Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-10]: src/external/apache2/mDNSResponder/dist/mDNSPosix Pull up fo...



details:   https://anonhg.NetBSD.org/src/rev/7af9b81f4608
branches:  netbsd-10
changeset: 376049:7af9b81f4608
user:      martin <martin%NetBSD.org@localhost>
date:      Sun May 28 10:20:08 2023 +0000

description:
Pull up following revision(s) (requested by andvar in ticket #183):

        external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c: revision 1.15

reapply changes for the built-in drop-privs support by tsarna.

this commit doesn't reapply "dumping of the unicast server list
to the DumpStateLog debugging output" enhancement.
It doesn't build anymore, no idea how to rewrite.

Should fix PR 57442. Needs pull-ups for netbsd-9, netbsd-10.

diffstat:

 external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c |  18 +++++++++++-
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 17861ca69fbb -r 7af9b81f4608 external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c
--- a/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c       Sun May 28 10:14:35 2023 +0000
+++ b/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c       Sun May 28 10:20:08 2023 +0000
@@ -50,6 +50,10 @@ extern int daemon(int, int);
 #include "PlatformCommon.h"
 #include "DNSCommon.h"
 
+#ifndef MDNSD_USER
+#define MDNSD_USER "nobody"
+#endif
+
 #define CONFIG_FILE "/etc/mdnsd.conf"
 static domainname DynDNSZone;                // Default wide-area zone for service registration
 static domainname DynDNSHostname;
@@ -190,11 +194,21 @@ int main(int argc, char **argv)
     // Now that we're finished with anything privileged, switch over to running as "nobody"
     if (mStatus_NoError == err)
     {
-        const struct passwd *pw = getpwnam("nobody");
+        const struct passwd *pw = getpwnam(MDNSD_USER);
         if (pw != NULL)
+       {
+            setgid(pw->pw_gid);
             setuid(pw->pw_uid);
+       }
         else
-            LogMsg("WARNING: mdnsd continuing as root because user \"nobody\" does not exist");
+#ifdef MDNSD_NOROOT
+        {
+            LogMsg("WARNING: mdnsd exiting because user \""MDNSD_USER"\" does not exist");
+            err = mStatus_Invalid;
+        }
+#else
+            LogMsg("WARNING: mdnsd continuing as root because user \""MDNSD_USER"\" does not exist");
+#endif
     }
 
     if (mStatus_NoError == err)



Home | Main Index | Thread Index | Old Index