mirror of
https://github.com/anope/anope.git
synced 2026-06-27 05:46:37 +02:00
Add a config option to disable sasl
This commit is contained in:
@@ -278,6 +278,13 @@ nickserv
|
||||
* This directive is opional.
|
||||
*/
|
||||
restoreonghost = yes
|
||||
|
||||
/*
|
||||
* Some IRCds allow "SASL" authentication to let users identify to Services
|
||||
* during the IRCd user registration process. If set, Services will allow
|
||||
* authenticating users through this mechanism.
|
||||
*/
|
||||
sasl = yes
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -572,6 +572,8 @@ class CoreExport ServerConfig
|
||||
Anope::string NSModesOnID;
|
||||
/* Restore nick/channels on ghost */
|
||||
bool NSRestoreOnGhost;
|
||||
/* Whether or not to use SASL */
|
||||
bool NSSASL;
|
||||
|
||||
/* Core ChanServ modules */
|
||||
Anope::string ChanCoreModules;
|
||||
|
||||
@@ -483,7 +483,7 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
u->SetRealname(params[3]);
|
||||
UplinkSocket::Message(u) << "FNAME " << params[3];
|
||||
}
|
||||
else if (params[1] == "SASL" && params.size() == 6)
|
||||
else if (Config->NSSASL && params[1] == "SASL" && params.size() == 6)
|
||||
{
|
||||
class InspIRCDSASLIdentifyRequest : public IdentifyRequest
|
||||
{
|
||||
@@ -501,6 +501,8 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
void OnFail() anope_override
|
||||
{
|
||||
UplinkSocket::Message(Me) << "ENCAP " << this->uid.substr(0, 3) << " SASL " << Me->GetSID() << " " << this->uid << " " << " D F";
|
||||
|
||||
Log(findbot(Config->NickServ)) << "A user failed to identify for account " << this->GetAccount() << " using SASL";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -867,7 +867,7 @@ struct IRCDMessageSASL : IRCDMessage
|
||||
return;
|
||||
|
||||
UplinkSocket::Message(Me) << "SVSLOGIN " << this->uid.substr(0, p) << " " << this->uid << " " << this->GetAccount();
|
||||
UplinkSocket::Message(findbot(Config->NickServ)) << "SASL " << this->uid.substr(0, p) << " " << this->uid << " D S";
|
||||
UplinkSocket::Message() << "SASL " << this->uid.substr(0, p) << " " << this->uid << " D S";
|
||||
}
|
||||
|
||||
void OnFail() anope_override
|
||||
@@ -876,7 +876,9 @@ struct IRCDMessageSASL : IRCDMessage
|
||||
if (p == Anope::string::npos)
|
||||
return;
|
||||
|
||||
UplinkSocket::Message(findbot(Config->NickServ)) << "SASL " << this->uid.substr(0, p) << " " << this->uid << " D F";
|
||||
UplinkSocket::Message() << "SASL " << this->uid.substr(0, p) << " " << this->uid << " D F";
|
||||
|
||||
Log(findbot(Config->NickServ)) << "A user failed to identify for account " << this->GetAccount() << " using SASL";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -893,12 +895,11 @@ struct IRCDMessageSASL : IRCDMessage
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
size_t p = params[1].find('!');
|
||||
if (p == Anope::string::npos)
|
||||
if (!Config->NSSASL || p == Anope::string::npos)
|
||||
return true;
|
||||
|
||||
/* Unreal segfaults if we send from Me */
|
||||
if (params[2] == "S")
|
||||
UplinkSocket::Message(findbot(Config->NickServ)) << "SASL " << params[1].substr(0, p) << " " << params[1] << " C +";
|
||||
UplinkSocket::Message() << "SASL " << params[1].substr(0, p) << " " << params[1] << " C +";
|
||||
else if (params[2] == "C")
|
||||
{
|
||||
Anope::string decoded;
|
||||
|
||||
@@ -1285,6 +1285,7 @@ ConfigItems::ConfigItems(ServerConfig *conf)
|
||||
{"nickserv", "kill", "60", new ValueContainerTime(&conf->NSKill), DT_TIME, NoValidation},
|
||||
{"nickserv", "modesonid", "", new ValueContainerString(&conf->NSModesOnID), DT_STRING, NoValidation},
|
||||
{"nickserv", "restoreonghost", "yes", new ValueContainerBool(&conf->NSRestoreOnGhost), DT_BOOLEAN, NoValidation},
|
||||
{"nickserv", "sasl", "yes", new ValueContainerBool(&conf->NSSASL), DT_BOOLEAN, NoValidation},
|
||||
{"mail", "usemail", "no", new ValueContainerBool(&conf->UseMail), DT_BOOLEAN, ValidateEmailReg},
|
||||
{"mail", "sendmailpath", "", new ValueContainerString(&conf->SendMailPath), DT_STRING, ValidateMail},
|
||||
{"mail", "sendfrom", "", new ValueContainerString(&conf->SendFrom), DT_STRING, ValidateMail},
|
||||
|
||||
@@ -455,6 +455,9 @@ void User::Login(NickCore *core)
|
||||
core->Users.push_back(this);
|
||||
|
||||
this->UpdateHost();
|
||||
|
||||
if (this->server->IsSynced())
|
||||
Log(this, "account") << "is now identified as " << this->nc->display;
|
||||
}
|
||||
|
||||
/** Logout the user
|
||||
@@ -463,6 +466,8 @@ void User::Logout()
|
||||
{
|
||||
if (!this->nc)
|
||||
return;
|
||||
|
||||
Log(this, "account") << "is not longer identified as " << this->nc->display;
|
||||
|
||||
std::list<User *>::iterator it = std::find(this->nc->Users.begin(), this->nc->Users.end(), this);
|
||||
if (it != this->nc->Users.end())
|
||||
|
||||
Reference in New Issue
Block a user