From 9012e78ce46db3225223ddbc2aeb549be9b13561 Mon Sep 17 00:00:00 2001 From: markm Date: Sun, 11 Apr 1999 09:22:17 +0000 Subject: 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 --- usr.sbin/inetd/Makefile | 4 ++-- usr.sbin/inetd/inetd.8 | 10 +++++++--- usr.sbin/inetd/inetd.c | 12 ++++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/inetd/Makefile b/usr.sbin/inetd/Makefile index 1c671fc..4178a23 100644 --- a/usr.sbin/inetd/Makefile +++ b/usr.sbin/inetd/Makefile @@ -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} diff --git a/usr.sbin/inetd/inetd.8 b/usr.sbin/inetd/inetd.8 index 55c2461..b55e205 100644 --- a/usr.sbin/inetd/inetd.8 +++ b/usr.sbin/inetd/inetd.8 @@ -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 diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index f7cd1d5..ae6e31f 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -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 @@ more: } 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 @@ more: 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) { -- cgit v1.1