]> git.proxmox.com Git - pve-access-control.git/commitdiff
improve parse_user_config, parse_shadow_config
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 15 Jul 2015 08:25:42 +0000 (10:25 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 22 Jul 2015 06:10:49 +0000 (08:10 +0200)
same as in pve-common: replace substituting line parsing
with /gm modified match regexps.

PVE/AccessControl.pm
PVE/Auth/PVE.pm

index 2b7044e2393039aab16dad482e76b0cfd6c29b76..955e143586017a63b3acdfa1590f17cafced6624 100644 (file)
@@ -708,11 +708,8 @@ sub parse_user_config {
 
     userconfig_force_defaults($cfg);
 
-    while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
+    while ($raw =~ /^\s*(.+?)\s*$/gm) {
        my $line = $1;
-
-       next if $line =~ m/^\s*$/; # skip empty lines
-
        my @data;
 
        foreach my $d (split (/:/, $line)) {
index 7f03b9e531881dd976499353975437bec04aaaa3..71479979eea163f47787f9d2e96fe0d869121f55 100755 (executable)
@@ -19,11 +19,9 @@ sub parse_shadow_passwd {
 
     my $shadow = {};
 
-    while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
+    while ($raw =~ /^\s*(.+?)\s*$/gm) {
        my $line = $1;
 
-       next if $line =~ m/^\s*$/; # skip empty lines
-
        if ($line !~ m/^\S+:\S+:$/) {
            warn "pve shadow password: ignore invalid line $.\n";
            next;