Author: Andres Miller <a1kmm@mware.virtualave.net>
authorPerry Lorier <isomer@undernet.org>
Tue, 2 Apr 2002 00:26:47 +0000 (00:26 +0000)
committerPerry Lorier <isomer@undernet.org>
Tue, 2 Apr 2002 00:26:47 +0000 (00:26 +0000)
Log message:

New Config file

Author: Bert Faes <bert.faes@pandora.be>

made /trace reply always show the username

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@693 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

16 files changed:
ChangeLog
doc/example.conf
include/class.h
include/motd.h
include/patchlevel.h
include/s_conf.h
ircd/Makefile.in
ircd/channel.c
ircd/class.c
ircd/ircd.c
ircd/m_trace.c
ircd/motd.c
ircd/s_bsd.c
ircd/s_conf.c
ircd/s_err.c
ircd/s_misc.c

index 7455819c21d2a0251d523a0a88c7b69765ce4566..eb38813b9c7a7bee884c1f9ab9fd037b611c8b44 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-04-02 Andrew Miller <a1kmm@mware.virtualave.net>
+       * ircd/ircd_parser.y: Added ircd parser, lexer, to replace the
+          old configuration file format.
+       * ircd/ircd_lexer.l
+       * ircd/s_conf.c
+       * doc/example.conf
+
+2002-03-23 Bert Faes <bert.faes@pandora.be>
+
+       * s_misc.c made /trace reply always show the username
+       
 2002-03-28  Kevin L Mitchell  <klmitch@mit.edu>
 
        * configure.in: use AC_CHECK_FUNCS to define HAVE_* macros; test
index 8e2075e99690460347931204a80151f8381daa2a..d40de5d2bb06b45e63c2d1e04cc95d33a63e9265 100644 (file)
@@ -7,6 +7,12 @@
 #
 # Updated and heavily modified by Braden <dbtem@yahoo.com>.
 #
+# Rewritten by A1kmm(Andrew Miller)<a1kmm@mware.virtualave.net> to support
+# the new flex/bison configuration parser.
+#
+# Rewritten by A1kmm(Andrew Miller)<a1kmm@mware.virtualave.net> to support
+# the new flex/bison configuration parser.
+#
 # Thanks and credits to: Run, Trillian, Cym, Morrissey, Chaos, Flynn,
 #                        Xorath, WildThang, Mmmm, SeKs, Ghostwolf and
 #                        all other Undernet IRC Admins and Operators,
 # but if all the other hubs in Europe aren't in service, it can connect
 # to one in the US by itself.
 #
-# All configuration options start with a letter identifying the option,
-# and a colon separated list of options. Unused fields should be left
-# blank.
+# The configuration format consists of a number of blocks in the format
+#  BlockName { setting = number; setting2 = "string"; setting3 = yes; };
+# Note that comments start from a #(hash) and go to the end of the line.
+# Whitespace(space, tab, or carriage return/linefeed) are ignored and may
+# be used to make the configuration file more readable.
 #
 # Please note that when ircd puts the configuration lines into practice,
 # it parses them exactly the other way round than they are listed here.
-# It reads the lines in reverse order.
+# It uses the blocks in reverse order.
 #
-# This means that you should start your I: lines with the "fall through",
-# most vanilla one and end with the most detailed.
+# This means that you should start your Client blocks with the
+# "fall through", most vanilla one, and end with the most detailed.
 #
 # There is a difference between the "hostname" and the "server name"
 # of the machine that the server is run on. For example, the host can
 # it to work.
 
 
-# [M:line]
+# [General]
 #
 # First some information about the server.
-# M:<server name>:<virtual host>:<description>:<not used>:<server numeric>
+# General {
+#         name = "servername";
+#         vhost = "virtualhost";
+#         description = "description";
+#         numeric = numericnumber;
+# };
 #
 # <virtual host> must contain either a * or a valid IPv4 address in
 # dotted quad notation. (127.0.0.1) The address MUST be the address
 # of a physical interface on the host. This address is used for outgoing
-# connections only, see P:lines for listener virtual hosting.
+# connections only, see Port{} for listener virtual hosting.
 # If in doubt put a * or the IP of your primary interface here.
 # The server must be compiled with virtual hosting turned on to get this
 # to work correctly.
 #
 # Note that <server numeric> has to be unique on the network your server
 # is running on, must be between 0 and 4095, and is not updated on a rehash.
-M:London.UK.Eu.UnderNet.org::University of London, England::1
-
+General {
+         name = "London.UK.Eu.UnderNet.org";
+         description = "University of London, England";
+         numeric = 1;
+};
 
-# [A:line]
+# [Admin]
 #
 # This sets information that can be retrieved with the /ADMIN command.
 # It should contain at least an admin Email contact address.
-# A:<line 1>:<line 2>:<line 3>
-A:The University of London:Undernet IRC server:IRC Admins <irc@london.ac.uk>
+Admin {
+  Location = "The University of London";
+  # At most two contact lines are allowed...
+  Contact = "Undernet IRC server";
+# Note that times can be specified as a number, or by giving something
+# like: 1 minutes 20 seconds, or 1*60+20.
+  Contact = "IRC Admins <irc@london.ac.uk>";
+};
 
-
-# [Y:lines]
+# [Classes]
 #
 # All connections to the server are associated with a certain "connection
 # class", be they incoming or outgoing (initiated by the server), be they
 # clients, servers or Martians. (Note that ircd doesn't have direct support
+# Recommended client classes:
 # for Martians (yet?); they will have to register as normal users. ;-)
-# Take the following Y: lines only as a guide.
-# Y:<class>:<ping freq>:<connect freq>:<maximum links>:<sendq size>
+# Take the following class blocks only as a guide.
+# Class {
+#  name = "<class>";
+#  pingfreq = time;
+#  connectfreq = time;
+#  maxlinks = number;
+#  sendq = size;
+# };
 #
 # <connect freq> applies only to servers, and specifies the frequency 
 # that the server tries to autoconnect. setting this to 0 will cause
 # the server to attempt to connect repeatedly with no delay until the 
 # <maximum links> condition is satisfied. This is a Bad Thing(tm).
+# Note that times can be specified as a number, or by giving something
+# like: 1 minutes 20 seconds, or 1*60+20.
+# Client {
+#  host = "user@host";
+#  ip = "ip@host";
+#  password = "password";
+#  class = "classname";
+# };
 #
 # <maximum links> should be set at either 0 or 1.
 #
-# Server classes: 90 = all your uplinks for who you do not wish to hub;
-# 80 = leaf servers (only used if your server is a hub)
-Y:90:90:300:1:9000000
-Y:80:90:300:0:9000000
-
+# Recommended server classes:
+# All your server uplinks you are not a hub for.
+Class {
+ name = "Server";
+ pingfreq = 1 minutes 30 seconds;
+ connectfreq = 5 minutes;
+ maxlinks = 1;
+ sendq = 9000000;
+};
+# All the leaf servers you hub for.
+Class {
+ name = "LeafServer";
+ pingfreq = 1 minutes 30 seconds;
+ connectfreq = 5 minutes;
+ maxlinks = 0;
+ sendq = 9000000;
+};
+
+# Recommended client classes:
 # Client classes. 10 = locals; 2 = for all .net and .com that are not
 # in Europe; 1 = for everybody.
-Y:10:90:0:100:160000
-Y:2:90:0:5:80000
-Y:1:90:0:400:160000
-
-
-# [I:lines]
+Class {
+ name = "Local";
+ pingfreq = 1 minutes 30 seconds;
+ sendq = 160000;
+ maxlinks = 100;
+};
+Client
+{
+ class = "Other";
+ host = "*@*";
+};
+Class {
+ name = "America";
+ pingfreq = 1 minutes 30 seconds;
+ sendq = 80000;
+ maxlinks = 5;
+};
+Class {
+ name = "Other";
+ pingfreq = 1 minutes 30 seconds;
+ sendq = 160000;
+ maxlinks = 400;
+};
+
+# [Client]
 #
 # To allow clients to connect, they need authorization. This can be
 # done based on hostmask, address mask, and/or with a password.
 # With intelligent use of classes and the maxconnections field in the
-# Y: lines, you can let in a specific domain, but get rid of all other
+# Client blocks, you can let in a specific domain, but get rid of all other
 # domains in the same toplevel, thus setting up some sort of "reverse
