370c7f2f0f
Similar diff and typo fix from Adam Jeanguenat <avj at voyager dot 6v6 dot org> ok sthen@
34 lines
886 B
Plaintext
34 lines
886 B
Plaintext
$OpenBSD: patch-src_ircd_c,v 1.5 2013/10/31 01:23:26 brad Exp $
|
|
--- src/ircd.c.orig Fri Oct 25 16:40:44 2013
|
|
+++ src/ircd.c Wed Oct 30 20:44:28 2013
|
|
@@ -136,7 +136,6 @@ make_daemon(void)
|
|
}
|
|
else if (pid > 0)
|
|
{
|
|
- print_startup(pid);
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
|
|
@@ -468,8 +467,19 @@ main(int argc, char *argv[])
|
|
/* Check to see if the user is running us as root, which is a nono */
|
|
if (geteuid() == 0)
|
|
{
|
|
- fprintf(stderr, "Don't run ircd as root!!!\n");
|
|
- return -1;
|
|
+ struct passwd *pw;
|
|
+
|
|
+ if ((pw = getpwnam(IRCD_USER)) == NULL)
|
|
+ {
|
|
+ fprintf(stderr, "Don't run ircd as root!!!\n");
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ if (setusercontext(NULL, pw, pw->pw_uid, LOGIN_SETALL) < 0)
|
|
+ {
|
|
+ fprintf(stderr, "Can't set user context to %s!\n", IRCD_USER);
|
|
+ return -1;
|
|
+ }
|
|
}
|
|
|
|
/* Setup corefile size immediately after boot -kre */
|