]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/request.c
Add comments.
[openldap] / libraries / libldap / request.c
index 2ea52590727b3eef3d865d0d61a0dbfb5a2d0b7a..30c8887beb7c9e2c08b7c011e11c6de0c6af610a 100644 (file)
@@ -96,7 +96,6 @@ ldap_send_initial_request(
                        ( ld->ld_host == NULL ) ? "(null)" : ld->ld_host, 0, 0 );
        }
 
-
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
        if ( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_DNS )
                && ldap_is_dns_dn( dn ) )
@@ -254,7 +253,6 @@ ldap_send_server_request(
        return( msgid );
 }
 
-
 LDAPConn *
 ldap_new_connection( LDAP *ld, LDAPURLDesc *srvlist, int use_ldsb,
        int connect, int bind )
@@ -568,7 +566,7 @@ ldap_free_request( LDAP *ld, LDAPRequest *lr )
 int
 ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
 {
-       int             rc, count, len, newdn = 0;
+       int             rc, count, len, newdn;
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
        int             ldapref;
 #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
@@ -653,16 +651,17 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
                        continue;
                }
 
+               /* NOTE! This code treats "ldap://host/" differently
+                * from "ldap://host". The behavior is wrong, but is
+                * left here intentionally to maintain compatibility
+                * with OpenLDAP 1.x and UMich 3.3 clients.
+                */
                *hadrefp = 1;
                if (( refdn = strchr( tmpref, '/' )) != NULL ) {
                        *refdn++ = '\0';
-                       if ( *refdn != '\0' )
-                       {
-                               newdn = 1;
-                       } else
-                       {
-                               refdn = NULL;
-                       }
+                       newdn = 1;
+               } else {
+                       newdn = 0;
                }
 
                if (( ber = re_encode_request( ld, origreq->lr_ber,