*
*/
+#include "common/admin_socket.h"
#include "common/ceph_argparse.h"
#include "common/ceph_context.h"
#include "common/ceph_crypto.h"
{
cct->init_crypto();
- if (!(cct->get_init_flags() & CINIT_FLAG_NO_DAEMON_ACTIONS))
+ int flags = cct->get_init_flags();
+ if (!(flags & CINIT_FLAG_NO_DAEMON_ACTIONS))
cct->start_service_thread();
+
+ if ((flags & CINIT_FLAG_DEFER_DROP_PRIVILEGES) &&
+ (cct->get_set_uid() || cct->get_set_gid())) {
+ // FIXME: Changing ownership of a socket file via the fd does not work as
+ // expected. The socket file is listed as owned by the same
+ // 'user:group' which the daemon that created the socket had during
+ // open().
+ cct->get_admin_socket()->chown(cct->get_set_uid(), cct->get_set_gid());
+ }
}
g_ceph_context->_log->chown_log_file(
g_ceph_context->get_set_uid(),
g_ceph_context->get_set_gid());
- g_ceph_context->get_admin_socket()->chown(
- g_ceph_context->get_set_uid(),
- g_ceph_context->get_set_gid());
}
}