- Update am-utils to current git to get needed NFSv3 functionality.

This commit is contained in:
Ian Kent 2014-10-21 18:23:01 +08:00
parent 0173213b27
commit 14a4da86dd
23 changed files with 58 additions and 952 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ am-utils-6.1.5.tar.gz
*~
*.log
*.rpm
/am-utils-6.2.0-1.git.bb13dea6.tar.gz

View File

@ -1,17 +0,0 @@
--- am-utils-6.1.5/m4/macros/linux_headers.m4.kzak 2005-02-19 22:38:58.000000000 +0100
+++ am-utils-6.1.5/m4/macros/linux_headers.m4 2006-12-18 21:28:04.000000000 +0100
@@ -14,7 +14,14 @@
],
[
if (argc > 1)
+#ifdef UTS_RELEASE
printf("%s", UTS_RELEASE);
+#else
+# define AMU_MA(a) ((a) >> 16)
+# define AMU_MI(a) (((a) & 0xffff) >> 8)
+# define AMU_PL(a) ((a) & 0xff)
+ printf("%d.%d.%d", AMU_MA(LINUX_VERSION_CODE), AMU_MI(LINUX_VERSION_CODE), AMU_PL(LINUX_VERSION_CODE));
+#endif
],
[ host_header_version=$value ],
[ echo

View File

@ -1,123 +0,0 @@
diff -up am-utils-6.1.new/bootstrap.kzak am-utils-6.1.new/bootstrap
--- am-utils-6.1.new/bootstrap.kzak 2003-10-11 08:02:04.000000000 +0200
+++ am-utils-6.1.new/bootstrap 2008-05-21 12:16:36.000000000 +0200
@@ -28,21 +28,13 @@ rm -fr autom4te.cache autom4te-*.cache
# generate acinclude.m4 file
echo "AMU: prepare acinclude.m4..."
test -f acinclude.m4 && mv -f acinclude.m4 acinclude.m4.old
-(cd m4/macros
- for i in HEADER *.m4; do
- cat $i
- echo
- echo
- done
- cat TRAILER
-) > acinclude.m4
# generate aclocal.m4 file
echo "AMU: aclocal..."
test -f aclocal.m4 && mv -f aclocal.m4 aclocal.m4.old
# show version
aclocal --version 2>&1 | head -1
-if aclocal ; then
+if aclocal -I m4/macros ; then
:
else
echo "aclocal command failed. fix errors and rerun $0."
@@ -60,7 +52,7 @@ autoconf configure.in > configure.new 2>
CUTWARNMSG1="warning: AC_PROG_LEX invoked multiple times|do not use m4_(patsubst|regexp):"
egrep -v "${CUTWARNMSG1}" ${LOG} > ${LOG}.new
mv ${LOG}.new ${LOG}
-if test -s ${LOG}; then
+if false && test -s ${LOG}; then
echo "AUTOCONF ERRORS (MUST FIX):"
cat ${LOG}
rm -f ${LOG}
@@ -80,7 +72,7 @@ autoheader configure.in > config.h.in 2>
CUTWARNMSG2="autoheader: \`config.h.in' is updated"
egrep -v "${CUTWARNMSG2}" ${LOG} > ${LOG}.new
mv ${LOG}.new ${LOG}
-if test -s ${LOG}; then
+if false && test -s ${LOG}; then
echo "AUTOHEADER ERRORS (MUST FIX):"
cat ${LOG}
rm -f ${LOG}
diff -up am-utils-6.1.new/configure.in.kzak am-utils-6.1.new/configure.in
--- am-utils-6.1.new/configure.in.kzak 2006-05-11 19:25:47.000000000 +0200
+++ am-utils-6.1.new/configure.in 2008-05-21 20:52:48.000000000 +0200
@@ -15,6 +15,7 @@ dnl new init style: PACKAGE, VERSION, BU
AC_INIT([am-utils],
sinclude([vers.m4]),
[https://bugzilla.am-utils.org/ or am-utils@am-utils.org])
+
AC_MSG_NOTICE(*** INITIALIZATION ***)
AC_CONFIG_SRCDIR([amd/amd.c])
AM_CONFIG_HEADER(config.h)
@@ -1286,6 +1287,8 @@ AMU_CHECK_LIBWRAP_SEVERITY
fi
dnl ======================================================================
+AMU_HDR_TEMPLATES
+
dnl *********
AMU_SAVE_STATE
dnl *********
diff -up am-utils-6.1.new/m4/macros/save_state.m4.kzak am-utils-6.1.new/m4/macros/save_state.m4
--- am-utils-6.1.new/m4/macros/save_state.m4.kzak 2002-01-07 08:36:24.000000000 +0100
+++ am-utils-6.1.new/m4/macros/save_state.m4 2008-05-21 12:16:36.000000000 +0200
@@ -1,12 +1,12 @@
dnl ######################################################################
dnl AC_SAVE_STATE: save confdefs.h onto dbgcf.h and write $ac_cv_* cache
dnl variables that are known so far.
-define(AMU_SAVE_STATE,
-AC_MSG_NOTICE(*** SAVING CONFIGURE STATE ***)
+AC_DEFUN([AMU_SAVE_STATE],
+[AC_MSG_NOTICE(*** SAVING CONFIGURE STATE ***)
if test -f confdefs.h
then
cp confdefs.h dbgcf.h
fi
-[AC_CACHE_SAVE]
+AC_CACHE_SAVE]
)
dnl ======================================================================
diff -up am-utils-6.1.new/m4/macros/cache_check_dynamic.m4.kzak am-utils-6.1.new/m4/macros/cache_check_dynamic.m4
--- am-utils-6.1.new/m4/macros/cache_check_dynamic.m4.kzak 2002-06-21 19:12:14.000000000 +0200
+++ am-utils-6.1.new/m4/macros/cache_check_dynamic.m4 2008-05-21 12:16:36.000000000 +0200
@@ -8,7 +8,7 @@ dnl after COMMANDS are run.
dnl
dnl ======================================================================
dnl AMU_CACHE_CHECK_DYNAMIC(MESSAGE, CACHE-ID, COMMANDS)
-define(AMU_CACHE_CHECK_DYNAMIC,
+AC_DEFUN([AMU_CACHE_CHECK_DYNAMIC],
[
ac_tmp=`echo $2`
if eval "test \"`echo '$''{'$ac_tmp'+set}'`\" = set"; then
diff -up am-utils-6.1.new/m4/macros/header_templates.m4.kzak am-utils-6.1.new/m4/macros/header_templates.m4
--- am-utils-6.1.new/m4/macros/header_templates.m4.kzak 2005-10-26 05:33:12.000000000 +0200
+++ am-utils-6.1.new/m4/macros/header_templates.m4 2008-05-21 20:37:28.000000000 +0200
@@ -1,5 +1,7 @@
dnl FILE: m4/macros/header_templates.m4
dnl defines descriptions for various am-utils specific macros
+AC_DEFUN([AMU_HDR_TEMPLATES],
+[
AH_TEMPLATE([HAVE_AMU_FS_AUTO],
[Define if have automount filesystem])
@@ -997,3 +999,5 @@ AH_TEMPLATE([NEED_LIBWRAP_SEVERITY_VARIA
AH_TEMPLATE([HAVE_EXTERN_LDAP_ENABLE_CACHE],
[does extern definition for ldap_enable_cache() exist?])
+
+])
diff -up am-utils-6.1.new/m4/macros/mount_headers.m4.kzak am-utils-6.1.new/m4/macros/mount_headers.m4
--- am-utils-6.1.new/m4/macros/mount_headers.m4.kzak 2002-01-07 08:36:23.000000000 +0100
+++ am-utils-6.1.new/m4/macros/mount_headers.m4 2008-05-21 12:16:36.000000000 +0200
@@ -1,6 +1,6 @@
dnl ######################################################################
dnl an M4 macro to include a list of common headers being used everywhere
-define(AMU_MOUNT_HEADERS,
+AC_DEFUN([AMU_MOUNT_HEADERS],
[
#include "${srcdir}/include/mount_headers1.h"
#include AMU_NFS_PROTOCOL_HEADER

View File

@ -1,24 +0,0 @@
From: Ian Kent <raven@themaw.net>
---
conf/autofs/autofs_linux.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/conf/autofs/autofs_linux.c b/conf/autofs/autofs_linux.c
index 5e6a171..fd5dbc6 100644
--- a/conf/autofs/autofs_linux.c
+++ b/conf/autofs/autofs_linux.c
@@ -753,6 +753,10 @@ autofs_umount_succeeded(am_node *mp)
autofs_fh_t *fh = mp->am_parent->am_autofs_fh;
struct autofs_pending_umount **pp, *p;
+ /* Already gone? */
+ if (fh == NULL)
+ return 0;
+
pp = &fh->pending_umounts;
while (*pp && !STREQ((*pp)->name, mp->am_name))
pp = &(*pp)->next;

View File

@ -1,35 +0,0 @@
am-utils-6.1.5 - dont background autofs umount
From: Ian Kent <ikent@redhat.com>
When using an autofs multi-level mount map amd can fail to umount
NFS leaf mounts causing shutdown to fail. It also can cause amd to
SEGV because, even though umounts fail, the autofs mount control
structure is freed and a later umount attempt doesn't check if this
struct is valid before using it.
The cause of the umount failure appears to be the background umount
of NFS mounts at the leaf of the tree not finishing before the autofs
file system mounts above are attempted.
It isn't worth adding a patch to check if the autofs mount control
structure is valid because if it isn't, in this case, amd doesn't
crash but still becomes unresponsive.
---
amd/map.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/amd/map.c b/amd/map.c
index 2fad4b7..8e86b39 100644
--- a/amd/map.c
+++ b/amd/map.c
@@ -946,7 +946,8 @@ unmount_mp(am_node *mp)
#endif /* HAVE_FS_AUTOFS */
if ((mf->mf_fsflags & FS_UBACKGROUND) &&
- (mf->mf_flags & MFF_MOUNTED)) {
+ (mf->mf_flags & MFF_MOUNTED) &&
+ !(mf->mf_flags & MFF_ON_AUTOFS)) {
dlog("Trying unmount in background");
run_task(unmount_node, (opaque_t) mp,
free_map_if_success, (opaque_t) mp);

View File

@ -1,26 +0,0 @@
CVE-2008-1078 am-utils: insecure usage of temporary files
Addresses-Red-Hat-Bugzilla: #435420
Signed-off-by: Karel Zak <kzak@redhat.com>
diff -up am-utils-6.1.5/scripts/expn.in.kzak am-utils-6.1.5/scripts/expn.in
--- am-utils-6.1.5/scripts/expn.in.kzak 2008-05-29 12:43:19.000000000 +0200
+++ am-utils-6.1.5/scripts/expn.in 2008-05-29 12:44:20.000000000 +0200
@@ -9,6 +9,7 @@
# hardcoded constants, should work fine for BSD-based systems
#require 'sys/socket.ph'; # perl 4
use Socket; # perl 5
+use Fcntl
$AF_INET = &AF_INET;
$SOCK_STREAM = &SOCK_STREAM;
@@ -1009,7 +1010,7 @@ sub mxlookup
}
$0 = "$av0 - nslookup of $server";
- open(T,">/tmp/expn$$") || die "open > /tmp/expn$$: $!\n";
+ sysopen(T,"/tmp/expn$$", O_EXCL | O_CREAT) || die "open > /tmp/expn$$: $!\n";
print T "set querytype=MX\n";
print T "$server\n";
close(T);

View File

@ -1,28 +0,0 @@
am-utils-6.1.5 - fix autofs proto version define
From: Ian Kent <raven@themaw.net>
I don't think am-utils works with autofs protocol version 5.
---
conf/autofs/autofs_linux.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/conf/autofs/autofs_linux.c b/conf/autofs/autofs_linux.c
index f56befa..eeb211f 100644
--- a/conf/autofs/autofs_linux.c
+++ b/conf/autofs/autofs_linux.c
@@ -59,8 +59,11 @@
*/
#define AUTOFS_MIN_VERSION 3
+#if AUTOFS_MAX_PROTO_VERSION >= 5
+#define AUTOFS_MAX_VERSION 4
+#else
#define AUTOFS_MAX_VERSION AUTOFS_MAX_PROTO_VERSION
-
+#endif
/*
* STRUCTURES:

View File

@ -1,33 +0,0 @@
am-utils-6.1.5 - handle ENOENT umount return for autofs mounts
From: Ian Kent <ikent@redhat.com>
An ENOENT return from umount(2) means the kernel path walk couldn't
resolve the path of the mount to a dentry. In that case there can't
be an autofs waitq entry waiting for notification, since there's no
dentry, so don't even try to notify the kernel.
---
amd/map.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/amd/map.c b/amd/map.c
index 8e86b39..e6d14b8 100644
--- a/amd/map.c
+++ b/amd/map.c
@@ -873,10 +873,12 @@ free_map_if_success(int rc, int term, opaque_t arg)
else
plog(XLOG_ERROR, "%s: unmount: %s", mp->am_path, strerror(rc));
#ifdef HAVE_FS_AUTOFS
- if (mf->mf_flags & MFF_IS_AUTOFS)
- autofs_get_mp(mp);
- if (mp->am_flags & AMF_AUTOFS)
- autofs_umount_failed(mp);
+ if (rc != ENOENT) {
+ if (mf->mf_flags & MFF_IS_AUTOFS)
+ autofs_get_mp(mp);
+ if (mp->am_flags & AMF_AUTOFS)
+ autofs_umount_failed(mp);
+ }
#endif /* HAVE_FS_AUTOFS */
amd_stats.d_uerr++;
} else {

View File

@ -1,69 +0,0 @@
diff -up am-utils-6.1.5/amd/amq_svc.c.kzak am-utils-6.1.5/amd/amq_svc.c
--- am-utils-6.1.5/amd/amq_svc.c.kzak 2006-01-02 19:40:31.000000000 +0100
+++ am-utils-6.1.5/amd/amq_svc.c 2010-03-01 12:43:25.000000000 +0100
@@ -65,47 +65,17 @@ int allow_severity=0, deny_severity=0;
* Returns: 1=allowed, 0=denied.
*/
static int
-amqsvc_is_client_allowed(const struct sockaddr_in *addr, char *remote)
+amqsvc_is_client_allowed(const struct sockaddr_in *addr)
{
- struct hostent *h;
- char *name = NULL, **ad;
- int ret = 0; /* default is 0==denied */
-
- /* Check IP address */
- if (hosts_ctl(AMD_SERVICE_NAME, "", remote, "")) {
- ret = 1;
- goto out;
- }
- /* Get address */
- if (!(h = gethostbyaddr((const char *)&(addr->sin_addr),
- sizeof(addr->sin_addr),
- AF_INET)))
- goto out;
- if (!(name = strdup(h->h_name)))
- goto out;
- /* Paranoia check */
- if (!(h = gethostbyname(name)))
- goto out;
- for (ad = h->h_addr_list; *ad; ad++)
- if (!memcmp(*ad, &(addr->sin_addr), h->h_length))
- break;
- if (!*ad)
- goto out;
- if (hosts_ctl(AMD_SERVICE_NAME, "", h->h_name, "")) {
- return 1;
- goto out;
- }
- /* Check aliases */
- for (ad = h->h_aliases; *ad; ad++)
- if (hosts_ctl(AMD_SERVICE_NAME, "", *ad, "")) {
- return 1;
- goto out;
- }
+ struct request_info req;
+
+ request_init(&req, RQ_DAEMON, AMD_SERVICE_NAME, RQ_CLIENT_SIN, addr, 0);
+ sock_methods(&req);
+
+ if (hosts_access(&req))
+ return 1;
- out:
- if (name)
- XFREE(name);
- return ret;
+ return 0;
}
#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
@@ -127,7 +97,7 @@ amq_program_1(struct svc_req *rqstp, SVC
struct sockaddr_in *remote_addr = svc_getcaller(rqstp->rq_xprt);
char *remote_hostname = inet_ntoa(remote_addr->sin_addr);
- if (!amqsvc_is_client_allowed(remote_addr, remote_hostname)) {
+ if (!amqsvc_is_client_allowed(remote_addr)) {
plog(XLOG_WARNING, "Amd denied remote amq service to %s", remote_hostname);
svcerr_auth(transp, AUTH_FAILED);
return;

View File

@ -1,27 +0,0 @@
--- am-utils-6.1.5/conf/mount/mount_linux.c.kzak 2006-08-24 15:59:24.000000000 +0200
+++ am-utils-6.1.5/conf/mount/mount_linux.c 2006-08-24 15:59:32.000000000 +0200
@@ -277,7 +277,7 @@
int errorcode;
/* Fake some values for linux */
- mnt_data->version = NFS_MOUNT_VERSION;
+ mnt_data->version = AMD_NFS_MOUNT_VERSION;
if (!mnt_data->timeo) {
#ifdef MNT2_NFS_OPT_TCP
if (mnt_data->flags & MNT2_NFS_OPT_TCP)
--- am-utils-6.1.5/conf/nfs_prot/nfs_prot_linux.h.kzak 2006-08-24 15:55:02.000000000 +0200
+++ am-utils-6.1.5/conf/nfs_prot/nfs_prot_linux.h 2006-08-24 15:58:27.000000000 +0200
@@ -241,6 +241,13 @@
u_char data[FHSIZE3];
};
+/* version of our nsf_mount_data struct
+ * -- we cannot use NFS_MOUNT_VERSION from system kernel
+ * headers, because there could version that doesn't
+ * match with nfs_args struct.
+ */
+#define AMD_NFS_MOUNT_VERSION 4
+
struct nfs_args {
int version; /* 1 */
int fd; /* 1 */

View File

@ -1,64 +0,0 @@
amd does not work with kernel 2.6.25
Just after start-up, one can find the following in /var/log/messages:
Jun 10 11:36:28 tantale amd[18589]: '/net': mount: No locks available
Jun 10 11:36:29 tantale kernel: Invalid hostname "pid18588@tantale:/net" in NFS lock request
From: Philippe Troin <phil@fifi.org>
Addresses: https://bugzilla.am-utils.org/show_bug.cgi?id=612
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=450754
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=640383
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=602938
---
amd/amfs_toplvl.c | 5 ++++-
amd/autil.c | 8 ++++++--
configure.in | 3 +++
3 files changed, 13 insertions(+), 3 deletions(-)
--- am-utils-6.1.5.orig/amd/amfs_toplvl.c
+++ am-utils-6.1.5/amd/amfs_toplvl.c
@@ -226,7 +226,10 @@ amfs_toplvl_mount(am_node *mp, mntfs *mf
MNTTAB_OPT_RETRANS, gopt.amfs_auto_retrans[AMU_TYPE_TOPLVL]);
xstrlcat(opts, toplvl_opts, sizeof(opts));
}
-
+#ifdef MNTTAB_OPT_NOLOCK
+ xstrlcat(opts, ",", sizeof(opts));
+ xstrlcat(opts, MNTTAB_OPT_NOLOCK, sizeof(opts));
+#endif /* MNTTAB_OPT_NOLOCK */
#ifdef MNTTAB_OPT_NOAC
if (gopt.auto_attrcache == 0) {
xstrlcat(opts, ",", sizeof(opts));
--- am-utils-6.1.5.orig/amd/autil.c
+++ am-utils-6.1.5/amd/autil.c
@@ -491,9 +491,13 @@ amfs_mount(am_node *mp, mntfs *mf, char
/*
* Make a ``hostname'' string for the kernel
+ *
+ * Linux kernel since v2.6.19-rc1 (commit 8dead0dbd478f35fd943f3719591e5af1ac0950d)
+ * does not accept '/' in hostname in NFS lock requests.
+ * -- kzak@redhat.com, 06-Oct-2010
*/
- xsnprintf(fs_hostname, sizeof(fs_hostname), "pid%ld@%s:%s",
- get_server_pid(), am_get_hostname(), dir);
+ xsnprintf(fs_hostname, sizeof(fs_hostname), "%s", am_get_hostname());
+
/*
* Most kernels have a name length restriction (64 bytes)...
*/
--- am-utils-6.1.5.orig/configure.in
+++ am-utils-6.1.5/configure.in
@@ -621,6 +621,9 @@ AC_CHECK_HEADERS([ \
# ifndef __KERNEL__
# define __KERNEL__
# endif /* __KERNEL__ */
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif /* HAVE_SYS_SOCKET_H */
#ifdef HAVE_LINUX_SOCKET_H
# include <linux/socket.h>
#endif /* HAVE_LINUX_SOCKET_H */

View File

@ -1,15 +0,0 @@
diff -ur am-utils-6.1.5.orig/scripts/fixrmtab.in am-utils-6.1.5/scripts/fixrmtab.in
--- am-utils-6.1.5.orig/scripts/fixrmtab.in 2006-08-18 16:24:53.000000000 -0400
+++ am-utils-6.1.5/scripts/fixrmtab.in 2006-08-18 16:31:12.000000000 -0400
@@ -11,7 +11,10 @@
#set -x
RMTAB=/etc/rmtab
-TMP=/tmp/rmtab.$$
+TMP=`mktemp /tmp/rmtab.XXXXXXXX`
+if [ x"$TMP" = "x" ] ; then
+ exit 1
+fi
if [ ! -f /etc/rmtab ]; then
exit 0

View File

@ -1,12 +0,0 @@
diff -up am-utils-6.1.5/doc/am-utils.texi.orig am-utils-6.1.5/doc/am-utils.texi
--- am-utils-6.1.5/doc/am-utils.texi.orig 2013-04-28 12:55:39.035902316 +0800
+++ am-utils-6.1.5/doc/am-utils.texi 2013-04-28 12:57:13.865766455 +0800
@@ -67,7 +67,7 @@ Copyright @copyright{} 1989 Jan-Simon Pe
Copyright @copyright{} 1989 Imperial College of Science, Technology & Medicine
@*
Copyright @copyright{} 1989 The Regents of the University of California.
-@sp
+@sp 1
All Rights Reserved.
@vskip 1ex
Permission to copy this document, or any portion of it, as

View File

@ -1,103 +0,0 @@
diff -up am-utils-6.1.5/amd/Makefile.am.orig am-utils-6.1.5/amd/Makefile.am
--- am-utils-6.1.5/amd/Makefile.am.orig 2013-04-28 11:00:46.447657616 +0800
+++ am-utils-6.1.5/amd/Makefile.am 2013-04-28 11:01:13.435635544 +0800
@@ -112,7 +112,7 @@ INCLUDES = -I$(top_srcdir)/include
# allow users to add their own flags via "configure --enable-am-flags=ARG"
AMU_CFLAGS = @AMU_CFLAGS@
-AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
+AM_CFLAGS = $(AMU_CFLAGS)
AM_YFLAGS = -d
# dependencies
diff -up am-utils-6.1.5/amq/Makefile.am.orig am-utils-6.1.5/amq/Makefile.am
--- am-utils-6.1.5/amq/Makefile.am.orig 2013-04-28 11:10:03.235036740 +0800
+++ am-utils-6.1.5/amq/Makefile.am 2013-04-28 11:10:15.271022717 +0800
@@ -22,7 +22,7 @@ INCLUDES = -I$(top_srcdir)/include
# allow users to add their own flags via "configure --enable-am-flags=ARG"
AMU_CFLAGS = @AMU_CFLAGS@
-AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
+AM_CFLAGS = $(AMU_CFLAGS)
# additional files to distribute and clean
EXTRA_DIST = $(man_MANS)
diff -up am-utils-6.1.5/fixmount/Makefile.am.orig am-utils-6.1.5/fixmount/Makefile.am
--- am-utils-6.1.5/fixmount/Makefile.am.orig 2013-04-28 11:10:31.786003486 +0800
+++ am-utils-6.1.5/fixmount/Makefile.am 2013-04-28 11:10:43.373990002 +0800
@@ -20,7 +20,7 @@ INCLUDES = -I$(top_srcdir)/include
# allow users to add their own flags via "configure --enable-am-flags=ARG"
AMU_CFLAGS = @AMU_CFLAGS@
-AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
+AM_CFLAGS = $(AMU_CFLAGS)
# additional files to distribute and clean
EXTRA_DIST = $(man_MANS)
diff -up am-utils-6.1.5/fsinfo/Makefile.am.orig am-utils-6.1.5/fsinfo/Makefile.am
--- am-utils-6.1.5/fsinfo/Makefile.am.orig 2013-04-28 11:10:58.384972545 +0800
+++ am-utils-6.1.5/fsinfo/Makefile.am 2013-04-28 11:11:11.180957646 +0800
@@ -43,7 +43,7 @@ INCLUDES = -I$(top_srcdir)/include
# allow users to add their own flags via "configure --enable-am-flags=ARG"
AMU_CFLAGS = @AMU_CFLAGS@
-AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
+AM_CFLAGS = $(AMU_CFLAGS)
AM_YFLAGS = -d
# dependencies
diff -up am-utils-6.1.5/hlfsd/Makefile.am.orig am-utils-6.1.5/hlfsd/Makefile.am
--- am-utils-6.1.5/hlfsd/Makefile.am.orig 2013-04-28 11:12:47.916845475 +0800
+++ am-utils-6.1.5/hlfsd/Makefile.am 2013-04-28 11:13:12.632816898 +0800
@@ -24,7 +24,7 @@ INCLUDES = -I$(top_srcdir)/include
# allow users to add their own flags via "configure --enable-am-flags=ARG"
AMU_CFLAGS = @AMU_CFLAGS@
-AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
+AM_CFLAGS = $(AMU_CFLAGS)
# additional files to distribute and clean
EXTRA_DIST = $(man_MANS)
diff -up am-utils-6.1.5/libamu/Makefile.am.orig am-utils-6.1.5/libamu/Makefile.am
--- am-utils-6.1.5/libamu/Makefile.am.orig 2013-04-28 10:47:29.683225080 +0800
+++ am-utils-6.1.5/libamu/Makefile.am 2013-04-28 11:00:21.405678035 +0800
@@ -69,13 +69,13 @@ libamu_la_DEPENDENCIES = @AMU_LIB_OBJS@
# LDFLAGS should include standard ones plus LIBTOOL ones
-AM_LDFLAGS = @LDFLAGS@ @LIBTOOL_LDFLAGS@
+AM_LDFLAGS = @LIBTOOL_LDFLAGS@
INCLUDES = -I$(top_srcdir)/include
# allow users to add their own flags via "configure --enable-am-flags=ARG"
AMU_CFLAGS = @AMU_CFLAGS@
-AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
+AM_CFLAGS = $(AMU_CFLAGS)
# dependencies
$(libamu_la_OBJECTS) $(libamu_la_LIBADD): \
diff -up am-utils-6.1.5/mk-amd-map/Makefile.am.orig am-utils-6.1.5/mk-amd-map/Makefile.am
--- am-utils-6.1.5/mk-amd-map/Makefile.am.orig 2013-04-28 11:13:28.858798119 +0800
+++ am-utils-6.1.5/mk-amd-map/Makefile.am 2013-04-28 11:13:41.095783984 +0800
@@ -20,7 +20,7 @@ INCLUDES = -I$(top_srcdir)/include
# allow users to add their own flags via "configure --enable-am-flags=ARG"
AMU_CFLAGS = @AMU_CFLAGS@
-AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
+AM_CFLAGS = $(AMU_CFLAGS)
# additional files to distribute and clean
EXTRA_DIST = $(man_MANS)
diff -up am-utils-6.1.5/wire-test/Makefile.am.orig am-utils-6.1.5/wire-test/Makefile.am
--- am-utils-6.1.5/wire-test/Makefile.am.orig 2013-04-28 11:14:00.265761847 +0800
+++ am-utils-6.1.5/wire-test/Makefile.am 2013-04-28 11:14:53.069700943 +0800
@@ -20,7 +20,7 @@ INCLUDES = -I$(top_srcdir)/include
# allow users to add their own flags via "configure --enable-am-flags=ARG"
AMU_CFLAGS = @AMU_CFLAGS@
-AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
+AM_CFLAGS = $(AMU_CFLAGS)
# additional files to distribute and clean
EXTRA_DIST = $(man_MANS)

View File

@ -1,13 +0,0 @@
diff -up am-utils-6.1.5/amd/map.c.orig am-utils-6.1.5/amd/map.c
--- am-utils-6.1.5/amd/map.c.orig 2014-03-19 19:45:45.000000000 +0800
+++ am-utils-6.1.5/amd/map.c 2014-03-19 19:47:42.741848068 +0800
@@ -748,7 +748,8 @@ umount_exported(void)
} else {
am_unmounted(mp);
}
- exported_ap[i] = NULL;
+ if (!(mf->mf_flags && (MFF_UNMOUNTING|MFF_MOUNTED)))
+ exported_ap[i] = NULL;
} else {
/*
* Any other node gets forcibly timed out.

View File

@ -1,50 +0,0 @@
am-utils-6.2-0.git.9b652fb4 - linux umount wait on ebusy
From: Ian Kent <ikent@redhat.com>
For some reason, when umounting autofs mounts after closing the ioctl
file handle, the kernel can return EBUSY for some small amount of time.
This can cause umounts to incorrectly fail when in fact they should
succeed.
Retrying for about a second and a half seems to work quite well.
---
conf/umount/umount_linux.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/conf/umount/umount_linux.c b/conf/umount/umount_linux.c
index 782c2cd..81b0527 100644
--- a/conf/umount/umount_linux.c
+++ b/conf/umount/umount_linux.c
@@ -63,6 +63,7 @@ umount_fs(char *mntdir, const char *mnttabname, u_int unmount_flags)
char loopstr[] = "loop=";
char *loopdev;
#endif /* HAVE_LOOP_DEVICE */
+ unsigned int retries = 8;
mp = mlist = read_mtab(mntdir, mnttabname);
@@ -94,6 +95,7 @@ umount_fs(char *mntdir, const char *mnttabname, u_int unmount_flags)
unlock_mntlist();
#endif /* MOUNT_TABLE_ON_FILE */
+again:
#if defined(HAVE_UMOUNT2) && defined(MNT2_GEN_OPT_DETACH)
/*
* If user asked to try forced unmounts, then do a quick check to see if
@@ -111,6 +113,14 @@ umount_fs(char *mntdir, const char *mnttabname, u_int unmount_flags)
} else
#endif /* defined(HAVE_UMOUNT2) && defined(MNT2_GEN_OPT_DETACH) */
error = UNMOUNT_TRAP(mp_save->mnt);
+
+ /* Linux kernel can be sluggish for some reason */
+ if (error == EBUSY && retries--) {
+ struct timespec tm = {0, 200000000};
+ nanosleep(&tm, NULL);
+ goto again;
+ }
+
if (error < 0) {
plog(XLOG_WARNING, "unmount(%s) failed: %m", mp_save->mnt->mnt_dir);
switch ((error = errno)) {

View File

@ -1,82 +0,0 @@
am-utils-6.2-1.git.e03592f0 - fix debug log deadlock
From: Ian Kent <raven@themaw.net>
It's possible (and likely) a SIGCHLD signal can arrive while in syslog(2)
and also attempt log log a message leading to deadlock.
---
libamu/xutil.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/libamu/xutil.c b/libamu/xutil.c
index b3e3a0f..0d9d2ec 100644
--- a/libamu/xutil.c
+++ b/libamu/xutil.c
@@ -420,14 +420,33 @@ debug_option(char *opt)
void
dplog(const char *fmt, ...)
{
+#ifdef HAVE_SIGACTION
+ sigset_t old, chld;
+#else /* not HAVE_SIGACTION */
+ int mask;
+#endif /* not HAVE_SIGACTION */
va_list ap;
+#ifdef HAVE_SIGACTION
+ sigemptyset(&chld);
+ sigaddset(&chld, SIGCHLD);
+#else /* not HAVE_SIGACTION */
+ mask = sigblock(sigmask(SIGCHLD));
+#endif /* not HAVE_SIGACTION */
+
+ sigprocmask(SIG_BLOCK, &chld, &old);
if (!logfp)
logfp = stderr; /* initialize before possible first use */
va_start(ap, fmt);
real_plog(XLOG_DEBUG, fmt, ap);
va_end(ap);
+
+#ifdef HAVE_SIGACTION
+ sigprocmask(SIG_SETMASK, &old, NULL);
+#else /* not HAVE_SIGACTION */
+ mask = sigblock(sigmask(SIGCHLD));
+#endif /* not HAVE_SIGACTION */
}
#endif /* DEBUG */
@@ -435,14 +454,33 @@ dplog(const char *fmt, ...)
void
plog(int lvl, const char *fmt, ...)
{
+#ifdef HAVE_SIGACTION
+ sigset_t old, chld;
+#else /* not HAVE_SIGACTION */
+ int mask;
+#endif /* not HAVE_SIGACTION */
va_list ap;
+#ifdef HAVE_SIGACTION
+ sigemptyset(&chld);
+ sigaddset(&chld, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &chld, &old);
+#else /* not HAVE_SIGACTION */
+ mask = sigblock(sigmask(SIGCHLD));
+#endif /* not HAVE_SIGACTION */
+
if (!logfp)
logfp = stderr; /* initialize before possible first use */
va_start(ap, fmt);
real_plog(lvl, fmt, ap);
va_end(ap);
+
+#ifdef HAVE_SIGACTION
+ sigprocmask(SIG_SETMASK, &old, NULL);
+#else /* not HAVE_SIGACTION */
+ sigsetmask(mask);
+#endif /* not HAVE_SIGACTION */
}

View File

@ -1,22 +0,0 @@
am-utils-6.2-1.git.e03592f0 - fix get_nfs_version() message
From: Ian Kent <ikent@redhat.com>
Fix a error message formating mistake in get_nfs_version().
---
conf/transp/transp_sockets.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/transp/transp_sockets.c b/conf/transp/transp_sockets.c
index d5e729f..5036b26 100644
--- a/conf/transp/transp_sockets.c
+++ b/conf/transp/transp_sockets.c
@@ -478,7 +478,7 @@ try_again:
}
if (errstr) {
- plog(XLOG_INFO, "get_nfs_version NFS(%d,%s) failed for %s%s",
+ plog(XLOG_INFO, "get_nfs_version NFS(%d,%s) failed for %s: %s",
(int) nfs_version, proto, host, errstr);
if (again) {
#ifdef HAVE_FS_NFS3

View File

@ -1,152 +0,0 @@
diff -up am-utils-6.1.5/amd/map.c.orig am-utils-6.1.5/amd/map.c
--- am-utils-6.1.5/amd/map.c.orig 2014-03-19 19:34:23.000000000 +0800
+++ am-utils-6.1.5/amd/map.c 2014-03-19 19:44:17.918101095 +0800
@@ -687,68 +687,80 @@ make_root_node(void)
void
umount_exported(void)
{
- int i;
+ int i, work_done;
- for (i = last_used_map; i >= 0; --i) {
- am_node *mp = exported_ap[i];
- mntfs *mf;
+ do {
+ work_done = 0;
- if (!mp)
- continue;
+ for (i = last_used_map; i >= 0; --i) {
+ am_node *mp = exported_ap[i];
+ mntfs *mf;
- mf = mp->am_mnt;
- if (mf->mf_flags & MFF_UNMOUNTING) {
- /*
- * If this node is being unmounted then just ignore it. However,
- * this could prevent amd from finishing if the unmount gets blocked
- * since the am_node will never be free'd. am_unmounted needs
- * telling about this possibility. - XXX
- */
- continue;
- }
+ if (!mp)
+ continue;
- if (!(mf->mf_fsflags & FS_DIRECTORY))
/*
- * When shutting down this had better
- * look like a directory, otherwise it
- * can't be unmounted!
+ * Wait for children to be removed first
*/
- mk_fattr(&mp->am_fattr, NFDIR);
+ if (mp->am_child)
+ continue;
- if ((--immediate_abort < 0 &&
- !(mp->am_flags & AMF_ROOT) && mp->am_parent) ||
- (mf->mf_flags & MFF_RESTART)) {
+ mf = mp->am_mnt;
+ if (mf->mf_flags & MFF_UNMOUNTING) {
+ /*
+ * If this node is being unmounted then just ignore it. However,
+ * this could prevent amd from finishing if the unmount gets blocked
+ * since the am_node will never be free'd. am_unmounted needs
+ * telling about this possibility. - XXX
+ */
+ continue;
+ }
- /*
- * Just throw this node away without bothering to unmount it. If
- * the server is not known to be up then don't discard the mounted
- * on directory or Amd might hang...
- */
- if (mf->mf_server &&
+ if (!(mf->mf_fsflags & FS_DIRECTORY))
+ /*
+ * When shutting down this had better
+ * look like a directory, otherwise it
+ * can't be unmounted!
+ */
+ mk_fattr(&mp->am_fattr, NFDIR);
+
+ if ((--immediate_abort < 0 &&
+ !(mp->am_flags & AMF_ROOT) && mp->am_parent) ||
+ (mf->mf_flags & MFF_RESTART)) {
+
+ work_done++;
+
+ /*
+ * Just throw this node away without bothering to unmount it. If
+ * the server is not known to be up then don't discard the mounted
+ * on directory or Amd might hang...
+ */
+ if (mf->mf_server &&
(mf->mf_server->fs_flags & (FSF_DOWN | FSF_VALID)) != FSF_VALID)
mf->mf_flags &= ~MFF_MKMNT;
- if (gopt.flags & CFM_UNMOUNT_ON_EXIT || mp->am_flags & AMF_AUTOFS) {
- plog(XLOG_INFO, "on-exit attempt to unmount %s", mf->mf_mount);
- /*
- * use unmount_mp, not unmount_node, so that unmounts be
- * backgrounded as needed.
- */
- unmount_mp((opaque_t) mp);
- } else {
- am_unmounted(mp);
- }
- exported_ap[i] = 0;
- } else {
- /*
- * Any other node gets forcibly timed out.
- */
- mp->am_flags &= ~AMF_NOTIMEOUT;
- mp->am_mnt->mf_flags &= ~MFF_RSTKEEP;
- mp->am_ttl = 0;
- mp->am_timeo = 1;
- mp->am_timeo_w = 0;
- }
- }
+ if (gopt.flags & CFM_UNMOUNT_ON_EXIT || mp->am_flags & AMF_AUTOFS) {
+ plog(XLOG_INFO, "on-exit attempt to unmount %s", mf->mf_mount);
+ /*
+ * use unmount_mp, not unmount_node, so that unmounts be
+ * backgrounded as needed.
+ */
+ unmount_mp((opaque_t) mp);
+ } else {
+ am_unmounted(mp);
+ }
+ exported_ap[i] = NULL;
+ } else {
+ /*
+ * Any other node gets forcibly timed out.
+ */
+ mp->am_flags &= ~AMF_NOTIMEOUT;
+ mp->am_mnt->mf_flags &= ~MFF_RSTKEEP;
+ mp->am_ttl = 0;
+ mp->am_timeo = 1;
+ mp->am_timeo_w = 0;
+ }
+ }
+ } while (work_done);
}
diff -U0 am-utils-6.1.5/ChangeLog.orig am-utils-6.1.5/ChangeLog
--- am-utils-6.1.5/ChangeLog.orig 2006-05-12 01:25:47.000000000 +0800
+++ am-utils-6.1.5/ChangeLog 2014-03-19 19:36:27.335598581 +0800
@@ -0,0 +1,12 @@
+2009-12-10 Christos Zoulas <christos@zoulas.com>
+
+ * Make sure to remove nodes in the proper order when going
+ down. Depending on what order the nodes got created it's
+ possible that the parent of a node has a bigger am_mapno
+ (index in exported_ap[]) so that it gets freed before
+ its child while the child's am_parent pointer is still
+ pointing to the already freed block of memory.
+ This change makes sure that umount_exported() cleans up
+ all children of a node first before freeing the node.
+ From: Krisztian Kovacs <Kris.Kovacs@morganstanley.com>
+

View File

@ -0,0 +1,36 @@
diff -up am-utils-6.2.0-1.git.bb13dea6/bootstrap.orig am-utils-6.2.0-1.git.bb13dea6/bootstrap
--- am-utils-6.2.0-1.git.bb13dea6/bootstrap.orig 2014-10-21 05:42:37.128509523 -0400
+++ am-utils-6.2.0-1.git.bb13dea6/bootstrap 2014-10-21 05:51:38.044996707 -0400
@@ -59,13 +59,13 @@ fi
echo "AMU: Fixing ylwrap..."
patch << \EOF
---- ylwrap.orig 2014-05-08 21:18:30.000000000 -0400
-+++ ylwrap 2014-05-09 22:25:54.900240000 -0400
-@@ -153,6 +153,22 @@
- *[\\/]*) prog="`pwd`/$prog" ;;
+--- ylwrap.orig 2014-10-21 05:38:42.210204684 -0400
++++ ylwrap 2014-10-21 05:44:45.602138698 -0400
+@@ -161,6 +161,22 @@
+ *[\\/]*) prog=`pwd`/$prog ;;
esac
-+prefix=`echo $input | sed \
++prefix=`echo $input | sed \
+ -e 's,^.*/,,g' \
+ -e 's/_gram.[yl]$/_/g' \
+ -e 's/_lex.[yl]$/_/g' \
@@ -81,10 +81,10 @@ patch << \EOF
+ flags="-p $prefix";;
+esac
+
- # FIXME: add hostname here for parallel makes that run commands on
- # other machines. But that might take us over the 14-char limit.
dirname=ylwrap$$
-@@ -166,10 +182,13 @@
+ do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+@@ -172,10 +188,13 @@
cd $dirname
case $# in

View File

@ -26,6 +26,8 @@ browsable_dirs = yes
show_statfs_entries = no
fully_qualified_hosts = no
cache_duration = 300
# Fedora doesn't support NFSv2, use the amd NFSv3 server.
auto_nfs_version = 3
# DEFINE AN AMD MOUNT POINT
[ /net ]

View File

@ -1,13 +1,17 @@
Summary: Automount utilities including an updated version of Amd
Name: am-utils
Version: 6.1.5
Release: 32%{?dist}
Version: 6.2.0
%define githash bb13dea6d0bf378f38a2a009a9802577f5399673
%define shorthash %(echo "%{githash}" | cut -c -8)
%define gitdate 20140906
%define revision 1
Release: %{revision}.%{gitdate}git%{shorthash}%{?dist}
License: BSD
Epoch: 5
Group: System Environment/Daemons
URL: http://am-utils.org
Source: ftp://ftp.am-utils.org/pub/am-utils/am-utils-%{version}.tar.gz
# Git repository git://git.fsl.cs.sunysb.edu/am-utils-6.2.git
Source: am-utils-%{version}-%{revision}.git.%{shorthash}.tar.gz
Source1: amd.service
Source2: am-utils.conf
Source3: am-utils.sysconf
@ -38,39 +42,13 @@ Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(preun): /sbin/install-info
# 203193 - tmpfile usage
Patch1: am-utils-6.1.5-rmtab-temp.patch
# 202180 - amd service doesn't work
Patch2: am-utils-6.1.5-nfs-version.patch
# UTS_RELEASE macro has been removed from the latest kernel
Patch3: am-utils-6.1.5-UTS_RELEASE.patch
# Build system bugfixes
Patch4: am-utils-6.1.5-buildsys.patch
# 435420 - CVE-2008-1078 am-utils: insecure usage of temporary files
Patch5: am-utils-6.1.5-expn-temp.patch
# 450754 - Amd does not work with 2.6.25
# 602938 - am-utils fails on f13 with amfs_toplvl_mount
# 640383 - am-utils doesn't work in Fedora 13
Patch6: am-utils-6.1.5-nolock-toplvl.patch
# 566711 - am-utils: incorrect use of tcp_wrapper
Patch7: am-utils-6.1.5-libwarp.patch
# 955445 - am-utils package should be built with PIE flags
Patch8: am-utils-6.1.5-use-_hardened_build-flag.patch
# Fix documentation build fails.
Patch9: am-utils-6.1.5-texinfo-documentation-build-fixes.patch
# automake ylwrap has changed, fix inline patch in bootstrap.
Patch1: am-utils-6.2.0-1.git.bb13dea6-ylwrap.patch
Patch10: am-utils-6.1.5-dont-background-autofs-umount.patch
Patch11: am-utils-6.1.5-check-fh-on-umount-succeeded.patch
Patch12: am-utils-6.1.5-handle-ENOENT-umount-return-for-autofs-mounts.patch
Patch13: am-utils-6.2-1.git.e03592f0-fix-get_nfs_version-message.patch
Patch14: am-utils-6.2-1.git.e03592f0-fix-debug-log-deadlock.patch
Patch15: am-utils-6.2-0.git.9b652fb4-linux-umount-wait-on-ebusy.patch
Patch16: am-utils-6.2-make-sure-to-remove-nodes-in-the-proper-order-when-going-down.patch
Patch17: am-utils-6.2-0.git.9b652fb4-fix-handle-failed-umount-on-exit.patch
# Don't attempt to use v5 protocol
Patch18: am-utils-6.1.5-fix-autofs-proto-version-define.patch
%global _hardened_build 1
# Not needed since autoreconf/libtool appear to do this automatically
# Leaving it set doesn't appear to be a problem so leave it set in
# case this changes.
%global _hardened_build 1
# We need to filter out some perl requirements for now.
%define _use_internal_dependency_generator 0
@ -88,26 +66,9 @@ You should install am-utils if you need a program for automatically
mounting and unmounting filesystems.
%prep
%setup -q
%setup -q -n %{name}-%{version}-%{revision}.git.%{shorthash}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
find_requires=%{old_find_requires}
echo "$find_requires | grep -v lostaltmail.conf" > find-requires
@ -205,11 +166,9 @@ fi
%files
%doc doc/*.ps AUTHORS BUGS ChangeLog NEWS README* scripts/*-sample
%dir /.automount
%{_bindir}/expn
%{_bindir}/pawd
%{_sbindir}/*
%{_mandir}/man[58]/*
%{_mandir}/man1/expn.1*
%{_mandir}/man1/pawd.1*
%config(noreplace) %{_sysconfdir}/amd.net
%config(noreplace) %{_sysconfdir}/amd.conf
@ -219,6 +178,9 @@ fi
%{_libdir}/libamu.so*
%changelog
* Tue Oct 21 2014 Ian Kent <ikent@redhat.com> - 5:6.2.0-1.20140906gitbb13dea6
- Update am-utils to current git to get needed NFSv3 functionality.
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5:6.1.5-32
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

View File

@ -1 +1 @@
bc07514f4316511ace5087b9e6dc3771 am-utils-6.1.5.tar.gz
6f631a68f7d98eca36feb5d675ff2296 am-utils-6.2.0-1.git.bb13dea6.tar.gz