Date: Fri, 19 Dec 2025 09:19:13 +0000 From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 67a2afe25ab8 - stable/14 - sys/rpc: UNIX auth: Do not log on bogus AUTH_SYS messages Message-ID: <69451891.3ed10.68037e29@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=67a2afe25ab8c4f93f82624d0f0a00cfa22f83bb commit 67a2afe25ab8c4f93f82624d0f0a00cfa22f83bb Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2025-10-14 12:54:55 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2025-12-19 09:16:46 +0000 sys/rpc: UNIX auth: Do not log on bogus AUTH_SYS messages Remove the printf() stances added in commit d4cc791f3b2e ("sys/rpc: UNIX auth: Fix OOB reads on too short message"). Even if it can be helpful to know why an authentication message is rejected, printing explanatory messages on each request attempt is a remote log filler that could be triggered by accident, and the generic RPC code generally does not do that. These printf() calls should be restored only after some limiting or configuration mechanism is devised. MFC with: d4cc791f3b2e ("sys/rpc: UNIX auth: Fix OOB reads on too short message") Sponsored by: The FreeBSD Foundation (cherry picked from commit 2110ae0ef9d6ca8cf52b29fcaf926c4343f56826) --- sys/rpc/svc_auth_unix.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/sys/rpc/svc_auth_unix.c b/sys/rpc/svc_auth_unix.c index 6d2cb2359ffd..46e339019f88 100644 --- a/sys/rpc/svc_auth_unix.c +++ b/sys/rpc/svc_auth_unix.c @@ -45,7 +45,6 @@ static char *sccsid = "@(#)svc_auth_unix.c 2.3 88/08/01 4.0 RPCSRC"; */ #include <sys/param.h> -#include <sys/systm.h> #include <sys/ucred.h> #include <rpc/rpc.h> @@ -74,11 +73,8 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg) const uint32_t min_len = 5 * BYTES_PER_XDR_UNIT; uint32_t str_len, supp_ngroups; - if (auth_len < min_len) { - (void)printf("AUTH_SYS: Too short credentials (%u)\n", - auth_len); + if (auth_len < min_len) goto badcred; - } time = IXDR_GET_UINT32(buf); str_len = IXDR_GET_UINT32(buf); if (str_len > AUTH_SYS_MAX_HOSTNAME) @@ -89,12 +85,8 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg) * 'str_len' (and that it won't cause an overflow in additions * below) to protect access to the credentials part. */ - if (auth_len < min_len + str_len) { - (void)printf("AUTH_SYS: Inconsistent credentials and " - "host name lengths (%u, %u)\n", - auth_len, str_len); + if (auth_len < min_len + str_len) goto badcred; - } buf += str_len / sizeof (int32_t); xcr->cr_uid = IXDR_GET_UINT32(buf); xcr->cr_gid = IXDR_GET_UINT32(buf); @@ -112,14 +104,8 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg) * read in total. */ if (auth_len < min_len + str_len + - supp_ngroups * BYTES_PER_XDR_UNIT) { - (void)printf("AUTH_SYS: Inconsistent lengths " - "(credentials %u, machine name %u, " - "supplementary groups %u)\n", - auth_len, str_len, - supp_ngroups * BYTES_PER_XDR_UNIT); + supp_ngroups * BYTES_PER_XDR_UNIT) goto badcred; - } /* * Note that 'xcr' is a 'struct xucred', which still has thehelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69451891.3ed10.68037e29>
