summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/network/adsl.pm13
1 files changed, 12 insertions, 1 deletions
diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm
index 92106940d..e712e24f7 100644
--- a/perl-install/network/adsl.pm
+++ b/perl-install/network/adsl.pm
@@ -73,10 +73,21 @@ sub adsl_ask_info {
my ($adsl, $netc, $_intf, $adsl_type) = @_;
my $pppoe_file = "/etc/ppp/pppoe.conf";
my $pppoe_conf = { getVarsFromSh($pppoe_file) } if $adsl_type =~ /pppoe/ && -f $pppoe_file;
+ my $login = $pppoe_conf->{USER};
+ foreach (qw(/etc/ppp/peers/adsl /etc/ppp/options)) {
+ next if $login && ! -r $_;
+ ($login) = map { if_(/^user\s+\"([^\"]+)\"/, $1) } cat_($_);
+ }
+ my $passwd = passwd_by_login($pppoe_conf->{USER});
+ foreach (qw(/etc/ppp/pap-secrets /etc/ppp/chap-secrets)) {
+ next if $passwd && ! -r $_;
+ my $qlogin = quotemeta $login;
+ ($passwd) = map { if_(/^(['"]?)$qlogin\1\s+\S+\s+(['"]?)(\S*)\2/, $3) } cat_($_);
+ }
$pppoe_conf->{DNS1} ||= '';
$pppoe_conf->{DNS2} ||= '';
add2hash($netc, { dnsServer2 => $pppoe_conf->{DNS1}, dnsServer3 => $pppoe_conf->{DNS2}, DOMAINNAME2 => '' });
- add2hash($adsl, { login => $pppoe_conf->{USER}, passwd => passwd_by_login($pppoe_conf->{USER}), passwd2 => '' });
+ add2hash($adsl, { login => $user, passwd => $passwd, passwd2 => '' });
ask_info2($adsl, $netc);
}