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

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