[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication windows_protocol_util.c, 1.22, 1.23

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


Author: rmeggins

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

Modified Files:
	windows_protocol_util.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: windows_protocol_util.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/windows_protocol_util.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- windows_protocol_util.c	20 Oct 2005 17:12:16 -0000	1.22
+++ windows_protocol_util.c	22 Nov 2005 03:40:08 -0000	1.23
@@ -1570,11 +1570,12 @@
 {
 	int retval = 0;
 
-	char *string_deleted = "(isdeleted=*)";
+	char *string_deleted = slapi_ch_strdup("(isdeleted=*)");
 
 	/* DBDB: we should allocate these filters once and keep them around for better performance */
 	Slapi_Filter *filter_deleted = slapi_str2filter( string_deleted );
 	
+    slapi_ch_free_string(&string_deleted);
 	/* DBDB: this should be one filter, the code originally tested separately and hasn't been fixed yet */
 	if ( (slapi_filter_test_simple( e, filter_deleted ) == 0) )
 	{
@@ -2251,9 +2252,10 @@
 		/* Next test for the correct kind of entry */
 		if (local_entry) {
 			/* DBDB: we should allocate these filters once and keep them around for better performance */
-			char *string_filter = "(&(|(objectclass=ntuser)(objectclass=ntgroup))(ntUserDomainId=*))";
+			char *string_filter = slapi_ch_strdup("(&(|(objectclass=ntuser)(objectclass=ntgroup))(ntUserDomainId=*))");
 			Slapi_Filter *filter = slapi_str2filter( string_filter );
 			
+            slapi_ch_free_string(&string_filter);
 			if (slapi_filter_test_simple( (Slapi_Entry*)local_entry, filter ) == 0)
 			{
 				retval = 1;




More information about the Fedora-directory-commits mailing list