From 278373f689224d0895a5aefc80f7e88e2627a9dd Mon Sep 17 00:00:00 2001
From: Leigh B Stoller <stoller@flux.utah.edu>
Date: Tue, 1 Mar 2016 16:43:07 -0700
Subject: [PATCH] Do not barf if there is no existing encrypted certificate to
 reuse, just create a new one.

---
 account/mkusercert.in | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/account/mkusercert.in b/account/mkusercert.in
index aa98ab3ab8..ab7138e530 100755
--- a/account/mkusercert.in
+++ b/account/mkusercert.in
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -wT
 #
-# Copyright (c) 2000-2015 University of Utah and the Flux Group.
+# Copyright (c) 2000-2016 University of Utah and the Flux Group.
 # 
 # {{{EMULAB-LICENSE
 # 
@@ -207,21 +207,18 @@ if (defined($options{"c"}) || defined($options{"C"})) {
     if (defined($options{"c"})) {
 	$old_password = $options{"c"};
     }
-    else {
-	$target_user->SSLPassPhrase(1, \$old_password) == 0
-	    or fatal("No password for encrypted SSL key");
-    }
-
-    #
-    # Make sure its all escaped since any printable char is allowed.
-    #
-    if ($old_password =~ /^([\040-\176]*)$/) {
-	$old_password = $1;
-    }
-    else {
-	die("Tainted argument: $old_password\n");
+    elsif ($target_user->SSLPassPhrase(1, \$old_password) == 0) {
+	#
+	# Make sure its all escaped since any printable char is allowed.
+	#
+	if ($old_password =~ /^([\040-\176]*)$/) {
+	    $old_password = $1;
+	}
+	else {
+	    fatal("Tainted password: $old_password");
+	}
+	$old_password =~ s/\'/\'\\\'\'/g;
     }
-    $old_password =~ s/\'/\'\\\'\'/g;
 }
 
 
-- 
GitLab