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

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Jan Cholasta authored and David Kupka committed 2016-09-07 12:46:35 +02:00
1 parent c7e0dbc4e1
commit b7b6faf14a
1 file changed
+5 -7
+5 -7
View File
@@ -1266,17 +1266,15 @@ class cert_find(Search, CertMethod):
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: