From: Gabriel B. <sh...@us...> - 2007-04-09 22:59:19
|
Update of /cvsroot/solidircd/solidircd-stable/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv13985/src Modified Files: channel.c glines.c ircd.c klines.c md5.c Log Message: Bahamut 1.8.4 latest changes part 1, this is not complete yet. Index: glines.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/glines.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** glines.c 18 Mar 2006 05:37:00 -0000 1.6 --- glines.c 9 Apr 2007 22:59:07 -0000 1.7 *************** *** 1,593 **** ! /* ! * glines.c - gline interface and storage ! * Copyright (C) 2005 Trevor Talbot and ! * the DALnet coding team ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 1, or (at your option) ! * any later version. ! * [...1175 lines suppressed...] ! *s = 0; ! ! if (!gs_read(buf1)) ! break; ! } ! ! fclose(jf); ! ! /* this will reopen the journal for appending */ ! return glinestore_compact(); ! } ! ! u_long ! memcount_glines(MCglines *mc) ! { ! mc->file = __FILE__; ! ! return 0; ! } \ No newline at end of file Index: md5.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/md5.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** md5.c 27 Jun 2005 03:02:36 -0000 1.1.1.1 --- md5.c 9 Apr 2007 22:59:08 -0000 1.2 *************** *** 1,274 **** ! /* ! * This is an OpenSSL-compatible implementation of the RSA Data Security, ! * Inc. MD5 Message-Digest Algorithm. ! * ! * Written by Solar Designer <so...@op...> in 2001, and placed in ! * the public domain. There's absolutely no warranty. ! * ! * This differs from Colin Plumb's older public domain implementation in ! * that no 32-bit integer data type is required, there's no compile-time ! * endianness configuration, and the function prototypes match OpenSSL's. ! * The primary goals are portability and ease of use. ! * ! * This implementation is meant to be fast, but not as fast as possible. ! * Some known optimizations are not included to reduce source code size ! * and avoid compile-time configuration. ! */ ! ! #if !defined(HAVE_SSL) ! ! #include <string.h> ! ! #include "md5.h" ! ! /* ! * The basic MD5 functions. ! * ! * F is optimized compared to its RFC 1321 definition just like in Colin ! * Plumb's implementation. ! */ ! #define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) ! #define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) ! #define H(x, y, z) ((x) ^ (y) ^ (z)) ! #define I(x, y, z) ((y) ^ ((x) | ~(z))) ! ! /* ! * The MD5 transformation for all four rounds. ! */ ! #define STEP(f, a, b, c, d, x, t, s) \ ! (a) += f((b), (c), (d)) + (x) + (t); \ ! (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ ! (a) += (b); ! ! /* ! * SET reads 4 input bytes in little-endian byte order and stores them ! * in a properly aligned word in host byte order. ! * ! * The check for little-endian architectures which tolerate unaligned ! * memory accesses is just an optimization. Nothing will break if it ! * doesn't work. ! */ ! #if defined(__i386__) || defined(__vax__) ! #define SET(n) \ ! (*(MD5_u32plus *)&ptr[(n) * 4]) ! #define GET(n) \ ! SET(n) ! #else ! #define SET(n) \ ! (ctx->block[(n)] = \ ! (MD5_u32plus)ptr[(n) * 4] | \ ! ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ ! ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ ! ((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) ! #define GET(n) \ ! (ctx->block[(n)]) ! #endif ! ! /* ! * This processes one or more 64-byte data blocks, but does NOT update ! * the bit counters. There're no alignment requirements. ! */ ! static void *body(MD5_CTX *ctx, void *data, unsigned long size) ! { ! unsigned char *ptr; ! MD5_u32plus a, b, c, d; ! MD5_u32plus saved_a, saved_b, saved_c, saved_d; ! ! ptr = data; ! ! a = ctx->a; ! b = ctx->b; ! c = ctx->c; ! d = ctx->d; ! ! do { ! saved_a = a; ! saved_b = b; ! saved_c = c; ! saved_d = d; ! ! /* Round 1 */ ! STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) ! STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) ! STEP(F, c, d, a, b, SET(2), 0x242070db, 17) ! STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) ! STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) ! STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) ! STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) ! STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) ! STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) ! STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) ! STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) ! STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) ! STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) ! STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) ! STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) ! STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) ! ! /* Round 2 */ ! STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) ! STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) ! STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) ! STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) ! STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) ! STEP(G, d, a, b, c, GET(10), 0x02441453, 9) ! STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) ! STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) ! STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) ! STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) ! STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) ! STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) ! STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) ! STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) ! STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) ! STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) ! ! /* Round 3 */ ! STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) ! STEP(H, d, a, b, c, GET(8), 0x8771f681, 11) ! STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) ! STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23) ! STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) ! STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11) ! STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) ! STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23) ! STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) ! STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11) ! STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) ! STEP(H, b, c, d, a, GET(6), 0x04881d05, 23) ! STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) ! STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11) ! STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) ! STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23) ! ! /* Round 4 */ ! STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) ! STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) ! STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) ! STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) ! STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) ! STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) ! STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) ! STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) ! STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) ! STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) ! STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) ! STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) ! STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) ! STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) ! STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) ! STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) ! ! a += saved_a; ! b += saved_b; ! c += saved_c; ! d += saved_d; ! ! ptr += 64; ! } while (size -= 64); ! ! ctx->a = a; ! ctx->b = b; ! ctx->c = c; ! ctx->d = d; ! ! return ptr; ! } ! ! void MD5_Init(MD5_CTX *ctx) ! { ! ctx->a = 0x67452301; ! ctx->b = 0xefcdab89; ! ctx->c = 0x98badcfe; ! ctx->d = 0x10325476; ! ! ctx->lo = 0; ! ctx->hi = 0; ! } ! ! void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) ! { ! MD5_u32plus saved_lo; ! unsigned long used, free; ! ! saved_lo = ctx->lo; ! if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) ! ctx->hi++; ! ctx->hi += size >> 29; ! ! used = saved_lo & 0x3f; ! ! if (used) { ! free = 64 - used; ! ! if (size < free) { ! memcpy(&ctx->buffer[used], data, size); ! return; ! } ! ! memcpy(&ctx->buffer[used], data, free); ! data = (unsigned char *)data + free; ! size -= free; ! body(ctx, ctx->buffer, 64); ! } ! ! if (size >= 64) { ! data = body(ctx, data, size & ~(unsigned long)0x3f); ! size &= 0x3f; ! } ! ! memcpy(ctx->buffer, data, size); ! } ! ! void MD5_Final(unsigned char *result, MD5_CTX *ctx) ! { ! unsigned long used, free; ! ! used = ctx->lo & 0x3f; ! ! ctx->buffer[used++] = 0x80; ! ! free = 64 - used; ! ! if (free < 8) { ! memset(&ctx->buffer[used], 0, free); ! body(ctx, ctx->buffer, 64); ! used = 0; ! free = 64; ! } ! ! memset(&ctx->buffer[used], 0, free - 8); ! ! ctx->lo <<= 3; ! ctx->buffer[56] = ctx->lo; ! ctx->buffer[57] = ctx->lo >> 8; ! ctx->buffer[58] = ctx->lo >> 16; ! ctx->buffer[59] = ctx->lo >> 24; ! ctx->buffer[60] = ctx->hi; ! ctx->buffer[61] = ctx->hi >> 8; ! ctx->buffer[62] = ctx->hi >> 16; ! ctx->buffer[63] = ctx->hi >> 24; ! ! body(ctx, ctx->buffer, 64); ! ! result[0] = ctx->a; ! result[1] = ctx->a >> 8; ! result[2] = ctx->a >> 16; ! result[3] = ctx->a >> 24; ! result[4] = ctx->b; ! result[5] = ctx->b >> 8; ! result[6] = ctx->b >> 16; ! result[7] = ctx->b >> 24; ! result[8] = ctx->c; ! result[9] = ctx->c >> 8; ! result[10] = ctx->c >> 16; ! result[11] = ctx->c >> 24; ! result[12] = ctx->d; ! result[13] = ctx->d >> 8; ! result[14] = ctx->d >> 16; ! result[15] = ctx->d >> 24; ! ! memset(ctx, 0, sizeof(ctx)); ! } ! ! #endif --- 1,274 ---- ! /* ! * This is an OpenSSL-compatible implementation of the RSA Data Security, ! * Inc. MD5 Message-Digest Algorithm. ! * ! * Written by Solar Designer <so...@op...> in 2001, and placed in ! * the public domain. There's absolutely no warranty. ! * ! * This differs from Colin Plumb's older public domain implementation in ! * that no 32-bit integer data type is required, there's no compile-time ! * endianness configuration, and the function prototypes match OpenSSL's. ! * The primary goals are portability and ease of use. ! * ! * This implementation is meant to be fast, but not as fast as possible. ! * Some known optimizations are not included to reduce source code size ! * and avoid compile-time configuration. ! */ ! ! #if !defined(HAVE_SSL) ! ! #include <string.h> ! ! #include "md5.h" ! ! /* ! * The basic MD5 functions. ! * ! * F is optimized compared to its RFC 1321 definition just like in Colin ! * Plumb's implementation. ! */ ! #define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) ! #define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) ! #define H(x, y, z) ((x) ^ (y) ^ (z)) ! #define I(x, y, z) ((y) ^ ((x) | ~(z))) ! ! /* ! * The MD5 transformation for all four rounds. ! */ ! #define STEP(f, a, b, c, d, x, t, s) \ ! (a) += f((b), (c), (d)) + (x) + (t); \ ! (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ ! (a) += (b); ! ! /* ! * SET reads 4 input bytes in little-endian byte order and stores them ! * in a properly aligned word in host byte order. ! * ! * The check for little-endian architectures which tolerate unaligned ! * memory accesses is just an optimization. Nothing will break if it ! * doesn't work. ! */ ! #if defined(__i386__) || defined(__vax__) ! #define SET(n) \ ! (*(MD5_u32plus *)&ptr[(n) * 4]) ! #define GET(n) \ ! SET(n) ! #else ! #define SET(n) \ ! (ctx->block[(n)] = \ ! (MD5_u32plus)ptr[(n) * 4] | \ ! ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ ! ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ ! ((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) ! #define GET(n) \ ! (ctx->block[(n)]) ! #endif ! ! /* ! * This processes one or more 64-byte data blocks, but does NOT update ! * the bit counters. There're no alignment requirements. ! */ ! static void *body(MD5_CTX *ctx, void *data, unsigned long size) ! { ! unsigned char *ptr; ! MD5_u32plus a, b, c, d; ! MD5_u32plus saved_a, saved_b, saved_c, saved_d; ! ! ptr = data; ! ! a = ctx->a; ! b = ctx->b; ! c = ctx->c; ! d = ctx->d; ! ! do { ! saved_a = a; ! saved_b = b; ! saved_c = c; ! saved_d = d; ! ! /* Round 1 */ ! STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) ! STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) ! STEP(F, c, d, a, b, SET(2), 0x242070db, 17) ! STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) ! STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) ! STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) ! STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) ! STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) ! STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) ! STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) ! STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) ! STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) ! STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) ! STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) ! STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) ! STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) ! ! /* Round 2 */ ! STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) ! STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) ! STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) ! STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) ! STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) ! STEP(G, d, a, b, c, GET(10), 0x02441453, 9) ! STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) ! STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) ! STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) ! STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) ! STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) ! STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) ! STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) ! STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) ! STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) ! STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) ! ! /* Round 3 */ ! STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) ! STEP(H, d, a, b, c, GET(8), 0x8771f681, 11) ! STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) ! STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23) ! STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) ! STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11) ! STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) ! STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23) ! STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) ! STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11) ! STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) ! STEP(H, b, c, d, a, GET(6), 0x04881d05, 23) ! STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) ! STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11) ! STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) ! STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23) ! ! /* Round 4 */ ! STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) ! STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) ! STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) ! STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) ! STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) ! STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) ! STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) ! STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) ! STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) ! STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) ! STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) ! STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) ! STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) ! STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) ! STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) ! STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) ! ! a += saved_a; ! b += saved_b; ! c += saved_c; ! d += saved_d; ! ! ptr += 64; ! } while (size -= 64); ! ! ctx->a = a; ! ctx->b = b; ! ctx->c = c; ! ctx->d = d; ! ! return ptr; ! } ! ! void MD5_Init(MD5_CTX *ctx) ! { ! ctx->a = 0x67452301; ! ctx->b = 0xefcdab89; ! ctx->c = 0x98badcfe; ! ctx->d = 0x10325476; ! ! ctx->lo = 0; ! ctx->hi = 0; ! } ! ! void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) ! { ! MD5_u32plus saved_lo; ! unsigned long used, free; ! ! saved_lo = ctx->lo; ! if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) ! ctx->hi++; ! ctx->hi += size >> 29; ! ! used = saved_lo & 0x3f; ! ! if (used) { ! free = 64 - used; ! ! if (size < free) { ! memcpy(&ctx->buffer[used], data, size); ! return; ! } ! ! memcpy(&ctx->buffer[used], data, free); ! data = (unsigned char *)data + free; ! size -= free; ! body(ctx, ctx->buffer, 64); ! } ! ! if (size >= 64) { ! data = body(ctx, data, size & ~(unsigned long)0x3f); ! size &= 0x3f; ! } ! ! memcpy(ctx->buffer, data, size); ! } ! ! void MD5_Final(unsigned char *result, MD5_CTX *ctx) ! { ! unsigned long used, free; ! ! used = ctx->lo & 0x3f; ! ! ctx->buffer[used++] = 0x80; ! ! free = 64 - used; ! ! if (free < 8) { ! memset(&ctx->buffer[used], 0, free); ! body(ctx, ctx->buffer, 64); ! used = 0; ! free = 64; ! } ! ! memset(&ctx->buffer[used], 0, free - 8); ! ! ctx->lo <<= 3; ! ctx->buffer[56] = ctx->lo; ! ctx->buffer[57] = ctx->lo >> 8; ! ctx->buffer[58] = ctx->lo >> 16; ! ctx->buffer[59] = ctx->lo >> 24; ! ctx->buffer[60] = ctx->hi; ! ctx->buffer[61] = ctx->hi >> 8; ! ctx->buffer[62] = ctx->hi >> 16; ! ctx->buffer[63] = ctx->hi >> 24; ! ! body(ctx, ctx->buffer, 64); ! ! result[0] = ctx->a; ! result[1] = ctx->a >> 8; ! result[2] = ctx->a >> 16; ! result[3] = ctx->a >> 24; ! result[4] = ctx->b; ! result[5] = ctx->b >> 8; ! result[6] = ctx->b >> 16; ! result[7] = ctx->b >> 24; ! result[8] = ctx->c; ! result[9] = ctx->c >> 8; ! result[10] = ctx->c >> 16; ! result[11] = ctx->c >> 24; ! result[12] = ctx->d; ! result[13] = ctx->d >> 8; ! result[14] = ctx->d >> 16; ! result[15] = ctx->d >> 24; ! ! memset(ctx, 0, sizeof(ctx)); ! } ! ! #endif Index: ircd.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/ircd.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ircd.c 26 Dec 2005 05:21:38 -0000 1.7 --- ircd.c 9 Apr 2007 22:59:07 -0000 1.8 *************** *** 106,114 **** float curSendK = 0, curRecvK = 0; ! #ifdef LOCKFILE ! extern time_t pending_kline_time; ! extern struct pkl *pending_klines; ! extern void do_pending_klines(void); ! #endif extern void engine_read_message(int); --- 106,110 ---- float curSendK = 0, curRecvK = 0; ! extern void engine_read_message(int); *************** *** 317,320 **** --- 313,319 ---- if (aconn->port <= 0 || aconn->class->connfreq == 0) continue; + if (aconn->legal == -1) + continue; + cltmp = aconn->class; *************** *** 580,584 **** /* found the ircd.conf in the directory local * to our binary itself */ ! strcpy(configfile, tmp); close(fd); strcpy(dpath, t_d2path); --- 579,583 ---- /* found the ircd.conf in the directory local * to our binary itself */ ! strcpy(configfile, tmp2); close(fd); strcpy(dpath, t_d2path); *************** *** 660,664 **** char REPORT_DO_DNS[256], REPORT_FIN_DNS[256], REPORT_FIN_DNSC[256], REPORT_FAIL_DNS[256], REPORT_DO_ID[256], REPORT_FIN_ID[256], ! REPORT_FAIL_ID[256]; FILE *dumpfp=NULL; --- 659,663 ---- char REPORT_DO_DNS[256], REPORT_FIN_DNS[256], REPORT_FIN_DNSC[256], REPORT_FAIL_DNS[256], REPORT_DO_ID[256], REPORT_FIN_ID[256], ! REPORT_FAIL_ID[256], REPORT_REJECT_ID[256]; FILE *dumpfp=NULL; *************** *** 905,908 **** --- 904,908 ---- sprintf(REPORT_FIN_ID, REPORT_FIN_ID_, me.name); sprintf(REPORT_FAIL_ID, REPORT_FAIL_ID_, me.name); + sprintf(REPORT_REJECT_ID, REPORT_REJECT_ID_, me.name); R_do_dns = strlen(REPORT_DO_DNS); R_fin_dns = strlen(REPORT_FIN_DNS); *************** *** 1209,1222 **** flush_connections(me.fd); - #ifdef LOCKFILE - /* - * * If we have pending klines and CHECK_PENDING_KLINES minutes - * have passed, try writing them out. -ThemBones - */ - - if ((pending_klines) && ((timeofday - pending_kline_time) - >= (CHECK_PENDING_KLINES * 60))) - do_pending_klines(); - #endif } } --- 1209,1212 ---- Index: channel.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/channel.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** channel.c 9 Apr 2007 16:01:10 -0000 1.23 --- channel.c 9 Apr 2007 22:59:07 -0000 1.24 *************** *** 108,112 **** return 0; ! for (c = (unsigned char *) msg; *c; c++) { /* not a control code */ --- 108,112 ---- return 0; ! for (c = msg; *c; c++) { /* not a control code */ *************** *** 824,885 **** #endif ! int check_joinrate(aChannel *chptr, time_t ts, int local, aClient *cptr) { ! int join_num = DEFAULT_JOIN_NUM; ! int join_time = DEFAULT_JOIN_TIME; ! if(!local && (NOW - ts) > 60) ! return 1; /* attempt to compensate for lag */ ! /* This first section checks the defaults, the second ! * checks the channels +j settings */ ! /* Has the join_time period elapsed? */ ! if((NOW - chptr->default_join_start) > join_time) { ! chptr->default_join_start = NOW; ! chptr->default_join_count = 0; } ! /* update the count here for attempts, in case a lower throttle blocks */ ! chptr->default_join_count++; ! /* If it's local and we've filled the join count, complain ! * to ops so they can take the appropriate measures */ ! if(local && chptr->default_join_count > join_num) ! sendto_realops_lev(DEBUG_LEV, "Join rate warning on %s for %s!%s@%s" ! " (%d in %d)", ! chptr->chname, cptr->name, cptr->user->username, ! cptr->hostip, chptr->default_join_count, ! NOW - chptr->default_join_start); ! /* Has the channel set their own custom settings? */ ! if(chptr->mode.mode & MODE_JOINRATE) { ! if(chptr->mode.join_num == 0 || chptr->mode.join_time == 0) ! return 1; /* channel has turned this off */ ! join_time = chptr->mode.join_time; ! join_num = chptr->mode.join_num; } ! /* Has the join_time period elapsed? */ ! if((NOW - chptr->join_start) > join_time) { ! chptr->join_start = NOW; ! chptr->join_count = 0; ! return 1; } ! /* If it's local and we've filled the join count, say no */ ! if(local && chptr->join_count >= join_num) { ! sendto_realops_lev(DEBUG_LEV, "Join rate throttling on %s for %s!%s@%s" ! " (%d/%d in %d/%d)", ! chptr->chname, cptr->name, cptr->user->username, ! cptr->hostip, chptr->join_count, join_num, ! NOW - chptr->join_start, join_time); ! return 0; } - return 1; } /* * adds a user to a channel by adding another link to the channels * member chain. --- 824,994 ---- #endif ! ! /* refill join rate warning token bucket, and count a join attempt */ ! static void ! jrw_update(aChannel *chptr) { ! int adj_delta; ! int bkt_delta; ! if (chptr->jrw_bucket < DEFAULT_JOIN_SIZE && NOW > chptr->jrw_last) ! { ! adj_delta = NOW - chptr->jrw_last; ! bkt_delta = DEFAULT_JOIN_SIZE - chptr->jrw_bucket; ! ! /* avoid overflow for long timespans */ ! if (adj_delta < bkt_delta) ! adj_delta *= DEFAULT_JOIN_NUM; ! ! if (adj_delta > bkt_delta) ! adj_delta = bkt_delta; ! ! chptr->jrw_bucket += adj_delta; ! ! /* bucket has a free fill (not join) slot, reset debt counter */ ! if (chptr->jrw_bucket >= DEFAULT_JOIN_NUM) ! chptr->jrw_debt_ctr = 0; ! } ! ! if (chptr->jrw_bucket >= -(DEFAULT_JOIN_SIZE - DEFAULT_JOIN_TIME)) ! chptr->jrw_bucket -= DEFAULT_JOIN_TIME; ! ! /* warning bucket is always current, which pins it at the rate limit */ ! chptr->jrw_last = NOW; ! ! /* for statistical purposes, keep count of join attempts */ ! if (chptr->jrw_debt_ctr++ == 0) ! chptr->jrw_debt_ts = NOW; ! } ! /* refill join rate throttling token bucket */ ! static void ! jrl_update(aChannel *chptr) ! { ! int adj_delta; ! int bkt_delta; ! int jnum, jsize; ! ! jnum = chptr->mode.jr_num; ! jsize = chptr->mode.jrl_size; ! ! /* throttling disabled */ ! if (!jsize) ! return; ! ! if (chptr->jrl_bucket < jsize && NOW > chptr->jrl_last) { ! adj_delta = NOW - chptr->jrl_last; ! bkt_delta = jsize - chptr->jrl_bucket; ! ! /* avoid overflow for long timespans */ ! if (adj_delta < bkt_delta) ! adj_delta *= jnum; ! ! if (adj_delta > bkt_delta) ! adj_delta = bkt_delta; ! ! chptr->jrl_bucket += adj_delta; } ! } ! /* ! * Do pre-JOIN updates. Called for local joins only. ! */ ! static void ! joinrate_prejoin(aChannel *chptr) ! { ! jrl_update(chptr); ! jrw_update(chptr); ! } ! ! /* ! * Check if a join would be allowed, warning if appropriate. ! * Called for local joins only. ! */ ! static int ! joinrate_check(aChannel *chptr, aClient *cptr, int warn) ! { ! int jnum, jtime, jsize; ! ! jnum = chptr->mode.jr_num; ! jtime = chptr->mode.jr_time; ! jsize = chptr->mode.jrl_size; ! ! /* join throttling disabled */ ! if (!jsize) ! return 1; ! ! /* free slot in bucket */ ! if (chptr->jrl_bucket >= jtime) ! return 1; ! ! /* throttled */ ! if (warn) { ! sendto_realops_lev(DEBUG_LEV, "Join rate throttling on %s for" ! " %s!%s@%s (%d%s in %d)", chptr->chname, ! cptr->name, cptr->user->username, cptr->hostip, ! jnum, (chptr->jrl_bucket < 0) ? "+" : "", jtime); ! } ! return 0; ! } ! /* ! * Do post-JOIN updates. Called for both local and remote joins. ! */ ! static void ! joinrate_dojoin(aChannel *chptr, aClient *cptr) ! { ! int jtime, jsize; ! int local; ! ! local = MyConnect(cptr); ! jtime = chptr->mode.jr_time; ! jsize = chptr->mode.jrl_size; ! ! if (!local) ! { ! jrw_update(chptr); ! jrl_update(chptr); } ! else if (chptr->jrw_bucket <= 0 && chptr->jrw_debt_ctr) { ! sendto_realops_lev(DEBUG_LEV, "Join rate warning on %s for %s!%s@%s" ! " (%d in %d) [joined]", chptr->chname, cptr->name, ! cptr->user->username, cptr->hostip, ! chptr->jrw_debt_ctr, NOW - chptr->jrw_debt_ts); } ! /* remote joins cause negative penalty here (distributed throttling) */ ! /* WARNING: joinrate_check must have allowed a local join */ ! if (jsize) { ! if (local || chptr->jrl_bucket >= -(jsize - jtime)) ! { ! chptr->jrl_bucket -= jtime; ! chptr->jrl_last = NOW; ! } } } /* + * Send a warning notice if appropriate. Called for local failed joins. + */ + static void + joinrate_warn(aChannel *chptr, aClient *cptr) + { + /* no slots free */ + if (chptr->jrw_bucket <= 0 && chptr->jrw_debt_ctr) + { + sendto_realops_lev(DEBUG_LEV, "Join rate warning on %s for %s!%s@%s" + " (%d in %d) [failed]", chptr->chname, cptr->name, + cptr->user->username, cptr->hostip, + chptr->jrw_debt_ctr, NOW - chptr->jrw_debt_ts); + } + } + + + /* * adds a user to a channel by adding another link to the channels * member chain. *************** *** 998,1007 **** { chanMember *cm; ! if (IsServer(cptr) || IsULine(cptr)) return 0; cm = find_user_member(chptr->members, cptr); ! if(!cm) { --- 1107,1118 ---- { chanMember *cm; ! int ismine; ! if (IsServer(cptr) || IsULine(cptr)) return 0; cm = find_user_member(chptr->members, cptr); ! ismine = MyClient(cptr); ! if(!cm) { *************** *** 1012,1022 **** if ((chptr->mode.mode & MODE_MODREG) && !IsRegNick(cptr)) return (ERR_NEEDREGGEDNICK); ! if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(msg)) ! return (ERR_NOCTRLSONCHAN); ! if (MyClient(cptr) && is_banned(cptr, chptr, NULL)) ! return (MODE_BAN); /* * channel is -n and user is not there; * we need to bquiet them if we can ! */ } else --- 1123,1137 ---- if ((chptr->mode.mode & MODE_MODREG) && !IsRegNick(cptr)) return (ERR_NEEDREGGEDNICK); ! if (ismine) ! { ! if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(msg)) ! return (ERR_NOCTRLSONCHAN); ! if (is_banned(cptr, chptr, NULL)) ! return (MODE_BAN); ! ! /* * channel is -n and user is not there; * we need to bquiet them if we can ! } */ } else *************** *** 1032,1036 **** return (ERR_NEEDREGGEDNICK); } ! if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(msg)) return (ERR_NOCTRLSONCHAN); } --- 1147,1153 ---- return (ERR_NEEDREGGEDNICK); } ! /* control code blocking isn't flood-critical, so only check locally */ ! if (ismine && (chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(msg)) ! return (ERR_NOCTRLSONCHAN); } *************** *** 1126,1130 **** } } ! if (chptr->mode.mode & MODE_JOINRATE) { *mbuf++ = 'j'; --- 1243,1247 ---- } } ! if (chptr->mode.mode & MODE_JOINRATE) { *mbuf++ = 'j'; *************** *** 1132,1144 **** if (IsMember(cptr, chptr) || IsServer(cptr) || IsULine(cptr)) { ! char tmp[128]; if(pbuf[0] != '\0') strcat(pbuf, " "); ! if(chptr->mode.join_num == 0 || chptr->mode.join_time == 0) ircsprintf(tmp, "0"); else ! ircsprintf(tmp, "%d:%d", chptr->mode.join_num, ! chptr->mode.join_time); strcat(pbuf, tmp); --- 1249,1261 ---- if (IsMember(cptr, chptr) || IsServer(cptr) || IsULine(cptr)) { ! char tmp[16]; if(pbuf[0] != '\0') strcat(pbuf, " "); ! if(chptr->mode.jr_num == 0 || chptr->mode.jr_time == 0) ircsprintf(tmp, "0"); else ! ircsprintf(tmp, "%d:%d", chptr->mode.jr_num, ! chptr->mode.jr_time); strcat(pbuf, tmp); *************** *** 1149,1152 **** --- 1266,1270 ---- } + static void send_channel_lists(aClient *cptr, aChannel *chptr) { *************** *** 1655,1659 **** if (!IsULine(sptr) && (level<2 || !IsOper(sptr))) { ! errors |= SM_ERR_NOTOPER; break; } --- 1773,1778 ---- if (!IsULine(sptr) && (level<2 || !IsOper(sptr))) { ! errors |= SM_ERR_NOPRIVS; ! break; } *************** *** 2050,2058 **** break; *mbuf++ = 'j'; ! chptr->mode.mode &= ~MODE_JOINRATE; ! chptr->mode.join_num = 0; ! chptr->mode.join_time = 0; ! chptr->join_start = 0; ! chptr->join_count = 0; nmodes++; break; --- 2169,2177 ---- break; *mbuf++ = 'j'; ! chptr->mode.jr_num = DEFAULT_JOIN_NUM; ! chptr->mode.jr_time = DEFAULT_JOIN_TIME; ! chptr->mode.jrl_size = DEFAULT_JOIN_SIZE; ! chptr->jrl_bucket = 0; ! chptr->jrl_last = NOW; /* slow start */ nmodes++; break; *************** *** 2104,2118 **** break; } /* range limit for local non-samodes */ if (MyClient(sptr) && level < 2) { ! /* static limits: time <= 60, 4 <= num <= 60 */ if (j_time > 60) j_time = 60; ! if (j_num > 60) ! j_num = 60; ! if (j_num < 4) ! j_num = 4; /* adjust number to time using min rate 1/8 */ --- 2223,2243 ---- break; } + /* safety cap */ + if (j_num > 127) + j_num = 127; + if (j_time > 127) + j_time = 127; /* range limit for local non-samodes */ if (MyClient(sptr) && level < 2) { ! /* static limits: time <= 60, 2 <= num <= 20 */ if (j_time > 60) j_time = 60; ! if (j_num > 20) ! j_num = 20; ! if (j_num < 2) ! j_num = 2; ! /* adjust number to time using min rate 1/8 */ *************** *** 2144,2151 **** chptr->mode.mode |= MODE_JOINRATE; ! chptr->mode.join_num = j_num; ! chptr->mode.join_time = j_time; ! chptr->join_start = 0; ! chptr->join_count = 0; *mbuf++ = 'j'; ADD_PARA(tmp); --- 2269,2277 ---- chptr->mode.mode |= MODE_JOINRATE; ! chptr->mode.jr_num = j_num; ! chptr->mode.jr_time = j_time; ! chptr->mode.jrl_size = j_num * j_time; ! chptr->jrl_bucket = 0; ! chptr->jrl_last = NOW; /* slow start */ *mbuf++ = 'j'; ADD_PARA(tmp); *************** *** 2468,2471 **** --- 2594,2598 ---- int invited = 0; int error = 0; + int jrl = 0; char *r = NULL; *************** *** 2479,2491 **** } ! if (invited || IsULine(sptr)) return 1; ! ! if (check_joinrate(chptr, NOW, 1, sptr) == 0) ! { ! r = "+j"; ! error = ERR_CHANNELISFULL; ! } ! else if (chptr->mode.mode & MODE_INVITEONLY) { r = "+i"; --- 2606,2614 ---- } ! if (invited) return 1; ! ! joinrate_prejoin(chptr); ! if (chptr->mode.mode & MODE_INVITEONLY) { r = "+i"; *************** *** 2506,2509 **** --- 2629,2639 ---- else if (*chptr->mode.key && (BadPtr(key) || mycmp(chptr->mode.key, key))) error = ERR_BADCHANNELKEY; + else if (!joinrate_check(chptr, sptr, 1)) + { + r = "+j"; + error = ERR_CHANNELISFULL; + jrl = 1; + } + #ifdef HAVE_SSL if (chptr->mode.mode & MODE_SSL && !IsUmodez(sptr)) *************** *** 2519,2523 **** #ifdef INVITE_LISTS ! if (error && is_invited(sptr, chptr)) error = 0; #endif --- 2649,2654 ---- #ifdef INVITE_LISTS ! if (error && !jrl && is_invited(sptr, chptr)) ! error = 0; #endif *************** *** 2532,2535 **** --- 2663,2669 ---- if (error) { + if (!jrl) + joinrate_warn(chptr, sptr); + if (error==ERR_NEEDREGGEDNICK) sendto_one(sptr, getreply(ERR_NEEDREGGEDNICK), me.name, sptr->name, *************** *** 2569,2574 **** } ! if (invited || IsULine(sptr)) return 0; if (chptr->mode.mode & MODE_INVITEONLY) --- 2703,2710 ---- } ! if (invited) return 0; + joinrate_prejoin(chptr); + if (chptr->mode.mode & MODE_INVITEONLY) *************** *** 2582,2586 **** if (chptr->mode.limit && chptr->users >= chptr->mode.limit) reasonbuf[rbufpos++] = 'l'; ! if (check_joinrate(chptr, NOW, 1, sptr) == 0) reasonbuf[rbufpos++] = 'j'; --- 2718,2722 ---- if (chptr->mode.limit && chptr->users >= chptr->mode.limit) reasonbuf[rbufpos++] = 'l'; ! if (!joinrate_check(chptr, sptr, 0)) reasonbuf[rbufpos++] = 'j'; *************** *** 3095,3099 **** else add_user_to_channel(chptr, sptr, 0); ! chptr->join_count++; /* Set timestamp if appropriate, and propagate */ if (MyClient(sptr) && flags == CHFL_CHANOP) --- 3231,3235 ---- else add_user_to_channel(chptr, sptr, 0); ! joinrate_dojoin(chptr, sptr); /* Set timestamp if appropriate, and propagate */ if (MyClient(sptr) && flags == CHFL_CHANOP) *************** *** 3509,3513 **** aClient *acptr; ! if (!(confopts & FLAGS_SERVHUB) || !(cptr->serv->uflags & ULF_NOBTOPIC)) for (chptr = channel; chptr; chptr = chptr->nextch) { --- 3645,3649 ---- aClient *acptr; ! for (chptr = channel; chptr; chptr = chptr->nextch) { *************** *** 3517,3521 **** } ! if (!(confopts & FLAGS_SERVHUB) || !(cptr->serv->uflags & ULF_NOAWAY)) for (acptr = client; acptr; acptr = acptr->next) { --- 3653,3657 ---- } ! for (acptr = client; acptr; acptr = acptr->next) { *************** *** 3749,3754 **** LOpts *lopt = cptr->user->lopt; int hashnum; ! char tempbuff[KEYLEN+8+3+1+3+6]; ! char modestuff[TOPICLEN+3+KEYLEN+8+3+1+6]; for (hashnum = lopt->starthash; hashnum < CH_MAX; hashnum++) --- 3885,3889 ---- LOpts *lopt = cptr->user->lopt; int hashnum; ! for (hashnum = lopt->starthash; hashnum < CH_MAX; hashnum++) *************** *** 3759,3763 **** chptr; chptr = chptr->hnextch) { ! if (SecretChannel(chptr) && !IsAnOper(cptr) && !IsMember(cptr, chptr)) continue; --- 3894,3898 ---- chptr; chptr = chptr->hnextch) { ! if (SecretChannel(chptr) && !IsAdmin(cptr) && !IsMember(cptr, chptr)) continue; *************** *** 3788,3804 **** * then adding an or to the inline. -- Doc. */ ! if (IsAnOper(cptr)) { ! *modebuf = *parabuf = '\0'; ! modebuf[1] = '\0'; ! channel_modes(cptr, modebuf, parabuf, chptr); ! if (SecretChannel(chptr) || HiddenChannel(chptr)) ! ircsprintf(tempbuff, "\002[%s %s]\002", modebuf, parabuf); ! else ! ircsprintf(tempbuff, "[%s %s]", modebuf, parabuf); ! ircsprintf(modestuff, "%-20s %s", tempbuff, chptr->topic); sendto_one(cptr, rpl_str(RPL_LIST), me.name, cptr->name, ! chptr->chname, chptr->users, modestuff); } else { --- 3923,3943 ---- * then adding an or to the inline. -- Doc. */ ! if (IsAdmin(cptr)) { ! char tempchname[CHANNELLEN + 2], *altchname; ! ! if (SecretChannel(chptr)) ! { ! tempchname[0] = '%'; ! strcpy(&tempchname[1], chptr->chname); ! altchname = &tempchname[0]; ! } ! else ! altchname = chptr->chname; ! sendto_one(cptr, rpl_str(RPL_LIST), me.name, cptr->name, ! altchname, chptr->users, chptr->topic); } + else { *************** *** 3823,3827 **** { next = lp->next; ! MyFree(lp->value.cp); free_link(lp); } --- 3962,3966 ---- { next = lp->next; ! MyFree(lp->value.cp); free_link(lp); } *************** *** 3829,3833 **** { next = lp->next; ! MyFree(lp->value.cp); free_link(lp); } --- 3968,3972 ---- { next = lp->next; ! MyFree(lp->value.cp); free_link(lp); } *************** *** 3937,3940 **** --- 4076,4080 ---- { next = lp->next; + MyFree(lp->value.cp); free_link(lp); } *************** *** 3942,3945 **** --- 4082,4086 ---- { next = lp->next; + MyFree(lp->value.cp); free_link(lp); } *************** *** 4622,4627 **** { add_user_to_channel(chptr, sptr, 0); ! chptr->join_count++; ! chptr->default_join_count++; sendto_channel_butserv(chptr, sptr, ":%s JOIN :%s", parv[0], parv[2]); --- 4763,4768 ---- { add_user_to_channel(chptr, sptr, 0); ! joinrate_dojoin(chptr, sptr); ! sendto_channel_butserv(chptr, sptr, ":%s JOIN :%s", parv[0], parv[2]); *************** *** 4693,4703 **** { *tmpb = '\0'; ! tmpb++; ! mode.join_time = atoi(tmpb); } else ! mode.join_time = 0; ! mode.join_num = atoi(tmpa); args++; --- 4834,4845 ---- { *tmpb = '\0'; ! tmpb++; ! mode.jr_time = atoi(tmpb); } else ! mode.jr_time = 0; ! mode.jr_num = atoi(tmpa); ! mode.jrl_size = mode.jr_num * mode.jr_time; args++; *************** *** 4785,4800 **** if (oldmode->mode & MODE_JOINRATE) { ! if ((mode.mode & MODE_JOINRATE) && !mode.join_num) /* 0 wins */ ; ! else if (oldmode->join_num && mode.join_num > oldmode->join_num) /* more joins wins */ ; ! else if (mode.join_num == oldmode->join_num && ! mode.join_time < oldmode->join_time) /* same joins in less time wins */ ; else { /* our settings win */ ! mode.join_num = oldmode->join_num; ! mode.join_time = oldmode->join_time; } } --- 4927,4944 ---- if (oldmode->mode & MODE_JOINRATE) { ! if ((mode.mode & MODE_JOINRATE) && !mode.jr_num) /* 0 wins */ ; ! else if (oldmode->jr_num && mode.jr_num > oldmode->jr_num) /* more joins wins */ ; ! else if (mode.jr_num == oldmode->jr_num && ! mode.jr_time < oldmode->jr_time) /* same joins in less time wins */ ; else { /* our settings win */ ! mode.jr_num = oldmode->jr_num; ! mode.jr_time = oldmode->jr_time; ! mode.jrl_size = oldmode->jrl_size; ! } } *************** *** 4879,4884 **** if ((mode.mode & MODE_JOINRATE) && (!(oldmode->mode & MODE_JOINRATE) || ! (oldmode->join_num != mode.join_num || ! oldmode->join_time != mode.join_time))) { char tmp[128]; --- 5023,5029 ---- if ((mode.mode & MODE_JOINRATE) && (!(oldmode->mode & MODE_JOINRATE) || ! (oldmode->jr_num != mode.jr_num || ! oldmode->jr_time != mode.jr_time))) ! { char tmp[128]; *************** *** 4887,4894 **** *mbuf++ = 'j'; ! if(mode.join_num == 0 || mode.join_time == 0) ircsprintf(tmp, "0"); else ! ircsprintf(tmp, "%d:%d", mode.join_num, mode.join_time); ADD_PARA(tmp) pargs++; --- 5032,5040 ---- *mbuf++ = 'j'; ! if(mode.jr_num == 0 || mode.jr_time == 0) ! ircsprintf(tmp, "0"); else ! ircsprintf(tmp, "%d:%d", mode.jr_num, mode.jr_time); ADD_PARA(tmp) pargs++; *************** *** 4929,4932 **** --- 5075,5081 ---- chptr->mode = mode; + chptr->jrl_bucket = 0; + chptr->jrl_last = NOW; /* slow start */ + if (!keepourmodes) /* deop and devoice everyone! */ Index: klines.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/klines.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** klines.c 4 Sep 2005 05:25:00 -0000 1.1 --- klines.c 9 Apr 2007 22:59:07 -0000 1.2 *************** *** 1,584 **** ! /* ! * klines.c - Kline interface and storage ! * Copyright (C) 2005 Trevor Talbot and ! * the DALnet coding team ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 1, or (at your option) ! * any later version. ! * [...1158 lines suppressed...] ! *s = 0; ! ! if (!ks_read(buf1)) ! break; ! } ! ! fclose(jf); ! ! /* this will reopen the journal for appending */ ! return klinestore_compact(); ! } ! ! u_long ! memcount_klines(MCklines *mc) ! { ! mc->file = __FILE__; ! ! return 0; ! } \ No newline at end of file |