svn commit: samba r10909 - in branches/SAMBA_3_0/source: include
libsmb utils
jmcd at samba.org
jmcd at samba.org
Tue Oct 11 18:42:27 GMT 2005
Author: jmcd
Date: 2005-10-11 18:42:25 +0000 (Tue, 11 Oct 2005)
New Revision: 10909
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10909
Log:
Give better shutdown messages
Modified:
branches/SAMBA_3_0/source/include/doserr.h
branches/SAMBA_3_0/source/libsmb/doserr.c
branches/SAMBA_3_0/source/utils/net_rpc.c
Changeset:
Modified: branches/SAMBA_3_0/source/include/doserr.h
===================================================================
--- branches/SAMBA_3_0/source/include/doserr.h 2005-10-11 17:36:29 UTC (rev 10908)
+++ branches/SAMBA_3_0/source/include/doserr.h 2005-10-11 18:42:25 UTC (rev 10909)
@@ -196,6 +196,7 @@
#define WERR_REG_FILE_INVALID W_ERROR(1017)
#define WERR_NO_SUCH_SERVICE W_ERROR(1060)
#define WERR_INVALID_SERVICE_CONTROL W_ERROR(1052)
+#define WERR_MACHINE_LOCKED W_ERROR(1271)
#define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338)
#define WERR_SERVER_UNAVAILABLE W_ERROR(1722)
#define WERR_INVALID_FORM_NAME W_ERROR(1902)
Modified: branches/SAMBA_3_0/source/libsmb/doserr.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/doserr.c 2005-10-11 17:36:29 UTC (rev 10908)
+++ branches/SAMBA_3_0/source/libsmb/doserr.c 2005-10-11 18:42:25 UTC (rev 10909)
@@ -66,6 +66,7 @@
{ "WERR_DFS_NO_SUCH_SERVER", WERR_DFS_NO_SUCH_SERVER },
{ "WERR_DFS_INTERNAL_ERROR", WERR_DFS_INTERNAL_ERROR },
{ "WERR_DFS_CANT_CREATE_JUNCT", WERR_DFS_CANT_CREATE_JUNCT },
+ { "WERR_MACHINE_LOCKED", WERR_MACHINE_LOCKED },
{ "WERR_INVALID_SECURITY_DESCRIPTOR", WERR_INVALID_SECURITY_DESCRIPTOR },
{ "WERR_INVALID_OWNER", WERR_INVALID_OWNER },
{ "WERR_SERVER_UNAVAILABLE", WERR_SERVER_UNAVAILABLE },
Modified: branches/SAMBA_3_0/source/utils/net_rpc.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_rpc.c 2005-10-11 17:36:29 UTC (rev 10908)
+++ branches/SAMBA_3_0/source/utils/net_rpc.c 2005-10-11 18:42:25 UTC (rev 10909)
@@ -4610,9 +4610,9 @@
if (NT_STATUS_IS_OK(result)) {
d_printf("\nShutdown of remote machine succeeded\n");
DEBUG(5,("Shutdown of remote machine succeeded\n"));
- } else
- DEBUG(0,("Shutdown of remote machine failed!\n"));
-
+ } else {
+ DEBUG(1,("Shutdown of remote machine failed!\n"));
+ }
return result;
}
@@ -4640,7 +4640,7 @@
int argc,
const char **argv)
{
- NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ WERROR result;
const char *msg = "This machine will be shutdown shortly";
uint32 timeout = 20;
#if 0
@@ -4676,16 +4676,19 @@
}
/* create an entry */
- result = werror_to_ntstatus(rpccli_reg_shutdown(pipe_hnd, mem_ctx, msg, timeout, opt_reboot, opt_force));
+ result = rpccli_reg_shutdown(pipe_hnd, mem_ctx, msg, timeout, opt_reboot, opt_force);
- if (NT_STATUS_IS_OK(result)) {
+ if (W_ERROR_IS_OK(result)) {
d_printf("\nShutdown of remote machine succeeded\n");
- DEBUG(5,("Shutdown of remote machine succeeded\n"));
+ } else {
+ d_printf("\nShutdown of remote machine failed\n");
+ if (W_ERROR_EQUAL(result,WERR_MACHINE_LOCKED))
+ d_printf("\nMachine locked, use -f switch to force\n");
+ else
+ d_printf("\nresult was: %s\n", dos_errstr(result));
}
- else
- DEBUG(0,("Shutdown of remote machine failed!\n"));
- return result;
+ return werror_to_ntstatus(result);
}
/**
@@ -4703,13 +4706,14 @@
int rc = run_rpc_command(NULL, PI_SHUTDOWN, 0,
rpc_init_shutdown_internals,
argc, argv);
- if (rc == 0)
- return rc;
- DEBUG(1, ("initshutdown pipe didn't work, trying winreg pipe\n"));
+ if (rc) {
+ DEBUG(1, ("initshutdown pipe failed, trying winreg pipe\n"));
+ rc = run_rpc_command(NULL, PI_WINREG, 0,
+ rpc_reg_shutdown_internals, argc, argv);
+ }
- return run_rpc_command(NULL, PI_WINREG, 0, rpc_reg_shutdown_internals,
- argc, argv);
+ return rc;
}
/***************************************************************************
More information about the samba-cvs
mailing list