[Fedora-directory-commits] ldapserver/ldap/servers/plugins/views views.c, 1.6, 1.7

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Tue Nov 22 03:40:21 UTC 2005


Author: rmeggins

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

Modified Files:
	views.c 
Log Message:
Cannot pass const strings into slapi_str2filter, since it can modify
the contents.  I'm not sure why we haven't caught this earlier, but
I believe it has something to do with the patch to make ds build on
Fedora Core 4 with gcc4.  To do that, we turn off the -fwriteable-strings
argument to gcc.  I suppose with it on, it moves those strings to
some sort of writeable memory location.  With it off, constant strings
are definitely in the data section.  There was one place in views that
used a constant string, and a couple of places in the windows sync code.



Index: views.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/views/views.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- views.c	11 Aug 2005 16:45:04 -0000	1.6
+++ views.c	22 Nov 2005 03:40:14 -0000	1.7
@@ -735,6 +735,7 @@
 	Slapi_Filter *pCurrentFilter = 0;
 	Slapi_Filter *pBuiltFilter = 0;
 	Slapi_Filter *pViewEntryExcludeFilter = 0;
+    char *excludeFilter;
 
 	if(pView->includeAncestorFiltersFilter)
 	{
@@ -769,7 +770,11 @@
 	}
 
 	/* filter for removing view entries from search */
-	pViewEntryExcludeFilter = slapi_str2filter( "(!(objectclass=" VIEW_OBJECTCLASS "))" );
+    /* richm - slapi_str2filter _writes_ to it's argument, so we have to pass in 
+       some writeable memory, or core dump, do not pass go */
+    excludeFilter = slapi_ch_strdup("(!(objectclass=" VIEW_OBJECTCLASS "))");
+	pViewEntryExcludeFilter = slapi_str2filter( excludeFilter );
+    slapi_ch_free_string(&excludeFilter);
 
 	if(pBuiltFilter)
 		pView->includeAncestorFiltersFilter = slapi_filter_join_ex( LDAP_FILTER_AND, pBuiltFilter, pViewEntryExcludeFilter, 0 );




More information about the Fedora-directory-commits mailing list