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

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