Skip to content

Commit 7f38f72

Browse files
fix tcp_wrappers cleanup
1 parent 19c604c commit 7f38f72

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/auditd-listen.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,7 @@ static void auditd_tcp_client_handler(struct ev_loop *loop,
736736
goto read_more;
737737
}
738738

739-
#ifndef HAVE_LIBWRAP
740-
#define auditd_tcpd_check(s) ({ 0; })
741-
#else
739+
#ifdef HAVE_LIBWRAP
742740
int allow_severity = LOG_INFO, deny_severity = LOG_NOTICE;
743741
static int auditd_tcpd_check(int sock)
744742
{
@@ -802,9 +800,9 @@ static void auditd_tcp_listen_handler( struct ev_loop *loop,
802800
return;
803801
}
804802

803+
#ifdef HAVE_LIBWRAP
805804
if (use_libwrap) {
806805
if (auditd_tcpd_check(afd)) {
807-
#ifndef HAVE_LIBWRAP
808806
shutdown(afd, SHUT_RDWR);
809807
close(afd);
810808
audit_msg(LOG_ERR, "TCP connection from %s rejected",
@@ -815,9 +813,9 @@ static void auditd_tcp_listen_handler( struct ev_loop *loop,
815813
sockaddr_to_port(&aaddr));
816814
send_audit_event(AUDIT_DAEMON_ACCEPT, emsg);
817815
return;
818-
#endif
819816
}
820817
}
818+
#endif
821819

822820
/* Verify it's coming from an authorized port. We assume the firewall
823821
* will block attempts from unauthorized machines. */

0 commit comments

Comments
 (0)