Blob Blame History Raw
autofs-5.1.4 - improve hostname lookup error logging

From: Ian Kent <raven@themaw.net>

There's not enough information in name lookup log messages
to determine if the failed lookup is in fact a problem or
is expected.

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

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -325,6 +325,7 @@
 - document ghost option in auto.master man page.
 - make expire remaining log level debug.
 - workaround getaddrinfo(3) ai_canonname bug
+- improve hostname lookup error logging.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/lib/parse_subs.c
+++ autofs-5.0.7/lib/parse_subs.c
@@ -476,7 +476,8 @@ unsigned int get_network_proximity(const
 
 	ret = getaddrinfo(name_or_num, NULL, &hints, &ni);
 	if (ret) {
-		logerr("getaddrinfo: %s", gai_strerror(ret));
+		logerr("hostname lookup for %s failed: %s",
+		       name_or_num, gai_strerror(ret));
 		return PROXIMITY_ERROR;
 	}
 
--- autofs-5.0.7.orig/lib/rpc_subs.c
+++ autofs-5.0.7/lib/rpc_subs.c
@@ -702,7 +702,8 @@ static int create_client(struct conn_inf
 	ret = getaddrinfo(info->host, NULL, &hints, &ai);
 	if (ret) {
 		error(LOGOPT_ANY,
-		      "hostname lookup failed: %s", gai_strerror(ret));
+		      "hostname lookup for %s failed: %s",
+		      info->host, gai_strerror(ret));
 		goto out_close;
 	}
 
--- autofs-5.0.7.orig/modules/dclist.c
+++ autofs-5.0.7/modules/dclist.c
@@ -357,7 +357,9 @@ static char *getdnsdomainname(unsigned i
 
 	ret = getaddrinfo(name, NULL, &hints, &ni);
 	if (ret) {
-		error(logopt, "hostname lookup failed: %s", gai_strerror(ret));
+		error(logopt,
+		      "hostname lookup for %s failed: %s",
+		      name, gai_strerror(ret));
 		return NULL;
 	}
 
--- autofs-5.0.7.orig/modules/parse_amd.c
+++ autofs-5.0.7/modules/parse_amd.c
@@ -260,7 +260,8 @@ static int match_my_name(unsigned int lo
 	ret = getaddrinfo(v->val, NULL, &hints, &cni);
 	if (ret) {
 		error(logopt, MODPREFIX
-		      "hostname lookup failed: %s\n", gai_strerror(ret));
+		      "hostname lookup for %s failed: %s\n",
+		      v->val, gai_strerror(ret));
 		goto out;
 	}
 
@@ -270,7 +271,8 @@ static int match_my_name(unsigned int lo
 	ret = getaddrinfo(name, NULL, &hints, &ni);
 	if (ret) {
 		error(logopt, MODPREFIX
-		      "hostname lookup failed: %s\n", gai_strerror(ret));
+		      "hostname lookup for %s failed: %s\n",
+		      name, gai_strerror(ret));
 		freeaddrinfo(cni);
 		goto out;
 	}
@@ -680,7 +682,8 @@ static char *normalize_hostname(unsigned
 		ret = getaddrinfo(host, NULL, &hints, &ni);
 		if (ret) {
 			error(logopt, MODPREFIX
-			      "hostname lookup failed: %s", gai_strerror(ret));
+			      "hostname lookup for %s failed: %s",
+			      host, gai_strerror(ret));
 			return NULL;
 		}
 		name = strdup(ni->ai_canonname);
--- autofs-5.0.7.orig/modules/replicated.c
+++ autofs-5.0.7/modules/replicated.c
@@ -945,8 +945,9 @@ try_name:
 
 	ret = getaddrinfo(name, NULL, &hints, &ni);
 	if (ret) {
-		error(LOGOPT_ANY, "hostname lookup failed: %s",
-		      gai_strerror(ret));
+		error(LOGOPT_ANY,
+		      "hostname lookup for %s failed: %s",
+		      name, gai_strerror(ret));
 		free(name);
 		return 0;
 	}