From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jakub Narebski <jnareb@gmail.com>
Cc: "László ÁSHIN" <laszlo.ashin@neti.hu>, git@vger.kernel.org
Subject: Re: [PATCH] git-cvsserver: pserver-auth-script
Date: Fri, 2 Jul 2010 21:34:11 +0000 [thread overview]
Message-ID: <AANLkTimts_MlrWGKaiu3frk7vOnK9B70RE7It2Wml3on@mail.gmail.com> (raw)
In-Reply-To: <m31vbloa6m.fsf@localhost.localdomain>
On Fri, Jul 2, 2010 at 21:31, Jakub Narebski <jnareb@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>> On Fri, Jul 2, 2010 at 07:54, László ÁSHIN <laszlo.ashin@neti.hu> wrote:
>>
>> > +
>> > + open SCRIPTIN, '|' . $authscript or die $!;
>> > + print SCRIPTIN $user . "\n";
>> > + print SCRIPTIN descramble($password) . "\n";
>> > + close SCRIPTIN;
>>
>> Nit: Nice use of three-arg open, but you should use lexical
>> filehandles instead. I.e.:
>>
>> open my $script, '|' . $authscript or die $!;
>> ...
>
> This is two-argument open, not three-argument magic open. There is
> string concatenation operator '.' there, not a comma ',' delimiting
> arguments.
Well spotted, I misread that.
> It should be
>
> open my $script_fd, '|-', $authscript
> or die "Couldn't open authentication script '$authscript': $!";
>
>> > + } else {
>> > + if (not exists $cfg->{gitcvs}->{authdb}) {
>
> Why not elsif?
>
>> > + print "E the repo config file needs a [gitcvs] section with an 'authdb' parameter set to the filename of the authentication database\n";
>
> Overly long line. Perhaps it would be better to split it into
> concatenated parts.
>
>
>> > + my $auth_ok;
>> > + open my $passwd, "<", $authdb or die $!;
>
> And here you use three-argument form of (ordinary) open.
This and the code below were already part of the code. But the patch
would be better if it didn't move so much code around so that this
would be obvious.
>> > + while (<$passwd>) {
>> > + if (m{^\Q$user\E:(.*)}) {
>> > + if (crypt($user, descramble($password)) eq $1) {
>
> Why nested if, and not short-circuit &&?
>
> + if (/^\Q$user\E:(.*)/ &&
> + crypt($user, descramble($password)) eq $1) {
>
> --
> Jakub Narebski
> Poland
> ShadeHawk on #git
>
next prev parent reply other threads:[~2010-07-02 21:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-02 7:54 [PATCH] git-cvsserver: pserver-auth-script László ÁSHIN
2010-07-02 14:33 ` Ævar Arnfjörð Bjarmason
2010-07-02 14:39 ` Ævar Arnfjörð Bjarmason
2010-07-02 15:04 ` Ævar Arnfjörð Bjarmason
2010-07-02 21:31 ` Jakub Narebski
2010-07-02 21:34 ` Ævar Arnfjörð Bjarmason [this message]
2010-07-03 9:28 ` Áshin László
2010-07-03 10:49 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTimts_MlrWGKaiu3frk7vOnK9B70RE7It2Wml3on@mail.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=laszlo.ashin@neti.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).