diff -c -N -r irc2.8.21+CSr6/common/bsd.c irc2.8.21+CSr7/common/bsd.c *** irc2.8.21+CSr6/common/bsd.c Mon Jul 31 16:11:43 1995 --- irc2.8.21+CSr7/common/bsd.c Mon Jul 31 16:12:55 1995 *************** *** 85,90 **** --- 85,91 ---- ** *NOTE* alarm calls have been preserved, so this should ** work equally well whether blocking or non-blocking ** mode is used... + ** -- Actually, alarm calls are gone now... - Comstud */ int deliver_it(cptr, str, len) aClient *cptr; diff -c -N -r irc2.8.21+CSr6/common/dbuf.c irc2.8.21+CSr7/common/dbuf.c *** irc2.8.21+CSr6/common/dbuf.c Mon Jul 31 16:11:43 1995 --- irc2.8.21+CSr7/common/dbuf.c Mon Jul 31 16:12:55 1995 *************** *** 44,49 **** --- 44,53 ---- #include "common.h" #include "sys.h" + #ifdef DOG3 + #define VALLOC + #endif + #if !defined(VALLOC) && !defined(valloc) #define valloc malloc #endif *************** *** 59,64 **** --- 63,94 ---- #define DBUFSIZ sizeof(((dbufbuf *)0)->data) + #ifdef DBUF_INIT + + /* dbuf_init--initialize a stretch of memory as dbufs. + Doing this early on should save virtual memory if not real memory.. + at the very least, we get more control over what the server is doing + + mika@cs.caltech.edu 6/24/95 + */ + + void dbuf_init() + { + int i=0; + dbufbuf *dbp; + + freelist = (dbufbuf *)valloc(sizeof(dbufbuf)*DBUF_INIT); + if (!freelist) + return; /* screw this if it doesn't work */ + dbp = freelist; + for(;inext = (dbp+1); + dbp->next = NULL; + dbufblocks++; + } + + #endif /* DBUF_INIT */ + /* ** dbuf_alloc - allocates a dbufbuf structure either from freelist or ** creates a new one. *************** *** 140,145 **** --- 170,178 ---- dyn->head = p->next; dbuf_free(p); } + #ifdef DBUF_TAIL + dyn->tail = dyn->head; + #endif return -1; } *************** *** 150,167 **** --- 183,218 ---- int length; { Reg1 dbufbuf **h, *d; + #ifdef DBUF_TAIL + Reg2 int off; + #else Reg2 int nbr, off; + #endif Reg3 int chunk; off = (dyn->offset + dyn->length) % DBUFSIZ; + #ifndef DBUF_TAIL nbr = (dyn->offset + dyn->length) / DBUFSIZ; + #endif /* ** Locate the last non-empty buffer. If the last buffer is ** full, the loop will terminate with 'd==NULL'. This loop ** assumes that the 'dyn->length' field is correctly ** maintained, as it should--no other check really needed. */ + #ifdef DBUF_TAIL + if (!dyn->length) + h = &(dyn->head); + else + { + if (off) + h = &(dyn->tail); + else + h = &(dyn->tail->next); + } + #else for (h = &(dyn->head); (d = *h) && --nbr >= 0; h = &(d->next)); + #endif /* DBUF_TAIL */ /* ** Append users data to buffer, allocating buffers as needed */ *************** *** 173,178 **** --- 224,232 ---- { if ((d = (dbufbuf *)dbuf_alloc()) == NULL) return dbuf_malloc_error(dyn); + #ifdef DBUF_TAIL + dyn->tail = d; + #endif *h = d; d->next = NULL; } *************** *** 194,199 **** --- 248,256 ---- { if (dyn->head == NULL) { + #ifdef DBUG_TAIL + dyn->tail = NULL; + #endif *length = 0; return NULL; } *************** *** 230,236 **** --- 287,300 ---- chunk = DBUFSIZ; } if (dyn->head == (dbufbuf *)NULL) + #ifdef DBUF_TAIL + { + dyn->tail = NULL; + #endif dyn->length = 0; + #ifdef DBUF_TAIL + } + #endif return 0; } diff -c -N -r irc2.8.21+CSr6/common/match.c irc2.8.21+CSr7/common/match.c *** irc2.8.21+CSr6/common/match.c Mon Jul 31 16:11:43 1995 --- irc2.8.21+CSr7/common/match.c Mon Jul 31 16:12:56 1995 *************** *** 122,129 **** int matches(ma, na) char *ma,*na; { - int r; - calls = 0; return _match(ma, na); } --- 122,127 ---- diff -c -N -r irc2.8.21+CSr6/common/packet.c irc2.8.21+CSr7/common/packet.c *** irc2.8.21+CSr6/common/packet.c Mon Jul 31 16:11:43 1995 --- irc2.8.21+CSr7/common/packet.c Mon Jul 31 16:12:56 1995 *************** *** 49,54 **** --- 49,57 ---- Reg1 char *ch1; Reg2 char *ch2; aClient *acpt = cptr->acpt; + #ifdef DOG3 + register char *cptrbuf = cptr->buffer; + #endif me.receiveB += length; /* Update bytes received */ cptr->receiveB += length; *************** *** 71,81 **** --- 74,94 ---- me.receiveK += (me.receiveB >> 10); me.receiveB &= 0x03ff; } + #ifdef DOG3 + ch1 = cptrbuf + cptr->count; + #else ch1 = cptr->buffer + cptr->count; + #endif ch2 = buffer; while (--length >= 0) { + #ifdef DOG3 + register char *g; + + g = (*ch1 = *ch2++); + #else *ch1 = *ch2++; + #endif /* * Yuck. Stuck. To make sure we stay backward compatible, * we must assume that either CR or LF terminates the message *************** *** 83,91 **** --- 96,112 ---- * of messages, backward compatibility is lost and major * problems will arise. - Avalon */ + #ifdef DOG3 + if ((g < '\16') && (g == '\n' || g == '\r')) + #else if (*ch1 == '\n' || *ch1 == '\r') + #endif { + #ifdef DOG3 + if (ch1 == cptrbuf) + #else if (ch1 == cptr->buffer) + #endif continue; /* Skip extra LF/CR's */ *ch1 = '\0'; me.receiveM += 1; /* Update messages received */ *************** *** 112,122 **** --- 133,155 ---- return exit_client(cptr, cptr, &me, "Dead Socket"); #endif + #ifdef DOG3 + ch1 = cptrbuf; + #else ch1 = cptr->buffer; + #endif } + #ifdef DOG3 + else if (ch1 < cptrbuf + (sizeof(cptr->buffer)-1)) + #else else if (ch1 < cptr->buffer + (sizeof(cptr->buffer)-1)) + #endif ch1++; /* There is always room for the null */ } + #ifdef DOG3 + cptr->count = ch1 - cptrbuf; + #else cptr->count = ch1 - cptr->buffer; + #endif return 0; } diff -c -N -r irc2.8.21+CSr6/common/send.c irc2.8.21+CSr7/common/send.c *** irc2.8.21+CSr6/common/send.c Mon Jul 31 16:11:43 1995 --- irc2.8.21+CSr7/common/send.c Mon Jul 31 16:12:56 1995 *************** *** 33,38 **** --- 33,44 ---- #include "h.h" #include + #ifdef DOG3 + #include "fdlist.h" + extern fdlist serv_fdlist; + void sendto_fdlist(); + #endif + #ifdef IRCII_KLUDGE #define NEWLINE "\n" #else diff -c -N -r irc2.8.21+CSr6/include/comstud.h irc2.8.21+CSr7/include/comstud.h *** irc2.8.21+CSr6/include/comstud.h Mon Jul 31 16:11:43 1995 --- irc2.8.21+CSr7/include/comstud.h Mon Jul 31 16:12:56 1995 *************** *** 1,6 **** --- 1,21 ---- #ifndef COMSTUD_H #define COMSTUD_H + /* DBUF_TAIL - define this if you'd like to use improved + performance dealing with dbufs... + */ + + #define DBUF_TAIL + + /* DBUF_INIT - define this if you want to pre-allocate + 4 megs of dbufs...this should help in + the long run according to dog3 =) + 1000 = 1000*4kb = 4 megs + just #undef if you think it's unneeded =) + */ + + #define DBUF_INIT 1000 + /* IDENTD_ONLY - define this if you only want people running identd to connect Note: Non-identd people are allowed on by *************** *** 227,234 **** and you wish to log clones */ ! #define FNAME_CLONELOG "/home/irc/irc2.8.21+CSr2/logs/clones.log" ! /* DEFAULT_IDLELIMIT - if you have CHECK_IDLE defined above, this value is the default # a client --- 242,248 ---- and you wish to log clones */ ! #define FNAME_CLONELOG "/home/irc/irc2.8.21+CSr7/logs/clones.log" /* DEFAULT_IDLELIMIT - if you have CHECK_IDLE defined above, this value is the default # a client diff -c -N -r irc2.8.21+CSr6/include/config.h irc2.8.21+CSr7/include/config.h *** irc2.8.21+CSr6/include/config.h Mon Jul 31 16:11:43 1995 --- irc2.8.21+CSr7/include/config.h Mon Jul 31 16:12:56 1995 *************** *** 24,33 **** #include "comstud.h" /* Type of host. These should be made redundant somehow. -avalon */ ! #define BSD Nothing Needed 4.{2,3} BSD, SunOS 3.x, 4.x */ /* HPUX Nothing needed (A.08/A.09) */ /* ULTRIX Nothing needed (4.2) */ /* OSF Nothing needed (1.2) */ --- 24,34 ---- #include "comstud.h" + #define COMSTUD_DEBUG /* Type of host. These should be made redundant somehow. -avalon */ ! /* BSD Nothing Needed 4.{2,3} BSD, SunOS 3.x, 4.x */ /* HPUX Nothing needed (A.08/A.09) */ /* ULTRIX Nothing needed (4.2) */ /* OSF Nothing needed (1.2) */ *************** *** 101,108 **** * these are only the recommened names and paths. Change as needed. * You must define these to something, even if you don't really want them. */ ! #define DPATH "/home/irc/irc2.8.21+CSr2/lib" /* dir where all ircd stuff is */ ! #define SPATH "/home/irc/irc2.8.21+CSr2/lib/ircd" #define CPATH "ircd.conf" /* server configuration file */ #define MPATH "ircd.motd" /* server MOTD file */ #define LPATH "ircd.log" /* Where the debug file lives, if DEBUGMODE */ --- 102,109 ---- * these are only the recommened names and paths. Change as needed. * You must define these to something, even if you don't really want them. */ ! #define DPATH "/home/irc/irc2.8.21+CSr7/lib" /* dir where all ircd stuff is */ ! #define SPATH "/home/irc/irc2.8.21+CSr7/lib/ircd" #define CPATH "ircd.conf" /* server configuration file */ #define MPATH "ircd.motd" /* server MOTD file */ #define LPATH "ircd.log" /* Where the debug file lives, if DEBUGMODE */ *************** *** 116,123 **** * successful use of /oper. These are either full paths or files within DPATH. */ ! #define FNAME_USERLOG "/home/irc/irc2.8.21+CSr2/logs/users.log" /* */ ! #define FNAME_OPERLOG "/home/irc/irc2.8.21+CSr2/logs/opers.log" /* */ /* CHROOTDIR * --- 117,124 ---- * successful use of /oper. These are either full paths or files within DPATH. */ ! #define FNAME_USERLOG "/home/irc/irc2.8.21+CSr7/logs/users.log" /* */ ! #define FNAME_OPERLOG "/home/irc/irc2.8.21+CSr7/logs/opers.log" /* */ /* CHROOTDIR * diff -c -N -r irc2.8.21+CSr6/include/dbuf.h irc2.8.21+CSr7/include/dbuf.h *** irc2.8.21+CSr6/include/dbuf.h Mon Jul 31 16:11:43 1995 --- irc2.8.21+CSr7/include/dbuf.h Mon Jul 31 16:12:56 1995 *************** *** 49,54 **** --- 49,57 ---- u_int length; /* Current number of bytes stored */ u_int offset; /* Offset to the first byte */ struct dbufbuf *head; /* First data buffer, if length > 0 */ + #ifdef DBUF_TAIL + struct dbufbuf *tail; /* last data buffer, if length > 0 */ + #endif } dbuf; #else typedef struct dbuf *************** *** 56,61 **** --- 59,67 ---- uint length; /* Current number of bytes stored */ uint offset; /* Offset to the first byte */ struct dbufbuf *head; /* First data buffer, if length > 0 */ + #ifdef DBUF_TAIL + struct dbufbuf *tail; /* last data buffer, if length > 0 */ + #endif } dbuf; #endif /* diff -c -N -r irc2.8.21+CSr6/include/patchlevel.h irc2.8.21+CSr7/include/patchlevel.h *** irc2.8.21+CSr6/include/patchlevel.h Mon Jul 31 16:00:00 1995 --- irc2.8.21+CSr7/include/patchlevel.h Mon Jul 31 16:13:10 1995 *************** *** 17,21 **** */ #ifndef PATCHLEVEL ! #define PATCHLEVEL "2.8.21+CSr6" #endif --- 17,21 ---- */ #ifndef PATCHLEVEL ! #define PATCHLEVEL "2.8.21+CSr7" #endif diff -c -N -r irc2.8.21+CSr6/include/struct.h irc2.8.21+CSr7/include/struct.h *** irc2.8.21+CSr6/include/struct.h Mon Jul 31 16:11:43 1995 --- irc2.8.21+CSr7/include/struct.h Mon Jul 31 16:12:56 1995 *************** *** 442,448 **** #ifdef BAN_INFO struct { char *banstr; ! char who[NICKLEN+1]; time_t when; } ban; #endif --- 442,448 ---- #ifdef BAN_INFO struct { char *banstr; ! char *who; time_t when; } ban; #endif diff -c -N -r irc2.8.21+CSr6/ircd/channel.c irc2.8.21+CSr7/ircd/channel.c *** irc2.8.21+CSr6/ircd/channel.c Mon Jul 31 16:11:44 1995 --- irc2.8.21+CSr7/ircd/channel.c Mon Jul 31 16:12:56 1995 *************** *** 205,211 **** #ifdef BAN_INFO ban->value.ban.banstr = (char *)MyMalloc(strlen(banid)+1); (void)strcpy(ban->value.ban.banstr, banid); ! (void)strcpy(ban->value.ban.who, cptr->name); ban->value.ban.when = time(NULL); #else ban->value.cp = (char *)MyMalloc(strlen(banid)+1); --- 205,212 ---- #ifdef BAN_INFO ban->value.ban.banstr = (char *)MyMalloc(strlen(banid)+1); (void)strcpy(ban->value.ban.banstr, banid); ! ban->value.ban.who = (char *)MyMalloc(strlen(cptr->name)+1); ! (void)strcpy(ban->value.ban.who, cptr->name); ban->value.ban.when = time(NULL); #else ban->value.cp = (char *)MyMalloc(strlen(banid)+1); *************** *** 239,244 **** --- 240,246 ---- *ban = tmp->next; #ifdef BAN_INFO MyFree(tmp->value.ban.banstr); + MyFree(tmp->value.ban.who); #else MyFree(tmp->value.cp); #endif *************** *** 484,490 **** --- 486,496 ---- if (!(lp->flags & mask)) continue; if (mask == CHFL_BAN) + #ifdef BAN_INFO + name = lp->value.ban.banstr; + #else name = lp->value.cp; + #endif else name = lp->value.cptr->name; if (strlen(parabuf) + strlen(name) + 10 < (size_t) MODEBUFLEN) *************** *** 804,810 **** me.name, cptr->name, chptr->chname, #ifdef BAN_INFO ! lp->value.cp, lp->value.ban.who, lp->value.ban.when); #else --- 810,816 ---- me.name, cptr->name, chptr->chname, #ifdef BAN_INFO ! lp->value.ban.banstr, lp->value.ban.who, lp->value.ban.when); #else *************** *** 1278,1283 **** --- 1284,1290 ---- tmp = tmp->next; #ifdef BAN_INFO MyFree(obtmp->value.ban.banstr); + MyFree(obtmp->value.ban.who); #else MyFree(obtmp->value.cp); #endif diff -c -N -r irc2.8.21+CSr6/ircd/ircd.c irc2.8.21+CSr7/ircd/ircd.c *** irc2.8.21+CSr6/ircd/ircd.c Mon Jul 31 16:11:44 1995 --- irc2.8.21+CSr7/ircd/ircd.c Mon Jul 31 16:12:57 1995 *************** *** 469,476 **** time_t delay = 0, now; struct rlimit r; ! r.rlim_cur = 1023; ! r.rlim_max = 1023; setrlimit(RLIMIT_NOFILE, &r); #ifdef IDLE_CHECK idlelimit = DEFAULT_IDLELIMIT*60; --- 469,479 ---- time_t delay = 0, now; struct rlimit r; ! #ifdef DBUF_INIT ! dbuf_init(); /* set up some dbuf stuff to control paging */ ! #endif ! r.rlim_cur = MAXCONNECTIONS; ! r.rlim_max = MAXCONNECTIONS; setrlimit(RLIMIT_NOFILE, &r); #ifdef IDLE_CHECK idlelimit = DEFAULT_IDLELIMIT*60; diff -c -N -r irc2.8.21+CSr6/ircd/s_debug.c irc2.8.21+CSr7/ircd/s_debug.c *** irc2.8.21+CSr6/ircd/s_debug.c Mon Jul 31 16:11:44 1995 --- irc2.8.21+CSr7/ircd/s_debug.c Mon Jul 31 16:12:57 1995 *************** *** 138,143 **** --- 138,146 ---- #ifdef IDENTD_ONLY 'd', #endif + #ifdef DBUF_TAIL + 'D', + #endif #ifdef OPER_CAN_FLOOD2 'f', #endif diff -c -N -r irc2.8.21+CSr6/ircd/s_serv.c irc2.8.21+CSr7/ircd/s_serv.c *** irc2.8.21+CSr6/ircd/s_serv.c Mon Jul 31 16:11:44 1995 --- irc2.8.21+CSr7/ircd/s_serv.c Mon Jul 31 16:12:57 1995 *************** *** 1735,1745 **** me.name, parv[0]); return 0; } ! if (strchr(parv[1], '@')) { ! user = parv[1]; ! host = strchr(parv[1], '@'); ! *(host++) = '\0'; if (!*host) host = "*"; if (*user == '~') --- 1735,1753 ---- me.name, parv[0]); return 0; } ! if (strchr(parv[1], '@') || *parv[1] == '*') { ! if (strchr(parv[1], '@')) ! { ! user = parv[1]; ! host = strchr(parv[1], '@'); ! *(host++) = '\0'; ! } ! else ! { ! user = "*"; ! host = parv[1]; ! } if (!*host) host = "*"; if (*user == '~') *************** *** 1761,1766 **** --- 1769,1780 ---- { if (!(acptr = find_chasing(sptr, parv[1], NULL))) return 0; + if (IsServer(acptr)) + { + sendto_one(sptr, ":%s NOTICE %s :Can't KLINE a server, use @'s where appropriate", + me.name, parv[0]); + return 0; + } strcpy(tempuser, "*"); if (*acptr->user->username == '~') strcat(tempuser, (char *)acptr->user->username+1); *************** *** 1983,1989 **** /* Only opers see users if there is a wildcard * but anyone can see all the opers. */ ! if (IsOper(sptr) && (MyClient(sptr) || !(dow && IsInvisible(acptr))) || !dow || IsAnOper(acptr)) { --- 1997,2003 ---- /* Only opers see users if there is a wildcard * but anyone can see all the opers. */ ! if (IsAnOper(sptr) && (MyClient(sptr) || !(dow && IsInvisible(acptr))) || !dow || IsAnOper(acptr)) {