packages: autofs/autofs-5.0.4-add-lsb-init-script-parameter-block.patch (NE...

pluto pluto at pld-linux.org
Sat Aug 29 15:16:35 CEST 2009


Author: pluto                        Date: Sat Aug 29 13:16:35 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- import latest patchset.

---- Files affected:
packages/autofs:
   autofs-5.0.4-add-lsb-init-script-parameter-block.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-add-missing-changelog-entries.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-add-nfs-mount-proto-default-conf-option.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-allow-automount-daemon-to-dump-core.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-always-read-file-maps-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-always-read-file-maps-key-lookup-fixes.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-always-read-file-maps-multi-map-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-always-read-file-maps.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-another-easy-alloca-replacements-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-clear-rpc-client-on-lookup-fail.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-code-analysis-corrections.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-configure-libtirpc-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-configure-libtirpc.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-dont-fail-on-ipv6-address-adding-host.p
 atch (NONE -> 1.1)  (NEW), autofs-5.0.4-dont-umount-existing-direct-mount-on-reread.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-easy-alloca-replacements-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-easy-alloca-replacements.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-expire-specific-submount-only.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-bad-token-declare.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-double-free-in-do_sasl_bind.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-double-free-in-expire_proc.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-dumb-libxml2-check.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-hosts-map-use-after-free.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-incorrect-dclist-free.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-kernel-includes.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-ldap-detection.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-lsb-init-script-header.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-map-type-info-parse-error.patch (NONE -> 1.1)  (NEW), a
 utofs-5.0.4-fix-map-type-info-parse-error-update.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-memory-leak-reading-ldap-master.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-negative-cache-non-existent-key.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-notify-mount-message-path.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-pthread-push-order-in-expire_proc_direct.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-quoted-mess.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-restorecon.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-return-start-status-on-fail.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-rpc-fd-leak.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-select-fd-limit.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-fix-st_remove_tasks-locking.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-force-unlink-umount.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-improve-manual-umount-recovery.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-ipv6-name-and-address-support.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-ipv6-parse.
 patch (NONE -> 1.1)  (NEW), autofs-5.0.4-library-reload-fix-update-fix-2.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-library-reload-fix-update-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-library-reload-fix-update.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-libxml2-workaround-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-make-hash-table-scale-to-thousands-of-entries.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-make-MAX_ERR_BUF-and-PARSE_MAX_BUF-use-easier-to-audit.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-manual-umount-recovery-fixes.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-remount-we-created-mount-point-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-renew-sasl-creds-upon-reconnect-fail.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-reset-flex-scanner-when-setting-buffer.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-srv-lookup-handle-endian.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-uris-list-locking-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-use-CLOEXEC-flag.patch (NONE -> 1.1)  (NEW), autofs-5.0.4
 -use-CLOEXEC-flag-setmntent-include-fix.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-use-CLOEXEC-flag-setmntent.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-use-intr-as-hosts-mount-default.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-use-misc-device.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-use-percent-hack-for-master.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-use-srv-query-for-domain-dn.patch (NONE -> 1.1)  (NEW), autofs-5.0.4-zero-s_magic-is-valid.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/autofs/autofs-5.0.4-add-lsb-init-script-parameter-block.patch
diff -u /dev/null packages/autofs/autofs-5.0.4-add-lsb-init-script-parameter-block.patch:1.1
--- /dev/null	Sat Aug 29 15:16:35 2009
+++ packages/autofs/autofs-5.0.4-add-lsb-init-script-parameter-block.patch	Sat Aug 29 15:16:26 2009
@@ -0,0 +1,69 @@
+autofs-5.0.4 - add lsb init script parameter block
+
+From: Ian Kent <raven at themaw.net>
+
+
+---
+
+ CHANGELOG             |    1 +
+ redhat/autofs.init.in |   11 ++++++++++-
+ samples/rc.autofs.in  |   11 ++++++++++-
+ 3 files changed, 21 insertions(+), 2 deletions(-)
+
+
+diff --git a/CHANGELOG b/CHANGELOG
+index 4df6a60..aab3209 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -30,6 +30,7 @@
+ - fix return start status on fail.
+ - fix double free in expire_proc().
+ - another easy alloca replacements fix.
++- add LSB init script parameter block.
+ 
+ 4/11/2008 autofs-5.0.4
+ -----------------------
+diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
+index 471667e..0fd1777 100644
+--- a/redhat/autofs.init.in
++++ b/redhat/autofs.init.in
+@@ -6,7 +6,16 @@
+ # processname: /usr/sbin/automount
+ # config: /etc/auto.master
+ # description: Automounts filesystems on demand
+-
++#
++### BEGIN INIT INFO
++# Provides: $autofs
++# Should-Start: $network $ypbind
++# Should-Stop: $network $ypbind
++# Default-Start: 3 4 5
++# Default-Stop: 0 1 2 6
++# Short-Description: Automounts filesystems on demand
++# Description: Automounts filesystems on demand
++### END INIT INFO
+ #
+ # Location of the automount daemon and the init directory
+ #
+diff --git a/samples/rc.autofs.in b/samples/rc.autofs.in
+index 2877fe2..63a0c5d 100644
+--- a/samples/rc.autofs.in
++++ b/samples/rc.autofs.in
+@@ -5,7 +5,16 @@
+ # On most distributions, this file should be called:
+ # /etc/rc.d/init.d/autofs or /etc/init.d/autofs or /etc/rc.d/rc.autofs
+ #
+-
++#
++### BEGIN INIT INFO
++# Provides: $autofs
++# Should-Start: $network $ypbind
++# Should-Stop: $network $ypbind
++# Default-Start: 3 4 5
++# Default-Stop: 0 1 2 6
++# Short-Description: Automounts filesystems on demand
++# Description: Automounts filesystems on demand
++### END INIT INFO
+ #
+ # Location of the automount daemon and the init directory
+ #

================================================================
Index: packages/autofs/autofs-5.0.4-add-missing-changelog-entries.patch
diff -u /dev/null packages/autofs/autofs-5.0.4-add-missing-changelog-entries.patch:1.1
--- /dev/null	Sat Aug 29 15:16:35 2009
+++ packages/autofs/autofs-5.0.4-add-missing-changelog-entries.patch	Sat Aug 29 15:16:27 2009
@@ -0,0 +1,27 @@
+autofs-5.0.4 - add missing changelog entries
+
+From: Ian Kent <raven at themaw.net>
+
+Add changelog entries inadvertantly missed in last commit.
+---
+
+ CHANGELOG |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+
+diff --git a/CHANGELOG b/CHANGELOG
+index 417a001..3ff3daa 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -16,6 +16,11 @@
+   use of 5.0.3 strartup behavior if required.
+ - always read entire file map into cache to speed lookups.
+ - make MAX_ERR_BUF and PARSE_MAX_BUF use easier to audit.
++- make some easy alloca replacements (Valerie Aurora Henson).
++- update to configure libtirpc if present.
++- update to provide ipv6 name and address support.
++- update to provide ipv6 address parsing.
++
+ 
+ 4/11/2008 autofs-5.0.4
+ -----------------------

================================================================
Index: packages/autofs/autofs-5.0.4-add-nfs-mount-proto-default-conf-option.patch
diff -u /dev/null packages/autofs/autofs-5.0.4-add-nfs-mount-proto-default-conf-option.patch:1.1
--- /dev/null	Sat Aug 29 15:16:35 2009
+++ packages/autofs/autofs-5.0.4-add-nfs-mount-proto-default-conf-option.patch	Sat Aug 29 15:16:27 2009
@@ -0,0 +1,181 @@
+autofs-5.0.4 - add nfs mount protocol default configuration option
+
+From: Ian Kent <raven at themaw.net>
+
+Add configuration option MOUNT_NFS_DEFAULT_PROTOCOL with default of 3.
+Since the default mount protocol used by mount.nfs(8) will change to
+NFS version 4 at some point, and because we can't identify the default
+automatically, we need to be able to set it in our configuration.
+This will only make a difference for replicated map entries as
+availability probing isn't used for single host map entries.
+---
+
+ CHANGELOG                      |    1 +
+ include/defaults.h             |    2 ++
+ lib/defaults.c                 |   15 ++++++++++++++-
+ man/auto.master.5.in           |    6 ++++++
+ modules/mount_nfs.c            |    8 +++++---
+ redhat/autofs.sysconfig.in     |   10 ++++++++++
+ samples/autofs.conf.default.in |   10 ++++++++++
+ 7 files changed, 48 insertions(+), 4 deletions(-)
+
+
+diff --git a/CHANGELOG b/CHANGELOG
+index ad74b7d..0ce2a56 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -25,6 +25,7 @@
+ - add check for alternate libtirpc library for libtirpc tsd workaround.
+ - cleanup configure defines for libtirpc.
+ - add WITH_LIBTIRPC to -V status report.
++- add nfs mount protocol default configuration option.
+ 
+ 4/11/2008 autofs-5.0.4
+ -----------------------
+diff --git a/include/defaults.h b/include/defaults.h
+index 9a2430f..9bf16e5 100644
+--- a/include/defaults.h
++++ b/include/defaults.h
+@@ -37,6 +37,7 @@
+ #define DEFAULT_ENTRY_ATTR		"cn"
+ #define DEFAULT_VALUE_ATTR		"nisMapEntry"
+ 
++#define DEFAULT_NFS_MOUNT_PROTOCOL	3
+ #define DEFAULT_APPEND_OPTIONS		1
+ #define DEFAULT_AUTH_CONF_FILE		AUTOFS_MAP_DIR "/autofs_ldap_auth.conf"
+ 
+@@ -61,6 +62,7 @@ struct ldap_schema *defaults_get_default_schema(void);
+ struct ldap_schema *defaults_get_schema(void);
+ struct ldap_searchdn *defaults_get_searchdns(void);
+ void defaults_free_searchdns(struct ldap_searchdn *);
++unsigned int defaults_get_mount_nfs_default_proto(void);
+ unsigned int defaults_get_append_options(void);
+ unsigned int defaults_get_umount_wait(void);
+ const char *defaults_get_auth_conf_file(void);
+diff --git a/lib/defaults.c b/lib/defaults.c
+index e507a59..17164bd 100644
+--- a/lib/defaults.c
++++ b/lib/defaults.c
+@@ -45,6 +45,7 @@
+ #define ENV_NAME_ENTRY_ATTR		"ENTRY_ATTRIBUTE"
+ #define ENV_NAME_VALUE_ATTR		"VALUE_ATTRIBUTE"
+ 
++#define ENV_MOUNT_NFS_DEFAULT_PROTOCOL	"MOUNT_NFS_DEFAULT_PROTOCOL"
+ #define ENV_APPEND_OPTIONS		"APPEND_OPTIONS"
+ #define ENV_UMOUNT_WAIT			"UMOUNT_WAIT"
+ #define ENV_AUTH_CONF_FILE		"AUTH_CONF_FILE"
+@@ -326,7 +327,8 @@ unsigned int defaults_read_config(unsigned int to_syslog)
+ 		    check_set_config_value(key, ENV_APPEND_OPTIONS, value, to_syslog) ||
+ 		    check_set_config_value(key, ENV_UMOUNT_WAIT, value, to_syslog) ||
+ 		    check_set_config_value(key, ENV_AUTH_CONF_FILE, value, to_syslog) ||
+-		    check_set_config_value(key, ENV_MAP_HASH_TABLE_SIZE, value, to_syslog))
++		    check_set_config_value(key, ENV_MAP_HASH_TABLE_SIZE, value, to_syslog) ||
++		    check_set_config_value(key, ENV_MOUNT_NFS_DEFAULT_PROTOCOL, value, to_syslog))
+ 			;
+ 	}
+ 
+@@ -643,6 +645,17 @@ struct ldap_schema *defaults_get_schema(void)
+ 	return schema;
+ }
+ 
++unsigned int defaults_get_mount_nfs_default_proto(void)
++{
++	long proto;
++
++	proto = get_env_number(ENV_MOUNT_NFS_DEFAULT_PROTOCOL);
++	if (proto < 2 || proto > 4)
++		proto = DEFAULT_NFS_MOUNT_PROTOCOL;
++
++	return (unsigned int) proto;
++}
++
+ unsigned int defaults_get_append_options(void)
+ {
+ 	int res;
+diff --git a/man/auto.master.5.in b/man/auto.master.5.in
+index 9cc5f02..aaa6324 100644
+--- a/man/auto.master.5.in
++++ b/man/auto.master.5.in
+@@ -183,6 +183,12 @@ but it is the best we can do.
+ .B BROWSE_MODE
+ Maps are browsable by default (program default "yes").
+ .TP
++.B MOUNT_NFS_DEFAULT_PROTOCOL
++Specify the default protocol used by mount.nfs(8) (program default 3). Since
++we can't identify this default automatically we need to set it in the autofs
++configuration. This option will only make a difference for replicated map
++entries as availability probing isn't used for single host map entries.
++.TP
+ .B APPEND_OPTIONS
+ Determine whether global options, given on the command line or per mount
+ in the master map, are appended to map entry options or if the map entry
+diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
+index 4f3f514..14d3850 100644
+--- a/modules/mount_nfs.c
++++ b/modules/mount_nfs.c
+@@ -61,7 +61,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
+ 	char fullpath[PATH_MAX];
+ 	char buf[MAX_ERR_BUF];
+ 	struct host *this, *hosts = NULL;
+-	unsigned int vers;
++	unsigned int mount_default_proto, vers;
+ 	char *nfsoptions = NULL;
+ 	unsigned int random_selection = ap->flags & MOUNT_FLAG_RANDOM_SELECT;
+ 	int len, status, err, existed = 1;
+@@ -130,10 +130,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
+ 		      nfsoptions, nosymlink, ro);
+ 	}
+ 
++	mount_default_proto = defaults_get_mount_nfs_default_proto();
++	vers = NFS_VERS_MASK | NFS_PROTO_MASK;
+ 	if (strcmp(fstype, "nfs4") == 0)
+ 		vers = NFS4_VERS_MASK | TCP_SUPPORTED;
+-	else
+-		vers = NFS_VERS_MASK | NFS_PROTO_MASK;
++	else if (mount_default_proto == 4)
++		vers = vers | NFS4_VERS_MASK;
+ 
+ 	if (!parse_location(ap->logopt, &hosts, what)) {
+ 		info(ap->logopt, MODPREFIX "no hosts available");
+diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
+index fe36f45..04e521c 100644
+--- a/redhat/autofs.sysconfig.in
++++ b/redhat/autofs.sysconfig.in
+@@ -22,6 +22,16 @@ TIMEOUT=300
+ #
+ BROWSE_MODE="no"
+ #
++# MOUNT_NFS_DEFAULT_PROTOCOL - specify the default protocol used by
++# 			       mount.nfs(8). Since we can't identify
++# 			       the default automatically we need to
++# 			       set it in our configuration. This will
++# 			       only make a difference for replicated
++# 			       map entries as availability probing isn't
++# 			       used for single host map entries.
++#
++#MOUNT_NFS_DEFAULT_PROTOCOL=3
++#
+ # APPEND_OPTIONS - append to global options instead of replace.
+ #
+ #APPEND_OPTIONS="yes"
+diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
+index 4496738..52d18ec 100644
+--- a/samples/autofs.conf.default.in
++++ b/samples/autofs.conf.default.in
+@@ -22,6 +22,16 @@ TIMEOUT=300
+ #
+ BROWSE_MODE="no"
+ #
++# MOUNT_NFS_DEFAULT_PROTOCOL - specify the default protocol used by
++# 			       mount.nfs(8). Since we can't identify
++# 			       the default automatically we need to
++# 			       set it in our configuration. This will
++# 			       only make a difference for replicated
++# 			       map entries as availability probing isn't
++# 			       used for single host map entries.
++#
++#MOUNT_NFS_DEFAULT_PROTOCOL=3
++#
+ # APPEND_OPTIONS - append to global options instead of replace.
+ #
+ #APPEND_OPTIONS="yes"

================================================================
Index: packages/autofs/autofs-5.0.4-allow-automount-daemon-to-dump-core.patch
diff -u /dev/null packages/autofs/autofs-5.0.4-allow-automount-daemon-to-dump-core.patch:1.1
--- /dev/null	Sat Aug 29 15:16:35 2009
+++ packages/autofs/autofs-5.0.4-allow-automount-daemon-to-dump-core.patch	Sat Aug 29 15:16:27 2009
@@ -0,0 +1,83 @@
+autofs-5.0.4 - allow the automount daemon to dump core
+
+From: Jeff Moyer <jmoyer at redhat.com>
+
+Right now, the automount daemon blocks all signals.  We should at least
+unblock those that will cause us to dump core.  Otherwise, I think the
+behaviour could be, umm, interesting.
+
+I tested this by sending SIGBUS and SIGSEGV to the automount daemon.
+
+edit - raven
+- I changed this a little so that the change to the signals is
+  done in one place and added SIGABRT and SIGTRAP to the list
+  of signals that aren't blocked.
+
+Signed-off-by: Jeff Moyer <jmoyer at redhat.com>
+---
+
+ CHANGELOG          |    1 +
+ daemon/automount.c |   16 ++++++++++++----
+ 2 files changed, 13 insertions(+), 4 deletions(-)
+
+
+diff --git a/CHANGELOG b/CHANGELOG
+index 7f27f5e..4b85649 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -57,6 +57,7 @@
+ - mannual umount recovery fixes.
+ - fix map type info parse error.
+ - fix an RPC fd leak.
++- don't block signals we expect to dump core.
+ 
+ 4/11/2008 autofs-5.0.4
+ -----------------------
+diff --git a/daemon/automount.c b/daemon/automount.c
+index 44dcdd6..e7f801b 100644
+--- a/daemon/automount.c
++++ b/daemon/automount.c
+@@ -64,6 +64,8 @@ static int st_stat = 1;
+ static int *pst_stat = &st_stat;
+ static pthread_t state_mach_thid;
+ 
++static sigset_t block_sigs;
++
+ /* Pre-calculated kernel packet length */
+ static size_t kpkt_len;
+ 
+@@ -1321,7 +1323,7 @@ static void *statemachine(void *arg)
+ 	sigset_t signalset;
+ 	int sig;
+ 
+-	sigfillset(&signalset);
++	memcpy(&signalset, &block_sigs, sizeof(signalset));
+ 	sigdelset(&signalset, SIGCHLD);
+ 	sigdelset(&signalset, SIGCONT);
+ 
+@@ -1817,7 +1819,6 @@ int main(int argc, char *argv[])
+ 	unsigned foreground, have_global_options;
+ 	time_t timeout;
+ 	time_t age = time(NULL);
+-	sigset_t allsigs;
+ 	struct rlimit rlim;
+ 	static const struct option long_options[] = {
+ 		{"help", 0, 0, 'h'},
+@@ -1837,8 +1838,15 @@ int main(int argc, char *argv[])
+ 		{0, 0, 0, 0}
+ 	};
+ 
+-	sigfillset(&allsigs);
+-	sigprocmask(SIG_BLOCK, &allsigs, NULL);
++	sigfillset(&block_sigs);
++	/* allow for the dropping of core files */
++	sigdelset(&block_sigs, SIGABRT);
++	sigdelset(&block_sigs, SIGBUS);
++	sigdelset(&block_sigs, SIGSEGV);
++	sigdelset(&block_sigs, SIGILL);
++	sigdelset(&block_sigs, SIGFPE);
++	sigdelset(&block_sigs, SIGTRAP);
++	sigprocmask(SIG_BLOCK, &block_sigs, NULL);
+ 
+ 	program = argv[0];
+ 

================================================================
Index: packages/autofs/autofs-5.0.4-always-read-file-maps-fix.patch
diff -u /dev/null packages/autofs/autofs-5.0.4-always-read-file-maps-fix.patch:1.1
--- /dev/null	Sat Aug 29 15:16:35 2009
+++ packages/autofs/autofs-5.0.4-always-read-file-maps-fix.patch	Sat Aug 29 15:16:27 2009
@@ -0,0 +1,61 @@
+autofs-5.0.4 - always read file maps fix
+
+From: Ian Kent <raven at themaw.net>
+
+If map instances are present for a map source then either we have
+plus included entries or we are looking through a list of nsswitch
+sources. In either case we cannot avoid reading through the map
+because we must preserve the key lookup order over multiple sources.
+But also, we can't know if a source instance has been changed since
+the last time we checked it until we preform a lookup against it.
+So, in this case a lookup within the internal cache cannot be relied
+upon to find the key we're looking for. At least, when we get to the
+file source instance itself, the lookup for the key will be done from
+the cache.
+---
+
+ CHANGELOG             |    1 +
+ modules/lookup_file.c |   17 ++++++++++++++---
+ 2 files changed, 15 insertions(+), 3 deletions(-)
+
+
+diff --git a/CHANGELOG b/CHANGELOG
+index aab3209..da7ecbf 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -31,6 +31,7 @@
+ - fix double free in expire_proc().
+ - another easy alloca replacements fix.
+ - add LSB init script parameter block.
++- fix file map lookup when reading included or nsswitch sources.
+ 
+ 4/11/2008 autofs-5.0.4
+ -----------------------
+diff --git a/modules/lookup_file.c b/modules/lookup_file.c
+index ec78090..bd30bc5 100644
+--- a/modules/lookup_file.c
++++ b/modules/lookup_file.c
+@@ -998,9 +998,20 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
+ 
+ 		cache_readlock(mc);
+ 		me = cache_lookup_first(mc);
+-		if (me && st.st_mtime <= me->age)
+-			goto do_cache_lookup;
+-		else
++		if (me && st.st_mtime <= me->age) {
++			/*
++			 * If any map instances are present for this source
++			 * then either we have plus included entries or we
++			 * are looking through the list of nsswitch sources.
++			 * In either case we cannot avoid reading through the
++			 * map because we must preserve the key order over
++			 * multiple sources. But also, we can't know, at this
++			 * point, if a source instance has been changed since
++			 * the last time we checked it.
++			 */
++			if (!source->instance)
++				goto do_cache_lookup;
++		} else
+ 			source->stale = 1;
+ 
+ 		me = cache_lookup_distinct(mc, key);

================================================================
Index: packages/autofs/autofs-5.0.4-always-read-file-maps-key-lookup-fixes.patch
diff -u /dev/null packages/autofs/autofs-5.0.4-always-read-file-maps-key-lookup-fixes.patch:1.1
--- /dev/null	Sat Aug 29 15:16:35 2009
+++ packages/autofs/autofs-5.0.4-always-read-file-maps-key-lookup-fixes.patch	Sat Aug 29 15:16:27 2009
@@ -0,0 +1,65 @@
+autofs-5.0.4 - always read file maps key lookup fixes
+
+From: Ian Kent <raven at themaw.net>
+
+Since we always read file maps at start we need to ensure that
+we return a not found if the key isn't found in the cache. Also,
+if we're looking through a "multi" map we can't use the cache
+lookup optimisation because, in this case, there is a single map
+source shared by the "multi" maps so we may not get correct results
+from the lookup if a map later in the search has been modified.
+---
+
+ CHANGELOG             |    1 +
+ modules/lookup_file.c |   17 +++++++++++------
+ 2 files changed, 12 insertions(+), 6 deletions(-)
+
+
+diff --git a/CHANGELOG b/CHANGELOG
+index 972ef63..5000f0c 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -48,6 +48,7 @@
+ - improve manual umount recovery.
+ - dont fail on ipv6 address when adding host.
+ - always read file maps multi map fix.
++- always read file maps key lookup fixes.
+ 
+ 4/11/2008 autofs-5.0.4
+ -----------------------
+diff --git a/modules/lookup_file.c b/modules/lookup_file.c
+index bd30bc5..a4ca39d 100644
+--- a/modules/lookup_file.c
++++ b/modules/lookup_file.c
+@@ -1003,13 +1003,15 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
+ 			 * If any map instances are present for this source
+ 			 * then either we have plus included entries or we
+ 			 * are looking through the list of nsswitch sources.
+-			 * In either case we cannot avoid reading through the
+-			 * map because we must preserve the key order over
+-			 * multiple sources. But also, we can't know, at this
+-			 * point, if a source instance has been changed since
+-			 * the last time we checked it.
++			 * In either case, or if it's a "multi" source, we
++			 * cannot avoid reading through the map because we
++			 * must preserve the key order over multiple sources
++			 * or maps. But also, we can't know, at this point,
++			 * if a source instance has been changed since the
++			 * last time we checked it.
+ 			 */
+-			if (!source->instance)
++			if (!source->instance &&
++			    source->type && strcmp(source->type, "multi"))
+ 				goto do_cache_lookup;
+ 		} else
+ 			source->stale = 1;
+@@ -1055,6 +1057,9 @@ do_cache_lookup:
+ 	}
+ 	cache_unlock(mc);
+ 
++	if (!me)
++		return NSS_STATUS_NOTFOUND;
++
+ 	if (!mapent)
+ 		return NSS_STATUS_TRYAGAIN;
+ 

