autofs-5.0.8 - get_nfs_info() should query portmapper if port is not given

From: Scott Mayhew <smayhew@redhat.com>

It shouldn't just assume it can use port 2049.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 CHANGELOG            |    1 +
 modules/replicated.c |    9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index d8c994a..f151d35 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@
 - fix ipv6 libtirpc getport.
 - fix ipv6 link local address handling.
 - fix fix ipv6 libtirpc getport.
+- get_nfs_info() should query portmapper if port is not given.
 
 17/10/2013 autofs-5.0.8
 =======================
diff --git a/modules/replicated.c b/modules/replicated.c
index 5fdd9d9..2463235 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -444,9 +444,12 @@ static unsigned int get_nfs_info(unsigned logopt, struct host *host,
 		      host->name, proto, version);
 
 	rpc_info->proto = proto;
-	if (port < 0)
-		rpc_info->port = NFS_PORT;
-	else if (port > 0)
+	if (port < 0) {
+		if (version & NFS4_REQUESTED)
+			rpc_info->port = NFS_PORT;
+		else
+			port = 0;
+	} else if (port > 0)
 		rpc_info->port = port;
 
 	memset(&parms, 0, sizeof(struct pmap));