mirror of
https://github.com/anope/anope.git
synced 2026-07-07 12:23:13 +02:00
Removed nickrequests, instead have unconfirmed registrations. Also made ns_resetpass allow remote-id to get past things such as kill immed.
This commit is contained in:
+1
-1
@@ -65,7 +65,7 @@ void mod_run_cmd(BotInfo *bi, User *u, ChannelInfo *ci, Command *c, const Anope:
|
||||
// Command requires registered users only
|
||||
if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->IsIdentified())
|
||||
{
|
||||
u->SendMessage(bi, _(_(NICK_IDENTIFY_REQUIRED)), Config->s_NickServ.c_str());
|
||||
u->SendMessage(bi, _(NICK_IDENTIFY_REQUIRED), Config->s_NickServ.c_str());
|
||||
Log(LOG_COMMAND, "denied", bi) << "Access denied for unregistered user " << u->GetMask() << " with command " << command;
|
||||
PopLanguage();
|
||||
return;
|
||||
|
||||
+3
-2
@@ -480,7 +480,7 @@ bool ValidateEmailReg(ServerConfig *config, const Anope::string &tag, const Anop
|
||||
{
|
||||
if (config->NSEmailReg)
|
||||
{
|
||||
if (value.equals_ci("preregexpire"))
|
||||
if (value.equals_ci("unconfirmedexpire"))
|
||||
{
|
||||
if (!data.GetInteger() && !dotime(data.GetValue()))
|
||||
throw ConfigException("The value for <" + tag + ":" + value + "> must be non-zero when e-mail registration are enabled!");
|
||||
@@ -1070,6 +1070,7 @@ void ServerConfig::Read()
|
||||
{"nickserv", "emailregistration", "no", new ValueContainerBool(&this->NSEmailReg), DT_BOOLEAN, NoValidation},
|
||||
{"nickserv", "modules", "", new ValueContainerString(&NickCoreModules), DT_STRING, NoValidation},
|
||||
{"nickserv", "forceemail", "no", new ValueContainerBool(&this->NSForceEmail), DT_BOOLEAN, ValidateEmailReg},
|
||||
{"nickserv", "confirmemailchanges", "no", new ValueContainerBool(&this->NSConfirmEmailChanges), DT_BOOLEAN, NoValidation},
|
||||
{"nickserv", "defaults", "secure memosignon memoreceive", new ValueContainerString(&NSDefaults), DT_STRING, NoValidation},
|
||||
{"nickserv", "languages", "", new ValueContainerString(&this->Languages), DT_STRING, NoValidation},
|
||||
{"nickserv", "defaultlanguage", "0", new ValueContainerString(&this->NSDefLanguage), DT_STRING, NoValidation},
|
||||
@@ -1078,7 +1079,7 @@ void ServerConfig::Read()
|
||||
{"nickserv", "expire", "21d", new ValueContainerTime(&this->NSExpire), DT_TIME, NoValidation},
|
||||
{"nickserv", "suspendexpire", "0", new ValueContainerTime(&this->NSSuspendExpire), DT_TIME, NoValidation},
|
||||
{"nickserv", "forbidexpire", "0", new ValueContainerTime(&this->NSForbidExpire), DT_TIME, NoValidation},
|
||||
{"nickserv", "preregexpire", "0", new ValueContainerTime(&this->NSRExpire), DT_TIME, ValidateEmailReg},
|
||||
{"nickserv", "unconfirmedexpire", "0", new ValueContainerTime(&this->NSUnconfirmedExpire), DT_TIME, ValidateEmailReg},
|
||||
{"nickserv", "maxaliases", "0", new ValueContainerUInt(&this->NSMaxAliases), DT_UINTEGER, NoValidation},
|
||||
{"nickserv", "accessmax", "0", new ValueContainerUInt(&this->NSAccessMax), DT_UINTEGER, ValidateNotZero},
|
||||
{"nickserv", "enforceruser", "", new ValueContainerString(&temp_nsuserhost), DT_STRING, ValidateNotEmpty},
|
||||
|
||||
@@ -37,27 +37,6 @@ void MailThread::Run()
|
||||
SetExitState();
|
||||
}
|
||||
|
||||
bool Mail(User *u, NickRequest *nr, BotInfo *service, const Anope::string &subject, const Anope::string &message)
|
||||
{
|
||||
if (!u || !nr || !service || subject.empty() || message.empty())
|
||||
return false;
|
||||
|
||||
if (!Config->UseMail)
|
||||
u->SendMessage(service, _("Services have been configured to not send mail."));
|
||||
else if (Anope::CurTime - u->lastmail < Config->MailDelay)
|
||||
u->SendMessage(service, _("Please wait \002%d\002 seconds and retry."), Config->MailDelay - Anope::CurTime - u->lastmail);
|
||||
else if (nr->email.empty())
|
||||
u->SendMessage(service, _("E-mail for \002%s\002 is invalid."), nr->nick.c_str());
|
||||
else
|
||||
{
|
||||
u->lastmail = nr->lastmail = Anope::CurTime;
|
||||
threadEngine.Start(new MailThread(nr->nick, nr->email, subject, message));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Mail(User *u, NickCore *nc, BotInfo *service, const Anope::string &subject, const Anope::string &message)
|
||||
{
|
||||
if (!u || !nc || !service || subject.empty() || message.empty())
|
||||
|
||||
@@ -137,7 +137,6 @@ extern void expire_all()
|
||||
Log(LOG_DEBUG) << "Running expire routines";
|
||||
expire_nicks();
|
||||
expire_chans();
|
||||
expire_requests();
|
||||
expire_exceptions();
|
||||
|
||||
FOREACH_MOD(I_OnDatabaseExpire, OnDatabaseExpire());
|
||||
|
||||
+3
-40
@@ -69,43 +69,6 @@ int tolower(char c)
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* merge_args: Take an argument count and argument vector and merge them
|
||||
* into a single string in which each argument is separated by
|
||||
* a space.
|
||||
* @param int Number of Args
|
||||
* @param argv Array
|
||||
* @return string of the merged array
|
||||
*/
|
||||
const char *merge_args(int argc, const char **argv)
|
||||
{
|
||||
int i;
|
||||
static char s[4096];
|
||||
char *t;
|
||||
|
||||
t = s;
|
||||
for (i = 0; i < argc; ++i)
|
||||
t += snprintf(t, sizeof(s) - (t - s), "%s%s", *argv++, i < argc - 1 ? " " : "");
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX: temporary "safe" version to avoid casting, it's still ugly.
|
||||
*/
|
||||
const char *merge_args(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
static char s[4096];
|
||||
char *t;
|
||||
|
||||
t = s;
|
||||
for (i = 0; i < argc; ++i)
|
||||
t += snprintf(t, sizeof(s) - (t - s), "%s%s", *argv++, i < argc - 1 ? " " : "");
|
||||
return s;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
NumberList::NumberList(const Anope::string &list, bool descending) : is_valid(true), desc(descending)
|
||||
{
|
||||
Anope::string error;
|
||||
@@ -839,12 +802,12 @@ bool Anope::Match(const Anope::string &str, const Anope::string &mask, bool case
|
||||
* @param ... any number of parameters
|
||||
* @return a Anope::string
|
||||
*/
|
||||
Anope::string Anope::printf(const char *fmt, ...)
|
||||
Anope::string Anope::printf(const Anope::string &fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[1024];
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_start(args, fmt.c_str());
|
||||
vsnprintf(buf, sizeof(buf), fmt.c_str(), args);
|
||||
va_end(args);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1,25 +1,6 @@
|
||||
#include "services.h"
|
||||
#include "modules.h"
|
||||
|
||||
NickRequest::NickRequest(const Anope::string &nickname)
|
||||
{
|
||||
if (nickname.empty())
|
||||
throw CoreException("Empty nick passed to NickRequest constructor");
|
||||
|
||||
this->requested = this->lastmail = 0;
|
||||
|
||||
this->nick = nickname;
|
||||
|
||||
NickRequestList[this->nick] = this;
|
||||
}
|
||||
|
||||
NickRequest::~NickRequest()
|
||||
{
|
||||
FOREACH_MOD(I_OnDelNickRequest, OnDelNickRequest(this));
|
||||
|
||||
NickRequestList.erase(this->nick);
|
||||
}
|
||||
|
||||
/** Default constructor
|
||||
* @param nick The nick
|
||||
* @param nickcore The nickcofe for this nick
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
nickalias_map NickAliasList;
|
||||
nickcore_map NickCoreList;
|
||||
nickrequest_map NickRequestList;
|
||||
|
||||
typedef std::map<Anope::string, NickServCollide *> nickservcollides_map;
|
||||
typedef std::map<Anope::string, NickServRelease *> nickservreleases_map;
|
||||
@@ -169,13 +168,6 @@ void ns_init()
|
||||
|
||||
int validate_user(User *u)
|
||||
{
|
||||
NickRequest *nr = findrequestnick(u->nick);
|
||||
if (nr)
|
||||
{
|
||||
u->SendMessage(NickServ, _(NICK_IS_PREREG));
|
||||
return 0;
|
||||
}
|
||||
|
||||
NickAlias *na = findnick(u->nick);
|
||||
if (!na)
|
||||
return 0;
|
||||
@@ -291,32 +283,8 @@ void expire_nicks()
|
||||
}
|
||||
}
|
||||
|
||||
void expire_requests()
|
||||
{
|
||||
for (nickrequest_map::const_iterator it = NickRequestList.begin(), it_end = NickRequestList.end(); it != it_end; )
|
||||
{
|
||||
NickRequest *nr = it->second;
|
||||
++it;
|
||||
|
||||
if (Config->NSRExpire && Anope::CurTime - nr->requested >= Config->NSRExpire)
|
||||
{
|
||||
Log(LOG_NORMAL, "expire") << "Request for nick " << nr->nick << " expiring";
|
||||
delete nr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
NickRequest *findrequestnick(const Anope::string &nick)
|
||||
{
|
||||
nickrequest_map::const_iterator it = NickRequestList.find(nick);
|
||||
|
||||
if (it != NickRequestList.end())
|
||||
return it->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NickAlias *findnick(const Anope::string &nick)
|
||||
{
|
||||
FOREACH_MOD(I_OnFindNick, OnFindNick(nick));
|
||||
|
||||
+2
-1
@@ -806,7 +806,8 @@ User *do_nick(const Anope::string &source, const Anope::string &nick, const Anop
|
||||
user->UpdateHost();
|
||||
do_on_id(user);
|
||||
ircdproto->SetAutoIdentificationToken(user);
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
if (na->nc->HasFlag(NI_UNCONFIRMED) == false)
|
||||
user->SetMode(NickServ, UMODE_REGISTERED);
|
||||
Log(NickServ) << user->GetMask() << " automatically identified for group " << user->Account()->display;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user