From 0386103af473c5ea4297746cf748d369ec5153c5 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 4 Jan 2014 14:05:08 -0800 Subject: [PATCH] strict conversion --- squid/squid-auth.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/squid/squid-auth.pl b/squid/squid-auth.pl index 892170310..afde1137d 100755 --- a/squid/squid-auth.pl +++ b/squid/squid-auth.pl @@ -2,20 +2,24 @@ # squid-auth.pl # A basic squid authentication program -open(AUTH, $ARGV[0]); -while() { +use strict; +use warnings; + +my %auth; +open(my $fh, $ARGV[0]); +while(<$fh>) { s/\r|\n//g; s/#.*$//; if (/^(\S+):(\S+)/) { $auth{$1} = $2; } } -close(AUTH); +close($fh); $| = 1; while() { s/\r|\n//g; - local ($u, $p) = split(/\s+/, $_); + my ($u, $p) = split(/\s+/, $_); print $auth{$u} && $auth{$u} eq crypt($p, $auth{$u}) ? "OK\n" : "ERR\n"; }