git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: "Marcin Wiśnicki" <mwisnicki@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH] git-cvsimport: normalize hostname for password lookup
Date: Fri, 29 Apr 2011 15:09:51 +0200	[thread overview]
Message-ID: <m2oc3pxkyo.fsf_-_@igel.home> (raw)
In-Reply-To: <m2sjt1xpfj.fsf@igel.home> (Andreas Schwab's message of "Fri, 29 Apr 2011 13:33:20 +0200")

When looking up the pserver password in .cvspass normalize the hostname
part of the address by converting it to lowercase.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
 git-cvsimport.perl |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index bbf327f..046fe32 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -249,6 +249,8 @@ sub conn {
 
 		# if username is not explicit in CVSROOT, then use current user, as cvs would
 		$user=(getlogin() || $ENV{'LOGNAME'} || $ENV{'USER'} || "anonymous") unless $user;
+		# Normalize hostname for lookup in .cvspass
+		$serv = lc $serv;
 		my $rr2 = "-";
 		unless ($port) {
 			$rr2 = ":pserver:$user\@$serv:$repo";
@@ -263,6 +265,8 @@ sub conn {
 				# :pserver:cvs@mea.tmt.tele.fi:/cvsroot/zmailer Ah<Z
 				while (<H>) {
 					chomp;
+					# FIXME: entries without version prefix
+					# may need to be normalized
 					s/^\/\d+\s+//;
 					my ($w,$p) = split(/\s/,$_,2);
 					if ($w eq $rr or $w eq $rr2) {
-- 
1.7.5


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  reply	other threads:[~2011-04-29 13:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28 20:59 cvsimport does not work with passwords ? Marcin Wiśnicki
2011-04-28 21:03 ` Marcin Wiśnicki
2011-04-28 21:35 ` Marcin Wiśnicki
2011-04-28 22:45   ` Jeff King
2011-04-28 22:50     ` Marcin Wiśnicki
2011-04-29 11:33 ` Andreas Schwab
2011-04-29 13:09   ` Andreas Schwab [this message]
2011-04-29 16:33     ` [PATCH] git-cvsimport: normalize hostname for password lookup Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2oc3pxkyo.fsf_-_@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=git@vger.kernel.org \
    --cc=mwisnicki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).