summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2019-09-14 11:38:46 +0000
committerkn <kn@openbsd.org>2019-09-14 11:38:46 +0000
commit8cb1af285baf807c12b3113cad2a9b1a19e91b73 (patch)
treee38486514271fb6f6ce3606a25349c61e012229b
parentin mta_relay_cmp() properly check that authlabel or backupname are not NULL (diff)
downloadwireguard-openbsd-8cb1af285baf807c12b3113cad2a9b1a19e91b73.tar.xz
wireguard-openbsd-8cb1af285baf807c12b3113cad2a9b1a19e91b73.zip
Support quoted SSIDs
Instead of ignoring SSIDs containing whitespaces, slightly adjust the commands to take everything in between 'nwid ' and ' chan' as SSID; if it has double quotes at start *and* end, simply remove those. This enables users to select networks such as "Unitymedia WifiSpot" and "FRITZ!Box 7490" for example which are common among the quoted ones at least in germany. The only SSIDs known to break this are those containing " chan " as this substring is used as delimiter. Picking "some chan 4 me" would therefore result in _nwid being assigned '"some' (literal double quote), but that seems reasonably acceptable compared to the current behaviour. Input rpe "Yes please" stsp
-rw-r--r--distrib/miniroot/install.sub13
1 files changed, 6 insertions, 7 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index ee6184b5f83..355c04fa4c3 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1140 2019/08/21 17:39:30 kn Exp $
+# $OpenBSD: install.sub,v 1.1141 2019/09/14 11:38:46 kn Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -1171,10 +1171,9 @@ v6_config() {
# Perform an 802.11 network scan on interface $1 and cache the result a file.
ieee80211_scan() {
- # N.B. Skipping quoted nwid's for now.
[[ -f $WLANLIST ]] ||
ifconfig $1 scan |
- sed -n 's/^ nwid \([^"]\)/\1/p' >$WLANLIST
+ sed -n 's/^[[:space:]]*nwid \(.*\) chan [0-9]* bssid \([[:xdigit:]:]*\).*/\1 (\2)/p' >$WLANLIST
cat $WLANLIST
}
@@ -1194,12 +1193,12 @@ ieee80211_config() {
ask_until "Access point? (ESSID, 'any', list# or '?')" "any"
case "$resp" in
+([0-9]))
- _nwid=$(ieee80211_scan $_if | sed -n "${resp}s/ .*//p")
+ _nwid=$(ieee80211_scan $_if |
+ sed -n ${resp}'{s/ ([[:xdigit:]:]*)$//p;q;}')
[[ -z $_nwid ]] && echo "There is no line $resp."
+ [[ $_nwid = \"*\" ]] && _nwid=${_nwid#\"} _nwid=${_nwid%\"}
;;
- \?) ieee80211_scan $_if |
- sed -n 's/^\([^ ]*\) chan .* bssid \([^ ]*\) .*$/ \1 (\2)/p' |
- cat -n | more -c
+ \?) ieee80211_scan $_if | cat -n | more -c
;;
*) _nwid=$resp
;;