/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Backend *newSuperior_be = NULL;
int manageDSAit;
struct berval pdn = BER_BVNULL;
- BackendDB *op_be;
+ BackendDB *op_be, *bd = op->o_bd;
if( op->o_req_ndn.bv_len == 0 ) {
Debug( LDAP_DEBUG_ANY, "do_modrdn: root dse!\n", 0, 0, 0 );
*/
op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 1 );
if ( op->o_bd == NULL ) {
+ op->o_bd = bd;
rs->sr_ref = referral_rewrite( default_referral,
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
if (!rs->sr_ref) rs->sr_ref = default_referral;
if ( rs->sr_ref != NULL ) {
rs->sr_err = LDAP_REFERRAL;
- op->o_bd = frontendDB;
send_ldap_result( op, rs );
- op->o_bd = NULL;
if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
} else {
- op->o_bd = frontendDB;
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"no global superior knowledge" );
- op->o_bd = NULL;
}
goto cleanup;
}
int repl_user = be_isupdate( op );
#ifndef SLAPD_MULTIMASTER
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif
+#endif /* ! SLAPD_MULTIMASTER */
{
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
#ifdef SLAPD_MULTIMASTER
if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
-#endif
+#endif /* SLAPD_MULTIMASTER */
{
cb.sc_next = op->o_callback;
op->o_callback = &cb;
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"shadow context; no update referral" );
}
-#endif
+#endif /* ! SLAPD_MULTIMASTER */
}
} else {
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
}
cleanup:;
+ op->o_bd = bd;
return rs->sr_err;
}
return rs->sr_err;
}
+
+void
+slap_modrdn2mods_free( Modifications *mod )
+{
+ Modifications *tmp;
+
+ for ( ; mod; mod = tmp ) {
+ tmp = mod->sml_next;
+ /* slap_modrdn2mods does things one way,
+ * slap_mods_opattrs does it differently
+ */
+ if ( mod->sml_op != SLAP_MOD_SOFTADD &&
+ mod->sml_op != LDAP_MOD_DELETE )
+ {
+ break;
+ }
+
+ if ( mod->sml_nvalues ) {
+ free( mod->sml_nvalues[0].bv_val );
+ }
+
+ free( mod );
+ }
+
+ slap_mods_free( mod, 1 );
+}
+