Red Hat Bugzilla – 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
Last modified: 2011-01-13 18:31:53 EST
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,
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.
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.