mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
rpc_client: let cli_get_session_key() return talloced session key.
Thanks, Volker, for pointing this out. Guenther
This commit is contained in:
parent
a07fe72538
commit
b47899195e
@ -7130,7 +7130,8 @@ struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
|
||||
const char *username,
|
||||
const char *password,
|
||||
NTSTATUS *perr);
|
||||
NTSTATUS cli_get_session_key(struct rpc_pipe_client *cli,
|
||||
NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
|
||||
struct rpc_pipe_client *cli,
|
||||
DATA_BLOB *session_key);
|
||||
|
||||
|
||||
|
@ -268,7 +268,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx,
|
||||
ctr1 = ctr.ctr2.ctr.mszip1.ctr1;
|
||||
}
|
||||
|
||||
status = cli_get_session_key(ctx->cli, &ctx->session_key);
|
||||
status = cli_get_session_key(mem_ctx, ctx->cli, &ctx->session_key);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
@ -3341,7 +3341,8 @@ struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
|
||||
#endif
|
||||
}
|
||||
|
||||
NTSTATUS cli_get_session_key(struct rpc_pipe_client *cli,
|
||||
NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
|
||||
struct rpc_pipe_client *cli,
|
||||
DATA_BLOB *session_key)
|
||||
{
|
||||
if (!session_key || !cli) {
|
||||
@ -3354,15 +3355,20 @@ NTSTATUS cli_get_session_key(struct rpc_pipe_client *cli,
|
||||
|
||||
switch (cli->auth->auth_type) {
|
||||
case PIPE_AUTH_TYPE_SCHANNEL:
|
||||
*session_key = data_blob(cli->auth->a_u.schannel_auth->sess_key, 16);
|
||||
*session_key = data_blob_talloc(mem_ctx,
|
||||
cli->auth->a_u.schannel_auth->sess_key, 16);
|
||||
break;
|
||||
case PIPE_AUTH_TYPE_NTLMSSP:
|
||||
case PIPE_AUTH_TYPE_SPNEGO_NTLMSSP:
|
||||
*session_key = cli->auth->a_u.ntlmssp_state->session_key;
|
||||
*session_key = data_blob_talloc(mem_ctx,
|
||||
cli->auth->a_u.ntlmssp_state->session_key.data,
|
||||
cli->auth->a_u.ntlmssp_state->session_key.length);
|
||||
break;
|
||||
case PIPE_AUTH_TYPE_KRB5:
|
||||
case PIPE_AUTH_TYPE_SPNEGO_KRB5:
|
||||
*session_key = cli->auth->a_u.kerberos_auth->session_key;
|
||||
*session_key = data_blob_talloc(mem_ctx,
|
||||
cli->auth->a_u.kerberos_auth->session_key.data,
|
||||
cli->auth->a_u.kerberos_auth->session_key.length);
|
||||
break;
|
||||
case PIPE_AUTH_TYPE_NONE:
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user