]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix the resesuid() shim implementation for NetBSD
authorOndřej Surý <ondrej@isc.org>
Tue, 20 Aug 2024 07:14:31 +0000 (09:14 +0200)
committerOndřej Surý <ondrej@isc.org>
Tue, 20 Aug 2024 09:32:35 +0000 (11:32 +0200)
The shim implementation of setresuid() was wrong - there was a copy and
paste error and it was calling setresgid() instead.  This only affects
NetBSD because Linux, FreeBSD and OpenBSD have setresuid() and
setresgid() implementation available from the system library.

bin/named/os.c

index 9efc114479d58a92a237ede51c0472c16efde837..f07d943550c2a913e866778c3cd5760dc16a5f5e 100644 (file)
@@ -295,11 +295,11 @@ setresuid(uid_t ruid, uid_t euid, uid_t suid) {
        REQUIRE(ruid == (uid_t)-1);
        REQUIRE(suid == (uid_t)-1);
 
-#if HAVE_SETREGID
-       return (setregid(ruid, euid));
-#else  /* HAVE_SETREGID */
-       return (setegid(euid));
-#endif /* HAVE_SETREGID */
+#if HAVE_SETREUID
+       return (setreuid(ruid, euid));
+#else  /* HAVE_SETREUID */
+       return (seteuid(euid));
+#endif /* HAVE_SETREUID */
 }
 #endif /* !HAVE_SETRESUID */