ldap/servers/plugins/referint/referint.c | 38 +++++++++++++++----------------
1 file changed, 19 insertions(+), 19 deletions(-)
New commits:
commit 6ba24ebaa9d3ee50b025f4e3dacad04a07f0c6f8
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Jul 9 15:24:25 2012 -0600
Ticket #405 - referint modrdn not working if case is different
https://fedorahosted.org/389/ticket/405
Resolves: Ticket #405
Bug Description: referint modrdn not working if case is different
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: Pass the Slapi_DN to _update_all_per_mod() and
_update_one_per_mod(). Use the case normalized dn (ndn) to compare against
the case normalized member value.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit 8ef08f85fb29ffe4c17ed900378882e8eb127bc4)
diff --git a/ldap/servers/plugins/referint/referint.c
b/ldap/servers/plugins/referint/referint.c
index 266a7d1..7e45e0e 100644
--- a/ldap/servers/plugins/referint/referint.c
+++ b/ldap/servers/plugins/referint/referint.c
@@ -342,7 +342,7 @@ static int
_update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */
Slapi_Attr *attr, /* referred attribute */
char *attrName,
- const char *origDN, /* original DN that was modified */
+ Slapi_DN *origDN, /* original DN that was modified */
char *newRDN, /* new RDN from modrdn */
const char *newsuperior, /* new superior from modrdn */
Slapi_PBlock *mod_pb)
@@ -362,7 +362,7 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
if (NULL == newRDN && NULL == newsuperior) {
/* in delete mode */
/* delete old dn so set that up */
- values_del[0] = (char *)origDN;
+ values_del[0] = (char *)slapi_sdn_get_dn(origDN);
values_del[1] = NULL;
attribute1.mod_type = attrName;
attribute1.mod_op = LDAP_MOD_DELETE;
@@ -374,7 +374,7 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
if (rc) {
slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM,
"_update_one_value: entry %s: deleting \"%s: %s\" failed
(%d)"
- "\n", slapi_sdn_get_dn(entrySDN), attrName, origDN, rc);
+ "\n", slapi_sdn_get_dn(entrySDN), attrName,
slapi_sdn_get_dn(origDN), rc);
}
} else {
/* in modrdn mode */
@@ -388,11 +388,11 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
goto bail;
}
/* need to put together rdn into a dn */
- dnParts = slapi_ldap_explode_dn( origDN, 0 );
+ dnParts = slapi_ldap_explode_dn( slapi_sdn_get_dn(origDN), 0 );
if (NULL == dnParts) {
slapi_log_error(SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM,
"_update_one_value: failed to explode dn %s\n",
- origDN);
+ slapi_sdn_get_dn(origDN));
goto bail;
}
if (NULL == newRDN) {
@@ -401,8 +401,8 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
if (newsuperior) {
superior = newsuperior;
} else {
- /* no need to free superior */
- superior = slapi_dn_find_parent(origDN);
+ /* do not free superior */
+ superior = slapi_dn_find_parent(slapi_sdn_get_dn(origDN));
}
/* newRDN and superior are already normalized. */
newDN = slapi_ch_smprintf("%s,%s", newRDN, superior);
@@ -443,7 +443,7 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
}
/* else: (rc < 0) Ignore the DN normalization error for now. */
- p = PL_strstr(sval, origDN);
+ p = PL_strstr(sval, slapi_sdn_get_ndn(origDN));
if (p == sval) {
/* (case 1) */
values_del[0] = sval;
@@ -466,7 +466,7 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
"_update_one_value: entry %s: replacing \"%s: %s\"
"
"with \"%s: %s\" failed (%d)\n",
slapi_sdn_get_dn(entrySDN), attrName,
- origDN, attrName, newDN, rc);
+ slapi_sdn_get_dn(origDN), attrName, newDN, rc);
}
} else if (p) {
char bak;
@@ -521,7 +521,7 @@ static int
_update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */
Slapi_Attr *attr, /* referred attribute */
char *attrName,
- const char *origDN, /* original DN that was modified */
+ Slapi_DN *origDN, /* original DN that was modified */
char *newRDN, /* new RDN from modrdn */
const char *newsuperior, /* new superior from modrdn */
Slapi_PBlock *mod_pb)
@@ -545,7 +545,7 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
LDAPMod attribute1;
/* delete old dn so set that up */
- values_del[0] = (char *)origDN;
+ values_del[0] = (char *)slapi_sdn_get_dn(origDN);
values_del[1] = NULL;
attribute1.mod_type = attrName;
attribute1.mod_op = LDAP_MOD_DELETE;
@@ -557,7 +557,7 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
if (rc) {
slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM,
"_update_all_per_mod: entry %s: deleting \"%s: %s\" failed
(%d)"
- "\n", slapi_sdn_get_dn(entrySDN), attrName, origDN, rc);
+ "\n", slapi_sdn_get_dn(entrySDN), attrName,
slapi_sdn_get_dn(origDN), rc);
}
} else {
/* in modrdn mode */
@@ -571,11 +571,11 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
goto bail;
}
/* need to put together rdn into a dn */
- dnParts = slapi_ldap_explode_dn( origDN, 0 );
+ dnParts = slapi_ldap_explode_dn( slapi_sdn_get_dn(origDN), 0 );
if (NULL == dnParts) {
slapi_log_error(SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM,
"_update_all_per_mod: failed to explode dn %s\n",
- origDN);
+ slapi_sdn_get_dn(origDN));
goto bail;
}
if (NULL == newRDN) {
@@ -584,8 +584,8 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
if (newsuperior) {
superior = newsuperior;
} else {
- /* no need to free superior */
- superior = slapi_dn_find_parent(origDN);
+ /* do not free superior */
+ superior = slapi_dn_find_parent(slapi_sdn_get_dn(origDN));
}
/* newRDN and superior are already normalized. */
newDN = slapi_ch_smprintf("%s,%s", newRDN, superior);
@@ -631,7 +631,7 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched
entry */
}
/* else: (rc < 0) Ignore the DN normalization error for now. */
- p = PL_strstr(sval, origDN);
+ p = PL_strstr(sval, slapi_sdn_get_ndn(origDN));
if (p == sval) {
/* (case 1) */
slapi_mods_add_string(smods, LDAP_MOD_DELETE, attrName, sval);
@@ -767,13 +767,13 @@ update_integrity(char **argv, Slapi_DN *origSDN,
if (nval > 128) {
rc = _update_one_per_mod(
slapi_entry_get_sdn(search_entries[j]),
- attr, attrName, origDN, newrDN,
+ attr, attrName, origSDN, newrDN,
slapi_sdn_get_dn(newsuperior),
mod_pb);
} else {
rc = _update_all_per_mod(
slapi_entry_get_sdn(search_entries[j]),
- attr, attrName, origDN, newrDN,
+ attr, attrName, origSDN, newrDN,
slapi_sdn_get_dn(newsuperior),
mod_pb);
}