2012-11-05 18:45:30 -05:00
|
|
|
$OpenBSD: patch-src_ircd_c,v 1.3 2012/11/05 23:45:30 brad Exp $
|
|
|
|
--- src/ircd.c.orig Sat Jul 21 16:39:18 2012
|
|
|
|
+++ src/ircd.c Sat Jul 21 18:03:14 2012
|
|
|
|
@@ -132,7 +132,6 @@ make_daemon(void)
|
2009-02-09 10:14:22 -05:00
|
|
|
}
|
|
|
|
else if (pid > 0)
|
|
|
|
{
|
|
|
|
- print_startup(pid);
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2012-11-05 18:45:30 -05:00
|
|
|
@@ -482,8 +481,19 @@ main(int argc, char *argv[])
|
2011-10-19 09:46:17 -04:00
|
|
|
*/
|
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 */
|