]> git.pld-linux.org Git - packages/evolution.git/commitdiff
- better IPv6 implementation
authorgrzegol <grzegol@pld-linux.org>
Thu, 20 Nov 2003 15:11:55 +0000 (15:11 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  (http://bugzilla.ximian.com/show_bug.cgi?id=46006)

Changed files:
    evolution-ipv6.patch -> 1.1

evolution-ipv6.patch [new file with mode: 0644]

diff --git a/evolution-ipv6.patch b/evolution-ipv6.patch
new file mode 100644 (file)
index 0000000..6cf8ab5
--- /dev/null
@@ -0,0 +1,79 @@
+2003-09-26  Jeffrey Stedfast  <fejj@ximian.com>
+
+       * e-host-utils.c (e_gethostbyaddr_r): IPv6 implementation
+       rewritten to use getnameinfo() which is the proper function to use
+       in this case. Fixes bug #46006.
+
+Index: e-host-utils.c
+===================================================================
+RCS file: /cvs/gnome/evolution/e-util/e-host-utils.c,v
+retrieving revision 1.14
+diff -u -r1.14 e-host-utils.c
+--- e-util/e-host-utils.c      29 Apr 2003 02:14:37 -0000      1.14
++++ e-util/e-host-utils.c      26 Sep 2003 15:51:10 -0000
+@@ -291,34 +291,18 @@
+                  char *buf, size_t buflen, int *herr)
+ {
+ #ifdef ENABLE_IPv6
+-      struct addrinfo hints, *res;
+-      const char *name;
+       int retval, len;
+       
+-      if ((name = inet_ntop (type, addr, buf, buflen)) == NULL) {
+-              if (errno == ENOSPC)
+-                      return ERANGE;
+-              
+-              return -1;
+-      }
+-      
+-      memset (&hints, 0, sizeof (struct addrinfo));
+-      hints.ai_flags = AI_CANONNAME;
+-      hints.ai_family = type == AF_INET6 ? PF_INET6 : PF_INET;
+-      hints.ai_socktype = 0;
+-      hints.ai_protocol = 0;
+-      
+-      if ((retval = getaddrinfo (name, NULL, &hints, &res)) != 0) {
++      if ((retval = getnameinfo (addr, addrlen, buf, buflen, NULL, 0, NI_NAMEREQD)) != 0) {
+               *herr = ai_to_herr (retval);
+               return -1;
+       }
+       
+-      len = ALIGN (strlen (res->ai_canonname) + 1);
+-      if (buflen < IPv6_BUFLEN_MIN + len + res->ai_addrlen + sizeof (char *))
++      len = ALIGN (strlen (buf) + 1);
++      if (buflen < IPv6_BUFLEN_MIN + len + addrlen + sizeof (char *))
+               return ERANGE;
+       
+       /* h_name */
+-      strcpy (buf, res->ai_canonname);
+       host->h_name = buf;
+       buf += len;
+       
+@@ -328,16 +312,8 @@
+       buf += sizeof (char *);
+       
+       /* h_addrtype and h_length */
+-      host->h_length = res->ai_addrlen;
+-      if (res->ai_family == PF_INET6) {
+-              host->h_addrtype = AF_INET6;
+-              
+-              addr = (char *) &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr;
+-      } else {
+-              host->h_addrtype = AF_INET;
+-              
+-              addr = (char *) &((struct sockaddr_in *) res->ai_addr)->sin_addr;
+-      }
++      host->h_length = addrlen;
++      host->h_addrtype = type;
+       
+       memcpy (buf, addr, host->h_length);
+       addr = buf;
+@@ -347,8 +323,6 @@
+       ((char **) buf)[0] = addr;
+       ((char **) buf)[1] = NULL;
+       host->h_addr_list = (char **) buf;
+-      
+-      freeaddrinfo (res);
+       
+       return 0;
+ #else /* No support for IPv6 addresses */
This page took 0.029019 seconds and 4 git commands to generate.