--- autofs5-5.0.3.orig/debian/rules +++ autofs5-5.0.3/debian/rules @@ -0,0 +1,58 @@ +#!/usr/bin/make -f + +.PHONY: clean build install binary binary-indep binary-arch + +clean: + dh_testdir + dh_testroot + rm -f build.stamp install.stamp + $(MAKE) distclean + dpatch deapply-all + dh_clean + +build: build.stamp +build.stamp: + dh_testdir + dpatch apply-all + ./configure --prefix=/usr \ + --with-confdir=/etc/default --mandir=/usr/share/man \ + --with-mapdir=/etc --with-hesiod --with-ldap --with-sasl \ + --enable-force-shutdown --enable-ignore-busy + chmod 0751 debian/configure_override + debian/configure_override HAVE_MODPROBE + debian/configure_override PATH_MODPROBE \"/sbin/modprobe\" + debian/configure_override HAVE_LINUX_PROCFS + $(MAKE) + touch build.stamp + +install: install.stamp +install.stamp: build + dh_testdir + dh_testroot + dh_clean + $(MAKE) DESTDIR=../debian/autofs5 install + dh_installdirs + mv debian/autofs5/etc/auto.* debian/autofs5/usr/share/autofs5/conffiles/ + mv debian/autofs5/etc/default/autofs debian/autofs5/usr/share/autofs5/conffiles/default.autofs5 + mv debian/autofs5/usr/lib/autofs/lookup_ldap* debian/autofs5-ldap/usr/lib/autofs/ + mv debian/autofs5/usr/lib/autofs/*_hesiod* debian/autofs5-hesiod/usr/lib/autofs/ + mv debian/autofs5/etc/autofs_ldap_auth.conf debian/autofs5-ldap/etc/ + +binary: binary-arch binary-indep +binary-arch: install + dh_testdir + dh_testroot + dh_install + dh_installchangelogs CHANGELOG + dh_installdocs + dh_installinit -pautofs5 -o --name=autofs -- start 19 2 3 4 5 . stop 81 0 1 6 . + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary-indep: --- autofs5-5.0.3.orig/debian/changelog +++ autofs5-5.0.3/debian/changelog @@ -0,0 +1,53 @@ +autofs5 (5.0.3-3) unstable; urgency=high + + * Link ldap module against libssl, too. Closes: #490352. + * High urgency due to RC bugfix and no other changes. + + -- Jan Christoph Nordholz Fri, 11 Jul 2008 18:07:16 +0200 + +autofs5 (5.0.3-2) unstable; urgency=low + + * Update upstream patchset (2008/06/12) - five new patches. + * Bump Standards version to 3.8.0, debhelper to v7. + * Link ldap module against kerberos. Closes: #485470. + * /dev/urandom is sufficiently random for our purpose - use it + instead of /dev/random, which might block. Closes: #481257. + * Add watch file. + + -- Jan Christoph Nordholz Thu, 12 Jun 2008 22:24:27 +0200 + +autofs5 (5.0.3-1) unstable; urgency=low + + * Upload to unstable. + * New upstream version 5.0.3 plus current patchset (as of 2008/04/27). + * Bump Standards to 3.7.3, debhelper to v6. + * Add build-dependency on libxml2-dev. + + -- Jan Christoph Nordholz Mon, 28 Apr 2008 15:55:37 +0200 + +autofs5 (5.0.2-2) experimental; urgency=low + + * Work around configure's automatic detection attempts of /sbin/modprobe + and the /proc filesystem. In the former case, this saves us an + unnecessary build-dependency. + This should get the autobuilders going. + * Add Recommends: module-init-tools in accordance with #416597. + + -- Jan Christoph Nordholz Tue, 17 Jul 2007 13:33:12 +0200 + +autofs5 (5.0.2-1) experimental; urgency=low + + * Initial release: + * Upstream autofs 5.0.2 including the patches: + autofs-5.0.2-add-krb5-include + autofs-5.0.2-bad-proto-init + autofs-5.0.2-add-missing-multi-support + autofs-5.0.2-add-multi-nsswitch-lookup + * Own patches: + * Add LSB header to initscript. + * Configure the default auto.master location to be in /etc. + * Build the usual package triplet (plain, -ldap and -hesiod). + * Build the ldap module with SASL support. + * Be cautious and upload to experimental. + + -- Jan Christoph Nordholz Fri, 06 Jul 2007 19:26:12 +0200 --- autofs5-5.0.3.orig/debian/autofs5.dirs +++ autofs5-5.0.3/debian/autofs5.dirs @@ -0,0 +1 @@ +usr/share/autofs5/conffiles --- autofs5-5.0.3.orig/debian/autofs5-hesiod.dirs +++ autofs5-5.0.3/debian/autofs5-hesiod.dirs @@ -0,0 +1 @@ +usr/lib/autofs --- autofs5-5.0.3.orig/debian/autofs5-ldap.dirs +++ autofs5-5.0.3/debian/autofs5-ldap.dirs @@ -0,0 +1,3 @@ +usr/lib/autofs +etc +etc/ldap --- autofs5-5.0.3.orig/debian/autofs5.postinst +++ autofs5-5.0.3/debian/autofs5.postinst @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ "$1" = "configure" ]; then + ucfr autofs5 /etc/auto.master + ucfr autofs5 /etc/auto.net + ucfr autofs5 /etc/auto.misc + ucfr autofs5 /etc/auto.smb + ucfr autofs5 /etc/default.autofs5 + + ucf /usr/share/autofs5/conffiles/auto.master /etc/auto.master + ucf /usr/share/autofs5/conffiles/auto.net /etc/auto.net + ucf /usr/share/autofs5/conffiles/auto.misc /etc/auto.misc + ucf /usr/share/autofs5/conffiles/auto.smb /etc/auto.smb + ucf /usr/share/autofs5/conffiles/default.autofs5 /etc/default/autofs +fi + +#DEBHELPER# --- autofs5-5.0.3.orig/debian/configure_override +++ autofs5-5.0.3/debian/configure_override @@ -0,0 +1,13 @@ +#!/bin/bash + +test -n include/config.h || exit 1 + +cat - <>include/config.h + +/* override by Debian build system */ +#ifndef $1 +# define $1 $2 +#endif /* $1 */ +EOF + +exit 0 --- autofs5-5.0.3.orig/debian/autofs5.postrm +++ autofs5-5.0.3/debian/autofs5.postrm @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ "$1" = "purge" ]; then + for CONFF in /etc/auto.master /etc/auto.net /etc/auto.misc /etc/auto.smb /etc/default/autofs; do + ucfr -p autofs5 $CONFF + ucf --purge $CONFF + rm -f $CONFF $CONFF.ucf-dist $CONFF.ucf-old $CONFF.ucf-new + done +fi + +#DEBHELPER# --- autofs5-5.0.3.orig/debian/copyright +++ autofs5-5.0.3/debian/copyright @@ -0,0 +1,66 @@ +This is the experimental (v5) branch of the automount daemon which can be +retrieved at ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5/. +Development is taking place at the autofs kernel.org mailing list, available +at http://linux.kernel.org/mailman/listinfo/autofs. + +It was packaged for Debian (and is presently maintained) by Jan Christoph +Nordholz . + +Copyright holder: Transmeta Corporation + +License (exceptions listed below): + Copyright (C) 1997-2000 Transmeta Corporation -- All Rights Reserved + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA; either version 2 of the License, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + Portions Copyright (C) 1999-2000 Jeremy Fitzhardinge + Portions Copyright (C) 2001-2005 Ian Kent + +License for lib/syslog.c and lib/syslog.h: + Copyright (C) 1983,1988,1993 + The Regents of the University of California. All rights reserved. + + These files are licensed under the BSD License. + +License for modules/cyrus-sasl.c: + Copyright (C) 2005 Red Hat, Inc. -- All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Red Hat, Inc., nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +On Debian systems, the complete text of the GNU General Public License +can be found in the file /usr/share/common-licenses/GPL. + +On Debian systems, the complete text of the BSD License can be found in the file +/usr/share/common-licenses/BSD. --- autofs5-5.0.3.orig/debian/compat +++ autofs5-5.0.3/debian/compat @@ -0,0 +1 @@ +7 --- autofs5-5.0.3.orig/debian/autofs5-ldap.install +++ autofs5-5.0.3/debian/autofs5-ldap.install @@ -0,0 +1,2 @@ +samples/autofs.schema etc/ldap/ +samples/ldap* usr/share/doc/autofs5-ldap/examples/ --- autofs5-5.0.3.orig/debian/autofs5.install +++ autofs5-5.0.3/debian/autofs5.install @@ -0,0 +1,3 @@ +README usr/share/doc/autofs5/ +README.[cnrsv]* usr/share/doc/autofs5/ +CREDITS usr/share/doc/autofs5/ --- autofs5-5.0.3.orig/debian/control +++ autofs5-5.0.3/debian/control @@ -0,0 +1,61 @@ +Source: autofs5 +Section: utils +Priority: extra +Maintainer: Jan Christoph Nordholz +Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 7), dpatch, autoconf, flex, bison, libhesiod-dev, libldap-dev, libsasl2-dev, libssl-dev, libkrb5-dev, libxml2-dev + +Package: autofs5 +Architecture: any +Depends: ${shlibs:Depends}, ucf +Provides: autofs +Conflicts: autofs +Replaces: autofs +Recommends: nfs-common, module-init-tools +Description: kernel-based automounter for Linux, version 5 + Autofs controls the operation of the automount daemons. The + automount daemons automatically mount filesystems when they + are used and unmount them after a period of inactivity. This + is done based on a set of pre-configured maps. + . + The kernel automounter implements an almost complete SunOS + style automounter under Linux. A recent version of the kernel + autofs4 module (builtin or separate) is required. + . + This is the experimental branch of the autofs daemon. + +Package: autofs5-ldap +Architecture: any +Depends: ${shlibs:Depends}, autofs5 +Provides: autofs-ldap +Conflicts: autofs-ldap +Replaces: autofs-ldap +Description: LDAP map support for autofs, version 5 + Autofs controls the operation of the automount daemons. The + automount daemons automatically mount filesystems when they + are used and unmount them after a period of inactivity. This + is done based on a set of pre-configured maps. + . + The kernel automounter implements an almost complete SunOS + style automounter under Linux. A recent version of the kernel + autofs4 module (builtin or separate) is required. + . + This is the LDAP module of the autofs experimental branch. + +Package: autofs5-hesiod +Architecture: any +Depends: ${shlibs:Depends}, autofs5 +Provides: autofs-hesiod +Conflicts: autofs-hesiod +Replaces: autofs-hesiod +Description: Hesiod map support for autofs, version 5 + Autofs controls the operation of the automount daemons. The + automount daemons automatically mount filesystems when they + are used and unmount them after a period of inactivity. This + is done based on a set of pre-configured maps. + . + The kernel automounter implements an almost complete SunOS + style automounter under Linux. A recent version of the kernel + autofs4 module (builtin or separate) is required. + . + This is the Hesiod module of the autofs experimental branch. --- autofs5-5.0.3.orig/debian/watch +++ autofs5-5.0.3/debian/watch @@ -0,0 +1,2 @@ +version=3 +ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5/autofs-(5[^-]*)\.tar\.bz2 --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-nfs4-tcp-only.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-nfs4-tcp-only.patch @@ -0,0 +1,31 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-nfs4-tcp-only.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index b172579..5a85a8e 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -3,6 +3,7 @@ + - correct configure test for ldapr page control functions. + - catch "-xfn" map type and issue "no supported" message. + - correction for handling of LDAP base dns with spaces. ++- avoid using UDP for probing NFSv4 mount requests. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c +index 0e7aebe..df01fd6 100644 +--- a/modules/mount_nfs.c ++++ b/modules/mount_nfs.c +@@ -129,7 +129,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + } + + if (strcmp(fstype, "nfs4") == 0) +- vers = NFS4_VERS_MASK | NFS_PROTO_MASK; ++ vers = NFS4_VERS_MASK | TCP_SUPPORTED; + else + vers = NFS_VERS_MASK | NFS_PROTO_MASK; + --- autofs5-5.0.3.orig/debian/patches/00list +++ autofs5-5.0.3/debian/patches/00list @@ -0,0 +1,25 @@ +01UPSTREAM_autofs-5.0.3-ldap-page-control-configure-fix.patch +01UPSTREAM_autofs-5.0.3-xfn-not-supported.patch +01UPSTREAM_autofs-5.0.3-basedn-with-spaces-fix-3.patch +01UPSTREAM_autofs-5.0.3-nfs4-tcp-only.patch +01UPSTREAM_autofs-5.0.3-correct-ldap-lib.patch +01UPSTREAM_autofs-5.0.3-dont-fail-on-empty-master-fix-2.patch +01UPSTREAM_autofs-5.0.3-expire-works-too-hard.patch +01UPSTREAM_autofs-5.0.3-unlink-mount-return-fix.patch +01UPSTREAM_autofs-5.0.3-update-linux-auto_fs4-h.patch +01UPSTREAM_autofs-5.0.3-expire-works-too-hard-update.patch +01UPSTREAM_autofs-5.0.3-expire-works-too-hard-update-2.patch +01UPSTREAM_autofs-5.0.3-handle-zero-length-nis-key.patch +01UPSTREAM_autofs-5.0.2-init-cb-on-load.patch +01UPSTREAM_autofs-5.0.3-map-type-in-map-name.patch +01UPSTREAM_autofs-5.0.3-mount-thread-create-cond-handling.patch +01UPSTREAM_autofs-5.0.3-check-for-kernel-automount.patch +01UPSTREAM_autofs-5.0.3-nss-source-any.patch +01UPSTREAM_autofs-5.0.3-dont-abuse-ap-ghost-field.patch +01UPSTREAM_autofs-5.0.3-lookup-next-soucre-stale-entry.patch +01UPSTREAM_autofs-5.0.3-remove-redundant-dns-name-lookups.patch +10lsb_initscript +11default_automaster_location +12disable_default_auto_master +13ldap_module_linkage +14dev_urandom_is_fine --- autofs5-5.0.3.orig/debian/patches/patch_order-5.0.3 +++ autofs5-5.0.3/debian/patches/patch_order-5.0.3 @@ -0,0 +1,20 @@ +autofs-5.0.3-ldap-page-control-configure-fix.patch +autofs-5.0.3-xfn-not-supported.patch +autofs-5.0.3-basedn-with-spaces-fix-3.patch +autofs-5.0.3-nfs4-tcp-only.patch +autofs-5.0.3-correct-ldap-lib.patch +autofs-5.0.3-dont-fail-on-empty-master-fix-2.patch +autofs-5.0.3-expire-works-too-hard.patch +autofs-5.0.3-unlink-mount-return-fix.patch +autofs-5.0.3-update-linux-auto_fs4-h.patch +autofs-5.0.3-expire-works-too-hard-update.patch +autofs-5.0.3-expire-works-too-hard-update-2.patch +autofs-5.0.3-handle-zero-length-nis-key.patch +autofs-5.0.2-init-cb-on-load.patch +autofs-5.0.3-map-type-in-map-name.patch +autofs-5.0.3-mount-thread-create-cond-handling.patch +autofs-5.0.3-check-for-kernel-automount.patch +autofs-5.0.3-nss-source-any.patch +autofs-5.0.3-dont-abuse-ap-ghost-field.patch +autofs-5.0.3-lookup-next-soucre-stale-entry.patch +autofs-5.0.3-remove-redundant-dns-name-lookups.patch --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-dont-abuse-ap-ghost-field.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-dont-abuse-ap-ghost-field.patch @@ -0,0 +1,88 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-dont-abuse-ap-ghost-field.patch +## DP: Supplied by upstream. + +@DPATCH@ + + +autofs-5.0.3 - don't abuse the ap->ghost field on NFS mount + +From: Ian Kent + +Using the ap->ghost field in the autofs mount point struct, to prevent +the mount point directory from being removed, when attempting a bind +mount when an NFS mount is local may lead to incorrectly reading and +ghosting the map. This can happen if a mount request comes in during +a map re-read when the autofs map doesn't have the browse option set. +This patch corrects that by using the existence check in the bind mount +module instead of the hack of changing the struct field. +--- + + modules/mount_bind.c | 2 +- + modules/mount_nfs.c | 11 ----------- + 2 files changed, 1 insertions(+), 12 deletions(-) + + +diff --git a/modules/mount_bind.c b/modules/mount_bind.c +index ef973e1..e4a04d0 100644 +--- a/modules/mount_bind.c ++++ b/modules/mount_bind.c +@@ -144,7 +144,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + if (ap->type != LKP_INDIRECT) + return 1; + +- if ((!ap->ghost && name_len) || !existed) ++ if ((!ap->ghost && name_len) && !existed) + rmdir_path(ap, fullpath, ap->dev); + + return err; +diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c +index 1855ea9..d7f42a7 100644 +--- a/modules/mount_nfs.c ++++ b/modules/mount_nfs.c +@@ -62,7 +62,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + { + char *fullpath, buf[MAX_ERR_BUF]; + struct host *this, *hosts = NULL; +- unsigned int save_ghost = ap->ghost; + unsigned int vers; + char *nfsoptions = NULL; + int len, rlen, status, err, existed = 1; +@@ -186,13 +185,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + if (!status) + existed = 0; + +- /* +- * We need to stop the bind mount module from removing the +- * mount point directory if a bind attempt fails so abuse +- * the ap->ghost field for this. +- */ +- ap->ghost = 1; +- + this = hosts; + while (this) { + char *loc, *port_opt = NULL; +@@ -229,7 +221,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + /* Success - we're done */ + if (!err) { + free_host_list(&hosts); +- ap->ghost = save_ghost; + return 0; + } + +@@ -271,7 +262,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + info(ap->logopt, MODPREFIX "mounted %s on %s", loc, fullpath); + free(loc); + free_host_list(&hosts); +- ap->ghost = save_ghost; + return 0; + } + +@@ -281,7 +271,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int + + forced_fail: + free_host_list(&hosts); +- ap->ghost = save_ghost; + + /* If we get here we've failed to complete the mount */ + --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-basedn-with-spaces-fix-3.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-basedn-with-spaces-fix-3.patch @@ -0,0 +1,31 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-basedn-with-spaces-fix-3.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index 8d09e93..b172579 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -2,6 +2,7 @@ + ----------------------- + - correct configure test for ldapr page control functions. + - catch "-xfn" map type and issue "no supported" message. ++- correction for handling of LDAP base dns with spaces. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/lib/master_tok.l b/lib/master_tok.l +index 2a6fdf9..7f1de90 100644 +--- a/lib/master_tok.l ++++ b/lib/master_tok.l +@@ -289,7 +289,7 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo + return EQUAL; + } + +- {DNNAMESTR1}/"," { ++ {DNNAMESTR1}/","{DNATTRSTR}"=" { + strcpy(master_lval.strtype, master_text); + return DNNAME; + } --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-update-linux-auto_fs4-h.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-update-linux-auto_fs4-h.patch @@ -0,0 +1,76 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-update-linux-auto_fs4-h.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index a0c7fa3..40ac2f8 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -8,6 +8,7 @@ + - another fix for don't fail on empty master map. + - fix expire working harder than needed. + - fix unlink of mount tree incorrectly causing autofs mount fail. ++- update kernel header file linux/auto_fs4.h. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/daemon/automount.c b/daemon/automount.c +index afbcb56..7ce9828 100644 +--- a/daemon/automount.c ++++ b/daemon/automount.c +@@ -890,7 +890,7 @@ static int set_log_priority(const char *path, int priority) + return 0; + } + +-static int get_pkt(struct autofs_point *ap, union autofs_packet_union *pkt) ++static int get_pkt(struct autofs_point *ap, union autofs_v5_packet_union *pkt) + { + struct pollfd fds[3]; + int pollfds = 3; +@@ -1074,7 +1074,7 @@ static int mount_autofs(struct autofs_point *ap) + + static int handle_packet(struct autofs_point *ap) + { +- union autofs_packet_union pkt; ++ union autofs_v5_packet_union pkt; + + if (get_pkt(ap, &pkt)) + return -1; +diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h +index 0a6bc52..31a2954 100644 +--- a/include/linux/auto_fs4.h ++++ b/include/linux/auto_fs4.h +@@ -59,6 +59,13 @@ struct autofs_packet_expire_multi { + char name[NAME_MAX+1]; + }; + ++union autofs_packet_union { ++ struct autofs_packet_hdr hdr; ++ struct autofs_packet_missing missing; ++ struct autofs_packet_expire expire; ++ struct autofs_packet_expire_multi expire_multi; ++}; ++ + /* autofs v5 common packet struct */ + struct autofs_v5_packet { + struct autofs_packet_hdr hdr; +@@ -78,12 +85,13 @@ typedef struct autofs_v5_packet autofs_packet_expire_indirect_t; + typedef struct autofs_v5_packet autofs_packet_missing_direct_t; + typedef struct autofs_v5_packet autofs_packet_expire_direct_t; + +-union autofs_packet_union { ++union autofs_v5_packet_union { + struct autofs_packet_hdr hdr; +- struct autofs_packet_missing missing; +- struct autofs_packet_expire expire; +- struct autofs_packet_expire_multi expire_multi; + struct autofs_v5_packet v5_packet; ++ autofs_packet_missing_indirect_t missing_indirect; ++ autofs_packet_expire_indirect_t expire_indirect; ++ autofs_packet_missing_direct_t missing_direct; ++ autofs_packet_expire_direct_t expire_direct; + }; + + #define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int) --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-ldap-page-control-configure-fix.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-ldap-page-control-configure-fix.patch @@ -0,0 +1,412 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-ldap-page-control-configure-fix.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index 624fe9e..98855f5 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,3 +1,7 @@ ++??/??/2008 autofs-5.0.4 ++----------------------- ++- correct configure test for ldapr page control functions. ++ + 14/01/2008 autofs-5.0.3 + ----------------------- + - include krb5.h in lookup_ldap.h (some openssl doesn't implicitly include it). +diff --git a/aclocal.m4 b/aclocal.m4 +index 118ef0d..f24e076 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -222,3 +222,69 @@ AC_TRY_LINK( + LDFLAGS="$af_check_hesiod_save_ldflags" + ]) + ++dnl -------------------------------------------------------------------------- ++dnl AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL ++dnl ++dnl Check for function ldap_create_page_control ++dnl -------------------------------------------------------------------------- ++AC_DEFUN([AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL], ++[AC_MSG_CHECKING(for ldap_create_page_control in -lldap) ++ ++# save current ldflags ++af_check_ldap_create_page_control_save_ldflags="$LDFLAGS" ++LDFLAGS="$LDFLAGS -lldap_r" ++ ++AC_TRY_LINK( ++ [ #include ], ++ [ LDAP *ld; ++ ber_int_t ps; ++ struct berval *c; ++ int ic, ret; ++ LDAPControl **clp; ++ ret = ldap_create_page_control(ld,ps,c,ic,clp); ], ++ [ af_have_ldap_create_page_control=yes ++ AC_MSG_RESULT(yes) ], ++ [ AC_MSG_RESULT(no) ]) ++ ++if test "$af_have_ldap_create_page_control" = "yes"; then ++ AC_DEFINE(HAVE_LDAP_CREATE_PAGE_CONTROL, 1, ++ [Define to 1 if you have the `ldap_create_page_control' function.]) ++fi ++ ++# restore ldflags ++LDFLAGS="$af_check_ldap_create_page_control_save_ldflags" ++]) ++ ++dnl -------------------------------------------------------------------------- ++dnl AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL ++dnl ++dnl Check for function ldap_parse_page_control ++dnl -------------------------------------------------------------------------- ++AC_DEFUN([AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL], ++[AC_MSG_CHECKING(for ldap_parse_page_control in -lldap) ++ ++# save current ldflags ++af_check_ldap_parse_page_control_save_ldflags="$LDFLAGS" ++LDFLAGS="$LDFLAGS -lldap_r" ++ ++AC_TRY_LINK( ++ [ #include ], ++ [ LDAP *ld; ++ ber_int_t ct; ++ struct berval *c; ++ int ret; ++ LDAPControl **clp; ++ ret = ldap_parse_page_control(ld,clp,ct,c); ], ++ [ af_have_ldap_parse_page_control=yes ++ AC_MSG_RESULT(yes) ], ++ [ AC_MSG_RESULT(no) ]) ++ ++if test "$af_have_ldap_create_page_control" = "yes"; then ++ AC_DEFINE(HAVE_LDAP_PARSE_PAGE_CONTROL, 1, ++ [Define to 1 if you have the `ldap_parse_page_control' function.]) ++fi ++ ++# restore ldflags ++LDFLAGS="$af_check_ldap_parse_page_control_save_ldflags" ++]) ++ +diff --git a/configure b/configure +index d212b05..e872392 100755 +--- a/configure ++++ b/configure +@@ -3631,7 +3631,7 @@ if test "${with_hesiod+set}" = set; then + fi + + +-if test -z "$HAVE_HESIOD" ++if test -z "$HAVE_HESIOD" -o "$HAVE_HESIOD" != "0" + then + HAVE_HESIOD=0 + { echo "$as_me:$LINENO: checking for libhesiod" >&5 +@@ -4498,7 +4498,7 @@ if test "${with_openldap+set}" = set; then + + fi + +-if test -z "$HAVE_LDAP"; then ++if test -z "$HAVE_LDAP" -o "$HAVE_LDAP" != "0"; then + HAVE_LDAP=0 + LDAP_FLAGS="$LDAP_FLAGS -DLDAP_DEPRECATED=1" + { echo "$as_me:$LINENO: checking for ldap_initialize in -lldap" >&5 +@@ -4566,71 +4566,106 @@ if test $ac_cv_lib_ldap_ldap_initialize = yes; then + HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap_r -llber -lresolv" + fi + +- if test "$HAVE_LDAP" == "1"; then ++ if test "$HAVE_LDAP" = "1"; then + + cat >>confdefs.h <<\_ACEOF + #define WITH_LDAP 1 + _ACEOF + + fi ++ { echo "$as_me:$LINENO: checking for ldap_create_page_control in -lldap" >&5 ++echo $ECHO_N "checking for ldap_create_page_control in -lldap... $ECHO_C" >&6; } ++ ++# save current ldflags ++af_check_ldap_create_page_control_save_ldflags="$LDFLAGS" ++LDFLAGS="$LDFLAGS -lldap_r" ++ ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ #include ++int ++main () ++{ ++ LDAP *ld; ++ ber_int_t ps; ++ struct berval *c; ++ int ic, ret; ++ LDAPControl **clp; ++ ret = ldap_create_page_control(ld,ps,c,ic,clp); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (ac_try="$ac_link" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_link") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest$ac_exeext && ++ $as_test_x conftest$ac_exeext; then ++ af_have_ldap_create_page_control=yes ++ { echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6; } ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ { echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6; } + fi + ++rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ ++ conftest$ac_exeext conftest.$ac_ext + ++if test "$af_have_ldap_create_page_control" = "yes"; then + ++cat >>confdefs.h <<\_ACEOF ++#define HAVE_LDAP_CREATE_PAGE_CONTROL 1 ++_ACEOF + +-LDFLAGS="${AF_tmp_ldflags}" ++fi + ++# restore ldflags ++LDFLAGS="$af_check_ldap_create_page_control_save_ldflags" + ++ { echo "$as_me:$LINENO: checking for ldap_parse_page_control in -lldap" >&5 ++echo $ECHO_N "checking for ldap_parse_page_control in -lldap... $ECHO_C" >&6; } + +-for ac_func in ldap_create_page_control ldap_parse_page_control +-do +-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +-{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then +- echo $ECHO_N "(cached) $ECHO_C" >&6 +-else +- cat >conftest.$ac_ext <<_ACEOF ++# save current ldflags ++af_check_ldap_parse_page_control_save_ldflags="$LDFLAGS" ++LDFLAGS="$LDFLAGS -lldap_r" ++ ++cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ +-/* Define $ac_func to an innocuous variant, in case declares $ac_func. +- For example, HP-UX 11i declares gettimeofday. */ +-#define $ac_func innocuous_$ac_func +- +-/* System header to define __stub macros and hopefully few prototypes, +- which can conflict with char $ac_func (); below. +- Prefer to if __STDC__ is defined, since +- exists even on freestanding compilers. */ +- +-#ifdef __STDC__ +-# include +-#else +-# include +-#endif +- +-#undef $ac_func +- +-/* 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 $ac_func (); +-/* 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_$ac_func || defined __stub___$ac_func +-choke me +-#endif +- ++ #include + int + main () + { +-return $ac_func (); ++ LDAP *ld; ++ ber_int_t ct; ++ struct berval *c; ++ int ret; ++ LDAPControl **clp; ++ ret = ldap_parse_page_control(ld,clp,ct,c); + ; + return 0; + } +@@ -4653,28 +4688,37 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then +- eval "$as_ac_var=yes" ++ af_have_ldap_parse_page_control=yes ++ { echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6; } + else + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + +- eval "$as_ac_var=no" ++ { echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6; } + fi + + rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +-fi +-ac_res=`eval echo '${'$as_ac_var'}'` +- { echo "$as_me:$LINENO: result: $ac_res" >&5 +-echo "${ECHO_T}$ac_res" >&6; } +-if test `eval echo '${'$as_ac_var'}'` = yes; then +- cat >>confdefs.h <<_ACEOF +-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 ++ ++if test "$af_have_ldap_create_page_control" = "yes"; then ++ ++cat >>confdefs.h <<\_ACEOF ++#define HAVE_LDAP_PARSE_PAGE_CONTROL 1 + _ACEOF + + fi +-done + ++# restore ldflags ++LDFLAGS="$af_check_ldap_parse_page_control_save_ldflags" ++ ++fi ++ ++ ++ ++ ++LDFLAGS="${AF_tmp_ldflags}" + + # + # SASL support +@@ -4703,7 +4747,7 @@ if test "${with_sasl+set}" = set; then + + fi + +-if test -z "$HAVE_SASL" -a "$HAVE_LIBXML" == "1" ++if test -z "$HAVE_SASL" -o "$HAVE_SASL" != "0" -a "$HAVE_LIBXML" == "1" + then + HAVE_SASL=0 + { echo "$as_me:$LINENO: checking for sasl_client_start in -lsasl2" >&5 +diff --git a/configure.in b/configure.in +index 952d040..a9c86dd 100644 +--- a/configure.in ++++ b/configure.in +@@ -155,7 +155,7 @@ AC_ARG_WITH(hesiod, + fi + ) + +-if test -z "$HAVE_HESIOD" ++if test -z "$HAVE_HESIOD" -o "$HAVE_HESIOD" != "0" + then + HAVE_HESIOD=0 + AF_CHECK_LIBHESIOD() +@@ -194,15 +194,17 @@ AC_ARG_WITH(openldap, + LDAP_FLAGS="-I${withval}/include" + fi + ) +-if test -z "$HAVE_LDAP"; then ++if test -z "$HAVE_LDAP" -o "$HAVE_LDAP" != "0"; then + HAVE_LDAP=0 + LDAP_FLAGS="$LDAP_FLAGS -DLDAP_DEPRECATED=1" + AC_CHECK_LIB(ldap, ldap_initialize, HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap_r -llber -lresolv", , + -llber -lresolv $LIBS) +- if test "$HAVE_LDAP" == "1"; then ++ if test "$HAVE_LDAP" = "1"; then + AC_DEFINE(WITH_LDAP,1, + [Define if using LDAP as a source of automount maps]) + fi ++ AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL() ++ AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL() + fi + + AC_SUBST(LDAP_FLAGS) +@@ -210,8 +212,6 @@ AC_SUBST(HAVE_LDAP) + AC_SUBST(LIBLDAP) + LDFLAGS="${AF_tmp_ldflags}" + +-AC_CHECK_FUNCS(ldap_create_page_control ldap_parse_page_control) +- + # + # SASL support + # configure magic taken from: +@@ -236,7 +236,7 @@ AC_ARG_WITH(sasl, + SASL_FLAGS="-I${withval}/include" + fi + ) +-if test -z "$HAVE_SASL" -a "$HAVE_LIBXML" == "1" ++if test -z "$HAVE_SASL" -o "$HAVE_SASL" != "0" -a "$HAVE_LIBXML" == "1" + then + HAVE_SASL=0 + AC_CHECK_LIB(sasl2, sasl_client_start, HAVE_SASL=1 LIBSASL="$LIBSASL -lsasl2", , -lsasl2 $LIBS) +diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c +index 0723fd8..e8530f6 100644 +--- a/modules/lookup_ldap.c ++++ b/modules/lookup_ldap.c +@@ -55,7 +55,7 @@ struct ldap_search_params { + char *query, **attrs; + struct berval *cookie; + int morePages; +- unsigned int totalCount; ++ ber_int_t totalCount; + LDAPMessage *result; + time_t age; + }; +@@ -63,7 +63,7 @@ struct ldap_search_params { + static LDAP *auth_init(unsigned logopt, const char *, struct lookup_context *); + + #ifndef HAVE_LDAP_CREATE_PAGE_CONTROL +-int ldap_create_page_control(LDAP *ldap, unsigned int pagesize, ++int ldap_create_page_control(LDAP *ldap, ber_int_t pagesize, + struct berval *cookie, char isCritical, + LDAPControl **output) + { +@@ -93,7 +93,7 @@ int ldap_create_page_control(LDAP *ldap, unsigned int pagesize, + + #ifndef HAVE_LDAP_PARSE_PAGE_CONTROL + int ldap_parse_page_control(LDAP *ldap, LDAPControl **controls, +- unsigned int *totalcount, struct berval **cookie) ++ ber_int_t *totalcount, struct berval **cookie) + { + int i, rc; + BerElement *theBer; +@@ -1644,7 +1644,7 @@ static int do_paged_query(struct ldap_search_params *sp, struct lookup_context * + struct autofs_point *ap = sp->ap; + LDAPControl *pageControl=NULL, *controls[2] = { NULL, NULL }; + LDAPControl **returnedControls = NULL; +- static unsigned long pageSize = 1000; ++ static ber_int_t pageSize = 1000; + static char pagingCriticality = 'T'; + int rv, scope = LDAP_SCOPE_SUBTREE; + --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-dont-fail-on-empty-master-fix-2.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-dont-fail-on-empty-master-fix-2.patch @@ -0,0 +1,58 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-dont-fail-on-empty-master-fix-2.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index e393f33..033923d 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -5,6 +5,7 @@ + - correction for handling of LDAP base dns with spaces. + - avoid using UDP for probing NFSv4 mount requests. + - use libldap instead of libldap_r (Guillaume Rousse). ++- another fix for don't fail on empty master map. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/lib/master.c b/lib/master.c +index ed82131..4a34dd4 100644 +--- a/lib/master.c ++++ b/lib/master.c +@@ -799,21 +799,13 @@ int master_read_master(struct master *master, time_t age, int readall) + + master_init_scan(); + +- if (!lookup_nss_read_master(master, age)) { +- error(logopt, +- "can't read master map %s", master->name); +- return 0; +- } +- ++ lookup_nss_read_master(master, age); + master_mount_mounts(master, age, readall); + + master_mutex_lock(); + +- if (list_empty(&master->mounts)) { +- master_mutex_unlock(); ++ if (list_empty(&master->mounts)) + warn(logopt, "no mounts in table"); +- return 1; +- } + + master_mutex_unlock(); + +diff --git a/modules/lookup_file.c b/modules/lookup_file.c +index b01eea6..466690a 100644 +--- a/modules/lookup_file.c ++++ b/modules/lookup_file.c +@@ -475,6 +475,7 @@ int lookup_read_master(struct master *master, time_t age, void *context) + "failed to read included master map %s", + master->name); + if (!master->recurse) { ++ master->name = save_name; + master->depth--; + master->recurse = 0; + fclose(f); --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.2-init-cb-on-load.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.2-init-cb-on-load.patch @@ -0,0 +1,147 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.2-init-cb-on-load.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index c221c13..af5a1b0 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -11,6 +11,7 @@ + - update kernel header file linux/auto_fs4.h. + - update fix expire working harder than needed. + - add missing check for zero length NIS key (Wengang Wang). ++- init SASL callbacks on every ldap lookup library load. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/include/lookup_ldap.h b/include/lookup_ldap.h +index d6a754d..908ed09 100644 +--- a/include/lookup_ldap.h ++++ b/include/lookup_ldap.h +@@ -99,10 +99,12 @@ int unbind_ldap_connection(unsigned logopt, LDAP *ldap, struct lookup_context *c + int authtype_requires_creds(const char *authtype); + + /* cyrus-sasl.c */ ++int autofs_sasl_client_init(unsigned logopt); + int autofs_sasl_init(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt); + int autofs_sasl_bind(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt); + void autofs_sasl_unbind(struct lookup_context *ctxt); +-void autofs_sasl_done(struct lookup_context *ctxt); ++void autofs_sasl_dispose(struct lookup_context *ctxt); ++void autofs_sasl_done(void); + #endif + + #endif +diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c +index f24f46b..902d9aa 100644 +--- a/modules/cyrus-sasl.c ++++ b/modules/cyrus-sasl.c +@@ -76,7 +76,6 @@ static const char *default_client = "autofsclient"; + static pthread_mutex_t krb5cc_mutex = PTHREAD_MUTEX_INITIALIZER; + static unsigned int krb5cc_in_use = 0; + +-static unsigned int init_callbacks = 1; + static int sasl_log_func(void *, int, const char *); + static int getpass_func(sasl_conn_t *, void *, int, sasl_secret_t **); + static int getuser_func(void *, int, const char **, unsigned *); +@@ -878,13 +877,6 @@ autofs_sasl_init(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt) + { + sasl_conn_t *conn; + +- /* Start up Cyrus SASL--only needs to be done once. */ +- if (init_callbacks && sasl_client_init(callbacks) != SASL_OK) { +- error(logopt, "sasl_client_init failed"); +- return -1; +- } +- init_callbacks = 0; +- + sasl_auth_id = ctxt->user; + sasl_auth_secret = ctxt->secret; + +@@ -916,8 +908,7 @@ autofs_sasl_init(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt) + * Destructor routine. This should be called when finished with an ldap + * session. + */ +-void +-autofs_sasl_done(struct lookup_context *ctxt) ++void autofs_sasl_dispose(struct lookup_context *ctxt) + { + int status, ret; + +@@ -953,3 +944,28 @@ autofs_sasl_done(struct lookup_context *ctxt) + ctxt->kinit_successful = 0; + } + } ++ ++/* ++ * Initialize the sasl callbacks, which increments the global ++ * use counter. ++ */ ++int autofs_sasl_client_init(unsigned logopt) ++{ ++ /* Start up Cyrus SASL--only needs to be done at library load. */ ++ if (sasl_client_init(callbacks) != SASL_OK) { ++ error(logopt, "sasl_client_init failed"); ++ return 0; ++ } ++ return 1; ++} ++ ++/* ++ * Decrement the library reference count and free resources if ++ * we are the last to close the library. ++ */ ++void autofs_sasl_done(void) ++{ ++ sasl_done(); ++ return; ++} ++ +diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c +index e8530f6..ded26f7 100644 +--- a/modules/lookup_ldap.c ++++ b/modules/lookup_ldap.c +@@ -599,7 +599,7 @@ static LDAP *connect_to_server(unsigned logopt, const char *uri, struct lookup_c + + if (!do_bind(logopt, ldap, ctxt)) { + unbind_ldap_connection(logopt, ldap, ctxt); +- autofs_sasl_done(ctxt); ++ autofs_sasl_dispose(ctxt); + error(logopt, MODPREFIX "cannot bind to server"); + return NULL; + } +@@ -672,7 +672,7 @@ static LDAP *do_reconnect(unsigned logopt, struct lookup_context *ctxt) + list_add_tail(&this->list, ctxt->uri); + + #ifdef WITH_SASL +- autofs_sasl_done(ctxt); ++ autofs_sasl_dispose(ctxt); + #endif + + /* Current server failed connect, try the rest */ +@@ -1330,6 +1330,13 @@ int lookup_init(const char *mapfmt, int argc, const char *const *argv, void **co + free_context(ctxt); + return 1; + } ++ ++ /* Init the sasl callbacks */ ++ if (!autofs_sasl_client_init(LOGOPT_NONE)) { ++ error(LOGOPT_ANY, "failed to init sasl client"); ++ free_context(ctxt); ++ return 1; ++ } + #endif + + if (ctxt->server || !ctxt->uri) { +@@ -2640,7 +2647,8 @@ int lookup_done(void *context) + struct lookup_context *ctxt = (struct lookup_context *) context; + int rv = close_parse(ctxt->parse); + #ifdef WITH_SASL +- autofs_sasl_done(ctxt); ++ autofs_sasl_dispose(ctxt); ++ autofs_sasl_done(); + #endif + free_context(ctxt); + return rv; --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-map-type-in-map-name.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-map-type-in-map-name.patch @@ -0,0 +1,71 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-map-type-in-map-name.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index af5a1b0..76f2477 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -12,6 +12,7 @@ + - update fix expire working harder than needed. + - add missing check for zero length NIS key (Wengang Wang). + - init SASL callbacks on every ldap lookup library load. ++- fix incorrect match of map type name when included in map name. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/lib/master_tok.l b/lib/master_tok.l +index b379940..4bbe033 100644 +--- a/lib/master_tok.l ++++ b/lib/master_tok.l +@@ -77,6 +77,7 @@ int my_yyinput(char *, int); + char buff[1024]; + char *bptr; + char *optr = buff; ++unsigned int tlen; + + %} + +@@ -190,13 +191,27 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo + {OPTWS}\\\n{OPTWS} {} + + {MULTI} { +- strcpy(master_lval.strtype, master_text); +- return(MULTITYPE); ++ tlen = master_leng - 1; ++ if (bptr != buff && isblank(master_text[tlen])) { ++ strncat(buff, master_text, tlen); ++ bptr += tlen; ++ yyless(tlen); ++ } else { ++ strcpy(master_lval.strtype, master_text); ++ return(MULTITYPE); ++ } + } + + {MTYPE} { +- strcpy(master_lval.strtype, master_text); +- return(MAPTYPE); ++ tlen = master_leng - 1; ++ if (bptr != buff && isblank(master_text[tlen])) { ++ strncat(buff, master_text, tlen); ++ bptr += tlen; ++ yyless(tlen); ++ } else { ++ strcpy(master_lval.strtype, master_text); ++ return(MAPTYPE); ++ } + } + + {MULTISEP} { return(DDASH); } +@@ -226,7 +241,7 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo + yyless(0); + } + +- {DNSERVERSTR} { ++ {DNSERVERSTR}{DNATTRSTR} { + BEGIN(DNSTR); + yyless(0); + } --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-handle-zero-length-nis-key.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-handle-zero-length-nis-key.patch @@ -0,0 +1,44 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-handle-zero-length-nis-key.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index dd66e95..c221c13 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -10,6 +10,7 @@ + - fix unlink of mount tree incorrectly causing autofs mount fail. + - update kernel header file linux/auto_fs4.h. + - update fix expire working harder than needed. ++- add missing check for zero length NIS key (Wengang Wang). + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c +index f5097dc..0fc84f8 100644 +--- a/modules/lookup_yp.c ++++ b/modules/lookup_yp.c +@@ -168,6 +168,10 @@ int yp_all_master_callback(int status, char *ypkey, int ypkeylen, + if (status != YP_TRUE) + return status; + ++ /* Ignore zero length keys */ ++ if (ypkeylen == 0) ++ return 0; ++ + /* + * Ignore keys beginning with '+' as plus map + * inclusion is only valid in file maps. +@@ -263,6 +267,10 @@ int yp_all_callback(int status, char *ypkey, int ypkeylen, + if (status != YP_TRUE) + return status; + ++ /* Ignore zero length keys */ ++ if (ypkeylen == 0) ++ return 0; ++ + /* + * Ignore keys beginning with '+' as plus map + * inclusion is only valid in file maps. --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-xfn-not-supported.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-xfn-not-supported.patch @@ -0,0 +1,81 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-xfn-not-supported.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index 98855f5..8d09e93 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,6 +1,7 @@ + ??/??/2008 autofs-5.0.4 + ----------------------- + - correct configure test for ldapr page control functions. ++- catch "-xfn" map type and issue "no supported" message. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/lib/master_parse.y b/lib/master_parse.y +index b450122..2184b4f 100644 +--- a/lib/master_parse.y ++++ b/lib/master_parse.y +@@ -50,6 +50,7 @@ static int add_multi_mapstr(void); + + static int master_error(const char *s); + static int master_notify(const char *s); ++static int master_msg(const char *s); + + static char *path; + static char *type; +@@ -119,6 +120,7 @@ static int master_fprintf(FILE *, char *, ...); + %token DNNAME + %token MAPHOSTS + %token MAPNULL ++%token MAPXFN + %token MAPNAME + %token NUMBER + %token OPTION +@@ -283,6 +285,12 @@ map: PATH + YYABORT; + } + } ++ | MAPXFN ++ { ++ master_notify($1); ++ master_msg("X/Open Federated Naming service not supported"); ++ YYABORT; ++ } + | MAPNULL + { + type = master_strdup($1 + 1); +@@ -598,6 +606,12 @@ static int master_notify(const char *s) + return(0); + } + ++static int master_msg(const char *s) ++{ ++ logmsg("%s", s); ++ return 0; ++} ++ + static void local_init_vars(void) + { + path = NULL; +diff --git a/lib/master_tok.l b/lib/master_tok.l +index d908047..2a6fdf9 100644 +--- a/lib/master_tok.l ++++ b/lib/master_tok.l +@@ -215,6 +215,12 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo + return MAPNULL; + } + ++ "-xfn" { ++ BEGIN(OPTSTR); ++ strcpy(master_lval.strtype, master_text); ++ return MAPXFN; ++ } ++ + "//" { + BEGIN(DNSTR); + yyless(0); --- autofs5-5.0.3.orig/debian/patches/12disable_default_auto_master.dpatch +++ autofs5-5.0.3/debian/patches/12disable_default_auto_master.dpatch @@ -0,0 +1,26 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 12disable_default_auto_master.dpatch by +## +## DP: Disable upstream's default of activating /mnt and /net. +## DP: In previous versions this was done as a security measure +## DP: (because the hosts map was processed without nosuid and nodev). + +@DPATCH@ +--- autofs5-5.0.3.orig/samples/auto.master 2008-04-27 17:45:28.000000000 +0200 ++++ autofs5-5.0.3/samples/auto.master 2008-04-28 15:49:19.000000000 +0200 +@@ -4,13 +4,13 @@ + # key [ -mount-options-separated-by-comma ] location + # For details of the format look at autofs(5). + # +-/misc /etc/auto.misc ++#/misc /etc/auto.misc + # + # NOTE: mounts done from a hosts map will be mounted with the + # "nosuid" and "nodev" options unless the "suid" and "dev" + # options are explicitly given. + # +-/net -hosts ++#/net -hosts + # + # Include central master map if it can be found using + # nsswitch sources. --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-check-for-kernel-automount.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-check-for-kernel-automount.patch @@ -0,0 +1,215 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-check-for-kernel-automount.patch +## DP: Supplied by upstream. + +@DPATCH@ + + +autofs 5.0.3 - check for exported mounts automatically mounted by kernel + +From: Ian Kent + +If a server exports file systems that are automatically mounted by +the kernel client autofs will mistakenly over mount them when it +constructs and mounts its multi-mount triggers. + +This patch makes autofs check for this case and ignores them if the +kernel mounts them while it mounts multi-mount triggers. + +We don't want to fight with NFS over mounting these because it +confuses autofs and they magically go away when the owner mount is +umounted. This isn't ideal because autofs will mount these mounts +while constructing its multi-mount triggers but it is unavoidable +at the moment. +--- + + CHANGELOG | 1 + + daemon/direct.c | 26 ++++++++++++++++++-------- + include/automount.h | 4 ++++ + lib/parse_subs.c | 26 ++++++++++++++++++-------- + 4 files changed, 41 insertions(+), 16 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index ff4a265..d953d2d 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -14,6 +14,7 @@ + - init SASL callbacks on every ldap lookup library load. + - fix incorrect match of map type name when included in map name. + - fix incorrect pthreads condition handling for mount requests. ++- add check for exports automatically mounted by NFS kernel client. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/daemon/direct.c b/daemon/direct.c +index a9dda87..86c817c 100644 +--- a/daemon/direct.c ++++ b/daemon/direct.c +@@ -664,12 +664,12 @@ int mount_autofs_offset(struct autofs_point *ap, struct mapent *me) + if (ap->state != ST_READMAP) + warn(ap->logopt, + "trigger %s already mounted", me->key); +- return 0; ++ return MOUNT_OFFSET_OK; + } + + if (me->ioctlfd != -1) { + error(ap->logopt, "active offset mount %s", me->key); +- return -1; ++ return MOUNT_OFFSET_FAIL; + } + + status = pthread_once(&key_mnt_params_once, key_mnt_params_init); +@@ -683,7 +683,7 @@ int mount_autofs_offset(struct autofs_point *ap, struct mapent *me) + crit(ap->logopt, + "mnt_params value create failed for offset mount %s", + me->key); +- return 0; ++ return MOUNT_OFFSET_OK; + } + mp->options = NULL; + +@@ -697,12 +697,22 @@ int mount_autofs_offset(struct autofs_point *ap, struct mapent *me) + if (!mp->options) { + mp->options = make_options_string(ap->path, ap->kpipefd, "offset"); + if (!mp->options) +- return 0; ++ return MOUNT_OFFSET_OK; + } + + /* In case the directory doesn't exist, try to mkdir it */ + if (mkdir_path(me->key, 0555) < 0) { + if (errno == EEXIST) { ++ /* ++ * If the mount point directory is a real mount ++ * and it isn't the root offset then it must be ++ * a mount that has been automatically mounted by ++ * the kernel NFS client. ++ */ ++ if (me->multi != me && ++ is_mounted(_PROC_MOUNTS, me->key, MNTS_REAL)) ++ return MOUNT_OFFSET_IGNORE; ++ + /* + * If we recieve an error, and it's EEXIST + * we know the directory was not created. +@@ -721,13 +731,13 @@ int mount_autofs_offset(struct autofs_point *ap, struct mapent *me) + debug(ap->logopt, + "can't create mount directory: %s, %s", + me->key, estr); +- return -1; ++ return MOUNT_OFFSET_FAIL; + } else { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + crit(ap->logopt, + "failed to create mount directory: %s, %s", + me->key, estr); +- return -1; ++ return MOUNT_OFFSET_FAIL; + } + } else { + /* No errors so the directory was successfully created */ +@@ -787,7 +797,7 @@ int mount_autofs_offset(struct autofs_point *ap, struct mapent *me) + + debug(ap->logopt, "mounted trigger %s", me->key); + +- return 0; ++ return MOUNT_OFFSET_OK; + + out_close: + close(ioctlfd); +@@ -797,7 +807,7 @@ out_err: + if (stat(me->key, &st) == 0 && me->dir_created) + rmdir_path(ap, me->key, st.st_dev); + +- return -1; ++ return MOUNT_OFFSET_FAIL; + } + + static int expire_direct(int ioctlfd, const char *path, unsigned int when, unsigned int logopt) +diff --git a/include/automount.h b/include/automount.h +index cd8ce7b..d59be77 100644 +--- a/include/automount.h ++++ b/include/automount.h +@@ -468,6 +468,10 @@ struct autofs_point { + + /* Standard functions used by daemon or modules */ + ++#define MOUNT_OFFSET_OK 0 ++#define MOUNT_OFFSET_FAIL -1 ++#define MOUNT_OFFSET_IGNORE -2 ++ + void *handle_mounts(void *arg); + int umount_multi(struct autofs_point *ap, const char *path, int incl); + int send_ready(unsigned logopt, int ioctlfd, unsigned int wait_queue_token); +diff --git a/lib/parse_subs.c b/lib/parse_subs.c +index 5422fef..27cb0fc 100644 +--- a/lib/parse_subs.c ++++ b/lib/parse_subs.c +@@ -390,7 +390,7 @@ int mount_multi_triggers(struct autofs_point *ap, char *root, struct mapent *me, + struct list_head *pos = NULL; + unsigned int fs_path_len; + unsigned int mounted; +- int start; ++ int ret, start; + + fs_path_len = strlen(root) + strlen(base); + if (fs_path_len > PATH_MAX) +@@ -411,15 +411,25 @@ int mount_multi_triggers(struct autofs_point *ap, char *root, struct mapent *me, + } + + oe = cache_lookup_offset(base, offset, start, &me->multi_list); +- if (!oe) ++ if (!oe || !oe->mapent) + goto cont; + + debug(ap->logopt, "mount offset %s", oe->key); + +- if (mount_autofs_offset(ap, oe) < 0) +- warn(ap->logopt, "failed to mount offset"); +- else ++ ret = mount_autofs_offset(ap, oe); ++ if (ret >= MOUNT_OFFSET_OK) + mounted++; ++ else { ++ if (ret != MOUNT_OFFSET_IGNORE) ++ warn(ap->logopt, "failed to mount offset"); ++ else { ++ debug(ap->logopt, ++ "ignoring \"nohide\" trigger %s", ++ oe->key); ++ free(oe->mapent); ++ oe->mapent = NULL; ++ } ++ } + cont: + offset = cache_get_offset(base, + offset, start, &me->multi_list, &pos); +@@ -457,7 +467,7 @@ int umount_multi_triggers(struct autofs_point *ap, char *root, struct mapent *me + + oe = cache_lookup_offset(mm_base, offset, start, &me->multi_list); + /* root offset is a special case */ +- if (!oe || (strlen(oe->key) - start) == 1) ++ if (!oe || !oe->mapent || (strlen(oe->key) - start) == 1) + continue; + + /* +@@ -481,7 +491,7 @@ int umount_multi_triggers(struct autofs_point *ap, char *root, struct mapent *me + while ((offset = cache_get_offset(mm_base, offset, start, mm_root, &pos))) { + oe = cache_lookup_offset(mm_base, offset, start, &me->multi_list); + /* root offset is a special case */ +- if (!oe || (strlen(oe->key) - start) == 1) ++ if (!oe || !oe->mapent || (strlen(oe->key) - start) == 1) + continue; + + debug(ap->logopt, "umount offset %s", oe->key); +@@ -505,7 +515,7 @@ int umount_multi_triggers(struct autofs_point *ap, char *root, struct mapent *me + if (is_mounted(_PATH_MOUNTED, root, MNTS_REAL)) { + info(ap->logopt, "unmounting dir = %s", root); + if (umount_ent(ap, root)) { +- if (!mount_multi_triggers(ap, root, me, "/")) ++ if (mount_multi_triggers(ap, root, me, "/") < 0) + warn(ap->logopt, + "failed to remount offset triggers"); + return left++; --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-unlink-mount-return-fix.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-unlink-mount-return-fix.patch @@ -0,0 +1,58 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-unlink-mount-return-fix.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index eb4cce1..a0c7fa3 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -7,6 +7,7 @@ + - use libldap instead of libldap_r (Guillaume Rousse). + - another fix for don't fail on empty master map. + - fix expire working harder than needed. ++- fix unlink of mount tree incorrectly causing autofs mount fail. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/daemon/direct.c b/daemon/direct.c +index 760fbd4..8d1e9c6 100644 +--- a/daemon/direct.c ++++ b/daemon/direct.c +@@ -275,7 +275,6 @@ static int unlink_mount_tree(struct autofs_point *ap, struct list_head *list) + else + rv = umount2(mnt->path, MNT_DETACH); + if (rv == -1) { +- ret = 0; + debug(ap->logopt, + "can't unlink %s from mount tree", mnt->path); + +@@ -287,6 +286,7 @@ static int unlink_mount_tree(struct autofs_point *ap, struct list_head *list) + + case ENOENT: + case EFAULT: ++ ret = 0; + warn(ap->logopt, "bad path for mount"); + break; + } +diff --git a/daemon/indirect.c b/daemon/indirect.c +index 39b42da..f0409ac 100644 +--- a/daemon/indirect.c ++++ b/daemon/indirect.c +@@ -65,7 +65,6 @@ static int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts) + else + rv = umount2(this->path, MNT_DETACH); + if (rv == -1) { +- ret = 0; + debug(ap->logopt, + "can't unlink %s from mount tree", this->path); + +@@ -77,6 +76,7 @@ static int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts) + + case ENOENT: + case EFAULT: ++ ret = 0; + warn(ap->logopt, "bad path for mount"); + break; + } --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-mount-thread-create-cond-handling.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-mount-thread-create-cond-handling.patch @@ -0,0 +1,320 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-mount-thread-create-cond-handling.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index 76f2477..ff4a265 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -13,6 +13,7 @@ + - add missing check for zero length NIS key (Wengang Wang). + - init SASL callbacks on every ldap lookup library load. + - fix incorrect match of map type name when included in map name. ++- fix incorrect pthreads condition handling for mount requests. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/daemon/direct.c b/daemon/direct.c +index 0c9a648..a9dda87 100644 +--- a/daemon/direct.c ++++ b/daemon/direct.c +@@ -1217,7 +1217,7 @@ static void mount_mutex_unlock(void *arg) + + static void *do_mount_direct(void *arg) + { +- struct pending_args *mt; ++ struct pending_args *args, mt; + struct autofs_point *ap; + struct passwd pw; + struct passwd *ppw = &pw; +@@ -1231,47 +1231,47 @@ static void *do_mount_direct(void *arg) + struct stat st; + int status, state; + +- mt = (struct pending_args *) arg; ++ args = (struct pending_args *) arg; + + status = pthread_mutex_lock(&ma_mutex); + if (status) + fatal(status); + +- ap = mt->ap; ++ memcpy(&mt, args, sizeof(struct pending_args)); + +- mt->signaled = 1; +- status = pthread_cond_signal(&mt->cond); ++ ap = mt.ap; ++ ++ args->signaled = 1; ++ status = pthread_cond_signal(&args->cond); + if (status) + fatal(status); + + mount_mutex_unlock(NULL); + +- pthread_cleanup_push(free_pending_args, mt); +- pthread_cleanup_push(pending_cond_destroy, mt); +- pthread_cleanup_push(mount_send_fail, mt); ++ pthread_cleanup_push(mount_send_fail, &mt); + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state); + +- status = fstat(mt->ioctlfd, &st); ++ status = fstat(mt.ioctlfd, &st); + if (status == -1) { + error(ap->logopt, +- "can't stat direct mount trigger %s", mt->name); ++ "can't stat direct mount trigger %s", mt.name); + pthread_setcancelstate(state, NULL); + pthread_exit(NULL); + } + +- status = stat(mt->name, &st); +- if (!S_ISDIR(st.st_mode) || st.st_dev != mt->dev) { ++ status = stat(mt.name, &st); ++ if (!S_ISDIR(st.st_mode) || st.st_dev != mt.dev) { + error(ap->logopt, + "direct trigger not valid or already mounted %s", +- mt->name); ++ mt.name); + pthread_setcancelstate(state, NULL); + pthread_exit(NULL); + } + + pthread_setcancelstate(state, NULL); + +- info(ap->logopt, "attempting to mount entry %s", mt->name); ++ info(ap->logopt, "attempting to mount entry %s", mt.name); + + /* + * Setup thread specific data values for macro +@@ -1283,8 +1283,8 @@ static void *do_mount_direct(void *arg) + if (!tsv) + goto cont; + +- tsv->uid = mt->uid; +- tsv->gid = mt->gid; ++ tsv->uid = mt.uid; ++ tsv->gid = mt.gid; + + /* Try to get passwd info */ + +@@ -1302,7 +1302,7 @@ static void *do_mount_direct(void *arg) + goto cont; + } + +- status = getpwuid_r(mt->uid, ppw, pw_tmp, tmplen, pppw); ++ status = getpwuid_r(tsv->uid, ppw, pw_tmp, tmplen, pppw); + if (status || !ppw) { + error(ap->logopt, "failed to get passwd info from getpwuid_r"); + free(tsv); +@@ -1356,7 +1356,7 @@ static void *do_mount_direct(void *arg) + gr_tmp = tmp; + pgr = &gr; + ppgr = &pgr; +- status = getgrgid_r(mt->gid, pgr, gr_tmp, tmplen, ppgr); ++ status = getgrgid_r(tsv->gid, pgr, gr_tmp, tmplen, ppgr); + if (status != ERANGE) + break; + tmplen += grplen; +@@ -1393,7 +1393,7 @@ static void *do_mount_direct(void *arg) + } + + cont: +- status = lookup_nss_mount(ap, NULL, mt->name, strlen(mt->name)); ++ status = lookup_nss_mount(ap, NULL, mt.name, strlen(mt.name)); + /* + * Direct mounts are always a single mount. If it fails there's + * nothing to undo so just complain +@@ -1402,29 +1402,27 @@ cont: + if (status) { + struct mapent *me; + int real_mount, set_fd; +- cache_readlock(mt->mc); +- me = cache_lookup_distinct(mt->mc, mt->name); ++ cache_readlock(mt.mc); ++ me = cache_lookup_distinct(mt.mc, mt.name); + real_mount = is_mounted(_PATH_MOUNTED, me->key, MNTS_REAL); + set_fd = (real_mount || me->multi == me); +- cache_unlock(mt->mc); ++ cache_unlock(mt.mc); + if (set_fd) { +- me->ioctlfd = mt->ioctlfd; +- send_ready(ap->logopt, mt->ioctlfd, mt->wait_queue_token); ++ me->ioctlfd = mt.ioctlfd; ++ send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token); + } else { +- send_ready(ap->logopt, mt->ioctlfd, mt->wait_queue_token); +- close(mt->ioctlfd); ++ send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token); ++ close(mt.ioctlfd); + } +- info(ap->logopt, "mounted %s", mt->name); ++ info(ap->logopt, "mounted %s", mt.name); + } else { +- send_fail(mt->ap->logopt, mt->ioctlfd, mt->wait_queue_token); +- close(mt->ioctlfd); +- info(ap->logopt, "failed to mount %s", mt->name); ++ send_fail(ap->logopt, mt.ioctlfd, mt.wait_queue_token); ++ close(mt.ioctlfd); ++ info(ap->logopt, "failed to mount %s", mt.name); + } + pthread_setcancelstate(state, NULL); + + pthread_cleanup_pop(0); +- pthread_cleanup_pop(1); +- pthread_cleanup_pop(1); + + return NULL; + } +@@ -1553,6 +1551,8 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ + } + + cache_unlock(mc); ++ pthread_cleanup_push(free_pending_args, mt); ++ pthread_cleanup_push(pending_cond_destroy, mt); + pthread_cleanup_push(mount_mutex_unlock, NULL); + pthread_setcancelstate(state, NULL); + +@@ -1564,6 +1564,8 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ + } + + pthread_cleanup_pop(1); ++ pthread_cleanup_pop(1); ++ pthread_cleanup_pop(1); + + return 0; + } +diff --git a/daemon/indirect.c b/daemon/indirect.c +index bebca8b..11865b3 100644 +--- a/daemon/indirect.c ++++ b/daemon/indirect.c +@@ -660,7 +660,7 @@ static void mount_mutex_unlock(void *arg) + + static void *do_mount_indirect(void *arg) + { +- struct pending_args *mt; ++ struct pending_args *args, mt; + struct autofs_point *ap; + char buf[PATH_MAX + 1]; + struct stat st; +@@ -674,29 +674,28 @@ static void *do_mount_indirect(void *arg) + struct thread_stdenv_vars *tsv; + int len, tmplen, grplen, status, state; + +- mt = (struct pending_args *) arg; ++ args = (struct pending_args *) arg; + + status = pthread_mutex_lock(&ma_mutex); + if (status) + fatal(status); + +- ap = mt->ap; +- mt->status = 0; ++ memcpy(&mt, args, sizeof(struct pending_args)); + +- mt->signaled = 1; +- status = pthread_cond_signal(&mt->cond); ++ ap = mt.ap; ++ ++ args->signaled = 1; ++ status = pthread_cond_signal(&args->cond); + if (status) + fatal(status); + + mount_mutex_unlock(NULL); + +- pthread_cleanup_push(free_pending_args, mt); +- pthread_cleanup_push(pending_cond_destroy, mt); +- pthread_cleanup_push(mount_send_fail, mt); ++ pthread_cleanup_push(mount_send_fail, &mt); + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state); + +- len = ncat_path(buf, sizeof(buf), ap->path, mt->name, mt->len); ++ len = ncat_path(buf, sizeof(buf), ap->path, mt.name, mt.len); + if (!len) { + crit(ap->logopt, "path to be mounted is to long"); + pthread_setcancelstate(state, NULL); +@@ -704,7 +703,7 @@ static void *do_mount_indirect(void *arg) + } + + status = lstat(buf, &st); +- if (status != -1 && !(S_ISDIR(st.st_mode) && st.st_dev == mt->dev)) { ++ if (status != -1 && !(S_ISDIR(st.st_mode) && st.st_dev == mt.dev)) { + error(ap->logopt, + "indirect trigger not valid or already mounted %s", buf); + pthread_setcancelstate(state, NULL); +@@ -725,8 +724,8 @@ static void *do_mount_indirect(void *arg) + if (!tsv) + goto cont; + +- tsv->uid = mt->uid; +- tsv->gid = mt->gid; ++ tsv->uid = mt.uid; ++ tsv->gid = mt.gid; + + /* Try to get passwd info */ + +@@ -744,7 +743,7 @@ static void *do_mount_indirect(void *arg) + goto cont; + } + +- status = getpwuid_r(mt->uid, ppw, pw_tmp, tmplen, pppw); ++ status = getpwuid_r(tsv->uid, ppw, pw_tmp, tmplen, pppw); + if (status || !ppw) { + error(ap->logopt, "failed to get passwd info from getpwuid_r"); + free(tsv); +@@ -798,7 +797,7 @@ static void *do_mount_indirect(void *arg) + gr_tmp = tmp; + pgr = &gr; + ppgr = &pgr; +- status = getgrgid_r(mt->gid, pgr, gr_tmp, tmplen, ppgr); ++ status = getgrgid_r(tsv->gid, pgr, gr_tmp, tmplen, ppgr); + if (status != ERANGE) + break; + tmplen += grplen; +@@ -834,20 +833,18 @@ static void *do_mount_indirect(void *arg) + free(tsv); + } + cont: +- status = lookup_nss_mount(ap, NULL, mt->name, mt->len); ++ status = lookup_nss_mount(ap, NULL, mt.name, mt.len); + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state); + if (status) { +- send_ready(ap->logopt, ap->ioctlfd, mt->wait_queue_token); ++ send_ready(ap->logopt, ap->ioctlfd, mt.wait_queue_token); + info(ap->logopt, "mounted %s", buf); + } else { +- send_fail(ap->logopt, ap->ioctlfd, mt->wait_queue_token); ++ send_fail(ap->logopt, ap->ioctlfd, mt.wait_queue_token); + info(ap->logopt, "failed to mount %s", buf); + } + pthread_setcancelstate(state, NULL); + + pthread_cleanup_pop(0); +- pthread_cleanup_pop(1); +- pthread_cleanup_pop(1); + + return NULL; + } +@@ -911,6 +908,8 @@ int handle_packet_missing_indirect(struct autofs_point *ap, autofs_packet_missin + return 1; + } + ++ pthread_cleanup_push(free_pending_args, mt); ++ pthread_cleanup_push(pending_cond_destroy, mt); + pthread_cleanup_push(mount_mutex_unlock, NULL); + pthread_setcancelstate(state, NULL); + +@@ -922,6 +921,8 @@ int handle_packet_missing_indirect(struct autofs_point *ap, autofs_packet_missin + } + + pthread_cleanup_pop(1); ++ pthread_cleanup_pop(1); ++ pthread_cleanup_pop(1); + + return 0; + } --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-expire-works-too-hard.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-expire-works-too-hard.patch @@ -0,0 +1,65 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-expire-works-too-hard.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index 033923d..eb4cce1 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -6,6 +6,7 @@ + - avoid using UDP for probing NFSv4 mount requests. + - use libldap instead of libldap_r (Guillaume Rousse). + - another fix for don't fail on empty master map. ++- fix expire working harder than needed. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/daemon/direct.c b/daemon/direct.c +index 529f143..760fbd4 100644 +--- a/daemon/direct.c ++++ b/daemon/direct.c +@@ -824,11 +824,16 @@ static int expire_direct(int ioctlfd, const char *path, unsigned int when, unsig + if (errno == EBADF || errno == EINVAL) + return 1; + +- /* Other than need to wait for the kernel ? */ +- if (errno != EAGAIN) +- return 0; ++ /* ++ * Other than EAGAIN is an expire error so continue. ++ * Kernel try the same mount again, limited by ++ * retries (ie. number of mounts directly under ++ * mount point, should always be one for direct ++ * mounts). ++ */ ++ if (errno == EAGAIN) ++ break; + } +- + nanosleep(&tm, NULL); + } + +diff --git a/daemon/indirect.c b/daemon/indirect.c +index fd94e59..39b42da 100644 +--- a/daemon/indirect.c ++++ b/daemon/indirect.c +@@ -344,11 +344,13 @@ static int expire_indirect(struct autofs_point *ap, int ioctlfd, const char *pat + if (errno == EBADF || errno == EINVAL) + return 1; + +- /* Other than need to wait for the kernel ? */ +- if (errno != EAGAIN) +- return 0; ++ /* ++ * Other than EAGAIN is an expire error so continue. ++ * Kernel will try the next mount. ++ */ ++ if (errno == EAGAIN) ++ break; + } +- + nanosleep(&tm, NULL); + } + --- autofs5-5.0.3.orig/debian/patches/11default_automaster_location.dpatch +++ autofs5-5.0.3/debian/patches/11default_automaster_location.dpatch @@ -0,0 +1,21 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## default_automaster_location.dpatch by +## +## DP: Set /etc/auto.master as the default location of the automounter +## DP: master map, because that file is surely available (the package +## DP: installs a default one). If the admin already has an auto.master +## DP: map in a different place, he can customize the file later. + +@DPATCH@ + +--- autofs5-5.0.2/samples/autofs.conf.default.in.orig 2007-07-06 19:21:33.000000000 +0200 ++++ autofs5-5.0.2/samples/autofs.conf.default.in 2007-07-06 19:21:41.000000000 +0200 +@@ -3,7 +3,7 @@ + # + # MASTER_MAP_NAME - default map name for the master map. + # +-#MASTER_MAP_NAME="auto.master" ++MASTER_MAP_NAME="/etc/auto.master" + # + # TIMEOUT - set the default mount timeout (default 600). + # --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-expire-works-too-hard-update-2.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-expire-works-too-hard-update-2.patch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-expire-works-too-hard-update-2.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/daemon/indirect.c b/daemon/indirect.c +index a098d42..51172f2 100644 +--- a/daemon/indirect.c ++++ b/daemon/indirect.c +@@ -420,6 +420,8 @@ void *expire_proc_indirect(void *arg) + if (strstr(next->opts, "indirect")) + master_notify_submount(ap, next->path, ap->state); + pthread_setcancelstate(cur_state, NULL); ++ ++ continue; + } + + if (ap->state == ST_EXPIRE || ap->state == ST_PRUNE) --- autofs5-5.0.3.orig/debian/patches/14dev_urandom_is_fine.dpatch +++ autofs5-5.0.3/debian/patches/14dev_urandom_is_fine.dpatch @@ -0,0 +1,17 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 14dev_urandom_is_fine.dpatch by +## +## DP: lookup_ldap.so has to be linked to libkrb5.so. + +@DPATCH@ +--- autofs5-5.0.3/modules/replicated.cO 2008-06-12 22:04:33.000000000 +0200 ++++ autofs5-5.0.3/modules/replicated.c 2008-06-12 22:04:41.000000000 +0200 +@@ -79,7 +79,7 @@ + int fd; + unsigned int seed; + +- fd = open("/dev/random", O_RDONLY); ++ fd = open("/dev/urandom", O_RDONLY); + if (fd < 0) { + srandom(time(NULL)); + return; --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-correct-ldap-lib.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-correct-ldap-lib.patch @@ -0,0 +1,84 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-correct-ldap-lib.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index 5a85a8e..e393f33 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -4,6 +4,7 @@ + - catch "-xfn" map type and issue "no supported" message. + - correction for handling of LDAP base dns with spaces. + - avoid using UDP for probing NFSv4 mount requests. ++- use libldap instead of libldap_r (Guillaume Rousse). + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/aclocal.m4 b/aclocal.m4 +index f24e076..a1105ae 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -232,7 +232,7 @@ AC_DEFUN([AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL], + + # save current ldflags + af_check_ldap_create_page_control_save_ldflags="$LDFLAGS" +-LDFLAGS="$LDFLAGS -lldap_r" ++LDFLAGS="$LDFLAGS -lldap" + + AC_TRY_LINK( + [ #include ], +@@ -265,7 +265,7 @@ AC_DEFUN([AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL], + + # save current ldflags + af_check_ldap_parse_page_control_save_ldflags="$LDFLAGS" +-LDFLAGS="$LDFLAGS -lldap_r" ++LDFLAGS="$LDFLAGS -lldap" + + AC_TRY_LINK( + [ #include ], +diff --git a/configure b/configure +index e872392..0d3268c 100755 +--- a/configure ++++ b/configure +@@ -4563,7 +4563,7 @@ fi + { echo "$as_me:$LINENO: result: $ac_cv_lib_ldap_ldap_initialize" >&5 + echo "${ECHO_T}$ac_cv_lib_ldap_ldap_initialize" >&6; } + if test $ac_cv_lib_ldap_ldap_initialize = yes; then +- HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap_r -llber -lresolv" ++ HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap -llber -lresolv" + fi + + if test "$HAVE_LDAP" = "1"; then +@@ -4578,7 +4578,7 @@ echo $ECHO_N "checking for ldap_create_page_control in -lldap... $ECHO_C" >&6; } + + # save current ldflags + af_check_ldap_create_page_control_save_ldflags="$LDFLAGS" +-LDFLAGS="$LDFLAGS -lldap_r" ++LDFLAGS="$LDFLAGS -lldap" + + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -4648,7 +4648,7 @@ echo $ECHO_N "checking for ldap_parse_page_control in -lldap... $ECHO_C" >&6; } + + # save current ldflags + af_check_ldap_parse_page_control_save_ldflags="$LDFLAGS" +-LDFLAGS="$LDFLAGS -lldap_r" ++LDFLAGS="$LDFLAGS -lldap" + + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +diff --git a/configure.in b/configure.in +index a9c86dd..27b9bec 100644 +--- a/configure.in ++++ b/configure.in +@@ -197,7 +197,7 @@ AC_ARG_WITH(openldap, + if test -z "$HAVE_LDAP" -o "$HAVE_LDAP" != "0"; then + HAVE_LDAP=0 + LDAP_FLAGS="$LDAP_FLAGS -DLDAP_DEPRECATED=1" +- AC_CHECK_LIB(ldap, ldap_initialize, HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap_r -llber -lresolv", , ++ AC_CHECK_LIB(ldap, ldap_initialize, HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap -llber -lresolv", , + -llber -lresolv $LIBS) + if test "$HAVE_LDAP" = "1"; then + AC_DEFINE(WITH_LDAP,1, --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-expire-works-too-hard-update.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-expire-works-too-hard-update.patch @@ -0,0 +1,53 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-expire-works-too-hard-update.patch +## DP: Supplied by upstream. + +@DPATCH@ + +diff --git a/CHANGELOG b/CHANGELOG +index 40ac2f8..dd66e95 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -9,6 +9,7 @@ + - fix expire working harder than needed. + - fix unlink of mount tree incorrectly causing autofs mount fail. + - update kernel header file linux/auto_fs4.h. ++- update fix expire working harder than needed. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/daemon/direct.c b/daemon/direct.c +index 8d1e9c6..0c9a648 100644 +--- a/daemon/direct.c ++++ b/daemon/direct.c +@@ -808,7 +808,7 @@ static int expire_direct(int ioctlfd, const char *path, unsigned int when, unsig + + if (fstat(ioctlfd, &st) == -1) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); +- error(logopt, "fstat failed: %s", estr); ++ debug(logopt, "fstat failed: %s", estr); + return 0; + } + +diff --git a/daemon/indirect.c b/daemon/indirect.c +index f0409ac..de37d16 100644 +--- a/daemon/indirect.c ++++ b/daemon/indirect.c +@@ -328,7 +328,7 @@ static int expire_indirect(struct autofs_point *ap, int ioctlfd, const char *pat + + if (fstat(ioctlfd, &st) == -1) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); +- error(ap->logopt, "fstat failed: %s", estr); ++ debug(ap->logopt, "fstat failed: %s", estr); + return 0; + } + +@@ -420,8 +420,6 @@ void *expire_proc_indirect(void *arg) + if (strstr(next->opts, "indirect")) + master_notify_submount(ap, next->path, ap->state); + pthread_setcancelstate(cur_state, NULL); +- +- continue; + } + + if (ap->state == ST_EXPIRE || ap->state == ST_PRUNE) --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-nss-source-any.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-nss-source-any.patch @@ -0,0 +1,171 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-nss-source-any.patch +## DP: Supplied by upstream. + +@DPATCH@ + + +autofs-5.0.3 - ignore nsswitch sources that aren't supported + +From: Ian Kent + +Allow any source name in nsswitch and ignore those we don't support. +This has the side affect of also ignoring any action associated with +a source that isn't supported by autofs. +--- + + CHANGELOG | 1 + + lib/nss_parse.y | 31 ++++++++++++++++--------------- + lib/nss_tok.l | 22 ++++++++++++---------- + 3 files changed, 29 insertions(+), 25 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index d953d2d..268fca6 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -15,6 +15,7 @@ + - fix incorrect match of map type name when included in map name. + - fix incorrect pthreads condition handling for mount requests. + - add check for exports automatically mounted by NFS kernel client. ++- update nsswitch parser to ignore nsswitch sources that aren't supported. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/lib/nss_parse.y b/lib/nss_parse.y +index 90b7d25..fa6958a 100644 +--- a/lib/nss_parse.y ++++ b/lib/nss_parse.y +@@ -64,7 +64,6 @@ char strval[128]; + %token SOURCE + %token STATUS + %token ACTION +-%token OTHER + + %start file + +@@ -83,7 +82,9 @@ sources: nss_source + + nss_source: SOURCE + { +- if (strcmp($1, "winbind")) ++ if (!strcmp($1, "files") || !strcmp($1, "yp") || ++ !strcmp($1, "nis") || !strcmp($1, "ldap") || ++ !strcmp($1, "nisplus") || !strcmp($1, "hesiod")) + src = add_source(nss_list, $1); + else + nss_ignore($1); +@@ -91,7 +92,9 @@ nss_source: SOURCE + { + enum nsswitch_status a; + +- if (strcmp($1, "winbind")) { ++ if (!strcmp($1, "files") || !strcmp($1, "yp") || ++ !strcmp($1, "nis") || !strcmp($1, "ldap") || ++ !strcmp($1, "nisplus") || !strcmp($1, "hesiod")) { + src = add_source(nss_list, $1); + for (a = 0; a < NSS_STATUS_MAX; a++) { + if (act[a].action != NSS_ACTION_UNKNOWN) { +@@ -101,12 +104,10 @@ nss_source: SOURCE + } + } else + nss_ignore($1); +-} | SOURCE LBRACKET status_exp_list SOURCE { nss_error($4); YYABORT; } +- | SOURCE LBRACKET status_exp_list OTHER { nss_error($4); YYABORT; } +- | SOURCE LBRACKET status_exp_list NL { nss_error("no closing bracket"); YYABORT; } +- | SOURCE LBRACKET OTHER { nss_error($3); YYABORT; } +- | SOURCE OTHER { nss_error("no opening bracket"); YYABORT; } +- | error OTHER { nss_error($2); YYABORT; }; ++} | SOURCE LBRACKET status_exp_list SOURCE { nss_error("missing close bracket"); YYABORT; } ++ | SOURCE LBRACKET status_exp_list NL { nss_error("missing close bracket"); YYABORT; } ++ | SOURCE LBRACKET SOURCE { nss_error($3); YYABORT; } ++ | error SOURCE { nss_error($2); YYABORT; }; + + status_exp_list: status_exp + | status_exp status_exp_list +@@ -117,17 +118,17 @@ status_exp: STATUS EQUAL ACTION + } | BANG STATUS EQUAL ACTION + { + set_action(act, $2, $4, 1); +-} | STATUS EQUAL OTHER {nss_error($3); YYABORT; } +- | STATUS OTHER {nss_error($2); YYABORT; } +- | BANG STATUS EQUAL OTHER {nss_error($4); YYABORT; } +- | BANG STATUS OTHER {nss_error($3); YYABORT; } +- | BANG OTHER {nss_error($2); YYABORT; }; ++} | STATUS EQUAL SOURCE {nss_error($3); YYABORT; } ++ | STATUS SOURCE {nss_error($2); YYABORT; } ++ | BANG STATUS EQUAL SOURCE {nss_error($4); YYABORT; } ++ | BANG STATUS SOURCE {nss_error($3); YYABORT; } ++ | BANG SOURCE {nss_error($2); YYABORT; }; + + %% + + static int nss_ignore(const char *s) + { +- logmsg("ignored invalid nsswitch config near [ %s ]", s); ++ logmsg("ignored unsupported autofs nsswitch source \"%s\"", s); + return(0); + } + +diff --git a/lib/nss_tok.l b/lib/nss_tok.l +index c435b63..1aede97 100644 +--- a/lib/nss_tok.l ++++ b/lib/nss_tok.l +@@ -62,13 +62,13 @@ extern unsigned int nss_automount_found; + + %option nounput + +-%x AUTOMOUNT ++%x AUTOMOUNT ACTIONSTR + + WS [[:blank:]]+ + + automount ([Aa][Uu][Tt][Oo][Mm][Oo][Uu][Nn][Tt]) + +-source files|yp|nis|nisplus|ldap|hesiod|winbind ++source [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+ + + success ([Ss][Uu][Cc][Cc][Ee][Ss][Ss]) + notfound ([Nn][Oo][Tt][Ff][Oo][Uu][Nn][Dd]) +@@ -82,8 +82,6 @@ return ([Rr][Ee][Tt][Uu][Rr][Nn]) + + action ({continue}|{return}) + +-other [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+ +- + %% + + ^{automount}: { +@@ -101,6 +99,14 @@ other [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+ + return SOURCE; + } + ++ "[" { BEGIN(ACTIONSTR); yyless(0); } ++ ++ \n { BEGIN(INITIAL); return NL; } ++} ++ ++{ ++ {WS} { } ++ + {status} { + strcpy(nss_lval.strval, nss_text); + return STATUS; +@@ -112,15 +118,11 @@ other [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+ + } + + "[" { return LBRACKET; } +- "]" { return RBRACKET; } ++ "]" { BEGIN(AUTOMOUNT); return RBRACKET; } + "=" { return EQUAL; } + "!" { return BANG; } + +- {other} { +- strcpy(nss_lval.strval, nss_text); +- return OTHER; +- } +- ++ . { BEGIN(AUTOMOUNT); yyless(0); } + \n { BEGIN(INITIAL); return NL; } + } + --- autofs5-5.0.3.orig/debian/patches/10lsb_initscript.dpatch +++ autofs5-5.0.3/debian/patches/10lsb_initscript.dpatch @@ -0,0 +1,85 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10lsb_initscript.dpatch by +## + +@DPATCH@ + +--- autofs5-5.0.2/samples/rc.autofs.in.orig 2007-07-06 19:41:14.000000000 +0200 ++++ autofs5-5.0.2/samples/rc.autofs.in 2007-07-06 19:43:42.000000000 +0200 +@@ -2,9 +2,16 @@ + # + # rc file for automount using a Sun-style "master map". + # +-# On most distributions, this file should be called: +-# /etc/rc.d/init.d/autofs or /etc/init.d/autofs or /etc/rc.d/rc.autofs +-# ++### BEGIN INIT INFO ++# Provides: autofs ++# Required-Start: $local_fs ++# Required-Stop: $local_fs ++# Default-Start: 2 3 4 5 ++# Default-Stop: 0 1 6 ++# Short-Description: automount daemon ++# Description: daemon to mount (possibly remote) filesystems ++# automatically upon entering the mountpoint ++### END INIT INFO + + # + # Location of the automount daemon and the init directory +@@ -47,28 +54,29 @@ + return 1 + fi + +- $prog $OPTIONS ++ start-stop-daemon --start --exec $DAEMON --oknodo -- $OPTIONS + RETVAL=$? + if [ $RETVAL -eq 0 ] ; then + echo "done." + else +- echo "failed." ++ echo "no valid automount entries defined." + fi +- return $RETVAL ++ return 0 + } + + function stop() { + echo -n $"Stopping $prog: " + count=0 + while [ -n "`pidof $DAEMON`" -a $count -lt 15 ] ; do +- killall -TERM $prog >& /dev/null +- RETVAL=$? +- [ $RETVAL = 0 -a -z "`pidof $DAEMON`" ] || sleep 3 ++ start-stop-daemon --stop --exec $DAEMON --oknodo ++ [ -z "`pidof $DAEMON`" ] || sleep 3 + count=`expr $count + 1` + done +- if [ -n "`pidof $DAEMON`" ] ; then ++ if [ -z "`pidof $DAEMON`" ] ; then ++ RETVAL=0 + echo "done." + else ++ RETVAL=1 + echo "failed." + fi + return $RETVAL +@@ -101,17 +109,16 @@ + stop) + stop + ;; +- restart) ++ restart|force-reload) + restart + ;; + reload) + reload + ;; + *) +- echo $"Usage: $0 {start|stop|restart|reload}" ++ echo $"Usage: $0 {start|stop|restart|reload|force-reload}" + exit 1; + ;; + esac + + exit $? +- --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-lookup-next-soucre-stale-entry.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-lookup-next-soucre-stale-entry.patch @@ -0,0 +1,138 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-lookup-next-soucre-stale-entry.patch +## DP: Supplied by upstream. + +@DPATCH@ + + +autofs-5.0.3 - multi-map doesn't pickup NIS updates automatically + +From: Ian Kent + +In a multi-map configuration, autofs doesn't pick up NIS updates +automatically. This is caused by the lookup not checking alternate +sources for the given key (or wildcard) when doing a key lookup. +--- + + CHANGELOG | 1 + + lib/cache.c | 2 ++ + modules/lookup_file.c | 11 ++++++++--- + modules/lookup_ldap.c | 11 ++++++++--- + modules/lookup_nisplus.c | 11 ++++++++--- + modules/lookup_yp.c | 11 ++++++++--- + 6 files changed, 35 insertions(+), 12 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index 268fca6..3ed84d3 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -16,6 +16,7 @@ + - fix incorrect pthreads condition handling for mount requests. + - add check for exports automatically mounted by NFS kernel client. + - update nsswitch parser to ignore nsswitch sources that aren't supported. ++- check for map key in (possible) alternate map sources when doing lookup. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/lib/cache.c b/lib/cache.c +index 55586a3..d5abab0 100644 +--- a/lib/cache.c ++++ b/lib/cache.c +@@ -700,6 +700,8 @@ int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key + int ret = CHE_OK; + + me = cache_lookup(mc, key); ++ while (me && me->source != ms) ++ me = cache_lookup_key_next(me); + if (!me || (*me->key == '*' && *key != '*')) { + ret = cache_add(mc, ms, key, mapent, age); + if (!ret) { +diff --git a/modules/lookup_file.c b/modules/lookup_file.c +index 466690a..894f6fd 100644 +--- a/modules/lookup_file.c ++++ b/modules/lookup_file.c +@@ -1116,9 +1116,14 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * + + cache_readlock(mc); + me = cache_lookup(mc, key); +- /* Stale mapent => check for wildcard */ +- if (me && !me->mapent) +- me = cache_lookup_distinct(mc, "*"); ++ /* Stale mapent => check for entry in alternate source or wildcard */ ++ if (me && !me->mapent) { ++ while ((me = cache_lookup_key_next(me))) ++ if (me->source == source) ++ break; ++ if (!me) ++ me = cache_lookup_distinct(mc, "*"); ++ } + if (me && (me->source == source || *me->key == '/')) { + pthread_cleanup_push(cache_lock_cleanup, mc); + mapent_len = strlen(me->mapent); +diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c +index ded26f7..5cc2148 100644 +--- a/modules/lookup_ldap.c ++++ b/modules/lookup_ldap.c +@@ -2596,9 +2596,14 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * + + cache_readlock(mc); + me = cache_lookup(mc, key); +- /* Stale mapent => check for wildcard */ +- if (me && !me->mapent) +- me = cache_lookup_distinct(mc, "*"); ++ /* Stale mapent => check for entry in alternate source or wildcard */ ++ if (me && !me->mapent) { ++ while ((me = cache_lookup_key_next(me))) ++ if (me->source == source) ++ break; ++ if (!me) ++ me = cache_lookup_distinct(mc, "*"); ++ } + if (me && (me->source == source || *me->key == '/')) { + mapent_len = strlen(me->mapent); + mapent = alloca(mapent_len + 1); +diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c +index 628ffcf..3c19fd3 100644 +--- a/modules/lookup_nisplus.c ++++ b/modules/lookup_nisplus.c +@@ -530,9 +530,14 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * + + cache_readlock(mc); + me = cache_lookup(mc, key); +- /* Stale mapent => check for wildcard */ +- if (me && !me->mapent) +- me = cache_lookup_distinct(mc, "*"); ++ /* Stale mapent => check for entry in alternate source or wildcard */ ++ if (me && !me->mapent) { ++ while ((me = cache_lookup_key_next(me))) ++ if (me->source == source) ++ break; ++ if (!me) ++ me = cache_lookup_distinct(mc, "*"); ++ } + if (me && (me->source == source || *me->key == '/')) { + mapent_len = strlen(me->mapent); + mapent = alloca(mapent_len + 1); +diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c +index 0fc84f8..14f981c 100644 +--- a/modules/lookup_yp.c ++++ b/modules/lookup_yp.c +@@ -636,9 +636,14 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * + + cache_readlock(mc); + me = cache_lookup(mc, key); +- /* Stale mapent => check for wildcard */ +- if (me && !me->mapent) +- me = cache_lookup_distinct(mc, "*"); ++ /* Stale mapent => check for entry in alternate source or wildcard */ ++ if (me && !me->mapent) { ++ while ((me = cache_lookup_key_next(me))) ++ if (me->source == source) ++ break; ++ if (!me) ++ me = cache_lookup_distinct(mc, "*"); ++ } + if (me && (me->source == source || *me->key == '/')) { + mapent_len = strlen(me->mapent); + mapent = alloca(mapent_len + 1); --- autofs5-5.0.3.orig/debian/patches/01UPSTREAM_autofs-5.0.3-remove-redundant-dns-name-lookups.patch +++ autofs5-5.0.3/debian/patches/01UPSTREAM_autofs-5.0.3-remove-redundant-dns-name-lookups.patch @@ -0,0 +1,246 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01UPSTREAM_autofs-5.0.3-remove-redundant-dns-name-lookups.patch +## DP: Supplied by upstream. + +@DPATCH@ + + +autofs-5.0.3 - eliminate redundant DNS name lookups + +From: Ian Kent + +When autofs tries to lookup a DNS host name where one or more DNS +servers aren't available the mount can take a long time. This is +caused by autofs doing the name lookups more often than it needs +to. This patch removes a number of these redundant name lookups. +--- + + CHANGELOG | 1 + + include/replicated.h | 1 + + include/rpc_subs.h | 4 +++- + lib/rpc_subs.c | 22 ++++++++++++++++++++-- + modules/replicated.c | 25 +++++++++++++++++++------ + 5 files changed, 44 insertions(+), 9 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index 3ed84d3..995daea 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -17,6 +17,7 @@ + - add check for exports automatically mounted by NFS kernel client. + - update nsswitch parser to ignore nsswitch sources that aren't supported. + - check for map key in (possible) alternate map sources when doing lookup. ++- eliminate redundant DNS name lookups. + + 14/01/2008 autofs-5.0.3 + ----------------------- +diff --git a/include/replicated.h b/include/replicated.h +index 672f853..88cd08a 100644 +--- a/include/replicated.h ++++ b/include/replicated.h +@@ -52,6 +52,7 @@ + struct host { + char *name; + char *addr; ++ size_t addr_len; + char *path; + unsigned int version; + unsigned int proximity; +diff --git a/include/rpc_subs.h b/include/rpc_subs.h +index 3292e01..e20a89d 100644 +--- a/include/rpc_subs.h ++++ b/include/rpc_subs.h +@@ -46,6 +46,8 @@ + + struct conn_info { + const char *host; ++ const char *addr; ++ size_t addr_len; + unsigned short port; + unsigned long program; + unsigned long version; +@@ -61,7 +63,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 *, const char *, unsigned int); ++int rpc_portmap_getclient(struct conn_info *, const char *, const char *, size_t, const char *, unsigned int); + unsigned short rpc_portmap_getport(struct conn_info *, struct pmap *); + 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 5797639..6be86c6 100644 +--- a/lib/rpc_subs.c ++++ b/lib/rpc_subs.c +@@ -86,6 +86,11 @@ static CLIENT *create_udp_client(struct conn_info *info) + memset(&raddr, 0, sizeof(raddr)); + + raddr.sin_family = AF_INET; ++ if (info->addr) { ++ memcpy(&raddr.sin_addr.s_addr, info->addr, info->addr_len); ++ goto got_addr; ++ } ++ + if (inet_aton(info->host, &raddr.sin_addr)) + goto got_addr; + +@@ -295,6 +300,11 @@ static CLIENT *create_tcp_client(struct conn_info *info) + memset(&addr, 0, sizeof(addr)); + + addr.sin_family = AF_INET; ++ if (info->addr) { ++ memcpy(&addr.sin_addr.s_addr, info->addr, info->addr_len); ++ goto got_addr; ++ } ++ + if (inet_aton(info->host, &addr.sin_addr)) + goto got_addr; + +@@ -407,8 +417,8 @@ void rpc_destroy_tcp_client(struct conn_info *info) + } + + int rpc_portmap_getclient(struct conn_info *info, +- const char *host, const char *proto, +- unsigned int option) ++ const char *host, const char *addr, size_t addr_len, ++ const char *proto, unsigned int option) + { + struct protoent *pe_proto; + CLIENT *client; +@@ -418,6 +428,8 @@ int rpc_portmap_getclient(struct conn_info *info, + return 0; + + info->host = host; ++ info->addr = addr; ++ info->addr_len = addr_len; + info->program = PMAPPROG; + info->port = PMAPPORT; + info->version = PMAPVERS; +@@ -462,6 +474,8 @@ unsigned short rpc_portmap_getport(struct conn_info *info, struct pmap *parms) + client = info->client; + else { + 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; +@@ -589,6 +603,8 @@ static unsigned int __rpc_ping(const char *host, + struct pmap parms; + + info.host = host; ++ info.addr = NULL; ++ info.addr_len = 0; + info.program = NFS_PROGRAM; + info.version = version; + info.send_sz = 0; +@@ -769,6 +785,8 @@ exports rpc_get_exports(const char *host, long seconds, long micros, unsigned in + int status; + + info.host = host; ++ info.addr = NULL; ++ info.addr_len = 0; + info.program = MOUNTPROG; + info.version = MOUNTVERS; + info.send_sz = 0; +diff --git a/modules/replicated.c b/modules/replicated.c +index 90b2925..efbe6b4 100644 +--- a/modules/replicated.c ++++ b/modules/replicated.c +@@ -225,7 +225,9 @@ static unsigned int get_proximity(const char *host_addr, int addr_len) + return PROXIMITY_OTHER; + } + +-static struct host *new_host(const char *name, const char *addr, unsigned int proximity, unsigned int weight) ++static struct host *new_host(const char *name, ++ const char *addr, size_t addr_len, ++ unsigned int proximity, unsigned int weight) + { + struct host *new; + char *tmp1, *tmp2; +@@ -237,11 +239,12 @@ static struct host *new_host(const char *name, const char *addr, unsigned int pr + if (!tmp1) + return NULL; + +- tmp2 = strdup(addr); ++ tmp2 = malloc(addr_len); + if (!tmp2) { + free(tmp1); + return NULL; + } ++ memcpy(tmp2, addr, addr_len); + + new = malloc(sizeof(struct host)); + if (!new) { +@@ -253,6 +256,7 @@ static struct host *new_host(const char *name, const char *addr, unsigned int pr + memset(new, 0, sizeof(struct host)); + + new->name = tmp1; ++ new->addr_len = addr_len; + new->addr = tmp2; + new->proximity = proximity; + new->weight = weight; +@@ -437,7 +441,8 @@ static unsigned int get_nfs_info(unsigned logopt, struct host *host, + v3_ver: + if (!have_port_opt) { + status = rpc_portmap_getclient(pm_info, +- host->name, proto, RPC_CLOSE_DEFAULT); ++ host->name, host->addr, host->addr_len, ++ proto, RPC_CLOSE_DEFAULT); + if (!status) + goto done_ver; + } +@@ -551,6 +556,8 @@ static int get_vers_and_cost(unsigned logopt, struct host *host, + timeout = RPC_TIMEOUT * 8; + + rpc_info.host = host->name; ++ rpc_info.addr = host->addr; ++ rpc_info.addr_len = host->addr_len; + rpc_info.program = NFS_PROGRAM; + rpc_info.timeout.tv_sec = timeout; + rpc_info.close_option = RPC_CLOSE_DEFAULT; +@@ -606,6 +613,8 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host, + timeout = RPC_TIMEOUT * 8; + + rpc_info.host = host->name; ++ rpc_info.addr = host->addr; ++ rpc_info.addr_len = host->addr_len; + rpc_info.program = NFS_PROGRAM; + rpc_info.timeout.tv_sec = timeout; + rpc_info.close_option = RPC_CLOSE_DEFAULT; +@@ -652,7 +661,8 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host, + return 0; + } else { + int ret = rpc_portmap_getclient(&pm_info, +- host->name, proto, RPC_CLOSE_DEFAULT); ++ host->name, host->addr, host->addr_len, ++ proto, RPC_CLOSE_DEFAULT); + if (!ret) + return 0; + +@@ -868,7 +878,7 @@ static int add_host_addrs(struct host **list, const char *host, unsigned int wei + if (prx == PROXIMITY_ERROR) + return 0; + +- if (!(new = new_host(host, thost, prx, weight))) ++ if (!(new = new_host(host, thost, sizeof(saddr.sin_addr), prx, weight))) + return 0; + + if (!add_host(list, new)) +@@ -891,11 +901,14 @@ static int add_host_addrs(struct host **list, const char *host, unsigned int wei + } + + for (haddr = phe->h_addr_list; *haddr; haddr++) { ++ struct in_addr tt; ++ + prx = get_proximity(*haddr, phe->h_length); + if (prx == PROXIMITY_ERROR) + return 0; + +- if (!(new = new_host(host, *haddr, prx, weight))) ++ memcpy(&tt, *haddr, sizeof(struct in_addr)); ++ if (!(new = new_host(host, *haddr, phe->h_length, prx, weight))) + return 0; + + if (!add_host(list, new)) { --- autofs5-5.0.3.orig/debian/patches/13ldap_module_linkage.dpatch +++ autofs5-5.0.3/debian/patches/13ldap_module_linkage.dpatch @@ -0,0 +1,18 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 13ldap_module_linkage.dpatch by +## +## DP: lookup_ldap.so has symbol references to libcrypto and libkrb5, +## DP: so link to them explicitly. + +@DPATCH@ +--- autofs5-5.0.3.orig/modules/Makefile 2008-06-12 21:53:14.000000000 +0200 ++++ autofs5-5.0.3/modules/Makefile 2008-06-12 21:53:26.000000000 +0200 +@@ -43,7 +43,7 @@ + ifeq ($(SASL), 1) + SASL_OBJ = cyrus-sasl.o + LDAP_FLAGS += $(SASL_FLAGS) $(XML_FLAGS) -DLDAP_THREAD_SAFE +- LIBLDAP += $(LIBSASL) $(XML_LIBS) ++ LIBLDAP += $(LIBSASL) $(XML_LIBS) -lcrypto -lkrb5 + endif + endif +