walters / rpms / nfs-utils

Forked from rpms/nfs-utils 6 years ago
Clone
538c985
--- nfs-utils-1.0.9/utils/mount/nfs4mount.c.sloppy	2006-09-20 12:08:39.000000000 +0200
538c985
+++ nfs-utils-1.0.9/utils/mount/nfs4mount.c	2006-09-20 12:08:39.000000000 +0200
538c985
@@ -50,6 +50,7 @@
538c985
 #endif
538c985
 
538c985
 extern int verbose;
538c985
+extern int sloppy;
538c985
 
538c985
 char *IDMAPLCK = DEFAULT_DIR "/rpcidmapd";
538c985
 #define idmapd_check() do { \
538c985
@@ -338,7 +339,7 @@
538c985
 				nocto = !val;
538c985
 			else if (!strcmp(opt, "ac"))
538c985
 				noac = !val;
538c985
-			else {
538c985
+			else if (!sloppy) {
538c985
 				printf(_("unknown nfs mount option: "
538c985
 					 "%s%s\n"), val ? "" : "no", opt);
538c985
 				goto fail;
538c985
--- nfs-utils-1.0.9/utils/mount/mount.c.sloppy	2006-09-20 12:08:39.000000000 +0200
538c985
+++ nfs-utils-1.0.9/utils/mount/mount.c	2006-09-20 12:10:31.000000000 +0200
538c985
@@ -44,6 +44,7 @@
538c985
 int nomtab;
538c985
 int verbose;
538c985
 int mounttype;
538c985
+int sloppy;
538c985
 
538c985
 static struct option longopts[] = {
538c985
   { "fake", 0, 0, 'f' },
538c985
@@ -239,6 +240,7 @@
538c985
 	printf("\t-w\t\tMount file system read-write\n");
538c985
 	printf("\t-f\t\tFake mount, don't actually mount\n");
538c985
 	printf("\t-n\t\tDo not update /etc/mtab\n");
538c985
+	printf("\t-s\t\tTolerate sloppy mount options rather than failing.\n");
538c985
 	printf("\t-h\t\tPrint this help\n");
538c985
 	printf("\tversion\t\tnfs4 - NFS version 4, nfs - older NFS version supported\n");
538c985
 	printf("\tnfsoptions\tRefer mount.nfs(8) or nfs(5)\n\n");
538c985
@@ -373,7 +375,7 @@
538c985
 		return 0;
538c985
 	}
538c985
 
538c985
-	while ((c = getopt_long (argc - 2, argv + 2, "rt:vVwfno:h",
538c985
+	while ((c = getopt_long (argc - 2, argv + 2, "rt:vVwfno:hs",
538c985
 				longopts, NULL)) != -1) {
538c985
 		switch (c) {
538c985
 		case 'r':
538c985
@@ -403,6 +405,9 @@
538c985
 			else
538c985
 				mount_opts = xstrdup(optarg);
538c985
 			break;
538c985
+		case 's':
538c985
+			++sloppy;
538c985
+			break;
538c985
 		case 128: /* bind */
538c985
 			mounttype = MS_BIND;
538c985
 			break;
538c985
--- nfs-utils-1.0.9/utils/mount/nfsmount.c.sloppy	2006-09-20 12:08:39.000000000 +0200
538c985
+++ nfs-utils-1.0.9/utils/mount/nfsmount.c	2006-09-20 12:08:39.000000000 +0200
538c985
@@ -104,6 +104,7 @@
538c985
 static char errbuf[BUFSIZ];
538c985
 static char *erreob = &errbuf[BUFSIZ];
538c985
 extern int verbose;
538c985
+extern int sloppy;
538c985
 
538c985
 /* Convert RPC errors into strings */
538c985
 int rpc_strerror(int);
538c985
@@ -606,13 +607,13 @@
538c985
 			} else if (!strcmp(opt, "namlen")) {
538c985
 				if (nfs_mount_version >= 2)
538c985
 					data->namlen = val;
538c985
-				else
538c985
+				else if (!sloppy)
538c985
 					goto bad_parameter;
538c985
 #endif
538c985
 			} else if (!strcmp(opt, "addr")) {
538c985
 				/* ignore */;
538c985
 				continue;
538c985
- 			} else
538c985
+ 			} else if (!sloppy)
538c985
 				goto bad_parameter;
538c985
 			sprintf(cbuf, "%s=%s,", opt, opteq+1);
538c985
 		} else if (opteq) {
538c985
@@ -629,7 +630,7 @@
538c985
 					mnt_pmap->pm_prot = IPPROTO_TCP;
538c985
 					data->flags |= NFS_MOUNT_TCP;
538c985
 #endif
538c985
-				} else
538c985
+				} else if (!sloppy)
538c985
 					goto bad_parameter;
538c985
 #if NFS_MOUNT_VERSION >= 5
538c985
 			} else if (!strcmp(opt, "sec")) {
538c985
@@ -658,7 +659,7 @@
538c985
 					data->pseudoflavor = AUTH_GSS_SPKMI;
538c985
 				else if (!strcmp(secflavor, "spkm3p"))
538c985
 					data->pseudoflavor = AUTH_GSS_SPKMP;
538c985
-				else {
538c985
+				else if (!sloppy) {
538c985
 					printf(_("Warning: Unrecognized security flavor %s.\n"),
538c985
 						secflavor);
538c985
 					goto bad_parameter;
538c985
@@ -677,7 +678,7 @@
538c985
 					goto bad_parameter;
538c985
  				}
538c985
  				strncpy(data->context, context, NFS_MAX_CONTEXT_LEN);
538c985
- 			} else
538c985
+ 			} else if (!sloppy)
538c985
 				goto bad_parameter;
538c985
 			sprintf(cbuf, "%s=%s,", opt, opteq+1);
538c985
 		} else {
538c985
@@ -768,9 +769,11 @@
538c985
 #endif
538c985
 			} else {
538c985
 			bad_option:
538c985
-				printf(_("Unsupported nfs mount option: "
538c985
-					 "%s%s\n"), val ? "" : "no", opt);
538c985
-				goto out_bad;
538c985
+				if (!sloppy) {
538c985
+					printf(_("Unsupported nfs mount option: "
538c985
+						 "%s%s\n"), val ? "" : "no", opt);
538c985
+					goto out_bad;
538c985
+				}
538c985
 			}
538c985
 			sprintf(cbuf, val ? "%s,":"no%s,", opt);
538c985
 		}