dovecot-2.1: imap/pop3-login: Include hostname and timestamp in ...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jan 10 23:10:10 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/81fa0597b8b6
changeset: 13925:81fa0597b8b6
user: Timo Sirainen <tss at iki.fi>
date: Tue Jan 10 23:10:04 2012 +0200
description:
imap/pop3-login: Include hostname and timestamp in "temporary auth failure" message.
diffstat:
src/imap-login/client-authenticate.c | 38 ++++++++++++++++++------------------
src/pop3-login/client-authenticate.c | 10 +++++++-
2 files changed, 27 insertions(+), 21 deletions(-)
diffs (110 lines):
diff -r d4c506d8f534 -r 81fa0597b8b6 src/imap-login/client-authenticate.c
--- a/src/imap-login/client-authenticate.c Tue Jan 10 22:57:09 2012 +0200
+++ b/src/imap-login/client-authenticate.c Tue Jan 10 23:10:04 2012 +0200
@@ -3,12 +3,14 @@
#include "login-common.h"
#include "base64.h"
#include "buffer.h"
+#include "hostpid.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "safe-memset.h"
#include "str.h"
#include "str-sanitize.h"
+#include "time-util.h"
#include "imap-resp-code.h"
#include "imap-parser.h"
#include "auth-client.h"
@@ -36,6 +38,7 @@
{
struct imap_client *imap_client = (struct imap_client *)client;
string_t *str;
+ const char *timestamp, *msg;
if (reply->host != NULL) {
/* IMAP referral
@@ -71,27 +74,24 @@
client_destroy_success(client, "Login with referral");
return TRUE;
}
- } else if (reply->nologin) {
- /* Authentication went ok, but for some reason user isn't
- allowed to log in. Shouldn't probably happen. */
- if (reply->reason != NULL) {
- client_send_line(client,
- CLIENT_CMD_REPLY_AUTH_FAIL_REASON,
- reply->reason);
- } else if (reply->temp) {
- client_send_line(client,
- CLIENT_CMD_REPLY_AUTH_FAIL_TEMP,
- AUTH_TEMP_FAILED_MSG);
- } else if (reply->authz_failure) {
- client_send_line(client, CLIENT_CMD_REPLY_AUTHZ_FAILED,
- "Authorization failed");
- } else {
- client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED,
- AUTH_FAILED_MSG);
- }
- } else {
+ } else if (!reply->nologin) {
/* normal login/failure */
return FALSE;
+ } else if (reply->reason != NULL) {
+ client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAIL_REASON,
+ reply->reason);
+ } else if (reply->temp) {
+ timestamp = t_strflocaltime("%Y-%m-%d %H:%M:%S", ioloop_time);
+ msg = t_strdup_printf(AUTH_TEMP_FAILED_MSG" [%s:%s]",
+ my_hostname, timestamp);
+ client_send_line(client,
+ CLIENT_CMD_REPLY_AUTH_FAIL_TEMP, msg);
+ } else if (reply->authz_failure) {
+ client_send_line(client, CLIENT_CMD_REPLY_AUTHZ_FAILED,
+ "Authorization failed");
+ } else {
+ client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED,
+ AUTH_FAILED_MSG);
}
i_assert(reply->nologin);
diff -r d4c506d8f534 -r 81fa0597b8b6 src/pop3-login/client-authenticate.c
--- a/src/pop3-login/client-authenticate.c Tue Jan 10 22:57:09 2012 +0200
+++ b/src/pop3-login/client-authenticate.c Tue Jan 10 23:10:04 2012 +0200
@@ -4,12 +4,14 @@
#include "base64.h"
#include "buffer.h"
#include "hex-binary.h"
+#include "hostpid.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "safe-memset.h"
#include "str.h"
#include "str-sanitize.h"
+#include "time-util.h"
#include "auth-client.h"
#include "../pop3/pop3-capability.h"
#include "ssl-proxy.h"
@@ -52,6 +54,8 @@
bool pop3_client_auth_handle_reply(struct client *client,
const struct client_auth_reply *reply)
{
+ const char *timestamp, *msg;
+
if (!reply->nologin)
return FALSE;
@@ -59,8 +63,10 @@
client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED,
reply->reason);
} else if (reply->temp) {
- client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAIL_TEMP,
- AUTH_TEMP_FAILED_MSG);
+ timestamp = t_strflocaltime("%Y-%m-%d %H:%M:%S", ioloop_time);
+ msg = t_strdup_printf(AUTH_TEMP_FAILED_MSG" [%s:%s]",
+ my_hostname, timestamp);
+ client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAIL_TEMP, msg);
} else {
client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED,
AUTH_FAILED_MSG);
More information about the dovecot-cvs
mailing list