diff options
author | Samuel Cabrero <scabrero@suse.de> | 2019-01-23 20:52:50 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-10-18 16:07:36 +0000 |
commit | 83def9a945f40892aaf0e4ea6ea7845d74bbaf7c (patch) | |
tree | a6c8a21d7a8b8d464d7d03335ce2f573fd086267 | |
parent | f402b937f4862843015686b8e28504fe588d0c5f (diff) | |
download | samba-83def9a945f40892aaf0e4ea6ea7845d74bbaf7c.tar.gz |
s4:rpc_server: Split dcerpc_generic_session_key for server and client
Split the common bits of dcerpc_generic_session_key to librpc and rename
client the specific part to dcecli_generic_session_key.
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | librpc/rpc/dcerpc_util.c | 10 | ||||
-rw-r--r-- | librpc/rpc/rpc_common.h | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_auth.c | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 9 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 2 |
6 files changed, 17 insertions, 10 deletions
diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c index 6bc97f7e7d8..103a24e9284 100644 --- a/librpc/rpc/dcerpc_util.c +++ b/librpc/rpc/dcerpc_util.c @@ -1340,3 +1340,13 @@ struct ndr_syntax_id dcerpc_construct_bind_time_features(uint64_t features) return s; } + +NTSTATUS dcerpc_generic_session_key(DATA_BLOB *session_key) +{ + *session_key = data_blob_null; + + /* this took quite a few CPU cycles to find ... */ + session_key->data = discard_const_p(unsigned char, "SystemLibraryDTC"); + session_key->length = 16; + return NT_STATUS_OK; +} diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h index f1535d74220..e109dfee4d6 100644 --- a/librpc/rpc/rpc_common.h +++ b/librpc/rpc/rpc_common.h @@ -445,4 +445,6 @@ struct ndr_syntax_id dcerpc_construct_bind_time_features(uint64_t features); (DCERPC_AUTH_PAD_ALIGNMENT - (stub_length) % DCERPC_AUTH_PAD_ALIGNMENT):\ 0) +NTSTATUS dcerpc_generic_session_key(DATA_BLOB *session_key); + #endif /* __DEFAULT_LIBRPC_RPCCOMMON_H__ */ diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index a0b00aff817..21ae5bcbd8d 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -144,7 +144,7 @@ static struct dcecli_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx, c->security_state.auth_type = DCERPC_AUTH_TYPE_NONE; c->security_state.auth_level = DCERPC_AUTH_LEVEL_NONE; c->security_state.auth_context_id = 0; - c->security_state.session_key = dcerpc_generic_session_key; + c->security_state.session_key = dcecli_generic_session_key; c->security_state.generic_state = NULL; c->flags = 0; /* diff --git a/source4/librpc/rpc/dcerpc_auth.c b/source4/librpc/rpc/dcerpc_auth.c index ea222c2706f..52dffec8ae4 100644 --- a/source4/librpc/rpc/dcerpc_auth.c +++ b/source4/librpc/rpc/dcerpc_auth.c @@ -523,7 +523,7 @@ NTSTATUS dcerpc_bind_auth_recv(struct composite_context *creq) after a successful authenticated bind the session key reverts to the generic session key */ - state->pipe->conn->security_state.session_key = dcerpc_generic_session_key; + state->pipe->conn->security_state.session_key = dcecli_generic_session_key; } talloc_free(creq); diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 39f7d87fc83..294ccfc1743 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -765,11 +765,9 @@ _PUBLIC_ NTSTATUS dcerpc_pipe_auth(TALLOC_CTX *mem_ctx, } -NTSTATUS dcerpc_generic_session_key(struct dcecli_connection *c, +NTSTATUS dcecli_generic_session_key(struct dcecli_connection *c, DATA_BLOB *session_key) { - *session_key = data_blob_null; - if (c != NULL) { if (c->transport.transport != NCALRPC && c->transport.transport != NCACN_UNIX_STREAM) @@ -778,10 +776,7 @@ NTSTATUS dcerpc_generic_session_key(struct dcecli_connection *c, } } - /* this took quite a few CPU cycles to find ... */ - session_key->data = discard_const_p(unsigned char, "SystemLibraryDTC"); - session_key->length = 16; - return NT_STATUS_OK; + return dcerpc_generic_session_key(session_key); } /* diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 146558de3b4..c16d76e0436 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -524,7 +524,7 @@ static NTSTATUS dcesrv_remote_session_key(struct dcesrv_auth *auth, static NTSTATUS dcesrv_local_fixed_session_key(struct dcesrv_auth *auth, DATA_BLOB *session_key) { - return dcerpc_generic_session_key(NULL, session_key); + return dcerpc_generic_session_key(session_key); } /* |