aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2019-08-09 04:33:27 +0100
committerGravatar Sadie Powell2019-08-09 04:33:27 +0100
commitf90feb3d87b1c34ef90143d5073773e082e266c4 (patch)
tree48c8c8ddea0558b605b81a54a33245580f481f61 /src
parentRemove remnants of the old ExtensionItem serialisation system. (diff)
downloadinspircd++-f90feb3d87b1c34ef90143d5073773e082e266c4.tar.gz
inspircd++-f90feb3d87b1c34ef90143d5073773e082e266c4.tar.bz2
inspircd++-f90feb3d87b1c34ef90143d5073773e082e266c4.zip
Redelete the flashpolicyd module which snuck back in during a merge.
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_flashpolicyd.cpp162
1 files changed, 0 insertions, 162 deletions
diff --git a/src/modules/m_flashpolicyd.cpp b/src/modules/m_flashpolicyd.cpp
deleted file mode 100644
index 30f4fbd03..000000000
--- a/src/modules/m_flashpolicyd.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- * Copyright (C) 2013 Daniel Vassdal <shutter@canternet.org>
- *
- * This file is part of InspIRCd. InspIRCd is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "inspircd.h"
-
-class FlashPDSocket;
-
-namespace
-{
- insp::intrusive_list<FlashPDSocket> sockets;
- std::string policy_reply;
- const std::string expected_request("<policy-file-request/>\0", 23);
-}
-
-class FlashPDSocket : public BufferedSocket, public Timer, public insp::intrusive_list_node<FlashPDSocket>
-{
- /** True if this object is in the cull list
- */
- bool waitingcull;
-
- bool Tick(time_t currtime) override
- {
- AddToCull();
- return false;
- }
-
- public:
- FlashPDSocket(int newfd, unsigned int timeoutsec)
- : BufferedSocket(newfd)
- , Timer(timeoutsec)
- , waitingcull(false)
- {
- ServerInstance->Timers.AddTimer(this);
- }
-
- ~FlashPDSocket()
- {
- sockets.erase(this);
- }
-
- void OnError(BufferedSocketError) override
- {
- AddToCull();
- }
-
- void OnDataReady() override
- {
- if (recvq == expected_request)
- WriteData(policy_reply);
- AddToCull();
- }
-
- void AddToCull()
- {
- if (waitingcull)
- return;
-
- waitingcull = true;
- Close();
- ServerInstance->GlobalCulls.AddItem(this);
- }
-};
-
-class ModuleFlashPD : public Module
-{
- unsigned int timeout;
-
- public:
- ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) override
- {
- if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "flashpolicyd"))
- return MOD_RES_PASSTHRU;
-
- if (policy_reply.empty())
- return MOD_RES_DENY;
-
- sockets.push_front(new FlashPDSocket(nfd, timeout));
- return MOD_RES_ALLOW;
- }
-
- void ReadConfig(ConfigStatus& status) override
- {
- ConfigTag* tag = ServerInstance->Config->ConfValue("flashpolicyd");
- std::string file = tag->getString("file");
-
- if (!file.empty())
- {
- try
- {
- FileReader reader(file);
- policy_reply = reader.GetString();
- }
- catch (CoreException&)
- {
- throw ModuleException("A file was specified for FlashPD, but it could not be loaded at " + tag->getTagLocation());
- }
- return;
- }
-
- // A file was not specified. Set the default setting.
- // We allow access to all client ports by default
- std::string to_ports;
- for (std::vector<ListenSocket*>::const_iterator i = ServerInstance->ports.begin(); i != ServerInstance->ports.end(); ++i)
- {
- ListenSocket* ls = *i;
- if (!stdalgo::string::equalsci(ls->bind_tag->getString("type", "clients"), "clients") || !ls->bind_tag->getString("ssl").empty())
- continue;
-
- to_ports.append(ConvToStr(ls->bind_sa.port())).push_back(',');
- }
-
- if (to_ports.empty())
- {
- policy_reply.clear();
- return;
- }
-
- to_ports.erase(to_ports.size() - 1);
-
- policy_reply =
-"<?xml version=\"1.0\"?>\
-<!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\">\
-<cross-domain-policy>\
-<site-control permitted-cross-domain-policies=\"master-only\"/>\
-<allow-access-from domain=\"*\" to-ports=\"" + to_ports + "\" />\
-</cross-domain-policy>";
- timeout = tag->getDuration("timeout", 5, 1);
- }
-
- CullResult cull() override
- {
- for (insp::intrusive_list<FlashPDSocket>::const_iterator i = sockets.begin(); i != sockets.end(); ++i)
- {
- FlashPDSocket* sock = *i;
- sock->AddToCull();
- }
- return Module::cull();
- }
-
- Version GetVersion() override
- {
- return Version("Flash Policy Daemon, allows Flash IRC clients to connect", VF_VENDOR);
- }
-};
-
-MODULE_INIT(ModuleFlashPD)