From: Günther Deschner Date: Fri, 29 Feb 2008 00:27:52 +0000 (+0100) Subject: libnetjoin: add fallback to level 24 samr setinfo so that libnet can join NT4. X-Git-Tag: samba-3.2.0pre2~37^2~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc2d3d51449831146a9faf6e809e7a91d174659c;p=thirdparty%2Fsamba.git libnetjoin: add fallback to level 24 samr setinfo so that libnet can join NT4. Guenther --- diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c index b8572f68b5b..1a8486f5b51 100644 --- a/source/libnet/libnet_join.c +++ b/source/libnet/libnet_join.c @@ -883,6 +883,25 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, &user_pol, 25, &user_info); + + if (NT_STATUS_EQUAL(status, NT_STATUS(DCERPC_FAULT_INVALID_TAG))) { + + uchar pwbuf2[516]; + + encode_pw_buffer(pwbuf2, r->in.machine_password, STR_UNICODE); + + /* retry with level 24 */ + init_samr_user_info24(&user_info.info24, pwbuf2, 24); + + SamOEMhashBlob(user_info.info24.password.data, 516, + &cli->user_session_key); + + status = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx, + &user_pol, + 24, + &user_info); + } + if (!NT_STATUS_IS_OK(status)) { libnet_join_set_error_string(mem_ctx, r, "Failed to set password for machine account (%s)\n",