1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 12:25:46 +02:00

Misc cleanup of ns_sasl and sasl.h.

This commit is contained in:
Sadie Powell
2025-03-03 23:54:03 +00:00
parent c0c7046a6d
commit 34896cefe9
6 changed files with 73 additions and 63 deletions
+11 -11
View File
@@ -42,7 +42,7 @@ namespace SASL
virtual void RemoveSession(Session *) = 0;
};
static ServiceReference<SASL::Service> sasl("SASL::Service", "sasl");
static ServiceReference<SASL::Service> service("SASL::Service", "sasl");
struct Session
{
@@ -65,8 +65,8 @@ namespace SASL
virtual ~Session()
{
if (sasl)
sasl->RemoveSession(this);
if (service)
service->RemoveSession(this);
}
};
@@ -83,8 +83,8 @@ namespace SASL
virtual ~Mechanism()
{
if (sasl)
sasl->DeleteSessions(this, true);
if (service)
service->DeleteSessions(this, true);
}
};
@@ -114,7 +114,7 @@ namespace SASL
void OnSuccess() override
{
if (!sasl)
if (!service)
return;
NickAlias *na = NickAlias::Find(GetAccount());
@@ -125,24 +125,24 @@ namespace SASL
if (maxlogins && na->nc->users.size() >= maxlogins)
return OnFail();
Session *s = sasl->GetSession(uid);
Session *s = service->GetSession(uid);
if (s)
{
Log(this->GetOwner(), "sasl", Config->GetClient("NickServ")) << GetUserInfo() << " identified to account " << this->GetAccount() << " using SASL";
sasl->Succeed(s, na->nc);
service->Succeed(s, na->nc);
delete s;
}
}
void OnFail() override
{
if (!sasl)
if (!service)
return;
Session *s = sasl->GetSession(uid);
Session *s = service->GetSession(uid);
if (s)
{
sasl->Fail(s);
service->Fail(s);
delete s;
}
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1793,7 +1793,7 @@ struct IRCDMessageSASL final
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override
{
if (!SASL::sasl)
if (!SASL::service)
return;
SASL::Message m;
@@ -1801,7 +1801,7 @@ struct IRCDMessageSASL final
m.target = params[1];
m.type = params[2];
m.data.assign(params.begin() + 3, params.end());
SASL::sasl->ProcessMessage(m);
SASL::service->ProcessMessage(m);
}
};
@@ -2396,7 +2396,7 @@ struct IRCDMessageUID final
auto ts = IRCD->ExtractTimestamp(params[1]);
NickAlias *na = NULL;
if (SASL::sasl)
if (SASL::service)
for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();)
{
SASLUser &u = *it;
+2 -2
View File
@@ -248,14 +248,14 @@ struct IRCDMessageEncap final
}
}
else if (params[1] == "SASL" && SASL::sasl && params.size() >= 6)
else if (params[1] == "SASL" && SASL::service && params.size() >= 6)
{
SASL::Message m;
m.source = params[2];
m.target = params[3];
m.type = params[4];
m.data.assign(params.begin() + 5, params.end());
SASL::sasl->ProcessMessage(m);
SASL::service->ProcessMessage(m);
}
return;
+2 -2
View File
@@ -217,14 +217,14 @@ struct IRCDMessageEncap final
*
* Solanum only accepts messages from SASL agents; these must have umode +S
*/
else if (params[1] == "SASL" && SASL::sasl && params.size() >= 6)
else if (params[1] == "SASL" && SASL::service && params.size() >= 6)
{
SASL::Message m;
m.source = params[2];
m.target = params[3];
m.type = params[4];
m.data.assign(params.begin() + 5, params.end());
SASL::sasl->ProcessMessage(m);
SASL::service->ProcessMessage(m);
}
}
};
+2 -2
View File
@@ -1301,7 +1301,7 @@ struct IRCDMessageSASL final
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override
{
if (!SASL::sasl)
if (!SASL::service)
return;
SASL::Message m;
@@ -1309,7 +1309,7 @@ struct IRCDMessageSASL final
m.target = params[0];
m.type = params[2];
m.data.assign(params.begin() + 3, params.end());
SASL::sasl->ProcessMessage(m);
SASL::service->ProcessMessage(m);
}
};