Skip to content

Commit

Permalink
global-init: chown run dir
Browse files Browse the repository at this point in the history
Also performs log file chown() operations if permission drop has been
deferred. Documents that admin socket chown() happen in the common init
path.

Signed-off-by: Karol Mroz <kmroz@suse.com>
  • Loading branch information
kmroz committed Apr 23, 2016
1 parent 206585c commit 9d51379
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/global/global_init.cc
Expand Up @@ -291,13 +291,21 @@ void global_init(std::vector < const char * > *alt_def_args,

if (priv_ss.str().length()) {
dout(0) << priv_ss.str() << dendl;
}

if (g_ceph_context->get_set_uid() || g_ceph_context->get_set_gid()) {
// fix ownership on log, asok files. this is sadly a bit of a hack :(
g_ceph_context->_log->chown_log_file(
g_ceph_context->get_set_uid(),
g_ceph_context->get_set_gid());
}
if ((flags & CINIT_FLAG_DEFER_DROP_PRIVILEGES) &&
(g_ceph_context->get_set_uid() || g_ceph_context->get_set_gid())) {
// Fix ownership on log files and run directories if needed.
// Admin socket files are chown()'d during the common init path _after_
// the service thread has been started. This is sadly a bit of a hack :(
chown_path(g_conf->run_dir,
g_ceph_context->get_set_uid(),
g_ceph_context->get_set_gid(),
g_ceph_context->get_set_uid_string(),
g_ceph_context->get_set_gid_string());
g_ceph_context->_log->chown_log_file(
g_ceph_context->get_set_uid(),
g_ceph_context->get_set_gid());
}

// Now we're ready to complain about config file parse errors
Expand Down

0 comments on commit 9d51379

Please sign in to comment.