Skip to content

Commit

Permalink
Merge branch 'jb54606' into 'master'
Browse files Browse the repository at this point in the history
Ignore all OpenVPN options without value set to false

See merge request mer-core/connman!317
  • Loading branch information
LaakkonenJussi committed Jun 14, 2021
2 parents e3a2a62 + 643cdf4 commit 2f059fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions connman/vpn/plugins/openvpn.c
Expand Up @@ -365,6 +365,14 @@ static int task_append_config_data(struct vpn_provider *provider,
if (!ov_options[i].ov_opt)
continue;

/*
* In case the option is without value, i.e. a boolean toggle
* then ignore the value when option is disabled.
*/
if (!ov_options[i].has_value && !vpn_provider_get_boolean(
provider, ov_options[i].cm_opt, false))
continue;

option = vpn_provider_get_string(provider,
ov_options[i].cm_opt);
if (!option)
Expand All @@ -374,23 +382,19 @@ static int task_append_config_data(struct vpn_provider *provider,
* If the AuthUserPass option is "-", provide the input
* via management interface
*/
if (!strcmp(ov_options[i].cm_opt, "OpenVPN.AuthUserPass") &&
!strcmp(option, "-"))
if (!g_strcmp0(ov_options[i].cm_opt, "OpenVPN.AuthUserPass") &&
!g_strcmp0(option, "-"))
option = NULL;

/* Handle BlockIPv6 internally */
if (!strncmp(ov_options[i].cm_opt, "OpenVPN.BlockIPv6", 17)) {
block_ipv6 = true;
continue;
}

if (connman_task_add_argument(task,
ov_options[i].ov_opt,
ov_options[i].has_value ? option : NULL) < 0)
return -EIO;

}

block_ipv6 = vpn_provider_get_boolean(provider, "OpenVPN.BlockIPv6",
false);
vpn_provider_set_supported_ip_networks(provider, true, !block_ipv6);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion rpm/connman.spec
Expand Up @@ -131,7 +131,7 @@ This package provides OpenVPN VPN plugin for connman.
Summary: Connection Manager OpenConnect VPN plugin
Requires: %{name} = %{version}-%{release}
Requires: %{name}-vpn-scripts
Requires: openconnect
Requires: openconnect >= 2.5.2

%description plugin-vpn-openconnect
This package provides OpenConnect VPN plugin for connman.
Expand Down

0 comments on commit 2f059fe

Please sign in to comment.