[there is no samba2 section in bugzilla, I hijacked samba3 one] One can run samba 2.2.12 daemons (nmbd,smbd,winbindd) under daemontools if they are started with -i option. However, smbd does not handle more than one connection at once in this mode. Also, if one redirects stdout to pipe/file, logging to stdout becomes buffered. Log text appears with inacceptable delay. This patch: * adds option -f to nmbd, smbd and windindd. * for nmbd and winbindd it is identical to -i. * for smbd it is mostly like -i but allows multiple connections to smbd. * usage() text updated accordingly. * smbd help on -i now mentions single threaded behaviour. * getopt in nmbd and smbd source expected -f option with parameter, but there were no other supporting code for it. An oversight? Removed. * stdout set to unbuffered mode if we do logging to it. Run tested. Please review/apply.
Created attachment 703 [details] The patch for 2.2.12
Two comments: - 2.2 is _not_ being maintained and will not be changed for this, so I'm closing the bug. If you need this change for 3.0, please submit a 3.0 patch. - This is not in the "net" program, so I'm changing the component.
> If you need this change for 3.0, please submit a 3.0 patch. I *was* using samba3, but was forced to migrate into stone age of 2.2.12. Right now I'm stranded in 2.2.12, because 3.0.7 does not want to join my NT4 domain. I reported the issue to the lists several times. I see other similar reports there, however, I also see success reports too. I will submit a report to bugzilla tomorrow after final round of testing. Do you want to be CCed?
3.0.7 mysteriously started to join just fine. Oh well... samba3, too, needs some fixing for daemontools operation. I have another patch now: * add --log-stdout to winbindd (it has --stdout, which differs from nmbd/smbd). * untangle and fix stdout logging, backgrounding, daemonizing and inetd mode operation of smbd. * while we're in server.c, convert runtime error into link-time one. Lightly run tested. Please review/apply.
Created attachment 706 [details] patch against 3.0.7
Created attachment 709 [details] Updated patch for 3.0.7 I realized that daemonize and background are always set to the same value, so I merged them into one. Also I moved close_low_fds() out of become_daemon(), because these are logically unrelated operations. I modified all callsites of become_daemon() to call close_low_fds() everywhere except smbd/server.c. In server.c I do close_low_fds() only if requested (i.e. if user did not specify --log-stdout). Please review/apply.
*** Bug 1758 has been marked as a duplicate of this bug. ***
To run smbd under a daemon monitor you should use -F not -i. smbd -F is used on OS X to run smbd, nmbd and winbindd under launchd and it works just fine. AFAICT, this works as designed.
If it's still broken in 3.5, please reopen. 3.0 isn't supported anymore.