Bug 501595 - [RHEL4] getnameinfo() should return EAI_NONAME when both nodename and servname are set to null and flag is set to NI_NAMEREQD
[RHEL4] getnameinfo() should return EAI_NONAME when both nodename and servnam...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc (Show other bugs)
4.7
All Linux
medium Severity medium
: rc
: 4.9
Assigned To: Andreas Schwab
BaseOS QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-19 17:30 EDT by Jeff Bastian
Modified: 2016-11-24 11:16 EST (History)
6 users (show)

See Also:
Fixed In Version: glibc-2.3.4-2.51
Doc Type: Bug Fix
Doc Text:
When "nodename" and "servname" were set to "NULL" and the "NI_NAMEREQD" flag was set, the getnameinfo() function incorrectly returned 0. This error has been fixed, and getnameinfo() now returns "EAI_NONAME" as documented.
Story Points: ---
Clone Of: 489419
Environment:
Last Closed: 2011-02-16 09:29:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
reproducer program (711 bytes, text/plain)
2009-05-19 17:33 EDT, Jeff Bastian
no flags Details
patch for glibc-2.3.4-2.43 (443 bytes, patch)
2009-05-19 17:35 EDT, Jeff Bastian
no flags Details | Diff

  None (edit)
Description Jeff Bastian 2009-05-19 17:30:33 EDT
+++ This bug was initially created as a clone of Bug #489419 +++

Description of Problem:
glibc getnameinfo() returns 0 when both nodename and servname are set to null and flag is set to 'NI_NAMEREQD'.

The synopsis of function getnameinfo is:
       int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *node, socklen_t nodelen, char *service, socklen_t servicelen, int flags);

RFC3493 tells that getnameinfo() should returns 'EAI_NONAME' when both nodename and servname are null.  So when use getnameinfo() with both nodename and servname are null and the NI_NAMEREQD flag is set, glibc should return 'EAI_NONAME' rather than 0.


Version-Release number of selected component:
glibc-2.3.4-2.43


How reproducible:
every time


Step to Reproduce:
1. gcc function-nodename-servname-null.c
2. ./a.out


Actual Results:
# ./a.out
==Both nodename and servname are null if the NI_NAMEREQD flag is set==
ERROR:return 0, expect error EAI_NONAME
<=== NG ===>


Expected Results:
# ./a.out
==Both nodename and servname are null if the NI_NAMEREQD flag is set==
<=== OK ===>


Additional Info:
Upstream patch:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/inet/getnameinfo.c.diff?r1=1.36&r2=1.37&cvsroot=glibc
Comment 1 Jeff Bastian 2009-05-19 17:33:09 EDT
Created attachment 344715 [details]
reproducer program
Comment 2 Jeff Bastian 2009-05-19 17:35:24 EDT
Created attachment 344716 [details]
patch for glibc-2.3.4-2.43
Comment 8 Jaromir Hradilek 2011-01-19 05:44:00 EST
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When "nodename" and "servname" were set to "NULL" and the "NI_NAMEREQD" flag was set, the getnameinfo() function incorrectly returned 0. This error has been fixed, and getnameinfo() now returns "EAI_NONAME" as documented.
Comment 9 errata-xmlrpc 2011-02-16 09:29:01 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0248.html

Note You need to log in before you can comment on or make changes to this bug.