Fix all warnings in source3 with gcc4.3.
[nivanova/samba-autobuild/.git] / source3 / utils / net_rpc_join.c
index 5bc38f979f4a891342db5f84e73c5023d076fb5b..8070a6282b7ee7b39da4c42d0698c21c9c6f8c92 100644 (file)
@@ -330,12 +330,8 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
        
        /* Create a random machine account password */
 
-       { 
-               char *str;
-               str = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
-               clear_trust_password = SMB_STRDUP(str);
-               E_md4hash(clear_trust_password, md4_trust_password);
-       }
+       clear_trust_password = generate_random_str(talloc_tos(), DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
+       E_md4hash(clear_trust_password, md4_trust_password);
 
        /* Set password on machine account */
 
@@ -343,7 +339,8 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
                                &cli->user_session_key,
                                &crypt_pwd);
 
-       init_samr_user_info24(&set_info.info24, crypt_pwd.data, 24);
+       init_samr_user_info24(&set_info.info24, &crypt_pwd,
+                             PASS_DONT_CHANGE_AT_NEXT_LOGON);
 
        CHECK_RPC_ERR(rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
                                               &user_pol,
@@ -468,7 +465,7 @@ done:
 
        cli_shutdown(cli);
 
-       SAFE_FREE(clear_trust_password);
+       TALLOC_FREE(clear_trust_password);
 
        return retval;
 }