]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
First phase of conversion to dynamic limits on all the lengths, configured via the...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 25 May 2008 17:30:43 +0000 (17:30 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 25 May 2008 17:30:43 +0000 (17:30 +0000)
(the tag isnt there yet, these all just run on defaults in the class constructor)

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9802 e03df62e-2008-0410-955e-edbf42e46eb7

49 files changed:
configure
include/configreader.h
include/hashcomp.h
include/inspircd.h
make/configure.pm
src/channels.cpp
src/commands/cmd_away.cpp
src/commands/cmd_join.cpp
src/commands/cmd_kick.cpp
src/commands/cmd_kill.cpp
src/commands/cmd_nick.cpp
src/commands/cmd_notice.cpp
src/commands/cmd_oper.cpp
src/commands/cmd_privmsg.cpp
src/commands/cmd_stats.cpp
src/commands/cmd_topic.cpp
src/commands/cmd_user.cpp
src/configreader.cpp
src/cull_list.cpp
src/hashcomp.cpp
src/helperfuncs.cpp
src/mode.cpp
src/modules/m_banredirect.cpp
src/modules/m_chanprotect.cpp
src/modules/m_chgident.cpp
src/modules/m_chgname.cpp
src/modules/m_conn_join.cpp
src/modules/m_denychans.cpp
src/modules/m_ident.cpp
src/modules/m_nicklock.cpp
src/modules/m_operjoin.cpp
src/modules/m_redirect.cpp
src/modules/m_sajoin.cpp
src/modules/m_sanick.cpp
src/modules/m_setident.cpp
src/modules/m_setname.cpp
src/modules/m_spanningtree/capab.cpp
src/modules/m_spanningtree/fjoin.cpp
src/modules/m_spanningtree/ftopic.cpp
src/modules/m_spanningtree/netburst.cpp
src/modules/m_spanningtree/opertype.cpp
src/modules/m_spanningtree/svsjoin.cpp
src/modules/m_spanningtree/svspart.cpp
src/modules/m_spanningtree/uid.cpp
src/modules/m_svshold.cpp
src/modules/m_watch.cpp
src/server.cpp
src/usermanager.cpp
src/users.cpp

index d0c7d535640b3f3f89ace9c3e3a501740e0dcbb7..64f80824d07f3c6af9c7f96e9e1933fb3a51494d 100755 (executable)
--- a/configure
+++ b/configure
@@ -97,12 +97,10 @@ our %extraobjects = ();
 
 our %extrasources = ();
 
-our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_nick_length,
-    $opt_chan_length, $opt_ports, $opt_epoll, $opt_kqueue, $opt_noports,
-    $opt_noepoll, $opt_nokqueue, $opt_disablerpath, $opt_ipv6, $opt_ipv6links,
-    $opt_noipv6links, $opt_ident, $opt_quit, $opt_topic, $opt_maxbuf, $opt_kick,
-    $opt_gecos, $opt_away, $opt_modes, $opt_disable_debug, $opt_maxchans,
-    $opt_opermaxchans, $opt_freebsd_port);
+our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_ports,
+    $opt_epoll, $opt_kqueue, $opt_noports, $opt_noepoll, $opt_nokqueue, $opt_disablerpath,
+    $opt_ipv6, $opt_ipv6links, $opt_noipv6links, $opt_maxbuf, $opt_disable_debug,
+    $opt_freebsd_port);
 
 our ($opt_cc, $opt_base_dir, $opt_config_dir, $opt_module_dir, $opt_binary_dir,
     $opt_library_dir);
