|
|
29d2b9 |
autofs-5.1.7 - fix mount_fullpath()
|
|
|
29d2b9 |
|
|
|
29d2b9 |
From: Ian Kent <raven@themaw.net>
|
|
|
29d2b9 |
|
|
|
29d2b9 |
mount_fullpath() incorrecly fills fullpath with the contents of root
|
|
|
29d2b9 |
when name[0] == '/'. The cases root[last] == '/' and name[0] == '/'
|
|
|
29d2b9 |
need to be handled seperately.
|
|
|
29d2b9 |
|
|
|
29d2b9 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
29d2b9 |
---
|
|
|
29d2b9 |
CHANGELOG | 1 +
|
|
|
29d2b9 |
lib/mounts.c | 4 +++-
|
|
|
29d2b9 |
modules/parse_amd.c | 6 ++++--
|
|
|
29d2b9 |
3 files changed, 8 insertions(+), 3 deletions(-)
|
|
|
29d2b9 |
|
|
|
29d2b9 |
diff --git a/CHANGELOG b/CHANGELOG
|
|
|
29d2b9 |
index 390028ac..e2fd532c 100644
|
|
|
29d2b9 |
--- a/CHANGELOG
|
|
|
29d2b9 |
+++ b/CHANGELOG
|
|
|
29d2b9 |
@@ -36,6 +36,7 @@
|
|
|
29d2b9 |
- add tree_mapent_add_node().
|
|
|
29d2b9 |
- add tree_mapent_delete_offsets().
|
|
|
29d2b9 |
- add tree_mapent_traverse_subtree().
|
|
|
29d2b9 |
+- fix mount_fullpath().
|
|
|
29d2b9 |
|
|
|
29d2b9 |
25/01/2021 autofs-5.1.7
|
|
|
29d2b9 |
- make bind mounts propagation slave by default.
|
|
|
29d2b9 |
diff --git a/lib/mounts.c b/lib/mounts.c
|
|
|
29d2b9 |
index fded4c09..497c28c9 100644
|
|
|
29d2b9 |
--- a/lib/mounts.c
|
|
|
29d2b9 |
+++ b/lib/mounts.c
|
|
|
29d2b9 |
@@ -371,8 +371,10 @@ int mount_fullpath(char *fullpath, size_t max_len,
|
|
|
29d2b9 |
/* Root offset of multi-mount or direct or offset mount.
|
|
|
29d2b9 |
* Direct or offset mount, name (or root) is absolute path.
|
|
|
29d2b9 |
*/
|
|
|
29d2b9 |
- if (root[last] == '/' || *name == '/')
|
|
|
29d2b9 |
+ if (root[last] == '/')
|
|
|
29d2b9 |
len = snprintf(fullpath, max_len, "%s", root);
|
|
|
29d2b9 |
+ else if (*name == '/')
|
|
|
29d2b9 |
+ len = snprintf(fullpath, max_len, "%s", name);
|
|
|
29d2b9 |
else
|
|
|
29d2b9 |
len = snprintf(fullpath, max_len, "%s/%s", root, name);
|
|
|
29d2b9 |
|
|
|
29d2b9 |
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
|
|
|
29d2b9 |
index 5a9079d6..64c1ce63 100644
|
|
|
29d2b9 |
--- a/modules/parse_amd.c
|
|
|
29d2b9 |
+++ b/modules/parse_amd.c
|
|
|
29d2b9 |
@@ -1177,7 +1177,8 @@ static int do_generic_mount(struct autofs_point *ap, const char *name,
|
|
|
29d2b9 |
* the automount filesystem.
|
|
|
29d2b9 |
*/
|
|
|
29d2b9 |
if (!is_mounted(entry->fs, MNTS_REAL)) {
|
|
|
29d2b9 |
- ret = do_mount(ap, entry->fs, "/", 1,
|
|
|
29d2b9 |
+ ret = do_mount(ap, entry->fs,
|
|
|
29d2b9 |
+ entry->fs, strlen(entry->fs),
|
|
|
29d2b9 |
target, entry->type, opts);
|
|
|
29d2b9 |
if (ret)
|
|
|
29d2b9 |
goto out;
|
|
|
29d2b9 |
@@ -1227,7 +1228,8 @@ static int do_nfs_mount(struct autofs_point *ap, const char *name,
|
|
|
29d2b9 |
mount_nfs->context);
|
|
|
29d2b9 |
} else {
|
|
|
29d2b9 |
if (!is_mounted(entry->fs, MNTS_REAL)) {
|
|
|
29d2b9 |
- ret = mount_nfs->mount_mount(ap, entry->fs, "/", 1,
|
|
|
29d2b9 |
+ ret = mount_nfs->mount_mount(ap, entry->fs,
|
|
|
29d2b9 |
+ entry->fs, strlen(entry->fs),
|
|
|
29d2b9 |
target, entry->type, opts,
|
|
|
29d2b9 |
mount_nfs->context);
|
|
|
29d2b9 |
if (ret)
|