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

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