================================================================
Index: packages/autofs/autofs-5.0.4-always-read-file-maps-multi-map-fix.patch
diff -u /dev/null packages/autofs/autofs-5.0.4-always-read-file-maps-multi-map-fix.patch:1.1
--- /dev/null	Sat Aug 29 15:16:35 2009
+++ packages/autofs/autofs-5.0.4-always-read-file-maps-multi-map-fix.patch	Sat Aug 29 15:16:27 2009
@@ -0,0 +1,132 @@
+autofs-5.0.4 - always read file maps multi map fix
+
+From: Ian Kent <raven at themaw.net>
+
+Since "multi" map entries may contain file maps themselves and we
+always want to read file maps we need to move the chack of whether
+to read the map from lookup_nss_read_map() into the individual
+map type lookup modules.
+---
+
+ CHANGELOG                |    1 +
+ daemon/lookup.c          |   14 --------------
+ modules/lookup_hosts.c   |    8 ++++++++
+ modules/lookup_ldap.c    |    8 ++++++++
+ modules/lookup_nisplus.c |    8 ++++++++
+ modules/lookup_yp.c      |    8 ++++++++
+ 6 files changed, 33 insertions(+), 14 deletions(-)
+
+
+diff --git a/CHANGELOG b/CHANGELOG
+index 7e1012f..972ef63 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -47,6 +47,7 @@
+ - fix incorrect shutdown introduced by library relaod fixes.
+ - improve manual umount recovery.
+ - dont fail on ipv6 address when adding host.
++- always read file maps multi map fix.
+ 
+ 4/11/2008 autofs-5.0.4
+ -----------------------
+diff --git a/daemon/lookup.c b/daemon/lookup.c
+index bc94655..9d5a5c8 100644
+--- a/daemon/lookup.c
++++ b/daemon/lookup.c
+@@ -278,20 +278,6 @@ static int do_read_map(struct autofs_point *ap, struct map_source *map, time_t a
+ 	map->lookup = lookup;
+ 	master_source_unlock(ap->entry);
+ 
+-	/* If we don't need to create directories then there's no use
+-	 * reading the map. We just need to test that the map is valid
+-	 * for the fail cases to function correctly and to cache the
+-	 * lookup handle.
+-	 *
+-	 * We always need to read the whole map for direct mounts in
+-	 * order to mount the triggers. We also want to read the whole
+-	 * map if it's a file map to avoid potentially lengthy linear
+-	 * file scanning.
+-	 */
+-	if (strcmp(map->type, "file") &&
+-	    !(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+-		return NSS_STATUS_SUCCESS;
+-
+ 	if (!map->stale)
+ 		return NSS_STATUS_SUCCESS;
+ 
+diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
+index d3ae0e2..a213780 100644
+--- a/modules/lookup_hosts.c
++++ b/modules/lookup_hosts.c
+@@ -89,6 +89,14 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
+ 	ap->entry->current = NULL;
+ 	master_source_current_signal(ap->entry);
+ 
++	/*
++	 * If we don't need to create directories then there's no use
++	 * reading the map. We always need to read the whole map for
++	 * direct mounts in order to mount the triggers.
++	 */
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list