[PATCH 4/5] git-cvsserver: break the loop after successful hit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No need to check for more lines of the authentication database after found a
matching one.
---
 git-cvsserver.perl |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index e842d77..cd461ac 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -248,11 +248,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.0.4
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]