summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-03-27 16:06:18 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-03-27 16:06:18 +0000
commitcfa6ec26232bc10d83e96f32833e24d0c8d8478d (patch)
treeeee5fba2786dbc16e6b88435d4f1445f6e15c559 /urpm
parentca60d227ae2946b191b4df07c5f572bee87ec656 (diff)
downloadurpmi-cfa6ec26232bc10d83e96f32833e24d0c8d8478d.tar
urpmi-cfa6ec26232bc10d83e96f32833e24d0c8d8478d.tar.gz
urpmi-cfa6ec26232bc10d83e96f32833e24d0c8d8478d.tar.bz2
urpmi-cfa6ec26232bc10d83e96f32833e24d0c8d8478d.tar.xz
urpmi-cfa6ec26232bc10d83e96f32833e24d0c8d8478d.zip
- urpmi.update, urpmi.addmedia:
o do not restrict read on /etc/urpmi/proxy.cfg if it doesn't contain passwords (#39434)
Diffstat (limited to 'urpm')
-rw-r--r--urpm/download.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index 801fc980..27f03f98 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -65,22 +65,27 @@ sub load_proxy_config () {
sub dump_proxy_config () {
$proxy_config or return 0; #- hasn't been read yet
+ my $has_password;
+
open my $f, '>', $PROXY_CFG or return 0;
foreach ('', sort grep { !/^(|cmd_line)$/ } keys %$proxy_config) {
my $m = $_ eq '' ? '' : "$_:";
my $p = $proxy_config->{$_};
foreach (qw(http_proxy ftp_proxy)) {
- defined $p->{$_} && $p->{$_} ne ''
- and print $f "$m$_=$p->{$_}\n";
+ if (defined $p->{$_} && $p->{$_} ne '') {
+ print $f "$m$_=$p->{$_}\n";
+ $has_password ||= hide_password($p->{$_}) ne $p->{$_};
+ }
}
if ($p->{ask}) {
print $f "${m}proxy_user_ask\n";
} elsif (defined $p->{user} && $p->{user} ne '') {
print $f "${m}proxy_user=$p->{user}:$p->{pwd}\n";
+ $has_password ||= $p->{pwd};
}
}
close $f;
- chmod 0600, $PROXY_CFG; #- may contain passwords
+ chmod 0600, $PROXY_CFG if $has_password;
return 1;
}