diff --git a/src/Main.cxx b/src/Main.cxx index 26b74b70c..e0a20d553 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -551,7 +551,7 @@ try { glue_mapper_init(raw_config); - initPermissions(); + initPermissions(raw_config); spl_global_init(raw_config); #ifdef ENABLE_ARCHIVE archive_plugin_init_all(); diff --git a/src/Permission.cxx b/src/Permission.cxx index 090195cfa..0a195d854 100644 --- a/src/Permission.cxx +++ b/src/Permission.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "Permission.hxx" #include "config/Param.hxx" -#include "config/Global.hxx" +#include "config/Data.hxx" #include "config/Option.hxx" #include "util/RuntimeError.hxx" @@ -87,7 +87,8 @@ static unsigned parsePermissions(const char *string) return permission; } -void initPermissions(void) +void +initPermissions(const ConfigData &config) { unsigned permission; const ConfigParam *param; @@ -95,7 +96,7 @@ void initPermissions(void) permission_default = PERMISSION_READ | PERMISSION_ADD | PERMISSION_CONTROL | PERMISSION_ADMIN; - param = config_get_param(ConfigOption::PASSWORD); + param = config.GetParam(ConfigOption::PASSWORD); if (param) { permission_default = 0; @@ -121,13 +122,13 @@ void initPermissions(void) } while ((param = param->next) != nullptr); } - param = config_get_param(ConfigOption::DEFAULT_PERMS); + param = config.GetParam(ConfigOption::DEFAULT_PERMS); if (param) permission_default = parsePermissions(param->value.c_str()); #ifdef HAVE_UN - param = config_get_param(ConfigOption::LOCAL_PERMISSIONS); + param = config.GetParam(ConfigOption::LOCAL_PERMISSIONS); if (param != nullptr) local_permissions = parsePermissions(param->value.c_str()); else diff --git a/src/Permission.hxx b/src/Permission.hxx index e0009471e..c1a218de0 100644 --- a/src/Permission.hxx +++ b/src/Permission.hxx @@ -22,6 +22,8 @@ #include "check.h" +struct ConfigData; + static constexpr unsigned PERMISSION_NONE = 0; static constexpr unsigned PERMISSION_READ = 1; static constexpr unsigned PERMISSION_ADD = 2; @@ -39,6 +41,6 @@ GetLocalPermissions() noexcept; #endif void -initPermissions(); +initPermissions(const ConfigData &config); #endif