summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/mep/mep.c
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2010-09-14 21:06:13 -0400
committerNathan Kinder <nkinder@redhat.com>2010-09-17 12:14:12 -0700
commit2a267dc9c52ff4f641a6045e6c481ea881010975 (patch)
tree4e23b1e3c2670698e47da0e2ee95501a1daea3a6 /ldap/servers/plugins/mep/mep.c
parent019789548c33ec6155a0cbebfe81c58bac4d1ed8 (diff)
downloadds-2a267dc9c52ff4f641a6045e6c481ea881010975.tar.gz
ds-2a267dc9c52ff4f641a6045e6c481ea881010975.tar.xz
ds-2a267dc9c52ff4f641a6045e6c481ea881010975.zip
Bug 630092 - Coverity #15479: Resource leaks issues
https://bugzilla.redhat.com/show_bug.cgi?id=630092 Description: The mep_pre_op() is correctly allocating and releasing smods during modify operation. However, the "else" clause on line 1517 theoretically allows other operations to enter and cause resource leak. The code has been modified to reject other operations from operating against the config entries.
Diffstat (limited to 'ldap/servers/plugins/mep/mep.c')
-rw-r--r--ldap/servers/plugins/mep/mep.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
index 72af4288..cb329e44 100644
--- a/ldap/servers/plugins/mep/mep.c
+++ b/ldap/servers/plugins/mep/mep.c
@@ -1514,7 +1514,8 @@ mep_pre_op(Slapi_PBlock * pb, int modop)
if (LDAP_CHANGETYPE_ADD == modop) {
slapi_pblock_get(pb, SLAPI_ADD_ENTRY, &e);
- } else {
+
+ } else if (LDAP_CHANGETYPE_MODIFY == modop) {
/* Fetch the entry being modified so we can
* create the resulting entry for validation. */
Slapi_DN *tmp_dn = slapi_sdn_new_dn_byref(dn);
@@ -1541,6 +1542,12 @@ mep_pre_op(Slapi_PBlock * pb, int modop)
* to let the main server handle it. */
goto bailmod;
}
+
+ } else {
+ /* Refuse other operations. */
+ ret = LDAP_UNWILLING_TO_PERFORM;
+ errstr = slapi_ch_smprintf("Not a valid operation.");
+ goto bail;
}
if (mep_parse_config_entry(e, 0) != 0) {