]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/result.c
Fix the 1.71 fix - only offset the length if the last character of the
[openldap] / servers / slapd / result.c
index 3c142748d48182421ee4c4fb5f07a05b2e3b4c04..bc8dc7aa6114f722f2aa0549c9e56176e899bdd2 100644 (file)
@@ -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;