mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 13:40:39 +01:00
nm-import-openvpn: parse quoted string as a single word
It is necessary, for example, for this to work: verify-x509-name "C=US, L=Cambridge, CN=GNOME, emailAddress=networkmanager-list@gnome.org" subject
This commit is contained in:
parent
c4ed2483b2
commit
79643ce28a
1 changed files with 21 additions and 4 deletions
|
|
@ -332,10 +332,27 @@ vpn2nm = {
|
|||
-- Read and convert the config into the global g_vpn_data --
|
||||
-----------------------------------------------------------
|
||||
function read_and_convert(in_file)
|
||||
local function line_split(str)
|
||||
t={}; i = 1
|
||||
for str in str:gmatch("%S+") do
|
||||
t[i] = str
|
||||
local function line_split(line)
|
||||
local t={}
|
||||
local i, idx = 1, 1
|
||||
local delim = "\""
|
||||
while true do
|
||||
local a,b = line:find("%S+", idx)
|
||||
if not a then break end
|
||||
|
||||
local str = line:sub(a,b)
|
||||
local quote = nil
|
||||
if str:sub(1,1) == delim and str:sub(#str,#str) ~= delim then
|
||||
quote = (line.." "):find(delim.."%s", b + 1)
|
||||
end
|
||||
|
||||
if quote then
|
||||
t[i] = line:sub(a, quote)
|
||||
idx = quote + 1
|
||||
else
|
||||
t[i] = str
|
||||
idx = b + 1
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
return t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue