diff --git a/SOURCES/autofs-5.1.4-change-expire-type-naming-to-better-reflect-usage.patch b/SOURCES/autofs-5.1.4-change-expire-type-naming-to-better-reflect-usage.patch new file mode 100644 index 0000000..f84b343 --- /dev/null +++ b/SOURCES/autofs-5.1.4-change-expire-type-naming-to-better-reflect-usage.patch @@ -0,0 +1,136 @@ +autofs-5.1.4 - change expire type naming to better reflect usage + +From: Ian Kent + +Expires can request different types of expire, currently normal or +immediate (and later force). + +Change the naming used in the expire functions to better indicate +usage. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 8 ++++---- + daemon/indirect.c | 8 ++++---- + daemon/state.c | 4 ++-- + include/state.h | 2 +- + 5 files changed, 12 insertions(+), 11 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -54,6 +54,7 @@ xx/xx/2018 autofs-5.1.5 + - allow period following macro in selector value. + - fix macro expansion in selector values. + - also use strictexpire for offsets. ++- change expire type naming to better reflect usage. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -861,7 +861,7 @@ void *expire_proc_direct(void *arg) + struct expire_args ec; + struct autofs_point *ap; + struct mapent *me = NULL; +- unsigned int now; ++ unsigned int how; + int ioctlfd, cur_state; + int status, ret, left; + +@@ -872,7 +872,7 @@ void *expire_proc_direct(void *arg) + fatal(status); + + ap = ec.ap = ea->ap; +- now = ea->when; ++ how = ea->how; + ec.status = -1; + + ea->signaled = 1; +@@ -966,7 +966,7 @@ void *expire_proc_direct(void *arg) + + ioctlfd = me->ioctlfd; + +- ret = ops->expire(ap->logopt, ioctlfd, next->path, now); ++ ret = ops->expire(ap->logopt, ioctlfd, next->path, how); + if (ret) { + left++; + pthread_setcancelstate(cur_state, NULL); +@@ -992,7 +992,7 @@ void *expire_proc_direct(void *arg) + debug(ap->logopt, "send expire to trigger %s", next->path); + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); +- ret = ops->expire(ap->logopt, ioctlfd, next->path, now); ++ ret = ops->expire(ap->logopt, ioctlfd, next->path, how); + if (ret) + left++; + pthread_setcancelstate(cur_state, NULL); +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -402,7 +402,7 @@ void *expire_proc_indirect(void *arg) + struct mnt_list *mnts = NULL, *next; + struct expire_args *ea; + struct expire_args ec; +- unsigned int now; ++ unsigned int how; + int offsets, submnts, count; + int retries; + int ioctlfd, cur_state; +@@ -415,7 +415,7 @@ void *expire_proc_indirect(void *arg) + fatal(status); + + ap = ec.ap = ea->ap; +- now = ea->when; ++ how = ea->how; + ec.status = -1; + + ea->signaled = 1; +@@ -540,7 +540,7 @@ void *expire_proc_indirect(void *arg) + debug(ap->logopt, "expire %s", next->path); + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); +- ret = ops->expire(ap->logopt, ioctlfd, next->path, now); ++ ret = ops->expire(ap->logopt, ioctlfd, next->path, how); + if (ret) + left++; + pthread_setcancelstate(cur_state, NULL); +@@ -554,7 +554,7 @@ void *expire_proc_indirect(void *arg) + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); + retries = (count_mounts(ap, ap->path, ap->dev) + 1); + while (retries--) { +- ret = ops->expire(ap->logopt, ap->ioctlfd, ap->path, now); ++ ret = ops->expire(ap->logopt, ap->ioctlfd, ap->path, how); + if (ret) + left++; + } +--- autofs-5.1.4.orig/daemon/state.c ++++ autofs-5.1.4/daemon/state.c +@@ -267,7 +267,7 @@ void expire_proc_cleanup(void *arg) + return; + } + +-static enum expire expire_proc(struct autofs_point *ap, int now) ++static enum expire expire_proc(struct autofs_point *ap, int how) + { + pthread_t thid; + struct expire_args *ea; +@@ -295,7 +295,7 @@ static enum expire expire_proc(struct au + fatal(status); + + ea->ap = ap; +- ea->when = now; ++ ea->how = how; + ea->status = 1; + + if (ap->type == LKP_INDIRECT) +--- autofs-5.1.4.orig/include/state.h ++++ autofs-5.1.4/include/state.h +@@ -55,7 +55,7 @@ struct expire_args { + unsigned int signaled; + struct autofs_point *ap; /* autofs mount we are working on */ + enum states state; /* State prune or expire */ +- unsigned int when; /* Immediate expire ? */ ++ unsigned int how; /* Normal, immediate expire ? */ + int status; /* Return status */ + }; + diff --git a/SOURCES/autofs-5.1.5-add-config-option-for-ignore-mount-option.patch b/SOURCES/autofs-5.1.5-add-config-option-for-ignore-mount-option.patch new file mode 100644 index 0000000..815393c --- /dev/null +++ b/SOURCES/autofs-5.1.5-add-config-option-for-ignore-mount-option.patch @@ -0,0 +1,155 @@ +autofs-5.1.5 - add config option for "ignore" mount option + +From: Ian Kent + +Add a configuration option to control whether the autofs pseudo +mount option is used on autofs mounts. + +The default setting is "no" to avoid unexpected behaviour and +so is an opt-in setting for those who understand that, if user +space utilities and libraries honour this, then autofs mounts +will be ommitted from mount table listings. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/defaults.h | 2 ++ + lib/defaults.c | 17 +++++++++++++++++ + lib/master.c | 3 ++- + man/autofs.conf.5.in | 7 +++++++ + redhat/autofs.conf.default.in | 9 +++++++++ + samples/autofs.conf.default.in | 9 +++++++++ + 7 files changed, 47 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -62,6 +62,7 @@ xx/xx/2018 autofs-5.1.5 + - fix unlink_mount_tree() not umounting mounts. + - add ignore mount option. + - use ignore option for offset mounts as well. ++- add config option for "ignore" mount option + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/include/defaults.h ++++ autofs-5.1.4/include/defaults.h +@@ -51,6 +51,7 @@ + + #define DEFAULT_USE_HOSTNAME_FOR_MOUNTS "0" + #define DEFAULT_DISABLE_NOT_FOUND_MESSAGE "0" ++#define DEFAULT_USE_IGNORE_MOUNT_OPTION "0" + + #define DEFAULT_SSS_MASTER_MAP_WAIT "0" + #define DEFAULT_USE_MOUNT_REQUEST_LOG_ID "0" +@@ -174,6 +175,7 @@ const char *defaults_get_auth_conf_file( + unsigned int defaults_get_map_hash_table_size(void); + unsigned int defaults_use_hostname_for_mounts(void); + unsigned int defaults_disable_not_found_message(void); ++unsigned int defaults_get_use_ignore_mount_option(void); + unsigned int defaults_get_sss_master_map_wait(void); + unsigned int defaults_get_use_mount_request_log_id(void); + +--- autofs-5.1.4.orig/lib/defaults.c ++++ autofs-5.1.4/lib/defaults.c +@@ -77,6 +77,7 @@ + + #define NAME_USE_HOSTNAME_FOR_MOUNTS "use_hostname_for_mounts" + #define NAME_DISABLE_NOT_FOUND_MESSAGE "disable_not_found_message" ++#define NAME_USE_IGNORE_MOUNT_OPTION "use_ignore_mount_option" + + #define NAME_SSS_MASTER_MAP_WAIT "sss_master_map_wait" + #define NAME_USE_MOUNT_REQUEST_LOG_ID "use_mount_request_log_id" +@@ -364,6 +365,11 @@ static int conf_load_autofs_defaults(voi + if (ret == CFG_FAIL) + goto error; + ++ ret = conf_update(sec, NAME_USE_IGNORE_MOUNT_OPTION, ++ DEFAULT_USE_IGNORE_MOUNT_OPTION, CONF_ENV); ++ if (ret == CFG_FAIL) ++ goto error; ++ + ret = conf_update(sec, NAME_SSS_MASTER_MAP_WAIT, + DEFAULT_SSS_MASTER_MAP_WAIT, CONF_ENV); + if (ret == CFG_FAIL) +@@ -1863,6 +1869,17 @@ unsigned int defaults_disable_not_found_ + + return res; + } ++ ++unsigned int defaults_get_use_ignore_mount_option(void) ++{ ++ int res; ++ ++ res = conf_get_yesno(autofs_gbl_sec, NAME_USE_IGNORE_MOUNT_OPTION); ++ if (res < 0) ++ res = atoi(DEFAULT_USE_IGNORE_MOUNT_OPTION); ++ ++ return res; ++} + + unsigned int defaults_get_sss_master_map_wait(void) + { +--- autofs-5.1.4.orig/lib/master.c ++++ autofs-5.1.4/lib/master.c +@@ -101,7 +101,8 @@ int master_add_autofs_point(struct maste + ap->negative_timeout = global_negative_timeout; + ap->exp_timeout = defaults_get_timeout(); + ap->exp_runfreq = 0; +- ap->flags = MOUNT_FLAG_IGNORE; ++ if (defaults_get_use_ignore_mount_option()) ++ ap->flags = MOUNT_FLAG_IGNORE; + if (ghost) + ap->flags |= MOUNT_FLAG_GHOST; + +--- autofs-5.1.4.orig/man/autofs.conf.5.in ++++ autofs-5.1.4/man/autofs.conf.5.in +@@ -151,6 +151,13 @@ That produces, IMHO, unnecessary noise i + has been added to provide the ability to turn it off. The default is "no" + to maintain the current behaviour. + .TP ++.B use_ignore_mount_option ++.br ++An option to enable the use of autofs pseudo option "disable". This option ++is used as a hint to user space that the mount entry should be ommitted from ++mount table listings. The default is "no" to avoid unexpected changes in ++behaviour and so is an opt-in setting. ++.TP + .B sss_master_map_wait + .br + Set the time to wait and retry if sssd returns "no such entry" when starting +--- autofs-5.1.4.orig/redhat/autofs.conf.default.in ++++ autofs-5.1.4/redhat/autofs.conf.default.in +@@ -183,6 +183,15 @@ mount_nfs_default_protocol = 4 + # + #disable_not_found_message = "no" + # ++# use_ignore_mount_option - This option is used to enable the use of autofs ++# pseudo option "disable". This option is used as a ++# hint to user space that the mount entry should be ++# ommitted from mount table listings. The default is ++# "no" to avoid unexpected changes in behaviour and ++# so is an opt-in setting. ++# ++#use_ignore_mount_option = no ++# + # sss_master_map_wait - When sssd is starting up it can sometimes return + # "no such entry" for a short time until it has read + # in the LDAP map information. Internal default is 0 +--- autofs-5.1.4.orig/samples/autofs.conf.default.in ++++ autofs-5.1.4/samples/autofs.conf.default.in +@@ -182,6 +182,15 @@ browse_mode = no + # + #disable_not_found_message = "no" + # ++# use_ignore_mount_option - This option is used to enable the use of autofs ++# pseudo option "disable". This option is used as a ++# hint to user space that the mount entry should be ++# ommitted from mount table listings. The default is ++# "no" to avoid unexpected changes in behaviour and ++# so is an opt-in setting. ++# ++#use_ignore_mount_option = no ++# + # sss_master_map_wait - When sssd is starting up it can sometimes return + # "no such entry" for a short time until it has read + # in the LDAP map information. Internal default is 0 diff --git a/SOURCES/autofs-5.1.5-add-glibc-getmntent.patch b/SOURCES/autofs-5.1.5-add-glibc-getmntent.patch new file mode 100644 index 0000000..162295d --- /dev/null +++ b/SOURCES/autofs-5.1.5-add-glibc-getmntent.patch @@ -0,0 +1,127 @@ +autofs-5.1.5 - add glibc getmntent_r() + +From: Ian Kent + +Add a slightly modified version of the glibc getmntent_r() function +so autofs can read the proc mount table directly. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + lib/mounts.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 96 insertions(+) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -66,6 +66,7 @@ xx/xx/2018 autofs-5.1.5 + - use bit flags for autofs mount types in mnt_list. + - use mp instead of path in mnt_list entries. + - always use PROC_MOUNTS to make mount lists. ++- add glibc getmntent_r(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -786,6 +786,101 @@ done: + return ret; + } + ++/* From glibc decode_name() */ ++/* Since the values in a line are separated by spaces, a name cannot ++ * contain a space. Therefore some programs encode spaces in names ++ * by the strings "\040". We undo the encoding when reading an entry. ++ * The decoding happens in place. ++ */ ++static char *local_decode_name(char *buf) ++{ ++ char *rp = buf; ++ char *wp = buf; ++ ++ do { ++ if (rp[0] == '\\' && rp[1] == '0' && ++ rp[2] == '4' && rp[3] == '0') { ++ /* \040 is a SPACE. */ ++ *wp++ = ' '; ++ rp += 3; ++ } else if (rp[0] == '\\' && rp[1] == '0' && ++ rp[2] == '1' && rp[3] == '1') { ++ /* \011 is a TAB. */ ++ *wp++ = '\t'; ++ rp += 3; ++ } else if (rp[0] == '\\' && rp[1] == '0' && ++ rp[2] == '1' && rp[3] == '2') { ++ /* \012 is a NEWLINE. */ ++ *wp++ = '\n'; ++ rp += 3; ++ } else if (rp[0] == '\\' && rp[1] == '\\') { ++ /* ++ * We have to escape \\ to be able to represent ++ * all characters. ++ */ ++ *wp++ = '\\'; ++ rp += 1; ++ } else if (rp[0] == '\\' && rp[1] == '1' && ++ rp[2] == '3' && rp[3] == '4') { ++ /* \134 is also \\. */ ++ *wp++ = '\\'; ++ rp += 3; ++ } else ++ *wp++ = *rp; ++ } while (*rp++ != '\0'); ++ ++ return buf; ++} ++ ++/* From glibc getmntent_r() */ ++static struct mntent * ++local_getmntent_r(FILE *tab, struct mntent *mnt, char *buf, int size) ++{ ++ char *cp, *head; ++ ++ do { ++ char *end_ptr; ++ ++ if (fgets(buf, size, tab) == NULL) ++ return 0; ++ ++ end_ptr = strchr(buf, '\n'); ++ if (end_ptr != NULL) { ++ while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t') ++ end_ptr--; ++ *end_ptr = '\0'; ++ } else { ++ /* Whole line was not read. Do it now but forget it. */ ++ char tmp[1024]; ++ while (fgets(tmp, sizeof tmp, tab) != NULL) ++ if (strchr(tmp, '\n') != NULL) ++ break; ++ } ++ ++ head = buf + strspn(buf, " \t"); ++ /* skip empty lines and comment lines */ ++ } while (head[0] == '\0' || head[0] == '#'); ++ ++ cp = strsep(&head, " \t"); ++ mnt->mnt_fsname = cp != NULL ? local_decode_name(cp) : (char *) ""; ++ if (head) ++ head += strspn(head, " \t"); ++ cp = strsep(&head, " \t"); ++ mnt->mnt_dir = cp != NULL ? local_decode_name (cp) : (char *) ""; ++ if (head) ++ head += strspn(head, " \t"); ++ cp = strsep(&head, " \t"); ++ mnt->mnt_type = cp != NULL ? local_decode_name (cp) : (char *) ""; ++ if (head) ++ head += strspn (head, " \t"); ++ cp = strsep (&head, " \t"); ++ mnt->mnt_opts = cp != NULL ? local_decode_name (cp) : (char *) ""; ++ ++ /* autofs doesn't need freq or passno */ ++ ++ return mnt; ++} ++ + /* + * Get list of mounts under path in longest->shortest order + */ diff --git a/SOURCES/autofs-5.1.5-add-ignore-mount-option.patch b/SOURCES/autofs-5.1.5-add-ignore-mount-option.patch new file mode 100644 index 0000000..19b21e4 --- /dev/null +++ b/SOURCES/autofs-5.1.5-add-ignore-mount-option.patch @@ -0,0 +1,90 @@ +autofs-5.1.5 - add ignore mount option + +From: Ian Kent + +Add mount option "ignore", if the kernel supports it, as an +indicator to applications to ignore the mount entry. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 10 ++++++++++ + daemon/indirect.c | 10 ++++++++++ + include/automount.h | 3 +++ + lib/master.c | 4 ++-- + 5 files changed, 26 insertions(+), 2 deletions(-) + +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -424,6 +424,16 @@ int do_mount_autofs_direct(struct autofs + 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 */ +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -133,6 +133,16 @@ static int do_mount_autofs_indirect(stru + } + } + ++ 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) { +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -556,6 +556,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 */ +--- autofs-5.1.4.orig/lib/master.c ++++ autofs-5.1.4/lib/master.c +@@ -101,9 +101,9 @@ int master_add_autofs_point(struct maste + 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; +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -60,6 +60,7 @@ xx/xx/2018 autofs-5.1.5 + - remove a couple of old debug messages. + - fix amd entry memory leak. + - fix unlink_mount_tree() not umounting mounts. ++- add ignore mount option. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. diff --git a/SOURCES/autofs-5.1.5-also-use-strictexpire-for-offsets.patch b/SOURCES/autofs-5.1.5-also-use-strictexpire-for-offsets.patch new file mode 100644 index 0000000..351fa86 --- /dev/null +++ b/SOURCES/autofs-5.1.5-also-use-strictexpire-for-offsets.patch @@ -0,0 +1,42 @@ +autofs-5.1.5 - also use strictexpire for offsets + +From: Ian Kent + +Map entries with offsets should use the "strictexpire" option when +mounting offsets if the option is set for the owner mount. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 10 ++++++++++ + 2 files changed, 11 insertions(+) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -53,6 +53,7 @@ xx/xx/2018 autofs-5.1.5 + - make expire remaining log level debug. + - allow period following macro in selector value. + - fix macro expansion in selector values. ++- also use strictexpire for offsets. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -743,6 +743,16 @@ int mount_autofs_offset(struct autofs_po + mp->options = make_options_string(ap->path, ap->kpipefd, str_offset); + if (!mp->options) + return MOUNT_OFFSET_OK; ++ ++ 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; ++ } ++ } + } + + strcpy(mountpoint, root); diff --git a/SOURCES/autofs-5.1.5-always-use-PROC_MOUNTS-to-make-mount-lists.patch b/SOURCES/autofs-5.1.5-always-use-PROC_MOUNTS-to-make-mount-lists.patch new file mode 100644 index 0000000..1580c15 --- /dev/null +++ b/SOURCES/autofs-5.1.5-always-use-PROC_MOUNTS-to-make-mount-lists.patch @@ -0,0 +1,405 @@ +autofs-5.1.5 - always use PROC_MOUNTS to make mount lists + +From: Ian Kent + +If it's necessary to read a mount table then always use the proc file +system mount table. + +This could be very inefficient for cases where the mtab (_PATH_MOUNTED) +is specified but the mtab has been a symlink to the proc mount tables +for quite a while now so it doesn't make any difference always using +the proc tables. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 6 +++--- + daemon/direct.c | 14 +++++++------- + daemon/indirect.c | 8 ++++---- + daemon/lookup.c | 4 ++-- + daemon/spawn.c | 2 +- + daemon/state.c | 2 +- + include/mounts.h | 6 +++--- + lib/mounts.c | 40 ++++++++++++++++++++-------------------- + modules/parse_amd.c | 4 ++-- + 10 files changed, 44 insertions(+), 43 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -65,6 +65,7 @@ xx/xx/2018 autofs-5.1.5 + - add config option for "ignore" mount option + - use bit flags for autofs mount types in mnt_list. + - use mp instead of path in mnt_list entries. ++- always use PROC_MOUNTS to make mount lists. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/automount.c ++++ autofs-5.1.4/daemon/automount.c +@@ -333,7 +333,7 @@ static int walk_tree(const char *base, i + struct stat st, *pst = &st; + int ret; + +- if (!is_mounted(_PATH_MOUNTED, base, MNTS_REAL)) ++ if (!is_mounted(base, MNTS_REAL)) + ret = lstat(base, pst); + else { + pst = NULL; +@@ -593,11 +593,11 @@ static int umount_subtree_mounts(struct + * If this is the root of a multi-mount we've had to umount + * it already to ensure it's ok to remove any offset triggers. + */ +- if (!is_mm_root && is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) { ++ if (!is_mm_root && is_mounted(path, MNTS_REAL)) { + struct amd_entry *entry; + debug(ap->logopt, "unmounting dir = %s", path); + if (umount_ent(ap, path) && +- is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) { ++ is_mounted(path, MNTS_REAL)) { + warn(ap->logopt, "could not umount dir %s", path); + left++; + goto done; +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -207,7 +207,7 @@ int umount_autofs_direct(struct autofs_p + struct mnt_list *mnts; + struct mapent *me, *ne; + +- mnts = tree_make_mnt_tree(_PROC_MOUNTS, "/"); ++ mnts = tree_make_mnt_tree("/"); + pthread_cleanup_push(mnts_cleanup, mnts); + nc = ap->entry->master->nc; + cache_readlock(nc); +@@ -515,7 +515,7 @@ int mount_autofs_direct(struct autofs_po + return -1; + } + +- mnts = tree_make_mnt_tree(_PROC_MOUNTS, "/"); ++ mnts = tree_make_mnt_tree("/"); + pthread_cleanup_push(mnts_cleanup, mnts); + pthread_cleanup_push(master_source_lock_cleanup, ap->entry); + master_source_readlock(ap->entry); +@@ -583,7 +583,7 @@ int umount_autofs_offset(struct autofs_p + int opened = 0; + + if (me->ioctlfd != -1) { +- if (is_mounted(_PATH_MOUNTED, me->key, MNTS_REAL)) { ++ if (is_mounted(me->key, MNTS_REAL)) { + error(ap->logopt, + "attempt to umount busy offset %s", me->key); + return 1; +@@ -591,7 +591,7 @@ int umount_autofs_offset(struct autofs_p + ioctlfd = me->ioctlfd; + } else { + /* offset isn't mounted, return success and try to recover */ +- if (!is_mounted(_PROC_MOUNTS, me->key, MNTS_AUTOFS)) { ++ if (!is_mounted(me->key, MNTS_AUTOFS)) { + debug(ap->logopt, + "offset %s not mounted", + me->key); +@@ -707,7 +707,7 @@ int mount_autofs_offset(struct autofs_po + if (!(ret == -1 && errno == ENOENT)) + return MOUNT_OFFSET_FAIL; + } else { +- if (is_mounted(_PROC_MOUNTS, me->key, MNTS_AUTOFS)) { ++ if (is_mounted(me->key, MNTS_AUTOFS)) { + if (ap->state != ST_READMAP) + warn(ap->logopt, + "trigger %s already mounted", me->key); +@@ -781,7 +781,7 @@ int mount_autofs_offset(struct autofs_po + * the kernel NFS client. + */ + if (me->multi != me && +- is_mounted(_PROC_MOUNTS, mountpoint, MNTS_REAL)) ++ is_mounted(mountpoint, MNTS_REAL)) + return MOUNT_OFFSET_IGNORE; + + /* +@@ -901,7 +901,7 @@ void *expire_proc_direct(void *arg) + + left = 0; + +- mnts = tree_make_mnt_tree(_PROC_MOUNTS, "/"); ++ mnts = tree_make_mnt_tree("/"); + pthread_cleanup_push(mnts_cleanup, mnts); + + /* Get a list of mounts select real ones and expire them if possible */ +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -104,7 +104,7 @@ static int do_mount_autofs_indirect(stru + if (ret == 0) + return -1; + } else { +- mnts = get_mnt_list(_PROC_MOUNTS, ap->path, 1); ++ mnts = get_mnt_list(ap->path, 1); + if (mnts) { + ret = unlink_mount_tree(ap, mnts); + free_mnt_list(mnts); +@@ -433,7 +433,7 @@ void *expire_proc_indirect(void *arg) + left = 0; + + /* Get a list of real mounts and expire them if possible */ +- mnts = get_mnt_list(_PROC_MOUNTS, ap->path, 0); ++ mnts = get_mnt_list(ap->path, 0); + pthread_cleanup_push(mnts_cleanup, mnts); + for (next = mnts; next; next = next->next) { + char *ind_key; +@@ -454,7 +454,7 @@ void *expire_proc_indirect(void *arg) + struct stat st; + + /* It's got a mount, deal with in the outer loop */ +- if (is_mounted(_PATH_MOUNTED, next->mp, MNTS_REAL)) { ++ if (is_mounted(next->mp, MNTS_REAL)) { + pthread_setcancelstate(cur_state, NULL); + continue; + } +@@ -563,7 +563,7 @@ void *expire_proc_indirect(void *arg) + pthread_cleanup_pop(1); + + count = offsets = submnts = 0; +- mnts = get_mnt_list(_PROC_MOUNTS, ap->path, 0); ++ mnts = get_mnt_list(ap->path, 0); + pthread_cleanup_push(mnts_cleanup, mnts); + /* Are there any real mounts left */ + for (next = mnts; next; next = next->next) { +--- autofs-5.1.4.orig/daemon/lookup.c ++++ autofs-5.1.4/daemon/lookup.c +@@ -1425,7 +1425,7 @@ void lookup_prune_one_cache(struct autof + valid = NULL; + } + if (!valid && +- is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) { ++ is_mounted(path, MNTS_REAL)) { + debug(ap->logopt, "prune posponed, %s mounted", path); + free(key); + free(path); +@@ -1448,7 +1448,7 @@ void lookup_prune_one_cache(struct autof + + if (valid) + cache_delete(mc, key); +- else if (!is_mounted(_PROC_MOUNTS, path, MNTS_AUTOFS)) { ++ else if (!is_mounted(path, MNTS_AUTOFS)) { + dev_t devid = ap->dev; + status = CHE_FAIL; + if (ap->type == LKP_DIRECT) +--- autofs-5.1.4.orig/daemon/spawn.c ++++ autofs-5.1.4/daemon/spawn.c +@@ -427,7 +427,7 @@ static int do_spawn(unsigned logopt, uns + if (!is_bind) + goto done; + +- if (is_mounted(_PROC_MOUNTS, argv[loc], MNTS_AUTOFS)) { ++ if (is_mounted(argv[loc], MNTS_AUTOFS)) { + fprintf(stderr, + "error: can't bind to an autofs mount\n"); + close(STDOUT_FILENO); +--- autofs-5.1.4.orig/daemon/state.c ++++ autofs-5.1.4/daemon/state.c +@@ -499,7 +499,7 @@ static void *do_readmap(void *arg) + struct mapent *me; + unsigned int append_alarm = !ap->exp_runfreq; + +- mnts = tree_make_mnt_tree(_PROC_MOUNTS, "/"); ++ mnts = tree_make_mnt_tree("/"); + pthread_cleanup_push(tree_mnts_cleanup, mnts); + nc = ap->entry->master->nc; + cache_readlock(nc); +--- autofs-5.1.4.orig/include/mounts.h ++++ autofs-5.1.4/include/mounts.h +@@ -99,11 +99,11 @@ char *make_mnt_name_string(char *path); + int ext_mount_add(struct list_head *, const char *, unsigned int); + int ext_mount_remove(struct list_head *, const char *); + int ext_mount_inuse(const char *); +-struct mnt_list *get_mnt_list(const char *table, const char *path, int include); ++struct mnt_list *get_mnt_list(const char *path, int include); + void free_mnt_list(struct mnt_list *list); +-int is_mounted(const char *table, const char *mp, unsigned int type); ++int is_mounted(const char *mp, unsigned int type); + void tree_free_mnt_tree(struct mnt_list *tree); +-struct mnt_list *tree_make_mnt_tree(const char *table, const char *path); ++struct mnt_list *tree_make_mnt_tree(const char *path); + int tree_get_mnt_list(struct mnt_list *mnts, struct list_head *list, const char *path, int include); + int tree_get_mnt_sublist(struct mnt_list *mnts, struct list_head *list, const char *path, int include); + int tree_find_mnt_ents(struct mnt_list *mnts, struct list_head *list, const char *path); +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -789,7 +789,7 @@ done: + /* + * Get list of mounts under path in longest->shortest order + */ +-struct mnt_list *get_mnt_list(const char *table, const char *path, int include) ++struct mnt_list *get_mnt_list(const char *path, int include) + { + FILE *tab; + size_t pathlen = strlen(path); +@@ -803,7 +803,7 @@ struct mnt_list *get_mnt_list(const char + if (!path || !pathlen || pathlen > PATH_MAX) + return NULL; + +- tab = open_setmntent_r(table); ++ tab = open_setmntent_r(_PROC_MOUNTS); + if (!tab) { + char *estr = strerror_r(errno, buf, PATH_MAX - 1); + logerr("setmntent: %s", estr); +@@ -892,7 +892,7 @@ void free_mnt_list(struct mnt_list *list + } + } + +-static int table_is_mounted(const char *table, const char *mp, unsigned int type) ++static int table_is_mounted(const char *mp, unsigned int type) + { + struct mntent *mnt; + struct mntent mnt_wrk; +@@ -904,7 +904,7 @@ static int table_is_mounted(const char * + if (!mp || !mp_len || mp_len >= PATH_MAX) + return 0; + +- tab = open_setmntent_r(table); ++ tab = open_setmntent_r(_PROC_MOUNTS); + if (!tab) { + char *estr = strerror_r(errno, buf, PATH_MAX - 1); + logerr("setmntent: %s", estr); +@@ -938,7 +938,7 @@ static int table_is_mounted(const char * + return ret; + } + +-static int ioctl_is_mounted(const char *table, const char *mp, unsigned int type) ++static int ioctl_is_mounted(const char *mp, unsigned int type) + { + struct ioctl_ops *ops = get_ioctl_ops(); + unsigned int mounted; +@@ -949,7 +949,7 @@ static int ioctl_is_mounted(const char * + */ + ret = ops->ismountpoint(LOGOPT_NONE, -1, mp, &mounted); + if (ret == -1) +- return table_is_mounted(table, mp, type); ++ return table_is_mounted(mp, type); + + if (mounted) { + switch (type) { +@@ -964,14 +964,14 @@ static int ioctl_is_mounted(const char * + return 0; + } + +-int is_mounted(const char *table, const char *mp, unsigned int type) ++int is_mounted(const char *mp, unsigned int type) + { + struct ioctl_ops *ops = get_ioctl_ops(); + + if (ops->ismountpoint) +- return ioctl_is_mounted(table, mp, type); ++ return ioctl_is_mounted(mp, type); + else +- return table_is_mounted(table, mp, type); ++ return table_is_mounted(mp, type); + } + + /* +@@ -1018,7 +1018,7 @@ void tree_free_mnt_tree(struct mnt_list + /* + * Make tree of system mounts in /proc/mounts. + */ +-struct mnt_list *tree_make_mnt_tree(const char *table, const char *path) ++struct mnt_list *tree_make_mnt_tree(const char *path) + { + FILE *tab; + struct mntent mnt_wrk; +@@ -1029,7 +1029,7 @@ struct mnt_list *tree_make_mnt_tree(cons + size_t plen; + int eq; + +- tab = open_setmntent_r(table); ++ tab = open_setmntent_r(_PROC_MOUNTS); + if (!tab) { + char *estr = strerror_r(errno, buf, PATH_MAX - 1); + logerr("setmntent: %s", estr); +@@ -1281,7 +1281,7 @@ int tree_is_mounted(struct mnt_list *mnt + int mounted = 0; + + if (ops->ismountpoint) +- return ioctl_is_mounted(_PROC_MOUNTS, path, type); ++ return ioctl_is_mounted(path, type); + + INIT_LIST_HEAD(&list); + +@@ -1856,7 +1856,7 @@ void set_indirect_mount_tree_catatonic(s + struct mapent_cache *mc; + struct mapent *me; + +- if (!is_mounted(_PROC_MOUNTS, ap->path, MNTS_AUTOFS)) ++ if (!is_mounted(ap->path, MNTS_AUTOFS)) + return; + + map = entry->maps; +@@ -1920,7 +1920,7 @@ int umount_ent(struct autofs_point *ap, + * so that we do not try to call rmdir_path on the + * directory. + */ +- if (!rv && is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) { ++ if (!rv && is_mounted(path, MNTS_REAL)) { + crit(ap->logopt, + "the umount binary reported that %s was " + "unmounted, but there is still something " +@@ -2053,7 +2053,7 @@ int mount_multi_triggers(struct autofs_p + */ + if (ap->state == ST_READMAP && ap->flags & MOUNT_FLAG_REMOUNT) { + if (oe->ioctlfd != -1 || +- is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) { ++ is_mounted(oe->key, MNTS_REAL)) { + char oe_root[PATH_MAX + 1]; + strcpy(oe_root, root); + strcat(oe_root, offset); +@@ -2142,7 +2142,7 @@ int umount_multi_triggers(struct autofs_ + left += umount_multi_triggers(ap, oe, root, oe_base); + + if (oe->ioctlfd != -1 || +- is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) { ++ is_mounted(oe->key, MNTS_REAL)) { + left++; + continue; + } +@@ -2185,10 +2185,10 @@ int umount_multi_triggers(struct autofs_ + * delete the offsets from the cache and we need to put + * the offset triggers back. + */ +- if (is_mounted(_PATH_MOUNTED, root, MNTS_REAL)) { ++ if (is_mounted(root, MNTS_REAL)) { + info(ap->logopt, "unmounting dir = %s", root); + if (umount_ent(ap, root) && +- is_mounted(_PATH_MOUNTED, root, MNTS_REAL)) { ++ is_mounted(root, MNTS_REAL)) { + if (mount_multi_triggers(ap, me, root, strlen(root), "/") < 0) + warn(ap->logopt, + "failed to remount offset triggers"); +@@ -2288,9 +2288,9 @@ int clean_stale_multi_triggers(struct au + * ESTALE errors when attempting list the directory. + */ + if (oe->ioctlfd != -1 || +- is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) { ++ is_mounted(oe->key, MNTS_REAL)) { + if (umount_ent(ap, oe->key) && +- is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) { ++ is_mounted(oe->key, MNTS_REAL)) { + debug(ap->logopt, + "offset %s has active mount, invalidate", + oe->key); +--- autofs-5.1.4.orig/modules/parse_amd.c ++++ autofs-5.1.4/modules/parse_amd.c +@@ -1173,7 +1173,7 @@ static int do_generic_mount(struct autof + * multiple times since they are outside of + * the automount filesystem. + */ +- if (!is_mounted(_PATH_MOUNTED, entry->fs, MNTS_REAL)) { ++ if (!is_mounted(entry->fs, MNTS_REAL)) { + ret = do_mount(ap, entry->fs, "/", 1, + target, entry->type, opts); + if (ret) +@@ -1223,7 +1223,7 @@ static int do_nfs_mount(struct autofs_po + target, entry->type, opts, + mount_nfs->context); + } else { +- if (!is_mounted(_PATH_MOUNTED, entry->fs, MNTS_REAL)) { ++ if (!is_mounted(entry->fs, MNTS_REAL)) { + ret = mount_nfs->mount_mount(ap, entry->fs, "/", 1, + target, entry->type, opts, + mount_nfs->context); diff --git a/SOURCES/autofs-5.1.5-dont-use-tree_is_mounted-for-mounted-checks.patch b/SOURCES/autofs-5.1.5-dont-use-tree_is_mounted-for-mounted-checks.patch new file mode 100644 index 0000000..2eed63a --- /dev/null +++ b/SOURCES/autofs-5.1.5-dont-use-tree_is_mounted-for-mounted-checks.patch @@ -0,0 +1,172 @@ +autofs-5.1.5 - don't use tree_is_mounted() for mounted checks + +From: Ian Kent + +Always use is_mounted() for mounted checks. + +If the proc mount table actually needs to be used this could be +very inefficient but the miscelaneous device ioctl interface +has been available to quite a few years now so it really needs +to be used to avoid the scanning of mount tables. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 12 ++++-------- + daemon/state.c | 4 ++-- + include/automount.h | 2 +- + include/mounts.h | 1 - + lib/mounts.c | 40 ---------------------------------------- + 6 files changed, 8 insertions(+), 52 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -69,6 +69,7 @@ xx/xx/2018 autofs-5.1.5 + - add glibc getmntent_r(). + - use local getmntent_r in table_is_mounted(). + - refactor unlink_active_mounts() in direct.c. ++- don't use tree_is_mounted() for mounted checks. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -82,7 +82,7 @@ static void mnts_cleanup(void *arg) + return; + } + +-int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, struct mapent *me) ++int do_umount_autofs_direct(struct autofs_point *ap, struct mapent *me) + { + struct ioctl_ops *ops = get_ioctl_ops(); + char buf[MAX_ERR_BUF]; +@@ -98,7 +98,7 @@ int do_umount_autofs_direct(struct autof + + if (me->ioctlfd != -1) { + if (ap->state == ST_READMAP && +- tree_is_mounted(mnts, me->key, MNTS_REAL)) { ++ is_mounted(me->key, MNTS_REAL)) { + error(ap->logopt, + "attempt to umount busy direct mount %s", + me->key); +@@ -204,11 +204,8 @@ int umount_autofs_direct(struct autofs_p + { + struct map_source *map; + struct mapent_cache *nc, *mc; +- struct mnt_list *mnts; + struct mapent *me, *ne; + +- mnts = tree_make_mnt_tree("/"); +- pthread_cleanup_push(mnts_cleanup, mnts); + nc = ap->entry->master->nc; + cache_readlock(nc); + pthread_cleanup_push(cache_lock_cleanup, nc); +@@ -233,7 +230,7 @@ int umount_autofs_direct(struct autofs_p + * catatonic regardless of the reason for the + * failed umount. + */ +- error = do_umount_autofs_direct(ap, mnts, me); ++ error = do_umount_autofs_direct(ap, me); + if (!error) + goto done; + +@@ -246,7 +243,6 @@ done: + map = map->next; + } + pthread_cleanup_pop(1); +- pthread_cleanup_pop(1); + + close(ap->state_pipe[0]); + close(ap->state_pipe[1]); +@@ -947,7 +943,7 @@ void *expire_proc_direct(void *arg) + } + + /* It's got a mount, deal with in the outer loop */ +- if (tree_is_mounted(mnts, me->key, MNTS_REAL)) { ++ if (is_mounted(me->key, MNTS_REAL)) { + pthread_setcancelstate(cur_state, NULL); + continue; + } +--- autofs-5.1.4.orig/daemon/state.c ++++ autofs-5.1.4/daemon/state.c +@@ -438,8 +438,8 @@ static void do_readmap_mount(struct auto + else + ap->exp_runfreq = runfreq; + } +- } else if (!tree_is_mounted(mnts, me->key, MNTS_REAL)) +- do_umount_autofs_direct(ap, mnts, me); ++ } else if (!is_mounted(me->key, MNTS_REAL)) ++ do_umount_autofs_direct(ap, me); + else + debug(ap->logopt, + "%s is mounted", me->key); +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -613,7 +613,7 @@ void submount_signal_parent(struct autof + void close_mount_fds(struct autofs_point *ap); + int umount_autofs(struct autofs_point *ap, const char *root, int force); + int umount_autofs_indirect(struct autofs_point *ap, const char *root); +-int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, struct mapent *me); ++int do_umount_autofs_direct(struct autofs_point *ap, struct mapent *me); + int umount_autofs_direct(struct autofs_point *ap); + int umount_autofs_offset(struct autofs_point *ap, struct mapent *me); + int handle_packet_expire_indirect(struct autofs_point *ap, autofs_packet_expire_indirect_t *pkt); +--- autofs-5.1.4.orig/include/mounts.h ++++ autofs-5.1.4/include/mounts.h +@@ -107,7 +107,6 @@ struct mnt_list *tree_make_mnt_tree(cons + int tree_get_mnt_list(struct mnt_list *mnts, struct list_head *list, const char *path, int include); + int tree_get_mnt_sublist(struct mnt_list *mnts, struct list_head *list, const char *path, int include); + int tree_find_mnt_ents(struct mnt_list *mnts, struct list_head *list, const char *path); +-int tree_is_mounted(struct mnt_list *mnts, const char *path, unsigned int type); + void set_tsd_user_vars(unsigned int, uid_t, gid_t); + const char *mount_type_str(unsigned int); + void set_exp_timeout(struct autofs_point *ap, struct map_source *source, time_t timeout); +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -1368,46 +1368,6 @@ int tree_find_mnt_ents(struct mnt_list * + return 0; + } + +-int tree_is_mounted(struct mnt_list *mnts, const char *path, unsigned int type) +-{ +- struct ioctl_ops *ops = get_ioctl_ops(); +- struct list_head *p; +- struct list_head list; +- int mounted = 0; +- +- if (ops->ismountpoint) +- return ioctl_is_mounted(path, type); +- +- INIT_LIST_HEAD(&list); +- +- if (!tree_find_mnt_ents(mnts, &list, path)) +- return 0; +- +- list_for_each(p, &list) { +- struct mnt_list *mptr; +- +- mptr = list_entry(p, struct mnt_list, entries); +- +- if (type) { +- if (type & MNTS_REAL) { +- if (mptr->flags & MNTS_AUTOFS) { +- mounted = 1; +- break; +- } +- } else if (type & MNTS_AUTOFS) { +- if (mptr->flags & MNTS_AUTOFS) { +- mounted = 1; +- break; +- } +- } else { +- mounted = 1; +- break; +- } +- } +- } +- return mounted; +-} +- + void set_tsd_user_vars(unsigned int logopt, uid_t uid, gid_t gid) + { + struct thread_stdenv_vars *tsv; diff --git a/SOURCES/autofs-5.1.5-fix-amd-entry-memory-leak.patch b/SOURCES/autofs-5.1.5-fix-amd-entry-memory-leak.patch new file mode 100644 index 0000000..f45393e --- /dev/null +++ b/SOURCES/autofs-5.1.5-fix-amd-entry-memory-leak.patch @@ -0,0 +1,33 @@ +autofs-5.1.5 - fix amd entry memory leak + +From: Ian Kent + +Fix an incorrect free of an amd_entry structure. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/master.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -58,6 +58,7 @@ xx/xx/2018 autofs-5.1.5 + - remove unused function has_fstab_option(). + - remove unused function reverse_mnt_list(). + - remove a couple of old debug messages. ++- fix amd entry memory leak. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/master.c ++++ autofs-5.1.4/lib/master.c +@@ -155,7 +155,7 @@ void master_free_autofs_point(struct aut + ext_mount_remove(&entry->ext_mount, entry->fs); + if (!list_empty(&entry->entries)) + list_del(&entry->entries); +- free(entry); ++ free_amd_entry(entry); + } + mounts_mutex_unlock(ap); + diff --git a/SOURCES/autofs-5.1.5-fix-missing-initialization-of-autofs_point-flags.patch b/SOURCES/autofs-5.1.5-fix-missing-initialization-of-autofs_point-flags.patch new file mode 100644 index 0000000..e152ce4 --- /dev/null +++ b/SOURCES/autofs-5.1.5-fix-missing-initialization-of-autofs_point-flags.patch @@ -0,0 +1,34 @@ +autofs-5.1.5 - fix missing initialization of autofs_point flags + +From: Ian Kent + +When adding the "use_ignore_mount_option" configuration option I added +a "use without initialization" for ap->flags. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/master.c | 2 ++ + 2 files changed, 3 insertions(+) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -75,6 +75,7 @@ xx/xx/2018 autofs-5.1.5 + - use local_getmntent_r() for unlink_mount_tree(). + - use local getmntent_r() in get_mnt_list(). + - use local getmntent_r() in tree_make_mnt_list(). ++- fix missing initialization of autofs_point flags. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/master.c ++++ autofs-5.1.4/lib/master.c +@@ -101,6 +101,8 @@ int master_add_autofs_point(struct maste + ap->negative_timeout = global_negative_timeout; + ap->exp_timeout = defaults_get_timeout(); + ap->exp_runfreq = 0; ++ ap->flags = 0; ++ + if (defaults_get_use_ignore_mount_option()) + ap->flags = MOUNT_FLAG_IGNORE; + if (ghost) diff --git a/SOURCES/autofs-5.1.5-fix-unlink_mount_tree-not-umounting-mounts.patch b/SOURCES/autofs-5.1.5-fix-unlink_mount_tree-not-umounting-mounts.patch new file mode 100644 index 0000000..317de04 --- /dev/null +++ b/SOURCES/autofs-5.1.5-fix-unlink_mount_tree-not-umounting-mounts.patch @@ -0,0 +1,136 @@ +autofs-5.1.5 - fix unlink_mount_tree() not umounting mounts + +From: Ian Kent + +At some point a check matching process group id of mounts was added to +the unlink_mount_tree() function so that mounts not matching the group +id of the calling process would be skipped. + +But unlink_mount_tree() is meant to force a cleanup of mounts from a +previous automount process so the process group of the current process +can never match so all mounts are skipped. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 7 ------- + daemon/indirect.c | 9 --------- + include/mounts.h | 1 - + lib/mounts.c | 20 -------------------- + 5 files changed, 1 insertion(+), 37 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -59,6 +59,7 @@ xx/xx/2018 autofs-5.1.5 + - remove unused function reverse_mnt_list(). + - remove a couple of old debug messages. + - fix amd entry memory leak. ++- fix unlink_mount_tree() not umounting mounts. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -264,10 +264,6 @@ static int unlink_mount_tree(struct auto + { + struct list_head *p; + int rv, ret; +- pid_t pgrp = getpgrp(); +- char spgrp[20]; +- +- sprintf(spgrp, "pgrp=%d", pgrp); + + ret = 1; + list_for_each(p, list) { +@@ -275,9 +271,6 @@ static int unlink_mount_tree(struct auto + + mnt = list_entry(p, struct mnt_list, list); + +- if (strstr(mnt->opts, spgrp)) +- continue; +- + if (strcmp(mnt->fs_type, "autofs")) + rv = spawn_umount(ap->logopt, "-l", mnt->path, NULL); + else +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -44,19 +44,10 @@ static int unlink_mount_tree(struct auto + { + struct mnt_list *this; + int rv, ret; +- pid_t pgrp = getpgrp(); +- char spgrp[20]; +- +- sprintf(spgrp, "pgrp=%d", pgrp); + + ret = 1; + this = mnts; + while (this) { +- if (strstr(this->opts, spgrp)) { +- this = this->next; +- continue; +- } +- + if (strcmp(this->fs_type, "autofs")) + rv = spawn_umount(ap->logopt, "-l", this->path, NULL); + else +--- autofs-5.1.4.orig/include/mounts.h ++++ autofs-5.1.4/include/mounts.h +@@ -53,7 +53,6 @@ struct mnt_list { + char *fs_name; + char *fs_type; + char *opts; +- pid_t owner; + /* + * List operations ie. get_mnt_list. + */ +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -798,7 +798,6 @@ struct mnt_list *get_mnt_list(const char + struct mntent *mnt; + struct mnt_list *ent, *mptr, *last; + struct mnt_list *list = NULL; +- char *pgrp; + size_t len; + + if (!path || !pathlen || pathlen > PATH_MAX) +@@ -879,15 +878,6 @@ struct mnt_list *get_mnt_list(const char + return NULL; + } + strcpy(ent->opts, mnt->mnt_opts); +- +- ent->owner = 0; +- pgrp = strstr(mnt->mnt_opts, "pgrp="); +- if (pgrp) { +- char *end = strchr(pgrp, ','); +- if (end) +- *end = '\0'; +- sscanf(pgrp, "pgrp=%d", &ent->owner); +- } + } + endmntent(tab); + +@@ -1068,7 +1058,6 @@ struct mnt_list *tree_make_mnt_tree(cons + struct mntent *mnt; + struct mnt_list *ent, *mptr; + struct mnt_list *tree = NULL; +- char *pgrp; + size_t plen; + int eq; + +@@ -1147,15 +1136,6 @@ struct mnt_list *tree_make_mnt_tree(cons + } + strcpy(ent->opts, mnt->mnt_opts); + +- ent->owner = 0; +- pgrp = strstr(mnt->mnt_opts, "pgrp="); +- if (pgrp) { +- char *end = strchr(pgrp, ','); +- if (end) +- *end = '\0'; +- sscanf(pgrp, "pgrp=%d", &ent->owner); +- } +- + mptr = tree; + while (mptr) { + int elen = strlen(ent->path); diff --git a/SOURCES/autofs-5.1.5-move-unlink_mount_tree-to-lib_mounts_c.patch b/SOURCES/autofs-5.1.5-move-unlink_mount_tree-to-lib_mounts_c.patch new file mode 100644 index 0000000..2773955 --- /dev/null +++ b/SOURCES/autofs-5.1.5-move-unlink_mount_tree-to-lib_mounts_c.patch @@ -0,0 +1,134 @@ +autofs-5.1.5 - move unlink_mount_tree() to lib/mounts.c + +From: Ian Kent + +Both daemon/direct.c and daemon/indirect.c use the same function to +lazy umount a list of mounts, move that function to lib/mounts.c. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 2 -- + daemon/indirect.c | 34 ---------------------------------- + include/mounts.h | 1 + + lib/mounts.c | 35 +++++++++++++++++++++++++++++++++++ + 5 files changed, 37 insertions(+), 36 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -71,6 +71,7 @@ xx/xx/2018 autofs-5.1.5 + - refactor unlink_active_mounts() in direct.c. + - don't use tree_is_mounted() for mounted checks. + - use single unlink_umount_tree() for both direct and indirect mounts. ++- move unlink_mount_tree() to lib/mounts.c. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -49,8 +49,6 @@ pthread_key_t key_mnt_direct_params; + pthread_key_t key_mnt_offset_params; + pthread_once_t key_mnt_params_once = PTHREAD_ONCE_INIT; + +-int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts); +- + static void key_mnt_params_destroy(void *arg) + { + struct mnt_params *mp; +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -40,40 +40,6 @@ + /* Attribute to create detached thread */ + extern pthread_attr_t th_attr_detached; + +-int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts) +-{ +- struct mnt_list *this; +- int rv, ret; +- +- ret = 1; +- this = mnts; +- while (this) { +- if (this->flags & MNTS_AUTOFS) +- rv = umount2(this->mp, MNT_DETACH); +- else +- rv = spawn_umount(ap->logopt, "-l", this->mp, NULL); +- if (rv == -1) { +- debug(ap->logopt, +- "can't unlink %s from mount tree", this->mp); +- +- switch (errno) { +- case EINVAL: +- warn(ap->logopt, +- "bad superblock or not mounted"); +- break; +- +- case ENOENT: +- case EFAULT: +- ret = 0; +- warn(ap->logopt, "bad path for mount"); +- break; +- } +- } +- this = this->next; +- } +- return ret; +-} +- + static int do_mount_autofs_indirect(struct autofs_point *ap, const char *root) + { + const char *str_indirect = mount_type_str(t_indirect); +--- autofs-5.1.4.orig/include/mounts.h ++++ autofs-5.1.4/include/mounts.h +@@ -100,6 +100,7 @@ int ext_mount_add(struct list_head *, co + int ext_mount_remove(struct list_head *, const char *); + int ext_mount_inuse(const char *); + struct mnt_list *get_mnt_list(const char *path, int include); ++int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts); + void free_mnt_list(struct mnt_list *list); + int is_mounted(const char *mp, unsigned int type); + void tree_free_mnt_tree(struct mnt_list *tree); +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -881,6 +881,41 @@ local_getmntent_r(FILE *tab, struct mnte + return mnt; + } + ++int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts) ++{ ++ struct mnt_list *this; ++ int rv, ret; ++ ++ ret = 1; ++ this = mnts; ++ while (this) { ++ if (this->flags & MNTS_AUTOFS) ++ rv = umount2(this->mp, MNT_DETACH); ++ else ++ rv = spawn_umount(ap->logopt, "-l", this->mp, NULL); ++ if (rv == -1) { ++ debug(ap->logopt, ++ "can't unlink %s from mount tree", this->mp); ++ ++ switch (errno) { ++ case EINVAL: ++ warn(ap->logopt, ++ "bad superblock or not mounted"); ++ break; ++ ++ case ENOENT: ++ case EFAULT: ++ ret = 0; ++ warn(ap->logopt, "bad path for mount"); ++ break; ++ } ++ } ++ this = this->next; ++ } ++ ++ return ret; ++} ++ + /* + * Get list of mounts under path in longest->shortest order + */ diff --git a/SOURCES/autofs-5.1.5-refactor-unlink_active_mounts-in-direct_c.patch b/SOURCES/autofs-5.1.5-refactor-unlink_active_mounts-in-direct_c.patch new file mode 100644 index 0000000..754281e --- /dev/null +++ b/SOURCES/autofs-5.1.5-refactor-unlink_active_mounts-in-direct_c.patch @@ -0,0 +1,116 @@ +autofs-5.1.5 - refactor unlink_active_mounts() in direct_c + +From: Ian Kent + +In daemon/direct.c:unlink_active_mounts() the tree_get_mnt_list() call +returns 1 for a non-empty list which amounts to a mounted check and then +handles the case where the map is being read. + +But the check that's carried out is to distinguish between a readmap +and a mount activity which should be handled by the caller instead of +burying the check away in the unlink_active_mounts() function. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + daemon/direct.c | 63 +++++++++++++++++++++++++++----------------------------- + 2 files changed, 32 insertions(+), 32 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -68,6 +68,7 @@ xx/xx/2018 autofs-5.1.5 + - always use PROC_MOUNTS to make mount lists. + - add glibc getmntent_r(). + - use local getmntent_r in table_is_mounted(). ++- refactor unlink_active_mounts() in direct.c. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -298,37 +298,12 @@ static int unlink_mount_tree(struct auto + + static int unlink_active_mounts(struct autofs_point *ap, struct mnt_list *mnts, struct mapent *me) + { +- struct ioctl_ops *ops = get_ioctl_ops(); + struct list_head list; + + INIT_LIST_HEAD(&list); + +- if (tree_get_mnt_list(mnts, &list, me->key, 1)) { +- if (ap->state == ST_READMAP) { +- time_t tout = get_exp_timeout(ap, me->source); +- int save_ioctlfd, ioctlfd; +- +- save_ioctlfd = ioctlfd = me->ioctlfd; +- +- if (ioctlfd == -1) +- ops->open(ap->logopt, +- &ioctlfd, me->dev, me->key); +- +- if (ioctlfd < 0) { +- error(ap->logopt, +- "failed to create ioctl fd for %s", +- me->key); +- return 0; +- } +- +- ops->timeout(ap->logopt, ioctlfd, tout); +- +- if (save_ioctlfd == -1) +- ops->close(ap->logopt, ioctlfd); +- +- return 0; +- } +- } ++ if (!tree_get_mnt_list(mnts, &list, me->key, 1)) ++ return 1; + + if (!unlink_mount_tree(ap, &list)) { + debug(ap->logopt, +@@ -371,16 +346,40 @@ int do_mount_autofs_direct(struct autofs + if (ret == 0) + return -1; + } else { ++ if (ap->state == ST_READMAP && is_mounted(me->key, MNTS_ALL)) { ++ time_t tout = get_exp_timeout(ap, me->source); ++ int save_ioctlfd, ioctlfd; ++ ++ save_ioctlfd = ioctlfd = me->ioctlfd; ++ ++ if (ioctlfd == -1) ++ ops->open(ap->logopt, ++ &ioctlfd, me->dev, me->key); ++ ++ if (ioctlfd < 0) { ++ error(ap->logopt, ++ "failed to create ioctl fd for %s", ++ me->key); ++ return 0; ++ } ++ ++ ops->timeout(ap->logopt, ioctlfd, tout); ++ ++ if (save_ioctlfd == -1) ++ ops->close(ap->logopt, ioctlfd); ++ ++ return 0; ++ } ++ + /* +- * A return of 0 indicates we're re-reading the map. + * A return of 1 indicates we successfully unlinked +- * the mount tree if there was one. A return of -1 +- * inducates we failed to unlink the mount tree so ++ * the mount tree if there was one. A return of 0 ++ * indicates we failed to unlink the mount tree so + * we have to return a failure. + */ + ret = unlink_active_mounts(ap, mnts, me); +- if (ret == -1 || ret == 0) +- return ret; ++ if (!ret) ++ return -1; + + if (me->ioctlfd != -1) { + error(ap->logopt, "active direct mount %s", me->key); diff --git a/SOURCES/autofs-5.1.5-remove-a-couple-of-old-debug-messages.patch b/SOURCES/autofs-5.1.5-remove-a-couple-of-old-debug-messages.patch new file mode 100644 index 0000000..46b3ae5 --- /dev/null +++ b/SOURCES/autofs-5.1.5-remove-a-couple-of-old-debug-messages.patch @@ -0,0 +1,38 @@ +autofs-5.1.5 - remove a couple of old debug messages + +From: Ian Kent + +Remove a couple of debug log messages from lookup_ghost(). +These messages have not shown a problem here and should be +removed. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/lookup.c | 5 ----- + 2 files changed, 1 insertion(+), 5 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -57,6 +57,7 @@ xx/xx/2018 autofs-5.1.5 + - change expire type naming to better reflect usage. + - remove unused function has_fstab_option(). + - remove unused function reverse_mnt_list(). ++- remove a couple of old debug messages. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/lookup.c ++++ autofs-5.1.4/daemon/lookup.c +@@ -793,11 +793,6 @@ int lookup_ghost(struct autofs_point *ap + + /* Directory already exists? */ + if (!ret) { +- /* Shouldn't need this +- me->dev = st.st_dev; +- me->ino = st.st_ino; +- */ +- debug(ap->logopt, "me->dev %d me->ino %d", me->dev, me->ino); + free(fullpath); + goto next; + } diff --git a/SOURCES/autofs-5.1.5-remove-unused-function-has_fstab_option.patch b/SOURCES/autofs-5.1.5-remove-unused-function-has_fstab_option.patch new file mode 100644 index 0000000..33c1274 --- /dev/null +++ b/SOURCES/autofs-5.1.5-remove-unused-function-has_fstab_option.patch @@ -0,0 +1,71 @@ +autofs-5.1.5 - remove unused function has_fstab_option() + +From: Ian Kent + +This function is not used, remove it. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/mounts.h | 1 - + lib/mounts.c | 29 ----------------------------- + 3 files changed, 1 insertion(+), 30 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -55,6 +55,7 @@ xx/xx/2018 autofs-5.1.5 + - fix macro expansion in selector values. + - also use strictexpire for offsets. + - change expire type naming to better reflect usage. ++- remove unused function has_fstab_option(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/include/mounts.h ++++ autofs-5.1.4/include/mounts.h +@@ -103,7 +103,6 @@ struct mnt_list *get_mnt_list(const char + struct mnt_list *reverse_mnt_list(struct mnt_list *list); + void free_mnt_list(struct mnt_list *list); + int is_mounted(const char *table, const char *path, unsigned int type); +-int has_fstab_option(const char *opt); + void tree_free_mnt_tree(struct mnt_list *tree); + struct mnt_list *tree_make_mnt_tree(const char *table, const char *path); + int tree_get_mnt_list(struct mnt_list *mnts, struct list_head *list, const char *path, int include); +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -1026,35 +1026,6 @@ int is_mounted(const char *table, const + return table_is_mounted(table, path, type); + } + +-int has_fstab_option(const char *opt) +-{ +- struct mntent *mnt; +- struct mntent mnt_wrk; +- char buf[PATH_MAX * 3]; +- FILE *tab; +- int ret = 0; +- +- if (!opt) +- return 0; +- +- tab = open_setmntent_r(_PATH_MNTTAB); +- if (!tab) { +- char *estr = strerror_r(errno, buf, PATH_MAX - 1); +- logerr("setmntent: %s", estr); +- return 0; +- } +- +- while ((mnt = getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) { +- if (hasmntopt(mnt, opt)) { +- ret = 1; +- break; +- } +- } +- endmntent(tab); +- +- return ret; +-} +- + /* + * Since we have to look at the entire mount tree for direct + * mounts (all mounts under "/") and we may have a large number diff --git a/SOURCES/autofs-5.1.5-remove-unused-function-reverse_mnt_list.patch b/SOURCES/autofs-5.1.5-remove-unused-function-reverse_mnt_list.patch new file mode 100644 index 0000000..f166c1d --- /dev/null +++ b/SOURCES/autofs-5.1.5-remove-unused-function-reverse_mnt_list.patch @@ -0,0 +1,63 @@ +autofs-5.1.5 - remove unused function reverse_mnt_list() + +From: Ian Kent + +This function is not used, remove it. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/mounts.h | 1 - + lib/mounts.c | 21 --------------------- + 3 files changed, 1 insertion(+), 22 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -56,6 +56,7 @@ xx/xx/2018 autofs-5.1.5 + - also use strictexpire for offsets. + - change expire type naming to better reflect usage. + - remove unused function has_fstab_option(). ++- remove unused function reverse_mnt_list(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/include/mounts.h ++++ autofs-5.1.4/include/mounts.h +@@ -100,7 +100,6 @@ int ext_mount_add(struct list_head *, co + int ext_mount_remove(struct list_head *, const char *); + int ext_mount_inuse(const char *); + struct mnt_list *get_mnt_list(const char *table, const char *path, int include); +-struct mnt_list *reverse_mnt_list(struct mnt_list *list); + void free_mnt_list(struct mnt_list *list); + int is_mounted(const char *table, const char *path, unsigned int type); + void tree_free_mnt_tree(struct mnt_list *tree); +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -894,27 +894,6 @@ struct mnt_list *get_mnt_list(const char + return list; + } + +-/* +- * Reverse a list of mounts +- */ +-struct mnt_list *reverse_mnt_list(struct mnt_list *list) +-{ +- struct mnt_list *next, *last; +- +- if (!list) +- return NULL; +- +- next = list; +- last = NULL; +- while (next) { +- struct mnt_list *this = next; +- next = this->next; +- this->next = last; +- last = this; +- } +- return last; +-} +- + void free_mnt_list(struct mnt_list *list) + { + struct mnt_list *next; diff --git a/SOURCES/autofs-5.1.5-use-bit-flags-for-autofs-mount-types-in-mnt_list.patch b/SOURCES/autofs-5.1.5-use-bit-flags-for-autofs-mount-types-in-mnt_list.patch new file mode 100644 index 0000000..a8733ac --- /dev/null +++ b/SOURCES/autofs-5.1.5-use-bit-flags-for-autofs-mount-types-in-mnt_list.patch @@ -0,0 +1,279 @@ +autofs-5.1.5 - use bit flags for autofs mount types in mnt_list + +From: Ian Kent + +Several fields in struct mnt_list don't need to be saved as strings +so change to using bit flags for them instead. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + daemon/direct.c | 10 ++--- + daemon/indirect.c | 16 ++++---- + include/mounts.h | 7 ++- + lib/mounts.c | 97 +++++++++++------------------------------------------- + 5 files changed, 38 insertions(+), 93 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -63,6 +63,7 @@ xx/xx/2018 autofs-5.1.5 + - add ignore mount option. + - use ignore option for offset mounts as well. + - add config option for "ignore" mount option ++- use bit flags for autofs mount types in mnt_list. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -271,10 +271,10 @@ static int unlink_mount_tree(struct auto + + mnt = list_entry(p, struct mnt_list, list); + +- if (strcmp(mnt->fs_type, "autofs")) +- rv = spawn_umount(ap->logopt, "-l", mnt->path, NULL); +- else ++ if (mnt->flags & MNTS_AUTOFS) + rv = umount2(mnt->path, MNT_DETACH); ++ else ++ rv = spawn_umount(ap->logopt, "-l", mnt->path, NULL); + if (rv == -1) { + debug(ap->logopt, + "can't unlink %s from mount tree", mnt->path); +@@ -925,7 +925,7 @@ void *expire_proc_direct(void *arg) + if (!me) + continue; + +- if (!strcmp(next->fs_type, "autofs")) { ++ if (next->flags & MNTS_AUTOFS) { + struct stat st; + int ioctlfd; + +@@ -936,7 +936,7 @@ void *expire_proc_direct(void *arg) + * one of them and pass on state change. + */ + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); +- if (strstr(next->opts, "indirect")) { ++ if (next->flags & MNTS_INDIRECT) { + master_notify_submount(ap, next->path, ap->state); + pthread_setcancelstate(cur_state, NULL); + continue; +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -48,10 +48,10 @@ static int unlink_mount_tree(struct auto + ret = 1; + this = mnts; + while (this) { +- if (strcmp(this->fs_type, "autofs")) +- rv = spawn_umount(ap->logopt, "-l", this->path, NULL); +- else ++ if (this->flags & MNTS_AUTOFS) + rv = umount2(this->path, MNT_DETACH); ++ else ++ rv = spawn_umount(ap->logopt, "-l", this->path, NULL); + if (rv == -1) { + debug(ap->logopt, + "can't unlink %s from mount tree", this->path); +@@ -439,15 +439,15 @@ void *expire_proc_indirect(void *arg) + char *ind_key; + int ret; + +- if (!strcmp(next->fs_type, "autofs")) { ++ if (next->flags & MNTS_AUTOFS) { + /* + * If we have submounts check if this path lives below + * one of them and pass on the state change. + */ + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); +- if (strstr(next->opts, "indirect")) ++ if (next->flags & MNTS_INDIRECT) + master_notify_submount(ap, next->path, ap->state); +- else if (strstr(next->opts, "offset")) { ++ else if (next->flags & MNTS_OFFSET) { + struct map_source *map; + struct mapent_cache *mc = NULL; + struct mapent *me = NULL; +@@ -567,10 +567,10 @@ void *expire_proc_indirect(void *arg) + pthread_cleanup_push(mnts_cleanup, mnts); + /* Are there any real mounts left */ + for (next = mnts; next; next = next->next) { +- if (strcmp(next->fs_type, "autofs")) ++ if (!(next->flags & MNTS_AUTOFS)) + count++; + else { +- if (strstr(next->opts, "indirect")) ++ if (next->flags & MNTS_INDIRECT) + submnts++; + else + offsets++; +--- autofs-5.1.4.orig/include/mounts.h ++++ autofs-5.1.4/include/mounts.h +@@ -35,6 +35,9 @@ + #define MNTS_ALL 0x0001 + #define MNTS_REAL 0x0002 + #define MNTS_AUTOFS 0x0004 ++#define MNTS_INDIRECT 0x0008 ++#define MNTS_DIRECT 0x0010 ++#define MNTS_OFFSET 0x0020 + + #define REMOUNT_SUCCESS 0x0000 + #define REMOUNT_FAIL 0x0001 +@@ -50,9 +53,7 @@ struct mapent; + + struct mnt_list { + char *path; +- char *fs_name; +- char *fs_type; +- char *opts; ++ unsigned int flags; + /* + * List operations ie. get_mnt_list. + */ +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -855,29 +855,17 @@ struct mnt_list *get_mnt_list(const char + } + strcpy(ent->path, mnt->mnt_dir); + +- ent->fs_name = malloc(strlen(mnt->mnt_fsname) + 1); +- if (!ent->fs_name) { +- endmntent(tab); +- free_mnt_list(list); +- return NULL; +- } +- strcpy(ent->fs_name, mnt->mnt_fsname); ++ if (!strcmp(mnt->mnt_type, "autofs")) ++ ent->flags |= MNTS_AUTOFS; + +- ent->fs_type = malloc(strlen(mnt->mnt_type) + 1); +- if (!ent->fs_type) { +- endmntent(tab); +- free_mnt_list(list); +- return NULL; +- } +- strcpy(ent->fs_type, mnt->mnt_type); +- +- ent->opts = malloc(strlen(mnt->mnt_opts) + 1); +- if (!ent->opts) { +- endmntent(tab); +- free_mnt_list(list); +- return NULL; ++ if (ent->flags & MNTS_AUTOFS) { ++ if (strstr(mnt->mnt_opts, "indirect")) ++ ent->flags |= MNTS_INDIRECT; ++ else if (strstr(mnt->mnt_opts, "direct")) ++ ent->flags |= MNTS_DIRECT; ++ else if (strstr(mnt->mnt_opts, "offset")) ++ ent->flags |= MNTS_OFFSET; + } +- strcpy(ent->opts, mnt->mnt_opts); + } + endmntent(tab); + +@@ -900,15 +888,6 @@ void free_mnt_list(struct mnt_list *list + if (this->path) + free(this->path); + +- if (this->fs_name) +- free(this->fs_name); +- +- if (this->fs_type) +- free(this->fs_type); +- +- if (this->opts) +- free(this->opts); +- + free(this); + } + } +@@ -1028,22 +1007,11 @@ void tree_free_mnt_tree(struct mnt_list + list_del(&this->self); + + free(this->path); +- free(this->fs_name); +- free(this->fs_type); +- +- if (this->opts) +- free(this->opts); + + free(this); + } + + free(tree->path); +- free(tree->fs_name); +- free(tree->fs_type); +- +- if (tree->opts) +- free(tree->opts); +- + free(tree); + } + +@@ -1103,38 +1071,17 @@ struct mnt_list *tree_make_mnt_tree(cons + } + strcpy(ent->path, mnt->mnt_dir); + +- ent->fs_name = malloc(strlen(mnt->mnt_fsname) + 1); +- if (!ent->fs_name) { +- free(ent->path); +- free(ent); +- endmntent(tab); +- tree_free_mnt_tree(tree); +- return NULL; +- } +- strcpy(ent->fs_name, mnt->mnt_fsname); +- +- ent->fs_type = malloc(strlen(mnt->mnt_type) + 1); +- if (!ent->fs_type) { +- free(ent->fs_name); +- free(ent->path); +- free(ent); +- endmntent(tab); +- tree_free_mnt_tree(tree); +- return NULL; +- } +- strcpy(ent->fs_type, mnt->mnt_type); ++ if (!strcmp(mnt->mnt_type, "autofs")) ++ ent->flags |= MNTS_AUTOFS; + +- ent->opts = malloc(strlen(mnt->mnt_opts) + 1); +- if (!ent->opts) { +- free(ent->fs_type); +- free(ent->fs_name); +- free(ent->path); +- free(ent); +- endmntent(tab); +- tree_free_mnt_tree(tree); +- return NULL; ++ if (ent->flags & MNTS_AUTOFS) { ++ if (strstr(mnt->mnt_opts, "indirect")) ++ ent->flags |= MNTS_INDIRECT; ++ else if (strstr(mnt->mnt_opts, "direct")) ++ ent->flags |= MNTS_DIRECT; ++ else if (strstr(mnt->mnt_opts, "offset")) ++ ent->flags |= MNTS_OFFSET; + } +- strcpy(ent->opts, mnt->mnt_opts); + + mptr = tree; + while (mptr) { +@@ -1347,17 +1294,13 @@ int tree_is_mounted(struct mnt_list *mnt + mptr = list_entry(p, struct mnt_list, entries); + + if (type) { +- unsigned int autofs_fs; +- +- autofs_fs = !strcmp(mptr->fs_type, "autofs"); +- + if (type & MNTS_REAL) { +- if (!autofs_fs) { ++ if (mptr->flags & MNTS_AUTOFS) { + mounted = 1; + break; + } + } else if (type & MNTS_AUTOFS) { +- if (autofs_fs) { ++ if (mptr->flags & MNTS_AUTOFS) { + mounted = 1; + break; + } diff --git a/SOURCES/autofs-5.1.5-use-ignore-option-for-offset-mounts-as-well.patch b/SOURCES/autofs-5.1.5-use-ignore-option-for-offset-mounts-as-well.patch new file mode 100644 index 0000000..797942f --- /dev/null +++ b/SOURCES/autofs-5.1.5-use-ignore-option-for-offset-mounts-as-well.patch @@ -0,0 +1,44 @@ +autofs-5.1.5 - use ignore option for offset mounts as well + +From: Ian Kent + +The pseudo option "ignore" (that's used as a hint that applications +should ignore this mount when reporting a list of mounts) has been +added to direct and indirect mounts but hasn't been added to offset +mounts. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 10 ++++++++++ + 2 files changed, 11 insertions(+) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -61,6 +61,7 @@ xx/xx/2018 autofs-5.1.5 + - fix amd entry memory leak. + - fix unlink_mount_tree() not umounting mounts. + - add ignore mount option. ++- use ignore option for offset mounts as well. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -756,6 +756,16 @@ int mount_autofs_offset(struct autofs_po + 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; ++ } ++ } + } + + strcpy(mountpoint, root); diff --git a/SOURCES/autofs-5.1.5-use-local-getmntent_r-in-get_mnt_list.patch b/SOURCES/autofs-5.1.5-use-local-getmntent_r-in-get_mnt_list.patch new file mode 100644 index 0000000..d788772 --- /dev/null +++ b/SOURCES/autofs-5.1.5-use-local-getmntent_r-in-get_mnt_list.patch @@ -0,0 +1,53 @@ +autofs-5.1.5 - use local getmntent_r() in get_mnt_list() + +From: Ian Kent + +Change get_mnt_list() to use the local getmntent_r() instead of +the glibc version so that if glibc is changed to support the +autofs "ignore" hint automount(8) won't be affected. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/mounts.c | 8 ++++---- + 2 files changed, 5 insertions(+), 4 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -73,6 +73,7 @@ xx/xx/2018 autofs-5.1.5 + - use single unlink_umount_tree() for both direct and indirect mounts. + - move unlink_mount_tree() to lib/mounts.c. + - use local_getmntent_r() for unlink_mount_tree(). ++- use local getmntent_r() in get_mnt_list(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -956,14 +956,14 @@ struct mnt_list *get_mnt_list(const char + if (!path || !pathlen || pathlen > PATH_MAX) + return NULL; + +- tab = open_setmntent_r(_PROC_MOUNTS); ++ tab = open_fopen_r(_PROC_MOUNTS); + if (!tab) { + char *estr = strerror_r(errno, buf, PATH_MAX - 1); +- logerr("setmntent: %s", estr); ++ logerr("fopen: %s", estr); + return NULL; + } + +- while ((mnt = getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) { ++ while ((mnt = local_getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) { + len = strlen(mnt->mnt_dir); + + if ((!include && len <= pathlen) || +@@ -1020,7 +1020,7 @@ struct mnt_list *get_mnt_list(const char + ent->flags |= MNTS_OFFSET; + } + } +- endmntent(tab); ++ fclose(tab); + + return list; + } diff --git a/SOURCES/autofs-5.1.5-use-local-getmntent_r-in-table_is_mounted.patch b/SOURCES/autofs-5.1.5-use-local-getmntent_r-in-table_is_mounted.patch new file mode 100644 index 0000000..d22303e --- /dev/null +++ b/SOURCES/autofs-5.1.5-use-local-getmntent_r-in-table_is_mounted.patch @@ -0,0 +1,53 @@ +autofs-5.1.5 - use local getmntent_r in table_is_mounted() + +From: Ian Kent + +Use the local_getmntent_r() funtion copied from glibc in the function +table_is_mounted() so that if glibc is changed to support the autofs +"ignore" hint automount(8) won't be affected. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/mounts.c | 8 ++++---- + 2 files changed, 5 insertions(+), 4 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -67,6 +67,7 @@ xx/xx/2018 autofs-5.1.5 + - use mp instead of path in mnt_list entries. + - always use PROC_MOUNTS to make mount lists. + - add glibc getmntent_r(). ++- use local getmntent_r in table_is_mounted(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -999,14 +999,14 @@ static int table_is_mounted(const char * + if (!mp || !mp_len || mp_len >= PATH_MAX) + return 0; + +- tab = open_setmntent_r(_PROC_MOUNTS); ++ tab = open_fopen_r(_PROC_MOUNTS); + if (!tab) { + char *estr = strerror_r(errno, buf, PATH_MAX - 1); +- logerr("setmntent: %s", estr); ++ logerr("fopen: %s", estr); + return 0; + } + +- while ((mnt = getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) { ++ while ((mnt = local_getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) { + size_t len = strlen(mnt->mnt_dir); + + if (type) { +@@ -1028,7 +1028,7 @@ static int table_is_mounted(const char * + break; + } + } +- endmntent(tab); ++ fclose(tab); + + return ret; + } diff --git a/SOURCES/autofs-5.1.5-use-local-getmntent_r-in-tree_get_mnt_list.patch b/SOURCES/autofs-5.1.5-use-local-getmntent_r-in-tree_get_mnt_list.patch new file mode 100644 index 0000000..e4ca35a --- /dev/null +++ b/SOURCES/autofs-5.1.5-use-local-getmntent_r-in-tree_get_mnt_list.patch @@ -0,0 +1,55 @@ +autofs-5.1.5 - use local getmntent_r() in tree_make_mnt_list() + +From: Ian Kent + +Change tree_make_mnt_list() to use the local getmntent_r() instead of +the glibc version so that if glibc is changed to support the autofs +"ignore" hint automount(8) won't be affected. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/mounts.c | 8 ++++---- + 2 files changed, 5 insertions(+), 4 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -74,6 +74,7 @@ xx/xx/2018 autofs-5.1.5 + - move unlink_mount_tree() to lib/mounts.c. + - use local_getmntent_r() for unlink_mount_tree(). + - use local getmntent_r() in get_mnt_list(). ++- use local getmntent_r() in tree_make_mnt_list(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -1182,16 +1182,16 @@ struct mnt_list *tree_make_mnt_tree(cons + size_t plen; + int eq; + +- tab = open_setmntent_r(_PROC_MOUNTS); ++ tab = open_fopen_r(_PROC_MOUNTS); + if (!tab) { + char *estr = strerror_r(errno, buf, PATH_MAX - 1); +- logerr("setmntent: %s", estr); ++ logerr("fopen: %s", estr); + return NULL; + } + + plen = strlen(path); + +- while ((mnt = getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) { ++ while ((mnt = local_getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) { + size_t len = strlen(mnt->mnt_dir); + + /* Not matching path */ +@@ -1283,7 +1283,7 @@ struct mnt_list *tree_make_mnt_tree(cons + if (!tree) + tree = ent; + } +- endmntent(tab); ++ fclose(tab); + + return tree; + } diff --git a/SOURCES/autofs-5.1.5-use-local_getmntent_r-for-unlink_mount_tree.patch b/SOURCES/autofs-5.1.5-use-local_getmntent_r-for-unlink_mount_tree.patch new file mode 100644 index 0000000..a774539 --- /dev/null +++ b/SOURCES/autofs-5.1.5-use-local_getmntent_r-for-unlink_mount_tree.patch @@ -0,0 +1,179 @@ +autofs-5.1.5 - use local_getmntent_r() for unlink_mount_tree() + +From: Ian Kent + +Now that unlink_mount_tree() is located in a single location and +only one function is used for this, change it to use our local +getmntent_r() function so that if glibc is changed to support the +autofs "ignore" hint automount(8) won't be affected. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 24 ++++++------------------ + daemon/indirect.c | 17 ++++++----------- + include/mounts.h | 2 +- + lib/mounts.c | 45 ++++++++++++++++++++++++++++++++++----------- + 5 files changed, 48 insertions(+), 41 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -72,6 +72,7 @@ xx/xx/2018 autofs-5.1.5 + - don't use tree_is_mounted() for mounted checks. + - use single unlink_umount_tree() for both direct and indirect mounts. + - move unlink_mount_tree() to lib/mounts.c. ++- use local_getmntent_r() for unlink_mount_tree(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -286,8 +286,6 @@ int do_mount_autofs_direct(struct autofs + if (ret == 0) + return -1; + } else { +- struct mnt_list *mnts; +- + if (ap->state == ST_READMAP && is_mounted(me->key, MNTS_ALL)) { + time_t tout = get_exp_timeout(ap, me->source); + int save_ioctlfd, ioctlfd; +@@ -313,22 +311,12 @@ int do_mount_autofs_direct(struct autofs + return 0; + } + +- mnts = get_mnt_list(me->key, 1); +- if (mnts) { +- /* +- * A return of 1 indicates we successfully unlinked +- * the mount tree if there was one. A return of 0 +- * indicates we failed to unlink the mount tree so +- * we have to return a failure. +- */ +- ret = unlink_mount_tree(ap, mnts); +- free_mnt_list(mnts); +- if (!ret) { +- error(ap->logopt, +- "already mounted as other than autofs " +- "or failed to unlink entry in tree"); +- return -1; +- } ++ ret = unlink_mount_tree(ap, ap->path); ++ if (!ret) { ++ error(ap->logopt, ++ "already mounted as other than autofs " ++ "or failed to unlink entry in tree"); ++ goto out_err; + } + + if (me->ioctlfd != -1) { +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -50,7 +50,6 @@ static int do_mount_autofs_indirect(stru + const char *map_name = hosts_map_name; + const char *type; + struct stat st; +- struct mnt_list *mnts; + int ret; + int err; + +@@ -70,16 +69,12 @@ static int do_mount_autofs_indirect(stru + if (ret == 0) + return -1; + } else { +- mnts = get_mnt_list(ap->path, 1); +- if (mnts) { +- ret = unlink_mount_tree(ap, mnts); +- free_mnt_list(mnts); +- if (!ret) { +- error(ap->logopt, +- "already mounted as other than autofs " +- "or failed to unlink entry in tree"); +- goto out_err; +- } ++ ret = unlink_mount_tree(ap, ap->path); ++ if (!ret) { ++ error(ap->logopt, ++ "already mounted as other than autofs " ++ "or failed to unlink entry in tree"); ++ goto out_err; + } + } + +--- autofs-5.1.4.orig/include/mounts.h ++++ autofs-5.1.4/include/mounts.h +@@ -100,7 +100,7 @@ int ext_mount_add(struct list_head *, co + int ext_mount_remove(struct list_head *, const char *); + int ext_mount_inuse(const char *); + struct mnt_list *get_mnt_list(const char *path, int include); +-int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts); ++int unlink_mount_tree(struct autofs_point *ap, const char *mp); + void free_mnt_list(struct mnt_list *list); + int is_mounted(const char *mp, unsigned int type); + void tree_free_mnt_tree(struct mnt_list *tree); +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -881,21 +881,44 @@ local_getmntent_r(FILE *tab, struct mnte + return mnt; + } + +-int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts) ++int unlink_mount_tree(struct autofs_point *ap, const char *mp) + { +- struct mnt_list *this; +- int rv, ret; ++ FILE *tab; ++ struct mntent *mnt; ++ struct mntent mnt_wrk; ++ char buf[PATH_MAX * 3]; ++ unsigned int mp_len = strlen(mp); ++ int rv, ret = 1; + +- ret = 1; +- this = mnts; +- while (this) { +- if (this->flags & MNTS_AUTOFS) +- rv = umount2(this->mp, MNT_DETACH); ++ tab = open_fopen_r(_PROC_MOUNTS); ++ if (!tab) { ++ char *estr = strerror_r(errno, buf, PATH_MAX - 1); ++ logerr("fopen: %s", estr); ++ return 0; ++ } ++ ++ while ((mnt = local_getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) { ++ unsigned int mnt_dir_len; ++ int is_autofs; ++ ++ if (strncmp(mnt->mnt_dir, mp, mp_len)) ++ continue; ++ ++ mnt_dir_len = strlen(mnt->mnt_dir); ++ is_autofs = !strcmp(mnt->mnt_type, "autofs"); ++ ++ if (mnt_dir_len == mp_len && !is_autofs) { ++ ret = 0; ++ break; ++ } ++ ++ if (is_autofs) ++ rv = umount2(mnt->mnt_dir, MNT_DETACH); + else +- rv = spawn_umount(ap->logopt, "-l", this->mp, NULL); ++ rv = spawn_umount(ap->logopt, "-l", mnt->mnt_dir, NULL); + if (rv == -1) { + debug(ap->logopt, +- "can't unlink %s from mount tree", this->mp); ++ "can't unlink %s from mount tree", mnt->mnt_dir); + + switch (errno) { + case EINVAL: +@@ -910,8 +933,8 @@ int unlink_mount_tree(struct autofs_poin + break; + } + } +- this = this->next; + } ++ fclose(tab); + + return ret; + } diff --git a/SOURCES/autofs-5.1.5-use-mp-instead-of-path-in-mnt_list-entries.patch b/SOURCES/autofs-5.1.5-use-mp-instead-of-path-in-mnt_list-entries.patch new file mode 100644 index 0000000..19d722b --- /dev/null +++ b/SOURCES/autofs-5.1.5-use-mp-instead-of-path-in-mnt_list-entries.patch @@ -0,0 +1,436 @@ +autofs-5.1.5 - use mp instead of path in mnt_list entries + +From: Ian Kent + +Use the simpler, more instructive mp instead of path in the +mnt_list structure. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + daemon/direct.c | 18 ++++++------- + daemon/indirect.c | 22 ++++++++-------- + include/mounts.h | 4 +-- + lib/mounts.c | 70 +++++++++++++++++++++++++++--------------------------- + 5 files changed, 58 insertions(+), 57 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -64,6 +64,7 @@ xx/xx/2018 autofs-5.1.5 + - use ignore option for offset mounts as well. + - add config option for "ignore" mount option + - use bit flags for autofs mount types in mnt_list. ++- use mp instead of path in mnt_list entries. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -272,12 +272,12 @@ static int unlink_mount_tree(struct auto + mnt = list_entry(p, struct mnt_list, list); + + if (mnt->flags & MNTS_AUTOFS) +- rv = umount2(mnt->path, MNT_DETACH); ++ rv = umount2(mnt->mp, MNT_DETACH); + else +- rv = spawn_umount(ap->logopt, "-l", mnt->path, NULL); ++ rv = spawn_umount(ap->logopt, "-l", mnt->mp, NULL); + if (rv == -1) { + debug(ap->logopt, +- "can't unlink %s from mount tree", mnt->path); ++ "can't unlink %s from mount tree", mnt->mp); + + switch (errno) { + case EINVAL: +@@ -920,7 +920,7 @@ void *expire_proc_direct(void *arg) + */ + pthread_cleanup_push(master_source_lock_cleanup, ap->entry); + master_source_readlock(ap->entry); +- me = lookup_source_mapent(ap, next->path, LKP_DISTINCT); ++ me = lookup_source_mapent(ap, next->mp, LKP_DISTINCT); + pthread_cleanup_pop(1); + if (!me) + continue; +@@ -937,7 +937,7 @@ void *expire_proc_direct(void *arg) + */ + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); + if (next->flags & MNTS_INDIRECT) { +- master_notify_submount(ap, next->path, ap->state); ++ master_notify_submount(ap, next->mp, ap->state); + pthread_setcancelstate(cur_state, NULL); + continue; + } +@@ -968,7 +968,7 @@ void *expire_proc_direct(void *arg) + cache_writelock(me->mc); + if (me->ioctlfd != -1 && + fstat(me->ioctlfd, &st) != -1 && +- !count_mounts(ap, next->path, st.st_dev)) { ++ !count_mounts(ap, next->mp, st.st_dev)) { + ops->close(ap->logopt, me->ioctlfd); + me->ioctlfd = -1; + cache_unlock(me->mc); +@@ -979,7 +979,7 @@ void *expire_proc_direct(void *arg) + + ioctlfd = me->ioctlfd; + +- ret = ops->expire(ap->logopt, ioctlfd, next->path, how); ++ ret = ops->expire(ap->logopt, ioctlfd, next->mp, how); + if (ret) { + left++; + pthread_setcancelstate(cur_state, NULL); +@@ -1002,10 +1002,10 @@ void *expire_proc_direct(void *arg) + if (ap->state == ST_EXPIRE || ap->state == ST_PRUNE) + pthread_testcancel(); + +- debug(ap->logopt, "send expire to trigger %s", next->path); ++ debug(ap->logopt, "send expire to trigger %s", next->mp); + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); +- ret = ops->expire(ap->logopt, ioctlfd, next->path, how); ++ ret = ops->expire(ap->logopt, ioctlfd, next->mp, how); + if (ret) + left++; + pthread_setcancelstate(cur_state, NULL); +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -49,12 +49,12 @@ static int unlink_mount_tree(struct auto + this = mnts; + while (this) { + if (this->flags & MNTS_AUTOFS) +- rv = umount2(this->path, MNT_DETACH); ++ rv = umount2(this->mp, MNT_DETACH); + else +- rv = spawn_umount(ap->logopt, "-l", this->path, NULL); ++ rv = spawn_umount(ap->logopt, "-l", this->mp, NULL); + if (rv == -1) { + debug(ap->logopt, +- "can't unlink %s from mount tree", this->path); ++ "can't unlink %s from mount tree", this->mp); + + switch (errno) { + case EINVAL: +@@ -446,7 +446,7 @@ void *expire_proc_indirect(void *arg) + */ + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); + if (next->flags & MNTS_INDIRECT) +- master_notify_submount(ap, next->path, ap->state); ++ master_notify_submount(ap, next->mp, ap->state); + else if (next->flags & MNTS_OFFSET) { + struct map_source *map; + struct mapent_cache *mc = NULL; +@@ -454,13 +454,13 @@ void *expire_proc_indirect(void *arg) + struct stat st; + + /* It's got a mount, deal with in the outer loop */ +- if (is_mounted(_PATH_MOUNTED, next->path, MNTS_REAL)) { ++ if (is_mounted(_PATH_MOUNTED, next->mp, MNTS_REAL)) { + pthread_setcancelstate(cur_state, NULL); + continue; + } + + /* Don't touch submounts */ +- if (master_find_submount(ap, next->path)) { ++ if (master_find_submount(ap, next->mp)) { + pthread_setcancelstate(cur_state, NULL); + continue; + } +@@ -471,7 +471,7 @@ void *expire_proc_indirect(void *arg) + while (map) { + mc = map->mc; + cache_writelock(mc); +- me = cache_lookup_distinct(mc, next->path); ++ me = cache_lookup_distinct(mc, next->mp); + if (me) + break; + cache_unlock(mc); +@@ -513,7 +513,7 @@ void *expire_proc_indirect(void *arg) + * If the mount corresponds to an offset trigger then + * the key is the path, otherwise it's the last component. + */ +- ind_key = strrchr(next->path, '/'); ++ ind_key = strrchr(next->mp, '/'); + if (ind_key) + ind_key++; + +@@ -526,7 +526,7 @@ void *expire_proc_indirect(void *arg) + */ + pthread_cleanup_push(master_source_lock_cleanup, ap->entry); + master_source_readlock(ap->entry); +- me = lookup_source_mapent(ap, next->path, LKP_DISTINCT); ++ me = lookup_source_mapent(ap, next->mp, LKP_DISTINCT); + if (!me && ind_key) + me = lookup_source_mapent(ap, ind_key, LKP_NORMAL); + pthread_cleanup_pop(1); +@@ -538,10 +538,10 @@ void *expire_proc_indirect(void *arg) + cache_unlock(me->mc); + } + +- debug(ap->logopt, "expire %s", next->path); ++ debug(ap->logopt, "expire %s", next->mp); + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); +- ret = ops->expire(ap->logopt, ioctlfd, next->path, how); ++ ret = ops->expire(ap->logopt, ioctlfd, next->mp, how); + if (ret) + left++; + pthread_setcancelstate(cur_state, NULL); +--- autofs-5.1.4.orig/include/mounts.h ++++ autofs-5.1.4/include/mounts.h +@@ -52,7 +52,7 @@ extern const unsigned int t_offset; + struct mapent; + + struct mnt_list { +- char *path; ++ char *mp; + unsigned int flags; + /* + * List operations ie. get_mnt_list. +@@ -101,7 +101,7 @@ int ext_mount_remove(struct list_head *, + int ext_mount_inuse(const char *); + struct mnt_list *get_mnt_list(const char *table, const char *path, int include); + void free_mnt_list(struct mnt_list *list); +-int is_mounted(const char *table, const char *path, unsigned int type); ++int is_mounted(const char *table, const char *mp, unsigned int type); + void tree_free_mnt_tree(struct mnt_list *tree); + struct mnt_list *tree_make_mnt_tree(const char *table, const char *path); + int tree_get_mnt_list(struct mnt_list *mnts, struct list_head *list, const char *path, int include); +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -817,8 +817,8 @@ struct mnt_list *get_mnt_list(const char + strncmp(mnt->mnt_dir, path, pathlen) != 0) + continue; + +- /* Not a subdirectory of requested path ? */ +- /* pathlen == 1 => everything is subdir */ ++ /* Not a subdirectory of requested mp? */ ++ /* mp_len == 1 => everything is subdir */ + if (pathlen > 1 && len > pathlen && + mnt->mnt_dir[pathlen] != '/') + continue; +@@ -834,7 +834,7 @@ struct mnt_list *get_mnt_list(const char + mptr = list; + last = NULL; + while (mptr) { +- if (len >= strlen(mptr->path)) ++ if (len >= strlen(mptr->mp)) + break; + last = mptr; + mptr = mptr->next; +@@ -847,13 +847,13 @@ struct mnt_list *get_mnt_list(const char + + ent->next = mptr; + +- ent->path = malloc(len + 1); +- if (!ent->path) { ++ ent->mp = malloc(len + 1); ++ if (!ent->mp) { + endmntent(tab); + free_mnt_list(list); + return NULL; + } +- strcpy(ent->path, mnt->mnt_dir); ++ strcpy(ent->mp, mnt->mnt_dir); + + if (!strcmp(mnt->mnt_type, "autofs")) + ent->flags |= MNTS_AUTOFS; +@@ -885,23 +885,23 @@ void free_mnt_list(struct mnt_list *list + + next = this->next; + +- if (this->path) +- free(this->path); ++ if (this->mp) ++ free(this->mp); + + free(this); + } + } + +-static int table_is_mounted(const char *table, const char *path, unsigned int type) ++static int table_is_mounted(const char *table, const char *mp, unsigned int type) + { + struct mntent *mnt; + struct mntent mnt_wrk; + char buf[PATH_MAX * 3]; +- size_t pathlen = strlen(path); ++ size_t mp_len = strlen(mp); + FILE *tab; + int ret = 0; + +- if (!path || !pathlen || pathlen >= PATH_MAX) ++ if (!mp || !mp_len || mp_len >= PATH_MAX) + return 0; + + tab = open_setmntent_r(table); +@@ -928,7 +928,7 @@ static int table_is_mounted(const char * + continue; + } + +- if (pathlen == len && !strncmp(path, mnt->mnt_dir, pathlen)) { ++ if (mp_len == len && !strncmp(mp, mnt->mnt_dir, mp_len)) { + ret = 1; + break; + } +@@ -938,7 +938,7 @@ static int table_is_mounted(const char * + return ret; + } + +-static int ioctl_is_mounted(const char *table, const char *path, unsigned int type) ++static int ioctl_is_mounted(const char *table, const char *mp, unsigned int type) + { + struct ioctl_ops *ops = get_ioctl_ops(); + unsigned int mounted; +@@ -947,9 +947,9 @@ static int ioctl_is_mounted(const char * + /* If the ioctl fails fall back to the potentially resource + * intensive mount table check. + */ +- ret = ops->ismountpoint(LOGOPT_NONE, -1, path, &mounted); ++ ret = ops->ismountpoint(LOGOPT_NONE, -1, mp, &mounted); + if (ret == -1) +- return table_is_mounted(table, path, type); ++ return table_is_mounted(table, mp, type); + + if (mounted) { + switch (type) { +@@ -964,14 +964,14 @@ static int ioctl_is_mounted(const char * + return 0; + } + +-int is_mounted(const char *table, const char *path, unsigned int type) ++int is_mounted(const char *table, const char *mp, unsigned int type) + { + struct ioctl_ops *ops = get_ioctl_ops(); + + if (ops->ismountpoint) +- return ioctl_is_mounted(table, path, type); ++ return ioctl_is_mounted(table, mp, type); + else +- return table_is_mounted(table, path, type); ++ return table_is_mounted(table, mp, type); + } + + /* +@@ -1006,12 +1006,12 @@ void tree_free_mnt_tree(struct mnt_list + + list_del(&this->self); + +- free(this->path); ++ free(this->mp); + + free(this); + } + +- free(tree->path); ++ free(tree->mp); + free(tree); + } + +@@ -1062,14 +1062,14 @@ struct mnt_list *tree_make_mnt_tree(cons + INIT_LIST_HEAD(&ent->entries); + INIT_LIST_HEAD(&ent->sublist); + +- ent->path = malloc(len + 1); +- if (!ent->path) { ++ ent->mp = malloc(len + 1); ++ if (!ent->mp) { + endmntent(tab); + free(ent); + tree_free_mnt_tree(tree); + return NULL; + } +- strcpy(ent->path, mnt->mnt_dir); ++ strcpy(ent->mp, mnt->mnt_dir); + + if (!strcmp(mnt->mnt_type, "autofs")) + ent->flags |= MNTS_AUTOFS; +@@ -1085,8 +1085,8 @@ struct mnt_list *tree_make_mnt_tree(cons + + mptr = tree; + while (mptr) { +- int elen = strlen(ent->path); +- int mlen = strlen(mptr->path); ++ int elen = strlen(ent->mp); ++ int mlen = strlen(mptr->mp); + + if (elen < mlen) { + if (mptr->left) { +@@ -1106,7 +1106,7 @@ struct mnt_list *tree_make_mnt_tree(cons + } + } + +- eq = strcmp(ent->path, mptr->path); ++ eq = strcmp(ent->mp, mptr->mp); + if (eq < 0) { + if (mptr->left) + mptr = mptr->left; +@@ -1146,7 +1146,7 @@ int tree_get_mnt_list(struct mnt_list *m + return 0; + + plen = strlen(path); +- mlen = strlen(mnts->path); ++ mlen = strlen(mnts->mp); + if (mlen < plen) + return tree_get_mnt_list(mnts->right, list, path, include); + else { +@@ -1155,10 +1155,10 @@ int tree_get_mnt_list(struct mnt_list *m + tree_get_mnt_list(mnts->left, list, path, include); + + if ((!include && mlen <= plen) || +- strncmp(mnts->path, path, plen)) ++ strncmp(mnts->mp, path, plen)) + goto skip; + +- if (plen > 1 && mlen > plen && mnts->path[plen] != '/') ++ if (plen > 1 && mlen > plen && mnts->mp[plen] != '/') + goto skip; + + INIT_LIST_HEAD(&mnts->list); +@@ -1193,7 +1193,7 @@ int tree_get_mnt_sublist(struct mnt_list + return 0; + + plen = strlen(path); +- mlen = strlen(mnts->path); ++ mlen = strlen(mnts->mp); + if (mlen < plen) + return tree_get_mnt_sublist(mnts->right, list, path, include); + else { +@@ -1202,10 +1202,10 @@ int tree_get_mnt_sublist(struct mnt_list + tree_get_mnt_sublist(mnts->left, list, path, include); + + if ((!include && mlen <= plen) || +- strncmp(mnts->path, path, plen)) ++ strncmp(mnts->mp, path, plen)) + goto skip; + +- if (plen > 1 && mlen > plen && mnts->path[plen] != '/') ++ if (plen > 1 && mlen > plen && mnts->mp[plen] != '/') + goto skip; + + INIT_LIST_HEAD(&mnts->sublist); +@@ -1237,7 +1237,7 @@ int tree_find_mnt_ents(struct mnt_list * + return 0; + + plen = strlen(path); +- mlen = strlen(mnts->path); ++ mlen = strlen(mnts->mp); + if (mlen < plen) + return tree_find_mnt_ents(mnts->right, list, path); + else if (mlen > plen) +@@ -1247,7 +1247,7 @@ int tree_find_mnt_ents(struct mnt_list * + + tree_find_mnt_ents(mnts->left, list, path); + +- if (!strcmp(mnts->path, path)) { ++ if (!strcmp(mnts->mp, path)) { + INIT_LIST_HEAD(&mnts->entries); + list_add(&mnts->entries, list); + } +@@ -1258,7 +1258,7 @@ int tree_find_mnt_ents(struct mnt_list * + + this = list_entry(p, struct mnt_list, self); + +- if (!strcmp(this->path, path)) { ++ if (!strcmp(this->mp, path)) { + INIT_LIST_HEAD(&this->entries); + list_add(&this->entries, list); + } diff --git a/SOURCES/autofs-5.1.5-use-single-unlink_umount_tree-for-both-direct-and-indirect-mounts.patch b/SOURCES/autofs-5.1.5-use-single-unlink_umount_tree-for-both-direct-and-indirect-mounts.patch new file mode 100644 index 0000000..ede2e23 --- /dev/null +++ b/SOURCES/autofs-5.1.5-use-single-unlink_umount_tree-for-both-direct-and-indirect-mounts.patch @@ -0,0 +1,271 @@ +autofs-5.1.5 - use single unlink_umount_tree() for both direct and indirect mounts + +From: Ian Kent + +Use the same function, unlink_umount_tree(), for forced unlink of mounts +for both indirect and direct mounts. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + daemon/direct.c | 96 +++++++++++++--------------------------------------- + daemon/indirect.c | 2 - + daemon/state.c | 17 +-------- + include/automount.h | 2 - + 5 files changed, 30 insertions(+), 88 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -70,6 +70,7 @@ xx/xx/2018 autofs-5.1.5 + - use local getmntent_r in table_is_mounted(). + - refactor unlink_active_mounts() in direct.c. + - don't use tree_is_mounted() for mounted checks. ++- use single unlink_umount_tree() for both direct and indirect mounts. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -49,6 +49,8 @@ pthread_key_t key_mnt_direct_params; + pthread_key_t key_mnt_offset_params; + pthread_once_t key_mnt_params_once = PTHREAD_ONCE_INIT; + ++int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts); ++ + static void key_mnt_params_destroy(void *arg) + { + struct mnt_params *mp; +@@ -256,64 +258,8 @@ done: + return 0; + } + +-static int unlink_mount_tree(struct autofs_point *ap, struct list_head *list) +-{ +- struct list_head *p; +- int rv, ret; +- +- ret = 1; +- list_for_each(p, list) { +- struct mnt_list *mnt; +- +- mnt = list_entry(p, struct mnt_list, list); +- +- if (mnt->flags & MNTS_AUTOFS) +- rv = umount2(mnt->mp, MNT_DETACH); +- else +- rv = spawn_umount(ap->logopt, "-l", mnt->mp, NULL); +- if (rv == -1) { +- debug(ap->logopt, +- "can't unlink %s from mount tree", mnt->mp); +- +- switch (errno) { +- case EINVAL: +- warn(ap->logopt, +- "bad superblock or not mounted"); +- break; +- +- case ENOENT: +- case EFAULT: +- ret = 0; +- warn(ap->logopt, "bad path for mount"); +- break; +- } +- } +- } +- return ret; +-} +- +-static int unlink_active_mounts(struct autofs_point *ap, struct mnt_list *mnts, struct mapent *me) +-{ +- struct list_head list; +- +- INIT_LIST_HEAD(&list); +- +- if (!tree_get_mnt_list(mnts, &list, me->key, 1)) +- return 1; +- +- if (!unlink_mount_tree(ap, &list)) { +- debug(ap->logopt, +- "already mounted as other than autofs " +- "or failed to unlink entry in tree"); +- return 0; +- } +- +- return 1; +-} +- + int do_mount_autofs_direct(struct autofs_point *ap, +- struct mnt_list *mnts, struct mapent *me, +- time_t timeout) ++ struct mapent *me, time_t timeout) + { + const char *str_direct = mount_type_str(t_direct); + struct ioctl_ops *ops = get_ioctl_ops(); +@@ -342,6 +288,8 @@ int do_mount_autofs_direct(struct autofs + if (ret == 0) + return -1; + } else { ++ struct mnt_list *mnts; ++ + if (ap->state == ST_READMAP && is_mounted(me->key, MNTS_ALL)) { + time_t tout = get_exp_timeout(ap, me->source); + int save_ioctlfd, ioctlfd; +@@ -367,15 +315,23 @@ int do_mount_autofs_direct(struct autofs + return 0; + } + +- /* +- * A return of 1 indicates we successfully unlinked +- * the mount tree if there was one. A return of 0 +- * indicates we failed to unlink the mount tree so +- * we have to return a failure. +- */ +- ret = unlink_active_mounts(ap, mnts, me); +- if (!ret) +- return -1; ++ mnts = get_mnt_list(me->key, 1); ++ if (mnts) { ++ /* ++ * A return of 1 indicates we successfully unlinked ++ * the mount tree if there was one. A return of 0 ++ * indicates we failed to unlink the mount tree so ++ * we have to return a failure. ++ */ ++ ret = unlink_mount_tree(ap, mnts); ++ free_mnt_list(mnts); ++ if (!ret) { ++ error(ap->logopt, ++ "already mounted as other than autofs " ++ "or failed to unlink entry in tree"); ++ return -1; ++ } ++ } + + if (me->ioctlfd != -1) { + error(ap->logopt, "active direct mount %s", me->key); +@@ -494,7 +450,6 @@ int mount_autofs_direct(struct autofs_po + struct map_source *map; + struct mapent_cache *nc, *mc; + struct mapent *me, *ne, *nested; +- struct mnt_list *mnts; + time_t now = monotonic_time(NULL); + + if (strcmp(ap->path, "/-")) { +@@ -510,8 +465,6 @@ int mount_autofs_direct(struct autofs_po + return -1; + } + +- mnts = tree_make_mnt_tree("/"); +- pthread_cleanup_push(mnts_cleanup, mnts); + pthread_cleanup_push(master_source_lock_cleanup, ap->entry); + master_source_readlock(ap->entry); + nc = ap->entry->master->nc; +@@ -539,7 +492,7 @@ int mount_autofs_direct(struct autofs_po + if (ne) { + if (map->master_line < ne->age) { + /* TODO: check return, locking me */ +- do_mount_autofs_direct(ap, mnts, me, timeout); ++ do_mount_autofs_direct(ap, me, timeout); + } + me = cache_enumerate(mc, me); + continue; +@@ -556,7 +509,7 @@ int mount_autofs_direct(struct autofs_po + } + + /* TODO: check return, locking me */ +- do_mount_autofs_direct(ap, mnts, me, timeout); ++ do_mount_autofs_direct(ap, me, timeout); + + me = cache_enumerate(mc, me); + } +@@ -565,7 +518,6 @@ int mount_autofs_direct(struct autofs_po + } + pthread_cleanup_pop(1); + pthread_cleanup_pop(1); +- pthread_cleanup_pop(1); + + return 0; + } +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -40,7 +40,7 @@ + /* Attribute to create detached thread */ + extern pthread_attr_t th_attr_detached; + +-static int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts) ++int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts) + { + struct mnt_list *this; + int rv, ret; +--- autofs-5.1.4.orig/daemon/state.c ++++ autofs-5.1.4/daemon/state.c +@@ -350,14 +350,7 @@ static void do_readmap_cleanup(void *arg + return; + } + +-static void tree_mnts_cleanup(void *arg) +-{ +- struct mnt_list *mnts = (struct mnt_list *) arg; +- tree_free_mnt_tree(mnts); +- return; +-} +- +-static void do_readmap_mount(struct autofs_point *ap, struct mnt_list *mnts, ++static void do_readmap_mount(struct autofs_point *ap, + struct map_source *map, struct mapent *me, time_t now) + { + struct mapent_cache *nc; +@@ -444,7 +437,7 @@ static void do_readmap_mount(struct auto + debug(ap->logopt, + "%s is mounted", me->key); + } else +- do_mount_autofs_direct(ap, mnts, me, get_exp_timeout(ap, map)); ++ do_mount_autofs_direct(ap, me, get_exp_timeout(ap, map)); + + return; + } +@@ -455,7 +448,6 @@ static void *do_readmap(void *arg) + struct map_source *map; + struct mapent_cache *nc, *mc; + struct readmap_args *ra; +- struct mnt_list *mnts; + int status; + time_t now; + +@@ -499,8 +491,6 @@ static void *do_readmap(void *arg) + struct mapent *me; + unsigned int append_alarm = !ap->exp_runfreq; + +- mnts = tree_make_mnt_tree("/"); +- pthread_cleanup_push(tree_mnts_cleanup, mnts); + nc = ap->entry->master->nc; + cache_readlock(nc); + pthread_cleanup_push(cache_lock_cleanup, nc); +@@ -518,7 +508,7 @@ static void *do_readmap(void *arg) + cache_readlock(mc); + me = cache_enumerate(mc, NULL); + while (me) { +- do_readmap_mount(ap, mnts, map, me, now); ++ do_readmap_mount(ap, map, me, now); + me = cache_enumerate(mc, me); + } + lookup_prune_one_cache(ap, map->mc, now); +@@ -538,7 +528,6 @@ static void *do_readmap(void *arg) + + pthread_cleanup_pop(1); + pthread_cleanup_pop(1); +- pthread_cleanup_pop(1); + } + + pthread_cleanup_pop(1); +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -606,7 +606,7 @@ void *expire_proc_indirect(void *); + void *expire_proc_direct(void *); + int expire_offsets_direct(struct autofs_point *ap, struct mapent *me, int now); + int mount_autofs_indirect(struct autofs_point *ap, const char *root); +-int do_mount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, struct mapent *me, time_t timeout); ++int do_mount_autofs_direct(struct autofs_point *ap, struct mapent *me, time_t timeout); + int mount_autofs_direct(struct autofs_point *ap); + int mount_autofs_offset(struct autofs_point *ap, struct mapent *me, const char *root, const char *offset); + void submount_signal_parent(struct autofs_point *ap, unsigned int success); diff --git a/SOURCES/autofs-5.1.6-update-ldap-READMEs-and-schema-definitions.patch b/SOURCES/autofs-5.1.6-update-ldap-READMEs-and-schema-definitions.patch new file mode 100644 index 0000000..b0003df --- /dev/null +++ b/SOURCES/autofs-5.1.6-update-ldap-READMEs-and-schema-definitions.patch @@ -0,0 +1,841 @@ +autofs-5.1.6 - update ldap READMEs and schema definitions + +From: Ian Kent + +The autofs schema in samples/autofs.schema should not be used for +autofs map information, it's very old and may be inaccurate or may +conflict with other schema definitions included in LDAP server +distributions. + +The README.autofs-schema has been updated to alert people to this +but the schema file has not yet been removed. + +A new README.ldap-schema has been added which recommends using either +of rfc2307 or rfc2307bis schema for autofs Sun format map information +stored in LDAP and at least one of these schema should be included in +LDAP server distributions. Additionally the README notes the schema +that needs to be used for autofs amd format maps is present in the +file samples/am-utils-ldap.schema. + +Ian + +Signed-off-by: Ian Kent +--- + README.autofs-schema | 8 + README.ldap-schema | 14 + + samples/am-utils-ldap-id.txt | 360 +++++++++++++++++++++++++++++++++++++++++++ + samples/am-utils-ldap.schema | 52 ++++++ + samples/rfc2307.schema | 37 ++++ + samples/rfc2307bis.schema | 310 +++++++++++++++++++++++++++++++++++++ + 6 files changed, 777 insertions(+), 4 deletions(-) + create mode 100644 README.ldap-schema + create mode 100644 samples/am-utils-ldap-id.txt + create mode 100644 samples/am-utils-ldap.schema + create mode 100644 samples/rfc2307.schema + create mode 100644 samples/rfc2307bis.schema + +--- autofs-5.1.4.orig/README.autofs-schema ++++ autofs-5.1.4/README.autofs-schema +@@ -9,10 +9,10 @@ not clear what schema to use for Linux a + + The schema was corrected somewhere along the line but the autofs + distribution copy was never updated. The schema has now been +-updated but it is not recommended for use as the schema for autofs +-map information. ++updated but may not be accurate and may conflict with other LDAP ++schemas so it is not recommended for use for autofs map information. + +-The rfc2307 or, preferably the, rfc2307bis schema is the recommened +-schema to use. ++The rfc2307 or the rfc2307bis schema is the recommened schema to ++use, based on requirements. + + Ian +--- /dev/null ++++ autofs-5.1.4/README.ldap-schema +@@ -0,0 +1,14 @@ ++LDAP Schema ++=========== ++ ++LDAP Schema definitions may be found in the samples sub-directory. ++ ++The ldap schema rfc2307.schema and rfc2307bis.schema may be used by ++autofs for Sun format automount maps, the choice of which is used is ++dependent on user needs. They are included for reference only as at ++least one of these should be included in LDAP server distributions. ++ ++The ldap schema am-utils-ldap.schema and am-utils-ldap-id.txt describe ++the schema used by autofs for amd format maps. ++ ++Ian +--- /dev/null ++++ autofs-5.1.4/samples/am-utils-ldap-id.txt +@@ -0,0 +1,360 @@ ++ ++ ++ ++ ++ ++ ++INTERNET-DRAFT Leif Johansson ++Intented Category: Experimental Stockholm University ++ ++ ++ ++ A directory (X.500 and LDAPv3) schema for Berkely automounter ++ ++ ++1. Status of this Memo ++ ++ This memo describes a directory (LDAP or X.500) schema for storing amd (Berkely- ++ style automounter) mount info maps. The schema is currently beeing supported by ++ the (beta version of the) am-utils version 6 package [AMUTILS]. ++ ++2. Overview and Rationale ++ ++ Directory services such as X.500 [X500] or LDAP [RFC2251] are a natural choice of ++ repository for amd mount map databases. All Object Identifiers in this document ++ are prefixed by amdSchema-id to be assigned later. The relation between this ++ schema and the automount schema elements in [HOWARD] are mostly superficial. The ++ model for the elements in [HOWARD] was the SUN automounter which has quite a ++ different syntax for mount maps. Furthermore the intended usage of this schema ++ differs from that of [HOWARD] in many respects. ++ ++3. DSA requirements ++ ++ Directory servers implementing this schema SHOULD maintain the modifyTimestamp ++ operational attribute. If not the amdMapCacheTtl attribute SHOULD be set to 0 ++ indicating to clients that caching of map entries SHOULD be turned off. Clients ++ wishing to use the amdMap schema MAY use the modifyTimestamp information to set ++ the ttl for internal caching schemes. A value of 0 for the amdMapCacheTtl must ++ result in clients turning off any local caching. ++ ++4. Syntax definitions ++ ++ The following attribute syntax is defined in this document: ++ ++ amdlocationlist ++ ++ This syntax represents a amd map value. This is the syntax expressed in BNF using ++ definitions from [RFC2252]: ++ ++ amdlocationlist = amdlocationselection | ++ amdlocationlist whsp "||" whsp amdlocationselection ++ ++ amdlocationselection = amdlocation | ++ amdlocationselection whsp amdlocation ++ ++ ++ ++ ++Johansson [Page 1] ++ ++ ++ ++ ++ ++Internet draft Berkeley AMD LDAP Schema 30 March 1998 ++ ++ ++ amdlocation = amdlocationinfo | ++ "-" amdlocationinfo | ++ "-" ++ ++ amdlocationinfo = seloropt | ++ amdlocationinfo ";" seloropt | ++ ";" ++ ++ seloropt = seletion | ++ optass ++ ++ selection = keystring "==" printablestring ++ keystring "!=" printablestring ++ ++ optass = keystring ++ ++ X.500 servers or LDAPv3 servers (supporting the binary attribute option) may use ++ the following syntax definition: ++ ++ AmdLocationList ::= SEQUENCE OF { ++ SEQUENCE OF { ++ location AmdLocation ++ } ++ } ++ ++ AmdLocation ::= SET OF { ++ CHOICE { ++ location [0] AmdLocationInfo ++ notlocation [1] AmdLocationInfo ++ not [2] NULL ++ } ++ } ++ ++ AmdLocationInfo ::= SET OF { ++ CHOICE { ++ selection [0] AmdSelection ++ option [1] AmdOption ++ } ++ } ++ ++ AmdSelection ::= CHOICE { ++ eq [0] AttributeAndValue ++ ne [1] AttributeAndValue ++ } ++ ++ AmdOption ::= AttributeAndValue ++ AttributeAndValue ::= SEQUENCE { ++ attribute IA5String ++ ++ ++ ++Johansson [Page 2] ++ ++ ++ ++ ++ ++Internet draft Berkeley AMD LDAP Schema 30 March 1998 ++ ++ ++ value IA5String ++ } ++ ++5. Attribute types ++ ++ The following attribute types are defined in this document: ++ ++ amdMapName ++ amdMapCacheTtl ++ amdMapEntry ++ amdMapEntryKey ++ amdMapEntryValue ++ ++ amdSchema-a OBJECT IDENTIFIER ::= { amdSchema-id 1 } ++ ++ amdMapName ATTRIBUTE ::= { ++ WITH SYNTAX IA5String ++ EQUALITY MATCHING RULE caseIgoreExactMatch ++ --ID { amdSchema-a 1 } ++ DESCRIPTION ++ "This attribute is the symbolic and in the naming ++ context unique name of an amd map. This corresponds ++ in the case of a flat file database to the name of ++ the file or the mount-point of the map." ++ } ++ ++ ++ amdMapCacheTtl ++ ATTRIBUTE ::= { ++ WITH SYNTAX Integer ++ EQUALITY MATCHING RULE integerExactMatch ++ --ID { amdSchema-a 2 } ++ SINGLE VALUED ++ DESCRIPTION ++ "The maximum time-to-live for the entries in this ++ map. After this many milliseconds the map has to ++ be cleared from local caches and reloaded. A value ++ of 0 disables caching." ++ } ++ ++ amdMapEntry ++ ATTRIBUTE ::= { ++ WITH SYNTAX DistinguishedName ++ EQUALITY MATHCING RULE dNCaseIgnoreExactMatch ++ --ID { amdSchema-a 3 } ++ DESCRIPTION ++ "A multivalued attribute listing the distinguished ++ names of the amdMapEntries making up this amdMap ++ ++ ++ ++Johansson [Page 3] ++ ++ ++ ++ ++ ++Internet draft Berkeley AMD LDAP Schema 30 March 1998 ++ ++ ++ object." ++ } ++ ++ amdMapEntryKey ::= { ++ ATTRIBUTE ::= { ++ WITH SYNTAX IA5String ++ EQUALITY MATCHING RULE stringExactMatch ++ --ID { amdSchema-a 4 } ++ SINGLE VALUED ++ DESCRIPTION ++ "The value of this attribute is usually the name of ++ a mountpoint for this amdMapEntry." ++ } ++ ++ amdMapEntryValue ::= { ++ ATTRIBUTE ::= { ++ WITH SYNTAX AmdLocationList ++ --ID { amdSchema-a 5 } ++ DESCRIPTION ++ "This is the actual mount information for the amdMapEntry ++ using the syntax described above." ++ } ++ ++ amdMapEntryKey ::= { ++ ATTRIBUTE ::= { ++ WITH SYNTAX IA5String ++ EQUALITY MATCHING RULE stringExactMatch ++ --ID { amdSchema-a 4 } ++ SINGLE VALUED ++ DESCRIPTION ++ "The value of this attribute is usually the name of ++ a mountpoint for this amdMapEntry." ++ } ++ ++ amdMapEntryValue ::= { ++ ATTRIBUTE ::= { ++ WITH SYNTAX AmdLocationList ++ --ID { amdSchema-a 5 } ++ DESCRIPTION ++ "This is the actual mount information for the amdMapEntry ++ using the syntax described above." ++ } ++ ++6. Object classes ++ ++ The following object classes are defined in this document: ++ ++ amdMap ++ ++ ++ ++Johansson [Page 4] ++ ++ ++ ++ ++ ++Internet draft Berkeley AMD LDAP Schema 30 March 1998 ++ ++ ++ amdMapEntry ++ ++ defined as follows: ++ ++ amdSchema-oc ::= { amdSchema-id 2 } ++ ++ amdMap OBJECT-CLASS ::= { ++ SUBCLASS OF { top } ++ KIND auxiliary ++ --ID { amdSchema-oc 1 } ++ MAY CONTAIN { amdMapCacheTtl , cn } ++ MUST CONTAIN { amdMapName , amdMapEntry } ++ } ++ ++ amdMapEntry OBJECT-CLASS ::= { ++ SUBCLASS OF { top } ++ KIND structural ++ --ID { amdSchema-oc 2 } ++ MUST CONTAIN { ++ amdMapName , ++ amdEntryKey , ++ amdEntryValue , ++ } MAY CONTAIN ++ { cn } DESCRIPTION "An entry of this ++ object class describes mount information relative to a ++ certain amdMap entry" ++ } ++ ++7. Examples ++ ++ ++ ++8. Security Considerations ++ ++ Due to the security problems posed by NFS care should be taken not to advertise ++ exported filesystems. Therefore it is often desirable to limit access to entries ++ carrying amd mount map information to those systems to which the corresponding ++ filesystems have been exported. ++ ++9. References ++ ++ [AMUTILS] ++ am-utils homepage: http://shekel.cs.columbia.edu/~erez/am-utils.html ++ ++ [RFC2251] ++ M. Wahl, T. Howes, S. Kille, "Lightweight Directory Access ++ Protocol (v3)", RFC 2251, December 1997. ++ ++ ++ ++ ++Johansson [Page 5] ++ ++ ++ ++ ++ ++Internet draft Berkeley AMD LDAP Schema 30 March 1998 ++ ++ ++ [RFC2252] ++ M. Wahl, A. Coulbeck, T. Howes, S. Kille, "Lightweight Directory ++ Access Protocol (v3): Attribute Syntax Definitions", RFC 2252, ++ December 1997. ++ ++ [RFC2253] ++ M. Wahl, S. Kille, T. Howes, "Lightweight Directory Access ++ Protocol (v3): UTF-8 String Representation of Distinguished ++ Names", RFC 2253, December 1997. ++ ++ [HOWARD] ++ Luke Howard, "An Approach for Using LDAP as a Network ++ Information Service", draft-howard-nis-schema-??.txt, Internet ++ draft. ++ ++ [X500] ++ ITU something or other. ++ ++ ++ ++Author's Address ++ ++ ++ Leif Johansson ++ Department of Mathematics ++ Stockholm University ++ S-106 91 Stockholm ++ SWEDEN ++ ++ Email: leifj AT matematik.su.se ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++Johansson [Page 6] ++ ++ +--- /dev/null ++++ autofs-5.1.4/samples/am-utils-ldap.schema +@@ -0,0 +1,52 @@ ++# A schema for the Berkeley automounter (AMD) ++# Authored by Erez Zadok and/or source maintainers ++# Definition by Tim Colles ++# Revised by Adam Morley ++ ++# OID Base is 1.3.6.1.4.1.10180 ++# ++# Syntaxes are under 1.3.6.1.4.1.10180.3.175-199 ++# Attribute types are under 1.3.6.1.4.1.10180.2.175-199 ++# Object classes are under 1.3.6.1.4.1.10180.1.175-199 ++ ++# Attribute Type Definitions ++ ++attributetype ( 1.3.6.1.4.1.10180.2.175 ++ NAME 'amdmapTimestamp' ++ DESC 'Probably the time the map was last modified' ++ EQUALITY integerMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributetype ( 1.3.6.1.4.1.10180.2.176 ++ NAME 'amdmapName' ++ DESC 'The symbolic name of the map, ie. map_name' ++ EQUALITY caseIgnoreMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ++ SINGLE-VALUE ) ++ ++attributetype ( 1.3.6.1.4.1.10180.2.177 ++ NAME 'amdmapKey' ++ DESC 'The key value for this entry' ++ EQUALITY caseIgnoreMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ++ SINGLE-VALUE ) ++ ++attributetype ( 1.3.6.1.4.1.10180.2.178 ++ NAME 'amdmapValue' ++ DESC 'The mount information for this entry' ++ EQUALITY caseIgnoreMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ++ SINGLE-VALUE ) ++ ++# Object Class Definitions ++ ++objectclass ( 1.3.6.1.4.1.10180.1.175 NAME 'amdmapTimestamp' ++ SUP top STRUCTURAL ++ DESC 'Timestamp for an AMD map' ++ MUST ( cn $ amdmapName $ amdmapTimestamp ) ) ++ ++objectclass ( 1.3.6.1.4.1.10180.1.176 NAME 'amdmap' ++ SUP top STRUCTURAL ++ DESC 'Defines an AMD map entry' ++ MUST ( cn $ amdmapName $ amdmapKey $ amdmapValue ) ) +--- /dev/null ++++ autofs-5.1.4/samples/rfc2307.schema +@@ -0,0 +1,37 @@ ++attributeType ( 1.3.6.1.1.1.1.31 ++ NAME 'automountMapName' ++ DESC 'automount Map Name' ++ EQUALITY caseExactIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ++ X-ORIGIN 'user defined' ) ++ ++attributeType ( 1.3.6.1.1.1.1.32 ++ NAME 'automountKey' ++ DESC 'Automount Key value' ++ EQUALITY caseExactIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ++ X-ORIGIN 'user defined' ) ++ ++attributeType ( 1.3.6.1.1.1.1.33 ++ NAME 'automountInformation' ++ DESC 'Automount information' ++ EQUALITY caseExactIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ++ X-ORIGIN 'user defined' ) ++ ++objectClass ( 1.3.6.1.1.1.2.16 ++ NAME 'automountMap' ++ DESC 'Automount Map information' ++ SUP top STRUCTURAL ++ MUST automountMapName ++ MAY description ++ X-ORIGIN 'user defined' ) ++ ++objectClass ( 1.3.6.1.1.1.2.17 ++ NAME 'automount' ++ DESC 'Automount information' ++ SUP top STRUCTURAL ++ MUST ( automountKey $ automountInformation ) ++ MAY description ++ X-ORIGIN 'user defined' ) ++ +--- /dev/null ++++ autofs-5.1.4/samples/rfc2307bis.schema +@@ -0,0 +1,310 @@ ++### ++# Extracted from: http://tools.ietf.org/html/draft-howard-rfc2307bis-02 ++### ++ ++# Builtin ++#attributeType ( 1.3.6.1.1.1.1.0 NAME 'uidNumber' ++# DESC 'An integer uniquely identifying a user in an ++# administrative domain' ++# EQUALITY integerMatch ++# ORDERING integerOrderingMatch ++# SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++# SINGLE-VALUE ) ++ ++# Builtin ++#attributeType ( 1.3.6.1.1.1.1.1 NAME 'gidNumber' ++# DESC 'An integer uniquely identifying a group in an ++# administrative domain' ++# EQUALITY integerMatch ++# ORDERING integerOrderingMatch ++# SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++# SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.2 NAME 'gecos' ++ DESC 'The GECOS field; the common name' ++ EQUALITY caseIgnoreMatch ++ SUBSTR caseIgnoreSubstringsMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.3 NAME 'homeDirectory' ++ DESC 'The absolute path to the home directory' ++ EQUALITY caseExactIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.4 NAME 'loginShell' ++ DESC 'The path to the login shell' ++ EQUALITY caseExactIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.5 NAME 'shadowLastChange' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.6 NAME 'shadowMin' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.7 NAME 'shadowMax' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.8 NAME 'shadowWarning' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.9 NAME 'shadowInactive' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.10 NAME 'shadowExpire' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.11 NAME 'shadowFlag' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.12 NAME 'memberUid' ++ EQUALITY caseExactMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) ++ ++attributeType ( 1.3.6.1.1.1.1.13 NAME 'memberNisNetgroup' ++ EQUALITY caseExactMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) ++ ++attributeType ( 1.3.6.1.1.1.1.14 NAME 'nisNetgroupTriple' ++ DESC 'Netgroup triple' ++ EQUALITY caseIgnoreMatch ++ SUBSTR caseIgnoreSubstringsMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) ++ ++attributeType ( 1.3.6.1.1.1.1.15 NAME 'ipServicePort' ++ DESC 'Service port number' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.16 NAME 'ipServiceProtocol' ++ DESC 'Service protocol name' ++ EQUALITY caseIgnoreMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) ++ ++attributeType ( 1.3.6.1.1.1.1.17 NAME 'ipProtocolNumber' ++ DESC 'IP protocol number' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.18 NAME 'oncRpcNumber' ++ DESC 'ONC RPC number' ++ EQUALITY integerMatch ++ ORDERING integerOrderingMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.19 NAME 'ipHostNumber' ++ DESC 'IPv4 addresses as a dotted decimal omitting leading ++ zeros or IPv6 addresses as defined in RFC2373' ++ EQUALITY caseIgnoreIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) ++ ++attributeType ( 1.3.6.1.1.1.1.20 NAME 'ipNetworkNumber' ++ DESC 'IP network omitting leading zeros, eg. 192.168' ++ EQUALITY caseIgnoreIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.21 NAME 'ipNetmaskNumber' ++ DESC 'IP netmask omitting leading zeros, eg. 255.255.255.0' ++ EQUALITY caseIgnoreIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.22 NAME 'macAddress' ++ DESC 'MAC address in maximal, colon separated hex ++ notation, eg. 00:00:92:90:ee:e2' ++ EQUALITY caseIgnoreIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) ++ ++attributeType ( 1.3.6.1.1.1.1.23 NAME 'bootParameter' ++ DESC 'rpc.bootparamd parameter' ++ EQUALITY caseExactIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) ++ ++attributeType ( 1.3.6.1.1.1.1.24 NAME 'bootFile' ++ DESC 'Boot image name' ++ EQUALITY caseExactIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) ++ ++attributeType ( 1.3.6.1.1.1.1.26 NAME 'nisMapName' ++ DESC 'Name of a generic NIS map' ++ EQUALITY caseIgnoreMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{64} ) ++ ++attributeType ( 1.3.6.1.1.1.1.27 NAME 'nisMapEntry' ++ DESC 'A generic NIS entry' ++ EQUALITY caseExactMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.28 NAME 'nisPublicKey' ++ DESC 'NIS public key' ++ EQUALITY octetStringMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.29 NAME 'nisSecretKey' ++ DESC 'NIS secret key' ++ EQUALITY octetStringMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.30 NAME 'nisDomain' ++ DESC 'NIS domain' ++ EQUALITY caseIgnoreIA5Match ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} ) ++ ++attributeType ( 1.3.6.1.1.1.1.31 NAME 'automountMapName' ++ DESC 'automount Map Name' ++ EQUALITY caseExactMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.32 NAME 'automountKey' ++ DESC 'Automount Key value' ++ EQUALITY caseExactMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ++ SINGLE-VALUE ) ++ ++attributeType ( 1.3.6.1.1.1.1.33 NAME 'automountInformation' ++ DESC 'Automount information' ++ EQUALITY caseExactMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ++ SINGLE-VALUE ) ++ ++objectClass ( 1.3.6.1.1.1.2.0 NAME 'posixAccount' SUP top AUXILIARY ++ DESC 'Abstraction of an account with POSIX attributes' ++ MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory ) ++ MAY ( userPassword $ loginShell $ gecos $ ++ description ) ) ++ ++objectClass ( 1.3.6.1.1.1.2.1 NAME 'shadowAccount' SUP top AUXILIARY ++ DESC 'Additional attributes for shadow passwords' ++ MUST uid ++ MAY ( userPassword $ description $ ++ shadowLastChange $ shadowMin $ shadowMax $ ++ shadowWarning $ shadowInactive $ ++ shadowExpire $ shadowFlag ) ) ++ ++objectClass ( 1.3.6.1.1.1.2.2 NAME 'posixGroup' SUP top AUXILIARY ++ DESC 'Abstraction of a group of accounts' ++ MUST gidNumber ++ MAY ( userPassword $ memberUid $ ++ description ) ) ++ ++objectClass ( 1.3.6.1.1.1.2.3 NAME 'ipService' SUP top STRUCTURAL ++ DESC 'Abstraction an Internet Protocol service. ++ Maps an IP port and protocol (such as tcp or udp) ++ to one or more names; the distinguished value of ++ the cn attribute denotes the services canonical ++ name' ++ MUST ( cn $ ipServicePort $ ipServiceProtocol ) ++ MAY description ) ++ ++objectClass ( 1.3.6.1.1.1.2.4 NAME 'ipProtocol' SUP top STRUCTURAL ++ DESC 'Abstraction of an IP protocol. Maps a protocol number ++ to one or more names. The distinguished value of the cn ++ attribute denotes the protocol canonical name' ++ MUST ( cn $ ipProtocolNumber ) ++ MAY description ) ++ ++objectClass ( 1.3.6.1.1.1.2.5 NAME 'oncRpc' SUP top STRUCTURAL ++ DESC 'Abstraction of an Open Network Computing (ONC) ++ [RFC1057] Remote Procedure Call (RPC) binding. ++ This class maps an ONC RPC number to a name. ++ The distinguished value of the cn attribute denotes ++ the RPC service canonical name' ++ MUST ( cn $ oncRpcNumber ) ++ MAY description ) ++ ++objectClass ( 1.3.6.1.1.1.2.6 NAME 'ipHost' SUP top AUXILIARY ++ DESC 'Abstraction of a host, an IP device. The distinguished ++ value of the cn attribute denotes the hosts canonical ++ name. Device SHOULD be used as a structural class' ++ MUST ( cn $ ipHostNumber ) ++ MAY ( userPassword $ l $ description $ ++ manager ) ) ++ ++objectClass ( 1.3.6.1.1.1.2.7 NAME 'ipNetwork' SUP top STRUCTURAL ++ DESC 'Abstraction of a network. The distinguished value of ++ the cn attribute denotes the network canonical name' ++ MUST ipNetworkNumber ++ MAY ( cn $ ipNetmaskNumber $ l $ description $ manager ) ) ++ ++objectClass ( 1.3.6.1.1.1.2.8 NAME 'nisNetgroup' SUP top STRUCTURAL ++ DESC 'Abstraction of a netgroup. May refer to other ++ netgroups' ++ MUST cn ++ MAY ( nisNetgroupTriple $ memberNisNetgroup $ description ) ) ++ ++objectClass ( 1.3.6.1.1.1.2.9 NAME 'nisMap' SUP top STRUCTURAL ++ DESC 'A generic abstraction of a NIS map' ++ MUST nisMapName ++ MAY description ) ++ ++objectClass ( 1.3.6.1.1.1.2.10 NAME 'nisObject' SUP top STRUCTURAL ++ DESC 'An entry in a NIS map' ++ MUST ( cn $ nisMapEntry $ nisMapName ) ) ++ ++objectClass ( 1.3.6.1.1.1.2.11 NAME 'ieee802Device' SUP top AUXILIARY ++ DESC 'A device with a MAC address; device SHOULD be ++ used as a structural class' ++ MAY macAddress ) ++ ++objectClass ( 1.3.6.1.1.1.2.12 NAME 'bootableDevice' SUP top AUXILIARY ++ DESC 'A device with boot parameters; device SHOULD be ++ used as a structural class' ++ MAY ( bootFile $ bootParameter ) ) ++ ++objectClass ( 1.3.6.1.1.1.2.14 NAME 'nisKeyObject' SUP top AUXILIARY ++ DESC 'An object with a public and secret key' ++ MUST ( cn $ nisPublicKey $ nisSecretKey ) ++ MAY ( uidNumber $ description ) ) ++ ++objectClass ( 1.3.6.1.1.1.2.15 NAME 'nisDomainObject' SUP top AUXILIARY ++ DESC 'Associates a NIS domain with a naming context' ++ MUST nisDomain ) ++ ++objectClass ( 1.3.6.1.1.1.2.16 NAME 'automountMap' SUP top STRUCTURAL ++ MUST ( automountMapName ) ++ MAY description ) ++ ++objectClass ( 1.3.6.1.1.1.2.17 NAME 'automount' SUP top STRUCTURAL ++ DESC 'Automount information' ++ MUST ( automountKey $ automountInformation ) ++ MAY description ) ++ ++objectClass ( 1.3.6.1.1.1.2.18 NAME 'groupOfMembers' SUP top STRUCTURAL ++ DESC 'A group with members (DNs)' ++ MUST cn ++ MAY ( businessCategory $ seeAlso $ owner $ ou $ o $ ++ description $ member ) ) diff --git a/SPECS/autofs.spec b/SPECS/autofs.spec index 389fd3d..77b68c5 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.1.4 -Release: 35%{?dist} +Release: 38%{?dist} Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -69,6 +69,32 @@ Patch52: autofs-5.1.5-make-expire-remaining-log-level-debug.patch Patch53: autofs-5.1.5-allow-period-following-macro-in-selector-value.patch Patch54: autofs-5.1.5-fix-macro-expansion-in-selector-values.patch +Patch60: autofs-5.1.5-also-use-strictexpire-for-offsets.patch +Patch61: autofs-5.1.4-change-expire-type-naming-to-better-reflect-usage.patch +Patch62: autofs-5.1.5-remove-unused-function-has_fstab_option.patch +Patch63: autofs-5.1.5-remove-unused-function-reverse_mnt_list.patch +Patch64: autofs-5.1.5-remove-a-couple-of-old-debug-messages.patch +Patch65: autofs-5.1.5-fix-amd-entry-memory-leak.patch +Patch66: autofs-5.1.5-fix-unlink_mount_tree-not-umounting-mounts.patch +Patch67: autofs-5.1.5-add-ignore-mount-option.patch +Patch68: autofs-5.1.5-use-ignore-option-for-offset-mounts-as-well.patch +Patch69: autofs-5.1.5-add-config-option-for-ignore-mount-option.patch +Patch70: autofs-5.1.5-use-bit-flags-for-autofs-mount-types-in-mnt_list.patch +Patch71: autofs-5.1.5-use-mp-instead-of-path-in-mnt_list-entries.patch +Patch72: autofs-5.1.5-always-use-PROC_MOUNTS-to-make-mount-lists.patch +Patch73: autofs-5.1.5-add-glibc-getmntent.patch +Patch74: autofs-5.1.5-use-local-getmntent_r-in-table_is_mounted.patch +Patch75: autofs-5.1.5-refactor-unlink_active_mounts-in-direct_c.patch +Patch76: autofs-5.1.5-dont-use-tree_is_mounted-for-mounted-checks.patch +Patch77: autofs-5.1.5-use-single-unlink_umount_tree-for-both-direct-and-indirect-mounts.patch +Patch78: autofs-5.1.5-move-unlink_mount_tree-to-lib_mounts_c.patch +Patch79: autofs-5.1.5-use-local_getmntent_r-for-unlink_mount_tree.patch +Patch80: autofs-5.1.5-use-local-getmntent_r-in-get_mnt_list.patch +Patch81: autofs-5.1.5-use-local-getmntent_r-in-tree_get_mnt_list.patch +Patch82: autofs-5.1.5-fix-missing-initialization-of-autofs_point-flags.patch + +Patch83: autofs-5.1.6-update-ldap-READMEs-and-schema-definitions.patch + %if %{with_systemd} BuildRequires: systemd-units BuildRequires: systemd-devel @@ -184,6 +210,32 @@ echo %{version}-%{release} > .version %patch53 -p1 %patch54 -p1 +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 +%patch64 -p1 +%patch65 -p1 +%patch66 -p1 +%patch67 -p1 +%patch68 -p1 +%patch69 -p1 +%patch70 -p1 +%patch71 -p1 +%patch72 -p1 +%patch73 -p1 +%patch74 -p1 +%patch75 -p1 +%patch76 -p1 +%patch77 -p1 +%patch78 -p1 +%patch79 -p1 +%patch80 -p1 +%patch81 -p1 +%patch82 -p1 + +%patch83 -p1 + %build LDFLAGS=-Wl,-z,now %configure --disable-mount-locking --enable-ignore-busy --with-libtirpc --without-hesiod %{?systemd_configure_arg:} @@ -262,7 +314,8 @@ fi %{_bindir}/systemctl try-restart %{name}.service >/dev/null 2>&1 || : %files -%doc CREDITS INSTALL COPY* README* samples/ldap* samples/autofs.schema +%doc CREDITS INSTALL COPY* README* samples/ldap* samples/*.schema +%doc samples/am-utils-ldap-id.txt %config %{init_file_name} %config(noreplace,missingok) /etc/auto.master %config(noreplace) /etc/autofs.conf @@ -277,6 +330,44 @@ fi %dir /etc/auto.master.d %changelog +* Mon Nov 25 2019 Ian Kent - 5.1.4-38 +- bz1660145 - autofs.schema doesn't work in RHEL8 + - update spec file doc inclusions for schema definition update. +- Related: rhbz#1660145 + +* Mon Nov 25 2019 Ian Kent - 5.1.4-37 +- bz1660145 - autofs.schema doesn't work in RHEL8 + - update ldap READMEs and schema definitions. +- Resolves: rhbz#1660145 + +* Tue Nov 12 2019 Ian Kent - 5.1.4-36 +- bz1743442 - getmntent returns additional "-hosts" entries when + automounter is used with "hosts" map (userspace part) + - also use strictexpire for offsets (mounts). + - change expire type naming to better reflect usage. + - remove unused function has_fstab_option(). + - remove unused function reverse_mnt_list(). + - remove a couple of old debug messages. + - fix amd entry memory leak. + - fix unlink_mount_tree() not umounting mounts. + - add ignore mount option. + - use ignore option for offset mounts as well. + - add config option for "ignore" mount option. + - use bit flags for autofs mount types in mnt_list. + - use mp instead of path in mnt_list entries. + - always use PROC_MOUNTS to make mount lists. + - add glibc getmntent_r(). + - use local getmntent_r in table_is_mounted(). + - refactor unlink_active_mounts() in direct.c. + - don't use tree_is_mounted() for mounted checks. + - use single unlink_umount_tree() for both direct and indirect mounts. + - move unlink_mount_tree() to lib/mounts.c. + - use local_getmntent_r() for unlink_mount_tree(). + - use local getmntent_r() in get_mnt_list(). + - use local getmntent_r() in tree_make_mnt_list(). + - fix missing initialization of autofs_point flags. +- Resolves: rhbz#1743442 + * Thu Jun 13 2019 Ian Kent - 5.1.4-35 - bz1681956 - autofs changes blocked until gating tests are added - correct test name in gating.yaml.