fef02c
From c3ceffccc56dea782a3dfac5bc3a14d1d022d33a Mon Sep 17 00:00:00 2001
fef02c
From: Jan Cholasta <jcholast@redhat.com>
fef02c
Date: Wed, 12 Oct 2016 12:58:46 +0200
fef02c
Subject: [PATCH] cert: add revocation reason back to cert-find output
fef02c
fef02c
In commit c718ef058847bb39e78236e8af0ad69ac961bbcf some param values were
fef02c
accidentally removed from cert-find output.
fef02c
fef02c
In commit 22d5f579bbd8bb452cf1bf620294ab6ade6e7c47 `serial_number_hex` and
fef02c
`revoked` were added back.
fef02c
fef02c
Add back `revocation_reason` as well. Also, do not include `revoked` with
fef02c
--raw, as it's a virtual attribute.
fef02c
fef02c
https://fedorahosted.org/freeipa/ticket/6269
fef02c
fef02c
Reviewed-By: Pavel Vomacka <pvomacka@redhat.com>
fef02c
---
fef02c
 ipaserver/plugins/cert.py | 17 +++++++++--------
fef02c
 1 file changed, 9 insertions(+), 8 deletions(-)
fef02c
fef02c
diff --git a/ipaserver/plugins/cert.py b/ipaserver/plugins/cert.py
fef02c
index 00bae4560d601e28e0b983786bff9144bcc1b065..68516391a54aead8e92f3cdeb33463d8fa624bbd 100644
fef02c
--- a/ipaserver/plugins/cert.py
fef02c
+++ b/ipaserver/plugins/cert.py
fef02c
@@ -1098,16 +1098,17 @@ class cert_find(Search, CertMethod):
fef02c
                 obj = {'serial_number': serial_number}
fef02c
             else:
fef02c
                 obj = ra_obj
fef02c
-                obj['issuer'] = issuer
fef02c
-                obj['subject'] = DN(ra_obj['subject'])
fef02c
-                obj['revoked'] = (
fef02c
-                    ra_obj['status'] in (u'REVOKED', u'REVOKED_EXPIRED'))
fef02c
-
fef02c
                 if all:
fef02c
-                    ra_obj = ra.get_certificate(str(serial_number))
fef02c
-                    if not raw:
fef02c
+                    obj.update(ra.get_certificate(str(serial_number)))
fef02c
+
fef02c
+                if not raw:
fef02c
+                    obj['issuer'] = issuer
fef02c
+                    obj['subject'] = DN(ra_obj['subject'])
fef02c
+                    obj['revoked'] = (
fef02c
+                        ra_obj['status'] in (u'REVOKED', u'REVOKED_EXPIRED'))
fef02c
+                    if all:
fef02c
                         obj['certificate'] = (
fef02c
-                            ra_obj['certificate'].replace('\r\n', ''))
fef02c
+                            obj['certificate'].replace('\r\n', ''))
fef02c
                         self.obj._parse(obj)
fef02c
 
fef02c
             obj['cacn'] = ca_obj['cn'][0]
fef02c
-- 
fef02c
2.10.2
fef02c