From e5125c2c84a80a4b23a285bda34eeb4489e6aa6d Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 11 Dec 2016 09:24:52 -0500 Subject: Allow nonconfirmed opers to confirm accounts --- modules/commands/ns_register.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index ce5dbc997..1595d51a8 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -27,7 +27,7 @@ class CommandNSConfirm : public Command { const Anope::string &passcode = params[0]; - if (source.nc && !source.nc->HasExt("UNCONFIRMED") && source.HasPriv("nickserv/confirm")) + if (source.nc && (!source.nc->HasExt("UNCONFIRMED") || source.IsOper()) && source.HasPriv("nickserv/confirm")) { NickAlias *na = NickAlias::Find(passcode); if (na == NULL) -- cgit From 358f46b8ae10921b1d6f69683f77606ef2909b60 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 11 Dec 2016 09:34:37 -0500 Subject: Fix setting kill quick in webcpanel --- modules/webcpanel/pages/nickserv/info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/webcpanel/pages/nickserv/info.cpp b/modules/webcpanel/pages/nickserv/info.cpp index b1c1e2afa..c0d7296fb 100644 --- a/modules/webcpanel/pages/nickserv/info.cpp +++ b/modules/webcpanel/pages/nickserv/info.cpp @@ -72,7 +72,7 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str } else if (message.post_data["kill"] == "quick" && !na->nc->HasExt("KILL_QUICK")) { - na->nc->Shrink("KILLPROTECT"); + na->nc->Extend("KILLPROTECT"); na->nc->Extend("KILL_QUICK"); replacements["MESSAGES"] = "Kill updated"; } -- cgit From d092f5e7c858e8cbaaa89595818a8a2077355561 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 11 Dec 2016 09:43:22 -0500 Subject: Fix detecting if chghost/chgident is loaded on inspircd and don't send them unless they are --- modules/protocol/inspircd20.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'modules') diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index f7ad9da21..fa0150e21 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -394,8 +394,6 @@ struct IRCDMessageCapab : Message::Capab chmodes.clear(); umodes.clear(); Servers::Capab.insert("SERVERS"); - Servers::Capab.insert("CHGHOST"); - Servers::Capab.insert("CHGIDENT"); Servers::Capab.insert("TOPICLOCK"); IRCD->CanSVSHold = false; } -- cgit From 438103199485f0e0e80289874f6f5cf70f8a76e3 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 19 Dec 2016 19:03:10 -0500 Subject: m_sasl: log hostname/ip, if provided --- modules/m_sasl.cpp | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/m_sasl.cpp b/modules/m_sasl.cpp index e1f55bcc9..3dff6c41f 100644 --- a/modules/m_sasl.cpp +++ b/modules/m_sasl.cpp @@ -55,7 +55,7 @@ class Plain : public Mechanism return; } - SASL::IdentifyRequest *req = new SASL::IdentifyRequest(this->owner, m.source, acc, pass); + SASL::IdentifyRequest *req = new SASL::IdentifyRequest(this->owner, m.source, acc, pass, sess->hostname, sess->ip); FOREACH_MOD(OnCheckAuthentication, (NULL, req)); req->Dispatch(); } @@ -104,16 +104,20 @@ class External : public Mechanism return; } + Anope::string user = "A user"; + if (!mysess->hostname.empty() && !mysess->ip.empty()) + user = mysess->hostname + " (" + mysess->ip + ")"; + NickCore *nc = certs->FindAccountFromCert(mysess->cert); if (!nc || nc->HasExt("NS_SUSPENDED")) { - Log(Config->GetClient("NickServ"), "sasl") << "A user failed to identify using certificate " << mysess->cert << " using SASL EXTERNAL"; + Log(Config->GetClient("NickServ"), "sasl") << user << " failed to identify using certificate " << mysess->cert << " using SASL EXTERNAL"; sasl->Fail(sess); delete sess; return; } - Log(Config->GetClient("NickServ"), "sasl") << "A user identified to account " << nc->display << " using SASL EXTERNAL"; + Log(Config->GetClient("NickServ"), "sasl") << user << " identified to account " << nc->display << " using SASL EXTERNAL"; sasl->Succeed(sess, nc); delete sess; } @@ -160,8 +164,21 @@ class SASLService : public SASL::Service, public Timer return; } - if (!session) - session = mech->CreateSession(m.source); + Anope::string hostname, ip; + if (session) + { + // Copy over host/ip to mech-specific session + hostname = session->hostname; + ip = session->ip; + delete session; + } + + session = mech->CreateSession(m.source); + if (session) + { + session->hostname = hostname; + session->ip = ip; + } } else if (m.type == "D") { @@ -169,6 +186,13 @@ class SASLService : public SASL::Service, public Timer sessions.erase(m.source); return; } + else if (m.type == "H") + { + if (!session) + session = new Session(NULL, m.source); + session->hostname = m.data; + session->ip = m.ext; + } if (session && session->mech) session->mech->ProcessMessage(session, m); @@ -261,7 +285,7 @@ class SASLService : public SASL::Service, public Timer Session *s = it->second; ++it; - if (!s || !s->mech || s->created + 60 < Anope::CurTime) + if (!s || s->created + 60 < Anope::CurTime) { delete s; sessions.erase(key); -- cgit From 574c8dfbc798df444899b4907efc50a40ec6e4a4 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 21 Dec 2016 10:35:57 -0500 Subject: Fix previous commit, deleting sessions removes it from the map which invalidates the reference --- modules/m_sasl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/m_sasl.cpp b/modules/m_sasl.cpp index 3dff6c41f..cb7030bb4 100644 --- a/modules/m_sasl.cpp +++ b/modules/m_sasl.cpp @@ -150,7 +150,7 @@ class SASLService : public SASL::Service, public Timer } } - Session* &session = sessions[m.source]; + Session* session = GetSession(m.source); if (m.type == "S") { @@ -178,18 +178,22 @@ class SASLService : public SASL::Service, public Timer { session->hostname = hostname; session->ip = ip; + + sessions[m.source] = session; } } else if (m.type == "D") { delete session; - sessions.erase(m.source); return; } else if (m.type == "H") { if (!session) + { session = new Session(NULL, m.source); + sessions[m.source] = session; + } session->hostname = m.data; session->ip = m.ext; } -- cgit From 7cede5bb6068a7c197f7d27548883332f6ad4b6d Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 7 Jan 2017 18:03:53 -0500 Subject: os_list: also allow patterns in nick!user@host#realname form --- modules/commands/os_list.cpp | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/commands/os_list.cpp b/modules/commands/os_list.cpp index 07eb9f30d..810ea56df 100644 --- a/modules/commands/os_list.cpp +++ b/modules/commands/os_list.cpp @@ -134,6 +134,7 @@ class CommandOSUserList : public Command const Anope::string &opt = params.size() > 1 ? params[1] : ""; Channel *c; std::set modes; + unsigned int count = 0; if (!pattern.empty()) Log(LOG_ADMIN, source, this) << "for " << pattern; @@ -144,7 +145,7 @@ class CommandOSUserList : public Command modes.insert("INVIS"); ListFormatter list(source.GetAccount()); - list.AddColumn(_("Name")).AddColumn(_("Mask")); + list.AddColumn(_("Name")).AddColumn(_("Mask")).AddColumn(_("Realname")); if (!pattern.empty() && (c = Channel::Find(pattern))) { @@ -162,7 +163,10 @@ class CommandOSUserList : public Command ListFormatter::ListEntry entry; entry["Name"] = uc->user->nick; entry["Mask"] = uc->user->GetIdent() + "@" + uc->user->GetDisplayedHost(); + entry["Realname"] = uc->user->realname; list.AddEntry(entry); + + ++count; } } else @@ -180,9 +184,27 @@ class CommandOSUserList : public Command if (!pattern.empty()) { - Anope::string mask = u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost(), mask2 = u2->nick + "!" + u2->GetIdent() + "@" + u2->host, mask3 = u2->nick + "!" + u2->GetIdent() + "@" + u2->ip.addr(); - if (!Anope::Match(mask, pattern, false, true) && !Anope::Match(mask2, pattern, false, true) && !Anope::Match(mask3, pattern, false, true)) + /* check displayed host, host, and ip */ + Anope::string masks[] = { + u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost(), + u2->nick + "!" + u2->GetIdent() + "@" + u2->host, + u2->nick + "!" + u2->GetIdent() + "@" + u2->ip.addr() + }; + + bool match = false; + for (unsigned int i = 0; i < sizeof(masks) / sizeof(*masks); ++i) + { + /* Check mask with realname included, too */ + if (Anope::Match(masks[i], pattern, false, true) || Anope::Match(masks[i] + "#" + u2->realname, pattern, false, true)) + { + match = true; + break; + } + } + + if (!match) continue; + if (!modes.empty()) for (std::set::iterator mit = modes.begin(), mit_end = modes.end(); mit != mit_end; ++mit) if (!u2->HasMode(*mit)) @@ -192,7 +214,10 @@ class CommandOSUserList : public Command ListFormatter::ListEntry entry; entry["Name"] = u2->nick; entry["Mask"] = u2->GetIdent() + "@" + u2->GetDisplayedHost(); + entry["Realname"] = u2->realname; list.AddEntry(entry); + + ++count; } } @@ -202,7 +227,7 @@ class CommandOSUserList : public Command for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); - source.Reply(_("End of users list.")); + source.Reply(_("End of users list. \002%u\002 users shown."), count); return; } @@ -214,8 +239,8 @@ class CommandOSUserList : public Command "nick is registered or not.\n" " \n" "If \002pattern\002 is given, lists only users that match it (it must be in\n" - "the format nick!user@host). If \002channel\002 is given, lists only users\n" - "that are on the given channel. If INVISIBLE is specified, only users\n" + "the format nick!user@host[#realname]). If \002channel\002 is given, lists\n" + "only users that are on the given channel. If INVISIBLE is specified, only users\n" "with the +i flag will be listed.")); const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); -- cgit From fe6271dffb92707a013a53b6e704ae2ceec36ebb Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 7 Jan 2017 18:04:07 -0500 Subject: ngircd: move metadata non-exietent user log message to debug --- modules/protocol/ngircd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index c401f406c..56869c63a 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -317,7 +317,7 @@ struct IRCDMessageMetadata : IRCDMessage User *u = User::Find(params[0]); if (!u) { - Log() << "received METADATA for non-existent user " << params[0]; + Log(LOG_DEBUG) << "received METADATA for non-existent user " << params[0]; return; } if (params[1].equals_cs("accountname")) -- cgit From 46aeb8b70b116ffe37a6f1a72ddb9c69b7cccc98 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 7 Jan 2017 18:09:14 -0500 Subject: os_list: show number of channels listed, too --- modules/commands/os_list.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/commands/os_list.cpp b/modules/commands/os_list.cpp index 810ea56df..780cdd05e 100644 --- a/modules/commands/os_list.cpp +++ b/modules/commands/os_list.cpp @@ -26,6 +26,7 @@ class CommandOSChanList : public Command const Anope::string &opt = params.size() > 1 ? params[1] : ""; std::set modes; User *u2; + unsigned int count = 0; if (!pattern.empty()) Log(LOG_ADMIN, source, this) << "for " << pattern; @@ -60,6 +61,8 @@ class CommandOSChanList : public Command entry["Modes"] = cc->chan->GetModes(true, true); entry["Topic"] = cc->chan->topic; list.AddEntry(entry); + + ++count; } } else @@ -83,6 +86,8 @@ class CommandOSChanList : public Command entry["Modes"] = c->GetModes(true, true); entry["Topic"] = c->topic; list.AddEntry(entry); + + ++count; } } @@ -92,7 +97,7 @@ class CommandOSChanList : public Command for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); - source.Reply(_("End of channel list.")); + source.Reply(_("End of channel list. \002%u\002 channels shown."), count); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override -- cgit