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

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Jul 7 09:58:25 CEST 2010


Author: dietmar
Date: 2010-07-07 07:58:25 +0000 (Wed, 07 Jul 2010)
New Revision: 4879

Modified:
   pve-access-control/trunk/AccessControl.pm
   pve-access-control/trunk/ChangeLog
Log:
       (parse_shadow): simplify code - there is no need to trim strings. Instead check for
       correct format.



Modified: pve-access-control/trunk/AccessControl.pm
===================================================================
--- pve-access-control/trunk/AccessControl.pm	2010-07-07 07:51:09 UTC (rev 4878)
+++ pve-access-control/trunk/AccessControl.pm	2010-07-07 07:58:25 UTC (rev 4879)
@@ -1077,14 +1077,12 @@
 
 	    next if $line =~ m/^\s*$/; # skip empty lines
 
-	    my @data;
-
-	    foreach my $d (split (/:/, $line)) {
-		$d =~ s/^\s+//;
-		$d =~ s/\s+$//;
-		push @data, $d
+	    if ($line !~ m/^\S+:\S+:$/) {
+		warn "pve shadow password: ignore invalid line $.\n";
+		next;
 	    }
-	    my ($username,$crypt_pass) = @data;
+
+	    my ($username,$crypt_pass) = split (/:/, $line);
 	    $shadow->{users}->{$username}->{shadow} = $crypt_pass;
         }
     }

Modified: pve-access-control/trunk/ChangeLog
===================================================================
--- pve-access-control/trunk/ChangeLog	2010-07-07 07:51:09 UTC (rev 4878)
+++ pve-access-control/trunk/ChangeLog	2010-07-07 07:58:25 UTC (rev 4879)
@@ -4,6 +4,8 @@
 	with file locking (Seth)
 	(encrypt_pw): use SHA256 to crypt passwords
 	(save_shadow_config): change mode to 0600, store to /etc/pve/auth/shadow.cfg
+	(parse_shadow): simplify code - there is no need to trim strings. Instead check for
+	correct format.
 
 	* test/auth-test.pl: program for testing authentication methods (Seth)
 




More information about the pve-devel mailing list