diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-02-05 15:46:55 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-02-05 16:23:53 +0100 |
commit | 8a56f79d491271120abc3843c46e9dda44edd308 (patch) | |
tree | e5b9b8c92086cc434b11b4c6663cef624bae45c6 /src/util | |
parent | 712b7d9b479dd68c0b410cf45407f11de0b64f79 (diff) | |
parent | 900d8f6f70859f528e84c5c38d0332f81d19df55 (diff) |
Merge #17482: util: Disallow network-qualified command line options
900d8f6f70859f528e84c5c38d0332f81d19df55 util: Disallow network-qualified command line options (Russell Yanofsky)
Pull request description:
Previously these were allowed but ignored.
This change implements one of the settings simplifications listed in #17508. Change includes release notes.
ACKs for top commit:
laanwj:
ACK 900d8f6f70859f528e84c5c38d0332f81d19df55
Tree-SHA512: ab020a16a86c1e8ec709fbf798d533879d32c565eceeb7eb785c33042c49c6b4d1108c5453d8166e4a2abffc2c8802fbb6d3b895e0ddeefa8f274fd647e3c8ad
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/system.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp index ff3967c577..13ff99c663 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -312,21 +312,18 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin std::string section; util::SettingsValue value = InterpretOption(section, key, val); Optional<unsigned int> flags = GetArgFlags('-' + key); - if (flags) { - if (!CheckValid(key, value, *flags, error)) { - return false; - } - // Weird behavior preserved for backwards compatibility: command - // line options with section prefixes are allowed but ignored. It - // would be better if these options triggered the Invalid parameter - // error below. - if (section.empty()) { - m_settings.command_line_options[key].push_back(value); - } - } else { - error = strprintf("Invalid parameter -%s", key); + + // Unknown command line options and command line options with dot + // characters (which are returned from InterpretOption with nonempty + // section strings) are not valid. + if (!flags || !section.empty()) { + error = strprintf("Invalid parameter %s", argv[i]); return false; } + + if (!CheckValid(key, value, *flags, error)) return false; + + m_settings.command_line_options[key].push_back(value); } // we do not allow -includeconf from command line |