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

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