summaryrefslogtreecommitdiff
path: root/server/monitor
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-09-11 16:13:35 -0400
committerSimo Sorce <ssorce@redhat.com>2009-09-11 17:57:08 -0400
commitf65550115e78a66a35b074a5b80394a6d9ff21fd (patch)
tree546207946583f959d38a226689ad2a2cf9fa8e87 /server/monitor
parentfa2004ce9f3d26681215cdc46c4ecb9c9dfea8fe (diff)
downloadsssd-f65550115e78a66a35b074a5b80394a6d9ff21fd.tar.gz
sssd-f65550115e78a66a35b074a5b80394a6d9ff21fd.tar.bz2
sssd-f65550115e78a66a35b074a5b80394a6d9ff21fd.zip
Exit if the sssd is launched as a user other than root
Diffstat (limited to 'server/monitor')
-rw-r--r--server/monitor/monitor.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c
index 3a7c4f21..44ce5f2c 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;