mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-01 14:15:49 +08:00
Apply preliminary patch provided by Hallvard.
This still needs significant review!
This commit is contained in:
parent
09488c0158
commit
9b09d42a1d
@ -114,7 +114,7 @@ char *derefDN ( Backend *be,
|
|||||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
||||||
char *matched;
|
char *matched;
|
||||||
char *newDN = NULL;
|
char *newDN = NULL;
|
||||||
int depth;
|
int depth, i;
|
||||||
Entry *eMatched;
|
Entry *eMatched;
|
||||||
Entry *eDeref;
|
Entry *eDeref;
|
||||||
Entry *eNew;
|
Entry *eNew;
|
||||||
@ -125,16 +125,13 @@ char *derefDN ( Backend *be,
|
|||||||
dn, 0, 0 );
|
dn, 0, 0 );
|
||||||
|
|
||||||
newDN = strdup ( dn );
|
newDN = strdup ( dn );
|
||||||
|
|
||||||
/* while we don't have a matched dn, deref the DN */
|
/* while we don't have a matched dn, deref the DN */
|
||||||
for ( depth = 0;
|
for ( depth = 0;
|
||||||
( (eMatched = dn2entry_r( be, newDN, &matched )) == NULL) &&
|
( (eMatched = dn2entry_r( be, newDN, &matched )) == NULL) &&
|
||||||
(depth < be->be_maxDerefDepth);
|
(depth < be->be_maxDerefDepth);
|
||||||
++depth ) {
|
++depth ) {
|
||||||
|
|
||||||
/* free reader lock */
|
|
||||||
cache_return_entry_r(&li->li_cache, eMatched);
|
|
||||||
|
|
||||||
if ((matched != NULL) && *matched) {
|
if ((matched != NULL) && *matched) {
|
||||||
char *submatch;
|
char *submatch;
|
||||||
|
|
||||||
@ -165,7 +162,10 @@ char *derefDN ( Backend *be,
|
|||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE, "<= l&g we have %s vs %s \n", matched, eNew->e_dn, 0 );
|
Debug( LDAP_DEBUG_TRACE, "<= l&g we have %s vs %s \n", matched, eNew->e_dn, 0 );
|
||||||
|
|
||||||
if (!strcasecmp (matched, eNew->e_dn)) {
|
i = strcasecmp (matched, eNew->e_dn);
|
||||||
|
/* free reader lock */
|
||||||
|
cache_return_entry_r(&li->li_cache, eNew);
|
||||||
|
if (! i) {
|
||||||
/* newDN same as old so not an alias, no need to go further */
|
/* newDN same as old so not an alias, no need to go further */
|
||||||
free (newDN);
|
free (newDN);
|
||||||
newDN = NULL;
|
newDN = NULL;
|
||||||
@ -188,9 +188,6 @@ char *derefDN ( Backend *be,
|
|||||||
free (matched);
|
free (matched);
|
||||||
matched = NULL;
|
matched = NULL;
|
||||||
free (remainder);
|
free (remainder);
|
||||||
|
|
||||||
/* free reader lock */
|
|
||||||
cache_return_entry_r(&li->li_cache, eNew);
|
|
||||||
}
|
}
|
||||||
/* free reader lock */
|
/* free reader lock */
|
||||||
cache_return_entry_r(&li->li_cache, eMatched);
|
cache_return_entry_r(&li->li_cache, eMatched);
|
||||||
@ -205,6 +202,9 @@ char *derefDN ( Backend *be,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* free reader lock */
|
||||||
|
cache_return_entry_r(&li->li_cache, eMatched);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the final part of the DN might be an alias
|
* the final part of the DN might be an alias
|
||||||
* so try to dereference it.
|
* so try to dereference it.
|
||||||
|
Loading…
Reference in New Issue
Block a user