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 c0c6290..99b771d 100644
--- a/crypto/uid.c
+++ b/crypto/uid.c
@@ -17,7 +17,7 @@
     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>