Browse Source

autofs package update

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 7 years ago
parent
commit
c9172b3a05
  1. 78
      SOURCES/autofs-5.0.6-fix-recursive-mount-deadlock.patch
  2. 38
      SOURCES/autofs-5.0.6-increase-file-map-read-buffer-size.patch
  3. 56
      SOURCES/autofs-5.0.7-README-update-mailing-list-subscription-info.patch
  4. 35
      SOURCES/autofs-5.0.7-add-after-sssd-dependency-to-unit-file.patch
  5. 48
      SOURCES/autofs-5.0.7-add-changlog-entry-for-coverity-fixes.patch
  6. 24
      SOURCES/autofs-5.0.7-add-debug-alert-for-waitpid-in-check_nfs_mount_version.patch
  7. 691
      SOURCES/autofs-5.0.7-add-enable-sloppy-mount-option-to-configure.patch
  8. 23
      SOURCES/autofs-5.0.7-add-initialization-of-bind_result-in.patch-do_sasl_bind.patch
  9. 25
      SOURCES/autofs-5.0.7-add-map-entry-null-check-in-do_expire_direct.patch
  10. 24
      SOURCES/autofs-5.0.7-add-mapent-null-check-in-lookup-nisplus-lookup_mount.patch
  11. 23
      SOURCES/autofs-5.0.7-add-null-check-in-extract_version.patch
  12. 26
      SOURCES/autofs-5.0.7-add-null-check-in-parse_server_string.patch
  13. 26
      SOURCES/autofs-5.0.7-add-null-check-in-read_one.patch
  14. 23
      SOURCES/autofs-5.0.7-add-pgrp-check-in-do_spawn.patch
  15. 70
      SOURCES/autofs-5.0.7-add-short-host-name-standard-marco-variable.patch
  16. 171
      SOURCES/autofs-5.0.7-add-std-vars-to-program-map-invocation.patch
  17. 217
      SOURCES/autofs-5.0.7-add-symlink-pseudo-option.patch
  18. 42
      SOURCES/autofs-5.0.7-add-timeout-option-description-to-man-page.patch
  19. 69
      SOURCES/autofs-5.0.7-allow-non-root-user-to-check-status.patch
  20. 50
      SOURCES/autofs-5.0.7-allow-nsswitch_conf-to-not-contain-automount-lines.patch
  21. 231
      SOURCES/autofs-5.0.7-allow-use-of-hosts-map-in-maps.patch
  22. 38
      SOURCES/autofs-5.0.7-check-for-protocol-option.patch
  23. 28
      SOURCES/autofs-5.0.7-configure-allow-cross-compilation-update.patch
  24. 41
      SOURCES/autofs-5.0.7-configure-in-allow-cross-compilation.patch
  25. 40
      SOURCES/autofs-5.0.7-depricate-nosymlink-pseudo-option.patch
  26. 48
      SOURCES/autofs-5.0.7-document-allowed-map-sources-in-auto_master.patch
  27. 46
      SOURCES/autofs-5.0.7-document-browse-option-in-man-page.patch
  28. 59
      SOURCES/autofs-5.0.7-dont-fail-on-master-map-self-include.patch
  29. 46
      SOURCES/autofs-5.0.7-dont-override-LDFLAGS-in-make-rules.patch
  30. 68
      SOURCES/autofs-5.0.7-dont-probe-rdma-mounts.patch
  31. 69
      SOURCES/autofs-5.0.7-dont-schedule-new-alarms-after-readmap.patch
  32. 41
      SOURCES/autofs-5.0.7-dont-use-dirent-d_type-to-filter-out-files-in-scandir.patch
  33. 54
      SOURCES/autofs-5.0.7-dont-wait-forever-to-restart.patch
  34. 51
      SOURCES/autofs-5.0.7-fix-a-couple-of-compiler-warnings.patch
  35. 45
      SOURCES/autofs-5.0.7-fix-add-null-check-in-parse_server_string.patch
  36. 24
      SOURCES/autofs-5.0.7-fix-automounter-support-on-parisc.patch
  37. 38
      SOURCES/autofs-5.0.7-fix-bad-mkdir-permission-on-create.patch
  38. 27
      SOURCES/autofs-5.0.7-fix-check-mkdir_path-in-mount_bind-mount_mount.patch
  39. 216
      SOURCES/autofs-5.0.7-fix-compilation-of-lookup_ldap_c-without-sasl.patch
  40. 117
      SOURCES/autofs-5.0.7-fix-crash-due-to-thread-unsafe-use-of-libldap.patch
  41. 108
      SOURCES/autofs-5.0.7-fix-dumpmaps-multi-output.patch
  42. 25
      SOURCES/autofs-5.0.7-fix-fcntl-return-check.patch
  43. 179
      SOURCES/autofs-5.0.7-fix-file-descriptor-leak-when-reloading-the-daemon.patch
  44. 37
      SOURCES/autofs-5.0.7-fix-fix-map-entry-duplicate-offset-detection.patch
  45. 283
      SOURCES/autofs-5.0.7-fix-fix-wildcard-multi-map-regression.patch
  46. 94
      SOURCES/autofs-5.0.7-fix-get_nfs_info-probe.patch
  47. 55
      SOURCES/autofs-5.0.7-fix-host_addr-null-reference-in-add_new_host.patch
  48. 41
      SOURCES/autofs-5.0.7-fix-inconsistent-signed-usage-for-__rpc_ping.patch
  49. 23
      SOURCES/autofs-5.0.7-fix-inconsistent-use-of-cache-lock-in-handle_packet_missing_direct.patch
  50. 30
      SOURCES/autofs-5.0.7-fix-incorrect-check-in-flag_is_owned.patch
  51. 22
      SOURCES/autofs-5.0.7-fix-incorrect-name-in-test.patch
  52. 22
      SOURCES/autofs-5.0.7-fix-incorrect-value-reference-in-parse_line.patch
  53. 39
      SOURCES/autofs-5.0.7-fix-init-script-status-return.patch
  54. 55
      SOURCES/autofs-5.0.7-fix-interface-address-null-check.patch
  55. 297
      SOURCES/autofs-5.0.7-fix-ipv6-proximity-calculation.patch
  56. 21
      SOURCES/autofs-5.0.7-fix-leaked-ldap-percent-hack-allocation-in-lookup_one.patch
  57. 66
      SOURCES/autofs-5.0.7-fix-libtirpc-build-option.patch
  58. 37
      SOURCES/autofs-5.0.7-fix-map-entry-duplicate-offset-detection.patch
  59. 62
      SOURCES/autofs-5.0.7-fix-master-map-bogus-keywork-match.patch
  60. 43
      SOURCES/autofs-5.0.7-fix-master-map-mount-options-matching.patch
  61. 30
      SOURCES/autofs-5.0.7-fix-memory-leak-in-get_dc_list.patch
  62. 46
      SOURCES/autofs-5.0.7-fix-nobind-man-page-description.patch
  63. 47
      SOURCES/autofs-5.0.7-fix-nobind-sun-escaped-map-entries.patch
  64. 81
      SOURCES/autofs-5.0.7-fix-null-map-entry-order-handling.patch
  65. 51
      SOURCES/autofs-5.0.7-fix-parse-buffer-initialization.patch
  66. 285
      SOURCES/autofs-5.0.7-fix-portmap-lookup.patch
  67. 21
      SOURCES/autofs-5.0.7-fix-possible-use-after-free-in-lookup_dir-lookup_init.patch
  68. 157
      SOURCES/autofs-5.0.7-fix-potential-null-dereference-in-lookup_mount.patch
  69. 36
      SOURCES/autofs-5.0.7-fix-probe-each-nfs-version-in-turn-for-singleton-mounts.patch
  70. 37
      SOURCES/autofs-5.0.7-fix-requires-in-spec-file.patch
  71. 128
      SOURCES/autofs-5.0.7-fix-several-off-by-one-errors.patch
  72. 45
      SOURCES/autofs-5.0.7-fix-some-automount_8-typos.patch
  73. 23
      SOURCES/autofs-5.0.7-fix-spawn_umount-return-check-in-mount_bind-lookup_init.patch
  74. 45
      SOURCES/autofs-5.0.7-fix-submount-offset-delete.patch
  75. 70
      SOURCES/autofs-5.0.7-fix-submount-tree-not-all-expiring.patch
  76. 36
      SOURCES/autofs-5.0.7-fix-syncronize-handle_mounts-shutdown.patch
  77. 72
      SOURCES/autofs-5.0.7-fix-systemd-unidir-in-spec-file.patch
  78. 33
      SOURCES/autofs-5.0.7-fix-typo-in-automount-8.patch
  79. 49
      SOURCES/autofs-5.0.7-fix-use-cache-entry-after-free-mistake.patch
  80. 54
      SOURCES/autofs-5.0.7-fix-use-get_proximity-without-libtirpc.patch
  81. 225
      SOURCES/autofs-5.0.7-fix-wildcard-multi-map-regression.patch
  82. 57
      SOURCES/autofs-5.0.7-handle-new-location-of-systemd.patch
  83. 84
      SOURCES/autofs-5.0.7-improve-timeout-option-description.patch
  84. 25
      SOURCES/autofs-5.0.7-include-usage-in-usage-message.patch
  85. 448
      SOURCES/autofs-5.0.7-lib-defaults-use-WITH_LDAP-conditional-around-LDAP-types.patch
  86. 57
      SOURCES/autofs-5.0.7-make-description-of-default-MOUNT_WAIT-setting-clear.patch
  87. 64
      SOURCES/autofs-5.0.7-make-dump-maps-check-for-duplicate-indirect-mounts.patch
  88. 156
      SOURCES/autofs-5.0.7-make-yellow-pages-support-optional.patch
  89. 73
      SOURCES/autofs-5.0.7-misc-man-page-fixes.patch
  90. 39
      SOURCES/autofs-5.0.7-modules-replicated-use-sin6.addr-s6_addr32.patch
  91. 40
      SOURCES/autofs-5.0.7-only-probe-specific-nfs-version-when-requested.patch
  92. 104
      SOURCES/autofs-5.0.7-probe-each-nfs-version-in-turn-for-singleton-mounts.patch
  93. 30
      SOURCES/autofs-5.0.7-recheck-valid-map-entry-lookup-return-in-do_readmap_mount.patch
  94. 36
      SOURCES/autofs-5.0.7-remove-debug-only-code-in-alarm-c.patch
  95. 125
      SOURCES/autofs-5.0.7-setup-program-map-env-from-macro-table.patch
  96. 73
      SOURCES/autofs-5.0.7-syncronize-handle_mounts-shutdown.patch
  97. 366
      SOURCES/autofs-5.0.7-teach-dumpmaps-to-output-simple-key-value-pairs.patch
  98. 63
      SOURCES/autofs-5.0.7-try-and-cleanup-after-dumpmaps.patch
  99. 92
      SOURCES/autofs-5.0.7-update-kernel-include-files.patch
  100. 471
      SOURCES/autofs-5.0.7-use-numeric-protocol-ids-instead-of-protoent-structs.patch
  101. Some files were not shown because too many files have changed in this diff Show More

78
SOURCES/autofs-5.0.6-fix-recursive-mount-deadlock.patch

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
autofs-5.0.6 - fix recursive mount deadlock

From: Ian Kent <raven@themaw.net>

Prior to the vfs-automount changes that went into 2.6.38
and were finalized in 3.1 it was not possible to block
path walks into multi-mounts whose root was covered by
another mount. To deal with that a write lock was used
to ensure the mount tree construction was completed. This
restricts the types of recursively defined mount maps that
can be used and can lead to a deadlock during lookup.

Now that we can prevent processes walking into multi-mounts
that are under construction we no longer need to use a
write lock.

Also, in the patch below, a cache writelock is changed to
a read lock because a write lock isn't needed since the
map cache entry isn't being updated.
---

