summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <blueowl@centrum.cz>2016-11-10 18:07:02 +0100
committerJiří Klimeš <blueowl@centrum.cz>2016-11-10 20:56:44 +0100
commitc4ed2483b2ce512c92949dc9b87a90e3bce447ac (patch)
treec16fef5ab3a84898f1223b174ee33cc3dad8e3c8
parentbc446c3ab8deeff75c4640c85e806e1eac154bc0 (diff)
downloadNetworkManager-c4ed2483b2ce512c92949dc9b87a90e3bce447ac.tar.gz
nm-import-openvpn: import 'verify-x509-name' option
https://git.gnome.org/browse/network-manager-openvpn/commit/?id=b51b3562ce079cc0be426e968fe1c90faadc0efd
-rwxr-xr-xcontrib/scripts/nm-import-openvpn11
1 files changed, 11 insertions, 0 deletions
diff --git a/contrib/scripts/nm-import-openvpn b/contrib/scripts/nm-import-openvpn
index 9cca4c66e8..c8af9d996e 100755
--- a/contrib/scripts/nm-import-openvpn
+++ b/contrib/scripts/nm-import-openvpn
@@ -266,6 +266,16 @@ function handle_routes(t, option, value)
if not t[option] then t[option] = {} end
t[option][#t[option]+1] = {value[2], netmask, gateway, metric}
end
+function handle_verify_x509_name(t, option, value)
+ if not value[2] then io.stderr:write("Warning: missing argument in option 'verify-x509-name'\n") return end
+ value[2] = unquote(value[2])
+ value[3] = value[3] or "subject"
+ if value[3] ~= "subject" and value[3] ~= "name" and value[3] ~= "name-prefix" then
+ io.stderr:write(string.format("Warning: ignoring invalid value '%s' for type in option '%s'\n", value[3], value[1]))
+ return
+ end
+ t[option] = value[3] .. ":" .. value[2]
+end
-- global variables
g_vpn_data = {}
@@ -315,6 +325,7 @@ vpn2nm = {
["route"] = { nm_opt="routes", func=handle_routes, tbl=g_ip4_data },
["max-routes"] = { nm_opt="max-routes", func=handle_number, tbl=g_vpn_data },
["tls-cipher"] = { nm_opt="tls-cipher", func=handle_generic_unquote, tbl=g_vpn_data },
+ ["verify-x509-name"] = { nm_opt="verify-x509-name", func=handle_verify_x509_name,tbl=g_vpn_data },
}
------------------------------------------------------------