From: Kurt Zeilenga Date: Sat, 10 Aug 2002 03:48:09 +0000 (+0000) Subject: Some more sockaddr_in v sockaddr_storage cleanup X-Git-Tag: NO_SLAP_OP_BLOCKS~1247 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ca5aa3b615e5b521c30625a81195d103e6fb67f7;p=openldap Some more sockaddr_in v sockaddr_storage cleanup --- diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index ca167f4966..5e4391178a 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -176,7 +176,11 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s) #else { /* error slippery */ +#ifdef LDAP_PF_INET6 + struct sockaddr_storage sin; +#else struct sockaddr_in sin; +#endif char ch; socklen_t dummy = sizeof(sin); if ( getpeername( s, (struct sockaddr *) &sin, &dummy ) @@ -321,7 +325,6 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, const char *host, unsigned long address, int port, int async ) { - struct sockaddr_in sin; ber_socket_t s = AC_SOCKET_INVALID; int rc, i, use_hp = 0; struct hostent *hp = NULL; @@ -436,6 +439,8 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, rc = s = -1; for ( i = 0; !use_hp || (hp->h_addr_list[i] != 0); ++i, rc = -1 ) { + struct sockaddr_in sin; + s = ldap_int_socket( ld, PF_INET, socktype ); if ( s == AC_SOCKET_INVALID ) { /* use_hp ? continue : break; */ @@ -447,7 +452,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, break; } - (void)memset((char *)&sin, '\0', sizeof(struct sockaddr_in)); + (void)memset((char *)&sin, '\0', sizeof sin); sin.sin_family = AF_INET; sin.sin_port = htons((short) port); p = (char *)&sin.sin_addr;