autofs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: Mark Fox <mfox@customdatacentre.com>, autofs@vger.kernel.org
Subject: Re: Changes to special character escaping?
Date: Mon, 10 Apr 2017 16:07:17 +0800	[thread overview]
Message-ID: <1491811637.4382.3.camel@themaw.net> (raw)
In-Reply-To: <CAFVxx_NaVK6J=tvfCa7AUQDaGLPE0ipZjpcqc1N55N4KrY5kKA@mail.gmail.com>

On Fri, 2017-04-07 at 16:56 -0600, Mark Fox wrote:
> Has something changed regarding escaping of special characters? The
> methods used to deal with special characters in maps that are included
> in distributions (ie. Ubuntu 16.04.2, so automount 5.1.1) no longer
> seem to work.

The problem is probably this patch, as you can see from the description
(spelling mistakes and all) there's a conflict depending on how the map entry
key is obtained, not sure what to do about it yet since I think this will be (at
least) the third time cifs escaping has been a problem .... lets look at a log.

autofs-5.1.0 - revert special case cifs escapes

From: Ian Kent <ikent@redhat.com>

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 8080743..e21752b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -46,6 +46,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.
 
 04/06/2014 autofs-5.1.0
 =======================
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;
 	}
 }
--
To unsubscribe from this list: send the line "unsubscribe autofs" in

      parent reply	other threads:[~2017-04-10  8:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 22:56 Changes to special character escaping? Mark Fox
2017-04-10  7:49 ` Ian Kent
2017-04-10  8:07 ` Ian Kent [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491811637.4382.3.camel@themaw.net \
    --to=raven@themaw.net \
    --cc=autofs@vger.kernel.org \
    --cc=mfox@customdatacentre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).