Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9536/ldap/servers/slapd
Modified Files:
mapping_tree.c modify.c schema.c slapi-plugin.h
Log Message:
Resolves: 470918
Summary: Made replica_set_updatedn detect value add modify operations properly.
Index: mapping_tree.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/mapping_tree.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- mapping_tree.c 8 Oct 2008 17:29:03 -0000 1.15
+++ mapping_tree.c 13 Nov 2008 23:08:18 -0000 1.16
@@ -1063,7 +1063,7 @@
/* if we are deleting this attribute the new parent
* node will be mapping_tree_root
*/
- if ((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_DELETE)
+ if (SLAPI_IS_MOD_DELETE(mods[i]->mod_op))
{
parent_node = mapping_tree_root;
}
@@ -1153,7 +1153,7 @@
/* state change
* for now only allow replace
*/
- if ((mods[i]->mod_op & ~LDAP_MOD_BVALUES) != LDAP_MOD_REPLACE)
+ if (!SLAPI_IS_MOD_REPLACE(mods[i]->mod_op))
{
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "must use replace
operation to change state\n");
*returncode = LDAP_UNWILLING_TO_PERFORM;
@@ -1206,8 +1206,8 @@
mtn_wlock();
- if (((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_REPLACE)
- || ((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_ADD))
+ if (SLAPI_IS_MOD_REPLACE(mods[i]->mod_op)
+ || SLAPI_IS_MOD_ADD(mods[i]->mod_op))
{
/* delete old referrals, set new ones */
mtn_free_referral_in_node(node);
@@ -1215,7 +1215,7 @@
node->mtn_referral = referral;
node->mtn_referral_entry =
referral2entry(referral, slapi_sdn_get_dn(subtree));
- } else if ((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_DELETE)
+ } else if (SLAPI_IS_MOD_DELETE(mods[i]->mod_op))
{
/* it is not OK to delete the referrals if they are still
* used
@@ -1249,8 +1249,8 @@
else if (strcasecmp(mods[i]->mod_type,
"nsslapd-distribution-funct" ) == 0)
{
- if (((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_REPLACE)
- || ((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_ADD))
+ if (SLAPI_IS_MOD_REPLACE(mods[i]->mod_op)
+ || SLAPI_IS_MOD_ADD(mods[i]->mod_op))
{
slapi_entry_attr_find(entryAfter,
"nsslapd-distribution-funct", &attr);
@@ -1264,7 +1264,7 @@
}
plugin_fct = slapi_ch_strdup(slapi_value_get_string(val));
}
- else if ((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_DELETE)
+ else if (SLAPI_IS_MOD_DELETE(mods[i]->mod_op))
{
plugin_fct = NULL;
}
@@ -1273,8 +1273,8 @@
else if (strcasecmp(mods[i]->mod_type,
"nsslapd-distribution-plugin" ) == 0)
{
- if (((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_REPLACE)
- || ((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_ADD))
+ if (SLAPI_IS_MOD_REPLACE(mods[i]->mod_op)
+ || SLAPI_IS_MOD_ADD(mods[i]->mod_op))
{
slapi_entry_attr_find(entryAfter,
"nsslapd-distribution-plugin", &attr);
@@ -1288,7 +1288,7 @@
}
plugin_lib = slapi_ch_strdup(slapi_value_get_string(val));
}
- else if ((mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_DELETE)
+ else if (SLAPI_IS_MOD_DELETE(mods[i]->mod_op))
{
plugin_lib = NULL;
}
Index: modify.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/modify.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- modify.c 24 Oct 2008 22:36:58 -0000 1.18
+++ modify.c 13 Nov 2008 23:08:18 -0000 1.19
@@ -637,7 +637,7 @@
while ( tmpmods && *tmpmods )
{
if ((*tmpmods)->mod_bvalues != NULL &&
- (((*tmpmods)->mod_op & ~LDAP_MOD_BVALUES) != LDAP_MOD_DELETE))
+ !SLAPI_IS_MOD_DELETE((*tmpmods)->mod_op))
{
for (i=0; i < numattr; i++)
{
Index: schema.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/schema.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- schema.c 15 Jul 2008 16:49:42 -0000 1.16
+++ schema.c 13 Nov 2008 23:08:18 -0000 1.17
@@ -1681,7 +1681,7 @@
/*
* Delete an objectclass or attribute
*/
- if ( (mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_DELETE) {
+ if (SLAPI_IS_MOD_DELETE(mods[i]->mod_op)) {
if (strcasecmp (mods[i]->mod_type, "objectclasses") == 0) {
*returncode = schema_delete_objectclasses (entryBefore, mods[i],
returntext, SLAPI_DSE_RETURNTEXT_SIZE, schema_ds4x_compat );
@@ -1707,7 +1707,7 @@
/*
* Replace an objectclass,attribute, or schema CSN
*/
- else if ( (mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_REPLACE) {
+ else if (SLAPI_IS_MOD_REPLACE(mods[i]->mod_op)) {
int replace_allowed = 0;
slapdFrontendConfig_t *slapdFrontendConfig;
@@ -1777,7 +1777,7 @@
/*
* Add an objectclass or attribute
*/
- else if ( (mods[i]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_ADD) {
+ else if (SLAPI_IS_MOD_ADD(mods[i]->mod_op)) {
if (strcasecmp (mods[i]->mod_type, "attributetypes") == 0) {
/*
* Add a new attribute
Index: slapi-plugin.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-plugin.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- slapi-plugin.h 5 Nov 2008 18:21:06 -0000 1.34
+++ slapi-plugin.h 13 Nov 2008 23:08:18 -0000 1.35
@@ -1897,6 +1897,10 @@
/* Size of the database, in kilobytes */
#define SLAPI_DBSIZE 199
+/* convenience macros for checking modify operation types */
+#define SLAPI_IS_MOD_ADD(x) (((x) & ~LDAP_MOD_BVALUES) == LDAP_MOD_ADD)
+#define SLAPI_IS_MOD_DELETE(x) (((x) & ~LDAP_MOD_BVALUES) == LDAP_MOD_DELETE)
+#define SLAPI_IS_MOD_REPLACE(x) (((x) & ~LDAP_MOD_BVALUES) == LDAP_MOD_REPLACE)
#ifdef __cplusplus
}