From 2ae410bd1b68634972d64e811b369be27ac12672 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 15 Aug 2000 02:13:00 +0000 Subject: [PATCH] Treat INADDR_LOOPBACK (as well as INADDR_ANY) as local host. --- libraries/libldap/os-ip.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; -- 2.39.5