summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-07-21 18:29:35 -0400
committerAdam <Adam@anope.org>2013-07-21 18:29:35 -0400
commit779f3788c97cccf20208392bf4284df7b42604d8 (patch)
treec8d2744afc6419a046d812999e8e61e75eb993bf
parent604da898136b9299f555336df633e30a09f44ddd (diff)
More validation stuff from fgs
-rw-r--r--modules/commands/ns_register.cpp6
-rw-r--r--modules/pseudoclients/nickserv.cpp2
-rw-r--r--src/config.cpp33
3 files changed, 27 insertions, 14 deletions
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index 5f768f6cb..fd19590e8 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -128,6 +128,12 @@ class CommandNSRegister : public Command
return;
}
+ if (nsregister.equals_ci("mail") && email.empty())
+ {
+ source.Reply(_("You must specify an email address."));
+ return;
+ }
+
time_t nickregdelay = Config->GetModule(this->owner)->Get<time_t>("nickregdelay");
time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay");
if (u && !u->HasMode("OPER") && nickregdelay && Anope::CurTime - u->timestamp < nickregdelay)
diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp
index 6730e91b9..4b9f016df 100644
--- a/modules/pseudoclients/nickserv.cpp
+++ b/modules/pseudoclients/nickserv.cpp
@@ -324,7 +324,7 @@ class NickServCore : public Module, public NickServService
if (!modesonid.empty())
u->SetModes(NickServ, "%s", modesonid.c_str());
- if (block->Get<bool>("forceemail") && u->Account()->email.empty())
+ if (block->Get<bool>("forceemail", "yes") && u->Account()->email.empty())
{
u->SendMessage(NickServ, _("You must now supply an e-mail for your nick.\n"
"This e-mail will allow you to retrieve your password in\n"
diff --git a/src/config.cpp b/src/config.cpp
index 1000e6cf4..27c3eccdc 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -145,26 +145,26 @@ Conf::Conf() : Block("")
{
Anope::string block;
Anope::string name;
- Anope::string def;
} noreload[] = {
- {"serverinfo", "name", ""},
- {"serverinfo", "description", ""},
- {"serverinfo", "localhost", ""},
- {"serverinfo", "id", ""},
- {"serverinfo", "pid", ""},
- {"networkinfo", "nicklen", "31"},
- {"networkinfo", "userlen", "10"},
- {"networkinfo", "hostlen", "64"},
- {"networkinfo", "chanlen", "32"},
- {"options", "passlen", "32"},
+ {"serverinfo", "name"},
+ {"serverinfo", "description"},
+ {"serverinfo", "localhost"},
+ {"serverinfo", "id"},
+ {"serverinfo", "pid"},
+ {"networkinfo", "nicklen"},
+ {"networkinfo", "userlen"},
+ {"networkinfo", "hostlen"},
+ {"networkinfo", "chanlen"},
+ {"options", "passlen"},
};
for (unsigned i = 0; i < sizeof(noreload) / sizeof(noreload[0]); ++i)
- if (this->GetBlock(noreload[i].block)->Get<const Anope::string>(noreload[i].name, noreload[i].def) != Config->GetBlock(noreload[i].block)->Get<const Anope::string>(noreload[i].name, noreload[i].def))
+ if (this->GetBlock(noreload[i].block)->Get<const Anope::string>(noreload[i].name) != Config->GetBlock(noreload[i].block)->Get<const Anope::string>(noreload[i].name))
throw ConfigException("<" + noreload[i].block + ":" + noreload[i].name + "> can not be modified once set");
}
- Block *serverinfo = this->GetBlock("serverinfo"), *options = this->GetBlock("options"), *mail = this->GetBlock("mail");
+ Block *serverinfo = this->GetBlock("serverinfo"), *options = this->GetBlock("options"),
+ *mail = this->GetBlock("mail"), *networkinfo = this->GetBlock("networkinfo");
ValidateNotEmpty("serverinfo", "name", serverinfo->Get<const Anope::string>("name"));
ValidateNotEmpty("serverinfo", "description", serverinfo->Get<const Anope::string>("description"));
@@ -176,11 +176,17 @@ Conf::Conf() : Block("")
ValidateNotZero("options", "expiretimeout", options->Get<time_t>("expiretimeout"));
ValidateNotZero("options", "readtimeout", options->Get<time_t>("readtimeout"));
ValidateNotZero("options", "warningtimeout", options->Get<time_t>("warningtimeout"));
+ ValidateNotZero("options", "passlen", options->Get<time_t>("passlen"));
ValidateNotEmpty("options", "enforceruser", options->Get<const Anope::string>("enforceruser"));
ValidateNotEmpty("options", "enforcerhost", options->Get<const Anope::string>("enforcerhost"));
ValidateNotEmpty("options", "guestnickprefix", options->Get<const Anope::string>("guestnickprefix"));
+ ValidateNotZero("networkinfo", "nicklen", networkinfo->Get<unsigned>("nicklen"));
+ ValidateNotZero("networkinfo", "userlen", networkinfo->Get<unsigned>("userlen"));
+ ValidateNotZero("networkinfo", "hostlen", networkinfo->Get<unsigned>("hostlen"));
+ ValidateNotZero("networkinfo", "chanlen", networkinfo->Get<unsigned>("chanlen"));
+
spacesepstream(options->Get<const Anope::string>("ulineservers")).GetTokens(this->Ulines);
if (mail->Get<bool>("usemail"))
@@ -212,6 +218,7 @@ Conf::Conf() : Block("")
const Anope::string &password = uplink->Get<const Anope::string>("password");
ValidateNotEmpty("uplink", "host", host);
+ ValidateNotZero("uplink", "port", port);
ValidateNotEmpty("uplink", "password", password);
this->Uplinks.push_back(Uplink(host, port, password, ipv6));