)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char *matched;
- char *newDN;
+ char *matched = NULL;
+ char *newDN = NULL;
int depth;
Entry *eMatched;
Entry *eDeref;
if ((eNew = derefAlias_r( be, conn, op, eMatched )) == NULL) {
free (matched);
free (newDN);
+ newDN = NULL;
free (remainder);
break; /* no associated entry, dont deref */
}
if (!strcasecmp (matched, eNew->e_dn)) {
/* newDN same as old so not an alias, no need to go further */
free (newDN);
+ newDN = NULL;
free (matched);
free (remainder);
break;
send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM, "",
"Maximum alias dereference depth exceeded for base" );
}
+
+ if (newDN == NULL) {
+ newDN = strdup ( dn );
+ }
Debug( LDAP_DEBUG_TRACE, "<= returning deref DN of %s\n", newDN, 0, 0 );
-
free(matched);
return newDN;