Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Apr 2026 13:44:05 +0000
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e2d48181239e - stable/14 - inetd: don't assume that initgroups(3) will set the egid
Message-ID:  <69dba1a5.40cd1.1d04e601@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by kevans:

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

commit e2d48181239e99b825862156cd5d6a9756875125
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2025-08-08 22:34:56 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-04-12 13:43:36 +0000

    inetd: don't assume that initgroups(3) will set the egid
    
    inetd, in the ident provider, seems to be the only initgroups(3)
    caller in base that assumes it will set the egid.  Everyone else uses it
    as it's typically used on other platforms: to initialize supplementary
    groups.
    
    (cherry picked from commit 33dd42e632982ba324789f47041d03ceb65f6560)
---
 usr.sbin/inetd/builtins.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/usr.sbin/inetd/builtins.c b/usr.sbin/inetd/builtins.c
index aed304ae99c2..0de2179ef52b 100644
--- a/usr.sbin/inetd/builtins.c
+++ b/usr.sbin/inetd/builtins.c
@@ -606,6 +606,8 @@ ident_stream(int s, struct servtab *sep)
 		 */
 		if (initgroups(pw->pw_name, pw->pw_gid) == -1)
 			iderror(lport, fport, s, ID_UNKNOWN);
+		if (setegid(pw->pw_gid) == -1)
+			iderror(lport, fport, s, ID_UNKNOWN);
 		if (seteuid(pw->pw_uid) == -1)
 			iderror(lport, fport, s, ID_UNKNOWN);
 		/*


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69dba1a5.40cd1.1d04e601>