Hello,

this patch was partially erroneous. A reverting patch is included.

måndag den  6 september 2010 klockan 11:20 skrev Guillem Jover detta:
> * src/inetd.c (nextconfig): Call expand_enter instead of enter for
> tcpmux services.
> (fix_tcpmux): Likewise.
> ---
>  src/inetd.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/inetd.c b/src/inetd.c
> index 354ae1d..1c51a51 100644
> --- a/src/inetd.c
> +++ b/src/inetd.c
> @@ -1161,10 +1161,8 @@ nextconfig (const char *file)
>       {
>         sep->se_fd = -1;
>         sep->se_checked = 1;
> -       enter (sep);
>       }
> -      else
> -     expand_enter (sep);
> +      expand_enter (sep);
>        freeconfig (sep);
>      }
>    endconfig (fconfig);

Since expand_enter() uses getaddrinfo(3) in resolving the service
name, every effort to start any TCPMUX service will fail immediately.
The original coding is correct. Sorry to say, but no testing to actually
start a custom TCPMUX service, using this alteration, could ever have
been performed. It would have been sufficent to try

     tcpmux stream tcp nowait root internal
     tcpmux/honeybee stream tcp nowait nobody /bin/date date

and

     $ echo "honeybee" | nc localhost 1

> @@ -1249,7 +1247,7 @@ fix_tcpmux (void)
>        if (debug)
>       fprintf (stderr, "inserting default tcpmux entry\n");
>        syslog (LOG_INFO, "inserting default tcpmux entry");
> -      enter (&serv);
> +      expand_enter (&serv);
>      }
>  }
>  

This change is correct, however, since

    $ getent services tcpmux

is a correct call.


Best regards,

Mats E A
From f7a67c19fb268b78e6474834247b099c774c1dcf Mon Sep 17 00:00:00 2001
From: Mats Erik Andersson <g...@gisladisker.se>
Date: Sat, 13 Nov 2010 11:09:34 +0100
Subject: [PATCH] inetd: Distinguish `enter' and `expand_enter'.

Partially revert commit fd64a202, which completely
broke all of TCPMUX.
---
 ChangeLog   |    7 +++++++
 src/inetd.c |    5 ++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cf06cfa..1f79514 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-13  Mats Erik Andersson <g...@gisladisker.se>
+
+	Partially revert changes introduced in fd64a202.
+
+	* src/inetd.c (nextconfig): Call `enter' for TCPMUX services,
+	but `expand_enter' for every other service.
+
 2010-11-09  Mats Erik Andersson <g...@gisladisker.se>
 
 	* tests/addrpeek.c: New file.
diff --git a/src/inetd.c b/src/inetd.c
index e711095..a530016 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -1163,8 +1163,11 @@ nextconfig (const char *file)
 	{
 	  sep->se_fd = -1;
 	  sep->se_checked = 1;
+	  enter (sep);
 	}
-      expand_enter (sep);
+      else
+	expand_enter (sep);
+
       freeconfig (sep);
     }
   endconfig (fconfig);
-- 
1.7.2.3

Attachment: signature.asc
Description: Digital signature

Reply via email to