diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-07-06 12:25:23 -0500 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-23 17:08:22 -0700 |
commit | 64a05c243f6f116ba00c05453d57488dd98c745e (patch) | |
tree | 8b3ada7c2a1bcb053694693fafdf3747951b195c | |
parent | ecaf325734a2795cb3d841f513a0c7c775e0aca9 (diff) | |
download | ds-64a05c243f6f116ba00c05453d57488dd98c745e.tar.gz ds-64a05c243f6f116ba00c05453d57488dd98c745e.tar.xz ds-64a05c243f6f116ba00c05453d57488dd98c745e.zip |
Bug 611790 - fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166
https://bugzilla.redhat.com/show_bug.cgi?id=611790
Resolves: bug 611790
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166
description: Catch possible NULL pointer in roles_cache_update() and roles_is_entry_member_of_object_ext().
-rw-r--r-- | ldap/servers/plugins/roles/roles_cache.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/ldap/servers/plugins/roles/roles_cache.c b/ldap/servers/plugins/roles/roles_cache.c index 07d22d0c..838ae271 100644 --- a/ldap/servers/plugins/roles/roles_cache.c +++ b/ldap/servers/plugins/roles/roles_cache.c @@ -614,10 +614,17 @@ static int roles_cache_update(roles_cache_def *suffix_to_update) operation = suffix_to_update->notified_operation; entry = suffix_to_update->notified_entry; + dn = slapi_sdn_new(); + if (!dn) { + slapi_log_error( SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "Out of memory \n"); + rc = -1; + goto done; + } + slapi_sdn_set_dn_byval(dn, suffix_to_update->notified_dn); - if ( (entry != NULL) && (dn != NULL) ) + if ( entry != NULL ) { if ( (operation == SLAPI_OPERATION_MODIFY) || (operation == SLAPI_OPERATION_DELETE) ) @@ -646,8 +653,8 @@ static int roles_cache_update(roles_cache_def *suffix_to_update) suffix_to_update->notified_entry = NULL; } +done: PR_RWLock_Unlock(suffix_to_update->cache_lock); - if ( dn != NULL ) { slapi_sdn_free(&dn); @@ -1718,6 +1725,12 @@ static int roles_is_entry_member_of_object_ext(vattr_context *c, caddr_t data, c slapi_log_error(SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "--> roles_is_entry_member_of_object\n"); + if (!this_role) { + slapi_log_error(SLAPI_LOG_FATAL, + ROLES_PLUGIN_SUBSYSTEM, "roles_is_entry_member_of_object-> NULL role\n"); + goto done; + } + if (!roles_is_inscope(entry_to_check, this_role->dn)) { slapi_log_error(SLAPI_LOG_PLUGIN, @@ -1752,7 +1765,7 @@ static int roles_is_entry_member_of_object_ext(vattr_context *c, caddr_t data, c ROLES_PLUGIN_SUBSYSTEM, "roles_is_entry_member_of_object-> invalid role type\n"); } } - +done: slapi_log_error(SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "<-- roles_is_entry_member_of_object\n"); return rc; |