diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2011-11-29 22:15:41 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2011-11-30 09:52:34 +0100 |
commit | d68af58657ce0e99594dff199fbb9b319cf6af96 (patch) | |
tree | da178dc37b90a3dbe01c7a88b534f0b06f18736e /src/socket.c | |
parent | f6cebb3bd5a00d79c8131637c0f6796a75e6af99 (diff) |
socket: add option for SO_PASSCRED
Add an option to enable SO_PASSCRED for unix sockets.
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/socket.c b/src/socket.c index 7ddf326a22..0864cce86d 100644 --- a/src/socket.c +++ b/src/socket.c @@ -406,6 +406,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { "%sFreeBind: %s\n" "%sTransparent: %s\n" "%sBroadcast: %s\n" + "%sPassCred: %s\n" "%sTCPCongestion: %s\n", prefix, socket_state_to_string(s->state), prefix, socket_address_bind_ipv6_only_to_string(s->bind_ipv6_only), @@ -416,6 +417,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { prefix, yes_no(s->free_bind), prefix, yes_no(s->transparent), prefix, yes_no(s->broadcast), + prefix, yes_no(s->pass_cred), prefix, strna(s->tcp_congestion)); if (s->control_pid > 0) @@ -657,6 +659,12 @@ static void socket_apply_socket_options(Socket *s, int fd) { log_warning("SO_BROADCAST failed: %m"); } + if (s->pass_cred) { + int one = 1; + if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0) + log_warning("SO_PASSCRED 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"); |