From nobody Sun Mar 31 19:01:11 2024 X-Original-To: dev-commits-src-main@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 4V73QJ0CRZz5GC51; Sun, 31 Mar 2024 19:01:12 +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 4V73QH6mh3z4MZj; Sun, 31 Mar 2024 19:01:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711911672; 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=m/6i6Pkyezu2CGfy2qkZycf+qpNnhe8xrNrHYeqamLE=; b=RW1NuszvTx5SM/ijDTRIPFeYGLTS0qls/tT7K3GC+WZ3qNGTgdmtJ7JywT+5zLtX2wX48m wKe88aBzoZpM4MhLGVtEPVitGMbfAGhBbc0qtMXuMKD5iwj9UnuUNbI80vh9Q6j54/8ye7 Otv/kj66FYZRGarVCuCht04PIGy8XzgySbNlNLqkY9xbPmi+YYvaA7XWuQdychBRJX/LaS 3n6Twv8lnGViS/4stuc8oHgeHtgeSP78WCb2bhuFoqs4LsGy6eZScvuPLhjpObOt45gxVz JjcO3VG5uIGv6AvmIFm8noeWOvKpQaCixAOnn+8LvgPh3dMq73EfEO7a+LjVMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711911671; a=rsa-sha256; cv=none; b=CfU2xesUynqdu2AM4rqtoeWVPOsbeCc7SOeGLEwnunqW77I1Xhz5fk1Pme0vqN7NTyJB92 G/bOMnhQH+QT75aiCH8sVyk4p7qB8xJIjFVuptSr3uuSDqjoHA9fmE95LoCPTAHgywt4NL r+GVEZ++zq9vHjJJKEPN8BuZlbdQ/RQJ3yIUgZFY674A+b8a0lkldAbUwp3lyry1BiJW/g fxqacQuVmsLDb8XRjZwosMAj80Mdb68+V/hDTuYboshsrqawfHZaOnA4065S0oh5iFeHKY i6AQ/hC+GbdmUNzCuvSvDsaMhIXwVqNnZ1OQjltDuQD3QDqLwKYrkrqBopmeGw== 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=1711911671; 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=m/6i6Pkyezu2CGfy2qkZycf+qpNnhe8xrNrHYeqamLE=; b=t2U8tsK8MC2eIjguvnmXPIytocdFBjfjFzIlsrgr6BE2jYwFCG+QkFPEikxao4pxIhUudU oqkYNCkS47Uu+EPMlJM6gvPKMqr3UjyKx6qnth9CpdkSgkPpiJntIgho6OBYlQG27s+6rE 2/BRWONZk8Z8wpdCJqs4cURZDwXaO/FHyc28ZAQz6TLUer+sEnxxDd73kJD3h4ZQKLlBc2 lUFJA4IsYfWj9Kb1TluGIOFBCwdNKos86VmSJN6FAJyhcGl4mB5Ap7Rn78Jd7GGp0ZZOZa IGEN/Dnn1io5MwuXVmFeabevTY1dHbAql6dDsqGCfr6jge4e36+8acst57uNug== 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 4V73QH6NJ1zqh1; Sun, 31 Mar 2024 19:01:11 +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 42VJ1BA0060843; Sun, 31 Mar 2024 19:01:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42VJ1BRF060840; Sun, 31 Mar 2024 19:01:11 GMT (envelope-from git) Date: Sun, 31 Mar 2024 19:01:11 GMT Message-Id: <202403311901.42VJ1BRF060840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: fefb7c399b39 - main - mountd.c: Add warning messages for administrative controls List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: fefb7c399b39403e1a31157e925a541f1cc24f0b Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fefb7c399b39403e1a31157e925a541f1cc24f0b commit fefb7c399b39403e1a31157e925a541f1cc24f0b Author: Rick Macklem AuthorDate: 2024-03-31 19:00:08 +0000 Commit: Rick Macklem CommitDate: 2024-03-31 19:00:08 +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. Reviewed by: emaste, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D44502 --- 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 73a4dbfe39b3..14693a922186 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -130,10 +130,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); @@ -272,6 +273,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; @@ -434,11 +436,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; @@ -1696,6 +1701,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. */