summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/libnet/libnet_dssync.c2
-rw-r--r--source3/rpc_client/cli_pipe.c14
3 files changed, 13 insertions, 6 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 70ab390dc1..1aca7f436d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c
index 63a5c8bef1..b1392acd7e 100644
--- a/source3/libnet/libnet_dssync.c
+++ b/source3/libnet/libnet_dssync.c
@@ -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;
}
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 469142d146..da81417220 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -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: