diff options
-rw-r--r-- | data/example.conf | 16 | ||||
-rw-r--r-- | data/nickserv.example.conf | 4 | ||||
-rw-r--r-- | docs/Changes.conf | 1 | ||||
-rw-r--r-- | modules/commands/ns_group.cpp | 15 | ||||
-rw-r--r-- | modules/commands/ns_resetpass.cpp | 4 | ||||
-rw-r--r-- | modules/commands/os_session.cpp | 2 | ||||
-rw-r--r-- | modules/extra/m_sasl_dh-aes.cpp | 10 | ||||
-rw-r--r-- | modules/extra/m_sasl_dh-blowfish.cpp | 10 | ||||
-rw-r--r-- | modules/extra/stats/irc2sql/tables.cpp | 60 | ||||
-rw-r--r-- | modules/ns_maxemail.cpp | 12 | ||||
-rw-r--r-- | modules/protocol/ngircd.cpp | 8 | ||||
-rw-r--r-- | modules/pseudoclients/nickserv.cpp | 6 |
12 files changed, 57 insertions, 91 deletions
diff --git a/data/example.conf b/data/example.conf index 5ccb4539b..9ffedac1f 100644 --- a/data/example.conf +++ b/data/example.conf @@ -780,7 +780,7 @@ log * memoserv/sendall memoserv/staff * * nickserv/getpass nickserv/getemail nickserv/suspend nickserv/ajoin - * nickserv/resetpass nickserv/list + * nickserv/list * * nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet nickserv/saset/password * nickserv/saset/display nickserv/saset/kill nickserv/saset/language nickserv/saset/message @@ -826,7 +826,7 @@ opertype inherits = "Helper, Another Helper" /* What commands (see above) this opertype may use */ - commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/resetpass nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline" + commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline" /* What privs (see above) this opertype has */ privs = "chanserv/auspex chanserv/no-register-limit memoserv/* nickserv/auspex nickserv/confirm" @@ -953,18 +953,6 @@ mail sendfrom = "services@localhost.net" /* - * If set, RESETPASS will be restricted to services operators with access to - * nickserv/resetpass in their opertype:commands. - * This directive is optional. - * - * WARNING: If you choose to not enable this option, you should limit the - * number of processes that the services user can have at a time (you can - * create a special user for this; remember to NEVER launch Services as - * root). - */ - restrict = yes - - /* * This controls the minimum amount of time a user must wait before sending * another e-mail after they have sent one. It also controls the minimum time * a user must wait before they can receive another e-mail. diff --git a/data/nickserv.example.conf b/data/nickserv.example.conf index 0c7fd49c6..f6c47ad0c 100644 --- a/data/nickserv.example.conf +++ b/data/nickserv.example.conf @@ -640,7 +640,7 @@ command { service = "NickServ"; name = "UPDATE"; command = "nickserv/update"; } * Limits how many times the same email address may be used in Anope * to register accounts. */ -module +#module { name = "ns_maxemail" @@ -649,5 +649,5 @@ module * commented, there will be no limit enforced when registering new accounts or using * /msg NickServ SET EMAIL. */ - #maxemails = 1 + maxemails = 1 } diff --git a/docs/Changes.conf b/docs/Changes.conf index 8b41ad2be..82e36be6d 100644 --- a/docs/Changes.conf +++ b/docs/Changes.conf @@ -3,6 +3,7 @@ Anope Version 2.0.0 options:passlen, enforceruser, enforcerhost, releasetimeout, and guestnickprefix moved to nickserv's module configuration options:hideregisteredcommands added m_ssl renamed to m_ssl_openssl +mail:restrict removed Anope Version 1.9.9 ------------------- diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index 9c54ab815..04842b3e3 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -313,14 +313,25 @@ class CommandNSGList : public Command ListFormatter list(source.GetAccount()); list.AddColumn(_("Nick")).AddColumn(_("Expires")); - time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire"); + time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "21d"), + unconfirmed_expire = Config->GetModule("nickserv")->Get<time_t>("unconfirmedexpire", "1d"); for (unsigned i = 0; i < nc->aliases->size(); ++i) { const NickAlias *na2 = nc->aliases->at(i); + Anope::string expires; + if (na2->HasExt("NS_NO_EXPIRE")) + expires = "Does not expire"; + else if (!nickserv_expire || Anope::NoExpire) + ; + else if (na2->nc->HasExt("UNCONFIRMED") && unconfirmed_expire) + expires = Anope::strftime(na2->time_registered + unconfirmed_expire, source.GetAccount()); + else + expires = Anope::strftime(na2->last_seen + nickserv_expire, source.GetAccount()); + ListFormatter::ListEntry entry; entry["Nick"] = na2->nick; - entry["Expires"] = (na2->HasExt("NS_NO_EXPIRE") || !nickserv_expire || Anope::NoExpire) ? "Does not expire" : Anope::strftime(na2->last_seen + nickserv_expire, source.GetAccount()); + entry["Expires"] = expires; list.AddEntry(entry); } diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp index a7d92b98e..c7c0302e7 100644 --- a/modules/commands/ns_resetpass.cpp +++ b/modules/commands/ns_resetpass.cpp @@ -27,9 +27,7 @@ class CommandNSResetPass : public Command { const NickAlias *na; - if (Config->GetBlock("mail")->Get<bool>("restrict") && !source.HasCommand("nickserv/resetpass")) - source.Reply(ACCESS_DENIED); - else if (!(na = NickAlias::Find(params[0]))) + if (!(na = NickAlias::Find(params[0]))) source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str()); else if (!na->nc->email.equals_ci(params[1])) source.Reply(_("Incorrect email address.")); diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index d3e82b04a..edf9458f8 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -767,7 +767,7 @@ class OSSession : public Module if (!e->expires || e->expires > Anope::CurTime) continue; BotInfo *OperServ = Config->GetClient("OperServ"); - Log(OperServ, "expire/exception") << "Session exception for " << e->mask << "has expired."; + Log(OperServ, "expire/exception") << "Session exception for " << e->mask << " has expired."; this->ss.DelException(e); delete e; } diff --git a/modules/extra/m_sasl_dh-aes.cpp b/modules/extra/m_sasl_dh-aes.cpp index 0b720b9a7..a4fc5ea44 100644 --- a/modules/extra/m_sasl_dh-aes.cpp +++ b/modules/extra/m_sasl_dh-aes.cpp @@ -21,10 +21,10 @@ class DHAES : public Mechanism } public: - struct Session : SASL::Session + struct DHAESSession : SASL::Session { DH* dh; - Session(Mechanism *m, const Anope::string &u, DH* dh_params) : SASL::Session(m, u) + DHAESSession(Mechanism *m, const Anope::string &u, DH* dh_params) : SASL::Session(m, u) { if (!(dh = DH_new())) return; @@ -39,7 +39,7 @@ class DHAES : public Mechanism } } - ~Session() + ~DHAESSession() { if (dh) DH_free(dh); @@ -50,7 +50,7 @@ class DHAES : public Mechanism const size_t keysize; SASL::Session* CreateSession(const Anope::string &uid) anope_override { - return new Session(this, uid, dh_params); + return new DHAESSession(this, uid, dh_params); } DHAES(Module *o) : Mechanism(o, "DH-AES"), keysize(256 / 8) @@ -72,7 +72,7 @@ class DHAES : public Mechanism void ProcessMessage(SASL::Session *session, const SASL::Message &m) anope_override { - Session *sess = anope_dynamic_static_cast<Session *>(session); + DHAESSession *sess = anope_dynamic_static_cast<DHAESSession *>(session); if (!sess->dh) { diff --git a/modules/extra/m_sasl_dh-blowfish.cpp b/modules/extra/m_sasl_dh-blowfish.cpp index c8ea020d5..1bfd50173 100644 --- a/modules/extra/m_sasl_dh-blowfish.cpp +++ b/modules/extra/m_sasl_dh-blowfish.cpp @@ -21,10 +21,10 @@ class DHBS : public Mechanism } public: - struct Session : SASL::Session + struct DHBSSession : SASL::Session { DH* dh; - Session(Mechanism *m, const Anope::string &u, DH* dh_params) : SASL::Session(m, u) + DHBSSession(Mechanism *m, const Anope::string &u, DH* dh_params) : SASL::Session(m, u) { if (!(dh = DH_new())) return; @@ -39,7 +39,7 @@ class DHBS : public Mechanism } } - ~Session() + ~DHBSSession() { if (dh) DH_free(dh); @@ -50,7 +50,7 @@ class DHBS : public Mechanism const size_t keysize; SASL::Session* CreateSession(const Anope::string &uid) anope_override { - return new Session(this, uid, dh_params); + return new DHBSSession(this, uid, dh_params); } DHBS(Module *o) : Mechanism(o, "DH-BLOWFISH"), keysize(256 / 8) @@ -72,7 +72,7 @@ class DHBS : public Mechanism void ProcessMessage(SASL::Session *session, const SASL::Message &m) anope_override { - Session *sess = anope_dynamic_static_cast<Session *>(session); + DHBSSession *sess = anope_dynamic_static_cast<DHBSSession *>(session); if (!sess->dh) { diff --git a/modules/extra/stats/irc2sql/tables.cpp b/modules/extra/stats/irc2sql/tables.cpp index 661069443..f8102e041 100644 --- a/modules/extra/stats/irc2sql/tables.cpp +++ b/modules/extra/stats/irc2sql/tables.cpp @@ -87,7 +87,6 @@ void IRC2SQL::CheckTables() query = "CREATE TABLE `" + prefix + "chan` (" "`chanid` int(11) UNSIGNED NOT NULL AUTO_INCREMENT," "`channel` varchar(255) NOT NULL," - "`currentusers` int(15) NOT NULL DEFAULT 0," "`topic` varchar(255) DEFAULT NULL," "`topicauthor` varchar(255) DEFAULT NULL," "`topictime` datetime DEFAULT NULL," @@ -230,47 +229,6 @@ void IRC2SQL::CheckTables() query = "CREATE PROCEDURE " + prefix + "ServerQuit(sname_ varchar(255)) " "BEGIN " /* 1. - * loop through all channels and decrease the user count - * by the number of users that are on this channel AND - * on the splitting server - * - * we dont have to care about channels that get empty, there will be - * an extra OnChannelDelete event triggered from anope. - */ - "DECLARE no_more_rows BOOLEAN DEFAULT FALSE;" - "DECLARE channel_ varchar(255);" - "DECLARE ucount_ int;" - "DECLARE channel_cursor CURSOR FOR " - "SELECT c.channel " - "FROM `" + prefix + "chan` as c, `" + prefix + "ison` as i, " - "`" + prefix + "user` as u, `" + prefix + "server` as s " - "WHERE c.chanid = i.chanid " - "AND i.nickid = u.nickid " - "AND u.servid = s.id " - "AND s.name = sname_;" - "DECLARE CONTINUE HANDLER FOR NOT FOUND " - "SET no_more_rows = TRUE;" - "OPEN channel_cursor;" - "the_loop: LOOP " - "FETCH channel_cursor INTO channel_;" - "IF no_more_rows THEN " - "CLOSE channel_cursor;" - "LEAVE the_loop;" - "END IF;" - "SELECT COUNT(*) INTO ucount_ " - "FROM `" + prefix + "ison` AS i, `" + prefix + "chan` AS c," - "`" + prefix + "user` AS u, `" + prefix + "server` AS s " - "WHERE i.nickid = u.nickid " - "AND u.servid = s.id " - "AND i.chanid = c.chanid " - "AND c.channel = channel_ " - "AND s.name = sname_; " - "UPDATE `" + prefix + "chan` " - "SET currentusers = currentusers - ucount_ " - "WHERE channel = channel_;" - "END LOOP;" - - /* 2. * remove all users on the splitting server from the ison table */ "DELETE i FROM `" + prefix + "ison` AS i " @@ -280,7 +238,7 @@ void IRC2SQL::CheckTables() "AND u.servid = s.id " "AND s.name = sname_;" - /* 3. + /* 2. * remove all users on the splitting server from the user table */ "DELETE u FROM `" + prefix + "user` AS u " @@ -288,7 +246,7 @@ void IRC2SQL::CheckTables() "WHERE s.id = u.servid " "AND s.name = sname_;" - /* 4. + /* 3. * on the splitting server, set usercount = 0, split_time = now(), online = 'N' */ "UPDATE `" + prefix + "server` SET currentusers = 0, split_time = now(), online = 'N' " @@ -306,12 +264,6 @@ void IRC2SQL::CheckTables() "UPDATE `" + prefix + "user` AS `u`, `" + prefix + "server` AS `s` " "SET s.currentusers = s.currentusers - 1 " "WHERE u.nick=nick_ AND u.servid = s.id; " - /* decrease the usercount on all channels where the user was on */ - "UPDATE `" + prefix + "user` AS u, `" + prefix + "ison` AS i, " - "`" + prefix + "chan` AS c " - "SET c.currentusers = c.currentusers - 1 " - "WHERE u.nick=nick_ AND u.nickid = i.nickid " - "AND i.chanid = c.chanid; " /* remove from all channels where the user was on */ "DELETE i FROM `" + prefix + "ison` AS i " "INNER JOIN `" + prefix + "user` as u " @@ -345,9 +297,9 @@ void IRC2SQL::CheckTables() "SELECT u.nickid, c.chanid, modes_ " "FROM " + prefix + "user AS u, " + prefix + "chan AS c " "WHERE u.nick=nick_ AND c.channel=channel_;" - "UPDATE `" + prefix + "chan` SET currentusers=currentusers+1 " - "WHERE channel=channel_;" - "SELECT `currentusers` INTO cur FROM `" + prefix + "chan` WHERE channel=channel_;" + "SELECT count(i.chanid) INTO cur " + "FROM `" + prefix + "chan` AS c, " + prefix + "ison AS i " + "WHERE i.chanid = c.chanid AND c.channel=channel_;" "SELECT `maxusers` INTO max FROM `" + prefix + "maxusers` WHERE name=channel_;" "IF found_rows() AND cur <= max THEN " "UPDATE `" + prefix + "maxusers` SET lastused=now() WHERE name=channel_;" @@ -373,8 +325,6 @@ void IRC2SQL::CheckTables() "AND u.nick = nick_ " "AND i.chanid = c.chanid " "AND c.channel = channel_;" - "UPDATE `" + prefix + "chan` SET currentusers=currentusers-1 " - "WHERE channel=channel_;" "END"; this->RunQuery(query); } diff --git a/modules/ns_maxemail.cpp b/modules/ns_maxemail.cpp index cbe74fdaf..432fe81d0 100644 --- a/modules/ns_maxemail.cpp +++ b/modules/ns_maxemail.cpp @@ -25,9 +25,9 @@ class NSMaxEmail : public Module return false; if (NSEmailMax == 1) - source.Reply(_("The given email address has reached its usage limit of 1 user.")); + source.Reply(_("The email address \2%s\2 has reached its usage limit of 1 user."), email.c_str()); else - source.Reply(_("The given email address has reached its usage limit of %d users."), NSEmailMax); + source.Reply(_("The email address \2%s\2 has reached its usage limit of %d users."), email.c_str(), NSEmailMax); return true; } @@ -57,6 +57,9 @@ class NSMaxEmail : public Module EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override { + if (source.IsOper()) + return EVENT_CONTINUE; + if (command->name == "nickserv/register") { if (this->CheckLimitReached(source, params.size() > 1 ? params[1] : "")) @@ -67,6 +70,11 @@ class NSMaxEmail : public Module if (this->CheckLimitReached(source, params.size() > 0 ? params[0] : "")) return EVENT_STOP; } + else if (command->name == "nickserv/ungroup" && source.GetAccount()) + { + if (this->CheckLimitReached(source, source.GetAccount()->email)) + return EVENT_STOP; + } return EVENT_CONTINUE; } diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index cd07866f2..b0b2bb522 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -2,7 +2,7 @@ * ngIRCd Protocol module for Anope IRC Services * * (C) 2012 Anope Team <team@anope.org> - * (C) 2011-2012 Alexander Barton <alex@barton.de> + * (C) 2011-2012, 2014 Alexander Barton <alex@barton.de> * (C) 2011 Anope Team <team@anope.org> * * Please read COPYING and README for further details. @@ -15,6 +15,12 @@ class ngIRCdProto : public IRCDProto { + void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override + { + IRCDProto::SendSVSKillInternal(source, user, buf); + user->KillInternal(source, buf); + } + public: ngIRCdProto(Module *creator) : IRCDProto(creator, "ngIRCd") { diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp index deb5cea33..0c314e500 100644 --- a/modules/pseudoclients/nickserv.cpp +++ b/modules/pseudoclients/nickserv.cpp @@ -201,6 +201,10 @@ class NickServCore : public Module, public NickServService NickAlias *na = NickAlias::Find(u->nick); if (na && *na->nc == u->Account() && !Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED")) u->SetMode(NickServ, "REGISTERED"); + + const Anope::string &modesonid = Config->GetModule(this)->Get<Anope::string>("modesonid"); + if (!modesonid.empty()) + u->SetModes(NickServ, "%s", modesonid.c_str()); } void Collide(User *u, NickAlias *na) anope_override @@ -366,7 +370,7 @@ class NickServCore : public Module, public NickServService const NickAlias *na = NickAlias::Find(u->nick); const Anope::string &unregistered_notice = Config->GetModule(this)->Get<const Anope::string>("unregistered_notice"); - if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !unregistered_notice.empty() && !na) + if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !unregistered_notice.empty() && !na && !u->Account()) u->SendMessage(NickServ, unregistered_notice); else if (na && !u->IsIdentified(true)) this->Validate(u); |