Hi All, Please review this patch.
Partially fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1353245 -- Thanks, Abhijeet Kasurde IRC: akasurde http://akasurde.github.io
From c636a147eea6d16d561a2b73d3f0b5760d587333 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde <[email protected]> Date: Tue, 2 Aug 2016 16:46:29 +0530 Subject: [PATCH] Added check for Subsystem data and request in 'pki-server subsystem-cert-export' Partially fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1353245 Signed-off-by: Abhijeet Kasurde <[email protected]> --- base/server/python/pki/server/cli/subsystem.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/base/server/python/pki/server/cli/subsystem.py b/base/server/python/pki/server/cli/subsystem.py index a44243a6788fc21d705055ec6bf4f1bc9e372475..a1301e0f4a400a31200570ec3ea95d548679e5aa 100644 --- a/base/server/python/pki/server/cli/subsystem.py +++ b/base/server/python/pki/server/cli/subsystem.py @@ -1,5 +1,6 @@ # Authors: # Endi S. Dewata <[email protected]> +# Abhijeet Kasurde <[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +15,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Copyright (C) 2015 Red Hat, Inc. +# Copyright (C) 2015-2016 Red Hat, Inc. # All rights reserved. # @@ -654,14 +655,22 @@ class SubsystemCertExportCLI(pki.cli.CLI): sys.exit(1) if cert_file: + cert_data = subsystem_cert.get('data', None) + if cert_data is None: + print("ERROR: Unable to find data from Subsystem Certificate") + sys.exit(1) - cert_data = pki.nssdb.convert_cert(subsystem_cert['data'], 'base64', 'pem') + cert_data = pki.nssdb.convert_cert(cert_data, 'base64', 'pem') with open(cert_file, 'w') as f: f.write(cert_data) if csr_file: + cert_request = subsystem_cert.get('request', None) + if cert_request is None: + print("ERROR: Unable to find request from Subsystem Certificate") + sys.exit(1) - csr_data = pki.nssdb.convert_csr(subsystem_cert['request'], 'base64', 'pem') + csr_data = pki.nssdb.convert_csr(cert_request, 'base64', 'pem') with open(csr_file, 'w') as f: f.write(csr_data) -- 2.4.11
_______________________________________________ Pki-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/pki-devel
