summaryrefslogtreecommitdiffstats
path: root/usr.sbin/inetd
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>1999-07-02 16:21:13 +0000
committersheldonh <sheldonh@FreeBSD.org>1999-07-02 16:21:13 +0000
commit60d229e604f6fdbe9921b44b59b82b2469286d78 (patch)
tree8a077082da0e7f40743198ac8c083b46840a1cba /usr.sbin/inetd
parent70faa23160a0584ce70fafd64bc4ab63f6b859e0 (diff)
downloadFreeBSD-src-60d229e604f6fdbe9921b44b59b82b2469286d78.zip
FreeBSD-src-60d229e604f6fdbe9921b44b59b82b2469286d78.tar.gz
Allow service alias names from /etc/services to be used when specifying
internal services in inetd.conf . The inetd(8) manpage used to say that the official name of a service _must_ be used, yet inetd itself was hardcoded to used a service alias for the auth service, namely ident! Rather than change inetd.conf and break existing configurations on next upgrade, we now allow service aliases as well as official names. This allows the software to work as expected and still support existing configurations. This should not breaking existing wrapped configurations either and the inetd(8) manpage already states that it is the service name specified in inetd.conf that is used for calls to hosts_access(3). PR: 11796 Reported by: Alex Charalabidis <alex@wnm.net> Approved by: des
Diffstat (limited to 'usr.sbin/inetd')
-rw-r--r--usr.sbin/inetd/inetd.84
-rw-r--r--usr.sbin/inetd/inetd.c28
2 files changed, 26 insertions, 6 deletions
diff --git a/usr.sbin/inetd/inetd.8 b/usr.sbin/inetd/inetd.8
index 094de17..aca5f8c 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.31 1999/06/30 23:47:46 sheldonh Exp $
+.\" $Id: inetd.8,v 1.32 1999/07/02 15:58:32 sheldonh Exp $
.\"
.Dd February 7, 1996
.Dt INETD 8
@@ -168,7 +168,7 @@ For
.Dq internal
services (discussed below), the service
name
-.Em must
+should
be the official name of the service (that is, the first entry in
.Pa /etc/services ) .
When used to specify an
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 7d73ac0..e7d610c 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.55 1999/06/30 23:36:39 sheldonh Exp $";
+ "$Id: inetd.c,v 1.56 1999/06/30 23:47:46 sheldonh Exp $";
#endif /* not lint */
/*
@@ -258,6 +258,7 @@ struct servtab *getconfigent __P((void));
void ident_stream __P((int, struct servtab *));
void machtime_dg __P((int, struct servtab *));
void machtime_stream __P((int, struct servtab *));
+int matchservent __P((char *, char *, char *));
char *newstr __P((char *));
char *nextline __P((FILE *));
void print_service __P((char *, struct servtab *));
@@ -306,7 +307,7 @@ struct biltin {
{ "tcpmux", SOCK_STREAM, 1, -1, (void (*)())tcpmux },
- { "ident", SOCK_STREAM, 1, -1, ident_stream },
+ { "auth", SOCK_STREAM, 1, -1, ident_stream },
{ NULL }
};
@@ -1124,6 +1125,23 @@ close_sep(sep)
sep->se_numchild = 0; /* forget about any existing children */
}
+int
+matchservent(name1, name2, proto)
+ char *name1, *name2, *proto;
+{
+ char **alias;
+ struct servent *se;
+
+ if ((se = getservbyname(name1, proto)) != NULL) {
+ if (strcmp(name2, se->s_name) == 0)
+ return(1);
+ for (alias = se->s_aliases; *alias; alias++)
+ if (strcmp(name2, *alias) == 0)
+ return(1);
+ }
+ return(0);
+}
+
struct servtab *
enter(cp)
struct servtab *cp;
@@ -1398,8 +1416,10 @@ more:
struct biltin *bi;
for (bi = biltins; bi->bi_service; bi++)
- if (bi->bi_socktype == sep->se_socktype &&
- strcmp(bi->bi_service, sep->se_service) == 0)
+ if ((bi->bi_socktype == sep->se_socktype &&
+ strcmp(bi->bi_service, sep->se_service) == 0) ||
+ matchservent(bi->bi_service, sep->se_service,
+ sep->se_proto))
break;
if (bi->bi_service == 0) {
syslog(LOG_ERR, "internal service %s unknown",
OpenPOWER on IntegriCloud