git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] git-cvsserver: break from loop after a successful hit
@ 2010-07-03 21:24 Áshin László
  2010-07-03 22:20 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 2+ messages in thread
From: Áshin László @ 2010-07-03 21:24 UTC (permalink / raw)
  To: git

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-03 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-03 21:24 [PATCH 4/4] git-cvsserver: break from loop after a successful hit Áshin László
2010-07-03 22:20 ` Ævar Arnfjörð Bjarmason

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).