From 2ee9c196d2b3bf53e706f40fabd9da2b0c5f2f88 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 8 Dec 1999 23:31:11 +0000 Subject: [PATCH] Fix the 1.71 fix - only offset the length if the last character of the referral URL is not a '/'. Also in send_search_reference, corrected the comparison for the pre-V3 case. Previously, referrals were being dropped completely for V2 subtree searches. More work is still needed, V2 onelevel referral handling is wrong. --- servers/slapd/result.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 3c142748d4..bc8dc7aa61 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -49,7 +49,9 @@ static char *v2ref( struct berval **ref, const char *text ) v2 = ch_realloc( v2, len + ref[i]->bv_len + 1 ); v2[len-1] = '\n'; memcpy(&v2[len], ref[i]->bv_val, ref[i]->bv_len ); - len += ref[i]->bv_len + 1; + len += ref[i]->bv_len; + if (ref[i]->bv_val[ref[i]->bv_len-1] != '/') + ++len; } v2[len-1] = '\0'; @@ -867,7 +869,7 @@ send_search_reference( if( op->o_protocol < LDAP_VERSION3 ) { /* save the references for the result */ - if( *refs == NULL ) { + if( *refs != NULL ) { value_add( v2refs, refs ); } return 0; -- 2.39.5