diff options
author | Adam <Adam@anope.org> | 2017-05-29 12:49:22 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-05-29 13:11:16 -0400 |
commit | 3f143633541a5361bf5b02b0d69b65447aea7b79 (patch) | |
tree | 3a33bd044bc8936150dcab38f355f3c3726b05e5 /modules | |
parent | e36d24a6c500b5ad921041fcb905f684c09d71e9 (diff) |
Remove recognized status and secure
Also remove /ns status, which is now almost useless with no recognized
status, and /ns access.
Diffstat (limited to 'modules')
24 files changed, 34 insertions, 764 deletions
diff --git a/modules/chanserv/main/channel.cpp b/modules/chanserv/main/channel.cpp index b9e519427..5f7c71c8c 100644 --- a/modules/chanserv/main/channel.cpp +++ b/modules/chanserv/main/channel.cpp @@ -247,16 +247,6 @@ void ChannelImpl::SetRestricted(bool restricted) Set(&ChannelType::restricted, restricted); } -bool ChannelImpl::IsSecure() -{ - return Get(&ChannelType::secure); -} - -void ChannelImpl::SetSecure(bool secure) -{ - Set(&ChannelType::secure, secure); -} - bool ChannelImpl::IsSecureOps() { return Get(&ChannelType::secureops); @@ -370,12 +360,6 @@ ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u, bool updateLastUsed) return group; NickServ::Account *nc = u->Account(); - if (nc == NULL && !this->IsSecure() && u->IsRecognized()) - { - NickServ::Nick *na = NickServ::FindNick(u->nick); - if (na != NULL) - nc = na->GetAccount(); - } group.super_admin = u->super_admin; group.founder = IsFounder(u); diff --git a/modules/chanserv/main/channel.h b/modules/chanserv/main/channel.h index cd419b351..eebddf91b 100644 --- a/modules/chanserv/main/channel.h +++ b/modules/chanserv/main/channel.h @@ -35,7 +35,6 @@ class ChannelImpl : public ChanServ::Channel Serialize::Storage<bool> peace; Serialize::Storage<bool> securefounder; Serialize::Storage<bool> restricted; - Serialize::Storage<bool> secure; Serialize::Storage<bool> secureops; Serialize::Storage<bool> signkick; Serialize::Storage<bool> signkicklevel; @@ -110,9 +109,6 @@ class ChannelImpl : public ChanServ::Channel bool IsRestricted() override; void SetRestricted(bool) override; - bool IsSecure() override; - void SetSecure(bool) override; - bool IsSecureOps() override; void SetSecureOps(bool) override; diff --git a/modules/chanserv/main/channeltype.cpp b/modules/chanserv/main/channeltype.cpp index 8e5c10b48..ca74263cd 100644 --- a/modules/chanserv/main/channeltype.cpp +++ b/modules/chanserv/main/channeltype.cpp @@ -39,7 +39,6 @@ ChannelType::ChannelType(Module *me) : Serialize::Type<ChannelImpl>(me) , peace(this, "peace", &ChannelImpl::peace) , securefounder(this, "securefounder", &ChannelImpl::securefounder) , restricted(this, "restricted", &ChannelImpl::restricted) - , secure(this, "secure", &ChannelImpl::secure) , secureops(this, "secureops", &ChannelImpl::secureops) , signkick(this, "signkick", &ChannelImpl::signkick) , signkicklevel(this, "signkicklevel", &ChannelImpl::signkicklevel) diff --git a/modules/chanserv/main/channeltype.h b/modules/chanserv/main/channeltype.h index 1e10f01ea..af4bc6cc9 100644 --- a/modules/chanserv/main/channeltype.h +++ b/modules/chanserv/main/channeltype.h @@ -48,7 +48,7 @@ class ChannelType : public Serialize::Type<ChannelImpl> Serialize::ObjectField<ChannelImpl, BotInfo *> servicebot; Serialize::Field<ChannelImpl, bool> greet, fantasy, noautoop, peace, securefounder, - restricted, secure, secureops, signkick, signkicklevel, noexpire, keepmodes, + restricted, secureops, signkick, signkicklevel, noexpire, keepmodes, persist, topiclock, keeptopic, _private; ChannelType(Module *); diff --git a/modules/chanserv/set.cpp b/modules/chanserv/set.cpp index 0dbb8c65c..b35d3ae51 100644 --- a/modules/chanserv/set.cpp +++ b/modules/chanserv/set.cpp @@ -702,73 +702,6 @@ class CommandCSSetRestricted : public Command } }; -class CommandCSSetSecure : public Command -{ - public: - CommandCSSetSecure(Module *creator, const Anope::string &cname = "chanserv/set/secure") : Command(creator, cname, 2, 2) - { - this->SetDesc(_("Activate security features")); - this->SetSyntax(_("\037channel\037 {ON | OFF}")); - } - - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override - { - const Anope::string &chan = params[0]; - const Anope::string ¶m = params[1]; - - if (Anope::ReadOnly) - { - source.Reply(_("Services are in read-only mode.")); - return; - } - - ChanServ::Channel *ci = ChanServ::Find(chan); - if (ci == NULL) - { - source.Reply(_("Channel \002{0}\002 isn't registered."), chan); - return; - } - - EventReturn MOD_RESULT; - MOD_RESULT = EventManager::Get()->Dispatch(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); - if (MOD_RESULT == EVENT_STOP) - return; - - if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration")) - { - source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName()); - return; - } - - if (param.equals_ci("ON")) - { - logger.Command(source, ci, _("{source} used {command} on {channel} to enable secure")); - - ci->SetSecure(true); - source.Reply(_("Secure option for \002{0}\002 is now \002on\002."), ci->GetName()); - } - else if (param.equals_ci("OFF")) - { - logger.Command(source, ci, _("{source} used {command} on {channel} to disable secure")); - - ci->SetSecure(false); - source.Reply(_("Secure option for \002{0}\002 is now \002off\002."), ci->GetName()); - } - else - { - this->OnSyntaxError(source, "SECURE"); - } - } - - bool OnHelp(CommandSource &source, const Anope::string &) override - { - source.Reply(_("Enables or disables security features for a channel." - " When \002secure\002 is set, only users who have logged in (eg. not recognized based on their hostmask)" - " will be given access to channels from account-based access entries")); - return true; - } -}; - class CommandCSSetSecureFounder : public Command { public: @@ -1143,7 +1076,6 @@ class CSSet : public Module CommandCSSetPeace commandcssetpeace; CommandCSSetPersist commandcssetpersist; CommandCSSetRestricted commandcssetrestricted; - CommandCSSetSecure commandcssetsecure; CommandCSSetSecureFounder commandcssetsecurefounder; CommandCSSetSecureOps commandcssetsecureops; CommandCSSetSignKick commandcssetsignkick; @@ -1176,7 +1108,6 @@ class CSSet : public Module , commandcssetpeace(this) , commandcssetpersist(this) , commandcssetrestricted(this) - , commandcssetsecure(this) , commandcssetsecurefounder(this) , commandcssetsecureops(this) , commandcssetsignkick(this) @@ -1301,8 +1232,6 @@ class CSSet : public Module info.AddOption(_("Peace")); if (ci->IsRestricted()) info.AddOption(_("Restricted access")); - if (ci->IsSecure()) - info.AddOption(_("Security")); if (ci->IsSecureFounder()) info.AddOption(_("Secure founder")); if (ci->IsSecureOps()) diff --git a/modules/database/flatfile.cpp b/modules/database/flatfile.cpp index 5c0f43108..9cdc0bff4 100644 --- a/modules/database/flatfile.cpp +++ b/modules/database/flatfile.cpp @@ -24,7 +24,6 @@ #include "modules/chanserv/log.h" #include "modules/chanserv/set_misc.h" #include "modules/chanserv/suspend.h" -#include "modules/nickserv/access.h" #include "modules/nickserv/ajoin.h" #include "modules/nickserv/cert.h" #include "modules/nickserv/set_misc.h" @@ -49,6 +48,7 @@ class DBFlatFile : public Module account->SetLanguage(data["language"]); account->SetOper(Oper::Find(account->GetDisplay())); +#if 0 spacesepstream sep = data["access"]; for (Anope::string token; sep.GetToken(token);) { @@ -59,6 +59,7 @@ class DBFlatFile : public Module access->SetMask(token); } } +#endif MemoServ::MemoInfo *memos = account->GetMemos(); if (memos != nullptr) @@ -71,7 +72,7 @@ class DBFlatFile : public Module catch (const ConvertException &) { } } - sep = data["memoignore"]; + spacesepstream sep = data["memoignore"]; for (Anope::string token; memos && sep.GetToken(token);) { MemoServ::Ignore *ign = Serialize::New<MemoServ::Ignore *>(); diff --git a/modules/database/old.cpp b/modules/database/old.cpp index 49692b8bd..80e179637 100644 --- a/modules/database/old.cpp +++ b/modules/database/old.cpp @@ -30,7 +30,6 @@ #include "modules/nickserv/suspend.h" #include "modules/chanserv/suspend.h" #include "modules/chanserv/access.h" -#include "modules/nickserv/access.h" #define READ(x) \ if (true) \ @@ -517,8 +516,8 @@ static void LoadNicks() READ(read_uint32(&u32, f)); if (u32 & OLD_NI_KILLPROTECT) nc->SetKillProtect(true); - if (u32 & OLD_NI_SECURE) - nc->SetSecure(true); + //if (u32 & OLD_NI_SECURE) + // nc->SetSecure(true); if (u32 & OLD_NI_MSG) nc->SetMsg(true); if (u32 & OLD_NI_MEMO_HARDMAX) @@ -608,12 +607,14 @@ static void LoadNicks() { READ(read_string(buffer, f)); +#if 0 NickAccess *a = Serialize::New<NickAccess *>(); if (a) { a->SetAccount(nc); a->SetMask(buffer); } +#endif } int16_t i16; @@ -868,8 +869,8 @@ static void LoadChannels() ci->SetRestricted(true); if (tmpu32 & OLD_CI_PEACE) ci->SetPeace(true); - if (tmpu32 & OLD_CI_SECURE) - ci->SetSecure(true); + //if (tmpu32 & OLD_CI_SECURE) + // ci->SetSecure(true); if (tmpu32 & OLD_CI_NO_EXPIRE) ci->SetNoExpire(true); if (tmpu32 & OLD_CI_MEMO_HARDMAX) diff --git a/modules/nickserv/access.cpp b/modules/nickserv/access.cpp deleted file mode 100644 index f0116d95c..000000000 --- a/modules/nickserv/access.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Anope IRC Services - * - * Copyright (C) 2003-2017 Anope Team <team@anope.org> - * - * This file is part of Anope. Anope is free software; you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License as published by the Free Software - * Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see see <http://www.gnu.org/licenses/>. - */ - -#include "module.h" -#include "modules/nickserv.h" -#include "modules/nickserv/access.h" - -class NickAccessImpl : public NickAccess -{ - friend class NickAccessType; - - Serialize::Storage<NickServ::Account *> account; - Serialize::Storage<Anope::string> mask; - - public: - using NickAccess::NickAccess; - - NickServ::Account *GetAccount() override; - void SetAccount(NickServ::Account *) override; - - Anope::string GetMask() override; - void SetMask(const Anope::string &) override; -}; - -class NickAccessType : public Serialize::Type<NickAccessImpl> -{ - public: - Serialize::ObjectField<NickAccessImpl, NickServ::Account *> account; - Serialize::Field<NickAccessImpl, Anope::string> mask; - - NickAccessType(Module *creator) : Serialize::Type<NickAccessImpl>(creator) - , account(this, "account", &NickAccessImpl::account, true) - , mask(this, "mask", &NickAccessImpl::mask) - { - } -}; - -NickServ::Account *NickAccessImpl::GetAccount() -{ - return Get(&NickAccessType::account); -} - -void NickAccessImpl::SetAccount(NickServ::Account *acc) -{ - Set(&NickAccessType::account, acc); -} - -Anope::string NickAccessImpl::GetMask() -{ - return Get(&NickAccessType::mask); -} - -void NickAccessImpl::SetMask(const Anope::string &m) -{ - Set(&NickAccessType::mask, m); -} - -class CommandNSAccess : public Command -{ - private: - void DoAdd(CommandSource &source, NickServ::Account *nc, const Anope::string &mask) - { - if (mask.empty()) - { - this->OnSyntaxError(source, "ADD"); - return; - } - - if (Anope::ReadOnly) - { - source.Reply(_("Services are in read-only mode.")); - return; - } - - std::vector<NickAccess *> access = nc->GetRefs<NickAccess *>(); - - if (access.size() >= Config->GetModule(this->GetOwner())->Get<unsigned>("accessmax", "32")) - { - source.Reply(_("Sorry, the maximum of \002{0}\002 access entries has been reached."), Config->GetModule(this->GetOwner())->Get<unsigned>("accessmax")); - return; - } - - for (NickAccess *a : access) - if (a->GetMask().equals_ci(mask)) - { - source.Reply(_("Mask \002{0}\002 already present on the access list of \002{1}\002."), mask, nc->GetDisplay()); - return; - } - - NickAccess *a = Serialize::New<NickAccess *>(); - a->SetAccount(nc); - a->SetMask(mask); - - logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to add mask {0} to {1}"), mask, nc->GetDisplay()); - source.Reply(_("\002{0}\002 added to the access list of \002{1}\002."), mask, nc->GetDisplay()); - } - - void DoDel(CommandSource &source, NickServ::Account *nc, const Anope::string &mask) - { - if (mask.empty()) - { - this->OnSyntaxError(source, "DEL"); - return; - } - - if (Anope::ReadOnly) - { - source.Reply(_("Services are in read-only mode.")); - return; - } - - for (NickAccess *a : nc->GetRefs<NickAccess *>()) - if (a->GetMask().equals_ci(mask)) - { - a->Delete(); - logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, - _("{source} used {command} to delete mask {0} from {1}"), - mask, nc->GetDisplay()); - source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), mask, nc->GetDisplay()); - return; - } - - - source.Reply(_("\002{0}\002 not found on the access list of \002{1}\002."), mask, nc->GetDisplay()); - } - - void DoList(CommandSource &source, NickServ::Account *nc, const Anope::string &mask) - { - std::vector<NickAccess *> access = nc->GetRefs<NickAccess *>(); - if (access.empty()) - { - source.Reply(_("The access list of \002{0}\002 is empty."), nc->GetDisplay()); - return; - } - - source.Reply(_("Access list for \002{0}\002:"), nc->GetDisplay()); - for (NickAccess *a : access) - { - if (!mask.empty() && !Anope::Match(a->GetMask(), mask)) - continue; - - source.Reply(" {0}", a->GetMask()); - } - } - public: - CommandNSAccess(Module *creator) : Command(creator, "nickserv/access", 1, 3) - { - this->SetDesc(_("Modify the list of authorized addresses")); - this->SetSyntax(_("ADD [\037nickname\037] \037mask\037")); - this->SetSyntax(_("DEL [\037nickname\037] \037mask\037")); - this->SetSyntax(_("LIST [\037nickname\037]")); - } - - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override - { - const Anope::string &cmd = params[0]; - Anope::string nick, mask; - - if (cmd.equals_ci("LIST")) - nick = params.size() > 1 ? params[1] : ""; - else - { - nick = params.size() == 3 ? params[1] : ""; - mask = params.size() > 1 ? params[params.size() - 1] : ""; - } - - NickServ::Account *nc; - if (!nick.empty() && source.HasPriv("nickserv/access")) - { - NickServ::Nick *na = NickServ::FindNick(nick); - if (na == NULL) - { - source.Reply(_("\002{0}\002 isn't registered."), nick); - return; - } - - if (Config->GetModule("nickserv/main")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->GetAccount() && na->GetAccount()->GetOper() && !cmd.equals_ci("LIST")) - { - source.Reply(_("You may view but not modify the access list of other Services Operators.")); - return; - } - - nc = na->GetAccount(); - } - else - { - nc = source.nc; - } - - if (!mask.empty() && (mask.find('@') == Anope::string::npos || mask.find('!') != Anope::string::npos)) - { - source.Reply(_("Mask must be in the form \037user\037@\037host\037.")); - source.Reply(_("\002%s%s HELP %s\002 for more information."), Config->StrictPrivmsg, source.service->nick, source.GetCommand()); // XXX - return; - } - - if (cmd.equals_ci("LIST")) - return this->DoList(source, nc, mask); - else if (nc->HasFieldS("NS_SUSPENDED")) - source.Reply(_("\002{0}\002 is suspended."), nc->GetDisplay()); - else if (cmd.equals_ci("ADD")) - return this->DoAdd(source, nc, mask); - else if (cmd.equals_ci("DEL")) - return this->DoDel(source, nc, mask); - else - this->OnSyntaxError(source, ""); - } - - bool OnHelp(CommandSource &source, const Anope::string &subcommand) override - { - source.Reply(_("Modifies or displays the access list for your account." - " The access list is a list of addresses that {1} uses to recognize you." - " If you match one of the hosts on the access list, services will not force you to change your nickname if the \002KILL\002 option is set." - " Furthermore, if the \002SECURE\002 option is disabled, services will recognize you just based on your hostmask, without having to supply a password." - " To gain access to channels when only recognized by your hostmask, the channel must too have the \002SECURE\002 option off." - " Services Operators may provide \037nickname\037 to modify other user's access lists.\n" - "\n" - "Examples:\n" - " \n" - " {command} ADD anyone@*.bepeg.com\n" - " Allows access to user \"anyone\" from any machine in the \"bepeg.com\" domain.\n" - "\n" - " {command} DEL anyone@*.bepeg.com\n" - " Reverses the previous command.\n" - "\n" - " {command} LIST\n" - " Displays the current access list."), - source.GetCommand(), source.service->nick); - return true; - } -}; - -class NSAccess : public Module - , public EventHook<NickServ::Event::NickRegister> -{ - CommandNSAccess commandnsaccess; - NickAccessType nick_type; - - public: - NSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) - , EventHook<NickServ::Event::NickRegister>(this) - , commandnsaccess(this) - , nick_type(this) - { - } - - void OnNickRegister(User *u, NickServ::Nick *na, const Anope::string &) override - { - if (u && Config->GetModule(this)->Get<bool>("addaccessonreg")) - { - NickAccess *a = Serialize::New<NickAccess *>(); - a->SetAccount(na->GetAccount()); - a->SetMask(u->WildMask()); - - u->SendMessage(Config->GetClient("NickServ"), - _("\002{0}\002 has been registered under your hostmask: \002{1}\002"), na->GetNick(), a->GetMask()); - } - } -}; - -MODULE_INIT(NSAccess) diff --git a/modules/nickserv/main/account.cpp b/modules/nickserv/main/account.cpp index 0ff20420b..9c3275cbe 100644 --- a/modules/nickserv/main/account.cpp +++ b/modules/nickserv/main/account.cpp @@ -19,7 +19,6 @@ #include "module.h" #include "accounttype.h" -#include "modules/nickserv/access.h" AccountImpl::~AccountImpl() { @@ -187,16 +186,6 @@ void AccountImpl::SetMsg(bool msg) Set(&AccountType::msg, msg); } -bool AccountImpl::IsSecure() -{ - return Get(&AccountType::secure); -} - -void AccountImpl::SetSecure(bool secure) -{ - Set(&AccountType::secure, secure); -} - bool AccountImpl::IsMemoSignon() { return Get(&AccountType::memosignon); @@ -288,23 +277,6 @@ void AccountImpl::SetDisplay(NickServ::Nick *na) nc = this; } -bool AccountImpl::IsOnAccess(User *u) -{ - Anope::string buf = u->GetIdent() + "@" + u->host, buf2, buf3; - if (!u->vhost.empty()) - buf2 = u->GetIdent() + "@" + u->vhost; - if (!u->GetCloakedHost().empty()) - buf3 = u->GetIdent() + "@" + u->GetCloakedHost(); - - for (NickAccess *access : GetRefs<NickAccess *>()) - { - Anope::string a = access->GetMask(); - if (Anope::Match(buf, a) || (!buf2.empty() && Anope::Match(buf2, a)) || (!buf3.empty() && Anope::Match(buf3, a))) - return true; - } - return false; -} - unsigned int AccountImpl::GetChannelCount() { unsigned int i = 0; diff --git a/modules/nickserv/main/account.h b/modules/nickserv/main/account.h index 8f8b0e123..39424faf3 100644 --- a/modules/nickserv/main/account.h +++ b/modules/nickserv/main/account.h @@ -34,7 +34,6 @@ class AccountImpl : public NickServ::Account Serialize::Storage<bool> killquick; Serialize::Storage<bool> killimmed; Serialize::Storage<bool> msg; - Serialize::Storage<bool> secure; Serialize::Storage<bool> memosignon, memoreceive, memomail; Serialize::Storage<bool> hideemail, hidemask, hidestatus, hidequit; Serialize::Storage<time_t> lastmail; @@ -88,9 +87,6 @@ class AccountImpl : public NickServ::Account bool IsMsg() override; void SetMsg(bool) override; - bool IsSecure() override; - void SetSecure(bool) override; - bool IsMemoSignon() override; void SetMemoSignon(bool) override; @@ -115,7 +111,6 @@ class AccountImpl : public NickServ::Account MemoServ::MemoInfo *GetMemos() override; void SetDisplay(NickServ::Nick *na) override; - bool IsOnAccess(User *u) override; unsigned int GetChannelCount() override; time_t GetLastMail() override; diff --git a/modules/nickserv/main/accounttype.cpp b/modules/nickserv/main/accounttype.cpp index 4c951a698..0f4ebbd16 100644 --- a/modules/nickserv/main/accounttype.cpp +++ b/modules/nickserv/main/accounttype.cpp @@ -35,7 +35,6 @@ AccountType::AccountType(Module *me) : Serialize::Type<AccountImpl>(me) , killquick(this, "killquick", &AccountImpl::killquick) , killimmed(this, "killimmed", &AccountImpl::killimmed) , msg(this, "msg", &AccountImpl::msg) - , secure(this, "secure", &AccountImpl::secure) , memosignon(this, "memo_signon", &AccountImpl::memosignon) , memoreceive(this, "memo_receive", &AccountImpl::memoreceive) , memomail(this, "memo_mail", &AccountImpl::memomail) diff --git a/modules/nickserv/main/accounttype.h b/modules/nickserv/main/accounttype.h index 6fa1bbaa3..1a6ab37cd 100644 --- a/modules/nickserv/main/accounttype.h +++ b/modules/nickserv/main/accounttype.h @@ -37,7 +37,7 @@ class AccountType : public Serialize::Type<AccountImpl> Serialize::ObjectField<AccountImpl, Oper *> oper; Serialize::Field<AccountImpl, Anope::string> greet; Serialize::Field<AccountImpl, bool> unconfirmed, _private, autoop, keepmodes, - killprotect, killquick, killimmed, msg, secure, memosignon, memoreceive, + killprotect, killquick, killimmed, msg, memosignon, memoreceive, memomail, hideemail, hidemask, hidestatus, hidequit; Serialize::Field<AccountImpl, time_t> last_mail; diff --git a/modules/nickserv/main/nickserv.cpp b/modules/nickserv/main/nickserv.cpp index ba20a0108..ab6a06af3 100644 --- a/modules/nickserv/main/nickserv.cpp +++ b/modules/nickserv/main/nickserv.cpp @@ -244,45 +244,32 @@ class NickServCore : public Module, public NickServ::NickServService if (MOD_RESULT == EVENT_ALLOW) return; - if (!na->GetAccount()->IsSecure() && u->IsRecognized()) - { - na->SetLastSeen(Anope::CurTime); - na->SetLastUsermask(u->GetIdent() + "@" + u->GetDisplayedHost()); - na->SetLastRealname(u->realname); + if (Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership")) return; - } - if (Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership")) + if (!na->GetAccount()->IsKillProtect()) return; - bool on_access = u->IsRecognized(false); + if (na->GetAccount()->IsKillImmed()) + { + u->SendMessage(*NickServ, _("This nickname has been registered; you may not use it.")); + this->Collide(u, na); + return; + } + + u->SendMessage(*NickServ, _("This nickname is registered. If this is your nickname, type \002{0}{1} IDENTIFY \037password\037\002. Otherwise, please choose a different nickname."), Config->StrictPrivmsg, NickServ->nick); // XXX - if (on_access || !na->GetAccount()->IsKillImmed()) + if (na->GetAccount()->IsKillQuick()) { - if (na->GetAccount()->IsSecure()) - u->SendMessage(*NickServ, _("This nickname is registered and protected. If this is your nickname, type \002{0}{1} IDENTIFY \037password\037\002. Otherwise, please choose a different nickname."), Config->StrictPrivmsg, NickServ->nick); // XXX - else - u->SendMessage(*NickServ, _("This nickname is owned by someone else. If this is your nickname, type \002{0}{1} IDENTIFY \037password\037\002. Otherwise, please choose a different nickname."), Config->StrictPrivmsg, NickServ->nick); // XXX + time_t killquick = Config->GetModule("nickserv/main")->Get<time_t>("killquick", "20s"); + u->SendMessage(*NickServ, _("If you do not change within {0}, I will change your nick."), Anope::Duration(killquick, u->Account())); + new NickServCollide(this, this, u, na, killquick); } - if (na->GetAccount()->IsKillProtect() && !on_access) + else { - if (na->GetAccount()->IsKillImmed()) - { - u->SendMessage(*NickServ, _("This nickname has been registered; you may not use it.")); - this->Collide(u, na); - } - else if (na->GetAccount()->IsKillQuick()) - { - time_t killquick = Config->GetModule("nickserv/main")->Get<time_t>("killquick", "20s"); - u->SendMessage(*NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(killquick, u->Account()).c_str()); - new NickServCollide(this, this, u, na, killquick); - } - else - { - time_t kill = Config->GetModule("nickserv/main")->Get<time_t>("kill", "60s"); - u->SendMessage(*NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(kill, u->Account()).c_str()); - new NickServCollide(this, this, u, na, kill); - } + time_t kill = Config->GetModule("nickserv/main")->Get<time_t>("kill", "60s"); + u->SendMessage(*NickServ, _("If you do not change within {0}, I will change your nick."), Anope::Duration(kill, u->Account())); + new NickServCollide(this, this, u, na, kill); } } @@ -626,7 +613,7 @@ class NickServCore : public Module, public NickServ::NickServService /* Update last quit and last seen for the user */ NickServ::Nick *na = NickServ::FindNick(u->nick); - if (na && !na->GetAccount()->HasFieldS("NS_SUSPENDED") && (u->IsRecognized() || u->IsIdentified(true))) + if (na && !na->GetAccount()->HasFieldS("NS_SUSPENDED") && u->IsIdentified(true)) { na->SetLastSeen(Anope::CurTime); na->SetLastQuit(msg); @@ -643,7 +630,7 @@ class NickServCore : public Module, public NickServ::NickServService for (NickServ::Nick *na : Serialize::GetObjects<NickServ::Nick *>()) { User *u = User::Find(na->GetNick(), true); - if (u && (u->IsIdentified(true) || u->IsRecognized())) + if (u && u->IsIdentified(true)) na->SetLastSeen(Anope::CurTime); bool expire = false; diff --git a/modules/nickserv/recover.cpp b/modules/nickserv/recover.cpp index f18c78379..91ce7639d 100644 --- a/modules/nickserv/recover.cpp +++ b/modules/nickserv/recover.cpp @@ -66,7 +66,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener // same person that is executing the command, so kill them off (old GHOST command). else if (u->Account() == na->GetAccount()) { - if (!source.GetAccount() && na->GetAccount()->IsSecure()) + if (!source.GetAccount()) { source.GetUser()->Login(u->Account()); cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and was automatically identified to {0}"), u->Account()->GetDisplay()); @@ -97,7 +97,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener /* User is not identified or not identified to the same account as the person using this command */ else { - if (!source.GetAccount() && na->GetAccount()->IsSecure()) + if (!source.GetAccount()) { source.GetUser()->Login(na->GetAccount()); // Identify the user using the command if they arent identified cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and was automatically identified to {0} ({1})"), na->GetNick(), na->GetAccount()->GetDisplay()); @@ -193,8 +193,6 @@ class CommandNSRecover : public Command bool ok = false; if (source.GetAccount() == na->GetAccount()) ok = true; - else if (!na->GetAccount()->IsSecure() && source.GetUser() && na->GetAccount()->IsOnAccess(source.GetUser())) - ok = true; if (certservice && source.GetUser() && certservice->Matches(source.GetUser(), na->GetAccount())) ok = true; diff --git a/modules/nickserv/set.cpp b/modules/nickserv/set.cpp index f712611a7..33882f110 100644 --- a/modules/nickserv/set.cpp +++ b/modules/nickserv/set.cpp @@ -719,7 +719,7 @@ class CommandNSSetKill : public Command "\n" "If you select \002QUICK\002, the user will be given only {1} to change their nick instead {0}." " If you select \002IMMED\002, the user's nickname will be changed immediately \037without\037 being warned first or given a chance to change their nick." - " With this set, the only way to use the nickname is to match an entry on the account's access list.")); + " With this set, the only way to use the nickname is to login to ihe account while not using the nickname (like via SASL).")); return true; } }; @@ -961,95 +961,6 @@ class CommandNSSASetMessage : public CommandNSSetMessage } }; -class CommandNSSetSecure : public Command -{ - public: - CommandNSSetSecure(Module *creator, const Anope::string &sname = "nickserv/set/secure", size_t min = 1) : Command(creator, sname, min, min + 1) - { - this->SetDesc(_("Turn nickname security on or off")); - this->SetSyntax("{ON | OFF}"); - } - - void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) - { - if (Anope::ReadOnly) - { - source.Reply(_("Services are in read-only mode.")); - return; - } - - NickServ::Nick *na = NickServ::FindNick(user); - if (!na) - { - source.Reply(_("\002{0}\002 isn't registered."), user); - return; - } - NickServ::Account *nc = na->GetAccount(); - - EventReturn MOD_RESULT; - MOD_RESULT = EventManager::Get()->Dispatch(&Event::SetNickOption::OnSetNickOption, source, this, nc, param); - if (MOD_RESULT == EVENT_STOP) - return; - - if (param.equals_ci("ON")) - { - logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to enable {0} for {1}"), - "SECURE", nc->GetDisplay()); - nc->SetSecure(true); - source.Reply(_("Secure option is now \002on\002 for \002{0}\002."), nc->GetDisplay()); - } - else if (param.equals_ci("OFF")) - { - logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable {0} for {1}"), - "SECURE", nc->GetDisplay()); - nc->SetSecure(false); - source.Reply(_("Secure option is now \002off\002 for \002{0}\002."), nc->GetDisplay()); - } - else - { - this->OnSyntaxError(source, "SECURE"); - } - } - - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override - { - this->Run(source, source.nc->GetDisplay(), params[0]); - } - - bool OnHelp(CommandSource &source, const Anope::string &) override - { - source.Reply(_("Turns the security feature on or off for your account." - " With \002SECURE\002 set, you must enter your password before you will be recognized as the owner of the account," - " regardless of whether your address is on the access list or not." - " However, if you are on the access list, services will not force you to change your nickname, regardless of the setting of the \002kill\002 option.")); - return true; - } -}; - -class CommandNSSASetSecure : public CommandNSSetSecure -{ - public: - CommandNSSASetSecure(Module *creator) : CommandNSSetSecure(creator, "nickserv/saset/secure", 2) - { - this->ClearSyntax(); - this->SetSyntax(_("\037account\037 {ON | OFF}")); - } - - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override - { - this->Run(source, params[0], params[1]); - } - - bool OnHelp(CommandSource &source, const Anope::string &) override - { - source.Reply(_("Turns the security feature on or off for \037account\037." - " With \002SECURE\002 set, you the user must enter their password before they will be recognized as the owner of the account," - " regardless of whether their address address is on the access list or not." - " However, if they are on the access list, services will not force them to change your nickname, regardless of the setting of the \002kill\002 option.")); - return true; - } -}; - class CommandNSSASetNoexpire : public Command { public: @@ -1142,9 +1053,6 @@ class NSSet : public Module CommandNSSetPassword commandnssetpassword; CommandNSSASetPassword commandnssasetpassword; - CommandNSSetSecure commandnssetsecure; - CommandNSSASetSecure commandnssasetsecure; - CommandNSSASetNoexpire commandnssasetnoexpire; /* email, passcode */ @@ -1178,8 +1086,6 @@ class NSSet : public Module , commandnssasetmessage(this) , commandnssetpassword(this) , commandnssasetpassword(this) - , commandnssetsecure(this) - , commandnssasetsecure(this) , commandnssasetnoexpire(this) , ns_set_email(this, "ns_set_email") @@ -1236,8 +1142,6 @@ class NSSet : public Module info.AddOption(_("Quick protection")); else if (na->GetAccount()->IsKillProtect()) info.AddOption(_("Protection")); - if (na->GetAccount()->IsSecure()) - info.AddOption(_("Security")); if (na->GetAccount()->IsMsg()) info.AddOption(_("Message mode")); if (na->GetAccount()->IsAutoOp()) diff --git a/modules/nickserv/status.cpp b/modules/nickserv/status.cpp deleted file mode 100644 index 9c68f2949..000000000 --- a/modules/nickserv/status.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Anope IRC Services - * - * Copyright (C) 2003-2017 Anope Team <team@anope.org> - * - * This file is part of Anope. Anope is free software; you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License as published by the Free Software - * Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see see <http://www.gnu.org/licenses/>. - */ - -#include "module.h" - -class CommandNSStatus : public Command -{ - public: - CommandNSStatus(Module *creator) : Command(creator, "nickserv/status", 0, 16) - { - this->SetDesc(_("Returns the owner status of the given nickname")); - this->SetSyntax(_("[\037nickname\037]")); - this->AllowUnregistered(true); - } - - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override - { - const Anope::string &nick = !params.empty() ? params[0] : source.GetNick(); - const NickServ::Nick *na = NickServ::FindNick(nick); - spacesepstream sep(nick); - Anope::string nickbuf; - -#warning "this is all disabled" - while (sep.GetToken(nickbuf)) - { - #if 0 - User *u2 = User::Find(nickbuf, true); - if (!u2) /* Nick is not online */ - source.Reply("STATUS %s %d %s", nickbuf.c_str(), 0, ""); - else if (u2->IsIdentified() && na && na->GetAccount() == u2->Account()) /* Nick is identified */ - source.Reply("STATUS %s %d %s", nickbuf.c_str(), 3, u2->Account()->GetDisplay().c_str()); - else if (u2->IsRecognized()) /* Nick is recognised, but NOT identified */ - source.Reply("STATUS %s %d %s", nickbuf.c_str(), 2, u2->Account() ? u2->Account()->GetDisplay().c_str() : ""); - else if (!na) /* Nick is online, but NOT a registered */ - source.Reply("STATUS %s %d %s", nickbuf.c_str(), 0, ""); - else - /* Nick is not identified for the nick, but they could be logged into an account, - * so we tell the user about it - */ - source.Reply("STATUS %s %d %s", nickbuf.c_str(), 1, u2->Account() ? u2->Account()->GetDisplay().c_str() : ""); - #endif - } - } - - bool OnHelp(CommandSource &source, const Anope::string &subcommand) override - { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Returns whether the user using the given nickname is\n" - "recognized as the owner of the nickname. The response has\n" - "this format:\n" - " \n" - " \037nickname\037 \037status-code\037 \037account\037\n" - " \n" - "where \037nickname\037 is the nickname sent with the command,\n" - "\037status-code\037 is one of the following, and \037account\037\n" - "is the account they are logged in as.\n" - " \n" - " 0 - no such user online \002or\002 nickname not registered\n" - " 1 - user not recognized as nickname's owner\n" - " 2 - user recognized as owner via access list only\n" - " 3 - user recognized as owner via password identification\n" - " \n" - "If no nickname is given, your status will be returned.")); - return true; - } -}; - -class NSStatus : public Module -{ - CommandNSStatus commandnsstatus; - - public: - NSStatus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) - , commandnsstatus(this) - { - } -}; - -MODULE_INIT(NSStatus) diff --git a/modules/webcpanel/pages/chanserv/set.cpp b/modules/webcpanel/pages/chanserv/set.cpp index 7369655ee..8e3ef0bf7 100644 --- a/modules/webcpanel/pages/chanserv/set.cpp +++ b/modules/webcpanel/pages/chanserv/set.cpp @@ -76,11 +76,6 @@ bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri ci->SetRestricted(!ci->IsRestricted()); replacements["MESSAGES"] = "Restricted updated"; } - if (ci->IsSecure() != message.post_data.count("secure")) - { - ci->SetSecure(!ci->IsSecure()); - replacements["MESSAGES"] = "Secure updated"; - } if (ci->IsSecureOps() != message.post_data.count("secureops")) { ci->SetSecureOps(!ci->IsSecureOps()); @@ -123,9 +118,6 @@ bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri if (ci->IsRestricted()) replacements["RESTRICTED"]; - if (ci->IsSecure()) - replacements["SECURE"]; - if (ci->IsSecureOps()) replacements["SECUREOPS"]; diff --git a/modules/webcpanel/pages/nickserv/access.cpp b/modules/webcpanel/pages/nickserv/access.cpp deleted file mode 100644 index c617ba05d..000000000 --- a/modules/webcpanel/pages/nickserv/access.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Anope IRC Services - * - * Copyright (C) 2012-2017 Anope Team <team@anope.org> - * - * This file is part of Anope. Anope is free software; you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License as published by the Free Software - * Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see see <http://www.gnu.org/licenses/>. - */ - -#include "../../webcpanel.h" -#include "modules/nickserv/access.h" - -WebCPanel::NickServ::Access::Access(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage(cat, u) -{ -} - -bool WebCPanel::NickServ::Access::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, ::NickServ::Nick *na, TemplateFileServer::Replacements &replacements) -{ - if (message.post_data.count("access") > 0) - { - std::vector<Anope::string> params; - params.push_back("ADD"); - params.push_back(message.post_data["access"]); - - WebPanel::RunCommand(na->GetAccount()->GetDisplay(), na->GetAccount(), "NickServ", "nickserv/access", params, replacements); - } - else if (message.get_data.count("del") > 0 && message.get_data.count("mask") > 0) - { - std::vector<Anope::string> params; - params.push_back("DEL"); - params.push_back(message.get_data["mask"]); - - WebPanel::RunCommand(na->GetAccount()->GetDisplay(), na->GetAccount(), "NickServ", "nickserv/access", params, replacements); - } - - for (NickAccess *a : na->GetAccount()->GetRefs<NickAccess *>()) - replacements["ACCESS"] = a->GetMask(); - - TemplateFileServer page("nickserv/access.html"); - page.Serve(server, page_name, client, message, reply, replacements); - return true; -} - diff --git a/modules/webcpanel/pages/nickserv/access.h b/modules/webcpanel/pages/nickserv/access.h deleted file mode 100644 index 122901abd..000000000 --- a/modules/webcpanel/pages/nickserv/access.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Anope IRC Services - * - * Copyright (C) 2012-2017 Anope Team <team@anope.org> - * - * This file is part of Anope. Anope is free software; you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License as published by the Free Software - * Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see see <http://www.gnu.org/licenses/>. - */ - -namespace WebCPanel -{ - -namespace NickServ -{ - -class Access : public WebPanelProtectedPage -{ - public: - Access(const Anope::string &cat, const Anope::string &u); - - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, ::NickServ::Nick *, TemplateFileServer::Replacements &) override; -}; - -} - -} - diff --git a/modules/webcpanel/pages/nickserv/info.cpp b/modules/webcpanel/pages/nickserv/info.cpp index f34bb0e5f..98e90ef4e 100644 --- a/modules/webcpanel/pages/nickserv/info.cpp +++ b/modules/webcpanel/pages/nickserv/info.cpp @@ -58,11 +58,6 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str na->GetAccount()->SetPrivate(!na->GetAccount()->IsPrivate()); replacements["MESSAGES"] = "Private updated"; } - if (na->GetAccount()->IsSecure() != message.post_data.count("secure")) - { - na->GetAccount()->SetSecure(!na->GetAccount()->IsSecure()); - replacements["MESSAGES"] = "Secure updated"; - } if (message.post_data["kill"] == "on" && !na->GetAccount()->IsKillProtect()) { na->GetAccount()->SetKillProtect(true); @@ -101,8 +96,6 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str replacements["AUTOOP"]; if (na->GetAccount()->IsPrivate()) replacements["PRIVATE"]; - if (na->GetAccount()->IsSecure()) - replacements["SECURE"]; if (na->GetAccount()->IsKillProtect()) replacements["KILL_ON"]; if (na->GetAccount()->IsKillQuick()) diff --git a/modules/webcpanel/templates/default/chanserv/set.html b/modules/webcpanel/templates/default/chanserv/set.html index 050c37f69..f8465293f 100644 --- a/modules/webcpanel/templates/default/chanserv/set.html +++ b/modules/webcpanel/templates/default/chanserv/set.html @@ -65,10 +65,6 @@ <td><input type="checkbox" name="restricted" value="on" {IF EXISTS RESTRICTED}checked{END IF}></td> </tr> <tr> - <td>Secure</td> - <td><input type="checkbox" name="secure" value="on" {IF EXISTS SECURE}checked{END IF}></td> - </tr> - <tr> <td>Secure Ops</td> <td><input type="checkbox" name="secureops" value="on" {IF EXISTS SECUREOPS}checked{END IF}></td> </tr> diff --git a/modules/webcpanel/templates/default/nickserv/info.html b/modules/webcpanel/templates/default/nickserv/info.html index 667c8b370..676e6cf76 100644 --- a/modules/webcpanel/templates/default/nickserv/info.html +++ b/modules/webcpanel/templates/default/nickserv/info.html @@ -49,10 +49,6 @@ <td><input type="checkbox" name="private" value="on" {IF EXISTS PRIVATE}checked{END IF}></td> </tr> <tr> - <td>Secure:</td> - <td><input type="checkbox" name="secure" value="on" {IF EXISTS SECURE}checked{END IF}></td> - </tr> - <tr> <td>Kill:</td> <td> <select name="kill" class="form-control input-sm"> diff --git a/modules/webcpanel/webcpanel.cpp b/modules/webcpanel/webcpanel.cpp index ba879a98f..d6bb9f8b7 100644 --- a/modules/webcpanel/webcpanel.cpp +++ b/modules/webcpanel/webcpanel.cpp @@ -37,7 +37,6 @@ class ModuleWebCPanel : public Module WebCPanel::NickServ::Info nickserv_info; WebCPanel::NickServ::Cert nickserv_cert; - WebCPanel::NickServ::Access nickserv_access; WebCPanel::NickServ::Alist nickserv_alist; WebCPanel::ChanServ::Info chanserv_info; @@ -69,7 +68,6 @@ class ModuleWebCPanel : public Module , confirm("/confirm") , nickserv_info("NickServ", "/nickserv/info") , nickserv_cert("NickServ", "/nickserv/cert") - , nickserv_access("NickServ", "/nickserv/access") , nickserv_alist("NickServ", "/nickserv/alist") , chanserv_info("ChanServ", "/chanserv/info") , chanserv_set("ChanServ", "/chanserv/set") @@ -124,11 +122,6 @@ class ModuleWebCPanel : public Module provider->RegisterPage(&this->nickserv_cert); } - ss.name = "Access"; - ss.url = "/nickserv/access"; - s.subsections.push_back(ss); - provider->RegisterPage(&this->nickserv_access); - ss.name = "AList"; ss.url = "/nickserv/alist"; s.subsections.push_back(ss); @@ -239,7 +232,6 @@ class ModuleWebCPanel : public Module provider->UnregisterPage(&this->nickserv_info); provider->UnregisterPage(&this->nickserv_cert); - provider->UnregisterPage(&this->nickserv_access); provider->UnregisterPage(&this->nickserv_alist); provider->UnregisterPage(&this->chanserv_info); diff --git a/modules/webcpanel/webcpanel.h b/modules/webcpanel/webcpanel.h index d82efaf3b..1dd206dec 100644 --- a/modules/webcpanel/webcpanel.h +++ b/modules/webcpanel/webcpanel.h @@ -177,7 +177,6 @@ namespace WebPanel #include "pages/nickserv/info.h" #include "pages/nickserv/cert.h" -#include "pages/nickserv/access.h" #include "pages/nickserv/alist.h" #include "pages/chanserv/info.h" |