]> git.sur5r.net Git - openldap/commitdiff
If port is zero, use default.
authorKurt Zeilenga <kurt@openldap.org>
Thu, 21 Feb 2002 15:39:35 +0000 (15:39 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 21 Feb 2002 15:39:35 +0000 (15:39 +0000)
libraries/libldap/open.c
libraries/libldap/os-ip.c

index 486f62b8c4e8530e420dc92f80ada35e471549fb..244dde7317c1008b69688591543c6c012d070444 100644 (file)
@@ -239,6 +239,14 @@ ldap_int_open_connection(
                                host = srv->lud_host;
                        }
 
+                       if( !port ) {
+                               if( strcmp(srv->lud_scheme, "ldaps") == 0 ) {
+                                       port = LDAPS_PORT;
+                               } else {
+                                       port = LDAP_PORT;
+                               }
+                       }
+
                        rc = ldap_connect_to_host( ld, conn->lconn_sb,
                                proto, host, addr, port, async );
 
@@ -256,6 +264,7 @@ ldap_int_open_connection(
 #endif
                        break;
 #ifdef LDAP_CONNECTIONLESS
+
                case LDAP_PROTO_UDP:
                        port = srv->lud_port;
 
@@ -266,6 +275,9 @@ ldap_int_open_connection(
                        } else {
                                host = srv->lud_host;
                        }
+
+                       if( !port ) port = LDAP_PORT;
+
                        LDAP_IS_UDP(ld) = 1;
                        rc = ldap_connect_to_host( ld, conn->lconn_sb,
                                proto, host, addr, port, async );
index 396873459726dee61288383c461611e62bd9487e..de03b7f68b6bb775935a1a7351b0b96315b9d5b9 100644 (file)
@@ -318,13 +318,18 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
        char                    *ha_buf=NULL, *p, *q;
        int                     socktype;
 
-       osip_debug(ld, "ldap_connect_to_host: %s\n",host,0,0);
        
        switch(proto) {
-       case LDAP_PROTO_TCP: socktype = SOCK_STREAM; break;
-       case LDAP_PROTO_UDP: socktype = SOCK_DGRAM; break;
-       default: osip_debug(ld, "ldap_connect_to_host: unknown proto: %d\n",
-                               proto, 0, 0);
+       case LDAP_PROTO_TCP: socktype = SOCK_STREAM;
+               osip_debug(ld, "ldap_connect_to_host: TCP %s:%d\n",host,port,0);
+               break;
+       case LDAP_PROTO_UDP: socktype = SOCK_DGRAM;
+               osip_debug(ld, "ldap_connect_to_host: TCP %s:%d\n",host,port,0);
+               break;
+
+       default:
+               osip_debug(ld, "ldap_connect_to_host: unknown proto: %d\n",
+                       proto, 0, 0);
                return -1;
        }