Blame SOURCES/autofs-5.1.5-add-mount_verbose-configuration-option.patch

135b98
autofs-5.1.5 - add mount_verbose configuration option
135b98
135b98
From: Lars R. Damerow <lars@pixar.com>
135b98
135b98
This option makes automount pass the -v flag to mount(8).
135b98
135b98
Signed-off-by: Lars R.  Damerow <lars@pixar.com>
135b98
Signed-off-by: Ian Kent <raven@themaw.net>
135b98
---
135b98
 CHANGELOG                      |    1 +
135b98
 daemon/spawn.c                 |   20 ++++++++++++--------
135b98
 include/defaults.h             |    2 ++
135b98
 lib/defaults.c                 |   17 +++++++++++++++++
135b98
 man/autofs.conf.5.in           |    4 ++++
135b98
 redhat/autofs.conf.default.in  |    4 ++++
135b98
 samples/autofs.conf.default.in |    4 ++++
135b98
 7 files changed, 44 insertions(+), 8 deletions(-)
135b98
135b98
--- autofs-5.1.4.orig/CHANGELOG
135b98
+++ autofs-5.1.4/CHANGELOG
135b98
@@ -47,6 +47,7 @@ xx/xx/2018 autofs-5.1.5
135b98
 - support strictexpire mount option.
135b98
 - add NULL check for get_addr_string() return.
135b98
 - use malloc(3) in spawn.c.
135b98
+- add mount_verbose configuration option.
135b98
 
135b98
 19/12/2017 autofs-5.1.4
135b98
 - fix spec file url.
135b98
--- autofs-5.1.4.orig/daemon/spawn.c
135b98
+++ autofs-5.1.4/daemon/spawn.c
135b98
@@ -558,12 +558,14 @@ int spawn_mount(unsigned logopt, ...)
135b98
 	char prog[] = PATH_MOUNT;
135b98
 	char arg0[] = PATH_MOUNT;
135b98
 	char argn[] = "-n";
135b98
+	char argvr[] = "-v";
135b98
 	/* In case we need to use the fake option to mount */
135b98
 	char arg_fake[] = "-f";
135b98
 	unsigned int options;
135b98
 	unsigned int retries = MTAB_LOCK_RETRIES;
135b98
 	int update_mtab = 1, ret, printed = 0;
135b98
 	unsigned int wait = defaults_get_mount_wait();
135b98
+	int verbose = defaults_get_mount_verbose();
135b98
 	char buf[PATH_MAX + 1];
135b98
 	unsigned int argv_len;
135b98
 
135b98
@@ -590,8 +592,10 @@ int spawn_mount(unsigned logopt, ...)
135b98
 		}
135b98
 	}
135b98
 
135b98
-	/* Alloc 1 extra slot in case we need to use the "-f" option */
135b98
-	argv_len = sizeof(char *) * (argc + 2);
135b98
+	/* Alloc 2 extra slots in case we need to use the "-f" or "-v" options
135b98
+	 * plus the NULL slot for end of args.
135b98
+	 */
135b98
+	argv_len = sizeof(char *) * (argc + 3);
135b98
 	argv = malloc(argv_len);
