Skip to content

Commit

Permalink
git-cvsserver: indent & clean up authdb code
Browse files Browse the repository at this point in the history
 - 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>
  • Loading branch information
Ævar Arnfjörð Bjarmason authored and Junio C Hamano committed May 20, 2010
1 parent c057bad commit 3052525
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions git-cvsserver.perl
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,19 @@
print "I HATE YOU\n";
exit 1;
}
my $auth_ok;
open PASSWD, "<$cfg->{gitcvs}->{authdb}" or die $!;
while(<PASSWD>) {
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;
}
Expand Down

0 comments on commit 3052525

Please sign in to comment.