Commit 9ff5100e 9ff5100ee7a0dc548d7c18256dac872352a3612c by Wojciech Polak

(imap4d_starttls): Terminate the session after receiving an illegal TLS

packet.
1 parent ddba8599
...@@ -34,6 +34,8 @@ imap4d_starttls (struct imap4d_command *command, char *arg) ...@@ -34,6 +34,8 @@ imap4d_starttls (struct imap4d_command *command, char *arg)
34 if (util_getword (arg, &sp)) 34 if (util_getword (arg, &sp))
35 return util_finish (command, RESP_BAD, "Too many args"); 35 return util_finish (command, RESP_BAD, "Too many args");
36 36
37 util_atexit (mu_deinit_tls_libs);
38
37 status = util_finish (command, RESP_OK, "Begin TLS negotiation"); 39 status = util_finish (command, RESP_OK, "Begin TLS negotiation");
38 util_flush_output (); 40 util_flush_output ();
39 tls_done = imap4d_init_tls_server (); 41 tls_done = imap4d_init_tls_server ();
...@@ -43,8 +45,14 @@ imap4d_starttls (struct imap4d_command *command, char *arg) ...@@ -43,8 +45,14 @@ imap4d_starttls (struct imap4d_command *command, char *arg)
43 imap4d_capability_remove ("STARTTLS"); 45 imap4d_capability_remove ("STARTTLS");
44 login_disabled = 0; 46 login_disabled = 0;
45 imap4d_capability_remove ("LOGINDISABLED"); 47 imap4d_capability_remove ("LOGINDISABLED");
46 util_atexit (mu_deinit_tls_libs);
47 } 48 }
49 else
50 {
51 syslog (LOG_ERR, _("Session terminated"));
52 util_bye ();
53 exit (0);
54 }
55
48 return status; 56 return status;
49 } 57 }
50 58
......