diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -130,10 +130,11 @@ SLIST_ENTRY(exportlist) entries; }; /* ex_flag bits */ -#define EX_LINKED 0x1 -#define EX_DONE 0x2 -#define EX_DEFSET 0x4 -#define EX_PUBLICFH 0x8 +#define EX_LINKED 0x01 +#define EX_DONE 0x02 +#define EX_DEFSET 0x04 +#define EX_PUBLICFH 0x08 +#define EX_ADMINWARN 0x10 SLIST_HEAD(exportlisthead, exportlist); @@ -272,6 +273,7 @@ static char **exnames; static char **hosts = NULL; static int force_v2 = 0; +static int warn_admin = 1; static int resvport_only = 1; static int nhosts = 0; static int dir_only = 1; @@ -434,11 +436,14 @@ else close(s); - while ((c = getopt(argc, argv, "2deh:lnp:RrS")) != -1) + while ((c = getopt(argc, argv, "2Adeh:lnp:RrS")) != -1) switch (c) { case '2': force_v2 = 1; break; + case 'A': + warn_admin = 0; + break; case 'e': /* now a no-op, since this is the default */ break; @@ -1696,6 +1701,20 @@ fsb.f_fsid.val[1]); } + if (warn_admin != 0 && + (ep->ex_flag & EX_ADMINWARN) == 0 && + strcmp(unvis_dir, fsb.f_mntonname) != + 0) { + if (debug) + warnx("exporting %s exports entire " + "%s file system", unvis_dir, + fsb.f_mntonname); + syslog(LOG_ERR, "Warning: exporting %s " + "exports entire %s file system", + unvis_dir, fsb.f_mntonname); + ep->ex_flag |= EX_ADMINWARN; + } + /* * Add dirpath to export mount point. */