mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
journald: make audit socket optional
If we were given some sockets through socket activation, and audit socket is not among them, do not try to open it. This way, if the socket unit is disabled, we will not receive audit events. https://bugzilla.redhat.com/show_bug.cgi?id=1227379
This commit is contained in:
parent
15d91bff36
commit
7d18d348da
@ -1453,6 +1453,7 @@ static int server_open_hostname(Server *s) {
|
||||
int server_init(Server *s) {
|
||||
_cleanup_fdset_free_ FDSet *fds = NULL;
|
||||
int n, r, fd;
|
||||
bool no_sockets;
|
||||
|
||||
assert(s);
|
||||
|
||||
@ -1569,6 +1570,9 @@ int server_init(Server *s) {
|
||||
fds = fdset_free(fds);
|
||||
}
|
||||
|
||||
no_sockets = s->native_fd < 0 && s->stdout_fd < 0 && s->syslog_fd < 0 && s->audit_fd < 0;
|
||||
|
||||
/* always open stdout, syslog, native, and kmsg sockets */
|
||||
r = server_open_stdout_socket(s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1585,9 +1589,12 @@ int server_init(Server *s) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = server_open_audit(s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
/* Unless we got *some* sockets and not audit, open audit socket */
|
||||
if (s->audit_fd >= 0 || no_sockets) {
|
||||
r = server_open_audit(s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = server_open_kernel_seqnum(s);
|
||||
if (r < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user