autofs-5.0.8 - fix ipv6 link local address handling

From: Ian Kent <raven@themaw.net>

Stop the validate_location() function from choking on link local
ipv6 addresses.
---
 CHANGELOG           |    1 +
 lib/rpc_subs.c      |    6 ++++++
 modules/parse_sun.c |    2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 9c87373..843c4ad 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@
 - allow --with-systemd to take a path arg.
 - fix WITH_LIBTIRPC function name.
 - fix ipv6 libtirpc getport.
+- fix ipv6 link local address handling.
 
 17/10/2013 autofs-5.0.8
 =======================
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index 2365b6e..9d5b2f5 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -669,6 +669,12 @@ static int create_client(struct conn_info *info, CLIENT **client)
 			goto done;
 		if (ret == -EHOSTUNREACH)
 			goto out_close;
+		if (ret == -EINVAL) {
+			char buf[MAX_ERR_BUF];
+			char *estr = strerror_r(-ret, buf, MAX_ERR_BUF);
+			error(LOGOPT_ANY, "connect() failed: %s", estr);
+			goto out_close;
+		}
 
 		if (!info->client && fd != RPC_ANYSOCK) {
 			close(fd);
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index 30820b5..e5a4def 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -862,7 +862,7 @@ static int validate_location(unsigned int logopt, char *loc)
 			    *ptr == '-' || *ptr == '.' || *ptr == '_' ||
 			    *ptr == ',' || *ptr == '(' || *ptr == ')' ||
 			    *ptr == '#' || *ptr == '@' || *ptr == ':' ||
-			    *ptr == '[' || *ptr == ']')) {
+			    *ptr == '[' || *ptr == ']' || *ptr == '%')) {
 				error(logopt, "invalid character \"%c\" "
 				      "found in location %s", *ptr, loc);
 				return 0;