]> git.pld-linux.org Git - packages/evolution.git/blame - evolution-ipv6.patch
- rel 3 for new gnutls
[packages/evolution.git] / evolution-ipv6.patch
CommitLineData
55195b68 12003-09-26 Jeffrey Stedfast <fejj@ximian.com>
2
3 * e-host-utils.c (e_gethostbyaddr_r): IPv6 implementation
4 rewritten to use getnameinfo() which is the proper function to use
5 in this case. Fixes bug #46006.
6
7Index: e-host-utils.c
8===================================================================
9RCS file: /cvs/gnome/evolution/e-util/e-host-utils.c,v
10retrieving revision 1.14
11diff -u -r1.14 e-host-utils.c
12--- e-util/e-host-utils.c 29 Apr 2003 02:14:37 -0000 1.14
13+++ e-util/e-host-utils.c 26 Sep 2003 15:51:10 -0000
14@@ -291,34 +291,18 @@
15 char *buf, size_t buflen, int *herr)
16 {
17 #ifdef ENABLE_IPv6
18- struct addrinfo hints, *res;
19- const char *name;
20 int retval, len;
21
22- if ((name = inet_ntop (type, addr, buf, buflen)) == NULL) {
23- if (errno == ENOSPC)
24- return ERANGE;
25-
26- return -1;
27- }
28-
29- memset (&hints, 0, sizeof (struct addrinfo));
30- hints.ai_flags = AI_CANONNAME;
31- hints.ai_family = type == AF_INET6 ? PF_INET6 : PF_INET;
32- hints.ai_socktype = 0;
33- hints.ai_protocol = 0;
34-
35- if ((retval = getaddrinfo (name, NULL, &hints, &res)) != 0) {
36+ if ((retval = getnameinfo (addr, addrlen, buf, buflen, NULL, 0, NI_NAMEREQD)) != 0) {
37 *herr = ai_to_herr (retval);
38 return -1;
39 }
40
41- len = ALIGN (strlen (res->ai_canonname) + 1);
42- if (buflen < IPv6_BUFLEN_MIN + len + res->ai_addrlen + sizeof (char *))
43+ len = ALIGN (strlen (buf) + 1);
44+ if (buflen < IPv6_BUFLEN_MIN + len + addrlen + sizeof (char *))
45 return ERANGE;
46
47 /* h_name */
48- strcpy (buf, res->ai_canonname);
49 host->h_name = buf;
50 buf += len;
51
52@@ -328,16 +312,8 @@
53 buf += sizeof (char *);
54
55 /* h_addrtype and h_length */
56- host->h_length = res->ai_addrlen;
57- if (res->ai_family == PF_INET6) {
58- host->h_addrtype = AF_INET6;
59-
60- addr = (char *) &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr;
61- } else {
62- host->h_addrtype = AF_INET;
63-
64- addr = (char *) &((struct sockaddr_in *) res->ai_addr)->sin_addr;
65- }
66+ host->h_length = addrlen;
67+ host->h_addrtype = type;
68
69 memcpy (buf, addr, host->h_length);
70 addr = buf;
71@@ -347,8 +323,6 @@
72 ((char **) buf)[0] = addr;
73 ((char **) buf)[1] = NULL;
74 host->h_addr_list = (char **) buf;
75-
76- freeaddrinfo (res);
77
78 return 0;
79 #else /* No support for IPv6 addresses */
This page took 0.560765 seconds and 4 git commands to generate.