summaryrefslogtreecommitdiff
path: root/source3/utils/net_rpc_join.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-08-01 10:48:53 +0200
committerStefan Metzmacher <metze@samba.org>2012-08-01 14:17:15 +0200
commit0068a9fd930331e6f2ee49aa79489c333ae4e722 (patch)
tree962f67b0b130db046ffde5008a6486ea6d2d2437 /source3/utils/net_rpc_join.c
parent616206a806761bb19bd7b6025d6068a867510bf5 (diff)
downloadsamba-0068a9fd930331e6f2ee49aa79489c333ae4e722.tar.gz
s3:utils/net_rpc*: make use of cli_get_session_key()
metze
Diffstat (limited to 'source3/utils/net_rpc_join.c')
-rw-r--r--source3/utils/net_rpc_join.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index f89ffb8b10f..2e3e240a3f7 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -186,6 +186,7 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
/* Password stuff */
+ DATA_BLOB session_key = data_blob_null;
char *clear_trust_password = NULL;
struct samr_CryptPassword crypt_pwd;
uchar md4_trust_password[16];
@@ -289,6 +290,13 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
b = pipe_hnd->binding_handle;
+ status = cli_get_session_key(mem_ctx, pipe_hnd, &session_key);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("Error getting session_key of SAM pipe. Error was %s\n",
+ nt_errstr(status)));
+ goto done;
+ }
+
CHECK_DCERPC_ERR(dcerpc_samr_Connect2(b, mem_ctx,
pipe_hnd->desthost,
SAMR_ACCESS_ENUM_DOMAINS
@@ -396,7 +404,7 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
/* Set password on machine account */
init_samr_CryptPassword(clear_trust_password,
- &cli->user_session_key,
+ &session_key,
&crypt_pwd);
set_info.info24.password = crypt_pwd;
@@ -532,6 +540,7 @@ done:
cli_shutdown(cli);
TALLOC_FREE(clear_trust_password);
+ data_blob_clear_free(&session_key);
return retval;
}