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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 7, 2010, 05:28 UTC
Message-ID
<7vwrt7zwqe.fsf@alter.siamese.dyndns.org>
In-Reply-To
<AANLkTik0pMkYDHZD9jgzn3OaGUdyeiFwAv7o3OTUmEvO@mail.gmail.com>
Áshin László <ashinlaszlo@gmail.com> writes:
> No need to check for more lines of the authentication database after found a
> matching one.
s/found/finding/;

But I see a bigger issue here. Is it plausible that you might want to allow two entries for one user, with two different passwords, in an authdb file? The current code allows it, but if we want to disallow it, we could instead add your "last", like this, if you do not break the structure of the conditional statements in the original code.

	while (<$passwd>) {
		if (m{^\Q$user\E:(.*)}) {
			if (crypt($user, $password) eq $1) {
				$auth_ok = 1;
			}
			last;
		}
	}
Or have the "last" inside the inner "if" statement to keep that logic.

Either way I think the original nested "if" is much easier to read than your version.

Previous: Áshin László
Message 2 of 2 in “git-cvsserver: break the loop after successful hit”
  1. 4/5 git-cvsserver: break the loop after successful hitÁshin László, Jul 6, 2010
  2. Junio C HamanoJul 7, 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.