Skip to content

Commit 80ebc60

Browse files
committed
Invalid magic number on remote reply leaves connection open
In recv_msg_tcp, encountering a bad magic number only logs an error and returns, leaving the socket open even though the comment notes it should be closed and restarted. When recv_msg_tcp encounters an invalid magic number it now shuts down the existing connection with stop_transport(), attempts to re-establish it immediately, and returns a failure if reconnection fails.
1 parent fd40e02 commit 80ebc60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

audisp/plugins/remote/audisp-remote.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,10 +1454,12 @@ static int recv_msg_tcp (unsigned char *header, char *msg, uint32_t *mlen)
14541454
}
14551455

14561456
if (! AUDIT_RMW_IS_MAGIC (header, AUDIT_RMW_HEADER_SIZE)) {
1457-
/* FIXME: the right thing to do here is close the socket
1458-
* and start a new one. */
1457+
/* close the socket and start a new one. */
14591458
sync_error_handler ("bad magic number");
1459+
stop_transport();
1460+
init_transport();
14601461
return -1;
1462+
14611463
}
14621464

14631465
AUDIT_RMW_UNPACK_HEADER (header, hver, mver, type, rlen, seq);

0 commit comments

Comments
 (0)