From 8d15a8fe054809b91cf4c8962234c8caa60c56a2 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 11 2020 22:13:13 +0000 Subject: Apply patch autofs-5.1.4-fix-directory-create-permission.patch patch_name: autofs-5.1.4-fix-directory-create-permission.patch present_in_specfile: true --- diff --git a/CHANGELOG b/CHANGELOG index d07d88c..4faab51 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ xx/xx/2018 autofs-5.1.5 - fix flag file permission. +- fix directory create permission. 19/12/2017 autofs-5.1.4 - fix spec file url. diff --git a/daemon/automount.c b/daemon/automount.c index 5c73961..dcdc19f 100644 --- a/daemon/automount.c +++ b/daemon/automount.c @@ -51,6 +51,8 @@ const char *libdir = AUTOFS_LIB_DIR; /* Location of library modules */ const char *mapdir = AUTOFS_MAP_DIR; /* Location of mount maps */ const char *confdir = AUTOFS_CONF_DIR; /* Location of autofs config file */ +unsigned int mp_mode = 0755; + unsigned int nfs_mount_uses_string_options = 0; static struct nfs_mount_vers vers, check = {1, 1, 1}; diff --git a/daemon/direct.c b/daemon/direct.c index 9a13435..3fdecdb 100644 --- a/daemon/direct.c +++ b/daemon/direct.c @@ -424,7 +424,7 @@ int do_mount_autofs_direct(struct autofs_point *ap, } /* In case the directory doesn't exist, try to mkdir it */ - if (mkdir_path(me->key, 0555) < 0) { + if (mkdir_path(me->key, mp_mode) < 0) { if (errno != EEXIST && errno != EROFS) { crit(ap->logopt, "failed to create mount directory %s", me->key); @@ -739,7 +739,7 @@ int mount_autofs_offset(struct autofs_point *ap, struct mapent *me, const char * strcat(mountpoint, offset); /* In case the directory doesn't exist, try to mkdir it */ - if (mkdir_path(mountpoint, 0555) < 0) { + if (mkdir_path(mountpoint, mp_mode) < 0) { if (errno == EEXIST) { /* * If the mount point directory is a real mount diff --git a/daemon/indirect.c b/daemon/indirect.c index ffb11b8..03c081e 100644 --- a/daemon/indirect.c +++ b/daemon/indirect.c @@ -133,7 +133,7 @@ static int do_mount_autofs_indirect(struct autofs_point *ap, const char *root) } /* In case the directory doesn't exist, try to mkdir it */ - if (mkdir_path(root, 0555) < 0) { + if (mkdir_path(root, mp_mode) < 0) { if (errno != EEXIST && errno != EROFS) { crit(ap->logopt, "failed to create autofs directory %s", diff --git a/daemon/lookup.c b/daemon/lookup.c index cb67e7d..6a722b3 100644 --- a/daemon/lookup.c +++ b/daemon/lookup.c @@ -802,7 +802,7 @@ int lookup_ghost(struct autofs_point *ap, const char *root) goto next; } - ret = mkdir_path(fullpath, 0555); + ret = mkdir_path(fullpath, mp_mode); if (ret < 0 && errno != EEXIST) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); warn(ap->logopt, diff --git a/include/automount.h b/include/automount.h index 2e2c2b0..e5c19d2 100644 --- a/include/automount.h +++ b/include/automount.h @@ -269,6 +269,7 @@ void reset_signals(void); int do_mount(struct autofs_point *ap, const char *root, const char *name, int name_len, const char *what, const char *fstype, const char *options); +extern unsigned int mp_mode; int mkdir_path(const char *path, mode_t mode); int rmdir_path(struct autofs_point *ap, const char *path, dev_t dev); diff --git a/modules/mount_bind.c b/modules/mount_bind.c index 4864ea5..5effa88 100644 --- a/modules/mount_bind.c +++ b/modules/mount_bind.c @@ -151,7 +151,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); - status = mkdir_path(fullpath, 0555); + status = mkdir_path(fullpath, mp_mode); if (status && errno != EEXIST) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); error(ap->logopt, @@ -203,7 +203,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int } else { debug(ap->logopt, MODPREFIX "calling mkdir_path %s", basepath); - if (mkdir_path(basepath, 0555) && errno != EEXIST) { + if (mkdir_path(basepath, mp_mode) && errno != EEXIST) { char *estr; estr = strerror_r(errno, buf, MAX_ERR_BUF); error(ap->logopt, @@ -219,7 +219,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int "failed to create symlink %s -> %s", fullpath, what); if ((ap->flags & MOUNT_FLAG_GHOST) && !status) { - if (mkdir_path(fullpath, 0555) && errno != EEXIST) { + if (mkdir_path(fullpath, mp_mode) && errno != EEXIST) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); error(ap->logopt, MODPREFIX "mkdir_path %s failed: %s", diff --git a/modules/mount_changer.c b/modules/mount_changer.c index 798f23b..7d44a72 100644 --- a/modules/mount_changer.c +++ b/modules/mount_changer.c @@ -87,7 +87,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); - status = mkdir_path(fullpath, 0555); + status = mkdir_path(fullpath, mp_mode); if (status && errno != EEXIST) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); error(ap->logopt, diff --git a/modules/mount_ext2.c b/modules/mount_ext2.c index 90fc087..3bbea95 100644 --- a/modules/mount_ext2.c +++ b/modules/mount_ext2.c @@ -69,7 +69,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); - status = mkdir_path(fullpath, 0555); + status = mkdir_path(fullpath, mp_mode); if (status && errno != EEXIST) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); error(ap->logopt, diff --git a/modules/mount_generic.c b/modules/mount_generic.c index ae63787..b1a3adb 100644 --- a/modules/mount_generic.c +++ b/modules/mount_generic.c @@ -68,7 +68,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); - status = mkdir_path(fullpath, 0555); + status = mkdir_path(fullpath, mp_mode); if (status && errno != EEXIST) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); error(ap->logopt, diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c index bf712a9..7716654 100644 --- a/modules/mount_nfs.c +++ b/modules/mount_nfs.c @@ -277,7 +277,7 @@ dont_probe: debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); - status = mkdir_path(fullpath, 0555); + status = mkdir_path(fullpath, mp_mode); if (status && errno != EEXIST) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); error(ap->logopt, diff --git a/modules/parse_amd.c b/modules/parse_amd.c index b40c1ad..c4b3ef0 100644 --- a/modules/parse_amd.c +++ b/modules/parse_amd.c @@ -1288,7 +1288,7 @@ static int do_program_mount(struct autofs_point *ap, rv = 0; ext_mount_add(&entry->ext_mount, entry->fs, 1); } else { - rv = mkdir_path(entry->fs, 0555); + rv = mkdir_path(entry->fs, mp_mode); if (rv && errno != EEXIST) { char buf[MAX_ERR_BUF]; char *estr;