[gnome-boxes] express,fedora: Require password for Fedora



commit b05ce10bae7663718125fca4c8f62d1220cda8c2
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sat Feb 18 17:02:27 2012 +0200

    express,fedora: Require password for Fedora
    
    Since Fedora requires us to set a password for root and user accounts, we
    now require user to provide a password. To not complicate users' life
    more than needed in this case, we free them from display (SPICE)
    authentication.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670306

 src/fedora-installer.vala     |    1 +
 src/unattended-installer.vala |    8 +++++++-
 src/vm-configurator.vala      |    4 +++-
 3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/fedora-installer.vala b/src/fedora-installer.vala
index 6b6c094..b6d7eb0 100644
--- a/src/fedora-installer.vala
+++ b/src/fedora-installer.vala
@@ -29,6 +29,7 @@ private class Boxes.FedoraInstaller: UnattendedInstaller {
         var source_path = get_unattended_dir ("fedora.ks");
 
         base.copy (media, source_path, "ks.cfg");
+        password_mandatory = true;
     }
 
     public override void set_direct_boot_params (GVirConfig.DomainOs os) {
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 100339d..0f4ada8 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -27,6 +27,8 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
         }
     }
 
+    public bool password_mandatory { get; protected set; }
+
     protected string unattended_src_path;
     protected string unattended_dest_name;
     protected DataStreamNewlineType newline_type;
@@ -152,6 +154,10 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
 
         if (username == "")
             throw new UnattendedInstallerError.SETUP_INCOMPLETE (_("No username provided"));
+
+        if (password_mandatory && password == "")
+            throw new UnattendedInstallerError.SETUP_INCOMPLETE
+                        (_("Password required for express installation of %s"), label);
     }
 
     protected virtual void setup_ui () {
@@ -238,7 +244,7 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
 
     protected virtual string fill_unattended_data (string data) throws RegexError {
         var str = username_regex.replace (data, data.length, 0, username_entry.text);
-        str = password_regex.replace (str, str.length, 0, password_entry.text);
+        str = password_regex.replace (str, str.length, 0, password);
         str = timezone_regex.replace (str, str.length, 0, timezone);
         str = kbd_regex.replace (str, str.length, 0, kbd);
         str = lang_regex.replace (str, str.length, 0, lang);
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 0f66155..4f3e94e 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -46,7 +46,9 @@ private class Boxes.VMConfigurator {
         if (install_media is UnattendedInstaller) {
             var unattended = install_media as UnattendedInstaller;
 
-            if (unattended.express_install && unattended.password != "")
+            // If guest requires password, we let it take care of authentications and free the user from one
+            // authentication layer.
+            if (unattended.express_install && !unattended.password_mandatory && unattended.password != "")
                 graphics.set_password (unattended.password);
         }
         domain.add_device (graphics);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]