diff --git a/autofs-5.0.4-special-case-cifs-escapes.patch b/autofs-5.0.4-special-case-cifs-escapes.patch new file mode 100644 index 0000000..9d2ab4e --- /dev/null +++ b/autofs-5.0.4-special-case-cifs-escapes.patch @@ -0,0 +1,95 @@ +autofs-5.0.4 - special case cifs escapes + +From: Ian Kent + +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 + ----------------------- diff --git a/autofs.spec b/autofs.spec index 4270a60..f1421ee 100644 --- a/autofs.spec +++ b/autofs.spec @@ -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-order-in-expire_proc_direct.patch 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 - 1:5.0.4-39 +- special case cifs mount location escaping (bz522109). + * Thu Sep 3 2009 Ian Kent - 1:5.0.4-38 - fix libxml2 non-thread-safe calls. - fix direct map cache locking.