In message <pine.bsf.4.10.9908021226580.11428-100...@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 majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to