[Fedora-directory-commits] ldapserver/ldap/servers/plugins/bitwise bitwise.c, 1.2, 1.3

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Mon Jul 14 23:31:35 UTC 2008


Author: rmeggins

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

Modified Files:
	bitwise.c 
Log Message:
Resolves: bug 428765
Bug Description: leak in bitwise plugin
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: The bitwise plugin should first check to make sure the requested OID is one that it can handle.
Platforms tested: RHEL5, Fedora 8, Fedora 9
Flag Day: no
Doc impact: no



Index: bitwise.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/bitwise/bitwise.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- bitwise.c	18 Oct 2007 00:08:28 -0000	1.2
+++ bitwise.c	14 Jul 2008 23:31:33 -0000	1.3
@@ -167,14 +167,18 @@
 	!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_TYPE, &mrTYPE) && mrTYPE != NULL &&
 	!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_VALUE, &mrVALUE) && mrVALUE != NULL) {
 
-	struct bitwise_match_cb *bmc = new_bitwise_match_cb(mrTYPE, mrVALUE);
-	slapi_pblock_set (pb, SLAPI_PLUGIN_OBJECT, bmc);
-	slapi_pblock_set (pb, SLAPI_PLUGIN_DESTROY_FN, (void*)bitwise_filter_destroy);
+	struct bitwise_match_cb *bmc = NULL;
 	if (strcmp(mrOID, "1.2.840.113556.1.4.803") == 0) {
 	    slapi_pblock_set (pb, SLAPI_PLUGIN_MR_FILTER_MATCH_FN, (void*)bitwise_filter_match_and);
 	} else if (strcmp(mrOID, "1.2.840.113556.1.4.804") == 0) {
 	    slapi_pblock_set (pb, SLAPI_PLUGIN_MR_FILTER_MATCH_FN, (void*)bitwise_filter_match_or);
+	} else { /* this oid not handled by this plugin */
+	    LDAPDebug (LDAP_DEBUG_FILTER, "=> bitwise_filter_create OID (%s) not handled\n", mrOID, 0, 0);
+	    return rc;
 	}
+	bmc = new_bitwise_match_cb(mrTYPE, mrVALUE);
+	slapi_pblock_set (pb, SLAPI_PLUGIN_OBJECT, bmc);
+	slapi_pblock_set (pb, SLAPI_PLUGIN_DESTROY_FN, (void*)bitwise_filter_destroy);
 	rc = LDAP_SUCCESS;
     } else {
 	LDAPDebug (LDAP_DEBUG_FILTER, "=> bitwise_filter_create missing parameter(s)\n", 0, 0, 0);
@@ -190,9 +194,6 @@
 bitwise_init (Slapi_PBlock* pb)
 {
     int rc;
-    int argc;
-    char** argv;
-    char* cfgpath;
 
     rc = slapi_pblock_set (pb, SLAPI_PLUGIN_MR_FILTER_CREATE_FN, (void*)bitwise_filter_create);
     if ( rc == 0 ) {




More information about the Fedora-directory-commits mailing list