wifi(fix): quote ssid and password for wpa_passphrase

pull/2885/head
Qingping Hou 7 years ago committed by Frans de Jonge
parent 4eb8664c95
commit bde2139b27

@ -164,8 +164,9 @@ function ReaderDictionary:stardictLookup(word, box)
results_str = A.stdout("./sdcv", "--utf8-input", "--utf8-output",
"-nj", word, "--data-dir", dict_dir)
else
local std_out = io.popen("./sdcv --utf8-input --utf8-output -nj "
.. ("%q"):format(word) .. " --data-dir " .. dict_dir, "r")
local std_out = io.popen(
("./sdcv --utf8-input --utf8-output -nj %q --data-dir %q"):format(word, dict_dir),
"r")
if std_out then
results_str = std_out:read("*all")
std_out:close()

@ -45,7 +45,7 @@ local function calculatePsk(ssid, pwd)
-- * /wpa_supplicant/wpa_passphrase.c
-- * /src/crypto/sha1-pbkdf2.c
-- see: http://docs.ros.org/diamondback/api/wpa_supplicant/html/sha1-pbkdf2_8c_source.html
local fp = io.popen(string.format("wpa_passphrase %s %s", ssid, pwd))
local fp = io.popen(("wpa_passphrase %q %q"):format(ssid, pwd))
local out = fp:read("*a")
fp:close()
return string.match(out, 'psk=([a-f0-9]+)')

Loading…
Cancel
Save