pkgsrc-Bugs archive

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

Re: pkg/47225: gnutls-cli do not resovle hostname with ipv4



The following reply was made to PR pkg/47225; it has been noted by GNATS.

From: Ji YongGang <jungleji%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: pkg/47225: gnutls-cli do not resovle hostname with ipv4
Date: Wed, 28 Nov 2012 13:43:29 +0800

 --Multipart_Wed_Nov_28_13:43:29_2012-1
 Content-Type: text/plain; charset=US-ASCII
 
 Upstream maintainer had been reported this issue:
 
 http://lists.gnu.org/archive/html/gnutls-devel/2012-11/threads.html#00041
 
 and fixed it in gnutls git HEAD.
 
 I made a patch for gnutls-3.0.25 in current pkgsrc, see attachment,
 and it works well now.
 
 $ gnutls-cli -V -p 587 -s smtp.gmail.com
 Error setting the x509 trust file
 Resolving 'smtp.gmail.com'...
 Connecting to '2a00:1450:4013:c01::6d:587'...
 Cannot connect to 2a00:1450:4013:c01::6d:587: No route to host
 Connecting to '74.125.136.108:587'...
 
 - Simple Client Mode:
 
 - Received[44]: 220 mx.google.com ESMTP u45sm38815070eep.0
 quit
 - Sent: 5 bytes
 - Received[49]: 221 2.0.0 closing connection u45sm38815070eep.0
 - Peer has closed the GnuTLS connection
 
 
 --Multipart_Wed_Nov_28_13:43:29_2012-1
 Content-Type: text/plain; type=patch; charset=US-ASCII
 Content-Disposition: attachment; filename="gnutls-3.0.25.diff"
 Content-Transfer-Encoding: 7bit
 
 diff -ruN gnutls.orig/distinfo gnutls/distinfo
 --- gnutls.orig/distinfo       2012-11-28 12:37:37.000000000 +0800
 +++ gnutls/distinfo    2012-11-28 13:05:23.000000000 +0800
 @@ -4,5 +4,9 @@
  RMD160 (gnutls-3.0.25.tar.xz) = 9af7f5d35f6b0000c06f07e4ec749e9fd663843e
  Size (gnutls-3.0.25.tar.xz) = 4657300 bytes
  SHA1 (patch-ae) = 71fbbeb43ac1689fca6fec7f8348d8534c1dc38a
 -SHA1 (patch-gl_stdio.in.h) = b5802da2cccddd6fab73bd39c49f7d62bef58464
 -SHA1 (patch-lib_nettle_egd.c) = b7e9769e8c620519c43ca7b7481a558e9d389c68
 +SHA1 (patch-gl_stdio.in.h) = 2dedbd5074feaf25ebc3606d93300f98ba21b989
 +SHA1 (patch-lib_nettle_egd.c) = 1c3780674ac98c2eafba36f6724cb3b60a6c1447
 +SHA1 (patch-src_cli.c) = 6302731771b5c986468bcece66f0101c433f1bc9
 +SHA1 (patch-src_ocsptool-common.c) = 1391b75943ef523fdb84a8fdf7095ec6edaafe0d
 +SHA1 (patch-src_socket.c) = 8a0dc13d32cd70453fb1d6f56ff4049eab1154cf
 +SHA1 (patch-src_socket.h) = acaabe7b08b33da6c00313796c92ea12b1d27742
 diff -ruN gnutls.orig/patches/patch-src_cli.c gnutls/patches/patch-src_cli.c
 --- gnutls.orig/patches/patch-src_cli.c        1970-01-01 08:00:00.000000000 
+0800
 +++ gnutls/patches/patch-src_cli.c     2012-11-28 12:38:51.000000000 +0800
 @@ -0,0 +1,20 @@
 +$NetBSD$
 +
 +--- src/cli.c.orig    2012-10-04 16:58:25.000000000 +0000
 ++++ src/cli.c
 +@@ -870,7 +870,6 @@ main (int argc, char **argv)
 +   init_global_tls_stuff ();
 + 
 +   socket_open (&hd, hostname, service, udp);
 +-  socket_connect (&hd);
 + 
 +   hd.session = init_tls_session (hostname);
 +   if (starttls)
 +@@ -924,7 +923,6 @@ main (int argc, char **argv)
 +           printf
 +             ("\n\n- Connecting again- trying to resume previous session\n");
 +           socket_open (&hd, hostname, service, udp);
 +-          socket_connect (&hd);
 +         }
 +       else
 +         {
 diff -ruN gnutls.orig/patches/patch-src_ocsptool-common.c 
gnutls/patches/patch-src_ocsptool-common.c
 --- gnutls.orig/patches/patch-src_ocsptool-common.c    1970-01-01 
08:00:00.000000000 +0800
 +++ gnutls/patches/patch-src_ocsptool-common.c 2012-11-28 12:38:51.000000000 
+0800
 @@ -0,0 +1,12 @@
 +$NetBSD$
 +
 +--- src/ocsptool-common.c.orig        2012-04-12 20:05:11.000000000 +0000
 ++++ src/ocsptool-common.c
 +@@ -191,7 +191,6 @@ socket_st hd;
 +   headers_size = strlen(headers);
 +   
 +   socket_open(&hd, hostname, service, 0);
 +-  socket_connect (&hd);
 +   
 +   socket_send(&hd, headers, headers_size);
 +   socket_send(&hd, req.data, req.size);
 diff -ruN gnutls.orig/patches/patch-src_socket.c 
gnutls/patches/patch-src_socket.c
 --- gnutls.orig/patches/patch-src_socket.c     1970-01-01 08:00:00.000000000 
+0800
 +++ gnutls/patches/patch-src_socket.c  2012-11-28 13:05:52.000000000 +0800
 @@ -0,0 +1,92 @@
 +$NetBSD$
 +
 +--- src/socket.c.orig 2012-04-12 20:05:11.000000000 +0000
 ++++ src/socket.c
 +@@ -121,22 +121,6 @@ socket_bye (socket_st * socket)
 + }
 + 
 + void
 +-socket_connect (const socket_st * hd)
 +-{
 +-  int err;
 +-
 +-  printf ("Connecting to '%s:%s'...\n", hd->ip, hd->service);
 +-
 +-  err = connect (hd->fd, hd->ptr->ai_addr, hd->ptr->ai_addrlen);
 +-  if (err < 0)
 +-    {
 +-      fprintf (stderr, "Cannot connect to %s:%s: %s\n", hd->hostname,
 +-               hd->service, strerror (errno));
 +-      exit (1);
 +-    }
 +-}
 +-
 +-void
 + socket_open (socket_st * hd, const char *hostname, const char *service, int 
udp)
 + {
 +   struct addrinfo hints, *res, *ptr;
 +@@ -167,34 +151,46 @@ socket_open (socket_st * hd, const char 
 +                               NI_NUMERICHOST | NI_NUMERICSERV)) != 0)
 +         {
 +           fprintf (stderr, "getnameinfo(): %s\n", gai_strerror (err));
 +-          freeaddrinfo (res);
 +-          exit (1);
 ++          continue;
 ++        }
 ++
 ++      if (hints.ai_socktype == SOCK_DGRAM)
 ++        {
 ++#if defined(IP_DONTFRAG)
 ++          int yes = 1;
 ++          if (setsockopt (sd, IPPROTO_IP, IP_DONTFRAG,
 ++                        (const void *) &yes, sizeof (yes)) < 0)
 ++            perror ("setsockopt(IP_DF) failed");
 ++#elif defined(IP_MTU_DISCOVER)
 ++          int yes = IP_PMTUDISC_DO;
 ++          if (setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER,
 ++                         (const void*) &yes, sizeof (yes)) < 0)
 ++            perror ("setsockopt(IP_DF) failed");
 ++#endif
 ++        }
 ++
 ++      printf ("Connecting to '%s:%s'...\n", buffer, portname);
 ++
 ++      err = connect (sd, ptr->ai_addr, ptr->ai_addrlen);
 ++      if (err < 0)
 ++        {
 ++          fprintf (stderr, "Cannot connect to %s:%s: %s\n", buffer,
 ++                   portname, strerror (errno));
 ++          continue;
 +         }
 + 
 +       break;
 +     }
 + 
 ++  if (err != 0)
 ++    exit(1);
 ++
 +   if (sd == -1)
 +     {
 +-      fprintf (stderr, "socket(): %s\n", strerror (errno));
 ++      fprintf (stderr, "Could not find a supported socket\n");
 +       exit (1);
 +     }
 + 
 +-  if (hints.ai_socktype == SOCK_DGRAM)
 +-    {
 +-#if defined(IP_DONTFRAG)
 +-      int yes = 1;
 +-      if (setsockopt (sd, IPPROTO_IP, IP_DONTFRAG,
 +-                      (const void *) &yes, sizeof (yes)) < 0)
 +-        perror ("setsockopt(IP_DF) failed");
 +-#elif defined(IP_MTU_DISCOVER)
 +-      int yes = IP_PMTUDISC_DO;
 +-      if (setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER, 
 +-                     (const void*) &yes, sizeof (yes)) < 0)
 +-        perror ("setsockopt(IP_DF) failed");
 +-#endif
 +-    }
 +-
 +   hd->secure = 0;
 +   hd->fd = sd;
 +   hd->hostname = strdup (hostname);
 diff -ruN gnutls.orig/patches/patch-src_socket.h 
gnutls/patches/patch-src_socket.h
 --- gnutls.orig/patches/patch-src_socket.h     1970-01-01 08:00:00.000000000 
+0800
 +++ gnutls/patches/patch-src_socket.h  2012-11-28 12:38:51.000000000 +0800
 @@ -0,0 +1,12 @@
 +$NetBSD$
 +
 +--- src/socket.h.orig 2012-04-12 20:05:11.000000000 +0000
 ++++ src/socket.h
 +@@ -16,7 +16,6 @@ ssize_t socket_recv (const socket_st * s
 + ssize_t socket_send (const socket_st * socket, const void *buffer,
 +                      int buffer_size);
 + void socket_open (socket_st * hd, const char *hostname, const char *service, 
int udp);
 +-void socket_connect (const socket_st * hd);
 + void socket_bye (socket_st * socket);
 + 
 + void sockets_init (void);
 
 --Multipart_Wed_Nov_28_13:43:29_2012-1--
 


Home | Main Index | Thread Index | Old Index