unsigned depth;
char **dnlist;
- assert( ( alias != NULL && dn == NULL ) || ( alias == NULL && dn != NULL ) );
+ assert( ( alias != NULL && dn_in == NULL )
+ || ( alias == NULL && dn_in != NULL ) );
*matched = NULL;
- *err = LDAP_SUCCESS;
+ *err = LDAP_NO_SUCH_OBJECT;
*text = NULL;
if( alias == NULL ) {
/* check if aliasDN is a subordinate of any DN in our list */
if( dnlist_subordinate( dnlist, aliasDN ) ) {
+ ch_free( aliasDN );
*matched = entry;
entry = NULL;
*err = LDAP_ALIAS_PROBLEM;
/* attempt to dereference alias */
newe = dn2entry_r( be, aliasDN, &sup );
+ ch_free( aliasDN );
if( newe != NULL ) {
free( dn );
dn = ch_strdup( entry->e_ndn );
charray_add( &dnlist, dn );
continue;
-
}
if ( sup != NULL ) {
}
aliasDN = new_superior( dn, sup->e_ndn, supDN );
+ free(supDN);
if( aliasDN == NULL ) {
free(aliasDN);
int *err,
const char **errmsg )
{
+ char *dn;
Attribute *a;
AttributeDescription *aliasedObjectName = slap_schema.si_ad_aliasedObjectName;
return NULL;
}
- return a->a_vals[0]->bv_val;
+ dn = ch_strdup( a->a_vals[0]->bv_val );
+
+ if( dn_normalize(dn) == NULL ) {
+ ch_free( dn );
+ *err = LDAP_ALIAS_PROBLEM;
+ *errmsg = "alias aliasedObjectName value is invalid";
+ return NULL;
+ }
+
+ return dn;
}
-char* new_superior(
+static char* new_superior(
const char *dn,
const char *oldSup,
const char *newSup )
newDN = ch_malloc( dnlen - olen + nlen + 1 );
- memcpy( newDN, dn, dnlen - olen );
- memcpy( &newDN[dnlen - olen], newSup, nlen );
+ AC_MEMCPY( newDN, dn, dnlen - olen );
+ AC_MEMCPY( &newDN[dnlen - olen], newSup, nlen );
newDN[dnlen - olen + nlen] = '\0';
return newDN;