11 changed files with 3 additions and 1215 deletions
@ -1,47 +0,0 @@ |
|||||
autofs-5.1.5 - Fix NFS mount from IPv6 addresses |
|
||||
|
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.de> |
|
||||
|
|
||||
When an NFS server is specified by an IPv6 address and no mount |
|
||||
options, the mount fails because check_address_proto() |
|
||||
receives vers with TCP_REQUESTED set but the host.addr_len is |
|
||||
INET6_ADDRSTRLEN. Removing the check for INET_ADDRSTRLEN |
|
||||
fixes this issue. |
|
||||
|
|
||||
However, this will allow mount from "proto=tcp" for an IPv6 |
|
||||
addressed server. |
|
||||
|
|
||||
Fixes: 9053214 ("autofs-5.1.3 - fix ipv6 proto option handling") |
|
||||
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> |
|
||||
Acked-by: Ian Kent <raven@themaw.net> |
|
||||
---
|
|
||||
CHANGELOG | 1 + |
|
||||
modules/replicated.c | 3 --- |
|
||||
2 files changed, 1 insertion(+), 3 deletions(-) |
|
||||
|
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
|
||||
index 5650e73b..c8a3dec2 100644
|
|
||||
--- a/CHANGELOG
|
|
||||
+++ b/CHANGELOG
|
|
||||
@@ -6,6 +6,7 @@ xx/xx/2019 autofs-5.1.6
|
|
||||
- add mount_verbose configuration option. |
|
||||
- optionally log mount requestor process info. |
|
||||
- log mount call arguments if mount_verbose is set. |
|
||||
+- Fix NFS mount from IPv6 addresses.
|
|
||||
|
|
||||
30/10/2018 autofs-5.1.5 |
|
||||
- fix flag file permission. |
|
||||
diff --git a/modules/replicated.c b/modules/replicated.c
|
|
||||
index 740270ec..e99e32a9 100644
|
|
||||
--- a/modules/replicated.c
|
|
||||
+++ b/modules/replicated.c
|
|
||||
@@ -497,9 +497,6 @@ static int check_address_proto(unsigned logopt,
|
|
||||
if (ipv6_requested) { |
|
||||
if (host->addr_len == INET_ADDRSTRLEN) |
|
||||
ret = 0; |
|
||||
- } else {
|
|
||||
- if (host->addr_len == INET6_ADDRSTRLEN)
|
|
||||
- ret = 0;
|
|
||||
} |
|
||||
|
|
||||
if (!ret) |
|
@ -1,43 +0,0 @@ |
|||||
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(+) |
|
||||
|
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
|
||||
index 76da2ee4..e71e913a 100644
|
|
||||
--- a/CHANGELOG
|
|
||||
+++ b/CHANGELOG
|
|
||||
@@ -1,6 +1,7 @@
|
|
||||
xx/xx/2019 autofs-5.1.6 |
|
||||
- support strictexpire mount option. |
|
||||
- fix hesiod string check in master_parse(). |
|
||||
+- add NULL check for get_addr_string() return.
|
|
||||
|
|
||||
30/10/2018 autofs-5.1.5 |
|
||||
- fix flag file permission. |
|
||||
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
|
|
||||
index 426c27bd..295c4a5d 100644
|
|
||||
--- a/modules/mount_nfs.c
|
|
||||
+++ b/modules/mount_nfs.c
|
|
||||
@@ -333,7 +333,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); |
|
@ -1,87 +0,0 @@ |
|||||
autofs-5.1.5 - add ignore mount option |
|
||||
|
|
||||
From: Ian Kent <raven@themaw.net> |
|
||||
|
|
||||
Add mount option "ignore", if the kernel supports it, as an |
|
||||
indicator to applications to ignore the mount entry. |
|
||||
|
|
||||
Signed-off-by: Ian Kent <raven@themaw.net> |
|
||||
---
|
|
||||
daemon/direct.c | 10 ++++++++++ |
|
||||
daemon/indirect.c | 10 ++++++++++ |
|
||||
include/automount.h | 3 +++ |
|
||||
lib/master.c | 4 ++-- |
|
||||
4 files changed, 25 insertions(+), 2 deletions(-) |
|
||||
|
|
||||
diff --git a/daemon/direct.c b/daemon/direct.c
|
|
||||
index 4f468563..42992220 100644
|
|
||||
--- a/daemon/direct.c
|
|
||||
+++ b/daemon/direct.c
|
|
||||
@@ -431,6 +431,16 @@ int do_mount_autofs_direct(struct autofs_point *ap,
|
|
||||
mp->options = tmp; |
|
||||
} |
|
||||
} |
|
||||
+
|
|
||||
+ if ((ap->flags & MOUNT_FLAG_IGNORE) &&
|
|
||||
+ ((get_kver_major() == 5 && get_kver_minor() > 4) ||
|
|
||||
+ (get_kver_major() > 5))) {
|
|
||||
+ char *tmp = realloc(mp->options, strlen(mp->options) + 7);
|
|
||||
+ if (tmp) {
|
|
||||
+ strcat(tmp, ",ignore");
|
|
||||
+ mp->options = tmp;
|
|
||||
+ }
|
|
||||
+ }
|
|
||||
} |
|
||||
|
|
||||
/* In case the directory doesn't exist, try to mkdir it */ |
|
||||
diff --git a/daemon/indirect.c b/daemon/indirect.c
|
|
||||
index 9ccbc038..8719960e 100644
|
|
||||
--- a/daemon/indirect.c
|
|
||||
+++ b/daemon/indirect.c
|
|
||||
@@ -142,6 +142,16 @@ static int do_mount_autofs_indirect(struct autofs_point *ap, const char *root)
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
+ if ((ap->flags & MOUNT_FLAG_IGNORE) &&
|
|
||||
+ ((get_kver_major() == 5 && get_kver_minor() > 4) ||
|
|
||||
+ (get_kver_major() > 5))) {
|
|
||||
+ char *tmp = realloc(options, strlen(options) + 7);
|
|
||||
+ if (tmp) {
|
|
||||
+ strcat(tmp, ",ignore");
|
|
||||
+ options = tmp;
|
|
||||
+ }
|
|
||||
+ }
|
|
||||
+
|
|
||||
/* In case the directory doesn't exist, try to mkdir it */ |
|
||||
if (mkdir_path(root, mp_mode) < 0) { |
|
||||
if (errno != EEXIST && errno != EROFS) { |
|
||||
diff --git a/include/automount.h b/include/automount.h
|
|
||||
index 1bb32015..d02410f3 100644
|
|
||||
--- a/include/automount.h
|
|
||||
+++ b/include/automount.h
|
|
||||
@@ -557,6 +557,9 @@ struct kernel_mod_version {
|
|
||||
/* Use strict expire semantics if requested and kernel supports it */ |
|
||||
#define MOUNT_FLAG_STRICTEXPIRE 0x0400 |
|
||||
|
|
||||
+/* Indicator for applications to ignore the mount entry */
|
|
||||
+#define MOUNT_FLAG_IGNORE 0x0800
|
|
||||
+
|
|
||||
struct autofs_point { |
|
||||
pthread_t thid; |
|
||||
char *path; /* Mount point name */ |
|
||||
diff --git a/lib/master.c b/lib/master.c
|
|
||||
index 5f3a3d99..e0bd34ab 100644
|
|
||||
--- a/lib/master.c
|
|
||||
+++ b/lib/master.c
|
|
||||
@@ -101,9 +101,9 @@ int master_add_autofs_point(struct master_mapent *entry, unsigned logopt,
|
|
||||
ap->negative_timeout = global_negative_timeout; |
|
||||
ap->exp_timeout = defaults_get_timeout(); |
|
||||
ap->exp_runfreq = 0; |
|
||||
- ap->flags = 0;
|
|
||||
+ ap->flags = MOUNT_FLAG_IGNORE;
|
|
||||
if (ghost) |
|
||||
- ap->flags = MOUNT_FLAG_GHOST;
|
|
||||
+ ap->flags |= MOUNT_FLAG_GHOST;
|
|
||||
|
|
||||
if (nobind) |
|
||||
ap->flags |= MOUNT_FLAG_NOBIND; |
|
@ -1,188 +0,0 @@ |
|||||
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(-) |
|
||||
|
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
|
||||
index b3c3b3b9..c2a0c7f1 100644
|
|
||||
--- a/CHANGELOG
|
|
||||
+++ b/CHANGELOG
|
|
||||
@@ -3,6 +3,7 @@ xx/xx/2019 autofs-5.1.6
|
|
||||
- fix hesiod string check in master_parse(). |
|
||||
- add NULL check for get_addr_string() return. |
|
||||
- use malloc(3) in spawn.c. |
|
||||
+- add mount_verbose configuration option.
|
|
||||
|
|
||||
30/10/2018 autofs-5.1.5 |
|
||||
- fix flag file permission. |
|
||||
diff --git a/daemon/spawn.c b/daemon/spawn.c
|
|
||||
index 2ab5c46f..4eb268ab 100644
|
|
||||
--- a/daemon/spawn.c
|
|
||||
+++ b/daemon/spawn.c
|
|
||||
@@ -558,12 +558,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; |
|
||||
|
|
||||
@@ -590,8 +592,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]; |
|
||||
@@ -604,12 +608,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 *); |
|
||||
diff --git a/include/defaults.h b/include/defaults.h
|
|
||||
index b28fde34..baa4b4c9 100644
|
|
||||
--- a/include/defaults.h
|
|
||||
+++ b/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(void);
|
|
||||
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); |
|
||||
diff --git a/lib/defaults.c b/lib/defaults.c
|
|
||||
index ae4d27c1..4ac5a180 100644
|
|
||||
--- a/lib/defaults.c
|
|
||||
+++ b/lib/defaults.c
|
|
||||
@@ -68,6 +68,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" |
|
||||
@@ -328,6 +329,11 @@ static int conf_load_autofs_defaults(void)
|
|
||||
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) |
|
||||
@@ -1781,6 +1787,17 @@ unsigned int defaults_get_append_options(void)
|
|
||||
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) |
|
||||
{ |
|
||||
long wait; |
|
||||
diff --git a/man/autofs.conf.5.in b/man/autofs.conf.5.in
|
|
||||
index cd7fc2f2..31136e2e 100644
|
|
||||
--- a/man/autofs.conf.5.in
|
|
||||
+++ b/man/autofs.conf.5.in
|
|
||||
@@ -41,6 +41,10 @@ Set the default timeout for caching failed key lookups (program default
|
|
||||
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) |
|
||||
diff --git a/redhat/autofs.conf.default.in b/redhat/autofs.conf.default.in
|
|
||||
index a72a79f6..7949f51a 100644
|
|
||||
--- a/redhat/autofs.conf.default.in
|
|
||||
+++ b/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 |
|
||||
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
|
|
||||
index 2693a975..d33625f1 100644
|
|
||||
--- a/samples/autofs.conf.default.in
|
|
||||
+++ b/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 |
|
@ -1,215 +0,0 @@ |
|||||
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 | 3 +++ |
|
||||
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, 47 insertions(+), 1 deletion(-) |
|
||||
|
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
|
||||
index ca036f19..f671dc52 100644
|
|
||||
--- a/CHANGELOG
|
|
||||
+++ b/CHANGELOG
|
|
||||
@@ -1,3 +1,6 @@
|
|
||||
+xx/xx/2019 autofs-5.1.6
|
|
||||
+- support strictexpire mount option.
|
|
||||
+
|
|
||||
30/10/2018 autofs-5.1.5 |
|
||||
- fix flag file permission. |
|
||||
- fix directory create permission. |
|
||||
diff --git a/daemon/direct.c b/daemon/direct.c
|
|
||||
index b885d12f..9c61c4b4 100644
|
|
||||
--- a/daemon/direct.c
|
|
||||
+++ b/daemon/direct.c
|
|
||||
@@ -421,6 +421,16 @@ int do_mount_autofs_direct(struct autofs_point *ap,
|
|
||||
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 */ |
|
||||
diff --git a/daemon/indirect.c b/daemon/indirect.c
|
|
||||
index 438a0a21..d0724293 100644
|
|
||||
--- a/daemon/indirect.c
|
|
||||
+++ b/daemon/indirect.c
|
|
||||
@@ -132,6 +132,16 @@ static int do_mount_autofs_indirect(struct autofs_point *ap, const char *root)
|
|
||||
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, mp_mode) < 0) { |
|
||||
if (errno != EEXIST && errno != EROFS) { |
|
||||
diff --git a/include/automount.h b/include/automount.h
|
|
||||
index 947daa10..1bb32015 100644
|
|
||||
--- a/include/automount.h
|
|
||||
+++ b/include/automount.h
|
|
||||
@@ -554,6 +554,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 */ |
|
||||
diff --git a/lib/master_parse.y b/lib/master_parse.y
|
|
||||
index 9aa57327..8fe8b128 100644
|
|
||||
--- a/lib/master_parse.y
|
|
||||
+++ b/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; |
|
||||
@@ -105,7 +106,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 OPT_MODE |
|
||||
-%token OPT_SLAVE OPT_PRIVATE
|
|
||||
+%token OPT_STRICTEXPIRE OPT_SLAVE OPT_PRIVATE
|
|
||||
%token COLON COMMA NL DDASH |
|
||||
%type <strtype> map |
|
||||
%type <strtype> options |
|
||||
@@ -206,6 +207,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; } |
|
||||
@@ -619,6 +621,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; } |
|
||||
@@ -693,6 +696,7 @@ static void local_init_vars(void)
|
|
||||
timeout = -1; |
|
||||
negative_timeout = 0; |
|
||||
symlnk = 0; |
|
||||
+ strictexpire = 0;
|
|
||||
slave = 0; |
|
||||
private = 0; |
|
||||
nobind = 0; |
|
||||
@@ -901,6 +905,8 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne
|
|
||||
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) |
|
||||
diff --git a/lib/master_tok.l b/lib/master_tok.l
|
|
||||
index f4e940ce..7486710b 100644
|
|
||||
--- a/lib/master_tok.l
|
|
||||
+++ b/lib/master_tok.l
|
|
||||
@@ -391,6 +391,7 @@ MODE (--mode{OPTWS}|--mode{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); } |
|
||||
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
|
|
||||
index 68242d45..dace4a1c 100644
|
|
||||
--- a/man/auto.master.5.in
|
|
||||
+++ b/man/auto.master.5.in
|
|
||||
@@ -199,6 +199,14 @@ entries only, either in the master map (so it effects all map entries)
|
|
||||
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 |
|
||||
diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c
|
|
||||
index cd0631b8..72e1aba4 100644
|
|
||||
--- a/modules/mount_autofs.c
|
|
||||
+++ b/modules/mount_autofs.c
|
|
||||
@@ -57,6 +57,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
|
|
||||
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, const char *root, const char *name,
|
|
||||
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, const char *root, const char *name,
|
|
||||
nap->parent = ap; |
|
||||
if (symlnk) |
|
||||
nap->flags |= MOUNT_FLAG_SYMLINK; |
|
||||
+ if (strictexpire)
|
|
||||
+ nap->flags |= MOUNT_FLAG_STRICTEXPIRE;
|
|
||||
|
|
||||
if (hosts) |
|
||||
argc = 0; |
|
@ -1,52 +0,0 @@ |
|||||
autofs-5.1.5 - fix hesiod string check in master_parse() |
|
||||
|
|
||||
From: Ian Kent <raven@themaw.net> |
|
||||
|
|
||||
When map source is specified in a master map entry, checking if |
|
||||
map type is hesiod in master_parse() will generate a SEGV if a |
|
||||
parser type is not also present becuase tmp will be NULL in this |
|
||||
case. |
|
||||
|
|
||||
Signed-off-by: Ian Kent <raven@themaw.net> |
|
||||
---
|
|
||||
CHANGELOG | 1 + |
|
||||
lib/master_parse.y | 8 ++++---- |
|
||||
2 files changed, 5 insertions(+), 4 deletions(-) |
|
||||
|
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
|
||||
index f671dc52..76da2ee4 100644
|
|
||||
--- a/CHANGELOG
|
|
||||
+++ b/CHANGELOG
|
|
||||
@@ -1,5 +1,6 @@
|
|
||||
xx/xx/2019 autofs-5.1.6 |
|
||||
- support strictexpire mount option. |
|
||||
+- fix hesiod string check in master_parse().
|
|
||||
|
|
||||
30/10/2018 autofs-5.1.5 |
|
||||
- fix flag file permission. |
|
||||
diff --git a/lib/master_parse.y b/lib/master_parse.y
|
|
||||
index 8fe8b128..f817f739 100644
|
|
||||
--- a/lib/master_parse.y
|
|
||||
+++ b/lib/master_parse.y
|
|
||||
@@ -173,8 +173,8 @@ line:
|
|
||||
if ((tmp = strchr($2, ','))) |
|
||||
*tmp++ = '\0'; |
|
||||
#ifndef WITH_HESIOD |
|
||||
- /* Map type or or map type parser is hesiod */
|
|
||||
- if (!strcmp($2, "hesiod") || !strcmp(tmp, "hesiod")) {
|
|
||||
+ /* Map type or map type parser is hesiod */
|
|
||||
+ if (!strcmp($2, "hesiod") || (tmp && !strcmp(tmp, "hesiod"))) {
|
|
||||
master_error("hesiod support not built in"); |
|
||||
local_free_vars(); |
|
||||
YYABORT; |
|
||||
@@ -362,8 +362,8 @@ map: PATH
|
|
||||
if ((tmp = strchr($1, ','))) |
|
||||
*tmp++ = '\0'; |
|
||||
#ifndef WITH_HESIOD |
|
||||
- /* Map type or or map type parser is hesiod */
|
|
||||
- if (!strcmp($1, "hesiod") || !strcmp(tmp, "hesiod")) {
|
|
||||
+ /* Map type or map type parser is hesiod */
|
|
||||
+ if (!strcmp($1, "hesiod") || (tmp && !strcmp(tmp, "hesiod"))) {
|
|
||||
master_error("hesiod support not built in"); |
|
||||
local_free_vars(); |
|
||||
YYABORT; |
|
@ -1,234 +0,0 @@ |
|||||
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 | 10 +++++++--- |
|
||||
modules/mount_ext2.c | 16 ++++++++++------ |
|
||||
modules/mount_generic.c | 14 +++++++++----- |
|
||||
modules/mount_nfs.c | 29 +++++++++++++++++------------ |
|
||||
6 files changed, 49 insertions(+), 27 deletions(-) |
|
||||
|
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
|
||||
index ee7deda4..5650e73b 100644
|
|
||||
--- a/CHANGELOG
|
|
||||
+++ b/CHANGELOG
|
|
||||
@@ -5,6 +5,7 @@ xx/xx/2019 autofs-5.1.6
|
|
||||
- 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.
|
|
||||
|
|
||||
30/10/2018 autofs-5.1.5 |
|
||||
- fix flag file permission. |
|
||||
diff --git a/modules/mount_afs.c b/modules/mount_afs.c
|
|
||||
index 2a776bd2..ef4e04da 100644
|
|
||||
--- a/modules/mount_afs.c
|
|
||||
+++ b/modules/mount_afs.c
|
|
||||
@@ -37,10 +37,14 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
|
||||
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, const char *root, const char *name, int
|
|
||||
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. */ |
|
||||
} |
|
||||
diff --git a/modules/mount_bind.c b/modules/mount_bind.c
|
|
||||
index b64cdccc..9cba0d7a 100644
|
|
||||
--- a/modules/mount_bind.c
|
|
||||
+++ b/modules/mount_bind.c
|
|
||||
@@ -81,10 +81,14 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
|
||||
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,9 +168,9 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
|
||||
if (!status) |
|
||||
existed = 0; |
|
||||
|
|
||||
- debug(ap->logopt, MODPREFIX
|
|
||||
- "calling mount --bind -o %s %s %s",
|
|
||||
- options, what, fullpath);
|
|
||||
+ mountlog(ap->logopt, MODPREFIX
|
|
||||
+ "calling mount --bind -o %s %s %s",
|
|
||||
+ options, what, fullpath);
|
|
||||
|
|
||||
err = spawn_bind_mount(ap->logopt, "-o", |
|
||||
options, what, fullpath, NULL); |
|
||||
diff --git a/modules/mount_ext2.c b/modules/mount_ext2.c
|
|
||||
index 3bbea95a..eb28b06c 100644
|
|
||||
--- a/modules/mount_ext2.c
|
|
||||
+++ b/modules/mount_ext2.c
|
|
||||
@@ -47,10 +47,14 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
|
||||
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, const char *root, const char *name, int
|
|
||||
} |
|
||||
|
|
||||
if (options) { |
|
||||
- debug(ap->logopt, MODPREFIX
|
|
||||
- "calling mount -t %s -o %s %s %s",
|
|
||||
- fstype, options, what, fullpath);
|
|
||||
+ mountlog(ap->logopt, MODPREFIX
|
|
||||
+ "calling mount -t %s -o %s %s %s",
|
|
||||
+ fstype, options, what, fullpath);
|
|
||||
err = spawn_mount(ap->logopt, "-t", fstype, |
|
||||
"-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); |
|
||||
} |
|
||||
|
|
||||
diff --git a/modules/mount_generic.c b/modules/mount_generic.c
|
|
||||
index b1a3adbf..cf531145 100644
|
|
||||
--- a/modules/mount_generic.c
|
|
||||
+++ b/modules/mount_generic.c
|
|
||||
@@ -46,10 +46,14 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
|
||||
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, const char *root, const char *name, int
|
|
||||
existed = 0; |
|
||||
|
|
||||
if (options && options[0]) { |
|
||||
- debug(ap->logopt,
|
|
||||
- MODPREFIX "calling mount -t %s -o %s %s %s",
|
|
||||
- fstype, options, what, fullpath);
|
|
||||
+ mountlog(ap->logopt,
|
|
||||
+ MODPREFIX "calling mount -t %s -o %s %s %s",
|
|
||||
+ fstype, options, what, fullpath);
|
|
||||
|
|
||||
err = spawn_mount(ap->logopt, "-t", fstype, |
|
||||
"-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); |
|
||||
} |
|
||||
|
|
||||
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
|
|
||||
index 295c4a5d..4e3e703f 100644
|
|
||||
--- a/modules/mount_nfs.c
|
|
||||
+++ b/modules/mount_nfs.c
|
|
||||
@@ -77,13 +77,17 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
|
||||
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_DEFAULT | NFS_PROTO_DEFAULT; |
|
||||
@@ -203,9 +207,9 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
|
||||
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)) { |
|
||||
@@ -379,17 +383,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); |
|
||||
} |
|
@ -1,171 +0,0 @@ |
|||||
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(-) |
|
||||
|
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
|
||||
index c2a0c7f1..ee7deda4 100644
|
|
||||
--- a/CHANGELOG
|
|
||||
+++ b/CHANGELOG
|
|
||||
@@ -4,6 +4,7 @@ xx/xx/2019 autofs-5.1.6
|
|
||||
- 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.
|
|
||||
|
|
||||
30/10/2018 autofs-5.1.5 |
|
||||
- fix flag file permission. |
|
||||
diff --git a/daemon/direct.c b/daemon/direct.c
|
|
||||
index 9c61c4b4..4f468563 100644
|
|
||||
--- a/daemon/direct.c
|
|
||||
+++ b/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, |
|
||||
diff --git a/daemon/indirect.c b/daemon/indirect.c
|
|
||||
index d0724293..9ccbc038 100644
|
|
||||
--- a/daemon/indirect.c
|
|
||||
+++ b/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"); |
|
||||
diff --git a/include/log.h b/include/log.h
|
|
||||
index c9b17b3c..69eed96b 100644
|
|
||||
--- a/include/log.h
|
|
||||
+++ b/include/log.h
|
|
||||
@@ -46,6 +46,8 @@ extern void log_crit(unsigned, const char* msg, ...);
|
|
||||
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) |
|
||||
|
|
||||
diff --git a/lib/log.c b/lib/log.c
|
|
||||
index ca771d72..0cb47d7e 100644
|
|
||||
--- a/lib/log.c
|
|
||||
+++ b/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;
|
|
||||
+}
|
|
||||
diff --git a/man/autofs.conf.5.in b/man/autofs.conf.5.in
|
|
||||
index 31136e2e..95ff7dd0 100644
|
|
||||
--- a/man/autofs.conf.5.in
|
|
||||
+++ b/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 |
|
||||
diff --git a/redhat/autofs.conf.default.in b/redhat/autofs.conf.default.in
|
|
||||
index 7949f51a..4b89a5f7 100644
|
|
||||
--- a/redhat/autofs.conf.default.in
|
|
||||
+++ b/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 |
|
||||
# |
|
||||
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
|
|
||||
index d33625f1..2f155111 100644
|
|
||||
--- a/samples/autofs.conf.default.in
|
|
||||
+++ b/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 |
|
||||
# |
|
@ -1,165 +0,0 @@ |
|||||
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(-) |
|
||||
|
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
|
||||
index e71e913a..b3c3b3b9 100644
|
|
||||
--- a/CHANGELOG
|
|
||||
+++ b/CHANGELOG
|
|
||||
@@ -2,6 +2,7 @@ xx/xx/2019 autofs-5.1.6
|
|
||||
- support strictexpire mount option. |
|
||||
- fix hesiod string check in master_parse(). |
|
||||
- add NULL check for get_addr_string() return. |
|
||||
+- use malloc(3) in spawn.c.
|
|
||||
|
|
||||
30/10/2018 autofs-5.1.5 |
|
||||
- fix flag file permission. |
|
||||
diff --git a/daemon/spawn.c b/daemon/spawn.c
|
|
||||
index dbbca7fa..2ab5c46f 100644
|
|
||||
--- a/daemon/spawn.c
|
|
||||
+++ b/daemon/spawn.c
|
|
||||
@@ -521,22 +521,33 @@ int spawnv(unsigned logopt, const char *prog, const char *const *argv)
|
|
||||
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, ...) |
|
||||
@@ -554,6 +565,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 |
|
||||
@@ -579,8 +591,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; |
|
||||
|
|
||||
@@ -655,6 +674,7 @@ int spawn_mount(unsigned logopt, ...)
|
|
||||
umount(argv[argc]); |
|
||||
ret = MNT_FORCE_FAIL; |
|
||||
} |
|
||||
+ free(argv);
|
|
||||
|
|
||||
return ret; |
|
||||
} |
|
||||
@@ -683,6 +703,7 @@ int spawn_bind_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 |
|
||||
@@ -711,8 +732,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; |
|
||||
@@ -774,6 +802,7 @@ int spawn_bind_mount(unsigned logopt, ...)
|
|
||||
umount(argv[argc]); |
|
||||
ret = MNT_FORCE_FAIL; |
|
||||
} |
|
||||
+ free(argv);
|
|
||||
|
|
||||
return ret; |
|
||||
} |
|
||||
@@ -796,6 +825,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; |
|
||||
@@ -821,8 +851,15 @@ int spawn_umount(unsigned logopt, ...)
|
|
||||
if (arg_c) |
|
||||
argc++;; |
|
||||
|
|
||||
- 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);
|
|
||||
|
|
||||
p = argv; |
|
||||
*p++ = arg0; |
|
||||
@@ -870,6 +907,7 @@ int spawn_umount(unsigned logopt, ...)
|
|
||||
"and /etc/mtab will differ"); |
|
||||
ret = 0; |
|
||||
} |
|
||||
+ free(argv);
|
|
||||
|
|
||||
return ret; |
|
||||
} |
|
@ -1,9 +0,0 @@ |
|||||
autofs-5.1.5-add-strictexpire-mount-option.patch |
|
||||
autofs-5.1.5-fix-hesiod-string-check-in-master_parse.patch |
|
||||
autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch |
|
||||
autofs-5.1.5-use-malloc-in-spawn_c.patch |
|
||||
autofs-5.1.5-add-mount_verbose-configuration-option.patch |
|
||||
autofs-5.1.5-optionally-log-mount-requestor-process-info.patch |
|
||||
autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch |
|
||||
autofs-5.1.5-add-ignore-mount-option.patch |
|
||||
autofs-5.1.5-Fix-NFS-mount-from-IPv6-addresses.patch |
|
Loading…
Reference in new issue