Bug 468807 - 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
The function _nss_ldap_gethostbyname_r doen't set the proper return value and...
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: nss_ldap (Show other bugs)
All Linux
medium Severity medium
: rc
: ---
Assigned To: Nalin Dahyabhai
Ondrej Moriš
Depends On:
  Show dependency treegraph
Reported: 2008-10-28 01:42 EDT by Jason Luo
Modified: 2011-01-13 18:31 EST (History)
3 users (show)

See Also:
Fixed In Version: nss_ldap-253-27.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-01-13 18:31:53 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
nss_ldap-253-errnop.patch (353 bytes, patch)
2008-10-28 01:42 EDT, Jason Luo
no flags Details | Diff

  None (edit)
Description Jason Luo 2008-10-28 01:42:01 EDT
Created attachment 321677 [details]

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

_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 01:55:19 EDT
upstream Bugzilla:
Comment 8 errata-xmlrpc 2011-01-13 18:31:53 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.


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