check the length of passphrase and SSID at the beginning
This commit is contained in:
parent
f66819c145
commit
5ff7503e01
23
create_ap
23
create_ap
@ -566,10 +566,21 @@ else
|
|||||||
INTERNET_IFACE=$2
|
INTERNET_IFACE=$2
|
||||||
fi
|
fi
|
||||||
if tty -s; then
|
if tty -s; then
|
||||||
read -p "SSID: " SSID
|
while :; do
|
||||||
|
read -p "SSID: " SSID
|
||||||
|
if [[ ${#SSID} -lt 1 || ${#SSID} -gt 32 ]]; then
|
||||||
|
echo "ERROR: Invalid SSID length ${#SSID} (expected 1..32)" >&2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
done
|
||||||
while :; do
|
while :; do
|
||||||
read -p "Passphrase: " -s PASSPHRASE
|
read -p "Passphrase: " -s PASSPHRASE
|
||||||
echo
|
echo
|
||||||
|
if [[ ${#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
|
read -p "Retype passphrase: " -s PASSPHRASE2
|
||||||
echo
|
echo
|
||||||
if [[ "$PASSPHRASE" != "$PASSPHRASE2" ]]; then
|
if [[ "$PASSPHRASE" != "$PASSPHRASE2" ]]; then
|
||||||
@ -589,6 +600,16 @@ if [[ "$SHARE_METHOD" != "none" ]] && ! is_interface $INTERNET_IFACE; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ${#SSID} -lt 1 || ${#SSID} -gt 32 ]]; then
|
||||||
|
echo "ERROR: Invalid SSID length ${#SSID} (expected 1..32)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -lt 8 ]] || [[ ${#PASSPHRASE} -gt 63 ]]; then
|
||||||
|
echo "ERROR: Invalid passphrase length ${#PASSPHRASE} (expected 8..63)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$SHARE_METHOD" == "bridge" ]]; then
|
if [[ "$SHARE_METHOD" == "bridge" ]]; then
|
||||||
OLD_BRIDGE_IPTABLES=$(cat /proc/sys/net/bridge/bridge-nf-call-iptables)
|
OLD_BRIDGE_IPTABLES=$(cat /proc/sys/net/bridge/bridge-nf-call-iptables)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user