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

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