client-common.c revision 04eb0abcf8f8b0c014499b5c5bae89484553613f
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen/* Copyright (c) 2002-2016 Dovecot authors, see the included COPYING file */
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstatic unsigned int clients_count = 0;
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstatic void empty_login_client_allocated_hook(struct client *client ATTR_UNUSED)
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstatic login_client_allocated_func_t *hook_client_allocated =
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainenlogin_client_allocated_hook_set(login_client_allocated_func_t *new_hook)
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen login_client_allocated_func_t *old_hook = hook_client_allocated;
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainenstatic void client_idle_disconnect_timeout(struct client *client)
33c6d5807b449463e9b81db5ec99fe027cc1b984Timo Sirainen unsigned int secs;
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen user_reason = "Timeout while finishing login.";
b7c2065b3f10f9ae27787a9db5aaefbfc70d4502Timo Sirainen "Timeout while finishing login (waited %u secs)", secs);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen "Disconnected for inactivity during authentication.";
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen "Disconnected: Inactivity during authentication";
97c339398f1aba6f315b55a9b6ee6b020e33bea4Timo Sirainen user_reason = "Timeout while finishing login.";
97c339398f1aba6f315b55a9b6ee6b020e33bea4Timo Sirainen "proxy: Logging in to %s:%u timed out "
97c339398f1aba6f315b55a9b6ee6b020e33bea4Timo Sirainen "(state=%u, duration=%us)",
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen client_notify_disconnect(client, CLIENT_DISCONNECT_TIMEOUT, user_reason);
94a78eb438622fa53abef1e1726714dacad4b61cTimo Sirainenstatic void client_open_streams(struct client *client)
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen client->input = i_stream_create_fd(client->fd, LOGIN_MAX_INBUF_SIZE);
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen client->output = o_stream_create_fd(client->fd, LOGIN_MAX_OUTBUF_SIZE);
b7c2065b3f10f9ae27787a9db5aaefbfc70d4502Timo Sirainen o_stream_set_no_error_handling(client->output, TRUE);
0469ed17dafcc56589ce00960a23f4f06817dfb5Timo Sirainen if (iostream_rawlog_create(login_rawlog_dir, &client->input,
const char *const *net;
unsigned int bits;
return FALSE;
return TRUE;
return FALSE;
struct client *
void **other_sets)
return client;
return TRUE;
return FALSE;
void client_destroy_oldest(void)
void clients_destroy_all(void)
int fd_ssl;
int ret;
if (ret > 0) {
unsigned int clients_get_count(void)
return clients_count;
static const struct var_expand_table *
sizeof(login_var_expand_empty_tab));
const char *ssl_state =
const char *ssl_error =
return tab;
char key;
str++;
return TRUE;
return FALSE;
unsigned int i, field_name_len;
return NULL;
field_name_len) == 0 &&
return NULL;
unsigned int pos;
if (have_username_key(*e)) {
T_BEGIN {
} T_END;
T_BEGIN {
} T_END;
T_BEGIN {
} T_END;
return t_strdup_printf(
return t_strdup_printf(
const char *text)
return FALSE;
return FALSE;
return TRUE;
return TRUE;