--- autofs-5.0.1/redhat/autofs.sysconfig.in.conf-append-global.patch 2007-01-04 12:33:40.000000000 +0900 +++ autofs-5.0.1/redhat/autofs.sysconfig.in 2007-04-16 17:40:04.000000000 +0800 @@ -13,6 +13,10 @@ DEFAULT_TIMEOUT=300 # DEFAULT_BROWSE_MODE="no" # +# DEFAULT_APPEND_OPTIONS - append to global options instead of replace. +# +#DEFAULT_APPEND_OPTIONS="yes" +# # DEFAULT_LOGGING - set default log level "none", "verbose" or "debug" # #DEFAULT_LOGGING="none" --- autofs-5.0.1/include/defaults.h.conf-append-global.patch 2007-01-04 12:33:40.000000000 +0900 +++ autofs-5.0.1/include/defaults.h 2007-04-16 17:35:35.000000000 +0800 @@ -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 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 --- autofs-5.0.1/modules/parse_sun.c.conf-append-global.patch 2007-04-16 17:34:19.000000000 +0800 +++ autofs-5.0.1/modules/parse_sun.c 2007-04-16 17:35:35.000000000 +0800 @@ -140,7 +140,7 @@ int expandsunent(const char *src, char * * 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) { @@ -952,6 +952,7 @@ int parse_mount(struct autofs_point *ap, 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; @@ -997,6 +998,7 @@ int parse_mount(struct autofs_point *ap, 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); @@ -1009,10 +1011,10 @@ int parse_mount(struct autofs_point *ap, /* 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); @@ -1032,10 +1034,25 @@ int parse_mount(struct autofs_point *ap, 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); --- autofs-5.0.1/samples/autofs.conf.default.in.conf-append-global.patch 2007-01-04 12:33:40.000000000 +0900 +++ autofs-5.0.1/samples/autofs.conf.default.in 2007-04-16 17:41:31.000000000 +0800 @@ -13,6 +13,10 @@ DEFAULT_TIMEOUT=300 # DEFAULT_BROWSE_MODE="no" # +# DEFAULT_APPEND_OPTIONS - append to global options instead of replace. +# +#DEFAULT_APPEND_OPTIONS="yes" +# # DEFAULT_LOGGING - set default log level "none", "verbose" or "debug" # #DEFAULT_LOGGING="none" --- autofs-5.0.1/lib/defaults.c.conf-append-global.patch 2007-01-04 12:33:40.000000000 +0900 +++ autofs-5.0.1/lib/defaults.c 2007-04-16 17:37:54.000000000 +0800 @@ -37,6 +37,7 @@ #define ENV_NAME_ENTRY_ATTR "DEFAULT_ENTRY_ATTRIBUTE" #define ENV_NAME_VALUE_ATTR "DEFAULT_VALUE_ATTRIBUTE" +#define ENV_APPEND_OPTIONS "DEFAULT_APPEND_OPTIONS" #define ENV_AUTH_CONF_FILE "DEFAULT_AUTH_CONF_FILE" static const char *default_master_map_name = DEFAULT_MASTER_MAP_NAME; @@ -168,6 +169,7 @@ unsigned int defaults_read_config(void) !strcasecmp(res, ENV_NAME_MAP_ATTR) || !strcasecmp(res, ENV_NAME_ENTRY_ATTR) || !strcasecmp(res, ENV_NAME_VALUE_ATTR) || + !strcasecmp(res, ENV_APPEND_OPTIONS) || !strcasecmp(res, ENV_AUTH_CONF_FILE)) { ret = setenv(res, value, 0); if (ret) @@ -311,6 +313,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;