From: Stefan Metzmacher Date: Tue, 23 Aug 2016 10:09:57 +0000 (+0200) Subject: s3:libnet_join: make use of trust_pw_new_value() X-Git-Tag: samba-4.4.10~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9eaad88004af7d5856ba632b881457d41a053e3;p=thirdparty%2Fsamba.git s3:libnet_join: make use of trust_pw_new_value() BUG: https://bugzilla.samba.org/show_bug.cgi?id=12262 Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme (cherry picked from commit 77edef9555acd6e0c843582637bc367fa0d2a203) --- diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index bab58f3462e..7e0afc1655e 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1128,9 +1128,11 @@ static NTSTATUS libnet_join_joindomain_rpc_unsecure(TALLOC_CTX *mem_ctx, } if (!r->in.machine_password) { - r->in.machine_password = generate_random_password(mem_ctx, - DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH, - DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH); + int security = r->in.ads ? SEC_ADS : SEC_DOMAIN; + + r->in.machine_password = trust_pw_new_value(mem_ctx, + r->in.secure_channel_type, + security); if (r->in.machine_password == NULL) { TALLOC_FREE(frame); return NT_STATUS_NO_MEMORY; @@ -1223,9 +1225,11 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, } if (!r->in.machine_password) { - r->in.machine_password = generate_random_password(mem_ctx, - DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH, - DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH); + int security = r->in.ads ? SEC_ADS : SEC_DOMAIN; + + r->in.machine_password = trust_pw_new_value(mem_ctx, + r->in.secure_channel_type, + security); NT_STATUS_HAVE_NO_MEMORY(r->in.machine_password); }