Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 5c005eb18a3b9c1baa0bed57734cded5 > files > 15

autofs-5.0.2-7mdv2008.0.src.rpm

diff --git a/CHANGELOG b/CHANGELOG
index 678e764..aa5d1c1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,7 @@
 - fix wait time resolution in alarm and state queue handlers.
 - fix handling of quoted slash alone.
 - fix parse confusion between attribute and attribute value.
+- fix version passed to get_supported_ver_and_cost.
 
 18/06/2007 autofs-5.0.2
 -----------------------
diff --git a/modules/replicated.c b/modules/replicated.c
index de1b40c..0764d4a 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -607,12 +607,31 @@ static int get_supported_ver_and_cost(struct host *host, unsigned int version, c
 
 	parms.pm_prog = NFS_PROGRAM;
 
+	/*
+	 *  The version passed in is the version as defined in
+	 *  include/replicated.h.  However, the version we want to send
+	 *  off to the rpc calls should match the program version of NFS.
+	 *  So, we do the conversion here.
+	 */
 	if (version & UDP_SELECTED_MASK) {
 		proto = "udp";
-		vers = (version << 8);
-	} else {
+		version >>= 8;
+	} else
 		proto = "tcp";
-		vers = version;
+
+	switch (version) {
+	case NFS2_SUPPORTED:
+		vers = NFS2_VERSION;
+		break;
+	case NFS3_SUPPORTED:
+		vers = NFS3_VERSION;
+		break;
+	case NFS4_SUPPORTED:
+		vers = NFS4_VERSION;
+		break;
+	default:
+		crit(LOGOPT_ANY, "called with invalid version: 0x%x\n", version);
+		return 0;
 	}
 
 	rpc_info.proto = getprotobyname(proto);