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

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