summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-03-13 00:00:27 +0100
committerLennart Poettering <lennart@poettering.net>2012-03-13 00:00:27 +0100
commit54ecda32c60c6f2548f74703bfd324694393edaa (patch)
treed9747c30a1985b3b95497450ca1c2678a9079d08 /src/socket.c
parentfa734f4da837abe6c893e75c95be78527db72c0f (diff)
socket: add option for SO_PASSEC
https://bugzilla.redhat.com/show_bug.cgi?id=798760 (Note that this work is not complete yet, as the kernel seems to send us useless data with SCM_SECURITY enabled)
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/socket.c b/src/socket.c
index aeedcbd7f3..ecaf3d2148 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -417,6 +417,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
"%sTransparent: %s\n"
"%sBroadcast: %s\n"
"%sPassCredentials: %s\n"
+ "%sPassSecurity: %s\n"
"%sTCPCongestion: %s\n",
prefix, socket_state_to_string(s->state),
prefix, socket_result_to_string(s->result),
@@ -429,6 +430,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
prefix, yes_no(s->transparent),
prefix, yes_no(s->broadcast),
prefix, yes_no(s->pass_cred),
+ prefix, yes_no(s->pass_sec),
prefix, strna(s->tcp_congestion));
if (s->control_pid > 0)
@@ -676,6 +678,12 @@ static void socket_apply_socket_options(Socket *s, int fd) {
log_warning("SO_PASSCRED failed: %m");
}
+ if (s->pass_sec) {
+ int one = 1;
+ if (setsockopt(fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one)) < 0)
+ log_warning("SO_PASSSEC failed: %m");
+ }
+
if (s->priority >= 0)
if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &s->priority, sizeof(s->priority)) < 0)
log_warning("SO_PRIORITY failed: %m");