From owner-freebsd-hackers Mon Aug 2 13:46:48 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from assaris.sics.se (assaris.sics.se [193.10.66.108]) by hub.freebsd.org (Postfix) with ESMTP id 982F914CC4; Mon, 2 Aug 1999 13:46:40 -0700 (PDT) (envelope-from assar@sics.se) Received: (from assar@localhost) by assaris.sics.se (8.9.3/8.7.3) id WAA02373; Mon, 2 Aug 1999 22:47:17 +0200 (CEST) To: Warner Losh Cc: Bill Fumerola , committers@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: Mentioning RFC numbers in /etc/services References: <199908021732.LAA07269@harmony.village.org> Mime-Version: 1.0 (generated by tm-edit 7.68) Content-Type: text/plain; charset=US-ASCII From: Assar Westerlund Date: 02 Aug 1999 22:47:16 +0200 In-Reply-To: Warner Losh's message of "Mon, 02 Aug 1999 11:32:15 -0600" Message-ID: <5laes96hbf.fsf@assaris.sics.se> Lines: 69 X-Mailer: Gnus v5.5/Emacs 19.34 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Warner Losh 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