commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_8-78-g3954dfe


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_8-78-g3954dfe
Date: Tue, 21 Dec 2010 16:33:58 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  3954dfe0534fe9f7394abe5f71794b28fdfa1c94 (commit)
       via  674b822746eb05faf72142a4b4bad1be41315b74 (commit)
       via  87657d8463be936fa813ca970064bb442c8a69ee (commit)
       via  202092b67d010d5d7b259bcf8b452052c6814b69 (commit)
       via  791329d9b2cf8c5237939782a0d6aae4adfa0487 (commit)
      from  0d25bc27e33926f8794fd823f5ebea54d16c3084 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=3954dfe0534fe9f7394abe5f71794b28fdfa1c94


commit 3954dfe0534fe9f7394abe5f71794b28fdfa1c94
Author: Mats Erik Andersson <address@hidden>
Date:   Tue Dec 21 16:08:11 2010 +0100

    inetd: Replaceable path for PID file.

diff --git a/ChangeLog b/ChangeLog
index fe1e866..47d34e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2010-12-21  Mats Erik Andersson <address@hidden>
 
+       * src/inetd.c (pidfile_option): New variable.
+       (pid_file): New variable.
+       (argp_options): Add an option for replacing path of PID file.
+       (parse_opt): Handle option `p'.
+       (main): Condition PID file use on PIDFILE_OPTION. Replace the
+       macro PATH_INETDPID by variable PID_FILE.
+
+2010-12-21  Mats Erik Andersson <address@hidden>
+
        * src/inetd.c (inetd_getaddrinfo): If IPV6, then add a flag
        AI_NUMERICHOST if the node is a numeric address string.
        New variable NUMERIC_ADDRESS.  Debug symbolic addresses.
diff --git a/src/inetd.c b/src/inetd.c
index 3d87867..8d2a915 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -163,6 +163,8 @@ char **config_files;
 
 static bool env_option = false;               /* Set environment variables */
 static bool resolve_option = false;    /* Resolve IP addresses */
+static bool pidfile_option = true;     /* Record the PID in a file */
+static const char *pid_file = PATH_INETDPID;
 
 const char args_doc[] = "[CONF-FILE [CONF-DIR]]...";
 const char doc[] = "Internet super-server.";
@@ -185,6 +187,9 @@ static struct argp_option argp_options[] = {
    "turn on debugging, run in foreground mode", GRP+1},
   {"environment", OPT_ENVIRON, NULL, 0,
    "pass local and remote socket information in environment variables", GRP+1},
+  { "pidfile", 'p', "PIDFILE", OPTION_ARG_OPTIONAL,
+    "replace the default path \"" PATH_INETDPID "\"",
+    GRP+1 },
   {"rate", 'R', "NUMBER", 0,
    "maximum invocation rate (per minute)", GRP+1},
   {"resolve", OPT_RESOLVE, NULL, 0,
@@ -211,6 +216,13 @@ parse_opt (int key, char *arg, struct argp_state *state)
       env_option = true;
       break;
 
+    case 'p':
+      if (arg && strlen (arg))
+       pid_file = arg;
+      else
+       pidfile_option = false;
+      break;
+
     case 'R':
       number = strtol (arg, &p, 0);
       if (number < 1 || *p)
@@ -1859,15 +1871,18 @@ main (int argc, char *argv[], char *envp[])
 
   openlog ("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
 
+  if (pidfile_option)
   {
-    FILE *fp = fopen (PATH_INETDPID, "w");
+    FILE *fp = fopen (pid_file, "w");
     if (fp != NULL)
       {
+       if (debug)
+         fprintf(stderr, "Using pid-file at \"%s\".\n", pid_file);
        fprintf (fp, "%d\n", getpid ());
        fclose (fp);
       }
     else
-      syslog (LOG_CRIT, "can't open %s: %s\n", PATH_INETDPID,
+      syslog (LOG_CRIT, "can't open %s: %s\n", pid_file,
              strerror (errno));
   }
 

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=674b822746eb05faf72142a4b4bad1be41315b74


commit 674b822746eb05faf72142a4b4bad1be41315b74
Author: Mats Erik Andersson <address@hidden>
Date:   Tue Dec 21 16:04:50 2010 +0100

    inetd: Adapt service nodes to IPv6.

diff --git a/ChangeLog b/ChangeLog
index d326942..fe1e866 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-12-21  Mats Erik Andersson <address@hidden>
 
+       * src/inetd.c (inetd_getaddrinfo): If IPV6, then add a flag
+       AI_NUMERICHOST if the node is a numeric address string.
+       New variable NUMERIC_ADDRESS.  Debug symbolic addresses.
+       (getconfigent): Replace `strchr' with `strrchr'.
+
+2010-12-21  Mats Erik Andersson <address@hidden>
+
        * src/inetd.c (print_service): If `ISMUX(SEP)' then present the
        node name as `tcpmux' or as `tcpmuxplus'.  Make 'builtin=' show
        actual service name, or `no' for non-builtins.
diff --git a/src/inetd.c b/src/inetd.c
index 7f7adbb..3d87867 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -737,10 +737,33 @@ enter (struct servtab *cp)
   return sep;
 }
 
+#define IPV4_NUMCHARS ".0123456789"
+#define IPV6_NUMCHARS ".:0123456789abcdefABCDEF"
+
 int
 inetd_getaddrinfo (struct servtab *sep, int proto, struct addrinfo **result)
 {
   struct addrinfo hints;
+#ifdef IPV6
+  bool numeric_address = false;
+
+  /* In case a numerical address is supplied, which does not
+     apply to the indicated domain, a non-local resolver
+     will wait in vain until time out occurs, thus blocking.
+     Avoid this by falling back to numerical host resolving
+     when address string seems to be numerical.  */
+
+  /* Purely numeric address?  Separate criteria for IPv4 and IPv6,
+     since IPv6 allows hexadecimal coding and IPv4 mapping!  */
+  if (sep->se_node
+      && (strspn (sep->se_node, IPV4_NUMCHARS) == strlen (sep->se_node)
+         || (strchr (sep->se_node, ':')
+             && strspn (sep->se_node, IPV6_NUMCHARS)) ) )
+    numeric_address = true;
+  else
+    if (debug && sep->se_node)
+      fprintf (stderr, "Resolving address: %s\n", sep->se_node);
+#endif /* IPV6 */
 
   memset (&hints, 0, sizeof (hints));
 
@@ -749,6 +772,10 @@ inetd_getaddrinfo (struct servtab *sep, int proto, struct 
addrinfo **result)
   if (sep->se_v4mapped && (sep->se_family != AF_INET))
     hints.ai_flags |= AI_V4MAPPED;
 #endif
+#ifdef IPV6
+  if (numeric_address)
+    hints.ai_flags |= AI_NUMERICHOST;
+#endif
   hints.ai_family = sep->se_family;
   hints.ai_socktype = sep->se_socktype;
   hints.ai_protocol = proto;
@@ -944,7 +971,7 @@ getconfigent (FILE *fconfig, const char *file, size_t *line)
       sep->se_line = *line;
 
       node = argv[INETD_SERVICE];
-      service = strchr (node, ':');
+      service = strrchr (node, ':');
       if (!service)
         {
          if (global_serv_node)

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=87657d8463be936fa813ca970064bb442c8a69ee


commit 87657d8463be936fa813ca970064bb442c8a69ee
Author: Mats Erik Andersson <address@hidden>
Date:   Tue Dec 21 15:57:25 2010 +0100

    inetd: Improve printout of service changes.

diff --git a/ChangeLog b/ChangeLog
index ed27d79..d326942 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-12-21  Mats Erik Andersson <address@hidden>
 
+       * src/inetd.c (print_service): If `ISMUX(SEP)' then present the
+       node name as `tcpmux' or as `tcpmuxplus'.  Make 'builtin=' show
+       actual service name, or `no' for non-builtins.
+       (fix_tcpmux): Let SERV.se_file report `fix_tcpmux' as origin.
+       Correct some spelling mistakes in error message.
+
+2010-12-21  Mats Erik Andersson <address@hidden>
+
        * tests/addrpeek.c: New file.
        * tests/Makefile.am: Register `addrpeek' using
        `check_PROGRAMS', but conditioned on `ENABLE_inetd'.
diff --git a/src/inetd.c b/src/inetd.c
index 625ebff..7f7adbb 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -523,12 +523,15 @@ void
 print_service (const char *action, struct servtab *sep)
 {
   fprintf (stderr,
-          "%s:%d: %s: %s:%s proto=%s, wait=%d, max=%u, user=%s builtin=%lx 
server=%s\n",
+          "%s:%d: %s: %s:%s proto=%s, wait=%d, max=%u, user=%s builtin=%s 
server=%s\n",
           sep->se_file, sep->se_line,
           action,
-          sep->se_node ? sep->se_node : "*", sep->se_service, sep->se_proto,
+          ISMUX (sep) ? (ISMUXPLUS (sep) ? "tcpmuxplus" : "tcpmux")
+                     : (sep->se_node ? sep->se_node : "*"),
+          sep->se_service, sep->se_proto,
           sep->se_wait, sep->se_max, sep->se_user,
-          (long) sep->se_bi, sep->se_server);
+          sep->se_bi ? sep->se_bi->bi_service : "no",
+          sep->se_server);
 }
 
 
@@ -1227,6 +1230,7 @@ fix_tcpmux (void)
       struct servtab serv;
       memset (&serv, 0, sizeof (serv));
 
+      serv.se_file = "fix_tcpmux";
       serv.se_service = newstr ("tcpmux");
       serv.se_socktype = SOCK_STREAM;
       serv.se_checked = 1;
@@ -1237,8 +1241,8 @@ fix_tcpmux (void)
          /* Should not happen */
          freeconfig (&serv);
          if (debug)
-           fprintf (stderr, "INETERNAL ERROR: could not found tcpmux 
built-in");
-         syslog (LOG_ERR, "INETERNAL ERROR: could not found tcpmux built-in");
+           fprintf (stderr, "INTERNAL ERROR: could not find tcpmux built-in");
+         syslog (LOG_ERR, "INTERNAL ERROR: could not find tcpmux built-in");
          return;
        }
       serv.se_wait = serv.se_bi->bi_wait;

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=202092b67d010d5d7b259bcf8b452052c6814b69


commit 202092b67d010d5d7b259bcf8b452052c6814b69
Author: Mats Erik Andersson <address@hidden>
Date:   Tue Dec 21 15:50:50 2010 +0100

    addrpeek: New test service for Inetd.

diff --git a/ChangeLog b/ChangeLog
index b1ea660..ed27d79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-12-21  Mats Erik Andersson <address@hidden>
 
+       * tests/addrpeek.c: New file.
+       * tests/Makefile.am: Register `addrpeek' using
+       `check_PROGRAMS', but conditioned on `ENABLE_inetd'.
+
+2010-12-21  Mats Erik Andersson <address@hidden>
+
        * src/inetd.c (prepenv): New prototype:
        `prepenv(int, struct sockaddr *, socklen_t)'.
        (prepenv): Change type of IP to `char []' of fixed length.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cce19ee..1327c5e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,6 +21,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/libinetutils 
-I$(top_srcdir)/lib
 LDADD = -L../libinetutils -linetutils  ../lib/libgnu.a
 
 check_PROGRAMS = localhost
+if ENABLE_inetd
+check_PROGRAMS += addrpeek
+endif
+
 dist_check_SCRIPTS =
 if ENABLE_ping
 dist_check_SCRIPTS += ping-localhost.sh
diff --git a/tests/addrpeek.c b/tests/addrpeek.c
new file mode 100644
index 0000000..02319b2
--- /dev/null
+++ b/tests/addrpeek.c
@@ -0,0 +1,135 @@
+/* addrpeek - testing service for Inetd: remote address, environment vars
+  Copyright (C) 2010 Free Software Foundation, Inc.
+
+  This file is part of GNU Inetutils.
+
+  GNU Inetutils is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or (at
+  your option) any later version.
+
+  GNU Inetutils is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see `http://www.gnu.org/licenses/'. */
+
+/* Written by Mats Erik Andersson.  */
+
+/* Addrpeek is a test client for examining Inetd, primarily TCP traffic.
+ * The client executes all those tasks that were listed as server
+ * arguments in the configuration file for Inetd:
+ *
+ *    addr : Reply with "Your address is $IP."
+ *    env  : Reply with all known environment variables and their values.
+ *
+ * Reasonable entries in `inetf.conf' could be
+ *
+ *    # Return numerical address of the calling client.
+ *    #
+ *    7890 stream tcp nowait nobody /tmp/addrpeek addrpeek addr
+ *    7890 stream tcp6 nowait nobody /tmp/addrpeek addrpeek addr
+ *    #
+ *    # Display all environment variables in use, and append
+ *    # the client's address at the end.
+ *    #
+ *    tcpmux stream tcp nowait nobody internal
+ *    tcpmux stream tcp6 nowait nobody internal
+ *    tcpmux/env stream tcp nowait nobody /tmp/addrpeek addrkeep env addr
+ */
+
+#include "config.h"
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+
+#ifndef SEPARATOR
+# define SEPARATOR "\n"
+#endif
+
+/* TODO Develop some reliable test for the existence of ENVIRON.
+ * It is detectable using HAVE_DECL_ENVIRON for GNU/Linux and
+ * GNU/kFreeBSD. It is present, but not detectable for OpenBSD
+ * and FreeBSD.
+ */
+extern char **environ;
+
+static void
+write_address (int fd)
+{
+  int type;
+  size_t len;
+  socklen_t sslen;
+  char addr[INET6_ADDRSTRLEN], answer[128];
+  struct sockaddr_storage ss;
+
+  sslen = sizeof (type);
+  getsockopt (fd, SOL_SOCKET, SO_TYPE, &type, &sslen);
+
+  if (type == SOCK_STREAM)
+    {
+      sslen = sizeof (ss);
+      getpeername (fd, (struct sockaddr *) &ss, &sslen);
+    }
+  else if (type == SOCK_DGRAM)
+    {
+      sslen = sizeof (ss);
+      recvfrom (fd, answer, sizeof (answer), 0,
+                  (struct sockaddr *) &ss, &sslen);
+      shutdown (fd, SHUT_RD);
+    }
+  else
+      return;
+
+  getnameinfo ((struct sockaddr *) &ss, sslen, addr, sizeof (addr),
+                NULL, 0, NI_NUMERICHOST);
+
+  len = snprintf (answer, sizeof (answer),
+                  "Your address is %s." SEPARATOR, addr);
+
+  sendto (fd, answer, len, 0, (struct sockaddr *) &ss, sslen);
+}
+
+void
+write_environment (int fd, char *envp[])
+{
+  for ( ; *envp; ++envp)
+    {
+      write (fd, *envp, strlen (*envp));
+      write (fd, SEPARATOR, strlen (SEPARATOR));
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int j;
+
+  for (j = 1; j < argc; ++j)
+    {
+      if (strncmp (argv[j], "addr", strlen ("addr")) == 0)
+        {
+          write_address (STDOUT_FILENO);
+          continue;
+        }
+
+      if (strncmp (argv[j], "env", strlen ("env")) == 0)
+        {
+          write_environment (STDOUT_FILENO, environ);
+          continue;
+        }
+    }
+
+  close (STDIN_FILENO);
+  close (STDOUT_FILENO);
+  close (STDERR_FILENO);
+
+  return EXIT_SUCCESS;
+}

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=791329d9b2cf8c5237939782a0d6aae4adfa0487


commit 791329d9b2cf8c5237939782a0d6aae4adfa0487
Author: Mats Erik Andersson <address@hidden>
Date:   Tue Dec 21 15:45:24 2010 +0100

    inetd: Environment variables also for IPv6.

diff --git a/ChangeLog b/ChangeLog
index b8e5b12..b1ea660 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-12-21  Mats Erik Andersson <address@hidden>
+
+       * src/inetd.c (prepenv): New prototype:
+       `prepenv(int, struct sockaddr *, socklen_t)'.
+       (prepenv): Change type of IP to `char []' of fixed length.
+       Delete HOST.  New integer variable RET.
+       Make type of SA_SERVER depend on macro IPV6, either
+       `struct sockaddr_storage' or `struct sockaddr_in'.
+       (prepenv): Eliminate use of `inet_ntoa' and `gethostbyaddr'
+       by new calls to `getnameinfo', with and without restiction
+       to numeric results.  Debugging output for three select
+       environment variables.
+       (main): Make type of SA_CLIENT depend on macro IPV6, either
+       `struct sockaddr_storage' or `struct sockaddr_in'.  Adaptions
+       to the new prototype for `prepenv'.
+
 2010-12-04  Mike Frysinger <address@hidden>  (tiny change)
 
        * man/Makefile.am (dist_man1_MANS): Renamed to dist_man_MANS.
diff --git a/src/inetd.c b/src/inetd.c
index c3cec04..625ebff 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -1696,15 +1696,21 @@ tcpmux (int s, struct servtab *sep)
 
 /* Set TCP environment variables, modelled after djb's ucspi-tcp tools:
    http://cr.yp.to/ucspi-tcp/environment.html
-   FIXME: This needs support for IPv6.
 */
 void
-prepenv (int ctrl, struct sockaddr_in sa_client)
+prepenv (int ctrl, struct sockaddr *sa_client, socklen_t sa_len)
 {
   char str[16];
-  char *ip;
-  struct hostent *host;
+  /* IP is used both for numeric addresses and for symbolic ones.
+   * Being statically allocated, and only for logging purposes,
+   * a full MAXPATHLEN is exaggerated, so a compromise is made.  */
+  char ip[4 * INET6_ADDRSTRLEN];
+  int ret;
+#ifdef IPV6
+  struct sockaddr_storage sa_server;
+#else
   struct sockaddr_in sa_server;
+#endif
   socklen_t len = sizeof (sa_server);
 
   setenv ("PROTO", "TCP", 1);
@@ -1719,47 +1725,58 @@ prepenv (int ctrl, struct sockaddr_in sa_client)
     syslog (LOG_WARNING, "getsockname(): %m");
   else
     {
-      ip = inet_ntoa (sa_server.sin_addr);
-      if (ip)
+      ret = getnameinfo ((struct sockaddr *) &sa_server, len,
+                         ip, sizeof (ip), str, sizeof (str),
+                         NI_NUMERICHOST | NI_NUMERICSERV);
+      if (ret == 0)
        {
          if (setenv ("TCPLOCALIP", ip, 1) < 0)
            syslog (LOG_WARNING, "setenv (TCPLOCALIP): %m");
-       }
+         else if (debug)
+           fprintf (stderr, "Assigned TCPLOCALIP = %s\n", ip);
 
-      snprintf (str, sizeof (str), "%d", ntohs (sa_server.sin_port));
-      setenv ("TCPLOCALPORT", str, 1);
+         if (setenv ("TCPLOCALPORT", str, 1) < 0)
+           syslog (LOG_WARNING, "setenv (TCPLOCALPORT): %m");
+       }
+      else
+       syslog (LOG_WARNING, "getnameinfo: %s", gai_strerror (ret));
 
       if (resolve_option)
        {
-         if ((host = gethostbyaddr ((char *) &sa_server.sin_addr,
-                                    sizeof (sa_server.sin_addr),
-                                    AF_INET)) == NULL)
-           syslog (LOG_WARNING, "gethostbyaddr: %m");
-         else if (setenv ("TCPLOCALHOST", host->h_name, 1) < 0)
+         ret = getnameinfo ((struct sockaddr *) &sa_server, len,
+                             ip, sizeof (ip), NULL, 0, 0);
+         if (ret != 0)
+           syslog (LOG_WARNING, "getnameinfo: %s", gai_strerror (ret));
+         else if (setenv ("TCPLOCALHOST", ip, 1) < 0)
            syslog (LOG_WARNING, "setenv(TCPLOCALHOST): %m");
        }
     }
 
-  ip = inet_ntoa (sa_client.sin_addr);
-  if (ip)
+  ret = getnameinfo (sa_client, sa_len, ip, sizeof (ip), str, sizeof (str),
+                     NI_NUMERICHOST | NI_NUMERICSERV);
+  if (ret == 0)
     {
       if (setenv ("TCPREMOTEIP", ip, 1) < 0)
        syslog (LOG_WARNING, "setenv(TCPREMOTEIP): %m");
-    }
+      else if (debug)
+       fprintf (stderr, "Assigned TCPREMOTEIP = %s\n", ip);
 
-  snprintf (str, sizeof (str), "%d", ntohs (sa_client.sin_port));
-  if (setenv ("TCPREMOTEPORT", str, 1) < 0)
-    syslog (LOG_WARNING, "setenv(TCPREMOTEPORT): %m");
+      if (setenv ("TCPREMOTEPORT", str, 1) < 0)
+       syslog (LOG_WARNING, "setenv(TCPREMOTEPORT): %m");
 
-  if (resolve_option)
-    {
-      if ((host = gethostbyaddr ((char *) &sa_client.sin_addr,
-                                sizeof (sa_client.sin_addr),
-                                AF_INET)) == NULL)
-       syslog (LOG_WARNING, "gethostbyaddr: %m");
-      else if (setenv ("TCPREMOTEHOST", host->h_name, 1) < 0)
-       syslog (LOG_WARNING, "setenv(TCPREMOTEHOST): %m");
+      if (resolve_option)
+       {
+         ret = getnameinfo (sa_client, sa_len, ip, sizeof (ip), NULL, 0, 0);
+         if (ret != 0)
+           syslog (LOG_WARNING, "getnameinfo: %s", gai_strerror (ret));
+         else if (setenv ("TCPREMOTEHOST", ip, 1) < 0)
+           syslog (LOG_WARNING, "setenv(TCPREMOTEHOST): %m");
+         else if (debug)
+           fprintf (stderr, "Assigned TCPREMOTEHOST = %s\n", ip);
+       }
     }
+  else
+    syslog (LOG_WARNING, "getnameinfo: %s", gai_strerror (ret));
 }
 
 
@@ -1870,7 +1887,11 @@ main (int argc, char *argv[], char *envp[])
              fprintf (stderr, "someone wants %s\n", sep->se_service);
            if (!sep->se_wait && sep->se_socktype == SOCK_STREAM)
              {
+#ifdef IPV6
+               struct sockaddr_storage sa_client;
+#else
                struct sockaddr_in sa_client;
+#endif
                socklen_t len = sizeof (sa_client);
 
                ctrl = accept (sep->se_fd, (struct sockaddr *) &sa_client,
@@ -1885,7 +1906,7 @@ main (int argc, char *argv[], char *envp[])
                    continue;
                  }
                if (env_option)
-                 prepenv (ctrl, sa_client);
+                 prepenv (ctrl, (struct sockaddr *) &sa_client, len);
              }
            else
              ctrl = sep->se_fd;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |   46 +++++++++++++++++
 src/inetd.c       |  141 +++++++++++++++++++++++++++++++++++++++--------------
 tests/Makefile.am |    4 ++
 tests/addrpeek.c  |  135 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 289 insertions(+), 37 deletions(-)
 create mode 100644 tests/addrpeek.c


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]