]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
global/global_init: do not apply_changes until after dropping privs
authorSage Weil <sage@redhat.com>
Mon, 8 Feb 2016 16:12:19 +0000 (11:12 -0500)
committerSage Weil <sage@redhat.com>
Mon, 8 Feb 2016 16:12:19 +0000 (11:12 -0500)
This ensures we open the log file a the final user, not as root.

Fixes: #14613
Signed-off-by: Sage Weil <sage@redhat.com>
src/global/global_init.cc
src/tools/ceph_conf.cc

index f65d6acc03f3628f923dbbb18e677215f2a9c8e5..a37f06541a6bad9665908f14b9cc88ad954b29fb 100644 (file)
@@ -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)) {
index 0d0b85c8969c7994faaab68a172633face085958..b67ea5c793ac88c478f22e5219462979dffcacf9 100644 (file)
@@ -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