diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2013-10-21 16:47:21 +0200 |
---|---|---|
committer | Jouke Witteveen <j.witteveen@gmail.com> | 2013-10-23 01:42:35 +0200 |
commit | f50656d00cac5125b0fd8ae7dbfa314b83597ad4 (patch) | |
tree | 2a17bac2e001558c6c0e7d5cc48624cccd674dbf /src | |
parent | 0c85a0d981c403a438e671af510a733a319b1b97 (diff) | |
download | netctl-f50656d00cac5125b0fd8ae7dbfa314b83597ad4.tar.gz netctl-f50656d00cac5125b0fd8ae7dbfa314b83597ad4.tar.xz |
Better detection of hex keys
Hex WEP keys are of even length, ASCII keys are of odd length.
Using this information we make wifi-menu work better for WEP networks.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/wpa | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/wpa b/src/lib/wpa index d79fdbe..ff6d9ab 100644 --- a/src/lib/wpa +++ b/src/lib/wpa @@ -219,11 +219,15 @@ wpa_make_config_block() { wep) echo "key_mgmt=NONE" echo "wep_tx_keyidx=0" - echo "wep_key0=$(wpa_quote "$Key")" + if (( ${#Key} % 2 == 0 )) && [[ "$key" = +([[:xdigit:]]) ]]; then + echo "wep_key0=$Key" + else + echo "wep_key0=$(wpa_quote "$Key")" + fi ;; wpa) echo "proto=RSN WPA" - if [[ "${#Key}" -eq 64 ]]; then + if [[ "${#key}" -eq 64 && "$key" = +([[:xdigit:]]) ]]; then echo "psk=$Key" else echo "psk=$(wpa_quote "$Key")" |