Move a NULL check in the lockout plugin to address something Coverity found. There is no risk of a crash here but it there is also no point calling something if we know the values are NULL.

rob
>From 6d490529b6d96838e0eaa3b29ac5c5f651b59875 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Tue, 27 Aug 2013 17:34:46 -0400
Subject: [PATCH] Re-order NULL check in ipa_lockout.

There is no risk of crash here as slapi_valueset_first_value() can handle
the case where the valueset is NULL, but there is no point in calling that
if we know there are no values.

https://fedorahosted.org/freeipa/ticket/3880
---
 daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c b/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c
index 9e903aaf179e9a7a8e95f76ec25f47f7ba9a6be6..fd6602fdee9b2fd95c154fd512fcba4f37e56bad 100644
--- a/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c
+++ b/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c
@@ -244,9 +244,8 @@ int ipalockout_getpolicy(Slapi_Entry *target_entry, Slapi_Entry **policy_entry,
     if (ldrc == 0) {
         Slapi_Value *sv = NULL;
 
-        slapi_valueset_first_value(*values, &sv);
-
         if (values != NULL) {
+            slapi_valueset_first_value(*values, &sv);
             *policy_dn = slapi_value_get_string(sv);
         }
     }
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to