freebsd-src/libexec/tftpd
Kyle Evans 5138a20765 tftpd: explicitly set egid after dropping supplemental groups
tftpd seems to be the last program in base that implicitly relies on
setgroups() to set the egid.  This is a security landmine in portable
software as most operating systems don't behave this way, so do an
explicit setgid() in case the kernel doesn't set it already.

While we're here, FreeBSD's setgroups() has supported nominally clearing
all supplemental groups since 1997.  It still leaves the egid in our
cr_groups[0] because we don't have an out-of-band way to store the egid,
and on other systems it'll clear the supplemental group entirely as one
would want.

Reviewed by:	allanjude (previous version), des, olce
Differential Revision:	https://reviews.freebsd.org/D51149
2025-07-24 09:59:07 -05:00
..
tests src: Use gnu17 as the default C standard for userland instead of gnu99 2025-02-11 09:16:25 -05:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend.options Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
tftp-file.c libexec: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
tftp-file.h tftpd: Drop unneeded includes. 2024-05-10 23:16:26 +02:00
tftp-io.c tftpd: Satisfy clang-analyzer. 2024-05-10 23:16:26 +02:00
tftp-io.h tftpd: Drop unneeded includes. 2024-05-10 23:16:26 +02:00
tftp-options.c libexec: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
tftp-options.h tftpd: Drop unneeded includes. 2024-05-10 23:16:26 +02:00
tftp-transfer.c libexec: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
tftp-transfer.h tftpd: Drop unneeded includes. 2024-05-10 23:16:26 +02:00
tftp-utils.c tftpd: Satisfy clang-analyzer. 2024-05-10 23:16:26 +02:00
tftp-utils.h tftpd: Satisfy clang-analyzer. 2024-05-10 23:16:26 +02:00
tftpd.8 tftpd: Address flaky tests 2024-11-03 16:47:38 +00:00
tftpd.c tftpd: explicitly set egid after dropping supplemental groups 2025-07-24 09:59:07 -05:00