summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-31 10:02:21 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-31 10:02:21 +0000
commite80554c3d3a5867300526ee7316339a2a50a1a5f (patch)
tree976b9e4a8a9c795a0a1f26bf424a2005c3fc0e51 /lib
parent28e8f93e28e92e3a0976dcd36aec43b87dc935a4 (diff)
downloaddrakx-net-e80554c3d3a5867300526ee7316339a2a50a1a5f.tar
drakx-net-e80554c3d3a5867300526ee7316339a2a50a1a5f.tar.gz
drakx-net-e80554c3d3a5867300526ee7316339a2a50a1a5f.tar.bz2
drakx-net-e80554c3d3a5867300526ee7316339a2a50a1a5f.tar.xz
drakx-net-e80554c3d3a5867300526ee7316339a2a50a1a5f.zip
ensure that WPA keys are 8-63 long if ASCII, 64 is hex
Diffstat (limited to 'lib')
-rw-r--r--lib/network/connection/wireless.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/network/connection/wireless.pm b/lib/network/connection/wireless.pm
index 59d1da2..1412000 100644
--- a/lib/network/connection/wireless.pm
+++ b/lib/network/connection/wireless.pm
@@ -518,6 +518,13 @@ sub check_network_access_settings {
return 0;
}
+ if ($self->{access}{network}{encryption} eq 'wpa-psk' &&
+ !convert_psk_key_for_wpa_supplicant($self->{access}{network}{key})) {
+ $self->{network_access}{error}{message} = N("The pre-shared key should have between 8 and 63 ASCII characters, or 64 hexadecimal characters.");
+ $self->{network_access}{error}{field} = \$self->{access}{network}{key};
+ return 0;
+ }
+
if ($self->{ifcfg}{WIRELESS_FREQ} && $self->{ifcfg}{WIRELESS_FREQ} !~ /[0-9.]*[kGM]/) {
$self->{network_access}{error}{message} = N("Freq should have the suffix k, M or G (for example, \"2.46G\" for 2.46 GHz frequency), or add enough '0' (zeroes).");
$self->{network_access}{error}{field} = \$self->{ifcfg}{WIRELESS_FREQ};