- if (!strcmp(be->be_suffixAlias[i], &dn[diff])) {
- char *oldDN = dn;
- dn = ch_malloc( diff + strlen(be->be_suffixAlias[i+1]) + 1 );
- strncpy( dn, oldDN, diff );
- strcpy( &dn[diff], be->be_suffixAlias[i+1] );
+ if (!strcmp(be->be_suffixAlias[i].bv_val, &dn->bv_val[diff])) {
+ char *oldDN = dn->bv_val;
+ dn->bv_len = diff + be->be_suffixAlias[i+1].bv_len;
+ dn->bv_val = ch_malloc( dn->bv_len + 1 );
+ strncpy( dn->bv_val, oldDN, diff );
+ strcpy( &dn->bv_val[diff], be->be_suffixAlias[i+1].bv_val );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "suffix_alias: converted \"%s\" to \"%s\"\n",
+ oldDN, dn->bv_val ));
+#else