aboutsummaryrefslogtreecommitdiff
path: root/src/app/config/config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-30 15:32:12 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-30 15:32:12 -0400
commit14831ea0ab7afbcdb1c0d91242f924d99ed4fcac (patch)
treef61719389ab368c8eff2fb5520c35af92f71a83d /src/app/config/config.c
parent15371d801cf7668b57bf3eb20f29afb6489bb027 (diff)
downloadtor-14831ea0ab7afbcdb1c0d91242f924d99ed4fcac.tar.gz
tor-14831ea0ab7afbcdb1c0d91242f924d99ed4fcac.zip
Use FILENAME to determine which options to check for relative paths
This is part of ticket 32344.
Diffstat (limited to 'src/app/config/config.c')
-rw-r--r--src/app/config/config.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index cda2440963..275ac9e762 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -3324,25 +3324,20 @@ warn_about_relative_paths(or_options_t *options)
{
tor_assert(options);
int n = 0;
+ const config_mgr_t *mgr = get_options_mgr();
- n += warn_if_option_path_is_relative("CookieAuthFile",
- options->CookieAuthFile);
- n += warn_if_option_path_is_relative("ExtORPortCookieAuthFile",
- options->ExtORPortCookieAuthFile);
- n += warn_if_option_path_is_relative("DirPortFrontPage",
- options->DirPortFrontPage);
- n += warn_if_option_path_is_relative("V3BandwidthsFile",
- options->V3BandwidthsFile);
- n += warn_if_option_path_is_relative("ControlPortWriteToFile",
- options->ControlPortWriteToFile);
- n += warn_if_option_path_is_relative("GeoIPFile",options->GeoIPFile);
- n += warn_if_option_path_is_relative("GeoIPv6File",options->GeoIPv6File);
- n += warn_if_option_path_is_relative("Log",options->DebugLogFile);
- n += warn_if_option_path_is_relative("AccelDir",options->AccelDir);
- n += warn_if_option_path_is_relative("DataDirectory",options->DataDirectory);
- n += warn_if_option_path_is_relative("PidFile",options->PidFile);
- n += warn_if_option_path_is_relative("ClientOnionAuthDir",
- options->ClientOnionAuthDir);
+ smartlist_t *vars = config_mgr_list_vars(mgr);
+ SMARTLIST_FOREACH_BEGIN(vars, const config_var_t *, cv) {
+ config_line_t *line;
+ if (cv->member.type != CONFIG_TYPE_FILENAME)
+ continue;
+ const char *name = cv->member.name;
+ line = config_get_assigned_option(mgr, options, name, 0);
+ if (line)
+ n += warn_if_option_path_is_relative(name, line->value);
+ config_free_lines(line);
+ } SMARTLIST_FOREACH_END(cv);
+ smartlist_free(vars);
for (config_line_t *hs_line = options->RendConfigLines; hs_line;
hs_line = hs_line->next) {