From 2736891f1fa5d0bad9b64083c7b2e2e38f0dd2b7 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 11 Sep 2009 16:13:35 -0400 Subject: [PATCH 2/2] Exit if the sssd is launched as a user other than root --- server/monitor/monitor.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index 3a7c4f2..44ce5f2 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -52,6 +52,7 @@ #include "dbus/dbus.h" #include "sbus/sssd_dbus.h" #include "monitor/monitor_interfaces.h" +#include "util/sssd-i18n.h" /* ping time cannot be less then once every few seconds or the * monitor will get crazy hammering children with messages */ @@ -2350,6 +2351,7 @@ int main(int argc, const char *argv[]) TALLOC_CTX *tmp_ctx; struct mt_ctx *monitor; int ret; + uid_t uid; struct poptOption long_options[] = { POPT_AUTOHELP @@ -2382,6 +2384,13 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); + uid = getuid(); + if (uid != 0) { + DEBUG(1, ("Running under %d, must be root\n", uid)); + ERROR("sssd must be run as root\n"); + return 8; + } + tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { return 7; -- 1.6.2.5