client.c revision 61e87c7e1e53a1fdd3680c7b1addd187282e1327
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen/* Copyright (C) 2002 Timo Sirainen */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen/* max. length of input command line (spec says 512), or max reply length in
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen SASL authentication */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen/* max. size of output buffer. if it gets full, the client is disconnected.
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen SASL authentication gives the largest output. */
e5fb952c6d49d3b6bff1746551566202e92947daTimo Sirainen/* Disconnect client after idling this many seconds */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen/* Disconnect client when it sends too many bad commands */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen/* When max. number of simultaneous connections is reached, few of the
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen oldest connections are disconnected. Since we have to go through the whole
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen client hash, it's faster if we disconnect multiple clients. */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen#if CLIENT_LOGIN_IDLE_TIMEOUT >= AUTH_REQUEST_TIMEOUT
4b2a4c8c762e3eaddf7fd2abfe7d4cca6e5e3fd8Timo Sirainen# error client idle timeout must be smaller than authentication timeout
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenstatic void client_set_title(struct pop3_client *client)
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen if (!verbose_proctitle || !process_per_connection)
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen process_title_set(t_strdup_printf(client->common.tls ?
int fd_ssl;
int ret;
if (ret > 0) {
return TRUE;
if (!ssl_initialized) {
return TRUE;
return TRUE;
return TRUE;
const char *args)
return FALSE;
return FALSE;
return FALSE;
return TRUE;
static void client_destroy_oldest(void)
unsigned int i, destroy_count;
for (i = 0; i < destroy_count; i++) {
sizeof(destroy_buf) -
for (i = 0; i < destroy_count; i++) {
char *ret;
return NULL;
t_push();
(unsigned long)ioloop_time,
t_pop();
return ret;
unsigned int current_count;
if (!process_per_connection) {
main_ref();
return TRUE;
main_unref();
return FALSE;
unsigned int clients_get_count(void)
void clients_notify_auth_connected(void)
void clients_destroy_all(void)
void clients_init(void)
void clients_deinit(void)