commit-inetutils
[Top][All Lists]
Advanced

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

[SCM] GNU Inetutils branch, master, updated. v2.1-15-g8586a5b


From: Simon Josefsson
Subject: [SCM] GNU Inetutils branch, master, updated. v2.1-15-g8586a5b
Date: Thu, 26 Aug 2021 03:12:36 -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  8586a5b3fe3302320b923ee31f9994e75708566e (commit)
      from  1965afb227ff00db56d822c4848bbb3f16f10c44 (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=8586a5b3fe3302320b923ee31f9994e75708566e


commit 8586a5b3fe3302320b923ee31f9994e75708566e
Author: Simon Josefsson <simon@josefsson.org>
Date:   Thu Aug 26 09:11:44 2021 +0200

    rlogind: Code for non-getaddrinfo removed.
    
    * NEWS: Mention change.
    * src/rlogind.c [!HAVE_DECL_GETADDRINFO]: Remove.

diff --git a/NEWS b/NEWS
index 4b930dc..f2ac9ea 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ GNU inetutils NEWS -- history of user-visible changes.
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
 ** logger
+** rlogind
 
 Code for non-getaddrinfo removed, since we are using gnulib to provide
 getaddrinfo on any platform that lacks it.  This may have resulted in
diff --git a/src/rlogind.c b/src/rlogind.c
index 2a469e7..345b9b6 100644
--- a/src/rlogind.c
+++ b/src/rlogind.c
@@ -632,20 +632,11 @@ find_listenfd (int family, int port)
 {
   int fd, on = 1;
   socklen_t size;
-#if HAVE_DECL_GETADDRINFO
   int rc;
   struct sockaddr_storage saddr;
   struct addrinfo hints, *ai, *res;
   char portstr[16];
-#else /* !HAVE_DECL_GETADDRINFO */
-  struct sockaddr_in saddr;
 
-  /* Enforce IPv4, lacking getaddrinfo().  */
-  if (family != AF_INET)
-    return -1;
-#endif
-
-#if HAVE_DECL_GETADDRINFO
   memset (&hints, 0, sizeof hints);
   hints.ai_family = family;
   hints.ai_flags = AI_PASSIVE;
@@ -675,17 +666,6 @@ find_listenfd (int family, int port)
   memcpy (&saddr, ai->ai_addr, ai->ai_addrlen);
   freeaddrinfo (res);
 
-#else /* !HAVE_DECL_GETADDRINFO */
-  size = sizeof saddr;
-  memset (&saddr, 0, size);
-  saddr.sin_family = family;
-# ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
-  saddr.sin_len = sizeof (struct sockaddr_in);
-# endif
-  saddr.sin_addr.s_addr = htonl (INADDR_ANY);
-  saddr.sin_port = htons (port);
-#endif
-
   fd = socket (family, SOCK_STREAM, 0);
   if (fd < 0)
     return -1;
@@ -815,11 +795,7 @@ rlogin_daemon (int maxchildren, int port)
        {
          pid_t pid;
          socklen_t size;
-#if HAVE_DECL_GETADDRINFO
          struct sockaddr_storage saddr;
-#else /* !HAVE_DECL_GETADDRINFO */
-         struct sockaddr_in saddr;
-#endif
 
          if (!FD_ISSET (listenfd[j], &lfdset))
            continue;
@@ -860,13 +836,8 @@ rlogin_daemon (int maxchildren, int port)
 int
 rlogind_auth (int fd, struct auth_data *ap)
 {
-#if HAVE_DECL_GETNAMEINFO && HAVE_DECL_GETADDRINFO
   int rc;
   char hoststr[NI_MAXHOST];
-#else
-  struct hostent *hp;
-  void *addrp;
-#endif
   char *hostname = "";
   int authenticated = 0;
   int port;
@@ -878,43 +849,20 @@ rlogind_auth (int fd, struct auth_data *ap)
   switch (ap->from.ss_family)
     {
     case AF_INET6:
-#if !HAVE_DECL_GETADDRINFO || !HAVE_DECL_GETNAMEINFO
-      addrp = (void *) &((struct sockaddr_in6 *) &ap->from)->sin6_addr;
-#endif
       port = ntohs (((struct sockaddr_in6 *) &ap->from)->sin6_port);
       break;
     case AF_INET:
     default:
-#if !HAVE_DECL_GETADDRINFO || !HAVE_DECL_GETNAMEINFO
-      addrp = (void *) &((struct sockaddr_in *) &ap->from)->sin_addr;
-#endif
       port = ntohs (((struct sockaddr_in *) &ap->from)->sin_port);
     }
 
   confirmed = 0;
 
   /* Check the remote host name */
-#if HAVE_DECL_GETNAMEINFO
   rc = getnameinfo ((struct sockaddr *) &ap->from, ap->fromlen,
                    hoststr, sizeof (hoststr), NULL, 0, NI_NAMEREQD);
   if (!rc)
     hostname = hoststr;
-#else /* !HAVE_DECL_GETNAMEINFO */
-  switch (ap->from.ss_family)
-    {
-    case AF_INET6:
-      hp = gethostbyaddr (addrp, sizeof (struct in6_addr),
-                         ap->from.ss_family);
-      break;
-    case AF_INET:
-    default:
-      hp = gethostbyaddr (addrp, sizeof (struct in_addr),
-                         ap->from.ss_family);
-    }
-  if (hp)
-    hostname = hp->h_name;
-#endif /* !HAVE_DECL_GETNAMEINFO */
-
   else if (reverse_required)
     {
       syslog (LOG_NOTICE, "can't resolve remote IP address");
@@ -928,7 +876,6 @@ rlogind_auth (int fd, struct auth_data *ap)
   if (verify_hostname || in_local_domain (ap->hostname))
     {
       int match = 0;
-#if HAVE_DECL_GETADDRINFO && HAVE_DECL_GETNAMEINFO
       struct addrinfo hints, *ai, *res;
       char astr[INET6_ADDRSTRLEN];
 
@@ -952,14 +899,6 @@ rlogind_auth (int fd, struct auth_data *ap)
            }
          freeaddrinfo (res);
        }
-#else /* !HAVE_DECL_GETADDRINFO */
-      for (hp = gethostbyname (ap->hostname); hp && !match; hp->h_addr_list++)
-       {
-         if (hp->h_addr_list[0] == NULL)
-           break;
-         match = memcmp (hp->h_addr_list[0], addrp, hp->h_length) == 0;
-       }
-#endif /* !HAVE_DECL_GETADDRINFO */
       if (!match)
        {
          syslog (LOG_ERR | LOG_AUTH, "cannot verify matching IP for %s (%s)",

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

Summary of changes:
 NEWS          |  1 +
 src/rlogind.c | 61 -----------------------------------------------------------
 2 files changed, 1 insertion(+), 61 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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