git: d2ce00e9a617 - main - Allow any user to read the NFS stats, for example with nfsstat(1).

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Fri, 02 Dec 2022 05:21:32 UTC
The branch main has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=d2ce00e9a6176014bbeb792dd9959ef1e60d787e

commit d2ce00e9a6176014bbeb792dd9959ef1e60d787e
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2022-12-01 21:08:01 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2022-12-02 05:21:14 +0000

    Allow any user to read the NFS stats, for example with nfsstat(1).
    
    This was originally allowed by 3cea29603d3 (2011).  But it got broken by
    693957f8861 (2016) and apparently nobody noticed.
    
    MFC after:      1 week
    Sponsored by:   Axcient
    Reviewed by:    rmacklem, ken
    Differential Revision: https://reviews.freebsd.org/D37589
---
 sys/nfs/nfs_nfssvc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/nfs/nfs_nfssvc.c b/sys/nfs/nfs_nfssvc.c
index a16ff8b36448..bf22817d2b25 100644
--- a/sys/nfs/nfs_nfssvc.c
+++ b/sys/nfs/nfs_nfssvc.c
@@ -85,7 +85,7 @@ sys_nfssvc(struct thread *td, struct nfssvc_args *uap)
 	AUDIT_ARG_CMD(uap->flag);
 
 	/* Allow anyone to get the stats. */
-	if ((uap->flag & ~NFSSVC_GETSTATS) != 0) {
+	if ((uap->flag & ~(NFSSVC_GETSTATS | NFSSVC_NEWSTRUCT)) != 0) {
 		error = priv_check(td, PRIV_NFS_DAEMON);
 		if (error != 0)
 			return (error);