-# K: line".
-# I:<IP mask or crap to force resolving>:<opt passwd>:<hostmask>::<class>
+# Kill block".
+# Client {
+#  host = "user@host";
+#  ip = "ip@host";
+#  password = "password";
+#  class = "classname";
+# };
 #
 # Technical description (for examples, see below):
 # For every connecting client, the IP address is known.  A reverse lookup
 # on this IP-number is done to get the (/all) hostname(s).
 # Each hostname that belongs to this IP-number is matched to <hostmask>,
-# and the I: line is used when any matches; the client will then show
+# and the Client {} is used when any matches; the client will then show
 # with this particular hostname.  If none of the hostnames match, then
 # the IP-number is matched against the <IP mask ...> field, if this matches
-# then the I: line is used nevertheless and the client will show with the
+# then the Client{} is used nevertheless and the client will show with the
 # first (main) hostname if any; if the IP-number did not resolve then the
 # client will show with the dot notation of the IP-number.
 # There is a special case for the UNIX domain sockets and localhost connections
@@ -123,82 +197,127 @@ Y:1:90:0:400:160000
 # 002 Your host is 2.undernet.org[jolan.ppro], running version ...
 # Then the "jolan.ppro" is the name used for matching.
 # Therefore, unix domain sockets, and connections to localhost would
-# match this I: line:
-# I:jolan.ppro::foobar::1
-# Finally, I: lines with empty <IP mask ..> or <hostmask> fields are skipped.
+# match this block:
+# host = "*@jolan.ppro";
 #
 # This is the "fallback" entry. All .uk, .nl, and all unresolved are
 # in these two lines.
 # By using two different lines, multiple connections from a single IP
 # are only allowed from hostnames which have both valid forward and
 # reverse DNS mappings.
-I:*@*:1:Unresolved::1
-I:Resolved::*@*::1
-
+Client
+{
+ class = "Other";
+ ip = "*@*";
+};
+
+
+Client
+{
+ class = "Other";
+ host = "*@*";
+};
 # If you don't want unresolved dudes to be able to connect to your
-# server, use just:
-# I:NotMatchingCrap::*@*::1
+# server, do not specify any "ip = " settings.
 #
 # Here, take care of all American ISPs.
-I:Resolved::*@*.com::2
-I:Resolved::*@*.net::2
-
+Client
+{
+ host = "*@*.com";
+ class = "America";
+};
+
+Client
+{
+ host = "*@*.net";
+ class = "America";
+};
 # Now list all the .com / .net domains that you wish to have access...
 # actually it's less work to do it this way than to do it the other
-# way around - Klining every single ISP in the US.
+# way around - K-lining every single ISP in the US.
 # I wish people in Holland just got a .nl domain, and not try to be
 # cool and use .com...
-I:Resolved::*@*.wirehub.net::1
-I:Resolved::*@*.planete.net::1
-I:Resolved::*@*.ivg.com::1
-I:Resolved::*@*.ib.com::1
-I:Resolved::*@*.ibm.net::1
-I:Resolved::*@*.hydro.com::1
-I:Resolved::*@*.NL.net::1
+Client { host = "*@*.wirehub.net"; class = "Other";};
+Client { host = "*@*.planete.net"; class = "Other";};
+Client { host = "*@*.ivg.com"; class = "Other";};
+Client { host = "*@*.ib.com"; class = "Other";};
+Client { host = "*@*.ibm.net"; class = "Other";};
+Client { host = "*@*.hydro.com"; class = "Other";};
+Client { host = "*@*.nl.net"; class = "Local";};
 
 # You can request a more complete listing, including the "list of standard
-# K-lines" from the Routing Committee; it will also be sent to you if
+# Kill blocks" from the Routing Committee; it will also be sent to you if
 # you apply for a server and get accepted.
 #
 # Ourselves - this makes sure that we can get in, no matter how full
 # the server is (hopefully).
-I:*@193.37.*::*@*.london.ac.uk::10
-
-# You can put a digit (0..9) in the password field, which will make ircd
+Client
+{
+ host = "*@*.london.ac.uk";
+ ip = "*@193.37.*";
+ class = "Local";
+};
+
+# You can put a digit (0..9) in the password value, which will make ircd
 # only accept a client when the total number of connections to the network
 # from the same IP number doesn't exceed this number.
 # The following example would accept at most one connection per IP number
 # from "*.swipnet.se" and at most two connections from dial up accounts
 # that have "dial??.*" as host mask:
-# I:Resolved:1:*@*.swipnet.se::1
-# I:Resolved:2:*@dial??.*::1
+# Client {
+#  host = "*@*.swipnet.se";
+#  password = "1";
+#  class = "Other";
+# };
+# Client {
+#  host = "*@dial??.*";
+#  password = "2";
+#  class = "Other";
+# };
 #
 # If you are not worried about who connects, this line will allow everyone
 # to connect.
-I:*::*::1
+Client {
+ host = "*@*";
+ ip = "*@*";
+ class = "Other";
+};
 
 
-# [T:lines]
+# [motd]
 #
 # It is possible to show a different Message of the Day to a connecting
 # client depending on its origin.
-# T:<hostmask>:<path to motd file>
-# or:
-# T:<classnumber>:<path to motd file>
+# motd {
+#  # Note: host can also be a classname.
+#  host = "Other";
+#  file = "path/to/motd/file";
+# };
 #
 # DPATH/net_com.motd contains a special MOTD where users are encouraged
-# to register their domains and get their own I: lines if they're in
+# to register their domains and get their own client{} lines if they're in
 # Europe, or move to US.UnderNet.org if they're in the USA.
-T:*.net:net_com.motd
-T:*.com:net_com.motd
-T:2:net_com.motd
+motd {
+ host = "*.net";
+ file = "net_com.motd";
+};
+motd {
+ host = "*.com";
+ file = "net_com.motd";
+};
+motd {
+ host = "America";
+ file = "net_com.motd";
+};
 
 # A different MOTD for ourselves, where we point out that the helpdesk
 # better not be bothered with questions regarding irc...
-T:*.london.ac.uk:london.motd
-
+motd {
+ host = "*.london.ac.uk";
+ file = "london.motd";
+};
 
-# [U:lines]
+# [Server]
 #
 # One of the many nice features of Undernet is "Uworld", a program
 # connected to the net as a server. This allows it to broadcast any mode
@@ -207,7 +326,17 @@ T:*.london.ac.uk:london.motd
 # There is only one slight problem: the TimeStamp protocol prevents this.
 # So there is a configuration option to allow them anyway from a certain
 # server.
-# U:<Server Name>:<Juped Nicks>:*
+# Server {
+#  # The servername or wildcard mask for it that this applies to.
+#  name = "relservername";
+#  # The mask of servers they are allowed to introduce(for hub=yes;) or
+#  # not allowed to introduce(for leaf=yes).
+#  mask = "servermask";
+#  # No is assumed for these unless you set it to yes.
+#  uworld = no;
+#  leaf = no;
+#  hub = yes;
+# };
 #
 # Note: (1) These lines are agreed on by every server admin on Undernet;
 # (2) These lines must be the same on every single server, or results
@@ -218,58 +347,145 @@ T:*.london.ac.uk:london.motd
 # servers will try to undo the mode hacks that Uworld does.  Make SURE that
 # all of the servers have the EXACT same Ulines.
 #
