]> git.sur5r.net Git - openldap/commitdiff
Use ldap_pvt_get_hname instead of ldap_pvt_gethostbyaddr_a
authorHoward Chu <hyc@openldap.org>
Wed, 5 Mar 2003 01:53:32 +0000 (01:53 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 5 Mar 2003 01:53:32 +0000 (01:53 +0000)
servers/slapd/daemon.c

index ea1d1b7e7ce236d72ccda23a1b85b5ca46eeac30..560a0d21ca653dc4e376df87d00a0fe42b4d087f 100644 (file)
@@ -1381,7 +1381,7 @@ slapd_daemon_task(
                        slap_ssf_t ssf = 0;
                        char *authid = NULL;
 #ifdef SLAPD_RLOOKUPS
-                       char *hebuf = NULL;
+                       char hbuf[NI_MAXHOST];
 #endif
 
                        char    *dnsname = NULL;
@@ -1612,23 +1612,12 @@ slapd_daemon_task(
                        ) {
 #ifdef SLAPD_RLOOKUPS
                                if ( use_reverse_lookup ) {
-                                       struct hostent he;
-                                       int herr;
-                                       struct hostent *hp = NULL;
-#  ifdef LDAP_PF_INET6
-                                       if ( from.sa_addr.sa_family == AF_INET6 )
-                                               ldap_pvt_gethostbyaddr_a(
-                                                       (char *)&(from.sa_in6_addr.sin6_addr),
-                                                       sizeof(from.sa_in6_addr.sin6_addr),
-                                                       AF_INET6, &he, &hebuf,
-                                                       &hp, &herr );
-                                       else
-#  endif /* LDAP_PF_INET6 */
-                                       ldap_pvt_gethostbyaddr_a(
-                                               (char *) &(from.sa_in_addr.sin_addr),
-                                               sizeof(from.sa_in_addr.sin_addr),
-                                               AF_INET, &he, &hebuf, &hp, &herr );
-                                       dnsname = hp ? ldap_pvt_str2lower( hp->h_name ) : NULL;
+                                       char *herr;
+                                       if (ldap_pvt_get_hname( &from, len, hbuf,
+                                               sizeof(hbuf), &herr ) == 0) {
+                                               ldap_pvt_str2lower( hbuf );
+                                               dnsname = hbuf;
+                                       }
                                }
 #else
                                dnsname = NULL;
@@ -1666,9 +1655,6 @@ slapd_daemon_task(
                                authid );
 
                        if( authid ) ch_free(authid);
-#ifdef SLAPD_RLOOKUPS
-                       if( hebuf ) ldap_memfree(hebuf);
-#endif
 
                        if( id < 0 ) {
 #ifdef NEW_LOGGING