summaryrefslogtreecommitdiffstats
path: root/perl-install/network/tools.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-06-24 05:32:13 +0000
committerOlivier Blin <oblin@mandriva.org>2004-06-24 05:32:13 +0000
commitfb85fae46c73c7cab5d5965fa1281c76a8007bad (patch)
tree7513b5ae2b97773c0698086ef7ba98ef673ea242 /perl-install/network/tools.pm
parentfa6ef617411bdf2082f01cd02a977207f41840a8 (diff)
downloaddrakx-fb85fae46c73c7cab5d5965fa1281c76a8007bad.tar
drakx-fb85fae46c73c7cab5d5965fa1281c76a8007bad.tar.gz
drakx-fb85fae46c73c7cab5d5965fa1281c76a8007bad.tar.bz2
drakx-fb85fae46c73c7cab5d5965fa1281c76a8007bad.tar.xz
drakx-fb85fae46c73c7cab5d5965fa1281c76a8007bad.zip
properly handle ascii WEP keys (#9884)
Diffstat (limited to 'perl-install/network/tools.pm')
-rw-r--r--perl-install/network/tools.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index 4726e1350..e49e8dc2b 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -189,4 +189,21 @@ sub reread_net_conf {
network::network::probe_netcnx_type('', $netc, $intf, $netcnx);
}
+sub convert_wep_key_for_iwconfig {
+ #- 5 or 13 characters, consider the key as ASCII and prepend "s:"
+ #- else consider the key as hexadecimal, do not strip dashes
+ #- always quote the key as string
+ my ($key) = @_;
+ unquotify \$key;
+ member(length($key), (5, 13)) ? qq("s:$key") : qq("$key");
+}
+
+sub get_wep_key_from_iwconfig {
+ #- strip "s:" if the key is 5 or 13 characters (ASCII)
+ #- else the key as hexadecimal, do not modify
+ my ($key) = @_;
+ $key =~ s/^s:// if member(length($key), (7,15));
+ $key;
+}
+
1;