diff --git a/CHANGELOG b/CHANGELOG index bd0bbf0..56b3dd6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +?/?/2006 autofs-5.0.1 rc3 +------------------------- +- fix handling of autofs specific mount options. + 1/9/2006 autofs-5.0.1 rc2 ------------------------- - code cleanup. diff --git a/lib/master.c b/lib/master.c index a411459..0ee7d38 100644 --- a/lib/master.c +++ b/lib/master.c @@ -70,10 +70,7 @@ int master_add_autofs_point(struct maste ap->readmap_thread = 0; ap->exp_timeout = timeout; ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; - if (ghost) - ap->ghost = ghost; - else - ap->ghost = defaults_get_browse_mode(); + ap->ghost = ghost; if (ap->path[1] == '-') ap->type = LKP_DIRECT; diff --git a/lib/master_parse.y b/lib/master_parse.y index 2f350f7..1a6a3a2 100644 --- a/lib/master_parse.y +++ b/lib/master_parse.y @@ -421,7 +421,7 @@ static void local_init_vars(void) verbose = 0; debug = 0; timeout = -1; - ghost = 0; + ghost = defaults_get_browse_mode(); local_argv = NULL; local_argc = 0; } diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c index c9baf57..e901f20 100644 --- a/modules/mount_autofs.c +++ b/modules/mount_autofs.c @@ -86,31 +86,57 @@ int mount_mount(struct autofs_point *ap, return 0; } + options = NULL; if (c_options) { - options = alloca(strlen(c_options) + 1); - if (!options) { + char *noptions; + const char *comma; + char *np; + int len = strlen(c_options) + 1; + + noptions = np = alloca(len); + if (!np) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); error(ap->logopt, MODPREFIX "alloca: %s", estr); return 1; } - strcpy(options, c_options); - } else { - options = NULL; + memset(np, 0, len); + + /* Grab the autofs specific options */ + for (comma = c_options; *comma != '\0';) { + const char *cp; + + while (*comma == ',') + comma++; + + cp = comma; + + while (*comma != '\0' && *comma != ',') + comma++; + + if (strncmp(cp, "nobrowse", 8) == 0) + ghost = 0; + else if (strncmp(cp, "browse", 6) == 0) + ghost = 1; + else if (strncmp(cp, "timeout=", 8) == 0) { + char *val = strchr(cp, '='); + unsigned tout; + if (val++) { + int ret = sscanf(cp, "timeout=%u", &tout); + if (ret) + timeout = tout; + } + } else { + memcpy(np, cp, comma - cp + 1); + np += comma - cp + 1; + } + } + options = noptions; } debug(ap->logopt, MODPREFIX "fullpath=%s what=%s options=%s", fullpath, what, options); - /* TODO: options processing needs more work */ - - if (strstr(options, "browse")) { - if (strstr(options, "nobrowse")) - ghost = 0; - else - ghost = 1; - } - entry = master_new_mapent(fullpath, ap->entry->age); if (!entry) { error(ap->logopt, diff --git a/modules/parse_sun.c b/modules/parse_sun.c index 190499c..4606577 100644 --- a/modules/parse_sun.c +++ b/modules/parse_sun.c @@ -461,6 +461,14 @@ static int sun_mount(struct autofs_point nonstrict = 0; } else if (strncmp("nonstrict", cp, 9) == 0) { nonstrict = 1; + } else if (strncmp("nobrowse", cp, 8) == 0 || + strncmp("browse", cp, 6) == 0 || + strncmp("timeout=", cp, 8) == 0) { + if (strcmp(fstype, "autofs") == 0 || + strstr(cp, "fstype=autofs")) { + memcpy(np, cp, comma - cp + 1); + np += comma - cp + 1; + } } else if (strncmp("bg", cp, 2) == 0 || strncmp("nofg", cp, 4) == 0) { continue;