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