diff options
author | Rich Megginson <rmeggins@redhat.com> | 2008-07-14 23:31:33 +0000 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2008-07-14 23:31:33 +0000 |
commit | 58bd25b8ce1ecd09d19aae31f6a989928d0413ed (patch) | |
tree | 06f7b350306514f2ae4716cfd19623a12685fde7 /ldap/servers/plugins/bitwise/bitwise.c | |
parent | f84e6d7b8a3aa8acb7452cd3bf766ee92842b671 (diff) | |
download | ds-58bd25b8ce1ecd09d19aae31f6a989928d0413ed.tar.gz ds-58bd25b8ce1ecd09d19aae31f6a989928d0413ed.tar.xz ds-58bd25b8ce1ecd09d19aae31f6a989928d0413ed.zip |
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
Diffstat (limited to 'ldap/servers/plugins/bitwise/bitwise.c')
-rw-r--r-- | ldap/servers/plugins/bitwise/bitwise.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ldap/servers/plugins/bitwise/bitwise.c b/ldap/servers/plugins/bitwise/bitwise.c index 8116599c..fb70fcfa 100644 --- a/ldap/servers/plugins/bitwise/bitwise.c +++ b/ldap/servers/plugins/bitwise/bitwise.c @@ -167,14 +167,18 @@ bitwise_filter_create (Slapi_PBlock* pb) !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 @@ int /* LDAP error code */ 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 ) { |