From: Sage Weil Date: Mon, 8 Feb 2016 16:12:19 +0000 (-0500) Subject: global/global_init: do not apply_changes until after dropping privs X-Git-Tag: v10.1.0~217^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8290536d7d373ea6dddd8cdb55ac71e42b5278e2;p=ceph.git global/global_init: do not apply_changes until after dropping privs This ensures we open the log file a the final user, not as root. Fixes: #14613 Signed-off-by: Sage Weil --- diff --git a/src/global/global_init.cc b/src/global/global_init.cc index f65d6acc03f..a37f06541a6 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -106,9 +106,6 @@ void global_pre_init(std::vector < const char * > *alt_def_args, conf->parse_argv(args); // argv override - // Expand metavariables. Invoke configuration observers. - conf->apply_changes(NULL); - // Now we're ready to complain about config file parse errors complain_about_parse_errors(cct, &parse_errors); } @@ -220,6 +217,9 @@ void global_init(std::vector < const char * > *alt_def_args, dout(0) << "set uid:gid to " << uid << ":" << gid << dendl; } + // Expand metavariables. Invoke configuration observers. Open log file. + g_conf->apply_changes(NULL); + if (g_conf->run_dir.length() && code_env == CODE_ENVIRONMENT_DAEMON && !(flags & CINIT_FLAG_NO_DAEMON_ACTIONS)) { diff --git a/src/tools/ceph_conf.cc b/src/tools/ceph_conf.cc index 0d0b85c8969..b67ea5c793a 100644 --- a/src/tools/ceph_conf.cc +++ b/src/tools/ceph_conf.cc @@ -153,6 +153,7 @@ int main(int argc, const char **argv) global_pre_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON, CINIT_FLAG_NO_DAEMON_ACTIONS); + g_conf->apply_changes(NULL); // do not common_init_finish(); do not start threads; do not do any of thing // wonky things the daemon whose conf we are examining would do (like initialize