1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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>
This commit is contained in:
Samuel Cabrero 2019-01-23 20:52:50 +01:00 committed by Andreas Schneider
parent f402b937f4
commit 83def9a945
6 changed files with 17 additions and 10 deletions

View File

@ -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;
}

View File

@ -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__ */

View File

@ -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;
/*

View File

@ -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);

View File

@ -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);
}
/*

View File

@ -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);
}
/*