Blob Blame History Raw
autofs-5.0.8 - check for bind onto self in mount_bind.c

From: Ian Kent <raven@themaw.net>

Check for an obviously impossible request to bind or symlink to the
same patch for source and target.
---
 CHANGELOG            |    1 +
 modules/mount_bind.c |    6 ++++++
 2 files changed, 7 insertions(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -85,6 +85,7 @@
 - fix compilation of lookup_ldap.c without sasl.
 - fix undefined authtype_requires_creds err if ldap enabled but without sasl.
 - pass map_source as function paramter where possible.
+- check for bind onto self in mount_bind.c.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/modules/mount_bind.c
+++ autofs-5.0.7/modules/mount_bind.c
@@ -135,6 +135,12 @@ int mount_mount(struct autofs_point *ap,
 	if (options == NULL || *options == '\0')
 		options = "defaults";
 
+	if (!strcmp(what, fullpath)) {
+		debug(ap->logopt, MODPREFIX
+		     "cannot mount or symlink %s to itself", fullpath);
+		return 1;
+	}
+
 	if (!symlnk && bind_works) {
 		int status, existed = 1;