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_9_4-112-g30e26


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-112-g30e26e4
Date: Sat, 9 May 2020 18:54:49 -0400 (EDT)

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  30e26e4c2fac84bda713b8c687d9f6555ea0eed6 (commit)
       via  6b47c25d621dc0bc88371836c77f2e4612ba4eef (commit)
      from  2dfa2d20aa2842d3e01a5ae3fa085746d1a07f47 (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=30e26e4c2fac84bda713b8c687d9f6555ea0eed6


commit 30e26e4c2fac84bda713b8c687d9f6555ea0eed6
Author: Mats Erik Andersson <address@hidden>
Date:   Sat May 9 23:52:51 2020 +0200

    whois: Delegation list for IPv6 ranges.
    
    Add code to match IPv6 queries against a data structure,
    which records known address delegations.  These provide
    prefixes of length at most 32 bits, and the corresponding
    server's name.

diff --git a/ChangeLog b/ChangeLog
index 05065d5..4648070 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2020-05-08  Mats Erik Andersson  <address@hidden>
+
+       whois: Delegation list for IPv6 ranges.
+
+       * whois/.gitignore: Add `ip6_del.h'.
+       * whois/Makefile.am (BUILT_SOURCES): Add `ip6_del.h'.
+       (EXTRA_DIST): Add `ip6_del_list', `ip6_del.h', `make_ip6_del.pl'.
+       (noinst_HEADERS): Add `ip6_del.h'.
+       (ip6_del.h): New target.
+       * whois/data.h (ip6_assign): New array.
+       * whois/ip6_del_list: New file.
+       * whois/make_ip6_del.pl: New file.
+       * whois/whois.c (whichwhois): Regard absence of period, colon,
+       and hyphen as evidence of NSI NIC or ASN.  Test for this and for
+       email address before any test for numeric addressing.  Implement
+       code for IPv6 delegation matching, to be triggered by the presence
+       of a colon in the given query string.
+
 2020-05-07  Mats Erik Andersson  <address@hidden>
 
        whois: Tweak command line arguments.
diff --git a/whois/.gitignore b/whois/.gitignore
index 6e0d83f..186c3a9 100644
--- a/whois/.gitignore
+++ b/whois/.gitignore
@@ -1,4 +1,5 @@
 whois
 as_del.h
 ip_del.h
+ip6_del.h
 tld_serv.h
diff --git a/whois/Makefile.am b/whois/Makefile.am
index c5265d6..7278dbc 100644
--- a/whois/Makefile.am
+++ b/whois/Makefile.am
@@ -26,13 +26,13 @@ EXTRA_PROGRAMS = whois
 
 whois_SOURCES = whois.c
 
-EXTRA_DIST = as_del_list ip_del_list tld_serv_list \
-  make_as_del.pl  make_ip_del.pl make_tld_serv.pl \
-  as_del.h ip_del.h tld_serv.h
+EXTRA_DIST = as_del_list ip_del_list ip6_del_list tld_serv_list \
+  make_as_del.pl  make_ip_del.pl make_ip6_del.pl make_tld_serv.pl \
+  as_del.h ip_del.h ip6_del.h tld_serv.h
 
-noinst_HEADERS = data.h as_del.h ip_del.h tld_serv.h whois.h
+noinst_HEADERS = data.h as_del.h ip_del.h ip6_del.h tld_serv.h whois.h
 
-BUILT_SOURCES = as_del.h ip_del.h tld_serv.h
+BUILT_SOURCES = as_del.h ip_del.h ip6_del.h tld_serv.h
 
 as_del.h: $(srcdir)/as_del_list $(srcdir)/make_as_del.pl
        LANG=C perl $(srcdir)/make_as_del.pl < $(srcdir)/as_del_list > as_del.h
@@ -40,5 +40,8 @@ as_del.h: $(srcdir)/as_del_list $(srcdir)/make_as_del.pl
 ip_del.h: $(srcdir)/ip_del_list $(srcdir)/make_ip_del.pl
        LANG=C perl $(srcdir)/make_ip_del.pl < $(srcdir)/ip_del_list > ip_del.h
 
+ip6_del.h: $(srcdir)/ip6_del_list $(srcdir)/make_ip6_del.pl
+       LANG=C perl $(srcdir)/make_ip6_del.pl < $(srcdir)/ip6_del_list > 
ip6_del.h
+
 tld_serv.h: $(srcdir)/tld_serv_list $(srcdir)/make_tld_serv.pl
        LANG=C perl $(srcdir)/make_tld_serv.pl < $(srcdir)/tld_serv_list > 
tld_serv.h
diff --git a/whois/data.h b/whois/data.h
index 88c5c36..5e013b2 100644
--- a/whois/data.h
+++ b/whois/data.h
@@ -111,6 +111,11 @@ struct ip_del ip_assign[] = {
   {0, 0, NULL}
 };
 
+struct ip_del ip6_assign[] = {
+#include "ip6_del.h"
+  {0, 0, NULL}
+};
+
 struct as_del
 {
   unsigned short first;
diff --git a/whois/ip6_del_list b/whois/ip6_del_list
new file mode 100644
index 0000000..db21d28
--- /dev/null
+++ b/whois/ip6_del_list
@@ -0,0 +1,43 @@
+# Copyright (C) 2020 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/'.
+
+# Accepted format of entry line:
+#
+#     hex:hex::/num    ripe    # comments
+#     hex:hex::/num    whois.arin.net
+#
+# where HEX are hexadecimal numbers of at most four significant digits,
+# and NUM are decimal numbers in the range 1 to 32, inclusive.
+
+# The default hard-coded server is ARIN.
+# The first established match is chosen as query server.
+
+2001:2000::/20 ripe
+2001:3000::/21 ripe
+2001:3800::/22 ripe
+
+2001:4000::/23 ripe
+2001:4200::/23 afrinic
+2001:4400::/23 apnic
+2001:4600::/23 ripe
+2001:4a00::/23 ripe
+2001:4c00::/23 ripe
+
+2400:0::/12    apnic
+2800:0::/12    lacnic
+2a00:0::/11    ripe
+2c00:0::/12    afrinic
diff --git a/whois/make_ip6_del.pl b/whois/make_ip6_del.pl
new file mode 100755
index 0000000..9b1ac87
--- /dev/null
+++ b/whois/make_ip6_del.pl
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2020 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/'.
+
+use strict;
+use warnings;
+
+# Accepted format of entry line:
+#
+#     hex:hex::/num    ripe    # comments
+#     hex:hex::/num    whois.arin.net
+#
+# where HEX are hexadecimal numbers of at most four significant digits,
+# and NUM are decimal numbers in the range 1 to 32, inclusive.
+
+my $prefix = qr/^([[:xdigit:]]{1,4}:[[:xdigit:]]{1,4})::\/(\d+)\s+([\w\.]+)$/;
+
+while (<>) {
+  # Sanitize input: strip comments after hash character,
+  #   discard leading and ending space, drop empty lines.
+  chomp;
+
+  s/^\s*(.*)\s*$/$1/;
+  s/\s*#.*$//;
+
+  next if /^$/;
+
+  # Check for acceptable data format.
+  die "Prefix is not parseable: \"$_\".\n"
+    unless (/$prefix/);
+
+  my ($i1, $i2) = (0, 0);
+
+  ($i1, $i2) = split /:/, $1;  # Prefix components, two double-octets.
+
+  my $masklen = $2;    # Prefix length
+  my $server = $3;     # Delegation target
+
+  die "Illegal prefix length: $masklen used in \"$1/$masklen\".\n"
+    if $masklen == 0 or $masklen > 32;
+
+  print "{ " . ((oct("0x" . $i1) << 16) + oct("0x" . $i2)) . "UL, " .
+    (0xffffffff^(0xffffffff >> $masklen)) . "UL, \"";
+
+  if ($server =~ /\./) {
+    print "$server";
+  } else {
+    print "whois.$server.net";
+  }
+
+  print "\" },\n";
+}
diff --git a/whois/whois.c b/whois/whois.c
index 7a4817b..84e0cc9 100644
--- a/whois/whois.c
+++ b/whois/whois.c
@@ -311,23 +311,12 @@ whichwhois (const char *s)
   if (*s == '\0')
     return "whois.ripe.net";
 
-  /* IPv6 address */
-  if (strchr (s, ':'))
-    {
-      /* Temporary hack until a delegation list is implemented.  */
-      /* The only easily found /20 delegation .  */
-      if (strncasecmp (s, "2001:2", 6) == 0)
-       return "whois.ripe.net";
-
-      return "whois.arin.net";
-    }
-
   /* email address */
   if (strchr (s, '@'))
     return "";
 
-  /* no dot and no hyphen means it's a NSI NIC handle or ASN (?) */
-  if (!strpbrk (s, ".-"))
+  /* no dot, no colon, and no hyphen means it's an NSI NIC handle or ASN (?) */
+  if (!strpbrk (s, ".-:"))
     {
       const char *p;
 
@@ -343,6 +332,31 @@ whichwhois (const char *s)
        return "";
     }
 
+  /* IPv6 address */
+  if (strchr (s, ':'))
+    {
+      int a = 0, b = 0;
+
+      /* Only the first two double-octets are ever scanned.
+       * At least one is required.
+       */
+      if (sscanf (s, "%x:%x:", &a, &b) == 0)
+       return "";
+
+      /* Mask off any non-significant bits and generate prefix.  */
+      ip = (a & 0xffff) << 16 | (b & 0xffff);
+
+      for (i = 0; ip6_assign[i].serv; i++)
+       if ((ip & ip6_assign[i].mask) == ip6_assign[i].net)
+         return ip6_assign[i].serv;
+
+      if (verb)
+       puts (_("Delegation server of this address is not known.\n"
+               "The fallback is ARIN, hoping for success."));
+
+      return "whois.arin.net";
+    }
+
   /* smells like an IP? */
   if ((ip = myinet_aton (s)))
     {

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


commit 6b47c25d621dc0bc88371836c77f2e4612ba4eef
Author: Mats Erik Andersson <address@hidden>
Date:   Sat May 9 22:58:38 2020 +0200

    Update ChangeLog, giving some more details.
    
    Fix comment in two files to match present code.

diff --git a/ChangeLog b/ChangeLog
index 06930e1..05065d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -102,12 +102,14 @@
        uucpd: Fix buffer overflows.
 
        This fixes several missing string termination issues with strncpy.
-       Also REMOTEHOST with size NI_MAXHOST was strcpy'ed into LINE which
+       Also REMOTEHOST of size NI_MAXHOST was strcpy'ed into LINE, which
        just had 32 bytes on the stack.
 
-       * src/uucpd.c (dologout): Increase LINE size.  Use exisiting SCPYN
+       * src/uucpd.c (SCPYN): Promote macro to global scope, but expand
+       its action by writing the final NUL character.
+       (dologin): Increase size of LINE.  Use existing macro SCPYN
        instead of strncpy.
-       (SCPYN): New macro.
+       [PATH_LASTLOG && HAVE_STRUCT_LASTLOG]: Delete local macro SCPYN.
 
 2020-02-29  Tim Rühsen <address@hidden>
 
@@ -116,23 +118,22 @@
        Usernames >= 56 bytes would overflow the char arrays Username and
        Logname.  This change mitigates this, but still silently truncates
        these arrays.  Silent truncation should be checked throughout the
-       code possibly within a more comprehensive code review.
+       code, possibly within a more comprehensive code review.
 
-       * src/uucpd.c (Usernaem, Logname): Increase size to 72 bytes.
+       * src/uucpd.c (Username, Logname): Increase size to 72 bytes.
        (doit): Use snprintf instead of sprintf.
 
 2020-02-29  Tim Rühsen <address@hidden>
 
        telnet: Use strdup instead malloc+strcpy.
 
-       * telnet/commands.c (tn): Use strdup instead malloc/strcpy.
+       * telnet/commands.c (tn): Assign HOSTNAME using strdup().
 
 2020-02-29  Tim Rühsen <address@hidden>
 
        telnet: Fix -Wsign-compare in suboption.
 
-       * telnet/telnet.c (suboption): Explicit cast to int to silence
-       -Wsign-compare.
+       * telnet/telnet.c (suboption): Explicitly cast sizeof() to int.
 
 2020-02-29  Tim Rühsen <address@hidden>
 
@@ -174,7 +175,7 @@
 
        ftp: Fix return value of remglob.
 
-       * ftp/cmds.c (remglob): Turn around NULL check.
+       * ftp/cmds.c (remglob): Switch roles of old values after NULL check.
 
 2020-02-29  Tim Rühsen <address@hidden>
 
@@ -184,7 +185,7 @@
 
 2020-02-29  Tim Rühsen <address@hidden>
 
-       ftp: Fix 2x misuse of strncpy (read buffer overflow).
+       ftp: Fix two misuses of strncpy (read buffer overflow).
 
        * ftp/ftp.c (pswitch): Correctly set the terminating NUL.
 
@@ -198,30 +199,31 @@
 
        whois: Silence -Wimplicit-fallthrough.
 
-       * whois/whois.c (main): Squeelch warnings.
+       * whois/whois.c (main): Squeelch warning.
 
 2020-02-29  Tim Rühsen <address@hidden>
 
        ping, ping6: Silence -Wimplicit-fallthrough.
 
-       * ping/ping.c (parse_opt): Squeelch warnings.
+       * ping/ping.c (parse_opt): Squeelch warning.
        * ping/ping6.c (parse_opt): Likewise.
 
 2020-02-17  Tim Rühsen <address@hidden>
 
        ping6: Fix memleak in ping_set_dest.
 
-       * ping/ping6.c (ping_set_dest): Rerrange code to avoid memory
-       leak.
-       * ping/ping6.h (ping_set_dest): Change type; update callees.
+       * ping/ping6.c (ping_set_dest): New function signature.
+       Rearrange code to avoid memory leak.
+       * ping/ping6.h (ping_set_dest): Change signature in declaration.
 
 2020-02-17  Tim Rühsen <address@hidden>
 
        ping: Fix memleak in ping_set_dest.
 
-       * ping/libping.c (ping_set_dest): Rerrange code to avoid memory
-       leak.
-       * ping/ping.h (ping_set_dest): Change type; update callees.
+       * ping/libping.c (ping_set_dest): New function signature.
+       Rearrange code to avoid memory leak.
+       [HAVE_DECL_GETADDRINFO]: Rename P as RHOST.
+       * ping/ping.h (ping_set_dest): Change signature in declaration.
 
 2020-02-16  Tim Rühsen <address@hidden>
 
@@ -251,9 +253,10 @@
        telnet: Fix silent truncation (off-by-one check)
 
        If the DISPLAY variable had exactly 44 bytes, the SE byte (end sub
-       negotiation) was silently truncated.
+       negotiation) was silently truncated.  This concerns CVE-2019-0053.
 
-       * telnet/telnet.c (suboption): Use >= instead of >.
+       * telnet/telnet.c (suboption): Add case of equality in conditional,
+       supplementing strict inequality.
 
 2020-02-21  Mats Erik Andersson  <address@hidden>
 
diff --git a/ftp/cmds.c b/ftp/cmds.c
index 283e5b8..6ae88e7 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -1240,7 +1240,7 @@ sethash (int argc _GL_UNUSED_PARAMETER, char **argv)
        {
        case 'g':
        case 'G':
-         hashbytes *= 1024 * 1024 * 1024;      /* Cascaded multiplication!  */
+         hashbytes *= 1024 * 1024 * 1024;
          break;
        case 'm':
        case 'M':
diff --git a/ping/libping.c b/ping/libping.c
index 9bfd9a1..92cd775 100644
--- a/ping/libping.c
+++ b/ping/libping.c
@@ -296,7 +296,7 @@ ping_set_dest (PING * ping, const char *host)
   char *rhost;
 
 # if defined HAVE_IDN || defined HAVE_IDN2
-  rc = idna_to_ascii_lz (host, &rhost, 0);     /* P is allocated.  */
+  rc = idna_to_ascii_lz (host, &rhost, 0);     /* RHOST is allocated.  */
   if (rc)
     return 1;
   host = rhost;

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

Summary of changes:
 ChangeLog                         | 61 +++++++++++++++++++++++------------
 ftp/cmds.c                        |  2 +-
 ping/libping.c                    |  2 +-
 whois/.gitignore                  |  1 +
 whois/Makefile.am                 | 13 +++++---
 whois/data.h                      |  5 +++
 Makefile.am => whois/ip6_del_list | 43 +++++++++++++------------
 whois/make_ip6_del.pl             | 67 +++++++++++++++++++++++++++++++++++++++
 whois/whois.c                     | 40 +++++++++++++++--------
 9 files changed, 174 insertions(+), 60 deletions(-)
 copy Makefile.am => whois/ip6_del_list (51%)
 create mode 100755 whois/make_ip6_del.pl


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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