[Samba] Semantics of "smb ports = 0"

Andrew Bartlett abartlet at samba.org
Sun Apr 29 01:13:22 MDT 2012


On Fri, 2012-04-27 at 10:56 -0400, Nikolaus Rath wrote:
> On 04/26/2012 09:13 PM, Jeremy Allison wrote:
> > On Wed, Apr 25, 2012 at 10:04:30AM -0400, Nikolaus Rath wrote:
> >> Hello,
> >>
> >> The qemu emulator has a feature to fork a samba instance for file
> >> sharing with the emulated hosts. It communicates with smbd over stdin.
> >> The generated configuration file contains a "smb ports = 0" directive to
> >> prevent smbd from listening to any ports.
> >>
> >> Unfortunately, with at least Samba 3.6.4 this causes a segfault
> >> instead:
> >>
> >> [0] vostro:/tmp/qemu-smb.6836-0# smbd -i -s smb.conf
> >> Unable to setup corepath for smbd: Operation not permitted
> >> smbd version 3.6.4 started.
> >> Copyright Andrew Tridgell and the Samba Team 1992-2011
> >> open_sockets_smbd: No sockets available to bind to.
> >> ===============================================================
> >> Abnormal server exit: open_sockets_smbd() failed
> >> ===============================================================
> >> BACKTRACE: 6 stack frames:
> >>  #0 smbd(log_stack_trace+0x1a) [0x7fe50c14f8ba]
> >>  #1 smbd(+0x6a0743) [0x7fe50c3bd743]
> >>  #2 smbd(+0x6a0a41) [0x7fe50c3bda41]
> >>  #3 smbd(main+0xa52) [0x7fe50be26d42]
> >>  #4 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd) [0x7fe508ac0ead]
> >>  #5 smbd(+0x10a6b9) [0x7fe50be276b9]
> >>
> >>
> >> Also, there is some confusion as to whether this option was actually
> >> ever necessary.
> >>
> >> Could someone clarify if something like this is still needed, or if
> >> Samba does the right think automatically? In the later case, has this
> >> always been the case or was it introduced in a specific version (and the
> >> "smb ports = 0" required before)?
> > 
> > In fack looking at the current code in v3-6-test, so long as
> > you ensure that you run without the '-D' (deamonize) option,
> > and fd 0 is a socket (we use getsockopt(fd, SOL_SOCKET, SO_TYPE...)
> > to detect this) then we'll go into 'inetd' mode, which I
> > think is what you want.
> 
> Yes. I am just wondering if this has always been the case, or if this is
> a recent feature and smb ports = 0 may have been required in earlier
> versions.

This has always been the case.  This (inetd) mode of operation is the
original mode of operation, well before we even had an smb.conf to put
'smb ports' into.  It remains supported, but isn't used much these days.
That said, I'm surprised we parse that line enough to crash in this
case.

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org



More information about the samba mailing list