Commit 2c112b2593 for openssl.org
commit 2c112b259312115ff6a880cf6a3cf47acc7f8b8d
Author: Showta Ishizaki <zakinko@snowrabbit.org>
Date: Fri Nov 13 17:42:58 2026 +0000
crypto/uid.c: use issetugid() on NetBSD
NetBSD has had issetugid() since 1.5, but OPENSSL_issetugid() falls back
to comparing the real and effective ids there. A set-user-ID program
that has dropped its privileges with setuid(getuid()) then looks like
an ordinary one, and the environment variables OpenSSL reads through
ossl_safe_getenv() are trusted again. issetugid() still answers 1
in that case.
Answer with issetugid() on NetBSD, as on the other BSDs.
Link: https://github.com/openssl/openssl/pull/7629
Signed-off-by: Showta Ishizaki <zakinko@snowrabbit.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Thu Nov 26 14:30:22 2026
Merged-from: https://github.com/openssl/openssl/pull/33978
diff --git a/crypto/uid.c b/crypto/uid.c
index c0c62909fd..99b771db6c 100644
--- a/crypto/uid.c
+++ b/crypto/uid.c
@@ -17,7 +17,7 @@ int OPENSSL_issetugid(void)
return 0;
}
-#elif defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) || defined(__DragonFly__) || (defined(__GLIBC__) && defined(__FreeBSD_kernel__))
+#elif defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) || defined(__DragonFly__) || (defined(__GLIBC__) && defined(__FreeBSD_kernel__)) || defined(__NetBSD__)
#include <unistd.h>