Issue 1416 - getaddrinfo() may legally return ai_addr = NULL
Summary: getaddrinfo() may legally return ai_addr = NULL
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-29 13:55 UTC by peter@adpm.de
Modified: 2014-08-01 21:05 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description peter@adpm.de 2001-10-29 13:55:18 UTC
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) (194.145.150.12)


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.

Comment 1 venaas@openldap.org 2001-10-30 21:39:31 UTC
On Mon, Oct 29, 2001 at 01:55:20PM +0000, peter.marschall@mayn.de wrote:
> 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) (194.145.150.12)
> 
> 
> 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.

I believe this is just poor language. The draft specs state that if
AI_PASSIVE is set, the address will be set to INADDR_ANY for IPv4 and
IN6ADDR_ANY_INIT for IPv6. I think this is what is meant by unspecified
above. Have you found getaddrinfo() implementations that return just a
NULL pointer? If so, which? The GNU C library code I have seen, seems
not to return a NULL pointer, but I might have missed something.

Stig

Comment 2 Kurt Zeilenga 2001-10-30 23:03:15 UTC
At 01:39 PM 2001-10-30, Stig@OpenLDAP.org wrote:
>On Mon, Oct 29, 2001 at 01:55:20PM +0000, peter.marschall@mayn.de wrote:
>> 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) (194.145.150.12)
>> 
>> 
>> 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.
>
>I believe this is just poor language. The draft

s/draft/RFC 2553/

>specs state that if
>AI_PASSIVE is set, the address will be set to INADDR_ANY for IPv4 and
>IN6ADDR_ANY_INIT for IPv6. I think this is what is meant by unspecified
>above. Have you found getaddrinfo() implementations that return just a
>NULL pointer? If so, which? The GNU C library code I have seen, seems
>not to return a NULL pointer, but I might have missed something.




Comment 3 venaas@openldap.org 2001-10-31 06:08:13 UTC
On Tue, Oct 30, 2001 at 11:03:49PM +0000, Kurt@OpenLDAP.org wrote:
> At 01:39 PM 2001-10-30, Stig@OpenLDAP.org wrote:
> >I believe this is just poor language. The draft
> 
> s/draft/RFC 2553/

It also says the same in the 2553bis draft, and in the Open Group base
specification draft. RFC 2553 is a bit out-dated, but they say the same
on this matter.

Stig

Comment 4 Kurt Zeilenga 2001-11-03 12:18:00 UTC
changed notes
Comment 5 Kurt Zeilenga 2001-12-04 20:58:09 UTC
changed notes
Comment 6 Kurt Zeilenga 2001-12-05 01:21:15 UTC
changed notes
changed state Open to Suspended
Comment 7 Kurt Zeilenga 2002-03-06 19:46:46 UTC
changed notes
changed state Suspended to Closed
Comment 8 Howard Chu 2003-12-12 22:52:14 UTC
moved from Incoming to Archive.Incoming
Comment 9 OpenLDAP project 2014-08-01 21:05:36 UTC
broken getaddrinfo impl