autofs-5.1.6 - initialize struct addrinfo for getaddrinfo() calls From: Ian Kent 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 --- 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(+) diff --git a/CHANGELOG b/CHANGELOG index 07a85cde..2c500a48 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ xx/xx/2020 autofs-5.1.7 - samples: fix Makefile targets' directory dependencies - remove intr hosts map mount option. - fix trailing dollar sun entry expansion. +- initialize struct addrinfo for getaddrinfo() calls. 07/10/2019 autofs-5.1.6 - support strictexpire mount option. diff --git a/lib/parse_subs.c b/lib/parse_subs.c index cdda2e1a..0ee00d51 100644 --- a/lib/parse_subs.c +++ b/lib/parse_subs.c @@ -475,6 +475,7 @@ unsigned int get_network_proximity(const char *name) 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", diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c index 8b23627a..643b7687 100644 --- a/lib/rpc_subs.c +++ b/lib/rpc_subs.c @@ -691,6 +691,7 @@ static int create_client(struct conn_info *info, CLIENT **client) else hints.ai_socktype = SOCK_STREAM; + ai = NULL; ret = getaddrinfo(info->host, NULL, &hints, &ai); if (ret) { error(LOGOPT_ANY, diff --git a/modules/dclist.c b/modules/dclist.c index ba32134d..c34c3a91 100644 --- a/modules/dclist.c +++ b/modules/dclist.c @@ -355,6 +355,7 @@ static char *getdnsdomainname(unsigned int logopt) hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; + ni = NULL; ret = getaddrinfo(name, NULL, &hints, &ni); if (ret) { error(logopt, diff --git a/modules/parse_amd.c b/modules/parse_amd.c index d8b9ea24..943a48b6 100644 --- a/modules/parse_amd.c +++ b/modules/parse_amd.c @@ -269,6 +269,7 @@ static int match_my_name(struct autofs_point *ap, const char *name, struct subst 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_point *ap, const char *name, struct subst 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 @@ -775,6 +777,7 @@ static char *normalize_hostname(unsigned int logopt, const char *host, hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; + ni = NULL; ret = getaddrinfo(host, NULL, &hints, &ni); if (ret) { error(logopt, MODPREFIX diff --git a/modules/replicated.c b/modules/replicated.c index 91fce882..03d4ba1e 100644 --- a/modules/replicated.c +++ b/modules/replicated.c @@ -982,6 +982,7 @@ static int add_host_addrs(struct host **list, const char *host, int ent_num, hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; + ni = NULL; ret = getaddrinfo(name, NULL, &hints, &ni); if (ret) goto try_name; @@ -1002,6 +1003,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,