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

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