зеркало из https://github.com/microsoft/git.git
Merge branch 'gr/cvsimport-alternative-cvspass-location'
* gr/cvsimport-alternative-cvspass-location: Look for password in both CVS and CVSNT password files.
This commit is contained in:
Коммит
2da61dcf9e
|
@ -227,6 +227,31 @@ sub new {
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub find_password_entry {
|
||||||
|
my ($cvspass, @cvsroot) = @_;
|
||||||
|
my ($file, $delim) = @$cvspass;
|
||||||
|
my $pass;
|
||||||
|
local ($_);
|
||||||
|
|
||||||
|
if (open(my $fh, $file)) {
|
||||||
|
# :pserver:cvs@mea.tmt.tele.fi:/cvsroot/zmailer Ah<Z
|
||||||
|
CVSPASSFILE:
|
||||||
|
while (<$fh>) {
|
||||||
|
chomp;
|
||||||
|
s/^\/\d+\s+//;
|
||||||
|
my ($w, $p) = split($delim,$_,2);
|
||||||
|
for my $cvsroot (@cvsroot) {
|
||||||
|
if ($w eq $cvsroot) {
|
||||||
|
$pass = $p;
|
||||||
|
last CVSPASSFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close($fh);
|
||||||
|
}
|
||||||
|
return $pass;
|
||||||
|
}
|
||||||
|
|
||||||
sub conn {
|
sub conn {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $repo = $self->{'fullrep'};
|
my $repo = $self->{'fullrep'};
|
||||||
|
@ -259,19 +284,23 @@ sub conn {
|
||||||
if ($pass) {
|
if ($pass) {
|
||||||
$pass = $self->_scramble($pass);
|
$pass = $self->_scramble($pass);
|
||||||
} else {
|
} else {
|
||||||
open(H,$ENV{'HOME'}."/.cvspass") and do {
|
my @cvspass = ([$ENV{'HOME'}."/.cvspass", qr/\s/],
|
||||||
# :pserver:cvs@mea.tmt.tele.fi:/cvsroot/zmailer Ah<Z
|
[$ENV{'HOME'}."/.cvs/cvspass", qr/=/]);
|
||||||
while (<H>) {
|
my @loc = ();
|
||||||
chomp;
|
foreach my $cvspass (@cvspass) {
|
||||||
s/^\/\d+\s+//;
|
my $p = find_password_entry($cvspass, $rr, $rr2);
|
||||||
my ($w,$p) = split(/\s/,$_,2);
|
if ($p) {
|
||||||
if ($w eq $rr or $w eq $rr2) {
|
push @loc, $cvspass->[0];
|
||||||
$pass = $p;
|
$pass = $p;
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
$pass = "A" unless $pass;
|
|
||||||
|
if (1 < @loc) {
|
||||||
|
die("Multiple cvs password files have ".
|
||||||
|
"entries for CVSROOT $opt_d: @loc");
|
||||||
|
} elsif (!$pass) {
|
||||||
|
$pass = "A";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($s, $rep);
|
my ($s, $rep);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче