From: Lennart Poettering Date: Wed, 7 Jul 2010 01:48:37 +0000 (+0200) Subject: initctl: check peer credentials after connection X-Git-Tag: v1~6 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a822056bca49a63cb832230af22f789c5ab5b856;p=systemd initctl: check peer credentials after connection --- diff --git a/Makefile.am b/Makefile.am index 0215f232..b444c02f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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) \ diff --git a/src/initctl.c b/src/initctl.c index a18cf384..7241acb8 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -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;