]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/os-ip.c
silence excessive logging
[openldap] / libraries / libldap / os-ip.c
index de03b7f68b6bb775935a1a7351b0b96315b9d5b9..7412a58014d067c5b702ae566db0dd77bff2ed90 100644 (file)
 
 int ldap_int_tblsize = 0;
 
+#if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
+int ldap_int_inet4or6 = AF_UNSPEC;
+#endif
+
 /*
  * nonblock connect code
  * written by Lars Uffmann, <lars.uffmann@mediaway.net>.
@@ -152,7 +156,7 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s)
 #if defined( notyet ) /* && defined( SO_ERROR ) */
 {
        int so_errno;
-       int dummy = sizeof(so_errno);
+       socklen_t dummy = sizeof(so_errno);
        if ( getsockopt( s, SOL_SOCKET, SO_ERROR, &so_errno, &dummy )
                == AC_SOCKET_ERROR )
        {
@@ -170,7 +174,7 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s)
        /* error slippery */
        struct sockaddr_in sin;
        char ch;
-       int dummy = sizeof(sin);
+       socklen_t dummy = sizeof(sin);
        if ( getpeername( s, (struct sockaddr *) &sin, &dummy )
                == AC_SOCKET_ERROR )
        {
@@ -340,11 +344,11 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
                struct addrinfo hints, *res, *sai;
 
                memset( &hints, '\0', sizeof(hints) );
-               hints.ai_family = AF_UNSPEC;
+               hints.ai_family = ldap_int_inet4or6;
                hints.ai_socktype = socktype;
 
                snprintf(serv, sizeof serv, "%d", port );
-               if ( err = getaddrinfo(host, serv, &hints, &res) ) {
+               if ( ( err = getaddrinfo(host, serv, &hints, &res) ) ) {
                        osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n",
                                AC_GAI_STRERROR(err), 0, 0);
                        return -1;
@@ -681,7 +685,11 @@ ldap_int_select( LDAP *ld, struct timeval *timeout )
 {
        struct selectinfo       *sip;
 
+#ifdef NEW_LOGGING
+       LDAP_LOG (( "os-ip", LDAP_LEVEL_ENTRY, "ldap_int_select\n" ));
+#else
        Debug( LDAP_DEBUG_TRACE, "ldap_int_select\n", 0, 0, 0 );
+#endif
 
        if ( ldap_int_tblsize == 0 )
                ldap_int_ip_init();