From: Wolfgang Bumiller Date: Wed, 15 Jul 2015 08:25:42 +0000 (+0200) Subject: improve parse_user_config, parse_shadow_config X-Git-Url: https://git.proxmox.com/?p=pve-access-control.git;a=commitdiff_plain;h=62af314a96068a16311be6e04788fb51bc66855b;ds=inline improve parse_user_config, parse_shadow_config same as in pve-common: replace substituting line parsing with /gm modified match regexps. --- diff --git a/PVE/AccessControl.pm b/PVE/AccessControl.pm index 2b7044e..955e143 100644 --- a/PVE/AccessControl.pm +++ b/PVE/AccessControl.pm @@ -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)) { diff --git a/PVE/Auth/PVE.pm b/PVE/Auth/PVE.pm index 7f03b9e..7147997 100755 --- a/PVE/Auth/PVE.pm +++ b/PVE/Auth/PVE.pm @@ -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;