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

[PATCH 4/4] git-cvsserver: break from loop after a successful hit

From
ÁLÁshin László <ashinlaszlo@gmail.com>
Date
Jul 3, 2010, 21:24 UTC
Message-ID
<AANLkTimPJPv0RieGQcXyJULFDcapVM74JCXcM9LU8CEQ@mail.gmail.com>
No need to check for more lines of the authentication database after found a
matching line.
---
 git-cvsserver.perl |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 01c5b21..fa2a11e 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -242,11 +242,10 @@ if ($state->{method} eq 'pserver') {
        my $auth_ok;
        open my $passwd, "<", $authdb or die $!;
        while (<$passwd>) {
-            if (m{^\Q$user\E:(.*)}) {
-                if (crypt($user, $password) eq $1) {
-                    $auth_ok = 1;
-                }
-            };
+            if (m{^\Q$user\E:(.*)} && crypt($user, $password) eq $1) {
+                $auth_ok = 1;
+                last;
+            }
        }
        close $passwd;

--
1.7.2.rc1.dirty
Next: Ævar Arnfjörð Bjarmason
Message 1 of 2 in “git-cvsserver: break from loop after a successful hit”
  1. 4/4 git-cvsserver: break from loop after a successful hitÁshin László, Jul 3, 2010
  2. Æ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.