Hi all, here's a patch witch adds a -D option and -V option to winbindd.
I think smbd, nmbd and wrepld have also this options and so it would be nice to keep them in sync. I also update the docu for this change. metze ----------------------------------------------------------------------------- Stefan "metze" Metzmacher <[EMAIL PROTECTED]>
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/nsswitch/winbindd.c HEAD-fix/source/nsswitch/winbindd.c --- HEAD/source/nsswitch/winbindd.c Wed Sep 18 09:44:23 2002 +++ HEAD-fix/source/nsswitch/winbindd.c Tue Oct 1 10:48:19 2002 @@ -742,12 +742,14 @@ struct winbindd_state server_state; /* static void usage(void) { printf("Usage: winbindd [options]\n"); + printf("\t-D daemon mode(default)\n"); printf("\t-i interactive mode\n"); printf("\t-B dual daemon mode\n"); printf("\t-n disable cacheing\n"); printf("\t-d level set debug level\n"); printf("\t-s configfile choose smb.conf location\n"); printf("\t-h show this help message\n"); + printf("\t-V Print version\n"); } int main(int argc, char **argv) @@ -758,6 +760,7 @@ static void usage(void) extern BOOL append_log; pstring logfile; int accept_sock; + BOOL is_daemon = False; BOOL interactive = False; int opt; @@ -788,11 +791,24 @@ static void usage(void) /* Initialise samba/rpc client stuff */ - while ((opt = getopt(argc, argv, "id:s:nhB")) != EOF) { + while ((opt = getopt(argc, argv, "id:s:DnhBV")) != EOF) { switch (opt) { + /* Become a deamon(default) */ + case 'D': + if (interactive) { + printf("Option %c can't be used with option -i\n", +(char)opt);; + exit(1); + } + is_daemon = True; + break; + /* Don't become a daemon */ case 'i': + if (is_daemon) { + printf("Option %c can't be used with option -D\n", +(char)opt);; + exit(1); + } interactive = True; break; @@ -820,13 +836,24 @@ static void usage(void) case 'h': usage(); exit(0); - + break; + + case 'V': + printf("Version %s\n",VERSION); + exit(0); + break; + default: printf("Unknown option %c\n", (char)opt); exit(1); } } + /* use daemon mode as default */ + if (!interactive) { + is_daemon = True; + } + snprintf(logfile, sizeof(logfile), "%s/log.winbindd", dyn_LOGFILEBASE); lp_set_logfile(logfile); setup_logging("winbindd", interactive); @@ -853,7 +880,7 @@ static void usage(void) fstrcpy(global_myworkgroup, lp_workgroup()); - if (!interactive) { + if (is_daemon) { become_daemon(); pidfile_create("winbindd"); }
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/docs/docbook/manpages/smbd.8.sgml HEAD-fix/docs/docbook/manpages/smbd.8.sgml --- HEAD/docs/docbook/manpages/smbd.8.sgml Wed May 8 17:34:58 2002 +++ HEAD-fix/docs/docbook/manpages/smbd.8.sgml Tue Oct 1 10:44:48 2002 @@ -197,7 +197,7 @@ <term>-p <port number></term> <listitem><para><replaceable>port number</replaceable> is a positive integer value. The default value if this parameter is not - specified is 139.</para> + specified is 139 and 445.</para> <para>This number is the port number that will be used when making connections to the server from client diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/docs/docbook/manpages/winbindd.8.sgml HEAD-fix/docs/docbook/manpages/winbindd.8.sgml --- HEAD/docs/docbook/manpages/winbindd.8.sgml Fri Sep 27 23:05:24 2002 +++ HEAD-fix/docs/docbook/manpages/winbindd.8.sgml Tue Oct 1 10:49:17 2002 @@ -16,9 +16,13 @@ <refsynopsisdiv> <cmdsynopsis> <command>winbindd</command> - <arg choice="opt">-i</arg> + <arg choice="opt">-D|-i</arg> + <arg choice="opt">-B</arg> + <arg choice="opt">-n</arg> <arg choice="opt">-d <debug level></arg> <arg choice="opt">-s <smb config file></arg> + <arg choice="opt">-h</arg> + <arg choice="opt">-V</arg> </cmdsynopsis> </refsynopsisdiv> @@ -104,6 +108,36 @@ group: files winbind <variablelist> <varlistentry> + <term>-D</term> + <listitem><para>Tells <command>winbindd</command> to + become a daemon and detach from the current terminal. This + option is the default behavior of <command>winbindd</command>. + </para></listitem> + </varlistentry> + + <varlistentry> + <term>-i</term> + <listitem><para>Tells <command>winbindd</command> to not + become a daemon and detach from the current terminal. This + option is used by developers when interactive debugging + of <command>winbindd</command> is required. </para></listitem> + </varlistentry> + + <varlistentry> + <term>-B</term> + <listitem><para>Tells <command>winbindd</command> to + run in dual daemon mode. + </para></listitem> + </varlistentry> + + <varlistentry> + <term>-n</term> + <listitem><para>Tells <command>winbindd</command> to + not use its internal cache. + </para></listitem> + </varlistentry> + + <varlistentry> <term>-d debuglevel</term> <listitem><para>Sets the debuglevel to an integer between 0 and 100. 0 is for no debugging and 100 is for reams and @@ -112,11 +146,28 @@ group: files winbind </varlistentry> <varlistentry> - <term>-i</term> - <listitem><para>Tells <command>winbindd</command> to not - become a daemon and detach from the current terminal. This - option is used by developers when interactive debugging - of <command>winbindd</command> is required. </para></listitem> + <term>-s config file</term> + <listitem><para>The file specified contains the + configuration details required by the server. The + information in this file includes server-specific + information such as what printcap file to use, as well + as descriptions of all the services that the server is + to provide. See <ulink url="smb.conf.5.html"><filename> + smb.conf(5)</filename></ulink> for more information. + The default configuration file name is determined at + compile time.</para></listitem> + </varlistentry> + + <varlistentry> + <term>-h</term> + <listitem><para>Prints the help information (usage) + for <command>smbd</command>.</para></listitem> + </varlistentry> + + <varlistentry> + <term>-v</term> + <listitem><para>Prints the version number for + <command>smbd</command>.</para></listitem> </varlistentry> </variablelist> </refsect1>