Blob Blame History Raw
autofs-5.1.6 - initialize struct addrinfo for getaddrinfo() calls

From: Ian Kent <raven@themaw.net>

The getaddrinfo() call may have become more fussy about initialization
of the passed in struct addrinfo that receives the results.

It's good practice to initialize it prior to the gataddrinfo() call just
in case.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG            |    1 +
 lib/parse_subs.c     |    1 +
 lib/rpc_subs.c       |    1 +
 modules/dclist.c     |    1 +
 modules/parse_amd.c  |    3 +++
 modules/replicated.c |    2 ++
 6 files changed, 9 insertions(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -352,6 +352,7 @@
 - fix missing initialization of autofs_point flags.
 - also use strictexpire for offsets.
 - fix trailing dollar sun entry expansion.
+- initialize struct addrinfo for getaddrinfo() calls.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/lib/parse_subs.c
+++ autofs-5.0.7/lib/parse_subs.c
@@ -474,6 +474,7 @@ unsigned int get_network_proximity(const
 	hints.ai_socktype = SOCK_DGRAM;
 	hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME;
 
+	ni = NULL;
 	ret = getaddrinfo(name_or_num, NULL, &hints, &ni);
 	if (ret) {
 		logerr("hostname lookup for %s failed: %s",
--- autofs-5.0.7.orig/lib/rpc_subs.c
+++ autofs-5.0.7/lib/rpc_subs.c
@@ -699,6 +699,7 @@ static int create_client(struct conn_inf
 	else
 		hints.ai_socktype = SOCK_STREAM;
 
+	ai = NULL;
 	ret = getaddrinfo(info->host, NULL, &hints, &ai);
 	if (ret) {
 		error(LOGOPT_ANY,
--- autofs-5.0.7.orig/modules/dclist.c
+++ autofs-5.0.7/modules/dclist.c
@@ -355,6 +355,7 @@ static char *getdnsdomainname(unsigned i
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_DGRAM;
 
+	ni = NULL;
 	ret = getaddrinfo(name, NULL, &hints, &ni);
 	if (ret) {
 		error(logopt,
--- autofs-5.0.7.orig/modules/parse_amd.c
+++ autofs-5.0.7/modules/parse_amd.c
@@ -269,6 +269,7 @@ static int match_my_name(struct autofs_p
 	hints.ai_socktype = SOCK_DGRAM;
 
 	/* Get host canonical name */
+	cni = NULL;
 	ret = getaddrinfo(v->val, NULL, &hints, &cni);
 	if (ret) {
 		error(logopt, MODPREFIX
@@ -280,6 +281,7 @@ static int match_my_name(struct autofs_p
 	hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME;
 
 	/* Resolve comparison name to its names and compare */
+	ni = NULL;
 	ret = getaddrinfo(exp_name, NULL, &hints, &ni);
 	if (ret) {
 		error(logopt, MODPREFIX
@@ -777,6 +779,7 @@ static char *normalize_hostname(unsigned
 		hints.ai_family = AF_UNSPEC;
 		hints.ai_socktype = SOCK_DGRAM;
 
+		ni = NULL;
 		ret = getaddrinfo(host, NULL, &hints, &ni);
 		if (ret) {
 			error(logopt, MODPREFIX
--- autofs-5.0.7.orig/modules/replicated.c
+++ autofs-5.0.7/modules/replicated.c
@@ -923,6 +923,7 @@ static int add_host_addrs(struct host **
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_DGRAM;
 
+	ni = NULL;
 	ret = getaddrinfo(name, NULL, &hints, &ni);
 	if (ret)
 		goto try_name;
@@ -943,6 +944,7 @@ try_name:
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_DGRAM;
 
+	ni = NULL;
 	ret = getaddrinfo(name, NULL, &hints, &ni);
 	if (ret) {
 		error(LOGOPT_ANY,