git: 11b90b298908 - stable/14 - cred: Constify signature of groupmember() and realgroupmember()

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Fri, 15 Nov 2024 10:48:52 UTC
The branch stable/14 has been updated by olce:

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

commit 11b90b298908f418f93923c971f2c0a214f2060e
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-10-30 10:59:49 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-11-15 10:47:40 +0000

    cred: Constify signature of groupmember() and realgroupmember()
    
    Reviewed by     emaste
    Approved by:    markj (mentor)
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D47343
    
    (cherry picked from commit b15110fb0dc6f0480482616f22bda3a2a19fbd80)
    
    Approved by:    markj (mentor)
---
 share/man/man9/groupmember.9 | 6 +++---
 sys/kern/kern_prot.c         | 4 ++--
 sys/sys/ucred.h              | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/share/man/man9/groupmember.9 b/share/man/man9/groupmember.9
index db2138ef088a..e7e28bae3ac9 100644
--- a/share/man/man9/groupmember.9
+++ b/share/man/man9/groupmember.9
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 .\" DAMAGE.
 .\"
-.Dd August 18, 2023
+.Dd October 31, 2024
 .Dt GROUPMEMBER 9
 .Os
 .Sh NAME
@@ -35,9 +35,9 @@
 .In sys/param.h
 .In sys/ucred.h
 .Ft bool
-.Fn groupmember "gid_t gid" "struct ucred *cred"
+.Fn groupmember "gid_t gid" "const struct ucred *cred"
 .Ft bool
-.Fn realgroupmember "gid_t gid" "struct ucred *cred"
+.Fn realgroupmember "gid_t gid" "const struct ucred *cred"
 .Sh DESCRIPTION
 The
 .Fn groupmember
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 19279742ea81..be7a71ae6879 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1307,7 +1307,7 @@ group_is_supplementary(const gid_t gid, const struct ucred *const cred)
  * supplementary groups).
  */
 bool
-groupmember(gid_t gid, struct ucred *cred)
+groupmember(gid_t gid, const struct ucred *cred)
 {
 
 	/*
@@ -1328,7 +1328,7 @@ groupmember(gid_t gid, struct ucred *cred)
  * groups).
  */
 bool
-realgroupmember(gid_t gid, struct ucred *cred)
+realgroupmember(gid_t gid, const struct ucred *cred)
 {
 	if (gid == cred->cr_rgid)
 		return (true);
diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h
index 7c9e46e47774..db38cd99e5bc 100644
--- a/sys/sys/ucred.h
+++ b/sys/sys/ucred.h
@@ -158,8 +158,8 @@ void	crcowfree(struct thread *td);
 void	cru2x(struct ucred *cr, struct xucred *xcr);
 void	cru2xt(struct thread *td, struct xucred *xcr);
 void	crsetgroups(struct ucred *cr, int n, gid_t *groups);
-bool	groupmember(gid_t gid, struct ucred *cred);
-bool	realgroupmember(gid_t gid, struct ucred *cred);
+bool	groupmember(gid_t gid, const struct ucred *cred);
+bool	realgroupmember(gid_t gid, const struct ucred *cred);
 #endif /* _KERNEL */
 
 #endif /* !_SYS_UCRED_H_ */