tech-net archive

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

rtadvd(8) for rump



I plan to check in the attached patch to rtadvd(8) to make it work
better under rump.

It removes the privsep code when built as rump.rtadvd.

I can't think of a way of setting up a path to a rump server socket that
remains the same across a call to chroot(2).

Any comments ?

Index: rtadvd.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/rtadvd/rtadvd.c,v
retrieving revision 1.79
diff -u -r1.79 rtadvd.c
--- rtadvd.c	28 Aug 2020 00:19:37 -0000	1.79
+++ rtadvd.c	28 Aug 2020 00:23:21 -0000
@@ -181,7 +181,9 @@
 	struct timespec *timeout;
 	int i, ch;
 	int fflag = 0, logopt;
+#ifndef RUMP_ACTION
 	struct passwd *pw;
+#endif
 	const char *pidfilepath = NULL;
 	pid_t pid;
 
@@ -245,6 +247,7 @@
 	if (dflag == 1)
 		(void)setlogmask(LOG_UPTO(LOG_INFO));
 
+#ifndef RUMP_ACTION
 	errno = 0; /* Ensure errno is 0 so we know if getpwnam errors or not */
 	if ((pw = getpwnam(RTADVD_USER)) == NULL) {
 		if (errno == 0)
@@ -255,6 +258,7 @@
 			logit(LOG_ERR, "getpwnam: %s: %m", RTADVD_USER);
 		return EXIT_FAILURE;
 	}
+#endif
 
 	/* timer initialization */
 	rtadvd_timer_init();
@@ -281,7 +285,7 @@
 		set[1].events = POLLIN;
 	} else
 		set[1].fd = -1;
-
+#ifndef RUMP_ACTION
 	logit(LOG_INFO, "dropping privileges to %s", RTADVD_USER);
 	if (prog_chroot(pw->pw_dir) == -1) {
 		logit(LOG_ERR, "chroot: %s: %m", pw->pw_dir);
@@ -298,7 +302,7 @@
 		logit(LOG_ERR, "failed to drop privileges: %m");
 		return EXIT_FAILURE;
 	}
-
+#endif
 	signal(SIGINT, set_die);
 	signal(SIGTERM, set_die);
 	signal(SIGHUP, set_reconf);


Home | Main Index | Thread Index | Old Index