]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Convertage.
[user/henk/code/inspircd.git] / src / configreader.cpp
index aaff93ef9a852b83c6b98b89fe8385a47bc3f617..8f6c93b1bf8e98baca123e7baaba2c54db5e90ba 100644 (file)
@@ -19,7 +19,8 @@
 /* $CopyInstall: conf/inspircd.helpop.example $(CONPATH) */
 /* $CopyInstall: conf/inspircd.censor.example $(CONPATH) */
 /* $CopyInstall: conf/inspircd.filter.example $(CONPATH) */
-/* $CopyInstall: docs/inspircd.conf.example $(CONPATH) */
+/* $CopyInstall: conf/inspircd.conf.example $(CONPATH) */
+/* $CopyInstall: conf/modules.conf.example $(CONPATH) */
 
 #include "inspircd.h"
 #include <fstream>
@@ -53,6 +54,8 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
        debugging = 0;
        MaxChans = 20;
        OperMaxChans = 30;
+       c_ipv4_range = 32;
+       c_ipv6_range = 128;
        maxbans.clear();
        DNSServerValidator = &ValidateDnsServer;
 }
@@ -528,7 +531,7 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*)
                         ((*name && (cc->GetName() == name)) || // if the name is the same
                         (*allow && (cc->GetHost() == allow)) || // or the allow is the same
                         (*deny && (cc->GetHost() == deny))) && // or the deny is the same
-                        (!port || port && (cc->GetPort() == port)) // and there is no port, or there is a port and the port is the same
+                        (!port || (port && (cc->GetPort() == port))) // and there is no port, or there is a port and the port is the same
                   )
                {
                        /* reenable class so users can be shoved into it :P */
@@ -844,6 +847,8 @@ void ServerConfig::Read(bool bail, User* user)
                {"die",         "value",        "",                     new ValueContainerChar (this->DieValue),                DT_CHARPTR,  NoValidation},
                {"channels",    "users",        "20",                   new ValueContainerUInt (&this->MaxChans),               DT_INTEGER,  NoValidation},
                {"channels",    "opers",        "60",                   new ValueContainerUInt (&this->OperMaxChans),           DT_INTEGER,  NoValidation},
+               {"cidr",        "ipv4clone",    "32",                   new ValueContainerInt (&this->c_ipv4_range),            DT_INTEGER,  NoValidation},
+               {"cidr",        "ipv6clone",    "128",                  new ValueContainerInt (&this->c_ipv6_range),            DT_INTEGER,  NoValidation},
                {"limits",      "maxnick",      "32",                   new ValueContainerST (&this->Limits.NickMax),           DT_INTEGER,  NoValidation},
                {"limits",      "maxchan",      "64",                   new ValueContainerST (&this->Limits.ChanMax),           DT_INTEGER,  NoValidation},
                {"limits",      "maxmodes",     "20",                   new ValueContainerST (&this->Limits.MaxModes),          DT_INTEGER,  NoValidation},
@@ -1302,12 +1307,14 @@ void ServerConfig::Read(bool bail, User* user)
 
        }
 
-       /** Note: This is safe, the method checks for user == NULL */
-       ServerInstance->Threads->Mutex(true);
-       ServerInstance->Parser->SetupCommandTable(user);
-       ServerInstance->Threads->Mutex(false);
-
-       if (!bail)
+       if (bail)
+       {
+               /** Note: This is safe, the method checks for user == NULL */
+               ServerInstance->Threads->Mutex(true);
+               ServerInstance->Parser->SetupCommandTable(user);
+               ServerInstance->Threads->Mutex(false);
+       }
+       else
        {
                if (user)
                        user->WriteServ("NOTICE %s :*** Successfully rehashed server.", user->nick.c_str());
@@ -2071,7 +2078,7 @@ bool ServerConfig::DirValid(const char* dirandfile)
 
 std::string ServerConfig::GetFullProgDir()
 {
-       char buffer[PATH_MAX+1];
+       char buffer[PATH_MAX];
 #ifdef WINDOWS
        /* Windows has specific api calls to get the exe path that never fail.
         * For once, windows has something of use, compared to the POSIX code