Skip to content

Commit

Permalink
Options: do not error out on client + pull
Browse files Browse the repository at this point in the history
Config

    client
    pull

was not correctly handled like client + tls-client
since the code short-circuited if tls-client wasn't set
and so didn't touch pull option.

Github: #277
Signed-off-by: Frank Lichtenheld <[email protected]>
  • Loading branch information
flichtenheld authored and dsommers committed Mar 13, 2024
1 parent 458e5df commit 763176e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openvpn/client/cliopthelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,12 @@ class ParseClientConfig
// add in missing options
bool added = false;

// client
if (options.exists("tls-client") && options.exists("pull"))
/* client
Ensure that we always look at both options, so they register as touched */
const bool tls_client_exists = options.exists("tls-client");
const bool pull_exists = options.exists("pull");

if (tls_client_exists && pull_exists)
{
Option opt;
opt.push_back("client");
Expand Down
1 change: 1 addition & 0 deletions test/unittests/test_cliopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ INSTANTIATE_TEST_SUITE_P(
certconfig + "\nremote 1.2.3.4\ntls-client\npull\n",
/* Should not trigger an error. Redundant options are no problem */
certconfig + "\nremote 1.2.3.4\ntls-client\npull\nclient\n",
certconfig + "\nremote 1.2.3.4\npull\nclient\n",
certconfig + "\nremote 1.2.3.4\nclient\ntls-client\n"));

INSTANTIATE_TEST_SUITE_P(
Expand Down

0 comments on commit 763176e

Please sign in to comment.