Blame SOURCES/autofs-5.1.5-add-config-option-for-ignore-mount-option.patch

8fa62f
autofs-5.1.5 - add config option for "ignore" mount option
8fa62f
8fa62f
From: Ian Kent <raven@themaw.net>
8fa62f
8fa62f
Add a configuration option to control whether the autofs pseudo
8fa62f
mount option is used on autofs mounts.
8fa62f
8fa62f
The default setting is "no" to avoid unexpected behaviour and
8fa62f
so is an opt-in setting for those who understand that, if user
8fa62f
space utilities and libraries honour this, then autofs mounts
8fa62f
will be ommitted from mount table listings.
8fa62f
8fa62f
Signed-off-by: Ian Kent <raven@themaw.net>
8fa62f
---
8fa62f
 CHANGELOG                      |    1 +
8fa62f
 include/defaults.h             |    2 ++
8fa62f
 lib/defaults.c                 |   17 +++++++++++++++++
8fa62f
 lib/master.c                   |    3 ++-
8fa62f
 man/autofs.conf.5.in           |    7 +++++++
8fa62f
 redhat/autofs.conf.default.in  |    9 +++++++++
8fa62f
 samples/autofs.conf.default.in |    9 +++++++++
8fa62f
 7 files changed, 47 insertions(+), 1 deletion(-)
8fa62f
8fa62f
--- autofs-5.1.4.orig/CHANGELOG
8fa62f
+++ autofs-5.1.4/CHANGELOG
8fa62f
@@ -62,6 +62,7 @@ xx/xx/2018 autofs-5.1.5
8fa62f
 - fix unlink_mount_tree() not umounting mounts.
8fa62f
 - add ignore mount option.
8fa62f
 - use ignore option for offset mounts as well.
8fa62f
+- add config option for "ignore" mount option
8fa62f
 
8fa62f
 19/12/2017 autofs-5.1.4
8fa62f
 - fix spec file url.
8fa62f
--- autofs-5.1.4.orig/include/defaults.h
8fa62f
+++ autofs-5.1.4/include/defaults.h
8fa62f
@@ -51,6 +51,7 @@
8fa62f
 
8fa62f
 #define DEFAULT_USE_HOSTNAME_FOR_MOUNTS  "0"
8fa62f
 #define DEFAULT_DISABLE_NOT_FOUND_MESSAGE "0"
8fa62f
+#define DEFAULT_USE_IGNORE_MOUNT_OPTION	 "0"
8fa62f
 
8fa62f
 #define DEFAULT_SSS_MASTER_MAP_WAIT	"0"
8fa62f
 #define DEFAULT_USE_MOUNT_REQUEST_LOG_ID "0"
