summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-06-25 00:21:37 +0200
committerGünther Deschner <gd@samba.org>2008-06-25 09:51:31 +0200
commit92bd665aea68ee8d198f72c95af5da487efcfc36 (patch)
tree62db2b32e94a20743b91fa0fa87872b46bf8fd15
parentda70f8ab1ec840bbdcc73c22c4d4c54705c83980 (diff)
downloadsamba-92bd665aea68ee8d198f72c95af5da487efcfc36.tar.gz
samba-92bd665aea68ee8d198f72c95af5da487efcfc36.tar.bz2
samba-92bd665aea68ee8d198f72c95af5da487efcfc36.zip
rpc_client: let cli_get_session_key() return talloced session key.
Thanks, Volker, for pointing this out. Guenther (This used to be commit b47899195e0c190445953243fe80da4e92994dd1)
-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: