gnutls-commit
[Top][All Lists]
Advanced

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

[SCM] GNU gnutls branch, master, updated. gnutls_3_1_5-15-g67a6c9c


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_1_5-15-g67a6c9c
Date: Mon, 26 Nov 2012 18:42:49 +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 gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=67a6c9c6299183bdc4c5a0307930ff273b0ff034

The branch, master has been updated
       via  67a6c9c6299183bdc4c5a0307930ff273b0ff034 (commit)
       via  5da62fb671474b1ffaad5dd3062895ca109c47bf (commit)
      from  eec31cce141049544a512c8e55211f434c691820 (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 -----------------------------------------------------------------
commit 67a6c9c6299183bdc4c5a0307930ff273b0ff034
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Nov 26 19:42:41 2012 +0100

    updated

commit 5da62fb671474b1ffaad5dd3062895ca109c47bf
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Nov 26 19:42:10 2012 +0100

    gnutls-cli will try to cannot to all possible returned addresses.

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

Summary of changes:
 NEWS                  |    3 ++
 src/cli.c             |    2 -
 src/ocsptool-common.c |    1 -
 src/socket.c          |   58 ++++++++++++++++++++++---------------------------
 src/socket.h          |    1 -
 5 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/NEWS b/NEWS
index 75eefb5..fad2021 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ See the end for copying conditions.
 ** libgnutls: gnutls_x509_crt_get_policy() allows for a list of zero
 policy qualifiers.
 
+** gnutls-cli: It will try to connect to all possible returned addresses
+before failing.
+
 ** API and ABI modifications:
 No changes since last version.
 
diff --git a/src/cli.c b/src/cli.c
index 95fe8e0..142c883 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -843,7 +843,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)
@@ -897,7 +896,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 --git a/src/ocsptool-common.c b/src/ocsptool-common.c
index 835ccbf..5aa265d 100644
--- a/src/ocsptool-common.c
+++ b/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 --git a/src/socket.c b/src/socket.c
index c504885..f901482 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -126,22 +126,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;
@@ -176,30 +160,40 @@ socket_open (socket_st * hd, const char *hostname, const 
char *service, int udp)
           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
+        }
+
+
+      printf ("Connecting to '%s:%s'...\n", hostname, portname);
+
+      err = connect (sd, ptr->ai_addr, ptr->ai_addrlen);
+      if (err < 0)
+        {
+          fprintf (stderr, "Cannot connect to %s:%s: %s\n", hostname,
+                   portname, strerror (errno));
+          exit (1);
+        }
       break;
     }
 
   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 --git a/src/socket.h b/src/socket.h
index 141bacb..9f98faf 100644
--- a/src/socket.h
+++ b/src/socket.h
@@ -16,7 +16,6 @@ ssize_t socket_recv (const socket_st * socket, void *buffer, 
int buffer_size);
 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);


hooks/post-receive
-- 
GNU gnutls



reply via email to

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