diff --git a/autofs-5.0.4-fix-lsb-init-script-header.patch b/autofs-5.0.4-fix-lsb-init-script-header.patch new file mode 100644 index 0000000..82b9018 --- /dev/null +++ b/autofs-5.0.4-fix-lsb-init-script-header.patch @@ -0,0 +1,57 @@ +autofs-5.0.4 - fix lsb init script header + +From: Ian Kent + +It truns out that "Should-Start:" is not sufficient to enforce +the required ordering of services and a "Required-Start:" is +needed instead. +--- + + CHANGELOG | 1 + + redhat/autofs.init.in | 4 ++-- + samples/rc.autofs.in | 4 ++-- + 3 files changed, 5 insertions(+), 4 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index 91edd14..2be7683 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -35,6 +35,7 @@ + - use misc device ioctl interface by default, if available. + - fix call restorecon when misc device file doesn't exist. + - clear rpc client on lookup fail. ++- fix lsb init script header. + + 4/11/2008 autofs-5.0.4 + ----------------------- +diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in +index a9a33c8..fded1d8 100644 +--- a/redhat/autofs.init.in ++++ b/redhat/autofs.init.in +@@ -9,8 +9,8 @@ + # + ### BEGIN INIT INFO + # Provides: $autofs +-# Should-Start: $network $ypbind +-# Should-Stop: $network $ypbind ++# Required-Start: $network $ypbind ++# Required-Stop: $network $ypbind + # Default-Start: 3 4 5 + # Default-Stop: 0 1 2 6 + # Short-Description: Automounts filesystems on demand +diff --git a/samples/rc.autofs.in b/samples/rc.autofs.in +index 78cbec2..b193a4e 100644 +--- a/samples/rc.autofs.in ++++ b/samples/rc.autofs.in +@@ -8,8 +8,8 @@ + # + ### BEGIN INIT INFO + # Provides: $autofs +-# Should-Start: $network $ypbind +-# Should-Stop: $network $ypbind ++# Required-Start: $network $ypbind ++# Required-Stop: $network $ypbind + # Default-Start: 3 4 5 + # Default-Stop: 0 1 2 6 + # Short-Description: Automounts filesystems on demand diff --git a/autofs-5.0.4-fix-memory-leak-reading-ldap-master.patch b/autofs-5.0.4-fix-memory-leak-reading-ldap-master.patch new file mode 100644 index 0000000..d278429 --- /dev/null +++ b/autofs-5.0.4-fix-memory-leak-reading-ldap-master.patch @@ -0,0 +1,38 @@ +autofs-5.0.4 - fix memory leak reading ldap master map + +From: Ian Kent + +When reading the master map the storage allocated by getting the location +value is not freed after use. +--- + + CHANGELOG | 1 + + modules/lookup_ldap.c | 2 ++ + 2 files changed, 3 insertions(+), 0 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index 2be7683..a143294 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -36,6 +36,7 @@ + - fix call restorecon when misc device file doesn't exist. + - clear rpc client on lookup fail. + - fix lsb init script header. ++- fix memory leak reading master map. + + 4/11/2008 autofs-5.0.4 + ----------------------- +diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c +index 5a54b5f..9b1180c 100644 +--- a/modules/lookup_ldap.c ++++ b/modules/lookup_ldap.c +@@ -1563,6 +1563,8 @@ int lookup_read_master(struct master *master, time_t age, void *context) + ldap_value_free(values); + goto next; + } ++ ldap_value_free(values); ++ + master_parse_entry(parse_buf, timeout, logging, age); + next: + ldap_value_free(keyValue); diff --git a/autofs-5.0.4-fix-st_remove_tasks-locking.patch b/autofs-5.0.4-fix-st_remove_tasks-locking.patch new file mode 100644 index 0000000..cb0f618 --- /dev/null +++ b/autofs-5.0.4-fix-st_remove_tasks-locking.patch @@ -0,0 +1,60 @@ +autofs-5.0.4 - fix st_remove_tasks() locking + +From: Ian Kent + +The autofs serialization of state changing during task (mount, umount etc.) +execution was being done twice, with the state queue manager and by using +a pipe to communicate state changes to the handle_mounts() thread. This +required the use of two mutexes which was unnecessary and problematic. So +the pipe was removed and the state queue alone now handles this. When this +was done most of the state queue locking was moved into the state queue +manager functions, however, the locking was inadvertantly left out of the +st_remove_tasks() function. +--- + + CHANGELOG | 1 + + daemon/state.c | 8 +++++++- + 2 files changed, 8 insertions(+), 1 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index a143294..c8b88e4 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -37,6 +37,7 @@ + - clear rpc client on lookup fail. + - fix lsb init script header. + - fix memory leak reading master map. ++- fix st_remove_tasks() locking. + + 4/11/2008 autofs-5.0.4 + ----------------------- +diff --git a/daemon/state.c b/daemon/state.c +index 417fde1..533e241 100644 +--- a/daemon/state.c ++++ b/daemon/state.c +@@ -783,10 +783,14 @@ void st_remove_tasks(struct autofs_point *ap) + struct state_queue *task, *waiting; + int status; + ++ st_mutex_lock(); ++ + head = &state_queue; + +- if (list_empty(head)) ++ if (list_empty(head)) { ++ st_mutex_unlock(); + return; ++ } + + p = head->next; + while (p != head) { +@@ -823,6 +827,8 @@ void st_remove_tasks(struct autofs_point *ap) + if (status) + fatal(status); + ++ st_mutex_unlock(); ++ + return; + } + diff --git a/autofs-5.0.4-reset-flex-scanner-when-setting-buffer.patch b/autofs-5.0.4-reset-flex-scanner-when-setting-buffer.patch new file mode 100644 index 0000000..6d1f73e --- /dev/null +++ b/autofs-5.0.4-reset-flex-scanner-when-setting-buffer.patch @@ -0,0 +1,59 @@ +autofs-5.0.4 - reset flex scanner when setting buffer + +From: Ian Kent + +We still have problems resetting the flex scan buffer after an error +is detected. This appears to fix the problem. +--- + + CHANGELOG | 1 + + lib/master_tok.l | 9 ++++++++- + 2 files changed, 9 insertions(+), 1 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index c8b88e4..5f1cf7f 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -38,6 +38,7 @@ + - fix lsb init script header. + - fix memory leak reading master map. + - fix st_remove_tasks() locking. ++- reset flex scanner when setting buffer. + + 4/11/2008 autofs-5.0.4 + ----------------------- +diff --git a/lib/master_tok.l b/lib/master_tok.l +index b6cc8be..373248b 100644 +--- a/lib/master_tok.l ++++ b/lib/master_tok.l +@@ -130,7 +130,6 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo + \x00 { + if (optr != buff) { + *optr = '\0'; +- optr = buff; + strcpy(master_lval.strtype, buff); + return NILL; + } +@@ -139,6 +138,11 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo + #.* { return COMMENT; } + + "/" { ++ if (optr != buff) { ++ *optr = '\0'; ++ strcpy(master_lval.strtype, buff); ++ return NILL; ++ } + BEGIN(PATHSTR); + bptr = buff; + yyless(0); +@@ -410,6 +414,9 @@ static void master_echo(void) + + void master_set_scan_buffer(const char *buffer) + { ++ master_lex_destroy(); ++ optr = buff; ++ + line = buffer; + line_pos = &line[0]; + /* diff --git a/autofs-5.0.4-use-percent-hack-for-master.patch b/autofs-5.0.4-use-percent-hack-for-master.patch new file mode 100644 index 0000000..73fbf6c --- /dev/null +++ b/autofs-5.0.4-use-percent-hack-for-master.patch @@ -0,0 +1,136 @@ +autofs-5.0.4 - use percent hack for master map keys + +From: Ian Kent + +The percent hack translation has been done for map keys but it +isn't used for master map keys. +--- + + CHANGELOG | 1 + + modules/lookup_ldap.c | 66 +++++++++++++++++++++++++++++++++++++++++++------ + 2 files changed, 59 insertions(+), 8 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index 4ed80e0..8258e00 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -40,6 +40,7 @@ + - fix st_remove_tasks() locking. + - reset flex scanner when setting buffer. + - zero s_magic is valid. ++- use percent hack for master map keys. + + 4/11/2008 autofs-5.0.4 + ----------------------- +diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c +index 9b1180c..8c6a8f2 100644 +--- a/modules/lookup_ldap.c ++++ b/modules/lookup_ldap.c +@@ -60,6 +60,7 @@ struct ldap_search_params { + }; + + static LDAP *auth_init(unsigned logopt, const char *, struct lookup_context *); ++static int decode_percent_hack(const char *, char **); + + #ifndef HAVE_LDAP_CREATE_PAGE_CONTROL + int ldap_create_page_control(LDAP *ldap, ber_int_t pagesize, +@@ -1508,6 +1509,9 @@ int lookup_read_master(struct master *master, time_t age, void *context) + debug(logopt, MODPREFIX "examining entries"); + + while (e) { ++ char *key = NULL; ++ int dec_len, i; ++ + keyValue = ldap_get_values(ldap, e, entry); + + if (!keyValue || !*keyValue) { +@@ -1519,19 +1523,63 @@ int lookup_read_master(struct master *master, time_t age, void *context) + * By definition keys must be unique within + * each map entry + */ +- if (ldap_count_values(keyValue) > 1) { +- error(logopt, +- MODPREFIX +- "key %s has duplicate entries - ignoring", +- *keyValue); +- goto next; ++ count = ldap_count_values(keyValue); ++ if (strcasecmp(class, "nisObject")) { ++ if (count > 1) { ++ error(logopt, MODPREFIX ++ "key %s has duplicates - ignoring", ++ *keyValue); ++ goto next; ++ } ++ key = strdup(keyValue[0]); ++ if (!key) { ++ error(logopt, MODPREFIX ++ "failed to dup map key %s - ignoring", ++ *keyValue); ++ goto next; ++ } ++ } else if (count == 1) { ++ dec_len = decode_percent_hack(keyValue[0], &key); ++ if (dec_len < 0) { ++ error(logopt, MODPREFIX ++ "invalid map key %s - ignoring", ++ *keyValue); ++ goto next; ++ } ++ } else { ++ dec_len = decode_percent_hack(keyValue[0], &key); ++ if (dec_len < 0) { ++ error(logopt, MODPREFIX ++ "invalid map key %s - ignoring", ++ *keyValue); ++ goto next; ++ } ++ ++ for (i = 1; i < count; i++) { ++ char *k; ++ dec_len = decode_percent_hack(keyValue[i], &k); ++ if (dec_len < 0) { ++ error(logopt, MODPREFIX ++ "invalid map key %s - ignoring", ++ *keyValue); ++ goto next; ++ } ++ if (strcmp(key, k)) { ++ error(logopt, MODPREFIX ++ "key entry mismatch %s - ignoring", ++ *keyValue); ++ free(k); ++ goto next; ++ } ++ free(k); ++ } + } + + /* + * Ignore keys beginning with '+' as plus map + * inclusion is only valid in file maps. + */ +- if (**keyValue == '+') { ++ if (*key == '+') { + warn(logopt, + MODPREFIX + "ignoreing '+' map entry - not in file map"); +@@ -1558,7 +1606,7 @@ int lookup_read_master(struct master *master, time_t age, void *context) + } + + if (snprintf(parse_buf, sizeof(parse_buf), "%s %s", +- *keyValue, *values) >= sizeof(parse_buf)) { ++ key, *values) >= sizeof(parse_buf)) { + error(logopt, MODPREFIX "map entry too long"); + ldap_value_free(values); + goto next; +@@ -1568,6 +1616,8 @@ int lookup_read_master(struct master *master, time_t age, void *context) + master_parse_entry(parse_buf, timeout, logging, age); + next: + ldap_value_free(keyValue); ++ if (key) ++ free(key); + e = ldap_next_entry(ldap, e); + } + diff --git a/autofs-5.0.4-zero-s_magic-is-valid.patch b/autofs-5.0.4-zero-s_magic-is-valid.patch new file mode 100644 index 0000000..a85724e --- /dev/null +++ b/autofs-5.0.4-zero-s_magic-is-valid.patch @@ -0,0 +1,47 @@ +autofs-5.0.4 - zero s_magic is valid + +From: Ian Kent + +When checking the super magic using the mount control ioctl +re-implementation an incorrect assumption is made that s_magic +field in the super block will not be zero. +--- + + CHANGELOG | 1 + + lib/dev-ioctl-lib.c | 10 ++++------ + 2 files changed, 5 insertions(+), 6 deletions(-) + + +diff --git a/CHANGELOG b/CHANGELOG +index 5f1cf7f..4ed80e0 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -39,6 +39,7 @@ + - fix memory leak reading master map. + - fix st_remove_tasks() locking. + - reset flex scanner when setting buffer. ++- zero s_magic is valid. + + 4/11/2008 autofs-5.0.4 + ----------------------- +diff --git a/lib/dev-ioctl-lib.c b/lib/dev-ioctl-lib.c +index 7c8c433..a034a3d 100644 +--- a/lib/dev-ioctl-lib.c ++++ b/lib/dev-ioctl-lib.c +@@ -764,12 +764,10 @@ static int dev_ioctl_ismountpoint(unsigned int logopt, + if (err) { + *mountpoint = DEV_IOCTL_IS_MOUNTED; + +- if (param->ismountpoint.out.magic) { +- if (param->ismountpoint.out.magic == AUTOFS_SUPER_MAGIC) +- *mountpoint |= DEV_IOCTL_IS_AUTOFS; +- else +- *mountpoint |= DEV_IOCTL_IS_OTHER; +- } ++ if (param->ismountpoint.out.magic == AUTOFS_SUPER_MAGIC) ++ *mountpoint |= DEV_IOCTL_IS_AUTOFS; ++ else ++ *mountpoint |= DEV_IOCTL_IS_OTHER; + } + + free_dev_ioctl_path(param); diff --git a/autofs.spec b/autofs.spec index 44ef741..e110d4b 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.4 -Release: 24 +Release: 26 Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -45,6 +45,12 @@ Patch32: autofs-5.0.4-always-read-file-maps-fix.patch Patch33: autofs-5.0.4-use-misc-device.patch Patch34: autofs-5.0.4-fix-restorecon.patch Patch35: autofs-5.0.4-clear-rpc-client-on-lookup-fail.patch +Patch36: autofs-5.0.4-fix-lsb-init-script-header.patch +Patch37: autofs-5.0.4-fix-memory-leak-reading-ldap-master.patch +Patch38: autofs-5.0.4-fix-st_remove_tasks-locking.patch +Patch39: autofs-5.0.4-reset-flex-scanner-when-setting-buffer.patch +Patch40: autofs-5.0.4-zero-s_magic-is-valid.patch +Patch41: autofs-5.0.4-use-percent-hack-for-master.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 libtirpc-devel Requires: kernel >= 2.6.17 @@ -121,6 +127,12 @@ echo %{version}-%{release} > .version %patch33 -p1 %patch34 -p1 %patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 %build #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir} @@ -173,6 +185,13 @@ fi %{_libdir}/autofs/ %changelog +* Thu Apr 16 2009 Ian Kent - 1:5.0.4-26 +- fix lsb init script header. +- fix memory leak reading ldap master map. +- fix st_remove_tasks() locking. +- reset flex scanner when setting buffer. +- zero s_magic is valid. + * Mon Mar 30 2009 Ian Kent - 1:5.0.4-24 - clear rpc client on lookup fail.