]> jfr.im git - irc/unrealircd/unrealircd.git/commitdiff
3-2beta13
authorstskeeps <redacted>
Mon, 9 Dec 2002 20:13:51 +0000 (20:13 +0000)
committerstskeeps <redacted>
Mon, 9 Dec 2002 20:13:51 +0000 (20:13 +0000)
77 files changed:
.CHANGES.NEW
.RELEASE.NOTES
.SICI
Changes
Unreal.nfo
aliases/aliases.conf
autoconf/configure.in
configure
doc/example.conf
doc/unreal32docs.html
help.conf
include/auth.h
include/config.h
include/dynconf.h
include/h.h
include/modules.h
include/struct.h
include/sys.h
include/threads.h
include/version.h
makeconf [deleted file]
makefile.win32
makefile.win32.ssl
networks/ircsystems.network
networks/makenet
src/auth.c
src/badwords.c
src/channel.c
src/cidr.c
src/crule.c
src/ircd.c
src/list.c
src/modules.c
src/modules/Makefile.in
src/modules/l_commands.c
src/modules/m_akill.c
src/modules/m_away.c
src/modules/m_cycle.c
src/modules/m_htm.c
src/modules/m_kill.c
src/modules/m_kline.c [deleted file]
src/modules/m_message.c
src/modules/m_oper.c
src/modules/m_quit.c
src/modules/m_rakill.c
src/modules/m_svslusers.c [new file with mode: 0644]
src/modules/m_svsmode.c
src/modules/m_tkl.c
src/modules/m_tsctl.c
src/modules/m_unkline.c
src/modules/m_unzline.c
src/modules/m_vhost.c
src/modules/m_who.c
src/modules/m_whois.c
src/modules/m_zline.c [deleted file]
src/modules/scan.c
src/modules/scan_http.c
src/modules/scan_socks.c
src/packet.c
src/res.c
src/s_auth.c
src/s_bsd.c
src/s_conf.c
src/s_kline.c
src/s_misc.c
src/s_serv.c
src/s_svs.c
src/s_user.c
src/send.c
src/ssl.c
src/support.c
src/version.c.SH
src/win32/Win32GUI.c
src/win32/debug.c
src/win32/unreal.c
src/win32/unrealinst.iss
src/win32/unrealinstssl.iss [deleted file]

index 56be7d233fe86175c09bac5a0e6f1be8637bf8e9..b5c08647b4d6a65c07d296b2fc7335393b42c68a 100644 (file)
@@ -7,7 +7,7 @@
  \___/|_| |_|_|  \___|\__,_|_|\___/\_| \_| \____/\__,_|
 
                                Configuration Program
-                             for Unreal3.2-Selene(beta12)
+                                for Unreal3.2-beta13
                                     
 This program will help you to compile your IRC server, and ask you
 questions regarding the compile-time settings of it during the process. 
index 6507dcc44f1158787390d679293af78de980d3c6..5c7adec185c32a60ea2148bfc4cf3192dc04a6a7 100644 (file)
@@ -1,11 +1,11 @@
 
-Unreal3.2-Selene (BETA12) Release Notes
+Unreal3.2-beta13 Release Notes
 ======================================
     
      I M P O R T A N T   R E A D I N G
 (YES, YOU WILL NEED TO READ ALL OF THIS)
 
-* Unreal3.2-Selene is a lot different than Unreal3.1.1. Forget all you have
+* Unreal3.2 is a lot different than Unreal3.1.1. Forget all you have
   learned about setting up Unreal3.1.1 - this is a lot different. We have got
   a new configuration format that integrates all the former config files,
   ircd.conf, vhost.conf, chrestrict.conf, unrealircd.conf, into to one new
@@ -164,7 +164,7 @@ Unreal3.2-Selene (BETA12) Release Notes
   kick" ban override and joining a +s channel without realizing it is +s and therefore you
   shouldn't know it exists.
 
-* If you use the SSL features of Unreal, you should use OpenSSL 0.9.6e or later. This is
+* If you use the SSL features of Unreal, you should use OpenSSL 0.9.6g or later. This is
   important as the older versions may make the program exploitable. See 
   http://www.openssl.org for more information
 
@@ -182,6 +182,14 @@ Unreal3.2-Selene (BETA12) Release Notes
   (http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html), and EGD
   (http://egd.sourceforge.net). Other EGD compatible programs should work as well.
 
+* Added Authentication method 'sslclientcert', the "password" parameter is
+  used as a filename which it loads a X509 client certificate from and
+  compares with the SSL client certificate (if provided). Example in an
+   oper {}:
+     password "clientcertificate.stskeeps.pem" { sslclientcert; };
+  In this event, the parameter of /oper login is not used, but must be
+  provided anyway, so for example do OPER login *
+
 * We have created a new complete set of docs!  doc/unreal32docs.html is now a complete
   set of docs!  It is still not finished, however it contains atleast what was already
   avail. in the other doc files.  
@@ -190,5 +198,33 @@ Unreal3.2-Selene (BETA12) Release Notes
 * We have removed ./Setup - Please read the new docs for information on configuring &
   setting up Unreal3.2
 
+* Removed makeconf - Read the docs to make a config file
+
+* Added set::ssl::options with the following options:
+    fail-if-no-clientcert   - If SSL client connects and doesn't provide a client
+                              certificate, abort connection immediately
+    verify-certificate      - Check the certificate's validity using X509 methods, check if
+                              we trust CA's, etc. 
+                              It however does slip self signed certificates through UNLESS
+    no-self-signed          - Don't allow self-signed certificates through (requires
+                              verify-certificate)
+
+* Added the ability specify which CA's are trusted using set::ssl::trusted-ca-file
+
+* A new configuration system has been added. The system is a bit more strict (meaning it
+  will complain more often) but it will never crash due to configuration errors, just
+  display a message saying errors exist.
+
+* SVSLUSERS was added to all U:lines to change local and global max user counts (this is
+  NOT meant so you can make the max count higher than it really should be.)
+
+* A new oper flag, can_override/v has been added. This is an attempt to stop oper abuse.
+  All opers can no longer use oper-override, this oflag MUST be in place for oper-override
+  to be allowed. Can_override is NOT assumed to be present no matter what your flags,
+  meaning you could be +N but still not be allowed to use oper-override.
+
+* UNKLINE and UNZLINE have been removed in favor of a system like G:lines, to remove you
+  now /kline -user@host or /zline -user@host
+
 * MAKE SURE YOU RERUN ./Config AND RUN make clean BEFORE USING THIS VERSION!!!
 
diff --git a/.SICI b/.SICI
index 5c25224a03eb3df2aa45770df6222ca4715335c2..3ac257416f0becb8e66174341d442a77020c23a8 100644 (file)
--- a/.SICI
+++ b/.SICI
@@ -4,14 +4,12 @@
 | some kind of Certification Authority (CA), so your users can check that |
 | they are really connected to the real server, so they feel secure?      |
 |                                                                         |
-| An initiative has been started, to help this problem, as more and more  |
-| SSL-enabled IRC servers will be started in the future, and people will  |
-| have trouble authenticating that they are really at the right server.   |
-| This initiative is called OpenIRC CA - They offer you to sign           |
-| SSL certificates for use with your IRCd for free,                       |
-| so your users can be sure that they can trust you and your server.      |     
-| To get a signed certificate from them please visit the website         |
-| http://www.openirc-ca.eu.org                                           |
+| There is an initiative at CACert.org - They offer SSL Certificates      |
+| for use with your IRCd for free, so your users can be sure that they    |
+| can trust you and your server.                                          |
+|                                                                         |
+| To get a free signed certificate please visit http://www.CACert.org     |
+|                                                _________________________|
 |                                              | Press enter to continue |
 ---------------------------------------------------------------------------
 
diff --git a/Changes b/Changes
index 7f1d9e6d5ba74a0faa0c2ad859745615742e2730..d7d147a3e460aba0561ef9ea41596df86be5a35c 100644 (file)
--- a/Changes
+++ b/Changes
@@ -20,7 +20,7 @@
  *                              
  */                             
                                 
-[ Unreal3.2-Selene ]
+[ Unreal3.2 ]
 - Fixed a _serious_ bug in SERVER command, reported by Valen, Forrester,
   M0rpheus, JK, and Hiten.
 - Fixed /botserv problem
@@ -1554,3 +1554,168 @@ seen. gmtime warning still there
 - Made so every join is a SJOIN to prevent TS0 problems. Read config.h to disable this if it causes problems
 - Added set::static-quit to unreal32docs.html
 - Updated docs to include ripemd-160 encryption option
+** beta12 released **
+- Fixed problem where SSL handshakes weren't unknown--'ed on remove reported
+  by Alzirr
+- Compile fix regarding above fix
+- Added vhost::swhois requested by FrostByghte (#0000171)
+- Fixed a win32 password encryption bug when in NT service mode reported by simonbell
+  (#0000285)
+- Fixed a problem with set::ssl::certificate and set::ssl::key that used
+  ->ce_varname instead of ->ce_vardata. Found by badSol
+- Added a newline in dynconf.h
+- SSL debugging stuff
+- Added some more debugging stuff, made check_pings a little more readable 
+- More SSL debugging stuff..
+- A minor fix in SSL_is_inited stuff in s_bsd
+- Fixed a bug with installing unreal as a services under NT4 reported by peter (#0000295)
+- Added the oper login the user has /oper'ed to in the 'is now an operator'
+  notice. Suggested by havlaz (#0000287)
+- Fixed a bug where aliases {} didn't use tokens reported by havlaz (#0000288)
+- Fixed a win32 editor bug when using chars with an ASCII code > 128, reported by XircNet
+  (#0000298)
+- Fixed a bug in TKL found by DerAlSem where it was possible to add a line for *@* (#0000307)
+- Fixed a /who bug where /who +c #chan wouldn't display the name of the channel
+  requested reported by aproxity (#0000304)
+- Fixed a bug where /who +c #chan would let you see users in a +s channel
+- Added Nugget's setuid patch
+- Made the IRC_UID stuff more proper..
+- Removed some old debug code from the win32 debugger
+- Compile warning cleanups
+- Made the win32 version default to unsigned chars, and the linux version do the same under gcc
+- Added Syzop's various zero-terminate patches and fixes for crashes when
+  you send commands like JOIN from a server directly
+- Made channel keys be case sensitive
+- Fixed a bug with /who -h in some cases, found by Zer0, fixed by butter (#0000361)
+- Changed auth method sslpubkey into sslclientcert, which means it will check the X509 certificate of the
+  user using X509_cmp. Also needing is some policy/conf setting to adjust if to reject invalid client certificates or whatever..
+- Added set::ssl::options, with three options:
+    fail-if-no-clientcert   - If SSL client connects and doesn't provide a client certificate, abort connection immediately
+    verify-certificate      - Check the certificate's validity using X509 methods, check if we trust CA's, etc. 
+                              It however does slip self signed certificates through UNLESS
+    no-self-signed          - Don't allow self-signed certificates through (requires verify-certificate)
+- Made conf parser mention if we make a link->options with CONNECT_SSL if we don't support SSL (and remove the CONNECT_SSL flag)
+- Made conf parser mention if we make a SSL listener and we don't support SSL
+- Added set::ssl::trusted-ca-file, if enabled, it will point the SSL stuff to use that file as trusted CA's (for verify-certificate)
+- Made conf _not_ bitch that it doesn't know set::ssl
+- Removed some leftover client certificate stuff
+- Fixed bug #0000372 reported by MorPheus where Killed (<everything-but-the-first-char-in-killer-letter-got-shown> (reason))
+- Fixed bug #0000377 reported by MorPheus where IPs of servers were shown in nick collision notices
+- Fixed bug #0000371 reported by havlaz about an extra \n slipped in with the TKL notice
+- Fixed bug with all TKL commands not accepting nicks anymore (#0000370 reported by Ravage)
+- Fixed bug #0000342 reported by James LiGate about tokens leaking through from clients
+- Removed some IPv6 resolver specifics that seemed illogical (reference to Jollino's IPv6 crashes)
+- Fixed crash bug in m_tkl_line found by Keeper
+- Fixed another m_tkl_line bug found by Keeper
+- Fixed an samode bug reported by mcskaf (#0000403)
+- Added the ability to /lusers server.name to get the lusers reply of another server
+  suggested by tony0man (#0000373)
+- Fixed a bug where /htm would report "no such server" when used locally, reported by
+  jollino (#0000343)
+- Possibly fixed some crash bugs in scan_socks and scan_http in Win32 reported by
+  UrLoverGuy13 and Xose (#0000389)
+- Documentation - Updatet sec2.0 - list of Supported OS's for Win32 Version
+- Documentation - Updated sec1.1 - Instructed to use bugs.unrealircd.org to report problems with docs
+- Documentation - Updated misc hyperlinks - doc/unreal32docs.html
+- Documentation - Updated sec3.31 - Added better description to the format we present set:: settings 
+- Documentation - Updated sec3.31 - Added more details to set directives
+- Documentation - Updated sec3.25 - Added option vhost::swhois to section 3.25 Vhost block
+- Documentation - Replaced text vair {} with <> to prevent confusion.
+- Documentation - Documented that lusers now supports remote servers
+- Documentation - Corrected vhost::from example as reported by joolz (#0000329 )
+- Documentation - Corrected set::scan:messages, currently listed as set::messages - as reported by joolz (#0000329) 
+- Documentation - Added channel mode t & description as reported by stfcs (#0000315) 
+- example.conf - Corrected incorrect set::services-services statment in alias block - reported by mcskaf (#0000401)
+- Documentation - Corrected Spelling mistake in HTM mode - Reported by CoNfOuNd (#0000387)
+- Documentation - Added coadmin to table of oper types - Reported by FrostByghte (#0000359)
+- Documentation - Corrected several HTML formating problems
+- Commited first 20% of conf3, if anyone runs devel, DO NOT, it is BROKEN and will most likely NOT FUNCTION
+  and it WILL burn, DIE, and WILL NOT WORK
+- Fixed conf3 bug with _conf_except tkl
+- /kline and /zline now use TKL
+- Removed src/win32/unrealinstssl.iss and merged it into unrealinst.iss, add #define
+  USE_SSL to the file to build an SSL package
+- Added additional NT Service options to the win32 installer
+- Made CLIENT_FLOOD more customizable
+- Fixed some conf3 compile errors and block-modded _*_tld
+- Fixed stats bug reported by RaYmAn
+- Added a patch by McSkaf that will hopefully fix the win32 resolver crashes
+- Converted badword to conf3
+- Fixed some win32 problems with conf3
+- Fixed a problem in config testing with conf3
+- Modified the main conf3 searching routine to use a binary search, this should speed up
+  config processing somewhat
+- Converted the config flag parsing systems to use a binary search
+- Conf3 cleanups
+- Converted help and log to conf3
+- Fixed a configure script bug involving gcc3 (#0000398, #0000412, #0000433) found and 
+  fixed by mister
+- Fixed alphabeticalising of named oper flags, added _conf/test_link
+- Finished up conf3, still needing some directives added but it sortof works. Rehash doesn't yet. 
+-  Fixed some idiotic lack of src/modules/Makefile.in changes for the sake of commands.so when 
+  /zline /kline etc was moved to a module
+- Converted _conf_alias to conf3, in the process changed the format to be slightly more
+  stable. See aliases/aliases.conf for the format changes
+- Numerous Sts-coded-conf3-while-sick bugs
+- Added SVSLUSERS, allows changing of local/global max users. This is designed so services
+  can make sure all servers report the same global max and that a local max can be adjusted
+  if for example a clone flood occurs. It is NOT designed to make the max count higher than
+  you actually have.
+- Fixed a bug in the win32 debugger where the contents of the core file were not written
+  until ok was clicked. Reported by Simon Bell.
+- Added an operflag can_override (v) only opers with this flag are allowed to use
+  oper-override.
+- Fixed a bug in SVSO where the t and Z flags could not be removed.
+- Updated .RELEASE.NOTES to include can_override
+- Fixed a bug where if set::help-channel was missing it was reported twice.
+- Made modules able to have configuration directives in conf3. The system to do this is 
+  completely new and works differently. All remnants of the old system have been removed.
+- Changed the module config system slightly to be able to detect more errors.
+- /rehash for conf3 (that works) :)
+- Fixed win32 compile error with default: ;
+- Fixed several conf3 errors
+- Converted deny {} to conf3, in the process added some extra crule functions to help
+  report errors better
+- Fixed sendto_ routines to use slot number as index into sentalong array
+- Fixed a conf3 bug
+- Made alias {}'s get rehashed
+- Made modules correctly rehash, this involves adding a Mod_Test function to modules that
+  need to perform configuration tests. This is currently only implimented for dynamic linking
+- Made the same system work under static linking. This (barring any bugs) should be the
+  completion of conf3. :)
+- Fixed a bug where chmode +q users could not kick chmode +a users. (#0000459) reported by
+  jollino.
+- Fixed serious bug in /who that caused the server to lock up (there's a ID
+  for this, could someone find it). Beta13 SHOULD be a LOT nearer now
+- Small typo in config validation found by ins4ne
+- Changed the way return values work in conf3 to better report the number of errors that
+  occurred.
+- Cleaned up some module code, also removed /module load|unload (just use /rehash)
+- Removed makeconf
+- Fixed errors in doc/example.conf and makenet
+- Fixed set::scan::bind-ip and set::scan::ban-time typos in unreal32docs.html
+- Changed set::scan:ban-time to set::scan::bantime and added set::scan::timeout in 
+  unreal32docs.html
+- Fixed some logical module rehash issues
+- Made config actually add listeners when rehashing (...) also you can now
+  change listener flags using /rehash
+- Changed .SICI to point to cacert.org instead (patch by evilbunny)
+- Fixed an oper count bug with SVS2MODE reported by confused (#0000490)
+- Removed m_kline.c and m_zline.c these are now implimented as part of m_tkl.c
+- Implemented a patch by poisoner to log vhosts in connect/disconnect logging (#0000487)
+- Made some changes to the thread API to fix some win32 crashes
+- Changed resolver code to use IRCMutex macros.
+- Documentation updates (some reported by poisoner) (#0000493)
+- Fixed some problems with /kline when removing a K:line
+- Updated docs some more
+- Fixed a makefile.win32.ssl problem reported by WeeD
+- Changed version to beta13, updated docs
+- Check for connect() success/failure in scanners on all OSs.
+- Documentation updates
+- Added back the commands check that didn't get added in conf3 (lamers
+  beware)
+- Fixed a typo in the module system
+- Fixed exception in scanner on Windows
+- Changed base version name to Unreal3.2, instead of Unreal3.2-Selene
+- Made McSkaf part of core coder team
+*** beta13 released ***
index c076db07064131e3bb66146f2091eb4a34a53744..4da05b67e6af630bf4ff7742506cf18d1fc4cd15 100644 (file)
@@ -1,5 +1,5 @@
 ===============================================
-=            UnrealIRCd v3.2-Selene (beta12)  =
+=            UnrealIRCd v3.2 (beta13)         =
 ===============================================
  Was brought to you by:
 
   * Griever   <griever@unrealircd.com>
   * Luke      <luke@unrealircd.com>
   * nighthawk <nighthawk@unrealircd.com>
+  * McSkaf    <mcskaf@unrealircd.org>
 
   Coders team:
   ============
-  * McSkaf    <mcskaf@unrealircd.org>
   * Zogg      <zogg@unrealircd.org>
   * NiQuiL    <niquil@unrealircd.org>
   * assyrian  <assyrian@unrealircd.org>
@@ -65,4 +65,4 @@ latest devel:
   ==============================================
       http://bugs.unrealircd.org
 
-y
+
index 8286690e746a8efc2398e2722022c7f1ca45866d..c8e264bc985f095a81126003dd2d0b13e5d2f1b8 100644 (file)
@@ -2,11 +2,13 @@
 
 alias identify {
        format "^#" {
-               alias chanserv;
+               nick chanserv;
+               type services;
                parameters "IDENTIFY %1-";
        };
        format "^[^#]" {
-               alias nickserv;
+               nick nickserv;
+               type services;
                parameters "IDENTIFY %1-";
        };
        type command;
@@ -14,11 +16,13 @@ alias identify {
 
 alias services {
        format "^#" {
-               alias chanserv;
+               nick chanserv;
+               type services;
                parameters "%1-";
        };
        format "^[^#]" {
-               alias nickserv;
+               nick nickserv;
+               type services;
                parameters "%1-";
        };
        type command;
@@ -26,11 +30,13 @@ alias services {
 
 alias register {
        format "^#" {
-               alias chanserv;
+               nick chanserv;
+               type services;
                parameters "REGISTER %1-";
        };
        format "^[^#]" {
-               alias nickserv;
+               nick nickserv;
+               type services;
                parameters "REGISTER %1-";
        };
        type command;
index 8ff43230883ba6f1f4af671134fc27f4dfd4dcb6..0ffe7f4ada741edff6eaa42cfeb9c53206a24cac 100644 (file)
@@ -8,16 +8,7 @@ fi
 AC_CONFIG_HEADER(include/setup.h)
 AC_PROG_CC
 if test "$ac_cv_prog_gcc" = "yes"; then
-AC_CACHE_CHECK(if you have gcc 3.0 or higher, ac_cv_gcc3, [
-if test -z "`gcc -v 2>&1 |grep 'gcc version 3.'`"; then
-ac_cv_gcc3="no"
-else
-ac_cv_gcc3="yes"
-fi
-])
-if test "$ac_cv_gcc3" = "yes"; then
-CFLAGS="$CFLAGS -Wnone"
-fi
+CFLAGS="$CFLAGS -funsigned-char"
 AC_CACHE_CHECK(if gcc has a working -pipe, ac_cv_pipe, [
        save_cflags="$CFLAGS"
        CFLAGS="$CFLAGS -pipe"
index 4bd4d4c9b202ce909c3a27c74eb3f94beb169050..32e4a0229af2a902c8ede8cb9a8d01a347d9c4e7 100755 (executable)
--- a/configure
+++ b/configure
@@ -1970,24 +1970,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 if test "$ac_cv_c_compiler_gnu" = "yes"; then
-echo "$as_me:$LINENO: checking if you have gcc 3.0 or higher" >&5
-echo $ECHO_N "checking if you have gcc 3.0 or higher... $ECHO_C" >&6
-if test "${ac_cv_gcc3+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-if test -z "`gcc -v 2>&1 |grep 'gcc version 3.'`"; then
-ac_cv_gcc3="no"
-else
-ac_cv_gcc3="yes"
-fi
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_gcc3" >&5
-echo "${ECHO_T}$ac_cv_gcc3" >&6
-if test "$ac_cv_gcc3" = "yes"; then
-CFLAGS="$CFLAGS -Wnone"
-fi
+CFLAGS="$CFLAGS -funsigned-char"
 echo "$as_me:$LINENO: checking if gcc has a working -pipe" >&5
 echo $ECHO_N "checking if gcc has a working -pipe... $ECHO_C" >&6
 if test "${ac_cv_pipe+set}" = set; then
index 92683a2e51c24964ddaa296e35d2e2ae35c03a67..000ad0ae4734fcaaaf1f909712c0c8205cadc819 100644 (file)
@@ -181,6 +181,7 @@ allow           channel {
        W               get_umodew
        ^               can_stealth
        H               get_host
+       v               can_override
 */
 
 /*
@@ -374,7 +375,7 @@ log "ircd.log" {
  * };
  */
 
-// This points the command /nickserv to the user NickServ who is connected to the set::services-name server
+// This points the command /nickserv to the user NickServ who is connected to the set::services-server server
 /*alias NickServ {
        nick "NickServ";
        type services;
@@ -405,7 +406,8 @@ alias StatServ { type stats; };
  * Syntax:
  * alias "name" {
  *     format "format string" {
- *             alias "points to";
+ *             nick "points to";
+ *              type aliastype;
  *             parameters "parameters to send";
  *     };
  *     type command;
@@ -417,11 +419,13 @@ alias StatServ { type stats; };
 /*
 alias "identify" {
        format "^#" {
-               alias "chanserv";
+               nick "chanserv";
+               type services;
                parameters "IDENTIFY %1-";
        };
        format "^[^#]" {
-               alias "nickserv";
+               nick "nickserv";
+               type services;
                parameters "IDENTIFY %1-";
        };
        type command;
@@ -441,11 +445,13 @@ alias "identify" {
 /* Standard aliases */
 alias "services" {
        format "^#" {
-               alias "chanserv";
+               nick "chanserv";
+               type services;
                parameters "%1-";
        };
        format "^[^#]" {
-               alias "nickserv";
+               nick "nickserv";
+               type services;
                parameters "%1-";
        };
        type command;
@@ -453,11 +459,13 @@ alias "services" {
 
 alias "identify" {
        format "^#" {
-               alias "chanserv";
+               nick "chanserv";
+               type services;
                parameters "IDENTIFY %1-";
        };
        format "^[^#]" {
-               alias "nickserv";
+               nick "nickserv";
+               type services;
                parameters "IDENTIFY %1-";
        };
        type command;
@@ -675,7 +683,6 @@ set {
                coadmin         "coadmin.roxnet.org";
                admin           "admin.roxnet.org";
                servicesadmin   "csops.roxnet.org";
-               techadmin       "techadmin.roxnet.org"; /* depreciated */
                netadmin        "netadmin.roxnet.org";
                host-on-oper-up "no";
        };
@@ -694,16 +701,12 @@ set {
                retries 2s;
        };
        options {
-               enable-opermotd;
-               enable-chatops;
                hide-ulines;
                identd-check;
                show-connect-info;
        };
 
        scan {
-               ban-message "Insecure SOCKS server";
-               quit-message "Insecure SOCKS server";
                /* Choose this to be some IP and some port that's always open and
                  * reachable by the proxies 
                  */
@@ -716,7 +719,11 @@ set {
                  * What message should we NOTICE to the users when we scan them
                */
                message "<insert scan notice here> (admin didn't edit config correctly)";
-               ban-time "4d";
+               /* How long should we ban proxies for? */
+               bantime 4d;
+               /* How long should we wait to see if the host has a proxy? */
+               timeout 15s;
+
        };
        ssl {
                /* Reads entropy from the domain socket located at '~/entropy' */
index b7fc32ef4172afd1e6a3ed75f7455c94464c843f..94a22102e446b929b93ae5aacd710984da8a856a 100644 (file)
@@ -1,21 +1,20 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-<title>UnrealIRCd - 3.2-Selene - Offical Documentation</title>
+<title>UnrealIRCd - 3.2 - Offical Documentation</title>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 </head>
 
 <body>
 <div align="center"><strong><font size="7">UnrealIRCd</font></strong><br>
   <font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
-  <font size="4">Version: 3.2-Selene</font><br>
-  <strong>Complete Documentation</strong> &#8211; Rev: 1.1<br>
-  <strong>Current Version:</strong> 3.2 Beta12<br>
-  <strong>Released</strong>: 8/25/02 </div>
-<p><br>
+  <font size="4">Version: 3.2</font><br>
+  <strong>Complete Documentation</strong> &#8211; Rev: 1.1.2.10<br>
+  <strong>Current Version:</strong> 3.2 Beta13<br>
+  <strong>Released</strong>: 12/05/02 </div>
   <strong>Head Coders:</strong> Stskeeps / Codemastr<br>
   <strong>Coding Team</strong>: Grievre / Luke / nighthawk<br>
-  <strong>Documentation:</strong> CKnight^</p>
+  <strong>Documentation:</strong> CKnight^<br>
 <p>Due to the increasing complexity of UnrealIRCd3.2 We have switched to a easier 
   to navigate, more inclusive documentation set. To view this documentation you 
   must have a compatible browser, which are listed below. Up to date docs are 
 <p>If you have any feedback, comments, suggestions, please feel free to contact 
   me with them, and I will do my best to work them in. My goal is to make Unreal3.2 
   and its powerful features, easier to setup, and easier to use.</p>
+<p>If you find any part of these docs are incorrect, or typo/grammer/spelling 
+  errors, please goto <a href="http://bugs.unrealircd.org">http://bugs.unrealircd.org</a> 
+  and file a bug report, and I will be sure to get it corrected ASAP.</p>
 <p><strong>Email: </strong><a href="mailto://docs@unrealircd.com">docs@unrealircd.com</a></p>
-<p> </p>
-<p> </p>
 <p><font size="+2"><strong>1.2 &#8211; Notes on current release</strong><a name="notesoncurrentrelease" id="notesoncurrentrelease"></a></font><br>
 </p>
 <p> <font size="-1">I M P O R T A N T R E A D I N G</font></p>
 <p><font size="-1">(YES, YOU WILL NEED TO READ ALL OF THIS)</font></p>
-<p><font size="-1">* Unreal3.2-Selene is a lot different than Unreal3.1.1. Forget 
+<p><font size="-1">* Unreal3.2 is a lot different than Unreal3.1.1. Forget 
   all you have learned about setting up Unreal3.1.1 - this is a lot different. 
   We have got a new configuration format that integrates all the former config 
   files,ircd.conf, vhost.conf, chrestrict.conf, unrealircd.conf, into to one newunrealircd.conf 
   for more info)</font></p>
 <p><font size="-1">* If you experience problems with the scanners, perhaps check 
   out BOPM (http://www.blitzed.org/bopm)</font></p>
-<p><font size="-1">* log {} syslog support added (read doc/conf.doc for more info)</font></p>
+<p><font size="-1">* log {} syslog support added (read doc/unreal32docs.html for 
+  more info)</font></p>
 <p><font size="-1">* Added ripemd-160 password encryption support</font></p>
 <p><font size="-1">* Enabled sha1 and md5 password encryption on Win32 regardless 
   of whether SSL is used.</font></p>
 <p><font size="-1">* We have removed ./Setup - Please read the new docs for information 
   on configuring &amp;<br>
   setting up Unreal3.2</font></p>
+<p><font size="-1">* Removed makeconf - Read the docs to make a config file</font></p>
+<p><font size="-1">* Added set::ssl::options with the following options:<br>
+    fail-if-no-clientcert   - If SSL client connects and doesn't provide a client<br>
+                              certificate, abort connection immediately<br>
+    verify-certificate      - Check the certificate's validity using X509 methods, check if<br>
+                              we trust CA's, etc. <br>
+                              It however does slip self signed certificates through UNLESS<br>
+    no-self-signed          - Don't allow self-signed certificates through (requires<br>
+                              verify-certificate)</font></p>
+
+<p><font size="-1">* Added the ability specify which CA's are trusted using set::ssl::trusted-ca-file</font></p>
+
+<p><font size="-1">* A new configuration system has been added. The system is a bit more strict (meaning it
+  will complain more often) but it will never crash due to configuration errors, just
+  display a message saying errors exist.</font></p>
+
+<p><font size="-1">* SVSLUSERS was added to all U:lines to change local and global max user counts (this is
+  NOT meant so you can make the max count higher than it really should be.)</font></p>
+
+<p><font size="-1">* A new oper flag, can_override/v has been added. This is an attempt to stop oper abuse.
+  All opers can no longer use oper-override, this oflag MUST be in place for oper-override
+  to be allowed. Can_override is NOT assumed to be present no matter what your flags,
+  meaning you could be +N but still not be allowed to use oper-override.</font></p>
+
+<p><font size="-1">* UNKLINE and UNZLINE have been removed in favor of a system like G:lines, to remove you
+  now /kline -user@host or /zline -user@host</font></p>
 <p><font size="-1">* MAKE SURE YOU RERUN ./Config AND RUN make clean BEFORE USING 
   THIS VERSION!!!</font></p>
 <p> </p>
 </p>
 <p>Unreal 3.2 is ONLY compatible with Unreal3.1.4 and Unreal3.2 servers. DO NOT 
   ATTEMPT to link to servers that it is NOT compatible with.</p>
-<p></p>
-<p></p>
 <p><font size="+2"><strong>2.0 - Installation</strong></font><a name="installation" id="installation"></a><br>
   <br>
   <strong>Tested &amp; Supported Operating Systems:</strong><br>
   <strong>Windows version:</strong><br>
   WindowsXP Home<br>
   WindowsXP Pro<br>
+  Windows 2000 Pro<br>
+  Windows 2000 Server<br>
+  Windows 2000 Advanced Server<br>
   <br>
   If you have Unreal3.2 working correctly under other operating systems, please 
-  send the details to docs@unrealircd.com<br>
-</p>
+  send the details to <a href="mailto://docs@unrealircd.com">docs@unrealircd.com<br>
+  </a> </p>
 <p><strong>Installation Instructions</strong><br>
-  1. gunzip -d Unreal3.2-beta12.tar.gz<br>
-  2. tar xvf Unreal3.2-beta12.tar <br>
+  1. gunzip -d Unreal3.2-beta13.tar.gz<br>
+  2. tar xvf Unreal3.2-beta13.tar <br>
   3. cd Unreal3.2 <br>
   DO NOT EDIT MAKEFILE <br>
   4. ./Config<br>
   format has a specific format. The format works like:</p>
 <p>&lt;block-name&gt; &lt;block-value&gt; {<br>
   &lt;block-directive&gt; &lt;directive-value&gt;;<br>
-  };</p>
+  } ;</p>
 <p>&lt;block-name&gt; is the type of block, such as me, or admin. &lt;block-value&gt; 
   sometimes specifies a value, such as /oper login, but other times it will be 
   a sub-type such as in ban user.</p>
   name &lt;name-of-server&gt;;<br>
   info &lt;server-description&gt;;<br>
   numeric &lt;server-numeric&gt;;<br>
-  };</p>
+  } ;</p>
 <p>These values are pretty obvious. The me::name specifies the name of the server, 
   me::info specifies the server's info line, me::numeric specifies a numeric to 
   identify the server. This must be a value between 1 and 255 that is unique to 
   name &quot;irc.foonet.com&quot;;<br>
   info &quot;FooNet Server&quot;;<br>
   numeric 1;<br>
-  };</p>
+  } ;</p>
 <p></p>
 <p><font size="+2"><strong>3.3 - Admin Block (Previously known as the A:Line)</strong></font><a name="adminblock"> 
   </a><br>
   which is specified in the class::. The values of this block define the connection 
   classes, class::pingfreq specifies the number of seconds between PINGs, class::connfreq 
   is only used in server classes to specify the time in seconds between connection 
-  attempts, class::maxclients specifies the maximum amount of clients that may 
-  use this class to connect, and class::sendq specifies the amount of information 
-  that can remain in the send queue buffer.</p>
+  attempts, class::maxclients specifies the maximum amount of clients or servers 
+  that may use this class to connect, and class::sendq specifies the amount of 
+  information that can remain in the send queue buffer.</p>
 <p>Examples:<br>
   class clients {<br>
   pingfreq 90;<br>
   form listen &lt;ip:port&gt;;. Valid listen::options are clientsonly (only users 
   may connect), serversonly (only servers nameconnect), java (CR javachat support), 
   ssl (SSL encrypted port). A combination of any of those flags may be specified.</p>
-<p> </p>
 <p>Since IPv6 is now supported, and the IPv6 seperator is a : it makes the<br>
   ip:port format a bit difficult. To compensate, you should enclose the IP in 
   brackets. For<br>
     <td><div align="center">can_zline</div></td>
     <td>Can use /zline</td>
   </tr>
+  <tr> 
+    <td><div align="center">t</div></td>
+    <td><div align="center">can_gkline</div></td>
+    <td>Can use /gline</td>
+  </tr>
+  <tr> 
+    <td><div align="center">Z</div></td>
+    <td><div align="center">can_gzline</div></td>
+    <td>Can use /gzline</td>
+  </tr>
   <tr> 
     <td><div align="center">W</div></td>
     <td><div align="center">get_umodew</div></td>
     <td><div align="center">can_stealth</div></td>
     <td>Can use +I</td>
   </tr>
+  <tr> 
+    <td><div align="center">v</div></td>
+    <td><div align="center">can_override</div></td>
+    <td>Can use OperOverride</td>
+  </tr>
 </table>
 <p>Certin flags give you other flags by default:</p>
 <table width="59%" border="1">
   <tr> 
     <td width="19%"><strong>local</strong></td>
     <td width="17%"><strong>global</strong></td>
-    <td width="19%"><strong>admin</strong></td>
+    <td width="19%"><strong>admin/coadmin</strong></td>
     <td width="22%"><strong>services-admin</strong></td>
     <td width="23%"><strong>netadmin</strong></td>
   </tr>
   };<br>
   login &lt;login-name&gt;;<br>
   password &lt;password&gt; { &lt;auth-type&gt;; };<br>
+  swhois &quot;&lt;swhois info&gt;&quot;;<br>
   };</p>
 <p>The vhost block allows you to specify a login/password that can be used with 
   the /vhost command to obtain a fake hostname. The vhost::vhost parameter can 
   in the login name the user must enter and vhost::password is the password that 
   must be entered. Lastly vhost::password:: allows you to specify the type of 
   authentication used by this item. The currently supported authentication types 
-  are crypt, md5, and sha1, ripemd-160.</p>
+  are crypt, md5, and sha1, ripemd-160. vhost::swhois allows you to add an extra 
+  line to a users whois, exactly as it does in the Oper Block oper::svhost.</p>
 <p>Example<br>
   vhost {<br>
   vhost my.own.personal.vhost.com;<br>
   from {<br>
-  my@isp.com;<br>
-  myother@isp.com;<br>
+  userhost my@isp.com;<br>
+  userhost  myother@isp.com;<br>
   };<br>
   login mynick;<br>
   password mypassword;<br>
+  swhois &quot;Im Special&quot;;<br>
   };</p>
 <p></p>
 <p><font size="+2"><strong>3.26 &#8211; Bad Words Block (Previously Known As badwords.*.conf)</strong></font><a name="badwordsblock"></a><br>
 <p>Syntax [command alias]:<br>
   alias &lt;name&gt; {<br>
   format &lt;regex-expression&gt; {<br>
-  alias &lt;alias-to-forward-to&gt;;<br>
+  nick &lt;nick-to-forward-to&gt;;<br>
+  type &lt;type-of-alias&gt;;<br>
   parameters &lt;parameter-string&gt;;<br>
   };<br>
   format &lt;regex-expression&gt; {<br>
   a regular expression that compares against the text sent to the alias command, 
   when matched the sub-entries of that alias::format will be used, you may have 
   multiple alias::format's to make the command do different things depending on 
-  the text sent to it. The alias::format::alias is the name of a preexisting (appears 
-  before this in the config file) alias block in the standard format that when 
-  that format is matched will be used. The alias::format::parameters is what will 
+  the text sent to it. The alias::format::nick is the nickname to forward this
+  alias to. The alias::format::type specifies the type of the alias that the
+  message should be forwarded to. The alias::format::parameters is what will 
   be sent as the parameters to this alias. To specify one of the parameters given 
   to the command alias specify % followed by a number, for example, %1 is the 
   first parameter. To specify all parameters from a given parameter to the end 
 <p><strong><font size="+2">3.31 &#8211; Set Block (Previosuly Known As unrealircd.conf 
   / networks file)</font><a name="setblock"></a></strong></p>
 <p>The set file is what use to be our networks/unrealircd.conf and our networks 
-  file. On single server networks, rather than have 3 files, I recommend including 
-  all of the set commands in the unrealircd.conf .</p>
-<p>Now, if your server is on a network, chances are you will all basicly use the 
-  same Set settings. Therefore it makes more sense to have a network file, which 
-  is loaded with a include:: directive. Below you will find all of the set directives 
-  available.</p>
-<p>Also, please note, that this release was rushed a bit, in future releases; 
-  I will expand on all of the set settings and syntax listed below.</p>
+  file. On single server networks, rather than have 3 files, on single server 
+  networks, you can just include the set statements in the unrealircd.conf, on 
+  multi-server networks, i recommend still using a networks file.</p>
+<p>Now, if your server is on a network, chances are you will all basically use 
+  the same Set settings. Therefore it makes more sense to have a network file, 
+  which is loaded with a include:: directive. Below you will find all of the set 
+  directives available.</p>
+<p>In this doc we refer to settings / directives in the &lt;block-name&gt;::&lt;block-directive&gt; 
+  format. This format is NOT the format that it can be entered into the configuration 
+  file. IT MUST be converted to the format listed below. It is presented in the 
+  format it is to make discussing it simpler.</p>
 <p>Syntax:<br>
   set {<br>
   &lt;entry&gt; &lt;value&gt;;<br>
   };</p>
 <p>The set block sets options for individual server features. Each entry does 
   something different and therefore each will be described below. Some directives 
-  have sub blocks which will also be described.</p>
-<p>set::kline-address &lt;email-address&gt;;<br>
+  have sub blocks which will also be described. There are many set statements 
+  to cover, all of the directives listed below can be included under ONE set statement. 
+  If a directive has options, they are included within the single set statement 
+  as well.<br>
+  Example:<br>
+  Set {<br>
+  kine-address my@emailaddress.com;<br>
+  auto-join #welcome;<br>
+  options {<br>
+  hide-ulines;<br>
+  no-stealth; };<br>
+  hosts {<br>
+  local LocalOp.MyNet.com;<br>
+  global globalop.mynet.com; };<br>
+  };</p>
+<p>Now if you wanted to make the set statements seperate, say you wanted to set 
+  your options in a single line.<br>
+  Example:<br>
+  set { options { hide-ulinesl; no-stealth; }; };<br>
+</p>
+<p> set::kline-address &lt;email-address&gt;;<br>
   The email address that K:line questions should be sent to. This value must be 
   specified.</p>
 <p>set::modes-on-connect &lt;+modes&gt;;<br>
 <p>set::prefix-quit &lt;text-to-prefix-quit&gt;;<br>
   Sets the text that will be used to prefix a quit message. If this value is set 
   to 0 then the standard &quot;Quit:&quot; is used.</p>
-<p>set::static-quit {quit message};<br>
+<p>set::static-quit &lt;quit message&gt;;<br>
   Sets a static quit message that will be sent whenever a client logs off the 
   network. This eliminates the need for anti-spam-quit-message-time, as well as 
   the set::prefix-quit. It will NOT replace ERRORS with the static-quit message.</p>
 <p>set::scan::endpoint &lt;ip:port&gt;;<br>
   Specifies the IP and port that the server will tell an incoming open proxy to 
   connect to.</p>
-<p>set::bind-ip {ip};<br>
+<p>set::scan::bind-ip &lt;ip&gt;;<br>
   What ip should the scanner bind to before connecting</p>
-<p>set::message {message};<br>
+<p>set::scan::message &lt;message&gt;;<br>
   Put a message that users will see when scanner is scanning</p>
-<p>set::ban-time {time}<br>
-  Sets the time of the ban (1d,2h,1w)</p>
+<p>set::scan::bantime {time}<br>
+  Sets the time of the ban (4d)</p>
+<p>set::scan::timeout {time}<br>
+  How long we wait to see if the host has a proxy (15s)</p>
 <p>set::ssl::egd &lt;filename&gt;;<br>
   Specifies that EGD (Entropy Gathering Daemon) support should be enabled. If 
   you run OpenSSL 0.9.7 or higher, then /var/run/egd-pool, /dev/egd-pool, /etc/egd-pool, 
     <td>Only Administrators may join</td>
   </tr>
   <tr> 
-    <td><div align="center">a {nick}</div></td>
+    <td><div align="center">a &lt;nick&gt;</div></td>
     <td>Goves protection to that user, may not be kicked</td>
   </tr>
   <tr> 
-    <td><div align="center">b {nick!user@host}<br>
+    <td><div align="center">b &lt;nick!user@host&gt;<br>
       </div></td>
     <td>Bans the givin user from the channel</td>
   </tr>
     <td>No CTCP's allowed in the channel</td>
   </tr>
   <tr> 
-    <td><div align="center">e {nick!user@host}</div></td>
+    <td><div align="center">e &lt;nick!user@host&gt;</div></td>
     <td>Execption ban &#8211; If someone matches this, they can join a channel 
       even if they match an existing ban</td>
   </tr>
   <tr> 
-    <td><div align="center">f * {lines:seconds}</div></td>
+    <td><div align="center">f * &lt;lines:seconds&gt;</div></td>
     <td>Flood protection, if the * is given a user will kick banned when they 
-      send {lines:seconds} if no * they are just kicked</td>
+      send &lt;lines:seconds&gt; if no * they are just kicked</td>
   </tr>
   <tr> 
     <td><div align="center">G</div></td>
     <td>No +I users may join (only settable by admins)</td>
   </tr>
   <tr> 
-    <td><div align="center">h {nick}</div></td>
+    <td><div align="center">h &lt;nick&gt;</div></td>
     <td>Gives half-op status to the user</td>
   </tr>
   <tr> 
     <td>/knock is not allowed</td>
   </tr>
   <tr> 
-    <td><div align="center">k {key}</div></td>
+    <td><div align="center">k &lt;key&gt;</div></td>
     <td>Sets a key needed to join</td>
   </tr>
   <tr> 
-    <td><div align="center">l {##}</div></td>
+    <td><div align="center">l &lt;##&gt;</div></td>
     <td>Sets max number of users</td>
   </tr>
   <tr> 
-    <td><div align="center">L {Chan}</div></td>
+    <td><div align="center">L &lt;Chan&gt;</div></td>
     <td>If the amount set by +l has been reached, users will be sent to this channel</td>
   </tr>
   <tr> 
     <td>Only IRCops may join</td>
   </tr>
   <tr> 
-    <td><div align="center">o {nick}</div></td>
+    <td><div align="center">o &lt;nick&gt;</div></td>
     <td>Gives a user channel operator status</td>
   </tr>
   <tr> 
   <tr> 
     <td><div align="center">s</div></td>
     <td>Makes channel secret</td>
+  </tr>
+   <tr> 
+    <td><div align="center">t</div></td>
+    <td>Only chanops can set topic</td>
   </tr>
   <tr> 
     <td><div align="center">u</div></td>
     <td>/invite is not allowed</td>
   </tr>
   <tr> 
-    <td><div align="center">v {nick}</div></td>
+    <td><div align="center">v &lt;nick&gt;</div></td>
     <td>Gives a voice to users. (May speak in +M Channels</td>
   </tr>
   <tr> 
     <td width="10%"><div align="center"><strong>Who</strong></div></td>
   </tr>
   <tr> 
-    <td>nick {newnickname}</td>
+    <td>nick &lt;newnickname&gt;</td>
     <td>Changes your online nick name. Alerts others to the change of your nick<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td>whois {nick}</td>
+    <td>whois &lt;nick&gt;</td>
     <td>Displays information of user requested. Includes Full Name, Host, Channels 
       User is in, and Oper Status<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">who {mask}</td>
+    <td height="39">who &lt;mask&gt;</td>
     <td>Who allows you to search for users (who do not have mode +I set). Masks 
       include: nickname, #channel, hostmask (*.attbi.com)<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">whowas {nick} {maxreplys}</td>
-    <td>Displays information on a nick that has logged off. The {max replies} 
+    <td height="39">whowas &lt;nick&gt; &lt;maxreplys&gt;</td>
+    <td>Displays information on a nick that has logged off. The &lt;max replies&gt; 
       field is optional, and limits how many records will be returned.<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">ison {nick1 nick2 nick3 ...}</td>
+    <td height="39">ison &lt;nick1 nick2 nick3 ...&gt;</td>
     <td>Allows you to check the online status of a user, or a list of users. Simple 
       return, best used for scripts<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">join {channel1,channel2, ...}</td>
+    <td height="39">join &lt;channel1,channel2, ...&gt;</td>
     <td>Allows you to join channels. Using the /join #channel1, #channel2, channel3 
       will allow you to join more than one channel at a time. The /join 0 command 
       makes you PART</td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">part {channel1, channel2, ...}</td>
+    <td height="39">part &lt;channel1, channel2, ...&gt;</td>
     <td>Allows you to part (leave) channels. Using the /part #channel1, #channel2, 
       channel3 will allow you to part more than one channel at a time. </td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">motd {server}</td>
+    <td height="39">motd &lt;server&gt;</td>
     <td>Displays the servers motd. Adding a server name allows you to view motd&#8217;s 
       on other servers.<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">rules {server}</td>
+    <td height="39">rules &lt;server&gt;</td>
     <td>Displays the ircd.rules of a server. Adding a server name allows you to 
       view rules on other servers</td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">lusers</td>
-    <td>Displays current &amp; max user loads, both global and local.<br></td>
+    <td height="39">lusers &lt;server&gt; </td>
+    <td>Displays current &amp; max user loads, both global and local. Adding a server name allows you to view rules on other servers.<br></td>
     <td>All</td>
   </tr>
   <tr> 
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">quit {reason}</td>
+    <td height="39">quit &lt;reason&gt;</td>
     <td>Causes you to disconnect from the server. If you include a reason, it 
       will be displayed on all channels as you quit</td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">ping {user}</td>
+    <td height="39">ping &lt;user&gt;</td>
     <td>Sends a PING request to a user. Used for checking connection and lag. 
       Servers issue pings on a timed basis to determine if users are still connected.<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">version {nick}</td>
+    <td height="39">version &lt;nick&gt;</td>
     <td>Sends a CTCP Version request to the user. If configured to do so, their 
       client will respond with the client version.<br></td>
     <td>All</td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">Admin {server}</td>
+    <td height="39">Admin &lt;server&gt;</td>
     <td>Displays the admin info of a server. If a server name is included it will 
       display the info of that server.<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">userhost {nick}</td>
+    <td height="39">userhost &lt;nick&gt;</td>
     <td>Displays the userhost of the nick given. Generally used for scripts<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">topic {channel} {topic}</td>
-    <td>Topic {channel} will display the current topic of the given channel. Topic 
-      {channel} {topic} will change the topic of the given channel.<br></td>
+    <td height="39">topic &lt;channel&gt; &lt;topic&gt;</td>
+    <td>Topic &lt;channel&gt; will display the current topic of the given channel. Topic 
+      &lt;channel&gt; &lt;topic&gt; will change the topic of the given channel.<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">invite {nick} {channel}</td>
+    <td height="39">invite &lt;nick&gt; &lt;channel&gt;</td>
     <td>Invites the given user to the given channel. (Must be a channel Op)<br></td>
     <td>ChanOp</td>
   </tr>
   <tr> 
-    <td height="39">kick {channel, channel} {user, user} {reason}</td>
+    <td height="39">kick &lt;channel, channel&gt; &lt;user, user&gt; &lt;reason&gt;</td>
     <td>Kicks a user or users out of a channel, or channels. A reason may also 
       be supplied. <br></td>
     <td>ChanOp</td>
   </tr>
   <tr> 
-    <td height="39">away {reason}</td>
+    <td height="39">away &lt;reason&gt;</td>
     <td>Marks you as being away. A reason may also be supplied.<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">Watch +-{nick} +-{nick}<br></td>
+    <td height="39">Watch +-&lt;nick&gt; +-&lt;nick&gt;<br></td>
     <td>Watch is a new notify-type system in UnrealIRCd which is both faster and 
       uses less network resources than any old-style notify system. The server 
       will send you a message when any nickname in your watch list logs on or 
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">helpop ?{topic} or !{topic}<br></td>
+    <td height="39">helpop ?&lt;topic&gt; or !&lt;topic&gt;<br></td>
     <td>HelpOp is a new system of getting IRC Server help. You type either /HELPOP 
       ? &lt;help system topic&gt; or /HELPOP ! &lt;question&gt; The &quot;?&quot; 
       in /HELPOP means query the help system and if you get no response you can 
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">list {search string}</td>
+    <td height="39">list &lt;search string&gt;</td>
     <td>Lists all channels on the network. If a search string is supplied, it 
       will apply that to the search. Wildcards are supported</td>
     <td>All</td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">Knock {channel} {message}<br></td>
+    <td height="39">Knock &lt;channel&gt; &lt;message&gt;<br></td>
     <td>Allows you to &#8216;knock&#8217; on an invite only channel and ask for 
       access. Will not work if channel has one of the following modes set: +K 
       +I. Will also not work if you are banned<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">vhost {login} {password}</td>
+    <td height="39">vhost &lt;login&gt; &lt;password&gt;</td>
     <td>Hides your host name by using a vhost provided by the server. <br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">mode {chan/nick} {mode}<br></td>
+    <td height="39">mode &lt;chan/nick&gt; &lt;mode&gt;<br></td>
     <td>Lets you set channel and user modes. Refer to section 4 for lists of modes<br></td>
     <td>All</td>
   </tr>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">time {server}</td>
+    <td height="39">time &lt;server&gt;</td>
     <td>Displays the servers date and time. Including a server name allows you 
       to check other servers.<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">botmotd {server}<br></td>
+    <td height="39">botmotd &lt;server&gt;<br></td>
     <td>Displays the servers bot message of the day. Including a server name allows 
       you to check other servers</td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">identify {password}</td>
+    <td height="39">identify &lt;password&gt;</td>
     <td>Sends your password to the services system to identify to your nick.<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">identify {channel} {password}</td>
+    <td height="39">identify &lt;channel&gt; &lt;password&gt;</td>
     <td>Sends your password to the services system to identify as the founder 
       of a channel.<br></td>
     <td>All</td>
   </tr>
   <tr> 
-    <td height="39">oper {userid} {password}<br></td>
+    <td height="39">oper &lt;userid&gt; &lt;password&gt;<br></td>
     <td>Command to give a user operator status if they match an Oper Block<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">wallop {message}</td>
+    <td height="39">wallop &lt;message&gt;</td>
     <td>Sends a message to all users with umode +w</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">globops {message}</td>
+    <td height="39">globops &lt;message&gt;</td>
     <td>Sends a message to all IRCops</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">chatops {message}</td>
+    <td height="39">chatops &lt;message&gt;</td>
     <td>Send a message to all IRCops with umode +c</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">locops {message}</td>
+    <td height="39">locops &lt;message&gt;</td>
     <td>Sends a message to all local IRCops</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">adchat {message}</td>
+    <td height="39">adchat &lt;message&gt;</td>
     <td>Sends a message to all Admins</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">nachat {message}</td>
+    <td height="39">nachat &lt;message&gt;</td>
     <td>Sends a message to all Net Admins</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">kill {nick} {reason}</td>
+    <td height="39">kill &lt;nick&gt; &lt;reason&gt;</td>
     <td>Kills a user from the network</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">kline {hostmask} {reason}</td>
+    <td height="39">kline &lt;hostmask&gt; &lt;reason&gt;</td>
     <td>Bans the hostmask from the server it is issued on. It is not a global 
       ban. </td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">unkline {hostmask}</td>
+    <td height="39">unkline &lt;hostmask&gt;</td>
     <td>Removes a kline</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">zline {ip} :{reason}</td>
+    <td height="39">zline &lt;ip&gt; :&lt;reason&gt;</td>
     <td>Bans an IP Address from the local server it is issued on<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">unzline {ip}</td>
+    <td height="39">unzline &lt;ip&gt;</td>
     <td>Removes a zline</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">gline {user@host} {time to ban} :{reason}<br></td>
+    <td height="39">gline &lt;user@host&gt; &lt;time to ban&gt; :&lt;reason&gt;<br></td>
     <td>Adds a global ban to anyone that matches. Time to ban is in seconds, or 
       u can use 1d for 1 days. To remove a gline, put a &#8211;user@host<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">shun +-{user@host} {time to shun} :{reason}<br></td>
+    <td height="39">shun +-&lt;user@host&gt; &lt;time to shun&gt; :&lt;reason&gt;<br></td>
     <td>Prevents a user from executing ANY commands on the server, and prevents 
       them from speaking. Time to ban is in seconds, or u can use 1d for 1 days. 
       To remove a shun, put a &#8211;user@host. Setting time to 0 makes it permanent. 
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">gzline {ip} {time to ban} :{reason}<br></td>
+    <td height="39">gzline &lt;ip&gt; &lt;time to ban&gt; :&lt;reason&gt;<br></td>
     <td>Adds a global zline. Time to ban is in seconds, or u can use 1d for 1 
       days. To remove a gzline, put a &#8211;user@host. Setting time to 0 makes 
       it permanent.<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">tkline {user@host} {time to ban} :{reason}<br></td>
+    <td height="39">tkline &lt;user@host&gt; &lt;time to ban&gt; :&lt;reason&gt;<br></td>
     <td>Timed Kline. . Time to ban is in seconds, or u can use 1d for 1 days. 
       To remove a tkline, put a &#8211;user@host. Setting time to 0 makes it permanent.<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">tzline {ip} {time to ban} :{reason}<br></td>
+    <td height="39">tzline &lt;ip&gt; &lt;time to ban&gt; :&lt;reason&gt;<br></td>
     <td>Timed Zline. . Time to ban is in seconds, or u can use 1d for 1 days. 
       To remove a tzline, put a &#8211;user@host. Setting time to 0 makes it permanent</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">akill {user@host} :{reason}<br></td>
+    <td height="39">akill &lt;user@host&gt; :&lt;reason&gt;<br></td>
     <td>Adds an akill (Services Admins &amp; Network Admins ONLY)<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">rakill {user@host}<br></td>
+    <td height="39">rakill &lt;user@host&gt;<br></td>
     <td>Removes an akill<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">rehash {server} &#8211;{flags}</td>
+    <td height="39">rehash &lt;server&gt; &#8211;&lt;flags&gt;</td>
     <td>Rehashes the servers config file. Incluidng a server name allows you to 
       rehash a remote servers config file. Several flags are also available. They 
       Include <br>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">restart {server} {password}<br></td>
+    <td height="39">restart &lt;server&gt; &lt;password&gt;<br></td>
     <td>Restarts the IRCD Process. Password is required. You may also include 
       a server name to restart a remote server.<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">die {password}<br></td>
+    <td height="39">die &lt;password&gt;<br></td>
     <td>Terminates the IRCD Process. Password is required</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">lag {server} <br></td>
+    <td height="39">lag &lt;server&gt; <br></td>
     <td>This command is like a Sonar or Traceroute for IRC server. You type in 
       /LAG irc.fyremoon.net and it will reply from every server it passes with 
       time and so on Useful for looking where lag is and optional TS future/past 
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">sethost {newhost}</td>
+    <td height="39">sethost &lt;newhost&gt;</td>
     <td>Lets you change your vhost to what ever you want it to be.<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">setident {newident}<br></td>
+    <td height="39">setident &lt;newident&gt;<br></td>
     <td>Lets you set your ident to what ever you want it to be<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">chghost {nick} {newhost}<br></td>
+    <td height="39">chghost &lt;nick&gt; &lt;newhost&gt;<br></td>
     <td>Lets you change the host name of a user currently on the system<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">chgident {nick} {newident}<br></td>
+    <td height="39">chgident &lt;nick&gt; &lt;newident&gt;<br></td>
     <td>Lets you set your ident to what ever you want it to be<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">chgname {nick} {newname}<br></td>
+    <td height="39">chgname &lt;nick&gt; &lt;newname&gt;<br></td>
     <td>Lets you change the realname of a user currently on the system<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">squit {sever}<br></td>
+    <td height="39">squit &lt;sever&gt;<br></td>
     <td>Disconnects a server from the network<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">connect {server} {port} {server}</td>
+    <td height="39">connect &lt;server&gt; &lt;port&gt; &lt;server&gt;</td>
     <td>If only one server is givin, it will attempt to connect the server you 
       are ON to the given server. If 2 servers are given, it will attempt to connect 
       the 2 servers together. Put the hub server as the first, and the leaf server 
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">dccdeny {filemask} {reason}<br></td>
+    <td height="39">dccdeny &lt;filemask&gt; &lt;reason&gt;<br></td>
     <td>Adds a DCCDENY for that filemask. Preventing that file from being sent.<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">undccdeny {filemask}<br></td>
+    <td height="39">undccdeny &lt;filemask&gt;<br></td>
     <td>Removes a DCCDENY</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">sajoin {nick} {channel}, {channel}<br></td>
+    <td height="39">sajoin &lt;nick&gt; &lt;channel&gt;, &lt;channel&gt;<br></td>
     <td>Forces a user to join a channel(s). Available to services &amp; network 
       admins only</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">sapart {nick} {channel}, {channel}<br></td>
+    <td height="39">sapart &lt;nick&gt; &lt;channel&gt;, &lt;channel&gt;<br></td>
     <td>Forces a user to part a channel(s). Available to services &amp; network 
       admins only.<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">samode {channel} {mode}<br></td>
+    <td height="39">samode &lt;channel&gt; &lt;mode&gt;<br></td>
     <td>Allows Network &amp; Services admins to change modes of a channel without 
       having ChanOps.<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">rping {servermask}<br></td>
+    <td height="39">rping &lt;servermask&gt;<br></td>
     <td>Will calculate in milliseconds the lag between servers<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">trace {servermask}<br></td>
+    <td height="39">trace &lt;servermask&gt;<br></td>
     <td>Will calculate in milliseconds the lag between servers<br></td>
     <td>IRCop</td>
   </tr>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="39">addmotd :{text}<br></td>
+    <td height="39">addmotd :&lt;text&gt;<br></td>
     <td>Will add the given text to the end of the Motd<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="36">addomotd :{text}<br></td>
+    <td height="36">addomotd :&lt;text&gt;<br></td>
     <td>Will add the given text to the end of the OperMotd<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="36">sdesc {newdescription}<br></td>
+    <td height="36">sdesc &lt;newdescription&gt;<br></td>
     <td>Allows server admins to change the description line of their server without 
       restarting.<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="36">addline {text}<br></td>
+    <td height="36">addline &lt;text&gt;<br></td>
     <td>Allows you to add lines to the unrealircd.conf<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="36">mkpasswd {password}<br></td>
+    <td height="36">mkpasswd &lt;password&gt;<br></td>
     <td>Will encrypt a clear text password to add it to the unrealircd.conf<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="36">tsctl offset +/- {time}<br></td>
+    <td height="36">tsctl offset +/- &lt;time&gt;<br></td>
     <td>Adjust the IRCD&#8217;s Internal clock (Do NOT use if you do not understand 
       EXACTLY what it does)<br></td>
     <td>IRCop</td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="36">tsctl svstime {timestamp}<br></td>
+    <td height="36">tsctl svstime &lt;timestamp&gt;<br></td>
     <td>Sets the TS time of all servers (Do NOT use if you do not understand EXACTLY 
       what it does)<br></td>
     <td>IRCop</td>
   </tr>
   <tr> 
-    <td height="36">htm {option}<br></td>
+    <td height="36">htm &lt;option&gt;<br></td>
     <td>Controls settings related to high traffic mode. High Traffic Mode (HTM) 
       basically disables certain user commands such as: list whois who etc in 
       response to extremely high traffic on the server. Options include: <br>
       -ON Forces server into HTM <br>
       -OFF Forces server out of HTM <br>
-      -NOSIY Sets the server to notify users/admins when in goes in and out of 
+      -NOISY Sets the server to notify users/admins when in goes in and out of 
       HTM<br>
       -QUITE Sets the server to NOT notify when going in and out of HTM<br>
-      -TO {value} Sets Traffic rate HTM activate<br> </td>
+      -TO &lt;value&gt; Sets Traffic rate HTM activate<br> </td>
     <td>IRCop</td>
   </tr>
   <tr>
-    <td height="36">stats {option}<br></td>
+    <td height="36">stats &lt;option&gt;<br></td>
     <td>b - Send the badwords list<br>
       C - Send the link block list<br>
       d - Send the deny link (auto) block list<br>
       V - Send the vhost block list<br>
       y - Send the class block list<br>
       Z - Send memory usage information</td>
+    <td>Admin</td>
+  </tr>
+  <tr>
+    <td height="36">module<br></td>
+    <td>
+       Lists all loaded modules
     <td>IRCop/All</td>
   </tr>
 </table>
-<p></p>
-<p></p>
-<p></p>
 </body>
 </html>
index 70bf55ca6eed6ffc08e350dc70ba19879db4845d..fa50d3d72d57ac61b050a932c60d3b0961d05452 100644 (file)
--- a/help.conf
+++ b/help.conf
-/* UnrealIRCd3.2 Help Configuration\r
- * Based on the original help text written by hAtbLaDe\r
- * Revised by CC (07/2002)\r
- *\r
- * A worthwhile update for the /HELPOP system.\r
+/* UnrealIRCd3.2 Help Configuration
+ * Based on the original help text written by hAtbLaDe
+ * Revised by CC (07/2002)
+ *
+ * A worthwhile update for the /HELPOP system.
  * Included with Unreal3.2 Dist. on 8/24/02 (Beta12)
- */\r
-\r
-help {\r
-       " Server Commands Help.";\r
-       " Specify your Question after the /HELPOP command.";\r
-       " You will find all of the server commands and options";\r
-       " available for use.";\r
-       " If you need extra assistance please visit the server's";\r
-       " help channel or ask an available IRCop.";\r
-       " -";\r
-       " /HELPOP USERCMDS - To get the list of User Commands";\r
-       " /HELPOP OPERCMDS - To get the list of Oper Commands";\r
-       " /HELPOP SVSCMDS  - Commands sent via U:Lined Server (Services)";\r
-       " /HELPOP UMODES   - To get the list of User Modes";\r
-       " /HELPOP SNOMASKS - To get a list of Snomasks";\r
-       " /HELPOP CHMODES  - To get the list of Channel Modes";\r
-       " /HELPOP OFLAGS   - To see the list of O:line Flags";\r
-       " -";\r
-       " ==-------------------------oOo--------------------------==";\r
-};\r
-\r
-help Usercmds {\r
-       " Currently the following User commands are available.";\r
-       " Use /HELPOP <command name> to get more information about";\r
-       " a specific command.";\r
-       " -";\r
-       " ==-----------------oOo-----------------==";\r
-       " NICK WHOIS WHO WHOWAS NAMES";\r
-       " ISON JOIN PART MOTD RULES";\r
-       " LUSERS MAP QUIT PING VERSION";\r
-       " STATS LINKS ADMIN USERHOST TOPIC";\r
-       " INVITE KICK AWAY WATCH LIST";\r
-       " PRIVMSG NOTICE KNOCK SETNAME VHOST";\r
-       " MODE CREDITS LICENSE TIME SILENCE PONG";\r
-       " ==-----------------oOo-----------------==";\r
-};\r
-\r
-help Opercmds {\r
-       " This section gives the IRC Operator only commands.";\r
-       " Use /HELPOP <command name> to get more information about";\r
-       " a specific command.";\r
-       " -";\r
-       " ==----------------oOo---------------==";\r
-       " OPER WALLOPS GLOBOPS CHATOPS LOCOPS";\r
-       " ADCHAT NACHAT TECHAT KILL KLINE";\r
-       " UNKLINE ZLINE UNZLINE GLINE SHUN";\r
-       " GZLINE TKLINE TZLINE HTM TSCTL";\r
-       " AKILL RAKILL REHASH RESTART DIE";\r
-       " LAG SETHOST SETIDENT CHGHOST CHGIDENT";\r
-       " CHGNAME SQUIT CONNECT DCCDENY UNDCCDENY";\r
-       " SAJOIN SAPART SAMODE RPING TRACE";\r
-       " OPERMOTD SDESC MKPASSWD";\r
-       " ==----------------oOo---------------==";\r
-};\r
-\r
-help Svscmds {\r
-       " This section gives the commands that can be";\r
-       " sent via a U:Lined Server such as Services.";\r
-       " The command is typically sent as:";\r
-       " /MSG OPERSERV RAW :services <command>";\r
-       " Use /HELPOP <command name> to get more information about";\r
-       " a specific command.";\r
-       " -";\r
-       " ==-----------oOo-----------==";\r
-       " SVSNICK SVSMODE SVSKILL";\r
-       " SVSNOOP SVSJOIN SVSPART";\r
-       " SVSO SWHOIS SQLINE";\r
-       " UNSQLINE SVS2MODE SVSFLINE";\r
-       " SVSMOTD SVSTIME";\r
-       " ==-----------oOo-----------==";\r
-};\r
-\r
-help Umodes {\r
-       " Here is a list of all the usermodes which are available for use.";\r
-       " -";\r
-       " ==---------------------------oOo---------------------------==";\r
-       " o = Global IRC Operator";\r
-       " O = Local IRC Operator";\r
-       " a = Is a Services Administrator";\r
-       " A = Is a Server Administrator";\r
-       " N = Is a Network Administrator";\r
-       " C = Is a Co Administrator";\r
-       " -";\r
-       " b = Can read & send to ChatOps";\r
-       " d = Makes it so you can not recieve channel PRIVMSGs (Deaf)";\r
-       " g = Can read & send to GlobOps, and LocOps";\r
-       " h = Available for Help (Help Operator)";\r
-       " i = Invisible (Not shown in /WHO searches)";\r
-       " q = Only U:lines can kick you (Services Admins only)";\r
-       " r = Identifies the nick as being Registered";\r
-       " s = Can listen to Server notices";\r
-       " t = Says that you are using a /VHOST";\r
-       " v = Receive infected DCC send rejection notices";\r
-       " w = Can listen to Wallop messages";\r
-       " x = Gives the user Hidden Hostname (security)";\r
-       " z = Marks the client as being on a Secure Connection (SSL)";\r
-       " B = Marks you as being a Bot";\r
-       " G = Filters out all Bad words in your messages with <censored>";\r
-       " H = Hide IRCop status in /WHO and /WHOIS. (IRC Operators only)";\r
-       " I = Invisible Join/Part. Makes you being hidden at channels";\r
-       " R = Allows you to only receive PRIVMSGs from registered (+r) users";\r
-       " S = For Services only. (Protects them)";\r
-       " V = Marks the client as a WebTV user";\r
-       " W = Lets you see when people do a /WHOIS on you (IRC Operators only)";\r
-       " ==---------------------------oOo---------------------------==";\r
-};\r
-\r
-help Snomasks {\r
-       " This section lists all of the snomasks available.";\r
-       " A snomask is used with usermode +s. They are an additional parameter.";\r
-       " For example, to set snomask +f you'd do:";\r
-       " /MODE mynick +s +f";\r
-       " You can remove individual snomasks or set -s to remove them all";\r
-       " -";\r
-       " ==-------------------------oOo-----------------------==";\r
-       " c = See's all Connects/Disconnects on local server";\r
-       " e = Can listen to Server Messages sent to +e users (Eyes)";\r
-       " f = Listen to Flood Alerts from server";\r
-       " j = See's Misc. Messages generated by the server";\r
-       " k = See's all the /KILL's which were executed";\r
-       " n = nick change notices";\r
-       " q = Lets you see notices when a user is rejected because of a Q:line";\r
-       " v = Lets you receive notice of /VHOST usages";\r
-       " F = Lets you recieve Far and Local connect notices";\r
-       " G = Lets you see TKL (G:line,Shun) noties";   \r
-       " ==-------------------------oOo------------------------==";\r
-};\r
-\r
-help Chmodes {\r
-       " This section lists all of the possible channel modes that may be used with /MODE";\r
-       " -";\r
-       " ==------------------------------oOo----------------------------==";\r
-       " v <nickname> = Gives Voice to the user (May talk if chan is +m)";\r
-       " h <nickname> = Gives HalfOp status to the user (Limited op access)";\r
-       " o <nickname> = Gives Operator status to the user";\r
-       " a <nickname> = Gives protection to the user (No kick/drop)";\r
-       " q <nickname> = Gives Owner status to the user";\r
-       " -";\r
-       " b <nick!ident@host> = Bans the nick!ident@host from the channel";\r
-       " c = Block messages containing mIRC color codes";\r
-       " e <nick!ident@host> = Overrides a ban for matching users";\r
-       " f [*]<lines>:<seconds> = Flood protection";\r
-       " (Users will be kicked after saying <lines> in <seconds> and banned if * is specified)";\r
-       " i = A user must be invited to join the channel";\r
-       " k <key> = Users must specify <key> to join";\r
-       " l <number of max users> = Channel may hold at most <number> of users";\r
-       " m = Moderated channel (only +vhoaq users may speak)";\r
-       " n = Users outside the channel can not send PRIVMSGs to the channel";\r
-       " p = Private channel";\r
-       " r = The channel is registered (services settable only)";\r
-       " s = Secret channel";\r
-       " t = Only +hoaq may change the topic";\r
-       " z = Only Clients on a Secure Connection (SSL) can join";\r
-       " A = Server/Net Admin only channel (Settable by Admins)";\r
-       " C = No CTCPs allowed in the channel";\r
-       " H = No +I users may join (Settable by Admins)";\r
-       " K = /KNOCK is not allowed";\r
-       " L <chan2> = Channel link (If +l is full, the next user will auto-join <chan2>)";\r
-       " N = No Nickname changes are permitted in the channel.";\r
-       " O = IRC Operator only channel (Settable by IRCops)";\r
-       " Q = No kicks allowed";\r
-       " R = Only registered (+r) users may join the channel";\r
-       " S = Strips mIRC color codes";\r
-       " V = /INVITE is not allowed";\r
-       " ==------------------------------oOo----------------------------==";\r
-};\r
-\r
-help Oflags {\r
-       " Here you will find the flags that can be placed inside of the O:Lines";\r
-       " -";\r
-       " ==----------------------oOo--------------------==";\r
-       " o = Local Operator";\r
-       " O = Global Operator";\r
-       " a = Gets +a on oper up. Is Services Administrator";\r
-       " A = Gets +A on oper up. Is Server Administrator";\r
-       " C = Gets +C on oper up. Is Co Administrator";\r
-       " N = Gets +N on oper up. Is Network Administrator";\r
-       " -";\r
-       " r = Access to /REHASH server";\r
-       " R = Access to /RESTART server";\r
-       " D = Access to /DIE server";\r
-       " h = Oper can send /HELPOPS - gets +h on oper up";\r
-       " g = Oper can send /GLOBOPS";\r
-       " w = Oper can send /WALLOPS";\r
-       " n = Oper can send Local Server Notices";\r
-       " G = Oper can send Global Server Notices";\r
-       " c = Access to do local /SQUITs and /CONNECTs";\r
-       " L = Access to do global /SQUITs and /CONNECTs";\r
-       " k = Access to do local /KILLs";\r
-       " K = Access to do global /KILLs";\r
-       " b = Oper can /KLINE users from server";\r
-       " t = Oper can /GKLINE users from server";\r
-       " B = Oper can /UNKLINE users from server";\r
-       " z = Can add Z:Lines";\r
-       " Z = Can add global Z:Lines";\r
-       " H = Gets +x on oper up";\r
-       " W = Gets +W on oper up";\r
-       " ^ = Allows to use usermode +I";\r
-       " ==----------------------oOo--------------------==";\r
-};\r
-\r
-\r
-help Nick {\r
-       " Changes your \"Online Identity\" on a server.";\r
-       " All those in the channel you are in will be";\r
-       " alerted of your nickname change.";\r
-       " -";\r
-       " Syntax:  NICK <new nickname>";\r
-       " Example: NICK hAtbLaDe";\r
-};\r
-\r
-help Whois {\r
-       " Shows information about the user in question,";\r
-       " such as their \"Name\", channels they are";\r
-       " currently in, their hostmask, etc.";\r
-       " -";\r
-       " Syntax:  WHOIS <user>";\r
-       " Example: WHOIS hAtbLaDe";\r
-};\r
-\r
-help Who {\r
-       " Retrieves information about users";\r
-       " -";\r
-       " Syntax:";\r
-       " /WHO [+|-][acghmnsuCM] [args]";\r
-       " Flags are specified like channel modes, the flags cgmnsu all have arguments";\r
-       " Flags are set to a positive check by +, a negative check by -";\r
-       " The flags available:";\r
-       " Flag a: user is away";\r
-       " Flag c <channel>: user is on <channel>, no wildcards accepted";\r
-       " Flag g <gcos/realname>: user has string <gcos> in their GCOS,";\r
-       " wildcards accepted, oper only";\r
-       " Flag h <host>: user has string <host> in their hostname, wildcards are accepted";\r
-       " Flag m <usermodes>: user has <usermodes> set on them, only o/A/a for nonopers";\r
-       " Flag n <nick>: user has string <nick> in their nickname, wildcards accepted";\r
-       " Flag s <server>: user is on server <server>, wildcards not accepted";\r
-       " Flag u <user>: user has string <user> in their username, wildcards accepted";\r
-       " Behavior flags:";\r
-       " Flag C: show first visible channel user is in";\r
-       " Flag M: check for user in channels I am a member of";\r
-       " -";\r
-       " For backwards compatibility, /who 0 o still shows +o users";\r
-       " Example: WHO +m o";\r
-};\r
-\r
-help Whowas {\r
-       " Retrieves previous WHOIS information for users";\r
-       " no longer connected to the server.";\r
-       " -";\r
-       " Syntax:  WHOWAS <nickname>";\r
-       "  WHOWAS <nickname> <max number of replies>";\r
-       " Example: WHOWAS hAtbLaDe";\r
-};\r
-\r
-help Names {\r
-       " Provides a list of users on the specified channel.";\r
-       " -";\r
-       "Syntax:  NAMES <channel>";\r
-       "Example: NAMES #Support";\r
-};\r
-\r
-help Ison { \r
-       " Used to determine if certain user(s) are";\r
-       " currently online based upon their nickname.";\r
-       " -";\r
-       " Syntax:  ISON <user> <user2> <user3> <user4>";\r
-       " Example: ISON hAtbLaDe Stskeeps OperServ AOLBot";\r
-};\r
-\r
-help Join { \r
-       " Used to enter one or more channels on an IRC server.";\r
-       " All occupants of the channel will be notified of your arrival.";\r
-       " JOIN with 0 as a parameter makes you Part all channels.";\r
-       " If you specify one or more keys, they will be used to join a +k channel";\r
-       " -";\r
-       " Syntax:  JOIN <chan>,<chan2>,<chan3> <key1>,<key2>,<key3>";\r
-       "  JOIN 0 (Parts all channels)";\r
-       " Example: JOIN #Support";\r
-       "          JOIN #Lobby,#IRCd";\r
-       "          JOIN #IRCd,#Support,#main letmein,somepass,anotherpass";\r
-};\r
-\r
-help Part {\r
-       " Used to part (or leave) a channel you currently occupy.";\r
-       " All those in the channel will be notified of your departure.";\r
-       " If you specify a reason it will be displayed to the users on the channel";\r
-       " -";\r
-       " Syntax:  PART <chan>,<chan2>,<chan3>,<chan4> <reason>";\r
-       " Example: PART #Support";\r
-       "          PART #Lobby,#IRCd See ya later!";\r
-};\r
-\r
-help Motd {\r
-       " Displays the Message Of The Day of the IRC Server you are logged onto.";\r
-       " -";\r
-       " Syntax: MOTD";\r
-       "         MOTD <server>";\r
-};\r
-\r
-help Rules {\r
-       " Shows you the Rules of the Network.";\r
-       " -";\r
-       " Syntax: RULES";\r
-       "         RULES <server>";\r
-};\r
-\r
-help Lusers {\r
-       " Provides Local and Global user information";\r
-       " (Such as Current and Maximum user count).";\r
-       " -";\r
-       " Syntax: LUSERS";\r
-};\r
-\r
-help Map {\r
-       " Provides a graphical \"Network Map\" of the IRC network.";\r
-       " Mainly used for routing purposes.";\r
-       " -";\r
-       " Syntax: MAP";\r
-};\r
-\r
-help Quit {\r
-       " Disconnects you from the IRC server. Those in the";\r
-       " channels you occupy will be notified of your departure.";\r
-       " If you do not specify a reason, your nickname becomes the reason.";\r
-       " -";\r
-       " Syntax:  QUIT <reason>";\r
-       " Example: QUIT Leaving!";\r
-};\r
-\r
-help Ping {\r
-       " The PING command is used to test the presence of an active client or";\r
-       " server at the other end of the connection.  Servers send a PING";\r
-       " message at regular intervals if no other activity detected coming";\r
-       " from a connection.  If a connection fails to respond to a PING";\r
-       " message within a set amount of time, that connection is closed. A";\r
-       " PING message MAY be sent even if the connection is active.";\r
-       " Note that this is different from a CTCP PING command..";\r
-       " -";\r
-       " Syntax:  PING <server> <server2>";\r
-       " Example: PING irc.fyremoon.net";\r
-       "          PING hAtbLaDe";\r
-       "          PING hAtbLaDe irc2.dynam.ac";\r
-};\r
-\r
-help Pong {\r
-       " PONG message is a reply to PING message.  If parameter <server2> is";\r
-       " given, this message will be forwarded to given target.  The <server>";\r
-       " parameter is the name of the entity who has responded to PING message";\r
-       " and generated this message.";\r
-       " -";\r
-       " Syntax:  PONG <server> <server2>";\r
-       " Example: PONG irc.fyremoon.net irc2.dynam.ac";\r
-       "          (PONG message from irc.fyremoon.net to irc2.dynam.ac)";\r
-};\r
-\r
-help Version {\r
-       " Provides Version information of the IRCd software in usage.";\r
-       " -";\r
-       " Syntax: VERSION";\r
-       "         VERSION <server>";\r
-};\r
-\r
-help Stats {\r
-       " Provides certain Statistical information about the server";\r
-       " -";\r
-       " Syntax:  STATS <flags>";\r
-       " Example: STATS u";\r
-       " -";\r
-       " ==---------------------oOo---------------------==";\r
-       " b - Send the badwords list";\r
-       " C - Send the link block list";\r
-       " d - Send the deny link (auto) block list";\r
-       " D - Send the deny link (all) block list";\r
-       " e - Send the except socks block list";\r
-       " E - Send the except ban block list";\r
-       " F - Send the deny dcc block list";\r
-       " G - Report TKL information (G:lines/Shuns)";\r
-       " H - Send the link block list";\r
-       " I - Send the allow block list";\r
-       " K - Send the ban user/ban ip/except ban block list (Includes AKILLs)";\r
-       " L - Send Link information";\r
-       " m - Send the events list";\r
-       " M - Send list of how many times each command was used";\r
-       " n - Send the ban realname block list";\r
-       " N - Send network configuration list";\r
-       " O - Send the oper block list";\r
-       " q - Send the SQLINE list";\r
-       " Q - Send the ban nick block list";\r
-       " r - Send the channel deny/allow block list";\r
-       " s - Send the SCache and NS list";\r
-       " S - Send the dynamic configuration list";\r
-       " t - Send connection information";\r
-       " T - Send the tld block list";\r
-       " u - Send server uptime and connection count";\r
-       " U - Send the ulines block list";\r
-       " v - Send the deny version block list";\r
-       " V - Send the vhost block list";\r
-       " Y - Send the class block list";\r
-       " Z - Send memory usage information";\r
-       " ==---------------------oOo---------------------==";\r
-};\r
-\r
-help Links {\r
-       " Lists all of the servers currently linked to the network.";\r
-       " Only IRCops can see linked U:lined servers.";\r
-       " -";\r
-       " Syntax: LINKS";\r
-};\r
-\r
-help Admin {\r
-       " Provides Administrative information regarding the server.";\r
-       " -";\r
-       " Syntax: ADMIN";\r
-       "         ADMIN <server>";\r
-};\r
-\r
-help Userhost {\r
-       " Returns the userhost of the user in question.";\r
-       " Usually used by scripts or bots.";\r
-       " -";\r
-       " Syntax:  USERHOST <nickname>";\r
-       " Example: USERHOST hAtbLaDe";\r
-};\r
-\r
-help Topic {\r
-       " Sets/Changes the topic of the channel in question,";\r
-       " or just display the current Topic.";\r
-       " -";\r
-       " Syntax:  TOPIC <channel> (Displays the current topic)";\r
-       "          TOPIC <channel> <topic> (Changes topic)";\r
-       " Example: TOPIC #Operhelp";\r
-       "          TOPIC #Lobby Welcome to #Lobby!!";\r
-};\r
-\r
-help Invite {\r
-       " Sends a user an Invitation to join a particular channel.";\r
-       " You must be an Operator on the channel in order to";\r
-       " invite a user into it.";\r
-       " -";\r
-       " Syntax:  INVITE <user> <channel>";\r
-       " Example: INVITE hAtbLaDe #Support";\r
-};\r
-\r
-help Kick {\r
-       " Removes a user from a channel. Can only be used by Operators";\r
-       " or Half-Ops. If no reason is specified, your nickname becomes the reason.";\r
-       " -";\r
-       " Syntax:  KICK <channel>[,<channel2>..] <user>[,<user2>..] <reason>";\r
-       " Example: KICK #Lobby foobar Lamer..";\r
-       "          KICK #Lobby,#OperHelp Lamer23,Luser12 Lamers!";\r
-};\r
-\r
-help Away {\r
-       " Sets your online status to \"Away\".";\r
-       " -";\r
-       " Syntax:  AWAY <reason> (Sets you Away with the reason given)";\r
-       "          AWAY (Un-Sets you as Away)";\r
-       " Example: AWAY Lunch time!";\r
-};\r
-\r
-help Watch {\r
-       " Watch is a notify-type system on the server which is both faster";\r
-       " and uses less network resources than any old-style notify";\r
-       " system. The server will send you a message when any nickname";\r
-       " in your watch list logs on or off.";\r
-       " The watch list DOES NOT REMAIN BETWEEN SESSIONS - You (or your";\r
-       " script or client) must add the nicknames to your watch list every";\r
-       " time you connect to an IRC server.";\r
-       " -";\r
-       " Syntax: WATCH +nick1 +nick2 +nick3 (Add nicknames)";\r
-       "         WATCH -nick (Delete nicknames)";\r
-       "         WATCH (View the watchlist)";\r
-};\r
-\r
-help List {\r
-       " Provides a complete listing of all channels on the network.";\r
-       " If a search string is specified, it will only show those";\r
-       " matching the search string.";\r
-       " -";\r
-       " Syntax:  LIST <search string>";\r
-       " Example: LIST";\r
-       "          LIST *ircd*";\r
-       " -";\r
-       " Some additional flags are also supported.";\r
-       " >number  List channels with more than <number> people";\r
-       " <number  List channels with less than <number> people";\r
-       " !*mask*  List channels that do not match *mask*";\r
-       " -";\r
-       " Any of those may be used instead of a standard mask.";\r
-};\r
-\r
-help Privmsg {\r
-       " /PRIVMSG @#channel <text> will send the text to Channel-ops on the";\r
-       " given channel only.";\r
-       " /PRIVMSG @+#channel <text> will send the text to both ops and voiced";\r
-       " users on the channel.";\r
-       " While some clients may support these as-is,";\r
-       " on others (such as ircII), it's necessary to use";\r
-       " /QUOTE PRIVMSG @#channel <text> instead.";\r
-       " You can also use % to signify HalfOps on the channel.";\r
-       " -";\r
-       " Syntax:  PRIVMSG <nick>,<nick2>,<nick3>,<nick4> :<text>";\r
-       " Example: PRIVMSG hAtbLaDe :Hello";\r
-       "          PRIVMSG hAtbLaDe,Somefella,Lamer :Hello everyone!";\r
-       "          PRIVMSG @#hottub There is a meeting on Saturday.";\r
-};\r
-\r
-help Notice {\r
-       " /NOTICE @#channel <text> will send the text to Channel-ops on the";\r
-       " given channel only.";\r
-       " /NOTICE @+#channel <text> will send the text to both ops and voiced";\r
-       " users on the channel.";\r
-       " While some clients may support these as-is,";\r
-       " on others (such as ircII), it's necessary to use";\r
-       " /QUOTE NOTICE @#channel <text> instead.";\r
-       " You can also use % to signify HalfOps on the channel.";\r
-       " -";\r
-       " Syntax:  NOTICE <nick>,<nick2>,<nick3>,<nick4> :<text>";\r
-       " Example: NOTICE hAtbLaDe :Hello";\r
-       "          NOTICE hAtbLaDe,Somefella,Lamer :Hello everyone!";\r
-       "          NOTICE @#hottub Do not forget the meeting on Friday.";\r
-};\r
-\r
-help Knock {\r
-       " For channels which are invite only, you can \"Knock\" on the";\r
-       " channel to request an invite.";\r
-       " -";\r
-       " Syntax:  KNOCK <channel> <message>";\r
-       " Example: KNOCK #secret_chan I'm an op, let me in!";\r
-};\r
-\r
-help Setname {\r
-       " Allows users to change their \"Real name\" (GECOS)";\r
-       " directly online at IRC without reconnecting";\r
-       " -";\r
-       " Syntax: SETNAME <New Real Name>";\r
-};\r
-\r
-help Vhost {\r
-       " Hides your real hostname with a virtual hostname";\r
-       " provided by the IRC server , using SETHOST.";\r
-       " -";\r
-       " Synatx:  VHOST <login> <password>";\r
-       " Example: VHOST openbsd ilovecypto";\r
-};\r
-\r
-help Mode {\r
-       " Sets a mode on a Channel or User.";\r
-       " Use /HELPOP CHMODES or /HELPOP UMODES to see a list of Modes";\r
-       " -";\r
-       " Syntax:  MODE <channel/user> <mode>";\r
-       " Example: MODE #Support +tn";\r
-       "          MODE #Support +ootn hAtbLaDe XYZ";\r
-};\r
-\r
-help Credits {\r
-       " This command will list the Credits to all the people who";\r
-       " helped create UnrealIRCd.";\r
-       " -";\r
-       " Syntax: CREDITS";\r
-       "         CREDITS <server>";\r
-};\r
-\r
-help License {\r
-       " This command displays information about the license UnrealIRCd is released under.";\r
-       " Syntax: LICENSE";\r
-       "         LICENSE <server>";\r
-};\r
-\r
-help Time {\r
-       " Displays the current Server Date and Time.";\r
-       " -";\r
-       " Syntax : TIME";\r
-       "          TIME <server>";\r
-};\r
-\r
-help Silence {\r
-       " Ignores messages from a user or list of users at the Server itself.";\r
-       " -";\r
-       " Syntax: SILENCE +nickname (Adds a nickname to SILENCE list)";\r
-       "         SILENCE -nickname (Removes a nickname from the SILENCE list)";\r
-       "         SILENCE           (Lists the current SILENCE list)";\r
-};\r
-\r
-help Oper {\r
-       " Attempts to give a user IRC Operator status.";\r
-       " (Lets the IRCop opper up)";\r
-       " -";\r
-       " Syntax:  OPER <uid> <password>";\r
-       " Example: OPER hAtbLaDe foobar234";\r
-};\r
-\r
-help Wallops {\r
-       " Sends a \"Message\" to all those with the umode +w.";\r
-       " Only IRCops can send Wallops, while anyone with the mode +w";\r
-       " can view them.";\r
-       " -";\r
-       " Syntax: WALLOPS <message>";\r
-};\r
-\r
-help Globops {\r
-       " Sends a global \"Message\" to all IRCops. Only viewable by IRCops";\r
-       " (unlike WALLOPS, which can be viewed by normal users).";\r
-       " -";\r
-       " Syntax:  GLOBOPS <message>";\r
-       " Example: GLOBOPS Lets get em clones ..";\r
-};\r
-\r
-help Locops {\r
-       " Similar to GLOBOPS, except only received by those IRCops local to your server.";\r
-       " -";\r
-       " Syntax:  LOCOPS <message>";\r
-       " Example: LOCOPS Gonna k:line that user ...";\r
-};\r
-\r
-help Adchat {\r
-       " Sends a message to all online Admins";\r
-       " -";\r
-       " Syntax:  ADCHAT <text>";\r
-       " Example: ADCHAT Hey guys! I'm finally here.";\r
-};\r
-\r
-help Nachat {\r
-       " Sends a message to all online NetAdmins";\r
-       " -";\r
-       " Syntax:  NACHAT <text>";\r
-       " Example: NACHAT Hey guys! How is everything?";\r
-};\r
-\r
-help Kill {\r
-       " Forcefully Disconnects a user from an IRC Server.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  KILL <user> <reason>";\r
-       " Example: KILL Jack16 Cloning is not allowed";\r
-};\r
-\r
-help Kline {\r
-       " Bans a hostmask from connection to the IRC server.";\r
-       " The user can however connect to other servers on the network";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  KLINE <hostmask> <reason>";\r
-       " Example: KLINE *@*.aol.com Abuse";\r
-};\r
-\r
-help Unkline {\r
-       " Removes a k:line from the server.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  UNKLINE <hostmask>";\r
-       " Example: UNKLINE *@*.aol.com";\r
-};\r
-\r
-help Zline {\r
-       " Disables all access to the IRC server from a specified IP.";\r
-       " The IP can however connect to other servers on the network";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  ZLINE <ip> :<Reason>";\r
-       " Example: ZLINE 127.0.0.1 :Do not IRC from Localhost";\r
-};\r
-\r
-help Unzline {\r
-       " Removes a currently active z:Line.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  UNZLINE <ip>";\r
-       " Example: UNZLINE 127.0.0.1";\r
-};\r
-\r
-help Gline {\r
-       " This command provides timed G:Lines. If you match a G:Line you cannot";\r
-       " connect to ANY server on the IRC network";\r
-       " A time of 0 in the GLINE makes it permanent (Never Expires).";\r
-       " You may also specify the time in the format 1d10h15m30s.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  GLINE <user@host mask> <seconds to be banned> :<reason>";\r
-       "  (Adds a G:line for user@host)";\r
-       "          GLINE -<user@host mask> (Removes a G:line for user@host)";\r
-       " Example: GLINE *@*.idiot.net 900 :Spammers (Adds a 15 min G:line)";\r
-       "          GLINE *@*.idiot.net 1d5h :Spammers (Adds a 29 hour G:line)";\r
-};\r
-\r
-help Shun {\r
-       " Prevents a user from executing ANY command except ADMIN";\r
-       " and respond to Server Pings.";\r
-       " A time of 0 in the SHUN makes it permanent (Never Expires).";\r
-       " You may also specify the time in the format 1d10h15m30s.";\r
-       " IRC Operator only command.";\r
-       " -");\r
-       " Syntax:  SHUN <nickname> <time> :<Reason> (Shun the nickname for time in seconds)";\r
-       "          SHUN +<user@host> <time> :<Reason>(Shun the user@host for time in seconds)";\r
-       "          SHUN -<user@host> (Removes the SHUN for user@host)";\r
-       "          SHUN (View the current SHUN list)";\r
-       " -";\r
-       " Example: SHUN +foobar@aol.com 600 :Spamming";\r
-       "  (Shuns foobar@aol.com for 10 mins for Spamming)";\r
-       "          SHUN +foobar@aol.com 1d6h :Spamming (Adds a 30 hour SHUN)";\r
-};\r
-\r
-help Gzline {\r
-       " This command provides timed global Z:line. If you match a Global Z:Line you cannot";\r
-       " connect to ANY server on the IRC network";\r
-       " A time of 0 in the GZLINE makes it permanent (Never Expires).";\r
-       " You may also specify the time in the format 1d10h15m30s.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  GZLINE <user@host mask> <seconds to be banned> :<reason>";\r
-       "  (Adds a Global Z:line for user@host)";\r
-       "          GZLINE -<user@host mask> (Removes a Global Z:line for user@host)";\r
-       " Example: GZLINE *@*.idiot.net 900 :Spammers (Adds a 15 min Global Z:line)";\r
-       "          GZLINE *@*.idiot.net 1d5h :Spammers (Adds a 29 hour Global Z:line)";\r
-};\r
-\r
-help Tkline {\r
-       " This command provides timed K:Lines. If you match a time K:Line you cannot";\r
-       " connect to the server until the time has expired";\r
-       " A time of 0 in the TKLINE makes it permanent (Never Expires).";\r
-       " You may also specify the time in the format 1d10h15m30s.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  TKLINE <user@host mask> <seconds to be banned> :<reason>";\r
-       "  (Adds a Timed K:line for user@host)";\r
-       "          TKLINE -<user@host mask> (Removes a Timed K:line for user@host)";\r
-       " Example: TKLINE *@*.idiot.net 900 :Spammers (Adds a 15 min Timed K:line)";\r
-       "          TKLINE *@*.idiot.net 1d5h :Spammers (Adds a 29 hour Timed K:line)";\r
-};\r
-\r
-help Tzline {\r
-       " This command provides timed Z:Lines. If you match a Timed Z:Line you cannot";\r
-       " connect to the server until the time has expired";\r
-       " A time of 0 in the TZLINE makes it permanent (Never Expires).";\r
-       " You may also specify the time in the format 1d10h15m30s.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  TZLINE <user@host mask> <seconds to be banned> :<reason>";\r
-       "  (Adds a Timed Z:line for user@host)";\r
-       "          TZLINE -<user@host mask> (Removes a Timed Z:line for user@host)";\r
-       " Example: TZLINE *@*.idiot.net 900 :Spammers (Adds a 15 min Timed Z:line)";\r
-       "          TZLINE *@*.idiot.net 1d5h :Spammers (Adds a 29 hour Timed Z:line)";\r
-};\r
-\r
-help Akill {\r
-       " Adds an Autokill for the specific host mask. This prevents";\r
-       " any user from that hostmask from connecting to the network.";\r
-       " Services Admin Command";\r
-       " -";\r
-       " Syntax:  AKILL <user@host> :<Reason>";\r
-       " Example: AKILL foo@aol.com :Spammers!";\r
-};\r
-\r
-help Rakill {\r
-       " Removes an AKILL set by a Services Admin.";\r
-       " Services Admin Command";\r
-       " -";\r
-       " Syntax: RAKILL <user@host>";\r
-};\r
-\r
-help Rehash {\r
-       " Prompts the server to reread the configuration files.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax: REHASH <servername> -<flags>";\r
-       "         REHASH -<flags>";\r
-       " -";\r
-       " If servername and flags are not specified this rehashes the";\r
-       " unrealircd.conf , removing any temporary k:lines.";\r
-       " If servername is specified, this is used to rehash config files on servername.";\r
-       " Only NetAdmins may specify a server name.";\r
-       " -";\r
-       " The flags are used to rehash other config files, valid flags are:";\r
-       "  -motd     - Rehashes all MOTD files and RULES files (including tld{})";\r
-       "  -opermotd - Rehashes the OPERMOTD";\r
-       "  -botmotd  - Rehashes the BOTMOTD";\r
-       "  -garbage  - Force garbage collection";\r
-};\r
-\r
-help Restart {\r
-       " Kills and Restarts the IRC daemon, disconnecting all users";\r
-       " currently on that server.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax: RESTART";\r
-       "         RESTART <password>";\r
-       "         RESTART <server> <password>";\r
-};\r
-\r
-help Die {\r
-       " Kills the IRC daemon, disconnecting all users currently on that server.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax: DIE";\r
-       "         DIE <password>";\r
-};\r
-\r
-help Lag {\r
-       " This command is like a Traceroute for IRC servers";\r
-       " You type in /LAG irc.fyremoon.net and it will";\r
-       " reply from every server it passes with time and so on";\r
-       " Useful for looking where lag is and optional TS future/past travels";\r
-       " -";\r
-       " Syntax: LAG <server>";\r
-};\r
-\r
-help Sethost {\r
-       " This command is so you can change your Virtual host (Vhost)";\r
-       " to anything you want, except special characters.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  SETHOST <new hostname>";\r
-       " Example: SETHOST i.have.hairy.armpits";\r
-};\r
-\r
-help Setident {\r
-       " With this command you can change your Ident (Username).";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  SETIDENT <new ident>";\r
-       " Example: SETIDENT l33t";\r
-};\r
-\r
-help Chghost {\r
-       " Changes the hostname of a user currently on the IRC network.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  CHGHOST <nick> <host>";\r
-       " Example: CHGHOST hAtbLaDe root.me.com";\r
-};\r
-\r
-help Chgident {\r
-       " Changes the Ident of a user currently on the IRC network.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  CHGIDENT <nick> <ident>";\r
-       " Example: CHGIDENT hAtbLaDe sheep";\r
-};\r
-\r
-help Chgname {\r
-       " Changes the \"IRC Name\" (or \"Real Name\") of a user currently on the IRC network.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  CHGNAME <nick> <name>";\r
-       " Example: CHGNAME hAtbLaDe Gotta new name :)";\r
-};\r
-\r
-help Squit {\r
-       " Disconnects an IRC Server from the network.";\r
-       " Usually used in routing of servers.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  SQUIT <server>";\r
-       " Example: SQUIT leaf.*";\r
-};\r
-\r
-help Connect {\r
-       " Links another IRC server to the one you are currently on.";\r
-       " Remote connections are also possible.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax:  CONNECT <server>";\r
-       "          CONNECT <hub> <port> <leaf>";\r
-       " Example: CONNECT leaf.*";\r
-       "          CONNECT hub.* 6667 leaf.*";\r
-};\r
-\r
-help Dccdeny {\r
-       " Adds a DCC Deny for that Filename mask. This means that any";\r
-       " DCC sends of Files matching that Filename mask will be rejected.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax: DCCDENY <filename mask> <reason>";\r
-};\r
-\r
-help Undccdeny {\r
-       " If the EXACT file you type is found it is removed, else it uses wildcards to search";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax: UNDCCDENY <filename mask>";\r
-};\r
-\r
-help Sajoin {\r
-       " Forces a user to join a channel.";\r
-       " Services Admin Command";\r
-       " -";\r
-       " Syntax:  SAJOIN <nick> <channel>,[<channel2>..]";\r
-       " Example: SAJOIN hAtbLaDe #OperHelp";\r
-       "          SAJOIN hAtbLaDe #Support,#IRCHelp";\r
-};\r
-\r
-help Sapart {\r
-       " Forces a user to join a channel.";\r
-       " Services Admin Command";\r
-       " -";\r
-       " Syntax:  SAJOIN <nick> <channel>,[<channel2>..]";\r
-       " Example: SAJOIN hAtbLaDe #OperHelp";\r
-       "          SAJOIN hAtbLaDe #Support,#IRCHelp";\r
-};\r
-\r
-help Samode {\r
-       " Allows a Services Administrator to change the mode on a channel,";\r
-       " without having Operator status.";\r
-       " Services Admin Command";\r
-       " -";\r
-       " Syntax:  SAMODE <channel> <mode>";\r
-       " Example: SAMODE #Support +m";\r
-};\r
-\r
-help Rping {\r
-       " This will calculate the Lag (In milliseconds) between servers";\r
-       " -";\r
-       " Syntax: RPING <servermask>";\r
-};\r
-\r
-help Trace {\r
-       " TRACE is useful to know what servers are connected to what.";\r
-       " Sometimes TRACE can be confusing, especially if you are using";\r
-       " it for the first time.";\r
-       " -";\r
-       " Syntax:  TRACE <servername>";\r
-       " Example: TRACE irc.fyremoon.net";\r
-};\r
-\r
-help Opermotd {\r
-       " Shows the IRCd Operator MOTD";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax: OPERMOTD";\r
-};\r
-\r
-help Sdesc {\r
-       " With this command you can change your Server Info Line";\r
-       " Without having to squit and reconnect.";\r
-       " This is a Server Admin/Co Admin only command";\r
-       " -";\r
-       " Syntax:  SDESC <New description>";\r
-       " Example: SDESC Fly High, Fly Free";\r
-};\r
-\r
-help Mkpasswd {\r
-       " This command will Encrypt the string it has been given";\r
-       " So you can add it directly to the unrealircd.conf if you use";\r
-       " Encrypted passwords. Type can be crypt, sha1, or md5. Sha1";\r
-       " and md5 are only available when compiled with SSL support.";\r
-       " -";\r
-       " Syntax:  MKPASSWD <method> <password>";\r
-       " Example: MKPASSWD crypt mpsare";\r
-};\r
-\r
-help Tsctl {\r
-       " This is a highly advanced command used to Adjust the";\r
-       " Internal IRC clock.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax: TSCTL OFFSET +|- <time> (Adjust internal IRC clock)";\r
-       "         TSCTL TIME (Will give TS report)";\r
-       "         TSCTL ALLTIME (Shows the TS report of all server)";\r
-       "         TSCTL SVSTIME <timestamp> (Sets the Time on all Servers)";\r
-};\r
-\r
-help Htm {\r
-       " Switches the server In & Out of High Traffic Mode";\r
-       " HTM is activated when the server is receiving extremely high amounts of information.";\r
-       " IRC Operator only command.";\r
-       " -";\r
-       " Syntax: HTM [option]";\r
-       " -";\r
-       " If no option is specified it just displays the current HTM state";\r
-       " If an option is specified it does a more specific task, valid options are:";\r
-       " -";\r
-       " ON    - Force HTM to activate";\r
-       " OFF   - Force HTM to deactivate";\r
-       " NOISY - Make HTM announce when it is entering/leaving HTM";\r
-       " QUIET - Stop HTM from announcing when it is entering/leaving HTM";\r
-       " TO <value> - Tell HTM at what incoming rate to activate HTM";\r
-};\r
-\r
-help Svsnick {\r
-       " Changes the nickname of the user in question.";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  SVSNICK <nickname> <new nickname> <timestamp>";\r
-       " Example: SVSNICK hAtbLaDe Foobar 963086432";\r
-};\r
-\r
-help Svsmode {\r
-       " Changes the mode of the User in question.";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  SVSMODE <nickname> <usermode>";\r
-       " Example: SVSMODE hAtbLaDe +i";\r
-};\r
-\r
-help Svskill {\r
-       " Forcefully disconnects a user from the network.";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  SVSKILL <user> :<reason>";\r
-       " Example: SVSKILL Lamer21 :Goodbye";\r
-};\r
-\r
-help Svsnoop {\r
-       " Enables or disables whether Global IRCop functions";\r
-       " exist on the server in question or not.";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  SVSNOOP <server> <+/->";\r
-       " Example: SVSNOOP leaf.* -";\r
-};\r
-\r
-help Svsjoin {\r
-       " Forces a user to join a channel.";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  SVSJOIN <nick> <channel>[,<channel2>..]";\r
-       " Example: SVSJOIN hAtbLaDe #jail";\r
-       "          SVSJOIN hAtbLaDe #jail,#zoo";\r
-};\r
-\r
-help Svspart {\r
-       " Forces a user to leave a channel.";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  SVSPART <nick> <channel>[,<channel2>..]";\r
-       " Example: SVSPART hAtbLaDe #Hanson";\r
-       "          SVSPART hAtbLaDe #Hanson,#AOL";\r
-};\r
-\r
-help Svso {\r
-       " Gives nick Operflags like the ones in O:lines.";\r
-       " Remember to set SVSMODE +o and alike.";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  SVSO <nick> <+operflags> (Adds the Operflags)";\r
-       "          SVSO <nick> - (Removes all O:Line flags)";\r
-       " Example: SVSO SomeNick +bBkK";\r
-};\r
-\r
-help Swhois {\r
-       " Changes the WHOIS message of the Nickname.";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  SWHOIS <nick> :<message> (Sets the SWHOIS)";\r
-       "          SWHOIS <nick> :  (Resets the SWHOIS)";\r
-       " Example: SWHOIS SomeNick :is a lamer";\r
-};\r
-\r
-help Sqline {\r
-       " Bans a Nickname or a certain Nickname mask from the Server.";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  SQLINE <nickmask> :<Reason>";\r
-       " Example: SQLINE *Bot* :No bots";\r
-};\r
-\r
-help Unsqline {\r
-       " Un-Bans a Nickname or Nickname mask";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Synax:  UNSQLINE <nickmask>";\r
-       " Example: UNSQLINE *Bot*";\r
-};\r
-\r
-help Svs2mode {\r
-       " Changes the Usermode of a nickname";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax:  :services.somenet.com SVS2MODE <nickname> +<mode>";\r
-       " Example: :services.roxnet.org SVS2MODE hAtbLaDe +h";\r
-};\r
-\r
-help Svsfline {\r
-       " Adds the given Filename mask to DCCDENY";\r
-       " Must be sent through an U:Lined server.";\r
-       " -";\r
-       " Syntax: :server SVSFLINE + file :reason (Add the filename)";\r
-       "         :server SVSFLINE - file (Deletes the filename)";\r
-       "         :server SVSFLINE *      (Wipes the DCCDENY list)";\r
-};\r
-\r
-help Svsmotd {\r
-       "Changes the Services Message Of The Day";\r
-       "Must be sent through an U:Lined server.";\r
-       "Syntax:  SVSMOTD # :<text> (Adds to Services MOTD)";\r
-       "         SVSMOTD !         (Deletes the MOTD)";\r
-       "         SVSMOTD ! :<text> (Deletes and Adds text)";\r
-       "Example: SVSMOTD # :Services MOTD";\r
-};\r
+ */
+
+help {
+       " Server Commands Help.";
+       " Specify your Question after the /HELPOP command.";
+       " You will find all of the server commands and options";
+       " available for use.";
+       " If you need extra assistance please visit the server's";
+       " help channel or ask an available IRCop.";
+       " -";
+       " /HELPOP USERCMDS - To get the list of User Commands";
+       " /HELPOP OPERCMDS - To get the list of Oper Commands";
+       " /HELPOP SVSCMDS  - Commands sent via U:Lined Server (Services)";
+       " /HELPOP UMODES   - To get the list of User Modes";
+       " /HELPOP SNOMASKS - To get a list of Snomasks";
+       " /HELPOP CHMODES  - To get the list of Channel Modes";
+       " /HELPOP OFLAGS   - To see the list of O:line Flags";
+       " -";
+       " ==-------------------------oOo--------------------------==";
+};
+
+help Usercmds {
+       " Currently the following User commands are available.";
+       " Use /HELPOP <command name> to get more information about";
+       " a specific command.";
+       " -";
+       " ==-----------------oOo-----------------==";
+       " NICK WHOIS WHO WHOWAS NAMES";
+       " ISON JOIN PART MOTD RULES";
+       " LUSERS MAP QUIT PING VERSION";
+       " STATS LINKS ADMIN USERHOST TOPIC";
+       " INVITE KICK AWAY WATCH LIST";
+       " PRIVMSG NOTICE KNOCK SETNAME VHOST";
+       " MODE CREDITS LICENSE TIME SILENCE PONG";
+       " ==-----------------oOo-----------------==";
+};
+
+help Opercmds {
+       " This section gives the IRC Operator only commands.";
+       " Use /HELPOP <command name> to get more information about";
+       " a specific command.";
+       " -";
+       " ==----------------oOo---------------==";
+       " OPER WALLOPS GLOBOPS CHATOPS LOCOPS";
+       " ADCHAT NACHAT TECHAT KILL KLINE";
+       " ZLINE GLINE SHUN";
+       " GZLINE TKLINE TZLINE HTM TSCTL";
+       " AKILL RAKILL REHASH RESTART DIE";
+       " LAG SETHOST SETIDENT CHGHOST CHGIDENT";
+       " CHGNAME SQUIT CONNECT DCCDENY UNDCCDENY";
+       " SAJOIN SAPART SAMODE RPING TRACE";
+       " OPERMOTD SDESC MKPASSWD";
+       " ==----------------oOo---------------==";
+};
+
+help Svscmds {
+       " This section gives the commands that can be";
+       " sent via a U:Lined Server such as Services.";
+       " The command is typically sent as:";
+       " /MSG OPERSERV RAW :services <command>";
+       " Use /HELPOP <command name> to get more information about";
+       " a specific command.";
+       " -";
+       " ==-----------oOo-----------==";
+       " SVSNICK SVSMODE SVSKILL";
+       " SVSNOOP SVSJOIN SVSPART";
+       " SVSO SWHOIS SQLINE SVSNLINE";
+       " UNSQLINE SVS2MODE SVSFLINE";
+       " SVSMOTD SVSTIME SVSLUSERS";
+       " ==-----------oOo-----------==";
+};
+
+help Umodes {
+       " Here is a list of all the usermodes which are available for use.";
+       " -";
+       " ==---------------------------oOo---------------------------==";
+       " o = Global IRC Operator";
+       " O = Local IRC Operator";
+       " a = Is a Services Administrator";
+       " A = Is a Server Administrator";
+       " N = Is a Network Administrator";
+       " C = Is a Co Administrator";
+       " -";
+       " b = Can read & send to ChatOps";
+       " d = Makes it so you can not recieve channel PRIVMSGs (Deaf)";
+       " g = Can read & send to GlobOps, and LocOps";
+       " h = Available for Help (Help Operator)";
+       " i = Invisible (Not shown in /WHO searches)";
+       " q = Only U:lines can kick you (Services Admins only)";
+       " r = Identifies the nick as being Registered";
+       " s = Can listen to Server notices";
+       " t = Says that you are using a /VHOST";
+       " v = Receive infected DCC send rejection notices";
+       " w = Can listen to Wallop messages";
+       " x = Gives the user Hidden Hostname (security)";
+       " z = Marks the client as being on a Secure Connection (SSL)";
+       " B = Marks you as being a Bot";
+       " G = Filters out all Bad words in your messages with <censored>";
+       " H = Hide IRCop status in /WHO and /WHOIS. (IRC Operators only)";
+       " I = Invisible Join/Part. Makes you being hidden at channels";
+       " R = Allows you to only receive PRIVMSGs from registered (+r) users";
+       " S = For Services only. (Protects them)";
+       " V = Marks the client as a WebTV user";
+       " W = Lets you see when people do a /WHOIS on you (IRC Operators only)";
+       " ==---------------------------oOo---------------------------==";
+};
+
+help Snomasks {
+       " This section lists all of the snomasks available.";
+       " A snomask is used with usermode +s. They are an additional parameter.";
+       " For example, to set snomask +f you'd do:";
+       " /MODE mynick +s +f";
+       " You can remove individual snomasks or set -s to remove them all";
+       " -";
+       " ==-------------------------oOo-----------------------==";
+       " c = See's all Connects/Disconnects on local server";
+       " e = Can listen to Server Messages sent to +e users (Eyes)";
+       " f = Listen to Flood Alerts from server";
+       " j = See's Misc. Messages generated by the server";
+       " k = See's all the /KILL's which were executed";
+       " n = nick change notices";
+       " q = Lets you see notices when a user is rejected because of a Q:line";
+       " v = Lets you receive notice of /VHOST usages";
+       " F = Lets you recieve Far and Local connect notices";
+       " G = Lets you see TKL (G:line,Shun) noties";   
+       " ==-------------------------oOo------------------------==";
+};
+
+help Chmodes {
+       " This section lists all of the possible channel modes that may be used with /MODE";
+       " -";
+       " ==------------------------------oOo----------------------------==";
+       " v <nickname> = Gives Voice to the user (May talk if chan is +m)";
+       " h <nickname> = Gives HalfOp status to the user (Limited op access)";
+       " o <nickname> = Gives Operator status to the user";
+       " a <nickname> = Gives protection to the user (No kick/drop)";
+       " q <nickname> = Gives Owner status to the user";
+       " -";
+       " b <nick!ident@host> = Bans the nick!ident@host from the channel";
+       " c = Block messages containing mIRC color codes";
+       " e <nick!ident@host> = Overrides a ban for matching users";
+       " f [*]<lines>:<seconds> = Flood protection";
+       " (Users will be kicked after saying <lines> in <seconds> and banned if * is specified)";
+       " i = A user must be invited to join the channel";
+       " k <key> = Users must specify <key> to join";
+       " l <number of max users> = Channel may hold at most <number> of users";
+       " m = Moderated channel (only +vhoaq users may speak)";
+       " n = Users outside the channel can not send PRIVMSGs to the channel";
+       " p = Private channel";
+       " r = The channel is registered (services settable only)";
+       " s = Secret channel";
+       " t = Only +hoaq may change the topic";
+       " z = Only Clients on a Secure Connection (SSL) can join";
+       " A = Server/Net Admin only channel (Settable by Admins)";
+       " C = No CTCPs allowed in the channel";
+       " H = No +I users may join (Settable by Admins)";
+       " K = /KNOCK is not allowed";
+       " L <chan2> = Channel link (If +l is full, the next user will auto-join <chan2>)";
+       " N = No Nickname changes are permitted in the channel.";
+       " O = IRC Operator only channel (Settable by IRCops)";
+       " Q = No kicks allowed";
+       " R = Only registered (+r) users may join the channel";
+       " S = Strips mIRC color codes";
+       " V = /INVITE is not allowed";
+       " ==------------------------------oOo----------------------------==";
+};
+
+help Oflags {
+       " Here you will find the flags that can be placed inside of the O:Lines";
+       " -";
+       " ==----------------------oOo--------------------==";
+       " o = Local Operator";
+       " O = Global Operator";
+       " a = Gets +a on oper up. Is Services Administrator";
+       " A = Gets +A on oper up. Is Server Administrator";
+       " C = Gets +C on oper up. Is Co Administrator";
+       " N = Gets +N on oper up. Is Network Administrator";
+       " -";
+       " r = Access to /REHASH server";
+       " R = Access to /RESTART server";
+       " D = Access to /DIE server";
+       " h = Oper can send /HELPOPS - gets +h on oper up";
+       " g = Oper can send /GLOBOPS";
+       " w = Oper can send /WALLOPS";
+       " n = Oper can send Local Server Notices";
+       " G = Oper can send Global Server Notices";
+       " c = Access to do local /SQUITs and /CONNECTs";
+       " L = Access to do global /SQUITs and /CONNECTs";
+       " k = Access to do local /KILLs";
+       " K = Access to do global /KILLs";
+       " b = Oper can /KLINE users from server";
+       " t = Oper can /GKLINE users from server";
+       " B = Oper can remove Klines";
+       " z = Can add Z:Lines";
+       " Z = Can add global Z:Lines";
+       " t = Can use /GLINE";
+       " v = Can use OperOverride";
+       " H = Gets +x on oper up";
+       " W = Gets +W on oper up";
+       " ^ = Allows to use usermode +I";
+       " ==----------------------oOo--------------------==";
+};
+
+
+help Nick {
+       " Changes your \"Online Identity\" on a server.";
+       " All those in the channel you are in will be";
+       " alerted of your nickname change.";
+       " -";
+       " Syntax:  NICK <new nickname>";
+       " Example: NICK hAtbLaDe";
+};
+
+help Whois {
+       " Shows information about the user in question,";
+       " such as their \"Name\", channels they are";
+       " currently in, their hostmask, etc.";
+       " -";
+       " Syntax:  WHOIS <user>";
+       " Example: WHOIS hAtbLaDe";
+};
+
+help Who {
+       " Retrieves information about users";
+       " -";
+       " Syntax:";
+       " /WHO [+|-][acghmnsuCM] [args]";
+       " Flags are specified like channel modes, the flags cgmnsu all have arguments";
+       " Flags are set to a positive check by +, a negative check by -";
+       " The flags available:";
+       " Flag a: user is away";
+       " Flag c <channel>: user is on <channel>, no wildcards accepted";
+       " Flag g <gcos/realname>: user has string <gcos> in their GCOS,";
+       " wildcards accepted, oper only";
+       " Flag h <host>: user has string <host> in their hostname, wildcards are accepted";
+       " Flag m <usermodes>: user has <usermodes> set on them, only o/A/a for nonopers";
+       " Flag n <nick>: user has string <nick> in their nickname, wildcards accepted";
+       " Flag s <server>: user is on server <server>, wildcards not accepted";
+       " Flag u <user>: user has string <user> in their username, wildcards accepted";
+       " Behavior flags:";
+       " Flag C: show first visible channel user is in";
+       " Flag M: check for user in channels I am a member of";
+       " -";
+       " For backwards compatibility, /who 0 o still shows +o users";
+       " Example: WHO +m o";
+};
+
+help Whowas {
+       " Retrieves previous WHOIS information for users";
+       " no longer connected to the server.";
+       " -";
+       " Syntax:  WHOWAS <nickname>";
+       "  WHOWAS <nickname> <max number of replies>";
+       " Example: WHOWAS hAtbLaDe";
+};
+
+help Names {
+       " Provides a list of users on the specified channel.";
+       " -";
+       "Syntax:  NAMES <channel>";
+       "Example: NAMES #Support";
+};
+
+help Ison { 
+       " Used to determine if certain user(s) are";
+       " currently online based upon their nickname.";
+       " -";
+       " Syntax:  ISON <user> <user2> <user3> <user4>";
+       " Example: ISON hAtbLaDe Stskeeps OperServ AOLBot";
+};
+
+help Join { 
+       " Used to enter one or more channels on an IRC server.";
+       " All occupants of the channel will be notified of your arrival.";
+       " JOIN with 0 as a parameter makes you Part all channels.";
+       " If you specify one or more keys, they will be used to join a +k channel";
+       " -";
+       " Syntax:  JOIN <chan>,<chan2>,<chan3> <key1>,<key2>,<key3>";
+       "  JOIN 0 (Parts all channels)";
+       " Example: JOIN #Support";
+       "          JOIN #Lobby,#IRCd";
+       "          JOIN #IRCd,#Support,#main letmein,somepass,anotherpass";
+};
+
+help Part {
+       " Used to part (or leave) a channel you currently occupy.";
+       " All those in the channel will be notified of your departure.";
+       " If you specify a reason it will be displayed to the users on the channel";
+       " -";
+       " Syntax:  PART <chan>,<chan2>,<chan3>,<chan4> <reason>";
+       " Example: PART #Support";
+       "          PART #Lobby,#IRCd See ya later!";
+};
+
+help Motd {
+       " Displays the Message Of The Day of the IRC Server you are logged onto.";
+       " -";
+       " Syntax: MOTD";
+       "         MOTD <server>";
+};
+
+help Rules {
+       " Shows you the Rules of the Network.";
+       " -";
+       " Syntax: RULES";
+       "         RULES <server>";
+};
+
+help Lusers {
+       " Provides Local and Global user information";
+       " (Such as Current and Maximum user count).";
+       " -";
+       " Syntax: LUSERS";
+};
+
+help Map {
+       " Provides a graphical \"Network Map\" of the IRC network.";
+       " Mainly used for routing purposes.";
+       " -";
+       " Syntax: MAP";
+};
+
+help Quit {
+       " Disconnects you from the IRC server. Those in the";
+       " channels you occupy will be notified of your departure.";
+       " If you do not specify a reason, your nickname becomes the reason.";
+       " -";
+       " Syntax:  QUIT <reason>";
+       " Example: QUIT Leaving!";
+};
+
+help Ping {
+       " The PING command is used to test the presence of an active client or";
+       " server at the other end of the connection.  Servers send a PING";
+       " message at regular intervals if no other activity detected coming";
+       " from a connection.  If a connection fails to respond to a PING";
+       " message within a set amount of time, that connection is closed. A";
+       " PING message MAY be sent even if the connection is active.";
+       " Note that this is different from a CTCP PING command..";
+       " -";
+       " Syntax:  PING <server> <server2>";
+       " Example: PING irc.fyremoon.net";
+       "          PING hAtbLaDe";
+       "          PING hAtbLaDe irc2.dynam.ac";
+};
+
+help Pong {
+       " PONG message is a reply to PING message.  If parameter <server2> is";
+       " given, this message will be forwarded to given target.  The <server>";
+       " parameter is the name of the entity who has responded to PING message";
+       " and generated this message.";
+       " -";
+       " Syntax:  PONG <server> <server2>";
+       " Example: PONG irc.fyremoon.net irc2.dynam.ac";
+       "          (PONG message from irc.fyremoon.net to irc2.dynam.ac)";
+};
+
+help Version {
+       " Provides Version information of the IRCd software in usage.";
+       " -";
+       " Syntax: VERSION";
+       "         VERSION <server>";
+};
+
+help Stats {
+       " Provides certain Statistical information about the server";
+       " -";
+       " Syntax:  STATS <flags>";
+       " Example: STATS u";
+       " -";
+       " ==---------------------oOo---------------------==";
+       " b - Send the badwords list";
+       " C - Send the link block list";
+       " d - Send the deny link (auto) block list";
+       " D - Send the deny link (all) block list";
+       " e - Send the except socks block list";
+       " E - Send the except ban block list";
+       " F - Send the deny dcc block list";
+       " G - Report TKL information (G:lines/Shuns)";
+       " H - Send the link block list";
+       " I - Send the allow block list";
+       " K - Send the ban user/ban ip/except ban block list (Includes AKILLs)";
+       " L - Send Link information";
+       " m - Send the events list";
+       " M - Send list of how many times each command was used";
+       " n - Send the ban realname block list";
+       " N - Send network configuration list";
+       " O - Send the oper block list";
+       " q - Send the SQLINE list";
+       " Q - Send the ban nick block list";
+       " r - Send the channel deny/allow block list";
+       " s - Send the SCache and NS list";
+       " S - Send the dynamic configuration list";
+       " t - Send connection information";
+       " T - Send the tld block list";
+       " u - Send server uptime and connection count";
+       " U - Send the ulines block list";
+       " v - Send the deny version block list";
+       " V - Send the vhost block list";
+       " Y - Send the class block list";
+       " Z - Send memory usage information";
+       " ==---------------------oOo---------------------==";
+};
+
+help Links {
+       " Lists all of the servers currently linked to the network.";
+       " Only IRCops can see linked U:lined servers.";
+       " -";
+       " Syntax: LINKS";
+};
+
+help Admin {
+       " Provides Administrative information regarding the server.";
+       " -";
+       " Syntax: ADMIN";
+       "         ADMIN <server>";
+};
+
+help Userhost {
+       " Returns the userhost of the user in question.";
+       " Usually used by scripts or bots.";
+       " -";
+       " Syntax:  USERHOST <nickname>";
+       " Example: USERHOST hAtbLaDe";
+};
+
+help Topic {
+       " Sets/Changes the topic of the channel in question,";
+       " or just display the current Topic.";
+       " -";
+       " Syntax:  TOPIC <channel> (Displays the current topic)";
+       "          TOPIC <channel> <topic> (Changes topic)";
+       " Example: TOPIC #Operhelp";
+       "          TOPIC #Lobby Welcome to #Lobby!!";
+};
+
+help Invite {
+       " Sends a user an Invitation to join a particular channel.";
+       " You must be an Operator on the channel in order to";
+       " invite a user into it.";
+       " -";
+       " Syntax:  INVITE <user> <channel>";
+       " Example: INVITE hAtbLaDe #Support";
+};
+
+help Kick {
+       " Removes a user from a channel. Can only be used by Operators";
+       " or Half-Ops. If no reason is specified, your nickname becomes the reason.";
+       " -";
+       " Syntax:  KICK <channel>[,<channel2>..] <user>[,<user2>..] <reason>";
+       " Example: KICK #Lobby foobar Lamer..";
+       "          KICK #Lobby,#OperHelp Lamer23,Luser12 Lamers!";
+};
+
+help Away {
+       " Sets your online status to \"Away\".";
+       " -";
+       " Syntax:  AWAY <reason> (Sets you Away with the reason given)";
+       "          AWAY (Un-Sets you as Away)";
+       " Example: AWAY Lunch time!";
+};
+
+help Watch {
+       " Watch is a notify-type system on the server which is both faster";
+       " and uses less network resources than any old-style notify";
+       " system. The server will send you a message when any nickname";
+       " in your watch list logs on or off.";
+       " The watch list DOES NOT REMAIN BETWEEN SESSIONS - You (or your";
+       " script or client) must add the nicknames to your watch list every";
+       " time you connect to an IRC server.";
+       " -";
+       " Syntax: WATCH +nick1 +nick2 +nick3 (Add nicknames)";
+       "         WATCH -nick (Delete nicknames)";
+       "         WATCH (View the watchlist)";
+};
+
+help List {
+       " Provides a complete listing of all channels on the network.";
+       " If a search string is specified, it will only show those";
+       " matching the search string.";
+       " -";
+       " Syntax:  LIST <search string>";
+       " Example: LIST";
+       "          LIST *ircd*";
+       " -";
+       " Some additional flags are also supported.";
+       " >number  List channels with more than <number> people";
+       " <number  List channels with less than <number> people";
+       " !*mask*  List channels that do not match *mask*";
+       " -";
+       " Any of those may be used instead of a standard mask.";
+};
+
+help Privmsg {
+       " /PRIVMSG @#channel <text> will send the text to Channel-ops on the";
+       " given channel only.";
+       " /PRIVMSG @+#channel <text> will send the text to both ops and voiced";
+       " users on the channel.";
+       " While some clients may support these as-is,";
+       " on others (such as ircII), it's necessary to use";
+       " /QUOTE PRIVMSG @#channel <text> instead.";
+       " You can also use % to signify HalfOps on the channel.";
+       " -";
+       " Syntax:  PRIVMSG <nick>,<nick2>,<nick3>,<nick4> :<text>";
+       " Example: PRIVMSG hAtbLaDe :Hello";
+       "          PRIVMSG hAtbLaDe,Somefella,Lamer :Hello everyone!";
+       "          PRIVMSG @#hottub There is a meeting on Saturday.";
+};
+
+help Notice {
+       " /NOTICE @#channel <text> will send the text to Channel-ops on the";
+       " given channel only.";
+       " /NOTICE @+#channel <text> will send the text to both ops and voiced";
+       " users on the channel.";
+       " While some clients may support these as-is,";
+       " on others (such as ircII), it's necessary to use";
+       " /QUOTE NOTICE @#channel <text> instead.";
+       " You can also use % to signify HalfOps on the channel.";
+       " -";
+       " Syntax:  NOTICE <nick>,<nick2>,<nick3>,<nick4> :<text>";
+       " Example: NOTICE hAtbLaDe :Hello";
+       "          NOTICE hAtbLaDe,Somefella,Lamer :Hello everyone!";
+       "          NOTICE @#hottub Do not forget the meeting on Friday.";
+};
+
+help Knock {
+       " For channels which are invite only, you can \"Knock\" on the";
+       " channel to request an invite.";
+       " -";
+       " Syntax:  KNOCK <channel> <message>";
+       " Example: KNOCK #secret_chan I'm an op, let me in!";
+};
+
+help Setname {
+       " Allows users to change their \"Real name\" (GECOS)";
+       " directly online at IRC without reconnecting";
+       " -";
+       " Syntax: SETNAME <New Real Name>";
+};
+
+help Vhost {
+       " Hides your real hostname with a virtual hostname";
+       " provided by the IRC server , using SETHOST.";
+       " -";
+       " Synatx:  VHOST <login> <password>";
+       " Example: VHOST openbsd ilovecypto";
+};
+
+help Mode {
+       " Sets a mode on a Channel or User.";
+       " Use /HELPOP CHMODES or /HELPOP UMODES to see a list of Modes";
+       " -";
+       " Syntax:  MODE <channel/user> <mode>";
+       " Example: MODE #Support +tn";
+       "          MODE #Support +ootn hAtbLaDe XYZ";
+};
+
+help Credits {
+       " This command will list the Credits to all the people who";
+       " helped create UnrealIRCd.";
+       " -";
+       " Syntax: CREDITS";
+       "         CREDITS <server>";
+};
+
+help License {
+       " This command displays information about the license UnrealIRCd is released under.";
+       " Syntax: LICENSE";
+       "         LICENSE <server>";
+};
+
+help Time {
+       " Displays the current Server Date and Time.";
+       " -";
+       " Syntax : TIME";
+       "          TIME <server>";
+};
+
+help Silence {
+       " Ignores messages from a user or list of users at the Server itself.";
+       " -";
+       " Syntax: SILENCE +nickname (Adds a nickname to SILENCE list)";
+       "         SILENCE -nickname (Removes a nickname from the SILENCE list)";
+       "         SILENCE           (Lists the current SILENCE list)";
+};
+
+help Oper {
+       " Attempts to give a user IRC Operator status.";
+       " (Lets the IRCop opper up)";
+       " -";
+       " Syntax:  OPER <uid> <password>";
+       " Example: OPER hAtbLaDe foobar234";
+};
+
+help Wallops {
+       " Sends a \"Message\" to all those with the umode +w.";
+       " Only IRCops can send Wallops, while anyone with the mode +w";
+       " can view them.";
+       " -";
+       " Syntax: WALLOPS <message>";
+};
+
+help Globops {
+       " Sends a global \"Message\" to all IRCops. Only viewable by IRCops";
+       " (unlike WALLOPS, which can be viewed by normal users).";
+       " -";
+       " Syntax:  GLOBOPS <message>";
+       " Example: GLOBOPS Lets get em clones ..";
+};
+
+help Locops {
+       " Similar to GLOBOPS, except only received by those IRCops local to your server.";
+       " -";
+       " Syntax:  LOCOPS <message>";
+       " Example: LOCOPS Gonna k:line that user ...";
+};
+
+help Adchat {
+       " Sends a message to all online Admins";
+       " -";
+       " Syntax:  ADCHAT <text>";
+       " Example: ADCHAT Hey guys! I'm finally here.";
+};
+
+help Nachat {
+       " Sends a message to all online NetAdmins";
+       " -";
+       " Syntax:  NACHAT <text>";
+       " Example: NACHAT Hey guys! How is everything?";
+};
+
+help Kill {
+       " Forcefully Disconnects a user from an IRC Server.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  KILL <user> <reason>";
+       " Example: KILL Jack16 Cloning is not allowed";
+};
+
+help Kline {
+       " This command provides timed K:Lines. If you match a K:Line you cannot";
+       " connect to the server";
+       " A time of 0 in the KLINE makes it permanent (Never Expires).";
+       " You may also specify the time in the format 1d10h15m30s.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  KLINE <hostmask> [time] <reason> (adds a Kline)";
+       "          KLINE -<hostmask> (removes a Kline)";
+       " Example: KLINE *@*.aol.com Abuse (Adds a permanent K:line)";
+       "          KLINE *@*.someisp.com 2d Abuse (Adds a K:line for 2 days)";
+       "          KLINE -*@*.aol.com";
+};
+
+help Zline {
+       " This command provides timed Z:Lines. If you match a Z:Line you cannot";
+       " connect to the server";
+       " A time of 0 in the KLINE makes it permanent (Never Expires).";
+       " You may also specify the time in the format 1d10h15m30s.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  ZLINE <ipmask> [time] <reason> (adds a Zline)";
+       "          ZLINE -<ipmask> (removes a Zline)";
+       " Example: ZLINE *@127.0.0.1 Abuse (Adds a permanent Z:line)";
+       "          ZLINE *@127.0.0.1 2d Abuse (Adds a Z:line for 2 days)";
+       "          ZLINE -*@127.0.0.1";
+};
+
+help Gline {
+       " This command provides timed G:Lines. If you match a G:Line you cannot";
+       " connect to ANY server on the IRC network";
+       " A time of 0 in the GLINE makes it permanent (Never Expires).";
+       " You may also specify the time in the format 1d10h15m30s.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  GLINE <user@host mask> [time] :<reason>";
+       "  (Adds a G:line for user@host)";
+       "          GLINE -<user@host mask> (Removes a G:line for user@host)";
+       " Example: GLINE *@*.idiot.net 900 :Spammers (Adds a 15 min G:line)";
+       "          GLINE *@*.idiot.net 1d5h :Spammers (Adds a 29 hour G:line)";
+       "          GLINE -*@*.idiot.net";
+};
+
+help Shun {
+       " Prevents a user from executing ANY command except ADMIN";
+       " and respond to Server Pings.";
+       " A time of 0 in the SHUN makes it permanent (Never Expires).";
+       " You may also specify the time in the format 1d10h15m30s.";
+       " IRC Operator only command.";
+       " -");
+       " Syntax:  SHUN <nickname> <time> :<Reason> (Shun the nickname for time in seconds)";
+       "          SHUN +<user@host> <time> :<Reason>(Shun the user@host for time in seconds)";
+       "          SHUN -<user@host> (Removes the SHUN for user@host)";
+       "          SHUN (View the current SHUN list)";
+       " -";
+       " Example: SHUN +foobar@aol.com 600 :Spamming";
+       "  (Shuns foobar@aol.com for 10 mins for Spamming)";
+       "          SHUN +foobar@aol.com 1d6h :Spamming (Adds a 30 hour SHUN)";
+};
+
+help Gzline {
+       " This command provides timed global Z:line. If you match a Global Z:Line you cannot";
+       " connect to ANY server on the IRC network";
+       " A time of 0 in the GZLINE makes it permanent (Never Expires).";
+       " You may also specify the time in the format 1d10h15m30s.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  GZLINE <user@host mask> <seconds to be banned> :<reason>";
+       "  (Adds a Global Z:line for user@host)";
+       "          GZLINE -<user@host mask> (Removes a Global Z:line for user@host)";
+       " Example: GZLINE *@*.idiot.net 900 :Spammers (Adds a 15 min Global Z:line)";
+       "          GZLINE *@*.idiot.net 1d5h :Spammers (Adds a 29 hour Global Z:line)";
+};
+
+help Tkline {
+       " This command provides timed K:Lines. If you match a time K:Line you cannot";
+       " connect to the server until the time has expired";
+       " A time of 0 in the TKLINE makes it permanent (Never Expires).";
+       " You may also specify the time in the format 1d10h15m30s.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  TKLINE <user@host mask> <seconds to be banned> :<reason>";
+       "  (Adds a Timed K:line for user@host)";
+       "          TKLINE -<user@host mask> (Removes a Timed K:line for user@host)";
+       " Example: TKLINE *@*.idiot.net 900 :Spammers (Adds a 15 min Timed K:line)";
+       "          TKLINE *@*.idiot.net 1d5h :Spammers (Adds a 29 hour Timed K:line)";
+};
+
+help Tzline {
+       " This command provides timed Z:Lines. If you match a Timed Z:Line you cannot";
+       " connect to the server until the time has expired";
+       " A time of 0 in the TZLINE makes it permanent (Never Expires).";
+       " You may also specify the time in the format 1d10h15m30s.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  TZLINE <user@host mask> <seconds to be banned> :<reason>";
+       "  (Adds a Timed Z:line for user@host)";
+       "          TZLINE -<user@host mask> (Removes a Timed Z:line for user@host)";
+       " Example: TZLINE *@*.idiot.net 900 :Spammers (Adds a 15 min Timed Z:line)";
+       "          TZLINE *@*.idiot.net 1d5h :Spammers (Adds a 29 hour Timed Z:line)";
+};
+
+help Akill {
+       " Adds an Autokill for the specific host mask. This prevents";
+       " any user from that hostmask from connecting to the network.";
+       " Services Admin Command";
+       " -";
+       " Syntax:  AKILL <user@host> :<Reason>";
+       " Example: AKILL foo@aol.com :Spammers!";
+};
+
+help Rakill {
+       " Removes an AKILL set by a Services Admin.";
+       " Services Admin Command";
+       " -";
+       " Syntax: RAKILL <user@host>";
+};
+
+help Rehash {
+       " Prompts the server to reread the configuration files.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax: REHASH <servername> -<flags>";
+       "         REHASH -<flags>";
+       " -";
+       " If servername and flags are not specified this rehashes the";
+       " unrealircd.conf , removing any temporary k:lines.";
+       " If servername is specified, this is used to rehash config files on servername.";
+       " Only NetAdmins may specify a server name.";
+       " -";
+       " The flags are used to rehash other config files, valid flags are:";
+       "  -motd     - Rehashes all MOTD files and RULES files (including tld{})";
+       "  -opermotd - Rehashes the OPERMOTD";
+       "  -botmotd  - Rehashes the BOTMOTD";
+       "  -garbage  - Force garbage collection";
+};
+
+help Restart {
+       " Kills and Restarts the IRC daemon, disconnecting all users";
+       " currently on that server.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax: RESTART";
+       "         RESTART <password>";
+       "         RESTART <server> <password>";
+};
+
+help Die {
+       " Kills the IRC daemon, disconnecting all users currently on that server.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax: DIE";
+       "         DIE <password>";
+};
+
+help Lag {
+       " This command is like a Traceroute for IRC servers";
+       " You type in /LAG irc.fyremoon.net and it will";
+       " reply from every server it passes with time and so on";
+       " Useful for looking where lag is and optional TS future/past travels";
+       " -";
+       " Syntax: LAG <server>";
+};
+
+help Sethost {
+       " This command is so you can change your Virtual host (Vhost)";
+       " to anything you want, except special characters.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  SETHOST <new hostname>";
+       " Example: SETHOST i.have.hairy.armpits";
+};
+
+help Setident {
+       " With this command you can change your Ident (Username).";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  SETIDENT <new ident>";
+       " Example: SETIDENT l33t";
+};
+
+help Chghost {
+       " Changes the hostname of a user currently on the IRC network.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  CHGHOST <nick> <host>";
+       " Example: CHGHOST hAtbLaDe root.me.com";
+};
+
+help Chgident {
+       " Changes the Ident of a user currently on the IRC network.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  CHGIDENT <nick> <ident>";
+       " Example: CHGIDENT hAtbLaDe sheep";
+};
+
+help Chgname {
+       " Changes the \"IRC Name\" (or \"Real Name\") of a user currently on the IRC network.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  CHGNAME <nick> <name>";
+       " Example: CHGNAME hAtbLaDe Gotta new name :)";
+};
+
+help Squit {
+       " Disconnects an IRC Server from the network.";
+       " Usually used in routing of servers.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  SQUIT <server>";
+       " Example: SQUIT leaf.*";
+};
+
+help Connect {
+       " Links another IRC server to the one you are currently on.";
+       " Remote connections are also possible.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax:  CONNECT <server>";
+       "          CONNECT <hub> <port> <leaf>";
+       " Example: CONNECT leaf.*";
+       "          CONNECT hub.* 6667 leaf.*";
+};
+
+help Dccdeny {
+       " Adds a DCC Deny for that Filename mask. This means that any";
+       " DCC sends of Files matching that Filename mask will be rejected.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax: DCCDENY <filename mask> <reason>";
+};
+
+help Undccdeny {
+       " If the EXACT file you type is found it is removed, else it uses wildcards to search";
+       " IRC Operator only command.";
+       " -";
+       " Syntax: UNDCCDENY <filename mask>";
+};
+
+help Sajoin {
+       " Forces a user to join a channel.";
+       " Services Admin Command";
+       " -";
+       " Syntax:  SAJOIN <nick> <channel>,[<channel2>..]";
+       " Example: SAJOIN hAtbLaDe #OperHelp";
+       "          SAJOIN hAtbLaDe #Support,#IRCHelp";
+};
+
+help Sapart {
+       " Forces a user to join a channel.";
+       " Services Admin Command";
+       " -";
+       " Syntax:  SAJOIN <nick> <channel>,[<channel2>..]";
+       " Example: SAJOIN hAtbLaDe #OperHelp";
+       "          SAJOIN hAtbLaDe #Support,#IRCHelp";
+};
+
+help Samode {
+       " Allows a Services Administrator to change the mode on a channel,";
+       " without having Operator status.";
+       " Services Admin Command";
+       " -";
+       " Syntax:  SAMODE <channel> <mode>";
+       " Example: SAMODE #Support +m";
+};
+
+help Rping {
+       " This will calculate the Lag (In milliseconds) between servers";
+       " -";
+       " Syntax: RPING <servermask>";
+};
+
+help Trace {
+       " TRACE is useful to know what servers are connected to what.";
+       " Sometimes TRACE can be confusing, especially if you are using";
+       " it for the first time.";
+       " -";
+       " Syntax:  TRACE <servername>";
+       " Example: TRACE irc.fyremoon.net";
+};
+
+help Opermotd {
+       " Shows the IRCd Operator MOTD";
+       " IRC Operator only command.";
+       " -";
+       " Syntax: OPERMOTD";
+};
+
+help Sdesc {
+       " With this command you can change your Server Info Line";
+       " Without having to squit and reconnect.";
+       " This is a Server Admin/Co Admin only command";
+       " -";
+       " Syntax:  SDESC <New description>";
+       " Example: SDESC Fly High, Fly Free";
+};
+
+help Mkpasswd {
+       " This command will Encrypt the string it has been given";
+       " So you can add it directly to the unrealircd.conf if you use";
+       " Encrypted passwords. Type can be crypt, sha1, or md5. Sha1";
+       " and md5 are only available when compiled with SSL support.";
+       " -";
+       " Syntax:  MKPASSWD <method> <password>";
+       " Example: MKPASSWD crypt mpsare";
+};
+
+help Tsctl {
+       " This is a highly advanced command used to Adjust the";
+       " Internal IRC clock.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax: TSCTL OFFSET +|- <time> (Adjust internal IRC clock)";
+       "         TSCTL TIME (Will give TS report)";
+       "         TSCTL ALLTIME (Shows the TS report of all server)";
+       "         TSCTL SVSTIME <timestamp> (Sets the Time on all Servers)";
+};
+
+help Htm {
+       " Switches the server In & Out of High Traffic Mode";
+       " HTM is activated when the server is receiving extremely high amounts of information.";
+       " IRC Operator only command.";
+       " -";
+       " Syntax: HTM [option]";
+       " -";
+       " If no option is specified it just displays the current HTM state";
+       " If an option is specified it does a more specific task, valid options are:";
+       " -";
+       " ON    - Force HTM to activate";
+       " OFF   - Force HTM to deactivate";
+       " NOISY - Make HTM announce when it is entering/leaving HTM";
+       " QUIET - Stop HTM from announcing when it is entering/leaving HTM";
+       " TO <value> - Tell HTM at what incoming rate to activate HTM";
+};
+
+help Svsnick {
+       " Changes the nickname of the user in question.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SVSNICK <nickname> <new nickname> <timestamp>";
+       " Example: SVSNICK hAtbLaDe Foobar 963086432";
+};
+
+help Svsmode {
+       " Changes the mode of the User in question.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SVSMODE <nickname> <usermode>";
+       " Example: SVSMODE hAtbLaDe +i";
+};
+
+help Svskill {
+       " Forcefully disconnects a user from the network.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SVSKILL <user> :<reason>";
+       " Example: SVSKILL Lamer21 :Goodbye";
+};
+
+help Svsnoop {
+       " Enables or disables whether Global IRCop functions";
+       " exist on the server in question or not.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SVSNOOP <server> <+/->";
+       " Example: SVSNOOP leaf.* -";
+};
+
+help Svsjoin {
+       " Forces a user to join a channel.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SVSJOIN <nick> <channel>[,<channel2>..]";
+       " Example: SVSJOIN hAtbLaDe #jail";
+       "          SVSJOIN hAtbLaDe #jail,#zoo";
+};
+
+help Svspart {
+       " Forces a user to leave a channel.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SVSPART <nick> <channel>[,<channel2>..]";
+       " Example: SVSPART hAtbLaDe #Hanson";
+       "          SVSPART hAtbLaDe #Hanson,#AOL";
+};
+
+help Svso {
+       " Gives nick Operflags like the ones in O:lines.";
+       " Remember to set SVSMODE +o and alike.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SVSO <nick> <+operflags> (Adds the Operflags)";
+       "          SVSO <nick> - (Removes all O:Line flags)";
+       " Example: SVSO SomeNick +bBkK";
+};
+
+help Swhois {
+       " Changes the WHOIS message of the Nickname.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SWHOIS <nick> :<message> (Sets the SWHOIS)";
+       "          SWHOIS <nick> :  (Resets the SWHOIS)";
+       " Example: SWHOIS SomeNick :is a lamer";
+};
+
+help Sqline {
+       " Bans a Nickname or a certain Nickname mask from the Server.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SQLINE <nickmask> :<Reason>";
+       " Example: SQLINE *Bot* :No bots";
+};
+
+help Unsqline {
+       " Un-Bans a Nickname or Nickname mask";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Synax:  UNSQLINE <nickmask>";
+       " Example: UNSQLINE *Bot*";
+};
+
+help Svs2mode {
+       " Changes the Usermode of a nickname";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  :services.somenet.com SVS2MODE <nickname> +<mode>";
+       " Example: :services.roxnet.org SVS2MODE hAtbLaDe +h";
+};
+
+help Svsfline {
+       " Adds the given Filename mask to DCCDENY";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax: :server SVSFLINE + file :reason (Add the filename)";
+       "         :server SVSFLINE - file (Deletes the filename)";
+       "         :server SVSFLINE *      (Wipes the DCCDENY list)";
+};
+
+help Svsmotd {
+       "Changes the Services Message Of The Day";
+       "Must be sent through an U:Lined server.";
+       "Syntax:  SVSMOTD # :<text> (Adds to Services MOTD)";
+       "         SVSMOTD !         (Deletes the MOTD)";
+       "         SVSMOTD ! :<text> (Deletes and Adds text)";
+       "Example: SVSMOTD # :Services MOTD";
+};
+
+help Svsnline {
+       " Adds a global realname ban.";
+       " Must be sent through an U:Lined server.";
+       " The reason must be a single parameter therefore";
+       " spaces are indicated by _, Unreal will internally";
+       " translate these to spaces";
+       " -";
+       " Syntax:  SVSLUSERS <reason_for_ban> :<realname>";
+       " Example: SVSNICK sub7_drone :*sub7*";
+};
+
+help Svslusers {
+       " Changes the global and/or local maximum user count";
+       " for a server. If -1 is specified for either of the";
+       " values, the current value is kept.";
+       " Must be sent through an U:Lined server.";
+       " -";
+       " Syntax:  SVSLUSERS <server> <globalmax|-1> <localmax|-1>";
+       " Example: SVSLUSERS irc.test.com -1 200";
+};
+
index d8f9eb2ddbc935136fc1d31339e3189377283fb4..522590bb5729cfe9de39112a39e470a318613555 100644 (file)
@@ -28,13 +28,13 @@ typedef     struct {
 #define AUTHTYPE_UNIXCRYPT  1
 #define AUTHTYPE_MD5        2
 #define AUTHTYPE_SHA1      3 
-#define AUTHTYPE_SSL_PUBKEY 4
+#define AUTHTYPE_SSL_CLIENTCERT 4
 #define AUTHTYPE_RIPEMD160  5
 
 #ifdef USE_SSL
 #define AUTHENABLE_MD5
 #define AUTHENABLE_SHA1
-#define AUTHENABLE_SSL_PUBKEY
+#define AUTHENABLE_SSL_CLIENTCERT
 #define AUTHENABLE_RIPEMD160
 /* OpenSSL provides a crypt() */
 #ifndef AUTHENABLE_UNIXCRYPT
index c158d29e6d4e91181f52311baccc3e1e6c9ff302..c5e24853e7835699a707268410df60c86c674630 100644 (file)
  * If you start the server as root but wish to have it run as another user,
  * define IRC_UID to that UID.  This should only be defined if you are running
  * as root and even then perhaps not.
+ * use #define IRC_UID <uid>
+ * and #define IRC_GID <gid>
  */
-
-/*
- * Ok this one is being changed. it is advisable never to run anything that
- * uses sockets etc. and has the potential for the outside world to connect to it
- * to run as root... Hackers do things like buffer overruns, and get dumped on
- * a shell with root access effectivley ... so DONT do it.. if a program uses a
- * port <1024 it will run as root, once the program has binded to the socket it
- * will set its uid to something OTHER than root ... you set that in unrealircd.conf
- *
- * 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)
-/* Change This Line Below \/ */
-#define BIG_SECURITY_HOLE
-/* Its the one above ^^^^^^^ */
-#ifndef BIG_SECURITY_HOLE
-#define        IRC_UID un_uid
-#define        IRC_GID un_gid
-#endif
-#endif
+#undef IRC_UID
+#undef IRC_GID 
 
 /*
  * CLIENT_FLOOD
@@ -617,13 +601,9 @@ error You stuffed up config.h signals
 # 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.
 #    endif
-#  endif
 #else
      error CLIENT_FLOOD undefined
 #endif
index b74e73caa2286b00f992bca30918e758bc4809bd..af341c1387e9c128a931936e54261915c939d3b0 100644 (file)
@@ -76,6 +76,8 @@ struct zConfiguration {
 #ifdef USE_SSL
        char *x_server_cert_pem;
        char *x_server_key_pem;
+       char *trusted_ca_file;
+       long ssl_options;
 #endif
        aNetwork network;
 };
@@ -129,4 +131,5 @@ extern aConfiguration iConf;
 #define CLOAK_KEY2                     iConf.network.key2
 #define CLOAK_KEY3                     iConf.network.key3
 #define CLOAK_KEYCRC                   iConf.network.keycrc
-#define STATIC_QUIT                    iConf.static_quit
\ No newline at end of file
+#define STATIC_QUIT                    iConf.static_quit
+
index ec462dea3ce4671137afe53c9b4b9f983dabdc50..faabf39b74b4b9c24cecf02f5c566756c0343b89 100644 (file)
@@ -93,8 +93,6 @@ extern ConfigItem_deny_link   *conf_deny_link;
 extern ConfigItem_allow_channel *conf_allow_channel;
 extern ConfigItem_deny_version *conf_deny_version;
 extern ConfigItem_log          *conf_log;
-extern ConfigItem_unknown      *conf_unknown;
-extern ConfigItem_unknown_ext   *conf_unknown_set;
 extern ConfigItem_alias                *conf_alias;
 extern ConfigItem_include      *conf_include;
 extern ConfigItem_help         *conf_help;
@@ -107,6 +105,7 @@ extern long set_usermode(char *umode);
 extern char *get_modestr(long umodes);
 extern void tkl_stats(aClient *cptr);
 extern void                    config_error(char *format, ...);
+extern int                     config_verbose;
 extern void config_progress(char *format, ...);
 extern void       ipport_seperate(char *string, char **ip, char **port);
 ConfigItem_class       *Find_class(char *name);
@@ -271,14 +270,16 @@ extern void sendto_channels_inviso_part(aClient *user);
 extern void sendto_channels_inviso_join(aClient *user);
 extern void    sendto_message_one(aClient *to, aClient *from, char *sender,
     char *cmd, char *nick, char *msg);
+#define PREFIX_ALL             0
+#define PREFIX_HALFOP  0x1
+#define PREFIX_VOICE   0x2
+#define PREFIX_OP              0x4
+extern void sendto_channelprefix_butone(aClient *one, aClient *from, aChannel *chptr,
+    int prefix, char *pattern, ...);
 extern void sendto_channelprefix_butone_tok(aClient *one, aClient *from, aChannel *chptr,
     int prefix, char *cmd, char *tok, char *nick, char *text);
 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_serv_butone(aClient *, char *, ...);
 extern void sendto_serv_butone_quit(aClient *, char *, ...);
 extern void sendto_serv_butone_sjoin(aClient *, char *, ...);
@@ -467,6 +468,8 @@ extern void    add_CommandX(char *cmd, char *token, int (*func)(), unsigned char
 
 /* CRULE */
 char *crule_parse(char *);
+int crule_test(char *);
+char *crule_errstring(int);
 int crule_eval(char *);
 void crule_free(char **);
 
@@ -486,9 +489,11 @@ extern int b64_decode(char const *src, unsigned char *target, size_t targsize);
 
 extern int             Auth_FindType(char *type);
 extern anAuthStruct    *Auth_ConvertConf2AuthStruct(ConfigEntry *ce);
-extern void    Auth_DeleteAuthStruct(anAuthStruct *as);
-extern int     Auth_Check(aClient *cptr, anAuthStruct *as, char *para);
-extern char   *Auth_Make(short type, char *para);
+extern void            Auth_DeleteAuthStruct(anAuthStruct *as);
+extern int             Auth_Check(aClient *cptr, anAuthStruct *as, char *para);
+extern char            *Auth_Make(short type, char *para);
+extern int             Auth_CheckError(ConfigEntry *ce);
+
 extern long xbase64dec(char *b64);
 extern aClient *find_server_b64_or_real(char *name);
 extern aClient *find_server_by_base64(char *b64);
@@ -519,7 +524,7 @@ extern u_long cres_mem(aClient *sptr, char *nick);
 extern void      flag_add(char *ch);
 extern void      flag_del(char ch);
 extern void init_dynconf(void);
-extern int        init_conf2(char *filename);
+extern int        init_conf(char *filename, int rehash);
 extern void       validate_configuration(void);
 extern void       run_configuration(void);
 extern aMotd *read_file(char *filename, aMotd **list);
@@ -532,5 +537,11 @@ extern void set_sock_opts(int fd, aClient *cptr);
 extern void iCstrip(char *line);
 extern time_t rfc2time(char *s);
 extern char *rfctime(time_t t, char *buf);
+extern void *MyMallocEx(size_t size);
+#ifdef USE_SSL
+char  *ssl_get_cipher(SSL *ssl);
+#endif
+long config_checkval(char *value, unsigned short flags);
+void config_status(char *format, ...);
 #define EVENT_DRUGS BASE_VERSION
 
index 70a942c47b226127d93550f5c79c932d98f1b072..f0e7c186b92a45ff636f42f25b00ccd863e7c7ea 100644 (file)
@@ -210,7 +210,10 @@ extern Hooktype            Hooktypes[MAXCUSTOMHOOKS];
 extern Hook            *global_i;
 
 void    Module_Init(void);
-char    *Module_Load(char *path, int load);
+char    *Module_Create(char *path);
+void    Init_all_testing_modules(void);
+void    Unload_all_loaded_modules(void);
+void    Unload_all_testing_modules(void);
 int     Module_Unload(char *name, int unload);
 vFP     Module_Sym(char *name);
 vFP     Module_SymX(char *name, Module **mptr);
@@ -248,7 +251,7 @@ void CommandDel(Command *command);
 #define HOOKTYPE_LOCAL_NICKCHANGE 2
 #define HOOKTYPE_LOCAL_CONNECT 3
 #define HOOKTYPE_SCAN_INFO 5    /* Taken care of in scan.c */
-#define HOOKTYPE_CONFIG_UNKNOWN 6
+#define HOOKTYPE_CONFIGPOSTTEST 6
 #define HOOKTYPE_REHASH 7
 #define HOOKTYPE_PRE_LOCAL_CONNECT 8
 #define HOOKTYPE_HTTPD_URL 9
@@ -257,12 +260,25 @@ void CommandDel(Command *command);
 #define HOOKTYPE_SERVER_QUIT 12
 #define HOOKTYPE_STATS 13
 #define HOOKTYPE_LOCAL_JOIN 14
+#define HOOKTYPE_CONFIGTEST 15
+#define HOOKTYPE_CONFIGRUN 16
 /* Module flags */
 #define MODFLAG_NONE   0x0000
-#define MODFLAG_LOADED 0x0001 /* (mod_load has been called and suceeded) */
+#define MODFLAG_LOADED 0x0001 /* Fully loaded */
+#define MODFLAG_TESTING 0x0002 /* Not yet initialized */
+#define MODFLAG_INIT   0x0004 /* Initialized */
+#define MODFLAG_DELAYED 0x0008 /* Delayed unload */
 
 /* Module function return values */
 #define MOD_SUCCESS 0
 #define MOD_FAILED -1
 #define MOD_DELAY 2
+
+#define CONFIG_MAIN 1
+#define CONFIG_SET 2
+#define CONFIG_BAN 3
+#define CONFIG_EXCEPT 4
+#define CONFIG_DENY 5
+#define CONFIG_ALLOW 6
+
 #endif
index 5fad0c8258cd34ff749257af0a5a784f2aea4b43..439bc9e28dd7278aaf9b4d77bf1ecb7431fba9d2 100644 (file)
@@ -54,6 +54,7 @@
 #include <openssl/ssl.h>
 #include <openssl/err.h>    
 #include <openssl/evp.h>
+#include <openssl/rand.h>
 #endif
 #include "auth.h" 
 extern int sendanyways;
@@ -497,7 +498,7 @@ typedef unsigned int u_int32_t;     /* XXX Hope this works! */
 #define OFLAG_HIDE      0x04000000     /* gets auto +x on oper up */
 #define OFLAG_TKL       0x10000000     /* can use G:lines and shuns */
 #define OFLAG_GZL       0x20000000     /* can use global Z:lines */
-#define OFLAG_WMASTER  0x40000000
+#define OFLAG_OVERRIDE 0x40000000      /* can use oper-override */
 #define OFLAG_INVISIBLE 0x80000000
 #define OFLAG_LOCAL    (OFLAG_REHASH|OFLAG_HELPOP|OFLAG_GLOBOP|OFLAG_WALLOP|OFLAG_LOCOP|OFLAG_LROUTE|OFLAG_LKILL|OFLAG_KLINE|OFLAG_UNKLINE|OFLAG_LNOTICE)
 #define OFLAG_GLOBAL   (OFLAG_LOCAL|OFLAG_GROUTE|OFLAG_GKILL|OFLAG_GNOTICE)
@@ -506,6 +507,7 @@ typedef unsigned int u_int32_t;     /* XXX Hope this works! */
 #define OFLAG_ADMIN_   (OFLAG_ADMIN | OFLAG_GLOBAL)
 #define OFLAG_SADMIN_  (OFLAG_SADMIN | OFLAG_GLOBAL)
 
+#define OPCanOverride(x) ((x)->oflag & OFLAG_OVERRIDE)
 #define OPCanTKL(x)    ((x)->oflag & OFLAG_TKL)
 #define OPCanGZL(x)    ((x)->oflag & OFLAG_GZL)
 #define OPCanZline(x)   ((x)->oflag & OFLAG_ZLINE)
@@ -732,6 +734,9 @@ extern short         Usermode_highest;
 #define CONNECT_AUTO           0x000004
 #define CONNECT_QUARANTINE     0x000008
 
+#define SSLFLAG_FAILIFNOCERT   0x1
+#define SSLFLAG_VERIFYCERT     0x2
+#define SSLFLAG_DONOTACCEPTSELFSIGNED 0x4
 struct Client {
        struct Client *next, *prev, *hnext;
        anUser *user;           /* ...defined, if this is a User */
@@ -959,13 +964,14 @@ struct _configitem_listen {
        char            *ip;
        int             port;
        long            options, clients;
+       aClient         *listener;
 };
 
 struct _configitem_vhost {
        ConfigItem      *prev, *next;
        ConfigFlag      flag;
        ConfigItem       *from;
-       char            *login, *virthost, *virtuser;
+       char            *login, *virthost, *virtuser, *swhois;
        anAuthStruct    *auth;
 };
 
@@ -1077,7 +1083,8 @@ struct _configitem_alias {
 struct _configitem_alias_format {
        ConfigItem *prev, *next;
        ConfigFlag flag;
-       ConfigItem_alias *alias;
+       char *nick;
+       short type;
        char *format, *parameters;
 };
        
@@ -1360,7 +1367,7 @@ struct liststruct {
 #ifdef CLEAN_COMPILE
 #define TStime() (time(NULL) + TSoffset)
 #else
-#define TStime() (0, timeofday == 0 ? (timeofday = time(NULL) + TSoffset) : timeofday)
+#define TStime() (timeofday == 0 ? (timeofday = time(NULL) + TSoffset) : timeofday)
 #endif
 
 /* Lifted somewhat from Undernet code --Rak */
index 0d6ab1d780992bb883d765bc058437b86e80bf89..b71d939980586ea91e7ec85f4b0fa480f0cf132c 100644 (file)
@@ -141,11 +141,6 @@ extern char OSName[256];
 #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
-};
-
 # 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
@@ -212,6 +207,7 @@ static const struct in6_addr in6addr_any = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 #define P_EWOULDBLOCK   EWOULDBLOCK
 #define P_EAGAIN        EAGAIN
 #define P_EINPROGRESS   EINPROGRESS
+#define P_EWORKING             EINPROGRESS
 #define P_EINTR         EINTR
 #define P_ETIMEDOUT     ETIMEDOUT
 #define P_ENOTSOCK     ENOTSOCK
@@ -232,6 +228,7 @@ static const struct in6_addr in6addr_any = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 #define P_EWOULDBLOCK   WSAEWOULDBLOCK
 #define P_EAGAIN        WSAEWOULDBLOCK
 #define P_EINPROGRESS   WSAEINPROGRESS
+#define P_EWORKING             WSAEWOULDBLOCK
 #define P_EINTR         WSAEINTR
 #define P_ETIMEDOUT     WSAETIMEDOUT
 #define P_ENOTSOCK     WSAENOTSOCK
index 8d929081b5a120ca126bd23da8b2daf10c749f00..05eb9286c7e74a50e882df54f5c3a357f9152b00 100644 (file)
 #include <pthread.h>
 typedef pthread_t THREAD;
 typedef pthread_mutex_t MUTEX;
+#define IRCCreateThreadEx(thread, start, arg, id) TDebug(CreateThread); pthread_create(&thread, NULL, (void*)start, arg)
 #define IRCCreateThread(thread, start, arg) TDebug(CreateThread); pthread_create(&thread, NULL, (void*)start, arg)
 #define IRCMutexLock(mutex) TDebug(MutexLock); pthread_mutex_lock(&mutex)
 #define IRCMutexTryLock(mutex) TDebug(MutexTryLock); pthread_mutex_trylock(&mutex);
 #define IRCMutexUnlock(mutex) TDebug(MutexUnlcok); pthread_mutex_unlock(&mutex)
 #define IRCCreateMutex(mutex) TDebug(CreateMutex); pthread_mutex_init(&mutex, NULL)
 #define IRCMutexDestroy(mutex) TDebug(MutexDestroy); pthread_mutex_destroy(&mutex)
-#define IRCJoinThread(thread,return) TDebug(JoinThread); pthread_join(thread, return)
+#define IRCJoinThread(thread,ppvalue) TDebug(JoinThread); pthread_join(thread, (void **)ppvalue)
+#define IRCExitThreadEx(value) TDebug(ExitThread); pthread_exit(value)
 #define IRCExitThread(value) TDebug(ExitThread); pthread_exit(value)
 #define IRCDetachThread(value) TDebug(DetachThread); pthread_detach(value);
 #define IRCTerminateThread(thread, value) pthread_cancel(&thread)
 #define IRCThreadSelf() pthread_self()
 #define IRCThreadEqual(thread1, thread2) pthread_equal(thread1,thread2)
 #else
-typedef unsigned long THREAD;
+typedef HANDLE THREAD;
 typedef HANDLE MUTEX;
+typedef unsigned (__stdcall *PTHREAD_START) (void *);
+#define IRCCreateThreadEx(thread, start, arg, id) thread = (THREAD)_beginthreadex(NULL, 0, (PTHREAD_START)start, arg, 0, id)
 #define IRCCreateThread(thread, start, arg) thread = _beginthread((void *)start, 0, arg)
 #define IRCMutexLock(mutex) WaitForSingleObject(mutex, INFINITE)
 #define IRCMutexTryLock(mutex) WaitForSingleObject(mutex, 0)
 #define IRCMutexUnlock(mutex) ReleaseMutex(mutex)
 #define IRCCreateMutex(mutex) mutex = CreateMutex(NULL, FALSE, NULL)
 #define IRCMutexDestroy(mutex) CloseHandle(mutex)
-#define IRCJoinThread(thread,return) WaitForSingleObject((HANDLE)thread, INFINITE); GetExitCodeThread((HANDLE)thread, (DWORD)return);
+#define IRCJoinThread(thread,pdwRc) { WaitForSingleObject((HANDLE)thread, INFINITE); GetExitCodeThread((HANDLE)thread, pdwRc); CloseHandle((HANDLE)thread); }
+#define IRCExitThreadEx(value) _endthreadex((unsigned int)value)
 #define IRCExitThread(value) _endthread()
 #define IRCTerminateThread(thread, value) TerminateThread((HANDLE)thread, value)
 #define IRCThreadSelf() GetCurrentThread()
index 348af5cd91bc8d29ef31d520335d7658218adbb0..6c92893de634e9763ac2623bbb7ae4871f20c3bf 100644 (file)
      /**/
 #define COMPILEINFO DEBUGMODESET DEBUGSET
 /*
- * Version Unreal3.2-Selene
+ * Version Unreal3.2
  */
 #define UnrealProtocol                 2303
 #define PATCH1                 "3"
 #define PATCH2                 ".2"
-#define PATCH3                 "-Selene"
-#define PATCH4                 "[beta12]"
+#define PATCH3                 "-beta13"
+#define PATCH4                 ""
 #define PATCH5                 ""
 #define PATCH6                 ""
 #define PATCH7                 ""
diff --git a/makeconf b/makeconf
deleted file mode 100755 (executable)
index f478c00..0000000
--- a/makeconf
+++ /dev/null
@@ -1,610 +0,0 @@
-#!/bin/sh
-# $Id$
-# Defaults
-#
-TIME=`date +"%H:%M:%S %Z"`
-DATE=`date +"%a, %b %e %Y"`
-IRCDCONF="unrealircd.conf"
-SERVNAME="Server.IRC.net"
-COMMENT="IRC server!"
-ADMIN="Admin-name"
-ADMNICK="Admin"
-ADMADDR="admin@no.where.com"
-OPERNAME="admin"
-OPERADDR="*@*"
-OPERPASS="password"
-NUMERIC=""
-PORT="6667"
-OPRT="default"
-LINKPASS="linkpass"
-VIRTUAL="1.2.3.4"
-ENCRYPT="Yes"
-FLAGS="OAZHWe"
-RESTARTPASS="restartpass"
-DIEPASS="diepass"
-SERVICES="Services.IRC-Net.Org"
-
-# these are so I can use stuff like $1 without it replacing it...like by
-# using $dlrsgn$uno for $1
-dlrsgn="$"
-uno="1"
-dos="2"
-
-# remove the temp file if it exists
-rm -f mkconf.tmp
-
-# make a quick script for replacing one line with another
-
-cat > repl_str << __EOF__
-sed -e "s@^$dlrsgn$uno\(.*\)@$dlrsgn$dos" $IRCDCONF > mkconf.tmp
-cp mkconf.tmp $IRCDCONF
-rm mkconf.tmp
-__EOF__
-
-# mark repl_str as an executable
-chmod +x repl_str
-rm -f repl_str
-# 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
-
-# we use a modified mkpasswd credit to Nelson Minar (minar@reed.edu)
-# for creating the original mkpasswd
-if test "x$CRYPT_OPER_PASSWORD" != "x" -o "x$CRYPT_LINK_PASSWORD" != "x" -o "x$CRYPT_XLINE_PASSWORD" != "x" ; then
-               cat > crypter.tmp.c << __EOF__
-                       #include <stdlib.h>
-                       #include <stdio.h>
-                       int main(int argc, char *argv[])
-                       {
-                               static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
-                               char salt[3];
-                               char *plaintext;
-                               srandom(time(0));
-                               salt[0] = saltChars[random() % 64];
-                               salt[1] = saltChars[random() % 64];
-                               salt[2] = 0;
-                               plaintext = argv[1];
-                               printf("%s", crypt(plaintext, salt));
-                       }
-__EOF__
-               cc crypter.tmp.c -o crypter.tmp -lcrypt
-               rm crypter.tmp.c                
-fi
-
-CONF=$IRCDCONF
-
-if [ -r "$CONF" ]; then
-       echo "$IRCDCONF found"
-       echo " "
-       echo "   I don't suggest running this with the conf file already"
-       echo "existing, since you will lose all the data in your conf file."
-       echo "This script is just for creating one. If you want to recreate"
-       echo "a conf file, type 'recreate'."
-       echo $n " [exit] -> $c"
-       read cc
-
-       if [ "$cc" != "recreate" ]; then
-               echo " "
-               echo "   OK, do you want to edit $IRCDCONF using an editor?"
-               echo "If so, specify the editor you want to use. Otherwise,"
-               echo "type 'exit'."
-               EDITFND="not found"
-
-                if [ -r /usr/bin/pico ]; then
-                        EDITFND="pico"
-                fi
-
-                if [ -r /usr/bin/joe ]; then
-                        EDITFND="joe"
-                fi
-
-               if [ -r /usr/bin/vi ]; then
-                       EDITFND="vi"
-               fi
-
-               if [ -r /usr/bin/vim ]; then
-                       EDITFND="vim"
-               fi
-
-               while [ "c" = "c" ]; do
-                       echo $n " [$EDITFND] -> $c"
-                       read EDITOR
-
-                       if [ -z "$EDITOR" ]; then
-                               EDITOR="$EDITFND"
-                       fi
-
-                       if [ "$EDITOR" = "exit" ]; then
-                               echo "Have a nice day."
-                               exit 1
-                       fi
-
-                       if [ -f $EDITOR ]; then
-                               $EDITOR $CONF
-                               exit 1
-                       fi
-
-                       if [ -f /usr/bin/$EDITOR ]; then
-                               /usr/bin/$EDITOR $CONF
-                               exit 1
-                       fi
-
-                       echo "   Editor not found. Specify a valid editor or"
-                       echo "type 'exit' to quit this script."
-               done
-
-       fi
-
-       mv $CONF "$CONF.saved"
-       rm $CONF
-       echo "$IRCDCONF has been renamed to ircd.conf.saved"
-else
-       echo "$IRCDCONF is not found. (good)"
-fi
-
-clear
-echo "|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|"
-echo "| Welcome to the $IRCDCONF generator. |"
-echo "|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|"
-echo " "
-echo "What will your server name be? (ie: $SERVNAME)"
-echo $n " [$SERVNAME] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       SERVNAME="$cc"
-fi
-
-echo " "
-echo "What is your IRC server's IP? (ie: $VIRTUAL)"
-echo "Use * to bind to all interfaces"
-echo $n " [$VIRTUAL] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-        VIRTUAL="$cc"
-fi
-
-echo " "
-echo "Server comment? (ie: Main Hub Server)"
-echo $n " [$COMMENT] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       COMMENT="$cc"
-fi
-
-echo " "
-echo "Main port? (ie: 6667)"
-echo $n " [$PORT] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       PORT="$cc"
-fi
-
-echo " "
-echo "What server numeric does the server have (range = 1..256)"
-echo "Must NOT be the same as other servers you link with"
-echo $n " [] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       NUMERIC="$cc"
-fi
-
-echo " "
-echo "What is your real name? (ie: John Doe)"
-echo $n " [$ADMIN] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       ADMIN="$cc"
-fi
-
-echo " "
-echo "What is your IRC nickname? (ie: JD)"
-echo $n " [$ADMNICK] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       ADMNICK="$cc"
-fi
-
-echo " "
-echo "What is your e-mail address? (ie: john@doe.com)"
-echo $n " [$ADMADDR] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       ADMADDR="$cc"
-fi
-
-echo " "
-OPERNAME="$ADMNICK"
-echo "What will your opername be for your O:line? (ie: johndoe)"
-echo $n " [$OPERNAME] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       OPERNAME="$cc"
-fi
-
-echo " "
-echo "What oper flags do you want to have? (ie: OAWZ)"
-echo "Some flags to choose from:"
-echo "  o = local oper"
-echo "  O = global oper"
-echo "  N = network administrator"
-echo "  A = server administrator"
-echo "  C = co administrator"
-echo "  read unrealircd.doc for more info about O:line flags)"
-echo $n " [$FLAGS] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       FLAGS="$cc"
-fi
-#Don't ask if they use encrypted oper passes, we can tell if they do
-
-echo " "
-echo "What will your /oper password be? (ie: snoopy67)"
-echo $n " [$OPERPASS] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-               OPERPASS="$cc"
-fi
-
-if [ "$CRYPT_OPER_PASSWORD" != "" ]; then
-       OPERPASS=`./crypter.tmp $OPERPASS`
-fi
-
-echo " "
-echo "What is your user@host mask on IRC? (ie: *@*.toronto.globalserve.net)"
-echo $n " [$OPERADDR] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-       OPERADDR="$cc"
-fi
-
-echo " "
-echo "What do you want your die password to be?"
-echo $n " [$DIEPASS] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-        DIEPASS="$cc"
-fi
-
-if [ "$CRYPT_XLINE_PASSWORD" != "" ]; then
-       DIEPASS=`./crypter.tmp $cc`
-fi
-
-echo " "
-echo "What do you want your restart password to be?"
-echo $n " [$RESTARTPASS] -> $c"
-read cc
-if [ ! -z "$cc" ]; then
-               RESTARTPASS="$cc"
-fi
-if [ "$CRYPT_XLINE_PASSWORD" != "" ]; then
-       RESTARTPASS=`./crypter.tmp $cc`
-fi
-echo " "
-echo "If your running services, or linking to a network that has"
-echo "services, please state the services servername."
-echo "If you are running a non-services network, just type 'next'"
-echo $n " [$SERVICES] -> $c"
-read cc
-
-#if [ ! -z "$cc" ]; then
-#        SERVICES="$cc"
-#fi
-
-if [ "$cc" = "next" ]; then
-        SERVICES="No.Services.Selected"
-elif [ ! -z "$cc" ]; then
-        SERVICES="$cc"
-fi
-
-cat > $CONF << __EOF__
-/*
- *
- * Filename:  $IRCDCONF
- * Created:  $DATE - $TIME
- *
- */
-
-/* Server Info */
-me {
-       name $SERVNAME;
-       info "$COMMENT";
-__EOF__
-if [ $NUMERIC != "" ]; then
-       echo "  numeric $NUMERIC;" >> $CONF
-fi
-cat >> $CONF << __EOF__
-};
-
-/* Admin Info */
-admin {
-       "$ADMIN";
-       "$ADMNICK";
-       "$ADMADDR";
-};
-
-/* Classes */
-class clients {
-       pingfreq 90;
-       maxclients 245;
-       sendq 100000;
-};
-
-class servers {
-       pingfreq 300;
-       connfreq 600;
-       maxclients 5;
-       sendq 1000000;
-};
-
-/* Allow info */
-allow {
-       ip "*@*";
-       hostname "*@*";
-       class clients;
-};
-
-/* Die/Restart Password */
-drpass {
-       die "$DIEPASS";
-       restart "$RESTARTPASS";
-};
-
-oper $OPERNAME {
-       from {
-               userhost $OPERADDR;
-       };
-       password "$OPERPASS";
-       flags $FLAGS;
-       class clients;
-};
-
-__EOF__
-
-echo "/* Links */" >> $CONF
-echo " "
-echo "   Would you like to configure any servers for linking?"
-echo "Type the servername, or type 'done' when finished."
-echo $n " [done] -> $c"
-read cc
-
-if [ -z "$cc" ]; then
-       cc="done"
-fi
-
-while [ "$cc" != "done" ]; do
-       THESERV="$cc"
-
-       SHOST="none"
-       while [ "$SHOST" = "none" ]; do
-               echo " "
-               echo "Hostname or ip for the other server? Must be specified."
-               echo $n " [] -> $c"
-               read SHOST
-       done    
-
-       echo " "
-       echo "Password to send to the other server?"
-       echo $n " [$LINKPASS] -> $c"
-       read CLP
-       if [ -z "$CLP" ]; then
-                       CLP="$LINKPASS"
-       fi
-       if [ "$CRYPT_LINK_PASSWORD" != "" ]; then
-               CLP=`./crypter.tmp $cc`
-       fi
-
-       echo " "
-       AUTOPORT=""
-       AUTOCONN="bad"
-       while [ "$AUTOCONN" = "bad" ]; do
-               echo " "
-               echo "Should we autconnect to this server?"
-               echo $n " [Yes] -> $c"
-               read cc
-               if [ -z "$cc" ]; then
-                       cc="Yes"
-               fi
-               case "$cc" in
-                       [Yy]*)
-                               AUTOCONN="yes"
-                               echo "What port should we autoconnect to?"
-                               echo $n " [$PORT] -> $c"
-                               read AUTOPORT
-                               if [ -z "$AUTOPORT" ]; then
-                                       AUTOPORT="$PORT"
-                               fi
-                               ;;
-                       [Nn]*)
-                               AUTOCONN="no"
-                               ;;
-                       *)
-                               echo "Please specify yes or no."
-                               AUTOCONN="bad"
-                               ;;
-               esac
-       done
-
-       echo " "
-       HUB="bad"
-       while [ "$HUB" = "bad" ]; do
-               echo " "
-               echo "Will this server be a hub?"
-               echo $n " [Yes] -> $c"
-               read cc
-               if [ -z "$cc" ]; then
-                       cc="Yes"
-               fi
-               case "$cc" in
-                       [Yy]*)
-                               HUB="Yes"
-                               ;;
-                       [Nn]*)
-                               HUB="no"
-                               ;;
-                       *)
-                               echo "Please specify yes or no."
-                               HUB="bad"
-                               ;;
-               esac
-       done
-
-       echo "link $THESERV {" >> $CONF
-       USER=`echo $SHOST |sed -e 's/\(.*\)@.*/\1/'`
-       HOST=`echo $SHOST |sed -e 's/.*@\(.*\)/\1/'`
-       if [ "$USER" = "$SHOST" ]; then
-               echo "  username *;" >> $CONF
-               echo "  hostname $SHOST;" >> $CONF
-       else
-               echo "  username $USER;" >> $CONF
-               echo "  hostname $HOST;" >> $CONF
-       fi
-               
-       echo "  bind-ip *;" >> $CONF
-       if [ "$AUTOPORT" != "" ]; then
-               echo "  port $AUTOPORT;" >> $CONF
-       else
-               echo "  port $PORT;" >> $CONF
-       fi
-       echo "  password-connect \"$CLP\";" >> $CONF
-       echo "  password-receive \"$CLP\";" >> $CONF
-       echo "  class servers;" >> $CONF
-       if [ "$HUB" = "Yes" ]; then
-               echo "  hub *;" >> $CONF
-       else
-               echo "  leaf *;" >> $CONF
-       fi
-       if [ "$AUTOCONN" != "no" ]; then
-               echo "  options {" >> $CONF
-               echo "          autoconnect;" >> $CONF
-               echo "  };" >> $CONF
-       fi
-       echo "};" >> $CONF
-       echo " " >> $CONF
-       echo " "
-       echo "Type the servername, or type 'done' when finished."
-       echo $n " [done] -> $c"
-       read cc
-       if [ -z "$cc" ]; then
-               cc="done"
-       fi
-done
-
-cat >> $CONF << __EOF__
-/* Ulines */
-ulines {
-       $SERVICES;
-};
-
-/* Banned nick names */
-ban nick { mask "*C*h*a*n*S*e*r*v*"; reason "Reserved for services"; };
-ban nick { mask "*N*i*c*k*S*e*r*v*"; reason "Reserved for services"; };
-ban nick { mask "*M*e*m*o*S*e*r*v*"; reason "Reserved for services"; };
-ban nick { mask "*H*e*l*p*S*e*r*v*"; reason "Reserved for services"; };
-ban nick { mask "*O*p*e*r*S*e*r*v*"; reason "Reserved for services"; };
-ban nick { mask "*I*n*f*o*S*e*r*v*"; reason "Reserved for services"; };
-ban nick { mask "*Admin*"; reason "Reserved for Administrator"; };
-ban nick { mask "*IRC*op*"; reason "Reserved for ircops"; };
-ban nick { mask "*Oper*"; reason "Reserved for ircops"; };
-ban nick { mask "Status"; reason "Bug in mIRC"; };
-
-/*
- * Include files
- */
-include "badwords.channel.conf";
-include "badwords.message.conf";
-include "help.conf";
-/*
- * Some modules;
-*/
-loadmodule "src/modules/commands.so";
-loadmodule "src/modules/scan.so";
-loadmodule "src/modules/scan_socks.so";
-loadmodule "src/modules/scan_http.so";
-/* Ports */
-listen $VIRTUAL:$PORT;
-__EOF__
-
-cc="blank"
-echo " "
-echo " "
-echo "   Would you like any extra ports, other than 6667? Enter them here."
-echo "Type 'done' when you are finished. Type 'default' to use 6665-6669/7000."
-while [ "$cc" != "done" ]; do
-       echo $n " [$OPRT] -> $c"
-       read cc
-       if [ -z "$cc" ]; then
-               cc="$OPRT"
-       fi
-       if [ "$cc" = "default" ]; then
-               echo "listen $VIRTUAL:6660;" >> $CONF
-               echo "listen $VIRTUAL:6661;" >> $CONF
-               echo "listen $VIRTUAL:6662;" >> $CONF
-               echo "listen $VIRTUAL:6663;" >> $CONF
-               echo "listen $VIRTUAL:6664;" >> $CONF
-                echo "listen $VIRTUAL:6665;" >> $CONF
-                echo "listen $VIRTUAL:6666;" >> $CONF
-                echo "listen $VIRTUAL:6668;" >> $CONF
-                echo "listen $VIRTUAL:6669;" >> $CONF
-                echo "listen $VIRTUAL:7000;" >> $CONF
-               cc="done"
-       fi
-       if [ "$cc" != "done" ]; then
-               if [ $cc = "$PORT" ]; then
-                       echo "  No, $PORT is already in use"
-                       echo "please use a port other than $PORT."
-               else
-                       echo "listen $VIRTUAL:$cc;" >> $CONF
-               fi
-       fi
-       case "$OPRT" in
-               6660) OPRT="done"
-                       ;;
-               6661) OPRT="6660"
-                       ;;
-               6662) OPRT="6661"
-                       ;;
-               6663) OPRT="6662"
-                       ;;
-               6664) OPRT="6663"
-                       ;;
-               6665) OPRT="6664"
-                       ;;
-               6666) OPRT="6665"
-                       ;;
-               6669) OPRT="6666"
-                       ;;
-               6668) OPRT="6669"
-                       ;;
-               6667) OPRT="6668"
-                       ;;
-               *) OPRT="done"
-                       ;;
-       esac
-done
-
-# Make it so ONLY the one who created the conf can read or write.
-chmod 700 $IRCDCONF
-
-cat << __EOF__
-
-
-    OK, $IRCDCONF has been generated according to what you specified.
-Make sure you double check for errors in $IRCDCONF. We recommend that
-you take a look at your $IRCDCONF right now. Thanks for using UnrealIRCd
-
-__EOF__
-               rm -f crypter.tmp
-               echo "Have a nice day."
-               echo "[Press enter to continue]"
-               read cc
-               more .CONFIG.RANT
-               echo "[Press enter when you have read all of this]"
-               read cc
-               echo ""
-               exit 1
index 262abfbbbf7d6ef35192ba768149b995f01164e2..fc1aa7fafc61857ba788e7e53013a32a51ca2359 100644 (file)
@@ -8,11 +8,11 @@ RC=rc
 DEBUG=1
 FD_SETSIZE=/D SCAN_API=1 /D FD_SETSIZE=16384
 !IFNDEF DEBUG 
-CFLAGS=/MT /O2 /G5 /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D STATIC_LINKING /D _WIN32GUI /D NOSPOOF=1 /c
+CFLAGS=/MT /J /O2 /G5 /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D STATIC_LINKING /D _WIN32GUI /D NOSPOOF=1 /c
 LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib ws2_32.lib advapi32.lib dbghelp.lib \
  oldnames.lib libcmt.lib comctl32.lib comdlg32.lib /nodefaultlib /nologo /out:WIRCD.EXE
 !ELSE
-CFLAGS=  /MTd /Zi /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D STATIC_LINKING /D _WIN32GUI /D NOSPOOF=1 /c
+CFLAGS=/MTd /J /Zi /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D STATIC_LINKING /D _WIN32GUI /D NOSPOOF=1 /c
 LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib wsock32.lib dbghelp.lib\
  oldnames.lib libcmt.lib comctl32.lib comdlg32.lib \
  advapi32.lib /nodefaultlib /nologo /debug /debugtype:BOTH /OUT:WIRCD.EXE 
@@ -42,12 +42,13 @@ MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OB
  SRC/M_SVSNLINE.OBJ SRC/M_WHO.OBJ SRC/M_SWHOIS.OBJ SRC/M_SVSMODE.OBJ \
  SRC/M_AWAY.OBJ SRC/M_SVSNOOP.OBJ SRC/M_MKPASSWD.OBJ SRC/M_SVSO.OBJ SRC/M_SVSNICK.OBJ \
  SRC/M_ADMINCHAT.OBJ SRC/M_AKILL.OBJ SRC/M_CHGNAME.OBJ SRC/M_GUEST.OBJ SRC/M_HTM.OBJ \
- SRC/M_KLINE.OBJ SRC/M_LAG.OBJ SRC/M_MESSAGE.OBJ SRC/M_NACHAT.OBJ SRC/M_OPER.OBJ \
+ SRC/M_LAG.OBJ SRC/M_MESSAGE.OBJ SRC/M_NACHAT.OBJ SRC/M_OPER.OBJ \
  SRC/M_PINGPONG.OBJ SRC/M_QUIT.OBJ SRC/M_RAKILL.OBJ SRC/M_RPING.OBJ SRC/M_SENDUMODE.OBJ \
  SRC/M_SQLINE.OBJ SRC/M_KILL.OBJ SRC/M_TSCTL.OBJ SRC/M_UNKLINE.OBJ \
- SRC/M_UNSQLINE.OBJ SRC/M_UNZLINE.OBJ SRC/M_WHOIS.OBJ SRC/M_ZLINE.OBJ \
+ SRC/M_UNSQLINE.OBJ SRC/M_UNZLINE.OBJ SRC/M_WHOIS.OBJ \
  SRC/SCAN.OBJ SRC/SCAN_SOCKS.OBJ SRC/SCAN_HTTP.OBJ SRC/M_TKL.OBJ SRC/M_VHOST.OBJ \
- SRC/M_CYCLE.OBJ SRC/M_SVSJOIN.OBJ SRC/M_SVSPART.OBJ SRC/INVISIBILITY.OBJ
+ SRC/M_CYCLE.OBJ SRC/M_SVSJOIN.OBJ SRC/M_SVSPART.OBJ SRC/M_SVSLUSERS.OBJ \
+ SRC/INVISIBILITY.OBJ
 
 ALL: CONF UNREAL.EXE WIRCD.EXE
 
@@ -302,9 +303,6 @@ src/m_htm.obj: src/modules/m_htm.c $(INCLUDES)
 src/m_kill.obj: src/modules/m_kill.c $(INCLUDES)
        $(CC) $(CFLAGS) src/modules/m_kill.c
 
-src/m_kline.obj: src/modules/m_kline.c $(INCLUDES)
-       $(CC) $(CFLAGS) src/modules/m_kline.c
-
 src/m_lag.obj: src/modules/m_lag.c $(INCLUDES)
        $(CC) $(CFLAGS) src/modules/m_lag.c
 
@@ -350,9 +348,6 @@ src/m_unzline.obj: src/modules/m_unzline.c $(INCLUDES)
 src/m_whois.obj: src/modules/m_whois.c $(INCLUDES)
        $(CC) $(CFLAGS) src/modules/m_whois.c
 
-src/m_zline.obj: src/modules/m_zline.c $(INCLUDES)
-       $(CC) $(CFLAGS) src/modules/m_zline.c
-
 src/m_vhost.obj: src/modules/m_vhost.c $(INCLUDES)
         $(CC) $(CFLAGS) src/modules/m_vhost.c
 
@@ -365,6 +360,9 @@ src/m_svsjoin.obj: src/modules/m_svsjoin.c $(INCLUDES)
 src/m_svspart.obj: src/modules/m_svspart.c $(INCLUDES)
         $(CC) $(CFLAGS) src/modules/m_svspart.c
 
+src/m_svslusers.obj: src/modules/m_svslusers.c $(INCLUDES)
+       $(CC) $(CFLAGS) src/modules/m_svslusers.c
+
 src/scan.obj: src/modules/scan.c $(INCLUDES)
         $(CC) $(CFLAGS) src/modules/scan.c
 
index e0d58c9da482335842034a63d23434dc08bfd8aa..58fe6bfe71a639ff050807184368f478e49db8c3 100644 (file)
@@ -45,12 +45,13 @@ MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OB
  SRC/M_SVSNLINE.OBJ SRC/M_WHO.OBJ SRC/M_SWHOIS.OBJ SRC/M_SVSMODE.OBJ \
  SRC/M_AWAY.OBJ SRC/M_SVSNOOP.OBJ SRC/M_MKPASSWD.OBJ SRC/M_SVSO.OBJ SRC/M_SVSNICK.OBJ \
  SRC/M_ADMINCHAT.OBJ SRC/M_AKILL.OBJ SRC/M_CHGNAME.OBJ SRC/M_GUEST.OBJ SRC/M_HTM.OBJ \
- SRC/M_KLINE.OBJ SRC/M_LAG.OBJ SRC/M_MESSAGE.OBJ SRC/M_NACHAT.OBJ SRC/M_OPER.OBJ \
+ SRC/M_LAG.OBJ SRC/M_MESSAGE.OBJ SRC/M_NACHAT.OBJ SRC/M_OPER.OBJ \
  SRC/M_PINGPONG.OBJ SRC/M_QUIT.OBJ SRC/M_RAKILL.OBJ SRC/M_RPING.OBJ SRC/M_SENDUMODE.OBJ \
  SRC/M_SQLINE.OBJ SRC/M_KILL.OBJ SRC/M_TSCTL.OBJ SRC/M_UNKLINE.OBJ \
- SRC/M_UNSQLINE.OBJ SRC/M_UNZLINE.OBJ SRC/M_WHOIS.OBJ SRC/M_ZLINE.OBJ \
+ SRC/M_UNSQLINE.OBJ SRC/M_UNZLINE.OBJ SRC/M_WHOIS.OBJ \
  SRC/SCAN.OBJ SRC/SCAN_SOCKS.OBJ SRC/SCAN_HTTP.OBJ SRC/M_TKL.OBJ SRC/M_VHOST.OBJ \
- SRC/M_CYCLE.OBJ SRC/M_SVSJOIN.OBJ SRC/M_SVSPART.OBJ SRC/INVISIBILITY.OBJ
+ SRC/M_CYCLE.OBJ SRC/M_SVSJOIN.OBJ SRC/M_SVSPART.OBJ SRC/M_SVSLUSERS.OBJ \
+ SRC/INVISIBILITY.OBJ
 
 ALL: CONF UNREAL.EXE WIRCD.EXE
 
@@ -305,9 +306,6 @@ src/m_htm.obj: src/modules/m_htm.c $(INCLUDES)
 src/m_kill.obj: src/modules/m_kill.c $(INCLUDES)
        $(CC) $(CFLAGS) src/modules/m_kill.c
 
-src/m_kline.obj: src/modules/m_kline.c $(INCLUDES)
-       $(CC) $(CFLAGS) src/modules/m_kline.c
-
 src/m_lag.obj: src/modules/m_lag.c $(INCLUDES)
        $(CC) $(CFLAGS) src/modules/m_lag.c
 
@@ -353,9 +351,6 @@ src/m_unzline.obj: src/modules/m_unzline.c $(INCLUDES)
 src/m_whois.obj: src/modules/m_whois.c $(INCLUDES)
        $(CC) $(CFLAGS) src/modules/m_whois.c
 
-src/m_zline.obj: src/modules/m_zline.c $(INCLUDES)
-       $(CC) $(CFLAGS) src/modules/m_zline.c
-
 src/m_vhost.obj: src/modules/m_vhost.c $(INCLUDES)
         $(CC) $(CFLAGS) src/modules/m_vhost.c
 
@@ -368,6 +363,9 @@ src/m_svsjoin.obj: src/modules/m_svsjoin.c $(INCLUDES)
 src/m_svspart.obj: src/modules/m_svspart.c $(INCLUDES)
         $(CC) $(CFLAGS) src/modules/m_svspart.c
 
+src/m_svslusers.obj: src/modules/m_svslusers.c $(INCLUDES)
+       $(CC) $(CFLAGS) src/modules/m_svslusers.c
+
 src/scan.obj: src/modules/scan.c $(INCLUDES)
         $(CC) $(CFLAGS) src/modules/scan.c
 
index 6e082b612b5a70710a5a97b06f98fa88d1b8e2a6..fb669db6b3ab97a269abb5a1b6a6b287ffdc47a1 100644 (file)
@@ -22,7 +22,6 @@ set {
                coadmin         "coadmin.ircsystems.net";
                admin           "admin.ircsystems.net";
                servicesadmin   "csops.ircsystems.net";
-               techadmin       "techadmin.ircsystems.net";
                netadmin        "netadmin.ircsystems.net";
                host-on-oper-up "off";
        };
index 1396a19a7d0cf74aee867e29dc7141268468c207..48f83c7afaa89fffe78047e8d51aa0b2a8a15c64 100755 (executable)
@@ -21,7 +21,6 @@ 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"
@@ -156,14 +155,6 @@ 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"
@@ -237,7 +228,6 @@ set {
                coadmin         "$COADMIN_HOST";
                admin           "$ADMIN_HOST";
                servicesadmin   "$CSOP_HOST";
-               techadmin       "$TECHADMIN_HOST";
                netadmin        "$NETADMIN_HOST";
 __EOF__
 if [ "$INAH" = "1" ]; then
@@ -250,42 +240,6 @@ echo "     };" >> $FILE
 echo "};" >> $FILE
 __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 ""
-               echo "" >> ../unrealircd.conf
-               echo "// Added by makenet $DATE" >> ../unrealircd.conf
-               echo "include \"networks/$FILE\";" >> ../unrealircd.conf
-               echo "All done. I have added \"include \"networks/$FILE\ to your unrealircd.conf"
-               echo "You might want to edit it if you have done makenet before"
-               echo "Thank you for choosing UnrealIRCd"
-               exit
-               ;;
-       *)
-               ;;
-       esac
-
-if [ "$NETWORK" == "My IRC Network" ] ; then
-echo ""
-echo "You may not submit a network file that uses default values"
-exit
-fi
-
-cat |sendmail -t << __EOF__&
-To: unreal-networks@lists.sourceforge.net
-From: $EMAIL
-Subject: Network file submission for $NETWORK
-
-`cat $FILE`
-.
-__EOF__
 echo ""
 echo "" >> ../unrealircd.conf
 echo "// Added by makenet $DATE" >> ../unrealircd.conf
index 3dd52e434b44e2559bc2a481ceb00a187623a0df..00ca3a11a35509a87cef69397713ad105c15daf9 100644 (file)
@@ -52,8 +52,8 @@ anAuthStruct AuthTypes[] = {
 #ifdef AUTHENABLE_SHA1
        {"sha1",        AUTHTYPE_SHA1},
 #endif
-#ifdef AUTHENABLE_SSL_PUBKEY
-       {"sslpubkey",   AUTHTYPE_SSL_PUBKEY},
+#ifdef AUTHENABLE_SSL_CLIENTCERT
+       {"sslclientcert",   AUTHTYPE_SSL_CLIENTCERT},
 #endif
 #ifdef AUTHENABLE_RIPEMD160
        {"ripemd160",   AUTHTYPE_RIPEMD160},
@@ -81,11 +81,20 @@ int         Auth_FindType(char *type)
  * } 
 */
 
-anAuthStruct   *Auth_ConvertConf2AuthStruct(ConfigEntry *ce)
+int            Auth_CheckError(ConfigEntry *ce)
 {
        short           type = AUTHTYPE_PLAINTEXT;
-       anAuthStruct    *as = NULL;
-       /* If there is a {}, use it */
+#ifdef AUTHENABLE_SSL_CLIENTCERT
+       X509 *x509_filecert = NULL;
+       FILE *x509_f = NULL;
+#endif
+       if (!ce->ce_vardata)
+       {
+               config_error("%s:%i: authentication module failure: missing parameter",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                       ce->ce_entries->ce_varname);
+               return -1;
+       }
        if (ce->ce_entries)
        {
                if (ce->ce_entries->ce_varname)
@@ -96,16 +105,58 @@ anAuthStruct       *Auth_ConvertConf2AuthStruct(ConfigEntry *ce)
                                config_error("%s:%i: authentication module failure: %s is not an implemented/enabled authentication method",
                                        ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
                                        ce->ce_entries->ce_varname);
-                               return NULL;
+                               return -1;
+                       }
+                       switch (type)
+                       {
+#ifdef AUTHENABLE_UNIXCRYPT
+                               case AUTHTYPE_UNIXCRYPT:
+                                       /* If our data is like 1 or none, we just let em through .. */
+                                       if (strlen(ce->ce_vardata) < 2)
+                                       {
+                                               config_error("%s:%i: authentication module failure: AUTHTYPE_UNIXCRYPT: no salt (crypt strings will always be >2 in length)",
+                                                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+                                               return -1;
+                                       }
+                                       break;
+#endif
+#ifdef AUTHENABLE_SSL_CLIENTCERT
+                               case AUTHTYPE_SSL_CLIENTCERT:
+                                       if (!(x509_f = fopen(ce->ce_vardata, "r")))
+                                       {
+                                               config_error("%s:%i: authentication module failure: AUTHTYPE_SSL_CLIENTCERT: error opening file %s: %s",
+                                                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata, strerror(errno));
+                                               return -1;
+                                       }
+                                       x509_filecert = PEM_read_X509(x509_f, NULL, NULL, NULL);
+                                       fclose(x509_f);
+                                       if (!x509_filecert)
+                                       {
+                                               config_error("%s:%i: authentication module failure: AUTHTYPE_SSL_CLIENTCERT: PEM_read_X509 errored in file %s (format error?)",
+                                                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                                               return -1;
+                                       }
+                                       X509_free(x509_filecert);
+                                       break;
+#endif
+                               default: ;
                        }
                }
        }
-       if (!ce->ce_vardata)
+       return 1;       
+}
+
+anAuthStruct   *Auth_ConvertConf2AuthStruct(ConfigEntry *ce)
+{
+       short           type = AUTHTYPE_PLAINTEXT;
+       anAuthStruct    *as = NULL;
+       /* If there is a {}, use it */
+       if (ce->ce_entries)
        {
-               config_error("%s:%i: authentication module failure: missing parameter",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                       ce->ce_entries->ce_varname);
-               return NULL;
+               if (ce->ce_entries->ce_varname)
+               {
+                       type = Auth_FindType(ce->ce_entries->ce_varname);
+               }
        }
        as = (anAuthStruct *) MyMalloc(sizeof(anAuthStruct));
        as->data = strdup(ce->ce_vardata);
@@ -145,11 +196,10 @@ int       Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
         int            i;
 #endif
 
-#ifdef AUTHENABLE_SSL_PUBKEY
-       EVP_PKEY *evp_pkey = NULL;
-       EVP_PKEY *evp_pkeyfile = NULL;
-       X509 *x509_client = NULL;
-       FILE *key_file = NULL;
+#ifdef AUTHENABLE_SSL_CLIENTCERT
+       X509 *x509_clientcert = NULL;
+       X509 *x509_filecert = NULL;
+       FILE *x509_f = NULL;
 #endif
        if (!as)
                return 1;
@@ -200,7 +250,8 @@ int Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
                                HCRYPTHASH hHash;
                                char buf2[512];
                                DWORD size = 512;
-                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
+                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
+                                   CRYPT_VERIFYCONTEXT))
                                        return -1;
                                if (!CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash))
                                        return -1;
@@ -243,7 +294,8 @@ int Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
                                HCRYPTHASH hHash;
                                char buf2[512];
                                DWORD size = 512;
-                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
+                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
+                                    CRYPT_VERIFYCONTEXT))
                                        return -1;
                                if (!CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash))
                                        return -1;
@@ -279,43 +331,35 @@ int       Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
                                return -1;
                        break;
 #endif
-#ifdef AUTHENABLE_SSL_PUBKEY
-               case AUTHTYPE_SSL_PUBKEY:
+#ifdef AUTHENABLE_SSL_CLIENTCERT
+               case AUTHTYPE_SSL_CLIENTCERT:
                        if (!para)
                                return -1;
                        if (!cptr->ssl)
                                return -1;
-                       x509_client = SSL_get_peer_certificate((SSL *)cptr->ssl);
-                       if (!x509_client)
+                       x509_clientcert = SSL_get_peer_certificate((SSL *)cptr->ssl);
+                       if (!x509_clientcert)
                                return -1;
-                       evp_pkey = X509_get_pubkey(x509_client);
-                       if (!(key_file = fopen(para, "r")))
+                       if (!(x509_f = fopen(as->data, "r")))
                        {
-                               EVP_PKEY_free(evp_pkey);
-                               X509_free(x509_client);
+                               X509_free(x509_clientcert);
                                return -1;
                        }
-                       evp_pkeyfile = PEM_read_PUBKEY(key_file, NULL,
-                               NULL, NULL);
-                       if (!evp_pkeyfile)
+                       x509_filecert = PEM_read_X509(x509_f, NULL, NULL, NULL);
+                       fclose(x509_f);
+                       if (!x509_filecert)
                        {
-                               fclose(key_file);
-                               EVP_PKEY_free(evp_pkey);
-                               X509_free(x509_client);
+                               X509_free(x509_clientcert);
                                return -1;
                        }
-                       if (!(EVP_PKEY_cmp_parameters(evp_pkeyfile, evp_pkey)))
+                       if (X509_cmp(x509_filecert, x509_clientcert) != 0)
                        {
-                               fclose(key_file);
-                               EVP_PKEY_free(evp_pkey);
-                               EVP_PKEY_free(evp_pkeyfile);
-                               X509_free(x509_client);
-                               return -1;
+                               X509_free(x509_clientcert);
+                               X509_free(x509_filecert);
+                               break;
                        }
-                       fclose(key_file);
-                       EVP_PKEY_free(evp_pkey);
-                       EVP_PKEY_free(evp_pkeyfile);
-                       X509_free(x509_client);
+                       X509_free(x509_clientcert);
+                       X509_free(x509_filecert);
                        return 2;       
 #endif
        }
@@ -371,7 +415,8 @@ char        *Auth_Make(short type, char *para)
                                HCRYPTPROV hProv;
                                HCRYPTHASH hHash;
                                DWORD size = 512;
-                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
+                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 
+                                    CRYPT_VERIFYCONTEXT))
                                        return NULL;
                                if (!CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash))
                                        return NULL;
@@ -405,7 +450,8 @@ char        *Auth_Make(short type, char *para)
                                HCRYPTPROV hProv;
                                HCRYPTHASH hHash;
                                DWORD size = 512;
-                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
+                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
+                                    CRYPT_VERIFYCONTEXT))
                                        return NULL;
                                if (!CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash))
                                        return NULL;
index 4e7b8d6f0f637b497c0c8054abfa1776799a1225..09ec72174f6194cfa8046c6237805dd50b8a8d96 100644 (file)
@@ -50,7 +50,6 @@ char *stripbadwords_channel(char *str)
        char *ptr;
        int  errorcode, matchlen, stringlen;
        ConfigItem_badword *this_word;
-       size_t n;
        if (!conf_badword_channel)
                return str;
 
@@ -111,7 +110,6 @@ char *stripbadwords_message(char *str)
        char *ptr;
        int  errorcode, matchlen, stringlen;
        ConfigItem_badword *this_word;
-       size_t n;
        if (!conf_badword_message)
                return str;
 
index 211722811531451d4ba25050021fbc1c14b4b126..843378762b5f8e88f3ea2e0b2809346d8b497f71 100644 (file)
@@ -1,4 +1,4 @@
-/*   Unreal Internet Relay Chat Daemon, src/channel.c
+/* Unreal Internet Relay Chat Daemon, src/channel.c
  *   Copyright (C) 1990 Jarkko Oikarinen and
  *                      University of Oulu, Co Center
  *
@@ -237,27 +237,30 @@ Member    *make_member(void)
 
        if (freemember == NULL)
        {
-               for (i = 1; i <= (4072/sizeof(Member)); i++)            
+               for (i = 1; i <= (4072/sizeof(Member)); ++i)            
                {
                        lp = (Member *)MyMalloc(sizeof(Member));
+                       lp->cptr = NULL;
+                       lp->flags = 0;
                        lp->next = freemember;
                        freemember = lp;
                }
-               lp = freemember;
-               freemember = lp->next;
-       }
-       else
-       {
-               lp = freemember;
-               freemember = freemember->next;
        }
+       lp = freemember;
+       freemember = freemember->next;
+       lp->next = NULL;
        return lp;
 }
 
 void   free_member(Member *lp)
 {
-       lp->next = freemember;
-       freemember = lp;
+       if (lp)
+       {
+               lp->next = freemember;
+               lp->cptr = NULL;
+               lp->flags = 0;
+               freemember = lp;
+       }
 }
 
 /* 
@@ -321,15 +324,18 @@ Membership        *make_membership(int local)
 
 void   free_membership(Membership *lp, int local)
 {
-       if (!local)
-       {
-               lp->next = freemembership;
-               freemembership = lp;
-       }
-       else
+       if (lp)
        {
-               lp->next = (Membership *) freemembershipL;
-               freemembershipL = (MembershipL *) lp;
+               if (!local)
+               {
+                       lp->next = freemembership;
+                       freemembership = lp;
+               }
+               else
+               {
+                       lp->next = (Membership *) freemembershipL;
+                       freemembershipL = (MembershipL *) lp;
+               }
        }
 }
 
@@ -601,6 +607,7 @@ void remove_user_from_channel(aClient *sptr, aChannel *chptr)
        Member *tmp; Membership *tmp2;
        Member *lp = chptr->members;
 
+       /* find 1st entry in list that is not user */
        for (; lp && (lp->cptr == sptr); lp = lp->next);
        for (;;)
        {
@@ -611,8 +618,7 @@ void remove_user_from_channel(aClient *sptr, aChannel *chptr)
                                free_member(tmp);
                                break;
                        }
-               for (curr2 = &sptr->user->channel; (tmp2 = *curr2);
-                   curr2 = &tmp2->next)
+               for (curr2 = &sptr->user->channel; (tmp2 = *curr2); curr2 = &tmp2->next)
                        if (tmp2->chptr == chptr)
                        {
                                *curr2 = tmp2->next;
@@ -1222,7 +1228,8 @@ CMD_FUNC(m_mode)
 
 #ifndef NO_OPEROVERRIDE
         if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr)
-            && !is_half_op(sptr, chptr) && IsOper(sptr))
+            && !is_half_op(sptr, chptr) && (MyClient(sptr) ? (IsOper(sptr) &&
+           OPCanOverride(sptr)) : IsOper(sptr)))
         {
                 sendts = 0;
                 opermode = 1;
@@ -1230,7 +1237,8 @@ CMD_FUNC(m_mode)
         }
 
         if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr)
-            && is_half_op(sptr, chptr) && IsOper(sptr))
+            && is_half_op(sptr, chptr) && (MyClient(sptr) ? (IsOper(sptr) &&
+           OPCanOverride(sptr)) : IsOper(sptr)))
         {
                 opermode = 2;
                 goto aftercheck;
@@ -1395,6 +1403,9 @@ void do_mode(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv
        }
 #endif
 
+       /* Should stop null modes */
+       if (*(modebuf + 1) == '\0')
+               return;
        if (IsPerson(sptr) && samode && MyClient(sptr))
        {
                sendto_serv_butone_token(NULL, me.name, MSG_GLOBOPS,
@@ -1406,9 +1417,7 @@ void do_mode(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv
                sptr = &me;
                sendts = 0;
        }
-       /* Should stop null modes */
-       if (*(modebuf + 1) == '\0')
-               return;
+
        
        sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s",
            sptr->name, chptr->chname, modebuf, parabuf);
@@ -2416,7 +2425,7 @@ static int can_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, ch
         if ((chptr->mode.mode & MODE_RGSTRONLY) && !IsARegNick(sptr))
                 return (ERR_NEEDREGGEDNICK);
 
-        if (*chptr->mode.key && (BadPtr(key) || mycmp(chptr->mode.key, key)))
+        if (*chptr->mode.key && (BadPtr(key) || strcmp(chptr->mode.key, key)))
                 return (ERR_BADCHANNELKEY);
 
         if ((chptr->mode.mode & MODE_INVITEONLY))
@@ -2894,7 +2903,9 @@ CMD_FUNC(m_join)
        char *p = NULL, *p2 = NULL;
 
        bouncedtimes = 0;
-
+       if (IsServer(sptr))
+               return 0;
+               
        if (parc < 2 || *parv[1] == '\0')
        {
                sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
@@ -3395,7 +3406,7 @@ CMD_FUNC(m_kick)
                        continue;
                if (!IsServer(cptr)
 #ifndef NO_OPEROVERRIDE
-                   && !IsOper(sptr)
+                   && (!IsOper(sptr) || !(MyClient(sptr) && OPCanOverride(sptr)))
 #endif
                    && !IsULine(sptr) && !is_chan_op(sptr, chptr)
                    && !is_halfop(sptr, chptr))
@@ -3452,9 +3463,9 @@ CMD_FUNC(m_kick)
                                                    chptr->chname, who->name, comment);
                                                goto attack;
                                        }       /* is_chan_op */
-                               if (is_chanprot(who, chptr)
+                               if ((is_chanprot(who, chptr)
                                    || is_chanowner(who, chptr)
-                                   || IsServices(who)) {
+                                   || IsServices(who)) && !is_chanowner(sptr, chptr)) {
                                        if (IsNetAdmin(sptr))
                                        {       /* IRCop kicking owner/prot */
                                                sendto_snomask(SNO_EYES,
@@ -3676,10 +3687,12 @@ CMD_FUNC(m_topic)
                    || IsULine(sptr) || is_halfop(sptr, chptr)) && topic)
                {
                        /* setting a topic */
-                       if (IsOper(sptr) && !(is_halfop(sptr, chptr)
-                           || IsULine(sptr)
-                           || is_chan_op(sptr, chptr))
-                           && (chptr->mode.mode & MODE_TOPICLIMIT))
+                       if ((MyClient(sptr) ? (IsOper(sptr) &&
+                            OPCanOverride(sptr)) : IsOper(sptr)) && 
+                            !(is_halfop(sptr, chptr)
+                            || IsULine(sptr)
+                            || is_chan_op(sptr, chptr))
+                            && (chptr->mode.mode & MODE_TOPICLIMIT))
                        {
 #ifdef NO_OPEROVERRIDE
                                return 0;
@@ -3779,7 +3792,8 @@ CMD_FUNC(m_invite)
         if (chptr->mode.mode & MODE_NOINVITE && !IsULine(sptr))
         {
 #ifndef NO_OPEROVERRIDE
-                if (IsOper(sptr) && sptr == acptr)
+                if ((MyClient(sptr) ? (IsOper(sptr) && OPCanOverride(sptr)) :
+                   IsOper(sptr)) && sptr == acptr)
                         over = 1;
                 else {
 #endif
@@ -3794,7 +3808,8 @@ CMD_FUNC(m_invite)
         if (!IsMember(sptr, chptr) && !IsULine(sptr))
         {
 #ifndef NO_OPEROVERRIDE
-                if (IsOper(sptr) && sptr == acptr)
+                if ((MyClient(sptr) ? (IsOper(sptr) && OPCanOverride(sptr)) :
+                   IsOper(sptr)) && sptr == acptr)
                         over = 1;
                 else {
 #endif
@@ -3818,7 +3833,8 @@ CMD_FUNC(m_invite)
                 if (!is_chan_op(sptr, chptr) && !IsULine(sptr))
                 {
 #ifndef NO_OPEROVERRIDE
-                        if (IsOper(sptr) && sptr == acptr)
+                if ((MyClient(sptr) ? (IsOper(sptr) && OPCanOverride(sptr)) :
+                   IsOper(sptr)) && sptr == acptr)
                                 over = 1;
                         else {
 #endif
@@ -3832,7 +3848,8 @@ CMD_FUNC(m_invite)
                 else if (!IsMember(sptr, chptr) && !IsULine(sptr))
                 {
 #ifndef NO_OPEROVERRIDE
-                        if (IsOper(sptr) && sptr == acptr)
+                if ((MyClient(sptr) ? (IsOper(sptr) && OPCanOverride(sptr)) :
+                   IsOper(sptr)) && sptr == acptr)
                                 over = 1;
                         else {
 #endif
@@ -3914,11 +3931,11 @@ CMD_FUNC(m_invite)
 #endif
                    )) {
                        if (over == 1)
-                               sendto_channelops_butone(NULL, &me, chptr,
+                               sendto_channelprefix_butone(NULL, &me, chptr, PREFIX_OP,
                                  ":%s NOTICE @%s :OperOverride -- %s invited him/herself into the channel.",
                                  me.name, chptr->chname, sptr->name);
                        else if (over == 0)
-                               sendto_channelops_butone(NULL, &me, chptr,
+                               sendto_channelprefix_butone(NULL, &me, chptr, PREFIX_OP,
                                  ":%s NOTICE @%s :%s invited %s into the channel.",
                                  me.name, chptr->chname, sptr->name, acptr->name);
 
@@ -3931,9 +3948,6 @@ CMD_FUNC(m_invite)
         return 0;
 }
 
-
-
-
 /*
  * The function which sends the actual channel list back to the user.
  * Operates by stepping through the hashtable, sending the entries back if
@@ -4568,6 +4582,9 @@ CMD_FUNC(m_knock)
 {
        aChannel *chptr;
 
+       if (IsServer(sptr))
+               return 0;
+
        if (parc < 2 || *parv[1] == '\0')
        {
                sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
@@ -4638,7 +4655,7 @@ CMD_FUNC(m_knock)
                return 0;
        }
 
-       sendto_channelops_butone(NULL, &me, chptr,
+       sendto_channelprefix_butone(NULL, &me, chptr, PREFIX_OP,
            ":%s NOTICE @%s :[Knock] by %s!%s@%s (%s) ",
            me.name, chptr->chname, sptr->name,
            sptr->user->username,
@@ -4765,7 +4782,7 @@ CMD_FUNC(m_sjoin)
        Member *lp;
        Membership *lp2;
        aParv *ap;
-       int  ts, oldts, pcount, x, y, z, i, f;
+       int  ts, oldts, pcount, i, f;
        unsigned short b=0,c;
        Mode oldmode;
        char *t, *bp, *tp, *p = NULL;
index 38b8dc6200bdf30915da20d6775ffcef351d4a9a..89f864a49f71a42ff9df89a9f529a730508a16ac 100644 (file)
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "struct.h"
-
+#include "h.h"
 /* The following functions have been taken from Hybrid7-beta8 simply because
  * I didn't feel like writing my own when they had ones that work just fine :)
  */
index 013d3a729722df312c7367f44b535404681c138a..f2922732a9b5f9d0d76a13390d1b77b8945da80c 100644 (file)
@@ -682,6 +682,39 @@ void crule_free(char **elem)
        *elem = NULL;
 }
 
+char *crule_errstring(int errcode)
+{
+       return crule_errstr[errcode-1];
+}
+
+int crule_test(char *rule)
+{
+       char *ruleptr = rule;
+       int  next_tok;
+       crule_treeptr ruleroot = NULL;
+       int  errcode = CR_NOERR;
+
+       if ((errcode = crule_gettoken(&next_tok, &ruleptr)) == CR_NOERR) {
+               if ((errcode = crule_parseorexpr(&ruleroot, &next_tok,
+                   &ruleptr)) == CR_NOERR) {
+                       if (ruleroot != NULL) {
+                               if (next_tok == CR_END)
+                               {
+                                       crule_free((char **)&ruleroot);
+                                       return 0;
+                               }
+                               else
+                                       errcode = CR_UNEXPCTTOK;
+                       }
+                       else
+                               errcode = CR_EXPCTOR;
+               }
+       }
+       if (ruleroot != NULL)
+               crule_free((char **)&ruleroot);
+       return errcode+1;
+}
+
 #ifdef CR_DEBUG
 void print_tree(crule_treeptr printelem)
 {
index f2a8e4206cffa56c0400b0b7071c3aced1ba5d61..46f7531c0aa47015baddca4f98d276347c69c0f7 100644 (file)
@@ -78,14 +78,6 @@ char *malloc_options = "h" MALLOC_FLAGS_EXTRA;
 #endif
 time_t TSoffset = 0;
 
-/* Added DrBin */
-#ifndef BIG_SECURITY_HOLE
-int  un_uid = 99;
-int  un_gid = 99;
-#endif
-/* End */
-
-
 #ifndef _WIN32
 extern char unreallogo[];
 #endif
@@ -484,7 +476,6 @@ extern TS check_pings(TS currenttime)
        int  i = 0;
        char banbuf[1024];
        int  ping = 0;
-       TS   oldest = 0;
 
        for (i = 0; i <= LastSlot; i++) {
                /*
@@ -585,15 +576,23 @@ extern TS check_pings(TS currenttime)
                Debug((DEBUG_DEBUG, "c(%s)=%d p %d k %d a %d", cptr->name,
                    cptr->status, ping, killflag,
                    currenttime - cptr->lasttime));
-               if (ping < (currenttime - cptr->lasttime)) {
-                       if (((cptr->flags & FLAGS_PINGSENT)
-                           && ((currenttime - cptr->lasttime) >= (2 * ping)))
-                           || ((!IsRegistered(cptr)
-                           && (currenttime - cptr->since) >= ping)))
+               
+               /* If ping is less than or equal to the last time we received a command from them */
+               if (ping <= (currenttime - cptr->lasttime))
+               {
+                       if (
+                               /* If we have sent a ping */
+                               ((cptr->flags & FLAGS_PINGSENT)
+                               /* And they had 2x ping frequency to respond */
+                               && ((currenttime - cptr->lasttime) >= (2 * ping)))
+                               || 
+                               /* Or isn't registered and time spent is larger than ping .. */
+                               (!IsRegistered(cptr) && (currenttime - cptr->since >= ping))
+                               )
                        {
-                               if (!IsRegistered(cptr) &&
-                                   (DoingDNS(cptr) || DoingAuth(cptr)
-                                   )) {
+                               /* if it's registered and doing dns/auth, timeout */
+                               if (!IsRegistered(cptr) && (DoingDNS(cptr) || DoingAuth(cptr)))
+                               {
                                        if (cptr->authfd >= 0) {
                                                CLOSE_SOCK(cptr->authfd);
                                                --OpenFiles;
@@ -621,7 +620,11 @@ extern TS check_pings(TS currenttime)
                                        continue;
                                }
                                if (IsServer(cptr) || IsConnecting(cptr) ||
-                                   IsHandshake(cptr)) {
+                                   IsHandshake(cptr)
+#ifdef USE_SSL
+                                       || IsSSLConnectHandshake(cptr)
+#endif     
+                                   ) {
                                        sendto_realops
                                            ("No response from %s, closing link",
                                            get_client_name(cptr, FALSE));
@@ -630,9 +633,16 @@ extern TS check_pings(TS currenttime)
                                            me.name, get_client_name(cptr,
                                            FALSE));
                                }
+#ifdef USE_SSL
+                               if (IsSSLAcceptHandshake(cptr))
+                                       Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%li-%li > %li)", cptr->sockhost,
+                                               currenttime, cptr->since, ping));
+#endif
                                exit_client(cptr, cptr, &me, "Ping timeout");
                                continue;
-                       } else if (IsRegistered(cptr) &&
+                               
+                       }
+                       else if (IsRegistered(cptr) &&
                            ((cptr->flags & FLAGS_PINGSENT) == 0)) {
                                /*
                                 * if we havent PINGed the connection and we havent
@@ -658,7 +668,7 @@ extern TS check_pings(TS currenttime)
                        || (IsSSLAcceptHandshake(cptr) || IsSSLConnectHandshake(cptr))
 #endif         
                )
-                       if (cptr->firsttime ? ((TStime() - cptr->firsttime) >
+                       if (cptr->firsttime ? ((currenttime - cptr->firsttime) >
                            100) : 0)
                                (void)exit_client(cptr, cptr, &me,
                                    "Connection Timed Out");
@@ -948,7 +958,7 @@ int InitwIRCD(int argc, char *argv[])
                          exit(0);
                  }
                  case 'C':
-                         conf_debuglevel = atoi(p);
+                         config_verbose = atoi(p);
                          break;
                  case 'x':
 #ifdef DEBUGMODE
@@ -993,58 +1003,6 @@ int InitwIRCD(int argc, char *argv[])
        }
 #endif
 
-#if !defined(IRC_UID) && !defined(_WIN32)
-       if ((uid != euid) && !euid) {
-               (void)fprintf(stderr,
-                   "ERROR: do not run ircd setuid root. Make it setuid a\
- normal user.\n");
-               exit(-1);
-       }
-#endif
-
-#if (!defined(CHROOTDIR) || (defined(IRC_UID) && defined(IRC_GID))) \
-    && !defined(_WIN32)
-# ifndef       AIX
-       (void)setuid((uid_t) uid);
-       (void)setuid((uid_t) euid);
-# endif
-/*
- * Modified 13/2000 DrBin
- * We need to have better controll over running as root ... see config.h
- */
-       if ((int)getuid() == 0) {
-#ifndef BIG_SECURITY_HOLE
-               if ((IRC_UID == 0) || (IRC_GID == 0)) {
-                       (void)fprintf(stderr,
-                           "ERROR: SETUID and SETGID have not been set properly"
-                           "\nPlease read your documentation\n(HINT:SETUID or SETGID can not be 0)\n");
-                       exit(-1);
-               } else {
-                       /*
-                        * run as a specified user 
-                        */
-
-                       (void)fprintf(stderr,
-                           "WARNING: ircd invoked as root\n");
-                       (void)fprintf(stderr, "         changing to uid %d\n",
-                           IRC_UID);
-                       (void)fprintf(stderr, "         changing to gid %d\n",
-                           IRC_GID);
-                       (void)setgid(IRC_GID);
-                       (void)setuid(IRC_UID);
-               }
-#else
-               /*
-                * check for setuid root as usual 
-                */
-               (void)fprintf(stderr,
-                   "ERROR: do not run ircd setuid root. Make it setuid a\
- normal user.\n");
-               exit(-1);
-# endif
-       }
-#endif                         /*CHROOTDIR/UID/GID/_WIN32 */
-
 #ifndef _WIN32
        /*
         * didn't set debuglevel 
@@ -1088,7 +1046,7 @@ int InitwIRCD(int argc, char *argv[])
                ModCoreInfo.size = sizeof(ModuleInfo);
                ModCoreInfo.module_load = 0;
                ModCoreInfo.handle = NULL;
-               l_commands_Init(&ModCoreInfo);
+               l_commands_Test(&ModCoreInfo);
        }
 #endif
        /*
@@ -1102,12 +1060,21 @@ int InitwIRCD(int argc, char *argv[])
        default_class->sendq = MAXSENDQLENGTH;
        default_class->name = "default";
        AddListItem(default_class, conf_class);
-       init_conf2(configfile);
-       validate_configuration();
+       if (init_conf(configfile, 0) < 0)
+       {
+               exit(-1);
+       }
        booted = TRUE;
        load_tunefile();
        make_umodestr();
        make_cmodestr();
+       if (!find_Command_simple("AWAY") || !find_Command_simple("KILL") ||
+               !find_Command_simple("OPER") || !find_Command_simple("PING"))
+       {
+               config_error("Someone forgot to load modules with proper commands in them. READ THE DOCUMENTATION");
+               exit(-4);
+       }
+
 #ifdef USE_SSL
 #ifndef _WIN32
        fprintf(stderr, "* Initializing SSL.\n");
@@ -1163,6 +1130,7 @@ int InitwIRCD(int argc, char *argv[])
                exit(1);
        conf_listen->options |= LISTENER_BOUND;
        me.umodes = conf_listen->options;
+       conf_listen->listener = &me;
        run_configuration();
        botmotd = (aMotd *) read_file(BPATH, &botmotd);
        rules = (aMotd *) read_rules(RPATH);
@@ -1209,6 +1177,38 @@ int InitwIRCD(int argc, char *argv[])
        R_fin_id = strlen(REPORT_FIN_ID);
        R_fail_id = strlen(REPORT_FAIL_ID);
        write_pidfile();
+
+#if !defined(IRC_UID) && !defined(_WIN32)
+       if ((uid != euid) && !euid) {
+               (void)fprintf(stderr,
+                   "ERROR: do not run ircd setuid root. Make it setuid a normal user.\n");
+               exit(-1);
+       }
+#endif
+
+#if defined(IRC_UID) && defined(IRC_GID)
+       if ((int)getuid() == 0) {
+               if ((IRC_UID == 0) || (IRC_GID == 0)) {
+                       (void)fprintf(stderr,
+                           "ERROR: SETUID and SETGID have not been set properly"
+                           "\nPlease read your documentation\n(HINT:SETUID or SETGID can not be 0)\n");
+                       exit(-1);
+               } else {
+                       /*
+                        * run as a specified user 
+                        */
+
+                       (void)fprintf(stderr,
+                           "WARNING: ircd invoked as root\n");
+                       (void)fprintf(stderr, "         changing to uid %d\n",
+                           IRC_UID);
+                       (void)fprintf(stderr, "         changing to gid %d\n",
+                           IRC_GID);
+                       (void)setgid(IRC_GID);
+                       (void)setuid(IRC_UID);
+               }
+       }
+#endif
        Debug((DEBUG_NOTICE, "Server ready..."));
        SetupEvents();
        loop.do_bancheck = 0;
index 64139dab1f4f2c30838e29f3fd39cf1793020d8f..4e3a5927e4f41a7f9b25cc65b71cb544e1a55531 100644 (file)
@@ -264,7 +264,11 @@ void remove_client_from_list(aClient *cptr)
                if (cptr->srvptr && cptr->srvptr->serv)
                        cptr->srvptr->serv->users--;
        }
-       if (IsUnknown(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
+       if (IsUnknown(cptr) || IsConnecting(cptr) || IsHandshake(cptr)
+#ifdef USE_SSL
+               || IsSSLHandshake(cptr)
+#endif
+       )
                IRCstats.unknown--;
        checklist();
        if (cptr->prev)
index 44e66c8112a983847d5b21b604236dad24f002d8..0857b278ca4c852e12906b57e82e06f071879da0 100644 (file)
@@ -88,6 +88,8 @@ Module *Module_Find(char *name)
        
        for (p = Modules; p; p = p->next)
        {
+               if (!(p->flags & MODFLAG_TESTING) || (p->flags & MODFLAG_DELAYED))
+                       continue;
                if (!strcmp(p->header->name, name))
                {
                        return (p);
@@ -100,7 +102,7 @@ Module *Module_Find(char *name)
 /*
  * Returns an error if insucessful .. yes NULL is OK! 
 */
-char  *Module_Load (char *path_, int load)
+char  *Module_Create(char *path_)
 {
 #ifndef STATIC_LINKING
 #ifdef _WIN32
@@ -108,6 +110,7 @@ char  *Module_Load (char *path_, int load)
 #else /* _WIN32 */
        void            *Mod;
 #endif /* _WIN32 */
+       int             (*Mod_Test)();
        int             (*Mod_Init)();
        int             (*Mod_Load)();
        int             (*Mod_Unload)();
@@ -189,49 +192,33 @@ char  *Module_Load (char *path_, int load)
                irc_dlsym(Mod, "Mod_Handle", Mod_Handle);
                if (Mod_Handle)
                        *Mod_Handle = mod;
-               if (betaversion >= 8) {
-                       modinfo.size = sizeof(ModuleInfo);
-                       modinfo.module_load = load;
-                       modinfo.handle = mod;
-                       if ((ret = (*Mod_Init)(&modinfo)) < MOD_SUCCESS) {
-                               ircsprintf(errorbuf, "Mod_Init returned %i",
-                                          ret);
-                               /* We EXPECT the module to have cleaned up it's mess */
-                               Module_free(mod);
-                               return (errorbuf);
-                       }
-               }
-               else {
-                       if ((ret = (*Mod_Init)(load)) < MOD_SUCCESS)
-                       {
-                               ircsprintf(errorbuf, "Mod_Init returned %i",
-                                          ret);
-                               /* We EXPECT the module to have cleaned up it's mess */
-                               Module_free(mod);
-                               return (errorbuf);
-                       }
-               }
-               
-               if (load)
+               irc_dlsym(Mod, "Mod_Test", Mod_Test);
+               if (Mod_Test)
                {
-                       irc_dlsym(Mod, "Mod_Load", Mod_Load);
-                       if (!Mod_Load)
-                       {
-                               /* We cannot do delayed unloading if this happens */
-                               (*Mod_Unload)();
-                               Module_free(mod);
-                               return ("Unable to locate Mod_Load"); 
+                       if (betaversion >= 8) {
+                               modinfo.size = sizeof(ModuleInfo);
+                               modinfo.module_load = 0;
+                               modinfo.handle = mod;
+                               if ((ret = (*Mod_Test)(&modinfo)) < MOD_SUCCESS) {
+                                       ircsprintf(errorbuf, "Mod_Test returned %i",
+                                                  ret);
+                                       /* We EXPECT the module to have cleaned up it's mess */
+                                       Module_free(mod);
+                                       return (errorbuf);
+                               }
                        }
-                       if ((ret = (*Mod_Load)(load)) < MOD_SUCCESS)
-                       {
-                               ircsprintf(errorbuf, "Mod_Load returned %i",
-                                         ret);
-                               (*Mod_Unload)();
-                               Module_free(mod);
-                               return (errorbuf);
+                       else {
+                               if ((ret = (*Mod_Test)(0)) < MOD_SUCCESS)
+                               {
+                                       ircsprintf(errorbuf, "Mod_Test returned %i",
+                                                  ret);
+                                       /* We EXPECT the module to have cleaned up it's mess */
+                                       Module_free(mod);
+                                       return (errorbuf);
+                               }
                        }
-                       mod->flags |= MODFLAG_LOADED;
                }
+               mod->flags = MODFLAG_TESTING;           
                AddListItem(mod, Modules);
                return NULL;
        }
@@ -250,6 +237,16 @@ char  *Module_Load (char *path_, int load)
        
 }
 
+void Module_DelayChildren(Module *m)
+{
+       ModuleChild *c;
+       for (c = m->children; c; c = c->next)
+       {
+               c->child->flags |= MODFLAG_DELAYED;
+               Module_DelayChildren(c->child);
+       }
+}
+
 Module *Module_make(ModuleHeader *header, 
 #ifdef _WIN32
        HMODULE mod
@@ -268,6 +265,136 @@ Module *Module_make(ModuleHeader *header,
        return (modp);
 }
 
+void Init_all_testing_modules(void)
+{
+       
+       Module *mi, *next;
+       int betaversion, tag, ret;
+       iFP Mod_Init;
+       ModuleInfo modinfo;
+       for (mi = Modules; mi; mi = next)
+       {
+               next = mi->next;
+               if (!(mi->flags & MODFLAG_TESTING))
+                       continue;
+               irc_dlsym(mi->dll, "Mod_Init", Mod_Init);
+               sscanf(mi->header->modversion, "3.2-b%d-%d", &betaversion, &tag);
+               if (betaversion >= 8) {
+                       modinfo.size = sizeof(ModuleInfo);
+                       modinfo.module_load = 0;
+                       modinfo.handle = mi;
+                       if ((ret = (*Mod_Init)(&modinfo)) < MOD_SUCCESS) {
+                               config_error("Error loading %s: Mod_Init returned %i",
+                                       mi->header->name, ret);
+                               Module_free(mi);
+                               continue;
+                       }
+               }
+               else {
+                       if ((ret = (*Mod_Init)(0)) < MOD_SUCCESS)
+                       {
+                               config_error("Error loading %s: Mod_Init returned %i",
+                                       mi->header->name, ret);
+                               Module_free(mi);
+                               continue;
+                       }
+               }               
+               mi->flags = MODFLAG_INIT;
+       }
+}      
+
+void Unload_all_loaded_modules(void)
+{
+       Module *mi, *next;
+       ModuleChild *child, *childnext;
+       ModuleObject *objs, *objnext;
+       iFP Mod_Unload;
+       int ret;
+
+       for (mi = Modules; mi; mi = next)
+       {
+               next = mi->next;
+               if (!(mi->flags & MODFLAG_LOADED) || (mi->flags & MODFLAG_DELAYED))
+                       continue;
+               irc_dlsym(mi->dll, "Mod_Unload", Mod_Unload);
+               if (Mod_Unload)
+               {
+                       ret = (*Mod_Unload)(0);
+                       if (ret == MOD_DELAY)
+                       {
+                               mi->flags |= MODFLAG_DELAYED;
+                               Module_DelayChildren(mi);
+                       }
+               }
+               for (objs = mi->objects; objs; objs = objnext) {
+                       objnext = objs->next;
+                       if (objs->type == MOBJ_EVENT) {
+                               LockEventSystem();
+                               EventDel(objs->object.event);
+                               UnlockEventSystem();
+                       }
+                       else if (objs->type == MOBJ_HOOK) {
+                               HookDel(objs->object.hook);
+                       }
+                       else if (objs->type == MOBJ_COMMAND) {
+                               CommandDel(objs->object.command);
+                       }
+                       else if (objs->type == MOBJ_HOOKTYPE) {
+                               HooktypeDel(objs->object.hooktype, mi);
+                       }
+               }
+               for (child = mi->children; child; child = childnext)
+               {
+                       childnext = child->next;
+                       DelListItem(child,mi->children);
+                       MyFree(child);
+               }
+               DelListItem(mi,Modules);
+               irc_dlclose(mi->dll);
+               MyFree(mi);
+       }
+}
+
+void Unload_all_testing_modules(void)
+{
+       Module *mi, *next;
+       ModuleChild *child, *childnext;
+       ModuleObject *objs, *objnext;
+
+       for (mi = Modules; mi; mi = next)
+       {
+               next = mi->next;
+               if (!(mi->flags & MODFLAG_TESTING))
+                       continue;
+               for (objs = mi->objects; objs; objs = objnext) {
+                       objnext = objs->next;
+                       if (objs->type == MOBJ_EVENT) {
+                               LockEventSystem();
+                               EventDel(objs->object.event);
+                               UnlockEventSystem();
+                       }
+                       else if (objs->type == MOBJ_HOOK) {
+                               HookDel(objs->object.hook);
+                       }
+                       else if (objs->type == MOBJ_COMMAND) {
+                               CommandDel(objs->object.command);
+                       }
+                       else if (objs->type == MOBJ_HOOKTYPE) {
+                               HooktypeDel(objs->object.hooktype, mi);
+                       }
+               }
+               for (child = mi->children; child; child = childnext)
+               {
+                       childnext = child->next;
+                       DelListItem(child,mi->children);
+                       MyFree(child);
+               }
+               DelListItem(mi,Modules);
+               irc_dlclose(mi->dll);
+               MyFree(mi);
+       }
+}
+
 /* 
  * Returns -1 if you cannot unload due to children still alive 
  * Returns 1 if successful 
@@ -353,6 +480,8 @@ int     Module_Unload(char *name, int unload)
        ret = (*Mod_Unload)(unload);
        if (ret == MOD_DELAY)
        {
+               m->flags |= MODFLAG_DELAYED;
+               Module_DelayChildren(m);
                return 2;
        }
        if (ret == MOD_FAILED)
@@ -375,18 +504,11 @@ vFP Module_SymEx(
 {
 #ifndef STATIC_LINKING
        vFP     fp;
-       char    buf[512];
 
        if (!name)
                return NULL;
        
-       ircsprintf(buf, "_%s", name);
-
-       /* Run through all modules and check for symbols */
        irc_dlsym(mod, name, fp);
-       if (fp)
-               return (fp);
-       irc_dlsym(mod, buf, fp);
        if (fp)
                return (fp);
        return NULL;
@@ -398,23 +520,19 @@ vFP Module_Sym(char *name)
 {
 #ifndef STATIC_LINKING
        vFP     fp;
-       char    buf[512];
        Module *mi;
        
        if (!name)
                return NULL;
-       
-       ircsprintf(buf, "_%s", name);
 
        /* Run through all modules and check for symbols */
        for (mi = Modules; mi; mi = mi->next)
        {
+               if (!(mi->flags & MODFLAG_TESTING) || (mi->flags & MODFLAG_DELAYED))
+                       continue;
                irc_dlsym(mi->dll, name, fp);
                if (fp)
                        return (fp);
-               irc_dlsym(mi->dll, buf, fp);
-               if (fp)
-                       return (fp);
        }
        return NULL;
 #endif
@@ -424,29 +542,22 @@ vFP Module_SymX(char *name, Module **mptr)
 {
 #ifndef STATIC_LINKING
        vFP     fp;
-       char    buf[512];
        Module *mi;
        
        if (!name)
                return NULL;
        
-       ircsprintf(buf, "_%s", name);
-
        /* Run through all modules and check for symbols */
        for (mi = Modules; mi; mi = mi->next)
        {
+               if (!(mi->flags & MODFLAG_TESTING) || (mi->flags & MODFLAG_DELAYED))
+                       continue;
                irc_dlsym(mi->dll, name, fp);
                if (fp)
                {
                        *mptr = mi;
                        return (fp);
                }
-               irc_dlsym(mi->dll, buf, fp);
-               if (fp)
-               {
-                       *mptr = mi;
-                       return (fp);
-               }
        }
        *mptr = NULL;
        return NULL;
@@ -488,7 +599,7 @@ void        module_loadall(int module_load)
                }
                else
                {
-                       mi->flags |= MODFLAG_LOADED;
+                       mi->flags = MODFLAG_LOADED;
                }
                
        }
@@ -537,7 +648,7 @@ int Module_Depend_Resolve(Module *p)
                if (!*(d->pointer))
                {
                        config_progress("Unable to resolve symbol %s, attempting to load %s to find it", d->symbol, d->module);
-                       Module_Load(d->module,0);
+                       Module_Create(d->module);
                        *(d->pointer) = Module_SymX(d->symbol, &parental);
                        if (!*(d->pointer)) {
                                config_progress("module dependancy error: cannot resolve symbol %s",
@@ -572,71 +683,19 @@ int  m_module(aClient *cptr, aClient *sptr, int parc, char *parv[])
                sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
                return 0;
        }
-       if (parc < 2)
-       {
-               sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
-                   me.name, parv[0], "MODULE");
-               return 0;
-       }
-       if (!match(parv[1], "load"))
+       if (!Modules)
        {
-               if (parc < 3)
-               {
-                       sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
-                           me.name, parv[0], "MODULE LOAD");
-                       return 0;
-               }
-               if (!(ret = Module_Load(parv[2], 1)))
-               {
-                       sendto_realops("Loaded module %s", parv[2]);
-                       return 0;
-               }
-               else
-               {
-                       sendto_realops("Module load of %s failed: %s",
-                               parv[2], ret);
-               }
+               sendto_one(sptr, ":%s NOTICE %s :*** No modules loaded", me.name, sptr->name);
+               return 1;
        }
-       else
-       if (!match(parv[1], "unload"))
-       {
-               if (parc < 3)
-               {
-                       sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
-                           me.name, parv[0], "MODULE UNLOAD");
-                       return 0;
-               }
-               sendto_realops("Trying to unload module %s", parv[2]);
-               i = Module_Unload(parv[2], 0);
-               {
-                       if (i == 1)
-                               sendto_realops("Unloaded module %s", parv[2]);
-                       else if (i == 2)
-                               sendto_realops("Delaying module unload of %s",
-                                       parv[2]);
-                       else if (i == -1)
-                               sendto_realops("Couldn't unload module %s",     
-                                       parv[2]);
-               }
-       }               
-       else
-       if (!match(parv[1], "status"))
-       {
-               if (!Modules)
-               {
-                       sendto_one(sptr, ":%s NOTICE %s :*** No modules loaded", me.name, sptr->name);
-                       return 1;
-               }
-               for (mi = Modules; mi; mi = mi->next)
-               {
-                       sendto_one(sptr, ":%s NOTICE %s :*** %s - %s (%s)", me.name, sptr->name,
-                               mi->header->name, mi->header->version, mi->header->description);        
-               }
-       }
-       else
+       for (mi = Modules; mi; mi = mi->next)
        {
-               sendto_one(sptr, ":%s NOTICE %s :*** Syntax: /module load|unload|status",
-                       me.name, sptr->name);
+               char delayed[32];
+               if (mi->flags & MODFLAG_DELAYED)
+                       strcpy(delayed, "[Unloading]");
+               sendto_one(sptr, ":%s NOTICE %s :*** %s - %s (%s) %s", me.name, sptr->name,
+                       mi->header->name, mi->header->version, mi->header->description,
+                       (mi->flags & MODFLAG_DELAYED) ? delayed : "");  
        }
        return 1;
 }
@@ -796,3 +855,4 @@ void        unload_all_modules(void)
                        (*Mod_Unload)(0);
        }
 }
+
index 63345a683eeeb38af0742226b46a9e7743d13ac4..ed03382d0ce36725f87d9ef08ccefd292172bf97 100644 (file)
@@ -29,20 +29,21 @@ R_MODULES=m_sethost.so m_chghost.so m_chgident.so m_setname.so \
                m_svsmotd.so m_svsnline.so m_who.so m_mkpasswd.so \
                m_away.so m_svsnoop.so m_svso.so m_svsnick.so \
         m_adminchat.so m_akill.so m_chgname.so m_guest.so m_htm.so m_kill.so \
-        m_kline.so m_lag.so m_message.so m_nachat.so m_oper.so m_pingpong.so \
+        m_lag.so m_message.so m_nachat.so m_oper.so m_pingpong.so \
         m_quit.so m_rakill.so m_rping.so m_sendumode.so m_sqline.so \
         m_tsctl.so m_unkline.so m_unsqline.so m_unzline.so m_whois.so \
-        m_zline.so m_tkl.so m_vhost.so m_cycle.so m_svsjoin.so m_svspart.so \
+        m_tkl.so m_vhost.so m_cycle.so m_svsjoin.so m_svspart.so \
         invisibility.so scan.so scan_socks.so scan_http.so web/httpd.so
 
 COMMANDS=m_sethost.c m_chghost.c m_chgident.c m_setname.c m_setident.c \
          m_sdesc.c m_svsmode.c m_swhois.c m_svsmotd.c m_svsnline.c \
         m_who.c m_mkpasswd.c m_away.c m_svsnoop.c m_svso.c m_svsnick.c \
         m_adminchat.c m_akill.c m_chgname.c m_guest.c m_htm.c m_kill.c \
-        m_kline.c m_lag.c m_message.c m_nachat.c m_oper.c m_pingpong.c \
+        m_lag.c m_message.c m_nachat.c m_oper.c m_pingpong.c \
         m_quit.c m_rakill.c m_rping.c m_sendumode.c m_sqline.c \
         m_tsctl.c m_unkline.c m_unsqline.c m_unzline.c m_whois.c \
-        m_zline.c m_tkl.c m_vhost.c m_cycle.c m_svsjoin.c m_svspart.c
+        m_tkl.c m_vhost.c m_cycle.c m_svsjoin.c m_svspart.c \
+        m_svslusers.c
 
 
 MODULES=commands.so $(R_MODULES)
@@ -89,10 +90,6 @@ m_kill.so: m_kill.c $(INCLUDES)
        $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
                -o m_kill.so m_kill.c
 
-m_kline.so: m_kline.c $(INCLUDES)
-       $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
-               -o m_kline.so m_kline.c
-
 m_lag.so: m_lag.c $(INCLUDES)
        $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
                -o m_lag.so m_lag.c
@@ -153,11 +150,6 @@ m_whois.so: m_whois.c $(INCLUDES)
        $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
                -o m_whois.so m_whois.c
 
-m_zline.so: m_zline.c $(INCLUDES)
-       $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
-               -o m_zline.so m_zline.c
-
-
 m_sethost.so: m_sethost.c $(INCLUDES)
        $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
                -o m_sethost.so m_sethost.c
@@ -242,6 +234,10 @@ m_svspart.so: m_svspart.c $(INCLUDES)
        $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
                -o m_svspart.so m_svspart.c
 
+m_svslusers.so: m_svslusers.c $(INCLUDES)
+       $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
+               -o m_svslusers.so m_svslusers.c
+
 scan.so: scan.c $(INCLUDES)
        $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
                 -o scan.so scan.c
index c61de1132a47108c31c678e3e7a83a80433f837d..e598c380b282bd69459948115a9a7343858f3636 100644 (file)
@@ -73,6 +73,10 @@ ModuleHeader l_commands_Header
  * want to
 */
 
+#ifdef SCAN_API
+extern int m_scan_Test(ModuleInfo *modinfo);
+#endif
+
 extern int m_sethost_Init(ModuleInfo *modinfo), m_setname_Init(ModuleInfo *modinfo), m_chghost_Init(ModuleInfo *modinfo);
 extern int m_chgident_Init(ModuleInfo *modinfo), m_setident_Init(ModuleInfo *modinfo), m_sdesc_Init(ModuleInfo *modinfo);
 extern int m_svsmode_Init(ModuleInfo *modinfo), m_swhois_Init(ModuleInfo *modinfo), m_svsmotd_Init(ModuleInfo *modinfo);
@@ -83,10 +87,11 @@ extern int m_lag_Init(ModuleInfo *modinfo), m_rping_Init(ModuleInfo *modinfo), m
 extern int m_tsctl_Init(ModuleInfo *modinfo), m_htm_Init(ModuleInfo *modinfo), m_chgname_Init(ModuleInfo *modinfo);
 extern int m_message_Init(ModuleInfo *modinfo), m_whois_Init(ModuleInfo *modinfo), m_quit_Init(ModuleInfo *modinfo);
 extern int m_kill_Init(ModuleInfo *modinfo), m_pingpong_Init(ModuleInfo *modinfo), m_oper_Init(ModuleInfo *modinfo);
-extern int m_akill_Init(ModuleInfo *modinfo), m_rakill_Init(ModuleInfo *modinfo), m_zline_Init(ModuleInfo *modinfo);
-extern int m_unzline_Init(ModuleInfo *modinfo), m_kline_Init(ModuleInfo *modinfo), m_unkline_Init(ModuleInfo *modinfo);
+extern int m_akill_Init(ModuleInfo *modinfo), m_rakill_Init(ModuleInfo *modinfo);
+extern int m_unzline_Init(ModuleInfo *modinfo), m_unkline_Init(ModuleInfo *modinfo);
+extern int m_sqline_Init(ModuleInfo *modinfo), m_unsqline_Init(ModuleInfo *modinfo), m_tkl_Init(ModuleInfo *modinfo);
 extern int m_vhost_Init(ModuleInfo *modinfo), m_cycle_Init(ModuleInfo *modinfo), m_svsjoin_Init(ModuleInfo *modinfo);
-extern int m_svspart_Init(ModuleInfo *modinfo);
+extern int m_svspart_Init(ModuleInfo *modinfo), m_svslusers_Init(ModuleInfo *modinfo);
 #ifdef GUEST
 extern int m_guest_Init(ModuleInfo *modinfo);
 #endif
@@ -107,11 +112,11 @@ extern int m_lag_Load(int module_load), m_rping_Load(int module_load), m_sendumo
 extern int m_tsctl_Load(int module_load), m_htm_Load(int module_load), m_chgname_Load(int module_load);
 extern int m_message_Load(int module_load), m_whois_Load(int module_load), m_quit_Load(int module_load);
 extern int m_kill_Load(int module_load), m_pingpong_Load(int module_load), m_oper_Load(int module_load);
-extern int m_akill_Load(int module_load), m_rakill_Load(int module_load), m_zline_Load(int module_load);
-extern int m_unzline_Load(int module_load), m_kline_Load(int module_load), m_unkline_Load(int module_load);
+extern int m_akill_Load(int module_load), m_rakill_Load(int module_load);
+extern int m_unzline_Load(int module_load), m_unkline_Load(int module_load);
 extern int m_sqline_Load(int module_load), m_unsqline_Load(int module_load), m_tkl_Load(int module_load);
 extern int m_vhost_Load(int module_load), m_cycle_Load(int module_load), m_svsjoin_Load(int module_load);
-extern int m_svspart_Load(int module_load);
+extern int m_svspart_Load(int module_load), m_svslusers_Load(int module_load);
 #ifdef GUEST
 extern int m_guest_Load(int module_load);
 #endif
@@ -130,9 +135,9 @@ extern int m_adminchat_Unload(), m_nachat_Unload(), m_lag_Unload(), m_rping_Unlo
 extern int m_sendumode_Unload(), m_tsctl_Unload(), m_htm_Unload(), m_chgname_Unload();
 extern int m_message_Unload(), m_whois_Unload(), m_quit_Unload(), m_kill_Unload();
 extern int m_pingpong_Unload(), m_oper_Unload(), m_akill_Unload(), m_rakill_Unload();
-extern int m_zline_Unload(), m_unzline_Unload(), m_kline_Unload(), m_unkline_Unload();
+extern int m_unzline_Unload(), m_unkline_Unload();
 extern int m_sqline_Unload(), m_unsqline_Unload(), m_tkl_Unload(), m_vhost_Unload();
-extern int m_cycle_Unload(), m_svsjoin_Unload(), m_svspart_Unload();
+extern int m_cycle_Unload(), m_svsjoin_Unload(), m_svspart_Unload(), m_svslusers_Unload();
 #ifdef GUEST
 extern int m_guest_Unload();
 #endif
@@ -143,6 +148,25 @@ extern int m_scan_Unload(), scan_socks_Unload(), scan_http_Unload();
 extern int invisibility_Unload();
 #endif
 
+#ifdef SCAN_API
+#ifdef DYNAMIC_LINKING
+DLLFUNC int Mod_Test(ModuleInfo *modinfo)
+#else
+int l_commands_Test(ModuleInfo *modinfo)
+#endif
+{
+       Module p;
+       bcopy(modinfo,&ModCmdsInfo,modinfo->size);
+        p.header = &scan_socks_Header;
+        Module_Depend_Resolve(&p);
+        p.header = &scan_http_Header;
+        Module_Depend_Resolve(&p);
+       m_scan_Test(modinfo);
+       return MOD_SUCCESS;
+}
+#endif
+
+
 #ifdef DYNAMIC_LINKING
 DLLFUNC int    Mod_Init(ModuleInfo *modinfo)
 #else
@@ -190,9 +214,7 @@ int    l_commands_Init(ModuleInfo *modinfo)
        m_oper_Init(&ModCmdsInfo);
        m_akill_Init(&ModCmdsInfo);
        m_rakill_Init(&ModCmdsInfo);
-       m_zline_Init(&ModCmdsInfo);
        m_unzline_Init(&ModCmdsInfo);
-       m_kline_Init(&ModCmdsInfo);
        m_unkline_Init(&ModCmdsInfo);
        m_sqline_Init(&ModCmdsInfo);
        m_unsqline_Init(&ModCmdsInfo);
@@ -201,14 +223,11 @@ int    l_commands_Init(ModuleInfo *modinfo)
        m_cycle_Init(&ModCmdsInfo);
        m_svsjoin_Init(&ModCmdsInfo);
        m_svspart_Init(&ModCmdsInfo);
+       m_svslusers_Init(&ModCmdsInfo);
 #ifdef GUEST
        m_guest_Init(&ModCmdsInfo);
 #endif
 #ifdef SCAN_API
-        p.header = &scan_socks_Header;
-        Module_Depend_Resolve(&p);
-        p.header = &scan_http_Header;
-        Module_Depend_Resolve(&p);
        m_scan_Init(&ModCmdsInfo);
        scan_socks_Init(&ModCmdsInfo);
        scan_http_Init(&ModCmdsInfo);
@@ -256,9 +275,7 @@ int    l_commands_Load(int module_load)
        m_oper_Load(module_load);
        m_akill_Load(module_load);
        m_rakill_Load(module_load);
-       m_zline_Load(module_load);
        m_unzline_Load(module_load);
-       m_kline_Load(module_load);
        m_unkline_Load(module_load);
        m_tkl_Load(module_load);
        m_sqline_Load(module_load);
@@ -267,6 +284,7 @@ int    l_commands_Load(int module_load)
        m_cycle_Load(module_load);
        m_svsjoin_Load(module_load);
        m_svspart_Load(module_load);
+       m_svslusers_Load(module_load);
 #ifdef GUEST
        m_guest_Load(module_load);
 #endif
@@ -319,9 +337,7 @@ int l_commands_Unload(int module_unload)
        m_oper_Unload();
        m_akill_Unload();
        m_rakill_Unload();
-       m_zline_Unload();
        m_unzline_Unload();
-       m_kline_Unload();
        m_unkline_Unload();
        m_sqline_Unload();
        m_unsqline_Unload();
@@ -329,6 +345,7 @@ int l_commands_Unload(int module_unload)
        m_cycle_Unload();
        m_svsjoin_Unload();
        m_svspart_Unload();
+       m_svslusers_Unload();
 #ifdef GUEST
        m_guest_Unload();
 #endif
index d6c53bdbdaccffb639fe86cc85c522a2657bf53a..336d0181d2b255639b53a8a3c810c7a3af247f68 100644 (file)
@@ -120,7 +120,6 @@ int m_akill_Unload(int module_unload)
 DLLFUNC int m_akill(aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
        char *hostmask, *usermask, *comment;
-       ConfigItem_ban *bconf;
        char    mo[1024];
        char *tkllayer[9] = {
                me.name,        /*0  server.name */
index cc0addc95ceb8211ba653501e432de207c26a110..1d8a8b0503e56be847d2cfb0eb47a4ff7d1ffd6d 100644 (file)
@@ -117,7 +117,8 @@ int m_away_Unload(int module_unload)
 int  m_away(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
         char *away, *awy2 = parv[1];
 
-
+       if (IsServer(sptr))
+               return 0;
         away = sptr->user->away;
         if (parc < 2 || !*awy2)
         {
index b2d3c205080207052113f201ffc1404e0f6cf3f2..c1fae74cf6a2850b9c48155ce96d0a651e9ae159 100644 (file)
@@ -119,10 +119,13 @@ CMD_FUNC(m_cycle)
 {
        char    channels[1024];
        
+       if (IsServer(sptr))
+               return 0;
+
         if (parc < 2)
                 return 0;
         parv[2] = "cycling";
-       strncpy(channels, parv[1], 1020);
+       strncpyzt(channels, parv[1], 1020);
         (void)m_part(cptr, sptr, 3, parv);
        parv[1] = channels;
         parv[2] = NULL;
index 4e0c910d3c0e7fb0950f242c98b2e899b40924d9..b0c8425fe90438b7d0c1bd530c5ffd3e735f0bad 100644 (file)
@@ -160,13 +160,13 @@ DLLFUNC int m_htm(aClient *cptr, aClient *sptr, int parc, char *parv[])
                case 1:
                        break;
                case 2:
-                       x = hunt_server_token(cptr, sptr, MSG_HTM, TOK_HTM, "%s", 1, parc, parv);
+                       x = hunt_server_token_quiet(cptr, sptr, MSG_HTM, TOK_HTM, "%s", 1, parc, parv);
                        break;
                case 3:
-                       x = hunt_server_token(cptr, sptr, MSG_HTM, TOK_HTM, "%s %s", 1, parc, parv);
+                       x = hunt_server_token_quiet(cptr, sptr, MSG_HTM, TOK_HTM, "%s %s", 1, parc, parv);
                        break;
                default:
-                       x = hunt_server_token(cptr, sptr, MSG_HTM, TOK_HTM, "%s %s %s", 1, parc, parv);
+                       x = hunt_server_token_quiet(cptr, sptr, MSG_HTM, TOK_HTM, "%s %s %s", 1, parc, parv);
        }
 
        switch (x) {
@@ -211,17 +211,6 @@ DLLFUNC int m_htm(aClient *cptr, aClient *sptr, int parc, char *parv[])
 
        else
        {
-#if 0
-               char *command = parv[1];
-
-               if (strchr(command, '.'))
-               {
-                       if ((x =
-                           hunt_server_token(cptr, sptr, MSG_HTM, TOK_HTM, "%s", 1, parc,
-                           parv)) != HUNTED_ISME)
-                               return 0;
-               }
-#endif
                if (!stricmp(command, "ON"))
                {
                        EventInfo mod;
index d55719a18f34bea7cc94ab6e67718adbf8d89f7d..b1f84469fcf07f7551adfbd4b09cdbbedc4b372d 100644 (file)
@@ -340,7 +340,7 @@ DLLFUNC int  m_kill(aClient *cptr, aClient *sptr, int parc, char *parv[])
                {
                        if ((killer = index(path, ' ')))
                        {
-                               while (*killer && *killer != '!')
+                               while ((killer >= path) && *killer && *killer != '!')
                                        killer--;
                                if (!*killer)
                                        killer = path;
diff --git a/src/modules/m_kline.c b/src/modules/m_kline.c
deleted file mode 100644 (file)
index 601e1d7..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- *   Unreal Internet Relay Chat Daemon, src/modules/m_kline.c
- *   (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
- *   Moved to modules by Fish (Justin Hammond)
- *
- *   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 "config.h"
-#include "struct.h"
-#include "common.h"
-#include "sys.h"
-#include "numeric.h"
-#include "msg.h"
-#include "channel.h"
-#include <time.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef _WIN32
-#include <io.h>
-#endif
-#include <fcntl.h>
-#include "h.h"
-#include "proto.h"
-#ifdef STRIPBADWORDS
-#include "badwords.h"
-#endif
-#ifdef _WIN32
-#include "version.h"
-#endif
-
-DLLFUNC int m_kline(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-
-/* Place includes here */
-#define MSG_KLINE       "KLINE" /* KLINE */
-#define TOK_KLINE       "W"     /* 87 */
-
-
-
-#ifndef DYNAMIC_LINKING
-ModuleHeader m_kline_Header
-#else
-#define m_kline_Header Mod_Header
-ModuleHeader Mod_Header
-#endif
-  = {
-       "kline",        /* Name of module */
-       "$Id$", /* Version */
-       "command /kline", /* Short description of module */
-       "3.2-b8-1",
-       NULL 
-    };
-
-
-/* The purpose of these ifdefs, are that we can "static" link the ircd if we
- * want to
-*/
-
-/* This is called on module init, before Server Ready */
-#ifdef DYNAMIC_LINKING
-DLLFUNC int    Mod_Init(ModuleInfo *modinfo)
-#else
-int    m_kline_Init(ModuleInfo *modinfo)
-#endif
-{
-       /*
-        * We call our add_Command crap here
-       */
-       add_Command(MSG_KLINE, TOK_KLINE, m_kline, 2);
-       return MOD_SUCCESS;
-       
-}
-
-/* Is first run when server is 100% ready */
-#ifdef DYNAMIC_LINKING
-DLLFUNC int    Mod_Load(int module_load)
-#else
-int    m_kline_Load(int module_load)
-#endif
-{
-       return MOD_SUCCESS;
-       
-}
-
-
-/* Called when module is unloaded */
-#ifdef DYNAMIC_LINKING
-DLLFUNC int    Mod_Unload(int module_unload)
-#else
-int    m_kline_Unload(int module_unload)
-#endif
-{
-       if (del_Command(MSG_KLINE, TOK_KLINE, m_kline) < 0)
-       {
-               sendto_realops("Failed to delete commands when unloading %s",
-                               m_kline_Header.name);
-       }
-       return MOD_SUCCESS;
-}
-
-/*
-** m_kline;
-**     parv[0] = sender prefix
-**     parv[1] = nickname
-**     parv[2] = comment or filename
-*/
-DLLFUNC int m_kline(aClient *cptr, aClient *sptr, int parc, char *parv[])
-{
-       char *host, *tmp, *hosttemp;
-       char uhost[80], name[80];
-       int  ip1, ip2, ip3, i;
-       aClient *acptr;
-       ConfigItem_ban *bconf;
-
-       if (!MyClient(sptr) || !OPCanKline(sptr))
-       {
-               sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
-               return 0;
-       }
-
-
-       if (parc < 2)
-       {
-               sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
-                   me.name, parv[0], "KLINE");
-               return 0;
-       }
-
-
-/* This patch allows opers to quote kline by address as well as nick
- * --Russell
- */
-       if ((hosttemp = (char *)strchr((char *)parv[1], '@')))
-       {
-               *hosttemp = 0;
-               hosttemp++;
-               strlcpy(name, parv[1], sizeof name);
-               strlcpy(uhost, hosttemp, sizeof uhost);
-               
-               
-               if (name[0] == '\0' || uhost[0] == '\0')
-               {
-                       Debug((DEBUG_INFO, "KLINE: Bad field!"));
-                       sendto_one(sptr,
-                           "NOTICE %s :*** If you're going to add a userhost, at LEAST specify both fields",
-                           parv[0]);
-                       return 0;
-               }
-               if (hosttemp)
-               {
-                       hosttemp++;
-                       i = 0;
-                       while (*hosttemp)
-                       {
-                               if (*hosttemp != '*' && *hosttemp != '.' && *hosttemp != '?')
-                                       i++;
-                               hosttemp++;
-                       }
-                       if (i < 4)
-                       {
-                               sendto_one(sptr,
-                                   ":%s NOTICE %s :*** [K:Line error] Too broad mask",
-                                   me.name, sptr->name);
-                               return 0;
-                       }
-               }
-       }
-
-/* by nick */
-       else
-       {
-               if (!(acptr = find_client(parv[1], NULL)))
-               {
-                       if (!(acptr =
-                           get_history(parv[1], (long)KILLCHASETIMELIMIT)))
-                       {
-                               sendto_one(sptr,
-                                   "NOTICE %s :*** Can't find user %s to add KLINE",
-                                   parv[0], parv[1]);
-                               return 0;
-                       }
-               }
-
-               if (!acptr->user)
-                       return 0;
-
-               strlcpy(name, acptr->user->username, sizeof name);
-               if (MyClient(acptr))
-                       host = acptr->sockhost;
-               else
-                       host = acptr->user->realhost;
-
-               /* Sanity checks */
-
-               if (name == '\0' || host == '\0')
-               {
-                       Debug((DEBUG_INFO, "KLINE: Bad field"));
-                       sendto_one(sptr, "NOTICE %s :*** Bad field!", parv[0]);
-                       return 0;
-               }
-
-               /* Add some wildcards */
-
-               /*
-                * sscanf is bad :/ at least make host < uhost
-                */
-               if (strlen(host) > sizeof uhost)
-                       host[sizeof uhost - 1] = '\0';
-
-               strlcpy(uhost, host, sizeof uhost);
-
-               if (isdigit(host[strlen(host) - 1]))
-               {
-                       if (sscanf(host, "%d.%d.%d.%*d", &ip1, &ip2, &ip3))
-                               ircsprintf(uhost, "%d.%d.%d.*", ip1, ip2, ip3);
-               }
-               else if (sscanf(host, "%*[^.].%*[^.].%s", uhost))
-               {               /* Not really... */
-                       tmp = (char *)strchr(host, '.');
-                       ircsprintf(uhost, "*%s", tmp);
-               }
-       }
-
-       sendto_realops("%s added a temporary user ban for %s@%s %s", parv[0], name, uhost,
-           parv[2] ? parv[2] : "");
-       ircd_log(LOG_KLINE, "%s added a temporary user ban for %s@%s %s",
-          parv[0], name, uhost,
-           parv[2] ? parv[2] : "");
-       bconf = (ConfigItem_ban *)MyMallocEx(sizeof(ConfigItem_ban));
-       bconf->flag.type = CONF_BAN_USER;
-       bconf->mask = strdup(make_user_host(name, uhost));
-       bconf->reason = parv[2] ? strdup(parv[2]) : NULL;
-       bconf->flag.type2 = CONF_BAN_TYPE_TEMPORARY;
-       AddListItem(bconf, conf_ban);
-       loop.do_bancheck = 1;
-       return 0;
-}
index 7a66b3a3bd8e6d80ff1097c6c79658a32aad3406..68161b94687f3b88f770daa8c0acb207ae6cb184 100644 (file)
@@ -136,10 +136,6 @@ int        m_message_Unload(int module_unload)
 ** rev argv 6/91
 **
 */
-#define PREFIX_HALFOP  0x1
-#define PREFIX_VOICE   0x2
-#define PREFIX_OP      0x4
-
 DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int notice)
 {
        aClient *acptr;
index 35e8bd4e50c87bc8c2284395f3fd39ac9d112ea3..1b54f9a5a8e707531a61d61b9cad3926afe0d5d8 100644 (file)
@@ -158,6 +158,9 @@ DLLFUNC int  m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
        int i = 0, j = 0;
        char* announce = 0;
 
+       if (IsServer(sptr))
+               return 0;
+
        if (parc < 3) {
                sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
                    me.name, parv[0], "OPER");
@@ -264,15 +267,15 @@ DLLFUNC int  m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
 
                if (announce != NULL) {
                        sendto_ops
-                           ("%s (%s@%s) %s",
+                           ("%s (%s@%s) [%s] %s",
                            parv[0], sptr->user->username,
                            IsHidden(sptr) ? sptr->user->virthost : sptr->
-                           user->realhost, announce);
+                           user->realhost, parv[1], announce);
                                sendto_serv_butone(&me,
-                                   ":%s GLOBOPS :%s (%s@%s) %s",
+                                   ":%s GLOBOPS :%s (%s@%s) [%s] %s",
                                    me.name, parv[0], sptr->user->username,
                                    IsHidden(sptr) ? sptr->
-                                   user->virthost : sptr->user->realhost, announce);
+                                   user->virthost : sptr->user->realhost, parv[1], announce);
 
                } 
                if (!aconf->snomask)
@@ -304,11 +307,6 @@ DLLFUNC int  m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
                        };
                        (void)m_join(cptr, sptr, 3, chans);
                }
-
-#if defined(USE_SYSLOG) && defined(SYSLOG_OPER)
-               syslog(LOG_INFO, "OPER (%s) by (%s!%s@%s)",
-                   name, parv[0], sptr->user->username, sptr->sockhost);
-#endif
                ircd_log(LOG_OPER, "OPER (%s) by (%s!%s@%s)", name, parv[0], sptr->user->username,
                        sptr->sockhost);
 
index a03077b34f726b210d442b1365a59c2ff44697a6..b21f963558a4196d864c5e483e7c7e3767e4cb9e 100644 (file)
@@ -121,7 +121,7 @@ int m_quit_Unload(int module_unload)
 DLLFUNC int  m_quit(aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
        char *ocomment = (parc > 1 && parv[1]) ? parv[1] : parv[0];
-       static char comment[TOPICLEN];
+       static char comment[TOPICLEN + 1];
 
        if (!IsServer(cptr))
        {
index 18a186346a4f145cad26aa1c101a209271e26c30..0f32e5b94fd6f34a51ab8dac1a719a41697004bd 100644 (file)
@@ -122,8 +122,6 @@ int m_rakill_Unload(int module_unload)
 */
 DLLFUNC int m_rakill(aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
-       char *hostmask, *usermask;
-       char    mo[1024];
        char *tkllayer[6] = {
                me.name,        /*0  server.name */
                "-",            /*1  - */
diff --git a/src/modules/m_svslusers.c b/src/modules/m_svslusers.c
new file mode 100644 (file)
index 0000000..446d4b1
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ *   IRC - Internet Relay Chat, src/modules/m_svslusers.c
+ *   (C) 2002 codemastr [Dominick Meglio] (codemastr@unrealircd.com)
+ *
+ *   SVSLUSERS command, allows remote setting of local and global max user count
+ *
+ *   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 "config.h"
+#include "struct.h"
+#include "common.h"
+#include "sys.h"
+#include "numeric.h"
+#include "msg.h"
+#include "channel.h"
+#include <time.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _WIN32
+#include <io.h>
+#endif
+#include <fcntl.h>
+#include "h.h"
+#include "proto.h"
+#ifdef STRIPBADWORDS
+#include "badwords.h"
+#endif
+#ifdef _WIN32
+#include "version.h"
+#endif
+extern ircstats IRCstats;
+DLLFUNC int m_svslusers(aClient *cptr, aClient *sptr, int parc, char *parv[]);
+
+#define MSG_SVSLUSERS  "SVSLUSERS"     
+#define TOK_SVSLUSERS  "BU"    
+
+
+#ifndef DYNAMIC_LINKING
+ModuleHeader m_svslusers_Header
+#else
+#define m_svslusers_Header Mod_Header
+ModuleHeader Mod_Header
+#endif
+  = {
+       "m_svslusers",
+       "$Id$",
+       "command /svslusers", 
+       "3.2-b8-1",
+       NULL 
+    };
+
+#ifdef DYNAMIC_LINKING
+DLLFUNC int    Mod_Init(ModuleInfo *modinfo)
+#else
+int    m_svslusers_Init(ModuleInfo *modinfo)
+#endif
+{
+       add_Command(MSG_SVSLUSERS, TOK_SVSLUSERS, m_svslusers, MAXPARA);
+       return MOD_SUCCESS;
+}
+
+#ifdef DYNAMIC_LINKING
+DLLFUNC int    Mod_Load(int module_load)
+#else
+int    m_svslusers_Load(int module_load)
+#endif
+{
+       return MOD_SUCCESS;
+}
+
+#ifdef DYNAMIC_LINKING
+DLLFUNC int    Mod_Unload(int module_unload)
+#else
+int    m_svslusers_Unload(int module_unload)
+#endif
+{
+       if (del_Command(MSG_SVSLUSERS, TOK_SVSLUSERS, m_svslusers) < 0)
+       {
+               sendto_realops("Failed to delete commands when unloading %s",
+                               m_svslusers_Header.name);
+       }
+       return MOD_SUCCESS;
+}
+/*
+** m_svslusers
+**      parv[0] = sender
+**      parv[1] = server to update
+**      parv[2] = max global users
+**      parv[3] = max local users
+**      If -1 is specified for either number, it is ignored and the current count
+**      is kept.
+*/
+int  m_svslusers(aClient *cptr, aClient *sptr, int parc, char *parv[])
+{
+        aClient *acptr;
+
+        if (!IsULine(sptr) || parc < 4)
+               return -1;  
+        if (hunt_server_token(cptr, sptr, MSG_SVSLUSERS, TOK_SVSLUSERS, "%s %s :%s", 1, parc,
+               parv) == HUNTED_ISME)
+        {
+               int temp;
+               temp = atoi(parv[2]);
+               if (temp >= 0)
+                       IRCstats.global_max = temp;
+               temp = atoi(parv[3]);
+               if (temp >= 0) 
+                       IRCstats.me_max = temp;
+        }
+        return 0;
+}
index 51bbb47fb9c47e2a37a73549996e8572085ced7b..c1be335aa8d078b699dc3da9107f202809116ba3 100644 (file)
@@ -480,6 +480,7 @@ int  m_svs2mode(aClient *cptr, aClient *sptr, int parc, char *parv[])
                                   if (what == MODE_DEL
                                       && (acptr->umodes & UMODE_OPER))
                                           IRCstats.operators--;
+                                 goto setmodey;
                          case 'H':
                                  if (what == MODE_ADD && !(acptr->umodes & UMODE_HIDEOPER))
                                        IRCstats.operators--;
index 5b3423fe9537daf973ca69f99da1240f247c86a2..416b4fea8e514b9fdbf25417865aeac2719d4b1b 100644 (file)
@@ -41,8 +41,8 @@ DLLFUNC int m_tkl_line(aClient *cptr, aClient *sptr, int parc, char *parv[], cha
 #define MSG_SHUN "SHUN"
 #define TOK_SHUN "BL"
 #define MSG_GZLINE "GZLINE"
-#define MSG_TKLINE "TKLINE"
-#define MSG_TZLINE "TZLINE"
+#define MSG_KLINE "KLINE"
+#define MSG_ZLINE "ZLINE"
 #define TOK_NONE ""
 
 #ifndef DYNAMIC_LINKING
@@ -76,8 +76,8 @@ int    m_tkl_Init(ModuleInfo *modinfo)
        */
        add_Command(MSG_GLINE, TOK_GLINE, m_gline, 3);
        add_Command(MSG_SHUN, TOK_SHUN, m_shun, 3);
-       add_Command(MSG_TZLINE, TOK_NONE, m_tzline, 3);
-       add_Command(MSG_TKLINE, TOK_NONE, m_tkline, 3);
+       add_Command(MSG_ZLINE, TOK_NONE, m_tzline, 3);
+       add_Command(MSG_KLINE, TOK_NONE, m_tkline, 3);
        add_Command(MSG_GZLINE, TOK_NONE, m_gzline, 3);
        return MOD_SUCCESS;
 }
@@ -102,9 +102,9 @@ int m_tkl_Unload(int module_unload)
 {
        if ((del_Command(MSG_GLINE, TOK_GLINE, m_gline) < 0) ||
            (del_Command(MSG_SHUN, TOK_SHUN, m_shun) < 0 ) ||
-           (del_Command(MSG_TZLINE, TOK_NONE, m_tzline) < 0) ||
+           (del_Command(MSG_ZLINE, TOK_NONE, m_tzline) < 0) ||
            (del_Command(MSG_GZLINE, TOK_NONE, m_gzline) < 0) ||
-           (del_Command(MSG_TKLINE, TOK_NONE, m_tkline) < 0))
+           (del_Command(MSG_KLINE, TOK_NONE, m_tkline) < 0))
 
        {
                sendto_realops("Failed to delete commands when unloading %s",
@@ -206,7 +206,11 @@ DLLFUNC int m_tkline(aClient *cptr, aClient *sptr, int parc, char *parv[])
                tkl_stats(sptr);
                return 0;
        }
-
+       if (!OPCanUnKline(sptr) && *parv[1] == '-')
+       {
+               sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
+               return 0;
+       }
        return m_tkl_line(cptr, sptr, parc, parv, "k");
 
 }
@@ -249,6 +253,7 @@ DLLFUNC int  m_tkl_line(aClient *cptr, aClient *sptr, int parc, char *parv[], ch
        TS   secs;
        int  whattodo = 0;      /* 0 = add  1 = del */
        int  i;
+       aClient *acptr = NULL;
        char *mask = NULL;
        char mo[1024], mo2[1024];
        char *p, *usermask, *hostmask;
@@ -291,8 +296,34 @@ DLLFUNC int  m_tkl_line(aClient *cptr, aClient *sptr, int parc, char *parv[], ch
 
        /* Check if its a hostmask and legal .. */
        p = strchr(mask, '@');
-
-       if (p && !whattodo)
+       if (p) {
+               usermask = strtok(mask, "@");
+               hostmask = strtok(NULL, "");
+               if (BadPtr(hostmask)) {
+                       if (BadPtr(usermask)) {
+                               return 0;
+                       }
+                       hostmask = usermask;
+                       usermask = "*";
+               }
+               p = hostmask-1;
+       }
+       else
+       {
+               /* It's seemingly a nick .. let's see if we can find the user */
+               if ((acptr = find_client(mask, NULL)) && IsPerson(acptr))
+               {
+                       usermask = "*";
+                       hostmask = acptr->user->realhost;
+                       p = hostmask - 1;
+               }
+               else
+               {
+                       sendto_one(sptr, rpl_str(ERR_NOSUCHNICK), me.name, sptr->name, mask);
+                       return 0;
+               }
+       }       
+       if (!whattodo)
        {
                p++;
                i = 0;
@@ -311,15 +342,6 @@ DLLFUNC int  m_tkl_line(aClient *cptr, aClient *sptr, int parc, char *parv[], ch
                }
        }
 
-       usermask = strtok(mask, "@");
-       hostmask = strtok(NULL, "");
-       if (BadPtr(hostmask)) {
-               if (BadPtr(usermask)) {
-                       return 0;
-               }
-               hostmask = usermask;
-               usermask = "*";
-       }
        tkl_check_expire(NULL);
 
        secs = 0;
index 3e388727cb006acf41d573de18d9b41fd78b2526..1f715692e18ed205ff95969b81c616bfbfff8d40 100644 (file)
@@ -209,7 +209,7 @@ DLLFUNC int m_tsctl(aClient *cptr, aClient *sptr, int parc, char *parv[])
                }
                if (strcmp(parv[1], "svstime") == 0)
                {
-                       if (parv[2] == '\0')
+                       if (!parv[2] || *parv[2] == '\0')
                        {
                                return 0;
                        }
index c9b1696b4e2e9e843f69ed89f5c12953402b81d0..fadde4a8f31f843bdd3f5ec8331af1069d999fad 100644 (file)
@@ -127,61 +127,7 @@ DLLFUNC int m_unkline(aClient *cptr, aClient *sptr, int parc, char *parv[])
                sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
                return 0;
        }
-       if (parc < 2)
-       {
-               sendto_one(sptr, ":%s NOTICE %s :*** Not enough parameters", me.name, parv[0]);
-               return 0;
-       }
-       if ((hosttemp = (char *)strchr((char *)parv[1], '@')))
-       {
-               *hosttemp = 0;
-               hosttemp++;
-               bzero(name, sizeof(name));
-               bzero(host, sizeof(host));
-               
-               strncpy(name, parv[1], sizeof(name) - 1);
-               strncpy(host, hosttemp, sizeof(host) - 1);
-               if (name[0] == '\0' || host[0] == '\0')
-               {
-                       Debug((DEBUG_INFO, "UNKLINE: Bad field"));
-                       sendto_one(sptr,
-                           ":%s NOTICE %s :*** Both user and host fields must be non-null",
-                           me.name, parv[0]);
-                       return 0;
-               }
-               if (!(bconf = Find_banEx(make_user_host(name, host), CONF_BAN_USER, CONF_BAN_TYPE_TEMPORARY)))
-               {
-                       sendto_one(sptr, ":%s NOTICE %s :*** Cannot find user ban %s@%s",
-                               me.name, parv[0], name, host);
-                       return 0;
-               }
-               if (bconf->flag.type2 != CONF_BAN_TYPE_TEMPORARY)
-               {
-                       sendto_one(sptr, ":%s NOTICE %s :*** You cannot remove permament user bans",
-                               me.name, sptr->name);
-                       return 0;
-               }
-               
-               DelListItem(bconf, conf_ban);
-               if (bconf->mask)
-                       MyFree(bconf->mask);
-               if (bconf->reason)
-                       MyFree(bconf->reason);
-               MyFree(bconf);
-               
-               sendto_one(sptr,
-                       ":%s NOTICE %s :*** Temporary user ban %s@%s is now removed.",
-                           me.name, parv[0], name, host);
-               sendto_realops("%s removed temporary user ban %s@%s", parv[0],
-                   name, host);
-               ircd_log(LOG_KLINE,
-                   "%s removed temporary user ban %s@%s",
-                   parv[0], name, host);
-               return 0;
-       }
-       /* This wasn't here before -- Barubary */
-       /* check_pings crap */
-       /* No, and it shouldn't have been, dork. It crashes the IRCd randomly. -Stskeeps */ 
-       loop.do_bancheck = 1;
+       sendto_one(sptr, ":%s NOTICE %s :Please use /kline -user@host", me.name, parv[0]);
+
        return 0;
 }
index 5c0c2ec9a18fcff9f01fd675cd2fee9ea84dbcd3..ede5b399f7c78299f02e080c9721183705d71572 100644 (file)
@@ -124,112 +124,13 @@ DLLFUNC int m_unzline(aClient *cptr, aClient *sptr, int parc, char *parv[])
        ConfigItem_ban *bconf;
        uline = IsULine(sptr) ? 1 : 0;
 
-       if (parc < 2)
-       {
-               sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
-                   me.name, parv[0], "UNZLINE");
-               return -1;
-       }
-
-
-       if (parc < 3 || !uline)
-       {
-               mask = parv[parc - 1];
-               server = NULL;
-       }
-       else if (parc == 3)
-       {
-               mask = parv[parc - 2];
-               server = parv[parc - 1];
-       }
-
-       if (!uline && (!MyConnect(sptr) || !OPCanZline(sptr) || !IsOper(sptr)))
-       {
-               sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
-               return -1;
-       }
-
-       /* before we even check ourselves we need to do the uline checks
-          because we aren't supposed to add a z:line if the message is
-          destined to be passed on... */
-
-       if (uline)
-       {
-               if (parc == 3 && server)
-               {
-                       if (hunt_server_token(cptr, sptr, MSG_UNZLINE, TOK_UNZLINE, "%s %s", 2,
-                           parc, parv) != HUNTED_ISME)
-                               return 0;
-                       else;
-               }
-               else
-                       sendto_serv_butone(cptr, ":%s UNZLINE %s", parv[0],
-                           parv[1]);
-
-       }
-
+        if (!MyClient(sptr) || !OPCanZline(sptr))
+        {
+                sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
+                return 0;
+        }
 
-       /* parse the removal mask the same way so an oper can just use
-          the same thing to remove it if they specified *@ or something... */
-       if ((in = index(parv[1], '@')))
-       {
-               strlcpy(userhost, in + 1, sizeof userhost);
-               in = &userhost[0];
-               while (*in)
-               {
-                       if (!isdigit(*in) && !ispunct(*in))
-                       {
-                               sendto_one(sptr,
-                                   ":%s NOTICE %s :*** it's not possible to have a z:line that's not an ip addresss...",
-                                   me.name, sptr->name);
-                               return 0;
-                       }
-                       in++;
-               }
-       }
-       else
-       {
-               strlcpy(userhost, parv[1], sizeof userhost);
-               in = &userhost[0];
-               while (*in)
-               {
-                       if (!isdigit(*in) && !ispunct(*in))
-                       {
-                               sendto_one(sptr,
-                                   ":%s NOTICE %s :*** it's not possible to have a z:line that's not an ip addresss...",
-                                   me.name, sptr->name);
-                               return 0;
-                       }
-                       in++;
-               }
-       }
-
-       akill = 0;
-       bconf = Find_ban(userhost, CONF_BAN_IP);
-       if (!bconf)
-       {
-               if (MyClient(sptr))
-                       sendto_one(sptr, ":%s NOTICE %s :*** Cannot find z:line %s",
-                               me.name, sptr->name, userhost);
-               return 0;
-       }
-       
-       if (uline == 0)
-       {
-               if (bconf->flag.type2 != CONF_BAN_TYPE_TEMPORARY)
-               {
-                       sendto_one(sptr, ":%s NOTICE %s :*** You may not remove permanent z:lines.",
-                               me.name, sptr->name);
-                       return 0;
-               }                       
-       }
-       DelListItem(bconf, conf_ban);
-       sendto_realops("%s removed z:line %s", parv[0], userhost);
-       if (bconf->mask)
-               MyFree(bconf->mask);
-       if (bconf->reason)
-               MyFree(bconf->reason);
-       MyFree(bconf);
+        sendto_one(sptr, ":%s NOTICE %s :Please use /zline -user@host", me.name, parv[0]);
 
        return 0;
 }
index 14f117d703c26b414f843134d4d5404f11ea5a7b..99c8676d3d43c621a59ae9001871994f7fc703e3 100644 (file)
@@ -182,6 +182,14 @@ int  m_vhost(aClient *cptr, aClient *sptr, int parc, char *parv[])
                        "%s", vhost->virthost);
                sendto_one(sptr, ":%s MODE %s :+tx",
                    sptr->name, sptr->name);
+               if (vhost->swhois) {
+                       if (sptr->user->swhois)
+                               MyFree(sptr->user->swhois);
+                       sptr->user->swhois = MyMalloc(strlen(vhost->swhois) +1);
+                       strcpy(sptr->user->swhois, vhost->swhois);
+                       sendto_serv_butone_token(cptr, sptr->name,
+                               MSG_SWHOIS, TOK_SWHOIS, "%s :%s", sptr->name, vhost->swhois);
+               }
                sendto_one(sptr,
                    ":%s NOTICE %s :*** Your vhost is now %s%s%s",
                    me.name, sptr->name, vhost->virtuser ? vhost->virtuser : "", 
index 39cdea766b8ae4952e3a54f14626eb84e15bc7f3..18ab3ebe4c110e45e15e76e3a9446032195047e0 100644 (file)
@@ -146,9 +146,7 @@ struct {
 
 DLLFUNC int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
-  aClient *target_client;
   aChannel *target_channel;
-  int opers_only = 0;
   char *mask = parv[1];
   char star[] = "*";
   int i = 0;
@@ -191,6 +189,12 @@ DLLFUNC int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
       sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
       return 0;
     }
+  if (wfl.channel && wfl.want_channel == WHO_WANT && (target_channel =
+      find_channel(wfl.channel, NULL)) != NULL) {
+      do_channel_who(sptr, target_channel, mask);
+      sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
+      return 0;
+  }
   else
     {
       do_other_who(sptr, mask);
@@ -240,7 +244,7 @@ static void who_sendhelp(aClient *sptr)
 static int parse_who_options(aClient *sptr, int argc, char **argv)
 {
   char *s = argv[0];
-  int what;
+  int what = WHO_ADD;
   int i = 1;
 
   if (*s != '-' && *s != '+')
@@ -290,7 +294,7 @@ static int parse_who_options(aClient *sptr, int argc, char **argv)
            }
          
          if (!IsAnOper(sptr))
-           continue; /* oper-only */
+           break; /* oper-only */
 
          wfl.gecos = argv[i];
          if (what == WHO_ADD)
@@ -447,16 +451,17 @@ static int can_see(aClient *sptr, aClient *acptr, aChannel *channel)
        if (!IsAnOper(acptr))
          return ret | WHO_CANTSEE;
 
-       if (IsHideOper(acptr))
+       if (IsHideOper(acptr)) {
          if (IsAnOper(sptr))
            ret |= WHO_OPERSEE;
          else
            return ret | WHO_CANTSEE;
+       }
       }
 
     /* if they only want people who are away */
     if ((wfl.want_away == WHO_WANT && !acptr->user->away) ||
-       wfl.want_away == WHO_DONTWANT && acptr->user->away)
+       (wfl.want_away == WHO_DONTWANT && acptr->user->away))
       return WHO_CANTSEE;
 
     /* if they only want people on a certain channel. */
@@ -505,7 +510,7 @@ static int can_see(aClient *sptr, aClient *acptr, aChannel *channel)
          host = acptr->user->realhost;
        else
          {
-           if (IsHidden(sptr))
+           if (IsHidden(acptr))
              host = acptr->user->virthost;
            else
              host = acptr->user->realhost;
@@ -746,9 +751,7 @@ static void send_who_reply(aClient *sptr, aClient *acptr,
 
 static char *first_visible_channel(aClient *sptr, aClient *acptr, int *flg)
 {
-  aChannel *chptr;
   Membership *lp;
-  static char chbuf[CHANNELLEN + 2];
 
   *flg = 0;
 
index d263dcf056694fe7e04602f493c52ed6a3f500c9..a759c83b195c7ca9aa45758312f1e87d5ac11adb 100644 (file)
@@ -139,7 +139,8 @@ DLLFUNC int  m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[])
        char *p = NULL;
        int  found, len, mlen;
 
-
+       if (IsServer(sptr))     
+               return 0;
 
        if (parc < 2)
        {
diff --git a/src/modules/m_zline.c b/src/modules/m_zline.c
deleted file mode 100644 (file)
index e92d59c..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- *   Unreal Internet Relay Chat Daemon, src/modules/m_zline.c
- *   (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
- *   Moved to modules by Fish (Justin Hammond)
- *
- *   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 "config.h"
-#include "struct.h"
-#include "common.h"
-#include "sys.h"
-#include "numeric.h"
-#include "msg.h"
-#include "channel.h"
-#include <time.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef _WIN32
-#include <io.h>
-#endif
-#include <fcntl.h>
-#include "h.h"
-#include "proto.h"
-#ifdef STRIPBADWORDS
-#include "badwords.h"
-#endif
-#ifdef _WIN32
-#include "version.h"
-#endif
-
-DLLFUNC int m_zline(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-
-/* Place includes here */
-#define MSG_ZLINE       "ZLINE" /* ZLINE */
-#define TOK_ZLINE       "q"     /* 112 */
-
-
-#ifndef DYNAMIC_LINKING
-ModuleHeader m_zline_Header
-#else
-#define m_zline_Header Mod_Header
-ModuleHeader Mod_Header
-#endif
-  = {
-       "zline",        /* Name of module */
-       "$Id$", /* Version */
-       "command /zline", /* Short description of module */
-       "3.2-b8-1",
-       NULL 
-    };
-
-
-/* The purpose of these ifdefs, are that we can "static" link the ircd if we
- * want to
-*/
-
-/* This is called on module init, before Server Ready */
-#ifdef DYNAMIC_LINKING
-DLLFUNC int    Mod_Init(ModuleInfo *modinfo)
-#else
-int    m_zline_Init(ModuleInfo *modinfo)
-#endif
-{
-       /*
-        * We call our add_Command crap here
-       */
-       add_Command(MSG_ZLINE, TOK_ZLINE, m_zline, 2);
-       return MOD_SUCCESS;
-}
-
-/* Is first run when server is 100% ready */
-#ifdef DYNAMIC_LINKING
-DLLFUNC int    Mod_Load(int module_load)
-#else
-int    m_zline_Load(int module_load)
-#endif
-{
-       return MOD_SUCCESS;
-}
-
-
-/* Called when module is unloaded */
-#ifdef DYNAMIC_LINKING
-DLLFUNC int    Mod_Unload(int module_unload)
-#else
-int    m_zline_Unload(int module_unload)
-#endif
-{
-       if (del_Command(MSG_ZLINE, TOK_ZLINE, m_zline) < 0)
-       {
-               sendto_realops("Failed to delete commands when unloading %s",
-                               m_zline_Header.name);
-       }
-       return MOD_SUCCESS;
-}
-
-
-/*
- *  m_zline                       add a temporary zap line
- *    parv[0] = sender prefix
- *    parv[1] = host
- *    parv[2] = reason
- */
-
-DLLFUNC int m_zline(aClient *cptr, aClient *sptr, int parc, char *parv[])
-{
-       char userhost[512 + 2] = "", *in;
-       int  uline = 0, propo = 0;
-       char *reason, *mask, *server, *person;
-       aClient *acptr;
-       ConfigItem_ban *bconf;
-       
-       reason = mask = server = person = NULL;
-
-       reason = ((parc >= 3) ? parv[parc - 1] : "Reason unspecified");
-       mask = ((parc >= 2) ? parv[parc - 2] : NULL);
-       server = ((parc >= 4) ? parv[parc - 1] : NULL);
-
-       if (parc == 4)
-       {
-               mask = parv[parc - 3];
-               server = parv[parc - 2];
-               reason = parv[parc - 1];
-       }
-
-       uline = IsULine(sptr) ? 1 : 0;
-
-       if (!uline && (!MyConnect(sptr) || !OPCanZline(sptr) || !IsOper(sptr)))
-       {
-               sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
-               return -1;
-       }
-
-       if (uline)
-       {
-               if (parc >= 4 && server)
-               {
-                       if (hunt_server_token(cptr, sptr, MSG_ZLINE, TOK_ZLINE, "%s %s :%s", 2,
-                           parc, parv) != HUNTED_ISME)
-                               return 0;
-                       else;
-               }
-               else
-                       propo = 1;
-       }
-
-       if (parc < 2)
-       {
-               sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
-                   me.name, parv[0], "ZLINE");
-               return -1;
-       }
-
-       if ((acptr = find_client(parv[1], NULL)))
-       {
-               strlcpy(userhost, inetntoa((char *)&acptr->ip), sizeof userhost);
-               person = &acptr->name[0];
-               acptr = NULL;
-       }
-       /* z-lines don't support user@host format, they only 
-          work with ip addresses and nicks */
-       else if ((in = index(parv[1], '@')) && (*(in + 1) != '\0'))
-       {
-               strlcpy(userhost, in + 1, sizeof userhost);
-               in = &userhost[0];
-               while (*in)
-               {
-                       if (!isdigit(*in) && !ispunct(*in))
-                       {
-                               sendto_one(sptr,
-                                   ":%s NOTICE %s :*** z:lines work only with ip addresses (you cannot specify ident either)",
-                                   me.name, sptr->name);
-                               return 0;
-                       }
-                       in++;
-               }
-       }
-       else if (in && !(*(in + 1)))    /* sheesh not only specifying a ident@, but
-                                          omitting the ip...? */
-       {
-               sendto_one(sptr,
-                   ":%s NOTICE %s :*** Hey! z:lines need an ip address...",
-                   me.name, sptr->name);
-               return -1;
-       }
-       else
-       {
-               strlcpy(userhost, parv[1], sizeof userhost);
-               in = &userhost[0];
-               while (*in)
-               {
-                       if (!isdigit(*in) && !ispunct(*in))
-                       {
-                               sendto_one(sptr,
-                                   ":%s NOTICE %s :*** z:lines work only with ip addresses (you cannot specify ident either)",
-                                   me.name, sptr->name);
-                               return 0;
-                       }
-                       in++;
-               }
-       }
-
-       /* this'll protect against z-lining *.* or something */
-       if (advanced_check(userhost, TRUE) == FALSE)
-       {
-               sendto_ops("Bad z:line mask from %s *@%s [%s]", parv[0],
-                   userhost, reason ? reason : "");
-               if (MyClient(sptr))
-                       sendto_one(sptr,
-                           ":%s NOTICE %s :** *@%s is a bad z:line mask...",
-                           me.name, sptr->name, userhost);
-               return 0;
-       }
-
-       if (!(bconf = Find_ban(userhost, CONF_BAN_IP)))
-       {
-               if (uline == 0)
-               {
-                       if (person)     
-                               sendto_realops("%s added a temp z:line for %s (*@%s) [%s]",
-                                   parv[0], person, userhost, reason ? reason : "");
-                       else
-                               sendto_realops("%s added a temp z:line *@%s [%s]", parv[0],
-                                   userhost, reason ? reason : "");
-               }
-               else
-               {
-                       if (person)
-                               sendto_ops("%s z:lined %s (*@%s) on %s [%s]", parv[0],
-                                   person, userhost, server ? server : ircnetwork,
-                                   reason ? reason : "");
-                       else
-                               sendto_ops("%s z:lined *@%s on %s [%s]", parv[0],
-                                   userhost, server ? server : ircnetwork,
-                                   reason ? reason : "");
-               
-               }
-               bconf = (ConfigItem_ban *) MyMallocEx(sizeof(ConfigItem_ban));
-               bconf->flag.type = CONF_BAN_IP;
-               bconf->mask = strdup(userhost);
-               bconf->reason = strdup(reason);
-               bconf->flag.type2 = uline ? CONF_BAN_TYPE_AKILL : CONF_BAN_TYPE_TEMPORARY;
-       }
-       else
-       {
-               goto propo_label;
-       }
-       AddListItem(bconf, conf_ban);
-propo_label:
-       if (propo == 1)         /* propo is if a ulined server is propagating a z-line
-                                  this should go after the above check */
-               sendto_serv_butone(cptr, ":%s ZLINE %s :%s", parv[0], parv[1],
-                   reason ? reason : "");
-
-       loop.do_bancheck = 1;
-       return 0;
-}
index 120fd2915c694ea8c8b14f076021ff9fbb6e1cad..719c8112c0c8d801c300aa6be4146d0d31212e92 100644 (file)
@@ -60,11 +60,23 @@ int Scan_BanTime = 0, Scan_TimeOut = 0;
 static Scan_AddrStruct *Scannings = NULL;
 MUTEX Scannings_lock;
 static char    *scan_message;
-
+extern ConfigEntry             *config_find_entry(ConfigEntry *ce, char *name);
 DLLFUNC int h_scan_connect(aClient *sptr);
-DLLFUNC int    h_config_set_scan(void);
+DLLFUNC int h_config_test(ConfigFile *, ConfigEntry *, int, int *);
+DLLFUNC int h_config_run(ConfigFile *, ConfigEntry *, int);
+DLLFUNC int h_config_posttest(int *);
+DLLFUNC int h_config_rehash();
 DLLFUNC int h_stats_scan(aClient *sptr, char *stats);
 
+struct requiredconfig {
+       int endpoint :1;
+       int timeout :1;
+       int bantime :1;
+       int bindip :1;
+};
+
+struct requiredconfig ReqConf;
+
 #ifndef DYNAMIC_LINKING
 ModuleHeader m_scan_Header
 #else
@@ -82,10 +94,24 @@ ModuleHeader Mod_Header
 EVENT(e_scannings_clean);
 
 static Event   *Scannings_clean = NULL;
-static Hook    *LocConnect = NULL, *ConfUnknown = NULL, *ServerStats = NULL;
+static Hook    *LocConnect = NULL, *ConfTest = NULL, *ConfRun = NULL, *ServerStats = NULL;
+static Hook    *ConfPostTest = NULL, *ConfRehash = NULL;
 static Hooktype *ScanHost = NULL;
 static int HOOKTYPE_SCAN_HOST;
 ModuleInfo ScanModInfo;
+
+#ifdef DYNAMIC_LINKING
+DLLFUNC int    Mod_Test(ModuleInfo *modinfo)
+#else
+int    m_scan_Test(ModuleInfo *modinfo)
+#endif
+{
+       bcopy(modinfo,&ScanModInfo,modinfo->size);
+       ConfTest = HookAddEx(ScanModInfo.handle, HOOKTYPE_CONFIGTEST, h_config_test);
+       ConfPostTest = HookAddEx(ScanModInfo.handle, HOOKTYPE_CONFIGPOSTTEST, h_config_posttest);
+       return MOD_SUCCESS;
+}
+
 /* This is called on module init, before Server Ready */
 #ifdef DYNAMIC_LINKING
 DLLFUNC int    Mod_Init(ModuleInfo *modinfo)
@@ -93,12 +119,13 @@ DLLFUNC int        Mod_Init(ModuleInfo *modinfo)
 int    m_scan_Init(ModuleInfo *modinfo)
 #endif
 {
-       int id;
        scan_message = NULL;
        bcopy(modinfo,&ScanModInfo,modinfo->size);
+       bzero(&ReqConf, sizeof(ReqConf));
        ScanHost = (Hooktype *)HooktypeAdd(modinfo->handle, "HOOKTYPE_SCAN_HOST", &HOOKTYPE_SCAN_HOST);
        LocConnect = HookAddEx(ScanModInfo.handle, HOOKTYPE_LOCAL_CONNECT, h_scan_connect);
-       ConfUnknown = HookAddEx(ScanModInfo.handle, HOOKTYPE_CONFIG_UNKNOWN, h_config_set_scan);
+       ConfRun = HookAddEx(ScanModInfo.handle, HOOKTYPE_CONFIGRUN, h_config_run);
+       ConfRehash = HookAddEx(ScanModInfo.handle, HOOKTYPE_REHASH, h_config_rehash);
        ServerStats = HookAddEx(ScanModInfo.handle, HOOKTYPE_STATS, h_stats_scan);
        bzero(&Scan_bind, sizeof(Scan_bind));
        IRCCreateMutex(Scannings_lock);
@@ -112,36 +139,6 @@ DLLFUNC int        Mod_Load(int module_load)
 int    m_scan_Load(int module_load)
 #endif
 {
-       if (Scan_endpoint.SIN_PORT == 0)
-       {
-               
-               if (*conf_listen->ip == '*') {
-                       ircd_log(LOG_ERROR, "Scan.so failed to load: set::scan::endpoint is missing");
-                       HooktypeDel(ScanHost,ScanModInfo.handle);
-                       HookDel(LocConnect);
-                       HookDel(ConfUnknown);
-                       HookDel(ServerStats);
-                       LockEventSystem();
-                       EventDel(Scannings_clean);
-                       UnlockEventSystem();
-                       IRCMutexDestroy(Scannings_lock);
-                       return MOD_FAILED;
-               }
-
-#ifndef INET6
-               Scan_endpoint.SIN_ADDR.S_ADDR = inet_addr(conf_listen->ip);
-#else
-               inet_pton(AFINET, conf_listen->ip, Scan_endpoint.SIN_ADDR.S_ADDR);
-#endif
-               Scan_endpoint.SIN_PORT = htons(conf_listen->port);
-               Scan_endpoint.SIN_FAMILY = AFINET;
-       }
-       
-       if (Scan_BanTime == 0)
-               Scan_BanTime = 86400;
-
-       if (Scan_TimeOut == 0)
-               Scan_TimeOut = 20;
        LockEventSystem();
        Scannings_clean = EventAddEx(ScanModInfo.handle, "e_scannings_clean", 0, 0, e_scannings_clean, NULL);
        UnlockEventSystem();
@@ -175,7 +172,9 @@ int m_scan_Unload(void)
        {
                HooktypeDel(ScanHost,ScanModInfo.handle);
                HookDel(LocConnect);
-               HookDel(ConfUnknown);
+               HookDel(ConfTest);
+               HookDel(ConfRun);
+               HookDel(ConfPostTest);
                HookDel(ServerStats);
                LockEventSystem();
                EventDel(Scannings_clean);
@@ -348,108 +347,176 @@ DLLFUNC int h_scan_connect(aClient *sptr)
  *    };
  * 
  */
+DLLFUNC h_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
+       ConfigEntry *cep;
+       int errors = 0;
 
-DLLFUNC int    h_config_set_scan(void)
-{
-       ConfigItem_unknown_ext *sets;
-       ConfigEntry *ce;
-       char    *ip;
-       char    *port;
-       int     iport;
-       for (sets = conf_unknown_set; sets; 
-               sets = (ConfigItem_unknown_ext *)sets->next)
+       if (type != CONFIG_SET)
+               return 0;
+
+       if (!strcmp(ce->ce_varname, "scan"))
        {
-               if (!strcmp(sets->ce_varname, "scan"))
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
                {
-                       for (ce = sets->ce_entries; ce; ce = (ConfigEntry *)ce->ce_next)
+                       if (!cep->ce_varname)
+                       {
+                               config_error("%s:%i: blank set::scan item",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum);    
+                               errors++;
+                               continue;
+                       }
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: set::scan::%s item without value",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum, cep->ce_varname);
+                               errors++;
+                               continue;
+                       }
+                       if (!strcmp(cep->ce_varname, "endpoint"))
                        {
-                               if (!strcmp(ce->ce_varname, "bantime")) {
-                                       if (!ce->ce_vardata) {
-                                               config_status("%s:%i: set::scan::bantime has no value",
-                                                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-                                               break;
-                                       }
-                                       Scan_BanTime = config_checkval(ce->ce_vardata,CFG_TIME);
+                               char copy[256];
+                               char *ip, *port;
+                               int iport;
+                               strcpy(copy, cep->ce_vardata);
+                               ipport_seperate(copy, &ip, &port);
+                               if (!ip || !*ip)
+                               {
+                                       config_error("%s:%i: set::scan::endpoint: illegal ip:port mask",
+                                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                                       errors++;
                                }
-                               else
-                               if (!strcmp(ce->ce_varname, "timeout")) {
-                                       if (!ce->ce_vardata) {
-                                               config_status("%s:%i: set::scan::timeout has no value",
-                                                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-                                               break;
-                                       }
-                                       Scan_TimeOut = config_checkval(ce->ce_vardata,CFG_TIME);
+                               if (strchr(ip, '*'))
+                               {
+                                       config_error("%s:%i: set::scan::endpoint: illegal ip",
+                                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                                       errors++;
                                }
-                               else
-                               if (!strcmp(ce->ce_varname, "endpoint"))
+                               if (!port || !*port)
                                {
-                                       if (!ce->ce_vardata)
-                                       {
-                                               config_status("%s:%i: set::scan::endpoint: syntax [ip]:port",
-                                                            ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-                                               break;
-                                       }
-                                       ipport_seperate(ce->ce_vardata, &ip, &port);
-                                       if (!ip || !*ip)
-                                       {
-                                               config_status("%s:%i: set::scan::endpoint: illegal ip",
-                                                            ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-                                               break;
-                                       }
-                                       if (!port || !*port)
-                                       {
-                                               config_status("%s:%i: set::scan::endpoint: missing/invalid port",
-                                                           ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-                                               break;
-                                       }
-                                       iport = atol(port);
-                                       if ((iport < 0) || (iport > 65535))
-                                       {
-                                               config_status("%s:%i: set::scan::endpoint: illegal port",
-                                                            ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-                                               break;
-                                       }
-#ifndef INET6
-                                       Scan_endpoint.SIN_ADDR.S_ADDR = inet_addr(ip);
-#else
-                                       inet_pton(AFINET, ip, Scan_endpoint.SIN_ADDR.S_ADDR);
-#endif
-                                       Scan_endpoint.SIN_PORT = htons(iport);
-                                       Scan_endpoint.SIN_FAMILY = AFINET;
+                                       config_error("%s:%i: set::scan::endpoint: missing port in mask",
+                                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                                       errors++;
                                }
-                               else if (!strcmp(ce->ce_varname, "bind-ip"))
+                               iport = atol(port);
+                               if ((iport < 0) || (iport > 65535))
                                {
-                                       if (!ce->ce_vardata)
-                                       {
-                                               config_status("%s:%i: set::scan::bind: syntax [ip]",
-                                                            ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-                                               break;
-                                       }
-#ifndef INET6
-                                       Scan_bind.S_ADDR = inet_addr(ce->ce_vardata);
-#else
-                                       inet_pton(AFINET, ce->ce_vardata, Scan_bind.S_ADDR);
-#endif
+                                       config_error("%s:%i: set::scan::endpoint: illegal port (must be 0..65536)",
+                                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                                       errors++;
                                }
-                               else if (!strcmp(ce->ce_varname, "message"))
+                               ReqConf.endpoint = 1;
+                       }
+                       else if (!strcmp(cep->ce_varname, "bind-ip"))
+                       {
+                               if (strchr(cep->ce_vardata, '*') && strcmp(cep->ce_vardata, "*"))
                                {
-                                       if (!ce->ce_vardata)
-                                       {
-                                               config_status("%s:%i: set::scan::message requires an argument",
-                                                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-                                               break;
-                                       }
-                                       if (scan_message)
-                                               free(scan_message);
-                                       scan_message = strdup(ce->ce_vardata);
+                                       config_error("%s:%i: set::scan::bind-ip: illegal ip, (mask, and not '*')",
+                                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+                                       errors++;
                                }
+                               ReqConf.bindip = 1;
+                       }
+                       else if (!strcmp(cep->ce_varname, "message"));
+                       else if (!strcmp(cep->ce_varname, "bantime"))
+                               ReqConf.bantime = 1;
+                       else if (!strcmp(cep->ce_varname, "timeout"))
+                               ReqConf.timeout = 1;
+                       else 
+                       {
+                               config_error("%s:%i: unknown directive set::scan::%s",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++;
+                       }
+                       
+               }
+               *errs = errors;
+               return errors ? -1 : 1;
+       }
+       else
+               return 0;
+}
+
+DLLFUNC h_config_run(ConfigFile *cf, ConfigEntry *ce, int type) {
+       ConfigEntry *cep;
+       int errors = 0;
+
+       if (type != CONFIG_SET)
+               return 0;
+       if (!strcmp(ce->ce_varname, "scan"))
+       {
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               {
+                       if (!strcmp(cep->ce_varname, "endpoint"))
+                       {
+                               char copy[256];
+                               char *ip, *port;
+                               int iport;
+                               strcpy(copy, cep->ce_vardata);
+                               ipport_seperate(copy, &ip, &port);
+#ifndef INET6
+                               Scan_endpoint.SIN_ADDR.S_ADDR = inet_addr(ip);
+#else
+                               inet_pton(AFINET, ip, Scan_endpoint.SIN_ADDR.S_ADDR);
+#endif
+                               iport = atol(port);
+                               Scan_endpoint.SIN_PORT = htons(iport);
+                               Scan_endpoint.SIN_FAMILY = AFINET;              
+                       }
+                       else if (!strcmp(cep->ce_varname, "bantime"))
+                               Scan_BanTime = config_checkval(cep->ce_vardata,CFG_TIME);
+                       else if (!strcmp(cep->ce_varname, "timeout"))
+                               Scan_TimeOut = config_checkval(cep->ce_vardata,CFG_TIME);
+                       else if (!strcmp(cep->ce_varname, "bind-ip"))
+                       {
+#ifndef INET6
+                               Scan_bind.S_ADDR = inet_addr(cep->ce_vardata);
+#else  
+                               inet_pton(AFINET, cep->ce_vardata, Scan_bind.S_ADDR);
+#endif
                        }
-                       del_ConfigItem(sets, conf_unknown_set);
-               }       
+                       if (!strcmp(cep->ce_varname, "message"))
+                               scan_message = strdup(cep->ce_vardata);
+               }
+               return 1;               
        }
        return 0;
 }
 
+DLLFUNC int h_config_posttest(int *errs) {
+       int errors = 0;
+       if (!ReqConf.endpoint)
+       {
+               config_error("set::scan::endpoint missing");
+               errors++;
+       }
+       if (!ReqConf.bantime)
+       {
+               config_error("set::scan::bantime missing");
+               errors++;
+       }
+       if (!ReqConf.timeout)
+       {
+               config_error("set::scan::timeout missing");
+               errors++;
+       }
+       if (!ReqConf.bindip)
+       {
+               config_error("set::scan::bind-ip missing");
+               errors++;
+       }
+       *errs = errors;
+       return errors ? -1 : 1; 
+}
+
+DLLFUNC int h_config_rehash()
+{
+       if (scan_message)
+               MyFree(scan_message);
+}
+
 DLLFUNC int h_stats_scan(aClient *sptr, char *stats) {
        if (*stats == 'S') {
                sendto_one(sptr, ":%s %i %s :scan::endpoint: %s:%d", me.name, RPL_TEXT, sptr->name,
index d45ce8860ded4d308b1ed69ce77cd6f60442bf14..d4d29b42f4e1fdda759e654d50717735b53d7334 100644 (file)
@@ -150,36 +150,43 @@ int       scan_http_Unload(int module_unload)
 void   scan_http_scan(Scan_AddrStruct *h)
 {
        THREAD  thread[3];
+       unsigned id[3];
+       /* note: on windows dwRc holds the thread return code.  on unix
+       ** its a void pointer
+       */
+       u_int32_t dwRc[3];
        HSStruct *p = NULL;
        
        IRCMutexLock((h->lock));
+
        /* First we take 3128 .. */
        h->refcnt++;
        p = MyMalloc(sizeof(HSStruct));
        p->hs = h;
        p->port = 3128;
-       IRCCreateThread(thread[0], scan_http_scan_port, p);
+       IRCCreateThreadEx(thread[0], scan_http_scan_port, p, &id[0]);
        /* Then we take 8080 .. */
        h->refcnt++;
        p = MyMalloc(sizeof(HSStruct));
        p->hs = h;
        p->port = 8080;
-       IRCCreateThread(thread[1], scan_http_scan_port, p);
+       IRCCreateThreadEx(thread[1], scan_http_scan_port, p, &id[1]);
        /* And then we try to infect them with Code Red .. */
        h->refcnt++;
        p = MyMalloc(sizeof(HSStruct));
        p->hs = h;
        p->port = 80;
-       IRCCreateThread(thread[2], scan_http_scan_port, p);
+       IRCCreateThreadEx(thread[2], scan_http_scan_port, p, &id[2]);
+       
        IRCMutexUnlock((h->lock));
-       IRCJoinThread(thread[0], NULL);         
-       IRCJoinThread(thread[1], NULL);         
-       IRCJoinThread(thread[2], NULL); 
+
+       IRCJoinThread(thread[0], &dwRc[0]);             
+       IRCJoinThread(thread[1], &dwRc[1]);             
+       IRCJoinThread(thread[2], &dwRc[2]);     
        IRCMutexLock((h->lock));
        h->refcnt--;
        IRCMutexUnlock((h->lock));
        IRCDetachThread(IRCThreadSelf());
-       IRCExitThread(NULL);
        return;
 }
 
@@ -194,9 +201,9 @@ void        scan_http_scan_port(HSStruct *z)
        struct                  SOCKADDR_IN bin;
        SOCKET                  fd;
        unsigned char           httpbuf[160];
-       fd_set                  rfds;
+       fd_set                  rfds, efds;
+       int  err, len = sizeof(err);
        struct timeval          tv;
-       int                     len;
 
        IRCMutexLock((h->lock));
 #ifndef INET6
@@ -251,26 +258,43 @@ void      scan_http_scan_port(HSStruct *z)
          * -Zogg
         */
        set_non_blocking(fd, NULL);
-       if ((retval = connect(fd, (struct sockaddr *)&sin,
-                sizeof(sin))) == -1 && !(ERRNO == P_EINPROGRESS))
+       if ((retval = connect(fd, (struct sockaddr *)&sin, sizeof(sin))) == -1 && (ERRNO != P_EWORKING))
        {
                /* we have no socks server! */
                CLOSE_SOCK(fd); 
                goto exituniverse;
-               return;
        }
        
-       /* We wait for write-ready */
+       /* We wait for connection to complete */
        tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
-       if (!select(fd + 1, NULL, &rfds, NULL, &tv))
+       FD_ZERO(&efds);
+       FD_SET(fd, &efds);
+       if (select(fd + 1, NULL, &rfds, &efds, &tv) <= 0)
+       {
+               /* timeout or error */
+               CLOSE_SOCK(fd);
+               goto exituniverse;
+       }
+       /* did connection fail on windows? */
+       if (FD_ISSET(fd, &efds))
        {
+               err = ERRNO;
                CLOSE_SOCK(fd);
                goto exituniverse;
        }
-                               
+#ifdef SO_ERROR
+       /* did connection fail on unix? */
+       if (!getsockopt(fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *)&err, &len))
+               if (err)
+               {
+                       /* connection failed */
+                       CLOSE_SOCK(fd);
+                       goto exituniverse;
+               }
+#endif
        bzero(httpbuf, sizeof(httpbuf));
        snprintf(httpbuf, sizeof httpbuf, "CONNECT %s:%i HTTP/1.1\n\n",
                Inet_ia2p(&xScan_endpoint->SIN_ADDR), ntohs(xScan_endpoint->SIN_PORT));
@@ -279,7 +303,7 @@ void        scan_http_scan_port(HSStruct *z)
                CLOSE_SOCK(fd);
                goto exituniverse;
        }
-       /* Now we wait for data. 10 secs ought to be enough  */
+       /* Now we wait for data. Duration is set::scan::timeout */
        tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
@@ -309,6 +333,5 @@ exituniverse:
        IRCMutexLock((h->lock));
        h->refcnt--;
        IRCMutexUnlock((h->lock));
-       IRCExitThread(NULL);
        return;
 }
index 92ff31536e4dfc46383eb6a354d4b509f27993a1..aa328bf6e30217898942011b424c64fb97279dc7 100644 (file)
@@ -146,19 +146,21 @@ int       scan_socks_Unload(int module_unload)
 void scan_socks_scan(Scan_AddrStruct *h)
 {
        THREAD thread[2];
+       unsigned id[2];
+       u_int32_t dwRc[2];
+       
        IRCMutexLock((h->lock));
        h->refcnt++;
-       IRCCreateThread(thread[0], scan_socks4_scan, h);
+       IRCCreateThreadEx(thread[0], scan_socks4_scan, h, &id[0]);
        h->refcnt++;
-       IRCCreateThread(thread[1], scan_socks5_scan, h);
+       IRCCreateThreadEx(thread[1], scan_socks5_scan, h, &id[1]);
        IRCMutexUnlock((h->lock));
-       IRCJoinThread(thread[0], NULL);
-       IRCJoinThread(thread[1], NULL);
+       IRCJoinThread(thread[0], &dwRc[0]);
+       IRCJoinThread(thread[1], &dwRc[1]);
        IRCMutexLock((h->lock));
        h->refcnt--;
        IRCMutexUnlock((h->lock));
        IRCDetachThread(IRCThreadSelf());
-       IRCExitThread(NULL);
        return;
 }
        
@@ -175,9 +177,9 @@ void        scan_socks4_scan(Scan_AddrStruct *h)
        SOCKET                  fd;
        unsigned char           socksbuf[10];
        unsigned long           theip;
-       fd_set                  rfds;
+       fd_set                  rfds, efds;
        struct timeval          tv;
-       int                     len;
+       int  err, len = sizeof(err);
        /* Get host */
 
        IRCMutexLock((h->lock));
@@ -232,8 +234,7 @@ void        scan_socks4_scan(Scan_AddrStruct *h)
          * -Zogg
         */
        set_non_blocking(fd, NULL);
-       if ((retval = connect(fd, (struct sockaddr *)&sin,
-                sizeof(sin))) == -1 && !(ERRNO == P_EINPROGRESS))
+       if ((retval = connect(fd, (struct sockaddr *)&sin, sizeof(sin))) == -1 && !(ERRNO == P_EWORKING))
        {
                /* we have no socks server! */
                CLOSE_SOCK(fd); 
@@ -241,16 +242,35 @@ void      scan_socks4_scan(Scan_AddrStruct *h)
                return;
        }
        
-       /* We wait for write-ready */
+       /* We wait for connection to complete */
        tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
-       if (!select(fd + 1, NULL, &rfds, NULL, &tv))
+       FD_ZERO(&efds);
+       FD_SET(fd, &efds);
+       if (select(fd + 1, NULL, &rfds, &efds, &tv) <= 0)
+       {
+               CLOSE_SOCK(fd);
+               goto exituniverse;
+       }
+       /* did connection fail on windows? */
+       if (FD_ISSET(fd, &efds))
        {
+               err = ERRNO;
                CLOSE_SOCK(fd);
                goto exituniverse;
        }
+#ifdef SO_ERROR
+       /* did connection fail on unix? */
+       if (!getsockopt(fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *)&err, &len))
+               if (err)
+               {
+                       /* connection failed */
+                       CLOSE_SOCK(fd);
+                       goto exituniverse;
+               }
+#endif
 #ifdef INET6
        ia4.s_addr = inet_aton((char *)Inet_ia2p(&xScan_endpoint->SIN_ADDR));
 #else
@@ -304,7 +324,6 @@ exituniverse:
        h->refcnt--;
        IRCMutexUnlock((h->lock));
        /* We get joined, we need no steekin Detach */
-       IRCExitThread(NULL);
        return;
 }
 
@@ -317,10 +336,10 @@ void      scan_socks5_scan(Scan_AddrStruct *h)
        struct                  SOCKADDR_IN sin;
        struct                  in_addr ia4;
        SOCKET                  fd;
-       unsigned long           theip;
-       fd_set                  rfds;
+       unsigned long   theip;
+       fd_set                  rfds, efds;
        struct timeval          tv;
-       int                     len;
+       int  err, len = sizeof(err);
        unsigned char           socksbuf[10];
        /* Get host */
        IRCMutexLock((h->lock));
@@ -368,26 +387,42 @@ void      scan_socks5_scan(Scan_AddrStruct *h)
          * -Zogg
         */
        set_non_blocking(fd, NULL);
-       if ((retval = connect(fd, (struct sockaddr *)&sin,
-                sizeof(sin))) == -1 && 
-                !(ERRNO == P_EINPROGRESS))
+       if ((retval = connect(fd, (struct sockaddr *)&sin, sizeof(sin))) == -1 && !(ERRNO == P_EWORKING))
        {
                /* we have no socks server! */
                CLOSE_SOCK(fd); 
                goto exituniverse;
-               return;
        }
        
-       /* We wait for write-ready */
+       /* We wait for connection to complete */
        tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
-       if (!select(fd + 1, NULL, &rfds, NULL, &tv))
+       FD_ZERO(&efds);
+       FD_SET(fd, &efds);
+       if (select(fd + 1, NULL, &rfds, &efds, &tv) <= 0)
+       {
+               CLOSE_SOCK(fd);
+               goto exituniverse;
+       }
+       /* did connection fail on windows? */
+       if (FD_ISSET(fd, &efds))
        {
+               err = ERRNO;
                CLOSE_SOCK(fd);
                goto exituniverse;
        }
+#ifdef SO_ERROR
+       /* did connection fail on unix? */
+       if (!getsockopt(fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *)&err, &len))
+               if (err)
+               {
+                       /* connection failed */
+                       CLOSE_SOCK(fd);
+                       goto exituniverse;
+               }
+#endif
 #ifdef INET6
        ia4.s_addr = inet_aton((char *)Inet_ia2p(&xScan_endpoint->SIN_ADDR));
 #else
@@ -467,7 +502,6 @@ exituniverse:
        h->refcnt--;
        IRCMutexUnlock(h->lock);
        /* We need no steekin detach */
-       IRCExitThread(NULL);
        return;
 }
 
index 152379053b2a67177f095dc44fc25c11bcdbdd24..1d06ef7da9dcba38a1e74318e720cad8334032d0 100644 (file)
@@ -352,7 +352,7 @@ inline aCommand *find_Command(char *cmd, short token, int flags)
                        if (!strcmp(p->cmd, cmd))
                                return (p);
                }
-               else
+               else if (!p->token)
                        if (!stricmp(p->cmd, cmd))
                                return (p);
        }
index 5d63cf771d9c6103045b3638d561b169877983c9..dffe91d0ddbfb29831e5f35de8c7a08de50879e3 100644 (file)
--- a/src/res.c
+++ b/src/res.c
@@ -32,6 +32,7 @@
 #include "nameser.h"
 #include "resolv.h"
 #include "inet.h"
+#include "threads.h"
 #include <string.h>
 #ifndef CLEAN_COMPILE
 static char rcsid[] = "@(#)$Id$";
@@ -50,6 +51,13 @@ static int incache = 0;
 static CacheTable hashtable[ARES_CACSIZE];
 static aCache *cachetop = NULL;
 static ResRQ *last, *first;
+/* control access to request queue - allow only one thread at a time.
+** Currently the list is only protected on Windows because we don't use 
+** threads to access it on Unix
+*/
+static MUTEX g_hResMutex;
+static int lock_request();
+static int unlock_request();
 
 static void rem_cache(aCache *);
 static void rem_request(ResRQ *);
@@ -100,6 +108,16 @@ int init_resolver(int op)
 {
        int  ret = 0;
 
+#ifdef _WIN32
+       IRCCreateMutex(g_hResMutex);
+       if (g_hResMutex == NULL)
+       {
+               ircd_log(LOG_ERROR, "IRCCreateMutex failed: %s:%i.  %s", 
+                                __FILE__, __LINE__,strerror(GetLastError()));
+               return ret;
+       }
+#endif
+
 #ifdef LRAND48
        srand48(TStime());
 #endif
@@ -156,10 +174,54 @@ int init_resolver(int op)
        return ret;
 }
 
+/* get access to resolver request queue */
+static int lock_request()
+{
+       int iRc = 1;
+#ifdef _WIN32
+       DWORD dwWaitRes;
+
+       if (g_hResMutex)
+       {
+               dwWaitRes = IRCMutexLock(g_hResMutex);
+               if (dwWaitRes != WAIT_OBJECT_0)
+               {
+                       ircd_log(LOG_ERROR, "IRCMutexLock failed with %d: %s:%i.  %s", 
+                                        dwWaitRes, __FILE__, __LINE__,strerror(GetLastError()));
+                       iRc = 0;
+               }
+       }
+#endif
+       return iRc;
+}
+
+/* release access to resolver request queue */
+static int unlock_request()
+{
+       int iRc = 1;
+
+#ifdef _WIN32
+       BOOL bRc;
+
+       if (g_hResMutex)
+       {
+               bRc = IRCMutexUnlock(g_hResMutex);
+               if (!bRc)
+               {
+                       ircd_log(LOG_ERROR, "IRCMutexUnlock failed: %s:%i.  %s", 
+                                        __FILE__, __LINE__,strerror(GetLastError()));
+                       iRc = 0;
+               }
+       }
+#endif
+       return iRc;
+}
+
 static int add_request(ResRQ *new)
 {
        if (!new)
                return -1;
+       lock_request();
        if (!first)
                first = last = new;
        else
@@ -169,6 +231,7 @@ static int add_request(ResRQ *new)
        }
        new->next = NULL;
        reinfo.re_requests++;
+       unlock_request();
        return 0;
 }
 
@@ -184,9 +247,19 @@ static void rem_request(ResRQ *old)
 
        if (!old)
                return;
+
+       lock_request();
+
 #ifdef _WIN32
-         while (old->locked)
-                 Sleep(0);
+       /* don't remove if async_dns() thread is running because it needs this memory
+       ** we should consider terminating the thread here esp.
+       ** if exit_client() called us
+       */
+       if (old->locked)
+       {
+               unlock_request();
+               return;
+       }
 #endif
        for (rptr = &first; *rptr; r2ptr = *rptr, rptr = &(*rptr)->next)
                if (*rptr == old)
@@ -197,8 +270,7 @@ static void rem_request(ResRQ *old)
                        break;
                }
 #ifdef DEBUGMODE
-       Debug((DEBUG_INFO, "rem_request:Remove %#x at %#x %#x",
-           old, *rptr, r2ptr));
+       Debug((DEBUG_INFO, "rem_request:Remove %#x at %#x %#x", old, *rptr, r2ptr));
 #endif
        r2ptr = old;
 #ifndef _WIN32
@@ -208,13 +280,13 @@ static void rem_request(ResRQ *old)
                if ((s = r2ptr->he.h_aliases[i]))
                        MyFree(s);
 #else
-       if (r2ptr->he)
-                 MyFree(r2ptr->he);
+       if (r2ptr->he)
+               MyFree(r2ptr->he);
 #endif
        if (r2ptr->name)
                MyFree(r2ptr->name);
        MyFree(r2ptr);
-
+       unlock_request();
        return;
 }
 
@@ -262,6 +334,7 @@ time_t timeout_query_list(time_t now)
        aClient *cptr;
 
        Debug((DEBUG_DNS, "timeout_query_list at %s", myctime(now)));
+       lock_request();
        for (rptr = first; rptr; rptr = r2ptr)
        {
                r2ptr = rptr->next;
@@ -286,12 +359,11 @@ time_t timeout_query_list(time_t now)
                                          if (SHOWCONNECTINFO)
                                                  sendto_one(cptr, REPORT_FAIL_DNS);
                                          ClearDNS(cptr);
-                                        if (!DoingAuth(cptr))
-                                                 SetAccess(cptr);
+                      if (!DoingAuth(cptr))
+                                                 SetAccess(cptr);
                                          break;
                                  case ASYNC_CONNECT:
-                                         sendto_ops("Host %s unknown",
-                                             rptr->name);
+                                         sendto_ops("Host %s unknown", rptr->name);
                                          break;
                                }
                                rem_request(rptr);
@@ -315,6 +387,7 @@ time_t timeout_query_list(time_t now)
                if (!next || tout < next)
                        next = tout;
        }
+       unlock_request();
        return (next > now) ? next : (now + AR_TTL);
 }
 
@@ -326,12 +399,14 @@ void del_queries(char *cp)
 {
        ResRQ *rptr, *r2ptr;
 
+       lock_request();
        for (rptr = first; rptr; rptr = r2ptr)
        {
                r2ptr = rptr->next;
                if (cp == rptr->cinfo.value.cp)
                        rem_request(rptr);
        }
+       unlock_request();
 }
 
 /*
@@ -426,10 +501,12 @@ static ResRQ *find_id(int id)
 {
        ResRQ *rptr;
 
+       lock_request();
        for (rptr = first; rptr; rptr = rptr->next)
                if (rptr->id == id)
-                       return rptr;
-       return NULL;
+                       break;
+       unlock_request();
+       return rptr;
 }
 
 struct hostent *gethost_byname(char *name, Link *lp)
@@ -441,7 +518,7 @@ struct hostent *gethost_byname(char *name, Link *lp)
 #ifndef _WIN32
                return (struct hostent *)&(cp->he);
 #else
-                return (struct hostent *)cp->he;
+               return (struct hostent *)cp->he;
 #endif
        if (!lp)
                return NULL;
@@ -1950,5 +2027,6 @@ int       res_copyhostent(struct hostent *from, struct hostent *to)
 
            }
        to->h_addr_list[i] = NULL;
+       return 1;
 }
 #endif /*_WIN32*/
index 0f347b0d56bf10c8eb601bb8daa5778740a957c0..3577d580778ae41d4306bcd0f0de463a37bdb70e 100644 (file)
@@ -103,8 +103,7 @@ void start_auth(aClient *cptr)
        sock.SIN_PORT = htons(113);
        sock.SIN_FAMILY = AFINET;
 
-       if (connect(cptr->authfd, (struct sockaddr *)&sock,
-               sizeof(sock)) == -1 && !(ERRNO == P_EINPROGRESS))
+       if (connect(cptr->authfd, (struct sockaddr *)&sock, sizeof(sock)) == -1 && !(ERRNO == P_EWORKING))
        {
                ircstp->is_abad++;
                /*
index 064c65d1e9de945b818cf8932945aa10136d1947..fc87c163f861d768844c837f71961a160313cd62 100644 (file)
@@ -80,7 +80,12 @@ Computing Center and Jarkko Oikarinen";
 int  rr;
 
 #endif
-
+#ifdef INET6
+static unsigned char minus_one[] =
+    { 255, 255, 255, 255, 255, 255, 255, 255, 255,
+        255, 255, 255, 255, 255, 255, 255, 0
+};
+#endif
 
 #ifndef IN_LOOPBACKNET
 #define IN_LOOPBACKNET 0x7f
@@ -465,6 +470,7 @@ int add_listener2(ConfigItem_listen *conf)
        {       
                cptr->umodes |= LISTENER_BOUND;
                conf->options |= LISTENER_BOUND;
+               conf->listener = cptr;
                set_non_blocking(cptr->fd, cptr);
                return 1;
        }
@@ -542,7 +548,11 @@ void init_sys(void)
        limit.rlim_cur = limit.rlim_max;        /* make soft limit the max */
        if (setrlimit(RLIMIT_FD_MAX, &limit) == -1)
        {
+#ifndef LONG_LONG_RLIM_T
                (void)fprintf(stderr, "error setting max fd's to %ld\n",
+#else
+               (void)fprintf(stderr, "error setting max fd's to %lld\n",
+#endif
                    limit.rlim_cur);
                exit(-1);
        }
@@ -1147,7 +1157,6 @@ void set_non_blocking(int fd, aClient *cptr)
  */
 aClient *add_connection(aClient *cptr, int fd)
 {
-       Link    lin;
        aClient *acptr;
        ConfigItem_ban *bconf;
        int i, j;
@@ -1254,6 +1263,7 @@ add_con_refuse:
        if (cptr->umodes & LISTENER_SSL)
        {
                SetSSLAcceptHandshake(acptr);
+               Debug((DEBUG_DEBUG, "Starting SSL accept handshake for %s", acptr->sockhost));
                if ((acptr->ssl = SSL_new(ctx_server)) == NULL)
                {
                        goto add_con_refuse;
@@ -1262,6 +1272,7 @@ add_con_refuse:
                SSL_set_fd(acptr->ssl, fd);
                SSL_set_nonblocking(acptr->ssl);
                if (!ircd_SSL_accept(acptr, fd)) {
+                       Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", acptr->sockhost));
                        SSL_set_shutdown(acptr->ssl, SSL_RECEIVED_SHUTDOWN);
                        SSL_smart_shutdown(acptr->ssl);
                        SSL_free(acptr->ssl);
@@ -1804,15 +1815,17 @@ int  read_message(time_t delay, fdlist *listp)
                           ** ...room for writing, empty some queue then...
                         */
                        ClearBlocked(cptr);
-                       if (IsConnecting(cptr))
+                       if (IsConnecting(cptr)) {
 #ifdef USE_SSL
                                if ((cptr->serv) && (cptr->serv->conf->options & CONNECT_SSL))
                                {
+                                       Debug((DEBUG_DEBUG, "ircd_SSL_client_handshake(%s)", cptr->name));
                                        write_err = ircd_SSL_client_handshake(cptr);
                                }
                                else
 #endif
                                        write_err = completed_connection(cptr);
+                       }
                        if (!write_err)
                        {
                                if (DoList(cptr) && IsSendable(cptr))
@@ -1854,12 +1867,18 @@ deadsocket:
                                        length = -1;
                                }
                        }
-                       else
+                       if (SSL_is_init_finished(cptr->ssl))
                        {
                                if (IsSSLAcceptHandshake(cptr))
+                               {
+                                       Debug((DEBUG_ERROR, "ssl: start_of_normal_client_handshake(%s)", cptr->sockhost));
                                        start_of_normal_client_handshake(cptr);
+                               }
                                else
+                               {
+                                       Debug((DEBUG_ERROR, "ssl: completed_connection", cptr->name));
                                        completed_connection(cptr);
+                               }
 
                        }
                }
index 4345704d567931b7654714d275b01bc1b380e09a..3b8c9c780a360c0aaa2ebb8fafa2fa2feb6897c7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *   Unreal Internet Relay Chat Daemon, src/s_conf.c
  *   (C) 1998-2000 Chris Behrens & Fred Jacobs (comstud, moogle)
- *   (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
+ *   (C) 2000-2002 Carsten V. Munk and the UnrealIRCd Team
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@
  *   along with this program; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
 #include "struct.h"
 #include "common.h"
 #include "sys.h"
 #ifdef _WIN32
 #undef GLOBH
 #endif
-extern MemoryInfo StatsZ;
-/*
- * TODO:
- *  - deny version {} (V:lines)
- *  - deny connect (D:d lines)
-*/
+
 #define ircstrdup(x,y) if (x) MyFree(x); if (!y) x = NULL; else x = strdup(y)
 #define ircfree(x) if (x) MyFree(x); x = NULL
 #define ircabs(x) (x < 0) ? -x : x
 
+/* 
+ * Some typedefs..
+*/
 typedef struct _confcommand ConfigCommand;
 struct _confcommand
 {
        char    *name;
-       int     (*func)(ConfigFile *conf, ConfigEntry *ce);
+       int     (*conffunc)(ConfigFile *conf, ConfigEntry *ce);
+       int     (*testfunc)(ConfigFile *conf, ConfigEntry *ce);
 };
 
 typedef struct _conf_operflag OperFlag;
@@ -74,67 +72,95 @@ struct _conf_operflag
        char    *name;
 };
 
-
-/*
- * Top-level configuration commands -Stskeeps
- */
-int    _conf_admin             (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_me                (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_oper              (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_class             (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_drpass    (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_ulines    (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_include   (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_tld               (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_listen    (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_allow             (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_except    (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_vhost             (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_link              (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_ban               (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_set               (ConfigFile *conf, ConfigEntry *ce);
+/* Config commands */
+
+static int     _conf_admin             (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_me                (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_oper              (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_class             (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_drpass            (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_ulines            (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_include           (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_tld               (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_listen            (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_allow             (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_except            (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_vhost             (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_link              (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_ban               (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_set               (ConfigFile *conf, ConfigEntry *ce);
 #ifdef STRIPBADWORDS
-int    _conf_badword           (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_badword           (ConfigFile *conf, ConfigEntry *ce);
 #endif
-int    _conf_deny              (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_deny_dcc          (ConfigFile *conf, ConfigEntry *ce);
-int     _conf_deny_link         (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_deny_channel      (ConfigFile *conf, ConfigEntry *ce);
-int     _conf_deny_version      (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_allow_channel     (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_loadmodule        (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_log               (ConfigFile *conf, ConfigEntry *ce);
-int    _conf_alias             (ConfigFile *conf, ConfigEntry *ce);
-int     _conf_help              (ConfigFile *conf, ConfigEntry *ce);
-aMotd *Find_file(char *, short);
-
-extern int conf_debuglevel;
+static int     _conf_deny              (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_deny_dcc          (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_deny_link         (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_deny_channel      (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_deny_version      (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_allow_channel     (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_loadmodule        (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_log               (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_alias             (ConfigFile *conf, ConfigEntry *ce);
+static int     _conf_help              (ConfigFile *conf, ConfigEntry *ce);
+
+/* 
+ * Validation commands 
+*/
 
+static int     _test_admin             (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_me                (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_oper              (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_class             (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_drpass            (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_ulines            (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_include           (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_tld               (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_listen            (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_allow             (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_except            (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_vhost             (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_link              (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_ban               (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_set               (ConfigFile *conf, ConfigEntry *ce);
+#ifdef STRIPBADWORDS
+static int     _test_badword           (ConfigFile *conf, ConfigEntry *ce);
+#endif
+static int     _test_deny              (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_deny_dcc          (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_deny_link         (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_deny_channel      (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_deny_version      (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_allow_channel     (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_loadmodule        (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_log               (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_alias             (ConfigFile *conf, ConfigEntry *ce);
+static int     _test_help              (ConfigFile *conf, ConfigEntry *ce);
+/* This MUST be alphabetized */
 static ConfigCommand _ConfigCommands[] = {
-       { "admin",              _conf_admin },
-       { "me",                 _conf_me },
-       { "oper",               _conf_oper },
-       { "class",              _conf_class },
-       { "drpass",     _conf_drpass },
-       { "ulines",     _conf_ulines },
-       { "include",    _conf_include },
-       { "tld",                _conf_tld },
-       { "listen",     _conf_listen },
-       { "allow",              _conf_allow },
-       { "except",             _conf_except },
-       { "vhost",              _conf_vhost },
-       { "link",               _conf_link },
-       { "ban",                _conf_ban },
-       { "set",                _conf_set },
+       { "admin",              _conf_admin,            _test_admin     },
+       { "alias",              _conf_alias,            _test_alias     },
+       { "allow",              _conf_allow,            _test_allow     },
 #ifdef STRIPBADWORDS
-       { "badword",            _conf_badword },
+       { "badword",            _conf_badword,          _test_badword   },
 #endif
-       { "deny",               _conf_deny },
-       { "loadmodule",         _conf_loadmodule },
-       { "log",                _conf_log },
-       { "alias",              _conf_alias },
-       { "help",               _conf_help },
-       { NULL,                 NULL  }
+       { "ban",                _conf_ban,              _test_ban       },
+       { "class",              _conf_class,            _test_class     },
+       { "deny",               _conf_deny,             _test_deny      },
+       { "drpass",             _conf_drpass,           _test_drpass    },
+       { "except",             _conf_except,           _test_except    },
+       { "help",               _conf_help,             _test_help      },
+       { "include",            NULL,                   _test_include   },
+       { "link",               _conf_link,             _test_link      },
+       { "listen",             _conf_listen,           _test_listen    },
+       { "loadmodule",         NULL,                   _test_loadmodule},
+       { "log",                _conf_log,              _test_log       },
+       { "me",                 _conf_me,               _test_me        },
+       { "oper",               _conf_oper,             _test_oper      },
+       { "set",                _conf_set,              _test_set       },
+       { "tld",                _conf_tld,              _test_tld       },
+       { "ulines",             _conf_ulines,           _test_ulines    },
+       { "vhost",              _conf_vhost,            _test_vhost     },
 };
 
 static int _OldOperFlags[] = {
@@ -165,84 +191,142 @@ static int _OldOperFlags[] = {
        OFLAG_INVISIBLE, '^',
        OFLAG_TKL, 't',
        OFLAG_GZL, 'Z',
+       OFLAG_OVERRIDE, 'v',
        0, 0
 };
 
+/* This MUST be alphabetized */
 static OperFlag _OperFlags[] = {
-       { OFLAG_LOCAL,          "local" },
-       { OFLAG_GLOBAL,         "global" },
-       { OFLAG_REHASH,         "can_rehash" },
+       { OFLAG_ADMIN_,         "admin"},
        { OFLAG_DIE,            "can_die" },
-       { OFLAG_RESTART,        "can_restart" },
-       { OFLAG_HELPOP,         "helpop" },
-       { OFLAG_GLOBOP,         "can_globops" },
-       { OFLAG_WALLOP,         "can_wallops" },
-       { OFLAG_LOCOP,          "locop"},
-       { OFLAG_LROUTE,         "can_localroute" },
-       { OFLAG_GROUTE,         "can_globalroute" },
-       { OFLAG_LKILL,          "can_localkill" },
+       { OFLAG_TKL,            "can_gkline"},
        { OFLAG_GKILL,          "can_globalkill" },
+       { OFLAG_GNOTICE,        "can_globalnotice" },
+       { OFLAG_GROUTE,         "can_globalroute" },
+       { OFLAG_GLOBOP,         "can_globops" },
+       { OFLAG_GZL,            "can_gzline"},
        { OFLAG_KLINE,          "can_kline" },
-       { OFLAG_UNKLINE,        "can_unkline" },
+       { OFLAG_LKILL,          "can_localkill" },
        { OFLAG_LNOTICE,        "can_localnotice" },
-       { OFLAG_GNOTICE,        "can_globalnotice" },
-       { OFLAG_ADMIN_,         "admin"},
-       { OFLAG_SADMIN_,        "services-admin"},
-       { OFLAG_NADMIN,         "netadmin"},
-       { OFLAG_COADMIN,        "coadmin"},
-       { OFLAG_ZLINE,          "can_zline"},
-       { OFLAG_WHOIS,          "get_umodew"},
+       { OFLAG_LROUTE,         "can_localroute" },
+       { OFLAG_OVERRIDE,       "can_override" },
+       { OFLAG_REHASH,         "can_rehash" },
+       { OFLAG_RESTART,        "can_restart" },
        { OFLAG_INVISIBLE,      "can_stealth"},
+       { OFLAG_UNKLINE,        "can_unkline" },
+       { OFLAG_WALLOP,         "can_wallops" },
+       { OFLAG_ZLINE,          "can_zline"},
+       { OFLAG_COADMIN,        "coadmin"},
        { OFLAG_HIDE,           "get_host"},
-       { OFLAG_TKL,            "can_gkline"},
-       { OFLAG_GZL,            "can_gzline"},
-       { 0L,   NULL  }
+       { OFLAG_WHOIS,          "get_umodew"},
+       { OFLAG_GLOBAL,         "global" },
+       { OFLAG_HELPOP,         "helpop" },
+       { OFLAG_LOCAL,          "local" },
+       { OFLAG_LOCOP,          "locop"},
+       { OFLAG_NADMIN,         "netadmin"},
+       { OFLAG_SADMIN_,        "services-admin"},
 };
 
+/* This MUST be alphabetized */
 static OperFlag _ListenerFlags[] = {
-       { LISTENER_NORMAL,      "standard"},
        { LISTENER_CLIENTSONLY, "clientsonly"},
-       { LISTENER_SERVERSONLY, "serversonly"},
-       { LISTENER_REMOTEADMIN, "remoteadmin"},
        { LISTENER_JAVACLIENT,  "java"},
        { LISTENER_MASK,        "mask"},
+       { LISTENER_REMOTEADMIN, "remoteadmin"},
+       { LISTENER_SERVERSONLY, "serversonly"},
        { LISTENER_SSL,         "ssl"},
-       { 0L,                   NULL },
+       { LISTENER_NORMAL,      "standard"},
 };
 
+/* This MUST be alphabetized */
 static OperFlag _LinkFlags[] = {
        { CONNECT_AUTO, "autoconnect" },
+       { CONNECT_QUARANTINE, "quarantine"},
        { CONNECT_SSL,  "ssl"             },
        { CONNECT_ZIP,  "zip"             },
-       { CONNECT_QUARANTINE, "quarantine"},
-       { 0L,           NULL }
 };
 
+/* This MUST be alphabetized */
 static OperFlag _LogFlags[] = {
+       { LOG_CLIENT, "connects" },
        { LOG_ERROR, "errors" },
        { LOG_KILL, "kills" },
-       { LOG_TKL, "tkl" },
-       { LOG_CLIENT, "connects" },
-       { LOG_SERVER, "server-connects" },
        { LOG_KLINE, "kline" },
        { LOG_OPER, "oper" },
-       { 0L, NULL }
+       { LOG_SERVER, "server-connects" },
+       { LOG_TKL, "tkl" },
+};
+
+#ifdef USE_SSL
+/* This MUST be alphabetized */
+static OperFlag _SSLFlags[] = {
+       { SSLFLAG_FAILIFNOCERT, "fail-if-no-clientcert" },
+       { SSLFLAG_DONOTACCEPTSELFSIGNED, "no-self-signed" },
+       { SSLFLAG_VERIFYCERT, "verify-certificate" },
 };
+#endif
+
+struct {
+       unsigned conf_me : 1;
+       unsigned conf_admin : 1;
+       unsigned conf_listen : 1;
+       struct 
+       {
+               unsigned kline_address : 1;
+               unsigned maxchannelsperuser : 1;
+               unsigned name_server : 1;
+               unsigned host_timeout : 1;
+               unsigned host_retries : 1;
+               unsigned defaultserv : 1;
+               unsigned irc_network : 1;
+               unsigned operhost : 1;
+               unsigned adminhost : 1;
+               unsigned locophost : 1;
+               unsigned sadminhost : 1;
+               unsigned netadminhost : 1;
+               unsigned coadminhost : 1;
+               unsigned cloakkeys : 1;
+               unsigned hlpchan : 1;
+               unsigned hidhost : 1;
+       } settings;
+} requiredstuff;
 
 /*
- * Some prototypes
- */
-void                   config_free(ConfigFile *cfptr);
-ConfigFile             *config_load(char *filename);
-ConfigEntry            *config_find(ConfigEntry *ceptr, char *name);
-void                   config_error(char *format, ...);
+ * Utilities
+*/
+
+void   ipport_seperate(char *string, char **ip, char **port);
+long   config_checkval(char *value, unsigned short flags);
+
+/*
+ * Parser
+*/
+
+ConfigFile             *config_load(char *filename);
+void                   config_free(ConfigFile *cfptr);
 static ConfigFile      *config_parse(char *filename, char *confdata);
 static void            config_entry_free(ConfigEntry *ceptr);
-int                    ConfigParse(ConfigFile *cfptr);
+ConfigEntry            *config_find_entry(ConfigEntry *ce, char *name);
+/*
+ * Error handling
+*/
+
+void                   config_error(char *format, ...);
+void                   config_status(char *format, ...);
+void                   config_progress(char *format, ...);
+
 #ifdef _WIN32
-extern void            win_log(char *format, ...);
-extern void win_error();
+extern void    win_log(char *format, ...);
+extern void            win_error();
 #endif
+
+/*
+ * Config parser (IRCd)
+*/
+int                    init_conf(char *rootconf, int rehash);
+int                    load_conf(char *filename);
+void                   config_rehash();
+int                    config_run();
 /*
  * Configuration linked lists
 */
@@ -267,8 +351,6 @@ ConfigItem_allow_channel *conf_allow_channel = NULL;
 ConfigItem_deny_link   *conf_deny_link = NULL;
 ConfigItem_deny_version *conf_deny_version = NULL;
 ConfigItem_log         *conf_log = NULL;
-ConfigItem_unknown     *conf_unknown = NULL;
-ConfigItem_unknown_ext  *conf_unknown_set = NULL;
 ConfigItem_alias       *conf_alias = NULL;
 ConfigItem_include     *conf_include = NULL;
 ConfigItem_help                *conf_help = NULL;
@@ -277,20 +359,14 @@ ConfigItem_badword        *conf_badword_channel = NULL;
 ConfigItem_badword      *conf_badword_message = NULL;
 #endif
 
-aConfiguration iConf;
+aConfiguration         iConf;
+aConfiguration         tempiConf;
+ConfigFile             *conf = NULL;
 
+int                    config_error_flag = 0;
+int                    config_verbose = 0;
 /*
- * MyMalloc with the only difference that it clears the memory too
- * -Stskeeps
- * Should be moved to support.c
- */
-void   *MyMallocEx(size_t size)
-{
-       void *p = MyMalloc(size);
-
-       bzero(p, size);
-       return (p);
-}
+*/
 
 void   ipport_seperate(char *string, char **ip, char **port)
 {
@@ -330,7 +406,7 @@ void        ipport_seperate(char *string, char **ip, char **port)
 
 
 long config_checkval(char *value, unsigned short flags) {
-       char *text, *ptr;
+       char *text;
        long ret = 0;
 
 
@@ -437,111 +513,71 @@ tolower(*(text+1)) == 'n') || *text == '1' || tolower(*text) == 't') {
        return ret;
 }
 
-int    config_error_flag = 0;
-/* Small function to bitch about stuff */
-void config_error(char *format, ...)
-{
-       va_list         ap;
-       char            buffer[1024];
-       char            *ptr;
-
-       va_start(ap, format);
-       vsprintf(buffer, format, ap);
-       va_end(ap);
-       if ((ptr = strchr(buffer, '\n')) != NULL)
-               *ptr = '\0';
-       if (!loop.ircd_booted)
-#ifndef _WIN32
-               fprintf(stderr, "[error] %s\n", buffer);
-#else
-               win_log("[error] %s", buffer);
-#endif
-       else
-               ircd_log(LOG_ERROR, "config error: %s", buffer);
-       sendto_realops("error: %s", buffer);
-       /* We cannot live with this */
-       config_error_flag = 1;
-}
-
-/* Like above */
-void config_status(char *format, ...)
+ConfigFile *config_load(char *filename)
 {
-       va_list         ap;
-       char            buffer[1024];
-       char            *ptr;
+       struct stat sb;
+       int                     fd;
+       int                     ret;
+       char            *buf = NULL;
+       ConfigFile      *cfptr;
 
-       va_start(ap, format);
-       vsprintf(buffer, format, ap);
-       va_end(ap);
-       if ((ptr = strchr(buffer, '\n')) != NULL)
-               *ptr = '\0';
-       if (!loop.ircd_booted)
 #ifndef _WIN32
-               fprintf(stderr, "* %s\n", buffer);
+       fd = open(filename, O_RDONLY);
 #else
-               win_log("* %s", buffer);
+       fd = open(filename, O_RDONLY|O_BINARY);
 #endif
-       sendto_realops("warning: %s", buffer);
+       if (fd == -1)
+       {
+               config_error("Couldn't open \"%s\": %s\n", filename, strerror(errno));
+               return NULL;
+       }
+       if (fstat(fd, &sb) == -1)
+       {
+               config_error("Couldn't fstat \"%s\": %s\n", filename, strerror(errno));
+               close(fd);
+               return NULL;
+       }
+       if (!sb.st_size)
+       {
+               close(fd);
+               return NULL;
+       }
+       buf = MyMalloc(sb.st_size+1);
+       if (buf == NULL)
+       {
+               config_error("Out of memory trying to load \"%s\"\n", filename);
+               close(fd);
+               return NULL;
+       }
+       ret = read(fd, buf, sb.st_size);
+       if (ret != sb.st_size)
+       {
+               config_error("Error reading \"%s\": %s\n", filename,
+                       ret == -1 ? strerror(errno) : strerror(EFAULT));
+               free(buf);
+               close(fd);
+               return NULL;
+       }
+       /* Just me or could this cause memory corrupted when ret <0 ? */
+       buf[ret] = '\0';
+       close(fd);
+       cfptr = config_parse(filename, buf);
+       free(buf);
+       return cfptr;
 }
 
-void config_progress(char *format, ...)
+void config_free(ConfigFile *cfptr)
 {
-       va_list         ap;
-       char            buffer[1024];
-       char            *ptr;
-
-       va_start(ap, format);
-       vsprintf(buffer, format, ap);
-       va_end(ap);
-       if ((ptr = strchr(buffer, '\n')) != NULL)
-               *ptr = '\0';
-       if (!loop.ircd_booted)
-               fprintf(stderr, "* %s\n", buffer);
-       sendto_realops("%s", buffer);
-}
-
-void clear_unknown(ConfigFile *file) {
-       ConfigItem_unknown *p;
-       ListStruct *next;
-       ConfigItem_unknown_ext *q;
+       ConfigFile      *nptr;
 
-       for (p = conf_unknown; p; p = (ConfigItem_unknown *)next) {
-               next = (ListStruct *)p->next;
-               if (p->ce->ce_fileptr != file)
-                       continue;
-               if (!strcmp(p->ce->ce_varname, "ban")) 
-                       config_status("%s:%i: unknown ban type %s",
-                               p->ce->ce_fileptr->cf_filename, p->ce->ce_varlinenum,
-                               p->ce->ce_vardata);
-               else if (!strcmp(p->ce->ce_varname, "except"))
-                       config_status("%s:%i: unknown except type %s",
-                               p->ce->ce_fileptr->cf_filename, p->ce->ce_varlinenum,
-                               p->ce->ce_vardata);
-               else if (!strcmp(p->ce->ce_varname, "deny"))
-                       config_status("%s:%i: unknown deny type %s",
-                               p->ce->ce_fileptr->cf_filename, p->ce->ce_varlinenum,
-                               p->ce->ce_vardata);
-               else if (!strcmp(p->ce->ce_varname, "allow"))
-                       config_status("%s:%i: unknown allow type %s",
-                               p->ce->ce_fileptr->cf_filename, p->ce->ce_varlinenum,
-                               p->ce->ce_vardata);
-               else                    
-                       config_status("%s:%i: unknown directive %s",
-                               p->ce->ce_fileptr->cf_filename, p->ce->ce_varlinenum,
-                               p->ce->ce_varname); 
-
-               DelListItem(p, conf_unknown);
-               MyFree(p);
-       }
-       for (q = conf_unknown_set; q; q = (ConfigItem_unknown_ext *)next) {
-               next = (ListStruct *)q->next;
-               if (q->ce_fileptr != file)
-                       continue;
-               config_status("%s:%i: unknown directive set::%s",
-                       q->ce_fileptr->cf_filename, q->ce_varlinenum,
-                       q->ce_varname);
-               DelListItem(q, conf_unknown_set);
-               MyFree(q);
+       for(;cfptr;cfptr=nptr)
+       {
+               nptr = cfptr->cf_next;
+               if (cfptr->cf_entries)
+                       config_entry_free(cfptr->cf_entries);
+               if (cfptr->cf_filename)
+                       free(cfptr->cf_filename);
+               free(cfptr);
        }
 }
 
@@ -833,3436 +869,4730 @@ static void config_entry_free(ConfigEntry *ceptr)
        }
 }
 
-void config_free(ConfigFile *cfptr)
+ConfigEntry            *config_find_entry(ConfigEntry *ce, char *name)
 {
-       ConfigFile      *nptr;
-
-       for(;cfptr;cfptr=nptr)
-       {
-               nptr = cfptr->cf_next;
-               if (cfptr->cf_entries)
-                       config_entry_free(cfptr->cf_entries);
-               if (cfptr->cf_filename)
-                       free(cfptr->cf_filename);
-               free(cfptr);
-       }
+       ConfigEntry *cep;
+       
+       for (cep = ce; cep; cep = cep->ce_next)
+               if (cep->ce_varname && !strcmp(cep->ce_varname, name))
+                       break;
+       return cep;
 }
 
-ConfigFile *config_load(char *filename)
+void config_error(char *format, ...)
 {
-       struct stat sb;
-       int                     fd;
-       int                     ret;
-       char            *buf = NULL;
-       ConfigFile      *cfptr;
+       va_list         ap;
+       char            buffer[1024];
+       char            *ptr;
 
+       va_start(ap, format);
+       vsprintf(buffer, format, ap);
+       va_end(ap);
+       if ((ptr = strchr(buffer, '\n')) != NULL)
+               *ptr = '\0';
+       if (!loop.ircd_booted)
 #ifndef _WIN32
-       fd = open(filename, O_RDONLY);
+               fprintf(stderr, "[error] %s\n", buffer);
 #else
-       fd = open(filename, O_RDONLY|O_BINARY);
+               win_log("[error] %s", buffer);
 #endif
-       if (fd == -1)
-       {
-               config_error("Couldn't open \"%s\": %s\n", filename, strerror(errno));
-               return NULL;
-       }
-       if (fstat(fd, &sb) == -1)
-       {
-               config_error("Couldn't fstat \"%s\": %s\n", filename, strerror(errno));
-               close(fd);
-               return NULL;
-       }
-       if (!sb.st_size)
-       {
-               close(fd);
-               return NULL;
-       }
-       buf = MyMalloc(sb.st_size+1);
-       if (buf == NULL)
-       {
-               config_error("Out of memory trying to load \"%s\"\n", filename);
-               close(fd);
-               return NULL;
-       }
-       ret = read(fd, buf, sb.st_size);
-       if (ret != sb.st_size)
-       {
-               config_error("Error reading \"%s\": %s\n", filename,
-                       ret == -1 ? strerror(errno) : strerror(EFAULT));
-               free(buf);
-               close(fd);
-               return NULL;
-       }
-       /* Just me or could this cause memory corrupted when ret <0 ? */
-       buf[ret] = '\0';
-       close(fd);
-       cfptr = config_parse(filename, buf);
-       free(buf);
-       return cfptr;
+       else
+               ircd_log(LOG_ERROR, "config error: %s", buffer);
+       sendto_realops("error: %s", buffer);
+       /* We cannot live with this */
+       config_error_flag = 1;
 }
 
-ConfigEntry *config_find(ConfigEntry *ceptr, char *name)
+/* Like above */
+void config_status(char *format, ...)
 {
-       for(;ceptr;ceptr=ceptr->ce_next)
-               if (!strcmp(ceptr->ce_varname, name))
-                       break;
-       return ceptr;
+       va_list         ap;
+       char            buffer[1024];
+       char            *ptr;
+
+       va_start(ap, format);
+       vsprintf(buffer, format, ap);
+       va_end(ap);
+       if ((ptr = strchr(buffer, '\n')) != NULL)
+               *ptr = '\0';
+       if (!loop.ircd_booted)
+#ifndef _WIN32
+               fprintf(stderr, "* %s\n", buffer);
+#else
+               win_log("* %s", buffer);
+#endif
+       sendto_realops("%s", buffer);
 }
 
-/* This will load a config named <filename> -Stskeeps */
-int    init_conf2(char *filename)
+void config_progress(char *format, ...)
 {
-       ConfigFile      *cfptr;
-       int             i = 0;
-
-       if (!filename)
-       {
-               config_error("Could not load config file %s", filename);
-               return 0;
-       }
-
+       va_list         ap;
+       char            buffer[1024];
+       char            *ptr;
 
-       config_progress("Opening config file %s .. ", filename);
-       if ((cfptr = config_load(filename)))
-       {
-               ConfigItem_include *includes;
-               config_progress("Config file %s loaded without problems",
-                       filename);
-               i = ConfigParse(cfptr);
-               RunHook0(HOOKTYPE_CONFIG_UNKNOWN);
-               clear_unknown(cfptr);
-               config_free(cfptr);
-               if (!stricmp(filename, CPATH))
-                       return i;
-               for (includes = conf_include; includes; includes = (ConfigItem_include *)includes->next) {
-                       if (!stricmp(includes->file, filename)) 
-                               break;
-               }
-               if (!includes) {
-                       includes = MyMalloc(sizeof(ConfigItem_include));
-                       includes->file = strdup(filename);
-                       AddListItem(includes, conf_include);
-               }
-               return i;
-       }
-       else
-       {
-               config_error("Could not load config file %s", filename);
-               return 0;
-       }
+       va_start(ap, format);
+       vsprintf(buffer, format, ap);
+       va_end(ap);
+       if ((ptr = strchr(buffer, '\n')) != NULL)
+               *ptr = '\0';
+       if (!loop.ircd_booted)
+#ifndef _WIN32
+               fprintf(stderr, "* %s\n", buffer);
+#else
+               win_log("* %s", buffer);
+#endif
+       sendto_realops("%s", buffer);
 }
 
-/* This is a function to make looking up config commands quick
-   It goes in and checks the variable names and executes commands
-   that it is told to execute when encountering certain variable names
-   -Stskeeps
-*/
-int    ConfigCmd(ConfigFile *cf, ConfigEntry *ce, ConfigCommand *cc)
-{
-       ConfigEntry *cep;
-       ConfigCommand *ccp;
-       if (!ce)
-       {
-               config_status("%s: empty file", cf->cf_filename);
-               return -1;
-       }
-       if (!cc)
-       {
-               config_error("ConfigCmd: Got !cc");
-               return -1;
-       }
-       for (cep = ce; cep; cep = cep->ce_next)
-       {
-               if (!cep->ce_varname)
-               {
-                       config_error("%s:%i: (null) cep->ce_varname",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                       continue;
+ConfigCommand *config_binary_search(char *cmd) {
+       int start = 0;
+       int stop = sizeof(_ConfigCommands)/sizeof(_ConfigCommands[0]);
+       int mid;
+       while (start <= stop) {
+               mid = (start+stop)/2;
+               if (smycmp(cmd,_ConfigCommands[mid].name) < 0) {
+                       stop = mid-1;
                }
-               for (ccp = cc; ccp->name; ccp++)
-               {
-                       if (!strcasecmp(ccp->name, cep->ce_varname))
-                       {
-                               ccp->func(cf, cep);
-                               break;
-                       }
-               }
-               if (!ccp->name)
-               {
-                       ConfigItem_unknown *ca = MyMalloc(sizeof(ConfigItem_unknown));
-                       ca->ce = cep;                   
-                       /* Add to the unknown list */
-                       AddListItem(ca, conf_unknown);
+               else if (smycmp(cmd,_ConfigCommands[mid].name) == 0) {
+                       return &_ConfigCommands[mid];
                }
+               else
+                       start = mid+1;
        }
-       return 0;
+       return NULL;
 }
 
-/* This simply starts the parsing of a config file from top level
-   -Stskeeps
-*/
-int    ConfigParse(ConfigFile *cfptr)
+void   free_iConf(aConfiguration *i)
 {
-       ConfigCmd(cfptr, cfptr->cf_entries, _ConfigCommands);
-       return 0;
+       ircfree(i->name_server);
+       ircfree(i->kline_address);
+       ircfree(i->auto_join_chans);
+       ircfree(i->oper_auto_join_chans);
+       ircfree(i->oper_only_stats);
+       ircfree(i->egd_path);
+       ircfree(i->static_quit);
+#ifdef USE_SSL
+       ircfree(i->x_server_cert_pem);
+       ircfree(i->x_server_key_pem);
+       ircfree(i->trusted_ca_file);
+#endif 
+       ircfree(i->network.x_ircnetwork);
+       ircfree(i->network.x_ircnet005);        
+       ircfree(i->network.x_defserv);
+       ircfree(i->network.x_services_name);
+       ircfree(i->network.x_oper_host);
+       ircfree(i->network.x_admin_host);
+       ircfree(i->network.x_locop_host);       
+       ircfree(i->network.x_sadmin_host);
+       ircfree(i->network.x_netadmin_host);
+       ircfree(i->network.x_coadmin_host);
+       ircfree(i->network.x_hidden_host);
+       ircfree(i->network.x_prefix_quit);
+       ircfree(i->network.x_helpchan);
+       ircfree(i->network.x_stats_server);
 }
 
-/* Here is the command parsing instructions */
-
-/* include comment */
-int    _conf_include(ConfigFile *conf, ConfigEntry *ce)
+int    init_conf(char *rootconf, int rehash)
 {
-#ifdef GLOBH
-       glob_t files;
-       int i;
-#elif defined(_WIN32)
-       HANDLE hFind;
-       WIN32_FIND_DATA FindData;
-       char cPath[MAX_PATH], *cSlash = NULL, *path;
-#endif
-       if (!ce->ce_vardata)
+       config_status("Loading IRCd configuration ..");
+       if (conf)
        {
-               config_status("%s:%i: include: no filename given",
-                       ce->ce_fileptr->cf_filename,
-                       ce->ce_varlinenum);
+               config_error("%s:%i - Someone forgot to clean up", __FILE__, __LINE__);
                return -1;
        }
-#if !defined(_WIN32) && !defined(_AMIGA) && DEFAULT_PERMISSIONS != 0
-       chmod(ce->ce_vardata, DEFAULT_PERMISSIONS);
+       bzero(&tempiConf, sizeof(iConf));
+       bzero(&requiredstuff, sizeof(requiredstuff));
+       if (load_conf(rootconf) > 0)
+       {
+               if (config_test() < 0)
+               {
+                       config_error("IRCd configuration failed to pass testing");
+#ifdef _WIN32
+                       if (!rehash)
+                               win_error();
 #endif
-#ifdef GLOBH
-#if defined(__OpenBSD__) && defined(GLOB_LIMIT)
-       glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK|GLOB_LIMIT, NULL, &files);
+#ifndef STATIC_LINKING
+                       Unload_all_testing_modules();
+#endif
+                       config_free(conf);
+                       conf = NULL;
+                       free_iConf(&tempiConf);
+                       return -1;
+               }
+               
+               if (rehash)
+               {
+                       config_rehash();
+#ifndef STATIC_LINKING
+                       Unload_all_loaded_modules();
 #else
-       glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK, NULL, &files);
+                       RunHook0(HOOKTYPE_REHASH);
 #endif
-       if (!files.gl_pathc) {
-               globfree(&files);
-               config_status("%s:%i: include %s: invalid file given",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                       ce->ce_vardata);
-               return -1;
-       }       
-       for (i = 0; i < files.gl_pathc; i++) {
-               init_conf2(files.gl_pathv[i]);
-       }
-       globfree(&files);
-#elif defined(_WIN32)
-       bzero(cPath,MAX_PATH);
-       if (strchr(ce->ce_vardata, '/') || strchr(ce->ce_vardata, '\\')) {
-               strncpy(cPath,ce->ce_vardata,MAX_PATH);
-               cSlash=cPath+strlen(cPath);
-               while(*cSlash != '\\' && *cSlash != '/' && cSlash > cPath)
-                       cSlash--; 
-               *(cSlash+1)=0;
-       }
-       hFind = FindFirstFile(ce->ce_vardata, &FindData);
-       if (!FindData.cFileName) {
-               config_status("%s:%i: include %s: invalid file given",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                       ce->ce_vardata);
-               FindClose(hFind);
-               return -1;
-       }
-       if (cPath) {
-               path = MyMalloc(strlen(cPath) + strlen(FindData.cFileName)+1);
-               strcpy(path,cPath);
-               strcat(path,FindData.cFileName);
-               init_conf2(path);
-               free(path);
-       }
-       else
-               init_conf2(FindData.cFileName);
-       while (FindNextFile(hFind, &FindData) != 0) {
-               if (cPath) {
-                       path = MyMalloc(strlen(cPath) + strlen(FindData.cFileName)+1);
-                       strcpy(path,cPath);
-                       strcat(path,FindData.cFileName);
-                       init_conf2(path);
-                       free(path);
                }
-               else
-                       init_conf2(FindData.cFileName);
-       }
-
-       FindClose(hFind);
+#ifndef STATIC_LINKING
+               Init_all_testing_modules();
 #else
-       return (init_conf2(ce->ce_vardata));
+               if (!rehash) {
+                       ModuleInfo ModCoreInfo;
+                       ModCoreInfo.size = sizeof(ModuleInfo);
+                       ModCoreInfo.module_load = 0;
+                       ModCoreInfo.handle = NULL;
+                       l_commands_Init(&ModCoreInfo);
+               }
 #endif
-       return 0;
-}
-/*
- * The admin {} block parser
-*/
-int    _conf_admin(ConfigFile *conf, ConfigEntry *ce)
-{
-       ConfigEntry *cep;
-       ConfigItem_admin *ca;
-
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
-       {
-               if (!cep->ce_varname)
+               if (config_run() < 0)
                {
-                       config_status("%s:%i: blank admin item",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
+                       config_error("Bad case of config errors. Server will now die. This really shouldn't happen");
+#ifdef _WIN32
+                       if (!rehash)
+                               win_error();
+#endif
+                       abort();
                }
-               ca = MyMallocEx(sizeof(ConfigItem_admin));
-               if (!conf_admin)
-                       conf_admin_tail = ca;
-               ircstrdup(ca->line, cep->ce_varname);
-               AddListItem(ca, conf_admin);
+                       
        }
-       return 0;
-}
-
-/*
- * The ulines {} block parser
-*/
-int    _conf_ulines(ConfigFile *conf, ConfigEntry *ce)
-{
-       ConfigEntry *cep;
-       ConfigItem_ulines *ca;
-
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       else    
        {
-               if (!cep->ce_varname)
-               {
-                       config_status("%s:%i: blank uline item",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
-               }
-               ca = MyMallocEx(sizeof(ConfigItem_ulines));
-               ircstrdup(ca->servername, cep->ce_varname);
-               AddListItem(ca, conf_ulines);
+               config_error("IRCd configuration failed to load");
+               config_free(conf);
+               conf = NULL;
+               free_iConf(&tempiConf);
+#ifdef _WIN32
+               if (!rehash)
+                       win_error();
+#endif
+               return -1;
        }
+       config_free(conf);
+       conf = NULL;
+#ifndef STATIC_LINKING
+       if (rehash)
+               module_loadall(0);
+#endif
+       config_status("Configuration loaded without any problems ..");
        return 0;
 }
 
-/*
- * The class {} block parser
-*/
-int    _conf_class(ConfigFile *conf, ConfigEntry *ce)
+int    load_conf(char *filename)
 {
-       ConfigEntry *cep;
-       ConfigItem_class *class;
-       unsigned char isnew = 0;
-
-       if (!ce->ce_vardata)
-       {
-               config_status("%s:%i: class without name",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
-       }
+       ConfigFile      *cfptr, *cfptr2, **cfptr3;
+       ConfigEntry     *ce;
+       int             ret;
 
-       if (!(class = Find_class(ce->ce_vardata)))
+       if (config_verbose > 0)
+               config_status("Loading config file %s ..", filename);
+       if ((cfptr = config_load(filename)))
        {
-               class = MyMallocEx(sizeof(ConfigItem_class));
-               ircstrdup(class->name, ce->ce_vardata);
-               isnew = 1;
+               for (cfptr3 = &conf, cfptr2 = conf; cfptr2; cfptr2 = cfptr2->cf_next)
+                       cfptr3 = &cfptr2->cf_next;
+               *cfptr3 = cfptr;
+#ifndef _WIN32
+               if (config_verbose > 1)
+                       config_status("Loading modules in %s", filename);
+               for (ce = cfptr->cf_entries; ce; ce = ce->ce_next)
+                       if (!strcmp(ce->ce_varname, "loadmodule"))
+                       {
+                                ret = _conf_loadmodule(cfptr, ce);
+                                if (ret < 0) 
+                                               return ret;
+                       }
+#endif
+               if (config_verbose > 1)
+                       config_status("Searching through %s for include files..", filename);
+               for (ce = cfptr->cf_entries; ce; ce = ce->ce_next)
+                       if (!strcmp(ce->ce_varname, "include"))
+                       {
+                                ret = _conf_include(cfptr, ce);
+                                if (ret < 0) 
+                                               return ret;
+                       }
+                       return 1;
        }
        else
        {
-               isnew = 0;
-       }
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               config_error("Could not load config file %s", filename);
+               return -1;
+       }       
+}
+
+void   config_rehash()
+{
+       ConfigItem_oper                 *oper_ptr;
+       ConfigItem_class                *class_ptr;
+       ConfigItem_ulines               *uline_ptr;
+       ConfigItem_allow                *allow_ptr;
+       ConfigItem_except               *except_ptr;
+       ConfigItem_ban                  *ban_ptr;
+       ConfigItem_link                 *link_ptr;
+       ConfigItem_listen               *listen_ptr;
+       ConfigItem_tld                  *tld_ptr;
+       ConfigItem_vhost                *vhost_ptr;
+       ConfigItem_badword              *badword_ptr;
+       ConfigItem_deny_dcc             *deny_dcc_ptr;
+       ConfigItem_deny_link            *deny_link_ptr;
+       ConfigItem_deny_channel         *deny_channel_ptr;
+       ConfigItem_allow_channel        *allow_channel_ptr;
+       ConfigItem_admin                *admin_ptr;
+       ConfigItem_deny_version         *deny_version_ptr;
+       ConfigItem_log                  *log_ptr;
+       ConfigItem_alias                *alias_ptr;
+       ConfigItem_include              *include_ptr;
+       ConfigItem_help                 *help_ptr;
+       ListStruct      *next, *next2;
+
+       /* clean out stuff that we don't use */ 
+       for (admin_ptr = conf_admin; admin_ptr; admin_ptr = (ConfigItem_admin *)next)
        {
-               if (!cep->ce_varname)
+               next = (ListStruct *)admin_ptr->next;
+               ircfree(admin_ptr->line);
+               DelListItem(admin_ptr, conf_admin);
+               MyFree(admin_ptr);
+       }
+       /* wipe the fckers out ..*/
+       for (oper_ptr = conf_oper; oper_ptr; oper_ptr = (ConfigItem_oper *)next)
+       {
+               ConfigItem_oper_from *oper_from;
+               next = (ListStruct *)oper_ptr->next;
+               ircfree(oper_ptr->name);
+               ircfree(oper_ptr->swhois);
+               ircfree(oper_ptr->snomask);
+               Auth_DeleteAuthStruct(oper_ptr->auth);
+               for (oper_from = (ConfigItem_oper_from *) oper_ptr->from; oper_from; oper_from = (ConfigItem_oper_from *) next2)
                {
-                       config_status("%s:%i: class item without variable name",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                       continue;
+                       next2 = (ListStruct *)oper_from->next;
+                       ircfree(oper_from->name);
+                       DelListItem(oper_from, oper_ptr->from);
+                       MyFree(oper_from);
                }
-               if (!cep->ce_vardata)
-               {
-                       config_status("%s:%i: class item without parameter",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+               DelListItem(oper_ptr, conf_oper);
+               MyFree(oper_ptr);
+       }
+       for (class_ptr = conf_class; class_ptr; class_ptr = (ConfigItem_class *) next)
+       {
+               next = (ListStruct *)class_ptr->next;
+               if (class_ptr->flag.permanent == 1)
                        continue;
-               }
-               if (!strcmp(cep->ce_varname, "pingfreq"))
-               {
-                       class->pingfreq = atol(cep->ce_vardata);
-                       if (!class->pingfreq)
-                       {
-                               config_status("%s:%i: class::pingfreq with illegal value, using default of %d",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum, PINGFREQUENCY);
-                               class->pingfreq = PINGFREQUENCY;
-                       
-                       }
-               } else
-               if (!strcmp(cep->ce_varname, "maxclients"))
-               {
-                       class->maxclients = atol(cep->ce_vardata);
-                       if (!class->maxclients)
-                       {
-                               config_status("%s:%i: class::maxclients with illegal value, using default of 100",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                               class->maxclients = 100;
-                       }
-               } else
-               if (!strcmp(cep->ce_varname, "connfreq"))
-               {
-                       class->connfreq = atol(cep->ce_vardata);
-                       if (class->connfreq < 10)
-                       {
-                               config_status("%s:%i: class::connfreq with illegal value (<10), using default of %d",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum, CONNECTFREQUENCY);
-                               class->connfreq = CONNECTFREQUENCY;
-                       }
-               } else
-               if (!strcmp(cep->ce_varname, "sendq"))
-               {
-                       class->sendq = atol(cep->ce_vardata);
-                       if (!class->sendq)
-                       {
-                               config_status("%s:%i: class::sendq with illegal value, using default of %d",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MAXSENDQLENGTH);
-                               class->sendq = MAXSENDQLENGTH;
-                       }
-               }
-               else
+               class_ptr->flag.temporary = 1;
+               /* We'll wipe it out when it has no clients */
+               if (!class_ptr->clients)
                {
-                       config_status("%s:%i: unknown directive class::%s",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                       cep->ce_varname);
-                       continue;
+                       ircfree(class_ptr->name);
+                       DelListItem(class_ptr, conf_class);
+                       MyFree(class_ptr);
                }
        }
-       if (isnew) 
-               AddListItem(class, conf_class);
-       return 0;
-}
-
-/*
- * The me {} block parser
-*/
-int    _conf_me(ConfigFile *conf, ConfigEntry *ce)
-{
-       ConfigEntry *cep;
-
-       if (!conf_me)
+       for (uline_ptr = conf_ulines; uline_ptr; uline_ptr = (ConfigItem_ulines *) next)
        {
-               conf_me = MyMallocEx(sizeof(ConfigItem_me));
+               next = (ListStruct *)uline_ptr->next;
+               /* We'll wipe it out when it has no clients */
+               ircfree(uline_ptr->servername);
+               DelListItem(uline_ptr, conf_ulines);
+               MyFree(uline_ptr);
        }
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       for (allow_ptr = conf_allow; allow_ptr; allow_ptr = (ConfigItem_allow *) next)
        {
-               if (!cep->ce_varname)
+               next = (ListStruct *)allow_ptr->next;
+               ircfree(allow_ptr->ip);
+               ircfree(allow_ptr->hostname);
+               Auth_DeleteAuthStruct(allow_ptr->auth);
+               DelListItem(allow_ptr, conf_allow);
+               MyFree(allow_ptr);
+       }
+       for (except_ptr = conf_except; except_ptr; except_ptr = (ConfigItem_except *) next)
+       {
+               next = (ListStruct *)except_ptr->next;
+               ircfree(except_ptr->mask);
+               DelListItem(except_ptr, conf_except);
+               MyFree(except_ptr);
+       }
+       for (ban_ptr = conf_ban; ban_ptr; ban_ptr = (ConfigItem_ban *) next)
+       {
+               next = (ListStruct *)ban_ptr->next;
+               if (ban_ptr->flag.type2 == CONF_BAN_TYPE_CONF || ban_ptr->flag.type2 == CONF_BAN_TYPE_TEMPORARY)
                {
-                       config_status("%s:%i: blank me line",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
+                       ircfree(ban_ptr->mask);
+                       ircfree(ban_ptr->reason);
+                       DelListItem(ban_ptr, conf_ban);
+                       MyFree(ban_ptr);
                }
-               if (!cep->ce_vardata)
+       }
+       for (link_ptr = conf_link; link_ptr; link_ptr = (ConfigItem_link *) next)
+       {
+               next = (ListStruct *)link_ptr->next;
+               if (link_ptr->refcount == 0)
                {
-                       config_status("%s:%i: me::%s without parameter",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum,
-                               cep->ce_varname);
-                       continue;
+                       link_cleanup(link_ptr);
+                       DelListItem(link_ptr, conf_link);
+                       MyFree(link_ptr);
                }
-               if (!strcmp(cep->ce_varname, "name"))
+               else
                {
-                       char *fixedname;
-                       ircfree(conf_me->name);
-                       ircstrdup(conf_me->name, cep->ce_vardata);
-                       if (!strchr(conf_me->name, '.'))
-                       {
-                               fixedname = MyMalloc(strlen(conf_me->name)+5);
-                               ircsprintf(fixedname, "irc.%s.com", conf_me->name);
-                               config_status("%s:%i: illegal me::name, missing ., using default of %s",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum, fixedname);
-                               ircfree(conf_me->name);
-                               ircstrdup(conf_me->name, fixedname);
-                               ircfree(fixedname);
+                       link_ptr->flag.temporary = 1;
+               }
+       }
+       for (listen_ptr = conf_listen; listen_ptr; listen_ptr = (ConfigItem_listen *)listen_ptr->next)
+       {
+               listen_ptr->flag.temporary = 1;
+       }
+       for (tld_ptr = conf_tld; tld_ptr; tld_ptr = (ConfigItem_tld *) next)
+       {
+               aMotd *motd;
+               next = (ListStruct *)tld_ptr->next;
+               ircfree(tld_ptr->motd_file);
+               ircfree(tld_ptr->rules_file);
+               if (!tld_ptr->flag.motdptr) {
+                       while (tld_ptr->motd) {
+                               motd = tld_ptr->motd->next;
+                               ircfree(tld_ptr->motd->line);
+                               ircfree(tld_ptr->motd);
+                               tld_ptr->motd = motd;
                        }
-               } else
-               if (!strcmp(cep->ce_varname, "info"))
-               {
-                       ircfree(conf_me->info);
-                       conf_me->info = strdup(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "numeric"))
-               {
-                       conf_me->numeric = atol(cep->ce_vardata);
-                       if ((conf_me->numeric < 0) && (conf_me->numeric > 254))
-                       {
-                               config_status("%s:%i: illegal me::numeric error (must be between 0 and 254). Setting to 0",
-                                       cep->ce_fileptr->cf_filename,
-                                       cep->ce_varlinenum);
-                               conf_me->numeric = 0;
+               }
+               if (!tld_ptr->flag.rulesptr) {
+                       while (tld_ptr->rules) {
+                               motd = tld_ptr->rules->next;
+                               ircfree(tld_ptr->rules->line);
+                               ircfree(tld_ptr->rules);
+                               tld_ptr->rules = motd;
                        }
                }
-               else
+               DelListItem(tld_ptr, conf_tld);
+               MyFree(tld_ptr);
+       }
+       for (vhost_ptr = conf_vhost; vhost_ptr; vhost_ptr = (ConfigItem_vhost *) next)
+       {
+               ConfigItem_oper_from *vhost_from;
+               
+               next = (ListStruct *)vhost_ptr->next;
+               
+               ircfree(vhost_ptr->login);
+               Auth_DeleteAuthStruct(vhost_ptr->auth);
+               ircfree(vhost_ptr->virthost);
+               ircfree(vhost_ptr->virtuser);
+               for (vhost_from = (ConfigItem_oper_from *) vhost_ptr->from; vhost_from;
+                       vhost_from = (ConfigItem_oper_from *) next2)
                {
-                       config_status("%s:%i: unknown directive me::%s",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum,
-                               cep->ce_varname);
+                       next2 = (ListStruct *)vhost_from->next;
+                       ircfree(vhost_from->name);
+                       DelListItem(vhost_from, vhost_ptr->from);
+                       MyFree(vhost_from);
                }
+               DelListItem(vhost_ptr, conf_vhost);
+               MyFree(vhost_ptr);
        }
-       return 0;
-}
 
-int    _conf_loadmodule(ConfigFile *conf, ConfigEntry *ce)
-{
-#ifdef GLOBH
-       glob_t files;
-       int i;
-#elif defined(_WIN32)
-       HANDLE hFind;
-       WIN32_FIND_DATA FindData;
-#endif
-       char *ret;
-       if (!ce->ce_vardata)
-       {
-               config_status("%s:%i: loadmodule without filename",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+#ifdef STRIPBADWORDS
+       for (badword_ptr = conf_badword_channel; badword_ptr;
+               badword_ptr = (ConfigItem_badword *) next) {
+               next = (ListStruct *)badword_ptr->next;
+               ircfree(badword_ptr->word);
+                       ircfree(badword_ptr->replace);
+               DelListItem(badword_ptr, conf_badword_channel);
+               MyFree(badword_ptr);
+       }
+       for (badword_ptr = conf_badword_message; badword_ptr;
+               badword_ptr = (ConfigItem_badword *) next) {
+               next = (ListStruct *)badword_ptr->next;
+               ircfree(badword_ptr->word);
+                       ircfree(badword_ptr->replace);
+               DelListItem(badword_ptr, conf_badword_message);
+               MyFree(badword_ptr);
        }
-#ifdef GLOBH
-#if defined(__OpenBSD__) && defined(GLOB_LIMIT)
-       glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK|GLOB_LIMIT, NULL, &files);
-#else
-       glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK, NULL, &files);
 #endif
-       if (!files.gl_pathc) {
-               globfree(&files);
-               config_status("%s:%i: loadmodule %s: failed to load",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                       ce->ce_vardata);
-               return -1;
-       }       
-       for (i = 0; i < files.gl_pathc; i++) {
-               if ((ret = Module_Load(files.gl_pathv[i],0))) {
-                       config_status("%s:%i: loadmodule %s: failed to load: %s",
-                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                               files.gl_pathv[i], ret);
+       for (deny_dcc_ptr = conf_deny_dcc; deny_dcc_ptr; deny_dcc_ptr = (ConfigItem_deny_dcc *)next)
+       {
+               next = (ListStruct *)deny_dcc_ptr->next;
+               if (deny_dcc_ptr->flag.type2 == CONF_BAN_TYPE_CONF)
+               {
+                       ircfree(deny_dcc_ptr->filename);
+                       ircfree(deny_dcc_ptr->reason);
+                       DelListItem(deny_dcc_ptr, conf_deny_dcc);
+                       MyFree(deny_dcc_ptr);
                }
        }
-       globfree(&files);
-#elif defined(_WIN32)
-       hFind = FindFirstFile(ce->ce_vardata, &FindData);
-       if (!FindData.cFileName) {
-               config_status("%s:%i: loadmodule %s: failed to load",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                       ce->ce_vardata);
-               FindClose(hFind);
-               return -1;
-       }
-       if ((ret = Module_Load(FindData.cFileName,0))) {
-                       config_status("%s:%i: loadmodule %s: failed to load: %s",
-                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                               FindData.cFileName, ret);
-       }
-       while (FindNextFile(hFind, &FindData) != 0) {
-               if (((ret = Module_Load(FindData.cFileName,0)))) 
-                       config_status("%s:%i: loadmodule %s: failed to load: %s",
-                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                               FindData.cFileName, ret);
+       for (deny_link_ptr = conf_deny_link; deny_link_ptr; deny_link_ptr = (ConfigItem_deny_link *) next) {
+               next = (ListStruct *)deny_link_ptr->next;
+               ircfree(deny_link_ptr->prettyrule);
+               ircfree(deny_link_ptr->mask);
+               crule_free(&deny_link_ptr->rule);
+               DelListItem(deny_link_ptr, conf_deny_link);
+               MyFree(deny_link_ptr);
        }
-       FindClose(hFind);
-#else
-       if ((ret = Module_Load(ce->ce_vardata,0))) {
-                       config_status("%s:%i: loadmodule %s: failed to load: %s",
-                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                               ce->ce_vardata, ret);
-                               return -1;
+       for (deny_version_ptr = conf_deny_version; deny_version_ptr; deny_version_ptr = (ConfigItem_deny_version *) next) {
+               next = (ListStruct *)deny_version_ptr->next;
+               ircfree(deny_version_ptr->mask);
+               ircfree(deny_version_ptr->version);
+               ircfree(deny_version_ptr->flags);
+               DelListItem(deny_version_ptr, conf_deny_version);
+               MyFree(deny_version_ptr);
        }
-#endif
-       return 1;
-}
-/*
- * The oper {} block parser
-*/
 
-int    _conf_oper(ConfigFile *conf, ConfigEntry *ce)
-{
-       ConfigEntry *cep;
-       ConfigEntry *cepp;
-       ConfigItem_oper *oper = NULL;
-       ConfigItem_oper_from *from;
-       OperFlag *ofp = NULL;
-       unsigned char   isnew = 0;
+       for (deny_channel_ptr = conf_deny_channel; deny_channel_ptr; deny_channel_ptr = (ConfigItem_deny_channel *) next)
+       {
+               next = (ListStruct *)deny_channel_ptr->next;
+               ircfree(deny_channel_ptr->channel);
+               ircfree(deny_channel_ptr->reason);
+               DelListItem(deny_channel_ptr, conf_deny_channel);
+               MyFree(deny_channel_ptr);
+       }
 
-       if (!ce->ce_vardata)
+       for (allow_channel_ptr = conf_allow_channel; allow_channel_ptr; allow_channel_ptr = (ConfigItem_allow_channel *) next)
        {
-               config_status("%s:%i: oper without name",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+               next = (ListStruct *)allow_channel_ptr->next;
+               ircfree(allow_channel_ptr->channel);
+               DelListItem(allow_channel_ptr, conf_allow_channel);
+               MyFree(allow_channel_ptr);
        }
 
-       if (!(oper = Find_oper(ce->ce_vardata)))
+       if (conf_drpass)
        {
-               oper =  MyMallocEx(sizeof(ConfigItem_oper));
-               oper->name = strdup(ce->ce_vardata);
-               isnew = 1;
+               Auth_DeleteAuthStruct(conf_drpass->restartauth);
+               conf_drpass->restartauth = NULL;
+               Auth_DeleteAuthStruct(conf_drpass->dieauth);
+               conf_drpass->dieauth = NULL;
+               ircfree(conf_drpass);
        }
-       else
+       for (log_ptr = conf_log; log_ptr; log_ptr = (ConfigItem_log *)next) {
+               next = (ListStruct *)log_ptr->next;
+               ircfree(log_ptr->file);
+               DelListItem(log_ptr, conf_log);
+               MyFree(log_ptr);
+       }
+       for (alias_ptr = conf_alias; alias_ptr; alias_ptr = (ConfigItem_alias *)next) {
+               aCommand *cmptr = find_Command(alias_ptr->alias, 0, 0);
+               ConfigItem_alias_format *fmt;
+               next = (ListStruct *)alias_ptr->next;           
+               ircfree(alias_ptr->nick);
+               del_Command(alias_ptr->alias, NULL, cmptr->func);
+               ircfree(alias_ptr->alias);
+               if (alias_ptr->format && alias_ptr->type == ALIAS_COMMAND) {
+                       for (fmt = (ConfigItem_alias_format *) alias_ptr->format; fmt; fmt = (ConfigItem_alias_format *) next2)
+                       {
+                               next2 = (ListStruct *)fmt->next;
+                               ircfree(fmt->format);
+                               ircfree(fmt->nick);
+                               ircfree(fmt->parameters);
+                               DelListItem(fmt, alias_ptr->format);
+                               MyFree(fmt);
+                       }
+               }
+               DelListItem(alias_ptr, conf_alias);
+               MyFree(alias_ptr);
+       }
+       for (include_ptr = conf_include; include_ptr; include_ptr = (ConfigItem_include *)next)
        {
-               isnew = 0;
+               next = (ListStruct *)include_ptr->next;  
+               ircfree(include_ptr->file);
+               DelListItem(include_ptr, conf_include);
+               MyFree(include_ptr);
+       }
+       for (help_ptr = conf_help; help_ptr; help_ptr = (ConfigItem_help *)next) {
+               aMotd *text;
+               next = (ListStruct *)help_ptr->next;
+               ircfree(help_ptr->command);
+               while (help_ptr->text) {
+                       text = help_ptr->text->next;
+                       ircfree(help_ptr->text->line);
+                       ircfree(help_ptr->text);
+                       help_ptr->text = text;
+               }
+               DelListItem(help_ptr, conf_help);
+               MyFree(help_ptr);
        }
 
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+}
+
+int    config_post_test()
+{
+#define Error(x) { config_error((x)); errors++; }
+       int     errors = 0;
+       
+       if (!requiredstuff.conf_me)
+               Error("me {} block missing");
+       if (!requiredstuff.conf_admin)
+               Error("admin {} block missing");
+       if (!requiredstuff.conf_listen)
+               Error("listen {} block missing");
+       if (!requiredstuff.settings.kline_address)
+               Error("set::kline-address missing");
+       if (!requiredstuff.settings.maxchannelsperuser)
+               Error("set::maxchannelsperuser missing");
+       if (!requiredstuff.settings.name_server)
+               Error("set::dns::nameserver missing");
+       if (!requiredstuff.settings.host_timeout)
+               Error("set::dns::host-timeout missing");
+       if (!requiredstuff.settings.host_retries)
+               Error("set::dns::host-retries missing");
+       if (!requiredstuff.settings.defaultserv)
+               Error("set::default-server missing");
+       if (!requiredstuff.settings.irc_network)
+               Error("set::network-name missing");
+       if (!requiredstuff.settings.operhost)
+               Error("set::hosts::global missing");
+       if (!requiredstuff.settings.adminhost)
+               Error("set::hosts::admin missing");
+       if (!requiredstuff.settings.sadminhost)
+               Error("set::hosts::servicesadmin missing");
+       if (!requiredstuff.settings.netadminhost)
+               Error("set::hosts::netadmin missing");
+       if (!requiredstuff.settings.coadminhost)
+               Error("set::hosts::coadmin missing");
+       if (!requiredstuff.settings.cloakkeys)
+               Error("set::cloak-keys missing");
+       if (!requiredstuff.settings.hlpchan)
+               Error("set::help-channel missing");
+       if (!requiredstuff.settings.hidhost)
+               Error("set::hiddenhost-prefix missing");
+       for (global_i = Hooks[HOOKTYPE_CONFIGPOSTTEST]; global_i; 
+               global_i = global_i->next) 
        {
-               if (!cep->ce_varname)
-               {
-                       config_status("%s:%i: oper item without variable name",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+               int value, errs = 0;
+               if (global_i->owner && !(global_i->owner->flags & MODFLAG_TESTING))
                        continue;
-               }
-               if (!strcmp(cep->ce_varname, "password"))
+               value = (*(global_i->func.intfunc))(&errs);
+               if (value == -1)
                {
-                       oper->auth = Auth_ConvertConf2AuthStruct(cep);
-                       continue;
+                       errors += errs;
+                       break;
                }
-               if (!cep->ce_entries)
+               if (value == -2)
+                       errors += errs;
+       }
+       return errors;  
+}
+
+int    config_run()
+{
+       ConfigEntry     *ce;
+       ConfigFile      *cfptr;
+       ConfigCommand   *cc;
+       int             errors = 0;
+       for (cfptr = conf; cfptr; cfptr = cfptr->cf_next)
+       {
+               if (config_verbose > 1)
+                       config_status("Running %s", cfptr->cf_filename);
+               for (ce = cfptr->cf_entries; ce; ce = ce->ce_next)
                {
-                       /* standard variable */
-                       if (!cep->ce_vardata)
-                       {
-                               config_status("%s:%i: oper::%s without parameter",
-                                       cep->ce_fileptr->cf_filename,
-                                       cep->ce_varlinenum,
-                                       cep->ce_varname);
-                               continue;
+                       if ((cc = config_binary_search(ce->ce_varname))) {
+                               if ((cc->conffunc) && (cc->conffunc(cfptr, ce) < 0))
+                                       errors++;
                        }
-                       if (!strcmp(cep->ce_varname, "class"))
+                       else
                        {
-                               oper->class = Find_class(cep->ce_vardata);
-                               if (!oper->class)
+                               int value;
+                               for (global_i = Hooks[HOOKTYPE_CONFIGRUN]; global_i;
+                                    global_i = global_i->next)
                                {
-                                       config_status("%s:%i: illegal oper::class, unknown class '%s' using default of class 'default'",
-                                               cep->ce_fileptr->cf_filename,
-                                               cep->ce_varlinenum,
-                                               cep->ce_vardata);
-                                       oper->class = default_class;
+                                       value = (*(global_i->func.intfunc))(cfptr,ce,CONFIG_MAIN);
+                                       if (value == 1)
+                                               break;
                                }
                        }
-                       else if (!strcmp(cep->ce_varname, "swhois")) {
-                               ircstrdup(oper->swhois, cep->ce_vardata);
-                       }
-                       else if (!strcmp(cep->ce_varname, "snomask")) {
-                                       ircstrdup(oper->snomask, cep->ce_vardata);
-                       }
-                       else if (!strcmp(cep->ce_varname, "flags"))
-                       {
-                               char *m = "*";
-                               int *i, flag;
+               }
+       }
 
-                                       for (m = (*cep->ce_vardata) ? cep->ce_vardata : m; *m; m++) {
-                                               for (i = _OldOperFlags; (flag = *i); i += 2)
-                                                       if (*m == (char)(*(i + 1))) {
-                                                               oper->oflags |= flag;
-                                                               break;
-                                                       }
-                               }
-                       }
+       close_listeners();
+       listen_cleanup();
+       close_listeners();
+       loop.do_bancheck = 1;
+       free_iConf(&iConf);
+       bcopy(&tempiConf, &iConf, sizeof(aConfiguration));
+       bzero(&tempiConf, sizeof(aConfiguration));
+       if (errors > 0)
+       {
+               config_error("%i fatal errors encountered", errors);
+       }
+       return (errors > 0 ? -1 : 1);
+}
 
-                       else
-                       {
-                               config_status("%s:%i: unknown directive oper::%s",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                               cep->ce_varname);
-                               continue;
-                       }
+
+OperFlag *config_binary_flags_search(OperFlag *table, char *cmd, int size) {
+       int start = 0;
+       int stop = size;
+       int mid;
+       while (start <= stop) {
+               mid = (start+stop)/2;
+               if (smycmp(cmd,table[mid].name) < 0) {
+                       stop = mid-1;
+               }
+               else if (smycmp(cmd,table[mid].name) == 0) {
+                       return &(table[mid]);
                }
                else
+                       start = mid+1;
+       }
+       return NULL;
+}
+
+
+int    config_test()
+{
+       ConfigEntry     *ce;
+       ConfigFile      *cfptr;
+       ConfigCommand   *cc;
+       int             errors = 0;
+
+       for (cfptr = conf; cfptr; cfptr = cfptr->cf_next)
+       {
+               if (config_verbose > 1)
+                       config_status("Testing %s", cfptr->cf_filename);
+               for (ce = cfptr->cf_entries; ce; ce = ce->ce_next)
                {
-                       /* Section */
-                       if (!strcmp(cep->ce_varname, "flags"))
+                       if (!ce->ce_varname)
                        {
-                               for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
-                               {
-                                       if (!cepp->ce_varname)
-                                       {
-                                               config_status("%s:%i: oper::flags item without variable name",
-                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
-                                               continue;
-                                       }
-                                       /* this should have been olp ;) -Stskeeps */
-                                       for (ofp = _OperFlags; ofp->name; ofp++)
-                                       {
-                                               if (!strcmp(ofp->name, cepp->ce_varname))
-                                               {
-                                                       oper->oflags |= ofp->flag;
-                                                       break;
-                                               }
-                                       }
-                                       if (!ofp->name)
-                                       {
-                                               config_status("%s:%i: unknown oper flag '%s'",
-                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
-                                                       cepp->ce_varname);
-                                               continue;
-                                       }
-                               }
-                               continue;
+                               config_error("%s:%i: %s:%i: null ce->ce_varname",
+                                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                                       __FILE__, __LINE__);
+                               return -1;
                        }
-                       else
-                       if (!strcmp(cep->ce_varname, "from"))
+                       if ((cc = config_binary_search(ce->ce_varname))) {
+                               if (cc->testfunc)
+                                       errors += (cc->testfunc(cfptr, ce));
+                       }
+                       else 
                        {
-                               for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+                               int used = 0;
+                               for (global_i = Hooks[HOOKTYPE_CONFIGTEST]; global_i; 
+                                       global_i = global_i->next) 
                                {
-                                       if (!cepp->ce_varname)
-                                       {
-                                               config_status("%s:%i: oper::from item without variable name",
-                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
+                                       int value, errs = 0;
+                                       if (global_i->owner && !(global_i->owner->flags & MODFLAG_TESTING))
                                                continue;
-                                       }
-                                       if (!cepp->ce_vardata)
+                                       value = (*(global_i->func.intfunc))(cfptr,ce,CONFIG_MAIN,&errs);
+                                       if (value == 2)
+                                               used = 1;
+                                       if (value == 1)
                                        {
-                                               config_status("%s:%i: oper::from::%s without parameter",
-                                                       cepp->ce_fileptr->cf_filename,
-                                                       cepp->ce_varlinenum,
-                                                       cepp->ce_varname);
-                                               continue;
+                                               used = 1;
+                                               break;
                                        }
-                                       if (!strcmp(cepp->ce_varname, "userhost"))
+                                       if (value == -1)
                                        {
-                                               from = MyMallocEx(sizeof(ConfigItem_oper_from));
-                                               ircstrdup(from->name, cepp->ce_vardata);
-                                               AddListItem(from, oper->from);
+                                               used = 1;
+                                               errors += errs;
+                                               break;
                                        }
-                                       else
+                                       if (value == -2) 
                                        {
-                                               config_status("%s:%i: unknown directive oper::from::%s",
-                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
-                                                       cepp->ce_varname);
-                                               continue;
+                                               used = 1;
+                                               errors += errs;
                                        }
+                                               
                                }
-                               continue;
-                       }
-                       else
-                       {
-                               config_status("%s:%i: unknown directive oper::%s (section)",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                               cep->ce_varname);
-                               continue;
+                               if (!used)
+                                       config_status("%s:%i: unknown directive %s", 
+                                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                                               ce->ce_varname);
                        }
                }
-
        }
-       if (isnew)
-               AddListItem(oper, conf_oper);
-       return 0;
+       errors += config_post_test();
+       if (errors > 0)
+       {
+               config_error("%i errors encountered", errors);
+       }
+       return (errors > 0 ? -1 : 1);
 }
 
+/*
+ * Service functions
+*/
 
-int     _conf_drpass(ConfigFile *conf, ConfigEntry *ce)
+ConfigItem_deny_dcc    *Find_deny_dcc(char *name)
 {
-       ConfigEntry *cep;
+       ConfigItem_deny_dcc     *p;
 
-       if (!conf_drpass) {
-               conf_drpass =  MyMallocEx(sizeof(ConfigItem_drpass));
-       }
+       if (!name)
+               return NULL;
 
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       for (p = conf_deny_dcc; p; p = (ConfigItem_deny_dcc *) p->next)
        {
-               if (!cep->ce_varname)
-               {
-                       config_status("%s:%i: drpass item without variable name",
-                        cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                       continue;
-               }
-               if (!cep->ce_vardata)
-               {
-                       config_status("%s:%i: missing parameter in drpass:%s",
-                        cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                               cep->ce_varname);
-                       continue;
-               }
-               if (!strcmp(cep->ce_varname, "restart"))
-               {
-                       if (conf_drpass->restartauth)
-                               Auth_DeleteAuthStruct(conf_drpass->restartauth);
-                       
-                       conf_drpass->restartauth = Auth_ConvertConf2AuthStruct(cep);
-               }
-               else if (!strcmp(cep->ce_varname, "die"))
-               {
-                       if (conf_drpass->dieauth)
-                               Auth_DeleteAuthStruct(conf_drpass->dieauth);
-                       
-                       conf_drpass->dieauth = Auth_ConvertConf2AuthStruct(cep);
-               }
-               else
-                       config_status("%s:%i: warning: unknown drpass directive '%s'",
-                                cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                cep->ce_varname);
+               if (!match(name, p->filename))
+                       return (p);
        }
-       return 0;
+       return NULL;
 }
 
-int     _conf_tld(ConfigFile *conf, ConfigEntry *ce)
-{
-       ConfigEntry *cep;
-       ConfigItem_tld *ca;
+ConfigItem_alias *Find_alias(char *name) {
+       ConfigItem_alias *alias;
 
-       ca = MyMallocEx(sizeof(ConfigItem_tld));
-        for (cep = ce->ce_entries; cep; cep = cep->ce_next)
-       {
-               if (!cep->ce_varname)
-               {
-                       config_status("%s:%i: blank tld item",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
-               }
-               if (!cep->ce_vardata)
-               {
-                       config_status("%s:%i: missing parameter in tld::%s",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                               cep->ce_varname);
-                       continue;
-               }
+       if (!name)
+               return NULL;
 
-               if (!strcmp(cep->ce_varname, "mask")) {
-                       ca->mask = strdup(cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "motd")) {
-                       if (!(ca->motd = Find_file(cep->ce_vardata,0)))
-                               ca->motd = read_motd(cep->ce_vardata);
-                       else
-                               ca->flag.motdptr = 1;
-                       ca->motd_file = strdup(cep->ce_vardata);
-                       ca->motd_tm = motd_tm;
-               }
-               else if (!strcmp(cep->ce_varname, "rules")) {
-                       if (!(ca->rules = Find_file(cep->ce_vardata,1)))
-                               ca->rules = read_rules(cep->ce_vardata);
-                       else
-                               ca->flag.rulesptr = 1;
-                       ca->rules_file = strdup(cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "channel")) {
-                       ca->channel = strdup(cep->ce_vardata);
-               }
-               else
-               {
-                       config_status("%s:%i: unknown directive tld::%s",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                               cep->ce_varname);
-               }
+       for (alias = conf_alias; alias; alias = (ConfigItem_alias *)alias->next) {
+               if (!stricmp(alias->alias, name))
+                       return alias;
        }
-       AddListItem(ca, conf_tld);
-       return 0;
+       return NULL;
 }
 
-/*
- * listen {} block parser
-*/
-int    _conf_listen(ConfigFile *conf, ConfigEntry *ce)
+ConfigItem_class       *Find_class(char *name)
 {
-       ConfigEntry *cep;
-       ConfigEntry *cepp;
-       ConfigItem_listen *listen = NULL;
-       OperFlag    *ofp;
-       char        copy[256];
-       char        *ip;
-       char        *port;
-       int         iport;
-       unsigned char   isnew = 0;
+       ConfigItem_class        *p;
 
-       if (!ce->ce_vardata)
+       if (!name)
+               return NULL;
+
+       for (p = conf_class; p; p = (ConfigItem_class *) p->next)
        {
-               config_status("%s:%i: listen without ip:port",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+               if (!strcmp(name, p->name))
+                       return (p);
        }
+       return NULL;
+}
 
-       strcpy(copy, ce->ce_vardata);
-       /* Seriously cheap hack to make listen <port> work -Stskeeps */
-       ipport_seperate(copy, &ip, &port);
-       if (!ip || !*ip)
+ConfigItem_oper        *Find_oper(char *name)
+{
+       ConfigItem_oper *p;
+
+       if (!name)
+               return NULL;
+
+       for (p = conf_oper; p; p = (ConfigItem_oper *) p->next)
        {
-               config_status("%s:%i: listen: illegal ip:port mask",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+               if (!strcmp(name, p->name))
+                       return (p);
        }
-       if (strchr(ip, '*') && strcmp(ip, "*"))
+       return NULL;
+}
+
+ConfigItem_listen      *Find_listen(char *ipmask, int port)
+{
+       ConfigItem_listen       *p;
+
+       if (!ipmask)
+               return NULL;
+
+       for (p = conf_listen; p; p = (ConfigItem_listen *) p->next)
        {
-               config_status("%s:%i: listen: illegal ip, (mask, and not '*')",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+               if (!match(p->ip, ipmask) && (port == p->port))
+                       return (p);
+               if (!match(ipmask, p->ip) && (port == p->port))
+                       return (p);
        }
-       if (!port || !*port)
-       {
-               config_status("%s:%i: listen: missing port in mask",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+       return NULL;
+}
+
+ConfigItem_ulines *Find_uline(char *host) {
+       ConfigItem_ulines *ulines;
+
+       if (!host)
+               return NULL;
+
+       for(ulines = conf_ulines; ulines; ulines =(ConfigItem_ulines *) ulines->next) {
+               if (!stricmp(host, ulines->servername))
+                       return ulines;
        }
-       iport = atol(port);
-       if ((iport < 0) || (iport > 65535))
-       {
-               config_status("%s:%i: listen: illegal port (must be 0..65536)",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+       return NULL;
+}
+
+
+ConfigItem_except *Find_except(char *host, short type) {
+       ConfigItem_except *excepts;
+
+       if (!host)
+               return NULL;
+
+       for(excepts = conf_except; excepts; excepts =(ConfigItem_except *) excepts->next) {
+               if (excepts->flag.type == type)
+                       if (!match(excepts->mask, host))
+                               return excepts;
        }
-       if (!(listen = Find_listen(ip, iport)))
+       return NULL;
+}
+
+ConfigItem_tld *Find_tld(char *host) {
+       ConfigItem_tld *tld;
+
+       if (!host)
+               return NULL;
+
+       for(tld = conf_tld; tld; tld = (ConfigItem_tld *) tld->next)
        {
-               listen = MyMallocEx(sizeof(ConfigItem_listen));
-               listen->ip = strdup(ip);
-               listen->port = iport;
-               isnew = 1;
+               if (!match(tld->mask, host))
+                       return tld;
        }
-       else
+       return NULL;
+}
+
+
+ConfigItem_link *Find_link(char *username,
+                          char *hostname,
+                          char *ip,
+                          char *servername)
+{
+       ConfigItem_link *link;
+
+       if (!username || !hostname || !servername || !ip)
+               return NULL;
+
+       for(link = conf_link; link; link = (ConfigItem_link *) link->next)
        {
-               isnew = 0;
+               if (!match(link->servername, servername) &&
+                   !match(link->username, username) &&
+                   (!match(link->hostname, hostname) || !match(link->hostname, ip)))
+                       return link;
        }
+       return NULL;
 
+}
 
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
-       {
-               if (!cep->ce_varname)
-               {
-                       config_status("%s:%i: listen item without variable name",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                       continue;
-               }
-               if (!cep->ce_vardata && !cep->ce_entries)
-               {
-                       config_status("%s:%i: listen::%s without parameter",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum,
-                               cep->ce_varname);
-                       continue;
-               }
-               if (!strcmp(cep->ce_varname, "options"))
-               {
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
-                       {
-                               if (!cepp->ce_varname)
-                               {
-                                       config_status("%s:%i: listen::options item without variable name",
-                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
-                                       continue;
-                               }
-                               for (ofp = _ListenerFlags; ofp->name; ofp++)
-                               {
-                                       if (!strcmp(ofp->name, cepp->ce_varname))
-                                       {
-                                               if (!(listen->options & ofp->flag))
-                                                       listen->options |= ofp->flag;
-                                               break;
-                                       }
-                               }
-                               if (!ofp->name)
-                               {
-                                       config_status("%s:%i: unknown listen option '%s'",
-                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
-                                               cepp->ce_varname);
-                                       continue;
-                               }
+ConfigItem_ban         *Find_ban(char *host, short type)
+{
+       ConfigItem_ban *ban;
+
+       /* Check for an except ONLY if we find a ban, makes it
+        * faster since most users will not have a ban so excepts
+        * don't need to be searched -- codemastr
+        */
+
+       for (ban = conf_ban; ban; ban = (ConfigItem_ban *) ban->next)
+               if (ban->flag.type == type)
+                       if (!match(ban->mask, host)) {
+                               /* Person got a exception */
+                               if (type == CONF_BAN_USER && Find_except(host, CONF_EXCEPT_BAN))
+                                       return NULL;
+                               return ban;
                        }
-               }
-               else
-               {
-                       config_status("%s:%i: unknown directive listen::%s",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                       cep->ce_varname);
-                       continue;
-               }
+       return NULL;
+}
 
-       }
-       if (isnew)
-               AddListItem(listen, conf_listen);
-       listen->flag.temporary = 0;
-       return 0;
+ConfigItem_ban         *Find_banEx(char *host, short type, short type2)
+{
+       ConfigItem_ban *ban;
+
+       /* Check for an except ONLY if we find a ban, makes it
+        * faster since most users will not have a ban so excepts
+        * don't need to be searched -- codemastr
+        */
+
+       for (ban = conf_ban; ban; ban = (ConfigItem_ban *) ban->next)
+               if ((ban->flag.type == type) && (ban->flag.type2 == type2))
+                       if (!match(ban->mask, host)) {
+                               /* Person got a exception */
+                               if (Find_except(host, type))
+                                       return NULL;
+                               return ban;
+                       }
+       return NULL;
 }
 
-/*
- * allow {} block parser
-*/
-int    _conf_allow(ConfigFile *conf, ConfigEntry *ce)
+int    AllowClient(aClient *cptr, struct hostent *hp, char *sockhost)
 {
-       ConfigEntry *cep, *cepp;
-       ConfigItem_allow *allow;
-       unsigned char isnew = 0;
+       ConfigItem_allow *aconf;
+       char *hname;
+       int  i, ii = 0;
+       static char uhost[HOSTLEN + USERLEN + 3];
+       static char fullname[HOSTLEN + 1];
 
-       if (ce->ce_vardata)
+       for (aconf = conf_allow; aconf; aconf = (ConfigItem_allow *) aconf->next)
        {
-               if (!strcmp(ce->ce_vardata, "channel"))
+               if (!aconf->hostname || !aconf->ip)
+                       goto attach;
+               if (hp)
+                       for (i = 0, hname = hp->h_name; hname;
+                           hname = hp->h_aliases[i++])
+                       {
+                               strncpyzt(fullname, hname,
+                                   sizeof(fullname));
+                               add_local_domain(fullname,
+                                   HOSTLEN - strlen(fullname));
+                               Debug((DEBUG_DNS, "a_il: %s->%s",
+                                   sockhost, fullname));
+                               if (index(aconf->hostname, '@'))
+                               {
+                                       /*
+                                        * Doing strlcpy / strlcat here
+                                        * would simply be a waste. We are
+                                        * ALREADY sure that it is proper 
+                                        * lengths
+                                       */
+                                       (void)strcpy(uhost, cptr->username);
+                                       (void)strcat(uhost, "@");
+                               }
+                               else
+                                       *uhost = '\0';
+                               /* 
+                                * Same here as above
+                                * -Stskeeps 
+                               */
+                               (void)strncat(uhost, fullname,
+                                   sizeof(uhost) - strlen(uhost));
+                               if (!match(aconf->hostname, uhost))
+                                       goto attach;
+                       }
+
+               if (index(aconf->ip, '@'))
                {
-                       _conf_allow_channel(conf, ce);
-                       return 0;
+                       strncpyzt(uhost, cptr->username, sizeof(uhost));
+                       (void)strcat(uhost, "@");
                }
                else
+                       *uhost = '\0';
+               (void)strncat(uhost, sockhost, sizeof(uhost) - strlen(uhost));
+               if (!match(aconf->ip, uhost))
+                       goto attach;
+               continue;
+             attach:
+/*             if (index(uhost, '@'))  now flag based -- codemastr */
+               if (!aconf->flags.noident)
+                       cptr->flags |= FLAGS_DOID;
+               if (!aconf->flags.useip && hp) 
+                       strncpyzt(uhost, fullname, sizeof(uhost));
+               else
+                       strncpyzt(uhost, sockhost, sizeof(uhost));
+               get_sockhost(cptr, uhost);
+               /* FIXME */
+               if (aconf->maxperip)
                {
-                       ConfigItem_unknown *ca2 = MyMalloc(sizeof(ConfigItem_unknown));
-                       ca2->ce = ce;
-                       AddListItem(ca2, conf_unknown);
-                       return -1;
+                       ii = 1;
+                       for (i = LastSlot; i >= 0; i--)
+                               if (local[i] && MyClient(local[i]) &&
+#ifndef INET6
+                                   local[i]->ip.S_ADDR == cptr->ip.S_ADDR)
+#else
+                                   !bcmp(local[i]->ip.S_ADDR, cptr->ip.S_ADDR, sizeof(cptr->ip.S_ADDR)))
+#endif
+                               {
+                                       ii++;
+                                       if (ii > aconf->maxperip)
+                                       {
+                                               exit_client(cptr, cptr, &me,
+                                                       "Too many connections from your IP");
+                                               return -5;      /* Already got one with that ip# */
+                                       }
+                               }
                }
-       }
-
-       allow =  MyMallocEx(sizeof(ConfigItem_allow));
-       isnew = 1;
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
-       {
-               if (!cep->ce_varname)
+               if ((i = Auth_Check(cptr, aconf->auth, cptr->passwd)) == -1)
                {
-                       config_status("%s:%i: allow item without variable name",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                       continue;
+                       exit_client(cptr, cptr, &me,
+                               "Password mismatch");
+                       return -5;
                }
-               if (!strcmp(cep->ce_varname, "ip"))
-               {
-                       allow->ip = strdup(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "maxperip"))
-               {
-                       allow->maxperip = atoi(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "hostname"))
-               {
-                       allow->hostname = strdup(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "password"))
-               {
-                       allow->auth = Auth_ConvertConf2AuthStruct(cep);
-               } else
-               if (!strcmp(cep->ce_varname, "class"))
+               if ((i == 2) && (cptr->passwd))
                {
-                       allow->class = Find_class(cep->ce_vardata);
-                       if (!allow->class)
-                       {
-                               config_status("%s:%i: illegal allow::class, unknown class '%s' using default of class 'default'",
-                                       cep->ce_fileptr->cf_filename,
-                                       cep->ce_varlinenum,
-                                       cep->ce_vardata);
-                               allow->class = default_class;
-                       }
+                       MyFree(cptr->passwd);
+                       cptr->passwd = NULL;
                }
-               else if (!strcmp(cep->ce_varname, "redirect-server"))
+               if (!((aconf->class->clients + 1) > aconf->class->maxclients))
                {
-                       allow->server = strdup(cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "redirect-port")) {
-                       allow->port = atoi(cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "options")) {
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
-                               if (!strcmp(cepp->ce_varname, "noident"))
-                                       allow->flags.noident = 1;
-                               else if (!strcmp(cepp->ce_varname, "useip")) 
-                                       allow->flags.useip = 1;
-                       }
+                       cptr->class = aconf->class;
+                       cptr->class->clients++;
                }
                else
                {
-                       config_status("%s:%i: unknown directive allow::%s",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                       cep->ce_varname);
-                       continue;
+                       sendto_one(cptr, rpl_str(RPL_REDIR), me.name, cptr->name, aconf->server ? aconf->server : defserv, aconf->port ? aconf->port : 6667);
+                       return -3;
                }
+               return 0;
        }
-       if (isnew)
-               AddListItem(allow, conf_allow);
-       return 0;
+       return -1;
 }
 
-int    _conf_allow_channel(ConfigFile *conf, ConfigEntry *ce)
+ConfigItem_vhost *Find_vhost(char *name) {
+       ConfigItem_vhost *vhost;
+
+       for (vhost = conf_vhost; vhost; vhost = (ConfigItem_vhost *)vhost->next) {
+               if (!strcmp(name, vhost->login))
+                       return vhost;
+       }
+       return NULL;
+}
+
+
+ConfigItem_deny_channel *Find_channel_allowed(char *name)
 {
-       ConfigItem_allow_channel        *allow = NULL;
-       ConfigEntry             *cep;
+       ConfigItem_deny_channel *dchannel;
+       ConfigItem_allow_channel *achannel;
 
-       allow = MyMallocEx(sizeof(ConfigItem_allow_channel));
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       for (dchannel = conf_deny_channel; dchannel; dchannel = (ConfigItem_deny_channel *)dchannel->next)
        {
-               if (!cep->ce_varname || !cep->ce_vardata)
-               {
-                       config_status("%s:%i: blank allow channel item",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
-               }
-               if (!strcmp(cep->ce_varname, "channel"))
+               if (!match(dchannel->channel, name))
+                       break;
+       }
+       if (dchannel)
+       {
+               for (achannel = conf_allow_channel; achannel; achannel = (ConfigItem_allow_channel *)achannel->next)
                {
-                       ircstrdup(allow->channel, cep->ce_vardata);
+                       if (!match(achannel->channel, name))
+                               break;
                }
+               if (achannel)
+                       return NULL;
                else
-               {
-                       config_status("%s:%i: unknown directive allow channel::%s",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum, cep->ce_varname);
-               }
-       }
-       if (!allow->channel)
-       {
-               config_status("%s:%i: allow channel {} without channel, ignoring",
-                       cep->ce_fileptr->cf_filename,
-                       cep->ce_varlinenum);
-               ircfree(allow->channel);
-               ircfree(allow);
-               return -1;
-       }
-       else
-       {
-               AddListItem(allow, conf_allow_channel);
-               return 0;
+                       return (dchannel);
        }
-       return 0;
+       return NULL;
 }
 
-
-
-/*
- * vhost {} block parser
-*/
-int    _conf_vhost(ConfigFile *conf, ConfigEntry *ce)
+void init_dynconf(void)
 {
-       ConfigEntry *cep, *cepp;
-       ConfigItem_vhost *vhost;
-       unsigned char isnew = 0;
-       ConfigItem_oper_from *from;
-       vhost = MyMallocEx(sizeof(ConfigItem_vhost));
-       isnew = 1;
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
-       {
-               if (!cep->ce_varname)
-               {
-                       config_status("%s:%i: vhost item without variable name",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                       continue;
-               }
-               if (!strcmp(cep->ce_varname, "vhost"))
-               {
-                       char *user, *host;
-                       user = strtok(cep->ce_vardata, "@");
-                       host = strtok(NULL, "");
-                       if (!host)
-                               vhost->virthost = strdup(user);
-                       else {
-                               vhost->virtuser = strdup(user);
-                               vhost->virthost = strdup(host);
-                       }
-               }
-               else if (!strcmp(cep->ce_varname, "from"))
-               {
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
-                               {
-                                       if (!cepp->ce_varname)
-                                       {
-                                               config_status("%s:%i: vhost::from item without variable name",
-                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
-                                               continue;
-                                       }
-                                       if (!cepp->ce_vardata)
-                                       {
-                                               config_status("%s:%i: vhost::from::%s without parameter",
-                                                       cepp->ce_fileptr->cf_filename,
-                                                       cepp->ce_varlinenum,
-                                                       cepp->ce_varname);
-                                               continue;
-                                       }
-                                       if (!strcmp(cepp->ce_varname, "userhost"))
-                                       {
-                                               from = MyMallocEx(sizeof(ConfigItem_oper_from));
-                                               ircstrdup(from->name, cepp->ce_vardata);
-                                               AddListItem(from, vhost->from);
-                                       }
-                                       else
-                                       {
-                                               config_status("%s:%i: unknown directive vhost::from::%s",
-                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
-                                                       cepp->ce_varname);
-                                               continue;
-                                       }
-                               }
-                               continue;
-                       }
-                else
-               if (!strcmp(cep->ce_varname, "login"))
-               {
-                       if (!cep->ce_vardata)
-                       {
-                               config_error("%s:%i: missing parameter for vhost::login",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                               
-                               continue;               
-                       }
-                       vhost->login = strdup(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "password"))
-               {
-                       vhost->auth = Auth_ConvertConf2AuthStruct(cep);
-               }
-               else
-               {
-                       config_status("%s:%i: unknown directive vhost::%s",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                       cep->ce_varname);
-                       continue;
-               }
-       }
-       if (isnew)
-               AddListItem(vhost, conf_vhost);
-       return 0;
+       bzero(&iConf, sizeof(iConf));
+       bzero(&tempiConf, sizeof(iConf));
 }
 
-int     _conf_except(ConfigFile *conf, ConfigEntry *ce)
+/* Report the unrealircd.conf info -codemastr*/
+void report_dynconf(aClient *sptr)
 {
+       sendto_one(sptr, ":%s %i %s :*** Dynamic Configuration Report ***",
+           me.name, RPL_TEXT, sptr->name);
+       sendto_one(sptr, ":%s %i %s :kline-address: %s", me.name, RPL_TEXT,
+           sptr->name, KLINE_ADDRESS);
+       sendto_one(sptr, ":%s %i %s :modes-on-connect: %s", me.name, RPL_TEXT,
+           sptr->name, get_modestr(CONN_MODES));
+       if (OPER_ONLY_STATS)
+               sendto_one(sptr, ":%s %i %s :oper-only-stats: %s", me.name, RPL_TEXT,
+                       sptr->name, OPER_ONLY_STATS);
+       sendto_one(sptr, ":%s %i %s :anti-spam-quit-message-time: %d", me.name, RPL_TEXT,
+               sptr->name, ANTI_SPAM_QUIT_MSG_TIME);
+#ifdef USE_SSL
+       sendto_one(sptr, ":%s %i %s :ssl::egd: %s", me.name, RPL_TEXT,
+               sptr->name, EGD_PATH ? EGD_PATH : (USE_EGD ? "1" : "0"));
+       sendto_one(sptr, ":%s %i %s :ssl::certificate: %s", me.name, RPL_TEXT,
+               sptr->name, SSL_SERVER_CERT_PEM);
+       sendto_one(sptr, ":%s %i %s :ssl::key: %s", me.name, RPL_TEXT,
+               sptr->name, SSL_SERVER_KEY_PEM);
+       sendto_one(sptr, ":%s %i %s :ssl::trusted-ca-file: %s", me.name, RPL_TEXT, sptr->name,
+        iConf.trusted_ca_file ? iConf.trusted_ca_file : "<none>");
+       sendto_one(sptr, ":%s %i %s :ssl::options: %s %s %s", me.name, RPL_TEXT, sptr->name,
+               iConf.ssl_options & SSLFLAG_FAILIFNOCERT ? "FAILIFNOCERT" : "",
+               iConf.ssl_options & SSLFLAG_VERIFYCERT ? "VERIFYCERT" : "",
+               iConf.ssl_options & SSLFLAG_DONOTACCEPTSELFSIGNED ? "DONOTACCEPTSELFSIGNED" : "");
+#endif
 
-       ConfigEntry *cep;
-       ConfigItem_except *ca;
-       unsigned char isnew = 0;
-
-       ca = MyMallocEx(sizeof(ConfigItem_except));
-       isnew = 1;
-
-       if (!ce->ce_vardata)
-       {
-               config_status("%s:%i: except without type",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
-       }
-
-       if (!strcmp(ce->ce_vardata, "ban")) {
-               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
-               {
-                       if (!strcmp(cep->ce_varname, "mask")) {
-                               ca->mask = strdup(cep->ce_vardata);
-                       }
-                       else {
-                               config_status("%s:%i: unknown directive except ban::%s",
-                                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                                       cep->ce_varname);
-                       }
-               }
-               ca->flag.type = CONF_EXCEPT_BAN;
-               AddListItem(ca, conf_except);
-       }
-       else if (!strcmp(ce->ce_vardata, "scan")) {
-               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
-               {
-                       if (!strcmp(cep->ce_varname, "mask")) {
-                               ca->mask = strdup(cep->ce_vardata);
-                       }
-                       else {
-                       config_status("%s:%i: unknown directive except scan::%s",
-                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                               cep->ce_varname);
-                       }
-               }
-               ca->flag.type = CONF_EXCEPT_SCAN;
-               AddListItem(ca, conf_except);
-
-       }
-       else if (!strcmp(ce->ce_vardata, "tkl")) {
-               for (cep = ce->ce_entries; cep; cep = cep->ce_next) {
-                       if (!strcmp(cep->ce_varname, "mask")) {
-                               ca->mask = strdup(cep->ce_vardata);
-                       }
-                       else if (!strcmp(cep->ce_varname, "type")) {
-                               if (!strcmp(cep->ce_vardata, "gline"))
-                                       ca->type = TKL_KILL|TKL_GLOBAL;
-                               else if (!strcmp(cep->ce_vardata, "gzline"))
-                                       ca->type = TKL_ZAP|TKL_GLOBAL;
-                               else if (!strcmp(cep->ce_vardata, "shun"))
-                                       ca->type = TKL_SHUN|TKL_GLOBAL;
-                               else if (!strcmp(cep->ce_vardata, "tkline"))
-                                       ca->type = TKL_KILL;
-                               else if (!strcmp(cep->ce_vardata, "tzline"))
-                                       ca->type = TKL_ZAP;
-                               else 
-                                       config_status("%s:%i: unknown except tkl type %s",
-                                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                                               cep->ce_varname);
-                       }
-                       else
-                                       config_status("%s:%i: unknown directive except tkl::%s",
-                                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
-                                               cep->ce_varname);
-
-               }
-               ca->flag.type = CONF_EXCEPT_TKL;
-               AddListItem(ca, conf_except);
-       }
-       else {
-               ConfigItem_unknown *ca2 = MyMalloc(sizeof(ConfigItem_unknown));
-               MyFree(ca);
-               ca2->ce = ce;
-               AddListItem(ca2, conf_unknown);
-       }
-       return 0;
+       sendto_one(sptr, ":%s %i %s :options::show-opermotd: %d", me.name, RPL_TEXT,
+           sptr->name, SHOWOPERMOTD);
+       sendto_one(sptr, ":%s %i %s :options::hide-ulines: %d", me.name, RPL_TEXT,
+           sptr->name, HIDE_ULINES);
+       sendto_one(sptr, ":%s %i %s :options::webtv-support: %d", me.name, RPL_TEXT,
+           sptr->name, WEBTV_SUPPORT);
+       sendto_one(sptr, ":%s %i %s :options::no-stealth: %d", me.name, RPL_TEXT,
+           sptr->name, NO_OPER_HIDING);
+       sendto_one(sptr, ":%s %i %s :options::identd-check: %d", me.name, RPL_TEXT,
+           sptr->name, IDENT_CHECK);
+       sendto_one(sptr, ":%s %i %s :options::fail-oper-warn: %d", me.name, RPL_TEXT,
+           sptr->name, FAILOPER_WARN);
+       sendto_one(sptr, ":%s %i %s :options::show-connect-info: %d", me.name, RPL_TEXT,
+           sptr->name, SHOWCONNECTINFO);
+       sendto_one(sptr, ":%s %i %s :maxchannelsperuser: %i", me.name, RPL_TEXT,
+           sptr->name, MAXCHANNELSPERUSER);
+       sendto_one(sptr, ":%s %i %s :auto-join: %s", me.name, RPL_TEXT,
+           sptr->name, AUTO_JOIN_CHANS ? AUTO_JOIN_CHANS : "0");
+       sendto_one(sptr, ":%s %i %s :oper-auto-join: %s", me.name,
+           RPL_TEXT, sptr->name, OPER_AUTO_JOIN_CHANS ? OPER_AUTO_JOIN_CHANS : "0");
+       sendto_one(sptr, ":%s %i %s :static-quit: %s", me.name, 
+               RPL_TEXT, sptr->name, STATIC_QUIT ? STATIC_QUIT : "<none>");    
+       sendto_one(sptr, ":%s %i %s :dns::timeout: %li", me.name, RPL_TEXT,
+           sptr->name, HOST_TIMEOUT);
+       sendto_one(sptr, ":%s %i %s :dns::retries: %d", me.name, RPL_TEXT,
+           sptr->name, HOST_RETRIES);
+       sendto_one(sptr, ":%s %i %s :dns::nameserver: %s", me.name, RPL_TEXT,
+           sptr->name, NAME_SERVER);
 }
 
-int     _conf_ban(ConfigFile *conf, ConfigEntry *ce)
+/* Report the network file info -codemastr */
+void report_network(aClient *sptr)
 {
+       sendto_one(sptr, ":%s %i %s :*** Network Configuration Report ***",
+           me.name, RPL_TEXT, sptr->name);
+       sendto_one(sptr, ":%s %i %s :network-name: %s", me.name, RPL_TEXT,
+           sptr->name, ircnetwork);
+       sendto_one(sptr, ":%s %i %s :default-server: %s", me.name, RPL_TEXT,
+           sptr->name, defserv);
+       sendto_one(sptr, ":%s %i %s :services-server: %s", me.name, RPL_TEXT,
+           sptr->name, SERVICES_NAME);
+       sendto_one(sptr, ":%s %i %s :hosts::global: %s", me.name, RPL_TEXT,
+           sptr->name, oper_host);
+       sendto_one(sptr, ":%s %i %s :hosts::admin: %s", me.name, RPL_TEXT,
+           sptr->name, admin_host);
+       sendto_one(sptr, ":%s %i %s :hosts::local: %s", me.name, RPL_TEXT,
+           sptr->name, locop_host);
+       sendto_one(sptr, ":%s %i %s :hosts::servicesadmin: %s", me.name, RPL_TEXT,
+           sptr->name, sadmin_host);
+       sendto_one(sptr, ":%s %i %s :hosts::netadmin: %s", me.name, RPL_TEXT,
+           sptr->name, netadmin_host);
+       sendto_one(sptr, ":%s %i %s :hosts::coadmin: %s", me.name, RPL_TEXT,
+           sptr->name, coadmin_host);
+       sendto_one(sptr, ":%s %i %s :hiddenhost-prefix: %s", me.name, RPL_TEXT,
+           sptr->name, hidden_host);
+       sendto_one(sptr, ":%s %i %s :help-channel: %s", me.name, RPL_TEXT,
+           sptr->name, helpchan);
+       sendto_one(sptr, ":%s %i %s :stats-server: %s", me.name, RPL_TEXT,
+           sptr->name, STATS_SERVER);
+       sendto_one(sptr, ":%s %i %s :hosts::host-on-oper-up: %i", me.name, RPL_TEXT, sptr->name,
+           iNAH);
+       sendto_one(sptr, ":%s %i %s :cloak-keys: %X", me.name, RPL_TEXT, sptr->name,
+               CLOAK_KEYCRC);
+}
 
-       ConfigEntry *cep;
-       ConfigItem_ban *ca;
-       unsigned char isnew = 0;
 
-       ca = MyMallocEx(sizeof(ConfigItem_ban));
-       isnew = 1;
 
+/*
+ * Actual config parser funcs
+*/
+
+int    _conf_include(ConfigFile *conf, ConfigEntry *ce)
+{
+       int     ret = 0;
+#ifdef GLOBH
+       glob_t files;
+       int i;
+#elif defined(_WIN32)
+       HANDLE hFind;
+       WIN32_FIND_DATA FindData;
+       char cPath[MAX_PATH], *cSlash = NULL, *path;
+#endif
        if (!ce->ce_vardata)
        {
-               config_status("%s:%i: ban without type",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               config_status("%s:%i: include: no filename given",
+                       ce->ce_fileptr->cf_filename,
+                       ce->ce_varlinenum);
                return -1;
        }
-       if (!strcmp(ce->ce_vardata, "nick"))
-               ca->flag.type = CONF_BAN_NICK;
-       else if (!strcmp(ce->ce_vardata, "ip"))
-               ca->flag.type = CONF_BAN_IP;
-       else if (!strcmp(ce->ce_vardata, "server"))
-               ca->flag.type = CONF_BAN_SERVER;
-       else if (!strcmp(ce->ce_vardata, "user"))
-               ca->flag.type = CONF_BAN_USER;
-       else if (!strcmp(ce->ce_vardata, "realname"))
-               ca->flag.type = CONF_BAN_REALNAME;
-       else
-       {
-               ConfigItem_unknown *ca2 = MyMalloc(sizeof(ConfigItem_unknown));
-               MyFree(ca);
-               ca2->ce = ce;
-               AddListItem(ca2, conf_unknown);
+#if !defined(_WIN32) && !defined(_AMIGA) && DEFAULT_PERMISSIONS != 0
+       chmod(ce->ce_vardata, DEFAULT_PERMISSIONS);
+#endif
+#ifdef GLOBH
+#if defined(__OpenBSD__) && defined(GLOB_LIMIT)
+       glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK|GLOB_LIMIT, NULL, &files);
+#else
+       glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK, NULL, &files);
+#endif
+       if (!files.gl_pathc) {
+               globfree(&files);
+               config_status("%s:%i: include %s: invalid file given",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                       ce->ce_vardata);
                return -1;
-       }
-
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
-       {
-               if (!cep->ce_vardata)
+       }       
+       for (i = 0; i < files.gl_pathc; i++) {
+               ret = load_conf(files.gl_pathv[i]);
+               if (ret < 0)
                {
-                       config_status("%s:%i: ban %s::%s without parameter",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum, ce->ce_vardata, cep->ce_varname);
-                       continue;
-               }
-               if (!strcmp(cep->ce_varname, "mask")) {
-                       ca->mask = strdup(cep->ce_vardata);
-                       if (ca->flag.type == CONF_BAN_IP) {
-                               ca->masktype = parse_netmask(ca->mask, &ca->netmask, &ca->bits);
-                       }
-               } else
-               if (!strcmp(cep->ce_varname, "reason")) {
-                       ca->reason = strdup(cep->ce_vardata);
+                       globfree(&files);
+                       return ret;
                }
-               else {
-                               config_status("%s:%i: unknown directive ban %s::%s",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                       ce->ce_vardata, cep->ce_varname);
+       }
+       globfree(&files);
+#elif defined(_WIN32)
+       bzero(cPath,MAX_PATH);
+       if (strchr(ce->ce_vardata, '/') || strchr(ce->ce_vardata, '\\')) {
+               strncpyzt(cPath,ce->ce_vardata,MAX_PATH);
+               cSlash=cPath+strlen(cPath);
+               while(*cSlash != '\\' && *cSlash != '/' && cSlash > cPath)
+                       cSlash--; 
+               *(cSlash+1)=0;
+       }
+       hFind = FindFirstFile(ce->ce_vardata, &FindData);
+       if (!FindData.cFileName) {
+               config_status("%s:%i: include %s: invalid file given",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                       ce->ce_vardata);
+               FindClose(hFind);
+               return -1;
+       }
+       if (cPath) {
+               path = MyMalloc(strlen(cPath) + strlen(FindData.cFileName)+1);
+               strcpy(path,cPath);
+               strcat(path,FindData.cFileName);
+               ret = load_conf(path);
+               free(path);
+       }
+       else
+               ret = load_conf(FindData.cFileName);
+       if (ret < 0)
+       {
+               FindClose(hFind);
+               return ret;
+       }
+       ret = 0;
+       while (FindNextFile(hFind, &FindData) != 0) {
+               if (cPath) {
+                       path = MyMalloc(strlen(cPath) + strlen(FindData.cFileName)+1);
+                       strcpy(path,cPath);
+                       strcat(path,FindData.cFileName);
+                       ret = load_conf(path);
+                       free(path);
+                       if (ret < 0)
+                               break;
                }
+               else
+                       ret = load_conf(FindData.cFileName);
        }
-       AddListItem(ca, conf_ban);
+       FindClose(hFind);
+       if (ret < 0)
+               return ret;
+#else
+       return (load_conf(ce->ce_vardata));
+#endif
+       return 1;
+}
+
+int    _test_include(ConfigFile *conf, ConfigEntry *ce)
+{
        return 0;
 }
 
-int    _conf_link(ConfigFile *conf, ConfigEntry *ce)
+int    _conf_admin(ConfigFile *conf, ConfigEntry *ce)
 {
        ConfigEntry *cep;
-       ConfigEntry *cepp;
-       ConfigItem_link *link = NULL;
-       OperFlag    *ofp;
-       unsigned char   isnew = 0;
+       ConfigItem_admin *ca;
 
-       if (!ce->ce_vardata)
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               config_status("%s:%i: link without servername",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+               ca = MyMallocEx(sizeof(ConfigItem_admin));
+               if (!conf_admin)
+                       conf_admin_tail = ca;
+               ircstrdup(ca->line, cep->ce_varname);
+               AddListItem(ca, conf_admin);
        }
+       return 1;
+}
 
-       if (!strchr(ce->ce_vardata, '.'))
+int    _test_admin(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       int         errors = 0;
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               config_status("%s:%i: link: bogus server name",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+               if (!cep->ce_varname)
+               {
+                       config_error("%s:%i: blank admin item",
+                               cep->ce_fileptr->cf_filename,
+                               cep->ce_varlinenum);
+                       errors++;
+                       continue;
+               }
        }
+       requiredstuff.conf_admin = 1;
+       return errors;
+}
 
-       link = (ConfigItem_link *) MyMallocEx(sizeof(ConfigItem_link));
-       link->servername = strdup(ce->ce_vardata);
-       isnew = 1;
+int    _conf_me(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+
+       if (!conf_me)
+       {
+               conf_me = MyMallocEx(sizeof(ConfigItem_me));
+       }
+       cep = config_find_entry(ce->ce_entries, "name");
+       ircfree(conf_me->name);
+       ircstrdup(conf_me->name, cep->ce_vardata);
+       cep = config_find_entry(ce->ce_entries, "info");
+       ircfree(conf_me->info);
+       ircstrdup(conf_me->info, cep->ce_vardata);
+       cep = config_find_entry(ce->ce_entries, "numeric");
+       conf_me->numeric = atol(cep->ce_vardata);
+       return 1;
+}
 
+int    _test_me(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       long        l;
+       int         errors = 0;
+       
+       if (!(cep = config_find_entry(ce->ce_entries, "name")))
+       {
+               config_error("%s:%i: me::name missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       else
+       {
+               if (cep->ce_vardata)
+               {
+                       if (!strchr(cep->ce_vardata, '.'))
+                       {       
+                               config_error("%s:%i: illegal me::name, must be fully qualified hostname",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++;
+                       }
+               }
+       }
+       if (!(cep = config_find_entry(ce->ce_entries, "info")))
+       {
+               config_error("%s:%i: me::info missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       else
+       {
 
+               if (cep->ce_vardata)
+               {
+                       if (strlen(cep->ce_vardata) > (REALLEN-1))
+                       {
+                               config_error("%s:%i: too long me::info, must be max. %i characters",
+                                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum, REALLEN-1);
+                               errors++;
+               
+                       }
+               }
+       }
+       if (!(cep = config_find_entry(ce->ce_entries, "numeric")))
+       {
+               config_error("%s:%i: me::numeric missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       else
+       {
+               if (cep->ce_vardata)
+               {
+                       l = atol(cep->ce_vardata);
+                       if ((l < 0) && (l > 254))
+                       {
+                               config_error("%s:%i: illegal me::numeric error (must be between 0 and 254)",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum);
+                               errors++;
+                       }
+               }
+       }
        for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
                if (!cep->ce_varname)
                {
-                       config_status("%s:%i: link item without variable name",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       config_error("%s:%i: blank me line",
+                               cep->ce_fileptr->cf_filename,
+                               cep->ce_varlinenum);
+                       errors++;
                        continue;
                }
-               if (!cep->ce_vardata && !cep->ce_entries)
+               if (!cep->ce_vardata)
                {
-                       config_status("%s:%i: link::%s without parameter",
+                       config_error("%s:%i: me::%s without parameter",
                                cep->ce_fileptr->cf_filename,
                                cep->ce_varlinenum,
                                cep->ce_varname);
+                       errors++;
                        continue;
                }
-               if (!strcmp(cep->ce_varname, "options"))
-               {
-                       /* remove options */
-                       link->options = 0;
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
-                       {
-                               if (!cepp->ce_varname)
-                               {
-                                       config_status("%s:%i: link::flag item without variable name",
-                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
-                                       continue;
-                               }
-                               for (ofp = _LinkFlags; ofp->name; ofp++)
-                               {
-                                       if (!strcmp(ofp->name, cepp->ce_varname))
-                                       {
-                                               if (!(link->options & ofp->flag))
-                                                       link->options |= ofp->flag;
-                                               break;
-                                       }
-                               }
-                               if (!ofp->name)
-                               {
-                                       config_status("%s:%i: unknown link option '%s'",
-                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
-                                               cepp->ce_varname);
-                                       continue;
-                               }
-                       }
-               } else
-               if (!strcmp(cep->ce_varname, "username"))
-               {
-                       link->username = strdup(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "hostname"))
-               {
-                       link->hostname = strdup(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "bind-ip"))
-               {
-                       link->bindip = strdup(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "port"))
-               {
-                       link->port = atol(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "hub"))
-               {
-                       link->hubmask = strdup(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "leaf"))
-               {
-                       link->leafmask = strdup(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "leafdepth"))
-               {
-                       link->leafdepth = atol(cep->ce_vardata);
-               } else
-               if (!strcmp(cep->ce_varname, "password-connect"))
-               {
-                       link->connpwd = strdup(cep->ce_vardata);
-               } else
-#ifdef USE_SSL
-               if (!strcmp(cep->ce_varname, "ciphers"))
-               {
-                       link->ciphers = strdup(cep->ce_vardata);
-               }
+               if (!strcmp(cep->ce_varname, "name"))
+               {} else
+               if (!strcmp(cep->ce_varname, "info"))
+               {} else
+               if (!strcmp(cep->ce_varname, "numeric"))
+               {}
                else
-#endif
-               if (!strcmp(cep->ce_varname, "password-receive"))
-               {
-                       link->recvauth = Auth_ConvertConf2AuthStruct(cep);
-               } else
-               if (!strcmp(cep->ce_varname, "class"))
                {
-                       link->class = Find_class(cep->ce_vardata);
-                       if (!link->class)
-                       {
-                               config_status("%s:%i: illegal link::class, unknown class '%s' using default of class 'default'",
-                                       cep->ce_fileptr->cf_filename,
-                                       cep->ce_varlinenum,
-                                       cep->ce_vardata);
-                               link->class = default_class;
-                       }
-               } else
-               {
-                       config_status("%s:%i: unknown directive link::%s",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                       cep->ce_varname);
-                       continue;
+                       config_error("%s:%i: unknown directive me::%s",
+                               cep->ce_fileptr->cf_filename,
+                               cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++; continue;
                }
-
        }
-       if (isnew)
-               AddListItem(link, conf_link);
-       return 0;
+       requiredstuff.conf_me = 1;
+       return errors;
 }
-int    _conf_set(ConfigFile *conf, ConfigEntry *ce)
+
+/*
+ * The oper {} block parser
+*/
+
+int    _conf_oper(ConfigFile *conf, ConfigEntry *ce)
 {
        ConfigEntry *cep;
        ConfigEntry *cepp;
-       char        temp[512];
-       int         i;
-#define CheckNull(x) if (!(x)->ce_vardata) { config_status("%s:%i: missing parameter", (x)->ce_fileptr->cf_filename, (x)->ce_varlinenum); continue; }
+       ConfigItem_oper *oper = NULL;
+       ConfigItem_oper_from *from;
+       OperFlag *ofp = NULL;
+       unsigned char   isnew = 0;
 
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       if (!ce->ce_vardata)
        {
-               if (!cep->ce_varname)
-               {
-                       config_status("%s:%i: blank set item",
+               config_status("%s:%i: oper without name",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return -1;
+       }
+
+       if (!(oper = Find_oper(ce->ce_vardata)))
+       {
+               oper =  MyMallocEx(sizeof(ConfigItem_oper));
+               oper->name = strdup(ce->ce_vardata);
+               isnew = 1;
+       }
+       else
+       {
+               isnew = 0;
+       }
+       
+       cep = config_find_entry(ce->ce_entries, "password");
+       oper->auth = Auth_ConvertConf2AuthStruct(cep);
+       cep = config_find_entry(ce->ce_entries, "class");
+       oper->class = Find_class(cep->ce_vardata);
+       if (!oper->class)
+       {
+               config_status("%s:%i: illegal oper::class, unknown class '%s' using default of class 'default'",
                                cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
+                               cep->ce_varlinenum,
+                               cep->ce_vardata);
+               oper->class = default_class;
+       }
+       
+       cep = config_find_entry(ce->ce_entries, "flags");
+       if (!cep->ce_entries)
+       {
+               char *m = "*";
+               int *i, flag;
+
+               for (m = (*cep->ce_vardata) ? cep->ce_vardata : m; *m; m++) {
+                       for (i = _OldOperFlags; (flag = *i); i += 2)
+                               if (*m == (char)(*(i + 1))) {
+                                       oper->oflags |= flag;
+                                       break;
+                               }
                }
-               if (!strcmp(cep->ce_varname, "kline-address")) {
-                       CheckNull(cep);
-                       ircstrdup(KLINE_ADDRESS, cep->ce_vardata);
+       }
+       else
+       {
+               for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+               {
+                       if ((ofp = config_binary_flags_search(_OperFlags, cepp->ce_varname, sizeof(_OperFlags)/sizeof(_OperFlags[0])))) 
+                               oper->oflags |= ofp->flag;
                }
-               else if (!strcmp(cep->ce_varname, "modes-on-connect")) {
-                       CheckNull(cep);
-                       CONN_MODES = (long) set_usermode(cep->ce_vardata);
-                       if (CONN_MODES & UMODE_OPER)
-                       {
-                               config_status("%s:%i set::modes-on-connect contains +o, deleting",
-                                       cep->ce_fileptr->cf_filename,
-                                       cep->ce_varlinenum);
-                               CONN_MODES &= ~UMODE_OPER;
-                       }
-               }
-               else if (!strcmp(cep->ce_varname, "modes-on-oper")) {
-                       CheckNull(cep);
-                       OPER_MODES = (long) set_usermode(cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "static-quit")) {
-                       CheckNull(cep);
-                       ircstrdup(STATIC_QUIT, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "auto-join")) {
-                       CheckNull(cep);
-                       ircstrdup(AUTO_JOIN_CHANS, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "oper-auto-join")) {
-                       CheckNull(cep);
-                       ircstrdup(OPER_AUTO_JOIN_CHANS, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "anti-spam-quit-message-time")) {
-                       CheckNull(cep);
-                       ANTI_SPAM_QUIT_MSG_TIME = config_checkval(cep->ce_vardata,CFG_TIME);
-               }
-               else if (!strcmp(cep->ce_varname, "oper-only-stats")) {
-                       CheckNull(cep);
-                       ircstrdup(OPER_ONLY_STATS, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "maxchannelsperuser")) {
-                       CheckNull(cep);
-                       MAXCHANNELSPERUSER = atoi(cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "network-name")) {
-                       char *tmp;
-                       CheckNull(cep);
-                       ircstrdup(ircnetwork, cep->ce_vardata);
-                       for (tmp = cep->ce_vardata; *cep->ce_vardata; cep->ce_vardata++) {
-                               if (*cep->ce_vardata == ' ')
-                                       *cep->ce_vardata='-';
-                       }
-                       ircstrdup(ircnet005, tmp);
-                       cep->ce_vardata = tmp;
-               }
-               else if (!strcmp(cep->ce_varname, "default-server")) {
-                       CheckNull(cep);
-                       ircstrdup(defserv, cep->ce_vardata);
+       }
+       if ((cep = config_find_entry(ce->ce_entries, "swhois")))
+       {
+               ircstrdup(oper->swhois, cep->ce_vardata);
+       }
+       if ((cep = config_find_entry(ce->ce_entries, "snomask")))
+       {
+               ircstrdup(oper->snomask, cep->ce_vardata);
+       }
+       cep = config_find_entry(ce->ce_entries, "from");
+       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+       {
+               if (!strcmp(cepp->ce_varname, "userhost"))
+               {
+                       from = MyMallocEx(sizeof(ConfigItem_oper_from));
+                       ircstrdup(from->name, cepp->ce_vardata);
+                       AddListItem(from, oper->from);
                }
-               else if (!strcmp(cep->ce_varname, "services-server")) {
-                       CheckNull(cep);
+       }
+       if (isnew)
+               AddListItem(oper, conf_oper);
+       return 1;
+}
 
-                       ircstrdup(SERVICES_NAME, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "stats-server")) {
-                       CheckNull(cep);
-                       ircstrdup(STATS_SERVER, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "help-channel")) {
-                       CheckNull(cep);
-                       ircstrdup(helpchan, cep->ce_vardata);
+int    _test_oper(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       ConfigEntry *cepp;
+       ConfigItem_oper *oper = NULL;
+       ConfigItem_oper_from *from;
+       OperFlag *ofp = NULL;
+       unsigned char   isnew = 0;
+       int     errors = 0;
+       if (!ce->ce_vardata)
+       {
+               config_error("%s:%i: oper without name",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!cep->ce_varname)
+               {
+                       config_error("%s:%i: oper item without variable name",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
                }
-               else if (!strcmp(cep->ce_varname, "hiddenhost-prefix")) {
-                       CheckNull(cep);
-                       ircstrdup(hidden_host, cep->ce_vardata);
+               if (!strcmp(cep->ce_varname, "password"))
+               {
+                       if (Auth_CheckError(cep) < 0)
+                               errors++;
+                       /* should have some auth check if ok .. */
+                       continue;
                }
-               else if (!strcmp(cep->ce_varname, "prefix-quit")) {
-                       CheckNull(cep);
-                       if (!stricmp(cep->ce_vardata, "no") || *cep->ce_vardata == '0')
+               if (!cep->ce_entries)
+               {
+                       /* standard variable */
+                       if (!cep->ce_vardata)
                        {
-                               ircstrdup(prefix_quit, "Quit: ");
+                               config_error("%s:%i: oper::%s without parameter",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
                        }
-                       ircstrdup(prefix_quit, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "dns")) {
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
-                               CheckNull(cepp);
-                               if (!strcmp(cepp->ce_varname, "timeout")) {
-                                       HOST_TIMEOUT = config_checkval(cepp->ce_vardata,CFG_TIME);
-                               }
-                               else if (!strcmp(cepp->ce_varname, "retries")) {
-                                       HOST_RETRIES = config_checkval(cepp->ce_vardata,CFG_TIME);
-                               }
-                               else if (!strcmp(cepp->ce_varname, "nameserver")) {
-                                       ircstrdup(NAME_SERVER, cepp->ce_vardata);
-                               }
+                       if (!strcmp(cep->ce_varname, "class"))
+                       {
                        }
-               }
-               else if (!strcmp(cep->ce_varname, "options")) {
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
-                               if (!strcmp(cepp->ce_varname, "webtv-support")) {
-                                       WEBTV_SUPPORT = 1;
-                               }
-                               else if (!strcmp(cepp->ce_varname, "hide-ulines")) {
-                                       HIDE_ULINES = 1;
-                               }
-                               else if (!strcmp(cepp->ce_varname, "no-stealth")) {
-                                       NO_OPER_HIDING = 1;
-                               }
-                               else if (!strcmp(cepp->ce_varname, "show-opermotd")) {
-                                       SHOWOPERMOTD = 1;
-                               }
-                               else if (!strcmp(cepp->ce_varname, "identd-check")) {
-                                       IDENT_CHECK = 1;
-                               }
-                               else if (!strcmp(cepp->ce_varname, "fail-oper-warn")) {
-                                       FAILOPER_WARN = 1;
-                               }
-                               else if (!strcmp(cepp->ce_varname, "show-connect-info")) {
-                                       SHOWCONNECTINFO = 1;
-                               }
+                       else if (!strcmp(cep->ce_varname, "swhois")) {
                        }
-               }
-               else if (!strcmp(cep->ce_varname, "hosts")) {
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+                       else if (!strcmp(cep->ce_varname, "snomask")) {
+                       }
+                       else if (!strcmp(cep->ce_varname, "flags"))
                        {
-                               if (!cepp->ce_vardata)
-                                       continue; 
-                               if (!strcmp(cepp->ce_varname, "local")) {
-                                       ircstrdup(locop_host, cepp->ce_vardata);
-                               }
-                               else if (!strcmp(cepp->ce_varname, "global")) {
-                                       ircstrdup(oper_host, cepp->ce_vardata);
-                               }
-                               else if (!strcmp(cepp->ce_varname, "coadmin")) {
-                                       ircstrdup(coadmin_host, cepp->ce_vardata);
-                               }
-                               else if (!strcmp(cepp->ce_varname, "admin")) {
-                                       ircstrdup(admin_host, cepp->ce_vardata);
-                               }
-                               else if (!strcmp(cepp->ce_varname, "servicesadmin")) {
-                                       ircstrdup(sadmin_host, cepp->ce_vardata);
-                               }
-                               else if (!strcmp(cepp->ce_varname, "netadmin")) {
-                                       ircstrdup(netadmin_host, cepp->ce_vardata);
-                               }
-                               else if (!strcmp(cepp->ce_varname, "host-on-oper-up")) {
-                                       iNAH = config_checkval(cepp->ce_vardata,CFG_YESNO);
-                               }
                        }
-               }
-               else if (!strcmp(cep->ce_varname, "cloak-keys"))
-               {
-                       /* Count number of numbers there .. */
-                       for (cepp = cep->ce_entries, i = 0; cepp; cepp = cepp->ce_next, i++) { }
-                       if (i != 3)
+                       else
                        {
-                               config_status("%s:%i: set::cloak-keys: we want 3 values, not %i!",
+                               config_error("%s:%i: unknown directive oper::%s",
                                        cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                                       i);
-                               return 0;
+                                               cep->ce_varname);
+                               errors++; continue;
                        }
-                       /* i == 3 SHOULD make this true .. */
-                       CLOAK_KEY1 = ircabs(atol(cep->ce_entries->ce_varname));
-                       CLOAK_KEY2 = ircabs(atol(cep->ce_entries->ce_next->ce_varname));
-                       CLOAK_KEY3 = ircabs(atol(cep->ce_entries->ce_next->ce_next->ce_varname));
-                       ircsprintf(temp, "%li.%li.%li", CLOAK_KEY1,
-                               CLOAK_KEY2, CLOAK_KEY3);
-                       CLOAK_KEYCRC = (long) crc32(temp, strlen(temp));
                }
-#ifdef USE_SSL
-               else if (!strcmp(cep->ce_varname, "ssl")) {
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
-                               if (!strcmp(cepp->ce_varname, "egd")) {
-                                       USE_EGD = 1;
-                                       if (cepp->ce_vardata)
-                                               EGD_PATH = strdup(cepp->ce_vardata);
-                               }
-                               else if (!strcmp(cepp->ce_varname, "certificate"))
+               else
+               {
+                       /* Section */
+                       if (!strcmp(cep->ce_varname, "flags"))
+                       {
+                               for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
                                {
-                                       if (!cepp->ce_vardata)
+                                       if (!cepp->ce_varname)
+                                       {
+                                               config_error("%s:%i: oper::flags item without variable name",
+                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
+                                               errors++; 
                                                continue;
-                                       ircstrdup(iConf.x_server_cert_pem, cepp->ce_varname);   
+                                       }
+                                       if (!config_binary_flags_search(_OperFlags, cepp->ce_varname, sizeof(_OperFlags)/sizeof(_OperFlags[0]))) {
+                                                config_error("%s:%i: unknown oper flag '%s'",
+                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
+                                                       cepp->ce_varname);
+                                               errors++; 
+                                       }
                                }
-                               else if (!strcmp(cepp->ce_varname, "key"))
+                               continue;
+                       }
+                       else
+                       if (!strcmp(cep->ce_varname, "from"))
+                       {
+                               for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
                                {
+                                       if (!cepp->ce_varname)
+                                       {
+                                               config_error("%s:%i: oper::from item without variable name",
+                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
+                                               errors++; continue;
+                                       }
                                        if (!cepp->ce_vardata)
-                                               continue;
-                                       ircstrdup(iConf.x_server_key_pem, cepp->ce_varname);    
+                                       {
+                                               config_error("%s:%i: oper::from::%s without parameter",
+                                                       cepp->ce_fileptr->cf_filename,
+                                                       cepp->ce_varlinenum,
+                                                       cepp->ce_varname);
+                                               errors++; continue;
+                                       }
+                                       if (!strcmp(cepp->ce_varname, "userhost"))
+                                       {
+                                       }
+                                       else
+                                       {
+                                               config_error("%s:%i: unknown directive oper::from::%s",
+                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
+                                                       cepp->ce_varname);
+                                               errors++; continue;
+                                       }
                                }
+                               continue;
+                       }
+                       else
+                       {
+                               config_error("%s:%i: unknown directive oper::%s (section)",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                               cep->ce_varname);
+                               errors++; continue;
                        }
                }
-#endif
-               else
-               {
-                       ConfigItem_unknown_ext *ca2 = MyMalloc(sizeof(ConfigItem_unknown_ext));
-                       ca2->ce_fileptr = cep->ce_fileptr;
-                       ca2->ce_varlinenum = cep->ce_varlinenum;
-                       ca2->ce_vardata = cep->ce_vardata;
-                       ca2->ce_varname = cep->ce_varname;
-                       ca2->ce_entries = cep->ce_entries;
-                       AddListItem(ca2, conf_unknown_set);
-/*                     config_status("%s:%i: unknown directive set::%s",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                               cep->ce_varname); */
-               }
+
        }
-       return 0;
+       if (!config_find_entry(ce->ce_entries, "password"))
+       {
+               config_error("%s:%i: oper::password missing", ce->ce_fileptr->cf_filename,
+                       ce->ce_varlinenum);
+               errors++;
+       }       
+       if (!config_find_entry(ce->ce_entries, "from"))
+       {
+               config_error("%s:%i: oper::from missing", ce->ce_fileptr->cf_filename,
+                       ce->ce_varlinenum);
+               errors++;
+       }       
+       if (!config_find_entry(ce->ce_entries, "class"))
+       {
+               config_error("%s:%i: oper::class missing", ce->ce_fileptr->cf_filename,
+                       ce->ce_varlinenum);
+               errors++;
+       }       
+       return errors;
+       
 }
-#ifdef STRIPBADWORDS
-int     _conf_badword(ConfigFile *conf, ConfigEntry *ce)
+
+/*
+ * The class {} block parser
+*/
+int    _conf_class(ConfigFile *conf, ConfigEntry *ce)
 {
        ConfigEntry *cep;
-       ConfigItem_badword *ca;
-       char *tmp;
-       short regex = 0;
+       ConfigItem_class *class;
+       unsigned char isnew = 0;
 
-       ca = MyMallocEx(sizeof(ConfigItem_badword));
-       if (!ce->ce_vardata) {
-               config_status("%s:%i: badword without type",
-                       ce->ce_fileptr->cf_filename,
-                       ce->ce_varlinenum);
-               return -1;
+       if (!(class = Find_class(ce->ce_vardata)))
+       {
+               class = MyMallocEx(sizeof(ConfigItem_class));
+               ircstrdup(class->name, ce->ce_vardata);
+               isnew = 1;
        }
+       else
+       {
+               isnew = 0;
+       }
+       cep = config_find_entry(ce->ce_entries, "pingfreq");
+       class->pingfreq = atol(cep->ce_vardata);
+       cep = config_find_entry(ce->ce_entries, "maxclients");
+       class->maxclients = atol(cep->ce_vardata);
+       cep = config_find_entry(ce->ce_entries, "sendq");
+       class->sendq = atol(cep->ce_vardata);
+       if ((cep = config_find_entry(ce->ce_entries, "connfreq")))
+       {
+               class->connfreq = atol(cep->ce_vardata);
+       }
+       if (isnew) 
+               AddListItem(class, conf_class);
+       return 1;
+}
 
-        for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+int    _test_class(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry     *cep;
+       long            l;
+       int             errors = 0;
+       if (!ce->ce_vardata)
        {
-               if (!cep->ce_varname)
-               {
-                       config_status("%s:%i: blank badword item",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
+               config_error("%s:%i: class without name",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++; 
+       }
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!cep->ce_varname)
+               {
+                       config_error("%s:%i: class item without variable name",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
                }
                if (!cep->ce_vardata)
                {
-                       config_status("%s:%i: missing parameter in badword::%s",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                               cep->ce_varname);
-                       continue;
-               }
-
-               if (!strcmp(cep->ce_varname, "word")) {
-                       for (tmp = cep->ce_vardata; *tmp; tmp++) {
-                               if ((int)*tmp < 65 || (int)*tmp > 123) {
-                                       regex = 1;
-                                       break;
-                               }
-                       }
-                       if (regex) {
-                               ircstrdup(ca->word, cep->ce_vardata);
-                       }
-                       else {
-                               ca->word = MyMalloc(strlen(cep->ce_vardata) + strlen(PATTERN) -1);
-                               ircsprintf(ca->word, PATTERN, cep->ce_vardata);
-                       }
-               }
-               else if (!strcmp(cep->ce_varname, "replace")) {
-                       ircstrdup(ca->replace, cep->ce_vardata);
+                       config_error("%s:%i: class item without parameter",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
                }
+               if (!strcmp(cep->ce_varname, "pingfreq"))
+               {} else
+               if (!strcmp(cep->ce_varname, "maxclients"))
+               {} else
+               if (!strcmp(cep->ce_varname, "connfreq"))
+               {} else
+               if (!strcmp(cep->ce_varname, "sendq"))
+               {}
                else
                {
-                       config_status("%s:%i: unknown directive badword::%s",
+                       config_error("%s:%i: unknown directive class::%s",
                                cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
-                               cep->ce_varname);
+                                       cep->ce_varname);
+                       errors++; continue;
                }
        }
-       if (!strcmp(ce->ce_vardata, "channel"))
-               AddListItem(ca, conf_badword_channel);
-       else if (!strcmp(ce->ce_vardata, "message"))
-               AddListItem(ca, conf_badword_message);
-       return 0;
-
-}
-#endif
-
-/* deny {} function */
-int    _conf_deny(ConfigFile *conf, ConfigEntry *ce)
-{
-       if (!ce->ce_vardata)
+       if ((cep = config_find_entry(ce->ce_entries, "pingfreq")))
        {
-               config_status("%s:%i: deny without type",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+               l = atol(cep->ce_vardata);
+               if (l < 1)
+               {
+                       config_error("%s:%i: class::pingfreq with illegal value",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++;
+               }
        }
-       if (!strcmp(ce->ce_vardata, "dcc"))
-               _conf_deny_dcc(conf, ce);
-       else if (!strcmp(ce->ce_vardata, "channel"))
-               _conf_deny_channel(conf, ce);
-       else if (!strcmp(ce->ce_vardata, "link"))
-               _conf_deny_link(conf, ce);
-       else if (!strcmp(ce->ce_vardata, "version"))
-               _conf_deny_version(conf, ce);
        else
        {
-               ConfigItem_unknown *ca2 = MyMalloc(sizeof(ConfigItem_unknown));
-               ca2->ce = ce;
-               AddListItem(ca2, conf_unknown);
-               return -1;
+               config_error("%s:%i: class::pingfreq missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
        }
-       return 0;
-}
-
-int    _conf_deny_dcc(ConfigFile *conf, ConfigEntry *ce)
-{
-       ConfigItem_deny_dcc     *deny = NULL;
-       ConfigEntry             *cep;
-
-       deny = MyMallocEx(sizeof(ConfigItem_deny_dcc));
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       if ((cep = config_find_entry(ce->ce_entries, "maxclients")))
        {
-               if (!cep->ce_varname || !cep->ce_vardata)
-               {
-                       config_status("%s:%i: blank deny dcc item",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
-               }
-               if (!strcmp(cep->ce_varname, "filename"))
+               l = atol(cep->ce_vardata);
+               if (!l)
                {
-                       ircstrdup(deny->filename, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "reason"))
-               {
-                       ircstrdup(deny->reason, cep->ce_vardata);
+                       config_error("%s:%i: class::maxclients with illegal value",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++;
                }
-               else
+       }
+       else
+       {
+               config_error("%s:%i: class::maxclients missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       if ((cep = config_find_entry(ce->ce_entries, "sendq")))
+       {
+               l = atol(cep->ce_vardata);
+               if (!l)
                {
-                       config_status("%s:%i: unknown directive deny dcc::%s",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum, cep->ce_varname);
+                       config_error("%s:%i: class::sendq with illegal value",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++;
                }
        }
-       if (!deny->filename || !deny->reason)
+       else
        {
-               config_status("%s:%i: deny dcc {} without filename/reason, ignoring",
-                       cep->ce_fileptr->cf_filename,
-                       cep->ce_varlinenum);
-               ircfree(deny->filename);
-               ircfree(deny->reason);
-               ircfree(deny);
-               return -1;
+               config_error("%s:%i: class::sendq missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
        }
-       else
+       if ((cep = config_find_entry(ce->ce_entries, "connfreq")))
        {
-               AddListItem(deny, conf_deny_dcc);
-               return 0;
+               l = atol(cep->ce_vardata);
+               if (l < 10)
+               {
+                       config_error("%s:%i: class::connfreq with illegal value (<10)",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++;
+               }
        }
-       return 0;
+       
+       return errors;
 }
 
-int    _conf_deny_channel(ConfigFile *conf, ConfigEntry *ce)
+int     _conf_drpass(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigItem_deny_channel         *deny = NULL;
-       ConfigEntry             *cep;
+       ConfigEntry *cep;
+
+       if (!conf_drpass) {
+               conf_drpass =  MyMallocEx(sizeof(ConfigItem_drpass));
+       }
 
-       deny = MyMallocEx(sizeof(ConfigItem_deny_channel));
        for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               if (!cep->ce_varname || !cep->ce_vardata)
-               {
-                       config_status("%s:%i: blank deny channel item",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
-               }
-               if (!strcmp(cep->ce_varname, "channel"))
-               {
-                       ircstrdup(deny->channel, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "reason"))
+               if (!strcmp(cep->ce_varname, "restart"))
                {
-                       ircstrdup(deny->reason, cep->ce_vardata);
+                       if (conf_drpass->restartauth)
+                               Auth_DeleteAuthStruct(conf_drpass->restartauth);
+                       
+                       conf_drpass->restartauth = Auth_ConvertConf2AuthStruct(cep);
                }
-               else
+               else if (!strcmp(cep->ce_varname, "die"))
                {
-                       config_status("%s:%i: unknown directive deny channel::%s",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum, cep->ce_varname);
+                       if (conf_drpass->dieauth)
+                               Auth_DeleteAuthStruct(conf_drpass->dieauth);
+                       
+                       conf_drpass->dieauth = Auth_ConvertConf2AuthStruct(cep);
                }
        }
-       if (!deny->channel || !deny->reason)
-       {
-               config_status("%s:%i: deny channel {} without channel/reason, ignoring",
-                       cep->ce_fileptr->cf_filename,
-                       cep->ce_varlinenum);
-               ircfree(deny->channel);
-               ircfree(deny->reason);
-               ircfree(deny);
-               return -1;
-       }
-       else
-       {
-               AddListItem(deny, conf_deny_channel);
-               return 0;
-       }
-       return 0;
+       return 1;
 }
-int    _conf_deny_link(ConfigFile *conf, ConfigEntry *ce)
-{
-       ConfigItem_deny_link    *deny = NULL;
-       ConfigEntry             *cep;
 
-       deny = MyMallocEx(sizeof(ConfigItem_deny_link));
+int     _test_drpass(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       int errors = 0;
        for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               if (!cep->ce_varname || !cep->ce_vardata)
+               if (!cep->ce_varname)
                {
-                       config_status("%s:%i: blank deny link item",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
+                       config_error("%s:%i: drpass item without variable name",
+                        cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
                }
-               if (!strcmp(cep->ce_varname, "mask"))
+               if (!cep->ce_vardata)
                {
-                       ircstrdup(deny->mask, cep->ce_vardata);
+                       config_error("%s:%i: missing parameter in drpass:%s",
+                        cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++; continue;
                }
-               else if (!strcmp(cep->ce_varname, "rule"))
+               if (!strcmp(cep->ce_varname, "restart"))
                {
-                       if (!(deny->rule = (char *)crule_parse(cep->ce_vardata))) {
-                               config_status("%s:%i: deny link::rule contains an invalid expression",
-                                       cep->ce_fileptr->cf_filename,
-                                       cep->ce_varlinenum);
-                               ircfree(deny->mask);
-                               ircfree(deny->prettyrule);
-                               ircfree(deny);
-                               return -1;
-                       }
-                       ircstrdup(deny->prettyrule, cep->ce_vardata);
+                       if (Auth_CheckError(cep) < 0)
+                               errors++;
+                       continue;
                }
-               else if (!strcmp(cep->ce_varname, "type")) {
-                       if (!strcmp(cep->ce_vardata, "all"))
-                               deny->flag.type = CRULE_ALL;
-                       else if (!strcmp(cep->ce_vardata, "auto"))
-                               deny->flag.type = CRULE_AUTO;
+               else if (!strcmp(cep->ce_varname, "die"))
+               {
+                       if (Auth_CheckError(cep) < 0)
+                               errors++;
+                       continue;
                }
                else
                {
-                       config_status("%s:%i: unknown directive deny link::%s",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum, cep->ce_varname);
+                       config_status("%s:%i: warning: unknown drpass directive '%s'",
+                                cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                cep->ce_varname);
+                       errors++; continue;
                }
        }
-       if (!deny->rule || !deny->prettyrule || !deny->mask)
-       {
-               config_status("%s:%i: deny link {} without mask/rule, ignoring",
-                       cep->ce_fileptr->cf_filename,
-                       cep->ce_varlinenum);
-               ircfree(deny->mask);
-               ircfree(deny->prettyrule);
-               if (deny->rule)
-                       crule_free(&deny->rule);
-               ircfree(deny);
-               return -1;
-       }
-       else
-       {
-               AddListItem(deny, conf_deny_link);
-               return 0;
-       }
-       return 0;
+       return errors;
 }
 
-int    _conf_deny_version(ConfigFile *conf, ConfigEntry *ce)
+/*
+ * The ulines {} block parser
+*/
+int    _conf_ulines(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigItem_deny_version *deny = NULL;
-       ConfigEntry             *cep;
+       ConfigEntry *cep;
+       ConfigItem_ulines *ca;
 
-       deny = MyMallocEx(sizeof(ConfigItem_deny_version));
        for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               if (!cep->ce_varname || !cep->ce_vardata)
+               if (!cep->ce_varname)
                {
-                       config_status("%s:%i: blank deny version item",
+                       config_status("%s:%i: blank uline item",
                                cep->ce_fileptr->cf_filename,
                                cep->ce_varlinenum);
                        continue;
                }
-               if (!strcmp(cep->ce_varname, "mask"))
-               {
-                       ircstrdup(deny->mask, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "version"))
-               {
-                       ircstrdup(deny->version, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "flags"))
-               {
-                       ircstrdup(deny->flags, cep->ce_vardata);
-               }
-               else
+               ca = MyMallocEx(sizeof(ConfigItem_ulines));
+               ircstrdup(ca->servername, cep->ce_varname);
+               AddListItem(ca, conf_ulines);
+       }
+       return 1;
+}
+
+int    _test_ulines(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       int         errors = 0;
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!cep->ce_varname)
                {
-                       config_status("%s:%i: unknown directive deny version::%s",
+                       config_error("%s:%i: blank uline item",
                                cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum, cep->ce_varname);
+                               cep->ce_varlinenum);
+                       errors++;
+                       continue;
                }
        }
-       if (!deny->mask || !deny->flags || !deny->version)
-       {
-               config_status("%s:%i: deny version {} without mask/flags/version, ignoring",
-                       cep->ce_fileptr->cf_filename,
-                       cep->ce_varlinenum);
-               ircfree(deny->mask);
-               ircfree(deny->version);
-               ircfree(deny->flags);
-               ircfree(deny);
-               return -1;
-       }
-       else
-       {
-               AddListItem(deny, conf_deny_version);
-               return 0;
-       }
-       return 0;
+       return errors;
 }
 
-int    _conf_log(ConfigFile *conf, ConfigEntry *ce)
+int     _conf_tld(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigItem_log *log = NULL;
-       ConfigEntry             *cep, *cepp;
-       OperFlag *ofl = NULL;
+       ConfigEntry *cep;
+       ConfigItem_tld *ca;
 
-       if (!ce->ce_vardata)
-       {
-               config_status("%s:%i: log without filename",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
-       }
-       log = MyMallocEx(sizeof(ConfigItem_log));
-       ircstrdup(log->file, ce->ce_vardata);
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       ca = MyMallocEx(sizeof(ConfigItem_tld)); cep =
+       config_find_entry(ce->ce_entries, "mask");
+       ca->mask = strdup(cep->ce_vardata);
+       cep = config_find_entry(ce->ce_entries, "motd");
+       ca->motd = read_motd(cep->ce_vardata); 
+       ca->motd_file = strdup(cep->ce_vardata);
+       ca->motd_tm = motd_tm;
+       cep = config_find_entry(ce->ce_entries, "rules");
+       ca->rules = read_rules(cep->ce_vardata);
+       ca->rules_file = strdup(cep->ce_vardata);
+       
+       if ((cep = config_find_entry(ce->ce_entries, "channel")))
+               ca->channel = strdup(cep->ce_vardata);
+       AddListItem(ca, conf_tld);
+       return 1;
+}
+
+int     _test_tld(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       int         errors = 0;
+       int         fd = -1;
+        for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
                if (!cep->ce_varname)
                {
-                       config_status("%s:%i: blank log item",
+                       config_error("%s:%i: blank tld item",
                                cep->ce_fileptr->cf_filename,
                                cep->ce_varlinenum);
-                       continue;
+                       errors++; continue;
                }
-               if (!strcmp(cep->ce_varname, "maxsize")) {
-                       log->maxsize = config_checkval(cep->ce_vardata,CFG_SIZE);
+               if (!cep->ce_vardata)
+               {
+                       config_error("%s:%i: missing parameter in tld::%s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++; continue;
                }
-               if (!strcmp(cep->ce_varname, "flags")) {
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
-                       {
-                               if (!cepp->ce_varname)
-                               {
-                                       config_status("%s:%i: log::flags item without variable name",
-                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
-                                       continue;
-                               }
-                               for (ofl = _LogFlags; ofl->name; ofl++)
-                               {
-                                       if (!strcmp(ofl->name, cepp->ce_varname))
-                                       {
-                                                       log->flags |= ofl->flag;
-                                               break;
-                                       }
-                               }
-                               if (!ofl->name)
-                               {
-                                       config_status("%s:%i: unknown log flag '%s'",
-                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
-                                               cepp->ce_varname);
-                                       continue;
-                               }
-                       }
-                               continue;
+               if (!strcmp(cep->ce_varname, "mask")) {
+               }
+               else if (!strcmp(cep->ce_varname, "motd")) {
+               }
+               else if (!strcmp(cep->ce_varname, "rules")) {
+               }
+               else if (!strcmp(cep->ce_varname, "channel")) {
+               }
+               else
+               {
+                       config_error("%s:%i: unknown directive tld::%s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++; continue;
                }
        }
-       AddListItem(log, conf_log);
-       return 0;
-}
-
-int    _conf_alias(ConfigFile *conf, ConfigEntry *ce)
-{
-       ConfigItem_alias *alias = NULL;
-       ConfigItem_alias_format *format;
-       ConfigEntry             *cep, *cepp;
-       aCommand *cmptr;
-
-       if (!ce->ce_vardata)
+       if (!(cep = config_find_entry(ce->ce_entries, "mask")))
        {
-               config_status("%s:%i: alias without name",
+               config_error("%s:%i: tld::mask missing",
                        ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
+               errors++;
        }
-       if ((cmptr = find_Command(ce->ce_vardata, 0, M_ALIAS)))
-               del_Command(ce->ce_vardata, NULL, cmptr->func);
-       else if (find_Command(ce->ce_vardata, 0, 0)) {
-               config_status("%s:%i: %s is an existing command, can not add alias",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
-               return -1;
+       if (!(cep = config_find_entry(ce->ce_entries, "motd")))
+       {
+               config_error("%s:%i: tld::motd missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
        }
-       if ((alias = Find_alias(ce->ce_vardata)))
-               DelListItem(alias, conf_alias);
-       alias = MyMallocEx(sizeof(ConfigItem_alias));
-       ircstrdup(alias->alias, ce->ce_vardata);
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       else
        {
-               if (!cep->ce_varname)
+               if (((fd = open(cep->ce_vardata, O_RDONLY)) == -1))
                {
-                       config_status("%s:%i: blank alias item",
-                               cep->ce_fileptr->cf_filename,
-                               cep->ce_varlinenum);
-                       continue;
-               }
-               if (!strcmp(cep->ce_varname, "format")) {
-                       format = MyMallocEx(sizeof(ConfigItem_alias_format));
-                       ircstrdup(format->format, cep->ce_vardata);
-                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
-                               if (!strcmp(cepp->ce_varname, "alias")) {
-                                       if (!(format->alias = Find_alias(cepp->ce_vardata))) {
-                                               config_status("%s:%i: alias %s not found",
-                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
-                                                       cepp->ce_vardata);
-                                                       return 0;
-                                       }
-                               }
-                               else if (!strcmp(cepp->ce_varname, "parameters")) {
-                                       ircstrdup(format->parameters, cepp->ce_vardata);
-                               }
-                       }
-                       AddListItem(format, alias->format);
-               }               
-                               
-               else if (!strcmp(cep->ce_varname, "nick")) {
-                       ircstrdup(alias->nick, cep->ce_vardata);
-               }
-               else if (!strcmp(cep->ce_varname, "type")) {
-                       if (!strcmp(cep->ce_vardata, "services"))
-                               alias->type = ALIAS_SERVICES;
-                       else if (!strcmp(cep->ce_vardata, "stats"))
-                               alias->type = ALIAS_STATS;
-                       else if (!strcmp(cep->ce_vardata, "normal"))
-                               alias->type = ALIAS_NORMAL;
-                       else if (!strcmp(cep->ce_vardata, "command"))
-                               alias->type = ALIAS_COMMAND;
-                       else {
-                               alias->type = ALIAS_SERVICES;
-                               config_status("%s:%i: Invalid alias type, using default of 'services'",
-                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                       }
+                       config_error("%s:%i: tld::motd: %s: %s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                               cep->ce_vardata, strerror(errno));
+                       errors++;
                }
-                       
-       }
-       if (BadPtr(alias->nick) && alias->type != ALIAS_COMMAND) {
-               ircstrdup(alias->nick, alias->alias); 
+               else
+                       close(fd);
+               
        }
-       add_CommandX(alias->alias, NULL, m_alias, 1, M_USER|M_ALIAS);
-       AddListItem(alias, conf_alias);
-       return 0;
-}
-
-int    _conf_help(ConfigFile *conf, ConfigEntry *ce)
-{
-       ConfigItem_help *help = NULL;
-       ConfigEntry             *cep;
-       aMotd *last = NULL, *temp;
-
-       if (!ce->ce_entries) {
-               config_status("%s:%i: help entry without text",
+       
+       if (!(cep = config_find_entry(ce->ce_entries, "rules")))
+       {
+               config_error("%s:%i: tld::rules missing",
                        ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
-               return -1;
-       }
-       if (Find_Help(ce->ce_vardata)) {
-               config_status("%s:%i: help for %s already exists",
-                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata ? ce->ce_vardata : "index");
-               return -1;
+               errors++;
        }
-       help = MyMalloc(sizeof(ConfigItem_help));
-       if (!ce->ce_vardata)
-               help->command = NULL;
        else
-               help->command = strdup(ce->ce_vardata);
-       help->text = NULL;
-               
-       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
-       {
-               temp = MyMalloc(sizeof(aMotd));
-               temp->line = strdup(cep->ce_varname);
-               temp->next = NULL;
-               if (!help->text)
-                       help->text = temp;
-               else
-                       last->next = temp;
-               last = temp;
-       }
-       AddListItem(help, conf_help);
-       return 0;
-}
-
-
-/*
- * Report functions
-*/
-
-void   report_configuration(void)
-{
-}
-
-
-void   run_configuration(void)
-{
-       ConfigItem_listen       *listenptr;
-
-       for (listenptr = conf_listen; listenptr; listenptr = (ConfigItem_listen *) listenptr->next)
        {
-               if (!(listenptr->options & LISTENER_BOUND))
+               if (((fd = open(cep->ce_vardata, O_RDONLY)) == -1))
                {
-                       if (add_listener2(listenptr) == -1)
-                       {
-                               ircd_log(LOG_ERROR, "Failed to bind to %s:%i", listenptr->ip, listenptr->port);
-                       }
-                               else
-                       {
-                       }
+                       config_error("%s:%i: tld::rules: %s: %s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                               cep->ce_vardata, strerror(errno));
+                       errors++;
                }
+               else
+                       close(fd);
        }
+       
+       return errors;
 }
 
-void   link_cleanup(ConfigItem_link *link_ptr)
+int    _conf_listen(ConfigFile *conf, ConfigEntry *ce)
 {
-       ircfree(link_ptr->servername);
-       ircfree(link_ptr->username);
-       ircfree(link_ptr->bindip);
-       ircfree(link_ptr->hostname);
-       ircfree(link_ptr->hubmask);
-       ircfree(link_ptr->leafmask);
-       ircfree(link_ptr->connpwd);
-#ifdef USE_SSL
-       ircfree(link_ptr->ciphers);
-#endif
-       Auth_DeleteAuthStruct(link_ptr->recvauth);
-       link_ptr->recvauth = NULL;
-}
-
+       ConfigEntry *cep;
+       ConfigEntry *cepp;
+       ConfigItem_listen *listen = NULL;
+       OperFlag    *ofp;
+       char        copy[256];
+       char        *ip;
+       char        *port;
+       int         iport;
+       unsigned char   isnew = 0;
 
-void   listen_cleanup()
-{
-       int     i = 0;
-       ConfigItem_listen *listen_ptr;
-       ListStruct *next;
-       for (listen_ptr = conf_listen; listen_ptr; listen_ptr = (ConfigItem_listen *)next)
+       if (!ce->ce_vardata)
        {
-               next = (ListStruct *)listen_ptr->next;
-               if (listen_ptr->flag.temporary && !listen_ptr->clients)
-               {
-                       ircfree(listen_ptr->ip);
-                       DelListItem(listen_ptr, conf_listen);
-                       MyFree(listen_ptr);
-                       i++;
-               }
+               return -1;
        }
-       if (i)
-               close_listeners();
-}
 
-#define Error config_error
-#define Status config_progress
-#define Warning config_status
-
-void   validate_configuration(void)
-{
-       ConfigItem_class *class_ptr;
-       ConfigItem_oper  *oper_ptr;
-       ConfigItem_tld   *tld_ptr;
-       ConfigItem_allow *allow_ptr;
-       ConfigItem_listen *listen_ptr;
-       ConfigItem_except *except_ptr;
-       ConfigItem_ban *ban_ptr;
-       ConfigItem_link *link_ptr;
-       ConfigItem_vhost *vhost_ptr;
-       ConfigItem_log *log_ptr;
-       ConfigItem_alias *alias_ptr;
-       ListStruct *next, *next2;
-       short hide_host = 1;
-       char *s;
-       struct in_addr in;
-       /* These may not have even gotten loaded because of previous errors so don't do
-         * anything -- codemastr
-        */
-#ifdef _WIN32
-       if (config_error_flag) {
-               win_log("Errors in configuration, terminating program.");
-               win_error();
-               exit(5);
-       }
-#endif
-       if (config_error_flag)
+       strcpy(copy, ce->ce_vardata);
+       /* Seriously cheap hack to make listen <port> work -Stskeeps */
+       ipport_seperate(copy, &ip, &port);
+       if (!ip || !*ip)
        {
-               Error("Errors in configuration, terminating program.");
-               exit(5);
-       }       
-       /* Let us validate dynconf first */
-       if (!KLINE_ADDRESS || (*KLINE_ADDRESS == '\0'))
-               Error("set::kline-address is missing");
-#ifndef DEVELOP
-       if (KLINE_ADDRESS) {
-               if (!strchr(KLINE_ADDRESS, '@') && !strchr(KLINE_ADDRESS, ':'))
-               {
-                       Error(
-                           "set::kline-address must be an e-mail or an URL");
-               }
-               else if (!match("*@unrealircd.com", KLINE_ADDRESS) || !match("*@unrealircd.org",KLINE_ADDRESS) || !match("unreal-*@lists.sourceforge.net",KLINE_ADDRESS)) 
-                       Error(
-                          "set::kline-address may not be an UnrealIRCd Team address");
-       }
-#endif
-       if ((MAXCHANNELSPERUSER < 1)) {
-               MAXCHANNELSPERUSER = 10;
-               Warning("set::maxchannelsperuser must be > 0. Using default of 10");
-       }
-       if ((iNAH < 0) || (iNAH > 1)) {
-               iNAH = 0;
-               Warning("set::host-on-oper-op is invalid. Disabling by default");
+               return -1;
        }
-       if (!NAME_SERVER)
+       if (strchr(ip, '*') && strcmp(ip, "*"))
        {
-               Warning("set::dns::nameserver is missing. Using 127.0.0.1 as default");
-               NAME_SERVER = strdup("127.0.0.1");
-               in.s_addr = inet_addr(NAME_SERVER);
+               return -1;
        }
-       else
+       if (!port || !*port)
        {
-               in.s_addr = inet_addr(NAME_SERVER);
-               if (strcmp((char *)inet_ntoa(in), NAME_SERVER))
-               {
-                       Warning("set::dns::nameserver (%s) is not a valid IP. Using 127.0.0.1 as default", NAME_SERVER);
-                       ircstrdup(NAME_SERVER, "127.0.0.1");
-                       in.s_addr = inet_addr(NAME_SERVER);
-               }
-       }
-       if (HOST_TIMEOUT < 0 || HOST_TIMEOUT > 180) {
-               HOST_TIMEOUT = 2;
-               Warning("set::dns::timeout is invalid. Using default of 2 seconds");
-       }
-       if (HOST_RETRIES < 0 || HOST_RETRIES > 10) {
-               HOST_RETRIES = 2;
-               Warning("set::dns::retries is invalid. Using default of 2");
-       }
-#define Missing(x) !x || (*(x) == '\0')
-       if (Missing(defserv))
-               Error("set::default-server is missing");
-       if (Missing(ircnetwork))
-               Error("set::network-name is missing");
-       if (Missing(SERVICES_NAME))
-               Error("set::services-server is missing. All services commands are being disabled");
-       if (Missing(oper_host)) {
-               Warning("set::hosts::global is missing");
-               hide_host = 0;
-       }
-       if (Missing(admin_host)) {
-               Warning("set::hosts::admin is missing");
-               hide_host = 0;
-       }
-       if (Missing(locop_host)) {
-               Warning("set::hosts::local is missing");
-               hide_host = 0;
-       }
-       if (Missing(sadmin_host)) {
-               Warning("set::hosts::servicesadmin is missing");
-               hide_host = 0;
-       }
-       if (Missing(netadmin_host)) {
-               Warning("set::hosts::netadmin is missing");
-               hide_host = 0;
-       }
-       if (Missing(coadmin_host)) {
-               Warning("set::hosts::coadmin is missing");
-               hide_host = 0;
+               return -1;
        }
-       if (hide_host == 0) {
-               Warning("Due to an invalid set::hosts field, oper host masking is being disabled");
-               iNAH = 0;
+       iport = atol(port);
+       if ((iport < 0) || (iport > 65535))
+       {
+               return -1;
        }
-       if (Missing(hidden_host))
-               Error("set::hiddenhost-prefix is missing");
-       if (Missing(helpchan))
-               Error("set::help-channel is missing");
-       if (Missing(STATS_SERVER))
-               Warning("set::stats-server is missing. /statserv is being disabled");
-       if ((CLOAK_KEY1 < 10000) || (CLOAK_KEY2 < 10000) || (CLOAK_KEY3 < 10000))
+       if (!(listen = Find_listen(ip, iport)))
        {
-               if (!CLOAK_KEY1 || !CLOAK_KEY2 || !CLOAK_KEY3)
-               {
-                       Error("set::cloak-keys are missing or is 0.");
-                       Error("Add this in your config file:");
-                       Error("set { cloak-keys { <big integer value>; <big integer value>; <big integer value>; }; };");
-                       Error("The numbers must be purely random, and the same on every server you link to");
-               }
-               Error("set::cloak-keys are too easy to guess. Please select three other more absurd and crazy numbers - will increase security a lot");
+               listen = MyMallocEx(sizeof(ConfigItem_listen));
+               listen->ip = strdup(ip);
+               listen->port = iport;
+               isnew = 1;
        }
-       if (!conf_listen)
+       else
        {
-               Error("No listeners defined");
+               isnew = 0;
        }
-       /* Now for the real config */
-       if (conf_me)
+
+       if (listen->options & LISTENER_BOUND)
        {
-               if (BadPtr(conf_me->name))
-                       Error("me::name is missing");
-               if (BadPtr(conf_me->info))
-                       Error("me::info is missing");
-               /* numeric is being checked in _conf_me */
+               listen->options = 0;
+               listen->options |= LISTENER_BOUND;
        }
        else
-               Error("me {} is missing");
+               listen->options = 0;
 
-       for (class_ptr = conf_class; class_ptr; class_ptr = (ConfigItem_class *) class_ptr->next)
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               if (BadPtr(class_ptr->name))
-                       Error("class without name");
-               else
+               if (!strcmp(cep->ce_varname, "options"))
                {
-                       if (!class_ptr->pingfreq) {
-                               Warning("class %s::pingfreq with illegal value, using default of %d",
-                                       class_ptr->name, PINGFREQUENCY);
-                               class_ptr->pingfreq = PINGFREQUENCY;
-                       }
-                       if (!class_ptr->sendq) {
-                               Warning("class %s::sendq with illegal value, using default of %d",
-                                       class_ptr->name, MAXSENDQLENGTH);
-                               class_ptr->sendq = MAXSENDQLENGTH;
-                       }
-                       if (class_ptr->maxclients < 0) {
-                               Warning("class %s:maxclients with illegal (negative) value, using default of 100",
-                                       class_ptr->name);
-                               class_ptr->maxclients = 100;
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+                       {
+                               if ((ofp = config_binary_flags_search(_ListenerFlags, cepp->ce_varname, sizeof(_ListenerFlags)/sizeof(_ListenerFlags[0]))))
+                                       listen->options |= ofp->flag;
                        }
+#ifndef USE_SSL
+                       if (listen->options & LISTENER_SSL)
+                       {
+                               config_status("%s:%i: listen with SSL flag enabled on a non SSL compile",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                               cep->ce_varname);
+                               listen->options &= ~LISTENER_SSL;
+                       }
+#endif
+               
                }
-               StatsZ.classes++;
-               StatsZ.classesmem += sizeof(ConfigItem_class);
+
        }
-       for (oper_ptr = conf_oper; oper_ptr; oper_ptr = (ConfigItem_oper *) oper_ptr->next)
-       {
-               ConfigItem_oper_from *oper_from;
+       if (isnew)
+               AddListItem(listen, conf_listen);
+       listen->flag.temporary = 0;
+       return 1;
+}
 
-               if (!oper_ptr->from) {
-                       Warning("oper %s: does not have a from record, using (unsafe) default of *@*",
-                               oper_ptr->name);
-                       oper_from = MyMallocEx(sizeof(ConfigItem_oper_from));
-                       ircstrdup(oper_from->name, "*@*");
-                       AddListItem(oper_from, oper_ptr->from); 
-               }
-               if (!oper_ptr->class) {
-                       Warning("oper %s::class is missing or unknown, using default of class 'default'",
-                               oper_ptr->name);
-                       oper_ptr->class = default_class;
-               }
-               if (!oper_ptr->oflags) {
-                       oper_ptr->oflags |= OFLAG_LOCAL;
-                       Warning("oper %s without privileges",
-                               oper_ptr->name);
-               }
+int    _test_listen(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       ConfigEntry *cepp;
+       ConfigItem_listen *listen = NULL;
+       OperFlag    *ofp;
+       char        copy[256];
+       char        *ip;
+       char        *port;
+       int         iport;
+       int         errors = 0;
+
+       if (!ce->ce_vardata)
+       {
+               config_error("%s:%i: listen without ip:port",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
        }
-       
-       for (listen_ptr = conf_listen; listen_ptr; listen_ptr = (ConfigItem_listen *)next)
+
+       strcpy(copy, ce->ce_vardata);
+       /* Seriously cheap hack to make listen <port> work -Stskeeps */
+       ipport_seperate(copy, &ip, &port);
+       if (!ip || !*ip)
        {
-               next = (ListStruct *)listen_ptr->next;
-               if (BadPtr(listen_ptr->ip)) {
-                       Warning("listen without ip, using default of *");
-                       ircstrdup(listen_ptr->ip,"*");
-               }
-               if (!listen_ptr->port) {
-                       Warning("listen port illegal. Deleting listen {} block");
-                       ircfree(listen_ptr->ip);
-                       DelListItem(listen_ptr, conf_listen);
-                       MyFree(listen_ptr);
-                       continue;
-               }
+               config_error("%s:%i: listen: illegal ip:port mask",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
        }
-       for (allow_ptr = conf_allow; allow_ptr; allow_ptr = (ConfigItem_allow *) allow_ptr->next)
+       if (strchr(ip, '*') && strcmp(ip, "*"))
        {
-               if (BadPtr(allow_ptr->ip)) {
-                       Warning("allow::ip, missing value, using default of *@*");
-                       ircstrdup(allow_ptr->ip, "*@*");
-               }
-               if (BadPtr(allow_ptr->hostname)) {
-                       Warning("allow::hostname, missing value, using default of *@*");
-                       ircstrdup(allow_ptr->hostname, "*@*");
-               }
-               if (allow_ptr->maxperip < 0) {
-                       Warning("allow::maxperip, must be positive or 0, using default of 1");
-                       allow_ptr->maxperip = 1;
-               }
-               if (!allow_ptr->class) {
-                       Warning("allow::class, unknown class, using default of class 'default'");
-                       allow_ptr->class = default_class;
-               }
+               config_error("%s:%i: listen: illegal ip, (mask, and not '*')",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
        }
-       for (except_ptr = conf_except; except_ptr; except_ptr = (ConfigItem_except *)next)
+       if (!port || !*port)
        {
-               next = (ListStruct *)except_ptr->next;
-               if (BadPtr(except_ptr->mask)) {
-                       Warning("except mask missing. Deleting except {} block");
-                       DelListItem(except_ptr, conf_except);
-                       MyFree(except_ptr);
-               }
+               config_error("%s:%i: listen: missing port in mask",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
        }
-       for (ban_ptr = conf_ban; ban_ptr; ban_ptr = (ConfigItem_ban *) next)
+       iport = atol(port);
+       if ((iport < 0) || (iport > 65535))
        {
-               next = (ListStruct *)ban_ptr->next;
-               if (BadPtr(ban_ptr->mask)) {
-                       Warning("ban mask missing. Deleting ban {} block");
-                       ircfree(ban_ptr->reason);
-                       DelListItem(ban_ptr, conf_ban);
-                       MyFree(ban_ptr);
-                       continue;
-               }
-               if (BadPtr(ban_ptr->reason)) {
-                       Warning("ban reason invalid, using default of 'no reason specified'");
-                       ircstrdup(ban_ptr->reason, "No reason specified");
-               }
-                       
+               config_error("%s:%i: listen: illegal port (must be 0..65536)",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
        }
-       for (link_ptr = conf_link; link_ptr; link_ptr = (ConfigItem_link *) next)
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               next = (ListStruct *)link_ptr->next;
-               if (BadPtr(link_ptr->servername))
+               if (!cep->ce_varname)
                {
-                       Warning("link without name. Deleting link {} block");
-                       DelListItem(link_ptr, conf_link);
-                       link_cleanup(link_ptr);
-                       MyFree(link_ptr);
+                       config_error("%s:%i: listen item without variable name",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
                }
-               else
+               if (!strcmp(cep->ce_varname, "options"))
                {
-                       if (BadPtr(link_ptr->username)) {
-                               Warning("link %s::username is missing, using default of *", link_ptr->servername);
-                               ircstrdup(link_ptr->username, "*");
-                       }
-                       if (BadPtr(link_ptr->hostname)) {
-                               Warning("link with invalid hostname. Deleting link {} block");
-                               DelListItem(link_ptr, conf_link);
-                               link_cleanup(link_ptr);
-                               MyFree(link_ptr);
-                               continue;
-                       }
-                       if (BadPtr(link_ptr->connpwd)) {
-                               Warning("link with invalid password-connect. Deleting link {} block");
-                               DelListItem(link_ptr, conf_link);
-                               link_cleanup(link_ptr);
-                               MyFree(link_ptr);
-                               continue;
-                       }
-                       if (!link_ptr->class) {
-                               Warning("link %s::class is missing, using default of class 'default'", link_ptr->servername);
-                               link_ptr->class = default_class;
+                       if (!cep->ce_entries)
+                       {
+                               config_error("%s:%i: listen::%s without parameter",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++;
                        }
-                       if (!link_ptr->port && (link_ptr->options & CONNECT_AUTO))
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
                        {
-                               Warning("link %s::port is 0, and is set to autoconnect, using default of 6667",
-                                       link_ptr->servername);
-                               link_ptr->port = 6667;
+                               if (!cepp->ce_varname)
+                               {
+                                       config_error("%s:%i: listen::options item without variable name",
+                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
+                                       errors++; continue;
+                               }
+                               if (!config_binary_flags_search(_ListenerFlags, cepp->ce_varname, sizeof(_ListenerFlags)/sizeof(_ListenerFlags[0])))
+                               {
+                                       config_error("%s:%i: unknown listen option '%s'",
+                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
+                                               cepp->ce_varname);
+                                       errors++; continue;
+                               }
                        }
                }
-               
-       }
-       for (tld_ptr = conf_tld; tld_ptr; tld_ptr = (ConfigItem_tld *) next)
-       {
-               next = (ListStruct *)tld_ptr->next;
-               if (BadPtr(tld_ptr->mask)) {
-                       Warning("tld without mask. Deleting tld {} block");
-                       DelListItem(tld_ptr, conf_tld);
-                       ircfree(tld_ptr->motd_file);
-                       ircfree(tld_ptr->rules_file);
-                       MyFree(tld_ptr);
-                       continue;
-               }
-       }
-       for (vhost_ptr = conf_vhost; vhost_ptr; vhost_ptr = (ConfigItem_vhost *)next) {
-               int nope = 0;
-               ConfigItem_oper_from *vhost_from;
-               next = (ListStruct *)vhost_ptr->next;
-               for (s = vhost_ptr->virthost; *s; s++)
+               else
                {
-                       if (!isallowed(*s)) {
-                               nope = 1;
-                               break;
-                       }
-               }
-               if (!nope && vhost_ptr->virtuser) {
-                       for (s = vhost_ptr->virtuser; *s; s++) {
-                               if (!isallowed(*s)) {
-                                       nope = 1;
-                                       break;
-                               }
-                       }
+                       config_error("%s:%i: unknown directive listen::%s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                       cep->ce_varname);
+                       errors++; continue;
                }
-               if (nope) {
-                       Warning("vhost::vhost %s%s%s is not valid. Deleting vhost {} block", vhost_ptr->virtuser ?
-                               vhost_ptr->virtuser : "", vhost_ptr->virtuser ? "@" : "", vhost_ptr->virthost);
-                       ircfree(vhost_ptr->login);
-                       ircfree(vhost_ptr->virthost);
-                       ircfree(vhost_ptr->virtuser);
-                       Auth_DeleteAuthStruct(vhost_ptr->auth);
-                       for (vhost_from = (ConfigItem_oper_from *) vhost_ptr->from; vhost_from; vhost_from = (ConfigItem_oper_from *) next2)
-                       {
-                               next2 = (ListStruct *)vhost_from->next;
-                               ircfree(vhost_from->name);
-                               DelListItem(vhost_from, vhost_ptr->from);
-                               MyFree(vhost_from);
-                       }
-                       DelListItem(vhost_ptr, conf_vhost);
-                       MyFree(vhost_ptr);
-               }
-
-       }
-
-
-       /* No log? No problem! Make a simple default one */
-       if (!conf_log) {
-               log_ptr = MyMallocEx(sizeof(ConfigItem_log));
-               ircstrdup(log_ptr->file, "ircd.log");
-               log_ptr->flags |= LOG_ERROR|LOG_KLINE|LOG_TKL;
-               AddListItem(log_ptr, conf_log);
-               Warning("No log {} found using ircd.log as default");
-       }
-       if (!conf_alias) {
-               alias_ptr = MyMallocEx(sizeof(ConfigItem_alias));
-               ircstrdup(alias_ptr->alias, "NickServ");
-               ircstrdup(alias_ptr->nick, "NickServ");
-               alias_ptr->type = ALIAS_SERVICES;
-               AddListItem(alias_ptr, conf_alias);
-               add_CommandX("NickServ", NULL, m_alias, 1, M_USER|M_ALIAS);
-               alias_ptr = MyMallocEx(sizeof(ConfigItem_alias));
-               ircstrdup(alias_ptr->alias, "ChanServ");
-               ircstrdup(alias_ptr->nick, "ChanServ");
-               alias_ptr->type = ALIAS_SERVICES;
-               AddListItem(alias_ptr, conf_alias);
-               add_CommandX("ChanServ", NULL, m_alias, 1, M_USER|M_ALIAS);
-               alias_ptr = MyMallocEx(sizeof(ConfigItem_alias));
-               ircstrdup(alias_ptr->alias, "MemoServ");
-               ircstrdup(alias_ptr->nick, "MemoServ");
-               alias_ptr->type = ALIAS_SERVICES;
-               AddListItem(alias_ptr, conf_alias);
-               add_CommandX("MemoServ", NULL, m_alias, 1, M_USER|M_ALIAS);
-               alias_ptr = MyMallocEx(sizeof(ConfigItem_alias));
-               ircstrdup(alias_ptr->alias, "OperServ");
-               ircstrdup(alias_ptr->nick, "OperServ");
-               alias_ptr->type = ALIAS_SERVICES;
-               AddListItem(alias_ptr, conf_alias);
-               add_CommandX("OperServ", NULL, m_alias, 1, M_USER|M_ALIAS);
-               alias_ptr = MyMallocEx(sizeof(ConfigItem_alias));
-               ircstrdup(alias_ptr->alias, "HelpServ");
-               ircstrdup(alias_ptr->nick, "HelpServ");
-               alias_ptr->type = ALIAS_SERVICES;
-               AddListItem(alias_ptr, conf_alias);
-               add_CommandX("HelpServ", NULL, m_alias, 1, M_USER|M_ALIAS);
-               alias_ptr = MyMallocEx(sizeof(ConfigItem_alias));
-               ircstrdup(alias_ptr->alias, "StatServ");
-               ircstrdup(alias_ptr->nick, "StatServ");
-               alias_ptr->type = ALIAS_STATS;
-               AddListItem(alias_ptr, conf_alias);
-               add_CommandX("StatServ", NULL, m_alias, 1, M_USER|M_ALIAS);
-               Warning("No alias{}'s found, using default of NickServ, ChanServ, MemoServ, OperServ, HelpServ, StatServ");
-       }
-       if (!find_Command_simple("AWAY") || !find_Command_simple("KILL") ||
-               !find_Command_simple("OPER") || !find_Command_simple("PING"))
-       {
-               Error("Someone forgot to load modules with proper commands in them. Read the documentation (.RELEASE.NOTES)");
-       }
-#ifdef _WIN32
-       if (config_error_flag)
-               win_log("Errors in configuration, terminating program.");
-       win_error();
-#endif
-       if (config_error_flag)
-       {
-               Error("Errors in configuration, terminating program.");
-               exit(5);
+
        }
+       requiredstuff.conf_listen = 1;
+       return errors;
 }
-#undef Error
-#undef Status
-#undef Missing
 
-int     rehash(aClient *cptr, aClient *sptr, int sig)
+
+int    _conf_allow(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigItem_oper                 *oper_ptr;
-       ConfigItem_class                *class_ptr;
-       ConfigItem_ulines               *uline_ptr;
-       ConfigItem_allow                *allow_ptr;
-       ConfigItem_except               *except_ptr;
-       ConfigItem_ban                  *ban_ptr;
-       ConfigItem_link                 *link_ptr;
-       ConfigItem_listen               *listen_ptr;
-       ConfigItem_tld                  *tld_ptr;
-       ConfigItem_vhost                *vhost_ptr;
-       ConfigItem_badword              *badword_ptr;
-       ConfigItem_deny_dcc             *deny_dcc_ptr;
-       ConfigItem_deny_link            *deny_link_ptr;
-       ConfigItem_deny_channel         *deny_channel_ptr;
-       ConfigItem_allow_channel        *allow_channel_ptr;
-       ConfigItem_admin                *admin_ptr;
-       ConfigItem_deny_version         *deny_version_ptr;
-       ConfigItem_log                  *log_ptr;
-       ConfigItem_alias                *alias_ptr;
-       ConfigItem_include              *include_ptr;
-       ConfigItem_help                 *help_ptr;
-       ListStruct      *next, *next2;
+       ConfigEntry *cep, *cepp;
+       ConfigItem_allow *allow;
 
-       bzero(&StatsZ, sizeof(StatsZ));
-       flush_connections(&me);
-       if (sig == 1)
-       {
-               sendto_ops("Got signal SIGHUP, reloading %s file", configfile);
-#ifdef ULTRIX
-               if (fork() > 0)
-                       exit(0);
-               write_pidfile();
-#endif
-       }
-       RunHook0(HOOKTYPE_REHASH);
-       for (admin_ptr = conf_admin; admin_ptr; admin_ptr = (ConfigItem_admin *)next)
-       {
-               next = (ListStruct *)admin_ptr->next;
-               ircfree(admin_ptr->line);
-               DelListItem(admin_ptr, conf_admin);
-               MyFree(admin_ptr);
-       }
-       /* wipe the fckers out ..*/
-       for (oper_ptr = conf_oper; oper_ptr; oper_ptr = (ConfigItem_oper *)next)
+       if (ce->ce_vardata)
        {
-               ConfigItem_oper_from *oper_from;
-               next = (ListStruct *)oper_ptr->next;
-               ircfree(oper_ptr->name);
-               ircfree(oper_ptr->swhois);
-               ircfree(oper_ptr->snomask);
-               Auth_DeleteAuthStruct(oper_ptr->auth);
-               for (oper_from = (ConfigItem_oper_from *) oper_ptr->from; oper_from; oper_from = (ConfigItem_oper_from *) next2)
+               if (!strcmp(ce->ce_vardata, "channel"))
                {
-                       next2 = (ListStruct *)oper_from->next;
-                       ircfree(oper_from->name);
-                       DelListItem(oper_from, oper_ptr->from);
-                       MyFree(oper_from);
+                       return (_conf_allow_channel(conf, ce));
                }
-               DelListItem(oper_ptr, conf_oper);
-               MyFree(oper_ptr);
-       }
-       for (class_ptr = conf_class; class_ptr; class_ptr = (ConfigItem_class *) next)
-       {
-               next = (ListStruct *)class_ptr->next;
-               if (class_ptr->flag.permanent == 1)
-                       continue;
-               class_ptr->flag.temporary = 1;
-               /* We'll wipe it out when it has no clients */
-               if (!class_ptr->clients)
+               else
                {
-                       ircfree(class_ptr->name);
-                       DelListItem(class_ptr, conf_class);
-                       MyFree(class_ptr);
+                       int value;
+                       for (global_i = Hooks[HOOKTYPE_CONFIGRUN]; global_i;
+                            global_i = global_i->next)
+                       {
+                               value = (*(global_i->func.intfunc))(conf,ce,CONFIG_ALLOW);
+                               if (value == 1)
+                                       break;
+                       }
+                       return 0;
                }
        }
-       for (uline_ptr = conf_ulines; uline_ptr; uline_ptr = (ConfigItem_ulines *) next)
+
+       allow = MyMallocEx(sizeof(ConfigItem_allow));
+       cep = config_find_entry(ce->ce_entries, "ip");
+       allow->ip = strdup(cep->ce_vardata);
+       cep = config_find_entry(ce->ce_entries, "hostname");
+       allow->hostname = strdup(cep->ce_vardata);
+       if ((cep = config_find_entry(ce->ce_entries, "password")))
        {
-               next = (ListStruct *)uline_ptr->next;
-               /* We'll wipe it out when it has no clients */
-               ircfree(uline_ptr->servername);
-               DelListItem(uline_ptr, conf_ulines);
-               MyFree(uline_ptr);
+               allow->auth = Auth_ConvertConf2AuthStruct(cep);
        }
-       for (allow_ptr = conf_allow; allow_ptr; allow_ptr = (ConfigItem_allow *) next)
+       cep = config_find_entry(ce->ce_entries, "class");
+       allow->class = Find_class(cep->ce_vardata);
+       if (!allow->class)
        {
-               next = (ListStruct *)allow_ptr->next;
-               ircfree(allow_ptr->ip);
-               ircfree(allow_ptr->hostname);
-               Auth_DeleteAuthStruct(allow_ptr->auth);
-               DelListItem(allow_ptr, conf_allow);
-               MyFree(allow_ptr);
+               config_status("%s:%i: illegal allow::class, unknown class '%s' using default of class 'default'",
+                       cep->ce_fileptr->cf_filename,
+                       cep->ce_varlinenum,
+                       cep->ce_vardata);
+                       allow->class = default_class;
        }
-       for (except_ptr = conf_except; except_ptr; except_ptr = (ConfigItem_except *) next)
+       if ((cep = config_find_entry(ce->ce_entries, "maxperip")))
        {
-               next = (ListStruct *)except_ptr->next;
-               ircfree(except_ptr->mask);
-               DelListItem(except_ptr, conf_except);
-               MyFree(except_ptr);
+               allow->maxperip = atoi(cep->ce_vardata);
        }
-       for (ban_ptr = conf_ban; ban_ptr; ban_ptr = (ConfigItem_ban *) next)
+       if ((cep = config_find_entry(ce->ce_entries, "redirect-server")))
        {
-               next = (ListStruct *)ban_ptr->next;
-               if (ban_ptr->flag.type2 == CONF_BAN_TYPE_CONF || ban_ptr->flag.type2 == CONF_BAN_TYPE_TEMPORARY)
-               {
-                       ircfree(ban_ptr->mask);
-                       ircfree(ban_ptr->reason);
-                       DelListItem(ban_ptr, conf_ban);
-                       MyFree(ban_ptr);
+               allow->server = strdup(cep->ce_vardata);
+       }
+       if ((cep = config_find_entry(ce->ce_entries, "redirect-port")))
+       {
+               allow->port = atoi(cep->ce_vardata);
+       }
+       if ((cep = config_find_entry(ce->ce_entries, "options")))
+       {
+               for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                       if (!strcmp(cepp->ce_varname, "noident"))
+                               allow->flags.noident = 1;
+                       else if (!strcmp(cepp->ce_varname, "useip")) 
+                               allow->flags.useip = 1;
                }
+       
        }
-       for (link_ptr = conf_link; link_ptr; link_ptr = (ConfigItem_link *) next)
+       AddListItem(allow, conf_allow);
+       return 1;
+}
+
+int    _test_allow(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep, *cepp;
+       ConfigItem_allow *allow;
+       unsigned char isnew = 0;
+       int             errors = 0;
+       if (ce->ce_vardata)
        {
-               next = (ListStruct *)link_ptr->next;
-               if (link_ptr->refcount == 0)
+               if (!strcmp(ce->ce_vardata, "channel"))
                {
-                       link_cleanup(link_ptr);
-                       DelListItem(link_ptr, conf_link);
-                       MyFree(link_ptr);
+                       return (_test_allow_channel(conf, ce));
                }
                else
                {
-                       link_ptr->flag.temporary = 1;
-               }
-       }
-       for (listen_ptr = conf_listen; listen_ptr; listen_ptr = (ConfigItem_listen *)listen_ptr->next)
-       {
-               listen_ptr->flag.temporary = 1;
-       }
-       for (tld_ptr = conf_tld; tld_ptr; tld_ptr = (ConfigItem_tld *) next)
-       {
-               aMotd *motd;
-               next = (ListStruct *)tld_ptr->next;
-               ircfree(tld_ptr->motd_file);
-               ircfree(tld_ptr->rules_file);
-               if (!tld_ptr->flag.motdptr) {
-                       while (tld_ptr->motd) {
-                               motd = tld_ptr->motd->next;
-                               ircfree(tld_ptr->motd->line);
-                               ircfree(tld_ptr->motd);
-                               tld_ptr->motd = motd;
+                       int used = 0;
+                       for (global_i = Hooks[HOOKTYPE_CONFIGTEST]; global_i; 
+                               global_i = global_i->next) 
+                       {
+                               int value, errs = 0;
+                               if (global_i->owner && !(global_i->owner->flags & MODFLAG_TESTING))
+                                       continue;
+                               value = (*(global_i->func.intfunc))(conf,ce,CONFIG_ALLOW,&errs);
+                               if (value == 2)
+                                       used = 1;
+                               if (value == 1)
+                               {
+                                       used = 1;
+                                       break;
+                               }
+                               if (value == -1)
+                               {
+                                       used = 1;
+                                       errors += errs;
+                                       break;
+                               }
+                               if (value == -2)
+                               {
+                                       used = 1;
+                                       errors += errs;
+                               }
                        }
-               }
-               if (!tld_ptr->flag.rulesptr) {
-                       while (tld_ptr->rules) {
-                               motd = tld_ptr->rules->next;
-                               ircfree(tld_ptr->rules->line);
-                               ircfree(tld_ptr->rules);
-                               tld_ptr->rules = motd;
+                       if (!used) {
+                               config_error("%s:%i: allow item with unknown type",
+                                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+                               return 1;
                        }
+                       return errors;
                }
-               DelListItem(tld_ptr, conf_tld);
-               MyFree(tld_ptr);
        }
-       for (vhost_ptr = conf_vhost; vhost_ptr; vhost_ptr = (ConfigItem_vhost *) next)
+
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               ConfigItem_oper_from *vhost_from;
-               
-               next = (ListStruct *)vhost_ptr->next;
-               
-               ircfree(vhost_ptr->login);
-               Auth_DeleteAuthStruct(vhost_ptr->auth);
-               ircfree(vhost_ptr->virthost);
-               ircfree(vhost_ptr->virtuser);
-               for (vhost_from = (ConfigItem_oper_from *) vhost_ptr->from; vhost_from;
-                       vhost_from = (ConfigItem_oper_from *) next2)
+               if (!cep->ce_varname)
                {
-                       next2 = (ListStruct *)vhost_from->next;
-                       ircfree(vhost_from->name);
-                       DelListItem(vhost_from, vhost_ptr->from);
-                       MyFree(vhost_from);
+                       config_status("%s:%i: allow item without variable name",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
+               }
+               if (!strcmp(cep->ce_varname, "ip"))
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: allow::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+               } else
+               if (!strcmp(cep->ce_varname, "maxperip"))
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: allow::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+               } else
+               if (!strcmp(cep->ce_varname, "hostname"))
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: allow::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+               } else
+               if (!strcmp(cep->ce_varname, "password"))
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: allow::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+               } else
+               if (!strcmp(cep->ce_varname, "class"))
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: allow::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "redirect-server"))
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: allow::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "redirect-port")) {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: allow::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "options")) {
+               }
+               else
+               {
+                       config_error("%s:%i: unknown directive allow::%s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                       cep->ce_varname);
+                       errors++; continue;
                }
-               DelListItem(vhost_ptr, conf_vhost);
-               MyFree(vhost_ptr);
        }
-
-#ifdef STRIPBADWORDS
-       for (badword_ptr = conf_badword_channel; badword_ptr;
-               badword_ptr = (ConfigItem_badword *) next) {
-               next = (ListStruct *)badword_ptr->next;
-               ircfree(badword_ptr->word);
-                       ircfree(badword_ptr->replace);
-               DelListItem(badword_ptr, conf_badword_channel);
-               MyFree(badword_ptr);
+       if (!(cep = config_find_entry(ce->ce_entries, "ip")))
+       {
+               config_error("%s:%i: allow::ip missing",
+                       ce->ce_fileptr->cf_filename,
+                       ce->ce_varlinenum);
+               errors++;
        }
-       for (badword_ptr = conf_badword_message; badword_ptr;
-               badword_ptr = (ConfigItem_badword *) next) {
-               next = (ListStruct *)badword_ptr->next;
-               ircfree(badword_ptr->word);
-                       ircfree(badword_ptr->replace);
-               DelListItem(badword_ptr, conf_badword_message);
-               MyFree(badword_ptr);
+       if (!(cep = config_find_entry(ce->ce_entries, "hostname")))
+       {
+               config_error("%s:%i: allow::hostname missing",
+                       ce->ce_fileptr->cf_filename,
+                       ce->ce_varlinenum);
+               errors++;
        }
-#endif
-       for (deny_dcc_ptr = conf_deny_dcc; deny_dcc_ptr; deny_dcc_ptr = (ConfigItem_deny_dcc *)next)
+       if ((cep = config_find_entry(ce->ce_entries, "password")))
        {
-               next = (ListStruct *)deny_dcc_ptr->next;
-               if (deny_dcc_ptr->flag.type2 == CONF_BAN_TYPE_CONF)
-               {
-                       ircfree(deny_dcc_ptr->filename);
-                       ircfree(deny_dcc_ptr->reason);
-                       DelListItem(deny_dcc_ptr, conf_deny_dcc);
-                       MyFree(deny_dcc_ptr);
-               }
+               /* some auth check stuff? */
+               if (Auth_CheckError(cep) < 0)
+                       errors++;
        }
-       for (deny_link_ptr = conf_deny_link; deny_link_ptr; deny_link_ptr = (ConfigItem_deny_link *) next) {
-               next = (ListStruct *)deny_link_ptr->next;
-               ircfree(deny_link_ptr->prettyrule);
-               ircfree(deny_link_ptr->mask);
-               crule_free(&deny_link_ptr->rule);
-               DelListItem(deny_link_ptr, conf_deny_link);
-               MyFree(deny_link_ptr);
+       if ((cep = config_find_entry(ce->ce_entries, "class")))
+       {
        }
-       for (deny_version_ptr = conf_deny_version; deny_version_ptr; deny_version_ptr = (ConfigItem_deny_version *) next) {
-               next = (ListStruct *)deny_version_ptr->next;
-               ircfree(deny_version_ptr->mask);
-               ircfree(deny_version_ptr->version);
-               ircfree(deny_version_ptr->flags);
-               DelListItem(deny_version_ptr, conf_deny_version);
-               MyFree(deny_version_ptr);
+       else
+       {
+               config_error("%s:%i: allow::class missing",
+                       ce->ce_fileptr->cf_filename,
+                       ce->ce_varlinenum);
+               errors++;
        }
-
-       for (deny_channel_ptr = conf_deny_channel; deny_channel_ptr; deny_channel_ptr = (ConfigItem_deny_channel *) next)
+       if ((cep = config_find_entry(ce->ce_entries, "maxperip")))
        {
-               next = (ListStruct *)deny_channel_ptr->next;
-               ircfree(deny_channel_ptr->channel);
-               ircfree(deny_channel_ptr->reason);
-               DelListItem(deny_channel_ptr, conf_deny_channel);
-               MyFree(deny_channel_ptr);
+               if (atoi(cep->ce_vardata) <= 0)
+               {
+                       config_error("%s:%i: allow::maxperip with illegal value (must be >0)",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++;
+               }
+       }
+       if ((cep = config_find_entry(ce->ce_entries, "options")))
+       {
+               if (!cep->ce_entries)
+               {
+                       config_error("%s:%i: allow::%s without parameter",
+                               cep->ce_fileptr->cf_filename,
+                               cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++;
+               }
+               for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                       if (!strcmp(cepp->ce_varname, "noident"))
+                       {}
+                       else if (!strcmp(cepp->ce_varname, "useip")) 
+                       {}
+                       else
+                       {
+                               config_error("%s:%i: allow::options unknown item '%s'",
+                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, 
+                                       cepp->ce_varname);
+                               errors++;
+                       }
+               }
+       
        }
+       return errors;
+}
 
-       for (allow_channel_ptr = conf_allow_channel; allow_channel_ptr; allow_channel_ptr = (ConfigItem_allow_channel *) next)
+int    _conf_allow_channel(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigItem_allow_channel        *allow = NULL;
+       ConfigEntry             *cep;
+
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               next = (ListStruct *)allow_channel_ptr->next;
-               ircfree(allow_channel_ptr->channel);
-               DelListItem(allow_channel_ptr, conf_allow_channel);
-               MyFree(allow_channel_ptr);
+               if (!strcmp(cep->ce_varname, "channel"))
+               {
+                       allow = MyMallocEx(sizeof(ConfigItem_allow_channel));
+                       ircstrdup(allow->channel, cep->ce_vardata);
+                       AddListItem(allow, conf_allow_channel);
+               }
        }
+       return 1;
+}
 
-       if (conf_drpass)
+int    _test_allow_channel(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry             *cep;
+       int                     errors = 0;
+       
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               Auth_DeleteAuthStruct(conf_drpass->restartauth);
-               conf_drpass->restartauth = NULL;
-               Auth_DeleteAuthStruct(conf_drpass->dieauth);
-               conf_drpass->dieauth = NULL;
-               ircfree(conf_drpass);
+               if (!cep->ce_varname || !cep->ce_vardata)
+               {
+                       config_error("%s:%i: allow channel item without contents",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
+               }
+               if (!strcmp(cep->ce_varname, "channel"))
+               {
+               }
+               else
+               {
+                       config_error("%s:%i: unknown allow channel directive %s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum, 
+                               cep->ce_varname);
+                       errors++;
+               }
        }
-       for (log_ptr = conf_log; log_ptr; log_ptr = (ConfigItem_log *)next) {
-               next = (ListStruct *)log_ptr->next;
-               ircfree(log_ptr->file);
-               DelListItem(log_ptr, conf_log);
-               MyFree(log_ptr);
+       return errors;
+}
+
+int     _conf_except(ConfigFile *conf, ConfigEntry *ce)
+{
+
+       ConfigEntry *cep, *cep2, *cep3;
+       ConfigItem_except *ca;
+
+
+       if (!strcmp(ce->ce_vardata, "ban")) {
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               {
+                       if (!strcmp(cep->ce_varname, "mask")) {
+                               ca = MyMallocEx(sizeof(ConfigItem_except));
+                               ca->mask = strdup(cep->ce_vardata);
+                               ca->flag.type = CONF_EXCEPT_BAN;
+                               AddListItem(ca, conf_except);
+                       }
+                       else {
+                       }
+               }
        }
-       for (alias_ptr = conf_alias; alias_ptr; alias_ptr = (ConfigItem_alias *)next) {
-               aCommand *cmptr = find_Command(alias_ptr->alias, 0, 0);
-               ConfigItem_alias_format *fmt;
-               next = (ListStruct *)alias_ptr->next;           
-               ircfree(alias_ptr->nick);
-               del_Command(alias_ptr->alias, NULL, cmptr->func);
-               ircfree(alias_ptr->alias);
-               if (alias_ptr->format && alias_ptr->type == ALIAS_COMMAND) {
-                       for (fmt = (ConfigItem_alias_format *) alias_ptr->format; fmt; fmt = (ConfigItem_alias_format *) next2)
+       else if (!strcmp(ce->ce_vardata, "scan")) {
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               {
+                       if (!strcmp(cep->ce_varname, "mask")) {
+                               ca = MyMallocEx(sizeof(ConfigItem_except));
+                               ca->mask = strdup(cep->ce_vardata);
+                               ca->flag.type = CONF_EXCEPT_SCAN;
+                               AddListItem(ca, conf_except);
+                       }
+                       else {
+                       }
+               }
+
+       }
+       else if (!strcmp(ce->ce_vardata, "tkl")) {
+               cep2 = config_find_entry(ce->ce_entries, "mask");
+               cep3 = config_find_entry(ce->ce_entries, "type");
+               ca = MyMallocEx(sizeof(ConfigItem_except));
+               ca->mask = strdup(cep2->ce_vardata);
+               if (!strcmp(cep3->ce_vardata, "gline"))
+                       ca->type = TKL_KILL|TKL_GLOBAL;
+               else if (!strcmp(cep3->ce_vardata, "gzline"))
+                       ca->type = TKL_ZAP|TKL_GLOBAL;
+               else if (!strcmp(cep3->ce_vardata, "shun"))
+                       ca->type = TKL_SHUN|TKL_GLOBAL;
+               else if (!strcmp(cep3->ce_vardata, "tkline"))
+                       ca->type = TKL_KILL;
+               else if (!strcmp(cep3->ce_vardata, "tzline"))
+                       ca->type = TKL_ZAP;
+               else 
+               {}
+               
+               ca->flag.type = CONF_EXCEPT_TKL;
+               AddListItem(ca, conf_except);
+       }
+       else {
+               int value;
+               for (global_i = Hooks[HOOKTYPE_CONFIGRUN]; global_i;
+                    global_i = global_i->next)
+               {
+                       value = (*(global_i->func.intfunc))(conf,ce,CONFIG_EXCEPT);
+                       if (value == 1)
+                               break;
+               }
+       }
+       return 1;
+}
+
+int     _test_except(ConfigFile *conf, ConfigEntry *ce)
+{
+
+       ConfigEntry *cep, *cep2, *cep3;
+       int         errors = 0;
+
+       if (!ce->ce_vardata)
+       {
+               config_error("%s:%i: except without type",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+
+       if (!strcmp(ce->ce_vardata, "ban")) {
+               if (!config_find_entry(ce->ce_entries, "mask"))
+               {
+                       config_error("%s:%i: except ban without mask item",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+                       return 1;
+               }
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: except ban item without contents",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++;
+                               continue;
+                       }
+                       if (!strcmp(cep->ce_varname, "mask"))
+                       {
+                       }
+                       else
+                       {
+                               config_error("%s:%i: unknown except ban directive %s",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
+                               errors++;
+                               continue;
+                       }
+               }
+               return errors;
+       }
+       else if (!strcmp(ce->ce_vardata, "scan")) {
+               if (!config_find_entry(ce->ce_entries, "mask"))
+               {
+                       config_error("%s:%i: except scan without mask item",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+                       return 1;
+               }
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: except scan item without contents",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++;
+                               continue;
+                       }
+                       if (!strcmp(cep->ce_varname, "mask"))
+                       {
+                       }
+                       else
+                       {
+                               config_error("%s:%i: unknown except scan directive %s",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
+                               errors++;
+                               continue;
+                       }
+               }
+               return errors;
+       }
+       else if (!strcmp(ce->ce_vardata, "tkl")) {
+               if (!config_find_entry(ce->ce_entries, "mask"))
+               {
+                       config_error("%s:%i: except tkl without mask item",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+                       return 1;
+               }
+               if (!(cep3 = config_find_entry(ce->ce_entries, "type")))
+               {
+                       config_error("%s:%i: except tkl without type item",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+                       return 1;
+               }
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: except tkl item without contents",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++;
+                               continue;
+                       }
+                       if (!strcmp(cep->ce_varname, "mask"))
+                       {
+                       }
+                       else if (!strcmp(cep->ce_varname, "type")) {}
+                       else
+                       {
+                               config_error("%s:%i: unknown except scan directive %s",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
+                               errors++;
+                               continue;
+                       }
+               }
+               if (!strcmp(cep3->ce_vardata, "gline")) {}
+               else if (!strcmp(cep3->ce_vardata, "gzline")){}
+               else if (!strcmp(cep3->ce_vardata, "shun")) {}
+               else if (!strcmp(cep3->ce_vardata, "tkline")) {}
+               else if (!strcmp(cep3->ce_vardata, "tzline")) {}
+               else 
+               {
+                       config_error("%s:%i: unknown except tkl type %s",
+                               cep3->ce_fileptr->cf_filename, cep3->ce_varlinenum,
+                               cep3->ce_vardata);
+                       return 1;
+
+               }
+               return errors;
+       }
+       else {
+               int used = 0;
+               for (global_i = Hooks[HOOKTYPE_CONFIGTEST]; global_i; 
+                       global_i = global_i->next) 
+               {
+                       int value, errs = 0;
+                       if (global_i->owner && !(global_i->owner->flags & MODFLAG_TESTING))
+                               continue;
+                       value = (*(global_i->func.intfunc))(conf,ce,CONFIG_EXCEPT,&errs);
+                       if (value == 2)
+                               used = 1;
+                       if (value == 1)
+                       {
+                               used = 1;
+                               break;
+                       }
+                       if (value == -1)
+                       {
+                               used = 1;
+                               errors += errs;
+                               break;
+                       }
+                       if (value == -2)
+                       {
+                               used = 1;
+                               errors += errs;
+                       }
+               }
+               if (!used) {
+                       config_error("%s:%i: unknown except type %s",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, 
+                               ce->ce_vardata);
+                       return 1;
+               }
+       }
+       return errors;
+}
+
+/*
+ * vhost {} block parser
+*/
+int    _conf_vhost(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigItem_vhost *vhost;
+       ConfigItem_oper_from *from;
+       ConfigEntry *cep, *cepp;
+       vhost = MyMallocEx(sizeof(ConfigItem_vhost));
+       cep = config_find_entry(ce->ce_entries, "vhost");
+       {
+               char *user, *host;
+               user = strtok(cep->ce_vardata, "@");
+               host = strtok(NULL, "");
+               if (!host)
+                       vhost->virthost = strdup(user);
+               else {
+                       vhost->virtuser = strdup(user);
+                       vhost->virthost = strdup(host);
+               }
+       }
+       cep = config_find_entry(ce->ce_entries, "login");
+       vhost->login = strdup(cep->ce_vardata); 
+       cep = config_find_entry(ce->ce_entries, "password");
+       vhost->auth = Auth_ConvertConf2AuthStruct(cep);
+       cep = config_find_entry(ce->ce_entries, "from");
+       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+       {
+               if (!strcmp(cepp->ce_varname, "userhost"))
+               {
+                       from = MyMallocEx(sizeof(ConfigItem_oper_from));
+                       ircstrdup(from->name, cepp->ce_vardata);
+                       AddListItem(from, vhost->from);
+               }
+       }
+       if ((cep = config_find_entry(ce->ce_entries, "swhois")))
+               vhost->swhois = strdup(cep->ce_vardata);
+       AddListItem(vhost, conf_vhost);
+       return 1;
+}
+
+int    _test_vhost(ConfigFile *conf, ConfigEntry *ce)
+{
+       int errors = 0;
+       ConfigEntry *vhost, *swhois, *from, *login, *password, *cep;
+       if (!ce->ce_entries)
+       {
+               config_error("%s:%i: empty vhost block", 
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       if (!(vhost = config_find_entry(ce->ce_entries, "vhost")))
+       {
+               config_error("%s:%i: vhost::vhost missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       else
+       {
+               if (!vhost->ce_vardata)
+               {
+                       config_error("%s:%i: vhost::vhost without contents",
+                               vhost->ce_fileptr->cf_filename, vhost->ce_varlinenum);
+                       errors++;
+               }       
+       }
+       if (!(login = config_find_entry(ce->ce_entries, "login")))
+       {
+               config_error("%s:%i: vhost::login missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+               
+       }
+       else
+       {
+               if (!login->ce_vardata)
+               {
+                       config_error("%s:%i: vhost::login without contents",
+                               login->ce_fileptr->cf_filename, login->ce_varlinenum);
+                       errors++;
+               }
+       }
+       if (!(password = config_find_entry(ce->ce_entries, "password")))
+       {
+               config_error("%s:%i: vhost::password missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       else
+       {
+               if (Auth_CheckError(password) < 0)
+                       errors++;
+       }
+       if (!(from = config_find_entry(ce->ce_entries, "from")))
+       {
+               config_error("%s:%i: vhost::from missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       else
+       {
+               if (!from->ce_entries)
+               {
+                       config_error("%s:%i: vhost::from block without contents",
+                               from->ce_fileptr->cf_filename, from->ce_varlinenum);
+                       errors++;
+               }
+               else
+               {
+                       for (cep = from->ce_entries; cep; cep = cep->ce_next)
+                       {
+                               if (!cep->ce_varname)
+                               {
+                                       config_error("%s:%i: vhost::from block item without variable name",
+                                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                                       errors++;
+                                       continue;
+                               }
+                               
+                               if (!strcmp(cep->ce_varname, "userhost"))
+                               {
+                                       if (!cep->ce_vardata)
+                                       {
+                                               config_error("%s:%i: vhost::from::userhost item without contents",
+                                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                                               errors++;
+                                               continue;       
+                                       }
+                               }
+                               else
+                               {
+                                       config_error("%s:%i: vhost::from unknown block item '%s'",
+                                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum, 
+                                               cep->ce_varname);
+                                       errors++;
+                                       continue;       
+                               }
+                       }
+               }
+       }
+       if ((swhois = config_find_entry(ce->ce_entries, "swhois")))
+       {
+               if (!swhois->ce_vardata)
+               {
+                       config_error("%s:%i: vhost::swhois without contents",
+                               swhois->ce_fileptr->cf_filename, swhois->ce_varlinenum);
+                       errors++;
+               }
+       }
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!cep->ce_varname)
+               {
+                       config_error("%s:%i: vhost item without contents",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
+               }
+               if (!cep->ce_vardata)
+               {
+                       if (strcmp(cep->ce_varname, "from"))
+                       {
+                               config_error("%s:%i: vhost item without contents",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++; continue;
+                       }
+               }
+               if (!stricmp(cep->ce_varname, "vhost")) {}
+               else if (!strcmp(cep->ce_varname, "login")) {}
+               else if (!strcmp(cep->ce_varname, "password")) {}
+               else if (!strcmp(cep->ce_varname, "from")) {}
+               else if (!strcmp(cep->ce_varname, "swhois")) {}
+               else
+               {
+                       config_error("%s:%i: unknown directive vhost::%s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum, 
+                               cep->ce_varname);
+                       errors++;
+               }
+       }
+
+       return errors;
+}
+
+#ifdef STRIPBADWORDS
+int     _conf_badword(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       ConfigItem_badword *ca;
+       char *tmp;
+       short regex = 0;
+
+       ca = MyMallocEx(sizeof(ConfigItem_badword));
+
+       cep = config_find_entry(ce->ce_entries, "word");
+       for (tmp = cep->ce_vardata; *tmp; tmp++) {
+               if ((int)*tmp < 65 || (int)*tmp > 123) {
+                       regex = 1;
+                       break;
+               }
+       }
+       if (regex) {
+               ircstrdup(ca->word, cep->ce_vardata);
+       }
+       else {
+               ca->word = MyMalloc(strlen(cep->ce_vardata) + strlen(PATTERN) -1);
+               ircsprintf(ca->word, PATTERN, cep->ce_vardata);
+       }
+       if ((cep = config_find_entry(ce->ce_entries, "replace"))) {
+               ircstrdup(ca->replace, cep->ce_vardata);
+       }
+       if (!strcmp(ce->ce_vardata, "channel"))
+               AddListItem(ca, conf_badword_channel);
+       else if (!strcmp(ce->ce_vardata, "message"))
+               AddListItem(ca, conf_badword_message);
+       return 1;
+
+}
+
+int _test_badword(ConfigFile *conf, ConfigEntry *ce) { 
+       int errors = 0;
+       ConfigEntry *word, *replace, *cep;
+       if (!ce->ce_entries)
+       {
+               config_error("%s:%i: empty badword block", 
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       if (!ce->ce_vardata)
+       {
+               config_error("%s:%i: badword without type",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       else if (strcmp(ce->ce_vardata, "channel") && strcmp(ce->ce_vardata, "message")) {
+                       config_error("%s:%i: badword with unknown type",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       if (!(word = config_find_entry(ce->ce_entries, "word")))
+       {
+               config_error("%s:%i: badword::word missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       else
+       {
+               if (!word->ce_vardata)
+               {
+                       config_error("%s:%i: badword::word without contents",
+                               word->ce_fileptr->cf_filename, word->ce_varlinenum);
+                       errors++;
+               }       
+       }
+       if ((replace = config_find_entry(ce->ce_entries, "replace")))
+       {
+               if (!replace->ce_vardata)
+               {
+                       config_error("%s:%i: badword::replace without contents",
+                               replace->ce_fileptr->cf_filename, replace->ce_varlinenum);
+                       errors++;
+               }
+       }
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!cep->ce_varname || !cep->ce_vardata)
+               {
+                       config_error("%s:%i: badword item without contents",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
+               }
+               if (!stricmp(cep->ce_varname, "word")) {}
+               else if (!strcmp(cep->ce_varname, "replace")) {}
+               else
+               {
+                       config_error("%s:%i: unknown directive badword::%s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum, 
+                               cep->ce_varname);
+                       errors++;
+               }
+       }
+
+       
+       return errors; 
+}
+#endif
+
+int     _conf_help(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       ConfigItem_help *ca;
+       aMotd *last = NULL, *temp;
+       ca = MyMallocEx(sizeof(ConfigItem_help));
+
+       if (!ce->ce_vardata)
+               ca->command = NULL;
+       else
+               ca->command = strdup(ce->ce_vardata);
+
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               temp = MyMalloc(sizeof(aMotd));
+               temp->line = strdup(cep->ce_varname);
+               temp->next = NULL;
+               if (!ca->text)
+                       ca->text = temp;
+               else
+                       last->next = temp;
+               last = temp;
+       }
+       AddListItem(ca, conf_help);
+       return 1;
+
+}
+
+int _test_help(ConfigFile *conf, ConfigEntry *ce) { 
+       int errors = 0;
+       ConfigEntry *cep;
+       if (!ce->ce_entries)
+       {
+               config_error("%s:%i: empty help block", 
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!cep->ce_varname)
+               {
+                       config_error("%s:%i: blank help item",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
+               }
+       }
+       return errors; 
+}
+
+int     _conf_log(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep, *cepp;
+       ConfigItem_log *ca;
+       aMotd *last = NULL, *temp;
+       OperFlag *ofp = NULL;
+
+       ca = MyMallocEx(sizeof(ConfigItem_log));
+       ircstrdup(ca->file, ce->ce_vardata);
+
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!strcmp(cep->ce_varname, "maxsize")) {
+                       ca->maxsize = config_checkval(cep->ce_vardata,CFG_SIZE);
+               }
+               else if (!strcmp(cep->ce_varname, "flags")) {
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+                       {
+                               if ((ofp = config_binary_flags_search(_LogFlags, cepp->ce_varname, sizeof(_LogFlags)/sizeof(_LogFlags[0])))) 
+                                       ca->flags |= ofp->flag;
+                       }
+               }
+       }
+       AddListItem(ca, conf_log);
+       return 1;
+
+}
+
+int _test_log(ConfigFile *conf, ConfigEntry *ce) { 
+       int errors = 0;
+       ConfigEntry *cep, *flags, *maxsize, *cepp;
+       OperFlag *ofp = NULL;
+
+       if (!ce->ce_vardata)
+       {
+               config_error("%s:%i: log block without filename", 
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       if (!ce->ce_entries)
+       {
+               config_error("%s:%i: empty log block", 
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!cep->ce_varname)
+               {
+                       config_error("%s:%i: blank log item",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
+               }
+               if (!strcmp(cep->ce_varname, "flags")) {}
+               else if (!strcmp(cep->ce_varname, "maxsize")) {
+               }
+               else {
+                       config_error("%s:%i: unknown directive log::%s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++; continue;
+               }
+       }
+       if ((maxsize = config_find_entry(ce->ce_entries, "maxsize"))) 
+       {
+               if (!maxsize->ce_vardata) 
+               {
+                       config_error("%s:%i: log::maxsize without contents",
+                               maxsize->ce_fileptr->cf_filename, maxsize->ce_varlinenum);
+                       errors++;
+               }
+       }
+       if (!(flags = config_find_entry(ce->ce_entries, "flags"))) {
+               config_error("%s:%i: log::flags missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       else {
+               if (!flags->ce_entries) {
+                       config_error("%s:%i: log::flags without contents",
+                               flags->ce_fileptr->cf_filename, flags->ce_varlinenum);
+                       errors++;
+               }
+               else {
+                       for (cepp = flags->ce_entries; cepp; cepp = cepp->ce_next)
+                       {
+                               if (!cepp->ce_varname)
+                               {
+                                       config_error("%s:%i: log::flags item without variable name",
+                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
+                                       errors++; continue;
+                               }
+                               if (!config_binary_flags_search(_LogFlags, cepp->ce_varname, sizeof(_LogFlags)/sizeof(_LogFlags[0]))) {
+                                        config_error("%s:%i: unknown log flag '%s'",
+                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
+                                               cepp->ce_varname);
+                                       errors++; 
+                               }
+                       }
+               }
+       }
+       return errors; 
+}
+
+
+int    _conf_link(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       ConfigEntry *cepp;
+       ConfigItem_link *link = NULL;
+       OperFlag    *ofp;
+       unsigned char   isnew = 0;
+
+       link = (ConfigItem_link *) MyMallocEx(sizeof(ConfigItem_link));
+       link->servername = strdup(ce->ce_vardata);
+       /* ugly, but it works. if it fails, we know _test_link failed miserably */
+       link->username = strdup(config_find_entry(ce->ce_entries, "username")->ce_vardata);
+       link->hostname = strdup(config_find_entry(ce->ce_entries, "hostname")->ce_vardata);
+       link->bindip = strdup(config_find_entry(ce->ce_entries, "bind-ip")->ce_vardata);
+       link->port = atol(config_find_entry(ce->ce_entries, "port")->ce_vardata);
+       link->recvauth = Auth_ConvertConf2AuthStruct(config_find_entry(ce->ce_entries, "password-receive"));
+       link->connpwd = strdup(config_find_entry(ce->ce_entries, "password-connect")->ce_vardata);
+       cep = config_find_entry(ce->ce_entries, "class");
+       link->class = Find_class(cep->ce_vardata);
+       if (!link->class)
+       {
+               config_status("%s:%i: illegal link::class, unknown class '%s' using default of class 'default'",
+                       cep->ce_fileptr->cf_filename,
+                       cep->ce_varlinenum,
+                       cep->ce_vardata);
+               link->class = default_class;
+       }
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!strcmp(cep->ce_varname, "options"))
+               {
+                       /* remove options */
+                       link->options = 0;
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+                       {
+                               if (!cepp->ce_varname)
+                               {
+                                       config_status("%s:%i: link::flag item without variable name",
+                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
+                                       continue;
+                               }
+                               if ((ofp = config_binary_flags_search(_LinkFlags, cepp->ce_varname, sizeof(_LinkFlags)/sizeof(_LinkFlags[0])))) 
+                                       link->options |= ofp->flag;
+
+                       }
+               } else
+               if (!strcmp(cep->ce_varname, "hub"))
+               {
+                       link->hubmask = strdup(cep->ce_vardata);
+               } else
+               if (!strcmp(cep->ce_varname, "leaf"))
+               {
+                       link->leafmask = strdup(cep->ce_vardata);
+               } else
+               if (!strcmp(cep->ce_varname, "leafdepth"))
+               {
+                       link->leafdepth = atol(cep->ce_vardata);
+               } 
+#ifdef USE_SSL
+               else if (!strcmp(cep->ce_varname, "ciphers"))
+               {
+                       link->ciphers = strdup(cep->ce_vardata);
+               }
+#endif
+       }
+       AddListItem(link, conf_link);
+       return 0;
+}
+
+int    _test_link(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry     *cep, *cepp;
+       OperFlag        *ofp;
+       int             errors = 0;
+       char            **p;
+       char            *requiredsections[] = {
+                               "username", "hostname", "bind-ip", "port",
+                               "password-receive", "password-connect",
+                               "class", NULL
+                       };
+       char            *knowndirc[] = 
+                       {
+                               "username", "hostname", "bind-ip",
+                               "port", "password-receive",
+                               "password-connect", "class",
+                               "hub", "leaf", 
+                               "leafdepth", "ciphers", 
+                               NULL
+                       };
+       if (!ce->ce_vardata)
+       {
+               config_error("%s:%i: link without servername",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+
+       }
+       if (!strchr(ce->ce_vardata, '.'))
+       {
+               config_error("%s:%i: link: bogus server name",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       
+       for (p = requiredsections; *p; p++)
+       {
+               if ((cep = config_find_entry(ce->ce_entries, *p)))
+               {
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: link::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum, cep->ce_varname);
+                               errors++;
+                       }
+               }
+               else
+               {
+                       config_error("%s:%i: link::%s missing",
+                               ce->ce_fileptr->cf_filename,
+                               ce->ce_varlinenum, *p);
+                       errors++;
+               }
+       }
+       if ((cep = config_find_entry(ce->ce_entries, "password-receive")))
+       {
+               if (Auth_CheckError(cep) < 0)
+                       errors++;
+       }
+       if (errors > 0)
+               return errors;
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!strcmp(cep->ce_varname, "options")) 
+               {
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+                       {
+                               if (!cepp->ce_varname)
+                               {
+                                       config_error("%s:%i: link::options item without variable name",
+                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
+                                               errors++; 
+                                               continue;
+                               }
+                               if (!(ofp = config_binary_flags_search(_LinkFlags, cepp->ce_varname, sizeof(_LinkFlags)/sizeof(_LinkFlags[0])))) {
+                                        config_error("%s:%i: unknown link option '%s'",
+                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
+                                               cepp->ce_varname);
+                                       errors++; 
+                               }
+#ifndef USE_SSL
+                               else 
+                               {
+                                       if (ofp->flag == CONNECT_SSL)
+                                       {
+                                               config_status("%s:%i: link %s with SSL option enabled on a non-SSL compile",
+                                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum, ce->ce_vardata);
+                                               errors++;
+                                       }
+                               }
+#endif 
+                       }
+                       continue;
+               }
+               for (p = knowndirc; *p; p++)
+                       if (!strcmp(cep->ce_varname, *p))
+                               break;
+               if (!*p)
+               {
+                       config_error("%s:%i: unknown directive link::%s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++;
+               }
+       }
+       return errors;
+               
+}
+
+int     _conf_ban(ConfigFile *conf, ConfigEntry *ce)
+{
+
+       ConfigEntry *cep;
+       ConfigItem_ban *ca;
+
+       ca = MyMallocEx(sizeof(ConfigItem_ban));
+       if (!strcmp(ce->ce_vardata, "nick"))
+               ca->flag.type = CONF_BAN_NICK;
+       else if (!strcmp(ce->ce_vardata, "ip"))
+               ca->flag.type = CONF_BAN_IP;
+       else if (!strcmp(ce->ce_vardata, "server"))
+               ca->flag.type = CONF_BAN_SERVER;
+       else if (!strcmp(ce->ce_vardata, "user"))
+               ca->flag.type = CONF_BAN_USER;
+       else if (!strcmp(ce->ce_vardata, "realname"))
+               ca->flag.type = CONF_BAN_REALNAME;
+       else {
+               int value;
+               for (global_i = Hooks[HOOKTYPE_CONFIGRUN]; global_i;
+                    global_i = global_i->next)
+               {
+                       value = (*(global_i->func.intfunc))(conf,ce,CONFIG_BAN);
+                       if (value == 1)
+                               break;
+               }
+               return 0;
+       }
+       cep = config_find_entry(ce->ce_entries, "mask");        
+       ca->mask = strdup(cep->ce_vardata);
+       if (ca->flag.type == CONF_BAN_IP)
+               ca->masktype = parse_netmask(ca->mask, &ca->netmask, &ca->bits);
+       cep = config_find_entry(ce->ce_entries, "reason");
+       ca->reason = strdup(cep->ce_vardata);
+       AddListItem(ca, conf_ban);
+       return 0;
+}
+
+int     _test_ban(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep;
+       int         errors = 0;
+       if (!ce->ce_vardata)
+       {
+               config_error("%s:%i: ban without type", 
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       if (!strcmp(ce->ce_vardata, "nick"))
+       {}
+       else if (!strcmp(ce->ce_vardata, "ip"))
+       {}
+       else if (!strcmp(ce->ce_vardata, "server"))
+       {}
+       else if (!strcmp(ce->ce_vardata, "user"))
+       {}
+       else if (!strcmp(ce->ce_vardata, "realname"))
+       {}
+       else
+       {
+               int used = 0;
+               for (global_i = Hooks[HOOKTYPE_CONFIGTEST]; global_i; 
+                       global_i = global_i->next) 
+               {
+                       int value, errs = 0;
+                       if (global_i->owner && !(global_i->owner->flags & MODFLAG_TESTING))
+                               continue;
+                       value = (*(global_i->func.intfunc))(conf,ce,CONFIG_BAN, &errs);
+                       if (value == 2)
+                               used = 1;
+                       if (value == 1)
+                       {
+                               used = 1;
+                               break;
+                       }
+                       if (value == -1)
+                       {
+                               used = 1;
+                               errors += errs;
+                               break;
+                       }
+                       if (value == -2)
+                       {
+                               used = 1;
+                               errors += errs;
+                       }
+               }
+               if (!used) {
+                       config_error("%s:%i: unknown ban type %s",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                               ce->ce_vardata);
+                       return 1;
+               }
+               return errors;
+       }
+       
+       if (!(cep = config_find_entry(ce->ce_entries, "mask")))
+       {
+               config_error("%s:%i: ban %s::mask missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+               errors++;
+       }
+       else {
+               if (!cep->ce_vardata)
+               {
+                       config_error("%s:%i: ban::%s without contents",
+                               cep->ce_fileptr->cf_filename,
+                               cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++;
+               }
+       }
+
+       if (!(cep = config_find_entry(ce->ce_entries, "reason")))
+       {
+               config_error("%s:%i: ban %s::reason missing",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+               errors++;
+       }
+       else {
+               if (!cep->ce_vardata)
+               {
+                       config_error("%s:%i: ban::%s without contents",
+                               cep->ce_fileptr->cf_filename,
+                               cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++;
+               }
+       }
+       return errors;  
+}
+
+int    _conf_set(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep, *cepp, *ceppp;
+       OperFlag        *ofl = NULL;
+       char        temp[512];
+       int         i;
+
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!strcmp(cep->ce_varname, "kline-address")) {
+                       ircstrdup(tempiConf.kline_address, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "modes-on-connect")) {
+                       tempiConf.conn_modes = (long) set_usermode(cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "modes-on-oper")) {
+                       tempiConf.oper_modes = (long) set_usermode(cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "static-quit")) {
+                       ircstrdup(tempiConf.static_quit, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "auto-join")) {
+                       ircstrdup(tempiConf.auto_join_chans, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "oper-auto-join")) {
+                       ircstrdup(tempiConf.oper_auto_join_chans, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "anti-spam-quit-message-time")) {
+                       tempiConf.anti_spam_quit_message_time = config_checkval(cep->ce_vardata,CFG_TIME);
+               }
+               else if (!strcmp(cep->ce_varname, "oper-only-stats")) {
+                       ircstrdup(tempiConf.oper_only_stats, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "maxchannelsperuser")) {
+                       tempiConf.maxchannelsperuser = atoi(cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "network-name")) {
+                       char *tmp;
+                       ircstrdup(tempiConf.network.x_ircnetwork, cep->ce_vardata);
+                       for (tmp = cep->ce_vardata; *cep->ce_vardata; cep->ce_vardata++) {
+                               if (*cep->ce_vardata == ' ')
+                                       *cep->ce_vardata='-';
+                       }
+                       ircstrdup(tempiConf.network.x_ircnet005, tmp);
+                       cep->ce_vardata = tmp;
+               }
+               else if (!strcmp(cep->ce_varname, "default-server")) {
+                       ircstrdup(tempiConf.network.x_defserv, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "services-server")) {
+                       ircstrdup(tempiConf.network.x_services_name, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "stats-server")) {
+                       ircstrdup(tempiConf.network.x_stats_server, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "help-channel")) {
+                       ircstrdup(tempiConf.network.x_helpchan, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "hiddenhost-prefix")) {
+                       ircstrdup(tempiConf.network.x_hidden_host, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "prefix-quit")) {
+                       if (*cep->ce_vardata == '0')
+                       {
+                               ircstrdup(tempiConf.network.x_prefix_quit, "");
+                       }
+                       else
+                               ircstrdup(tempiConf.network.x_prefix_quit, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "dns")) {
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                               if (!strcmp(cepp->ce_varname, "timeout")) {
+                                       tempiConf.host_timeout = config_checkval(cepp->ce_vardata,CFG_TIME);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "retries")) {
+                                       tempiConf.host_retries = config_checkval(cepp->ce_vardata,CFG_TIME);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "nameserver")) {
+                                       ircstrdup(tempiConf.name_server, cepp->ce_vardata);
+                               }
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "options")) {
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                               if (!strcmp(cepp->ce_varname, "webtv-support")) {
+                                       tempiConf.webtv_support = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "hide-ulines")) {
+                                       tempiConf.hide_ulines = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "no-stealth")) {
+                                       tempiConf.no_oper_hiding = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "show-opermotd")) {
+                                       tempiConf.som = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "identd-check")) {
+                                       tempiConf.ident_check = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "fail-oper-warn")) {
+                                       tempiConf.fail_oper_warn = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "show-connect-info")) {
+                                       tempiConf.show_connect_info = 1;
+                               }
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "hosts")) {
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+                       {
+                               if (!strcmp(cepp->ce_varname, "local")) {
+                                       ircstrdup(tempiConf.network.x_locop_host, cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "global")) {
+                                       ircstrdup(tempiConf.network.x_oper_host, cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "coadmin")) {
+                                       ircstrdup(tempiConf.network.x_coadmin_host, cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "admin")) {
+                                       ircstrdup(tempiConf.network.x_admin_host, cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "servicesadmin")) {
+                                       ircstrdup(tempiConf.network.x_sadmin_host, cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "netadmin")) {
+                                       ircstrdup(tempiConf.network.x_netadmin_host, cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "host-on-oper-up")) {
+                                       tempiConf.network.x_inah = config_checkval(cepp->ce_vardata,CFG_YESNO);
+                               }
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "cloak-keys"))
+               {
+                       tempiConf.network.key = ircabs(atol(cep->ce_entries->ce_varname));
+                       tempiConf.network.key2 = ircabs(atol(cep->ce_entries->ce_next->ce_varname));
+                       tempiConf.network.key3 = ircabs(atol(cep->ce_entries->ce_next->ce_next->ce_varname));
+                       ircsprintf(temp, "%li.%li.%li", tempiConf.network.key,
+                               tempiConf.network.key2, tempiConf.network.key3);
+                       tempiConf.network.keycrc = (long) crc32(temp, strlen(temp));
+               }
+               else if (!strcmp(cep->ce_varname, "ssl")) {
+#ifdef USE_SSL
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                               if (!strcmp(cepp->ce_varname, "egd")) {
+                                       tempiConf.use_egd = 1;
+                                       if (cepp->ce_vardata)
+                                               tempiConf.egd_path = strdup(cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "certificate"))
+                               {
+                                       ircstrdup(tempiConf.x_server_cert_pem, cepp->ce_vardata);       
+                               }
+                               else if (!strcmp(cepp->ce_varname, "key"))
+                               {
+                                       ircstrdup(tempiConf.x_server_key_pem, cepp->ce_vardata);        
+                               }
+                               else if (!strcmp(cepp->ce_varname, "trusted-ca-file"))
+                               {
+                                       ircstrdup(tempiConf.trusted_ca_file, cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "options"))
+                               {
+                                       tempiConf.ssl_options = 0;
+                                       for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next)
+                                       {
+                                               for (ofl = _SSLFlags; ofl->name; ofl++)
+                                               {
+                                                       if (!strcmp(ceppp->ce_varname, ofl->name))
+                                                       {       
+                                                               tempiConf.ssl_options |= ofl->flag;
+                                                               break;
+                                                       }
+                                               }
+                                       }
+                                       if (tempiConf.ssl_options & SSLFLAG_DONOTACCEPTSELFSIGNED)
+                                               if (!tempiConf.ssl_options & SSLFLAG_VERIFYCERT)
+                                                       tempiConf.ssl_options |= SSLFLAG_VERIFYCERT;
+                               }       
+                               
+                       }
+#endif
+               }
+               else 
+               {
+                       int value;
+                       for (global_i = Hooks[HOOKTYPE_CONFIGRUN]; global_i;
+                            global_i = global_i->next)
                        {
-                               next2 = (ListStruct *)fmt->next;
-                               ircfree(fmt->format);
-                               ircfree(fmt->parameters);
-                               DelListItem(fmt, alias_ptr->format);
-                               MyFree(fmt);
+                               value = (*(global_i->func.intfunc))(conf,cep,CONFIG_SET);
+                               if (value == 1)
+                                       break;
+                       }
+               }
+       }
+       return 0;
+}
+
+int    _test_set(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigEntry *cep, *cepp, *ceppp;
+       OperFlag        *ofl = NULL;
+       long            templong, l1, l2,l3;
+       int             tempi;
+       char        temp[512];
+       int         i;
+       int         errors = 0;
+#define CheckNull(x) if ((!(x)->ce_vardata) || (!(*((x)->ce_vardata)))) { config_error("%s:%i: missing parameter", (x)->ce_fileptr->cf_filename, (x)->ce_varlinenum); errors++; continue; }
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!cep->ce_varname)
+               {
+                       config_error("%s:%i: blank set item",
+                               cep->ce_fileptr->cf_filename,
+                               cep->ce_varlinenum);
+                       errors++;
+                       continue;
+               }
+               if (!strcmp(cep->ce_varname, "kline-address")) {
+                       CheckNull(cep);
+                       if (!strchr(cep->ce_vardata, '@') && !strchr(cep->ce_vardata, ':'))
+                       {
+                               config_error("%s:%i: set::kline-address must be an e-mail or an URL",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++;
+                               continue;
+                       }
+                       else if (!match("*@unrealircd.com", cep->ce_vardata) || !match("*@unrealircd.org",cep->ce_vardata) || !match("unreal-*@lists.sourceforge.net",cep->ce_vardata)) 
+                       {
+                               config_error("%s:%i: set::kline-address may not be an UnrealIRCd Team address",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++; continue;
+                       }
+                       requiredstuff.settings.kline_address = 1;
+               }
+               else if (!strcmp(cep->ce_varname, "modes-on-connect")) {
+                       CheckNull(cep);
+                       templong = (long) set_usermode(cep->ce_vardata);
+                       if (templong & UMODE_OPER)
+                       {
+                               config_error("%s:%i: set::modes-on-connect contains +o",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum);
+                               errors++;
+                               continue;
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "modes-on-oper")) {
+                       CheckNull(cep);
+                       templong = (long) set_usermode(cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "static-quit")) {
+                       CheckNull(cep);
+               }
+               else if (!strcmp(cep->ce_varname, "auto-join")) {
+                       CheckNull(cep);
+               }
+               else if (!strcmp(cep->ce_varname, "oper-auto-join")) {
+                       CheckNull(cep);
+               }
+               else if (!strcmp(cep->ce_varname, "anti-spam-quit-message-time")) {
+                       CheckNull(cep);
+               }
+               else if (!strcmp(cep->ce_varname, "oper-only-stats")) {
+                       CheckNull(cep);
+               }
+               else if (!strcmp(cep->ce_varname, "maxchannelsperuser")) {
+                       CheckNull(cep);
+                       tempi = atoi(cep->ce_vardata);
+                       if (tempi < 1)
+                       {
+                               config_error("%s:%i: set::maxchannelsperuser must be > 0",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum);
+                               errors++;
+                               continue;
+                       }
+                       requiredstuff.settings.maxchannelsperuser = 1;
+               }
+               else if (!strcmp(cep->ce_varname, "network-name")) {
+                       CheckNull(cep);
+                       requiredstuff.settings.irc_network = 1;
+               }
+               else if (!strcmp(cep->ce_varname, "default-server")) {
+                       CheckNull(cep);
+                       requiredstuff.settings.defaultserv = 1;
+               }
+               else if (!strcmp(cep->ce_varname, "services-server")) {
+                       CheckNull(cep);
+               }
+               else if (!strcmp(cep->ce_varname, "stats-server")) {
+                       CheckNull(cep);
+               }
+               else if (!strcmp(cep->ce_varname, "help-channel")) {
+                       CheckNull(cep);
+                       requiredstuff.settings.hlpchan = 1;
+               }
+               else if (!strcmp(cep->ce_varname, "hiddenhost-prefix")) {
+                       CheckNull(cep);
+                       if (strchr(cep->ce_vardata, ' ') || (*cep->ce_vardata == ':'))
+                       {
+                               config_error("%s:%i: set::hiddenhost-prefix must not contain spaces or be prefixed with ':'",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++;
+                               continue;
+                       }
+                       requiredstuff.settings.hidhost = 1;
+               }
+               else if (!strcmp(cep->ce_varname, "prefix-quit")) {
+                       CheckNull(cep);
+               }
+               else if (!strcmp(cep->ce_varname, "dns")) {
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                               CheckNull(cepp);
+                               if (!strcmp(cepp->ce_varname, "timeout")) {
+                                       requiredstuff.settings.host_timeout = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "retries")) {
+                                       requiredstuff.settings.host_retries = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "nameserver")) {
+                                       struct in_addr in;
+                                       
+                                       in.s_addr = inet_addr(cepp->ce_vardata);
+                                       if (strcmp((char *)inet_ntoa(in), cepp->ce_vardata))
+                                       {
+                                               config_error("%s:%i: set::dns::nameserver (%s) is not a valid IP",
+                                                       cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
+                                                       cepp->ce_vardata);
+                                               errors++;
+                                               continue;
+                                       }
+                                       requiredstuff.settings.name_server = 1;
+                               }
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "options")) {
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                               if (!strcmp(cepp->ce_varname, "webtv-support")) {
+                               }
+                               else if (!strcmp(cepp->ce_varname, "hide-ulines")) {
+                               }
+                               else if (!strcmp(cepp->ce_varname, "no-stealth")) {
+                               }
+                               else if (!strcmp(cepp->ce_varname, "show-opermotd")) {
+                               }
+                               else if (!strcmp(cepp->ce_varname, "identd-check")) {
+                               }
+                               else if (!strcmp(cepp->ce_varname, "fail-oper-warn")) {
+                               }
+                               else if (!strcmp(cepp->ce_varname, "show-connect-info")) {
+                               }
+                               else
+                               {
+                                       config_error("%s:%i: unknown option set::options::%s",
+                                               cepp->ce_fileptr->cf_filename,
+                                               cepp->ce_varlinenum,
+                                               cepp->ce_varname);
+                                       errors++;
+                                       continue;
+                               }
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "hosts")) {
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
+                       {
+                               if (!cepp->ce_vardata)
+                               {
+                                       config_error("%s:%i: set::hosts item without value",
+                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
+                                       errors++;
+                                       continue;
+                               } 
+                               if (!strcmp(cepp->ce_varname, "local")) {
+                                       requiredstuff.settings.locophost = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "global")) {
+                                       requiredstuff.settings.operhost = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "coadmin")) {
+                                       requiredstuff.settings.coadminhost = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "admin")) {
+                                       requiredstuff.settings.adminhost = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "servicesadmin")) {
+                                       requiredstuff.settings.sadminhost = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "netadmin")) {
+                                       requiredstuff.settings.netadminhost = 1;
+                               }
+                               else if (!strcmp(cepp->ce_varname, "host-on-oper-up")) {
+                               }
+                               else
+                               {
+                                       config_error("%s:%i: unknown directive set::hosts::%s",
+                                               cepp->ce_fileptr->cf_filename,
+                                               cepp->ce_varlinenum,
+                                               cepp->ce_varname);
+                                       errors++;
+                                       continue;
+
+                               }
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "cloak-keys"))
+               {
+                       /* Count number of numbers there .. */
+                       for (cepp = cep->ce_entries, i = 0; cepp; cepp = cepp->ce_next, i++) { }
+                       if (i != 3)
+                       {
+                               config_error("%s:%i: set::cloak-keys: we want 3 values, not %i!",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                       i);
+                               errors++;
+                               continue;
+                       }
+                       /* i == 3 SHOULD make this true .. */
+                       l1 = ircabs(atol(cep->ce_entries->ce_varname));
+                       l2 = ircabs(atol(cep->ce_entries->ce_next->ce_varname));
+                       l3  = ircabs(atol(cep->ce_entries->ce_next->ce_next->ce_varname));
+                       if ((l1 < 10000) || (l2 < 10000) || (l3 < 10000))
+                       {
+                               config_error("%s:%i: set::cloak-keys: values must be over 10000",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++;
+                               continue;
+                       }               
+                       requiredstuff.settings.cloakkeys = 1;   
+               }
+               else if (!strcmp(cep->ce_varname, "ssl")) {
+#ifdef USE_SSL
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                               if (!strcmp(cepp->ce_varname, "egd")) {
+                               }
+                               else if (!strcmp(cepp->ce_varname, "certificate"))
+                               {
+                                       CheckNull(cepp);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "key"))
+                               {
+                                       CheckNull(cepp);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "trusted-ca-file"))
+                               {
+                                       CheckNull(cepp);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "options"))
+                               {
+                                       for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next)
+                                       {
+                                               for (ofl = _SSLFlags; ofl->name; ofl++)
+                                               {
+                                                       if (!strcmp(ceppp->ce_varname, ofl->name))
+                                                       {       
+                                                               break;
+                                                       }
+                                               }
+                                       }
+                                       if (!ofl->name)
+                                       {
+                                               config_error("%s:%i: unknown SSL flag '%s'",
+                                                       ceppp->ce_fileptr->cf_filename, 
+                                                       ceppp->ce_varlinenum, ceppp->ce_varname);
+                                       }
+                               }       
+                               
+                       }
+#endif
+               }
+               else
+               {
+                       int used = 0;
+                       for (global_i = Hooks[HOOKTYPE_CONFIGTEST]; global_i; 
+                               global_i = global_i->next) 
+                       {
+                               int value, errs = 0;
+                               if (global_i->owner && !(global_i->owner->flags & MODFLAG_TESTING))
+                                       continue;
+                               value = (*(global_i->func.intfunc))(conf,cep,CONFIG_SET, &errs);
+                               if (value == 2)
+                                       used = 1;
+                               if (value == 1)
+                               {
+                                       used = 1;
+                                       break;
+                               }
+                               if (value == -1)
+                               {
+                                       used = 1;
+                                       errors += errs;
+                                       break;
+                               }
+                               if (value == -2)
+                               {
+                                       used = 1;
+                                       errors += errs;
+                               }
+                       }
+                       if (!used) {
+                               config_error("%s:%i: unknown directive set::%s",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++;
                        }
                }
-               DelListItem(alias_ptr, conf_alias);
-               MyFree(alias_ptr);
        }
-       for (include_ptr = conf_include; include_ptr; include_ptr = (ConfigItem_include *)next)
-       {
-               next = (ListStruct *)include_ptr->next;  
-               ircfree(include_ptr->file);
-               DelListItem(include_ptr, conf_include);
-               MyFree(include_ptr);
+       return errors;
+}
+
+int    _conf_loadmodule(ConfigFile *conf, ConfigEntry *ce)
+{
+#ifdef GLOBH
+       glob_t files;
+       int i;
+#elif defined(_WIN32)
+       HANDLE hFind;
+       WIN32_FIND_DATA FindData;
+#endif
+       char *ret;
+       if (!ce->ce_vardata)
+       {
+               config_status("%s:%i: loadmodule without filename",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return -1;
+       }
+#ifdef GLOBH
+#if defined(__OpenBSD__) && defined(GLOB_LIMIT)
+       glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK|GLOB_LIMIT, NULL, &files);
+#else
+       glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK, NULL, &files);
+#endif
+       if (!files.gl_pathc) {
+               globfree(&files);
+               config_status("%s:%i: loadmodule %s: failed to load",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                       ce->ce_vardata);
+               return -1;
+       }       
+       for (i = 0; i < files.gl_pathc; i++) {
+               if ((ret = Module_Create(files.gl_pathv[i]))) {
+                       config_status("%s:%i: loadmodule %s: failed to load: %s",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                               files.gl_pathv[i], ret);
+               }
+       }
+       globfree(&files);
+#elif defined(_WIN32)
+       hFind = FindFirstFile(ce->ce_vardata, &FindData);
+       if (!FindData.cFileName) {
+               config_status("%s:%i: loadmodule %s: failed to load",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                       ce->ce_vardata);
+               FindClose(hFind);
+               return -1;
        }
-       for (help_ptr = conf_help; help_ptr; help_ptr = (ConfigItem_help *)next) {
-               aMotd *text;
-               next = (ListStruct *)help_ptr->next;
-               ircfree(help_ptr->command);
-               while (help_ptr->text) {
-                       text = help_ptr->text->next;
-                       ircfree(help_ptr->text->line);
-                       ircfree(help_ptr->text);
-                       help_ptr->text = text;
-               }
-               DelListItem(help_ptr, conf_help);
-               MyFree(help_ptr);
+       if ((ret = Module_Create(FindData.cFileName))) {
+                       config_status("%s:%i: loadmodule %s: failed to load: %s",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                               FindData.cFileName, ret);
+       }
+       while (FindNextFile(hFind, &FindData) != 0) {
+               if (((ret = Module_Create(FindData.cFileName)))) 
+                       config_status("%s:%i: loadmodule %s: failed to load: %s",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                               FindData.cFileName, ret);
+       }
+       FindClose(hFind);
+#else
+       if ((ret = Module_Create(ce->ce_vardata))) {
+                       config_status("%s:%i: loadmodule %s: failed to load: %s",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                               ce->ce_vardata, ret);
+                               return -1;
        }
-       ircfree(KLINE_ADDRESS);
-       ircfree(AUTO_JOIN_CHANS);
-       ircfree(OPER_AUTO_JOIN_CHANS);
-       ircfree(OPER_ONLY_STATS);
-       ircfree(ircnetwork);
-       ircfree(ircnet005);
-       ircfree(defserv);
-       ircfree(SERVICES_NAME);
-       ircfree(STATS_SERVER);
-       ircfree(helpchan);
-       ircfree(hidden_host);
-       ircfree(prefix_quit);
-       ircfree(NAME_SERVER);
-       ircfree(locop_host);
-       ircfree(oper_host);
-       ircfree(coadmin_host);
-       ircfree(admin_host);
-       ircfree(sadmin_host);
-       ircfree(netadmin_host);
-       ircfree(STATIC_QUIT);
-#ifdef USE_SSL
-       ircfree(iConf.x_server_cert_pem);
-       ircfree(iConf.x_server_key_pem);
 #endif
-       bzero(&iConf, sizeof(iConf));
+       return 1;
+}
 
-       /* rehash_modules */
-       init_conf2(configfile);
-       validate_configuration();
-       module_loadall(0);
-       /* Clean up listen records */
-       close_listeners();
-       listen_cleanup();
-       close_listeners();
-       run_configuration();
-       loop.do_bancheck = 1;
-       /* Check pings is done AFTERWARDS return anyhow, fuckheads. */
-       sendto_realops("Completed rehash");
+int    _test_loadmodule(ConfigFile *conf, ConfigEntry *ce)
+{
        return 0;
 }
 
-
 /*
- * Lookup functions
- * -Stskeeps
+ * Actually use configuration
 */
-ConfigItem_deny_dcc    *Find_deny_dcc(char *name)
-{
-       ConfigItem_deny_dcc     *p;
 
-       if (!name)
-               return NULL;
+void   run_configuration(void)
+{
+       ConfigItem_listen       *listenptr;
 
-       for (p = conf_deny_dcc; p; p = (ConfigItem_deny_dcc *) p->next)
+       for (listenptr = conf_listen; listenptr; listenptr = (ConfigItem_listen *) listenptr->next)
        {
-               if (!match(name, p->filename))
-                       return (p);
-       }
-       return NULL;
-}
-
-ConfigItem_alias *Find_alias(char *name) {
-       ConfigItem_alias *alias;
-
-       if (!name)
-               return NULL;
-
-       for (alias = conf_alias; alias; alias = (ConfigItem_alias *)alias->next) {
-               if (!stricmp(alias->alias, name))
-                       return alias;
+               if (!(listenptr->options & LISTENER_BOUND))
+               {
+                       if (add_listener2(listenptr) == -1)
+                       {
+                               ircd_log(LOG_ERROR, "Failed to bind to %s:%i", listenptr->ip, listenptr->port);
+                       }
+                               else
+                       {
+                       }
+               }
+               else
+               {
+                       if (listenptr->listener)
+                       {
+                               listenptr->listener->umodes = 
+                                       (listenptr->options & ~LISTENER_BOUND) ? listenptr->options : LISTENER_NORMAL;
+                               listenptr->listener->umodes |= LISTENER_BOUND;
+                       }
+               }
        }
-       return NULL;
 }
 
-ConfigItem_class       *Find_class(char *name)
+int    _conf_alias(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigItem_class        *p;
-
-       if (!name)
-               return NULL;
+       ConfigItem_alias *alias = NULL;
+       ConfigItem_alias_format *format;
+       ConfigEntry             *cep, *cepp;
+       aCommand *cmptr;
 
-       for (p = conf_class; p; p = (ConfigItem_class *) p->next)
+       if (!ce->ce_vardata)
        {
-               if (!strcmp(name, p->name))
-                       return (p);
+               config_status("%s:%i: alias without name",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return -1;
        }
-       return NULL;
-}
-
-ConfigItem_oper        *Find_oper(char *name)
-{
-       ConfigItem_oper *p;
-
-       if (!name)
-               return NULL;
-
-       for (p = conf_oper; p; p = (ConfigItem_oper *) p->next)
+       if ((cmptr = find_Command(ce->ce_vardata, 0, M_ALIAS)))
+               del_Command(ce->ce_vardata, NULL, cmptr->func);
+       if ((alias = Find_alias(ce->ce_vardata)))
+               DelListItem(alias, conf_alias);
+       alias = MyMallocEx(sizeof(ConfigItem_alias));
+       ircstrdup(alias->alias, ce->ce_vardata);
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               if (!strcmp(name, p->name))
-                       return (p);
+               if (!strcmp(cep->ce_varname, "format")) {
+                       format = MyMallocEx(sizeof(ConfigItem_alias_format));
+                       ircstrdup(format->format, cep->ce_vardata);
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                               if (!strcmp(cepp->ce_varname, "nick")) {
+                                       ircstrdup(format->nick, cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "parameters")) {
+                                       ircstrdup(format->parameters, cepp->ce_vardata);
+                               }
+                               else if (!strcmp(cepp->ce_varname, "type")) {
+                                       if (!strcmp(cepp->ce_vardata, "services"))
+                                               format->type = ALIAS_SERVICES;
+                                       else if (!strcmp(cepp->ce_vardata, "stats"))
+                                               format->type = ALIAS_STATS;
+                                       else if (!strcmp(cepp->ce_vardata, "normal"))
+                                               format->type = ALIAS_NORMAL;
+                               }
+                       }
+                       AddListItem(format, alias->format);
+               }               
+                               
+               else if (!strcmp(cep->ce_varname, "nick")) {
+                       ircstrdup(alias->nick, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "type")) {
+                       if (!strcmp(cep->ce_vardata, "services"))
+                               alias->type = ALIAS_SERVICES;
+                       else if (!strcmp(cep->ce_vardata, "stats"))
+                               alias->type = ALIAS_STATS;
+                       else if (!strcmp(cep->ce_vardata, "normal"))
+                               alias->type = ALIAS_NORMAL;
+                       else if (!strcmp(cep->ce_vardata, "command"))
+                               alias->type = ALIAS_COMMAND;
+               }
+                       
        }
-       return NULL;
+       if (BadPtr(alias->nick) && alias->type != ALIAS_COMMAND) {
+               ircstrdup(alias->nick, alias->alias); 
+       }
+       add_CommandX(alias->alias, NULL, m_alias, 1, M_USER|M_ALIAS);
+       AddListItem(alias, conf_alias);
+       return 0;
 }
 
-ConfigItem_listen      *Find_listen(char *ipmask, int port)
-{
-       ConfigItem_listen       *p;
-
-       if (!ipmask)
-               return NULL;
 
-       for (p = conf_listen; p; p = (ConfigItem_listen *) p->next)
+int _test_alias(ConfigFile *conf, ConfigEntry *ce) { 
+       int errors = 0;
+       ConfigEntry *cep, *cepp;
+       if (!ce->ce_entries)
        {
-               if (!match(p->ip, ipmask) && (port == p->port))
-                       return (p);
-               if (!match(ipmask, p->ip) && (port == p->port))
-                       return (p);
+               config_error("%s:%i: empty alias block", 
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
        }
-       return NULL;
-}
-
-ConfigItem_ulines *Find_uline(char *host) {
-       ConfigItem_ulines *ulines;
-
-       if (!host)
-               return NULL;
+       if (!ce->ce_vardata) 
+       {
+               config_error("%s:%i: alias without name", 
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               errors++;
+       }
+       else if (!find_Command(ce->ce_vardata, 0, M_ALIAS) && find_Command(ce->ce_vardata, 0, 0)) {
+               config_status("%s:%i: %s is an existing command, can not add alias",
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+               errors++;
+       }
+       if (!config_find_entry(ce->ce_entries, "type"))
+       {
+               config_error("%s:%i: alias::type missing", ce->ce_fileptr->cf_filename,
+                       ce->ce_varlinenum);
+               errors++;
+       }
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!cep->ce_varname)
+               {
+                       config_error("%s:%i: blank alias item",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                       errors++; continue;
+               }
+               if (!cep->ce_vardata)
+               {
+                       config_error("%s:%i: alias::%s without parameter",
+                               cep->ce_fileptr->cf_filename,
+                               cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++; continue;
+               }
 
-       for(ulines = conf_ulines; ulines; ulines =(ConfigItem_ulines *) ulines->next) {
-               if (!stricmp(host, ulines->servername))
-                       return ulines;
+               if (!strcmp(cep->ce_varname, "format")) {
+                       if (!config_find_entry(cep->ce_entries, "type"))
+                       {
+                               config_error("%s:%i: alias::format::type missing", cep->ce_fileptr->cf_filename,
+                               cep->ce_varlinenum);
+                               errors++;
+                       }
+                       if (!config_find_entry(cep->ce_entries, "nick"))
+                       {
+                               config_error("%s:%i: alias::format::nick missing", cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum);
+                               errors++;
+                       }
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                               if (!cepp->ce_vardata)
+                               {
+                                       config_error("%s:%i: alias::format::%s without parameter",
+                                               cepp->ce_fileptr->cf_filename,
+                                               cepp->ce_varlinenum,
+                                               cepp->ce_varname);
+                                       errors++; continue;
+                               }
+                               if (!strcmp(cepp->ce_varname, "nick")) 
+                                       ;
+                               else if (!strcmp(cepp->ce_varname, "type"))
+                               {
+                                       if (!strcmp(cepp->ce_vardata, "services"))
+                                               ;
+                                       else if (!strcmp(cep->ce_vardata, "stats"))
+                                               ;
+                                       else if (!strcmp(cep->ce_vardata, "normal"))
+                                               ;
+                                       else {
+                                               config_status("%s:%i: unknown alias type",
+                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
+                                               errors++;
+                                       }
+                               }
+                               else if (!strcmp(cepp->ce_varname, "parameters")) 
+                                       ;
+                               else {
+                                       config_status("%s:%i: unknown directive alias::format::%s",
+                                               cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, cepp->ce_varname);
+                                       errors++;
+                               }
+                       }
+               }
+               else if (!strcmp(cep->ce_varname, "nick")) 
+                       ;
+               else if (!strcmp(cep->ce_varname, "type")) {
+                       if (!strcmp(cep->ce_vardata, "services"))
+                               ;
+                       else if (!strcmp(cep->ce_vardata, "stats"))
+                               ;
+                       else if (!strcmp(cep->ce_vardata, "normal"))
+                               ;
+                       else if (!strcmp(cep->ce_vardata, "command"))
+                               ;
+                       else {
+                               config_status("%s:%i: unknown alias type",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++;
+                       }
+               }
+               else {
+                       config_error("%s:%i: unknown directive alias::%s",
+                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                               cep->ce_varname);
+                       errors++;
+               }
        }
-       return NULL;
+       return errors; 
 }
 
-
-ConfigItem_except *Find_except(char *host, short type) {
-       ConfigItem_except *excepts;
-
-       if (!host)
-               return NULL;
-
-       for(excepts = conf_except; excepts; excepts =(ConfigItem_except *) excepts->next) {
-               if (excepts->flag.type == type)
-                       if (!match(excepts->mask, host))
-                               return excepts;
+int    _conf_deny(ConfigFile *conf, ConfigEntry *ce)
+{
+       if (!strcmp(ce->ce_vardata, "dcc"))
+               _conf_deny_dcc(conf, ce);
+       else if (!strcmp(ce->ce_vardata, "channel"))
+               _conf_deny_channel(conf, ce);
+       else if (!strcmp(ce->ce_vardata, "link"))
+               _conf_deny_link(conf, ce);
+       else if (!strcmp(ce->ce_vardata, "version"))
+               _conf_deny_version(conf, ce);
+       else
+       {
+               int value;
+               for (global_i = Hooks[HOOKTYPE_CONFIGRUN]; global_i;
+                    global_i = global_i->next)
+               {
+                       value = (*(global_i->func.intfunc))(conf,ce,CONFIG_DENY);
+                       if (value == 1)
+                               break;
+               }
+               return 0;
        }
-       return NULL;
+       return 0;
 }
 
-ConfigItem_tld *Find_tld(char *host) {
-       ConfigItem_tld *tld;
-
-       if (!host)
-               return NULL;
+int    _conf_deny_dcc(ConfigFile *conf, ConfigEntry *ce)
+{
+       ConfigItem_deny_dcc     *deny = NULL;
+       ConfigEntry             *cep;
 
-       for(tld = conf_tld; tld; tld = (ConfigItem_tld *) tld->next)
+       deny = MyMallocEx(sizeof(ConfigItem_deny_dcc));
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               if (!match(tld->mask, host))
-                       return tld;
+               if (!strcmp(cep->ce_varname, "filename"))
+               {
+                       ircstrdup(deny->filename, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "reason"))
+               {
+                       ircstrdup(deny->reason, cep->ce_vardata);
+               }
        }
-       return NULL;
+       AddListItem(deny, conf_deny_dcc);
+       return 0;
 }
 
-
-ConfigItem_link *Find_link(char *username,
-                          char *hostname,
-                          char *ip,
-                          char *servername)
+int    _conf_deny_channel(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigItem_link *link;
-
-       if (!username || !hostname || !servername || !ip)
-               return NULL;
+       ConfigItem_deny_channel         *deny = NULL;
+       ConfigEntry             *cep;
 
-       for(link = conf_link; link; link = (ConfigItem_link *) link->next)
+       deny = MyMallocEx(sizeof(ConfigItem_deny_channel));
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
        {
-               if (!match(link->servername, servername) &&
-                   !match(link->username, username) &&
-                   (!match(link->hostname, hostname) || !match(link->hostname, ip)))
-                       return link;
+               if (!strcmp(cep->ce_varname, "channel"))
+               {
+                       ircstrdup(deny->channel, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "reason"))
+               {
+                       ircstrdup(deny->reason, cep->ce_vardata);
+               }
        }
-       return NULL;
-
+       AddListItem(deny, conf_deny_channel);
+       return 0;
 }
-
-ConfigItem_ban         *Find_ban(char *host, short type)
+int    _conf_deny_link(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigItem_ban *ban;
-
-       /* Check for an except ONLY if we find a ban, makes it
-        * faster since most users will not have a ban so excepts
-        * don't need to be searched -- codemastr
-        */
+       ConfigItem_deny_link    *deny = NULL;
+       ConfigEntry             *cep;
 
-       for (ban = conf_ban; ban; ban = (ConfigItem_ban *) ban->next)
-               if (ban->flag.type == type)
-                       if (!match(ban->mask, host)) {
-                               /* Person got a exception */
-                               if (type == CONF_BAN_USER && Find_except(host, CONF_EXCEPT_BAN))
-                                       return NULL;
-                               return ban;
-                       }
-       return NULL;
+       deny = MyMallocEx(sizeof(ConfigItem_deny_link));
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!strcmp(cep->ce_varname, "mask"))
+               {
+                       ircstrdup(deny->mask, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "rule"))
+               {
+                       deny->rule = (char *)crule_parse(cep->ce_vardata);
+                       ircstrdup(deny->prettyrule, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "type")) {
+                       if (!strcmp(cep->ce_vardata, "all"))
+                               deny->flag.type = CRULE_ALL;
+                       else if (!strcmp(cep->ce_vardata, "auto"))
+                               deny->flag.type = CRULE_AUTO;
+               }
+       }
+       AddListItem(deny, conf_deny_link);
+       return 0;
 }
 
-ConfigItem_ban         *Find_banEx(char *host, short type, short type2)
+int    _conf_deny_version(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigItem_ban *ban;
-
-       /* Check for an except ONLY if we find a ban, makes it
-        * faster since most users will not have a ban so excepts
-        * don't need to be searched -- codemastr
-        */
-
-       for (ban = conf_ban; ban; ban = (ConfigItem_ban *) ban->next)
-               if ((ban->flag.type == type) && (ban->flag.type2 == type2))
-                       if (!match(ban->mask, host)) {
-                               /* Person got a exception */
-                               if (Find_except(host, type))
-                                       return NULL;
-                               return ban;
-                       }
-       return NULL;
-}
-
-aMotd *Find_file(char *file, short type) {
-       ConfigItem_tld *tlds;
+       ConfigItem_deny_version *deny = NULL;
+       ConfigEntry             *cep;
 
-       for (tlds = conf_tld; tlds; tlds = (ConfigItem_tld *)tlds->next) {
-               if (type == 0) {
-                       if (!strcmp(file, tlds->motd_file))
-                               return tlds->motd;
+       deny = MyMallocEx(sizeof(ConfigItem_deny_version));
+       for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+       {
+               if (!strcmp(cep->ce_varname, "mask"))
+               {
+                       ircstrdup(deny->mask, cep->ce_vardata);
                }
-               else {
-                       if (!strcmp(file, tlds->rules_file))
-                               return tlds->rules;
+               else if (!strcmp(cep->ce_varname, "version"))
+               {
+                       ircstrdup(deny->version, cep->ce_vardata);
+               }
+               else if (!strcmp(cep->ce_varname, "flags"))
+               {
+                       ircstrdup(deny->flags, cep->ce_vardata);
                }
        }
-       return NULL;
+       AddListItem(deny, conf_deny_version);
+       return 0;
 }
 
-
-int    AllowClient(aClient *cptr, struct hostent *hp, char *sockhost)
+int     _test_deny(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigItem_allow *aconf;
-       char *hname;
-       int  i, ii = 0;
-       static char uhost[HOSTLEN + USERLEN + 3];
-       static char fullname[HOSTLEN + 1];
-
-       for (aconf = conf_allow; aconf; aconf = (ConfigItem_allow *) aconf->next)
+       ConfigEntry *cep;
+       int         errors = 0;
+       if (!ce->ce_vardata)
        {
-               if (!aconf->hostname || !aconf->ip)
-                       goto attach;
-               if (hp)
-                       for (i = 0, hname = hp->h_name; hname;
-                           hname = hp->h_aliases[i++])
+               config_error("%s:%i: deny without type",        
+                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+               return 1;
+       }
+       if (!strcmp(ce->ce_vardata, "dcc"))
+       {
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               {
+                       if (!cep->ce_varname)
                        {
-                               (void)strncpy(fullname, hname,
-                                   sizeof(fullname) - 1);
-                               add_local_domain(fullname,
-                                   HOSTLEN - strlen(fullname));
-                               Debug((DEBUG_DNS, "a_il: %s->%s",
-                                   sockhost, fullname));
-                               if (index(aconf->hostname, '@'))
+                               config_error("%s:%i: blank deny item",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++; continue;
+                       }
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: deny::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+                       if (!strcmp(cep->ce_varname, "filename"))
+                       ;
+                       else if (!strcmp(cep->ce_varname, "reason"))
+                       ;
+                       else 
+                       {
+                               config_error("%s:%i: unknown directive deny::%s",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++;
+                       }
+               }
+               if (!(cep = config_find_entry(ce->ce_entries, "filename")))
+               {
+                       config_error("%s:%i: deny %s::filename missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
+               }
+               if (!(cep = config_find_entry(ce->ce_entries, "reason")))
+               {
+                       config_error("%s:%i: deny %s::reason missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
+               }
+       }
+       else if (!strcmp(ce->ce_vardata, "channel"))
+       {
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               {
+                       if (!cep->ce_varname)
+                       {
+                               config_error("%s:%i: blank deny item",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++; continue;
+                       }
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: deny::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+                       if (!strcmp(cep->ce_varname, "channel"))
+                       ;
+                       else if (!strcmp(cep->ce_varname, "reason"))
+                       ;
+                       else 
+                       {
+                               config_error("%s:%i: unknown directive deny::%s",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++;
+                       }
+               }
+               if (!(cep = config_find_entry(ce->ce_entries, "channel")))
+               {
+                       config_error("%s:%i: deny %s::channel missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
+               }
+               if (!(cep = config_find_entry(ce->ce_entries, "reason")))
+               {
+                       config_error("%s:%i: deny %s::reason missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
+               }
+       }
+       else if (!strcmp(ce->ce_vardata, "link"))
+       {
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
+               {
+                       if (!cep->ce_varname)
+                       {
+                               config_error("%s:%i: blank deny item",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++; continue;
+                       }
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: deny::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+                       if (!strcmp(cep->ce_varname, "mask"))
+                       ;
+                       else if (!strcmp(cep->ce_varname, "rule"))
+                       {
+                               int val = 0;
+                               if ((val = crule_test(cep->ce_vardata)))
                                {
-                                       /*
-                                        * Doing strlcpy / strlcat here
-                                        * would simply be a waste. We are
-                                        * ALREADY sure that it is proper 
-                                        * lengths
-                                       */
-                                       (void)strcpy(uhost, cptr->username);
-                                       (void)strcat(uhost, "@");
+                                       config_error("%s:%i: deny::%s contains an invalid expression: %s",
+                                               cep->ce_fileptr->cf_filename,
+                                               cep->ce_varlinenum,
+                                               cep->ce_varname, crule_errstring(val));
+                                       errors++;
+                               }
+                       }
+                       else if (!strcmp(cep->ce_varname, "type"))
+                       {
+                               if (!strcmp(cep->ce_vardata, "auto"))
+                               ;
+                               else if (!strcmp(cep->ce_vardata, "all"))
+                               ;
+                               else {
+                                       config_status("%s:%i: unknown deny link type",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                                       errors++;
                                }
-                               else
-                                       *uhost = '\0';
-                               /* 
-                                * Same here as above
-                                * -Stskeeps 
-                               */
-                               (void)strncat(uhost, fullname,
-                                   sizeof(uhost) - strlen(uhost));
-                               if (!match(aconf->hostname, uhost))
-                                       goto attach;
+                       }       
+                       else 
+                       {
+                               config_error("%s:%i: unknown directive deny::%s",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++;
                        }
-
-               if (index(aconf->ip, '@'))
+               }
+               if (!(cep = config_find_entry(ce->ce_entries, "mask")))
                {
-                       strncpyzt(uhost, cptr->username, sizeof(uhost));
-                       (void)strcat(uhost, "@");
+                       config_error("%s:%i: deny %s::mask missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
+               }       
+               if (!(cep = config_find_entry(ce->ce_entries, "rule")))
+               {
+                       config_error("%s:%i: deny %s::rule missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
                }
-               else
-                       *uhost = '\0';
-               (void)strncat(uhost, sockhost, sizeof(uhost) - strlen(uhost));
-               if (!match(aconf->ip, uhost))
-                       goto attach;
-               continue;
-             attach:
-/*             if (index(uhost, '@'))  now flag based -- codemastr */
-               if (!aconf->flags.noident)
-                       cptr->flags |= FLAGS_DOID;
-               if (!aconf->flags.useip && hp) 
-                       (void)strncpy(uhost, fullname, sizeof(uhost));
-               else
-                       (void)strncpy(uhost, sockhost, sizeof(uhost));
-               get_sockhost(cptr, uhost);
-               /* FIXME */
-               if (aconf->maxperip)
+               if (!(cep = config_find_entry(ce->ce_entries, "type")))
                {
-                       ii = 1;
-                       for (i = LastSlot; i >= 0; i--)
-                               if (local[i] && MyClient(local[i]) &&
-#ifndef INET6
-                                   local[i]->ip.S_ADDR == cptr->ip.S_ADDR)
-#else
-                                   !bcmp(local[i]->ip.S_ADDR, cptr->ip.S_ADDR, sizeof(cptr->ip.S_ADDR)))
-#endif
-                               {
-                                       ii++;
-                                       if (ii > aconf->maxperip)
-                                       {
-                                               exit_client(cptr, cptr, &me,
-                                                       "Too many connections from your IP");
-                                               return -5;      /* Already got one with that ip# */
-                                       }
-                               }
+                       config_error("%s:%i: deny %s::type missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
                }
-               if ((i = Auth_Check(cptr, aconf->auth, cptr->passwd)) == -1)
+       }
+       else if (!strcmp(ce->ce_vardata, "version"))
+       {
+               for (cep = ce->ce_entries; cep; cep = cep->ce_next)
                {
-                       exit_client(cptr, cptr, &me,
-                               "Password mismatch");
-                       return -5;
+                       if (!cep->ce_varname)
+                       {
+                               config_error("%s:%i: blank deny item",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+                               errors++; continue;
+                       }
+                       if (!cep->ce_vardata)
+                       {
+                               config_error("%s:%i: deny::%s without contents",
+                                       cep->ce_fileptr->cf_filename,
+                                       cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++; continue;
+                       }
+                       if (!strcmp(cep->ce_varname, "mask"))
+                       ;
+                       else if (!strcmp(cep->ce_varname, "version"))
+                       ;
+                       else if (!strcmp(cep->ce_varname, "flags"))
+                       ;
+                       else 
+                       {
+                               config_error("%s:%i: unknown directive deny::%s",
+                                       cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
+                                       cep->ce_varname);
+                               errors++;
+                       }
                }
-               if ((i == 2) && (cptr->passwd))
+               if (!(cep = config_find_entry(ce->ce_entries, "mask")))
                {
-                       MyFree(cptr->passwd);
-                       cptr->passwd = NULL;
+                       config_error("%s:%i: deny %s::mask missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
                }
-               if (!((aconf->class->clients + 1) > aconf->class->maxclients))
+               if (!(cep = config_find_entry(ce->ce_entries, "version")))
                {
-                       cptr->class = aconf->class;
-                       cptr->class->clients++;
+                       config_error("%s:%i: deny %s::version missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
                }
-               else
+               if (!(cep = config_find_entry(ce->ce_entries, "flags")))
                {
-                       sendto_one(cptr, rpl_str(RPL_REDIR), me.name, cptr->name, aconf->server ? aconf->server : defserv, aconf->port ? aconf->port : 6667);
-                       return -3;
+                       config_error("%s:%i: deny %s::flags missing",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
+                       errors++;
                }
-               return 0;
-       }
-       return -1;
-}
-
-ConfigItem_vhost *Find_vhost(char *name) {
-       ConfigItem_vhost *vhost;
-
-       for (vhost = conf_vhost; vhost; vhost = (ConfigItem_vhost *)vhost->next) {
-               if (!strcmp(name, vhost->login))
-                       return vhost;
-       }
-       return NULL;
-}
-
-
-ConfigItem_deny_channel *Find_channel_allowed(char *name)
-{
-       ConfigItem_deny_channel *dchannel;
-       ConfigItem_allow_channel *achannel;
-
-       for (dchannel = conf_deny_channel; dchannel; dchannel = (ConfigItem_deny_channel *)dchannel->next)
-       {
-               if (!match(dchannel->channel, name))
-                       break;
        }
-       if (dchannel)
+       else
        {
-               for (achannel = conf_allow_channel; achannel; achannel = (ConfigItem_allow_channel *)achannel->next)
+               int used = 0;
+               for (global_i = Hooks[HOOKTYPE_CONFIGTEST]; global_i; 
+                       global_i = global_i->next) 
                {
-                       if (!match(achannel->channel, name))
+                       int value, errs = 0;
+                       if (global_i->owner && !(global_i->owner->flags & MODFLAG_TESTING))
+                               continue;
+                       value = (*(global_i->func.intfunc))(conf,ce,CONFIG_DENY, &errs);
+                       if (value == 2)
+                               used = 1;
+                       if (value == 1)
+                       {
+                               used = 1;
+                               break;
+                       }
+                       if (value == -1)
+                       {
+                               used = 1;
+                               errors += errs;
                                break;
+                       }
+                       if (value == -2)
+                       {
+                               used = 1;
+                               errors += errs;
+                       }
                }
-               if (achannel)
-                       return NULL;
-               else
-                       return (dchannel);
+               if (!used) {
+                       config_error("%s:%i: unknown deny type %s",
+                               ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
+                               ce->ce_vardata);
+                       return 1;
+               }
+               return errors;
        }
-       return NULL;
+
+       return errors;  
 }
 
-void init_dynconf(void)
+
+int     rehash(aClient *cptr, aClient *sptr, int sig)
 {
-       bzero(&iConf, sizeof(iConf));
+       flush_connections(&me);
+       if (sig == 1)
+       {
+               sendto_ops("Got signal SIGHUP, reloading %s file", configfile);
+#ifdef ULTRIX
+               if (fork() > 0)
+                       exit(0);
+               write_pidfile();
+#endif
+       }
+       if (init_conf(configfile, 1) == 0)
+               run_configuration();
+       
+       return 1;
 }
 
-/* Report the unrealircd.conf info -codemastr*/
-void report_dynconf(aClient *sptr)
+void   link_cleanup(ConfigItem_link *link_ptr)
 {
-       sendto_one(sptr, ":%s %i %s :*** Dynamic Configuration Report ***",
-           me.name, RPL_TEXT, sptr->name);
-       sendto_one(sptr, ":%s %i %s :kline-address: %s", me.name, RPL_TEXT,
-           sptr->name, KLINE_ADDRESS);
-       sendto_one(sptr, ":%s %i %s :modes-on-connect: %s", me.name, RPL_TEXT,
-           sptr->name, get_modestr(CONN_MODES));
-       if (OPER_ONLY_STATS)
-               sendto_one(sptr, ":%s %i %s :oper-only-stats: %s", me.name, RPL_TEXT,
-                       sptr->name, OPER_ONLY_STATS);
-       sendto_one(sptr, ":%s %i %s :anti-spam-quit-message-time: %d", me.name, RPL_TEXT,
-               sptr->name, ANTI_SPAM_QUIT_MSG_TIME);
+       ircfree(link_ptr->servername);
+       ircfree(link_ptr->username);
+       ircfree(link_ptr->bindip);
+       ircfree(link_ptr->hostname);
+       ircfree(link_ptr->hubmask);
+       ircfree(link_ptr->leafmask);
+       ircfree(link_ptr->connpwd);
 #ifdef USE_SSL
-       sendto_one(sptr, ":%s %i %s :ssl::egd: %s", me.name, RPL_TEXT,
-               sptr->name, EGD_PATH ? EGD_PATH : (USE_EGD ? "1" : "0"));
-       sendto_one(sptr, ":%s %i %s :ssl::certificate: %s", me.name, RPL_TEXT,
-               sptr->name, SSL_SERVER_CERT_PEM);
-       sendto_one(sptr, ":%s %i %s :ssl::key: %s", me.name, RPL_TEXT,
-               sptr->name, SSL_SERVER_KEY_PEM);
+       ircfree(link_ptr->ciphers);
 #endif
-
-       sendto_one(sptr, ":%s %i %s :options::show-opermotd: %d", me.name, RPL_TEXT,
-           sptr->name, SHOWOPERMOTD);
-       sendto_one(sptr, ":%s %i %s :options::hide-ulines: %d", me.name, RPL_TEXT,
-           sptr->name, HIDE_ULINES);
-       sendto_one(sptr, ":%s %i %s :options::webtv-support: %d", me.name, RPL_TEXT,
-           sptr->name, WEBTV_SUPPORT);
-       sendto_one(sptr, ":%s %i %s :options::no-stealth: %d", me.name, RPL_TEXT,
-           sptr->name, NO_OPER_HIDING);
-       sendto_one(sptr, ":%s %i %s :options::identd-check: %d", me.name, RPL_TEXT,
-           sptr->name, IDENT_CHECK);
-       sendto_one(sptr, ":%s %i %s :options::fail-oper-warn: %d", me.name, RPL_TEXT,
-           sptr->name, FAILOPER_WARN);
-       sendto_one(sptr, ":%s %i %s :options::show-connect-info: %d", me.name, RPL_TEXT,
-           sptr->name, SHOWCONNECTINFO);
-       sendto_one(sptr, ":%s %i %s :maxchannelsperuser: %i", me.name, RPL_TEXT,
-           sptr->name, MAXCHANNELSPERUSER);
-       sendto_one(sptr, ":%s %i %s :auto-join: %s", me.name, RPL_TEXT,
-           sptr->name, AUTO_JOIN_CHANS ? AUTO_JOIN_CHANS : "0");
-       sendto_one(sptr, ":%s %i %s :oper-auto-join: %s", me.name,
-           RPL_TEXT, sptr->name, OPER_AUTO_JOIN_CHANS ? OPER_AUTO_JOIN_CHANS : "0");
-       sendto_one(sptr, ":%s %i %s :static-quit: %s", me.name, 
-               RPL_TEXT, sptr->name, STATIC_QUIT ? STATIC_QUIT : "<none>");    
-       sendto_one(sptr, ":%s %i %s :dns::timeout: %li", me.name, RPL_TEXT,
-           sptr->name, HOST_TIMEOUT);
-       sendto_one(sptr, ":%s %i %s :dns::retries: %d", me.name, RPL_TEXT,
-           sptr->name, HOST_RETRIES);
-       sendto_one(sptr, ":%s %i %s :dns::nameserver: %s", me.name, RPL_TEXT,
-           sptr->name, NAME_SERVER);
+       Auth_DeleteAuthStruct(link_ptr->recvauth);
+       link_ptr->recvauth = NULL;
 }
 
-/* Report the network file info -codemastr */
-void report_network(aClient *sptr)
+
+void   listen_cleanup()
 {
-       sendto_one(sptr, ":%s %i %s :*** Network Configuration Report ***",
-           me.name, RPL_TEXT, sptr->name);
-       sendto_one(sptr, ":%s %i %s :network-name: %s", me.name, RPL_TEXT,
-           sptr->name, ircnetwork);
-       sendto_one(sptr, ":%s %i %s :default-server: %s", me.name, RPL_TEXT,
-           sptr->name, defserv);
-       sendto_one(sptr, ":%s %i %s :services-server: %s", me.name, RPL_TEXT,
-           sptr->name, SERVICES_NAME);
-       sendto_one(sptr, ":%s %i %s :hosts::global: %s", me.name, RPL_TEXT,
-           sptr->name, oper_host);
-       sendto_one(sptr, ":%s %i %s :hosts::admin: %s", me.name, RPL_TEXT,
-           sptr->name, admin_host);
-       sendto_one(sptr, ":%s %i %s :hosts::local: %s", me.name, RPL_TEXT,
-           sptr->name, locop_host);
-       sendto_one(sptr, ":%s %i %s :hosts::servicesadmin: %s", me.name, RPL_TEXT,
-           sptr->name, sadmin_host);
-       sendto_one(sptr, ":%s %i %s :hosts::netadmin: %s", me.name, RPL_TEXT,
-           sptr->name, netadmin_host);
-       sendto_one(sptr, ":%s %i %s :hosts::coadmin: %s", me.name, RPL_TEXT,
-           sptr->name, coadmin_host);
-       sendto_one(sptr, ":%s %i %s :hiddenhost-prefix: %s", me.name, RPL_TEXT,
-           sptr->name, hidden_host);
-       sendto_one(sptr, ":%s %i %s :help-channel: %s", me.name, RPL_TEXT,
-           sptr->name, helpchan);
-       sendto_one(sptr, ":%s %i %s :stats-server: %s", me.name, RPL_TEXT,
-           sptr->name, STATS_SERVER);
-       sendto_one(sptr, ":%s %i %s :hosts::host-on-oper-up: %i", me.name, RPL_TEXT, sptr->name,
-           iNAH);
-       sendto_one(sptr, ":%s %i %s :cloak-keys: %X", me.name, RPL_TEXT, sptr->name,
-               CLOAK_KEYCRC);
+       int     i = 0;
+       ConfigItem_listen *listen_ptr;
+       ListStruct *next;
+       for (listen_ptr = conf_listen; listen_ptr; listen_ptr = (ConfigItem_listen *)next)
+       {
+               next = (ListStruct *)listen_ptr->next;
+               if (listen_ptr->flag.temporary && !listen_ptr->clients)
+               {
+                       ircfree(listen_ptr->ip);
+                       DelListItem(listen_ptr, conf_listen);
+                       MyFree(listen_ptr);
+                       i++;
+               }
+       }
+       if (i)
+               close_listeners();
 }
-
-
index 34a57d8ee3efc9f49f40fba4a36edd1e92b261ff..a8e9c6a1c623cdc39dc005e528702f26d88feb6b 100644 (file)
@@ -536,11 +536,10 @@ int m_tkl(aClient *cptr, aClient *sptr, int parc, char *parv[])
                  tkl_add_line(type, parv[3], parv[4], parv[8], parv[5],
                      expiry_1, setat_1);
 
-                 strncpy(gmt, asctime(gmtime((TS *)&setat_1)), sizeof(gmt));
-                 strncpy(gmt2, asctime(gmtime((TS *)&expiry_1)), sizeof(gmt2));
-                 gmt[strlen(gmt) - 1] = '\0';
-                 gmt2[strlen(gmt2) - 1] = '\0';
-
+                 strncpyzt(gmt, asctime(gmtime((TS *)&setat_1)), sizeof(gmt));
+                 strncpyzt(gmt2, asctime(gmtime((TS *)&expiry_1)), sizeof(gmt2));
+                 iCstrip(gmt);
+                 iCstrip(gmt2);
                  switch (type)
                  {
                    case TKL_KILL:
@@ -637,10 +636,10 @@ int m_tkl(aClient *cptr, aClient *sptr, int parc, char *parv[])
                                  if (!strcmp(tk->hostmask, parv[4])
                                      && !strcmp(tk->usermask, parv[3]))
                                  {
-                                         strncpy(gmt,
+                                         strncpyzt(gmt,
                                              asctime(gmtime((TS *)&tk->
                                              set_at)), sizeof(gmt));
-                                         gmt[strlen(gmt) - 1] = '\0';
+                                         iCstrip(gmt);
                                          sendto_snomask(SNO_TKL,
                                              "%s removed %s %s@%s (set at %s - reason: %s)",
                                              parv[5], txt, tk->usermask,
index f5cd69351cda6742a171ccd38b8f6f7779cf62f9..e8676d0d52bb4c4b9b794beec5b4e2c9da46db6b 100644 (file)
@@ -442,9 +442,15 @@ int  exit_client(aClient *cptr, aClient *sptr, aClient *from, char *comment)
                                MyFree(sptr->user->lopt);
                        }
                        on_for = TStime() - sptr->firsttime;
-                       ircd_log(LOG_CLIENT, "Disconnect - (%d:%d:%d) %s!%s@%s",
-                               on_for / 3600, (on_for % 3600) / 60, on_for % 60,
-                               sptr->name, sptr->user->username, sptr->user->realhost);
+                       if IsHidden(sptr)
+                               ircd_log(LOG_CLIENT, "Disconnect - (%d:%d:%d) %s!%s@%s [VHOST %s]",
+                                       on_for / 3600, (on_for % 3600) / 60, on_for % 60,
+                                       sptr->name, sptr->user->username,
+                                       sptr->user->realhost, sptr->user->virthost);
+                       else
+                               ircd_log(LOG_CLIENT, "Disconnect - (%d:%d:%d) %s!%s@%s",
+                                       on_for / 3600, (on_for % 3600) / 60, on_for % 60,
+                                       sptr->name, sptr->user->username, sptr->user->realhost);
                }
 
                if (sptr->fd >= 0 && !IsConnecting(sptr))
index 44b4fc2b4c062f9fa07a6b1f8824f8c860e8a4aa..29b34fe33a6ec6178639efa9879afc1c507ac0e2 100644 (file)
@@ -333,8 +333,7 @@ CMD_FUNC(m_protoctl)
        /* parv[parc - 1] */
        for (i = 1; i < parc; i++)
        {
-               strncpy(proto, parv[i], 127);
-               proto[127] = '\0';      /* Just to be safe... */
+               strncpyzt(proto, parv[i], sizeof proto);
                s = proto;
 #ifndef PROTOCTL_MADNESS
                if (*s == '-')
@@ -712,7 +711,7 @@ CMD_FUNC(m_server)
                                        get_client_name(cptr, TRUE));
                        return exit_client(cptr, cptr, &me, "Invalid numeric");
                }
-               (void)strncpy(info, parv[parc - 1], REALLEN + 60);
+               strncpyzt(info, parv[parc - 1], REALLEN + 61);
                strncpyzt(cptr->name, servername, sizeof(cptr->name));
                cptr->hopcount = hop;
                /* Add ban server stuff */
@@ -893,7 +892,7 @@ CMD_FUNC(m_server_remote)
                        servername);
                return exit_client(cptr, cptr, &me, "Invalid remote numeric");
        }
-       (void)strncpy(info, parv[parc - 1], REALLEN + 60);
+       strncpyzt(info, parv[parc - 1], REALLEN + 61);
        if (!cptr->serv->conf)
        {
                sendto_realops("Lost conf for %s!!, dropping link", cptr->name);
@@ -1461,6 +1460,8 @@ void m_info_send(aClient *sptr)
            me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| * Luke         <luke@unrealircd.com>",
            me.name, RPL_INFO, sptr->name);
+       sendto_one(sptr, ":%s %d %s :| * McSkaf       <mcskaf@unrealircd.com>",
+           me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| Coder team:", me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
@@ -1472,8 +1473,6 @@ void m_info_send(aClient *sptr)
            me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| * chasm     <chasm@unrealircd.org>",
            me.name, RPL_INFO, sptr->name);
-       sendto_one(sptr, ":%s %d %s :| * McSkaf    <mcskaf@unrealircd.org>",
-           me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| Previous versions:",
            me.name, RPL_INFO, sptr->name);
@@ -1915,6 +1914,8 @@ CMD_FUNC(m_stats)
        int  doall = 0, wilds = 0, showports = IsAnOper(sptr), remote = 0;
        char *name;
 
+       if (IsServer(sptr))
+               return 0;
        if (hunt_server_token(cptr, sptr, MSG_STATS, TOK_STATS, "%s :%s", 2, parc,
            parv) != HUNTED_ISME)
                return 0;
@@ -2666,12 +2667,13 @@ CMD_FUNC(m_help)
 
 /*
  * parv[0] = sender
- * parv[1] = host/server mask.
- * parv[2] = server to query
+ * parv[1] = server to query
  */
 CMD_FUNC(m_lusers)
 {
-
+       if (hunt_server_token(cptr, sptr, MSG_LUSERS, TOK_LUSERS, ":%s", 1, parc,
+           parv) != HUNTED_ISME)
+               return 0;
        /* Just to correct results ---Stskeeps */
        if (IRCstats.clients > IRCstats.global_max)
                IRCstats.global_max = IRCstats.clients;
@@ -3766,6 +3768,8 @@ CMD_FUNC(m_motd)
        int  svsnofile = 0;
        char userhost[HOSTLEN + USERLEN + 6];
 
+       if (IsServer(sptr))
+               return 0;
        if (hunt_server_token(cptr, sptr, MSG_MOTD, TOK_MOTD, ":%s", 1, parc, parv) !=
 HUNTED_ISME)
                return 0;
@@ -4058,6 +4062,9 @@ CMD_FUNC(m_rules)
        ConfigItem_tld *ptr;
        aMotd *temp;
        char userhost[USERLEN + HOSTLEN + 6];
+       if (IsServer(sptr))
+               return 0;
+               
        if (hunt_server_token(cptr, sptr, MSG_RULES, TOK_RULES, ":%s", 1, parc,
            parv) != HUNTED_ISME)
                return 0;
index db80bfc3a6ba66bbc8504744a32589ea7b65935c..58c217d140f22aa6e27518a9ae1a6053399c6944 100644 (file)
@@ -80,6 +80,9 @@ int oper_access[] = {
        OFLAG_WHOIS, 'W',
        OFLAG_HIDE, 'H',
        OFLAG_INVISIBLE, '^',
+       OFLAG_TKL, 't',
+       OFLAG_GZL, 'Z',
+       OFLAG_OVERRIDE, 'v',
        0, 0
 };
 
@@ -236,7 +239,8 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
 
        if (alias->type == ALIAS_SERVICES) {
                if (SERVICES_NAME && (acptr = find_person(alias->nick, NULL)))
-                       sendto_one(acptr, ":%s PRIVMSG %s@%s :%s", parv[0],
+                       sendto_one(acptr, ":%s %s %s@%s :%s", parv[0],
+                               IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE, 
                                alias->nick, SERVICES_NAME, parv[1]);
                else
                        sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name,
@@ -244,7 +248,8 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
        }
        else if (alias->type == ALIAS_STATS) {
                if (STATS_SERVER && (acptr = find_person(alias->nick, NULL)))
-                       sendto_one(acptr, ":%s PRIVMSG %s@%s :%s", parv[0],
+                       sendto_one(acptr, ":%s %s %s@%s :%s", parv[0],
+                               IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE, 
                                alias->nick, STATS_SERVER, parv[1]);
                else
                        sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name,
@@ -257,7 +262,8 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
                                        sptr->user->username, IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost,
                                        alias->nick, parv[1]);
                        else
-                               sendto_one(acptr, ":%s PRIVMSG %s :%s", parv[0],
+                               sendto_one(acptr, ":%s %s %s :%s", parv[0],
+                                       IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE, 
                                        alias->nick, parv[1]);
                }
                else
@@ -318,7 +324,7 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
                                xparv[0] = parv[0];
                                xparv[1] = output;
                                xparv[2] = NULL;
-                               m_alias(cptr, sptr, 2, xparv, format->alias->alias);
+                               m_alias(cptr, sptr, 2, xparv, format->nick);
                                regfree(&pcomp);
                                free(current);
                                break;
index 329394ae449028cf2d8d9193f7ea0eb4b78bf3ff..1a80e17575c02afeaf72691c23a77ed2fb5ba660 100644 (file)
@@ -417,6 +417,69 @@ int  hunt_server_token(aClient *cptr, aClient *sptr, char *command, char *token,
        return (HUNTED_NOSUCH);
 }
 
+int  hunt_server_token_quiet(aClient *cptr, aClient *sptr, char *command, char *token, char
+*params, int server, int parc, char *parv[])
+{
+       aClient *acptr;
+
+       /*
+          ** Assume it's me, if no server
+        */
+       if (parc <= server || BadPtr(parv[server]) ||
+           match(me.name, parv[server]) == 0 ||
+           match(parv[server], me.name) == 0)
+               return (HUNTED_ISME);
+       /*
+          ** These are to pickup matches that would cause the following
+          ** message to go in the wrong direction while doing quick fast
+          ** non-matching lookups.
+        */
+       if ((acptr = find_client(parv[server], NULL)))
+               if (acptr->from == sptr->from && !MyConnect(acptr))
+                       acptr = NULL;
+       if (!acptr && (acptr = find_server_quick(parv[server])))
+               if (acptr->from == sptr->from && !MyConnect(acptr))
+                       acptr = NULL;
+       if (!acptr)
+               for (acptr = client, (void)collapse(parv[server]);
+                   (acptr = next_client(acptr, parv[server]));
+                   acptr = acptr->next)
+               {
+                       if (acptr->from == sptr->from && !MyConnect(acptr))
+                               continue;
+                       /*
+                        * Fix to prevent looping in case the parameter for
+                        * some reason happens to match someone from the from
+                        * link --jto
+                        */
+                       if (IsRegistered(acptr) && (acptr != cptr))
+                               break;
+               }
+       if (acptr)
+       {
+               char buff[1024];
+               if (IsMe(acptr) || MyClient(acptr))
+                       return HUNTED_ISME;
+               if (match(acptr->name, parv[server]))
+                       parv[server] = acptr->name;
+               if (IsToken(acptr->from)) {
+                       sprintf(buff, ":%s %s ", parv[0], token);
+                       strcat(buff, params);
+                       sendto_one(acptr, buff, parv[1], parv[2], parv[3], parv[4], parv[5], parv[6], parv[7], parv[8]);
+               }
+               else {
+                       sprintf(buff, ":%s %s ", parv[0], command);
+                       strcat(buff, params);
+                       sendto_one(acptr, buff, parv[1], parv[2],
+                       parv[3], parv[4], parv[5], parv[6], parv[7], parv[8]);
+               }
+               return (HUNTED_PASS);
+       }
+       return (HUNTED_NOSUCH);
+}
+
+
+
 
 /*
 ** check_for_target_limit
@@ -759,13 +822,11 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam
                        char temp[USERLEN + 1];
                        strncpyzt(temp, username, USERLEN + 1);
                        if (IDENT_CHECK == 0) {
-                               strncpy(user->username, temp, USERLEN);
-                               user->username[USERLEN] = '\0';
+                               strncpyzt(user->username, temp, USERLEN + 1);
                        }
                        else {
                                *user->username = '~';
-                               (void)strncpy(&user->username[1], temp, USERLEN);
-                               user->username[USERLEN] = '\0';
+                               strncpyzt((user->username + 1), temp, USERLEN);
 #ifdef HOSTILENAME
                                noident = 1;
 #endif
@@ -874,7 +935,12 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam
        {
                IRCstats.unknown--;
                IRCstats.me_clients++;
-               ircd_log(LOG_CLIENT, "Connect - %s!%s@%s", nick, user->username, user->realhost);
+               if IsHidden(sptr)
+                       ircd_log(LOG_CLIENT, "Connect - %s!%s@%s [VHOST %s]", nick,
+                               user->username, user->realhost, user->virthost);
+               else
+                       ircd_log(LOG_CLIENT, "Connect - %s!%s@%s", nick, user->username,
+                               user->realhost);
                sendto_one(sptr, rpl_str(RPL_WELCOME), me.name, nick,
                    ircnetwork, nick, user->username, user->realhost);
                /* This is a duplicate of the NOTICE but see below... */
@@ -1291,7 +1357,7 @@ CMD_FUNC(m_nick)
           ** is concerned (user is changing the case of his/her
           ** nickname or somesuch)
         */
-       if (acptr == sptr)
+       if (acptr == sptr) {
                if (strcmp(acptr->name, nick) != 0)
                        /*
                           ** Allows change of case in his/her nick
@@ -1306,6 +1372,7 @@ CMD_FUNC(m_nick)
                           ** version would treat it as nick collision.
                         */
                        return 0;       /* NICK Message ignored */
+       }
        /*
           ** Note: From this point forward it can be assumed that
           ** acptr != sptr (point to different client structures).
@@ -1361,7 +1428,7 @@ CMD_FUNC(m_nick)
                }
                sendto_failops("Nick collision on %s (%s %d <- %s %d)",
                    acptr->name, acptr->from->name, acptr->lastnick,
-                   get_client_name(cptr, FALSE), lastnick);
+                   cptr->name, lastnick);
                /*
                   **    I'm putting the KILL handling here just to make it easier
                   ** to read, it's hard to follow it the way it used to be.
index 4319296804eb77e27573002f7803d39da258a1bd..001e4ff3fa77a21c0f4d68ae6fdde4c875b2d858 100644 (file)
@@ -53,6 +53,13 @@ static char sendbuf[2048];
 static char tcmd[1024];
 static char ccmd[1024];
 
+/* this array is used to ensure we send a msg only once to a remote 
+** server.  like, when we are sending a message to all channel members
+** send the message to those that are directly connected to us and once 
+** to each server that has these members.  the servers then forward the
+** message to other servers and to those channel members that are directly
+** connected to them
+*/
 static int sentalong[MAXCONNECTIONS];
 
 void vsendto_prefix_one(struct Client *to, struct Client *from,
@@ -297,13 +304,12 @@ void sendto_channel_butone(aClient *one, aClient *from, aChannel *chptr,
        for (lp = chptr->members; lp; lp = lp->next)
        {
                acptr = lp->cptr;
-               /* ...was the one I should skip */
-               if (acptr->from == one || (IsDeaf(acptr)
-                   && !(sendanyways == 1)))
+               /* skip the one and deaf clients (unless sendanyways is set) */
+               if (acptr->from == one || (IsDeaf(acptr) && !(sendanyways == 1)))
                        continue;
                if (MyConnect(acptr))   /* (It is always a client) */
                        vsendto_prefix_one(acptr, from, pattern, vl);
-               else if (sentalong[(i = acptr->from->fd)] != sentalong_marker)
+               else if (sentalong[(i = acptr->from->slot)] != sentalong_marker)
                {
                        sentalong[i] = sentalong_marker;
                        /*
@@ -325,24 +331,24 @@ void sendto_channelprefix_butone(aClient *one, aClient *from, aChannel *chptr,
        int  i;
 
        va_start(vl, pattern);
-       for (i = 0; i < MAXCONNECTIONS; i++)
-               sentalong[i] = 0;
+
+       ++sentalong_marker;
        for (lp = chptr->members; lp; lp = lp->next)
        {
                acptr = lp->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))
-                       goto good;
-               if ((prefix & 0x2) && (lp->flags & CHFL_VOICE))
+        if ((prefix & PREFIX_HALFOP) && (lp->flags & CHFL_HALFOP))
                        goto good;
-               if ((prefix & 0x4) && (lp->flags & CHFL_CHANOP))
+               if ((prefix & PREFIX_VOICE) && (lp->flags & CHFL_VOICE))
                        goto good;
-                       continue;
+               if ((prefix & PREFIX_OP) && (lp->flags & CHFL_CHANOP))
+                       goto good;
+               continue;
+               
                good:
-
-               i = acptr->from->fd;
+               i = acptr->from->slot;
                if (MyConnect(acptr) && IsRegisteredUser(acptr))
                {
 #ifdef SECURECHANMSGSONLYGOTOSECURE
@@ -351,22 +357,21 @@ void sendto_channelprefix_butone(aClient *one, aClient *from, aChannel *chptr,
                                        continue;
 #endif
                        vsendto_prefix_one(acptr, from, pattern, vl);
-                       sentalong[i] = 1;
+                       sentalong[i] = sentalong_marker;
                }
                else
                {
                        /* Now check whether a message has been sent to this
                         * remote link already */
-                       if (sentalong[i] == 0)
+                       if (sentalong[i] != sentalong_marker)
                        {
 #ifdef SECURECHANMSGSONLYGOTOSECURE
                                if (chptr->mode.mode & MODE_ONLYSECURE)
                                        if (!IsSecure(acptr->from))
                                                continue;
 #endif
-
                                vsendto_prefix_one(acptr, from, pattern, vl);
-                               sentalong[i] = 1;
+                               sentalong[i] = sentalong_marker;
                        }
                }
        }
@@ -384,51 +389,45 @@ void sendto_channelprefix_butone_tok(aClient *one, aClient *from, aChannel *chpt
 
        sprintf(tcmd, ":%s %s %s :%s", from->name, tok, nick, text);
        sprintf(ccmd, ":%s %s %s :%s", from->name, cmd, nick, text);
-       for (i = 0; i < MAXCONNECTIONS; i++)
-               sentalong[i] = 0;
+
+       ++sentalong_marker;
        for (lp = chptr->members; lp; lp = lp->next)
        {
                acptr = lp->cptr;
                if (acptr->from == one)
                        continue;       /* ...was the one I should skip
                                           or user not not a channel op */
-                if (prefix == 0)
-                       goto good;
-                if ((prefix & 0x1) && (lp->flags & CHFL_HALFOP))
-                       goto good;
-               if ((prefix & 0x2) && (lp->flags & CHFL_VOICE))
+        if (prefix == PREFIX_ALL)
+               goto good;
+        if ((prefix & PREFIX_HALFOP) && (lp->flags & CHFL_HALFOP))
                        goto good;
-               if ((prefix & 0x4) && (lp->flags & CHFL_CHANOP))
+               if ((prefix & PREFIX_VOICE) && (lp->flags & CHFL_VOICE))
                        goto good;
-                       continue;
+               if ((prefix & PREFIX_OP) && (lp->flags & CHFL_CHANOP))
+                       goto good;
+               continue;
+               
                good:
-
-               i = acptr->from->fd;
-
+               i = acptr->from->slot;
+               if (IsDeaf(acptr) && !sendanyways)
+                       continue;
                if (MyConnect(acptr) && IsRegisteredUser(acptr))
                {
-                       if (IsDeaf(acptr))
-                               if (!sendanyways)
-                                       continue;
                        sendto_prefix_one(acptr, from, ":%s %s %s :%s",
                                from->name, cmd, nick, text);
-                       sentalong[i] = 1;
+                       sentalong[i] = sentalong_marker;
                }
                else
                {
-                       if (IsDeaf(acptr))
-                               if (!sendanyways)
-                                       continue;
                        /* Now check whether a message has been sent to this
                         * remote link already */
-                       if (sentalong[i] == 0)
+                       if (sentalong[i] != sentalong_marker)
                        {
-
                                if (IsToken(acptr->from))
                                        sendto_one(acptr, "%s", tcmd);
                                else
                                        sendto_one(acptr, "%s", ccmd);
-                               sentalong[i] = 1;
+                               sentalong[i] = sentalong_marker;
                        }
                }
        }
@@ -458,148 +457,7 @@ void sendto_chanops_butone(aClient *one, aChannel *chptr, char *pattern, ...)
                        vsendto_one(acptr, pattern, vl);
                }
        }
-
-}
-
-/*
- * sendto_channelops_butone Added 1 Sep 1996 by Cabal95.
- *   Send a message to all OPs in channel chptr that
- *   are directly on this server and sends the message
- *   on to the next server if it has any OPs.
- *
- *   All servers must have this functional ability
- *    or one without will send back an error message. -- Cabal95
- */
-void sendto_channelops_butone(aClient *one, aClient *from, aChannel *chptr,
-    char *pattern, ...)
-{
-       va_list vl;
-       Member *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->cptr;
-               if (acptr->from == one || !(lp->flags & CHFL_CHANOP))
-                       continue;       /* ...was the one I should skip
-                                          or user not not a channel op */
-               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_channelvoice_butone
- * direct port of Cabal95's sendto_channelops_butone
- * to allow for /notice @+#channel messages
- * not exactly the most adventurous coding (made heavy use of copy-paste) <G>
- * but it's needed to avoid mass-msg trigger in script vnotices
- * -DuffJ
- */
-
-void sendto_channelvoice_butone(aClient *one, aClient *from, aChannel *chptr,
-    char *pattern, ...)
-{
-       va_list vl;
-       Member *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->cptr;
-               if (acptr->from == one || !(lp->flags & CHFL_VOICE))
-                       continue;       /* ...was the one I should skip
-                                          or user not (a channel voice or op) */
-               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_channelhalfop_butone
- * direct port of Cabal95's sendto_channelops_butone
- * to allow for /notice @+#channel messages
- * not exactly the most adventurous coding (made heavy use of copy-paste) <G>
- * but it's needed to avoid mass-msg trigger in script hnotices
- * -Stskeeps
- */
-
-void sendto_channelhalfop_butone(aClient *one, aClient *from, aChannel *chptr,
-    char *pattern, ...)
-{
-       va_list vl;
-       Member *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->cptr;
-               if (acptr->from == one || !(lp->flags & CHFL_HALFOP))
-                       continue;       /* ...was the one I should skip
-                                          or user not (a channel halfop or op) */
-               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;
 }
 
 /*
@@ -1050,7 +908,7 @@ void sendto_serv_nickv2_token(aClient *one, char *pattern, char *tokpattern,
 /*
  * sendto_common_channels()
  *
- * Sends a message to all people (inclusing user) on local server who are
+ * Sends a message to all people (including user) on local server who are
  * in same channel with user.
  */
 void sendto_common_channels(aClient *user, char *pattern, ...)
@@ -1062,19 +920,18 @@ void sendto_common_channels(aClient *user, char *pattern, ...)
        aClient *cptr;
 
        va_start(vl, pattern);
-       memset((char *)sentalong, '\0', sizeof(sentalong));
+
+       ++sentalong_marker;
        if (user->fd >= 0)
-               sentalong[user->fd] = 1;
+               sentalong[user->slot] = sentalong_marker;
        if (user->user)
-               for (channels = user->user->channel; channels;
-                   channels = channels->next)
-                       for (users = channels->chptr->members; users;
-                           users = users->next)
+               for (channels = user->user->channel; channels; channels = channels->next)
+                       for (users = channels->chptr->members; users; users = users->next)
                        {
                                cptr = users->cptr;
-                               if (!MyConnect(cptr) || sentalong[cptr->fd])
+                               if (!MyConnect(cptr) || sentalong[cptr->slot] == sentalong_marker)
                                        continue;
-                               sentalong[cptr->fd]++;
+                               sentalong[cptr->slot] = sentalong_marker;
                                vsendto_prefix_one(cptr, user, pattern, vl);
                        }
        if (MyConnect(user))
@@ -1455,18 +1312,18 @@ void sendto_ops_butone(aClient *one, aClient *from, char *pattern, ...)
        aClient *cptr;
 
        va_start(vl, pattern);
-       for (i = 0; i <= LastSlot; i++)
-               sentalong[i] = 0;
+
+       ++sentalong_marker;
        for (cptr = client; cptr; cptr = cptr->next)
        {
                if (!SendWallops(cptr))
                        continue;
                i = cptr->from->slot;   /* find connection oper is on */
-               if (sentalong[i])       /* sent message along it already ? */
+               if (sentalong[i] == sentalong_marker)   /* sent message along it already ? */
                        continue;
                if (cptr->from == one)
                        continue;       /* ...was the one I should skip */
-               sentalong[i] = 1;
+               sentalong[i] = sentalong_marker;
                vsendto_prefix_one(cptr->from, from, pattern, vl);
        }
        va_end(vl);
@@ -1487,18 +1344,18 @@ void sendto_opers_butone(aClient *one, aClient *from, char *pattern, ...)
        aClient *cptr;
 
        va_start(vl, pattern);
-       for (i = 0; i <= LastSlot; i++)
-               sentalong[i] = 0;
+
+       ++sentalong_marker;
        for (cptr = client; cptr; cptr = cptr->next)
        {
                if (!IsAnOper(cptr))
                        continue;
                i = cptr->from->slot;   /* find connection oper is on */
-               if (sentalong[i])       /* sent message along it already ? */
+               if (sentalong[i] == sentalong_marker)   /* sent message along it already ? */
                        continue;
                if (cptr->from == one)
                        continue;       /* ...was the one I should skip */
-               sentalong[i] = 1;
+               sentalong[i] = sentalong_marker;
                vsendto_prefix_one(cptr->from, from, pattern, vl);
        }
        va_end(vl);
@@ -1516,18 +1373,18 @@ void sendto_ops_butme(aClient *from, char *pattern, ...)
        aClient *cptr;
 
        va_start(vl, pattern);
-       for (i = 0; i <= LastSlot; i++)
-               sentalong[i] = 0;
+
+       ++sentalong_marker;
        for (cptr = client; cptr; cptr = cptr->next)
        {
                if (!SendWallops(cptr))
                        continue;
                i = cptr->from->slot;   /* find connection oper is on */
-               if (sentalong[i])       /* sent message along it already ? */
+               if (sentalong[i] == sentalong_marker)   /* sent message along it already ? */
                        continue;
                if (!strcmp(cptr->user->server, me.name))       /* a locop */
                        continue;
-               sentalong[i] = 1;
+               sentalong[i] = sentalong_marker;
                vsendto_prefix_one(cptr->from, from, pattern, vl);
        }
        va_end(vl);
@@ -1780,20 +1637,20 @@ void sendto_channels_inviso_join(aClient *user)
                Member *users;
         aClient *cptr;
 
-        memset((char *)sentalong, '\0', sizeof(sentalong));
-        if (user->fd >= 0)
-                sentalong[user->fd] = 1;
+               ++sentalong_marker;
+               if (user->fd >= 0)
+                       sentalong[user->slot] = sentalong_marker;
         if (user->user)
-                for (channels = user->user->channel; channels; channels = channels->next)
-                        for (users = channels->chptr->members; users; users = users->next)
-                       {
-                                cptr = users->cptr;
-                                if (!MyConnect(cptr) || IsNetAdmin(cptr) || sentalong[cptr->fd] || cptr == user)
-                                        continue;
-                                sentalong[cptr->fd]++;
-                                sendto_one(cptr, ":%s!%s@%s JOIN :%s", user->name, user->user->username,
-                               (IsHidden(user) ? user->user->virthost : user->user->realhost), channels->chptr->chname);
-                       }
+                       for (channels = user->user->channel; channels; channels = channels->next)
+                               for (users = channels->chptr->members; users; users = users->next)
+                               {
+                                       cptr = users->cptr;
+                    if (!MyConnect(cptr) || IsNetAdmin(cptr) || sentalong[cptr->slot] == sentalong_marker || cptr == user)
+                                               continue;
+                    sentalong[cptr->slot] = sentalong_marker;
+                    sendto_one(cptr, ":%s!%s@%s JOIN :%s", user->name, user->user->username,
+                              (IsHidden(user) ? user->user->virthost : user->user->realhost), channels->chptr->chname);
+                               }
        return;
 }
 
@@ -1803,42 +1660,42 @@ void sendto_channels_inviso_part(aClient *user)
         Member *users;
         aClient *cptr;
 
-        memset((char *)sentalong, '\0', sizeof(sentalong));
-        if (user->fd >= 0)
-                sentalong[user->fd] = 1;
+               ++sentalong_marker;
+               if (user->fd >= 0)
+                       sentalong[user->slot] = sentalong_marker;
         if (user->user)
-                for (channels = user->user->channel; channels; channels = channels->next)
-                        for (users = channels->chptr->members; users; users = users->next)
-                       {
-                                cptr = users->cptr;
-                                if (!MyConnect(cptr) || IsNetAdmin(cptr) || sentalong[cptr->fd] || cptr == user)
-                                        continue;
-                                sentalong[cptr->fd]++;
-                               sendto_one(cptr, ":%s!%s@%s PART :%s", user->name, user->user->username, (IsHidden(user) ? user->user->virthost : user->user->realhost), channels->chptr->chname);
-                       }
+                       for (channels = user->user->channel; channels; channels = channels->next)
+                               for (users = channels->chptr->members; users; users = users->next)
+                               {
+                                       cptr = users->cptr;
+                    if (!MyConnect(cptr) || IsNetAdmin(cptr) || sentalong[cptr->slot] == sentalong_marker || cptr == user)
+                                               continue;
+                    sentalong[cptr->slot] = sentalong_marker;
+                       sendto_one(cptr, ":%s!%s@%s PART :%s", user->name, user->user->username, (IsHidden(user) ? user->user->virthost : user->user->realhost), channels->chptr->chname);
+                               }
        return;
 }
 
 void sendto_channel_ntadmins(aClient *from, aChannel *chptr, char *pattern, ...)
 {
-        va_list vl;
-        Member *lp;
-        aClient *acptr;
-        int  i;
-
-        va_start(vl, pattern);
-        ++sentalong_marker;
-        for (lp = chptr->members; lp; lp = lp->next)
+       va_list vl;
+    Member *lp;
+    aClient *acptr;
+    int  i;
+
+    va_start(vl, pattern);
+    ++sentalong_marker;
+    for (lp = chptr->members; lp; lp = lp->next)
        {
-                acptr = lp->cptr;
-                if (acptr->from == from || !IsNetAdmin(acptr) || (IsDeaf(acptr) && !(sendanyways == 1)))
-                        continue;
-                if (MyConnect(acptr))   /* (It is always a client) */
-                        vsendto_prefix_one(acptr, from, pattern, vl);
-                else if (sentalong[(i = acptr->from->fd)] != sentalong_marker)
+               acptr = lp->cptr;
+        if (acptr->from == from || !IsNetAdmin(acptr) || (IsDeaf(acptr) && !(sendanyways == 1)))
+                       continue;
+        if (MyConnect(acptr))   /* (It is always a client) */
+                       vsendto_prefix_one(acptr, from, pattern, vl);
+        else if (sentalong[(i = acptr->from->slot)] != sentalong_marker)
                {
-                        sentalong[i] = sentalong_marker;
-                        vsendto_prefix_one(acptr, from, pattern, vl);
+                       sentalong[i] = sentalong_marker;
+            vsendto_prefix_one(acptr, from, pattern, vl);
                }
        }
        va_end(vl);
index f03815fcc295a3451c3a845152750bf7b54ac3b4..76e2725cef6b0ebdc6db187f6e2f9d331d31656d 100644 (file)
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -23,6 +23,7 @@
 #include "common.h"
 #include "struct.h"
 #include "h.h"
+#include "proto.h"
 #include "sys.h"
 #ifdef _WIN32
 #include <windows.h>
@@ -48,9 +49,9 @@ typedef struct {
        char **buffer;
 } StreamIO;
 
-static StreamIO *streamp;
 #define CHK_SSL(err) if ((err)==-1) { ERR_print_errors_fp(stderr); }
 #ifdef _WIN32
+static StreamIO *streamp;
 LRESULT SSLPassDLG(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam) {
        StreamIO *stream;
        switch (Message) {
@@ -76,6 +77,40 @@ LRESULT SSLPassDLG(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam) {
        }
 }
 #endif                         
+
+char *ssl_error_str(int err)
+{
+     char *ssl_errstr = NULL;
+     switch(err) {
+       case SSL_ERROR_NONE:
+           ssl_errstr = "SSL: No error";
+           break;
+       case SSL_ERROR_SSL:
+           ssl_errstr = "Internal OpenSSL error or protocol error";
+           break;
+       case SSL_ERROR_WANT_READ:
+           ssl_errstr = "OpenSSL functions requested a read()";
+           break;
+       case SSL_ERROR_WANT_WRITE:
+           ssl_errstr = "OpenSSL functions requested a write()";
+           break;
+       case SSL_ERROR_WANT_X509_LOOKUP:
+           ssl_errstr = "OpenSSL requested a X509 lookup which didn`t arrive";
+           break;
+       case SSL_ERROR_SYSCALL:
+           ssl_errstr = "Underlying syscall error";
+           break;
+       case SSL_ERROR_ZERO_RETURN:
+           ssl_errstr = "Underlying socket operation returned zero";
+           break;
+       case SSL_ERROR_WANT_CONNECT:
+           ssl_errstr = "OpenSSL functions wanted a connect()";
+           break;
+       default:
+           ssl_errstr = "Unknown OpenSSL error (huh?)";
+     }
+     return (ssl_errstr);
+}
                                
                                
 int  ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *password)
@@ -90,8 +125,7 @@ int  ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *password)
 #endif
        if (before)
        {
-               strncpy(buf, (char *)beforebuf, size);
-               buf[size - 1] = '\0';
+               strncpyzt(buf, (char *)beforebuf, size);
                return (strlen(buf));
        }
 #ifndef _WIN32
@@ -105,16 +139,36 @@ int  ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *password)
 #endif
        if (pass)
        {
-               strncpy(buf, (char *)pass, size);
-               strncpy(beforebuf, (char *)pass, sizeof(beforebuf));
-               beforebuf[sizeof(beforebuf) - 1] = '\0';
-               buf[size - 1] = '\0';
+               strncpyzt(buf, (char *)pass, size);
+               strncpyzt(beforebuf, (char *)pass, sizeof(beforebuf));
                before = 1;
                return (strlen(buf));
        }
        return 0;
 }
 
+static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
+{
+       int verify_err = 0;
+
+       verify_err = X509_STORE_CTX_get_error(ctx);
+       ircd_log(LOG_ERROR, "%i", verify_err);  
+       if (preverify_ok)
+               return 1;
+       if (iConf.ssl_options & SSLFLAG_VERIFYCERT)
+       {
+               if (verify_err == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT)
+                       if (!(iConf.ssl_options & SSLFLAG_DONOTACCEPTSELFSIGNED))
+                       {
+                               return 1;
+                       }
+               return preverify_ok;
+       }
+       else
+               return 1;
+}
+
+
 void init_ctx_server(void)
 {
        ctx_server = SSL_CTX_new(SSLv23_server_method());
@@ -125,6 +179,9 @@ void init_ctx_server(void)
        }
        SSL_CTX_set_default_passwd_cb(ctx_server, ssl_pem_passwd_cb);
        SSL_CTX_set_options(ctx_server, SSL_OP_NO_SSLv2);
+       SSL_CTX_set_verify(ctx_server, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE
+                       | (iConf.ssl_options & SSLFLAG_FAILIFNOCERT ? SSL_VERIFY_FAIL_IF_NO_PEER_CERT : 0), ssl_verify_callback);
+
        if (SSL_CTX_use_certificate_file(ctx_server, SSL_SERVER_CERT_PEM, SSL_FILETYPE_PEM) <= 0)
        {
                ircd_log(LOG_ERROR, "Failed to load SSL certificate %s", SSL_SERVER_CERT_PEM);
@@ -141,8 +198,17 @@ void init_ctx_server(void)
                ircd_log(LOG_ERROR, "Failed to check SSL private key");
                exit(5);
        }
+       if (iConf.trusted_ca_file)
+       {
+               if (!SSL_CTX_load_verify_locations(ctx_server, iConf.trusted_ca_file, NULL))
+               {
+                       ircd_log(LOG_ERROR, "Failed to load Trusted CA's from %s", iConf.trusted_ca_file);
+                       exit(6);
+               }
+       }
 }
 
+
 void init_ctx_client(void)
 {
        ctx_client = SSL_CTX_new(SSLv3_client_method());
@@ -199,8 +265,9 @@ void init_ssl(void)
 
 int  ssl_handshake(aClient *cptr)
 {
+#ifdef NO_CERTCHECKING
        char *str;
-       int  err;
+#endif
 
        cptr->ssl = SSL_new(ctx_server);
        CHK_NULL(cptr->ssl);
@@ -220,44 +287,6 @@ int  ssl_handshake(aClient *cptr)
                cptr->ssl = NULL;
                return -1;
        }
-
-       /* Get client's certificate (note: beware of dynamic
-        * allocation) - opt */
-        /* We do not do this -Stskeeps */
-
-#ifdef NO_CERTCHECKING
-       cptr->client_cert =
-           (struct X509 *)SSL_get_peer_certificate((SSL *) cptr->ssl);
-
-       if (cptr->client_cert != NULL)
-       {
-               // log (L_DEBUG,"Client certificate:\n");
-
-               str =
-                   X509_NAME_oneline(X509_get_subject_name((X509 *) cptr->
-                   client_cert), 0, 0);
-               CHK_NULL(str);
-               // log (L_DEBUG, "\t subject: %s\n", str);
-               free(str);
-
-               str =
-                   X509_NAME_oneline(X509_get_issuer_name((X509 *) cptr->
-                   client_cert), 0, 0);
-               CHK_NULL(str);
-               // log (L_DEBUG, "\t issuer: %s\n", str);
-               free(str);
-
-               /* We could do all sorts of certificate
-                * verification stuff here before
-                *        deallocating the certificate. */
-
-               X509_free((X509 *) cptr->client_cert);
-       }
-       else
-       {
-               // log (L_DEBUG, "Client does not have certificate.\n");
-       }
-#endif
        return 0;
 
 }
@@ -401,16 +430,16 @@ int ircd_SSL_write(aClient *acptr, const void *buf, int sz)
                if(ERRNO == EAGAIN)
                    return -1;
            default:
+               Debug((DEBUG_ERROR, "ircd_SSL_write: returning fatal_ssl_error for %s", acptr->name));
                return fatal_ssl_error(ssl_err, SAFE_SSL_WRITE, acptr);
        }
     }
+    Debug((DEBUG_ERROR, "ircd_SSL_write for %s (%p, %i): success", acptr->name, buf, sz));
     return len;
 }
 
 int ircd_SSL_client_handshake(aClient *acptr)
 {
-       int ssl_err;
-       
        acptr->ssl = SSL_new(ctx_client);
        if (!acptr->ssl)
        {
@@ -438,9 +467,11 @@ int ircd_SSL_client_handshake(aClient *acptr)
                case -1: 
                        return -1;
                case 0: 
+                       Debug((DEBUG_DEBUG, "SetSSLConnectHandshake(%s)", get_client_name(acptr, TRUE)));
                        SetSSLConnectHandshake(acptr);
                        return 0;
                case 1: 
+                       Debug((DEBUG_DEBUG, "SSL_init_finished should finish this job (%s)", get_client_name(acptr, TRUE)));
                        /* SSL_init_finished in s_bsd will finish the job */
                        return 1;
                default:
@@ -460,6 +491,7 @@ int ircd_SSL_accept(aClient *acptr, int fd) {
                        || ERRNO == P_EAGAIN)
            case SSL_ERROR_WANT_READ:
            case SSL_ERROR_WANT_WRITE:
+                   Debug((DEBUG_DEBUG, "ircd_SSL_accept(%s), - %s", get_client_name(acptr, TRUE), ssl_error_str(ssl_err)));
                    /* handshake will be completed later . . */
                    return 1;
            default:
@@ -482,8 +514,11 @@ int ircd_SSL_connect(aClient *acptr) {
                        || ERRNO == P_EAGAIN)
            case SSL_ERROR_WANT_READ:
            case SSL_ERROR_WANT_WRITE:
+                {
+                   Debug((DEBUG_DEBUG, "ircd_SSL_connect(%s), - %s", get_client_name(acptr, TRUE), ssl_error_str(ssl_err)));
                    /* handshake will be completed later . . */
                    return 0;
+                }
            default:
                return fatal_ssl_error(ssl_err, SAFE_SSL_CONNECT, acptr);
                
@@ -510,7 +545,6 @@ static int fatal_ssl_error(int ssl_error, int where, aClient *sptr)
 {
     /* don`t alter ERRNO */
     int errtmp = ERRNO;
-    char *errstr = (char *)strerror(errtmp);
     char *ssl_errstr, *ssl_func;
 
     switch(where) {
index 5c4c0eb3954c4f8ef619b2946320aa8a718494bc..ed8f6d0fb8e5a76faca87384d5f7355fb6b87381 100644 (file)
@@ -1671,3 +1671,12 @@ int b64_decode(char const *src, unsigned char *target, size_t targsize)
 
        return (tarindex);
 }
+
+void   *MyMallocEx(size_t size)
+{
+       void *p = MyMalloc(size);
+
+       bzero(p, size);
+       return (p);
+}
+
index 9bc4fc33c966ea8b4427548e24dfd49ddafc1d3a..69c7d1d26cfa8e783dfc7d7cfe14d2db1db2a217 100644 (file)
@@ -107,8 +107,8 @@ char *unrealcredits[] =
 "value your donations. ",
 "",
 "Stskeeps would primarily like to thank Julie for her",
-"support through the years. See the page for a more extensive",
-"list of all the coders' credits.",
+"support through the years.  See the page for a more extensive",
+"list of all the coders' credits. ",
 "",
 "This IRCd is dedicated to those who have kept us rocking and", 
 "in good mood all through the years we've struggled with this"
index d88091d14d2a57027b3130508dbf68d8938cc3bf..6da1cad0b36d8e753226d70a1f96f497c0a48717 100644 (file)
@@ -73,18 +73,18 @@ LRESULT CALLBACK HelpDLG(HWND, UINT, WPARAM, LPARAM);
 LRESULT CALLBACK StatusDLG(HWND, UINT, WPARAM, LPARAM);
 LRESULT CALLBACK ConfigErrorDLG(HWND, UINT, WPARAM, LPARAM);
 LRESULT CALLBACK ColorDLG(HWND, UINT, WPARAM, LPARAM);
-LRESULT CALLBACK FromVarDLG(HWND, UINT, WPARAM, LPARAM, char *, char **);
+LRESULT CALLBACK FromVarDLG(HWND, UINT, WPARAM, LPARAM, unsigned char *, unsigned char **);
 LRESULT CALLBACK FromFileReadDLG(HWND, UINT, WPARAM, LPARAM);
 LRESULT CALLBACK FromFileDLG(HWND, UINT, WPARAM, LPARAM);
 
 typedef struct {
        int *size;
-       char **buffer;
+       unsigned char **buffer;
 } StreamIO;
 
 extern  void      SocketLoop(void *dummy);
-int CountRTFSize(char *);
-void IRCToRTF(char *, char *);
+int CountRTFSize(unsigned char *);
+void IRCToRTF(unsigned char *, unsigned char *);
 HINSTANCE hInst;
 NOTIFYICONDATA SysTray;
 void CleanUp(void);
@@ -92,7 +92,7 @@ HTREEITEM AddItemToTree(HWND, LPSTR, int, short);
 void win_map(aClient *, HWND, short);
 extern Link *Servers;
 extern ircstats IRCstats;
-char *errors = NULL, *RTFBuf = NULL;
+unsigned char *errors = NULL, *RTFBuf = NULL;
 extern aMotd *botmotd, *opermotd, *motd, *rules;
 extern VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv);
 extern BOOL IsService;
@@ -143,7 +143,7 @@ LRESULT RESubClassFunc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam) {
        POINT p;
        RECT r;
        DWORD start, end;
-       char string[500];
+       unsigned char string[500];
 
        if (Message == WM_GETDLGCODE)
           return DLGC_WANTALLKEYS;
@@ -191,11 +191,11 @@ LRESULT RESubClassFunc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam) {
  */
 typedef struct colorlist {
        struct colorlist *prev,*next;
-       char *color;
+       unsigned char *color;
 } ColorList;
 
 ColorList *TextColors = NULL;
-void AddColor(char *color) {
+void AddColor(unsigned char *color) {
        ColorList *clist;
 
        clist = MyMallocEx(sizeof(ColorList));
@@ -248,7 +248,7 @@ DWORD CALLBACK SplitIt(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) {
 }
 
 DWORD CALLBACK BufferIt(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) {
-       char *buf2;
+       unsigned char *buf2;
        static long size = 0;
        if (!RTFBuf)
                size = 0;
@@ -270,12 +270,12 @@ DWORD CALLBACK BufferIt(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) {
        return 0;
 }
 
-DWORD CALLBACK RTFToIRC(int fd, char *pbBuff, long cb) {
-       char *buffer = (char *)malloc(cb);
+DWORD CALLBACK RTFToIRC(int fd, unsigned char *pbBuff, long cb) {
+       unsigned char *buffer = malloc(cb);
        int i = 0, j = 0, k = 0, start = 0, end = 0;
        int incolor = 0, bold = 0, uline = 0;
-       char cmd[15], value[500], color[25], colorbuf[4];
-       char colors[16];
+       unsigned char cmd[15], value[500], color[25], colorbuf[4];
+       unsigned char colors[16];
        pbBuff++;
        TextColors = NULL;
        bzero(buffer, cb);
@@ -301,7 +301,16 @@ DWORD CALLBACK RTFToIRC(int fd, char *pbBuff, long cb) {
                                i++;
                                continue;
                        }
-
+                       if (*pbBuff == '\'') {
+                               unsigned char ltr, ultr[3];
+                               ultr[0] = *++pbBuff;
+                               ultr[1] = *++pbBuff;
+                               ultr[2] = 0;
+                               ltr = strtoul(ultr,NULL,16);
+                               buffer[i] = ltr;
+                               i++;
+                               continue;
+                       }
                        value[0] = cmd[0] = 0;
                        for (j = k = start = end = 0;
                                *pbBuff && *pbBuff != '\\' && *pbBuff != '\r' && *pbBuff != '\n';
@@ -432,7 +441,7 @@ DWORD CALLBACK RTFToIRC(int fd, char *pbBuff, long cb) {
                                        DelNewestColor();
                                }
                                else if (!strncmp(cmd, "cf", 2)) {
-                                       char number[3];
+                                       unsigned char number[3];
                                        int num = 0;
                                        incolor = 1;
                                        strcpy(number, &cmd[2]);
@@ -460,7 +469,7 @@ DWORD CALLBACK RTFToIRC(int fd, char *pbBuff, long cb) {
 int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
 {
        MSG msg;
-       char *s;
+       unsigned char *s;
        HWND hWnd;
        WSADATA WSAData;
        HICON hIcon;
@@ -559,9 +568,9 @@ LRESULT CALLBACK MainDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 static HCURSOR hCursor;
 static HMENU hRehash, hAbout, hConfig, hTray, hLogs;
 
-       char *argv[3];
+       unsigned char *argv[3];
        aClient *paClient;
-       char *msg;
+       unsigned char *msg;
        POINT p;
 
        if (message == WM_TASKBARCREATED){
@@ -761,7 +770,7 @@ static HMENU hRehash, hAbout, hConfig, hTray, hLogs;
                        }
                        case WM_COMMAND: {
                                if (LOWORD(wParam) >= 60000 && HIWORD(wParam) == 0 && !lParam) {
-                                       char path[MAX_PATH];
+                                       unsigned char path[MAX_PATH];
                                        if (GetMenuString(hLogs, LOWORD(wParam), path, MAX_PATH, MF_BYCOMMAND))
                                                DialogBoxParam(hInst, "FromVar", hDlg,
 (DLGPROC)FromFileReadDLG, (LPARAM)path);
@@ -896,14 +905,14 @@ LRESULT CALLBACK DalDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
        return FromVarDLG(hDlg, message, wParam, lParam, "UnrealIRCd DALnet Credits", dalinfotext);
 }
 
-LRESULT CALLBACK FromVarDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam, char
-*title, char **s) {
+LRESULT CALLBACK FromVarDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam,
+unsigned char *title, unsigned char **s) {
        HWND hWnd;
        switch (message) {
                case WM_INITDIALOG: {
-                       char    String[16384];
+                       unsigned char   String[16384];
                        int size;
-                       char *RTFString;
+                       unsigned char *RTFString;
                        StreamIO *stream = malloc(sizeof(StreamIO));
                        EDITSTREAM edit;
                        SetWindowText(hDlg, title);
@@ -978,24 +987,24 @@ LRESULT CALLBACK FromFileReadDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM
        switch (message) {
                case WM_INITDIALOG: {
                        int fd,len;
-                       char *buffer = '\0', *string = '\0';
+                       unsigned char *buffer = '\0', *string = '\0';
                        EDITSTREAM edit;
                        StreamIO *stream = malloc(sizeof(StreamIO));
-                       char szText[256];
+                       unsigned char szText[256];
                        struct stat sb;
                        HWND hWnd = GetDlgItem(hDlg, IDC_TEXT), hTip;
-                       wsprintf(szText, "UnrealIRCd Viewer - %s", (char *)lParam);
+                       wsprintf(szText, "UnrealIRCd Viewer - %s", (unsigned char *)lParam);
                        SetWindowText(hDlg, szText);
                        lpfnOldWndProc = (FARPROC)SetWindowLong(hWnd, GWL_WNDPROC, (DWORD)RESubClassFunc);
-                       if ((fd = open((char *)lParam, _O_RDONLY|_O_BINARY)) != -1) {
+                       if ((fd = open((unsigned char *)lParam, _O_RDONLY|_O_BINARY)) != -1) {
                                fstat(fd,&sb);
                                /* Only allocate the amount we need */
-                               buffer = (char *)malloc(sb.st_size+1);
+                               buffer = malloc(sb.st_size+1);
                                buffer[0] = 0;
                                len = read(fd, buffer, sb.st_size);
                                buffer[len] = 0;
                                len = CountRTFSize(buffer)+1;
-                               string = (char *)malloc(len);
+                               string = malloc(len);
                                bzero(string,len);
                                IRCToRTF(buffer,string);
                                RTFBuf = string;
@@ -1071,7 +1080,7 @@ LRESULT CALLBACK HelpDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
                case WM_DRAWITEM: {
                        LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
-                       char text[500];
+                       unsigned char text[500];
                        COLORREF oldtext;
                        RECT focus;
                        GetWindowText(lpdis->hwndItem, text, 500);
@@ -1191,19 +1200,19 @@ LRESULT CALLBACK GotoDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
        HWND hWnd;
        static FINDREPLACE find;
-       static char *file;
+       static unsigned char *file;
        static HWND hTool, hClip, hStatus;
        CHARFORMAT2 chars;
        switch (message) {
                case WM_INITDIALOG: {
                        int fd,len;
-                       char *buffer = '\0', *string = '\0';
+                       unsigned char *buffer = '\0', *string = '\0';
                        EDITSTREAM edit;
                        StreamIO *stream = malloc(sizeof(StreamIO));
-                       char szText[256];
+                       unsigned char szText[256];
                        struct stat sb;
                        HWND hWnd = GetDlgItem(hDlg, IDC_TEXT), hTip;
-                       file = (char *)lParam;
+                       file = (unsigned char *)lParam;
                        if (file)
                                wsprintf(szText, "UnrealIRCd Editor - %s", file);
                        else 
@@ -1220,12 +1229,12 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar
                        if ((fd = open(file, _O_RDONLY|_O_BINARY)) != -1) {
                                fstat(fd,&sb);
                                /* Only allocate the amount we need */
-                               buffer = (char *)malloc(sb.st_size+1);
+                               buffer = malloc(sb.st_size+1);
                                buffer[0] = 0;
                                len = read(fd, buffer, sb.st_size);
                                buffer[len] = 0;
                                len = CountRTFSize(buffer)+1;
-                               string = (char *)malloc(len);
+                               string = malloc(len);
                                bzero(string,len);
                                IRCToRTF(buffer,string);
                                RTFBuf = string;
@@ -1260,7 +1269,7 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar
                                HWND hWnd = GetDlgItem(hDlg, IDC_TEXT);
                                DWORD start, end, currline;
                                static DWORD prevline = 0;
-                               char buffer[512];
+                               unsigned char buffer[512];
                                chars.cbSize = sizeof(CHARFORMAT2);
                                SendMessage(hWnd, EM_GETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)&chars);
                                if (chars.dwMask & CFM_BOLD && chars.dwEffects & CFE_BOLD)
@@ -1418,7 +1427,7 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar
                        EDITSTREAM edit;
                        OPENFILENAME lpopen;
                        if (!file) {
-                               char path[MAX_PATH];
+                               unsigned char path[MAX_PATH];
                                path[0] = '\0';
                                bzero(&lpopen, sizeof(OPENFILENAME));
                                lpopen.lStructSize = sizeof(OPENFILENAME);
@@ -1450,7 +1459,7 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar
                        return 0;
                }
                if (LOWORD(wParam) == IDM_NEW) {
-                       char text[1024];
+                       unsigned char text[1024];
                        BOOL newfile = FALSE;
                        int ans;
                        if (SendMessage(GetDlgItem(hDlg, IDC_TEXT), EM_GETMODIFY, 0, 0) != 0) {
@@ -1468,7 +1477,7 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar
                        else
                                newfile = TRUE;
                        if (newfile == TRUE) {
-                               char szText[256];
+                               unsigned char szText[256];
                                file = NULL;
                                strcpy(szText, "UnrealIRCd Editor - New File");
                                SetWindowText(hDlg, szText);
@@ -1503,7 +1512,7 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar
                        SendMessage(hClip, WM_DRAWCLIPBOARD, wParam, lParam);
                        break;
                case WM_CLOSE: {
-                       char text[256];
+                       unsigned char text[256];
                        int ans;
                        if (SendMessage(GetDlgItem(hDlg, IDC_TEXT), EM_GETMODIFY, 0, 0) != 0) {
                                sprintf(text, "The text in the %s file has changed.\r\n\r\nDo you want to save the changes?", file ? file : "new");
@@ -1728,10 +1737,10 @@ LRESULT CALLBACK ColorDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
 
 /* find how big a buffer expansion we need for RTF transformation */
-int CountRTFSize(char *buffer) {
+int CountRTFSize(unsigned char *buffer) {
        int size = 0;
        short bold = 0, uline = 0, reverse = 0;
-       char *buf = buffer;
+       unsigned char *buf = buffer;
 
        for (; *buf; buf++, size++) {
                if (*buf == '{' || *buf == '}' || *buf == '\\') {
@@ -1751,7 +1760,7 @@ int CountRTFSize(char *buffer) {
                        bold = ~bold;
                }
                if (*buf == '\3') {
-                       char color[3];
+                       unsigned char color[3];
                        int number;
                        size += 3;
                        if (!isdigit(*(buf+1)))
@@ -1790,8 +1799,8 @@ int CountRTFSize(char *buffer) {
        return (size+494);
 }
 
-void IRCToRTF(char *buffer, char *string) {
-       char *tmp = buffer;
+void IRCToRTF(unsigned char *buffer, unsigned char *string) {
+       unsigned char *tmp = buffer;
        int i = 0;
        short bold = 0, uline = 0;
        sprintf(string, "{\\rtf1\\ansi\\ansicpg1252\\deff0{\\fonttbl{\\f0\\fmodern\\fprq1\\"
@@ -1836,7 +1845,7 @@ void IRCToRTF(char *buffer, char *string) {
                        continue;
                }
                if (*tmp == '\3') {
-                       char color[3];
+                       unsigned char color[3];
                        int number;
                        strcat(string, "\\cf");
                        i += 3;
@@ -1955,10 +1964,10 @@ void win_map(aClient *server, HWND hwTreeView, short remap)
 }
 
 /* ugly stuff, but hey it works -- codemastr */
-void win_log(char *format, ...) {
+void win_log(unsigned char *format, ...) {
         va_list ap;
-        char buf[2048];
-               char *buf2;
+        unsigned char buf[2048];
+               unsigned char *buf2;
         va_start(ap, format);
         ircvsprintf(buf, format, ap);
        if (!IsService) {
index bf76e27e94ae928f4840412414cdee6b628760c0..928ad2e9112085fee81fa08d976b984b6bcd2751 100644 (file)
@@ -198,6 +198,7 @@ LONG __stdcall ExceptionFilter(EXCEPTION_POINTERS *e) {
        sprintf(text, "UnrealIRCd has encountered a fatal error. Debugging information has"
                " been dumped to wircd.%d.core, please email this file to coders@lists.unrealircd.org.",
                getpid());
+       fclose(fd);
        if (!IsService)
                MessageBox(NULL, text, "Fatal Error", MB_OK);
        else {
@@ -207,7 +208,6 @@ LONG __stdcall ExceptionFilter(EXCEPTION_POINTERS *e) {
                fclose(fd);
        }
        CleanUp();
-       fclose(fd);
        return EXCEPTION_EXECUTE_HANDLER;
 }
 
@@ -215,7 +215,4 @@ void InitDebug(void) {
        SetUnhandledExceptionFilter(&ExceptionFilter);
 }
 
-void Crash() {
-       int o = 0;
-       o = 1/o;
-}
+
index df1818cb991de6bb999ea54b33426ef9b0774f97..a75db6dd04e23aab57a50bce86f558c42313f92b 100644 (file)
@@ -21,7 +21,8 @@
 #include <string.h>
 #include <stdio.h>
 static         OSVERSIONINFO VerInfo;
-
+HMODULE hAdvapi;
+BOOL (*uChangeServiceConfig2)();
 #define IRCD_SERVICE_CONTROL_REHASH 128
 void show_usage() {
        fprintf(stderr, "unreal start|stop|rehash|restart|install|uninstall|config <option> <value>");
@@ -44,7 +45,9 @@ int main(int argc, char *argv[]) {
        if (argc < 2) {
                show_usage();
                return -1;
-               }
+       }
+       hAdvapi = LoadLibrary("advapi32.dll");
+       (FARPROC)uChangeServiceConfig2 = GetProcAddress(hAdvapi, "ChangeServiceConfig2A");
        if (!stricmp(argv[1], "install")) {
                SC_HANDLE hService, hSCManager;
                char path[MAX_PATH+1];
@@ -71,7 +74,7 @@ int main(int argc, char *argv[]) {
                if (VerInfo.dwMajorVersion == 5) {
                        SERVICE_DESCRIPTION info;
                        info.lpDescription = "Internet Relay Chat Server. Allows users to chat with eachother via an IRC client.";
-                       ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &info);
+                       uChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &info);
                }
                CloseServiceHandle(hService);
                CloseServiceHandle(hSCManager);
@@ -155,7 +158,7 @@ int main(int argc, char *argv[]) {
                                hAction.Type = SC_ACTION_RESTART;
                                hAction.Delay = atoi(argv[3])*60000;
                                hFailActions.lpsaActions = &hAction;
-                               if (ChangeServiceConfig2(hService, SERVICE_CONFIG_FAILURE_ACTIONS,      
+                               if (uChangeServiceConfig2(hService, SERVICE_CONFIG_FAILURE_ACTIONS,     
                                                     &hFailActions))
                                        printf("UnrealIRCd NT Service configuration changed");
                                else
@@ -166,7 +169,7 @@ int main(int argc, char *argv[]) {
                                hFailActions.cActions = 0;
                                hAction.Type = SC_ACTION_NONE;
                                hFailActions.lpsaActions = &hAction;
-                               if (ChangeServiceConfig2(hService, SERVICE_CONFIG_FAILURE_ACTIONS,
+                               if (uChangeServiceConfig2(hService, SERVICE_CONFIG_FAILURE_ACTIONS,
                                                     &hFailActions)) 
                                        printf("UnrealIRCd NT Service configuration changed");
                                else
index c3e7b7be41ff613f3fafcb4daf4cb8a34c4ad8c4..d9ef2cffdf2f025b83689fbc7a9a434f68d4c8e9 100644 (file)
@@ -1,17 +1,26 @@
 ; UnrealIRCd Win32 Installation Script for My Inno Setup Extensions
+; Requires ISX 3.0.4 to work
+
+; #define USE_SSL
+; Uncomment the above line to package an SSL build
+
 
 [Setup]
 AppName=UnrealIRCd
-AppVerName=UnrealIRCd3.2-beta12
+AppVerName=UnrealIRCd3.2-beta13
 AppPublisher=UnrealIRCd Team
 AppPublisherURL=http://www.unrealircd.com
 AppSupportURL=http://www.unrealircd.com
 AppUpdatesURL=http://www.unrealircd.com
-AppMutex=UnrealMutex
+AppMutex=UnrealMutex,Global\UnrealMutex
 DefaultDirName={pf}\Unreal3.2
 DefaultGroupName=UnrealIRCd
 AllowNoIcons=yes
+#ifndef USE_SSL
 LicenseFile=.\gpl.rtf
+#else
+LicenseFile=.\gplplusssl.rtf
+#endif
 Compression=bzip/9
 MinVersion=4.0.1111,4.0.1381
 OutputDir=../../
@@ -19,7 +28,14 @@ OutputDir=../../
 [Tasks]
 Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"
 Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: unchecked
-Name: "installservice"; Description: "Install &Service"; GroupDescription: "Service support:"; MinVersion: 0,4.0
+Name: "installservice"; Description: "Install as a &service"; GroupDescription: "Service support:"; MinVersion: 0,4.0
+Name: "installservice/startboot"; Description: "S&tart UnrealIRCd when Windows starts"; GroupDescription: "Service support:"; MinVersion: 0,4.0; Flags: exclusive
+Name: "installservice/startdemand"; Description: "Start UnrealIRCd on &request"; GroupDescription: "Service support:"; MinVersion: 0,4.0; Flags: exclusive
+Name: "installservice/crashrestart"; Description: "Restart UnrealIRCd if it &crashes"; GroupDescription: "Service support:"; MinVersion: 0,5.0;
+#ifdef USE_SSL
+Name: "makecert"; Description: "&Create certificate"; GroupDescription: "SSL options:";
+Name: "enccert"; Description: "&Encrypt certificate"; GroupDescription: "SSL options:";
+#endif
 
 [Files]
 Source: "..\..\wircd.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite
@@ -30,9 +46,9 @@ Source: "..\..\.RELEASE.NOTES"; DestDir: "{app}"; DestName: "RELEASE.NOTES.txt";
 Source: "..\..\.SICI"; DestDir: "{app}"; DestName: "SICI.txt"; CopyMode: alwaysoverwrite
 Source: "..\..\badwords.channel.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
 Source: "..\..\badwords.message.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\Changes"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\Changes.old"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\Donation"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\Changes"; DestDir: "{app}"; DestName: "Changes.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\Changes.old"; DestDir: "{app}"; DestName: "Changes.old.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\Donation"; DestDir: "{app}"; DestName: "Donation.txt"; CopyMode: alwaysoverwrite
 Source: ".\gnu_regex.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
 Source: "..\..\help.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
 Source: "..\..\LICENSE"; DestDir: "{app}"; DestName: "LICENSE.txt"; CopyMode: alwaysoverwrite
@@ -41,6 +57,14 @@ Source: "..\..\doc\*.*"; DestDir: "{app}\doc"; CopyMode: alwaysoverwrite
 Source: "..\..\aliases\*"; DestDir: "{app}\aliases"; CopyMode: alwaysoverwrite
 Source: "..\..\networks\*"; DestDir: "{app}\networks"; CopyMode: alwaysoverwrite
 Source: "..\..\unreal.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite; MinVersion: 0,4.0
+#ifdef USE_SSL
+Source: "c:\openssl\bin\openssl.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "c:\openssl\bin\ssleay32.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "c:\openssl\bin\libeay32.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: ".\makecert.bat"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: ".\encpem.bat"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\ssl.cnf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+#endif
 Source: isxdl.dll; DestDir: {tmp}; CopyMode: dontcopy
 
 [UninstallDelete]
@@ -52,7 +76,6 @@ external 'isxdl_Download@files:isxdl.dll stdcall';
 function isxdl_SetOption(Option, Value: PChar): Integer;
 external 'isxdl_SetOption@files:isxdl.dll stdcall';
 const url = 'http://www.unrealircd.com/downloads/DbgHelp.Dll';
-
 function NextButtonClick(CurPage: Integer): Boolean;
 var
 dbghelp,tmp,output: String;
@@ -79,6 +102,7 @@ begin
   end;
   Result := true;
 end;
+
 procedure DeInitializeSetup();
 var
 input,output: String;
@@ -91,6 +115,10 @@ end;
 [Icons]
 Name: "{group}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"
 Name: "{group}\Uninstall UnrealIRCd"; Filename: "{uninstallexe}"; WorkingDir: "{app}"
+#ifdef USE_SSL
+Name: "{group}\Make Certificate"; Filename: "{app}\makecert.bat"; WorkingDir: "{app}"
+Name: "{group}\Encrypt Certificate"; Filename: "{app}\encpem.bat"; WorkingDir: "{app}"
+#endif
 Name: "{group}\Documentation"; Filename: "{app}\doc\unreal32docs.html"; WorkingDir: "{app}"
 Name: "{userdesktop}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: desktopicon
 Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: quicklaunchicon
@@ -99,8 +127,15 @@ Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\UnrealIRCd"; Filen
 Filename: "notepad"; Description: "View example.conf"; Parameters: "{app}\doc\example.conf"; Flags: postinstall skipifsilent shellexec runmaximized
 Filename: "{app}\doc\unreal32docs.html"; Description: "View UnrealIRCd documentation"; Parameters: ""; Flags: postinstall skipifsilent shellexec runmaximized
 Filename: "notepad"; Description: "View Release Notes"; Parameters: "{app}\RELEASE.NOTES.txt"; Flags: postinstall skipifsilent shellexec runmaximized
-Filename: "notepad"; Description: "View Changes"; Parameters: "{app}\Changes"; Flags: postinstall skipifsilent shellexec runmaximized
+Filename: "notepad"; Description: "View Changes"; Parameters: "{app}\Changes.txt"; Flags: postinstall skipifsilent shellexec runmaximized
 Filename: "{app}\unreal.exe"; Parameters: "install"; Flags: runminimized nowait; Tasks: installservice
+Filename: "{app}\unreal.exe"; Parameters: "config startup manual"; Flags: runminimized nowait; Tasks: installservice/startdemand
+Filename: "{app}\unreal.exe"; Parameters: "config startup auto"; Flags: runminimized nowait; Tasks: installservice/startboot
+Filename: "{app}\unreal.exe"; Parameters: "config crashrestart 2"; Flags: runminimized nowait; Tasks: installservice/crashrestart
+#ifdef USE_SSL
+Filename: "{app}\makecert.bat"; Tasks: makecert
+Filename: "{app}\encpem.bat"; WorkingDir: "{app}"; Tasks: enccert
+#endif
 
 [UninstallRun]
 Filename: "{app}\unreal.exe"; Parameters: "uninstall"; Flags: runminimized; RunOnceID: "DelService"; Tasks: installservice
diff --git a/src/win32/unrealinstssl.iss b/src/win32/unrealinstssl.iss
deleted file mode 100644 (file)
index 20092cd..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-; UnrealIRCd Win32 Installation Script for My Inno Setup Extensions
-
-[Setup]
-AppName=UnrealIRCd
-AppVerName=UnrealIRCd3.2-beta12
-AppPublisher=UnrealIRCd Team
-AppPublisherURL=http://www.unrealircd.com
-AppSupportURL=http://www.unrealircd.com
-AppUpdatesURL=http://www.unrealircd.com
-AppMutex=UnrealMutex
-DefaultDirName={pf}\Unreal3.2
-DefaultGroupName=UnrealIRCd
-AllowNoIcons=yes
-LicenseFile=.\gplplusssl.rtf
-Compression=bzip/9
-MinVersion=4.0.1111,4.0.1381
-OutputDir=../../
-
-[Tasks]
-Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"
-Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: unchecked
-Name: "installservice"; Description: "Install &Service"; GroupDescription: "Service support:"; MinVersion: 0,4.0
-Name: "makecert"; Description: "Create &Certificate"; GroupDescription: "SSL options:";
-
-[Files]
-Source: "..\..\wircd.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\WIRCD.pdb"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\.CHANGES.NEW"; DestDir: "{app}"; DestName: "CHANGES.NEW.txt"; CopyMode: alwaysoverwrite
-Source: "..\..\.CONFIG.RANT"; DestDir: "{app}"; DestName: "CONFIG.RANT.txt"; CopyMode: alwaysoverwrite
-Source: "..\..\.RELEASE.NOTES"; DestDir: "{app}"; DestName: "RELEASE.NOTES.txt"; CopyMode: alwaysoverwrite
-Source: "..\..\.SICI"; DestDir: "{app}"; DestName: "SICI.txt"; CopyMode: alwaysoverwrite
-Source: "..\..\badwords.channel.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\badwords.message.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\Changes"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\Changes.old"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\Donation"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: ".\gnu_regex.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\help.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\LICENSE"; DestDir: "{app}"; DestName: "LICENSE.txt"; CopyMode: alwaysoverwrite
-Source: "..\..\Unreal.nfo"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\..\doc\*.*"; DestDir: "{app}\doc"; CopyMode: alwaysoverwrite
-Source: "..\..\aliases\*"; DestDir: "{app}\aliases"; CopyMode: alwaysoverwrite
-Source: "..\..\networks\*"; DestDir: "{app}\networks"; CopyMode: alwaysoverwrite
-Source: "..\..\unreal.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite; MinVersion: 0,4.0
-Source: "c:\openssl\bin\openssl.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "c:\openssl\bin\ssleay32.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "c:\openssl\bin\libeay32.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: ".\makecert.bat"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: ".\encpem.bat"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: "..\ssl.cnf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
-Source: isxdl.dll; DestDir: {tmp}; CopyMode: dontcopy
-
-[UninstallDelete]
-Type: files; Name: "{app}\DbgHelp.Dll"
-
-[Code]
-function isxdl_Download(hWnd: Integer; URL, Filename: PChar): Integer;
-external 'isxdl_Download@files:isxdl.dll stdcall';
-function isxdl_SetOption(Option, Value: PChar): Integer;
-external 'isxdl_SetOption@files:isxdl.dll stdcall';
-const url = 'http://www.unrealircd.com/downloads/DbgHelp.Dll';
-
-function NextButtonClick(CurPage: Integer): Boolean;
-var
-dbghelp,tmp,output: String;
-m: String;
-hWnd,answer: Integer;
-begin
-  dbghelp := ExpandConstant('{sys}\DbgHelp.Dll');
-  output := ExpandConstant('{app}\DbgHelp.Dll');
-  GetVersionNumbersString(dbghelp,m);
-  if ((CurPage = wpReady) AND NOT FileExists(output)) then begin
-    if (NOT FileExists(dbghelp)) then
-      m := StringOfChar('0',1);
-    if (StrToInt(m[1]) < 5) then begin
-     answer := MsgBox('DbgHelp.dll version 5.0 or higher is required to install Unreal, do you wish to install it now?', mbConfirmation, MB_YESNO);
-     if answer = IDYES then begin
-      tmp := ExpandConstant('{tmp}\dbghelp.dll');
-      isxdl_SetOption('title', 'Downloading DbgHelp.dll');
-      hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
-      if isxdl_Download(hWnd, url, tmp) = 0 then
-         MsgBox('Download and installation of DbgHelp.Dll failed, the file must be manually installed. The file can be downloaded at http://www.unrealircd.com/downloads/DbgHelp.Dll', mbInformation, MB_OK);
-     end else
-       MsgBox('In order for Unreal to properly function you must manually install this dll. The dll can be downloaded from http://www.unrealircd.com/downloads/DbgHelp.Dll', mbInformation, MB_OK);
-    end;
-  end;
-  Result := true;
-end;
-procedure DeInitializeSetup();
-var
-input,output: String;
-begin
-  input := ExpandConstant('{tmp}\dbghelp.dll');
-  output := ExpandConstant('{app}\dbghelp.dll');
-  FileCopy(input, output, true);
-end;
-
-[Icons]
-Name: "{group}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"
-Name: "{group}\Uninstall UnrealIRCd"; Filename: "{uninstallexe}"; WorkingDir: "{app}"
-Name: "{group}\Makecert"; Filename: "{app}\makecert.bat"; WorkingDir: "{app}"
-Name: "{group}\Encpem"; Filename: "{app}\encpem.bat"; WorkingDir: "{app}"
-Name: "{group}\Documentation"; Filename: "{app}\doc\unreal32docs.html"; WorkingDir: "{app}"
-Name: "{userdesktop}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: desktopicon
-Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: quicklaunchicon
-
-[Run]
-Filename: "notepad"; Description: "View example.conf"; Parameters: "{app}\doc\example.conf"; Flags: postinstall skipifsilent shellexec runmaximized
-Filename: "{app}\doc\unreal32docs.html"; Description: "View UnrealIRCd documentation"; Parameters: ""; Flags: postinstall skipifsilent shellexec runmaximized
-Filename: "notepad"; Description: "View Release Notes"; Parameters: "{app}\RELEASE.NOTES.txt"; Flags: postinstall skipifsilent shellexec runmaximized
-Filename: "notepad"; Description: "View Changes"; Parameters: "{app}\Changes"; Flags: postinstall skipifsilent shellexec runmaximized
-Filename: "{app}\unreal.exe"; Parameters: "install"; Flags: runminimized nowait; Tasks: installservice
-Filename: "{app}\makecert.bat"; Tasks: makecert
-
-[UninstallRun]
-Filename: "{app}\unreal.exe"; Parameters: "uninstall"; Flags: runminimized; RunOnceID: "DelService"; Tasks: installservice