1
0
mirror of https://github.com/anope/anope.git synced 2026-07-05 20:23:11 +02:00

added ns_cert

This commit is contained in:
DukePyrolator
2011-03-12 09:27:16 +01:00
parent 95469fde30
commit fbae3344ff
25 changed files with 452 additions and 99 deletions
+39
View File
@@ -129,3 +129,42 @@ void NickCore::ClearAccess()
FOREACH_MOD(I_OnNickClearAccess, OnNickClearAccess(this));
this->access.clear();
}
void NickCore::AddCert(const Anope::string &entry)
{
this->cert.push_back(entry);
FOREACH_MOD(I_OnNickAddCert, OnNickAddCert(this, entry));
}
Anope::string NickCore::GetCert(unsigned entry) const
{
if (this->cert.empty() || entry >= this->cert.size())
return "";
return this->cert[entry];
}
bool NickCore::FindCert(const Anope::string &entry)
{
for (unsigned i = 0, end = this->cert.size(); i < end; ++i)
if (this->cert[i] == entry)
return true;
return false;
}
void NickCore::EraseCert(const Anope::string &entry)
{
for (unsigned i = 0, end = this->cert.size(); i < end; ++i)
if (this->cert[i] == entry)
{
FOREACH_MOD(I_OnNickEraseCert, OnNickEraseCert(this, entry));
this->cert.erase(this->cert.begin() + i);
break;
}
}
void NickCore::ClearCert()
{
FOREACH_MOD(I_OnNickClearCert, OnNickClearCert(this));
this->cert.clear();
}
+6 -1
View File
@@ -185,7 +185,12 @@ int validate_user(User *u)
u->Collide(na);
return 0;
}
if (!u->IsIdentified() && !u->fingerprint.empty() && na->nc->FindCert(u->fingerprint))
{
u->SendMessage(NickServ, _("SSL Fingerprint accepted, you are now identified"));
u->Identify(na);
return 1;
}
if (!na->nc->HasFlag(NI_SECURE) && u->IsRecognized())
{
na->last_seen = Anope::CurTime;
+57
View File
@@ -334,6 +334,63 @@ void User::Collide(NickAlias *na)
kill_user(Config->s_NickServ, this, "Services nickname-enforcer kill");
}
/** Identify the user to the Nick
* updates last_seen, logs the user in,
* send messages, checks for mails, set vhost and more
* @param the NickAlias
*/
void User::Identify(NickAlias *na)
{
if (!na)
{
Log() << "User::Identify() called with NULL pointer";
return;
}
if (this->nick.equals_ci(na->nick))
{
Anope::string last_usermask = this->GetIdent() + "@" + this->GetDisplayedHost();
na->last_usermask = last_usermask;
na->last_realname = this->realname;
na->last_seen = Anope::CurTime;
}
this->Login(na->nc);
ircdproto->SendAccountLogin(this, this->Account());
ircdproto->SetAutoIdentificationToken(this);
if (na->nc->HasFlag(NI_UNCONFIRMED) == false)
this->SetMode(NickServ, UMODE_REGISTERED);
if (ircd->vhost)
do_on_id(this);
if (Config->NSModeOnID)
do_setmodes(this);
FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(this));
if (Config->NSForceEmail && na->nc->email.empty())
{
this->SendMessage(NickServ, _("You must now supply an e-mail for your nick.\n"
"This e-mail will allow you to retrieve your password in\n"
"case you forget it."));
this->SendMessage(NickServ, _("Type \002%R%s SET EMAIL \037e-mail\037\002 in order to set your e-mail.\n"
"Your privacy is respected; this e-mail won't be given to\n"
"any third-party person."), NickServ->nick.c_str());
}
if (na->nc->HasFlag(NI_UNCONFIRMED))
{
this->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you when you registered."));
time_t time_registered = Anope::CurTime - na->time_registered;
if (Config->NSUnconfirmedExpire > time_registered)
this->SendMessage(NickServ, _("Your account will expire, if not confirmed, in %s"), duration(Config->NSUnconfirmedExpire - time_registered).c_str());
}
check_memos(this);
}
/** Login the user to a NickCore
* @param core The account the user is useing
*/