]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libnet_join: make use of trust_pw_new_value()
authorStefan Metzmacher <metze@samba.org>
Tue, 23 Aug 2016 10:09:57 +0000 (12:09 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 25 Feb 2017 00:35:17 +0000 (01:35 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12262

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 77edef9555acd6e0c843582637bc367fa0d2a203)

source3/libnet/libnet_join.c

index bab58f3462e1ce8e4c8fc9dda48807e9bb7c569f..7e0afc1655ec54533365879fbb4907ea18799149 100644 (file)
@@ -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);
        }