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.
This commit is contained in:
cjs 1997-01-11 03:33:31 +00:00
parent fbb40475d5
commit 7e5ed09d92
1 changed files with 27 additions and 0 deletions

View File

@ -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);
}