Gentoo Archives: gentoo-commits

From: "Peter Volkov (pva)" <pva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-fs/autofs/files: autofs-5.0.6-ipv6_name_lookup_regression.patch
Date: Fri, 01 Jul 2011 11:24:19
Message-Id: 20110701112407.133A120034@flycatcher.gentoo.org
1 pva 11/07/01 11:24:07
2
3 Added: autofs-5.0.6-ipv6_name_lookup_regression.patch
4 Log:
5 Fix regression in the ipv6 lookup, bug #373577 thank Juergen Rose for report and Dustin Polke for the fix.
6
7 (Portage version: 2.1.10.3/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 net-fs/autofs/files/autofs-5.0.6-ipv6_name_lookup_regression.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-fs/autofs/files/autofs-5.0.6-ipv6_name_lookup_regression.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-fs/autofs/files/autofs-5.0.6-ipv6_name_lookup_regression.patch?rev=1.1&content-type=text/plain
14
15 Index: autofs-5.0.6-ipv6_name_lookup_regression.patch
16 ===================================================================
17 --- modules/replicated.c
18 +++ modules/replicated.c
19 @@ -1111,7 +1111,8 @@ static int add_host_addrs(struct host **list, const char *host,
20 unsigned int weight, unsigned int options)
21 {
22 struct addrinfo hints, *ni, *this;
23 - char *name = strdup(host);
24 + char *n_ptr;
25 + char *name = n_ptr = strdup(host);
26 int len;
27 char buf[MAX_ERR_BUF];
28 int rr = 0;
29 @@ -1125,15 +1126,17 @@ static int add_host_addrs(struct host **list, const char *host,
30 }
31 len = strlen(name);
32
33 - if (name[0] == '[' && name[--len] == ']')
34 + if (name[0] == '[' && name[--len] == ']') {
35 name[len] = '\0';
36 + name++;
37 + }
38
39 memset(&hints, 0, sizeof(hints));
40 hints.ai_flags = AI_NUMERICHOST;
41 hints.ai_family = AF_UNSPEC;
42 hints.ai_socktype = SOCK_DGRAM;
43
44 - ret = getaddrinfo(name + 1, NULL, &hints, &ni);
45 + ret = getaddrinfo(name, NULL, &hints, &ni);
46 if (ret)
47 goto try_name;
48
49 @@ -1153,7 +1156,7 @@ try_name:
50 hints.ai_family = AF_UNSPEC;
51 hints.ai_socktype = SOCK_DGRAM;
52
53 - ret = getaddrinfo(name + 1, NULL, &hints, &ni);
54 + ret = getaddrinfo(name, NULL, &hints, &ni);
55 if (ret) {
56 error(LOGOPT_ANY, "hostname lookup failed: %s",
57 gai_strerror(ret));
58 @@ -1172,7 +1175,7 @@ try_name:
59 }
60 freeaddrinfo(ni);
61 done:
62 - free(name);
63 + free(n_ptr);
64 return ret;
65 }