Bug#299051: exim4+libnss-ldap: Loops infinitely on startup

Antonio Kanouras Antonio Kanouras <solist@solistland.dnsalias.org>, 299051@bugs.debian.org
Fri, 11 Mar 2005 14:36:45 +0200


Package: exim4
Version: 4.50-4
Severity: normal

Hi,

I've hit a weird bug when using libnss-ldap. It seems related to
#190072. Under some circumstances, Exim4 gets stuck in an infinite
loop. Everything else on the system works as usual in either case. I'm
just a beginner in C, but it seems that when using the first version of
nsswitch.conf, libnss-ldap (or libldap probably) tries to use Exim's
IPv6 listening socket for communicating with the LDAP server instead of
opening its own.

Although they are defined, I don't use Netgroups. System users and
groups except "staff" are in flat files. The rest are in LDAP.
Exim4 uses LDAP directly for SMTP AUTH.

The bug isn't hit if I run:
	exim4 -bdf
or:	exim4 -bdf -d
or:	exim4 -bdf -d+all
or:	exim4 -bd -d
or:	exim4 -bd -d+all
or:	exim4 -q30m

or if nscd is running.

Please let me know if there's anything else I can do/provide more info
about.


-- Package Versions --
libnss-ldap	220-1
libldap2	2.1.30-3
slapd		2.1.30-3
exim4-config	4.50-4


-- /etc/nsswitch.conf (Bug is hit) --
passwd:         ldap files
group:          ldap files
shadow:         ldap files

hosts:          files dns
networks:       files
protocols:      db
services:       db
ethers:         db
rpc:            db
netgroup:       ldap
-------------------

-- /etc/nsswitch.conf (OK) --
passwd:         files ldap
group:          files ldap
shadow:         files ldap

hosts:          files dns
networks:       files
protocols:      db
services:       db
ethers:         db
rpc:            db
netgroup:       ldap
-------------------


-- /etc/libnss-ldap.conf --
# Note: the bug is hit when using "host 127.0.0.1" too.
uri ldapi://%2fvar%2frun%2fldapi/
base dc=solistland,dc=org
ldap_version 3
rootbinddn cn=admin,dc=solistland,dc=org
nss_base_passwd         ou=People,dc=solistland,dc=org?one
nss_base_shadow         ou=People,dc=solistland,dc=org?one
nss_base_group          ou=Group,dc=solistland,dc=org?one
nss_base_netgroup       ou=Netgroup,dc=solistland,dc=org?one
----------------------

-- /var/log/exim4/mainlog --
2005-03-11 04:15:08 exim 4.50 daemon started: pid=28714, -q30m, listening for SMTP on port 25 (IPv6 and IPv4)
2005-03-11 04:15:08 50 select() failures: Bad file descriptor
2005-03-11 04:15:08 50 select() failures: Bad file descriptor
2005-03-11 04:15:08 50 select() failures: Bad file descriptor
2005-03-11 04:15:08 50 select() failures: Bad file descriptor
[and so on... (about 300 lines/sec)]
----------------------------

-- /var/log/syslog --
Mar 11 04:15:08 planis exim4: nss_ldap: reconnecting to LDAP server...
Mar 11 04:15:08 planis exim4: nss_ldap: reconnected to LDAP server after 1 attempt(s)
---------------------


