From 62af314a96068a16311be6e04788fb51bc66855b Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 15 Jul 2015 10:25:42 +0200 Subject: [PATCH] improve parse_user_config, parse_shadow_config same as in pve-common: replace substituting line parsing with /gm modified match regexps. --- PVE/AccessControl.pm | 5 +---- PVE/Auth/PVE.pm | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) 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; -- 2.39.2