Mercurial > dovecot > core-2.2
changeset 21724:dce69a67f3b2
pop3-login: Log proxy state as human-readable string.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 09 Mar 2017 10:46:36 -0500 |
parents | de665befcc92 |
children | 685240c1a19b |
files | src/pop3-login/client.c src/pop3-login/client.h src/pop3-login/pop3-proxy.c src/pop3-login/pop3-proxy.h |
diffstat | 4 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pop3-login/client.c Thu Mar 09 10:41:52 2017 -0500 +++ b/src/pop3-login/client.c Thu Mar 09 10:46:36 2017 -0500 @@ -312,7 +312,7 @@ pop3_proxy_reset, pop3_proxy_parse_line, pop3_proxy_error, - NULL, + pop3_proxy_get_state, }; static const struct login_binary pop3_login_binary = {
--- a/src/pop3-login/client.h Thu Mar 09 10:41:52 2017 -0500 +++ b/src/pop3-login/client.h Thu Mar 09 10:46:36 2017 -0500 @@ -10,7 +10,9 @@ POP3_PROXY_STARTTLS, POP3_PROXY_XCLIENT, POP3_PROXY_LOGIN1, - POP3_PROXY_LOGIN2 + POP3_PROXY_LOGIN2, + + POP3_PROXY_STATE_COUNT }; struct pop3_client {
--- a/src/pop3-login/pop3-proxy.c Thu Mar 09 10:41:52 2017 -0500 +++ b/src/pop3-login/pop3-proxy.c Thu Mar 09 10:46:36 2017 -0500 @@ -12,6 +12,10 @@ #include "client.h" #include "pop3-proxy.h" +static const char *pop3_proxy_state_names[POP3_PROXY_STATE_COUNT] = { + "banner", "starttls", "xclient", "login1", "login2" +}; + static void proxy_free_password(struct client *client) { if (client->proxy_password == NULL) @@ -216,6 +220,8 @@ client_proxy_finish_destroy_client(client); return 1; + case POP3_PROXY_STATE_COUNT: + i_unreached(); } /* Login failed. Pass through the error message to client. @@ -259,3 +265,8 @@ { client_send_reply(client, POP3_CMD_REPLY_ERROR, text); } + +const char *pop3_proxy_get_state(struct client *client) +{ + return pop3_proxy_state_names[client->proxy_state]; +}
--- a/src/pop3-login/pop3-proxy.h Thu Mar 09 10:41:52 2017 -0500 +++ b/src/pop3-login/pop3-proxy.h Thu Mar 09 10:46:36 2017 -0500 @@ -5,5 +5,6 @@ int pop3_proxy_parse_line(struct client *client, const char *line); void pop3_proxy_error(struct client *client, const char *text); +const char *pop3_proxy_get_state(struct client *client); #endif