[pve-devel] r4869 - pve-access-control/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Jul 5 09:39:45 CEST 2010


Author: dietmar
Date: 2010-07-05 07:39:45 +0000 (Mon, 05 Jul 2010)
New Revision: 4869

Modified:
   pve-access-control/trunk/AccessControl.pm
   pve-access-control/trunk/ChangeLog
Log:
* AccessControl.pm: cleanup - remove space in function calls(Seth)


Modified: pve-access-control/trunk/AccessControl.pm
===================================================================
--- pve-access-control/trunk/AccessControl.pm	2010-07-05 07:37:13 UTC (rev 4868)
+++ pve-access-control/trunk/AccessControl.pm	2010-07-05 07:39:45 UTC (rev 4869)
@@ -30,7 +30,7 @@
 
     my $parent = ( caller(1) )[3];
 
-    lock_file ($userconfiglock, $parent, $code, @param);
+    lock_file($userconfiglock, $parent, $code, @param);
 }
 
 # flock: we use one file handle per process, so lock file
@@ -66,7 +66,7 @@
         }
         alarm (0);
 
-        $res = &$code (@param);
+        $res = &$code(@param);
     };
 
     my $err = $@;
@@ -212,7 +212,7 @@
 
 	    local $ENV{PVETICKET} = $ticket if $ticket;
 
-	    $pid = open3 ($writer, $reader, $error, @$cmd) || die $!;
+	    $pid = open3($writer, $reader, $error, @$cmd) || die $!;
 	};
 
 	my $err = $@;
@@ -230,14 +230,14 @@
 	close $writer;
 
 	my $select = new IO::Select;
-	$select->add ($reader);
-	$select->add ($error);
+	$select->add($reader);
+	$select->add($error);
 
 	my $outlog = '';
 	my $errlog = '';
 
 	while ($select->count) {
-	    my @handles = $select->can_read ($timeout);
+	    my @handles = $select->can_read($timeout);
 
 	    if (defined ($timeout) && (scalar (@handles) == 0)) {
 		kill (9, $pid);
@@ -261,7 +261,7 @@
 			    $outlog .= $buf;
 			    while ($outlog =~ s/^([^\010\r\n]*)(\r|\n|(\010)+|\r\n)//s) {
 				my $line = $1;
-				&$outfunc ($line);
+				&$outfunc($line);
 			    }
 			};
 			my $err = $@;
@@ -280,7 +280,7 @@
 			    $errlog .= $buf;
 			    while ($errlog =~ s/^([^\010\r\n]*)(\r|\n|(\010)+|\r\n)//s) {
 				my $line = $1;
-				&$errfunc ($line);
+				&$errfunc($line);
 			    }
 			};
 			my $err = $@;
