[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-inetutils] [PATCH] Allow port numbers in inetd.conf
From: |
Jeroen Dekkers |
Subject: |
Re: [bug-inetutils] [PATCH] Allow port numbers in inetd.conf |
Date: |
Sun, 25 Apr 2004 10:43:12 +0200 |
User-agent: |
Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) |
At Sun, 25 Apr 2004 01:10:23 +0200,
Tollef Fog Heen wrote:
>
> * Jeroen Dekkers
>
> | At Sat, 24 Apr 2004 14:11:25 +0200,
> | Robert Millan wrote:
> | > I'm attaching a patch, made by Tollef Fog Heen <address@hidden>, for
> | > allowing port numbers in inetd.conf.
> | >
> | > 2004-04-24 Tollef Fog Heen <address@hidden>
> | >
> | > * inetd/inetd.c: Allow use of port numbers.
> | <SNIP>
> | > + port = strtol(sep->se_service, NULL, 10);
> | > + if (port > 0)
> | > + {
> | > + sp = malloc(sizeof(struct servent));
> | > + if (!sp)
> | > + {
> | > + syslog (LOG_ERR, strerror (errno));
> | > + continue;
> | > + }
> | > + asprintf(&(sp->s_name), "%d", port);
> | > + sp->s_aliases = NULL;
> | > + sp->s_port = htons(port);
> | > + sp->s_proto = strdup(sep->se_proto);
> | > + }
> |
> | Why don't you use getservbyport()?
>
> Because it only returns meaningful answers for ports which are
> registered in /etc/services:
Hmm, okay, that's right. But still you don't have to malloc and
fill the struct servent, you can just compare port to
sep->se_ctrladdr.sin_port and set sin_port etc if it differs.
Jeroen Dekkers