git: 5e0787bf710f - stable/13 - cred: Constify signature of groupmember() and realgroupmember()

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Fri, 15 Nov 2024 13:00:43 UTC
The branch stable/13 has been updated by olce:

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

commit 5e0787bf710f1e8c0ae186a32ff39fa2c3ded25d
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-10-30 10:59:49 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-11-15 12:59:07 +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 ae7ccd477955..ea1a7fdbebd4 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 int
-.Fn groupmember "gid_t gid" "struct ucred *cred"
+.Fn groupmember "gid_t gid" "const struct ucred *cred"
 .Ft int
-.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 c80db8efeee8..0ec3df305048 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1303,7 +1303,7 @@ group_is_supplementary(const gid_t gid, const struct ucred *const cred)
  * supplementary groups).
  */
 int
-groupmember(gid_t gid, struct ucred *cred)
+groupmember(gid_t gid, const struct ucred *cred)
 {
 
 	/*
@@ -1324,7 +1324,7 @@ groupmember(gid_t gid, struct ucred *cred)
  * groups).
  */
 int
-realgroupmember(gid_t gid, struct ucred *cred)
+realgroupmember(gid_t gid, const struct ucred *cred)
 {
 	if (gid == cred->cr_rgid)
 		return (1);
diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h
index 837c33757317..74e2d59c57ea 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);
-int	groupmember(gid_t gid, struct ucred *cred);
-int	realgroupmember(gid_t gid, struct ucred *cred);
+int	groupmember(gid_t gid, const struct ucred *cred);
+int	realgroupmember(gid_t gid, const struct ucred *cred);
 #endif /* _KERNEL */
 
 #endif /* !_SYS_UCRED_H_ */