-# As of ircu2.10.05 is it possible to Jupe nicks. Juped nicks need to be
-# added to U: lines.  As per CFV-0095, the following nicks must be juped,
-# it is not allowed to jupe others as well.
-U:Uworld.EU.undernet.org:EuWorld,E,StatServ,NoteServ:*
-U:Uworld2.undernet.org:UWorld2,ChanSvr,ChanSaver,ChanServ:*
-U:Uworld.undernet.org:Uworld,NickSvr,NickSaver,NickServ:*
-U:channels.undernet.org:LPT1,X,login:*
-U:channels2.undernet.org:LPT2,W,Undernet:*
-U:channels3.undernet.org:COM1,V,protocol:*
-U:channels4.undernet.org:COM2,U,pass:*
-U:channels5.undernet.org:COM3,Y,AUX:*
-U:channels6.undernet.org:COM4,Z,newpass:*
-
-
-# [K:lines]
+# If your server starts on a bit larger network, you'll probably get
+# assigned one or two uplinks to which your server can connect.
+# If your uplink(s) also connect to other servers than yours (which is
+# probable), you need to define your uplink as being allowed to "hub".
+# To do this, set "hub = yes;"
+# You can also force a server(even one that doesn't connect to you)
+# to be a leaf with "leaf = yes;"
+
+Server {
+ name = "uworld.eu.undernet.org";
+ mask = "*";
+ uworld = yes;
+ hub = yes;
+};
+Server {
+ name = "uworld2.undernet.org";
+ mask = "*";
+ uworld = yes;
+ hub = yes;
+};
+Server {
+ name = "uworld.undernet.org";
+ mask = "*";
+ uworld = yes;
+ hub = yes;
+};
+Server {
+ name = "channels.undernet.org";
+ mask = "*";
+ uworld = yes;
+ hub = yes;
+};
+Server {
+ name = "channels2.undernet.org";
+ mask = "*";
+ uworld = yes;
+ hub = yes;
+};
+Server {
+ name = "channels3.undernet.org";
+ mask = "*";
+ uworld = yes;
+ hub = yes;
+};
+Server {
+ name = "channels4.undernet.org";
+ mask = "*";
+ uworld = yes;
+ hub = yes;
+};
+Server {
+ name = "channels5.undernet.org";
+ mask = "*";
+ uworld = yes;
+ hub = yes;
+};
+Server {
+ name = "channels6.undernet.org";
+ mask = "*";
+ uworld = yes;
+ hub = yes;
+};
+Server {
+ name = "Amsterdam.NL.Eu.UnderNet.org";
+ mask = "*";
+ hub = yes;
+};
+# An example just to make sure IRCnet doesn't get on undernet...
+Server {
+ name = "*";
+ mask = "eris.berkeley.edu";
+ hub = yes;
+};
+
+# As of ircu2.10.05 is it possible to Jupe nicks. As per CFV-0095, the
+# following nicks must be juped, it is not allowed to jupe others as well.
+Jupe {
+ nick = "EuWorld,E,StatServ,NoteServ";
+ nick = "UWorld2,ChanSvr,ChanSaver,ChanServ";
+ nick = "Uworld,NickSvr,NickSaver,NickServ";
+ nick = "LPT1,X,login,LPT2,W,Undernet,COM1,V,protocol,COM2";
+ nick = "U,pass,COM3,Y,AUX,COM4,Z,newpass";
+};
+
+# [Kill]
 #
 # While running your server, you will most probably encounter individuals
 # or groups of persons that you do not wish to have access to your server.
 #
-# For this purpose, the ircd understands "kill lines".
-# K:<host/IP mask>:"<opt reason>":<username mask>
+# For this purpose, the ircd understands "kill blocks". These are also
+# known as K-lines, by virtue of the former config file format.
+# Kill
+# {
+#   host = "user@host";
+#   reason = "The reason the user will see";
+# };
+# It is possible to ban on the basis of the real name.
+# It is also possible to use a file as comment for the ban, using
+# file = "file":
+# Kill
+# {
+#   realname = "realnametoban";
+#   file = "path/to/file/with/reason/to/show";
+# };
 #
-# It is possible to use a file as comment for the ban.
-# K:<host/IP mask>:!<path to file>:<usermask>
 #
 # The default reason is: "You are banned from this server"
-# Note that Klines are local to the server; if you ban a person or a
+# Note that K-lines are local to the server; if you ban a person or a
 # whole domain from your server, they can get on IRC via any other server
-# that doesn't have them Klined (yet).
+# that doesn't have them K-lined (yet).
 #
 # With a simple comment, using quotes:
-K:*.au:"Please use a nearer server":*
-K:*.edu:"Please use a nearer server":*
+Kill { host = "*.au"; reason = "Please use a nearer server"; };
+Kill { host = "*.edu"; reason = "Please use a nearer server"; };
 
-# With a file, prepending a '!' before the filename.
 # The file can contain for example, a reason, a link to the
 # server rules and a contact address.
-K:unixbox.flooder.co.uk:!kline/youflooded.txt:*luser
-
-#
-# IP-based kill lines are designated with a lowercase 'k'.  These lines
-# use the same format as normal K: lines, except they apply to all hosts,
-# even if an IP address has a properly resolving host name.
-k:192.168.*:!klines/martians:*
-
-# Additionally, you may specify a hostmask prefixed with $R to indicate
-# a match should be performed against the "real-name" / "info" field
-# instead of the host/IP.
-K:$R*sub7*:"You are infected with a Trojan":*
-
-
-# [C:lines]
+Kill
+{
+ host = "*luser@unixbox.flooder.co.uk";
+ file = "kline/youflooded.txt";
+};
+
+# IP-based kill lines apply to all hosts, even if an IP address has a
+# properly resolving host name.
+Kill
+{
+ host = "192.168.*";
+ file = "klines/martians";
+};
+
+# The realname field lets you ban by realname...
+Kill
+{
+ host = "*sub7*";
+ reason = "You are infected with a Trojan";
+};
+
+# [Connect]
 #
 # You probably want your server connected to other servers, so your users
 # have other users to chat with.
@@ -282,52 +498,62 @@ K:$R*sub7*:"You are infected with a Trojan":*
 # server links is provided for ircd to decide what links to allow, what
 # to let humans do themselves, and what links to (forcefully) disallow.
 #
-# The Connection lines (also known as C lines)
+# The Connect blocks
 # define what servers the server connect to, and which servers are
 # allowed to connect.
-# C:<remote hostname or IP>:<password>:<remote server name>:<port>:<class>
+# Connect {
+#  name = "servername";
+#  host = "hostnameORip";
+#  password = "passwd";
+#  port = portno;
+#  class = "classname";
+# };
 #
 # The "port" field defines the default port the server tries to connect
 # to if an operator uses /connect without specifying a port. This is also
 # the port used when the server attempts to auto-connect to the remote 
-# server. (See Y:lines for more informationa about auto-connects).
+# server. (See Class blocks for more informationa about auto-connects).
 #
 # Our primary uplink.
-C:1.2.3.4:passwd:Amsterdam.NL.Eu.UnderNet.org:4400:90
-
+Connect {
+ name = "Amsterdam.NL.Eu.UnderNet.org";
+ host = "1.2.3.4";
+ password = "passwd";
+ port = 4400;
+ class = "Servers";
+};
 
-# [H:lines]
-#
-# If your server starts on a bit larger network, you'll probably get
-# assigned one or two uplinks to which your server can connect.
-# If your uplink(s) also connect to other servers than yours (which is
-# probable), you need to define your uplink as being allowed to "hub".
-# H:<allowed hostmask>::<server name>
-H:*.*::Amsterdam.NL.Eu.UnderNet.org
-
-
-# [L:lines]
-#
-# Of course, the opposite is also possible: forcing a server to be
-# a leaf. L: lines follow Murphy's Law: if you use them, there's a big
-# chance that routing will be screwed up afterwards.
-# L:<opt disallowed hostmask>::<server mask>:<opt max depth>
-
-
-# [D:lines]
+# [crule]
 #
 # For an advanced, real-time rule-based routing decision making system
-# you can use Disallow lines. For more information, see doc/readme.crules.
-# D:<server mask that ircd will refuse to connect to>::<rule>
-# d:<server mask that ircd will not autoconnect to>::<rule>
-# D:*.US.UnderNet.org::connected(*.US.UnderNet.org)
-# d:*.EU.UnderNet.org::connected(Amsterdam.NL.EU.*)
-#
-# The following line is recommended for leaf servers:
-# d:*::directcon(*)
-
-
-# [O:lines]
+# you can use crule blocks. For more information, see doc/readme.crules.
+# CRULE
+# {
+#  server = "servermask";
+#  rule = "connectrule";
+#  # Setting all to yes makes the rule always apply. Otherwise it only
+#  # applies to autoconnects.
+#  all = yes;
+# };
+CRULE
+{
+ server = "*.US.UnderNet.org";
+ rule = "connected(*.US.UnderNet.org)";
+};
+CRULE
+{
+ server = "*.EU.UnderNet.org";
+ rule = "connected(Amsterdam.NL.EU.*)";
+};
+
+# The following block is recommended for leaf servers:
+CRULE
+{
+ server = "*";
+ rule = "directcon(*)";
+};
+
+# [Operator]
 #
 # Inevitably, you have reached the part about "IRC Operators". Oper status
 # grants some special privileges to a user, like the power to make the
@@ -344,28 +570,42 @@ H:*.*::Amsterdam.NL.Eu.UnderNet.org
 # them from using Uworld as well.
 # Depending on some defines in include/config.h, local operators are also
 # not allowed to /DIE and /RESTART the server.
