diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-03-20 16:08:58 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-03-20 16:11:06 +0200 |
commit | 1da223b05d0b851d6cb025af3d58f70e1c533d0a (patch) | |
tree | 9baf0bbaa368ec2875555d0895226fcdd92b94a0 | |
parent | a6ed2f92b4e7cd21cd1634f1ee4443f40b12a68b (diff) | |
download | mailutils-1da223b05d0b851d6cb025af3d58f70e1c533d0a.tar.gz mailutils-1da223b05d0b851d6cb025af3d58f70e1c533d0a.tar.bz2 |
Fix pop3d command parser (complement afda9ba4)
* pop3d/cmd.c (command_table_head): Remove. Use command_table
instead. All uses changed.
* pop3d/stls.c (pop3d_stls): Fail if TLS is not requested.
-rw-r--r-- | pop3d/cmd.c | 11 | ||||
-rw-r--r-- | pop3d/stls.c | 3 |
2 files changed, 4 insertions, 10 deletions
diff --git a/pop3d/cmd.c b/pop3d/cmd.c index 5983e0bb7..dcd81501e 100644 --- a/pop3d/cmd.c +++ b/pop3d/cmd.c @@ -20,8 +20,6 @@ struct mu_tls_config global_tls_conf; static struct pop3d_command command_table[] = { { "STLS", pop3d_stls }, -#define COMMAND_TABLE_STLS 0 -#define COMMAND_TABLE_PLAIN 1 { "RETR", pop3d_retr }, { "DELE", pop3d_dele }, { "USER", pop3d_user }, @@ -38,13 +36,11 @@ static struct pop3d_command command_table[] = { { NULL } }; -static struct pop3d_command *command_table_head; - pop3d_command_handler_t pop3d_find_command (const char *name) { struct pop3d_command *p; - for (p = command_table_head; p->name; p++) + for (p = command_table; p->name; p++) { if (mu_c_strcasecmp (name, p->name) == 0) return p->handler; @@ -137,11 +133,6 @@ stls_preflight (mu_m_server_t msrv) if (errors) return 1; - if (tls_requested) - command_table_head = command_table + COMMAND_TABLE_STLS; - else - command_table_head = command_table + COMMAND_TABLE_PLAIN; - return 0; } diff --git a/pop3d/stls.c b/pop3d/stls.c index b83dcb6bb..576db3857 100644 --- a/pop3d/stls.c +++ b/pop3d/stls.c @@ -22,6 +22,9 @@ int pop3d_stls (char *arg, struct pop3d_session *session) { + if (session->tls_mode == tls_no) + return ERR_BAD_CMD; + if (strlen (arg) != 0) return ERR_BAD_ARGS; |