chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
journald: don't pass around SO_TIMESTAMP timestamp for audit, which we don't have...
[elogind.git]
/
src
/
journal
/
journald-audit.c
diff --git
a/src/journal/journald-audit.c
b/src/journal/journald-audit.c
index d88d67c5bd9af25a14a31818f6bc7fd754e279b9..ba8a1ae8bdbea58f6a700eb6b88002766110a8d7 100644
(file)
--- a/
src/journal/journald-audit.c
+++ b/
src/journal/journald-audit.c
@@
-325,7
+325,7
@@
static int map_all_fields(
}
}
}
}
-static void process_audit_string(Server *s, int type, const char *data, size_t size
, const struct timeval *tv
) {
+static void process_audit_string(Server *s, int type, const char *data, size_t size) {
_cleanup_free_ struct iovec *iov = NULL;
size_t n_iov_allocated = 0;
unsigned n_iov = 0, k;
_cleanup_free_ struct iovec *iov = NULL;
size_t n_iov_allocated = 0;
unsigned n_iov = 0, k;
@@
-354,7
+354,7
@@
static void process_audit_string(Server *s, int type, const char *data, size_t s
if (!p)
return;
if (!p)
return;
- if (sscanf(p, "(%" PRIi64 ".%" PRIi64 ":%" PRIi64 "):
%n",
+ if (sscanf(p, "(%" PRIi64 ".%" PRIi64 ":%" PRIi64 "):%n",
&seconds,
&msec,
&id,
&seconds,
&msec,
&id,
@@
-362,6
+362,10
@@
static void process_audit_string(Server *s, int type, const char *data, size_t s
return;
p += k;
return;
p += k;
+ p += strspn(p, WHITESPACE);
+
+ if (isempty(p))
+ return;
n_iov_allocated = N_IOVEC_META_FIELDS + 5;
iov = new(struct iovec, n_iov_allocated);
n_iov_allocated = N_IOVEC_META_FIELDS + 5;
iov = new(struct iovec, n_iov_allocated);
@@
-382,7
+386,7
@@
static void process_audit_string(Server *s, int type, const char *data, size_t s
sprintf(id_field, "_AUDIT_ID=%" PRIu64, id);
IOVEC_SET_STRING(iov[n_iov++], id_field);
sprintf(id_field, "_AUDIT_ID=%" PRIu64, id);
IOVEC_SET_STRING(iov[n_iov++], id_field);
- m = strappenda("MESSAGE=
", data
);
+ m = strappenda("MESSAGE=
audit: ", p
);
IOVEC_SET_STRING(iov[n_iov++], m);
z = n_iov;
IOVEC_SET_STRING(iov[n_iov++], m);
z = n_iov;
@@
-394,7
+398,7
@@
static void process_audit_string(Server *s, int type, const char *data, size_t s
goto finish;
}
goto finish;
}
- server_dispatch_message(s, iov, n_iov, n_iov_allocated, NULL,
tv
, NULL, 0, NULL, LOG_NOTICE, 0);
+ server_dispatch_message(s, iov, n_iov, n_iov_allocated, NULL,
NULL
, NULL, 0, NULL, LOG_NOTICE, 0);
finish:
/* free() all entries that map_all_fields() added. All others
finish:
/* free() all entries that map_all_fields() added. All others
@@
-409,7
+413,6
@@
void server_process_audit_message(
const void *buffer,
size_t buffer_size,
const struct ucred *ucred,
const void *buffer,
size_t buffer_size,
const struct ucred *ucred,
- const struct timeval *tv,
const union sockaddr_union *sa,
socklen_t salen) {
const union sockaddr_union *sa,
socklen_t salen) {
@@
-449,7
+452,7
@@
void server_process_audit_message(
if (nl->nlmsg_type < AUDIT_FIRST_USER_MSG)
return;
if (nl->nlmsg_type < AUDIT_FIRST_USER_MSG)
return;
- process_audit_string(s, nl->nlmsg_type, NLMSG_DATA(nl), nl->nlmsg_len - ALIGN(sizeof(struct nlmsghdr))
, tv
);
+ process_audit_string(s, nl->nlmsg_type, NLMSG_DATA(nl), nl->nlmsg_len - ALIGN(sizeof(struct nlmsghdr)));
}
static int enable_audit(int fd, bool b) {
}
static int enable_audit(int fd, bool b) {