amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone
Blob Blame History Raw
From dd3b06c0c6581bf0c2c3c3f347ab7a84c860a15b Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Wed, 1 Oct 2014 14:06:06 -0700
Subject: [PATCH] Ticket #47892 - coverity defects found in 1.3.3.x

Description: fixing compiler warnings reported by covscan on 1.3.3.4.
https://fedorahosted.org/389/ticket/47892#comment:8

Reviewed by mreynolds@redhat.com (Thank you, Mark!!)

(cherry picked from commit afc8b06f9e9cc045906d6d6fb64fe5d5f9d7c3d5)
(cherry picked from commit 5353f9fd97518074b77698bf13d95325aeb667d9)
---
 ldap/servers/plugins/acl/acl.c      | 10 +++++-----
 ldap/servers/plugins/acl/aclparse.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index f8b854c..fe863c8 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -2475,13 +2475,13 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *
 			int done;
 
 
-			if (aclpb->aclpb_access & SLAPI_ACL_ADD &&
-				aci->aci_type & ACI_TARGET_ATTR_ADD_FILTERS) {
+			if ((aclpb->aclpb_access & SLAPI_ACL_ADD) &&
+			    (aci->aci_type & ACI_TARGET_ATTR_ADD_FILTERS)) {
 
 				attrFilterArray = aci->targetAttrAddFilters;
 
-			} else if (aclpb->aclpb_access & SLAPI_ACL_DELETE && 
-						aci->aci_type & ACI_TARGET_ATTR_DEL_FILTERS) {
+			} else if ((aclpb->aclpb_access & SLAPI_ACL_DELETE) && 
+			           (aci->aci_type & ACI_TARGET_ATTR_DEL_FILTERS)) {
 				
 				attrFilterArray = aci->targetAttrDelFilters;
 
@@ -2490,7 +2490,7 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *
 			attr_matched = ACL_TRUE;
 			num_attrs = 0;
 
-			while (attrFilterArray[num_attrs] && attr_matched) {
+			while (attrFilterArray && attrFilterArray[num_attrs] && attr_matched) {
 				attrFilter = attrFilterArray[num_attrs];
 
 				/* 
diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c
index ae4f2d5..ea64fa7 100644
--- a/ldap/servers/plugins/acl/aclparse.c
+++ b/ldap/servers/plugins/acl/aclparse.c
@@ -256,7 +256,7 @@ __aclp__parse_aci(char *str, aci_t  *aci_item, char **errbuf)
    	int 	targetattrfilterslen = strlen(aci_targetattrfilters);
         int     target_to_len        = strlen(aci_target_to);
         int     target_from_len      = strlen(aci_target_from);
-        PRBool  is_target_to;
+        PRBool  is_target_to = PR_FALSE;
 
 	__acl_strip_leading_space( &str );
 
-- 
1.9.3