diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-11-30 11:30:42 +0200 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-11-30 15:01:18 +0200 |
commit | 5de0f9dec69dba2466f44d9fd031e36b488dd15a (patch) | |
tree | 9cd4a1b5478b6dd26af23fe0aadbb48820a8186e /vpn/plugins | |
parent | f0191c24ad067e927c4bfe40f3933011724bda64 (diff) | |
download | connman-5de0f9dec69dba2466f44d9fd031e36b488dd15a.tar.gz connman-5de0f9dec69dba2466f44d9fd031e36b488dd15a.tar.bz2 connman-5de0f9dec69dba2466f44d9fd031e36b488dd15a.zip |
openconnect: Add support for --no-cert-check client option
Diffstat (limited to 'vpn/plugins')
-rw-r--r-- | vpn/plugins/openconnect.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/vpn/plugins/openconnect.c b/vpn/plugins/openconnect.c index d36662cd..83584da8 100644 --- a/vpn/plugins/openconnect.c +++ b/vpn/plugins/openconnect.c @@ -46,6 +46,16 @@ #include "vpn.h" +#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) + +struct { + const char *cm_opt; + const char *oc_opt; + char has_value; +} oc_options[] = { + { "OpenConnect.NoCertCheck", "--no-cert-check", 0 }, +}; + struct oc_private_data { struct connman_task *task; char *if_name; @@ -53,6 +63,30 @@ struct oc_private_data { void *user_data; }; +static int task_append_config_data(struct vpn_provider *provider, + struct connman_task *task) +{ + const char *option; + int i; + + for (i = 0; i < (int)ARRAY_SIZE(oc_options); i++) { + if (oc_options[i].oc_opt == NULL) + continue; + + option = vpn_provider_get_string(provider, + oc_options[i].cm_opt); + if (option == NULL) + continue; + + if (connman_task_add_argument(task, + oc_options[i].oc_opt, + oc_options[i].has_value ? option : NULL) < 0) + return -EIO; + } + + return 0; +} + static int oc_notify(DBusMessage *msg, struct vpn_provider *provider) { DBusMessageIter iter, dict; @@ -325,6 +359,8 @@ static int run_connect(struct vpn_provider *provider, goto done; } + task_append_config_data(provider, task); + vpn_provider_set_string(provider, "OpenConnect.Cookie", vpncookie); certsha1 = vpn_provider_get_string(provider, @@ -438,7 +474,8 @@ done: static int oc_save(struct vpn_provider *provider, GKeyFile *keyfile) { - const char *setting; + const char *setting, *option; + int i; setting = vpn_provider_get_string(provider, "OpenConnect.ServerCert"); @@ -461,6 +498,19 @@ static int oc_save(struct vpn_provider *provider, GKeyFile *keyfile) vpn_provider_get_save_group(provider), "VPN.MTU", setting); + for (i = 0; i < (int)ARRAY_SIZE(oc_options); i++) { + if (strncmp(oc_options[i].cm_opt, "OpenConnect.", 12) == 0) { + option = vpn_provider_get_string(provider, + oc_options[i].cm_opt); + if (option == NULL) + continue; + + g_key_file_set_string(keyfile, + vpn_provider_get_save_group(provider), + oc_options[i].cm_opt, option); + } + } + return 0; } |