From c79aa413032c7ed93d154dda9b55759e715ad30b Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Fri, 10 Oct 2008 08:55:18 +0000 Subject: [PATCH] - add map-type-in-map-name fix patch to sync with upstream and RHEL. - don't readmap on HUP for new mount. - add NIS_PARTIAL to map entry not found check and fix use after free bug. --- ....3-dont-readmap-on-hup-for-new-mount.patch | 39 ++++++++++++++ autofs-5.0.3-map-type-in-map-name-fix.patch | 27 ++++++++++ autofs-5.0.3-nisplus-partial-and-free.patch | 54 +++++++++++++++++++ autofs.spec | 13 ++++- 4 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 autofs-5.0.3-dont-readmap-on-hup-for-new-mount.patch create mode 100644 autofs-5.0.3-map-type-in-map-name-fix.patch create mode 100644 autofs-5.0.3-nisplus-partial-and-free.patch diff --git a/autofs-5.0.3-dont-readmap-on-hup-for-new-mount.patch b/autofs-5.0.3-dont-readmap-on-hup-for-new-mount.patch new file mode 100644 index 0000000..39823c2 --- /dev/null +++ b/autofs-5.0.3-dont-readmap-on-hup-for-new-mount.patch @@ -0,0 +1,39 @@ +autofs-5.0.3 - don't readmap on HUP for new mount + +From: Ian Kent + +If we're performing a new mount during a HUP signal then +we will read the map during the mount. +--- + + lib/master.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + + +--- autofs-5.0.3.orig/lib/master.c ++++ autofs-5.0.3/lib/master.c +@@ -1108,8 +1108,6 @@ int master_mount_mounts(struct master *m + } + cache_unlock(nc); + +- check_update_map_sources(this, readall); +- + st_mutex_lock(); + + state_pipe = this->ap->state_pipe[1]; +@@ -1120,11 +1118,14 @@ int master_mount_mounts(struct master *m + + st_mutex_unlock(); + +- if (ret == -1 && save_errno == EBADF) ++ if (!ret) ++ check_update_map_sources(this, readall); ++ else if (ret == -1 && save_errno == EBADF) { + if (!master_do_mount(this)) { + list_del_init(&this->list); + master_free_mapent_sources(ap->entry, 1); + master_free_mapent(ap->entry); ++ } + } + } + diff --git a/autofs-5.0.3-map-type-in-map-name-fix.patch b/autofs-5.0.3-map-type-in-map-name-fix.patch new file mode 100644 index 0000000..bb5fae2 --- /dev/null +++ b/autofs-5.0.3-map-type-in-map-name-fix.patch @@ -0,0 +1,27 @@ +autofs-5.0.3 - map type in map name fix + +From: Ian Kent + +Fix incorrect match of map type as a host name. +Actually the original patch didn't match upstream or RHEL +so this syncs the source with those. It appears the problem +was fixed here some time ago but slightly differently. +--- + + lib/master_tok.l | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + + +--- autofs-5.0.3.orig/lib/master_tok.l ++++ autofs-5.0.3/lib/master_tok.l +@@ -202,7 +202,9 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|-- + } + } + +- {MTYPE}/({DNSERVERSTR}|{DNATTRSTR}=)? { ++ {MTYPE} | ++ {MTYPE}/{DNSERVERSTR}{DNATTRSTR} | ++ {MTYPE}/{DNATTRSTR}= { + tlen = master_leng - 1; + if (bptr != buff && isblank(master_text[tlen])) { + strncat(buff, master_text, tlen); diff --git a/autofs-5.0.3-nisplus-partial-and-free.patch b/autofs-5.0.3-nisplus-partial-and-free.patch new file mode 100644 index 0000000..9333873 --- /dev/null +++ b/autofs-5.0.3-nisplus-partial-and-free.patch @@ -0,0 +1,54 @@ +autofs-5.0.3 - nisplus partial and free + +From: Jeff Bastian + +During a nisplus key lookup nis_list() can return NIS_PARTIAL +as well as possibly NIS_NOTFOUND or NIS_S_NOTFOUND when the key +doesn't exist. This patch adds this to the checks and fixes a use +after free of the result struct. +--- + + modules/lookup_nisplus.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + + +--- autofs-5.0.3.orig/modules/lookup_nisplus.c ++++ autofs-5.0.3/modules/lookup_nisplus.c +@@ -285,13 +285,15 @@ static int lookup_one(struct autofs_poin + + result = nis_list(tablename, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + if (result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) { ++ nis_error rs = result->status; + nis_freeresult(result); + pthread_setcancelstate(cur_state, NULL); +- if (result->status == NIS_NOTFOUND || +- result->status == NIS_S_NOTFOUND) ++ if (rs == NIS_NOTFOUND || ++ rs == NIS_S_NOTFOUND || ++ rs == NIS_PARTIAL) + return CHE_MISSING; + +- return -result->status; ++ return -rs; + } + + +@@ -338,13 +340,15 @@ static int lookup_wild(struct autofs_poi + + result = nis_list(tablename, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + if (result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) { ++ nis_error rs = result->status; + nis_freeresult(result); + pthread_setcancelstate(cur_state, NULL); +- if (result->status == NIS_NOTFOUND || +- result->status == NIS_S_NOTFOUND) ++ if (rs == NIS_NOTFOUND || ++ rs == NIS_S_NOTFOUND || ++ rs == NIS_PARTIAL) + return CHE_MISSING; + +- return -result->status; ++ return -rs; + } + + this = NIS_RES_OBJECT(result); diff --git a/autofs.spec b/autofs.spec index 8b6ee54..baf9931 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: 25 +Release: 26 Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -59,6 +59,9 @@ Patch46: autofs-5.0.3-fix-ifc-buff-size-fix-2.patch Patch47: autofs-5.0.3-check-for-kernel-automount-fix.patch Patch48: autofs-5.0.3-fix-fd-leak-at-multi-mount-fail.patch Patch49: autofs-5.0.3-fix-incorrect-multi-mount-mountpoint.patch +Patch50: autofs-5.0.3-map-type-in-map-name-fix.patch +Patch51: autofs-5.0.3-dont-readmap-on-hup-for-new-mount.patch +Patch52: autofs-5.0.3-nisplus-partial-and-free.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 @@ -149,6 +152,9 @@ echo %{version}-%{release} > .version %patch47 -p1 %patch48 -p1 %patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 %build #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir} @@ -201,6 +207,11 @@ fi %{_libdir}/autofs/ %changelog +* Fri Oct 10 2008 Ian Kent - 5.0.3-26 +- add map-type-in-map-name fix patch to sync with upstream and RHEL. +- don't readmap on HUP for new mount. +- add NIS_PARTIAL to map entry not found check and fix use after free bug. + * Fri Sep 26 2008 Ian Kent - 5.0.3-25 - fix fd leak at multi-mount non-fatal mount fail. - fix incorrect multi-mount mountpoint calcualtion.