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;