Blame SOURCES/autofs-5.1.1-add-config-option-to-suppress-not-found-log-message.patch

306fa1
autofs-5.1.1 - add config option to suppress not found log message
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
Signed-off-by: Ian Kent <raven@themaw.net>
306fa1
---
306fa1
 CHANGELOG                      |    1 +
306fa1
 daemon/lookup.c                |   11 +++++++++--
306fa1
 include/defaults.h             |    4 +++-
306fa1
 lib/defaults.c                 |   17 +++++++++++++++++
306fa1
 man/autofs.conf.5.in           |    7 +++++++
306fa1
 modules/lookup_hesiod.c        |    6 ++++--
306fa1
 redhat/autofs.conf.default.in  |    8 ++++++++
306fa1
 samples/autofs.conf.default.in |    8 ++++++++
306fa1
 8 files changed, 57 insertions(+), 5 deletions(-)
306fa1
306fa1
--- autofs-5.0.7.orig/CHANGELOG
306fa1
+++ autofs-5.0.7/CHANGELOG
306fa1
@@ -205,6 +205,7 @@
306fa1
 - fix typo in autofs_sasl_bind().
306fa1
 - add configuration option to use fqdn in mounts.
306fa1
 - fix use-after-free in st_queue_handler().
306fa1
+- add config option to supress not found log message.
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
--- autofs-5.0.7.orig/daemon/lookup.c
306fa1
+++ autofs-5.0.7/daemon/lookup.c
306fa1
@@ -1036,8 +1036,15 @@ static void update_negative_cache(struct
306fa1
 		 */
306fa1
 		cache_unlock(me->mc);
306fa1
 	else {
306fa1
-		/* Notify only once after fail */
306fa1
-		logmsg("key \"%s\" not found in map source(s).", name);
306fa1
+		if (!defaults_disable_not_found_message()) {
306fa1
+			/* This really should be a warning but the original
306fa1
+			 * request for this needed it to be unconditional.
306fa1
+			 * That produces, IMHO, unnecessary noise in the log
306fa1
+			 * so a configuration option has been added to provide
306fa1
+			 * the ability to turn it off.
306fa1
+			 */
306fa1
+			logmsg("key \"%s\" not found in map source(s).", name);
306fa1
+		}
306fa1
 
306fa1
 		/* Doesn't exist in any source, just add it somewhere */
306fa1
 		if (source)
306fa1
--- autofs-5.0.7.orig/include/defaults.h
306fa1
+++ autofs-5.0.7/include/defaults.h
306fa1
@@ -47,7 +47,8 @@
306fa1
 
306fa1
 #define DEFAULT_MAP_HASH_TABLE_SIZE	"1024"
306fa1
 
306fa1
-#define DEFAULT_USE_HOSTNAME_FOR_MOUNTS	"0"
306fa1
+#define DEFAULT_USE_HOSTNAME_FOR_MOUNTS  "0"
306fa1
+#define DEFAULT_DISABLE_NOT_FOUND_MESSAGE "0"
306fa1
 
306fa1
 /* Config entry flags */
306fa1
 #define CONF_NONE			0x00000000
306fa1
@@ -165,6 +166,7 @@ unsigned int defaults_get_umount_wait(vo
306fa1
 const char *defaults_get_auth_conf_file(void);
306fa1
 unsigned int defaults_get_map_hash_table_size(void);
306fa1
 unsigned int defaults_use_hostname_for_mounts(void);
306fa1
+unsigned int defaults_disable_not_found_message(void);
306fa1
 
306fa1
 unsigned int conf_amd_mount_section_exists(const char *);
306fa1
 char *conf_amd_get_arch(void);
306fa1
--- autofs-5.0.7.orig/lib/defaults.c
306fa1
+++ autofs-5.0.7/lib/defaults.c
306fa1
@@ -73,6 +73,7 @@
306fa1
 #define NAME_MAP_HASH_TABLE_SIZE	"map_hash_table_size"
306fa1
 
306fa1
 #define NAME_USE_HOSTNAME_FOR_MOUNTS	"use_hostname_for_mounts"
306fa1
+#define NAME_DISABLE_NOT_FOUND_MESSAGE	"disable_not_found_message"
306fa1
 
306fa1
 #define NAME_AMD_ARCH				"arch"
306fa1
 #define NAME_AMD_AUTO_ATTRCACHE			"auto_attrcache"
306fa1
@@ -341,6 +342,11 @@ static int conf_load_autofs_defaults(voi
306fa1
 	if (ret == CFG_FAIL)
306fa1
 		goto error;
306fa1
 
306fa1
+	ret = conf_update(sec, NAME_DISABLE_NOT_FOUND_MESSAGE,
306fa1
+			  DEFAULT_DISABLE_NOT_FOUND_MESSAGE, CONF_ENV);
306fa1
+	if (ret == CFG_FAIL)
306fa1
+		goto error;
306fa1
+
306fa1
 	/* LDAP_URI and SEARCH_BASE can occur multiple times */
306fa1
 	while ((co = conf_lookup(sec, NAME_LDAP_URI)))
306fa1
 		conf_delete(co->section, co->name);
306fa1
@@ -1717,6 +1723,17 @@ unsigned int defaults_use_hostname_for_m
306fa1
 
306fa1
 	return res;
306fa1
 }
306fa1
+
306fa1
+unsigned int defaults_disable_not_found_message(void)
306fa1
+{
306fa1
+	int res;
306fa1
+
306fa1
+	res = conf_get_yesno(autofs_gbl_sec, NAME_DISABLE_NOT_FOUND_MESSAGE);
306fa1
+	if (res < 0)
306fa1
+		res = atoi(DEFAULT_DISABLE_NOT_FOUND_MESSAGE);
306fa1
+
306fa1
+	return res;
306fa1
+}
306fa1
 
306fa1
 unsigned int conf_amd_mount_section_exists(const char *section)
306fa1
 {
306fa1
--- autofs-5.0.7.orig/man/autofs.conf.5.in
306fa1
+++ autofs-5.0.7/man/autofs.conf.5.in
306fa1
@@ -129,6 +129,13 @@ name resolving to one that isn't respond
306fa1
 of attempts at a successful mount will correspond to the number of
306fa1
 addresses the host name resolves to the order will also not correspond
306fa1
 to fastest responding hosts.
306fa1
+.TP
306fa1
+.B disable_not_found_message
306fa1
+.br
306fa1
+The original request to add this log message needed it to be unconditional.
306fa1
+That produces, IMHO, unnecessary noise in the log so a configuration option
306fa1
+has been added to provide the ability to turn it off. The default is "no"
306fa1
+to maintain the current behaviour.
306fa1
 .SS LDAP Configuration
306fa1
 .P
306fa1
 Configuration settings available are:
306fa1
--- autofs-5.0.7.orig/modules/lookup_hesiod.c
306fa1
+++ autofs-5.0.7/modules/lookup_hesiod.c
306fa1
@@ -194,8 +194,10 @@ static int lookup_one(struct autofs_poin
306fa1
 	hes_result = hesiod_resolve(ctxt->hesiod_context, key, "filsys");
306fa1
 	if (!hes_result || !hes_result[0]) {
306fa1
 		int err = errno;
306fa1
-		error(ap->logopt,
306fa1
-		      MODPREFIX "key \"%s\" not found in map", key);
306fa1
+		if (!defaults_disable_not_found_message()) {
306fa1
+			error(ap->logopt,
306fa1
+			      MODPREFIX "key \"%s\" not found in map", key);
306fa1
+		}
306fa1
 		status = pthread_mutex_unlock(&hesiod_mutex);
306fa1
 		if (status)
306fa1
 			fatal(status);
306fa1
--- autofs-5.0.7.orig/redhat/autofs.conf.default.in
306fa1
+++ autofs-5.0.7/redhat/autofs.conf.default.in
306fa1
@@ -151,6 +151,14 @@ mount_nfs_default_protocol = 4
306fa1
 #
306fa1
 #use_hostname_for_mounts = "no"
306fa1
 #
306fa1
+# disable_not_found_message - The original request to add this log message
306fa1
+# 			 needed it to be unconditional. That produces, IMHO,
306fa1
+# 			 unnecessary noise in the log so a configuration option
306fa1
+# 			 has been added to provide the ability to turn it off.
306fa1
+# 			 The default is "no" to maintain the current behaviour.
306fa1
+#
306fa1
+#disable_not_found_message = "no"
306fa1
+#
306fa1
 # Otions for the amd parser within autofs.
306fa1
 #
306fa1
 # amd configuration options that are aren't used, haven't been
306fa1
--- autofs-5.0.7.orig/samples/autofs.conf.default.in
306fa1
+++ autofs-5.0.7/samples/autofs.conf.default.in
306fa1
@@ -150,6 +150,14 @@ browse_mode = no
306fa1
 #
306fa1
 #use_hostname_for_mounts = "no"
306fa1
 #
306fa1
+# disable_not_found_message - The original request to add this log message
306fa1
+# 			 needed it to be unconditional. That produces, IMHO,
306fa1
+# 			 unnecessary noise in the log so a configuration option
306fa1
+# 			 has been added to provide the ability to turn it off.
306fa1
+# 			 The default is "no" to maintain the current behaviour.
306fa1
+#
306fa1
+#disable_not_found_message = "no"
306fa1
+#
306fa1
 # Otions for the amd parser within autofs.
306fa1
 #
306fa1
 # amd configuration options that are aren't used, haven't been