8fa62f
@@ -174,6 +175,7 @@ const char *defaults_get_auth_conf_file(
8fa62f
 unsigned int defaults_get_map_hash_table_size(void);
8fa62f
 unsigned int defaults_use_hostname_for_mounts(void);
8fa62f
 unsigned int defaults_disable_not_found_message(void);
8fa62f
+unsigned int defaults_get_use_ignore_mount_option(void);
8fa62f
 unsigned int defaults_get_sss_master_map_wait(void);
8fa62f
 unsigned int defaults_get_use_mount_request_log_id(void);
8fa62f
 
8fa62f
--- autofs-5.1.4.orig/lib/defaults.c
8fa62f
+++ autofs-5.1.4/lib/defaults.c
8fa62f
@@ -77,6 +77,7 @@
8fa62f
 
8fa62f
 #define NAME_USE_HOSTNAME_FOR_MOUNTS	"use_hostname_for_mounts"
8fa62f
 #define NAME_DISABLE_NOT_FOUND_MESSAGE	"disable_not_found_message"
8fa62f
+#define NAME_USE_IGNORE_MOUNT_OPTION	"use_ignore_mount_option"
8fa62f
 
8fa62f
 #define NAME_SSS_MASTER_MAP_WAIT	"sss_master_map_wait"
8fa62f
 #define NAME_USE_MOUNT_REQUEST_LOG_ID	"use_mount_request_log_id"
8fa62f
@@ -364,6 +365,11 @@ static int conf_load_autofs_defaults(voi
8fa62f
 	if (ret == CFG_FAIL)
8fa62f
 		goto error;
8fa62f
 
8fa62f
+	ret = conf_update(sec, NAME_USE_IGNORE_MOUNT_OPTION,
8fa62f
+			  DEFAULT_USE_IGNORE_MOUNT_OPTION, CONF_ENV);
8fa62f
+	if (ret == CFG_FAIL)
8fa62f
+		goto error;
8fa62f
+
8fa62f
 	ret = conf_update(sec, NAME_SSS_MASTER_MAP_WAIT,
8fa62f
 			  DEFAULT_SSS_MASTER_MAP_WAIT, CONF_ENV);
8fa62f
 	if (ret == CFG_FAIL)
8fa62f
@@ -1863,6 +1869,17 @@ unsigned int defaults_disable_not_found_
8fa62f
 
8fa62f
 	return res;
8fa62f
 }
8fa62f
+
8fa62f
+unsigned int defaults_get_use_ignore_mount_option(void)
8fa62f
+{
8fa62f
+	int res;
8fa62f
+
8fa62f
+	res = conf_get_yesno(autofs_gbl_sec, NAME_USE_IGNORE_MOUNT_OPTION);
8fa62f
+	if (res < 0)
8fa62f
+		res = atoi(DEFAULT_USE_IGNORE_MOUNT_OPTION);
8fa62f
+
8fa62f
+	return res;
8fa62f
+}
8fa62f
 
8fa62f
 unsigned int defaults_get_sss_master_map_wait(void)
8fa62f
 {
8fa62f
--- autofs-5.1.4.orig/lib/master.c
8fa62f
+++ autofs-5.1.4/lib/master.c
8fa62f
@@ -101,7 +101,8 @@ int master_add_autofs_point(struct maste
8fa62f
 		ap->negative_timeout = global_negative_timeout;
8fa62f
 	ap->exp_timeout = defaults_get_timeout();
8fa62f
 	ap->exp_runfreq = 0;
8fa62f
-	ap->flags = MOUNT_FLAG_IGNORE;
8fa62f
+	if (defaults_get_use_ignore_mount_option())
8fa62f
+		ap->flags = MOUNT_FLAG_IGNORE;
8fa62f
 	if (ghost)
8fa62f
 		ap->flags |= MOUNT_FLAG_GHOST;
8fa62f
 
8fa62f
--- autofs-5.1.4.orig/man/autofs.conf.5.in
8fa62f
+++ autofs-5.1.4/man/autofs.conf.5.in
8fa62f
@@ -151,6 +151,13 @@ That produces, IMHO, unnecessary noise i
8fa62f
 has been added to provide the ability to turn it off. The default is "no"
8fa62f
 to maintain the current behaviour.
8fa62f
 .TP
8fa62f
+.B use_ignore_mount_option
8fa62f
+.br
8fa62f
+An option to enable the use of autofs pseudo option "disable". This option
8fa62f
+is used as a hint to user space that the mount entry should be ommitted from
8fa62f
+mount table listings. The default is "no" to avoid unexpected changes in
8fa62f
+behaviour and so is an opt-in setting.
8fa62f
+.TP
8fa62f
 .B sss_master_map_wait
8fa62f
 .br
8fa62f
 Set the time to wait and retry if sssd returns "no such entry" when starting
8fa62f
--- autofs-5.1.4.orig/redhat/autofs.conf.default.in
8fa62f
+++ autofs-5.1.4/redhat/autofs.conf.default.in
8fa62f
@@ -183,6 +183,15 @@ mount_nfs_default_protocol = 4
8fa62f
 #
8fa62f
 #disable_not_found_message = "no"
8fa62f
 #
8fa62f
+# use_ignore_mount_option - This option is used to enable the use of autofs
8fa62f
+#			pseudo option "disable". This option is used as a
8fa62f
+#			hint to user space that the mount entry should be
8fa62f
+#			ommitted from mount table listings. The default is
8fa62f
+#			"no" to avoid unexpected changes in behaviour and
8fa62f
+#			so is an opt-in setting.
8fa62f
+#
8fa62f
+#use_ignore_mount_option = no
8fa62f
+#
8fa62f
 # sss_master_map_wait - When sssd is starting up it can sometimes return
8fa62f
 # 			"no such entry" for a short time until it has read
8fa62f
 # 			in the LDAP map information. Internal default is 0
8fa62f
--- autofs-5.1.4.orig/samples/autofs.conf.default.in
8fa62f
+++ autofs-5.1.4/samples/autofs.conf.default.in
8fa62f
@@ -182,6 +182,15 @@ browse_mode = no
8fa62f
 #
8fa62f
 #disable_not_found_message = "no"
8fa62f
 #
8fa62f
+# use_ignore_mount_option - This option is used to enable the use of autofs
8fa62f
+#			pseudo option "disable". This option is used as a
8fa62f
+#			hint to user space that the mount entry should be
8fa62f
+#			ommitted from mount table listings. The default is
8fa62f
+#			"no" to avoid unexpected changes in behaviour and
8fa62f
+#			so is an opt-in setting.
8fa62f
+#
8fa62f
+#use_ignore_mount_option = no
8fa62f
+#
8fa62f
 # sss_master_map_wait - When sssd is starting up it can sometimes return
8fa62f
 #			"no such entry" for a short time until it has read
8fa62f
 # 			in the LDAP map information. Internal default is 0