#include "login-common.h"
#include "str.h"
+#include "str-sanitize.h"
#include "imap-parser.h"
#include "imap-quote.h"
#include "imap-login-settings.h"
str_len(client->cmd_id->log_reply) > 0) {
e_debug(client->cmd_id->params_event,
"Pre-login ID sent: %s",
- str_c(client->cmd_id->log_reply));
+ str_sanitize(str_c(client->cmd_id->log_reply),
+ IMAP_ID_PARAMS_LOG_MAX_LEN));
}
}
#include "imap-common.h"
#include "imap-id.h"
#include "str.h"
+#include "str-sanitize.h"
static void
cmd_id_log_params(const struct imap_arg *args, struct event *event,
string_t *log_reply = str_new(default_pool, 64);
cmd_id_log_params(args, event, log_reply);
if (str_len(log_reply) > 0)
- e_debug(event, "ID sent: %s", str_c(log_reply)));
+ e_debug(event, "ID sent: %s",
+ str_sanitize(str_c(log_reply),
+ IMAP_ID_PARAMS_LOG_MAX_LEN));
event_unref(&event);
str_free(&log_reply);
}
/* RFC 2971 says keys are max. 30 octets */
#define IMAP_ID_KEY_MAX_LEN 30
+/* Truncate excessively large IMAP ID parameters in log lines. */
+#define IMAP_ID_PARAMS_LOG_MAX_LEN 1024
/* Return ID reply based on given settings. */
const char *imap_id_reply_generate(const char *settings);