diff options
-rw-r--r-- | language/anope.it_IT.po | 2 | ||||
-rw-r--r-- | modules/database/db_flatfile.cpp | 14 | ||||
-rw-r--r-- | modules/protocol/bahamut.cpp | 1 | ||||
-rw-r--r-- | modules/protocol/hybrid.cpp | 207 | ||||
-rw-r--r-- | src/config.cpp | 30 |
5 files changed, 190 insertions, 64 deletions
diff --git a/language/anope.it_IT.po b/language/anope.it_IT.po index f0b0b518e..8253271f4 100644 --- a/language/anope.it_IT.po +++ b/language/anope.it_IT.po @@ -7235,7 +7235,7 @@ msgstr "Limita l'accesso al canale" #: modules/commands/cs_set.cpp:1291 msgid "Restricted access" -msgstr "Acesso limitato" +msgstr "Accesso limitato" #: modules/commands/cs_set.cpp:661 #, c-format diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp index f00694735..de7a5b951 100644 --- a/modules/database/db_flatfile.cpp +++ b/modules/database/db_flatfile.cpp @@ -308,10 +308,7 @@ class DBFlatFile : public Module, public Pipe else db_name = Anope::DataDir + "/" + Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"); - if (Anope::IsFile(db_name)) - rename(db_name.c_str(), (db_name + ".tmp").c_str()); - - std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream(db_name.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); + std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream((db_name + ".tmp").c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); if (!fs->is_open()) Log(this) << "Unable to open " << db_name << " for writing"; @@ -345,14 +342,15 @@ class DBFlatFile : public Module, public Pipe this->Write("Unable to write database " + db_name); f->close(); - - if (Anope::IsFile((db_name + ".tmp").c_str())) - rename((db_name + ".tmp").c_str(), db_name.c_str()); } else { f->close(); - unlink((db_name + ".tmp").c_str()); +#ifdef _WIN32 + /* Windows rename() fails if the file already exists. */ + remove(db_name.c_str()); +#endif + rename((db_name + ".tmp").c_str(), db_name.c_str()); } delete f; diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 439aaf117..96198423b 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -524,6 +524,7 @@ class ProtoBahamut : public Module /* v/h/o/a/q */ ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0)); + ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1)); ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 1)); /* Add channel modes */ diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 7c3d98a63..5046030ba 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -1,7 +1,7 @@ /* ircd-hybrid protocol module. Minimum supported version of ircd-hybrid is 8.2.23. * * (C) 2003-2022 Anope Team <team@anope.org> - * (C) 2012-2020 ircd-hybrid development team + * (C) 2012-2022 ircd-hybrid development team * * Please read COPYING and README for further details. * @@ -10,6 +10,7 @@ */ #include "module.h" +#include "modules/cs_mode.h" static Anope::string UplinkSID; static bool UseSVSAccount = false; // Temporary backwards compatibility hack until old proto is deprecated @@ -22,7 +23,7 @@ class HybridProto : public IRCDProto u->KillInternal(source, buf); } - public: + public: HybridProto(Module *creator) : IRCDProto(creator, "ircd-hybrid 8.2.23+") { DefaultPseudoclientModes = "+oi"; @@ -100,20 +101,32 @@ class HybridProto : public IRCDProto void SendJoin(User *u, Channel *c, const ChannelStatus *status) override { + UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << u->GetUID(); + /* - * Note that we must send our modes with the SJOIN and can not add them to the - * mode stacker because ircd-hybrid does not allow *any* client to op itself + * Note that we can send this with the SJOIN but choose not to + * because the mode stacker will handle this and probably will + * merge these modes with +nrt and other mlocked modes. */ - UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" - << (status != NULL ? status->BuildModePrefixList() : "") << u->GetUID(); - - /* And update our internal status for this user since this is not going through our mode handling system */ if (status) { + /* First save the channel status in case uc->status == status */ + ChannelStatus cs = *status; + + /* + * If the user is internally on the channel with flags, kill them so that + * the stacker will allow this. + */ ChanUserContainer *uc = c->FindUser(u); + if (uc) + uc->status.Clear(); + + BotInfo *setter = BotInfo::Find(u->GetUID()); + for (size_t i = 0; i < cs.Modes().length(); ++i) + c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), u->GetUID(), false); if (uc) - uc->status = *status; + uc->status = cs; } } @@ -171,15 +184,13 @@ class HybridProto : public IRCDProto UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password; /* - * As of October 02, 2020, ircd-hybrid-8 does support the following capabilities - * which are required to work with IRC-services: - * * TBURST - Supports topic burst * ENCAP - Supports ENCAP * EOB - Supports End Of Burst message * RHOST - Supports UID message with realhost information + * MLOCK - Supports MLOCK */ - UplinkSocket::Message() << "CAPAB :ENCAP TBURST EOB RHOST"; + UplinkSocket::Message() << "CAPAB :ENCAP TBURST EOB RHOST MLOCK"; SendServer(Me); @@ -222,11 +233,7 @@ class HybridProto : public IRCDProto void SendChannel(Channel *c) override { - Anope::string modes = c->GetModes(true, true); - - if (modes.empty()) - modes = "+"; - + Anope::string modes = "+" + c->GetModes(true, true); UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " " << modes << " :"; } @@ -275,6 +282,11 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "SVSHOST " << u->GetUID() << " " << u->timestamp << " " << u->host; } + bool IsExtbanValid(const Anope::string &mask) override + { + return mask.length() >= 4 && mask[0] == '$' && mask[2] == ':'; + } + bool IsIdentValid(const Anope::string &ident) override { if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) @@ -317,7 +329,7 @@ struct IRCDMessageBMask : IRCDMessage { IRCDMessageBMask(Module *creator) : IRCDMessage(creator, "BMASK", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - /* 0 1 2 3 */ + /* 0 1 2 3 */ /* :0MC BMASK 1350157102 #channel b :*!*@*.test.com */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -335,6 +347,31 @@ struct IRCDMessageBMask : IRCDMessage } }; +struct IRCDMessageCapab : Message::Capab +{ + IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + /* 0 */ + /* CAPAB :TBURST EOB MLOCK */ + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override + { + spacesepstream sep(params[0]); + Anope::string capab; + + while (sep.GetToken(capab)) + { + if (capab.find("HOP") != Anope::string::npos || capab.find("RHOST") != Anope::string::npos) + ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1)); + if (capab.find("AOP") != Anope::string::npos) + ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '&', 3)); + if (capab.find("QOP") != Anope::string::npos) + ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '~', 4)); + } + + Message::Capab::Run(source, params, tags); + } +}; + struct IRCDMessageEOB : IRCDMessage { IRCDMessageEOB(Module *creator) : IRCDMessage(creator, "EOB", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } @@ -357,7 +394,32 @@ struct IRCDMessageJoin : Message::Join std::vector<Anope::string> p = params; p.erase(p.begin()); - return Message::Join::Run(source, p, tags); + Message::Join::Run(source, p, tags); + } +}; + +struct IRCDMessageMLock : IRCDMessage +{ + IRCDMessageMLock(Module *creator) : IRCDMessage(creator, "MLOCK", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + /* 0 1 2 3 */ + /* :0MC MLOCK 1350157102 #channel 1350158923 :nt */ + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override + { + Channel *c = Channel::Find(params[1]); + + if (c && c->ci) + { + ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks"); + Anope::string modes; + + if (modelocks) + modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); + + // Mode lock string is not what we say it is? + if (modes != params[3]) + UplinkSocket::Message(Me) << "MLOCK " << c->creation_time << " " << c->name << " " << Anope::CurTime << " :" << modes; + } } }; @@ -400,7 +462,7 @@ struct IRCDMessageServer : IRCDMessage { IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - /* 0 1 2 3 4 */ + /* 0 1 2 3 4 */ /* SERVER hades.arpa 1 4XY + :ircd-hybrid test server */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -422,9 +484,9 @@ struct IRCDMessageServer : IRCDMessage struct IRCDMessageSID : IRCDMessage { - IRCDMessageSID(Module *creator) : IRCDMessage(creator, "SID", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageSID(Module *creator) : IRCDMessage(creator, "SID", 5) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - /* 0 1 2 3 4 */ + /* 0 1 2 3 4 */ /* :0MC SID hades.arpa 2 4XY + :ircd-hybrid test server */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -437,15 +499,16 @@ struct IRCDMessageSID : IRCDMessage struct IRCDMessageSJoin : IRCDMessage { - IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + /* 0 1 2 3 */ + /* :0MC SJOIN 1654877335 #nether +nt :@0MCAAAAAB +0MCAAAAAC */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Anope::string modes; - if (params.size() >= 3) - for (unsigned i = 2; i < params.size() - 1; ++i) - modes += " " + params[i]; + for (unsigned i = 2; i < params.size() - 1; ++i) + modes += " " + params[i]; if (!modes.empty()) modes.erase(modes.begin()); @@ -485,11 +548,8 @@ struct IRCDMessageSVSMode : IRCDMessage { IRCDMessageSVSMode(Module *creator) : IRCDMessage(creator, "SVSMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - /* - * parv[0] = nickname - * parv[1] = TS - * parv[2] = mode - */ + /* 0 1 2 */ + /* :0MC SVSMODE 0MCAAAAAB 1350157102 +r */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = User::Find(params[0]); @@ -508,6 +568,8 @@ struct IRCDMessageTBurst : IRCDMessage { IRCDMessageTBurst(Module *creator) : IRCDMessage(creator, "TBURST", 5) { } + /* 0 1 2 3 4 */ + /* :0MC TBURST 1654867975 #nether 1654877335 Steve!~steve@the.mines :Join the ghast nation */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Anope::string setter; @@ -524,6 +586,8 @@ struct IRCDMessageTMode : IRCDMessage { IRCDMessageTMode(Module *creator) : IRCDMessage(creator, "TMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + /* 0 1 2 */ + /* :0MC TMODE 1654867975 #nether +ntR */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { time_t ts = 0; @@ -547,14 +611,14 @@ struct IRCDMessageTMode : IRCDMessage struct IRCDMessageUID : IRCDMessage { - IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 10) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 11) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + /* 0 1 2 3 4 5 6 7 8 9 10 */ + /* :0MC UID Steve 1 1350157102 +oi ~steve virtual.host real.host 10.0.0.1 0MCAAAAAB Steve :Mining all the time */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { NickAlias *na = NULL; - /* 0 1 2 3 4 5 6 7 8 9 10 */ - /* :0MC UID Steve 1 1350157102 +oi ~steve virtual.host real.host 10.0.0.1 0MCAAAAAB Steve :Mining all the time */ if (params[9] != "*") na = NickAlias::Find(params[9]); @@ -586,7 +650,6 @@ class ProtoHybrid : public Module /* Core message handlers */ Message::Away message_away; - Message::Capab message_capab; Message::Error message_error; Message::Invite message_invite; Message::Kick message_kick; @@ -607,8 +670,10 @@ class ProtoHybrid : public Module /* Our message handlers */ IRCDMessageBMask message_bmask; + IRCDMessageCapab message_capab; IRCDMessageEOB message_eob; IRCDMessageJoin message_join; + IRCDMessageMLock message_mlock; IRCDMessageNick message_nick; IRCDMessagePass message_pass; IRCDMessagePong message_pong; @@ -621,11 +686,13 @@ class ProtoHybrid : public Module IRCDMessageUID message_uid; IRCDMessageCertFP message_certfp; + bool use_server_side_mlock; + void AddModes() { /* Add user modes */ ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a')); - ModeManager::AddUserMode(new UserModeOperOnly("CALLERID", 'g')); + ModeManager::AddUserMode(new UserMode("CALLERID", 'g')); ModeManager::AddUserMode(new UserMode("INVIS", 'i')); ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l')); ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); @@ -634,21 +701,22 @@ class ProtoHybrid : public Module ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r')); ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's')); ModeManager::AddUserMode(new UserMode("WALLOPS", 'w')); + ModeManager::AddUserMode(new UserMode("BOT", 'B')); ModeManager::AddUserMode(new UserMode("DEAF", 'D')); ModeManager::AddUserMode(new UserMode("SOFTCALLERID", 'G')); ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H')); ModeManager::AddUserMode(new UserMode("REGPRIV", 'R')); ModeManager::AddUserMode(new UserModeNoone("SSL", 'S')); ModeManager::AddUserMode(new UserModeNoone("WEBIRC", 'W')); + ModeManager::AddUserMode(new UserMode("SECUREONLY", 'Z')); /* b/e/I */ ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b')); ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e')); ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I')); - /* v/h/o */ + /* v/o */ ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0)); - ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1)); ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2)); /* l/k */ @@ -664,25 +732,28 @@ class ProtoHybrid : public Module ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r')); ModeManager::AddChannelMode(new ChannelMode("SECRET", 's')); ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't')); - ModeManager::AddChannelMode(new ChannelMode("HIDEBMASKS", 'u')); ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C')); ModeManager::AddChannelMode(new ChannelMode("NOKNOCK", 'K')); ModeManager::AddChannelMode(new ChannelModeOperOnly("LBAN", 'L')); ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M')); + ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N')); ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O')); + ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q')); ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R')); ModeManager::AddChannelMode(new ChannelMode("SSL", 'S')); ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'T')); + ModeManager::AddChannelMode(new ChannelMode("NOINVITE", 'V')); + ModeManager::AddChannelMode(new ChannelModeNoone("ISSECURE", 'Z')); } -public: + public: ProtoHybrid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), ircd_proto(this), - message_away(this), message_capab(this), message_error(this), message_invite(this), message_kick(this), + message_away(this), message_error(this), message_invite(this), message_kick(this), message_kill(this), message_mode(this), message_motd(this), message_notice(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this), message_topic(this), message_version(this), message_whois(this), - message_bmask(this), message_eob(this), message_join(this), + message_bmask(this), message_capab(this), message_eob(this), message_join(this), message_mlock(this), message_nick(this), message_pass(this), message_pong(this), message_server(this), message_sid(this), message_sjoin(this), message_svsmode(this), message_tburst(this), message_tmode(this), message_uid(this), message_certfp(this) @@ -695,6 +766,56 @@ public: { u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); } + + void OnReload(Configuration::Conf *conf) override + { + use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); + } + + void OnChannelSync(Channel *c) override + { + if (!c->ci) + return; + + ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks"); + if (use_server_side_mlock && modelocks && Servers::Capab.count("MLOCK")) + { + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); + UplinkSocket::Message(Me) << "MLOCK " << c->creation_time << " " << c->ci->name << " " << Anope::CurTime << " :" << modes; + } + } + + void OnDelChan(ChannelInfo *ci) override + { + if (use_server_side_mlock && ci->c && Servers::Capab.count("MLOCK")) + UplinkSocket::Message(Me) << "MLOCK " << ci->c->creation_time << " " << ci->name << " " << Anope::CurTime << " :"; + } + + EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) override + { + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); + ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); + if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK")) + { + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; + UplinkSocket::Message(Me) << "MLOCK " << ci->c->creation_time << " " << ci->name << " " << Anope::CurTime << " :" << modes; + } + + return EVENT_CONTINUE; + } + + EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) override + { + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); + ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); + if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK")) + { + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); + UplinkSocket::Message(Me) << "MLOCK " << ci->c->creation_time << " " << ci->name << " " << Anope::CurTime << " :" << modes; + } + + return EVENT_CONTINUE; + } }; MODULE_INIT(ProtoHybrid) diff --git a/src/config.cpp b/src/config.cpp index c6ead071e..d7b90a105 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -89,6 +89,12 @@ static void ValidateNoSpaces(const Anope::string &block, const Anope::string &na throw ConfigException("The value for <" + block + ":" + name + "> may not contain spaces!"); } +static void ValidateNotEmptyOrSpaces(const Anope::string &block, const Anope::string &name, const Anope::string &value) +{ + ValidateNotEmpty(block, name, value); + ValidateNoSpaces(block, name, value); +} + template<typename T> static void ValidateNotZero(const Anope::string &block, const Anope::string &name, T value) { if (!value) @@ -144,7 +150,7 @@ Conf::Conf() : Block(""), EmptyBlock("") const Anope::string &servername = serverinfo->Get<Anope::string>("name"); - ValidateNotEmpty("serverinfo", "name", servername); + ValidateNotEmptyOrSpaces("serverinfo", "name", servername); if (servername.find(' ') != Anope::string::npos || servername.find('.') == Anope::string::npos) throw ConfigException("serverinfo:name is not a valid server name"); @@ -192,9 +198,9 @@ Conf::Conf() : Block(""), EmptyBlock("") int port = uplink->Get<int>("port"); const Anope::string &password = uplink->Get<const Anope::string>("password"); - ValidateNotEmpty("uplink", "host", host); + ValidateNotEmptyOrSpaces("uplink", "host", host); ValidateNotZero("uplink", "port", port); - ValidateNotEmpty("uplink", "password", password); + ValidateNotEmptyOrSpaces("uplink", "password", password); if (password.find(' ') != Anope::string::npos || password[0] == ':') throw ConfigException("uplink:password is not valid"); @@ -208,7 +214,7 @@ Conf::Conf() : Block(""), EmptyBlock("") const Anope::string &modname = module->Get<const Anope::string>("name"); - ValidateNotEmpty("module", "name", modname); + ValidateNotEmptyOrSpaces("module", "name", modname); this->ModulesAutoLoad.push_back(modname); } @@ -270,7 +276,7 @@ Conf::Conf() : Block(""), EmptyBlock("") &vhost = oper->Get<const Anope::string>("vhost"); bool require_oper = oper->Get<bool>("require_oper"); - ValidateNotEmpty("oper", "name", nname); + ValidateNotEmptyOrSpaces("oper", "name", nname); ValidateNotEmpty("oper", "type", type); OperType *ot = NULL; @@ -303,9 +309,9 @@ Conf::Conf() : Block(""), EmptyBlock("") &modes = service->Get<const Anope::string>("modes"), &channels = service->Get<const Anope::string>("channels"); - ValidateNotEmpty("service", "nick", nick); - ValidateNotEmpty("service", "user", user); - ValidateNotEmpty("service", "host", host); + ValidateNotEmptyOrSpaces("service", "nick", nick); + ValidateNotEmptyOrSpaces("service", "user", user); + ValidateNotEmptyOrSpaces("service", "host", host); ValidateNotEmpty("service", "gecos", gecos); ValidateNoSpaces("service", "channels", channels); @@ -415,9 +421,9 @@ Conf::Conf() : Block(""), EmptyBlock("") &group = command->Get<const Anope::string>("group"); bool hide = command->Get<bool>("hide"); - ValidateNotEmpty("command", "service", service); + ValidateNotEmptyOrSpaces("command", "service", service); ValidateNotEmpty("command", "name", nname); - ValidateNotEmpty("command", "command", cmd); + ValidateNotEmptyOrSpaces("command", "command", cmd); BotInfo *bi = this->GetClient(service); if (!bi) @@ -451,8 +457,8 @@ Conf::Conf() : Block(""), EmptyBlock("") bool hide = fantasy->Get<bool>("hide"), prepend_channel = fantasy->Get<bool>("prepend_channel", "yes"); - ValidateNotEmpty("fantasy", "name", nname); - ValidateNotEmpty("fantasy", "command", service); + ValidateNotEmptyOrSpaces("fantasy", "name", nname); + ValidateNotEmptyOrSpaces("fantasy", "command", service); CommandInfo &c = this->Fantasy[nname]; c.name = service; |