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>
---
modules/replicated.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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));