summaryrefslogtreecommitdiff
path: root/source3/utils/net_rpc.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-09-26 15:15:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:14:46 -0500
commitbbaa0b178d834f4962ab440dff0e1837029369df (patch)
tree99d6b5c007301ffe8ce55deb3be43a0582a724c4 /source3/utils/net_rpc.c
parentcda3a18f2343d4c2f5ff8b08be6015eec37647c3 (diff)
downloadsamba-bbaa0b178d834f4962ab440dff0e1837029369df.tar.gz
samba-bbaa0b178d834f4962ab440dff0e1837029369df.tar.bz2
samba-bbaa0b178d834f4962ab440dff0e1837029369df.zip
r18919: * Get the new rpccli_winreg_XXXX() functions into the tree
There some broken functionality here that I'm still working on. * remove unneeded parsing routines (This used to be commit cbfe1a4b498593a48fc34f584754ed4a9ef72cc5)
Diffstat (limited to 'source3/utils/net_rpc.c')
-rw-r--r--source3/utils/net_rpc.c53
1 files changed, 20 insertions, 33 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index a09ed3cb3c..c22ffb9878 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -4937,7 +4937,7 @@ static NTSTATUS rpc_shutdown_abort_internals(const DOM_SID *domain_sid,
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- result = rpccli_shutdown_abort(pipe_hnd, mem_ctx);
+ result = rpccli_initshutdown_Abort(pipe_hnd, mem_ctx, NULL);
if (NT_STATUS_IS_OK(result)) {
d_printf("\nShutdown successfully aborted\n");
@@ -5038,6 +5038,8 @@ static NTSTATUS rpc_init_shutdown_internals(const DOM_SID *domain_sid,
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
const char *msg = "This machine will be shutdown shortly";
uint32 timeout = 20;
+ struct initshutdown_String msg_string;
+ struct initshutdown_String_sub s;
if (opt_comment) {
msg = opt_comment;
@@ -5046,9 +5048,12 @@ static NTSTATUS rpc_init_shutdown_internals(const DOM_SID *domain_sid,
timeout = opt_timeout;
}
+ s.name = msg;
+ msg_string.name = &s;
+
/* create an entry */
- result = rpccli_shutdown_init(pipe_hnd, mem_ctx, msg, timeout, opt_reboot,
- opt_force);
+ result = rpccli_initshutdown_Init(pipe_hnd, mem_ctx, NULL,
+ &msg_string, timeout, opt_force, opt_reboot);
if (NT_STATUS_IS_OK(result)) {
d_printf("\nShutdown of remote machine succeeded\n");
@@ -5083,55 +5088,37 @@ static NTSTATUS rpc_reg_shutdown_internals(const DOM_SID *domain_sid,
int argc,
const char **argv)
{
- WERROR result;
const char *msg = "This machine will be shutdown shortly";
uint32 timeout = 20;
-#if 0
- poptContext pc;
- int rc;
-
- struct poptOption long_options[] = {
- {"message", 'm', POPT_ARG_STRING, &msg},
- {"timeout", 't', POPT_ARG_INT, &timeout},
- {"reboot", 'r', POPT_ARG_NONE, &reboot},
- {"force", 'f', POPT_ARG_NONE, &force},
- { 0, 0, 0, 0}
- };
-
- pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
- POPT_CONTEXT_KEEP_FIRST);
+ struct initshutdown_String msg_string;
+ struct initshutdown_String_sub s;
+ NTSTATUS result;
- rc = poptGetNextOpt(pc);
-
- if (rc < -1) {
- /* an error occurred during option processing */
- DEBUG(0, ("%s: %s\n",
- poptBadOption(pc, POPT_BADOPTION_NOALIAS),
- poptStrerror(rc)));
- return NT_STATUS_INVALID_PARAMETER;
- }
-#endif
if (opt_comment) {
msg = opt_comment;
}
+ s.name = msg;
+ msg_string.name = &s;
+
if (opt_timeout) {
timeout = opt_timeout;
}
/* create an entry */
- result = rpccli_reg_shutdown(pipe_hnd, mem_ctx, msg, timeout, opt_reboot, opt_force);
+ result = rpccli_winreg_InitiateSystemShutdown(pipe_hnd, mem_ctx, NULL,
+ &msg_string, timeout, opt_force, opt_reboot);
- if (W_ERROR_IS_OK(result)) {
+ if (NT_STATUS_IS_OK(result)) {
d_printf("\nShutdown of remote machine succeeded\n");
} else {
d_fprintf(stderr, "\nShutdown of remote machine failed\n");
- if (W_ERROR_EQUAL(result,WERR_MACHINE_LOCKED))
+ if ( W_ERROR_EQUAL(ntstatus_to_werror(result),WERR_MACHINE_LOCKED) )
d_fprintf(stderr, "\nMachine locked, use -f switch to force\n");
else
- d_fprintf(stderr, "\nresult was: %s\n", dos_errstr(result));
+ d_fprintf(stderr, "\nresult was: %s\n", nt_errstr(result));
}
- return werror_to_ntstatus(result);
+ return result;
}
/**