summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-08-01 10:30:06 +0200
committerStefan Metzmacher <metze@samba.org>2012-08-01 14:17:14 +0200
commit616206a806761bb19bd7b6025d6068a867510bf5 (patch)
tree7baff1c9cfbbbd45e4499fff9360deab162c1b8d
parent8b42f526f47bc8075b5a6f81b2293787ccb066bc (diff)
downloadsamba-616206a806761bb19bd7b6025d6068a867510bf5.tar.gz
samba-616206a806761bb19bd7b6025d6068a867510bf5.tar.bz2
samba-616206a806761bb19bd7b6025d6068a867510bf5.zip
s3:libnet_join: make use of cli_get_session_key() in libnet_join_joindomain_rpc()
metze
-rw-r--r--source3/libnet/libnet_join.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index c9b2282b51..399c13a86a 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -853,6 +853,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
union samr_UserInfo user_info;
struct dcerpc_binding_handle *b = NULL;
+ DATA_BLOB session_key = data_blob_null;
struct samr_CryptPassword crypt_pwd;
struct samr_CryptPasswordEx crypt_pwd_ex;
@@ -888,6 +889,13 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
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;
+ }
+
status = dcerpc_samr_Connect2(b, mem_ctx,
pipe_hnd->desthost,
SAMR_ACCESS_ENUM_DOMAINS
@@ -1064,7 +1072,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
/* Set password on machine account - first try level 26 */
init_samr_CryptPasswordEx(r->in.machine_password,
- &cli->user_session_key,
+ &session_key,
&crypt_pwd_ex);
user_info.info26.password = crypt_pwd_ex;
@@ -1081,7 +1089,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
/* retry with level 24 */
init_samr_CryptPassword(r->in.machine_password,
- &cli->user_session_key,
+ &session_key,
&crypt_pwd);
user_info.info24.password = crypt_pwd;
@@ -1125,6 +1133,8 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
return status;
}
+ data_blob_clear_free(&session_key);
+
if (is_valid_policy_hnd(&sam_pol)) {
dcerpc_samr_Close(b, mem_ctx, &sam_pol, &result);
}