-# Local operators are designated with a lowercase 'o'
-# O:<host/IP mask>:<encrypted password>:<Nick>::<connection class>
-# o:<host/IP mask>:<encrypted password>:<Nick>::<connection class>
+# Operator {
+#  local = no;
+#  host = "host/IP mask";
+#  name = "opername";
+#  password = "encryptedpass";
+#  class = "classname";
+# };
 #
 # The encrypted password is optional.  If you wish to encrypt your password,
 # there is a utility in the ircd.  Please read the file tools/README.  
-O:*@*.cs.vu.nl:VRKLKuGKn0jLs:Niels::10
-o:*@*.uu.net:noncryptedpass:Braden::10
+Operator {
+ local = no;
+ host = "*@*.cs.vu.nl";
+ password = "VRKLKuGKn0jLt";
+ name = "Niels";
+ class = "Local";
+};
+Operator {
+ local = yes;
+ host = "*@*.uu.net";
+ password = "notencryptedpass";
+ name = "Niels";
+ class = "Local";
+};
 
 # Note that the <connection class> is optional, but leaving it away
-# puts the O: lines in class 0, which usually only accepts one connection
-# at a time.  If you want users to Oper up more then once per O: line,
-# then use a connection class that allows more then one connection,
-# for example (using class 10 as in the example above):
+# puts the opers in class "default", which usually only accepts one
+# connection at a time.  If you want users to Oper up more then once per
+# block, then use a connection class that allows more then one connection,
+# for example (using class Local as in the example above):
 #
 # Once you OPER your connection class changes no matter where you are or
-# your previous connection classes.  If the defined connection class is 10
-# for the O:line, then your new connection class is 10.
-# Y:10:90:0:100:160000
-
+# your previous connection classes.  If the defined connection class is
+# Local for the operator block, then your new connection class is Local.
 
-# [P:lines]
+# [Port]
 # When your server gets more full, you will notice delays when trying to
 # connect to your server's primary listening port. It is possible via the
 # Port lines to specify additional ports for the ircd to listen to.
@@ -373,12 +613,21 @@ o:*@*.uu.net:noncryptedpass:Braden::10
 # ports;
 # Undernet uses 4400 for server listener ports.
 # These are just hints, they are in no way official IANA or IETF policies.
-# IANA says we should use port 194, but that requires us to run as root, so
-# we don't do that.
-#
-# P:<hostmask>:<interface>:<[CS][H]>:<port number>
-#
-# The hostmask setting allows you to specify a range of IP addresses that
+# IANA says we should use port 194, but that requires us to run as root,
+# so we don't do that.
+#
+# Port {
+#  port = number;
+#  mask = "ipmask";
+#  # Use this to control the interface you bind to.
+#  vhost = "virtualhostip";
+#  # Setting to yes makes this server only.
+#  server = yes;
+#  # Setting to yes makes the port "hidden" from stats.
+#  hidden = yes;
+# };
+#
+# The mask setting allows you to specify a range of IP addresses that
 # you will allow connections from. This should only contain IP addresses
 # and '*' if used. This field only uses IP addresses. This does not use
 # DNS in any way so you can't use it to allow *.nl or *.uk. Attempting
@@ -392,41 +641,41 @@ o:*@*.uu.net:noncryptedpass:Braden::10
 # If you want to use virtual hosting *YOU* *MUST* *USE* *THIS* otherwise it
 # WILL bind to all interfaces - not what most people seem to expect.
 #
-# The [CS][H] field is an optional field to specify that a port is a
-# server port or a client port and whether it's hidden or not.
-# If used the first character MUST be either a C or S.
-# If you want to hide a port from /stats p from non-opers follow the C
-# or S with an H
-#
-# C = Client (Ports 6660-6669)
-# S = Server (Port 4400)
-#
-# P:<hostmask>:<interface>:<[CS][H]>:<port number>
-#
-# This is a normal server port, you need to have at least one server
-# port defined if you want to connect your server to other servers.
-P:::S:4400
+Port {
+ server = yes;
+ port = 4400;
+};
 
 # This is a Server port that is Hidden
-#P:::SH:4401
+Port {
+ server = yes;
+ hidden = yes;
+ port = 4401;
+};
 
 # The following are normal client ports
-P:::C:6667
-P::::6668
-P:192.168.*:::6666
+Port { port = 6667; };
+Port { port = 6668; };
+Port {
+ mask = "192.168.*";
+ port = 6666;
+};
 
 # This is a hidden client port, listening on the interface associated
 # with the IP address 168.8.21.107
-#P:*:168.8.21.107:CH:7000
-
+Port {
+ mask = "168.8.21.107";
+ hidden = yes;
+ port = 7000;
+};
 
-# [F:lines]
-#
+# [features]
 # IRC servers have a large number of options and features.  Most of these
 # are set at compile time through the use of #define's--see "make config"
 # for more details--but we are working to move many of these into the
-# configuration file.  Feature lines are the hook we're using for this.
-# F:<Option>:<Value>
+# configuration file.  Features let you configure these at runtime.
+# You only need one feature block in which you use
+# "featurename" = "value1" , "value2", ..., "valuen-1", "valuen";
 #
 # The entire purpose of F:lines are so that you do not have to recompile
 # the IRCD everytime you want to change a feature.  All of the features
@@ -437,84 +686,86 @@ P:192.168.*:::6666
 # found at doc/readme.log.  The defaults used by the Undernet network are
 # below.
 #
