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

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