Merge from 2.2 to allow net rpc join -U to complete even if the workstation
authorTim Potter <tpot@samba.org>
Fri, 14 Dec 2001 02:17:18 +0000 (02:17 +0000)
committerTim Potter <tpot@samba.org>
Fri, 14 Dec 2001 02:17:18 +0000 (02:17 +0000)
account already exists.

# net rpc join --user=Administrator%password

It's kind of weird seeing the mix of NET.EXE style of options (net command
subcommand /arg:value) with the GNU-style long options.  I think it works.

source/utils/net_rpc_join.c

index 73ec2e593dd0d93912a92e04c0e0da4d98480191..c9fa52a7340bc42d33ae42ad5dafd4ae1979e03c 100644 (file)
@@ -138,13 +138,16 @@ int net_rpc_join(int argc, const char **argv)
                                          0xe005000b, &user_pol, 
                                          &user_rid);
 
-       /* We *must* do this.... don't ask... */
        if (!NT_STATUS_IS_OK(result) && 
            !NT_STATUS_EQUAL(result, NT_STATUS_USER_EXISTS)) {
                d_printf("Create of workstation account failed\n");
                goto done;
        }
-       cli_samr_close(cli, mem_ctx, &user_pol);
+
+       /* We *must* do this.... don't ask... */
+
+       if (NT_STATUS_IS_OK(result))
+               cli_samr_close(cli, mem_ctx, &user_pol);
 
        names = (char *)&acct_name[0];