[Fedora-directory-commits] ldapserver/ldap/servers/plugins/cos cos_cache.c, 1.7, 1.8

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Fri Oct 12 18:03:45 UTC 2007


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/cos
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27588/plugins/cos

Modified Files:
	cos_cache.c 
Log Message:
Resolves: #193724
Summary: "nested" filtered roles result in deadlock (Comment #12)
Description:
1. Changed cache_lock to the read-write lock.
2. Instead of using the local vattr_context in vattr_test_filter, use the one
set in pblock as much as possible.  To achieve the goal, introduced
pb_vattr_context to pblock.
3. Increased VATTR_LOOP_COUNT_MAX from 50 to 256.
4. When the loop count hit VATTR_LOOP_COUNT_MAX, it sets
LDAP_UNWILLING_TO_PERFORM and returns it to the client.



Index: cos_cache.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/cos/cos_cache.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cos_cache.c	10 Nov 2006 23:44:56 -0000	1.7
+++ cos_cache.c	12 Oct 2007 18:03:43 -0000	1.8
@@ -2222,6 +2222,7 @@
 	returns 
 		0 on success, we added a computed attribute
 		1 on outright failure
+		> LDAP ERROR CODE
 		-1 when doesn't know about attribute
 
 	{PARPAR} must also check the attribute does not exist if we are not
@@ -2392,10 +2393,14 @@
 					int free_flags = 0;
 
 					if(pSpec && pSpec->val) {
-						slapi_vattr_values_get_sp(context, e, pSpec->val, &pAttrSpecs, &type_name_disposition, &actual_type_name, 0, &free_flags);
+						ret = slapi_vattr_values_get_sp(context, e, pSpec->val, &pAttrSpecs, &type_name_disposition, &actual_type_name, 0, &free_flags);
 						/* MAB: We need to free actual_type_name here !!! 
 						XXX BAD--should use slapi_vattr_values_free() */	
 						slapi_ch_free((void **) &actual_type_name);
+						if (SLAPI_VIRTUALATTRS_LOOP_DETECTED == ret) {
+							ret = LDAP_UNWILLING_TO_PERFORM;
+							goto bail;
+						}
 					}
 
 					if(pAttrSpecs || pDef->cosType == COSTYPE_POINTER)
@@ -2548,6 +2553,8 @@
 		ret = 1;
 	else if(hit == 1)
 		ret = 0;
+	else
+		ret = -1;
 
 	if(props)
 		*props = 0;




More information about the Fedora-directory-commits mailing list