@@ -121,8 +119,6 @@ GetOptions (
        'rebuild' => \$opt_rebuild,
        'enable-openssl' => \$opt_use_openssl,
        'disable-interactive' => \$opt_nointeractive,
-       'with-nick-length=i' => \$opt_nick_length,
-       'with-channel-length=i' => \$opt_chan_length,
        'enable-ports' => \$opt_ports,
        'enable-epoll' => \$opt_epoll,
        'enable-kqueue' => \$opt_kqueue,
@@ -134,14 +130,7 @@ GetOptions (
        'enable-remote-ipv6' => \$opt_ipv6links,
        'disable-remote-ipv6' => \$opt_noipv6links,
        'with-cc=s' => \$opt_cc,
-       'with-ident-length=i' => \$opt_ident,
-       'with-quit-length=i' => \$opt_quit,
-       'with-topic-length=i' => \$opt_topic,
        'with-maxbuf=i' => \$opt_maxbuf,
-       'with-kick-length=i' => \$opt_kick,
-       'with-gecos-length=i' => \$opt_gecos,
-       'with-away-length=i' => \$opt_away,
-       'with-max-modes=i' => \$opt_modes,
        'enable-freebsd-ports-openssl' => \$opt_freebsd_port,
        'prefix=s' => \$opt_base_dir,
        'config-dir=s' => \$opt_config_dir,
@@ -178,13 +167,6 @@ our $non_interactive = (
        (defined $opt_base_dir) ||
        (defined $opt_binary_dir) ||
        (defined $opt_nointeractive) ||
-       (defined $opt_away) ||
-       (defined $opt_gecos) ||
-       (defined $opt_kick) ||
-       (defined $opt_modes) ||
-       (defined $opt_topic) ||
-       (defined $opt_quit) ||
-       (defined $opt_ident) ||
        (defined $opt_cc) ||
        (defined $opt_ipv6) ||
        (defined $opt_ipv6links) ||
@@ -192,10 +174,6 @@ our $non_interactive = (
        (defined $opt_kqueue) ||
        (defined $opt_epoll) ||
        (defined $opt_ports) ||
-       (defined $opt_maxchans) ||
-       (defined $opt_opermaxchans) ||
-       (defined $opt_chan_length) ||
-       (defined $opt_nick_length) ||
        (defined $opt_use_openssl) ||
        (defined $opt_nokqueue) ||
        (defined $opt_noepoll) ||
@@ -287,21 +265,6 @@ else
        $config{OPTIMISATI}      = "-O2";                               # DEBUGGING OFF!
 }
 
-$config{NICK_LENGT}     = "31";                                        # Default Nick Length
-if (defined $opt_nick_length)
-{
-       $config{NICK_LENGT} = $opt_nick_length;
-}
-$config{CHAN_LENGT}     = "64";                                        # Default Channel Name Length
-if (defined $opt_chan_length)
-{
-       $config{CHAN_LENGT} = $opt_chan_length;
-}
-$config{MAXI_MODES}     = "20";                                        # Default Max. Number of Modes set at once.
-if (defined $opt_modes)
-{
-       $config{MAXI_MODES} = $opt_modes;
-}
 $config{HAS_STRLCPY}   = "false";                                      # strlcpy Check.
 $config{HAS_STDINT}     = "false";                                     # stdint.h check
 $config{USE_KQUEUE}     = "y";                                         # kqueue enabled
@@ -367,37 +330,7 @@ if (defined $opt_cc)
 our $exec = $config{CC} . " -dumpversion | cut -c 1";
 chomp($config{GCCVER}          = `$exec`);                             # Major GCC Version
 $config{MAKEORDER}             = "ircd mods";                          # build order
-$config{MAX_IDENT}             = "12";                                 # max ident size
-$config{MAX_QUIT}              = "255";                                # max quit message size
-$config{MAX_TOPIC}             = "307";                                # max topic size
-$config{MAX_KICK}              = "255";                                # max kick message size
-$config{MAX_GECOS}             = "128";                                # max GECOS size
-$config{MAX_AWAY}              = "200";                                # max AWAY size
 $config{MAXBUF}                        = "512";                                # Max buffer size
-if (defined $opt_ident)
-{
-       $config{MAX_IDENT} = $opt_ident;
-}
-if (defined $opt_quit)
-{
-       $config{MAX_QUIT} = $opt_quit;
-}
-if (defined $opt_topic)
-{
-       $config{MAX_TOPIC} = $opt_topic;
-}
-if (defined $opt_kick)
-{
-       $config{MAX_KICK} = $opt_kick;
-}
-if (defined $opt_gecos)
-{
-       $config{MAX_GECOS} = $opt_gecos;
-}
-if (defined $opt_away)
-{
-       $config{MAX_AWAY} = $opt_away;
-}
 
 if ($config{HAS_OPENSSL} =~ /^([-[:digit:].]+)([a-z])?(\-[a-z][0-9])?$/) {
        $config{HAS_OPENSSL} = $1;
@@ -929,24 +862,6 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
        else {
                print "\nCould not detect OpenSSL or GnuTLS. Make sure pkg-config is installed if\nyou intend to use OpenSSL, or that GnuTLS is in your path if you intend\nto use GnuTLS.\n\n";
        }
-
-       print "\nThe following questions will ask you for various figures relating\n";
-       print "To your IRCd install. Please note that these should usually be left\n";
-       print "as defaults unless you have a real reason to change them. If they\n";
-       print "changed, then the values must be identical on all servers on your\n";
-       print "network, or malfunctions and/or crashes may occur, with the exception\n";
-       print "of the 'maximum number of clients' setting which may be different on\n";
-       print "different servers on the network.\n\n";
-
-       promptnumeric("length of nicknames", "NICK_LENGT");
-       promptnumeric("length of channel names", "CHAN_LENGT");
-       promptnumeric("number of mode changes in one line", "MAXI_MODES");
-       promptnumeric("length of an ident (username)", "MAX_IDENT");
-       promptnumeric("length of a quit message", "MAX_QUIT");
-       promptnumeric("length of a channel topic", "MAX_TOPIC");
-       promptnumeric("length of a kick message", "MAX_KICK");
-       promptnumeric("length of a GECOS (real name)", "MAX_GECOS");
-       promptnumeric("length of an away message", "MAX_AWAY");
 }
 
 dumphash();
@@ -1223,8 +1138,6 @@ sub writefiles {
        {
                print "Writing \e[1;32minspircd_config.h\e[0m\n";
                open(FILEHANDLE, ">include/inspircd_config.h");
-               my $NL = $config{NICK_LENGT}+1;
-               my $CL = $config{CHAN_LENGT}+1;
                print FILEHANDLE <<EOF;
 /* Auto generated by configure, do not modify! */
 #ifndef __CONFIGURATION_AUTO__
@@ -1239,15 +1152,6 @@ sub writefiles {
 #define VERSION "$version"
 #define REVISION "$revision2"
 #define SOMAXCONN_S "$config{_SOMAXCONN}"
-#define NICKMAX $NL
-#define CHANMAX $CL
-#define MAXMODES $config{MAXI_MODES}
-#define IDENTMAX $config{MAX_IDENT}
-#define MAXQUIT $config{MAX_QUIT}
-#define MAXTOPIC $config{MAX_TOPIC}
-#define MAXKICK $config{MAX_KICK}
-#define MAXGECOS $config{MAX_GECOS}
-#define MAXAWAY $config{MAX_AWAY}
 #define OPTIMISATION $config{OPTIMITEMP}
 #define LIBRARYDIR "$config{LIBRARY_DIR}"
 #define SYSTEM "$incos"
index 7fc60203d9116b736798206744722a35b648c74d..56a2ee6988185d3b82894acb9dbb2d573e251514 100644 (file)
@@ -226,6 +226,28 @@ struct operclass_data : public Extensible
 typedef std::map<irc::string, operclass_data> operclass_t;
 
 
+class ServerLimits : public Extensible
+{
+ public:
+       size_t NickMax;
+       size_t ChanMax;
+       size_t MaxModes;
+       size_t IdentMax;
+       size_t MaxQuit;
+       size_t MaxTopic;
+       size_t MaxKick;
+       size_t MaxGecos;
+       size_t MaxAway;
+
+       /* Creating the class initialises it to the defaults
+        * as in 1.1's ./configure script. Reading other values
+        * from the config will change these values.
+        */
+       ServerLimits() : NickMax(31), ChanMax(64), MaxModes(20), IdentMax(12), MaxQuit(255), MaxTopic(307), MaxKick(255), MaxGecos(128), MaxAway(200)
+       {
+       }
+};
+
 /** This class holds the bulk of the runtime configuration for the ircd.
  * It allows for reading new config values, accessing configuration files,
  * and storage of the configuration data needed to run the ircd, such as
@@ -275,11 +297,6 @@ class CoreExport ServerConfig : public Extensible
 
        std::map<std::string, std::istream*> IncludedFiles;
 
-       std::map<std::string, bool> CompletedFiles;
-
-       size_t TotalDownloaded;
-       size_t FileErrors;
-
        /** Used to indicate who we announce invites to on a channel */
        enum InviteAnnounceState { INVITE_ANNOUNCE_NONE, INVITE_ANNOUNCE_ALL, INVITE_ANNOUNCE_OPS, INVITE_ANNOUNCE_DYNAMIC };
 
@@ -295,6 +312,8 @@ class CoreExport ServerConfig : public Extensible
         */
        ConfigDataHash config_data;
 
+       ServerLimits Limits;
+
        /** Max number of WhoWas entries per user.
         */
        int WhoWasGroupSize;
index 4eb65823db6e775743a18ff7aebe37f5ebe399d0..928abe809c8b8018433f001ca8d2665608fdb248 100644 (file)
@@ -174,6 +174,7 @@ namespace irc
        class CoreExport modestacker : public classbase
        {
         private:
+               InspIRCd* ServerInstance;
                /** The mode sequence and its parameters
                 */
                std::deque<std::string> sequence;
@@ -187,7 +188,7 @@ namespace irc
                 * @param add True if the stack is adding modes,
                 * false if it is removing them
                 */
-               modestacker(bool add);
+               modestacker(InspIRCd* Instance, bool add);
                /** Push a modeletter and its parameter onto the stack.
                 * No checking is performed as to if this mode actually
                 * requires a parameter. If you stack invalid mode
index e729a0b2af122f827cc7bbca71a01a0b8f6192f2..9d7c8e6e1a129c93886c89fac2cdc941e8f53c5f 100644 (file)
@@ -230,11 +230,11 @@ typedef std::vector<std::pair<std::string, long> > FailedPortList;
 class InspIRCd;
 
 DEFINE_HANDLER1(ProcessUserHandler, void, User*);
-DEFINE_HANDLER1(IsNickHandler, bool, const char*);
+DEFINE_HANDLER2(IsNickHandler, bool, const char*, size_t);
 DEFINE_HANDLER1(IsIdentHandler, bool, const char*);
 DEFINE_HANDLER1(FindDescriptorHandler, User*, int);
 DEFINE_HANDLER1(FloodQuitUserHandler, void, User*);
-DEFINE_HANDLER1(IsChannelHandler, bool, const char*);
+DEFINE_HANDLER2(IsChannelHandler, bool, const char*, size_t);
 DEFINE_HANDLER1(IsSIDHandler, bool, const std::string&);
 DEFINE_HANDLER1(RehashHandler, void, const std::string&);
 
@@ -585,7 +585,7 @@ class CoreExport InspIRCd : public classbase
         * @param chname A channel name to verify
         * @return True if the name is valid
         */
-       caller1<bool, const char*> IsChannel;
+       caller2<bool, const char*, size_t> IsChannel;
 
        /** Return true if str looks like a server ID
         * @param string to check against
@@ -633,7 +633,7 @@ class CoreExport InspIRCd : public classbase
         * @param n A nickname to verify
         * @return True if the nick is valid
         */
-       caller1<bool, const char*> IsNick;
+       caller2<bool, const char*, size_t> IsNick;
 
        /** Return true if an ident is valid
         * @param An ident to verify
index 4f176324c2b52c2675d45787f94c961524b5f8c3..ab440f07fc85a7d78582b324fd0af48eff0cdd19 100644 (file)
@@ -193,21 +193,15 @@ sub dumphash()
        print "\e[0mConfig path:\e[1;32m\t\t\t$main::config{CONFIG_DIR}\e[0m\n";
        print "\e[0mModule path:\e[1;32m\t\t\t$main::config{MODULE_DIR}\e[0m\n";
        print "\e[0mLibrary path:\e[1;32m\t\t\t$main::config{LIBRARY_DIR}\e[0m\n";
-       print "\e[0mMax nickname length:\e[1;32m\t\t$main::config{NICK_LENGT}\e[0m\n";
-       print "\e[0mMax channel length:\e[1;32m\t\t$main::config{CHAN_LENGT}\e[0m\n";
-       print "\e[0mMax mode length:\e[1;32m\t\t$main::config{MAXI_MODES}\e[0m\n";
-       print "\e[0mMax ident length:\e[1;32m\t\t$main::config{MAX_IDENT}\e[0m\n";
-       print "\e[0mMax quit length:\e[1;32m\t\t$main::config{MAX_QUIT}\e[0m\n";
-       print "\e[0mMax topic length:\e[1;32m\t\t$main::config{MAX_TOPIC}\e[0m\n";
-       print "\e[0mMax kick length:\e[1;32m\t\t$main::config{MAX_KICK}\e[0m\n";
-       print "\e[0mMax name length:\e[1;32m\t\t$main::config{MAX_GECOS}\e[0m\n";
-       print "\e[0mMax away length:\e[1;32m\t\t$main::config{MAX_AWAY}\e[0m\n";
        print "\e[0mGCC Version Found:\e[1;32m\t\t$main::config{GCCVER}.x\e[0m\n";
        print "\e[0mCompiler program:\e[1;32m\t\t$main::config{CC}\e[0m\n";
        print "\e[0mIPv6 Support:\e[1;32m\t\t\t$main::config{IPV6}\e[0m\n";
        print "\e[0mIPv6 to IPv4 Links:\e[1;32m\t\t$main::config{SUPPORT_IP6LINKS}\e[0m\n";
        print "\e[0mGnuTLS Support:\e[1;32m\t\t\t$main::config{USE_GNUTLS}\e[0m\n";
        print "\e[0mOpenSSL Support:\e[1;32m\t\t$main::config{USE_OPENSSL}\e[0m\n\n";
+       print "\e[1;32mImportant note: The maximum length values are now configured in the\e[0m\n";
+       print "\e[1;32m                configuration file, not in ./configure! See the <limits>\e[0m\n";
+       print "\e[1;32m                tag in the configuration file for more information.\e[0m\n\n";
 }
 
 sub is_dir
@@ -258,8 +252,6 @@ InspIRCd 1.0.x, are also allowed.
   --clean                      Remove .config.cache file and go interactive
   --enable-gnutls              Enable GnuTLS module [no]
   --enable-openssl             Enable OpenSSL module [no]
-  --with-nick-length=[n]       Specify max. nick length [32]
-  --with-channel-length=[n]    Specify max. channel length [64]
   --enable-optimization=[n]    Optimize using -O[n] gcc flag
   --enable-epoll               Enable epoll() where supported [set]
   --enable-kqueue              Enable kqueue() where supported [set]
@@ -273,14 +265,6 @@ InspIRCd 1.0.x, are also allowed.
   --disable-remote-ipv6        Do not allow remote ipv6 servers [not set]
   --with-cc=[filename]         Use an alternative g++ binary to
                                build InspIRCd [g++]
-  --with-ident-length=[n]      Specify max length of ident [12]
-  --with-quit-length=[n]       Specify max length of quit [200]
-  --with-topic-length=[n]      Specify max length of topic [350]
-  --with-kick-length=[n]       Specify max length of kick [200]
-  --with-gecos-length=[n]      Specify max length of gecos [150]
-  --with-away-length=[n]       Specify max length of away [150]
-  --with-max-modes=[n]         Specify max modes per line which
-                               have parameters [20]
   --with-maxbuf=[n]            Change the per message buffer size [512]
                                DO NOT ALTER THIS OPTION WITHOUT GOOD REASON
                                AS IT *WILL* BREAK CLIENTS!!!
index f0cd66dbf29af66d53ec09facde8dd2c2c1c48ab..d03f80f64e0c40edbe95df45fa36b7b6ac84d7a3 100644 (file)
@@ -25,7 +25,7 @@ Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts) : Serv
                throw CoreException("Cannot create duplicate channel " + cname);
 
        (*(ServerInstance->chanlist))[cname.c_str()] = this;
-       this->name.assign(cname, 0, CHANMAX);
+       this->name.assign(cname, 0, ServerInstance->Config->Limits.ChanMax);
        this->created = ts ? ts : ServerInstance->Time();
        this->age = this->created;
 
@@ -254,7 +254,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
                }
        }
 
-       strlcpy(cname, cn, CHANMAX);
+       strlcpy(cname, cn, Instance->Config->Limits.ChanMax);
        Ptr = Instance->FindChan(cname);
 
        if (!Ptr)
@@ -917,7 +917,7 @@ void Channel::UserList(User *user, CUList *ulist)
                
                size_t ptrlen = 0;
 
-               if (curlen > (480-NICKMAX))
+               if (curlen + prefixlist.length() + nick.length() + 1 > 480)
                {
                        /* list overflowed into multiple numerics */
                        user->WriteServ(std::string(list));
index 7fac7ae6d382792f05e9e07b3e8846924ae40fc7..6dccf97598289e64d181fad7da7e4d4233cd93bc 100644 (file)
@@ -33,7 +33,7 @@ CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User
                        return CMD_FAILURE;
 
                user->awaytime = ServerInstance->Time();
-               user->awaymsg.assign(parameters[0], 0, MAXAWAY);
+               user->awaymsg.assign(parameters[0], 0, ServerInstance->Config->Limits.MaxAway);
 
                user->WriteNumeric(306, "%s :You have been marked as being away",user->nick.c_str());
        }
index b270075075745aa7ea7c532b31d1a286855d6a21..c19e7c015410055a6816d3f8e9d6965b92559316 100644 (file)
@@ -28,7 +28,7 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User
                if (ServerInstance->Parser->LoopCall(user, this, parameters, 0, 1))
                        return CMD_SUCCESS;
 
-               if (ServerInstance->IsChannel(parameters[0].c_str()))
+               if (ServerInstance->IsChannel(parameters[0].c_str(), ServerInstance->Config->Limits.ChanMax))
                {
                        Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, parameters[1].c_str(), false);
                        return CMD_SUCCESS;
@@ -39,7 +39,7 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User
                if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
                        return CMD_SUCCESS;
 
-               if (ServerInstance->IsChannel(parameters[0].c_str()))
+               if (ServerInstance->IsChannel(parameters[0].c_str(), ServerInstance->Config->Limits.ChanMax))
                {
                        Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, "", false);
                        return CMD_SUCCESS;
index 174800cf5de03b41419d438bd156bc34d7afce2a..a0ff5d1c3e64fd6d469f29b85b03547f9375499d 100644 (file)
@@ -23,7 +23,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
  */
 CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User *user)
 {
-       char reason[MAXKICK];
+       std::string reason;
        Channel* c = ServerInstance->FindChan(parameters[0]);
        User* u = ServerInstance->FindNick(parameters[1]);
 
@@ -44,14 +44,14 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User
 
        if (parameters.size() > 2)
        {
-               strlcpy(reason, parameters[2].c_str(), MAXKICK - 1);
+               reason.assign(parameters[2], 0, ServerInstance->Config->Limits.MaxKick);
        }
        else
        {
-               strlcpy(reason, user->nick.c_str(), MAXKICK - 1);
+               reason.assign(user->nick, 0, ServerInstance->Config->Limits.MaxKick);
        }
 
-       if (!c->KickUser(user, u, reason))
+       if (!c->KickUser(user, u, reason.c_str()))
                /* Nobody left here, delete the Channel */
                delete c;
 
index f656c570178525d596b98057e43b220393998b0d..02e80b4f2de28c161b181acc64c6167500fd8bbb 100644 (file)
@@ -54,18 +54,18 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
                        if (*ServerInstance->Config->HideKillsServer)
                        {
                                // hidekills is on, use it
-                               snprintf(killreason, MAXQUIT, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer, parameters[1].c_str());
+                               snprintf(killreason, ServerInstance->Config->Limits.MaxQuit, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer, parameters[1].c_str());
                        }
                        else
                        {
                                // hidekills is off, do nothing
-                               snprintf(killreason, MAXQUIT, "Killed (%s (%s))", user->nick.c_str(), parameters[1].c_str());
+                               snprintf(killreason, ServerInstance->Config->Limits.MaxQuit, "Killed (%s (%s))", user->nick.c_str(), parameters[1].c_str());
                        }
                }
                else
                {
                        /* Leave it alone, remote server has already formatted it */
-                       strlcpy(killreason, parameters[1].c_str(), MAXQUIT);
+                       strlcpy(killreason, parameters[1].c_str(), ServerInstance->Config->Limits.MaxQuit);
                }
 
                /*
index 0391323dc3af86fe0503270f9d6a1d28b820fa15..0eb55ccfe7ee0d2cc40fa91f9086dff2d2175181 100644 (file)
@@ -27,7 +27,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
  */
 CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User *user)
 {
-       char oldnick[NICKMAX];
+       std::string oldnick;
 
        if (parameters[0].empty())
        {
@@ -36,7 +36,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
                return CMD_FAILURE;
        }
 
-       if (((!ServerInstance->IsNick(parameters[0].c_str()))) && (IS_LOCAL(user)))
+       if (((!ServerInstance->IsNick(parameters[0].c_str(), ServerInstance->Config->Limits.NickMax))) && (IS_LOCAL(user)))
        {
                if (!allowinvalid)
                {
@@ -59,11 +59,9 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
 
        if (assign(user->nick) == parameters[0])
        {
-               ServerInstance->Logs->Log("nick", DEBUG, "Change to same nick '%s' %d '%s' '%d'", user->nick.c_str(), user->nick.length(), parameters[0].c_str(), parameters[0].length());
                /* If its exactly the same, even case, dont do anything. */
                if (parameters[0] == user->nick)
                {
-                       ServerInstance->Logs->Log("nick", DEBUG, "Not even a case change");
                        return CMD_SUCCESS;
                }
 
@@ -71,14 +69,14 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
                 * able to do silly things like this even though the RFC says
                 * the nick AAA is the same as the nick aaa.
                 */
-               strlcpy(oldnick, user->nick.c_str(), NICKMAX - 1);
+               oldnick.assign(user->nick, 0, ServerInstance->Config->Limits.NickMax);
                int MOD_RESULT = 0;
-               FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0].c_str()));
+               FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
                if (MOD_RESULT)
                        return CMD_FAILURE;
                if (user->registered == REG_ALL)
                        user->WriteCommon("NICK %s",parameters[0].c_str());
-               user->nick.assign(parameters[0], 0, NICKMAX - 1);
+               user->nick.assign(parameters[0], 0, ServerInstance->Config->Limits.NickMax);
                user->InvalidateCache();
                FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
                return CMD_SUCCESS;
@@ -122,7 +120,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
                                InUse->WriteTo(InUse, "NICK %s", InUse->uuid.c_str());
                                InUse->WriteNumeric(433, "%s %s :Nickname overruled.", InUse->nick.c_str(), InUse->nick.c_str());
                                InUse->UpdateNickHash(InUse->uuid.c_str());
-                               InUse->nick.assign(InUse->uuid, 0, NICKMAX - 1);
+                               InUse->nick.assign(InUse->uuid, 0, ServerInstance->Config->Limits.NickMax);
                                InUse->InvalidateCache();
                                InUse->registered &= ~REG_NICK;
                        }
@@ -145,7 +143,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
        if (user->registered == REG_ALL)
                user->WriteCommon("NICK %s", parameters[0].c_str());
 
-       strlcpy(oldnick, user->nick.c_str(), NICKMAX - 1);
+       oldnick.assign(user->nick, 0, ServerInstance->Config->Limits.NickMax);
 
        /* change the nick of the user in the users_hash */
        user = user->UpdateNickHash(parameters[0].c_str());
@@ -154,7 +152,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
        if (!user)
                return CMD_FAILURE;
 
-       user->nick.assign(parameters[0], 0, NICKMAX - 1);
+       user->nick.assign(parameters[0], 0, ServerInstance->Config->Limits.NickMax);
        user->InvalidateCache();
 
        /* Update display nicks */
@@ -181,7 +179,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
        if (user->registered == REG_ALL)
        {
                user->IncreasePenalty(10);
-               FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
+               FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user, oldnick));
        }
 
        return CMD_SUCCESS;
index 5086f3f4fb8b866bfe63c8764777506e70ce479c..9cf4800a437200aa4e9f418cdbf9abde0db511f3 100644 (file)
@@ -130,8 +130,9 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
 
                if (targetserver)
                {
-                       char nickonly[NICKMAX+1];
-                       strlcpy(nickonly, destnick, targetserver - destnick + 1);
+                       std::string nickonly;
+
+                       nickonly.assign(destnick, 0, targetserver - destnick + 1);
                        dest = ServerInstance->FindNickOnly(nickonly);
                        if (dest && strcasecmp(dest->server, targetserver + 1))
                        {
index 1ce7dc49de541ed2295674966455a91e810fc063..97134f0389fa5116e2e85c6c6098571c519c1629 100644 (file)
@@ -80,7 +80,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
                                if (!strcmp(TypeName,OperType))
                                {
                                        /* found this oper's opertype */
-                                       if (!ServerInstance->IsNick(TypeName))
+                                       if (!ServerInstance->IsNick(TypeName, ServerInstance->Config->Limits.NickMax))
                                        {
                                                user->WriteNumeric(491, "%s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick.c_str());
                                                ServerInstance->SNO->WriteToSnoMask('o',"CONFIGURATION ERROR! Oper type '%s' contains invalid characters",OperType);
index 842635ae27bbfe8cad5aed1a97b2ed8c0c7718ab..0086bb72debb4264baa8995f578b2a1cce83b8d9 100644 (file)
@@ -132,8 +132,9 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
        
                if (targetserver)
                {
-                       char nickonly[NICKMAX+1];
-                       strlcpy(nickonly, destnick, targetserver - destnick + 1);
+                       std::string nickonly;
+
+                       nickonly.assign(destnick, 0, targetserver - destnick + 1);
                        dest = ServerInstance->FindNickOnly(nickonly);
                        if (dest && strcasecmp(dest->server, targetserver + 1))
                        {
index 9da5f1aeba8204a4f3fa8d31eeb455c7239081db..fafa9758174d4ff99b34d3905fee189f233adbcb 100644 (file)
@@ -264,10 +264,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str
                        for (std::vector<User*>::iterator n = ServerInstance->Users->local_users.begin(); n != ServerInstance->Users->local_users.end(); n++)
                        {
                                User* i = *n;
-                               if (ServerInstance->IsNick(i->nick.c_str()))
-                               {
-                                       results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->dhost+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
-                               }
+                               results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->dhost+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
                        }
                break;
 
@@ -277,10 +274,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str
                        for (std::vector<User*>::iterator n = ServerInstance->Users->local_users.begin(); n != ServerInstance->Users->local_users.end(); n++)
                        {
                                User* i = *n;
-                               if (ServerInstance->IsNick(i->nick.c_str()))
-                               {
-                                       results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->GetIPString()+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
-                               }
+                               results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->GetIPString()+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
                        }
                break;
 
index e723a50c9948d2f022375836accb9f454c2b6966..0e1a115da81494a0f7f035dd6574414c16515808 100644 (file)
@@ -70,7 +70,7 @@ CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User
                                }
                        }
 
-                       char topic[MAXTOPIC];
+                       std::string topic;
 
                        if (IS_LOCAL(user))
                        {
@@ -79,17 +79,17 @@ CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User
                                 */
                                int MOD_RESULT = 0;
 
-                               strlcpy(topic, parameters[1].c_str(), MAXTOPIC);
+                               topic.assign(parameters[1], 0, ServerInstance->Config->Limits.MaxTopic);
                                FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(user,Ptr,topic));
                                if (MOD_RESULT)
                                        return CMD_FAILURE;
 
-                               Ptr->topic.assign(topic, 0, MAXTOPIC);
+                               Ptr->topic.assign(topic, 0, ServerInstance->Config->Limits.MaxTopic);
                        }
                        else
                        {
                                /* Sneaky shortcut, one string copy for a remote topic */
-                               Ptr->topic.assign(parameters[1], 0, MAXTOPIC);
+                               Ptr->topic.assign(parameters[1], 0, ServerInstance->Config->Limits.MaxTopic);
                        }
 
                        Ptr->setby.assign(ServerInstance->Config->FullHostInTopic ?
index 1acd901f9a5c1cf61f04fd34e31088833b89764c..7bc9307f614191f49e438981b01a1efe57693d77 100644 (file)
@@ -40,14 +40,14 @@ CmdResult CommandUser::Handle (const std::vector<std::string>& parameters, User
                         * ~ character, and +1 for null termination, therefore we can safely use up to
                         * IDENTMAX here.
                         */
-                       user->ident.assign(parameters[0], 0, IDENTMAX);
-                       user->fullname.assign(parameters[3].empty() ? std::string("No info") : parameters[3], 0, MAXGECOS);
+                       user->ident.assign(parameters[0], 0, ServerInstance->Config->Limits.IdentMax);
+                       user->fullname.assign(parameters[3].empty() ? std::string("No info") : parameters[3], 0, ServerInstance->Config->Limits.MaxGecos);
                        user->registered = (user->registered | REG_USER);
                }
        }
        else
        {
-               user->WriteNumeric(462, "%s :You may not reregister",user->nick.c_str());
+               user->WriteNumeric(462, "%s :You may not reregister", user->nick.c_str());
                return CMD_FAILURE;
        }
 
index e184353160270898964ac22f8b3409820ae36865..76aae190b7f38e649cd0ea1ee61135a978023f9b 100644 (file)
@@ -1009,7 +1009,7 @@ void ServerConfig::Read(bool bail, User* user)
                                case DT_CHANNEL:
                                {
                                        ValueContainerChar* vcc = (ValueContainerChar*)Values[Index].val;
-                                       if (*(vi.GetString()) && !ServerInstance->IsChannel(vi.GetString()))
+                                       if (*(vi.GetString()) && !ServerInstance->IsChannel(vi.GetString(), MAXBUF))
                                        {
                                                ServerInstance->Threads->Mutex(false);
                                                throw CoreException("The value of <"+std::string(Values[Index].tag)+":"+Values[Index].value+"> is not a valid channel name");
@@ -1114,7 +1114,7 @@ void ServerConfig::Read(bool bail, User* user)
                                                                        vl.push_back(ValueItem(item));
                                                                else
                                                                        vl.push_back(ValueItem(""));
-                                                               if (!ServerInstance->IsChannel(vl[vl.size()-1].GetString()))
+                                                               if (!ServerInstance->IsChannel(vl[vl.size()-1].GetString(), MAXBUF))
                                                                        throw CoreException("The value of <"+std::string(MultiValues[Index].tag)+":"+MultiValues[Index].items[valuenum]+"> number "+ConvToStr(tagnum + 1)+" is not a valid channel name");
                                                        }
                                                        break;
index ddbf6acae8e7d12980c3efeb8a5f69e2418d92d2..a7f8d3316c6375d0ab396679fbb47632cbe54150 100644 (file)
@@ -54,8 +54,8 @@ int CullList::Apply()
                std::string reason;
                std::string oper_reason;
 
-               reason.assign(u->quitmsg, 0, MAXQUIT - 1);
-               oper_reason.assign(preset_reason.empty() ? preset_reason : u->operquitmsg, 0, MAXQUIT - 1);
+               reason.assign(u->quitmsg, 0, ServerInstance->Config->Limits.MaxQuit);
+               oper_reason.assign(preset_reason.empty() ? preset_reason : u->operquitmsg, 0, ServerInstance->Config->Limits.MaxQuit);
 
                if (u->registered != REG_ALL)
                        if (ServerInstance->Users->unregistered_count)
index a27a83f64ff89ef589b4ad540a7cf80f09be0d9f..19f2d601c410e7c6585c688b35003a8a02ef0345 100644 (file)
@@ -318,7 +318,7 @@ CoreExport const char* irc::Spacify(const char* n)
 }
 
 
-irc::modestacker::modestacker(bool add) : adding(add)
+irc::modestacker::modestacker(InspIRCd* Instance, bool add) : ServerInstance(Instance), adding(add)
 {
        sequence.clear();
        sequence.push_back("");
@@ -362,7 +362,7 @@ int irc::modestacker::GetStackedLine(std::deque<std::string> &result, int max_li
        if (sequence.size() > 1)
                nextsize = sequence[1].length() + 2;
 
-       while (!sequence[0].empty() && (sequence.size() > 1) && (result.size() < MAXMODES) && ((size + nextsize) < max_line_size))
+       while (!sequence[0].empty() && (sequence.size() > 1) && (result.size() < ServerInstance->Config->Limits.MaxModes) && ((size + nextsize) < max_line_size))
        {
                result[0] += *(sequence[0].begin());
                if (!sequence[1].empty())
index 8b93be24500e9cb681aaf8d8a7155f2459f088ee..d46f53ec7fa7c1c3567e6e42fecc467ee74f909b 100644 (file)
@@ -182,9 +182,9 @@ bool InspIRCd::IsValidMask(const std::string &mask)
 }
 
 /* true for valid channel name, false else */
-bool IsChannelHandler::Call(const char *chname)
+bool IsChannelHandler::Call(const char *chname, size_t max)
 {
-       char *c;
+       const char *c = chname + 1;
 
        /* check for no name - don't check for !*chname, as if it is empty, it won't be '#'! */
        if (!chname || *chname != '#')
@@ -192,7 +192,6 @@ bool IsChannelHandler::Call(const char *chname)
                return false;
        }
 
-       c = (char *)chname + 1;
        while (*c)
        {
                switch (*c)
@@ -205,9 +204,10 @@ bool IsChannelHandler::Call(const char *chname)
 
                c++;
        }
-               
+
+       size_t len = c - chname;        
        /* too long a name - note funky pointer arithmetic here. */
-       if ((c - chname) > CHANMAX)
+       if (len > max)
        {
                        return false;
        }
@@ -216,13 +216,13 @@ bool IsChannelHandler::Call(const char *chname)
 }
 
 /* true for valid nickname, false else */
-bool IsNickHandler::Call(const char* n)
+bool IsNickHandler::Call(const char* n, size_t max)
 {
        if (!n || !*n)
                return false;
  
-       int p = 0;
-       for (char* i = (char*)n; *i; i++, p++)
+       unsigned int p = 0;
+       for (const char* i = n; *i; i++, p++)
        {
                if ((*i >= 'A') && (*i <= '}'))
                {
@@ -241,7 +241,7 @@ bool IsNickHandler::Call(const char* n)
        }
 
        /* too long? or not -- pointer arithmetic rocks */
-       return (p < NICKMAX - 1);
+       return (p < max);
 }
 
 /* return true for good ident, false else */
@@ -250,7 +250,7 @@ bool IsIdentHandler::Call(const char* n)
        if (!n || !*n)
                return false;
 
-       for (char* i = (char*)n; *i; i++)
+       for (const char* i = n; *i; i++)
        {
                if ((*i >= 'A') && (*i <= '}'))
                {
index ed4b4b6b618e36f90b6f6d0bfb523724fc53b9b8..b778d1d5c5f458e64fcb7eb9de9125a084495771 100644 (file)
@@ -711,7 +711,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
                                                                state_change = false;
 
                                                                if ((output_sequence.length() + parameter_list.str().length() > 450) || (output_sequence.length() > 100)
-                                                                               || (parameter_count > MAXMODES))
+                                                                               || (parameter_count > ServerInstance->Config->Limits.MaxModes))
                                                                {
                                                                        /* We cant have a mode sequence this long */
                                                                        letter = mode_sequence.end() - 1;
index a8add0c72e78d5f01e4bccd47a79c836d5431ad2..f786d48ee692b92c6b0b48b562c8474a78fec581 100644 (file)
@@ -114,7 +114,7 @@ class BanRedirect : public ModeWatcher
        
                        if(mask[CHAN].length())
                        {
-                               if(Srv->IsChannel(mask[CHAN].c_str()))
+                               if(!IS_LOCAL(source) || Srv->IsChannel(mask[CHAN].c_str(), ServerInstance->Config->Limits.ChanMax))
                                {
                                        if (assign(channel->name) == mask[CHAN])
                                        {
index e44e496f8f5bdb0ae326ad319278e913d8b92f34..a79eda993eb6b50696676f4f670d476c870cbc38 100644 (file)
@@ -68,7 +68,7 @@ class FounderProtectBase
                std::string item = extend + std::string(channel->name);
                std::vector<std::string> mode_junk;
                mode_junk.push_back(channel->name);
-               irc::modestacker modestack(false);
+               irc::modestacker modestack(ServerInstance, false);
                std::deque<std::string> stackresult;                            
 
                for (CUList::iterator i = cl->begin(); i != cl->end(); i++)
index d0d77f1939b22661db1b1274e8c1793cb25fa541..3ab558b5741ea1bdd3f4092088ea1dd9ce9da452 100644 (file)
@@ -43,7 +43,7 @@ class CommandChgident : public Command
                        return CMD_FAILURE;
                }
                
-               if (parameters[1].length() > IDENTMAX - 1)
+               if (parameters[1].length() > ServerInstance->Config->Limits.IdentMax)
                {
                        user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick.c_str());
                        return CMD_FAILURE;
index 233bb15b677f3498e127bfe7de2f10a11b134f80..936cd72ac00c87f48ff5e74be5d7771addaa7695 100644 (file)
@@ -43,7 +43,7 @@ class CommandChgname : public Command
                        return CMD_FAILURE;
                }
                
-               if (parameters[1].length() > MAXGECOS)
+               if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos)
                {
                        user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str());
                        return CMD_FAILURE;
index 13941415546aea1c0d052e5557f916c9c0bf8cc1..046176b0c69f9c4830c7ffd926423d54214572a0 100644 (file)
@@ -81,7 +81,7 @@ class ModuleConnJoin : public Module
                                return;
 
                        for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++)
-                               if (ServerInstance->IsChannel(it->c_str()))
+                               if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
                                        Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time());
                }
 
index f285476795f274a5e5ce19049b953967d741b682..e847f8c7cc5ed2ea536879ae23f4adadec422b7d 100644 (file)
@@ -45,7 +45,7 @@ class ModuleDenyChannels : public Module
                        if (!redirect.empty())
                        {
                        
-                               if (!ServerInstance->IsChannel(redirect.c_str()))
+                               if (!ServerInstance->IsChannel(redirect.c_str(), ServerInstance->Config->Limits.ChanMax))
                                {
                                        if (user)
                                                user->WriteServ("Notice %s :Invalid badchan redirect '%s'", user->nick.c_str(), redirect.c_str());
@@ -110,7 +110,7 @@ class ModuleDenyChannels : public Module
                                                }
                                        }
                                        
-                                       if (ServerInstance->IsChannel(redirect.c_str()))
+                                       if (ServerInstance->IsChannel(redirect.c_str(), ServerInstance->Config->Limits.ChanMax))
                                        {
                                                /* simple way to avoid potential loops: don't redirect to +L channels */
                                                Channel *newchan = ServerInstance->FindChan(redirect);
index e7d8728d6ae955c7d479016b9ecace7d0209db98..197a6e5e2486eea0876f8984ca041f7d9c260c4b 100644 (file)
@@ -296,11 +296,11 @@ class IdentRequestSocket : public EventHandler
                        if (i < 3)
                                continue;
 
-                       char ident[IDENTMAX + 2];
+                       std::string ident;
 
                        /* Truncate the ident at any characters we don't like, skip leading spaces */
-                       int k = 0;
-                       for (const char *j = token.c_str(); *j && (k < IDENTMAX + 1); j++)
+                       size_t k = 0;
+                       for (const char *j = token.c_str(); *j && (k < ServerInstance->Config->Limits.IdentMax + 1); j++)
                        {
                                if (*j == ' ')
                                        continue;
@@ -308,17 +308,15 @@ class IdentRequestSocket : public EventHandler
                                /* Rules taken from InspIRCd::IsIdent */
                                if (((*j >= 'A') && (*j <= '}')) || ((*j >= '0') && (*j <= '9')) || (*j == '-') || (*j == '.'))
                                {
-                                       ident[k++] = *j;
+                                       ident += *j;
                                        continue;
                                }
 
                                break;
                        }
 
-                       ident[k] = '\0';
-
                        /* Re-check with IsIdent, in case that changes and this doesn't (paranoia!) */
-                       if (*ident && ServerInstance->IsIdent(ident))
+                       if (!ident.empty() && ServerInstance->IsIdent(ident.c_str()))
                        {
                                result = ident;
                        }
@@ -366,9 +364,9 @@ class ModuleIdent : public Module
        virtual int OnUserRegister(User *user)
        {
                /* User::ident is currently the username field from USER; with m_ident loaded, that
-                * should be preceded by a ~. The field is actually IDENTMAX+2 characters wide. */
-               if (user->ident.length() > IDENTMAX + 1)
-                       user->ident.assign(user->ident, 0, IDENTMAX);
+                * should be preceded by a ~. The field is actually IdentMax+2 characters wide. */
+               if (user->ident.length() > ServerInstance->Config->Limits.IdentMax + 1)
+                       user->ident.assign(user->ident, 0, ServerInstance->Config->Limits.IdentMax);
                user->ident.insert(0, "~");
 
                user->WriteServ("NOTICE Auth :*** Looking up your ident...");
@@ -457,7 +455,7 @@ class ModuleIdent : public Module
                        user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", isock->GetResult());
 
                /* Copy the ident string to the user */
-               user->ident.assign(isock->GetResult(), 0, IDENTMAX+1);
+               user->ident.assign(isock->GetResult(), 0, ServerInstance->Config->Limits.IdentMax + 1);
 
                /* The user isnt actually disconnecting, we call this to clean up the user */
                OnUserDisconnect(user);
index adeab2691febc35aae7fcbecc612bcf290870d10..86054ab3e1a36e9ce4bfdd95cac1e3783ce20674 100644 (file)
@@ -48,7 +48,7 @@ class CommandNicklock : public Command
                }
 
                // check nick is valid
-               if (!ServerInstance->IsNick(parameters[1].c_str()))
+               if (IS_LOCAL(user) && !ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax))
                {
                        return CMD_FAILURE;
                }
@@ -58,8 +58,12 @@ class CommandNicklock : public Command
 
                if (!target->ForceNickChange(parameters[1].c_str()))
                {
-                       // ugh, nickchange failed for some reason -- possibly existing nick? XXX change to UID here
-                       ServerInstance->Users->QuitUser(target, "Nickname collision");
+                       // ugh, nickchange failed for some reason -- possibly existing nick?
+                       if (!target->ForceNickChange(target->uuid.c_str()))
+                       {
+                               // Well shit, we cant even change them to their UID (this should not happen!)
+                               ServerInstance->Users->QuitUser(target, "Nickname collision");
+                       }
                }
 
                // give them a lock flag
index 42415faa2f757e471fd88baab5e021d6b7959f22..b0976b1cc35536eaa1ef82d0bb6bab386178f2ae 100644 (file)
@@ -91,7 +91,7 @@ class ModuleOperjoin : public Module
                                return;
 
                        for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++)
-                               if (ServerInstance->IsChannel(it->c_str()))
+                               if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
                                        Channel::JoinUser(ServerInstance, user, it->c_str(), override, "", false, ServerInstance->Time());
 
                        std::map<std::string, std::vector<std::string> >::iterator i = operTypeChans.find(user->oper);
@@ -101,7 +101,7 @@ class ModuleOperjoin : public Module
                                const std::vector<std::string>& list = i->second;
                                for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it)
                                {
-                                       if (ServerInstance->IsChannel(it->c_str()))
+                                       if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
                                        {
                                                Channel::JoinUser(ServerInstance, user, it->c_str(), override, "", false, ServerInstance->Time());
                                        }
index 289a73dcacb2723707e3338cfc2a9889b37ef6da..9c529a37d7af621d841467decf02a393e115f7f4 100644 (file)
@@ -42,9 +42,9 @@ class Redirect : public ModeHandler
                {
                        Channel* c = NULL;
 
-                       if (!ServerInstance->IsChannel(parameter.c_str()))
+                       if (IS_LOCAL(source) && !ServerInstance->IsChannel(parameter.c_str(), ServerInstance->Config->Limits.ChanMax))
                        {
-                               source->WriteNumeric(403, "%s %s :Invalid channel name",source->nick.c_str(), parameter.c_str());
+                               source->WriteNumeric(403, "%s %s :Invalid channel name", source->nick.c_str(), parameter.c_str());
                                parameter.clear();
                                return MODEACTION_DENY;
                        }
index 8b237674b2e01ce0774d4f030dd66dc7a46d8a3f..5be61fbf60cf5418787860f320c8e04360ea1b4a 100644 (file)
@@ -37,10 +37,10 @@ class CommandSajoin : public Command
                                user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
                                return CMD_FAILURE;
                        }
-                       if (!ServerInstance->IsChannel(parameters[1].c_str()))
+                       if (IS_LOCAL(source) && !ServerInstance->IsChannel(parameters[1].c_str(), ServerInstance->Config->Limits.ChanMax))
                        {
                                /* we didn't need to check this for each character ;) */
-                               user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
+                               user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name or name too long");
                                return CMD_FAILURE;
                        }
 
index cd93377c8a2b99911c417586978c0d5ffa785fb3..83d7fabd44c4cc5614bac1206691dbc76c421eb8 100644 (file)
@@ -38,7 +38,11 @@ class CommandSanick : public Command
                                return CMD_FAILURE;
                        }
                        std::string oldnick = user->nick;
-                       if (ServerInstance->IsNick(parameters[1].c_str()))
+                       if (IS_LOCAL(user) && !ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax))
+                       {
+                               user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[1].c_str());
+                       }
+                       else
                        {
                                if (target->ForceNickChange(parameters[1].c_str()))
                                {
@@ -52,10 +56,6 @@ class CommandSanick : public Command
                                        return CMD_FAILURE;
                                }
                        }
-                       else
-                       {
-                               user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[1].c_str());
-                       }
 
                        return CMD_FAILURE;
                }
index 13f5d0c9296d64a3b66affdd9f5163a00265743e..6577ebbb392271ad2d0e5aa9e38009b819a7226f 100644 (file)
@@ -35,7 +35,7 @@ class CommandSetident : public Command
                        return CMD_FAILURE;
                }
                
