chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ask-password. Initializing socket_fd inside ask_agent.
[elogind.git]
/
src
/
socket-util.c
diff --git
a/src/socket-util.c
b/src/socket-util.c
index 442abfe1affb2bd8615f1739913fbacc64190f98..151757c52bdd6d84d945a52552c8d69041c60bd1 100644
(file)
--- a/
src/socket-util.c
+++ b/
src/socket-util.c
@@
-1,4
+1,4
@@
-/*-*- Mode: C; c-basic-offset: 8 -*-*/
+/*-*- Mode: C; c-basic-offset: 8
; indent-tabs-mode: nil
-*-*/
/***
This file is part of systemd.
/***
This file is part of systemd.
@@
-34,6
+34,7
@@
#include "util.h"
#include "socket-util.h"
#include "missing.h"
#include "util.h"
#include "socket-util.h"
#include "missing.h"
+#include "label.h"
int socket_address_parse(SocketAddress *a, const char *s) {
int r;
int socket_address_parse(SocketAddress *a, const char *s) {
int r;
@@
-305,7
+306,7
@@
int socket_address_listen(
bool free_bind,
mode_t directory_mode,
mode_t socket_mode,
bool free_bind,
mode_t directory_mode,
mode_t socket_mode,
- /* FIXME SELINUX: pass SELinux context object here */
+ const char *label,
int *ret) {
int r, fd, one;
int *ret) {
int r, fd, one;
@@
-315,11
+316,17
@@
int socket_address_listen(
if ((r = socket_address_verify(a)) < 0)
return r;
if ((r = socket_address_verify(a)) < 0)
return r;
- /* FIXME SELINUX: The socket() here should be done with the
- * right SELinux context set */
+ r = label_socket_set(label);
+ if (r < 0)
+ return r;
+
+ fd = socket(socket_address_family(a), a->type | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
+ r = fd < 0 ? -errno : 0;
- if ((fd = socket(socket_address_family(a), a->type | SOCK_NONBLOCK | SOCK_CLOEXEC, 0)) < 0)
- return -errno;
+ label_socket_clear();
+
+ if (r < 0)
+ return r;
if (socket_address_family(a) == AF_INET6 && only != SOCKET_ADDRESS_DEFAULT) {
int flag = only == SOCKET_ADDRESS_IPV6_ONLY;
if (socket_address_family(a) == AF_INET6 && only != SOCKET_ADDRESS_DEFAULT) {
int flag = only == SOCKET_ADDRESS_IPV6_ONLY;