[PATCH] autofs: handle old configuration format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a patch to fix

http://bugzilla.centos.org/view.php?id=8614

The configuration stuff was redone and it broke backwards compatiblity.
Unfortunately this was backported to Centos/RHEL, so configurations that were
working in 6.4 suddenly broke in 6.6, which is not helpful.  Fix this by
noticing if we are looking at the old configuration file, strip out the DEFAULT_
bit of the variable if it is there and tolower the rest of the string.  This
makes it so our old configuration works properly and now people get their home
dirs automounted properly with either versions of autofs.  Thanks,

Signed-off-by: Josef Bacik <jbacik@xxxxxx>
---
 lib/defaults.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/lib/defaults.c b/lib/defaults.c
index 5711e65..cd43a60 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -776,6 +776,27 @@ static int check_set_config_value(const char *section,
 	return ret;
 }
 
+static int check_set_old_config_value(const char *section, const char *key,
+				      const char *value)
+{
+	const char *pkey = key;
+	char lkey[PATH_MAX+1];
+	char *plkey = &lkey[0];
+
+	/*
+	 * The old format was DEFAULT_whatever, so just trim the DEFAULT_ bit if
+	 * it's there.
+	 */
+	if (strstr(key, "DEFAULT_"))
+		pkey += strlen("DEFAULT_");
+
+	/* Lower case everything */
+	while (*pkey)
+		*plkey++ = tolower(*pkey++);
+	*plkey = '\0';
+	return check_set_config_value(section, lkey, value);
+}
+
 static int parse_line(char *line, char **sec, char **res, char **value)
 {
 	char *key, *val, *trailer;
@@ -924,7 +945,10 @@ static int read_config(unsigned int to_syslog, FILE *f, const char *name)
 				"%s is not used by autofs, ignored", res);
 			continue;
 		}
-		check_set_config_value(new_sec, key, value);
+		if (name == OLD_CONFIG_FILE)
+			check_set_old_config_value(new_sec, key, value);
+		else
+			check_set_config_value(new_sec, key, value);
 	}
 
 	if (!feof(f) || ferror(f)) {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux