|
|
9a499a |
autofs-5.1.7 - pass root length to mount_fullpath()
|
|
|
9a499a |
|
|
|
9a499a |
From: Ian Kent <raven@themaw.net>
|
|
|
9a499a |
|
|
|
9a499a |
The length of root may already be known, add a parameter to allow
|
|
|
9a499a |
passing it to mount_fullpath() so a strlen() call can be avoided.
|
|
|
9a499a |
|
|
|
9a499a |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
9a499a |
---
|
|
|
9a499a |
CHANGELOG | 1 +
|
|
|
9a499a |
include/mounts.h | 2 +-
|
|
|
9a499a |
lib/mounts.c | 11 +++++++----
|
|
|
9a499a |
modules/mount_bind.c | 2 +-
|
|
|
9a499a |
modules/mount_changer.c | 2 +-
|
|
|
9a499a |
modules/mount_ext2.c | 2 +-
|
|
|
9a499a |
modules/mount_generic.c | 2 +-
|
|
|
9a499a |
modules/mount_nfs.c | 2 +-
|
|
|
9a499a |
modules/parse_sun.c | 4 ++--
|
|
|
9a499a |
9 files changed, 16 insertions(+), 12 deletions(-)
|
|
|
9a499a |
|
|
|
9a499a |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
9a499a |
+++ autofs-5.1.4/CHANGELOG
|
|
|
9a499a |
@@ -44,6 +44,7 @@
|
|
|
9a499a |
- remove obsolete functions.
|
|
|
9a499a |
- remove redundant local var from sun_mount().
|
|
|
9a499a |
- use mount_fullpath() in one spot in parse_mount().
|
|
|
9a499a |
+- pass root length to mount_fullpath().
|
|
|
9a499a |
|
|
|
9a499a |
xx/xx/2018 autofs-5.1.5
|
|
|
9a499a |
- fix flag file permission.
|
|
|
9a499a |
--- autofs-5.1.4.orig/include/mounts.h
|
|
|
9a499a |
+++ autofs-5.1.4/include/mounts.h
|
|
|
9a499a |
@@ -131,7 +131,7 @@ int check_nfs_mount_version(struct nfs_m
|
|
|
9a499a |
extern unsigned int nfs_mount_uses_string_options;
|
|
|
9a499a |
|
|
|
9a499a |
int mount_fullpath(char *fullpath, size_t max_len,
|
|
|
9a499a |
- const char *root, const char *name);
|
|
|
9a499a |
+ const char *root, size_t root_len, const char *name);
|
|
|
9a499a |
|
|
|
9a499a |
struct amd_entry;
|
|
|
9a499a |
|
|
|
9a499a |
--- autofs-5.1.4.orig/lib/mounts.c
|
|
|
9a499a |
+++ autofs-5.1.4/lib/mounts.c
|
|
|
9a499a |
@@ -362,11 +362,14 @@ int check_nfs_mount_version(struct nfs_m
|
|
|
9a499a |
#endif
|
|
|
9a499a |
|
|
|
9a499a |
int mount_fullpath(char *fullpath, size_t max_len,
|
|
|
9a499a |
- const char *root, const char *name)
|
|
|
9a499a |
+ const char *root, size_t root_len, const char *name)
|
|
|
9a499a |
{
|
|
|
9a499a |
int last, len;
|
|
|
9a499a |
|
|
|
9a499a |
- last = strlen(root) - 1;
|
|
|
9a499a |
+ if (root_len)
|
|
|
9a499a |
+ last = root_len - 1;
|
|
|
9a499a |
+ else
|
|
|
9a499a |
+ last = strlen(root) - 1;
|
|
|
9a499a |
|
|
|
9a499a |
/* Root offset of multi-mount or direct or offset mount.
|
|
|
9a499a |
* Direct or offset mount, name (or root) is absolute path.
|
|
|
9a499a |
@@ -1685,7 +1688,7 @@ void tree_mapent_cleanup_offsets(struct
|
|
|
9a499a |
else {
|
|
|
9a499a |
char mp[PATH_MAX + 1];
|
|
|
9a499a |
|
|
|
9a499a |
- if (!mount_fullpath(mp, PATH_MAX, ap->path, oe->key))
|
|
|
9a499a |
+ if (!mount_fullpath(mp, PATH_MAX, ap->path, ap->len, oe->key))
|
|
|
9a499a |
error(ap->logopt, "mount path is too long");
|
|
|
9a499a |
else
|
|
|
9a499a |
tree_mapent_umount_mount(ap, mp);
|
|
|
9a499a |
@@ -1922,7 +1925,7 @@ int tree_mapent_umount_offsets(struct ma
|
|
|
9a499a |
* one of these keys is the root of a multi-mount the mount
|
|
|
9a499a |
* path must be constructed.
|
|
|
9a499a |
*/
|
|
|
9a499a |
- if (!mount_fullpath(mp, PATH_MAX, ap->path, oe->key)) {
|
|
|
9a499a |
+ if (!mount_fullpath(mp, PATH_MAX, ap->path, ap->len, oe->key)) {
|
|
|
9a499a |
error(ap->logopt, "mount path is too long");
|
|
|
9a499a |
return 0;
|
|
|
9a499a |
}
|
|
|
9a499a |
--- autofs-5.1.4.orig/modules/mount_bind.c
|
|
|
9a499a |
+++ autofs-5.1.4/modules/mount_bind.c
|
|
|
9a499a |
@@ -122,7 +122,7 @@ int mount_mount(struct autofs_point *ap,
|
|
|
9a499a |
}
|
|
|
9a499a |
}
|
|
|
9a499a |
|
|
|
9a499a |
- len = mount_fullpath(fullpath, PATH_MAX, root, name);
|
|
|
9a499a |
+ len = mount_fullpath(fullpath, PATH_MAX, root, 0, name);
|
|
|
9a499a |
if (!len) {
|
|
|
9a499a |
error(ap->logopt,
|
|
|
9a499a |
MODPREFIX "mount point path too long");
|
|
|
9a499a |
--- autofs-5.1.4.orig/modules/mount_changer.c
|
|
|
9a499a |
+++ autofs-5.1.4/modules/mount_changer.c
|
|
|
9a499a |
@@ -59,7 +59,7 @@ int mount_mount(struct autofs_point *ap,
|
|
|
9a499a |
|
|
|
9a499a |
fstype = "iso9660";
|
|
|
9a499a |
|
|
|
9a499a |
- len = mount_fullpath(fullpath, PATH_MAX, root, name);
|
|
|
9a499a |
+ len = mount_fullpath(fullpath, PATH_MAX, root, 0, name);
|
|
|
9a499a |
if (!len) {
|
|
|
9a499a |
error(ap->logopt,
|
|
|
9a499a |
MODPREFIX "mount point path too long");
|
|
|
9a499a |
--- autofs-5.1.4.orig/modules/mount_ext2.c
|
|
|
9a499a |
+++ autofs-5.1.4/modules/mount_ext2.c
|
|
|
9a499a |
@@ -55,7 +55,7 @@ int mount_mount(struct autofs_point *ap,
|
|
|
9a499a |
if (defaults_get_mount_verbose())
|
|
|
9a499a |
mountlog = &log_info;
|
|
|
9a499a |
|
|
|
9a499a |
- len = mount_fullpath(fullpath, PATH_MAX, root, name);
|
|
|
9a499a |
+ len = mount_fullpath(fullpath, PATH_MAX, root, 0, name);
|
|
|
9a499a |
if (!len) {
|
|
|
9a499a |
error(ap->logopt,
|
|
|
9a499a |
MODPREFIX "mount point path too long");
|
|
|
9a499a |
--- autofs-5.1.4.orig/modules/mount_generic.c
|
|
|
9a499a |
+++ autofs-5.1.4/modules/mount_generic.c
|
|
|
9a499a |
@@ -54,7 +54,7 @@ int mount_mount(struct autofs_point *ap,
|
|
|
9a499a |
if (defaults_get_mount_verbose())
|
|
|
9a499a |
mountlog = &log_info;
|
|
|
9a499a |
|
|
|
9a499a |
- len = mount_fullpath(fullpath, PATH_MAX, root, name);
|
|
|
9a499a |
+ len = mount_fullpath(fullpath, PATH_MAX, root, 0, name);
|
|
|
9a499a |
if (!len) {
|
|
|
9a499a |
error(ap->logopt,
|
|
|
9a499a |
MODPREFIX "mount point path too long");
|
|
|
9a499a |
--- autofs-5.1.4.orig/modules/mount_nfs.c
|
|
|
9a499a |
+++ autofs-5.1.4/modules/mount_nfs.c
|
|
|
9a499a |
@@ -213,7 +213,7 @@ int mount_mount(struct autofs_point *ap,
|
|
|
9a499a |
}
|
|
|
9a499a |
|
|
|
9a499a |
/* Construct mount point directory */
|
|
|
9a499a |
- len = mount_fullpath(fullpath, PATH_MAX, root, name);
|
|
|
9a499a |
+ len = mount_fullpath(fullpath, PATH_MAX, root, 0, name);
|
|
|
9a499a |
if (!len) {
|
|
|
9a499a |
error(ap->logopt,
|
|
|
9a499a |
MODPREFIX "mount point path too long");
|
|
|
9a499a |
--- autofs-5.1.4.orig/modules/parse_sun.c
|
|
|
9a499a |
+++ autofs-5.1.4/modules/parse_sun.c
|
|
|
9a499a |
@@ -1091,7 +1091,7 @@ static int mount_subtree(struct autofs_p
|
|
|
9a499a |
struct mapent *ro;
|
|
|
9a499a |
size_t len;
|
|
|
9a499a |
|
|
|
9a499a |
- len = mount_fullpath(key, PATH_MAX, ap->path, me->key);
|
|
|
9a499a |
+ len = mount_fullpath(key, PATH_MAX, ap->path, ap->len, me->key);
|
|
|
9a499a |
if (!len) {
|
|
|
9a499a |
warn(ap->logopt, "path loo long");
|
|
|
9a499a |
return 1;
|
|
|
9a499a |
@@ -1361,7 +1361,7 @@ dont_expand:
|
|
|
9a499a |
time_t age;
|
|
|
9a499a |
int l;
|
|
|
9a499a |
|
|
|
9a499a |
- m_root_len = mount_fullpath(m_root, PATH_MAX, ap->path, name);
|
|
|
9a499a |
+ m_root_len = mount_fullpath(m_root, PATH_MAX, ap->path, ap->len, name);
|
|
|
9a499a |
if (!m_root_len) {
|
|
|
9a499a |
error(ap->logopt,
|
|
|
9a499a |
MODPREFIX "multi-mount root path too long");
|