From 50a4d88ce0093b59aadf157dca815ae4f66ac640 Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Fri, 19 Sep 2008 09:00:03 +0000 Subject: [PATCH] - add upstream bug fixes - bug fix for mtab check. - bug fix for zero length nis key. - update for ifc buffer handling. - bug fix for kernel automount handling. - warning: I found a bunch of patches that were present but not being applied. --- ...5.0.3-check-for-kernel-automount-fix.patch | 25 ++++++++ autofs-5.0.3-fix-ifc-buff-size-fix-2.patch | 59 +++++++++++++++++++ ....3-handle-zero-length-nis-key-update.patch | 57 ++++++++++++++++++ autofs-5.0.3-mtab-as-proc-mounts-fix.patch | 25 ++++++++ autofs.spec | 40 ++++++++++++- 5 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 autofs-5.0.3-check-for-kernel-automount-fix.patch create mode 100644 autofs-5.0.3-fix-ifc-buff-size-fix-2.patch create mode 100644 autofs-5.0.3-handle-zero-length-nis-key-update.patch create mode 100644 autofs-5.0.3-mtab-as-proc-mounts-fix.patch diff --git a/autofs-5.0.3-check-for-kernel-automount-fix.patch b/autofs-5.0.3-check-for-kernel-automount-fix.patch new file mode 100644 index 0000000..225f51b --- /dev/null +++ b/autofs-5.0.3-check-for-kernel-automount-fix.patch @@ -0,0 +1,25 @@ +autofs-5.0.3 - check for kernel automount fix + +From: Ian Kent + +Look in the correct mount table for kernel automounted "nohide" +mounts. +--- + + daemon/direct.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + + +diff --git a/daemon/direct.c b/daemon/direct.c +index afb354e..13f572c 100644 +--- a/daemon/direct.c ++++ b/daemon/direct.c +@@ -709,7 +709,7 @@ int mount_autofs_offset(struct autofs_point *ap, struct mapent *me, const char * + * the kernel NFS client. + */ + if (me->multi != me && +- is_mounted(_PATH_MOUNTED, mountpoint, MNTS_REAL)) ++ is_mounted(_PROC_MOUNTS, mountpoint, MNTS_REAL)) + return MOUNT_OFFSET_IGNORE; + + /* diff --git a/autofs-5.0.3-fix-ifc-buff-size-fix-2.patch b/autofs-5.0.3-fix-ifc-buff-size-fix-2.patch new file mode 100644 index 0000000..4010c2d --- /dev/null +++ b/autofs-5.0.3-fix-ifc-buff-size-fix-2.patch @@ -0,0 +1,59 @@ +autofs-5.0.3 - fix ifc buff size fix 2 + +From: Ian Kent + +For the case of a large number of interfaces there can be +a lot of malloc(3)s for every mount which could slow things +down. So we remember the maximum allocation size and use it +in subsequent allocations. +--- + + modules/replicated.c | 12 ++++++++++-- + 1 files changed, 10 insertions(+), 2 deletions(-) + + +diff --git a/modules/replicated.c b/modules/replicated.c +index 35a6675..b435f4b 100644 +--- a/modules/replicated.c ++++ b/modules/replicated.c +@@ -62,7 +62,10 @@ + #ifndef MAX_ERR_BUF + #define MAX_ERR_BUF 512 + #endif ++ + #define MAX_IFC_BUF 2048 ++static int volatile ifc_buf_len = MAX_IFC_BUF; ++static int volatile ifc_last_len = 0; + + #define MASK_A 0x7F000000 + #define MASK_B 0xBFFF0000 +@@ -97,7 +100,7 @@ void seed_random(void) + + static int alloc_ifreq(struct ifconf *ifc, int sock) + { +- int ret, lastlen = 0, len = MAX_IFC_BUF; ++ int ret, lastlen = ifc_last_len, len = ifc_buf_len; + char err_buf[MAX_ERR_BUF], *buf; + + while (1) { +@@ -119,7 +122,7 @@ static int alloc_ifreq(struct ifconf *ifc, int sock) + return 0; + } + +- if (ifc->ifc_len == lastlen) ++ if (ifc->ifc_len <= lastlen) + break; + + lastlen = ifc->ifc_len; +@@ -127,6 +130,11 @@ static int alloc_ifreq(struct ifconf *ifc, int sock) + free(buf); + } + ++ if (lastlen != ifc_last_len) { ++ ifc_last_len = lastlen; ++ ifc_buf_len = len; ++ } ++ + return 1; + } + diff --git a/autofs-5.0.3-handle-zero-length-nis-key-update.patch b/autofs-5.0.3-handle-zero-length-nis-key-update.patch new file mode 100644 index 0000000..f0ec782 --- /dev/null +++ b/autofs-5.0.3-handle-zero-length-nis-key-update.patch @@ -0,0 +1,57 @@ +autofs-5.0.3 - handle zero length nis key update + +From: Ian Kent + +A zero length key is invalid but so is a single character +non-printable key and it causes the parser to get confused +as well. +--- + + modules/lookup_yp.c | 17 +++++++++++++---- + 1 files changed, 13 insertions(+), 4 deletions(-) + + +diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c +index ee06551..8b6408b 100644 +--- a/modules/lookup_yp.c ++++ b/modules/lookup_yp.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -168,9 +169,13 @@ int yp_all_master_callback(int status, char *ypkey, int ypkeylen, + if (status != YP_TRUE) + return status; + +- /* Ignore zero length keys */ +- if (ypkeylen == 0) ++ /* Ignore zero length and single non-printable char keys */ ++ if (ypkeylen == 0 || (ypkeylen == 1 && !isprint(*ypkey))) { ++ warn(logopt, MODPREFIX ++ "ignoring invalid map entry, zero length or " ++ "single character non-printable key"); + return 0; ++ } + + /* + * Ignore keys beginning with '+' as plus map +@@ -267,9 +272,13 @@ int yp_all_callback(int status, char *ypkey, int ypkeylen, + if (status != YP_TRUE) + return status; + +- /* Ignore zero length keys */ +- if (ypkeylen == 0) ++ /* Ignore zero length and single non-printable char keys */ ++ if (ypkeylen == 0 || (ypkeylen == 1 && !isprint(*ypkey))) { ++ warn(logopt, MODPREFIX ++ "ignoring invalid map entry, zero length or " ++ "single character non-printable key"); + return 0; ++ } + + /* + * Ignore keys beginning with '+' as plus map diff --git a/autofs-5.0.3-mtab-as-proc-mounts-fix.patch b/autofs-5.0.3-mtab-as-proc-mounts-fix.patch new file mode 100644 index 0000000..dc01908 --- /dev/null +++ b/autofs-5.0.3-mtab-as-proc-mounts-fix.patch @@ -0,0 +1,25 @@ +autofs-5.0.3 - check for mtab pointing to /proc/mounts fix + +From: Ian Kent + +Fix incorrect initialization in spawn_bind_mount() which +caused bind mounts to not be added to mtab. +--- + + daemon/spawn.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + + +diff --git a/daemon/spawn.c b/daemon/spawn.c +index 85cf9b8..17f92f4 100644 +--- a/daemon/spawn.c ++++ b/daemon/spawn.c +@@ -432,7 +432,7 @@ int spawn_bind_mount(unsigned logopt, ...) + char arg_fake[] = "-f"; + unsigned int options; + unsigned int retries = MTAB_LOCK_RETRIES; +- int update_mtab = 0, ret, printed = 0; ++ int update_mtab = 1, ret, printed = 0; + char buf[PATH_MAX]; + + /* If we use mount locking we can't validate the location */ diff --git a/autofs.spec b/autofs.spec index 5a63a74..40206f6 100644 --- a/autofs.spec +++ b/autofs.spec @@ -4,7 +4,7 @@ Summary: A tool for automatically mounting and unmounting filesystems Name: autofs Version: 5.0.3 -Release: 21 +Release: 23 Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -53,6 +53,10 @@ Patch40: autofs-5.0.3-use-dev-urandom.patch Patch41: autofs-5.0.3-mtab-as-proc-mounts.patch Patch42: autofs-5.0.3-fix-ifc-buff-size.patch Patch43: autofs-5.0.3-fix-percent-hack.patch +Patch44: autofs-5.0.3-mtab-as-proc-mounts-fix.patch +Patch45: autofs-5.0.3-handle-zero-length-nis-key-update.patch +Patch46: autofs-5.0.3-fix-ifc-buff-size-fix-2.patch +Patch47: autofs-5.0.3-check-for-kernel-automount-fix.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs Requires: kernel >= 2.6.17 @@ -116,6 +120,31 @@ echo %{version}-%{release} > .version %patch20 -p1 %patch21 -p1 %patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 %build #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir} @@ -168,6 +197,15 @@ fi %{_libdir}/autofs/ %changelog +* Fri Sep 19 2008 Ian Kent - 5.0.3-23 +- add upstream bug fixes + - bug fix for mtab check. + - bug fix for zero length nis key. + - update for ifc buffer handling. + - bug fix for kernel automount handling. +- warning: I found a bunch of patches that were present but not + being applied. + * Mon Aug 25 2008 Ian Kent - 5.0.3-21 - add upstream bug fix patches - add command line option to override is running check.