Skip to content

Commit 79375b5

Browse files
committed
If af_unix finds stdin to not be a socket, assume a file and string
1 parent 1d4e19d commit 79375b5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

audisp/plugins/af_unix/audisp-af_unix.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,13 @@ void read_audit_record(int ifd)
384384
rc = recvfrom(ifd, peek, sizeof(peek), MSG_PEEK, NULL, NULL);
385385
if (rc < 0) {
386386
if (errno == ENOTSOCK) {
387-
syslog(LOG_ERR, "stdin is not a socket (%s)",
388-
strerror(errno));
389-
exit(1);
387+
// Let's assume it is a file which means string
388+
inbound_protocol = F_STRING;
389+
goto resolved;
390390
}
391+
syslog(LOG_ERR, "recvfrom failed (%s)",
392+
strerror(errno));
393+
stop = 1;
391394
return;
392395
}
393396
if (rc == 0) {
@@ -400,6 +403,7 @@ void read_audit_record(int ifd)
400403
inbound_protocol = F_STRING;
401404
}
402405

406+
resolved:
403407
if (inbound_protocol == F_BINARY) {
404408
struct audit_dispatcher_header *hdr =
405409
(struct audit_dispatcher_header *)rx_buf;

0 commit comments

Comments
 (0)