jcholast's pull request #64: "cert: fix cert-find --certificate when the cert 
is not in LDAP" was opened

PR body:
"""
Always return the cert specified in --certificate in cert-find result, even
when the cert is not found in LDAP.

https://fedorahosted.org/freeipa/ticket/6304
"""

See the full pull-request at https://github.com/freeipa/freeipa/pull/64
... or pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/64/head:pr64
git checkout pr64
From ecab8d6ed81150ebf651270aa52116924c6c01ba Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Wed, 7 Sep 2016 08:06:10 +0200
Subject: [PATCH] cert: fix cert-find --certificate when the cert is not in
 LDAP

Always return the cert specified in --certificate in cert-find result, even
when the cert is not found in LDAP.

https://fedorahosted.org/freeipa/ticket/6304
---
 ipaserver/plugins/cert.py | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/ipaserver/plugins/cert.py b/ipaserver/plugins/cert.py
index 6195a6b..8da1869 100644
--- a/ipaserver/plugins/cert.py
+++ b/ipaserver/plugins/cert.py
@@ -1266,17 +1266,15 @@ def _ldap_search(self, all, raw, pkey_only, no_members, timelimit,
                     rule)
                 filters.append(filter)
 
-        cert = options.get('certificate')
-        if cert is not None:
-            filter = ldap.make_filter_from_attr('usercertificate', cert)
-            filters.append(filter)
-
         result = collections.OrderedDict()
         complete = bool(filters)
 
-        if cert is None:
+        cert = options.get('certificate')
+        if cert is not None:
+            filter = ldap.make_filter_from_attr('usercertificate', cert)
+        else:
             filter = '(usercertificate=*)'
-            filters.append(filter)
+        filters.append(filter)
 
         filter = ldap.combine_filters(filters, ldap.MATCH_ALL)
         try:
-- 
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