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

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