Fix the "internal" wrapping as well as a nasty bug involving

the daemon name vs the path. Also fix some warnings and improve
the wrapper section of the man page.

Nice debugging work by:	Sheldon Hearn
This commit is contained in:
Mark Murray 1999-04-11 09:22:17 +00:00
parent 4ae29eb73c
commit d06590a52b
3 changed files with 17 additions and 9 deletions

View File

@ -1,11 +1,11 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $Id$
# $Id: Makefile,v 1.6 1999/03/28 10:50:30 markm Exp $
PROG= inetd
MAN8= inetd.8
MLINKS= inetd.8 inetd.conf.5
COPTS+= -Wall -DLOGIN_CAP -DLIBWRAP
COPTS+= -Wall -DLOGIN_CAP -DLIBWRAP -DLIBWRAP_INTERNAL
#COPTS+= -DSANITY_CHECK
DPADD+= ${LIBUTIL} ${LIBWRAP}

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)inetd.8 8.3 (Berkeley) 4/13/94
.\" $Id: inetd.8,v 1.22 1998/06/10 12:34:25 phk Exp $
.\" $Id: inetd.8,v 1.23 1999/03/28 10:50:30 markm Exp $
.\"
.Dd February 7, 1996
.Dt INETD 8
@ -383,9 +383,13 @@ records its process ID in the file
.Pa /var/run/inetd.pid
to assist in reconfiguration.
.Pp
Support is provided for tcp_wrappers; see the relevant documentation. The
Support is provided for tcp_wrappers; see the relevant documentation (
.Xr hosts_access 5
).
The
.Pa tcpd
daemon is not required.
daemon is not required, as that functionality is builtin. This also allows
the ``internal'' services to be wrapped.
.Sh TCPMUX
.Pp
.Tn RFC 1078

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)from: inetd.c 8.4 (Berkeley) 4/13/94";
#endif
static const char rcsid[] =
"$Id: inetd.c,v 1.46 1999/01/05 11:56:35 danny Exp $";
"$Id: inetd.c,v 1.47 1999/03/28 10:50:30 markm Exp $";
#endif /* not lint */
/*
@ -207,6 +207,7 @@ struct servtab {
#endif
struct biltin *se_bi; /* if built-in, description */
char *se_server; /* server program */
char *se_server_name; /* server program without path */
#define MAXARGV 20
char *se_argv[MAXARGV+1]; /* program arguments */
int se_fd; /* open descriptor */
@ -624,8 +625,8 @@ main(argc, argv, envp)
if (sep->se_accept
&& sep->se_socktype == SOCK_STREAM) {
request_init(&req,
RQ_DAEMON, sep->se_argv[0] ?
sep->se_argv[0] : sep->se_service,
RQ_DAEMON, sep->se_server_name ?
sep->se_server_name : sep->se_service,
RQ_FILE, ctrl, NULL);
fromhost(&req);
denied = !hosts_access(&req);
@ -1390,6 +1391,8 @@ getconfigent()
} else
sep->se_group = NULL;
sep->se_server = newstr(sskip(&cp));
if ((sep->se_server_name = rindex(sep->se_server, '/')))
sep->se_server_name++;
if (strcmp(sep->se_server, "internal") == 0) {
struct biltin *bi;
@ -1406,11 +1409,12 @@ getconfigent()
sep->se_bi = bi;
} else
sep->se_bi = NULL;
if (sep->se_maxchild < 0) /* apply default max-children */
if (sep->se_maxchild < 0) { /* apply default max-children */
if (sep->se_bi)
sep->se_maxchild = sep->se_bi->bi_maxchild;
else
sep->se_maxchild = sep->se_accept ? 0 : 1;
}
if (sep->se_maxchild) {
sep->se_pids = malloc(sep->se_maxchild * sizeof(*sep->se_pids));
if (sep->se_pids == NULL) {