Ian Kent 346236
autofs-5.0.7 - fix nobind sun escaped map entries
Ian Kent 346236
Ian Kent 346236
From: Ian Kent <ikent@redhat.com>
Ian Kent 346236
Ian Kent 346236
If a map contains a Sun colon escape to indicate the mount is a local
Ian Kent 346236
file system and the "nobind" option is present there is no hostname in
Ian Kent 346236
the mount location and the mount fails.
Ian Kent 346236
---
Ian Kent 346236
Ian Kent 346236
 CHANGELOG           |    4 ++++
Ian Kent 346236
 modules/mount_nfs.c |    5 +++--
Ian Kent 346236
 2 files changed, 7 insertions(+), 2 deletions(-)
Ian Kent 346236
Ian Kent 346236
Ian Kent 346236
diff --git a/CHANGELOG b/CHANGELOG
Ian Kent 346236
index 67fdcec..faf4c80 100644
Ian Kent 346236
--- a/CHANGELOG
Ian Kent 346236
+++ b/CHANGELOG
Ian Kent 346236
@@ -1,3 +1,7 @@
Ian Kent 346236
+??/??/2012 autofs-5.0.8
Ian Kent 346236
+=======================
Ian Kent 346236
+- fix nobind sun escaped map entries.
Ian Kent 346236
+
Ian Kent 346236
 25/07/2012 autofs-5.0.7
Ian Kent 346236
 =======================
Ian Kent 346236
 - fix ipv6 name for lookup fix.
Ian Kent 346236
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
Ian Kent 346236
index 9b8e5f1..bbbb1de 100644
Ian Kent 346236
--- a/modules/mount_nfs.c
Ian Kent 346236
+++ b/modules/mount_nfs.c
Ian Kent 346236
@@ -263,13 +263,14 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
Ian Kent 346236
 			} else
Ian Kent 346236
 				strcpy(loc, n_addr);
Ian Kent 346236
 		} else {
Ian Kent 346236
-			loc = malloc(strlen(this->name) + strlen(this->path) + 2);
Ian Kent 346236
+			char *host = this->name ? this->name : "localhost";
Ian Kent 346236
+			loc = malloc(strlen(host) + strlen(this->path) + 2);
Ian Kent 346236
 			if (!loc) {
Ian Kent 346236
 				char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
Ian Kent 346236
 				error(ap->logopt, "malloc: %s", estr);
Ian Kent 346236
 				goto forced_fail;
Ian Kent 346236
 			}
Ian Kent 346236
-			strcpy(loc, this->name);
Ian Kent 346236
+			strcpy(loc, host);
Ian Kent 346236
 		}
Ian Kent 346236
 		strcat(loc, ":");
Ian Kent 346236
 		strcat(loc, this->path);