reason = t_strdup_printf("%s (unfinished %s command)",
reason, cmd->reg->name);
}
+ if (!conn->set.no_state_in_reason) {
+ reason = t_strdup_printf("%s (state=%s)", reason,
+ smtp_server_state_names[conn->state.state]);
+ }
e_debug(conn->event, "Disconnected: %s", reason);
conn->disconnect_reason = i_strdup(reason);
server->set.rcpt_domain_optional = set->rcpt_domain_optional;
server->set.mail_path_allow_broken = set->mail_path_allow_broken;
server->set.debug = set->debug;
+ server->set.no_state_in_reason = set->no_state_in_reason;
/* There is no event log prefix added here, since the server itself does
not log anything. */
/* The path provided to the RCPT command does not need to have the
domain part. */
bool rcpt_domain_optional:1;
+ /* Don't include "(state=%s)" in the disconnection reason string. */
+ bool no_state_in_reason:1;
};
struct smtp_server_stats {
if (reason == NULL)
reason = "Connection closed";
- e_info(client->event, "Disconnect from %s: %s (state=%s)",
- client_remote_id(client), reason,
- smtp_server_state_names[client->state.state]);
+ e_info(client->event, "Disconnect from %s: %s",
+ client_remote_id(client), reason);
if (conn != NULL) {
smtp_server_connection_terminate(
smtp_server_set.protocol = SMTP_PROTOCOL_SMTP;
smtp_server_set.max_pipelined_commands = 5;
smtp_server_set.max_bad_commands = CLIENT_MAX_BAD_COMMANDS;
+ /* Pre-auth state is always logged either as GREETING or READY.
+ It's not very useful. */
+ smtp_server_set.no_state_in_reason = TRUE;
smtp_server = smtp_server_init(&smtp_server_set);
}
log_reason = reason = "Connection closed";
else
log_reason = t_str_oneline(reason);
- i_info("Disconnect from %s: %s %s (state=%s)",
+ i_info("Disconnect from %s: %s %s",
client_remote_id(client),
- log_reason, client_stats(client),
- smtp_server_state_names[client->state.state]);
+ log_reason, client_stats(client));
conn = client->conn;
client->conn = NULL;