Bug 1874 - [PATCH] samba is hard to use with daemontools.
Summary: [PATCH] samba is hard to use with daemontools.
Status: RESOLVED WONTFIX
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: File Services (show other bugs)
Version: 3.0.7
Hardware: All Windows 2000
: P3 normal
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
: 1758 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-05 23:03 UTC by Denis Vlasenko (dead mail address)
Modified: 2010-04-26 03:43 UTC (History)
1 user (show)

See Also:


Attachments
The patch for 2.2.12 (5.59 KB, patch)
2004-10-05 23:05 UTC, Denis Vlasenko (dead mail address)
no flags Details
patch against 3.0.7 (6.52 KB, patch)
2004-10-07 04:45 UTC, Denis Vlasenko (dead mail address)
no flags Details
Updated patch for 3.0.7 (8.73 KB, patch)
2004-10-08 03:41 UTC, Denis Vlasenko (dead mail address)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Vlasenko (dead mail address) 2004-10-05 23:03:34 UTC
[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.
Comment 1 Denis Vlasenko (dead mail address) 2004-10-05 23:05:41 UTC
Created attachment 703 [details]
The patch for 2.2.12
Comment 2 Jim McDonough 2004-10-06 05:53:04 UTC
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.
Comment 3 Denis Vlasenko (dead mail address) 2004-10-06 07:03:31 UTC
> 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?
Comment 4 Denis Vlasenko (dead mail address) 2004-10-07 04:43:50 UTC
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.
Comment 5 Denis Vlasenko (dead mail address) 2004-10-07 04:45:47 UTC
Created attachment 706 [details]
patch against 3.0.7
Comment 6 Denis Vlasenko (dead mail address) 2004-10-08 03:41:28 UTC
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.
Comment 7 Gerald (Jerry) Carter (dead mail address) 2006-04-10 07:44:19 UTC
*** Bug 1758 has been marked as a duplicate of this bug. ***
Comment 8 James Peach 2007-05-12 23:18:11 UTC
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.
Comment 9 Stefan Metzmacher 2010-04-26 03:43:03 UTC
If it's still broken in 3.5, please reopen.
3.0 isn't supported anymore.