[pve-devel] r6477 - in pve-access-control/trunk: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Aug 15 10:32:14 CEST 2011


Author: dietmar
Date: 2011-08-15 10:32:14 +0200 (Mon, 15 Aug 2011)
New Revision: 6477

Modified:
   pve-access-control/trunk/ChangeLog
   pve-access-control/trunk/PVE/AccessControl.pm
Log:
	* PVE/AccessControl.pm (parse_user_config): fix parser for files
	without newline at eof
	(parse_shadow_passwd): fix parser for files without newline at eof
	(parse_domains): fix parser for files without newline at eof



Modified: pve-access-control/trunk/ChangeLog
===================================================================
--- pve-access-control/trunk/ChangeLog	2011-08-15 08:31:00 UTC (rev 6476)
+++ pve-access-control/trunk/ChangeLog	2011-08-15 08:32:14 UTC (rev 6477)
@@ -1,3 +1,10 @@
+2011-08-15  Proxmox Support Team  <support at proxmox.com>
+
+	* PVE/AccessControl.pm (parse_user_config): fix parser for files
+	without newline at eof
+	(parse_shadow_passwd): fix parser for files without newline at eof
+	(parse_domains): fix parser for files without newline at eof
+
 2011-08-01  Proxmox Support Team  <support at proxmox.com>
 
 	* PVE/AccessControl.pm (lock_*): remove $parent in calls to

Modified: pve-access-control/trunk/PVE/AccessControl.pm
===================================================================
--- pve-access-control/trunk/PVE/AccessControl.pm	2011-08-15 08:31:00 UTC (rev 6476)
+++ pve-access-control/trunk/PVE/AccessControl.pm	2011-08-15 08:32:14 UTC (rev 6477)
@@ -707,8 +707,7 @@
 
     userconfig_force_defaults($cfg);
 
-    $raw = "" if !defined($raw);
-    while ($raw =~ s/^(.*)\n//) {
+    while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
 	my $line = $1;
 
 	next if $line =~ m/^\s*$/; # skip empty lines
@@ -855,9 +854,7 @@
 
     my $shadow = {};
 
-    $raw = "" if !defined($raw);
-
-    while ($raw =~ s/^(.*)\n//) {
+    while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
 	my $line = $1;
 
 	next if $line =~ m/^\s*$/; # skip empty lines
@@ -925,11 +922,9 @@
 
     my $cfg = {};
 
-    $raw = "" if !defined($raw);
-
     my $default;
 
-    while ($raw =~ s/^(.*)\n//) {
+    while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
 	my $line = $1;
  
 	next if $line =~ m/^\#/; # skip comment lines
@@ -953,7 +948,7 @@
 		$entry = { type => $type };
 	    }
 
-	    while ($raw =~ s/^(.*)\n//) {
+	    while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
 		$line = $1;
 
 		next if $line =~ m/^\#/; #skip comment lines



More information about the pve-devel mailing list