fixed the message 'Odd number of elements in hash assignment' in lib/HTTPServer.pm

This commit is contained in:
Jordi Sanfeliu 2017-03-15 17:49:05 +01:00
parent dd694ac72a
commit 82d8c9ed9e
2 changed files with 18 additions and 1 deletions

View File

@ -20,6 +20,9 @@
- Fixed the MIME type of graphs in 'emailreports.pm' and in 'traffacct.pm' to
honor the 'image_format' option. [#174]
- Fixed in 'emailreports.pm' to name each attached graph correctly.
- Fixed the message 'Odd number of elements in hash assignment' in
HTTPServer.pm line 58, generated by a malformed line in the 'htpasswd' file.
Now it warns about such malformed line in the HTTP built-in log.
3.9.0 - 14-Oct-2016

View File

@ -55,7 +55,21 @@ sub check_passwd {
if(open(IN, $main::config{httpd_builtin}->{auth}->{htpasswd})) {
while(<IN>) {
my %pair = split(':', $_);
my $line = trim($_);
# append character ':' if not exist
if(index($line, ":") < 0) {
logger("Malformed line in " . $main::config{httpd_builtin}->{auth}->{htpasswd}, "ERROR");
$line .= ":" if index($line, ":") < 0;
}
# discard that line if password is missing
if(length($line) == index($line, ":") + 1) {
logger("Malformed line in " . $main::config{httpd_builtin}->{auth}->{htpasswd}, "ERROR");
next;
}
my %pair = split(':', $line);
if($pair{$user || ""}) {
chomp($pair{$user});
if(crypt($pass, $pair{$user}) ne $pair{$user}) {