Check for client options
A message that is not in the archive (sent off-list or not yet received): 7e3baf77.AWYAACLanAUAAAAAAAAAAWpzJVQAAYCsnhYAAAAAABXTlQBkyU1m@...2677...
PATCH 1/1 Check for client options
From: Merten Fermont <[email protected]...>
Require 'client' or 'tls-client'+'pull' to be declared in the config. To prevent other errors, 'client' option is added when 'tls-client' and 'pull' are both declared.
Fixes error that --pull is a unknown option.
--- openvpn/client/cliopt.hpp | 1 - openvpn/client/cliopthelper.hpp | 11 ++++++++++- openvpn/common/options.hpp | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-)
openvpn/client/cliopt.hpp +0 -1
@@ -802,7 +802,6 @@ class ClientOptions : public RC<thread_unsafe_refcount> "replay-persist", /* Makes little sense in TLS mode */ "script-security", "sndbuf", - "tls-client", /* Always enabled */ "tmp-dir", "tun-ipv6", /* ignored in v2 as well */ "txqueuelen", /* so platforms evaluate that in tun, some do not, do not warn about that */
openvpn/client/cliopthelper.hpp +10 -1
@@ -367,13 +367,22 @@ class ParseClientConfig bool added = false; // client - if (!options.exists("client")) + if (options.exists("client")) + { + options.touch("tls-client", true); + options.touch("pull", true); + } + else if (options.exists("tls-client") && options.exists("pull")) { Option opt; opt.push_back("client"); options.push_back(std::move(opt)); added = true; } + else + { + throw option_error("No 'client' or 'tls-client'+'pull' directive declared. Other roles are not supported."); + } // dev if (!options.exists("dev"))
openvpn/common/options.hpp +2 -2
@@ -1460,11 +1460,11 @@ class OptionList : public std::vector<Option>, public RCCopyable<thread_unsafe_r } // Touch an option, if it exists. - void touch(const std::string &name) const + void touch(const std::string &name, bool lightly = false) const { const Option *o = get_ptr(name); if (o) - o->touch(); + o->touch(lightly); } // Render object as a string.
Signature · 1 line
2.41.0