diff options
-rw-r--r-- | docs/docbook/manpages/nmbd.8.sgml | 29 | ||||
-rw-r--r-- | docs/docbook/manpages/smbd.8.sgml | 28 | ||||
-rw-r--r-- | docs/docbook/manpages/winbindd.8.sgml | 29 | ||||
-rw-r--r-- | docs/htmldocs/nmbd.8.html | 69 | ||||
-rw-r--r-- | docs/htmldocs/pdbedit.8.html | 144 | ||||
-rw-r--r-- | docs/htmldocs/smbd.8.html | 76 | ||||
-rw-r--r-- | docs/htmldocs/smbpasswd.8.html | 67 | ||||
-rw-r--r-- | docs/htmldocs/testparm.1.html | 43 | ||||
-rw-r--r-- | docs/htmldocs/wbinfo.1.html | 37 | ||||
-rw-r--r-- | docs/manpages/nmbd.8 | 25 | ||||
-rw-r--r-- | docs/manpages/smbd.8 | 25 | ||||
-rw-r--r-- | docs/manpages/smbgroupedit.8 | 4 | ||||
-rw-r--r-- | docs/manpages/winbindd.8 | 25 | ||||
-rw-r--r-- | source3/lib/debug.c | 1 | ||||
-rw-r--r-- | source3/lib/util.c | 9 | ||||
-rw-r--r-- | source3/nmbd/nmbd.c | 24 | ||||
-rw-r--r-- | source3/nsswitch/winbindd.c | 24 | ||||
-rw-r--r-- | source3/smbd/server.c | 18 | ||||
-rw-r--r-- | source3/web/startstop.c | 6 | ||||
-rw-r--r-- | source3/wrepld/server.c | 25 |
20 files changed, 553 insertions, 155 deletions
diff --git a/docs/docbook/manpages/nmbd.8.sgml b/docs/docbook/manpages/nmbd.8.sgml index b8986110a6..db920c79a1 100644 --- a/docs/docbook/manpages/nmbd.8.sgml +++ b/docs/docbook/manpages/nmbd.8.sgml @@ -17,6 +17,8 @@ <cmdsynopsis> <command>nmbd</command> <arg choice="opt">-D</arg> + <arg choice="opt">-F</arg> + <arg choice="opt">-S</arg> <arg choice="opt">-a</arg> <arg choice="opt">-i</arg> <arg choice="opt">-o</arg> @@ -87,6 +89,28 @@ </varlistentry> <varlistentry> + <term>-F</term> + <listitem><para>If specified, this parameter causes + the main <command>nmbd</command> process to not daemonize, + i.e. double-fork and disassociate with the terminal. + Child processes are still created as normal to service + each connection request, but the main process does not + exit. This operation mode is suitable for running + <command>nmbd</command> under process supervisors such + as <command>supervise</command> and <command>svscan</command> + from Daniel J. Bernstein's <command>daemontools</command> + package, or the AIX process monitor. + </para></listitem> + </varlistentry> + + <varlistentry> + <term>-S</term> + <listitem><para>If specified, this parameter causes + <command>nmbd</command> to log to standard output rather + than a file.</para></listitem> + </varlistentry> + + <varlistentry> <term>-a</term> <listitem><para>If this parameter is specified, each new connection will append log messages to the log file. @@ -99,8 +123,9 @@ server to run "interactively", not as a daemon, even if the server is executed on the command line of a shell. Setting this parameter negates the implicit daemon mode when run from the - command line. - </para></listitem> + command line. <command>nmbd</command> also logs to standard + output, as if the <command>-S</command> parameter had been + given. </para></listitem> </varlistentry> <varlistentry> diff --git a/docs/docbook/manpages/smbd.8.sgml b/docs/docbook/manpages/smbd.8.sgml index 4ae8b3148b..9fb80901be 100644 --- a/docs/docbook/manpages/smbd.8.sgml +++ b/docs/docbook/manpages/smbd.8.sgml @@ -16,6 +16,8 @@ <cmdsynopsis> <command>smbd</command> <arg choice="opt">-D</arg> + <arg choice="opt">-F</arg> + <arg choice="opt">-S</arg> <arg choice="opt">-i</arg> <arg choice="opt">-h</arg> <arg choice="opt">-V</arg> @@ -87,12 +89,36 @@ </varlistentry> <varlistentry> + <term>-F</term> + <listitem><para>If specified, this parameter causes + the main <command>smbd</command> process to not daemonize, + i.e. double-fork and disassociate with the terminal. + Child processes are still created as normal to service + each connection request, but the main process does not + exit. This operation mode is suitable for running + <command>smbd</command> under process supervisors such + as <command>supervise</command> and <command>svscan</command> + from Daniel J. Bernstein's <command>daemontools</command> + package, or the AIX process monitor. + </para></listitem> + </varlistentry> + + <varlistentry> + <term>-S</term> + <listitem><para>If specified, this parameter causes + <command>smbd</command> to log to standard output rather + than a file.</para></listitem> + </varlistentry> + + <varlistentry> <term>-i</term> <listitem><para>If this parameter is specified it causes the server to run "interactively", not as a daemon, even if the server is executed on the command line of a shell. Setting this parameter negates the implicit deamon mode when run from the - command line. + command line. <command>smbd</command> also logs to standard + output, as if the <command>-S</command> parameter had been + given. </para></listitem> </varlistentry> diff --git a/docs/docbook/manpages/winbindd.8.sgml b/docs/docbook/manpages/winbindd.8.sgml index 848f6ed3fa..ccef2fa623 100644 --- a/docs/docbook/manpages/winbindd.8.sgml +++ b/docs/docbook/manpages/winbindd.8.sgml @@ -16,6 +16,8 @@ <refsynopsisdiv> <cmdsynopsis> <command>winbindd</command> + <arg choice="opt">-F</arg> + <arg choice="opt">-S</arg> <arg choice="opt">-i</arg> <arg choice="opt">-B</arg> <arg choice="opt">-d <debug level></arg> @@ -106,6 +108,28 @@ group: files winbind <variablelist> <varlistentry> + <term>-F</term> + <listitem><para>If specified, this parameter causes + the main <command>winbindd</command> process to not daemonize, + i.e. double-fork and disassociate with the terminal. + Child processes are still created as normal to service + each connection request, but the main process does not + exit. This operation mode is suitable for running + <command>winbindd</command> under process supervisors such + as <command>supervise</command> and <command>svscan</command> + from Daniel J. Bernstein's <command>daemontools</command> + package, or the AIX process monitor. + </para></listitem> + </varlistentry> + + <varlistentry> + <term>-S</term> + <listitem><para>If specified, this parameter causes + <command>winbindd</command> to log to standard output rather + than a file.</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 @@ -118,7 +142,10 @@ group: files winbind <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> + of <command>winbindd</command> is required. + <command>winbindd</command> also logs to standard output, + as if the <command>-S</command> parameter had been given. + </para></listitem> </varlistentry> <varlistentry> diff --git a/docs/htmldocs/nmbd.8.html b/docs/htmldocs/nmbd.8.html index c427e488dc..1183a14522 100644 --- a/docs/htmldocs/nmbd.8.html +++ b/docs/htmldocs/nmbd.8.html @@ -35,12 +35,12 @@ NAME="AEN8"><H2 ><B CLASS="COMMAND" >nmbd</B -> [-D] [-a] [-i] [-o] [-h] [-V] [-d <debug level>] [-H <lmhosts file>] [-l <log directory>] [-n <primary netbios name>] [-p <port number>] [-s <configuration file>]</P +> [-D] [-F] [-S] [-a] [-i] [-o] [-h] [-V] [-d <debug level>] [-H <lmhosts file>] [-l <log directory>] [-n <primary netbios name>] [-p <port number>] [-s <configuration file>]</P ></DIV ><DIV CLASS="REFSECT1" ><A -NAME="AEN23" +NAME="AEN25" ></A ><H2 >DESCRIPTION</H2 @@ -111,7 +111,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN40" +NAME="AEN42" ></A ><H2 >OPTIONS</H2 @@ -143,6 +143,48 @@ CLASS="COMMAND" </P ></DD ><DT +>-F</DT +><DD +><P +>If specified, this parameter causes + the main <B +CLASS="COMMAND" +>nmbd</B +> process to not daemonize, + i.e. double-fork and disassociate with the terminal. + Child processes are still created as normal to service + each connection request, but the main process does not + exit. This operation mode is suitable for running + <B +CLASS="COMMAND" +>nmbd</B +> under process supervisors such + as <B +CLASS="COMMAND" +>supervise</B +> and <B +CLASS="COMMAND" +>svscan</B +> + from Daniel J. Bernstein's <B +CLASS="COMMAND" +>daemontools</B +> + package, or the AIX process monitor. + </P +></DD +><DT +>-S</DT +><DD +><P +>If specified, this parameter causes + <B +CLASS="COMMAND" +>nmbd</B +> to log to standard output rather + than a file.</P +></DD +><DT >-a</DT ><DD ><P @@ -158,8 +200,15 @@ CLASS="COMMAND" server to run "interactively", not as a daemon, even if the server is executed on the command line of a shell. Setting this parameter negates the implicit daemon mode when run from the - command line. - </P + command line. <B +CLASS="COMMAND" +>nmbd</B +> also logs to standard + output, as if the <B +CLASS="COMMAND" +>-S</B +> parameter had been + given. </P ></DD ><DT >-o</DT @@ -385,7 +434,7 @@ CLASS="FILENAME" ><DIV CLASS="REFSECT1" ><A -NAME="AEN130" +NAME="AEN148" ></A ><H2 >FILES</H2 @@ -541,7 +590,7 @@ CLASS="FILENAME" ><DIV CLASS="REFSECT1" ><A -NAME="AEN177" +NAME="AEN195" ></A ><H2 >SIGNALS</H2 @@ -603,7 +652,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN193" +NAME="AEN211" ></A ><H2 >VERSION</H2 @@ -614,7 +663,7 @@ NAME="AEN193" ><DIV CLASS="REFSECT1" ><A -NAME="AEN196" +NAME="AEN214" ></A ><H2 >SEE ALSO</H2 @@ -679,7 +728,7 @@ TARGET="_top" ><DIV CLASS="REFSECT1" ><A -NAME="AEN213" +NAME="AEN231" ></A ><H2 >AUTHOR</H2 diff --git a/docs/htmldocs/pdbedit.8.html b/docs/htmldocs/pdbedit.8.html index 3ed3dfe8e9..8cb8dc76bf 100644 --- a/docs/htmldocs/pdbedit.8.html +++ b/docs/htmldocs/pdbedit.8.html @@ -1,11 +1,12 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><TITLE >pdbedit</TITLE ><META NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.77"></HEAD +CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ +"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" @@ -15,9 +16,7 @@ VLINK="#840084" ALINK="#0000FF" ><H1 ><A -NAME="PDBEDIT" -></A ->pdbedit</H1 +NAME="PDBEDIT">pdbedit</H1 ><DIV CLASS="REFNAMEDIV" ><A @@ -29,20 +28,18 @@ NAME="AEN5" ><DIV CLASS="REFSYNOPSISDIV" ><A -NAME="AEN8" -></A -><H2 +NAME="AEN8"><H2 >Synopsis</H2 ><P ><B CLASS="COMMAND" >pdbedit</B -> [-l] [-v] [-w] [-u username] [-f fullname] [-h homedir] [-d drive] [-s script] [-p profile] [-a] [-m] [-x] [-i passdb-backend] [-e passdb-backend] [-b passdb-backend] [-D debuglevel]</P +> [-l] [-v] [-w] [-u username] [-f fullname] [-h homedir] [-D drive] [-S script] [-p profile] [-a] [-m] [-x] [-i passdb-backend] [-e passdb-backend] [-b passdb-backend] [-d debuglevel] [-s configfile] [-P account-policy] [-V value]</P ></DIV ><DIV CLASS="REFSECT1" ><A -NAME="AEN27" +NAME="AEN30" ></A ><H2 >DESCRIPTION</H2 @@ -68,7 +65,7 @@ TARGET="_top" ><DIV CLASS="REFSECT1" ><A -NAME="AEN34" +NAME="AEN37" ></A ><H2 >OPTIONS</H2 @@ -91,11 +88,20 @@ CLASS="COMMAND" >pdbedit -l</B ></P ><P +><TABLE +BORDER="0" +BGCOLOR="#E0E0E0" +WIDTH="90%" +><TR +><TD ><PRE CLASS="PROGRAMLISTING" > sorce:500:Simo Sorce samba:45:Test User </PRE +></TD +></TR +></TABLE ></P ></DD ><DT @@ -111,6 +117,12 @@ CLASS="COMMAND" >pdbedit -l -v</B ></P ><P +><TABLE +BORDER="0" +BGCOLOR="#E0E0E0" +WIDTH="90%" +><TR +><TD ><PRE CLASS="PROGRAMLISTING" > --------------- @@ -132,6 +144,9 @@ CLASS="PROGRAMLISTING" Logon Script: Profile Path: \\BERSERKER\profile </PRE +></TD +></TR +></TABLE ></P ></DD ><DT @@ -158,11 +173,20 @@ CLASS="COMMAND" >pdbedit -l -w</B ></P ><P +><TABLE +BORDER="0" +BGCOLOR="#E0E0E0" +WIDTH="90%" +><TR +><TD ><PRE CLASS="PROGRAMLISTING" > sorce:500:508818B733CE64BEAAD3B435B51404EE:D2A2418EFC466A8A0F6B1DBB5C3DB80C:[UX ]:LCT-00000000: samba:45:0F2B255F7B67A7A9AAD3B435B51404EE:BC281CE3F53B6A5146629CD4751D3490:[UX ]:LCT-3BFA1E8D: </PRE +></TD +></TR +></TABLE ></P ></DD ><DT @@ -171,19 +195,13 @@ CLASS="PROGRAMLISTING" ><P >This option specifies the username to be used for the operation requested (listing, adding, removing). - It is <SPAN -CLASS="emphasis" -><I + It is <I CLASS="EMPHASIS" >required</I -></SPAN > in add, remove and modify - operations and <SPAN -CLASS="emphasis" -><I + operations and <I CLASS="EMPHASIS" >optional</I -></SPAN > in list operations.</P ></DD @@ -215,7 +233,7 @@ CLASS="COMMAND" </P ></DD ><DT ->-d drive</DT +>-D drive</DT ><DD ><P >This option can be used while adding or @@ -229,7 +247,7 @@ CLASS="COMMAND" </P ></DD ><DT ->-s script</DT +>-S script</DT ><DD ><P >This option can be used while adding or @@ -269,10 +287,19 @@ CLASS="COMMAND" CLASS="COMMAND" >pdbedit -a -u sorce</B > - <PRE + <TABLE +BORDER="0" +BGCOLOR="#E0E0E0" +WIDTH="90%" +><TR +><TD +><PRE CLASS="PROGRAMLISTING" >new password: retype new password</PRE +></TD +></TR +></TABLE > </P ></DD @@ -352,13 +379,78 @@ CLASS="COMMAND" >pdbedit -b xml:/root/pdb-backup.xml -l</B ></P ></DD +><DT +>-P account-policy</DT +><DD +><P +>Display an account policy</P +><P +>Valid policies are: minimum password age, reset count minutes, disconnect time, + user must logon to change password, password history, lockout duration, min password length, + maximum password age and bad lockout attempt.</P +><P +>Example: <B +CLASS="COMMAND" +>pdbedit -P "bad lockout attempt"</B +></P +><P +><TABLE +BORDER="0" +BGCOLOR="#E0E0E0" +WIDTH="90%" +><TR +><TD +><PRE +CLASS="PROGRAMLISTING" +> account policy value for bad lockout attempt is 0 + </PRE +></TD +></TR +></TABLE +></P +></DD +><DT +>-V account-policy-value</DT +><DD +><P +>Sets an account policy to a specified value. + This option may only be used in conjunction + with the <TT +CLASS="PARAMETER" +><I +>-P</I +></TT +> option. + </P +><P +>Example: <B +CLASS="COMMAND" +>pdbedit -P "bad lockout attempt" -V 3</B +></P +><P +><TABLE +BORDER="0" +BGCOLOR="#E0E0E0" +WIDTH="90%" +><TR +><TD +><PRE +CLASS="PROGRAMLISTING" +> account policy value for bad lockout attempt was 0 + account policy value for bad lockout attempt is now 3 + </PRE +></TD +></TR +></TABLE +></P +></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A -NAME="AEN140" +NAME="AEN161" ></A ><H2 >NOTES</H2 @@ -368,7 +460,7 @@ NAME="AEN140" ><DIV CLASS="REFSECT1" ><A -NAME="AEN143" +NAME="AEN164" ></A ><H2 >VERSION</H2 @@ -379,7 +471,7 @@ NAME="AEN143" ><DIV CLASS="REFSECT1" ><A -NAME="AEN146" +NAME="AEN167" ></A ><H2 >SEE ALSO</H2 @@ -399,7 +491,7 @@ TARGET="_top" ><DIV CLASS="REFSECT1" ><A -NAME="AEN151" +NAME="AEN172" ></A ><H2 >AUTHOR</H2 diff --git a/docs/htmldocs/smbd.8.html b/docs/htmldocs/smbd.8.html index ff0abc2bd1..65f5f95b8d 100644 --- a/docs/htmldocs/smbd.8.html +++ b/docs/htmldocs/smbd.8.html @@ -34,12 +34,12 @@ NAME="AEN8"><H2 ><B CLASS="COMMAND" >smbd</B -> [-D] [-i] [-h] [-V] [-b] [-d <debug level>] [-l <log directory>] [-p <port number>] [-O <socket option>] [-s <configuration file>]</P +> [-D] [-F] [-S] [-i] [-h] [-V] [-b] [-d <debug level>] [-l <log directory>] [-p <port number>] [-O <socket option>] [-s <configuration file>]</P ></DIV ><DIV CLASS="REFSECT1" ><A -NAME="AEN21" +NAME="AEN23" ></A ><H2 >DESCRIPTION</H2 @@ -104,7 +104,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN35" +NAME="AEN37" ></A ><H2 >OPTIONS</H2 @@ -134,6 +134,48 @@ CLASS="COMMAND" </P ></DD ><DT +>-F</DT +><DD +><P +>If specified, this parameter causes + the main <B +CLASS="COMMAND" +>smbd</B +> process to not daemonize, + i.e. double-fork and disassociate with the terminal. + Child processes are still created as normal to service + each connection request, but the main process does not + exit. This operation mode is suitable for running + <B +CLASS="COMMAND" +>smbd</B +> under process supervisors such + as <B +CLASS="COMMAND" +>supervise</B +> and <B +CLASS="COMMAND" +>svscan</B +> + from Daniel J. Bernstein's <B +CLASS="COMMAND" +>daemontools</B +> + package, or the AIX process monitor. + </P +></DD +><DT +>-S</DT +><DD +><P +>If specified, this parameter causes + <B +CLASS="COMMAND" +>smbd</B +> to log to standard output rather + than a file.</P +></DD +><DT >-i</DT ><DD ><P @@ -141,7 +183,15 @@ CLASS="COMMAND" server to run "interactively", not as a daemon, even if the server is executed on the command line of a shell. Setting this parameter negates the implicit deamon mode when run from the - command line. + command line. <B +CLASS="COMMAND" +>smbd</B +> also logs to standard + output, as if the <B +CLASS="COMMAND" +>-S</B +> parameter had been + given. </P ></DD ><DT @@ -329,7 +379,7 @@ CLASS="FILENAME" ><DIV CLASS="REFSECT1" ><A -NAME="AEN105" +NAME="AEN123" ></A ><H2 >FILES</H2 @@ -441,7 +491,7 @@ CLASS="FILENAME" ><DIV CLASS="REFSECT1" ><A -NAME="AEN141" +NAME="AEN159" ></A ><H2 >LIMITATIONS</H2 @@ -460,7 +510,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN145" +NAME="AEN163" ></A ><H2 >ENVIRONMENT VARIABLES</H2 @@ -491,7 +541,7 @@ CLASS="CONSTANT" ><DIV CLASS="REFSECT1" ><A -NAME="AEN154" +NAME="AEN172" ></A ><H2 >PAM INTERACTION</H2 @@ -538,7 +588,7 @@ CLASS="EMPHASIS" ><DIV CLASS="REFSECT1" ><A -NAME="AEN165" +NAME="AEN183" ></A ><H2 >VERSION</H2 @@ -549,7 +599,7 @@ NAME="AEN165" ><DIV CLASS="REFSECT1" ><A -NAME="AEN168" +NAME="AEN186" ></A ><H2 >DIAGNOSTICS</H2 @@ -572,7 +622,7 @@ NAME="AEN168" ><DIV CLASS="REFSECT1" ><A -NAME="AEN173" +NAME="AEN191" ></A ><H2 >SIGNALS</H2 @@ -638,7 +688,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN190" +NAME="AEN208" ></A ><H2 >SEE ALSO</H2 @@ -704,7 +754,7 @@ TARGET="_top" ><DIV CLASS="REFSECT1" ><A -NAME="AEN207" +NAME="AEN225" ></A ><H2 >AUTHOR</H2 diff --git a/docs/htmldocs/smbpasswd.8.html b/docs/htmldocs/smbpasswd.8.html index fa7b4b2520..da3cb9f601 100644 --- a/docs/htmldocs/smbpasswd.8.html +++ b/docs/htmldocs/smbpasswd.8.html @@ -1,11 +1,12 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><TITLE >smbpasswd</TITLE ><META NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.77"></HEAD +CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ +"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" @@ -15,9 +16,7 @@ VLINK="#840084" ALINK="#0000FF" ><H1 ><A -NAME="SMBPASSWD" -></A ->smbpasswd</H1 +NAME="SMBPASSWD">smbpasswd</H1 ><DIV CLASS="REFNAMEDIV" ><A @@ -29,20 +28,18 @@ NAME="AEN5" ><DIV CLASS="REFSYNOPSISDIV" ><A -NAME="AEN8" -></A -><H2 +NAME="AEN8"><H2 >Synopsis</H2 ><P ><B CLASS="COMMAND" >smbpasswd</B -> [-a] [-x] [-d] [-e] [-D debuglevel] [-n] [-r <remote machine>] [-R <name resolve order>] [-m] [-U username[%password]] [-h] [-s] [-w pass] [username]</P +> [-a] [-x] [-d] [-e] [-D debuglevel] [-n] [-r <remote machine>] [-R <name resolve order>] [-m] [-U username[%password]] [-h] [-s] [-w pass] [-i] [-L] [username]</P ></DIV ><DIV CLASS="REFSECT1" ><A -NAME="AEN25" +NAME="AEN27" ></A ><H2 >DESCRIPTION</H2 @@ -54,12 +51,9 @@ TARGET="_top" > suite.</P ><P >The smbpasswd program has several different - functions, depending on whether it is run by the <SPAN -CLASS="emphasis" -><I + functions, depending on whether it is run by the <I CLASS="EMPHASIS" >root</I -></SPAN > user or not. When run as a normal user it allows the user to change the password used for their SMB sessions on any machines that store @@ -75,12 +69,9 @@ CLASS="COMMAND" CLASS="COMMAND" >smbpasswd</B > differs from how the passwd program works - however in that it is not <SPAN -CLASS="emphasis" -><I + however in that it is not <I CLASS="EMPHASIS" >setuid root</I -></SPAN > but works in a client-server mode and communicates with a locally running <B @@ -100,7 +91,7 @@ CLASS="FILENAME" was typed correctly. No passwords will be echoed on the screen whilst being typed. If you have a blank SMB password (specified by the string "NO PASSWORD" in the smbpasswd file) then just press - the <Enter> key when asked for your old password. </P + the <Enter> key when asked for your old password. </P ><P >smbpasswd can also be used by a normal user to change their SMB password on remote machines, such as Windows NT Primary Domain @@ -119,7 +110,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN41" +NAME="AEN43" ></A ><H2 >OPTIONS</H2 @@ -134,7 +125,7 @@ CLASS="VARIABLELIST" ><P >This option specifies that the username following should be added to the local smbpasswd file, with the - new password typed (type <Enter> for the old password). This + new password typed (type <Enter> for the old password). This option is ignored if the username following already exists in the smbpasswd file and it is treated like a regular change password command. Note that the default passdb backends require @@ -303,12 +294,9 @@ CLASS="PARAMETER" copy of the user account database and will not allow the password change).</P ><P -><SPAN -CLASS="emphasis" ><I CLASS="EMPHASIS" >Note</I -></SPAN > that Windows 95/98 do not have a real password database so it is not possible to change passwords specifying a Win95/98 machine as remote machine target. </P @@ -499,16 +487,31 @@ CLASS="PARAMETER" </P ></DD ><DT +>-i</DT +><DD +><P +>This option tells smbpasswd that the account + being changed is an interdomain trust account. Currently this is used + when Samba is being used as an NT Primary Domain Controller. + The account contains the info about another trusted domain.</P +><P +>This option is only available when running smbpasswd as root. + </P +></DD +><DT +>-L</DT +><DD +><P +>Run in local mode.</P +></DD +><DT >username</DT ><DD ><P >This specifies the username for all of the - <SPAN -CLASS="emphasis" -><I + <I CLASS="EMPHASIS" >root only</I -></SPAN > options to operate on. Only root can specify this parameter as only root has the permission needed to modify attributes directly in the local smbpasswd file. @@ -520,7 +523,7 @@ CLASS="EMPHASIS" ><DIV CLASS="REFSECT1" ><A -NAME="AEN162" +NAME="AEN173" ></A ><H2 >NOTES</H2 @@ -563,7 +566,7 @@ CLASS="FILENAME" ><DIV CLASS="REFSECT1" ><A -NAME="AEN172" +NAME="AEN183" ></A ><H2 >VERSION</H2 @@ -574,7 +577,7 @@ NAME="AEN172" ><DIV CLASS="REFSECT1" ><A -NAME="AEN175" +NAME="AEN186" ></A ><H2 >SEE ALSO</H2 @@ -597,7 +600,7 @@ TARGET="_top" ><DIV CLASS="REFSECT1" ><A -NAME="AEN181" +NAME="AEN192" ></A ><H2 >AUTHOR</H2 diff --git a/docs/htmldocs/testparm.1.html b/docs/htmldocs/testparm.1.html index 0fc94cd880..baf11bacac 100644 --- a/docs/htmldocs/testparm.1.html +++ b/docs/htmldocs/testparm.1.html @@ -1,11 +1,12 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><TITLE >testparm</TITLE ><META NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.77"></HEAD +CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ +"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" @@ -15,9 +16,7 @@ VLINK="#840084" ALINK="#0000FF" ><H1 ><A -NAME="TESTPARM" -></A ->testparm</H1 +NAME="TESTPARM">testparm</H1 ><DIV CLASS="REFNAMEDIV" ><A @@ -30,20 +29,18 @@ NAME="AEN5" ><DIV CLASS="REFSYNOPSISDIV" ><A -NAME="AEN8" -></A -><H2 +NAME="AEN8"><H2 >Synopsis</H2 ><P ><B CLASS="COMMAND" >testparm</B -> [-s] [-h] [-v] [-L <servername>] {config filename} [hostname hostIP]</P +> [-s] [-h] [-v] [-L <servername>] [-t <encoding>] {config filename} [hostname hostIP]</P ></DIV ><DIV CLASS="REFSECT1" ><A -NAME="AEN17" +NAME="AEN18" ></A ><H2 >DESCRIPTION</H2 @@ -69,12 +66,9 @@ CLASS="COMMAND" </B > will successfully load the configuration file.</P ><P ->Note that this is <SPAN -CLASS="emphasis" -><I +>Note that this is <I CLASS="EMPHASIS" >NOT</I -></SPAN > a guarantee that the services specified in the configuration file will be available or will operate as expected. </P @@ -100,7 +94,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN32" +NAME="AEN33" ></A ><H2 >OPTIONS</H2 @@ -152,6 +146,13 @@ CLASS="FILENAME" their defaults.</P ></DD ><DT +>-t encoding</DT +><DD +><P +> Output data in specified encoding. + </P +></DD +><DT >configfilename</DT ><DD ><P @@ -209,7 +210,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN72" +NAME="AEN77" ></A ><H2 >FILES</H2 @@ -238,7 +239,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN81" +NAME="AEN86" ></A ><H2 >DIAGNOSTICS</H2 @@ -252,18 +253,18 @@ NAME="AEN81" ><DIV CLASS="REFSECT1" ><A -NAME="AEN84" +NAME="AEN89" ></A ><H2 >VERSION</H2 ><P ->This man page is correct for version 2.2 of +>This man page is correct for version 3.0 of the Samba suite.</P ></DIV ><DIV CLASS="REFSECT1" ><A -NAME="AEN87" +NAME="AEN92" ></A ><H2 >SEE ALSO</H2 @@ -289,7 +290,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN94" +NAME="AEN99" ></A ><H2 >AUTHOR</H2 diff --git a/docs/htmldocs/wbinfo.1.html b/docs/htmldocs/wbinfo.1.html index 26e098868e..b5cafb8829 100644 --- a/docs/htmldocs/wbinfo.1.html +++ b/docs/htmldocs/wbinfo.1.html @@ -1,11 +1,12 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><TITLE >wbinfo</TITLE ><META NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.77"></HEAD +CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ +"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" @@ -15,9 +16,7 @@ VLINK="#840084" ALINK="#0000FF" ><H1 ><A -NAME="WBINFO" -></A ->wbinfo</H1 +NAME="WBINFO">wbinfo</H1 ><DIV CLASS="REFNAMEDIV" ><A @@ -29,20 +28,18 @@ NAME="AEN5" ><DIV CLASS="REFSYNOPSISDIV" ><A -NAME="AEN8" -></A -><H2 +NAME="AEN8"><H2 >Synopsis</H2 ><P ><B CLASS="COMMAND" >wbinfo</B -> [-u] [-g] [-h name] [-i ip] [-n name] [-s sid] [-U uid] [-G gid] [-S sid] [-Y sid] [-t] [-m] [-r user] [-a user%password] [-A user%password]</P +> [-u] [-g] [-i ip] [-N netbios-name] [-n name] [-s sid] [-U uid] [-G gid] [-S sid] [-Y sid] [-t] [-m] [-r user] [-a user%password] [-A user%password] [-p]</P ></DIV ><DIV CLASS="REFSECT1" ><A -NAME="AEN26" +NAME="AEN27" ></A ><H2 >DESCRIPTION</H2 @@ -79,7 +76,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN37" +NAME="AEN38" ></A ><H2 >OPTIONS</H2 @@ -123,13 +120,13 @@ CLASS="COMMAND" >. </P ></DD ><DT ->-h name</DT +>-N name</DT ><DD ><P >The <TT CLASS="PARAMETER" ><I ->-h</I +>-N</I ></TT > option queries <B @@ -146,13 +143,13 @@ CLASS="PARAMETER" </P ></DD ><DT ->-i ip</DT +>-I ip</DT ><DD ><P >The <TT CLASS="PARAMETER" ><I ->-i</I +>-I</I ></TT > option queries <B @@ -308,7 +305,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN119" +NAME="AEN120" ></A ><H2 >EXIT STATUS</H2 @@ -327,18 +324,18 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN124" +NAME="AEN125" ></A ><H2 >VERSION</H2 ><P ->This man page is correct for version 2.2 of +>This man page is correct for version 3.0 of the Samba suite.</P ></DIV ><DIV CLASS="REFSECT1" ><A -NAME="AEN127" +NAME="AEN128" ></A ><H2 >SEE ALSO</H2 @@ -356,7 +353,7 @@ CLASS="COMMAND" ><DIV CLASS="REFSECT1" ><A -NAME="AEN132" +NAME="AEN133" ></A ><H2 >AUTHOR</H2 diff --git a/docs/manpages/nmbd.8 b/docs/manpages/nmbd.8 index 057adb8bed..ff98f0ce44 100644 --- a/docs/manpages/nmbd.8 +++ b/docs/manpages/nmbd.8 @@ -3,12 +3,12 @@ .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng <steve@ggi-project.org>. -.TH "NMBD" "8" "26 November 2002" "" "" +.TH "NMBD" "8" "03 January 2003" "" "" .SH NAME nmbd \- NetBIOS name server to provide NetBIOS over IP naming services to clients .SH SYNOPSIS -\fBnmbd\fR [ \fB-D\fR ] [ \fB-a\fR ] [ \fB-i\fR ] [ \fB-o\fR ] [ \fB-h\fR ] [ \fB-V\fR ] [ \fB-d <debug level>\fR ] [ \fB-H <lmhosts file>\fR ] [ \fB-l <log directory>\fR ] [ \fB-n <primary netbios name>\fR ] [ \fB-p <port number>\fR ] [ \fB-s <configuration file>\fR ] +\fBnmbd\fR [ \fB-D\fR ] [ \fB-F\fR ] [ \fB-S\fR ] [ \fB-a\fR ] [ \fB-i\fR ] [ \fB-o\fR ] [ \fB-h\fR ] [ \fB-V\fR ] [ \fB-d <debug level>\fR ] [ \fB-H <lmhosts file>\fR ] [ \fB-l <log directory>\fR ] [ \fB-n <primary netbios name>\fR ] [ \fB-p <port number>\fR ] [ \fB-s <configuration file>\fR ] .SH "DESCRIPTION" .PP @@ -57,6 +57,23 @@ will operate as a daemon if launched from a command shell. nmbd can also be operated from the \fBinetd\fR meta-daemon, although this is not recommended. .TP +\fB-F\fR +If specified, this parameter causes +the main \fBnmbd\fR process to not daemonize, +i.e. double-fork and disassociate with the terminal. +Child processes are still created as normal to service +each connection request, but the main process does not +exit. This operation mode is suitable for running +\fBnmbd\fR under process supervisors such +as \fBsupervise\fR and \fBsvscan\fR +from Daniel J. Bernstein's \fBdaemontools\fR +package, or the AIX process monitor. +.TP +\fB-S\fR +If specified, this parameter causes +\fBnmbd\fR to log to standard output rather +than a file. +.TP \fB-a\fR If this parameter is specified, each new connection will append log messages to the log file. @@ -67,7 +84,9 @@ If this parameter is specified it causes the server to run "interactively", not as a daemon, even if the server is executed on the command line of a shell. Setting this parameter negates the implicit daemon mode when run from the -command line. +command line. \fBnmbd\fR also logs to standard +output, as if the \fB-S\fR parameter had been +given. .TP \fB-o\fR If this parameter is specified, the diff --git a/docs/manpages/smbd.8 b/docs/manpages/smbd.8 index 3e350f80e9..0c8cae0d3e 100644 --- a/docs/manpages/smbd.8 +++ b/docs/manpages/smbd.8 @@ -3,12 +3,12 @@ .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng <steve@ggi-project.org>. -.TH "SMBD" "8" "26 November 2002" "" "" +.TH "SMBD" "8" "03 January 2003" "" "" .SH NAME smbd \- server to provide SMB/CIFS services to clients .SH SYNOPSIS -\fBsmbd\fR [ \fB-D\fR ] [ \fB-i\fR ] [ \fB-h\fR ] [ \fB-V\fR ] [ \fB-b\fR ] [ \fB-d <debug level>\fR ] [ \fB-l <log directory>\fR ] [ \fB-p <port number>\fR ] [ \fB-O <socket option>\fR ] [ \fB-s <configuration file>\fR ] +\fBsmbd\fR [ \fB-D\fR ] [ \fB-F\fR ] [ \fB-S\fR ] [ \fB-i\fR ] [ \fB-h\fR ] [ \fB-V\fR ] [ \fB-b\fR ] [ \fB-d <debug level>\fR ] [ \fB-l <log directory>\fR ] [ \fB-p <port number>\fR ] [ \fB-O <socket option>\fR ] [ \fB-s <configuration file>\fR ] .SH "DESCRIPTION" .PP @@ -60,12 +60,31 @@ servers that provide more than casual use file and print services. This switch is assumed if \fBsmbd \fR is executed on the command line of a shell. .TP +\fB-F\fR +If specified, this parameter causes +the main \fBsmbd\fR process to not daemonize, +i.e. double-fork and disassociate with the terminal. +Child processes are still created as normal to service +each connection request, but the main process does not +exit. This operation mode is suitable for running +\fBsmbd\fR under process supervisors such +as \fBsupervise\fR and \fBsvscan\fR +from Daniel J. Bernstein's \fBdaemontools\fR +package, or the AIX process monitor. +.TP +\fB-S\fR +If specified, this parameter causes +\fBsmbd\fR to log to standard output rather +than a file. +.TP \fB-i\fR If this parameter is specified it causes the server to run "interactively", not as a daemon, even if the server is executed on the command line of a shell. Setting this parameter negates the implicit deamon mode when run from the -command line. +command line. \fBsmbd\fR also logs to standard +output, as if the \fB-S\fR parameter had been +given. .TP \fB-h\fR Prints the help information (usage) diff --git a/docs/manpages/smbgroupedit.8 b/docs/manpages/smbgroupedit.8 index 3ee7980e5d..b514b99793 100644 --- a/docs/manpages/smbgroupedit.8 +++ b/docs/manpages/smbgroupedit.8 @@ -3,7 +3,7 @@ .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng <steve@ggi-project.org>. -.TH "SMBGROUPEDIT" "8" "01 October 2002" "" "" +.TH "SMBGROUPEDIT" "8" "03 January 2003" "" "" .SH NAME smbgroupedit \- Query/set/change UNIX - Windows NT group mapping .SH SYNOPSIS @@ -111,7 +111,7 @@ map the unix domadm group to the Windows NT .nf root# \fBsmbgroupedit \\ -c S-1-5-21-1108995562-3116817432-1375597819-512 \\ --u domadm\fR +-u domadm -td\fR .fi \fBwarning:\fR don't copy and paste this sample, the diff --git a/docs/manpages/winbindd.8 b/docs/manpages/winbindd.8 index 2cd25af942..8cfb403723 100644 --- a/docs/manpages/winbindd.8 +++ b/docs/manpages/winbindd.8 @@ -3,12 +3,12 @@ .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng <steve@ggi-project.org>. -.TH "WINBINDD" "8" "26 November 2002" "" "" +.TH "WINBINDD" "8" "03 January 2003" "" "" .SH NAME winbindd \- Name Service Switch daemon for resolving names from NT servers .SH SYNOPSIS -\fBwinbindd\fR [ \fB-i\fR ] [ \fB-B\fR ] [ \fB-d <debug level>\fR ] [ \fB-s <smb config file>\fR ] [ \fB-n\fR ] +\fBwinbindd\fR [ \fB-F\fR ] [ \fB-S\fR ] [ \fB-i\fR ] [ \fB-B\fR ] [ \fB-d <debug level>\fR ] [ \fB-s <smb config file>\fR ] [ \fB-n\fR ] .SH "DESCRIPTION" .PP @@ -74,6 +74,23 @@ resolve hostnames from \fI/etc/hosts\fR and then from the WINS server. .SH "OPTIONS" .TP +\fB-F\fR +If specified, this parameter causes +the main \fBwinbindd\fR process to not daemonize, +i.e. double-fork and disassociate with the terminal. +Child processes are still created as normal to service +each connection request, but the main process does not +exit. This operation mode is suitable for running +\fBwinbindd\fR under process supervisors such +as \fBsupervise\fR and \fBsvscan\fR +from Daniel J. Bernstein's \fBdaemontools\fR +package, or the AIX process monitor. +.TP +\fB-S\fR +If specified, this parameter causes +\fBwinbindd\fR to log to standard output rather +than a file. +.TP \fB-d debuglevel\fR Sets the debuglevel to an integer between 0 and 100. 0 is for no debugging and 100 is for reams and @@ -84,7 +101,9 @@ level 100 (see BUGS.txt). Tells \fBwinbindd\fR to not become a daemon and detach from the current terminal. This option is used by developers when interactive debugging -of \fBwinbindd\fR is required. +of \fBwinbindd\fR is required. +\fBwinbindd\fR also logs to standard output, +as if the \fB-S\fR parameter had been given. .TP \fB-n\fR Disable caching. This means winbindd will diff --git a/source3/lib/debug.c b/source3/lib/debug.c index ea5bad3b6d..966a53fca3 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -525,6 +525,7 @@ void setup_logging(const char *pname, BOOL interactive) if (interactive) { stdout_logging = True; dbf = x_stdout; + x_setbuf( x_stdout, NULL ); } #ifdef WITH_SYSLOG else { diff --git a/source3/lib/util.c b/source3/lib/util.c index 67de9e4bf2..ec967e4abf 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -873,10 +873,13 @@ void msleep(unsigned int t) Become a daemon, discarding the controlling terminal. ****************************************************************************/ -void become_daemon(void) +void become_daemon(BOOL Fork) { - if (sys_fork()) - _exit(0); + if (Fork) { + if (sys_fork()) { + _exit(0); + } + } /* detach from the terminal */ #ifdef HAVE_SETSID diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 988127e431..2b7d8033a2 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -32,6 +32,12 @@ extern BOOL global_in_nmbd; /* are we running as a daemon ? */ static BOOL is_daemon = False; +/* fork or run in foreground ? */ +static BOOL Fork = True; + +/* log to standard output ? */ +static BOOL log_stdout = False; + /* have we found LanMan clients yet? */ BOOL found_lm_clients = False; @@ -590,6 +596,8 @@ static BOOL open_sockets(BOOL isdaemon, int port) POPT_AUTOHELP {"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon(default)" }, {"interactive", 'i', POPT_ARG_VAL, &opt_interactive, True, "Run interactive (not a daemon)" }, + {"foreground", 'F', POPT_ARG_VAL, &Fork, False, "Run daemon in foreground (for daemontools & etc)" }, + {"log-stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" }, {"hosts", 'H', POPT_ARG_STRING, dyn_LMHOSTSFILE, 'H', "Load a netbios hosts file"}, {"port", 'p', POPT_ARG_INT, &global_nmb_port, NMB_PORT, "Listen on the specified port" }, {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug }, @@ -639,8 +647,18 @@ static BOOL open_sockets(BOOL isdaemon, int port) { } poptFreeContext(pc); - - setup_logging( argv[0], opt_interactive ); + + if ( opt_interactive ) { + Fork = False; + log_stdout = True; + } + + if ( log_stdout && Fork ) { + DEBUG(0,("ERROR: Can't log to stdout (-S) unless daemon is in foreground (-F) or interactive (-i)\n")); + exit(1); + } + + setup_logging( argv[0], log_stdout ); reopen_logs(); @@ -672,7 +690,7 @@ static BOOL open_sockets(BOOL isdaemon, int port) if (is_daemon && !opt_interactive) { DEBUG( 2, ( "Becoming a daemon.\n" ) ); - become_daemon(); + become_daemon(Fork); } #if HAVE_SETPGID diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index acc717e13c..479b35da07 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -758,6 +758,8 @@ struct winbindd_state server_state; /* Server state information */ static void usage(void) { printf("Usage: winbindd [options]\n"); + printf("\t-F daemon in foreground mode\n"); + printf("\t-S log to stdout\n"); printf("\t-i interactive mode\n"); printf("\t-B dual daemon mode\n"); printf("\t-n disable cacheing\n"); @@ -771,6 +773,8 @@ static void usage(void) extern BOOL AllowDebugChange; pstring logfile; BOOL interactive = False; + BOOL Fork = True; + BOOL log_stdout = False; int opt; /* glibc (?) likes to print "User defined signal 1" and exit if a @@ -795,12 +799,20 @@ static void usage(void) /* Initialise samba/rpc client stuff */ - while ((opt = getopt(argc, argv, "id:s:nhB")) != EOF) { + while ((opt = getopt(argc, argv, "FSid:s:nhB")) != EOF) { switch (opt) { + case 'F': + Fork = False; + break; + case 'S': + log_stdout = True; + break; /* Don't become a daemon */ case 'i': interactive = True; + log_stdout = True; + Fork = False; break; /* dual daemon system */ @@ -834,9 +846,15 @@ static void usage(void) } } + if (log_stdout && Fork) { + printf("Can't log to stdout (-S) unless daemon is in foreground +(-F) or interactive (-i)\n"); + usage(); + exit(1); + } + snprintf(logfile, sizeof(logfile), "%s/log.winbindd", dyn_LOGFILEBASE); lp_set_logfile(logfile); - setup_logging("winbindd", interactive); + setup_logging("winbindd", log_stdout); reopen_logs(); DEBUG(1, ("winbindd version %s started.\n", VERSION ) ); @@ -853,7 +871,7 @@ static void usage(void) exit(1); if (!interactive) { - become_daemon(); + become_daemon(Fork); pidfile_create("winbindd"); } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 94849f9f5c..c5474a46b8 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -632,6 +632,8 @@ static BOOL init_structs(void ) /* shall I run as a daemon */ static BOOL is_daemon = False; static BOOL interactive = False; + static BOOL Fork = True; + static BOOL log_stdout = False; static char *ports = NULL; int opt; poptContext pc; @@ -640,6 +642,8 @@ static BOOL init_structs(void ) POPT_AUTOHELP {"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon (default)" }, {"interactive", 'i', POPT_ARG_VAL, &interactive, True, "Run interactive (not a daemon)"}, + {"foreground", 'F', POPT_ARG_VAL, &Fork, False, "Run daemon in foreground (for daemontools & etc)" }, + {"log-stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" }, {"build-options", 'b', POPT_ARG_NONE, NULL, 'b', "Print build options" }, {"port", 'p', POPT_ARG_STRING, &ports, 0, "Listen on the specified ports"}, {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug}, @@ -678,7 +682,17 @@ static BOOL init_structs(void ) set_remote_machine_name("smbd"); - setup_logging(argv[0],interactive); + if (interactive) { + Fork = False; + log_stdout = True; + } + + if (log_stdout && Fork) { + DEBUG(0,("ERROR: Can't log to stdout (-S) unless daemon is in foreground (-F) or interactive (-i)\n")); + exit(1); + } + + setup_logging(argv[0],log_stdout); /* we want to re-seed early to prevent time delays causing client problems at a later date. (tridge) */ @@ -767,7 +781,7 @@ static BOOL init_structs(void ) if (is_daemon && !interactive) { DEBUG( 3, ( "Becoming a daemon.\n" ) ); - become_daemon(); + become_daemon(Fork); } #if HAVE_SETPGID diff --git a/source3/web/startstop.c b/source3/web/startstop.c index e10dff4118..c6babff954 100644 --- a/source3/web/startstop.c +++ b/source3/web/startstop.c @@ -39,7 +39,7 @@ void start_smbd(void) slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", dyn_SBINDIR); - become_daemon(); + become_daemon(True); execl(binfile, binfile, "-D", NULL); @@ -60,7 +60,7 @@ void start_nmbd(void) slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", dyn_SBINDIR); - become_daemon(); + become_daemon(True); execl(binfile, binfile, "-D", NULL); @@ -81,7 +81,7 @@ void start_winbindd(void) slprintf(binfile, sizeof(pstring) - 1, "%s/winbindd", dyn_SBINDIR); - become_daemon(); + become_daemon(True); execl(binfile, binfile, NULL); diff --git a/source3/wrepld/server.c b/source3/wrepld/server.c index e39fb148d6..349f2a21ab 100644 --- a/source3/wrepld/server.c +++ b/source3/wrepld/server.c @@ -166,9 +166,11 @@ void exit_server(const char *reason) static void usage(char *pname) { - d_printf("Usage: %s [-DaioPh?V] [-d debuglevel] [-l log basename] [-p port]\n", pname); + d_printf("Usage: %s [-DFSaioPh?V] [-d debuglevel] [-l log basename] [-p port]\n", pname); d_printf(" [-O socket options] [-s services file]\n"); d_printf("\t-D Become a daemon (default)\n"); + d_printf("\t-F Run daemon in foreground (for daemontools, etc)\n"); + d_printf("\t-S Log to stdout\n"); d_printf("\t-a Append to log file (default)\n"); d_printf("\t-i Run interactive (not a daemon)\n" ); d_printf("\t-o Overwrite log file, don't append\n"); @@ -523,6 +525,8 @@ static void process(void) BOOL is_daemon = False; BOOL interactive = False; BOOL specified_logfile = False; + BOOL Fork = True; + BOOL log_stdout = False; int opt; pstring logfile; @@ -536,8 +540,14 @@ static void process(void) argc--; } - while ( EOF != (opt = getopt(argc, argv, "O:l:s:d:Dp:h?Vaiof:")) ) + while ( EOF != (opt = getopt(argc, argv, "FSO:l:s:d:Dp:h?Vaiof:")) ) switch (opt) { + case 'F': + Fork = False; + break; + case 'S': + log_stdout = True; + break; case 'O': pstrcpy(user_socket_options,optarg); break; @@ -554,6 +564,8 @@ static void process(void) case 'i': interactive = True; + Fork = False; + log_stdout = True; break; case 'D': @@ -586,6 +598,11 @@ static void process(void) usage(argv[0]); exit(1); } + if (log_stdout && Fork) { + d_printf("Can't log to stdout (-S) unless daemon is in foreground (-F) or interactive (-i)\n"); + usage(argv[0]); + exit(1); + } #ifdef HAVE_SETLUID /* needed for SecureWare on SCO */ @@ -604,7 +621,7 @@ static void process(void) set_remote_machine_name("wrepld"); - setup_logging(argv[0],interactive); + setup_logging(argv[0],log_stdout); /* we want to re-seed early to prevent time delays causing client problems at a later date. (tridge) */ @@ -682,7 +699,7 @@ static void process(void) if (is_daemon && !interactive) { DEBUG( 3, ( "Becoming a daemon.\n" ) ); - become_daemon(); + become_daemon(Fork); } #if HAVE_SETPGID |