135b98
 	if (!argv) {
135b98
 		char buf[MAX_ERR_BUF];
135b98
@@ -604,12 +608,12 @@ int spawn_mount(unsigned logopt, ...)
135b98
 	argv[0] = arg0;
135b98
 
135b98
 	va_start(arg, logopt);
135b98
-	if (update_mtab)
135b98
-		p = argv + 1;
135b98
-	else {
135b98
-		argv[1] = argn;
135b98
-		p = argv + 2;
135b98
-	}
135b98
+	p = argv + 1;
135b98
+	if (!update_mtab)
135b98
+		*(p++) = argn;
135b98
+	if (verbose)
135b98
+		*(p++) = argvr;
135b98
+
135b98
 	while ((*p = va_arg(arg, char *))) {
135b98
 		if (options == SPAWN_OPT_OPEN && !strcmp(*p, "-t")) {
135b98
 			*(++p) = va_arg(arg, char *);
135b98
--- autofs-5.1.4.orig/include/defaults.h
135b98
+++ autofs-5.1.4/include/defaults.h
135b98
@@ -27,6 +27,7 @@
135b98
 #define DEFAULT_TIMEOUT			"600"
135b98
 #define DEFAULT_MASTER_WAIT		"10"
135b98
 #define DEFAULT_NEGATIVE_TIMEOUT	"60"
135b98
+#define DEFAULT_MOUNT_VERBOSE		"0"
135b98
 #define DEFAULT_MOUNT_WAIT		"-1"
135b98
 #define DEFAULT_UMOUNT_WAIT		"12"
135b98
 #define DEFAULT_BROWSE_MODE		"1"
135b98
@@ -166,6 +167,7 @@ unsigned int defaults_get_ldap_timeout(v
135b98
 unsigned int defaults_get_ldap_network_timeout(void);
135b98
 unsigned int defaults_get_mount_nfs_default_proto(void);
135b98
 unsigned int defaults_get_append_options(void);
135b98
+unsigned int defaults_get_mount_verbose(void);
135b98
 unsigned int defaults_get_mount_wait(void);
135b98
 unsigned int defaults_get_umount_wait(void);
135b98
 const char *defaults_get_auth_conf_file(void);
135b98
--- autofs-5.1.4.orig/lib/defaults.c
135b98
+++ autofs-5.1.4/lib/defaults.c
135b98
@@ -68,6 +68,7 @@
135b98
 
135b98
 #define NAME_MOUNT_NFS_DEFAULT_PROTOCOL	"mount_nfs_default_protocol"
135b98
 #define NAME_APPEND_OPTIONS		"append_options"
135b98
+#define NAME_MOUNT_VERBOSE		"mount_verbose"
135b98
 #define NAME_MOUNT_WAIT			"mount_wait"
135b98
 #define NAME_UMOUNT_WAIT		"umount_wait"
135b98
 #define NAME_AUTH_CONF_FILE		"auth_conf_file"
135b98
@@ -328,6 +329,11 @@ static int conf_load_autofs_defaults(voi
135b98
 	if (ret == CFG_FAIL)
135b98
 		goto error;
135b98
 
135b98
+	ret = conf_update(sec, NAME_MOUNT_VERBOSE,
135b98
+			  DEFAULT_MOUNT_VERBOSE, CONF_ENV);
135b98
+	if (ret == CFG_FAIL)
135b98
+		goto error;
135b98
+
135b98
 	ret = conf_update(sec, NAME_MOUNT_WAIT,
135b98
 			  DEFAULT_MOUNT_WAIT, CONF_ENV);
135b98
 	if (ret == CFG_FAIL)
135b98
@@ -1780,6 +1786,17 @@ unsigned int defaults_get_append_options
135b98
 
135b98
 	return res;
135b98
 }
135b98
+
135b98
+unsigned int defaults_get_mount_verbose(void)
135b98
+{
135b98
+	long res;
135b98
+
135b98
+	res = conf_get_yesno(autofs_gbl_sec, NAME_MOUNT_VERBOSE);
135b98
+	if (res < 0)
135b98
+		res = atoi(DEFAULT_MOUNT_VERBOSE);
135b98
+
135b98
+	return res;
135b98
+}
135b98
 
135b98
 unsigned int defaults_get_mount_wait(void)
135b98
 {
135b98
--- autofs-5.1.4.orig/man/autofs.conf.5.in
135b98
+++ autofs-5.1.4/man/autofs.conf.5.in
135b98
@@ -41,6 +41,10 @@ Set the default timeout for caching fail
135b98
 60). If the equivalent command line option is given it will override this
135b98
 setting.
135b98
 .TP
135b98
+.B mount_verbose
135b98
+.br
135b98
+Use the verbose flag when spawning mount(8) (program default "no").
135b98
+.TP
135b98
 .B mount_wait
135b98
 .br
135b98
 Set the default time to wait for a response from a spawned mount(8)
135b98
--- autofs-5.1.4.orig/redhat/autofs.conf.default.in
135b98
+++ autofs-5.1.4/redhat/autofs.conf.default.in
135b98
@@ -26,6 +26,10 @@ timeout = 300
135b98
 #
135b98
 #negative_timeout = 60
135b98
 #
135b98
+# mount_verbose - use the -v flag when calling mount(8).
135b98
+#
135b98
+#mount_verbose = no
135b98
+#
135b98
 # mount_wait - time to wait for a response from mount(8).
135b98
 # 	       Setting this timeout can cause problems when
135b98
 # 	       mount would otherwise wait for a server that
135b98
--- autofs-5.1.4.orig/samples/autofs.conf.default.in
135b98
+++ autofs-5.1.4/samples/autofs.conf.default.in
135b98
@@ -26,6 +26,10 @@ timeout = 300
135b98
 #
135b98
 #negative_timeout = 60
135b98
 #
135b98
+# mount_verbose - use the -v flag when calling mount(8).
135b98
+#
135b98
+#mount_verbose = no
135b98
+#
135b98
 # mount_wait - time to wait for a response from mount(8).
135b98
 # 	       Setting this timeout can cause problems when
135b98
 # 	       mount would otherwise wait for a server that