sync 3.0 into HEAD for the last time
[vlendec/samba-autobuild/.git] / source3 / utils / net_rpc.c
index 890d4a012b131a07000dd97df05fe6d40ccab806..fefc5af3653d93e2efc9067020d3b8ed15e4ab76 100644 (file)
@@ -84,7 +84,14 @@ static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
        result = cli_lsa_query_info_policy(cli, mem_ctx, &pol, info_class, 
                                           domain_name, domain_sid);
        if (!NT_STATUS_IS_OK(result)) {
-               goto error;
+ error:
+               fprintf(stderr, "could not obtain sid for domain %s\n", cli->domain);
+
+               if (!NT_STATUS_IS_OK(result)) {
+                       fprintf(stderr, "error: %s\n", nt_errstr(result));
+               }
+
+               exit(1);
        }
 
        cli_lsa_close(cli, mem_ctx, &pol);
@@ -92,15 +99,6 @@ static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
        talloc_destroy(mem_ctx);
 
        return domain_sid;
-
- error:
-       fprintf(stderr, "could not obtain sid for domain %s\n", cli->domain);
-
-       if (!NT_STATUS_IS_OK(result)) {
-               fprintf(stderr, "error: %s\n", nt_errstr(result));
-       }
-
-       exit(1);
 }
 
 /**
@@ -1709,8 +1707,13 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, struct cli
 
 static int rpc_trustdom_add(int argc, const char **argv)
 {
-       return run_rpc_command(NULL, PI_SAMR, 0, rpc_trustdom_add_internals,
-                              argc, argv);
+       if (argc > 0) {
+               return run_rpc_command(NULL, PI_SAMR, 0, rpc_trustdom_add_internals,
+                                      argc, argv);
+       } else {
+               d_printf("Usage: net rpc trustdom add <domain>\n");
+               return -1;
+       }
 }
 
 
@@ -1726,6 +1729,7 @@ static int rpc_trustdom_add(int argc, const char **argv)
 static int rpc_trustdom_del(int argc, const char **argv)
 {
        d_printf("Sorry, not yet implemented.\n");
+       d_printf("Use 'smbpasswd -x -i' instead.\n");
        return -1;
 }
 
@@ -1782,7 +1786,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
 
        /* find the domain controller */
        if (!net_find_pdc(&server_ip, pdc_name, domain_name)) {
-               DEBUG(0, ("Coulnd find domain controller for domain %s\n", domain_name));
+               DEBUG(0, ("Couldn't find domain controller for domain %s\n", domain_name));
                return -1;
        }
 
@@ -1988,8 +1992,8 @@ static int rpc_trustdom_list(int argc, const char **argv)
        POLICY_HND connect_hnd;
        
        /* trusted domains listing variables */
-       int enum_ctx = 0;
-       int num_domains, i, pad_len, col_len = 20;
+       unsigned int num_domains, enum_ctx = 0;
+       int i, pad_len, col_len = 20;
        DOM_SID *domain_sids;
        char **trusted_dom_names;
        fstring pdc_name, dummy;