From: Marco d'Itri <md@linux.it>
Date: Sat, 14 May 2022 02:57:49 +0800
Subject: tcpdchk_libwrapped

---
 tcpdchk.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tcpdchk.c b/tcpdchk.c
index 416c08d..4931e99 100644
--- a/tcpdchk.c
+++ b/tcpdchk.c
@@ -53,6 +53,24 @@ extern char *optarg;
 #include "inetcf.h"
 #include "scaffold.h"
 
+/* list of programs which are known to be linked with libwrap in debian */
+static const char *const libwrap_programs[] = {
+    "portmap", "mountd", "statd", "ugidd",
+    "redir", "rlinetd",
+    "sshd",
+    "atftpd",
+    "diald",
+    "esound",
+    "gdm", "gnome-session",
+    "icecast", "icecast_admin", "icecast_client", "icecast_source",
+    "mysqld",
+    "ntop",
+    "pptpd",
+    "rquotad",
+    "sendmail", "smail",
+    NULL
+};
+
  /*
   * Stolen from hosts_access.c...
   */
@@ -147,8 +165,8 @@ char  **argv;
     /*
      * These are not run from inetd but may have built-in access control.
      */
-    inet_set("portmap", WR_NOT);
-    inet_set("rpcbind", WR_NOT);
+    for (c = 0; libwrap_programs[c]; c++)
+	inet_set(libwrap_programs[c], WR_YES);
 
     /*
      * Check accessibility of access control files.
