Blame SOURCES/autofs-5.0.7-check-for-protocol-option.patch

ab3a3d
autofs-5.0.7 - check for protocol option
ab3a3d
ab3a3d
From: Ian Kent <raven@themaw.net>
ab3a3d
ab3a3d
When a specific protocol is requested in the mount options only
ab3a3d
that protocol should be probed for.
ab3a3d
---
ab3a3d
 modules/mount_nfs.c |   10 ++++++++++
ab3a3d
 1 file changed, 10 insertions(+)
ab3a3d
ab3a3d
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
ab3a3d
index 9de8a73..3d2ccea 100644
ab3a3d
--- a/modules/mount_nfs.c
ab3a3d
+++ b/modules/mount_nfs.c
ab3a3d
@@ -156,6 +156,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
ab3a3d
 					if (port < 0)
ab3a3d
 						port = 0;
ab3a3d
 					port_opt = cp;
ab3a3d
+				} else if (strncmp("proto=udp", cp, o_len) == 0 ||
ab3a3d
+					   strncmp("udp", cp, o_len) == 0) {
ab3a3d
+					vers &= ~TCP_SUPPORTED;
ab3a3d
+				} else if (strncmp("proto=tcp", cp, o_len) == 0 ||
ab3a3d
+					   strncmp("tcp", cp, o_len) == 0) {
ab3a3d
+					vers &= ~UDP_SUPPORTED;
ab3a3d
 				}
ab3a3d
 				/* Check for options that also make sense
ab3a3d
 				   with bind mounts */
ab3a3d
@@ -167,6 +173,10 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
ab3a3d
 			}
ab3a3d
 		}
ab3a3d
 
ab3a3d
+		/* In case both tcp and udp options were given */
ab3a3d
+		if ((vers & NFS_PROTO_MASK) == 0)
ab3a3d
+			vers |= NFS_PROTO_MASK;
ab3a3d
+
ab3a3d
 		debug(ap->logopt, MODPREFIX
ab3a3d
 		      "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d",
ab3a3d
 		      nfsoptions, nobind, nosymlink, ro);