Blame SOURCES/autofs-5.0.9-revert-special-case-cifs-escapes.patch

306fa1
autofs-5.0.9 - revert special case cifs escapes
306fa1
306fa1
From: Ian Kent <ikent@redhat.com>
306fa1
306fa1
The patch this reverts added an additional dquote on the mount location
306fa1
to revolve "\"s but this causes inconsistent quoting between the lookup
306fa1
key and the mount location when it is substituted using the &.
306fa1
306fa1
As described in the original patch:
306fa1
"Since "\" is a valid seperator for cifs shares it can't be used to escape
306fa1
characters in the share name passed to mount.cifs. So we have no choice
306fa1
but to require that the seperator we use is "/" and de-quote the string
306fa1
before sending it to mount.cifs."
306fa1
306fa1
We do need to require that the seperator "/" is used which alone should
306fa1
eliminate the need for an additional dequote and expect that invalid
306fa1
share name mounts will fail.
306fa1
---
306fa1
 modules/mount_generic.c |   36 ++++++------------------------------
306fa1
 1 file changed, 6 insertions(+), 30 deletions(-)
306fa1
306fa1
--- autofs-5.0.7.orig/modules/mount_generic.c
306fa1
+++ autofs-5.0.7/modules/mount_generic.c
306fa1
@@ -39,7 +39,6 @@ int mount_mount(struct autofs_point *ap,
306fa1
 {
306fa1
 	char fullpath[PATH_MAX];
306fa1
 	char buf[MAX_ERR_BUF];
306fa1
-	char *loc;
306fa1
 	int err;
306fa1
 	int len, status, existed = 1;
306fa1
 
306fa1
@@ -75,44 +74,22 @@ int mount_mount(struct autofs_point *ap,
306fa1
 	if (!status)
306fa1
 		existed = 0;
306fa1
 
306fa1
-	/*
306fa1
-	 * Special case quoting for cifs share names.
306fa1
-	 *
306fa1
-	 * Since "\" is a valid seperator for cifs shares it can't be
306fa1
-	 * used to escape characters in the share name passed to
306fa1
-	 * mount.cifs. So we have no choice but to require that the
306fa1
-	 * seperator we use is "/" and de-quote the string before
306fa1
-	 * sending it to mount.cifs.
306fa1
-	 */
306fa1
-	loc = NULL;
306fa1
-	if (strcmp(fstype, "cifs"))
306fa1
-		loc = strdup(what);
306fa1
-	else
306fa1
-		loc = dequote(what, strlen(what), ap->logopt);
306fa1
-	if (!loc) {
306fa1
-		error(ap->logopt,
306fa1
-		      MODPREFIX "failed to alloc buffer for mount location");
306fa1
-		return 1;
306fa1
-	}
306fa1
-
306fa1
 	if (options && options[0]) {
306fa1
 		debug(ap->logopt,
306fa1
 		      MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
306fa1
-		      fstype, options, loc, fullpath);
306fa1
+		      fstype, options, what, fullpath);
306fa1
 
306fa1
 		err = spawn_mount(ap->logopt, "-t", fstype,
306fa1
-			     SLOPPYOPT "-o", options, loc, fullpath, NULL);
306fa1
+			     SLOPPYOPT "-o", options, what, fullpath, NULL);
306fa1
 	} else {
306fa1
 		debug(ap->logopt, MODPREFIX "calling mount -t %s %s %s",
306fa1
-		      fstype, loc, fullpath);
306fa1
-		err = spawn_mount(ap->logopt, "-t", fstype, loc, fullpath, NULL);
306fa1
+		      fstype, what, fullpath);
306fa1
+		err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL);
306fa1
 	}
306fa1
 
306fa1
 	if (err) {
306fa1
 		info(ap->logopt, MODPREFIX "failed to mount %s (type %s) on %s",
306fa1
-		     loc, fstype, fullpath);
306fa1
-
306fa1
-		free(loc);
306fa1
+		     what, fstype, fullpath);
306fa1
 
306fa1
 		if (ap->type != LKP_INDIRECT)
306fa1
 			return 1;
306fa1
@@ -123,8 +100,7 @@ int mount_mount(struct autofs_point *ap,
306fa1
 		return 1;
306fa1
 	} else {
306fa1
 		debug(ap->logopt, MODPREFIX "mounted %s type %s on %s",
306fa1
-		     loc, fstype, fullpath);
306fa1
-		free(loc);
306fa1
+		     what, fstype, fullpath);
306fa1
 		return 0;
306fa1
 	}
306fa1
 }