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

Subsystems: the rest

DORMANTno replies

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Áshin László <hidden>
Date: 2016-06-15 22:49:04

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

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

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:49:04

On Sat, Jul 3, 2010 at 21:24, Áshin László [off-list ref] wrote:
No need to check for more lines of the authentication database after found a
matching line.
Indeed.

Acked-by: Ævar Arnfjörð Bjarmason <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help