openbsd-ports/net/ircd-ratbox/patches/patch-src_ircd_c
simon cef96c6e30 import ircd-ratbox
ircd-ratbox is an advanced, stable and fast ircd.
It is the primary ircd used on EFNet, combining the stability of an ircd
required for a large production network together with a rich set of
features, making it also suitable for use on smaller networks. 

Features include:
 * optional SSL support to enable encrypted connections between clients
   and servers, as well as server to server links
 * support for SSL only channels (channel mode +S)
 * uses sqlite3 for handling and storing k/x/d lines
 * support for global CIDR limits
 * provides adminwall command allowing admins to broadcast messages to
   each other
 * support to force nick changes

request, testing and feedback by Michiel van Baak
setusercontext() idea from form@ via bernd@
tested on armish and ok by sthen@
2009-02-09 09:41:54 +00:00

32 lines
782 B
Plaintext

$OpenBSD: patch-src_ircd_c,v 1.1.1.1 2009/02/09 09:41:54 simon Exp $
--- src/ircd.c.orig Sun Feb 8 23:12:35 2009
+++ src/ircd.c Sun Feb 8 23:15:04 2009
@@ -242,7 +242,6 @@ make_daemon(void)
}
else if(pid > 0)
{
- print_startup(pid);
exit(EXIT_SUCCESS);
}
@@ -535,8 +534,17 @@ ratbox_main(int argc, char *argv[])
#ifndef _WIN32
if(geteuid() == 0)
{
- fprintf(stderr, "Don't run ircd as root!!!\n");
- exit(EXIT_FAILURE);
+ struct passwd *pw;
+
+ if ((pw = getpwnam(IRCD_USER)) == NULL) {
+ fprintf(stderr, "Don't run ircd as root!!!\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (setusercontext(NULL, pw, pw->pw_uid, LOGIN_SETALL) < 0) {
+ fprintf(stderr, "Can's set user context to %s!\n", IRCD_USER);
+ exit(EXIT_FAILURE);
+ }
}
#endif
init_sys();