From 3052525effbf4b9ab0cc4a66fe32f0f7261b7323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sat, 15 May 2010 02:46:01 +0000 Subject: [PATCH] git-cvsserver: indent & clean up authdb code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Indent the last commit to fit with the rest of the code. - Use lexical filehandles instead of global globs - Close the filehandle after the password database has been read. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- git-cvsserver.perl | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 8b97fb80cf..ed1d5b9d60 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -194,16 +194,19 @@ print "I HATE YOU\n"; exit 1; } - my $auth_ok; - open PASSWD, "<$cfg->{gitcvs}->{authdb}" or die $!; - while() { - if (m{^\Q$user\E:(.*)}) { - if (crypt($user, $1) eq $1) { - $auth_ok = 1; - } - }; - } - unless ($auth_ok) { + + my $auth_ok; + open my $passwd, "<", $cfg->{gitcvs}->{authdb} or die $!; + while (<$passwd>) { + if (m{^\Q$user\E:(.*)}) { + if (crypt($user, $1) eq $1) { + $auth_ok = 1; + } + }; + } + close $passwd; + + unless ($auth_ok) { print "I HATE YOU\n"; exit 1; }