Blame SOURCES/autofs-5.1.3-workaround-getaddrinfo-ai_canonname-bug.patch

304803
autofs-5.1.3 - workaround getaddrinfo(3) ai_canonname bug
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
There appears to be a bug in some versions of getaddrinfo() where the
304803
addrinfo structure gets garbage in ai_canonname when it is not requested
304803
by the lookup flags causing a crash or lookup fail.
304803
304803
Try and work around this by always requesting ai_canonname for lookups
304803
and hope this doesn't affect the semantics of the autofs lookup usage.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG            |    1 +
304803
 lib/parse_subs.c     |    1 +
304803
 lib/rpc_subs.c       |    2 +-
304803
 modules/parse_amd.c  |    2 +-
304803
 modules/replicated.c |    4 ++--
304803
 5 files changed, 6 insertions(+), 4 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -324,6 +324,7 @@
304803
 - log mount call arguments if mount_verbose is set.
304803
 - document ghost option in auto.master man page.
304803
 - make expire remaining log level debug.
304803
+- workaround getaddrinfo(3) ai_canonname bug
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/lib/parse_subs.c
304803
+++ autofs-5.0.7/lib/parse_subs.c
304803
@@ -472,6 +472,7 @@ unsigned int get_network_proximity(const
304803
 	memset(&hints, 0, sizeof(struct addrinfo));
304803
 	hints.ai_family = AF_UNSPEC;
304803
 	hints.ai_socktype = SOCK_DGRAM;
304803
+	hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME;
304803
 
304803
 	ret = getaddrinfo(name_or_num, NULL, &hints, &ni);
304803
 	if (ret) {
304803
--- autofs-5.0.7.orig/lib/rpc_subs.c
304803
+++ autofs-5.0.7/lib/rpc_subs.c
304803
@@ -692,7 +692,7 @@ static int create_client(struct conn_inf
304803
 	}
304803
 
304803
 	memset(&hints, 0, sizeof(hints));
304803
-	hints.ai_flags = AI_ADDRCONFIG;
304803
+	hints.ai_flags = AI_ADDRCONFIG | AI_CANONNAME;
304803
 	hints.ai_family = AF_UNSPEC;
304803
 	if (info->proto == IPPROTO_UDP)
304803
 		hints.ai_socktype = SOCK_DGRAM;
304803
--- autofs-5.0.7.orig/modules/parse_amd.c
304803
+++ autofs-5.0.7/modules/parse_amd.c
304803
@@ -264,7 +264,7 @@ static int match_my_name(unsigned int lo
304803
 		goto out;
304803
 	}
304803
 
304803
-	hints.ai_flags = 0;
304803
+	hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME;
304803
 
304803
 	/* Resolve comparison name to its names and compare */
304803
 	ret = getaddrinfo(name, NULL, &hints, &ni);
304803
--- autofs-5.0.7.orig/modules/replicated.c
304803
+++ autofs-5.0.7/modules/replicated.c
304803
@@ -919,7 +919,7 @@ static int add_host_addrs(struct host **
304803
 	}
304803
 
304803
 	memset(&hints, 0, sizeof(hints));
304803
-	hints.ai_flags = AI_NUMERICHOST;
304803
+	hints.ai_flags = AI_NUMERICHOST | AI_CANONNAME;
304803
 	hints.ai_family = AF_UNSPEC;
304803
 	hints.ai_socktype = SOCK_DGRAM;
304803
 
304803
@@ -939,7 +939,7 @@ static int add_host_addrs(struct host **
304803
 
304803
 try_name:
304803
 	memset(&hints, 0, sizeof(hints));
304803
-	hints.ai_flags = AI_ADDRCONFIG;
304803
+	hints.ai_flags = AI_ADDRCONFIG | AI_CANONNAME;
304803
 	hints.ai_family = AF_UNSPEC;
304803
 	hints.ai_socktype = SOCK_DGRAM;
304803