diff --git a/.cvsignore b/.cvsignore index 14723f3..81e410e 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1 @@ -autofs-5.0.1-rc3.tar.bz2 -autofs-5.0.1.tar.bz2 +autofs-5.0.2.tar.bz2 diff --git a/autofs-5.0.1-add-ldaps-support.patch b/autofs-5.0.1-add-ldaps-support.patch deleted file mode 100644 index 8f54008..0000000 --- a/autofs-5.0.1-add-ldaps-support.patch +++ /dev/null @@ -1,342 +0,0 @@ ---- autofs-5.0.1/man/auto.master.5.in.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800 -+++ autofs-5.0.1/man/auto.master.5.in 2007-06-12 20:29:38.000000000 +0800 -@@ -101,8 +101,9 @@ - .B filsys - entries are used for maps. - .TP --.B ldap --The map is stored in an LDAP directory. -+.B ldap \fPor\fB ldaps -+The map is stored in an LDAP directory. If \fBldaps\fP is used the -+appropriate certificate must be configured in the LDAP client. - .RE - .TP - \fBformat\fP ---- autofs-5.0.1/include/lookup_ldap.h.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800 -+++ autofs-5.0.1/include/lookup_ldap.h 2007-06-12 20:29:38.000000000 +0800 -@@ -13,6 +13,7 @@ - char *mapname; - - char *server; -+ int port; - char *base; - char *qdn; - ---- autofs-5.0.1/daemon/lookup.c.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800 -+++ autofs-5.0.1/daemon/lookup.c 2007-06-12 20:29:38.000000000 +0800 -@@ -169,20 +169,30 @@ - char source[10]; - - memset(source, 0, 10); -- /* TODO: ldaps is not yet handled by ldap module */ -- /* TODO: must tighten up this test */ -- if (!strncmp(name, "file", 4) || -- !strncmp(name, "yp", 2) || -- !strncmp(name, "nis", 3) || -- !strncmp(name, "nisplus", 7) || -- !strncmp(name, "ldap", 4)) { -+ if (!strncmp(name, "file:", 5) || -+ !strncmp(name, "yp:", 3) || -+ !strncmp(name, "nis:", 4) || -+ !strncmp(name, "nisplus:", 8) || -+ !strncmp(name, "ldap:", 5) || -+ !strncmp(name, "ldaps:", 6)) { - strncpy(source, name, tmp - name); - -- master->name = tmp + 1; -- -- debug(LOGOPT_NONE, -- "reading master %s %s", -- source, master->name); -+ /* -+ * If it's an ldap map leave the source in the -+ * name so the lookup module can work out if -+ * ldaps has been requested. -+ */ -+ if (strncmp(name, "ldap", 4)) { -+ master->name = tmp + 1; -+ debug(LOGOPT_NONE, -+ "reading master %s %s", -+ source, master->name); -+ } else { -+ master->name = name; -+ debug(LOGOPT_NONE, -+ "reading master %s %s", -+ source, tmp + 1); -+ } - - result = do_read_master(master, source, age); - master->name = name; ---- autofs-5.0.1/modules/lookup_ldap.c.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800 -+++ autofs-5.0.1/modules/lookup_ldap.c 2007-06-12 20:29:38.000000000 +0800 -@@ -100,14 +100,8 @@ - ctxt->version = 3; - - /* Initialize the LDAP context. */ -- /* LDAP_PORT should not be hard-coded, here. If we are going to -- * parse ldap strings ourselves, then we can put the port specified -- * in the host:port format here. Otherwise, we can just pass the -- * host:port string to the ldap_init call and let the library handle -- * it. -JM -- */ -- ldap = ldap_init(ctxt->server, LDAP_PORT); -- if (!ldap) { -+ rv = ldap_initialize(&ldap, ctxt->server); -+ if (rv != LDAP_OPT_SUCCESS) { - crit(LOGOPT_ANY, - MODPREFIX "couldn't initialize LDAP connection to %s", - ctxt->server ? ctxt->server : "default server"); -@@ -119,8 +113,8 @@ - if (rv != LDAP_OPT_SUCCESS) { - /* fall back to LDAPv2 */ - ldap_unbind_ext(ldap, NULL, NULL); -- ldap = ldap_init(ctxt->server, LDAP_PORT); -- if (!ldap) { -+ rv = ldap_initialize(&ldap, ctxt->server); -+ if (rv != LDAP_OPT_SUCCESS) { - crit(LOGOPT_ANY, MODPREFIX "couldn't initialize LDAP"); - return NULL; - } -@@ -348,7 +342,7 @@ - goto out; - } - -- if (!usetls) -+ if (!usetls || ctxt->port == LDAPS_PORT) - use_tls = LDAP_TLS_DONT_USE; - else { - if (!strcasecmp(usetls, "yes")) -@@ -551,16 +545,31 @@ - */ - static int parse_server_string(const char *url, struct lookup_context *ctxt) - { -- char buf[MAX_ERR_BUF], *tmp = NULL; -- const char *ptr; -- int l; -+ char buf[MAX_ERR_BUF], *tmp = NULL, proto[9]; -+ const char *ptr, *name; -+ int l, al_len; - -+ *proto = '\0'; - ptr = url; - - debug(LOGOPT_NONE, - MODPREFIX - "Attempting to parse LDAP information from string \"%s\".", ptr); - -+ ctxt->port = LDAP_PORT; -+ if (!strncmp(ptr, "ldap:", 5) || !strncmp(ptr, "ldaps:", 6)) { -+ if (*(ptr + 4) == 's') { -+ ctxt->port = LDAPS_PORT; -+ memcpy(proto, ptr, 6); -+ strcat(proto, "//"); -+ ptr += 6; -+ } else { -+ memcpy(proto, ptr, 5); -+ strcat(proto, "//"); -+ ptr += 5; -+ } -+ } -+ - if (!strncmp(ptr, "//", 2)) { - const char *s = ptr + 2; - const char *q = NULL; -@@ -568,7 +577,13 @@ - /* Isolate the server(s). */ - if ((q = strchr(s, '/'))) { - l = q - s; -- tmp = malloc(l + 1); -+ if (*proto) { -+ al_len = l + strlen(proto) + 2; -+ tmp = malloc(al_len); -+ } else { -+ al_len = l + 1; -+ tmp = malloc(al_len); -+ } - if (!tmp) { - char *estr; - estr = strerror_r(errno, buf, MAX_ERR_BUF); -@@ -576,8 +591,13 @@ - return 0; - } - ctxt->server = tmp; -- memset(ctxt->server, 0, l + 1); -- memcpy(ctxt->server, s, l); -+ memset(ctxt->server, 0, al_len); -+ if (*proto) { -+ strcpy(ctxt->server, proto); -+ memcpy(ctxt->server + strlen(proto), s, l); -+ strcat(ctxt->server, "/"); -+ } else -+ memcpy(ctxt->server, s, l); - ptr = q + 1; - } else { - crit(LOGOPT_ANY, -@@ -613,8 +633,14 @@ - } - - l = q - ptr; -+ if (proto) { -+ al_len = l + strlen(proto) + 2; -+ tmp = malloc(al_len); -+ } else { -+ al_len = l + 1; -+ tmp = malloc(al_len); -+ } - /* Isolate the server's name. */ -- tmp = malloc(l + 1); - if (!tmp) { - char *estr; - estr = strerror_r(errno, buf, MAX_ERR_BUF); -@@ -622,8 +648,13 @@ - return 0; - } - ctxt->server = tmp; -- memset(ctxt->server, 0, l + 1); -- memcpy(ctxt->server, ptr, l); -+ memset(ctxt->server, 0, al_len); -+ if (*proto) { -+ strcpy(ctxt->server, proto); -+ memcpy(ctxt->server + strlen(proto), ptr, l); -+ strcat(ctxt->server, "/"); -+ } else -+ memcpy(ctxt->server, ptr, l); - ptr += l + 1; - } - -@@ -639,29 +670,41 @@ - * the later LDAP calls will fail. - */ - l = strlen(ptr); -- if (strchr(ptr, '=')) { -+ if ((name = strchr(ptr, '='))) { - char *base; - -+ /* -+ * An '=' with no ',' means a mapname has been given so just -+ * grab it alone to keep it independent of schema otherwize -+ * we expect a full dn. -+ */ - if (!strchr(ptr, ',')) { -- debug(LOGOPT_NONE, -- MODPREFIX "LDAP dn not fuly specified"); -- if (ctxt->server) -- free(ctxt->server); -- return 0; -- } -- -- base = malloc(l + 1); -- if (!base) { -- char *estr; -- estr = strerror_r(errno, buf, MAX_ERR_BUF); -- crit(LOGOPT_ANY, MODPREFIX "malloc: %s", estr); -- if (ctxt->server) -- free(ctxt->server); -- return 0; -+ char *map = strdup(name + 1); -+ if (map) -+ ctxt->mapname = map; -+ else { -+ char *estr; -+ estr = strerror_r(errno, buf, MAX_ERR_BUF); -+ crit(LOGOPT_ANY, MODPREFIX "malloc: %s", estr); -+ if (ctxt->server) -+ free(ctxt->server); -+ return 0; -+ } -+ -+ } else { -+ base = malloc(l + 1); -+ if (!base) { -+ char *estr; -+ estr = strerror_r(errno, buf, MAX_ERR_BUF); -+ crit(LOGOPT_ANY, MODPREFIX "malloc: %s", estr); -+ if (ctxt->server) -+ free(ctxt->server); -+ return 0; -+ } -+ ctxt->base = base; -+ memset(ctxt->base, 0, l + 1); -+ memcpy(ctxt->base, ptr, l); - } -- ctxt->base = base; -- memset(ctxt->base, 0, l + 1); -- memcpy(ctxt->base, ptr, l); - } else { - char *map = malloc(l + 1); - if (!map) { -@@ -676,6 +719,14 @@ - memset(ctxt->mapname, 0, l + 1); - memcpy(map, ptr, l); - } -+ -+ if (!ctxt->server && *proto) { -+ if (!strncmp(proto, "ldaps", 5)) { -+ warn(LOGOPT_ANY, MODPREFIX -+ "server must be given to force ldaps, connection " -+ "will use LDAP client configured protocol"); -+ } -+ } - done: - if (ctxt->mapname) - debug(LOGOPT_NONE, MODPREFIX "mapname %s", ctxt->mapname); ---- autofs-5.0.1/modules/Makefile.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800 -+++ autofs-5.0.1/modules/Makefile 2007-06-12 20:29:38.000000000 +0800 -@@ -64,6 +64,7 @@ - -rm -f $(INSTALLROOT)$(autofslibdir)/mount_smbfs.so - ln -fs lookup_file.so $(INSTALLROOT)$(autofslibdir)/lookup_files.so - ln -fs lookup_yp.so $(INSTALLROOT)$(autofslibdir)/lookup_nis.so -+ ln -fs lookup_ldap.so $(INSTALLROOT)$(autofslibdir)/lookup_ldaps.so - ln -fs mount_nfs.so $(INSTALLROOT)$(autofslibdir)/mount_nfs4.so - ifeq ($(EXT2FS), 1) - ifeq ($(EXT3FS), 1) ---- autofs-5.0.1/lib/master_tok.l.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800 -+++ autofs-5.0.1/lib/master_tok.l 2007-06-12 20:29:38.000000000 +0800 -@@ -104,7 +104,7 @@ - DNNAMESTR ([[:alnum:]_.\-]+) - - INTMAP (-hosts|-null) --MTYPE ((file|program|yp|nis|nisplus|ldap|hesiod|userdir)(,(sun|hesiod))?) -+MTYPE ((file|program|yp|nis|nisplus|ldap|ldaps|hesiod|userdir)(,(sun|hesiod))?) - - - OPTTOUT (-t{OPTWS}|-t{OPTWS}={OPTWS}|--timeout{OPTWS}|--timeout{OPTWS}={OPTWS}) ---- autofs-5.0.1/lib/master_parse.y.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800 -+++ autofs-5.0.1/lib/master_parse.y 2007-06-12 20:29:38.000000000 +0800 -@@ -290,6 +290,19 @@ - local_free_vars(); - YYABORT; - } -+ /* Add back the type for lookup_ldap.c to handle ldaps */ -+ if (*local_argv[0]) { -+ tmp = malloc(strlen(type) + strlen(local_argv[0]) + 2); -+ if (!tmp) { -+ local_free_vars(); -+ YYABORT; -+ } -+ strcpy(tmp, type); -+ strcat(tmp, ":"); -+ strcat(tmp, local_argv[0]); -+ free(local_argv[0]); -+ local_argv[0] = tmp; -+ } - } - ; - -@@ -343,12 +356,12 @@ - strcat($$, ","); - strcat($$, $5); - } -- | DNATTR -+ | DNNAME - { -- master_notify($1); -- YYABORT; -+ /* Matches map in old style syntax ldap:server:map */ -+ strcpy($$, $1); - } -- | DNNAME -+ | DNATTR - { - master_notify($1); - YYABORT; diff --git a/autofs-5.0.1-alarm-deadlock.patch b/autofs-5.0.1-alarm-deadlock.patch deleted file mode 100644 index 6153ee3..0000000 --- a/autofs-5.0.1-alarm-deadlock.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff --git a/lib/alarm.c b/lib/alarm.c -index e0e6fd4..4a72605 100755 ---- a/lib/alarm.c -+++ b/lib/alarm.c -@@ -168,7 +168,6 @@ void alarm_delete(struct autofs_point *ap) - static void *alarm_handler(void *arg) - { - struct list_head *head; -- struct autofs_point *ap; - struct timespec expire; - time_t now; - int status; -@@ -192,10 +191,11 @@ static void *alarm_handler(void *arg) - - current = list_entry(head->next, struct alarm, list); - -- ap = current->ap; - now = time(NULL); - - if (current->time <= now) { -+ struct autofs_point *ap; -+ - list_del(¤t->list); - - if (current->cancel) { -@@ -203,11 +203,15 @@ static void *alarm_handler(void *arg) - continue; - } - -+ ap = current->ap; -+ free(current); -+ alarm_unlock(); -+ - state_mutex_lock(ap); - nextstate(ap->state_pipe[1], ST_EXPIRE); - state_mutex_unlock(ap); - -- free(current); -+ alarm_lock(); - continue; - } - -@@ -215,6 +219,7 @@ static void *alarm_handler(void *arg) - expire.tv_nsec = 0; - - while (1) { -+ struct autofs_point *ap; - struct alarm *next; - - status = pthread_cond_timedwait(&cond, &mutex, &expire); -@@ -232,12 +237,15 @@ static void *alarm_handler(void *arg) - break; - - list_del(¤t->list); -+ ap = current->ap; - free(current); -+ alarm_unlock(); - - state_mutex_lock(ap); - nextstate(ap->state_pipe[1], ST_EXPIRE); - state_mutex_unlock(ap); - -+ alarm_lock(); - break; - } - } diff --git a/autofs-5.0.1-allow-dot-in-master-macro.patch b/autofs-5.0.1-allow-dot-in-master-macro.patch deleted file mode 100644 index 87e3f44..0000000 --- a/autofs-5.0.1-allow-dot-in-master-macro.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/lib/master_tok.l b/lib/master_tok.l -index a5d6066..c15ef68 100644 ---- a/lib/master_tok.l -+++ b/lib/master_tok.l -@@ -89,7 +89,7 @@ NL \r?\n - CONT \\\n{OPTWS} - - OPTIONSTR ([\-]?([[:alpha:]_]([[:alnum:]_\-])*(=([[:alnum:]_\-])+)*)+) --MACROSTR (-D{OPTWS}([[:alpha:]_]([[:alnum:]_\-])*)=([[:alnum:]_\-])+) -+MACROSTR (-D{OPTWS}([[:alpha:]_]([[:alnum:]_\-])*)=([[:alnum:]_\-\.])+) - SLASHIFYSTR (--(no-)?slashify-colons) - NUMBER [0-9]+ - diff --git a/autofs-5.0.1-bad-cast.patch b/autofs-5.0.1-bad-cast.patch deleted file mode 100644 index 4c0cf6e..0000000 --- a/autofs-5.0.1-bad-cast.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/daemon/automount.c b/daemon/automount.c -index 938ee1b..37e040b 100644 ---- a/daemon/automount.c -+++ b/daemon/automount.c -@@ -276,7 +276,7 @@ static int walk_tree(const char *base, int (*fn) (const char *file, - - static int rm_unwanted_fn(const char *file, const struct stat *st, int when, void *arg) - { -- dev_t dev = *(int *) arg; -+ dev_t dev = *(dev_t *) arg; - char buf[MAX_ERR_BUF]; - struct stat newst; - diff --git a/autofs-5.0.1-check-mtab-updated.patch b/autofs-5.0.1-check-mtab-updated.patch deleted file mode 100644 index 47dec10..0000000 --- a/autofs-5.0.1-check-mtab-updated.patch +++ /dev/null @@ -1,99 +0,0 @@ -diff --git a/CHANGELOG b/CHANGELOG -index 34fad3e..b379431 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -3,6 +3,7 @@ - - fix return check for getpwuid_r and getgrgid_r. - - give up trying to update exports list while host is mounted. - - fix to "@network" matching. -+- check for fstab update and retry if not updated. - - 20/2/2007 autofs-5.0.1 - ---------------------- -diff --git a/daemon/spawn.c b/daemon/spawn.c -index 7f0a6e0..271d37e 100644 ---- a/daemon/spawn.c -+++ b/daemon/spawn.c -@@ -34,6 +34,8 @@ static pthread_mutex_t spawn_mutex = PTHREAD_MUTEX_INITIALIZER; - #define SPAWN_OPT_LOCK 0x0001 - #define SPAWN_OPT_ACCESS 0x0002 - -+#define MTAB_LOCK_RETRIES 3 -+ - inline void dump_core(void) - { - sigset_t segv; -@@ -267,6 +269,8 @@ int spawn_mount(logger *log, ...) - char prog[] = PATH_MOUNT; - char arg0[] = PATH_MOUNT; - unsigned int options; -+ unsigned int retries = MTAB_LOCK_RETRIES; -+ int ret; - - /* If we use mount locking we can't validate the location */ - #ifdef ENABLE_MOUNT_LOCKING -@@ -289,7 +293,14 @@ int spawn_mount(logger *log, ...) - while ((*p++ = va_arg(arg, char *))); - va_end(arg); - -- return do_spawn(log, options, prog, (const char **) argv); -+ while (retries--) { -+ ret = do_spawn(log, options, prog, (const char **) argv); -+ if (ret & MTAB_NOTUPDATED) -+ continue; -+ break; -+ } -+ -+ return ret; - } - - /* -@@ -309,6 +320,8 @@ int spawn_bind_mount(logger *log, ...) - char arg0[] = PATH_MOUNT; - char bind[] = "--bind"; - unsigned int options; -+ unsigned int retries = MTAB_LOCK_RETRIES; -+ int ret; - - /* If we use mount locking we can't validate the location */ - #ifdef ENABLE_MOUNT_LOCKING -@@ -332,7 +345,14 @@ int spawn_bind_mount(logger *log, ...) - while ((*p++ = va_arg(arg, char *))); - va_end(arg); - -- return do_spawn(log, options, prog, (const char **) argv); -+ while (retries--) { -+ ret = do_spawn(log, options, prog, (const char **) argv); -+ if (ret & MTAB_NOTUPDATED) -+ continue; -+ break; -+ } -+ -+ return ret; - } - - int spawn_umount(logger *log, ...) -@@ -343,6 +363,8 @@ int spawn_umount(logger *log, ...) - char prog[] = PATH_UMOUNT; - char arg0[] = PATH_UMOUNT; - unsigned int options; -+ unsigned int retries = MTAB_LOCK_RETRIES; -+ int ret; - - #ifdef ENABLE_MOUNT_LOCKING - options = SPAWN_OPT_LOCK; -@@ -364,6 +386,13 @@ int spawn_umount(logger *log, ...) - while ((*p++ = va_arg(arg, char *))); - va_end(arg); - -- return do_spawn(log, options, prog, (const char **) argv); -+ while (retries--) { -+ ret = do_spawn(log, options, prog, (const char **) argv); -+ if (ret & MTAB_NOTUPDATED) -+ continue; -+ break; -+ } -+ -+ return ret; - } - diff --git a/autofs-5.0.1-check-user-info-return.patch b/autofs-5.0.1-check-user-info-return.patch deleted file mode 100644 index ac66abe..0000000 --- a/autofs-5.0.1-check-user-info-return.patch +++ /dev/null @@ -1,56 +0,0 @@ -diff --git a/CHANGELOG b/CHANGELOG -index 3a7f47e..d416684 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -1,3 +1,7 @@ -+??/??/2007 autofs-5.0.2 -+----------------------- -+- fix return check for getpwuid_r and getgrgid_r. -+ - 20/2/2007 autofs-5.0.1 - ---------------------- - - fix typo in Fix typo in var when removing temp directory. -diff --git a/daemon/direct.c b/daemon/direct.c -index 0869858..2dc23db 100644 ---- a/daemon/direct.c -+++ b/daemon/direct.c -@@ -1335,7 +1335,7 @@ static void *do_mount_direct(void *arg) - } - - status = getpwuid_r(mt->uid, ppw, pw_tmp, tmplen, pppw); -- if (status) { -+ if (status || !ppw) { - error(ap->logopt, "failed to get passwd info from getpwuid_r"); - free(tsv); - free(pw_tmp); -@@ -1382,7 +1382,7 @@ static void *do_mount_direct(void *arg) - } - - status = getgrgid_r(mt->gid, pgr, gr_tmp, tmplen, ppgr); -- if (status) { -+ if (status || !pgr) { - error(ap->logopt, "failed to get group info from getgrgid_r"); - free(tsv->user); - free(tsv->home); -diff --git a/daemon/indirect.c b/daemon/indirect.c -index 46e3f99..2068c16 100644 ---- a/daemon/indirect.c -+++ b/daemon/indirect.c -@@ -807,7 +807,7 @@ static void *do_mount_indirect(void *arg) - } - - status = getpwuid_r(mt->uid, ppw, pw_tmp, tmplen, pppw); -- if (status) { -+ if (status || !ppw) { - error(ap->logopt, "failed to get passwd info from getpwuid_r"); - free(tsv); - free(pw_tmp); -@@ -854,7 +854,7 @@ static void *do_mount_indirect(void *arg) - } - - status = getgrgid_r(mt->gid, pgr, gr_tmp, tmplen, ppgr); -- if (status) { -+ if (status || !pgr) { - error(ap->logopt, "failed to get group info from getgrgid_r"); - free(tsv->user); - free(tsv->home); diff --git a/autofs-5.0.1-cmd-global-options-fix.patch b/autofs-5.0.1-cmd-global-options-fix.patch deleted file mode 100644 index 8bf22cc..0000000 --- a/autofs-5.0.1-cmd-global-options-fix.patch +++ /dev/null @@ -1,156 +0,0 @@ -diff --git a/modules/parse_sun.c b/modules/parse_sun.c -index 0494e76..99961c3 100644 ---- a/modules/parse_sun.c -+++ b/modules/parse_sun.c -@@ -264,7 +264,7 @@ int parse_init(int argc, const char *const *argv, void **context) - { - struct parse_context *ctxt; - char buf[MAX_ERR_BUF]; -- char *noptstr, *def, *val, *macros; -+ char *noptstr, *def, *val, *macros, *gbl_options; - const char *xopt; - int optlen, len, offset; - int i, bval; -@@ -397,25 +397,31 @@ int parse_init(int argc, const char *const *argv, void **context) - } - } - -+ gbl_options = NULL; - if (global_options) { -+ if (ctxt->optstr && strstr(ctxt->optstr, global_options)) -+ goto options_done; -+ gbl_options = strdup(global_options); -+ } -+ -+ if (gbl_options) { - append_options = defaults_get_append_options(); - if (append_options) { -- char *tmp = concat_options(global_options, ctxt->optstr); -+ char *tmp = concat_options(gbl_options, ctxt->optstr); - if (!tmp) { - char *estr = strerror_r(errno, buf, MAX_ERR_BUF); - error(LOGOPT_ANY, MODPREFIX "concat_options: %s", estr); -+ free(gbl_options); - } else - ctxt->optstr = tmp; - } else { - if (!ctxt->optstr) -- ctxt->optstr = strdup(global_options); -- if (!ctxt->optstr) { -- char *estr = strerror_r(errno, buf, MAX_ERR_BUF); -- warn(LOGOPT_ANY, MODPREFIX "%s", estr); -- } -+ ctxt->optstr = gbl_options; -+ else -+ free(gbl_options); - } - } -- -+options_done: - debug(LOGOPT_NONE, - MODPREFIX "init gathered global options: %s", ctxt->optstr); - -@@ -799,18 +805,23 @@ static int parse_mapent(const char *ent, char *g_options, char **options, char * - char *tmp, *newopt = NULL; - - p = parse_options(p, &newopt, logopt); -- tmp = concat_options(myoptions, newopt); -- if (!tmp) { -- char *estr; -- estr = strerror_r(errno, buf, MAX_ERR_BUF); -- error(logopt, MODPREFIX -- "concat_options: %s", estr); -- if (newopt) -- free(newopt); -+ if (newopt && strstr(newopt, myoptions)) { - free(myoptions); -- return 0; -+ myoptions = newopt; -+ } else { -+ tmp = concat_options(myoptions, newopt); -+ if (!tmp) { -+ char *estr; -+ estr = strerror_r(errno, buf, MAX_ERR_BUF); -+ error(logopt, MODPREFIX -+ "concat_options: %s", estr); -+ if (newopt) -+ free(newopt); -+ free(myoptions); -+ return 0; -+ } -+ myoptions = tmp; - } -- myoptions = tmp; - - p = skipspace(p); - } while (*p == '-'); -@@ -1042,19 +1053,24 @@ int parse_mount(struct autofs_point *ap, const char *name, - char *noptions = NULL; - - p = parse_options(p, &noptions, ap->logopt); -- tmp = concat_options(mnt_options, noptions); -- if (!tmp) { -- char *estr = strerror_r(errno, buf, MAX_ERR_BUF); -- error(ap->logopt, -- MODPREFIX "concat_options: %s", estr); -- if (noptions) -- free(noptions); -- if (mnt_options) -- free(mnt_options); -- free(options); -- return 1; -+ if (mnt_options && noptions && strstr(noptions, mnt_options)) { -+ free(mnt_options); -+ mnt_options = noptions; -+ } else { -+ tmp = concat_options(mnt_options, noptions); -+ if (!tmp) { -+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); -+ error(ap->logopt, -+ MODPREFIX "concat_options: %s", estr); -+ if (noptions) -+ free(noptions); -+ if (mnt_options) -+ free(mnt_options); -+ free(options); -+ return 1; -+ } -+ mnt_options = tmp; - } -- mnt_options = tmp; - - p = skipspace(p); - } while (*p == '-'); -@@ -1065,17 +1081,22 @@ int parse_mount(struct autofs_point *ap, const char *name, - } - - if (append_options) { -- tmp = concat_options(options, mnt_options); -- if (!tmp) { -- char *estr = strerror_r(errno, buf, MAX_ERR_BUF); -- error(ap->logopt, MODPREFIX "concat_options: %s", estr); -- if (options) -- free(options); -- if (mnt_options) -- free(mnt_options); -- return 1; -+ if (options && mnt_options && strstr(mnt_options, options)) { -+ free(options); -+ options = mnt_options; -+ } else { -+ tmp = concat_options(options, mnt_options); -+ if (!tmp) { -+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); -+ error(ap->logopt, MODPREFIX "concat_options: %s", estr); -+ if (options) -+ free(options); -+ if (mnt_options) -+ free(mnt_options); -+ return 1; -+ } -+ options = tmp; - } -- options = tmp; - } else - options = mnt_options; - } diff --git a/autofs-5.0.1-cmd-global-options.patch b/autofs-5.0.1-cmd-global-options.patch deleted file mode 100644 index 0212355..0000000 --- a/autofs-5.0.1-cmd-global-options.patch +++ /dev/null @@ -1,143 +0,0 @@ -diff --git a/daemon/automount.c b/daemon/automount.c -index 37e040b..a8327d1 100644 ---- a/daemon/automount.c -+++ b/daemon/automount.c -@@ -47,6 +47,8 @@ const char *libdir = AUTOFS_LIB_DIR; /* Location of library modules */ - const char *mapdir = AUTOFS_MAP_DIR; /* Location of mount maps */ - const char *confdir = AUTOFS_CONF_DIR; /* Location of autofs config file */ - -+const char *global_options; /* Global option, from command line */ -+ - static char *pid_file = NULL; /* File in which to keep pid */ - unsigned int random_selection; /* use random policy when selecting - * which multi-mount host to mount */ -@@ -1367,6 +1369,8 @@ static void usage(void) - /*" -f --foreground do not fork into background\n" */ - " -r --random-replicated-selection" - " use ramdom replicated server selection\n" -+ " -O --global-options" -+ " specify global mount options\n" - " -V --version print version, build config and exit\n" - , program); - } -@@ -1452,7 +1456,7 @@ int main(int argc, char *argv[]) - { - int res, opt, status; - unsigned ghost, logging; -- unsigned foreground; -+ unsigned foreground, have_global_options; - time_t timeout; - time_t age = time(NULL); - sigset_t allsigs; -@@ -1466,6 +1470,7 @@ int main(int argc, char *argv[]) - {"define", 1, 0, 'D'}, - {"foreground", 0, 0, 'f'}, - {"random-selection", 0, 0, 'r'}, -+ {"global-options", 1, 0, 'O'}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; -@@ -1482,10 +1487,12 @@ int main(int argc, char *argv[]) - ghost = defaults_get_browse_mode(); - logging = defaults_get_logging(); - random_selection = 0; -+ global_options = NULL; -+ have_global_options = 0; - foreground = 0; - - opterr = 0; -- while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVr", long_options, NULL)) != EOF) { -+ while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVrO:", long_options, NULL)) != EOF) { - switch (opt) { - case 'h': - usage(); -@@ -1523,6 +1530,16 @@ int main(int argc, char *argv[]) - random_selection = 1; - break; - -+ case 'O': -+ if (!have_global_options) { -+ global_options = strdup(optarg); -+ have_global_options = 1; -+ break; -+ } -+ printf("%s: global options already specified.\n", -+ program); -+ break; -+ - case '?': - case ':': - printf("%s: Ambiguous or unknown options\n", program); -diff --git a/man/automount.8.in b/man/automount.8.in -index 59f2805..b01be83 100644 ---- a/man/automount.8.in -+++ b/man/automount.8.in -@@ -51,6 +51,12 @@ mount entries. - Enables the use of ramdom selection when choosing a host from a - list of replicated servers. - .TP -+.I "\-O, \-\-global-options" -+Allows the specification of global mount options used for all master -+map entries. These options will either replace or be appened to options -+given in a master map entry depending on the APPEND_OPTIONS configuration -+setting. -+.TP - .I "\-V, \-\-version" - Display the version number, then exit. - .SH ARGUMENTS -diff --git a/modules/parse_sun.c b/modules/parse_sun.c -index 276493a..0494e76 100644 ---- a/modules/parse_sun.c -+++ b/modules/parse_sun.c -@@ -42,6 +42,8 @@ int parse_version = AUTOFS_PARSE_VERSION; /* Required by protocol */ - static struct mount_mod *mount_nfs = NULL; - static int init_ctr = 0; - -+extern const char *global_options; -+ - struct parse_context { - char *optstr; /* Mount options */ - char *macros; /* Map wide macro defines */ -@@ -65,6 +67,8 @@ static struct parse_context default_context = { - 1 /* Do slashify_colons */ - }; - -+static char *concat_options(char *left, char *right); -+ - /* Free all storage associated with this context */ - static void kill_context(struct parse_context *ctxt) - { -@@ -264,6 +268,7 @@ int parse_init(int argc, const char *const *argv, void **context) - const char *xopt; - int optlen, len, offset; - int i, bval; -+ unsigned int append_options; - - /* Get processor information for predefined escapes */ - -@@ -392,6 +397,25 @@ int parse_init(int argc, const char *const *argv, void **context) - } - } - -+ if (global_options) { -+ append_options = defaults_get_append_options(); -+ if (append_options) { -+ char *tmp = concat_options(global_options, ctxt->optstr); -+ if (!tmp) { -+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); -+ error(LOGOPT_ANY, MODPREFIX "concat_options: %s", estr); -+ } else -+ ctxt->optstr = tmp; -+ } else { -+ if (!ctxt->optstr) -+ ctxt->optstr = strdup(global_options); -+ if (!ctxt->optstr) { -+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); -+ warn(LOGOPT_ANY, MODPREFIX "%s", estr); -+ } -+ } -+ } -+ - debug(LOGOPT_NONE, - MODPREFIX "init gathered global options: %s", ctxt->optstr); - diff --git a/autofs-5.0.1-conf-append-global.patch b/autofs-5.0.1-conf-append-global.patch deleted file mode 100644 index 2c163e4..0000000 --- a/autofs-5.0.1-conf-append-global.patch +++ /dev/null @@ -1,158 +0,0 @@ -diff --git a/include/defaults.h b/include/defaults.h -index b64735f..ef58467 100644 ---- a/include/defaults.h -+++ b/include/defaults.h -@@ -34,6 +34,7 @@ - #define DEFAULT_ENTRY_ATTR "cn" - #define DEFAULT_VALUE_ATTR "nisMapEntry" - -+#define DEFAULT_APPEND_OPTIONS 1 - #define DEFAULT_AUTH_CONF_FILE AUTOFS_MAP_DIR "/autofs_ldap_auth.conf" - - unsigned int defaults_read_config(void); -@@ -47,6 +48,7 @@ const char *defaults_get_entry_obj_class(void); - const char *defaults_get_map_attr(void); - const char *defaults_get_entry_attr(void); - const char *defaults_get_value_attr(void); -+unsigned int defaults_get_append_options(void); - const char *defaults_get_auth_conf_file(void); - - #endif -diff --git a/lib/defaults.c b/lib/defaults.c -index f76478e..4b4acba 100644 ---- a/lib/defaults.c -+++ b/lib/defaults.c -@@ -37,6 +37,7 @@ - #define ENV_NAME_ENTRY_ATTR "ENTRY_ATTRIBUTE" - #define ENV_NAME_VALUE_ATTR "VALUE_ATTRIBUTE" - -+#define ENV_APPEND_OPTIONS "APPEND_OPTIONS" - #define ENV_AUTH_CONF_FILE "AUTH_CONF_FILE" - - static const char *default_master_map_name = DEFAULT_MASTER_MAP_NAME; -@@ -200,6 +201,7 @@ unsigned int defaults_read_config(void) - check_set_config_value(res, ENV_NAME_MAP_ATTR, value) || - check_set_config_value(res, ENV_NAME_ENTRY_ATTR, value) || - check_set_config_value(res, ENV_NAME_VALUE_ATTR, value) || -+ check_set_config_value(res, ENV_APPEND_OPTIONS, value) || - check_set_config_value(res, ENV_AUTH_CONF_FILE, value)) - ; - } -@@ -338,6 +340,17 @@ const char *defaults_get_value_attr(void) - return (const char *) va; - } - -+unsigned int defaults_get_append_options(void) -+{ -+ int res; -+ -+ res = get_env_yesno(ENV_APPEND_OPTIONS); -+ if (res < 0) -+ res = DEFAULT_APPEND_OPTIONS; -+ -+ return res; -+} -+ - const char *defaults_get_auth_conf_file(void) - { - char *cf; -diff --git a/modules/parse_sun.c b/modules/parse_sun.c -index 9323e7c..276493a 100644 ---- a/modules/parse_sun.c -+++ b/modules/parse_sun.c -@@ -140,7 +140,7 @@ int expandsunent(const char *src, char *dst, const char *key, - * re preserved, we need to escape them here. - */ - if (strchr(key, ' ')) { -- char *keyp = key; -+ const char *keyp = key; - while (*keyp) { - if (isspace(*keyp)) { - if (dst) { -@@ -953,6 +953,7 @@ int parse_mount(struct autofs_point *ap, const char *name, - int mapent_len, rv = 0; - int optlen, cur_state; - int slashify = ctxt->slashify_colons; -+ unsigned int append_options; - - source = ap->entry->current; - ap->entry->current = NULL; -@@ -998,6 +999,7 @@ int parse_mount(struct autofs_point *ap, const char *name, - - debug(ap->logopt, MODPREFIX "expanded entry: %s", pmapent); - -+ append_options = defaults_get_append_options(); - options = strdup(ctxt->optstr ? ctxt->optstr : ""); - if (!options) { - char *estr = strerror_r(errno, buf, MAX_ERR_BUF); -@@ -1010,10 +1012,10 @@ int parse_mount(struct autofs_point *ap, const char *name, - - /* Deal with 0 or more options */ - if (*p == '-') { -- char *mnt_options = NULL; -+ char *tmp, *mnt_options = NULL; - - do { -- char *tmp, *noptions = NULL; -+ char *noptions = NULL; - - p = parse_options(p, &noptions, ap->logopt); - tmp = concat_options(mnt_options, noptions); -@@ -1033,10 +1035,25 @@ int parse_mount(struct autofs_point *ap, const char *name, - p = skipspace(p); - } while (*p == '-'); - -- if (options) -+ if (options && !append_options) { - free(options); -+ options = NULL; -+ } - -- options = mnt_options; -+ if (append_options) { -+ tmp = concat_options(options, mnt_options); -+ if (!tmp) { -+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); -+ error(ap->logopt, MODPREFIX "concat_options: %s", estr); -+ if (options) -+ free(options); -+ if (mnt_options) -+ free(mnt_options); -+ return 1; -+ } -+ options = tmp; -+ } else -+ options = mnt_options; - } - - debug(ap->logopt, MODPREFIX "gathered options: %s", options); -diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in -index 84d524b..8299b55 100644 ---- a/redhat/autofs.sysconfig.in -+++ b/redhat/autofs.sysconfig.in -@@ -13,6 +13,10 @@ TIMEOUT=300 - # - BROWSE_MODE="no" - # -+# APPEND_OPTIONS - append to global options instead of replace. -+# -+#APPEND_OPTIONS="yes" -+# - # LOGGING - set default log level "none", "verbose" or "debug" - # - #LOGGING="none" -diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in -index 84d524b..8299b55 100644 ---- a/samples/autofs.conf.default.in -+++ b/samples/autofs.conf.default.in -@@ -13,6 +13,10 @@ TIMEOUT=300 - # - BROWSE_MODE="no" - # -+# APPEND_OPTIONS - append to global options instead of replace. -+# -+#APPEND_OPTIONS="yes" -+# - # LOGGING - set default log level "none", "verbose" or "debug" - # - #LOGGING="none" diff --git a/autofs-5.0.1-correct-logic-test-wild-lookup.patch b/autofs-5.0.1-correct-logic-test-wild-lookup.patch deleted file mode 100644 index 02967fd..0000000 --- a/autofs-5.0.1-correct-logic-test-wild-lookup.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff --git a/modules/lookup_file.c b/modules/lookup_file.c -index cc1964f..6346602 100644 ---- a/modules/lookup_file.c -+++ b/modules/lookup_file.c -@@ -979,12 +979,12 @@ static int check_map_indirect(struct autofs_point *ap, - } - } else { - /* Wildcard not in map but now is */ -- if (wild & (CHE_OK || CHE_UPDATED)) -+ if (wild & (CHE_OK | CHE_UPDATED)) - source->stale = 1; - } - pthread_cleanup_pop(1); - -- if (wild & (CHE_OK || CHE_UPDATED)) -+ if (wild & (CHE_OK | CHE_UPDATED)) - return NSS_STATUS_SUCCESS; - } - -diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c -index eae8702..83e99e0 100644 ---- a/modules/lookup_nisplus.c -+++ b/modules/lookup_nisplus.c -@@ -438,12 +438,12 @@ static int check_map_indirect(struct autofs_point *ap, - } - } else { - /* Wildcard not in map but now is */ -- if (wild & (CHE_OK || CHE_UPDATED)) -+ if (wild & (CHE_OK | CHE_UPDATED)) - source->stale = 1; - } - pthread_cleanup_pop(1); - -- if (wild & (CHE_UPDATED || CHE_OK)) -+ if (wild & (CHE_UPDATED | CHE_OK)) - return NSS_STATUS_SUCCESS; - } - -diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c -index 5a154cd..da280cc 100644 ---- a/modules/lookup_yp.c -+++ b/modules/lookup_yp.c -@@ -523,12 +523,12 @@ static int check_map_indirect(struct autofs_point *ap, - } - } else { - /* Wildcard not in map but now is */ -- if (wild & (CHE_OK || CHE_UPDATED)) -+ if (wild & (CHE_OK | CHE_UPDATED)) - source->stale = 1; - } - pthread_cleanup_pop(1); - -- if (wild & (CHE_OK || CHE_UPDATED)) -+ if (wild & (CHE_OK | CHE_UPDATED)) - return NSS_STATUS_SUCCESS; - } - diff --git a/autofs-5.0.1-disable-exports-check.patch b/autofs-5.0.1-disable-exports-check.patch deleted file mode 100644 index 387fc52..0000000 --- a/autofs-5.0.1-disable-exports-check.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c -index f6a65ae..a9a4c75 100644 ---- a/modules/lookup_hosts.c -+++ b/modules/lookup_hosts.c -@@ -208,7 +208,7 @@ done: - exp = rpc_get_exports(name, 10, 0, RPC_CLOSE_NOLINGER); - - /* Check exports for obvious ones we don't have access to */ -- exp = rpc_exports_prune(exp); -+ /*exp = rpc_exports_prune(exp);*/ - - mapent = NULL; - while (exp) { diff --git a/autofs-5.0.1-drop-default-prefix-from-config.patch b/autofs-5.0.1-drop-default-prefix-from-config.patch deleted file mode 100644 index e8aa0ef..0000000 --- a/autofs-5.0.1-drop-default-prefix-from-config.patch +++ /dev/null @@ -1,467 +0,0 @@ -diff --git a/README.v5.release b/README.v5.release -index 3f23b91..3b4e02b 100644 ---- a/README.v5.release -+++ b/README.v5.release -@@ -13,8 +13,7 @@ Differences between version 4 and version 5. - installed "/etc/auto.master" to ensure that those using NIS will - still find their master map. This is in line with other industry - automount implementations. The name of the default master map can -- be overridden by setting the DEFAULT_MASTER_MAP_NAME configuration -- variable. -+ be overridden by setting the MASTER_MAP_NAME configuration variable. - - - The `automount' daemon is now a multi-threaded application and so - appears as a single process (unless a thread process display option -diff --git a/gentoo/net-fs/autofs/files/autofs.conf b/gentoo/net-fs/autofs/files/autofs.conf -index 836a4a1..7b34c20 100644 ---- a/gentoo/net-fs/autofs/files/autofs.conf -+++ b/gentoo/net-fs/autofs/files/autofs.conf -@@ -1,50 +1,50 @@ - # - # Define default options for autofs. - # --# DEFAULT_MASTER_MAP_NAME - default map name for the master map. -+# MASTER_MAP_NAME - default map name for the master map. - # --#DEFAULT_MASTER_MAP_NAME="/etc/auto.master" -+#MASTER_MAP_NAME="/etc/auto.master" - # --# DEFAULT_TIMEOUT - set the default mount timeout (default 600). -+# TIMEOUT - set the default mount timeout (default 600). - # --DEFAULT_TIMEOUT=300 -+TIMEOUT=300 - # --# DEFAULT_BROWSE_MODE - maps are browsable by default. -+# BROWSE_MODE - maps are browsable by default. - # --DEFAULT_BROWSE_MODE="no" -+BROWSE_MODE="no" - # --# DEFAULT_LOGGING - set default log level "none", "verbode" or "debug" -+# LOGGING - set default log level "none", "verbode" or "debug" - # --#DEFAULT_LOGGING="none" -+#LOGGING="none" - # - # Define the default LDAP schema to use for lookups - # - # System default - # --#DEFAULT_MAP_OBJECT_CLASS="nisMap" --#DEFAULT_ENTRY_OBJECT_CLASS="nisObject" --#DEFAULT_MAP_ATTRIBUTE="nisMapName" --#DEFAULT_ENTRY_ATTRIBUTE="cn" --#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry" -+#MAP_OBJECT_CLASS="nisMap" -+#ENTRY_OBJECT_CLASS="nisObject" -+#MAP_ATTRIBUTE="nisMapName" -+#ENTRY_ATTRIBUTE="cn" -+#VALUE_ATTRIBUTE="nisMapEntry" - # - # Other common LDAP nameing - # --#DEFAULT_MAP_OBJECT_CLASS="automountMap" --#DEFAULT_ENTRY_OBJECT_CLASS="automount" --#DEFAULT_MAP_ATTRIBUTE="ou" --#DEFAULT_ENTRY_ATTRIBUTE="cn" --#DEFAULT_VALUE_ATTRIBUTE="automountInformation" -+#MAP_OBJECT_CLASS="automountMap" -+#ENTRY_OBJECT_CLASS="automount" -+#MAP_ATTRIBUTE="ou" -+#ENTRY_ATTRIBUTE="cn" -+#VALUE_ATTRIBUTE="automountInformation" - # --#DEFAULT_MAP_OBJECT_CLASS="automountMap" --#DEFAULT_ENTRY_OBJECT_CLASS="automount" --#DEFAULT_MAP_ATTRIBUTE="automountMapName" --#DEFAULT_ENTRY_ATTRIBUTE="automountKey" --#DEFAULT_VALUE_ATTRIBUTE="automountInformation" -+#MAP_OBJECT_CLASS="automountMap" -+#ENTRY_OBJECT_CLASS="automount" -+#MAP_ATTRIBUTE="automountMapName" -+#ENTRY_ATTRIBUTE="automountKey" -+#VALUE_ATTRIBUTE="automountInformation" - # --# DEFAULT_AUTH_CONF_FILE - set the default location for the SASL --# authentication configuration file. -+# AUTH_CONF_FILE - set the default location for the SASL -+# authentication configuration file. - # --#DEFAULT_AUTH_CONF_FILE="/etc/autofs/autofs-auth.conf" -+#AUTH_CONF_FILE="/etc/autofs/autofs-auth.conf" - # - # General global options - # -diff --git a/lib/defaults.c b/lib/defaults.c -index 65dbd8d..f76478e 100644 ---- a/lib/defaults.c -+++ b/lib/defaults.c -@@ -23,21 +23,21 @@ - #define DEFAULTS_CONFIG_FILE AUTOFS_CONF_DIR "/autofs" - #define MAX_LINE_LEN 256 - --#define ENV_NAME_MASTER_MAP "DEFAULT_MASTER_MAP_NAME" -+#define ENV_NAME_MASTER_MAP "MASTER_MAP_NAME" - --#define ENV_NAME_TIMEOUT "DEFAULT_TIMEOUT" --#define ENV_NAME_BROWSE_MODE "DEFAULT_BROWSE_MODE" --#define ENV_NAME_LOGGING "DEFAULT_LOGGING" -+#define ENV_NAME_TIMEOUT "TIMEOUT" -+#define ENV_NAME_BROWSE_MODE "BROWSE_MODE" -+#define ENV_NAME_LOGGING "LOGGING" - --#define ENV_LDAP_SERVER "DEFAULT_LDAP_SERVER" -+#define ENV_LDAP_SERVER "LDAP_SERVER" - --#define ENV_NAME_MAP_OBJ_CLASS "DEFAULT_MAP_OBJECT_CLASS" --#define ENV_NAME_ENTRY_OBJ_CLASS "DEFAULT_ENTRY_OBJECT_CLASS" --#define ENV_NAME_MAP_ATTR "DEFAULT_MAP_ATTRIBUTE" --#define ENV_NAME_ENTRY_ATTR "DEFAULT_ENTRY_ATTRIBUTE" --#define ENV_NAME_VALUE_ATTR "DEFAULT_VALUE_ATTRIBUTE" -+#define ENV_NAME_MAP_OBJ_CLASS "MAP_OBJECT_CLASS" -+#define ENV_NAME_ENTRY_OBJ_CLASS "ENTRY_OBJECT_CLASS" -+#define ENV_NAME_MAP_ATTR "MAP_ATTRIBUTE" -+#define ENV_NAME_ENTRY_ATTR "ENTRY_ATTRIBUTE" -+#define ENV_NAME_VALUE_ATTR "VALUE_ATTRIBUTE" - --#define ENV_AUTH_CONF_FILE "DEFAULT_AUTH_CONF_FILE" -+#define ENV_AUTH_CONF_FILE "AUTH_CONF_FILE" - - static const char *default_master_map_name = DEFAULT_MASTER_MAP_NAME; - -@@ -104,6 +104,39 @@ static int get_env_yesno(const char *name) - } - - /* -+ * We've changed the key names so we need to check for the -+ * config key and it's old name for backward conpatibility. -+*/ -+static int check_set_config_value(const char *res, const char *name, const char *value) -+{ -+ char *old_name; -+ int ret; -+ -+ if (!strcasecmp(res, name)) { -+ ret = setenv(name, value, 0); -+ if (ret) -+ fprintf(stderr, -+ "can't set config value for %s, " -+ "error %d", name, ret); -+ return 1; -+ } -+ -+ old_name = alloca(strlen(name) + 9); -+ strcpy(old_name, "DEFAULT_"); -+ strcat(old_name, name); -+ -+ if (!strcasecmp(res, old_name)) { -+ ret = setenv(name, value, 0); -+ if (ret) -+ fprintf(stderr, -+ "can't set config value for %s, " -+ "error %d", name, ret); -+ return 1; -+ } -+ return 0; -+} -+ -+/* - * Read config env variables and check they have been set. - * - * This simple minded routine assumes the config file -@@ -115,7 +148,6 @@ unsigned int defaults_read_config(void) - FILE *f; - char buf[MAX_LINE_LEN]; - char *res, *value; -- unsigned int ret; - - f = fopen(DEFAULTS_CONFIG_FILE, "r"); - if (!f) -@@ -158,23 +190,18 @@ unsigned int defaults_read_config(void) - while (*trailer && (*trailer == '"' || isblank(*trailer))) - *(trailer--) = '\0';; - -- if (!strcasecmp(res, ENV_NAME_MASTER_MAP) || -- !strcasecmp(res, ENV_NAME_TIMEOUT) || -- !strcasecmp(res, ENV_NAME_BROWSE_MODE) || -- !strcasecmp(res, ENV_NAME_LOGGING) || -- !strcasecmp(res, ENV_LDAP_SERVER) || -- !strcasecmp(res, ENV_NAME_MAP_OBJ_CLASS) || -- !strcasecmp(res, ENV_NAME_ENTRY_OBJ_CLASS) || -- !strcasecmp(res, ENV_NAME_MAP_ATTR) || -- !strcasecmp(res, ENV_NAME_ENTRY_ATTR) || -- !strcasecmp(res, ENV_NAME_VALUE_ATTR) || -- !strcasecmp(res, ENV_AUTH_CONF_FILE)) { -- ret = setenv(res, value, 0); -- if (ret) -- fprintf(stderr, -- "can't set config value for %s, " -- "error %d", res, ret); -- } -+ if (check_set_config_value(res, ENV_NAME_MASTER_MAP, value) || -+ check_set_config_value(res, ENV_NAME_TIMEOUT, value) || -+ check_set_config_value(res, ENV_NAME_BROWSE_MODE, value) || -+ check_set_config_value(res, ENV_NAME_LOGGING, value) || -+ check_set_config_value(res, ENV_LDAP_SERVER, value) || -+ check_set_config_value(res, ENV_NAME_MAP_OBJ_CLASS, value) || -+ check_set_config_value(res, ENV_NAME_ENTRY_OBJ_CLASS, value) || -+ check_set_config_value(res, ENV_NAME_MAP_ATTR, value) || -+ check_set_config_value(res, ENV_NAME_ENTRY_ATTR, value) || -+ check_set_config_value(res, ENV_NAME_VALUE_ATTR, value) || -+ check_set_config_value(res, ENV_AUTH_CONF_FILE, value)) -+ ; - } - - if (!feof(f)) { -diff --git a/man/auto.master.5.in b/man/auto.master.5.in -index cb3c1d6..cfeefe7 100644 ---- a/man/auto.master.5.in -+++ b/man/auto.master.5.in -@@ -25,7 +25,7 @@ The default location of the master map is - but an alternate name may be given on the command line when running - the automounter and the default master map may changed by setting the - .nh --.B "DEFAULT_MASTER_MAP_NAME" -+.B "MASTER_MAP_NAME" - .hy - configuration variable in - .nh -@@ -144,13 +144,13 @@ configuration file - .hy - They are: - .TP --.B DEFAULT_TIMEOUT -+.B TIMEOUT - sets the default mount timeout (program default 600). - .TP --.B DEFAULT_BROWSE_MODE -+.B BROWSE_MODE - Maps are browsable by default (program default "yes"). - .TP --.B DEFAULT_LOGGING -+.B LOGGING - set default log level "none", "verbose" or "debug" (program default "none"). - ======= - .SH GENERAL SYSTEM DEFAULTS CONFIGURATION -@@ -163,13 +163,13 @@ configuration file - .P - They are: - .TP --.B DEFAULT_TIMEOUT -+.B TIMEOUT - sets the default mount timeout (program default 600). - .TP --.B DEFAULT_BROWSE_MODE -+.B BROWSE_MODE - Maps are browsable by default (program default "yes"). - .TP --.B DEFAULT_LOGGING -+.B LOGGING - set default log level "none", "verbose" or "debug" (program default "none"). - .SH BUILTIN MAP -hosts - If "-hosts" is given as the map then accessing a key under the mount point -@@ -215,7 +215,7 @@ located in - .P - The configuration settings available are: - .TP --\fBDEFAULT_MAP_OBJECT_CLASS\fP -+\fBMAP_OBJECT_CLASS\fP - The map object class. Its Default value is "nisMap". In the - .nh - automountMap -@@ -225,14 +225,14 @@ schema this corresponds to the class - .BR automountMap . - .hy - .TP --.B DEFAULT_ENTRY_OBJECT_CLASS -+.B ENTRY_OBJECT_CLASS - The map entry object class. Its default value is \fBnisObject\fP. - In the automountMap schema this corresponds to the class - .nh - .BR automount . - .hy - .TP --.B DEFAULT_MAP_ATTRIBUTE -+.B MAP_ATTRIBUTE - The attribute used to identify the name of the map to which this - entry belongs. Its default value is - .nh -@@ -247,7 +247,7 @@ schema this corresponds to the attributes \fBou\fP or - .BR automountMapName . - .hy - .TP --.B DEFAULT_ENTRY_ATTRIBUTE -+.B ENTRY_ATTRIBUTE - The attribute used to identify a map key. Its default value is - In the - .nh -@@ -258,7 +258,7 @@ schema this corresponds to the attribute - .BR automountKey . - .hy - .TP --.B DEFAULT_VALUE_ATTRIBUTE -+.B VALUE_ATTRIBUTE - The attribute used to identify the value of the map entry. Its default - value is - .nh -diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in -index 7cbc03f..84d524b 100644 ---- a/redhat/autofs.sysconfig.in -+++ b/redhat/autofs.sysconfig.in -@@ -1,50 +1,50 @@ - # - # Define default options for autofs. - # --# DEFAULT_MASTER_MAP_NAME - default map name for the master map. -+# MASTER_MAP_NAME - default map name for the master map. - # --#DEFAULT_MASTER_MAP_NAME="auto.master" -+#MASTER_MAP_NAME="auto.master" - # --# DEFAULT_TIMEOUT - set the default mount timeout (default 600). -+# TIMEOUT - set the default mount timeout (default 600). - # --DEFAULT_TIMEOUT=300 -+TIMEOUT=300 - # --# DEFAULT_BROWSE_MODE - maps are browsable by default. -+# BROWSE_MODE - maps are browsable by default. - # --DEFAULT_BROWSE_MODE="no" -+BROWSE_MODE="no" - # --# DEFAULT_LOGGING - set default log level "none", "verbose" or "debug" -+# LOGGING - set default log level "none", "verbose" or "debug" - # --#DEFAULT_LOGGING="none" -+#LOGGING="none" - # - # Define the default LDAP schema to use for lookups - # - # System default - # --#DEFAULT_MAP_OBJECT_CLASS="nisMap" --#DEFAULT_ENTRY_OBJECT_CLASS="nisObject" --#DEFAULT_MAP_ATTRIBUTE="nisMapName" --#DEFAULT_ENTRY_ATTRIBUTE="cn" --#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry" -+#MAP_OBJECT_CLASS="nisMap" -+#ENTRY_OBJECT_CLASS="nisObject" -+#MAP_ATTRIBUTE="nisMapName" -+#ENTRY_ATTRIBUTE="cn" -+#VALUE_ATTRIBUTE="nisMapEntry" - # - # Other common LDAP nameing - # --#DEFAULT_MAP_OBJECT_CLASS="automountMap" --#DEFAULT_ENTRY_OBJECT_CLASS="automount" --#DEFAULT_MAP_ATTRIBUTE="ou" --#DEFAULT_ENTRY_ATTRIBUTE="cn" --#DEFAULT_VALUE_ATTRIBUTE="automountInformation" -+#MAP_OBJECT_CLASS="automountMap" -+#ENTRY_OBJECT_CLASS="automount" -+#MAP_ATTRIBUTE="ou" -+#ENTRY_ATTRIBUTE="cn" -+#VALUE_ATTRIBUTE="automountInformation" - # --#DEFAULT_MAP_OBJECT_CLASS="automountMap" --#DEFAULT_ENTRY_OBJECT_CLASS="automount" --#DEFAULT_MAP_ATTRIBUTE="automountMapName" --#DEFAULT_ENTRY_ATTRIBUTE="automountKey" --#DEFAULT_VALUE_ATTRIBUTE="automountInformation" -+#MAP_OBJECT_CLASS="automountMap" -+#ENTRY_OBJECT_CLASS="automount" -+#MAP_ATTRIBUTE="automountMapName" -+#ENTRY_ATTRIBUTE="automountKey" -+#VALUE_ATTRIBUTE="automountInformation" - # --# DEFAULT_AUTH_CONF_FILE - set the default location for the SASL -+# AUTH_CONF_FILE - set the default location for the SASL - # authentication configuration file. - # --#DEFAULT_AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf" -+#AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf" - # - # General global options - # -diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in -index 7cbc03f..84d524b 100644 ---- a/samples/autofs.conf.default.in -+++ b/samples/autofs.conf.default.in -@@ -1,50 +1,50 @@ - # - # Define default options for autofs. - # --# DEFAULT_MASTER_MAP_NAME - default map name for the master map. -+# MASTER_MAP_NAME - default map name for the master map. - # --#DEFAULT_MASTER_MAP_NAME="auto.master" -+#MASTER_MAP_NAME="auto.master" - # --# DEFAULT_TIMEOUT - set the default mount timeout (default 600). -+# TIMEOUT - set the default mount timeout (default 600). - # --DEFAULT_TIMEOUT=300 -+TIMEOUT=300 - # --# DEFAULT_BROWSE_MODE - maps are browsable by default. -+# BROWSE_MODE - maps are browsable by default. - # --DEFAULT_BROWSE_MODE="no" -+BROWSE_MODE="no" - # --# DEFAULT_LOGGING - set default log level "none", "verbose" or "debug" -+# LOGGING - set default log level "none", "verbose" or "debug" - # --#DEFAULT_LOGGING="none" -+#LOGGING="none" - # - # Define the default LDAP schema to use for lookups - # - # System default - # --#DEFAULT_MAP_OBJECT_CLASS="nisMap" --#DEFAULT_ENTRY_OBJECT_CLASS="nisObject" --#DEFAULT_MAP_ATTRIBUTE="nisMapName" --#DEFAULT_ENTRY_ATTRIBUTE="cn" --#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry" -+#MAP_OBJECT_CLASS="nisMap" -+#ENTRY_OBJECT_CLASS="nisObject" -+#MAP_ATTRIBUTE="nisMapName" -+#ENTRY_ATTRIBUTE="cn" -+#VALUE_ATTRIBUTE="nisMapEntry" - # - # Other common LDAP nameing - # --#DEFAULT_MAP_OBJECT_CLASS="automountMap" --#DEFAULT_ENTRY_OBJECT_CLASS="automount" --#DEFAULT_MAP_ATTRIBUTE="ou" --#DEFAULT_ENTRY_ATTRIBUTE="cn" --#DEFAULT_VALUE_ATTRIBUTE="automountInformation" -+#MAP_OBJECT_CLASS="automountMap" -+#ENTRY_OBJECT_CLASS="automount" -+#MAP_ATTRIBUTE="ou" -+#ENTRY_ATTRIBUTE="cn" -+#VALUE_ATTRIBUTE="automountInformation" - # --#DEFAULT_MAP_OBJECT_CLASS="automountMap" --#DEFAULT_ENTRY_OBJECT_CLASS="automount" --#DEFAULT_MAP_ATTRIBUTE="automountMapName" --#DEFAULT_ENTRY_ATTRIBUTE="automountKey" --#DEFAULT_VALUE_ATTRIBUTE="automountInformation" -+#MAP_OBJECT_CLASS="automountMap" -+#ENTRY_OBJECT_CLASS="automount" -+#MAP_ATTRIBUTE="automountMapName" -+#ENTRY_ATTRIBUTE="automountKey" -+#VALUE_ATTRIBUTE="automountInformation" - # --# DEFAULT_AUTH_CONF_FILE - set the default location for the SASL -+# AUTH_CONF_FILE - set the default location for the SASL - # authentication configuration file. - # --#DEFAULT_AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf" -+#AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf" - # - # General global options - # diff --git a/autofs-5.0.1-export-check-network-fix-2.patch b/autofs-5.0.1-export-check-network-fix-2.patch deleted file mode 100644 index 43dcb75..0000000 --- a/autofs-5.0.1-export-check-network-fix-2.patch +++ /dev/null @@ -1,144 +0,0 @@ -diff --git a/CHANGELOG b/CHANGELOG -index 0bb91e9..34fad3e 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -2,6 +2,7 @@ - ----------------------- - - fix return check for getpwuid_r and getgrgid_r. - - give up trying to update exports list while host is mounted. -+- fix to "@network" matching. - - 20/2/2007 autofs-5.0.1 - ---------------------- -diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c -index f51ca82..2c5b5d5 100644 ---- a/lib/rpc_subs.c -+++ b/lib/rpc_subs.c -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - #include - - #include "mount.h" -@@ -46,6 +47,8 @@ - #define MAX_IFC_BUF 1024 - #define MAX_ERR_BUF 128 - -+#define MAX_NETWORK_LEN 255 -+ - /* Get numeric value of the n bits starting at position p */ - #define getbits(x, p, n) ((x >> (p + 1 - n)) & ~(~0 << n)) - -@@ -1066,6 +1069,9 @@ static char *inet_fill_net(const char *net_num, char *net) - char *np; - unsigned int dots = 3; - -+ if (strlen(net_num) > INET_ADDRSTRLEN) -+ return NULL; -+ - *net = '\0'; - strcpy(net, net_num); - -@@ -1076,6 +1082,11 @@ static char *inet_fill_net(const char *net_num, char *net) - if (!*np && dots) - strcat(net, "0"); - } -+ -+ if (!isdigit(*np) || dots < 0) { -+ *net = '\0'; -+ return NULL; -+ } - } - - while (dots--) -@@ -1088,13 +1099,21 @@ static int match_network(const char *network) - { - struct netent *pnent, nent; - const char *pcnet; -- char *net, cnet[INET_ADDRSTRLEN + 1], mask[4], *pmask; -+ char *net, cnet[MAX_NETWORK_LEN], mask[4], *pmask; - unsigned int size; -+ size_t l_network = strlen(network) + 1; - int status; - -- net = alloca(strlen(network) + 1); -+ if (l_network > MAX_NETWORK_LEN) { -+ error(LOGOPT_ANY, -+ "match string \"%s\" too long", network); -+ return 0; -+ } -+ -+ net = alloca(l_network); - if (!net) - return 0; -+ memset(net, 0, l_network); - strcpy(net, network); - - if ((pmask = strchr(net, '/'))) -@@ -1115,32 +1134,48 @@ static int match_network(const char *network) - if (pnent) { - uint32_t n_net; - -- n_net = ntohl(nent.n_net); -- pcnet = inet_ntop(nent.n_addrtype, &n_net, cnet, INET_ADDRSTRLEN); -- if (!pcnet) -+ switch (nent.n_addrtype) { -+ case AF_INET: -+ n_net = ntohl(nent.n_net); -+ pcnet = inet_ntop(AF_INET, &n_net, cnet, INET_ADDRSTRLEN); -+ if (!pcnet) -+ return 0; -+ -+ if (!pmask) { -+ size = inet_get_net_len(nent.n_net); -+ if (!size) -+ return 0; -+ } -+ break; -+ -+ case AF_INET6: - return 0; - -- if (!pmask) { -- size = inet_get_net_len(nent.n_net); -- if (!size) -- return 0; -+ default: -+ return 0; - } - } else { -- struct in_addr addr; - int ret; - -- pcnet = inet_fill_net(net, cnet); -- if (!pcnet) -+ if (strchr(net, ':')) { - return 0; -+ } else { -+ struct in_addr addr; - -- ret = inet_pton(AF_INET, pcnet, &addr); -- if (ret <= 0) -- return 0; -+ pcnet = inet_fill_net(net, cnet); -+ if (!pcnet) -+ return 0; - -- if (!pmask) { -- size = inet_get_net_len(htonl(addr.s_addr)); -- if (!size) -+ ret = inet_pton(AF_INET, pcnet, &addr); -+ if (ret <= 0) - return 0; -+ -+ if (!pmask) { -+ uint32_t nl_addr = htonl(addr.s_addr); -+ size = inet_get_net_len(nl_addr); -+ if (!size) -+ return 0; -+ } - } - } - diff --git a/autofs-5.0.1-file-map-allow-white-space-only-line.patch b/autofs-5.0.1-file-map-allow-white-space-only-line.patch deleted file mode 100644 index 51cba53..0000000 --- a/autofs-5.0.1-file-map-allow-white-space-only-line.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff --git a/CHANGELOG b/CHANGELOG -index b379431..2fc3c9e 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -4,6 +4,7 @@ - - give up trying to update exports list while host is mounted. - - fix to "@network" matching. - - check for fstab update and retry if not updated. -+- change file map lexer to allow white-space only blank lines. - - 20/2/2007 autofs-5.0.1 - ---------------------- -diff --git a/modules/lookup_file.c b/modules/lookup_file.c -index 0f4d8f1..4a5674e 100644 ---- a/modules/lookup_file.c -+++ b/modules/lookup_file.c -@@ -236,11 +236,21 @@ static int read_one(FILE *f, char *key, unsigned int *k_len, char *mapent, unsig - - case st_badent: - if (ch == '\n') { -+ nch = getc(f); -+ if (nch != EOF && isblank(nch)) { -+ ungetc(nch, f); -+ break; -+ } -+ ungetc(nch, f); - state = st_begin; - if (gotten == got_real || gotten == getting) - goto got_it; -+ warn(LOGOPT_ANY, MODPREFIX -+ "bad map entry \"%s...\" for key " -+ "\"%s\"", mapent, key); - goto next; -- } -+ } else if (!isblank(ch)) -+ gotten = got_nothing; - break; - - case st_entspc: -@@ -274,24 +284,21 @@ static int read_one(FILE *f, char *key, unsigned int *k_len, char *mapent, unsig - - case st_getent: - if (ch == '\n') { -+ if (escape == esc_all) { -+ state = st_begin; -+ warn(LOGOPT_ANY, MODPREFIX -+ "unmatched \" in %s for key %s", -+ mapent, key); -+ goto next; -+ } - nch = getc(f); - if (nch != EOF && isblank(nch)) { - ungetc(nch, f); - state = st_badent; -- gotten = got_nothing; -- warn(LOGOPT_ANY, MODPREFIX -- "bad map entry \"%s...\" for key " -- "\"%s\"", mapent, key); - break; - } - ungetc(nch, f); - state = st_begin; -- if (escape == esc_all) { -- warn(LOGOPT_ANY, MODPREFIX -- "unmatched \" in %s for key %s", -- mapent, key); -- goto next; -- } - if (gotten == got_real || gotten == getting) - goto got_it; - } else if (mapent_len < MAPENT_MAX_LEN) { diff --git a/autofs-5.0.1-fix-browse-dir-create.patch b/autofs-5.0.1-fix-browse-dir-create.patch deleted file mode 100644 index b893e95..0000000 --- a/autofs-5.0.1-fix-browse-dir-create.patch +++ /dev/null @@ -1,52 +0,0 @@ -diff --git a/daemon/lookup.c b/daemon/lookup.c -index aded82b..4429edb 100644 ---- a/daemon/lookup.c -+++ b/daemon/lookup.c -@@ -423,6 +423,7 @@ int lookup_nss_read_map(struct autofs_point *ap, time_t age) - struct nss_source *this; - struct map_source *map; - enum nsswitch_status status; -+ unsigned int at_least_one = 0; - int result = 0; - - /* -@@ -493,9 +494,13 @@ int lookup_nss_read_map(struct autofs_point *ap, time_t age) - if (result == NSS_STATUS_UNKNOWN) - continue; - -+ if (result == NSS_STATUS_SUCCESS) { -+ at_least_one = 1; -+ result = NSS_STATUS_TRYAGAIN; -+ } -+ - status = check_nss_result(this, result); - if (status >= 0) { -- result = !status; - map = NULL; - break; - } -@@ -509,7 +514,10 @@ int lookup_nss_read_map(struct autofs_point *ap, time_t age) - } - pthread_cleanup_pop(1); - -- return !result; -+ if (!result || at_least_one) -+ return 1; -+ -+ return 0; - } - - int lookup_ghost(struct autofs_point *ap) -diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c -index bc75be0..5f03b2f 100644 ---- a/modules/lookup_yp.c -+++ b/modules/lookup_yp.c -@@ -305,7 +305,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) - - mapname = alloca(strlen(ctxt->mapname) + 1); - if (!mapname) -- return 0; -+ return NSS_STATUS_UNKNOWN; - - strcpy(mapname, ctxt->mapname); - diff --git a/autofs-5.0.1-hosts-simple-fail.patch b/autofs-5.0.1-hosts-simple-fail.patch deleted file mode 100644 index ea9d8ff..0000000 --- a/autofs-5.0.1-hosts-simple-fail.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/CHANGELOG b/CHANGELOG -index d416684..0bb91e9 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -1,6 +1,7 @@ - ??/??/2007 autofs-5.0.2 - ----------------------- - - fix return check for getpwuid_r and getgrgid_r. -+- give up trying to update exports list while host is mounted. - - 20/2/2007 autofs-5.0.1 - ---------------------- -diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c -index 1a16b96..8855ed7 100644 ---- a/modules/lookup_hosts.c -+++ b/modules/lookup_hosts.c -@@ -189,7 +189,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - if (!ret) - return NSS_STATUS_SUCCESS; - -- debug(ap->logopt, MODPREFIX "mount failed - update exports list"); -+ return NSS_STATUS_TRYAGAIN; - } - done: - /* diff --git a/autofs-5.0.1-localfs-label-check.patch b/autofs-5.0.1-localfs-label-check.patch deleted file mode 100644 index accdaa9..0000000 --- a/autofs-5.0.1-localfs-label-check.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/lib/mounts.c b/lib/mounts.c -index 524f0ee..0e428e8 100644 ---- a/lib/mounts.c -+++ b/lib/mounts.c -@@ -371,7 +371,9 @@ int contained_in_local_fs(const char *path) - ret = 1; - } else - ret = 1; -- } -+ } else if (!strncmp("LABEL=", this->fs_name, 6) || -+ !strncmp("UUID=", this->fs_name, 5)) -+ ret = 1; - break; - } - } diff --git a/autofs-5.0.1-map-update-source-only.patch b/autofs-5.0.1-map-update-source-only.patch deleted file mode 100644 index 91441a2..0000000 --- a/autofs-5.0.1-map-update-source-only.patch +++ /dev/null @@ -1,1506 +0,0 @@ -diff --git a/daemon/direct.c b/daemon/direct.c -index 38baabd..179e74b 100644 ---- a/daemon/direct.c -+++ b/daemon/direct.c -@@ -526,7 +526,7 @@ int mount_autofs_direct(struct autofs_point *ap) - return -1; - - /* TODO: check map type */ -- if (lookup_nss_read_map(ap, now)) -+ if (lookup_nss_read_map(ap, NULL, now)) - lookup_prune_cache(ap, now); - else { - error(ap->logopt, "failed to read direct map"); -@@ -1413,7 +1413,7 @@ static void *do_mount_direct(void *arg) - } - - cont: -- status = lookup_nss_mount(ap, 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 -diff --git a/daemon/indirect.c b/daemon/indirect.c -index 2068c16..02e7045 100644 ---- a/daemon/indirect.c -+++ b/daemon/indirect.c -@@ -261,7 +261,7 @@ int mount_autofs_indirect(struct autofs_point *ap) - return -1; - - /* TODO: read map, determine map type is OK */ -- if (lookup_nss_read_map(ap, now)) -+ if (lookup_nss_read_map(ap, NULL, now)) - lookup_prune_cache(ap, now); - else { - error(ap->logopt, "failed to read map for %s", ap->path); -@@ -884,7 +884,7 @@ static void *do_mount_indirect(void *arg) - free(tsv); - } - cont: -- status = lookup_nss_mount(ap, 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->ioctlfd, mt->wait_queue_token); -diff --git a/daemon/lookup.c b/daemon/lookup.c -index 4429edb..acf2e98 100644 ---- a/daemon/lookup.c -+++ b/daemon/lookup.c -@@ -261,11 +261,16 @@ static int do_read_map(struct autofs_point *ap, struct map_source *map, time_t a - if (!ap->ghost && ap->type != LKP_DIRECT) - return NSS_STATUS_SUCCESS; - -+ if (!map->stale) -+ return NSS_STATUS_SUCCESS; -+ - master_source_current_wait(ap->entry); - ap->entry->current = map; - - status = lookup->lookup_read_map(ap, age, lookup->context); - -+ map->stale = 0; -+ - /* - * For maps that don't support enumeration return success - * and do whatever we must to have autofs function with an -@@ -302,7 +307,9 @@ static int read_file_source_instance(struct autofs_point *ap, struct map_source - - instance = master_find_source_instance(map, type, format, 0, NULL); - if (!instance) { -- instance = master_add_source_instance(map, type, format, age); -+ int argc = map->argc; -+ const char **argv = map->argv; -+ instance = master_add_source_instance(map, type, format, age, argc, argv); - if (!instance) - return NSS_STATUS_UNAVAIL; - instance->recurse = map->recurse; -@@ -321,7 +328,9 @@ static int read_source_instance(struct autofs_point *ap, struct map_source *map, - - instance = master_find_source_instance(map, type, format, 0, NULL); - if (!instance) { -- instance = master_add_source_instance(map, type, format, age); -+ int argc = map->argc; -+ const char **argv = map->argv; -+ instance = master_add_source_instance(map, type, format, age, argc, argv); - if (!instance) - return NSS_STATUS_UNAVAIL; - instance->recurse = map->recurse; -@@ -343,7 +352,6 @@ static enum nsswitch_status read_map_source(struct nss_source *this, - struct autofs_point *ap, struct map_source *map, time_t age) - { - enum nsswitch_status result; -- struct map_source *instance; - struct map_source tmap; - char *path; - -@@ -363,15 +371,6 @@ static enum nsswitch_status read_map_source(struct nss_source *this, - return NSS_STATUS_NOTFOUND; - } - -- instance = master_find_source_instance(map, -- "file", map->format, map->argc, map->argv); -- if (!instance) -- instance = master_find_source_instance(map, -- "program", map->format, map->argc, map->argv); -- -- if (instance) -- return read_file_source_instance(ap, map, age); -- - this->source[4] = '\0'; - tmap.type = this->source; - tmap.format = map->format; -@@ -412,10 +411,12 @@ static enum nsswitch_status read_map_source(struct nss_source *this, - result = read_file_source_instance(ap, &tmap, age); - pthread_cleanup_pop(1); - -+ map->instance = tmap.instance; -+ - return result; - } - --int lookup_nss_read_map(struct autofs_point *ap, time_t age) -+int lookup_nss_read_map(struct autofs_point *ap, struct map_source *source, time_t age) - { - struct master_mapent *entry = ap->entry; - struct list_head nsslist; -@@ -433,7 +434,10 @@ int lookup_nss_read_map(struct autofs_point *ap, time_t age) - */ - pthread_cleanup_push(master_source_lock_cleanup, entry); - master_source_readlock(entry); -- map = entry->maps; -+ if (source) -+ map = source; -+ else -+ map = entry->maps; - while (map) { - /* Is map source up to date or no longer valid */ - if (!map->stale || entry->age > map->age) { -@@ -655,7 +659,9 @@ static int lookup_name_file_source_instance(struct autofs_point *ap, struct map_ - - instance = master_find_source_instance(map, type, format, 0, NULL); - if (!instance) { -- instance = master_add_source_instance(map, type, format, age); -+ int argc = map->argc; -+ const char **argv = map->argv; -+ instance = master_add_source_instance(map, type, format, age, argc, argv); - if (!instance) - return NSS_STATUS_NOTFOUND; - instance->recurse = map->recurse; -@@ -675,7 +681,9 @@ static int lookup_name_source_instance(struct autofs_point *ap, struct map_sourc - - instance = master_find_source_instance(map, type, format, 0, NULL); - if (!instance) { -- instance = master_add_source_instance(map, type, format, age); -+ int argc = map->argc; -+ const char **argv = map->argv; -+ instance = master_add_source_instance(map, type, format, age, argc, argv); - if (!instance) - return NSS_STATUS_NOTFOUND; - instance->recurse = map->recurse; -@@ -690,7 +698,6 @@ static enum nsswitch_status lookup_map_name(struct nss_source *this, - const char *name, int name_len) - { - enum nsswitch_status result; -- struct map_source *instance; - struct map_source tmap; - char *path; - -@@ -710,13 +717,6 @@ static enum nsswitch_status lookup_map_name(struct nss_source *this, - return NSS_STATUS_NOTFOUND; - } - -- instance = master_find_source_instance(map, "file", map->format, 0, NULL); -- if (!instance) -- instance = master_find_source_instance(map, "program", map->format, 0, NULL); -- -- if (instance) -- return lookup_name_file_source_instance(ap, map, name, name_len); -- - this->source[4] = '\0'; - tmap.type = this->source; - tmap.format = map->format; -@@ -754,13 +754,15 @@ static enum nsswitch_status lookup_map_name(struct nss_source *this, - - result = lookup_name_file_source_instance(ap, &tmap, name, name_len); - -+ map->instance = tmap.instance; -+ - /* path is freed in free_argv */ - free_argv(tmap.argc, tmap.argv); - - return result; - } - --int lookup_nss_mount(struct autofs_point *ap, const char *name, int name_len) -+int lookup_nss_mount(struct autofs_point *ap, struct map_source *source, const char *name, int name_len) - { - struct master_mapent *entry = ap->entry; - struct list_head nsslist; -@@ -777,7 +779,10 @@ int lookup_nss_mount(struct autofs_point *ap, const char *name, int name_len) - */ - pthread_cleanup_push(master_source_lock_cleanup, entry); - master_source_readlock(entry); -- map = entry->maps; -+ if (source) -+ map = source; -+ else -+ map = entry->maps; - while (map) { - /* - * Only consider map sources that have been read since -@@ -856,11 +861,28 @@ int lookup_nss_mount(struct autofs_point *ap, const char *name, int name_len) - - map = map->next; - } -+ send_map_update_request(ap); - pthread_cleanup_pop(1); - - return !result; - } - -+static void lookup_close_lookup_instances(struct map_source *map) -+{ -+ struct map_source *instance; -+ -+ instance = map->instance; -+ while (instance) { -+ lookup_close_lookup_instances(instance); -+ instance = instance->next; -+ } -+ -+ if (map->lookup) { -+ close_lookup(map->lookup); -+ map->lookup = NULL; -+ } -+} -+ - void lookup_close_lookup(struct autofs_point *ap) - { - struct map_source *map; -@@ -870,21 +892,7 @@ void lookup_close_lookup(struct autofs_point *ap) - return; - - while (map) { -- struct map_source *instance; -- -- instance = map->instance; -- while (instance) { -- if (instance->lookup) { -- close_lookup(instance->lookup); -- instance->lookup = NULL; -- } -- instance = instance->next; -- } -- -- if (map->lookup) { -- close_lookup(map->lookup); -- map->lookup = NULL; -- } -+ lookup_close_lookup_instances(map); - map = map->next; - } - return; -@@ -925,6 +933,7 @@ int lookup_prune_cache(struct autofs_point *ap, time_t age) - - map = entry->maps; - while (map) { -+ /* Is the map stale */ - if (!map->stale) { - map = map->next; - continue; -@@ -956,7 +965,7 @@ int lookup_prune_cache(struct autofs_point *ap, time_t age) - - if (is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) { - debug(ap->logopt, -- "prune posponed, %s is mounted", path); -+ "prune check posponed, %s mounted", path); - free(key); - free(path); - continue; -diff --git a/daemon/state.c b/daemon/state.c -index 2fa78aa..6c373c8 100644 ---- a/daemon/state.c -+++ b/daemon/state.c -@@ -378,7 +378,7 @@ static void *do_readmap(void *arg) - - pthread_cleanup_push(do_readmap_cleanup, ra); - -- status = lookup_nss_read_map(ap, now); -+ status = lookup_nss_read_map(ap, NULL, now); - if (!status) - pthread_exit(NULL); - -diff --git a/include/automount.h b/include/automount.h -index 01e5301..85e6e9c 100644 ---- a/include/automount.h -+++ b/include/automount.h -@@ -141,6 +141,7 @@ struct mapent { - pthread_mutex_t multi_mutex; - struct list_head multi_list; - struct mapent_cache *mc; -+ struct map_source *source; - /* Need to know owner if we're a multi-mount */ - struct mapent *multi; - /* Parent nesting point within multi-mount */ -@@ -175,10 +176,10 @@ struct mapent *cache_lookup(struct mapent_cache *mc, const char *key); - struct mapent *cache_lookup_distinct(struct mapent_cache *mc, const char *key); - struct mapent *cache_lookup_offset(const char *prefix, const char *offset, int start, struct list_head *head); - struct mapent *cache_partial_match(struct mapent_cache *mc, const char *prefix); --int cache_add(struct mapent_cache *mc, const char *key, const char *mapent, time_t age); -+int cache_add(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age); - int cache_add_offset(struct mapent_cache *mc, const char *mkey, const char *key, const char *mapent, time_t age); - int cache_set_parents(struct mapent *mm); --int cache_update(struct mapent_cache *mc, const char *key, const char *mapent, time_t age); -+int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age); - int cache_delete(struct mapent_cache *mc, const char *key); - void cache_multi_lock(struct mapent *me); - void cache_multi_unlock(struct mapent *me); -@@ -221,11 +222,11 @@ int rmdir_path(struct autofs_point *ap, const char *path, dev_t dev); - #define PARSE_MAX_BUF KEY_MAX_LEN + MAPENT_MAX_LEN + 2 - - int lookup_nss_read_master(struct master *master, time_t age); --int lookup_nss_read_map(struct autofs_point *ap, time_t age); -+int lookup_nss_read_map(struct autofs_point *ap, struct map_source *source, time_t age); - int lookup_enumerate(struct autofs_point *ap, - int (*fn)(struct autofs_point *,struct mapent *, int), time_t now); - int lookup_ghost(struct autofs_point *ap); --int lookup_nss_mount(struct autofs_point *ap, const char *name, int name_len); -+int lookup_nss_mount(struct autofs_point *ap, struct map_source *source, const char *name, int name_len); - void lookup_close_lookup(struct autofs_point *ap); - int lookup_prune_cache(struct autofs_point *ap, time_t age); - struct mapent *lookup_source_valid_mapent(struct autofs_point *ap, const char *key, unsigned int type); -diff --git a/include/master.h b/include/master.h -index 96dfbd2..8470bb1 100644 ---- a/include/master.h -+++ b/include/master.h -@@ -85,7 +85,8 @@ void master_free_map_source(struct map_source *, unsigned int); - struct map_source * - master_find_source_instance(struct map_source *, const char *, const char *, int, const char **); - struct map_source * --master_add_source_instance(struct map_source *, const char *, const char *, time_t); -+master_add_source_instance(struct map_source *, const char *, const char *, time_t, int, const char **); -+void send_map_update_request(struct autofs_point *); - void master_source_writelock(struct master_mapent *); - void master_source_readlock(struct master_mapent *); - void master_source_unlock(struct master_mapent *); -diff --git a/lib/cache.c b/lib/cache.c -index d27dea9..06bb461 100644 ---- a/lib/cache.c -+++ b/lib/cache.c -@@ -509,7 +509,7 @@ struct mapent *cache_partial_match(struct mapent_cache *mc, const char *prefix) - } - - /* cache must be write locked by caller */ --int cache_add(struct mapent_cache *mc, const char *key, const char *mapent, time_t age) -+int cache_add(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age) - { - struct mapent *me, *existing = NULL; - char *pkey, *pent; -@@ -541,6 +541,7 @@ int cache_add(struct mapent_cache *mc, const char *key, const char *mapent, time - me->age = age; - me->status = 0; - me->mc = mc; -+ me->source = ms; - INIT_LIST_HEAD(&me->ino_index); - INIT_LIST_HEAD(&me->multi_list); - me->multi = NULL; -@@ -618,7 +619,7 @@ int cache_add_offset(struct mapent_cache *mc, const char *mkey, const char *key, - if (me && me != owner) - return CHE_DUPLICATE; - -- ret = cache_add(mc, key, mapent, age); -+ ret = cache_add(mc, owner->source, key, mapent, age); - if (ret == CHE_FAIL) { - warn(LOGOPT_ANY, "failed to add key %s to cache", key); - return CHE_FAIL; -@@ -686,7 +687,7 @@ int cache_set_parents(struct mapent *mm) - } - - /* cache must be write locked by caller */ --int cache_update(struct mapent_cache *mc, const char *key, const char *mapent, time_t age) -+int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age) - { - struct mapent *me = NULL; - char *pent; -@@ -694,7 +695,7 @@ int cache_update(struct mapent_cache *mc, const char *key, const char *mapent, t - - me = cache_lookup(mc, key); - if (!me || (*me->key == '*' && *key != '*')) { -- ret = cache_add(mc, key, mapent, age); -+ ret = cache_add(mc, ms, key, mapent, age); - if (!ret) { - debug(LOGOPT_NONE, "failed for %s", key); - return CHE_FAIL; -@@ -705,9 +706,11 @@ int cache_update(struct mapent_cache *mc, const char *key, const char *mapent, t - if (me->age == age) - return CHE_OK; - -- if (!mapent) -+ if (!mapent) { -+ if (me->mapent) -+ free(me->mapent); - me->mapent = NULL; -- else if (!me->mapent || strcmp(me->mapent, mapent) != 0) { -+ } else if (!me->mapent || strcmp(me->mapent, mapent) != 0) { - pent = malloc(strlen(mapent) + 1); - if (pent == NULL) - return CHE_FAIL; -diff --git a/lib/master.c b/lib/master.c -index 0066f8b..4d31959 100644 ---- a/lib/master.c -+++ b/lib/master.c -@@ -292,10 +292,8 @@ struct map_source *master_find_map_source(struct master_mapent *entry, - return source; - } - --void master_free_map_source(struct map_source *source, unsigned int free_cache) -+static void __master_free_map_source(struct map_source *source, unsigned int free_cache) - { -- int status; -- - if (source->type) - free(source->type); - if (source->format) -@@ -318,20 +316,12 @@ void master_free_map_source(struct map_source *source, unsigned int free_cache) - if (source->instance) { - struct map_source *instance, *next; - -- status = pthread_mutex_lock(&instance_mutex); -- if (status) -- fatal(status); -- - instance = source->instance; - while (instance) { - next = instance->next; -- master_free_map_source(instance, 0); -+ __master_free_map_source(instance, 0); - instance = next; - } -- -- status = pthread_mutex_unlock(&instance_mutex); -- if (status) -- fatal(status); - } - - free(source); -@@ -339,6 +329,21 @@ void master_free_map_source(struct map_source *source, unsigned int free_cache) - return; - } - -+void master_free_map_source(struct map_source *source, unsigned int free_cache) -+{ -+ int status; -+ -+ status = pthread_mutex_lock(&instance_mutex); -+ if (status) -+ fatal(status); -+ -+ __master_free_map_source(source, free_cache); -+ -+ status = pthread_mutex_unlock(&instance_mutex); -+ if (status) -+ fatal(status); -+} -+ - struct map_source *master_find_source_instance(struct map_source *source, const char *type, const char *format, int argc, const char **argv) - { - struct map_source *map; -@@ -378,19 +383,15 @@ next: - } - - struct map_source * --master_add_source_instance(struct map_source *source, const char *type, const char *format, time_t age) -+master_add_source_instance(struct map_source *source, const char *type, const char *format, time_t age, int argc, const char **argv) - { - struct map_source *instance; - struct map_source *new; - char *ntype, *nformat; -- const char **tmpargv, *name; -+ const char **tmpargv; - int status; - -- if (!type) -- return NULL; -- -- instance = master_find_source_instance(source, -- type, format, source->argc, source->argv); -+ instance = master_find_source_instance(source, type, format, argc, argv); - if (instance) - return instance; - -@@ -399,12 +400,14 @@ master_add_source_instance(struct map_source *source, const char *type, const ch - return NULL; - memset(new, 0, sizeof(struct map_source)); - -- ntype = strdup(type); -- if (!ntype) { -- master_free_map_source(new, 0); -- return NULL; -+ if (type) { -+ ntype = strdup(type); -+ if (!ntype) { -+ master_free_map_source(new, 0); -+ return NULL; -+ } -+ new->type = ntype; - } -- new->type = ntype; - - if (format) { - nformat = strdup(format); -@@ -418,17 +421,16 @@ master_add_source_instance(struct map_source *source, const char *type, const ch - new->age = age; - new->master_line = 0; - new->mc = source->mc; -+ new->stale = 1; - -- tmpargv = copy_argv(source->argc, source->argv); -+ tmpargv = copy_argv(argc, argv); - if (!tmpargv) { - master_free_map_source(new, 0); - return NULL; - } -- new->argc = source->argc; -+ new->argc = argc; - new->argv = tmpargv; - -- name = new->argv[0]; -- - status = pthread_mutex_lock(&instance_mutex); - if (status) - fatal(status); -@@ -451,6 +453,71 @@ master_add_source_instance(struct map_source *source, const char *type, const ch - return new; - } - -+static void check_stale_instances(struct map_source *source) -+{ -+ struct map_source *map; -+ -+ if (!source) -+ return; -+ -+ map = source->instance; -+ while (map) { -+ if (map->stale) { -+ source->stale = 1; -+ break; -+ } -+ check_stale_instances(map->instance); -+ map = map->next; -+ } -+ -+ return; -+} -+ -+void send_map_update_request(struct autofs_point *ap) -+{ -+ struct map_source *map; -+ int status, need_update = 0; -+ -+ if (!ap->ghost) -+ return; -+ -+ status = pthread_mutex_lock(&instance_mutex); -+ if (status) -+ fatal(status); -+ -+ map = ap->entry->maps; -+ while (map) { -+ check_stale_instances(map); -+ map = map->next; -+ } -+ -+ map = ap->entry->maps; -+ while (map) { -+ if (map->stale) { -+ need_update = 1; -+ break; -+ } -+ map = map->next; -+ } -+ -+ status = pthread_mutex_unlock(&instance_mutex); -+ if (status) -+ fatal(status); -+ -+ if (!need_update) -+ return; -+ -+ status = pthread_mutex_lock(&ap->state_mutex); -+ if (status) -+ fatal(status); -+ nextstate(ap->state_pipe[1], ST_READMAP); -+ status = pthread_mutex_unlock(&ap->state_mutex); -+ if (status) -+ fatal(status); -+ -+ return; -+} -+ - void master_source_writelock(struct master_mapent *entry) - { - int status; -diff --git a/lib/master_parse.y b/lib/master_parse.y -index e4c9f7d..7e98a4e 100644 ---- a/lib/master_parse.y -+++ b/lib/master_parse.y -@@ -531,7 +531,7 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne - /* Add null map entries to the null map cache */ - if (type && !strcmp(type, "null")) { - cache_writelock(nc); -- cache_update(nc, path, NULL, lineno); -+ cache_update(nc, NULL, path, NULL, lineno); - cache_unlock(nc); - local_free_vars(); - return 1; -diff --git a/modules/lookup_file.c b/modules/lookup_file.c -index 4a5674e..cc1964f 100644 ---- a/modules/lookup_file.c -+++ b/modules/lookup_file.c -@@ -547,45 +547,20 @@ static int check_self_include(const char *key, struct lookup_context *ctxt) - return 0; - } - --static struct autofs_point * -+static struct map_source * - prepare_plus_include(struct autofs_point *ap, time_t age, char *key, unsigned int inc) - { -- struct master *master; -- struct master_mapent *entry; - struct map_source *current; - struct map_source *source; -- struct autofs_point *iap; - char *type, *map, *fmt; - const char *argv[2]; -- int ret, argc; -- unsigned int timeout = ap->exp_timeout; -- unsigned int logopt = ap->logopt; -- unsigned int ghost = ap->ghost; -+ int argc; - char *buf, *tmp; - - current = ap->entry->current; - ap->entry->current = NULL; - master_source_current_signal(ap->entry); - -- master = ap->entry->master; -- -- entry = master_new_mapent(master, ap->path, ap->entry->age); -- if (!entry) { -- error(ap->logopt, MODPREFIX "malloc failed for entry"); -- return NULL; -- } -- -- ret = master_add_autofs_point(entry, timeout, logopt, ghost, 0); -- if (!ret) { -- master_free_mapent(entry); -- error(ap->logopt, -- MODPREFIX "failed to add autofs_point to entry"); -- return NULL; -- } -- iap = entry->ap; -- iap->kpipefd = ap->kpipefd; -- set_mnt_logging(iap); -- - /* - * TODO: - * Initially just consider the passed in key to be a simple map -@@ -598,7 +573,6 @@ prepare_plus_include(struct autofs_point *ap, time_t age, char *key, unsigned in - /* skip plus */ - buf = strdup(key + 1); - if (!buf) { -- master_free_mapent(entry); - error(ap->logopt, MODPREFIX "failed to strdup key"); - return NULL; - } -@@ -629,21 +603,23 @@ prepare_plus_include(struct autofs_point *ap, time_t age, char *key, unsigned in - argv[0] = map; - argv[1] = NULL; - -- source = master_add_map_source(entry, type, fmt, age, argc, argv); -+ source = master_find_source_instance(current, type, fmt, argc, argv); - if (!source) { -- master_free_mapent(entry); -- free(buf); -- error(ap->logopt, "failed to creat map_source"); -- return NULL; -+ source = master_add_source_instance(current, type, fmt, age, argc, argv); -+ if (!source) { -+ free(buf); -+ error(ap->logopt, "failed to add included map instance"); -+ return NULL; -+ } - } -- source->mc = current->mc; -+ - source->depth = current->depth + 1; - if (inc) - source->recurse = 1; - - free(buf); - -- return iap; -+ return source; - } - - int lookup_read_map(struct autofs_point *ap, time_t age, void *context) -@@ -715,7 +691,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) - * included map. - */ - if (*key == '+') { -- struct autofs_point *iap; -+ struct map_source *inc_source; - unsigned int inc; - int status; - -@@ -726,21 +702,18 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) - master_source_current_wait(ap->entry); - ap->entry->current = source; - -- iap = prepare_plus_include(ap, age, key, inc); -- if (!iap) { -+ inc_source = prepare_plus_include(ap, age, key, inc); -+ if (!inc_source) { - debug(ap->logopt, - "failed to select included map %s", key); - continue; - } - - /* Gim'ee some o' that 16k stack baby !! */ -- status = lookup_nss_read_map(iap, age); -+ status = lookup_nss_read_map(ap, inc_source, age); - if (!status) - warn(ap->logopt, - "failed to read included map %s", key); -- -- master_free_mapent_sources(iap->entry, 0); -- master_free_mapent(iap->entry); - } else { - char *s_key; - -@@ -749,7 +722,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) - continue; - - cache_writelock(mc); -- cache_update(mc, s_key, mapent, age); -+ cache_update(mc, source, s_key, mapent, age); - cache_unlock(mc); - - free(s_key); -@@ -815,7 +788,7 @@ static int lookup_one(struct autofs_point *ap, - * included map. - */ - if (*mkey == '+') { -- struct autofs_point *iap; -+ struct map_source *inc_source; - unsigned int inc; - int status; - -@@ -827,8 +800,8 @@ static int lookup_one(struct autofs_point *ap, - master_source_current_wait(ap->entry); - ap->entry->current = source; - -- iap = prepare_plus_include(ap, age, mkey, inc); -- if (!iap) { -+ inc_source = prepare_plus_include(ap, age, mkey, inc); -+ if (!inc_source) { - debug(ap->logopt, - MODPREFIX - "failed to select included map %s", -@@ -837,11 +810,7 @@ static int lookup_one(struct autofs_point *ap, - } - - /* Gim'ee some o' that 16k stack baby !! */ -- status = lookup_nss_mount(iap, key, key_len); -- -- master_free_mapent_sources(iap->entry, 0); -- master_free_mapent(iap->entry); -- -+ status = lookup_nss_mount(ap, inc_source, key, key_len); - if (status) { - fclose(f); - return CHE_COMPLETED; -@@ -868,7 +837,7 @@ static int lookup_one(struct autofs_point *ap, - free(s_key); - - cache_writelock(mc); -- ret = cache_update(mc, key, mapent, age); -+ ret = cache_update(mc, source, key, mapent, age); - cache_unlock(mc); - - fclose(f); -@@ -928,7 +897,7 @@ static int lookup_wild(struct autofs_point *ap, struct lookup_context *ctxt) - continue; - - cache_writelock(mc); -- ret = cache_update(mc, "*", mapent, age); -+ ret = cache_update(mc, source, "*", mapent, age); - cache_unlock(mc); - - fclose(f); -@@ -952,7 +921,6 @@ static int check_map_indirect(struct autofs_point *ap, - struct map_source *source; - struct mapent_cache *mc; - struct mapent *exists; -- int need_map = 0; - int ret = CHE_OK; - - source = ap->entry->current; -@@ -961,12 +929,6 @@ static int check_map_indirect(struct autofs_point *ap, - - mc = source->mc; - -- cache_readlock(mc); -- exists = cache_lookup_distinct(mc, key); -- if (exists && exists->mc != mc) -- exists = NULL; -- cache_unlock(mc); -- - master_source_current_wait(ap->entry); - ap->entry->current = source; - -@@ -977,49 +939,53 @@ static int check_map_indirect(struct autofs_point *ap, - if (ret == CHE_FAIL) - return NSS_STATUS_NOTFOUND; - -- if ((ret & CHE_UPDATED) || -- (exists && (ret & CHE_MISSING))) -- need_map = 1; -+ if (ret & CHE_UPDATED) -+ source->stale = 1; -+ -+ pthread_cleanup_push(cache_lock_cleanup, mc); -+ cache_writelock(mc); -+ exists = cache_lookup_distinct(mc, key); -+ /* Not found in the map but found in the cache */ -+ if (exists && exists->source == source && ret & CHE_MISSING) { -+ if (exists->mapent) { -+ free(exists->mapent); -+ exists->mapent = NULL; -+ exists->status = 0; -+ source->stale = 1; -+ } -+ } -+ pthread_cleanup_pop(1); - - if (ret == CHE_MISSING) { -+ struct mapent *we; - int wild = CHE_MISSING; - - master_source_current_wait(ap->entry); - ap->entry->current = source; - - wild = lookup_wild(ap, ctxt); -- if (wild == CHE_COMPLETED || CHE_UPDATED || CHE_OK) -- return NSS_STATUS_SUCCESS; --/* -- if (wild == CHE_FAIL) -- return NSS_STATUS_NOTFOUND; --*/ -+ /* -+ * Check for map change and update as needed for -+ * following cache lookup. -+ */ - pthread_cleanup_push(cache_lock_cleanup, mc); - cache_writelock(mc); -- if (wild == CHE_MISSING) -- cache_delete(mc, "*"); -- -- if (cache_delete(mc, key) && wild & (CHE_MISSING | CHE_FAIL)) -- rmdir_path(ap, key, ap->dev); -+ we = cache_lookup_distinct(mc, "*"); -+ if (we) { -+ /* Wildcard entry existed and is now gone */ -+ if (we->source == source && (wild & CHE_MISSING)) { -+ cache_delete(mc, "*"); -+ source->stale = 1; -+ } -+ } else { -+ /* Wildcard not in map but now is */ -+ if (wild & (CHE_OK || CHE_UPDATED)) -+ source->stale = 1; -+ } - pthread_cleanup_pop(1); -- } - -- /* Have parent update its map ? */ -- /* TODO: update specific map */ -- if (ap->ghost && need_map) { -- int status; -- -- source->stale = 1; -- -- status = pthread_mutex_lock(&ap->state_mutex); -- if (status) -- fatal(status); -- -- nextstate(ap->state_pipe[1], ST_READMAP); -- -- status = pthread_mutex_unlock(&ap->state_mutex); -- if (status) -- fatal(status); -+ if (wild & (CHE_OK || CHE_UPDATED)) -+ return NSS_STATUS_SUCCESS; - } - - if (ret == CHE_MISSING) -@@ -1109,7 +1075,10 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - - cache_readlock(mc); - me = cache_lookup(mc, key); -- if (me && me->mapent && *me->mapent) { -+ /* Stale mapent => check for wildcard */ -+ if (me && !me->mapent) -+ me = cache_lookup_distinct(mc, "*"); -+ if (me && (me->source == source || *me->key == '/')) { - pthread_cleanup_push(cache_lock_cleanup, mc); - mapent_len = strlen(me->mapent); - mapent = alloca(mapent_len + 1); -@@ -1132,7 +1101,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - cache_writelock(mc); - me = cache_lookup_distinct(mc, key); - if (!me) -- rv = cache_update(mc, key, NULL, now); -+ rv = cache_update(mc, source, key, NULL, now); - if (rv != CHE_FAIL) { - me = cache_lookup_distinct(mc, key); - me->status = now + NEGATIVE_TIMEOUT; -diff --git a/modules/lookup_hesiod.c b/modules/lookup_hesiod.c -index 562c51b..f30e9b2 100644 ---- a/modules/lookup_hesiod.c -+++ b/modules/lookup_hesiod.c -@@ -154,7 +154,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - } - - cache_writelock(mc); -- rv = cache_update(mc, name, best_record, time(NULL)); -+ rv = cache_update(mc, source, name, best_record, time(NULL)); - cache_unlock(mc); - if (rv == CHE_FAIL) - return NSS_STATUS_UNAVAIL; -diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c -index 7eb5060..f6a65ae 100644 ---- a/modules/lookup_hosts.c -+++ b/modules/lookup_hosts.c -@@ -103,7 +103,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) - while ((host = gethostent()) != NULL) { - pthread_cleanup_push(cache_lock_cleanup, mc); - cache_writelock(mc); -- cache_update(mc, host->h_name, NULL, age); -+ cache_update(mc, source, host->h_name, NULL, age); - cache_unlock(mc); - pthread_cleanup_pop(0); - } -@@ -257,7 +257,7 @@ done: - debug(ap->logopt, MODPREFIX "%s -> %s", name, mapent); - - cache_writelock(mc); -- cache_update(mc, name, mapent, now); -+ cache_update(mc, source, name, mapent, now); - cache_unlock(mc); - - debug(LOGOPT_ANY, "source wait"); -diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c -index 3a1d36b..29ba0c8 100644 ---- a/modules/lookup_ldap.c -+++ b/modules/lookup_ldap.c -@@ -1251,7 +1251,7 @@ static int read_one_map(struct autofs_point *ap, - goto next; - - cache_writelock(mc); -- cache_update(mc, s_key, mapent, age); -+ cache_update(mc, source, s_key, mapent, age); - cache_unlock(mc); - - free(s_key); -@@ -1313,6 +1313,7 @@ static int lookup_one(struct autofs_point *ap, - char *attrs[3]; - int scope = LDAP_SCOPE_SUBTREE; - LDAP *ldap; -+ struct mapent *we; - unsigned int wild = 0; - int ret = CHE_MISSING; - -@@ -1466,7 +1467,7 @@ static int lookup_one(struct autofs_point *ap, - goto next; - wild = 1; - cache_writelock(mc); -- cache_update(mc, "*", mapent, age); -+ cache_update(mc, source, "*", mapent, age); - cache_unlock(mc); - goto next; - } -@@ -1476,7 +1477,7 @@ static int lookup_one(struct autofs_point *ap, - goto next; - - cache_writelock(mc); -- ret = cache_update(mc, s_key, mapent, age); -+ ret = cache_update(mc, source, s_key, mapent, age); - cache_unlock(mc); - - free(s_key); -@@ -1493,10 +1494,34 @@ next: - ldap_msgfree(result); - unbind_ldap_connection(ldap, ctxt); - -+ /* Failed to find wild entry, update cache if needed */ -+ pthread_cleanup_push(cache_lock_cleanup, mc); - cache_writelock(mc); -- if (!wild && cache_lookup(mc, "*")) -- cache_delete(mc, "*"); -- cache_unlock(mc); -+ we = cache_lookup_distinct(mc, "*"); -+ if (we) { -+ /* Wildcard entry existed and is now gone */ -+ if (we->source == source && !wild) { -+ cache_delete(mc, "*"); -+ source->stale = 1; -+ } -+ } else { -+ /* Wildcard not in map but now is */ -+ if (wild) -+ source->stale = 1; -+ } -+ /* Not found in the map but found in the cache */ -+ if (ret == CHE_MISSING) { -+ struct mapent *exists = cache_lookup_distinct(mc, qKey); -+ if (exists && exists->source == source) { -+ if (exists->mapent) { -+ free(exists->mapent); -+ exists->mapent = NULL; -+ source->stale = 1; -+ exists->status = 0; -+ } -+ } -+ } -+ pthread_cleanup_pop(1); - - return ret; - } -@@ -1507,10 +1532,10 @@ static int check_map_indirect(struct autofs_point *ap, - { - struct map_source *source; - struct mapent_cache *mc; -- struct mapent *me, *exists; -+ struct mapent *me; - time_t now = time(NULL); - time_t t_last_read; -- int ret, cur_state, need_map = 0; -+ int ret, cur_state; - - source = ap->entry->current; - ap->entry->current = NULL; -@@ -1518,12 +1543,6 @@ static int check_map_indirect(struct autofs_point *ap, - - mc = source->mc; - -- cache_readlock(mc); -- exists = cache_lookup_distinct(mc, key); -- if (exists && exists->mc != mc) -- exists = NULL; -- cache_unlock(mc); -- - master_source_current_wait(ap->entry); - ap->entry->current = source; - -@@ -1535,44 +1554,28 @@ static int check_map_indirect(struct autofs_point *ap, - } - pthread_setcancelstate(cur_state, NULL); - -+ /* -+ * Check for map change and update as needed for -+ * following cache lookup. -+ */ - cache_readlock(mc); -+ t_last_read = ap->exp_runfreq + 1; - me = cache_lookup_first(mc); -- t_last_read = me ? now - me->age : ap->exp_runfreq + 1; -- cache_unlock(mc); -- -- if (t_last_read > ap->exp_runfreq) { -- if ((ret & CHE_UPDATED) || -- (exists && (ret & CHE_MISSING))) -- need_map = 1; -- } -- -- if (ret == CHE_MISSING && exists) { -- pthread_cleanup_push(cache_lock_cleanup, mc); -- cache_writelock(mc); -- if (cache_delete(mc, key)) -- rmdir_path(ap, key, ap->dev); -- pthread_cleanup_pop(1); -+ while (me) { -+ if (me->source == source) { -+ t_last_read = now - me->age; -+ break; -+ } -+ me = cache_lookup_next(mc, me); - } -+ cache_unlock(mc); - -- /* Have parent update its map */ -- if (ap->ghost && need_map) { -- int status; -- -+ if (t_last_read > ap->exp_runfreq && ret & CHE_UPDATED) - source->stale = 1; - -- status = pthread_mutex_lock(&ap->state_mutex); -- if (status) -- fatal(status); -- -- nextstate(ap->state_pipe[1], ST_READMAP); -- -- status = pthread_mutex_unlock(&ap->state_mutex); -- if (status) -- fatal(status); -- } -- - cache_readlock(mc); -- if (ret == CHE_MISSING && !cache_lookup(mc, "*")) { -+ me = cache_lookup_distinct(mc, "*"); -+ if (ret == CHE_MISSING && (!me || me->source != source)) { - cache_unlock(mc); - return NSS_STATUS_NOTFOUND; - } -@@ -1648,7 +1651,10 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - - cache_readlock(mc); - me = cache_lookup(mc, key); -- if (me && me->mapent && *me->mapent) { -+ /* Stale mapent => check for wildcard */ -+ if (me && !me->mapent) -+ me = cache_lookup_distinct(mc, "*"); -+ if (me && (me->source == source || *me->key == '/')) { - mapent_len = strlen(me->mapent); - mapent = alloca(mapent_len + 1); - strcpy(mapent, me->mapent); -@@ -1670,7 +1676,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - cache_writelock(mc); - me = cache_lookup_distinct(mc, key); - if (!me) -- rv = cache_update(mc, key, NULL, now); -+ rv = cache_update(mc, source, key, NULL, now); - if (rv != CHE_FAIL) { - me = cache_lookup_distinct(mc, key); - me->status = now + NEGATIVE_TIMEOUT; -diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c -index 683ec6c..eae8702 100644 ---- a/modules/lookup_nisplus.c -+++ b/modules/lookup_nisplus.c -@@ -234,7 +234,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) - mapent = ENTRY_VAL(this, 1); - - cache_writelock(mc); -- cache_update(mc, s_key, mapent, age); -+ cache_update(mc, source, s_key, mapent, age); - cache_unlock(mc); - - free(s_key); -@@ -296,7 +296,7 @@ static int lookup_one(struct autofs_point *ap, - this = NIS_RES_OBJECT(result); - mapent = ENTRY_VAL(this, 1); - cache_writelock(mc); -- ret = cache_update(mc, key, mapent, age); -+ ret = cache_update(mc, source, key, mapent, age); - cache_unlock(mc); - - nis_freeresult(result); -@@ -348,7 +348,7 @@ static int lookup_wild(struct autofs_point *ap, struct lookup_context *ctxt) - this = NIS_RES_OBJECT(result); - mapent = ENTRY_VAL(this, 1); - cache_writelock(mc); -- ret = cache_update(mc, "*", mapent, age); -+ ret = cache_update(mc, source, "*", mapent, age); - cache_unlock(mc); - - nis_freeresult(result); -@@ -366,7 +366,6 @@ static int check_map_indirect(struct autofs_point *ap, - struct mapent *me, *exists; - time_t now = time(NULL); - time_t t_last_read; -- int need_map = 0; - int ret = 0; - - source = ap->entry->current; -@@ -375,12 +374,6 @@ static int check_map_indirect(struct autofs_point *ap, - - mc = source->mc; - -- cache_readlock(mc); -- exists = cache_lookup_distinct(mc, key); -- if (exists && exists->mc != mc) -- exists = NULL; -- cache_unlock(mc); -- - master_source_current_wait(ap->entry); - ap->entry->current = source; - -@@ -396,51 +389,62 @@ static int check_map_indirect(struct autofs_point *ap, - return NSS_STATUS_UNAVAIL; - } - -- cache_readlock(mc); -+ pthread_cleanup_push(cache_lock_cleanup, mc); -+ cache_writelock(mc); -+ t_last_read = ap->exp_runfreq + 1; - me = cache_lookup_first(mc); -- t_last_read = me ? now - me->age : ap->exp_runfreq + 1; -- cache_unlock(mc); -- -- if (t_last_read > ap->exp_runfreq) -- if ((ret & CHE_UPDATED) || -- (exists && (ret & CHE_MISSING))) -- need_map = 1; -+ while (me) { -+ if (me->source == source) { -+ t_last_read = now - me->age; -+ break; -+ } -+ me = cache_lookup_next(mc, me); -+ } -+ exists = cache_lookup_distinct(mc, key); -+ /* Not found in the map but found in the cache */ -+ if (exists && exists->source == source && ret & CHE_MISSING) { -+ if (exists->mapent) { -+ free(exists->mapent); -+ exists->mapent = NULL; -+ source->stale = 1; -+ exists->status = 0; -+ } -+ } -+ pthread_cleanup_pop(1); -+ -+ if (t_last_read > ap->exp_runfreq && ret & CHE_UPDATED) -+ source->stale = 1; - - if (ret == CHE_MISSING) { - int wild = CHE_MISSING; -+ struct mapent *we; - - master_source_current_wait(ap->entry); - ap->entry->current = source; - - wild = lookup_wild(ap, ctxt); -- if (wild == CHE_UPDATED || CHE_OK) -- return NSS_STATUS_SUCCESS; -- -+ /* -+ * Check for map change and update as needed for -+ * following cache lookup. -+ */ - pthread_cleanup_push(cache_lock_cleanup, mc); - cache_writelock(mc); -- if (wild == CHE_MISSING) -- cache_delete(mc, "*"); -- -- if (cache_delete(mc, key) && wild & (CHE_MISSING | CHE_FAIL)) -- rmdir_path(ap, key, ap->dev); -+ we = cache_lookup_distinct(mc, "*"); -+ if (we) { -+ /* Wildcard entry existed and is now gone */ -+ if (we->source == source && wild & CHE_MISSING) { -+ cache_delete(mc, "*"); -+ source->stale = 1; -+ } -+ } else { -+ /* Wildcard not in map but now is */ -+ if (wild & (CHE_OK || CHE_UPDATED)) -+ source->stale = 1; -+ } - pthread_cleanup_pop(1); -- } -- -- /* Have parent update its map */ -- if (ap->ghost && need_map) { -- int status; -- -- source->stale = 1; - -- status = pthread_mutex_lock(&ap->state_mutex); -- if (status) -- fatal(status); -- -- nextstate(ap->state_pipe[1], ST_READMAP); -- -- status = pthread_mutex_unlock(&ap->state_mutex); -- if (status) -- fatal(status); -+ if (wild & (CHE_UPDATED || CHE_OK)) -+ return NSS_STATUS_SUCCESS; - } - - if (ret == CHE_MISSING) -@@ -514,7 +518,10 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - - cache_readlock(mc); - me = cache_lookup(mc, key); -- if (me && me->mapent && *me->mapent) { -+ /* Stale mapent => check for wildcard */ -+ if (me && !me->mapent) -+ me = cache_lookup_distinct(mc, "*"); -+ if (me && (me->source == source || *me->key == '/')) { - mapent_len = strlen(me->mapent); - mapent = alloca(mapent_len + 1); - strcpy(mapent, me->mapent); -@@ -535,7 +542,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - cache_writelock(mc); - me = cache_lookup_distinct(mc, key); - if (!me) -- rv = cache_update(mc, key, NULL, now); -+ rv = cache_update(mc, source, key, NULL, now); - if (rv != CHE_FAIL) { - me = cache_lookup_distinct(mc, key); - me->status = time(NULL) + NEGATIVE_TIMEOUT; -diff --git a/modules/lookup_program.c b/modules/lookup_program.c -index a22d400..1cdbf80 100644 ---- a/modules/lookup_program.c -+++ b/modules/lookup_program.c -@@ -339,7 +339,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - } - - cache_writelock(mc); -- ret = cache_update(mc, name, mapent, time(NULL)); -+ ret = cache_update(mc, source, name, mapent, time(NULL)); - cache_unlock(mc); - if (ret == CHE_FAIL) - return NSS_STATUS_UNAVAIL; -diff --git a/modules/lookup_userhome.c b/modules/lookup_userhome.c -index 00a01ea..efcab0b 100644 ---- a/modules/lookup_userhome.c -+++ b/modules/lookup_userhome.c -@@ -78,7 +78,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - } - - cache_writelock(mc); -- ret = cache_update(mc, name, NULL, time(NULL)); -+ ret = cache_update(mc, source, name, NULL, time(NULL)); - cache_unlock(mc); - - if (ret == CHE_FAIL) { -diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c -index 5f03b2f..5a154cd 100644 ---- a/modules/lookup_yp.c -+++ b/modules/lookup_yp.c -@@ -272,7 +272,7 @@ int yp_all_callback(int status, char *ypkey, int ypkeylen, - *(mapent + vallen) = '\0'; - - cache_writelock(mc); -- ret = cache_update(mc, key, mapent, age); -+ ret = cache_update(mc, source, key, mapent, age); - cache_unlock(mc); - - free(key); -@@ -389,7 +389,7 @@ static int lookup_one(struct autofs_point *ap, - } - - cache_writelock(mc); -- ret = cache_update(mc, key, mapent, age); -+ ret = cache_update(mc, source, key, mapent, age); - cache_unlock(mc); - free(mapent); - -@@ -441,7 +441,7 @@ static int lookup_wild(struct autofs_point *ap, struct lookup_context *ctxt) - } - - cache_writelock(mc); -- ret = cache_update(mc, "*", mapent, age); -+ ret = cache_update(mc, source, "*", mapent, age); - cache_unlock(mc); - free(mapent); - -@@ -456,7 +456,6 @@ static int check_map_indirect(struct autofs_point *ap, - struct mapent_cache *mc; - struct mapent *exists; - unsigned int map_order; -- int need_map = 0; - int ret = 0; - - source = ap->entry->current; -@@ -465,12 +464,6 @@ static int check_map_indirect(struct autofs_point *ap, - - mc = source->mc; - -- cache_readlock(mc); -- exists = cache_lookup_distinct(mc, key); -- if (exists && exists->mc != mc) -- exists = NULL; -- cache_unlock(mc); -- - master_source_current_wait(ap->entry); - ap->entry->current = source; - -@@ -490,44 +483,53 @@ static int check_map_indirect(struct autofs_point *ap, - map_order = get_map_order(ctxt->domainname, ctxt->mapname); - if (map_order > ctxt->order) { - ctxt->order = map_order; -- need_map = 1; -+ source->stale = 1; - } - -+ pthread_cleanup_push(cache_lock_cleanup, mc); -+ cache_writelock(mc); -+ exists = cache_lookup_distinct(mc, key); -+ /* Not found in the map but found in the cache */ -+ if (exists && exists->source == source && ret & CHE_MISSING) { -+ if (exists->mapent) { -+ free(exists->mapent); -+ exists->mapent = NULL; -+ source->stale = 1; -+ exists->status = 0; -+ } -+ } -+ pthread_cleanup_pop(1); -+ - if (ret == CHE_MISSING) { -+ struct mapent *we; - int wild = CHE_MISSING; - - master_source_current_wait(ap->entry); - ap->entry->current = source; - - wild = lookup_wild(ap, ctxt); -- if (wild == CHE_UPDATED || CHE_OK) -- return NSS_STATUS_SUCCESS; -- -+ /* -+ * Check for map change and update as needed for -+ * following cache lookup. -+ */ - pthread_cleanup_push(cache_lock_cleanup, mc); - cache_writelock(mc); -- if (wild == CHE_MISSING) -- cache_delete(mc, "*"); -- -- if (cache_delete(mc, key) && wild & (CHE_MISSING | CHE_FAIL)) -- rmdir_path(ap, key, ap->dev); -+ we = cache_lookup_distinct(mc, "*"); -+ if (we) { -+ /* Wildcard entry existed and is now gone */ -+ if (we->source == source && (wild & CHE_MISSING)) { -+ cache_delete(mc, "*"); -+ source->stale = 1; -+ } -+ } else { -+ /* Wildcard not in map but now is */ -+ if (wild & (CHE_OK || CHE_UPDATED)) -+ source->stale = 1; -+ } - pthread_cleanup_pop(1); -- } -- -- /* Have parent update its map if needed */ -- if (ap->ghost && need_map) { -- int status; - -- source->stale = 1; -- -- status = pthread_mutex_lock(&ap->state_mutex); -- if (status) -- fatal(status); -- -- nextstate(ap->state_pipe[1], ST_READMAP); -- -- status = pthread_mutex_unlock(&ap->state_mutex); -- if (status) -- fatal(status); -+ if (wild & (CHE_OK || CHE_UPDATED)) -+ return NSS_STATUS_SUCCESS; - } - - if (ret == CHE_MISSING) -@@ -602,7 +604,10 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - - cache_readlock(mc); - me = cache_lookup(mc, key); -- if (me && me->mapent && *me->mapent) { -+ /* Stale mapent => check for wildcard */ -+ if (me && !me->mapent) -+ me = cache_lookup_distinct(mc, "*"); -+ if (me && (me->source == source || *me->key == '/')) { - mapent_len = strlen(me->mapent); - mapent = alloca(mapent_len + 1); - strcpy(mapent, me->mapent); -@@ -623,7 +628,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * - cache_writelock(mc); - me = cache_lookup_distinct(mc, key); - if (!me) -- rv = cache_update(mc, key, NULL, now); -+ rv = cache_update(mc, source, key, NULL, now); - if (rv != CHE_FAIL) { - me = cache_lookup_distinct(mc, key); - me->status = now + NEGATIVE_TIMEOUT; -diff --git a/modules/parse_sun.c b/modules/parse_sun.c -index 93fe3de..9323e7c 100644 ---- a/modules/parse_sun.c -+++ b/modules/parse_sun.c -@@ -1080,7 +1080,7 @@ int parse_mount(struct autofs_point *ap, const char *name, - * Not in the cache, perhaps it's a program map - * or one that doesn't support enumeration - */ -- ret = cache_add(mc, name, mapent, time(NULL)); -+ ret = cache_add(mc, source, name, mapent, time(NULL)); - if (ret == CHE_FAIL) { - cache_unlock(mc); - free(options); diff --git a/autofs-5.0.1-network_match-fix.patch b/autofs-5.0.1-network_match-fix.patch deleted file mode 100644 index c61b897..0000000 --- a/autofs-5.0.1-network_match-fix.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c -index 2c5b5d5..5151a1e 100644 ---- a/lib/rpc_subs.c -+++ b/lib/rpc_subs.c -@@ -1072,18 +1072,23 @@ static char *inet_fill_net(const char *net_num, char *net) - if (strlen(net_num) > INET_ADDRSTRLEN) - return NULL; - -+ if (!isdigit(*net_num)) -+ return NULL; -+ - *net = '\0'; - strcpy(net, net_num); - - np = net; -- while (*np) { -- if (*np++ == '.') { -+ while (*np++) { -+ if (*np == '.') { -+ np++; - dots--; - if (!*np && dots) - strcat(net, "0"); -+ continue; - } - -- if (!isdigit(*np) || dots < 0) { -+ if ((*np && !isdigit(*np)) || dots < 0) { - *net = '\0'; - return NULL; - } diff --git a/autofs-5.0.1-null-domain-fix.patch b/autofs-5.0.1-null-domain-fix.patch deleted file mode 100644 index a050793..0000000 --- a/autofs-5.0.1-null-domain-fix.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c -index 5151a1e..831d456 100644 ---- a/lib/rpc_subs.c -+++ b/lib/rpc_subs.c -@@ -52,7 +52,7 @@ - /* Get numeric value of the n bits starting at position p */ - #define getbits(x, p, n) ((x >> (p + 1 - n)) & ~(~0 << n)) - --static char *ypdomain = NULL; -+static char *domain = NULL; - - inline void dump_core(void); - static pthread_mutex_t networks_mutex = PTHREAD_MUTEX_INITIALIZER; -@@ -946,8 +946,8 @@ static int name_match(const char *name, const char *pattern) - else { - ret = !memcmp(name, pattern, strlen(pattern)); - /* Name could still be a netgroup (Solaris) */ -- if (!ret && ypdomain) -- ret = innetgr(pattern, name, NULL, ypdomain); -+ if (!ret) -+ ret = innetgr(pattern, name, NULL, domain); - } - - return ret; -@@ -1228,8 +1228,8 @@ static int host_match(char *pattern) - if (gethostname(myname, MAXHOSTNAMELEN)) - return 0; - -- if (yp_get_default_domain(&ypdomain)) -- ypdomain = NULL; -+ if (yp_get_default_domain(&domain)) -+ domain = NULL; - - if (*m_pattern == '@') { - /* -@@ -1237,8 +1237,8 @@ static int host_match(char *pattern) - * spec or it's a netgroup. - */ - ret = match_network(m_pattern + 1); -- if (!ret && ypdomain) -- ret = innetgr(m_pattern + 1, myname, NULL, ypdomain); -+ if (!ret) -+ ret = innetgr(m_pattern + 1, myname, NULL, domain); - } else if (*m_pattern == '.') { - size_t m_len = strlen(m_pattern); - char *has_dot = strchr(myname, '.'); diff --git a/autofs-5.0.1-random-selection.patch b/autofs-5.0.1-random-selection.patch deleted file mode 100644 index df6825e..0000000 --- a/autofs-5.0.1-random-selection.patch +++ /dev/null @@ -1,173 +0,0 @@ ---- autofs-5.0.1/include/replicated.h.random-selection 2007-03-16 16:27:36.000000000 +0900 -+++ autofs-5.0.1/include/replicated.h 2007-03-16 16:27:54.000000000 +0900 -@@ -60,6 +60,7 @@ struct host { - struct host *next; - }; - -+void seed_random(void); - void free_host_list(struct host **); - int parse_location(struct host **, const char *); - int prune_host_list(struct host **, unsigned int, const char *); ---- autofs-5.0.1/modules/replicated.c.random-selection 2007-03-16 16:27:36.000000000 +0900 -+++ autofs-5.0.1/modules/replicated.c 2007-03-16 16:27:54.000000000 +0900 -@@ -74,6 +74,29 @@ - #define max(x, y) (x >= y ? x : y) - #define mmax(x, y, z) (max(x, y) == x ? max(x, z) : max(y, z)) - -+extern unsigned int random_selection; -+ -+void seed_random(void) -+{ -+ int fd; -+ unsigned int seed; -+ -+ fd = open("/dev/random", O_RDONLY); -+ if (fd < 0) { -+ srandom(time(NULL)); -+ return; -+ } -+ -+ if (read(fd, &seed, sizeof(seed)) != -1) -+ srandom(seed); -+ else -+ srandom(time(NULL)); -+ -+ close(fd); -+ -+ return; -+} -+ - static unsigned int get_proximity(const char *host_addr, int addr_len) - { - struct sockaddr_in *msk_addr, *if_addr; -@@ -403,7 +426,11 @@ static unsigned int get_nfs_info(struct - status = rpc_ping_proto(rpc_info); - gettimeofday(&end, &tz); - if (status) { -- taken += elapsed(start, end); -+ if (random_selection) -+ /* Random value between 0 and 1 */ -+ taken += ((float) random())/((float) RAND_MAX+1); -+ else -+ taken += elapsed(start, end);; - count++; - supported = NFS4_SUPPORTED; - } -@@ -440,7 +467,11 @@ v3_ver: - status = rpc_ping_proto(rpc_info); - gettimeofday(&end, &tz); - if (status) { -- taken += elapsed(start, end); -+ if (random_selection) -+ /* Random value between 0 and 1 */ -+ taken += ((float) random())/((float) RAND_MAX+1); -+ else -+ taken += elapsed(start, end);; - count++; - supported |= NFS3_SUPPORTED; - } -@@ -470,7 +501,11 @@ v2_ver: - status = rpc_ping_proto(rpc_info); - gettimeofday(&end, &tz); - if (status) { -- taken += elapsed(start, end); -+ if (random_selection) -+ /* Random value between 0 and 1 */ -+ taken += ((float) random())/((float) RAND_MAX+1); -+ else -+ taken += elapsed(start, end);; - count++; - supported |= NFS2_SUPPORTED; - } -@@ -610,8 +645,13 @@ static int get_supported_ver_and_cost(st - gettimeofday(&start, &tz); - status = rpc_ping_proto(&rpc_info); - gettimeofday(&end, &tz); -- if (status) -- taken = elapsed(start, end); -+ if (status) { -+ if (random_selection) -+ /* Random value between 0 and 1 */ -+ taken = ((float) random())/((float) RAND_MAX+1); -+ else -+ taken = elapsed(start, end); -+ } - } - done: - if (rpc_info.proto->p_proto == IPPROTO_UDP) { ---- autofs-5.0.1/modules/mount_nfs.c.random-selection 2007-03-16 16:27:36.000000000 +0900 -+++ autofs-5.0.1/modules/mount_nfs.c 2007-03-16 16:27:54.000000000 +0900 -@@ -51,6 +51,8 @@ int mount_init(void **context) - } else - init_ctr++; - -+ seed_random(); -+ - return !mount_bind; - } - ---- autofs-5.0.1/daemon/automount.c.random-selection 2007-03-16 16:27:36.000000000 +0900 -+++ autofs-5.0.1/daemon/automount.c 2007-03-16 16:27:54.000000000 +0900 -@@ -48,6 +48,8 @@ const char *mapdir = AUTOFS_MAP_DIR; /* - const char *confdir = AUTOFS_CONF_DIR; /* Location of autofs config file */ - - static char *pid_file = NULL; /* File in which to keep pid */ -+unsigned int random_selection; /* use random policy when selecting -+ * which multi-mount host to mount */ - static int start_pipefd[2]; - static int st_stat = 0; - static int *pst_stat = &st_stat; -@@ -1363,6 +1365,8 @@ static void usage(void) - " -d --debug log debuging info\n" - " -D --define define global macro variable\n" - /*" -f --foreground do not fork into background\n" */ -+ " -r --random-replicated-selection" -+ " use ramdom replicated server selection\n" - " -V --version print version, build config and exit\n" - , program); - } -@@ -1461,6 +1465,7 @@ int main(int argc, char *argv[]) - {"debug", 0, 0, 'd'}, - {"define", 1, 0, 'D'}, - {"foreground", 0, 0, 'f'}, -+ {"random-selection", 0, 0, 'r'}, - {"version", 0, 0, 'V'}, - {0, 0, 0, 0} - }; -@@ -1476,10 +1481,11 @@ int main(int argc, char *argv[]) - timeout = defaults_get_timeout(); - ghost = defaults_get_browse_mode(); - logging = defaults_get_logging(); -+ random_selection = 0; - foreground = 0; - - opterr = 0; -- while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fV", long_options, NULL)) != EOF) { -+ while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVr", long_options, NULL)) != EOF) { - switch (opt) { - case 'h': - usage(); -@@ -1513,6 +1519,10 @@ int main(int argc, char *argv[]) - show_build_info(); - exit(0); - -+ case 'r': -+ random_selection = 1; -+ break; -+ - case '?': - case ':': - printf("%s: Ambiguous or unknown options\n", program); ---- autofs-5.0.1/man/automount.8.in.random-selection 2007-03-16 16:27:36.000000000 +0900 -+++ autofs-5.0.1/man/automount.8.in 2007-03-16 16:27:54.000000000 +0900 -@@ -49,6 +49,10 @@ Define a global macro substitution varia - are over-ridden macro definitions of the same name specified in - mount entries. - .TP -+.I "\-r, \-\-random-replicated-selection" -+Enables the use of ramdom selection when choosing a host from a -+list of replicated servers. -+.TP - .I "\-V, \-\-version" - Display the version number, then exit. - .SH ARGUMENTS diff --git a/autofs.spec b/autofs.spec index f5c2e5a..a5a6d44 100644 --- a/autofs.spec +++ b/autofs.spec @@ -3,34 +3,13 @@ # Summary: A tool for automatically mounting and unmounting filesystems Name: autofs -Version: 5.0.1 -Release: 16 +Version: 5.0.2 +Release: 1 Epoch: 1 License: GPL Group: System Environment/Daemons URL: http://wiki.autofs.net/ Source: ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.bz2 -Patch1: autofs-5.0.1-check-user-info-return.patch -Patch2: autofs-5.0.1-hosts-simple-fail.patch -Patch3: autofs-5.0.1-export-check-network-fix-2.patch -Patch4: autofs-5.0.1-check-mtab-updated.patch -Patch5: autofs-5.0.1-file-map-allow-white-space-only-line.patch -Patch6: autofs-5.0.1-network_match-fix.patch -Patch7: autofs-5.0.1-drop-default-prefix-from-config.patch -Patch8: autofs-5.0.1-random-selection.patch -Patch9: autofs-5.0.1-bad-cast.patch -Patch10: autofs-5.0.1-fix-browse-dir-create.patch -Patch11: autofs-5.0.1-map-update-source-only.patch -Patch12: autofs-5.0.1-null-domain-fix.patch -Patch13: autofs-5.0.1-conf-append-global.patch -Patch14: autofs-5.0.1-cmd-global-options.patch -Patch15: autofs-5.0.1-localfs-label-check.patch -Patch16: autofs-5.0.1-disable-exports-check.patch -Patch17: autofs-5.0.1-cmd-global-options-fix.patch -Patch18: autofs-5.0.1-allow-dot-in-master-macro.patch -Patch19: autofs-5.0.1-correct-logic-test-wild-lookup.patch -Patch20: autofs-5.0.1-alarm-deadlock.patch -Patch21: autofs-5.0.1-add-ldaps-support.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 Conflicts: kernel < 2.6.17 @@ -72,27 +51,6 @@ inkludera nĂ€tfilsystem, CD-ROM, floppydiskar, och sĂ„ vidare. %prep %setup -q echo %{version}-%{release} > .version -%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 -%patch19 -p1 -%patch20 -p1 -%patch21 -p1 %build #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir} @@ -145,6 +103,9 @@ fi %{_libdir}/autofs/ %changelog +* Mon Jun 18 2007 Ian Kent - 5.0.2-1 +- Update to upstream release 5.0.2. + * Tue Jun 12 2007 Ian Kent - 5.0.1-16 - add ldaps support. - note: it's no longer possible to have multiple hosts in an ldap map spec. diff --git a/sources b/sources index ecacc3b..b573cdf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -f5a1d5e3611e8509f727a14391933dac autofs-5.0.1.tar.bz2 +fd56817cba70814753bc98f5fb7f23ec autofs-5.0.2.tar.bz2