diff --git a/account/mkusercert.in b/account/mkusercert.in index aa98ab3ab806ecc6ddde658f40268fc2f28ce1a2..ab7138e5308594d3826f58e8fcd319c7e4eda1dc 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; }