[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm ldbm_delete.c, 1.4, 1.5
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17627
Modified Files:
ldbm_delete.c
Log Message:
165862 - Needed to set BE_INDEX_EQUALITY flag when doing a delete of an entry.
Index: ldbm_delete.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldbm_delete.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ldbm_delete.c 19 Apr 2005 22:07:38 -0000 1.4
+++ ldbm_delete.c 12 Aug 2005 22:52:29 -0000 1.5
@@ -401,7 +401,7 @@
}
}
/* delete from attribute indexes */
- addordel_flags = BE_INDEX_DEL|BE_INDEX_PRESENCE;
+ addordel_flags = BE_INDEX_DEL|BE_INDEX_PRESENCE|BE_INDEX_EQUALITY;
if (delete_tombstone_entry)
{
addordel_flags |= BE_INDEX_TOMBSTONE; /* tell index code we are deleting a tombstone */
18 years, 8 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm index.c, 1.6, 1.7
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13302
Modified Files:
index.c
Log Message:
Bug(s) fixed: 165827
Bug Description: Daily Acceptance: Directory Install failed to register Directory server as a Red Hat server (81)
Reviewed by: Nathan (Thanks!)
Fix Description: The index code, in the replace case, was not checking to see if there were
actually any values to delete before attempting to delete them. This fix just
checks to see if there are any values to delete.
Platforms tested: RHEL3
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing with the new indexing tests
New Tests integrated into TET: none
Index: index.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/index.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- index.c 12 Aug 2005 05:49:55 -0000 1.6
+++ index.c 12 Aug 2005 19:07:37 -0000 1.7
@@ -550,10 +550,12 @@
}
/* We need to first remove the old values from the
- * index. */
+ * index, if any. */
+ if (deleted_valueArray) {
index_addordel_values_sv( be, mods[i]->mod_type,
deleted_valueArray, evals, id,
flags, txn );
+ }
/* Free valuearray */
slapi_valueset_free(mod_vals);
18 years, 8 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd libslapd.def, 1.11, 1.12 slapi-private.h, 1.8, 1.9
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25560
Modified Files:
libslapd.def slapi-private.h
Log Message:
164843 - Modified indexing to deal with attribute subtypes
Index: libslapd.def
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/libslapd.def,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- libslapd.def 19 Apr 2005 22:07:36 -0000 1.11
+++ libslapd.def 12 Aug 2005 05:49:54 -0000 1.12
@@ -1056,6 +1056,7 @@
slapi_entry_delete_values_sv @1058
slapi_entry_attr_replace_sv @1059
+ valuearray_find @1060
valuearray_free @1061
slapd_Client_auth @1062
slapi_rand_r @1063
Index: slapi-private.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-private.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- slapi-private.h 19 Apr 2005 22:07:37 -0000 1.8
+++ slapi-private.h 12 Aug 2005 05:49:54 -0000 1.9
@@ -778,6 +778,7 @@
void valuearray_add_value_fast(Slapi_Value ***vals, Slapi_Value *addval, int nvals, int *maxvals, int exact, int passin);
void valuearray_add_valuearray( Slapi_Value ***vals, Slapi_Value **addvals, PRUint32 flags );
void valuearray_add_valuearray_fast( Slapi_Value ***vals, Slapi_Value **addvals, int nvals, int naddvals, int *maxvals, int exact, int passin );
+int valuearray_find(const Slapi_Attr *a, Slapi_Value **va, const Slapi_Value *v);
/******************************************************************************
18 years, 8 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm back-ldbm.h, 1.5, 1.6 index.c, 1.5, 1.6
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25560/back-ldbm
Modified Files:
back-ldbm.h index.c
Log Message:
164843 - Modified indexing to deal with attribute subtypes
Index: back-ldbm.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/back-ldbm.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- back-ldbm.h 25 Apr 2005 16:24:23 -0000 1.5
+++ back-ldbm.h 12 Aug 2005 05:49:55 -0000 1.6
@@ -637,6 +637,7 @@
#define BE_INDEX_PRESENCE 4 /* (w/DEL) remove the presence index */
#define BE_INDEX_TOMBSTONE 8 /* Index entry as a tombstone */
#define BE_INDEX_DONT_ENCRYPT 16 /* Disable any encryption if this flag is set */
+#define BE_INDEX_EQUALITY 32 /* (w/DEL) remove the equality index */
/* Name of attribute type used for binder-based look through limit */
#define LDBM_LOOKTHROUGHLIMIT_AT "nsLookThroughLimit"
Index: index.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/index.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- index.c 19 Apr 2005 22:07:38 -0000 1.5
+++ index.c 12 Aug 2005 05:49:55 -0000 1.6
@@ -453,35 +453,118 @@
)
{
int rc = 0;
- int i;
- Slapi_Attr *attr;
+ int i, j;
ID id = olde->ep_id;
- Slapi_Value **svals = NULL;
+ int flags = 0;
+ char buf[SLAPD_TYPICAL_ATTRIBUTE_NAME_MAX_LENGTH];
+ char *basetype = NULL;
+ char *tmp = NULL;
+ Slapi_Attr *curr_attr = NULL;
+ Slapi_ValueSet *all_vals = NULL;
+ Slapi_ValueSet *mod_vals = NULL;
+ Slapi_Value **evals = NULL; /* values that still exist after a
+ * delete.
+ */
+ Slapi_Value **mods_valueArray = NULL; /* values that are specified in this
+ * operation.
+ */
+ Slapi_Value **deleted_valueArray = NULL; /* values whose index entries
+ * should be deleted.
+ */
for ( i = 0; mods[i] != NULL; i++ ) {
+ /* Get base attribute type */
+ basetype = buf;
+ tmp = slapi_attr_basetype(mods[i]->mod_type, buf, sizeof(buf));
+ if(tmp != NULL) {
+ basetype = tmp; /* basetype was malloc'd */
+ }
+
+ /* Get a list of all remaining values for the base type
+ * and any present subtypes.
+ */
+ all_vals = slapi_valueset_new();
+
+ for (curr_attr = newe->ep_entry->e_attrs; curr_attr != NULL; curr_attr = curr_attr->a_next) {
+ if (slapi_attr_type_cmp( basetype, curr_attr->a_type, SLAPI_TYPE_CMP_BASE ) == 0) {
+ valueset_add_valuearray(all_vals, attr_get_present_values(curr_attr));
+ }
+ }
+
+ evals = valueset_get_valuearray(all_vals);
+
+ /* Get a list of all values specified in the operation.
+ */
+ if ( mods[i]->mod_bvalues != NULL ) {
+ valuearray_init_bervalarray(mods[i]->mod_bvalues,
+ &mods_valueArray);
+ }
+
switch ( mods[i]->mod_op & ~LDAP_MOD_BVALUES ) {
case LDAP_MOD_REPLACE:
+ flags = BE_INDEX_DEL;
+ /* Get a list of all values being deleted.
+ */
+ mod_vals = slapi_valueset_new();
+
+ for (curr_attr = olde->ep_entry->e_attrs; curr_attr != NULL; curr_attr = curr_attr->a_next) {
+ if (slapi_attr_type_cmp( mods[i]->mod_type, curr_attr->a_type, SLAPI_TYPE_CMP_EXACT ) == 0) {
+ valueset_add_valuearray(mod_vals, attr_get_present_values(curr_attr));
+ }
+ }
+
+ deleted_valueArray = valueset_get_valuearray(mod_vals);
+
+ /* If subtypes exist, don't remove the presence
+ * index.
+ */
+ if ( evals != NULL && deleted_valueArray != NULL) {
+ /* evals will contain the new value that is being
+ * added as part of the replace operation if one
+ * was specified. We must remove this value from
+ * evals to know if any subtypes are present.
+ */
+ slapi_entry_attr_find( olde->ep_entry, mods[i]->mod_type, &curr_attr );
+ if ( mods_valueArray != NULL ) {
+ for ( j = 0; mods_valueArray[j] != NULL; j++ ) {
+ valuearray_remove_value(curr_attr, evals, mods_valueArray[j]);
+ }
+ }
+
+ /* Search evals for the values being deleted. If
+ * they don't exist, delete the equality index.
+ */
+ for ( j = 0; deleted_valueArray[j] != NULL; j++ ) {
+ if (valuearray_find(curr_attr, evals, deleted_valueArray[j]) == -1) {
+ if (!(flags & BE_INDEX_EQUALITY)) {
+ flags |= BE_INDEX_EQUALITY;
+ }
+ } else {
+ /* Remove duplicate value from deleted value array */
+ valuearray_remove_value(curr_attr, deleted_valueArray, deleted_valueArray[j]);
+ j--;
+ }
+ }
+ } else {
+ flags |= BE_INDEX_PRESENCE|BE_INDEX_EQUALITY;
+ }
+
/* We need to first remove the old values from the
* index. */
- if ( slapi_entry_attr_find( olde->ep_entry, mods[i]->mod_type, &attr ) == 0 &&
- (svals = attr_get_present_values(attr)) != NULL ) {
index_addordel_values_sv( be, mods[i]->mod_type,
- svals, NULL, id,
- BE_INDEX_DEL|BE_INDEX_PRESENCE,
- txn );
- }
+ deleted_valueArray, evals, id,
+ flags, txn );
+
+ /* Free valuearray */
+ slapi_valueset_free(mod_vals);
case LDAP_MOD_ADD:
- if ( mods[i]->mod_bvalues == NULL ) {
+ if ( mods_valueArray == NULL ) {
rc = 0;
} else {
- Slapi_Value **mods_valueArray = NULL;
- valuearray_init_bervalarray(mods[i]->mod_bvalues,
- &mods_valueArray);
rc = index_addordel_values_sv( be,
mods[i]->mod_type,
mods_valueArray, NULL,
id, BE_INDEX_ADD, txn );
- valuearray_free(&mods_valueArray);
}
break;
@@ -489,44 +572,88 @@
if ( (mods[i]->mod_bvalues == NULL) ||
(mods[i]->mod_bvalues[0] == NULL) ) {
rc = 0;
- /* if no value are specified all the values will
- * be suppressed -> remove the presence index
+ flags = BE_INDEX_DEL;
+
+ /* Get a list of all values that are being
+ * deleted.
*/
- if ( slapi_entry_attr_find( olde->ep_entry, mods[i]->mod_type, &attr ) == 0 &&
- (svals = attr_get_present_values(attr)) != NULL ) {
- index_addordel_values_sv( be, mods[i]->mod_type,
- svals, NULL, id, BE_INDEX_DEL|BE_INDEX_PRESENCE, txn);
+ mod_vals = slapi_valueset_new();
+
+ for (curr_attr = olde->ep_entry->e_attrs; curr_attr != NULL; curr_attr = curr_attr->a_next) {
+ if (slapi_attr_type_cmp( mods[i]->mod_type, curr_attr->a_type, SLAPI_TYPE_CMP_EXACT ) == 0) {
+ valueset_add_valuearray(mod_vals, attr_get_present_values(curr_attr));
+ }
+ }
+
+ deleted_valueArray = valueset_get_valuearray(mod_vals);
+
+ /* If subtypes exist, don't remove the
+ * presence index.
+ */
+ if (evals != NULL) {
+ for (curr_attr = newe->ep_entry->e_attrs; (curr_attr != NULL);
+ curr_attr = curr_attr->a_next) {
+ if (slapi_attr_type_cmp( basetype, curr_attr->a_type, SLAPI_TYPE_CMP_BASE ) == 0) {
+ /* Check if the any values being deleted
+ * also exist in a subtype.
+ */
+ for ( j=0; deleted_valueArray[j] != NULL; j++) {
+ if ( valuearray_find(curr_attr, evals, deleted_valueArray[j]) == -1 ) {
+ /* If the equality flag isn't already set, set it */
+ if (!(flags & BE_INDEX_EQUALITY)) {
+ flags |= BE_INDEX_EQUALITY;
+ }
+ } else {
+ /* Remove duplicate value from the mod list */
+ valuearray_remove_value(curr_attr, deleted_valueArray, deleted_valueArray[j]);
+ j--;
+ }
+ }
+ }
+ }
+ } else {
+ flags = BE_INDEX_DEL|BE_INDEX_PRESENCE|BE_INDEX_EQUALITY;
}
+
+ /* Update the index */
+ index_addordel_values_sv( be, mods[i]->mod_type,
+ deleted_valueArray, evals, id, flags, txn);
+
+ slapi_valueset_free(mod_vals);
} else {
+
/* determine if the presence key should be
* removed (are we removing the last value
* for this attribute?)
*/
- int flags = BE_INDEX_DEL;
- Slapi_Value ** svals = NULL;
- Slapi_Value **mods_valueArray = NULL;
-
- valuearray_init_bervalarray(mods[i]->mod_bvalues,
- &mods_valueArray);
-
- if (slapi_entry_attr_find(newe->ep_entry,
- mods[i]->mod_type, &attr) == 0) {
- svals = attr_get_present_values(attr);
+ if (evals == NULL || evals[0] == NULL) {
+ flags = BE_INDEX_DEL|BE_INDEX_PRESENCE;
+ } else {
+ flags = BE_INDEX_DEL;
}
- if (svals == NULL || svals[0] == NULL) {
- flags |= BE_INDEX_PRESENCE;
- }
+ /* If the same value doesn't exist in a subtype, set
+ * BE_INDEX_EQUALITY flag so the equality index is
+ * removed.
+ */
+ slapi_entry_attr_find( olde->ep_entry, mods[i]->mod_type, &curr_attr);
+ if ( valuearray_find(curr_attr, evals, mods_valueArray[i]) == -1 ) {
+ flags |= BE_INDEX_EQUALITY;
+ }
- rc = index_addordel_values_sv( be, mods[i]->mod_type,
+ rc = index_addordel_values_sv( be, basetype,
mods_valueArray,
- svals, id, flags, txn );
- valuearray_free(&mods_valueArray);
+ evals, id, flags, txn );
}
rc = 0;
break;
}
+ /* free memory */
+ slapi_ch_free((void **)&tmp);
+ valuearray_free(&mods_valueArray);
+ slapi_valueset_free(all_vals);
+
if ( rc != 0 ) {
ldbm_nasty(errmsg, 1040, rc);
return( rc );
@@ -1595,7 +1722,11 @@
/*
* equality index entry
*/
- if ( ai->ai_indexmask & INDEX_EQUALITY ) {
+ if (( ai->ai_indexmask & INDEX_EQUALITY ) &&
+ (flags & (BE_INDEX_ADD|BE_INDEX_EQUALITY))) {
+ /* on delete, only remove the equality index if the
+ * BE_INDEX_EQUALITY flag is set.
+ */
slapi_call_syntax_values2keys_sv( ai->ai_plugin, vals, &ivals,
LDAP_FILTER_EQUALITY );
18 years, 8 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/views views.c, 1.5, 1.6
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/views
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6565/ldapserver/ldap/servers/plugins/views
Modified Files:
views.c
Log Message:
Bug(s) fixed: 165640
Bug Description: Directory Server crashes when deleting a view
Reviewed by: Nathan (Thanks!)
Fix Description: Needed to pass in the _address_ of theCache.pCacheViews to views_cache_add_ll_entry. Yet another lesson in using the compiler to catch type errors rather than casting to void*.
Platforms tested: RHEL3
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
Index: views.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/views/views.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- views.c 19 Apr 2005 22:07:36 -0000 1.5
+++ views.c 11 Aug 2005 16:45:04 -0000 1.6
@@ -1529,7 +1529,7 @@
theView->parentid = 0;
/* add view to the cache */
- views_cache_add_ll_entry((void**)theCache.pCacheViews, (void *)theView);
+ views_cache_add_ll_entry((void**)&theCache.pCacheViews, (void *)theView);
views_cache_discover_parent(theView);
if(theView->pParent)
18 years, 8 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/uiduniq 7bit.c, 1.5, 1.6
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/uiduniq
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9879
Modified Files:
7bit.c
Log Message:
Bug(s) fixed: 165600
Bug Description: Adding multiple attributes using a single ldapmodify crashes ns-slapd
Reviewed by: Nathan (Thanks!)
Fix Description: In C, the array '[]' dereference operator takes precedence over the '*' deref operator. In this case, I needed to put parentheses around the pointer dereference to avoid having array dereferenced first. modary is a pointer to an array, not an array, so I can't dereference it with the array operator until I first dereference the pointer.
Platforms tested: RHEL3
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
Index: 7bit.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/uiduniq/7bit.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- 7bit.c 19 Apr 2005 22:07:35 -0000 1.5
+++ 7bit.c 10 Aug 2005 20:56:35 -0000 1.6
@@ -344,7 +344,7 @@
*modary = (LDAPMod **)slapi_ch_malloc(*capacity * sizeof(LDAPMod *));
}
}
- *modary[*nmods] = toadd;
+ (*modary)[*nmods] = toadd;
(*nmods)++;
}
18 years, 8 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/uiduniq uid.c, 1.6, 1.7
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/uiduniq
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9391
Modified Files:
uid.c
Log Message:
164017 - Attribute uniqueness plugin now only checks for conflicts in subtrees that the operation applies to
Index: uid.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/uiduniq/uid.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- uid.c 19 Apr 2005 22:07:35 -0000 1.6
+++ uid.c 1 Aug 2005 18:05:27 -0000 1.7
@@ -383,8 +383,14 @@
*/
for(;argc > 0;argc--,argv++)
{
- result = search(*argv, attrName, attr, values, dn);
- if (result) break;
+ /*
+ * The DN should already be normalized, so we don't have to
+ * worry about that here.
+ */
+ if (slapi_dn_issuffix(dn, *argv)) {
+ result = search(*argv, attrName, attr, values, dn);
+ if (result) break;
+ }
}
return result;
}
18 years, 9 months