[Date Prev][Date Next] [Chronological] [Thread] [Top]

getaddrinfo() may legally return ai_addr = NULL (ITS#1416)

Full_Name: Peter Marschall
Version: 20.0.18
OS: Linux 2.4.x
URL: ftp://ftp.openldap.org/incoming/peter.marschall-011029.patch
Submission from: (NULL) (

The man page for getaddrinfo() in the GNU C library states:       
       If node is NULL, the network address in each socket struc-
       ture  is  initialized  according  to  the AI_PASSIVE flag,
       which is set in the ai_flags member of the  hints  parame-
       ter.  The network address in each socket structure will be
       left unspecified if AI_PASSIVE flag is set.  This is  used
       by server applications, which intend to accept client con-
       nections on any network address.  The network address will
       be set to the loopback interface address if the AI_PASSIVE
       flag is not set.  This is  used  by  client  applications,
       which  intend  to  connect to a server running on the same
       network host.
So, at least for glibc, the ai_addr field of the addrinfo structure 
may be legally NULL when the AI_PASSIVE flag is set and host is NULL.

Unfortunately slap_get_listener_addresses() in servers/slapd/daemon.c
issues a warnung when ai_addr is NULL no matter what which value host has.

The patch in ftp://ftp.openldap.org/incoming/
should fix this problem.
Since my knowledge in network programming is somewhat limited, this
patch may need some polishing.