commit 8c7c5dba27a7d426961d95926f905f13d3247a0d parent f62b410aaa688544eb3993f575c84017ad184f57 Author: oblique <psyberbits@gmail.com> Date: Sat, 23 May 2015 20:57:15 +0300 When we read PSK from stdin, don't hide it from the user. Diffstat:
M | create_ap | | | 32 | ++++++++++++++++++-------------- |
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/create_ap b/create_ap @@ -1087,23 +1087,27 @@ else break done while :; do - read -p "Passphrase: " -s PASSPHRASE - echo - if [[ $USE_PSK -eq 1 ]]; then - if [[ ${#PASSPHRASE} -ne 64 ]]; then - echo "ERROR: Invalid pre-shared-key length ${#PASSPHRASE} (expected 64)" >&2 + if [[ $USE_PSK -eq 0 ]]; then + read -p "Passphrase: " -s PASSPHRASE + echo + if [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -lt 8 ]] || [[ ${#PASSPHRASE} -gt 63 ]]; then + echo "ERROR: Invalid passphrase length ${#PASSPHRASE} (expected 8..63)" >&2 continue fi - elif [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -lt 8 ]] || [[ ${#PASSPHRASE} -gt 63 ]]; then - echo "ERROR: Invalid passphrase length ${#PASSPHRASE} (expected 8..63)" >&2 - continue - fi - read -p "Retype passphrase: " -s PASSPHRASE2 - echo - if [[ "$PASSPHRASE" != "$PASSPHRASE2" ]]; then - echo "Passphrases do not match." + read -p "Retype passphrase: " -s PASSPHRASE2 + echo + if [[ "$PASSPHRASE" != "$PASSPHRASE2" ]]; then + echo "Passphrases do not match." + else + break + fi else - break + read -p "PSK: " PASSPHRASE + echo + if [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -ne 64 ]]; then + echo "ERROR: Invalid pre-shared-key length ${#PASSPHRASE} (expected 64)" >&2 + continue + fi fi done else