URL: https://github.com/freeipa/freeipa/pull/392
Author: tomaskrizek
 Title: #392: Fix coverity issue
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/392/head:pr392
git checkout pr392
From 9626860539c4d7bf5afb24423b9ef36ecef23185 Mon Sep 17 00:00:00 2001
From: Tomas Krizek <tkri...@redhat.com>
Date: Thu, 12 Jan 2017 10:49:12 +0100
Subject: [PATCH] Fix coverity issue

A code path exists, where principal_obj is None. Add check
principal_obj is not None to avoid dereferencing it.
 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 cc47084..d8bfc1c 100644
--- a/ipaserver/plugins/cert.py
+++ b/ipaserver/plugins/cert.py
@@ -780,7 +780,8 @@ def execute(self, csr, all=False, raw=False, **kw):
                             "match requested principal") % gn.name)
             elif isinstance(gn, cryptography.x509.general_name.RFC822Name):
                 if principal_type == USER:
-                    if gn.value not in principal_obj.get('mail', []):
+                    if principal_obj and gn.value not in principal_obj.get(
+                            'mail', []):
                         raise errors.ValidationError(
Manage your subscription for the Freeipa-devel mailing list:
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to