From 5b988a95573769b6acf1f396f18b02402992d174 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Thu, 1 Aug 2019 13:02:07 -0400 Subject: [PATCH] import autofs-5.1.4-35.el8 --- .autofs.metadata | 1 + .gitignore | 1 + ...es.rules-remove-samples-from-SUBDIRS.patch | 66 + ...ofs-5.1.4-account-for-libnsl-changes.patch | 557 ++++ ...NULL-check-in-prepare_attempt_prefix.patch | 34 + ...ap-entry-to-the-installed-master-map.patch | 42 + ...ditional-inclusion-of-fedfs-binaries.patch | 184 ++ ...add-error-handling-for-ext_mount_add.patch | 121 + .../autofs-5.1.4-add-fedfs-getsrvinfo_c.patch | 402 +++ .../autofs-5.1.4-add-fedfs-map-nfs4_c.patch | 342 +++ ...ge-note-about-extra-slashes-in-paths.patch | 40 + ...pseudo-options-for-mount-propagation.patch | 179 ++ SOURCES/autofs-5.1.4-add-mount_fedfs_c.patch | 696 +++++ ...-systemd-service-command-line-option.patch | 137 + ...-After-line-to-include-statd-service.patch | 39 + ...r-handle-hesiod-support-not-built-in.patch | 130 + SOURCES/autofs-5.1.4-covarity-fixes-1.patch | 425 +++ ...ing-slash-in-master-map-mount-points.patch | 48 + ...e-array-for-path-when-not-neccessary.patch | 56 + ...ofs-5.1.4-fix-NFS-version-mask-usage.patch | 69 + ...ofs-5.1.4-fix-age-setting-at-startup.patch | 42 + ...-fix-amd-parser-opts-option-handling.patch | 66 + ...utofs-5.1.4-fix-deadlock-in-dumpmaps.patch | 40 + ....1.4-fix-directory-create-permission.patch | 207 ++ ...1.4-fix-error-return-in-do_nfs_mount.patch | 35 + ...-fix-fd-leak-in-rpc_do_create_client.patch | 46 + ...utofs-5.1.4-fix-flag-file-permission.patch | 41 + ...-fix-incorrect-locking-in-sss-lookup.patch | 40 + ...-5.1.4-fix-libresolv-configure-check.patch | 94 + .../autofs-5.1.4-fix-monotonic_elapsed.patch | 49 + ...efix-option-handling-in-expand_entry.patch | 55 + ...tofs-5.1.4-fix-program-usage-message.patch | 40 + ...sublink-option-not-set-from-defaults.patch | 48 + ...date_negative_cache-map-source-usage.patch | 98 + ...e-after-free-in-do_master_list_reset.patch | 55 + ...-use-after-free-in-parse_ldap_config.patch | 34 + ...mprove-hostname-lookup-error-logging.patch | 123 + ....4-mark-removed-cache-entry-negative.patch | 64 + ...e-stdio-descriptors-to-become_daemon.patch | 117 + ....1.4-remove-autofs4-module-load-code.patch | 222 ++ ...-set-bind-mount-as-propagation-slave.patch | 69 + ...tch-for-autofs-typo-and-possible-bug.patch | 48 + ...5.1.4-update-build-info-with-systemd.patch | 41 + ...se-flags-for-startup-boolean-options.patch | 217 ++ ...1.4-use-systemd-sd_notify-at-startup.patch | 1357 ++++++++++ ...dnt-prevent-selection-among-replicas.patch | 226 ++ ...ULL-check-for-get_addr_string-return.patch | 39 + ...d-mount_verbose-configuration-option.patch | 174 ++ ...-5.1.5-add-strictexpire-mount-option.patch | 200 ++ ...od-following-macro-in-selector-value.patch | 34 + ...-hesiod-string-check-in-master_parse.patch | 49 + ...x-macro-expansion-in-selector-values.patch | 419 +++ ...ll-arguments-if-mount_verbose-is-set.patch | 222 ++ ...ake-expire-remaining-log-level-debug.patch | 55 + ...lly-log-mount-requestor-process-info.patch | 155 ++ .../autofs-5.1.5-use-malloc-in-spawn_c.patch | 161 ++ SPECS/autofs.spec | 2303 +++++++++++++++++ 57 files changed, 10854 insertions(+) create mode 100644 .autofs.metadata create mode 100644 .gitignore create mode 100644 SOURCES/autofs-5.1.4-Makefiles.rules-remove-samples-from-SUBDIRS.patch create mode 100644 SOURCES/autofs-5.1.4-account-for-libnsl-changes.patch create mode 100644 SOURCES/autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch create mode 100644 SOURCES/autofs-5.1.4-add-an-example-fedfs-master-map-entry-to-the-installed-master-map.patch create mode 100644 SOURCES/autofs-5.1.4-add-conditional-inclusion-of-fedfs-binaries.patch create mode 100644 SOURCES/autofs-5.1.4-add-error-handling-for-ext_mount_add.patch create mode 100644 SOURCES/autofs-5.1.4-add-fedfs-getsrvinfo_c.patch create mode 100644 SOURCES/autofs-5.1.4-add-fedfs-map-nfs4_c.patch create mode 100644 SOURCES/autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch create mode 100644 SOURCES/autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch create mode 100644 SOURCES/autofs-5.1.4-add-mount_fedfs_c.patch create mode 100644 SOURCES/autofs-5.1.4-add-systemd-service-command-line-option.patch create mode 100644 SOURCES/autofs-5.1.4-add-units-After-line-to-include-statd-service.patch create mode 100644 SOURCES/autofs-5.1.4-better-handle-hesiod-support-not-built-in.patch create mode 100644 SOURCES/autofs-5.1.4-covarity-fixes-1.patch create mode 100644 SOURCES/autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch create mode 100644 SOURCES/autofs-5.1.4-dont-use-array-for-path-when-not-neccessary.patch create mode 100644 SOURCES/autofs-5.1.4-fix-NFS-version-mask-usage.patch create mode 100644 SOURCES/autofs-5.1.4-fix-age-setting-at-startup.patch create mode 100644 SOURCES/autofs-5.1.4-fix-amd-parser-opts-option-handling.patch create mode 100644 SOURCES/autofs-5.1.4-fix-deadlock-in-dumpmaps.patch create mode 100644 SOURCES/autofs-5.1.4-fix-directory-create-permission.patch create mode 100644 SOURCES/autofs-5.1.4-fix-error-return-in-do_nfs_mount.patch create mode 100644 SOURCES/autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch create mode 100644 SOURCES/autofs-5.1.4-fix-flag-file-permission.patch create mode 100644 SOURCES/autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch create mode 100644 SOURCES/autofs-5.1.4-fix-libresolv-configure-check.patch create mode 100644 SOURCES/autofs-5.1.4-fix-monotonic_elapsed.patch create mode 100644 SOURCES/autofs-5.1.4-fix-prefix-option-handling-in-expand_entry.patch create mode 100644 SOURCES/autofs-5.1.4-fix-program-usage-message.patch create mode 100644 SOURCES/autofs-5.1.4-fix-sublink-option-not-set-from-defaults.patch create mode 100644 SOURCES/autofs-5.1.4-fix-update_negative_cache-map-source-usage.patch create mode 100644 SOURCES/autofs-5.1.4-fix-use-after-free-in-do_master_list_reset.patch create mode 100644 SOURCES/autofs-5.1.4-fix-use-after-free-in-parse_ldap_config.patch create mode 100644 SOURCES/autofs-5.1.4-improve-hostname-lookup-error-logging.patch create mode 100644 SOURCES/autofs-5.1.4-mark-removed-cache-entry-negative.patch create mode 100644 SOURCES/autofs-5.1.4-move-close-stdio-descriptors-to-become_daemon.patch create mode 100644 SOURCES/autofs-5.1.4-remove-autofs4-module-load-code.patch create mode 100644 SOURCES/autofs-5.1.4-set-bind-mount-as-propagation-slave.patch create mode 100644 SOURCES/autofs-5.1.4-tiny-patch-for-autofs-typo-and-possible-bug.patch create mode 100644 SOURCES/autofs-5.1.4-update-build-info-with-systemd.patch create mode 100644 SOURCES/autofs-5.1.4-use-flags-for-startup-boolean-options.patch create mode 100644 SOURCES/autofs-5.1.4-use-systemd-sd_notify-at-startup.patch create mode 100644 SOURCES/autofs-5.1.4-use_hostname_for_mounts-shouldnt-prevent-selection-among-replicas.patch create mode 100644 SOURCES/autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch create mode 100644 SOURCES/autofs-5.1.5-add-mount_verbose-configuration-option.patch create mode 100644 SOURCES/autofs-5.1.5-add-strictexpire-mount-option.patch create mode 100644 SOURCES/autofs-5.1.5-allow-period-following-macro-in-selector-value.patch create mode 100644 SOURCES/autofs-5.1.5-fix-hesiod-string-check-in-master_parse.patch create mode 100644 SOURCES/autofs-5.1.5-fix-macro-expansion-in-selector-values.patch create mode 100644 SOURCES/autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch create mode 100644 SOURCES/autofs-5.1.5-make-expire-remaining-log-level-debug.patch create mode 100644 SOURCES/autofs-5.1.5-optionally-log-mount-requestor-process-info.patch create mode 100644 SOURCES/autofs-5.1.5-use-malloc-in-spawn_c.patch create mode 100644 SPECS/autofs.spec diff --git a/.autofs.metadata b/.autofs.metadata new file mode 100644 index 0000000..d308afe --- /dev/null +++ b/.autofs.metadata @@ -0,0 +1 @@ +0256f9e75e2da9185afe797f1c5bedb1604c7eb2 SOURCES/autofs-5.1.4.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e866b5f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/autofs-5.1.4.tar.gz diff --git a/SOURCES/autofs-5.1.4-Makefiles.rules-remove-samples-from-SUBDIRS.patch b/SOURCES/autofs-5.1.4-Makefiles.rules-remove-samples-from-SUBDIRS.patch new file mode 100644 index 0000000..d06748d --- /dev/null +++ b/SOURCES/autofs-5.1.4-Makefiles.rules-remove-samples-from-SUBDIRS.patch @@ -0,0 +1,66 @@ +autofs-5.1.4 - Makefiles.rules: remove 'samples' from SUBDIRS + +From: NeilBrown + +The rules in Makefile make it quite clear that +'samples' is not expected to be part of SUBDIRS. +e.g. + - The rule for "clean" handles both $(SUBDIRS) *and* samples. + - There are separate "install" and "install_samples" targets. + +However SUBDIRS does contain 'samples'. This means that +a simple "make; make install" will over-write your configuration files. + +So remove 'samples' from SUBDIRS. Note that it has been removed in +the past, but then got added back again. + +Signed-off-by: NeilBrown +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + Makefile.rules | 2 +- + autofs.spec | 6 ++++++ + 3 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 313730b1..1e5ec15b 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -11,6 +11,7 @@ xx/xx/2018 autofs-5.1.5 + - account for recent libnsl changes. + - use_hostname_for_mounts shouldn't prevent selection among replicas. + - fix monotonic_elapsed. ++- Makefiles.rules: remove 'samples' from SUBDIRS. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/Makefile.rules b/Makefile.rules +index 2bfa043c..4deab3b9 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -3,7 +3,7 @@ + # + + # Root directory contents +-SUBDIRS = lib daemon modules man samples ++SUBDIRS = lib daemon modules man + INCDIRS = include + INCFILES = COPYING COPYRIGHT NEWS README* TODO Makefile Makefile.rules \ + Makefile.conf.in .version .autofs-* configure.in aclocal.m4 \ +diff --git a/autofs.spec b/autofs.spec +index 6da0655d..57d8db46 100644 +--- a/autofs.spec ++++ b/autofs.spec +@@ -121,6 +121,12 @@ install -m 755 redhat/autofs.init $RPM_BUILD_ROOT/etc/rc.d/init.d/autofs + install -m 644 redhat/autofs.conf $RPM_BUILD_ROOT/etc/autofs.conf + install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs + ++install -m 644 samples/auto.master $RPM_BUILD_ROOT/etc/auto.master ++install -m 644 samples/auto.misc $RPM_BUILD_ROOT/etc/auto.misc ++install -m 644 samples/auto.net $RPM_BUILD_ROOT/etc/auto.net ++install -m 644 samples/auto.smb $RPM_BUILD_ROOT/etc/auto.smb ++install -m 600 samples/autofs_ldap_auth.conf $RPM_BUILD_ROOT/etc/autofs_ldap_auth.conf ++ + %clean + [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT + diff --git a/SOURCES/autofs-5.1.4-account-for-libnsl-changes.patch b/SOURCES/autofs-5.1.4-account-for-libnsl-changes.patch new file mode 100644 index 0000000..baf0af1 --- /dev/null +++ b/SOURCES/autofs-5.1.4-account-for-libnsl-changes.patch @@ -0,0 +1,557 @@ +autofs-5.1.4 - account for recent libnsl changes + +From: Ian Kent + +The glibc RPC code has been dropped. + +The NIS functionality comes in the libnsl library but it installs +its files into sub directories of the system include and library +directories. + +So configure needs to check for this and allow for it in the +compile and linking of the NIS and NIS+ lookup modules. +--- + CHANGELOG | 1 + Makefile.conf.in | 4 - + Makefile.rules | 2 + aclocal.m4 | 45 ++++++++ + configure | 288 ++++++++++++++++++++++++++++++++++++++++++++++++--- + configure.in | 27 ++--- + include/config.h.in | 3 + + modules/Makefile | 10 ++ + 8 files changed, 343 insertions(+), 37 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 9d19c0a7..2d5d5b1f 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -8,6 +8,7 @@ xx/xx/2018 autofs-5.1.5 + - fix sublink option not set from defaults. + - fix error return in do_nfs_mount(). + - add error handling for ext_mount_add(). ++- account for recent libnsl changes. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/Makefile.conf.in b/Makefile.conf.in +index f879e262..85662654 100644 +--- a/Makefile.conf.in ++++ b/Makefile.conf.in +@@ -14,8 +14,8 @@ DAEMON_LDFLAGS = @DAEMON_LDFLAGS@ + # Glibc < 2.17 requires librt for clock_gettime() + LIBCLOCK_GETTIME = @LIBCLOCK_GETTIME@ + +-# Special parameters for glibc (libc 6) +-LIBNSL = @LIBNSL@ ++NSLLIB = @NSL_LIBS@ ++NSLCFLAGS = @NSL_CFLAGS@ + LIBRESOLV = @LIBRESOLV@ + + # Hesiod support: yes (1) no (0) +diff --git a/Makefile.rules b/Makefile.rules +index 0edf9bfe..2bfa043c 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -54,8 +54,6 @@ ifdef DMALLOCLIB + LIBS += $(DMALLOCLIB) + endif + +-LIBS += $(LIBNSL) +- + LIBS += $(LIBCLOCK_GETTIME) + + # Standard rules +diff --git a/aclocal.m4 b/aclocal.m4 +index 51772043..f1ed3870 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -417,3 +417,48 @@ fi + LIBS="$af_check_ldap_parse_page_control_save_libs" + ]) + ++dnl -------------------------------------------------------------------------- ++dnl AF_CHECK_YPCLNT_HEADER ++dnl ++dnl Check for include file rpcsvc/ypclnt.h for YellowPages support. ++dnl -------------------------------------------------------------------------- ++AC_DEFUN([AF_CHECK_YPCLNT_HEADER], ++[ ++# save current CFLAGS ++af_check_ypclnt_header_save_cflags="$CFLAGS" ++CFLAGS="$CFLAGS $NSL_CFLAGS $TIRPC_CFLAGS" ++ ++HAVE_YPCLNT=0 ++AC_CHECK_HEADER([rpcsvc/ypclnt.h], HAVE_YPCLNT=1) ++AC_SUBST(HAVE_YPCLNT) ++if test "$HAVE_YPCLNT" = "1"; then ++ AC_DEFINE(HAVE_YPCLNT, 1, ++ [Define if using YellowPages]) ++fi ++ ++# restore libs ++CFLAGS="$af_check_ypclnt_header_save_cflags" ++]) ++ ++dnl -------------------------------------------------------------------------- ++dnl AF_CHECK_NIS_HEADER ++dnl ++dnl Check for include file rpcsvc/nis.h for NIS+ support. ++dnl -------------------------------------------------------------------------- ++AC_DEFUN([AF_CHECK_NIS_HEADER], ++[ ++# save current CFLAGS ++af_check_nis_header_save_cflags="$CFLAGS" ++CFLAGS="$CFLAGS $NSL_CFLAGS $TIRPC_CFLAGS" ++ ++HAVE_NISPLUS=0 ++AC_CHECK_HEADER([rpcsvc/nis.h], HAVE_NISPLUS=1) ++AC_SUBST(HAVE_NISPLUS) ++if test "$HAVE_NISPLUS" = "1"; then ++ AC_DEFINE(HAVE_NISPLUS, 1, ++ [Define if using NIS+]) ++fi ++ ++# restore libs ++CFLAGS="$af_check_nis_header_save_cflags" ++]) +diff --git a/configure b/configure +index 476cea4b..2d517aac 100755 +--- a/configure ++++ b/configure +@@ -634,8 +634,8 @@ XML_FLAGS + LIBLDAP + HAVE_LDAP + LDAP_FLAGS +-HAVE_YPCLNT + HAVE_NISPLUS ++HAVE_YPCLNT + EGREP + GREP + CPP +@@ -643,7 +643,8 @@ HESIOD_FLAGS + LIBHESIOD + HAVE_HESIOD + LIBRESOLV +-LIBNSL ++NSL_LIBS ++NSL_CFLAGS + LIBCLOCK_GETTIME + KRB5_CONFIG + XML_CONFIG +@@ -764,6 +765,8 @@ CFLAGS + LDFLAGS + LIBS + CPPFLAGS ++NSL_CFLAGS ++NSL_LIBS + CPP' + + +@@ -1417,6 +1420,8 @@ Some influential environment variables: + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory ++ NSL_CFLAGS C compiler flags for NSL, overriding pkg-config ++ NSL_LIBS linker flags for NSL, overriding pkg-config + CPP C preprocessor + + Use these variables to override the choices made by `configure' or to help +@@ -4500,9 +4505,186 @@ fi + + + +-# +-# glibc/libc 6 new libraries +-# ++ ++ ++ ++ ++ ++ ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. ++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_path_PKG_CONFIG+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++PKG_CONFIG=$ac_cv_path_PKG_CONFIG ++if test -n "$PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 ++$as_echo "$PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++fi ++if test -z "$ac_cv_path_PKG_CONFIG"; then ++ ac_pt_PKG_CONFIG=$PKG_CONFIG ++ # Extract the first word of "pkg-config", so it can be a program name with args. ++set dummy pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $ac_pt_PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG ++if test -n "$ac_pt_PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 ++$as_echo "$ac_pt_PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ if test "x$ac_pt_PKG_CONFIG" = x; then ++ PKG_CONFIG="" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ PKG_CONFIG=$ac_pt_PKG_CONFIG ++ fi ++else ++ PKG_CONFIG="$ac_cv_path_PKG_CONFIG" ++fi ++ ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=0.9.0 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 ++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ PKG_CONFIG="" ++ fi ++fi ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSL" >&5 ++$as_echo_n "checking for NSL... " >&6; } ++ ++if test -n "$NSL_CFLAGS"; then ++ pkg_cv_NSL_CFLAGS="$NSL_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnsl\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libnsl") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_NSL_CFLAGS=`$PKG_CONFIG --cflags "libnsl" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$NSL_LIBS"; then ++ pkg_cv_NSL_LIBS="$NSL_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnsl\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libnsl") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_NSL_LIBS=`$PKG_CONFIG --libs "libnsl" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ NSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnsl" 2>&1` ++ else ++ NSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnsl" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$NSL_PKG_ERRORS" >&5 ++ ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for yp_match in -lnsl" >&5 + $as_echo_n "checking for yp_match in -lnsl... " >&6; } + if ${ac_cv_lib_nsl_yp_match+:} false; then : +@@ -4540,10 +4722,66 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_yp_match" >&5 + $as_echo "$ac_cv_lib_nsl_yp_match" >&6; } + if test "x$ac_cv_lib_nsl_yp_match" = xyes; then : +- LIBNSL="-lnsl" ++ NSL_LIBS="-lnsl" + fi + + ++NSL_CFLAGS="" ++ ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for yp_match in -lnsl" >&5 ++$as_echo_n "checking for yp_match in -lnsl... " >&6; } ++if ${ac_cv_lib_nsl_yp_match+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lnsl $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char yp_match (); ++int ++main () ++{ ++return yp_match (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_nsl_yp_match=yes ++else ++ ac_cv_lib_nsl_yp_match=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_yp_match" >&5 ++$as_echo "$ac_cv_lib_nsl_yp_match" >&6; } ++if test "x$ac_cv_lib_nsl_yp_match" = xyes; then : ++ NSL_LIBS="-lnsl" ++fi ++ ++ ++NSL_CFLAGS="" ++ ++else ++ NSL_CFLAGS=$pkg_cv_NSL_CFLAGS ++ NSL_LIBS=$pkg_cv_NSL_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_query in -lresolv" >&5 + $as_echo_n "checking for res_query in -lresolv... " >&6; } +@@ -4659,8 +4897,6 @@ fi + + LDFLAGS="${AF_tmp_ldflags}" + +-# NIS+ support? +-HAVE_NISPLUS=0 + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' + ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +@@ -5058,15 +5294,11 @@ fi + done + + +-ac_fn_c_check_header_mongrel "$LINENO" "rpcsvc/nis.h" "ac_cv_header_rpcsvc_nis_h" "$ac_includes_default" +-if test "x$ac_cv_header_rpcsvc_nis_h" = xyes; then : +- HAVE_NISPLUS=1 +-fi +- + ++# save current CFLAGS ++af_check_ypclnt_header_save_cflags="$CFLAGS" ++CFLAGS="$CFLAGS $NSL_CFLAGS $TIRPC_CFLAGS" + +- +-# YellowPages support? + HAVE_YPCLNT=0 + ac_fn_c_check_header_mongrel "$LINENO" "rpcsvc/ypclnt.h" "ac_cv_header_rpcsvc_ypclnt_h" "$ac_includes_default" + if test "x$ac_cv_header_rpcsvc_ypclnt_h" = xyes; then : +@@ -5081,6 +5313,32 @@ $as_echo "#define HAVE_YPCLNT 1" >>confdefs.h + + fi + ++# restore libs ++CFLAGS="$af_check_ypclnt_header_save_cflags" ++ ++ ++# save current CFLAGS ++af_check_nis_header_save_cflags="$CFLAGS" ++CFLAGS="$CFLAGS $NSL_CFLAGS $TIRPC_CFLAGS" ++ ++HAVE_NISPLUS=0 ++ac_fn_c_check_header_mongrel "$LINENO" "rpcsvc/nis.h" "ac_cv_header_rpcsvc_nis_h" "$ac_includes_default" ++if test "x$ac_cv_header_rpcsvc_nis_h" = xyes; then : ++ HAVE_NISPLUS=1 ++fi ++ ++ ++ ++if test "$HAVE_NISPLUS" = "1"; then ++ ++$as_echo "#define HAVE_NISPLUS 1" >>confdefs.h ++ ++fi ++ ++# restore libs ++CFLAGS="$af_check_nis_header_save_cflags" ++ ++ + # + # OpenLDAP support? Expect that this may have a special directory... + # +diff --git a/configure.in b/configure.in +index d3660923..d74775cc 100644 +--- a/configure.in ++++ b/configure.in +@@ -209,11 +209,13 @@ fi + AC_CHECK_LIB(rt, clock_gettime, LIBCLOCK_GETTIME="-lrt") + AC_SUBST(LIBCLOCK_GETTIME) + +-# +-# glibc/libc 6 new libraries +-# +-AC_CHECK_LIB(nsl, yp_match, LIBNSL="-lnsl") +-AC_SUBST(LIBNSL) ++PKG_PROG_PKG_CONFIG() ++PKG_CHECK_MODULES([NSL],[libnsl],, ++[ ++AC_CHECK_LIB(nsl, yp_match, NSL_LIBS="-lnsl") ++AC_SUBST(NSL_LIBS) ++NSL_CFLAGS="" ++]) + + AC_CHECK_LIB(resolv, res_query, LIBRESOLV="-lresolv") + AC_SUBST(LIBRESOLV) +@@ -254,19 +256,8 @@ AC_SUBST(LIBHESIOD) + AC_SUBST(HESIOD_FLAGS) + LDFLAGS="${AF_tmp_ldflags}" + +-# NIS+ support? +-HAVE_NISPLUS=0 +-AC_CHECK_HEADER(rpcsvc/nis.h, HAVE_NISPLUS=1) +-AC_SUBST(HAVE_NISPLUS) +- +-# YellowPages support? +-HAVE_YPCLNT=0 +-AC_CHECK_HEADER([rpcsvc/ypclnt.h], HAVE_YPCLNT=1) +-AC_SUBST(HAVE_YPCLNT) +-if test "$HAVE_YPCLNT" = "1"; then +- AC_DEFINE(HAVE_YPCLNT, 1, +- [Define if using YellowPages]) +-fi ++AF_CHECK_YPCLNT_HEADER() ++AF_CHECK_NIS_HEADER() + + # + # OpenLDAP support? Expect that this may have a special directory... +diff --git a/include/config.h.in b/include/config.h.in +index 04873e8f..991a2bda 100644 +--- a/include/config.h.in ++++ b/include/config.h.in +@@ -57,6 +57,9 @@ + /* define if you have MOUNT_NFS */ + #undef HAVE_MOUNT_NFS + ++/* Define if using NIS+ */ ++#undef HAVE_NISPLUS ++ + /* define if the umount command supports the -c option */ + #undef HAVE_NO_CANON_UMOUNT + +diff --git a/modules/Makefile b/modules/Makefile +index d9ab06c5..0447559a 100644 +--- a/modules/Makefile ++++ b/modules/Makefile +@@ -116,6 +116,16 @@ parse_amd.so: parse_amd.c amd_parse.tab.o amd_tok.o + # + # Ad hoc compilation rules for modules which need auxilliary libraries + # ++lookup_yp.so: lookup_yp.c ++ $(CC) $(SOLDFLAGS) $(CFLAGS) $(NSLCFLAGS) -o lookup_yp.so \ ++ lookup_yp.c $(LDFLAGS) $(AUTOFS_LIB) $(LIBS) $(NSLLIB) ++ $(STRIP) lookup_yp.so ++ ++lookup_nisplus.so: lookup_nisplus.c ++ $(CC) $(SOLDFLAGS) $(CFLAGS) $(NSLCFLAGS) -o lookup_nisplus.so \ ++ lookup_nisplus.c $(LDFLAGS) $(AUTOFS_LIB) $(LIBS) $(NSLLIB) ++ $(STRIP) lookup_nisplus.so ++ + lookup_hesiod.so: lookup_hesiod.c + $(CC) $(SOLDFLAGS) $(CFLAGS) $(HESIOD_FLAGS) -o lookup_hesiod.so \ + lookup_hesiod.c $(LDFLAGS) $(AUTOFS_LIB) $(LIBHESIOD) $(LIBRESOLV) $(LIBS) diff --git a/SOURCES/autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch b/SOURCES/autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch new file mode 100644 index 0000000..cd730cf --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch @@ -0,0 +1,34 @@ +autofs-5.1.4 - add NULL check in prepare_attempt_prefix() + +From: Ian Kent + +prepare_attempt_prefix() calls calloc(3) and continues without +checking if the allocation succeeded. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/log.c | 2 ++ + 2 files changed, 3 insertions(+) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -39,6 +39,7 @@ xx/xx/2018 autofs-5.1.5 + - better handle hesiod support not built in. + - fix hesiod string check in master_parse(). + - remove autofs4 module load code. ++- add NULL check in prepare_attempt_prefix(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/log.c ++++ autofs-5.1.4/lib/log.c +@@ -44,6 +44,8 @@ static char *prepare_attempt_prefix(cons + + snprintf(buffer, ATTEMPT_ID_SIZE, "%02lx", *attempt_id); + prefixed_msg = (char *) calloc(len, sizeof(char)); ++ if (!prefixed_msg) ++ return NULL; + strcpy(prefixed_msg, buffer); + strcat(prefixed_msg, "|"); + strcat(prefixed_msg, msg); diff --git a/SOURCES/autofs-5.1.4-add-an-example-fedfs-master-map-entry-to-the-installed-master-map.patch b/SOURCES/autofs-5.1.4-add-an-example-fedfs-master-map-entry-to-the-installed-master-map.patch new file mode 100644 index 0000000..ff3f5cc --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-an-example-fedfs-master-map-entry-to-the-installed-master-map.patch @@ -0,0 +1,42 @@ +autofs-5.1.4 - add an example fedfs master map entry to the installed master map + +From: Ian Kent + +Add an example of using the fedfs program map (to facilitate access +to fedfs domain mounts) to the installed master map. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + samples/auto.master | 6 ++++++ + 2 files changed, 7 insertions(+) + +diff --git a/CHANGELOG b/CHANGELOG +index bbe8019e..f771a433 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -18,6 +18,7 @@ xx/xx/2018 autofs-5.1.5 + - add mount.fedfs.c. + - add fedfs-map-nfs4.c. + - add conditional inclusion of fedfs binaries. ++- add an example fedfs master map entry to the installed master map. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/samples/auto.master b/samples/auto.master +index 0f2c8ab0..9a9968a3 100644 +--- a/samples/auto.master ++++ b/samples/auto.master +@@ -17,6 +17,12 @@ + # + +dir:/etc/auto.master.d + # ++# If you have fedfs set up and the related binaries, either ++# built as part of autofs or installed from another package, ++# uncomment this line to use the fedfs program map to access ++# your fedfs mounts. ++#/nfs4 /usr/sbin/fedfs-map-nfs4 nobind ++# + # Include central master map if it can be found using + # nsswitch sources. + # diff --git a/SOURCES/autofs-5.1.4-add-conditional-inclusion-of-fedfs-binaries.patch b/SOURCES/autofs-5.1.4-add-conditional-inclusion-of-fedfs-binaries.patch new file mode 100644 index 0000000..536165e --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-conditional-inclusion-of-fedfs-binaries.patch @@ -0,0 +1,184 @@ +autofs-5.1.4 - add conditional inclusion of fedfs binaries + +From: Ian Kent + +Add conditional inclusion of the fedfs binaries. + +Using configure a --with-fedfs is needed to build and install +the fedfs binaries. + +Using rpmbuild -tb it's necessary to add the option +--without fedfs to exclude the fedfs binaries from the resulting +rpm package. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + Makefile.conf.in | 2 ++ + Makefile.rules | 6 +++++- + autofs.spec | 12 +++++++++++- + configure | 16 ++++++++++++++++ + configure.in | 9 +++++++++ + 6 files changed, 44 insertions(+), 2 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 412e3382..bbe8019e 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -17,6 +17,7 @@ xx/xx/2018 autofs-5.1.5 + - add fedfs-getsrvinfo.c. + - add mount.fedfs.c. + - add fedfs-map-nfs4.c. ++- add conditional inclusion of fedfs binaries. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/Makefile.conf.in b/Makefile.conf.in +index 85662654..3fe1a0a0 100644 +--- a/Makefile.conf.in ++++ b/Makefile.conf.in +@@ -58,6 +58,8 @@ EXT3FS = @HAVE_E3FSCK@ + # Support for calling e4fsck when mounting ext4 filesystems + EXT4FS = @HAVE_E4FSCK@ + ++FEDFS = @ENABLE_FEDFS@ ++ + LEX = @PATH_LEX@ + YACC = @PATH_YACC@ + RPCGEN = @PATH_RPCGEN@ +diff --git a/Makefile.rules b/Makefile.rules +index fc9f6019..2ccb1f6e 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -3,12 +3,16 @@ + # + + # Root directory contents +-SUBDIRS = lib daemon fedfs modules man ++SUBDIRS = lib daemon modules man + INCDIRS = include + INCFILES = COPYING COPYRIGHT NEWS README* TODO Makefile Makefile.rules \ + Makefile.conf.in .version .autofs-* configure.in aclocal.m4 \ + configure *.patch autofs.spec + ++ifeq ($(FEDFS), 1) ++ SUBDIRS += fedfs ++endif ++ + # Attempt to be friends with autotools + INSTALLROOT = $(DESTDIR) + +diff --git a/autofs.spec b/autofs.spec +index 157c09b4..2cb09ef0 100644 +--- a/autofs.spec ++++ b/autofs.spec +@@ -16,6 +16,10 @@ + # disable them. + %define with_libtirpc %{?_without_libtirpc: 0} %{?!_without_libtirpc: 1} + ++# Use --without fedfs in your rpmbuild command or force values to 0 to ++# disable them. ++%define with_fedfs %{?_without_fedfs: 0} %{?!_without_fedfs: 1} ++ + Summary: A tool from automatically mounting and umounting filesystems. + Name: autofs + %define version 5.1.4 +@@ -82,6 +86,9 @@ echo %{version}-%{release} > .version + %if %{with_libtirpc} + %define libtirpc_configure_arg --with-libtirpc + %endif ++%if %{with_fedfs} ++ %define fedfs_configure_arg --enable-fedfs ++%endif + + %build + CFLAGS="$RPM_OPT_FLAGS -Wall" \ +@@ -90,7 +97,8 @@ LDFLAGS="-Wl,-z,now" \ + --disable-mount-locking \ + --enable-ignore-busy \ + %{?systemd_configure_arg:} \ +- %{?libtirpc_configure_arg:} ++ %{?libtirpc_configure_arg:} \ ++ %{?fedfs_configure_arg:} + CFLAGS="$RPM_OPT_FLAGS -Wall" LDFLAGS="-Wl,-z,now" make initdir=/etc/rc.d/init.d DONTSTRIP=1 + + %install +@@ -191,8 +199,10 @@ fi + %config(noreplace) /etc/sysconfig/autofs + %config(noreplace) /etc/autofs_ldap_auth.conf + %{_sbindir}/automount ++%if %{with_fedfs} + %{_sbindir}/mount.fedfs + %{_sbindir}/fedfs-map-nfs4 ++%endif + %dir %{_libdir}/autofs + %{_libdir}/autofs/* + %{_mandir}/*/* +diff --git a/configure b/configure +index 5c8aae30..9682b36f 100755 +--- a/configure ++++ b/configure +@@ -648,6 +648,7 @@ NSL_CFLAGS + LIBCLOCK_GETTIME + KRB5_CONFIG + XML_CONFIG ++ENABLE_FEDFS + sssldir + HAVE_SSS_AUTOFS + PATH_RPCGEN +@@ -743,6 +744,7 @@ with_libtirpc + with_dmalloc + enable_sloppy_mount + enable_no_canon_umount ++enable_fedfs + with_hesiod + with_openldap + with_sasl +@@ -1377,6 +1379,7 @@ Optional Features: + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-sloppy-mount enable the use of the -s option to mount + --enable-no-canon-umount enable the use of the -c option to umount ++ --enable-fedfs enable inclusion of fedfs binaries mount.fedfs and fedfs-map-nfs4 + --disable-ext-env disable search in environment for substitution variable + --disable-mount-locking disable use of locking when spawning mount command + --enable-force-shutdown enable USR1 signal to force unlink umount of any +@@ -4246,6 +4249,19 @@ $as_echo "#define HAVE_NO_CANON_UMOUNT 1" >>confdefs.h + + fi + ++ENABLE_FEDFS="" ++# Check whether --enable-fedfs was given. ++if test "${enable_fedfs+set}" = set; then : ++ enableval=$enable_fedfs; ++else ++ enable_fedfs=no ++fi ++ ++if test x$enable_fedfs = xyes; then ++ ENABLE_FEDFS="1" ++fi ++ ++ + # LDAP SASL auth needs libxml and Kerberos + for ac_prog in xml2-config + do +diff --git a/configure.in b/configure.in +index 4d1208f5..de06a96d 100644 +--- a/configure.in ++++ b/configure.in +@@ -195,6 +195,15 @@ if test x$enable_no_canon_umount = xyes; then + AC_DEFINE(HAVE_NO_CANON_UMOUNT, 1, [define if the umount command supports the -c option]) + fi + ++ENABLE_FEDFS="" ++AC_ARG_ENABLE(fedfs, ++[ --enable-fedfs enable inclusion of fedfs binaries mount.fedfs and fedfs-map-nfs4],, ++ enable_fedfs=no) ++if test x$enable_fedfs = xyes; then ++ ENABLE_FEDFS="1" ++fi ++AC_SUBST(ENABLE_FEDFS) ++ + # LDAP SASL auth needs libxml and Kerberos + AF_CHECK_LIBXML() + AF_CHECK_KRB5() diff --git a/SOURCES/autofs-5.1.4-add-error-handling-for-ext_mount_add.patch b/SOURCES/autofs-5.1.4-add-error-handling-for-ext_mount_add.patch new file mode 100644 index 0000000..814ae30 --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-error-handling-for-ext_mount_add.patch @@ -0,0 +1,121 @@ +autofs-5.1.4 - add error handling for ext_mount_add() + +From: Ian Kent + +Add error handling (memory allocation failures) for ext_mount_add(). + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/mounts.c | 5 +---- + modules/parse_amd.c | 42 ++++++++++++++++++++++++++++++------------ + 3 files changed, 32 insertions(+), 16 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index d0cfa19b..9d19c0a7 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -7,6 +7,7 @@ xx/xx/2018 autofs-5.1.5 + - fix prefix option handling in expand_entry(). + - fix sublink option not set from defaults. + - fix error return in do_nfs_mount(). ++- add error handling for ext_mount_add(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/lib/mounts.c b/lib/mounts.c +index 6fa304aa..f46fab2b 100644 +--- a/lib/mounts.c ++++ b/lib/mounts.c +@@ -715,15 +715,12 @@ int ext_mount_add(struct list_head *entry, const char *path, unsigned int umount + } + + em = malloc(sizeof(struct ext_mount)); +- if (!em) { +- ret = -1; ++ if (!em) + goto done; +- } + + em->mountpoint = strdup(path); + if (!em->mountpoint) { + free(em); +- ret = -1; + goto done; + } + em->umount = umount; +diff --git a/modules/parse_amd.c b/modules/parse_amd.c +index 2a5d9a30..e7debc56 100644 +--- a/modules/parse_amd.c ++++ b/modules/parse_amd.c +@@ -1080,7 +1080,14 @@ static int do_generic_mount(struct autofs_point *ap, const char *name, + umount = 1; + } + /* We have an external mount */ +- ext_mount_add(&entry->ext_mount, entry->fs, umount); ++ if (!ext_mount_add(&entry->ext_mount, entry->fs, umount)) { ++ umount_ent(ap, entry->fs); ++ error(ap->logopt, MODPREFIX ++ "error: could not add external mount %s", ++ entry->fs); ++ ret = 1; ++ goto out; ++ } + ret = do_link_mount(ap, name, entry, flags); + } + out: +@@ -1124,7 +1131,13 @@ static int do_nfs_mount(struct autofs_point *ap, const char *name, + umount = 1; + } + /* We might be using an external mount */ +- ext_mount_add(&entry->ext_mount, entry->fs, umount); ++ if (!ext_mount_add(&entry->ext_mount, entry->fs, umount)) { ++ umount_ent(ap, entry->fs); ++ error(ap->logopt, MODPREFIX ++ "error: could not add external mount %s", entry->fs); ++ ret = 1; ++ goto out; ++ } + ret = do_link_mount(ap, name, entry, flags); + } + out: +@@ -1309,6 +1322,9 @@ static int do_program_mount(struct autofs_point *ap, + */ + if (ext_mount_inuse(entry->fs)) { + rv = 0; ++ /* An external mount with path entry->fs exists ++ * so ext_mount_add() won't fail. ++ */ + ext_mount_add(&entry->ext_mount, entry->fs, 1); + } else { + rv = mkdir_path(entry->fs, mp_mode); +@@ -1325,17 +1341,19 @@ static int do_program_mount(struct autofs_point *ap, + + rv = spawnv(ap->logopt, prog, (const char * const *) argv); + if (WIFEXITED(rv) && !WEXITSTATUS(rv)) { +- rv = 0; +- ext_mount_add(&entry->ext_mount, entry->fs, 1); +- debug(ap->logopt, MODPREFIX +- "%s: mounted %s", entry->type, entry->fs); +- } else { +- if (!ext_mount_inuse(entry->fs)) +- rmdir_path(ap, entry->fs, ap->dev); +- error(ap->logopt, MODPREFIX +- "%s: failed to mount using: %s", +- entry->type, entry->mount); ++ if (ext_mount_add(&entry->ext_mount, entry->fs, 1)) { ++ rv = 0; ++ debug(ap->logopt, MODPREFIX ++ "%s: mounted %s", entry->type, entry->fs); ++ goto do_free; ++ } ++ umount_ent(ap, entry->fs); + } ++ ++ if (!ext_mount_inuse(entry->fs)) ++ rmdir_path(ap, entry->fs, ap->dev); ++ error(ap->logopt, MODPREFIX ++ "%s: failed to mount using %s", entry->type, entry->mount); + } + do_free: + free_argv(argc, (const char **) argv); diff --git a/SOURCES/autofs-5.1.4-add-fedfs-getsrvinfo_c.patch b/SOURCES/autofs-5.1.4-add-fedfs-getsrvinfo_c.patch new file mode 100644 index 0000000..6863304 --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-fedfs-getsrvinfo_c.patch @@ -0,0 +1,402 @@ +autofs-5.1.4 - add fedfs-getsrvinfo.c + +From: Ian Kent + +Add the fedfs domain information discovery library functions. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + fedfs/fedfs-getsrvinfo.c | 311 ++++++++++++++++++++++++++++++++++++++++++++++ + fedfs/fedfs-getsrvinfo.h | 52 ++++++++ + 3 files changed, 364 insertions(+) + create mode 100644 fedfs/fedfs-getsrvinfo.c + create mode 100644 fedfs/fedfs-getsrvinfo.h + +diff --git a/CHANGELOG b/CHANGELOG +index dbfb8389..8d6c737c 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -14,6 +14,7 @@ xx/xx/2018 autofs-5.1.5 + - Makefiles.rules: remove 'samples' from SUBDIRS. + - dont allow trailing slash in master map mount points. + - fix libresolv configure check. ++- add fedfs-getsrvinfo.c. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/fedfs/fedfs-getsrvinfo.c b/fedfs/fedfs-getsrvinfo.c +new file mode 100644 +index 00000000..02ad16b5 +--- /dev/null ++++ b/fedfs/fedfs-getsrvinfo.c +@@ -0,0 +1,311 @@ ++/* ++ * Copyright 2011 Oracle. All rights reserved. ++ * ++ * This file is part of fedfs-utils. ++ * ++ * fedfs-utils is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2.0 as ++ * published by the Free Software Foundation. ++ * ++ * fedfs-utils is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License version 2.0 for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * version 2.0 along with fedfs-utils. If not, see: ++ * ++ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "fedfs-getsrvinfo.h" ++ ++/** ++ * Parsing overlay for DNS query result record header. Fields are ++ * in network byte order. ++ */ ++struct rechdr { ++ uint16_t type; ++ uint16_t class; ++ uint32_t ttl; ++ uint16_t length; ++} __attribute__((__packed__)); ++ ++/** ++ * Parsing overlay for DNS query result SRV record data. Fields ++ * are in network byte order. ++ */ ++struct srv { ++ uint16_t priority; ++ uint16_t weight; ++ uint16_t port; ++ unsigned char *target; ++} __attribute__((__packed__)); ++ ++/** ++ * Return C string matching error value of "status" ++ * ++ * @param status error status returned by getsrvinfo ++ * @return pointer to static NUL-terminated C string containing error message ++ */ ++const char * ++gsi_strerror(int status) ++{ ++ static char buf[256]; ++ ++ switch (status) { ++ case ESI_SUCCESS: ++ return "Success"; ++ case ESI_NONAME: ++ return "Name not found"; ++ case ESI_AGAIN: ++ return "Temporary failure in name resolution"; ++ case ESI_FAIL: ++ return "Non-recoverable failure in name resolution"; ++ case ESI_NODATA: ++ return "No SRV record returned"; ++ case ESI_SERVICE: ++ return "Service is not available"; ++ case ESI_MEMORY: ++ return "Memory allocation failure"; ++ case ESI_SYSTEM: ++ snprintf(buf, sizeof(buf), "System error (%d): %s", ++ status, strerror(errno)); ++ return buf; ++ case ESI_PARSE: ++ return "Failed to parse server response"; ++ } ++ ++ snprintf(buf, sizeof(buf), "Unknown error (%d)", status); ++ return buf; ++} ++ ++/** ++ * Release a list of SRV records allocated by getsrvinfo() ++ * ++ * @param si pointer to first element of a list of struct srvinfo ++ * ++ */ ++void freesrvinfo(struct srvinfo *si) ++{ ++ struct srvinfo *tmp; ++ ++ while (si != NULL) { ++ tmp = si; ++ si = si->si_next; ++ free(tmp->si_target); ++ free(tmp); ++ } ++} ++ ++/** ++ * Ordering predicate for srvinfo lists ++ * ++ * @param a a srvinfo list element to compare ++ * @param b another srvinfo list element to compare ++ * @return true if "b" should fall later in the list than "a" ++ * ++ * See RFC 2782. The list is ordered as follows: ++ * ++ * o Lowest priority first. ++ * o In each priority class, highest weight first. ++ */ ++static _Bool ++srvinfo_is_after(const struct srvinfo *a, const struct srvinfo *b) ++{ ++ if (a->si_priority > b->si_priority) ++ return true; ++ if (a->si_priority < b->si_priority) ++ return false; ++ ++ if (a->si_weight < b->si_weight) ++ return true; ++ return false; ++} ++ ++/** ++ * Insert a srvinfo element into a list ++ * ++ * @param head pointer to head of list of elements ++ * @param entry new list element to insert ++ * ++ */ ++static void ++insert_srvinfo(struct srvinfo **head, struct srvinfo *entry) ++{ ++ entry->si_next = *head; ++ *head = entry; ++} ++ ++/** ++ * Insert a srvinfo element into a list, in order ++ * ++ * @param head pointer to head of list of elements ++ * @param entry new list element to insert ++ * ++ */ ++static void ++insert_srvinfo_sorted(struct srvinfo **head, struct srvinfo *entry) ++{ ++ struct srvinfo *spot, *back; ++ ++ spot = *head; ++ back = NULL; ++ while (spot && srvinfo_is_after(spot, entry)) { ++ back = spot; ++ spot = spot->si_next; ++ } ++ ++ if (spot == (*head)) ++ insert_srvinfo(head, entry); ++ else { ++ insert_srvinfo(&spot, entry); ++ /* off the end of the list? */ ++ if (spot == entry) ++ back->si_next = entry; ++ } ++} ++ ++/** ++ * Retrieve list of SRV records from DNS service ++ * ++ * @param srvname NUL-terminated C string containing record type to look up ++ * @param domainname NUL-terminated C string containing domain name to look up ++ * @param si OUT: list of SRV record information retrieved ++ * @return zero on success, or an ESI_ status code describing the error ++ * ++ * Caller must free list of records using freesrvinfo(). ++ */ ++int ++getsrvinfo(const char *srvname, const char *domainname, struct srvinfo **si) ++{ ++ unsigned char *msg, *eom, *comp_dn; ++ struct srvinfo *results; ++ unsigned short count, i; ++ int status, len; ++ char *exp_dn; ++ HEADER *hdr; ++ ++ msg = calloc(1, NS_MAXMSG); ++ exp_dn = calloc(1, NS_MAXDNAME); ++ if (msg == NULL || exp_dn == NULL) { ++ status = ESI_MEMORY; ++ goto out; ++ } ++ ++ _res.options |= RES_AAONLY; ++ len = res_querydomain(srvname, domainname, C_IN, T_SRV, msg, NS_MAXMSG); ++ if (len == -1) { ++ switch (h_errno) { ++ case HOST_NOT_FOUND: ++ status = ESI_NONAME; ++ break; ++ case TRY_AGAIN: ++ status = ESI_AGAIN; ++ break; ++ case NO_RECOVERY: ++ status = ESI_FAIL; ++ break; ++ case NO_DATA: ++ status = ESI_NODATA; ++ break; ++ default: ++ fprintf(stderr, "SRV query failed for %s.%s: %s\n", ++ srvname, domainname, hstrerror(h_errno)); ++ status = ESI_FAIL; ++ } ++ goto out; ++ } ++ ++ hdr = (HEADER *)msg; ++ count = ntohs(hdr->ancount); ++ if (count == 0) { ++ status = ESI_NODATA; ++ goto out; ++ } ++ eom = msg + len; ++ ++ comp_dn = &msg[HFIXEDSZ]; ++ comp_dn += dn_skipname(comp_dn, eom) + QFIXEDSZ; ++ ++ results = NULL; ++ for (i = 0; i < count; i++) { ++ struct srvinfo *new; ++ struct srv *record; ++ int l; ++ ++ l = dn_expand(msg, eom, comp_dn, exp_dn, NS_MAXDNAME); ++ if (l == -1) { ++ status = ESI_PARSE; ++ goto out_free; ++ } ++ comp_dn += l; ++ ++ record = (struct srv *)&comp_dn[10]; ++ comp_dn += 16; ++ ++ l = dn_expand(msg, eom, comp_dn, exp_dn, NS_MAXDNAME); ++ if (l == -1) { ++ status = ESI_PARSE; ++ goto out_free; ++ } ++ comp_dn += l; ++ ++ if (count == 1 && strcmp(exp_dn, ".") == 0) { ++ status = ESI_SERVICE; ++ goto out_free; ++ } ++ ++ new = calloc(1, sizeof(*new)); ++ if (new == NULL) { ++ status = ESI_MEMORY; ++ goto out; ++ } ++ ++ new->si_target = strdup(exp_dn); ++ if (new->si_target == NULL) { ++ free(new); ++ status = ESI_MEMORY; ++ goto out; ++ } ++ new->si_priority = ntohs(record->priority); ++ new->si_weight = ntohs(record->weight); ++ new->si_port = ntohs(record->port); ++ ++ insert_srvinfo_sorted(&results, new); ++ } ++ ++ status = ESI_SUCCESS; ++ *si = results; ++ ++out: ++ free(exp_dn); ++ free(msg); ++ return status; ++ ++out_free: ++ freesrvinfo(results); ++ goto out; ++} +diff --git a/fedfs/fedfs-getsrvinfo.h b/fedfs/fedfs-getsrvinfo.h +new file mode 100644 +index 00000000..13170359 +--- /dev/null ++++ b/fedfs/fedfs-getsrvinfo.h +@@ -0,0 +1,52 @@ ++/* ++ * Copyright 2011 Oracle. All rights reserved. ++ * ++ * This file is part of fedfs-utils. ++ * ++ * fedfs-utils is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2.0 as ++ * published by the Free Software Foundation. ++ * ++ * fedfs-utils is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License version 2.0 for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * version 2.0 along with fedfs-utils. If not, see: ++ * ++ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ++ */ ++ ++#ifndef _FEDFS_GETSRVINFO_H_ ++#define _FEDFS_GETSRVINFO_H_ ++ ++/** ++ * Single list element containing SRV record data ++ */ ++struct srvinfo { ++ struct srvinfo *si_next; ++ char *si_target; ++ unsigned short si_priority; ++ unsigned short si_weight; ++ unsigned short si_port; ++}; ++ ++enum { ++ ESI_SUCCESS = 0, ++ ESI_NONAME = -2, ++ ESI_AGAIN = -3, ++ ESI_FAIL = -4, ++ ESI_NODATA = -5, ++ ESI_SERVICE = -8, ++ ESI_MEMORY = -10, ++ ESI_SYSTEM = -11, ++ ESI_PARSE = -1000, ++}; ++ ++int getsrvinfo(const char *srvname, const char *domainname, ++ struct srvinfo **si); ++void freesrvinfo(struct srvinfo *si); ++const char *gsi_strerror(int status); ++ ++#endif /* !_FEDFS_GETSRVINFO_H_ */ diff --git a/SOURCES/autofs-5.1.4-add-fedfs-map-nfs4_c.patch b/SOURCES/autofs-5.1.4-add-fedfs-map-nfs4_c.patch new file mode 100644 index 0000000..1563f68 --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-fedfs-map-nfs4_c.patch @@ -0,0 +1,342 @@ +autofs-5.1.4 - add fedfs-map-nfs4.c + +From: Ian Kent + +Add build (and install) of the fedfs program map, fedfs-map-nfs4. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + autofs.spec | 1 + fedfs/Makefile | 12 ++- + fedfs/fedfs-map-nfs4.c | 204 ++++++++++++++++++++++++++++++++++++++++++++++++ + fedfs/fedfs-token.h | 40 +++++++++ + 5 files changed, 256 insertions(+), 2 deletions(-) + create mode 100644 fedfs/fedfs-map-nfs4.c + create mode 100644 fedfs/fedfs-token.h + +diff --git a/CHANGELOG b/CHANGELOG +index 88992147..412e3382 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -16,6 +16,7 @@ xx/xx/2018 autofs-5.1.5 + - fix libresolv configure check. + - add fedfs-getsrvinfo.c. + - add mount.fedfs.c. ++- add fedfs-map-nfs4.c. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/autofs.spec b/autofs.spec +index 2cc0e38f..157c09b4 100644 +--- a/autofs.spec ++++ b/autofs.spec +@@ -192,6 +192,7 @@ fi + %config(noreplace) /etc/autofs_ldap_auth.conf + %{_sbindir}/automount + %{_sbindir}/mount.fedfs ++%{_sbindir}/fedfs-map-nfs4 + %dir %{_libdir}/autofs + %{_libdir}/autofs/* + %{_mandir}/*/* +diff --git a/fedfs/Makefile b/fedfs/Makefile +index cb325bed..dff749e4 100644 +--- a/fedfs/Makefile ++++ b/fedfs/Makefile +@@ -6,11 +6,13 @@ + include ../Makefile.rules + + SRCS = mount.fedfs.c +-HDRS = fedfs-getsrvinfo.h fedfs-gpl-boiler.h fedfs-nls.h ++HDRS = fedfs-getsrvinfo.h fedfs-gpl-boiler.h fedfs-nls.h \ ++ fedfs-token.h + + fedfs-getsrvinfo_OBJ = fedfs-getsrvinfo.o + + mount_fedfs_OBJ = mount.fedfs.o ++fedfs-map-nfs4_OBJ = fedfs-map-nfs4.o + + version := $(shell cat ../.version) + +@@ -18,18 +20,24 @@ CFLAGS += -rdynamic $(DAEMON_CFLAGS) -D_GNU_SOURCE -I../include + CFLAGS += -DVERSION_STRING=\"$(version)\" + LDFLAGS += -rdynamic + +-all: mount.fedfs ++all: mount.fedfs fedfs-map-nfs4 + + mount.fedfs: $(mount_fedfs_OBJ) $(fedfs-getsrvinfo_OBJ) $(HDRS) + $(CC) -o mount.fedfs \ + $(mount_fedfs_OBJ) $(fedfs-getsrvinfo_OBJ) \ + $(LDFLAGS) $(LIBRESOLV) $(LIBS) + ++fedfs-map-nfs4: $(fedfs-map-nfs4_OBJ) $(fedfs-getsrvinfo_OBJ) $(HDRS) ++ $(CC) -o fedfs-map-nfs4 \ ++ $(fedfs-map-nfs4_OBJ) $(fedfs-getsrvinfo_OBJ) \ ++ $(LDFLAGS) $(LIBRESOLV) $(LIBS) ++ + clean: + rm -f *.o *.s *~ mount.fedfs + + install: all + install -d -m 755 $(INSTALLROOT)$(sbindir) ++ install -c fedfs-map-nfs4 -m 755 $(INSTALLROOT)$(sbindir); \ + if ! test -x $(INSTALLROOT)$(sbindir)/mount.fedfs; \ + then \ + install -c mount.fedfs -m 755 $(INSTALLROOT)$(sbindir); \ +diff --git a/fedfs/fedfs-map-nfs4.c b/fedfs/fedfs-map-nfs4.c +new file mode 100644 +index 00000000..9f831cd7 +--- /dev/null ++++ b/fedfs/fedfs-map-nfs4.c +@@ -0,0 +1,204 @@ ++/* ++ * Copyright 2011 Oracle. All rights reserved. ++ * ++ * This file is part of fedfs-utils. ++ * ++ * fedfs-utils is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2.0 as ++ * published by the Free Software Foundation. ++ * ++ * fedfs-utils is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License version 2.0 for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * version 2.0 along with fedfs-utils. If not, see: ++ * ++ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "fedfs-nls.h" ++#include "fedfs-token.h" ++#include "fedfs-getsrvinfo.h" ++#include "fedfs-gpl-boiler.h" ++ ++/** ++ * Name of SRV record containing NFSv4 FedFS root ++ */ ++#define FEDFS_NFS_DOMAINROOT "_nfs-domainroot._tcp" ++ ++/** ++ * Export pathname of NFSv4 FedFS root ++ */ ++#define FEDFS_NFS_EXPORTPATH "/.domainroot" ++ ++static char *progname; ++ ++/** ++ * Display usage message ++ */ ++static void ++fedfs_map_usage(void) ++{ ++ printf(_("\nUsage: %s [domain]\n\n"), progname); ++ ++ printf("%s", fedfs_gpl_boilerplate); ++} ++ ++/** ++ * Construct an NFSv4 map entry for "domainname" with one server ++ * ++ * @param si single-entry list of SRV records ++ * @param domainname NUL-terminated UTF-8 string containing name of FedFS domain ++ * @return command exit status ++ */ ++static int fedfs_map_nfs4_oneserver(struct srvinfo *si, const char *domainname) ++{ ++ printf("-fstype=nfs,vers=4,fg"); ++ if (si->si_port != 2049) ++ printf(",port=%u", si->si_port); ++ printf(" %s:%s/%s\n", si->si_target, FEDFS_NFS_EXPORTPATH, domainname); ++ return 0; ++} ++ ++/** ++ * Construct an NFSv4 map entry for "domainname" with multiple servers ++ * ++ * @param si list of SRV records for requested FedFS domain ++ * @param domainname NUL-terminated UTF-8 string containing name of FedFS domain ++ * @return command exit status ++ */ ++static int fedfs_map_nfs4_replicas(struct srvinfo *si, const char *domainname) ++{ ++ struct srvinfo *cur; ++ unsigned short port; ++ _Bool comma; ++ ++ /* ++ * Unfortunately our automounter can't handle a list of ++ * replicas where the various servers live on different ++ * ports from one another. ++ */ ++ port = si->si_port; ++ for (cur = si; cur != NULL; cur = cur->si_next) ++ if (cur->si_port != port) { ++ fprintf(stderr, _("%s: Replicas on different ports not supported\n"), ++ progname); ++ return 1; ++ } ++ ++ if (port != 2049) ++ printf("-fstype=nfs,vers=4,fg,port=%u ", port); ++ else ++ printf("-fstype=nfs,vers=4,fg "); ++ ++ /* ++ * Note that the export path is required to be indentical ++ * for all domain root servers for this domain. ++ */ ++ for (comma = false, cur = si; cur != NULL; cur = cur->si_next) { ++ if (comma) ++ printf(","); ++ printf("%s(%u)", cur->si_target, cur->si_weight); ++ comma = true; ++ } ++ printf(":%s/%s\n", FEDFS_NFS_EXPORTPATH, domainname); ++ ++ return 0; ++} ++ ++/** ++ * Construct an NFSv4 map entry for "domainname" ++ * ++ * @param domainname NUL-terminated UTF-8 string containing name of FedFS domain ++ * @return command exit status ++ */ ++static int fedfs_map_nfs4(const char *domainname) ++{ ++ struct srvinfo *cur, *si = NULL; ++ unsigned int count; ++ int error, result; ++ ++ result = 1; ++ error = getsrvinfo(FEDFS_NFS_DOMAINROOT, domainname, &si); ++ switch (error) { ++ case ESI_SUCCESS: ++ break; ++ case ESI_NONAME: ++ fprintf(stderr, _("%s: Domain name %s not found\n"), ++ progname, domainname); ++ goto out; ++ case ESI_SERVICE: ++ fprintf(stderr, _("%s: No FedFS domain root available for %s\n"), ++ progname, domainname); ++ goto out; ++ default: ++ fprintf(stderr, _("%s: Failed to resolve %s: %s\n"), ++ progname, domainname, gsi_strerror(error)); ++ goto out; ++ } ++ ++ for (count = 0, cur = si; cur != NULL; cur = cur->si_next) ++ count++; ++ if (count == 1) ++ result = fedfs_map_nfs4_oneserver(si, domainname); ++ else ++ result = fedfs_map_nfs4_replicas(si, domainname); ++ ++out: ++ freesrvinfo(si); ++ return result; ++} ++ ++/** ++ * Program entry point ++ * ++ * @param argc count of command line arguments ++ * @param argv array of NUL-terminated C strings containing command line arguments ++ * @return program exit status ++ */ ++int main(int argc, char *argv[]) ++{ ++ (void)setlocale(LC_ALL, ""); ++ ++ progname = basename(argv[0]); ++ ++ if (argc != 2) { ++ fedfs_map_usage(); ++ return 1; ++ } ++ ++ if (strcmp(progname, "fedfs-map-nfs4") == 0) ++ return fedfs_map_nfs4(argv[1]); ++#ifdef EXAMPLE ++ /* CIFS support might plug in here */ ++ else if (strcmp(progname, "fedfs-map-cifs") == 0) ++ return fedfs_map_cifs(argv[1]); ++#endif ++ ++ fprintf(stderr, _("%s: Unsupported file system type\n"), progname); ++ return 1; ++} +diff --git a/fedfs/fedfs-token.h b/fedfs/fedfs-token.h +new file mode 100644 +index 00000000..5651409d +--- /dev/null ++++ b/fedfs/fedfs-token.h +@@ -0,0 +1,40 @@ ++/* ++ * Copyright (C) 2007 Oracle. All rights reserved. ++ * Copyright (C) 2007 Chuck Lever ++ * ++ * This file is part of fedfs-utils. ++ * ++ * fedfs-utils is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2.0 as ++ * published by the Free Software Foundation. ++ * ++ * fedfs-utils is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License version 2.0 for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * version 2.0 along with fedfs-utils. If not, see: ++ * ++ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ++ */ ++ ++#ifndef _FEDFS_UTILS_TOKEN_H ++#define _FEDFS_UTILS_TOKEN_H ++ ++#include ++ ++/** ++ * Private tokenizer state object ++ */ ++struct tokenizer; ++ ++__attribute_malloc__ ++struct tokenizer *tk_new_tokenizer(const char *string, ++ const char delimiter); ++__attribute_malloc__ ++char *tk_next_token(struct tokenizer *state); ++void tk_free_tokenizer(struct tokenizer *state); ++int tk_tokenizer_error(const struct tokenizer *state); ++ ++#endif /* !_FEDFS_UTILS_TOKEN_H */ diff --git a/SOURCES/autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch b/SOURCES/autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch new file mode 100644 index 0000000..45b3646 --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch @@ -0,0 +1,40 @@ +autofs-5.1.4 - add-man page note about extra slashes in paths + +From: Ian Kent + +Make note of the effect unnecessary multiple slashes can have in map +paths in auto.master(5). + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + man/auto.master.5.in | 8 ++++++++ + 2 files changed, 9 insertions(+) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -25,6 +25,7 @@ xx/xx/2018 autofs-5.1.5 + - use systemd sd_notify() at startup. + - fix NFS version mask usage. + - fix fd leak in rpc_do_create_client(). ++- add-man page note about extra slashes in paths. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/man/auto.master.5.in ++++ autofs-5.1.4/man/auto.master.5.in +@@ -66,6 +66,14 @@ will process the map according to the sp + map entries. Indirect map entries must be unique in the master map so + second and subsequent entries for an indirect mount point are ignored by + .BR automount (8). ++.TP ++.B NOTE: ++autofs currently does not collapse multiple slashes in paths, so it is ++important to ensure paths used in maps are correct. If unnecessary multiple ++slashes are present in a path it can lead to unexpected failures such as ++an inability to expire automounts. An exception to this is a trailing slash ++at the end of the automount point path in the master map which will be ++removed if present. + .SH "FORMAT" + Master map entries have three fields separated by an arbitrary number + of spaces or tabs. Lines beginning with # are comments. The first field diff --git a/SOURCES/autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch b/SOURCES/autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch new file mode 100644 index 0000000..7a4c649 --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch @@ -0,0 +1,179 @@ +autofs-5.1.4 - add master map pseudo options for mount propagation + +From: Ian Kent + +Add master map entry pseudo mount option of "slave" or "private" to +allow mount propagation of bind mounts to be set to either "slave" or +"private". + +This option may be needed when using multi-mounts that have bind mounts +that bind to a file system that is propagation shared. This is becuase +the bind mount will have the same properties as its target which causes +problems for offset mounts. When this happens an unwanted offset mount +is propagated back to the target file system resulting in a deadlock +when attempting to access the offset. + +By default bind mounts will inherit the mount propagation of the target +file system. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/automount.h | 4 ++++ + lib/master_parse.y | 13 +++++++++++++ + lib/master_tok.l | 2 ++ + man/auto.master.5.in | 12 ++++++++++++ + modules/mount_bind.c | 30 +++++++++++++++++++----------- + 6 files changed, 51 insertions(+), 11 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -31,6 +31,7 @@ xx/xx/2018 autofs-5.1.5 + - fix update_negative_cache() map source usage. + - mark removed cache entry negative. + - set bind mount as propagation slave. ++- add master map pseudo options for mount propagation. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -549,6 +549,10 @@ struct kernel_mod_version { + /* Read amd map even if it's not to be ghosted (browsable) */ + #define MOUNT_FLAG_AMD_CACHE_ALL 0x0080 + ++/* Set mount propagation for bind mounts */ ++#define MOUNT_FLAG_SLAVE 0x0100 ++#define MOUNT_FLAG_PRIVATE 0x0200 ++ + struct autofs_point { + pthread_t thid; + char *path; /* Mount point name */ +--- autofs-5.1.4.orig/lib/master_parse.y ++++ autofs-5.1.4/lib/master_parse.y +@@ -58,6 +58,8 @@ static char *format; + static long timeout; + static long negative_timeout; + static unsigned symlnk; ++static unsigned slave; ++static unsigned private; + static unsigned nobind; + static unsigned ghost; + extern unsigned global_selection_options; +@@ -103,6 +105,7 @@ static int master_fprintf(FILE *, char * + %token MAP + %token OPT_TIMEOUT OPT_NTIMEOUT OPT_NOBIND OPT_NOGHOST OPT_GHOST OPT_VERBOSE + %token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT OPT_SYMLINK OPT_MODE ++%token OPT_SLAVE OPT_PRIVATE + %token COLON COMMA NL DDASH + %type map + %type options +@@ -196,6 +199,8 @@ line: + | PATH OPT_DEBUG { master_notify($1); YYABORT; } + | PATH OPT_TIMEOUT { master_notify($1); YYABORT; } + | PATH OPT_SYMLINK { master_notify($1); YYABORT; } ++ | PATH OPT_SLAVE { master_notify($1); YYABORT; } ++ | PATH OPT_PRIVATE { master_notify($1); YYABORT; } + | PATH OPT_NOBIND { master_notify($1); YYABORT; } + | PATH OPT_GHOST { master_notify($1); YYABORT; } + | PATH OPT_NOGHOST { master_notify($1); YYABORT; } +@@ -600,6 +605,8 @@ option: daemon_option + daemon_option: OPT_TIMEOUT NUMBER { timeout = $2; } + | OPT_NTIMEOUT NUMBER { negative_timeout = $2; } + | OPT_SYMLINK { symlnk = 1; } ++ | OPT_SLAVE { slave = 1; } ++ | OPT_PRIVATE { private = 1; } + | OPT_NOBIND { nobind = 1; } + | OPT_NOGHOST { ghost = 0; } + | OPT_GHOST { ghost = 1; } +@@ -672,6 +679,8 @@ static void local_init_vars(void) + timeout = -1; + negative_timeout = 0; + symlnk = 0; ++ slave = 0; ++ private = 0; + nobind = 0; + ghost = defaults_get_browse_mode(); + random_selection = global_selection_options & MOUNT_FLAG_RANDOM_SELECT; +@@ -878,6 +887,10 @@ int master_parse_entry(const char *buffe + entry->ap->flags |= MOUNT_FLAG_USE_WEIGHT_ONLY; + if (symlnk) + entry->ap->flags |= MOUNT_FLAG_SYMLINK; ++ if (slave) ++ entry->ap->flags |= MOUNT_FLAG_SLAVE; ++ if (private) ++ entry->ap->flags |= MOUNT_FLAG_PRIVATE; + if (negative_timeout) + entry->ap->negative_timeout = negative_timeout; + if (mode && mode < LONG_MAX) +--- autofs-5.1.4.orig/lib/master_tok.l ++++ autofs-5.1.4/lib/master_tok.l +@@ -389,6 +389,8 @@ MODE (--mode{OPTWS}|--mode{OPTWS}={OPTW + -?symlink { return(OPT_SYMLINK); } + -?nobind { return(OPT_NOBIND); } + -?nobrowse { return(OPT_NOGHOST); } ++ -?slave { return(OPT_SLAVE); } ++ -?private { return(OPT_PRIVATE); } + -g|--ghost|-?browse { return(OPT_GHOST); } + -v|--verbose { return(OPT_VERBOSE); } + -d|--debug { return(OPT_DEBUG); } +--- autofs-5.1.4.orig/man/auto.master.5.in ++++ autofs-5.1.4/man/auto.master.5.in +@@ -199,6 +199,18 @@ entries only, either in the master map ( + or with individual map entries. The option is ignored for direct mounts + and non-root offest mount entries. + .TP ++.I slave \fPor\fI private ++This option allows mount propagation of bind mounts to be set to ++either \fIslave\fP or \fIprivate\fP. This option may be needed when using ++multi-mounts that have bind mounts that bind to a file system that is ++propagation shared. This is becuase the bind mount will have the same ++properties as its target which causes problems for offset mounts. When ++this happens an unwanted offset mount is propagated back to the target ++file system resulting in a deadlock when attempting to access the offset. ++This option is a an autofs pseudo mount option that can be used in the ++master map only. By default bind mounts will inherit the mount propagation ++of the target file system. ++.TP + .I "\-r, \-\-random-multimount-selection" + Enables the use of random selection when choosing a host from a + list of replicated servers. This option is applied to this mount +--- autofs-5.1.4.orig/modules/mount_bind.c ++++ autofs-5.1.4/modules/mount_bind.c +@@ -186,17 +186,25 @@ int mount_mount(struct autofs_point *ap, + what, fstype, fullpath); + } + +- /* The bind mount has succeeded but if the target +- * mount is propagation shared propagation of child +- * mounts (autofs offset mounts for example) back to +- * the target of the bind mount must be avoided or +- * autofs trigger mounts will deadlock. +- */ +- err = mount(NULL, fullpath, NULL, MS_SLAVE, NULL); +- if (err) +- warn(ap->logopt, +- "failed to set propagation type for %s", +- fullpath); ++ if (ap->flags & (MOUNT_FLAG_SLAVE | MOUNT_FLAG_PRIVATE)) { ++ int flags = MS_SLAVE; ++ ++ if (ap->flags & MOUNT_FLAG_PRIVATE) ++ flags = MS_PRIVATE; ++ ++ /* The bind mount has succeeded but if the target ++ * mount is propagation shared propagation of child ++ * mounts (autofs offset mounts for example) back to ++ * the target of the bind mount must be avoided or ++ * autofs trigger mounts will deadlock. ++ */ ++ err = mount(NULL, fullpath, NULL, flags, NULL); ++ if (err) { ++ warn(ap->logopt, ++ "failed to set propagation for %s", ++ fullpath, root); ++ } ++ } + + return 0; + } else { diff --git a/SOURCES/autofs-5.1.4-add-mount_fedfs_c.patch b/SOURCES/autofs-5.1.4-add-mount_fedfs_c.patch new file mode 100644 index 0000000..9bda028 --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-mount_fedfs_c.patch @@ -0,0 +1,696 @@ +autofs-5.1.4 - add mount.fedfs.c + +From: Ian Kent + +Add build and install of the mount.fedfs binary. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + Makefile | 3 + Makefile.rules | 2 + autofs.spec | 1 + fedfs/Makefile | 36 +++ + fedfs/fedfs-gpl-boiler.h | 40 ++++ + fedfs/fedfs-nls.h | 38 ++++ + fedfs/mount.fedfs.c | 485 ++++++++++++++++++++++++++++++++++++++++++++++ + 8 files changed, 605 insertions(+), 1 deletion(-) + create mode 100644 fedfs/Makefile + create mode 100644 fedfs/fedfs-gpl-boiler.h + create mode 100644 fedfs/fedfs-nls.h + create mode 100644 fedfs/mount.fedfs.c + +diff --git a/CHANGELOG b/CHANGELOG +index 8d6c737c..88992147 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -15,6 +15,7 @@ xx/xx/2018 autofs-5.1.5 + - dont allow trailing slash in master map mount points. + - fix libresolv configure check. + - add fedfs-getsrvinfo.c. ++- add mount.fedfs.c. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/Makefile b/Makefile +index e560a7cb..99db2c75 100644 +--- a/Makefile ++++ b/Makefile +@@ -19,6 +19,9 @@ kernel: + samples: + set -e; if [ -d samples ]; then $(MAKE) -C samples all; fi + ++fedfs: ++ set -e; if [ -d fedfs ]; then $(MAKE) -C fedfs all; fi ++ + clean: + for i in $(SUBDIRS) samples; do \ + if [ -d $$i ]; then $(MAKE) -C $$i clean; fi; done +diff --git a/Makefile.rules b/Makefile.rules +index 4deab3b9..fc9f6019 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -3,7 +3,7 @@ + # + + # Root directory contents +-SUBDIRS = lib daemon modules man ++SUBDIRS = lib daemon fedfs modules man + INCDIRS = include + INCFILES = COPYING COPYRIGHT NEWS README* TODO Makefile Makefile.rules \ + Makefile.conf.in .version .autofs-* configure.in aclocal.m4 \ +diff --git a/autofs.spec b/autofs.spec +index 2464e741..2cc0e38f 100644 +--- a/autofs.spec ++++ b/autofs.spec +@@ -191,6 +191,7 @@ fi + %config(noreplace) /etc/sysconfig/autofs + %config(noreplace) /etc/autofs_ldap_auth.conf + %{_sbindir}/automount ++%{_sbindir}/mount.fedfs + %dir %{_libdir}/autofs + %{_libdir}/autofs/* + %{_mandir}/*/* +diff --git a/fedfs/Makefile b/fedfs/Makefile +new file mode 100644 +index 00000000..cb325bed +--- /dev/null ++++ b/fedfs/Makefile +@@ -0,0 +1,36 @@ ++# ++# Makefile for mount.fedfs ++# ++ ++-include ../Makefile.conf ++include ../Makefile.rules ++ ++SRCS = mount.fedfs.c ++HDRS = fedfs-getsrvinfo.h fedfs-gpl-boiler.h fedfs-nls.h ++ ++fedfs-getsrvinfo_OBJ = fedfs-getsrvinfo.o ++ ++mount_fedfs_OBJ = mount.fedfs.o ++ ++version := $(shell cat ../.version) ++ ++CFLAGS += -rdynamic $(DAEMON_CFLAGS) -D_GNU_SOURCE -I../include ++CFLAGS += -DVERSION_STRING=\"$(version)\" ++LDFLAGS += -rdynamic ++ ++all: mount.fedfs ++ ++mount.fedfs: $(mount_fedfs_OBJ) $(fedfs-getsrvinfo_OBJ) $(HDRS) ++ $(CC) -o mount.fedfs \ ++ $(mount_fedfs_OBJ) $(fedfs-getsrvinfo_OBJ) \ ++ $(LDFLAGS) $(LIBRESOLV) $(LIBS) ++ ++clean: ++ rm -f *.o *.s *~ mount.fedfs ++ ++install: all ++ install -d -m 755 $(INSTALLROOT)$(sbindir) ++ if ! test -x $(INSTALLROOT)$(sbindir)/mount.fedfs; \ ++ then \ ++ install -c mount.fedfs -m 755 $(INSTALLROOT)$(sbindir); \ ++ fi +diff --git a/fedfs/fedfs-gpl-boiler.h b/fedfs/fedfs-gpl-boiler.h +new file mode 100644 +index 00000000..1353e736 +--- /dev/null ++++ b/fedfs/fedfs-gpl-boiler.h +@@ -0,0 +1,40 @@ ++/* ++ * Copyright 2011 Oracle. All rights reserved. ++ * ++ * This file is part of fedfs-utils. ++ * ++ * fedfs-utils is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2.0 as ++ * published by the Free Software Foundation. ++ * ++ * fedfs-utils is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License version 2.0 for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * version 2.0 along with fedfs-utils. If not, see: ++ * ++ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ++ */ ++ ++#ifndef _GPL_BOILER_H_ ++#define _GPL_BOILER_H_ ++ ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ ++/** ++ * GPLv2 boilerplate for usage messages ++ */ ++static const char *fedfs_gpl_boilerplate = ++ "\nCopyright 2010, 2011, 2012, 2013 Oracle. " ++ "All rights reserved.\n\n" ++ "License GPLv2: " ++ "\n" ++ "This is free software. " ++ "You are free to change and redistribute it.\n" ++ "There is NO WARRANTY, to the extent permitted by law.\n"; ++ ++#endif /* !_GPL_BOILER_H_ */ +diff --git a/fedfs/fedfs-nls.h b/fedfs/fedfs-nls.h +new file mode 100644 +index 00000000..92f968d3 +--- /dev/null ++++ b/fedfs/fedfs-nls.h +@@ -0,0 +1,38 @@ ++/* ++ * From util-linux/include/nls.h (GPLv2) ++ */ ++ ++#ifndef UTIL_LINUX_NLS_H ++#define UTIL_LINUX_NLS_H ++ ++int main(int argc, char *argv[]); ++ ++#ifndef LOCALEDIR ++#define LOCALEDIR "/usr/share/locale" ++#endif ++ ++#ifdef HAVE_LOCALE_H ++# include ++#else ++# undef setlocale ++# define setlocale(Category, Locale) ({}) /* empty */ ++#endif ++ ++#ifdef ENABLE_NLS ++# include ++# define _(Text) gettext (Text) ++# ifdef gettext_noop ++# define N_(String) gettext_noop (String) ++# else ++# define N_(String) (String) ++# endif ++#else ++# undef bindtextdomain ++# define bindtextdomain(Domain, Directory) /* empty */ ++# undef textdomain ++# define textdomain(Domain) /* empty */ ++# define _(Text) (Text) ++# define N_(Text) (Text) ++#endif ++ ++#endif /* UTIL_LINUX_NLS_H */ +diff --git a/fedfs/mount.fedfs.c b/fedfs/mount.fedfs.c +new file mode 100644 +index 00000000..bd434395 +--- /dev/null ++++ b/fedfs/mount.fedfs.c +@@ -0,0 +1,485 @@ ++/* ++ * Copyright 2011 Oracle. All rights reserved. ++ * ++ * This file is part of fedfs-utils. ++ * ++ * fedfs-utils is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2.0 as ++ * published by the Free Software Foundation. ++ * ++ * fedfs-utils is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License version 2.0 for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * version 2.0 along with fedfs-utils. If not, see: ++ * ++ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "fedfs-nls.h" ++#include "fedfs-getsrvinfo.h" ++#include "fedfs-gpl-boiler.h" ++ ++/** ++ * Top-level directory on client under which we mount NFSv4 domain roots ++ */ ++#define FEDFS_NFS4_TLDIR "nfs4" ++ ++/** ++ * Name of SRV record containing NFSv4 FedFS root ++ */ ++#define FEDFS_NFS_DOMAINROOT "_nfs-domainroot._tcp" ++ ++/** ++ * Export path of NFSv4 FedFS root ++ */ ++#define FEDFS_NFS_EXPORTPATH "/.domainroot" ++ ++/** ++ * Pathname to mount.nfs ++ */ ++#define MOUNT_NFS_EXECUTABLE "/sbin/mount.nfs" ++ ++/** ++ * Mount status values, lifted from util-linux ++ */ ++enum { ++ EX_SUCCESS = 0, ++ EX_USAGE = 1, ++ EX_FAIL = 32, ++}; ++ ++static char *progname; ++static int nomtab; ++static int verbose; ++static _Bool readonly; ++static _Bool sloppy; ++static _Bool fake; ++ ++/** ++ * Short form command line options ++ */ ++static const char fedfs_opts[] = "fhno:rsvVw"; ++ ++/** ++ * Long form command line options ++ */ ++static const struct option fedfs_longopts[] = ++{ ++ { "fake", 0, NULL, 'f' }, ++ { "help", 0, NULL, 'h' }, ++ { "no-mtab", 0, NULL, 'n' }, ++ { "options", 1, NULL, 'o' }, ++ { "read-only", 0, NULL, 'r' }, ++ { "read-write", 0, NULL, 'w' }, ++ { "ro", 0, NULL, 'r' }, ++ { "rw", 0, NULL, 'w' }, ++ { "sloppy", 0, NULL, 's' }, ++ { "verbose", 0, NULL, 'v' }, ++ { "version", 0, NULL, 'V' }, ++ { NULL, 0, NULL, 0 } ++}; ++ ++/** ++ * Display mount.fedfs usage message ++ */ ++static void ++mount_usage(void) ++{ ++ printf(_("\nUsage: %s remotedir localdir [-fhnrsvVw]\n\n"), progname); ++ printf(_("options:\n")); ++ printf(_("\t-f\t\tFake mount, do not actually mount\n")); ++ printf(_("\t-h\t\tPrint this help\n")); ++ printf(_("\t-n\t\tDo not update /etc/mtab\n")); ++ printf(_("\t-r\t\tMount file system readonly\n")); ++ printf(_("\t-s\t\tTolerate sloppy mount options\n")); ++ printf(_("\t-v\t\tVerbose\n")); ++ printf(_("\t-V\t\tPrint version\n")); ++ printf(_("\t-w\t\tMount file system read-write\n")); ++ ++ printf("%s", fedfs_gpl_boilerplate); ++} ++ ++/** ++ * Concatenate three strings ++ * ++ * @param s NUL-terminated C string ++ * @param t NUL-terminated C string ++ * @param u NUL-terminated C string ++ * @return pointer to NUL-terminated C string or NULL ++ * ++ * Caller must free the returned string with free(3). Always frees ++ * its first arg - typical use: s = xstrconcat3(s,t,u); ++ * ++ * Lifted from util-linux. ++ */ ++static char * ++xstrconcat3(char *s, const char *t, const char *u) ++{ ++ _Bool free_s = true; ++ char *result; ++ ++ if (s == NULL) { ++ s = ""; ++ free_s = false; ++ } ++ if (t == NULL) ++ t = ""; ++ if (u == NULL) ++ u = ""; ++ result = malloc(strlen(s) + strlen(t) + strlen(u) + 1); ++ if (result == NULL) ++ goto out; ++ ++ strcpy(result, s); ++ strcat(result, t); ++ strcat(result, u); ++ ++out: ++ if (free_s) ++ free(s); ++ return result; ++} ++ ++/** ++ * Exec mount.nfs ++ * ++ * @param server NUL-terminated C string containing name of NFS server ++ * @param port server port to use when mounting ++ * @param domainname NUL-terminated C string containing FedFS domain name ++ * @param export_path NUL-terminated C string containing server export path ++ * @param mounted_on_dir NUL-terminated C string containing local mounted-on directory ++ * @param text_options NUL-terminated C string containing user's mount options ++ * ++ */ ++static void ++exec_mount_nfs4(const char *server, unsigned short port, ++ const char *domainname, const char *export_path, ++ const char *mounted_on_dir, const char *text_options) ++{ ++ static char special[2048]; ++ static char options[2048]; ++ char *args[16]; ++ int count = 0; ++ ++ snprintf(special, sizeof(special), "%s:%s/%s%s", server, ++ FEDFS_NFS_EXPORTPATH, domainname, export_path); ++ ++ if (text_options != NULL && strcmp(text_options, "") != 0) ++ snprintf(options, sizeof(options), "%s,vers=4,fg,port=%u", ++ text_options, port); ++ else ++ snprintf(options, sizeof(options), "vers=4,fg,port=%u", port); ++ ++ if (verbose) { ++ printf(_("%s: Special device: %s\n"), ++ progname, special); ++ printf(_("%s: Mounted-on directory: %s\n"), ++ progname, mounted_on_dir); ++ printf(_("%s: Mount options: %s\n"), ++ progname, options); ++ } ++ ++ args[count++] = MOUNT_NFS_EXECUTABLE; ++ args[count++] = special; ++ args[count++] = (char *)mounted_on_dir; ++ if (verbose) ++ args[count++] = "-v"; ++ if (fake) ++ args[count++] = "-f"; ++ if (nomtab) ++ args[count++] = "-n"; ++ if (readonly) ++ args[count++] = "-r"; ++ if (sloppy) ++ args[count++] = "-s"; ++ args[count++] = "-o"; ++ args[count++] = options; ++ ++ args[count] = NULL; ++ execv(args[0], args); ++} ++ ++/** ++ * Mount a FedFS domain root via NFSv4 ++ * ++ * @param domainname NUL-terminated C string containing FedFS domain name ++ * @param export_path NUL-terminated C string containing server export path ++ * @param mounted_on_dir NUL-terminated C string containing local mounted-on directory ++ * @param text_options NUL-terminated C string containing user's mount options ++ * @return exit status code from the mount.nfs command ++ * ++ * Construct the server:/export string and the mounted-on directory string ++ * based on the DNS SRV query results, then fork and exec mount.nfs to do ++ * the actual mount request. ++ */ ++static int ++nfs4_mount(const char *domainname, const char *export_path, ++ const char *mounted_on_dir, const char *text_options) ++{ ++ struct srvinfo *tmp, *si = NULL; ++ int error, status; ++ ++ status = EX_FAIL; ++ ++ error = getsrvinfo(FEDFS_NFS_DOMAINROOT, domainname, &si); ++ switch (error) { ++ case ESI_SUCCESS: ++ break; ++ case ESI_NONAME: ++ fprintf(stderr, _("%s: Domain name %s not found\n"), ++ progname, domainname); ++ goto out; ++ case ESI_SERVICE: ++ fprintf(stderr, _("%s: No FedFS domain root available for %s\n"), ++ progname, domainname); ++ goto out; ++ default: ++ fprintf(stderr, _("%s: Failed to resolve %s: %s\n"), ++ progname, domainname, gsi_strerror(error)); ++ goto out; ++ } ++ ++ /* ++ * The srvinfo list is already in RFC 2782 sorted order. Try each ++ * SRV record once, in the foreground. Go with the first one that ++ * works. ++ */ ++ for (tmp = si; tmp != NULL; tmp = tmp->si_next) { ++ pid_t pid; ++ ++ pid = fork(); ++ switch (pid) { ++ case 0: ++ exec_mount_nfs4(tmp->si_target, tmp->si_port, ++ domainname, export_path, mounted_on_dir, ++ text_options); ++ /*NOTREACHED*/ ++ fprintf(stderr, _("%s: Failed to exec: %s\n"), ++ progname, strerror(errno)); ++ exit(EX_FAIL); ++ case -1: ++ fprintf(stderr, _("%s: Failed to fork: %s\n"), ++ progname, strerror(errno)); ++ goto out; ++ default: ++ waitpid(pid, &status, 0); ++ if (status == EX_SUCCESS) ++ goto out; ++ } ++ } ++ ++out: ++ freesrvinfo(si); ++ return status; ++} ++ ++/** ++ * Try one mount request ++ * ++ * @param source NUL-terminated C string containing name of "special device" ++ * @param target NUL-terminated C string containing local mounted-on directory ++ * @param text_options NUL-terminated C string containing user's mount options ++ * @return an exit status code ++ * ++ * Parse the pathname in "source." It contains the file system protocol ++ * and FedFS domain name. Then pass these arguments to the appropriate ++ * mount helper subcommand. ++ */ ++static int ++try_mount(const char *source, const char *target, const char *text_options) ++{ ++ char *global_name, *topdir, *domainname, *remaining; ++ int result; ++ ++ remaining = NULL; ++ result = EX_FAIL; ++ ++ global_name = strdup(source); ++ if (global_name == NULL) { ++ fprintf(stderr, _("%s: Unable to parse globally useful name\n"), ++ progname); ++ goto out; ++ } ++ ++ topdir = strtok(global_name, "/"); ++ if (topdir == NULL) { ++ fprintf(stderr, _("%s: Invalid globally useful name: %s\n"), ++ progname, source); ++ goto out; ++ } ++ if (verbose) ++ printf(_("%s: Top-level directory: %s\n"), ++ progname, topdir); ++ ++ domainname = strtok(NULL, "/"); ++ if (domainname == NULL) { ++ fprintf(stderr, _("%s: Missing domain name in globally " ++ "useful name: %s\n"), progname, source); ++ goto out; ++ } ++ if (verbose) ++ printf(_("%s: Domain name: %s\n"), ++ progname, domainname); ++ ++ remaining = strtok(NULL, "/"); ++ if (remaining == NULL) { ++ remaining = strdup("/"); ++ if (remaining == NULL) { ++ fprintf(stderr, _("%s: No memory\n"), progname); ++ goto out; ++ } ++ } else { ++ char *tmp; ++ ++ tmp = malloc(strlen(remaining) + 1); ++ if (tmp == NULL) { ++ fprintf(stderr, _("%s: No memory\n"), progname); ++ remaining = NULL; ++ goto out; ++ } ++ strcpy(tmp, "/"); ++ strcat(tmp, remaining); ++ remaining = tmp; ++ } ++ if (verbose) ++ printf(_("%s: Export path: %s\n"), ++ progname, remaining); ++ ++ if (strcmp(topdir, FEDFS_NFS4_TLDIR) == 0) ++ result = nfs4_mount(domainname, remaining, target, text_options); ++#if 0 ++ /* example: SMB support plugs in here */ ++ else if (strcmp(topdir, FEDFS_SMB_TLDIR) == 0) ++ result = smb_mount(domainname, remaining, target, text_options); ++#endif ++ else ++ fprintf(stderr, _("%s: Unrecognized file system protocol\n"), progname); ++ ++out: ++ free(global_name); ++ free(remaining); ++ ++ return result; ++} ++ ++/** ++ * Program entry point ++ * ++ * @param argc count of command line arguments ++ * @param argv array of NUL-terminated C strings containing command line arguments ++ * @return program exit status ++ */ ++int main(int argc, char *argv[]) ++{ ++ char *source, *target, *text_options; ++ int c, mnt_err; ++ ++ (void)setlocale(LC_ALL, ""); ++ ++ progname = basename(argv[0]); ++ ++ if (argv[1] && argv[1][0] == '-') { ++ if(argv[1][1] == 'V') ++ printf("%s (VERSION_STRING)\n", progname); ++ else ++ mount_usage(); ++ exit(EX_SUCCESS); ++ } ++ ++ if (argc < 3) { ++ mount_usage(); ++ exit(EX_USAGE); ++ } ++ ++ source = argv[1]; ++ target = argv[2]; ++ ++ mnt_err = EX_USAGE; ++ text_options = NULL; ++ readonly = false; ++ sloppy = false; ++ fake = false; ++ argv[2] = argv[0]; /* so that getopt error messages are correct */ ++ while ((c = getopt_long(argc - 2, argv + 2, fedfs_opts, ++ fedfs_longopts, NULL)) != -1) { ++ switch (c) { ++ case 'f': ++ fake = true; ++ break; ++ case 'n': ++ ++nomtab; ++ break; ++ case 'o': ++ /* Ugh. */ ++ if (text_options != NULL) ++ text_options = xstrconcat3(text_options, ",", optarg); ++ else ++ text_options = strdup(optarg); ++ if (text_options == NULL) { ++ fprintf(stderr, _("%s: No memory\n"), progname); ++ goto out; ++ } ++ break; ++ case 'r': ++ readonly = true; ++ break; ++ case 's': ++ sloppy = true; ++ break; ++ case 'v': ++ ++verbose; ++ break; ++ case 'V': ++ printf("%s: (VERSION_STRING)\n", progname); ++ mnt_err = EX_SUCCESS; ++ goto out; ++ case 'w': ++ readonly = false; ++ break; ++ case 'h': ++ default: ++ mount_usage(); ++ goto out; ++ } ++ } ++ ++ /* Extra non-option words at the end are bogus... */ ++ if (optind != argc - 2) { ++ mount_usage(); ++ goto out; ++ } ++ ++ if (getuid() != 0 && geteuid() != 0) { ++ fprintf(stderr, _("%s: Not installed setuid - " ++ "\"user\" FedFS mounts are not supported\n"), progname); ++ mnt_err = EX_FAIL; ++ goto out; ++ } ++ ++ mnt_err = try_mount(source, target, text_options); ++ ++out: ++ free(text_options); ++ exit(mnt_err); ++} diff --git a/SOURCES/autofs-5.1.4-add-systemd-service-command-line-option.patch b/SOURCES/autofs-5.1.4-add-systemd-service-command-line-option.patch new file mode 100644 index 0000000..ba8838d --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-systemd-service-command-line-option.patch @@ -0,0 +1,137 @@ +autofs-5.1.4 - add systemd service command line option + +From: Ian Kent + +When run as a systemd service using the systemd notification method to +synchronise startup, logging should be done to syslog so the log entry +format is consistent between daemon and systemd usage. + +So, rather than run use the forground option, add an option to tell +the automounter it's being run as a systemd service and use syslog +for logging when its present on the command line. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 22 +++++++++++++++++++--- + include/automount.h | 1 + + man/automount.8 | 4 ++++ + samples/autofs.service.in | 2 +- + 5 files changed, 26 insertions(+), 4 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -43,6 +43,7 @@ xx/xx/2018 autofs-5.1.5 + - update build info with systemd. + - use flags for startup boolean options. + - move close stdio descriptors to become_daemon(). ++- add systemd service command line option. + + 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 +@@ -1210,13 +1210,21 @@ static void become_daemon(unsigned int f + } + + /* Detach from foreground process */ +- if (flags & DAEMON_FLAGS_FOREGROUND) { ++ if (flags & DAEMON_FLAGS_FOREGROUND && ++ !(flags & DAEMON_FLAGS_SYSTEMD_SERVICE)) { + if ((flags & DAEMON_FLAGS_CHECK_DAEMON) && !aquire_flag_file()) { + fprintf(stderr, "%s: program is already running.\n", + program); + exit(1); + } + log_to_stderr(); ++ } else if (flags & DAEMON_FLAGS_SYSTEMD_SERVICE) { ++ if ((flags & DAEMON_FLAGS_CHECK_DAEMON) && !aquire_flag_file()) { ++ fprintf(stderr, "%s: program is already running.\n", ++ program); ++ exit(1); ++ } ++ open_log(); + } else { + int nullfd; + +@@ -1925,6 +1933,8 @@ static void usage(void) + " -d --debug log debuging info\n" + " -Dvariable=value, --define variable=value\n" + " define global macro variable\n" ++ " -S --systemd-service\n" ++ " run automounter as a systemd service\n" + " -f --foreground do not fork into background\n" + " -r --random-multimount-selection\n" + " use ramdom replicated server selection\n" +@@ -2190,7 +2200,7 @@ int main(int argc, char *argv[]) + time_t timeout; + time_t age = monotonic_time(NULL); + struct rlimit rlim; +- const char *options = "+hp:t:vmdD:fVrO:l:n:CFM"; ++ const char *options = "+hp:t:vmdD:SfVrO:l:n:CFM"; + static const struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"pid-file", 1, 0, 'p'}, +@@ -2198,6 +2208,7 @@ int main(int argc, char *argv[]) + {"verbose", 0, 0, 'v'}, + {"debug", 0, 0, 'd'}, + {"define", 1, 0, 'D'}, ++ {"systemd-service", 0, 0, 'S'}, + {"foreground", 0, 0, 'f'}, + {"random-multimount-selection", 0, 0, 'r'}, + {"negative-timeout", 1, 0, 'n'}, +@@ -2266,6 +2277,10 @@ int main(int argc, char *argv[]) + macro_parse_globalvar(optarg); + break; + ++ case 'S': ++ flags |= DAEMON_FLAGS_SYSTEMD_SERVICE; ++ break; ++ + case 'f': + flags |= DAEMON_FLAGS_FOREGROUND; + break; +@@ -2653,7 +2668,8 @@ int main(int argc, char *argv[]) + } + + #ifdef WITH_SYSTEMD +- sd_notify(1, "READY=1"); ++ if (flags & DAEMON_FLAGS_SYSTEMD_SERVICE) ++ sd_notify(1, "READY=1"); + #endif + + state_mach_thid = pthread_self(); +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -67,6 +67,7 @@ + #endif + + #define DAEMON_FLAGS_FOREGROUND 0x0001 ++#define DAEMON_FLAGS_SYSTEMD_SERVICE 0x0002 + #define DAEMON_FLAGS_HAVE_GLOBAL_OPTIONS 0x0004 + #define DAEMON_FLAGS_GHOST 0x0008 + #define DAEMON_FLAGS_CHECK_DAEMON 0x0010 +--- autofs-5.1.4.orig/man/automount.8 ++++ autofs-5.1.4/man/automount.8 +@@ -57,6 +57,10 @@ Define a global macro substitution varia + are over-ridden macro definitions of the same name specified in + mount entries. + .TP ++.I \-S, \-\-systemd-service ++Used when running the automounter as a systemd service to ensure log entry ++format is consistent with the log entry format when running as a daemon. ++.TP + .I "\-f, \-\-foreground" + Run the daemon in the foreground and log to stderr instead of syslog." + .TP +--- autofs-5.1.4.orig/samples/autofs.service.in ++++ autofs-5.1.4/samples/autofs.service.in +@@ -6,7 +6,7 @@ Wants=network-online.target rpc-statd.se + [Service] + Type=notify + EnvironmentFile=-@@autofsconfdir@@/autofs +-ExecStart=@@sbindir@@/automount $OPTIONS --foreground --dont-check-daemon ++ExecStart=@@sbindir@@/automount $OPTIONS --systemd-service --dont-check-daemon + ExecReload=/usr/bin/kill -HUP $MAINPID + KillMode=process + TimeoutSec=180 diff --git a/SOURCES/autofs-5.1.4-add-units-After-line-to-include-statd-service.patch b/SOURCES/autofs-5.1.4-add-units-After-line-to-include-statd-service.patch new file mode 100644 index 0000000..c5b6ee4 --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-units-After-line-to-include-statd-service.patch @@ -0,0 +1,39 @@ +autofs-5.1.4 - add units After line to include statd service + +From: Ian Kent + +autofs needs to ensure statd is started before any NFS mounts +are attempted. This is because if the first NFS mount starts +the service and the mount is an automounted directory that is +included in the PATH used by systemctl (eg. /usr/local/bin) +the mount cannot complete. + +Add rpc-statd.service to the unit "After=" line to try and +ensure it is started before automount. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + samples/autofs.service.in | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -21,6 +21,7 @@ xx/xx/2018 autofs-5.1.5 + - add an example fedfs master map entry to the installed master map. + - improve hostname lookup error logging. + - tiny patch for autofs typo and possible bug. ++- add units After line to include statd service. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/samples/autofs.service.in ++++ autofs-5.1.4/samples/autofs.service.in +@@ -1,6 +1,6 @@ + [Unit] + Description=Automounts filesystems on demand +-After=network.target ypbind.service sssd.service network-online.target remote-fs.target ++After=network.target ypbind.service sssd.service network-online.target remote-fs.target rpc-statd.service rpcbind.service + Wants=network-online.target rpc-statd.service rpcbind.service + + [Service] diff --git a/SOURCES/autofs-5.1.4-better-handle-hesiod-support-not-built-in.patch b/SOURCES/autofs-5.1.4-better-handle-hesiod-support-not-built-in.patch new file mode 100644 index 0000000..eb62296 --- /dev/null +++ b/SOURCES/autofs-5.1.4-better-handle-hesiod-support-not-built-in.patch @@ -0,0 +1,130 @@ +autofs-5.1.4 - better handle hesiod support not built in + +From: Ian Kent + +The configure option --without-hesiod is not handled well. + +If this option is given and hesiod is seen in the master +map parser or the amd map parser issue a message telling +the user hesiod support isn't built in. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/master_parse.y | 18 ++++++++++++++++-- + modules/amd_parse.y | 7 +++++++ + modules/parse_amd.c | 28 +++++++++++++++++++++++++--- + 4 files changed, 49 insertions(+), 5 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -36,6 +36,7 @@ xx/xx/2018 autofs-5.1.5 + - fix use after free in parse_ldap_config(). + - fix incorrect locking in sss lookup. + - fix amd parser opts option handling. ++- better handle hesiod support not built in. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/master_parse.y ++++ autofs-5.1.4/lib/master_parse.y +@@ -171,7 +171,14 @@ line: + + if ((tmp = strchr($2, ','))) + *tmp++ = '\0'; +- ++#ifndef WITH_HESIOD ++ /* Map type or or map type parser is hesiod */ ++ if (!strcmp($2, "hesiod") || !strcmp(tmp, "hesiod")) { ++ master_error("hesiod support not built in"); ++ local_free_vars(); ++ YYABORT; ++ } ++#endif + if (type) + free(type); + type = master_strdup($2); +@@ -352,7 +359,14 @@ map: PATH + + if ((tmp = strchr($1, ','))) + *tmp++ = '\0'; +- ++#ifndef WITH_HESIOD ++ /* Map type or or map type parser is hesiod */ ++ if (!strcmp($1, "hesiod") || !strcmp(tmp, "hesiod")) { ++ master_error("hesiod support not built in"); ++ local_free_vars(); ++ YYABORT; ++ } ++#endif + if (type) + free(type); + if (strcmp($1, "exec")) +--- autofs-5.1.4.orig/modules/amd_parse.y ++++ autofs-5.1.4/modules/amd_parse.y +@@ -574,6 +574,13 @@ static int match_map_option_map_type(cha + !strcmp(map_type, "nisplus") || + !strcmp(map_type, "ldap") || + !strcmp(map_type, "hesiod")) { ++#ifndef WITH_HESIOD ++ if (!strcmp(map_type, "hesiod")) { ++ amd_msg("hesiod support not built in"); ++ free(map_type); ++ return 0; ++ } ++#endif + amd_set_value(&entry.map_type, map_type); + } else if (!strcmp(map_type, "exec")) { + /* autofs uses "program" for "exec" map type */ +--- autofs-5.1.4.orig/modules/parse_amd.c ++++ autofs-5.1.4/modules/parse_amd.c +@@ -1871,15 +1871,25 @@ struct amd_entry *make_default_entry(str + if (amd_parse_list(ap, defaults, &dflts, &sv)) + return NULL; + defaults_entry = list_entry(dflts.next, struct amd_entry, list); +- list_del_init(&defaults_entry->list); + /* + * If map type isn't given try to inherit from + * parent. A NULL map type is valid and means + * use configured nss sources. + */ + map_type = conf_amd_get_map_type(ap->path); +- if (map_type) ++ if (map_type) { + defaults_entry->map_type = map_type; ++#ifndef HAVE_HESIOD ++ if (!strcmp(map_type, "hesiod")) { ++ warn(ap->logopt, MODPREFIX ++ "hesiod support not built in, " ++ "defaults map entry not set"); ++ defaults_entry = NULL; ++ } ++#endif ++ } ++ if (defaults_entry) ++ list_del_init(&defaults_entry->list); + /* The list should now be empty .... */ + free_amd_entry_list(&dflts); + return defaults_entry; +@@ -2005,8 +2015,20 @@ static struct amd_entry *get_defaults_en + * use configured nss sources. + */ + char *map_type = conf_amd_get_map_type(ap->path); +- if (map_type) ++ if (map_type) { + entry->map_type = map_type; ++#ifndef HAVE_HESIOD ++ if (!strcmp(map_type, "hesiod")) { ++ warn(ap->logopt, MODPREFIX ++ "hesiod support not built in, " ++ "attempting to use internal " ++ "default"); ++ free_amd_entry(entry); ++ free(expand); ++ goto out; ++ } ++#endif ++ } + } + free(expand); + } diff --git a/SOURCES/autofs-5.1.4-covarity-fixes-1.patch b/SOURCES/autofs-5.1.4-covarity-fixes-1.patch new file mode 100644 index 0000000..e434734 --- /dev/null +++ b/SOURCES/autofs-5.1.4-covarity-fixes-1.patch @@ -0,0 +1,425 @@ +autofs-5.1.4 - covarity fixes 1 + +From: Ian Kent + +* remove conditional close of nullfd. +* fix memory leak of local_domain in lib/macros.c:macro_init(). +* check for NULL prior to several assignments in lib/master_parse.y. +* fix memory leak in lib/mounts.c:add_std_amd_vars(). +* add missing break in lib/rpc_subs.c:rpc_get_netid(). +* fix variable scope problem in modules/amd_parse.c:make_selector(). +* fix selector itself not freed in lib/parse_subs.c:free_selector(). +* fix possible memory leak in modules/lookup_ldap.c:parse_ldap_config(). +* fix possible memory leak in modules/lookup_ldap.c:decode_percent_hack(). +* fix usage of decode_percent_hack() in modules/lookup_ldap.c. +* initialize enc_key1 and enc_key2 in modules/lookup_ldap.c:lookup_one(). +* fix double alloc of map_type in modules/parse_amd.c:make_default_entry(). +* fix double alloc of map_type in modules/parse_amd.c:get_defaults_entry(). +* fix possible memory leak in modules/parse_sun.c:parse_reinit(). +* initialize myoptions and ro_loc in modules/parse_sun.c:mount_subtree(). +* initialize myoptions and loc in modules/parse_sun.c:parse_mount(). + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/log.c | 3 +-- + lib/macros.c | 1 + + lib/master_parse.y | 28 ++++++++++++++++++++++++++++ + lib/mounts.c | 4 +++- + lib/parse_subs.c | 1 + + lib/rpc_subs.c | 1 + + modules/amd_parse.y | 4 ++-- + modules/lookup_ldap.c | 27 ++++++++++++++++++++++----- + modules/parse_amd.c | 4 ++-- + modules/parse_sun.c | 10 +++++++++- + 11 files changed, 71 insertions(+), 13 deletions(-) + +--- autofs-5.1.4.orig/lib/log.c ++++ autofs-5.1.4/lib/log.c +@@ -336,8 +336,7 @@ void log_to_syslog(void) + exit(1); + } + +- if (nullfd > 2) +- close(nullfd); ++ close(nullfd); + + return; + } +--- autofs-5.1.4.orig/lib/macros.c ++++ autofs-5.1.4/lib/macros.c +@@ -137,6 +137,7 @@ void macro_init(void) + + macro_init_done = 1; + macro_unlock(); ++ free(local_domain); + return; + } + +--- autofs-5.1.4.orig/lib/master_parse.y ++++ autofs-5.1.4/lib/master_parse.y +@@ -157,6 +157,8 @@ line: + + trim_maptype($2); + ++ if (path) ++ free(path); + path = master_strdup($1); + if (!path) { + master_error("memory allocation error"); +@@ -167,6 +169,8 @@ line: + if ((tmp = strchr($2, ','))) + *tmp++ = '\0'; + ++ if (type) ++ free(type); + type = master_strdup($2); + if (!type) { + master_error("memory allocation error"); +@@ -174,6 +178,8 @@ line: + YYABORT; + } + if (tmp) { ++ if (format) ++ free(format); + format = master_strdup(tmp); + if (!format) { + master_error("memory allocation error"); +@@ -204,6 +210,8 @@ line: + + mapspec: map + { ++ if (local_argv) ++ free_argv(local_argc, (const char **) local_argv); + local_argc = tmp_argc; + local_argv = tmp_argv; + tmp_argc = 0; +@@ -211,6 +219,8 @@ mapspec: map + } + | map options + { ++ if (local_argv) ++ free_argv(local_argc, (const char **) local_argv); + local_argc = tmp_argc; + local_argv = tmp_argv; + tmp_argc = 0; +@@ -288,6 +298,8 @@ map: PATH + } + | MAPHOSTS + { ++ if (type) ++ free(type); + type = master_strdup($1 + 1); + if (!type) { + local_free_vars(); +@@ -302,6 +314,8 @@ map: PATH + } + | MAPNULL + { ++ if (type) ++ free(type); + type = master_strdup($1 + 1); + if (!type) { + local_free_vars(); +@@ -310,6 +324,8 @@ map: PATH + } + | dnattrs + { ++ if (type) ++ free(type); + type = master_strdup("ldap"); + if (!type) { + local_free_vars(); +@@ -332,6 +348,8 @@ map: PATH + if ((tmp = strchr($1, ','))) + *tmp++ = '\0'; + ++ if (type) ++ free(type); + if (strcmp($1, "exec")) + type = master_strdup($1); + else +@@ -342,6 +360,8 @@ map: PATH + YYABORT; + } + if (tmp) { ++ if (format) ++ free(format); + format = master_strdup(tmp); + if (!format) { + master_error("memory allocation error"); +@@ -366,6 +386,8 @@ map: PATH + if ((tmp = strchr($1, ','))) + *tmp++ = '\0'; + ++ if (type) ++ free(type); + if (strcmp($1, "exec")) + type = master_strdup($1); + else +@@ -376,6 +398,8 @@ map: PATH + YYABORT; + } + if (tmp) { ++ if (format) ++ free(format); + format = master_strdup(tmp); + if (!format) { + master_error("memory allocation error"); +@@ -400,6 +424,8 @@ map: PATH + if ((tmp = strchr($1, ','))) + *tmp++ = '\0'; + ++ if (type) ++ free(type); + if (strcmp($1, "exec")) + type = master_strdup($1); + else +@@ -410,6 +436,8 @@ map: PATH + YYABORT; + } + if (tmp) { ++ if (format) ++ free(format); + format = master_strdup(tmp); + if (!format) { + master_error("memory allocation error"); +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -489,8 +489,10 @@ void add_std_amd_vars(struct substvar *s + const struct substvar *v = macro_findvar(sv, "domain", 4); + if (v && *v->val) { + tmp = strdup(v->val); +- if (tmp) ++ if (tmp) { + macro_global_addvar("cluster", 7, tmp); ++ free(tmp); ++ } + } + } + +--- autofs-5.1.4.orig/lib/parse_subs.c ++++ autofs-5.1.4/lib/parse_subs.c +@@ -189,6 +189,7 @@ void free_selector(struct selector *sele + free(s->func.arg2); + s = next; + } ++ free(selector); + return; + } + +--- autofs-5.1.4.orig/lib/rpc_subs.c ++++ autofs-5.1.4/lib/rpc_subs.c +@@ -389,6 +389,7 @@ static enum clnt_stat rpc_get_netid(cons + } + + *netid = nc_netid; ++ break; + } + endnetconfig(handle); + free(nc_proto); +--- autofs-5.1.4.orig/modules/amd_parse.y ++++ autofs-5.1.4/modules/amd_parse.y +@@ -822,13 +822,13 @@ static int make_selector(char *name, + if (!value1) + tmp = NULL; + else { +- char *tmp = amd_strdup(value1); ++ tmp = amd_strdup(value1); + if (!tmp) + goto error; + } + s->func.arg1 = tmp; + } else if (s->sel->flags & SEL_FLAG_FUNC2) { +- char *tmp = amd_strdup(value1); ++ tmp = amd_strdup(value1); + if (!tmp) + goto error; + s->func.arg1 = tmp; +--- autofs-5.1.4.orig/modules/lookup_ldap.c ++++ autofs-5.1.4/modules/lookup_ldap.c +@@ -1137,6 +1137,7 @@ int parse_ldap_config(unsigned logopt, s + error(logopt, + MODPREFIX "stat(2) failed with error %s.", + strerror(errno)); ++ free(auth_conf); + return 0; + } + +@@ -1148,6 +1149,7 @@ int parse_ldap_config(unsigned logopt, s + "Please make sure that it is owned by root, group " + "is root, and the mode is 0600.", + auth_conf); ++ free(auth_conf); + return -1; + } + +@@ -1182,9 +1184,11 @@ int parse_ldap_config(unsigned logopt, s + goto out; + } + +- if (!usetls || ctxt->port == LDAPS_PORT) ++ if (!usetls || ctxt->port == LDAPS_PORT) { + use_tls = LDAP_TLS_DONT_USE; +- else { ++ if (usetls) ++ free(usetls); ++ } else { + if (!strcasecmp(usetls, "yes")) + use_tls = LDAP_TLS_INIT; + else if (!strcasecmp(usetls, "no")) +@@ -1194,6 +1198,7 @@ int parse_ldap_config(unsigned logopt, s + MODPREFIX + "The usetls property must have value " + "\"yes\" or \"no\"."); ++ free(usetls); + ret = -1; + goto out; + } +@@ -1221,6 +1226,7 @@ int parse_ldap_config(unsigned logopt, s + MODPREFIX + "The tlsrequired property must have value " + "\"yes\" or \"no\"."); ++ free(tlsrequired); + ret = -1; + goto out; + } +@@ -1252,6 +1258,7 @@ int parse_ldap_config(unsigned logopt, s + MODPREFIX + "The authrequired property must have value " + "\"yes\", \"no\", \"autodetect\", or \"simple\"."); ++ free(authrequired); + ret = -1; + goto out; + } +@@ -1338,6 +1345,7 @@ auth_fail: + (void)get_property(logopt, root, "credentialcache", &client_cc); + + ctxt->auth_conf = auth_conf; ++ auth_conf = NULL; + ctxt->use_tls = use_tls; + ctxt->tls_required = tls_required; + ctxt->auth_required = auth_required; +@@ -1375,8 +1383,12 @@ auth_fail: + user, secret ? "specified" : "unspecified", + client_princ, client_cc); + } ++ if (authtype) ++ free(authtype); + out: + xmlFreeDoc(doc); ++ if (auth_conf) ++ free(auth_conf); + + if (fallback) + return 0; +@@ -1986,7 +1998,7 @@ int lookup_read_master(struct master *ma + } + } else if (count == 1) { + dec_len = decode_percent_hack(keyValue[0], &key); +- if (dec_len < 0) { ++ if (dec_len <= 0) { + error(logopt, MODPREFIX + "invalid map key %s - ignoring", + *keyValue); +@@ -1994,7 +2006,7 @@ int lookup_read_master(struct master *ma + } + } else { + dec_len = decode_percent_hack(keyValue[0], &key); +- if (dec_len < 0) { ++ if (dec_len <= 0) { + error(logopt, MODPREFIX + "invalid map key %s - ignoring", + *keyValue); +@@ -2004,7 +2016,7 @@ int lookup_read_master(struct master *ma + for (i = 1; i < count; i++) { + char *k; + dec_len = decode_percent_hack(keyValue[i], &k); +- if (dec_len < 0) { ++ if (dec_len <= 0) { + error(logopt, MODPREFIX + "invalid map key %s - ignoring", + *keyValue); +@@ -2159,6 +2171,8 @@ static int decode_percent_hack(const cha + *key = NULL; + + len = get_percent_decoded_len(name); ++ if (!len) ++ return 0; + new = malloc(len + 1); + if (!new) + return -1; +@@ -2998,6 +3012,9 @@ static int lookup_one(struct autofs_poin + attrs[1] = info; + attrs[2] = NULL; + ++ enc_key1 = NULL; ++ enc_key2 = NULL; ++ + if (*qKey == '*' && qKey_len == 1) + *qKey = '/'; + else if (!strcasecmp(class, "nisObject")) { +--- autofs-5.1.4.orig/modules/parse_amd.c ++++ autofs-5.1.4/modules/parse_amd.c +@@ -1879,7 +1879,7 @@ struct amd_entry *make_default_entry(str + */ + map_type = conf_amd_get_map_type(ap->path); + if (map_type) +- defaults_entry->map_type = strdup(map_type); ++ defaults_entry->map_type = map_type; + /* The list should now be empty .... */ + free_amd_entry_list(&dflts); + return defaults_entry; +@@ -2006,7 +2006,7 @@ static struct amd_entry *get_defaults_en + */ + char *map_type = conf_amd_get_map_type(ap->path); + if (map_type) +- entry->map_type = strdup(map_type); ++ entry->map_type = map_type; + } + free(expand); + } +--- autofs-5.1.4.orig/modules/parse_sun.c ++++ autofs-5.1.4/modules/parse_sun.c +@@ -443,8 +443,10 @@ int parse_reinit(int argc, const char *c + + *new = default_context; + +- if (do_init(argc, argv, new)) ++ if (do_init(argc, argv, new)) { ++ free(new); + return 1; ++ } + + kill_context(ctxt); + +@@ -1143,6 +1145,9 @@ static int mount_subtree(struct autofs_p + const char *root; + int ro_len; + ++ myoptions = NULL; ++ ro_loc = NULL; ++ + rv = parse_mapent(ro->mapent, + options, &myoptions, &ro_loc, ap->logopt); + if (!rv) { +@@ -1524,6 +1529,9 @@ dont_expand: + p += l; + p = skipspace(p); + ++ myoptions = NULL; ++ loc = NULL; ++ + l = parse_mapent(p, options, &myoptions, &loc, ap->logopt); + if (!l) { + cache_delete_offset_list(mc, name); +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -26,6 +26,7 @@ xx/xx/2018 autofs-5.1.5 + - fix NFS version mask usage. + - fix fd leak in rpc_do_create_client(). + - add-man page note about extra slashes in paths. ++- covarity fixes. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. diff --git a/SOURCES/autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch b/SOURCES/autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch new file mode 100644 index 0000000..456dc80 --- /dev/null +++ b/SOURCES/autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch @@ -0,0 +1,48 @@ +autofs-5.1.4 - dont allow trailing slash in master map mount points + +From: Ian Kent + +If a master map mount point path has a trailing '/' this can cause +problems so remove them at parse time. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/master_parse.y | 5 +++++ + 2 files changed, 6 insertions(+) + +diff --git a/CHANGELOG b/CHANGELOG +index 1e5ec15b..a7bb89dc 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -12,6 +12,7 @@ xx/xx/2018 autofs-5.1.5 + - use_hostname_for_mounts shouldn't prevent selection among replicas. + - fix monotonic_elapsed. + - Makefiles.rules: remove 'samples' from SUBDIRS. ++- dont allow trailing slash in master map mount points. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/lib/master_parse.y b/lib/master_parse.y +index 42e03c2d..761ade9b 100644 +--- a/lib/master_parse.y ++++ b/lib/master_parse.y +@@ -749,6 +749,7 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne + struct map_source *source; + unsigned int logopt = logging; + unsigned int m_logopt = master->logopt; ++ size_t mp_len; + int ret; + + local_init_vars(); +@@ -763,6 +764,10 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne + return 0; + } + ++ mp_len = strlen(path); ++ while (mp_len && path[--mp_len] == '/') ++ path[mp_len] = 0; ++ + nc = master->nc; + + /* Add null map entries to the null map cache */ diff --git a/SOURCES/autofs-5.1.4-dont-use-array-for-path-when-not-neccessary.patch b/SOURCES/autofs-5.1.4-dont-use-array-for-path-when-not-neccessary.patch new file mode 100644 index 0000000..b95f0ea --- /dev/null +++ b/SOURCES/autofs-5.1.4-dont-use-array-for-path-when-not-neccessary.patch @@ -0,0 +1,56 @@ +autofs-5.1.4 - dont use array for path when not necessary + +From: Ian Kent + +In parse_amd.c:do_link_mount() a character array is used to construct +a path when a pointer to the relevant amd entry field is sufficient. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/parse_amd.c | 6 +++--- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 0f30596f..13f01397 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -3,6 +3,7 @@ xx/xx/2018 autofs-5.1.5 + - fix directory create permission. + - fix use after free in do_master_list_reset(). + - fix deadlock in dumpmaps. ++- dont use array for path when not necessary. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/modules/parse_amd.c b/modules/parse_amd.c +index c4b3ef0b..2cce5417 100644 +--- a/modules/parse_amd.c ++++ b/modules/parse_amd.c +@@ -967,8 +967,8 @@ static int do_auto_mount(struct autofs_point *ap, const char *name, + static int do_link_mount(struct autofs_point *ap, const char *name, + struct amd_entry *entry, unsigned int flags) + { +- char target[PATH_MAX + 1]; + const char *opts = (entry->opts && *entry->opts) ? entry->opts : NULL; ++ char *target; + int ret; + + if (entry->sublink) { +@@ -977,14 +977,14 @@ static int do_link_mount(struct autofs_point *ap, const char *name, + "error: sublink option length is too long"); + return 0; + } +- strcpy(target, entry->sublink); ++ target = entry->sublink; + } else { + if (strlen(entry->fs) > PATH_MAX) { + error(ap->logopt, MODPREFIX + "error: fs option length is too long"); + return 0; + } +- strcpy(target, entry->fs); ++ target = entry->fs; + } + + if (!(flags & CONF_AUTOFS_USE_LOFS)) diff --git a/SOURCES/autofs-5.1.4-fix-NFS-version-mask-usage.patch b/SOURCES/autofs-5.1.4-fix-NFS-version-mask-usage.patch new file mode 100644 index 0000000..6e25027 --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-NFS-version-mask-usage.patch @@ -0,0 +1,69 @@ +autofs-5.1.4 - fix NFS version mask usage + +From: Ian Kent + +Upstream commit a8af65195 changed NFS_VERS_MASK to exclude NFSv2 +so NFSv2 would be excluded in the default availability probe. + +But NFS_VERS_MASK is used like a mask elsewhere and causes NFSv2 +to be cleared for the availability probe even when it is requested. + +So add a macro to NFS_VERS_DEFAULT (and accompanying macros) to be +used to set initial defaults and restore NFS_VERS_MASK to what it +should be when used as a mask. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/replicated.h | 5 ++++- + modules/mount_nfs.c | 6 +++--- + 3 files changed, 8 insertions(+), 4 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -23,6 +23,7 @@ xx/xx/2018 autofs-5.1.5 + - tiny patch for autofs typo and possible bug. + - add units After line to include statd service. + - use systemd sd_notify() at startup. ++- fix NFS version mask usage. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/include/replicated.h ++++ autofs-5.1.4/include/replicated.h +@@ -26,7 +26,9 @@ + #define NFS2_SUPPORTED 0x0010 + #define NFS3_SUPPORTED 0x0020 + #define NFS4_SUPPORTED 0x0040 +-#define NFS_VERS_MASK (NFS3_SUPPORTED) ++#define NFS_VERS_DEFAULT (NFS3_SUPPORTED) ++#define NFS_VERS_MASK (NFS2_SUPPORTED|NFS3_SUPPORTED) ++#define NFS4_VERS_DEFAULT (NFS4_SUPPORTED) + #define NFS4_VERS_MASK (NFS4_SUPPORTED) + + #define NFS2_REQUESTED NFS2_SUPPORTED +@@ -39,6 +41,7 @@ + #define UDP_REQUESTED UDP_SUPPORTED + #define TCP6_REQUESTED 0x0100 + #define UDP6_REQUESTED 0x0200 ++#define NFS_PROTO_DEFAULT (TCP_SUPPORTED|UDP_SUPPORTED) + #define NFS_PROTO_MASK (TCP_SUPPORTED|UDP_SUPPORTED) + + #define NFS2_TCP_SUPPORTED NFS2_SUPPORTED +--- autofs-5.1.4.orig/modules/mount_nfs.c ++++ autofs-5.1.4/modules/mount_nfs.c +@@ -86,11 +86,11 @@ int mount_mount(struct autofs_point *ap, + root, name, what, fstype, options); + + mount_default_proto = defaults_get_mount_nfs_default_proto(); +- vers = NFS_VERS_MASK | NFS_PROTO_MASK; ++ vers = NFS_VERS_DEFAULT | NFS_PROTO_DEFAULT; + if (strcmp(fstype, "nfs4") == 0) +- vers = NFS4_VERS_MASK | TCP_SUPPORTED; ++ vers = NFS4_VERS_DEFAULT | TCP_SUPPORTED; + else if (mount_default_proto == 4) +- vers = vers | NFS4_VERS_MASK; ++ vers = vers | NFS4_VERS_DEFAULT; + + /* Extract "nosymlink" pseudo-option which stops local filesystems + * from being symlinked. diff --git a/SOURCES/autofs-5.1.4-fix-age-setting-at-startup.patch b/SOURCES/autofs-5.1.4-fix-age-setting-at-startup.patch new file mode 100644 index 0000000..84e1f2b --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-age-setting-at-startup.patch @@ -0,0 +1,42 @@ +autofs-5.1.4 - fix age setting at startup + +From: Ian Kent + +Commit 2b567ace7d, which resets the master map list on startup +before retrying a read, incorrectly sets age using time() when +it should use monotonic_time(). + +This causes lookup failures for submounts in cases where a master +map read retry was needed. + +The failure happens because the mount entry age is greater than +the map entry age which is meant to indicate the map is no longer +valid which is not the case. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -32,6 +32,7 @@ xx/xx/2018 autofs-5.1.5 + - mark removed cache entry negative. + - set bind mount as propagation slave. + - add master map pseudo options for mount propagation. ++- fix age setting at startup. + + 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 +@@ -2610,7 +2610,7 @@ int main(int argc, char *argv[]) + * we have anyway. + */ + do_master_list_reset(master_list); +- age = time(NULL); ++ age = monotonic_time(NULL); + master_read_master(master_list, age, 1); + } + } diff --git a/SOURCES/autofs-5.1.4-fix-amd-parser-opts-option-handling.patch b/SOURCES/autofs-5.1.4-fix-amd-parser-opts-option-handling.patch new file mode 100644 index 0000000..ffd1b1d --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-amd-parser-opts-option-handling.patch @@ -0,0 +1,66 @@ +autofs-5.1.4 - fix amd parser opts option handling + +From: Ian Kent + +The recent implementation of the amd map program mount feature +introduced a regression in the amd parser where only the first +option of a comma separated list of is applied to a mount entry. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/amd_parse.y | 4 ++-- + modules/parse_amd.c | 4 +++- + 3 files changed, 6 insertions(+), 3 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -35,6 +35,7 @@ xx/xx/2018 autofs-5.1.5 + - fix age setting at startup. + - fix use after free in parse_ldap_config(). + - fix incorrect locking in sss lookup. ++- fix amd parser opts option handling. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/modules/amd_parse.y ++++ autofs-5.1.4/modules/amd_parse.y +@@ -401,7 +401,7 @@ option_assignment: MAP_OPTION OPTION_ASS + } + | MNT_OPTION OPTION_ASSIGN options + { +- if (!match_mnt_option_options($1, $3)) { ++ if (!match_mnt_option_options($1, opts)) { + amd_notify($1); + YYABORT; + } +@@ -409,7 +409,7 @@ option_assignment: MAP_OPTION OPTION_ASS + } + | MNT_OPTION OPTION_ASSIGN QUOTE options QUOTE + { +- if (!match_mnt_option_options($1, $4)) { ++ if (!match_mnt_option_options($1, opts)) { + amd_notify($1); + YYABORT; + } +--- autofs-5.1.4.orig/modules/parse_amd.c ++++ autofs-5.1.4/modules/parse_amd.c +@@ -2136,6 +2136,7 @@ int parse_mount(struct autofs_point *ap, + list_del_init(&this->list); + cur_defaults = this; + update_with_defaults(defaults_entry, cur_defaults, sv); ++ debug(ap->logopt, "merged /defaults entry with defaults"); + continue; + } else if (this->flags & AMD_DEFAULTS_RESET) { + struct amd_entry *nd, *new; +@@ -2174,8 +2175,9 @@ int parse_mount(struct autofs_point *ap, + + at_least_one = 1; + +- debug(ap->logopt, "expand mount entry"); ++ debug(ap->logopt, "update mount entry with defaults"); + update_with_defaults(cur_defaults, this, sv); ++ debug(ap->logopt, "expand mount entry"); + sv = expand_entry(ap, this, flags, sv); + sv = merge_entry_options(ap, this, sv); + normalize_sublink(ap->logopt, this, sv); diff --git a/SOURCES/autofs-5.1.4-fix-deadlock-in-dumpmaps.patch b/SOURCES/autofs-5.1.4-fix-deadlock-in-dumpmaps.patch new file mode 100644 index 0000000..12bd077 --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-deadlock-in-dumpmaps.patch @@ -0,0 +1,40 @@ +autofs-5.1.4 - fix deadlock in dumpmaps + +From: Ian Kent + +Commit a223d11fa8e (autofs-5.1.3 - serialize calls to open_xxxx() +functions) introduces a deadlock when using the dumpmaps function. + +In this case the open fd mutex needs to be unlocked in the forked +child process of the do_spawn() function. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/spawn.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/CHANGELOG b/CHANGELOG +index 2747327b..0f30596f 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -2,6 +2,7 @@ xx/xx/2018 autofs-5.1.5 + - fix flag file permission. + - fix directory create permission. + - fix use after free in do_master_list_reset(). ++- fix deadlock in dumpmaps. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/daemon/spawn.c b/daemon/spawn.c +index fabe577e..dbbca7fa 100644 +--- a/daemon/spawn.c ++++ b/daemon/spawn.c +@@ -338,6 +338,7 @@ static int do_spawn(unsigned logopt, unsigned int wait, + dup2(pipefd[1], STDOUT_FILENO); + dup2(pipefd[1], STDERR_FILENO); + close(pipefd[1]); ++ open_mutex_unlock(); + + /* what to mount must always be second last */ + while (*pargv++) diff --git a/SOURCES/autofs-5.1.4-fix-directory-create-permission.patch b/SOURCES/autofs-5.1.4-fix-directory-create-permission.patch new file mode 100644 index 0000000..9723031 --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-directory-create-permission.patch @@ -0,0 +1,207 @@ +autofs-5.1.4 - fix directory create permission + +From: Ian Kent + +autofs mount point directory creation is done using a permission of +0555. + +But it is necessary to create directories within autofs mount points +for some map entry types so write access should be set for the owner +on mount point directories. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 2 ++ + daemon/direct.c | 4 ++-- + daemon/indirect.c | 2 +- + daemon/lookup.c | 2 +- + include/automount.h | 1 + + modules/mount_bind.c | 6 +++--- + modules/mount_changer.c | 2 +- + modules/mount_ext2.c | 2 +- + modules/mount_generic.c | 2 +- + modules/mount_nfs.c | 2 +- + modules/parse_amd.c | 2 +- + 12 files changed, 16 insertions(+), 12 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index d07d88ce..4faab510 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,5 +1,6 @@ + xx/xx/2018 autofs-5.1.5 + - fix flag file permission. ++- fix directory create permission. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/daemon/automount.c b/daemon/automount.c +index 5c739617..dcdc19fb 100644 +--- a/daemon/automount.c ++++ b/daemon/automount.c +@@ -51,6 +51,8 @@ const char *libdir = AUTOFS_LIB_DIR; /* Location of library modules */ + const char *mapdir = AUTOFS_MAP_DIR; /* Location of mount maps */ + const char *confdir = AUTOFS_CONF_DIR; /* Location of autofs config file */ + ++unsigned int mp_mode = 0755; ++ + unsigned int nfs_mount_uses_string_options = 0; + static struct nfs_mount_vers vers, check = {1, 1, 1}; + +diff --git a/daemon/direct.c b/daemon/direct.c +index 9a134351..3fdecdb8 100644 +--- a/daemon/direct.c ++++ b/daemon/direct.c +@@ -424,7 +424,7 @@ int do_mount_autofs_direct(struct autofs_point *ap, + } + + /* In case the directory doesn't exist, try to mkdir it */ +- if (mkdir_path(me->key, 0555) < 0) { ++ if (mkdir_path(me->key, mp_mode) < 0) { + if (errno != EEXIST && errno != EROFS) { + crit(ap->logopt, + "failed to create mount directory %s", me->key); +@@ -739,7 +739,7 @@ int mount_autofs_offset(struct autofs_point *ap, struct mapent *me, const char * + strcat(mountpoint, offset); + + /* In case the directory doesn't exist, try to mkdir it */ +- if (mkdir_path(mountpoint, 0555) < 0) { ++ if (mkdir_path(mountpoint, mp_mode) < 0) { + if (errno == EEXIST) { + /* + * If the mount point directory is a real mount +diff --git a/daemon/indirect.c b/daemon/indirect.c +index ffb11b8c..03c081ed 100644 +--- a/daemon/indirect.c ++++ b/daemon/indirect.c +@@ -133,7 +133,7 @@ static int do_mount_autofs_indirect(struct autofs_point *ap, const char *root) + } + + /* In case the directory doesn't exist, try to mkdir it */ +- if (mkdir_path(root, 0555) < 0) { ++ if (mkdir_path(root, mp_mode) < 0) { + if (errno != EEXIST && errno != EROFS) { + crit(ap->logopt, + "failed to create autofs directory %s", +diff --git a/daemon/lookup.c b/daemon/lookup.c +index cb67e7d9..6a722b3b 100644 +--- a/daemon/lookup.c ++++ b/daemon/lookup.c +@@ -802,7 +802,7 @@ int lookup_ghost(struct autofs_point *ap, const char *root) + goto next; + } + +- ret = mkdir_path(fullpath, 0555); ++ ret = mkdir_path(fullpath, mp_mode); + if (ret < 0 && errno != EEXIST) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + warn(ap->logopt, +diff --git a/include/automount.h b/include/automount.h +index 2e2c2b02..e5c19d23 100644 +--- a/include/automount.h ++++ b/include/automount.h +@@ -269,6 +269,7 @@ void reset_signals(void); + int do_mount(struct autofs_point *ap, const char *root, const char *name, + int name_len, const char *what, const char *fstype, + const char *options); ++extern unsigned int mp_mode; + int mkdir_path(const char *path, mode_t mode); + int rmdir_path(struct autofs_point *ap, const char *path, dev_t dev); + +diff --git a/modules/mount_bind.c b/modules/mount_bind.c +index 4864ea51..5effa880 100644 +--- a/modules/mount_bind.c ++++ b/modules/mount_bind.c +@@ -151,7 +151,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + + debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); + +- status = mkdir_path(fullpath, 0555); ++ status = mkdir_path(fullpath, mp_mode); + if (status && errno != EEXIST) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, +@@ -203,7 +203,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + } else { + debug(ap->logopt, + MODPREFIX "calling mkdir_path %s", basepath); +- if (mkdir_path(basepath, 0555) && errno != EEXIST) { ++ if (mkdir_path(basepath, mp_mode) && errno != EEXIST) { + char *estr; + estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, +@@ -219,7 +219,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + "failed to create symlink %s -> %s", + fullpath, what); + if ((ap->flags & MOUNT_FLAG_GHOST) && !status) { +- if (mkdir_path(fullpath, 0555) && errno != EEXIST) { ++ if (mkdir_path(fullpath, mp_mode) && errno != EEXIST) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, + MODPREFIX "mkdir_path %s failed: %s", +diff --git a/modules/mount_changer.c b/modules/mount_changer.c +index 798f23b2..7d44a720 100644 +--- a/modules/mount_changer.c ++++ b/modules/mount_changer.c +@@ -87,7 +87,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + + debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); + +- status = mkdir_path(fullpath, 0555); ++ status = mkdir_path(fullpath, mp_mode); + if (status && errno != EEXIST) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, +diff --git a/modules/mount_ext2.c b/modules/mount_ext2.c +index 90fc0876..3bbea95a 100644 +--- a/modules/mount_ext2.c ++++ b/modules/mount_ext2.c +@@ -69,7 +69,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + + debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); + +- status = mkdir_path(fullpath, 0555); ++ status = mkdir_path(fullpath, mp_mode); + if (status && errno != EEXIST) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, +diff --git a/modules/mount_generic.c b/modules/mount_generic.c +index ae637875..b1a3adbf 100644 +--- a/modules/mount_generic.c ++++ b/modules/mount_generic.c +@@ -68,7 +68,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + + debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); + +- status = mkdir_path(fullpath, 0555); ++ status = mkdir_path(fullpath, mp_mode); + if (status && errno != EEXIST) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, +diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c +index bf712a93..77166544 100644 +--- a/modules/mount_nfs.c ++++ b/modules/mount_nfs.c +@@ -277,7 +277,7 @@ dont_probe: + + debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); + +- status = mkdir_path(fullpath, 0555); ++ status = mkdir_path(fullpath, mp_mode); + if (status && errno != EEXIST) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, +diff --git a/modules/parse_amd.c b/modules/parse_amd.c +index b40c1ad1..c4b3ef0b 100644 +--- a/modules/parse_amd.c ++++ b/modules/parse_amd.c +@@ -1288,7 +1288,7 @@ static int do_program_mount(struct autofs_point *ap, + rv = 0; + ext_mount_add(&entry->ext_mount, entry->fs, 1); + } else { +- rv = mkdir_path(entry->fs, 0555); ++ rv = mkdir_path(entry->fs, mp_mode); + if (rv && errno != EEXIST) { + char buf[MAX_ERR_BUF]; + char *estr; diff --git a/SOURCES/autofs-5.1.4-fix-error-return-in-do_nfs_mount.patch b/SOURCES/autofs-5.1.4-fix-error-return-in-do_nfs_mount.patch new file mode 100644 index 0000000..80d0a87 --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-error-return-in-do_nfs_mount.patch @@ -0,0 +1,35 @@ +autofs-5.1.4 - fix error return in do_nfs_mount() + +From: Ian Kent + +Fix incorrect error return in modules/parse_amd.c:do_nfs_mount(). +--- + CHANGELOG | 1 + + modules/parse_amd.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 756ef927..d0cfa19b 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -6,6 +6,7 @@ xx/xx/2018 autofs-5.1.5 + - dont use array for path when not necessary. + - fix prefix option handling in expand_entry(). + - fix sublink option not set from defaults. ++- fix error return in do_nfs_mount(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/modules/parse_amd.c b/modules/parse_amd.c +index 1c962fff..2a5d9a30 100644 +--- a/modules/parse_amd.c ++++ b/modules/parse_amd.c +@@ -1099,7 +1099,7 @@ static int do_nfs_mount(struct autofs_point *ap, const char *name, + if (strlen(entry->rhost) + strlen(entry->rfs) + 1 > PATH_MAX) { + error(ap->logopt, MODPREFIX + "error: rhost + rfs options length is too long"); +- return 0; ++ return 1; + } + + strcpy(target, entry->rhost); diff --git a/SOURCES/autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch b/SOURCES/autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch new file mode 100644 index 0000000..5a69084 --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch @@ -0,0 +1,46 @@ +autofs-5.1.4 - fix fd leak in rpc_do_create_client() + +From: Ian Kent + +Commit 94f87e203a (fix create_client() RPC client handling) fixed +possible use of an invalid RPC client handle but the change neglected +to account for a check in rpc_do_create_client() that would open a new +file descriptor without checking if the passed in descriptor was +already opened. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/rpc_subs.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -24,6 +24,7 @@ xx/xx/2018 autofs-5.1.5 + - add units After line to include statd service. + - use systemd sd_notify() at startup. + - fix NFS version mask usage. ++- fix fd leak in rpc_do_create_client(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/rpc_subs.c ++++ autofs-5.1.4/lib/rpc_subs.c +@@ -183,7 +183,7 @@ static int rpc_do_create_client(struct s + in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY); + slen = sizeof(struct sockaddr_in); + +- if (!info->client) { ++ if (!info->client && *fd == RPC_ANYSOCK) { + struct sockaddr *laddr; + + *fd = open_sock(addr->sa_family, type, proto); +@@ -296,7 +296,7 @@ static int rpc_do_create_client(struct s + * it would bind to a reserved port, which has been shown to + * exhaust the reserved port range in some situations. + */ +- if (!info->client) { ++ if (!info->client && *fd == RPC_ANYSOCK) { + *fd = open_sock(addr->sa_family, type, proto); + if (*fd < 0) { + ret = -errno; diff --git a/SOURCES/autofs-5.1.4-fix-flag-file-permission.patch b/SOURCES/autofs-5.1.4-fix-flag-file-permission.patch new file mode 100644 index 0000000..c2f8fdb --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-flag-file-permission.patch @@ -0,0 +1,41 @@ +autofs-5.1.4 - fix flag file permission + +From: Ian Kent + +The flag file used to check if automount(8) is running was being +created with mode 0 which caused unnecessary dac_override AVC +failures. + +There's no reason to protect this file so just use 0644 as the +file permission. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 3 +++ + daemon/flag.c | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 246279ae..d07d88ce 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,3 +1,6 @@ ++xx/xx/2018 autofs-5.1.5 ++- fix flag file permission. ++ + 19/12/2017 autofs-5.1.4 + - fix spec file url. + - fix unset tsd group name handling. +diff --git a/daemon/flag.c b/daemon/flag.c +index 99f26847..ff9858c8 100644 +--- a/daemon/flag.c ++++ b/daemon/flag.c +@@ -164,7 +164,7 @@ int aquire_flag_file(void) + while (!we_created_flagfile) { + int errsv, i, j; + +- i = open_fd_mode(linkf, O_WRONLY|O_CREAT, 0); ++ i = open_fd_mode(linkf, O_WRONLY|O_CREAT, 0644); + if (i < 0) { + release_flag_file(); + return 0; diff --git a/SOURCES/autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch b/SOURCES/autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch new file mode 100644 index 0000000..5917b5e --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch @@ -0,0 +1,40 @@ +autofs-5.1.4 - fix incorrect locking in sss lookup + +From: Ian Kent + +Commit 766e0f6c4, autofs-5.0.7 - fix fix wildcard multi map regression, +introduced a deadlock during restart when the sss modules is used. + +Looking at the comment above the code which takes the lock it clearly +does this incorrectly. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/lookup_sss.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -34,6 +34,7 @@ xx/xx/2018 autofs-5.1.5 + - add master map pseudo options for mount propagation. + - fix age setting at startup. + - fix use after free in parse_ldap_config(). ++- fix incorrect locking in sss lookup. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/modules/lookup_sss.c ++++ autofs-5.1.4/modules/lookup_sss.c +@@ -786,9 +786,9 @@ int lookup_mount(struct autofs_point *ap + * when we're starting up so just take the readlock in that + */ + if (ap->flags & MOUNT_FLAG_REMOUNT) +- cache_writelock(mc); +- else + cache_readlock(mc); ++ else ++ cache_writelock(mc); + me = cache_lookup(mc, key); + /* Stale mapent => check for entry in alternate source or wildcard */ + if (me && !me->mapent) { diff --git a/SOURCES/autofs-5.1.4-fix-libresolv-configure-check.patch b/SOURCES/autofs-5.1.4-fix-libresolv-configure-check.patch new file mode 100644 index 0000000..f6a9bb3 --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-libresolv-configure-check.patch @@ -0,0 +1,94 @@ +autofs-5.1.4 - fix libresolv configure check + +From: Ian Kent + +The libresolv functions are not found by AC_CHECK_LIB() unless +they are prefixed with "__". + +So change the library check to also look for __ during +the check. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + configure | 41 +++++++++++++++++++++++++++++++++++++++++ + configure.in | 2 +- + 3 files changed, 43 insertions(+), 1 deletion(-) + +diff --git a/CHANGELOG b/CHANGELOG +index a7bb89dc..dbfb8389 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -13,6 +13,7 @@ xx/xx/2018 autofs-5.1.5 + - fix monotonic_elapsed. + - Makefiles.rules: remove 'samples' from SUBDIRS. + - dont allow trailing slash in master map mount points. ++- fix libresolv configure check. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/configure b/configure +index 2d517aac..5c8aae30 100755 +--- a/configure ++++ b/configure +@@ -4821,6 +4821,47 @@ fi + $as_echo "$ac_cv_lib_resolv_res_query" >&6; } + if test "x$ac_cv_lib_resolv_res_query" = xyes; then : + LIBRESOLV="-lresolv" ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __res_query in -lresolv" >&5 ++$as_echo_n "checking for __res_query in -lresolv... " >&6; } ++if ${ac_cv_lib_resolv___res_query+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lresolv $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char __res_query (); ++int ++main () ++{ ++return __res_query (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_resolv___res_query=yes ++else ++ ac_cv_lib_resolv___res_query=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv___res_query" >&5 ++$as_echo "$ac_cv_lib_resolv___res_query" >&6; } ++if test "x$ac_cv_lib_resolv___res_query" = xyes; then : ++ LIBRESOLV="-lresolv" ++fi ++ + fi + + +diff --git a/configure.in b/configure.in +index d74775cc..4d1208f5 100644 +--- a/configure.in ++++ b/configure.in +@@ -217,7 +217,7 @@ AC_SUBST(NSL_LIBS) + NSL_CFLAGS="" + ]) + +-AC_CHECK_LIB(resolv, res_query, LIBRESOLV="-lresolv") ++AC_CHECK_LIB(resolv, res_query, LIBRESOLV="-lresolv", AC_CHECK_LIB(resolv, __res_query, LIBRESOLV="-lresolv")) + AC_SUBST(LIBRESOLV) + + # diff --git a/SOURCES/autofs-5.1.4-fix-monotonic_elapsed.patch b/SOURCES/autofs-5.1.4-fix-monotonic_elapsed.patch new file mode 100644 index 0000000..17c5a6e --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-monotonic_elapsed.patch @@ -0,0 +1,49 @@ +autofs-5.1.4 - fix monotonic_elapsed + +From: NeilBrown + +When automount probes multiple hosts to find the one which +responds most quickly, it currently ignores the nanoseconds. +This often makes the cost "0", which makes weights ineffective. + +The cause is that monotonic_elapsed() casts tv_nsec to a +double *after* dividing by 1 billion, rather than before. + +With this change, weights become effective for choosing +between hosts which respond in under one second. + +Signed-off-by: NeilBrown +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/rpc_subs.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 104fca90..313730b1 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -10,6 +10,7 @@ xx/xx/2018 autofs-5.1.5 + - add error handling for ext_mount_add(). + - account for recent libnsl changes. + - use_hostname_for_mounts shouldn't prevent selection among replicas. ++- fix monotonic_elapsed. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c +index 73097c9d..60ede9f8 100644 +--- a/lib/rpc_subs.c ++++ b/lib/rpc_subs.c +@@ -1093,9 +1093,9 @@ double monotonic_elapsed(struct timespec start, struct timespec end) + double t1, t2; + + t1 = (double) start.tv_sec + +- (double) (start.tv_nsec/(1000*1000*1000)); ++ ((double) start.tv_nsec/(1000*1000*1000)); + t2 = (double) end.tv_sec + +- (double) (end.tv_nsec/(1000*1000*1000)); ++ ((double) end.tv_nsec/(1000*1000*1000)); + return t2 - t1; + } + diff --git a/SOURCES/autofs-5.1.4-fix-prefix-option-handling-in-expand_entry.patch b/SOURCES/autofs-5.1.4-fix-prefix-option-handling-in-expand_entry.patch new file mode 100644 index 0000000..4e3996b --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-prefix-option-handling-in-expand_entry.patch @@ -0,0 +1,55 @@ +autofs-5.1.4 - fix prefix option handling in expand_entry() + +From: Ian Kent + +The changes to fix the defaults handling in the amd map parser caused +the prefix option to not be expanded and also to not be propagated to +submounts in some cases. + +But the prefix should be expanded in modules/parse_amd.c:expand_entry() +along with the reset of the amd map entry fields. + +Just adding this to modules/parse_amd.c:expand_entry() (where it should +be) fixes the amd map entry expansion and also fixes the propagation +of the prefix to submounts. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/parse_amd.c | 11 +++++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/CHANGELOG b/CHANGELOG +index 13f01397..19aec2ae 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -4,6 +4,7 @@ xx/xx/2018 autofs-5.1.5 + - fix use after free in do_master_list_reset(). + - fix deadlock in dumpmaps. + - dont use array for path when not necessary. ++- fix prefix option handling in expand_entry(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/modules/parse_amd.c b/modules/parse_amd.c +index 2cce5417..1a5a2960 100644 +--- a/modules/parse_amd.c ++++ b/modules/parse_amd.c +@@ -725,6 +725,17 @@ static struct substvar *expand_entry(struct autofs_point *ap, + entry->rhost = host; + } + next: ++ if (entry->pref) { ++ if (expand_selectors(ap, entry->pref, &expand, sv)) { ++ debug(logopt, MODPREFIX ++ "pref expand(\"%s\") -> %s", ++ entry->pref, expand); ++ free(entry->pref); ++ entry->pref = expand; ++ } ++ sv = macro_addvar(sv, "pref", 4, entry->pref); ++ } ++ + if (entry->sublink) { + if (expand_selectors(ap, entry->sublink, &expand, sv)) { + debug(logopt, MODPREFIX diff --git a/SOURCES/autofs-5.1.4-fix-program-usage-message.patch b/SOURCES/autofs-5.1.4-fix-program-usage-message.patch new file mode 100644 index 0000000..052dbbd --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-program-usage-message.patch @@ -0,0 +1,40 @@ +autofs-5.1.4 - fix program usage message + +From: Ian Kent + +There is a discrepancy between the list of options in the usage +message of automount(8) and the options listed in the man page. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 6 +++++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -27,6 +27,7 @@ xx/xx/2018 autofs-5.1.5 + - fix fd leak in rpc_do_create_client(). + - add-man page note about extra slashes in paths. + - covarity fixes. ++- fix program usage message. + + 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 +@@ -1893,9 +1893,13 @@ static void usage(void) + " -h --help this text\n" + " -p --pid-file f write process id to file f\n" + " -t --timeout n auto-unmount in n seconds (0-disable)\n" ++ " -M --master-wait n\n" ++ " maximum wait time (seconds) for master\n" ++ " map to become available\n" + " -v --verbose be verbose\n" + " -d --debug log debuging info\n" +- " -D --define define global macro variable\n" ++ " -Dvariable=value, --define variable=value\n" ++ " define global macro variable\n" + " -f --foreground do not fork into background\n" + " -r --random-multimount-selection\n" + " use ramdom replicated server selection\n" diff --git a/SOURCES/autofs-5.1.4-fix-sublink-option-not-set-from-defaults.patch b/SOURCES/autofs-5.1.4-fix-sublink-option-not-set-from-defaults.patch new file mode 100644 index 0000000..cefb27c --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-sublink-option-not-set-from-defaults.patch @@ -0,0 +1,48 @@ +autofs-5.1.4 - fix sublink option not set from defaults + +From: Ian Kent + +If the amd entry sublink option is given in a defaults entry +it isn't merged into the current entry during parsing. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/parse_amd.c | 12 ++++++++++++ + 2 files changed, 13 insertions(+) + +diff --git a/CHANGELOG b/CHANGELOG +index 19aec2ae..756ef927 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -5,6 +5,7 @@ xx/xx/2018 autofs-5.1.5 + - fix deadlock in dumpmaps. + - dont use array for path when not necessary. + - fix prefix option handling in expand_entry(). ++- fix sublink option not set from defaults. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/modules/parse_amd.c b/modules/parse_amd.c +index 1a5a2960..1c962fff 100644 +--- a/modules/parse_amd.c ++++ b/modules/parse_amd.c +@@ -645,6 +645,18 @@ static void update_with_defaults(struct amd_entry *defaults, + } + } + ++ if (!entry->sublink) { ++ if (defaults->sublink) { ++ tmp = strdup(defaults->sublink); ++ if (tmp) ++ entry->sublink = tmp; ++ } else { ++ v = macro_findvar(sv, "sublink", 2); ++ if (v) ++ entry->sublink = strdup(v->val); ++ } ++ } ++ + return; + } + diff --git a/SOURCES/autofs-5.1.4-fix-update_negative_cache-map-source-usage.patch b/SOURCES/autofs-5.1.4-fix-update_negative_cache-map-source-usage.patch new file mode 100644 index 0000000..2a822f7 --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-update_negative_cache-map-source-usage.patch @@ -0,0 +1,98 @@ +autofs-5.1.4 - fix update_negative_cache() map source usage + +From: Ian Kent + +File map sources can be either plain text or executable. + +When the map path is specified without a type (eg. when a +full path is used) an instance map source is used and the +original map is left unchanged. + +But update_negative_cache() fails to take this into account +causing it to update the wrong map cache. + +When a map reload is done the map entry appears to not exist +so the new map entry is added. + +This could go unnoticed except that, after a map read, the +map entry cache cleans stale map entries and the existence +of this negative entry causes the new map entry to be deleted +and map lookups continue to fail. + +In hindsite the use of an instance map source for this is +probably uneccessary but changing it will be risky so, for +now, just make update_negative_cache() use the correct map. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/lookup.c | 38 ++++++++++++++++++++++++++++++++++++-- + 2 files changed, 37 insertions(+), 2 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -28,6 +28,7 @@ xx/xx/2018 autofs-5.1.5 + - add-man page note about extra slashes in paths. + - covarity fixes. + - fix program usage message. ++- fix update_negative_cache() map source usage. + + 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 +@@ -1100,6 +1100,37 @@ static enum nsswitch_status lookup_map_n + return result; + } + ++static struct map_source *lookup_get_map_source(struct master_mapent *entry) ++{ ++ struct map_source *map = entry->maps; ++ struct stat st; ++ char *type; ++ ++ if (map->type || *map->argv[0] != '/') ++ return map; ++ ++ if (*(map->argv[0] + 1) == '/') ++ return map; ++ ++ if (stat(map->argv[0], &st) == -1) ++ return NULL; ++ ++ if (!S_ISREG(st.st_mode)) ++ return NULL; ++ ++ if (st.st_mode & __S_IEXEC) ++ type = "program"; ++ else ++ type = "file"; ++ ++ /* This is a file source with a path starting with "/". ++ * But file maps can be either plain text or executable ++ * so they use a map instance and the actual map source ++ * remains untouched. ++ */ ++ return master_find_source_instance(map, type, map->format, 0, NULL); ++} ++ + static void update_negative_cache(struct autofs_point *ap, struct map_source *source, const char *name) + { + struct master_mapent *entry = ap->entry; +@@ -1133,11 +1164,14 @@ static void update_negative_cache(struct + logmsg("key \"%s\" not found in map source(s).", name); + } + +- /* Doesn't exist in any source, just add it somewhere */ ++ /* Doesn't exist in any source, just add it somewhere. ++ * Also take care to use the same map source used by ++ * map reads and key lookups for the update. ++ */ + if (source) + map = source; + else +- map = entry->maps; ++ map = lookup_get_map_source(entry); + if (map) { + time_t now = monotonic_time(NULL); + int rv = CHE_FAIL; diff --git a/SOURCES/autofs-5.1.4-fix-use-after-free-in-do_master_list_reset.patch b/SOURCES/autofs-5.1.4-fix-use-after-free-in-do_master_list_reset.patch new file mode 100644 index 0000000..ff12fd9 --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-use-after-free-in-do_master_list_reset.patch @@ -0,0 +1,55 @@ +autofs-5.1.4 - fix use after free in do_master_list_reset() + +From: Ian Kent + +Umm ... list_for_each() can't be used in do_master_list_reset() because +the subject entry of the loop is removed for the list within the loop +body. Therefore it can't be used to calculate the next pointer within a +for (...) loop. + +There is no list_for_each_safe() macro in the list.h of autofs so it +needs to be done manually. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 8 ++++++-- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 4faab510..2747327b 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,6 +1,7 @@ + xx/xx/2018 autofs-5.1.5 + - fix flag file permission. + - fix directory create permission. ++- fix use after free in do_master_list_reset(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/daemon/automount.c b/daemon/automount.c +index dcdc19fb..28b3f2f5 100644 +--- a/daemon/automount.c ++++ b/daemon/automount.c +@@ -2070,14 +2070,18 @@ static void remove_empty_args(char **argv, int *argc) + + static void do_master_list_reset(struct master *master) + { +- struct list_head *head, *p; ++ struct list_head *head, *p, *n; + + master_mutex_lock(); + + head = &master->mounts; +- list_for_each(p, head) { ++ n = head->next; ++ while (n != head) { + struct master_mapent *entry; + ++ p = n; ++ n = p->next; ++ + entry = list_entry(p, struct master_mapent, list); + + if (!list_empty(&entry->list)) diff --git a/SOURCES/autofs-5.1.4-fix-use-after-free-in-parse_ldap_config.patch b/SOURCES/autofs-5.1.4-fix-use-after-free-in-parse_ldap_config.patch new file mode 100644 index 0000000..806d0ab --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-use-after-free-in-parse_ldap_config.patch @@ -0,0 +1,34 @@ +autofs-5.1.4 - fix use after free in parse_ldap_config() + +From: Ian Kent + +Commit a4a2af5f30 (covarity fixes) incorrecly frees local variable +authtype after assigning it to a lookup context structure member. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/lookup_ldap.c | 2 -- + 2 files changed, 1 insertion(+), 2 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -33,6 +33,7 @@ xx/xx/2018 autofs-5.1.5 + - set bind mount as propagation slave. + - add master map pseudo options for mount propagation. + - fix age setting at startup. ++- fix use after free in parse_ldap_config(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/modules/lookup_ldap.c ++++ autofs-5.1.4/modules/lookup_ldap.c +@@ -1383,8 +1383,6 @@ auth_fail: + user, secret ? "specified" : "unspecified", + client_princ, client_cc); + } +- if (authtype) +- free(authtype); + out: + xmlFreeDoc(doc); + if (auth_conf) diff --git a/SOURCES/autofs-5.1.4-improve-hostname-lookup-error-logging.patch b/SOURCES/autofs-5.1.4-improve-hostname-lookup-error-logging.patch new file mode 100644 index 0000000..cfab93e --- /dev/null +++ b/SOURCES/autofs-5.1.4-improve-hostname-lookup-error-logging.patch @@ -0,0 +1,123 @@ +autofs-5.1.4 - improve hostname lookup error logging + +From: Ian Kent + +There's not enough information in name lookup log messages +to determine if the failed lookup is in fact a problem or +is expected. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/parse_subs.c | 3 ++- + lib/rpc_subs.c | 3 ++- + modules/dclist.c | 4 +++- + modules/parse_amd.c | 9 ++++++--- + modules/replicated.c | 5 +++-- + 6 files changed, 17 insertions(+), 8 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index f771a433..596590a8 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -19,6 +19,7 @@ xx/xx/2018 autofs-5.1.5 + - add fedfs-map-nfs4.c. + - add conditional inclusion of fedfs binaries. + - add an example fedfs master map entry to the installed master map. ++- improve hostname lookup error logging. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/lib/parse_subs.c b/lib/parse_subs.c +index db784a58..841e81fd 100644 +--- a/lib/parse_subs.c ++++ b/lib/parse_subs.c +@@ -476,7 +476,8 @@ unsigned int get_network_proximity(const char *name) + + ret = getaddrinfo(name_or_num, NULL, &hints, &ni); + if (ret) { +- logerr("getaddrinfo: %s", gai_strerror(ret)); ++ logerr("hostname lookup for %s failed: %s", ++ name_or_num, gai_strerror(ret)); + return PROXIMITY_ERROR; + } + +diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c +index 60ede9f8..cc83e84d 100644 +--- a/lib/rpc_subs.c ++++ b/lib/rpc_subs.c +@@ -693,7 +693,8 @@ static int create_client(struct conn_info *info, CLIENT **client) + ret = getaddrinfo(info->host, NULL, &hints, &ai); + if (ret) { + error(LOGOPT_ANY, +- "hostname lookup failed: %s", gai_strerror(ret)); ++ "hostname lookup for %s failed: %s", ++ info->host, gai_strerror(ret)); + goto out_close; + } + +diff --git a/modules/dclist.c b/modules/dclist.c +index 4daa199b..ba32134d 100644 +--- a/modules/dclist.c ++++ b/modules/dclist.c +@@ -357,7 +357,9 @@ static char *getdnsdomainname(unsigned int logopt) + + ret = getaddrinfo(name, NULL, &hints, &ni); + if (ret) { +- error(logopt, "hostname lookup failed: %s", gai_strerror(ret)); ++ error(logopt, ++ "hostname lookup for %s failed: %s", ++ name, gai_strerror(ret)); + return NULL; + } + +diff --git a/modules/parse_amd.c b/modules/parse_amd.c +index e7debc56..9543ced3 100644 +--- a/modules/parse_amd.c ++++ b/modules/parse_amd.c +@@ -260,7 +260,8 @@ static int match_my_name(unsigned int logopt, const char *name, struct substvar + ret = getaddrinfo(v->val, NULL, &hints, &cni); + if (ret) { + error(logopt, MODPREFIX +- "hostname lookup failed: %s\n", gai_strerror(ret)); ++ "hostname lookup for %s failed: %s\n", ++ v->val, gai_strerror(ret)); + goto out; + } + +@@ -270,7 +271,8 @@ static int match_my_name(unsigned int logopt, const char *name, struct substvar + ret = getaddrinfo(name, NULL, &hints, &ni); + if (ret) { + error(logopt, MODPREFIX +- "hostname lookup failed: %s\n", gai_strerror(ret)); ++ "hostname lookup for %s failed: %s\n", ++ name, gai_strerror(ret)); + freeaddrinfo(cni); + goto out; + } +@@ -678,7 +680,8 @@ static char *normalize_hostname(unsigned int logopt, const char *host, + ret = getaddrinfo(host, NULL, &hints, &ni); + if (ret) { + error(logopt, MODPREFIX +- "hostname lookup failed: %s", gai_strerror(ret)); ++ "hostname lookup for %s failed: %s", ++ host, gai_strerror(ret)); + return NULL; + } + name = strdup(ni->ai_canonname); +diff --git a/modules/replicated.c b/modules/replicated.c +index f7b83236..740270ec 100644 +--- a/modules/replicated.c ++++ b/modules/replicated.c +@@ -1007,8 +1007,9 @@ try_name: + + ret = getaddrinfo(name, NULL, &hints, &ni); + if (ret) { +- error(LOGOPT_ANY, "hostname lookup failed: %s", +- gai_strerror(ret)); ++ error(LOGOPT_ANY, ++ "hostname lookup for %s failed: %s", ++ name, gai_strerror(ret)); + free(name); + return 0; + } diff --git a/SOURCES/autofs-5.1.4-mark-removed-cache-entry-negative.patch b/SOURCES/autofs-5.1.4-mark-removed-cache-entry-negative.patch new file mode 100644 index 0000000..ad2d363 --- /dev/null +++ b/SOURCES/autofs-5.1.4-mark-removed-cache-entry-negative.patch @@ -0,0 +1,64 @@ +autofs-5.1.4 - mark removed cache entry negative + +From: Ian Kent + +When re-reading a map entries that have been removed are detected +and deleted from the map entry cache by lookup_prune_cache(). + +If a removed map entry is mounted at the time lookup_prune_cache() +is called the map entry is skippedi. This is done becuase the next +lookup (following the mount expire, which needs the cache entry to +remain) will detect the stale cache entry and a map update done +resulting in the istale entry being removed. + +But if a map re-read is performed while the cache entry is mounted +the cache will appear to up to date so the removed entry will remain +valid even after it has expired. + +To cover this case it's sufficient to mark the mounted cache entry +negative during the cache prune which prevent further lookups from +using the stale entry. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/lookup.c | 12 +++++++++--- + 2 files changed, 10 insertions(+), 3 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -29,6 +29,7 @@ xx/xx/2018 autofs-5.1.5 + - covarity fixes. + - fix program usage message. + - fix update_negative_cache() map source usage. ++- mark removed cache entry negative. + + 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 +@@ -1417,15 +1417,21 @@ void lookup_prune_one_cache(struct autof + if (valid && valid->mc == mc) { + /* + * We've found a map entry that has been removed from +- * the current cache so it isn't really valid. ++ * the current cache so it isn't really valid. Set the ++ * mapent negative to prevent further mount requests ++ * using the cache entry. + */ ++ debug(ap->logopt, "removed map entry detected, mark negative"); ++ if (valid->mapent) { ++ free(valid->mapent); ++ valid->mapent = NULL; ++ } + cache_unlock(valid->mc); + valid = NULL; + } + if (!valid && + is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) { +- debug(ap->logopt, +- "prune check posponed, %s mounted", path); ++ debug(ap->logopt, "prune posponed, %s mounted", path); + free(key); + free(path); + continue; diff --git a/SOURCES/autofs-5.1.4-move-close-stdio-descriptors-to-become_daemon.patch b/SOURCES/autofs-5.1.4-move-close-stdio-descriptors-to-become_daemon.patch new file mode 100644 index 0000000..4a4642e --- /dev/null +++ b/SOURCES/autofs-5.1.4-move-close-stdio-descriptors-to-become_daemon.patch @@ -0,0 +1,117 @@ +autofs-5.1.4 - move close stdio descriptors to become_daemon() + +From: Ian Kent + +Move the stdio file descriptor close to the become_daemon() function +as closing these file descriptors, ie. detaching from ttys, is part +of the preperation for becoming a system daemon. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 27 ++++++++++++++++++++++++++- + include/log.h | 1 - + lib/log.c | 29 ----------------------------- + 4 files changed, 27 insertions(+), 31 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -42,6 +42,7 @@ xx/xx/2018 autofs-5.1.5 + - add NULL check in prepare_attempt_prefix(). + - update build info with systemd. + - use flags for startup boolean options. ++- move close stdio descriptors to become_daemon(). + + 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 +@@ -1218,6 +1218,8 @@ static void become_daemon(unsigned int f + } + log_to_stderr(); + } else { ++ int nullfd; ++ + if (open_pipe(start_pipefd) < 0) { + fprintf(stderr, "%s: failed to create start_pipefd.\n", + program); +@@ -1261,7 +1263,30 @@ static void become_daemon(unsigned int f + close(start_pipefd[1]); + exit(*pst_stat); + } +- log_to_syslog(); ++ ++ /* Redirect all our file descriptors to /dev/null */ ++ nullfd = open("/dev/null", O_RDWR); ++ if (nullfd < 0) { ++ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); ++ fprintf(stderr, "cannot open /dev/null: %s", estr); ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ exit(*pst_stat); ++ } ++ ++ if (dup2(nullfd, STDIN_FILENO) < 0 || ++ dup2(nullfd, STDOUT_FILENO) < 0 || ++ dup2(nullfd, STDERR_FILENO) < 0) { ++ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); ++ fprintf(stderr, ++ "redirecting file descriptors failed: %s", estr); ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ exit(*pst_stat); ++ } ++ ++ open_log(); ++ close(nullfd); + } + + /* Write pid file if requested */ +--- autofs-5.1.4.orig/include/log.h ++++ autofs-5.1.4/include/log.h +@@ -36,7 +36,6 @@ extern void set_log_debug_ap(struct auto + extern void set_mnt_logging(unsigned global_logopt); + + extern void open_log(void); +-extern void log_to_syslog(void); + extern void log_to_stderr(void); + + extern void log_info(unsigned int, const char* msg, ...); +--- autofs-5.1.4.orig/lib/log.c ++++ autofs-5.1.4/lib/log.c +@@ -314,35 +314,6 @@ void open_log(void) + return; + } + +-void log_to_syslog(void) +-{ +- char buf[MAX_ERR_BUF]; +- int nullfd; +- +- open_log(); +- +- /* Redirect all our file descriptors to /dev/null */ +- nullfd = open("/dev/null", O_RDWR); +- if (nullfd < 0) { +- char *estr = strerror_r(errno, buf, MAX_ERR_BUF); +- fprintf(stderr, "cannot open /dev/null: %s", estr); +- exit(1); +- } +- +- if (dup2(nullfd, STDIN_FILENO) < 0 || +- dup2(nullfd, STDOUT_FILENO) < 0 || +- dup2(nullfd, STDERR_FILENO) < 0) { +- char *estr = strerror_r(errno, buf, MAX_ERR_BUF); +- fprintf(stderr, +- "redirecting file descriptors failed: %s", estr); +- exit(1); +- } +- +- close(nullfd); +- +- return; +-} +- + void log_to_stderr(void) + { + if (syslog_open) { diff --git a/SOURCES/autofs-5.1.4-remove-autofs4-module-load-code.patch b/SOURCES/autofs-5.1.4-remove-autofs4-module-load-code.patch new file mode 100644 index 0000000..27c0dfa --- /dev/null +++ b/SOURCES/autofs-5.1.4-remove-autofs4-module-load-code.patch @@ -0,0 +1,222 @@ +autofs-5.1.4 - remove autofs4 module load code + +From: Ian Kent + +The autofs kernel module has finally been renamed from autofs4 to +autofs so autoloading works so there is no need for manual loading. + +The module load function has been commented out in the source for +a long time so there should not be any adverse affects from removing +it. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + configure | 61 ---------------------------------------------------- + configure.in | 1 + daemon/automount.c | 8 ------ + daemon/module.c | 35 ----------------------------- + include/automount.h | 7 ----- + include/config.h.in | 6 ----- + 7 files changed, 1 insertion(+), 118 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -38,6 +38,7 @@ xx/xx/2018 autofs-5.1.5 + - fix amd parser opts option handling. + - better handle hesiod support not built in. + - fix hesiod string check in master_parse(). ++- remove autofs4 module load code. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/configure ++++ autofs-5.1.4/configure +@@ -659,8 +659,6 @@ PATH_YACC + YACC + PATH_LEX + LEX +-HAVE_MODPROBE +-MODPROBE + HAVE_E4FSCK + E4FSCK + HAVE_E3FSCK +@@ -4155,65 +4153,6 @@ else + HAVE_E4FSCK=0 + fi + +-for ac_prog in modprobe +-do +- # Extract the first word of "$ac_prog", so it can be a program name with args. +-set dummy $ac_prog; ac_word=$2 +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +-$as_echo_n "checking for $ac_word... " >&6; } +-if ${ac_cv_path_MODPROBE+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- case $MODPROBE in +- [\\/]* | ?:[\\/]*) +- ac_cv_path_MODPROBE="$MODPROBE" # Let the user override the test with a path. +- ;; +- *) +- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +-for as_dir in $searchpath +-do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +- ac_cv_path_MODPROBE="$as_dir/$ac_word$ac_exec_ext" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +- fi +-done +- done +-IFS=$as_save_IFS +- +- ;; +-esac +-fi +-MODPROBE=$ac_cv_path_MODPROBE +-if test -n "$MODPROBE"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MODPROBE" >&5 +-$as_echo "$MODPROBE" >&6; } +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +-fi +- +- +- test -n "$MODPROBE" && break +-done +- +-if test -n "$MODPROBE"; then +- +-$as_echo "#define HAVE_MODPROBE 1" >>confdefs.h +- +- +-cat >>confdefs.h <<_ACEOF +-#define PATH_MODPROBE "$MODPROBE" +-_ACEOF +- +- HAVE_MODPROBE=1 +-else +- HAVE_MODPROBE=0 +-fi +- + + for ac_prog in flex lex + do +--- autofs-5.1.4.orig/configure.in ++++ autofs-5.1.4/configure.in +@@ -161,7 +161,6 @@ AF_PATH_INCLUDE(UMOUNT, umount, /bin/umo + AF_PATH_INCLUDE(E2FSCK, fsck.ext2 e2fsck, , $searchpath) + AF_PATH_INCLUDE(E3FSCK, fsck.ext3 e3fsck, , $searchpath) + AF_PATH_INCLUDE(E4FSCK, fsck.ext4 e4fsck, , $searchpath) +-AF_PATH_INCLUDE(MODPROBE, modprobe, , $searchpath) + + AF_CHECK_PROG(LEX, flex lex, , $searchpath) + AF_CHECK_PROG(YACC, bison, , $searchpath) +--- autofs-5.1.4.orig/daemon/automount.c ++++ autofs-5.1.4/daemon/automount.c +@@ -2336,14 +2336,6 @@ int main(int argc, char *argv[]) + exit(exit_code); + } + +-#if 0 +- if (!load_autofs4_module()) { +- fprintf(stderr, "%s: can't load %s filesystem module.\n", +- program, FS_MODULE_NAME); +- exit(1); +- } +-#endif +- + /* Don't need the kernel module just to look at the configured maps */ + if (!dumpmaps && (!query_kproto_ver() || get_kver_major() < 5)) { + fprintf(stderr, +--- autofs-5.1.4.orig/daemon/module.c ++++ autofs-5.1.4/daemon/module.c +@@ -19,41 +19,6 @@ + #include "automount.h" + #include "nsswitch.h" + +-int load_autofs4_module(void) +-{ +- FILE *fp; +- char buf[PATH_MAX]; +- int ret; +- +- /* +- * Check if module already loaded or compiled in. +- * If both autofs v3 and v4 are coplied in and +- * the v3 module registers first or the v4 module +- * is an older version we will catch it at mount +- * time. +- */ +- fp = open_fopen_r("/proc/filesystems"); +- if (!fp) { +- logerr("cannot open /proc/filesystems"); +- return 0; +- } +- +- while (fgets(buf, sizeof(buf), fp)) { +- if (strstr(buf, "autofs")) { +- fclose(fp); +- return 1; +- } +- } +- fclose(fp); +- +- ret = spawnl(LOGOPT_NONE, PATH_MODPROBE, PATH_MODPROBE, +- "-q", FS_MODULE_NAME, NULL); +- if (ret) +- return 0; +- +- return 1; +-} +- + int open_lookup(const char *name, const char *err_prefix, const char *mapfmt, + int argc, const char *const *argv, struct lookup_mod **lookup) + { +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -52,17 +52,10 @@ + #error Failed to locate umount(8)! + #endif + +-#ifndef HAVE_MODPROBE +-#error Failed to locate modprobe(8)! +-#endif +- + #ifndef HAVE_LINUX_PROCFS + #error Failed to verify existence of procfs filesystem! + #endif + +-#define FS_MODULE_NAME "autofs4" +-int load_autofs4_module(void); +- + /* The -s (sloppy) option to mount is good, if we have it... */ + + #ifdef HAVE_SLOPPY_MOUNT +--- autofs-5.1.4.orig/include/config.h.in ++++ autofs-5.1.4/include/config.h.in +@@ -48,9 +48,6 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_MEMORY_H + +-/* define if you have MODPROBE */ +-#undef HAVE_MODPROBE +- + /* define if you have MOUNT */ + #undef HAVE_MOUNT + +@@ -129,9 +126,6 @@ + /* define if you have LEX */ + #undef PATH_LEX + +-/* define if you have MODPROBE */ +-#undef PATH_MODPROBE +- + /* define if you have MOUNT */ + #undef PATH_MOUNT + diff --git a/SOURCES/autofs-5.1.4-set-bind-mount-as-propagation-slave.patch b/SOURCES/autofs-5.1.4-set-bind-mount-as-propagation-slave.patch new file mode 100644 index 0000000..cb8356c --- /dev/null +++ b/SOURCES/autofs-5.1.4-set-bind-mount-as-propagation-slave.patch @@ -0,0 +1,69 @@ +autofs-5.1.4 - set bind mount as propagation slave + +From: Ian Kent + +When using a multi-mount with mount targets that are on the +local machine and resulting bind mounts are made to a file +system that is mount propagation shared (such as the root +file system on systemd managed systems) the autofs offset +mount triggers made within the bind mount will be propagated +back to the target file system. + +When this happens the target of the offset (the unwanted +propagated mount) is itself an autofs trigger mount and +accessing the path results in a deadlock. + +In order for these multi-mounts to function properly in this +case bind mounts that contain mount triggers must be set to +propagation slave or private so the backward propagation +doesn't occur. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/mount_bind.c | 16 +++++++++++++++- + 2 files changed, 16 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -30,6 +30,7 @@ xx/xx/2018 autofs-5.1.5 + - fix program usage message. + - fix update_negative_cache() map source usage. + - mark removed cache entry negative. ++- set bind mount as propagation slave. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/modules/mount_bind.c ++++ autofs-5.1.4/modules/mount_bind.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #define MODULE_MOUNT + #include "automount.h" +@@ -183,8 +184,21 @@ int mount_mount(struct autofs_point *ap, + debug(ap->logopt, + MODPREFIX "mounted %s type %s on %s", + what, fstype, fullpath); +- return 0; + } ++ ++ /* The bind mount has succeeded but if the target ++ * mount is propagation shared propagation of child ++ * mounts (autofs offset mounts for example) back to ++ * the target of the bind mount must be avoided or ++ * autofs trigger mounts will deadlock. ++ */ ++ err = mount(NULL, fullpath, NULL, MS_SLAVE, NULL); ++ if (err) ++ warn(ap->logopt, ++ "failed to set propagation type for %s", ++ fullpath); ++ ++ return 0; + } else { + char *cp; + char basepath[PATH_MAX]; diff --git a/SOURCES/autofs-5.1.4-tiny-patch-for-autofs-typo-and-possible-bug.patch b/SOURCES/autofs-5.1.4-tiny-patch-for-autofs-typo-and-possible-bug.patch new file mode 100644 index 0000000..1f03fff --- /dev/null +++ b/SOURCES/autofs-5.1.4-tiny-patch-for-autofs-typo-and-possible-bug.patch @@ -0,0 +1,48 @@ +autofs-5.1.4 - tiny patch for autofs typo and possible bug + +From: Todd Eigenschink + +(1) The word "to" is doubled in two warnings. + +(2) It prints a warning when it can't open the "old" config file, even +if it was able to open the default one. That's a reasonable warning if +it *couldn't* open the new one, but seems unnecessary if it could. + +The patch removes the unneeded "to"s and only prints warning about the +old config file if it couldn't open the default one. + +Signed-off-by: Todd Eigenschink +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/defaults.c | 6 +++--- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -20,6 +20,7 @@ xx/xx/2018 autofs-5.1.5 + - add conditional inclusion of fedfs binaries. + - add an example fedfs master map entry to the installed master map. + - improve hostname lookup error logging. ++- tiny patch for autofs typo and possible bug. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/defaults.c ++++ autofs-5.1.4/lib/defaults.c +@@ -1207,12 +1207,12 @@ unsigned int defaults_read_config(unsign + + conf = open_fopen_r(DEFAULT_CONFIG_FILE); + if (!conf) +- message(to_syslog, "failed to to open config %s", ++ message(to_syslog, "failed to open config %s", + DEFAULT_CONFIG_FILE); + + oldconf = open_fopen_r(OLD_CONFIG_FILE); +- if (!oldconf) +- message(to_syslog, "failed to to open old config %s", ++ if (!oldconf && !conf) ++ message(to_syslog, "failed to open old config %s", + OLD_CONFIG_FILE); + + /* Neither config has been updated */ diff --git a/SOURCES/autofs-5.1.4-update-build-info-with-systemd.patch b/SOURCES/autofs-5.1.4-update-build-info-with-systemd.patch new file mode 100644 index 0000000..7c9f381 --- /dev/null +++ b/SOURCES/autofs-5.1.4-update-build-info-with-systemd.patch @@ -0,0 +1,41 @@ +autofs-5.1.4 - update build info with systemd + +From: Ian Kent + +Update the show_build_info() function to include systemd +build info. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 9 +++++++++ + 2 files changed, 10 insertions(+) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -40,6 +40,7 @@ xx/xx/2018 autofs-5.1.5 + - fix hesiod string check in master_parse(). + - remove autofs4 module load code. + - add NULL check in prepare_attempt_prefix(). ++- update build info with systemd. + + 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 +@@ -1951,6 +1951,15 @@ static void show_build_info(void) + } + #endif + ++#ifdef WITH_SYSTEMD ++ printf("WITH_SYSTEMD "); ++ count = count + 13; ++ ++ if (count > 60) { ++ printf("\n "); ++ count = 0; ++ } ++#endif + + #ifdef WITH_HESIOD + printf("WITH_HESIOD "); diff --git a/SOURCES/autofs-5.1.4-use-flags-for-startup-boolean-options.patch b/SOURCES/autofs-5.1.4-use-flags-for-startup-boolean-options.patch new file mode 100644 index 0000000..b744ce7 --- /dev/null +++ b/SOURCES/autofs-5.1.4-use-flags-for-startup-boolean-options.patch @@ -0,0 +1,217 @@ +autofs-5.1.4 - use flags for startup boolean options + +From: Ian Kent + +The daemon uses a number of boolean flags each stored in unsigned int +variables. But a single bit flag is sufficient storage for most of +these flags. + +So use bit flags for these where possible. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 45 ++++++++++++++++++++++----------------------- + include/automount.h | 6 ++++++ + lib/master.c | 4 ++-- + 4 files changed, 31 insertions(+), 25 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -41,6 +41,7 @@ xx/xx/2018 autofs-5.1.5 + - remove autofs4 module load code. + - add NULL check in prepare_attempt_prefix(). + - update build info with systemd. ++- use flags for startup boolean options. + + 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 +@@ -1195,7 +1195,7 @@ static int handle_packet(struct autofs_p + return -1; + } + +-static void become_daemon(unsigned foreground, unsigned daemon_check) ++static void become_daemon(unsigned int flags) + { + FILE *pidfp; + char buf[MAX_ERR_BUF]; +@@ -1210,8 +1210,8 @@ static void become_daemon(unsigned foreg + } + + /* Detach from foreground process */ +- if (foreground) { +- if (daemon_check && !aquire_flag_file()) { ++ if (flags & DAEMON_FLAGS_FOREGROUND) { ++ if ((flags & DAEMON_FLAGS_CHECK_DAEMON) && !aquire_flag_file()) { + fprintf(stderr, "%s: program is already running.\n", + program); + exit(1); +@@ -1238,7 +1238,7 @@ static void become_daemon(unsigned foreg + } + close(start_pipefd[0]); + +- if (daemon_check && !aquire_flag_file()) { ++ if ((flags & DAEMON_FLAGS_CHECK_DAEMON) && !aquire_flag_file()) { + fprintf(stderr, "%s: program is already running.\n", + program); + /* Return success if already running */ +@@ -2158,8 +2158,8 @@ int main(int argc, char *argv[]) + { + int res, opt, status; + int logpri = -1; +- unsigned ghost, logging, daemon_check; +- unsigned dumpmaps, foreground, have_global_options; ++ unsigned int flags; ++ unsigned int logging; + unsigned master_read; + int master_wait; + time_t timeout; +@@ -2202,17 +2202,15 @@ int main(int argc, char *argv[]) + + nfs_mount_uses_string_options = check_nfs_mount_version(&vers, &check); + ++ flags = defaults_get_browse_mode() ? DAEMON_FLAGS_GHOST : 0; ++ flags |= DAEMON_FLAGS_CHECK_DAEMON; ++ + kpkt_len = get_kpkt_len(); + master_wait = defaults_get_master_wait(); + timeout = defaults_get_timeout(); +- ghost = defaults_get_browse_mode(); + logging = defaults_get_logging(); + global_selection_options = 0; + global_options = NULL; +- have_global_options = 0; +- foreground = 0; +- dumpmaps = 0; +- daemon_check = 1; + + remove_empty_args(argv, &argc); + +@@ -2244,7 +2242,7 @@ int main(int argc, char *argv[]) + break; + + case 'f': +- foreground = 1; ++ flags |= DAEMON_FLAGS_FOREGROUND; + break; + + case 'V': +@@ -2260,7 +2258,7 @@ int main(int argc, char *argv[]) + break; + + case 'm': +- dumpmaps = 1; ++ flags |= DAEMON_FLAGS_DUMP_MAPS; + break; + + case 'M': +@@ -2268,9 +2266,9 @@ int main(int argc, char *argv[]) + break; + + case 'O': +- if (!have_global_options) { ++ if (!(flags & DAEMON_FLAGS_HAVE_GLOBAL_OPTIONS)) { + global_options = strdup(optarg); +- have_global_options = 1; ++ flags |= DAEMON_FLAGS_HAVE_GLOBAL_OPTIONS; + break; + } + printf("%s: global options already specified.\n", +@@ -2295,7 +2293,7 @@ int main(int argc, char *argv[]) + break; + + case 'C': +- daemon_check = 0; ++ flags &= ~DAEMON_FLAGS_CHECK_DAEMON; + break; + + case 'F': +@@ -2346,7 +2344,8 @@ int main(int argc, char *argv[]) + } + + /* Don't need the kernel module just to look at the configured maps */ +- if (!dumpmaps && (!query_kproto_ver() || get_kver_major() < 5)) { ++ if (!(flags & DAEMON_FLAGS_DUMP_MAPS) && ++ (!query_kproto_ver() || get_kver_major() < 5)) { + fprintf(stderr, + "%s: test mount forbidden or " + "incorrect kernel protocol version, " +@@ -2377,7 +2376,7 @@ int main(int argc, char *argv[]) + /* Get processor information for predefined escapes */ + macro_init(); + +- if (dumpmaps) { ++ if (flags & DAEMON_FLAGS_DUMP_MAPS) { + struct master_mapent *entry; + struct list_head *head, *p; + struct mapent_cache *nc; +@@ -2395,9 +2394,9 @@ int main(int argc, char *argv[]) + } + + if (master) +- master_list = master_new(NULL, timeout, ghost); ++ master_list = master_new(NULL, timeout, flags); + else +- master_list = master_new(master, timeout, ghost); ++ master_list = master_new(master, timeout, flags); + if (!master_list) { + printf("%s: can't create master map", program); + macro_free_global_table(); +@@ -2443,9 +2442,9 @@ int main(int argc, char *argv[]) + } + + if (argc == 0) +- master_list = master_new(NULL, timeout, ghost); ++ master_list = master_new(NULL, timeout, flags); + else +- master_list = master_new(argv[0], timeout, ghost); ++ master_list = master_new(argv[0], timeout, flags); + + if (!master_list) { + printf("%s: can't create master map %s", program, argv[0]); +@@ -2453,7 +2452,7 @@ int main(int argc, char *argv[]) + exit(1); + } + +- become_daemon(foreground, daemon_check); ++ become_daemon(flags); + + if (pthread_attr_init(&th_attr)) { + logerr("%s: failed to init thread attribute struct!", +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -66,6 +66,12 @@ + #define SLOPPY + #endif + ++#define DAEMON_FLAGS_FOREGROUND 0x0001 ++#define DAEMON_FLAGS_HAVE_GLOBAL_OPTIONS 0x0004 ++#define DAEMON_FLAGS_GHOST 0x0008 ++#define DAEMON_FLAGS_CHECK_DAEMON 0x0010 ++#define DAEMON_FLAGS_DUMP_MAPS 0x0020 ++ + #define AUTOFS_SUPER_MAGIC 0x00000187L + #define SMB_SUPER_MAGIC 0x0000517BL + #define CIFS_MAGIC_NUMBER 0xFF534D42L +--- autofs-5.1.4.orig/lib/master.c ++++ autofs-5.1.4/lib/master.c +@@ -922,7 +922,7 @@ void master_free_mapent(struct master_ma + return; + } + +-struct master *master_new(const char *name, unsigned int timeout, unsigned int ghost) ++struct master *master_new(const char *name, unsigned int timeout, unsigned int flags) + { + struct master *master; + char *tmp; +@@ -948,7 +948,7 @@ struct master *master_new(const char *na + master->depth = 0; + master->reading = 0; + master->read_fail = 0; +- master->default_ghost = ghost; ++ master->default_ghost = flags & DAEMON_FLAGS_GHOST; + master->default_timeout = timeout; + master->default_logging = defaults_get_logging(); + master->logopt = master->default_logging; diff --git a/SOURCES/autofs-5.1.4-use-systemd-sd_notify-at-startup.patch b/SOURCES/autofs-5.1.4-use-systemd-sd_notify-at-startup.patch new file mode 100644 index 0000000..410f267 --- /dev/null +++ b/SOURCES/autofs-5.1.4-use-systemd-sd_notify-at-startup.patch @@ -0,0 +1,1357 @@ +autofs-5.1.4 - use systemd sd_notify() at startup + +From: Ian Kent + +autofs needs to ensure statd is started before any NFS mounts +are attempted. + +When starting the statd service with the autofs service the statd +service will trigger a restart of the autofs service during its +start up. Sometimes this can happen during the automount start up +itself. + +When this happens it causes systemd to become confused and remove +the pid file created by automount leaving systemd thinking the +autofs service had failed start up when it was actually running. + +It was recommened that autofs be changed to a "Type=notify" service +to avoid this. Using this a pid file is no longer needed and is now +not used. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + Makefile.conf.in | 3 + aclocal.m4 | 3 + autofs.spec | 1 + configure | 948 +++++++++++++++++++++++++++------------------- + configure.in | 8 + daemon/Makefile | 5 + daemon/automount.c | 83 ++-- + samples/autofs.service.in | 5 + 9 files changed, 635 insertions(+), 422 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -22,6 +22,7 @@ xx/xx/2018 autofs-5.1.5 + - improve hostname lookup error logging. + - tiny patch for autofs typo and possible bug. + - add units After line to include statd service. ++- use systemd sd_notify() at startup. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/Makefile.conf.in ++++ autofs-5.1.4/Makefile.conf.in +@@ -18,6 +18,9 @@ NSLLIB = @NSL_LIBS@ + NSLCFLAGS = @NSL_CFLAGS@ + LIBRESOLV = @LIBRESOLV@ + ++SYSTEMD = @WITH_SYSTEMD@ ++LIBSYSTEMD = @systemd_LIBS@ ++ + # Hesiod support: yes (1) no (0) + HESIOD = @HAVE_HESIOD@ + LIBHESIOD = @LIBHESIOD@ +--- autofs-5.1.4.orig/aclocal.m4 ++++ autofs-5.1.4/aclocal.m4 +@@ -257,14 +257,17 @@ AC_DEFUN([AF_WITH_SYSTEMD], + fi + done + fi ++ WITH_SYSTEMD=0 + if test -n "$systemddir"; then + AC_MSG_RESULT($systemddir) ++ WITH_SYSTEMD=1 + else + AC_MSG_RESULT(not found) + fi + else + if test "$withval" != no; then + systemddir=$withval ++ WITH_SYSTEMD=1 + fi + fi]) + ]) +--- autofs-5.1.4.orig/autofs.spec ++++ autofs-5.1.4/autofs.spec +@@ -32,6 +32,7 @@ Source: https://www.kernel.org/pub/linux + Buildroot: %{_tmppath}/%{name}-tmp + %if %{with_systemd} + BuildRequires: systemd-units ++BuildRequires: systemd-devel + %endif + %if %{with_libtirpc} + BuildRequires: libtirpc-devel +--- autofs-5.1.4.orig/configure ++++ autofs-5.1.4/configure +@@ -674,6 +674,12 @@ MOUNT_NFS + HAVE_MOUNT + MOUNT + DMALLOCLIB ++TIRPC_LIBS ++TIRPC_CFLAGS ++flagdir ++fifodir ++mapdir ++confdir + OBJEXT + EXEEXT + ac_ct_CC +@@ -681,16 +687,13 @@ CPPFLAGS + LDFLAGS + CFLAGS + CC +-TIRPC_LIBS +-TIRPC_CFLAGS ++systemd_LIBS ++systemd_CFLAGS ++WITH_SYSTEMD ++systemddir + PKG_CONFIG_LIBDIR + PKG_CONFIG_PATH + PKG_CONFIG +-flagdir +-fifodir +-mapdir +-confdir +-systemddir + piddir + initdir + target_alias +@@ -760,13 +763,15 @@ target_alias + PKG_CONFIG + PKG_CONFIG_PATH + PKG_CONFIG_LIBDIR +-TIRPC_CFLAGS +-TIRPC_LIBS ++systemd_CFLAGS ++systemd_LIBS + CC + CFLAGS + LDFLAGS + LIBS + CPPFLAGS ++TIRPC_CFLAGS ++TIRPC_LIBS + NSL_CFLAGS + NSL_LIBS + CPP' +@@ -1413,9 +1418,10 @@ Some influential environment variables: + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path +- TIRPC_CFLAGS +- C compiler flags for TIRPC, overriding pkg-config +- TIRPC_LIBS linker flags for TIRPC, overriding pkg-config ++ systemd_CFLAGS ++ C compiler flags for systemd, overriding pkg-config ++ systemd_LIBS ++ linker flags for systemd, overriding pkg-config + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a +@@ -1423,6 +1429,9 @@ Some influential environment variables: + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory ++ TIRPC_CFLAGS ++ C compiler flags for TIRPC, overriding pkg-config ++ TIRPC_LIBS linker flags for TIRPC, overriding pkg-config + NSL_CFLAGS C compiler flags for NSL, overriding pkg-config + NSL_LIBS linker flags for NSL, overriding pkg-config + CPP C preprocessor +@@ -2291,166 +2300,6 @@ if test -z "$piddir"; then + fi + + +-# +-# Check for systemd unit files direectory exists if unit file installation +-# is requested +-# +- +-# Check whether --with-systemd was given. +-if test "${with_systemd+set}" = set; then : +- withval=$with_systemd; if test "$withval" = yes; then +- if test -z "$systemddir"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5 +-$as_echo_n "checking location of the systemd unit files directory... " >&6; } +- for systemd_d in /usr/lib/systemd/system /usr/lib64/systemd/system /lib/systemd/system /lib64/systemd/system; do +- if test -z "$systemddir"; then +- if test -d "$systemd_d"; then +- systemddir="$systemd_d" +- fi +- fi +- done +- fi +- if test -n "$systemddir"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5 +-$as_echo "$systemddir" >&6; } +- else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +-$as_echo "not found" >&6; } +- fi +-else +- if test "$withval" != no; then +- systemddir=$withval +- fi +-fi +-fi +- +- +- +- +-# +-# Location of system config script directory? +-# +-if test -z "$confdir"; then +- for conf_d in /etc/sysconfig /etc/defaults /etc/conf.d /etc/default; do +- if test -z "$confdir"; then +- if test -d "$conf_d"; then +- confdir="$conf_d" +- fi +- fi +- done +-fi +- +-# Check whether --with-confdir was given. +-if test "${with_confdir+set}" = set; then : +- withval=$with_confdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" +- then +- : +- else +- confdir="${withval}" +- fi +- +-fi +- +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs configuration file directory" >&5 +-$as_echo_n "checking for autofs configuration file directory... " >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $confdir" >&5 +-$as_echo "$confdir" >&6; } +- +- +-# +-# The user can specify --with-mapsdir=PATH to specify autofs maps go +-# +-if test -z "$mapdir"; then +- for map_d in /etc/autofs /etc; do +- if test -z "$mapdir"; then +- if test -d "$map_d"; then +- mapdir="$map_d" +- fi +- fi +- done +-fi +- +-# Check whether --with-mapdir was given. +-if test "${with_mapdir+set}" = set; then : +- withval=$with_mapdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" +- then +- : +- else +- mapdir="${withval}" +- fi +- +-fi +- +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs maps directory" >&5 +-$as_echo_n "checking for autofs maps directory... " >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mapdir" >&5 +-$as_echo "$mapdir" >&6; } +- +- +-# +-# The user can specify --with-fifodir=PATH to specify where autofs fifos go +-# +-if test -z "$fifodir"; then +- for fifo_d in /run /var/run /tmp; do +- if test -z "$fifodir"; then +- if test -d "$fifo_d"; then +- fifodir="$fifo_d" +- fi +- fi +- done +-fi +- +-# Check whether --with-fifodir was given. +-if test "${with_fifodir+set}" = set; then : +- withval=$with_fifodir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" +- then +- : +- else +- fifodir="${withval}" +- fi +- +-fi +- +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs fifos directory" >&5 +-$as_echo_n "checking for autofs fifos directory... " >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fifodir" >&5 +-$as_echo "$fifodir" >&6; } +- +- +-# +-# The user can specify --with-flagdir=PATH to specify where autofs flag file goes +-# +-if test -z "$flagdir"; then +- for flag_d in /run /var/run /tmp; do +- if test -z "$flagdir"; then +- if test -d "$flag_d"; then +- flagdir="$flag_d" +- fi +- fi +- done +-fi +- +-# Check whether --with-flagdir was given. +-if test "${with_flagdir+set}" = set; then : +- withval=$with_flagdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" +- then +- : +- else +- flagdir="${withval}" +- fi +- +-fi +- +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs flag file directory" >&5 +-$as_echo_n "checking for autofs flag file directory... " >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $flagdir" >&5 +-$as_echo "$flagdir" >&6; } +- +- +-# +-# Use libtirpc +-# +- + + + +@@ -2571,111 +2420,46 @@ $as_echo "no" >&6; } + fi + fi + +-# Check whether --with-libtirpc was given. +-if test "${with_libtirpc+set}" = set; then : +- withval=$with_libtirpc; +-fi +- +-if test "x$with_libtirpc" = "xyes"; then +- +-pkg_failed=no +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIRPC" >&5 +-$as_echo_n "checking for TIRPC... " >&6; } ++# ++# Check for systemd unit files direectory exists if unit file installation ++# is requested ++# + +-if test -n "$TIRPC_CFLAGS"; then +- pkg_cv_TIRPC_CFLAGS="$TIRPC_CFLAGS" +- elif test -n "$PKG_CONFIG"; then +- if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtirpc\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "libtirpc") 2>&5 +- ac_status=$? +- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +- test $ac_status = 0; }; then +- pkg_cv_TIRPC_CFLAGS=`$PKG_CONFIG --cflags "libtirpc" 2>/dev/null` +- test "x$?" != "x0" && pkg_failed=yes +-else +- pkg_failed=yes +-fi +- else +- pkg_failed=untried +-fi +-if test -n "$TIRPC_LIBS"; then +- pkg_cv_TIRPC_LIBS="$TIRPC_LIBS" +- elif test -n "$PKG_CONFIG"; then +- if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtirpc\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "libtirpc") 2>&5 +- ac_status=$? +- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +- test $ac_status = 0; }; then +- pkg_cv_TIRPC_LIBS=`$PKG_CONFIG --libs "libtirpc" 2>/dev/null` +- test "x$?" != "x0" && pkg_failed=yes ++# Check whether --with-systemd was given. ++if test "${with_systemd+set}" = set; then : ++ withval=$with_systemd; if test "$withval" = yes; then ++ if test -z "$systemddir"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5 ++$as_echo_n "checking location of the systemd unit files directory... " >&6; } ++ for systemd_d in /usr/lib/systemd/system /usr/lib64/systemd/system /lib/systemd/system /lib64/systemd/system; do ++ if test -z "$systemddir"; then ++ if test -d "$systemd_d"; then ++ systemddir="$systemd_d" ++ fi ++ fi ++ done ++ fi ++ WITH_SYSTEMD=0 ++ if test -n "$systemddir"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5 ++$as_echo "$systemddir" >&6; } ++ WITH_SYSTEMD=1 ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 ++$as_echo "not found" >&6; } ++ fi + else +- pkg_failed=yes +-fi +- else +- pkg_failed=untried ++ if test "$withval" != no; then ++ systemddir=$withval ++ WITH_SYSTEMD=1 ++ fi + fi +- +- +- +-if test $pkg_failed = yes; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +- +-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then +- _pkg_short_errors_supported=yes +-else +- _pkg_short_errors_supported=no + fi +- if test $_pkg_short_errors_supported = yes; then +- TIRPC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtirpc" 2>&1` +- else +- TIRPC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtirpc" 2>&1` +- fi +- # Put the nasty error message in config.log where it belongs +- echo "$TIRPC_PKG_ERRORS" >&5 +- +- as_fn_error $? "Package requirements (libtirpc) were not met: +- +-$TIRPC_PKG_ERRORS +- +-Consider adjusting the PKG_CONFIG_PATH environment variable if you +-installed software in a non-standard prefix. + +-Alternatively, you may set the environment variables TIRPC_CFLAGS +-and TIRPC_LIBS to avoid the need to call pkg-config. +-See the pkg-config man page for more details." "$LINENO" 5 +-elif test $pkg_failed = untried; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +-as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +-is in your PATH or set the PKG_CONFIG environment variable to the full +-path to pkg-config. +- +-Alternatively, you may set the environment variables TIRPC_CFLAGS +-and TIRPC_LIBS to avoid the need to call pkg-config. +-See the pkg-config man page for more details. +- +-To get pkg-config, see . +-See \`config.log' for more details" "$LINENO" 5; } +-else +- TIRPC_CFLAGS=$pkg_cv_TIRPC_CFLAGS +- TIRPC_LIBS=$pkg_cv_TIRPC_LIBS +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +-$as_echo "yes" >&6; } + + +-$as_echo "#define WITH_LIBTIRPC 1" >>confdefs.h +- +- +-$as_echo "#define TIRPC_WORKAROUND 1" >>confdefs.h +- + +-fi +- ac_ext=c ++ac_ext=c + ac_cpp='$CPP $CPPFLAGS' + ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' + ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +@@ -3465,7 +3249,511 @@ ac_link='$CC -o conftest$ac_exeext $CFLA + ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +-for ac_func in getrpcbyname getservbyname ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemd" >&5 ++$as_echo_n "checking for systemd... " >&6; } ++ ++if test -n "$systemd_CFLAGS"; then ++ pkg_cv_systemd_CFLAGS="$systemd_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_systemd_CFLAGS=`$PKG_CONFIG --cflags "libsystemd" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$systemd_LIBS"; then ++ pkg_cv_systemd_LIBS="$systemd_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_systemd_LIBS=`$PKG_CONFIG --libs "libsystemd" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ systemd_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1` ++ else ++ systemd_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$systemd_PKG_ERRORS" >&5 ++ ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sm_notify in -lsystemd" >&5 ++$as_echo_n "checking for sm_notify in -lsystemd... " >&6; } ++if ${ac_cv_lib_systemd_sm_notify+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lsystemd $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char sm_notify (); ++int ++main () ++{ ++return sm_notify (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_systemd_sm_notify=yes ++else ++ ac_cv_lib_systemd_sm_notify=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_systemd_sm_notify" >&5 ++$as_echo "$ac_cv_lib_systemd_sm_notify" >&6; } ++if test "x$ac_cv_lib_systemd_sm_notify" = xyes; then : ++ systemd_LIBS="-lsystemd" ++fi ++ ++ ++ ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sm_notify in -lsystemd" >&5 ++$as_echo_n "checking for sm_notify in -lsystemd... " >&6; } ++if ${ac_cv_lib_systemd_sm_notify+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lsystemd $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char sm_notify (); ++int ++main () ++{ ++return sm_notify (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_systemd_sm_notify=yes ++else ++ ac_cv_lib_systemd_sm_notify=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_systemd_sm_notify" >&5 ++$as_echo "$ac_cv_lib_systemd_sm_notify" >&6; } ++if test "x$ac_cv_lib_systemd_sm_notify" = xyes; then : ++ systemd_LIBS="-lsystemd" ++fi ++ ++ ++ ++else ++ systemd_CFLAGS=$pkg_cv_systemd_CFLAGS ++ systemd_LIBS=$pkg_cv_systemd_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++fi ++ ++# ++# Location of system config script directory? ++# ++if test -z "$confdir"; then ++ for conf_d in /etc/sysconfig /etc/defaults /etc/conf.d /etc/default; do ++ if test -z "$confdir"; then ++ if test -d "$conf_d"; then ++ confdir="$conf_d" ++ fi ++ fi ++ done ++fi ++ ++# Check whether --with-confdir was given. ++if test "${with_confdir+set}" = set; then : ++ withval=$with_confdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" ++ then ++ : ++ else ++ confdir="${withval}" ++ fi ++ ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs configuration file directory" >&5 ++$as_echo_n "checking for autofs configuration file directory... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $confdir" >&5 ++$as_echo "$confdir" >&6; } ++ ++ ++# ++# The user can specify --with-mapsdir=PATH to specify autofs maps go ++# ++if test -z "$mapdir"; then ++ for map_d in /etc/autofs /etc; do ++ if test -z "$mapdir"; then ++ if test -d "$map_d"; then ++ mapdir="$map_d" ++ fi ++ fi ++ done ++fi ++ ++# Check whether --with-mapdir was given. ++if test "${with_mapdir+set}" = set; then : ++ withval=$with_mapdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" ++ then ++ : ++ else ++ mapdir="${withval}" ++ fi ++ ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs maps directory" >&5 ++$as_echo_n "checking for autofs maps directory... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mapdir" >&5 ++$as_echo "$mapdir" >&6; } ++ ++ ++# ++# The user can specify --with-fifodir=PATH to specify where autofs fifos go ++# ++if test -z "$fifodir"; then ++ for fifo_d in /run /var/run /tmp; do ++ if test -z "$fifodir"; then ++ if test -d "$fifo_d"; then ++ fifodir="$fifo_d" ++ fi ++ fi ++ done ++fi ++ ++# Check whether --with-fifodir was given. ++if test "${with_fifodir+set}" = set; then : ++ withval=$with_fifodir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" ++ then ++ : ++ else ++ fifodir="${withval}" ++ fi ++ ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs fifos directory" >&5 ++$as_echo_n "checking for autofs fifos directory... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fifodir" >&5 ++$as_echo "$fifodir" >&6; } ++ ++ ++# ++# The user can specify --with-flagdir=PATH to specify where autofs flag file goes ++# ++if test -z "$flagdir"; then ++ for flag_d in /run /var/run /tmp; do ++ if test -z "$flagdir"; then ++ if test -d "$flag_d"; then ++ flagdir="$flag_d" ++ fi ++ fi ++ done ++fi ++ ++# Check whether --with-flagdir was given. ++if test "${with_flagdir+set}" = set; then : ++ withval=$with_flagdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" ++ then ++ : ++ else ++ flagdir="${withval}" ++ fi ++ ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs flag file directory" >&5 ++$as_echo_n "checking for autofs flag file directory... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $flagdir" >&5 ++$as_echo "$flagdir" >&6; } ++ ++ ++# ++# Use libtirpc ++# ++ ++ ++ ++ ++ ++ ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. ++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_path_PKG_CONFIG+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++PKG_CONFIG=$ac_cv_path_PKG_CONFIG ++if test -n "$PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 ++$as_echo "$PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++fi ++if test -z "$ac_cv_path_PKG_CONFIG"; then ++ ac_pt_PKG_CONFIG=$PKG_CONFIG ++ # Extract the first word of "pkg-config", so it can be a program name with args. ++set dummy pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $ac_pt_PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG ++if test -n "$ac_pt_PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 ++$as_echo "$ac_pt_PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ if test "x$ac_pt_PKG_CONFIG" = x; then ++ PKG_CONFIG="" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ PKG_CONFIG=$ac_pt_PKG_CONFIG ++ fi ++else ++ PKG_CONFIG="$ac_cv_path_PKG_CONFIG" ++fi ++ ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=0.9.0 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 ++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ PKG_CONFIG="" ++ fi ++fi ++ ++# Check whether --with-libtirpc was given. ++if test "${with_libtirpc+set}" = set; then : ++ withval=$with_libtirpc; ++fi ++ ++if test "x$with_libtirpc" = "xyes"; then ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIRPC" >&5 ++$as_echo_n "checking for TIRPC... " >&6; } ++ ++if test -n "$TIRPC_CFLAGS"; then ++ pkg_cv_TIRPC_CFLAGS="$TIRPC_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtirpc\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libtirpc") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_TIRPC_CFLAGS=`$PKG_CONFIG --cflags "libtirpc" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$TIRPC_LIBS"; then ++ pkg_cv_TIRPC_LIBS="$TIRPC_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtirpc\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libtirpc") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_TIRPC_LIBS=`$PKG_CONFIG --libs "libtirpc" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ TIRPC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtirpc" 2>&1` ++ else ++ TIRPC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtirpc" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$TIRPC_PKG_ERRORS" >&5 ++ ++ as_fn_error $? "Package requirements (libtirpc) were not met: ++ ++$TIRPC_PKG_ERRORS ++ ++Consider adjusting the PKG_CONFIG_PATH environment variable if you ++installed software in a non-standard prefix. ++ ++Alternatively, you may set the environment variables TIRPC_CFLAGS ++and TIRPC_LIBS to avoid the need to call pkg-config. ++See the pkg-config man page for more details." "$LINENO" 5 ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it ++is in your PATH or set the PKG_CONFIG environment variable to the full ++path to pkg-config. ++ ++Alternatively, you may set the environment variables TIRPC_CFLAGS ++and TIRPC_LIBS to avoid the need to call pkg-config. ++See the pkg-config man page for more details. ++ ++To get pkg-config, see . ++See \`config.log' for more details" "$LINENO" 5; } ++else ++ TIRPC_CFLAGS=$pkg_cv_TIRPC_CFLAGS ++ TIRPC_LIBS=$pkg_cv_TIRPC_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++ ++$as_echo "#define WITH_LIBTIRPC 1" >>confdefs.h ++ ++ ++$as_echo "#define TIRPC_WORKAROUND 1" >>confdefs.h ++ ++ ++fi ++ for ac_func in getrpcbyname getservbyname + do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +@@ -4522,126 +4810,6 @@ fi + + + +- +- +- +- +- +- +-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then +- if test -n "$ac_tool_prefix"; then +- # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +-$as_echo_n "checking for $ac_word... " >&6; } +-if ${ac_cv_path_PKG_CONFIG+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- case $PKG_CONFIG in +- [\\/]* | ?:[\\/]*) +- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. +- ;; +- *) +- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +-for as_dir in $PATH +-do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +- fi +-done +- done +-IFS=$as_save_IFS +- +- ;; +-esac +-fi +-PKG_CONFIG=$ac_cv_path_PKG_CONFIG +-if test -n "$PKG_CONFIG"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +-$as_echo "$PKG_CONFIG" >&6; } +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +-fi +- +- +-fi +-if test -z "$ac_cv_path_PKG_CONFIG"; then +- ac_pt_PKG_CONFIG=$PKG_CONFIG +- # Extract the first word of "pkg-config", so it can be a program name with args. +-set dummy pkg-config; ac_word=$2 +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +-$as_echo_n "checking for $ac_word... " >&6; } +-if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- case $ac_pt_PKG_CONFIG in +- [\\/]* | ?:[\\/]*) +- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. +- ;; +- *) +- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +-for as_dir in $PATH +-do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +- ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +- fi +-done +- done +-IFS=$as_save_IFS +- +- ;; +-esac +-fi +-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +-if test -n "$ac_pt_PKG_CONFIG"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +-$as_echo "$ac_pt_PKG_CONFIG" >&6; } +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +-fi +- +- if test "x$ac_pt_PKG_CONFIG" = x; then +- PKG_CONFIG="" +- else +- case $cross_compiling:$ac_tool_warned in +-yes:) +-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +-ac_tool_warned=yes ;; +-esac +- PKG_CONFIG=$ac_pt_PKG_CONFIG +- fi +-else +- PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +-fi +- +-fi +-if test -n "$PKG_CONFIG"; then +- _pkg_min_version=0.9.0 +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } +- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +-$as_echo "yes" >&6; } +- else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +- PKG_CONFIG="" +- fi +-fi +- + pkg_failed=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSL" >&5 + $as_echo_n "checking for NSL... " >&6; } +--- autofs-5.1.4.orig/configure.in ++++ autofs-5.1.4/configure.in +@@ -48,6 +48,7 @@ AF_INIT_D() + AC_SUBST(initdir) + AF_PID_D() + AC_SUBST(piddir) ++PKG_PROG_PKG_CONFIG() + + # + # Check for systemd unit files direectory exists if unit file installation +@@ -55,6 +56,12 @@ AC_SUBST(piddir) + # + AF_WITH_SYSTEMD() + AC_SUBST(systemddir) ++AC_SUBST(WITH_SYSTEMD) ++PKG_CHECK_MODULES([systemd],[libsystemd],, ++[ ++ AC_CHECK_LIB(systemd, sm_notify, systemd_LIBS="-lsystemd") ++ AC_SUBST(systemd_LIBS) ++]) + + # + # Location of system config script directory? +@@ -218,7 +225,6 @@ fi + AC_CHECK_LIB(rt, clock_gettime, LIBCLOCK_GETTIME="-lrt") + AC_SUBST(LIBCLOCK_GETTIME) + +-PKG_PROG_PKG_CONFIG() + PKG_CHECK_MODULES([NSL],[libnsl],, + [ + AC_CHECK_LIB(nsl, yp_match, NSL_LIBS="-lnsl") +--- autofs-5.1.4.orig/daemon/Makefile ++++ autofs-5.1.4/daemon/Makefile +@@ -22,6 +22,11 @@ CFLAGS += -DVERSION_STRING=\"$(version)\ + LDFLAGS += -rdynamic + LIBS += -ldl -lpthread + ++ifeq ($(SYSTEMD), 1) ++ CFLAGS += -DWITH_SYSTEMD ++ LIBS += $(LIBSYSTEMD) ++endif ++ + ifeq ($(LDAP), 1) + CFLAGS += $(XML_FLAGS) + LIBS += $(XML_LIBS) +--- autofs-5.1.4.orig/daemon/automount.c ++++ autofs-5.1.4/daemon/automount.c +@@ -36,6 +36,9 @@ + #include + #include + #include ++#ifdef WITH_SYSTEMD ++#include ++#endif + + #include "automount.h" + #if defined(LIBXML2_WORKAROUND) || defined(TIRPC_WORKAROUND) +@@ -67,7 +70,7 @@ unsigned int global_selection_options; + long global_negative_timeout = -1; + int do_force_unlink = 0; /* Forceably unlink mount tree at startup */ + +-static int start_pipefd[2]; ++static int start_pipefd[2] = {-1, -1}; + static int st_stat = 1; + static int *pst_stat = &st_stat; + static pthread_t state_mach_thid; +@@ -1206,12 +1209,6 @@ static void become_daemon(unsigned foreg + exit(0); + } + +- if (open_pipe(start_pipefd) < 0) { +- fprintf(stderr, "%s: failed to create start_pipefd.\n", +- program); +- exit(0); +- } +- + /* Detach from foreground process */ + if (foreground) { + if (daemon_check && !aquire_flag_file()) { +@@ -1221,6 +1218,12 @@ static void become_daemon(unsigned foreg + } + log_to_stderr(); + } else { ++ if (open_pipe(start_pipefd) < 0) { ++ fprintf(stderr, "%s: failed to create start_pipefd.\n", ++ program); ++ exit(0); ++ } ++ + pid = fork(); + if (pid > 0) { + close(start_pipefd[1]); +@@ -2450,8 +2453,10 @@ int main(int argc, char *argv[]) + if (pthread_attr_init(&th_attr)) { + logerr("%s: failed to init thread attribute struct!", + program); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2460,8 +2465,10 @@ int main(int argc, char *argv[]) + if (pthread_attr_init(&th_attr_detached)) { + logerr("%s: failed to init thread attribute struct!", + program); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2471,8 +2478,10 @@ int main(int argc, char *argv[]) + &th_attr_detached, PTHREAD_CREATE_DETACHED)) { + logerr("%s: failed to set detached thread attribute!", + program); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2483,8 +2492,10 @@ int main(int argc, char *argv[]) + &th_attr_detached, detached_thread_stack_size)) { + logerr("%s: failed to set stack size thread attribute!", + program); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2495,8 +2506,10 @@ int main(int argc, char *argv[]) + &th_attr_detached, &detached_thread_stack_size)) { + logerr("%s: failed to get detached thread stack size!", + program); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2513,8 +2526,10 @@ int main(int argc, char *argv[]) + logerr("%s: failed to create thread data key for std env vars!", + program); + master_kill(master_list); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2525,8 +2540,10 @@ int main(int argc, char *argv[]) + logerr("%s: failed to create thread data key for attempt ID!", + program); + master_kill(master_list); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2537,8 +2554,10 @@ int main(int argc, char *argv[]) + if (!alarm_start_handler()) { + logerr("%s: failed to create alarm handler thread!", program); + master_kill(master_list); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2547,8 +2566,10 @@ int main(int argc, char *argv[]) + if (!st_start_handler()) { + logerr("%s: failed to create FSM handler thread!", program); + master_kill(master_list); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2596,9 +2617,15 @@ int main(int argc, char *argv[]) + */ + do_force_unlink = 0; + +- st_stat = 0; +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ st_stat = 0; ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } ++ ++#ifdef WITH_SYSTEMD ++ sd_notify(1, "READY=1"); ++#endif + + state_mach_thid = pthread_self(); + statemachine(NULL); +--- autofs-5.1.4.orig/samples/autofs.service.in ++++ autofs-5.1.4/samples/autofs.service.in +@@ -4,10 +4,9 @@ After=network.target ypbind.service sssd + Wants=network-online.target rpc-statd.service rpcbind.service + + [Service] +-Type=forking +-PIDFile=@@autofspiddir@@/autofs.pid ++Type=notify + EnvironmentFile=-@@autofsconfdir@@/autofs +-ExecStart=@@sbindir@@/automount $OPTIONS --pid-file @@autofspiddir@@/autofs.pid ++ExecStart=@@sbindir@@/automount $OPTIONS --foreground --dont-check-daemon + ExecReload=/usr/bin/kill -HUP $MAINPID + KillMode=process + TimeoutSec=180 diff --git a/SOURCES/autofs-5.1.4-use_hostname_for_mounts-shouldnt-prevent-selection-among-replicas.patch b/SOURCES/autofs-5.1.4-use_hostname_for_mounts-shouldnt-prevent-selection-among-replicas.patch new file mode 100644 index 0000000..f398e45 --- /dev/null +++ b/SOURCES/autofs-5.1.4-use_hostname_for_mounts-shouldnt-prevent-selection-among-replicas.patch @@ -0,0 +1,226 @@ +autofs-5.1.4 - use_hostname_for_mounts shouldn't prevent selection among replicas + +From: NeilBrown + +If several replicas have been specified for a mount point, +and use_hostname_for_mount is set to "yes", the selection +between these replicas is currently disabled and the last in +the list is always chosen. + +There is little point selecting between different addresses +for the one host in this case, but it is still worth +selecting between different hosts, particularly if different +weights have been specified. + +This patch restores the "prune_host_list()" functionality +when use_hostname_for_mount is set, and modifies it slightly +so that only on IP address for any host:/path entry in the +config file is willl be successfully probed. After a +success, further addresses from the same entry are skipped. +This is achieved by tracking an entry number ("ent_num") for +each 'struct host'. + +Signed-off-by: NeilBrown +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/replicated.h | 3 ++- + modules/mount_nfs.c | 2 +- + modules/replicated.c | 35 ++++++++++++++++++++--------------- + 4 files changed, 24 insertions(+), 17 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 2d5d5b1f..104fca90 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -9,6 +9,7 @@ xx/xx/2018 autofs-5.1.5 + - fix error return in do_nfs_mount(). + - add error handling for ext_mount_add(). + - account for recent libnsl changes. ++- use_hostname_for_mounts shouldn't prevent selection among replicas. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +diff --git a/include/replicated.h b/include/replicated.h +index 69ab7800..0f482d21 100644 +--- a/include/replicated.h ++++ b/include/replicated.h +@@ -57,6 +57,7 @@ + + struct host { + char *name; ++ int ent_num; + struct sockaddr *addr; + size_t addr_len; + unsigned int rr; +@@ -70,7 +71,7 @@ struct host { + }; + + void seed_random(void); +-struct host *new_host(const char *, struct sockaddr *, size_t, ++struct host *new_host(const char *, int, struct sockaddr *, size_t, + unsigned int, unsigned int, unsigned int); + void free_host_list(struct host **); + int parse_location(unsigned, struct host **, const char *, unsigned int); +diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c +index 77166544..4cf0cd27 100644 +--- a/modules/mount_nfs.c ++++ b/modules/mount_nfs.c +@@ -236,7 +236,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + (vers & NFS4_VERS_MASK) != 0 && + !(vers & UDP6_REQUESTED)) { + unsigned int v4_probe_ok = 0; +- struct host *tmp = new_host(hosts->name, ++ struct host *tmp = new_host(hosts->name, 0, + hosts->addr, hosts->addr_len, + hosts->proximity, + hosts->weight, hosts->options); +diff --git a/modules/replicated.c b/modules/replicated.c +index 3ac4c70f..f7b83236 100644 +--- a/modules/replicated.c ++++ b/modules/replicated.c +@@ -83,7 +83,7 @@ void seed_random(void) + return; + } + +-struct host *new_host(const char *name, ++struct host *new_host(const char *name, int ent_num, + struct sockaddr *addr, size_t addr_len, + unsigned int proximity, unsigned int weight, + unsigned int options) +@@ -116,6 +116,7 @@ struct host *new_host(const char *name, + memset(new, 0, sizeof(struct host)); + + new->name = tmp1; ++ new->ent_num = ent_num; + new->addr_len = addr_len; + new->addr = tmp2; + new->proximity = proximity; +@@ -714,7 +715,7 @@ done: + int prune_host_list(unsigned logopt, struct host **list, + unsigned int vers, int port) + { +- struct host *this, *last, *first; ++ struct host *this, *last, *first, *prev; + struct host *new = NULL; + unsigned int proximity, selected_version = 0; + unsigned int v2_tcp_count, v3_tcp_count, v4_tcp_count; +@@ -726,12 +727,6 @@ int prune_host_list(unsigned logopt, struct host **list, + if (!*list) + return 0; + +- /* If we're using the host name then there's no point probing +- * avialability and respose time. +- */ +- if (defaults_use_hostname_for_mounts()) +- return 1; +- + /* Use closest hosts to choose NFS version */ + + first = *list; +@@ -877,11 +872,18 @@ int prune_host_list(unsigned logopt, struct host **list, + + first = last; + this = first; ++ prev = NULL; + while (this) { + struct host *next = this->next; + if (!this->name) { + remove_host(list, this); + add_host(&new, this); ++ } else if (defaults_use_hostname_for_mounts() && prev && ++ prev->ent_num == this->ent_num) { ++ /* When we use the hostname to mount, there is no ++ * point in probing every address it has, just one is ++ * enough. Skip the rest. ++ */ + } else { + status = get_supported_ver_and_cost(logopt, this, + selected_version, port); +@@ -889,6 +891,7 @@ int prune_host_list(unsigned logopt, struct host **list, + this->version = selected_version; + remove_host(list, this); + add_host(&new, this); ++ prev = this; + } + } + this = next; +@@ -901,7 +904,7 @@ int prune_host_list(unsigned logopt, struct host **list, + } + + static int add_new_host(struct host **list, +- const char *host, unsigned int weight, ++ const char *host, int ent_num, unsigned int weight, + struct addrinfo *host_addr, + unsigned int rr, unsigned int options) + { +@@ -940,7 +943,7 @@ static int add_new_host(struct host **list, + else + return 0; + +- new = new_host(host, host_addr->ai_addr, addr_len, prx, weight, options); ++ new = new_host(host, ent_num, host_addr->ai_addr, addr_len, prx, weight, options); + if (!new) + return 0; + +@@ -953,7 +956,7 @@ static int add_new_host(struct host **list, + return 1; + } + +-static int add_host_addrs(struct host **list, const char *host, ++static int add_host_addrs(struct host **list, const char *host, int ent_num, + unsigned int weight, unsigned int options) + { + struct addrinfo hints, *ni, *this; +@@ -988,7 +991,7 @@ static int add_host_addrs(struct host **list, const char *host, + + this = ni; + while (this) { +- ret = add_new_host(list, host, weight, this, 0, options); ++ ret = add_new_host(list, host, ent_num, weight, this, 0, options); + if (!ret) + break; + this = this->ai_next; +@@ -1027,7 +1030,7 @@ try_name: + rr++; + this = ni; + while (this) { +- ret = add_new_host(list, host, weight, this, rr, options); ++ ret = add_new_host(list, host, ent_num, weight, this, rr, options); + if (!ret) + break; + this = this->ai_next; +@@ -1120,6 +1123,7 @@ int parse_location(unsigned logopt, struct host **hosts, + { + char *str, *p, *delim; + unsigned int empty = 1; ++ int ent_num = 1; + + if (!list) + return 0; +@@ -1177,7 +1181,7 @@ int parse_location(unsigned logopt, struct host **hosts, + } + + if (p != delim) { +- if (!add_host_addrs(hosts, p, weight, options)) { ++ if (!add_host_addrs(hosts, p, ent_num, weight, options)) { + if (empty) { + p = next; + continue; +@@ -1199,7 +1203,7 @@ int parse_location(unsigned logopt, struct host **hosts, + *delim = '\0'; + next = delim + 1; + +- if (!add_host_addrs(hosts, p, weight, options)) { ++ if (!add_host_addrs(hosts, p, ent_num, weight, options)) { + p = next; + continue; + } +@@ -1213,6 +1217,7 @@ int parse_location(unsigned logopt, struct host **hosts, + return 0; + } + ++ ent_num++; + p = next; + } + diff --git a/SOURCES/autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch b/SOURCES/autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch new file mode 100644 index 0000000..be021c3 --- /dev/null +++ b/SOURCES/autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch @@ -0,0 +1,39 @@ +autofs-5.1.5 - add NULL check for get_addr_string() return + +From: Ian Kent + +When constructing the mount location string in mount_nfs.c:mount_mount() +the return from get_addr_string() is not checked for NULL. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/mount_nfs.c | 6 ++++++ + 2 files changed, 7 insertions(+) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -45,6 +45,7 @@ xx/xx/2018 autofs-5.1.5 + - move close stdio descriptors to become_daemon(). + - add systemd service command line option. + - support strictexpire mount option. ++- add NULL check for get_addr_string() return. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/modules/mount_nfs.c ++++ autofs-5.1.4/modules/mount_nfs.c +@@ -333,7 +333,13 @@ dont_probe: + socklen_t len = INET6_ADDRSTRLEN; + char n_buf[len + 1]; + const char *n_addr; ++ + n_addr = get_addr_string(this->addr, n_buf, len); ++ if (!n_addr) { ++ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); ++ error(ap->logopt, "get_addr_string: %s", estr); ++ goto forced_fail; ++ } + loc = malloc(strlen(n_addr) + strlen(this->path) + 4); + if (!loc) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); diff --git a/SOURCES/autofs-5.1.5-add-mount_verbose-configuration-option.patch b/SOURCES/autofs-5.1.5-add-mount_verbose-configuration-option.patch new file mode 100644 index 0000000..8521252 --- /dev/null +++ b/SOURCES/autofs-5.1.5-add-mount_verbose-configuration-option.patch @@ -0,0 +1,174 @@ +autofs-5.1.5 - add mount_verbose configuration option + +From: Lars R. Damerow + +This option makes automount pass the -v flag to mount(8). + +Signed-off-by: Lars R. Damerow +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/spawn.c | 20 ++++++++++++-------- + include/defaults.h | 2 ++ + lib/defaults.c | 17 +++++++++++++++++ + man/autofs.conf.5.in | 4 ++++ + redhat/autofs.conf.default.in | 4 ++++ + samples/autofs.conf.default.in | 4 ++++ + 7 files changed, 44 insertions(+), 8 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -47,6 +47,7 @@ xx/xx/2018 autofs-5.1.5 + - support strictexpire mount option. + - add NULL check for get_addr_string() return. + - use malloc(3) in spawn.c. ++- add mount_verbose configuration option. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/spawn.c ++++ autofs-5.1.4/daemon/spawn.c +@@ -558,12 +558,14 @@ int spawn_mount(unsigned logopt, ...) + char prog[] = PATH_MOUNT; + char arg0[] = PATH_MOUNT; + char argn[] = "-n"; ++ char argvr[] = "-v"; + /* In case we need to use the fake option to mount */ + char arg_fake[] = "-f"; + unsigned int options; + unsigned int retries = MTAB_LOCK_RETRIES; + int update_mtab = 1, ret, printed = 0; + unsigned int wait = defaults_get_mount_wait(); ++ int verbose = defaults_get_mount_verbose(); + char buf[PATH_MAX + 1]; + unsigned int argv_len; + +@@ -590,8 +592,10 @@ int spawn_mount(unsigned logopt, ...) + } + } + +- /* Alloc 1 extra slot in case we need to use the "-f" option */ +- argv_len = sizeof(char *) * (argc + 2); ++ /* Alloc 2 extra slots in case we need to use the "-f" or "-v" options ++ * plus the NULL slot for end of args. ++ */ ++ argv_len = sizeof(char *) * (argc + 3); + argv = malloc(argv_len); + if (!argv) { + char buf[MAX_ERR_BUF]; +@@ -604,12 +608,12 @@ int spawn_mount(unsigned logopt, ...) + argv[0] = arg0; + + va_start(arg, logopt); +- if (update_mtab) +- p = argv + 1; +- else { +- argv[1] = argn; +- p = argv + 2; +- } ++ p = argv + 1; ++ if (!update_mtab) ++ *(p++) = argn; ++ if (verbose) ++ *(p++) = argvr; ++ + while ((*p = va_arg(arg, char *))) { + if (options == SPAWN_OPT_OPEN && !strcmp(*p, "-t")) { + *(++p) = va_arg(arg, char *); +--- autofs-5.1.4.orig/include/defaults.h ++++ autofs-5.1.4/include/defaults.h +@@ -27,6 +27,7 @@ + #define DEFAULT_TIMEOUT "600" + #define DEFAULT_MASTER_WAIT "10" + #define DEFAULT_NEGATIVE_TIMEOUT "60" ++#define DEFAULT_MOUNT_VERBOSE "0" + #define DEFAULT_MOUNT_WAIT "-1" + #define DEFAULT_UMOUNT_WAIT "12" + #define DEFAULT_BROWSE_MODE "1" +@@ -166,6 +167,7 @@ unsigned int defaults_get_ldap_timeout(v + unsigned int defaults_get_ldap_network_timeout(void); + unsigned int defaults_get_mount_nfs_default_proto(void); + unsigned int defaults_get_append_options(void); ++unsigned int defaults_get_mount_verbose(void); + unsigned int defaults_get_mount_wait(void); + unsigned int defaults_get_umount_wait(void); + const char *defaults_get_auth_conf_file(void); +--- autofs-5.1.4.orig/lib/defaults.c ++++ autofs-5.1.4/lib/defaults.c +@@ -68,6 +68,7 @@ + + #define NAME_MOUNT_NFS_DEFAULT_PROTOCOL "mount_nfs_default_protocol" + #define NAME_APPEND_OPTIONS "append_options" ++#define NAME_MOUNT_VERBOSE "mount_verbose" + #define NAME_MOUNT_WAIT "mount_wait" + #define NAME_UMOUNT_WAIT "umount_wait" + #define NAME_AUTH_CONF_FILE "auth_conf_file" +@@ -328,6 +329,11 @@ static int conf_load_autofs_defaults(voi + if (ret == CFG_FAIL) + goto error; + ++ ret = conf_update(sec, NAME_MOUNT_VERBOSE, ++ DEFAULT_MOUNT_VERBOSE, CONF_ENV); ++ if (ret == CFG_FAIL) ++ goto error; ++ + ret = conf_update(sec, NAME_MOUNT_WAIT, + DEFAULT_MOUNT_WAIT, CONF_ENV); + if (ret == CFG_FAIL) +@@ -1780,6 +1786,17 @@ unsigned int defaults_get_append_options + + return res; + } ++ ++unsigned int defaults_get_mount_verbose(void) ++{ ++ long res; ++ ++ res = conf_get_yesno(autofs_gbl_sec, NAME_MOUNT_VERBOSE); ++ if (res < 0) ++ res = atoi(DEFAULT_MOUNT_VERBOSE); ++ ++ return res; ++} + + unsigned int defaults_get_mount_wait(void) + { +--- autofs-5.1.4.orig/man/autofs.conf.5.in ++++ autofs-5.1.4/man/autofs.conf.5.in +@@ -41,6 +41,10 @@ Set the default timeout for caching fail + 60). If the equivalent command line option is given it will override this + setting. + .TP ++.B mount_verbose ++.br ++Use the verbose flag when spawning mount(8) (program default "no"). ++.TP + .B mount_wait + .br + Set the default time to wait for a response from a spawned mount(8) +--- autofs-5.1.4.orig/redhat/autofs.conf.default.in ++++ autofs-5.1.4/redhat/autofs.conf.default.in +@@ -26,6 +26,10 @@ timeout = 300 + # + #negative_timeout = 60 + # ++# mount_verbose - use the -v flag when calling mount(8). ++# ++#mount_verbose = no ++# + # mount_wait - time to wait for a response from mount(8). + # Setting this timeout can cause problems when + # mount would otherwise wait for a server that +--- autofs-5.1.4.orig/samples/autofs.conf.default.in ++++ autofs-5.1.4/samples/autofs.conf.default.in +@@ -26,6 +26,10 @@ timeout = 300 + # + #negative_timeout = 60 + # ++# mount_verbose - use the -v flag when calling mount(8). ++# ++#mount_verbose = no ++# + # mount_wait - time to wait for a response from mount(8). + # Setting this timeout can cause problems when + # mount would otherwise wait for a server that diff --git a/SOURCES/autofs-5.1.5-add-strictexpire-mount-option.patch b/SOURCES/autofs-5.1.5-add-strictexpire-mount-option.patch new file mode 100644 index 0000000..3809b9e --- /dev/null +++ b/SOURCES/autofs-5.1.5-add-strictexpire-mount-option.patch @@ -0,0 +1,200 @@ +autofs-5.1.5 - support strictexpire mount option + +From: Ian Kent + +Kernel commit 092a53452b (("autofs: take more care to not update +last_used on path walk") helped to (partially) resolve a problem +where automounts were not expiring due to aggressive accesses from +user space. + +This patch was later reverted because, for very large environments, +it meant more mount requests from clients and when there are a lot +of clients this caused a fairly significant increase in server load. + +But there is a need for both types of expire check, depending on use +case, so a mount option to allow for strict update of last use of +autofs dentrys has been added ito the autofs file system (which just +means not updating the last use on path walk accesses). + +So add support for this master map mount entry option in the user +space code. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 10 ++++++++++ + daemon/indirect.c | 10 ++++++++++ + include/automount.h | 3 +++ + lib/master_parse.y | 8 +++++++- + lib/master_tok.l | 1 + + man/auto.master.5.in | 8 ++++++++ + modules/mount_autofs.c | 5 +++++ + 8 files changed, 45 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -44,6 +44,7 @@ xx/xx/2018 autofs-5.1.5 + - use flags for startup boolean options. + - move close stdio descriptors to become_daemon(). + - add systemd service command line option. ++- support strictexpire mount option. + + 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 +@@ -421,6 +421,16 @@ int do_mount_autofs_direct(struct autofs + mp->options = make_options_string(ap->path, ap->kpipefd, str_direct); + if (!mp->options) + return 0; ++ ++ if ((ap->flags & MOUNT_FLAG_STRICTEXPIRE) && ++ ((get_kver_major() == 5 && get_kver_minor() > 3) || ++ (get_kver_major() > 5))) { ++ char *tmp = realloc(mp->options, strlen(mp->options) + 12); ++ if (tmp) { ++ strcat(tmp, ",strictexpire"); ++ mp->options = tmp; ++ } ++ } + } + + /* In case the directory doesn't exist, try to mkdir it */ +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -132,6 +132,16 @@ static int do_mount_autofs_indirect(stru + goto out_err; + } + ++ if ((ap->flags & MOUNT_FLAG_STRICTEXPIRE) && ++ ((get_kver_major() == 5 && get_kver_minor() > 3) || ++ (get_kver_major() > 5))) { ++ char *tmp = realloc(options, strlen(options) + 12); ++ if (tmp) { ++ strcat(tmp, ",strictexpire"); ++ options = tmp; ++ } ++ } ++ + /* In case the directory doesn't exist, try to mkdir it */ + if (mkdir_path(root, mp_mode) < 0) { + if (errno != EEXIST && errno != EROFS) { +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -553,6 +553,9 @@ struct kernel_mod_version { + #define MOUNT_FLAG_SLAVE 0x0100 + #define MOUNT_FLAG_PRIVATE 0x0200 + ++/* Use strict expire semantics if requested and kernel supports it */ ++#define MOUNT_FLAG_STRICTEXPIRE 0x0400 ++ + struct autofs_point { + pthread_t thid; + char *path; /* Mount point name */ +--- autofs-5.1.4.orig/lib/master_parse.y ++++ autofs-5.1.4/lib/master_parse.y +@@ -58,6 +58,7 @@ static char *format; + static long timeout; + static long negative_timeout; + static unsigned symlnk; ++static unsigned strictexpire; + static unsigned slave; + static unsigned private; + static unsigned nobind; +@@ -105,7 +106,7 @@ static int master_fprintf(FILE *, char * + %token MAP + %token OPT_TIMEOUT OPT_NTIMEOUT OPT_NOBIND OPT_NOGHOST OPT_GHOST OPT_VERBOSE + %token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT OPT_SYMLINK OPT_MODE +-%token OPT_SLAVE OPT_PRIVATE ++%token OPT_STRICTEXPIRE OPT_SLAVE OPT_PRIVATE + %token COLON COMMA NL DDASH + %type map + %type options +@@ -206,6 +207,7 @@ line: + | PATH OPT_DEBUG { master_notify($1); YYABORT; } + | PATH OPT_TIMEOUT { master_notify($1); YYABORT; } + | PATH OPT_SYMLINK { master_notify($1); YYABORT; } ++ | PATH OPT_STRICTEXPIRE { master_notify($1); YYABORT; } + | PATH OPT_SLAVE { master_notify($1); YYABORT; } + | PATH OPT_PRIVATE { master_notify($1); YYABORT; } + | PATH OPT_NOBIND { master_notify($1); YYABORT; } +@@ -619,6 +621,7 @@ option: daemon_option + daemon_option: OPT_TIMEOUT NUMBER { timeout = $2; } + | OPT_NTIMEOUT NUMBER { negative_timeout = $2; } + | OPT_SYMLINK { symlnk = 1; } ++ | OPT_STRICTEXPIRE { strictexpire = 1; } + | OPT_SLAVE { slave = 1; } + | OPT_PRIVATE { private = 1; } + | OPT_NOBIND { nobind = 1; } +@@ -693,6 +696,7 @@ static void local_init_vars(void) + timeout = -1; + negative_timeout = 0; + symlnk = 0; ++ strictexpire = 0; + slave = 0; + private = 0; + nobind = 0; +@@ -901,6 +905,8 @@ int master_parse_entry(const char *buffe + entry->ap->flags |= MOUNT_FLAG_USE_WEIGHT_ONLY; + if (symlnk) + entry->ap->flags |= MOUNT_FLAG_SYMLINK; ++ if (strictexpire) ++ entry->ap->flags |= MOUNT_FLAG_STRICTEXPIRE; + if (slave) + entry->ap->flags |= MOUNT_FLAG_SLAVE; + if (private) +--- autofs-5.1.4.orig/lib/master_tok.l ++++ autofs-5.1.4/lib/master_tok.l +@@ -391,6 +391,7 @@ MODE (--mode{OPTWS}|--mode{OPTWS}={OPTW + -?nobrowse { return(OPT_NOGHOST); } + -?slave { return(OPT_SLAVE); } + -?private { return(OPT_PRIVATE); } ++ -?strictexpire { return(OPT_STRICTEXPIRE); } + -g|--ghost|-?browse { return(OPT_GHOST); } + -v|--verbose { return(OPT_VERBOSE); } + -d|--debug { return(OPT_DEBUG); } +--- autofs-5.1.4.orig/man/auto.master.5.in ++++ autofs-5.1.4/man/auto.master.5.in +@@ -199,6 +199,14 @@ entries only, either in the master map ( + or with individual map entries. The option is ignored for direct mounts + and non-root offest mount entries. + .TP ++.I "strictexpire" ++Use a strict expire policy for this automount. Using this option means ++that last use of autofs directory entries will not be updated during ++path walks so that mounts in an automount won't be kept mounted by ++applications scanning the mount tree. Note that this doesn't completely ++resolve the problem of expired automounts being immediately re-mounted ++due to application accesses triggered by the expire itself. ++.TP + .I slave \fPor\fI private + This option allows mount propagation of bind mounts to be set to + either \fIslave\fP or \fIprivate\fP. This option may be needed when using +--- autofs-5.1.4.orig/modules/mount_autofs.c ++++ autofs-5.1.4/modules/mount_autofs.c +@@ -57,6 +57,7 @@ int mount_mount(struct autofs_point *ap, + int nobind = ap->flags & MOUNT_FLAG_NOBIND; + int ghost = ap->flags & MOUNT_FLAG_GHOST; + int symlnk = ap->flags & MOUNT_FLAG_SYMLINK; ++ int strictexpire = ap->flags & MOUNT_FLAG_STRICTEXPIRE; + time_t timeout = get_exp_timeout(ap, ap->entry->maps); + unsigned logopt = ap->logopt; + struct map_type_info *info; +@@ -131,6 +132,8 @@ int mount_mount(struct autofs_point *ap, + ghost = 1; + else if (_strncmp("symlink", cp, 7) == 0) + symlnk = 1; ++ else if (_strncmp("strictexpire", cp, 12) == 0) ++ strictexpire = 1; + else if (_strncmp("hosts", cp, 5) == 0) + hosts = 1; + else if (_strncmp("timeout=", cp, 8) == 0) { +@@ -173,6 +176,8 @@ int mount_mount(struct autofs_point *ap, + nap->parent = ap; + if (symlnk) + nap->flags |= MOUNT_FLAG_SYMLINK; ++ if (strictexpire) ++ nap->flags |= MOUNT_FLAG_STRICTEXPIRE; + + if (hosts) + argc = 0; diff --git a/SOURCES/autofs-5.1.5-allow-period-following-macro-in-selector-value.patch b/SOURCES/autofs-5.1.5-allow-period-following-macro-in-selector-value.patch new file mode 100644 index 0000000..a96c68f --- /dev/null +++ b/SOURCES/autofs-5.1.5-allow-period-following-macro-in-selector-value.patch @@ -0,0 +1,34 @@ +autofs-5.1.5 - allow period following macro in selector value + +From: Ian Kent + +If a ${} macro is used in a selector (such as hostd) the parser doesn't +permit a period to follow it (such as when the value is a host name). + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/amd_tok.l | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -51,6 +51,7 @@ xx/xx/2018 autofs-5.1.5 + - optionally log mount requestor process info. + - log mount call arguments if mount_verbose is set. + - make expire remaining log level debug. ++- allow period following macro in selector value. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/modules/amd_tok.l ++++ autofs-5.1.4/modules/amd_tok.l +@@ -95,7 +95,7 @@ V6MASK (12[0-8]|1[0-1][0-9]|[1-9][0-9]| + + FOPT (({QSTR}|{FSTR}|{MACRO})+) + OPTS ({OSTR}(=({VSTR}|{MACRO})+)?) +-SOPT (({SSTR}|{QSTR}|{MACRO})+) ++SOPT ({SSTR}|{QSTR}|{MACRO}(\.|{SSTR}|{QSTR}|{MACRO})+) + NOPT ({SSTR}|(({IP4ADDR}(\/{V4MASK})?)|({IP6ADDR}(\/{V6MASK})?))) + + MAPOPT (fs|type|maptype|pref|sublink|cache) diff --git a/SOURCES/autofs-5.1.5-fix-hesiod-string-check-in-master_parse.patch b/SOURCES/autofs-5.1.5-fix-hesiod-string-check-in-master_parse.patch new file mode 100644 index 0000000..dd389f7 --- /dev/null +++ b/SOURCES/autofs-5.1.5-fix-hesiod-string-check-in-master_parse.patch @@ -0,0 +1,49 @@ +autofs-5.1.5 - fix hesiod string check in master_parse() + +From: Ian Kent + +When map source is specified in a master map entry, checking if +map type is hesiod in master_parse() will generate a SEGV if a +parser type is not also present becuase tmp will be NULL in this +case. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/master_parse.y | 8 ++++---- + 2 files changed, 5 insertions(+), 4 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -37,6 +37,7 @@ xx/xx/2018 autofs-5.1.5 + - fix incorrect locking in sss lookup. + - fix amd parser opts option handling. + - better handle hesiod support not built in. ++- fix hesiod string check in master_parse(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/master_parse.y ++++ autofs-5.1.4/lib/master_parse.y +@@ -172,8 +172,8 @@ line: + if ((tmp = strchr($2, ','))) + *tmp++ = '\0'; + #ifndef WITH_HESIOD +- /* Map type or or map type parser is hesiod */ +- if (!strcmp($2, "hesiod") || !strcmp(tmp, "hesiod")) { ++ /* Map type or map type parser is hesiod */ ++ if (!strcmp($2, "hesiod") || (tmp && !strcmp(tmp, "hesiod"))) { + master_error("hesiod support not built in"); + local_free_vars(); + YYABORT; +@@ -360,8 +360,8 @@ map: PATH + if ((tmp = strchr($1, ','))) + *tmp++ = '\0'; + #ifndef WITH_HESIOD +- /* Map type or or map type parser is hesiod */ +- if (!strcmp($1, "hesiod") || !strcmp(tmp, "hesiod")) { ++ /* Map type or map type parser is hesiod */ ++ if (!strcmp($1, "hesiod") || (tmp && !strcmp(tmp, "hesiod"))) { + master_error("hesiod support not built in"); + local_free_vars(); + YYABORT; diff --git a/SOURCES/autofs-5.1.5-fix-macro-expansion-in-selector-values.patch b/SOURCES/autofs-5.1.5-fix-macro-expansion-in-selector-values.patch new file mode 100644 index 0000000..0b2a5d0 --- /dev/null +++ b/SOURCES/autofs-5.1.5-fix-macro-expansion-in-selector-values.patch @@ -0,0 +1,419 @@ +autofs-5.1.5 - fix macro expansion in selector values + +From: Ian Kent + +Macro expansion is not done in selector values before use, for example +in "hostd==${/key}.." the ${/key} is not expanded before +use leading to an attempt to use an invalid host name. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + modules/parse_amd.c | 286 ++++++++++++++++++++++++++++++++++------------------ + 2 files changed, 193 insertions(+), 94 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -52,6 +52,7 @@ xx/xx/2018 autofs-5.1.5 + - log mount call arguments if mount_verbose is set. + - make expire remaining log level debug. + - allow period following macro in selector value. ++- fix macro expansion in selector values. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/modules/parse_amd.c ++++ autofs-5.1.4/modules/parse_amd.c +@@ -231,17 +231,29 @@ static struct substvar *add_lookup_vars( + return list; + } + +-static int match_my_name(unsigned int logopt, const char *name, struct substvar *sv) ++static int match_my_name(struct autofs_point *ap, const char *name, struct substvar *sv) + { + struct addrinfo hints, *cni, *ni, *haddr; + char host[NI_MAXHOST + 1], numeric[NI_MAXHOST + 1]; ++ unsigned int logopt = ap->logopt; + const struct substvar *v; ++ char *exp_name = NULL; + int rv = 0, ret; + ++ if (!expand_selectors(ap, name, &exp_name, sv)) ++ exp_name = strdup(name); ++ if (!exp_name) { ++ error(logopt, ++ MODPREFIX "error: failed to alloc space for name"); ++ goto out; ++ } ++ + v = macro_findvar(sv, "host", 4); + if (v) { +- if (!strcmp(v->val, name)) +- return 1; ++ if (!strcmp(v->val, exp_name)) { ++ rv = 1; ++ goto out; ++ } + } + + if (!v || !v->val) { +@@ -268,11 +280,11 @@ static int match_my_name(unsigned int lo + hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME; + + /* Resolve comparison name to its names and compare */ +- ret = getaddrinfo(name, NULL, &hints, &ni); ++ ret = getaddrinfo(exp_name, NULL, &hints, &ni); + if (ret) { + error(logopt, MODPREFIX + "hostname lookup for %s failed: %s\n", +- name, gai_strerror(ret)); ++ exp_name, gai_strerror(ret)); + freeaddrinfo(cni); + goto out; + } +@@ -310,18 +322,180 @@ next: + freeaddrinfo(ni); + freeaddrinfo(cni); + out: ++ if (exp_name) ++ free(exp_name); + return rv; + } + +-static int eval_selector(unsigned int logopt, ++static int sel_strcmp(struct autofs_point *ap, ++ const struct substvar *v, struct selector *s, ++ struct substvar *sv) ++{ ++ char *expand = NULL; ++ int ret = 0; ++ int res; ++ ++ res = expand_selectors(ap, s->comp.value, &expand, sv); ++ if (res) ++ res = strcmp(v->val, expand); ++ else ++ res = strcmp(v->val, s->comp.value); ++ ++ if (s->compare & SEL_COMP_EQUAL && !res) { ++ debug(ap->logopt, MODPREFIX ++ "matched selector %s(%s) == %s", ++ v->def, v->val, expand ? expand : s->comp.value); ++ ret = 1; ++ } else if (s->compare & SEL_COMP_NOTEQUAL && res) { ++ debug(ap->logopt, MODPREFIX ++ "matched selector %s(%s) != %s", ++ v->def, v->val, expand ? expand : s->comp.value); ++ ret = 1; ++ } else ++ debug(ap->logopt, MODPREFIX ++ "did not match selector %s(%s) %s %s", ++ v->def, v->val, ++ (s->compare & SEL_COMP_EQUAL ? "==" : "!="), ++ expand ? expand : s->comp.value); ++ ++ if (expand) ++ free(expand); ++ ++ return ret; ++} ++ ++static int sel_lstat(struct autofs_point *ap, ++ struct selector *s, struct substvar *sv) ++{ ++ struct stat st; ++ char *expand = NULL; ++ int res, ret; ++ ++ /* Sould be OK to fail on any error here */ ++ res = expand_selectors(ap, s->func.arg1, &expand, sv); ++ if (res) ++ ret = !lstat(expand, &st); ++ else ++ ret = !lstat(s->func.arg1, &st); ++ ++ if (s->compare == SEL_COMP_NOT) ++ ret = !ret; ++ if (ret) ++ debug(ap->logopt, MODPREFIX ++ "matched selector %s(%s)", ++ s->sel->name, expand ? expand : s->func.arg1); ++ else ++ debug(ap->logopt, MODPREFIX ++ "did not match selector %s(%s)", ++ s->sel->name, expand ? expand : s->func.arg1); ++ if (expand) ++ free(expand); ++ ++ return ret; ++} ++ ++static int sel_in_network(struct autofs_point *ap, ++ struct selector *s, struct substvar *sv) ++{ ++ char *expand = NULL; ++ int res, ret; ++ ++ res = expand_selectors(ap, s->func.arg1, &expand, sv); ++ if (!res) ++ ret = in_network(s->func.arg1); ++ else ++ ret = in_network(expand); ++ ++ if (s->compare == SEL_COMP_NOT) ++ ret = !ret; ++ if (ret) ++ debug(ap->logopt, MODPREFIX ++ "matched selector %s(%s)", ++ s->sel->name, expand ? expand : s->func.arg1); ++ else ++ debug(ap->logopt, MODPREFIX ++ "did not match selector %s(%s)", ++ s->sel->name, expand ? expand : s->func.arg1); ++ ++ if (expand) ++ free(expand); ++ ++ return ret; ++} ++ ++static int sel_netgrp(struct autofs_point *ap, ++ struct selector *s, struct substvar *sv) ++{ ++ char *exp_arg1 = NULL, *exp_arg2 = NULL; ++ const struct substvar *v; ++ int res, ret = 0; ++ char *host; ++ ++ if (s->func.arg2) { ++ res = expand_selectors(ap, s->func.arg2, &exp_arg2, sv); ++ if (res) ++ host = exp_arg2; ++ else ++ host = s->func.arg2; ++ } else { ++ if (s->sel->selector == SEL_NETGRP) ++ v = macro_findvar(sv, "host", 4); ++ else ++ v = macro_findvar(sv, "hostd", 5); ++ if (!v || !*v->val) { ++ error(ap->logopt, MODPREFIX ++ "failed to get value of ${host}"); ++ goto out; ++ } ++ host = v->val; ++ } ++ ++ res = expand_selectors(ap, s->func.arg1, &exp_arg1, sv); ++ if (res) ++ ret = innetgr(exp_arg1, host, NULL, NULL); ++ else ++ ret = innetgr(s->func.arg1, host, NULL, NULL); ++ ++ if (s->compare == SEL_COMP_NOT) ++ ret = !ret; ++ if (ret) { ++ if (!s->func.arg2) ++ debug(ap->logopt, MODPREFIX ++ "matched selector %s(%s)", ++ s->sel->name, exp_arg1 ? exp_arg1 : s->func.arg1); ++ else ++ debug(ap->logopt, MODPREFIX ++ "matched selector %s(%s,%s)", s->sel->name, ++ exp_arg1 ? exp_arg1 : s->func.arg1, ++ exp_arg2 ? exp_arg2 : s->func.arg2); ++ } else { ++ if (!s->func.arg2) ++ debug(ap->logopt, MODPREFIX ++ "did not match selector %s(%s)", ++ s->sel->name, exp_arg1 ? exp_arg1 : s->func.arg1); ++ else ++ debug(ap->logopt, MODPREFIX ++ "did not match selector %s(%s,%s)", s->sel->name, ++ exp_arg1 ? exp_arg1 : s->func.arg1, ++ exp_arg2 ? exp_arg2 : s->func.arg2); ++ } ++out: ++ if (exp_arg1) ++ free(exp_arg1); ++ if (exp_arg2) ++ free(exp_arg2); ++ ++ return ret; ++} ++ ++static int eval_selector(struct autofs_point *ap, + struct amd_entry *this, struct substvar *sv) + { + struct selector *s = this->selector; ++ unsigned int logopt = ap->logopt; + const struct substvar *v; + unsigned int s_type; + unsigned int v_type; +- struct stat st; +- char *host; + int res, val, ret = 0; + + s_type = s->sel->flags & SEL_FLAGS_TYPE_MASK; +@@ -339,26 +513,7 @@ static int eval_selector(unsigned int lo + + switch (v_type) { + case SEL_FLAG_STR: +- res = strcmp(v->val, s->comp.value); +- if (s->compare & SEL_COMP_EQUAL && !res) { +- debug(logopt, MODPREFIX +- "matched selector %s(%s) == %s", +- v->def, v->val, s->comp.value); +- ret = 1; +- break; +- } else if (s->compare & SEL_COMP_NOTEQUAL && res) { +- debug(logopt, MODPREFIX +- "matched selector %s(%s) != %s", +- v->def, v->val, s->comp.value); +- ret = 1; +- break; +- } +- +- debug(logopt, MODPREFIX +- "did not match selector %s(%s) %s %s", +- v->def, v->val, +- (s->compare & SEL_COMP_EQUAL ? "==" : "!="), +- s->comp.value); ++ ret = sel_strcmp(ap, v, s, sv); + break; + + case SEL_FLAG_NUM: +@@ -434,7 +589,7 @@ static int eval_selector(unsigned int lo + break; + + case SEL_XHOST: +- ret = match_my_name(logopt, s->func.arg1, sv); ++ ret = match_my_name(ap, s->func.arg1, sv); + if (s->compare == SEL_COMP_NOT) + ret = !ret; + if (ret) +@@ -448,32 +603,11 @@ static int eval_selector(unsigned int lo + break; + + case SEL_EXISTS: +- /* Sould be OK to fail on any error here */ +- ret = !lstat(s->func.arg1, &st); +- if (s->compare == SEL_COMP_NOT) +- ret = !ret; +- if (ret) +- debug(logopt, MODPREFIX +- "matched selector %s(%s)", +- s->sel->name, s->func.arg1); +- else +- debug(logopt, MODPREFIX +- "did not match selector %s(%s)", +- s->sel->name, s->func.arg1); ++ ret = sel_lstat(ap, s, sv); + break; + + case SEL_IN_NETWORK: +- ret = in_network(s->func.arg1); +- if (s->compare == SEL_COMP_NOT) +- ret = !ret; +- if (ret) +- debug(logopt, MODPREFIX +- "matched selector %s(%s)", +- s->sel->name, s->func.arg1); +- else +- debug(logopt, MODPREFIX +- "did not match selector %s(%s)", +- s->sel->name, s->func.arg1); ++ ret = sel_in_network(ap, s, sv); + break; + + default: +@@ -492,43 +626,7 @@ static int eval_selector(unsigned int lo + switch (s->sel->selector) { + case SEL_NETGRP: + case SEL_NETGRPD: +- if (s->func.arg2) +- host = s->func.arg2; +- else { +- if (s->sel->selector == SEL_NETGRP) +- v = macro_findvar(sv, "host", 4); +- else +- v = macro_findvar(sv, "hostd", 5); +- if (!v || !*v->val) { +- error(logopt, MODPREFIX +- "failed to get value of ${host}"); +- break; +- } +- host = v->val; +- } +- ret = innetgr(s->func.arg1, host, NULL, NULL); +- if (s->compare == SEL_COMP_NOT) +- ret = !ret; +- if (ret) { +- if (!s->func.arg2) +- debug(logopt, MODPREFIX +- "matched selector %s(%s)", +- s->sel->name, s->func.arg1); +- else +- debug(logopt, MODPREFIX +- "matched selector %s(%s,%s)", +- s->sel->name, s->func.arg1, +- s->func.arg2); +- } else { +- if (!s->func.arg2) +- debug(logopt, MODPREFIX +- "did not match selector %s(%s)", +- s->sel->name, s->func.arg1); +- else +- debug(logopt, MODPREFIX +- "did not match selector %s(%s,%s)", +- s->sel->name, s->func.arg1, s->func.arg2); +- } ++ ret = sel_netgrp(ap, s, sv); + break; + + default: +@@ -1753,7 +1851,7 @@ static void update_prefix(struct autofs_ + return; + } + +-static int match_selectors(unsigned int logopt, ++static int match_selectors(struct autofs_point *ap, + struct amd_entry *entry, struct substvar *sv) + { + struct selector *s = entry->selector; +@@ -1761,7 +1859,7 @@ static int match_selectors(unsigned int + + /* No selectors, always match */ + if (!s) { +- debug(logopt, MODPREFIX "no selectors found in location"); ++ debug(ap->logopt, MODPREFIX "no selectors found in location"); + return 1; + } + +@@ -1769,7 +1867,7 @@ static int match_selectors(unsigned int + + /* All selectors must match */ + while (s) { +- ret = eval_selector(logopt, entry, sv); ++ ret = eval_selector(ap, entry, sv); + if (!ret) + break; + s = s->next; +@@ -1939,7 +2037,7 @@ static struct amd_entry *select_default_ + if (!this->selector) + continue; + +- if (match_selectors(ap->logopt, this, sv)) { ++ if (match_selectors(ap, this, sv)) { + if (entry_default) { + /*update_with_defaults(entry_default, this, sv);*/ + free_amd_entry(entry_default); +@@ -2192,7 +2290,7 @@ int parse_mount(struct autofs_point *ap, + break; + } + +- if (!match_selectors(ap->logopt, this, sv)) ++ if (!match_selectors(ap, this, sv)) + continue; + + at_least_one = 1; diff --git a/SOURCES/autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch b/SOURCES/autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch new file mode 100644 index 0000000..ee3b686 --- /dev/null +++ b/SOURCES/autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch @@ -0,0 +1,222 @@ +autofs-5.1.5 - log mount call arguments if mount_verbose is set + +From: Lars R. Damerow + +Override the debug log only setting if mount_verbose is set so that +mount parameter information is logged on mount. + +Signed-off-by: Lars R. Damerow +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/mount_afs.c | 6 +++++- + modules/mount_bind.c | 10 +++++++--- + modules/mount_ext2.c | 16 ++++++++++------ + modules/mount_generic.c | 14 +++++++++----- + modules/mount_nfs.c | 29 +++++++++++++++++------------ + 6 files changed, 49 insertions(+), 27 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -49,6 +49,7 @@ xx/xx/2018 autofs-5.1.5 + - use malloc(3) in spawn.c. + - add mount_verbose configuration option. + - optionally log mount requestor process info. ++- log mount call arguments if mount_verbose is set. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/modules/mount_afs.c ++++ autofs-5.1.4/modules/mount_afs.c +@@ -37,10 +37,14 @@ int mount_mount(struct autofs_point *ap, + char dest[PATH_MAX + 1]; + size_t r_len = strlen(root); + size_t d_len = r_len + name_len + 2; ++ void (*mountlog)(unsigned int, const char*, ...) = &log_debug; + + if (ap->flags & MOUNT_FLAG_REMOUNT) + return 0; + ++ if (defaults_get_mount_verbose()) ++ mountlog = &log_info; ++ + if (d_len > PATH_MAX) + return 1; + +@@ -53,7 +57,7 @@ int mount_mount(struct autofs_point *ap, + if (dest[strlen(dest)-1] == '/') + dest[strlen(dest)-1] = '\0'; + +- debug(ap->logopt, MODPREFIX "mounting AFS %s -> %s", dest, what); ++ mountlog(ap->logopt, MODPREFIX "mounting AFS %s -> %s", dest, what); + + return symlink(what, dest); /* Try it. If it fails, return the error. */ + } +--- autofs-5.1.4.orig/modules/mount_bind.c ++++ autofs-5.1.4/modules/mount_bind.c +@@ -81,10 +81,14 @@ int mount_mount(struct autofs_point *ap, + int err; + int i, len; + int symlnk = (*name != '/' && (ap->flags & MOUNT_FLAG_SYMLINK)); ++ void (*mountlog)(unsigned int, const char*, ...) = &log_debug; + + if (ap->flags & MOUNT_FLAG_REMOUNT) + return 0; + ++ if (defaults_get_mount_verbose()) ++ mountlog = &log_info; ++ + /* Extract "symlink" pseudo-option which forces local filesystems + * to be symlinked instead of bound. + */ +@@ -164,9 +168,9 @@ int mount_mount(struct autofs_point *ap, + if (!status) + existed = 0; + +- debug(ap->logopt, MODPREFIX +- "calling mount --bind -o %s %s %s", +- options, what, fullpath); ++ mountlog(ap->logopt, MODPREFIX ++ "calling mount --bind -o %s %s %s", ++ options, what, fullpath); + + err = spawn_bind_mount(ap->logopt, "-o", + options, what, fullpath, NULL); +--- autofs-5.1.4.orig/modules/mount_ext2.c ++++ autofs-5.1.4/modules/mount_ext2.c +@@ -47,10 +47,14 @@ int mount_mount(struct autofs_point *ap, + int err, ro = 0; + const char *fsck_prog; + int len, status, existed = 1; ++ void (*mountlog)(unsigned int, const char*, ...) = &log_debug; + + if (ap->flags & MOUNT_FLAG_REMOUNT) + return 0; + ++ if (defaults_get_mount_verbose()) ++ mountlog = &log_info; ++ + /* Root offset of multi-mount */ + len = strlen(root); + if (root[len - 1] == '/') { +@@ -121,15 +125,15 @@ int mount_mount(struct autofs_point *ap, + } + + if (options) { +- debug(ap->logopt, MODPREFIX +- "calling mount -t %s -o %s %s %s", +- fstype, options, what, fullpath); ++ mountlog(ap->logopt, MODPREFIX ++ "calling mount -t %s -o %s %s %s", ++ fstype, options, what, fullpath); + err = spawn_mount(ap->logopt, "-t", fstype, + "-o", options, what, fullpath, NULL); + } else { +- debug(ap->logopt, +- MODPREFIX "calling mount -t %s %s %s", +- fstype, what, fullpath); ++ mountlog(ap->logopt, ++ MODPREFIX "calling mount -t %s %s %s", ++ fstype, what, fullpath); + err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL); + } + +--- autofs-5.1.4.orig/modules/mount_generic.c ++++ autofs-5.1.4/modules/mount_generic.c +@@ -46,10 +46,14 @@ int mount_mount(struct autofs_point *ap, + char buf[MAX_ERR_BUF]; + int err; + int len, status, existed = 1; ++ void (*mountlog)(unsigned int, const char*, ...) = &log_debug; + + if (ap->flags & MOUNT_FLAG_REMOUNT) + return 0; + ++ if (defaults_get_mount_verbose()) ++ mountlog = &log_info; ++ + /* Root offset of multi-mount */ + len = strlen(root); + if (root[len - 1] == '/') { +@@ -80,15 +84,15 @@ int mount_mount(struct autofs_point *ap, + existed = 0; + + if (options && options[0]) { +- debug(ap->logopt, +- MODPREFIX "calling mount -t %s -o %s %s %s", +- fstype, options, what, fullpath); ++ mountlog(ap->logopt, ++ MODPREFIX "calling mount -t %s -o %s %s %s", ++ fstype, options, what, fullpath); + + err = spawn_mount(ap->logopt, "-t", fstype, + "-o", options, what, fullpath, NULL); + } else { +- debug(ap->logopt, MODPREFIX "calling mount -t %s %s %s", +- fstype, what, fullpath); ++ mountlog(ap->logopt, MODPREFIX "calling mount -t %s %s %s", ++ fstype, what, fullpath); + err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL); + } + +--- autofs-5.1.4.orig/modules/mount_nfs.c ++++ autofs-5.1.4/modules/mount_nfs.c +@@ -77,13 +77,17 @@ int mount_mount(struct autofs_point *ap, + int port = -1; + int ro = 0; /* Set if mount bind should be read-only */ + int rdma = 0; ++ void (*mountlog)(unsigned int, const char*, ...) = &log_debug; + + if (ap->flags & MOUNT_FLAG_REMOUNT) + return 0; + +- debug(ap->logopt, +- MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s", +- root, name, what, fstype, options); ++ if (defaults_get_mount_verbose()) ++ mountlog = &log_info; ++ ++ mountlog(ap->logopt, ++ MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s", ++ root, name, what, fstype, options); + + mount_default_proto = defaults_get_mount_nfs_default_proto(); + vers = NFS_VERS_DEFAULT | NFS_PROTO_DEFAULT; +@@ -203,9 +207,9 @@ int mount_mount(struct autofs_point *ap, + if ((vers & NFS_PROTO_MASK) == 0) + vers |= NFS_PROTO_MASK; + +- debug(ap->logopt, MODPREFIX +- "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d", +- nfsoptions, nobind, nosymlink, ro); ++ mountlog(ap->logopt, MODPREFIX ++ "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d", ++ nfsoptions, nobind, nosymlink, ro); + } + + if (!parse_location(ap->logopt, &hosts, what, flags)) { +@@ -379,17 +383,18 @@ dont_probe: + } + + if (nfsoptions && *nfsoptions) { +- debug(ap->logopt, +- MODPREFIX "calling mount -t %s " SLOPPY +- "-o %s %s %s", fstype, nfsoptions, loc, fullpath); ++ mountlog(ap->logopt, ++ MODPREFIX "calling mount -t %s " SLOPPY ++ "-o %s %s %s", fstype, nfsoptions, loc, ++ fullpath); + + err = spawn_mount(ap->logopt, + "-t", fstype, SLOPPYOPT "-o", + nfsoptions, loc, fullpath, NULL); + } else { +- debug(ap->logopt, +- MODPREFIX "calling mount -t %s %s %s", +- fstype, loc, fullpath); ++ mountlog(ap->logopt, ++ MODPREFIX "calling mount -t %s %s %s", ++ fstype, loc, fullpath); + err = spawn_mount(ap->logopt, + "-t", fstype, loc, fullpath, NULL); + } diff --git a/SOURCES/autofs-5.1.5-make-expire-remaining-log-level-debug.patch b/SOURCES/autofs-5.1.5-make-expire-remaining-log-level-debug.patch new file mode 100644 index 0000000..4d115ea --- /dev/null +++ b/SOURCES/autofs-5.1.5-make-expire-remaining-log-level-debug.patch @@ -0,0 +1,55 @@ +autofs-5.1.5 - make expire remaining log level debug + +From: Ian Kent + +The log message listing the remaining mounts should be log level +debug not info. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 2 +- + daemon/indirect.c | 4 ++-- + 3 files changed, 4 insertions(+), 3 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -50,6 +50,7 @@ xx/xx/2018 autofs-5.1.5 + - add mount_verbose configuration option. + - optionally log mount requestor process info. + - log mount call arguments if mount_verbose is set. ++- make expire remaining log level debug. + + 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 +@@ -990,7 +990,7 @@ void *expire_proc_direct(void *arg) + pthread_cleanup_pop(1); + + if (left) +- info(ap->logopt, "%d remaining in %s", left, ap->path); ++ debug(ap->logopt, "%d remaining in %s", left, ap->path); + + ec.status = left; + +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -578,7 +578,7 @@ void *expire_proc_indirect(void *arg) + pthread_cleanup_pop(1); + + if (submnts) +- info(ap->logopt, ++ debug(ap->logopt, + "%d submounts remaining in %s", submnts, ap->path); + + /* +@@ -586,7 +586,7 @@ void *expire_proc_indirect(void *arg) + * words) the umounts are done by the time we reach here + */ + if (count) +- info(ap->logopt, "%d remaining in %s", count, ap->path); ++ debug(ap->logopt, "%d remaining in %s", count, ap->path); + + ec.status = left; + diff --git a/SOURCES/autofs-5.1.5-optionally-log-mount-requestor-process-info.patch b/SOURCES/autofs-5.1.5-optionally-log-mount-requestor-process-info.patch new file mode 100644 index 0000000..d731970 --- /dev/null +++ b/SOURCES/autofs-5.1.5-optionally-log-mount-requestor-process-info.patch @@ -0,0 +1,155 @@ +autofs-5.1.5 - optionally log mount requestor process info + +From: Lars R. Damerow + +This information can be helpful to determine who or what is making +particular mount requests, especially when used in conjunction with +the use_mount_request_log_id option. + +Signed-off-by: Lars R. Damerow +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 6 ++++++ + daemon/indirect.c | 6 ++++++ + include/log.h | 2 ++ + lib/log.c | 39 +++++++++++++++++++++++++++++++++++++++ + man/autofs.conf.5.in | 3 ++- + redhat/autofs.conf.default.in | 4 +++- + samples/autofs.conf.default.in | 4 +++- + 8 files changed, 62 insertions(+), 3 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -48,6 +48,7 @@ xx/xx/2018 autofs-5.1.5 + - add NULL check for get_addr_string() return. + - use malloc(3) in spawn.c. + - add mount_verbose configuration option. ++- optionally log mount requestor process info. + + 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 +@@ -1242,6 +1242,12 @@ static void *do_mount_direct(void *arg) + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state); + ++ if (defaults_get_mount_verbose()) { ++ pid_t ppid = log_pidinfo(ap, mt.pid, "requestor"); ++ if (ppid > 0) ++ log_pidinfo(ap, ppid, "parent"); ++ } ++ + status = fstat(mt.ioctlfd, &st); + if (status == -1) { + error(ap->logopt, +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -758,6 +758,12 @@ static void *do_mount_indirect(void *arg + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state); + ++ if (defaults_get_mount_verbose()) { ++ pid_t ppid = log_pidinfo(ap, mt.pid, "requestor"); ++ if (ppid > 0) ++ log_pidinfo(ap, ppid, "parent"); ++ } ++ + len = ncat_path(buf, sizeof(buf), ap->path, mt.name, mt.len); + if (!len) { + crit(ap->logopt, "path to be mounted is to long"); +--- autofs-5.1.4.orig/include/log.h ++++ autofs-5.1.4/include/log.h +@@ -46,6 +46,8 @@ extern void log_crit(unsigned, const cha + extern void log_debug(unsigned int, const char* msg, ...); + extern void logmsg(const char* msg, ...); + ++extern pid_t log_pidinfo(struct autofs_point *ap, pid_t pid, char *label); ++ + #define debug(opt, msg, args...) \ + do { log_debug(opt, "%s: " msg, __FUNCTION__, ##args); } while (0) + +--- autofs-5.1.4.orig/lib/log.c ++++ autofs-5.1.4/lib/log.c +@@ -325,3 +325,42 @@ void log_to_stderr(void) + + return; + } ++ ++pid_t log_pidinfo(struct autofs_point *ap, pid_t pid, char *label) { ++ char buf[PATH_MAX + 1] = ""; ++ FILE *statfile; ++ ++ pid_t tgid, ppid; ++ int uid, euid, gid, egid; ++ char comm[64] = ""; ++ ++ sprintf(buf, "/proc/%d/status", pid); ++ statfile = fopen(buf, "r"); ++ if (statfile == NULL) { ++ info(ap->logopt, "pidinfo %s: failed to open %s", label, buf); ++ return -1; ++ } ++ ++ while (fgets(buf, sizeof(buf), statfile) != NULL) { ++ if (strncmp(buf, "Name:", 5) == 0) { ++ sscanf(buf, "Name:\t%s", (char *) &comm); ++ } else if (strncmp(buf, "Tgid:", 5) == 0) { ++ sscanf(buf, "Tgid:\t%d", (int *) &tgid); ++ } else if (strncmp(buf, "PPid:", 5) == 0) { ++ sscanf(buf, "PPid:\t%d", (int *) &ppid); ++ } else if (strncmp(buf, "Uid:", 4) == 0) { ++ sscanf(buf, ++ "Uid:\t%d\t%d", (int *) &uid, (int *) &euid); ++ } else if (strncmp(buf, "Gid:", 4) == 0) { ++ sscanf(buf, ++ "Gid:\t%d\t%d", (int *) &gid, (int *) &egid); ++ } ++ } ++ fclose(statfile); ++ ++ info(ap->logopt, ++ "pidinfo %s: pid:%d comm:%s tgid:%d uid:%d euid:%d gid:%d egid:%d", ++ label, pid, comm, tgid, uid, euid, gid, egid); ++ ++ return ppid; ++} +--- autofs-5.1.4.orig/man/autofs.conf.5.in ++++ autofs-5.1.4/man/autofs.conf.5.in +@@ -43,7 +43,8 @@ setting. + .TP + .B mount_verbose + .br +-Use the verbose flag when spawning mount(8) (program default "no"). ++Use the verbose flag when spawning mount(8), and log some process info ++about the requestor and its parent (program default "no"). + .TP + .B mount_wait + .br +--- autofs-5.1.4.orig/redhat/autofs.conf.default.in ++++ autofs-5.1.4/redhat/autofs.conf.default.in +@@ -26,7 +26,9 @@ timeout = 300 + # + #negative_timeout = 60 + # +-# mount_verbose - use the -v flag when calling mount(8). ++# mount_verbose - use the -v flag when calling mount(8) and log some ++# process information about the requestor and its ++# parent. + # + #mount_verbose = no + # +--- autofs-5.1.4.orig/samples/autofs.conf.default.in ++++ autofs-5.1.4/samples/autofs.conf.default.in +@@ -26,7 +26,9 @@ timeout = 300 + # + #negative_timeout = 60 + # +-# mount_verbose - use the -v flag when calling mount(8). ++# mount_verbose - use the -v flag when calling mount(8) and log some ++# process information about the requestor and its ++# parent. + # + #mount_verbose = no + # diff --git a/SOURCES/autofs-5.1.5-use-malloc-in-spawn_c.patch b/SOURCES/autofs-5.1.5-use-malloc-in-spawn_c.patch new file mode 100644 index 0000000..72634af --- /dev/null +++ b/SOURCES/autofs-5.1.5-use-malloc-in-spawn_c.patch @@ -0,0 +1,161 @@ +autofs-5.1.5 - use malloc(3) in spawn.c + +From: Ian Kent + +Use malloc(3) in spawn.c functions instead of alloca(3) as a failure +return for this function is undefined. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/spawn.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------ + 2 files changed, 45 insertions(+), 6 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -46,6 +46,7 @@ xx/xx/2018 autofs-5.1.5 + - add systemd service command line option. + - support strictexpire mount option. + - add NULL check for get_addr_string() return. ++- use malloc(3) in spawn.c. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/spawn.c ++++ autofs-5.1.4/daemon/spawn.c +@@ -521,22 +521,33 @@ int spawnv(unsigned logopt, const char * + int spawnl(unsigned logopt, const char *prog, ...) + { + va_list arg; +- int argc; ++ int argc, ret; + char **argv, **p; ++ unsigned int argv_len; + + va_start(arg, prog); + for (argc = 1; va_arg(arg, char *); argc++); + va_end(arg); + +- if (!(argv = alloca(sizeof(char *) * argc))) ++ argv_len = sizeof(char *) * (argc + 1); ++ argv = malloc(argv_len); ++ if (!argv) { ++ char buf[MAX_ERR_BUF]; ++ char *estr = strerror_r(errno, buf, sizeof(buf)); ++ crit(logopt, "malloc: %s", estr); + return -1; ++ } ++ memset(argv, 0, argv_len); + + va_start(arg, prog); + p = argv; + while ((*p++ = va_arg(arg, char *))); + va_end(arg); + +- return do_spawn(logopt, -1, SPAWN_OPT_NONE, prog, (const char **) argv); ++ ret = do_spawn(logopt, -1, SPAWN_OPT_NONE, prog, (const char **) argv); ++ free(argv); ++ ++ return ret; + } + + int spawn_mount(unsigned logopt, ...) +@@ -554,6 +565,7 @@ int spawn_mount(unsigned logopt, ...) + int update_mtab = 1, ret, printed = 0; + unsigned int wait = defaults_get_mount_wait(); + char buf[PATH_MAX + 1]; ++ unsigned int argv_len; + + /* If we use mount locking we can't validate the location */ + #ifdef ENABLE_MOUNT_LOCKING +@@ -579,8 +591,15 @@ int spawn_mount(unsigned logopt, ...) + } + + /* Alloc 1 extra slot in case we need to use the "-f" option */ +- if (!(argv = alloca(sizeof(char *) * (argc + 2)))) ++ argv_len = sizeof(char *) * (argc + 2); ++ argv = malloc(argv_len); ++ if (!argv) { ++ char buf[MAX_ERR_BUF]; ++ char *estr = strerror_r(errno, buf, sizeof(buf)); ++ crit(logopt, "malloc: %s", estr); + return -1; ++ } ++ memset(argv, 0, argv_len); + + argv[0] = arg0; + +@@ -655,6 +674,7 @@ int spawn_mount(unsigned logopt, ...) + umount(argv[argc]); + ret = MNT_FORCE_FAIL; + } ++ free(argv); + + return ret; + } +@@ -683,6 +703,7 @@ int spawn_bind_mount(unsigned logopt, .. + int update_mtab = 1, ret, printed = 0; + unsigned int wait = defaults_get_mount_wait(); + char buf[PATH_MAX + 1]; ++ unsigned int argv_len; + + /* If we use mount locking we can't validate the location */ + #ifdef ENABLE_MOUNT_LOCKING +@@ -711,8 +732,15 @@ int spawn_bind_mount(unsigned logopt, .. + } + } + +- if (!(argv = alloca(sizeof(char *) * (argc + 2)))) ++ argv_len = sizeof(char *) * (argc + 2); ++ argv = malloc(argv_len); ++ if (!argv) { ++ char buf[MAX_ERR_BUF]; ++ char *estr = strerror_r(errno, buf, sizeof(buf)); ++ crit(logopt, "malloc: %s", estr); + return -1; ++ } ++ memset(argv, 0, argv_len); + + argv[0] = arg0; + argv[1] = bind; +@@ -774,6 +802,7 @@ int spawn_bind_mount(unsigned logopt, .. + umount(argv[argc]); + ret = MNT_FORCE_FAIL; + } ++ free(argv); + + return ret; + } +@@ -796,6 +825,7 @@ int spawn_umount(unsigned logopt, ...) + int update_mtab = 1, ret, printed = 0; + unsigned int wait = defaults_get_umount_wait(); + char buf[PATH_MAX + 1]; ++ unsigned int argv_len; + + #ifdef ENABLE_MOUNT_LOCKING + options = SPAWN_OPT_LOCK; +@@ -821,8 +851,15 @@ int spawn_umount(unsigned logopt, ...) + if (arg_c) + argc++;; + +- if (!(argv = alloca(sizeof(char *) * (argc + 1)))) ++ argv_len = sizeof(char *) * (argc + 1); ++ argv = malloc(argv_len); ++ if (!argv) { ++ char buf[MAX_ERR_BUF]; ++ char *estr = strerror_r(errno, buf, sizeof(buf)); ++ crit(logopt, "malloc: %s", estr); + return -1; ++ } ++ memset(argv, 0, argv_len); + + p = argv; + *p++ = arg0; +@@ -870,6 +907,7 @@ int spawn_umount(unsigned logopt, ...) + "and /etc/mtab will differ"); + ret = 0; + } ++ free(argv); + + return ret; + } diff --git a/SPECS/autofs.spec b/SPECS/autofs.spec new file mode 100644 index 0000000..389fd3d --- /dev/null +++ b/SPECS/autofs.spec @@ -0,0 +1,2303 @@ +# +# $Id: autofs.spec,v 1.11 2003/12/04 15:41:32 raven Exp $ +# +# Use --without systemd in your rpmbuild command or force values to 0 to +# disable them. +%define with_systemd %{?_without_systemd: 0} %{?!_without_systemd: 1} + +Summary: A tool for automatically mounting and unmounting filesystems +Name: autofs +Version: 5.1.4 +Release: 35%{?dist} +Epoch: 1 +License: GPLv2+ +Group: System Environment/Daemons +Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.gz +Patch1: autofs-5.1.4-fix-flag-file-permission.patch +Patch2: autofs-5.1.4-fix-directory-create-permission.patch +Patch3: autofs-5.1.4-fix-use-after-free-in-do_master_list_reset.patch +Patch4: autofs-5.1.4-fix-deadlock-in-dumpmaps.patch +Patch5: autofs-5.1.4-dont-use-array-for-path-when-not-neccessary.patch +Patch6: autofs-5.1.4-fix-prefix-option-handling-in-expand_entry.patch +Patch7: autofs-5.1.4-fix-sublink-option-not-set-from-defaults.patch +Patch8: autofs-5.1.4-fix-error-return-in-do_nfs_mount.patch +Patch9: autofs-5.1.4-add-error-handling-for-ext_mount_add.patch +Patch10: autofs-5.1.4-account-for-libnsl-changes.patch +Patch11: autofs-5.1.4-use_hostname_for_mounts-shouldnt-prevent-selection-among-replicas.patch +Patch12: autofs-5.1.4-fix-monotonic_elapsed.patch +Patch13: autofs-5.1.4-Makefiles.rules-remove-samples-from-SUBDIRS.patch +Patch14: autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch +Patch15: autofs-5.1.4-fix-libresolv-configure-check.patch +Patch16: autofs-5.1.4-add-fedfs-getsrvinfo_c.patch +Patch17: autofs-5.1.4-add-mount_fedfs_c.patch +Patch18: autofs-5.1.4-add-fedfs-map-nfs4_c.patch +Patch19: autofs-5.1.4-add-conditional-inclusion-of-fedfs-binaries.patch +Patch20: autofs-5.1.4-add-an-example-fedfs-master-map-entry-to-the-installed-master-map.patch +Patch21: autofs-5.1.4-improve-hostname-lookup-error-logging.patch +Patch22: autofs-5.1.4-tiny-patch-for-autofs-typo-and-possible-bug.patch +Patch23: autofs-5.1.4-add-units-After-line-to-include-statd-service.patch +Patch24: autofs-5.1.4-use-systemd-sd_notify-at-startup.patch +Patch25: autofs-5.1.4-fix-NFS-version-mask-usage.patch +Patch26: autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch +Patch27: autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch +Patch28: autofs-5.1.4-covarity-fixes-1.patch +Patch29: autofs-5.1.4-fix-program-usage-message.patch +Patch30: autofs-5.1.4-fix-update_negative_cache-map-source-usage.patch +Patch31: autofs-5.1.4-mark-removed-cache-entry-negative.patch +Patch32: autofs-5.1.4-set-bind-mount-as-propagation-slave.patch +Patch33: autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch +Patch34: autofs-5.1.4-fix-age-setting-at-startup.patch +Patch35: autofs-5.1.4-fix-use-after-free-in-parse_ldap_config.patch +Patch36: autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch +Patch37: autofs-5.1.4-fix-amd-parser-opts-option-handling.patch +Patch38: autofs-5.1.4-better-handle-hesiod-support-not-built-in.patch +Patch39: autofs-5.1.5-fix-hesiod-string-check-in-master_parse.patch + +Patch40: autofs-5.1.4-remove-autofs4-module-load-code.patch +Patch41: autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch +Patch42: autofs-5.1.4-update-build-info-with-systemd.patch +Patch43: autofs-5.1.4-use-flags-for-startup-boolean-options.patch +Patch44: autofs-5.1.4-move-close-stdio-descriptors-to-become_daemon.patch +Patch45: autofs-5.1.4-add-systemd-service-command-line-option.patch +Patch46: autofs-5.1.5-add-strictexpire-mount-option.patch +Patch47: autofs-5.1.5-add-NULL-check-for-get_addr_string-return.patch +Patch48: autofs-5.1.5-use-malloc-in-spawn_c.patch +Patch49: autofs-5.1.5-add-mount_verbose-configuration-option.patch +Patch50: autofs-5.1.5-optionally-log-mount-requestor-process-info.patch +Patch51: autofs-5.1.5-log-mount-call-arguments-if-mount_verbose-is-set.patch +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 + +%if %{with_systemd} +BuildRequires: systemd-units +BuildRequires: systemd-devel +%endif +BuildRequires: gcc +BuildRequires: autoconf, openldap-devel, bison, flex, libxml2-devel +BuildRequires: cyrus-sasl-devel, openssl-devel module-init-tools util-linux +BuildRequires: e2fsprogs libtirpc-devel libsss_autofs libnsl2-devel +BuildRequires: rpcgen pkgconfig +Conflicts: cyrus-sasl-lib < 2.1.23-9 +Requires: bash coreutils sed gawk grep module-init-tools /bin/ps +%if %{with_systemd} +Requires(post): systemd-sysv +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units +%else +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/service +Requires(postun): /sbin/service +Requires(postun): /sbin/chkconfig +%endif +Summary(de): autofs daemon +Summary(fr): démon autofs +Summary(tr): autofs sunucu süreci +Summary(sv): autofs-daemon + +%description +autofs is a daemon which automatically mounts filesystems when you use +them, and unmounts them later when you are not using them. This can +include network filesystems, CD-ROMs, floppies, and so forth. + +%description -l de +autofs ist ein Dämon, der Dateisysteme automatisch montiert, wenn sie +benutzt werden, und sie später bei Nichtbenutzung wieder demontiert. +Dies kann Netz-Dateisysteme, CD-ROMs, Disketten und ähnliches einschließen. + +%description -l fr +autofs est un démon qui monte automatiquement les systèmes de fichiers +lorsqu'on les utilise et les démonte lorsqu'on ne les utilise plus. Cela +inclus les systèmes de fichiers réseau, les CD-ROMs, les disquettes, etc. + +%description -l tr +autofs, kullanýlan dosya sistemlerini gerek olunca kendiliðinden baðlar +ve kullanýmlarý sona erince yine kendiliðinden çözer. Bu iþlem, að dosya +sistemleri, CD-ROM'lar ve disketler üzerinde yapýlabilir. + +%description -l sv +autofs är en daemon som mountar filsystem när de använda, och senare +unmountar dem när de har varit oanvända en bestämd tid. Detta kan +inkludera nätfilsystem, CD-ROM, floppydiskar, och så vidare. + +%prep +%setup -q -n %{name}-%{version} +echo %{version}-%{release} > .version +%if %{with_systemd} + %define unitdir %{?_unitdir:/usr/lib/systemd/system} + %define systemd_configure_arg --with-systemd +%endif +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 + +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 +%patch48 -p1 +%patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 + +%build +LDFLAGS=-Wl,-z,now +%configure --disable-mount-locking --enable-ignore-busy --with-libtirpc --without-hesiod %{?systemd_configure_arg:} +make initdir=%{_initrddir} DONTSTRIP=1 + +%install +%if %{with_systemd} +install -d -m 755 $RPM_BUILD_ROOT%{unitdir} +%else +mkdir -p -m755 $RPM_BUILD_ROOT%{_initrddir} +%endif +mkdir -p -m755 $RPM_BUILD_ROOT%{_sbindir} +mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}/autofs +mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/{man5,man8} +mkdir -p -m755 $RPM_BUILD_ROOT/etc/sysconfig +mkdir -p -m755 $RPM_BUILD_ROOT/etc/auto.master.d + +make install mandir=%{_mandir} initdir=%{_initrddir} systemddir=%{unitdir} INSTALLROOT=$RPM_BUILD_ROOT +echo make -C redhat +make -C redhat +install -m 755 -d $RPM_BUILD_ROOT/misc +%if %{with_systemd} +# Configure can get this wrong when the unit files appear under /lib and /usr/lib +find $RPM_BUILD_ROOT -type f -name autofs.service -exec rm -f {} \; +install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{unitdir}/autofs.service +%define init_file_name %{unitdir}/autofs.service +%else +install -m 755 redhat/autofs.init $RPM_BUILD_ROOT%{_initrddir}/autofs +%define init_file_name /etc/rc.d/init.d/autofs +%endif +install -m 644 redhat/autofs.conf $RPM_BUILD_ROOT/etc/autofs.conf +install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs + +install -m 644 samples/auto.master $RPM_BUILD_ROOT/etc/auto.master +install -m 644 samples/auto.misc $RPM_BUILD_ROOT/etc/auto.misc +install -m 755 samples/auto.net $RPM_BUILD_ROOT/etc/auto.net +install -m 755 samples/auto.smb $RPM_BUILD_ROOT/etc/auto.smb +install -m 600 samples/autofs_ldap_auth.conf $RPM_BUILD_ROOT/etc/autofs_ldap_auth.conf + +%post +%if %{with_systemd} +%systemd_post %{name}.service +%else +if [ $1 -eq 1 ]; then + %{_sbindir}/sbin/chkconfig --add autofs +fi +%endif + +%preun +%if %{with_systemd} +%systemd_preun %{name}.service +%else +if [ $1 -eq 0 ] ; then + %{_sbindir}/service autofs stop > /dev/null 2>&1 || : + %{_sbindir}/chkconfig --del autofs +fi +%endif + +%postun +%if %{with_systemd} +%systemd_postun_with_restart %{name}.service +%else +if [ $1 -ge 1 ] ; then + %{_sbindir}/sbin/service autofs condrestart > /dev/null 2>&1 || : +fi +%endif + +%triggerun -- %{name} < 5.0.6-5 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply %{name} +# to migrate them to systemd targets +%{_bindir}/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +%{_sbindir}/chkconfig --del %{name} >/dev/null 2>&1 || : +%{_bindir}/systemctl try-restart %{name}.service >/dev/null 2>&1 || : + +%files +%doc CREDITS INSTALL COPY* README* samples/ldap* samples/autofs.schema +%config %{init_file_name} +%config(noreplace,missingok) /etc/auto.master +%config(noreplace) /etc/autofs.conf +%config(noreplace,missingok) /etc/auto.misc +%config(noreplace,missingok) /etc/auto.net +%config(noreplace,missingok) /etc/auto.smb +%config(noreplace) /etc/sysconfig/autofs +%config(noreplace) /etc/autofs_ldap_auth.conf +%{_sbindir}/automount +%{_mandir}/*/* +%{_libdir}/autofs/ +%dir /etc/auto.master.d + +%changelog +* 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. +- Related: rhbz#1681956 + +* Thu Jun 13 2019 Ian Kent - 5.1.4-34 +- bz1681956 - autofs changes blocked until gating tests are added + - add gating.yaml for manual gate testing. +- Related: rhbz#1681956 + +* Tue May 21 2019 Ian Kent - 5.1.4-33 +- bz1689466 - Sanitize autofs logging + - make expire remaining log level debug. +- bz1685805 - autofs doesn't expand macros in amd map selectors + - allow period following macro in selector value. + - fix macro expansion in selector values. +- Resolves: rhbz#1689466 rhbz#1685805 + +* Mon Apr 29 2019 Ian Kent - 5.1.4-32 +- bz1703876 - [RFE] Enable additional logging information for autofs + - add NULL check for get_addr_string() return. + - use malloc(3) in spawn.c. + - add mount_verbose configuration option. + - optionally log mount requestor process info. + - log mount call arguments if mount_verbose is set. +- Resolves: rhbz#1703876 + +* Mon Apr 29 2019 Ian Kent - 5.1.4-31 +- bz1689467 - path_resolution on an autofs managed path resets the timer. Can + this be made configurable? + - support strictexpire mount option. +- Resolves: rhbz#1689467 + +* Tue Apr 23 2019 Ian Kent - 5.1.4-30 +- bz1689469 - [autofs] The log no longer print PID of automount process + - remove autofs4 module load code. + - add NULL check in prepare_attempt_prefix(). + - update build info with systemd. + - use flags for startup boolean options. + - move close stdio descriptors to become_daemon(). + - add systemd service command line option. +- Resolves: rhbz#1689469 + +* Mon Dec 03 2018 Ian Kent - 5.1.4-29 +- bz1654541 - autofs crash when parsing master map + - fix hesiod string check in master_parse(). +- Resolves: rhbz#1654541 + +* Fri Oct 19 2018 Ian Kent - 5.1.4-28 +- bz1638487 - Drop dependency on hesiod + - actually update the spec file with the hesiod removal. +- Related: rhbz#1638487 + +* Fri Oct 19 2018 Ian Kent - 5.1.4-27 +- bz1638487 - Drop dependency on hesiod + - better handle hesiod support not built in. + - exclude hesiod support from configure options + - remove hesiod depends. +- Resolves: rhbz#1638487 + +* Thu Sep 27 2018 Ian Kent - 5.1.4-26 +- bz1630190 - yum update hanging while restarting autofs + - fix incorrect locking in sss lookup. +- bz1630194 - after upgrading to autofs-5.0.7-83.el7.x86_64 on + RHEL 7 clients, amd maps /defaults key mount options are no + longer working + - fix amd parser opts option handling. +- Resolves: rhbz#1630190 rhbz#1630194 + +* Fri Aug 24 2018 Ian Kent - 5.1.4-24 +- bz1621938 - autofs can no longer get maps from IPA server + - fix use after free in parse_ldap_config(). +- Resolves: rhbz#1621938 + +* Tue Aug 14 2018 Ian Kent - 5.1.4-23 +- bz1615782 - autofs master map age is incorrectly set + - fix age setting at startup. +- Resolves: rhbz#1615782 + +* Tue Aug 14 2018 Ian Kent - 5.1.4-22 +- bz1613630 - On Red Hat 7.x systems if you try to access local + filesystems using the automounter through /net then the shell + and mount could lock up *if* the filesystem your accessing is + double exported. + - set bind mount as propagation slave. + - add master map pseudo options for mount propagation. +- Resolves: rhbz#1613630 + +* Mon Aug 13 2018 Ian Kent - 1:5.1.4-21 +- bz1611866 - autofs reload is unable to activate new map entries, + it is autofs restart which shows new map entries. + - fix update_negative_cache() map source usage. +- bz1613621 - [autofs]Removed entries still can be accessed + - mark removed cache entry negative. +- Resolves: rhbz#1611866 rhbz#1613621 + +* Mon Aug 06 2018 Ian Kent - 1:5.1.4-20 +- bz1612565 - Man page scan results for autofs + - fix program usage message. +- Resolves: rhbz#1612565 + +* Fri Jul 20 2018 Ian Kent - 1:5.1.4-19 +- bz1602447 - Please review important issues found by covscan in + "autofs-5.1.4-18.el8+7" + - covarity fixes. +-Resolves: rhbz#1602447 + +* Mon Jun 25 2018 Ian Kent - 1:5.1.4-18 +- bz1593492 - Ignore trailing slashes at the end of executable maps in + auto.master config file + - add-man page note about extra slashes in paths +- Resolves: rhbz#1593492 + +* Thu Jun 21 2018 Ian Kent - 1:5.1.4-17 +- bz1577700 - automount leaves FDs in half-open state + - fix fd leak in rpc_do_create_client(). +- Resolves: rhbz#1577700 + +* Mon Mar 26 2018 Ian Kent - 1:5.1.4-16 +- tiny patch for autofs typo and possible bug. +- add units After line to include statd service. +- use systemd sd_notify() at startup. +- add "BuildRequires: systemd-devel". +- fix NFS version mask usage. +- fix incorrect date in changelog. + +* Tue Mar 06 2018 Ian Kent - 1:5.1.4-14 +- improve hostname lookup error logging. + +* Tue Mar 06 2018 Ian Kent - 1:5.1.4-13 +- fix install permissions of auto.net and auto.smb. + +* Mon Feb 19 2018 Ian Kent - 1:5.1.4-12 +- dont allow trailing slash in master map mount points. +- fix libresolv configure check. +- add fedfs-getsrvinfo.c. +- add mount.fedfs.c. +- add fedfs-map-nfs4.c +- add conditional inclusion of fedfs binaries. +- add an example fedfs master map entry to the installed master map. + +* Fri Feb 09 2018 Igor Gnatenko - 1:5.1.4-11 +- Escape macros in %%changelog + +* Fri Feb 9 2018 Ian Kent - 1:5.1.4-10 +- clean up obsolete spec file directives. + +* Wed Feb 7 2018 Ian Kent - 1:5.1.4-9 +- fix install mode of autofs_ldap_auth.conf. + +* Tue Feb 6 2018 Ian Kent - 1:5.1.4-8 +- add missing BuildRequires. + +* Mon Feb 5 2018 Ian Kent - 1:5.1.4-7 +- add error handling for ext_mount_add(). +- account for recent libnsl changes. +- use_hostname_for_mounts shouldn't prevent selection among replicas. +- fix monotonic_elapse. +- Makefiles.rules: remove 'samples' from SUBDIRS. + +* Thu Feb 1 2018 Ian Kent - 1:5.1.4-6 +- dont use array for path when not necessary. +- fix prefix option handling in expand_entry(). +- fix sublink option not set from defaults. +- fix error return in do_nfs_mount(). + +* Wed Jan 10 2018 Ian Kent - 1:5.1.4-5 +- actually apply fix use after free in do_master_list_reset(). +- fix deadlock in dumpmaps. +- fix rpcgen dependency problem. + +* Fri Dec 22 2017 Ian Kent - 1:5.1.4-4 +- fix use after free in do_master_list_reset(). + +* Wed Dec 20 2017 Ian Kent - 1:5.1.4-3 +- fix email in last two changelog entries. + +* Tue Dec 19 2017 Ian Kent - 1:5.1.4-2 +- fix flag file permission. +- fix directory create permission. + +* Tue Dec 19 2017 Ian Kent - 1:5.1.4-1 +- Update to upstream 5.1.4 release. + +* Tue Nov 07 2017 Igor Gnatenko - 1:5.1.3-5 +- Remove old crufty coreutils requires + +* Wed Aug 02 2017 Fedora Release Engineering - 1:5.1.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1:5.1.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon May 29 2017 Ian Kent - 1:5.1.3-2 +- Fix "Source:" URL and changelog anotations. + +* Mon May 29 2017 Ian Kent - 1:5.1.3-1 +- update to upstream 5.1.3 release. + +* Fri Feb 10 2017 Fedora Release Engineering - 1:5.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Jun 15 2016 Fedora Release Engineering - 1:5.1.2-1 +- update to upstream 5.1.2 release. + +* Wed Feb 03 2016 Fedora Release Engineering - 1:5.1.1-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jan 20 2016 Ian Kent - 1:5.1.1-21 +- add some new upstream memory leak and use after free bug fixes. + +* Wed Jan 20 2016 Ian Kent - 1:5.1.1-20 +- fix incorrect committer changelog entries. +- add current released upstream patches. + +* Wed Nov 04 2015 Ian Kent - 1:5.1.1-7 +- revert fix libtirpc name clash patch (an old 5.0.6 patch). + +* Wed Nov 04 2015 Ian Kent - 1:5.1.1-6 +- remove unnecessary nfs-utils BuildRequires (bz1277669). + +* Mon Nov 02 2015 Ian Kent - 1:5.1.1-5 +- fix fix gcc5 complaints. +- update libtirpc workaround for new soname. + +* Sun Nov 01 2015 Kalev Lember - 1:5.1.1-4 +- Rebuilt for libtirpc soname bump + +* Wed Jun 17 2015 Fedora Release Engineering - 1:5.1.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Fri Jun 12 2015 Ian Kent - 1:5.1.1-2 +- add build requires for gcc. + +* Thu Apr 23 2015 Ian Kent - 1:5.1.1-1 +- Update to autofs-5.1.1. + +* Mon Mar 23 2015 Ian Kent - 1:5.1.0-12 +- fix gcc5 complaints (bz1204685). + +* Mon Mar 23 2015 Peter Robinson 1:5.1.0-11 +- Drop ancient 2.6 kernel patches from docs + +* Wed Jan 21 2015 Ian Kent - 1:5.1.0-10 +- make negative cache update consistent for all lookup modules. +- ensure negative cache isn't updated on remount. +- dont add wildcard to negative cache. +- make service want network-online (bz1071591). + +* Tue Nov 18 2014 Ian Kent - 1:5.1.0-9 +- fix custom autofs.conf not being installed. +- init qdn before use in get_query_dn(). +- fix typo in update_hosts_mounts(). +- fix hosts map update on reload. + + +* Fri Oct 17 2014 Ian Kent - 1:5.1.0-8 +- fix fix master map type check. + +* Wed Oct 15 2014 Ian Kent - 1:5.1.0-7 +- force disable browse mode for amd format maps. +- fix hosts map options check in lookup_amd_instance(). +- fix memory leak in create_client(). +- fix memory leak in get_exports(). +- fix memory leak in get_defaults_entry(). +- fix out of order clearing of options buffer. +- fix reset amd lexer scan buffer. +- ignore multiple commas in options strings. +- fix typo in flagdir configure option. +- clarify multiple mounts description. +- gaurd against incorrect umount return. +- update man page autofs(8) for systemd. +- remove ancient kernel Requires. + +* Fri Aug 15 2014 Fedora Release Engineering - 1:5.1.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Tue Jul 8 2014 Ian Kent - 1:5.1.0-5 +- rename two incorrectly named patches. +- add missing change entry to another patch. + +* Mon Jul 7 2014 Ian Kent - 1:5.1.0-4 +- add mutex call return check in defaults.c. + +* Mon Jul 7 2014 Ian Kent - 1:5.1.0-3 +- fix compile error in defaults.c. +- add serialization to sasl init. +- dont allocate dev_ctl_ops too early. +- fix incorrect round robin host detection. +- fix race accessing qdn in get_query_dn(). +- fix leak in cache_push_mapent(). +- fix config entry read buffer not checked. +- fix FILE pointer check in defaults_read_config(). +- fix memory leak in conf_amd_get_log_options(). +- fix signed comparison in inet_fill_net(). +- fix buffer size checks in get_network_proximity(). +- fix leak in get_network_proximity(). +- fix buffer size checks in merge_options(). +- check amd lex buffer len before copy. +- add return check in ldap check_map_indirect(). +- check host macro is set before use. +- check options length before use in parse_amd.c. +- fix some out of order evaluations in parse_amd.c. +- fix copy and paste error in dup_defaults_entry(). + +* Sat Jun 07 2014 Fedora Release Engineering - 1:5.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu Jun 5 2014 Ian Kent - 1:5.1.0-1 +- update to upstream release, 5.1.0. + - fix reset flex scan buffer on init. + - fix fix negative status being reset on map read. + - fix out of order amd timestamp lookup. + - fix ldap default schema config. + - fix ldap default master map name config. + - fix map format init in lookup_init(). + - fix incorrect max key length in defaults get_hash(). + - fix xfn sets incorrect lexer state. + - fix old style key lookup. + - fix expire when server not responding. + - fix ldap_uri config update. + - fix typo in conf_load_autofs_defaults(). + - fix hash on confg option add and delete. + - add plus to path match pattern. + - fix multi entry ldap option handling. + - cleanup options in amd_parse.c. + - allow empty value for some map options. + - allow empty value in macro selectors. + +* Sun Apr 13 2014 Ian Kent - 1:5.1.0-0.beta1.1 +- amd lookup update lookup ldap to handle amd keys + - inadvertantly drop from initial series. +- amd lookup update lookup hesiod to handle amd keys + - inadvertantly drop from initial series. +- fix wildcard key lookup. +- check for non existent negative entries in lookup_ghost(). + +* Wed Apr 2 2014 Ian Kent - 1:5.1.0-0.beta1 +- Update to autofs-5.0.1-beta1. + +* Wed Feb 19 2014 Ian Kent - 1:5.0.8-6 +- fix portmap not trying proto v2. + +* Tue Dec 24 2013 Ian Kent - 1:5.0.8-5 +- fix ipv6 link local address handling. +- fix fix ipv6 libtirpc getport. +- get_nfs_info() should query portmapper if port is not given. +- fix rpc_portmap_getport() proto not set. + +* Mon Nov 25 2013 Ian Kent - 1:5.0.8-4 +- allow --with-systemd to take a path arg. +- fix WITH_LIBTIRPC function name. +- fix ipv6 libtirpc getport (bz1033918). + +* Thu Nov 7 2013 Ian Kent - 1:5.0.8-3 +- fix undefined authtype_requires_creds err if ldap enabled but without sasl. +- fix master map type check. +- fix task manager not getting signaled. + +* Mon Oct 21 2013 Ian Kent - 1:5.0.8-2 +- remove now unused patch files (bz1020242). + +* Mon Oct 21 2013 Ian Kent - 1:5.0.8-1 +- update to upstream version 5.0.8 (bz1020242). + +* Sat Aug 03 2013 Fedora Release Engineering - 1:5.0.7-29 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Sat Jul 13 2013 Ian Kent - 1:5.0.7-28 +- add after sssd dependency to unit file (bz984089). + +* Sat Jul 13 2013 Ian Kent - 1:5.0.7-27 +- fix a couple of compiler warnings. + +* Fri Jul 12 2013 Ian Kent - 1:5.0.7-26 +- link with full reloc options. + +* Fri Jul 12 2013 Ian Kent - 1:5.0.7-25 +- fix default path used for unitdir. +- fix changelog inconsistent dates. + +* Wed Jul 10 2013 Ian Kent - 1:5.0.7-24 +- check for protocol option. +- use ulimit max open files if greater than internal maximum. + +* Fri Jun 28 2013 Ian Kent - 1:5.0.7-23 +- fix add null check in parse_server_string() (bz979155). + +* Wed Jun 19 2013 Ian Kent - 1:5.0.7-22 +- misc man page fixes (bz948517). + +* Wed Jun 12 2013 Ian Kent - 1:5.0.7-21 +- fix probe each nfs version in turn for singleton mounts (bz973537). + +* Tue Jun 11 2013 Ian Kent - 1:5.0.7-20 +- fix master map mount options matching. +- fix master map bogus keywork match. +- fix fix map entry duplicate offset detection. +- add a number of fixes based on a Covarity report. + +* Mon May 27 2013 Ian Kent - 1:5.0.7-19 +- dont probe rdma mounts. + +* Fri May 24 2013 Ian Kent - 1:5.0.7-17 +- fix interface address null check. + +* Mon May 13 2013 Ian Kent - 1:5.0.7-16 +- make dump maps check for duplicate indirect mounts (bz961312). +- document allowed map sources in auto.master(5) (bz961312). +- add enable sloppy mount option to configure. + +* Sun Apr 28 2013 Ian Kent - 1:5.0.7-14 +- fix syncronize of handle_mounts() shutdown. +- fix submount tree not all expiring. + +* Tue Mar 26 2013 Ian Kent - 1:5.0.7-13 +- fix some automount(8) typos (bz664178). + +* Tue Mar 12 2013 Ian Kent - 1:5.0.7-12 +- dont fail on master map self include. +- fix wildcard multi map regression. +- fix file descriptor leak when reloading the daemon. +- depricate nosymlink pseudo option. +- add symlink pseudo option. +- update kernel include files. +- fix requires in spec file. +- fix libtirpc build option. +- fix systemd unidir in spec file. +- document browse option in man page. +- fix automounter support on parisc. + +* Wed Feb 13 2013 Fedora Release Engineering - 1:5.0.7-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Mon Jan 21 2013 Ian Kent - 1:5.0.7-10 +- fix submount offset delete. +- fix init script status return. +- fix use get_proximity() without libtirpc. +- don't use dirent d_type to filter out files in scandir(). +- don't schedule new alarms after readmap. +- use numeric protocol ids instead of protoent structs. +- lib/defaults.c: use WITH_LDAP conditional around LDAP types. +- make yellow pages support optional. +- modules/replicated.c: use sin6_addr.s6_addr32. +- workaround missing GNU versionsort extension. + +* Tue Nov 20 2012 Ian Kent - 1:5.0.7-9 +- fix nobind man page description. + +* Tue Nov 20 2012 Ian Kent - 1:5.0.7-8 +- fix map entry duplicate offset detection. +- Allow nsswitch.conf to not contain "automount:" lines. + +* Thu Oct 18 2012 Ian Kent - 1:5.0.7-7 +- use spec file systemd unit file location. + +* Thu Oct 18 2012 Ian Kent - 1:5.0.7-6 +- fix recursive mount deadlock. +- increase file map read buffer size. +- handle new location of systemd. + +* Tue Oct 16 2012 Ian Kent - 1:5.0.7-5 +- configure: allow cross compilation update. +- fix date in changelog entry. + +* Mon Oct 15 2012 Ian Kent - 1:5.0.7-4 +- include usage in usage message. +- dont wait forever to restart. +- add option description to man page. +- fix null map entry order handling. +- make description of default MOUNT_WAIT setting clear. +- configure.in: allow cross compilation. +- README: update mailing list subscription info. +- allow non root user to check status. + +* Mon Sep 10 2012 Ian Kent - 1:5.0.7-3 +- fix nobind sun escaped map entries. +- fix use cache entry after free mistake. +- fix ipv6 proximity calculation. +- fix parse buffer initialization. +- fix typo in automount(8). + +* Mon Aug 27 2012 Ian Kent - 1:5.0.7-2 +- update systemd scriplet macros (bz850040). + +* Wed Jul 25 2012 Ian Kent - 1:5.0.7-1 +- Update to upstream version 5.0.7. + +* Wed Jul 25 2012 Ian Kent - 1:5.0.6-24 +- fix changelog message commit dates. + +* Wed Jul 18 2012 Fedora Release Engineering - 1:5.0.6-23 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jul 16 2012 Ian Kent - 1:5.0.6-21 +- fix systemd argument passing. +- fix get_nfs_info() can incorrectly fail. +- fix offset directory removal. + +* Tue Jul 3 2012 Ian Kent - 1:5.0.6-21 +- fix fix LDAP result leaks on error paths. +- report map not read when debug logging. +- duplicate parent options for included maps. +- update ->timeout() function to not return timeout. +- move timeout to map_source. +- fix kernel verion check of version components. +- dont retry ldap connect if not required. +- check if /etc/mtab is a link to /proc/self/mounts. +- fix nfs4 contacts portmap. +- make autofs wait longer for shutdown. +- fix sss map age not updated. +- fix remount deadlock. +- fix umount recovery of busy direct mount. +- fix offset mount point directory removal. +- remove move mount code and configure option. +- fix remount of multi mount. +- fix devce ioctl alloc path check. +- refactor hosts lookup module. +- remove cache update from parse_mount(). +- add function to delete offset cache entry. +- allow update of multi mount offset entries. +- add hup signal handling to hosts map. + +* Tue May 22 2012 Ian Kent - 1:5.0.6-19 +- fix libtirpc name clash (bz821847). + +* Tue May 22 2012 Ian Kent - 1:5.0.6-18 +- update patch fix initialization in rpc create_client() (bz821847). + +* Wed May 16 2012 Ian Kent - 1:5.0.6-17 +- fix initialization in rpc create_client() (bz821847). + +* Tue May 1 2012 Ian Kent - 1:5.0.6-16 +- add libsss_autofs as a build dependency. + +* Tue May 1 2012 Ian Kent - 1:5.0.6-15 +- fix typo in libtirpc file name. +- fix rework error return handling in rpc code. +- allow MOUNT_WAIT to override probe. +- improve UDP RPC timeout handling. +- fix segfault in get_query_dn(). +- use strtok_r() in linux_version_code(). +- fix sss wildcard match. +- fix dlopen() error handling in sss module. +- fix configure string length tests for sss library. + +* Wed Feb 29 2012 Ian Kent - 1:5.0.6-14 +- fix function to check mount.nfs version. + +* Sun Feb 26 2012 Ian Kent - 1:5.0.6-13 +- fix error in %%post scriplet. + +* Fri Feb 24 2012 Ian Kent - 1:5.0.6-12 +- ignore duplicate exports in auto.net. +- add kernel verion check function. +- add function to check mount.nfs version. +- reinstate singleton mount probe. +- rework error return handling in rpc code. +- catch EHOSTUNREACH and bail out early. +- systemd support fixes. +- fix segmentation fault in do_remount_indirect(). + +* Thu Feb 9 2012 Ian Kent - 1:5.0.6-11 +- fix fuzz in CHANGELOG hunk when applying patch26. + +* Tue Feb 7 2012 Ian Kent - 1:5.0.6-10 +- fix rpc build error. +- add sss lookup module. +- teach automount about sss source. + +* Mon Jan 23 2012 Ian Kent - 1:5.0.6-9 +- add correct patch for "fix improve mount location error reporting". +- add correct patch for "fix fix wait for master source mutex". + +* Mon Jan 23 2012 Ian Kent - 1:5.0.6-8 +- fix fix wait for master source mutex. +- fix improve mount location error reporting (bz783496). + +* Thu Jan 12 2012 Fedora Release Engineering - 1:5.0.6-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Fri Dec 9 2011 Ian Kent - 1:5.0.6-6 +- remove empty command line arguments (passed by systemd). + +* Mon Dec 5 2011 Ian Kent - 1:5.0.6-5 +- fix ipv6 name lookup check. +- fix ipv6 rpc calls. +- fix ipv6 configure check. +- add piddir to configure. +- add systemd unit support. +- fix MNT_DETACH define. + +* Mon Dec 5 2011 Ian Kent - 1:5.0.6-4 +- fix lsb service name in init script 2 (bz712504). + +* Tue Nov 8 2011 Ian Kent - 1:5.0.6-3 +- improve mount location error reporting. +- fix paged query more results check. +- fix dumpmaps not reading maps. +- fix result null check in read_one_map(). +- Fix LDAP result leaks on error paths. +- code analysis fixes 1. +- fix not bind mounting local filesystem. +- update dir map-type patch for changed patch order. +- fix wait for master source mutex. +- fix submount shutdown race +- fix fix map source check in file lookup. +- add disable move mount configure option. + +* Wed Jul 6 2011 Ian Kent - 1:5.0.6-2 +- add missing spec file entries for dir-type change (bz719208). + +* Mon Jul 4 2011 Ian Kent - 1:5.0.6-1 +- update source to 5.0.6. +- fix ipv6 name for lookup fix. +- add dir map-type patch. + +* Tue Jun 14 2011 Ian Kent - 1:5.0.5-38 +- fix lsb service name in init script (bz692963). + +* Fri Mar 18 2011 Ian Kent - 1:5.0.5-37 +- replace GPLv3 code with GPLv2 equivalent. + +* Thu Mar 03 2011 Ian Kent - 1:5.0.5-36 +- use weight only for server selection. +- fix isspace() wild card substition. +- auto adjust ldap page size. +- fix prune cache valid check. +- fix mountd vers retry. +- fix expire race. +- add lsb force-reload and try-restart. + +* Mon Feb 07 2011 Fedora Release Engineering - 1:5.0.5-35 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Nov 23 2010 Ian Kent - 1:5.0.5-34.fc15 +- revert wait for master map to be available at start. + +* Mon Nov 22 2010 Ian Kent - 1:5.0.5-33.fc15 +- fix wait for master map to be available at start. + +* Mon Nov 8 2010 Ian Kent - 1:5.0.5-32.fc15 +- always read file maps mount lookup map read fix. +- fix direct map not updating on reread. +- add external bind method. +- fix add simple bind auth. +- add option to dump configured automount maps. +- wait for master map to be available at start. + +* Fri Aug 27 2010 Ian Kent - 1:5.0.5-31.fc15 +- fix status privilege error (bz627605). + +* Wed Aug 18 2010 Ian Kent - 1:5.0.5-30.fc15 +- fix restart not working (bz624694). + +* Wed Aug 11 2010 Ian Kent - 1:5.0.5-29 +- remove ERR_remove_state() openssl call. + +* Tue Aug 10 2010 Ian Kent - 1:5.0.5-28 +- remove extra read master map call. +- remove extra cache create call in master_add_map_source(). +- fix error handing in do_mount_indirect(). +- expire thread use pending mutex. +- explicity link against the Kerberos library. +- remove some log message duplication for verbose logging. + +* Mon May 24 2010 Ian Kent - 1:5.0.5-27.fc14 +- fix master map source server unavailable handling. +- add autofs_ldap_auth.conf man page. +- fix random selection for host on different network. +- make redhat init script more lsb compliant. +- don't hold lock for simple mounts. +- fix remount locking. +- fix wildcard map entry match. +- fix parse_sun() module init. +- dont check null cache on expire. +- fix null cache race. +- fix cache_init() on source re-read. +- fix mapent becomes negative during lookup. +- check each dc server individually. +- fix negative cache included map lookup. +- remove state machine timed wait. + +* Fri Apr 30 2010 Ian Kent - 1:5.0.5-26.fc14 +- remove URL tag as there is not official autofs wiki (bz529804). + +* Wed Apr 7 2010 Ian Kent - 1:5.0.5-25.fc14 +- make nfs4 default for replicated selection configuration (bz579949). +- add simple bind authentication option (bz579951). + +* Fri Mar 26 2010 Ian Kent - 1:5.0.5-24.fc14 +- fix add locality as valid ldap master map attribute (bz575863). + +* Wed Mar 17 2010 Ian Kent - 1:5.0.5-22 +- fix get query dn failure. +- fix ampersand escape in auto.smb. +- add locality as valid ldap master map attribute. + +* Wed Mar 17 2010 Ian Kent - 1:5.0.5-22 +- add Conflicts to ensure we get fixed cyrus-sasl-lib for rev 21 change. + +* Tue Feb 23 2010 Ian Kent - 1:5.0.5-21 +- add missing sasl mutex callbacks. + +* Thu Feb 11 2010 Ian Kent - 1:5.0.5-19 +- fix segfault upon reconnect cannot find valid base dn. + +* Mon Feb 1 2010 Ian Kent - 1:5.0.5-17 +- dont connect at ldap lookup module init. +- fix random selection option. +- fix disable timeout. +- fix strdup() return value check. + +* Tue Dec 8 2009 Ian Kent - 1:5.0.5-16 +- fix memory leak on reload (bz545137). + +* Fri Dec 4 2009 Ian Kent - 1:5.0.5-14 +- fix rpc fail on large export list (bz543023). + +* Mon Nov 30 2009 Ian Kent - 1:5.0.5-12 +- check for path mount location in generic module. +- dont fail mount on access fail. + +* Tue Nov 24 2009 Ian Kent - 1:5.0.5-10 +- fix pidof init script usage. + +* Mon Nov 23 2009 Ian Kent - 1:5.0.5-8 +- fix timeout in connect_nb(). + +* Mon Nov 16 2009 Ian Kent - 1:5.0.5-6 +- don't use master_lex_destroy() to clear parse buffer. +- make documentation for set-log-priority clearer. + +* Tue Nov 10 2009 Ian Kent - 1:5.0.5-5 +- fix ext4 "preen" fsck at mount. + +* Mon Nov 9 2009 Ian Kent - 1:5.0.5-4 +- fix stale initialization for file map instance patch was not applied. + +* Tue Nov 3 2009 Ian Kent - 1:5.0.5-3 +- fix stale initialization for file map instance. + +* Tue Oct 6 2009 Ian Kent - 1:5.0.5-2 +- fix included map read fail handling. +- refactor ldap sasl authentication bind to eliminate extra connect + causing some servers to reject the request. +- add mount wait parameter to allow timeout of mount requests to + unresponsive servers. +- special case cifs escape handling. +- fix libxml2 workaround configure. +- more code analysis corrections (and fix a typo in an init script). +- fix backwards #ifndef INET6. + +* Fri Sep 4 2009 Ian Kent - 1:5.0.5-1 +- update source to latest upstream version. + - this is essentially a consolidation of the patches already in this rpm. +- add dist tag to match latest RHEL-5 package tag format. + +* Thu Sep 3 2009 Ian Kent - 1:5.0.4-39 +- fix libxml2 non-thread-safe calls. +- fix direct map cache locking. +- fix patch "dont umount existing direct mount on reread" deadlock. + +* Fri Jul 24 2009 Fedora Release Engineering - 1:5.0.4-37 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Fri Jul 17 2009 Ian Kent - 1:5.0.4-34 +- fix typo in patch to allow dumping core. + +* Wed Jul 15 2009 Ian Kent - 1:5.0.4-32 +- fix an RPC fd leak. +- don't block signals we expect to dump core. +- fix pthread push order in expire_proc_direct(). + +* Fri Jun 12 2009 Ian Kent - 1:5.0.4-30 +- fix incorrect dclist free. +- srv lookup handle endianness. +- fix bug introduced by library reload changes which causes autofs to + not release mount thread resources when using submounts. +- fix notify mount message path. +- try harder to work out if we created mount point at remount. +- fix double free in do_sasl_bind(). +- manual umount recovery fixes. +- fix map type info parse error. + +* Mon May 18 2009 Ian Kent - 1:5.0.4-28 +- use intr option as hosts mount default. +- sync kernel includes with upstream kernel. +- dont umount existing direct mount on master re-read. +- fix incorrect shutdown introduced by library relaod fixes. +- improve manual umount recovery. +- dont fail on ipv6 address when adding host. +- always read file maps multi map fix. +- always read file maps key lookup fixes. +- add support for LDAP_URI="ldap:///" SRV RR lookup. + +* Thu Apr 16 2009 Ian Kent - 1:5.0.4-26 +- fix lsb init script header. +- fix memory leak reading ldap master map. +- fix st_remove_tasks() locking. +- reset flex scanner when setting buffer. +- zero s_magic is valid. + +* Mon Mar 30 2009 Ian Kent - 1:5.0.4-24 +- clear rpc client on lookup fail. + +* Fri Mar 20 2009 Ian Kent - 1:5.0.4-23 +- fix call restorecon when misc device file doesn't exist. + +* Wed Mar 18 2009 Ian Kent - 1:5.0.4-22 +- use misc device ioctl interface by default, if available. + +* Tue Mar 17 2009 Ian Kent - 1:5.0.4-21 +- fix file map lookup when reading included or nsswitch sources. + - a regression introduced by file map lookup optimisation in rev 9. + +* Fri Mar 13 2009 Ian Kent - 1:5.0.4-20 +- add LSB init script parameter block. + +* Fri Mar 13 2009 Ian Kent - 1:5.0.4-19 +- another easy alloca replacements fix. + +* Thu Mar 12 2009 Ian Kent - 1:5.0.4-18 +- fix return start status on fail. +- fix double free in expire_proc(). + +* Wed Feb 25 2009 Ian Kent - 1:5.0.4-17 +- fix bad token declaration in master map parser. + +* Wed Feb 25 2009 Ian Kent - 1:5.0.4-16 +- correct mkdir command in %%install section, bz481132. + +* Tue Feb 24 2009 Ian Kent - 1:5.0.4-15 +- fix array out of bounds accesses and cleanup couple of other alloca() calls. +- Undo mistake in copy order for submount path introduced by rev 11 patch. +- add check for alternate libxml2 library for libxml2 tsd workaround. +- add check for alternate libtirpc library for libtirpc tsd workaround. +- cleanup configure defines for libtirpc. +- add WITH_LIBTIRPC to -V status report. +- add libtirpc-devel to BuildRequires. +- add nfs mount protocol default configuration option. + +* Mon Feb 23 2009 Fedora Release Engineering - 1:5.0.4-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Feb 19 2009 Ian Kent - 5.0.4-10 +- fix mntent.h not included before use of setmntent_r(). + +* Mon Feb 16 2009 Ian Kent - 5.0.4-9 +- fix hosts map use after free. +- fix uri list locking (again). +- check for stale SASL credentials upon connect fail. +- add "forcestart" and "forcerestart" init script options to allow + use of 5.0.3 strartup behavior if required. +- always read entire file map into cache to speed lookups. +- make MAX_ERR_BUF and PARSE_MAX_BUF use easier to audit. +- make some easy alloca replacements. +- update to configure libtirpc if present. +- update to provide ipv6 name and address support. +- update to provide ipv6 address parsing. + +* Thu Feb 5 2009 Ian Kent - 5.0.4-8 +- rename program map parsing bug fix patch. +- use CLOEXEC flag functionality for setmntent also, if present. + +* Wed Jan 21 2009 Jeff Moyer - 5.0.4-6 +- fix a bug in the program map parsing routine + +* Thu Jan 15 2009 Ian Kent - 5.0.4-5 +- fix negative caching of non-existent keys. +- fix ldap library detection in configure. +- use CLOEXEC flag functionality if present. +- fix select(2) fd limit. +- make hash table scale to thousands of entries. + +* Wed Dec 3 2008 Ian Kent - 5.0.4-4 +- fix nested submount expire deadlock. + +* Wed Nov 19 2008 Ian Kent - 5.0.4-3 +- fix libxml2 version check for deciding whether to use workaround. + +* Tue Nov 11 2008 Ian Kent - 5.0.4-2 +- Fix tag confusion. + +* Tue Nov 11 2008 Ian Kent - 5.0.4-1 +- Upstream source version 5.0.4. + +* Tue Nov 11 2008 Ian Kent - 5.0.3-32 +- correct buffer length setting in autofs-5.0.3-fix-ifc-buff-size-fix.patch. + +* Sun Nov 2 2008 Ian Kent - 5.0.3-30 +- fix segv during library re-open. +- fix incorrect pthreads condition handling for expire requests. +- fix master map lexer eval order. +- fix bad alloca usage. + +* Thu Oct 23 2008 Ian Kent - 5.0.3-28 +- don't close file handle for rootless direct mounti-mount at mount. +- wait submount expire thread completion when expire successful. +- add inadvertantly ommitted server list locking in LDAP module. + +* Fri Oct 10 2008 Ian Kent - 5.0.3-26 +- add map-type-in-map-name fix patch to sync with upstream and RHEL. +- don't readmap on HUP for new mount. +- add NIS_PARTIAL to map entry not found check and fix use after free bug. + +* Fri Sep 26 2008 Ian Kent - 5.0.3-25 +- fix fd leak at multi-mount non-fatal mount fail. +- fix incorrect multi-mount mountpoint calcualtion. + +* Fri Sep 19 2008 Ian Kent - 5.0.3-23 +- add upstream bug fixes + - bug fix for mtab check. + - bug fix for zero length nis key. + - update for ifc buffer handling. + - bug fix for kernel automount handling. +- warning: I found a bunch of patches that were present but not + being applied. + +* Mon Aug 25 2008 Ian Kent - 5.0.3-21 +- add upstream bug fix patches + - add command line option to override is running check. + - don't use proc fs for is running check. + - fix fail on included browse map not found. + - fix incorrect multi source messages. + - clear stale flag on map read. + - fix proximity other rpc ping timeout. + - refactor mount request vars code. + - make handle_mounts startup condition distinct. + - fix submount shutdown handling. + - try not to block on expire. + - add configuration paramter UMOUNT_WAIT. + - fix multi mount race. + - fix nfs4 colon escape handling. + - check replicated list after probe. + - add replicated server selection debug logging. + - update replicated server selection documentation. + - use /dev/urandom instead of /dev/random. + - check for mtab pointing to /proc/mounts. + - fix interface config buffer size. + - fix percent hack heap corruption. + +* Mon Jul 14 2008 Tom "spot" Callaway - 5.0.3-19 +- change conflicts to requires +- fix license tag + +* Mon Jun 30 2008 Ian Kent - 5.0.3-18 +- don't abuse the ap->ghost field on NFS mount. +- multi-map doesn't pickup NIS updates automatically. +- eliminate redundant DNS name lookups. +- mount thread create condition handling fix. +- allow directory create on NFS root. +- check direct mount path length. +- fix incorrect in check in get user info. +- fix a couple of memory leaks. + +* Wed May 14 2008 Ian Kent - 5.0.3-16 +- update patches, documentation and comments only change. +- rename patch and add to CVS. + +* Mon May 12 2008 Ian Kent - 5.0.3-14 +- check for nohide mounts (bz 442618). +- ignore nsswitch sources that aren't supported (bz 445880). + +* Thu Apr 17 2008 Ian Kent - 5.0.3-13 +- fix typo in patch for incorrect pthreads condition handling patch. + +* Mon Apr 14 2008 Ian Kent - 5.0.3-12 +- fix incorrect pthreads condition handling for mount requests. + +* Tue Apr 1 2008 Ian Kent - 5.0.3-11 +- and another try at fixing lexer matching map type in map name. + +* Sun Mar 30 2008 Ian Kent - 5.0.3-10 +- another try a fixing lexer matching map type in map name. + +* Wed Mar 26 2008 Ian Kent - 5.0.3-9 +- fix lexer ambiguity in match when map type name is included in map name. + +* Mon Mar 24 2008 Ian Kent - 5.0.3-8 +- revert miscellaneous device node related patches. +- add missing check for zero length NIS key. +- fix incorrect match of map type name when included in map name. +- update rev 7 sasl callbacks patch. + +* Thu Mar 20 2008 Ian Kent - 5.0.3-7 +- add patch to initialize sasl callbacks unconditionally on autofs + LDAP lookup library load. + +* Mon Feb 25 2008 Ian Kent - 5.0.3-6 +- fix expire calling kernel more often than needed. +- fix unlink of mount tree incorrectly causing autofs mount fail. +- add miscellaneous device node interface library. +- use miscellaneous device node, if available, for active restart. +- device node and active restart fixes. +- update is_mounted to use device node ioctl, if available. + +* Fri Feb 1 2008 Ian Kent - 5.0.3-5 +- another fix for don't fail on empty master map. + +* Fri Jan 25 2008 Ian Kent - 5.0.3-4 +- correction to the correction for handling of LDAP base dns with spaces. +- avoid using UDP for probing NFSv4 mount requests. +- use libldap instead of libldap_r. + +* Mon Jan 21 2008 Ian Kent - 5.0.3-3 +- catch "-xfn" map type and issue "no supported" message. +- another correction for handling of LDAP base dns with spaces. + +* Mon Jan 14 2008 Ian Kent - 5.0.3-2 +- correct configure test for ldap page control functions. + +* Mon Jan 14 2008 Ian Kent - 5.0.3-1 +- update source to version 5.0.3. + +* Fri Dec 21 2007 Ian Kent - 5.0.2-25 +- Bug 426401: CVE-2007-6285 autofs default doesn't set nodev in /net [rawhide] + - use mount option "nodev" for "-hosts" map unless "dev" is explicily specified. + +* Tue Dec 18 2007 Ian Kent - 5.0.2-23 +- Bug 397591 SELinux is preventing /sbin/rpc.statd (rpcd_t) "search" to (sysctl_fs_t). + - prevent fork between fd open and setting of FD_CLOEXEC. + +* Thu Dec 13 2007 Ian Kent - 5.0.2-21 +- Bug 421371: CVE-2007-5964 autofs defaults don't restrict suid in /net [rawhide] + - use mount option "nosuid" for "-hosts" map unless "suid" is explicily specified. + +* Thu Dec 6 2007 Jeremy Katz - 1:5.0.2-19 +- rebuild for new ldap + +* Tue Nov 20 2007 Ian Kent - 5.0.2-18 +- fix schema selection in LDAP schema discovery. +- check for "*" when looking up wildcard in LDAP. +- fix couple of edge case parse fails of timeout option. +- add SEARCH_BASE configuration option. +- add random selection as a master map entry option. +- re-read config on HUP signal. +- add LDAP_URI, LDAP_TIMEOUT and LDAP_NETWORK_TIMEOUT configuration options. +- fix deadlock in submount mount module. +- fix lack of ferror() checking when reading files. +- fix typo in autofs(5) man page. +- fix map entry expansion when undefined macro is present. +- remove unused export validation code. +- add dynamic logging (adapted from v4 patch from Jeff Moyer). +- fix recursive loopback mounts (Matthias Koenig). +- add map re-load to verbose logging. +- fix handling of LDAP base dns with spaces. +- handle MTAB_NOTUPDATED status return from mount. +- when default master map, auto.master, is used also check for auto_master. +- update negative mount timeout handling. +- fix large group handling (Ryan Thomas). +- fix for dynamic logging breaking non-sasl build (Guillaume Rousse). +- eliminate NULL proc ping for singleton host or local mounts. + +* Mon Sep 24 2007 Ian Kent - 5.0.2-16 +- add descriptive comments to config about LDAP schema discovery. +- work around segfault at exit caused by libxml2. +- fix foreground logging (also fixes shutdown needing extra signal bug). + +* Wed Sep 5 2007 Ian Kent - 5.0.2-15 +- fix LDAP schema discovery. + +* Tue Aug 28 2007 Ian Kent - 5.0.2-14 +- update patch to prevent failure on empty master map. +- if there's no "automount" entry in nsswitch.conf use "files" source. +- add LDAP schema discovery if no schema is configured. + +* Wed Aug 22 2007 Ian Kent - 5.0.2-13 +- fix "nosymlink" option handling and add desription to man page. + +* Tue Aug 21 2007 Ian Kent - 5.0.2-12 +- change random multiple server selection option name to be consistent + with upstream naming. + +* Tue Aug 21 2007 Ian Kent - 5.0.2-11 +- don't fail on empty master map. +- add support for the "%%" hack for case insensitive attribute schemas. + +* Mon Jul 30 2007 Ian Kent - 5.0.2-10 +- mark map instances stale so they aren't "cleaned" during updates. +- fix large file compile time option. + +* Fri Jul 27 2007 Ian Kent - 5.0.2-9 +- fix version passed to get_supported_ver_and_cost (bz 249574). + +* Tue Jul 24 2007 Ian Kent - 5.0.2-8 +- fix parse confusion between attribute and attribute value. + +* Fri Jul 20 2007 Ian Kent - 5.0.2-7 +- fix handling of quoted slash alone (bz 248943). + +* Wed Jul 18 2007 Ian Kent - 5.0.2-6 +- fix wait time resolution in alarm and state queue handlers (bz 247711). + +* Mon Jul 16 2007 Ian Kent - 5.0.2-5 +- fix mount point directory creation for bind mounts. +- add quoting for exports gathered by hosts map. + +* Mon Jun 25 2007 Ian Kent - 5.0.2-4 +- update multi map nsswitch patch. + +* Mon Jun 25 2007 Ian Kent - 5.0.2-3 +- add missing "multi" map support. +- add multi map nsswitch lookup. + +* Wed Jun 20 2007 Ian Kent - 5.0.2-2 +- include krb5.h in lookup_ldap.h (some openssl doesn't implicitly include it). +- correct initialization of local var in parse_server_string. + +* Mon Jun 18 2007 Ian Kent - 5.0.2-1 +- Update to upstream release 5.0.2. + +* Tue Jun 12 2007 Ian Kent - 5.0.1-16 +- add ldaps support. + - note: it's no longer possible to have multiple hosts in an ldap map spec. + - note: to do this you need to rely on the ldap client config. + +* Thu Jun 7 2007 Ian Kent - 5.0.1-14 +- fix deadlock in alarm manager module. + +* Sun Jun 3 2007 Ian Kent - 5.0.1-12 +- correct mistake in logic test in wildcard lookup. + +* Mon May 7 2007 Ian Kent - 5.0.1-10 +- fix master map lexer to admit "." in macro values. + +* Tue Apr 17 2007 Ian Kent - 5.0.1-9 +- upstream fix for filesystem is local check. +- disable exports access control check (bz 203277). +- fix patch to add command option for set a global mount options (bz 214684). + +* Mon Apr 16 2007 Ian Kent - 5.0.1-8 +- add configuration variable to control appending of global options (bz 214684). +- add command option to set a global mount options string (bz 214684). + +* Tue Apr 3 2007 Ian Kent - 5.0.1-7 +- fix "null" domain netgroup match for "-hosts" map. + +* Thu Mar 29 2007 Ian Kent - 5.0.1-6 +- fix directory creation for browse mounts. +- fix wildcard map handling and improve nsswitch source map update. + +* Fri Mar 16 2007 Ian Kent - 5.0.1-5 +- drop "DEFAULT_" prefix from configuration names. +- add option to select replicated server at random (instead of + ping response time) (bz 227604). +- fix incorrect cast in directory cleanup routines (bz 231864). + +* Thu Mar 8 2007 Ian Kent - 5.0.1-4 +- fixed numeric export match (bz 231188). + +* Thu Mar 1 2007 Ian Kent - 5.0.1-3 +- change file map lexer to allow white-space only blank lines (bz 229434). + +* Fri Feb 23 2007 Ian Kent - 5.0.1-2 +- update "@network" matching patch. + +* Thu Feb 22 2007 Ian Kent - 5.0.1-1 +- update to release tar. +- fix return check for getpwuid_r and getgrgid_r. +- patch to give up trying to update exports list while host is mounted. +- fix to "@network" matching. +- patch to check for fstab update and retry if not updated. + +* Tue Feb 20 2007 Ian Kent - 5.0.1-0.rc3.24 +- add "condrestart" to init script (bz 228860). +- add "@network" and .domain.name export check. +- fix display map name in mount entry for "-hosts" map. + +* Fri Feb 16 2007 Ian Kent - 5.0.1-0.rc3.22 +- fix localhost replicated mounts not working (bz 208757). + +* Wed Feb 14 2007 Ian Kent - 5.0.1-0.rc3.20 +- correct return status from do_mkdir (bz 223480). + +* Sat Feb 10 2007 Ian Kent - 5.0.1-0.rc3.18 +- update the "task done race" patch to fix a deadlock. +- added URL tag. +- removed obsoletes autofs-ldap. +- replaced init directory paths with %%{_initrddir} macro. + +* Fri Feb 9 2007 Ian Kent - 5.0.1-0.rc3.17 +- make use of spaces and tabs in spec file consistent. +- escape embedded macro text in %%changelog. +- eliminate redundant %%version and %%release. +- remove redundant conditional check from %%clean. +- remove redundant exit from %%preun. +- correct %%defattr spec. +- remove empty %%doc and redundant %%dir misc lines. +- combine program module spec lines into simpler one line form. + +* Tue Feb 6 2007 Ian Kent - 5.0.1-0.rc3.15 +- fix race when setting task done (bz 227268). + +* Mon Jan 29 2007 Ian Kent - 5.0.1-0.rc3.13 +- make double quote handing consistent (at least as much as we can). +- fix handling of trailing white space in wildcard lookup (forward port bz 199720). +- check fqdn of each interface when matching export access list (bz 213700). + +* Thu Jan 18 2007 Ian Kent - 5.0.1-0.rc3.11 +- correct check for busy offset mounts before offset umount (bz 222872). + +* Wed Jan 17 2007 Ian Kent - 5.0.1-0.rc3.9 +- fix another expire regression introduced in the "mitigate manual umount" + patch (bz 222872). + +* Mon Jan 15 2007 Ian Kent - 5.0.1-0.rc3.7 +- ignore "winbind" if it appears in "automount" nsswitch.conf (bz 214632). + +* Wed Jan 10 2007 Ian Kent - 5.0.1-0.rc3.5 +- remove fullstop from Summary tag. +- change Buildroot to recommended form. +- replace Prereq with Requires. + +* Tue Jan 9 2007 Ian Kent - 5.0.1-0.rc3.3 +- remove redundant rpath link option (prep for move to Extras). + +* Tue Jan 9 2007 Ian Kent - 5.0.1-0.rc3.1 +- consolidate to rc3. +- fix typo in Fix typo in var when removing temp directory (bz 221847). + +* Wed Dec 27 2006 Ian Kent - 5.0.1-0.rc2.41 +- fix nonstrict multi-mount handling (bz 219383). +- correct detection of duplicate indirect mount entries (bz 220799). + +* Thu Dec 14 2006 Ian Kent - 5.0.1-0.rc2.38 +- update master map tokenizer to admit "slasify-colons" option. +- update location validation to accept "_" (bz 219445). +- set close-on-exec flag on open sockets (bz 215757). + +* Mon Dec 11 2006 Ian Kent - 5.0.1-0.rc2.35 +- update "replace-tempnam" patch to create temp files in sane location. + +* Mon Dec 11 2006 Ian Kent - 5.0.1-0.rc2.34 +- change mount "device" from "automount" to the map name. +- check for buffer overflow in mount_afs.c. +- replace tempnam with mkdtemp. + +* Sun Dec 10 2006 Ian Kent - 5.0.1-0.rc2.33 +- expand export access checks to include missing syntax options. +- make "-hosts" module try to be sensitive to exports list changes. + +* Thu Dec 7 2006 Ian Kent - 5.0.1-0.rc2.32 +- remove ability to use multiple indirect mount entries in master + map (bz 218616). + +* Wed Dec 6 2006 Ian Kent - 5.0.1-0.rc2.29 +- alter nfs4 host probing to not use portmap lookup and add options + check for "port=" parameter (bz 208757). +- correct semantics of "-null" map handling (bzs 214800, 208091). + +* Sat Nov 25 2006 Ian Kent - 5.0.1-0.rc2.26 +- fix parsing of bad mount mount point in master map (bz 215620). +- fix use after free memory access in cache.c and lookup_yp.c (bz 208091). +- eliminate use of pthread_kill to detect task completion (bz 208091). + +* Sun Nov 12 2006 Ian Kent - 5.0.1-0.rc2.23 +- fix tokenizer to distinguish between global option and dn string (bz 214684). +- fix incorrect return from spawn. + +* Wed Nov 8 2006 Ian Kent - 5.0.1-0.rc2.21 +- mitigate manual umount of automounts where possible. +- fix multiply recursive bind mounts. +- check kernel module version and require 5.00 or above. +- fix expire regression introduced in the "mitigate manual umount" patch. +- still more on multiply recursive bind mounts. + +* Mon Oct 30 2006 Ian Kent - 5.0.1-0.rc2.20 +- Update patch for changed semantics of mkdir in recent kernels. +- fix macro table locking (bz 208091). +- fix nsswitch parser locking (bz 208091). +- allow only one master map read task at a time. +- fix misc memory leaks. + +* Wed Oct 25 2006 Ian Kent - 5.0.1-0.rc2.19 +- deal with changed semantics of mkdir in recent kernels. + +* Fri Oct 20 2006 Ian Kent - 5.0.1-0.rc2.16 +- fix get_query_dn not looking in subtree for LDAP search (missed + econd occurance). +- allow additional common LDAP attributes in map dn. +- Resolves: rhbz#205997 + +* Mon Oct 16 2006 Ian Kent - 5.0.1-0.rc2.13 +- fix parsing of numeric host names in LDAP map specs (bz 205997). + +* Mon Oct 16 2006 Ian Kent - 5.0.1-0.rc2.12 +- fix "-fstype=nfs4" server probing (part 2 of bz 208757). +- set close-on-exec flag on open files where possible (bz 207678). + +* Fri Oct 13 2006 Ian Kent - 5.0.1-0.rc2.11 +- fix file handle leak in nsswitch parser (bz 207678). +- fix memory leak in mount and expire request processing (bz 207678). +- add additional check to prevent running of cancelled tasks. +- fix potential file handle leakage in rpc_subs.c for some failure + cases (bz 207678). +- fix file handle leak in included map lookup (bz 207678). + +* Sat Oct 7 2006 Ian Kent - 5.0.1-0.rc2.10 +- fix get_query_dn not looking in subtree for LDAP search. +- allow syntax "--timeout " for backward compatibility + (bz 193948). +- make masked_match independent of hostname for exports comparison + (bz 209638). + +* Thu Oct 5 2006 Ian Kent - 5.0.1-0.rc2.9 +- fix "-fstype=nfs4" handling (bz 208757). + +* Wed Sep 27 2006 Ian Kent - 5.0.1-0.rc2.8 +- review and fix master map options update for map reload. + +* Wed Sep 27 2006 Ian Kent - 5.0.1-0.rc2.7 +- make default installed master map for /net use "-hosts" instead + of auto.net. +- fix included map recursive map key lookup. + +* Mon Sep 25 2006 Ian Kent - 5.0.1-0.rc2.6 +- remove unused option UNDERSCORETODOT from default config files. + +* Mon Sep 25 2006 Ian Kent - 5.0.1-0.rc2.5 +- fix LDAP lookup delete cache entry only if entry doesn't exist. +- add missing socket close in replicated host check (Jeff Moyer). + +* Wed Sep 20 2006 Ian Kent - 5.0.1-0.rc2.4 +- fix cache entrys not being cleaned up on submount expire. + +* Sun Sep 17 2006 Ian Kent - 5.0.1-0.rc2.3 +- fix include check full patch for file map of same name. + +* Wed Sep 13 2006 Ian Kent - 5.0.1-0.rc2.2 +- fix handling of autofs specific mount options (bz 199777). + +* Fri Sep 1 2006 Ian Kent - 5.0.1-0.rc2.1 +- consolidate to rc2. +- fix colon escape handling. +- fix recusively referenced bind automounts. +- update kernel patches. + +* Fri Aug 25 2006 Ian Kent - 5.0.1-0.rc1.17 +- fix task cancelation at shutdown (more) +- fix concurrent mount and expire race with nested submounts. + +* Sun Aug 20 2006 Ian Kent - 5.0.1-0.rc1.16 +- fix included map lookup. +- fix directory cleanup on expire. +- fix task cancelation at shutdown. +- fix included map wild card key lookup. + +* Wed Aug 16 2006 Ian Kent - 5.0.1-0.rc1.15 +- expire individual submounts. +- add ino_index locking. +- fix nested submount expiring away when pwd is base of submount. +- more expire re-work to cope better with shutdown following cthon tests. +- allow hostname to start with numeric when validating. + +* Mon Aug 7 2006 Ian Kent - 5.0.1-0.rc1.14 +- remove SIGCHLD handler because it is no longer needed and was + causing expire problems. +- alter expire locking of multi-mounts to lock sub-tree instead of + entire tree. +- review verbose message feedback and update. +- correction for expire of multi-mounts. +- spelling corrections to release notes (Jeff Moyer). +- add back sloppy mount option, removed for Connectathon testing. +- disable mtab locking again. + +* Fri Aug 4 2006 Ian Kent - 5.0.1-0.rc1.13 +- tidy up directory cleanup and add validation check to rmdir_path. + +* Fri Aug 4 2006 Ian Kent - 5.0.1-0.rc1.12 +- enable mtab locking until I can resolve the race with it. + +* Fri Aug 4 2006 Ian Kent - 5.0.1-0.rc1.11 +- cthon fix expire of wildcard and program mounts broken by recent + patches. + +* Thu Aug 3 2006 Ian Kent - 5.0.1-0.rc1.10 +- cthon corrections for shutdown patch below and fix shutdown expire. + +* Wed Aug 2 2006 Ian Kent - 5.0.1-0.rc1.9 +- cthon fix some shutdown races. + +* Thu Jul 27 2006 Ian Kent - 5.0.1-0.rc1.8 +- Fix compile error. + +* Thu Jul 27 2006 Ian Kent - 5.0.1-0.rc1.7 +- cthon fix expire of various forms of nested mounts. + +* Mon Jul 24 2006 Ian Kent - 5.0.1-0.rc1.6 +- cthon more parser corrections and attempt to fix multi-mounts + with various combinations of submounts (still not right). + +* Wed Jul 19 2006 Ian Kent - 5.0.1-0.rc1.5 +- Add conflicts kernel < 2.6.17. +- Fix submount operation broken by connectathon updates. + +* Wed Jul 19 2006 Ian Kent - 5.0.1-0.rc1.4 +- Correction to host name validation test for connectathon tests. + +* Wed Jul 19 2006 Ian Kent - 5.0.1-0.rc1.3 +- More code cleanup and corrections for connectathon tests. + +* Wed Jul 19 2006 Ian Kent - 5.0.1-0.rc1.2 +- Code cleanup and fixes for connectathon tests. + +* Thu Jul 13 2006 Ian Kent - 5.0.1-0.rc1.1 +- Update version label to avoid package update problems. + +* Thu Jul 13 2006 Ian Kent - 5.0.0_beta6-8 +- add cacheing of negative lookups to reduce unneeded map + lookups (bz 197746 part 2). + +* Wed Jul 12 2006 Jesse Keating - 1:5.0.0_beta6-7.1 +- rebuild + +* Tue Jul 11 2006 Ian Kent - 5.0.0_beta6-7 +- correct directory cleanup in mount modules. +- merge key and wildcard LDAP query for lookups (bz 197746). + +* Sat Jul 8 2006 Ian Kent - 5.0.0_beta6-6 +- correct test for libhesiod. + +* Fri Jul 7 2006 Ian Kent - 5.0.0_beta6-5 +- correct auto.net installed as auto.smb. +- update LDAP auth - add autodectect option. + +* Wed Jul 5 2006 Ian Kent - 5.0.0_beta6-4 +- correct shutdown log message print. +- correct auth init test when no credentials required. + +* Tue Jul 4 2006 Ian Kent - 5.0.0_beta6-3 +- correct test for existence of auth config file. + +* Mon Jul 3 2006 Ian Kent - 5.0.0_beta6-2 +- merge LDAP authentication update for GSSAPI (Jeff Moyer). +- update default auth config to add options documenetation (Jeff Moyer). +- workaround segfaults at exit after using GSSAPI library. +- fix not checking return in init_ldap_connection (jeff Moyer). + +* Thu Jun 29 2006 Ian Kent - 5.0.0_beta6-1 +- consolidate to beta6, including: + - mode change update for config file. + - correction to get_query_dn fix from beta5-4. + +* Wed Jun 28 2006 Ian Kent - 5.0.0_beta5-6 +- cleanup defaults_read_config (Jeff Moyer). + +* Tue Jun 27 2006 Ian Kent - 5.0.0_beta5-5 +- allow global macro defines to override system macros. +- correct spelling error in default config files missed by + previous update. +- misc correctness and a memory leak fix. + +* Mon Jun 26 2006 Ian Kent - 5.0.0_beta5-4 +- correct spelling error in default config. +- fix default auth config not being installed. +- change LDAP query method as my test db was incorrect. +- change ldap defaults code to handle missing auth config. +- fix mistake in parsing old style LDAP specs. +- update LDAP so that new query method also works for old syntax. + +* Fri Jun 23 2006 Ian Kent - 5.0.0_beta5-3 +- lookup_init cleanup and fix missed memory leak. +- use nis map order to check if update is needed. +- fix couple of memory leaks in lookup_yp.c. +- fix pasre error in replicated server module. + +* Wed Jun 21 2006 Ian Kent - 5.0.0_beta5-2 +- Add openssl-devel to the BuildRequires, as it is needed for the LDAP + authentication bitsi also. + +* Tue Jun 20 2006 Ian Kent - 5.0.0_beta5-1 +- promote to beta5. + +* Tue Jun 20 2006 Ian Kent - 5.0.0_beta4-14 +- fix directory cleanup at exit. + +* Mon Jun 19 2006 Ian Kent - 5.0.0_beta4-13 +- Change LDAP message severity from crit to degug (bz# 183893). +- Corrections to INSTALL and README.v5.release. +- Add patch to fix segv on overlength map keys in file maps (Jeff Moter). +- Add patch to restrict scanning of /proc to pid directories only (Jeff Moyer). + +* Thu Jun 15 2006 Jeff Moyer - 5.0.0_beta4-12 +- Change BuildPrereq to BuildRequires as per the package guidelines. +- Add libxml2-devel to the BuildRequires, as it is needed for the LDAP + authentication bits. + +* Wed Jun 14 2006 Ian Kent - 5.0.0_beta4-11 +- add export access list matching to "hosts" lookup module (bz # 193585). + +* Tue Jun 13 2006 Jeff Moyer - 5.0.0_beta4-10 +- Add a BuildPrereq for cyrus-sasl-devel + +* Tue Jun 13 2006 Ian Kent - 5.0.0_beta4-9 +- move autofs4 module loading back to init script (part bz # 194061). + +* Mon Jun 12 2006 Ian Kent - 5.0.0_beta4-8 +- fix handling of master map entry update (bz # 193718). +- fix program map handling of invalid multi-mount offsets. + +* Sat Jun 10 2006 Ian Kent - 5.0.0_beta4-7 +- fix context init error (introduced by memory leak patch). + +* Fri Jun 9 2006 Ian Kent - 5.0.0_beta4-6 +- add free for working var in get_default_logging. +- add inialisation for kver in autofs_point struct. +- fix sources list corruption in check_update_map_sources. +- fix memory leak in walk_tree. +- fix memory leak in rpc_portmap_getport and rpc_ping_proto. +- fix memory leak in initialisation of lookup modules. + +* Thu Jun 8 2006 Ian Kent - 5.0.0_beta4-5 +- misc fixes for things found while investigating map re-read problem. + +* Wed Jun 7 2006 Ian Kent - 5.0.0_beta4-4 +- check base of offset mount tree is not a mount before umounting + its offsets. +- fix replicated mount parse for case where last name in list + fails lookup. +- correct indirect mount expire broken by the wildcard lookup fix. +- fix up multi-mount handling when wildcard map entry present. + +* Mon Jun 5 2006 Ian Kent - 5.0.0_beta4-3 +- correct config names in default.c (jpro@bas.ac.uk). + +* Mon Jun 5 2006 Ian Kent - 5.0.0_beta4-2 +- re-instate v4 directory cleanup (bz# 193832 again). +- backout master map lookup changes made to beta3. +- change default master map from /etc/auto.master to auto.master + so that we always use nsswitch to locate master map. +- change default installed master map to include "+auto.master" + to pickup NIS master map (all bz# 193831 again). + +* Fri Jun 2 2006 Ian Kent - 5.0.0_beta4-1 +- update to beta4. +- should address at least bzs 193798, 193770, 193831 and + possibly 193832. + +* Mon May 29 2006 Ian Kent - 5.0.0_beta3-6 +- add back test for nested mount in program map lookup. + - I must have commented this out for a reason. I guess we'll + find out soon enough. + +* Mon May 29 2006 Ian Kent - 5.0.0_beta3-5 +- fix handling of autofs filesystem mount fail on init. + +* Sat May 27 2006 Ian Kent - 5.0.0_beta3-4 +- updated hesiod patch. + +* Sat May 27 2006 Ian Kent - 5.0.0_beta3-3 +- update hesiod module (Jeff Moyer). + - add mutex to protect against overlapping mount requests. + - update return from mount request to give more sensible NSS_* + values. + +* Fri May 26 2006 Jeff Moyer - 1:5.0.0_beta3-2 +- Fix the install permissions for auto.master and auto.misc. + +* Thu May 25 2006 Ian Kent - 5.0.0_beta3-1 +- update source to version 5.0.0_beta3. +- add patch to remove extra debug print. +- add patch to + - fix memory alloc error in nis lookup module. + - add "_" to "." mapname translation to nis lookup module. +- add patch to add owner pid to mount list struct. +- add patch to disable NFSv4 when probing hosts (at least foe now). +- add patch to fix white space handling in replicated server selection code. +- add patch to prevent striping of debug info macro patch (Jeff Moyer). +- add patch to add sanity checks on rmdir_path and unlink (Jeff Moyer). +- add patch to fix e2fsck error code check (Jeff Moyer). + +* Tue May 16 2006 Ian Kent - 1:4.1.4-23 +- add patch to ignore the "bg" and "fg" mount options as they + aren't relevant for autofs mounts (bz #184386). + +* Tue May 2 2006 Ian Kent - 1:4.1.4-20 +- add patch to use "cifs" instead of smbfs and escape speces + in share names (bz #163999, #187732). + +* Tue Apr 11 2006 Ian Kent - 1:4.1.4-18 +- Add patch to allow customization of arguments to the + autofs-ldap-auto-master program (bz #187525). +- Add patch to escap "#" characters in exports from auto.net + program mount (bz#178304). + +* Fri Feb 10 2006 Jesse Keating - 1:4.1.4-16.2.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 1:4.1.4-16.2.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Wed Feb 1 2006 Ian Kent - 1:4.1.4-16.2 +- Add more general patch to translate "_" to "." in map names. (bz #147765) + +* Wed Jan 25 2006 Ian Kent - 1:4.1.4-16.1 +- Add patch to use LDAP_DEPRICATED compile option. (bz #173833) + +* Tue Jan 17 2006 Ian Kent - 1:4.1.4-16 +- Replace check-is-multi with more general multi-parse-fix. +- Add fix for premature return when waiting for lock file. +- Update copyright declaration for reentrant-syslog source. +- Add patch for configure option to disable locking during mount. + But don't disable locking by default. +- Add ability to handle automount schema used in Sun directory server. +- Quell compiler warning about getsockopt parameter. +- Quell compiler warning about yp_order parameter. + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Thu Nov 17 2005 Jeff Moyer - 1:4.1.4-14 +- Removed the /misc entry from the default auto.master. auto.misc has + an entry for the cdrom device, and the preferred method of mounting the + cd is via udev/hal. + +* Mon Nov 7 2005 Jeff Moyer - 1:4.1.4-13 +- Changed to sort -k 1, since that should be the same as +0. + +* Thu Nov 3 2005 Jeff Moyer - 1:4.1.4-12 +- The sort command no longer accepts options of the form "+0". This broke + auto.net, so the option was removed. Fixes bz #172111. + +* Wed Oct 26 2005 - 1:4.1.4-11 +- Check the return code of is_local_addr in get_best_mount. (bz #169523) + +* Wed Oct 26 2005 - 1:4.1.4-10 +- Fix some bugs in the parser +- allow -net instead of /etc/auto.net +- Fix a buffer overflow with large key lengths +- Don't allow autofs to unlink files, only to remove directories +- change to the upstream reentrant syslog patch from the band-aid deferred + syslog patch. +- Get rid of the init script patch that hard-coded the release to redhat. + This should be handled properly by all red hat distros. + +* Wed May 4 2005 Jeff Moyer - 1:4.1.4-8 +- Add in the deferred syslog patch. This fixes a hung automounter issue + related to unsafe calls to syslog in signal handler context. + +* Tue May 3 2005 Jeff Moyer - 1:4.1.4-7 +- I reversed the checking for multimount entries, breaking those configs! + This update puts the code back the way it was before I broke it. + +* Tue Apr 26 2005 Jeff Moyer - 1:4.1.4-6 +- Fix a race between mounting a share and updating the cache in the parent + process. If the mount completed first, the parent would not expire the + stale entry, leaving it first on the list. This causes map updates to not + be recognized (well, worse, they are recognized after the first expire, but + not subsequent ones). Fixes a regression, bug #137026 (rhel3 bug). + +* Fri Apr 15 2005 Chris Feist - 1:4.1.4-5 +- Fixed regression with -browse not taking effect. + +* Wed Apr 13 2005 Jeff Moyer - 1:4.1.4-4 +- Finish up with the merge breakage. +- Temporary fix for the multimount detection code. It seems half-baked. + +* Wed Apr 13 2005 Jeff Moyer - 1:4.1.4-3 +- Fix up the one-auto-master patch. My "improvements" had side-effects. + +* Wed Apr 13 2005 Jeff Moyer - 1:4.1.4-2 +- Import 4.1.4 and merge. + +* Mon Apr 4 2005 Jeff Moyer - 1:4.1.3-123 +- Add in an error case that was omitted in the multi-over patch. +- Update our auto.net to reflect the changes that went into 4.1.4_beta2. + This fixes a problem seen by at least one customer where a malformed entry + appeared first in the multimount list, thus causing the entire multimount + to be ignored. This new auto.net places that entry at the end, purely by + luck, but it fixes the problem in this one case. + +* Thu Mar 31 2005 Jeff Moyer - 1:4.1.3-119 +- Merge in the multi-over patch. This resolves an issue whereby multimounts + (such as those used for /net) could be processed in the wrong order, + resulting in directories not showing up in a multimount tree. The fix + is to process these directories in order, shortest to longer path. + +* Wed Mar 23 2005 Chris Feist - 1:4.1.3-115 +- Fixed regression causing any entries after a wildcard in an + indirect map to be ignored. (bz #151668). +- Fixed regression which caused local hosts to be mount instead + of --bind local directories. (bz #146887) + +* Thu Mar 17 2005 Chris Feist - 1:4.1.3-111 +- Fixed one off bug in the submount-variable-propagation patch. + (bz #143074) +- Fixed a bug in the init script which wouldn't find the -browse + option if it was preceded by another option. (fz #113494) + +* Mon Feb 28 2005 Chris Feist - 1:4.1.3-100 +- When using ldap if auto.master doesn't exist we now check for auto_master. + Addresses bz #130079 +- When using an auto.smb map we now remove the leading ':' from the path which + caused mount to fail in the past. Addresses bz #147492 +- Autofs now checks /etc/nsswitch.conf to determine in what order files & nis + are checked when looking up autofs submount maps which don't specify a + maptype. Addresses IT #57612. + +* Mon Feb 14 2005 Jeff Moyer - 1:4.1.3-99 +- Change Copyright to License in the spec file so it will build. + +* Fri Feb 11 2005 Jeff Moyer - 1:4.1.3-98 +- Program maps can repeat the last character of output. Fix this. + Addresses bz #138606 +- Return first entry when there are duplicate keys in a map. Addresses + bz #140108. +- Propagate custom map variables to submounts. Fixes bz #143074. +- Create a sysconfig variable to control whether we source only one master + map (the way sun does), or source all maps found (which is the default for + backwards compatibility). Addresses bz #143126. +- Revised version of the get_best_mount patch. (#146887) cfeist@redhat.com + The previous patch introduced a regression. Non-replicated mounts would + not have the white space stripped from the entry and the mount would fail. +- Handle comment characters in the middle of the automount line in + /etc/nsswitch.conf. Addresses bz #127457. + +* Wed Feb 2 2005 Chris Feist - 1:4.1.3-94 +- Stop automount from pinging hosts if there is only one host (#146887) + +* Wed Feb 2 2005 Jeff Moyer - 1:4.1.3-90 +- Fix potential double free in cache_release. This bug showed up in a + multi-map setup. Two calls to cache_release would result in a SIGSEGV, + and the automount process would never exit. + +* Mon Jan 24 2005 Chris Feist - 1:4.3-82 +- Fixed documentation so users know that any local mounts override + any other weighted mount. + +* Mon Jan 24 2005 Chris Feist - 1:4.3-80 +- Added a variable to determine if we created the directory or not + so we don't accidently remove a directory that we didn't create when + we stop autofs. (bz #134399) + +* Tue Jan 11 2005 Jeff Moyer - 1:4.1.3-76 +- Fix the large program map patch. + +* Tue Jan 11 2005 Jeff Moyer - 1:4.1.3-75 +- Fix some merging breakages that caused the package not to build. + +* Thu Jan 6 2005 - 1:4.1.3-74 +- Add in the map expiry patch +- Bring in other patches that have been committed to other branches. This + version should now contain all fixes we have to date +- Merge conflicts due to map expiry changes + +* Fri Nov 19 2004 Jeff Moyer - 1:4.1.3-57 +- Pass a socket into clntudp_bufcreate so that we don't use up additional + reserved ports. This patch, along with the socket leak fix, addresses + bz #128966. + +* Wed Nov 17 2004 - 1:4.1.3-56 +- Somehow the -browse patch either didn't get committed or got reverted. + Fixed. + +* Tue Nov 16 2004 Jeff Moyer - 1:4.1.3-55 +- Fix program maps so that they can have gt 4k characters. (Neil Horman) + Addresses bz #138994. +- Add a space after the colon here "Starting automounter:" in init script. + Fixes bz #138513. + +* Mon Nov 15 2004 Jeff Moyer - 1:4.1.3-53 +- Make autofs understand -[no]browse. Addresses fz #113494. + +* Thu Nov 11 2004 Jeff Moyer - 1:4.1.3-48 +- Fix the umount loop device function in the init script. + +* Wed Oct 27 2004 Chris Feist - 1:4.1.3-34 +- Added a patch to fix the automounter failing on ldap maps + when it couldn't get the whole map. (ie. when the search + limit was lower than the number of results) + +* Thu Oct 21 2004 Chris Feist - 1:4.1.3-32 +- Fixed the use of +ypmapname so the maps included with +ypmapname + are used in the correct order. (In the past the '+' entries + were always processed after local entries.) + +* Thu Oct 21 2004 Chris Feist - 1:4.1.3-31 +- Fixed the duplicate map detection code to detect if maps try + to mount on top of existing maps. + +* Wed Oct 20 2004 Chris Feist - 1:4.1.3-29 +- Fixed a problem with backwards compatability. Specifying local + maps without '/etc/' prepended to them now works. (bz #136038) + +* Fri Oct 15 2004 Chris Feist - 1:4.1.3-28 +- Fixed a bug which caused directories to never be unmounted. (bz #134403) + +* Thu Oct 14 2004 Chris Feist - 1:4.1.3-27 +- Fixed an error in the init script which caused duplicate entries to be + displayed when asking for autofs status. + +* Fri Oct 1 2004 Jeff Moyer - 1:4.1.3-22 +- Comment out map expiry (and related) patch for an FC3 build. + +* Thu Sep 23 2004 Jeff Moyer - 1:4.1.3-21 +- Make local options apply to all maps in a multi-map entry. + +* Tue Sep 21 2004 Jeff Moyer - 1:4.1.3-20 +- Merged my and Ian's socket leak fixes into one, smaller patch. Only + partially addresses bz #128966. +- Fix some more echo lines for internationalization. bz #77820 +- Revert the only one auto.master patch until we implement the +auto_master + syntax. Temporarily addresses bz #133055. + +* Thu Sep 2 2004 Jeff Moyer - 1:4.1.3-18 +- Umount loopback filesystems under automount points when stopping the + automounter. +- Uncomment the map expiry patch. +- change a close to an fclose in lookup_file.c + +* Tue Aug 31 2004 Jeff Moyer - 1:4.1.3-17 +- Add patch to support parsing nsswitch.conf to determine map sources. +- Disable this patch, and Ian's map expiry patch for a FC build. + +* Tue Aug 24 2004 Jeff Moyer - 1:4.1.3-16 +- Version 3 of Ian's map expiry changes. + +* Wed Aug 18 2004 Jeff Moyer - 1:4.1.3-15 +- Fix a socket leak in the rpc_subs, causing mounts to fail since we are + running out of port space fairly quickly. + +* Wed Aug 18 2004 Jeff Moyer - 1:4.1.3-14 +- New map expiry patch from Ian. +- Fix a couple signal races. No known problem reports of these, but they + are holes, none-the-less. + +* Tue Aug 10 2004 Jeff Moyer - 1:4.1.3-13 +- Only read one auto.master map (instead of concatenating all found sources). +- Uncomment Ian's experimental mount expiry patch. + +* Fri Aug 6 2004 Jeff Moyer - 1:4.1.3-12 +- Add a sysconfig entry to disable direct map support, and set this to + 1 by default. +- Disable the beta map expiry logic so I can build into a stable distro. +- Add defaults for all of the sysconfig variables to the init script so + we don't trip over user errors (i.e. deleting /etc/sysconfig/autofs). + +* Wed Aug 4 2004 Jeff Moyer - 1:4.1.3-11 +- Add beta map expiry code for wider testing. (Ian Kent) +- Fix check for ghosting option. I forgot to check for it in DAEMONOPTIONS. +- Remove STRIPDASH from /etc/sysconfig/autofs + +* Mon Jul 12 2004 Jeff Moyer - 1:4.1.3-10 +- Add bad chdir patch from Ian Kent. +- Add a typo fix for the mtab lock file. +- Nuke the stripdash patch. It didn't solve a problem. + +* Tue Jun 22 2004 Jeff Moyer - 1:4.1.3-9 +- Bump revison for inclusion in RHEL 3. + +* Mon Jun 21 2004 Jeff Moyer - 1:4.1.3-8 +- Change icmp ping to an rpc ping. (Ian Kent) +- Fix i18n patch + o Remove the extra \" from one echo line. + o Use echo -e if we are going to do a \n in the echo string. + +* Mon Jun 21 2004 Alan Cox +- Fixed i18n bug #107463 + +* Mon Jun 21 2004 Alan Cox +- Fixed i18n bug #107461 + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Sat Jun 5 2004 Jeff Moyer - 1:4.1.3-4 +- Perform an icmp ping request before rpc_pings, since the rpc clnt_create + function has a builtin default timeout of 60 seconds. This could result + in a long delay when a server in a replicated mount setup is down. +- For non-replicated server entries, ping a host before attempting to mount. + (Ian Kent) +- Change to %%configure. +- Put version-release into .version to allow for automount --version to + print exact info. +- Nuke my get-best-mount patch which always uses the long timeout. This + should no longer be needed. +- Put name into changelog entries to make them consistent. Add e:n-v-r + into Florian's entry. +- Stop autofs before uninstalling + +* Sat Jun 05 2004 Florian La Roche - 1:4.1.3-3 +- add a preun script to remove autofs + +* Tue Jun 1 2004 Jeff Moyer - 1:4.1.3-2 +- Incorporate patch from Ian which fixes an infinite loop seen by those + running older versions of the kernel patches (triggered by non-strict mounts + being the default). + +* Tue Jun 1 2004 Jeff Moyer - 1:4.1.3-1 +- Update to upstream 4.1.3. + +* Thu May 6 2004 Jeff Moyer - 1:4.1.2-6 +- The lookup_yp module only dealt with YPERR_KEY, all other errors were + treated as success. As a result, if the ypdomain was not bound, the + subprocess that starts mounts would SIGSEGV. This is now fixed. +- Option parsing in the init script was not precise enough, sometimes matching + filesystem options to one of --ghost, --timeout, --verbose, or --debug. + The option-parsing patch addresses this issue by making the regexp's much + more precise. +- Ian has rolled a third version of the replicated mount fixes. + +* Tue May 4 2004 Jeff Moyer - 1:4.1.2-5 +- Ian has a new fix for replicated server and multi-mounts. Updated the + patch for testing. Still beta. (Ian Kent) + +* Mon May 3 2004 Jeff Moyer - 1:4.1.2-4 +- Fix broken multi-mounts. test patch. (Ian Kent) + +* Tue Apr 20 2004 Jeff Moyer - 1:4.1.2-3 +- Fix a call to spawnl which forgot to specify a lock file. (nphilipp) + +* Wed Apr 14 2004 - 1:4.1.2-2 +- Pass --libdir= to ./configure so we get this right on 64 bit platforms that + support backwards compat. + +* Wed Apr 14 2004 Jeff Moyer - 1:4.1.2-1 +- Change hard-coded paths in the spec file to the %%{_xxx} variety. +- Update to upstream 4.1.2. +- Add a STRIPDASH option to /etc/sysconfig/autofs which allows for + compatibility with the Sun automounter options specification syntax in + auto.master. See /etc/sysconfig/autofs for more information. Addresses + bug 113950. + +* Tue Apr 6 2004 Jeff Moyer - 1:4.1.1-6 +- Add the /etc/sysconfig/autofs file, and supporting infrastructure in + the init script. +- Add support for UNDERSCORE_TO_DOT for those who want it. +- We no longer own /net. Move it to the filesystem package. + +* Tue Mar 30 2004 Jeff Moyer - 1:4.1.1-5 +- Clarify documentation on direct maps. +- Send automount daemons a HUP signal during reload. This tells them to + re-read maps (otherwise they use a cached version. Patch from the autofs + maintainer. + +* Mon Mar 22 2004 Jeff Moyer - 1:4.1.1-4 +- Fix init script to print out failures where appropriate. +- Build the automount daemon as a PIE. + +* Thu Mar 18 2004 Jeff Moyer - 1:4.1.1-3 +- Fix bug in get_best_mount, whereby if there is only one option, we + choose nothing. This is primarily due to the fact that we pass 0 in to + the get_best_mount function for the long timeout parameter. So, we + timeout trying to contact our first and only server, and never retry. + +* Thu Mar 18 2004 Jeff Moyer - 1:4.1.1-2 +- Prevent startup if a mountpoint is already mounted. + +* Thu Mar 18 2004 Jeff Moyer - 1:4.1.1-1 +- Update to 4.1.1, as it fixes problems with wildcards that people are + seeing quite a bit. + +* Wed Mar 17 2004 Jeff Moyer - 1:4.1.0-8 +- Fix ldap init code to parse server name and options correctly. + +* Tue Mar 16 2004 Jeff Moyer - 1:4.1.0-7 +- Moved the freeing of ap.path to cleanup_exit, as we would otherwise + reference an already-freed variable. + +* Mon Mar 15 2004 Jeff Moyer - 1:4.1.0-6 +- add %%config(noreplace) for auto.* config files. + +* Wed Mar 10 2004 Jeff Moyer 1:4.1.0-5 +- make the init script only recognize redhat systems. Nalin seems to remember + some arcane build system error that can be caused if we don't do this. + +* Wed Mar 10 2004 Jeff Moyer 1:4.1.0-4 +- comment out /net and /misc from the default auto.master. /net is important + since in a default shipping install, we can neatly co-exist with amd. + +* Wed Mar 10 2004 Jeff Moyer 1:4.1.0-3 +- Ported forward Red Hat's patches from 3.1.7 that were not already present + in 4.1.0. +- Moving autofs from version 3.1.7 to 4.1.0 + +* Mon Sep 29 2003 Ian Kent +- Added work around for O(1) patch oddity. + +* Sat Aug 16 2003 Ian Kent +- Fixed tree mounts. +- Corrected transciption error in autofs4-2.4.18 kernel module + +* Sun Aug 10 2003 Ian Kent +- Checked and merged most of the RedHat v3 patches +- Fixed kernel module handling wu-ftpd login problem (again) + +* Thu Aug 7 2003 Ian Kent +- Removed ineffective lock stuff +- Added -n to bind mount to prevent mtab update error +- Added retry to autofs umount to clean matb after fail +- Redirected messages from above to debug log and added info message +- Fixed autofs4 module reentrancy, pwd and chroot handling + +* Wed Jul 30 2003 Ian Kent +- Fixed autofs4 ghosting patch for 2.4.19 and above (again) +- Fixed autofs directory removal on failure of autofs mount +- Fixed lock file wait function overlapping calls to (u)mount + +* Sun Jul 27 2003 Ian Kent +- Implemented LDAP direct map handling for nisMap and automountMap schema +- Fixed autofs4 ghosting patch for 2.4.19 and above (again) +- Added locking to fix overlapping internal calls to (u)mount +- Added wait for mtab~ to improve tolerance of overlapping external calls to (u)mount +- Fixed ghosted directory removal after failed mount attempt + +* Wed May 28 2003 Ian Kent +- Cleaned up an restructured my added code +- Corrected ghosting problem with 2.4.19 and above +- Added autofs4 ghosting patch for 2.4.19 and above +- Implemented HUP signal to force update of ghosted maps + +* Sat Mar 23 2002 Ian Kent +- Add patch to implement directory ghosting and direct mounts +- Add patch to for autofs4 module to support ghosting + +* Wed Jan 17 2001 Nalin Dahyabhai +- use -fPIC instead of -fpic for modules and honor other RPM_OPT_FLAGS + +* Tue Feb 29 2000 Nalin Dahyabhai +- enable hesiod support over libbind + +* Fri Aug 13 1999 Cristian Gafton +- add patch from rth to avoid an infinite loop