summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2008-07-02 18:15:22 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2008-07-02 18:15:22 +0000
commit0ff7a87e2212bbcbca7ce2435030765ebe2d9e71 (patch)
tree70c40f2dbd27b5625bbcd4bc1ebf31cd097fd3f7
parent326df84b4cbc89587fc41dc17f1caf622b70c8c3 (diff)
downloadds-0ff7a87e2212bbcbca7ce2435030765ebe2d9e71.tar.gz
ds-0ff7a87e2212bbcbca7ce2435030765ebe2d9e71.tar.xz
ds-0ff7a87e2212bbcbca7ce2435030765ebe2d9e71.zip
Resoves: #428929
Summary: Directory server is caching string case for attributes with Directorystring syntax even after deletion Description: Introduced a new flag SLAPI_VALUE_FLAG_USENEWVALUE for valueset_remove_valuearr to exchange the value in the deleted value set and the to be added value. With this change, the newly added value is resurrected instead of the original value.
-rw-r--r--ldap/servers/slapd/entrywsi.c5
-rw-r--r--ldap/servers/slapd/slapi-plugin.h2
-rw-r--r--ldap/servers/slapd/valueset.c41
3 files changed, 42 insertions, 6 deletions
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index 53a5fa3e..9923f57f 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -497,7 +497,10 @@ entry_add_present_values_wsi(Slapi_Entry *e, const char *type, struct berval **b
break;
}
/* Check if any of the values to be added are on the deleted list */
- valueset_remove_valuearray(&a->a_deleted_values, a, valuestoadd, SLAPI_VALUE_FLAG_IGNOREERROR,&deletedvalues); /* JCM Check return code */
+ valueset_remove_valuearray(&a->a_deleted_values,
+ a, valuestoadd,
+ SLAPI_VALUE_FLAG_IGNOREERROR|SLAPI_VALUE_FLAG_USENEWVALUE,
+ &deletedvalues); /* JCM Check return code */
if(deletedvalues!=NULL && deletedvalues[0]!=NULL)
{
/* Some of the values to be added were on the deleted list */
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 92cac83c..e7d982f7 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -470,6 +470,8 @@ int slapi_value_compare(const Slapi_Attr *a,const Slapi_Value *v1,const Slapi_Va
#define SLAPI_VALUE_FLAG_PASSIN 0x1
#define SLAPI_VALUE_FLAG_IGNOREERROR 0x2
#define SLAPI_VALUE_FLAG_PRESERVECSNSET 0x4
+#define SLAPI_VALUE_FLAG_USENEWVALUE 0x8 /* see valueset_remove_valuearray */
+
Slapi_ValueSet *slapi_valueset_new( void );
void slapi_valueset_free(Slapi_ValueSet *vs);
void slapi_valueset_init(Slapi_ValueSet *vs);
diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
index 1e6e70ed..61e0724f 100644
--- a/ldap/servers/slapd/valueset.c
+++ b/ldap/servers/slapd/valueset.c
@@ -1053,6 +1053,16 @@ valueset_update_csn(Slapi_ValueSet *vs, CSNType t, const CSN *csn)
* Remove an array of values from a value set.
* The removed values are passed back in an array.
*
+ * Flags
+ * SLAPI_VALUE_FLAG_PRESERVECSNSET - csnset in the value set is duplicated and
+ * preserved in the matched element of the
+ * array of values.
+ * SLAPI_VALUE_FLAG_IGNOREERROR - ignore an error: Couldn't find the value to
+ * be deleted.
+ * SLAPI_VALUE_FLAG_USENEWVALUE - replace the value between the value set and
+ * the matched element of the array of values
+ * (used by entry_add_present_values_wsi).
+ *
* Returns
* LDAP_SUCCESS - OK.
* LDAP_NO_SUCH_ATTRIBUTE - A value to be deleted was not in the value set.
@@ -1110,12 +1120,23 @@ valueset_remove_valuearray(Slapi_ValueSet *vs, const Slapi_Attr *a, Slapi_Value
/* Move the value to be removed to the out array */
if ( va_out )
{
- if (vs->va[index]->v_csnset && (flags & SLAPI_VALUE_FLAG_PRESERVECSNSET))
+ if (vs->va[index]->v_csnset &&
+ (flags & SLAPI_VALUE_FLAG_PRESERVECSNSET|
+ SLAPI_VALUE_FLAG_USENEWVALUE))
{
valuestodelete[i]->v_csnset = csnset_dup (vs->va[index]->v_csnset);
}
- valuearrayfast_add_value_passin(&vaf_out,vs->va[index]);
- vs->va[index] = NULL;
+ if (flags & SLAPI_VALUE_FLAG_USENEWVALUE)
+ {
+ valuearrayfast_add_value_passin(&vaf_out,valuestodelete[i]);
+ valuestodelete[i] = vs->va[index];
+ vs->va[index] = NULL;
+ }
+ else
+ {
+ valuearrayfast_add_value_passin(&vaf_out,vs->va[index]);
+ vs->va[index] = NULL;
+ }
}
else
{
@@ -1170,11 +1191,21 @@ valueset_remove_valuearray(Slapi_ValueSet *vs, const Slapi_Attr *a, Slapi_Value
{
if ( va_out )
{
- if (found->v_csnset && (flags & SLAPI_VALUE_FLAG_PRESERVECSNSET))
+ if (found->v_csnset &&
+ (flags & SLAPI_VALUE_FLAG_PRESERVECSNSET|
+ SLAPI_VALUE_FLAG_USENEWVALUE))
{
valuestodelete[i]->v_csnset = csnset_dup (found->v_csnset);
}
- valuearrayfast_add_value_passin(&vaf_out,found);
+ if (flags & SLAPI_VALUE_FLAG_USENEWVALUE)
+ {
+ valuearrayfast_add_value_passin(&vaf_out,valuestodelete[i]);
+ valuestodelete[i] = found;
+ }
+ else
+ {
+ valuearrayfast_add_value_passin(&vaf_out,found);
+ }
}
else
{