diff --git a/SOURCES/autofs-5.1.3-document-ghost-option-in-auto_master-man-page.patch b/SOURCES/autofs-5.1.3-document-ghost-option-in-auto_master-man-page.patch
new file mode 100644
index 0000000..f609885
--- /dev/null
+++ b/SOURCES/autofs-5.1.3-document-ghost-option-in-auto_master-man-page.patch
@@ -0,0 +1,38 @@
+autofs-5.1.3 - document ghost option in auto.master man page
+
+From: Ian Kent <raven@themaw.net>
+
+The --ghost pseudo option has been depricated for quite a while now
+in favour of the browse option as descibed in auto.master(5).
+
+However it isn't noted in the description of the browse option that
+the --ghost option is the same as the browse option.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG            |    1 +
+ man/auto.master.5.in |    3 ++-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -322,6 +322,7 @@
+ - add mount_verbose configuration option.
+ - optionally log mount requestor process info.
+ - log mount call arguments if mount_verbose is set.
++- document ghost option in auto.master man page.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/man/auto.master.5.in
++++ autofs-5.0.7/man/auto.master.5.in
+@@ -176,7 +176,8 @@ can cause performance problem if the ind
+ be used with caution. The internal program default is to enable browse
+ mode for indirect mounts but the default installed configuration overrides
+ this by setting BROWSE_MODE to "no" because of the potential performance
+-problem.
++problem. This option does the same as the depricated --ghost option, the
++browse option is preferred because it is used by other autofs implementations.
+ .TP
+ .I "nobind"
+ This is an autofs specific option that is a pseudo mount option and
diff --git a/SOURCES/autofs-5.1.3-workaround-getaddrinfo-ai_canonname-bug.patch b/SOURCES/autofs-5.1.3-workaround-getaddrinfo-ai_canonname-bug.patch
new file mode 100644
index 0000000..ec3d0c6
--- /dev/null
+++ b/SOURCES/autofs-5.1.3-workaround-getaddrinfo-ai_canonname-bug.patch
@@ -0,0 +1,82 @@
+autofs-5.1.3 - workaround getaddrinfo(3) ai_canonname bug
+
+From: Ian Kent <raven@themaw.net>
+
+There appears to be a bug in some versions of getaddrinfo() where the
+addrinfo structure gets garbage in ai_canonname when it is not requested
+by the lookup flags causing a crash or lookup fail.
+
+Try and work around this by always requesting ai_canonname for lookups
+and hope this doesn't affect the semantics of the autofs lookup usage.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG            |    1 +
+ lib/parse_subs.c     |    1 +
+ lib/rpc_subs.c       |    2 +-
+ modules/parse_amd.c  |    2 +-
+ modules/replicated.c |    4 ++--
+ 5 files changed, 6 insertions(+), 4 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -324,6 +324,7 @@
+ - log mount call arguments if mount_verbose is set.
+ - document ghost option in auto.master man page.
+ - make expire remaining log level debug.
++- workaround getaddrinfo(3) ai_canonname bug
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/lib/parse_subs.c
++++ autofs-5.0.7/lib/parse_subs.c
+@@ -472,6 +472,7 @@ unsigned int get_network_proximity(const
+ 	memset(&hints, 0, sizeof(struct addrinfo));
+ 	hints.ai_family = AF_UNSPEC;
+ 	hints.ai_socktype = SOCK_DGRAM;
++	hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME;
+ 
+ 	ret = getaddrinfo(name_or_num, NULL, &hints, &ni);
+ 	if (ret) {
+--- autofs-5.0.7.orig/lib/rpc_subs.c
++++ autofs-5.0.7/lib/rpc_subs.c
+@@ -692,7 +692,7 @@ static int create_client(struct conn_inf
+ 	}
+ 
+ 	memset(&hints, 0, sizeof(hints));
+-	hints.ai_flags = AI_ADDRCONFIG;
++	hints.ai_flags = AI_ADDRCONFIG | AI_CANONNAME;
+ 	hints.ai_family = AF_UNSPEC;
+ 	if (info->proto == IPPROTO_UDP)
+ 		hints.ai_socktype = SOCK_DGRAM;
+--- autofs-5.0.7.orig/modules/parse_amd.c
++++ autofs-5.0.7/modules/parse_amd.c
+@@ -264,7 +264,7 @@ static int match_my_name(unsigned int lo
+ 		goto out;
+ 	}
+ 
+-	hints.ai_flags = 0;
++	hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME;
+ 
+ 	/* Resolve comparison name to its names and compare */
+ 	ret = getaddrinfo(name, NULL, &hints, &ni);
+--- autofs-5.0.7.orig/modules/replicated.c
++++ autofs-5.0.7/modules/replicated.c
+@@ -919,7 +919,7 @@ static int add_host_addrs(struct host **
+ 	}
+ 
+ 	memset(&hints, 0, sizeof(hints));
+-	hints.ai_flags = AI_NUMERICHOST;
++	hints.ai_flags = AI_NUMERICHOST | AI_CANONNAME;
+ 	hints.ai_family = AF_UNSPEC;
+ 	hints.ai_socktype = SOCK_DGRAM;
+ 
+@@ -939,7 +939,7 @@ static int add_host_addrs(struct host **
+ 
+ try_name:
+ 	memset(&hints, 0, sizeof(hints));
+-	hints.ai_flags = AI_ADDRCONFIG;
++	hints.ai_flags = AI_ADDRCONFIG | AI_CANONNAME;
+ 	hints.ai_family = AF_UNSPEC;
+ 	hints.ai_socktype = SOCK_DGRAM;
+ 
diff --git a/SOURCES/autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch b/SOURCES/autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch
new file mode 100644
index 0000000..ee0bd42
--- /dev/null
+++ b/SOURCES/autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch
@@ -0,0 +1,34 @@
+autofs-5.1.4 - add NULL check in prepare_attempt_prefix()
+
+From: Ian Kent <raven@themaw.net>
+
+prepare_attempt_prefix() calls calloc(3) and continues without
+checking if the allocation succeeded.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG |    1 +
+ lib/log.c |    2 ++
+ 2 files changed, 3 insertions(+)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -311,6 +311,7 @@
+ - add master map pseudo options for mount propagation.
+ - fix amd parser opts option handling.
+ - fix incorrect locking in sss lookup.
++- add NULL check in prepare_attempt_prefix().
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/lib/log.c
++++ autofs-5.0.7/lib/log.c
+@@ -44,6 +44,8 @@ static char *prepare_attempt_prefix(cons
+ 
+ 		snprintf(buffer, ATTEMPT_ID_SIZE, "%02lx", *attempt_id);
+ 		prefixed_msg = (char *) calloc(len, sizeof(char));
++		if (!prefixed_msg)
++			return NULL;
+ 		strcpy(prefixed_msg, buffer);
+ 		strcat(prefixed_msg, "|");
+ 		strcat(prefixed_msg, msg);
diff --git a/SOURCES/autofs-5.1.4-add-systemd-service-command-line-option.patch b/SOURCES/autofs-5.1.4-add-systemd-service-command-line-option.patch
new file mode 100644
index 0000000..51e6074
--- /dev/null
+++ b/SOURCES/autofs-5.1.4-add-systemd-service-command-line-option.patch
@@ -0,0 +1,137 @@
+autofs-5.1.4 - add systemd service command line option
+
+From: Ian Kent <raven@themaw.net>
+
+When run as a systemd service using the systemd notification method to
+synchronise startup, logging should be done to syslog so the log entry
+format is consistent between daemon and systemd usage.
+
+So, rather than run use the forground option, add an option to tell
+the automounter it's being run as a systemd service and use syslog
+for logging when its present on the command line.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG                 |    1 +
+ daemon/automount.c        |   22 +++++++++++++++++++---
+ include/automount.h       |    1 +
+ man/automount.8           |    4 ++++
+ samples/autofs.service.in |    2 +-
+ 5 files changed, 26 insertions(+), 4 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -315,6 +315,7 @@
+ - update build info with systemd.
+ - use flags for startup boolean options.
+ - move close stdio descriptors to become_daemon().
++- add systemd service command line option.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/daemon/automount.c
++++ autofs-5.0.7/daemon/automount.c
+@@ -1212,13 +1212,21 @@ static void become_daemon(unsigned int f
+ 	}
+ 
+ 	/* Detach from foreground process */
+-	if (flags & DAEMON_FLAGS_FOREGROUND) {
++	if (flags & DAEMON_FLAGS_FOREGROUND &&
++	   !(flags & DAEMON_FLAGS_SYSTEMD_SERVICE)) {
+ 		if ((flags & DAEMON_FLAGS_CHECK_DAEMON) && !aquire_flag_file()) {
+ 			fprintf(stderr, "%s: program is already running.\n",
+ 				program);
+ 			exit(1);
+ 		}
+ 		log_to_stderr();
++	} else if (flags & DAEMON_FLAGS_SYSTEMD_SERVICE) {
++		if ((flags & DAEMON_FLAGS_CHECK_DAEMON) && !aquire_flag_file()) {
++			fprintf(stderr, "%s: program is already running.\n",
++				program);
++			exit(1);
++		}
++		open_log();
+ 	} else {
+ 		int nullfd;
+ 
+@@ -1923,6 +1931,8 @@ static void usage(void)
+ 		"	-v --verbose	be verbose\n"
+ 		"	-d --debug	log debuging info\n"
+ 		"	-D --define	define global macro variable\n"
++		"	-S --systemd-service\n"
++		"			run automounter as a systemd service\n"
+ 		"	-f --foreground do not fork into background\n"
+ 		"	-r --random-multimount-selection\n"
+ 		"			use ramdom replicated server selection\n"
+@@ -2191,7 +2201,7 @@ int main(int argc, char *argv[])
+ 	time_t timeout;
+ 	time_t age = time(NULL);
+ 	struct rlimit rlim;
+-	const char *options = "+hp:t:vmdD:fVrO:l:n:CFM";
++	const char *options = "+hp:t:vmdD:SfVrO:l:n:CFM";
+ 	static const struct option long_options[] = {
+ 		{"help", 0, 0, 'h'},
+ 		{"pid-file", 1, 0, 'p'},
+@@ -2199,6 +2209,7 @@ int main(int argc, char *argv[])
+ 		{"verbose", 0, 0, 'v'},
+ 		{"debug", 0, 0, 'd'},
+ 		{"define", 1, 0, 'D'},
++		{"systemd-service", 0, 0, 'S'},
+ 		{"foreground", 0, 0, 'f'},
+ 		{"random-multimount-selection", 0, 0, 'r'},
+ 		{"negative-timeout", 1, 0, 'n'},
+@@ -2267,6 +2278,10 @@ int main(int argc, char *argv[])
+ 			macro_parse_globalvar(optarg);
+ 			break;
+ 
++		case 'S':
++			flags |= DAEMON_FLAGS_SYSTEMD_SERVICE;
++			break;
++
+ 		case 'f':
+ 			flags |= DAEMON_FLAGS_FOREGROUND;
+ 			break;
+@@ -2660,7 +2675,8 @@ int main(int argc, char *argv[])
+ 	}
+ 
+ #ifdef WITH_SYSTEMD
+-	sd_notify(1, "READY=1");
++	if (flags & DAEMON_FLAGS_SYSTEMD_SERVICE)
++		sd_notify(1, "READY=1");
+ #endif
+ 
+ 	state_mach_thid = pthread_self();
+--- autofs-5.0.7.orig/include/automount.h
++++ autofs-5.0.7/include/automount.h
+@@ -74,6 +74,7 @@ int load_autofs4_module(void);
+ #endif
+ 
+ #define DAEMON_FLAGS_FOREGROUND			0x0001
++#define DAEMON_FLAGS_SYSTEMD_SERVICE		0x0002
+ #define DAEMON_FLAGS_HAVE_GLOBAL_OPTIONS	0x0004
+ #define DAEMON_FLAGS_GHOST			0x0008
+ #define DAEMON_FLAGS_CHECK_DAEMON		0x0010
+--- autofs-5.0.7.orig/man/automount.8
++++ autofs-5.0.7/man/automount.8
+@@ -57,6 +57,10 @@ Define a global macro substitution varia
+ are over-ridden macro definitions of the same name specified in
+ mount entries.
+ .TP
++.I \-S, \-\-systemd-service
++Used when running the automounter as a systemd service to ensure log entry
++format is consistent with the log entry format when running as a daemon.
++.TP
+ .I "\-f, \-\-foreground"
+ Run the daemon in the foreground and log to stderr instead of syslog."
+ .TP
+--- autofs-5.0.7.orig/samples/autofs.service.in
++++ autofs-5.0.7/samples/autofs.service.in
+@@ -6,7 +6,7 @@ Wants=network-online.target rpc-statd.se
+ [Service]
+ Type=notify
+ EnvironmentFile=-@@autofsconfdir@@/autofs
+-ExecStart=@@sbindir@@/automount $OPTIONS --foreground --dont-check-daemon
++ExecStart=@@sbindir@@/automount $OPTIONS --systemd-service --dont-check-daemon
+ ExecReload=/usr/bin/kill -HUP $MAINPID
+ KillMode=process
+ TimeoutSec=180
diff --git a/SOURCES/autofs-5.1.4-improve-hostname-lookup-error-logging.patch b/SOURCES/autofs-5.1.4-improve-hostname-lookup-error-logging.patch
new file mode 100644
index 0000000..5edd1ea
--- /dev/null
+++ b/SOURCES/autofs-5.1.4-improve-hostname-lookup-error-logging.patch
@@ -0,0 +1,111 @@
+autofs-5.1.4 - improve hostname lookup error logging
+
+From: Ian Kent <raven@themaw.net>
+
+There's not enough information in name lookup log messages
+to determine if the failed lookup is in fact a problem or
+is expected.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG            |    1 +
+ lib/parse_subs.c     |    3 ++-
+ lib/rpc_subs.c       |    3 ++-
+ modules/dclist.c     |    4 +++-
+ modules/parse_amd.c  |    9 ++++++---
+ modules/replicated.c |    5 +++--
+ 6 files changed, 17 insertions(+), 8 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -325,6 +325,7 @@
+ - document ghost option in auto.master man page.
+ - make expire remaining log level debug.
+ - workaround getaddrinfo(3) ai_canonname bug
++- improve hostname lookup error logging.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/lib/parse_subs.c
++++ autofs-5.0.7/lib/parse_subs.c
+@@ -476,7 +476,8 @@ unsigned int get_network_proximity(const
+ 
+ 	ret = getaddrinfo(name_or_num, NULL, &hints, &ni);
+ 	if (ret) {
+-		logerr("getaddrinfo: %s", gai_strerror(ret));
++		logerr("hostname lookup for %s failed: %s",
++		       name_or_num, gai_strerror(ret));
+ 		return PROXIMITY_ERROR;
+ 	}
+ 
+--- autofs-5.0.7.orig/lib/rpc_subs.c
++++ autofs-5.0.7/lib/rpc_subs.c
+@@ -702,7 +702,8 @@ static int create_client(struct conn_inf
+ 	ret = getaddrinfo(info->host, NULL, &hints, &ai);
+ 	if (ret) {
+ 		error(LOGOPT_ANY,
+-		      "hostname lookup failed: %s", gai_strerror(ret));
++		      "hostname lookup for %s failed: %s",
++		      info->host, gai_strerror(ret));
+ 		goto out_close;
+ 	}
+ 
+--- autofs-5.0.7.orig/modules/dclist.c
++++ autofs-5.0.7/modules/dclist.c
+@@ -357,7 +357,9 @@ static char *getdnsdomainname(unsigned i
+ 
+ 	ret = getaddrinfo(name, NULL, &hints, &ni);
+ 	if (ret) {
+-		error(logopt, "hostname lookup failed: %s", gai_strerror(ret));
++		error(logopt,
++		      "hostname lookup for %s failed: %s",
++		      name, gai_strerror(ret));
+ 		return NULL;
+ 	}
+ 
+--- autofs-5.0.7.orig/modules/parse_amd.c
++++ autofs-5.0.7/modules/parse_amd.c
+@@ -260,7 +260,8 @@ static int match_my_name(unsigned int lo
+ 	ret = getaddrinfo(v->val, NULL, &hints, &cni);
+ 	if (ret) {
+ 		error(logopt, MODPREFIX
+-		      "hostname lookup failed: %s\n", gai_strerror(ret));
++		      "hostname lookup for %s failed: %s\n",
++		      v->val, gai_strerror(ret));
+ 		goto out;
+ 	}
+ 
+@@ -270,7 +271,8 @@ static int match_my_name(unsigned int lo
+ 	ret = getaddrinfo(name, NULL, &hints, &ni);
+ 	if (ret) {
+ 		error(logopt, MODPREFIX
+-		      "hostname lookup failed: %s\n", gai_strerror(ret));
++		      "hostname lookup for %s failed: %s\n",
++		      name, gai_strerror(ret));
+ 		freeaddrinfo(cni);
+ 		goto out;
+ 	}
+@@ -680,7 +682,8 @@ static char *normalize_hostname(unsigned
+ 		ret = getaddrinfo(host, NULL, &hints, &ni);
+ 		if (ret) {
+ 			error(logopt, MODPREFIX
+-			      "hostname lookup failed: %s", gai_strerror(ret));
++			      "hostname lookup for %s failed: %s",
++			      host, gai_strerror(ret));
+ 			return NULL;
+ 		}
+ 		name = strdup(ni->ai_canonname);
+--- autofs-5.0.7.orig/modules/replicated.c
++++ autofs-5.0.7/modules/replicated.c
+@@ -945,8 +945,9 @@ try_name:
+ 
+ 	ret = getaddrinfo(name, NULL, &hints, &ni);
+ 	if (ret) {
+-		error(LOGOPT_ANY, "hostname lookup failed: %s",
+-		      gai_strerror(ret));
++		error(LOGOPT_ANY,
++		      "hostname lookup for %s failed: %s",
++		      name, gai_strerror(ret));
+ 		free(name);
+ 		return 0;
+ 	}
diff --git a/SOURCES/autofs-5.1.4-move-close-stdio-descriptors-to-become_daemon.patch b/SOURCES/autofs-5.1.4-move-close-stdio-descriptors-to-become_daemon.patch
new file mode 100644
index 0000000..8163e60
--- /dev/null
+++ b/SOURCES/autofs-5.1.4-move-close-stdio-descriptors-to-become_daemon.patch
@@ -0,0 +1,118 @@
+autofs-5.1.4 - move close stdio descriptors to become_daemon()
+
+From: Ian Kent <raven@themaw.net>
+
+Move the stdio file descriptor close to the become_daemon() function
+as closing these file descriptors, ie. detaching from ttys, is part
+of the preperation for becoming a system daemon.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG          |    1 +
+ daemon/automount.c |   27 ++++++++++++++++++++++++++-
+ include/log.h      |    1 -
+ lib/log.c          |   30 ------------------------------
+ 4 files changed, 27 insertions(+), 32 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -314,6 +314,7 @@
+ - add NULL check in prepare_attempt_prefix().
+ - update build info with systemd.
+ - use flags for startup boolean options.
++- move close stdio descriptors to become_daemon().
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/daemon/automount.c
++++ autofs-5.0.7/daemon/automount.c
+@@ -1220,6 +1220,8 @@ static void become_daemon(unsigned int f
+ 		}
+ 		log_to_stderr();
+ 	} else {
++		int nullfd;
++
+ 		if (open_pipe(start_pipefd) < 0) {
+ 			fprintf(stderr, "%s: failed to create start_pipefd.\n",
+ 				program);
+@@ -1263,7 +1265,30 @@ static void become_daemon(unsigned int f
+ 			close(start_pipefd[1]);
+ 			exit(*pst_stat);
+ 		}
+-		log_to_syslog();
++
++		/* Redirect all our file descriptors to /dev/null */
++		nullfd = open("/dev/null", O_RDWR);
++		if (nullfd < 0) {
++			char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
++			fprintf(stderr, "cannot open /dev/null: %s", estr);
++			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
++			close(start_pipefd[1]);
++			exit(*pst_stat);
++		}
++
++		if (dup2(nullfd, STDIN_FILENO) < 0 ||
++		    dup2(nullfd, STDOUT_FILENO) < 0 ||
++		    dup2(nullfd, STDERR_FILENO) < 0) {
++			char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
++			fprintf(stderr,
++				"redirecting file descriptors failed: %s", estr);
++			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
++			close(start_pipefd[1]);
++			exit(*pst_stat);
++		}
++
++		open_log();
++		close(nullfd);
+ 	}
+ 
+ 	/* Write pid file if requested */
+--- autofs-5.0.7.orig/include/log.h
++++ autofs-5.0.7/include/log.h
+@@ -36,7 +36,6 @@ extern void set_log_debug_ap(struct auto
+ extern void set_mnt_logging(unsigned global_logopt);
+ 
+ extern void open_log(void);
+-extern void log_to_syslog(void);
+ extern void log_to_stderr(void);
+  
+ extern void log_info(unsigned int, const char* msg, ...);
+--- autofs-5.0.7.orig/lib/log.c
++++ autofs-5.0.7/lib/log.c
+@@ -314,36 +314,6 @@ void open_log(void)
+ 	return;
+ }
+ 
+-void log_to_syslog(void)
+-{
+-	char buf[MAX_ERR_BUF];
+-	int nullfd;
+-
+-	open_log();
+-
+-	/* Redirect all our file descriptors to /dev/null */
+-	nullfd = open("/dev/null", O_RDWR);
+-	if (nullfd < 0) {
+-		char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+-		fprintf(stderr, "cannot open /dev/null: %s", estr);
+-		exit(1);
+-	}
+-
+-	if (dup2(nullfd, STDIN_FILENO) < 0 ||
+-	    dup2(nullfd, STDOUT_FILENO) < 0 ||
+-	    dup2(nullfd, STDERR_FILENO) < 0) {
+-		char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+-		fprintf(stderr,
+-			"redirecting file descriptors failed: %s", estr);
+-		exit(1);
+-	}
+-
+-	if (nullfd > 2)
+-		close(nullfd);
+-
+-	return;
+-}
+-
+ void log_to_stderr(void)
+ {
+ 	if (syslog_open) {
diff --git a/SOURCES/autofs-5.1.4-update-build-info-with-systemd.patch b/SOURCES/autofs-5.1.4-update-build-info-with-systemd.patch
new file mode 100644
index 0000000..76e4fa5
--- /dev/null
+++ b/SOURCES/autofs-5.1.4-update-build-info-with-systemd.patch
@@ -0,0 +1,41 @@
+autofs-5.1.4 - update build info with systemd
+
+From: Ian Kent <raven@themaw.net>
+
+Update the show_build_info() function to include systemd
+build info.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG          |    1 +
+ daemon/automount.c |    9 +++++++++
+ 2 files changed, 10 insertions(+)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -312,6 +312,7 @@
+ - fix amd parser opts option handling.
+ - fix incorrect locking in sss lookup.
+ - add NULL check in prepare_attempt_prefix().
++- update build info with systemd.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/daemon/automount.c
++++ autofs-5.0.7/daemon/automount.c
+@@ -1952,6 +1952,15 @@ static void show_build_info(void)
+ 	}
+ #endif
+ 
++#ifdef WITH_SYSTEMD
++	printf("WITH_SYSTEMD ");
++	count = count + 13;
++
++	if (count > 60) {
++		printf("\n  ");
++		count = 0;
++	}
++#endif
+ 
+ #ifdef WITH_HESIOD
+ 	printf("WITH_HESIOD ");
diff --git a/SOURCES/autofs-5.1.4-use-flags-for-startup-boolean-options.patch b/SOURCES/autofs-5.1.4-use-flags-for-startup-boolean-options.patch
new file mode 100644
index 0000000..38ad839
--- /dev/null
+++ b/SOURCES/autofs-5.1.4-use-flags-for-startup-boolean-options.patch
@@ -0,0 +1,217 @@
+autofs-5.1.4 - use flags for startup boolean options
+
+From: Ian Kent <raven@themaw.net>
+
+The daemon uses a number of boolean flags each stored in unsigned int
+variables. But a single bit flag is sufficient storage for most of
+these flags.
+
+So use bit flags for these where possible.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG           |    1 +
+ daemon/automount.c  |   45 ++++++++++++++++++++++-----------------------
+ include/automount.h |    6 ++++++
+ lib/master.c        |    4 ++--
+ 4 files changed, 31 insertions(+), 25 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -313,6 +313,7 @@
+ - fix incorrect locking in sss lookup.
+ - add NULL check in prepare_attempt_prefix().
+ - update build info with systemd.
++- use flags for startup boolean options.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/daemon/automount.c
++++ autofs-5.0.7/daemon/automount.c
+@@ -1197,7 +1197,7 @@ static int handle_packet(struct autofs_p
+ 	return -1;
+ }
+ 
+-static void become_daemon(unsigned foreground, unsigned daemon_check)
++static void become_daemon(unsigned int flags)
+ {
+ 	FILE *pidfp;
+ 	char buf[MAX_ERR_BUF];
+@@ -1212,8 +1212,8 @@ static void become_daemon(unsigned foreg
+ 	}
+ 
+ 	/* Detach from foreground process */
+-	if (foreground) {
+-		if (daemon_check && !aquire_flag_file()) {
++	if (flags & DAEMON_FLAGS_FOREGROUND) {
++		if ((flags & DAEMON_FLAGS_CHECK_DAEMON) && !aquire_flag_file()) {
+ 			fprintf(stderr, "%s: program is already running.\n",
+ 				program);
+ 			exit(1);
+@@ -1240,7 +1240,7 @@ static void become_daemon(unsigned foreg
+ 		}
+ 		close(start_pipefd[0]);
+ 
+-		if (daemon_check && !aquire_flag_file()) {
++		if ((flags & DAEMON_FLAGS_CHECK_DAEMON) && !aquire_flag_file()) {
+ 			fprintf(stderr, "%s: program is already running.\n",
+ 				program);
+ 			/* Return success if already running */
+@@ -2159,8 +2159,8 @@ int main(int argc, char *argv[])
+ {
+ 	int res, opt, status;
+ 	int logpri = -1;
+-	unsigned ghost, logging, daemon_check;
+-	unsigned dumpmaps, foreground, have_global_options;
++	unsigned int flags;
++	unsigned int logging;
+ 	unsigned master_read;
+ 	int master_wait;
+ 	time_t timeout;
+@@ -2203,17 +2203,15 @@ int main(int argc, char *argv[])
+ 
+ 	nfs_mount_uses_string_options = check_nfs_mount_version(&vers, &check);
+ 
++	flags = defaults_get_browse_mode() ? DAEMON_FLAGS_GHOST : 0;
++	flags |= DAEMON_FLAGS_CHECK_DAEMON;
++
+ 	kpkt_len = get_kpkt_len();
+ 	master_wait = defaults_get_master_wait();
+ 	timeout = defaults_get_timeout();
+-	ghost = defaults_get_browse_mode();
+ 	logging = defaults_get_logging();
+ 	global_selection_options = 0;
+ 	global_options = NULL;
+-	have_global_options = 0;
+-	foreground = 0;
+-	dumpmaps = 0;
+-	daemon_check = 1;
+ 
+ 	remove_empty_args(argv, &argc);
+ 
+@@ -2245,7 +2243,7 @@ int main(int argc, char *argv[])
+ 			break;
+ 
+ 		case 'f':
+-			foreground = 1;
++			flags |= DAEMON_FLAGS_FOREGROUND;
+ 			break;
+ 
+ 		case 'V':
+@@ -2261,7 +2259,7 @@ int main(int argc, char *argv[])
+ 			break;
+ 
+ 		case 'm':
+-			dumpmaps = 1;
++			flags |= DAEMON_FLAGS_DUMP_MAPS;
+ 			break;
+ 
+ 		case 'M':
+@@ -2269,9 +2267,9 @@ int main(int argc, char *argv[])
+ 			break;
+ 
+ 		case 'O':
+-			if (!have_global_options) {
++			if (!(flags & DAEMON_FLAGS_HAVE_GLOBAL_OPTIONS)) {
+ 				global_options = strdup(optarg);
+-				have_global_options = 1;
++				flags |= DAEMON_FLAGS_HAVE_GLOBAL_OPTIONS;
+ 				break;
+ 			}
+ 			printf("%s: global options already specified.\n",
+@@ -2296,7 +2294,7 @@ int main(int argc, char *argv[])
+ 			break;
+ 
+ 		case 'C':
+-			daemon_check = 0;
++			flags &= ~DAEMON_FLAGS_CHECK_DAEMON;
+ 			break;
+ 
+ 		case 'F':
+@@ -2355,7 +2353,8 @@ int main(int argc, char *argv[])
+ #endif
+ 
+ 	/* Don't need the kernel module just to look at the configured maps */
+-	if (!dumpmaps && (!query_kproto_ver() || get_kver_major() < 5)) {
++	if (!(flags & DAEMON_FLAGS_DUMP_MAPS) &&
++	   (!query_kproto_ver() || get_kver_major() < 5)) {
+ 		fprintf(stderr,
+ 			"%s: test mount forbidden or "
+ 			"incorrect kernel protocol version, "
+@@ -2386,7 +2385,7 @@ int main(int argc, char *argv[])
+ 	/* Get processor information for predefined escapes */
+ 	macro_init();
+ 
+-	if (dumpmaps) {
++	if (flags & DAEMON_FLAGS_DUMP_MAPS) {
+ 		struct master_mapent *entry;
+ 		struct list_head *head, *p;
+ 		struct mapent_cache *nc;
+@@ -2404,9 +2403,9 @@ int main(int argc, char *argv[])
+ 		}
+ 
+ 		if (master)
+-			master_list = master_new(NULL, timeout, ghost);
++			master_list = master_new(NULL, timeout, flags);
+ 		else
+-			master_list = master_new(master, timeout, ghost);
++			master_list = master_new(master, timeout, flags);
+ 		if (!master_list) {
+ 			printf("%s: can't create master map", program);
+ 			macro_free_global_table();
+@@ -2452,9 +2451,9 @@ int main(int argc, char *argv[])
+ 	}
+ 
+ 	if (argc == 0)
+-		master_list = master_new(NULL, timeout, ghost);
++		master_list = master_new(NULL, timeout, flags);
+ 	else
+-		master_list = master_new(argv[0], timeout, ghost);
++		master_list = master_new(argv[0], timeout, flags);
+ 
+ 	if (!master_list) {
+ 		printf("%s: can't create master map %s", program, argv[0]);
+@@ -2462,7 +2461,7 @@ int main(int argc, char *argv[])
+ 		exit(1);
+ 	}
+ 
+-	become_daemon(foreground, daemon_check);
++	become_daemon(flags);
+ 
+ 	if (pthread_attr_init(&th_attr)) {
+ 		logerr("%s: failed to init thread attribute struct!",
+--- autofs-5.0.7.orig/include/automount.h
++++ autofs-5.0.7/include/automount.h
+@@ -73,6 +73,12 @@ int load_autofs4_module(void);
+ #define SLOPPY
+ #endif
+ 
++#define DAEMON_FLAGS_FOREGROUND			0x0001
++#define DAEMON_FLAGS_HAVE_GLOBAL_OPTIONS	0x0004
++#define DAEMON_FLAGS_GHOST			0x0008
++#define DAEMON_FLAGS_CHECK_DAEMON		0x0010
++#define DAEMON_FLAGS_DUMP_MAPS			0x0020
++
+ #define AUTOFS_SUPER_MAGIC 0x00000187L
+ #define SMB_SUPER_MAGIC    0x0000517BL
+ #define CIFS_MAGIC_NUMBER  0xFF534D42L
+--- autofs-5.0.7.orig/lib/master.c
++++ autofs-5.0.7/lib/master.c
+@@ -921,7 +921,7 @@ void master_free_mapent(struct master_ma
+ 	return;
+ }
+ 
+-struct master *master_new(const char *name, unsigned int timeout, unsigned int ghost)
++struct master *master_new(const char *name, unsigned int timeout, unsigned int flags)
+ {
+ 	struct master *master;
+ 	char *tmp;
+@@ -947,7 +947,7 @@ struct master *master_new(const char *na
+ 	master->depth = 0;
+ 	master->reading = 0;
+ 	master->read_fail = 0;
+-	master->default_ghost = ghost;
++	master->default_ghost = flags & DAEMON_FLAGS_GHOST;
+ 	master->default_timeout = timeout;
+ 	master->default_logging = defaults_get_logging();
+ 	master->logopt = master->default_logging;
diff --git a/SOURCES/autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch b/SOURCES/autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch
new file mode 100644
index 0000000..1525eb8
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch
@@ -0,0 +1,39 @@
+autofs-5.1.5 - add NULL check for get_addr_string() return
+
+From: Ian Kent <raven@themaw.net>
+
+When constructing the mount location string in mount_nfs.c:mount_mount()
+the return from get_addr_string() is not checked for NULL.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG           |    1 +
+ modules/mount_nfs.c |    6 ++++++
+ 2 files changed, 7 insertions(+)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -317,6 +317,7 @@
+ - move close stdio descriptors to become_daemon().
+ - add systemd service command line option.
+ - support strictexpire mount option.
++- add NULL check for get_addr_string() return.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/modules/mount_nfs.c
++++ autofs-5.0.7/modules/mount_nfs.c
+@@ -324,7 +324,13 @@ dont_probe:
+ 			socklen_t len = INET6_ADDRSTRLEN;
+ 			char n_buf[len + 1];
+ 			const char *n_addr;
++
+ 			n_addr = get_addr_string(this->addr, n_buf, len);
++			if (!n_addr) {
++				char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
++				error(ap->logopt, "get_addr_string: %s", estr);
++				goto forced_fail;
++			}
+ 			loc = malloc(strlen(n_addr) + strlen(this->path) + 4);
+ 			if (!loc) {
+ 				char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
diff --git a/SOURCES/autofs-5.1.5-add-mount_verbose-configuration-option.patch b/SOURCES/autofs-5.1.5-add-mount_verbose-configuration-option.patch
new file mode 100644
index 0000000..605fe3f
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-add-mount_verbose-configuration-option.patch
@@ -0,0 +1,174 @@
+autofs-5.1.5 - add mount_verbose configuration option
+
+From: Lars R. Damerow <lars@pixar.com>
+
+This option makes automount pass the -v flag to mount(8).
+
+Signed-off-by: Lars R.  Damerow <lars@pixar.com>
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG                      |    1 +
+ daemon/spawn.c                 |   20 ++++++++++++--------
+ include/defaults.h             |    2 ++
+ lib/defaults.c                 |   17 +++++++++++++++++
+ man/autofs.conf.5.in           |    4 ++++
+ redhat/autofs.conf.default.in  |    4 ++++
+ samples/autofs.conf.default.in |    4 ++++
+ 7 files changed, 44 insertions(+), 8 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -319,6 +319,7 @@
+ - support strictexpire mount option.
+ - add NULL check for get_addr_string() return.
+ - use malloc(3) in spawn.c.
++- add mount_verbose configuration option.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/daemon/spawn.c
++++ autofs-5.0.7/daemon/spawn.c
+@@ -537,12 +537,14 @@ int spawn_mount(unsigned logopt, ...)
+ 	char prog[] = PATH_MOUNT;
+ 	char arg0[] = PATH_MOUNT;
+ 	char argn[] = "-n";
++	char argvr[] = "-v";
+ 	/* In case we need to use the fake option to mount */
+ 	char arg_fake[] = "-f";
+ 	unsigned int options;
+ 	unsigned int retries = MTAB_LOCK_RETRIES;
+ 	int update_mtab = 1, ret, printed = 0;
+ 	unsigned int wait = defaults_get_mount_wait();
++	int verbose = defaults_get_mount_verbose();
+ 	char buf[PATH_MAX + 1];
+ 	unsigned int argv_len;
+ 
+@@ -569,8 +571,10 @@ int spawn_mount(unsigned logopt, ...)
+ 		}
+ 	}
+ 
+-	/* Alloc 1 extra slot in case we need to use the "-f" option */
+-	argv_len = sizeof(char *) * (argc + 2);
++	/* Alloc 2 extra slots in case we need to use the "-f" or "-v" options
++	 * plus the NULL slot for end of args.
++	 */
++	argv_len = sizeof(char *) * (argc + 3);
+ 	argv = malloc(argv_len);
+ 	if (!argv) {
+ 		char buf[MAX_ERR_BUF];
+@@ -583,12 +587,12 @@ int spawn_mount(unsigned logopt, ...)
+ 	argv[0] = arg0;
+ 
+ 	va_start(arg, logopt);
+-	if (update_mtab)
+-		p = argv + 1;
+-	else {
+-		argv[1] = argn;
+-		p = argv + 2;
+-	}
++	p = argv + 1;
++	if (!update_mtab)
++		*(p++) = argn;
++	if (verbose)
++		*(p++) = argvr;
++
+ 	while ((*p = va_arg(arg, char *))) {
+ 		if (options == SPAWN_OPT_OPEN && !strcmp(*p, "-t")) {
+ 			*(++p) = va_arg(arg, char *);
+--- autofs-5.0.7.orig/include/defaults.h
++++ autofs-5.0.7/include/defaults.h
+@@ -27,6 +27,7 @@
+ #define DEFAULT_TIMEOUT			"600"
+ #define DEFAULT_MASTER_WAIT		"10"
+ #define DEFAULT_NEGATIVE_TIMEOUT	"60"
++#define DEFAULT_MOUNT_VERBOSE		"0"
+ #define DEFAULT_MOUNT_WAIT		"-1"
+ #define DEFAULT_UMOUNT_WAIT		"12"
+ #define DEFAULT_BROWSE_MODE		"1"
+@@ -166,6 +167,7 @@ unsigned int defaults_get_ldap_timeout(v
+ unsigned int defaults_get_ldap_network_timeout(void);
+ unsigned int defaults_get_mount_nfs_default_proto(void);
+ unsigned int defaults_get_append_options(void);
++unsigned int defaults_get_mount_verbose(void);
+ unsigned int defaults_get_mount_wait(void);
+ unsigned int defaults_get_umount_wait(void);
+ const char *defaults_get_auth_conf_file(void);
+--- autofs-5.0.7.orig/lib/defaults.c
++++ autofs-5.0.7/lib/defaults.c
+@@ -67,6 +67,7 @@
+ 
+ #define NAME_MOUNT_NFS_DEFAULT_PROTOCOL	"mount_nfs_default_protocol"
+ #define NAME_APPEND_OPTIONS		"append_options"
++#define NAME_MOUNT_VERBOSE		"mount_verbose"
+ #define NAME_MOUNT_WAIT			"mount_wait"
+ #define NAME_UMOUNT_WAIT		"umount_wait"
+ #define NAME_AUTH_CONF_FILE		"auth_conf_file"
+@@ -327,6 +328,11 @@ static int conf_load_autofs_defaults(voi
+ 	if (ret == CFG_FAIL)
+ 		goto error;
+ 
++	ret = conf_update(sec, NAME_MOUNT_VERBOSE,
++			  DEFAULT_MOUNT_VERBOSE, CONF_ENV);
++	if (ret == CFG_FAIL)
++		goto error;
++
+ 	ret = conf_update(sec, NAME_MOUNT_WAIT,
+ 			  DEFAULT_MOUNT_WAIT, CONF_ENV);
+ 	if (ret == CFG_FAIL)
+@@ -1779,6 +1785,17 @@ unsigned int defaults_get_append_options
+ 
+ 	return res;
+ }
++
++unsigned int defaults_get_mount_verbose(void)
++{
++	long res;
++
++	res = conf_get_yesno(autofs_gbl_sec, NAME_MOUNT_VERBOSE);
++	if (res < 0)
++		res = atoi(DEFAULT_MOUNT_VERBOSE);
++
++	return res;
++}
+ 
+ unsigned int defaults_get_mount_wait(void)
+ {
+--- autofs-5.0.7.orig/man/autofs.conf.5.in
++++ autofs-5.0.7/man/autofs.conf.5.in
+@@ -41,6 +41,10 @@ Set the default timeout for caching fail
+ 60). If the equivalent command line option is given it will override this
+ setting.
+ .TP
++.B mount_verbose
++.br
++Use the verbose flag when spawning mount(8) (program default "no").
++.TP
+ .B mount_wait
+ .br
+ Set the default time to wait for a response from a spawned mount(8)
+--- autofs-5.0.7.orig/redhat/autofs.conf.default.in
++++ autofs-5.0.7/redhat/autofs.conf.default.in
+@@ -26,6 +26,10 @@ timeout = 300
+ #
+ #negative_timeout = 60
+ #
++# mount_verbose - use the -v flag when calling mount(8).
++#
++#mount_verbose = no
++#
+ # mount_wait - time to wait for a response from mount(8).
+ # 	       Setting this timeout can cause problems when
+ # 	       mount would otherwise wait for a server that
+--- autofs-5.0.7.orig/samples/autofs.conf.default.in
++++ autofs-5.0.7/samples/autofs.conf.default.in
+@@ -26,6 +26,10 @@ timeout = 300
+ #
+ #negative_timeout = 60
+ #
++# mount_verbose - use the -v flag when calling mount(8).
++#
++#mount_verbose = no
++#
+ # mount_wait - time to wait for a response from mount(8).
+ # 	       Setting this timeout can cause problems when
+ # 	       mount would otherwise wait for a server that
diff --git a/SOURCES/autofs-5.1.5-add-strictexpire-mount-option.patch b/SOURCES/autofs-5.1.5-add-strictexpire-mount-option.patch
new file mode 100644
index 0000000..8fe7586
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-add-strictexpire-mount-option.patch
@@ -0,0 +1,200 @@
+autofs-5.1.5 - support strictexpire mount option
+
+From: Ian Kent <raven@themaw.net>
+
+Kernel commit 092a53452b (("autofs: take more care to not update
+last_used on path walk") helped to (partially) resolve a problem
+where automounts were not expiring due to aggressive accesses from
+user space.
+
+This patch was later reverted because, for very large environments,
+it meant more mount requests from clients and when there are a lot
+of clients this caused a fairly significant increase in server load.
+
+But there is a need for both types of expire check, depending on use
+case, so a mount option to allow for strict update of last use of
+autofs dentrys has been added ito the autofs file system (which just
+means not updating the last use on path walk accesses).
+
+So add support for this master map mount entry option in the user
+space code.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG              |    1 +
+ daemon/direct.c        |   10 ++++++++++
+ daemon/indirect.c      |   10 ++++++++++
+ include/automount.h    |    3 +++
+ lib/master_parse.y     |    8 +++++++-
+ lib/master_tok.l       |    1 +
+ man/auto.master.5.in   |    8 ++++++++
+ modules/mount_autofs.c |    5 +++++
+ 8 files changed, 45 insertions(+), 1 deletion(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -316,6 +316,7 @@
+ - use flags for startup boolean options.
+ - move close stdio descriptors to become_daemon().
+ - add systemd service command line option.
++- support strictexpire mount option.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/daemon/direct.c
++++ autofs-5.0.7/daemon/direct.c
+@@ -420,6 +420,16 @@ int do_mount_autofs_direct(struct autofs
+ 		mp->options = make_options_string(ap->path, ap->kpipefd, str_direct);
+ 		if (!mp->options)
+ 			return 0;
++
++		if ((ap->flags & MOUNT_FLAG_STRICTEXPIRE) &&
++		    ((get_kver_major() == 5 && get_kver_minor() > 3) ||
++		     (get_kver_major() > 5))) {
++			char *tmp = realloc(mp->options, strlen(mp->options) + 12);
++			if (tmp) {
++				strcat(tmp, ",strictexpire");
++				mp->options = tmp;
++			}
++		}
+ 	}
+ 
+ 	/* In case the directory doesn't exist, try to mkdir it */
+--- autofs-5.0.7.orig/daemon/indirect.c
++++ autofs-5.0.7/daemon/indirect.c
+@@ -131,6 +131,16 @@ static int do_mount_autofs_indirect(stru
+ 		goto out_err;
+ 	}
+ 
++	if ((ap->flags & MOUNT_FLAG_STRICTEXPIRE) &&
++	    ((get_kver_major() == 5 && get_kver_minor() > 3) ||
++	     (get_kver_major() > 5))) {
++		char *tmp = realloc(options, strlen(options) + 12);
++		if (tmp) {
++			strcat(tmp, ",strictexpire");
++			options = tmp;
++		}
++	}
++
+ 	/* In case the directory doesn't exist, try to mkdir it */
+ 	if (mkdir_path(root, 0555) < 0) {
+ 		if (errno != EEXIST && errno != EROFS) {
+--- autofs-5.0.7.orig/include/automount.h
++++ autofs-5.0.7/include/automount.h
+@@ -538,6 +538,9 @@ struct kernel_mod_version {
+ #define MOUNT_FLAG_SLAVE		0x0100
+ #define MOUNT_FLAG_PRIVATE		0x0200
+ 
++/* Use strict expire semantics if requested and kernel supports it */
++#define MOUNT_FLAG_STRICTEXPIRE		0x0400
++
+ struct autofs_point {
+ 	pthread_t thid;
+ 	char *path;			/* Mount point name */
+--- autofs-5.0.7.orig/lib/master_parse.y
++++ autofs-5.0.7/lib/master_parse.y
+@@ -58,6 +58,7 @@ static char *format;
+ static long timeout;
+ static long negative_timeout;
+ static unsigned symlnk;
++static unsigned strictexpire;
+ static unsigned slave;
+ static unsigned private;
+ static unsigned nobind;
+@@ -104,7 +105,7 @@ static int master_fprintf(FILE *, char *
+ %token MAP
+ %token OPT_TIMEOUT OPT_NTIMEOUT OPT_NOBIND OPT_NOGHOST OPT_GHOST OPT_VERBOSE
+ %token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT OPT_SYMLINK
+-%token OPT_SLAVE OPT_PRIVATE
++%token OPT_STRICTEXPIRE OPT_SLAVE OPT_PRIVATE
+ %token COLON COMMA NL DDASH
+ %type <strtype> map
+ %type <strtype> options
+@@ -191,6 +192,7 @@ line:
+ 	| PATH OPT_DEBUG { master_notify($1); YYABORT; }
+ 	| PATH OPT_TIMEOUT { master_notify($1); YYABORT; }
+ 	| PATH OPT_SYMLINK { master_notify($1); YYABORT; }
++	| PATH OPT_STRICTEXPIRE { master_notify($1); YYABORT; }
+ 	| PATH OPT_SLAVE { master_notify($1); YYABORT; }
+ 	| PATH OPT_PRIVATE { master_notify($1); YYABORT; }
+ 	| PATH OPT_NOBIND { master_notify($1); YYABORT; }
+@@ -574,6 +576,7 @@ option: daemon_option
+ daemon_option: OPT_TIMEOUT NUMBER { timeout = $2; }
+ 	| OPT_NTIMEOUT NUMBER { negative_timeout = $2; }
+ 	| OPT_SYMLINK	{ symlnk = 1; }
++	| OPT_STRICTEXPIRE { strictexpire = 1; }
+ 	| OPT_SLAVE	{ slave = 1; }
+ 	| OPT_PRIVATE	{ private = 1; }
+ 	| OPT_NOBIND	{ nobind = 1; }
+@@ -647,6 +650,7 @@ static void local_init_vars(void)
+ 	timeout = -1;
+ 	negative_timeout = 0;
+ 	symlnk = 0;
++	strictexpire = 0;
+ 	slave = 0;
+ 	private = 0;
+ 	nobind = 0;
+@@ -854,6 +858,8 @@ int master_parse_entry(const char *buffe
+ 		entry->ap->flags |= MOUNT_FLAG_USE_WEIGHT_ONLY;
+ 	if (symlnk)
+ 		entry->ap->flags |= MOUNT_FLAG_SYMLINK;
++	if (strictexpire)
++		entry->ap->flags |= MOUNT_FLAG_STRICTEXPIRE;
+ 	if (slave)
+ 		entry->ap->flags |= MOUNT_FLAG_SLAVE;
+ 	if (private)
+--- autofs-5.0.7.orig/lib/master_tok.l
++++ autofs-5.0.7/lib/master_tok.l
+@@ -388,6 +388,7 @@ OPTNTOUT	(-n{OPTWS}|-n{OPTWS}={OPTWS}|--
+ 	-?nobrowse		{ return(OPT_NOGHOST); }
+ 	-?slave			{ return(OPT_SLAVE); }
+ 	-?private		{ return(OPT_PRIVATE); }
++	-?strictexpire		{ return(OPT_STRICTEXPIRE); }
+ 	-g|--ghost|-?browse	{ return(OPT_GHOST); }
+ 	-v|--verbose		{ return(OPT_VERBOSE); }
+ 	-d|--debug		{ return(OPT_DEBUG); }
+--- autofs-5.0.7.orig/man/auto.master.5.in
++++ autofs-5.0.7/man/auto.master.5.in
+@@ -198,6 +198,14 @@ entries only, either in the master map (
+ or with individual map entries. The option is ignored for direct mounts
+ and non-root offest mount entries.
+ .TP
++.I "strictexpire"
++Use a strict expire policy for this automount. Using this option means
++that last use of autofs directory entries will not be updated during
++path walks so that mounts in an automount won't be kept mounted by
++applications scanning the mount tree. Note that this doesn't completely
++resolve the problem of expired automounts being immediately re-mounted
++due to application accesses triggered by the expire itself.
++.TP
+ .I slave \fPor\fI private
+ This option allows mount propagation of bind mounts to be set to
+ either \fIslave\fP or \fIprivate\fP. This option may be needed when using
+--- autofs-5.0.7.orig/modules/mount_autofs.c
++++ autofs-5.0.7/modules/mount_autofs.c
+@@ -57,6 +57,7 @@ int mount_mount(struct autofs_point *ap,
+ 	int nobind = ap->flags & MOUNT_FLAG_NOBIND;
+ 	int ghost = ap->flags & MOUNT_FLAG_GHOST;
+ 	int symlnk = ap->flags & MOUNT_FLAG_SYMLINK;
++	int strictexpire = ap->flags & MOUNT_FLAG_STRICTEXPIRE;
+ 	time_t timeout = get_exp_timeout(ap, ap->entry->maps);
+ 	unsigned logopt = ap->logopt;
+ 	struct map_type_info *info;
+@@ -131,6 +132,8 @@ int mount_mount(struct autofs_point *ap,
+ 				ghost = 1;
+ 			else if (_strncmp("symlink", cp, 7) == 0)
+ 				symlnk = 1;
++			else if (_strncmp("strictexpire", cp, 12) == 0)
++				strictexpire = 1;
+ 			else if (_strncmp("hosts", cp, 5) == 0)
+ 				hosts = 1;
+ 			else if (_strncmp("timeout=", cp, 8) == 0) {
+@@ -173,6 +176,8 @@ int mount_mount(struct autofs_point *ap,
+ 	nap->parent = ap;
+ 	if (symlnk)
+ 		nap->flags |= MOUNT_FLAG_SYMLINK;
++	if (strictexpire)
++		nap->flags |= MOUNT_FLAG_STRICTEXPIRE;
+ 
+ 	if (hosts)
+ 		argc = 0;
diff --git a/SOURCES/autofs-5.1.5-allow-period-following-macro-in-selector-value.patch b/SOURCES/autofs-5.1.5-allow-period-following-macro-in-selector-value.patch
new file mode 100644
index 0000000..b0adfad
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-allow-period-following-macro-in-selector-value.patch
@@ -0,0 +1,34 @@
+autofs-5.1.5 - allow period following macro in selector value
+
+From: Ian Kent <raven@themaw.net>
+
+If a ${} macro is used in a selector (such as hostd) the parser doesn't
+permit a period to follow it (such as when the value is a host name).
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG         |    1 +
+ modules/amd_tok.l |    2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -326,6 +326,7 @@
+ - make expire remaining log level debug.
+ - workaround getaddrinfo(3) ai_canonname bug
+ - improve hostname lookup error logging.
++- allow period following macro in selector value.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/modules/amd_tok.l
++++ autofs-5.0.7/modules/amd_tok.l
+@@ -95,7 +95,7 @@ V6MASK		(12[0-8]|1[0-1][0-9]|[1-9][0-9]|
+ 
+ FOPT		(({QSTR}|{FSTR}|{MACRO})+)
+ OPTS		({OSTR}(=({VSTR}|{MACRO})+)?)
+-SOPT		(({SSTR}|{QSTR}|{MACRO})+)
++SOPT		({SSTR}|{QSTR}|{MACRO}(\.|{SSTR}|{QSTR}|{MACRO})+)
+ NOPT		({SSTR}|(({IP4ADDR}(\/{V4MASK})?)|({IP6ADDR}(\/{V6MASK})?)))
+ 
+ MAPOPT		(fs|type|maptype|pref|sublink|cache)
diff --git a/SOURCES/autofs-5.1.5-fix-macro-expansion-in-selector-values.patch b/SOURCES/autofs-5.1.5-fix-macro-expansion-in-selector-values.patch
new file mode 100644
index 0000000..0abe03a
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-fix-macro-expansion-in-selector-values.patch
@@ -0,0 +1,419 @@
+autofs-5.1.5 - fix macro expansion in selector values
+
+From: Ian Kent <raven@themaw.net>
+
+Macro expansion is not done in selector values before use, for example
+in "hostd==${/key}.<donain>.<name>" the ${/key} is not expanded before
+use leading to an attempt to use an invalid host name.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG           |    1 
+ modules/parse_amd.c |  286 ++++++++++++++++++++++++++++++++++------------------
+ 2 files changed, 193 insertions(+), 94 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -327,6 +327,7 @@
+ - workaround getaddrinfo(3) ai_canonname bug
+ - improve hostname lookup error logging.
+ - allow period following macro in selector value.
++- fix macro expansion in selector values.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/modules/parse_amd.c
++++ autofs-5.0.7/modules/parse_amd.c
+@@ -231,17 +231,29 @@ static struct substvar *add_lookup_vars(
+ 	return list;
+ }
+ 
+-static int match_my_name(unsigned int logopt, const char *name, struct substvar *sv)
++static int match_my_name(struct autofs_point *ap, const char *name, struct substvar *sv)
+ {
+ 	struct addrinfo hints, *cni, *ni, *haddr;
+ 	char host[NI_MAXHOST + 1], numeric[NI_MAXHOST + 1];
++	unsigned int logopt = ap->logopt;
+ 	const struct substvar *v;
++	char *exp_name = NULL;
+ 	int rv = 0, ret;
+ 
++	if (!expand_selectors(ap, name, &exp_name, sv))
++		exp_name = strdup(name);
++	if (!exp_name) {
++		error(logopt,
++		      MODPREFIX "error: failed to alloc space for name");
++		goto out;
++	}
++
+ 	v = macro_findvar(sv, "host", 4);
+ 	if (v) {
+-		if (!strcmp(v->val, name))
+-			return 1;
++		if (!strcmp(v->val, exp_name)) {
++			rv = 1;
++			goto out;
++		}
+ 	}
+ 
+ 	if (!v || !v->val) {
+@@ -268,11 +280,11 @@ static int match_my_name(unsigned int lo
+ 	hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME;
+ 
+ 	/* Resolve comparison name to its names and compare */
+-	ret = getaddrinfo(name, NULL, &hints, &ni);
++	ret = getaddrinfo(exp_name, NULL, &hints, &ni);
+ 	if (ret) {
+ 		error(logopt, MODPREFIX
+ 		      "hostname lookup for %s failed: %s\n",
+-		      name, gai_strerror(ret));
++		      exp_name, gai_strerror(ret));
+ 		freeaddrinfo(cni);
+ 		goto out;
+ 	}
+@@ -312,18 +324,180 @@ next:
+ 	freeaddrinfo(ni);
+ 	freeaddrinfo(cni);
+ out:
++	if (exp_name)
++		free(exp_name);
+ 	return rv;
+ }
+ 
+-static int eval_selector(unsigned int logopt,
++static int sel_strcmp(struct autofs_point *ap,
++		      const struct substvar *v, struct selector *s,
++		      struct substvar *sv)
++{
++	char *expand = NULL;
++	int ret = 0;
++	int res;
++
++	res = expand_selectors(ap, s->comp.value, &expand, sv);
++	if (res)
++		res = strcmp(v->val, expand);
++	else
++		res = strcmp(v->val, s->comp.value);
++
++	if (s->compare & SEL_COMP_EQUAL && !res) {
++		debug(ap->logopt, MODPREFIX
++		      "matched selector %s(%s) == %s",
++		      v->def, v->val, expand ? expand : s->comp.value);
++		ret = 1;
++	} else if (s->compare & SEL_COMP_NOTEQUAL && res) {
++		debug(ap->logopt, MODPREFIX
++		      "matched selector %s(%s) != %s",
++		      v->def, v->val, expand ? expand : s->comp.value);
++		ret = 1;
++	} else
++		debug(ap->logopt, MODPREFIX
++		      "did not match selector %s(%s) %s %s",
++		      v->def, v->val,
++		      (s->compare & SEL_COMP_EQUAL ? "==" : "!="),
++		      expand ? expand : s->comp.value);
++
++	if (expand)
++		free(expand);
++
++	return ret;
++}
++
++static int sel_lstat(struct autofs_point *ap,
++		     struct selector *s, struct substvar *sv)
++{
++	struct stat st;
++	char *expand = NULL;
++	int res, ret;
++
++	/* Sould be OK to fail on any error here */
++	res = expand_selectors(ap, s->func.arg1, &expand, sv);
++	if (res)
++		ret = !lstat(expand, &st);
++	else
++		ret = !lstat(s->func.arg1, &st);
++
++	if (s->compare == SEL_COMP_NOT)
++		ret = !ret;
++	if (ret)
++		debug(ap->logopt, MODPREFIX
++		      "matched selector %s(%s)",
++		      s->sel->name, expand ? expand : s->func.arg1);
++	else
++		debug(ap->logopt, MODPREFIX
++		      "did not match selector %s(%s)",
++		      s->sel->name, expand ? expand : s->func.arg1);
++	if (expand)
++		free(expand);
++
++	return ret;
++}
++
++static int sel_in_network(struct autofs_point *ap,
++			  struct selector *s, struct substvar *sv)
++{
++	char *expand = NULL;
++	int res, ret;
++
++	res = expand_selectors(ap, s->func.arg1, &expand, sv);
++	if (!res)
++		ret = in_network(s->func.arg1);
++	else
++		ret = in_network(expand);
++
++	if (s->compare == SEL_COMP_NOT)
++		ret = !ret;
++	if (ret)
++		debug(ap->logopt, MODPREFIX
++		      "matched selector %s(%s)",
++		      s->sel->name, expand ? expand : s->func.arg1);
++	else
++		debug(ap->logopt, MODPREFIX
++		      "did not match selector %s(%s)",
++		      s->sel->name, expand ? expand : s->func.arg1);
++
++	if (expand)
++		free(expand);
++
++	return ret;
++}
++
++static int sel_netgrp(struct autofs_point *ap,
++		      struct selector *s, struct substvar *sv)
++{
++	char *exp_arg1 = NULL, *exp_arg2 = NULL;
++	const struct substvar *v;
++	int res, ret = 0;
++	char *host;
++
++	if (s->func.arg2) {
++		res = expand_selectors(ap, s->func.arg2, &exp_arg2, sv);
++		if (res)
++			host = exp_arg2;
++		else
++			host = s->func.arg2;
++	} else {
++		if (s->sel->selector == SEL_NETGRP)
++			v = macro_findvar(sv, "host", 4);
++		else
++			v = macro_findvar(sv, "hostd", 5);
++		if (!v || !*v->val) {
++			error(ap->logopt, MODPREFIX
++			     "failed to get value of ${host}");
++			goto out;
++		}
++		host = v->val;
++	}
++
++	res = expand_selectors(ap, s->func.arg1, &exp_arg1, sv);
++	if (res)
++		ret = innetgr(exp_arg1, host, NULL, NULL);
++	else
++		ret = innetgr(s->func.arg1, host, NULL, NULL);
++
++	if (s->compare == SEL_COMP_NOT)
++		ret = !ret;
++	if (ret) {
++		if (!s->func.arg2)
++			debug(ap->logopt, MODPREFIX
++			      "matched selector %s(%s)",
++			      s->sel->name, exp_arg1 ? exp_arg1 : s->func.arg1);
++		else
++			debug(ap->logopt, MODPREFIX
++			      "matched selector %s(%s,%s)", s->sel->name,
++			      exp_arg1 ? exp_arg1 : s->func.arg1,
++			      exp_arg2 ? exp_arg2 : s->func.arg2);
++	} else {
++		if (!s->func.arg2)
++			debug(ap->logopt, MODPREFIX
++			      "did not match selector %s(%s)",
++			      s->sel->name, exp_arg1 ? exp_arg1 : s->func.arg1);
++		else
++			debug(ap->logopt, MODPREFIX
++			      "did not match selector %s(%s,%s)", s->sel->name,
++			      exp_arg1 ? exp_arg1 : s->func.arg1,
++			      exp_arg2 ? exp_arg2 : s->func.arg2);
++	}
++out:
++	if (exp_arg1)
++		free(exp_arg1);
++	if (exp_arg2)
++		free(exp_arg2);
++
++	return ret;
++}
++
++static int eval_selector(struct autofs_point *ap,
+ 			 struct amd_entry *this, struct substvar *sv)
+ {
+ 	struct selector *s = this->selector;
++	unsigned int logopt = ap->logopt;
+ 	const struct substvar *v;
+ 	unsigned int s_type;
+ 	unsigned int v_type;
+-	struct stat st;
+-	char *host;
+ 	int res, val, ret = 0;
+ 
+ 	s_type = s->sel->flags & SEL_FLAGS_TYPE_MASK;
+@@ -341,26 +515,7 @@ static int eval_selector(unsigned int lo
+ 
+ 		switch (v_type) {
+ 		case SEL_FLAG_STR:
+-			res = strcmp(v->val, s->comp.value);
+-			if (s->compare & SEL_COMP_EQUAL && !res) {
+-				debug(logopt, MODPREFIX
+-				      "matched selector %s(%s) == %s",
+-				      v->def, v->val, s->comp.value);
+-				ret = 1;
+-				break;
+-			} else if (s->compare & SEL_COMP_NOTEQUAL && res) {
+-				debug(logopt, MODPREFIX
+-				      "matched selector %s(%s) != %s",
+-				      v->def, v->val, s->comp.value);
+-				ret = 1;
+-				break;
+-			}
+-
+-			debug(logopt, MODPREFIX
+-				      "did not match selector %s(%s) %s %s",
+-				      v->def, v->val,
+-				      (s->compare & SEL_COMP_EQUAL ? "==" : "!="),
+-				      s->comp.value);
++			ret = sel_strcmp(ap, v, s, sv);
+ 			break;
+ 
+ 		case SEL_FLAG_NUM:
+@@ -436,7 +591,7 @@ static int eval_selector(unsigned int lo
+ 			break;
+ 
+ 		case SEL_XHOST:
+-			ret = match_my_name(logopt, s->func.arg1, sv);
++			ret = match_my_name(ap, s->func.arg1, sv);
+ 			if (s->compare == SEL_COMP_NOT)
+ 				ret = !ret;
+ 			if (ret)
+@@ -450,32 +605,11 @@ static int eval_selector(unsigned int lo
+ 			break;
+ 
+ 		case SEL_EXISTS:
+-			/* Sould be OK to fail on any error here */
+-			ret = !lstat(s->func.arg1, &st);
+-			if (s->compare == SEL_COMP_NOT)
+-				ret = !ret;
+-			if (ret)
+-				debug(logopt, MODPREFIX
+-				      "matched selector %s(%s)",
+-				      s->sel->name, s->func.arg1);
+-			else
+-				debug(logopt, MODPREFIX
+-				      "did not match selector %s(%s)",
+-				      s->sel->name, s->func.arg1);
++			ret = sel_lstat(ap, s, sv);
+ 			break;
+ 
+ 		case SEL_IN_NETWORK:
+-			ret = in_network(s->func.arg1);
+-			if (s->compare == SEL_COMP_NOT)
+-				ret = !ret;
+-			if (ret)
+-				debug(logopt, MODPREFIX
+-				      "matched selector %s(%s)",
+-				      s->sel->name, s->func.arg1);
+-			else
+-				debug(logopt, MODPREFIX
+-				      "did not match selector %s(%s)",
+-				      s->sel->name, s->func.arg1);
++			ret = sel_in_network(ap, s, sv);
+ 			break;
+ 
+ 		default:
+@@ -494,43 +628,7 @@ static int eval_selector(unsigned int lo
+ 		switch (s->sel->selector) {
+ 		case SEL_NETGRP:
+ 		case SEL_NETGRPD:
+-			if (s->func.arg2)
+-				host = s->func.arg2;
+-			else {
+-				if (s->sel->selector == SEL_NETGRP)
+-					v = macro_findvar(sv, "host", 4);
+-				else
+-					v = macro_findvar(sv, "hostd", 5);
+-				if (!v || !*v->val) {
+-					error(logopt, MODPREFIX
+-					     "failed to get value of ${host}");
+-					break;
+-				}
+-				host = v->val;
+-			}
+-			ret = innetgr(s->func.arg1, host, NULL, NULL);
+-			if (s->compare == SEL_COMP_NOT)
+-				ret = !ret;
+-			if (ret) {
+-				if (!s->func.arg2)
+-					debug(logopt, MODPREFIX
+-					      "matched selector %s(%s)",
+-					      s->sel->name, s->func.arg1);
+-				else
+-					debug(logopt, MODPREFIX
+-					      "matched selector %s(%s,%s)",
+-					      s->sel->name, s->func.arg1,
+-					      s->func.arg2);
+-			} else {
+-				if (!s->func.arg2)
+-					debug(logopt, MODPREFIX
+-					      "did not match selector %s(%s)",
+-					      s->sel->name, s->func.arg1);
+-				else
+-					debug(logopt, MODPREFIX
+-					      "did not match selector %s(%s,%s)",
+-					      s->sel->name, s->func.arg1, s->func.arg2);
+-			}
++			ret = sel_netgrp(ap, s, sv);
+ 			break;
+ 
+ 		default:
+@@ -1737,7 +1835,7 @@ static void update_prefix(struct autofs_
+ 	return;
+ }
+ 
+-static int match_selectors(unsigned int logopt,
++static int match_selectors(struct autofs_point *ap,
+ 			   struct amd_entry *entry, struct substvar *sv)
+ {
+ 	struct selector *s = entry->selector;
+@@ -1745,7 +1843,7 @@ static int match_selectors(unsigned int
+ 
+ 	/* No selectors, always match */
+ 	if (!s) {
+-		debug(logopt, MODPREFIX "no selectors found in location");
++		debug(ap->logopt, MODPREFIX "no selectors found in location");
+ 		return 1;
+ 	}
+ 
+@@ -1753,7 +1851,7 @@ static int match_selectors(unsigned int
+ 
+ 	/* All selectors must match */
+ 	while (s) {
+-		ret = eval_selector(logopt, entry, sv);
++		ret = eval_selector(ap, entry, sv);
+ 		if (!ret)
+ 			break;
+ 		s = s->next;
+@@ -1913,7 +2011,7 @@ static struct amd_entry *select_default_
+ 		if (!this->selector)
+ 			continue;
+ 
+-		if (match_selectors(ap->logopt, this, sv)) {
++		if (match_selectors(ap, this, sv)) {
+ 			if (entry_default) {
+ 				/*update_with_defaults(entry_default, this, sv);*/
+ 				free_amd_entry(entry_default);
+@@ -2154,7 +2252,7 @@ int parse_mount(struct autofs_point *ap,
+ 			break;
+ 		}
+ 
+-		if (!match_selectors(ap->logopt, this, sv))
++		if (!match_selectors(ap, this, sv))
+ 			continue;
+ 
+ 		at_least_one = 1;
diff --git a/SOURCES/autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch b/SOURCES/autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch
new file mode 100644
index 0000000..d08d569
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch
@@ -0,0 +1,223 @@
+autofs-5.1.5 - log mount call arguments if mount_verbose is set
+
+From: Lars R. Damerow <lars@pixar.com>
+
+Override the debug log only setting if mount_verbose is set so that
+mount parameter information is logged on mount.
+
+Signed-off-by: Lars R. Damerow <lars@pixar.com>
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG               |    1 +
+ modules/mount_afs.c     |    6 +++++-
+ modules/mount_bind.c    |   11 +++++++----
+ modules/mount_ext2.c    |   16 ++++++++++------
+ modules/mount_generic.c |   14 +++++++++-----
+ modules/mount_nfs.c     |   29 +++++++++++++++++------------
+ 6 files changed, 49 insertions(+), 28 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -321,6 +321,7 @@
+ - use malloc(3) in spawn.c.
+ - add mount_verbose configuration option.
+ - optionally log mount requestor process info.
++- log mount call arguments if mount_verbose is set.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/modules/mount_afs.c
++++ autofs-5.0.7/modules/mount_afs.c
+@@ -37,10 +37,14 @@ int mount_mount(struct autofs_point *ap,
+ 	char dest[PATH_MAX + 1];
+ 	size_t r_len = strlen(root);
+ 	size_t d_len = r_len + name_len + 2;
++	void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
+ 
+ 	if (ap->flags & MOUNT_FLAG_REMOUNT)
+ 		return 0;
+ 
++	if (defaults_get_mount_verbose())
++		mountlog = &log_info;
++
+ 	if (d_len > PATH_MAX)
+ 		return 1;
+ 
+@@ -53,7 +57,7 @@ int mount_mount(struct autofs_point *ap,
+ 	if (dest[strlen(dest)-1] == '/')
+ 	    dest[strlen(dest)-1] = '\0';
+ 
+-	debug(ap->logopt, MODPREFIX "mounting AFS %s -> %s", dest, what);
++	mountlog(ap->logopt, MODPREFIX "mounting AFS %s -> %s", dest, what);
+ 
+ 	return symlink(what, dest);	/* Try it.  If it fails, return the error. */
+ }
+--- autofs-5.0.7.orig/modules/mount_bind.c
++++ autofs-5.0.7/modules/mount_bind.c
+@@ -81,10 +81,14 @@ int mount_mount(struct autofs_point *ap,
+ 	int err;
+ 	int i, len;
+ 	int symlnk = (*name != '/' && (ap->flags & MOUNT_FLAG_SYMLINK));
++	void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
+ 
+ 	if (ap->flags & MOUNT_FLAG_REMOUNT)
+ 		return 0;
+ 
++	if (defaults_get_mount_verbose())
++		mountlog = &log_info;
++
+ 	/* Extract "symlink" pseudo-option which forces local filesystems
+ 	 * to be symlinked instead of bound.
+ 	 */
+@@ -164,10 +168,9 @@ int mount_mount(struct autofs_point *ap,
+ 		if (!status)
+ 			existed = 0;
+ 
+-		debug(ap->logopt,
+-		      MODPREFIX
+-		      "calling mount --bind " SLOPPY " -o %s %s %s",
+-		      options, what, fullpath);
++		mountlog(ap->logopt, MODPREFIX
++			 "calling mount --bind " SLOPPY " -o %s %s %s",
++			  options, what, fullpath);
+ 
+ 		err = spawn_bind_mount(ap->logopt,
+ 			     SLOPPYOPT "-o", options, what, fullpath, NULL);
+--- autofs-5.0.7.orig/modules/mount_ext2.c
++++ autofs-5.0.7/modules/mount_ext2.c
+@@ -47,10 +47,14 @@ int mount_mount(struct autofs_point *ap,
+ 	int err, ro = 0;
+ 	const char *fsck_prog;
+ 	int len, status, existed = 1;
++	void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
+ 
+ 	if (ap->flags & MOUNT_FLAG_REMOUNT)
+ 		return 0;
+ 
++	if (defaults_get_mount_verbose())
++		mountlog = &log_info;
++
+ 	/* Root offset of multi-mount */
+ 	len = strlen(root);
+ 	if (root[len - 1] == '/') {
+@@ -121,15 +125,15 @@ int mount_mount(struct autofs_point *ap,
+ 	}
+ 
+ 	if (options) {
+-		debug(ap->logopt,
+-		      MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
+-		      fstype, options, what, fullpath);
++		mountlog(ap->logopt, MODPREFIX
++			 "calling mount -t %s " SLOPPY "-o %s %s %s",
++			 fstype, options, what, fullpath);
+ 		err = spawn_mount(ap->logopt, "-t", fstype,
+ 			     SLOPPYOPT "-o", options, what, fullpath, NULL);
+ 	} else {
+-		debug(ap->logopt,
+-		      MODPREFIX "calling mount -t %s %s %s",
+-		      fstype, what, fullpath);
++		mountlog(ap->logopt,
++			 MODPREFIX "calling mount -t %s %s %s",
++			 fstype, what, fullpath);
+ 		err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL);
+ 	}
+ 
+--- autofs-5.0.7.orig/modules/mount_generic.c
++++ autofs-5.0.7/modules/mount_generic.c
+@@ -46,10 +46,14 @@ int mount_mount(struct autofs_point *ap,
+ 	char buf[MAX_ERR_BUF];
+ 	int err;
+ 	int len, status, existed = 1;
++	void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
+ 
+ 	if (ap->flags & MOUNT_FLAG_REMOUNT)
+ 		return 0;
+ 
++	if (defaults_get_mount_verbose())
++		mountlog = &log_info;
++
+ 	/* Root offset of multi-mount */
+ 	len = strlen(root);
+ 	if (root[len - 1] == '/') {
+@@ -80,15 +84,15 @@ int mount_mount(struct autofs_point *ap,
+ 		existed = 0;
+ 
+ 	if (options && options[0]) {
+-		debug(ap->logopt,
+-		      MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
+-		      fstype, options, what, fullpath);
++		mountlog(ap->logopt,
++			 MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
++			 fstype, options, what, fullpath);
+ 
+ 		err = spawn_mount(ap->logopt, "-t", fstype,
+ 			     SLOPPYOPT "-o", options, what, fullpath, NULL);
+ 	} else {
+-		debug(ap->logopt, MODPREFIX "calling mount -t %s %s %s",
+-		      fstype, what, fullpath);
++		mountlog(ap->logopt, MODPREFIX "calling mount -t %s %s %s",
++			 fstype, what, fullpath);
+ 		err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL);
+ 	}
+ 
+--- autofs-5.0.7.orig/modules/mount_nfs.c
++++ autofs-5.0.7/modules/mount_nfs.c
+@@ -77,13 +77,17 @@ int mount_mount(struct autofs_point *ap,
+ 	int port = -1;
+ 	int ro = 0;            /* Set if mount bind should be read-only */
+ 	int rdma = 0;
++	void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
+ 
+ 	if (ap->flags & MOUNT_FLAG_REMOUNT)
+ 		return 0;
+ 
+-	debug(ap->logopt,
+-	      MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s",
+-	      root, name, what, fstype, options);
++	if (defaults_get_mount_verbose())
++		mountlog = &log_info;
++
++	mountlog(ap->logopt,
++		 MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s",
++		 root, name, what, fstype, options);
+ 
+ 	mount_default_proto = defaults_get_mount_nfs_default_proto();
+ 	vers = NFS_VERS_MASK | NFS_PROTO_MASK;
+@@ -193,9 +197,9 @@ int mount_mount(struct autofs_point *ap,
+ 		if ((vers & NFS_PROTO_MASK) == 0)
+ 			vers |= NFS_PROTO_MASK;
+ 
+-		debug(ap->logopt, MODPREFIX
+-		      "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d",
+-		      nfsoptions, nobind, nosymlink, ro);
++		mountlog(ap->logopt, MODPREFIX
++			 "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d",
++			 nfsoptions, nobind, nosymlink, ro);
+ 	}
+ 
+ 	if (!parse_location(ap->logopt, &hosts, what, flags)) {
+@@ -370,17 +374,18 @@ dont_probe:
+ 		}
+ 
+ 		if (nfsoptions && *nfsoptions) {
+-			debug(ap->logopt,
+-			      MODPREFIX "calling mount -t %s " SLOPPY 
+-			      "-o %s %s %s", fstype, nfsoptions, loc, fullpath);
++			mountlog(ap->logopt,
++				 MODPREFIX "calling mount -t %s " SLOPPY
++				 "-o %s %s %s", fstype, nfsoptions, loc,
++				 fullpath);
+ 
+ 			err = spawn_mount(ap->logopt,
+ 					  "-t", fstype, SLOPPYOPT "-o",
+ 					  nfsoptions, loc, fullpath, NULL);
+ 		} else {
+-			debug(ap->logopt,
+-			      MODPREFIX "calling mount -t %s %s %s",
+-			      fstype, loc, fullpath);
++			mountlog(ap->logopt,
++				 MODPREFIX "calling mount -t %s %s %s",
++				 fstype, loc, fullpath);
+ 			err = spawn_mount(ap->logopt,
+ 					  "-t", fstype, loc, fullpath, NULL);
+ 		}
diff --git a/SOURCES/autofs-5.1.5-make-expire-remaining-log-level-debug.patch b/SOURCES/autofs-5.1.5-make-expire-remaining-log-level-debug.patch
new file mode 100644
index 0000000..5e4d1ec
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-make-expire-remaining-log-level-debug.patch
@@ -0,0 +1,55 @@
+autofs-5.1.5 - make expire remaining log level debug
+
+From: Ian Kent <raven@themaw.net>
+
+The log message listing the remaining mounts should be log level
+debug not info.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG         |    1 +
+ daemon/direct.c   |    2 +-
+ daemon/indirect.c |    4 ++--
+ 3 files changed, 4 insertions(+), 3 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -323,6 +323,7 @@
+ - optionally log mount requestor process info.
+ - log mount call arguments if mount_verbose is set.
+ - document ghost option in auto.master man page.
++- make expire remaining log level debug.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/daemon/direct.c
++++ autofs-5.0.7/daemon/direct.c
+@@ -986,7 +986,7 @@ void *expire_proc_direct(void *arg)
+ 	pthread_cleanup_pop(1);
+ 
+ 	if (left)
+-		info(ap->logopt, "%d remaining in %s", left, ap->path);
++		debug(ap->logopt, "%d remaining in %s", left, ap->path);
+ 
+ 	ec.status = left;
+ 
+--- autofs-5.0.7.orig/daemon/indirect.c
++++ autofs-5.0.7/daemon/indirect.c
+@@ -574,7 +574,7 @@ void *expire_proc_indirect(void *arg)
+ 	pthread_cleanup_pop(1);
+ 
+ 	if (submnts)
+-		info(ap->logopt,
++		debug(ap->logopt,
+ 		     "%d submounts remaining in %s", submnts, ap->path);
+ 
+ 	/* 
+@@ -582,7 +582,7 @@ void *expire_proc_indirect(void *arg)
+ 	 * words) the umounts are done by the time we reach here
+ 	 */
+ 	if (count)
+-		info(ap->logopt, "%d remaining in %s", count, ap->path);
++		debug(ap->logopt, "%d remaining in %s", count, ap->path);
+ 
+ 	ec.status = left;
+ 
diff --git a/SOURCES/autofs-5.1.5-openssl-workaround.patch b/SOURCES/autofs-5.1.5-openssl-workaround.patch
new file mode 100644
index 0000000..323022f
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-openssl-workaround.patch
@@ -0,0 +1,41 @@
+autofs-5.1.5 - openssl workaround
+
+From: Ian Kent <raven@themaw.net>
+
+Pre-open openssl libraries to prevent possible library unloads
+that could leave library static data undefined.
+
+---
+ daemon/automount.c |   14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- autofs-5.0.7.orig/daemon/automount.c
++++ autofs-5.0.7/daemon/automount.c
+@@ -2641,6 +2641,11 @@ int main(int argc, char *argv[])
+ 		dh_tirpc = dlopen("libtirpc.so.1", RTLD_NOW);
+ #endif
+ 
++	void *dh_ossl10 = dlopen("libssl.so.10", RTLD_NOW);
++	void *dh_crypto10 = dlopen("libcrypto.so.10", RTLD_NOW);
++	void *dh_ossl6 = dlopen("libssl.so.6", RTLD_NOW);
++	void *dh_crypto6 = dlopen("libcrypto.so.6", RTLD_NOW);
++
+ 	master_read = master_read_master(master_list, age, 0);
+ 	if (!master_read) {
+ 		/*
+@@ -2693,6 +2698,15 @@ int main(int argc, char *argv[])
+ 	release_flag_file();
+ 	macro_free_global_table();
+ 
++	if (dh_ossl10)
++		dlclose(dh_ossl10);
++	if (dh_crypto10)
++		dlclose(dh_crypto10);
++	if (dh_ossl6)
++		dlclose(dh_ossl6);
++	if (dh_crypto6)
++		dlclose(dh_crypto6);
++
+ #ifdef TIRPC_WORKAROUND
+ 	if (dh_tirpc)
+ 		dlclose(dh_tirpc);
diff --git a/SOURCES/autofs-5.1.5-optionally-log-mount-requestor-process-info.patch b/SOURCES/autofs-5.1.5-optionally-log-mount-requestor-process-info.patch
new file mode 100644
index 0000000..f421627
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-optionally-log-mount-requestor-process-info.patch
@@ -0,0 +1,155 @@
+autofs-5.1.5 - optionally log mount requestor process info
+
+From: Lars R. Damerow <lars@pixar.com>
+
+This information can be helpful to determine who or what is making
+particular mount requests, especially when used in conjunction with
+the use_mount_request_log_id option.
+
+Signed-off-by: Lars R. Damerow <lars@pixar.com>
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG                      |    1 +
+ daemon/direct.c                |    6 ++++++
+ daemon/indirect.c              |    6 ++++++
+ include/log.h                  |    2 ++
+ lib/log.c                      |   39 +++++++++++++++++++++++++++++++++++++++
+ man/autofs.conf.5.in           |    3 ++-
+ redhat/autofs.conf.default.in  |    4 +++-
+ samples/autofs.conf.default.in |    4 +++-
+ 8 files changed, 62 insertions(+), 3 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -320,6 +320,7 @@
+ - add NULL check for get_addr_string() return.
+ - use malloc(3) in spawn.c.
+ - add mount_verbose configuration option.
++- optionally log mount requestor process info.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/daemon/direct.c
++++ autofs-5.0.7/daemon/direct.c
+@@ -1242,6 +1242,12 @@ static void *do_mount_direct(void *arg)
+ 
+ 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
+ 
++	if (defaults_get_mount_verbose()) {
++		pid_t ppid = log_pidinfo(ap, mt.pid, "requestor");
++		if (ppid > 0)
++			log_pidinfo(ap, ppid, "parent");
++	}
++
+ 	status = fstat(mt.ioctlfd, &st);
+ 	if (status == -1) {
+ 		error(ap->logopt,
+--- autofs-5.0.7.orig/daemon/indirect.c
++++ autofs-5.0.7/daemon/indirect.c
+@@ -758,6 +758,12 @@ static void *do_mount_indirect(void *arg
+ 
+ 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
+ 
++	if (defaults_get_mount_verbose()) {
++		pid_t ppid = log_pidinfo(ap, mt.pid, "requestor");
++		if (ppid > 0)
++			log_pidinfo(ap, ppid, "parent");
++	}
++
+ 	len = ncat_path(buf, sizeof(buf), ap->path, mt.name, mt.len);
+ 	if (!len) {
+ 		crit(ap->logopt, "path to be mounted is to long");
+--- autofs-5.0.7.orig/include/log.h
++++ autofs-5.0.7/include/log.h
+@@ -46,6 +46,8 @@ extern void log_crit(unsigned, const cha
+ extern void log_debug(unsigned int, const char* msg, ...);
+ extern void logmsg(const char* msg, ...);
+ 
++extern pid_t log_pidinfo(struct autofs_point *ap, pid_t pid, char *label);
++
+ #define debug(opt, msg, args...)	\
+ 	do { log_debug(opt, "%s: " msg,  __FUNCTION__, ##args); } while (0)
+ 
+--- autofs-5.0.7.orig/lib/log.c
++++ autofs-5.0.7/lib/log.c
+@@ -325,3 +325,42 @@ void log_to_stderr(void)
+ 
+ 	return;
+ }
++
++pid_t log_pidinfo(struct autofs_point *ap, pid_t pid, char *label) {
++	char buf[PATH_MAX + 1] = "";
++	FILE *statfile;
++
++	pid_t tgid, ppid;
++	int uid, euid, gid, egid;
++	char comm[64] = "";
++
++	sprintf(buf, "/proc/%d/status", pid);
++	statfile = fopen(buf, "r");
++	if (statfile == NULL) {
++		info(ap->logopt, "pidinfo %s: failed to open %s", label, buf);
++		return -1;
++	}
++
++	while (fgets(buf, sizeof(buf), statfile) != NULL) {
++	        if (strncmp(buf, "Name:", 5) == 0) {
++			sscanf(buf, "Name:\t%s", (char *) &comm);
++		} else if (strncmp(buf, "Tgid:", 5) == 0) {
++			sscanf(buf, "Tgid:\t%d", (int *) &tgid);
++		} else if (strncmp(buf, "PPid:", 5) == 0) {
++			sscanf(buf, "PPid:\t%d", (int *) &ppid);
++		} else if (strncmp(buf, "Uid:", 4) == 0) {
++			sscanf(buf,
++			      "Uid:\t%d\t%d", (int *) &uid, (int *) &euid);
++		} else if (strncmp(buf, "Gid:", 4) == 0) {
++			sscanf(buf,
++			      "Gid:\t%d\t%d", (int *) &gid, (int *) &egid);
++		}
++	}
++	fclose(statfile);
++
++	info(ap->logopt,
++	  "pidinfo %s: pid:%d comm:%s tgid:%d uid:%d euid:%d gid:%d egid:%d",
++	   label, pid, comm, tgid, uid, euid, gid, egid);
++
++	return ppid;
++}
+--- autofs-5.0.7.orig/man/autofs.conf.5.in
++++ autofs-5.0.7/man/autofs.conf.5.in
+@@ -43,7 +43,8 @@ setting.
+ .TP
+ .B mount_verbose
+ .br
+-Use the verbose flag when spawning mount(8) (program default "no").
++Use the verbose flag when spawning mount(8), and log some process info
++about the requestor and its parent (program default "no").
+ .TP
+ .B mount_wait
+ .br
+--- autofs-5.0.7.orig/redhat/autofs.conf.default.in
++++ autofs-5.0.7/redhat/autofs.conf.default.in
+@@ -26,7 +26,9 @@ timeout = 300
+ #
+ #negative_timeout = 60
+ #
+-# mount_verbose - use the -v flag when calling mount(8).
++# mount_verbose - use the -v flag when calling mount(8) and log some
++#		  process information about the requestor and its
++#		  parent.
+ #
+ #mount_verbose = no
+ #
+--- autofs-5.0.7.orig/samples/autofs.conf.default.in
++++ autofs-5.0.7/samples/autofs.conf.default.in
+@@ -26,7 +26,9 @@ timeout = 300
+ #
+ #negative_timeout = 60
+ #
+-# mount_verbose - use the -v flag when calling mount(8).
++# mount_verbose - use the -v flag when calling mount(8) and log some
++#		  process information about the requestor and its
++#		  parent.
+ #
+ #mount_verbose = no
+ #
diff --git a/SOURCES/autofs-5.1.5-use-malloc-in-spawn_c.patch b/SOURCES/autofs-5.1.5-use-malloc-in-spawn_c.patch
new file mode 100644
index 0000000..f6e9eb7
--- /dev/null
+++ b/SOURCES/autofs-5.1.5-use-malloc-in-spawn_c.patch
@@ -0,0 +1,161 @@
+autofs-5.1.5 - use malloc(3) in spawn.c
+
+From: Ian Kent <raven@themaw.net>
+
+Use malloc(3) in spawn.c functions instead of alloca(3) as a failure
+return for this function is undefined.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+---
+ CHANGELOG      |    1 +
+ daemon/spawn.c |   50 ++++++++++++++++++++++++++++++++++++++++++++------
+ 2 files changed, 45 insertions(+), 6 deletions(-)
+
+--- autofs-5.0.7.orig/CHANGELOG
++++ autofs-5.0.7/CHANGELOG
+@@ -318,6 +318,7 @@
+ - add systemd service command line option.
+ - support strictexpire mount option.
+ - add NULL check for get_addr_string() return.
++- use malloc(3) in spawn.c.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+--- autofs-5.0.7.orig/daemon/spawn.c
++++ autofs-5.0.7/daemon/spawn.c
+@@ -500,22 +500,33 @@ int spawnv(unsigned logopt, const char *
+ int spawnl(unsigned logopt, const char *prog, ...)
+ {
+ 	va_list arg;
+-	int argc;
++	int argc, ret;
+ 	char **argv, **p;
++	unsigned int argv_len;
+ 
+ 	va_start(arg, prog);
+ 	for (argc = 1; va_arg(arg, char *); argc++);
+ 	va_end(arg);
+ 
+-	if (!(argv = alloca(sizeof(char *) * argc)))
++	argv_len = sizeof(char *) * (argc + 1);
++	argv = malloc(argv_len);
++	if (!argv) {
++		char buf[MAX_ERR_BUF];
++		char *estr = strerror_r(errno, buf, sizeof(buf));
++		crit(logopt, "malloc: %s", estr);
+ 		return -1;
++	}
++	memset(argv, 0, argv_len);
+ 
+ 	va_start(arg, prog);
+ 	p = argv;
+ 	while ((*p++ = va_arg(arg, char *)));
+ 	va_end(arg);
+ 
+-	return do_spawn(logopt, -1, SPAWN_OPT_NONE, prog, (const char **) argv);
++	ret = do_spawn(logopt, -1, SPAWN_OPT_NONE, prog, (const char **) argv);
++	free(argv);
++
++	return ret;
+ }
+ 
+ int spawn_mount(unsigned logopt, ...)
+@@ -533,6 +544,7 @@ int spawn_mount(unsigned logopt, ...)
+ 	int update_mtab = 1, ret, printed = 0;
+ 	unsigned int wait = defaults_get_mount_wait();
+ 	char buf[PATH_MAX + 1];
++	unsigned int argv_len;
+ 
+ 	/* If we use mount locking we can't validate the location */
+ #ifdef ENABLE_MOUNT_LOCKING
+@@ -558,8 +570,15 @@ int spawn_mount(unsigned logopt, ...)
+ 	}
+ 
+ 	/* Alloc 1 extra slot in case we need to use the "-f" option */
+-	if (!(argv = alloca(sizeof(char *) * (argc + 2))))
++	argv_len = sizeof(char *) * (argc + 2);
++	argv = malloc(argv_len);
++	if (!argv) {
++		char buf[MAX_ERR_BUF];
++		char *estr = strerror_r(errno, buf, sizeof(buf));
++		crit(logopt, "malloc: %s", estr);
+ 		return -1;
++	}
++	memset(argv, 0, argv_len);
+ 
+ 	argv[0] = arg0;
+ 
+@@ -634,6 +653,7 @@ int spawn_mount(unsigned logopt, ...)
+ 		umount(argv[argc]);
+ 		ret = MNT_FORCE_FAIL;
+ 	}
++	free(argv);
+ 
+ 	return ret;
+ }
+@@ -661,6 +681,7 @@ int spawn_bind_mount(unsigned logopt, ..
+ 	unsigned int retries = MTAB_LOCK_RETRIES;
+ 	int update_mtab = 1, ret, printed = 0;
+ 	char buf[PATH_MAX + 1];
++	unsigned int argv_len;
+ 
+ 	/* If we use mount locking we can't validate the location */
+ #ifdef ENABLE_MOUNT_LOCKING
+@@ -689,8 +710,15 @@ int spawn_bind_mount(unsigned logopt, ..
+ 		}
+ 	}
+ 
+-	if (!(argv = alloca(sizeof(char *) * (argc + 2))))
++	argv_len = sizeof(char *) * (argc + 2);
++	argv = malloc(argv_len);
++	if (!argv) {
++		char buf[MAX_ERR_BUF];
++		char *estr = strerror_r(errno, buf, sizeof(buf));
++		crit(logopt, "malloc: %s", estr);
+ 		return -1;
++	}
++	memset(argv, 0, argv_len);
+ 
+ 	argv[0] = arg0;
+ 	argv[1] = bind;
+@@ -752,6 +780,7 @@ int spawn_bind_mount(unsigned logopt, ..
+ 		umount(argv[argc]);
+ 		ret = MNT_FORCE_FAIL;
+ 	}
++	free(argv);
+ 
+ 	return ret;
+ }
+@@ -769,6 +798,7 @@ int spawn_umount(unsigned logopt, ...)
+ 	int update_mtab = 1, ret, printed = 0;
+ 	unsigned int wait = defaults_get_umount_wait();
+ 	char buf[PATH_MAX + 1];
++	unsigned int argv_len;
+ 
+ #ifdef ENABLE_MOUNT_LOCKING
+ 	options = SPAWN_OPT_LOCK;
+@@ -792,8 +822,15 @@ int spawn_umount(unsigned logopt, ...)
+ 		}
+ 	}
+ 
+-	if (!(argv = alloca(sizeof(char *) * argc + 1)))
++	argv_len = sizeof(char *) * (argc + 1);
++	argv = malloc(argv_len);
++	if (!argv) {
++		char buf[MAX_ERR_BUF];
++		char *estr = strerror_r(errno, buf, sizeof(buf));
++		crit(logopt, "malloc: %s", estr);
+ 		return -1;
++	}
++	memset(argv, 0, argv_len);
+ 
+ 	argv[0] = arg0;
+ 
+@@ -841,6 +878,7 @@ int spawn_umount(unsigned logopt, ...)
+ 		     "and /etc/mtab will differ");
+ 		ret = 0;
+ 	}
++	free(argv);
+ 
+ 	return ret;
+ }
diff --git a/SPECS/autofs.spec b/SPECS/autofs.spec
index 79550c0..0dd1dc8 100644
--- a/SPECS/autofs.spec
+++ b/SPECS/autofs.spec
@@ -8,7 +8,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.7
-Release: 99%{?dist}
+Release: 106%{?dist}
 Epoch: 1
 License: GPLv2+
 Group: System Environment/Daemons
@@ -473,6 +473,27 @@ Patch852: autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch
 Patch853: autofs-5.1.4-fix-amd-parser-opts-option-handling.patch
 Patch854: autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch
 
+Patch855: autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch
+Patch856: autofs-5.1.4-update-build-info-with-systemd.patch
+Patch857: autofs-5.1.4-use-flags-for-startup-boolean-options.patch
+Patch858: autofs-5.1.4-move-close-stdio-descriptors-to-become_daemon.patch
+Patch859: autofs-5.1.4-add-systemd-service-command-line-option.patch
+
+Patch860: autofs-5.1.5-add-strictexpire-mount-option.patch
+Patch861: autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch
+Patch862: autofs-5.1.5-use-malloc-in-spawn_c.patch
+Patch863: autofs-5.1.5-add-mount_verbose-configuration-option.patch
+Patch864: autofs-5.1.5-optionally-log-mount-requestor-process-info.patch
+Patch865: autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch
+
+Patch866: autofs-5.1.5-openssl-workaround.patch
+Patch867: autofs-5.1.3-document-ghost-option-in-auto_master-man-page.patch
+Patch868: autofs-5.1.5-make-expire-remaining-log-level-debug.patch
+Patch869: autofs-5.1.3-workaround-getaddrinfo-ai_canonname-bug.patch
+Patch870: autofs-5.1.4-improve-hostname-lookup-error-logging.patch
+Patch871: autofs-5.1.5-allow-period-following-macro-in-selector-value.patch
+Patch872: autofs-5.1.5-fix-macro-expansion-in-selector-values.patch
+
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 %if %{with_systemd}
 BuildRequires: systemd-units
@@ -984,6 +1005,27 @@ echo %{version}-%{release} > .version
 %patch853 -p1
 %patch854 -p1
 
+%patch855 -p1
+%patch856 -p1
+%patch857 -p1
+%patch858 -p1
+%patch859 -p1
+
+%patch860 -p1
+%patch861 -p1
+%patch862 -p1
+%patch863 -p1
+%patch864 -p1
+%patch865 -p1
+
+%patch866 -p1
+%patch867 -p1
+%patch868 -p1
+%patch869 -p1
+%patch870 -p1
+%patch871 -p1
+%patch872 -p1
+
 %build
 LDFLAGS=-Wl,-z,now
 %configure --disable-mount-locking \
@@ -1080,6 +1122,53 @@ fi
 %dir /etc/auto.master.d
 
 %changelog
+* Thu Mar 07 2019 Ian Kent <ikent@redhat.com> - 5.0.7-106
+- bz1685804 - autofs doesn't expand macros in amd map selectors
+  - workaround getaddrinfo(3) ai_canonname bug.
+  - improve hostname lookup error logging.
+  - allow period following macro in selector value.
+  - fix macro expansion in selector values.
+- Resolves: rhbz#1685804
+
+* Tue Mar 05 2019 Ian Kent <ikent@redhat.com> - 5.0.7-105
+- bz1680582 - Sanitize autofs logging
+  - make expire remaining log level debug.
+- Resolves: rhbz#1680582
+
+* Tue Mar 05 2019 Ian Kent <ikent@redhat.com> - 5.0.7-104
+- bz1442063 - Parameter ghost not documented in the man pages
+  - document ghost option in auto.master man page.
+- Resolves: rhbz#1442063
+
+* Mon Feb 18 2019 Ian Kent <ikent@redhat.com> - 5.0.7-103
+- bz1644933 - Segmentation fault in err_string_data_LHASH_COMP
+  - openssl workaround.
+- Resolves: rhbz#1644933
+
+* Mon Feb 04 2019 Ian Kent <ikent@redhat.com> - 5.0.7-102
+- bz1644910 - [RFE] Enable additional logging information for autofs
+  - add NULL check for get_addr_string() return.
+  - use malloc(3) in spawn.c.
+  - add mount_verbose configuration option.
+  - optionally log mount requestor process info.
+  - log mount call arguments if mount_verbose is set.
+- Resolves: rhbz#1644910
+
+* Tue Jan 22 2019 Ian Kent <ikent@redhat.com> - 5.0.7-101
+- bz1640448 - path_resolution on an autofs managed path resets the timer. Can
+  this be made configurable?
+  - support strictexpire mount option.
+- Resolves: rhbz#1640448
+
+* Tue Dec 11 2018 Ian Kent <ikent@redhat.com> - 5.0.7-100
+- bz1599516 - [autofs] The log no longer print PID of automount process
+  - add NULL check in prepare_attempt_prefix().
+  - update build info with systemd.
+  - use flags for startup boolean options.
+  - move close stdio descriptors to become_daemon().
+  - add systemd service command line option.
+- Resolves: rhbz#1599516
+
 * Wed Sep 19 2018 Ian Kent <ikent@redhat.com> - 5.0.7-98
 - bz1630189 - yum update hanging while restarting autofs
   - fix incorrect locking in sss lookup.