-- strace -f exim4 -bd  --
[...]
dup2(0, 1)                              = 1
fstat64(2, 0xbffff1d0)                  = -1 EBADF (Bad file descriptor)
dup2(0, 2)                              = 2
getppid()                               = 27671
clone(Process 27674 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb78d96c8) = 27674
[pid 27674] setsid()                    = 27674
[pid 27674] socket(PF_INET6, SOCK_STREAM, IPPROTO_IP <unfinished ...>
[pid 27673] exit_group(0)               = ?
[pid 27674] <... socket resumed> )      = 3
[pid 27674] setsockopt(3, SOL_IPV6, IPV6_V6ONLY, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
bind(3, {sa_family=AF_INET6, sin6_port=htons(25), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
listen(3, 20)                           = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0
bind(4, {sa_family=AF_INET, sin_port=htons(25), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(4, 20)                           = 0
open("/var/run/exim4/exim.pid", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 5
getpid()                                = 27674
fstat64(5, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe8000
fchmod(5, 0644)                         = 0
write(5, "27674\n", 6)                  = 6
close(5)                                = 0
munmap(0xb7fe8000, 4096)                = 0
rt_sigaction(SIGHUP, {0x805c8d0, [HUP], SA_RESTART}, {SIG_IGN}, 8) = 0
geteuid32()                             = 0
geteuid32()                             = 0
getegid32()                             = 103
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_IGN}, 8) = 0
geteuid32()                             = 0
geteuid32()                             = 0
time(NULL)                              = 1110490993
write(3, "0\201\321\2\1\vc\201\313\4\36ou=People,dc=solistla"..., 212) = -1 EPIPE (Broken pipe)
--- SIGPIPE (Broken pipe) @ 0 (0) ---
time(NULL)                              = 1110490993
write(3, "0\5\2\1\fB\0", 7)             = -1 EPIPE (Broken pipe)
--- SIGPIPE (Broken pipe) @ 0 (0) ---
close(3)                                = 0
time([1110490993])                      = 1110490993
open("/etc/localtime", O_RDONLY)        = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=823, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe8000
read(3, "TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0\t\0"..., 4096) = 823
close(3)                                = 0
munmap(0xb7fe8000, 4096)                = 0
rt_sigaction(SIGPIPE, {0xb7c30530, [], 0}, {SIG_IGN}, 8) = 0
socket(PF_FILE, SOCK_DGRAM, 0)          = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
connect(3, {sa_family=AF_FILE, path="/dev/log"}, 16) = -1 EPROTOTYPE (Protocol wrong type for socket)
close(3)                                = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
connect(3, {sa_family=AF_FILE, path="/dev/log"}, 16) = 0
send(3, "<14>Mar 10 23:43:13 exim4: nss_l"..., 68, 0) = 68
rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
geteuid32()                             = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 5
fcntl64(5, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(5, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(5, {sa_family=AF_FILE, path="/var/run/ldapi"}, 110) = 0
fcntl64(5, F_GETFL)                     = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(5, F_SETFL, O_RDWR)             = 0
getpeername(5, {sa_family=AF_FILE, path="/var/run/ldapi"}, [17]) = 0
uname({sys="Linux", node="planis", ...}) = 0
getegid32()                             = 103
geteuid32()                             = 0
time(NULL)                              = 1110490994
write(5, "01\2\1\1`,\2\1\3\4\35cn=admin,dc=solistla"..., 51) = 51
time(NULL)                              = 1110490994
select(1024, [5], [], NULL, {30, 0})    = 1 (in [5], left {29, 990000})
read(5, "0\f\2\1\1a\7\n", 8)            = 8
read(5, "\1\0\4\0\4\0", 6)              = 6
time(NULL)                              = 1110490994
setsockopt(5, SOL_SOCKET, SO_KEEPALIVE, [0], 4) = 0
fcntl64(5, F_SETFD, FD_CLOEXEC)         = 0
getsockname(5, {sa_family=AF_FILE, path=@}, [2]) = 0
getpeername(5, {sa_family=AF_FILE, path="/var/run/ldapi"}, [17]) = 0
time([1110490994])                      = 1110490994
time(NULL)                              = 1110490994
write(5, "0\201\321\2\1\2c\201\313\4\36ou=People,dc=solistla"..., 212) = 212
select(1024, [5], [], NULL, NULL)       = 1 (in [5])
read(5, "0\f\2\1\2e\7\n", 8)            = 8
read(5, "\1\0\4\0\4\0", 6)              = 6
time(NULL)                              = 1110490994
time([1110490994])                      = 1110490994
rt_sigaction(SIGPIPE, {0xb7c30530, [], 0}, {SIG_IGN}, 8) = 0
send(3, "<14>Mar 10 23:43:14 exim4: nss_l"..., 83, 0) = 83
rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
time([1110490994])                      = 1110490994
rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
open("/etc/passwd", O_RDONLY)           = 6
fcntl64(6, F_GETFD)                     = 0
fcntl64(6, F_SETFD, FD_CLOEXEC)         = 0
fstat64(6, {st_mode=S_IFREG|0644, st_size=1520, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe8000
read(6, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 1520
close(6)                                = 0
munmap(0xb7fe8000, 4096)                = 0
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_IGN}, 8) = 0
geteuid32()                             = 0
geteuid32()                             = 0
geteuid32()                             = 0
time(NULL)                              = 1110490994
write(5, "0i\2\1\3cd\4\36ou=People,dc=solistland"..., 107) = 107
select(1024, [5], [], NULL, NULL)       = 1 (in [5])
read(5, "0\f\2\1\3e\7\n", 8)            = 8
read(5, "\1\0\4\0\4\0", 6)              = 6
time(NULL)                              = 1110490994
time([1110490994])                      = 1110490994
geteuid32()                             = 0
geteuid32()                             = 0
time(NULL)                              = 1110490994
write(5, "0w\2\1\4cr\4\35ou=Group,dc=solistland,"..., 121) = 121
time([1110490994])                      = 1110490994
select(1024, [5], [], NULL, NULL)       = 1 (in [5])
read(5, "0\f\2\1\4e\7\n", 8)            = 8
read(5, "\1\0\4\0\4\0", 6)              = 6
time(NULL)                              = 1110490994
geteuid32()                             = 0
rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
open("/etc/group", O_RDONLY)            = 6
fcntl64(6, F_GETFD)                     = 0
fcntl64(6, F_SETFD, FD_CLOEXEC)         = 0
fstat64(6, {st_mode=S_IFREG|0644, st_size=736, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe8000
_llseek(6, 0, [0], SEEK_CUR)            = 0
read(6, "root::0:\ndaemon::1:\nbin::2:\nsys:"..., 4096) = 736
read(6, "", 4096)                       = 0
close(6)                                = 0
munmap(0xb7fe8000, 4096)                = 0
setgroups32(2, [103, 45])               = 0
setgid32(103)                           = 0
setuid32(103)                           = 0
rt_sigaction(SIGCHLD, {0x805c900, [], 0}, NULL, 8) = 0
getpid()                                = 27674
time(NULL)                              = 1110490994
open("/var/log/exim4/mainlog", O_WRONLY|O_APPEND|O_LARGEFILE) = 6
fcntl64(6, F_GETFD)                     = 0
fcntl64(6, F_SETFD, FD_CLOEXEC)         = 0
fstat64(6, {st_mode=S_IFREG|0640, st_size=302636174, ...}) = 0
write(6, "2005-03-10 23:43:14 exim 4.50 da"..., 118) = 118
getpid()                                = 27674
close(6)                                = 0
close(3)                                = 0
select(5, [3 4], NULL, NULL, NULL)      = -1 EBADF (Bad file descriptor)
waitpid(-1, 0xbffff238, WNOHANG)        = -1 ECHILD (No child processes)
select(5, [3 4], NULL, NULL, NULL)      = -1 EBADF (Bad file descriptor)
waitpid(-1, 0xbffff238, WNOHANG)        = -1 ECHILD (No child processes)
select(5, [3 4], NULL, NULL, NULL)      = -1 EBADF (Bad file descriptor)
waitpid(-1, 0xbffff238, WNOHANG)        = -1 ECHILD (No child processes)
[...]
select(5, [3 4], NULL, NULL, NULL)      = -1 EBADF (Bad file descriptor)
waitpid(-1, 0xbffff238, WNOHANG)        = -1 ECHILD (No child processes)
select(5, [3 4], NULL, NULL, NULL)      = -1 EBADF (Bad file descriptor)
waitpid(-1, 0xbffff238, WNOHANG)        = -1 ECHILD (No child processes)
select(5, [3 4], NULL, NULL, NULL)      = -1 EBADF (Bad file descriptor)
waitpid(-1, 0xbffff238, WNOHANG)        = -1 ECHILD (No child processes)
time(NULL)                              = 1110490994
time(NULL)                              = 1110490994
close(-1)                               = -1 EBADF (Bad file descriptor)
open("/var/log/exim4/mainlog", O_WRONLY|O_APPEND|O_LARGEFILE) = 3
fcntl64(3, F_GETFD)                     = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0640, st_size=302636292, ...}) = 0
write(3, "2005-03-10 23:43:14 50 select() "..., 62) = 62
open("/var/log/exim4/paniclog", O_WRONLY|O_APPEND|O_LARGEFILE) = 6
fcntl64(6, F_GETFD)                     = 0
fcntl64(6, F_SETFD, FD_CLOEXEC)         = 0
write(6, "2005-03-10 23:43:14 50 select() "..., 62) = 62
close(6)                                = 0
close(3)                                = 0
select(5, [3 4], NULL, NULL, NULL)      = -1 EBADF (Bad file descriptor)
waitpid(-1, 0xbffff238, WNOHANG)        = -1 ECHILD (No child processes)
select(5, [3 4], NULL, NULL, NULL)      = -1 EBADF (Bad file descriptor)
waitpid(-1, 0xbffff238, WNOHANG)        = -1 ECHILD (No child processes)
select(5, [3 4], NULL, NULL, NULL)      = -1 EBADF (Bad file descriptor)
waitpid(-1, 0xbffff238, WNOHANG)        = -1 ECHILD (No child processes)
[and so on...]





Thanks for your work,
Antonio


PS: The split conf files rock!



-- Package-specific info:
Exim version 4.50 #1 built 02-Mar-2005 07:42:40
Copyright (c) University of Cambridge 2004
Berkeley DB: Sleepycat Software: Berkeley DB 4.2.52: (December  3, 2003)
Support for: iconv() IPv6 PAM Perl GnuTLS Content_Scanning Old_Demime
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch ldap ldapdn ldapm mysql nis nis0 passwd pgsql
Authenticators: cram_md5 cyrus_sasl plaintext spa
Routers: accept dnslookup ipliteral iplookup manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Fixed never_users: 0
Configuration file is /var/lib/exim4/config.autogenerated
# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'

dc_eximconfig_configtype='internet'
dc_other_hostnames='planis.dynalias.net'
dc_local_interfaces=''
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='true'
dc_relay_nets='192.168.0.0/16'
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname=''

# Solist
# WARNING: This was not set by debconf
dc_localdelivery='maildir_home'

dc_mailname_in_oh='true'
mailname:planis.dynalias.net

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (990, 'unstable'), (70, 'experimental')
Architecture: i386 (i586)
Kernel: Linux 2.6.10
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages exim4 depends on:
ii  exim4-base                    4.50-4     support files for all exim MTA (v4
ii  exim4-daemon-heavy            4.50-4     exim MTA (v4) daemon with extended

-- no debconf information