summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2012-08-11 16:16:52 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2012-08-13 09:05:26 +0200
commitbba8d3f50075695c3fb1d1bb6d623c1f6d41b7c0 (patch)
tree36183889be525bc549415eaf638f63cfbc197ec7
parent890a3c483644858615027c4f0358bbfb4e51f05f (diff)
downloadnetctl-bba8d3f50075695c3fb1d1bb6d623c1f6d41b7c0.tar.gz
netctl-bba8d3f50075695c3fb1d1bb6d623c1f6d41b7c0.tar.xz
Allow hex passphrase in wifi-menu
WPA allows the use of 64 digit hex passphrases. Allow this in wifi-menu as well.
-rwxr-xr-xscripts/wifi-menu15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/wifi-menu b/scripts/wifi-menu
index 043bc79..f46db0d 100755
--- a/scripts/wifi-menu
+++ b/scripts/wifi-menu
@@ -112,12 +112,15 @@ create_profile()
[[ "$OBSCURE" ]] && box="--insecure --passwordbox" || box="--inputbox"
msg="Enter $security security key for\n'$1'"
key=$(dialog $box "$msg" 10 40 --stdout) || return $?
- [[ "${#key}" -ge 8 && "${#key}" -le 63 ]] || return 4
- if [[ "$OBSCURE" ]]; then
- key=$(wpa_passphrase "$1" "$key" | grep -m 1 "^[[:space:]]*psk=")
- key=${key#*psk=}
- else
- key=$(printf "%q" "$key")
+ if [[ "${#key}" -ge 8 && "${#key}" -le 63 ]]; then
+ if [[ "$OBSCURE" ]]; then
+ key=$(wpa_passphrase "$1" "$key" | grep -m 1 "^[[:space:]]*psk=")
+ key=${key#*psk=}
+ else
+ key=$(printf "%q" "$key")
+ fi
+ elif ! [[ "${#key}" -eq 64 && "$key" = +([[:xdigit:]]) ]]; then
+ return 4
fi
fi
cat << EOF > "$PROFILE_DIR/$PROFILE"