Date: 02 Aug 1999 22:47:16 +0200 From: Assar Westerlund <assar@sics.se> To: Warner Losh <imp@village.org> Cc: Bill Fumerola <billf@jade.chc-chimes.com>, committers@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: Mentioning RFC numbers in /etc/services Message-ID: <5laes96hbf.fsf@assaris.sics.se> In-Reply-To: Warner Losh's message of "Mon, 02 Aug 1999 11:32:15 -0600" References: <Pine.BSF.4.10.9908021226580.11428-100000@jade.chc-chimes.com> <199908021732.LAA07269@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Warner Losh <imp@village.org> writes:
> 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.
Or you might as well fix it for RPCs at the same time.
/assar
--- inetd.c.orig Mon Aug 2 22:35:28 1999
+++ inetd.c Mon Aug 2 22:41:52 1999
@@ -830,34 +830,50 @@
continue;
}
if (!sep->se_rpc) {
+ int port;
+
sp = getservbyname(sep->se_service, sep->se_proto);
if (sp == 0) {
- syslog(LOG_ERR, "%s/%s: unknown service",
+ port = htons(strtol (sep->se_service,
+ NULL, 0));
+ if (port == 0) {
+ 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) {
+ } else
+ port = sp->s_port;
+ if (port != sep->se_ctrladdr.sin_port) {
sep->se_ctrladdr.sin_family = AF_INET;
sep->se_ctrladdr.sin_addr = bind_address;
- sep->se_ctrladdr.sin_port = sp->s_port;
+ sep->se_ctrladdr.sin_port = port;
if (sep->se_fd >= 0)
close_sep(sep);
}
} else {
+ int rpc_number;
+
rpc = getrpcbyname(sep->se_service);
if (rpc == 0) {
- syslog(LOG_ERR, "%s/%s unknown RPC service.",
+ rpc_number = strtol (sep->se_service,
+ NULL, 0);
+ if (rpc_number == 0) {
+ syslog(LOG_ERR,
+ "%s/%s unknown RPC service.",
sep->se_service, sep->se_proto);
if (sep->se_fd != -1)
(void) close(sep->se_fd);
sep->se_fd = -1;
continue;
}
- if (rpc->r_number != sep->se_rpc_prog) {
+ } else
+ rpc_number = sep->se_rpc_prog;
+ if (rpc_number != sep->se_rpc_prog) {
if (sep->se_rpc_prog)
unregisterrpc(sep);
- sep->se_rpc_prog = rpc->r_number;
+ sep->se_rpc_prog = rpc_number;
if (sep->se_fd != -1)
(void) close(sep->se_fd);
sep->se_fd = -1;
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?5laes96hbf.fsf>
