|
|
591f3a |
autofs-5.1.8 - fix minus only option handling in concat_options()
|
|
|
591f3a |
|
|
|
591f3a |
From: Ian Kent <raven@themaw.net>
|
|
|
591f3a |
|
|
|
591f3a |
While a '-' alone isn't strictly valid it hadn't previously cuased a
|
|
|
591f3a |
parse error. So commit 9047e91ffa69 (autofs-5.1.7 - fix concat_options()
|
|
|
591f3a |
error handling) introduced a regression by no longer allowing this.
|
|
|
591f3a |
|
|
|
591f3a |
Fix this regression by only failing if errno is set to a non-zero value
|
|
|
591f3a |
on return from concat_options() as well as returning NULL.
|
|
|
591f3a |
|
|
|
591f3a |
Fixes: 9047e91ffa69 (autofs-5.1.7 - fix concat_options() error handling)
|
|
|
591f3a |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
591f3a |
---
|
|
|
591f3a |
CHANGELOG | 1 +
|
|
|
591f3a |
modules/parse_sun.c | 25 +++++++++++++++++++------
|
|
|
591f3a |
2 files changed, 20 insertions(+), 6 deletions(-)
|
|
|
591f3a |
|
|
|
591f3a |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
591f3a |
+++ autofs-5.1.4/CHANGELOG
|
|
|
591f3a |
@@ -103,6 +103,7 @@
|
|
|
591f3a |
- fix deadlock with hosts map reload.
|
|
|
591f3a |
- fix memory leak in update_hosts_mounts().
|
|
|
591f3a |
- fix concat_options() error handling.
|
|
|
591f3a |
+- fix minus only option handling in concat_options().
|
|
|
591f3a |
|
|
|
591f3a |
xx/xx/2018 autofs-5.1.5
|
|
|
591f3a |
- fix flag file permission.
|
|
|
591f3a |
--- autofs-5.1.4.orig/modules/parse_sun.c
|
|
|
591f3a |
+++ autofs-5.1.4/modules/parse_sun.c
|
|
|
591f3a |
@@ -376,10 +376,16 @@ static int do_init(int argc, const char
|
|
|
591f3a |
if (gbl_options) {
|
|
|
591f3a |
append_options = defaults_get_append_options();
|
|
|
591f3a |
if (append_options) {
|
|
|
591f3a |
- char *tmp = concat_options(gbl_options, ctxt->optstr);
|
|
|
591f3a |
+ char *tmp;
|
|
|
591f3a |
+
|
|
|
591f3a |
+ errno = 0;
|
|
|
591f3a |
+ tmp = concat_options(gbl_options, ctxt->optstr);
|
|
|
591f3a |
if (!tmp) {
|
|
|
591f3a |
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
591f3a |
- logerr(MODPREFIX "concat_options: %s", estr);
|
|
|
591f3a |
+ /* Ignore non-error NULL return */
|
|
|
591f3a |
+ if (errno) {
|
|
|
591f3a |
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
591f3a |
+ logerr(MODPREFIX "concat_options: %s", estr);
|
|
|
591f3a |
+ }
|
|
|
591f3a |
/* freed in concat_options */
|
|
|
591f3a |
ctxt->optstr = NULL;
|
|
|
591f3a |
} else
|
|
|
591f3a |
@@ -996,9 +1002,12 @@ static int parse_mapent(const char *ent,
|
|
|
591f3a |
free(myoptions);
|
|
|
591f3a |
myoptions = newopt;
|
|
|
591f3a |
} else if (newopt) {
|
|
|
591f3a |
+ errno = 0;
|
|
|
591f3a |
tmp = concat_options(myoptions, newopt);
|
|
|
591f3a |
- if (!tmp) {
|
|
|
591f3a |
+ /* Ignore non-error NULL return */
|
|
|
591f3a |
+ if (!tmp && errno) {
|
|
|
591f3a |
char *estr;
|
|
|
591f3a |
+
|
|
|
591f3a |
estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
591f3a |
error(logopt, MODPREFIX
|
|
|
591f3a |
"concat_options: %s", estr);
|
|
|
591f3a |
@@ -1370,8 +1379,10 @@ dont_expand:
|
|
|
591f3a |
free(mnt_options);
|
|
|
591f3a |
mnt_options = noptions;
|
|
|
591f3a |
} else if (noptions) {
|
|
|
591f3a |
+ errno = 0;
|
|
|
591f3a |
tmp = concat_options(mnt_options, noptions);
|
|
|
591f3a |
- if (!tmp) {
|
|
|
591f3a |
+ /* Ignore non-error NULL return */
|
|
|
591f3a |
+ if (!tmp && errno) {
|
|
|
591f3a |
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
591f3a |
error(ap->logopt,
|
|
|
591f3a |
MODPREFIX "concat_options: %s", estr);
|
|
|
591f3a |
@@ -1395,8 +1406,10 @@ dont_expand:
|
|
|
591f3a |
free(options);
|
|
|
591f3a |
options = mnt_options;
|
|
|
591f3a |
} else if (mnt_options) {
|
|
|
591f3a |
+ errno = 0;
|
|
|
591f3a |
tmp = concat_options(options, mnt_options);
|
|
|
591f3a |
- if (!tmp) {
|
|
|
591f3a |
+ /* Ignore non-error NULL return */
|
|
|
591f3a |
+ if (!tmp && errno) {
|
|
|
591f3a |
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
591f3a |
error(ap->logopt, MODPREFIX "concat_options: %s", estr);
|
|
|
591f3a |
free(pmapent);
|