ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/replication/repl5_protocol_util.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
New commits:
commit 758a68db83c653187203d683c9d9a71742314be5
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon May 21 09:08:04 2012 -0600
Ticket #321 - krbExtraData is being null modified and replicated on each ssh login
Bug Description: Crash during IPA install
Fix Description: Have to free the mod before moving the unremoved mods
down the list on top of the freed mod.
Reviewed by: mreynolds (Thanks!)
diff --git a/ldap/servers/plugins/replication/repl5_protocol_util.c b/ldap/servers/plugins/replication/repl5_protocol_util.c
index 3327405..30d211a 100644
--- a/ldap/servers/plugins/replication/repl5_protocol_util.c
+++ b/ldap/servers/plugins/replication/repl5_protocol_util.c
@@ -707,6 +707,11 @@ repl5_strip_fractional_mods(Repl_Agmt *agmt, LDAPMod ** mods)
*/
if (0 == slapi_attr_type_cmp(mods[j]->mod_type, a[i], SLAPI_TYPE_CMP_SUBTYPE))
{
+ /* Adjust value of j, implicit in not incrementing it */
+ /* Free this mod */
+ ber_bvecfree(mods[j]->mod_bvalues);
+ slapi_ch_free((void **)&(mods[j]->mod_type));
+ slapi_ch_free((void **)&mods[j]);
/* Move down all subsequent mods */
for (k = j; mods[k+1] ; k++)
{
@@ -714,11 +719,6 @@ repl5_strip_fractional_mods(Repl_Agmt *agmt, LDAPMod ** mods)
}
/* Zero the end of the array */
mods[k] = NULL;
- /* Adjust value of j, implicit in not incrementing it */
- /* Free this mod */
- ber_bvecfree(mods[j]->mod_bvalues);
- slapi_ch_free((void **)&(mods[j]->mod_type));
- slapi_ch_free((void **)&mods[j]);
} else {
j++;
}
11 years, 11 months
VERSION.sh
by Richard Allen Megginson
VERSION.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 8eaa3c605b74e78fc45172f0e0544e65017090c4
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon May 21 09:54:42 2012 -0600
console .2 is still compatible with 389 .3 for now
diff --git a/VERSION.sh b/VERSION.sh
index 5e93c7a..e7c8e85 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -50,4 +50,5 @@ PACKAGE_BUGREPORT="${PACKAGE_BUGREPORT}enter_bug.cgi?product=$brand"
PACKAGE_STRING="$PACKAGE_TARNAME $PACKAGE_VERSION"
# the version of the ds console package that this directory server
# is compatible with
-CONSOLE_VERSION=$VERSION_MAJOR.$VERSION_MINOR.6
+# console .2 is still compatible with 389 .3 for now
+CONSOLE_VERSION=$VERSION_MAJOR.2.6
11 years, 11 months
ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/replication/csnpl.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 12567ffd8c5504cd3ba7dc7783e7ca1f237c82be
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri May 18 15:13:16 2012 -0600
Trac Ticket #359 - Database RUV could mismatch the one in changelog under the stress
https://fedorahosted.org/389/ticket/359
Fix Description:
. Fix for csnplRollUp - was leaking the node data - since
llistRemoveCurrentAndGetNext will detach the current node,
we have to free the data associated with the current node
first, but not the csn, so set that to NULL first
Reviewed by: nhosoi (Thanks!)
diff --git a/ldap/servers/plugins/replication/csnpl.c b/ldap/servers/plugins/replication/csnpl.c
index 16cebf1..b3c2ffd 100644
--- a/ldap/servers/plugins/replication/csnpl.c
+++ b/ldap/servers/plugins/replication/csnpl.c
@@ -101,9 +101,8 @@ CSNPL* csnplNew ()
void
-csnpldata_free(void **data)
+csnpldata_free(csnpldata **data_to_free)
{
- csnpldata **data_to_free = (csnpldata **)data;
if (NULL != data_to_free)
{
if (NULL != (*data_to_free)->csn)
@@ -319,6 +318,10 @@ csnplRollUp(CSNPL *csnpl, CSN **first_commited)
*first_commited = data->csn;
freeit = PR_FALSE;
}
+ /* llistRemoveCurrentAndGetNext will detach the current node
+ so we have to free the data associated with it, but not the csn */
+ data->csn = NULL;
+ csnpldata_free(&data);
data = (csnpldata *)llistRemoveCurrentAndGetNext(csnpl->csnList, &iterator);
} else {
data = (csnpldata *)llistGetNext (csnpl->csnList, &iterator);
11 years, 11 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/replication/csnpl.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit b5f3f98fc0a8f94ecf1b4bf0c68d8a17b75a233b
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri May 18 15:13:16 2012 -0600
Trac Ticket #359 - Database RUV could mismatch the one in changelog under the stress
https://fedorahosted.org/389/ticket/359
Fix Description:
. Fix for csnplRollUp - was leaking the node data - since
llistRemoveCurrentAndGetNext will detach the current node,
we have to free the data associated with the current node
first, but not the csn, so set that to NULL first
Reviewed by: nhosoi (Thanks!)
(cherry picked from commit 12567ffd8c5504cd3ba7dc7783e7ca1f237c82be)
diff --git a/ldap/servers/plugins/replication/csnpl.c b/ldap/servers/plugins/replication/csnpl.c
index 16cebf1..b3c2ffd 100644
--- a/ldap/servers/plugins/replication/csnpl.c
+++ b/ldap/servers/plugins/replication/csnpl.c
@@ -101,9 +101,8 @@ CSNPL* csnplNew ()
void
-csnpldata_free(void **data)
+csnpldata_free(csnpldata **data_to_free)
{
- csnpldata **data_to_free = (csnpldata **)data;
if (NULL != data_to_free)
{
if (NULL != (*data_to_free)->csn)
@@ -319,6 +318,10 @@ csnplRollUp(CSNPL *csnpl, CSN **first_commited)
*first_commited = data->csn;
freeit = PR_FALSE;
}
+ /* llistRemoveCurrentAndGetNext will detach the current node
+ so we have to free the data associated with it, but not the csn */
+ data->csn = NULL;
+ csnpldata_free(&data);
data = (csnpldata *)llistRemoveCurrentAndGetNext(csnpl->csnList, &iterator);
} else {
data = (csnpldata *)llistGetNext (csnpl->csnList, &iterator);
11 years, 11 months
Branch '389-ds-base-1.2.10' - ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/replication/csnpl.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 4d982e5cfdd3f2091a79cce6be94df998c9736f3
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri May 18 15:13:16 2012 -0600
Trac Ticket #359 - Database RUV could mismatch the one in changelog under the stress
https://fedorahosted.org/389/ticket/359
Fix Description:
. Fix for csnplRollUp - was leaking the node data - since
llistRemoveCurrentAndGetNext will detach the current node,
we have to free the data associated with the current node
first, but not the csn, so set that to NULL first
Reviewed by: nhosoi (Thanks!)
(cherry picked from commit 12567ffd8c5504cd3ba7dc7783e7ca1f237c82be)
(cherry picked from commit b5f3f98fc0a8f94ecf1b4bf0c68d8a17b75a233b)
diff --git a/ldap/servers/plugins/replication/csnpl.c b/ldap/servers/plugins/replication/csnpl.c
index 16cebf1..b3c2ffd 100644
--- a/ldap/servers/plugins/replication/csnpl.c
+++ b/ldap/servers/plugins/replication/csnpl.c
@@ -101,9 +101,8 @@ CSNPL* csnplNew ()
void
-csnpldata_free(void **data)
+csnpldata_free(csnpldata **data_to_free)
{
- csnpldata **data_to_free = (csnpldata **)data;
if (NULL != data_to_free)
{
if (NULL != (*data_to_free)->csn)
@@ -319,6 +318,10 @@ csnplRollUp(CSNPL *csnpl, CSN **first_commited)
*first_commited = data->csn;
freeit = PR_FALSE;
}
+ /* llistRemoveCurrentAndGetNext will detach the current node
+ so we have to free the data associated with it, but not the csn */
+ data->csn = NULL;
+ csnpldata_free(&data);
data = (csnpldata *)llistRemoveCurrentAndGetNext(csnpl->csnList, &iterator);
} else {
data = (csnpldata *)llistGetNext (csnpl->csnList, &iterator);
11 years, 11 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/replication/llist.c | 6 +--
ldap/servers/plugins/replication/urp.c | 57 ++++++++++++++++++++++-------
ldap/servers/slapd/back-ldbm/ldbm_add.c | 29 +++++++-------
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 29 +++++++-------
4 files changed, 76 insertions(+), 45 deletions(-)
New commits:
commit f9dfeea2d8bb561d915d62c7661f9d3de48d38cc
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Tue May 15 10:43:59 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
f0f74b57f81998a325dc7472b9ea9b44c5ff6439 was not correct.
. Undo the changes made in ldbm_back_add, ldbm_back_modrdn
(ldbm_add.c, ldbm_modrdn.c) in commit
f0f74b57f81998a325dc7472b9ea9b44c5ff6439.
. 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.
(cherry picked from commit ff601de4c21224f6fa5b995fd877907671f75575)
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 bc32473..1d8799a 100644
--- a/ldap/servers/plugins/replication/urp.c
+++ b/ldap/servers/plugins/replication/urp.c
@@ -137,7 +137,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 */
@@ -249,7 +259,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 */
@@ -311,7 +331,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. */
@@ -323,8 +353,8 @@ urp_modrdn_operation( Slapi_PBlock *pb )
/* newrdn is no need to be case-ignored (get_rdn_plus_uniqueid) */
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) )
@@ -361,26 +391,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 fc7ed80..1539c7c 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -117,7 +117,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 );
@@ -1044,26 +1043,26 @@ 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);
} else {
/* It is safer not to abort when the transaction is not started. */
if (txn.back_txn_txn && (txn.back_txn_txn != parent_txn)) {
+ /* make sure SLAPI_RESULT_CODE and SLAPI_PLUGIN_OPRETURN are set */
+ int val = 0;
+ 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 );
+ }
/* call the transaction post add plugins just before the abort */
if ((retval = plugin_call_plugins(pb, SLAPI_PLUGIN_BE_TXN_POST_ADD_FN))) {
int opreturn = 0;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 2e180f2..b3d8111 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -120,7 +120,6 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
const char *newdn = NULL;
char *newrdn = NULL;
int opreturn = 0;
- int val = 0;
/* sdn & parentsdn need to be initialized before "goto *_return" */
slapi_sdn_init(&dn_newdn);
@@ -1199,20 +1198,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) {
- opreturn = -1;
- slapi_pblock_set( pb, SLAPI_PLUGIN_OPRETURN, &opreturn );
- }
-
if (disk_full)
{
retval = return_on_disk_full(li);
@@ -1222,6 +1207,20 @@ error_return:
/* It is safer not to abort when the transaction is not started. */
if (txn.back_txn_txn && (txn.back_txn_txn != parent_txn))
{
+ /* make sure SLAPI_RESULT_CODE and SLAPI_PLUGIN_OPRETURN are set */
+ int val = 0;
+ 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) {
+ opreturn = -1;
+ slapi_pblock_set( pb, SLAPI_PLUGIN_OPRETURN, &opreturn );
+ }
/* call the transaction post modrdn plugins just before the commit */
if ((retval = plugin_call_plugins(pb, SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN))) {
LDAPDebug1Arg( LDAP_DEBUG_TRACE, "SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN plugin "
11 years, 11 months
Branch '389-ds-base-1.2.11' - ldap/schema ldap/servers
by Richard Allen Megginson
ldap/schema/01core389.ldif | 3 -
ldap/servers/plugins/replication/repl5.h | 2
ldap/servers/plugins/replication/repl5_agmt.c | 25 ++++++++
ldap/servers/plugins/replication/repl5_protocol_util.c | 50 ++++++++++++-----
ldap/servers/plugins/replication/repl_globals.c | 1
ldap/servers/slapd/charray.c | 5 +
ldap/servers/slapd/slapi-plugin.h | 9 +++
7 files changed, 80 insertions(+), 15 deletions(-)
New commits:
commit fde3a20f8238e54916e690487a011561ca111cb0
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Thu May 17 17:25:06 2012 -0400
Ticket #321 - krbExtraData is being null modified and replicated on each ssh login
Bug Description: When using fractional repl, if you update a attribute that is excluded,
a modify op is still sent to the replicas. The update is basically empty,
except we are still updating these attributes for no reason:
modifiersname
modifyTimestamp
etc
Fix Description: Added a new attribute to the replication agmt: nsds5ReplicaStripAttrs
Add the attributes that you don't want replicated if the mods are "empty".
Separate each attribute by a space:
nsds5ReplicaStripAttrs: modifiersname modifytimestamp
Side Note: Did a little optimization in repl5_strip_fractional_mods() as well.
https://fedorahosted.org/389/ticket/321
Reviewed by:
(cherry picked from commit 59ac943dc635817054c82a1d7c904dc01514d96d)
diff --git a/ldap/schema/01core389.ldif b/ldap/schema/01core389.ldif
index b3df639..def693d 100644
--- a/ldap/schema/01core389.ldif
+++ b/ldap/schema/01core389.ldif
@@ -108,6 +108,7 @@ attributeTypes: ( 2.16.840.1.113730.3.1.808 NAME 'nsds5replicaLastInitEnd' DESC
attributeTypes: ( 2.16.840.1.113730.3.1.809 NAME 'nsds5replicaLastInitStatus' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.1097 NAME 'nsds5replicaBusyWaitTime' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.1098 NAME 'nsds5replicaSessionPauseTime' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2134 NAME 'nsds5ReplicaStripAttrs' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.9999999 NAME 'nsds5debugreplicatimeout' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2064 NAME 'nsSaslMapRegexString' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2065 NAME 'nsSaslMapBaseDNTemplate' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
@@ -153,7 +154,7 @@ objectClasses: ( 2.16.840.1.113730.3.2.110 NAME 'nsMappingTree' DESC 'Netscape d
objectClasses: ( 2.16.840.1.113730.3.2.104 NAME 'nsContainer' DESC 'Netscape defined objectclass' SUP top MUST ( CN ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.108 NAME 'nsDS5Replica' DESC 'Netscape defined objectclass' SUP top MUST ( nsDS5ReplicaRoot $ nsDS5ReplicaId ) MAY (cn $ nsDS5ReplicaType $ nsDS5ReplicaBindDN $ nsState $ nsDS5ReplicaName $ nsDS5Flags $ nsDS5Task $ nsDS5ReplicaReferral $ nsDS5ReplicaAutoReferral $ nsds5ReplicaPurgeDelay $ nsds5ReplicaTombstonePurgeInterval $ nsds5ReplicaChangeCount $ nsds5ReplicaLegacyConsumer) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.113 NAME 'nsTombstone' DESC 'Netscape defined objectclass' SUP top MAY ( nsParentUniqueId $ nscpEntryDN ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.103 NAME 'nsDS5ReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicatedAttributeListTotal $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5ReplicaEnabled $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5replicaSessionPauseTime ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.103 NAME 'nsDS5ReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicatedAttributeListTotal $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5ReplicaEnabled $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5ReplicaStripAttrs $ nsds5replicaSessionPauseTime ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.39 NAME 'nsslapdConfig' DESC 'Netscape defined objectclass' SUP top MAY ( cn ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.317 NAME 'nsSaslMapping' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsSaslMapRegexString $ nsSaslMapBaseDNTemplate $ nsSaslMapFilterTemplate ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.43 NAME 'nsSNMP' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsSNMPEnabled ) MAY ( nsSNMPOrganization $ nsSNMPLocation $ nsSNMPContact $ nsSNMPDescription $ nsSNMPName $ nsSNMPMasterHost $ nsSNMPMasterPort ) X-ORIGIN 'Netscape Directory Server' )
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index 23d9753..d3feeb0 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -156,6 +156,7 @@ extern const char *type_nsds5ReplicaTimeout;
extern const char *type_nsds5ReplicaBusyWaitTime;
extern const char *type_nsds5ReplicaSessionPauseTime;
extern const char *type_nsds5ReplicaEnabled;
+extern const char *type_nsds5ReplicaStripAttrs;
/* Attribute names for windows replication agreements */
extern const char *type_nsds7WindowsReplicaArea;
@@ -356,6 +357,7 @@ void* agmt_get_connection( Repl_Agmt *ra);
int agmt_has_protocol(Repl_Agmt *agmt);
PRBool agmt_is_enabled(Repl_Agmt *ra);
int agmt_set_enabled_from_entry(Repl_Agmt *ra, Slapi_Entry *e);
+char **agmt_get_attrs_to_strip(Repl_Agmt *ra);
typedef struct replica Replica;
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c
index d194acc..4db7e13 100644
--- a/ldap/servers/plugins/replication/repl5_agmt.c
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
@@ -138,6 +138,8 @@ typedef struct repl5agmt {
void *priv; /* private data, used for windows-specific agreement data
for sync agreements or for replication session plug-in
private data for normal replication agreements */
+ char **attrs_to_strip; /* for fractional replication, if a "mod" is empty, strip out these attributes:
+ * modifiersname, modifytimestamp, internalModifiersname, internalModifyTimestamp, etc */
int agreement_type;
} repl5agmt;
@@ -470,6 +472,16 @@ agmt_new_from_entry(Slapi_Entry *e)
slapi_ch_array_free(denied_attrs);
goto loser;
}
+ /*
+ * Extract the attributes to strip for "empty" mods
+ */
+ ra->attrs_to_strip = NULL;
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds5ReplicaStripAttrs);
+ if (NULL != tmpstr)
+ {
+ ra->attrs_to_strip = slapi_str2charray_ext(tmpstr, " ", 0);
+ slapi_ch_free_string(&tmpstr);
+ }
if (!agmt_is_valid(ra))
{
@@ -575,6 +587,10 @@ agmt_delete(void **rap)
windows_agreement_delete(ra);
}
+ if(ra->attrs_to_strip){
+ slapi_ch_array_free(ra->attrs_to_strip);
+ }
+
schedule_destroy(ra->schedule);
slapi_ch_free((void **)&ra->long_name);
slapi_ch_free((void **)rap);
@@ -2540,3 +2556,12 @@ agmt_set_enabled_from_entry(Repl_Agmt *ra, Slapi_Entry *e){
return rc;
}
+char **
+agmt_get_attrs_to_strip(Repl_Agmt *ra)
+{
+ if(ra){
+ return ra->attrs_to_strip;
+ } else {
+ return NULL;
+ }
+}
diff --git a/ldap/servers/plugins/replication/repl5_protocol_util.c b/ldap/servers/plugins/replication/repl5_protocol_util.c
index 732d952..3327405 100644
--- a/ldap/servers/plugins/replication/repl5_protocol_util.c
+++ b/ldap/servers/plugins/replication/repl5_protocol_util.c
@@ -689,25 +689,25 @@ protocol_response2string (int response)
int
repl5_strip_fractional_mods(Repl_Agmt *agmt, LDAPMod ** mods)
{
- int retval = 0;
- int i = 0;
char **a = agmt_get_fractional_attrs(agmt);
+ char **attrs_to_strip;
+ int retval = 0;
+ int strip = 1;
+ int i, j, k;
+
if (a) {
/* Iterate through the fractional attr list */
for ( i = 0; a[i] != NULL; i++ )
{
- char *this_excluded_attr = a[i];
- int j = 0;
-
for ( j = 0; NULL != mods[ j ]; )
{
- /* For each one iterate through the attrs in this mod list */
- /* For any that match, remove the mod */
- LDAPMod *this_mod = mods[j];
- if (0 == slapi_attr_type_cmp(this_mod->mod_type,this_excluded_attr,SLAPI_TYPE_CMP_SUBTYPE))
+ /*
+ * Iterate through the attrs in this mod list.
+ * If any match the fractional attr then remove the mod.
+ */
+ if (0 == slapi_attr_type_cmp(mods[j]->mod_type, a[i], SLAPI_TYPE_CMP_SUBTYPE))
{
/* Move down all subsequent mods */
- int k = 0;
for (k = j; mods[k+1] ; k++)
{
mods[k] = mods[k+1];
@@ -716,15 +716,37 @@ repl5_strip_fractional_mods(Repl_Agmt *agmt, LDAPMod ** mods)
mods[k] = NULL;
/* Adjust value of j, implicit in not incrementing it */
/* Free this mod */
- ber_bvecfree(this_mod->mod_bvalues);
- slapi_ch_free((void **)&(this_mod->mod_type));
- slapi_ch_free((void **)&this_mod);
-
+ ber_bvecfree(mods[j]->mod_bvalues);
+ slapi_ch_free((void **)&(mods[j]->mod_type));
+ slapi_ch_free((void **)&mods[j]);
} else {
j++;
}
}
}
+ /*
+ * Check if "all" the remaining mods are on attributes we want to strip from the update.
+ * If all the mods are on attrs_to_strip, then free them.
+ */
+ if((attrs_to_strip = agmt_get_attrs_to_strip(agmt)) != NULL){
+ for(j = 0; mods[j] != NULL; j++)
+ {
+ if(slapi_ch_array_utf8_inlist(attrs_to_strip, mods[j]->mod_type) == 0){
+ /* at least one of the mods is "real", so don't strip anything */
+ strip = 0;
+ break;
+ }
+ }
+ if(strip){
+ /* free the remaining mods */
+ for(j = 0; mods[j] != NULL; j++)
+ {
+ ber_bvecfree(mods[j]->mod_bvalues);
+ slapi_ch_free((void **)&(mods[j]->mod_type));
+ slapi_ch_free((void **)&mods[j]);
+ }
+ }
+ }
slapi_ch_array_free(a);
}
return retval;
diff --git a/ldap/servers/plugins/replication/repl_globals.c b/ldap/servers/plugins/replication/repl_globals.c
index d2d2318..9445394 100644
--- a/ldap/servers/plugins/replication/repl_globals.c
+++ b/ldap/servers/plugins/replication/repl_globals.c
@@ -127,6 +127,7 @@ const char *type_nsds5ReplicaTimeout = "nsds5ReplicaTimeout";
const char *type_nsds5ReplicaBusyWaitTime = "nsds5ReplicaBusyWaitTime";
const char *type_nsds5ReplicaSessionPauseTime = "nsds5ReplicaSessionPauseTime";
const char *type_nsds5ReplicaEnabled = "nsds5ReplicaEnabled";
+const char *type_nsds5ReplicaStripAttrs = "nsds5ReplicaStripAttrs";
/* windows sync specific attributes */
const char *type_nsds7WindowsReplicaArea = "nsds7WindowsReplicaSubtree";
diff --git a/ldap/servers/slapd/charray.c b/ldap/servers/slapd/charray.c
index 1bb084f..7df9a08 100644
--- a/ldap/servers/slapd/charray.c
+++ b/ldap/servers/slapd/charray.c
@@ -296,6 +296,11 @@ charray_utf8_inlist(
return( 0 );
}
+int slapi_ch_array_utf8_inlist(char **a, char *s)
+{
+ return charray_utf8_inlist(a,s);
+}
+
char **
charray_dup( char **a )
{
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 215773b..659ac61 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5282,6 +5282,15 @@ char ** slapi_ch_array_dup( char **array );
*/
void slapi_ch_array_add( char ***array, char *string );
+/**
+ * Find a string in an array of strings
+ *
+ * \param array The array of strings
+ * \param string The string to look for in the array
+ * \return NULL if there is no match
+ * \return 1 if there is a match
+ */
+int slapi_ch_array_utf8_inlist(char **array, char *string);
/*
* checking routines for allocating and freeing memory
11 years, 11 months
ldap/schema ldap/servers
by Mark Reynolds
ldap/schema/01core389.ldif | 3 -
ldap/servers/plugins/replication/repl5.h | 2
ldap/servers/plugins/replication/repl5_agmt.c | 25 ++++++++
ldap/servers/plugins/replication/repl5_protocol_util.c | 50 ++++++++++++-----
ldap/servers/plugins/replication/repl_globals.c | 1
ldap/servers/slapd/charray.c | 5 +
ldap/servers/slapd/slapi-plugin.h | 9 +++
7 files changed, 80 insertions(+), 15 deletions(-)
New commits:
commit 59ac943dc635817054c82a1d7c904dc01514d96d
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Thu May 17 17:25:06 2012 -0400
Ticket #321 - krbExtraData is being null modified and replicated on each ssh login
Bug Description: When using fractional repl, if you update a attribute that is excluded,
a modify op is still sent to the replicas. The update is basically empty,
except we are still updating these attributes for no reason:
modifiersname
modifyTimestamp
etc
Fix Description: Added a new attribute to the replication agmt: nsds5ReplicaStripAttrs
Add the attributes that you don't want replicated if the mods are "empty".
Separate each attribute by a space:
nsds5ReplicaStripAttrs: modifiersname modifytimestamp
Side Note: Did a little optimization in repl5_strip_fractional_mods() as well.
https://fedorahosted.org/389/ticket/321
Reviewed by:
diff --git a/ldap/schema/01core389.ldif b/ldap/schema/01core389.ldif
index b3df639..def693d 100644
--- a/ldap/schema/01core389.ldif
+++ b/ldap/schema/01core389.ldif
@@ -108,6 +108,7 @@ attributeTypes: ( 2.16.840.1.113730.3.1.808 NAME 'nsds5replicaLastInitEnd' DESC
attributeTypes: ( 2.16.840.1.113730.3.1.809 NAME 'nsds5replicaLastInitStatus' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.1097 NAME 'nsds5replicaBusyWaitTime' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.1098 NAME 'nsds5replicaSessionPauseTime' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2134 NAME 'nsds5ReplicaStripAttrs' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.9999999 NAME 'nsds5debugreplicatimeout' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2064 NAME 'nsSaslMapRegexString' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2065 NAME 'nsSaslMapBaseDNTemplate' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
@@ -153,7 +154,7 @@ objectClasses: ( 2.16.840.1.113730.3.2.110 NAME 'nsMappingTree' DESC 'Netscape d
objectClasses: ( 2.16.840.1.113730.3.2.104 NAME 'nsContainer' DESC 'Netscape defined objectclass' SUP top MUST ( CN ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.108 NAME 'nsDS5Replica' DESC 'Netscape defined objectclass' SUP top MUST ( nsDS5ReplicaRoot $ nsDS5ReplicaId ) MAY (cn $ nsDS5ReplicaType $ nsDS5ReplicaBindDN $ nsState $ nsDS5ReplicaName $ nsDS5Flags $ nsDS5Task $ nsDS5ReplicaReferral $ nsDS5ReplicaAutoReferral $ nsds5ReplicaPurgeDelay $ nsds5ReplicaTombstonePurgeInterval $ nsds5ReplicaChangeCount $ nsds5ReplicaLegacyConsumer) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.113 NAME 'nsTombstone' DESC 'Netscape defined objectclass' SUP top MAY ( nsParentUniqueId $ nscpEntryDN ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.103 NAME 'nsDS5ReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicatedAttributeListTotal $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5ReplicaEnabled $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5replicaSessionPauseTime ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.103 NAME 'nsDS5ReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicatedAttributeListTotal $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5ReplicaEnabled $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5ReplicaStripAttrs $ nsds5replicaSessionPauseTime ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.39 NAME 'nsslapdConfig' DESC 'Netscape defined objectclass' SUP top MAY ( cn ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.317 NAME 'nsSaslMapping' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsSaslMapRegexString $ nsSaslMapBaseDNTemplate $ nsSaslMapFilterTemplate ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.43 NAME 'nsSNMP' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsSNMPEnabled ) MAY ( nsSNMPOrganization $ nsSNMPLocation $ nsSNMPContact $ nsSNMPDescription $ nsSNMPName $ nsSNMPMasterHost $ nsSNMPMasterPort ) X-ORIGIN 'Netscape Directory Server' )
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index 23d9753..d3feeb0 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -156,6 +156,7 @@ extern const char *type_nsds5ReplicaTimeout;
extern const char *type_nsds5ReplicaBusyWaitTime;
extern const char *type_nsds5ReplicaSessionPauseTime;
extern const char *type_nsds5ReplicaEnabled;
+extern const char *type_nsds5ReplicaStripAttrs;
/* Attribute names for windows replication agreements */
extern const char *type_nsds7WindowsReplicaArea;
@@ -356,6 +357,7 @@ void* agmt_get_connection( Repl_Agmt *ra);
int agmt_has_protocol(Repl_Agmt *agmt);
PRBool agmt_is_enabled(Repl_Agmt *ra);
int agmt_set_enabled_from_entry(Repl_Agmt *ra, Slapi_Entry *e);
+char **agmt_get_attrs_to_strip(Repl_Agmt *ra);
typedef struct replica Replica;
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c
index d194acc..4db7e13 100644
--- a/ldap/servers/plugins/replication/repl5_agmt.c
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
@@ -138,6 +138,8 @@ typedef struct repl5agmt {
void *priv; /* private data, used for windows-specific agreement data
for sync agreements or for replication session plug-in
private data for normal replication agreements */
+ char **attrs_to_strip; /* for fractional replication, if a "mod" is empty, strip out these attributes:
+ * modifiersname, modifytimestamp, internalModifiersname, internalModifyTimestamp, etc */
int agreement_type;
} repl5agmt;
@@ -470,6 +472,16 @@ agmt_new_from_entry(Slapi_Entry *e)
slapi_ch_array_free(denied_attrs);
goto loser;
}
+ /*
+ * Extract the attributes to strip for "empty" mods
+ */
+ ra->attrs_to_strip = NULL;
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds5ReplicaStripAttrs);
+ if (NULL != tmpstr)
+ {
+ ra->attrs_to_strip = slapi_str2charray_ext(tmpstr, " ", 0);
+ slapi_ch_free_string(&tmpstr);
+ }
if (!agmt_is_valid(ra))
{
@@ -575,6 +587,10 @@ agmt_delete(void **rap)
windows_agreement_delete(ra);
}
+ if(ra->attrs_to_strip){
+ slapi_ch_array_free(ra->attrs_to_strip);
+ }
+
schedule_destroy(ra->schedule);
slapi_ch_free((void **)&ra->long_name);
slapi_ch_free((void **)rap);
@@ -2540,3 +2556,12 @@ agmt_set_enabled_from_entry(Repl_Agmt *ra, Slapi_Entry *e){
return rc;
}
+char **
+agmt_get_attrs_to_strip(Repl_Agmt *ra)
+{
+ if(ra){
+ return ra->attrs_to_strip;
+ } else {
+ return NULL;
+ }
+}
diff --git a/ldap/servers/plugins/replication/repl5_protocol_util.c b/ldap/servers/plugins/replication/repl5_protocol_util.c
index 732d952..3327405 100644
--- a/ldap/servers/plugins/replication/repl5_protocol_util.c
+++ b/ldap/servers/plugins/replication/repl5_protocol_util.c
@@ -689,25 +689,25 @@ protocol_response2string (int response)
int
repl5_strip_fractional_mods(Repl_Agmt *agmt, LDAPMod ** mods)
{
- int retval = 0;
- int i = 0;
char **a = agmt_get_fractional_attrs(agmt);
+ char **attrs_to_strip;
+ int retval = 0;
+ int strip = 1;
+ int i, j, k;
+
if (a) {
/* Iterate through the fractional attr list */
for ( i = 0; a[i] != NULL; i++ )
{
- char *this_excluded_attr = a[i];
- int j = 0;
-
for ( j = 0; NULL != mods[ j ]; )
{
- /* For each one iterate through the attrs in this mod list */
- /* For any that match, remove the mod */
- LDAPMod *this_mod = mods[j];
- if (0 == slapi_attr_type_cmp(this_mod->mod_type,this_excluded_attr,SLAPI_TYPE_CMP_SUBTYPE))
+ /*
+ * Iterate through the attrs in this mod list.
+ * If any match the fractional attr then remove the mod.
+ */
+ if (0 == slapi_attr_type_cmp(mods[j]->mod_type, a[i], SLAPI_TYPE_CMP_SUBTYPE))
{
/* Move down all subsequent mods */
- int k = 0;
for (k = j; mods[k+1] ; k++)
{
mods[k] = mods[k+1];
@@ -716,15 +716,37 @@ repl5_strip_fractional_mods(Repl_Agmt *agmt, LDAPMod ** mods)
mods[k] = NULL;
/* Adjust value of j, implicit in not incrementing it */
/* Free this mod */
- ber_bvecfree(this_mod->mod_bvalues);
- slapi_ch_free((void **)&(this_mod->mod_type));
- slapi_ch_free((void **)&this_mod);
-
+ ber_bvecfree(mods[j]->mod_bvalues);
+ slapi_ch_free((void **)&(mods[j]->mod_type));
+ slapi_ch_free((void **)&mods[j]);
} else {
j++;
}
}
}
+ /*
+ * Check if "all" the remaining mods are on attributes we want to strip from the update.
+ * If all the mods are on attrs_to_strip, then free them.
+ */
+ if((attrs_to_strip = agmt_get_attrs_to_strip(agmt)) != NULL){
+ for(j = 0; mods[j] != NULL; j++)
+ {
+ if(slapi_ch_array_utf8_inlist(attrs_to_strip, mods[j]->mod_type) == 0){
+ /* at least one of the mods is "real", so don't strip anything */
+ strip = 0;
+ break;
+ }
+ }
+ if(strip){
+ /* free the remaining mods */
+ for(j = 0; mods[j] != NULL; j++)
+ {
+ ber_bvecfree(mods[j]->mod_bvalues);
+ slapi_ch_free((void **)&(mods[j]->mod_type));
+ slapi_ch_free((void **)&mods[j]);
+ }
+ }
+ }
slapi_ch_array_free(a);
}
return retval;
diff --git a/ldap/servers/plugins/replication/repl_globals.c b/ldap/servers/plugins/replication/repl_globals.c
index d2d2318..9445394 100644
--- a/ldap/servers/plugins/replication/repl_globals.c
+++ b/ldap/servers/plugins/replication/repl_globals.c
@@ -127,6 +127,7 @@ const char *type_nsds5ReplicaTimeout = "nsds5ReplicaTimeout";
const char *type_nsds5ReplicaBusyWaitTime = "nsds5ReplicaBusyWaitTime";
const char *type_nsds5ReplicaSessionPauseTime = "nsds5ReplicaSessionPauseTime";
const char *type_nsds5ReplicaEnabled = "nsds5ReplicaEnabled";
+const char *type_nsds5ReplicaStripAttrs = "nsds5ReplicaStripAttrs";
/* windows sync specific attributes */
const char *type_nsds7WindowsReplicaArea = "nsds7WindowsReplicaSubtree";
diff --git a/ldap/servers/slapd/charray.c b/ldap/servers/slapd/charray.c
index 1bb084f..7df9a08 100644
--- a/ldap/servers/slapd/charray.c
+++ b/ldap/servers/slapd/charray.c
@@ -296,6 +296,11 @@ charray_utf8_inlist(
return( 0 );
}
+int slapi_ch_array_utf8_inlist(char **a, char *s)
+{
+ return charray_utf8_inlist(a,s);
+}
+
char **
charray_dup( char **a )
{
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index ec64974..823652a 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5291,6 +5291,15 @@ char ** slapi_ch_array_dup( char **array );
*/
void slapi_ch_array_add( char ***array, char *string );
+/**
+ * Find a string in an array of strings
+ *
+ * \param array The array of strings
+ * \param string The string to look for in the array
+ * \return NULL if there is no match
+ * \return 1 if there is a match
+ */
+int slapi_ch_array_utf8_inlist(char **array, char *string);
/*
* checking routines for allocating and freeing memory
11 years, 11 months
Branch '389-ds-base-1.2.10' - ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/acl/aclparse.c | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit e5bdf55e290dffc07bb6b8a97bef67fce90b21c6
Author: Charles Lopes <clopes(a)amazon.com>
Date: Tue May 8 15:37:59 2012 +0000
Bug #361: Bad DNs in ACIs can segfault ns-slapd
A bad userdn will make the DN normalization fail. This sets dn to NULL,
and the server will attempt to access the NULL dn.
The fix is to just return with an error if the normalization fails since
the DN is invalid.
Reviewed by: rmeggins
(cherry picked from commit 8ba2982457e7d2143ae0c2af212412122592c284)
(cherry picked from commit 58ec62b04fd3696bd77a0610fb8ede58e9fa64d4)
diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c
index 15b373b..39d9f6c 100644
--- a/ldap/servers/plugins/acl/aclparse.c
+++ b/ldap/servers/plugins/acl/aclparse.c
@@ -566,6 +566,11 @@ __aclp__copy_normalized_str (char *src, char *endsrc, char *start,
/* Normalize the value of userdn and append it to ret_str */
slapi_sdn_init_dn_byref(&sdn, p);
dn = slapi_sdn_get_dn(&sdn);
+ /* Normalization failed so return an error (-1) */
+ if (!dn) {
+ slapi_sdn_done(&sdn);
+ return -1;
+ }
/* append up to ldap(s):/// */
aclutil_str_append_ext(dest, destlen, start, p - start);
/* append the DN part */
11 years, 11 months
Branch '389-ds-base-1.2.11' - 2 commits - ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/acl/aclparse.c | 5 +++++
ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
New commits:
commit 58ec62b04fd3696bd77a0610fb8ede58e9fa64d4
Author: Charles Lopes <clopes(a)amazon.com>
Date: Tue May 8 15:37:59 2012 +0000
Bug #361: Bad DNs in ACIs can segfault ns-slapd
A bad userdn will make the DN normalization fail. This sets dn to NULL,
and the server will attempt to access the NULL dn.
The fix is to just return with an error if the normalization fails since
the DN is invalid.
Reviewed by: rmeggins
(cherry picked from commit 8ba2982457e7d2143ae0c2af212412122592c284)
diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c
index 15b373b..39d9f6c 100644
--- a/ldap/servers/plugins/acl/aclparse.c
+++ b/ldap/servers/plugins/acl/aclparse.c
@@ -566,6 +566,11 @@ __aclp__copy_normalized_str (char *src, char *endsrc, char *start,
/* Normalize the value of userdn and append it to ret_str */
slapi_sdn_init_dn_byref(&sdn, p);
dn = slapi_sdn_get_dn(&sdn);
+ /* Normalization failed so return an error (-1) */
+ if (!dn) {
+ slapi_sdn_done(&sdn);
+ return -1;
+ }
/* append up to ldap(s):/// */
aclutil_str_append_ext(dest, destlen, start, p - start);
/* append the DN part */
commit 127afd747e304725763e076de33cd4151544da66
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Thu May 17 11:37:44 2012 -0700
Trac Ticket #338 - letters in object's cn get converted to
lowercase when renaming object
Fix description: In modrdn, if newrdn is different from the oldrdn
only by upper/lower cases, it was ignored in the entryrdn code.
This patch recognizes the change and updates the entryrdn index.
commit b1ed11117e02c0ae670f05f9850b20fd9334d567
(cherry picked from commit 197a8f5c6a4def3915cd07d07602e3ed80b082b0)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
index 5281f22..b548b29 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
@@ -542,7 +542,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;
}
11 years, 11 months