Fix all warnings in source3 with gcc4.3.
[samba.git] / source3 / utils / net_rpc.c
index d3b10019d48ba68da06018d5ea0eeee5791533f9..e0d606c19ae937e726265eebdf902f8ed749670f 100644 (file)
@@ -749,7 +749,9 @@ static int rpc_user_password(struct net_context *c, int argc, const char **argv)
        if (argv[1]) {
                u1003.usri1003_password = argv[1];
        } else {
-               asprintf(&prompt, "Enter new password for %s:", argv[0]);
+               if (asprintf(&prompt, "Enter new password for %s:", argv[0]) == -1) {
+                       return -1;
+               }
                u1003.usri1003_password = getpass(prompt);
                SAFE_FREE(prompt);
        }
@@ -3133,7 +3135,7 @@ static NTSTATUS rpc_share_migrate_shares_internals(struct net_context *c,
                }
 
                if (!NT_STATUS_IS_OK(nt_status) || !W_ERROR_IS_OK(result)) {
-                       printf("cannot add share: %s\n", dos_errstr(result));
+                       printf("cannot add share: %s\n", win_errstr(result));
                        goto done;
                }
 
@@ -3580,7 +3582,7 @@ static NTSTATUS rpc_share_migrate_security_internals(struct net_context *c,
                                                          &parm_error,
                                                          &result);
                if (!NT_STATUS_IS_OK(nt_status) || !W_ERROR_IS_OK(result)) {
-                       printf("cannot set share-acl: %s\n", dos_errstr(result));
+                       printf("cannot set share-acl: %s\n", win_errstr(result));
                        goto done;
                }
 
@@ -5075,7 +5077,7 @@ NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
                if ( W_ERROR_EQUAL(werr, WERR_MACHINE_LOCKED) )
                        d_fprintf(stderr, "\nMachine locked, use -f switch to force\n");
                else
-                       d_fprintf(stderr, "\nresult was: %s\n", dos_errstr(werr));
+                       d_fprintf(stderr, "\nresult was: %s\n", win_errstr(werr));
        }
 
        return result;
@@ -5250,10 +5252,11 @@ static NTSTATUS rpc_trustdom_add_internals(struct net_context *c,
                                      notime, notime, notime,
                                      NULL, NULL, NULL, NULL, NULL,
                                      NULL, NULL, NULL, NULL, &parameters,
-                                     0, 0, ACB_DOMTRUST, SAMR_FIELD_ACCT_FLAGS,
+                                     0, 0, ACB_DOMTRUST,
+                                     SAMR_FIELD_ACCT_FLAGS | SAMR_FIELD_NT_PASSWORD_PRESENT,
                                      hours,
                                      0, 0, 0, 0, 0, 0, 0,
-                                     crypt_pwd.data, 24);
+                                     &crypt_pwd);
 
                result = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
                                                  &user_pol,
@@ -5532,7 +5535,9 @@ static int rpc_trustdom_establish(struct net_context *c, int argc,
        strupper_m(domain_name);
 
        /* account name used at first is our domain's name with '$' */
-       asprintf(&acct_name, "%s$", lp_workgroup());
+       if (asprintf(&acct_name, "%s$", lp_workgroup()) == -1) {
+               return -1;
+       }
        strupper_m(acct_name);
 
        /*
@@ -6325,7 +6330,8 @@ bool net_rpc_check(struct net_context *c, unsigned flags)
        if (!attempt_netbios_session_request(&cli, global_myname(),
                                             server_name, &server_ss))
                goto done;
-       if (!cli_negprot(cli))
+       status = cli_negprot(cli);
+       if (!NT_STATUS_IS_OK(status))
                goto done;
        if (cli->protocol < PROTOCOL_NT1)
                goto done;
@@ -6370,6 +6376,14 @@ static int rpc_vampire(struct net_context *c, int argc, const char **argv)
                        "net rpc vampire keytab\n"
                        "    Dump remote SAM database to Kerberos keytab file"
                },
+               {
+                       "passdb",
+                       rpc_vampire_passdb,
+                       NET_TRANSPORT_RPC,
+                       "Dump remote SAM database to passdb",
+                       "net rpc vampire passdb\n"
+                       "    Dump remote SAM database to passdb"
+               },
 
                {NULL, NULL, 0, NULL, NULL}
        };