]> err.no Git - systemd/commitdiff
initctl: check peer credentials after connection
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Jul 2010 01:48:37 +0000 (03:48 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 7 Jul 2010 02:13:19 +0000 (04:13 +0200)
Makefile.am
src/initctl.c

index 0215f2325d14ce1ef081c11b0855eea26897a333..b444c02f3026e6ce37ed464866675e07b530d7c2 100644 (file)
@@ -453,7 +453,8 @@ systemd_logger_LDADD = \
 
 systemd_initctl_SOURCES = \
        src/initctl.c \
-       src/sd-daemon.c
+       src/sd-daemon.c \
+       src/dbus-common.c
 
 systemd_initctl_CFLAGS = \
        $(AM_CFLAGS) \
index a18cf384a473121dcc9064423684ff5b1173ca74..7241acb8dfe59771c9d5c930eeb1aeaecbaccc2e 100644 (file)
@@ -41,6 +41,7 @@
 #include "initreq.h"
 #include "special.h"
 #include "sd-daemon.h"
+#include "dbus-common.h"
 
 #define SERVER_FD_MAX 16
 #define TIMEOUT ((int) (10*MSEC_PER_SEC))
@@ -300,6 +301,10 @@ static int server_init(Server *s, unsigned n_sockets) {
                 log_error("Failed to get D-Bus connection: %s", error.message);
                 goto fail;
         }
+        if ((r = bus_check_peercred(s->bus)) < 0) {
+                log_error("Bus connection failed peer credential check: %s", strerror(-r));
+                goto fail;
+        }
 
         return 0;