Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/external/apache2/mDNSResponder/dist/mDNSPosix Pull up fol...
details: https://anonhg.NetBSD.org/src/rev/904dd69def2c
branches: netbsd-9
changeset: 376052:904dd69def2c
user: martin <martin%NetBSD.org@localhost>
date: Sun May 28 10:21:15 2023 +0000
description:
Pull up following revision(s) (requested by andvar in ticket #1634):
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 bd2112448a2d -r 904dd69def2c external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c
--- a/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c Mon May 15 10:26:43 2023 +0000
+++ b/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c Sun May 28 10:21:15 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