Skip to contentSkip to conversation

cvsimport does not work with passwords ?

PATCH In review Marcin Wiśnicki 4 participants 8 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

I have to import part of public cvs repository that is protected by password (which is "anoncvs"):

Quoted 2 lines

export CVSROOT=:pserver:[email protected]:/home/ncvs cvs login

And now I can use cvs and cvsps, when I try git however:

Quoted 1 line

git cvsimport -vk projects/pkgtools

AuthReply: I HATE YOU

It seems that it does not send the password. From captured network conversation:

-> BEGIN AUTH REQUEST
-> /home/ncvs
-> anoncvs
-> A
-> END AUTH REQUEST
<- I HATE YOU

But cat ~/.cvspass:
/1 :pserver:[email protected]:2401/home/ncvs Ay=0=h<Z

So why is git not sending the password ?

#1 lore raw
Quoted 3 lines · Marcin Wiśnicki
Quoted 1 line

git cvsimport -vk projects/pkgtools

AuthReply: I HATE YOU

Forgot to mention:

Quoted 1 line

git --version

git version 1.7.4.4

#2 lore raw
In reply to Marcin Wiśnicki
Quoted 6 lines · Marcin Wiśnicki

I have to import part of public cvs repository that is protected by password (which is "anoncvs"):

Quoted 2 lines

export CVSROOT=:pserver:[email protected]:/home/ncvs cvs login

I have tried another mirror that uses ssh:

Quoted 2 lines

export CVSROOT=:ext:[email protected]:/home/ncvs export SSH_RSH=ssh

And this also does not work because git tries to use rsh. According to google this should work.

Any ideas why cvsimport is so broken for me ?

#3 lore raw
Quoted 9 lines · Marcin Wiśnicki

I have tried another mirror that uses ssh:

Quoted 2 lines

export CVSROOT=:ext:[email protected]:/home/ncvs export SSH_RSH=ssh

And this also does not work because git tries to use rsh. According to google this should work.

Any ideas why cvsimport is so broken for me ?

It has (thankfully) been a long time since I've had to touch CVS, but shouldn't that be CVS_RSH on the second line?

-Peff

#4 lore raw
Quoted 10 lines · Jeff King
Quoted 8 lines · Marcin Wiśnicki

I have tried another mirror that uses ssh:

Quoted 2 lines

export CVSROOT=:ext:[email protected]:/home/ncvs export SSH_RSH=ssh

And this also does not work because git tries to use rsh. According to google this should work.

Quoted 6 lines
Quoted 1 line

Any ideas why cvsimport is so broken for me ?

It has (thankfully) been a long time since I've had to touch CVS, but shouldn't that be CVS_RSH on the second line?

-Peff

Ahh yes indeed. I made a silly typo, now it works.

#6 lore raw

PATCH 1/1 git-cvsimport: normalize hostname for password lookup

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

---
 git-cvsimport.perl |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
git-cvsimport.perl +4 -0
index bbf327f..046fe32 100755
@@ -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:[email protected]:/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) {
Signature · 7 lines
1.7.5


-- 
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#7 lore raw

Re: [PATCH] git-cvsimport: normalize hostname for password lookup

Quoted 14 lines · Andreas Schwab
git-cvsimport.perl +2 -0
index bbf327f..046fe32 100755
@@ -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";

git-cvsimport.perl sub conn { · line 272

Quoted 8 lines
git-cvsimport.perl +2 -0
@@ -263,6 +265,8 @@ sub conn {
 				# :pserver:[email protected]:/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) {

If I correctly recall what I found out from cvs's changelog while looking at
http://thread.gmane.org/gmane.comp.version-control.git/163979/focus=167178
I think the versioned entries are already downcased, so the above, including the "FIXME", looks correct.

As I wrote in another message in that thread, I think this codepath should be refactored a bit better so that it can handle subtle differences between versions and implementations of cvs itself, and also these versioned entries. A good first step might be to separate out the body of the innermost loop we see here that process one entry from the cvspass file into a helper function.

Can you give an eyeball on the update of 077aac1 (Look for password in both CVS and CVSNT password files., 2011-02-18) posted by Guy Rouillier today and help testing it, and put this fix on top that?

Thanks.