[pve-devel] [PATCH] Fix: disable root

Wolfgang Link w.link at proxmox.com
Wed Jan 28 09:34:47 CET 2015


From: Wolfgang Link <wolfgang at linksystems.org>

root can now be disabled in GUI.

Signed-off-by: Wolfgang Link <w.link at proxmox.com>
---
 PVE/AccessControl.pm |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/PVE/AccessControl.pm b/PVE/AccessControl.pm
index db85d08..a1b4971 100644
--- a/PVE/AccessControl.pm
+++ b/PVE/AccessControl.pm
@@ -356,8 +356,6 @@ sub check_user_enabled {
 
     return 1 if $data->{enable};
 
-    return 1 if $username eq 'root at pam'; # root is always enabled
-
     die "user '$username' is disabled\n" if !$noerr;
  
     return undef;
@@ -695,10 +693,10 @@ sub userconfig_force_defaults {
 	$cfg->{roles}->{$r} = $special_roles->{$r};
     }
 
-    # fixme: remove 'root' group (not required)?
-
-    # add root user 
-    $cfg->{users}->{'root at pam'}->{enable} = 1;
+    # add root user if not exists
+    if (!$cfg->{users}->{'root at pam'}) {
+	$cfg->{users}->{'root at pam'}->{enable} = 1; 
+    }
 }
 
 sub parse_user_config {
-- 
1.7.10.4





More information about the pve-devel mailing list