- refactor ldap sasl authentication bind to eliminate extra connect causing some servers to reject the request. - add mount wait parameter to allow timeout of mount requests to unresponsive servers. - special case cifs escape handling. - fix libxml2 workaround configure. - more code analysis corrections (and fix a typo in an init script). - fix backwards #ifndef INET6.
100 lines
2.9 KiB
Diff
100 lines
2.9 KiB
Diff
autofs-5.0.5 - special case cifs escapes
|
|
|
|
From: Ian Kent <raven@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(-)
|
|
|
|
|
|
diff --git a/CHANGELOG b/CHANGELOG
|
|
index fadb229..671c979 100644
|
|
--- a/CHANGELOG
|
|
+++ b/CHANGELOG
|
|
@@ -3,6 +3,7 @@
|
|
- fix included map read fail handling.
|
|
- refactor ldap sasl bind handling.
|
|
- add mount wait timeout parameter.
|
|
+- special case cifs escapes.
|
|
|
|
03/09/2009 autofs-5.0.5
|
|
-----------------------
|
|
diff --git a/modules/mount_generic.c b/modules/mount_generic.c
|
|
index 8edad8b..da85d1a 100644
|
|
--- a/modules/mount_generic.c
|
|
+++ b/modules/mount_generic.c
|
|
@@ -39,6 +39,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
|
{
|
|
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, const char *root, const char *name, int
|
|
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, const char *root, const char *name, int
|
|
return 1;
|
|
} else {
|
|
info(ap->logopt, MODPREFIX "mounted %s type %s on %s",
|
|
- what, fstype, fullpath);
|
|
+ loc, fstype, fullpath);
|
|
+ free(loc);
|
|
return 0;
|
|
}
|
|
}
|