Blame SOURCES/autofs-5.1.4-improve-hostname-lookup-error-logging.patch

aea863
autofs-5.1.4 - improve hostname lookup error logging
aea863
aea863
From: Ian Kent <raven@themaw.net>
aea863
aea863
There's not enough information in name lookup log messages
aea863
to determine if the failed lookup is in fact a problem or
aea863
is expected.
aea863
aea863
Signed-off-by: Ian Kent <raven@themaw.net>
aea863
---
aea863
 CHANGELOG            |    1 +
aea863
 lib/parse_subs.c     |    3 ++-
aea863
 lib/rpc_subs.c       |    3 ++-
aea863
 modules/dclist.c     |    4 +++-
aea863
 modules/parse_amd.c  |    9 ++++++---
aea863
 modules/replicated.c |    5 +++--
aea863
 6 files changed, 17 insertions(+), 8 deletions(-)
aea863
aea863
diff --git a/CHANGELOG b/CHANGELOG
aea863
index f771a433..596590a8 100644
aea863
--- a/CHANGELOG
aea863
+++ b/CHANGELOG
aea863
@@ -19,6 +19,7 @@ xx/xx/2018 autofs-5.1.5
aea863
 - add fedfs-map-nfs4.c.
aea863
 - add conditional inclusion of fedfs binaries.
aea863
 - add an example fedfs master map entry to the installed master map.
aea863
+- improve hostname lookup error logging.
aea863
 
aea863
 19/12/2017 autofs-5.1.4
aea863
 - fix spec file url.
aea863
diff --git a/lib/parse_subs.c b/lib/parse_subs.c
aea863
index db784a58..841e81fd 100644
aea863
--- a/lib/parse_subs.c
aea863
+++ b/lib/parse_subs.c
aea863
@@ -476,7 +476,8 @@ unsigned int get_network_proximity(const char *name)
aea863
 
aea863
 	ret = getaddrinfo(name_or_num, NULL, &hints, &ni);
aea863
 	if (ret) {
aea863
-		logerr("getaddrinfo: %s", gai_strerror(ret));
aea863
+		logerr("hostname lookup for %s failed: %s",
aea863
+		       name_or_num, gai_strerror(ret));
aea863
 		return PROXIMITY_ERROR;
aea863
 	}
aea863
 
aea863
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
aea863
index 60ede9f8..cc83e84d 100644
aea863
--- a/lib/rpc_subs.c
aea863
+++ b/lib/rpc_subs.c
aea863
@@ -693,7 +693,8 @@ static int create_client(struct conn_info *info, CLIENT **client)
aea863
 	ret = getaddrinfo(info->host, NULL, &hints, &ai;;
aea863
 	if (ret) {
aea863
 		error(LOGOPT_ANY,
aea863
-		      "hostname lookup failed: %s", gai_strerror(ret));
aea863
+		      "hostname lookup for %s failed: %s",
aea863
+		      info->host, gai_strerror(ret));
aea863
 		goto out_close;
aea863
 	}
aea863
 
aea863
diff --git a/modules/dclist.c b/modules/dclist.c
aea863
index 4daa199b..ba32134d 100644
aea863
--- a/modules/dclist.c
aea863
+++ b/modules/dclist.c
aea863
@@ -357,7 +357,9 @@ static char *getdnsdomainname(unsigned int logopt)
aea863
 
aea863
 	ret = getaddrinfo(name, NULL, &hints, &ni);
aea863
 	if (ret) {
aea863
-		error(logopt, "hostname lookup failed: %s", gai_strerror(ret));
aea863
+		error(logopt,
aea863
+		      "hostname lookup for %s failed: %s",
aea863
+		      name, gai_strerror(ret));
aea863
 		return NULL;
aea863
 	}
aea863
 
aea863
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
aea863
index e7debc56..9543ced3 100644
aea863
--- a/modules/parse_amd.c
aea863
+++ b/modules/parse_amd.c
aea863
@@ -260,7 +260,8 @@ static int match_my_name(unsigned int logopt, const char *name, struct substvar
aea863
 	ret = getaddrinfo(v->val, NULL, &hints, &cni);
aea863
 	if (ret) {
aea863
 		error(logopt, MODPREFIX
aea863
-		      "hostname lookup failed: %s\n", gai_strerror(ret));
aea863
+		      "hostname lookup for %s failed: %s\n",
aea863
+		      v->val, gai_strerror(ret));
aea863
 		goto out;
aea863
 	}
aea863
 
aea863
@@ -270,7 +271,8 @@ static int match_my_name(unsigned int logopt, const char *name, struct substvar
aea863
 	ret = getaddrinfo(name, NULL, &hints, &ni);
aea863
 	if (ret) {
aea863
 		error(logopt, MODPREFIX
aea863
-		      "hostname lookup failed: %s\n", gai_strerror(ret));
aea863
+		      "hostname lookup for %s failed: %s\n",
aea863
+		      name, gai_strerror(ret));
aea863
 		freeaddrinfo(cni);
aea863
 		goto out;
aea863
 	}
aea863
@@ -678,7 +680,8 @@ static char *normalize_hostname(unsigned int logopt, const char *host,
aea863
 		ret = getaddrinfo(host, NULL, &hints, &ni);
aea863
 		if (ret) {
aea863
 			error(logopt, MODPREFIX
aea863
-			      "hostname lookup failed: %s", gai_strerror(ret));
aea863
+			      "hostname lookup for %s failed: %s",
aea863
+			      host, gai_strerror(ret));
aea863
 			return NULL;
aea863
 		}
aea863
 		name = strdup(ni->ai_canonname);
aea863
diff --git a/modules/replicated.c b/modules/replicated.c
aea863
index f7b83236..740270ec 100644
aea863
--- a/modules/replicated.c
aea863
+++ b/modules/replicated.c
aea863
@@ -1007,8 +1007,9 @@ try_name:
aea863
 
aea863
 	ret = getaddrinfo(name, NULL, &hints, &ni);
aea863
 	if (ret) {
aea863
-		error(LOGOPT_ANY, "hostname lookup failed: %s",
aea863
-		      gai_strerror(ret));
aea863
+		error(LOGOPT_ANY,
aea863
+		      "hostname lookup for %s failed: %s",
aea863
+		      name, gai_strerror(ret));
aea863
 		free(name);
aea863
 		return 0;
aea863
 	}