diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 1 | ||||
-rw-r--r-- | src/commands/cmd_whois.cpp | 2 | ||||
-rw-r--r-- | src/configreader.cpp | 1 | ||||
-rw-r--r-- | src/modules/extra/README | 3 | ||||
-rw-r--r-- | src/modules/extra/m_ldapauth.cpp | 21 | ||||
-rw-r--r-- | src/modules/extra/m_sqlite3.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_blockcolor.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_ojoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_stripcolor.cpp | 4 | ||||
-rw-r--r-- | src/server.cpp | 1 | ||||
-rw-r--r-- | src/users.cpp | 11 |
12 files changed, 43 insertions, 18 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 8e7d4af06..0b8945aca 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -804,7 +804,6 @@ void Channel::UserList(User *user) dlen = curlen = snprintf(list,MAXBUF,"%s %c %s :", user->nick.c_str(), this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=', this->name.c_str()); ptr = list + dlen; - ptrlen = 0; numusers = 0; } diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index dc2e3ae51..ea1d94291 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -78,7 +78,7 @@ CmdResult CommandWhois::Handle (const std::vector<std::string>& parameters, User { /* no such nick/channel */ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), !parameters[userindex].empty() ? parameters[userindex].c_str() : "*"); - user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick.c_str(), parameters[userindex].empty() ? parameters[userindex].c_str() : "*"); + user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick.c_str(), !parameters[userindex].empty() ? parameters[userindex].c_str() : "*"); return CMD_FAILURE; } diff --git a/src/configreader.cpp b/src/configreader.cpp index 6ef5105aa..a1a244501 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -375,6 +375,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) me->maxlocal = tag->getInt("localmax", me->maxlocal); me->maxglobal = tag->getInt("globalmax", me->maxglobal); me->maxchans = tag->getInt("maxchans", me->maxchans); + me->maxconnwarn = tag->getBool("maxconnwarn", me->maxconnwarn); me->limit = tag->getInt("limit", me->limit); ClassMap::iterator oldMask = oldBlocksByMask.find(typeMask); diff --git a/src/modules/extra/README b/src/modules/extra/README index 6dc9bb18a..2478b57cf 100644 --- a/src/modules/extra/README +++ b/src/modules/extra/README @@ -3,8 +3,7 @@ For example, m_filter_pcre requires the PCRE libraries. To compile any of these modules first ensure you have the required dependencies (read the online documentation at http://wiki.inspircd.org/) and then symlink -the .cpp file from this directory into the parent directory (src/modules/) and -re-configure your inspircd with ./configure -modupdate to detect the new module. +the .cpp file from this directory into the parent directory (src/modules/). Alternatively, use the command: ./configure --enable-extras=m_extra.cpp, which will automatically take care of symlinking the module of that name and any headers it needs diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 4fae7a2e7..a3d80b8f3 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -46,6 +46,7 @@ class ModuleLDAPAuth : public Module std::string killreason; std::string username; std::string password; + std::vector<std::string> whitelistedcidrs; int searchscope; bool verbose; bool useusername; @@ -73,6 +74,7 @@ public: void OnRehash(User* user) { ConfigReader Conf; + whitelistedcidrs.clear(); base = Conf.ReadValue("ldapauth", "baserdn", 0); attribute = Conf.ReadValue("ldapauth", "attribute", 0); @@ -85,6 +87,16 @@ public: verbose = Conf.ReadFlag("ldapauth", "verbose", 0); /* Set to true if failed connects should be reported to operators */ useusername = Conf.ReadFlag("ldapauth", "userfield", 0); + ConfigTagList whitelisttags = ServerInstance->Config->ConfTags("ldapwhitelist"); + + for (ConfigIter i = whitelisttags.first; i != whitelisttags.second; ++i) + { + std::string cidr = i->second->getString("cidr"); + if (!cidr.empty()) { + whitelistedcidrs.push_back(cidr); + } + } + if (scope == "base") searchscope = LDAP_SCOPE_BASE; else if (scope == "onelevel") @@ -128,6 +140,15 @@ public: return MOD_RES_PASSTHRU; } + for (std::vector<std::string>::iterator i = whitelistedcidrs.begin(); i != whitelistedcidrs.end(); i++) + { + if (InspIRCd::MatchCIDR(user->GetIPString(), *i, ascii_case_insensitive_map)) + { + ldapAuthed.set(user,1); + return MOD_RES_PASSTHRU; + } + } + if (!CheckCredentials(user)) { ServerInstance->Users->QuitUser(user, killreason); diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 3809ac738..0f99b7f1a 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -15,6 +15,10 @@ #include <sqlite3.h> #include "sql.h" +#ifdef WINDOWS +# pragma comment(lib, "sqlite3.lib") +#endif + /* $ModDesc: sqlite3 provider */ /* $CompileFlags: pkgconfversion("sqlite3","3.3") pkgconfincludes("sqlite3","/sqlite3.h","") */ /* $LinkerFlags: pkgconflibs("sqlite3","/libsqlite3.so","-lsqlite3") */ diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index d19317074..cbe4bc1fa 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -23,13 +23,13 @@ class BlockColor : public SimpleChannelModeHandler BlockColor(Module* Creator) : SimpleChannelModeHandler(Creator, "blockcolor", 'c') { } }; -class ModuleBlockColour : public Module +class ModuleBlockColor : public Module { bool AllowChanOps; BlockColor bc; public: - ModuleBlockColour() : bc(this) + ModuleBlockColor() : bc(this) { if (!ServerInstance->Modes->AddMode(&bc)) throw ModuleException("Could not add new modes!"); @@ -64,7 +64,7 @@ class ModuleBlockColour : public Module case 21: case 22: case 31: - user->WriteNumeric(404, "%s %s :Can't send colours to channel (+c set)",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(404, "%s %s :Can't send colors to channel (+c set)",user->nick.c_str(), c->name.c_str()); return MOD_RES_DENY; break; } @@ -79,7 +79,7 @@ class ModuleBlockColour : public Module return OnUserPreMessage(user,dest,target_type,text,status,exempt_list); } - virtual ~ModuleBlockColour() + virtual ~ModuleBlockColor() { } @@ -89,4 +89,4 @@ class ModuleBlockColour : public Module } }; -MODULE_INIT(ModuleBlockColour) +MODULE_INIT(ModuleBlockColor) diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index bbe3f05bb..c326321b0 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -242,7 +242,7 @@ class ModuleOjoin : public Module Version GetVersion() { - return Version("Network Buisness Join", VF_VENDOR); + return Version("Network Business Join", VF_VENDOR); } }; diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index ea217b398..8846b2fbc 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -93,7 +93,6 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src parameterlist param_list; if (Utils->AnnounceTSChange) chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name.c_str(), channel.c_str(), (unsigned long) ourTS, (unsigned long) TS); - ourTS = TS; // while the name is equal in case-insensitive compare, it might differ in case; use the remote version chan->name = channel; chan->age = TS; diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index c2246a0d9..83358922b 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -13,7 +13,7 @@ #include "inspircd.h" -/* $ModDesc: Provides channel +S mode (strip ansi colour) */ +/* $ModDesc: Provides channel +S mode (strip ansi color) */ /** Handles channel mode +S */ @@ -137,7 +137,7 @@ class ModuleStripColor : public Module virtual Version GetVersion() { - return Version("Provides channel +S mode (strip ansi colour)", VF_VENDOR); + return Version("Provides channel +S mode (strip ansi color)", VF_VENDOR); } }; diff --git a/src/server.cpp b/src/server.cpp index 91b911ff2..cba395ebe 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -100,7 +100,6 @@ void InspIRCd::IncrementUID(int pos) for (int i = 3; i < (UUID_LENGTH - 1); i++) { current_uid[i] = 'A'; - pos = UUID_LENGTH - 1; } } else diff --git a/src/users.cpp b/src/users.cpp index dda214a78..f8f9d0025 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -734,13 +734,15 @@ void LocalUser::CheckClass() else if ((a->GetMaxLocal()) && (ServerInstance->Users->LocalCloneCount(this) > a->GetMaxLocal())) { ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (local)"); - ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString()); + if (a->maxconnwarn) + ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString()); return; } else if ((a->GetMaxGlobal()) && (ServerInstance->Users->GlobalCloneCount(this) > a->GetMaxGlobal())) { ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (global)"); - ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString()); + if (a->maxconnwarn) + ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString()); return; } @@ -1693,7 +1695,7 @@ const std::string& FakeUser::GetFullRealHost() ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask) : config(tag), type(t), fakelag(true), name("unnamed"), registration_timeout(0), host(mask), pingtime(0), softsendqmax(0), hardsendqmax(0), recvqmax(0), - penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxchans(0), limit(0) + penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(0), limit(0) { } @@ -1702,7 +1704,7 @@ ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask, cons registration_timeout(parent.registration_timeout), host(mask), pingtime(parent.pingtime), softsendqmax(parent.softsendqmax), hardsendqmax(parent.hardsendqmax), recvqmax(parent.recvqmax), penaltythreshold(parent.penaltythreshold), commandrate(parent.commandrate), - maxlocal(parent.maxlocal), maxglobal(parent.maxglobal), maxchans(parent.maxchans), + maxlocal(parent.maxlocal), maxglobal(parent.maxglobal), maxconnwarn(parent.maxconnwarn), maxchans(parent.maxchans), limit(parent.limit) { } @@ -1723,6 +1725,7 @@ void ConnectClass::Update(const ConnectClass* src) commandrate = src->commandrate; maxlocal = src->maxlocal; maxglobal = src->maxglobal; + maxconnwarn = src->maxconnwarn; maxchans = src->maxchans; limit = src->limit; } |