git-cvsserver: indent & clean up authdb code

- 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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Ævar Arnfjörð Bjarmason 2010-05-15 02:46:01 +00:00 committed by Junio C Hamano
parent c057bad370
commit 3052525eff
1 changed files with 13 additions and 10 deletions

View File

@ -194,15 +194,18 @@ if ($state->{method} eq 'pserver') {
print "I HATE YOU\n"; print "I HATE YOU\n";
exit 1; exit 1;
} }

my $auth_ok; my $auth_ok;
open PASSWD, "<$cfg->{gitcvs}->{authdb}" or die $!; open my $passwd, "<", $cfg->{gitcvs}->{authdb} or die $!;
while(<PASSWD>) { while (<$passwd>) {
if (m{^\Q$user\E:(.*)}) { if (m{^\Q$user\E:(.*)}) {
if (crypt($user, $1) eq $1) { if (crypt($user, $1) eq $1) {
$auth_ok = 1; $auth_ok = 1;
} }
}; };
} }
close $passwd;

unless ($auth_ok) { unless ($auth_ok) {
print "I HATE YOU\n"; print "I HATE YOU\n";
exit 1; exit 1;