/**
* Tracks SASL authentication state like charybdis does. --nenolod
*/
-class SaslAuthenticator
+class SaslAuthenticator : public classbase
{
private:
InspIRCd *ServerInstance;
params.push_back("S");
params.push_back(method);
- Event e((char*)¶ms, Creator, "send_encap");
- e.Send(ServerInstance);
+ ServerInstance->PI->SendEncapsulatedData(params);
}
SaslResult GetSaslResult(std::string &result_)
this->result = SASL_ABORT;
}
- bool SendClientMessage(const char* const* parameters, int pcnt)
+ bool SendClientMessage(const std::vector<std::string>& parameters)
{
if (this->state != SASL_COMM)
return true;
params.push_back(this->agent);
params.push_back("C");
- for (int i = 0; i < pcnt; ++i)
- params.push_back(parameters[i]);
+ params.insert(params.end(), parameters.begin(), parameters.end());
- Event e((char*)¶ms, Creator, "send_encap");
- e.Send(ServerInstance);
+ ServerInstance->PI->SendEncapsulatedData(params);
- if (*parameters[0] == '*')
+ if (parameters[0][0] == '*')
{
this->Abort();
return false;
switch (this->result)
{
case SASL_OK:
- this->user->WriteNumeric(903, "%s :SASL authentication successful", this->user->nick);
+ this->user->WriteNumeric(903, "%s :SASL authentication successful", this->user->nick.c_str());
break;
case SASL_ABORT:
- this->user->WriteNumeric(906, "%s :SASL authentication aborted", this->user->nick);
+ this->user->WriteNumeric(906, "%s :SASL authentication aborted", this->user->nick.c_str());
break;
case SASL_FAIL:
- this->user->WriteNumeric(904, "%s :SASL authentication failed", this->user->nick);
+ this->user->WriteNumeric(904, "%s :SASL authentication failed", this->user->nick.c_str());
break;
default:
break;
this->source = "m_sasl.so";
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
/* Only allow AUTHENTICATE on unregistered clients */
if (user->registered != REG_ALL)
SaslAuthenticator *sasl;
if (!(user->GetExt("sasl_authenticator", sasl)))
sasl = new SaslAuthenticator(user, parameters[0], ServerInstance, Creator);
- else if (sasl->SendClientMessage(parameters, pcnt) == false) // IAL abort extension --nenolod
+ else if (sasl->SendClientMessage(parameters) == false) // IAL abort extension --nenolod
delete sasl;
}
return CMD_FAILURE;
{
CommandAuthenticate* sasl;
public:
-
+
ModuleSASL(InspIRCd* Me)
: Module(Me)
{
std::string* str = NULL;
if (user->GetExt("accountname", str))
- {
- std::deque<std::string> params;
- params.push_back(user->uuid);
- params.push_back("accountname");
- params.push_back(*str);
- Event e((char*)¶ms, this, "send_metadata");
- e.Send(ServerInstance);
- }
+ ServerInstance->PI->SendMetaData(user, TYPE_USER, "accountname", *str);
+
return;
}