autofs/SOURCES/autofs-5.1.8-fix-minus-only-option-handling-in-concat_options.patch

89 lines
2.9 KiB
Diff
Raw Normal View History

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