-# F:DOMAINNAME:<obtained from /etc/resolv.conf by ./configure>
-# F:RELIABLE_CLOCK:FALSE
-# F:BUFFERPOOL:27000000
-# F:HAS_FERGUSON_FLUSHER:FALSE
-# F:CLIENT_FLOOD:1024
-# F:SERVER_PORT:4400
-# F:NODEFAULTMOTD:TRUE
-# F:MOTD_BANNER
-# F:KILL_IPMISMATCH:FALSE
-# F:IDLE_FROM_MSG:TRUE
-# F:HUB:FALSE
-# F:WALLOPS_OPER_ONLY:FALSE
-# F:NODNS:FALSE
-# F:RANDOM_SEED:<you should set one explicitly>
-# F:DEFAULT_LIST_PARAM
-# F:NICKNAMEHISTORYLENGTH:800
-# F:HOST_HIDING:FALSE
-# F:HIDDEN_HOST:users.undernet.org
-# F:KILLCHASETIMELIMIT:30
-# F:MAXCHANNELSPERUSER:10
-# F:AVBANLEN:40
-# F:MAXBANS:30
-# F:MAXSILES:15
-# F:HANGONGOODLINK:300
-# F:HANGONRETRYDELAY:10
-# F:CONNECTTIMEOUT:90
-# F:TIMESEC:60
-# F:MAXIMUM_LINKS:1
-# F:PINGFREQUENCY:120
-# F:CONNECTFREQUENCY:600
-# F:DEFAULTMAXSENDQLENGTH:40000
-# F:GLINEMAXUSERCOUNT:20
-# F:MPATH:ircd.motd
-# F:RPATH:remote.motd
-# F:PPATH:ircd.pid
-# F:VIRTUAL_HOST:FALSE
-# F:TOS_SERVER:0x08
-# F:TOS_CLIENT:0x08
-# F:POLLS_PER_LOOP:200
-# F:CRYPT_OPER_PASSWORD:TRUE
-# F:OPER_NO_CHAN_LIMIT:TRUE
-# F:OPER_MODE_LCHAN:TRUE
-# F:OPER_WALK_THROUGH_LMODES:FALSE
-# F:NO_OPER_DEOP_LCHAN:FALSE
-# F:SHOW_INVISIBLE_USERS:TRUE
-# F:SHOW_ALL_INVISIBLE_USERS:TRUE
-# F:UNLIMIT_OPER_QUERY:FALSE
-# F:LOCAL_KILL_ONLY:FALSE
-# F:CONFIG_OPERCMDS:FALSE
-# F:OPER_KILL:TRUE
-# F:OPER_REHASH:TRUE
-# F:OPER_RESTART:TRUE
-# F:OPER_DIE:TRUE
-# F:OPER_GLINE:TRUE
-# F:OPER_LGLINE:TRUE
-# F:OPER_JUPE:TRUE
-# F:OPER_LJUPE:TRUE
-# F:OPER_OPMODE:TRUE
-# F:OPER_LOPMODE:TRUE
-# F:OPER_BADCHAN:FALSE
-# F:OPER_LBADCHAN:FALSE
-# F:OPER_SET:FALSE
-# F:OPERS_SEE_IN_SECRET_CHANNELS:TRUE
-# F:OPER_WIDE_GLINE:TRUE
-# F:OPER_LIST_CHAN:TRUE
-# F:LOCOP_KILL:TRUE
-# F:LOCOP_REHASH:TRUE
-# F:LOCOP_RESTART:FALSE
-# F:LOCOP_DIE:FALSE
-# F:LOCOP_LGLINE:TRUE
-# F:LOCOP_LJUPE:TRUE
-# F:LOCOP_LOPMODE:TRUE
-# F:LOCOP_LBADCHAN:FALSE
-# F:LOCOP_SET:FALSE
-# F:LOCOP_SEE_IN_SECRET_CHANNELS:FALSE
-# F:LOCOP_WIDE_GLINE:FALSE
-# F:LOCOP_LIST_CHAN:FALSE
-
+features
+{
+#  "DOMAINNAME"="<obtained from /etc/resolv.conf by ./configure>";
+#  "RELIABLE_CLOCK"="FALSE";
+#  "BUFFERPOOL"="27000000";
+#  "HAS_FERGUSON_FLUSHER"="FALSE";
+#  "CLIENT_FLOOD"="1024";
+#  "SERVER_PORT"="4400";
+#  "NODEFAULTMOTD"="TRUE";
+#  "MOTD_BANNER"="TRUE";
+#  "KILL_IPMISMATCH"="FALSE";
+#  "IDLE_FROM_MSG"="TRUE";
+#  "HUB"="FALSE";
+#  "WALLOPS_OPER_ONLY"="FALSE";
+#  "NODNS"="FALSE";
+#  "RANDOM_SEED"="<you should set one explicitly>";
+#  "DEFAULT_LIST_PARAM"="TRUE";
+#  "NICKNAMEHISTORYLENGTH"="800";
+#  "HOST_HIDING"="FALSE";
+#  "HIDDEN_HOST"="users.undernet.org";
+#  "KILLCHASETIMELIMIT"="30";
+#  "MAXCHANNELSPERUSER"="10";
+#  "AVBANLEN"="40";
+#  "MAXBANS"="30";
+#  "MAXSILES"="15";
+#  "HANGONGOODLINK="300";
+# "HANGONRETRYDELAY" = "10";
+# "CONNECTTIMEOUT" = "90";
+# "TIMESEC" = "60";
+# "MAXIMUM_LINKS" = "1";
+# "PINGFREQUENCY" = "120";
+# "CONNECTFREQUENCY" = "600";
+# "DEFAULTMAXSENDQLENGTH" = "40000";
+# "GLINEMAXUSERCOUNT" = "20";
+# "MPATH" = "ircd.motd";
+# "RPATH" = "remote.motd";
+# "PPATH" = "ircd.pid";
+# "VIRTUAL_HOST" = "FALSE";
+# "TOS_SERVER" = "0x08";
+# "TOS_CLIENT" = "0x08";
+# "POLLS_PER_LOOP" = "200";
+# "CRYPT_OPER_PASSWORD" = "TRUE";
+# "OPER_NO_CHAN_LIMIT" = "TRUE";
+# "OPER_MODE_LCHAN" = "TRUE";
+# "OPER_WALK_THROUGH_LMODES" = "FALSE";
+# "NO_OPER_DEOP_LCHAN" = "FALSE";
+# "SHOW_INVISIBLE_USERS" = "TRUE";
+# "SHOW_ALL_INVISIBLE_USERS" = "TRUE";
+# "UNLIMIT_OPER_QUERY" = "FALSE";
+# "LOCAL_KILL_ONLY" = "FALSE";
+# "CONFIG_OPERCMDS" = "FALSE";
+# "OPER_KILL" = "TRUE";
+# "OPER_REHASH" = "TRUE";
+# "OPER_RESTART" = "TRUE";
+# "OPER_DIE" = "TRUE";
+# "OPER_GLINE" = "TRUE";
+# "OPER_LGLINE" = "TRUE";
+# "OPER_JUPE" = "TRUE";
+# "OPER_LJUPE" = "TRUE";
+# "OPER_OPMODE" = "TRUE";
+# "OPER_LOPMODE" = "TRUE";
+# "OPER_BADCHAN" = "FALSE";
+# "OPER_LBADCHAN" = "FALSE";
+# "OPER_SET" = "FALSE";
+# "OPERS_SEE_IN_SECRET_CHANNELS" = "TRUE";
+# "OPER_WIDE_GLINE" = "TRUE";
+# "OPER_LIST_CHAN" = "TRUE";
+# "LOCOP_KILL" = "TRUE";
+# "LOCOP_REHASH" = "TRUE";
+# "LOCOP_RESTART" = "FALSE";
+# "LOCOP_DIE" = "FALSE";
+# "LOCOP_LGLINE" = "TRUE";
+# "LOCOP_LJUPE" = "TRUE";
+# "LOCOP_LOPMODE" = "TRUE";
+# "LOCOP_LBADCHAN" = "FALSE";
+# "LOCOP_SET" = "FALSE";
+# "LOCOP_SEE_IN_SECRET_CHANNELS" = "FALSE";
+# "LOCOP_WIDE_GLINE" = "FALSE";
+# "LOCOP_LIST_CHAN" = "FALSE";
+};
 
 # Well, you have now reached the end of this sample configuration
 # file. If you have any questions, feel free to mail
