From 7e5ed09d927ffb3ef48fdf3235c09efc45dbdc0b Mon Sep 17 00:00:00 2001 From: cjs Date: Sat, 11 Jan 1997 03:33:31 +0000 Subject: [PATCH] Add a list of programs which are not in /etc/inetd.conf but use libwrap on their own (currently just /usr/sbin/sendmail). Also, mark all programs in inetd as wrapped even without tcpd being called, since NetBSD inetd wraps all programs. --- usr.sbin/tcpdchk/inetcf.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/usr.sbin/tcpdchk/inetcf.c b/usr.sbin/tcpdchk/inetcf.c index 6a4e0b29cd72..88e049fd7661 100644 --- a/usr.sbin/tcpdchk/inetcf.c +++ b/usr.sbin/tcpdchk/inetcf.c @@ -21,6 +21,19 @@ extern void exit(); #include "tcpd.h" #include "inetcf.h" + /* + * Programs that use libwrap directly are not in inetd.conf, and so must + * be added here in a similar format. (We pretend we found them in + * /etc/inetd.conf.) Each one is a set of three strings that correspond + * to fields in /etc/inetd.conf: + * protocol (field 3), path (field 6), arg0 (field 7) + * The last entry should be a NULL. + */ +char *uses_libwrap[] = { + "tcp", "/usr/sbin/sendmail", "sendmail", + (char *) NULL +}; + /* * Network configuration files may live in unusual places. Here are some * guesses. Shorter names follow longer ones. @@ -59,6 +72,7 @@ char *conf; { char buf[BUFSIZ]; FILE *fp; + char **wrapped; char *service; char *protocol; char *user; @@ -94,6 +108,15 @@ char *conf; check_path(conf, &st); } + /* + * Process the list of programs that use libwrap directly. + */ + wrapped = uses_libwrap; + while (*wrapped != NULL) { + inet_chk(wrapped[0], wrapped[1], wrapped[2], ""); + wrapped += 3; + } + /* * Process the file. After the 7.0 wrapper release it became clear that * there are many more inetd.conf formats than the 8 systems that I had @@ -263,6 +286,10 @@ char *arg1; if (wrap_status == WR_YES && STR_EQ(protocol, "rpc/tcp")) tcpd_warn("%s: cannot wrap rpc/tcp services", tcpd_proc_name); + /* NetBSD inetd wraps all programs */ + if (! STR_EQ(protocol, "rpc/tcp")) + wrap_status = WR_YES; + inet_set(tcpd_proc_name, wrap_status); }