diff --git a/CHANGELOG b/CHANGELOG index d8a6987..9683eb3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -57,6 +57,7 @@ - second attempt fixing quoting for exports gathered by hosts map. - quell annoying "cannot open mount module" message. - fix for improve handling of server not available. +- use mount option "nodev" for "-hosts" map unless "dev" is explicily specified. 18/06/2007 autofs-5.0.2 ----------------------- 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 #