ldap/servers/plugins/acl/acl.c | 16 +++++-- ldap/servers/plugins/acl/acllist.c | 4 - ldap/servers/plugins/chainingdb/cb_add.c | 2 ldap/servers/plugins/chainingdb/cb_compare.c | 2 ldap/servers/plugins/chainingdb/cb_delete.c | 2 ldap/servers/plugins/chainingdb/cb_modify.c | 2 ldap/servers/plugins/chainingdb/cb_modrdn.c | 32 +-------------- ldap/servers/plugins/chainingdb/cb_search.c | 4 - ldap/servers/plugins/referint/referint.c | 6 +- ldap/servers/plugins/replication/llist.c | 6 +- ldap/servers/plugins/replication/urp.c | 57 +++++++++++++++++++++------ ldap/servers/plugins/uiduniq/7bit.c | 4 - ldap/servers/slapd/back-ldbm/ldbm_add.c | 15 ------- ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c | 3 - ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 15 ------- ldap/servers/slapd/modrdn.c | 7 ++- 16 files changed, 84 insertions(+), 93 deletions(-)
New commits: commit 2bead40718b7729df9435c44ab11f796d76848bf Author: Noriko Hosoi nhosoi@totoro.usersys.redhat.com Date: Sun May 13 17:10:04 2012 -0700
Trac Ticket #359 - Database RUV could mismatch the one in changelog under the stress
https://fedorahosted.org/389/ticket/359
Fix Description: . Fix for llistRemoveCurrentAndGetNext (llist.c) in commit f92f3a6e91498770aa8e93b6842ba752d4ed279a was not correct. . Undo the changes made in ldbm_back_add, ldbm_back_modrdn (ldbm_add.c, ldbm_modrdn.c) in commit f92f3a6e91498770aa8e93b6842ba752d4ed279a. . urp.c: In the original design, if op_result is LDA_SUCCESS and the return code is -1, the operation is skipped, but the max csn is updated in RUV. Currently, we have no way to do so. This patch eliminates the cases: 2 in urp_add_operation and 1 in urp_modrdn_operation are now LDAP_UNWILLING_TO_PERFORM; 1 in urp_modrdn_operation (the existing entry is the same as the target one) returns 0.
diff --git a/ldap/servers/plugins/replication/llist.c b/ldap/servers/plugins/replication/llist.c index e80f532..05cfa48 100644 --- a/ldap/servers/plugins/replication/llist.c +++ b/ldap/servers/plugins/replication/llist.c @@ -165,14 +165,14 @@ void* llistRemoveCurrentAndGetNext (LList *list, void **iterator) if (node) { prevNode->next = node->next; + if (list->tail == node) { + list->tail = prevNode; + } _llistDestroyNode (&node, NULL); node = prevNode->next; if (node) { return node->data; } else { - if (list->head->next == NULL) { - list->tail = NULL; - } return NULL; } } diff --git a/ldap/servers/plugins/replication/urp.c b/ldap/servers/plugins/replication/urp.c index 25dfd5c..e70ae5b 100644 --- a/ldap/servers/plugins/replication/urp.c +++ b/ldap/servers/plugins/replication/urp.c @@ -139,7 +139,17 @@ urp_add_operation( Slapi_PBlock *pb ) * - It could be a replay of the same Add, or * - It could be a UUID generation collision, or */ - op_result = LDAP_SUCCESS; + /* + * This operation won't be replayed. That is, this CSN won't update + * the max csn in RUV. The CSN is left uncommitted in RUV unless an + * error is set to op_result. Just to get rid of this CSN from RUV, + * setting an error to op_result + */ + /* op_result = LDAP_SUCCESS; */ + slapi_log_error(slapi_log_urp, sessionid, + "urp_add (%s): an entry with this uniqueid already exists.\n", + slapi_entry_get_dn_const(existing_uniqueid_entry)); + op_result= LDAP_UNWILLING_TO_PERFORM; slapi_pblock_set(pb, SLAPI_RESULT_CODE, &op_result); rc= -1; /* Ignore this Operation */ PROFILE_POINT; /* Add Conflict; UniqueID Exists; Ignore */ @@ -251,7 +261,17 @@ urp_add_operation( Slapi_PBlock *pb ) * b) We've seen the Operation before. * Let's go with (b) and ignore the little bastard. */ - op_result= LDAP_SUCCESS; + /* + * This operation won't be replayed. That is, this CSN won't update + * the max csn in RUV. The CSN is left uncommitted in RUV unless an + * error is set to op_result. Just to get rid of this CSN from RUV, + * setting an error to op_result + */ + /* op_result = LDAP_SUCCESS; */ + slapi_log_error(slapi_log_urp, sessionid, + "urp_add (%s): The CSN of the Operation and the Entry DN are the same.", + slapi_entry_get_dn_const(existing_dn_entry)); + op_result= LDAP_UNWILLING_TO_PERFORM; slapi_pblock_set(pb, SLAPI_RESULT_CODE, &op_result); rc= -1; /* Ignore this Operation */ PROFILE_POINT; /* Add Conflict; Entry Exists; Same CSN */ @@ -315,7 +335,17 @@ urp_modrdn_operation( Slapi_PBlock *pb ) * The Operation CSN is not newer than the DN CSN. * Either we're beaten by another ModRDN or we've applied the op. */ - op_result= LDAP_SUCCESS; + /* op_result= LDAP_SUCCESS; */ + /* + * This operation won't be replayed. That is, this CSN won't update + * the max csn in RUV. The CSN is left uncommitted in RUV unless an + * error is set to op_result. Just to get rid of this CSN from RUV, + * setting an error to op_result + */ + slapi_log_error(slapi_log_urp, sessionid, + "urp_modrdn (%s): operation CSN is newer than the DN CSN.\n", + slapi_entry_get_dn_const(target_entry)); + op_result= LDAP_UNWILLING_TO_PERFORM; slapi_pblock_set(pb, SLAPI_RESULT_CODE, &op_result); rc= -1; /* Ignore the modrdn */ PROFILE_POINT; /* ModRDN Conflict; Entry with Target DN Exists; OPCSN is not newer. */ @@ -326,8 +356,8 @@ urp_modrdn_operation( Slapi_PBlock *pb ) target_sdn = slapi_entry_get_sdn_const (target_entry); slapi_pblock_get(pb, SLAPI_MODRDN_NEWRDN, &newrdn); slapi_pblock_get(pb, SLAPI_TARGET_UNIQUEID, &op_uniqueid); - slapi_pblock_get(pb, SLAPI_MODRDN_PARENT_ENTRY, &parent_entry); - slapi_pblock_get(pb, SLAPI_MODRDN_NEWPARENT_ENTRY, &new_parent_entry); + slapi_pblock_get(pb, SLAPI_MODRDN_PARENT_ENTRY, &parent_entry); + slapi_pblock_get(pb, SLAPI_MODRDN_NEWPARENT_ENTRY, &new_parent_entry); slapi_pblock_get(pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, &newsuperior);
if ( is_tombstone_entry (target_entry) ) @@ -364,26 +394,29 @@ urp_modrdn_operation( Slapi_PBlock *pb ) goto bailout; }
- slapi_pblock_get(pb, SLAPI_MODRDN_EXISTING_ENTRY, &existing_entry); - if(existing_entry!=NULL) + slapi_pblock_get(pb, SLAPI_MODRDN_EXISTING_ENTRY, &existing_entry); + if(existing_entry!=NULL) { /* * An entry with the target DN already exists. - * The smaller dncsn wins. The loser changes its RDN to - * uniqueid+baserdn, and adds operational attribute - * ATTR_NSDS5_REPLCONFLIC + * The smaller dncsn wins. The loser changes its RDN to + * uniqueid+baserdn, and adds operational attribute + * ATTR_NSDS5_REPLCONFLIC */
existing_uniqueid = slapi_entry_get_uniqueid (existing_entry); existing_sdn = slapi_entry_get_sdn_const ( existing_entry);
/* - * Dismiss the operation if the existing entry is the same as the target one. + * It used to dismiss the operation if the existing entry is + * the same as the target one. + * But renaming the RDN with the one which only cases are different, + * cn=ABC --> cn=Abc, this case matches. We should go forward the op. */ if (strcmp(op_uniqueid, existing_uniqueid) == 0) { op_result= LDAP_SUCCESS; slapi_pblock_set(pb, SLAPI_RESULT_CODE, &op_result); - rc = -1; /* Ignore the op */ + rc = 0; /* Don't ignore the op */ PROFILE_POINT; /* ModRDN Replay */ goto bailout; } diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c index 132b125..df09c64 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_add.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c @@ -116,7 +116,6 @@ ldbm_back_add( Slapi_PBlock *pb ) int is_ruv = 0; /* True if the current entry is RUV */ CSN *opcsn = NULL; entry_address addr = {0}; - int val = 0;
slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li ); slapi_pblock_get( pb, SLAPI_ADD_ENTRY, &e ); @@ -965,20 +964,6 @@ error_return: disk_full = 1; }
- /* make sure SLAPI_RESULT_CODE and SLAPI_PLUGIN_OPRETURN are set */ - slapi_pblock_get(pb, SLAPI_RESULT_CODE, &val); - if (!val) { - if (!ldap_result_code) { - ldap_result_code = LDAP_OPERATIONS_ERROR; - } - slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code); - } - slapi_pblock_get( pb, SLAPI_PLUGIN_OPRETURN, &val ); - if (!val) { - val = -1; - slapi_pblock_set( pb, SLAPI_PLUGIN_OPRETURN, &val ); - } - diskfull_return: if (disk_full) { rc= return_on_disk_full(li); diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c index 0b56219..6b0fa34 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c @@ -111,7 +111,6 @@ ldbm_back_modrdn( Slapi_PBlock *pb ) entry_address *newsuperior_addr; char ebuf[BUFSIZ]; CSN *opcsn = NULL; - int val = 0;
/* sdn & parentsdn need to be initialized before "goto *_return" */ slapi_sdn_init(&dn_newdn); @@ -1066,20 +1065,6 @@ error_return: disk_full = 1; }
- /* make sure SLAPI_RESULT_CODE and SLAPI_PLUGIN_OPRETURN are set */ - slapi_pblock_get(pb, SLAPI_RESULT_CODE, &val); - if (!val) { - if (!ldap_result_code) { - ldap_result_code = LDAP_OPERATIONS_ERROR; - } - slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code); - } - slapi_pblock_get(pb, SLAPI_PLUGIN_OPRETURN, &val); - if (!val) { - val = -1; - slapi_pblock_set(pb, SLAPI_PLUGIN_OPRETURN, &val); - } - if (disk_full) { retval = return_on_disk_full(li);
commit ff29d1793e3bdfe19751d2e40b7ae5aa9963a3ba Author: Noriko Hosoi nhosoi@totoro.usersys.redhat.com Date: Sun May 13 17:05:05 2012 -0700
Trac Ticket #338 - letters in object's cn get converted to lowercase when renaming object
https://fedorahosted.org/389/ticket/338
Fix description: The value of newrdn was normalized as dn then decapitalized. The decapitalization was not just needed but the cause of the reported bug.
This patch removes the decapitalization call (slapi_dn_ignore_case) and adds slapi_dn_ignore_case to acl_access_allowed_modrdn (acl.c) and referint_postop_modrdn (referint/referint.c).
Additionally, unnecessary code is being removed from chaining_ back_modrdn (chainingdb/cb_modrdn.c). (Ported from commit 178fe6a74c793b3c6adc71f571bba40a6271325c)
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c index c8a221e..5a7b446 100644 --- a/ldap/servers/plugins/acl/acl.c +++ b/ldap/servers/plugins/acl/acl.c @@ -118,6 +118,7 @@ acl_access_allowed_modrdn( { int retCode ; char *newrdn; + char *ci_newrdn; const char *oldrdn; Slapi_DN *target_sdn = NULL; int deleteoldrdn = 0; @@ -139,8 +140,11 @@ acl_access_allowed_modrdn( slapi_pblock_get( pb, SLAPI_MODRDN_TARGET_SDN, &target_sdn ); slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &newrdn );
+ ci_newrdn = slapi_ch_strdup(newrdn); + slapi_dn_ignore_case(ci_newrdn); /* Check can add the new naming attribute */ - retCode = check_rdn_access( pb, e, newrdn, ACLPB_SLAPI_ACL_WRITE_ADD) ; + retCode = check_rdn_access( pb, e, ci_newrdn, ACLPB_SLAPI_ACL_WRITE_ADD) ; + slapi_ch_free_string(&ci_newrdn); if ( retCode != LDAP_SUCCESS ) { slapi_log_error( SLAPI_LOG_ACL, plugin_name, "modrdn:write permission to add new naming attribute not allowed\n"); @@ -150,7 +154,7 @@ acl_access_allowed_modrdn( /* Check can delete the new naming attribute--if required */ slapi_pblock_get( pb, SLAPI_MODRDN_DELOLDRDN, &deleteoldrdn ); if ( deleteoldrdn ) { - oldrdn = slapi_sdn_get_dn(target_sdn); + oldrdn = slapi_sdn_get_ndn(target_sdn); retCode = check_rdn_access( pb, e, oldrdn, ACLPB_SLAPI_ACL_WRITE_DEL) ; if ( retCode != LDAP_SUCCESS ) { slapi_log_error( SLAPI_LOG_ACL, plugin_name, @@ -1793,8 +1797,10 @@ acl_modified (Slapi_PBlock *pb, int optype, char *n_dn, void *change)
/* Change the acls */ acllist_acicache_WRITE_LOCK(); + /* acllist_moddn_aci_needsLock expects normalized new_DN, + * which is no need to be case-ignored */ acllist_moddn_aci_needsLock ( e_sdn, new_DN ); - acllist_acicache_WRITE_UNLOCK(); + acllist_acicache_WRITE_UNLOCK();
/* deallocat the parent_DN */ if (parent_DN != NULL) { @@ -1987,7 +1993,7 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int * int rv; /* return value */ /* Assume that resource matches */ int matches = ACL_TRUE; - int attr_matched; + int attr_matched = ACL_TRUE; int attr_matched_in_targetattrfilters = 0; int dn_matched; char *res_attr; @@ -2713,7 +2719,7 @@ acl__TestRights(Acl_PBlock *aclpb,int access, char **right, char ** map_generic, char *acl_tag; int expr_num; char *testRights[2]; - aci_t *aci; + aci_t *aci = NULL; int numHandles = 0; TNF_PROBE_0_DEBUG(acl__TestRights_start,"ACL",""); diff --git a/ldap/servers/plugins/acl/acllist.c b/ldap/servers/plugins/acl/acllist.c index 8eb39b9..9b5363a 100644 --- a/ldap/servers/plugins/acl/acllist.c +++ b/ldap/servers/plugins/acl/acllist.c @@ -889,7 +889,7 @@ acllist_acicache_WRITE_LOCK( ) }
/* This routine must be called with the acicache write lock taken */ -/* newdn is normalized & case-ignored */ +/* newdn is normalized (no need to be case-ignored) */ int acllist_moddn_aci_needsLock ( Slapi_DN *oldsdn, char *newdn ) { @@ -919,7 +919,7 @@ acllist_moddn_aci_needsLock ( Slapi_DN *oldsdn, char *newdn )
/* Now set the new DN */ slapi_sdn_done ( head->acic_sdn ); - slapi_sdn_set_ndn_byval ( head->acic_sdn, newdn ); + slapi_sdn_set_normdn_byval ( head->acic_sdn, newdn );
aciListHead->acic_sdn = NULL; __acllist_free_aciContainer ( &aciListHead ); diff --git a/ldap/servers/plugins/chainingdb/cb_add.c b/ldap/servers/plugins/chainingdb/cb_add.c index 116ac92..07b90fa 100644 --- a/ldap/servers/plugins/chainingdb/cb_add.c +++ b/ldap/servers/plugins/chainingdb/cb_add.c @@ -69,7 +69,7 @@ chaining_back_add ( Slapi_PBlock *pb ) const char *dn = NULL; Slapi_DN *sdn = NULL; char *cnxerrbuf=NULL; - time_t endtime; + time_t endtime = 0; cb_outgoing_conn *cnx; if ( (rc=cb_forward_operation(pb)) != LDAP_SUCCESS ) { diff --git a/ldap/servers/plugins/chainingdb/cb_compare.c b/ldap/servers/plugins/chainingdb/cb_compare.c index 16f6c7b..594c4bb 100644 --- a/ldap/servers/plugins/chainingdb/cb_compare.c +++ b/ldap/servers/plugins/chainingdb/cb_compare.c @@ -67,7 +67,7 @@ chaining_back_compare ( Slapi_PBlock *pb ) const char *dn = NULL; Slapi_DN *sdn = NULL; char *cnxerrbuf=NULL; - time_t endtime; + time_t endtime = 0; cb_outgoing_conn *cnx;
if ( LDAP_SUCCESS != (rc=cb_forward_operation(pb) )) { diff --git a/ldap/servers/plugins/chainingdb/cb_delete.c b/ldap/servers/plugins/chainingdb/cb_delete.c index 87a69a2..09972b2 100644 --- a/ldap/servers/plugins/chainingdb/cb_delete.c +++ b/ldap/servers/plugins/chainingdb/cb_delete.c @@ -66,7 +66,7 @@ chaining_back_delete ( Slapi_PBlock *pb ) Slapi_DN *sdn = NULL; char *matched_msg, *error_msg; char *cnxerrbuf=NULL; - time_t endtime; + time_t endtime = 0; cb_outgoing_conn *cnx;
if ( LDAP_SUCCESS != (rc=cb_forward_operation(pb) )) { diff --git a/ldap/servers/plugins/chainingdb/cb_modify.c b/ldap/servers/plugins/chainingdb/cb_modify.c index aa914b9..06e6b82 100644 --- a/ldap/servers/plugins/chainingdb/cb_modify.c +++ b/ldap/servers/plugins/chainingdb/cb_modify.c @@ -69,7 +69,7 @@ chaining_back_modify ( Slapi_PBlock *pb ) Slapi_DN *sdn = NULL; char *matched_msg, *error_msg; char *cnxerrbuf=NULL; - time_t endtime; + time_t endtime = 0; cb_outgoing_conn *cnx;
if ( LDAP_SUCCESS != (rc=cb_forward_operation(pb) )) { diff --git a/ldap/servers/plugins/chainingdb/cb_modrdn.c b/ldap/servers/plugins/chainingdb/cb_modrdn.c index b6b882b..1ce6c60 100644 --- a/ldap/servers/plugins/chainingdb/cb_modrdn.c +++ b/ldap/servers/plugins/chainingdb/cb_modrdn.c @@ -62,16 +62,13 @@ chaining_back_modrdn ( Slapi_PBlock *pb ) char **referrals=NULL; LDAPMessage *res; char *matched_msg, *error_msg; - char *newdn = NULL; - const char *pdn = NULL; char *ndn = NULL; Slapi_DN *sdn = NULL; - Slapi_DN *psdn = NULL; int deleteoldrdn = 0; Slapi_DN *newsuperior = NULL; char *newrdn = NULL; char * cnxerrbuf=NULL; - time_t endtime; + time_t endtime = 0; cb_outgoing_conn *cnx;
if ( LDAP_SUCCESS != (rc=cb_forward_operation(pb) )) { @@ -90,36 +87,13 @@ chaining_back_modrdn ( Slapi_PBlock *pb ) }
slapi_pblock_get( pb, SLAPI_MODRDN_TARGET_SDN, &sdn ); + /* newrdn is passed to ldap_rename, which does not require case-ignored + * newrdn. */ slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &newrdn ); slapi_pblock_get( pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, &newsuperior ); slapi_pblock_get( pb, SLAPI_MODRDN_DELOLDRDN, &deleteoldrdn );
ndn = (char *)slapi_sdn_get_ndn(sdn); - - /* - * Construct the new dn - */ - psdn = slapi_sdn_new(); - slapi_sdn_get_parent(sdn, psdn); - pdn = slapi_sdn_get_ndn(psdn); - - if ( pdn ) { - /* parent + rdn + separator(s) + null */ - newdn = slapi_ch_smprintf("%s,%s", newrdn, pdn); - } else { - newdn = slapi_ch_strdup( newrdn ); - } - slapi_sdn_free(&psdn); - - /* - * Make sure the current backend is managing - * the new dn. We won't support moving entries - * across backend this way. - * Done in the front-end. - */ - - slapi_ch_free((void **)&newdn); - if (cb->local_acl && !cb->associated_be_is_disabled) { /* * Check local acls diff --git a/ldap/servers/plugins/chainingdb/cb_search.c b/ldap/servers/plugins/chainingdb/cb_search.c index 92eb2ea..a27e767 100644 --- a/ldap/servers/plugins/chainingdb/cb_search.c +++ b/ldap/servers/plugins/chainingdb/cb_search.c @@ -77,7 +77,7 @@ chainingdb_build_candidate_list ( Slapi_PBlock *pb ) char **referrals=NULL; char *cnxerrbuf=NULL; time_t endbefore=0; - time_t endtime; + time_t endtime = 0; cb_outgoing_conn *cnx;
slapi_pblock_get( pb, SLAPI_BACKEND, &be ); @@ -459,7 +459,7 @@ chainingdb_next_search_entry ( Slapi_PBlock *pb ) char **referrals=NULL; cb_backend_instance * cb=NULL; Slapi_Backend * be; - time_t endtime; + time_t endtime = 0;
matched_msg=error_msg=NULL;
diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c index 195ff2b..4db5d6d 100644 --- a/ldap/servers/plugins/referint/referint.c +++ b/ldap/servers/plugins/referint/referint.c @@ -300,8 +300,7 @@ referint_postop_modrdn( Slapi_PBlock *pb ) }else if(delay == 0){ /* no delay */ /* call function to update references to entry */ - rc = update_integrity(argv, sdn, newrdn, - newsuperior, logChanges, txn); + rc = update_integrity(argv, sdn, newrdn, newsuperior, logChanges, txn); }else{ /* write the entry to integrity log */ writeintegritylog(argv[1], sdn, newrdn, newsuperior); @@ -418,6 +417,7 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ } /* newRDN and superior are already normalized. */ newDN = slapi_ch_smprintf("%s,%s", newRDN, superior); + slapi_dn_ignore_case(newDN); /* * Compare the modified dn with the value of * the target attribute of referint to find out @@ -596,7 +596,9 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ /* no need to free superior */ superior = slapi_dn_find_parent(origDN); } + /* newRDN and superior are already normalized. */ newDN = slapi_ch_smprintf("%s,%s", newRDN, superior); + slapi_dn_ignore_case(newDN); /* * Compare the modified dn with the value of * the target attribute of referint to find out diff --git a/ldap/servers/plugins/uiduniq/7bit.c b/ldap/servers/plugins/uiduniq/7bit.c index 3e0b921..3509044 100644 --- a/ldap/servers/plugins/uiduniq/7bit.c +++ b/ldap/servers/plugins/uiduniq/7bit.c @@ -606,8 +606,8 @@ preop_modrdn(Slapi_PBlock *pb)
/* NOTE: strdup on the rdn, since it will be freed when * the entry is freed */ - - slapi_entry_set_dn(e, slapi_ch_strdup(rdn)); + /* slapi_entry_set_normdn expects rdn normalized, but not decapitalized */ + slapi_entry_set_normdn(e, slapi_ch_strdup(rdn));
err = slapi_entry_add_rdn_values(e); if (err) diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c index 4eba4ed..c602a1c 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c @@ -497,7 +497,8 @@ entryrdn_rename_subtree(backend *be, if (newsrdn && slapi_rdn_get_rdn(newsrdn)) { /* if the new RDN value is identical to the old RDN, * we don't have to do "rename" */ - if (strcmp(slapi_rdn_get_nrdn(newsrdn), slapi_rdn_get_nrdn(&oldsrdn))) { + /* Don't miss the case changes, too. */ + if (strcmp(slapi_rdn_get_rdn(newsrdn), slapi_rdn_get_rdn(&oldsrdn))) { /* did not match; let's rename it */ mynewsrdn = newsrdn; } diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c index a7bb1a6..c270ed5 100644 --- a/ldap/servers/slapd/modrdn.c +++ b/ldap/servers/slapd/modrdn.c @@ -191,7 +191,6 @@ do_modrdn( Slapi_PBlock *pb ) slapi_ch_free_string( &rawnewsuperior ); goto free_and_return; } - slapi_dn_ignore_case( newrdn ); slapi_ch_free_string( &rawnewrdn );
if (rawnewsuperior) { @@ -218,6 +217,8 @@ do_modrdn( Slapi_PBlock *pb ) */ parent = slapi_dn_parent(slapi_sdn_get_ndn(&sdn)); newdn = slapi_ch_smprintf("%s,%s", newrdn, parent); + /* slapi_sdn_init_normdn_passin expects normalized but NOT + * decapitalized dn */ slapi_sdn_init_normdn_passin(&snewdn, newdn); /* newdn is normalized */ if (0 == slapi_sdn_compare(&sdn, snewsuperior) || 0 == slapi_sdn_compare(&snewdn, snewsuperior)) { @@ -560,6 +561,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args) }
/* check if created attributes are used in the new RDN */ + /* check_rdn_for_created_attrs ignores the cases */ if (check_rdn_for_created_attrs((const char *)newrdn)) { send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX, NULL, "invalid attribute in RDN", 0, NULL); goto free_and_return_nolock; @@ -607,6 +609,8 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args) * appropriate one, or send a referral to our "referral server" * if we don't hold it. */ + /* slapi_mapping_tree_select_and_check ignores the case of newdn + * which is generated using newrdn above. */ if ((err = slapi_mapping_tree_select_and_check(pb, newdn, &be, &referral, errorbuf)) != LDAP_SUCCESS) { send_ldap_result(pb, err, NULL, errorbuf, 0, NULL); @@ -707,6 +711,7 @@ free_and_return_nolock: } else { slapi_pblock_get(pb, SLAPI_MODRDN_TARGET_SDN, &sdn); slapi_sdn_free(&sdn); + /* get newrdn to free the string */ slapi_pblock_get(pb, SLAPI_MODRDN_NEWRDN, &newrdn); slapi_ch_free_string(&newrdn); slapi_pblock_get(pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, &newsuperiorsdn);
389-commits@lists.fedoraproject.org