Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
autofs
autofs-5.0.5-fix-ipv6-name-for-lookup.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File autofs-5.0.5-fix-ipv6-name-for-lookup.patch of Package autofs
commit 5b083026ae08c91a0b01b309d44d278c7eb87ada Author: Ian Kent <ikent@redhat.com> Date: Tue Jun 28 14:45:14 2011 +0800 autofs-5.0.5 - fix ipv6 name for lookup When an IPv6 name is given in a map entry the convention is to surround the name with square brackets if it is an address. When trying to translate such a name autofs did not first remove the brackets so the name lookup failed. Index: autofs-5.0.5/modules/replicated.c =================================================================== --- autofs-5.0.5.orig/modules/replicated.c +++ autofs-5.0.5/modules/replicated.c @@ -217,10 +217,8 @@ static unsigned int get_proximity(struct switch (ifr->ifr_addr.sa_family) { case AF_INET: -#ifndef INET6 if (host_addr->sa_family == AF_INET6) break; -#endif if_addr = (struct sockaddr_in *) &ifr->ifr_addr; ret = memcmp(&if_addr->sin_addr, hst_addr, addr_len); if (!ret) { @@ -270,10 +268,8 @@ static unsigned int get_proximity(struct switch (ifr->ifr_addr.sa_family) { case AF_INET: -#ifndef INET6 if (host_addr->sa_family == AF_INET6) break; -#endif if_addr = (struct sockaddr_in *) &ifr->ifr_addr; ia = ntohl((uint32_t) if_addr->sin_addr.s_addr); @@ -1115,15 +1111,29 @@ static int add_host_addrs(struct host ** unsigned int weight, unsigned int options) { struct addrinfo hints, *ni, *this; + char *name = strdup(host); + int len; + char buf[MAX_ERR_BUF]; int rr = 0; int ret; + if (!name) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(LOGOPT_ANY, "strdup: %s", estr); + error(LOGOPT_ANY, "failed to add host %s", host); + return 0; + } + len = strlen(name); + + if (name[0] == '[' && name[--len] == ']') + name[len] = '\0'; + memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_NUMERICHOST; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; - ret = getaddrinfo(host, NULL, &hints, &ni); + ret = getaddrinfo(name + 1, NULL, &hints, &ni); if (ret) goto try_name; @@ -1143,10 +1153,11 @@ try_name: hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; - ret = getaddrinfo(host, NULL, &hints, &ni); + ret = getaddrinfo(name + 1, NULL, &hints, &ni); if (ret) { error(LOGOPT_ANY, "hostname lookup failed: %s", gai_strerror(ret)); + free(name); return 0; } @@ -1161,6 +1172,7 @@ try_name: } freeaddrinfo(ni); done: + free(name); return ret; } Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -77,6 +77,7 @@ - fix map source check in file lookup. - fix simple bind without SASL support. - fix sasl bind host name selection. +- fix ipv6 name for lookup. 03/09/2009 autofs-5.0.5 -----------------------
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor