[PATCH 2/2] Fix password setup

Reto Gantenbein reto.gantenbein at linuxmonk.ch
Wed Jul 14 05:03:06 CEST 2010


Check for password given by user, else auto-generate.
---
 bin/xen-create-image |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/bin/xen-create-image b/bin/xen-create-image
index f460a8a..9821866 100755
--- a/bin/xen-create-image
+++ b/bin/xen-create-image
@@ -4354,7 +4354,6 @@ sub setupRootPassword
     }
     else
     {
-        logprint("Generating a password for the new guest.\n");
         #
         #  Replace the password in the /etc/shadow file
         #
@@ -4364,14 +4363,17 @@ sub setupRootPassword
             #
             #  Generate a password, salt and use that to generating a hash
             #
-            if ( $CONFIG{ 'genpass' } )
+            if ( $CONFIG{ 'password' } )
             {
-                $PASSWORD = generatePassword( $CONFIG{ 'genpass_len' } );
+                logprint("Using given root password.\n");
+                $PASSWORD = $CONFIG { 'password' };
             }
             else
             {
-                $PASSWORD = $CONFIG { 'password' };
+                logprint("Generating a root password.\n");
+                $PASSWORD = generatePassword( $CONFIG{ 'genpass_len' } );
             }
+
             my $salt = generatePassword(8);
             my $hash = `echo -n $PASSWORD | openssl passwd -stdin -1 -salt $salt`;
             $hash =~ s/\s+$//;
-- 
1.7.1


--=-o24Y2pqGiRfPORxeWiOg
Content-Disposition: attachment; filename="xt-guess-suite-and-mirror_Fix-fallback-mirror-suite.patch"
Content-Type: text/x-patch; name="xt-guess-suite-and-mirror_Fix-fallback-mirror-suite.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit



More information about the xen-tools-dev mailing list