-               if (parameters[0].size() > IDENTMAX)
+               if (parameters[0].size() > ServerInstance->Config->Limits.IdentMax)
                {
                        user->WriteServ("NOTICE %s :*** SETIDENT: Ident is too long", user->nick.c_str());
                        return CMD_FAILURE;
index eab376cab8f087b38e2fede5766748353f6e5500..8c35c2be24bc65368738ae5cb703a0d2c12b261c 100644 (file)
@@ -35,7 +35,7 @@ class CommandSetname : public Command
                        return CMD_FAILURE;
                }
                
-               if (parameters[0].size() > MAXGECOS)
+               if (parameters[0].size() > ServerInstance->Config->Limits.MaxGecos)
                {
                        user->WriteServ("NOTICE %s :*** SETNAME: GECOS too long", user->nick.c_str());
                        return CMD_FAILURE;
index 5919c65bb7735f84bba27d76b2d96062b783c885..9a45b8131a8e9d3a0456a33596e1fadaa0e4a938 100644 (file)
@@ -81,16 +81,16 @@ void TreeSocket::SendCapabilities()
        }
 
        this->WriteLine("CAPAB CAPABILITIES " /* Preprocessor does this one. */
-                       ":NICKMAX="+ConvToStr(NICKMAX)+
-                       " HALFOP="+ConvToStr(this->Instance->Config->AllowHalfop)+
-                       " CHANMAX="+ConvToStr(CHANMAX)+
-                       " MAXMODES="+ConvToStr(MAXMODES)+
-                       " IDENTMAX="+ConvToStr(IDENTMAX)+
-                       " MAXQUIT="+ConvToStr(MAXQUIT)+
-                       " MAXTOPIC="+ConvToStr(MAXTOPIC)+
-                       " MAXKICK="+ConvToStr(MAXKICK)+
-                       " MAXGECOS="+ConvToStr(MAXGECOS)+
-                       " MAXAWAY="+ConvToStr(MAXAWAY)+
+                       ":NICKMAX="+ConvToStr(Instance->Config->Limits.NickMax)+
+                       " HALFOP="+ConvToStr(Instance->Config->AllowHalfop)+
+                       " CHANMAX="+ConvToStr(Instance->Config->Limits.ChanMax)+
+                       " MAXMODES="+ConvToStr(Instance->Config->Limits.MaxModes)+
+                       " IDENTMAX="+ConvToStr(Instance->Config->Limits.IdentMax)+
+                       " MAXQUIT="+ConvToStr(Instance->Config->Limits.MaxQuit)+
+                       " MAXTOPIC="+ConvToStr(Instance->Config->Limits.MaxTopic)+
+                       " MAXKICK="+ConvToStr(Instance->Config->Limits.MaxKick)+
+                       " MAXGECOS="+ConvToStr(Instance->Config->Limits.MaxGecos)+
+                       " MAXAWAY="+ConvToStr(Instance->Config->Limits.MaxAway)+
                        " IP6NATIVE="+ConvToStr(ip6)+
                        " IP6SUPPORT="+ConvToStr(ip6support)+
                        " PROTOCOL="+ConvToStr(ProtocolVersion)+extra+
@@ -171,19 +171,6 @@ bool TreeSocket::Capab(const std::deque<std::string> &params)
                                reason = "Modules loaded on these servers are not correctly matched, these modules are not loaded on " + diff;
                }
 
