+2010-09-28 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Fix option escaping for fusermount. If the "fsname=" option
+ contained a comma then the option parser in fusermount was
+ confused (Novell bugzilla #641480). Fix by escaping commas when
+ passing them over to fusermount. Reported by Jan Engelhardt
+
2010-08-27 Miklos Szeredi <miklos@szeredi.hu>
* Add NetBSD support. Patch from Emmanuel Dreyfus
return fuse_opt_add_opt(&mo->kernel_opts, arg);
case KEY_FUSERMOUNT_OPT:
- return fuse_opt_add_opt(&mo->fusermount_opts, arg);
+ return fuse_opt_add_opt_escaped(&mo->fusermount_opts, arg);
case KEY_SUBTYPE_OPT:
return fuse_opt_add_opt(&mo->subtype_opt, arg);
static int get_string_opt(const char *s, unsigned len, const char *opt,
char **val)
{
+ int i;
unsigned opt_len = strlen(opt);
+ char *d;
if (*val)
free(*val);
return 0;
}
- memcpy(*val, s + opt_len, len - opt_len);
- (*val)[len - opt_len] = '\0';
+ d = *val;
+ s += opt_len;
+ len -= opt_len;
+ for (i = 0; i < len; i++) {
+ if (s[i] == '\\' && i + 1 < len)
+ i++;
+ *d++ = s[i];
+ }
+ *d = '\0';
return 1;
}
unsigned len;
const char *fsname_str = "fsname=";
const char *subtype_str = "subtype=";
- for (len = 0; s[len] && s[len] != ','; len++);
+ for (len = 0; s[len]; len++) {
+ if (s[len] == '\\' && s[len + 1])
+ len++;
+ else if (s[len] == ',')
+ break;
+ }
if (begins_with(s, fsname_str)) {
if (!get_string_opt(s, len, fsname_str, &fsname))
goto err;