mirror of
https://github.com/systemd/systemd.git
synced 2025-01-26 14:04:03 +03:00
bus: reuse sd_is_socket() call
This commit is contained in:
parent
15d5af8145
commit
9ab32f9daa
@ -1689,7 +1689,8 @@ libsystemd_bus_la_SOURCES = \
|
|||||||
|
|
||||||
libsystemd_bus_la_LIBADD = \
|
libsystemd_bus_la_LIBADD = \
|
||||||
libsystemd-id128-internal.la \
|
libsystemd-id128-internal.la \
|
||||||
libsystemd-shared.la
|
libsystemd-shared.la \
|
||||||
|
libsystemd-daemon.la
|
||||||
|
|
||||||
noinst_LTLIBRARIES += \
|
noinst_LTLIBRARIES += \
|
||||||
libsystemd-bus.la
|
libsystemd-bus.la
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "missing.h"
|
#include "missing.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
#include "sd-daemon.h"
|
||||||
|
|
||||||
#include "sd-bus.h"
|
#include "sd-bus.h"
|
||||||
#include "bus-socket.h"
|
#include "bus-socket.h"
|
||||||
@ -589,25 +590,17 @@ static int bus_socket_start_auth_client(sd_bus *b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int bus_socket_start_auth(sd_bus *b) {
|
static int bus_socket_start_auth(sd_bus *b) {
|
||||||
int domain = 0, r;
|
|
||||||
socklen_t sl;
|
|
||||||
|
|
||||||
assert(b);
|
assert(b);
|
||||||
|
|
||||||
b->state = BUS_AUTHENTICATING;
|
b->state = BUS_AUTHENTICATING;
|
||||||
b->auth_timeout = now(CLOCK_MONOTONIC) + BUS_DEFAULT_TIMEOUT;
|
b->auth_timeout = now(CLOCK_MONOTONIC) + BUS_DEFAULT_TIMEOUT;
|
||||||
|
|
||||||
sl = sizeof(domain);
|
if (sd_is_socket(b->input_fd, AF_UNIX, 0, 0) <= 0)
|
||||||
r = getsockopt(b->input_fd, SOL_SOCKET, SO_DOMAIN, &domain, &sl);
|
|
||||||
if (r < 0 || domain != AF_UNIX)
|
|
||||||
b->negotiate_fds = false;
|
b->negotiate_fds = false;
|
||||||
|
|
||||||
if (b->output_fd != b->input_fd) {
|
if (b->output_fd != b->input_fd)
|
||||||
r = getsockopt(b->output_fd, SOL_SOCKET, SO_DOMAIN, &domain, &sl);
|
if (sd_is_socket(b->output_fd, AF_UNIX, 0, 0) <= 0)
|
||||||
if (r < 0 || domain != AF_UNIX)
|
|
||||||
b->negotiate_fds = false;
|
b->negotiate_fds = false;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (b->is_server)
|
if (b->is_server)
|
||||||
return bus_socket_read_auth(b);
|
return bus_socket_read_auth(b);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user