2011-10-19 09:46:17 -04:00
|
|
|
$OpenBSD: patch-src_ircd_c,v 1.2 2011/10/19 13:46:17 jasper Exp $
|
|
|
|
--- src/ircd.c.orig Thu Aug 18 12:21:47 2011
|
|
|
|
+++ src/ircd.c Fri Oct 14 16:13:29 2011
|
|
|
|
@@ -144,7 +144,6 @@ make_daemon(void)
|
2009-02-09 10:14:22 -05:00
|
|
|
}
|
|
|
|
else if (pid > 0)
|
|
|
|
{
|
|
|
|
- print_startup(pid);
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2011-10-19 09:46:17 -04:00
|
|
|
@@ -488,8 +487,19 @@ main(int argc, char *argv[])
|
|
|
|
*/
|
2009-02-09 10:14:22 -05:00
|
|
|
if (geteuid() == 0)
|
|
|
|
{
|
|
|
|
- fprintf(stderr, "Don't run ircd as root!!!\n");
|
2011-10-19 09:46:17 -04:00
|
|
|
- return -1;
|
2009-02-09 10:14:22 -05:00
|
|
|
+ struct passwd *pw;
|
|
|
|
+
|
|
|
|
+ if ((pw = getpwnam(IRCD_USER)) == NULL)
|
|
|
|
+ {
|
|
|
|
+ fprintf(stderr, "Don't run ircd as root!!!\n");
|
2011-10-19 09:46:17 -04:00
|
|
|
+ return -1;
|
2009-02-09 10:14:22 -05:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (setusercontext(NULL, pw, pw->pw_uid, LOGIN_SETALL) < 0)
|
|
|
|
+ {
|
|
|
|
+ fprintf(stderr, "Can's set user context to %s!\n", IRCD_USER);
|
2011-10-19 09:46:17 -04:00
|
|
|
+ return -1;
|
2009-02-09 10:14:22 -05:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup corefile size immediately after boot -kre */
|