@@ -454,7 +454,7 @@
 sub user_enabled {
     my ($usercfg, $username) = @_;
 
-    return undef if !verify_username ($username, 1);
+    return undef if !verify_username($username, 1);
  
     return 1 if $usercfg && $usercfg->{users}->{$username} &&
 	$usercfg->{users}->{$username}->{enabled};
@@ -474,7 +474,7 @@
  
 	my ($user, $domain);
 
-	($username, $user, $domain) = verify_username ($username);
+	($username, $user, $domain) = verify_username($username);
  
 	my $usercfg = load_user_config();
 
@@ -508,11 +508,11 @@
 
     my ($username, $opts) = @_;
 
-    lock_user_config (sub {
+    lock_user_config(sub {
     
 	my $domain;
 
-	($username, undef, $domain) = verify_username ($username);
+	($username, undef, $domain) = verify_username($username);
 	
 	my $usercfg = load_user_config();
 
@@ -525,12 +525,12 @@
 
 	    store_shadow_passwd() if !$domain && $opts->{passwd};
 
-	    enable_user ($username, $usercfg);
+	    enable_user($username, $usercfg);
 
 	    if ($opts->{groups}) {
-		foreach my $group (split_list ($opts->{groups})) {
+		foreach my $group (split_list($opts->{groups})) {
 		    if ($usercfg->{groups}->{$group}) {
-			add_user_group ($username, $usercfg, $group);
+			add_user_group($username, $usercfg, $group);
 		    } else {
 			warn "ignore group '$group' - no such group\n";
 			next;
@@ -542,15 +542,15 @@
 
 	    die "user '$username' does not exist\n" if !$usercfg->{users}->{$username};
 	    store_shadow_passwd() if !$domain && $opts->{passwd};
-	    enable_user ($username, $usercfg) if $opts->{unlock} &&
+	    enable_user($username, $usercfg) if $opts->{unlock} &&
 		!$usercfg->{users}->{$username}->{enabled};
-	    disable_user ($username, $usercfg) if $opts->{lock} &&
+	    disable_user($username, $usercfg) if $opts->{lock} &&
 		$usercfg->{users}->{$username}->{enabled};
-	    delete_user_group ($username, $usercfg) if (!$opts->{append} && $opts->{groups});
+	    delete_user_group($username, $usercfg) if (!$opts->{append} && $opts->{groups});
 	    if ($opts->{groups}) {
-		foreach my $group (split_list ($opts->{groups})) {
+		foreach my $group (split_list($opts->{groups})) {
 		    if ($usercfg->{groups}->{$group}) {
-			add_user_group ($username, $usercfg, $group);
+			add_user_group($username, $usercfg, $group);
 		    } else {
 			warn "ignore group '$group' - no such group\n";
 			next;
@@ -558,11 +558,11 @@
 		}
 	    }
 
-	    name_user ($username, $usercfg) if $opts->{name};
-	    comment_user ($username, $usercfg) if $opts->{comment};
+	    name_user($username, $usercfg) if $opts->{name};
+	    comment_user($username, $usercfg) if $opts->{comment};
 	}
 
-	save_user_config ($usercfg);
+	save_user_config($usercfg);
     });
 
     my $err = $@;
@@ -574,18 +574,18 @@
     
     my ($username) = @_;
     
-    lock_user_config (sub {
+    lock_user_config(sub {
 
-	($username, undef, undef) = verify_username ($username);
+	($username, undef, undef) = verify_username($username);
 
 	my $usercfg = load_user_config();
 
 	delete ($usercfg->{users}->{$username})
 	    if $usercfg->{users}->{$username};
 
-	delete_user_group ($username, $usercfg);
-	delete_user_acl ($username, $usercfg);
-	save_user_config ($usercfg);
+	delete_user_group($username, $usercfg);
+	delete_user_acl($username, $usercfg);
+	save_user_config($usercfg);
     });
 
     my $err = $@;
@@ -665,18 +665,18 @@
 
     my ($group) = @_;
 
-    lock_user_config (sub {
+    lock_user_config(sub {
     
 	my $usercfg = load_user_config();
 
-	verify_groupname ($group);
+	verify_groupname($group);
 	
 	die "group '$group' already exists\n" 
 	    if $usercfg->{groups}->{$group};
 
 	$usercfg->{groups}->{$group} = {};
 
-	save_user_config ($usercfg);
+	save_user_config($usercfg);
     
     });
 
@@ -689,16 +689,16 @@
     
     my ($group) = @_;
 
-    lock_user_config (sub {
+    lock_user_config(sub {
 
-	verify_groupname ($group);
+	verify_groupname($group);
 
 	my $usercfg = load_user_config();
 
 	delete ($usercfg->{groups}->{$group})
 	    if $usercfg->{groups}->{$group};
 
-	save_user_config ($usercfg);
+	save_user_config($usercfg);
 
     });
 
@@ -749,11 +749,11 @@
 sub modify_role {
     my ($role, $opts) = @_;
 
-    lock_user_config (sub {
+    lock_user_config(sub {
 	
 	my $usercfg = load_user_config();
 
-	verify_rolename ($role);
+	verify_rolename($role);
 
 	if ($opts->{create}) {
 	    die "can't add role '$role' - role already exists\n" if $usercfg->{roles}->{$role};	
@@ -764,7 +764,7 @@
 
 	$usercfg->{roles}->{$role} = {} if !$opts->{append};
 	if ($opts->{privs}) {
-	    foreach my $priv (split_list ($opts->{privs})) {
+	    foreach my $priv (split_list($opts->{privs})) {
 		if ($usercfg->{roles}->{$role} && defined ($valid_privs->{$priv})) {
 		    $usercfg->{roles}->{$role}->{$priv} = 1;
 		} else {
@@ -773,7 +773,7 @@
 	    }	
 	}
 
-	save_user_config ($usercfg);
+	save_user_config($usercfg);
     });
 
     my $err = $@;
@@ -785,16 +785,16 @@
     
     my ($role) = @_;
 
-    lock_user_config (sub {
+    lock_user_config(sub {
 
 	my $usercfg = load_user_config();
 
-	verify_rolename ($role);
+	verify_rolename($role);
 
 	delete ($usercfg->{roles}->{$role})
 	    if $usercfg->{roles}->{$role};
 
-	save_user_config ($usercfg);
+	save_user_config($usercfg);
 
     });
 
@@ -911,7 +911,7 @@
 	    if ($et eq 'user') {
 		my ($user, $enabled) = @data;
 
-		if (!verify_username ($user, 1)) {
+		if (!verify_username($user, 1)) {
 		    warn "user config - ignore user '$user' - invalid characters in user name\n";
 		    next;
 		}
@@ -935,7 +935,7 @@
 	    } elsif ($et eq 'group') {
 		my ($group, $userlist) = @data;
 
-		if (!verify_groupname ($group, 1)) {
+		if (!verify_groupname($group, 1)) {
 		    warn "user config - ignore group '$group' - invalid characters in group name\n";
 		    next;
 		}
@@ -943,9 +943,9 @@
 		# make sure to add the group (even if there are no members)
 		$cfg->{groups}->{$group} = {} if !$cfg->{groups}->{$group};
 
-		foreach my $user (split_list ($userlist)) {
+		foreach my $user (split_list($userlist)) {
 
-		    if (!verify_username ($user, 1)) {
+		    if (!verify_username($user, 1)) {
 			warn "user config - ignore invalid group member '$user'\n";
 			next;
 		    }
@@ -961,7 +961,7 @@
 	    } elsif ($et eq 'role') {
 		my ($role, $privlist) = @data;
 		
-		if (!verify_rolename ($role, 1)) {
+		if (!verify_rolename($role, 1)) {
 		    warn "user config - ignore role '$role' - invalid characters in role name\n";
 		    next;
 		}
@@ -969,7 +969,7 @@
 		# make sure to add the role (even if there are no privileges)
 		$cfg->{roles}->{$role} = {} if !$cfg->{roles}->{$role};
 
-		foreach my $priv (split_list ($privlist)) {
+		foreach my $priv (split_list($privlist)) {
 		    if (defined ($valid_privs->{$priv})) {
 			$cfg->{roles}->{$role}->{$priv} = 1;
 		    } else {
@@ -980,15 +980,15 @@
 	    } elsif ($et eq 'acl') {
 		my ($propagate, $pathtxt, $uglist, $rolelist) = @data;
 
-		if (my $path = normalize_path ($pathtxt)) {
-		    foreach my $role (split_list ($rolelist)) {
+		if (my $path = normalize_path($pathtxt)) {
+		    foreach my $role (split_list($rolelist)) {
 			
-			if (!verify_rolename ($role, 1)) {
+			if (!verify_rolename($role, 1)) {
 			    warn "user config - ignore invalid role name '$role' in acl\n";
 			    next;
 			}
 
-			foreach my $ug (split_list ($uglist)) {
+			foreach my $ug (split_list($uglist)) {
 			    if ($ug =~ m/^@(\w+)$/) {
 				my $group = $1;
 				if ($cfg->{groups}->{$group}) { # group exists 
@@ -996,7 +996,7 @@
 				} else {
 				    warn "user config - ignore invalid acl group '$group'\n";
 				}
-			    } elsif (verify_username ($ug, 1)) {
+			    } elsif (verify_username($ug, 1)) {
 				if ($cfg->{users}->{$ug}) { # user exists 
 				    $cfg->{acl}->{$path}->{users}->{$ug}->{$role} = $propagate;
 				} else {
@@ -1032,7 +1032,7 @@
     my $cfg = {};
 
     my $fh = IO::File->new ($userconfigpath, 'r');
-    $cfg = parse_config ($userconfigpath, $fh);
+    $cfg = parse_config($userconfigpath, $fh);
     $fh->close() if $fh;
 
     $user_config_cache = $cfg;
@@ -1208,7 +1208,7 @@
 sub permission {
     my ($cfg, $user, $path) = @_;
 
-    my @ra = roles ($cfg, $user, $path);
+    my @ra = roles($cfg, $user, $path);
     
     my $privs = {};
 

Modified: pve-access-control/trunk/ChangeLog
===================================================================
--- pve-access-control/trunk/ChangeLog	2010-07-05 07:37:13 UTC (rev 4868)
+++ pve-access-control/trunk/ChangeLog	2010-07-05 07:39:45 UTC (rev 4869)
@@ -2,6 +2,7 @@
 
 	* AccessControl.pm (modify_user): remove call to change_password()
 	- not neccessary at all (Seth)
+	* AccessControl.pm: cleanup - remove space in function calls(Seth)
 
 2010-07-02  Proxmox Support Team  <support at proxmox.com>
 




More information about the pve-devel mailing list