rc = ldap_passwd(lc->ld, id.bv_len ? &mdn : NULL, old.bv_len ? &old : NULL,
new.bv_len ? &new : NULL, op->o_ctrls, NULL, &msgid);
-#ifdef ENABLE_REWRITE
- if (mdn.bv_val != dn.bv_val)
-#endif
+
+ if (mdn.bv_val != dn.bv_val) {
free(mdn.bv_val);
+ }
+
if (rc == LDAP_SUCCESS) {
if (ldap_result(lc->ld, msgid, 1, NULL, &res) == -1) {
ldap_get_option(lc->ld, LDAP_OPT_ERROR_NUMBER, &rc);
rc = ldap_modify_ext( lc->ld, mdn.bv_val, modv, op->o_ctrls, NULL, &msgid );
cleanup:;
-#ifdef ENABLE_REWRITE
if ( mdn.bv_val != dn->bv_val ) {
-#endif /* ENABLE_REWRITE */
free( mdn.bv_val );
-#ifdef ENABLE_REWRITE
}
-#endif /* ENABLE_REWRITE */
for (i=0; modv[i]; i++) {
ch_free(modv[i]->mod_bvalues);
}
char *match = NULL, *err = NULL;
char **mapped_attrs = NULL;
struct berval mbase;
-#ifdef ENABLE_REWRITE
char *mmatch = NULL;
-#endif /* ENABLE_REWRITE */
struct berval mfilter = { 0, NULL };
struct slap_limits_set *limit = NULL;
int isroot = 0;
mmatch, err, v2refs, NULL, count );
#else /* !ENABLE_REWRITE */
+ if ( match != NULL ) {
+ struct berval dn, mdn;
+
+ ber_str2bv(match, 0, 0, &dn);
+ ldap_back_dn_massage(li, &dn, &mdn, 0, 0);
+ mmatch = mdn.bv_val;
+ }
+
if ( v2refs ) {
sres = LDAP_REFERRAL;
}
send_search_result( conn, op, sres,
- match, err, v2refs, NULL, count );
+ mmatch, err, v2refs, NULL, count );
#endif /* !ENABLE_REWRITE */
finish:;
if ( match ) {
-#ifdef ENABLE_REWRITE
if ( mmatch != match ) {
free( mmatch );
}
-#endif /* ENABLE_REWRITE */
LDAP_FREE(match);
}
if ( err ) {
}
#else /* !ENABLE_REWRITE */
ldap_back_dn_massage( li, bv, &newval, 0, 0 );
+ if ( bv->bv_val != newval.bv_val ) {
+ LBER_FREE( bv->bv_val );
+ }
*bv = newval;
#endif /* !ENABLE_REWRITE */
}