summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_clearcache.cpp2
-rw-r--r--src/commands/cmd_info.cpp21
-rw-r--r--src/commands/cmd_whois.cpp2
-rw-r--r--src/configreader.cpp1
-rw-r--r--src/dns.cpp57
-rw-r--r--src/inspircd.cpp4
-rw-r--r--src/modules/extra/README3
-rw-r--r--src/modules/extra/m_sqlite3.cpp4
-rw-r--r--src/modules/m_blockcolor.cpp10
-rw-r--r--src/modules/m_chghost.cpp11
-rw-r--r--src/modules/m_hostchange.cpp2
-rw-r--r--src/modules/m_ojoin.cpp2
-rw-r--r--src/modules/m_remove.cpp5
-rw-r--r--src/modules/m_shun.cpp6
-rw-r--r--src/modules/m_stripcolor.cpp4
-rw-r--r--src/users.cpp11
16 files changed, 100 insertions, 45 deletions
diff --git a/src/commands/cmd_clearcache.cpp b/src/commands/cmd_clearcache.cpp
index ecf2c07fc..c5492a8b6 100644
--- a/src/commands/cmd_clearcache.cpp
+++ b/src/commands/cmd_clearcache.cpp
@@ -17,7 +17,7 @@
#include "channels.h"
#include "ctables.h"
-/** Handle /ADMIN. These command handlers can be reloaded by the core,
+/** Handle /CLEARCACHE. These command handlers can be reloaded by the core,
* and handle basic RFC1459 commands. Commands within modules work
* the same way, however, they can be fully unloaded, where these
* may not.
diff --git a/src/commands/cmd_info.cpp b/src/commands/cmd_info.cpp
index 012a5bf81..e0ad65bda 100644
--- a/src/commands/cmd_info.cpp
+++ b/src/commands/cmd_info.cpp
@@ -44,16 +44,17 @@ static const char* const lines[] = {
" November 2002 - Present",
" ",
"\2Core Developers\2:",
- " Craig Edwards, Brain, <brain@inspircd.org>",
- " Craig McLure, Craig, <craig@inspircd.org>",
- " Robin Burchell, w00t, <w00t@inspircd.org>",
- " Oliver Lupton, Om, <om@inspircd.org>",
- " John Brooks, Special, <special@inspircd.org>",
- " Dennis Friis, peavey, <peavey@inspircd.org>",
- " Thomas Stagner, aquanight, <aquanight@inspircd.org>",
- " Uli Schlachter, psychon, <psychon@inspircd.org>",
- " Matt Smith, dz, <dz@inspircd.org>",
- " Daniel De Graaf, danieldg, <danieldg@inspircd.org>",
+ " Craig Edwards, Brain, <brain@inspircd.org>",
+ " Craig McLure, Craig, <craig@inspircd.org>",
+ " Robin Burchell, w00t, <w00t@inspircd.org>",
+ " Oliver Lupton, Om, <om@inspircd.org>",
+ " John Brooks, Special, <special@inspircd.org>",
+ " Dennis Friis, peavey, <peavey@inspircd.org>",
+ " Thomas Stagner, aquanight, <aquanight@inspircd.org>",
+ " Uli Schlachter, psychon, <psychon@inspircd.org>",
+ " Matt Smith, dz, <dz@inspircd.org>",
+ " Daniel De Graaf, danieldg, <danieldg@inspircd.org>",
+ " jackmcbarn, <jackmcbarn@inspircd.org>",
" ",
"\2Regular Contributors\2:",
" Majic MacGyver Namegduf Ankit",
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/dns.cpp b/src/dns.cpp
index 945e1fb15..58cbcca76 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -38,6 +38,8 @@ looks like this, walks like this or tastes like this.
#include "configreader.h"
#include "socket.h"
+#define DN_COMP_BITMASK 0xC000 /* highest 6 bits in a DN label header */
+
/** Masks to mask off the responses we get from the DNSRequest methods
*/
enum QueryInfo
@@ -98,7 +100,7 @@ class DNSRequest
DNSRequest(DNS* dns, int id, const std::string &original);
~DNSRequest();
- DNSInfo ResultIsReady(DNSHeader &h, int length);
+ DNSInfo ResultIsReady(DNSHeader &h, unsigned length);
int SendRequests(const DNSHeader *header, const int length, QueryType qt);
};
@@ -161,7 +163,10 @@ int CachedQuery::CalcTTLRemaining()
/* Allocate the processing buffer */
DNSRequest::DNSRequest(DNS* dns, int rid, const std::string &original) : dnsobj(dns)
{
- res = new unsigned char[512];
+ /* hardening against overflow here: make our work buffer twice the theoretical
+ * maximum size so that hostile input doesn't screw us over.
+ */
+ res = new unsigned char[sizeof(DNSHeader) * 2];
*res = 0;
orig = original;
RequestTimeout* RT = new RequestTimeout(ServerInstance->Config->dns_timeout ? ServerInstance->Config->dns_timeout : 5, this, rid);
@@ -688,11 +693,11 @@ DNSResult DNS::GetResult()
}
/** A result is ready, process it */
-DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, int length)
+DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, unsigned length)
{
- int i = 0;
+ unsigned i = 0, o;
int q = 0;
- int curanswer, o;
+ int curanswer;
ResourceRecord rr;
unsigned short ptr;
@@ -755,7 +760,7 @@ DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, int length)
else i += header.payload[i] + 1; /* skip length and label */
}
}
- if (length - i < 10)
+ if (static_cast<int>(length - i) < 10)
return std::make_pair((unsigned char*)NULL,"Incorrectly sized DNS reply");
/* XXX: We actually initialise 'rr' here including its ttl field */
@@ -790,17 +795,37 @@ DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, int length)
switch (rr.type)
{
+ /*
+ * CNAME and PTR are compressed. We need to decompress them.
+ */
case DNS_QUERY_CNAME:
- /* CNAME and PTR have the same processing code */
case DNS_QUERY_PTR:
+ {
+ unsigned short lowest_pos = length;
o = 0;
q = 0;
while (q == 0 && i < length && o + 256 < 1023)
{
+ /* DN label found (byte over 63) */
if (header.payload[i] > 63)
{
memcpy(&ptr,&header.payload[i],2);
- i = ntohs(ptr) - 0xC000 - 12;
+
+ i = ntohs(ptr);
+
+ /* check that highest two bits are set. if not, we've been had */
+ if ((i & DN_COMP_BITMASK) != DN_COMP_BITMASK)
+ return std::make_pair((unsigned char *) NULL, "DN label decompression header is bogus");
+
+ /* mask away the two highest bits. */
+ i &= ~DN_COMP_BITMASK;
+
+ /* and decrease length by 12 bytes. */
+ i -= 12;
+
+ if (i >= lowest_pos)
+ return std::make_pair((unsigned char *) NULL, "Invalid decompression pointer");
+ lowest_pos = i;
}
else
{
@@ -813,25 +838,35 @@ DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, int length)
res[o] = 0;
if (o != 0)
res[o++] = '.';
- memcpy(&res[o],&header.payload[i + 1],header.payload[i]);
+
+ if (o + header.payload[i] > sizeof(DNSHeader))
+ return std::make_pair((unsigned char *) NULL, "DN label decompression is impossible -- malformed/hostile packet?");
+
+ memcpy(&res[o], &header.payload[i + 1], header.payload[i]);
o += header.payload[i];
i += header.payload[i] + 1;
}
}
}
res[o] = 0;
+ }
break;
case DNS_QUERY_AAAA:
+ if (rr.rdlength != sizeof(struct in6_addr))
+ return std::make_pair((unsigned char *) NULL, "rr.rdlength is larger than 16 bytes for an ipv6 entry -- malformed/hostile packet?");
+
memcpy(res,&header.payload[i],rr.rdlength);
res[rr.rdlength] = 0;
break;
case DNS_QUERY_A:
+ if (rr.rdlength != sizeof(struct in_addr))
+ return std::make_pair((unsigned char *) NULL, "rr.rdlength is larger than 4 bytes for an ipv4 entry -- malformed/hostile packet?");
+
memcpy(res,&header.payload[i],rr.rdlength);
res[rr.rdlength] = 0;
break;
default:
- memcpy(res,&header.payload[i],rr.rdlength);
- res[rr.rdlength] = 0;
+ return std::make_pair((unsigned char *) NULL, "don't know how to handle undefined type (" + ConvToStr(rr.type) + ") -- rejecting");
break;
}
return std::make_pair(res,"No error");
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 2ac844bb6..86223ae95 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -488,8 +488,8 @@ InspIRCd::InspIRCd(int argc, char** argv) :
printf_c("\033[1;32mInspire Internet Relay Chat Server, compiled %s at %s\n",__DATE__,__TIME__);
printf_c("(C) InspIRCd Development Team.\033[0m\n\n");
printf_c("Developers:\n");
- printf_c("\t\033[1;32mBrain, FrostyCoolSlug, w00t, Om, Special\n");
- printf_c("\t\033[1;32mpeavey, aquanight, psychon, dz, danieldg\033[0m\n\n");
+ printf_c("\t\033[1;32mBrain, FrostyCoolSlug, w00t, Om, Special, peavey\n");
+ printf_c("\t\033[1;32maquanight, psychon, dz, danieldg, jackmcbarn\033[0m\n\n");
printf_c("Others:\t\t\t\033[1;32mSee /INFO Output\033[0m\n");
this->Modes = new ModeParser;
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_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_chghost.cpp b/src/modules/m_chghost.cpp
index 8c3911418..0262a5f37 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -33,6 +33,12 @@ class CommandChghost : public Command
{
const char* x = parameters[1].c_str();
+ if (parameters[1].length() > 63)
+ {
+ user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick.c_str());
+ return CMD_FAILURE;
+ }
+
for (; *x; x++)
{
if (!hostmap[(unsigned char)*x])
@@ -42,11 +48,6 @@ class CommandChghost : public Command
}
}
- if ((parameters[1].c_str() - x) > 63)
- {
- user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick.c_str());
- return CMD_FAILURE;
- }
User* dest = ServerInstance->FindNick(parameters[0]);
if (!dest)
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp
index 20c7e5bc2..6e4600da6 100644
--- a/src/modules/m_hostchange.cpp
+++ b/src/modules/m_hostchange.cpp
@@ -73,7 +73,7 @@ class ModuleHostChange : public Module
for (int index = 0; index < Conf.Enumerate("hostchange"); index++)
{
std::string mask = Conf.ReadValue("hostchange", "mask", index);
- std::string ports = Conf.ReadValue("hosthange", "ports", index);
+ std::string ports = Conf.ReadValue("hostchange", "ports", index);
std::string action = Conf.ReadValue("hostchange", "action", index);
std::string newhost = Conf.ReadValue("hostchange", "value", index);
Host* x = new Host;
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_remove.cpp b/src/modules/m_remove.cpp
index 2394332be..ffbae43bb 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -77,6 +77,11 @@ class RemoveBase : public Command
hasnokicks = (ServerInstance->Modules->Find("m_nokicks.so") && channel->IsModeSet('Q'));
+ if((ServerInstance->ULine(target->server) || ServerInstance->ULine(target->nick.c_str()))){
+ user->WriteNumeric(482, "%s %s :Only a u-line may remove a u-line from a channel.", user->nick.c_str(), channame);
+ return CMD_FAILURE;
+ }
+
/* We support the +Q channel mode via. the m_nokicks module, if the module is loaded and the mode is set then disallow the /remove */
if ((!IS_LOCAL(user)) || (!supportnokicks || !hasnokicks))
{
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 6d7f12562..e11aa9956 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -202,6 +202,12 @@ class ModuleShun : public Module
ServerInstance->XLines->UnregisterFactory(&f);
}
+ void Prioritize()
+ {
+ Module* alias = ServerInstance->Modules->Find("m_alias.so");
+ ServerInstance->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_BEFORE, &alias);
+ }
+
virtual ModResult OnStats(char symbol, User* user, string_list& out)
{
if (symbol != 'H')
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/users.cpp b/src/users.cpp
index 7f8e3df8a..6277f95f9 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;
}