CHANGELOG | 1 +
daemon/direct.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 936c9ab..9cdad6e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@
- configure.in: allow cross compilation.
- README: update mailing list subscription info.
- allow non root user to check status.
+- fix recursive mount deadlock.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/direct.c b/daemon/direct.c
index 7e2f0d7..3e09c5d 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -1285,6 +1285,8 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
struct timespec wait;
struct timeval now;
int ioctlfd, len, state;
+ unsigned int kver_major = get_kver_major();
+ unsigned int kver_minor = get_kver_minor();
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
@@ -1297,8 +1299,16 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
* cache entry we will not be able to find the mapent. So
* we must take the source writelock to ensure the parent
* has mount is complete before we look for the entry.
+ *
+ * Since the vfs-automount kernel changes we can now block
+ * on covered mounts during mount tree construction so a
+ * write lock is no longer needed. So we now can handle a
+ * wider class of recursively define mount lookups.
*/
- master_source_writelock(ap->entry);
+ if (kver_major > 5 || (kver_major == 5 && kver_minor > 1))
+ master_source_readlock(ap->entry);
+ else
+ master_source_writelock(ap->entry);
map = ap->entry->maps;
while (map) {
/*
@@ -1311,7 +1321,7 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
}
mc = map->mc;
- cache_writelock(mc);
+ cache_readlock(mc);
me = cache_lookup_ino(mc, pkt->dev, pkt->ino);
if (me)
break;

38
SOURCES/autofs-5.0.6-increase-file-map-read-buffer-size.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
autofs-5.0.6 - increase file map read buffer size

From: Ian Kent <raven@themaw.net>

The file map entry read buffer can be too small for larger
multi-mount map entries so increase it.
---

CHANGELOG | 1 +
include/automount.h | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 9cdad6e..3bdf8a4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -13,6 +13,7 @@
- README: update mailing list subscription info.
- allow non root user to check status.
- fix recursive mount deadlock.
+- increase file map read buffer size.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/automount.h b/include/automount.h
index 561fcc2..37541f5 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -233,7 +233,7 @@ int rmdir_path(struct autofs_point *ap, const char *path, dev_t dev);
#define AUTOFS_LOOKUP_VERSION 5
#define KEY_MAX_LEN NAME_MAX
-#define MAPENT_MAX_LEN 4095
+#define MAPENT_MAX_LEN 16384
#define PARSE_MAX_BUF KEY_MAX_LEN + MAPENT_MAX_LEN + 2
int lookup_nss_read_master(struct master *master, time_t age);

56
SOURCES/autofs-5.0.7-README-update-mailing-list-subscription-info.patch

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
autofs-5.0.7 - README: update mailing list subscription info

From: Chris Packham <chris.packham@alliedtelesis.co.nz>

Following the kernel.org compromise the mailing list was moved to
vger.kernel.org. Update the subscription info and add URLs for the gmane
mailing list archive.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

CHANGELOG | 1 +
README | 17 ++++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index fe801e8..44c9fb2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,6 +10,7 @@
- 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.
25/07/2012 autofs-5.0.7
=======================
diff --git a/README b/README
index cef16a9..9024e64 100644
--- a/README
+++ b/README
@@ -43,9 +43,20 @@ Fitzhardinge's <jeremy@goop.org> work on autofs 3. Further enhancements
have been made by Ian Kent <raven@themaw.net>.
If you use or want to help develop autofs, please join the autofs
-mailing list by visiting:
+mailing list by sending an email to:
- http://linux.kernel.org/mailman/listinfo/autofs
+ majordomo@vger.kernel.org
-and folling the instructions there to subscribe to the autofs mailing list.
+With the body text:
+
+ subscribe autofs
+
+Once subscribed you can send patches to:
+
+ autofs@vger.kernel.org
+
+The autofs mailing list archive can be viewed on gmane:
+
+ http://news.gmane.org/gmane.linux.kernel.autofs
+ http://blog.gmane.org/gmane.linux.kernel.autofs

35
SOURCES/autofs-5.0.7-add-after-sssd-dependency-to-unit-file.patch

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
autofs-5.0.7 - add after sssd dependency to unit file

From: Ian Kent <ikent@redhat.com>

When using sss as a map source autofs can sometimes start before
sssd is ready.
---
CHANGELOG | 1 +
samples/autofs.service.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 7749f01..2734fe3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -55,6 +55,7 @@
- fix add null check in parse_server_string().
- don't override LDFLAGS in make rules.
- fix a couple of compiler warnings.
+- add after sssd dependency to unit file.
25/07/2012 autofs-5.0.7
=======================
diff --git a/samples/autofs.service.in b/samples/autofs.service.in
index 056ab5e..777463d 100644
--- a/samples/autofs.service.in
+++ b/samples/autofs.service.in
@@ -1,6 +1,6 @@
[Unit]
Description=Automounts filesystems on demand
-After=network.target ypbind.service
+After=network.target ypbind.service sssd.service
[Service]
Type=forking

48
SOURCES/autofs-5.0.7-add-changlog-entry-for-coverity-fixes.patch

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
autofs-5.0.7 - add changlog entry for coverity fixes

From: Ian Kent <raven@themaw.net>

A bunch of changes have been made based on a Covarity report.
Mostly I pust the changes into seperate patches so they can be kept simple.

Changes:
- fix fcntl return check.
- fix spawn_umount() return check in mount_bind.c:lookup_init().
- fix check mkdir_path() in mount_bind.c:mount_mount().
- fix incorrect var name in test.
- remove debug only code in alarm.c.
- fix inconsistent use of cache lock in handle_packet_missing_direct().
- fix several off by one errors.
- fix memory leak in get_dc_list().
- fix host_addr null reference in add_new_host().
- add null check in read_one().
- add pgrp check in do_spawn().
- fix inconsistent signed usage for __rpc_ping().
- add null check in extract_version().
- recheck valid map entry lookup return in do_readmap_mount().
- add null check in parse_server_string().
- add map entry null check in do_expire_direct().
- add mapent null check in lookup_nisplus.c:lookup_mount().
- fix potential null dereference in lookup_mount().
- fix leaked ldap percent hack allocation in lookup_one().
- fix incorrect value reference in parse_line().
- add debug alert for waitpid in check_nfs_mount_version().
- add initialization of bind_result in-do_sasl_bind().
- fix incorrect check in flag_is_owned().
- fix possible use after free in lookup_dir.c:lookup_init().
---
CHANGELOG | 1 +
1 file changed, 1 insertion(+)

diff --git a/CHANGELOG b/CHANGELOG
index 48e9806..25179b1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -49,6 +49,7 @@
- fix master map bogus keywork match.
- fix fix map entry duplicate offset detection.
- probe each nfs version in turn for singleton mounts.
+- add changlog entry for coverity fixes.
25/07/2012 autofs-5.0.7
=======================

24
SOURCES/autofs-5.0.7-add-debug-alert-for-waitpid-in-check_nfs_mount_version.patch

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
autofs-5.0.7 - add debug alert for waitpid in check_nfs_mount_version()

From: Ian Kent <raven@themaw.net>

We don't really case if there's no process to wait for but add a debug
log alert for information.
---
lib/mounts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/mounts.c b/lib/mounts.c
index 7b959b8..a6f560e 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -287,7 +287,8 @@ int check_nfs_mount_version(struct nfs_mount_vers *vers,
ret = 0;
}
- if (waitpid(f, &status, 0) != f) ;
+ if (waitpid(f, &status, 0) != f)
+ debug(LOGOPT_NONE, "no process found to wait for");
pthread_sigmask(SIG_SETMASK, &oldsig, NULL);
pthread_setcancelstate(cancel_state, NULL);

691
SOURCES/autofs-5.0.7-add-enable-sloppy-mount-option-to-configure.patch

@ -0,0 +1,691 @@ @@ -0,0 +1,691 @@
autofs-5.0.7 - add enable sloppy mount option to configure

From: Ian Kent <ikent@redhat.com>

Add an option --enable-sloppy-mount or --disable-sloppy-mount to force
or prevent the use of the -s option to mount, thus avoiding the
autodetection. This can be useful in setups where executing mount
might be undesirable, particularly in packaging environments.

2013-04-04 Martin von Gagern

References:
* https://bugs.gentoo.org/453778
---
CHANGELOG | 1
aclocal.m4 | 2
configure | 252 +++++++++++++++++++++++++++++++---------------------------
configure.in | 10 ++
4 files changed, 146 insertions(+), 119 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 61edddf..66c11de 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -42,6 +42,7 @@
- fix submount tree not all expiring.
- make dump maps check for duplicate indirect mounts.
- document allowed map sources in auto.master.
+- add enable sloppy mount option to configure.
25/07/2012 autofs-5.0.7
=======================
diff --git a/aclocal.m4 b/aclocal.m4
index 47bca0c..c5de159 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -66,7 +66,7 @@ AC_DEFUN(AF_SLOPPY_MOUNT,
[if test -n "$MOUNT" ; then
AC_MSG_CHECKING([if mount accepts the -s option])
if "$MOUNT" -s > /dev/null 2>&1 ; then
- AC_DEFINE(HAVE_SLOPPY_MOUNT, 1, [define if the mount command supports the -s option])
+ enable_sloppy_mount=yes
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
diff --git a/configure b/configure
index c1423d8..08b7ccc 100755
--- a/configure
+++ b/configure
@@ -1,11 +1,9 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68.
+# Generated by GNU Autoconf 2.69.
#
#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -212,21 +236,25 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
- # We cannot yet assume a decent shell, so we have to provide a
- # neutralization value for shells without unset; and this also
- # works around shells that cannot unset nonexistent variables.
- # Preserve -v and -x to the replacement shell.
- BASH_ENV=/dev/null
- ENV=/dev/null
- (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
- export CONFIG_SHELL
- case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
- esac
- exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
fi
if test x$as_have_required = xno; then :
@@ -328,6 +356,14 @@ $as_echo X"$as_dir" |
} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -449,6 +485,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -483,16 +523,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -504,28 +544,8 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -715,6 +735,7 @@ with_fifodir
with_flagdir
with_libtirpc
with_dmalloc
+enable_sloppy_mount
with_hesiod
with_openldap
with_sasl
@@ -1187,8 +1208,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1341,6 +1360,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-sloppy-mount enable the use of the -s option to mount
--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
@@ -1442,9 +1462,9 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
configure
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.69
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1520,7 +1540,7 @@ $as_echo "$ac_try_echo"; } >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
+ test -x conftest$ac_exeext
}; then :
ac_retval=0
else
@@ -1740,7 +1760,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2324,7 +2344,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2364,7 +2384,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2417,7 +2437,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2458,7 +2478,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -2516,7 +2536,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2560,7 +2580,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3006,8 +3026,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3209,7 +3228,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MOUNT="$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
@@ -3269,7 +3288,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MOUNT_NFS="$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
@@ -3329,7 +3348,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_UMOUNT="$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
@@ -3389,7 +3408,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_E2FSCK="$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
@@ -3448,7 +3467,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_E3FSCK="$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
@@ -3507,7 +3526,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_E4FSCK="$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
@@ -3566,7 +3585,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ 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
@@ -3626,7 +3645,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_LEX="$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
@@ -3682,7 +3701,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_YACC="$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
@@ -3738,7 +3757,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_RANLIB="$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
@@ -3794,7 +3813,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_RPCGEN="$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
@@ -3858,13 +3877,19 @@ fi
# Newer mounts have the -s (sloppy) option to ignore unknown options,
# good for portability
#
-if test -n "$MOUNT" ; then
+# Check whether --enable-sloppy-mount was given.
+if test "${enable_sloppy_mount+set}" = set; then :
+ enableval=$enable_sloppy_mount;
+else
+ enable_sloppy_mount=auto
+fi
+
+if test x$enable_sloppy_mount = xauto; then
+ if test -n "$MOUNT" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if mount accepts the -s option" >&5
$as_echo_n "checking if mount accepts the -s option... " >&6; }
if "$MOUNT" -s > /dev/null 2>&1 ; then
-
-$as_echo "#define HAVE_SLOPPY_MOUNT 1" >>confdefs.h
-
+ enable_sloppy_mount=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
@@ -3872,6 +3897,12 @@ $as_echo "yes" >&6; }
$as_echo "no" >&6; }
fi
fi
+fi
+if test x$enable_sloppy_mount = xyes; then
+
+$as_echo "#define HAVE_SLOPPY_MOUNT 1" >>confdefs.h
+
+fi
# LDAP SASL auth needs libxml and Kerberos
for ac_prog in xml2-config
@@ -3894,7 +3925,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_XML_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
@@ -3969,7 +4000,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_KRB5_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
@@ -4387,7 +4418,7 @@ do
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+ as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
@@ -4453,7 +4484,7 @@ do
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+ as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
@@ -4928,7 +4959,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4968,7 +4999,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5021,7 +5052,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5062,7 +5093,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -5120,7 +5151,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5164,7 +5195,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5360,8 +5391,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -5882,16 +5912,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -5951,28 +5981,16 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -5994,7 +6012,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by $as_me, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -6056,10 +6074,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
config.status
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -6147,7 +6165,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
diff --git a/configure.in b/configure.in
index 4029375..559045a 100644
--- a/configure.in
+++ b/configure.in
@@ -157,7 +157,15 @@ AC_SUBST(sssldir)
# Newer mounts have the -s (sloppy) option to ignore unknown options,
# good for portability
#
-AF_SLOPPY_MOUNT()
+AC_ARG_ENABLE(sloppy-mount,
+[ --enable-sloppy-mount enable the use of the -s option to mount],,
+ enable_sloppy_mount=auto)
+if test x$enable_sloppy_mount = xauto; then
+ AF_SLOPPY_MOUNT()
+fi
+if test x$enable_sloppy_mount = xyes; then
+ AC_DEFINE(HAVE_SLOPPY_MOUNT, 1, [define if the mount command supports the -s option])
+fi
# LDAP SASL auth needs libxml and Kerberos
AF_CHECK_LIBXML()

23
SOURCES/autofs-5.0.7-add-initialization-of-bind_result-in.patch-do_sasl_bind.patch

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
autofs-5.0.7 - add initialization of bind_result in-do_sasl_bind()

From: Ian Kent <raven@themaw.net>

There is an unlikley code path where bind_result could be used uninitialized
so initialize it so it isn't incorrectly used if it has rubish in it.
---
modules/cyrus-sasl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
index b456333..68f9242 100644
--- a/modules/cyrus-sasl.c
+++ b/modules/cyrus-sasl.c
@@ -210,7 +210,7 @@ int
do_sasl_bind(unsigned logopt, LDAP *ld, sasl_conn_t *conn, const char **clientout,
unsigned int *clientoutlen, const char *auth_mech, int sasl_result)
{
- int ret, msgid, bind_result;
+ int ret, msgid, bind_result = LDAP_OTHER;
struct berval client_cred, *server_cred, temp_cred;
LDAPMessage *results;
int have_data, expected_data;

25
SOURCES/autofs-5.0.7-add-map-entry-null-check-in-do_expire_direct.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
autofs-5.0.7 - add map entry null check in do_expire_direct()

From: Ian Kent <raven@themaw.net>

Since we've seen a mount failure for this map entry it should exist
but add a null check in case it's been removed while we waited on
the lock.
---
daemon/direct.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/daemon/direct.c b/daemon/direct.c
index 399ad0a..f85e1b5 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -1019,7 +1019,8 @@ static void *do_expire_direct(void *arg)
struct mapent *me;
cache_writelock(mt.mc);
me = cache_lookup_distinct(mt.mc, mt.name);
- me->ioctlfd = -1;
+ if (me)
+ me->ioctlfd = -1;
cache_unlock(mt.mc);
ops->send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token);
ops->close(ap->logopt, mt.ioctlfd);

24
SOURCES/autofs-5.0.7-add-mapent-null-check-in-lookup-nisplus-lookup_mount.patch

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
autofs-5.0.7 - add mapent null check in lookup_nisplus.c:lookup_mount()

From: Ian Kent <raven@themaw.net>

malloc(3) could return null under low memory conditions, add a null check
for this case.
---
modules/lookup_nisplus.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
index 8237a1e..ef942a7 100644
--- a/modules/lookup_nisplus.c
+++ b/modules/lookup_nisplus.c
@@ -584,7 +584,8 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (me && (me->source == source || *me->key == '/')) {
mapent_len = strlen(me->mapent);
mapent = malloc(mapent_len + 1);
- strcpy(mapent, me->mapent);
+ if (mapent)
+ strcpy(mapent, me->mapent);
}
}
cache_unlock(mc);

23
SOURCES/autofs-5.0.7-add-null-check-in-extract_version.patch

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
autofs-5.0.7 - add null check in extract_version()

From: Ian Kent <raven@themaw.net>

A space should always be found in the passed in string but a check
should be done in case it isn't.
---
lib/mounts.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/mounts.c b/lib/mounts.c
index 0caa0aa..7b959b8 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -168,6 +168,8 @@ unsigned int get_kver_minor(void)
static int extract_version(char *start, struct nfs_mount_vers *vers)
{
char *s_ver = strchr(start, ' ');
+ if (!s_ver)
+ return 0;
while (*s_ver && !isdigit(*s_ver)) {
s_ver++;
if (!*s_ver)

26
SOURCES/autofs-5.0.7-add-null-check-in-parse_server_string.patch

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
autofs-5.0.7 - add null check in parse_server_string()

From: Ian Kent <raven@themaw.net>

Add an error check for the case there's no ':' server name delimiter in
parse_server_string().
---
modules/lookup_ldap.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 17cbe9a..a59de92 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -1212,6 +1212,11 @@ static int parse_server_string(unsigned logopt, const char *url, struct lookup_c
/* Isolate the server. Include the port spec */
if (*ptr != '[')
q = strchr(ptr, ':');
+ if (!q) {
+ crit(logopt, MODPREFIX
+ "LDAP server name not found in %s", ptr);
+ return 0;
+ }
else {
q = ++ptr;
while (*q == ':' || isxdigit(*q))

26
SOURCES/autofs-5.0.7-add-null-check-in-read_one.patch

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
autofs-5.0.7 - add null check in read_one()

From: Ian Kent <raven@themaw.net>

The pointter p shouldn't be null here but add a chack anyway.
---
modules/lookup_file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index 65e5ee6..2836996 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -302,8 +302,10 @@ static int read_one(unsigned logopt, FILE *f, char *key, unsigned int *k_len, ch
if (gotten == got_real || gotten == getting)
goto got_it;
} else if (mapent_len < MAPENT_MAX_LEN) {
- mapent_len++;
- *(p++) = ch;
+ if (p) {
+ mapent_len++;
+ *(p++) = ch;
+ }
nch = getc(f);
if (nch == EOF &&
(gotten == got_real || gotten == getting))

23
SOURCES/autofs-5.0.7-add-pgrp-check-in-do_spawn.patch

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
autofs-5.0.7 - add pgrp check in do_spawn()

From: Ian Kent <raven@themaw.net>

The process group should never be negative here but add a check anyway.
---
daemon/spawn.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/daemon/spawn.c b/daemon/spawn.c
index 9b8d5a2..abb353a 100644
--- a/daemon/spawn.c
+++ b/daemon/spawn.c
@@ -201,7 +201,8 @@ static int do_spawn(unsigned logopt, unsigned int wait,
seteuid(0);
setegid(0);
- setpgid(0, pgrp);
+ if (pgrp >= 0)
+ setpgid(0, pgrp);
}
execv(prog, (char *const *) argv);

70
SOURCES/autofs-5.0.7-add-short-host-name-standard-marco-variable.patch

@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
autofs-5.0.7 - add short host name standard marco variable

From: Ian Kent <raven@themaw.net>

Sometimes the short hostname (without the domain part) could be useful.
Add this to the standard additional macro variables, in particular, to
compliment the ${HOST} macro.
---
CHANGELOG | 1 +
man/autofs.5 | 2 +-
modules/parse_sun.c | 13 +++++++++++++
3 files changed, 15 insertions(+), 1 deletion(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -77,6 +77,7 @@
- fix fix options compare.
- fix max() declaration.
- setup program map env from macro table.
+- add short host name standard marco variable.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/man/autofs.5
+++ autofs-5.0.7/man/autofs.5
@@ -170,7 +170,7 @@ UID The user login ID
GROUP The user group name
GID The user group ID
HOME The user home directory
-HOST Hostname (uname -n)
+SHOST Short hostname (domain part removed if present)
.fi
.RE
.sp
--- autofs-5.0.7.orig/modules/parse_sun.c
+++ autofs-5.0.7/modules/parse_sun.c
@@ -107,6 +107,7 @@ static struct substvar *addstdenv(struct
tsv = pthread_getspecific(key_thread_stdenv_vars);
if (tsv) {
+ struct substvar *mv;
int ret;
long num;
@@ -121,6 +122,17 @@ static struct substvar *addstdenv(struct
list = macro_addvar(list, "USER", 4, tsv->user);
list = macro_addvar(list, "GROUP", 5, tsv->group);
list = macro_addvar(list, "HOME", 4, tsv->home);
+ mv = macro_findvar(list, "HOST", 4);
+ if (mv) {
+ char *shost = strdup(mv->val);
+ if (shost) {
+ char *dot = strchr(shost, '.');
+ if (dot)
+ *dot = '\0';
+ list = macro_addvar(list, "SHOST", 5, shost);
+ free(shost);
+ }
+ }
}
return list;
}
@@ -134,6 +146,7 @@ static struct substvar *removestdenv(str
list = macro_removevar(list, "HOME", 4);
list = macro_removevar(list, "GID", 3);
list = macro_removevar(list, "GROUP", 5);
+ list = macro_removevar(list, "SHOST", 5);
return list;
}

171
SOURCES/autofs-5.0.7-add-std-vars-to-program-map-invocation.patch

@ -0,0 +1,171 @@ @@ -0,0 +1,171 @@
autofs-5.0.7 - add std vars to program map invocation

From: Ian Kent <ikent@redhat.com>

Program maps currently don't have the standard macro variables set
in the environemt when they run.

Also, program maps aren't necessarily executed within a shell so
setting the standard variables in the environment needs to be done
the same way it's done by the Sun map parser.
---
CHANGELOG | 1
include/mounts.h | 3 ++
lib/mounts.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++
modules/lookup_program.c | 2 +
modules/parse_sun.c | 51 -----------------------------------------------
5 files changed, 57 insertions(+), 51 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -79,6 +79,7 @@
- setup program map env from macro table.
- add short host name standard marco variable.
- fix symlink fail message in mount_bind.c.
+- add std vars to program map invocation.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/include/mounts.h
+++ autofs-5.0.7/include/mounts.h
@@ -85,6 +85,9 @@ unsigned int linux_version_code(void);
int check_nfs_mount_version(struct nfs_mount_vers *, struct nfs_mount_vers *);
extern unsigned int nfs_mount_uses_string_options;
+struct substvar *addstdenv(struct substvar *sv);
+struct substvar *removestdenv(struct substvar *sv);
+
unsigned int query_kproto_ver(void);
unsigned int get_kver_major(void);
unsigned int get_kver_minor(void);
--- autofs-5.0.7.orig/lib/mounts.c
+++ autofs-5.0.7/lib/mounts.c
@@ -303,6 +303,57 @@ int check_nfs_mount_version(struct nfs_m
}
#endif
+struct substvar *addstdenv(struct substvar *sv)
+{
+ struct substvar *list = sv;
+ struct thread_stdenv_vars *tsv;
+ char numbuf[16];
+
+ tsv = pthread_getspecific(key_thread_stdenv_vars);
+ if (tsv) {
+ const struct substvar *mv;
+ int ret;
+ long num;
+
+ num = (long) tsv->uid;
+ ret = sprintf(numbuf, "%ld", num);
+ if (ret > 0)
+ list = macro_addvar(list, "UID", 3, numbuf);
+ num = (long) tsv->gid;
+ ret = sprintf(numbuf, "%ld", num);
+ if (ret > 0)
+ list = macro_addvar(list, "GID", 3, numbuf);
+ list = macro_addvar(list, "USER", 4, tsv->user);
+ list = macro_addvar(list, "GROUP", 5, tsv->group);
+ list = macro_addvar(list, "HOME", 4, tsv->home);
+ mv = macro_findvar(list, "HOST", 4);
+ if (mv) {
+ char *shost = strdup(mv->val);
+ if (shost) {
+ char *dot = strchr(shost, '.');
+ if (dot)
+ *dot = '\0';
+ list = macro_addvar(list, "SHOST", 5, shost);
+ free(shost);
+ }
+ }
+ }
+ return list;
+}
+
+struct substvar *removestdenv(struct substvar *sv)
+{
+ struct substvar *list = sv;
+
+ list = macro_removevar(list, "UID", 3);
+ list = macro_removevar(list, "USER", 4);
+ list = macro_removevar(list, "HOME", 4);
+ list = macro_removevar(list, "GID", 3);
+ list = macro_removevar(list, "GROUP", 5);
+ list = macro_removevar(list, "SHOST", 5);
+ return list;
+}
+
/*
* Make common autofs mount options string
*/
--- autofs-5.0.7.orig/modules/lookup_program.c
+++ autofs-5.0.7/modules/lookup_program.c
@@ -271,6 +271,8 @@ int lookup_mount(struct autofs_point *ap
*/
if (ctxt->mapfmt && strcmp(ctxt->mapfmt, "MAPFMT_DEFAULT")) {
struct parse_context *pctxt = (struct parse_context *) ctxt->parse->context;
+ /* Add standard environment as seen by sun map parser */
+ pctxt->subst = addstdenv(pctxt->subst);
macro_setenv(pctxt->subst);
}
execl(ctxt->mapname, ctxt->mapname, name, NULL);
--- autofs-5.0.7.orig/modules/parse_sun.c
+++ autofs-5.0.7/modules/parse_sun.c
@@ -99,57 +99,6 @@ static void kill_context(struct parse_co
free(ctxt);
}
-static struct substvar *addstdenv(struct substvar *sv)
-{
- struct substvar *list = sv;
- struct thread_stdenv_vars *tsv;
- char numbuf[16];
-
- tsv = pthread_getspecific(key_thread_stdenv_vars);
- if (tsv) {
- struct substvar *mv;
- int ret;
- long num;
-
- num = (long) tsv->uid;
- ret = sprintf(numbuf, "%ld", num);
- if (ret > 0)
- list = macro_addvar(list, "UID", 3, numbuf);
- num = (long) tsv->gid;
- ret = sprintf(numbuf, "%ld", num);
- if (ret > 0)
- list = macro_addvar(list, "GID", 3, numbuf);
- list = macro_addvar(list, "USER", 4, tsv->user);
- list = macro_addvar(list, "GROUP", 5, tsv->group);
- list = macro_addvar(list, "HOME", 4, tsv->home);
- mv = macro_findvar(list, "HOST", 4);
- if (mv) {
- char *shost = strdup(mv->val);
- if (shost) {
- char *dot = strchr(shost, '.');
- if (dot)
- *dot = '\0';
- list = macro_addvar(list, "SHOST", 5, shost);
- free(shost);
- }
- }
- }
- return list;
-}
-
-static struct substvar *removestdenv(struct substvar *sv)
-{
- struct substvar *list = sv;
-
- list = macro_removevar(list, "UID", 3);
- list = macro_removevar(list, "USER", 4);
- list = macro_removevar(list, "HOME", 4);
- list = macro_removevar(list, "GID", 3);
- list = macro_removevar(list, "GROUP", 5);
- list = macro_removevar(list, "SHOST", 5);
- return list;
-}
-
/*
* $- and &-expand a Sun-style map entry and return the length of the entry.
* If "dst" is NULL, just count the length.

217
SOURCES/autofs-5.0.7-add-symlink-pseudo-option.patch

@ -0,0 +1,217 @@ @@ -0,0 +1,217 @@
autofs-5.0.7 - add symlink pseudo option

From: Ian Kent <raven@themaw.net>

Add a "symlink" pseudo option to tell the bind mount module to symlink
instead of bind when mounting mounts other than direct mounts and
non-root indirect mount offset mounts (aka. non-root multi-mount
entries).
---
CHANGELOG | 1 +
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 +++++
modules/mount_bind.c | 36 +++++++++++++++++++++++++++++++++++-
7 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index c189483..247d334 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -32,6 +32,7 @@
- fix wildcard multi map regression.
- fix file descriptor leak when reloading the daemon.
- depricate nosymlink pseudo option.
+- add symlink pseudo option.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/automount.h b/include/automount.h
index 37541f5..e72fa0d 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -455,6 +455,9 @@ struct kernel_mod_version {
/* Don't use bind mounts even when system supports them */
#define MOUNT_FLAG_NOBIND 0x0020
+/* Use symlinks instead of bind mounting local mounts */
+#define MOUNT_FLAG_SYMLINK 0x0040
+
struct autofs_point {
pthread_t thid;
char *path; /* Mount point name */
diff --git a/lib/master_parse.y b/lib/master_parse.y
index f925b5a..11caf5b 100644
--- a/lib/master_parse.y
+++ b/lib/master_parse.y
@@ -57,6 +57,7 @@ static char *type;
static char *format;
static long timeout;
static long negative_timeout;
+static unsigned symlnk;
static unsigned nobind;
static unsigned ghost;
extern unsigned global_selection_options;
@@ -100,7 +101,7 @@ static int master_fprintf(FILE *, char *, ...);
%token COMMENT
%token MAP
%token OPT_TIMEOUT OPT_NTIMEOUT OPT_NOBIND OPT_NOGHOST OPT_GHOST OPT_VERBOSE
-%token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT
+%token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT OPT_SYMLINK
%token COLON COMMA NL DDASH
%type <strtype> map
%type <strtype> options
@@ -186,6 +187,7 @@ line:
| PATH OPT_USE_WEIGHT { master_notify($1); YYABORT; }
| PATH OPT_DEBUG { master_notify($1); YYABORT; }
| PATH OPT_TIMEOUT { master_notify($1); YYABORT; }
+ | PATH OPT_SYMLINK { 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; }
@@ -557,6 +559,7 @@ option: daemon_option
daemon_option: OPT_TIMEOUT NUMBER { timeout = $2; }
| OPT_NTIMEOUT NUMBER { negative_timeout = $2; }
+ | OPT_SYMLINK { symlnk = 1; }
| OPT_NOBIND { nobind = 1; }
| OPT_NOGHOST { ghost = 0; }
| OPT_GHOST { ghost = 1; }
@@ -627,6 +630,7 @@ static void local_init_vars(void)
debug = 0;
timeout = -1;
negative_timeout = 0;
+ symlnk = 0;
nobind = 0;
ghost = defaults_get_browse_mode();
random_selection = global_selection_options & MOUNT_FLAG_RANDOM_SELECT;
@@ -811,6 +815,8 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne
entry->ap->flags |= MOUNT_FLAG_RANDOM_SELECT;
if (use_weight)
entry->ap->flags |= MOUNT_FLAG_USE_WEIGHT_ONLY;
+ if (symlnk)
+ entry->ap->flags |= MOUNT_FLAG_SYMLINK;
if (negative_timeout)
entry->ap->negative_timeout = negative_timeout;
diff --git a/lib/master_tok.l b/lib/master_tok.l
index 30abb15..f9b4e55 100644
--- a/lib/master_tok.l
+++ b/lib/master_tok.l
@@ -361,6 +361,7 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo
return(NUMBER);
}
+ -?symlink { return(OPT_SYMLINK); }
-?nobind { return(OPT_NOBIND); }
-?nobrowse { return(OPT_NOGHOST); }
-g|--ghost|-?browse { return(OPT_GHOST); }
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index 8007542..bbea43a 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -159,6 +159,14 @@ on individual map entries of both types. Bind mounting of NFS file
systems can also be prevented for specific map entrys by adding the
"port=" mount option to the entries.
.TP
+.I "symlink"
+This option makes bind mounting use a symlink instead of an actual bind
+mount. It is an autofs specific option that is a pseudo mount option and
+so is given without a leading dash. It may be used with indirect map
+entries only, either in the master map (so it effects all map entries)
+or with individual map entries. The option is ignored for direct mounts
+and non-root offest mount entries.
+.TP
.I "\-r, \-\-random-multimount-selection"
Enables the use of ramdom selection when choosing a host from a
list of replicated servers. This option is applied to this mount
diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c
index ef16020..8c1e600 100644
--- a/modules/mount_autofs.c
+++ b/modules/mount_autofs.c
@@ -51,6 +51,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
int argc, status;
int nobind = ap->flags & MOUNT_FLAG_NOBIND;
int ghost = ap->flags & MOUNT_FLAG_GHOST;
+ int symlnk = ap->flags & MOUNT_FLAG_SYMLINK;
time_t timeout = ap->entry->maps->exp_timeout;
unsigned logopt = ap->logopt;
struct map_type_info *info;
@@ -120,6 +121,8 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
nobind = 1;
else if (strncmp(cp, "browse", 6) == 0)
ghost = 1;
+ else if (strncmp(cp, "symlink", 7) == 0)
+ symlnk = 1;
else if (strncmp(cp, "timeout=", 8) == 0) {
char *val = strchr(cp, '=');
unsigned tout;
@@ -158,6 +161,8 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
}
nap = entry->ap;
nap->parent = ap;
+ if (symlnk)
+ nap->flags |= MOUNT_FLAG_SYMLINK;
argc = 1;
diff --git a/modules/mount_bind.c b/modules/mount_bind.c
index 9bce686..4975294 100644
--- a/modules/mount_bind.c
+++ b/modules/mount_bind.c
@@ -73,10 +73,44 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
char buf[MAX_ERR_BUF];
int err;
int i, len;
+ int symlnk = (*name != '/' && (ap->flags & MOUNT_FLAG_SYMLINK));
if (ap->flags & MOUNT_FLAG_REMOUNT)
return 0;
+ /* Extract "symlink" pseudo-option which forces local filesystems
+ * to be symlinked instead of bound.
+ */
+ if (*name != '/' && !symlnk && options) {
+ const char *comma;
+ int o_len = strlen(options) + 1;
+
+ for (comma = options; *comma != '\0';) {
+ const char *cp;
+ const char *end;
+
+ while (*comma == ',')
+ comma++;
+
+ /* Skip leading white space */
+ while (*comma == ' ' || *comma == '\t')
+ comma++;
+
+ cp = comma;
+ while (*comma != '\0' && *comma != ',')
+ comma++;
+
+ /* Skip trailing white space */
+ end = comma - 1;
+ while (*comma == ' ' || *comma == '\t')
+ end--;
+
+ o_len = end - cp + 1;
+ if (strncmp("symlink", cp, o_len) == 0)
+ symlnk = 1;
+ }
+ }
+
/* Root offset of multi-mount */
len = strlen(root);
if (root[len - 1] == '/') {
@@ -100,7 +134,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
if (options == NULL || *options == '\0')
options = "defaults";
- if (bind_works) {
+ if (!symlnk && bind_works) {
int status, existed = 1;
debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath);

42
SOURCES/autofs-5.0.7-add-timeout-option-description-to-man-page.patch

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
autofs-5.0.7 - add timeout option description to man page

From: Ian Kent <ikent@redhat.com>

The pseudo option used t set the timeout for map entries is one of
the most most frequently used autofs options but is not mentioned
in auto.master(5).
---

CHANGELOG | 1 +
man/auto.master.5.in | 5 +++++
2 files changed, 6 insertions(+), 0 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 93b9c26..7b8d185 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@
- fix parse buffer initialization.
- fix typo in automount(8).
- dont wait forever to restart.
+- add timeout option description to man page.
25/07/2012 autofs-5.0.7
=======================
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index 54269f8..21d7544 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -167,6 +167,11 @@ server is specified in the map entry. If no server weights are given
then each available server will be tried in the order listed, within
proximity.
.TP
+.I "\-t, \-\-timeout <seconds>"
+Set the expire timeout for map entries. This option can be used to
+override the global default given either on the command line
+or in the configuration.
+.TP
.I "\-n, \-\-negative\-timeout <seconds>"
Set the timeout for caching failed key lookups. This option can be
used to override the global default given either on the command line

69
SOURCES/autofs-5.0.7-allow-non-root-user-to-check-status.patch

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
autofs-5.0.7 - allow non root user to check status

From: Ian Kent <ikent@redhat.com>


---

CHANGELOG | 1 +
redhat/autofs.init.in | 20 +++++++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 44c9fb2..936c9ab 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,7 @@
- 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.
25/07/2012 autofs-5.0.7
=======================
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
index cd5cb34..fe18b3e 100644
--- a/redhat/autofs.init.in
+++ b/redhat/autofs.init.in
@@ -167,6 +167,19 @@ function usage_message() {
RETVAL=0
+# allow non-root users to read status / usage
+
+case "$1" in
+ status)
+ status -p @@autofspiddir@@/autofs.pid -l autofs $prog
+ exit 0;
+ ;;
+ usage)
+ usage_message
+ exit 0;
+ ;;
+esac
+
# Only the root user may change the service status
if [ `id -u` -ne 0 ] && [ "$1" != "status" ]; then
echo "insufficient privilege to change service status"
@@ -184,9 +197,6 @@ case "$1" in
stop)
stop
;;
- status)
- status -p @@autofspiddir@@/autofs.pid -l autofs $prog
- ;;
restart|force-reload)
restart
;;
@@ -202,10 +212,6 @@ case "$1" in
restart
fi
;;
- usage)
- usage_message
- exit 0
- ;;
*)
usage_message
exit 2

50
SOURCES/autofs-5.0.7-allow-nsswitch_conf-to-not-contain-automount-lines.patch

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
autofs-5.0.7 - Allow nsswitch.conf to not contain "automount:" lines

From: Michael Tokarev <mjt@tls.msk.ru>

Current code does not allow a case when nsswitch.conf
does not mention automount map at all, like all new
installations. It logs a rather unpleasant error
message instead:

syntax error in nsswitch config near [ syntax error ]

this patch has a minimal fix, to allo "file" to be empty.

Whole parser in C is about 25 lines of code, the "grammar"
is trivial, and it is better to ditch all this yacc/lex
stuff, but that will be much more intrusive change.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: 682266@bugs.debian.org
---

CHANGELOG | 1 +
lib/nss_parse.y | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index bd0dd82..16ac2a0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,7 @@
- increase file map read buffer size.
- handle new location of systemd.
- fix map entry duplicate offset detection.
+- Allow nsswitch.conf to not contain "automount:" lines.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/nss_parse.y b/lib/nss_parse.y
index a39fda4..055e9d7 100644
--- a/lib/nss_parse.y
+++ b/lib/nss_parse.y
@@ -72,6 +72,7 @@ file: {
nss_debug = YYDEBUG;
#endif
} sources NL
+ | /* empty */
;
sources: nss_source

231
SOURCES/autofs-5.0.7-allow-use-of-hosts-map-in-maps.patch

@ -0,0 +1,231 @@ @@ -0,0 +1,231 @@
autofs-5.0.7 - allow use of hosts map in maps

From: Ian Kent <raven@themaw.net>

At the moment the internal hosts map can only be use as an entry in the
master map but there's no reason (I can think of so far) that it shouldn't
be possible to use it in map entries.
---
lib/parse_subs.c | 17 ++++++-----
modules/mount_autofs.c | 29 ++++++++++++++++----
modules/parse_sun.c | 71 +++++++++++++++++++++++++++++++------------------
3 files changed, 80 insertions(+), 37 deletions(-)

--- autofs-5.0.7.orig/lib/parse_subs.c
+++ autofs-5.0.7/lib/parse_subs.c
@@ -35,6 +35,7 @@ static struct types map_type[] = {
{ "ldaps", 5 },
{ "hesiod", 6 },
{ "userdir", 7 },
+ { "hosts", 5 },
};
static unsigned int map_type_count = sizeof(map_type)/sizeof(struct types);
@@ -384,7 +385,7 @@ struct map_type_info *parse_map_type_inf
return NULL;
} else {
*pos++ = '\0';
- while (*pos == ' ')
+ while (*pos && *pos == ' ')
*pos++ = '\0';
map = pos;
break;
@@ -412,7 +413,7 @@ struct map_type_info *parse_map_type_inf
return NULL;
} else {
*pos++ = '\0';
- while (*pos == ' ')
+ while (*pos && *pos == ' ')
*pos++ = '\0';
map = pos;
break;
@@ -458,11 +459,13 @@ struct map_type_info *parse_map_type_inf
}
}
- info->map = strdup(map);
- if (!info->map) {
- free(buf);
- free_map_type_info(info);
- return NULL;
+ if (map) {
+ info->map = strdup(map);
+ if (!info->map) {
+ free(buf);
+ free_map_type_info(info);
+ return NULL;
+ }
}
free(buf);
--- autofs-5.0.7.orig/modules/mount_autofs.c
+++ autofs-5.0.7/modules/mount_autofs.c
@@ -62,6 +62,7 @@ int mount_mount(struct autofs_point *ap,
char buf[MAX_ERR_BUF];
char *options, *p;
int len, ret;
+ int hosts = 0;
/* Root offset of multi-mount */
len = strlen(root);
@@ -123,6 +124,8 @@ int mount_mount(struct autofs_point *ap,
ghost = 1;
else if (strncmp(cp, "symlink", 7) == 0)
symlnk = 1;
+ else if (strncmp(cp, "hosts", 5) == 0)
+ hosts = 1;
else if (strncmp(cp, "timeout=", 8) == 0) {
char *val = strchr(cp, '=');
unsigned tout;
@@ -164,7 +167,10 @@ int mount_mount(struct autofs_point *ap,
if (symlnk)
nap->flags |= MOUNT_FLAG_SYMLINK;
- argc = 1;
+ if (hosts)
+ argc = 0;
+ else
+ argc = 1;
if (options) {
char *t = options;
@@ -176,14 +182,27 @@ int mount_mount(struct autofs_point *ap,
}
argv = (const char **) alloca((argc + 1) * sizeof(char *));
- argc = 1;
-
- if (!(info = parse_map_type_info(what))) {
+ if (hosts)
+ argc = 0;
+ else
+ argc = 1;
+
+ /*
+ * If a mount of a hosts map is being requested it will come
+ * ro us via the options. Catch that below when processing the
+ * option and create type info struct then.
+ */
+ if (hosts)
+ info = parse_map_type_info("hosts:");
+ else
+ info = parse_map_type_info(what);
+ if (!info) {
error(ap->logopt, MODPREFIX "failed to parse map info");
master_free_mapent(entry);
return 1;
}
- argv[0] = info->map;
+ if (info->map)
+ argv[0] = info->map;
if (options) {
p = options;
--- autofs-5.0.7.orig/modules/parse_sun.c
+++ autofs-5.0.7/modules/parse_sun.c
@@ -695,14 +695,18 @@ static int sun_mount(struct autofs_point
rv = mount_nfs->mount_mount(ap, root, mountpoint, strlen(mountpoint),
what, fstype, options, mount_nfs->context);
} else {
- what = alloca(loclen + 1);
- if (*loc == ':') {
- loclen--;
- memcpy(what, loc + 1, loclen);
- what[loclen] = '\0';
- } else {
- memcpy(what, loc, loclen);
- what[loclen] = '\0';
+ if (!loclen)
+ what = NULL;
+ else {
+ what = alloca(loclen + 1);
+ if (*loc == ':') {
+ loclen--;
+ memcpy(what, loc + 1, loclen);
+ what[loclen] = '\0';
+ } else {
+ memcpy(what, loc, loclen);
+ what[loclen] = '\0';
+ }
}
debug(ap->logopt, MODPREFIX
@@ -799,7 +803,8 @@ update_offset_entry(struct autofs_point
mc = source->mc;
- if (!*path || !*loc) {
+ /* Internal hosts map may have loc == NULL */
+ if (!*path) {
error(ap->logopt,
MODPREFIX "syntax error in offset %s -> %s", path, loc);
return CHE_FAIL;
@@ -833,8 +838,10 @@ update_offset_entry(struct autofs_point
if (*myoptions) {
strcpy(m_mapent, "-");
strcat(m_mapent, myoptions);
- strcat(m_mapent, " ");
- strcat(m_mapent, loc);
+ if (loc) {
+ strcat(m_mapent, " ");
+ strcat(m_mapent, loc);
+ }
} else
strcpy(m_mapent, loc);
@@ -1435,13 +1442,17 @@ int parse_mount(struct autofs_point *ap,
l = parse_mapent(p, options, &myoptions, &loc, ap->logopt);
if (!l) {
- cache_delete_offset_list(mc, name);
- cache_multi_unlock(me);
- cache_unlock(mc);
- free(path);
- free(options);
- pthread_setcancelstate(cur_state, NULL);
- return 1;
+ if (!(strstr(myoptions, "fstype=autofs") &&
+ strstr(myoptions, "hosts"))) {
+ error(LOGOPT_ANY, "I think I'm a hosts map? l %d", l);
+ cache_delete_offset_list(mc, name);
+ cache_multi_unlock(me);
+ cache_unlock(mc);
+ free(path);
+ free(options);
+ pthread_setcancelstate(cur_state, NULL);
+ return 1;
+ }
}
p += l;
@@ -1592,13 +1603,23 @@ int parse_mount(struct autofs_point *ap,
p = skipspace(p);
}
- loclen = strlen(loc);
- if (loclen == 0) {
- free(loc);
- free(options);
- error(ap->logopt,
- MODPREFIX "entry %s is empty!", name);
- return 1;
+ /*
+ * If options are asking for a hosts map loc should be
+ * NULL but we see it can contain junk, so ....
+ */
+ if ((strstr(options, "fstype=autofs") &&
+ strstr(options, "hosts"))) {
+ loc = NULL;
+ loclen = 0;
+ } else {
+ loclen = strlen(loc);
+ if (loclen == 0) {
+ free(loc);
+ free(options);
+ error(ap->logopt,
+ MODPREFIX "entry %s is empty!", name);
+ return 1;
+ }
}
debug(ap->logopt,

38
SOURCES/autofs-5.0.7-check-for-protocol-option.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
autofs-5.0.7 - check for protocol option

From: Ian Kent <raven@themaw.net>

When a specific protocol is requested in the mount options only
that protocol should be probed for.
---
modules/mount_nfs.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index 9de8a73..3d2ccea 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -156,6 +156,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
if (port < 0)
port = 0;
port_opt = cp;
+ } else if (strncmp("proto=udp", cp, o_len) == 0 ||
+ strncmp("udp", cp, o_len) == 0) {
+ vers &= ~TCP_SUPPORTED;
+ } else if (strncmp("proto=tcp", cp, o_len) == 0 ||
+ strncmp("tcp", cp, o_len) == 0) {
+ vers &= ~UDP_SUPPORTED;
}
/* Check for options that also make sense
with bind mounts */
@@ -167,6 +173,10 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
}
}
+ /* In case both tcp and udp options were given */
+ 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);

28
SOURCES/autofs-5.0.7-configure-allow-cross-compilation-update.patch

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
autofs-5.0.7 - configure: allow cross compilation update

From: Chris Packham <chris.packham@alliedtelesis.co.nz>

Run "make distclean" to update configure. This should have been included
in 5936c738 when configure.in was updated but it was missed.
---

configure | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)


diff --git a/configure b/configure
index bf62203..ba3bba6 100755
--- a/configure
+++ b/configure
@@ -5378,10 +5378,7 @@ DAEMON_LDFLAGS=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc -fPIE works" >&5
$as_echo_n "checking whether gcc -fPIE works... " >&6; }
if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+ gcc_supports_pie=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

41
SOURCES/autofs-5.0.7-configure-in-allow-cross-compilation.patch

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
autofs-5.0.7 - configure.in: allow cross compilation

From: Chris Packham <chris.packham@alliedtelesis.co.nz>

The default behaviour of AC_RUN_IFELSE is to stop with an error if cross
compiling. Avoid this by providing the optional 4th argument to set
gcc_supports_pie=no if support for PIE cannot be detected.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

CHANGELOG | 1 +
configure.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 961e340..fe801e8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,7 @@
- add timeout option description to man page.
- fix null map entry order handling.
- make description of default MOUNT_WAIT setting clear.
+- configure.in: allow cross compilation.
25/07/2012 autofs-5.0.7
=======================
diff --git a/configure.in b/configure.in
index 1a24e34..90bda62 100644
--- a/configure.in
+++ b/configure.in
@@ -307,7 +307,7 @@ DAEMON_CFLAGS=
DAEMON_LDFLAGS=
AC_MSG_CHECKING([whether gcc -fPIE works])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[int main(void) {return 0;}]])],
- [gcc_supports_pie=yes], [gcc_supports_pie=no])
+ [gcc_supports_pie=yes], [gcc_supports_pie=no], [gcc_supports_pie=no])
AC_MSG_RESULT([$gcc_supports_pie])
if test $gcc_supports_pie = yes ; then
DAEMON_CFLAGS="-fPIE"

40
SOURCES/autofs-5.0.7-depricate-nosymlink-pseudo-option.patch

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
autofs-5.0.7 - depricate nosymlink pseudo option

From: Ian Kent <raven@themaw.net>

The undocumented "nosymlink" option was the only way to force local
NFS mounting until the more descriptive "nobind" option was added.

So depricate the "nosymlink" option in favour of the "nobind" option.
---
CHANGELOG | 1 +
modules/mount_nfs.c | 4 ++++
2 files changed, 5 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index a7ed212..c189483 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -31,6 +31,7 @@
- dont fail on master map self include.
- fix wildcard multi map regression.
- fix file descriptor leak when reloading the daemon.
+- depricate nosymlink pseudo option.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index bbbb1de..e61320b 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -125,6 +125,10 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
o_len = end - cp + 1;
if (strncmp("nosymlink", cp, o_len) == 0) {
+ warn(ap->logopt, MODPREFIX
+ "the \"nosymlink\" option is depricated "
+ "and will soon be removed, "
+ "use the \"nobind\" option instead");
nosymlink = 1;
} else if (strncmp("nobind", cp, o_len) == 0) {
nobind = 1;

48
SOURCES/autofs-5.0.7-document-allowed-map-sources-in-auto_master.patch

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
autofs-5.0.7 - document allowed map sources in auto.master

From: Ian Kent <raven@themaw.net>

Direct map may have multiple map sources but indirect maps may have
only one map source.
---
CHANGELOG | 1 +
man/auto.master.5.in | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 4576d47..61edddf 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -41,6 +41,7 @@
- syncronize handle_mounts() shutdown.
- fix submount tree not all expiring.
- make dump maps check for duplicate indirect mounts.
+- document allowed map sources in auto.master.
25/07/2012 autofs-5.0.7
=======================
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index c552e56..7907ffa 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -40,7 +40,8 @@ For direct maps the mount point is always specified as:
.P
/-
.P
-and the key used within the direct map is the full path to the mount point.
+and the key used within the direct map is the full path to the mount point. The direct map
+may have multiple entries in the master map.
.P
For indirect maps access is by using the path scheme:
.P
@@ -60,7 +61,9 @@ present in the master map by including a line of the form:
and
.BR automount (8)
will process the map according to the specification described below for
-map entries.
+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).
.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

46
SOURCES/autofs-5.0.7-document-browse-option-in-man-page.patch

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
autofs-5.0.7 - document browse option in man page

From: Ian Kent <raven@themaw.net>

The "browse" option has remained undocumented for a long time.
Finally add a section for it to auto.master(5) making special
note of the potential performance implications.
---
CHANGELOG | 1 +
man/auto.master.5.in | 11 +++++++++++
2 files changed, 12 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index ecdea0b..d8e4049 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -36,6 +36,7 @@
- fix requires in spec file.
- fix libtirpc build option to require libtirpc-devel if needed.
- fix systemd unidir in spec file.
+- document browse option in man page.
25/07/2012 autofs-5.0.7
=======================
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index bbea43a..c552e56 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -147,6 +147,17 @@ multiple file systems should be mounted (`multimounts'). If this option
is given, no file system is mounted at all if at least one file system
can't be mounted.
.TP
+.I "[no]browse"
+This is an autofs specific option that is a pseudo mount option and
+so is given without a leading dash. Use of the browse option pre-creates
+mount point directories for indirect mount maps so the map keys can be
+seen in a directory listing without being mounted. Use of this option
+can cause performance problem if the indirect map is large so it should
+be used with caution. The internal program default is to enable browse
+mode for indirect mounts but the default installed configuration overrides
+this by setting BROWSE_MODE to "no" because of the potential performance
+problem.
+.TP
.I "nobind"
This is an autofs specific option that is a pseudo mount option and
so is given without a leading dash. It may be used either in the master

59
SOURCES/autofs-5.0.7-dont-fail-on-master-map-self-include.patch

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
autofs-5.0.7 - dont fail on master map self include

From: Ian Kent <raven@themaw.net>

When reading the master map a self included file map should skip the source
and proceed to the next so, in this case, return an nss status that will
allow the map read to continue. In particular not NSS_STATUS_UNAVAIL which
causes the lookup to record a failure or NSS_STATUS_SUCCESS which indicates
a successful lookup and termintes the reading of sources.
---
CHANGELOG | 1 +
modules/lookup_file.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 39388a5..97d6f48 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -28,6 +28,7 @@
- make yellow pages support optional.
- modules/replicated.c: use sin6_addr.s6_addr32.
- workaround missing GNU versionsort extension.
+- dont fail on master map self include.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index facb305..f37bed9 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -397,8 +397,9 @@ int lookup_read_master(struct master *master, time_t age, void *context)
unsigned int path_len, ent_len;
int entry, cur_state;
+ /* Don't return fail on self include, skip source */
if (master->recurse)
- return NSS_STATUS_UNAVAIL;
+ return NSS_STATUS_TRYAGAIN;
if (master->depth > MAX_INCLUDE_DEPTH) {
error(logopt, MODPREFIX
@@ -443,7 +444,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)
inc = check_master_self_include(master, ctxt);
if (inc)
- master->recurse = 1;;
+ master->recurse = 1;
master->depth++;
status = lookup_nss_read_master(master, age);
if (!status) {
@@ -645,7 +646,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
mc = source->mc;
if (source->recurse)
- return NSS_STATUS_UNAVAIL;
+ return NSS_STATUS_TRYAGAIN;
if (source->depth > MAX_INCLUDE_DEPTH) {
error(ap->logopt,

46
SOURCES/autofs-5.0.7-dont-override-LDFLAGS-in-make-rules.patch

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
autofs-5.0.7 - don't override LDFLAGS in make rules

From: Ian Kent <ikent@redhat.com>

Ensure that externally defined LDFLAGS is not overridden.
---
CHANGELOG | 1 +
Makefile.rules | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 5d90139..37eac72 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -53,6 +53,7 @@
- fix probe each nfs version in turn for singleton mounts.
- misc man page fixes.
- fix add null check in parse_server_string().
+- don't override LDFLAGS in make rules.
25/07/2012 autofs-5.0.7
=======================
diff --git a/Makefile.rules b/Makefile.rules
index f2ba386..6b5b2bd 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -24,16 +24,16 @@ endif
ifdef DEBUG
CFLAGS ?= -g -Wall -DDEBUG
-LDFLAGS = -g
+LDFLAGS ?= -g
STRIP = :
else
ifdef DONTSTRIP
CFLAGS ?= -O2 -g
-LDFLAGS = -g
+LDFLAGS ?= -g
STRIP = :
else
CFLAGS ?= -O2 -Wall
-LDFLAGS = -s
+LDFLAGS ?= -s
STRIP = strip --strip-debug
endif
endif

68
SOURCES/autofs-5.0.7-dont-probe-rdma-mounts.patch

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
autofs-5.0.7 - dont probe rdma mounts

From: Ian Kent <raven@themaw.net>

Since the change to pass text nfs mount options drectly to the kernel all autofs
mount requests now probe server availability. This was because of long delays
mounting from servers that aren't responding.

This caused mounts requesting the rdma protocol to fail if udp or tcp was also
not available from the server.

Since, AFAICT the rmda protocol can't be used with RPC fromn userspace, the only
way to work around it is to not probe servers when rdma is requested.
---
CHANGELOG | 1 +
modules/mount_nfs.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 50e83d7..f9bc987 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -44,6 +44,7 @@
- document allowed map sources in auto.master.
- add enable sloppy mount option to configure.
- fix interface address null check.
+- dont probe rdma mounts.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index e61320b..5424d74 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -71,6 +71,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
int nosymlink = 0;
int port = -1;
int ro = 0; /* Set if mount bind should be read-only */
+ int rdma = 0;
if (ap->flags & MOUNT_FLAG_REMOUNT)
return 0;
@@ -124,6 +125,11 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
end--;
o_len = end - cp + 1;
+
+ if (strncmp("proto=rdma", cp, o_len) == 0 ||
+ strncmp("rdma", cp, o_len) == 0)
+ rdma = 1;
+
if (strncmp("nosymlink", cp, o_len) == 0) {
warn(ap->logopt, MODPREFIX
"the \"nosymlink\" option is depricated "
@@ -170,7 +176,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
info(ap->logopt, MODPREFIX "no hosts available");
return 1;
}
- prune_host_list(ap->logopt, &hosts, vers, port);
+ /*
+ * We can't probe protocol rdma so leave it to mount.nfs(8)
+ * and and suffer the delay if a server isn't available.
+ */
+ if (!rdma)
+ prune_host_list(ap->logopt, &hosts, vers, port);
if (!hosts) {
info(ap->logopt, MODPREFIX "no hosts available");

69
SOURCES/autofs-5.0.7-dont-schedule-new-alarms-after-readmap.patch

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
autofs-5.0.7 - don't schedule new alarms after readmap

From: Leonardo Chiquitto <leonardo.lists@gmail.com>

Currently, a new alarm is scheduled every time the daemon receives
a SIGHUP (map re-read) or SIGUSR1 (forced expiration). Besides that,
map re-reads started on demand when a map is found to be outdated
also generate a new alarm.

Once added, these alarms are never deleted and hence increase the
number of times the daemon wakes up to run the expiration procedure.
After a couple of months, in setups with many mount points, it's
normal to see automount waking up every second to handle the
expiration timer.

This patch removes the alarm scheduling from the readmap cleanup
routine and makes sure the alarm is re-added after the expiration
process only when it was not triggered by SIGUSR1.

I couldn't think of any use case to justify keeping these alarms:
it's critical to have the alarm ticking every timeout/4 seconds,
but more than one periodic alarm running doesn't seem to make
sense.
---

CHANGELOG | 1 +
daemon/state.c | 6 +-----
2 files changed, 2 insertions(+), 5 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index c9be73e..4cf5621 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -22,6 +22,7 @@
- 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.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/state.c b/daemon/state.c
index b451c56..6e23022 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -144,7 +144,7 @@ void expire_cleanup(void *arg)
ap->submount = 2;
}
- if (!ap->submount)
+ if (ap->state == ST_EXPIRE && !ap->submount)
alarm_add(ap, ap->exp_runfreq);
/* FALLTHROUGH */
@@ -330,13 +330,9 @@ static void do_readmap_cleanup(void *arg)
ap = ra->ap;
st_mutex_lock();
-
ap->readmap_thread = 0;
st_set_done(ap);
- if (!ap->submount)
- alarm_add(ap, ap->exp_runfreq);
st_ready(ap);
-
st_mutex_unlock();
free(ra);

41
SOURCES/autofs-5.0.7-dont-use-dirent-d_type-to-filter-out-files-in-scandir.patch

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
autofs-5.0.7 - don't use dirent d_type to filter out files in scandir()

From: Leonardo Chiquitto <leonardo.lists@gmail.com>

The "d_type" field of a dirent structure is not filled in by all
file systems (XFS being one example), so we can't rely on it to
check file types.
---

CHANGELOG | 1 +
modules/lookup_dir.c | 4 ----
2 files changed, 1 insertions(+), 4 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 460bd27..c9be73e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,6 +21,7 @@
- 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()
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/lookup_dir.c b/modules/lookup_dir.c
index 658cc29..33901c0 100644
--- a/modules/lookup_dir.c
+++ b/modules/lookup_dir.c
@@ -103,10 +103,6 @@ static int acceptable_dirent_p(const struct dirent *e)
{
size_t namesz;
-
- if (!(e->d_type == DT_REG || e->d_type == DT_LNK))
- return 0;
-
namesz = strlen(e->d_name);
if (!namesz)
return 0;

54
SOURCES/autofs-5.0.7-dont-wait-forever-to-restart.patch

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
autofs-5.0.7 - dont wait forever to restart

From: Ian Kent <ikent@redhat.com>

When restarting autofs the daemon must be stopped before it is started
again if it is to function properly. At the moment the init script waits
forever which is not ok if the daemon won't exit for some reason.

So, if the daemon is still running after the stop, run stop() again, wait
a bit longer and if it still hasn't stopped kill it with a SIGKILL to clear
the way for the startup.
---

CHANGELOG | 1 +
redhat/autofs.init.in | 13 ++++++++++---
2 files changed, 11 insertions(+), 3 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 6051723..93b9c26 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,7 @@
- fix ipv6 proximity calculation.
- fix parse buffer initialization.
- fix typo in automount(8).
+- dont wait forever to restart.
25/07/2012 autofs-5.0.7
=======================
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
index ec6d5d6..cd5cb34 100644
--- a/redhat/autofs.init.in
+++ b/redhat/autofs.init.in
@@ -129,9 +129,16 @@ function restart() {
status autofs > /dev/null 2>&1
if [ $? -eq 0 ]; then
stop
- while [ -n "`pidof $prog`" ] ; do
- sleep 5
- done
+ if [ -n "`pidof $prog`" ]; then
+ # If we failed to stop, try at least one more time
+ # after waiting a little while
+ sleep 20
+ stop
+ auto_pid=`pidof $prog`
+ if [ -n "$auto_pid" ]; then
+ kill -9 $auto_pid
+ fi
+ fi
fi
start
}

51
SOURCES/autofs-5.0.7-fix-a-couple-of-compiler-warnings.patch

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
autofs-5.0.7 - fix a couple of compiler warnings

From: Ian Kent <ikent@redhat.com>

Quiet a couple of ompiler warnings by making intention explicit using brackets.
---
CHANGELOG | 1 +
modules/mount_bind.c | 2 +-
modules/mount_nfs.c | 4 ++--
3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 37eac72..7749f01 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -54,6 +54,7 @@
- misc man page fixes.
- fix add null check in parse_server_string().
- don't override LDFLAGS in make rules.
+- fix a couple of compiler warnings.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/mount_bind.c b/modules/mount_bind.c
index 61a773c..2b70104 100644
--- a/modules/mount_bind.c
+++ b/modules/mount_bind.c
@@ -208,7 +208,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
MODPREFIX
"failed to create local mount %s -> %s",
fullpath, what);
- if (ap->flags & MOUNT_FLAG_GHOST && !status)
+ if ((ap->flags & MOUNT_FLAG_GHOST) && !status)
if (mkdir_path(fullpath, 0555) && 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 3d2ccea..adf2002 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -202,8 +202,8 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
*/
if ((hosts && !hosts->next) &&
mount_default_proto == 4 &&
- vers & NFS_VERS_MASK != 0 &&
- vers & NFS4_VERS_MASK != 0) {
+ (vers & NFS_VERS_MASK) != 0 &&
+ (vers & NFS4_VERS_MASK) != 0) {
unsigned int v4_probe_ok = 0;
struct host *tmp = new_host(hosts->name,
hosts->addr, hosts->addr_len,

45
SOURCES/autofs-5.0.7-fix-add-null-check-in-parse_server_string.patch

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
autofs-5.0.7 - fix add null check in parse_server_string()

From: Ian Kent <raven@themaw.net>

In a recent patch that added an error check for the case there's no ':' server
name delimiter parse_server_string() braces were not added which lead to an
incorrect parse error.
---
CHANGELOG | 1 +
modules/lookup_ldap.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 503a21e..5d90139 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -52,6 +52,7 @@
- add changlog entry for coverity fixes.
- fix probe each nfs version in turn for singleton mounts.
- misc man page fixes.
+- fix add null check in parse_server_string().
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 35ea6ea..a2bfafd 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -1210,14 +1210,14 @@ static int parse_server_string(unsigned logopt, const char *url, struct lookup_c
const char *q = NULL;
/* Isolate the server. Include the port spec */
- if (*ptr != '[')
+ if (*ptr != '[') {
q = strchr(ptr, ':');
if (!q) {
crit(logopt, MODPREFIX
"LDAP server name not found in %s", ptr);
return 0;
}
- else {
+ } else {
q = ++ptr;
while (*q == ':' || isxdigit(*q))
q++;

24
SOURCES/autofs-5.0.7-fix-automounter-support-on-parisc.patch

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
autofs-5.0.7 - fix automounter support on parisc

From: Helge Deller <deller@gmx.de>

This patch fixes automounter support on the parisc architecture with
64-bit kernel and 32-bit userspace.

Signed-off-by: Helge Deller <deller@gmx.de>
---
daemon/automount.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/daemon/automount.c b/daemon/automount.c
index 4a3eb3d..4c651cf 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -610,6 +610,7 @@ static size_t get_kpkt_len(void)
if (strcmp(un.machine, "alpha") == 0 ||
strcmp(un.machine, "ia64") == 0 ||
strcmp(un.machine, "x86_64") == 0 ||
+ strcmp(un.machine, "parisc64") == 0 ||
strcmp(un.machine, "ppc64") == 0)
pkt_len += 4;

38
SOURCES/autofs-5.0.7-fix-bad-mkdir-permission-on-create.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
autofs-5.0.7 - fix bad mkdir permission on create

From: Ian Kent <raven@themaw.net>

Reported by Gordon Lack (gordon[dot]m[dot]lack[at]gsk[dot]com).

If the automount daemon needs to create a directory (hierarchy) for an
automount and it is started up with a umask of 027 (or similar) then it
creates unusable directories (permission == 550).
---
CHANGELOG | 1 +
daemon/automount.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -88,6 +88,7 @@
- check for bind onto self in mount_bind.c.
- fix symlink expire.
- fix master map type check.
+- fix bad mkdir permission on create.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/daemon/automount.c
+++ autofs-5.0.7/daemon/automount.c
@@ -122,7 +122,10 @@ static int do_mkdir(const char *parent,
status = statfs(parent, &fs);
if ((status != -1 && fs.f_type == (__SWORD_TYPE) AUTOFS_SUPER_MAGIC) ||
contained_in_local_fs(path)) {
- if (mkdir(path, mode) == -1) {
+ mode_t mask = umask(0022);
+ int ret = mkdir(path, mode);
+ (void) umask(mask);
+ if (ret == -1) {
errno = EACCES;
return 0;
}

27
SOURCES/autofs-5.0.7-fix-check-mkdir_path-in-mount_bind-mount_mount.patch

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
autofs-5.0.7 - fix check mkdir_path() in mount_bind.c:mount_mount()

From: Ian Kent <raven@themaw.net>


---
modules/mount_bind.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/mount_bind.c b/modules/mount_bind.c
index d6c6fe7..61a773c 100644
--- a/modules/mount_bind.c
+++ b/modules/mount_bind.c
@@ -209,7 +209,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
"failed to create local mount %s -> %s",
fullpath, what);
if (ap->flags & MOUNT_FLAG_GHOST && !status)
- mkdir_path(fullpath, 0555);
+ if (mkdir_path(fullpath, 0555) && errno != EEXIST) {
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ error(ap->logopt,
+ MODPREFIX "mkdir_path %s failed: %s",
+ fullpath, estr);
+ }
else {
if (ap->type == LKP_INDIRECT)
rmdir_path(ap, fullpath, ap->dev);

216
SOURCES/autofs-5.0.7-fix-compilation-of-lookup_ldap_c-without-sasl.patch

@ -0,0 +1,216 @@ @@ -0,0 +1,216 @@
autofs-5.0.7 - fix compilation of lookup_ldap.c without sasl

From: Dustin Polke <DuPol@gmx.de>

See https://bugs.gentoo.org/show_bug.cgi?id=361899 for more info.

Edited by: Ian Kent <raven@themaw.net>
- fix parse_ldap_config() is needed by ldap but previously excluded.
- exclude other references to ctxt->extern_cert and ctxt->extern_key.
- prevent memory leak if present in config but not used.
- remove now unused set_env().
---
CHANGELOG | 1 +
include/lookup_ldap.h | 4 ++--
lib/Makefile | 4 ++++
modules/Makefile | 6 ++++--
modules/lookup_ldap.c | 18 +++++++++++++-----
5 files changed, 24 insertions(+), 9 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -82,6 +82,7 @@
- add std vars to program map invocation.
- check for existing offset mount before mounting.
- fix cache readlock not taken on lookup.
+- fix compilation of lookup_ldap.c without sasl.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/include/lookup_ldap.h
+++ autofs-5.0.7/include/lookup_ldap.h
@@ -11,6 +11,8 @@
#include <krb5.h>
#endif
+#include <libxml/tree.h>
+
#include "list.h"
#include "dclist.h"
@@ -92,7 +94,6 @@ struct lookup_context {
};
-#ifdef WITH_SASL
#define LDAP_AUTH_CONF_FILE "test"
#define LDAP_TLS_DONT_USE 0
@@ -104,7 +105,6 @@ struct lookup_context {
#define LDAP_AUTH_REQUIRED 0x0002
#define LDAP_AUTH_AUTODETECT 0x0004
#define LDAP_NEED_AUTH (LDAP_AUTH_REQUIRED|LDAP_AUTH_AUTODETECT)
-#endif
#define LDAP_AUTH_USESIMPLE 0x0008
--- autofs-5.0.7.orig/lib/Makefile
+++ autofs-5.0.7/lib/Makefile
@@ -24,6 +24,10 @@ CFLAGS += -I../include -fPIC -D_GNU_SOUR
CFLAGS += -DAUTOFS_MAP_DIR=\"$(autofsmapdir)\"
CFLAGS += -DAUTOFS_CONF_DIR=\"$(autofsconfdir)\"
+ifeq ($(LDAP), 1)
+ CFLAGS += $(XML_FLAGS) $(XML_LIBS)
+endif
+
.PHONY: all install clean
all: autofs.a
--- autofs-5.0.7.orig/modules/Makefile
+++ autofs-5.0.7/modules/Makefile
@@ -45,10 +45,12 @@ endif
ifeq ($(LDAP), 1)
SRCS += lookup_ldap.c
MODS += lookup_ldap.so
+ LDAP_FLAGS += $(XML_FLAGS) -DLDAP_THREAD_SAFE
+ LIBLDAP += $(XML_LIBS)
ifeq ($(SASL), 1)
SASL_OBJ = cyrus-sasl.o cyrus-sasl-extern.o
- LDAP_FLAGS += $(SASL_FLAGS) $(XML_FLAGS) $(KRB5_FLAGS) -DLDAP_THREAD_SAFE
- LIBLDAP += $(LIBSASL) $(XML_LIBS) $(KRB5_LIBS)
+ LDAP_FLAGS += $(SASL_FLAGS) $(KRB5_FLAGS)
+ LIBLDAP += $(LIBSASL) $(KRB5_LIBS)
endif
endif
--- autofs-5.0.7.orig/modules/lookup_ldap.c
+++ autofs-5.0.7/modules/lookup_ldap.c
@@ -66,6 +66,7 @@ struct ldap_search_params {
static int decode_percent_hack(const char *, char **);
+#ifdef WITH_SASL
static int set_env(unsigned logopt, const char *name, const char *val)
{
int ret = setenv(name, val, 1);
@@ -75,6 +76,7 @@ static int set_env(unsigned logopt, cons
}
return 1;
}
+#endif
#ifndef HAVE_LDAP_CREATE_PAGE_CONTROL
int ldap_create_page_control(LDAP *ldap, ber_int_t pagesize,
@@ -183,9 +185,9 @@ int unbind_ldap_connection(unsigned logo
{
int rv;
-#ifdef WITH_SASL
if (ctxt->use_tls == LDAP_TLS_RELEASE)
ctxt->use_tls = LDAP_TLS_INIT;
+#ifdef WITH_SASL
autofs_sasl_unbind(ctxt);
#endif
@@ -243,7 +245,6 @@ LDAP *init_ldap_connection(unsigned logo
info(logopt, MODPREFIX "failed to set connection timeout to %d",
net_timeout.tv_sec);
-#ifdef WITH_SASL
if (ctxt->use_tls) {
if (ctxt->version == 2) {
if (ctxt->tls_required) {
@@ -272,7 +273,6 @@ LDAP *init_ldap_connection(unsigned logo
}
ctxt->use_tls = LDAP_TLS_RELEASE;
}
-#endif
return ldap;
}
@@ -585,10 +585,12 @@ static LDAP *do_connect(unsigned logopt,
{
LDAP *ldap;
+#ifdef WITH_SASL
if (ctxt->extern_cert && ctxt->extern_key) {
set_env(logopt, ENV_LDAPTLS_CERT, ctxt->extern_cert);
set_env(logopt, ENV_LDAPTLS_KEY, ctxt->extern_key);
}
+#endif
ldap = init_ldap_connection(logopt, uri, ctxt);
if (ldap) {
@@ -791,7 +793,6 @@ find_server:
return ldap;
}
-#ifdef WITH_SASL
int get_property(unsigned logopt, xmlNodePtr node, const char *prop, char **value)
{
xmlChar *ret;
@@ -812,6 +813,7 @@ int get_property(unsigned logopt, xmlNod
return 0;
}
+#ifdef WITH_SASL
/*
* For plain text, login and digest-md5 authentication types, we need
* user and password credentials.
@@ -824,6 +826,7 @@ int authtype_requires_creds(const char *
return 1;
return 0;
}
+#endif
/*
* Returns:
@@ -1056,6 +1059,7 @@ auth_fail:
}
} else if (auth_required == LDAP_AUTH_REQUIRED &&
(authtype && !strncmp(authtype, "EXTERNAL", 8))) {
+#ifdef WITH_SASL
ret = get_property(logopt, root, "external_cert", &extern_cert);
ret |= get_property(logopt, root, "external_key", &extern_key);
/*
@@ -1074,6 +1078,7 @@ auth_fail:
if (extern_key)
free(extern_key);
}
+#endif
}
/*
@@ -1094,8 +1099,10 @@ auth_fail:
ctxt->secret = secret;
ctxt->client_princ = client_princ;
ctxt->client_cc = client_cc;
+#ifdef WITH_SASL
ctxt->extern_cert = extern_cert;
ctxt->extern_key = extern_key;
+#endif
debug(logopt, MODPREFIX
"ldap authentication configured with the following options:");
@@ -1127,7 +1134,6 @@ out:
return ret;
}
-#endif
/*
* Take an input string as specified in the master map, and break it
@@ -1390,10 +1396,12 @@ static void free_context(struct lookup_c
defaults_free_searchdns(ctxt->sdns);
if (ctxt->dclist)
free_dclist(ctxt->dclist);
+#ifdef WITH_SASL
if (ctxt->extern_cert)
free(ctxt->extern_cert);
if (ctxt->extern_key)
free(ctxt->extern_key);
+#endif
free(ctxt);
return;

117
SOURCES/autofs-5.0.7-fix-crash-due-to-thread-unsafe-use-of-libldap.patch

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
autofs-5.0.7 - fix crash due to thread unsafe use of libldap

From: Leonardo Chiquitto <leonardo.lists@gmail.com>

Add locking around LDAP initialization calls

To prevent corruption inside SSL and LDAP libraries, it's necessary to
serialize all calls to functions that initialize LDAP contexts.

How to reproduce the problem:

- Setup an LDAP server with SSL/TLS support enabled
- Configure AutoFS to fetch the maps from LDAP
- Make sure the OpenLDAP client library is configured to use SSL
connections and "usetls" is set to yes in autofs_ldap_auth.conf.

In one directory handled by AutoFS (an indirect mount point), trigger in
parallel some dozens of invalid mounts (ie, try to access keys that do not
exist in the AutoFS map). Repeat until it crashes.

Here it always crashes in less than 20 minutes, normally inside OpenSSL.
Core dump inspection shows that internal SSL structures are corrupted,
with function pointers pointing to random addresses.

Trying to find similar reports on the web, I found this email from an
OpenLDAP developer (partial quote, emphasis mine) [1]:

"As far as I know, libldap is thread safe in the sense that multiple
threads can use separate LDAP* handles without running into concurrency
issues; *except for library initialization*, all accesses to common data
(i.e. global variables) is read-only."

[1]http://www.openldap.org/cgi-bin/wilma_hiliter/openldap-software/200606/msg00252.html

AutoFS implements no locking around LDAP initialization libraries and
it's quite common to see multiple threads executing ldap_initialize()
or ldap_start_tls_s() at the same time.
---
CHANGELOG | 1 +
modules/lookup_ldap.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -105,6 +105,7 @@
- fix incorrect append options description in README.v5-release.
- fix mistake in assignment.
- use open(2) instead of access(2) to trigger dependent mounts.
+- fix crash due to thread unsafe use of libldap.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/modules/lookup_ldap.c
+++ autofs-5.0.7/modules/lookup_ldap.c
@@ -52,6 +52,12 @@ static struct ldap_schema common_schema[
};
static unsigned int common_schema_count = sizeof(common_schema)/sizeof(struct ldap_schema);
+/*
+ * Initialization of LDAP and OpenSSL must be always serialized to
+ * avoid corruption of context structures inside these libraries.
+ */
+pthread_mutex_t ldapinit_mutex = PTHREAD_MUTEX_INITIALIZER;
+
struct ldap_search_params {
struct autofs_point *ap;
LDAP *ldap;
@@ -138,6 +144,22 @@ int ldap_parse_page_control(LDAP *ldap,
}
#endif /* HAVE_LDAP_PARSE_PAGE_CONTROL */
+static void ldapinit_mutex_lock(void)
+{
+ int status = pthread_mutex_lock(&ldapinit_mutex);
+ if (status)
+ fatal(status);
+ return;
+}
+
+static void ldapinit_mutex_unlock(void)
+{
+ int status = pthread_mutex_unlock(&ldapinit_mutex);
+ if (status)
+ fatal(status);
+ return;
+}
+
static void uris_mutex_lock(struct lookup_context *ctxt)
{
int status = pthread_mutex_lock(&ctxt->uris_mutex);
@@ -198,7 +220,7 @@ int unbind_ldap_connection(unsigned logo
return rv;
}
-LDAP *init_ldap_connection(unsigned logopt, const char *uri, struct lookup_context *ctxt)
+LDAP *__init_ldap_connection(unsigned logopt, const char *uri, struct lookup_context *ctxt)
{
LDAP *ldap = NULL;
struct timeval timeout = { ctxt->timeout, 0 };
@@ -276,6 +298,17 @@ LDAP *init_ldap_connection(unsigned logo
return ldap;
}
+
+LDAP *init_ldap_connection(unsigned logopt, const char *uri, struct lookup_context *ctxt)
+{
+ LDAP *ldap;
+
+ ldapinit_mutex_lock();
+ ldap = __init_ldap_connection(logopt, uri, ctxt);
+ ldapinit_mutex_unlock();
+
+ return ldap;
+}
static int get_query_dn(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt, const char *class, const char *key)
{

108
SOURCES/autofs-5.0.7-fix-dumpmaps-multi-output.patch

@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
autofs-5.0.7 - fix dumpmaps multi output

From: Ian Kent <raven@themaw.net>

If the maps contain the old style "multi" type the dumped map information
isn't right.
---
CHANGELOG | 1
lib/master.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 50 insertions(+), 12 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -58,6 +58,7 @@
- add after sssd dependency to unit file.
- fix syncronize handle_mounts() shutdown.
- fix fix wildcard multi map regression.
+- fix dumpmaps multi output.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/lib/master.c
+++ autofs-5.0.7/lib/master.c
@@ -1281,6 +1281,54 @@ static void list_source_instances(struct
return;
}
+static void print_map_info(struct map_source *source)
+{
+ int argc = source->argc;
+ int i, multi, map_num;
+
+ multi = (source->type && !strcmp(source->type, "multi"));
+ map_num = 1;
+ for (i = 0; i < argc; i++) {
+ if (source->argv[i] && *source->argv[i] != '-') {
+ if (!multi)
+ printf(" map: %s\n", source->argv[i]);
+ else
+ printf(" map[%i]: %s\n", map_num, source->argv[i]);
+ i++;
+ }
+
+ if (i >= argc)
+ return;
+
+ if (!strcmp(source->argv[i], "--"))
+ continue;
+
+ if (source->argv[i]) {
+ int need_newline = 0;
+ int j;
+
+ if (!multi)
+ printf(" arguments:");
+ else
+ printf(" arguments[%i]:", map_num);
+
+ for (j = i; j < source->argc; j++) {
+ if (!strcmp(source->argv[j], "--"))
+ break;
+ printf(" %s", source->argv[j]);
+ i++;
+ need_newline = 1;
+ }
+ if (need_newline)
+ printf("\n");
+ }
+ if (multi)
+ map_num++;
+ }
+
+ return;
+}
+
int master_show_mounts(struct master *master)
{
struct list_head *p, *head;
@@ -1311,7 +1359,6 @@ int master_show_mounts(struct master *ma
struct autofs_point *ap;
time_t now = time(NULL);
unsigned int count = 0;
- int i;
this = list_entry(p, struct master_mapent, list);
p = p->next;
@@ -1357,20 +1404,10 @@ int master_show_mounts(struct master *ma
}
if (source->argc >= 1) {
- i = 0;
- if (source->argv[0] && *source->argv[0] != '-') {
- printf(" map: %s\n", source->argv[0]);
- i = 1;
- }
+ print_map_info(source);
if (count && ap->type == LKP_INDIRECT)
printf(" duplicate indirect map entry"
" will be ignored at run time\n");
- if (source->argc > 1) {
- printf(" arguments: ");
- for (; i < source->argc; i++)
- printf("%s ", source->argv[i]);
- printf("\n");
- }
}
printf("\n");

25
SOURCES/autofs-5.0.7-fix-fcntl-return-check.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
autofs-5.0.7 - fix fcntl return check

From: Ian Kent <raven@themaw.net>

When checking for FD_CLOEXEC support the return of the fcntl(2) call to
get the file descriptor flags is not checked which could result in an
incorrect result.
---
include/automount.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/automount.h b/include/automount.h
index e72fa0d..6ced842 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -547,7 +547,8 @@ static inline void check_cloexec(int fd)
{
if (cloexec_works == 0) {
int fl = fcntl(fd, F_GETFD);
- cloexec_works = (fl & FD_CLOEXEC) ? 1 : -1;
+ if (fl != -1)
+ cloexec_works = (fl & FD_CLOEXEC) ? 1 : -1;
}
if (cloexec_works > 0)
return;

179
SOURCES/autofs-5.0.7-fix-file-descriptor-leak-when-reloading-the-daemon.patch

@ -0,0 +1,179 @@ @@ -0,0 +1,179 @@
autofs-5.0.7 - fix file descriptor leak when reloading the daemon

From: Leonardo Chiquitto <leonardo.lists@gmail.com>

A customer reported that AutoFS may leak file descriptors when some
maps are modified and the daemon reloaded. I'm able to reproduce the
problem on 5.0.7 by following these steps:

1. Configure a simple direct mount:

# cat /etc/auto.master
/- /etc/auto.direct

# cat /etc/auto.direct
/nfs server:/nfs

2. Start the automounter and do NOT trigger the mount

3. Replace /etc/auto.direct with:

# cat /etc/auto.direct
/nfs/1 server:/nfs
/nfs/2 server:/nfs

4. Reload:

# kill -HUP $(pidof automount)

>From now on, every reload will leak a file descriptor:

# ls -la /proc/$(pidof automount)/fd | grep /nfs
lr-x------ 1 root root 64 Aug 14 22:08 11 -> /nfs
lr-x------ 1 root root 64 Aug 14 22:08 12 -> /nfs
lr-x------ 1 root root 64 Aug 14 22:08 13 -> /nfs
lr-x------ 1 root root 64 Aug 14 22:08 14 -> /nfs
lr-x------ 1 root root 64 Aug 14 22:08 5 -> /nfs

I've investigated the problem and discovered that the leak happens in
do_umount_autofs_direct():

- edit imk
The same leak is present in umount_autofs_offset() also.
Updated patch to cover that too.
- end edit

int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list
*mnts, struct mapent *me)
{
(...)
if (me->ioctlfd != -1) {
if (tree_is_mounted(mnts, me->key, MNTS_REAL)) {
error(ap->logopt,
"attempt to umount busy direct mount %s",
me->key);
return 1;
}
ioctlfd = me->ioctlfd;
} else // ioctlfd == -1
ops->open(ap->logopt, &ioctlfd, me->dev, me->key); <= we open it here

if (ioctlfd >= 0) {
unsigned int status = 1;

rv = ops->askumount(ap->logopt, ioctlfd, &status);
/// at this point, rv == 0 and status == 0
if (rv) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt, "ioctl failed: %s", estr);
return 1;
} else if (!status) {
/// at this point, ap->state == ST_READMAP
if (ap->state != ST_SHUTDOWN_FORCE) {
error(ap->logopt,
"ask umount returned busy for %s",
me->key);
return 1; <= we return here, without closing the fd
} else {
me->ioctlfd = -1;
ops->catatonic(ap->logopt, ioctlfd);
ops->close(ap->logopt, ioctlfd);
goto force_umount;
}
(...)
---
CHANGELOG | 1 +
daemon/direct.c | 19 ++++++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 46ef335..a7ed212 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -30,6 +30,7 @@
- workaround missing GNU versionsort extension.
- dont fail on master map self include.
- fix wildcard multi map regression.
+- fix file descriptor leak when reloading the daemon.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/direct.c b/daemon/direct.c
index 3e09c5d..228a666 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -86,7 +86,8 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, stru
{
struct ioctl_ops *ops = get_ioctl_ops();
char buf[MAX_ERR_BUF];
- int ioctlfd, rv, left, retries;
+ int ioctlfd = -1, rv, left, retries;
+ int opened = 0;
left = umount_multi(ap, me->key, 0);
if (left) {
@@ -103,8 +104,10 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, stru
return 1;
}
ioctlfd = me->ioctlfd;
- } else
+ } else {
ops->open(ap->logopt, &ioctlfd, me->dev, me->key);
+ opened = 1;
+ }
if (ioctlfd >= 0) {
unsigned int status = 1;
@@ -113,12 +116,16 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, stru
if (rv) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt, "ioctl failed: %s", estr);
+ if (opened && ioctlfd != -1)
+ ops->close(ap->logopt, ioctlfd);
return 1;
} else if (!status) {
if (ap->state != ST_SHUTDOWN_FORCE) {
error(ap->logopt,
"ask umount returned busy for %s",
me->key);
+ if (opened && ioctlfd != -1)
+ ops->close(ap->logopt, ioctlfd);
return 1;
} else {
me->ioctlfd = -1;
@@ -536,7 +543,8 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me)
{
struct ioctl_ops *ops = get_ioctl_ops();
char buf[MAX_ERR_BUF];
- int ioctlfd, rv = 1, retries;
+ int ioctlfd = -1, rv = 1, retries;
+ int opened = 0;
if (me->ioctlfd != -1) {
if (is_mounted(_PATH_MOUNTED, me->key, MNTS_REAL)) {
@@ -554,6 +562,7 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me)
return 0;
}
ops->open(ap->logopt, &ioctlfd, me->dev, me->key);
+ opened = 1;
}
if (ioctlfd >= 0) {
@@ -563,6 +572,8 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me)
if (rv) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
logerr("ioctl failed: %s", estr);
+ if (opened && ioctlfd != -1)
+ ops->close(ap->logopt, ioctlfd);
return 1;
} else if (!status) {
if (ap->state != ST_SHUTDOWN_FORCE) {
@@ -570,6 +581,8 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me)
error(ap->logopt,
"ask umount returned busy for %s",
me->key);
+ if (opened && ioctlfd != -1)
+ ops->close(ap->logopt, ioctlfd);
return 1;
} else {
me->ioctlfd = -1;

37
SOURCES/autofs-5.0.7-fix-fix-map-entry-duplicate-offset-detection.patch

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
autofs-5.0.7 - fix fix map entry duplicate offset detection

From: Ian Kent <raven@themaw.net>

Map entry duplicate detection was still broken.
This hopefully will fix it, at least the Conectathon duplicate offset entry
tests pass now.
---
CHANGELOG | 1 +
lib/cache.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index e15aa1f..39d7889 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -47,6 +47,7 @@
- dont probe rdma mounts.
- fix master map mount options matching.
- fix master map bogus keywork match.
+- fix fix map entry duplicate offset detection.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/cache.c b/lib/cache.c
index 1e05a99..ecace4a 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -659,7 +659,7 @@ int cache_update_offset(struct mapent_cache *mc, const char *mkey, const char *k
me = cache_lookup_distinct(mc, key);
if (me && me->age == age) {
- if (me->multi == owner)
+ if (me == owner || strcmp(me->key, key) == 0)
return CHE_DUPLICATE;
}

283
SOURCES/autofs-5.0.7-fix-fix-wildcard-multi-map-regression.patch

@ -0,0 +1,283 @@ @@ -0,0 +1,283 @@
autofs-5.0.7 - fix fix wildcard multi map regression

From: Ian Kent <raven@themaw.net>

A recent patch to fix a wildcard multi map mount regression has a
side effect of causing a deadlock at startup when trying to re-connect
to existing mounts.

The patch required the map entry cache write lock be taken so the cache
could be updated. But when starting and trying to re-connect to existing
mounts there's no need to update the cache.
---
CHANGELOG | 1 +
modules/lookup_file.c | 25 ++++++++++++++++++++-----
modules/lookup_ldap.c | 23 +++++++++++++++++++----
modules/lookup_nisplus.c | 26 +++++++++++++++++++++-----
modules/lookup_sss.c | 22 ++++++++++++++++++----
modules/lookup_yp.c | 23 +++++++++++++++++++----
6 files changed, 98 insertions(+), 22 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -57,6 +57,7 @@
- fix a couple of compiler warnings.
- add after sssd dependency to unit file.
- fix syncronize handle_mounts() shutdown.
+- fix fix wildcard multi map regression.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/modules/lookup_file.c
+++ autofs-5.0.7/modules/lookup_file.c
@@ -1042,7 +1042,7 @@ int lookup_mount(struct autofs_point *ap
return NSS_STATUS_UNAVAIL;
}
- cache_writelock(mc);
+ cache_readlock(mc);
me = cache_lookup_first(mc);
if (me && st.st_mtime <= me->age) {
/*
@@ -1084,7 +1084,18 @@ int lookup_mount(struct autofs_point *ap
}
}
- cache_writelock(mc);
+ /*
+ * We can't take the writelock for direct mounts. If we're
+ * starting up or trying to re-connect to an existing direct
+ * mount we could be iterating through the map entries with
+ * the readlock held. But we don't need to update the cache
+ * when we're starting up so just take the readlock in that
+ * case.
+ */
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
+ cache_readlock(mc);
+ else
+ cache_writelock(mc);
do_cache_lookup:
me = cache_lookup(mc, key);
/*
@@ -1102,10 +1113,11 @@ do_cache_lookup:
}
if (me && me->mapent) {
/*
- * Add wildcard match for later validation checks and
- * negative cache lookups.
+ * If this is a lookup add wildcard match for later validation
+ * checks and negative cache lookups.
*/
- if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ if (!(ap->flags & MOUNT_FLAG_REMOUNT) &&
+ ap->type == LKP_INDIRECT && *me->key == '*') {
ret = cache_update(mc, source, key, me->mapent, me->age);
if (!(ret & (CHE_OK | CHE_UPDATED)))
me = NULL;
@@ -1130,6 +1142,9 @@ do_cache_lookup:
ret = ctxt->parse->parse_mount(ap, key, key_len,
mapent, ctxt->parse->context);
if (ret) {
+ /* Don't update negative cache when re-connecting */
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
+ return NSS_STATUS_TRYAGAIN;
cache_writelock(mc);
cache_update_negative(mc, source, key, ap->negative_timeout);
cache_unlock(mc);
--- autofs-5.0.7.orig/modules/lookup_ldap.c
+++ autofs-5.0.7/modules/lookup_ldap.c
@@ -2975,7 +2975,18 @@ int lookup_mount(struct autofs_point *ap
return status;
}
- cache_writelock(mc);
+ /*
+ * We can't take the writelock for direct mounts. If we're
+ * starting up or trying to re-connect to an existing direct
+ * mount we could be iterating through the map entries with
+ * the readlock held. But we don't need to update the cache
+ * when we're starting up so just take the readlock in that
+ * case.
+ */
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
+ 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) {
@@ -2987,10 +2998,11 @@ int lookup_mount(struct autofs_point *ap
}
if (me && me->mapent) {
/*
- * Add wildcard match for later validation checks and
- * negative cache lookups.
+ * If this is a lookup add wildcard match for later validation
+ * checks and negative cache lookups.
*/
- if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ if (!(ap->flags & MOUNT_FLAG_REMOUNT) &&
+ ap->type == LKP_INDIRECT && *me->key == '*') {
ret = cache_update(mc, source, key, me->mapent, me->age);
if (!(ret & (CHE_OK | CHE_UPDATED)))
me = NULL;
@@ -3012,6 +3024,9 @@ int lookup_mount(struct autofs_point *ap
ret = ctxt->parse->parse_mount(ap, key, key_len,
mapent, ctxt->parse->context);
if (ret) {
+ /* Don't update negative cache when re-connecting */
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
+ return NSS_STATUS_TRYAGAIN;
cache_writelock(mc);
cache_update_negative(mc, source, key, ap->negative_timeout);
cache_unlock(mc);
--- autofs-5.0.7.orig/modules/lookup_nisplus.c
+++ autofs-5.0.7/modules/lookup_nisplus.c
@@ -561,7 +561,18 @@ int lookup_mount(struct autofs_point *ap
return status;
}
- cache_writelock(mc);
+ /*
+ * We can't take the writelock for direct mounts. If we're
+ * starting up or trying to re-connect to an existing direct
+ * mount we could be iterating through the map entries with
+ * the readlock held. But we don't need to update the cache
+ * when we're starting up so just take the readlock in that
+ * case.
+ */
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
+ 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) {
@@ -573,10 +584,11 @@ int lookup_mount(struct autofs_point *ap
}
if (me && me->mapent) {
/*
- * Add wildcard match for later validation checks and
- * negative cache lookups.
+ * If this is a lookup add wildcard match for later validation
+ * checks and negative cache lookups.
*/
- if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ if (!(ap->flags & MOUNT_FLAG_REMOUNT) &&
+ ap->type == LKP_INDIRECT && *me->key == '*') {
ret = cache_update(mc, source, key, me->mapent, me->age);
if (!(ret & (CHE_OK | CHE_UPDATED)))
me = NULL;
@@ -603,6 +615,11 @@ int lookup_mount(struct autofs_point *ap
time_t now = time(NULL);
int rv = CHE_OK;
+ free(mapent);
+
+ /* Don't update negative cache when re-connecting */
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
+ return NSS_STATUS_TRYAGAIN;
cache_writelock(mc);
me = cache_lookup_distinct(mc, key);
if (!me)
@@ -612,7 +629,6 @@ int lookup_mount(struct autofs_point *ap
me->status = time(NULL) + ap->negative_timeout;
}
cache_unlock(mc);
- free(mapent);
return NSS_STATUS_TRYAGAIN;
}
free(mapent);
--- autofs-5.0.7.orig/modules/lookup_sss.c
+++ autofs-5.0.7/modules/lookup_sss.c
@@ -635,7 +635,17 @@ int lookup_mount(struct autofs_point *ap
return status;
}
- cache_readlock(mc);
+ /*
+ * We can't take the writelock for direct mounts. If we're
+ * starting up or trying to re-connect to an existing direct
+ * mount we could be iterating through the map entries with
+ * the readlock held. But we don't need to update the cache
+ * 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);
me = cache_lookup(mc, key);
/* Stale mapent => check for entry in alternate source or wildcard */
if (me && !me->mapent) {
@@ -647,10 +657,11 @@ int lookup_mount(struct autofs_point *ap
}
if (me && me->mapent) {
/*
- * Add wildcard match for later validation checks and
- * negative cache lookups.
+ * If this is a lookup add wildcard match for later validation
+ * checks and negative cache lookups.
*/
- if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ if (ap->type == LKP_INDIRECT && *me->key == '*' &&
+ !(ap->flags & MOUNT_FLAG_REMOUNT)) {
ret = cache_update(mc, source, key, me->mapent, me->age);
if (!(ret & (CHE_OK | CHE_UPDATED)))
me = NULL;
@@ -672,6 +683,9 @@ int lookup_mount(struct autofs_point *ap
ret = ctxt->parse->parse_mount(ap, key, key_len,
mapent, ctxt->parse->context);
if (ret) {
+ /* Don't update negative cache when re-connecting */
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
+ return NSS_STATUS_TRYAGAIN;
cache_writelock(mc);
cache_update_negative(mc, source, key, ap->negative_timeout);
cache_unlock(mc);
--- autofs-5.0.7.orig/modules/lookup_yp.c
+++ autofs-5.0.7/modules/lookup_yp.c
@@ -662,7 +662,18 @@ int lookup_mount(struct autofs_point *ap
return status;
}
- cache_writelock(mc);
+ /*
+ * We can't take the writelock for direct mounts. If we're
+ * starting up or trying to re-connect to an existing direct
+ * mount we could be iterating through the map entries with
+ * the readlock held. But we don't need to update the cache
+ * when we're starting up so just take the readlock in that
+ * case.
+ */
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
+ 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) {
@@ -674,10 +685,11 @@ int lookup_mount(struct autofs_point *ap
}
if (me && me->mapent) {
/*
- * Add wildcard match for later validation checks and
- * negative cache lookups.
+ * If this is a lookup add wildcard match for later validation
+ * checks and negative cache lookups.
*/
- if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ if (ap->type == LKP_INDIRECT && *me->key == '*' &&
+ !(ap->flags & MOUNT_FLAG_REMOUNT)) {
ret = cache_update(mc, source, key, me->mapent, me->age);
if (!(ret & (CHE_OK | CHE_UPDATED)))
me = NULL;
@@ -698,6 +710,9 @@ int lookup_mount(struct autofs_point *ap
ret = ctxt->parse->parse_mount(ap, key, key_len,
mapent, ctxt->parse->context);
if (ret) {
+ /* Don't update negative cache when re-connecting */
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
+ return NSS_STATUS_TRYAGAIN;
cache_writelock(mc);
cache_update_negative(mc, source, key, ap->negative_timeout);
cache_unlock(mc);

94
SOURCES/autofs-5.0.7-fix-get_nfs_info-probe.patch

@ -0,0 +1,94 @@ @@ -0,0 +1,94 @@
autofs-5.0.7 - fix get_nfs_info() probe

From: Ian Kent <ikent@redhat.com>

A recent contributed patch series changed the behaviour of server
probing to use port specification in the same way as mount.nfs(8).

Unfortunately, if NFSv2 only is to be probed and the NFS port
needs to be obtained, the probe fails unconditionally because
no rpc client has yet been created.
---
CHANGELOG | 1 +
modules/replicated.c | 32 ++++++++++++++++++++------------
2 files changed, 21 insertions(+), 12 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -61,6 +61,7 @@
- fix dumpmaps multi output.
- try and cleanup after dumpmaps.
- teach dumpmaps to output simple key value pairs.
+- fix get_nfs_info() probe.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/modules/replicated.c
+++ autofs-5.0.7/modules/replicated.c
@@ -444,6 +444,11 @@ static unsigned int get_nfs_info(unsigne
host->name, proto, version);
rpc_info->proto = proto;
+ if (port < 0)
+ rpc_info->port = NFS_PORT;
+ else if (port > 0)
+ rpc_info->port = port;
+
memset(&parms, 0, sizeof(struct pmap));
parms.pm_prog = NFS_PROGRAM;
parms.pm_prot = proto;
@@ -451,11 +456,7 @@ static unsigned int get_nfs_info(unsigne
if (!(version & NFS4_REQUESTED))
goto v3_ver;
- if (port < 0)
- rpc_info->port = NFS_PORT;
- else if (port > 0)
- rpc_info->port = port;
- else {
+ if (!port) {
status = rpc_portmap_getclient(pm_info,
host->name, host->addr, host->addr_len,
proto, RPC_CLOSE_DEFAULT);
@@ -515,7 +516,7 @@ v3_ver:
if (!(version & NFS3_REQUESTED))
goto v2_ver;
- if (port <= 0 && !(version & NFS4_REQUESTED && port == 0)) {
+ if (!port && !pm_info->client) {
status = rpc_portmap_getclient(pm_info,
host->name, host->addr, host->addr_len,
proto, RPC_CLOSE_DEFAULT);
@@ -526,9 +527,7 @@ v3_ver:
goto done_ver;
}
- if (port > 0)
- rpc_info->port = port;
- else {
+ if (!port) {
parms.pm_vers = NFS3_VERSION;
status = rpc_portmap_getport(pm_info, &parms, &rpc_info->port);
if (status == -EHOSTUNREACH || status == -ETIMEDOUT) {
@@ -573,9 +572,18 @@ v2_ver:
if (!(version & NFS2_REQUESTED))
goto done_ver;
- if (port > 0)
- rpc_info->port = port;
- else {
+ if (!port && !pm_info->client) {
+ status = rpc_portmap_getclient(pm_info,
+ host->name, host->addr, host->addr_len,
+ proto, RPC_CLOSE_DEFAULT);
+ if (status == -EHOSTUNREACH) {
+ supported = status;
+ goto done_ver;
+ } else if (status)
+ goto done_ver;
+ }
+
+ if (!port) {
parms.pm_vers = NFS2_VERSION;
status = rpc_portmap_getport(pm_info, &parms, &rpc_info->port);
if (status == -EHOSTUNREACH || status == -ETIMEDOUT) {

55
SOURCES/autofs-5.0.7-fix-host_addr-null-reference-in-add_new_host.patch

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
autofs-5.0.7 - fix host_addr null reference in add_new_host()

From: Ian Kent <raven@themaw.net>

The function add_new_host() is always called from a loop that depends
on host_addr being non-null.

Remove the redundant check.
---
modules/replicated.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)

diff --git a/modules/replicated.c b/modules/replicated.c
index 0a044b9..e793ca4 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -1030,28 +1030,19 @@ static int add_new_host(struct host **list,
unsigned int prx;
int addr_len;
+ prx = get_proximity(host_addr->ai_addr);
+
/*
- * If we are using random selection we pretend all hosts are at
- * the same proximity so hosts further away don't get excluded.
- * We can't use PROXIMITY_LOCAL or we won't perform an RPC ping
- * to remove hosts that may be down.
+ * If we want the weight to be the determining factor
+ * when selecting a host, or we are using random selection,
+ * then all hosts must have the same proximity. However,
+ * if this is the local machine it should always be used
+ * since it is certainly available.
*/
- if (!host_addr)
+ if (prx != PROXIMITY_LOCAL &&
+ (options & (MOUNT_FLAG_USE_WEIGHT_ONLY |
+ MOUNT_FLAG_RANDOM_SELECT)))
prx = PROXIMITY_SUBNET;
- else {
- prx = get_proximity(host_addr->ai_addr);
- /*
- * If we want the weight to be the determining factor
- * when selecting a host, or we are using random selection,
- * then all hosts must have the same proximity. However,
- * if this is the local machine it should always be used
- * since it is certainly available.
- */
- if (prx != PROXIMITY_LOCAL &&
- (options & (MOUNT_FLAG_USE_WEIGHT_ONLY |
- MOUNT_FLAG_RANDOM_SELECT)))
- prx = PROXIMITY_SUBNET;
- }
/*
* If we tried to add an IPv6 address and we don't have IPv6

41
SOURCES/autofs-5.0.7-fix-inconsistent-signed-usage-for-__rpc_ping.patch

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
autofs-5.0.7 - fix inconsistent signed usage for __rpc_ping()

From: Ian Kent <raven@themaw.net>

There is some incosistent usage of unsigned int variables with the usage
of __rpc_ping().
---
lib/rpc_subs.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index 718caf9..f5742e8 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -670,13 +670,11 @@ int rpc_ping_proto(struct conn_info *info)
return 1;
}
-static unsigned int __rpc_ping(const char *host,
- unsigned long version,
- int proto,
- long seconds, long micros,
- unsigned int option)
+static int __rpc_ping(const char *host,
+ unsigned long version, int proto,
+ long seconds, long micros, unsigned int option)
{
- unsigned int status;
+ int status;
struct conn_info info;
struct pmap parms;
@@ -713,7 +711,7 @@ int rpc_ping(const char *host, long seconds, long micros, unsigned int option)
{
unsigned long vers3 = NFS3_VERSION;
unsigned long vers2 = NFS2_VERSION;
- unsigned int status;
+ int status;
status = __rpc_ping(host, vers2, IPPROTO_UDP, seconds, micros, option);
if (status > 0)

23
SOURCES/autofs-5.0.7-fix-inconsistent-use-of-cache-lock-in-handle_packet_missing_direct.patch

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
autofs-5.0.7 - fix inconsistent use of cache lock in handle_packet_missing_direct()

From: Ian Kent <raven@themaw.net>

All references here except this one refer to the same variable so change the odd
one out for consistency.
---
daemon/direct.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/daemon/direct.c b/daemon/direct.c
index 228a666..399ad0a 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -1392,7 +1392,7 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
ops->send_fail(ap->logopt,
ioctlfd, pkt->wait_queue_token, -ENOENT);
ops->close(ap->logopt, ioctlfd);
- cache_unlock(me->mc);
+ cache_unlock(mc);
master_source_unlock(ap->entry);
master_mutex_unlock();
pthread_setcancelstate(state, NULL);

30
SOURCES/autofs-5.0.7-fix-incorrect-check-in-flag_is_owned.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
autofs-5.0.7 - fix incorrect check in flag_is_owned()

From: Ian Kent <raven@themaw.net>

The flag file code isn't used any more but this is clearly incorrect
so fix it in case it gets used sometime in the future.
---
daemon/flag.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/daemon/flag.c b/daemon/flag.c
index f8fe163..db9a4bd 100644
--- a/daemon/flag.c
+++ b/daemon/flag.c
@@ -66,12 +66,11 @@ static int flag_is_owned(int fd)
continue;
}
-
- /* Stale flagfile */
- if (!tries)
- return 0;
}
+ /* Stale flagfile */
+ if (!tries)
+ return 0;
if (pid) {
int ret;

22
SOURCES/autofs-5.0.7-fix-incorrect-name-in-test.patch

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
autofs-5.0.7 - fix incorrect var name in test

From: Ian Kent <raven@themaw.net>

Fix incorrect variable name used for test of buffer size for getgrgid_r.
---
lib/mounts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/mounts.c b/lib/mounts.c
index 550445c..0caa0aa 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -1222,7 +1222,7 @@ void set_tsd_user_vars(unsigned int logopt, uid_t uid, gid_t gid)
/* Try to get group info */
grplen = sysconf(_SC_GETGR_R_SIZE_MAX);
- if (tmplen < 0) {
+ if (grplen < 0) {
error(logopt, "failed to get buffer size for getgrgid_r");
goto free_tsv_home;
}

22
SOURCES/autofs-5.0.7-fix-incorrect-value-reference-in-parse_line.patch

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
autofs-5.0.7 - fix incorrect value reference in parse_line()

From: Ian Kent <raven@themaw.net>

This chack should clearly be on the contents of key not the pointer value.
---
lib/defaults.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/defaults.c b/lib/defaults.c
index 1e89509..7c65387 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -167,7 +167,7 @@ static int parse_line(char *line, char **res, char **value)
while (*key && *key == ' ')
key++;
- if (!key)
+ if (!*key)
return 0;
if (!(val = strchr(key, '=')))

39
SOURCES/autofs-5.0.7-fix-init-script-status-return.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
autofs-5.0.7 - fix init script status return

From: Ian Kent <ikent@redhat.com>

The patch that added the piddir to configure to fix incorrect init
script status() function returns failed to actually return the value
to the user.
---

CHANGELOG | 1 +
redhat/autofs.init.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 76c1f73..5bcb1af 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,7 @@
- Allow nsswitch.conf to not contain "automount:" lines.
- fix nobind man page description.
- fix submount offset delete.
+- fix init script status return.
25/07/2012 autofs-5.0.7
=======================
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
index fe18b3e..9d008ff 100644
--- a/redhat/autofs.init.in
+++ b/redhat/autofs.init.in
@@ -172,7 +172,7 @@ RETVAL=0
case "$1" in
status)
status -p @@autofspiddir@@/autofs.pid -l autofs $prog
- exit 0;
+ exit $?;
;;
usage)
usage_message

55
SOURCES/autofs-5.0.7-fix-interface-address-null-check.patch

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
autofs-5.0.7 - fix interface address null check

From: Doug Nazar <nazard@nazar.ca>

Since commit aa6f7793 [autofs-5.0.7 - fix ipv6 proximity calculation]
get_proximity() uses getifaddrs however it crashes on interfaces with
no addresses.

Fix the NULL check to ignore interfaces with no addresses.
Also skip interfaces which are not currently running.
---
CHANGELOG | 1 +
modules/replicated.c | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 66c11de..50e83d7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -43,6 +43,7 @@
- make dump maps check for duplicate indirect mounts.
- document allowed map sources in auto.master.
- add enable sloppy mount option to configure.
+- fix interface address null check.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/replicated.c b/modules/replicated.c
index 26f64b8..6dbdade 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -165,8 +165,9 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
this = ifa;
while (this) {
- if (this->ifa_flags & IFF_POINTOPOINT ||
- this->ifa_addr->sa_data == NULL) {
+ if (!(this->ifa_flags & IFF_UP) ||
+ this->ifa_flags & IFF_POINTOPOINT ||
+ this->ifa_addr == NULL) {
this = this->ifa_next;
continue;
}
@@ -202,8 +203,9 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
this = ifa;
while (this) {
- if (this->ifa_flags & IFF_POINTOPOINT ||
- this->ifa_addr->sa_data == NULL) {
+ if (!(this->ifa_flags & IFF_UP) ||
+ this->ifa_flags & IFF_POINTOPOINT ||
+ this->ifa_addr == NULL) {
this = this->ifa_next;
continue;
}

297
SOURCES/autofs-5.0.7-fix-ipv6-proximity-calculation.patch

@ -0,0 +1,297 @@ @@ -0,0 +1,297 @@
autofs-5.0.7 - fix ipv6 proximity calculation

From: Ian Kent <ikent@redhat.com>

The socket based ioctl used to get interface information only
return IPv4 information. Change get_proximity() function to use
getifaddrs(3) instead.
---

CHANGELOG | 1
modules/replicated.c | 149 ++++++++++++++------------------------------------
2 files changed, 42 insertions(+), 108 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index dc38580..34c70fa 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@
=======================
- fix nobind sun escaped map entries.
- fix use cache entry after free in lookup_prune_one_cache().
+- fix ipv6 proximity calculation.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/replicated.c b/modules/replicated.c
index 78046c6..bd6003b 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -52,6 +52,7 @@
#include <net/if.h>
#include <netinet/in.h>
#include <netdb.h>
+#include <ifaddrs.h>
#include "rpc_subs.h"
#include "replicated.h"
@@ -110,58 +111,18 @@ void seed_random(void)
return;
}
-static int alloc_ifreq(struct ifconf *ifc, int sock)
-{
- int ret, lastlen = ifc_last_len, len = ifc_buf_len;
- char err_buf[MAX_ERR_BUF], *buf;
-
- while (1) {
- buf = malloc(len);
- if (!buf) {
- char *estr = strerror_r(errno, err_buf, MAX_ERR_BUF);
- logerr("malloc: %s", estr);
- return 0;
- }
-
- ifc->ifc_len = len;
- ifc->ifc_req = (struct ifreq *) buf;
-
- ret = ioctl(sock, SIOCGIFCONF, ifc);
- if (ret == -1) {
- char *estr = strerror_r(errno, err_buf, MAX_ERR_BUF);
- logerr("ioctl: %s", estr);
- free(buf);
- return 0;
- }
-
- if (ifc->ifc_len <= lastlen)
- break;
-
- lastlen = ifc->ifc_len;
- len += MAX_IFC_BUF;
- free(buf);
- }
-
- if (lastlen != ifc_last_len) {
- ifc_last_len = lastlen;
- ifc_buf_len = len;
- }
-
- return 1;
-}
-
static unsigned int get_proximity(struct sockaddr *host_addr)
{
+ struct ifaddrs *ifa = NULL;
+ struct ifaddrs *this;
struct sockaddr_in *addr, *msk_addr, *if_addr;
struct sockaddr_in6 *addr6, *msk6_addr, *if6_addr;
struct in_addr *hst_addr;
struct in6_addr *hst6_addr;
int addr_len;
- char buf[MAX_ERR_BUF], *ptr;
- struct ifconf ifc;
- struct ifreq *ifr, nmptr;
- int sock, ret, i;
+ char buf[MAX_ERR_BUF];
uint32_t mask, ha, ia, *mask6, *ha6, *ia6;
+ int ret;
addr = NULL;
addr6 = NULL;
@@ -170,13 +131,14 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
mask6 = NULL;
ha6 = NULL;
ia6 = NULL;
+ ha = 0;
switch (host_addr->sa_family) {
case AF_INET:
addr = (struct sockaddr_in *) host_addr;
hst_addr = (struct in_addr *) &addr->sin_addr;
ha = ntohl((uint32_t) hst_addr->s_addr);
- addr_len = sizeof(hst_addr);
+ addr_len = sizeof(*hst_addr);
break;
case AF_INET6:
@@ -186,7 +148,7 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
addr6 = (struct sockaddr_in6 *) host_addr;
hst6_addr = (struct in6_addr *) &addr6->sin6_addr;
ha6 = &hst6_addr->s6_addr32[0];
- addr_len = sizeof(hst6_addr);
+ addr_len = sizeof(*hst6_addr);
break;
#endif
@@ -194,36 +156,29 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
return PROXIMITY_ERROR;
}
- sock = open_sock(AF_INET, SOCK_DGRAM, 0);
- if (sock < 0) {
+ ret = getifaddrs(&ifa);
+ if (ret) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
- logerr("socket creation failed: %s", estr);
+ logerr("getifaddrs: %s", estr);
return PROXIMITY_ERROR;
}
- if (!alloc_ifreq(&ifc, sock)) {
- close(sock);
- return PROXIMITY_ERROR;
- }
-
- /* For each interface */
-
- /* Is the address a local interface */
- i = 0;
- ptr = (char *) &ifc.ifc_buf[0];
-
- while (ptr < (char *) ifc.ifc_req + ifc.ifc_len) {
- ifr = (struct ifreq *) ptr;
+ this = ifa;
+ while (this) {
+ if (this->ifa_flags & IFF_POINTOPOINT ||
+ this->ifa_addr->sa_data == NULL) {
+ this = this->ifa_next;
+ continue;
+ }
- switch (ifr->ifr_addr.sa_family) {
+ switch (this->ifa_addr->sa_family) {
case AF_INET:
if (host_addr->sa_family == AF_INET6)
break;
- if_addr = (struct sockaddr_in *) &ifr->ifr_addr;
+ if_addr = (struct sockaddr_in *) this->ifa_addr;
ret = memcmp(&if_addr->sin_addr, hst_addr, addr_len);
if (!ret) {
- close(sock);
- free(ifc.ifc_req);
+ freeifaddrs(ifa);
return PROXIMITY_LOCAL;
}
break;
@@ -234,55 +189,41 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
#else
if (host_addr->sa_family == AF_INET)
break;
-
- if6_addr = (struct sockaddr_in6 *) &ifr->ifr_addr;
+ if6_addr = (struct sockaddr_in6 *) this->ifa_addr;
ret = memcmp(&if6_addr->sin6_addr, hst6_addr, addr_len);
if (!ret) {
- close(sock);
- free(ifc.ifc_req);
+ freeifaddrs(ifa);
return PROXIMITY_LOCAL;
}
#endif
-
default:
break;
}
-
- i++;
- ptr = (char *) &ifc.ifc_req[i];
+ this = this->ifa_next;
}
- i = 0;
- ptr = (char *) &ifc.ifc_buf[0];
-
- while (ptr < (char *) ifc.ifc_req + ifc.ifc_len) {
- ifr = (struct ifreq *) ptr;
-
- nmptr = *ifr;
- ret = ioctl(sock, SIOCGIFNETMASK, &nmptr);
- if (ret == -1) {
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
- logerr("ioctl: %s", estr);
- close(sock);
- free(ifc.ifc_req);
- return PROXIMITY_ERROR;
+ this = ifa;
+ while (this) {
+ if (this->ifa_flags & IFF_POINTOPOINT ||
+ this->ifa_addr->sa_data == NULL) {
+ this = this->ifa_next;
+ continue;
}
- switch (ifr->ifr_addr.sa_family) {
+ switch (this->ifa_addr->sa_family) {
case AF_INET:
if (host_addr->sa_family == AF_INET6)
break;
- if_addr = (struct sockaddr_in *) &ifr->ifr_addr;
+ if_addr = (struct sockaddr_in *) this->ifa_addr;
ia = ntohl((uint32_t) if_addr->sin_addr.s_addr);
- /* Is the address within a localiy attached subnet */
+ /* Is the address within a localy attached subnet */
- msk_addr = (struct sockaddr_in *) &nmptr.ifr_netmask;
+ msk_addr = (struct sockaddr_in *) this->ifa_netmask;
mask = ntohl((uint32_t) msk_addr->sin_addr.s_addr);
if ((ia & mask) == (ha & mask)) {
- close(sock);
- free(ifc.ifc_req);
+ freeifaddrs(ifa);
return PROXIMITY_SUBNET;
}
@@ -304,8 +245,7 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
break;
if ((ia & mask) == (ha & mask)) {
- close(sock);
- free(ifc.ifc_req);
+ freeifaddrs(ifa);
return PROXIMITY_NET;
}
break;
@@ -316,35 +256,28 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
#else
if (host_addr->sa_family == AF_INET)
break;
-
- if6_addr = (struct sockaddr_in6 *) &ifr->ifr_addr;
+ if6_addr = (struct sockaddr_in6 *) this->ifa_addr;
ia6 = &if6_addr->sin6_addr.s6_addr32[0];
/* Is the address within the network of the interface */
- msk6_addr = (struct sockaddr_in6 *) &nmptr.ifr_netmask;
+ msk6_addr = (struct sockaddr_in6 *) this->ifa_netmask;
mask6 = &msk6_addr->sin6_addr.s6_addr32[0];
if (ipv6_mask_cmp(ha6, ia6, mask6)) {
- close(sock);
- free(ifc.ifc_req);
+ freeifaddrs(ifa);
return PROXIMITY_SUBNET;
}
/* How do we define "local network" in ipv6? */
#endif
- break;
-
default:
break;
}
-
- i++;
- ptr = (char *) &ifc.ifc_req[i];
+ this = this->ifa_next;
}
- close(sock);
- free(ifc.ifc_req);
+ freeifaddrs(ifa);
return PROXIMITY_OTHER;
}

21
SOURCES/autofs-5.0.7-fix-leaked-ldap-percent-hack-allocation-in-lookup_one.patch

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
autofs-5.0.7 - fix leaked ldap percent hack allocation in lookup_one()

From: Ian Kent <raven@themaw.net>

Fix a resource leak when calling the percent hack transforms in lookup_one().
---
modules/lookup_ldap.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 26481a8..35ea6ea 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -2525,6 +2525,7 @@ static int lookup_one(struct autofs_point *ap,
if (enc_len1 != 0) {
enc_len2 = encode_percent_hack(qKey, &enc_key2, 1);
if (enc_len2 < 0) {
+ free(enc_key1);
crit(ap->logopt,
"could not use percent hack encode key %s",
qKey);

66
SOURCES/autofs-5.0.7-fix-libtirpc-build-option.patch

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
autofs-5.0.7 - fix libtirpc build option

From: Ian Kent <raven@themaw.net>


---
CHANGELOG | 1 +
autofs.spec | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index e848bcd..b6b2679 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -34,6 +34,7 @@
- depricate nosymlink pseudo option.
- add symlink pseudo option.
- fix requires in spec file.
+- fix libtirpc build option to require libtirpc-devel if needed.
25/07/2012 autofs-5.0.7
=======================
diff --git a/autofs.spec b/autofs.spec
index 703f7a9..f77acc1 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -12,6 +12,10 @@
# disable them.
%define with_systemd %{?_without_systemd: 0} %{?!_without_systemd: 1}
+# Use --without libtirpc in your rpmbuild command or force values to 0 to
+# disable them.
+%define with_libtirpc %{?_without_libtirpc: 0} %{?!_without_libtirpc: 1}
+
Summary: A tool from automatically mounting and umounting filesystems.
Name: autofs
%define version 5.0.7
@@ -25,6 +29,9 @@ Buildroot: %{_tmppath}/%{name}-tmp
%if %{with_systemd}
BuildRequires: systemd-units
%endif
+%if %{with_libtirpc}
+BuildRequires: libtirpc-devel
+%endif
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, cyrus-sasl-devel
Requires: chkconfig
Requires: /bin/bash mktemp sed textutils sh-utils grep /bin/ps
@@ -72,9 +79,17 @@ echo %{version}-%{release} > .version
%define _unitdir %{?_unitdir:/lib/systemd/system}
%define systemd_configure_arg --with-systemd
%endif
+%if %{with_libtirpc}
+ %define libtirpc_configure_arg --with-libtirpc
+%endif
%build
-CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc %{?systemd_configure_arg:}
+CFLAGS="$RPM_OPT_FLAGS -Wall" \
+./configure --libdir=%{_libdir} \
+ --disable-mount-locking \
+ --enable-ignore-busy \
+ %{?systemd_configure_arg:} \
+ %{?libtirpc_configure_arg:}
CFLAGS="$RPM_OPT_FLAGS -Wall" make initdir=/etc/rc.d/init.d DONTSTRIP=1
%install

37
SOURCES/autofs-5.0.7-fix-map-entry-duplicate-offset-detection.patch

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
autofs-5.0.7 - fix map entry duplicate offset detection

From: Ian Kent <raven@themaw.net>

Recent changes broke the detection of duplicate offsets in map entries.
---

CHANGELOG | 1 +
lib/cache.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 8f6bb3a..bd0dd82 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -15,6 +15,7 @@
- fix recursive mount deadlock.
- increase file map read buffer size.
- handle new location of systemd.
+- fix map entry duplicate offset detection.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/cache.c b/lib/cache.c
index 9179ad5..1e05a99 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -659,7 +659,7 @@ int cache_update_offset(struct mapent_cache *mc, const char *mkey, const char *k
me = cache_lookup_distinct(mc, key);
if (me && me->age == age) {
- if (me->multi != owner)
+ if (me->multi == owner)
return CHE_DUPLICATE;
}

62
SOURCES/autofs-5.0.7-fix-master-map-bogus-keywork-match.patch

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
autofs-5.0.7 - fix master map bogus keywork match

From: Ian Kent <raven@themaw.net>

If we have a map name in the master map that ends with a keyword
of one of the map types or "multi" we mistakenly match the trailing
white space and include that in the map name. This has to be wrong
since we can't handle quoting in the master map and embedded white
space must be escaped. It would be good if we handled quoted strings
but that has proven a bit of a nightmare so far for the current
tokenizer.
---
CHANGELOG | 1 +
lib/master_tok.l | 16 ++++++++++++++++
2 files changed, 17 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 00eaff2..e15aa1f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -46,6 +46,7 @@
- fix interface address null check.
- dont probe rdma mounts.
- fix master map mount options matching.
+- fix master map bogus keywork match.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/master_tok.l b/lib/master_tok.l
index 8d1f1a2..a55cc76 100644
--- a/lib/master_tok.l
+++ b/lib/master_tok.l
@@ -202,6 +202,14 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo
{MULTI} {
tlen = master_leng - 1;
if (bptr != buff && isblank(master_text[tlen])) {
+ /*
+ * We can't handle unescaped white space in map names
+ * so just eat the white space. We always have the
+ * "multi" at the beginning of the string so the while
+ * will not fall off the end.
+ */
+ while (isblank(master_text[tlen - 1]))
+ tlen--;
strncat(buff, master_text, tlen);
bptr += tlen;
yyless(tlen);
@@ -216,6 +224,14 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo
{MTYPE}/{DNATTRSTR}= {
tlen = master_leng - 1;
if (bptr != buff && isblank(master_text[tlen])) {
+ /*
+ * We can't handle unescaped white space in map names
+ * so just eat the white space. We always have the
+ * maptype keyword at the beginning of the string so
+ * the while will not fall off the end.
+ */
+ while (isblank(master_text[tlen - 1]))
+ tlen--;
strncat(buff, master_text, tlen);
bptr += tlen;
yyless(tlen);

43
SOURCES/autofs-5.0.7-fix-master-map-mount-options-matching.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
autofs-5.0.7 - fix master map mount options matching

From: Ian Kent <raven@themaw.net>

The master map options pattern matching is fairly primitive since it
doesn't need to be very sophisticated. The current mount option pattern
matching can't match mount options with quotes or embedded colons and so
it can't pass these options through as a global options string.

But it must be able to match a fairly large class of strings, including
the above case, so they can be passed through as global options. Of
course it can't try and validate them since it can't know what mount type
they may be used with.
---
CHANGELOG | 1 +
lib/master_tok.l | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 1156cc9..00eaff2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -45,6 +45,7 @@
- add enable sloppy mount option to configure.
- fix interface address null check.
- dont probe rdma mounts.
+- fix master map mount options matching.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/master_tok.l b/lib/master_tok.l
index f9b4e55..8d1f1a2 100644
--- a/lib/master_tok.l
+++ b/lib/master_tok.l
@@ -91,7 +91,7 @@ OPTWS [[:blank:]]*
NL \r?\n
CONT \\\n{OPTWS}
-OPTIONSTR ([\-]?([[:alpha:]_]([[:alnum:]_\-])*(=([[:alnum:]_\-])+)*)+)
+OPTIONSTR ([\-]?([[:alpha:]_]([[:alnum:]_\-])*(=(\"?([[:alnum:]_\-\:])+\"?))?)+)
MACROSTR (-D{OPTWS}([[:alpha:]_]([[:alnum:]_\-\.])*)=([[:alnum:]_\-\.])+)
SLASHIFYSTR (--(no-)?slashify-colons)
NUMBER [0-9]+

30
SOURCES/autofs-5.0.7-fix-memory-leak-in-get_dc_list.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
autofs-5.0.7 - fix memory leak in get_dc_list()

From: Ian Kent <raven@themaw.net>

In get_dc_list() if an invalid port is found the allocated list storage
isn't freed on the error exit.
---
modules/dclist.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/modules/dclist.c b/modules/dclist.c
index d16b913..af21ce0 100644
--- a/modules/dclist.c
+++ b/modules/dclist.c
@@ -536,6 +536,7 @@ struct dclist *get_dc_list(unsigned int logopt, const char *uri)
else
strcat(tmp, " ");
+ list = NULL;
for (i = 0; i < numdcs; i++) {
if (i > 0)
strcat(tmp, " ");
@@ -549,6 +550,7 @@ struct dclist *get_dc_list(unsigned int logopt, const char *uri)
error(logopt,
"invalid port: %u", dcs[i].port);
free_srv_rrs(dcs, numdcs);
+ free(tmp);
goto out_error;
}
strcat(tmp, port);

46
SOURCES/autofs-5.0.7-fix-nobind-man-page-description.patch

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
autofs-5.0.7 - fix nobind man page description

From: Ian Kent <raven@themaw.net>

Update auto.master(5) to better describe the behavior of the "nobind"
option when used with direct mounts maps.
---

CHANGELOG | 1 +
man/auto.master.5.in | 10 +++++++---
2 files changed, 8 insertions(+), 3 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 16ac2a0..7eb7235 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -17,6 +17,7 @@
- handle new location of systemd.
- fix map entry duplicate offset detection.
- Allow nsswitch.conf to not contain "automount:" lines.
+- fix nobind man page description.
25/07/2012 autofs-5.0.7
=======================
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index 21d7544..8007542 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -151,9 +151,13 @@ can't be mounted.
This is an autofs specific option that is a pseudo mount option and
so is given without a leading dash. It may be used either in the master
map entry (so it effects all the map entries) or with individual map
-entries to prevent bind mounting of local NFS filesystems. Bind mounting
-of NFS file systems can also be prevented for specific map entrys by
-adding the "port=" mount option to the entries.
+entries to prevent bind mounting of local NFS filesystems. For direct
+mount maps the option is only effective if specified on the first direct
+map entry and is applied to all direct mount maps in the master map. It
+is ignored if given on subsequent direct map entries. It may be used
+on individual map entries of both types. Bind mounting of NFS file
+systems can also be prevented for specific map entrys by adding the
+"port=" mount option to the entries.
.TP
.I "\-r, \-\-random-multimount-selection"
Enables the use of ramdom selection when choosing a host from a

47
SOURCES/autofs-5.0.7-fix-nobind-sun-escaped-map-entries.patch

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
autofs-5.0.7 - fix nobind sun escaped map entries

From: Ian Kent <ikent@redhat.com>

If a map contains a Sun colon escape to indicate the mount is a local
file system and the "nobind" option is present there is no hostname in
the mount location and the mount fails.
---

CHANGELOG | 4 ++++
modules/mount_nfs.c | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 67fdcec..faf4c80 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+??/??/2012 autofs-5.0.8
+=======================
+- fix nobind sun escaped map entries.
+
25/07/2012 autofs-5.0.7
=======================
- fix ipv6 name for lookup fix.
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index 9b8e5f1..bbbb1de 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -263,13 +263,14 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
} else
strcpy(loc, n_addr);
} else {
- loc = malloc(strlen(this->name) + strlen(this->path) + 2);
+ char *host = this->name ? this->name : "localhost";
+ loc = malloc(strlen(host) + strlen(this->path) + 2);
if (!loc) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt, "malloc: %s", estr);
goto forced_fail;
}
- strcpy(loc, this->name);
+ strcpy(loc, host);
}
strcat(loc, ":");
strcat(loc, this->path);

81
SOURCES/autofs-5.0.7-fix-null-map-entry-order-handling.patch

@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
autofs-5.0.7 - fix null map entry order handling

From: Ian Kent <ikent@redhat.com>

If a null map entry appears after a corresponding indirect map entry
autofs doesn't handle it properly.

Since it appears after the map entry it should'nt affect it but autofs
doesn't account for this case and assumes the map entry is already
mounted and tries to shut it down causing attempted access to facilities
that don't exist.
---

CHANGELOG | 1 +
lib/master.c | 32 +++++++++++++++++++++++++++++---
2 files changed, 30 insertions(+), 3 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 7b8d185..79cf673 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@
- fix typo in automount(8).
- dont wait forever to restart.
- add timeout option description to man page.
+- fix null map entry order handling.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/master.c b/lib/master.c
index 904b13d..a0e62f2 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -1179,9 +1179,35 @@ int master_mount_mounts(struct master *master, time_t age, int readall)
cache_readlock(nc);
ne = cache_lookup_distinct(nc, this->path);
- if (ne && this->age > ne->age) {
+ /*
+ * If this path matched a nulled entry the master map entry
+ * must be an indirect mount so the master map entry line
+ * number may be obtained from this->maps.
+ */
+ if (ne) {
+ int lineno = ne->age;
cache_unlock(nc);
- st_add_task(ap, ST_SHUTDOWN_PENDING);
+
+ /* null entry appears after map entry */
+ if (this->maps->master_line < lineno) {
+ warn(ap->logopt,
+ "ignoring null entry that appears after "
+ "existing entry for %s", this->path);
+ goto cont;
+ }
+ if (ap->state != ST_INIT) {
+ st_add_task(ap, ST_SHUTDOWN_PENDING);
+ continue;
+ }
+ /*
+ * The map entry hasn't been started yet and we've
+ * seen a preceeding null map entry for it so just
+ * delete it from the master map entry list so it
+ * doesn't get in the road.
+ */
+ list_del_init(&this->list);
+ master_free_mapent_sources(ap->entry, 1);
+ master_free_mapent(ap->entry);
continue;
}
nested = cache_partial_match(nc, this->path);
@@ -1194,7 +1220,7 @@ int master_mount_mounts(struct master *master, time_t age, int readall)
cache_delete(nc, nested->key);
}
cache_unlock(nc);
-
+cont:
st_mutex_lock();
state_pipe = this->ap->state_pipe[1];

51
SOURCES/autofs-5.0.7-fix-parse-buffer-initialization.patch

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
autofs-5.0.7 - fix parse buffer initialization

From: Ian Kent <ikent@redhat.com>

When parsing a master map entry, if the mount point path is longer than
the following map string the lexical analyzer buffer may not have a null
terminator where it is expected. If the map name string also contains a
string that is the same as a map type at the end the map name the map
name is not constructed correctly because of this lack of a string
terminator in the buffer.
---

CHANGELOG | 1 +
lib/master_tok.l | 4 +++-
2 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 34c70fa..276d6ba 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,7 @@
- fix nobind sun escaped map entries.
- fix use cache entry after free in lookup_prune_one_cache().
- fix ipv6 proximity calculation.
+- fix parse buffer initialization.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/master_tok.l b/lib/master_tok.l
index 0d6edb7..30abb15 100644
--- a/lib/master_tok.l
+++ b/lib/master_tok.l
@@ -74,7 +74,8 @@ int my_yyinput(char *, int);
#define unput(c) (*(char *) --line = c)
#endif
-char buff[1024];
+#define BUFF_LEN 1024
+char buff[BUFF_LEN];
char *bptr;
char *optr = buff;
unsigned int tlen;
@@ -174,6 +175,7 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo
*bptr = '\0';
strcpy(master_lval.strtype, buff);
bptr = buff;
+ memset(buff, 0, BUFF_LEN);
return(PATH);
}

285
SOURCES/autofs-5.0.7-fix-portmap-lookup.patch

@ -0,0 +1,285 @@ @@ -0,0 +1,285 @@
autofs-5.0.7 - fix portmap lookup

From: Ian Kent <ikent@redhat.com>

The autofs RPC library has fallen behind some.

When using IPv6 (rpbbind) version 3 or 4 is available whereas with IPv4
(portmap) verions 2 and 3 are available.

autofs uses the version defined by PMAPVERS in the portmap include files
whereas it should be using the RPCBVERS defines when using libtirpc.

In addition /etc/rpc should be used for program number lookup and
/etc/services should be used to lookup rpcbind/protmap port number.

This incompatibility only shows up when using IPv6 only.
---
CHANGELOG | 1
aclocal.m4 | 2 +
configure | 80 +++++++++++++++++++++++++++++++++++++++++++++
include/config.h.in | 6 +++
lib/rpc_subs.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++----
5 files changed, 175 insertions(+), 6 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -62,6 +62,7 @@
- try and cleanup after dumpmaps.
- teach dumpmaps to output simple key value pairs.
- fix get_nfs_info() probe.
+- fix portmap lookup.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/aclocal.m4
+++ autofs-5.0.7/aclocal.m4
@@ -421,6 +421,8 @@ if test "$af_have_libtirpc" = "yes"; the
TIRPCLIB="-ltirpc"
fi
+AC_CHECK_FUNCS([getrpcbyname getservbyname])
+
# restore flags
CFLAGS="$af_check_libtirpc_save_cflags"
LDFLAGS="$af_check_libtirpc_save_ldflags"
--- autofs-5.0.7.orig/configure
+++ autofs-5.0.7/configure
@@ -1559,6 +1559,73 @@ fi
} # ac_fn_c_try_link
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* 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 $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
# ac_fn_c_try_cpp LINENO
# ----------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
@@ -3161,6 +3228,19 @@ $as_echo "#define TIRPC_WORKAROUND 1" >>
TIRPCLIB="-ltirpc"
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"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
# restore flags
CFLAGS="$af_check_libtirpc_save_cflags"
LDFLAGS="$af_check_libtirpc_save_ldflags"
--- autofs-5.0.7.orig/include/config.h.in
+++ autofs-5.0.7/include/config.h.in
@@ -21,6 +21,12 @@
/* define if you have E4FSCK */
#undef HAVE_E4FSCK
+/* Define to 1 if you have the `getrpcbyname' function. */
+#undef HAVE_GETRPCBYNAME
+
+/* Define to 1 if you have the `getservbyname' function. */
+#undef HAVE_GETSERVBYNAME
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
--- autofs-5.0.7.orig/lib/rpc_subs.c
+++ autofs-5.0.7/lib/rpc_subs.c
@@ -43,6 +43,14 @@
} while (0)
#endif
+#ifdef WITH_LIBTIRPC
+const rpcprog_t rpcb_prog = RPCBPROG;
+const rpcvers_t rpcb_version = RPCBVERS;
+#else
+const rpcprog_t rpcb_prog = PMAPPROG;
+const rpcvers_t rpcb_version = PMAPVERS;
+#endif
+
#include "mount.h"
#include "rpc_subs.h"
#include "automount.h"
@@ -259,6 +267,9 @@ static int rpc_do_create_client(struct s
laddr = (struct sockaddr *) &in4_laddr;
in4_raddr->sin_port = htons(info->port);
slen = sizeof(struct sockaddr_in);
+ /* Use rpcbind v2 for AF_INET */
+ if (info->program == rpcb_prog)
+ info->version = PMAPVERS;
} else if (addr->sa_family == AF_INET6) {
struct sockaddr_in6 *in6_raddr = (struct sockaddr_in6 *) addr;
in6_laddr.sin6_family = AF_INET6;
@@ -315,6 +326,63 @@ static int rpc_do_create_client(struct s
}
#endif
+#if defined(HAVE_GETRPCBYNAME) || defined(HAVE_GETSERVBYNAME)
+static pthread_mutex_t rpcb_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+static rpcprog_t rpc_getrpcbyname(const rpcprog_t program)
+{
+#ifdef HAVE_GETRPCBYNAME
+ static const char *rpcb_pgmtbl[] = {
+ "rpcbind", "portmap", "portmapper", "sunrpc", NULL,
+ };
+ struct rpcent *entry;
+ rpcprog_t prog_number;
+ unsigned int i;
+
+ pthread_mutex_lock(&rpcb_mutex);
+ for (i = 0; rpcb_pgmtbl[i] != NULL; i++) {
+ entry = getrpcbyname(rpcb_pgmtbl[i]);
+ if (entry) {
+ prog_number = entry->r_number;
+ pthread_mutex_unlock(&rpcb_mutex);
+ return prog_number;
+ }
+ }
+ pthread_mutex_unlock(&rpcb_mutex);
+#endif
+ return program;
+}
+
+static unsigned short rpc_getrpcbport(const int proto)
+{
+#ifdef HAVE_GETSERVBYNAME
+ static const char *rpcb_netnametbl[] = {
+ "rpcbind", "portmapper", "sunrpc", NULL,
+ };
+ struct servent *entry;
+ struct protoent *p_ent;
+ unsigned short port;
+ unsigned int i;
+
+ pthread_mutex_lock(&rpcb_mutex);
+ p_ent = getprotobynumber(proto);
+ if (!p_ent)
+ goto done;
+ for (i = 0; rpcb_netnametbl[i] != NULL; i++) {
+ entry = getservbyname(rpcb_netnametbl[i], p_ent->p_name);
+ if (entry) {
+ port = entry->s_port;
+ pthread_mutex_unlock(&rpcb_mutex);
+ return port;
+ }
+ }
+done:
+ pthread_mutex_unlock(&rpcb_mutex);
+#endif
+ return (unsigned short) PMAPPORT;
+}
+
/*
* Create an RPC client
*/
@@ -510,9 +578,15 @@ int rpc_portmap_getclient(struct conn_in
info->host = host;
info->addr = addr;
info->addr_len = addr_len;
- info->program = PMAPPROG;
- info->port = PMAPPORT;
- info->version = PMAPVERS;
+ info->program = rpc_getrpcbyname(rpcb_prog);
+ info->port = ntohs(rpc_getrpcbport(proto));
+ /*
+ * When using libtirpc we might need to change the rpcbind version
+ * to qurey AF_INET addresses. Since we might not have an address
+ * yet set AF_INET rpcbind version in rpc_do_create_client() when
+ * we always have an address.
+ */
+ info->version = rpcb_version;
info->proto = proto;
info->send_sz = RPCSMALLMSGSIZE;
info->recv_sz = RPCSMALLMSGSIZE;
@@ -555,9 +629,15 @@ int rpc_portmap_getport(struct conn_info
pmap_info.host = info->host;
pmap_info.addr = info->addr;
pmap_info.addr_len = info->addr_len;
- pmap_info.port = PMAPPORT;
- pmap_info.program = PMAPPROG;
- pmap_info.version = PMAPVERS;
+ pmap_info.port = ntohs(rpc_getrpcbport(info->proto));
+ pmap_info.program = rpc_getrpcbyname(rpcb_prog);
+ /*
+ * When using libtirpc we might need to change the rpcbind
+ * version to qurey AF_INET addresses. Since we might not
+ * have an address yet set AF_INET rpcbind version in
+ * rpc_do_create_client() when we always have an address.
+ */
+ pmap_info.version = rpcb_version;
pmap_info.proto = info->proto;
pmap_info.send_sz = RPCSMALLMSGSIZE;
pmap_info.recv_sz = RPCSMALLMSGSIZE;

21
SOURCES/autofs-5.0.7-fix-possible-use-after-free-in-lookup_dir-lookup_init.patch

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
autofs-5.0.7 - fix possible use after free in lookup_dir.c:lookup_init()

From: Ian Kent <raven@themaw.net>

Add a missing error return in lookup_dir.c:lookup_init().
---
modules/lookup_dir.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/modules/lookup_dir.c b/modules/lookup_dir.c
index 07471b7..cbeda1f 100644
--- a/modules/lookup_dir.c
+++ b/modules/lookup_dir.c
@@ -98,6 +98,7 @@ int lookup_init(const char *mapfmt, int argc, const char *const *argv, void **co
free(ctxt);
warn(LOGOPT_NONE, MODPREFIX
"dir map %s, is not a directory", argv[0]);
+ return 1;
}
*context = ctxt;

157
SOURCES/autofs-5.0.7-fix-potential-null-dereference-in-lookup_mount.patch

@ -0,0 +1,157 @@ @@ -0,0 +1,157 @@
autofs-5.0.7 - fix potential null dereference in lookup_mount()

From: Ian Kent <raven@themaw.net>

Updating a negative cache entry should always find an entry but the entry
lookup return isn't checked and probably should be.

Since this code is duplicated in several modules add it as a function to
the cache handling code.
---
include/automount.h | 1 +
lib/cache.c | 20 ++++++++++++++++++++
modules/lookup_file.c | 11 +----------
modules/lookup_ldap.c | 12 +-----------
modules/lookup_sss.c | 12 +-----------
modules/lookup_yp.c | 12 ++----------
6 files changed, 26 insertions(+), 42 deletions(-)

diff --git a/include/automount.h b/include/automount.h
index 6ced842..71787a5 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -189,6 +189,7 @@ struct mapent *cache_lookup_offset(const char *prefix, const char *offset, int s
struct mapent *cache_partial_match(struct mapent_cache *mc, const char *prefix);
int cache_add(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age);
int cache_update_offset(struct mapent_cache *mc, const char *mkey, const char *key, const char *mapent, time_t age);
+void cache_update_negative(struct mapent_cache *mc, struct map_source *ms, const char *key, time_t timeout);
int cache_set_parents(struct mapent *mm);
int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age);
int cache_delete(struct mapent_cache *mc, const char *key);
diff --git a/lib/cache.c b/lib/cache.c
index ecace4a..be4917b 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -680,6 +680,26 @@ done:
return ret;
}
+void cache_update_negative(struct mapent_cache *mc,
+ struct map_source *ms, const char *key,
+ time_t timeout)
+{
+ time_t now = time(NULL);
+ struct mapent *me;
+ int rv = CHE_OK;
+
+ me = cache_lookup_distinct(mc, key);
+ if (!me)
+ rv = cache_update(mc, ms, key, NULL, now);
+ if (rv != CHE_FAIL) {
+ me = cache_lookup_distinct(mc, key);
+ if (me)
+ me->status = now + timeout;
+ }
+ return;
+}
+
+
static struct mapent *get_parent(const char *key, struct list_head *head, struct list_head **pos)
{
struct list_head *next;
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index 2836996..4b4ee89 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -1130,17 +1130,8 @@ do_cache_lookup:
ret = ctxt->parse->parse_mount(ap, key, key_len,
mapent, ctxt->parse->context);
if (ret) {
- time_t now = time(NULL);
- int rv = CHE_OK;
-
cache_writelock(mc);
- me = cache_lookup_distinct(mc, key);
- if (!me)
- rv = cache_update(mc, source, key, NULL, now);
- if (rv != CHE_FAIL) {
- me = cache_lookup_distinct(mc, key);
- me->status = now + ap->negative_timeout;
- }
+ cache_update_negative(mc, source, key, ap->negative_timeout);
cache_unlock(mc);
return NSS_STATUS_TRYAGAIN;
}
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index a59de92..26481a8 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -3011,18 +3011,8 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
ret = ctxt->parse->parse_mount(ap, key, key_len,
mapent, ctxt->parse->context);
if (ret) {
- time_t now = time(NULL);
- int rv = CHE_OK;
-
- /* Record the the mount fail in the cache */
cache_writelock(mc);
- me = cache_lookup_distinct(mc, key);
- if (!me)
- rv = cache_update(mc, source, key, NULL, now);
- if (rv != CHE_FAIL) {
- me = cache_lookup_distinct(mc, key);
- me->status = now + ap->negative_timeout;
- }
+ cache_update_negative(mc, source, key, ap->negative_timeout);
cache_unlock(mc);
return NSS_STATUS_TRYAGAIN;
}
diff --git a/modules/lookup_sss.c b/modules/lookup_sss.c
index 5c2ed0a..1fe740b 100644
--- a/modules/lookup_sss.c
+++ b/modules/lookup_sss.c
@@ -672,18 +672,8 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
ret = ctxt->parse->parse_mount(ap, key, key_len,
mapent, ctxt->parse->context);
if (ret) {
- time_t now = time(NULL);
- int rv = CHE_OK;
-
- /* Record the the mount fail in the cache */
cache_writelock(mc);
- me = cache_lookup_distinct(mc, key);
- if (!me)
- rv = cache_update(mc, source, key, NULL, now);
- if (rv != CHE_FAIL) {
- me = cache_lookup_distinct(mc, key);
- me->status = now + ap->negative_timeout;
- }
+ cache_update_negative(mc, source, key, ap->negative_timeout);
cache_unlock(mc);
return NSS_STATUS_TRYAGAIN;
}
diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
index a716e1f..e99e3c0 100644
--- a/modules/lookup_yp.c
+++ b/modules/lookup_yp.c
@@ -698,18 +698,10 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
ret = ctxt->parse->parse_mount(ap, key, key_len,
mapent, ctxt->parse->context);
if (ret) {
- time_t now = time(NULL);
- int rv = CHE_OK;
-
cache_writelock(mc);
- me = cache_lookup_distinct(mc, key);
- if (!me)
- rv = cache_update(mc, source, key, NULL, now);
- if (rv != CHE_FAIL) {
- me = cache_lookup_distinct(mc, key);
- me->status = now + ap->negative_timeout;
- }
+ cache_update_negative(mc, source, key, ap->negative_timeout);
cache_unlock(mc);
+ return NSS_STATUS_TRYAGAIN;
}
}

36
SOURCES/autofs-5.0.7-fix-probe-each-nfs-version-in-turn-for-singleton-mounts.patch

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
autofs-5.0.7 - fix probe each nfs version in turn for singleton mounts

From: Ian Kent <raven@themaw.net>

If there aren't any hosts in the list returned from parse_location() make sure
the probe checks are skipped.
---
CHANGELOG | 1 +
modules/mount_nfs.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 25179b1..0242c11 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -50,6 +50,7 @@
- fix fix map entry duplicate offset detection.
- probe each nfs version in turn for singleton mounts.
- add changlog entry for coverity fixes.
+- fix probe each nfs version in turn for singleton mounts.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index 81ba3ca..9de8a73 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -190,7 +190,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
* to NFSv3 (if it can). If the NFSv4 probe fails then probe as
* normal.
*/
- if (!hosts->next &&
+ if ((hosts && !hosts->next) &&
mount_default_proto == 4 &&
vers & NFS_VERS_MASK != 0 &&
vers & NFS4_VERS_MASK != 0) {

37
SOURCES/autofs-5.0.7-fix-requires-in-spec-file.patch

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
autofs-5.0.7 - fix requires in spec file

From: Ian Kent <raven@themaw.net>

Fix the use of depricated reqires in tar spec file.
---
CHANGELOG | 1 +
autofs.spec | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 247d334..e848bcd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -33,6 +33,7 @@
- fix file descriptor leak when reloading the daemon.
- depricate nosymlink pseudo option.
- add symlink pseudo option.
+- fix requires in spec file.
25/07/2012 autofs-5.0.7
=======================
diff --git a/autofs.spec b/autofs.spec
index b8a3b7a..703f7a9 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -25,8 +25,8 @@ Buildroot: %{_tmppath}/%{name}-tmp
%if %{with_systemd}
BuildRequires: systemd-units
%endif
-BuildPrereq: autoconf, hesiod-devel, openldap-devel, bison, flex, cyrus-sasl-devel
-Prereq: chkconfig
+BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, cyrus-sasl-devel
+Requires: chkconfig
Requires: /bin/bash mktemp sed textutils sh-utils grep /bin/ps
%if %{with_systemd}
Requires(post): systemd-sysv

128
SOURCES/autofs-5.0.7-fix-several-off-by-one-errors.patch

@ -0,0 +1,128 @@ @@ -0,0 +1,128 @@
autofs-5.0.7 - fix several off by one errors

From: Ian Kent <raven@themaw.net>

Fix several off-by-one array reference errors and a couple of short allocation
errors.
---
daemon/spawn.c | 10 +++++-----
lib/defaults.c | 2 +-
modules/lookup_ldap.c | 8 ++++----
modules/parse_hesiod.c | 2 +-
modules/parse_sun.c | 2 +-
5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/daemon/spawn.c b/daemon/spawn.c
index 3b4a009..9b8d5a2 100644
--- a/daemon/spawn.c
+++ b/daemon/spawn.c
@@ -320,7 +320,7 @@ int spawn_mount(unsigned logopt, ...)
unsigned int retries = MTAB_LOCK_RETRIES;
int update_mtab = 1, ret, printed = 0;
unsigned int wait = defaults_get_mount_wait();
- char buf[PATH_MAX];
+ char buf[PATH_MAX + 1];
/* If we use mount locking we can't validate the location */
#ifdef ENABLE_MOUNT_LOCKING
@@ -346,7 +346,7 @@ 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)))
+ if (!(argv = alloca(sizeof(char *) * (argc + 2))))
return -1;
argv[0] = arg0;
@@ -448,7 +448,7 @@ int spawn_bind_mount(unsigned logopt, ...)
unsigned int options;
unsigned int retries = MTAB_LOCK_RETRIES;
int update_mtab = 1, ret, printed = 0;
- char buf[PATH_MAX];
+ char buf[PATH_MAX + 1];
/* If we use mount locking we can't validate the location */
#ifdef ENABLE_MOUNT_LOCKING
@@ -477,7 +477,7 @@ int spawn_bind_mount(unsigned logopt, ...)
}
}
- if (!(argv = alloca(sizeof(char *) * argc + 2)))
+ if (!(argv = alloca(sizeof(char *) * (argc + 2))))
return -1;
argv[0] = arg0;
@@ -556,7 +556,7 @@ int spawn_umount(unsigned logopt, ...)
unsigned int retries = MTAB_LOCK_RETRIES;
int update_mtab = 1, ret, printed = 0;
unsigned int wait = defaults_get_umount_wait();
- char buf[PATH_MAX];
+ char buf[PATH_MAX + 1];
#ifdef ENABLE_MOUNT_LOCKING
options = SPAWN_OPT_LOCK;
diff --git a/lib/defaults.c b/lib/defaults.c
index ae1162f..1e89509 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -227,7 +227,7 @@ void defaults_free_uris(struct list_head *list)
static unsigned int add_uris(char *value, struct list_head *list)
{
char *str, *tok, *ptr = NULL;
- size_t len = strlen(value);
+ size_t len = strlen(value) + 1;
str = alloca(len);
if (!str)
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 83e3215..17cbe9a 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -2234,8 +2234,8 @@ static int do_get_entries(struct ldap_search_params *sp, struct map_source *sour
mapent = new_me;
strcat(mapent, " ");
strncat(mapent, v_val, v_len);
- mapent[new_size] = '\0';
- mapent_len = new_size;
+ mapent[new_size - 1] = '\0';
+ mapent_len = new_size - 1;
} else {
char *estr;
estr = strerror_r(errno, buf, sizeof(buf));
@@ -2723,8 +2723,8 @@ static int lookup_one(struct autofs_point *ap,
mapent = new_me;
strcat(mapent, " ");
strncat(mapent, v_val, v_len);
- mapent[new_size] = '\0';
- mapent_len = new_size;
+ mapent[new_size - 1] = '\0';
+ mapent_len = new_size - 1;
} else {
char *estr;
estr = strerror_r(errno, buf, sizeof(buf));
diff --git a/modules/parse_hesiod.c b/modules/parse_hesiod.c
index 7a6a57d..237fd50 100644
--- a/modules/parse_hesiod.c
+++ b/modules/parse_hesiod.c
@@ -117,7 +117,7 @@ static int parse_nfs(struct autofs_point *ap,
p++;
/* Isolate the remote mountpoint for this NFS fs. */
- for (i = 0; (!isspace(p[i]) && i < (int) sizeof(mount)); i++) {
+ for (i = 0; (!isspace(p[i]) && i < ((int) sizeof(mount) - 1)); i++) {
if (!p[i]) {
error(ap->logopt, MODPREFIX
"unexpeced end of input looking for NFS "
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index ae1caf7..c1fc528 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -1135,7 +1135,7 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
}
ro_len = strlen(ro_loc);
- tmp = alloca(mnt_root_len + 1);
+ tmp = alloca(mnt_root_len + 2);
strcpy(tmp, mnt_root);
tmp[mnt_root_len] = '/';
tmp[mnt_root_len + 1] = '\0';

45
SOURCES/autofs-5.0.7-fix-some-automount_8-typos.patch

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
autofs-5.0.7 - fix some automount(8) typos

From: Ian Kent <raven@themaw.net>

Fix a couple of spelling errors in the automount(8) man page
that have been around for a long time.
---
CHANGELOG | 1 +
man/automount.8 | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index d8e4049..488ad1e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -37,6 +37,7 @@
- fix libtirpc build option to require libtirpc-devel if needed.
- fix systemd unidir in spec file.
- document browse option in man page.
+- fix some automount(8) typos.
25/07/2012 autofs-5.0.7
=======================
diff --git a/man/automount.8 b/man/automount.8
index dddebce..7cc32c5 100644
--- a/man/automount.8
+++ b/man/automount.8
@@ -43,7 +43,7 @@ autofs managed mounts.
.TP
.I "\-d, \-\-debug"
Enables logging of general status and progress messages as well as
-debuging messages for all autofs managed mounts.
+debugging messages for all autofs managed mounts.
.TP
.I "\-Dvariable=value"
Define a global macro substitution variable. Global definitions
@@ -133,7 +133,7 @@ unused. If the force umount at exit option is used the filesystems
will be umounted but the mount will not be released by the kernel
until they are no longer in use by the processes that held them busy.
If automount managed filesystems are found mounted when autofs is
-started they will be recoverd unless they are no longer present in
+started they will be recovered unless they are no longer present in
the map in which case they need to umounted manually.
.P
If the option to disable the check to see if the daemon is already

23
SOURCES/autofs-5.0.7-fix-spawn_umount-return-check-in-mount_bind-lookup_init.patch

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
autofs-5.0.7 - fix spawn_umount() return check in mount_bind.c:lookup_init()

From: Ian Kent <raven@themaw.net>

Check return of spawn_umount() and report it if it fails.
---
modules/mount_bind.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/mount_bind.c b/modules/mount_bind.c
index 4975294..d6c6fe7 100644
--- a/modules/mount_bind.c
+++ b/modules/mount_bind.c
@@ -57,7 +57,8 @@ int mount_init(void **context)
bind_works = 1;
}
- spawn_umount(LOGOPT_NONE, "-n", t2_dir, NULL);
+ if (spawn_umount(LOGOPT_NONE, "-n", t2_dir, NULL) != 0)
+ debug(LOGOPT_ANY, MODPREFIX "umount failed for %s", t2_dir);
out:
rmdir(t1_dir);

45
SOURCES/autofs-5.0.7-fix-submount-offset-delete.patch

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
autofs-5.0.7 - fix submount offset delete

From: Ian Kent <ikent@redhat.com>

As part of the implementation to allow for limited update of
the internal hosts map by using a HUP signal some code that
deleted any offset entries from the cache on lookup was removed
as it appeared to not be needed.

There is however a case where it is needed to avoid a duplicate
cache entry failure on lookup.
---

CHANGELOG | 1 +
daemon/automount.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 7eb7235..76c1f73 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -18,6 +18,7 @@
- fix map entry duplicate offset detection.
- Allow nsswitch.conf to not contain "automount:" lines.
- fix nobind man page description.
+- fix submount offset delete.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/automount.c b/daemon/automount.c
index e56f9e1..4a3eb3d 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -544,8 +544,8 @@ int umount_multi(struct autofs_point *ap, const char *path, int incl)
* If we are a submount we need to umount any offsets our
* parent may have mounted over top of us.
*/
- /*if (ap->submount)
- left += umount_subtree_mounts(ap->parent, path, is_autofs_fs);*/
+ if (ap->submount)
+ left += umount_subtree_mounts(ap->parent, path, is_autofs_fs);
left += umount_subtree_mounts(ap, path, is_autofs_fs);

70
SOURCES/autofs-5.0.7-fix-submount-tree-not-all-expiring.patch

@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
autofs-5.0.7 - fix submount tree not all expiring

From: Ian Kent <ikent@redhat.com>

Due to the change in the expire-specific-submount-only patch, sub-mounts
within an indirect mount that follow a submount (in the check order) won't
be expired if that submount is busy.
---
CHANGELOG | 1 +
lib/master.c | 24 +++++++++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index f1ec1e5..4106e7f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -39,6 +39,7 @@
- document browse option in man page.
- fix some automount(8) typos.
- syncronize handle_mounts() shutdown.
+- fix submount tree not all expiring.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/master.c b/lib/master.c
index a0e62f2..64dbcb1 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -905,15 +905,24 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
this = list_entry(p, struct autofs_point, mounts);
p = p->prev;
- if (!master_submount_list_empty(this)) {
- mounts_mutex_unlock(ap);
- return master_notify_submount(this, path, state);
- }
-
/* path not the same */
if (strcmp(this->path, path))
continue;
+ if (!master_submount_list_empty(this)) {
+ char *this_path = strdup(this->path);
+ if (this_path) {
+ mounts_mutex_unlock(ap);
+ master_notify_submount(this, path, state);
+ mounts_mutex_lock(ap);
+ if (!__master_find_submount(ap, this_path)) {
+ free(this_path);
+ continue;
+ }
+ free(this_path);
+ }
+ }
+
/* Now we have found the submount we want to expire */
st_mutex_lock();
@@ -959,10 +968,7 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
st_mutex_lock();
}
st_mutex_unlock();
- mounts_mutex_unlock(ap);
-
- return ret;
-
+ break;
}
mounts_mutex_unlock(ap);

36
SOURCES/autofs-5.0.7-fix-syncronize-handle_mounts-shutdown.patch

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
autofs-5.0.7 - fix syncronize handle_mounts() shutdown

From: Ian Kent <raven@themaw.net>

A recent change to fix a problem where automount would exit when re-reading
the master map if more than on entry had been removed causes automount to
ignore HUP signals if the mount list is empty.

Removing that check and testing shows that the remainder of the change still
fixes the original problem.
---
CHANGELOG | 1 +
daemon/automount.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -56,6 +56,7 @@
- don't override LDFLAGS in make rules.
- fix a couple of compiler warnings.
- add after sssd dependency to unit file.
+- fix syncronize handle_mounts() shutdown.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/daemon/automount.c
+++ autofs-5.0.7/daemon/automount.c
@@ -1286,7 +1286,7 @@ static int do_hup_signal(struct master *
master_mutex_lock();
/* Already doing a map read or shutdown or no mounts */
- if (master->reading || list_empty(&master->mounts)) {
+ if (master->reading) {
status = pthread_mutex_unlock(&mrc.mutex);
if (status)
fatal(status);

72
SOURCES/autofs-5.0.7-fix-systemd-unidir-in-spec-file.patch

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
autofs-5.0.7 - fix systemd unidir in spec file

From: Ian Kent <raven@themaw.net>


---
CHANGELOG | 1 +
autofs.spec | 16 ++++++++--------
2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index b6b2679..ecdea0b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -35,6 +35,7 @@
- add symlink pseudo option.
- fix requires in spec file.
- fix libtirpc build option to require libtirpc-devel if needed.
+- fix systemd unidir in spec file.
25/07/2012 autofs-5.0.7
=======================
diff --git a/autofs.spec b/autofs.spec
index f77acc1..a768e44 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -76,7 +76,7 @@ inkludera n
%setup -q
echo %{version}-%{release} > .version
%if %{with_systemd}
- %define _unitdir %{?_unitdir:/lib/systemd/system}
+ %define unitdir %{?_unitdir:/lib/systemd/system}
%define systemd_configure_arg --with-systemd
%endif
%if %{with_libtirpc}
@@ -95,7 +95,7 @@ CFLAGS="$RPM_OPT_FLAGS -Wall" make initdir=/etc/rc.d/init.d DONTSTRIP=1
%install
rm -rf $RPM_BUILD_ROOT
%if %{with_systemd}
-install -d -m 755 $RPM_BUILD_ROOT%{_unitdir}
+install -d -m 755 $RPM_BUILD_ROOT%{unitdir}
%else
mkdir -p -m755 $RPM_BUILD_ROOT/etc/rc.d/init.d
%endif
@@ -109,9 +109,13 @@ make install mandir=%{_mandir} initdir=/etc/rc.d/init.d INSTALLROOT=$RPM_BUILD_R
echo make -C redhat
make -C redhat
%if %{with_systemd}
-install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{_unitdir}/autofs.service
+# 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/etc/rc.d/init.d/autofs
+%define init_file_name /etc/rc.d/init.d/autofs
%endif
install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs
@@ -170,11 +174,7 @@ fi
%files
%defattr(-,root,root)
%doc CREDITS CHANGELOG INSTALL COPY* README* samples/ldap* samples/autofs.schema samples/autofs_ldap_auth.conf
-%if %{with_systemd}
-%{_unitdir}/autofs.service
-%else
-%config /etc/rc.d/init.d/autofs
-%endif
+%config %{init_file_name}
%config(noreplace) /etc/auto.master
%config(noreplace,missingok) /etc/auto.misc
%config(noreplace,missingok) /etc/auto.net

33
SOURCES/autofs-5.0.7-fix-typo-in-automount-8.patch

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
autofs-5.0.7 - fix typo in automount(8)

From: Ian Kent <ikent@redhat.com>


---

CHANGELOG | 1 +
man/automount.8 | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)


--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -4,6 +4,7 @@
- fix use cache entry after free in lookup_prune_one_cache().
- fix ipv6 proximity calculation.
- fix parse buffer initialization.
+- fix typo in automount(8).
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/man/automount.8
+++ autofs-5.0.7/man/automount.8
@@ -51,7 +51,7 @@ are over-ridden macro definitions of the
mount entries.
.TP
.I "\-f, \-\-foreground"
-Run the daemon in the forground and log to stderr instead of syslog."
+Run the daemon in the foreground and log to stderr instead of syslog."
.TP
.I "\-r, \-\-random-multimount-selection"
Enables the use of ramdom selection when choosing a host from a

49
SOURCES/autofs-5.0.7-fix-use-cache-entry-after-free-mistake.patch

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
autofs-5.0.7 - fix use cache entry after free mistake

From: Ian Kent <ikent@redhat.com>

Fix an obvious use after free mistake in lookup_prune_one_cache().
---

CHANGELOG | 1 +
daemon/lookup.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index faf4c80..dc38580 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
??/??/2012 autofs-5.0.8
=======================
- fix nobind sun escaped map entries.
+- fix use cache entry after free in lookup_prune_one_cache().
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 7909536..e3d9536 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -1103,15 +1103,18 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
if (valid)
cache_delete(mc, key);
else if (!is_mounted(_PROC_MOUNTS, path, MNTS_AUTOFS)) {
+ dev_t devid = ap->dev;
status = CHE_FAIL;
+ if (ap->type == LKP_DIRECT)
+ devid = this->dev;
if (this->ioctlfd == -1)
status = cache_delete(mc, key);
if (status != CHE_FAIL) {
if (ap->type == LKP_INDIRECT) {
if (ap->flags & MOUNT_FLAG_GHOST)
- rmdir_path(ap, path, ap->dev);
+ rmdir_path(ap, path, devid);
} else
- rmdir_path(ap, path, this->dev);
+ rmdir_path(ap, path, devid);
}
}
cache_unlock(mc);

54
SOURCES/autofs-5.0.7-fix-use-get_proximity-without-libtirpc.patch

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
autofs-5.0.7 - fix use get_proximity() without libtirpc

From: Ian Kent <raven@themaw.net>

If autofs is not using libtirpc and there are any configured IPv6
interfaces then get_proximity() will fail with PROXIMITY_UNSUPPORTED.

In this case when checking interfaces the IPv6 interfaces need to be
ignored.
---

CHANGELOG | 1 +
modules/replicated.c | 8 ++------
2 files changed, 3 insertions(+), 6 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 5bcb1af..460bd27 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -20,6 +20,7 @@
- fix nobind man page description.
- fix submount offset delete.
- fix init script status return.
+- fix use get_proximity() without libtirpc.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/replicated.c b/modules/replicated.c
index bd6003b..6b96320 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -184,9 +184,7 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
break;
case AF_INET6:
-#ifndef WITH_LIBTIRPC
- return PROXIMITY_UNSUPPORTED;
-#else
+#ifdef WITH_LIBTIRPC
if (host_addr->sa_family == AF_INET)
break;
if6_addr = (struct sockaddr_in6 *) this->ifa_addr;
@@ -251,9 +249,7 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
break;
case AF_INET6:
-#ifndef WITH_LIBTIRPC
- return PROXIMITY_UNSUPPORTED;
-#else
+#ifdef WITH_LIBTIRPC
if (host_addr->sa_family == AF_INET)
break;
if6_addr = (struct sockaddr_in6 *) this->ifa_addr;

225
SOURCES/autofs-5.0.7-fix-wildcard-multi-map-regression.patch

@ -0,0 +1,225 @@ @@ -0,0 +1,225 @@
autofs-5.0.7 - fix wildcard multi map regression

From: Ian Kent <raven@themaw.net>

A recent patch that removed code to add the current map entry when
being parsed if it didn't already exist cause wildcard indirect
multi-mount map entries to fail to mount.

Indirect multi-mount map entries need the entry matched by a wildcard
lookup to be added to the map entry cache because subsequent operations
expect a distinct map entry to be present or they will fail. This is
what the code that was removed did but it did so in the wrong place
which caused a deadlock situation.
---
CHANGELOG | 1 +
modules/lookup_file.c | 23 ++++++++++++++++-------
modules/lookup_ldap.c | 19 +++++++++++++++----
modules/lookup_nisplus.c | 21 ++++++++++++++++-----
modules/lookup_sss.c | 17 ++++++++++++++---
modules/lookup_yp.c | 21 ++++++++++++++++-----
6 files changed, 78 insertions(+), 24 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 97d6f48..46ef335 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -29,6 +29,7 @@
- modules/replicated.c: use sin6_addr.s6_addr32.
- workaround missing GNU versionsort extension.
- dont fail on master map self include.
+- fix wildcard multi map regression.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index f37bed9..65e5ee6 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -1040,7 +1040,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
return NSS_STATUS_UNAVAIL;
}
- cache_readlock(mc);
+ cache_writelock(mc);
me = cache_lookup_first(mc);
if (me && st.st_mtime <= me->age) {
/*
@@ -1082,7 +1082,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
}
}
- cache_readlock(mc);
+ cache_writelock(mc);
do_cache_lookup:
me = cache_lookup(mc, key);
/*
@@ -1098,11 +1098,20 @@ do_cache_lookup:
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- pthread_cleanup_push(cache_lock_cleanup, mc);
- strcpy(mapent_buf, me->mapent);
- mapent = mapent_buf;
- pthread_cleanup_pop(0);
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ strcpy(mapent_buf, me->mapent);
+ mapent = mapent_buf;
+ }
}
cache_unlock(mc);
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 431e50d..83e3215 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -2969,7 +2969,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
return status;
}
- cache_readlock(mc);
+ cache_writelock(mc);
me = cache_lookup(mc, key);
/* Stale mapent => check for entry in alternate source or wildcard */
if (me && !me->mapent) {
@@ -2979,9 +2979,20 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- strcpy(mapent_buf, me->mapent);
- mapent = mapent_buf;
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ strcpy(mapent_buf, me->mapent);
+ mapent = mapent_buf;
+ }
}
cache_unlock(mc);
diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
index 9fced96..8237a1e 100644
--- a/modules/lookup_nisplus.c
+++ b/modules/lookup_nisplus.c
@@ -561,7 +561,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
return status;
}
- cache_readlock(mc);
+ cache_writelock(mc);
me = cache_lookup(mc, key);
/* Stale mapent => check for entry in alternate source or wildcard */
if (me && !me->mapent) {
@@ -571,10 +571,21 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- mapent_len = strlen(me->mapent);
- mapent = malloc(mapent_len + 1);
- strcpy(mapent, me->mapent);
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ mapent_len = strlen(me->mapent);
+ mapent = malloc(mapent_len + 1);
+ strcpy(mapent, me->mapent);
+ }
}
cache_unlock(mc);
diff --git a/modules/lookup_sss.c b/modules/lookup_sss.c
index e0b84cc..5c2ed0a 100644
--- a/modules/lookup_sss.c
+++ b/modules/lookup_sss.c
@@ -645,9 +645,20 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- strcpy(mapent_buf, me->mapent);
- mapent = mapent_buf;
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ strcpy(mapent_buf, me->mapent);
+ mapent = mapent_buf;
+ }
}
cache_unlock(mc);
diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
index 720df2e..a716e1f 100644
--- a/modules/lookup_yp.c
+++ b/modules/lookup_yp.c
@@ -662,7 +662,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
return status;
}
- cache_readlock(mc);
+ cache_writelock(mc);
me = cache_lookup(mc, key);
/* Stale mapent => check for entry in alternate source or wildcard */
if (me && !me->mapent) {
@@ -672,10 +672,21 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- mapent_len = strlen(me->mapent);
- mapent = alloca(mapent_len + 1);
- strcpy(mapent, me->mapent);
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ mapent_len = strlen(me->mapent);
+ mapent = alloca(mapent_len + 1);
+ strcpy(mapent, me->mapent);
+ }
}
cache_unlock(mc);

57
SOURCES/autofs-5.0.7-handle-new-location-of-systemd.patch

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
autofs-5.0.7 - Handle new location of systemd

From: Frederic Crozat <fcrozat@suse.com>

Some distributions are moving systemd unit files from /lib to
/usr/lib, so we need to test both directories.

edit: imk
It occurs to me I've forgotten to check for the 64 bit variants
of the directories, so add them as well.
end edit: imk
---

CHANGELOG | 1 +
aclocal.m4 | 2 +-
configure | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 3bdf8a4..8f6bb3a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,7 @@
- allow non root user to check status.
- fix recursive mount deadlock.
- increase file map read buffer size.
+- handle new location of systemd.
25/07/2012 autofs-5.0.7
=======================
diff --git a/aclocal.m4 b/aclocal.m4
index 1798c8b..47bca0c 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -234,7 +234,7 @@ AC_DEFUN([AF_WITH_SYSTEMD],
[if test "$withval" = yes; then
if test -z "$systemddir"; then
AC_MSG_CHECKING([location of the systemd unit files directory])
- for systemd_d in /lib/systemd/system; do
+ 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"
diff --git a/configure b/configure
index ba3bba6..3722a46 100755
--- a/configure
+++ b/configure
@@ -2157,7 +2157,7 @@ if test "${with_systemd+set}" = set; 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 /lib/systemd/system; do
+ 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"

84
SOURCES/autofs-5.0.7-improve-timeout-option-description.patch

@ -0,0 +1,84 @@ @@ -0,0 +1,84 @@
autofs-5.0.7 - improve timeout option description

From: Ian Kent <raven@themaw.net>

The description of the configuration option is a little misleading.
So add some explaination about the internal default and the reason
the default installed configuration overrides it.
---
CHANGELOG | 1 +
man/auto.master.5.in | 5 ++++-
man/automount.8 | 5 ++++-
redhat/autofs.sysconfig.in | 5 ++++-
samples/autofs.conf.default.in | 5 ++++-
5 files changed, 17 insertions(+), 4 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -65,6 +65,7 @@
- fix portmap lookup.
- only probe specific nfs version if requested.
- fix ipv6 libtirpc getport.
+- improve timeout option description.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/man/auto.master.5.in
+++ autofs-5.0.7/man/auto.master.5.in
@@ -212,7 +212,10 @@ configuration file
They are:
.TP
.B TIMEOUT
-sets the default mount timeout (program default 600).
+Sets the default mount timeout in seconds. The internal program
+default is 10 minutes, but the default installed configuration
+overrides this and sets the timeout to 5 minutes to be consistent
+with earlier autofs releases.
.TP
.B NEGATIVE_TIMEOUT
Set the default timeout for caching failed key lookups (program default
--- autofs-5.0.7.orig/man/automount.8
+++ autofs-5.0.7/man/automount.8
@@ -29,10 +29,13 @@ Print brief help on program usage.
.I "\-p, \-\-pid-file"
Write the pid of the daemon to the specified file.
.TP
-.I "\-t, \-\-timeout"
+.I "\-t <seconds>, \-\-timeout <seconds>"
Set the global minimum timeout, in seconds, until directories
are unmounted. The default is 10 minutes. Setting the timeout
to zero disables umounts completely.
+The internal program default is 10 minutes, but the default
+installed configuration overrides this and sets the timeout
+to 5 minutes to be consistent with earlier autofs releases.
.TP
.I "\-n <seconds>, \-\-negative\-timeout <seconds>"
Set the default timeout for caching failed key lookups. The default is 60 seconds.
--- autofs-5.0.7.orig/redhat/autofs.sysconfig.in
+++ autofs-5.0.7/redhat/autofs.sysconfig.in
@@ -5,7 +5,10 @@
#
#MASTER_MAP_NAME="auto.master"
#
-# TIMEOUT - set the default mount timeout (default 600).
+# TIMEOUT - set the default mount timeout in secons. The internal
+# program default is 10 minutes, but the default installed
+# configuration overrides this and sets the timeout to 5
+# minutes to be consistent with earlier autofs releases.
#
TIMEOUT=300
#
--- autofs-5.0.7.orig/samples/autofs.conf.default.in
+++ autofs-5.0.7/samples/autofs.conf.default.in
@@ -5,7 +5,10 @@
#
#MASTER_MAP_NAME="auto.master"
#
-# TIMEOUT - set the default mount timeout (default 600).
+# TIMEOUT - set the default mount timeout in secons. The internal
+# program default is 10 minutes, but the default installed
+# configuration overrides this and sets the timeout to 5
+# minutes to be consistent with earlier autofs releases.
#
TIMEOUT=300
#

25
SOURCES/autofs-5.0.7-include-usage-in-usage-message.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
autofs-5.0.7 - include usage in usage message

From: Ian Kent <ikent@redhat.com>

Since usage is a case entry we should also nclude it in the usage
message.
---

redhat/autofs.init.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
index 8e355da..ec6d5d6 100644
--- a/redhat/autofs.init.in
+++ b/redhat/autofs.init.in
@@ -155,7 +155,7 @@ function reload() {
}
function usage_message() {
- echo $"Usage: $0 {start|forcestart|stop|status|restart|force-reload|forcerestart|reload|condrestart|try-restart}"
+ echo $"Usage: $0 {start|forcestart|stop|status|restart|force-reload|forcerestart|reload|condrestart|try-restart|usage}"
}
RETVAL=0

448
SOURCES/autofs-5.0.7-lib-defaults-use-WITH_LDAP-conditional-around-LDAP-types.patch

@ -0,0 +1,448 @@ @@ -0,0 +1,448 @@
autofs-5.0.7 - lib/defaults.c: use WITH_LDAP conditional around LDAP types

From: Chris Packham <chris.packham@alliedtelesis.co.nz>

Wrap the inclusion of lookup_ldap.h and functions that use ldap_uri or
ldap_schema with the WITH_LDAP conditional. WITH_LDAP is set by the
configure step when LDAP support is not desired. This also allows
compilation on a system that doesn't have any LDAP libraries.
---

CHANGELOG | 1
include/defaults.h | 14 +-
include/lookup_ldap.h | 1
lib/defaults.c | 325 +++++++++++++++++++++++++------------------------
modules/lookup_ldap.c | 1
5 files changed, 175 insertions(+), 167 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index ba1d65b..1130db6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -24,6 +24,7 @@
- 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.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/defaults.h b/include/defaults.h
index cda2174..871e14b 100644
--- a/include/defaults.h
+++ b/include/defaults.h
@@ -44,8 +44,16 @@
#define DEFAULT_MAP_HASH_TABLE_SIZE 1024
+#ifdef WITH_LDAP
struct ldap_schema;
struct ldap_searchdn;
+void defaults_free_uris(struct list_head *);
+struct list_head *defaults_get_uris(void);
+struct ldap_schema *defaults_get_default_schema(void);
+void defaults_free_searchdns(struct ldap_searchdn *);
+struct ldap_searchdn *defaults_get_searchdns(void);
+struct ldap_schema *defaults_get_schema(void);
+#endif
unsigned int defaults_read_config(unsigned int);
const char *defaults_get_master_map(void);
@@ -57,12 +65,6 @@ unsigned int defaults_get_logging(void);
const char *defaults_get_ldap_server(void);
unsigned int defaults_get_ldap_timeout(void);
unsigned int defaults_get_ldap_network_timeout(void);
-struct list_head *defaults_get_uris(void);
-void defaults_free_uris(struct list_head *);
-struct ldap_schema *defaults_get_default_schema(void);
-struct ldap_schema *defaults_get_schema(void);
-struct ldap_searchdn *defaults_get_searchdns(void);
-void defaults_free_searchdns(struct ldap_searchdn *);
unsigned int defaults_get_mount_nfs_default_proto(void);
unsigned int defaults_get_append_options(void);
unsigned int defaults_get_mount_wait(void);
diff --git a/include/lookup_ldap.h b/include/lookup_ldap.h
index e441a61..9a4ce73 100644
--- a/include/lookup_ldap.h
+++ b/include/lookup_ldap.h
@@ -8,7 +8,6 @@
#include <openssl/evp.h>
#include <openssl/err.h>
#include <sasl/sasl.h>
-#include <libxml/tree.h>
#include <krb5.h>
#endif
diff --git a/lib/defaults.c b/lib/defaults.c
index 5ce71b7..ae1162f 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -17,9 +17,12 @@
#include <ctype.h>
#include <string.h>
+#include "config.h"
#include "list.h"
#include "defaults.h"
+#ifdef WITH_LDAP
#include "lookup_ldap.h"
+#endif
#include "log.h"
#include "automount.h"
@@ -197,6 +200,7 @@ static int parse_line(char *line, char **res, char **value)
return 1;
}
+#ifdef WITH_LDAP
void defaults_free_uris(struct list_head *list)
{
struct list_head *next;
@@ -290,166 +294,6 @@ struct list_head *defaults_get_uris(void)
return list;
}
-/*
- * Read config env variables and check they have been set.
- *
- * This simple minded routine assumes the config file
- * is valid bourne shell script without spaces around "="
- * and that it has valid values.
- */
-unsigned int defaults_read_config(unsigned int to_syslog)
-{
- FILE *f;
- char buf[MAX_LINE_LEN];
- char *res;
-
- f = open_fopen_r(DEFAULTS_CONFIG_FILE);
- if (!f)
- return 0;
-
- while ((res = fgets(buf, MAX_LINE_LEN, f))) {
- char *key, *value;
-
- if (!parse_line(res, &key, &value))
- continue;
-
- if (check_set_config_value(key, ENV_NAME_MASTER_MAP, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_TIMEOUT, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_NEGATIVE_TIMEOUT, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_BROWSE_MODE, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_LOGGING, value, to_syslog) ||
- check_set_config_value(key, ENV_LDAP_TIMEOUT, value, to_syslog) ||
- check_set_config_value(key, ENV_LDAP_NETWORK_TIMEOUT, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_MAP_OBJ_CLASS, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_ENTRY_OBJ_CLASS, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_MAP_ATTR, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_ENTRY_ATTR, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_VALUE_ATTR, value, to_syslog) ||
- check_set_config_value(key, ENV_APPEND_OPTIONS, value, to_syslog) ||
- check_set_config_value(key, ENV_MOUNT_WAIT, value, to_syslog) ||
- check_set_config_value(key, ENV_UMOUNT_WAIT, value, to_syslog) ||
- check_set_config_value(key, ENV_AUTH_CONF_FILE, value, to_syslog) ||
- check_set_config_value(key, ENV_MAP_HASH_TABLE_SIZE, value, to_syslog) ||
- check_set_config_value(key, ENV_MOUNT_NFS_DEFAULT_PROTOCOL, value, to_syslog))
- ;
- }
-
- if (!feof(f) || ferror(f)) {
- if (!to_syslog) {
- fprintf(stderr,
- "fgets returned error %d while reading %s\n",
- ferror(f), DEFAULTS_CONFIG_FILE);
- } else {
- logmsg("fgets returned error %d while reading %s",
- ferror(f), DEFAULTS_CONFIG_FILE);
- }
- fclose(f);
- return 0;
- }
-
- fclose(f);
- return 1;
-}
-
-const char *defaults_get_master_map(void)
-{
- char *master;
-
- master = get_env_string(ENV_NAME_MASTER_MAP);
- if (!master)
- return strdup(default_master_map_name);
-
- return (const char *) master;
-}
-
-int defaults_master_set(void)
-{
- char *val = getenv(ENV_NAME_MASTER_MAP);
- if (!val)
- return 0;
-
- return 1;
-}
-
-unsigned int defaults_get_timeout(void)
-{
- long timeout;
-
- timeout = get_env_number(ENV_NAME_TIMEOUT);
- if (timeout < 0)
- timeout = DEFAULT_TIMEOUT;
-
- return (unsigned int) timeout;
-}
-
-unsigned int defaults_get_negative_timeout(void)
-{
- long n_timeout;
-
- n_timeout = get_env_number(ENV_NAME_NEGATIVE_TIMEOUT);
- if (n_timeout <= 0)
- n_timeout = DEFAULT_NEGATIVE_TIMEOUT;
-
- return (unsigned int) n_timeout;
-}
-
-unsigned int defaults_get_browse_mode(void)
-{
- int res;
-
- res = get_env_yesno(ENV_NAME_BROWSE_MODE);
- if (res < 0)
- res = DEFAULT_BROWSE_MODE;
-
- return res;
-}
-
-unsigned int defaults_get_logging(void)
-{
- char *res;
- unsigned int logging = DEFAULT_LOGGING;
-
- res = get_env_string(ENV_NAME_LOGGING);
- if (!res)
- return logging;
-
- if (!strcasecmp(res, "none"))
- logging = DEFAULT_LOGGING;
- else {
- if (!strcasecmp(res, "verbose"))
- logging |= LOGOPT_VERBOSE;
-
- if (!strcasecmp(res, "debug"))
- logging |= LOGOPT_DEBUG;
- }
-
- free(res);
-
- return logging;
-}
-
-unsigned int defaults_get_ldap_timeout(void)
-{
- int res;
-
- res = get_env_number(ENV_LDAP_TIMEOUT);
- if (res < 0)
- res = DEFAULT_LDAP_TIMEOUT;
-
- return res;
-}
-
-unsigned int defaults_get_ldap_network_timeout(void)
-{
- int res;
-
- res = get_env_number(ENV_LDAP_NETWORK_TIMEOUT);
- if (res < 0)
- res = DEFAULT_LDAP_NETWORK_TIMEOUT;
-
- return res;
-}
-
struct ldap_schema *defaults_get_default_schema(void)
{
struct ldap_schema *schema;
@@ -645,6 +489,167 @@ struct ldap_schema *defaults_get_schema(void)
return schema;
}
+#endif
+
+/*
+ * Read config env variables and check they have been set.
+ *
+ * This simple minded routine assumes the config file
+ * is valid bourne shell script without spaces around "="
+ * and that it has valid values.
+ */
+unsigned int defaults_read_config(unsigned int to_syslog)
+{
+ FILE *f;
+ char buf[MAX_LINE_LEN];
+ char *res;
+
+ f = open_fopen_r(DEFAULTS_CONFIG_FILE);
+ if (!f)
+ return 0;
+
+ while ((res = fgets(buf, MAX_LINE_LEN, f))) {
+ char *key, *value;
+
+ if (!parse_line(res, &key, &value))
+ continue;
+
+ if (check_set_config_value(key, ENV_NAME_MASTER_MAP, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_TIMEOUT, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_NEGATIVE_TIMEOUT, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_BROWSE_MODE, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_LOGGING, value, to_syslog) ||
+ check_set_config_value(key, ENV_LDAP_TIMEOUT, value, to_syslog) ||
+ check_set_config_value(key, ENV_LDAP_NETWORK_TIMEOUT, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_MAP_OBJ_CLASS, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_ENTRY_OBJ_CLASS, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_MAP_ATTR, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_ENTRY_ATTR, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_VALUE_ATTR, value, to_syslog) ||
+ check_set_config_value(key, ENV_APPEND_OPTIONS, value, to_syslog) ||
+ check_set_config_value(key, ENV_MOUNT_WAIT, value, to_syslog) ||
+ check_set_config_value(key, ENV_UMOUNT_WAIT, value, to_syslog) ||
+ check_set_config_value(key, ENV_AUTH_CONF_FILE, value, to_syslog) ||
+ check_set_config_value(key, ENV_MAP_HASH_TABLE_SIZE, value, to_syslog) ||
+ check_set_config_value(key, ENV_MOUNT_NFS_DEFAULT_PROTOCOL, value, to_syslog))
+ ;
+ }
+
+ if (!feof(f) || ferror(f)) {
+ if (!to_syslog) {
+ fprintf(stderr,
+ "fgets returned error %d while reading %s\n",
+ ferror(f), DEFAULTS_CONFIG_FILE);
+ } else {
+ logmsg("fgets returned error %d while reading %s",
+ ferror(f), DEFAULTS_CONFIG_FILE);
+ }
+ fclose(f);
+ return 0;
+ }
+
+ fclose(f);
+ return 1;
+}
+
+const char *defaults_get_master_map(void)
+{
+ char *master;
+
+ master = get_env_string(ENV_NAME_MASTER_MAP);
+ if (!master)
+ return strdup(default_master_map_name);
+
+ return (const char *) master;
+}
+
+int defaults_master_set(void)
+{
+ char *val = getenv(ENV_NAME_MASTER_MAP);
+ if (!val)
+ return 0;
+
+ return 1;
+}
+
+unsigned int defaults_get_timeout(void)
+{
+ long timeout;
+
+ timeout = get_env_number(ENV_NAME_TIMEOUT);
+ if (timeout < 0)
+ timeout = DEFAULT_TIMEOUT;
+
+ return (unsigned int) timeout;
+}
+
+unsigned int defaults_get_negative_timeout(void)
+{
+ long n_timeout;
+
+ n_timeout = get_env_number(ENV_NAME_NEGATIVE_TIMEOUT);
+ if (n_timeout <= 0)
+ n_timeout = DEFAULT_NEGATIVE_TIMEOUT;
+
+ return (unsigned int) n_timeout;
+}
+
+unsigned int defaults_get_browse_mode(void)
+{
+ int res;
+
+ res = get_env_yesno(ENV_NAME_BROWSE_MODE);
+ if (res < 0)
+ res = DEFAULT_BROWSE_MODE;
+
+ return res;
+}
+
+unsigned int defaults_get_logging(void)
+{
+ char *res;
+ unsigned int logging = DEFAULT_LOGGING;
+
+ res = get_env_string(ENV_NAME_LOGGING);
+ if (!res)
+ return logging;
+
+ if (!strcasecmp(res, "none"))
+ logging = DEFAULT_LOGGING;
+ else {
+ if (!strcasecmp(res, "verbose"))
+ logging |= LOGOPT_VERBOSE;
+
+ if (!strcasecmp(res, "debug"))
+ logging |= LOGOPT_DEBUG;
+ }
+
+ free(res);
+
+ return logging;
+}
+
+unsigned int defaults_get_ldap_timeout(void)
+{
+ int res;
+
+ res = get_env_number(ENV_LDAP_TIMEOUT);
+ if (res < 0)
+ res = DEFAULT_LDAP_TIMEOUT;
+
+ return res;
+}
+
+unsigned int defaults_get_ldap_network_timeout(void)
+{
+ int res;
+
+ res = get_env_number(ENV_LDAP_NETWORK_TIMEOUT);
+ if (res < 0)
+ res = DEFAULT_LDAP_NETWORK_TIMEOUT;
+
+ return res;
+}
unsigned int defaults_get_mount_nfs_default_proto(void)
{
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 3bc4dc5..431e50d 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -28,6 +28,7 @@
#include <arpa/nameser.h>
#include <resolv.h>
#include <lber.h>
+#include <libxml/tree.h>
#define MODULE_LOOKUP
#include "automount.h"

57
SOURCES/autofs-5.0.7-make-description-of-default-MOUNT_WAIT-setting-clear.patch

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
autofs-5.0.7 - make description of default MOUNT_WAIT setting clear

From: Ian Kent <ikent@redhat.com>


---

CHANGELOG | 1 +
redhat/autofs.sysconfig.in | 5 +++--
samples/autofs.conf.default.in | 5 +++--
3 files changed, 7 insertions(+), 4 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 79cf673..961e340 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@
- dont wait forever to restart.
- add timeout option description to man page.
- fix null map entry order handling.
+- make description of default MOUNT_WAIT setting clear.
25/07/2012 autofs-5.0.7
=======================
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
index 36b924d..a8992c4 100644
--- a/redhat/autofs.sysconfig.in
+++ b/redhat/autofs.sysconfig.in
@@ -18,8 +18,9 @@ TIMEOUT=300
# Setting this timeout can cause problems when
# mount would otherwise wait for a server that
# is temporarily unavailable, such as when it's
-# restarting. The defailt of waiting for mount(8)
-# usually results in a wait of around 3 minutes.
+# restarting. The default setting (-1) of waiting
+# for mount(8) usually results in a wait of around
+# 3 minutes.
#
#MOUNT_WAIT=-1
#
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
index ac2f63b..1da89cf 100644
--- a/samples/autofs.conf.default.in
+++ b/samples/autofs.conf.default.in
@@ -18,8 +18,9 @@ TIMEOUT=300
# Setting this timeout can cause problems when
# mount would otherwise wait for a server that
# is temporarily unavailable, such as when it's
-# restarting. The defailt of waiting for mount(8)
-# usually results in a wait of around 3 minutes.
+# restarting. The default setting (-1) of waiting
+# for mount(8) usually results in a wait of around
+# 3 minutes.
#
#MOUNT_WAIT=-1
#

64
SOURCES/autofs-5.0.7-make-dump-maps-check-for-duplicate-indirect-mounts.patch

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
autofs-5.0.7 - make dump maps check for duplicate indirect mounts

From: Ian Kent <raven@themaw.net>

The dumpmaps function was intended for users to find out how the configured
mounts would be seen by automount. It does a limited amount of checking and
in particular doesn't report that duplicate indirect map sources will be
ignored at runtime.
---
CHANGELOG | 1 +
lib/master.c | 7 +++++++
2 files changed, 8 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 4106e7f..4576d47 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -40,6 +40,7 @@
- fix some automount(8) typos.
- syncronize handle_mounts() shutdown.
- fix submount tree not all expiring.
+- make dump maps check for duplicate indirect mounts.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/master.c b/lib/master.c
index 64dbcb1..eca3523 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -1310,6 +1310,7 @@ int master_show_mounts(struct master *master)
struct master_mapent *this;
struct autofs_point *ap;
time_t now = time(NULL);
+ unsigned int count = 0;
int i;
this = list_entry(p, struct master_mapent, list);
@@ -1318,6 +1319,7 @@ int master_show_mounts(struct master *master)
ap = this->ap;
printf("\nMount point: %s\n", ap->path);
+
printf("\nsource(s):\n");
/*
@@ -1360,6 +1362,9 @@ int master_show_mounts(struct master *master)
printf(" map: %s\n", source->argv[0]);
i = 1;
}
+ if (count && ap->type == LKP_INDIRECT)
+ printf(" duplicate indirect map entry"
+ " will be ignored at run time\n");
if (source->argc > 1) {
printf(" arguments: ");
for (; i < source->argc; i++)
@@ -1379,6 +1384,8 @@ int master_show_mounts(struct master *master)
} while ((me = cache_lookup_next(source->mc, me)));
}
+ count++;
+
source = source->next;
}

156
SOURCES/autofs-5.0.7-make-yellow-pages-support-optional.patch

@ -0,0 +1,156 @@ @@ -0,0 +1,156 @@
autofs-5.0.7 - make yellow pages support optional

From: Chris Packham <chris.packham@alliedtelesis.co.nz>

If rpcsvc/ypclnt.h is not available don't compile in Yellow Pages
support.
---

CHANGELOG | 1 +
Makefile.conf.in | 3 +++
configure | 16 ++++++++++++++++
configure.in | 9 +++++++++
include/config.h.in | 3 +++
lib/rpc_subs.c | 1 -
modules/Makefile | 9 +++++++--
7 files changed, 39 insertions(+), 3 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 1130db6..ed17163 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -25,6 +25,7 @@
- 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.
25/07/2012 autofs-5.0.7
=======================
diff --git a/Makefile.conf.in b/Makefile.conf.in
index 802318b..3766d45 100644
--- a/Makefile.conf.in
+++ b/Makefile.conf.in
@@ -43,6 +43,9 @@ NISPLUS = @HAVE_NISPLUS@
# SMBFS support: yes (1) no (0)
SMBFS = @HAVE_SMBMOUNT@
+# YellowPages support: yes (1) no (0)
+YPCLNT = @HAVE_YPCLNT@
+
# Support for calling e2fsck when mounting ext2 filesystems
EXT2FS = @HAVE_E2FSCK@
diff --git a/configure b/configure
index 3722a46..cf6428c 100755
--- a/configure
+++ b/configure
@@ -614,6 +614,7 @@ XML_FLAGS
LIBLDAP
HAVE_LDAP
LDAP_FLAGS
+HAVE_YPCLNT
HAVE_NISPLUS
EGREP
GREP
@@ -4575,6 +4576,21 @@ fi
+# 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 :
+ HAVE_YPCLNT=1
+fi
+
+
+
+if test "$HAVE_YPCLNT" = "1"; then
+
+$as_echo "#define HAVE_YPCLNT 1" >>confdefs.h
+
+fi
+
#
# OpenLDAP support? Expect that this may have a special directory...
#
diff --git a/configure.in b/configure.in
index 90bda62..363c376 100644
--- a/configure.in
+++ b/configure.in
@@ -213,6 +213,15 @@ 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
+
#
# OpenLDAP support? Expect that this may have a special directory...
#
diff --git a/include/config.h.in b/include/config.h.in
index 9bdf98a..7f1c5b5 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -72,6 +72,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define if using YellowPages */
+#undef HAVE_YPCLNT
+
/* Use libxml2 tsd usage workaround */
#undef LIBXML2_WORKAROUND
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index ad1d557..718caf9 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -27,7 +27,6 @@
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <rpcsvc/ypclnt.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <ctype.h>
diff --git a/modules/Makefile b/modules/Makefile
index 939da7c..c5deb24 100644
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -5,13 +5,13 @@
-include ../Makefile.conf
include ../Makefile.rules
-SRCS := lookup_yp.c lookup_file.c lookup_program.c lookup_userhome.c \
+SRCS := lookup_file.c lookup_program.c lookup_userhome.c \
lookup_multi.c lookup_hosts.c lookup_dir.c \
parse_sun.c \
mount_generic.c mount_nfs.c mount_afs.c mount_autofs.c \
mount_changer.c mount_bind.c
-MODS := lookup_yp.so lookup_file.so lookup_program.so lookup_userhome.so \
+MODS := lookup_file.so lookup_program.so lookup_userhome.so \
lookup_multi.so lookup_hosts.so lookup_dir.so \
parse_sun.so \
mount_generic.so mount_nfs.so mount_afs.so mount_autofs.so \
@@ -37,6 +37,11 @@ ifeq ($(NISPLUS), 1)
MODS += lookup_nisplus.so
endif
+ifeq ($(YPCLNT), 1)
+ SRCS += lookup_yp.c
+ MODS += lookup_yp.so
+endif
+
ifeq ($(LDAP), 1)
SRCS += lookup_ldap.c
MODS += lookup_ldap.so

73
SOURCES/autofs-5.0.7-misc-man-page-fixes.patch

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
autofs-5.0.7 - misc man page fixes

From: Ian Kent <raven@themaw.net>

- add missing long option for for macro define in automount(8).
- fix a couple of grammar mistakes in autofs(8).
- add missing force option to help.
---
CHANGELOG | 1 +
daemon/automount.c | 1 +
man/autofs.8.in | 4 ++--
man/automount.8 | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 0242c11..503a21e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -51,6 +51,7 @@
- probe each nfs version in turn for singleton mounts.
- add changlog entry for coverity fixes.
- fix probe each nfs version in turn for singleton mounts.
+- misc man page fixes.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/automount.c b/daemon/automount.c
index 3f9337f..019637f 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -1734,6 +1734,7 @@ static void usage(void)
" set daemon log verbosity\n"
" -C --dont-check-daemon\n"
" don't check if daemon is already running\n"
+ " -F --force forceably clean up known automounts at start\n"
" -V --version print version, build config and exit\n"
, program);
}
diff --git a/man/autofs.8.in b/man/autofs.8.in
index ac0670d..fae0b00 100644
--- a/man/autofs.8.in
+++ b/man/autofs.8.in
@@ -6,7 +6,7 @@
.I start|stop|restart|reload|status
.SH "DESCRIPTION"
.B autofs
-control the operation of the
+controls the operation of the
.BR automount (8)
daemons running on the Linux system. Usually
.B autofs
@@ -16,7 +16,7 @@ parameter and at shutdown time with the
.I stop
parameter. The
.B autofs
-script can also manually be invoked by the system administrator to shut
+script can also be manually invoked by the system administrator to shut
down, restart or reload the automounters.
.P
.SH "OPERATION"
diff --git a/man/automount.8 b/man/automount.8
index 7cc32c5..844b876 100644
--- a/man/automount.8
+++ b/man/automount.8
@@ -45,7 +45,7 @@ autofs managed mounts.
Enables logging of general status and progress messages as well as
debugging messages for all autofs managed mounts.
.TP
-.I "\-Dvariable=value"
+.I "\-Dvariable=value, --define variable=value"
Define a global macro substitution variable. Global definitions
are over-ridden macro definitions of the same name specified in
mount entries.

39
SOURCES/autofs-5.0.7-modules-replicated-use-sin6.addr-s6_addr32.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
autofs-5.0.7 - modules/replicated.c: use sin6_addr.s6_addr32

From: Chris Packham <chris.packham@alliedtelesis.co.nz>

The exported in6.h kernel header provides a convenience macro s6_addr32
for accessing the 32bit words of an ipv6 address. Use this instead of
__in6_u.__u6_addr32.
---

CHANGELOG | 1 +
modules/replicated.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index ed17163..4eaa9f9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -26,6 +26,7 @@
- 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.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/replicated.c b/modules/replicated.c
index dbd5513..26f64b8 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -1146,7 +1146,7 @@ try_name:
rr4++;
} else if (this->ai_family == AF_INET6) {
struct sockaddr_in6 *addr = (struct sockaddr_in6 *) this->ai_addr;
- if (!IN6_IS_ADDR_LOOPBACK(addr->sin6_addr.__in6_u.__u6_addr32))
+ if (!IN6_IS_ADDR_LOOPBACK(addr->sin6_addr.s6_addr32))
rr6++;
}
this = this->ai_next;

40
SOURCES/autofs-5.0.7-only-probe-specific-nfs-version-when-requested.patch

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
autofs-5.0.7 - only probe specific nfs version when requested

From: Ian Kent <raven@themaw.net>

If a specific NFS version is given as an option the set the probe flags
to probe only that version.
---
CHANGELOG | 1 +
modules/mount_nfs.c | 10 +++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -63,6 +63,7 @@
- teach dumpmaps to output simple key value pairs.
- fix get_nfs_info() probe.
- fix portmap lookup.
+- only probe specific nfs version if requested.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/modules/mount_nfs.c
+++ autofs-5.0.7/modules/mount_nfs.c
@@ -146,7 +146,15 @@ int mount_mount(struct autofs_point *ap,
if (strncmp("vers=4", cp, o_len) == 0 ||
strncmp("nfsvers=4", cp, o_len) == 0)
vers = NFS4_VERS_MASK | TCP_SUPPORTED;
- else if (strstr(cp, "port=") == cp &&
+ else if (strncmp("vers=3", cp, o_len) == 0 ||
+ strncmp("nfsvers=3", cp, o_len) == 0) {
+ vers &= ~(NFS4_VERS_MASK | NFS_VERS_MASK);
+ vers |= NFS3_REQUESTED;
+ } else if (strncmp("vers=2", cp, o_len) == 0 ||
+ strncmp("nfsvers=2", cp, o_len) == 0) {
+ vers &= ~(NFS4_VERS_MASK | NFS_VERS_MASK);
+ vers |= NFS2_REQUESTED;
+ } else if (strstr(cp, "port=") == cp &&
o_len - 5 < 25) {
char optport[25];

104
SOURCES/autofs-5.0.7-probe-each-nfs-version-in-turn-for-singleton-mounts.patch

@ -0,0 +1,104 @@ @@ -0,0 +1,104 @@
autofs-5.0.7 - probe each nfs version in turn for singleton mounts

From: Ian Kent <raven@themaw.net>


---
CHANGELOG | 1 +
include/replicated.h | 2 ++
modules/mount_nfs.c | 35 ++++++++++++++++++++++++++++++++++-
modules/replicated.c | 8 ++++----
4 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 39d7889..48e9806 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -48,6 +48,7 @@
- fix master map mount options matching.
- fix master map bogus keywork match.
- fix fix map entry duplicate offset detection.
+- probe each nfs version in turn for singleton mounts.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/replicated.h b/include/replicated.h
index ff0e7b9..728f131 100644
--- a/include/replicated.h
+++ b/include/replicated.h
@@ -68,6 +68,8 @@ struct host {
};
void seed_random(void);
+struct host *new_host(const char *, 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);
int prune_host_list(unsigned, struct host **, unsigned int, int);
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index 5424d74..81ba3ca 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -180,9 +180,42 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
* We can't probe protocol rdma so leave it to mount.nfs(8)
* and and suffer the delay if a server isn't available.
*/
- if (!rdma)
+ if (rdma)
+ goto dont_probe;
+
+ /*
+ * If this is a singleton mount, and NFSv4 only hasn't been asked
+ * for, and the default NFS protocol is set to v4 in the autofs
+ * configuration only probe NFSv4 and let mount.nfs(8) do fallback
+ * to NFSv3 (if it can). If the NFSv4 probe fails then probe as
+ * normal.
+ */
+ if (!hosts->next &&
+ mount_default_proto == 4 &&
+ vers & NFS_VERS_MASK != 0 &&
+ vers & NFS4_VERS_MASK != 0) {
+ unsigned int v4_probe_ok = 0;
+ struct host *tmp = new_host(hosts->name,
+ hosts->addr, hosts->addr_len,
+ hosts->proximity,
+ hosts->weight, hosts->options);
+ if (tmp) {
+ tmp->rr = hosts->rr;
+ prune_host_list(ap->logopt, &tmp,
+ NFS4_VERS_MASK|TCP_SUPPORTED, port);
+ /* If probe succeeds just try the mount with host in hosts */
+ if (tmp) {
+ v4_probe_ok = 1;
+ free_host_list(&tmp);
+ }
+ }
+ if (!v4_probe_ok)
+ prune_host_list(ap->logopt, &hosts, vers, port);
+ } else {
prune_host_list(ap->logopt, &hosts, vers, port);
+ }
+dont_probe:
if (!hosts) {
info(ap->logopt, MODPREFIX "no hosts available");
return 1;
diff --git a/modules/replicated.c b/modules/replicated.c
index 6dbdade..0a044b9 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -280,10 +280,10 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
return PROXIMITY_OTHER;
}
-static struct host *new_host(const char *name,
- struct sockaddr *addr, size_t addr_len,
- unsigned int proximity, unsigned int weight,
- unsigned int options)
+struct host *new_host(const char *name,
+ struct sockaddr *addr, size_t addr_len,
+ unsigned int proximity, unsigned int weight,
+ unsigned int options)
{
struct host *new;
struct sockaddr *tmp2;

30
SOURCES/autofs-5.0.7-recheck-valid-map-entry-lookup-return-in-do_readmap_mount.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
autofs-5.0.7 - recheck valid map entry lookup return in do_readmap_mount()

From: Ian Kent <raven@themaw.net>

After looking for an expected existing valid map entry in do_readmap_mount()
add a check in case it isn't found.

If it actually isn't found (although it always should be) the only thing
that can be done is log an error return.
---
daemon/state.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/daemon/state.c b/daemon/state.c
index 6e23022..ddc5556 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -405,6 +405,12 @@ static void do_readmap_mount(struct autofs_point *ap, struct mnt_list *mnts,
me->key);
cache_writelock(vmc);
valid = cache_lookup_distinct(vmc, me->key);
+ if (!valid) {
+ cache_unlock(vmc);
+ error(ap->logopt,
+ "failed to find expected existing valid map entry");
+ return;
+ }
/* Take over the mount if there is one */
valid->ioctlfd = me->ioctlfd;
me->ioctlfd = -1;

36
SOURCES/autofs-5.0.7-remove-debug-only-code-in-alarm-c.patch

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
autofs-5.0.7 - remove debug only code in alarm.c

From: Ian Kent <raven@themaw.net>

This code is only ever used for "on-the-fly" debugging so just remove it.
---
lib/alarm.c | 16 ----------------
1 file changed, 16 deletions(-)

diff --git a/lib/alarm.c b/lib/alarm.c
index d5cdc05..0f04ef8 100755
--- a/lib/alarm.c
+++ b/lib/alarm.c
@@ -40,22 +40,6 @@ do { \
fatal(_alm_unlock); \
} while (0)
-void dump_alarms(void)
-{
- struct list_head *head;
- struct list_head *p;
-
- pthread_mutex_lock(&mutex);
- head = &alarms;
- list_for_each(p, head) {
- struct alarm *this;
-
- this = list_entry(p, struct alarm, list);
- logmsg("alarm time = %d", this->time);
- }
- pthread_mutex_unlock(&mutex);
-}
-
/* Insert alarm entry on ordered list. */
int alarm_add(struct autofs_point *ap, time_t seconds)
{

125
SOURCES/autofs-5.0.7-setup-program-map-env-from-macro-table.patch

@ -0,0 +1,125 @@ @@ -0,0 +1,125 @@
autofs-5.0.7 - setup program map env from macro table

From: Ian Kent <raven@themaw.net>

The ability to pass parameters to program maps, in some way, is needed.
Standard autofs specifies that program maps have one argument so passing
parameters as arguments shouldn't be done.

This patch sets the existing macro table definitions (for both global and
local table) as environment variables before calling the map. The values
are not checked after return so, at this stage, program maps can't change
macro definitions.
---
CHANGELOG | 1 +
include/macros.h | 1 +
lib/macros.c | 28 ++++++++++++++++++++++++++++
modules/lookup_program.c | 20 ++++++++++++++++++++
4 files changed, 50 insertions(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -76,6 +76,7 @@
- fix options compare.
- fix fix options compare.
- fix max() declaration.
+- setup program map env from macro table.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/include/macros.h
+++ autofs-5.0.7/include/macros.h
@@ -40,5 +40,6 @@ void macro_free_global_table(void);
void macro_free_table(struct substvar *table);
const struct substvar *
macro_findvar(const struct substvar *table, const char *str, int len);
+void macro_setenv(struct substvar *table);
#endif
--- autofs-5.0.7.orig/lib/macros.c
+++ autofs-5.0.7/lib/macros.c
@@ -421,3 +421,31 @@ macro_findvar(const struct substvar *tab
return NULL;
}
+/* Set environment from macro variable table */
+void macro_setenv(struct substvar *table)
+{
+ const struct substvar *sv = system_table;
+ const struct substvar *lv = table;
+
+ /*
+ * First set environment from global table, matching local
+ * variables will overwrite these.
+ */
+ while (sv) {
+ if (sv->def)
+ setenv(sv->def, sv->val, 1);
+ sv = sv->next;
+ }
+
+ error(LOGOPT_ANY, "table %p", table);
+ dump_table(table);
+
+ /* Next set environment from the local table */
+ while (lv) {
+ if (lv->def)
+ setenv(lv->def, lv->val, 1);
+ lv = lv->next;
+ }
+
+ return;
+}
--- autofs-5.0.7.orig/modules/lookup_program.c
+++ autofs-5.0.7/modules/lookup_program.c
@@ -36,9 +36,17 @@
struct lookup_context {
const char *mapname;
+ char *mapfmt;
struct parse_mod *parse;
};
+struct parse_context {
+ char *optstr; /* Mount options */
+ char *macros; /* Map wide macro defines */
+ struct substvar *subst; /* $-substitutions */
+ int slashify_colons; /* Change colons to slashes? */
+};
+
int lookup_version = AUTOFS_LOOKUP_VERSION; /* Required by protocol */
int lookup_init(const char *mapfmt, int argc, const char *const *argv, void **context)
@@ -79,6 +87,8 @@ int lookup_init(const char *mapfmt, int
if (!mapfmt)
mapfmt = MAPFMT_DEFAULT;
+ ctxt->mapfmt = strdup(mapfmt);
+
ctxt->parse = open_parse(mapfmt, MODPREFIX, argc - 1, argv + 1);
if (!ctxt->parse) {
logmsg(MODPREFIX "failed to open parse context");
@@ -255,6 +265,14 @@ int lookup_mount(struct autofs_point *ap
warn(ap->logopt,
MODPREFIX "failed to set PWD to %s for map %s",
ap->path, ctxt->mapname);
+ /*
+ * MAPFMT_DEFAULT must be "sun" for ->parse_init() to have setup
+ * the macro table.
+ */
+ if (ctxt->mapfmt && strcmp(ctxt->mapfmt, "MAPFMT_DEFAULT")) {
+ struct parse_context *pctxt = (struct parse_context *) ctxt->parse->context;
+ macro_setenv(pctxt->subst);
+ }
execl(ctxt->mapname, ctxt->mapname, name, NULL);
_exit(255); /* execl() failed */
}
@@ -448,6 +466,8 @@ int lookup_done(void *context)
{
struct lookup_context *ctxt = (struct lookup_context *) context;
int rv = close_parse(ctxt->parse);
+ if (ctxt->mapfmt)
+ free(ctxt->mapfmt);
free(ctxt);
return rv;
}

73
SOURCES/autofs-5.0.7-syncronize-handle_mounts-shutdown.patch

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
autofs-5.0.7 - syncronize handle_mounts() shutdown

From: Ian Kent <ikent@redhat.com>

When re-reading the master map the signal handler thread receives
a SIGTERM signal from handle_mounts_cleanup() for map entries that
have been removed. This is done to allow joining with handle_mounts()
threads before shutting down to ensure clean up has been completed
before the thread terminates.

But, if more than one map entry is removed, multiple threads may be
cleaned up during the handling of a single signal so there can be no
work to do when a subsequent signal is received. In this case the
signal handler thread interprets the additional SIGTERM signal as a
request to shutdown and exits.
---
CHANGELOG | 1 +
daemon/automount.c | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 488ad1e..f1ec1e5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -38,6 +38,7 @@
- fix systemd unidir in spec file.
- document browse option in man page.
- fix some automount(8) typos.
+- syncronize handle_mounts() shutdown.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/automount.c b/daemon/automount.c
index 4c651cf..3f9337f 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -1285,7 +1285,8 @@ static int do_hup_signal(struct master *master, time_t age)
nfs_mount_uses_string_options = check_nfs_mount_version(&vers, &check);
master_mutex_lock();
- if (master->reading) {
+ /* Already doing a map read or shutdown or no mounts */
+ if (master->reading || list_empty(&master->mounts)) {
status = pthread_mutex_unlock(&mrc.mutex);
if (status)
fatal(status);
@@ -1449,6 +1450,7 @@ static void handle_mounts_cleanup(void *arg)
char path[PATH_MAX + 1];
char buf[MAX_ERR_BUF];
unsigned int clean = 0, submount, logopt;
+ unsigned int pending = 0;
ap = (struct autofs_point *) arg;
@@ -1466,6 +1468,9 @@ static void handle_mounts_cleanup(void *arg)
list_del_init(&ap->mounts);
}
+ /* Don't signal the handler if we have already done so */
+ if (!list_empty(&master_list->completed))
+ pending = 1;
master_remove_mapent(ap->entry);
master_source_unlock(ap->entry);
@@ -1498,7 +1503,7 @@ static void handle_mounts_cleanup(void *arg)
* so it can join with any completed handle_mounts() threads and
* perform final cleanup.
*/
- if (!submount)
+ if (!submount && !pending)
pthread_kill(state_mach_thid, SIGTERM);
master_mutex_unlock();

366
SOURCES/autofs-5.0.7-teach-dumpmaps-to-output-simple-key-value-pairs.patch

@ -0,0 +1,366 @@ @@ -0,0 +1,366 @@
autofs-5.0.7 - teach dumpmaps to output simple key value pairs

From: Ian Kent <raven@themaw.net>

The dumpmaps option doesn't allow maps to be output in <key, value>
pairs suitable for use as a file map.

This could be useful to save current maps as a backup for emergency
use.

If the dumpmaps option is given and is followed by two parameters,
"<map type> <map name>" then simple <key, value> pairs that would
be read in by a map read are printed to stdout if the given map type
and map name are found in the map configuration.

If the map is an LDAP map and there is more than one map of same name
in different base dns only the first map encountered by autofs will
be listed.

If the map type is an old style multi-map and any one of the map
names in the multi-map entry matches the given map name the entries
that would be used by autofs for the whole multi-map will be listed.
---
CHANGELOG | 1
daemon/automount.c | 56 ++++++++++++---
include/master.h | 1
lib/master.c | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++++
man/automount.8 | 20 +++++
5 files changed, 250 insertions(+), 15 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -60,6 +60,7 @@
- fix fix wildcard multi map regression.
- fix dumpmaps multi output.
- try and cleanup after dumpmaps.
+- teach dumpmaps to output simple key value pairs.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/daemon/automount.c
+++ autofs-5.0.7/daemon/automount.c
@@ -1725,7 +1725,8 @@ static void usage(void)
" -f --foreground do not fork into background\n"
" -r --random-multimount-selection\n"
" use ramdom replicated server selection\n"
- " -m --dumpmaps dump automounter maps and exit\n"
+ " -m --dumpmaps [<map type> <map name>]\n"
+ " dump automounter maps and exit\n"
" -n --negative-timeout n\n"
" set the timeout for failed key lookups.\n"
" -O --global-options\n"
@@ -2125,22 +2126,33 @@ int main(int argc, char *argv[])
program);
#endif
- if (argc == 0)
- master_list = master_new(NULL, timeout, ghost);
- else
- master_list = master_new(argv[0], timeout, ghost);
-
- if (!master_list) {
- printf("%s: can't create master map %s", program, argv[0]);
- exit(1);
- }
-
if (dumpmaps) {
struct master_mapent *entry;
struct list_head *head, *p;
struct mapent_cache *nc;
+ const char *type = NULL;
+ const char *name = NULL;
+ const char *master = NULL;
+
+ if (argc > 0) {
+ if (argc >= 2) {
+ type = argv[0];
+ name = argv[1];
+ }
+ if (argc == 3)
+ master = argv[2];
+ }
- open_log();
+ if (master)
+ master_list = master_new(NULL, timeout, ghost);
+ else
+ master_list = master_new(master, timeout, ghost);
+ if (!master_list) {
+ printf("%s: can't create master map", program);
+ exit(1);
+ }
+
+ log_to_stderr();
master_init_scan();
@@ -2153,7 +2165,15 @@ int main(int argc, char *argv[])
master_list->nc = nc;
lookup_nss_read_master(master_list, 0);
- master_show_mounts(master_list);
+ if (type) {
+ const char *map = basename(name);
+ if (!map)
+ printf("%s: invalid map name %s\n",
+ program, name);
+ else
+ dump_map(master_list, type, map);
+ } else
+ master_show_mounts(master_list);
head = &master_list->mounts;
p = head->next;
@@ -2168,6 +2188,16 @@ int main(int argc, char *argv[])
exit(0);
}
+ if (argc == 0)
+ master_list = master_new(NULL, timeout, ghost);
+ else
+ master_list = master_new(argv[0], timeout, ghost);
+
+ if (!master_list) {
+ printf("%s: can't create master map %s", program, argv[0]);
+ exit(1);
+ }
+
become_daemon(foreground, daemon_check);
if (pthread_attr_init(&th_attr)) {
--- autofs-5.0.7.orig/include/master.h
+++ autofs-5.0.7/include/master.h
@@ -112,6 +112,7 @@ int master_submount_list_empty(struct au
int master_notify_submount(struct autofs_point *, const char *path, enum states);
void master_notify_state_change(struct master *, int);
int master_mount_mounts(struct master *, time_t, int);
+int dump_map(struct master *, const char *, const char *);
int master_show_mounts(struct master *);
extern inline unsigned int master_get_logopt(void);
int master_list_empty(struct master *);
--- autofs-5.0.7.orig/lib/master.c
+++ autofs-5.0.7/lib/master.c
@@ -1329,6 +1329,193 @@ static void print_map_info(struct map_so
return;
}
+static int match_type(const char *source, const char *type)
+{
+ if (!strcmp(source, type))
+ return 1;
+ /* Sources file and files are synonymous */
+ if (!strncmp(source, type, 4) && (strlen(source) <= 5))
+ return 1;
+ return 0;
+}
+
+static char *get_map_name(const char *string)
+{
+ char *name, *tmp;
+ char *start, *end, *base;
+
+ tmp = strdup(string);
+ if (!tmp) {
+ printf("error: allocation failure: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ base = basename(tmp);
+ end = strchr(base, ',');
+ if (end)
+ *end = '\0';
+ start = strchr(tmp, '=');
+ if (start)
+ start++;
+ else {
+ char *colon = strrchr(base, ':');
+ if (colon)
+ start = ++colon;
+ else
+ start = base;
+ }
+
+ name = strdup(start);
+ if (!name)
+ printf("error: allocation failure: %s\n", strerror(errno));
+ free(tmp);
+
+ return name;
+}
+
+static int match_name(struct map_source *source, const char *name)
+{
+ int argc = source->argc;
+ int ret = 0;
+ int i;
+
+ /*
+ * This can't work for old style "multi" type sources since
+ * there's no way to know from which map the cache entry came
+ * from and duplicate entries are ignored at map read time.
+ * All we can really do is list all the entries for the given
+ * multi map if one of its map names matches.
+ */
+ for (i = 0; i < argc; i++) {
+ if (i == 0 || !strcmp(source->argv[i], "--")) {
+ if (i != 0) {
+ i++;
+ if (i >= argc)
+ break;
+ }
+
+ if (source->argv[i] && *source->argv[i] != '-') {
+ char *map = get_map_name(source->argv[i]);
+ if (!map)
+ break;
+ if (!strcmp(map, name)) {
+ ret = 1;
+ free(map);
+ break;
+ }
+ free(map);
+ }
+ }
+ }
+
+ return ret;
+}
+
+int dump_map(struct master *master, const char *type, const char *name)
+{
+ struct list_head *p, *head;
+
+ if (list_empty(&master->mounts)) {
+ printf("no master map entries found\n");
+ return 1;
+ }
+
+ head = &master->mounts;
+ p = head->next;
+ while (p != head) {
+ struct map_source *source;
+ struct master_mapent *this;
+ struct autofs_point *ap;
+ time_t now = time(NULL);
+
+ this = list_entry(p, struct master_mapent, list);
+ p = p->next;
+
+ ap = this->ap;
+
+ /*
+ * Ensure we actually read indirect map entries so we can
+ * list them. The map reads won't read any indirect map
+ * entries (other than those in a file map) unless the
+ * browse option is set.
+ */
+ if (ap->type == LKP_INDIRECT)
+ ap->flags |= MOUNT_FLAG_GHOST;
+
+ /* Read the map content into the cache */
+ if (lookup_nss_read_map(ap, NULL, now))
+ lookup_prune_cache(ap, now);
+ else {
+ printf("failed to read map\n");
+ lookup_close_lookup(ap);
+ continue;
+ }
+
+ if (!this->maps) {
+ printf("no map sources found for %s\n", ap->path);
+ lookup_close_lookup(ap);
+ continue;
+ }
+
+ source = this->maps;
+ while (source) {
+ struct map_source *instance;
+ struct mapent *me;
+
+ instance = NULL;
+ if (source->type) {
+ if (!match_type(source->type, type)) {
+ source = source->next;
+ continue;
+ }
+ if (!match_name(source, name)) {
+ source = source->next;
+ continue;
+ }
+ instance = source;
+ } else {
+ struct map_source *map;
+
+ map = source->instance;
+ while (map) {
+ if (!match_type(map->type, type)) {
+ map = map->next;
+ continue;
+ }
+ if (!match_name(map, name)) {
+ map = map->next;
+ continue;
+ }
+ instance = map;
+ break;
+ }
+ }
+
+ if (!instance) {
+ source = source->next;
+ lookup_close_lookup(ap);
+ continue;
+ }
+
+ me = cache_lookup_first(source->mc);
+ if (!me)
+ printf("no keys found in map\n");
+ else {
+ do {
+ if (me->source == instance)
+ printf("%s\t%s\n", me->key, me->mapent);
+ } while ((me = cache_lookup_next(source->mc, me)));
+ }
+
+ lookup_close_lookup(ap);
+ return 1;
+ }
+ lookup_close_lookup(ap);
+ }
+
+ return 0;
+}
+
int master_show_mounts(struct master *master)
{
struct list_head *p, *head;
--- autofs-5.0.7.orig/man/automount.8
+++ autofs-5.0.7/man/automount.8
@@ -57,8 +57,24 @@ Run the daemon in the foreground and log
Enables the use of ramdom selection when choosing a host from a
list of replicated servers.
.TP
-.I "\-m, \-\-dumpmaps"
-Dump configured automounter maps, then exit.
+.I "\-m, \-\-dumpmaps [<map type> <map name>]"
+With no parameters, list information about the configured automounter
+maps, then exit.
+
+If the dumpmaps option is given and is followed by two parameters,
+"<map type> <map name>" then simple "<key, value>" pairs that would
+be read in by a map read are printed to stdout if the given map type
+and map name are found in the map configuration.
+
+If the map is an LDAP map and there is more than one map of same name
+in different base dns only the first map encountered by autofs will
+be listed. Similarly, if the map is a file map and there is more than
+one map of the same name in different directories, only the first map
+encountered will be listed.
+
+If the map type is an old style multi-map and any one of the map
+names in the multi-map entry matches the given map name the entries
+that would be used by autofs for the whole multi-map will be listed.
.TP
.I "\-O, \-\-global-options"
Allows the specification of global mount options used for all master

63
SOURCES/autofs-5.0.7-try-and-cleanup-after-dumpmaps.patch

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
autofs-5.0.7 - try and cleanup after dumpmaps

From: Ian Kent <raven@themaw.net>

Try and cleanup a little after dumping maps.
It's not really necessary but but can help by reducing the noise
from valgrind when checking code.
---
CHANGELOG | 1 +
daemon/automount.c | 13 +++++++++++++
lib/master.c | 2 ++
3 files changed, 16 insertions(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -59,6 +59,7 @@
- fix syncronize handle_mounts() shutdown.
- fix fix wildcard multi map regression.
- fix dumpmaps multi output.
+- try and cleanup after dumpmaps.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/daemon/automount.c
+++ autofs-5.0.7/daemon/automount.c
@@ -2136,6 +2136,8 @@ int main(int argc, char *argv[])
}
if (dumpmaps) {
+ struct master_mapent *entry;
+ struct list_head *head, *p;
struct mapent_cache *nc;
open_log();
@@ -2152,6 +2154,17 @@ int main(int argc, char *argv[])
lookup_nss_read_master(master_list, 0);
master_show_mounts(master_list);
+
+ head = &master_list->mounts;
+ p = head->next;
+ while (p != head) {
+ entry = list_entry(p, struct master_mapent, list);
+ p = p->next;
+ master_free_mapent_sources(entry, 1);
+ master_free_mapent(entry);
+ }
+ master_kill(master_list);
+
exit(0);
}
--- autofs-5.0.7.orig/lib/master.c
+++ autofs-5.0.7/lib/master.c
@@ -1426,6 +1426,8 @@ int master_show_mounts(struct master *ma
source = source->next;
}
+ lookup_close_lookup(ap);
+
printf("\n");
}

92
SOURCES/autofs-5.0.7-update-kernel-include-files.patch

@ -0,0 +1,92 @@ @@ -0,0 +1,92 @@
autofs-5.0.7 - update kernel include files

From: Ian Kent <raven@themaw.net>

Update autofs include files to include the latest changes.
---
include/linux/auto_fs.h | 33 ++++++++++-----------------------
include/linux/auto_fs4.h | 3 ++-
2 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index 91d414f..64df1a6 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -14,13 +14,8 @@
#ifndef _LINUX_AUTO_FS_H
#define _LINUX_AUTO_FS_H
-#ifdef __KERNEL__
-#include <linux/fs.h>
-#include <linux/limits.h>
#include <linux/types.h>
-#include <linux/ioctl.h>
-#else
-#include <asm/types.h>
+#ifndef __KERNEL__
#include <sys/ioctl.h>
#endif /* __KERNEL__ */
@@ -32,25 +27,16 @@
#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
/*
- * Architectures where both 32- and 64-bit binaries can be executed
- * on 64-bit kernels need this. This keeps the structure format
- * uniform, and makes sure the wait_queue_token isn't too big to be
- * passed back down to the kernel.
- *
- * This assumes that on these architectures:
- * mode 32 bit 64 bit
- * -------------------------
- * int 32 bit 32 bit
- * long 32 bit 64 bit
- *
- * If so, 32-bit user-space code should be backwards compatible.
+ * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed
+ * back to the kernel via ioctl from userspace. On architectures where 32- and
+ * 64-bit userspace binaries can be executed it's important that the size of
+ * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we
+ * do not break the binary ABI interface by changing the structure size.
*/
-
-#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \
- || defined(__powerpc__) || defined(__s390__)
-typedef unsigned int autofs_wqt_t;
-#else
+#if defined(__ia64__) || defined(__alpha__) /* pure 64bit architectures */
typedef unsigned long autofs_wqt_t;
+#else
+typedef unsigned int autofs_wqt_t;
#endif
/* Packet types */
@@ -81,6 +67,7 @@ struct autofs_packet_expire {
#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
+#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t)
#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index 55fa478..e02982f 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -12,6 +12,7 @@
#define _LINUX_AUTO_FS4_H
/* Include common v3 definitions */
+#include <linux/types.h>
#include <linux/auto_fs.h>
/* autofs v4 definitions */
@@ -23,7 +24,7 @@
#define AUTOFS_MIN_PROTO_VERSION 3
#define AUTOFS_MAX_PROTO_VERSION 5
-#define AUTOFS_PROTO_SUBVERSION 1
+#define AUTOFS_PROTO_SUBVERSION 2
/* Mask for expire behaviour */
#define AUTOFS_EXP_IMMEDIATE 1

471
SOURCES/autofs-5.0.7-use-numeric-protocol-ids-instead-of-protoent-structs.patch

@ -0,0 +1,471 @@ @@ -0,0 +1,471 @@
autofs-5.0.7 - use numeric protocol ids instead of protoent structs

From: Leonardo Chiquitto <leonardo.lists@gmail.com>

The function getprotobyname() is not reentrant, so we can't call
it simultaneously from multiple threads. Instead of switching to
the reentrant version which adds more complexity to the code,
lets use numeric protocol IDs instead of protoent structures.
---

CHANGELOG | 1 +
include/rpc_subs.h | 4 +--
lib/rpc_subs.c | 80 ++++++++++++++++++--------------------------------
modules/replicated.c | 42 +++++++++++---------------
4 files changed, 50 insertions(+), 77 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 4cf5621..ba1d65b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -23,6 +23,7 @@
- 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.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/rpc_subs.h b/include/rpc_subs.h
index ca474d9..b6d59f9 100644
--- a/include/rpc_subs.h
+++ b/include/rpc_subs.h
@@ -54,7 +54,7 @@ struct conn_info {
unsigned short port;
unsigned long program;
unsigned long version;
- struct protoent *proto;
+ int proto;
unsigned int send_sz;
unsigned int recv_sz;
struct timeval timeout;
@@ -66,7 +66,7 @@ int rpc_udp_getclient(struct conn_info *, unsigned int, unsigned int);
void rpc_destroy_udp_client(struct conn_info *);
int rpc_tcp_getclient(struct conn_info *, unsigned int, unsigned int);
void rpc_destroy_tcp_client(struct conn_info *);
-int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, const char *, unsigned int);
+int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, int, unsigned int);
int rpc_portmap_getport(struct conn_info *, struct pmap *, unsigned short *);
int rpc_ping_proto(struct conn_info *);
int rpc_ping(const char *, long, long, unsigned int);
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index d33a3c4..ad1d557 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -170,7 +170,7 @@ static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, i
*client = NULL;
- proto = info->proto->p_proto;
+ proto = info->proto;
if (proto == IPPROTO_UDP)
type = SOCK_DGRAM;
else
@@ -201,7 +201,7 @@ static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, i
in4_raddr = (struct sockaddr_in *) addr;
in4_raddr->sin_port = htons(info->port);
- switch (info->proto->p_proto) {
+ switch (info->proto) {
case IPPROTO_UDP:
clnt = clntudp_bufcreate(in4_raddr,
info->program, info->version,
@@ -241,7 +241,7 @@ static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, i
*client = NULL;
- proto = info->proto->p_proto;
+ proto = info->proto;
if (proto == IPPROTO_UDP)
type = SOCK_DGRAM;
else
@@ -292,11 +292,11 @@ static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, i
nb_addr.maxlen = nb_addr.len = slen;
nb_addr.buf = addr;
- if (info->proto->p_proto == IPPROTO_UDP)
+ if (info->proto == IPPROTO_UDP)
clnt = clnt_dg_create(*fd, &nb_addr,
info->program, info->version,
info->send_sz, info->recv_sz);
- else if (info->proto->p_proto == IPPROTO_TCP) {
+ else if (info->proto == IPPROTO_TCP) {
ret = connect_nb(*fd, addr, slen, &info->timeout);
if (ret < 0)
return ret;
@@ -355,7 +355,7 @@ static int create_client(struct conn_info *info, CLIENT **client)
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = AF_UNSPEC;
- if (info->proto->p_proto == IPPROTO_UDP)
+ if (info->proto == IPPROTO_UDP)
hints.ai_socktype = SOCK_DGRAM;
else
hints.ai_socktype = SOCK_STREAM;
@@ -370,7 +370,7 @@ static int create_client(struct conn_info *info, CLIENT **client)
haddr = ai;
while (haddr) {
- if (haddr->ai_protocol != info->proto->p_proto) {
+ if (haddr->ai_protocol != info->proto) {
haddr = haddr->ai_next;
continue;
}
@@ -417,16 +417,11 @@ out_close:
int rpc_udp_getclient(struct conn_info *info,
unsigned int program, unsigned int version)
{
- struct protoent *pe_proto;
CLIENT *client;
int ret;
if (!info->client) {
- pe_proto = getprotobyname("udp");
- if (!pe_proto)
- return -ENOENT;
-
- info->proto = pe_proto;
+ info->proto = IPPROTO_UDP;
info->timeout.tv_sec = RPC_TOUT_UDP;
info->timeout.tv_usec = 0;
info->send_sz = UDPMSGSIZE;
@@ -458,16 +453,11 @@ void rpc_destroy_udp_client(struct conn_info *info)
int rpc_tcp_getclient(struct conn_info *info,
unsigned int program, unsigned int version)
{
- struct protoent *pe_proto;
CLIENT *client;
int ret;
if (!info->client) {
- pe_proto = getprotobyname("tcp");
- if (!pe_proto)
- return -ENOENT;
-
- info->proto = pe_proto;
+ info->proto = IPPROTO_TCP;
info->timeout.tv_sec = RPC_TOUT_TCP;
info->timeout.tv_usec = 0;
info->send_sz = 0;
@@ -513,23 +503,18 @@ void rpc_destroy_tcp_client(struct conn_info *info)
int rpc_portmap_getclient(struct conn_info *info,
const char *host, struct sockaddr *addr, size_t addr_len,
- const char *proto, unsigned int option)
+ int proto, unsigned int option)
{
- struct protoent *pe_proto;
CLIENT *client;
int ret;
- pe_proto = getprotobyname(proto);
- if (!pe_proto)
- return -ENOENT;
-
info->host = host;
info->addr = addr;
info->addr_len = addr_len;
info->program = PMAPPROG;
info->port = PMAPPORT;
info->version = PMAPVERS;
- info->proto = pe_proto;
+ info->proto = proto;
info->send_sz = RPCSMALLMSGSIZE;
info->recv_sz = RPCSMALLMSGSIZE;
info->timeout.tv_sec = PMAP_TOUT_UDP;
@@ -537,7 +522,7 @@ int rpc_portmap_getclient(struct conn_info *info,
info->close_option = option;
info->client = NULL;
- if (pe_proto->p_proto == IPPROTO_TCP)
+ if (info->proto == IPPROTO_TCP)
info->timeout.tv_sec = PMAP_TOUT_TCP;
ret = create_client(info, &client);
@@ -555,7 +540,7 @@ int rpc_portmap_getport(struct conn_info *info,
struct conn_info pmap_info;
CLIENT *client;
enum clnt_stat status;
- int proto = info->proto->p_proto;
+ int proto = info->proto;
int ret;
memset(&pmap_info, 0, sizeof(struct conn_info));
@@ -633,13 +618,13 @@ int rpc_ping_proto(struct conn_info *info)
{
CLIENT *client;
enum clnt_stat status;
- int proto = info->proto->p_proto;
+ int proto = info->proto;
int ret;
if (info->client)
client = info->client;
else {
- if (info->proto->p_proto == IPPROTO_UDP) {
+ if (info->proto == IPPROTO_UDP) {
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
}
@@ -688,7 +673,7 @@ int rpc_ping_proto(struct conn_info *info)
static unsigned int __rpc_ping(const char *host,
unsigned long version,
- char *proto,
+ int proto,
long seconds, long micros,
unsigned int option)
{
@@ -696,6 +681,7 @@ static unsigned int __rpc_ping(const char *host,
struct conn_info info;
struct pmap parms;
+ info.proto = proto;
info.host = host;
info.addr = NULL;
info.addr_len = 0;
@@ -710,13 +696,9 @@ static unsigned int __rpc_ping(const char *host,
status = RPC_PING_FAIL;
- info.proto = getprotobyname(proto);
- if (!info.proto)
- return status;
-
parms.pm_prog = NFS_PROGRAM;
parms.pm_vers = version;
- parms.pm_prot = info.proto->p_proto;
+ parms.pm_prot = info.proto;
parms.pm_port = 0;
status = rpc_portmap_getport(&info, &parms, &info.port);
@@ -734,19 +716,19 @@ int rpc_ping(const char *host, long seconds, long micros, unsigned int option)
unsigned long vers2 = NFS2_VERSION;
unsigned int status;
- status = __rpc_ping(host, vers2, "udp", seconds, micros, option);
+ status = __rpc_ping(host, vers2, IPPROTO_UDP, seconds, micros, option);
if (status > 0)
return RPC_PING_V2 | RPC_PING_UDP;
- status = __rpc_ping(host, vers3, "udp", seconds, micros, option);
+ status = __rpc_ping(host, vers3, IPPROTO_UDP, seconds, micros, option);
if (status > 0)
return RPC_PING_V3 | RPC_PING_UDP;
- status = __rpc_ping(host, vers2, "tcp", seconds, micros, option);
+ status = __rpc_ping(host, vers2, IPPROTO_TCP, seconds, micros, option);
if (status > 0)
return RPC_PING_V2 | RPC_PING_TCP;
- status = __rpc_ping(host, vers3, "tcp", seconds, micros, option);
+ status = __rpc_ping(host, vers3, IPPROTO_TCP, seconds, micros, option);
if (status > 0)
return RPC_PING_V3 | RPC_PING_TCP;
@@ -769,7 +751,7 @@ int rpc_time(const char *host,
double taken;
struct timeval start, end;
struct timezone tz;
- char *proto = (ping_proto & RPC_PING_UDP) ? "udp" : "tcp";
+ int proto = (ping_proto & RPC_PING_UDP) ? IPPROTO_UDP : IPPROTO_TCP;
unsigned long vers = ping_vers;
gettimeofday(&start, &tz);
@@ -791,12 +773,12 @@ static int rpc_get_exports_proto(struct conn_info *info, exports *exp)
{
CLIENT *client;
enum clnt_stat status;
- int proto = info->proto->p_proto;
+ int proto = info->proto;
unsigned int option = info->close_option;
int vers_entry;
int ret;
- if (info->proto->p_proto == IPPROTO_UDP) {
+ if (info->proto == IPPROTO_UDP) {
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
}
@@ -903,11 +885,9 @@ exports rpc_get_exports(const char *host, long seconds, long micros, unsigned in
parms.pm_port = 0;
/* Try UDP first */
- info.proto = getprotobyname("udp");
- if (!info.proto)
- goto try_tcp;
+ info.proto = IPPROTO_UDP;
- parms.pm_prot = info.proto->p_proto;
+ parms.pm_prot = info.proto;
status = rpc_portmap_getport(&info, &parms, &info.port);
if (status < 0)
@@ -920,11 +900,9 @@ exports rpc_get_exports(const char *host, long seconds, long micros, unsigned in
return exportlist;
try_tcp:
- info.proto = getprotobyname("tcp");
- if (!info.proto)
- return NULL;
+ info.proto = IPPROTO_TCP;
- parms.pm_prot = info.proto->p_proto;
+ parms.pm_prot = info.proto;
status = rpc_portmap_getport(&info, &parms, &info.port);
if (status < 0)
diff --git a/modules/replicated.c b/modules/replicated.c
index 6b96320..dbd5513 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -419,7 +419,7 @@ void free_host_list(struct host **list)
static unsigned int get_nfs_info(unsigned logopt, struct host *host,
struct conn_info *pm_info, struct conn_info *rpc_info,
- const char *proto, unsigned int version, int port)
+ int proto, unsigned int version, int port)
{
unsigned int random_selection = host->options & MOUNT_FLAG_RANDOM_SELECT;
unsigned int use_weight_only = host->options & MOUNT_FLAG_USE_WEIGHT_ONLY;
@@ -433,22 +433,18 @@ static unsigned int get_nfs_info(unsigned logopt, struct host *host,
int status, count = 0;
if (host->addr)
- debug(logopt, "called with host %s(%s) proto %s version 0x%x",
+ debug(logopt, "called with host %s(%s) proto %d version 0x%x",
host->name, get_addr_string(host->addr, buf, len),
proto, version);
else
debug(logopt,
- "called for host %s proto %s version 0x%x",
+ "called for host %s proto %d version 0x%x",
host->name, proto, version);
- rpc_info->proto = getprotobyname(proto);
- if (!rpc_info->proto)
- return 0;
-
+ rpc_info->proto = proto;
memset(&parms, 0, sizeof(struct pmap));
-
parms.pm_prog = NFS_PROGRAM;
- parms.pm_prot = rpc_info->proto->p_proto;
+ parms.pm_prot = proto;
if (!(version & NFS4_REQUESTED))
goto v3_ver;
@@ -479,7 +475,7 @@ static unsigned int get_nfs_info(unsigned logopt, struct host *host,
}
}
- if (rpc_info->proto->p_proto == IPPROTO_UDP)
+ if (rpc_info->proto == IPPROTO_UDP)
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS4_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS4_VERSION);
@@ -540,7 +536,7 @@ v3_ver:
goto v2_ver;
}
- if (rpc_info->proto->p_proto == IPPROTO_UDP)
+ if (rpc_info->proto == IPPROTO_UDP)
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS3_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS3_VERSION);
@@ -587,7 +583,7 @@ v2_ver:
goto done_ver;
}
- if (rpc_info->proto->p_proto == IPPROTO_UDP)
+ if (rpc_info->proto == IPPROTO_UDP)
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS2_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS2_VERSION);
@@ -618,7 +614,7 @@ v2_ver:
}
done_ver:
- if (rpc_info->proto->p_proto == IPPROTO_UDP) {
+ if (rpc_info->proto == IPPROTO_UDP) {
rpc_destroy_udp_client(rpc_info);
rpc_destroy_udp_client(pm_info);
} else {
@@ -675,7 +671,7 @@ static int get_vers_and_cost(unsigned logopt, struct host *host,
if (version & TCP_REQUESTED) {
supported = get_nfs_info(logopt, host,
- &pm_info, &rpc_info, "tcp", vers, port);
+ &pm_info, &rpc_info, IPPROTO_TCP, vers, port);
if (IS_ERR(supported)) {
if (ERR(supported) == EHOSTUNREACH ||
ERR(supported) == ETIMEDOUT)
@@ -688,7 +684,7 @@ static int get_vers_and_cost(unsigned logopt, struct host *host,
if (version & UDP_REQUESTED) {
supported = get_nfs_info(logopt, host,
- &pm_info, &rpc_info, "udp", vers, port);
+ &pm_info, &rpc_info, IPPROTO_UDP, vers, port);
if (IS_ERR(supported)) {
if (!ret && ERR(supported) == ETIMEDOUT)
return ret;
@@ -709,7 +705,7 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
socklen_t len = INET6_ADDRSTRLEN;
char buf[len + 1];
struct conn_info pm_info, rpc_info;
- const char *proto;
+ int proto;
unsigned int vers;
struct timeval start, end;
struct timezone tz;
@@ -748,10 +744,10 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
* So, we do the conversion here.
*/
if (version & UDP_SELECTED_MASK) {
- proto = "udp";
+ proto = IPPROTO_UDP;
version >>= 8;
} else
- proto = "tcp";
+ proto = IPPROTO_TCP;
switch (version) {
case NFS2_SUPPORTED:
@@ -768,9 +764,7 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
return 0;
}
- rpc_info.proto = getprotobyname(proto);
- if (!rpc_info.proto)
- return 0;
+ rpc_info.proto = proto;
if (port > 0)
rpc_info.port = port;
@@ -786,14 +780,14 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
memset(&parms, 0, sizeof(struct pmap));
parms.pm_prog = NFS_PROGRAM;
- parms.pm_prot = rpc_info.proto->p_proto;
+ parms.pm_prot = rpc_info.proto;
parms.pm_vers = vers;
ret = rpc_portmap_getport(&pm_info, &parms, &rpc_info.port);
if (ret < 0)
goto done;
}
- if (rpc_info.proto->p_proto == IPPROTO_UDP)
+ if (rpc_info.proto == IPPROTO_UDP)
status = rpc_udp_getclient(&rpc_info, NFS_PROGRAM, vers);
else
status = rpc_tcp_getclient(&rpc_info, NFS_PROGRAM, vers);
@@ -815,7 +809,7 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
}
}
done:
- if (rpc_info.proto->p_proto == IPPROTO_UDP) {
+ if (rpc_info.proto == IPPROTO_UDP) {
rpc_destroy_udp_client(&rpc_info);
rpc_destroy_udp_client(&pm_info);
} else {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save