mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
Whoops.
This commit is contained in:
parent
5ee53ca851
commit
a9fff6ae9d
@ -127,7 +127,7 @@ cldap_open( char *host, int port )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( inet_aton( host, &address ) == 0 ) {
|
if ( (address = inet_addr( host )) == -1 ) {
|
||||||
if ( (hp = gethostbyname( host )) == NULL ) {
|
if ( (hp = gethostbyname( host )) == NULL ) {
|
||||||
errno = EHOSTUNREACH;
|
errno = EHOSTUNREACH;
|
||||||
continue;
|
continue;
|
||||||
|
@ -64,20 +64,9 @@ ldap_open( char *host, int port )
|
|||||||
#ifdef LDAP_REFERRALS
|
#ifdef LDAP_REFERRALS
|
||||||
LDAPServer *srv;
|
LDAPServer *srv;
|
||||||
#endif /* LDAP_REFERRALS */
|
#endif /* LDAP_REFERRALS */
|
||||||
#ifdef HAVE_WINSOCK_2
|
|
||||||
WORD wVersionRequested;
|
|
||||||
WSADATA wsaData;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 );
|
Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 );
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK_2
|
|
||||||
wVersionRequested = MAKEWORD( 2, 0 );
|
|
||||||
if ( WSAStartup( wVersionRequested, &wsadata ) != 0 ) {
|
|
||||||
return( NULL );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (( ld = ldap_init( host, port )) == NULL ) {
|
if (( ld = ldap_init( host, port )) == NULL ) {
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
@ -87,9 +76,6 @@ ldap_open( char *host, int port )
|
|||||||
NULL || ( ld->ld_defhost != NULL && ( srv->lsrv_host =
|
NULL || ( ld->ld_defhost != NULL && ( srv->lsrv_host =
|
||||||
strdup( ld->ld_defhost )) == NULL )) {
|
strdup( ld->ld_defhost )) == NULL )) {
|
||||||
ldap_ld_free( ld, 0 );
|
ldap_ld_free( ld, 0 );
|
||||||
#ifdef HAVE_WINSOCK_2
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
srv->lsrv_port = ld->ld_defport;
|
srv->lsrv_port = ld->ld_defport;
|
||||||
@ -98,9 +84,6 @@ ldap_open( char *host, int port )
|
|||||||
if ( ld->ld_defhost != NULL ) free( srv->lsrv_host );
|
if ( ld->ld_defhost != NULL ) free( srv->lsrv_host );
|
||||||
free( (char *)srv );
|
free( (char *)srv );
|
||||||
ldap_ld_free( ld, 0 );
|
ldap_ld_free( ld, 0 );
|
||||||
#ifdef HAVE_WINSOCK_2
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
++ld->ld_defconn->lconn_refcnt; /* so it never gets closed/freed */
|
++ld->ld_defconn->lconn_refcnt; /* so it never gets closed/freed */
|
||||||
@ -109,9 +92,6 @@ ldap_open( char *host, int port )
|
|||||||
if ( open_ldap_connection( ld, &ld->ld_sb, ld->ld_defhost,
|
if ( open_ldap_connection( ld, &ld->ld_sb, ld->ld_defhost,
|
||||||
ld->ld_defport, &ld->ld_host, 0 ) < 0 ) {
|
ld->ld_defport, &ld->ld_host, 0 ) < 0 ) {
|
||||||
ldap_ld_free( ld, 0 );
|
ldap_ld_free( ld, 0 );
|
||||||
#ifdef HAVE_WINSOCK_2
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
#endif /* LDAP_REFERRALS */
|
#endif /* LDAP_REFERRALS */
|
||||||
|
@ -96,7 +96,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
|||||||
|
|
||||||
connected = use_hp = 0;
|
connected = use_hp = 0;
|
||||||
|
|
||||||
if ( host != NULL && ( inet_aton( host, &address ) == 0 ) ) {
|
if ( host != NULL && ( address = inet_addr( host )) == -1 ) {
|
||||||
if ( (hp = gethostbyname( host )) == NULL ) {
|
if ( (hp = gethostbyname( host )) == NULL ) {
|
||||||
errno = EHOSTUNREACH; /* not exactly right, but... */
|
errno = EHOSTUNREACH; /* not exactly right, but... */
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
Loading…
Reference in New Issue
Block a user