mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Rework getaddrinfo/inet_ntop not to segfault with ai_addr is (bogusly) NULL
This commit is contained in:
parent
8f4795d064
commit
712295ef4b
@ -333,9 +333,13 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
|
||||
AC_GAI_STRERROR(err), 0, 0);
|
||||
return -1;
|
||||
}
|
||||
sai = res;
|
||||
rc = -1;
|
||||
do {
|
||||
|
||||
for( sai=res; sai != NULL; sai=sai->ai_next) {
|
||||
if( sai->ai_addr == NULL ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* we assume AF_x and PF_x are equal for all x */
|
||||
s = ldap_int_socket( ld, sai->ai_family, socktype );
|
||||
if ( s == AC_SOCKET_INVALID ) {
|
||||
@ -374,7 +378,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
|
||||
break;
|
||||
}
|
||||
ldap_pvt_close_socket(ld, s);
|
||||
} while ((sai = sai->ai_next) != NULL);
|
||||
}
|
||||
freeaddrinfo(res);
|
||||
return rc;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user