]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: use generate_random_password() instead of generate_random_str()
authorStefan Metzmacher <metze@samba.org>
Fri, 1 Feb 2013 12:14:05 +0000 (13:14 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 4 Feb 2013 16:14:22 +0000 (17:14 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/libads/util.c
source3/libnet/libnet_join.c
source3/libsmb/trusts_util.c
source3/utils/net_rpc_join.c
source3/utils/net_rpc_trust.c

index 6a6b42afc432679b8fa3e3648ad36f1aef03e847..2e22bca02e5a58c89d218e3f236e9a508d7ca906 100644 (file)
@@ -35,8 +35,10 @@ ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_princip
                return ADS_ERROR_SYSTEM(ENOENT);
        }
 
-       new_password = generate_random_str(talloc_tos(), DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
-    
+       new_password = generate_random_password(talloc_tos(),
+                               DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH,
+                               DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
+
        ret = kerberos_set_password(ads->auth.kdc_server, host_principal, password, host_principal, new_password, ads->auth.time_offset);
 
        if (!ADS_ERR_OK(ret)) {
index d6aa7937ee59bb2500a85948d9551d5b02a9585e..3d0a6d30b89d17df00ce56d6444caedaee07e88d 100644 (file)
@@ -811,7 +811,9 @@ static NTSTATUS libnet_join_joindomain_rpc_unsecure(TALLOC_CTX *mem_ctx,
        }
 
        if (!r->in.machine_password) {
-               r->in.machine_password = generate_random_str(mem_ctx, DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
+               r->in.machine_password = generate_random_password(mem_ctx,
+                               DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH,
+                               DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
                NT_STATUS_HAVE_NO_MEMORY(r->in.machine_password);
        }
 
@@ -882,7 +884,9 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
        }
 
        if (!r->in.machine_password) {
-               r->in.machine_password = generate_random_str(mem_ctx, DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
+               r->in.machine_password = generate_random_password(mem_ctx,
+                               DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH,
+                               DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
                NT_STATUS_HAVE_NO_MEMORY(r->in.machine_password);
        }
 
index be1f1f8971f5d5f42b1b31e053ea34ec66b417a9..0d039bc812e8eac127c53050e25176956d003e3d 100644 (file)
@@ -52,10 +52,11 @@ NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *m
        }
 
        /* Create a random machine account password */
-       new_trust_passwd = generate_random_str(mem_ctx, DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
-
+       new_trust_passwd = generate_random_password(mem_ctx,
+                               DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH,
+                               DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
        if (new_trust_passwd == NULL) {
-               DEBUG(0, ("talloc_strdup failed\n"));
+               DEBUG(0, ("generate_random_password failed\n"));
                return NT_STATUS_NO_MEMORY;
        }
 
index ed81aacac790be656eace3b2407fa0b93ddf0cdf..7167cf9f3c46ca1bb7c6f059e736f9b57fd6bdd7 100644 (file)
@@ -401,7 +401,9 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
        
        /* Create a random machine account password */
 
-       clear_trust_password = generate_random_str(talloc_tos(), DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
+       clear_trust_password = generate_random_password(talloc_tos(),
+                                       DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH,
+                                       DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
        E_md4hash(clear_trust_password, md4_trust_password);
 
        /* Set password on machine account */
index d15d10c0d421c780b715d186baf7e76cc7224df6..9060700be1d8197aa261897fbe2a7e2ad716f8a8 100644 (file)
@@ -518,11 +518,11 @@ static int rpc_trust_common(struct net_context *net_ctx, int argc,
                        }
 
                        DEBUG(0, ("Using random trust password.\n"));
-       /* FIXME: why only 8 characters work? Would it be possible to use a
-        * random binary password? */
-                       trust_pw = generate_random_str(mem_ctx, 8);
+                       trust_pw = generate_random_password(mem_ctx,
+                                       DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH,
+                                       DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
                        if (trust_pw == NULL) {
-                               DEBUG(0, ("generate_random_str failed.\n"));
+                               DEBUG(0, ("generate_random_password failed.\n"));
                                goto done;
                        }
                } else {