[PATCH] and question - net rpc shutdown

Willi Mann newsletters at wm1.at
Mon Dec 23 19:21:01 GMT 2002


Hi!

This patch corrects a problem with the default comment for net rpc 
shutdown.
(diff against 3.0)

My power off - problem persists because net rpc shutdown is similar to 
InitiateSystemShutdown, which is not able to power off the computer. In 
my research I've found out that powering off needs a Remote API call (if 
my interpretations of the data on the wire are correct). Is there any 
function in Samba which can send a remote API call?

Thanks

Willi


Index: utils/net.c
===================================================================
RCS file: /cvsroot/samba/source/utils/net.c,v
retrieving revision 1.43.2.8
diff -u -r1.43.2.8 net.c
--- utils/net.c 12 Nov 2002 23:20:49 -0000      1.43.2.8
+++ utils/net.c 23 Dec 2002 18:45:15 -0000
@@ -68,6 +68,7 @@
 int opt_port = 0;
 int opt_maxusers = -1;
 char *opt_comment = "";
+BOOL opt_comment_specified = False;
 int opt_flags = -1;
 int opt_jobid = 0;
 int opt_timeout = 0;
@@ -446,7 +447,7 @@
                {"myname",      'n', POPT_ARG_STRING, &opt_requester_name},
                {"conf",        's', POPT_ARG_STRING, &servicesf},
                {"server",      'S', POPT_ARG_STRING, &opt_host},
-               {"comment",     'C', POPT_ARG_STRING, &opt_comment},
+               {"comment",     'C', POPT_ARG_STRING, &opt_comment,'C'},
                {"maxusers",    'M', POPT_ARG_INT,    &opt_maxusers},
                {"flags",       'F', POPT_ARG_INT,    &opt_flags},
                {"jobid",       'j', POPT_ARG_INT,    &opt_jobid},
@@ -487,6 +488,9 @@
                                *p = 0;
                                opt_password = p+1;
                        }
+                       break;
+               case 'C':
+                       opt_comment_specified = True;
                        break;
                default:
                        d_printf("\nInvalid option %c (%d)\n", 
(char)opt, opt);
Index: utils/net.h
===================================================================
RCS file: /cvsroot/samba/source/utils/net.h,v
retrieving revision 1.7.2.1
diff -u -r1.7.2.1 net.h
--- utils/net.h 15 Jul 2002 10:35:23 -0000      1.7.2.1
+++ utils/net.h 23 Dec 2002 18:45:25 -0000
@@ -38,6 +38,7 @@

 extern int opt_maxusers;
 extern char *opt_comment;
+extern BOOL opt_comment_specified;
 extern int opt_flags;

 extern char *opt_comment;
Index: utils/net_rpc.c
===================================================================
RCS file: /cvsroot/samba/source/utils/net_rpc.c,v
retrieving revision 1.14.2.10
diff -u -r1.14.2.10 net_rpc.c
--- utils/net_rpc.c     20 Dec 2002 20:21:31 -0000      1.14.2.10
+++ utils/net_rpc.c     23 Dec 2002 18:45:34 -0000
@@ -1478,7 +1478,7 @@
        if (force) {
                flgs |= REG_FORCE_SHUTDOWN;
        }
-       if (opt_comment) {
+       if (opt_comment_specified) {
                msg = opt_comment;
        }
        if (opt_timeout) {





More information about the samba-technical mailing list