Bug 468807

Summary: The function _nss_ldap_gethostbyname_r doen't set the proper return value and errno_p when the length of name is less than required
Product: Red Hat Enterprise Linux 5 Reporter: Jason Luo <jason.luo>
Component: nss_ldapAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED ERRATA QA Contact: Ondrej Moriš <omoris>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.2CC: dpal, jplans, omoris
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nss_ldap-253-27.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 23:31:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
nss_ldap-253-errnop.patch none

Description Jason Luo 2008-10-28 05:42:01 UTC
Created attachment 321677 [details]
nss_ldap-253-errnop.patch

let's look at the prototype of some related functions:

NSS_STATUS
_nss_ldap_gethostbyname_r (const char *name, struct hostent * result,
                           char *buffer, size_t buflen, int *errnop,
                           int *h_errnop)

struct hostent *gethostbyname2(const char *name, int af)

int gethostbyname2_r(const char *name, int af,
         struct hostent *ret, char *buf, size_t buflen,
         struct hostent **result, int *h_errnop);

we assume that we get hosts from ldap server.

gethostbyname2 call gethostbyname2_r to get the hosts from ldap_server, the
default size of name(the first parameter of function gethostbyname2) is 1024.
If the size is not enough,  gethostbyname2 require gethostbyname2_r to return
the errno as the return value , set the proper value of h_errnop , then
gethostbyname2 will double the size of name and call gethostbyname2_r again. 
but, the function called by gethostbyname2 doesn't follow the restriction. in
nss_ldap, the related function is _nss_ldap_gethostbyname_r.

Comment 1 Jason Luo 2008-10-28 05:55:19 UTC
upstream Bugzilla:
http://bugzilla.padl.com/show_bug.cgi?id=378

Comment 8 errata-xmlrpc 2011-01-13 23:31:53 UTC
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-0097.html