-               cap_validation valid_capab[] = { 
-                       {"Maximum nickname lengths differ or remote nickname length not specified", "NICKMAX", NICKMAX},
-                       {"Maximum ident lengths differ or remote ident length not specified", "IDENTMAX", IDENTMAX},
-                       {"Maximum channel lengths differ or remote channel length not specified", "CHANMAX", CHANMAX},
-                       {"Maximum modes per line differ or remote modes per line not specified", "MAXMODES", MAXMODES},
-                       {"Maximum quit lengths differ or remote quit length not specified", "MAXQUIT", MAXQUIT},
-                       {"Maximum topic lengths differ or remote topic length not specified", "MAXTOPIC", MAXTOPIC},
-                       {"Maximum kick lengths differ or remote kick length not specified", "MAXKICK", MAXKICK},
-                       {"Maximum GECOS (fullname) lengths differ or remote GECOS length not specified", "MAXGECOS", MAXGECOS},
-                       {"Maximum awaymessage lengths differ or remote awaymessage length not specified", "MAXAWAY", MAXAWAY},
-                       {"", "", 0}
-               };
-
                if (((this->CapKeys.find("IP6SUPPORT") == this->CapKeys.end()) && (ip6support)) || ((this->CapKeys.find("IP6SUPPORT") != this->CapKeys.end()) && (this->CapKeys.find("IP6SUPPORT")->second != ConvToStr(ip6support))))
                        reason = "We don't both support linking to IPV6 servers";
                if (((this->CapKeys.find("IP6NATIVE") != this->CapKeys.end()) && (this->CapKeys.find("IP6NATIVE")->second == "1")) && (!ip6support))
