From 49855ca9dea9241ccd88e3a89b499b6fed4493c9 Mon Sep 17 00:00:00 2001 From: Tomas Krizek 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. Reviewed-By: Martin Basti --- 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 cc47084b5..d8bfc1cd7 100644 --- a/ipaserver/plugins/cert.py +++ b/ipaserver/plugins/cert.py @@ -780,7 +780,8 @@ class cert_request(Create, BaseCertMethod, VirtualCommand): "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( name='csr', error=_(