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

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