summaryrefslogtreecommitdiff
path: root/modules/extra
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-10-07 22:39:58 -0400
committerAdam <Adam@anope.org>2012-10-07 22:39:58 -0400
commitb8b63ff115f0daddf479b0da507a2f731255a06d (patch)
treed6b82bf0dfc39fdfe6a6a23ba318bb0c2906d6c1 /modules/extra
parent0a111c19764ed14ab5f724c78d9dd8c08a3c124f (diff)
Remove the asynchronous identifing hack and replace it with something better. Fixes m_*_authentication only being able to properly work when people identify normally using nickserv/identify
Diffstat (limited to 'modules/extra')
-rw-r--r--modules/extra/httpd.h21
-rw-r--r--modules/extra/m_httpd.cpp7
-rw-r--r--modules/extra/m_ldap_authentication.cpp123
-rw-r--r--modules/extra/m_sql_authentication.cpp111
-rw-r--r--modules/extra/m_xmlrpc_main.cpp50
-rw-r--r--modules/extra/webcpanel/pages/chanserv/access.cpp9
-rw-r--r--modules/extra/webcpanel/pages/chanserv/access.h2
-rw-r--r--modules/extra/webcpanel/pages/chanserv/akick.cpp9
-rw-r--r--modules/extra/webcpanel/pages/chanserv/akick.h2
-rw-r--r--modules/extra/webcpanel/pages/chanserv/info.cpp4
-rw-r--r--modules/extra/webcpanel/pages/chanserv/info.h2
-rw-r--r--modules/extra/webcpanel/pages/chanserv/set.cpp7
-rw-r--r--modules/extra/webcpanel/pages/chanserv/set.h2
-rw-r--r--modules/extra/webcpanel/pages/confirm.cpp3
-rw-r--r--modules/extra/webcpanel/pages/confirm.h2
-rw-r--r--modules/extra/webcpanel/pages/index.cpp118
-rw-r--r--modules/extra/webcpanel/pages/index.h2
-rw-r--r--modules/extra/webcpanel/pages/logout.cpp3
-rw-r--r--modules/extra/webcpanel/pages/logout.h2
-rw-r--r--modules/extra/webcpanel/pages/memoserv/memos.cpp3
-rw-r--r--modules/extra/webcpanel/pages/memoserv/memos.h2
-rw-r--r--modules/extra/webcpanel/pages/nickserv/access.cpp3
-rw-r--r--modules/extra/webcpanel/pages/nickserv/access.h2
-rw-r--r--modules/extra/webcpanel/pages/nickserv/alist.cpp3
-rw-r--r--modules/extra/webcpanel/pages/nickserv/alist.h2
-rw-r--r--modules/extra/webcpanel/pages/nickserv/cert.cpp3
-rw-r--r--modules/extra/webcpanel/pages/nickserv/cert.h2
-rw-r--r--modules/extra/webcpanel/pages/nickserv/info.cpp3
-rw-r--r--modules/extra/webcpanel/pages/nickserv/info.h2
-rw-r--r--modules/extra/webcpanel/pages/operserv/akill.cpp3
-rw-r--r--modules/extra/webcpanel/pages/operserv/akill.h2
-rw-r--r--modules/extra/webcpanel/pages/register.cpp3
-rw-r--r--modules/extra/webcpanel/pages/register.h2
-rw-r--r--modules/extra/webcpanel/static_fileserver.cpp5
-rw-r--r--modules/extra/webcpanel/static_fileserver.h2
-rw-r--r--modules/extra/webcpanel/template_fileserver.cpp1
-rw-r--r--modules/extra/webcpanel/webcpanel.h10
-rw-r--r--modules/extra/xmlrpc.h2
38 files changed, 283 insertions, 251 deletions
diff --git a/modules/extra/httpd.h b/modules/extra/httpd.h
index 684c11512..d9e800d13 100644
--- a/modules/extra/httpd.h
+++ b/modules/extra/httpd.h
@@ -21,6 +21,23 @@ struct HTTPReply
HTTPReply() : error(HTTP_ERROR_OK), length(0) { }
+ HTTPReply(const HTTPReply& other) : error(other.error), length(other.length)
+ {
+ content_type = other.content_type;
+ headers = other.headers;
+ cookies = other.cookies;
+
+ for (unsigned i = 0; i < other.out.size(); ++i)
+ out.push_back(new Data(other.out[i]->buf, other.out[i]->len));
+ }
+
+ ~HTTPReply()
+ {
+ for (unsigned i = 0; i < out.size(); ++i)
+ delete out[i];
+ out.clear();
+ }
+
struct Data
{
char *buf;
@@ -87,10 +104,10 @@ class HTTPPage : public Base
* @param The HTTP header sent from the client to request the page
* @param The HTTP header that will be sent back to the client
*/
- virtual void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
+ virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
};
-class HTTPClient : public ClientSocket, public BufferedSocket, public BinarySocket
+class HTTPClient : public ClientSocket, public BufferedSocket, public BinarySocket, public Base
{
protected:
void WriteClient(const Anope::string &message)
diff --git a/modules/extra/m_httpd.cpp b/modules/extra/m_httpd.cpp
index 626a62e8c..e802ed055 100644
--- a/modules/extra/m_httpd.cpp
+++ b/modules/extra/m_httpd.cpp
@@ -35,7 +35,7 @@ static Anope::string GetStatusFromCode(HTTPError err)
return "501 Not Implemented";
}
-class MyHTTPClient : public HTTPClient, public Base
+class MyHTTPClient : public HTTPClient
{
HTTPProvider *provider;
HTTPMessage header;
@@ -78,9 +78,8 @@ class MyHTTPClient : public HTTPClient, public Base
HTTPReply reply;
- this->page->OnRequest(this->provider, this->page_name, this, this->header, reply);
-
- this->SendReply(&reply);
+ if (this->page->OnRequest(this->provider, this->page_name, this, this->header, reply))
+ this->SendReply(&reply);
}
public:
diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp
index 7fcd67e5d..2ca08f975 100644
--- a/modules/extra/m_ldap_authentication.cpp
+++ b/modules/extra/m_ldap_authentication.cpp
@@ -2,6 +2,8 @@
#include "nickserv.h"
#include "ldap.h"
+static Module *me;
+
static Anope::string basedn;
static Anope::string search_filter;
static Anope::string object_class;
@@ -10,17 +12,21 @@ static Anope::string username_attribute;
struct IdentifyInfo
{
- dynamic_reference<Command> command;
- CommandSource source;
- std::vector<Anope::string> params;
- Anope::string account;
- Anope::string pass;
- Anope::string dn;
+ dynamic_reference<User> user;
+ IdentifyRequest *req;
service_reference<LDAPProvider> lprov;
bool admin_bind;
+ Anope::string dn;
- IdentifyInfo(Command *c, CommandSource &s, const std::vector<Anope::string> &pa, const Anope::string &a, const Anope::string &p, service_reference<LDAPProvider> &lp) :
- command(c), source(s), params(pa), account(a), pass(p), lprov(lp), admin_bind(true) { }
+ IdentifyInfo(User *u, IdentifyRequest *r, service_reference<LDAPProvider> &lp) : user(u), req(r), lprov(lp), admin_bind(true)
+ {
+ req->Hold(me);
+ }
+
+ ~IdentifyInfo()
+ {
+ req->Release(me);
+ }
};
class IdentifyInterface : public LDAPInterface
@@ -46,9 +52,9 @@ class IdentifyInterface : public LDAPInterface
IdentifyInfo *ii = it->second;
this->requests.erase(it);
- if (!ii->source.GetUser() || !ii->command || !ii->lprov)
+ if (!ii->lprov)
{
- delete this;
+ delete ii;
return;
}
@@ -63,69 +69,55 @@ class IdentifyInterface : public LDAPInterface
const LDAPAttributes &attr = r.get(0);
ii->dn = attr.get("dn");
Log(LOG_DEBUG) << "m_ldap_authenticationn: binding as " << ii->dn;
- LDAPQuery id = ii->lprov->Bind(this, ii->dn, ii->pass);
+ LDAPQuery id = ii->lprov->Bind(this, ii->dn, ii->req->GetPassword());
this->Add(id, ii);
+ return;
}
catch (const LDAPException &ex)
{
Log() << "m_ldap_authentication: Error binding after search: " << ex.GetReason();
- delete ii;
}
}
- else
- {
- User *u = ii->source.GetUser();
- Command *c = ii->command;
-
- u->Extend("m_ldap_authentication_error", NULL);
-
- c->Execute(ii->source, ii->params);
-
- delete ii;
- }
break;
}
case LDAPResult::QUERY_BIND:
{
if (ii->admin_bind)
{
- Anope::string sf = search_filter.replace_all_cs("%account", ii->account).replace_all_cs("%object_class", object_class);
+ Anope::string sf = search_filter.replace_all_cs("%account", ii->req->GetAccount()).replace_all_cs("%object_class", object_class);
Log(LOG_DEBUG) << "m_ldap_authentication: searching for " << sf;
LDAPQuery id = ii->lprov->Search(this, basedn, sf);
this->Add(id, ii);
ii->admin_bind = false;
+ return;
}
else
{
- User *u = ii->source.GetUser();
- Command *c = ii->command;
-
- u->Extend("m_ldap_authentication_authenticated", NULL);
-
- NickAlias *na = findnick(ii->account);
+ NickAlias *na = findnick(ii->req->GetAccount());
if (na == NULL)
{
- na = new NickAlias(ii->account, new NickCore(ii->account));
- if (Config->NSAddAccessOnReg)
- na->nc->AddAccess(create_mask(u));
-
- BotInfo *bi = findbot(Config->NickServ);
- if (bi)
- u->SendMessage(bi, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
+ na = new NickAlias(ii->req->GetAccount(), new NickCore(ii->req->GetAccount()));
+ if (ii->user)
+ {
+ if (Config->NSAddAccessOnReg)
+ na->nc->AddAccess(create_mask(ii->user));
+
+ const BotInfo *bi = findbot(Config->NickServ);
+ if (bi)
+ ii->user->SendMessage(bi, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
+ }
}
-
na->nc->Extend("m_ldap_authentication_dn", new ExtensibleItemClass<Anope::string>(ii->dn));
-
- enc_encrypt(ii->pass, na->nc->pass);
-
- c->Execute(ii->source, ii->params);
- delete ii;
+
+ ii->req->Success(me);
}
break;
}
default:
- delete ii;
+ break;
}
+
+ delete ii;
}
void OnError(const LDAPResult &r) anope_override
@@ -135,20 +127,6 @@ class IdentifyInterface : public LDAPInterface
return;
IdentifyInfo *ii = it->second;
this->requests.erase(it);
-
- if (!ii->source.GetUser() || !ii->command)
- {
- delete ii;
- return;
- }
-
- User *u = ii->source.GetUser();
- Command *c = ii->command;
-
- u->Extend("m_ldap_authentication_error", NULL);
-
- c->Execute(ii->source, ii->params);
-
delete ii;
}
};
@@ -235,6 +213,8 @@ class NSIdentifyLDAP : public Module
{
this->SetAuthor("Anope");
+ me = this;
+
Implementation i[] = { I_OnReload, I_OnPreCommand, I_OnCheckAuthentication, I_OnNickIdentify, I_OnNickRegister };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::SetPriority(this, PRIORITY_FIRST);
@@ -267,28 +247,12 @@ class NSIdentifyLDAP : public Module
return EVENT_CONTINUE;
}
- EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) anope_override
+ void OnCheckAuthentication(User *u, IdentifyRequest *req) anope_override
{
+ if (!this->ldap)
+ return;
- if (c == NULL || source == NULL || !this->ldap)
- return EVENT_CONTINUE;
-
- User *u = source->GetUser();
- if (!u)
- return EVENT_CONTINUE;
-
- if (u->HasExt("m_ldap_authentication_authenticated"))
- {
- u->Shrink("m_ldap_authentication_authenticated");
- return EVENT_ALLOW;
- }
- else if (u->HasExt("m_ldap_authentication_error"))
- {
- u->Shrink("m_ldap_authentication_error");
- return EVENT_CONTINUE;
- }
-
- IdentifyInfo *ii = new IdentifyInfo(c, *source, params, account, password, this->ldap);
+ IdentifyInfo *ii = new IdentifyInfo(u, req, this->ldap);
try
{
LDAPQuery id = this->ldap->BindAsAdmin(&this->iinterface);
@@ -298,10 +262,7 @@ class NSIdentifyLDAP : public Module
{
delete ii;
Log() << "ns_identify_ldap: " << ex.GetReason();
- return EVENT_CONTINUE;
}
-
- return EVENT_STOP;
}
void OnNickIdentify(User *u) anope_override
diff --git a/modules/extra/m_sql_authentication.cpp b/modules/extra/m_sql_authentication.cpp
index 957258fcb..9375615ee 100644
--- a/modules/extra/m_sql_authentication.cpp
+++ b/modules/extra/m_sql_authentication.cpp
@@ -1,71 +1,71 @@
#include "module.h"
#include "sql.h"
+static Module *me;
+
class SQLAuthenticationResult : public SQLInterface
{
- dynamic_reference<Command> cmd;
- CommandSource source;
- std::vector<Anope::string> params;
dynamic_reference<User> user;
- Anope::string account;
+ IdentifyRequest *req;
public:
- SQLAuthenticationResult(Module *m, Command *c, CommandSource &s, const std::vector<Anope::string> &p, User *u, const Anope::string &a) : SQLInterface(m), cmd(c), source(s), params(p), user(u), account(a) { }
+ SQLAuthenticationResult(User *u, IdentifyRequest *r) : SQLInterface(me), user(u), req(r)
+ {
+ req->Hold(me);
+ }
+
+ ~SQLAuthenticationResult()
+ {
+ req->Release(me);
+ }
void OnResult(const SQLResult &r) anope_override
{
- if (user && cmd)
+ if (r.Rows() == 0)
{
- Anope::string email;
+ Log(LOG_DEBUG) << "m_sql_authentication: Unsuccessful authentication for " << req->GetAccount();
+ delete this;
+ return;
+ }
- if (r.Rows() > 0)
- {
- user->Extend("m_sql_authentication_success", NULL);
+ Log(LOG_DEBUG) << "m_sql_authentication: Successful authentication for " << req->GetAccount();
- try
- {
- email = r.Get(0, "email");
- }
- catch (const SQLException &) { }
- }
- else
- user->Extend("m_sql_authentication_failed", NULL);
+ Anope::string email;
+ try
+ {
+ email = r.Get(0, "email");
+ }
+ catch (const SQLException &) { }
- BotInfo *bi = findbot(Config->NickServ);
- NickAlias *na = findnick(account);
- if (na == NULL)
+ const BotInfo *bi = findbot(Config->NickServ);
+ NickAlias *na = findnick(req->GetAccount());
+ if (na == NULL)
+ {
+ na = new NickAlias(req->GetAccount(), new NickCore(req->GetAccount()));
+ if (user)
{
- na = new NickAlias(account, new NickCore(account));
if (Config->NSAddAccessOnReg)
na->nc->AddAccess(create_mask(user));
if (bi)
user->SendMessage(bi, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
}
+ }
- if (!email.empty() && email != na->nc->email)
- {
- na->nc->email = email;
- if (bi)
- user->SendMessage(bi, _("Your email has been updated to \002%s\002."), email.c_str());
- }
-
- cmd->Execute(source, params);
+ if (!email.empty() && email != na->nc->email)
+ {
+ na->nc->email = email;
+ if (user && bi)
+ user->SendMessage(bi, _("Your email has been updated to \002%s\002."), email.c_str());
}
+ req->Success(me);
delete this;
}
void OnError(const SQLResult &r) anope_override
{
Log() << "m_sql_authentication: Error executing query " << r.GetQuery().query << ": " << r.GetError();
-
- if (user && cmd)
- {
- user->Extend("m_sql_authentication_failed", NULL);
- cmd->Execute(source, params);
- }
-
delete this;
}
};
@@ -84,6 +84,8 @@ class ModuleSQLAuthentication : public Module
{
this->SetAuthor("Anope");
+ me = this;
+
Implementation i[] = { I_OnReload, I_OnPreCommand, I_OnCheckAuthentication };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
@@ -113,37 +115,32 @@ class ModuleSQLAuthentication : public Module
return EVENT_CONTINUE;
}
- EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) anope_override
+ void OnCheckAuthentication(User *u, IdentifyRequest *req) anope_override
{
- if (!source || !source->GetUser())
- return EVENT_CONTINUE;
- else if (!this->SQL)
+ if (!this->SQL)
{
Log() << "m_sql_authentication: Unable to find SQL engine";
- return EVENT_CONTINUE;
+ return;
}
- else if (source->GetUser()->HasExt("m_sql_authentication_success"))
+
+ SQLQuery q(this->query);
+ q.setValue("a", req->GetAccount());
+ q.setValue("p", req->GetPassword());
+ if (u)
{
- source->GetUser()->Shrink("m_sql_authentication_success");
- return EVENT_ALLOW;
+ q.setValue("n", u->nick);
+ q.setValue("i", u->ip);
}
- else if (source->GetUser()->HasExt("m_sql_authentication_failed"))
+ else
{
- source->GetUser()->Shrink("m_sql_authentication_failed");
- return EVENT_CONTINUE;
+ q.setValue("n", "");
+ q.setValue("i", "");
}
- SQLQuery q(this->query);
- q.setValue("a", account);
- q.setValue("p", password);
- q.setValue("n", source->GetNick());
- q.setValue("i", source->GetUser()->ip);
-
- this->SQL->Run(new SQLAuthenticationResult(this, c, *source, params, source->GetUser(), account), q);
- Log(LOG_DEBUG) << "m_sql_authentication: Checking authentication for " << account;
+ this->SQL->Run(new SQLAuthenticationResult(u, req), q);
- return EVENT_STOP;
+ Log(LOG_DEBUG) << "m_sql_authentication: Checking authentication for " << req->GetAccount();
}
};
diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp
index dc12d565e..cd7b68967 100644
--- a/modules/extra/m_xmlrpc_main.cpp
+++ b/modules/extra/m_xmlrpc_main.cpp
@@ -1,6 +1,37 @@
#include "module.h"
#include "xmlrpc.h"
+class XMLRPCIdentifyRequest : public IdentifyRequest
+{
+ XMLRPCRequest request;
+ dynamic_reference<XMLRPCServiceInterface> xinterface;
+ dynamic_reference<XMLRPCClientSocket> source;
+
+ public:
+ XMLRPCIdentifyRequest(XMLRPCRequest& req, XMLRPCServiceInterface* iface, XMLRPCClientSocket* s, const Anope::string &acc, const Anope::string &pass) : IdentifyRequest(acc, pass), request(req), xinterface(iface), source(s) { }
+
+ void OnSuccess() anope_override
+ {
+ if (!xinterface || !source)
+ return;
+
+ request.reply("result", "Success");
+ request.reply("account", GetAccount());
+
+ xinterface->Reply(source, &request);
+ }
+
+ void OnFail() anope_override
+ {
+ if (!xinterface || !source)
+ return;
+
+ request.reply("error", "Invalid password");
+
+ xinterface->Reply(source, &request);
+ }
+};
+
class MyXMLRPCEvent : public XMLRPCEvent
{
public:
@@ -77,22 +108,9 @@ class MyXMLRPCEvent : public XMLRPCEvent
request->reply("error", "Invalid parameters");
else
{
- const NickAlias *na = findnick(username);
-
- if (!na)
- request->reply("error", "Invalid account");
- else
- {
- EventReturn MOD_RESULT;
- FOREACH_RESULT(I_OnCheckAuthentication, OnCheckAuthentication(NULL, NULL, std::vector<Anope::string>(), na->nc->display, password));
- if (MOD_RESULT == EVENT_ALLOW)
- {
- request->reply("result", "Success");
- request->reply("account", na->nc->display);
- }
- else
- request->reply("error", "Invalid password");
- }
+ XMLRPCIdentifyRequest *req = new XMLRPCIdentifyRequest(*request, iface, source, username, password);
+ FOREACH_MOD(I_OnCheckAuthentication, OnCheckAuthentication(NULL, req));
+ req->Dispatch();
}
}
diff --git a/modules/extra/webcpanel/pages/chanserv/access.cpp b/modules/extra/webcpanel/pages/chanserv/access.cpp
index d3ec2ad99..71fe1a7e9 100644
--- a/modules/extra/webcpanel/pages/chanserv/access.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/access.cpp
@@ -11,7 +11,7 @@ WebCPanel::ChanServ::Access::Access(const Anope::string &cat, const Anope::strin
{
}
-void WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
const Anope::string &chname = message.get_data["channel"];
@@ -19,19 +19,19 @@ void WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
{
reply.error = HTTP_FOUND;
reply.headers["Location"] = "http://" + message.headers["Host"] + "/chanserv/info";
- return;
+ return true;
}
ChannelInfo *ci = cs_findchan(chname);
if (!ci)
- return;
+ return true;
AccessGroup u_access = ci->AccessFor(na->nc);
bool has_priv = na->nc->IsServicesOper() && na->nc->o->ot->HasPriv("chanserv/access/modify");
if (!u_access.HasPriv("ACCESS_LIST") && !has_priv)
- return;
+ return true;
const ChanAccess *highest = u_access.Highest();
@@ -136,6 +136,7 @@ void WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
TemplateFileServer page("chanserv/access.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
std::set<Anope::string> WebCPanel::ChanServ::Access::GetData() anope_override
diff --git a/modules/extra/webcpanel/pages/chanserv/access.h b/modules/extra/webcpanel/pages/chanserv/access.h
index 50425aa40..d5fbbf68c 100644
--- a/modules/extra/webcpanel/pages/chanserv/access.h
+++ b/modules/extra/webcpanel/pages/chanserv/access.h
@@ -16,7 +16,7 @@ class Access : public WebPanelProtectedPage
public:
Access(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
std::set<Anope::string> GetData() anope_override;
};
diff --git a/modules/extra/webcpanel/pages/chanserv/akick.cpp b/modules/extra/webcpanel/pages/chanserv/akick.cpp
index bc80437cc..bb38c5e06 100644
--- a/modules/extra/webcpanel/pages/chanserv/akick.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/akick.cpp
@@ -11,7 +11,7 @@ WebCPanel::ChanServ::Akick::Akick(const Anope::string &cat, const Anope::string
{
}
-void WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
const Anope::string &chname = message.get_data["channel"];
@@ -19,19 +19,19 @@ void WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::st
{
reply.error = HTTP_FOUND;
reply.headers["Location"] = "http://" + message.headers["Host"] + "/chanserv/info";
- return;
+ return true;
}
ChannelInfo *ci = cs_findchan(chname);
if (!ci)
- return;
+ return true;
AccessGroup u_access = ci->AccessFor(na->nc);
bool has_priv = na->nc->IsServicesOper() && na->nc->o->ot->HasPriv("chanserv/access/modify");
if (!u_access.HasPriv("akick") && !has_priv)
- return;
+ return true;
if (message.get_data["del"].empty() == false && message.get_data["mask"].empty() == false)
{
@@ -70,6 +70,7 @@ void WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::st
TemplateFileServer page("chanserv/akick.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
std::set<Anope::string> WebCPanel::ChanServ::Akick::GetData() anope_override
diff --git a/modules/extra/webcpanel/pages/chanserv/akick.h b/modules/extra/webcpanel/pages/chanserv/akick.h
index ff4a4653e..cd8408934 100644
--- a/modules/extra/webcpanel/pages/chanserv/akick.h
+++ b/modules/extra/webcpanel/pages/chanserv/akick.h
@@ -16,7 +16,7 @@ class Akick : public WebPanelProtectedPage
public:
Akick(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
std::set<Anope::string> GetData() anope_override;
};
diff --git a/modules/extra/webcpanel/pages/chanserv/info.cpp b/modules/extra/webcpanel/pages/chanserv/info.cpp
index 8db88f496..44ae98537 100644
--- a/modules/extra/webcpanel/pages/chanserv/info.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/info.cpp
@@ -11,7 +11,7 @@ WebCPanel::ChanServ::Info::Info(const Anope::string &cat, const Anope::string &u
{
}
-void WebCPanel::ChanServ::Info::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::ChanServ::Info::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
// XXX this is slightly inefficient
for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
@@ -25,8 +25,8 @@ void WebCPanel::ChanServ::Info::OnRequest(HTTPProvider *server, const Anope::str
}
}
-
TemplateFileServer page("chanserv/main.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/chanserv/info.h b/modules/extra/webcpanel/pages/chanserv/info.h
index 87dc9836b..c55e1b1eb 100644
--- a/modules/extra/webcpanel/pages/chanserv/info.h
+++ b/modules/extra/webcpanel/pages/chanserv/info.h
@@ -16,7 +16,7 @@ class Info : public WebPanelProtectedPage
public:
Info(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/chanserv/set.cpp b/modules/extra/webcpanel/pages/chanserv/set.cpp
index 764eb13ac..7d144c6de 100644
--- a/modules/extra/webcpanel/pages/chanserv/set.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/set.cpp
@@ -11,7 +11,7 @@ WebCPanel::ChanServ::Set::Set(const Anope::string &cat, const Anope::string &u)
{
}
-void WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
const Anope::string &chname = message.get_data["channel"];
@@ -19,13 +19,13 @@ void WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
{
reply.error = HTTP_FOUND;
reply.headers["Location"] = "http://" + message.headers["Host"] + "/chanserv/info";
- return;
+ return true;
}
ChannelInfo *ci = cs_findchan(chname);
if (!ci || !ci->AccessFor(na->nc).HasPriv("SET"))
- return;
+ return true;
if (message.post_data.empty() == false)
{
@@ -125,6 +125,7 @@ void WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
TemplateFileServer page("chanserv/set.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
std::set<Anope::string> WebCPanel::ChanServ::Set::GetData() anope_override
diff --git a/modules/extra/webcpanel/pages/chanserv/set.h b/modules/extra/webcpanel/pages/chanserv/set.h
index 67e817493..4d4113b5a 100644
--- a/modules/extra/webcpanel/pages/chanserv/set.h
+++ b/modules/extra/webcpanel/pages/chanserv/set.h
@@ -16,7 +16,7 @@ class Set : public WebPanelProtectedPage
public:
Set(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
std::set<Anope::string> GetData() anope_override;
};
diff --git a/modules/extra/webcpanel/pages/confirm.cpp b/modules/extra/webcpanel/pages/confirm.cpp
index f18d28129..18e2004b5 100644
--- a/modules/extra/webcpanel/pages/confirm.cpp
+++ b/modules/extra/webcpanel/pages/confirm.cpp
@@ -7,7 +7,7 @@
#include "../webcpanel.h"
-void WebCPanel::Confirm::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply)
+bool WebCPanel::Confirm::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply)
{
TemplateFileServer::Replacements replacements;
const Anope::string &user = message.post_data["username"], &pass = message.post_data["password"], &email = message.post_data["email"];
@@ -27,5 +27,6 @@ void WebCPanel::Confirm::OnRequest(HTTPProvider *server, const Anope::string &pa
TemplateFileServer page("confirm.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/confirm.h b/modules/extra/webcpanel/pages/confirm.h
index d4d19d9c6..c6a5d180d 100644
--- a/modules/extra/webcpanel/pages/confirm.h
+++ b/modules/extra/webcpanel/pages/confirm.h
@@ -15,7 +15,7 @@ class Confirm : public WebPanelPage
public:
Confirm(const Anope::string &u) : WebPanelPage(u) { }
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/index.cpp b/modules/extra/webcpanel/pages/index.cpp
index e0db8f8de..73f7224f4 100644
--- a/modules/extra/webcpanel/pages/index.cpp
+++ b/modules/extra/webcpanel/pages/index.cpp
@@ -7,67 +7,93 @@
#include "../webcpanel.h"
-void WebCPanel::Index::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply)
+class WebpanelRequest : public IdentifyRequest
{
+ HTTPReply reply;
+ HTTPMessage message;
+ dynamic_reference<HTTPProvider> server;
+ Anope::string page_name;
+ dynamic_reference<HTTPClient> client;
TemplateFileServer::Replacements replacements;
- const Anope::string &user = message.post_data["username"], &pass = message.post_data["password"];
- replacements["TITLE"] = page_title;
+ public:
+ WebpanelRequest(HTTPReply &r, HTTPMessage &m, HTTPProvider *s, const Anope::string &p_n, HTTPClient *c, TemplateFileServer::Replacements &re, const Anope::string &user, const Anope::string &pass) : IdentifyRequest(user, pass), reply(r), message(m), server(s), page_name(p_n), client(c), replacements(re) { }
- if (!user.empty() && !pass.empty())
+ void OnSuccess() anope_override
{
- // Rate limit check.
-
- NickAlias *na = findnick(user);
-
- EventReturn MOD_RESULT = EVENT_CONTINUE;
-
- if (na)
+ if (!client)
+ return;
+ NickAlias *na = findnick(this->GetAccount());
+ if (!na)
{
- FOREACH_RESULT(I_OnCheckAuthentication, OnCheckAuthentication(NULL, NULL, std::vector<Anope::string>(), na->nc->display, pass));
+ this->OnFail();
+ return;
}
- if (MOD_RESULT == EVENT_ALLOW)
+ Anope::string id;
+ for (int i = 0; i < 64; ++i)
{
- Anope::string id;
- for (int i = 0; i < 64; ++i)
- {
- char c;
- do
- c = 48 + (rand() % 75);
- while (!isalnum(c));
- id += c;
- }
-
- na->Extend("webcpanel_id", new ExtensibleItemClass<Anope::string>(id));
- na->Extend("webcpanel_ip", new ExtensibleItemClass<Anope::string>(client->GetIP()));
-
- {
- HTTPReply::cookie c;
- c.push_back(std::make_pair("account", na->nick));
- c.push_back(std::make_pair("Path", "/"));
- reply.cookies.push_back(c);
- }
-
- {
- HTTPReply::cookie c;
- c.push_back(std::make_pair("id", id));
- c.push_back(std::make_pair("Path", "/"));
- reply.cookies.push_back(c);
- }
-
- reply.error = HTTP_FOUND;
- reply.headers["Location"] = "http://" + message.headers["Host"] + "/nickserv/info";
- return;
+ char c;
+ do
+ c = 48 + (rand() % 75);
+ while (!isalnum(c));
+ id += c;
}
- else
+
+ na->Extend("webcpanel_id", new ExtensibleItemClass<Anope::string>(id));
+ na->Extend("webcpanel_ip", new ExtensibleItemClass<Anope::string>(client->GetIP()));
+
{
- replacements["INVALID_LOGIN"] = "Invalid username or password";
+ HTTPReply::cookie c;
+ c.push_back(std::make_pair("account", na->nick));
+ c.push_back(std::make_pair("Path", "/"));
+ reply.cookies.push_back(c);
+ }
+
+ {
+ HTTPReply::cookie c;
+ c.push_back(std::make_pair("id", id));
+ c.push_back(std::make_pair("Path", "/"));
+ reply.cookies.push_back(c);
}
+
+ reply.error = HTTP_FOUND;
+ reply.headers["Location"] = "http://" + message.headers["Host"] + "/nickserv/info";
+
+ client->SendReply(&reply);
}
- TemplateFileServer page("login.html");
+ void OnFail() anope_override
+ {
+ if (!client)
+ return;
+ replacements["INVALID_LOGIN"] = "Invalid username or password";
+ TemplateFileServer page("login.html");
+ page.Serve(server, page_name, client, message, reply, replacements);
+ client->SendReply(&reply);
+ }
+};
+
+bool WebCPanel::Index::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply)
+{
+ TemplateFileServer::Replacements replacements;
+ const Anope::string &user = message.post_data["username"], &pass = message.post_data["password"];
+
+ replacements["TITLE"] = page_title;
+
+ if (!user.empty() && !pass.empty())
+ {
+ // Rate limit check.
+
+ WebpanelRequest *req = new WebpanelRequest(reply, message, server, page_name, client, replacements, user, pass);
+ FOREACH_MOD(I_OnCheckAuthentication, OnCheckAuthentication(NULL, req));
+ req->Dispatch();
+ return false;
+ }
+
+ TemplateFileServer page("login.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/index.h b/modules/extra/webcpanel/pages/index.h
index 2f4d9c400..e67d7181a 100644
--- a/modules/extra/webcpanel/pages/index.h
+++ b/modules/extra/webcpanel/pages/index.h
@@ -15,7 +15,7 @@ class Index : public WebPanelPage
public:
Index(const Anope::string &u) : WebPanelPage(u) { }
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/logout.cpp b/modules/extra/webcpanel/pages/logout.cpp
index 90a6a8a9b..efa93ab4f 100644
--- a/modules/extra/webcpanel/pages/logout.cpp
+++ b/modules/extra/webcpanel/pages/logout.cpp
@@ -11,12 +11,13 @@ WebCPanel::Logout::Logout(const Anope::string &u) : WebPanelProtectedPage("", u)
{
}
-void WebCPanel::Logout::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::Logout::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
na->Shrink("webcpanel_id");
na->Shrink("webcpanel_ip");
reply.error = HTTP_FOUND;
reply.headers["Location"] = "http://" + message.headers["Host"];
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/logout.h b/modules/extra/webcpanel/pages/logout.h
index 4f31e4a00..d00a83733 100644
--- a/modules/extra/webcpanel/pages/logout.h
+++ b/modules/extra/webcpanel/pages/logout.h
@@ -13,7 +13,7 @@ class Logout : public WebPanelProtectedPage
public:
Logout(const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/memoserv/memos.cpp b/modules/extra/webcpanel/pages/memoserv/memos.cpp
index eafbde3a5..00b913ef0 100644
--- a/modules/extra/webcpanel/pages/memoserv/memos.cpp
+++ b/modules/extra/webcpanel/pages/memoserv/memos.cpp
@@ -11,7 +11,7 @@ WebCPanel::MemoServ::Memos::Memos(const Anope::string &cat, const Anope::string
{
}
-void WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
const Anope::string &chname = message.get_data["channel"];
ChannelInfo *ci;
@@ -117,5 +117,6 @@ void WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::st
TemplateFileServer page("memoserv/memos.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/memoserv/memos.h b/modules/extra/webcpanel/pages/memoserv/memos.h
index 00c4c346b..32942147f 100644
--- a/modules/extra/webcpanel/pages/memoserv/memos.h
+++ b/modules/extra/webcpanel/pages/memoserv/memos.h
@@ -16,7 +16,7 @@ class Memos : public WebPanelProtectedPage
public:
Memos(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/nickserv/access.cpp b/modules/extra/webcpanel/pages/nickserv/access.cpp
index c18c5ccb0..40128f47e 100644
--- a/modules/extra/webcpanel/pages/nickserv/access.cpp
+++ b/modules/extra/webcpanel/pages/nickserv/access.cpp
@@ -11,7 +11,7 @@ WebCPanel::NickServ::Access::Access(const Anope::string &cat, const Anope::strin
{
}
-void WebCPanel::NickServ::Access::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::NickServ::Access::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
if (message.post_data.count("access") > 0)
{
@@ -35,5 +35,6 @@ void WebCPanel::NickServ::Access::OnRequest(HTTPProvider *server, const Anope::s
TemplateFileServer page("nickserv/access.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/nickserv/access.h b/modules/extra/webcpanel/pages/nickserv/access.h
index 3f4059aa4..068757877 100644
--- a/modules/extra/webcpanel/pages/nickserv/access.h
+++ b/modules/extra/webcpanel/pages/nickserv/access.h
@@ -16,7 +16,7 @@ class Access : public WebPanelProtectedPage
public:
Access(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/nickserv/alist.cpp b/modules/extra/webcpanel/pages/nickserv/alist.cpp
index d3c92dcf4..2fd184dbb 100644
--- a/modules/extra/webcpanel/pages/nickserv/alist.cpp
+++ b/modules/extra/webcpanel/pages/nickserv/alist.cpp
@@ -11,7 +11,7 @@ WebCPanel::NickServ::Alist::Alist(const Anope::string &cat, const Anope::string
{
}
-void WebCPanel::NickServ::Alist::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::NickServ::Alist::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
int chan_count = 0;
@@ -45,5 +45,6 @@ void WebCPanel::NickServ::Alist::OnRequest(HTTPProvider *server, const Anope::st
TemplateFileServer page("nickserv/alist.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/nickserv/alist.h b/modules/extra/webcpanel/pages/nickserv/alist.h
index 5e4b31724..93ec85d03 100644
--- a/modules/extra/webcpanel/pages/nickserv/alist.h
+++ b/modules/extra/webcpanel/pages/nickserv/alist.h
@@ -16,7 +16,7 @@ class Alist : public WebPanelProtectedPage
public:
Alist(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/nickserv/cert.cpp b/modules/extra/webcpanel/pages/nickserv/cert.cpp
index e354addca..5c799d2f6 100644
--- a/modules/extra/webcpanel/pages/nickserv/cert.cpp
+++ b/modules/extra/webcpanel/pages/nickserv/cert.cpp
@@ -11,7 +11,7 @@ WebCPanel::NickServ::Cert::Cert(const Anope::string &cat, const Anope::string &u
{
}
-void WebCPanel::NickServ::Cert::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::NickServ::Cert::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
if (message.post_data.count("certfp") > 0)
{
@@ -35,5 +35,6 @@ void WebCPanel::NickServ::Cert::OnRequest(HTTPProvider *server, const Anope::str
TemplateFileServer page("nickserv/cert.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/nickserv/cert.h b/modules/extra/webcpanel/pages/nickserv/cert.h
index 1f9f1b4ad..bcc148132 100644
--- a/modules/extra/webcpanel/pages/nickserv/cert.h
+++ b/modules/extra/webcpanel/pages/nickserv/cert.h
@@ -16,7 +16,7 @@ class Cert : public WebPanelProtectedPage
public:
Cert(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/nickserv/info.cpp b/modules/extra/webcpanel/pages/nickserv/info.cpp
index 7ae07ad28..3ec61b03f 100644
--- a/modules/extra/webcpanel/pages/nickserv/info.cpp
+++ b/modules/extra/webcpanel/pages/nickserv/info.cpp
@@ -11,7 +11,7 @@ WebCPanel::NickServ::Info::Info(const Anope::string &cat, const Anope::string &u
{
}
-void WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
if (message.post_data.empty() == false)
{
@@ -107,5 +107,6 @@ void WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str
TemplateFileServer page("nickserv/info.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/nickserv/info.h b/modules/extra/webcpanel/pages/nickserv/info.h
index 05fc981ac..45ffbc882 100644
--- a/modules/extra/webcpanel/pages/nickserv/info.h
+++ b/modules/extra/webcpanel/pages/nickserv/info.h
@@ -16,7 +16,7 @@ class Info : public WebPanelProtectedPage
public:
Info(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/operserv/akill.cpp b/modules/extra/webcpanel/pages/operserv/akill.cpp
index 8a66b8d9b..3d66b5c6a 100644
--- a/modules/extra/webcpanel/pages/operserv/akill.cpp
+++ b/modules/extra/webcpanel/pages/operserv/akill.cpp
@@ -11,7 +11,7 @@ WebCPanel::OperServ::Akill::Akill(const Anope::string &cat, const Anope::string
{
}
-void WebCPanel::OperServ::Akill::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+bool WebCPanel::OperServ::Akill::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
static service_reference<XLineManager> akills("XLineManager","xlinemanager/sgline");
@@ -59,5 +59,6 @@ void WebCPanel::OperServ::Akill::OnRequest(HTTPProvider *server, const Anope::st
TemplateFileServer page("operserv/akill.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/operserv/akill.h b/modules/extra/webcpanel/pages/operserv/akill.h
index 4b5f8f1dd..270ae84a7 100644
--- a/modules/extra/webcpanel/pages/operserv/akill.h
+++ b/modules/extra/webcpanel/pages/operserv/akill.h
@@ -16,7 +16,7 @@ class Akill : public WebPanelProtectedPage
public:
Akill(const Anope::string &cat, const Anope::string &u);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/pages/register.cpp b/modules/extra/webcpanel/pages/register.cpp
index 84efb3fc0..e8ed84303 100644
--- a/modules/extra/webcpanel/pages/register.cpp
+++ b/modules/extra/webcpanel/pages/register.cpp
@@ -7,7 +7,7 @@
#include "../webcpanel.h"
-void WebCPanel::Register::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply)
+bool WebCPanel::Register::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply)
{
TemplateFileServer::Replacements replacements;
@@ -19,5 +19,6 @@ void WebCPanel::Register::OnRequest(HTTPProvider *server, const Anope::string &p
TemplateFileServer page("register.html");
page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
}
diff --git a/modules/extra/webcpanel/pages/register.h b/modules/extra/webcpanel/pages/register.h
index 0651bfba6..deb46c950 100644
--- a/modules/extra/webcpanel/pages/register.h
+++ b/modules/extra/webcpanel/pages/register.h
@@ -15,7 +15,7 @@ class Register : public WebPanelPage
public:
Register(const Anope::string &u) : WebPanelPage(u) { }
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override;
};
}
diff --git a/modules/extra/webcpanel/static_fileserver.cpp b/modules/extra/webcpanel/static_fileserver.cpp
index 6e6d5ccd4..1fbf46ee8 100644
--- a/modules/extra/webcpanel/static_fileserver.cpp
+++ b/modules/extra/webcpanel/static_fileserver.cpp
@@ -17,7 +17,7 @@ StaticFileServer::StaticFileServer(const Anope::string &f_n, const Anope::string
{
}
-void StaticFileServer::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply)
+bool StaticFileServer::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply)
{
int fd = open((template_base + "/" + this->file_name).c_str(), O_RDONLY);
if (fd < 0)
@@ -25,7 +25,7 @@ void StaticFileServer::OnRequest(HTTPProvider *server, const Anope::string &page
Log(LOG_NORMAL, "httpd") << "Error serving file " << page_name << " (" << (template_base + "/" + this->file_name) << "): " << strerror(errno);
client->SendError(HTTP_PAGE_NOT_FOUND, "Page not found");
- return;
+ return true;
}
reply.content_type = this->GetContentType();
@@ -37,5 +37,6 @@ void StaticFileServer::OnRequest(HTTPProvider *server, const Anope::string &page
reply.Write(buffer, i);
close(fd);
+ return true;
}
diff --git a/modules/extra/webcpanel/static_fileserver.h b/modules/extra/webcpanel/static_fileserver.h
index 17fa7d6b2..238614610 100644
--- a/modules/extra/webcpanel/static_fileserver.h
+++ b/modules/extra/webcpanel/static_fileserver.h
@@ -14,6 +14,6 @@ class StaticFileServer : public HTTPPage
public:
StaticFileServer(const Anope::string &f_n, const Anope::string &u, const Anope::string &c_t);
- void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override;
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override;
};
diff --git a/modules/extra/webcpanel/template_fileserver.cpp b/modules/extra/webcpanel/template_fileserver.cpp
index 45dc4dadd..b1881b811 100644
--- a/modules/extra/webcpanel/template_fileserver.cpp
+++ b/modules/extra/webcpanel/template_fileserver.cpp
@@ -239,5 +239,6 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n
}
reply.Write(finished);
+ return;
}
diff --git a/modules/extra/webcpanel/webcpanel.h b/modules/extra/webcpanel/webcpanel.h
index 9573bbb6c..e33025b52 100644
--- a/modules/extra/webcpanel/webcpanel.h
+++ b/modules/extra/webcpanel/webcpanel.h
@@ -66,7 +66,7 @@ class WebPanelPage : public HTTPPage
{
}
- virtual void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
+ virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
};
class WebPanelProtectedPage : public WebPanelPage
@@ -78,14 +78,14 @@ class WebPanelProtectedPage : public WebPanelPage
{
}
- void OnRequest(HTTPProvider *provider, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply) anope_override anope_final
+ bool OnRequest(HTTPProvider *provider, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply) anope_override anope_final
{
service_reference<Panel> panel("Panel", "webcpanel");
NickAlias *na;
if (!panel || !(na = panel->GetNickFromSession(client, message)))
{
- return; // Access denied
+ return true; // Access denied
}
TemplateFileServer::Replacements replacements;
@@ -123,10 +123,10 @@ class WebPanelProtectedPage : public WebPanelPage
}
}
- this->OnRequest(provider, page_name, client, message, reply, na, replacements);
+ return this->OnRequest(provider, page_name, client, message, reply, na, replacements);
}
- virtual void OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) = 0;
+ virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) = 0;
/* What get data should be appended to links in the navbar */
virtual std::set<Anope::string> GetData() { return std::set<Anope::string>(); }
diff --git a/modules/extra/xmlrpc.h b/modules/extra/xmlrpc.h
index baff9b18d..bc3ba893d 100644
--- a/modules/extra/xmlrpc.h
+++ b/modules/extra/xmlrpc.h
@@ -3,7 +3,7 @@ class XMLRPCClientSocket;
class XMLRPCListenSocket;
class XMLRPCServiceInterface;
-class XMLRPCClientSocket : public ClientSocket, public BufferedSocket
+class XMLRPCClientSocket : public ClientSocket, public BufferedSocket, public Base
{
protected:
Anope::string query;