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

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