- disable exports access control check (bz 203277). - fix patch to add command option for set a global mount options (bz 214684).
157 lines
4.3 KiB
Diff
157 lines
4.3 KiB
Diff
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;
|
|
}
|