From: Kurt Zeilenga Date: Tue, 15 Aug 2000 02:13:00 +0000 (+0000) Subject: Treat INADDR_LOOPBACK (as well as INADDR_ANY) as local host. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2252 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2ae410bd1b68634972d64e811b369be27ac12672;p=openldap Treat INADDR_LOOPBACK (as well as INADDR_ANY) as local host. --- diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index c2143561a1..cf7f322e76 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -473,6 +473,17 @@ ldap_host_connected_to( Sockbuf *sb ) { return LDAP_STRDUP( ldap_int_hostname ); } + +#ifdef INADDR_LOOPBACK + localhost.sin_addr.s_addr = htonl( INADDR_LOOPBACK ); + + if( memcmp ( &localhost.sin_addr, + &((struct sockaddr_in *)&sa)->sin_addr, + sizeof(localhost.sin_addr) ) == 0 ) + { + return LDAP_STRDUP( ldap_int_hostname ); + } +#endif } break;