autofs-5.0.9 - revert special case cifs escapes From: Ian Kent The patch this reverts added an additional dquote on the mount location to revolve "\"s but this causes inconsistent quoting between the lookup key and the mount location when it is substituted using the &. As described in the original patch: "Since "\" is a valid seperator for cifs shares it can't be used to escape characters in the share name passed to mount.cifs. So we have no choice but to require that the seperator we use is "/" and de-quote the string before sending it to mount.cifs." We do need to require that the seperator "/" is used which alone should eliminate the need for an additional dequote and expect that invalid share name mounts will fail. --- CHANGELOG | 1 + modules/mount_generic.c | 36 ++++++------------------------------ 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 402c96d..80a82dc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -27,6 +27,7 @@ - add config option to force use of program map stdvars. - fix incorrect check in parse_mount(). - handle duplicates in multi mounts. +- revert special case cifs escapes. 28/03/2014 autofs-5.0.9 ======================= diff --git a/modules/mount_generic.c b/modules/mount_generic.c index 2473b80..c4108e6 100644 --- a/modules/mount_generic.c +++ b/modules/mount_generic.c @@ -39,7 +39,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int { char fullpath[PATH_MAX]; char buf[MAX_ERR_BUF]; - char *loc; int err; int len, status, existed = 1; @@ -75,44 +74,22 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int if (!status) existed = 0; - /* - * Special case quoting for cifs share names. - * - * Since "\" is a valid seperator for cifs shares it can't be - * used to escape characters in the share name passed to - * mount.cifs. So we have no choice but to require that the - * seperator we use is "/" and de-quote the string before - * sending it to mount.cifs. - */ - loc = NULL; - if (strcmp(fstype, "cifs")) - loc = strdup(what); - else - loc = dequote(what, strlen(what), ap->logopt); - if (!loc) { - error(ap->logopt, - MODPREFIX "failed to alloc buffer for mount location"); - return 1; - } - if (options && options[0]) { debug(ap->logopt, MODPREFIX "calling mount -t %s -o %s %s %s", - fstype, options, loc, fullpath); + fstype, options, what, fullpath); err = spawn_mount(ap->logopt, "-t", fstype, - "-o", options, loc, fullpath, NULL); + "-o", options, what, fullpath, NULL); } else { debug(ap->logopt, MODPREFIX "calling mount -t %s %s %s", - fstype, loc, fullpath); - err = spawn_mount(ap->logopt, "-t", fstype, loc, fullpath, NULL); + fstype, what, fullpath); + err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL); } if (err) { info(ap->logopt, MODPREFIX "failed to mount %s (type %s) on %s", - loc, fstype, fullpath); - - free(loc); + what, fstype, fullpath); if (ap->type != LKP_INDIRECT) return 1; @@ -123,8 +100,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int return 1; } else { debug(ap->logopt, MODPREFIX "mounted %s type %s on %s", - loc, fstype, fullpath); - free(loc); + what, fstype, fullpath); return 0; } }