diff --git a/openvpn/client/cliopthelper.hpp b/openvpn/client/cliopthelper.hpp index 5bb3050ba..0d156a6fa 100644 --- a/openvpn/client/cliopthelper.hpp +++ b/openvpn/client/cliopthelper.hpp @@ -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"); diff --git a/test/unittests/test_cliopt.cpp b/test/unittests/test_cliopt.cpp index a0dab0c66..6c97d85ab 100644 --- a/test/unittests/test_cliopt.cpp +++ b/test/unittests/test_cliopt.cpp @@ -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(