summaryrefslogtreecommitdiffstats
path: root/perl-install/network/tools.pm
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-12-06 11:01:59 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-12-06 11:01:59 +0000
commitb8c50cf70eb80b5bcaedcaf6117549ff83bc36cd (patch)
treec8e340107a55c3b52c8d476a8cb613655c00856b /perl-install/network/tools.pm
parent9209a6b92d9c5a84e588f401aca4a1b17f43650e (diff)
downloaddrakx-backup-do-not-use-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.tar
drakx-backup-do-not-use-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.tar.gz
drakx-backup-do-not-use-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.tar.bz2
drakx-backup-do-not-use-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.tar.xz
drakx-backup-do-not-use-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.zip
isdn data are now fetched form system instead of drakconnect conf file
Diffstat (limited to 'perl-install/network/tools.pm')
-rw-r--r--perl-install/network/tools.pm34
1 files changed, 26 insertions, 8 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index c86f9de4c..b654e87f1 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -8,7 +8,7 @@ use MDK::Common::Globals "network", qw($in $prefix $disconnect_file $connect_pro
use MDK::Common::System qw(getVarsFromSh);
@ISA = qw(Exporter);
-@EXPORT = qw(write_cnx_script write_secret_backend write_initscript ask_connect_now connect_backend disconnect_backend read_providers_backend ask_info2 type2interface connected connected_bg test_connected connected2 disconnected);
+@EXPORT = qw(write_cnx_script write_secret_backend read_secret_backend passwd_by_login write_initscript ask_connect_now connect_backend disconnect_backend read_providers_backend ask_info2 type2interface connected connected_bg test_connected connected2 disconnected);
@EXPORT_OK = qw($in);
sub write_cnx_script {
@@ -33,21 +33,39 @@ sub write_secret_backend {
}
}
+sub unquotify {
+ my ($word) = @_;
+ ($a, $b, $c) = $$word =~ /"(.*)"|'(.*)'|(.*)/;
+ $$word = $a ? $a : $b ? $b : $c;
+}
+
sub read_secret_backend {
my $conf;
foreach my $i ("pap-secrets", "chap-secrets") {
foreach (cat_("$prefix/etc/ppp/$i")) {
my ($login, $server, $passwd) = split(' ');
- my ($a, $b, $c) = $passwd =~ /"(.*)"|'(.*)'|(.*)/;
- $passwd = $a ? $a : $b ? $b : $c;
- push @$conf, {login => $login,
- passwd => $passwd,
- server => $server };
+ if ($login && $passwd) {
+ unquotify \$passwd;
+ unquotify \$login;
+ unquotify \$server;
+ push @$conf, {login => $login,
+ passwd => $passwd,
+ server => $server };
+ }
}
}
$conf;
}
+sub passwd_by_login {
+ my ($login) = @_;
+
+ unquotify \$login;
+ my $secret = read_secret_backend();
+ foreach (@$secret) {
+ return $_->{passwd} if ($_->{login} eq $login);
+ }
+}
sub ask_connect_now {
my ($type) = @_;
@@ -68,8 +86,8 @@ sub ask_connect_now {
$up = connected();
}
my $m = $up ? N("The system is now connected to Internet.") .
- if_($::isInstall, N("For security reason, it will be disconnected now.")) :
- N("The system doesn't seem to be connected to internet.
+ if_($::isInstall, N("For security reason, it will be disconnected now.")) :
+ N("The system doesn't seem to be connected to internet.
Try to reconfigure your connection.");
if ($::isWizard) {
$::Wizard_no_previous = 1;