Commit 988d0462 988d04621acd47fbf7fb48134a827f72dff3260e by Wojciech Polak

Added support for ERR_TLS_ACTIVE.

1 parent 2364f404
...@@ -377,6 +377,10 @@ pop3d_mainloop (int fd, FILE *infile, FILE *outfile) ...@@ -377,6 +377,10 @@ pop3d_mainloop (int fd, FILE *infile, FILE *outfile)
377 pop3d_outf ("-ERR " TOO_LONG "\r\n"); 377 pop3d_outf ("-ERR " TOO_LONG "\r\n");
378 else if (status == ERR_FILE) 378 else if (status == ERR_FILE)
379 pop3d_outf ("-ERR " FILE_EXP "\r\n"); 379 pop3d_outf ("-ERR " FILE_EXP "\r\n");
380 #ifdef WITH_TLS
381 else if (status == ERR_TLS_ACTIVE)
382 pop3d_outf ("-ERR " TLS_ACTIVE "\r\n");
383 #endif /* WITH_TLS */
380 else 384 else
381 pop3d_outf ("-ERR unknown error\r\n"); 385 pop3d_outf ("-ERR unknown error\r\n");
382 386
......
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
59 /* An error occured when expunging. */ 59 /* An error occured when expunging. */
60 #define FILE_EXP "Some deleted messages not removed" 60 #define FILE_EXP "Some deleted messages not removed"
61 61
62 /* Command not permitted when TLS active. */
63 #define TLS_ACTIVE "Command not permitted when TLS active"
64
62 /* APOP password file, without .db or .passwd, which are added based on file 65 /* APOP password file, without .db or .passwd, which are added based on file
63 type automatically */ 66 type automatically */
64 #define APOP_PASSFILE_NAME "apop" 67 #define APOP_PASSFILE_NAME "apop"
...@@ -167,6 +170,7 @@ ...@@ -167,6 +170,7 @@
167 #define ERR_TIMEOUT 14 170 #define ERR_TIMEOUT 14
168 #define ERR_UNKNOWN 15 171 #define ERR_UNKNOWN 15
169 #define ERR_MBOX_SYNC 16 172 #define ERR_MBOX_SYNC 16
173 #define ERR_TLS_ACTIVE 17
170 174
171 extern mailbox_t mbox; 175 extern mailbox_t mbox;
172 extern int state; 176 extern int state;
......
...@@ -30,6 +30,9 @@ pop3d_stls (const char *arg) ...@@ -30,6 +30,9 @@ pop3d_stls (const char *arg)
30 if (state != AUTHORIZATION) 30 if (state != AUTHORIZATION)
31 return ERR_WRONG_STATE; 31 return ERR_WRONG_STATE;
32 32
33 if (tls_done)
34 return ERR_TLS_ACTIVE;
35
33 pop3d_outf ("+OK Begin TLS negotiation\r\n"); 36 pop3d_outf ("+OK Begin TLS negotiation\r\n");
34 pop3d_flush_output (); 37 pop3d_flush_output ();
35 38
......