From 0e3c217d90ea9af230a002e06104c147c54ab01a Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Wed, 8 Jan 2003 03:17:20 +0000 Subject: [PATCH] Author: Kev Log message: Polishing this forward-port. This won't compile--map.c assumes that the head-in-sand stuff is still in preprocessor macros, rather than features. Files that remain to be reviewed: * ChangeLog.11 (probably moves to doc/history, but might should be synced with the ChangeLog in .11) * doc/example.conf (probably needs a full rewrite) * include/ircd_alloc.h * ircd/channel.c * ircd/chkconf.c (maybe we should just shoot it and put it out of its misery) * ircd/ircd_alloc.c * ircd/m_burst.c * ircd/m_destruct.c * ircd/m_endburst.c * ircd/m_join.c * ircd/m_server.c (this one needs a rewrite, *bad*) * ircd/map.c * ircd/s_conf.c (I haven't yet sat down and figured out the new .conf processor) git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@901 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- BUGS | 9 - ChangeLog | 132 +++++++++ INSTALL | 182 +++--------- README | 110 +++++--- README.FreeBSD | 37 +++ README.Solaris | 20 ++ RELEASE.NOTES | 2 + TODO | 44 --- configure.in | 22 +- ChangeLog.07 => doc/history/ChangeLog.07 | 2 +- ChangeLog.10 => doc/history/ChangeLog.10 | 2 +- doc/readme.asll | 25 ++ doc/readme.features | 335 ++++++++++++++++++++++- doc/readme.log | 2 +- include/channel.h | 1 + include/handlers.h | 2 +- include/ircd_defs.h | 10 - include/ircd_policy.h | 167 ----------- include/jupe.h | 1 + include/msgq.h | 11 - include/numeric.h | 2 + include/s_stats.h | 7 +- ircd/Makefile.in | 2 +- ircd/engine_poll.c | 2 - ircd/ircd.c | 3 + ircd/ircd_features.c | 3 +- ircd/ircd_relay.c | 2 +- ircd/m_account.c | 1 + ircd/m_clearmode.c | 6 +- ircd/m_create.c | 6 +- ircd/m_gline.c | 9 +- ircd/m_kick.c | 5 +- ircd/m_lusers.c | 2 +- ircd/m_map.c | 2 +- ircd/m_nick.c | 11 + ircd/m_opmode.c | 4 +- ircd/m_privmsg.c | 2 +- ircd/m_settime.c | 33 ++- ircd/m_squit.c | 5 - ircd/m_userhost.c | 3 +- ircd/m_wallvoices.c | 2 +- ircd/m_who.c | 8 + ircd/m_whois.c | 2 +- ircd/s_bsd.c | 13 +- ircd/s_debug.c | 14 + ircd/s_err.c | 6 +- ircd/s_misc.c | 2 +- ircd/s_stats.c | 2 +- ircd/s_user.c | 13 +- ircd/table_gen.c | 6 +- ircd/whocmds.c | 4 +- tools/linesync/linesync.conf | 15 + tools/linesync/linesync.sh | 222 +++++++++++++++ 53 files changed, 1023 insertions(+), 512 deletions(-) delete mode 100644 BUGS create mode 100644 README.FreeBSD create mode 100644 README.Solaris delete mode 100644 TODO rename ChangeLog.07 => doc/history/ChangeLog.07 (96%) rename ChangeLog.10 => doc/history/ChangeLog.10 (99%) create mode 100644 doc/readme.asll delete mode 100644 include/ircd_policy.h create mode 100644 tools/linesync/linesync.conf create mode 100755 tools/linesync/linesync.sh diff --git a/BUGS b/BUGS deleted file mode 100644 index 31bb985..0000000 --- a/BUGS +++ /dev/null @@ -1,9 +0,0 @@ -# -# BUGS file for ircu2.10 -# -# $Id: BUGS,v 1.7 2000-07-15 01:31:23 isomer Exp $ -# -* crule parser coredumps on invalid input -* throttle - * gets corrupted data when adding a new server. - * looses count and assert()'s frequently? diff --git a/ChangeLog b/ChangeLog index 6e38436..97d34c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,135 @@ +2003-01-07 Kevin L Mitchell + + * BUGS: removed from distribution + + * ChangeLog.07: moved into doc/history + + * ChangeLog.10: moved into doc/history + + * INSTALL: pulled up from u2.10.11.04 + + * README: pulled up from u2.10.11.04 + + * README.FreeBSD: pulled up from u2.10.11.04 + + * README.Solaris: pulled up from u2.10.11.04 + + * RELEASE.NOTES: add sysctl note from u2.10.11.04 + + * TODO: removed from distribution + + * configure.in: add extra check for res_mkquery; remove + --disable-headinsand since it no longer has any effect; pull up + "Enable" vs. "Disable" changes from u2.10.11.04 + + * doc/readme.asll: pulled up from u2.10.11.04 + + * doc/readme.features: pull up missing documentation, including a + couple of corrections + + * doc/readme.log: correct text to read FACILITY instead of SYSLOG + in the documentation for configuring syslog facility + + * include/channel.h: declare IsInvited() + + * include/handlers.h: do some minor reorderings + + * include/ircd_defs.h: remove deprecated NETWORK and URL_CLIENTS + #define's + + * include/ircd_policy.h: removed from the distribution + + * include/jupe.h: declare jupe_memory_count() + + * include/msgq.h: remove MsgCounts structure + + * include/numeric.h: add a blank line after RPL_STATSQLINE; add + RPL_HOSTHIDDEN + + * include/s_stats.h: include ircd_features.h for definition of the + enum; remove extraneous declarations + + * ircd/Makefile.in: add LDFLAGS to table_gen + + * ircd/engine_poll.c: remove commented-out assertion + + * ircd/ircd.c: include s_stats.h and call stats_init() + + * ircd/ircd_features.c: feature names have to be case-sensitive + because of some of the HIS features + + * ircd/ircd_relay.c: reorder includes + + * ircd/m_account.c: include string.h for strlen() + + * ircd/m_clearmode.c: remove extraneous clean_channelname(); make + sure to refer to chname, not parv[1] + + * ircd/m_create.c: remove the broken code that squits servers that + are >5 minutes fast; fix "badop || CHFL_CHANOP" bug that caused op + desyncs + + * ircd/m_gline.c: if it's a server, force the gline; don't + gline_find() before determining if the oper had the privilege + + * ircd/m_kick.c: kicks by servers should appear to be from the + local server thanks to HIS + + * ircd/m_lusers.c: needs ircd_features.h, not ircd_policy.h + + * ircd/m_map.c: needs ircd_features.h, not ircd_policy.h + + * ircd/m_nick.c: added an assertion and some explanatory comments + pulled up from u2.10.11.04 + + * ircd/m_opmode.c: no longer requiring oper to be on the channel; + search for quarantines before allowing ops + + * ircd/m_privmsg.c: one character typo that probably means nothing + + * ircd/m_settime.c: add back comments I left in the code + + * ircd/m_squit.c: remove protocol_violation() notices + + * ircd/m_userhost.c: return realhost if user is an oper + + * ircd/m_wallvoices.c: only m_wallvoices() should add a + + + * ircd/m_who.c: add handling for the 'a' field + + * ircd/m_whois.c: correct a typo of FEAT_HIS_SERVERNAME for + FEAT_HIS_SERVERINFO + + * ircd/s_bsd.c: close file descriptors 0, 1, and 2; pull up some + ancient bug fixes from the u2.10.11 branch + + * ircd/s_debug.c: include gline.h, jupe.h, motd.h, and s_stats.h; + call motd_memory_count(), gline_memory_count(), and + jupe_memory_count() when reporting memory usage; add back a + comment regarding "DBuf caveats" + + * ircd/s_err.c: add RPL_STATSQLINE, RPL_HOSTHIDDEN, and pull up + change to ERR_NOPRIVILEGES wording + + * ircd/s_misc.c: include ircd_features.h and not ircd_policy.h + + * ircd/s_stats.c: count from 0 and not 1 when initializing the + stats + + * ircd/s_user.c: comment out assertion; remove extraneous + definition of FLAGS_HOST_HIDDEN; add in hikari's "your host is now + hidden" reply; don't detach oper confs unless sptr is not an oper + + * ircd/table_gen.c: pull up change to NTL_CHPFX (removing +); + change channel name character range to be from '\041' (!) to + UCHAR_MAX + + * ircd/whocmds.c: pull up fix to /who idle time from u2.10.11.04 + + * tools/linesync/linesync.conf: pull up from u2.10.11.04 + + * tools/linesync/linesync.sh: pull up from u2.10.11.04 + 2003-01-07 Andrew Miller * almost everything: Forward ported numerous changes from .11 to .12 diff --git a/INSTALL b/INSTALL index 1bff47f..e6827a6 100644 --- a/INSTALL +++ b/INSTALL @@ -1,158 +1,56 @@ -INSTALL file by Run - Updated by Isomer - Updated for u2.10.11 by Kev -This is the UnderNet IRC daemon. +ircu - INSTALL + Original by Run , + Isomer , and Kev + Rewritten by Sengaia -The installation of the IRC daemon (ircd) exists of the following steps: +Compiling and installing ircu should be a fairly straightforward process, +if you have obtained this software as a (.tar.gz) package, please consider +using CVS (described below). Using CVS will make updating your installation +much easier. -1) Retrieve the package. -2) cd into the base directory. -3) "./configure" -4) "make" -5) "make install" +After obtaining the latest version of the ircu source code, change into the +source directory (ircu2.10), and run "./configure". To see the various ways +in which you can customize your installation, run "./configure --help". -1) Retrieve the package. -======================== +The configure process will check your environment and prepare itself for +compiling the source code. If one or more of the prerequisites cannot be +found, configure will terminate with an error. You will need to resolve +this and run configure again. -The recommended way to get the ircu package now is to use CVS. CVS makes -upgrades a lot less painful and lets you get the latest package. - -1.1) The first thing you need to do is "authenticate" yourself against the -server. - -This is done with: - -cvs -d :pserver:anoncvs@coder-com.undernet.org:/home/coder-com/cvs login - -(we recommend that you cut and paste the above line to use it :) -When it prompts you for a password enter "anoncvs". - -1.2) The module you will check out is ircu2.10. There are three branches -you can check out. - -stable - This branch is always the recommended version for use on the - Undernet. To check out the stable tree, add "-r u2_10_11" to - the CVS command line. - -beta - This branch is undergoing testing before being promoted to the - stable branch. It may be buggy. Use on the Undernet's production - network is prohibited, except for certain authorized servers. The - "-r" flag you need to check this branch out is documented on the - Coder Committee's web site, http://coder-com.undernet.org. - -alpha - This is the development branch. It is not guaranteed to even - compile, and should be considered HIGHLY unstable. It is NOT - intended for production use. If you wish to play with the server, - you may wish to investigate the test network. To check this branch - out, use no "-r" flags. - - -to check out the tree, type: - -cvs -d :pserver:anoncvs@coder-com.undernet.org:/home/coder-com/cvs checkout - -P ircu2.10 - -The above two lines shouldn't have an enter between them. If you want to -use another branch, place the appropriate "-r" flag after the "checkout" -command. This will create a directory ircu2.10, and put all the files in -there. - -To get the latest version, from within the tree type "cvs update -dP". - -For more information see the coder-com website at -http://coder-com.undernet.org/ - -The old (tried and true) method that works even when the website isn't being -DoS'd (sigh) is included below. Using the method below means you can't -just type 'cvs update -dP' to get the latest version. +If configure runs without error(s), you are ready to compile. To compile ircu, +run "make". Please use GNU make and gcc. If the source code does not compile, +make sure your environment is setup correctly. If you are convinced the source +of the failure is ircu, gather all relevant information about your system such +as the Architecture, OS version, the configure statement you used, etc. and +contact coder-com@undernet.org. - The name of the package is something like `ircu2.x.y.z.tgz', where - "x.y.z" is the current release (at the time of writing we have - ircu2.10.00.beta3.tgz). +Once ircu is compiled, install it by running "make install". - You need `gzip', the GNU unzip command, to uncompress this package. - You can download this from every GNU ftp site for almost any Operating system. - - If you have GNU tar, type: - - tar xzf ircu2.x.y.z.tgz - - where "ircu2.x.y.z.tgz" is the name of the package. - - If your tar doesn't support the 'z' flag, you can type alternatively: - - gzip -dc ircu2.x.y.z.tgz | tar xf - - - Both methods result in a directory "ircu2.x.y.z" in your current directory. - -2) cd into the base directory -============================= +Next, you will have to configure your IRC server by setting up your ircd.conf +file. Use the included doc/ircd.conf.sample as a starting point. +Setting up ircd.conf can be a bit tricky, so if this is your first time doing +it, begin with a bare-bones configuration and extend it as you go. -Make this directory your current directory by typing: +If you are upgrading from ircu2.10.10, use the tools/transition script to +convert your existing configuration file(s). -cd ircu2.x.y.z +Good Luck! -or ircu2.10 if you used cvs. +RETRIEVING IRCU VIA CVS -where "ircu2.x.y.z" is the name of the unpacked directory. - -3) "./configure" -================ - -This will generate "config.h", your operating system-dependent -configuration. - -If this produces a "Permission Denied" error message, then try typing -"chmod a+x ./configure" first to give yourself permission to run the file. - -For information on configure command line options, type "./configure --help". - -4) "make" -========= - -Type: - -make - -in the base directory. It should compile without errors or warnings. -Please mail any problem to the maintainer, but only AFTER you made sure -you did everything the right way. If you want your operating system -to be supported in future releases, you best make a patch that -actually fixes the problem. - -5) "make install" -================= - -This should install the ircd and the man page. Please recheck the -permissions of the binary. - -Of course, you need a syntactically correct ircd.conf in DPATH. See the -docs for some info on this. Also create an ircd.motd with the text of -your MOTD. And finally create a remote.motd with three lines of text -as the remote MOTD. Again, all of these files should be readable by the -ircd, and the logfiles should be writeable. - - -In case of problems -=================== - -If you have problems configuring the server you might consider installing -GNU make in your PATH. In some cases a brain-dead /bin/sh is causing the -problem, in which case I suggest to install "bash" and use that (as sh -> -bash). Finally, any other compile problem should be solved when you install -gcc. +The recommended way to get the ircu package now is to use CVS. CVS makes +upgrades a lot less painful and lets you get the latest package. -If you have problems with starting the ircd, run "./configure" again -and give it the "--enable-debug" command line option. Recompile the ircd, -and run it by hand as: +The first thing you need to do is login to the cvs server: +# cvs -d :pserver:anoncvs@coder-com.undernet.org:/home/coder-com/cvs login -ircd -t -x9 +(we recommend that you cut and paste the above line to use it :) +When it prompts you for a password enter "anoncvs". -This will write debug output to your screen, probably showing why it -doesn't start. +To check out the the last stable version of ircu, use: +# cvs -d :pserver:anoncvs@coder-com.undernet.org:/home/coder-com/cvs checkout -P ircu2.10 -DO NOT USE A SERVER WITH DEBUGGING ENABLED ON A PRODUCTION NETWORK. Doing -so is a severe privacy risk. +To update your source tree to the latest version, run "cvs update -dP" from within the +ircu2.10 directory. For more information, see http://coder-com.undernet.org. -If things still don't work, try emailing coder-com@undernet.org diff --git a/README b/README index 4472da3..9cff13a 100644 --- a/README +++ b/README @@ -1,36 +1,74 @@ -README for the ircu2.10.11 series -PLEASE READ THIS COMPLETELY BEFORE RUNNING THE SERVER! - -The u2.10.11 is the most advanced version of Undernet ircd to date. -There are still plenty of rough edges, but many things have been -cleaned up and redone. The major changes for this version are -documented in RELEASE.NOTES, in this directory. A good description of -compiling and installing the server is included in INSTALL. Further -documentation on many aspects of ircu is contained in the doc -subdirectory. - -IF YOU ARE PLANNING ON USING IRCU IN A CHROOT "JAIL," YOU MUST READ -doc/readme.chroot! This document describes the intricacies of using -the Undernet ircd daemon in such an environment. - -This version of ircd no longer has the "make compile" step; most -compile-time options have become features which can be set in the -configuration file, or on the fly online through the SET and RESET -commands; the current values may be obtained with GET. The remaining -compile-time options are set through arguments to ./configure. A list -of the compile-time options may be obtained with "./configure --help"; -see RELEASE.NOTES for a more comprehensive description of each -option. All features are documented in doc/readme.features, and log -configuration is documented in doc/readme.log. - -This server version is not compatible with Undernet ircd releases -prior to u2.10.10, nor is it compatible with any other version of -ircd. Also note that this version incorporates the features requested -by the Undernet administrators in CFV 165; if you don't want these -hiding features enabled, you must add -DINCLUDED_ircd_policy_h to -CFLAGS prior to running ./configure. - -For more information on the changes in this release, see RELEASE.NOTES -and ChangeLog, both in this directory. You may also reference the CVS -log on the Undernet Coder Committee web page at -http://coder-com.undernet.org/. + + Welcome to ircu2.10.11, the Undernet IRC daemon + +Version u2.10.11 of the Undernet ircd incorporates many new features +over its predecessor, and we feel that using it will make you very +happy indeed. + +New features include: + - A completely rewritten network event engine, which make full use + of the asynchronous event engines available in FreeBSD (kqueue) + and Solaris (/dev/poll), resulting in dramaticaly improved + performance. + - New F: (feature) lines in ircd.conf, and the GET/SET commands allow + many settings to be changed dynamically, rather than by with compile- + time configuration. + - The new "account" feature added to the P10 protocol, allows people to + remain logged in to service bots (i.e., gnuworld) during a netsplit. + This means people will not have to login again once the network rejoins. + +INSTALLATION + +Please see the INSTALL file for installation instructions, for hints on how +to best configure your OS for running ircu under high load, see the various +README. files. + +COMPATIBILITY + +This version of ircu will only work with servers that use the P10 protocol, +some of the new features will only work between ircu2.10.11 servers. + +GENERAL PERFORMANCE HINTS + +For platform-specific notes and hints, see the various README. +files included in this distribution. The notes below apply to servers that +will serve large numbers (thousands) of clients simultaneously. If your +server serves a small amount of users, you will not really have to do much +of anything about performance tuning. + + - Run an OS that supports an asynchronous network event engine; currently + these are FreeBSD (kqueue), and Solaris (/dev/poll); possibly other BSDs + will also support kqueue. This will have a dramatic effect on performance. + - Make things as lean as possible: Make your server dedicated to ircu, + disable anything that is not neccesary, and build a custom kernel (where + possible). + - Tune kernel parameters; see the various README. files as well + as your OS documentation for more information. + - With many clients connecting each second, ircu will be doing lots of DNS + lookups. Make sure that the DNS server(s) in your /etc/resolv.conf are as + close as possible, or run a local caching DNS server on your IRC server. + +TIME SYNCHRONIZATION + +Many things can and will go horribly wrong when the clocks on the servers +on your network become (too far) out of sync. It is therefore highly +recommended that all servers run a version of ntpd that will keep their +clocks from going astray. + +INFORMATION HIDING + +As per undernet-admins CFV-165, this server contains code that will, +by default, hide certain information from ordinary users. If you do +not want this, please make sure you add -DINCLUDED_ircd_policy_h to +CFLAGS prior to running ./configure, like in: + +> CFLAGS=-DINCLUDED_ircd_policy_h ./configure + +MORE INFORMATION + +For more information on this software, see the included documentation +in the doc/ directory, as well as http://coder-com.undernet.org. + +For general information on the Undernet, vist http://www.undernet.org + +Happy IRCing! diff --git a/README.FreeBSD b/README.FreeBSD new file mode 100644 index 0000000..2534ec5 --- /dev/null +++ b/README.FreeBSD @@ -0,0 +1,37 @@ +Running ircu2.10.11 on FreeBSD + +When running on FreeBSD, ircu can make use of the kqueue() event engine, which +results in much improved performance over the old poll()-based method. kqueue +is included in the more recent 4.x releases of FreeBSD. + +In order for ircu to be able to serve many clients simultaneously, you need +to increase the maximum allowable number of open files in the system. To do +this, add commands such as the following during your system's boot sequence: + +sysctl -w kern.maxfiles=16384 +sysctl -w kern.maxfilesperproc=16384 + +Unless you will be serving thousands of clients simultaneously, you will not +need to do the following, unless of course you just can't stand having a +system that is not optimized to its limits :) + +Build a custom kernel: Make your kernel as lean as possible by removing all +drivers and options you will not need. The following parameters will affect +performance, they are listed with suggested values only. For more information +on what they do exactly, see FreeBSD's documentation. + +maxusers 2048 +options NMBCLUSTERS=65535 +options ICMP_BANDLIM + +Also, you may wish to run the following at system startup (from /etc/rc.local, +or whichever other method you prefer): + +sysctl -w net.inet.tcp.rfc1323=1 +sysctl -w net.inet.tcp.delayed_ack=0 +sysctl -w net.inet.tcp.restrict_rst=1 +sysctl -w kern.ipc.maxsockbuf=2097152 +sysctl -w kern.ipc.somaxconn=2048 + +Created by Sengaia , July 20 2002. + diff --git a/README.Solaris b/README.Solaris new file mode 100644 index 0000000..565260a --- /dev/null +++ b/README.Solaris @@ -0,0 +1,20 @@ + +Running ircu2.10.11 on Solaris + +When running on Solaris, ircu can make use of the /dev/poll event engine, which +results in much improved performance over the old poll()-based method. Solaris +versions 8 and 9 include /dev/poll out of the box, for Solaris 7 you will have +to grab and install Patch-ID 106541-21. + +In order to increase the number of clients ircu can handle, add lines such as +the following to /etc/system: + +* set hard limit on file descriptors +set rlim_fd_max = 16384 +* set soft limit on file descriptors +set rlim_fd_cur = 8192 + +For more useful hints see http://www.sean.de/Solaris/soltune.html + +Created by Sengaia on July 20, 2002. + diff --git a/RELEASE.NOTES b/RELEASE.NOTES index 2b6dfc8..5016e61 100644 --- a/RELEASE.NOTES +++ b/RELEASE.NOTES @@ -268,6 +268,8 @@ OPEN_MAX=4096 FD_SETSIZE=4096 NMBCLUSTERS=8096 +If you have trouble connecting *out* from your machine try: + sysctl -w net.inet.ip.portrange.last=10000 Solaris 2.6 --Tar diff --git a/TODO b/TODO deleted file mode 100644 index 09bdc45..0000000 --- a/TODO +++ /dev/null @@ -1,44 +0,0 @@ - -Undernet Server TODO List -This list contains things that still need to be done. - -Remember: -Premature optimisation is the root of all evil - Knuth -Debugging is at least twice as difficult as programming. So if you -write a program that uses all of your ability, you'll never be able -to debug it all. - -Current Bugs: -* privmsg doesn't work because of bugs in unique_vector - -High Priority: - -* something is leaking "a meg a minute" with heap debugging on - with 1300+ clients - (No idea) -* add_Target in s_user.c turns pointers to ints - this doesn't make much sence on alpha where sizeof(void *) != sizeof(int) - -Medium Priority: -* crule parser coredumps on invalid input -* why do the allocation counts change the first time you rehash - after a server boot without changing the conf file: - *** Allocations: 416(41848) - *** ircd.conf : Rehashing - *** Allocations: 424(42006) - *** ircd.conf : Rehashing - *** Allocations: 424(42006) - -* Use numeric nicks for numeric replies to remote clients -* Finish message handlers. -* Clean up ircd.conf processing, lots of sub issues. -* Implement PROTOCOL handshaking - http://www.xs4all.nl/~carlo17/irc/prot.html -* Prepare network code to handle even more connections: - http://www.kegel.com/c10k.html -* Implement zlib compression for server links. -* Cleanups, lots of them. -* Document undernet protocol as it is used in - doc/rfc1459.unet -* Finish tokenization. - diff --git a/configure.in b/configure.in index 4e01494..81bda6c 100644 --- a/configure.in +++ b/configure.in @@ -106,6 +106,11 @@ AC_SEARCH_LIBS(crypt, descrypt crypt, , dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff AC_LIBRARY_NET +dnl Look for res_mkquery. Done after AC_LIBRARY_NET in case res_mkquery +dnl is in one of those libraries somewhere. +AC_SEARCH_LIBS(res_mkquery, resolv, , +[AC_MSG_ERROR([Unable to find library containing res_mkquery()])]) + dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(poll.h sys/devpoll.h sys/event.h) @@ -284,19 +289,6 @@ if test x"$unet_cv_enable_symbols" = xyes; then CFLAGS="-g $CFLAGS" fi -dnl Check for --disable-headinsand -AC_MSG_CHECKING([whether to enable head in sand 'features']) -AC_ARG_ENABLE([headinsand], -[ --disable-headinsand Disable head in sand (-DNO_HEAD_IN_SAND)], -[unet_cv_enable_headinsand=$enable_headinsand], -[AC_CACHE_VAL(unet_cv_enable_headinsand, -[unet_cv_enable_headinsand=yes])]) -AC_MSG_RESULT([$unet_cv_enable_headinsand]) - -if test x"$unet_cv_enable_headinsand" = xno; then - CFLAGS="-DNO_HEAD_IN_SAND $CFLAGS" -fi - dnl Now check for --enable-profile AC_MSG_CHECKING([whether to enable profiling support (gprof)]) AC_ARG_ENABLE([profile], @@ -352,7 +344,7 @@ fi dnl --disable-devpoll check... AC_MSG_CHECKING([whether to enable the /dev/poll event engine]) AC_ARG_ENABLE([devpoll], -[ --disable-devpoll Enable the /dev/poll-based engine], +[ --disable-devpoll Disable the /dev/poll-based engine], [unet_cv_enable_devpoll=$enable_devpoll], [AC_CACHE_VAL(unet_cv_enable_devpoll, [unet_cv_enable_devpoll=yes])]) @@ -371,7 +363,7 @@ fi dnl --disable-kqueue check... AC_MSG_CHECKING([whether to enable the kqueue event engine]) AC_ARG_ENABLE([kqueue], -[ --disable-kqueue Enable the kqueue-based engine], +[ --disable-kqueue Disable the kqueue-based engine], [unet_cv_enable_kqueue=$enable_kqueue], [AC_CACHE_VAL(unet_cv_enable_kqueue, [unet_cv_enable_kqueue=yes])]) diff --git a/ChangeLog.07 b/doc/history/ChangeLog.07 similarity index 96% rename from ChangeLog.07 rename to doc/history/ChangeLog.07 index f5ceb2e..0b3204b 100644 --- a/ChangeLog.07 +++ b/doc/history/ChangeLog.07 @@ -1,7 +1,7 @@ # # ChangeLog for Undernet ircu Servers # -# $Id: ChangeLog.07,v 1.1 2000-03-18 05:20:28 bleep Exp $ +# $Id: ChangeLog.07,v 1.2 2003-01-08 03:17:18 klmitch Exp $ # # Please insert new entries on the top of the list, a one or two line comment # is sufficient. Please include your name on the entries we know who to blame. diff --git a/ChangeLog.10 b/doc/history/ChangeLog.10 similarity index 99% rename from ChangeLog.10 rename to doc/history/ChangeLog.10 index 6841b04..9869776 100644 --- a/ChangeLog.10 +++ b/doc/history/ChangeLog.10 @@ -1,7 +1,7 @@ # # ChangeLog for ircu2.10.10 # -# $Id: ChangeLog.10,v 1.10 2001-07-28 16:57:33 kev Exp $ +# $Id: ChangeLog.10,v 1.2 2003-01-08 03:17:18 klmitch Exp $ # # Insert new changes at beginning of the change list. # diff --git a/doc/readme.asll b/doc/readme.asll new file mode 100644 index 0000000..a48470b --- /dev/null +++ b/doc/readme.asll @@ -0,0 +1,25 @@ +AsLL preliminary documentation, last updated 13 Jun 2002 + +Server-to-server ping format: + + G ! + +prefix = origin server numeric +local-ts = local timestamp, as "seconds.miliseconds" +target = target server numeric + +The local-ts is also sent instead of the origin field, +so RTT information can be collected from non-AsLL servers, +while preserving backward compatibility. + + +Server-to-server pong format: + + Z + +prefix = origin server numeric +origin = origin server numeric +target = target server numeric +remote-ts = remote timestamp as received from an AsLL PING +diff = difference between local-ts and remote-ts in miliseconds (integer) +local-ts = local timestamp, as "seconds.miliseconds" diff --git a/doc/readme.features b/doc/readme.features index 5d9aea6..597f458 100644 --- a/doc/readme.features +++ b/doc/readme.features @@ -1,7 +1,9 @@ Many of the old compile-time options are now configured through the server configuration file, ircd.conf. This file is intended to document each of these features. Logging, although also configured -through the use of F-lines, is documented in doc/readme.log. +through the use of F-lines, is documented in doc/readme.log. NOTE +THAT THESE NAMES ARE CASE SENSITIVE! Values are not case sensitive +unless stated otherwise in the documentation for that feature. DOMAINNAME * Type: string @@ -126,6 +128,13 @@ MOTD_BANNER If you enable NODEFAULTMOTD, this specifies a one-line banner to be sent to the client in addition to the instructions mentioned above. +PROVIDER + * Type: string + * Default: NULL + +This string as added to the 001 numeric prefixed with "via" before the nick. +It's used for providing promotional space to providers as per CFV-202 + KILL_IPMISMATCH * Type: boolean * Default: FALSE @@ -223,7 +232,7 @@ number of clients" / 25. HOST_HIDING * Type: boolean - * Default: FALSE + * Default: TRUE This selects whether local users can set umode +x, thus allowing them to hide their hostname if they have also registered with a channel @@ -242,6 +251,20 @@ HIDDEN_IP This selects a fake IP to be shown on /USERIP and /WHO %i when the target has a hidden host (see HOST_HIDING). +AUTOHIDE + * Type: boolean + * Default: TRUE + +If enabled, local users get umode +x by default when they connect. + +CONNEXIT_NOTICES + * Type: boolean + * Default: FALSE + +This feature controls the generation of server notices when a user +connects to or disconnects from the server. Enabling this feature may +have a performance impact. + KILLCHASETIMELIMIT * Type: integer * Default: 30 @@ -606,6 +629,20 @@ OPER_LOPMODE This selects whether global IRC operators on this server are permitted to use /OPMODE and /CLEARMODE on local ("&") channels. +OPER_FORCE_OPMODE + * Type: boolean + * Default: TRUE + +This selects whether global IRC operators on this server are permitted +to override Q-lines set for /OPMODE and /CLEARMODE on ordinary ("#") channels + +OPER_FORCE_LOPMODE + * Type: boolean + * Default: TRUE + +This selects whether global IRC operators on this server are permitted +to override Q-lines set for /OPMODE and /CLEARMODE on local ("&") channels + OPER_BADCHAN * Type: boolean * Default: FALSE @@ -703,6 +740,13 @@ LOCOP_LOPMODE This selects whether local IRC operators are permitted to use /OPMODE and /CLEARMODE on local ("&") channels. +LOCOP_FORCE_LOPMODE + * Type: boolean + * Default: TRUE + +This selects whether local IRC operators on this server are permitted +to override Q-lines set for /OPMODE and /CLEARMODE on local ("&") channels + LOCOP_LBADCHAN * Type: boolean * Default: FALSE @@ -743,3 +787,290 @@ LOCOP_LIST_CHAN This selects whether local IRC operators are permitted to list secret (+s) channels. +HIS_MAP + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /MAP from users. + +HIS_SNOTICES + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes server notices from users. + +HIS_SNOTICES_OPER_ONLY + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes server notices from users. + +HIS_DESYNCS + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes server wallops from users. + +HIS_DEBUG_OPER_ONLY + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes server wallops from users. + +HIS_WALLOPS + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes operator wallops from users. + +HIS_LINKS + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /LINKS from users. + +HIS_TRACE + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /TRACE from users. + +HIS_STATS_l + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS l from users. + +HIS_STATS_c + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS c from users. + +HIS_STATS_g + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS g from users. + +HIS_STATS_h + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS h from users. + +HIS_STATS_k + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS k from users. + +HIS_STATS_f + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS f from users. + +HIS_STATS_i + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS i from users. + +HIS_STATS_j + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS j from users. + +HIS_STATS_M + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS M from users. + +HIS_STATS_m + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS m from users. + +HIS_STATS_o + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS o from users. + +HIS_STATS_p + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS p from users. + +HIS_STATS_q + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS q from users. + +HIS_STATS_r + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS r from users. + +HIS_STATS_d + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS d from users. + +HIS_STATS_e + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS e from users. + +HIS_STATS_t + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS t from users. + +HIS_STATS_T + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS T from users. + +HIS_STATS_u + * Type: boolean + * Default: FALSE + +As per UnderNet CFV-165, this allows users to perform /STATS u. + +HIS_STATS_U + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS U from users. + +HIS_STATS_v + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS v from users. + +HIS_STATS_w + * Type: boolean + * Default: FALSE + +As per UnderNet CFV-165, this allows users to perform /STATS w. + +HIS_STATS_x + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS x from users. + +HIS_STATS_y + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS y from users. + +HIS_STATS_z + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS z from users. + +HIS_WHOIS_SERVERNAME + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes server names in replies to /WHOIS. + +HIS_WHOIS_IDLETIME + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes idle time in replies to /WHOIS. + +HIS_WHO_SERVERNAME + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes server names in replies to /WHO. + +HIS_WHO_HOPCOUNT + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this replaces hopcount to a static 3 in replies to /WHO. + +HIS_BANWHO + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this doesn't show which server set a ban. + +HIS_KILLWHO + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this doesn't show which server or oper performed a +kill. + +HIS_REWRITE + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this remaps remote numerics to come from the local +server. + +HIS_REMOTE + * Type: integer + * Default: 1 + +As per UnderNet CFV-165, this disallows remote queries. (*sob!*) + +HIS_NETSPLIT + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes server names in net break sign-offs. + +HIS_SERVERNAME + * Type: string + * Default: "*.undernet.org" + +As per UnderNet CFV-165, this is the "name" of the server shown to users on a +/WHOIS of another user. + +HIS_SERVERINFO + * Type: string + * Default: "The Undernet Underworld" + +As per UnderNet CFV-165, this is the "info" of the server shown to users on a +/WHOIS of another user. + +HIS_URLSERVERS + * Type: string + * Default: "http://www.undernet.org/servers.php" + +As per UnderNet CFV-165, this is the URL shown to users when they do a /MAP or +/LINKS. + +NETWORK + * Type: string + * Default: "UnderNet" + +This defines the network name as reported in the 005 "supported features" +numeric, and as used by the "Failed to deliver" message. + +URL_CLIENTS + * Type: string + * Default: "ftp://ftp.undernet.org/pub/irc/clients" + +This defines a URL that users may visit to find compatible IRC clients. diff --git a/doc/readme.log b/doc/readme.log index f1ac51f..d4bfe70 100644 --- a/doc/readme.log +++ b/doc/readme.log @@ -160,7 +160,7 @@ Logging to Syslog By default, except for the CONFIG subsystem, no logs are sent to syslog. This can be overridden using an F-line like -"F:LOG::SYSLOG:"; , as above, should be +"F:LOG::FACILITY:"; , as above, should be replaced with one of the subsystem names described above, and must be one of the facility strings mentioned under "Default Syslog Facility." The facility string may also be "NONE," to diff --git a/include/channel.h b/include/channel.h index d12072c..96c878a 100644 --- a/include/channel.h +++ b/include/channel.h @@ -348,6 +348,7 @@ extern void remove_user_from_all_channels(struct Client* cptr); extern int is_chan_op(struct Client *cptr, struct Channel *chptr); extern int is_zombie(struct Client *cptr, struct Channel *chptr); extern int has_voice(struct Client *cptr, struct Channel *chptr); +extern int IsInvited(struct Client* cptr, struct Channel* chptr); extern void send_channel_modes(struct Client *cptr, struct Channel *chptr); extern char *pretty_mask(char *mask); extern void del_invite(struct Client *cptr, struct Channel *chptr); diff --git a/include/handlers.h b/include/handlers.h index 55abeaa..bbd483e 100644 --- a/include/handlers.h +++ b/include/handlers.h @@ -85,7 +85,6 @@ struct Client; extern int m_admin(struct Client*, struct Client*, int, char*[]); -extern int ms_asll(struct Client*, struct Client*, int, char*[]); extern int m_away(struct Client*, struct Client*, int, char*[]); extern int m_cnotice(struct Client*, struct Client*, int, char*[]); extern int m_cprivmsg(struct Client*, struct Client*, int, char*[]); @@ -173,6 +172,7 @@ extern int mr_pong(struct Client*, struct Client*, int, char*[]); extern int mr_server(struct Client*, struct Client*, int, char*[]); extern int ms_account(struct Client*, struct Client*, int, char*[]); extern int ms_admin(struct Client*, struct Client*, int, char*[]); +extern int ms_asll(struct Client*, struct Client*, int, char*[]); extern int ms_away(struct Client*, struct Client*, int, char*[]); extern int ms_burst(struct Client*, struct Client*, int, char*[]); extern int ms_clearmode(struct Client*, struct Client*, int, char*[]); diff --git a/include/ircd_defs.h b/include/ircd_defs.h index 04b9074..14978fd 100644 --- a/include/ircd_defs.h +++ b/include/ircd_defs.h @@ -29,16 +29,6 @@ * revision. Every server on a given network must also use the same sizes. */ -/* - * NETWORK is the name the server claims the network is - */ -#define NETWORK "UnderNet" - -/* - * URL_CLIENTS is a URL to where to find compatible clients - */ -#define URL_CLIENTS "ftp://ftp.undernet.org/pub/irc/clients" - /* * NICKLEN is the maximum length allowed for a nickname * diff --git a/include/ircd_policy.h b/include/ircd_policy.h deleted file mode 100644 index 1576435..0000000 --- a/include/ircd_policy.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * IRC - Internet Relay Chat, include/ircd_policy.h - * Copyright (C) 1990 Jarkko Oikarinen and - * University of Oulu, Computing Center - * - * 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 2, 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$ - */ -#ifndef INCLUDED_ircd_policy_h -#define INCLUDED_ircd_policy_h - -/* This file contains undernet admin policy decisions, even if they are - * braindead and silly. These aren't configurable as they are network - * policy, and should not be changed (depending on what network your - * on different ones of these should be defined - */ - -/* If you want nothing to do with this nonsense, uncomment this or - * add -DNO_HEAD_IN_SAND to CFLAGS. */ -/* #define NO_HEAD_IN_SAND */ - -#ifndef NO_HEAD_IN_SAND - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 1) Removal of server notices from users - * - * This is implemented as disallowing users from setting +s - */ -#define HEAD_IN_SAND_SNOTICES -#define SERVNOTICE_OPER_ONLY - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 2) Removal of server wallops from users - * - * This is implemented by making all server wallops DESYNC's, and removing - * +g from normal users. - */ -#define HEAD_IN_SAND_DESYNCS -#define DEBUG_OPER_ONLY - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 3) Removal of operator wallops from users - * - * This is implemented as disallowing users from setting +w - */ -#define HEAD_IN_SAND_WALLOPS -/* #define WALLOPS_OPER_ONLY */ - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 5) Removal of /MAP from users. - * - */ -#define HEAD_IN_SAND_MAP - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 6) Removal of links from users - */ -#define HEAD_IN_SAND_LINKS - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 7) Restrict the output of LINKS to only display known leaves. - */ - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 8) Removal of /TRACE from users. - */ -#define HEAD_IN_SAND_TRACE - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 9-13) Removal of various stats from non users - */ -#define HEAD_IN_SAND_STATS_L -#define HEAD_IN_SAND_STATS_C -#define HEAD_IN_SAND_STATS_G -#define HEAD_IN_SAND_STATS_H -#define HEAD_IN_SAND_STATS_K -#define HEAD_IN_SAND_STATS_F -#define HEAD_IN_SAND_STATS_I -#define HEAD_IN_SAND_STATS_M -#define HEAD_IN_SAND_STATS_m -#define HEAD_IN_SAND_STATS_O -#define HEAD_IN_SAND_STATS_P -#define HEAD_IN_SAND_STATS_R -#define HEAD_IN_SAND_STATS_D -#define HEAD_IN_SAND_STATS_d -#define HEAD_IN_SAND_STATS_E -#define HEAD_IN_SAND_STATS_t -#define HEAD_IN_SAND_STATS_T -#define HEAD_IN_SAND_STATS_U -#undef HEAD_IN_SAND_STATS_u -#undef HEAD_IN_SAND_STATS_W -#define HEAD_IN_SAND_STATS_X -#define HEAD_IN_SAND_STATS_Y -#define HEAD_IN_SAND_STATS_Z - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 14) Removal of server names in net break sign-offs. - */ - -#define HEAD_IN_SAND_NETSPLIT - -/* CFV-165 - Hiding Nonessential information from non-opers - * - * 15) Removal of server names in replies to /WHOIS - */ - -#define HEAD_IN_SAND_WHOIS_SERVERNAME -#define HEAD_IN_SAND_WHOIS_IDLETIME -#define HEAD_IN_SAND_WHO_SERVERNAME -#define HEAD_IN_SAND_WHO_HOPCOUNT - -/* CFV-165 - Hiding Nonessential information from non-opers - * - */ - -/* don't show which server set a ban */ -#define HEAD_IN_SAND_BANWHO - -/* Don't show which server or oper performed a kill */ -#define HEAD_IN_SAND_KILLWHO - -/* remap remote numerics to come from the local server */ -#define HEAD_IN_SAND_REWRITE - -/* disallow remote queries (*sob!*) */ -/* (note, set this to 0 to reenable, not undef */ -#define HEAD_IN_SAND_REMOTE 1 -#else /* NO_HEAD_IN_SAND */ -#define HEAD_IN_SAND_REMOTE 0 -#endif /* NO_HEAD_IN_SAND */ - -#define HEAD_IN_SAND_SERVERNAME "*.undernet.org" -#define HEAD_IN_SAND_SERVERINFO "The Undernet Underworld" - -#define URL_SERVERS "http://www.undernet.org/servers.php" - -#endif /* INCLUDED_ircd_policy_h */ - - - - - - - - diff --git a/include/jupe.h b/include/jupe.h index e59788d..795d33b 100644 --- a/include/jupe.h +++ b/include/jupe.h @@ -71,5 +71,6 @@ extern void jupe_free(struct Jupe *jupe); extern void jupe_burst(struct Client *cptr); extern int jupe_resend(struct Client *cptr, struct Jupe *jupe); extern int jupe_list(struct Client *sptr, char *server); +extern int jupe_memory_count(size_t *ju_size); #endif /* INCLUDED_jupe_h */ diff --git a/include/msgq.h b/include/msgq.h index b7b5535..cde01bb 100644 --- a/include/msgq.h +++ b/include/msgq.h @@ -37,17 +37,6 @@ struct iovec; struct Client; struct StatDesc; -struct MsgCounts { - int alloc; - int used; -}; - -/* - * These should be considered read-only - */ -extern struct MsgCounts msgBufCounts; /* resource count for struct MsgBuf */ -extern struct MsgCounts msgCounts; /* resource count for struct Msg */ - struct Msg; struct MsgBuf; diff --git a/include/numeric.h b/include/numeric.h index ec38079..72c5b51 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -113,6 +113,7 @@ extern const struct Numeric* get_error_numeric(int err); RPL_STATSGLINE 227 Dalnet RPL_STATSVLINE 227 unreal */ #define RPL_STATSQLINE 228 /* Undernet extension */ + #define RPL_SERVICEINFO 231 /* unused */ #define RPL_ENDOFSERVICES 232 /* unused */ /* RPL_RULES 232 unreal */ @@ -304,6 +305,7 @@ extern const struct Numeric* get_error_numeric(int err); /* RPL_USERS 393 Dalnet/EFnet/IRCnet */ /* RPL_END_USERS 394 Dalnet/EFnet/IRCnet */ /* RPL_NOUSERS 395 Dalnet/EFnet/IRCnet */ +#define RPL_HOSTHIDDEN 396 /* UMODE +x completed succesfuly */ /* * Errors are in the range from 400-599 currently and are grouped by what diff --git a/include/s_stats.h b/include/s_stats.h index 967aeac..2298fa3 100644 --- a/include/s_stats.h +++ b/include/s_stats.h @@ -24,6 +24,9 @@ #ifndef INCLUDED_s_stats_h #define INCLUDED_s_stats_h +#ifndef INCLUDED_features_h +#include "ircd_features.h" +#endif struct Client; @@ -50,10 +53,6 @@ struct StatDesc extern struct StatDesc statsinfo[]; extern struct StatDesc *statsmap[]; -extern void report_stats(struct Client *sptr, char stat); -extern void report_configured_links(struct Client *sptr, int mask); -extern int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[], char stat, int MustBeOper); - extern void stats_init(void); #endif /* INCLUDED_s_stats_h */ diff --git a/ircd/Makefile.in b/ircd/Makefile.in index 2aeed4a..0edee0d 100644 --- a/ircd/Makefile.in +++ b/ircd/Makefile.in @@ -251,7 +251,7 @@ version.c: version.c.SH s_serv.c s_user.c channel.c s_bsd.c s_misc.c ircd.c \ ircd_string.o: ircd_string.c chattr.tab.c table_gen: table_gen.o - ${CC} -o $@ table_gen.o + ${CC} ${LDFLAGS} -o $@ table_gen.o chattr.tab.c: table_gen ./table_gen > chattr.tab.c diff --git a/ircd/engine_poll.c b/ircd/engine_poll.c index 01bd0a3..a0159ef 100644 --- a/ircd/engine_poll.c +++ b/ircd/engine_poll.c @@ -303,8 +303,6 @@ engine_loop(struct Generators* gen) } } - /* assert(!(pollfdList[i].revents & POLLERR)); */ - #ifdef POLLHUP if (pollfdList[i].revents & POLLHUP) { /* hang-up on socket */ Debug((DEBUG_ENGINE, "poll: EOF from client (POLLHUP)")); diff --git a/ircd/ircd.c b/ircd/ircd.c index 27d56ba..5888513 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -50,6 +50,7 @@ #include "s_conf.h" #include "s_debug.h" #include "s_misc.h" +#include "s_stats.h" #include "send.h" #include "sys.h" #include "uping.h" @@ -665,6 +666,8 @@ int main(int argc, char **argv) { uping_init(); + stats_init(); + IPcheck_init(); timer_add(timer_init(&connect_timer), try_connections, 0, TT_RELATIVE, 1); timer_add(timer_init(&ping_timer), check_pings, 0, TT_RELATIVE, 1); diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c index f0ad610..ccbd9fe 100644 --- a/ircd/ircd_features.c +++ b/ircd/ircd_features.c @@ -381,6 +381,7 @@ static struct FeatureDesc { /* Misc. random stuff */ F_S(NETWORK, 0, "UnderNet", 0), F_S(URL_CLIENTS, 0, "ftp://ftp.undernet.org/pub/irc/clients", 0), + #undef F_S #undef F_B #undef F_I @@ -397,7 +398,7 @@ feature_desc(struct Client* from, const char *feature) assert(0 != feature); for (i = 0; features[i].type; i++) /* find appropriate descriptor */ - if (!ircd_strcmp(feature, features[i].type)) + if (!strcmp(feature, features[i].type)) return &features[i]; Debug((DEBUG_ERROR, "Unknown feature \"%s\"", feature)); diff --git a/ircd/ircd_relay.c b/ircd/ircd_relay.c index 2b59926..49541e4 100644 --- a/ircd/ircd_relay.c +++ b/ircd/ircd_relay.c @@ -30,8 +30,8 @@ #include "hash.h" #include "ircd.h" #include "ircd_chattr.h" -#include "ircd_reply.h" #include "ircd_features.h" +#include "ircd_reply.h" #include "ircd_string.h" #include "match.h" #include "msg.h" diff --git a/ircd/m_account.c b/ircd/m_account.c index aa795ed..9a7cfe8 100644 --- a/ircd/m_account.c +++ b/ircd/m_account.c @@ -90,6 +90,7 @@ #include "send.h" #include +#include /* * ms_account - server message handler diff --git a/ircd/m_clearmode.c b/ircd/m_clearmode.c index ac164d2..2ac7652 100644 --- a/ircd/m_clearmode.c +++ b/ircd/m_clearmode.c @@ -299,17 +299,15 @@ mo_clearmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) force = 1; } - clean_channelname(parv[1]); - if (!HasPriv(sptr, - IsLocalChannel(parv[1]) ? PRIV_LOCAL_OPMODE : PRIV_OPMODE)) + IsLocalChannel(chname) ? PRIV_LOCAL_OPMODE : PRIV_OPMODE)) return send_reply(sptr, ERR_NOPRIVILEGES); if (('#' != *chname && '&' != *chname) || !(chptr = FindChannel(chname))) return send_reply(sptr, ERR_NOSUCHCHANNEL, chname); + if (!force && (qreason = find_quarantine(chptr->chname))) return send_reply(sptr, ERR_QUARANTINED, chptr->chname, qreason); - return do_clearmode(cptr, sptr, chptr, control); } diff --git a/ircd/m_create.c b/ircd/m_create.c index f496aae..b66b4c8 100644 --- a/ircd/m_create.c +++ b/ircd/m_create.c @@ -138,9 +138,6 @@ int ms_create(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) "SETTIME to correct this", cli_user(sptr)->server, chanTS - TStime()); - /* If this server is >5 minutes fast, squit it */ - if (TStime() - chanTS<-5*60*60) - return exit_client(sptr, sptr, &me, "Timestamp Drift/Bogus TS"); /* Now issue a SETTIME to resync. If we're in the wrong, our * (RELIABLE_CLOCK) hub will bounce a SETTIME back to us. */ @@ -151,7 +148,6 @@ int ms_create(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) joinbuf_init(&join, sptr, cptr, JOINBUF_TYPE_JOIN, 0, 0); joinbuf_init(&create, sptr, cptr, JOINBUF_TYPE_CREATE, 0, chanTS); - /* For each channel in the comma seperated list: */ for (name = ircd_strtok(&p, parv[1], ","); name; name = ircd_strtok(&p, 0, ",")) { @@ -187,7 +183,7 @@ int ms_create(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) chptr->creationtime = chanTS; joinbuf_join(badop ? &join : &create, chptr, - (badop || CHFL_CHANOP)); + (badop ? 0 : CHFL_CHANOP)); } joinbuf_flush(&join); /* flush out the joins and creates */ diff --git a/ircd/m_gline.c b/ircd/m_gline.c index cee85ac..027d88e 100644 --- a/ircd/m_gline.c +++ b/ircd/m_gline.c @@ -131,7 +131,7 @@ ms_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (*mask == '!') { mask++; - flags |= GLINE_OPERFORCE; + flags |= GLINE_OPERFORCE; /* assume oper had WIDE_GLINE */ } if ((parc == 3 && *mask == '-') || parc == 5) @@ -151,6 +151,9 @@ ms_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) else return need_more_params(sptr, "GLINE"); + if (IsServer(sptr)) + flags |= GLINE_FORCE; + if (!(target[0] == '*' && target[1] == '\0')) { if (!(acptr = FindNServer(target))) return 0; /* no such server */ @@ -296,11 +299,11 @@ mo_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (!(flags & GLINE_LOCAL) && !feature_bool(FEAT_CONFIG_OPERCMDS)) return send_reply(sptr, ERR_DISABLED, "GLINE"); - agline = gline_find(mask, GLINE_ANY | GLINE_EXACT); - if (!HasPriv(sptr, (flags & GLINE_LOCAL ? PRIV_LOCAL_GLINE : PRIV_GLINE))) return send_reply(sptr, ERR_NOPRIVILEGES); + agline = gline_find(mask, GLINE_ANY | GLINE_EXACT); + if (agline) { if (GlineIsLocal(agline) && !(flags & GLINE_LOCAL)) /* global over local */ gline_free(agline); diff --git a/ircd/m_kick.c b/ircd/m_kick.c index 4aed611..86d966c 100644 --- a/ircd/m_kick.c +++ b/ircd/m_kick.c @@ -235,8 +235,9 @@ int ms_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) comment); if (member) { /* and tell the channel about it */ - sendcmdto_channel_butserv_butone(sptr, CMD_KICK, chptr, NULL, "%H %C :%s", chptr, who, - comment); + sendcmdto_channel_butserv_butone(IsServer(sptr) ? &me : sptr, CMD_KICK, + chptr, NULL, "%H %C :%s", chptr, who, + comment); make_zombie(member, who, cptr, sptr, chptr); } diff --git a/ircd/m_lusers.c b/ircd/m_lusers.c index 0409235..07c562b 100644 --- a/ircd/m_lusers.c +++ b/ircd/m_lusers.c @@ -83,7 +83,7 @@ #include "client.h" #include "ircd.h" -#include "ircd_policy.h" +#include "ircd_features.h" #include "ircd_reply.h" #include "ircd_string.h" #include "msg.h" diff --git a/ircd/m_map.c b/ircd/m_map.c index fb9897f..617b482 100644 --- a/ircd/m_map.c +++ b/ircd/m_map.c @@ -84,7 +84,7 @@ #include "client.h" #include "ircd.h" #include "ircd_defs.h" -#include "ircd_policy.h" +#include "ircd_features.h" #include "ircd_reply.h" #include "ircd_snprintf.h" #include "ircd_string.h" diff --git a/ircd/m_nick.c b/ircd/m_nick.c index 48e022c..e986e2d 100644 --- a/ircd/m_nick.c +++ b/ircd/m_nick.c @@ -362,6 +362,17 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return 0; } /* now we know we have a real collision. */ + /* + * Note: From this point forward it can be assumed that + * acptr != sptr (point to different client structures). + */ + assert(acptr != sptr); + /* + * If the older one is "non-person", the new entry is just + * allowed to overwrite it. Just silently drop non-person, + * and proceed with the nick. This should take care of the + * "dormant nick" way of generating collisions... + */ if (IsUnknown(acptr) && MyConnect(acptr)) { ServerStats->is_ref++; diff --git a/ircd/m_opmode.c b/ircd/m_opmode.c index aab68f5..0c4bbe1 100644 --- a/ircd/m_opmode.c +++ b/ircd/m_opmode.c @@ -165,8 +165,8 @@ int mo_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!IsChannelName(chname) || !(chptr = FindChannel(chname))) return send_reply(sptr, ERR_NOSUCHCHANNEL, chname); - if (!(member = find_member_link(chptr, sptr))) - return send_reply(sptr, ERR_NOTONCHANNEL, chptr->chname); + if (!force && (qreason = find_quarantine(chptr->chname))) + return send_reply(sptr, ERR_QUARANTINED, chptr->chname, qreason); modebuf_init(&mbuf, sptr, cptr, chptr, (MODEBUF_DEST_CHANNEL | /* Send MODE to channel */ diff --git a/ircd/m_privmsg.c b/ircd/m_privmsg.c index 1d257e3..4427cbf 100644 --- a/ircd/m_privmsg.c +++ b/ircd/m_privmsg.c @@ -201,7 +201,7 @@ int mo_privmsg(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(cptr == sptr); assert(0 != cli_user(sptr)); - ClrFlag(cptr, FLAG_TS8); + ClrFlag(sptr, FLAG_TS8); if (feature_bool(FEAT_IDLE_FROM_MSG)) cli_user(sptr)->last = CurrentTime; diff --git a/ircd/m_settime.c b/ircd/m_settime.c index 6240b52..f770258 100644 --- a/ircd/m_settime.c +++ b/ircd/m_settime.c @@ -113,15 +113,16 @@ int ms_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) static char tbuf[11]; struct DLink *lp; - if (parc < 2) + if (parc < 2) /* verify argument count */ return need_more_params(sptr, "SETTIME"); - t = atoi(parv[1]); + t = atoi(parv[1]); /* convert time and compute delta */ dt = TStime() - t; + /* verify value */ if (t < OLDEST_TS || dt < -9000000) { - if (IsServer(sptr)) + if (IsServer(sptr)) /* protocol violation if it's from a server */ protocol_violation(sptr, "SETTIME: Bad value (%Tu, delta %l)", t, dt); else sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :SETTIME: Bad value (%Tu, " @@ -137,7 +138,7 @@ int ms_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) parv[1] = tbuf; } - if (BadPtr(parv[2])) + if (BadPtr(parv[2])) /* spam the network */ { for (lp = cli_serv(&me)->down; lp; lp = lp->next) if (cptr != lp->value.cptr) @@ -172,7 +173,7 @@ int ms_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) (dt < 0) ? -dt : dt, (dt < 0) ? "forwards" : "backwards"); } } - else + else /* tell opers about time change */ { sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, @@ -208,13 +209,14 @@ int mo_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!IsOper(sptr)) return send_reply(sptr, ERR_NOPRIVILEGES); - if (parc < 2) + if (parc < 2) /* verify argument count */ return need_more_params(sptr, "SETTIME"); - if (parc == 2 && MyUser(sptr)) + if (parc == 2 && MyUser(sptr)) /* default to me */ parv[parc++] = cli_name(&me); - t = atoi(parv[1]); + t = atoi(parv[1]); /* convert the time */ + /* If we're reliable_clock or if the oper specified a 0 time, use current */ if (!t || feature_bool(FEAT_RELIABLE_CLOCK)) { @@ -223,35 +225,36 @@ int mo_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) parv[1] = tbuf; } - dt = TStime() - t; + dt = TStime() - t; /* calculate the delta */ - if (t < OLDEST_TS || dt < -9000000) + if (t < OLDEST_TS || dt < -9000000) /* verify value */ { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :SETTIME: Bad value", sptr); return 0; } + /* OK, send the message off to its destination */ if (hunt_server_prio_cmd(sptr, CMD_SETTIME, cptr, 1, "%s %C", 2, parc, parv) != HUNTED_ISME) return 0; - if (feature_bool(FEAT_RELIABLE_CLOCK)) + if (feature_bool(FEAT_RELIABLE_CLOCK)) /* don't apply settime--reliable */ { if ((dt > 600) || (dt < -600)) sendcmdto_serv_butone(&me, CMD_DESYNCH, 0, ":Bad SETTIME from %s: %Tu " "(delta %l)", cli_name(sptr), t, dt); - if (IsUser(sptr)) + if (IsUser(sptr)) /* Let user know we're ignoring him */ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is not set %ld seconds " "%s: RELIABLE_CLOCK is defined", sptr, (dt < 0) ? -dt : dt, (dt < 0) ? "forward" : "backward"); } - else + else /* tell opers about time change */ { sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, (dt < 0) ? "forwards" : "backwards"); - TSoffset -= dt; - if (IsUser(sptr)) + TSoffset -= dt; /* apply time change */ + if (IsUser(sptr)) /* let user know what we did */ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is set %ld seconds %s", sptr, (dt < 0) ? -dt : dt, (dt < 0) ? "forwards" : "backwards"); diff --git a/ircd/m_squit.c b/ircd/m_squit.c index 8611b21..c0282fe 100644 --- a/ircd/m_squit.c +++ b/ircd/m_squit.c @@ -77,8 +77,6 @@ int ms_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) acptr = FindNServer(server); if (!acptr) { - protocol_violation(sptr, "Issued SQUIT for unknown server %s (ignored)", - server); Debug((DEBUG_NOTICE, "Ignoring SQUIT to an unknown server")); return 0; } @@ -97,9 +95,6 @@ int ms_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if ( timestamp != 0 && timestamp != cli_serv(acptr)->timestamp) { - protocol_violation(sptr, "Issued SQUIT for %C with wrong timestamp %Tu " - "(%Tu) (ignored)", acptr, timestamp, - cli_serv(acptr)->timestamp); Debug((DEBUG_NOTICE, "Ignoring SQUIT with the wrong timestamp")); return 0; } diff --git a/ircd/m_userhost.c b/ircd/m_userhost.c index 694b111..07f9ca6 100644 --- a/ircd/m_userhost.c +++ b/ircd/m_userhost.c @@ -97,7 +97,8 @@ static void userhost_formatter(struct Client* cptr, struct Client *sptr, struct msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr), HasPriv(cptr, PRIV_DISPLAY) ? "*" : "", cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username, - cli_user(cptr)->host); + HasHiddenHost(cptr) && !IsAnOper(sptr) ? + cli_user(cptr)->host : cli_user(cptr)->realhost); } /* diff --git a/ircd/m_wallvoices.c b/ircd/m_wallvoices.c index 4aa3d86..b228f17 100644 --- a/ircd/m_wallvoices.c +++ b/ircd/m_wallvoices.c @@ -146,7 +146,7 @@ int ms_wallvoices(struct Client* cptr, struct Client* sptr, int parc, char* parv if (client_can_send_to_channel(sptr, chptr)) { sendcmdto_channel_butone(sptr, CMD_WALLVOICES, chptr, cptr, SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES, - "%H :+ %s", chptr, parv[parc - 1]); + "%H :%s", chptr, parv[parc - 1]); } else send_reply(sptr, ERR_CANNOTSENDTOCHAN, parv[1]); } diff --git a/ircd/m_who.c b/ircd/m_who.c index d66775b..a9e68e2 100644 --- a/ircd/m_who.c +++ b/ircd/m_who.c @@ -210,6 +210,10 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) case 'R': matchsel |= WHO_FIELD_REN; continue; + case 'a': + case 'A': + matchsel |= WHO_FIELD_ACC; + continue; } if (ch == '%') while ((ch = *p++) && (ch != ',')) @@ -260,6 +264,10 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) case 'U': fields |= WHO_FIELD_UID; break; + case 'a': + case 'A': + fields |= WHO_FIELD_ACC; + break; default: break; } diff --git a/ircd/m_whois.c b/ircd/m_whois.c index 71a2b77..5dda1a5 100644 --- a/ircd/m_whois.c +++ b/ircd/m_whois.c @@ -186,7 +186,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc) if (feature_bool(FEAT_HIS_WHOIS_SERVERNAME) && !IsAnOper(sptr) && sptr != acptr) send_reply(sptr, RPL_WHOISSERVER, name, feature_str(FEAT_HIS_SERVERNAME), - feature_str(FEAT_HIS_SERVERNAME)); + feature_str(FEAT_HIS_SERVERINFO)); else send_reply(sptr, RPL_WHOISSERVER, name, cli_name(a2cptr), cli_info(a2cptr)); diff --git a/ircd/s_bsd.c b/ircd/s_bsd.c index 282bb5e..010d631 100644 --- a/ircd/s_bsd.c +++ b/ircd/s_bsd.c @@ -196,12 +196,10 @@ static void connect_dns_callback(void* vptr, struct DNSReply* reply) void close_connections(int close_stderr) { int i; -#if 0 close(0); close(1); if (close_stderr) close(2); -#endif for (i = 3; i < MAXCONNECTIONS; ++i) close(i); } @@ -727,11 +725,9 @@ static int read_packet(struct Client *cptr, int socket_ready) * For server connections, we process as many as we can without * worrying about the time of day or anything :) */ - if (length <= 0) - ; - else if (IsServer(cptr)) + if (length > 0 && IsServer(cptr)) return server_dopacket(cptr, readbuf, length); - else if (IsConnecting(cptr) || IsHandshake(cptr)) + else if (length > 0 && (IsHandshake(cptr) || IsConnecting(cptr))) return connect_dopacket(cptr, readbuf, length); else { @@ -740,9 +736,10 @@ static int read_packet(struct Client *cptr, int socket_ready) * it on the end of the receive queue and do it when its * turn comes around. */ - if (dbuf_put(&(cli_recvQ(cptr)), readbuf, length) == 0) + if (length > 0 && dbuf_put(&(cli_recvQ(cptr)), readbuf, length) == 0) return exit_client(cptr, cptr, &me, "dbuf_put fail"); - else if (DBufLength(&(cli_recvQ(cptr))) > feature_int(FEAT_CLIENT_FLOOD)) + + if (DBufLength(&(cli_recvQ(cptr))) > feature_int(FEAT_CLIENT_FLOOD)) return exit_client(cptr, cptr, &me, "Excess Flood"); while (DBufLength(&(cli_recvQ(cptr))) && !NoNewLine(cptr) && diff --git a/ircd/s_debug.c b/ircd/s_debug.c index a227454..da19929 100644 --- a/ircd/s_debug.c +++ b/ircd/s_debug.c @@ -26,6 +26,7 @@ #include "channel.h" #include "class.h" #include "client.h" +#include "gline.h" #include "hash.h" #include "ircd_alloc.h" #include "ircd_features.h" @@ -33,13 +34,16 @@ #include "ircd_osdep.h" #include "ircd_reply.h" #include "ircd.h" +#include "jupe.h" #include "list.h" +#include "motd.h" #include "msgq.h" #include "numeric.h" #include "numnicks.h" #include "res.h" #include "s_bsd.h" #include "s_conf.h" +#include "s_stats.h" #include "send.h" #include "struct.h" #include "sys.h" @@ -357,6 +361,13 @@ void count_memory(struct Client *cptr, struct StatDesc *sd, int stat, totww = wwu * sizeof(struct User) + wwam + wwm; + motd_memory_count(cptr); + + gl = gline_memory_count(&glm); + ju = jupe_memory_count(&jum); + send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, + ":Glines %d(%zu) Jupes %d(%zu)", gl, glm, ju, jum); + send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":Hash: client %d(%zu), chan is the same", HASHSIZE, sizeof(void *) * HASHSIZE); @@ -374,6 +385,9 @@ void count_memory(struct Client *cptr, struct StatDesc *sd, int stat, ":DBufs allocated %d(%zu) used %d(%zu)", DBufAllocCount, dbufs_allocated, DBufUsedCount, dbufs_used); + /* The DBuf caveats now count for this, but this routine now sends + * replies all on its own. + */ msgq_count_memory(cptr, &msg_allocated, &msgbuf_allocated); rm = cres_mem(cptr); diff --git a/ircd/s_err.c b/ircd/s_err.c index c2cbdd4..17f02ca 100644 --- a/ircd/s_err.c +++ b/ircd/s_err.c @@ -488,7 +488,7 @@ static Numeric replyTable[] = { /* 227 */ { 0 }, /* 228 */ - { 0 }, + { RPL_STATSQLINE, "Q %s :%s", "228" }, /* 229 */ { 0 }, /* 230 */ @@ -824,7 +824,7 @@ static Numeric replyTable[] = { /* 395 */ { 0 }, /* 396 */ - { 0 }, + { RPL_HOSTHIDDEN, "%s.%s :is now your hidden host", "396" }, /* 397 */ { 0 }, /* 398 */ @@ -994,7 +994,7 @@ static Numeric replyTable[] = { /* 480 */ { 0 }, /* 481 */ - { ERR_NOPRIVILEGES, ":Permission Denied: You're not an IRC operator", "481" }, + { ERR_NOPRIVILEGES, ":Permission Denied: Insufficient privileges", "481" }, /* 482 */ { ERR_CHANOPRIVSNEEDED, "%s :You're not channel operator", "482" }, /* 483 */ diff --git a/ircd/s_misc.c b/ircd/s_misc.c index cafbd57..7660432 100644 --- a/ircd/s_misc.c +++ b/ircd/s_misc.c @@ -31,8 +31,8 @@ #include "hash.h" #include "ircd.h" #include "ircd_alloc.h" +#include "ircd_features.h" #include "ircd_log.h" -#include "ircd_policy.h" #include "ircd_reply.h" #include "ircd_snprintf.h" #include "ircd_string.h" diff --git a/ircd/s_stats.c b/ircd/s_stats.c index d169a69..886abda 100644 --- a/ircd/s_stats.c +++ b/ircd/s_stats.c @@ -504,7 +504,7 @@ stats_init(void) int i; /* Make darn sure the statsmap array is initialized to all zeros */ - for (i = 1; i < 256; i++) + for (i = 0; i < 256; i++) statsmap[i] = 0; /* Build the mapping */ diff --git a/ircd/s_user.c b/ircd/s_user.c index 9ad2b2e..12ec782 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -276,7 +276,7 @@ int hunt_server_prio_cmd(struct Client *from, const char *cmd, const char *tok, return HUNTED_NOSUCH; } - assert(!IsServer(from)); + /* assert(!IsServer(from)); SETTIME to particular destinations permitted */ parv[server] = (char *) acptr; /* HACK! HACK! HACK! ARGH! */ @@ -1048,7 +1048,6 @@ void send_user_info(struct Client* sptr, char* names, int rpl, InfoFormatter fmt * If, after setting the flags, the user has both HiddenHost and Account * set, its hostmask is changed. */ -#define FLAGS_HOST_HIDDEN (FLAGS_ACCOUNT|FLAGS_HIDDENHOST) int hide_hostmask(struct Client *cptr, unsigned int flag) { @@ -1066,6 +1065,11 @@ hide_hostmask(struct Client *cptr, unsigned int flag) ircd_snprintf(0, cli_user(cptr)->host, HOSTLEN, "%s.%s", cli_user(cptr)->account, feature_str(FEAT_HIDDEN_HOST)); + /* ok, the client is now fully hidden, so let them know -- hikari */ + if (MyConnect(cptr)) + send_reply(cptr, RPL_HOSTHIDDEN, cli_user(cptr)->account, + feature_str(FEAT_HIDDEN_HOST)); + /* * Go through all channels the client was on, rejoin him * and set the modes, if any @@ -1283,7 +1287,8 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv } if (MyConnect(sptr)) { - if (FlagHas(&setflags, FLAG_OPER) || FlagHas(&setflags, FLAG_LOCOP)) + if (FlagHas(&setflags, FLAG_OPER) || FlagHas(&setflags, FLAG_LOCOP) && + !IsAnOper(sptr)) det_confs_butmask(sptr, CONF_CLIENT & ~CONF_OPS); if (SendServNotice(sptr)) @@ -1304,7 +1309,7 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv { /* user now oper */ ++UserStats.opers; - client_set_privs(sptr, NULL); + client_set_privs(sptr, NULL); /* may set propagate privilege */ } /* remember propagate privilege setting */ if (HasPriv(sptr, PRIV_PROPAGATE)) diff --git a/ircd/table_gen.c b/ircd/table_gen.c index 7a1cd77..5710748 100644 --- a/ircd/table_gen.c +++ b/ircd/table_gen.c @@ -98,8 +98,8 @@ static void makeTables(void) moveMacro(NTL_GRAPH, NTL_PRINT); markString(NTL_PRINT, " "); - markRange(NTL_IRCCH, 0, (char) UCHAR_MAX); - unMarkString(NTL_IRCCH, "\007\040\054\240"); + markRange(NTL_IRCCH, '\041', (char) UCHAR_MAX); + unMarkString(NTL_IRCCH, "\054\240"); markRange(NTL_IRCCL, '\300', '\326'); markRange(NTL_IRCCL, '\330', '\336'); @@ -120,7 +120,7 @@ static void makeTables(void) markRange(NTL_IRCUI, '\xd8', '\xde'); markString(NTL_IRCUI, ".-_^'`~"); markString(NTL_EOL, "\n\r"); - markString(NTL_CHPFX, "#&+"); + markString(NTL_CHPFX, "#&"); markString(NTL_KTIME, " ,-0123456789"); /* And finally let's take care of the toLower/toUpper stuff */ diff --git a/ircd/whocmds.c b/ircd/whocmds.c index e90ec21..87f7626 100644 --- a/ircd/whocmds.c +++ b/ircd/whocmds.c @@ -212,7 +212,9 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, if (fields & WHO_FIELD_IDL) { *p1++ = ' '; - if (MyUser(acptr)) + if (MyUser(acptr) && + (IsAnOper(sptr) || !feature_bool(FEAT_HIS_WHO_SERVERNAME) || + acptr == sptr)) p1 += ircd_snprintf(0, p1, 11, "%d", CurrentTime - cli_user(acptr)->last); else diff --git a/tools/linesync/linesync.conf b/tools/linesync/linesync.conf new file mode 100644 index 0000000..0694bf8 --- /dev/null +++ b/tools/linesync/linesync.conf @@ -0,0 +1,15 @@ + +# Configuration for linesync.sh +# +# - This file must be placed in the same directory as ircd.conf +# - Note that all URL's *MUST* have a trailing / +# - Since we are using wget, you could use ftp:// URL's as well if you want to + +# Where do we get our ircd.conf update? +LINE_SERVER="http://some.domain/" + +# Check servers, as many as you like, seperated by spaces +LINE_CHECK="http://host1.other.domain/lsync/ http://host-19.domain-x.net/ http://www.domain.what" + +# What .conf lines are allowed in the downloaded updates? +ALLOWED_LINES="kKQU" diff --git a/tools/linesync/linesync.sh b/tools/linesync/linesync.sh new file mode 100755 index 0000000..bac6c30 --- /dev/null +++ b/tools/linesync/linesync.sh @@ -0,0 +1,222 @@ +#!/bin/sh +# linesync.sh, Copyright (c) 2002 Arjen Wolfs +# 20020604, sengaia@undernet.org +# +# The code contained is in this file is licenced under the terms +# and conditions as specified in the GNU General Public License. +# +# linesync.sh - centralized ircd.conf updates. +# The purpose of this little shell script is to allow a section of an ircd.conf to be +# updated from a central location. Hence it is intended to facilitate the automated +# distribution of k, K, Q, and U lines; or any other .conf lines you may wish to keep +# synchronized accross all servers on a network. +# +# This script will download a file called linesync from a specified web server (see +# below for configuration), and calculate an md5sum from it. It will then download +# a file called linesync.sum from a configurable number of other web servers and +# compare the contents of these files against the checksum calculated. If any of the +# downloaded checksums mismatch, the program will abort. This provides security to +# the centralized update mechanism - in order for it to be compromised, multiple +# web servers would have to compromised. +# +# If all checksums match, the script inspects the .conf lines contained within the +# downloaded file. If any .conf lines are found that are not specifically allowed, +# the program will abort. This will prevent malicious/dangerous .conf lines (such as +# O: or C: lines) from being inserted into ircd.conf. +# +# If all the checks mentioned above are passed, the script checks ircd.conf for a section +# that begins with "# BEGIN LINESYNC", and ends with "# END LINESYNC". The section contained +# between these two comments is the section maintained by this program. If these lines are not +# found in the ircd.conf, they will be appended to it. +# Next, the script will build a new ircd.conf by removing all lines present between the two +# commented lines mentioned above, and replace them with the contents of the file downloaded. +# +# Once this has been completed, ircd.conf is backed up and replaced with the newly built version, +# and ircd will be rehashed. +# +# Configuration: This script requires two parameters - the full path to your ircd.conf, and the +# full path to your ircd.pid. It will look for a configuration file called linesync.conf in the +# same directory as ircd.conf. See the included sample linesync.conf for information on how to +# set it up. Obviously, you will need to have web server(s) to use for the distribution of your +# .conf update and checksums. This script requires the presence of wget and md5sum, and various +# other programs that should be present by default on any Unix system. +# +# This program should be run from crontab, i.e something like: +# 0 0 * * * /home/irc/bin/linesync.sh /home/irc/lib/ircd.conf /home/irc/lib/ircd.pid +# +# This program has been tested on and works on FreeBSD, Solaris, and Linux. +# md5sum is included in GNU textutils. +# +# Good Luck! +# Arjen Wolfs (sengaia@undernet.org), June 9 2002. +# + +# This checks for the presence of an executable file in $PATH +locate_program() { + if [ ! -x "`which $1 2>&1`" ]; then + echo "You don't seem to have $1. Sorry." + exit 1 + fi +} + +# This checks for the presence of any file +check_file() { + if [ ! -f "$1" ]; then + echo "There doesn't appear to be a $1. Sorry." + exit 1 + fi +} + +# Try to find programs we will need +locate_program wget && locate_program egrep + +# try to find GNU awk +awk_cmd=`which gawk` +if [ $? -ne 0 ]; then + awk_cmd="" +fi + +# try to find an appropriate md5 program +# BSD md5 capability courtesy of spale +md5_cmd=`which md5sum` +if [ -z "$md5_cmd" ]; then + md5_cmd=`which md5` + if [ -z "$md5_cmd" ]; then + echo "No MD5 capable programs found (I looked for md5sum and md5)." + exit + else + md5_cmd="$md5_cmd -q" + fi +fi + +if [ -z "$awk_cmd" ]; then + locate_program awk + is_gawk=`echo | awk --version | head -1 | egrep '^GNU.+$'` + if [ -z "$is_gawk" ]; then + echo "Your version of awk is not GNU awk. Sorry." + exit 1 + fi + awk_cmd="awk" +fi + +# Check for required command line parameters +if [ -z "$1" -o -z "$2" ]; then + echo "Usage: $0 " + echo " Full path to ircd.conf (/home/irc/lib/ircd.conf)" + echo " Full path to ircd.pid (/home/irc/lib/ircd.pid)" + exit 1 +fi + +# check and set up stuff +cpath=$1 +ppath=$2 +check_file $cpath +dpath=`dirname $cpath` +lpath="$dpath/linesync.conf" +check_file $lpath +save_dir=$PWD; cd $dpath +tpath=$PWD; cd $save_dir +tmp_path="$dpath/tmp" +mkdir $tmp_path > /dev/null 2>&1 + +# load and check configuration +. $lpath +if [ -z "$LINE_SERVER" -o -z "$LINE_CHECK" -o -z "$ALLOWED_LINES" ]; then + echo "Please setup $lpath correctly." + exit 1 +fi + +# Not all versions of date support %s, work around it +TS=`date +%Y%m%d%H%M%S` +TMPFILE="$tmp_path/linesync.$TS" +LSFILE="$LINE_SERVER""linesync" +# Attempt to download our .conf update +wget --cache=off --quiet --output-document=$TMPFILE $LSFILE > /dev/null 2>&1 +if [ ! -s "$TMPFILE" ]; then + echo "Unable to retrieve $LSFILE. Sorry." + rm $TMPFILE > /dev/null 2>&1 + exit 1 +fi + +# Check wether the file contains any disallowed .conf lines +bad_lines=`egrep '^[^'$ALLOWED_LINES'#]+' $TMPFILE` +if [ ! -z "$bad_lines" ]; then + echo "The file downloaded in $TMPFILE contains the following disallowed line(s):" + echo $bad_lines + exit 1 +fi + +# check our ircd.conf +ircd_setup=`egrep '^# (BEGIN|END) LINESYNC$' $cpath|wc -l` +if [ $ircd_setup != 2 ]; then + cp $cpath $cpath.orig + echo "Performing initial merge on $cpath, original file saved as $cpath.orig." + + echo "# Do NOT remove the following line, linesync.sh depends on it!" >> $cpath + echo "# BEGIN LINESYNC" >> $cpath + echo "# END LINESYNC" >> $cpath + echo "# Do not remove the previous line, linesync.sh depends on it!" >> $cpath + + # Do an initial merge to remove duplicates + inpath="$tmp_path/linesync.tmp.$TS" + $awk_cmd ' + { + if (!loaded_template) { + command="cat " tempfile; tlines=0; + while ((command | getline avar) > 0) { template[tlines]=avar; tlines++ } + close(command) + loaded_template++ + } + dup_line=0 + for (i=0; i $inpath +else + inpath=$cpath +fi + +# Get the checksum +CKSUM=`$md5_cmd $TMPFILE|cut -d' ' -f1` + +check_file="$tmp_path/linesync.sum.$TS" +for ck_server in $LINE_CHECK; do + sumfile="$ck_server""linesync.sum" + wget --cache=off --quiet --output-document=$check_file $sumfile > /dev/null 2>&1 + if [ ! -s "$check_file" ]; then + echo "Unable to retrieve checksum from $sumfile" + exit 1 + fi + if [ "$CKSUM" != "`cat $check_file`" ]; then + echo "Checksum retrieved from $sumfile does not match!" + exit 1 + fi + rm -f $check_file +done +# It all checks out, proceed... + +# Replace the marked block in ircd.conf with the new version + +$awk_cmd ' +$0=="# BEGIN LINESYNC" { chop++; print; next } +$0=="# END LINESYNC" { + command="cat " syncfile + while ((command | getline avar) > 0) { print avar } + close(command) + chop-- +} +{ if (!chop) print $0 } +' syncfile=$TMPFILE < $inpath > $tmp_path/linesync.new.$TS + +# Back up the current ircd.conf and replace it with the new one +cp $cpath $dpath/ircd.conf.bk +cp $tmp_path/linesync.new.$TS $cpath + +# Rehash ircd (without caring wether or not it succeeds) +kill -HUP `cat $ppath 2>/dev/null` > /dev/null 2>&1 + +# (Try to) clean up +rm -rf $tmp_path > /dev/null 2>&1 + +# That's it... -- 2.20.1