@@ -201,13 +188,6 @@ bool TreeSocket::Capab(const std::deque<std::string> &params)
 
                if (((this->CapKeys.find("HALFOP") == this->CapKeys.end()) && (Instance->Config->AllowHalfop)) || ((this->CapKeys.find("HALFOP") != this->CapKeys.end()) && (this->CapKeys.find("HALFOP")->second != ConvToStr(Instance->Config->AllowHalfop))))
                        reason = "We don't both have halfop support enabled/disabled identically";
-
-               for (int x = 0; valid_capab[x].size; ++x)
-               {
-                       if (((this->CapKeys.find(valid_capab[x].key) == this->CapKeys.end()) || ((this->CapKeys.find(valid_capab[x].key) != this->CapKeys.end()) &&
-                                                (this->CapKeys.find(valid_capab[x].key)->second != ConvToStr(valid_capab[x].size)))))
-                               reason = valid_capab[x].reason;
-               }
        
                /* Challenge response, store their challenge for our password */
                std::map<std::string,std::string>::iterator n = this->CapKeys.find("CHALLENGE");
index 985c86143272bcfbaff6546096eaa2b49216b7c1..4ef8d2d4f8a7726804fd205975b503c317893c3a 100644 (file)
@@ -60,7 +60,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
        if (params.size() < 3)
                return true;
 
