client-common-auth.c revision 5f5870385cff47efd2f58e7892f251cf13761528
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2002-2012 Dovecot authors, see the included COPYING file */
2767104d81e97a109f0aa9758792bfa1da325a97Timo Sirainen#define PROXY_FAILURE_MSG "Account is temporarily unavailable."
5ce2084ada06ade9f44fc2914c34658e9a842dc1Timo Sirainen#define LOGIN_DNS_CLIENT_SOCKET_PATH "dns-client"
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainen/* If we've been waiting auth server to respond for over this many milliseconds,
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainen send a "waiting" message. */
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainen#define GREETING_WARNING_TIMEOUT_MSECS (10*1000)
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainen if (client->auth_initializing || client->destroyed)
79fcd3f95a6266cc62ceaa753e56dd4456ab7c4bTimo Sirainen client->io = io_add(client->fd, IO_READ, client_input, client);
79fcd3f95a6266cc62ceaa753e56dd4456ab7c4bTimo Sirainenstatic void client_auth_waiting_timeout(struct client *client)
5ce2084ada06ade9f44fc2914c34658e9a842dc1Timo Sirainen client_log_warn(client, "Auth process not responding, "
5ce2084ada06ade9f44fc2914c34658e9a842dc1Timo Sirainen "delayed sending greeting");
2767104d81e97a109f0aa9758792bfa1da325a97Timo Sirainen client_send_line(client, CLIENT_CMD_REPLY_STATUS,
2767104d81e97a109f0aa9758792bfa1da325a97Timo Sirainen AUTH_SERVER_WAITING_MSG : AUTH_MASTER_WAITING_MSG);
5ce2084ada06ade9f44fc2914c34658e9a842dc1Timo Sirainenvoid client_set_auth_waiting(struct client *client)
0011b7d11624ff4d72c1832081285c3edb90c2c3Timo Sirainenstatic void client_auth_parse_args(struct client *client,
2767104d81e97a109f0aa9758792bfa1da325a97Timo Sirainen const char *const *args,
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainen reply_r->proxy_timeout_msecs = 1000*atoi(value);
2cfe9983ce7a6280636ee12beccc2e865111967bTimo Sirainen reply_r->ssl_flags |= PROXY_SSL_FLAG_ANY_CERT;
2767104d81e97a109f0aa9758792bfa1da325a97Timo Sirainen reply_r->port = login_binary->default_ssl_port;
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainen reply_r->ssl_flags |= PROXY_SSL_FLAG_ANY_CERT;
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainen /* already handled in login-common */
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainen i_debug("Ignoring unknown passdb extra field: %s", key);
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainenstatic void proxy_free_password(struct client *client)
d6c5ceea8521b92d10e51a59da00c792f6140b1dTimo Sirainen safe_memset(client->proxy_password, 0, strlen(client->proxy_password));
16834f18f903048c772112838c015051642a0e77Timo Sirainenvoid client_proxy_finish_destroy_client(struct client *client)
if (send_line) {
const char *line;
unsigned int duration;
if (!success)
return FALSE;
return TRUE;
const unsigned char *data;
unsigned int len;
for (i = 0; i < size; i++) {
return i < size;
int ret;
return ret;
switch (sasl_reply) {
data);
const char *init_resp)
return TRUE;
if (pass_sent) {
return FALSE;
void clients_notify_auth_connected(void)