summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-04-08 19:59:20 +0200
committerHarald Hoyer <harald@redhat.com>2013-04-08 20:03:50 +0200
commitb97caef538ae37bd2dc04fc15b448c12a2c9422b (patch)
treedc8bf2b8edbbd5127dd06c9ba36f3da7c7b597d3 /src/udev
parentd4b7fecb051142404da6bf587c1796a6de768990 (diff)
udev/udev-ctrl.c:udev_ctrl_new_from_fd() enable SO_PASSCRED
Avoid "sender uid=65534, message ignored" case, where no credentials can be read on the sender side. Seems, the server socket does not enable credential receiving fast enough, and the message from the client (without credential) sometimes is queued before the credential passing was active.
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-ctrl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 6ee6b04b1b..e60da906c5 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -73,6 +73,7 @@ struct udev_ctrl_connection {
struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd)
{
struct udev_ctrl *uctrl;
+ const int on = 1;
uctrl = calloc(1, sizeof(struct udev_ctrl));
if (uctrl == NULL)
@@ -91,6 +92,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd)
uctrl->bound = true;
uctrl->sock = fd;
}
+ setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
uctrl->saddr.sun_family = AF_LOCAL;
strscpy(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), "/run/udev/control");