[exim] Exim can't resolve hostname of database when second e…

Etusivu
Poista viesti
Vastaa
Lähettäjä: Marcin Mirosław
Päiväys:  
Vastaanottaja: exim users
Aihe: [exim] Exim can't resolve hostname of database when second email is sended in one TCP connection
Hello!
I'm testing new configuration using "exim -bh x.y.z -d". I've noticed
strange behavior when I send HELO/EHLO after first mail was received.

I'm sending:
>>>>>>>>>>>>>>>>>>>>

ehlo toja
mail from: a@???
rcpt to: uzytkownik@???
data


asdadasd

.

helo test
quit
<<<<<<<<<<<<<<<<<<<

When second HELO appears I'm getting in debug session:
SMTP<< ehlo test
sender_fullhost = google-public-dns-a.google.com (test) [8.8.8.8]
sender_rcvhost = google-public-dns-a.google.com ([8.8.8.8] helo=test)
set_process_info: 8450 handling incoming connection from
google-public-dns-a.google.com (test) [8.8.8.8]
using ACL "acl_check_helo"
processing "drop"
search_open: pgsql "NULL"
search_find: file="NULL"
key="SELECT domain FROM postfixadmin_domain WHERE domain = 'test' AND
active = '1' AND backupmx = '0' UNION select '@'" partial=-1 affix=NULL
starflags=0
LRU list:
internal_search_find: file="NULL"
type=pgsql key="SELECT domain FROM postfixadmin_domain WHERE domain =
'test' AND active = '1' AND backupmx = '0' UNION select '@'"
database lookup required for SELECT domain FROM postfixadmin_domain
WHERE domain = 'test' AND active = '1' AND backupmx = '0' UNION select '@'
PostgreSQL query: SELECT domain FROM postfixadmin_domain WHERE domain =
'test' AND active = '1' AND backupmx = '0' UNION select '@'
PGSQL new connection: host=pgsql port=5432 database=xx_poczta_test_db
user=xx_poczta_test
PGSQL connection failed: could not translate host name "pgsql" to
address: Name or service not known

lookup deferred: PGSQL connection failed: could not translate host name
"pgsql" to address: Name or service not known

LOG: MAIN PANIC
failed to expand "<\n ${lookup pgsql{


Definition of pgsql_servers is:
hide pgsql_servers = "pgsql::5432/xx_poczta_test_db/xx_poczta_test/yy"

Full hostname of database server is: pgsql.in.xx.com.pl
$ cat /etc/resolv.conf
search in.xx.com.pl
nameserver 192.168.1.35


$ host pgsql
pgsql.in.cadera.com.pl has address 192.168.1.220

When Iconfigure connection as:
hide pgsql_servers =
"pgsql.in.cadera.com.pl::5432/xx_poczta_test_db/xx_poczta_test/yy"

or I add "pgsql" to /etc/hosts then problem disappears.
It looks like "search" option isn't applied when exim tries translate
hostname to address.

Ok, I run exim under strace, here is relevant part
when first time exim tries to resolve "pgsql":
connect(3, {sa_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("192.168.1.35")}, 16) = 0
gettimeofday({1381226200, 288600}, NULL) = 0
poll([{fd=3, events=POLLOUT}], 1, 0)    = 1 ([{fd=3, revents=POLLOUT}])
sendto(3,
"\224\242\1\0\0\1\0\0\0\0\0\0\5pgsql\2in\6cadera\3com\2pl\0\0\1\0\1",
40, MSG_NOSIGNAL, NULL, 0) = 40
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 5000) = 1 ([{fd=3,
revents=POLLOUT}])
sendto(3,
"\214o\1\0\0\1\0\0\0\0\0\0\5pgsql\2in\6cadera\3com\2pl\0\0\34\0\1", 40,
MSG_NOSIGNAL, NULL, 0) = 40
gettimeofday({1381226200, 289009}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, 4999)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [94])                = 0
recvfrom(3,
"\224\242\205\200\0\1\0\1\0\2\0\0\5pgsql\2in\6cadera\3com\2pl\0\0\1\0\1\300\f\0\1\0\1\0\0*0\0\4\300\250\1\334\300\22\0\2\0\1\0\0*0\0\7\4dns1\300\22\300\22\0\2\0\1\0\0*0\0\7\4dns2\300\22",
2048, 0, {sa_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("192.168.1.35")}, [16]) = 94
gettimeofday({1381226200, 293071}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, 4995)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [87])                = 0
recvfrom(3,
"\214o\205\200\0\1\0\0\0\1\0\0\5pgsql\2in\6cadera\3com\2pl\0\0\34\0\1\300\22\0\6\0\1\0\0*0\0#\4dns1\300\22\5admin\300\25w\3752`\0\0*0\0\0\34
\0\t:\200\0\0*0", 1954, 0, {sa_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("192.168.1.35")}, [16]) = 87
close(3)


When second HELO is sended:
connect(3, {sa_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("192.168.1.35")}, 16) = 0
gettimeofday({1381226202, 831438}, NULL) = 0
poll([{fd=3, events=POLLOUT}], 1, 0)    = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "\36V\1\0\0\1\0\0\0\0\0\0\5pgsql\0\0\1\0\1", 23, MSG_NOSIGNAL,
NULL, 0) = 23
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 5000) = 1 ([{fd=3,
revents=POLLOUT}])
sendto(3, "\256J\1\0\0\1\0\0\0\0\0\0\5pgsql\0\0\34\0\1", 23,
MSG_NOSIGNAL, NULL, 0) = 23
gettimeofday({1381226202, 831628}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, 4999)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [98])                = 0
recvfrom(3,
"\36V\201\203\0\1\0\0\0\1\0\0\5pgsql\0\0\1\0\1\0\0\6\0\1\0\0#\360\0@\1a\froot-servers\3net\0\5nstld\fverisign-grs\3com\0w\375{\0\0\0\7\10\0\0\3\204\0\t:\2
00\0\1Q\200", 2048, 0, {sa_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("192.168.1.35")}, [16]) = 98
gettimeofday({1381226202, 834145}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, 4997)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [98])                = 0
recvfrom(3,
"\256J\201\203\0\1\0\0\0\1\0\0\5pgsql\0\0\34\0\1\0\0\6\0\1\0\0#\360\0@\1a\froot-servers\3net\0\5nstld\fverisign-grs\3com\0w\375{\0\0\0\7\10\0\0\3\204\0\t:
\200\0\1Q\200", 1950, 0, {sa_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("192.168.1.35")}, [16]) = 98
close(3)                                = 0
write(2, "PGSQL connection failed:
[...]


So in second case Exim doesn't send correct search option.

exim -bV
Exim version 4.82_RC2 #2 built 08-Oct-2013 11:56:12
Copyright (c) University of Cambridge, 1995 - 2012
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007
- 2012
Berkeley DB: Berkeley DB 4.8.30: (2013-09-25)
Support for: crypteq iconv() OpenSSL Content_Scanning DKIM Old_Demime
Experimental_SRS
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm
dbmjz dbmnz dnsdb dsearch passwd pgsql
Authenticators: cram_md5 dovecot plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
Configuration file is /etc/exim/exim.conf

Thanks for any help!
Marcin