]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/os-ip.c
Added ldap_pvt_sasl_bind() prototype to ldap_pvt.h. This
[openldap] / libraries / libldap / os-ip.c
index cf56ae8a6434e74c7f3df6c1c79faf42e6b5cf32..530c9299dcea66b3a1f7041b179b98205ed960a1 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenLDAP$ */
 /*
  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
@@ -73,7 +74,7 @@ ldap_int_timeval_dup( struct timeval **dest, const struct timeval *src )
                return 1;
        }
 
-       SAFEMEMCPY( (char *) new, (char *) src, sizeof(struct timeval));
+       SAFEMEMCPY( (char *) new, (const char *) src, sizeof(struct timeval));
 
        *dest = new;
        return 0;
@@ -116,8 +117,13 @@ ldap_pvt_prepare_socket(LDAP *ld, int fd)
 #ifdef TCP_NODELAY
 {
        int dummy = 1;
-       if ( setsockopt( fd, IPPROTO_TCP, TCP_NODELAY, (char*) &dummy, sizeof(dummy) ) == -1 )
-               return -1;
+       if ( setsockopt( fd, IPPROTO_TCP, TCP_NODELAY,
+               (char*) &dummy, sizeof(dummy) ) == AC_SOCKET_ERROR )
+       {
+               osip_debug(ld, "ldap_prepare_socket: "
+                       "setsockopt(%d, TCP_NODELAY) failed (ignored).\n",
+                       fd, 0, 0);
+       }
 }
 #endif
        return 0;
@@ -187,8 +193,8 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_in *sin, int async)
                tv.tv_sec = opt_tv->tv_sec;
        }
 
-       osip_debug(ld, "ldap_connect_timeout: fd: %d tm: %d async: %d\n",
-                       s, opt_tv ? tv.tv_sec : -1, async);
+       osip_debug(ld, "ldap_connect_timeout: fd: %d tm: %ld async: %d\n",
+                       s, opt_tv ? tv.tv_sec : -1L, async);
 
        if ( ldap_pvt_ndelay_on(ld, s) == -1 )
                return ( -1 );
@@ -297,9 +303,9 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, const char *host,
                (void)memset((char *)&sin, 0, sizeof(struct sockaddr_in));
                sin.sin_family = AF_INET;
                sin.sin_port = port;
-               p = (char *)&sin.sin_addr.s_addr;
+               p = (char *)&sin.sin_addr;
                q = use_hp ? (char *)hp->h_addr_list[i] : (char *)&address;
-               SAFEMEMCPY(p, q, sizeof(p) );
+               SAFEMEMCPY(p, q, sizeof(sin.sin_addr) );
 
                osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n", 
                                inet_ntoa(sin.sin_addr),ntohs(sin.sin_port),0);
@@ -327,12 +333,11 @@ ldap_close_connection( Sockbuf *sb )
 }
 
 
-#if defined( HAVE_KERBEROS ) || defined( HAVE_TLS )
+#if defined( HAVE_KERBEROS ) || defined( HAVE_TLS ) || defined( HAVE_CYRUS_SASL )
 char *
 ldap_host_connected_to( Sockbuf *sb )
 {
        struct hostent          *hp;
-       char                    *p;
        socklen_t               len;
        struct sockaddr_in      sin;