git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-cvsserver: pserver-auth-script

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 2, 2010, 21:34 UTC
Message-ID
<AANLkTimts_MlrWGKaiu3frk7vOnK9B70RE7It2Wml3on@mail.gmail.com>
In-Reply-To
<m31vbloa6m.fsf@localhost.localdomain>
On Fri, Jul 2, 2010 at 21:31, Jakub Narebski <jnareb@gmail.com> wrote:
Show 18 quoted lines
> Æ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.
Show 20 quoted lines
> 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.

Show 14 quoted lines
>> > +            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
>
Previous: Jakub NarebskiNext: Áshin László
Message 6 of 8 in “git-cvsserver: pserver-auth-script”
  1. git-cvsserver: pserver-auth-scriptLászló ÁSHIN, Jul 2, 2010
  2. Ævar Arnfjörð BjarmasonJul 2, 2010
  3. Ævar Arnfjörð BjarmasonJul 2, 2010
  4. Ævar Arnfjörð BjarmasonJul 2, 2010
  5. Jakub NarebskiJul 2, 2010
  6. Ævar Arnfjörð BjarmasonJul 2, 2010
  7. Áshin LászlóJul 3, 2010
  8. Ævar Arnfjörð BjarmasonJul 3, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.