index a7b25197926e9882169ba5077d716a7c3d5b477e..93ba2bdc424f548bb3ed353466d768b4c7be12b8 100644 (file)
@@ -34,7 +34,7 @@ struct ConfItem;
  */
 struct ConnectionClass {
   struct ConnectionClass* next;
-  int                     cc_class;
+  char                    *cc_name;
   unsigned int            max_sendq;
   short                   ping_freq;
   short                   conn_freq;
@@ -47,14 +47,14 @@ struct ConnectionClass {
  * Macro's
  */
 
-#define ConClass(x)     ((x)->cc_class)
+#define ConClass(x)     ((x)->cc_name)
 #define PingFreq(x)     ((x)->ping_freq)
 #define ConFreq(x)      ((x)->conn_freq)
 #define MaxLinks(x)     ((x)->max_links)
 #define MaxSendq(x)     ((x)->max_sendq)
 #define Links(x)        ((x)->ref_count)
 
-#define ConfClass(x)    ((x)->conn_class->cc_class)
+#define ConfClass(x)    ((x)->conn_class->cc_name)
 #define ConfPingFreq(x) ((x)->conn_class->ping_freq)
 #define ConfConFreq(x)  ((x)->conn_class->conn_freq)
 #define ConfMaxLinks(x) ((x)->conn_class->max_links)
@@ -71,15 +71,15 @@ extern const struct ConnectionClass* get_class_list(void);
 extern void class_mark_delete(void);
 extern void class_delete_marked(void);
 
-extern struct ConnectionClass *find_class(unsigned int cclass);
+extern struct ConnectionClass *find_class(const char *name);
 extern struct ConnectionClass *make_class(void);
 extern void free_class(struct ConnectionClass * tmp);
 extern unsigned int get_con_freq(struct ConnectionClass * clptr);
 extern unsigned int get_client_ping(struct Client *acptr);
-extern unsigned int get_conf_class(const struct ConfItem *aconf);
+extern char *get_conf_class(const struct ConfItem *aconf);
 extern int get_conf_ping(const struct ConfItem *aconf);
-extern unsigned int get_client_class(struct Client *acptr);
-extern void add_class(unsigned int conclass, unsigned int ping,
+extern char *get_client_class(struct Client *acptr);
+extern void add_class(char *name, unsigned int ping,
                       unsigned int confreq, unsigned int maxli, unsigned int sendq);
 extern void check_class(void);
 extern void report_classes(struct Client *sptr);
index ba2204a40ea20817bb176a9ead017e53279db938..5ee6e050e149336c1606a5c08a70896802d4bfa4 100644 (file)
@@ -38,10 +38,8 @@ struct TRecord;
 struct Motd {
   struct Motd*         next;
   int                  type;
-  union {
-    char*              hostmask;
-    int                        class;
-  }                    id;
+  /* Used for classname if it is a class. */
+  char*                hostmask;
   char*                        path;
   int                  maxcount;
   struct MotdCache*    cache;
index 373a089545bfd542eeb9ab0ea7149cb0297184f8..280ddd97d2a7084f537ec94558e60f3b20ff0f89 100644 (file)
@@ -18,7 +18,7 @@
  * $Id$
  *
  */
-#define PATCHLEVEL "00"
+#define PATCHLEVEL "01"
 
 #define RELEASE ".12.alpha."
 
index 23b929a86074e763da608277ac0290a248a468aa..6a89ab9142a64386fcc331229190ef1b05594dfb 100644 (file)
@@ -148,6 +148,7 @@ enum AuthorizationCheckResult {
   ACR_BAD_SOCKET
 };
 
+
 /*
  * GLOBALS
  */
@@ -189,4 +190,6 @@ extern int find_kill(struct Client *cptr);
 extern int find_restrict(struct Client *cptr);
 extern struct MotdItem* read_motd(const char* motdfile);
 
+extern void yyerror(const char *msg);
+
 #endif /* INCLUDED_s_conf_h */
index 7a553cd245ae8cca181d9803a90f779f7999b2c7..d9076affc5030a5dff6acc5cd87180bedb846d43 100644 (file)
@@ -38,6 +38,8 @@ CHOWN = chown
 CHGRP = chgrp
 MKDIR = mkdir
 TOUCH = touch
+LEX = flex
+YACC = bison -y
 GREP = grep
 OSDEP_C = @OSDEP_C@
 ENGINE_C = @ENGINE_C@
@@ -100,6 +102,7 @@ IRCD_SRC = \
        ircd_string.c \
        ircd_xopen.c \
        jupe.c \
+       lex.yy.c \
        list.c \
        listener.c \
        m_account.c \
@@ -197,15 +200,15 @@ IRCD_SRC = \
        uping.c \
        userload.c \
        whocmds.c \
-       whowas.c
+       whowas.c \
+       y.tab.c
 
-CHKCONF_SRC = chkconf.c
 
 SRC = ${IRCD_SRC} ${OSDEP_C} ${ENGINE_C}
 
 OBJS = ${SRC:%.c=%.o}
 
-DEP_SRC = ${IRCD_SRC} ${OSDEP_SRC} ${ENGINE_SRC} ${CHKCONF_SRC}
+DEP_SRC = ${IRCD_SRC} ${OSDEP_SRC} ${ENGINE_SRC}
 
 all:
        ( cd ..; make -f Makefile )
@@ -215,7 +218,7 @@ all:
 .c.o:
        ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
 
-build: ircd chkconf
+build: ircd
 
 ircd: ${OBJS} ../include/patchlevel.h version.o
        ${PURIFY} ${CC} ${OBJS} version.o ${RINGLOG_O} ${LDFLAGS} ${LIBS} \
@@ -244,13 +247,11 @@ table_gen: table_gen.o
 chattr.tab.c: table_gen
        ./table_gen > chattr.tab.c
 
-chkcrule.o: crule.c
-       ${CC} ${CFLAGS} ${CPPFLAGS} -DCR_CHKCONF -o chkcrule.o -c \
-               ${srcdir}/crule.c
+lex.yy.c: ircd_lexer.l y.tab.h
+       ${LEX} ircd_lexer.l
 
-chkconf: chkconf.o fda.o match.o chkcrule.o ircd_alloc.o fileio.o ircd_string.o
-       ${CC} chkconf.o fda.o match.o chkcrule.o ircd_alloc.o fileio.o \
-       ircd_string.o ${LDFLAGS} ${LIBS} -o chkconf
+y.tab.c y.tab.h: ircd_parser.y
+       ${YACC} -d ircd_parser.y
 
 mkbindir:
        @test -d ${BINDIR} || mkdir ${BINDIR}
index 87b35ce3af43905347f819a1e47d70749f77a675..93c4162d637ba6306895f90363f387decb4f2edc 100644 (file)
@@ -2571,7 +2571,7 @@ mode_parse_ban(struct ParseState *state, int *flag_p)
        ban->flags |= MODE_DEL; /* mark ban for deletion: overlapping */
 
       if (!ban->next && (newban->flags & MODE_ADD)) {
-       ban->next = newban; /* add our ban with its flags */
+       ban->next = newban; /* add our"ban with its flags */
        break; /* get out of loop */
       }
     }
index f3772478347dddfa6893f8adc48240d257a08561..58acaf880ef0961950d174498e79091ca9aefd53 100644 (file)
@@ -26,6 +26,7 @@
 #include "ircd_alloc.h"
 #include "ircd_features.h"
 #include "ircd_reply.h"
+#include "ircd_string.h"
 #include "list.h"
 #include "numeric.h"
 #include "s_conf.h"
@@ -60,6 +61,8 @@ void free_class(struct ConnectionClass* p)
 {
   if (p) {
     assert(0 == p->valid);
+    if (p->cc_name)
+     MyFree(p->cc_name);
     MyFree(p);
     --connClassAllocCount;
   }
@@ -73,7 +76,8 @@ void init_class(void)
   if (!connClassList)
     connClassList = (struct ConnectionClass*) make_class();
 
-  ConClass(connClassList) = 0;
+  /* We had better not try and free this... */
+  ConClass(connClassList) = "default";
   PingFreq(connClassList) = feature_int(FEAT_PINGFREQUENCY);
   ConFreq(connClassList)  = feature_int(FEAT_CONNECTFREQUENCY);
   MaxLinks(connClassList) = feature_int(FEAT_MAXIMUM_LINKS);
@@ -112,7 +116,7 @@ void class_delete_marked(void)
   Debug((DEBUG_DEBUG, "Class check:"));
 
   for (prev = cl = connClassList; cl; cl = prev->next) {
-    Debug((DEBUG_DEBUG, "Class %d : CF: %d PF: %d ML: %d LI: %d SQ: %d",
+    Debug((DEBUG_DEBUG, "Class %s : CF: %d PF: %d ML: %d LI: %d SQ: %d",
            ConClass(cl), ConFreq(cl), PingFreq(cl), MaxLinks(cl), Links(cl), MaxSendq(cl)));
     /*
      * unlink marked classes, delete unreferenced ones
@@ -127,14 +131,15 @@ void class_delete_marked(void)
   }
 }
 
-unsigned int get_conf_class(const struct ConfItem* aconf)
+char*
+get_conf_class(const struct ConfItem* aconf)
 {
   if ((aconf) && (aconf->conn_class))
     return (ConfClass(aconf));
 
   Debug((DEBUG_DEBUG, "No Class For %s", (aconf) ? aconf->name : "*No Conf*"));
 
-  return (BAD_CONF_CLASS);
+  return NULL;
 }
 
 int get_conf_ping(const struct ConfItem* aconf)
@@ -148,24 +153,20 @@ int get_conf_ping(const struct ConfItem* aconf)
   return -1;
 }
 
-unsigned int get_client_class(struct Client *acptr)
+char*
+get_client_class(struct Client *acptr)
 {
   struct SLink *tmp;
   struct ConnectionClass *cl;
-  unsigned int retc = BAD_CLIENT_CLASS;
 
+  /* Return the most recent(first on LL) client class... */
   if (acptr && !IsMe(acptr) && (cli_confs(acptr)))
     for (tmp = cli_confs(acptr); tmp; tmp = tmp->next)
     {
-      if (!tmp->value.aconf || !(cl = tmp->value.aconf->conn_class))
-        continue;
-      if (ConClass(cl) > retc || retc == BAD_CLIENT_CLASS)
-        retc = ConClass(cl);
+      if (tmp->value.aconf && !(cl = tmp->value.aconf->conn_class))
+        return ConClass(cl);
     }
-
-  Debug((DEBUG_DEBUG, "Returning Class %d For %s", retc, cli_name(acptr)));
-
-  return (retc);
+  return "(null-class)";
 }
 
 unsigned int get_client_ping(struct Client *acptr)
@@ -213,14 +214,14 @@ unsigned int get_con_freq(struct ConnectionClass * clptr)
  * if no present entry is found, then create a new one and add it in
  * immeadiately after the first one (class 0).
  */
-void add_class(unsigned int conClass, unsigned int ping, unsigned int confreq,
+void add_class(char *name, unsigned int ping, unsigned int confreq,
                unsigned int maxli, unsigned int sendq)
 {
   struct ConnectionClass* t;
   struct ConnectionClass* p;
 
-  t = find_class(conClass);
-  if ((t == connClassList) && (conClass != 0))
+  t = find_class(name);
+  if ((t == connClassList) && (name != NULL))
   {
     p = (struct ConnectionClass *) make_class();
     p->next = t->next;
@@ -228,30 +229,32 @@ void add_class(unsigned int conClass, unsigned int ping, unsigned int confreq,
   }
   else
     p = t;
-  Debug((DEBUG_DEBUG, "Add Class %u: cf: %u pf: %u ml: %u sq: %d",
-         conClass, confreq, ping, maxli, sendq));
-  ConClass(p) = conClass;
+  Debug((DEBUG_DEBUG, "Add Class %s: cf: %u pf: %u ml: %u sq: %d",
+         name, confreq, ping, maxli, sendq));
+  ConClass(p) = name;
   ConFreq(p) = confreq;
   PingFreq(p) = ping;
   MaxLinks(p) = maxli;
-  MaxSendq(p) = (sendq > 0) ? sendq : feature_int(FEAT_DEFAULTMAXSENDQLENGTH);
+  MaxSendq(p) = (sendq > 0) ?
+     sendq : feature_int(FEAT_DEFAULTMAXSENDQLENGTH);
   p->valid = 1;
   if (p != t)
     Links(p) = 0;
 }
 
-struct ConnectionClass* find_class(unsigned int cclass)
+struct ConnectionClass* find_class(const char *name)
 {
   struct ConnectionClass *cltmp;
 
   for (cltmp = connClassList; cltmp; cltmp = cltmp->next) {
-    if (ConClass(cltmp) == cclass)
+    if (!ircd_strcmp(ConClass(cltmp), name))
       return cltmp;
   }
   return connClassList;
 }
 
-void report_classes(struct Client *sptr)
+void
+report_classes(struct Client *sptr)
 {
   struct ConnectionClass *cltmp;
 
@@ -261,7 +264,8 @@ void report_classes(struct Client *sptr)
               Links(cltmp));
 }
 
-unsigned int get_sendq(struct Client *cptr)
+unsigned int
+get_sendq(struct Client *cptr)
 {
   assert(0 != cptr);
   assert(0 != cli_local(cptr));
@@ -276,7 +280,7 @@ unsigned int get_sendq(struct Client *cptr)
     for (tmp = cli_confs(cptr); tmp; tmp = tmp->next) {
       if (!tmp->value.aconf || !(cl = tmp->value.aconf->conn_class))
         continue;
-      if (ConClass(cl) != BAD_CLIENT_CLASS) {
+      if (ConClass(cl) != NULL) {
         cli_max_sendq(cptr) = MaxSendq(cl);
         return cli_max_sendq(cptr);
       }
index 3696538eaf0018f0296e7ac2c9e55a3bcbc0f0f1..8912a82f705ae93f57cf97db6dec51bb0d212d86 100644 (file)
@@ -229,7 +229,7 @@ static void try_connections(struct Event* ev) {
   struct ConnectionClass* cltmp;
   struct ConfItem*  con_conf    = 0;
   struct Jupe*      ajupe;
-  unsigned int      con_class   = 0;
+  const char*       con_class   = NULL;
 
   assert(ET_EXPIRE == ev_type(ev));
   assert(0 != ev_timer(ev));
@@ -265,7 +265,7 @@ static void try_connections(struct Event* ev) {
     cptr = FindServer(aconf->name);
 
     if (!cptr && (Links(cltmp) < MaxLinks(cltmp)) &&
-        (!connecting || (ConClass(cltmp) > con_class))) {
+        (!connecting /*|| (ConClass(cltmp) > con_class)*/)) {
       /*
        * Check connect rules to see if we're allowed to try
        */
index f4d8464acc9ec9bba466b04b0701549f2fd0107d..4fa9d8a502acb2e3213facd567728182c91aeca2 100644 (file)
@@ -190,7 +190,7 @@ int m_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   /* report all direct connections */
 
   for (i = 0; i <= HighestFd; i++) {
-    unsigned int conClass;
+    const char *conClass;
 
     if (!(acptr = LocalClientArray[i])) /* Local Connection? */
       continue;
@@ -391,7 +391,7 @@ int ms_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   /* report all direct connections */
 
   for (i = 0; i <= HighestFd; i++) {
-    unsigned int conClass;
+    const char *conClass;
 
     if (!(acptr = LocalClientArray[i])) /* Local Connection? */
       continue;
@@ -590,7 +590,7 @@ int mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   /* report all direct connections */
 
   for (i = 0; i <= HighestFd; i++) {
-    unsigned int conClass;
+    const char *conClass;
 
     if (!(acptr = LocalClientArray[i])) /* Local Connection? */
       continue;
index 468a1511728fab89906bab88e5b3511888e5ef25..fe78046d376f944eb54307f1d90b9ab3119d3b5a 100644 (file)
@@ -63,40 +63,27 @@ motd_create(const char *hostmask, const char *path, int maxcount)
 {
   struct Motd* tmp;
   int type = MOTD_UNIVERSAL;
-  const char* s;
-
+  
   assert(0 != path);
-
-  if (hostmask) { /* figure out if it's a class or hostmask */
-    type = MOTD_CLASS; /* all digits, convert to class */
-
-    for (s = hostmask; *s; s++)
-      if (!IsDigit(*s)) { /* not a digit, not a class... */
-       type = MOTD_HOSTMASK;
-       break;
-      }
-  }
-
+  
+  if (hostmask != NULL && find_class(hostmask))
+    type = MOTD_CLASS;
+  else
+    type = MOTD_HOSTMASK;
   /* allocate memory and initialize the structure */
-  if (MotdList.freelist) {
+  if (MotdList.freelist)
+  {
     tmp = MotdList.freelist;
     MotdList.freelist = tmp->next;
   } else
     tmp = (struct Motd *)MyMalloc(sizeof(struct Motd));
-
+  
   tmp->next = 0;
   tmp->type = type;
-
-  switch (type) {
-  case MOTD_HOSTMASK:
-    DupString(tmp->id.hostmask, hostmask);
-    break;
-
-  case MOTD_CLASS:
-    tmp->id.class = atoi(hostmask);
-    break;
-  }
-
+  
+  if (hostmask != NULL)
+    DupString(tmp->hostmask, hostmask);
+  
   DupString(tmp->path, path);
   tmp->maxcount = maxcount;
   tmp->cache = 0;
@@ -213,8 +200,7 @@ motd_destroy(struct Motd *motd)
   assert(0 != motd);
 
   MyFree(motd->path); /* we always must have a path */
-  if (motd->type == MOTD_HOSTMASK) /* free a host mask if any */
-    MyFree(motd->id.hostmask);
+  MyFree(motd->hostmask);
   if (motd->cache) /* drop the cache */
     motd_decache(motd);
 
@@ -229,7 +215,7 @@ static struct Motd *
 motd_lookup(struct Client *cptr)
 {
   struct Motd *ptr;
-  int class = -1;
+  char *class = NULL;
 
   assert(0 != cptr);
 
@@ -238,12 +224,14 @@ motd_lookup(struct Client *cptr)
 
   class = get_client_class(cptr);
 
-  /* check the T-lines first */
-  for (ptr = MotdList.other; ptr; ptr = ptr->next) {
-    if (ptr->type == MOTD_CLASS && ptr->id.class == class)
+  /* check the motd blocks first */
+  for (ptr = MotdList.other; ptr; ptr = ptr->next)
+  {
+    if (ptr->type == MOTD_CLASS &&
+        !match(ptr->hostmask, class))
       return ptr;
-    else if (ptr->type == MOTD_HOSTMASK &&
-            !match(ptr->id.hostmask, cli_sockhost(cptr)))
+    else if (ptr->type == MOTD_HOSTMASK && class != NULL &&
+             !match(ptr->hostmask, cli_sockhost(cptr)))
       return ptr;
   }
 
@@ -366,7 +354,8 @@ motd_clear(void)
   motd_decache(MotdList.remote);
 
   if (MotdList.other) /* destroy other MOTDs */
-    for (ptr = MotdList.other; ptr; ptr = next) {
+    for (ptr = MotdList.other; ptr; ptr = next)
+    { 
       next = ptr->next;
       motd_destroy(ptr);
     }
@@ -384,11 +373,7 @@ motd_report(struct Client *to)
 {
   struct Motd *ptr;
 
-  for (ptr = MotdList.other; ptr; ptr = ptr->next) {
-    if (ptr->type == MOTD_CLASS) /* class requires special handling */
-      send_reply(to, SND_EXPLICIT | RPL_STATSTLINE, "T %d %s", ptr->id.class,
-                ptr->path);
-    else if (ptr->type == MOTD_HOSTMASK)
-      send_reply(to, RPL_STATSTLINE, 'T', ptr->id.hostmask, ptr->path);
-  }
+  for (ptr = MotdList.other; ptr; ptr = ptr->next)
+    send_reply(to, SND_EXPLICIT | RPL_STATSTLINE, "T %s %s",
+               ptr->hostmask, ptr->path);
 }
index e379e61fb2e800b254ba151e0771139b501abdf3..08c451161ee7ae208b9370656e098e1dfd00a5a3 100644 (file)
@@ -196,10 +196,12 @@ static void connect_dns_callback(void* vptr, struct DNSReply* reply)
 void close_connections(int close_stderr)
 {
   int i;
+#if 0
   close(0);
   close(1);
   if (close_stderr)
     close(2);
+#endif
   for (i = 3; i < MAXCONNECTIONS; ++i)
     close(i);
 }
index 4a1cbb096ac8b1826cd639f9f047ee001fbe381f..d1677b1abb44d330302af9f78036db268a602d3f 100644 (file)
@@ -59,7 +59,6 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <netdb.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 struct ConfItem* GlobalConfList  = 0;
 int              GlobalConfCount = 0;
 
-static struct LocalConf   localConf;
-static struct CRuleConf*  cruleConfList;
-static struct ServerConf* serverConfList;
-static struct DenyConf*   denyConfList;
+void yyparse(void);
+int conf_fd, lineno;
+
+struct LocalConf   localConf;
+struct CRuleConf*  cruleConfList;
+/* struct ServerConf* serverConfList; */
+struct DenyConf*   denyConfList;
 
 /*
  * output the reason for being k lined from a file  - Mmmm
@@ -235,7 +237,7 @@ static struct DNSReply* conf_dns_lookup(struct ConfItem* aconf)
  * Do (start) DNS lookups of all hostnames in the conf line and convert
  * an IP addresses in a.b.c.d number for to IP#s.
  */
-static void lookup_confhost(struct ConfItem *aconf)
+void lookup_confhost(struct ConfItem *aconf)
 {
   struct DNSReply* reply;
 
@@ -626,6 +628,7 @@ struct ConfItem* find_conf_byip(struct SLink* lp, const char* ip,
  *
  * - looks for a match on all given fields.
  */
+#if 0
 static struct ConfItem *find_conf_entry(struct ConfItem *aconf,
                                         unsigned int mask)
 {
@@ -661,7 +664,6 @@ static struct ConfItem *find_conf_entry(struct ConfItem *aconf,
   return bconf;
 }
 
-
 /*
  * If conf line is a class definition, create a class entry
  * for it and make the conf_line illegal and delete it.
@@ -778,6 +780,7 @@ void conf_add_crule(const char* const* fields, int count, int type)
     cruleConfList = p;
   } 
 }
+#endif
 
 void conf_erase_crule_list(void)
 {
@@ -799,6 +802,7 @@ const struct CRuleConf* conf_get_crule_list(void)
   return cruleConfList;
 }
 
+#if 0
 void conf_add_server(const char* const* fields, int count)
 {
   struct ServerConf* server;
@@ -895,6 +899,8 @@ void conf_add_deny(const char* const* fields, int count, int ip_kill)
   conf->next = denyConfList;
   denyConfList = conf;
 }
+#endif
+
 
 void conf_erase_deny_list(void)
 {
@@ -928,26 +934,14 @@ const struct DenyConf* conf_get_deny_list(void)
 
 int read_configuration_file(void)
 {
-  enum { MAX_FIELDS = 15 };
-
-  char* src;
-  char* dest;
-  int quoted;
-  FBFILE *file;
-  char line[512];
-  int ccount = 0;
-  struct ConfItem *aconf = 0;
-  
-  int   field_count = 0;
-  const char* field_vector[MAX_FIELDS + 1];
-
-  Debug((DEBUG_DEBUG, "read_configuration_file: ircd.conf = %s", configfile));
-  if (0 == (file = fbopen(configfile, "r"))) {
-    return 0;
-  }
-
   feature_unmark(); /* unmark all features for resetting later */
-
+  /* Now just open an fd. The buffering isn't really needed... */
+  if ((conf_fd = open(configfile, O_RDONLY)) < 0)
+   return 0;
+  lineno = 1;
+  yyparse();
+  close(conf_fd);
+#if 0
   while (fbgets(line, sizeof(line) - 1, file)) {
     if ('#' == *line || IsSpace(*line))
       continue;
@@ -1232,10 +1226,20 @@ int read_configuration_file(void)
     free_conf(aconf);
   fbclose(file);
 /*    nextping = nextconnect = CurrentTime; */
+#endif
   feature_mark(); /* reset unmarked features */
   return 1;
 }
 
+void
+yyerror(const char *msg)
+{
+ sendto_opmask_butone(0, SNO_ALL, "Config file parse error line %d: %s",
+                      lineno, msg);
+ log_write(LS_CONFIG, L_ERROR, 0, "Config file parse error line %d: %s",
+           lineno, msg);
+}
+
 /*
  * rehash
  *
@@ -1418,7 +1422,7 @@ int find_kill(struct Client *cptr)
       break;
 
     if (deny->flags & DENY_FLAGS_REALNAME) { /* K: by real name */
-      if (0 == match(deny->hostmask + 2, realname))
+      if (0 == match(deny->hostmask, realname))
        break;
     } else if (deny->flags & DENY_FLAGS_IP) { /* k: by IP */
       Debug((DEBUG_DEBUG, "ip: %08x network: %08x/%i mask: %08x",
index 08195f80268a7efd6b0cf139a1005e2a98fc6bca..0d91dc659ac3c9ec05bda96c010716b69c78d570 100644 (file)
@@ -434,23 +434,23 @@ static Numeric replyTable[] = {
 /* 200 */
   { RPL_TRACELINK, "Link %s.%s %s %s", "200" },
 /* 201 */
-  { RPL_TRACECONNECTING, "Try. %d %s", "201" },
+  { RPL_TRACECONNECTING, "Try. %s %s", "201" },
 /* 202 */
-  { RPL_TRACEHANDSHAKE, "H.S. %d %s", "202" },
+  { RPL_TRACEHANDSHAKE, "H.S. %s %s", "202" },
 /* 203 */
-  { RPL_TRACEUNKNOWN, "???? %d %s", "203" },
+  { RPL_TRACEUNKNOWN, "???? %s %s", "203" },
 /* 204 */
-  { RPL_TRACEOPERATOR, "Oper %d %s %ld", "204" },
+  { RPL_TRACEOPERATOR, "Oper %s %s %ld", "204" },
 /* 205 */
-  { RPL_TRACEUSER, "User %d %s %ld", "205" },
+  { RPL_TRACEUSER, "User %s %s %ld", "205" },
 /* 206 */
-  { RPL_TRACESERVER, "Serv %d %dS %dC %s %s!%s@%s %ld %ld", "206" },
+  { RPL_TRACESERVER, "Serv %s %dS %dC %s %s!%s@%s %ld %ld", "206" },
 /* 207 */
   { 0 },
 /* 208 */
   { RPL_TRACENEWTYPE, "<newtype> 0 %s", "208" },
 /* 209 */
-  { RPL_TRACECLASS, "Class %d %d", "209" },
+  { RPL_TRACECLASS, "Class %s %d", "209" },
 /* 210 */
   { 0 },
 /* 211 */
@@ -468,7 +468,7 @@ static Numeric replyTable[] = {
 /* 217 */
   { RPL_STATSPLINE, "P %d %d %s %s", "217" },
 /* 218 */
-  { RPL_STATSYLINE, "%c %d %d %d %d %ld %d", "218" },
+  { RPL_STATSYLINE, "%c %s %d %d %d %ld %d", "218" },
 /* 219 */
   { RPL_ENDOFSTATS, "%c :End of /STATS report", "219" },
 /* 220 */
index 89a960d0ad2bd5427011504b1c1394e1dea1128b..2760cad3c5b40c4e14843d72728f4f992d724903 100644 (file)
@@ -170,7 +170,7 @@ const char* get_client_name(const struct Client* sptr, int showip)
   if (MyConnect(sptr)) {
     if (showip)
       ircd_snprintf(0, nbuf, sizeof(nbuf), "%s[%s@%s]", cli_name(sptr),
-            (IsIdented(sptr)) ? cli_username(sptr) : "", cli_sock_ip(sptr));
+            cli_user(sptr)->username, cli_sock_ip(sptr));
     else
         return cli_name(sptr);
     return nbuf;