Index: AUTHORS =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/AUTHORS,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -r1.5 -r1.5.2.1 --- AUTHORS 21 Apr 2003 21:33:18 -0000 1.5 +++ AUTHORS 7 Nov 2003 20:51:08 -0000 1.5.2.1 @@ -12,15 +12,22 @@ Main Authors ~~~~~~~~~~~~ -Alexander Barton, , "alex" +Alexander Barton, (alex) Contributors ~~~~~~~~~~~~ -Goetz Hoffart, -Ilja Osthoff, +Goetz Hoffart, (goetz) +Ilja Osthoff, (ilja) Sean Reifschneider, +Code snippets +~~~~~~~~~~~~~ +J. Kercheval: pattern matching functions +Patrick Powell, : snprintf()-function +Andrew Tridgell & Martin Pool: strl{cpy|cat}()-functions + + -- -$Id: AUTHORS,v 1.5 2003/04/21 21:33:18 alex Exp $ +$Id: AUTHORS,v 1.5.2.1 2003/11/07 20:51:08 alex Exp $ Index: ChangeLog =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/ChangeLog,v retrieving revision 1.188.2.17 retrieving revision 1.188.2.18 diff -u -r1.188.2.17 -r1.188.2.18 --- ChangeLog 18 Jul 2003 20:54:47 -0000 1.188.2.17 +++ ChangeLog 7 Nov 2003 20:51:08 -0000 1.188.2.18 @@ -10,8 +10,27 @@ -- ChangeLog -- +ngIRCd 0.7.5 (2003-11-07) + + - Fixed ban behavior: users which are banned from a channel can't no + longer send PRIVMSG's to this channel (fixes Bug #47). + - Fixed and enhanced the "penalty handling" of the server: commands that + require more resources block the client for a short time. + - Changed the internal time resolution to one second. + - New configuration variable "MaxConnectionsIP" to limit the number of + simultaneous connections from a single IP that the server will accept. + This configuration options lowers the risk of denial of service attacks + (DoS), the default is 5 connections per client IP. + - Fixed build problems under Mac OS X 10.3. + - Use "-pipe" when compiling with gcc, speeds things up a little :-) + - Added new configuration variable "Listen" to bind all listening + sockets of the server to a single IP address. + - Suppress misleading error message of diff during make run. + - Enhanced test-suite and made it work on GNU/Hurd. + - Fixed minor typo in debug output :-) + ngIRCd 0.7.1 (2003-07-18) - + - Included files to build Debian packages (located in "debian/"). - Updated config.guess and config.sub to newer upstream versions. - NJOIN propagates user channel modes correctly again ... Upsa. @@ -458,4 +477,4 @@ -- -$Id: ChangeLog,v 1.188.2.17 2003/07/18 20:54:47 alex Exp $ +$Id: ChangeLog,v 1.188.2.18 2003/11/07 20:51:08 alex Exp $ Index: NEWS =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/NEWS,v retrieving revision 1.53.2.4 retrieving revision 1.53.2.5 diff -u -r1.53.2.4 -r1.53.2.5 --- NEWS 18 Jul 2003 20:54:47 -0000 1.53.2.4 +++ NEWS 7 Nov 2003 20:51:08 -0000 1.53.2.5 @@ -10,6 +10,15 @@ -- NEWS -- +ngIRCd 0.7.5 (2003-07-11) + + - New configuration variable "MaxConnectionsIP" to limit the number of + simultaneous connections from a single IP that the server will accept. + This configuration options lowers the risk of denial of service attacks + (DoS), the default is 5 connections per client IP. + - Added new configuration variable "Listen" to bind all listening + sockets of the server to a single IP address. + ngIRCd 0.7.1 (2003-07-18) - Added support for GNU/Hurd. @@ -165,4 +174,4 @@ -- -$Id: NEWS,v 1.53.2.4 2003/07/18 20:54:47 alex Exp $ +$Id: NEWS,v 1.53.2.5 2003/11/07 20:51:08 alex Exp $ Index: config.guess =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/config.guess,v retrieving revision 1.1.8.1 retrieving revision 1.1.8.2 diff -u -r1.1.8.1 -r1.1.8.2 --- config.guess 9 Jul 2003 21:04:42 -0000 1.1.8.1 +++ config.guess 7 Nov 2003 21:04:21 -0000 1.1.8.2 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2003-05-19' +timestamp='2003-10-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -106,6 +106,7 @@ : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; @@ -282,6 +283,9 @@ # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -320,6 +324,9 @@ NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; @@ -727,7 +734,7 @@ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -744,7 +751,7 @@ *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) + *:FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -756,7 +763,10 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + # GNU/KFreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -767,8 +777,8 @@ i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks @@ -789,8 +799,13 @@ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; @@ -878,6 +893,9 @@ s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; @@ -935,6 +953,9 @@ LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 @@ -1036,7 +1057,7 @@ exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1151,7 +1172,7 @@ *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) @@ -1192,6 +1213,9 @@ *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 Index: config.sub =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/config.sub,v retrieving revision 1.1.8.1 retrieving revision 1.1.8.2 diff -u -r1.1.8.1 -r1.1.8.2 --- config.sub 9 Jul 2003 21:04:42 -0000 1.1.8.1 +++ config.sub 7 Nov 2003 21:04:47 -0000 1.1.8.2 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2003-05-09' +timestamp='2003-10-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -118,7 +118,7 @@ # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -228,13 +228,14 @@ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | clipper \ + | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | ip2k \ + | ip2k | iq2000 \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ @@ -247,6 +248,7 @@ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ @@ -261,7 +263,7 @@ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ - | tahoe | thumb | tic80 | tron \ + | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ @@ -304,7 +306,7 @@ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ + | ip2k-* | iq2000-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ @@ -319,6 +321,7 @@ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ @@ -771,18 +774,24 @@ pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; + pentium4) + basic_machine=i786-pc + ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pn) basic_machine=pn-gould ;; @@ -841,6 +850,10 @@ sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -848,6 +861,9 @@ basic_machine=sh-hitachi os=-hms ;; + sh64) + basic_machine=sh64-unknown + ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks @@ -922,10 +938,6 @@ basic_machine=t90-cray os=-unicos ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff @@ -1119,7 +1131,7 @@ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ @@ -1131,7 +1143,7 @@ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1155,6 +1167,9 @@ -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -1277,6 +1292,9 @@ arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 Index: configure.in =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/configure.in,v retrieving revision 1.89.2.10 retrieving revision 1.89.2.11 diff -u -r1.89.2.10 -r1.89.2.11 --- configure.in 18 Jul 2003 20:55:10 -0000 1.89.2.10 +++ configure.in 7 Nov 2003 20:51:08 -0000 1.89.2.11 @@ -8,13 +8,13 @@ # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # -# $Id: configure.in,v 1.89.2.10 2003/07/18 20:55:10 alex Exp $ +# $Id: configure.in,v 1.89.2.11 2003/11/07 20:51:08 alex Exp $ # # -- Initialisierung -- AC_PREREQ(2.50) -AC_INIT(ngircd, 0.7.1) +AC_INIT(ngircd, 0.7.5) AC_CONFIG_SRCDIR(src/ngircd/ngircd.c) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.6) @@ -271,7 +271,7 @@ ansi=" -ansi" pedantic=" -pedantic" - $CC --version | grep 20020420 > /dev/null 2>&1 + $CC --version | grep 20020420 >/dev/null 2>&1 if test $? -eq 0; then # Mac OS X (and Darwin?) ship with a slightly broken # prerelease of GCC 3.1 which don't like -pedantic: @@ -279,7 +279,16 @@ pedantic="" fi - uname | grep "CYGWIN" > /dev/null 2>&1 + $CC --version | grep 20030304 >/dev/null 2>&1 + if test $? -eq 0; then + # Mac OS X 10.3 (and Darwin 7.0?) have a strange gcc (or + # system header files?) which produces lots of errors when + # using -ansi; so we don't =:-) + AC_MSG_RESULT([detected broken GNU C compiler, disabling "-ansi"]) + ansi="" + fi + + uname | grep "CYGWIN" >/dev/null 2>&1 if test $? -eq 0; then # The include files of Cygwin don't like -ansi, # so we disable it: @@ -287,7 +296,7 @@ ansi="" fi - add_CFLAGS="-Wall -W${ansi}${pedantic} $CFLAGS $CFLAGS_ADD" + add_CFLAGS="-pipe -Wall -W${ansi}${pedantic} $CFLAGS $CFLAGS_ADD" else the_CFLAGS="$CFLAGS" add_CFLAGS="$CFLAGS_ADD" Index: MacOSX/ngircd.pbproj/project.pbxproj =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/MacOSX/ngircd.pbproj/project.pbxproj,v retrieving revision 1.26 retrieving revision 1.26.2.1 diff -u -r1.26 -r1.26.2.1 --- MacOSX/ngircd.pbproj/project.pbxproj 19 Mar 2003 20:09:51 -0000 1.26 +++ MacOSX/ngircd.pbproj/project.pbxproj 7 Nov 2003 20:51:08 -0000 1.26.2.1 @@ -218,7 +218,8 @@ ); isa = PBXGroup; name = Products; - refType = 4; + path = ""; + refType = 2; }; //1A0 //1A1 @@ -421,10 +422,10 @@ }; F51F791401DFD0DE01D13771 = { children = ( - FA550F3103D59CB300A85B04, F5263AEF01E2A9B801CE8F8F, F51F791501DFD0DE01D13771, F5E9447D02C9EE2801A85B04, + FA0B193305060CB800A85B04, F5B565290325412B01A85B04, F5E9447E02C9EE2801A85B04, F5E9447F02C9EE2801A85B04, @@ -433,8 +434,8 @@ ); isa = PBXGroup; name = doc; - path = /Users/alex/Develop/ngircd/doc; - refType = 0; + path = ../doc; + refType = 2; }; F51F791501DFD0DE01D13771 = { fileEncoding = 5; @@ -477,8 +478,8 @@ ); isa = PBXGroup; name = testsuite; - path = /Users/alex/Develop/ngircd/src/testsuite; - refType = 0; + path = ../src/testsuite; + refType = 2; }; F520AEA90335E29001A85B04 = { fileEncoding = 5; @@ -593,8 +594,8 @@ ); isa = PBXGroup; name = man; - path = /Users/alex/Develop/ngircd/man; - refType = 0; + path = ../man; + refType = 2; }; F520AF180335F1B801A85B04 = { fileEncoding = 5; @@ -691,8 +692,9 @@ F576ABFE01D61D7401A85B03, ); isa = PBXGroup; - path = ngircd; - refType = 4; + name = ngircd; + path = ../src/ngircd; + refType = 2; }; F52162BB01C7B904012300F4 = { fileEncoding = 5; @@ -1034,7 +1036,7 @@ ); isa = PBXGroup; path = ngircd.pbproj; - refType = 4; + refType = 2; }; F56D8BA101E0BFA00155ADA7 = { fileEncoding = 5; @@ -1275,7 +1277,8 @@ ); isa = PBXGroup; name = contrib; - refType = 4; + path = ""; + refType = 2; }; F5D3536203892AD201A85B04 = { fileEncoding = 5; @@ -1377,8 +1380,8 @@ ); isa = PBXGroup; name = portab; - path = /Users/alex/Develop/ngircd/src; - refType = 0; + path = ../src/portab; + refType = 2; }; F5F18133023EC63701A85B04 = { fileEncoding = 5; @@ -1443,6 +1446,13 @@ //FA2 //FA3 //FA4 + FA0B193305060CB800A85B04 = { + fileEncoding = 5; + isa = PBXFileReference; + name = Platforms.txt; + path = ../doc/Platforms.txt; + refType = 2; + }; FA42C8AD03C0A00B00A85B04 = { fileEncoding = 4; isa = PBXFileReference; @@ -1503,7 +1513,8 @@ ); isa = PBXGroup; name = tool; - refType = 4; + path = ../src; + refType = 2; }; FA550F2A03D59C8200A85B04 = { fileEncoding = 5; @@ -1550,93 +1561,6 @@ settings = { }; }; - FA550F3103D59CB300A85B04 = { - children = ( - FA550F3503D59CD800A85B04, - FA550F3403D59CD800A85B04, - FA550F3703D59CD800A85B04, - FA550F3203D59CD800A85B04, - FA550F3303D59CD800A85B04, - FA550F3603D59CD800A85B04, - FA550F3803D59CD800A85B04, - FA550F3903D59CD800A85B04, - FA550F3A03D59CD800A85B04, - FA550F3B03D59CD800A85B04, - ); - isa = PBXGroup; - name = de; - refType = 4; - }; - FA550F3203D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = CVS.txt; - path = ../doc/de/CVS.txt; - refType = 2; - }; - FA550F3303D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = FAQ.txt; - path = ../doc/de/FAQ.txt; - refType = 2; - }; - FA550F3403D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = INSTALL; - path = ../doc/de/INSTALL; - refType = 2; - }; - FA550F3503D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = Makefile.am; - path = ../doc/de/Makefile.am; - refType = 2; - }; - FA550F3603D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = Protocol.txt; - path = ../doc/de/Protocol.txt; - refType = 2; - }; - FA550F3703D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = README; - path = ../doc/de/README; - refType = 2; - }; - FA550F3803D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = "README-AUX.txt"; - path = "../doc/de/README-AUX.txt"; - refType = 2; - }; - FA550F3903D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = "README-BeOS.txt"; - path = "../doc/de/README-BeOS.txt"; - refType = 2; - }; - FA550F3A03D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = RFC.txt; - path = ../doc/de/RFC.txt; - refType = 2; - }; - FA550F3B03D59CD800A85B04 = { - fileEncoding = 5; - isa = PBXFileReference; - name = "sample-ngircd.conf"; - path = "../doc/de/sample-ngircd.conf"; - refType = 2; - }; FAC0383C03BB318400A85B04 = { fileRef = F51044520297ABF80173DE11; isa = PBXBuildFile; Index: contrib/ngircd.spec =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/contrib/ngircd.spec,v retrieving revision 1.2.4.4 retrieving revision 1.2.4.5 diff -u -r1.2.4.4 -r1.2.4.5 --- contrib/ngircd.spec 18 Jul 2003 20:55:10 -0000 1.2.4.4 +++ contrib/ngircd.spec 7 Nov 2003 20:51:08 -0000 1.2.4.5 @@ -1,5 +1,5 @@ %define name ngircd -%define version 0.7.1 +%define version 0.7.5 %define release 1 %define prefix %{_prefix} Index: debian/changelog =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/debian/changelog,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -u -r1.2.2.4 -r1.2.2.5 --- debian/changelog 18 Jul 2003 20:55:10 -0000 1.2.2.4 +++ debian/changelog 7 Nov 2003 21:05:15 -0000 1.2.2.5 @@ -1,3 +1,9 @@ +ngircd (0.7.5-0.1ab) unstable; urgency=low + + * New upstream version. + + -- Alexander Barton Fri, 7 Nov 2003 21:59:58 +0100 + ngircd (0.7.1-0.1ab) unstable; urgency=low * New upstream version :-) Index: doc/sample-ngircd.conf =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/doc/sample-ngircd.conf,v retrieving revision 1.20.2.2 retrieving revision 1.20.2.3 diff -u -r1.20.2.2 -r1.20.2.3 --- doc/sample-ngircd.conf 29 Apr 2003 12:37:17 -0000 1.20.2.2 +++ doc/sample-ngircd.conf 7 Nov 2003 20:51:09 -0000 1.20.2.3 @@ -1,4 +1,4 @@ -# $Id: sample-ngircd.conf,v 1.20.2.2 2003/04/29 12:37:17 alex Exp $ +# $Id: sample-ngircd.conf,v 1.20.2.3 2003/11/07 20:51:09 alex Exp $ # # This is a sample configuration file for the ngIRCd, which must adept to @@ -36,6 +36,10 @@ # Ports on which the server should listen. There may be more than # one port, separated with ";". (Default: 6667) ;Ports = 6667, 6668, 66694 + + # IP address on which the server should listen. (Default: empty, + # so the server listens on all IP addresses of the system) + ;Listen = 1.2.3.4 # Text file with the "message of the day" (MOTD). This message will # be shown to all users connecting to the server: @@ -72,6 +76,10 @@ # Maximum number of simultaneous connection the server is allowed # to accept (<=0: unlimited): ;MaxConnections = -1 + + # Maximum number of simultaneous connections from a single IP address + # the server will accept (<=0: unlimited): + ;MaxConnectionsIP = 5 # Maximum number of channels a user can be member of (<=0: no limit): ;MaxJoins = 10 Index: man/ngircd.conf.5 =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/man/ngircd.conf.5,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -r1.9.2.1 -r1.9.2.2 --- man/ngircd.conf.5 18 Jul 2003 20:48:20 -0000 1.9.2.1 +++ man/ngircd.conf.5 7 Nov 2003 20:51:10 -0000 1.9.2.2 @@ -1,5 +1,5 @@ .\" -.\" $Id: ngircd.conf.5,v 1.9.2.1 2003/07/18 20:48:20 alex Exp $ +.\" $Id: ngircd.conf.5,v 1.9.2.2 2003/11/07 20:51:10 alex Exp $ .\" .TH ngircd.conf 5 "Mai 2003" ngircd "ngIRCd Manual" .SH NAME @@ -67,6 +67,10 @@ Ports on which the server should listen. There may be more than one port, separated with ';'. Default: 6667. .TP +\fBListen\fR +The ip address on which the server should listen. Default is empty, so +the server listens on all configured ip addresses and interfaces. +.TP \fBMotdFile\fR Text file with the "message of the day" (MOTD). This message will be shown to all users connecting to the server. @@ -114,6 +118,11 @@ Maximum number of simultaneous connection the server is allowed to accept (<=0: unlimited). Default: -1. .TP +\fBMaxConnectionsIP\fR +Maximum number of simultaneous connections from a single IP address that +the server will accept (<=0: unlimited). This configuration options lowers +the risk of denial of service attacks (DoS). Default: 5. +.TP \fBMaxJoins\fR Maximum number of channels a user can be member of (<=0: no limit). Default: 10. Index: src/ngircd/Makefile.am =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/Makefile.am,v retrieving revision 1.39.2.1 retrieving revision 1.39.2.2 diff -u -r1.39.2.1 -r1.39.2.2 --- src/ngircd/Makefile.am 18 Jul 2003 20:49:05 -0000 1.39.2.1 +++ src/ngircd/Makefile.am 7 Nov 2003 20:51:10 -0000 1.39.2.2 @@ -8,7 +8,7 @@ # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # -# $Id: Makefile.am,v 1.39.2.1 2003/07/18 20:49:05 alex Exp $ +# $Id: Makefile.am,v 1.39.2.2 2003/11/07 20:51:10 alex Exp $ # AUTOMAKE_OPTIONS = ../portab/ansi2knr @@ -71,7 +71,8 @@ | $(AWK) "{ print \$$9 }" | sort | tail -1 \ | sed -e "s/\//-/g" )\"" > cvs-version.new \ || echo "" > cvs-version.new - diff cvs-version.h cvs-version.new || cp cvs-version.new cvs-version.h + diff cvs-version.h cvs-version.new 2>/dev/null \ + || cp cvs-version.new cvs-version.h TESTS = check-version check-help Index: src/ngircd/channel.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/channel.c,v retrieving revision 1.42 retrieving revision 1.42.2.1 diff -u -r1.42 -r1.42.2.1 --- src/ngircd/channel.c 30 Dec 2002 17:15:42 -0000 1.42 +++ src/ngircd/channel.c 7 Nov 2003 20:51:10 -0000 1.42.2.1 @@ -17,7 +17,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: channel.c,v 1.42 2002/12/30 17:15:42 alex Exp $"; +static char UNUSED id[] = "$Id: channel.c,v 1.42.2.1 2003/11/07 20:51:10 alex Exp $"; #include "imp.h" #include @@ -669,7 +669,7 @@ { BOOLEAN is_member, has_voice, is_op, ok; - /* Okay, Ziel ist ein Channel */ + /* Okay, target is a channel */ is_member = has_voice = is_op = FALSE; if( Channel_IsMemberOf( Chan, From )) { @@ -678,14 +678,21 @@ if( strchr( Channel_UserModes( Chan, From ), 'o' )) is_op = TRUE; } - /* pruefen, ob Client in Channel schreiben darf */ + /* Check weather client is allowed to write to channel */ ok = TRUE; if( strchr( Channel_Modes( Chan ), 'n' ) && ( ! is_member )) ok = FALSE; if( strchr( Channel_Modes( Chan ), 'm' ) && ( ! is_op ) && ( ! has_voice )) ok = FALSE; + + /* Is the client banned? */ + if( Lists_CheckBanned( From, Chan )) + { + /* Client is banned, bus is he channel operator or has voice? */ + if(( ! has_voice ) && ( ! is_op )) ok = FALSE; + } if( ! ok ) return IRC_WriteStrClient( From, ERR_CANNOTSENDTOCHAN_MSG, Client_ID( From ), Channel_Name( Chan )); - /* Text senden */ + /* Send text */ if( Client_Conn( From ) > NONE ) Conn_UpdateIdle( Client_Conn( From )); return IRC_WriteStrChannelPrefix( Client, Chan, From, TRUE, "PRIVMSG %s :%s", Channel_Name( Chan ), Text ); } /* Channel_Write */ Index: src/ngircd/conf.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/conf.c,v retrieving revision 1.57.2.2 retrieving revision 1.57.2.3 diff -u -r1.57.2.2 -r1.57.2.3 --- src/ngircd/conf.c 29 Apr 2003 12:37:18 -0000 1.57.2.2 +++ src/ngircd/conf.c 7 Nov 2003 20:51:10 -0000 1.57.2.3 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conf.c,v 1.57.2.2 2003/04/29 12:37:18 alex Exp $"; +static char UNUSED id[] = "$Id: conf.c,v 1.57.2.3 2003/11/07 20:51:10 alex Exp $"; #include "imp.h" #include @@ -120,6 +120,7 @@ printf( "%u", Conf_ListenPorts[i] ); } puts( "" ); + printf( " Listen = %s\n", Conf_ListenAddress ); pwd = getpwuid( Conf_UID ); if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name ); else printf( " ServerUID = %ld\n", (LONG)Conf_UID ); @@ -132,6 +133,8 @@ printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" ); if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections ); else printf( " MaxConnections = -1\n" ); + if( Conf_MaxConnectionsIP > 0 ) printf( " MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP ); + else printf( " MaxConnectionsIP = -1\n" ); if( Conf_MaxJoins > 0 ) printf( " MaxJoins = %d\n", Conf_MaxJoins ); else printf( " MaxJoins = -1\n" ); puts( "" ); @@ -340,6 +343,7 @@ strlcat( Conf_MotdFile, MOTD_FILE, sizeof( Conf_MotdFile )); Conf_ListenPorts_Count = 0; + strcpy( Conf_ListenAddress, "" ); Conf_UID = Conf_GID = 0; @@ -354,6 +358,7 @@ Conf_OperCanMode = FALSE; Conf_MaxConnections = -1; + Conf_MaxConnectionsIP = 5; Conf_MaxJoins = 10; /* Initialize server configuration structures */ @@ -689,6 +694,16 @@ Conf_MaxConnections = atol( Arg ); return; } + if( strcasecmp( Var, "MaxConnectionsIP" ) == 0 ) + { + /* Maximum number of simoultanous connections from one IP. Values <= 0 are equal to "no limit". */ +#ifdef HAVE_ISDIGIT + if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxConnectionsIP\" is not a number!", NGIRCd_ConfFile, Line ); + else +#endif + Conf_MaxConnectionsIP = atoi( Arg ); + return; + } if( strcasecmp( Var, "MaxJoins" ) == 0 ) { /* Maximum number of channels a user can join. Values <= 0 are equal to "no limit". */ @@ -699,6 +714,15 @@ Conf_MaxJoins = atoi( Arg ); return; } + if( strcasecmp( Var, "Listen" ) == 0 ) + { + /* IP-Address to bind sockets */ + if( strlcpy( Conf_ListenAddress, Arg, sizeof( Conf_ListenAddress )) >= sizeof( Conf_ListenAddress )) + { + Config_Error( LOG_WARNING, "%s, line %d: Value of \"Listen\" too long!", NGIRCd_ConfFile, Line ); + } + return; + } Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var ); } /* Handle_GLOBAL */ Index: src/ngircd/conf.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/conf.h,v retrieving revision 1.26 retrieving revision 1.26.2.1 diff -u -r1.26 -r1.26.2.1 --- src/ngircd/conf.h 31 Dec 2002 16:12:50 -0000 1.26 +++ src/ngircd/conf.h 7 Nov 2003 20:51:11 -0000 1.26.2.1 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: conf.h,v 1.26 2002/12/31 16:12:50 alex Exp $ + * $Id: conf.h,v 1.26.2.1 2003/11/07 20:51:11 alex Exp $ * * Configuration management (header) */ @@ -76,6 +76,9 @@ GLOBAL UINT Conf_ListenPorts[MAX_LISTEN_PORTS]; GLOBAL INT Conf_ListenPorts_Count; +/* Address to which the socket should be bound or empty (=all) */ +GLOBAL CHAR Conf_ListenAddress[16]; + /* User and group ID the server should run with */ GLOBAL UINT Conf_UID; GLOBAL UINT Conf_GID; @@ -107,6 +110,9 @@ /* Maximum number of channels a user can join */ GLOBAL INT Conf_MaxJoins; +/* Maximum number of connections per IP address */ +GLOBAL INT Conf_MaxConnectionsIP; + GLOBAL VOID Conf_Init PARAMS((VOID )); GLOBAL VOID Conf_Rehash PARAMS((VOID )); Index: src/ngircd/conn-func.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/conn-func.c,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 --- src/ngircd/conn-func.c 30 Dec 2002 17:14:28 -0000 1.1 +++ src/ngircd/conn-func.c 7 Nov 2003 20:51:11 -0000 1.1.2.1 @@ -16,10 +16,11 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conn-func.c,v 1.1 2002/12/30 17:14:28 alex Exp $"; +static char UNUSED id[] = "$Id: conn-func.c,v 1.1.2.1 2003/11/07 20:51:11 alex Exp $"; #include "imp.h" #include +#include #include "conn.h" @@ -69,7 +70,7 @@ assert( Idx > NONE ); assert( Seconds >= 0 ); - + t = time( NULL ) + Seconds; if( t > My_Connections[Idx].delaytime ) My_Connections[Idx].delaytime = t; } /* Conn_SetPenalty */ Index: src/ngircd/conn.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/conn.c,v retrieving revision 1.122.2.1 retrieving revision 1.122.2.2 diff -u -r1.122.2.1 -r1.122.2.2 --- src/ngircd/conn.c 25 Apr 2003 16:50:53 -0000 1.122.2.1 +++ src/ngircd/conn.c 7 Nov 2003 20:51:11 -0000 1.122.2.2 @@ -16,7 +16,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conn.c,v 1.122.2.1 2003/04/25 16:50:53 alex Exp $"; +static char UNUSED id[] = "$Id: conn.c,v 1.122.2.2 2003/11/07 20:51:11 alex Exp $"; #include "imp.h" #include @@ -87,6 +87,7 @@ LOCAL VOID New_Server PARAMS(( INT Server, CONN_ID Idx )); LOCAL VOID Read_Resolver_Result PARAMS(( INT r_fd )); LOCAL VOID Simple_Message PARAMS(( INT Sock, CHAR *Msg )); +LOCAL INT Count_Connections PARAMS(( struct sockaddr_in addr )); LOCAL fd_set My_Listeners; LOCAL fd_set My_Sockets; @@ -119,7 +120,9 @@ Log( LOG_EMERG, "Can't allocate memory! [Conn_Init]" ); exit( 1 ); } - Log( LOG_DEBUG, "Allocted connection pool for %d items (%ld bytes).", Pool_Size, sizeof( CONNECTION ) * Pool_Size ); +#ifdef DEBUG + Log( LOG_DEBUG, "Allocated connection pool for %d items (%ld bytes).", Pool_Size, sizeof( CONNECTION ) * Pool_Size ); +#endif /* zu Beginn haben wir keine Verbindungen */ FD_ZERO( &My_Listeners ); @@ -146,7 +149,9 @@ CONN_ID idx; INT i; +#ifdef DEBUG Log( LOG_DEBUG, "Shutting down all connections ..." ); +#endif #ifdef RENDEZVOUS Rendezvous_UnregisterListeners( ); @@ -164,12 +169,16 @@ if( FD_ISSET( i, &My_Listeners )) { close( i ); +#ifdef DEBUG Log( LOG_DEBUG, "Listening socket %d closed.", i ); +#endif } else if( FD_ISSET( i, &My_Connects )) { close( i ); +#ifdef DEBUG Log( LOG_DEBUG, "Connection %d closed during creation (socket %d).", idx, i ); +#endif } else if( idx < Pool_Size ) { @@ -224,7 +233,9 @@ if( FD_ISSET( i, &My_Sockets ) && FD_ISSET( i, &My_Listeners )) { close( i ); +#ifdef DEBUG Log( LOG_DEBUG, "Listening socket %d closed.", i ); +#endif } } } /* Conn_ExitListeners */ @@ -236,6 +247,7 @@ /* Create new listening socket on specified port */ struct sockaddr_in addr; + struct in_addr inaddr; INT sock; #ifdef RENDEZVOUS CHAR name[CLIENT_ID_LEN], *info; @@ -243,9 +255,24 @@ /* Server-"Listen"-Socket initialisieren */ memset( &addr, 0, sizeof( addr )); + memset( &inaddr, 0, sizeof( inaddr )); addr.sin_family = AF_INET; addr.sin_port = htons( Port ); - addr.sin_addr.s_addr = htonl( INADDR_ANY ); + if( Conf_ListenAddress[0] ) + { +#ifdef HAVE_INET_ATON + if( inet_aton( Conf_ListenAddress, &inaddr ) == 0 ) +#else + inaddr.s_addr = inet_addr( Conf_ListenAddress ); + if( inaddr.s_addr == (unsigned)-1 ) +#endif + { + Log( LOG_CRIT, "Can't listen on %s:%u: can't convert ip address %s!", Conf_ListenAddress, Port, Conf_ListenAddress ); + return FALSE; + } + } + else inaddr.s_addr = htonl( INADDR_ANY ); + addr.sin_addr = inaddr; /* Socket erzeugen */ sock = socket( PF_INET, SOCK_STREAM, 0); @@ -279,7 +306,8 @@ if( sock > Conn_MaxFD ) Conn_MaxFD = sock; - Log( LOG_INFO, "Now listening on port %d (socket %d).", Port, sock ); + if( Conf_ListenAddress[0]) Log( LOG_INFO, "Now listening on %s:%d (socket %d).", Conf_ListenAddress, Port, sock ); + else Log( LOG_INFO, "Now listening on 0.0.0.0:%d (socket %d).", Port, sock ); #ifdef RENDEZVOUS /* Get best server description text */ @@ -350,10 +378,13 @@ Check_Servers( ); Check_Connections( ); + t = time( NULL ); + /* noch volle Lese-Buffer suchen */ for( i = 0; i < Pool_Size; i++ ) { - if(( My_Connections[i].sock > NONE ) && ( My_Connections[i].rdatalen > 0 )) + if(( My_Connections[i].sock > NONE ) && ( My_Connections[i].rdatalen > 0 ) && + ( My_Connections[i].delaytime < t )) { /* Kann aus dem Buffer noch ein Befehl extrahiert werden? */ if( Handle_Buffer( i )) timeout = FALSE; @@ -382,7 +413,6 @@ } /* von welchen Sockets koennte gelesen werden? */ - t = time( NULL ); read_sockets = My_Sockets; for( i = 0; i < Pool_Size; i++ ) { @@ -413,7 +443,7 @@ /* Timeout initialisieren */ tv.tv_usec = 0; - if( timeout ) tv.tv_sec = TIME_RES; + if( timeout ) tv.tv_sec = 1; else tv.tv_sec = 0; /* Auf Aktivitaet warten */ @@ -527,7 +557,9 @@ * In diesem Fall wird hier einfach ein Fehler geliefert. */ if( My_Connections[Idx].sock <= NONE ) { +#ifdef DEBUG Log( LOG_DEBUG, "Skipped write on closed socket (connection %d).", Idx ); +#endif return FALSE; } @@ -836,7 +868,9 @@ return FALSE; } +#ifdef DEBUG Log( LOG_DEBUG, "Connection %d with \"%s:%d\" established, now sendig PASS and SERVER ...", Idx, My_Connections[Idx].host, Conf_Server[Conf_GetServer( Idx )].port ); +#endif /* PASS und SERVER verschicken */ Conn_WriteStr( Idx, "PASS %s %s", Conf_Server[Conf_GetServer( Idx )].pwd_out, NGIRCd_ProtoID ); @@ -887,7 +921,7 @@ CONN_ID idx; CLIENT *c; POINTER *ptr; - LONG new_size; + LONG new_size, cnt; assert( Sock > NONE ); @@ -915,6 +949,17 @@ /* Socket initialisieren */ Init_Socket( new_sock ); + + /* Check IP-based connection limit */ + cnt = Count_Connections( new_addr ); + if(( Conf_MaxConnectionsIP > 0 ) && ( cnt >= Conf_MaxConnectionsIP )) + { + /* Access denied, too many connections from this IP! */ + Log( LOG_ERR, "Refused connection from %s: too may connections (%ld) from this IP!", inet_ntoa( new_addr.sin_addr ), cnt); + Simple_Message( new_sock, "ERROR :Connection refused, too many connections from your IP!" ); + close( new_sock ); + return; + } /* Freie Connection-Struktur suchen */ for( idx = 0; idx < Pool_Size; idx++ ) if( My_Connections[idx].sock == NONE ) break; @@ -966,9 +1011,13 @@ /* Struktur umkopieren ... */ memcpy( ptr, My_Connections, sizeof( CONNECTION ) * Pool_Size ); +#ifdef DEBUG Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [malloc()/memcpy()]", new_size, sizeof( CONNECTION ) * new_size ); +#endif } +#ifdef DEBUG else Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [realloc()]", new_size, sizeof( CONNECTION ) * new_size ); +#endif /* Adjust pointer to new block */ My_Connections = ptr; @@ -1032,7 +1081,9 @@ { /* die Connection wurde vermutlich (wegen eines * Fehlers) bereits wieder abgebaut ... */ +#ifdef DEBUG Log( LOG_DEBUG, "Socket2Index: can't get connection for socket %d!", Sock ); +#endif return NONE; } else return idx; @@ -1135,6 +1186,9 @@ result = FALSE; do { + /* Check penalty */ + if( My_Connections[Idx].delaytime > time( NULL )) return result; + #ifdef USE_ZLIB /* ggf. noch unkomprimiete Daten weiter entpacken */ if( My_Connections[Idx].options & CONN_ZIP ) @@ -1214,7 +1268,9 @@ memcpy( My_Connections[Idx].zip.rbuf, My_Connections[Idx].rbuf, My_Connections[Idx].rdatalen ); My_Connections[Idx].zip.rdatalen = My_Connections[Idx].rdatalen; My_Connections[Idx].rdatalen = 0; +#ifdef DEBUG Log( LOG_DEBUG, "Moved already received data (%d bytes) to uncompression buffer.", My_Connections[Idx].zip.rdatalen ); +#endif } } #endif @@ -1251,14 +1307,18 @@ if( My_Connections[i].lastping < time( NULL ) - Conf_PongTimeout ) { /* Timeout */ +#ifdef DEBUG Log( LOG_DEBUG, "Connection %d: Ping timeout: %d seconds.", i, Conf_PongTimeout ); +#endif Conn_Close( i, NULL, "Ping timeout", TRUE ); } } else if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout ) { /* es muss ein PING gesendet werden */ +#ifdef DEBUG Log( LOG_DEBUG, "Connection %d: sending PING ...", i ); +#endif My_Connections[i].lastping = time( NULL ); Conn_WriteStr( i, "PING :%s", Client_ID( Client_ThisServer( ))); } @@ -1269,7 +1329,9 @@ if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout ) { /* Timeout */ +#ifdef DEBUG Log( LOG_DEBUG, "Connection %d timed out ...", i ); +#endif Conn_Close( i, NULL, "Timeout", FALSE ); } } @@ -1325,7 +1387,9 @@ Log( LOG_ALERT, "Can't establist server connection: connection limit reached (%d)!", Pool_Size ); return; } +#ifdef DEBUG Log( LOG_DEBUG, "Preparing connection %d for \"%s\" ...", idx, Conf_Server[i].host ); +#endif /* Verbindungs-Struktur initialisieren */ Init_Conn_Struct( idx ); @@ -1437,7 +1501,9 @@ FD_SET( new_sock, &My_Connects ); if( new_sock > Conn_MaxFD ) Conn_MaxFD = new_sock; +#ifdef DEBUG Log( LOG_DEBUG, "Registered new connection %d on socket %d.", Idx, My_Connections[Idx].sock ); +#endif } /* New_Server */ @@ -1534,11 +1600,15 @@ /* Opsa! Keine passende Connection gefunden!? Vermutlich * wurde sie schon wieder geschlossen. */ close( r_fd ); +#ifdef DEBUG Log( LOG_DEBUG, "Resolver: Got result for unknown connection!?" ); +#endif return; } +#ifdef DEBUG Log( LOG_DEBUG, "Resolver: %s is \"%s\".", My_Connections[i].host, result ); +#endif /* Aufraeumen */ close( My_Connections[i].res_stat->pipe[0] ); @@ -1582,4 +1652,18 @@ } /* Simple_Error */ +LOCAL INT +Count_Connections( struct sockaddr_in addr_in ) +{ + INT i, cnt; + + cnt = 0; + for( i = 0; i < Pool_Size; i++ ) + { + if(( My_Connections[i].sock > NONE ) && ( My_Connections[i].addr.sin_addr.s_addr == addr_in.sin_addr.s_addr )) cnt++; + } + return cnt; +} /* Count_Connections */ + + /* -eof- */ Index: src/ngircd/defines.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/defines.h,v retrieving revision 1.42 retrieving revision 1.42.2.1 diff -u -r1.42 -r1.42.2.1 --- src/ngircd/defines.h 23 Feb 2003 12:03:39 -0000 1.42 +++ src/ngircd/defines.h 7 Nov 2003 20:51:11 -0000 1.42.2.1 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: defines.h,v 1.42 2003/02/23 12:03:39 alex Exp $ + * $Id: defines.h,v 1.42.2.1 2003/11/07 20:51:11 alex Exp $ * * Global defines of ngIRCd. */ @@ -19,8 +19,6 @@ #define NONE -1 -#define TIME_RES 2 /* Zeit-Aufloesung des Servers in Sekunden */ - #define FNAME_LEN 256 /* max. Laenge eines Dateinamen */ #define LINE_LEN 256 /* max. Laenge einer Konfigurationszeile */ Index: src/ngircd/irc-info.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-info.c,v retrieving revision 1.16.2.1 retrieving revision 1.16.2.2 diff -u -r1.16.2.1 -r1.16.2.2 --- src/ngircd/irc-info.c 18 Jul 2003 20:49:35 -0000 1.16.2.1 +++ src/ngircd/irc-info.c 7 Nov 2003 20:51:11 -0000 1.16.2.2 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-info.c,v 1.16.2.1 2003/07/18 20:49:35 alex Exp $"; +static char UNUSED id[] = "$Id: irc-info.c,v 1.16.2.2 2003/11/07 20:51:11 alex Exp $"; #include "imp.h" #include @@ -77,6 +77,7 @@ if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC2_MSG, Client_ID( prefix ), Conf_ServerAdmin2 )) return DISCONNECTED; if( ! IRC_WriteStrClient( Client, RPL_ADMINEMAIL_MSG, Client_ID( prefix ), Conf_ServerAdminMail )) return DISCONNECTED; + IRC_SetPenalty( Client, 1 ); return CONNECTED; } /* IRC_ADMIN */ @@ -161,7 +162,8 @@ } c = Client_Next( c ); } - + + IRC_SetPenalty( target, 1 ); return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask ); } /* IRC_LINKS */ @@ -197,6 +199,7 @@ IRC_Send_LUSERS( target ); + IRC_SetPenalty( target, 1 ); return CONNECTED; } /* IRC_LUSERS */ @@ -230,6 +233,7 @@ } } + IRC_SetPenalty( from, 3 ); return IRC_Show_MOTD( from ); } /* IRC_MOTD */ @@ -324,6 +328,7 @@ if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED; } + IRC_SetPenalty( from, 1 ); return IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), "*" ); } /* IRC_NAMES */ @@ -402,6 +407,7 @@ break; } + IRC_SetPenalty( from, 2 ); return IRC_WriteStrClient( from, RPL_ENDOFSTATS_MSG, Client_ID( from ), query ); } /* IRC_STATS */ @@ -517,6 +523,7 @@ } /* mit Versionsinfo antworten */ + IRC_SetPenalty( Client, 1 ); #ifdef CVSDATE strlcpy( ver, CVSDATE, sizeof( ver )); strncpy( ver + 4, ver + 5, 2 ); Index: src/ngircd/irc-login.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-login.c,v retrieving revision 1.34 retrieving revision 1.34.2.1 diff -u -r1.34 -r1.34.2.1 --- src/ngircd/irc-login.c 31 Mar 2003 15:54:21 -0000 1.34 +++ src/ngircd/irc-login.c 7 Nov 2003 20:51:11 -0000 1.34.2.1 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-login.c,v 1.34 2003/03/31 15:54:21 alex Exp $"; +static char UNUSED id[] = "$Id: irc-login.c,v 1.34.2.1 2003/11/07 20:51:11 alex Exp $"; #include "imp.h" #include @@ -223,6 +223,7 @@ /* neuen Client-Nick speichern */ Client_SetID( target, Req->argv[0] ); + IRC_SetPenalty( target, 2 ); } return CONNECTED; @@ -457,6 +458,9 @@ if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED; if( ! IRC_Show_MOTD( Client )) return DISCONNECTED; + /* Suspend the client for a second ... */ + IRC_SetPenalty( Client, 1 ); + return CONNECTED; } /* Hello_User */ Index: src/ngircd/irc-mode.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-mode.c,v retrieving revision 1.31 retrieving revision 1.31.2.1 diff -u -r1.31 -r1.31.2.1 --- src/ngircd/irc-mode.c 21 Jan 2003 21:04:16 -0000 1.31 +++ src/ngircd/irc-mode.c 7 Nov 2003 20:51:11 -0000 1.31.2.1 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-mode.c,v 1.31 2003/01/21 21:04:16 alex Exp $"; +static char UNUSED id[] = "$Id: irc-mode.c,v 1.31.2.1 2003/11/07 20:51:11 alex Exp $"; #include "imp.h" #include @@ -230,7 +230,8 @@ } Log( LOG_DEBUG, "User \"%s\": Mode change, now \"%s\".", Client_Mask( Target ), Client_Modes( Target )); } - + + IRC_SetPenalty( Client, 1 ); return ok; } /* Client_Mode */ @@ -598,6 +599,7 @@ } } + IRC_SetPenalty( Client, 1 ); return CONNECTED; } /* Channel_Mode */ Index: src/ngircd/irc-write.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-write.c,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -u -r1.14 -r1.14.2.1 --- src/ngircd/irc-write.c 30 Dec 2002 17:15:42 -0000 1.14 +++ src/ngircd/irc-write.c 7 Nov 2003 20:51:11 -0000 1.14.2.1 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-write.c,v 1.14 2002/12/30 17:15:42 alex Exp $"; +static char UNUSED id[] = "$Id: irc-write.c,v 1.14.2.1 2003/11/07 20:51:11 alex Exp $"; #include "imp.h" #include @@ -395,6 +395,21 @@ } /* IRC_WriteStrRelatedPrefix */ +GLOBAL VOID +IRC_SetPenalty( CLIENT *Client, INT Seconds ) +{ + CONN_ID c; + + assert( Client != NULL ); + assert( Seconds > 0 ); + + if( Client_Type( Client ) == CLIENT_SERVER ) return; + + c = Client_Conn( Client ); + if( c > NONE ) Conn_SetPenalty( c, Seconds ); +} /* IRC_SetPenalty */ + + LOCAL CHAR * Get_Prefix( CLIENT *Target, CLIENT *Client ) { Index: src/ngircd/irc-write.h =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc-write.h,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -u -r1.5 -r1.5.4.1 --- src/ngircd/irc-write.h 12 Dec 2002 12:23:43 -0000 1.5 +++ src/ngircd/irc-write.h 7 Nov 2003 20:51:11 -0000 1.5.4.1 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-write.h,v 1.5 2002/12/12 12:23:43 alex Exp $ + * $Id: irc-write.h,v 1.5.4.1 2003/11/07 20:51:11 alex Exp $ * * Sending IRC commands over the network (header) */ @@ -18,17 +18,19 @@ #define __irc_write_h__ -GLOBAL BOOLEAN IRC_WriteStrClient PARAMS((CLIENT *Client, CHAR *Format, ... )); -GLOBAL BOOLEAN IRC_WriteStrClientPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... )); +GLOBAL BOOLEAN IRC_WriteStrClient PARAMS(( CLIENT *Client, CHAR *Format, ... )); +GLOBAL BOOLEAN IRC_WriteStrClientPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... )); -GLOBAL BOOLEAN IRC_WriteStrChannel PARAMS((CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... )); -GLOBAL BOOLEAN IRC_WriteStrChannelPrefix PARAMS((CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )); +GLOBAL BOOLEAN IRC_WriteStrChannel PARAMS(( CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... )); +GLOBAL BOOLEAN IRC_WriteStrChannelPrefix PARAMS(( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )); -GLOBAL VOID IRC_WriteStrServers PARAMS((CLIENT *ExceptOf, CHAR *Format, ... )); -GLOBAL VOID IRC_WriteStrServersPrefix PARAMS((CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... )); -GLOBAL VOID IRC_WriteStrServersPrefixFlag PARAMS((CLIENT *ExceptOf, CLIENT *Prefix, CHAR Flag, CHAR *Format, ... )); +GLOBAL VOID IRC_WriteStrServers PARAMS(( CLIENT *ExceptOf, CHAR *Format, ... )); +GLOBAL VOID IRC_WriteStrServersPrefix PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... )); +GLOBAL VOID IRC_WriteStrServersPrefixFlag PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, CHAR Flag, CHAR *Format, ... )); -GLOBAL BOOLEAN IRC_WriteStrRelatedPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )); +GLOBAL BOOLEAN IRC_WriteStrRelatedPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )); + +GLOBAL VOID IRC_SetPenalty PARAMS(( CLIENT *Client, INT Seconds )); #endif Index: src/ngircd/irc.c =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/ngircd/irc.c,v retrieving revision 1.120.2.1 retrieving revision 1.120.2.2 diff -u -r1.120.2.1 -r1.120.2.2 --- src/ngircd/irc.c 29 Apr 2003 12:20:14 -0000 1.120.2.1 +++ src/ngircd/irc.c 7 Nov 2003 20:51:11 -0000 1.120.2.2 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc.c,v 1.120.2.1 2003/04/29 12:20:14 alex Exp $"; +static char UNUSED id[] = "$Id: irc.c,v 1.120.2.2 2003/11/07 20:51:11 alex Exp $"; #include "imp.h" #include @@ -265,6 +265,7 @@ /* Some information about us */ if( ! IRC_WriteStrClient( from, RPL_TRACESERVER_MSG, Client_ID( from ), Conf_ServerName, Client_Mask( Client_ThisServer( )), Option_String( Client_Conn( Client )))) return DISCONNECTED; + IRC_SetPenalty( Client, 3 ); return IRC_WriteStrClient( from, RPL_TRACEEND_MSG, Client_ID( from ), Conf_ServerName, PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel ); } /* IRC_TRACE */ @@ -286,6 +287,8 @@ if( ! IRC_WriteStrClient( Client, "NOTICE %s :%s", Client_ID( Client ), cmd->name )) return DISCONNECTED; cmd++; } + + IRC_SetPenalty( Client, 2 ); return CONNECTED; } /* IRC_HELP */ Index: src/testsuite/getpid.sh =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/testsuite/getpid.sh,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -u -r1.2.4.1 -r1.2.4.2 --- src/testsuite/getpid.sh 22 Apr 2003 20:01:23 -0000 1.2.4.1 +++ src/testsuite/getpid.sh 7 Nov 2003 20:51:11 -0000 1.2.4.2 @@ -1,28 +1,35 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: getpid.sh,v 1.2.4.1 2003/04/22 20:01:23 alex Exp $ +# $Id: getpid.sh,v 1.2.4.2 2003/11/07 20:51:11 alex Exp $ -# wurde ein Name uebergeben? +# did we get a name? [ $# -ne 1 ] && exit 1 -# Flags fuer "ps" ermitteln +# detect flags for "ps" and "head" if [ `uname` = "FreeBSD" ]; then PS_FLAGS="-a"; PS_PIDCOL="1"; HEAD_FLAGS="-n 1" elif [ `uname` = "A/UX" ]; then PS_FLAGS="-ae"; PS_PIDCOL="1"; HEAD_FLAGS="-1" +elif [ `uname` = "GNU" ]; then + PS_FLAGS="-ax"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1" else PS_FLAGS="-f"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1" ps $PS_FLAGS > /dev/null 2>&1 if [ $? -ne 0 ]; then PS_FLAGS="a"; PS_PIDCOL="1"; fi fi -# PID ermitteln +# debug output +#echo "$0: PS_FLAGS=$PS_FLAGS" +#echo "$0: PS_PIDCOL=$PS_PIDCOL" +#echo "$0: HEAD_FLAGS=$HEAD_FLAGS" + +# search PID ps $PS_FLAGS > procs.tmp -cat procs.tmp | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n > pids.tmp +cat procs.tmp | grep -v "$0" | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n > pids.tmp pid=`head $HEAD_FLAGS pids.tmp` rm -rf procs.tmp pids.tmp -# ermittelte PID validieren +# validate PID [ "$pid" -gt 1 ] > /dev/null 2>&1 [ $? -ne 0 ] && exit 1 Index: src/testsuite/ngircd-test.conf =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/testsuite/ngircd-test.conf,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -u -r1.3 -r1.3.4.1 --- src/testsuite/ngircd-test.conf 21 Oct 2002 13:45:23 -0000 1.3 +++ src/testsuite/ngircd-test.conf 7 Nov 2003 20:51:11 -0000 1.3.4.1 @@ -1,4 +1,4 @@ -# $Id: ngircd-test.conf,v 1.3 2002/10/21 13:45:23 alex Exp $ +# $Id: ngircd-test.conf,v 1.3.4.1 2003/11/07 20:51:11 alex Exp $ [Global] Name = ngircd.test.server @@ -6,6 +6,7 @@ Ports = 6789 MotdFile = ngircd-test.motd AdminEMail = admin@irc.server + MaxConnectionsIP = 0 [Operator] Name = TestOp Index: src/testsuite/start-server.sh =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/testsuite/start-server.sh,v retrieving revision 1.10 retrieving revision 1.10.4.1 diff -u -r1.10 -r1.10.4.1 --- src/testsuite/start-server.sh 10 Nov 2002 14:28:06 -0000 1.10 +++ src/testsuite/start-server.sh 7 Nov 2003 20:51:11 -0000 1.10.4.1 @@ -1,31 +1,37 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: start-server.sh,v 1.10 2002/11/10 14:28:06 alex Exp $ +# $Id: start-server.sh,v 1.10.4.1 2003/11/07 20:51:11 alex Exp $ [ -z "$srcdir" ] && srcdir=`dirname $0` echo " starting server ..." -# alte Logfiles loeschen +# remove old logfiles rm -rf logs *.log -# pruefen, ob getpid.sh gueltige PID's liefert. Wenn dem nicht so ist, -# wird kein ngIRCd gestartet, da dieser ansonsten nicht mehr am Ende -# des Testlaufs beendet werden koennte! +# check weather getpid.sh returns valid PIDs. If not, don't start up the +# test-server, because we won't be able to kill it at the end of the test. ./getpid.sh sh > /dev/null 2>&1 if [ $? -ne 0 ]; then echo " error: getpid.sh FAILED!" exit 1 fi -# MOTD fuer Test-Server erzeugen +# check if there is a test-server already running +./getpid.sh T-ngircd > /dev/null 2>&1 +if [ $? -eq 0 ]; then + echo " error: test-server already running!" + exit 1 +fi + +# generate MOTD for test-server echo "This is an ngIRCd Test Server" > ngircd-test.motd -# Test-Server starten ... +# starting up test-server ... ./T-ngircd -np -f ${srcdir}/ngircd-test.conf > ngircd-test.log 2>&1 & sleep 1 -# validieren, dass Server laeuft +# validate running test-server pid=`./getpid.sh T-ngircd` [ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1 Index: src/testsuite/stop-server.sh =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/testsuite/stop-server.sh,v retrieving revision 1.9 retrieving revision 1.9.4.1 diff -u -r1.9 -r1.9.4.1 --- src/testsuite/stop-server.sh 10 Nov 2002 14:28:06 -0000 1.9 +++ src/testsuite/stop-server.sh 7 Nov 2003 20:51:11 -0000 1.9.4.1 @@ -1,17 +1,25 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: stop-server.sh,v 1.9 2002/11/10 14:28:06 alex Exp $ +# $Id: stop-server.sh,v 1.9.4.1 2003/11/07 20:51:11 alex Exp $ [ -z "$srcdir" ] && srcdir=`dirname $0` echo " stopping server ..." -# Test-Server stoppen ... +# stop test-server ... pid=`./getpid.sh T-ngircd` -[ -n "$pid" ] && kill $pid > /dev/null 2>&1 || exit 1 -sleep 1 +if [ -z "$pid" ]; then + echo " no running server found!?" + exit 1 +fi +kill $pid > /dev/null 2>&1 || exit 1 -# jetzt duerfte der Prozess nicht mehr laufen -kill -0 $pid > /dev/null 2>&1 && exit 1 || exit 0 +# waiting ... +for i in 1 2 3 4 5; do + kill -0 $pid > /dev/null 2>&1 || exit 0 + sleep 1 +done +echo " server still running!?" +exit 1 # -eof- Index: src/testsuite/stress-server.sh =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/testsuite/stress-server.sh,v retrieving revision 1.6.4.1 retrieving revision 1.6.4.2 diff -u -r1.6.4.1 -r1.6.4.2 --- src/testsuite/stress-server.sh 22 Apr 2003 20:01:23 -0000 1.6.4.1 +++ src/testsuite/stress-server.sh 7 Nov 2003 20:51:11 -0000 1.6.4.2 @@ -1,6 +1,6 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: stress-server.sh,v 1.6.4.1 2003/04/22 20:01:23 alex Exp $ +# $Id: stress-server.sh,v 1.6.4.2 2003/11/07 20:51:11 alex Exp $ [ -z "$srcdir" ] && srcdir=`dirname $0` @@ -12,11 +12,11 @@ type expect > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo "SKIP: ${name} -- \"expect\" not found."; exit 77 + echo " ${name}: \"expect\" not found."; exit 77 fi type telnet > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo "SKIP: ${name} -- \"telnet\" not found."; exit 77 + echo " ${name}: \"telnet\" not found."; exit 77 fi echo " stressing server with $CLIENTS clients (be patient!) ..." Index: src/testsuite/tests.sh =================================================================== RCS file: /usr/local/CVS/ngircd/ngircd/src/testsuite/tests.sh,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -u -r1.3 -r1.3.6.1 --- src/testsuite/tests.sh 12 Sep 2002 02:29:03 -0000 1.3 +++ src/testsuite/tests.sh 7 Nov 2003 20:51:11 -0000 1.3.6.1 @@ -1,6 +1,6 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: tests.sh,v 1.3 2002/09/12 02:29:03 alex Exp $ +# $Id: tests.sh,v 1.3.6.1 2003/11/07 20:51:11 alex Exp $ name=`basename $0` test=`echo ${name} | cut -d '.' -f 1` @@ -8,11 +8,11 @@ type expect > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo "SKIP: ${name} -- \"expect\" not found."; exit 77 + echo " ${name}: \"expect\" not found."; exit 77 fi type telnet > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo "SKIP: ${name} -- \"telnet\" not found."; exit 77 + echo " ${name}: \"telnet\" not found."; exit 77 fi echo " doing ${test} ..."