Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Aug 1999 11:32:15 -0600
From:      Warner Losh <imp@village.org>
To:        Bill Fumerola <billf@jade.chc-chimes.com>
Cc:        committers@FreeBSD.ORG, hackers@FreeBSD.ORG
Subject:   Re: Mentioning RFC numbers in /etc/services 
Message-ID:  <199908021732.LAA07269@harmony.village.org>
In-Reply-To: Your message of "Mon, 02 Aug 1999 12:27:51 EDT." <Pine.BSF.4.10.9908021226580.11428-100000@jade.chc-chimes.com> 
References:  <Pine.BSF.4.10.9908021226580.11428-100000@jade.chc-chimes.com>  

next in thread | previous in thread | raw e-mail | index | archive | help
In message <Pine.BSF.4.10.9908021226580.11428-100000@jade.chc-chimes.com> Bill Fumerola writes:
: I agree. The change should be made in inetd, not in getportbyname()

Or getservbyname (which is really what you'd want to change).  I have
patches to inetd that I've enclosed here.  They are gorss, but the
code itself doesn't lend itself to non-gross patches w/o some rework,
which I was too lazy to do this morning.

Warner

Index: inetd.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/usr.sbin/inetd/inetd.c,v
retrieving revision 1.70
diff -u -r1.70 inetd.c
--- inetd.c	1999/07/26 06:39:46	1.70
+++ inetd.c	1999/08/02 17:27:52
@@ -744,6 +744,7 @@
 {
 	struct servtab *sep, *new, **sepp;
 	long omask;
+	int p;
 
 	if (!setconfig()) {
 		syslog(LOG_ERR, "%s: %m", CONFIG);
@@ -832,15 +833,21 @@
 		if (!sep->se_rpc) {
 			sp = getservbyname(sep->se_service, sep->se_proto);
 			if (sp == 0) {
+				if ((p = strtol(sep->se_service, 
+				    (char **NULL), 10))) {
+					sep->se_ctrladdr.sin_port = htons(p);
+					goto numeric_override;
+				}
 				syslog(LOG_ERR, "%s/%s: unknown service",
 			    	sep->se_service, sep->se_proto);
 				sep->se_checked = 0;
 				continue;
 			}
 			if (sp->s_port != sep->se_ctrladdr.sin_port) {
+				sep->se_ctrladdr.sin_port = sp->s_port;
+numeric_override:
 				sep->se_ctrladdr.sin_family = AF_INET;
 				sep->se_ctrladdr.sin_addr = bind_address;
-				sep->se_ctrladdr.sin_port = sp->s_port;
 				if (sep->se_fd >= 0)
 					close_sep(sep);
 			}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908021732.LAA07269>