diff options
Diffstat (limited to 'modules/extra')
-rw-r--r-- | modules/extra/cs_entrymsg.cpp | 2 | ||||
-rw-r--r-- | modules/extra/db_mysql.cpp | 10 | ||||
-rw-r--r-- | modules/extra/hs_request.cpp | 11 | ||||
-rw-r--r-- | modules/extra/m_async_commands.cpp | 2 | ||||
-rw-r--r-- | modules/extra/m_ldap_oper.cpp | 45 | ||||
-rw-r--r-- | modules/extra/m_xmlrpc_main.cpp | 4 |
6 files changed, 52 insertions, 22 deletions
diff --git a/modules/extra/cs_entrymsg.cpp b/modules/extra/cs_entrymsg.cpp index df68b141f..649fd69f8 100644 --- a/modules/extra/cs_entrymsg.cpp +++ b/modules/extra/cs_entrymsg.cpp @@ -107,7 +107,7 @@ class CommandEntryMessage : public Command User *u = source.u; ChannelInfo *ci = source.ci; - if (ci && (IsFounder(u, ci) || u->Account()->HasCommand("chanserv/entrymsg"))) + if (ci && (IsFounder(u, ci) || u->HasCommand("chanserv/entrymsg"))) { bool success = true; if (params[1].equals_ci("LIST")) diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp index 7b1addbdb..d8a6d934c 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/extra/db_mysql.cpp @@ -663,7 +663,7 @@ class DBMySQL : public Module if (service == NickServ) { - if (u->Account() && ((command->name.equals_ci("SET") && !params.empty()) || (command->name.equals_ci("SASET") && u->Account()->HasCommand("nickserv/saset") && params.size() > 1))) + if (u->Account() && ((command->name.equals_ci("SET") && !params.empty()) || (command->name.equals_ci("SASET") && u->HasCommand("nickserv/saset") && params.size() > 1))) { Anope::string cmd = (command->name.equals_ci("SET") ? params[0] : params[1]); NickCore *nc = (command->name.equals_ci("SET") ? u->Account() : findcore(params[0])); @@ -697,7 +697,7 @@ class DBMySQL : public Module { if (!ci) return; - if (!u->Account()->HasPriv("chanserv/set") && check_access(u, ci, CA_SET)) + if (!u->HasPriv("chanserv/set") && check_access(u, ci, CA_SET)) return; if (params[1].equals_ci("FOUNDER") && ci->founder) { @@ -727,7 +727,7 @@ class DBMySQL : public Module { if (!ci) return; - if (!check_access(u, ci, CA_SET) && !u->Account()->HasPriv("botserv/administration")) + if (!check_access(u, ci, CA_SET) && !u->HasPriv("botserv/administration")) return; if (params[1].equals_ci("BADWORDS") || params[1].equals_ci("BOLDS") || params[1].equals_ci("CAPS") || params[1].equals_ci("COLORS") || params[1].equals_ci("FLOOD") || params[1].equals_ci("REPEAT") || params[1].equals_ci("REVERSES") || params[1].equals_ci("UNDERLINES")) { @@ -756,12 +756,12 @@ class DBMySQL : public Module } else if (command->name.equals_ci("SET") && params.size() > 2) { - if (ci && !check_access(u, ci, CA_SET) && !u->Account()->HasPriv("botserv/administration")) + if (ci && !check_access(u, ci, CA_SET) && !u->HasPriv("botserv/administration")) return; BotInfo *bi = NULL; if (!ci) bi = findbot(params[0]); - if (bi && params[1].equals_ci("PRIVATE") && u->Account()->HasPriv("botserv/set/private")) + if (bi && params[1].equals_ci("PRIVATE") && u->HasPriv("botserv/set/private")) { this->RunQuery("UPDATE `anope_bs_core` SET `flags` = '" + ToString(bi->ToString()) + "' WHERE `nick` = '" + this->Escape(bi->nick) + "'"); } diff --git a/modules/extra/hs_request.cpp b/modules/extra/hs_request.cpp index 3b0a3c4cf..4978035d3 100644 --- a/modules/extra/hs_request.cpp +++ b/modules/extra/hs_request.cpp @@ -423,12 +423,17 @@ void req_send_memos(CommandSource &source, const Anope::string &vIdent, const An host = vHost; if (HSRequestMemoOper == 1) - for (it = Config->Opers.begin(), it_end = Config->Opers.end(); it != it_end; ++it) + for (unsigned i = 0; i < Config->Opers.size(); ++i) { - Anope::string nick = it->first; + Oper *o = Config->Opers[i]; + + NickAlias *na = findnick(o->name); + if (!na) + continue; + char message[BUFSIZE]; snprintf(message, sizeof(message), _("[auto memo] vHost \002%s\002 has been requested."), host.c_str()); - memo_send(source, nick, message, 2); + memo_send(source, na->nick, message, 2); } } diff --git a/modules/extra/m_async_commands.cpp b/modules/extra/m_async_commands.cpp index e7aa37ff0..7e1b24f34 100644 --- a/modules/extra/m_async_commands.cpp +++ b/modules/extra/m_async_commands.cpp @@ -46,7 +46,7 @@ class AsynchCommandMutex : public CommandMutex return; } - if (!command->permission.empty() && !u->Account()->HasCommand(command->permission)) + if (!command->permission.empty() && !u->HasCommand(command->permission)) { u->SendMessage(bi, _(ACCESS_DENIED)); Log(LOG_COMMAND, "denied", bi) << "Access denied for user " << u->GetMask() << " with command " << command; diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp index 8a5f57116..b8a1d5f51 100644 --- a/modules/extra/m_ldap_oper.cpp +++ b/modules/extra/m_ldap_oper.cpp @@ -1,6 +1,7 @@ #include "module.h" #include "ldap.h" +static std::set<Oper *> my_opers; static Anope::string opertype_attribute; class IdentifyInterface : public LDAPInterface @@ -36,22 +37,32 @@ class IdentifyInterface : public LDAPInterface const Anope::string &opertype = attr.get(opertype_attribute); - for (std::list<OperType *>::iterator oit = Config->MyOperTypes.begin(), oit_end = Config->MyOperTypes.end(); oit != oit_end; ++oit) + OperType *ot = OperType::Find(opertype); + if (ot != NULL && (u->Account()->o == NULL || ot != u->Account()->o->ot)) { - OperType *ot = *oit; - if (ot->GetName() == opertype && ot != u->Account()->ot) + Oper *o = u->Account()->o; + if (o != NULL && my_opers.count(o) > 0) { - u->Account()->ot = ot; - Log() << "m_ldap_oper: Tied " << u->nick << " (" << u->Account()->display << ") to opertype " << ot->GetName(); - break; + my_opers.erase(o); + delete o; } + o = new Oper(u->nick, "", "", ot); + my_opers.insert(o); + u->Account()->o = o; + Log() << "m_ldap_oper: Tied " << u->nick << " (" << u->Account()->display << ") to opertype " << ot->GetName(); } } catch (const LDAPException &ex) { - if (u->Account()->ot != NULL) + if (u->Account()->o != NULL) { - u->Account()->ot = NULL; + if (my_opers.count(u->Account()->o) > 0) + { + my_opers.erase(u->Account()->o); + delete u->Account()->o; + } + u->Account()->o = NULL; + Log() << "m_ldap_oper: Removed services operator from " << u->nick << " (" << u->Account()->display << ")"; } } @@ -79,8 +90,8 @@ class LDAPOper : public Module this->SetAuthor("Anope"); this->SetType(SUPPORTED); - Implementation i[] = { I_OnReload, I_OnNickIdentify }; - ModuleManager::Attach(i, this, 2); + Implementation i[] = { I_OnReload, I_OnNickIdentify, I_OnDelCore }; + ModuleManager::Attach(i, this, 3); OnReload(false); } @@ -94,6 +105,10 @@ class LDAPOper : public Module this->basedn = config.ReadValue("m_ldap_oper", "basedn", "", 0); this->filter = config.ReadValue("m_ldap_oper", "filter", "", 0); opertype_attribute = config.ReadValue("m_ldap_oper", "opertype_attribute", "", 0); + + for (std::set<Oper *>::iterator it = my_opers.begin(), it_end = my_opers.end(); it != it_end; ++it) + delete *it; + my_opers.clear(); } void OnNickIdentify(User *u) @@ -115,6 +130,16 @@ class LDAPOper : public Module Log() << "m_ldapoper: " << ex.GetReason(); } } + + void OnDelCore(NickCore *nc) + { + if (nc->o != NULL && my_opers.count(nc->o) > 0) + { + my_opers.erase(nc->o); + delete nc->o; + nc->o = NULL; + } + } }; MODULE_INIT(LDAPOper) diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp index 39c4cca19..4efe230ad 100644 --- a/modules/extra/m_xmlrpc_main.cpp +++ b/modules/extra/m_xmlrpc_main.cpp @@ -248,8 +248,8 @@ class MyXMLRPCEvent : public XMLRPCEvent if (u->Account()) { request->reply("account", iface->Sanitize(u->Account()->display)); - if (u->Account()->ot) - request->reply("opertype", iface->Sanitize(u->Account()->ot->GetName())); + if (u->Account()->o) + request->reply("opertype", iface->Sanitize(u->Account()->o->ot->GetName())); } Anope::string channels; |