cyradm on Solaris 9 revisited unknown host

Michael O'Rourke OP morourke at
Tue Dec 13 18:15:41 EST 2005

Hello all,

I have Cyrus IMAPd 2.2.12 (patched with Christos Soulios' auto* patches)
on a Solaris 9 box; gcc 3.4.2. It is compiled thusly (the CFLAGS, CPPFLAGS
and LDFLAGS are three long lines -- really!):

export CFLAGS="-I/usr/local/include -I/usr/local/BerkeleyDB.4.3/include
-I/usr/local/ssl/include -I/opt/sfw/gcc-3/include"
export CPPFLAGS="-I/usr/local/include -I/usr/local/BerkeleyDB.4.3/include
-I/usr/local/ssl/include -I/opt/sfw/gcc-3/include"
export LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB.4.3/lib
-L/usr/local/ssl/lib -L/usr/local/lib/sasl2
-lsocket -lnsl"
./configure --enable-nntp --enable-listext --enable-netscapehack \
  --disable-gssapi --with-cyrus-user=cyrus --with-cyrus-group=smmsp \
  --with-auth=pts --with-bdb=/usr/local/BerkeleyDB.4.3 \
  --with-bdb-libdir=/usr/local/BerkeleyDB.4.3/lib \
  --with-bdb-incdir=/usr/local/BerkeleyDB.4.3/include \
  --with-ldap=/usr/local --with-pts=ldap --with-openssl=/usr/local/ssl \
  --with-sasl=/usr/local/lib --with-perl=/usr/local/bin/perl

Several times in the past there have been problems with an "unknown host"
error from cyradm on Solaris 9. The only "solution" that I have seen that
works is to remove the ai_flags member of the hints structure at about
line 239 of lib/imclient.c in the imclient_connect function. On Solaris 9,
the AI_CANONNAME is defined in /usr/include/netdb.h as 0x0010 (or 16 to
save you the conversion), while on linux, it is 2. The error that
getaddrinfo returned was 3, or a bad ai_flags value. I then tried setting
the ai_flags to 2, rather than AI_CANONNAME, and cyradm worked!

On this machine I also have ISC Bind9 installed. It has its own netdb.h
and getaddrinfo function. ClamAV also has a private getaddrinfo in Others, like OpenLDAP have it as a global.

It seems that Cyrus IMAPd is grabbing Sun's header file
(/usr/include/netdb.h), but when the call is made, it is using one of the
other function calls which are conveniently available and possibly first
in the search path. None of the other software on the system (OpenLDAP,
OpenSSL, Cyrus SASL, etc) is linked against libbind.a except for Sendmail

One other thing. Other programs that use getaddrinfo (most notably,
imtest) work as expected. I therefore suspect some glitch in perl (5.8.5),
which I compiled myself, but it is not linked against any of the programs
with their own getaddrinfo (I know this since it was the third thing I
compiled on this machine and before Bind9 and ClamAV) and perl does not
have such a private function (that I can find).

How can I find out which of these extraneous getaddrinfo calls imclient.c
is using? I can not run cyradm in a debugger since it is a shell script
(which then calls perl, which does who knows what!). Can someone more
knowledgable than I suggest a small program that links against imclient
and calls imclient_connect that I can run in the gnu debugger? Is there a
simpler way?

Thank You, Mike.

More information about the Info-cyrus mailing list