root/nntp/starttls.cc

Revision 868b365c127bbf4f0b52f22da03e32a94a4f6653, 2.0 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 3 years ago)

Update the project blurb

Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>

  • Property mode set to 100644
Line 
1/*  This file is part of Alue, the multiprotocol Internet discussion daemon
2
3    Copyright © 2009 Antti-Juhani Kaijanaho
4
5    Alue is free software: you can redistribute it and/or modify it
6    under the terms of the GNU General Public License as published by
7    the Free Software Foundation, either version 3 of the License, or
8    (at your option) any later version.
9
10    Alue is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with Alue.  If not, see <http://www.gnu.org/licenses/>.
17
18 */
19
20#include "connection.hh"
21
22namespace nntp {
23
24        class starttls : public connection::command
25        {
26        public:
27                starttls(std::string s) {
28                        connection::register_command(s, this);
29                }
30
31                connection::continuation::ptr
32                perform(connection::cb, const std::string [],  size_t) const;
33
34                void write_capability_line(connection::cb c) const {
35                        if (c.tls_active()) return;
36                        c.send_line("STARTTLS");
37                }
38        };
39
40
41        connection::continuation::ptr
42        starttls::perform(connection::cb c, const std::string[], size_t nargs)
43                const
44        {
45                if (nargs != 0)
46                {
47                        c.send_line("501 syntax error");
48                        return c.dispatch();
49                }
50                if (c.tls_active())
51                {
52                        c.send_line("502 not permitted in this state");
53                        return c.dispatch();
54                }
55                c.send_line("382 start TLS negotation");
56                return c.starttls();
57        }
58
59};
60namespace {
61        nntp::starttls starttls("starttls");
62}
Note: See TracBrowser for help on using the browser.