git: 1fa29df2cd37 - stable/14 - sys/rpc: UNIX auth: Support XDR_FREE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Dec 2025 09:19:11 UTC
The branch stable/14 has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=1fa29df2cd37e74daa95c1150ec284b269db2e1f
commit 1fa29df2cd37e74daa95c1150ec284b269db2e1f
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-10-13 15:13:09 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-12-19 09:16:45 +0000
sys/rpc: UNIX auth: Support XDR_FREE
xdr_authunix_parms() does not allocate any auxiliary memory, so we can
simply support XDR_FREE by just returning TRUE.
Although there are currently no callers passing XDR_FREE, this makes us
immune to such a change in a way that doesn't cost more but is more
constructive than a mere KASSERT().
Suggested by: rmacklem
MFC after: 2 days
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 4ae70c3ea498e06676040ee99254d261e29ae82e)
---
sys/rpc/authunix_prot.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/rpc/authunix_prot.c b/sys/rpc/authunix_prot.c
index 5189a279da8b..e72a28130882 100644
--- a/sys/rpc/authunix_prot.c
+++ b/sys/rpc/authunix_prot.c
@@ -65,6 +65,10 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred)
uint32_t junk;
char hostbuf[MAXHOSTNAMELEN];
+ if (xdrs->x_op == XDR_FREE)
+ /* This function does not allocate auxiliary memory. */
+ return (TRUE);
+
if (xdrs->x_op == XDR_ENCODE) {
getcredhostname(NULL, hostbuf, sizeof(hostbuf));
namelen = strlen(hostbuf);