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

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