diff --git a/data/example.conf b/data/example.conf index 32c536207..4592ae7c9 100644 --- a/data/example.conf +++ b/data/example.conf @@ -267,6 +267,10 @@ networkinfo * but recommended. */ hostlen = 64 + + /* Set this to the maximum allowed channel length on your network. + */ + chanlen = 32 } /* diff --git a/include/config.h b/include/config.h index d9ec11abd..23ebe2da9 100644 --- a/include/config.h +++ b/include/config.h @@ -391,6 +391,8 @@ class CoreExport ServerConfig unsigned UserLen; /* Max lenght of hostnames */ unsigned HostLen; + /* Max length of channel names */ + unsigned ChanLen; /* Casemapping to use */ Anope::string CaseMap; diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 59dd9ddd6..d3b94b26c 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -341,10 +341,10 @@ class UnrealIRCdProto : public IRCDProto bool IsChannelValid(const Anope::string &chan) anope_override { - if (chan.find(':') != Anope::string::npos || chan[0] != '#') + if (chan.find(':') != Anope::string::npos) return false; - return true; + return IRCDProto::IsChannelValid(chan); } void SendLogin(User *u) anope_override diff --git a/src/config.cpp b/src/config.cpp index 6896be7c8..375a097ce 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -1164,6 +1164,7 @@ ConfigItems::ConfigItems(ServerConfig *conf) {"networkinfo", "nicklen", "31", new ValueContainerUInt(&conf->NickLen), DT_UINTEGER | DT_NORELOAD, ValidateNickLen}, {"networkinfo", "userlen", "10", new ValueContainerUInt(&conf->UserLen), DT_UINTEGER | DT_NORELOAD, NoValidation}, {"networkinfo", "hostlen", "64", new ValueContainerUInt(&conf->HostLen), DT_UINTEGER | DT_NORELOAD, NoValidation}, + {"networkinfo", "chanlen", "32", new ValueContainerUInt(&conf->ChanLen), DT_UINTEGER | DT_NORELOAD, NoValidation}, {"options", "casemap", "ascii", new ValueContainerString(&conf->CaseMap), DT_STRING, NoValidation}, {"options", "passlen", "32", new ValueContainerUInt(&conf->PassLen), DT_UINTEGER | DT_NORELOAD, NoValidation}, {"options", "seed", "0", new ValueContainerLUInt(&conf->Seed), DT_LUINTEGER, NoValidation}, diff --git a/src/protocol.cpp b/src/protocol.cpp index e9ab88c77..c6ace2a16 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -310,7 +310,7 @@ void IRCDProto::SendNumeric(int numeric, const Anope::string &dest, const char * bool IRCDProto::IsChannelValid(const Anope::string &chan) { - if (chan[0] != '#') + if (chan.empty() || chan[0] != '#' || chan.length() > Config->ChanLen) return false; return true;