rpms/autofs/F-11 autofs-5.0.4-special-case-cifs-escapes.patch, NONE, 1.1 autofs.spec, 1.288, 1.289

Ian Kent iankent at fedoraproject.org
Thu Sep 10 04:14:59 UTC 2009


Author: iankent

Update of /cvs/pkgs/rpms/autofs/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv1412

Modified Files:
	autofs.spec 
Added Files:
	autofs-5.0.4-special-case-cifs-escapes.patch 
Log Message:
* Wed Sep 10 2009 Ian Kent <ikent at redhat.com> - 1:5.0.4-39
- special case cifs mount location escaping (bz522109).


autofs-5.0.4-special-case-cifs-escapes.patch:
 CHANGELOG               |    1 +
 modules/mount_generic.c |   36 ++++++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 6 deletions(-)

--- NEW FILE autofs-5.0.4-special-case-cifs-escapes.patch ---
autofs-5.0.4 - special case cifs escapes

From: Ian Kent <raven at themaw.net>

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.
---

 CHANGELOG               |    1 +
 modules/mount_generic.c |   36 ++++++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 6 deletions(-)


--- autofs-5.0.4.orig/modules/mount_generic.c
+++ autofs-5.0.4/modules/mount_generic.c
@@ -39,6 +39,7 @@ int mount_mount(struct autofs_point *ap,
 {
 	char fullpath[PATH_MAX];
 	char buf[MAX_ERR_BUF];
+	char *loc;
 	int err;
 	int len, status, existed = 1;
 
@@ -74,22 +75,44 @@ int mount_mount(struct autofs_point *ap,
 	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 " SLOPPY "-o %s %s %s",
-		      fstype, options, what, fullpath);
+		      fstype, options, loc, fullpath);
 
 		err = spawn_mount(ap->logopt, "-t", fstype,
-			     SLOPPYOPT "-o", options, what, fullpath, NULL);
+			     SLOPPYOPT "-o", options, loc, fullpath, NULL);
 	} else {
 		debug(ap->logopt, MODPREFIX "calling mount -t %s %s %s",
-		      fstype, what, fullpath);
-		err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL);
+		      fstype, loc, fullpath);
+		err = spawn_mount(ap->logopt, "-t", fstype, loc, fullpath, NULL);
 	}
 
 	if (err) {
 		info(ap->logopt, MODPREFIX "failed to mount %s (type %s) on %s",
-		     what, fstype, fullpath);
+		     loc, fstype, fullpath);
+
+		free(loc);
 
 		if (ap->type != LKP_INDIRECT)
 			return 1;
@@ -100,7 +123,8 @@ int mount_mount(struct autofs_point *ap,
 		return 1;
 	} else {
 		info(ap->logopt, MODPREFIX "mounted %s type %s on %s",
-		    what, fstype, fullpath);
+		     loc, fstype, fullpath);
+		free(loc);
 		return 0;
 	}
 }
--- autofs-5.0.4.orig/CHANGELOG
+++ autofs-5.0.4/CHANGELOG
@@ -62,6 +62,7 @@
 - fix libxml2 non-thread-safe calls.
 - fix direct map cache locking.
 - fix dont umount existing direct mount on reread.
+- special case cifs escapes.
 
 4/11/2008 autofs-5.0.4
 -----------------------


Index: autofs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/autofs/F-11/autofs.spec,v
retrieving revision 1.288
retrieving revision 1.289
diff -u -p -r1.288 -r1.289
--- autofs.spec	3 Sep 2009 08:32:46 -0000	1.288
+++ autofs.spec	10 Sep 2009 04:14:59 -0000	1.289
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.4
-Release: 38
+Release: 39
 Epoch: 1
 License: GPLv2+
 Group: System Environment/Daemons
@@ -75,6 +75,7 @@ Patch62: autofs-5.0.4-fix-pthread-push-o
 Patch63: autofs-5.0.4-fix-libxml2-non-thread-safe-calls.patch
 Patch64: autofs-5.0.4-fix-direct-map-cache-locking.patch
 Patch65: autofs-5.0.4-fix-dont-umount-existing-direct-mount-on-reread.patch
+Patch66: autofs-5.0.4-special-case-cifs-escapes.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel
 Requires: kernel >= 2.6.17
@@ -181,6 +182,7 @@ echo %{version}-%{release} > .version
 %patch63 -p1
 %patch64 -p1
 %patch65 -p1
+%patch66 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -233,6 +235,9 @@ fi
 %{_libdir}/autofs/
 
 %changelog
+* Wed Sep 10 2009 Ian Kent <ikent at redhat.com> - 1:5.0.4-39
+- special case cifs mount location escaping (bz522109).
+
 * Thu Sep 3 2009 Ian Kent <ikent at redhat.com> - 1:5.0.4-38
 - fix libxml2 non-thread-safe calls.
 - fix direct map cache locking.




More information about the scm-commits mailing list