diff options
| author | Adam <Adam@anope.org> | 2012-09-15 10:11:31 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2012-09-30 20:30:27 -0400 |
| commit | 9ba719688161499f01c168b1aed84a563bcb5953 (patch) | |
| tree | b2ffbe3ceebf2a32820780fb76d30967af8ea50c /modules | |
| parent | 1e71303ffaf263adb0cc659505caa223f7f27b85 (diff) | |
Make CommandSource use references, sometimes we hold them for awhile
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/commands/cs_access.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/hs_group.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/hs_request.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/ms_rsend.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/ns_access.cpp | 4 | ||||
| -rw-r--r-- | modules/commands/ns_drop.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/ns_ghost.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/ns_group.cpp | 4 | ||||
| -rw-r--r-- | modules/commands/ns_info.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/ns_recover.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/ns_register.cpp | 4 | ||||
| -rw-r--r-- | modules/commands/ns_release.cpp | 4 | ||||
| -rw-r--r-- | modules/commands/ns_update.cpp | 2 | ||||
| -rw-r--r-- | modules/extra/m_ldap_authentication.cpp | 17 |
14 files changed, 25 insertions, 26 deletions
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index c482e3c66..df724db1e 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -469,7 +469,7 @@ class CommandCSAccess : public Command else if (is_del) { const NickAlias *na = findnick(nick); - if (na && na->nc == source.nc) + if (na && na->nc == source.GetAccount()) has_access = true; } diff --git a/modules/commands/hs_group.cpp b/modules/commands/hs_group.cpp index f0d030c70..22538ed1a 100644 --- a/modules/commands/hs_group.cpp +++ b/modules/commands/hs_group.cpp @@ -38,7 +38,7 @@ class CommandHSGroup : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { NickAlias *na = findnick(source.GetNick()); - if (na && source.nc == na->nc && na->HasVhost()) + if (na && source.GetAccount() == na->nc && na->HasVhost()) { this->Sync(na); if (!na->GetVhostIdent().empty()) diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp index 1b08968ae..f4b710b7f 100644 --- a/modules/commands/hs_request.cpp +++ b/modules/commands/hs_request.cpp @@ -89,7 +89,7 @@ class CommandHSRequest : public Command { User *u = source.GetUser(); NickAlias *na = findnick(source.GetNick()); - if (!na || na->nc != source.nc) + if (!na || na->nc != source.GetAccount()) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp index 6dc79bb44..9b6545f7f 100644 --- a/modules/commands/ms_rsend.cpp +++ b/modules/commands/ms_rsend.cpp @@ -34,7 +34,7 @@ class CommandMSRSend : public Command const NickAlias *na = NULL; /* prevent user from rsend to themselves */ - if ((na = findnick(nick)) && na->nc == source.nc) + if ((na = findnick(nick)) && na->nc == source.GetAccount()) { source.Reply(_("You can not request a receipt when sending a memo to yourself.")); return; diff --git a/modules/commands/ns_access.cpp b/modules/commands/ns_access.cpp index 73748a401..915b70cb3 100644 --- a/modules/commands/ns_access.cpp +++ b/modules/commands/ns_access.cpp @@ -114,12 +114,12 @@ class CommandNSAccess : public Command source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); return; } - else if (na->nc != source.nc && !source.HasPriv("nickserv/access")) + else if (na->nc != source.GetAccount() && !source.HasPriv("nickserv/access")) { source.Reply(ACCESS_DENIED); return; } - else if (Config->NSSecureAdmins && source.nc != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) + else if (Config->NSSecureAdmins && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) { source.Reply(_("You may view but not modify the access list of other services operators.")); return; diff --git a/modules/commands/ns_drop.cpp b/modules/commands/ns_drop.cpp index 9f6de6f5a..d5ac7cef8 100644 --- a/modules/commands/ns_drop.cpp +++ b/modules/commands/ns_drop.cpp @@ -38,7 +38,7 @@ class CommandNSDrop : public Command return; } - bool is_mine = source.nc == na->nc; + bool is_mine = source.GetAccount() == na->nc; Anope::string my_nick; if (is_mine && nick.empty()) my_nick = na->nick; diff --git a/modules/commands/ns_ghost.cpp b/modules/commands/ns_ghost.cpp index 074c133b2..3362cf408 100644 --- a/modules/commands/ns_ghost.cpp +++ b/modules/commands/ns_ghost.cpp @@ -44,7 +44,7 @@ class CommandNSGhost : public Command else { bool ok = false; - if (source.nc == na->nc) + if (source.GetAccount() == na->nc) ok = true; else if (!na->nc->HasFlag(NI_SECURE) && source.GetUser() && is_on_access(source.GetUser(), na->nc)) ok = true; diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index ed1a9eb75..3df4b3460 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -266,7 +266,7 @@ class CommandNSGList : public Command source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); return; } - else if (na->nc != source.nc && !source.IsServicesOper()) + else if (na->nc != source.GetAccount() && !source.IsServicesOper()) { source.Reply(ACCESS_DENIED, Config->NickServ.c_str()); return; @@ -275,7 +275,7 @@ class CommandNSGList : public Command nc = na->nc; } else - nc = source.nc; + nc = source.GetAccount(); ListFormatter list; list.addColumn("Nick").addColumn("Expires"); diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp index 94126e93b..b3b734a39 100644 --- a/modules/commands/ns_info.cpp +++ b/modules/commands/ns_info.cpp @@ -57,7 +57,7 @@ class CommandNSInfo : public Command if (u2 && u2->Account() == na->nc) nick_online = true; - if (has_auspex || na->nc == source.nc) + if (has_auspex || na->nc == source.GetAccount()) show_hidden = true; source.Reply(_("%s is %s"), na->nick.c_str(), na->last_realname.c_str()); diff --git a/modules/commands/ns_recover.cpp b/modules/commands/ns_recover.cpp index b74703a48..7c5b6cbeb 100644 --- a/modules/commands/ns_recover.cpp +++ b/modules/commands/ns_recover.cpp @@ -82,7 +82,7 @@ class CommandNSRecover : public Command else { bool ok = false; - if (source.nc == na->nc) + if (source.GetAccount() == na->nc) ok = true; else if (!na->nc->HasFlag(NI_SECURE) && source.GetUser() && is_on_access(source.GetUser(), na->nc)) ok = true; diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index 953fd2d89..2665b2381 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -58,7 +58,7 @@ class CommandNSConfirm : public Command { ircdproto->SendLogin(source.GetUser()); const NickAlias *na = findnick(source.GetNick()); - if (!Config->NoNicknameOwnership && na != NULL && na->nc == source.nc && na->nc->HasFlag(NI_UNCONFIRMED) == false) + if (!Config->NoNicknameOwnership && na != NULL && na->nc == source.GetAccount() && na->nc->HasFlag(NI_UNCONFIRMED) == false) source.GetUser()->SetMode(findbot(Config->NickServ), UMODE_REGISTERED); } } @@ -294,7 +294,7 @@ class CommandNSResend : public Command if (na == NULL) source.Reply(NICK_NOT_REGISTERED); - else if (na->nc != source.nc || source.nc->HasFlag(NI_UNCONFIRMED) == false) + else if (na->nc != source.GetAccount() || source.nc->HasFlag(NI_UNCONFIRMED) == false) source.Reply(_("Your account is already confirmed.")); else { diff --git a/modules/commands/ns_release.cpp b/modules/commands/ns_release.cpp index 44c89fbf7..9e12685aa 100644 --- a/modules/commands/ns_release.cpp +++ b/modules/commands/ns_release.cpp @@ -58,10 +58,10 @@ class CommandNSRelease : public Command } else { - bool override = source.nc != na->nc && source.HasPriv("nickserv/release"); + bool override = source.GetAccount() != na->nc && source.HasPriv("nickserv/release"); bool ok = override; - if (source.nc == na->nc) + if (source.GetAccount() == na->nc) ok = true; else if (source.GetUser() && !na->nc->HasFlag(NI_SECURE) && is_on_access(source.GetUser(), na->nc)) ok = true; diff --git a/modules/commands/ns_update.cpp b/modules/commands/ns_update.cpp index b4affe547..5ca8da26d 100644 --- a/modules/commands/ns_update.cpp +++ b/modules/commands/ns_update.cpp @@ -30,7 +30,7 @@ class CommandNSUpdate : public Command NickAlias *na = findnick(u->nick); - if (na && na->nc == source.nc) + if (na && na->nc == source.GetAccount()) { na->last_realname = u->realname; na->last_seen = Anope::CurTime; diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index 0f0593c34..7fcd67e5d 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -10,7 +10,6 @@ static Anope::string username_attribute; struct IdentifyInfo { - dynamic_reference<User> user; dynamic_reference<Command> command; CommandSource source; std::vector<Anope::string> params; @@ -20,8 +19,8 @@ struct IdentifyInfo service_reference<LDAPProvider> lprov; bool admin_bind; - IdentifyInfo(User *u, Command *c, CommandSource &s, const std::vector<Anope::string> &pa, const Anope::string &a, const Anope::string &p, service_reference<LDAPProvider> &lp) : - user(u), command(c), source(s), params(pa), account(a), pass(p), lprov(lp), admin_bind(true) { } + IdentifyInfo(Command *c, CommandSource &s, const std::vector<Anope::string> &pa, const Anope::string &a, const Anope::string &p, service_reference<LDAPProvider> &lp) : + command(c), source(s), params(pa), account(a), pass(p), lprov(lp), admin_bind(true) { } }; class IdentifyInterface : public LDAPInterface @@ -47,7 +46,7 @@ class IdentifyInterface : public LDAPInterface IdentifyInfo *ii = it->second; this->requests.erase(it); - if (!ii->user || !ii->command || !ii->lprov) + if (!ii->source.GetUser() || !ii->command || !ii->lprov) { delete this; return; @@ -75,7 +74,7 @@ class IdentifyInterface : public LDAPInterface } else { - User *u = ii->user; + User *u = ii->source.GetUser(); Command *c = ii->command; u->Extend("m_ldap_authentication_error", NULL); @@ -98,7 +97,7 @@ class IdentifyInterface : public LDAPInterface } else { - User *u = ii->user; + User *u = ii->source.GetUser(); Command *c = ii->command; u->Extend("m_ldap_authentication_authenticated", NULL); @@ -137,13 +136,13 @@ class IdentifyInterface : public LDAPInterface IdentifyInfo *ii = it->second; this->requests.erase(it); - if (!ii->user || !ii->command) + if (!ii->source.GetUser() || !ii->command) { delete ii; return; } - User *u = ii->user; + User *u = ii->source.GetUser(); Command *c = ii->command; u->Extend("m_ldap_authentication_error", NULL); @@ -289,7 +288,7 @@ class NSIdentifyLDAP : public Module return EVENT_CONTINUE; } - IdentifyInfo *ii = new IdentifyInfo(u, c, *source, params, account, password, this->ldap); + IdentifyInfo *ii = new IdentifyInfo(c, *source, params, account, password, this->ldap); try { LDAPQuery id = this->ldap->BindAsAdmin(&this->iinterface); |
