summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-01-23 10:53:32 -0500
committerAdam <Adam@anope.org>2016-01-23 10:53:32 -0500
commit38fcf15d6283865f603793dd1afc1fbe5035a6a6 (patch)
tree430558a634a39309888e7d0133868b3350b209e9
parent75dd784538504b53d5155a96b88aaac6188f950d (diff)
Put maxlogins logic a few other important places
-rw-r--r--include/modules/sasl.h4
-rw-r--r--modules/commands/ns_cert.cpp16
2 files changed, 20 insertions, 0 deletions
diff --git a/include/modules/sasl.h b/include/modules/sasl.h
index eca31d4af..d9756949f 100644
--- a/include/modules/sasl.h
+++ b/include/modules/sasl.h
@@ -89,6 +89,10 @@ namespace SASL
if (!na || na->nc->HasExt("NS_SUSPENDED"))
return OnFail();
+ unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
+ if (maxlogins && na->nc->users.size() >= maxlogins)
+ return OnFail();
+
Session *s = sasl->GetSession(uid);
if (s)
{
diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp
index aedb816d2..87702b834 100644
--- a/modules/commands/ns_cert.cpp
+++ b/modules/commands/ns_cert.cpp
@@ -362,6 +362,13 @@ class NSCert : public Module
if (!nc || nc->HasExt("NS_SUSPENDED"))
return;
+ unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
+ if (maxlogins && nc->users.size() >= maxlogins)
+ {
+ u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), nc->display.c_str(), maxlogins);
+ return;
+ }
+
NickAlias *na = NickAlias::Find(u->nick);
if (na && na->nc == nc)
u->Identify(na);
@@ -378,7 +385,16 @@ class NSCert : public Module
if (!u->fingerprint.empty() && cl && cl->FindCert(u->fingerprint))
{
BotInfo *NickServ = Config->GetClient("NickServ");
+
+ unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
+ if (maxlogins && na->nc->users.size() >= maxlogins)
+ {
+ u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins);
+ return EVENT_CONTINUE;
+ }
+
u->Identify(na);
+
u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified."));
Log(NickServ) << u->GetMask() << " automatically identified for account " << na->nc->display << " via SSL certificate fingerprint";
return EVENT_ALLOW;