- /* build new dn, and new ndn for the entry */
- if(op->oq_modrdn.rs_newSup != NULL) /* new superior */
- p_dn = *op->oq_modrdn.rs_newSup;
- else
- p_dn = slap_empty_bv;
- dnParent(&entry->e_name, &p_dn);
- build_new_dn(&new_dn, &p_dn, &op->oq_modrdn.rs_newrdn, NULL);
- dnNormalize( 0, NULL, NULL, &new_dn, &bv, op->o_tmpmemctx );
- ber_dupbv( &new_ndn, &bv );
- entry->e_name = new_dn;
- entry->e_nname = new_ndn;
-
- /* perform the modifications */
- res = apply_modify_to_entry(entry, mods, op, rs);
- if(res == LDAP_SUCCESS) {
- rs->sr_err = move_entry(entry, &op->o_req_ndn,
- &new_ndn,
- &op->o_bd->be_nsuffix[0],
- &ni->li_base_path);
- }
- else
- rs->sr_err = res;
+ /* build the mods to the entry */
+ if ( entry != NULL ) {
+ /* build new dn, and new ndn for the entry */
+ if ( op->oq_modrdn.rs_newSup != NULL ) {
+ struct berval op_dn = op->o_req_dn,
+ op_ndn = op->o_req_ndn;
+ Entry *np;
+
+ /* new superior */
+ p_dn = *op->oq_modrdn.rs_newSup;
+ op->o_req_dn = *op->oq_modrdn.rs_newSup;
+ op->o_req_ndn = *op->oq_modrdn.rs_nnewSup;
+ np = (Entry *)get_entry( op, &ni->li_base_path );
+ op->o_req_dn = op_dn;
+ op->o_req_ndn = op_ndn;
+ if ( np == NULL ) {
+ goto no_such_object;