case IMAP_PARSE_ERROR_LITERAL_TOO_BIG:
client_send_reply(&client->common,
IMAP_CMD_REPLY_BYE, msg);
- client_destroy(&client->common,
- t_strconcat("Disconnected: ", msg, NULL));
+ client_destroy(&client->common, msg);
return FALSE;
default:
break;
if (++client->common.bad_counter >= CLIENT_MAX_BAD_COMMANDS) {
client_send_reply(&client->common, IMAP_CMD_REPLY_BYE,
"Too many invalid IMAP commands.");
- client_destroy(&client->common,
- "Disconnected: Too many invalid commands");
+ client_destroy(&client->common, "Too many invalid commands");
return FALSE;
}
client_send_reply(&client->common, IMAP_CMD_REPLY_BAD,
} else if (client->auth_request != NULL) {
user_reason =
"Disconnected for inactivity during authentication.";
- destroy_reason =
- "Disconnected: Inactivity during authentication";
+ destroy_reason = "Inactivity during authentication";
} else if (client->login_proxy != NULL) {
secs = ioloop_time - client->created;
user_reason = "Timeout while finishing login.";
"%s", destroy_reason);
} else {
user_reason = "Disconnected for inactivity.";
- destroy_reason = "Disconnected: Inactivity";
+ destroy_reason = "Inactivity";
}
client_notify_disconnect(client, CLIENT_DISCONNECT_TIMEOUT, user_reason);
client_destroy(client, destroy_reason);
login_refresh_proctitle();
}
-void client_disconnect(struct client *client, const char *reason)
+void client_disconnect(struct client *client, const char *reason,
+ bool add_disconnected_prefix)
{
if (client->disconnected)
return;
struct event *event = client->login_proxy == NULL ?
client->event :
login_proxy_get_event(client->login_proxy);
- e_info(event, "%s", reason);
+ if (add_disconnected_prefix)
+ e_info(event, "Disconnected: %s", reason);
+ else
+ e_info(event, "%s", reason);
}
if (client->output != NULL)
client_fd_proxies. */
DLLIST_REMOVE(&clients, client);
- client_disconnect(client, reason);
+ client_disconnect(client, reason, !client->login_success);
pool_unref(&client->preproxy_pool);
client_notify_disconnect(client, CLIENT_DISCONNECT_RESOURCE_CONSTRAINT,
"Connection queue full");
- client_destroy(client, "Disconnected: Connection queue full");
+ client_destroy(client, "Connection queue full");
}
void clients_destroy_all_reason(const char *reason)
void clients_destroy_all(void)
{
- clients_destroy_all_reason("Disconnected: Shutting down");
+ clients_destroy_all_reason("Shutting down");
}
static int client_sni_callback(const char *name, const char **error_r,
client_notify_disconnect(client,
CLIENT_DISCONNECT_INTERNAL_ERROR,
"TLS initialization failed.");
- client_destroy(client,
- "Disconnected: TLS initialization failed.");
+ client_destroy(client, "TLS initialization failed.");
return;
}
login_refresh_proctitle();
client_notify_disconnect(client,
CLIENT_DISCONNECT_RESOURCE_CONSTRAINT,
"Input buffer full, aborting");
- client_destroy(client, "Disconnected: Input buffer full");
+ client_destroy(client, "Input buffer full");
return FALSE;
case -1:
/* disconnected */
const struct login_settings *set,
const struct master_service_ssl_settings *ssl_set);
void client_init(struct client *client, void **other_sets);
-void client_disconnect(struct client *client, const char *reason);
+void client_disconnect(struct client *client, const char *reason,
+ bool add_disconnected_prefix);
void client_destroy(struct client *client, const char *reason);
/* Destroy the client after a successful login. Either the client fd was
sent to the post-login process, or the connection will be proxied. */
next = proxy->next;
if (want_kick(proxy, args, key_idx)) {
- client_destroy(proxy->client, KILLED_BY_ADMIN_REASON);
+ client_disconnect(proxy->client, KILLED_BY_ADMIN_REASON, FALSE);
+ client_destroy(proxy->client, NULL);
count++;
}
} T_END;
if (director_username_hash(proxy->client, &proxy_hash) &&
proxy_hash == hash &&
!net_ip_compare(&proxy->ip, &except_ip)) {
- client_destroy(proxy->client, KILLED_BY_DIRECTOR_REASON);
+ client_disconnect(proxy->client, KILLED_BY_DIRECTOR_REASON, FALSE);
+ client_destroy(proxy->client, NULL);
count++;
}
}