From 13d276d0d7fb7a1150663395ef30a885a7389db4 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 28 Aug 2015 06:13:09 +0200 Subject: Imported Upstream version 225 --- src/udev/udev-ctrl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/udev/udev-ctrl.c') diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index b0ad277f73..ead7c92b27 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -92,6 +92,11 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) { uctrl->bound = true; uctrl->sock = fd; } + + /* + * FIXME: remove it as soon as we can depend on this: + * http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=90c6bd34f884cd9cee21f1d152baf6c18bcac949 + */ r = setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); if (r < 0) log_warning_errno(errno, "could not set SO_PASSCRED: %m"); @@ -379,13 +384,14 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) { cmsg_close_all(&smsg); cmsg = CMSG_FIRSTHDR(&smsg); - cred = (struct ucred *) CMSG_DATA(cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { log_error("no sender credentials received, message ignored"); goto err; } + cred = (struct ucred *) CMSG_DATA(cmsg); + if (cred->uid != 0) { log_error("sender uid="UID_FMT", message ignored", cred->uid); goto err; -- cgit v1.2.1