s3-rpc_client: Rename get_query_dispinfo_params.
[ira/wip.git] / source3 / utils / net_rpc.c
index 135b5e4ec456bb61ae4652decae148ae91042fd2..158e4d501a0810762c2a4a2116af5cd0f214aeac 100644 (file)
@@ -30,9 +30,9 @@
 #include "rpc_client/cli_lsarpc.h"
 #include "../librpc/gen_ndr/ndr_netlogon_c.h"
 #include "../librpc/gen_ndr/ndr_srvsvc_c.h"
-#include "../librpc/gen_ndr/cli_spoolss.h"
+#include "../librpc/gen_ndr/ndr_spoolss.h"
 #include "../librpc/gen_ndr/ndr_initshutdown_c.h"
-#include "../librpc/gen_ndr/cli_winreg.h"
+#include "../librpc/gen_ndr/ndr_winreg_c.h"
 #include "secrets.h"
 #include "lib/netapi/netapi.h"
 #include "lib/netapi/netapi_net.h"
@@ -952,7 +952,7 @@ static int rpc_user_list(struct net_context *c, int argc, const char **argv)
        do {
                uint32_t max_entries, max_size;
 
-               get_query_dispinfo_params(
+               dcerpc_get_query_dispinfo_params(
                        loop_count, &max_entries, &max_size);
 
                status = NetQueryDisplayInformation(c->opt_host,
@@ -2348,7 +2348,7 @@ static NTSTATUS rpc_group_list_internals(struct net_context *c,
 
                if (!global) break;
 
-               get_query_dispinfo_params(
+               dcerpc_get_query_dispinfo_params(
                        loop_count, &max_entries, &max_size);
 
                result = rpccli_samr_QueryDisplayInfo(pipe_hnd, mem_ctx,
@@ -4386,7 +4386,6 @@ static bool get_user_tokens(struct net_context *c, int *num_tokens,
                }
 
                get_user_sids(domain, user, &(result[i].token));
-               i+=1;
        }
        TALLOC_FREE(frame);
        wbcFreeMemory(users);
@@ -5154,16 +5153,22 @@ static NTSTATUS rpc_reg_shutdown_abort_internals(struct net_context *c,
                                                const char **argv)
 {
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+       WERROR werr;
+       struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
 
-       result = rpccli_winreg_AbortSystemShutdown(pipe_hnd, mem_ctx, NULL, NULL);
+       result = dcerpc_winreg_AbortSystemShutdown(b, mem_ctx, NULL, &werr);
 
-       if (NT_STATUS_IS_OK(result)) {
+       if (!NT_STATUS_IS_OK(result)) {
+               DEBUG(5,("cmd_reg_abort_shutdown: query failed\n"));
+               return result;
+       }
+       if (W_ERROR_IS_OK(werr)) {
                d_printf(_("\nShutdown successfully aborted\n"));
                DEBUG(5,("cmd_reg_abort_shutdown: query succeeded\n"));
        } else
                DEBUG(5,("cmd_reg_abort_shutdown: query failed\n"));
 
-       return result;
+       return werror_to_ntstatus(werr);
 }
 
 /**
@@ -5292,6 +5297,7 @@ NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
        struct lsa_StringLarge msg_string;
        NTSTATUS result;
        WERROR werr;
+       struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
 
        if (c->opt_comment) {
                msg = c->opt_comment;
@@ -5303,11 +5309,15 @@ NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
        }
 
        /* create an entry */
-       result = rpccli_winreg_InitiateSystemShutdown(pipe_hnd, mem_ctx, NULL,
+       result = dcerpc_winreg_InitiateSystemShutdown(b, mem_ctx, NULL,
                        &msg_string, timeout, c->opt_force, c->opt_reboot,
                        &werr);
+       if (!NT_STATUS_IS_OK(result)) {
+               d_fprintf(stderr, "\nShutdown of remote machine failed\n");
+               return result;
+       }
 
-       if (NT_STATUS_IS_OK(result)) {
+       if (W_ERROR_IS_OK(werr)) {
                d_printf(_("\nShutdown of remote machine succeeded\n"));
        } else {
                d_fprintf(stderr, "\nShutdown of remote machine failed\n");
@@ -5317,7 +5327,7 @@ NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
                        d_fprintf(stderr, "\nresult was: %s\n", win_errstr(werr));
        }
 
-       return result;
+       return werror_to_ntstatus(werr);
 }
 
 /**