Entry ent = { 0 };
BerElement ber = *e->lm_ber;
Attribute *attr, **attrp;
- struct berval *bv, bdn;
+ struct berval bdn,
+ dn = BER_BVNULL;
const char *text;
dncookie dc;
+ int rc;
if ( ber_scanf( &ber, "{m{", &bdn ) == LBER_ERROR ) {
return LDAP_DECODING_ERROR;
dc.rs = rs;
dc.ctx = "searchResult";
- rs->sr_err = ldap_back_dn_massage( &dc, &bdn, &ent.e_name );
+ rs->sr_err = ldap_back_dn_massage( &dc, &bdn, &dn );
if ( rs->sr_err != LDAP_SUCCESS) {
return rs->sr_err;
}
*
* FIXME: should we log anything, or delegate to dnNormalize?
*/
- if ( dnNormalize( 0, NULL, NULL, &ent.e_name, &ent.e_nname,
- op->o_tmpmemctx ) != LDAP_SUCCESS )
- {
+ rc = dnPrettyNormal( NULL, &dn, &ent.e_name, &ent.e_nname,
+ op->o_tmpmemctx );
+ if ( dn.bv_val != bdn.bv_val ) {
+ free( dn.bv_val );
+ }
+ BER_BVZERO( &dn );
+
+ if ( rc != LDAP_SUCCESS ) {
return LDAP_INVALID_DN_SYNTAX;
}
if ( attr->a_desc == slap_schema.si_ad_objectClass
|| attr->a_desc == slap_schema.si_ad_structuralObjectClass )
{
+ struct berval *bv;
+
for ( bv = attr->a_vals; !BER_BVISNULL( bv ); bv++ ) {
ldap_back_map( &mi->mi_targets[ target ].mt_rwmap.rwm_oc,
bv, &mapped, BACKLDAP_REMAP );
rs->sr_attrs = NULL;
if ( !BER_BVISNULL( &ent.e_name ) ) {
- if ( ent.e_name.bv_val != bdn.bv_val ) {
- free( ent.e_name.bv_val );
- }
+ free( ent.e_name.bv_val );
BER_BVZERO( &ent.e_name );
}
if ( !BER_BVISNULL( &ent.e_nname ) ) {