r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
[samba.git] / source3 / utils / net_rpc_join.c
index eb91a7df61292f45e2a23d8c322b65c5e587606f..79c632f8314d37b78a227ced1b4fc3e8e6ad2007 100644 (file)
@@ -19,7 +19,7 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
 #include "includes.h"
-#include "../utils/net.h"
+#include "utils/net.h"
 
 /* Macro for checking RPC error codes to make things more readable */
 
@@ -42,7 +42,7 @@
  * @return A shell status integer (0 for success)
  *
  **/
-int net_rpc_join_ok(const char *domain)
+static int net_rpc_join_ok(const char *domain)
 {
        struct cli_state *cli;
        uchar stored_md4_trust_password[16];
@@ -115,8 +115,6 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        /* Password stuff */
 
        char *clear_trust_password = NULL;
-       fstring ucs2_trust_password;
-       int ucs2_pw_len;
        uchar pwbuf[516];
        SAM_USERINFO_CTR ctr;
        SAM_USER_INFO_24 p24;
@@ -260,16 +258,11 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        { 
                char *str;
                str = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
-               clear_trust_password = strdup(str);
+               clear_trust_password = SMB_STRDUP(str);
                E_md4hash(clear_trust_password, md4_trust_password);
        }
 
-       ucs2_pw_len = push_ucs2(NULL, ucs2_trust_password, 
-                               clear_trust_password, 
-                               sizeof(ucs2_trust_password), 0);
-                 
-       encode_pw_buffer((char *)pwbuf, ucs2_trust_password,
-                        ucs2_pw_len);
+       encode_pw_buffer(pwbuf, clear_trust_password, STR_UNICODE);
 
        /* Set password on machine account */