-       irc::modestacker modestack(true);                               /* Modes to apply from the users in the user list */
+       irc::modestacker modestack(Instance, true);                     /* Modes to apply from the users in the user list */
        User* who = NULL;                                               /* User we are currently checking */
        std::string channel = params[0];                                /* Channel name, as a string */
        time_t TS = atoi(params[1].c_str());                            /* Timestamp given to us for remote side */
index 3ea77511242a7dc9376c138849c01c13e1607a40..e18187087fa8fa1320b6c9d589b90a6e15b1d21a 100644 (file)
@@ -34,7 +34,7 @@ bool TreeSocket::ForceTopic(const std::string &source, std::deque<std::string> &
                if ((ts >= c->topicset) || (c->topic.empty()))
                {
                        std::string oldtopic = c->topic;
-                       c->topic.assign(params[3], 0, MAXTOPIC);
+                       c->topic.assign(params[3], 0, Instance->Config->Limits.MaxTopic);
                        c->setby.assign(params[2], 0, 127);
                        c->topicset = ts;
                        /* if the topic text is the same as the current topic,
index 8444bbec64a8b67201b4f1400b64415c1ea73389..793a3cf9a8d2b8cbacce53ed656c07c8d8ad2ef6 100644 (file)
@@ -96,8 +96,19 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
 
        for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
        {
+               size_t ptrlen = 0;
+               std::string modestr = this->Instance->Modes->ModeString(i->first, c, false);
+
+               if ((curlen + modestr.length() + i->first->uuid.length() + 4) > 480)
+               {
+                       buffer.append(list).append("\r\n");
+                       dlen = curlen = snprintf(list, MAXBUF, ":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true));
+                       ptr = list + dlen;
+                       numusers = 0;
+               }
+
                // The first parameter gets a : before it
-               size_t ptrlen = snprintf(ptr, MAXBUF, " %s%s,%s", !numusers ? ":" : "", this->Instance->Modes->ModeString(i->first, c, false).c_str(), i->first->uuid.c_str());
+               ptrlen = snprintf(ptr, MAXBUF, " %s%s,%s", !numusers ? ":" : "", modestr.c_str(), i->first->uuid.c_str());
 
                looped_once = true;
 
@@ -105,15 +116,6 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
                ptr += ptrlen;
 
                numusers++;
-
-               if (curlen > (480-NICKMAX))
-               {
-                       buffer.append(list).append("\r\n");
-                       dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true));
-                       ptr = list + dlen;
-                       ptrlen = 0;
-                       numusers = 0;
-               }
        }
 
        // Okay, permanent channels will (of course) need this \r\n anyway, numusers check is if there
@@ -132,7 +134,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
                        params.append(" ").append(b->data);
                        linesize += size; 
                }
-               if ((params.length() >= MAXMODES) || (currsize > 350))
+               if ((params.length() >= Instance->Config->Limits.MaxModes) || (currsize > 350))
                {
                        /* Wrap at MAXMODES */
                        buffer.append(":").append(this->Instance->Config->GetSID()).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params).append("\r\n");
index a2aff74f98307e5e4f57889fb17c5fd8a5ac6018..01638f9ac501a6467c1c54f2f85ec09e96345211 100644 (file)
@@ -35,8 +35,8 @@ bool TreeSocket::OperType(const std::string &prefix, std::deque<std::string> &pa
                if (!u->IsModeSet('o'))
                        this->Instance->Users->all_opers.push_back(u);
                u->modes[UM_OPERATOR] = 1;
-               u->oper.assign(opertype, 0, NICKMAX - 1);
-               Utils->DoOneToAllButSender(u->uuid,"OPERTYPE",params,u->server);
+               u->oper.assign(opertype, 0, Instance->Config->Limits.NickMax);
+               Utils->DoOneToAllButSender(u->uuid, "OPERTYPE", params, u->server);
 
                TreeServer* remoteserver = Utils->FindServer(u->server);
                bool dosend = true;
index ee4addb74167b870c52cff73b2f5c0596f547c62..5f9f94e95e2875c4da4e2bbb2ece034bc2f8495c 100644 (file)
@@ -35,9 +35,6 @@ bool TreeSocket::ServiceJoin(const std::string &prefix, std::deque<std::string>
        if (params.size() < 2)
                return true;
 
-       if (!this->Instance->IsChannel(params[1].c_str()))
-               return true;
-
        User* u = this->Instance->FindNick(params[0]);
 
        if (u)
index 00fd9eb3a4ed521097ba228503e5cd3492983ada..639792be9cfea6cb4f8590618265ccb75ad521bb 100644 (file)
@@ -35,9 +35,6 @@ bool TreeSocket::ServicePart(const std::string &prefix, std::deque<std::string>
        if (params.size() < 2)
                return true;
 
-       if (!this->Instance->IsChannel(params[1].c_str()))
-               return true;
-
        User* u = this->Instance->FindNick(params[0]);
        Channel* c = this->Instance->FindChan(params[1]);
 
index 70f7b874c1b5cedf87b910105db9870611f2a38e..d84ee2a046c9a8d075887517f77bb72ba68b9b78 100644 (file)
@@ -48,9 +48,6 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
        time_t signon = ConvToInt(params[8]);
        std::string empty;
 
-       /* XXX probably validate UID length too -- w00t */
-       cmd_validation valid[] = { {"Nickname", 2, NICKMAX}, {"Hostname", 3, 64}, {"Displayed hostname", 4, 64}, {"Ident", 5, IDENTMAX + 1}, {"GECOS", 9, MAXGECOS}, {"", 0, 0} };
-
        TreeServer* remoteserver = Utils->FindServer(source);
 
        if (!remoteserver)
@@ -66,16 +63,6 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
                return true;
        }
 
-       for (size_t x = 0; valid[x].length; ++x)
-       {
-               if (params[valid[x].param].length() > valid[x].length)
-               {
-                       this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction (" + valid[x].item + " > " + ConvToStr(valid[x].length) + ")");
-                       return true;
-               }
-       }
-
-
        /* check for collision */
        user_hash::iterator iter = this->Instance->Users->clientlist->find(params[2]);
 
@@ -109,12 +96,12 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
        }
        (*(this->Instance->Users->clientlist))[params[2]] = _new;
        _new->SetFd(FD_MAGIC_NUMBER);
-       _new->nick.assign(params[2], 0, NICKMAX - 1);
+       _new->nick.assign(params[2], 0, MAXBUF);
        _new->host.assign(params[3], 0, 64);
        _new->dhost.assign(params[4], 0, 64);
        _new->server = this->Instance->FindServerNamePtr(remoteserver->GetName().c_str());
-       _new->ident.assign(params[5], 0, IDENTMAX + 1);
-       _new->fullname.assign(params[9], 0, MAXGECOS);
+       _new->ident.assign(params[5], 0, MAXBUF);
+       _new->fullname.assign(params[9], 0, MAXBUF);
        _new->registered = REG_ALL;
        _new->signon = signon;
        _new->age = age_t;
index ce19a67a346eec6fb42b242518a7c4529718f875..c1c7e84217beb6d96542a9903c3efeda795c6481 100644 (file)
@@ -100,7 +100,11 @@ class CommandSvshold : public Command
                else if (parameters.size() >= 2)
                {
                        /* full form to add a SVSHold */
-                       if (ServerInstance->IsNick(parameters[0].c_str()))
+
+                       /* NOTE: We check nicks up to 512 in length here, as a hax to allow
+                        * remote nicks that are longer than our configuration to be held
+                        */
+                       if (ServerInstance->IsNick(parameters[0].c_str(), 512))
                        {
                                // parameters[0] = w00t
                                // parameters[1] = 1h3m2s
index 3ae856b5e7ac6d9d8704743d6cf76868806862c7..62949e48a12495060965c21a7663eaa14c288e12 100644 (file)
@@ -137,7 +137,7 @@ class CommandWatch : public Command
        CmdResult remove_watch(User* user, const char* nick)
        {
                // removing an item from the list
-               if (!ServerInstance->IsNick(nick))
+               if (!ServerInstance->IsNick(nick, ServerInstance->Config->Limits.NickMax))
                {
                        user->WriteNumeric(942, "%s %s :Invalid nickname", user->nick.c_str(), nick);
                        return CMD_FAILURE;
@@ -191,7 +191,7 @@ class CommandWatch : public Command
 
        CmdResult add_watch(User* user, const char* nick)
        {
-               if (!ServerInstance->IsNick(nick))
+               if (!ServerInstance->IsNick(nick, ServerInstance->Config->Limits.NickMax))
                {
                        user->WriteNumeric(942, "%s %s :Invalid nickname",user->nick.c_str(),nick);
                        return CMD_FAILURE;
index ae1d106b8b7b7da4b13cf311cf35df7c2ade8dc0..d583d87c3ebf1633ca90abf04d1ed2be00810f61 100644 (file)
@@ -83,9 +83,9 @@ void InspIRCd::BuildISupport()
 {
        // the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
        std::stringstream v;
-       v << "WALLCHOPS WALLVOICES MODES=" << MAXMODES << " CHANTYPES=# PREFIX=" << this->Modes->BuildPrefixes() << " MAP MAXCHANNELS=" << Config->MaxChans << " MAXBANS=60 VBANLIST NICKLEN=" << NICKMAX-1;
-       v << " CASEMAPPING=rfc1459 STATUSMSG=@" << (this->Config->AllowHalfop ? "%" : "") << "+ CHARSET=ascii TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=" << Config->MaxTargets;
-       v << " AWAYLEN=" << MAXAWAY << " CHANMODES=" << this->Modes->ChanModes() << " FNC NETWORK=" << Config->Network << " MAXPARA=32 ELIST=MU";
+       v << "WALLCHOPS WALLVOICES MODES=" << Config->Limits.MaxModes << " CHANTYPES=# PREFIX=" << this->Modes->BuildPrefixes() << " MAP MAXCHANNELS=" << Config->MaxChans << " MAXBANS=60 VBANLIST NICKLEN=" << Config->Limits.NickMax;
+       v << " CASEMAPPING=rfc1459 STATUSMSG=@" << (this->Config->AllowHalfop ? "%" : "") << "+ CHARSET=ascii TOPICLEN=" << Config->Limits.MaxTopic << " KICKLEN=" << Config->Limits.MaxKick << " MAXTARGETS=" << Config->MaxTargets;
+       v << " AWAYLEN=" << Config->Limits.MaxAway << " CHANMODES=" << this->Modes->ChanModes() << " FNC NETWORK=" << Config->Network << " MAXPARA=32 ELIST=MU";
        Config->data005 = v.str();
        FOREACH_MOD_I(this,I_On005Numeric,On005Numeric(Config->data005));
        Config->Update005();
index a171c32d203aec7ae4cafc8712aea2b95941bc4d..73096d4a84e477c04cdd15aac06c1bbde3c8c1e6 100644 (file)
@@ -68,7 +68,7 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, int port, bool iscache
        (*(this->clientlist))[New->uuid] = New;
 
        /* The users default nick is their UUID */
-       New->nick.assign(New->uuid, 0, NICKMAX - 1);
+       New->nick.assign(New->uuid, 0, ServerInstance->Config->Limits.NickMax);
 
        New->server = Instance->FindServerNamePtr(Instance->Config->ServerName);
        New->ident.assign("unknown");
index 4ffdeb678ebd4220468aaa03841bd14bea2d7823..c892c51f50231e1d1ccc93c8bd4c73d6816ba2e1 100644 (file)
@@ -721,7 +721,7 @@ void User::Oper(const std::string &opertype, const std::string &opername)
                this->WriteServ("MODE %s :+o", this->nick.c_str());
                FOREACH_MOD(I_OnOper, OnOper(this, opertype));
                ServerInstance->Logs->Log("OPER", DEFAULT, "%s!%s@%s opered as type: %s", this->nick.c_str(), this->ident.c_str(), this->host.c_str(), opertype.c_str());
-               this->oper.assign(opertype, 0, NICKMAX - 1);
+               this->oper.assign(opertype, 0, ServerInstance->Config->Limits.NickMax);
                ServerInstance->Users->all_opers.push_back(this);
 
                opertype_t::iterator iter_opertype = ServerInstance->Config->opertypes.find(this->oper.c_str());
@@ -1521,7 +1521,7 @@ bool User::ChangeName(const char* gecos)
                        return false;
                FOREACH_MOD(I_OnChangeName,OnChangeName(this,gecos));
        }
-       this->fullname.assign(gecos, 0, MAXGECOS+1);
+       this->fullname.assign(gecos, 0, ServerInstance->Config->Limits.MaxGecos);
 
        return true;
 }
@@ -1573,7 +1573,7 @@ bool User::ChangeIdent(const char* newident)
        if (this->ServerInstance->Config->CycleHosts)
                this->WriteCommonExcept("%s","QUIT :Changing ident");
 
-       this->ident.assign(newident, 0, IDENTMAX + 1);
+       this->ident.assign(newident, 0, ServerInstance->Config->Limits.IdentMax + 1);
 
        this->InvalidateCache();