X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_starttls.cpp;h=80e2bb006060b69a020aaa5e1b75531ed03d889e;hb=0a329440bd1d0fa642ce2f3e14bc88125377b5bd;hp=09c9b4f0fff1b07a33a8949933ecda9fb8d6e96d;hpb=ec1e85cb3dbe7c733faa7dbd850459a41b7e5144;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_starttls.cpp b/src/modules/m_starttls.cpp index 09c9b4f0f..80e2bb006 100644 --- a/src/modules/m_starttls.cpp +++ b/src/modules/m_starttls.cpp @@ -1,7 +1,11 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2020 Matt Schatz + * Copyright (C) 2019 Robby + * Copyright (C) 2018 Sadie Powell * Copyright (C) 2014 Adam + * Copyright (C) 2013, 2015-2016 Attila Molnar * * 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 @@ -30,39 +34,39 @@ enum class CommandStartTLS : public SplitCommand { - dynamic_reference_nocheck& ssl; + dynamic_reference_nocheck& ssl; public: - CommandStartTLS(Module* mod, dynamic_reference_nocheck& s) + CommandStartTLS(Module* mod, dynamic_reference_nocheck& s) : SplitCommand(mod, "STARTTLS") , ssl(s) { works_before_reg = true; } - CmdResult HandleLocal(const std::vector& parameters, LocalUser* user) + CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE { if (!ssl) { - user->WriteNumeric(ERR_STARTTLS, ":STARTTLS is not enabled"); + user->WriteNumeric(ERR_STARTTLS, "STARTTLS is not enabled"); return CMD_FAILURE; } if (user->registered == REG_ALL) { - user->WriteNumeric(ERR_STARTTLS, ":STARTTLS is not permitted after client registration is complete"); + user->WriteNumeric(ERR_STARTTLS, "STARTTLS is not permitted after client registration is complete"); return CMD_FAILURE; } if (user->eh.GetIOHook()) { - user->WriteNumeric(ERR_STARTTLS, ":STARTTLS failure"); + user->WriteNumeric(ERR_STARTTLS, "STARTTLS failure"); return CMD_FAILURE; } - user->WriteNumeric(RPL_STARTTLS, ":STARTTLS successful, go ahead with TLS handshake"); + user->WriteNumeric(RPL_STARTTLS, "STARTTLS successful, go ahead with TLS handshake"); /* We need to flush the write buffer prior to adding the IOHook, - * otherwise we'll be sending this line inside the SSL session - which + * otherwise we'll be sending this line inside the TLS (SSL) session - which * won't start its handshake until the client gets this line. Currently, * we assume the write will not block here; this is usually safe, as * STARTTLS is sent very early on in the registration phase, where the @@ -71,8 +75,7 @@ class CommandStartTLS : public SplitCommand */ user->eh.DoWrite(); - user->eh.AddIOHook(*ssl); - ssl->OnStreamSocketAccept(&user->eh, NULL, NULL); + ssl->OnAccept(&user->eh, NULL, NULL); return CMD_SUCCESS; } @@ -81,8 +84,8 @@ class CommandStartTLS : public SplitCommand class ModuleStartTLS : public Module { CommandStartTLS starttls; - GenericCap tls; - dynamic_reference_nocheck ssl; + Cap::Capability tls; + dynamic_reference_nocheck ssl; public: ModuleStartTLS() @@ -103,19 +106,9 @@ class ModuleStartTLS : public Module ssl.SetProvider("ssl/" + newprovider); } - void OnEvent(Event& ev) CXX11_OVERRIDE - { - tls.HandleEvent(ev); - } - - void On005Numeric(std::map& tokens) CXX11_OVERRIDE - { - tokens["STARTTLS"]; - } - Version GetVersion() CXX11_OVERRIDE { - return Version("Provides support for the STARTTLS command", VF_VENDOR); + return Version("Provides the IRCv3 tls client capability.", VF_VENDOR); } };