diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2011-11-29 23:14:36 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2011-11-30 10:12:59 +0100 |
commit | 75d3fc60f88e08bf953063819a8a04b881d6db23 (patch) | |
tree | c9e09035ca4a54263138207bf8d390d39d8d1c57 | |
parent | d68af58657ce0e99594dff199fbb9b319cf6af96 (diff) |
shutdownd: use PassCred=yes in the socket unit
Since Linux 3.2 in order to receive SCM_CREDENTIALS it is not sufficient
to set SO_PASSCRED just before recvmsg(). The option has to be already
set when the sender sends the message.
With socket activation it is too late to set the option in the service.
It must be set on the socket right from the start.
See the kernel commit:
16e57262 af_unix: dont send SCM_CREDENTIALS by default
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=757628
-rw-r--r-- | src/shutdownd.c | 6 | ||||
-rw-r--r-- | units/systemd-shutdownd.socket | 1 |
2 files changed, 1 insertions, 6 deletions
diff --git a/src/shutdownd.c b/src/shutdownd.c index 0ffa8b2881..46856b01ad 100644 --- a/src/shutdownd.c +++ b/src/shutdownd.c @@ -173,7 +173,6 @@ int main(int argc, char *argv[]) { }; int r = EXIT_FAILURE, n_fds; - int one = 1; struct shutdownd_command c; struct pollfd pollfd[_FD_MAX]; bool exec_shutdown = false, unlink_nologin = false, failed = false; @@ -205,11 +204,6 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - if (setsockopt(SD_LISTEN_FDS_START, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0) { - log_error("SO_PASSCRED failed: %m"); - return EXIT_FAILURE; - } - zero(c); zero(pollfd); diff --git a/units/systemd-shutdownd.socket b/units/systemd-shutdownd.socket index bc0358a346..13b6c7a5cc 100644 --- a/units/systemd-shutdownd.socket +++ b/units/systemd-shutdownd.socket @@ -15,3 +15,4 @@ Before=sockets.target [Socket] ListenDatagram=/run/systemd/shutdownd SocketMode=0600 +PassCred=yes |