Samba logging to stdout BUG

Aleksandr A. Kozlov A-Hedgehog at yandex.ru
Thu Nov 20 09:35:17 GMT 2003


Hello, All!

 I am a big fan of DJb daemontools and i think that running daemons
 under supervise process is the right way. So I decide to run my samba
 (v2.2.8a) under daemontools, then I found patch from Michael
 Handler (www.grendel.net). Patch samba-2.2.8-daemontools.diff was
 applied successfully. This patch allow daemons (smbd, nmbd, winbindd)
 to run in foreground (-F option) and log to stdout (-S option).

 Running in foreground ("smbd -F") works fine!
 Once I try to get smbd to log to stdout. Following documentation, I used
 -S, so it become "smbd -FS". Daemon works in foreground, but in stdout I
 see only few first strings of log! Running "-i" logs to stdout
 significally more than few strings. See for example:

 Running "smbd -i -d2" gave me following output:
/===BEGIN===/
smbd version 2.2.8a started.
Copyright Andrew Tridgell and the Samba Team 1992-2002
uid=0 gid=0 euid=0 egid=0
Processing section "[test]"
Processing section "[vfs-testing]"
Processing section "[hidden]"
Processing section "[helpshare]"
added interface ip=10.0.0.3 bcast=10.0.0.255 nmask=255.255.255.0
file_init: Information only: requested 10000 open files, 937 are available.
waiting for a connection
netbios connect: name1=SERVER           name2=HOME1
netbios connect: local=server remote=home1
StartTLS issued: using a TLS connection
ldap_open_connection: connection opened
ldap_connect_system: Binding to ldap server as "cn=samba,ou=daemons,dc=myoffice,dc=ru"
ldap_connect_system: succesful connection to the LDAP server
ldap_search_one_user: searching for:[(&(uid=alex)(objectclass=sambaAccount))]
get_single_attribute: [uid] = [alex]
Entry found for user: alex
get_single_attribute: [pwdLastSet] = [1059150427]
get_single_attribute: [logonTime] = [0]
get_single_attribute: [logoffTime] = [2147483647]
get_single_attribute: [kickoffTime] = [2147483647]
get_single_attribute: [pwdCanChange] = [0]
get_single_attribute: [pwdMustChange] = [2147483647]
get_single_attribute: [cn] = [Alexandr A. Kozlov]
get_single_attribute: [homeDrive] = [<does not exist>]
get_single_attribute: [smbHome] = [<does not exist>]
get_single_attribute: [scriptPath] = [<does not exist>]
get_single_attribute: [profilePath] = [<does not exist>]
get_single_attribute: [description] = [<does not exist>]
get_single_attribute: [userWorkstations] = [<does not exist>]
get_single_attribute: [rid] = [3000]
get_single_attribute: [primaryGroupID] = [3001]
get_single_attribute: [lmPassword] = [19ABB5C851CE7A54AAD3B435B51404EE]
get_single_attribute: [ntPassword] = [FD5117F72B251C2CB9A7A6669B8BD0A6]
get_single_attribute: [acctFlags] = [[UX         ]]
home1 (10.0.0.100) connect to service vfs-testing as user alex (uid=1000, gid=1000) (pid 15102)
/===END===/
 
 Running "smbd -FS -d2" gave me following output:
/===BEGIN===/
smbd version 2.2.8a started.
Copyright Andrew Tridgell and the Samba Team 1992-2002
uid=0 gid=0 euid=0 egid=0
Processing section "[test]"
Processing section "[vfs-testing]"
Processing section "[hidden]"
Processing section "[helpshare]"
added interface ip=10.0.0.3 bcast=10.0.0.255 nmask=255.255.255.0
file_init: Information only: requested 10000 open files, 937 are available.
standard input is not a socket, assuming -D option
waiting for a connection 
/===END===/
 
 As you can see, logging to stdout not working! I investigated this
 problem, and the problem was in /smbd/server.c
          /* close our standart file
          descriptors */
          close_low_fds();
 After execution of this point logging stops! Evidently, this is
 because of closing stdout. So I commented out this string and logging
 to stdout works excellent!

 By the way, options -F and -S are build-in in Samba3. I have no
 possibilities to check this bug in Samba3, so please check this bug
 in samba3 release. It seems to me than this bug is also present,
 because:
  - procedure close_low_fds(BOOL stderr_too) still closing stdout
  - procedure calls "close_low_fds(False)" in the same place (so it will
    close stdout, leaving stderr without changes)

Good Bye!
Alex




More information about the samba-technical mailing list