@@ -212,7 +212,7 @@ static void
conf_parse_line(int trans, char *line, size_t sz)
{
char *val, *ptr;
- size_t i, valsize;
+ size_t i;
size_t j;
static char *section = 0;
static char *arg = 0;
@@ -299,16 +299,23 @@ conf_parse_line(int trans, char *line, size_t sz)
}
line[strcspn (line, " \t=")] = '\0';
val = line + i + 1 + strspn (line + i + 1, " \t");
- valsize = 0;
- while (val[valsize++]);
- /* Skip trailing spaces and comments */
- for (j = 0; j < valsize; j++) {
- if (val[j] == '#' || val[j] == ';' || isspace(val[j])) {
- val[j] = '\0';
- break;
+ if (line[0] == '"') {
+ line ++;
+ j = strcspn(line, "\"");
+ line[j] = 0;
+ } else if (line[0] == '\'') {
+ line ++;
+ j = strcspn(line, "'");
+ line[j] = 0;
+ } else
+ /* Skip trailing spaces and comments */
+ for (j = 0; val[j]; j++) {
+ if (val[j] == '#' || val[j] == ';' || isspace(val[j])) {
+ val[j] = '\0';
+ break;
+ }
}
- }
if (strcasecmp(line, "include") == 0)
conf_load(trans, val);
else
@@ -35,6 +35,8 @@ in the current section to
.BR 4 .
Leading and trailing spaces and tab
are ignored, as are spaces and tabs surrounding the equals sign.
+Single and double quotes surrounding the assigned value are also
+removed.
.PP
Any line starting with
.RB \*(lq # \*(rq
When "include = " is used to read and "environment" file such as /etc/sysconfig/nfs, there might be quotes around values. Stripe those off, just like a 'shell' reading the file would. Signed-off-by: NeilBrown <neilb@suse.com> --- support/nfs/conffile.c | 25 ++++++++++++++++--------- systemd/nfs.conf.man | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html