[Fedora-directory-commits] ldapserver/ldap/servers/slapd attrlist.c, 1.5, 1.6 entry.c, 1.10, 1.11 proto-slap.h, 1.23, 1.24 slap.h, 1.17, 1.18 slapi-plugin.h, 1.11, 1.12 value.c, 1.4, 1.5 valueset.c, 1.5, 1.6

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Mon Nov 6 20:51:33 UTC 2006


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv14694/servers/slapd

Modified Files:
	attrlist.c entry.c proto-slap.h slap.h slapi-plugin.h value.c 
	valueset.c 
Log Message:
Resolves: #199923
Summary: subtree search fails to find items under a db containing special characters (Comment#16)
Description: When dn contains rdn which includes '\\', it was escaped twice to generate a key for entrydn and caused mismatch in forming ancestorid index.  It ends up the subtree search fail.



Index: attrlist.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/attrlist.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- attrlist.c	25 Aug 2005 00:58:27 -0000	1.5
+++ attrlist.c	6 Nov 2006 20:51:31 -0000	1.6
@@ -289,3 +289,26 @@
     return rc;
 }
 
+/*
+ * attrlist_replace_with_flags - replace the attribute value(s) with this value(s)
+ *
+ * Returns
+ * LDAP_SUCCESS - OK (including the attr not found)
+ * LDAP_OPERATIONS_ERROR - Existing duplicates in attribute.
+ */
+int attrlist_replace_with_flags(Slapi_Attr **alist, const char *type, struct berval **vals, int flags)
+{
+    Slapi_Attr **a = NULL;
+    Slapi_Value **values = NULL;
+    int rc = LDAP_SUCCESS;
+
+    if (vals == NULL || vals[0] == NULL) {
+        (void)attrlist_delete(alist, type);
+    } else {
+        attrlist_find_or_create(alist, type, &a);
+        valuearray_init_bervalarray_with_flags(vals, &values, flags);
+        rc = attr_replace(*a, values);
+    }
+    return rc;
+}
+


Index: entry.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/entry.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- entry.c	25 Aug 2005 00:58:27 -0000	1.10
+++ entry.c	6 Nov 2006 20:51:31 -0000	1.11
@@ -2796,6 +2796,17 @@
 }
 
 int
+entry_replace_values_with_flags(
+    Slapi_Entry		*e,
+    const char		*type,
+    struct berval	**vals,
+    int flags
+)
+{
+    return attrlist_replace_with_flags( &e->e_attrs, type, vals, flags );
+}
+
+int
 slapi_entry_flag_is_set( const Slapi_Entry *e, unsigned char flag )
 {
 	return( e->e_flags & flag );


Index: proto-slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/proto-slap.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- proto-slap.h	6 Nov 2006 19:33:42 -0000	1.23
+++ proto-slap.h	6 Nov 2006 20:51:31 -0000	1.24
@@ -81,6 +81,7 @@
 int attrlist_count_subtypes(Slapi_Attr *a, const char *type);
 Slapi_Attr *attrlist_find_ex( Slapi_Attr *a, const char *type, int *type_name_disposition, char** actual_type_name, void **hint );
 int attrlist_replace(Slapi_Attr **alist, const char *type, struct berval **vals);
+int attrlist_replace_with_flags(Slapi_Attr **alist, const char *type, struct berval **vals, int flags);
 
 /*
  * attrsyntax.c
@@ -121,6 +122,7 @@
  * valueset.c
  */
 int valuearray_init_bervalarray(struct berval **bvals, Slapi_Value ***cvals);
+int valuearray_init_bervalarray_with_flags(struct berval **bvals, Slapi_Value ***cvals, unsigned long flags);
 int valuearray_get_bervalarray(Slapi_Value **cvals, struct berval ***bvals); /* JCM SLOW FUNCTION */
 void valuearray_free(Slapi_Value ***va);
 Slapi_Value *valuearray_remove_value(const Slapi_Attr *a, Slapi_Value **va, const Slapi_Value *v);
@@ -642,6 +644,7 @@
  * modutil.c
  */
 int entry_replace_values( Slapi_Entry *e, const char *type, struct berval **vals );
+int entry_replace_values_with_flags( Slapi_Entry *e, const char *type, struct berval **vals, int flags );
 int entry_apply_mods( Slapi_Entry *e, LDAPMod **mods );
 int entry_apply_mod( Slapi_Entry *e, const LDAPMod *mod );
 void freepmods( LDAPMod **pmods );


Index: slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slap.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- slap.h	6 Nov 2006 19:33:42 -0000	1.17
+++ slap.h	6 Nov 2006 20:51:31 -0000	1.18
@@ -379,6 +379,7 @@
 {
     struct berval bv;
     CSNSet *v_csnset;
+    unsigned long v_flags;
 };
 
 /*


Index: slapi-plugin.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-plugin.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- slapi-plugin.h	17 Aug 2006 15:33:03 -0000	1.11
+++ slapi-plugin.h	6 Nov 2006 20:51:31 -0000	1.12
@@ -61,6 +61,7 @@
 #define SLAPI_ATTR_FLAG_OBSOLETE	0x0040	/* an outdated definition */
 #define SLAPI_ATTR_FLAG_COLLECTIVE	0x0080	/* collective (not supported) */
 #define SLAPI_ATTR_FLAG_NOUSERMOD	0x0100	/* can't be modified over LDAP */
+#define SLAPI_ATTR_FLAG_NORMALIZED	0x0200	/* the attr value is normalized */
 
 /* operation flags */
 #define SLAPI_OP_FLAG_NEVER_CHAIN	0x00800 /* Do not chain the operation */	
@@ -429,6 +430,9 @@
 Slapi_Value *slapi_value_init_string(Slapi_Value *v,const char *s);
 Slapi_Value *slapi_value_init_string_passin(Slapi_Value *v, char *s);
 Slapi_Value *slapi_value_dup(const Slapi_Value *v);
+void slapi_value_set_flags(Slapi_Value *v, unsigned long flags);
+void slapi_values_set_flags(Slapi_Value **vs, unsigned long flags);
+unsigned long slapi_value_get_flags(Slapi_Value *v);
 void slapi_value_free(Slapi_Value **value);
 const struct berval *slapi_value_get_berval( const Slapi_Value *value );
 Slapi_Value *slapi_value_set_berval( Slapi_Value *value, const struct berval *bval );


Index: value.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/value.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- value.c	19 Apr 2005 22:07:37 -0000	1.4
+++ value.c	6 Nov 2006 20:51:31 -0000	1.5
@@ -190,6 +190,30 @@
     return v;
 }
 
+void
+slapi_value_set_flags(Slapi_Value *v, unsigned long flags)
+{
+	PR_ASSERT(v!=NULL);
+	v->v_flags = flags;
+}
+
+void
+slapi_values_set_flags(Slapi_Value **vs, unsigned long flags)
+{
+	PR_ASSERT(vs!=NULL);
+	Slapi_Value **v;
+	for (v = vs; v && *v; v++) {
+		slapi_value_set_flags(*v, flags);
+	}
+}
+
+unsigned long
+slapi_value_get_flags(Slapi_Value *v)
+{
+	PR_ASSERT(v!=NULL);
+	return v->v_flags;
+}
+
 void 
 slapi_value_free(Slapi_Value **v)
 {


Index: valueset.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/valueset.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- valueset.c	25 Aug 2005 00:58:27 -0000	1.5
+++ valueset.c	6 Nov 2006 20:51:31 -0000	1.6
@@ -250,6 +250,36 @@
 /*
  * JCM SLOW FUNCTION
  *
+ * WARNING: Use only if you absolutley need to...
+ * This function mostly exists to map from the old slapi berval
+ * based interface to the new Slapi_Value based interfaces.
+ */
+int
+valuearray_init_bervalarray_with_flags(struct berval **bvals, Slapi_Value ***cvals, unsigned long flags)
+{
+    int n;
+    for(n=0; bvals != NULL && bvals[n] != NULL; n++);
+    if(n==0)
+    {
+        *cvals = NULL;
+    }
+    else
+    {
+        int i;
+        *cvals = (Slapi_Value **) slapi_ch_malloc((n + 1) * sizeof(Slapi_Value *));
+        for(i=0;i<n;i++)
+        {
+            (*cvals)[i] = slapi_value_new_berval(bvals[i]);
+            slapi_value_set_flags((*cvals)[i], flags);
+        }
+        (*cvals)[i] = NULL;
+    }
+    return n;
+}
+
+/*
+ * JCM SLOW FUNCTION
+ *
  * Use only if you absolutley need to...
  * This function mostly exists to map from the old slapi berval
  * based interface to the new Slapi_Value based interfaces.




More information about the Fedora-directory-commits mailing list