From ea1827f519eb74deb29ba7d8e24b110d03adeb92 Mon Sep 17 00:00:00 2001 From: "mhein%netscape.com" Date: Wed, 19 Sep 2001 18:49:51 +0000 Subject: [PATCH] 558135 - smart referrals with three contiguous slashes don't work git-svn-id: svn://10.0.0.236/branches/ldapcsdk_branch_50@103210 18797224-902f-48f8-a5cc-f745e15eee43 --- .../c-sdk/ldap/libraries/libldap/request.c | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/request.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/request.c index dad1f8e9c1d..a6ae9ca2f1b 100644 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/request.c +++ b/mozilla/directory/c-sdk/ldap/libraries/libldap/request.c @@ -993,9 +993,18 @@ chase_one_referral( LDAP *ld, LDAPRequest *lr, LDAPRequest *origreq, srv->lsrv_host = NULL; } else { if ( ludp->lud_host == NULL ) { - srv->lsrv_host = nsldapi_strdup( ld->ld_defhost ); + srv->lsrv_host = + nsldapi_strdup( origreq->lr_conn->lconn_server->lsrv_host ); + LDAPDebug( LDAP_DEBUG_TRACE, + "chase_one_referral: using hostname '%s' from original " + "request on new request\n", + srv->lsrv_host, 0, 0); } else { - srv->lsrv_host = nsldapi_strdup( ludp->lud_host ); + srv->lsrv_host = nsldapi_strdup( ludp->lud_host ); + LDAPDebug( LDAP_DEBUG_TRACE, + "chase_one_referral: using hostname '%s' as specified " + "on new request\n", + srv->lsrv_host, 0, 0); } if ( srv->lsrv_host == NULL ) { @@ -1006,10 +1015,18 @@ chase_one_referral( LDAP *ld, LDAPRequest *lr, LDAPRequest *origreq, } } - if ( ludp->lud_port == 0 ) { - srv->lsrv_port = ( secure ) ? LDAPS_PORT : LDAP_PORT; + if ( ludp->lud_port == 0 && ludp->lud_host == NULL ) { + srv->lsrv_port = origreq->lr_conn->lconn_server->lsrv_port; + LDAPDebug( LDAP_DEBUG_TRACE, + "chase_one_referral: using port (%d) from original " + "request on new request\n", + srv->lsrv_port, 0, 0); } else { srv->lsrv_port = ludp->lud_port; + LDAPDebug( LDAP_DEBUG_TRACE, + "chase_one_referral: using port (%d) as specified on " + "new request\n", + srv->lsrv_port, 0, 0); } if ( secure ) {