From: Howard Chu Date: Wed, 11 Dec 2002 16:36:36 +0000 (+0000) Subject: Must use reentrant gethostbyaddr for reverse lookups. Other threads may X-Git-Tag: NO_SLAP_OP_BLOCKS~690 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ee571c54a4b1970fa6fa93baee8c3416fe783de8;p=openldap Must use reentrant gethostbyaddr for reverse lookups. Other threads may be doing lookups too (e.g., SASL/GSSAPI) --- diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 94c002d142..68d845b8f0 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -1612,19 +1612,25 @@ slapd_daemon_task( ) { #ifdef SLAPD_RLOOKUPS if ( use_reverse_lookup ) { + struct hostent he; + int herr; + char *ha = NULL; + hp = NULL; # ifdef LDAP_PF_INET6 if ( from.sa_addr.sa_family == AF_INET6 ) - hp = gethostbyaddr( + ldap_pvt_gethostbyaddr_a( (char *)&(from.sa_in6_addr.sin6_addr), sizeof(from.sa_in6_addr.sin6_addr), - AF_INET6 ); + AF_INET6, &he, &ha, + &hp, &herr ); else # endif /* LDAP_PF_INET6 */ - hp = gethostbyaddr( + ldap_pvt_gethostbyaddr_a( (char *) &(from.sa_in_addr.sin_addr), sizeof(from.sa_in_addr.sin_addr), - AF_INET ); + AF_INET, &he, &ha, &hp, &herr ); dnsname = hp ? ldap_pvt_str2lower( hp->h_name ) : NULL; + if (ha) ldap_memfree( ha ); } #else dnsname = NULL;