Since ~/.netrc isn't widely used by most (if any) NNTP and IMAP
clients, we won't read it by default for lei. AFAIK, ~/.netrc
is mainly by FTP clients (e.g. ftp(1) and lftp(1)). wget uses
it by default for HTTP(S) (and FTP), but curl does not.
To avoid breaking stable release use cases, public-inbox-watch
continues to read ~/.netrc by default.
The --netrc switch is supported by all existing lei commands
which may use curl.
close $out_r or die "`git credential $op' failed: \$!=$! \$?=$?\n";
}
close $out_r or die "`git credential $op' failed: \$!=$! \$?=$?\n";
}
-sub check_netrc ($) {
- my ($self) = @_;
+sub check_netrc {
+ my ($self, $lei) = @_;
+
+ # n.b. lei doesn't load ~/.netrc by default, public-inbox-watch does,
+ # which may've been a mistake, but we have to live with it.
+ return if ($lei && !$lei->{opt}->{netrc});
# part of the standard library, but distributions may split it out
eval { require Net::Netrc };
# part of the standard library, but distributions may split it out
eval { require Net::Netrc };
$cred = undef;
}
if ($cred) {
$cred = undef;
}
if ($cred) {
- my $p = $cred->{password} // $cred->check_netrc;
+ my $p = $cred->{password} // $cred->check_netrc($lei);
$cred->fill($lei) unless defined($p); # may prompt user here
$mic->User($mic_arg->{User} = $cred->{username});
$mic->Password($mic_arg->{Password} = $cred->{password});
$cred->fill($lei) unless defined($p); # may prompt user here
$mic->User($mic_arg->{User} = $cred->{username});
$mic->Password($mic_arg->{Password} = $cred->{password});
}, 'PublicInbox::GitCredential';
($u, $p) = split(/:/, $ui, 2);
($cred->{username}, $cred->{password}) = ($u, $p);
}, 'PublicInbox::GitCredential';
($u, $p) = split(/:/, $ui, 2);
($cred->{username}, $cred->{password}) = ($u, $p);
- $p //= $cred->check_netrc;
+ $p //= $cred->check_netrc($lei);
}
my $common = $nn_common->{$sec} // {};
my $nn_arg = {
}
my $common = $nn_common->{$sec} // {};
my $nn_arg = {