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-72-g17819c3


From: Simon Josefsson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_8-72-g17819c3
Date: Sat, 04 Dec 2010 09:06:07 +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  17819c31287e09170f7f8ac81987078f35175b1a (commit)
       via  f8e234b23ae3296d34f943290a9feacdab1ea33a (commit)
       via  6e41c83785f48dcfc1937015e01e3a3e4884dad0 (commit)
      from  4543b88b71d4598a3c9e49d44c59ab5ae54c4848 (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=17819c31287e09170f7f8ac81987078f35175b1a


commit 17819c31287e09170f7f8ac81987078f35175b1a
Author: Mats Erik Andersson <address@hidden>
Date:   Mon Nov 22 16:54:34 2010 +0100

    traceroute: Make immune against `RES_OPTIONS=inet6'.
    
    Signed-off-by: Simon Josefsson <address@hidden>

diff --git a/ChangeLog b/ChangeLog
index bf7ab0b..e5eebd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2010-11-22  Mats Erik Andersson <address@hidden>
 
+       * src/traceroute.c: Include "xalloc.h".
+       * src/traceroute.c (host): Deleted variable.
+       (hostname, addrstr): New variables;
+       (parse_opt) [ARGP_KEY_ARG]: Abolish gethostbyname. Only use
+       xstrdup to copy argument.
+       (main): Use getaddrinfo and getnameinfo for name resolving.
+       New variables HINTS and *RES of type `struct addrinfo'.
+
+2010-11-22  Mats Erik Andersson <address@hidden>
+
        Resolve a double free issue.  Leads to segmentation faults.
 
        * src/inetd.c (nextconfig): Do not use `freeconfig' unconditionally.
diff --git a/src/traceroute.c b/src/traceroute.c
index 432e6e1..9caeb00 100644
--- a/src/traceroute.c
+++ b/src/traceroute.c
@@ -47,6 +47,7 @@
 #include <argp.h>
 #include <icmp.h>
 
+#include "xalloc.h"
 #include "libinetutils.h"
 
 #define TRACE_UDP_PORT 33434
@@ -87,7 +88,8 @@ char *get_hostname (struct in_addr *addr);
 
 int stop = 0;
 int pid = 0;
-struct hostent *host;
+static char *hostname = NULL;
+char addrstr[INET6_ADDRSTRLEN];
 struct sockaddr_in dest;
 
 static enum trace_type opt_type = TRACE_ICMP;
@@ -158,9 +160,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
 
     case ARGP_KEY_ARG:
       host_is_given = true;
-      host = gethostbyname (arg);
-      if (host == NULL)
-        error (EXIT_FAILURE, 0, "unknown host");
+      hostname = xstrdup(arg);
       break;
 
     case ARGP_KEY_SUCCESS:
@@ -180,6 +180,7 @@ static struct argp argp = {argp_options, parse_opt, 
args_doc, doc};
 int
 main (int argc, char **argv)
 {
+  struct addrinfo hints, *res;
   trace_t trace;
 
   set_program_name (argv[0]);
@@ -188,15 +189,28 @@ main (int argc, char **argv)
   iu_argp_init ("traceroute", program_authors);
   argp_parse (&argp, argc, argv, 0, NULL, NULL);
 
+  /* Hostname lookup first for better information */
+  memset (&hints, 0, sizeof (hints));
+  hints.ai_family = AF_INET;
+  hints.ai_flags = AI_CANONNAME;
+
+  if ((hostname == NULL) || (*hostname == '\0')
+      || getaddrinfo (hostname, NULL, &hints, &res))
+    error (EXIT_FAILURE, 0, "unknown host");
+
   if (geteuid () != 0)
     error (EXIT_FAILURE, EPERM, "insufficient permissions");
 
-  dest.sin_addr = *(struct in_addr *) host->h_addr;
-  dest.sin_family = AF_INET;
+  memcpy (&dest, res->ai_addr, res->ai_addrlen);
   dest.sin_port = htons (opt_port);
 
+  getnameinfo (res->ai_addr, res->ai_addrlen, addrstr, sizeof (addrstr),
+                  NULL, 0, NI_NUMERICHOST);
+
   printf ("traceroute to %s (%s), %d hops max\n",
-         host->h_name, inet_ntoa (dest.sin_addr), opt_max_hops);
+         res->ai_canonname, addrstr, opt_max_hops);
+
+  freeaddrinfo (res);
 
   trace_init (&trace, dest, opt_type);
 

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


commit f8e234b23ae3296d34f943290a9feacdab1ea33a
Author: Mats Erik Andersson <address@hidden>
Date:   Mon Nov 22 15:55:16 2010 +0100

    inetd: Registration of services with multiple nodes.
    
    Signed-off-by: Simon Josefsson <address@hidden>

diff --git a/ChangeLog b/ChangeLog
index 05b7e56..bf7ab0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-11-22  Mats Erik Andersson <address@hidden>
 
+       Resolve a double free issue.  Leads to segmentation faults.
+
+       * src/inetd.c (nextconfig): Do not use `freeconfig' unconditionally.
+       Condition on SERV_NODE, which needs partial memory deallocation.
+
+2010-11-22  Mats Erik Andersson <address@hidden>
+
        Partially revert changes introduced in fd64a202.
 
        * src/inetd.c (nextconfig): Call `enter' for TCPMUX services,
diff --git a/src/inetd.c b/src/inetd.c
index 1af29d4..c3cec04 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -1168,7 +1168,10 @@ nextconfig (const char *file)
       else
        expand_enter (sep);
 
-      freeconfig (sep);
+      if (serv_node)
+       free (sep->se_node);
+      else
+       freeconfig (sep);
     }
   endconfig (fconfig);
   /*

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=6e41c83785f48dcfc1937015e01e3a3e4884dad0


commit 6e41c83785f48dcfc1937015e01e3a3e4884dad0
Author: Mats Erik Andersson <address@hidden>
Date:   Mon Nov 22 15:43:53 2010 +0100

    inetd: Distinct service registration for TCPMUX.
    
    Signed-off-by: Simon Josefsson <address@hidden>

diff --git a/ChangeLog b/ChangeLog
index daf9708..05b7e56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-11-22  Mats Erik Andersson <address@hidden>
 
+       Partially revert changes introduced in fd64a202.
+
+       * src/inetd.c (nextconfig): Call `enter' for TCPMUX services,
+       but `expand_enter' for every other service.
+
+2010-11-22  Mats Erik Andersson <address@hidden>
+
        * src/inetd.c (inetd_getaddrinfo): Do not use AI_V4MAPPED with
        address family AF_INET.  FreeBSD fails otherwise.
 
diff --git a/src/inetd.c b/src/inetd.c
index ce7592e..1af29d4 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);

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

Summary of changes:
 ChangeLog        |   24 ++++++++++++++++++++++++
 src/inetd.c      |   10 ++++++++--
 src/traceroute.c |   28 +++++++++++++++++++++-------
 3 files changed, 53 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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