Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 241

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index 56aaa5d..49a711c 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -196,8 +196,8 @@ For example, with an entry in the master map of
 accessing /net/myserver will mount exports from myserver on directories below
 /net/myserver.
 .P
-NOTE: mounts done from a hosts map will be mounted with the "nosuid" option
-unless the "suid" option is explicitly given in the master map entry.
+NOTE: mounts done from a hosts map will be mounted with the "nosuid" and "nodev" options
+unless the options "suid" and "dev" are explicitly given in the master map entry.
 .SH LDAP MAPS
 If the map type \fBldap\fP is specified the mapname is of the form
 \fB[//servername/]dn\fP, where the optional \fBservername\fP is
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index a97a7aa..4241f16 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -589,8 +589,12 @@ static int sun_mount(struct autofs_point *ap, const char *root,
 	type = ap->entry->maps->type;
 	if (type && !strcmp(type, "hosts")) {
 		if (options) {
-			if (!strstr(options, "suid")) {
-				char *tmp = alloca(strlen(options) + 8);
+			int len = strlen(options);
+			int suid = strstr(options, "suid") ? 0 : 7;
+			int dev = strstr(options, "dev") ? 0 : 6;
+
+			if (suid || dev) {
+				char *tmp = alloca(len + suid + dev + 1);
 				if (!tmp) {
 					error(ap->logopt, MODPREFIX
 					      "alloca failed for options");
@@ -598,12 +602,16 @@ static int sun_mount(struct autofs_point *ap, const char *root,
 						return -1;
 					return 1;
 				}
+
 				strcpy(tmp, options);
-				strcat(tmp, ",nosuid");
+				if (suid)
+					strcat(tmp, ",nosuid");
+				if (dev)
+					strcat(tmp, ",nodev");
 				options = tmp;
 			}
 		} else {
-			char *tmp = alloca(7);
+			char *tmp = alloca(13);
 			if (!tmp) {
 				error(ap->logopt,
 				      MODPREFIX "alloca failed for options");
@@ -611,7 +619,7 @@ static int sun_mount(struct autofs_point *ap, const char *root,
 					return -1;
 				return 1;
 			}
-			strcpy(tmp, "nosuid");
+			strcpy(tmp, "nosuid,nodev");
 			options = tmp;
 		}
 	}
diff --git a/samples/auto.master b/samples/auto.master
index 4995976..9fe5609 100644
--- a/samples/auto.master
+++ b/samples/auto.master
@@ -7,8 +7,8 @@
 /misc	/etc/auto.misc
 #
 # NOTE: mounts done from a hosts map will be mounted with the
-#	"nosuid" option unless the "suid" option is explicitly
-#	given.
+#	"nosuid" and "nodev" options unless the "suid" and "dev"
+#	options are explicitly given.
 #
 /net	-hosts
 #