From nobody Sun Apr 14 01:03:45 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VHBrd3Gv6z5GcfL; Sun, 14 Apr 2024 01:03:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VHBrd2cTTz47Lp; Sun, 14 Apr 2024 01:03:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713056625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cgUUfMNTyaSsJoOvknrXTpwnAlYW6OvuJckzonpmGYM=; b=RVTUiX3GjFSMdmVqcmAr4LsLezEOyfuEs97IoVNN12dFiTX/Ez6HebORRVq+hfp0/0u47N XeR1mps76F+b2yvjqqRdGFj8GpLhyasxGejMijcFz07HGDu17IA1vmpIoZ67cbzTm9p4dR NVPo11d12L1sdpa11E1H6NroxVOZnMuIdpm18NpyVmYHUTmXcENkn493ab55vmqxaml8Cw M2XtjdU5evutQF7HjAPyQGKpxMEkduYTScIBjOV/OhhvFJTWMGM1oLBvgEv+SB3oQpfItR kttxfy1vm5q3dEdlT95OY+V4uLkf8o1sOsg41tRQs8ufS9a8mzKGfduVs6lr6Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713056625; a=rsa-sha256; cv=none; b=Y7y96ZO8Fnq2jQNaFjTIkNvfKBmvBVUaW54xEnW1k0Om0LYIp9DdE7lGHeRg3RgBnfy9WP 7bFipuHoLtXYYSZZTyL7F7jiNIFMGR11OuV5JUCKMMSINj2URCwbmcyaFz6rLxxriJiXgY a+9tEcoG4IDNohBfxezBUZgypbiQv0NEKlc/T0Dt9jSDUIo0i2NqT16/rWcxEMz/A1Qizi cEvAq1sksQcRptrbjJZkC0Vvdgx5ag18jw9OJ0X1exJQXORwDpIQ/QjOqNVzNmjx3CZXJv gGKtJGI+6AqxXORV5mc3mjgpei5BjhEYfbG3nMJz02otCr2ZkUGFPSvLIi1KIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713056625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cgUUfMNTyaSsJoOvknrXTpwnAlYW6OvuJckzonpmGYM=; b=O6eUJhQvv9v/ViwZLeBnRk1LpOpemeF97r0U7JQEBF/x90aRCQjmxqb7Whz8bFAW0+eE95 t8f0q2ZtxDpZLKpAoktSUg+7nhFinGf7cBKa8vOA8YvSNmeTZDpJbk8EnWUPdiPNptWw1a yzv3QRoPFsgtanO/IUm1bpKrkEgo+Pwo+/GjgcQJ7ZDbj0ctI7uOJz/Us1S6UOKmyVEw1/ PNaOgB498a1i/6yUUOZZA6jEFMWjzkvXkeNdQWAOQQ3LM4OVAf661VW8CVsxG/dwFGKxa1 JEX+xv7rbFyN/DhN+HAximx/sCUJ9uzmkWQ8zr2K1Fv7UBSMWZ1Z2AJaxPBo6A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VHBrd2CWzzw3S; Sun, 14 Apr 2024 01:03:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43E13jJO012421; Sun, 14 Apr 2024 01:03:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43E13jTF012418; Sun, 14 Apr 2024 01:03:45 GMT (envelope-from git) Date: Sun, 14 Apr 2024 01:03:45 GMT Message-Id: <202404140103.43E13jTF012418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 58fdd8509cf1 - stable/14 - mountd.c: Add warning messages for administrative controls List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 58fdd8509cf1a6846cc4124c2bfa03d9343ab910 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=58fdd8509cf1a6846cc4124c2bfa03d9343ab910 commit 58fdd8509cf1a6846cc4124c2bfa03d9343ab910 Author: Rick Macklem AuthorDate: 2024-03-31 19:00:08 +0000 Commit: Rick Macklem CommitDate: 2024-04-14 01:02:33 +0000 mountd.c: Add warning messages for administrative controls When "administrative controls" (which are exports of subdirectories within a NFS server's local file system) are used, they export the entire local server file system. (The subdirectory only applies to the Mount protocol used for NFSv3 mounts.) To minimize the risk that this causes confusion w.r.t. what is exported to NFS client(s), this patch generates warning messages for these. Only one message is generated for each server local file system. The messages can be silenced via a new "-A" command line option. The mountd.8 man page will be patched via a separate commit. (cherry picked from commit fefb7c399b39403e1a31157e925a541f1cc24f0b) --- usr.sbin/mountd/mountd.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 33c19a81a0cf..6583bfbc0ffb 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -143,10 +143,11 @@ struct exportlist { 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); @@ -285,6 +286,7 @@ static char *exnames_default[2] = { _PATH_EXPORTS, NULL }; 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; @@ -447,11 +449,14 @@ main(int argc, char **argv) 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; @@ -1709,6 +1714,20 @@ get_exportlist_one(int passno) 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. */