git: e665c0f6f7a6 - main - sys/rpc: UNIX auth: Use AUTH_SYS_MAX_{GROUPS,HOSTNAME} as limits (2/2)

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Tue, 14 Oct 2025 12:22:51 UTC
The branch main has been updated by olce:

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

commit e665c0f6f7a611d25d9d7e7f64d98c84b3a92820
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-10-07 13:33:53 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-10-14 12:21:49 +0000

    sys/rpc: UNIX auth: Use AUTH_SYS_MAX_{GROUPS,HOSTNAME} as limits (2/2)
    
    Remove local defines from 'svc_auth_unix.c' and use the new limit
    macros instead.
    
    Reviewed by:    rmacklem
    MFC after:      2 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D52963
---
 sys/rpc/svc_auth_unix.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sys/rpc/svc_auth_unix.c b/sys/rpc/svc_auth_unix.c
index aad4e7610795..b3389bc79511 100644
--- a/sys/rpc/svc_auth_unix.c
+++ b/sys/rpc/svc_auth_unix.c
@@ -50,9 +50,6 @@
 
 #include <rpc/rpc_com.h>
 
-#define MAX_MACHINE_NAME	255
-#define NGRPS			16
-
 /*
  * Unix longhand authenticator
  */
@@ -76,7 +73,7 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
 	if (buf != NULL) {
 		time = IXDR_GET_UINT32(buf);
 		str_len = (size_t)IXDR_GET_UINT32(buf);
-		if (str_len > MAX_MACHINE_NAME) {
+		if (str_len > AUTH_SYS_MAX_HOSTNAME) {
 			stat = AUTH_BADCRED;
 			goto done;
 		}
@@ -85,7 +82,7 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
 		xcr->cr_uid = IXDR_GET_UINT32(buf);
 		xcr->cr_gid = IXDR_GET_UINT32(buf);
 		supp_ngroups = (size_t)IXDR_GET_UINT32(buf);
-		if (supp_ngroups > NGRPS) {
+		if (supp_ngroups > AUTH_SYS_MAX_GROUPS) {
 			stat = AUTH_BADCRED;
 			goto done;
 		}