threads / discuss / 27212

cvsimport does not work with passwords ?

Subject: cvsimport does not work with passwords ?

## tl;dr

8 messages between Apr 28, 2011 and Apr 29, 2011.

replies: 7people: 4as markdown or json

Marcin Wiśnicki· Apr 28, 2011, 20:59 UTC · lore

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

> export CVSROOT=:pserver:anoncvs@anoncvs.fr.FreeBSD.org:/home/ncvs
> cvs login
And now I can use cvs and cvsps, when I try git however:
> 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:anoncvs@anoncvs.fr.freebsd.org:2401/home/ncvs Ay=0=h<Z

So why is git not sending the password ?
Marcin Wiśnicki· Apr 28, 2011, 21:35 UTC · re: Marcin Wiśnicki · lore

Re: cvsimport does not work with passwords ?

On Thu, 28 Apr 2011 20:59:57 +0000, Marcin Wiśnicki wrote:
Show 6 quoted lines
> I have to import part of public cvs repository that is protected by
> password (which is "anoncvs"):
> 
>> export CVSROOT=:pserver:anoncvs@anoncvs.fr.FreeBSD.org:/home/ncvs cvs
>> login
> 
I have tried another mirror that uses ssh:
> export CVSROOT=:ext:anoncvs@anoncvs1.FreeBSD.org:/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 ?
Jeff King· Apr 28, 2011, 22:45 UTC · re: Marcin Wiśnicki · lore

Re: cvsimport does not work with passwords ?

On Thu, Apr 28, 2011 at 09:35:53PM +0000, Marcin Wiśnicki wrote:
Show 9 quoted lines
> I have tried another mirror that uses ssh:
> 
> > export CVSROOT=:ext:anoncvs@anoncvs1.FreeBSD.org:/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
Marcin Wiśnicki· Apr 28, 2011, 22:50 UTC · re: Jeff King · lore

Re: cvsimport does not work with passwords ?

On Thu, 28 Apr 2011 18:45:10 -0400, Jeff King wrote:
Show 16 quoted lines
> On Thu, Apr 28, 2011 at 09:35:53PM +0000, Marcin Wiśnicki wrote:
> 
>> I have tried another mirror that uses ssh:
>> 
>> > export CVSROOT=:ext:anoncvs@anoncvs1.FreeBSD.org:/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
Ahh yes indeed. I made a silly typo, now it works.
Andreas Schwab· Apr 29, 2011, 11:33 UTC · re: Marcin Wiśnicki · lore

Re: cvsimport does not work with passwords ?

Marcin Wiśnicki <mwisnicki@gmail.com> writes:
>> export CVSROOT=:pserver:anoncvs@anoncvs.fr.FreeBSD.org:/home/ncvs
> /1 :pserver:anoncvs@anoncvs.fr.freebsd.org:2401/home/ncvs Ay=0=h<Z
Note the different case.
Andreas.
-- 
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."
Andreas Schwab· Apr 29, 2011, 13:09 UTC · re: Andreas Schwab · lore

[PATCH] 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.

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."
Junio C Hamano· Apr 29, 2011, 16:33 UTC · re: Andreas Schwab · lore

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

Andreas Schwab <schwab@linux-m68k.org> writes:
Show 22 quoted lines
> 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) {

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.

← back to recent threads