From 24f4e065e5d3c02460ecc8fc7f938c9d0ba98fc8 Mon Sep 17 00:00:00 2001 From: Seth Schoen Date: Sun, 12 Aug 2012 18:49:26 -0700 Subject: [PATCH 1/2] lowercase names and remove duplicates --- server-ca/CSR.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server-ca/CSR.py b/server-ca/CSR.py index 66fe402cf..85bffcd9a 100644 --- a/server-ca/CSR.py +++ b/server-ca/CSR.py @@ -127,7 +127,8 @@ def cn(csr): def subject_names(csr): """ - Get the cn and subjectAltNames from this CSR. + Get the cn and subjectAltNames from this CSR + (removing duplicates but retaining original order). @type csr: str @param csr: PEM-encoded string of the CSR @@ -137,7 +138,7 @@ def subject_names(csr): """ csr = str(csr) names = [] - names.append(cn(csr)) + names.append(cn(csr).lower()) req = M2Crypto.X509.load_request_string(csr) for ext in req.get_extensions(): # requires M3Crypto modification @@ -148,7 +149,9 @@ def subject_names(csr): for san in sans: san = san.strip() # remove leading space if san.startswith('DNS:'): - names.append(san[len('DNS:'):]) + new_name = san[len('DNS:'):].lower() + if new_name not in names: + names.append(new_name) # Don't exit loop - support multiple SAN extensions?? From 7b0a68d79cef07e361751ebea9d946faee71a246 Mon Sep 17 00:00:00 2001 From: Seth Schoen Date: Sun, 12 Aug 2012 19:04:28 -0700 Subject: [PATCH 2/2] don't set stdout inside check_output --- trustify/client/configurator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trustify/client/configurator.py b/trustify/client/configurator.py index 7498f0c1d..57440768e 100644 --- a/trustify/client/configurator.py +++ b/trustify/client/configurator.py @@ -518,7 +518,7 @@ class Configurator(object): TODO: TEST """ # Use check_output so the command will finish before reloading - subprocess.check_output(["sudo", "a2enmod", "ssl"], stdout=open("/dev/null", 'w'), stderr=open("/dev/null", 'w')) + subprocess.check_output(["sudo", "a2enmod", "ssl"], stderr=open("/dev/null", 'w')) subprocess.call(["sudo", "/etc/init.d/apache2", "reload"], stdout=open("/dev/null", 'w')) def fnmatch_to_re(self, cleanFNmatch):