[17:21] fiction @ sanctuary [~/irc/ircd] % cvs diff -u -r v2_11_1p1 -rHEAD s_bsd.c Index: s_bsd.c =================================================================== RCS file: /usr/local/repository/irc/ircd/s_bsd.c,v retrieving revision 1.176 retrieving revision 1.181 diff -u -r1.176 -r1.181 --- s_bsd.c 2005/02/21 12:52:24 1.176 +++ s_bsd.c 2006/04/30 15:44:39 1.181 @@ -35,7 +35,7 @@ */ #ifndef lint -static const volatile char rcsid[] = "@(#)$Id: s_bsd.c,v 1.176 2005/02/21 12:52:24 chopin Exp $"; +static const volatile char rcsid[] = "@(#)$Id: s_bsd.c,v 1.181 2006/04/30 15:44:39 q Exp $"; #endif #include "os.h" @@ -212,6 +212,13 @@ SOCK_LEN_TYPE len = sizeof(server); char ipname[20]; + /* broken config? why allow such broken line to live? + ** XXX: fix initconf()? --B. */ + if (!ipmask) + { + sendto_flag(SCH_ERROR, "Invalid P-line"); + return -1; + } ad[0] = ad[1] = ad[2] = ad[3] = 0; /* @@ -550,9 +557,18 @@ static time_t last = 0; static char first = 1; int sp[2], fd, val; + static pid_t iauth_pid = 0; if ((bootopt & BOOT_NOIAUTH) != 0) return; + if (rcvdsig == 2) + { + sendto_flag(SCH_AUTH, "Killing iauth..."); + if (iauth_pid) + kill(iauth_pid, SIGTERM); + iauth_pid = 0; + } + else if (adfd >= 0) { if (rcvdsig) @@ -594,7 +610,7 @@ sizeof(val)) < 0) sendto_flag(SCH_AUTH, "IAUTH_BUFFER too big for sp1 rcvbuf, using default"); - switch (vfork()) + switch ((iauth_pid = vfork())) { case -1: sendto_flag(SCH_ERROR, "vfork() failed!"); @@ -697,6 +713,23 @@ exit(-1); } } + /* Let's assume that if it has define for fd limit, then + it can do core limits, too. --B. */ + if (!getrlimit(RLIMIT_CORE, &limit)) + { + limit.rlim_cur = limit.rlim_max; + if (limit.rlim_cur != RLIM_INFINITY) + { + (void)fprintf(stderr, "warning: max core" + " is not unlimited\n"); + } + if (setrlimit(RLIMIT_CORE, &limit) == -1) + { + (void)fprintf(stderr, "error setting max core to %d\n", + (int) limit.rlim_cur); + exit(-1); + } + } #endif #if !defined(USE_POLL) # ifdef sequent @@ -2047,6 +2080,7 @@ ** it on the end of the receive queue and do it when its ** turn comes around. */ + /* why no poolsize increase here like in send? --B. */ if (length && dbuf_put(&cptr->recvQ, readbuf, length) < 0) return exit_client(cptr, cptr, &me, "dbuf_put fail"); @@ -2107,6 +2141,7 @@ pfd = &poll_fdarray[nbr_pfds++];\ pfd->fd = thisfd; \ pfd->events = 0; \ + pfd->revents = 0; \ } struct pollfd poll_fdarray[MAXCONNECTIONS]; @@ -2704,7 +2739,7 @@ server.SIN_FAMILY = AFINET; get_sockhost(cptr, aconf->host); - if (aconf->source_ip) + if (!BadPtr(aconf->source_ip)) { memset(&outip, 0, sizeof(outip)); outip.SIN_PORT = 0;