- ptr = strchr(rdn->bv_val, '=');
- ad_name.bv_val = rdn->bv_val;
- ad_name.bv_len = ptr - rdn->bv_val;
- rc = slap_bv2ad( &ad_name, &ad, &text );
+ if ( ldap_bv2rdn_x( rdn, &srdn, &ptr, LDAP_DN_FORMAT_LDAP, op->o_tmpmemctx ))
+ goto fail;
+
+ rc = slap_bv2ad( &srdn[0]->la_attr, &ad, &text );