URL: https://github.com/freeipa/freeipa/pull/578
Author: tomaskrizek
 Title: #578: Coverity: fix bad use of null-like value in cert.py
Action: opened

PR body:
"""
http://cov01.lab.eng.brq.redhat.com/covscanhub/task/38300/
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/578/head:pr578
git checkout pr578
From aa920d58ba2c8ecea4c8c00946d1927b9a250f04 Mon Sep 17 00:00:00 2001
From: Tomas Krizek <tkri...@redhat.com>
Date: Mon, 13 Mar 2017 18:55:59 +0100
Subject: [PATCH] Coverity: fix bad use of null-like value in cert.py

---
 ipaserver/plugins/cert.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ipaserver/plugins/cert.py b/ipaserver/plugins/cert.py
index fb16f5b..6c63913 100644
--- a/ipaserver/plugins/cert.py
+++ b/ipaserver/plugins/cert.py
@@ -679,7 +679,8 @@ def execute(self, csr, all=False, raw=False, **kw):
             # fail if any email addr from DN does not appear in ldap entry
             email_addrs = csr_obj.subject.get_attributes_for_oid(
                     cryptography.x509.oid.NameOID.EMAIL_ADDRESS)
-            if len(set(email_addrs) - set(principal_obj.get('mail', []))) > 0:
+            if principal_obj is None or len(set(email_addrs) - set(
+                    principal_obj.get('mail', []))) > 0:
                 raise errors.ValidationError(
                     name='csr',
                     error=_(
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to