Date: Wed, 4 Aug 1999 08:06:29 +1000 From: Peter Jeremy <jeremyp@gsmx07.alcatel.com.au> To: hackers@FreeBSD.ORG Subject: Re: Mentioning RFC numbers in /etc/services Message-ID: <99Aug4.074710est.40322@border.alcanet.com.au>
next in thread | raw e-mail | index | archive | help
Assar Westerlund <assar@sics.se> wrote:
As an enhancement, the strtol() check should verify that the passed
service number is completely numeric:
>--- 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;
+ char *ep;
>+
> sp = getservbyname(sep->se_service, sep->se_proto);
> if (sp == 0) {
>- syslog(LOG_ERR, "%s/%s: unknown service",
>+ port = htons(strtol (sep->se_service,
+ &ep, 0));
+ if (port <= 0 || *ep) {
...
and similarly for the RPC service number.
Brian Somers <brian@Awfulhak.org> wrote:
>I know I'd be pretty annoyed if I tried to do something like ``ssh -p
>1234 somewhere'' after configuring my interface in single-user modem
>with nis in /etc/host.conf and found that ssh was looking up 1234 in
>/etc/services. Even if this is right, it's not intuitive.
Adding definitions like ': 1 2 ;' to forth is always good for confusing
people. Similarly, adding lines like '1234 4321/tcp' to /etc/services
will lead to counter-intuitive behaviour.
That said, I think that the get...byname() should preceed the strtol()
for general consistency.
Brian Somers <brian@Awfulhak.org> wrote:
>I've been stung with things like pipe() for exactly the same reasons.
>IMHO, pipe() should *not* behave like socketpair() as it encourages
>FreeBSD developers to write bad code :-(
SVR4 provides bi-directional pipe(2) FD's. Digital UNIX (aka OSF/1
aka Tru64) seems to support both behaviours. I suspect the trend will
be for pipe()'s to be bi-directional. Feel free to add a sysctl to
make pipe's unidirectional.
Peter
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?99Aug4.074710est.40322>
