From fb85fae46c73c7cab5d5965fa1281c76a8007bad Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 24 Jun 2004 05:32:13 +0000 Subject: properly handle ascii WEP keys (#9884) --- perl-install/network/tools.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'perl-install/network/tools.pm') 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; -- cgit v1.2.1