client-common-auth.c revision 53dfcefa9440a49d703e49193819a79be99c9ba6
/* Copyright (c) 2002-2009 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "istream.h"
#include "ostream.h"
#include "str.h"
#include "safe-memset.h"
#include "login-proxy.h"
#include "auth-client.h"
#include "client-common.h"
#include <stdlib.h>
#define PROXY_FAILURE_MSG "Account is temporarily unavailable."
/* If we've been waiting auth server to respond for over this many milliseconds,
send a "waiting" message. */
#define AUTH_FAILURE_DELAY_INCREASE_MSECS 5000
#endif
{
/* get back to normal client input. */
}
{
unsigned int delay_msecs;
if (client->auth_initializing)
return;
if (nodelay) {
return;
}
/* increase the timeout after each unsuccessful attempt, but don't
increase it so high that the idle timeout would be triggered */
}
{
client->master_tag == 0 ?
}
{
}
const char *const *args,
struct client_auth_reply *reply_r)
{
if (p == NULL) {
value = "";
} else {
value = p + 1;
}
}
/* already handled in login-common */
}
}
{
return;
}
{
/* remote username is different, log it */
}
}
{
/* remote username is different, log it */
}
}
{
if (send_line) {
}
/* call this last - it may destroy the client */
}
{
const char *line;
/* we're just freeing the proxy */
return;
}
/* we came here from client_destroy() */
return;
}
/* failed for some reason, probably server disconnected */
return;
}
switch (i_stream_read(input)) {
case -2:
return;
case -1:
return;
}
break;
}
}
const struct client_auth_reply *reply)
{
struct login_proxy_settings proxy_set;
return -1;
}
/* connection_queue_add() decided that we were the oldest
connection and killed us. */
return -1;
}
return -1;
}
return -1;
}
/* disable input until authentication is finished */
return 0;
}
static bool
{
/* we want to proxy the connection to another server.
don't do this unless authentication succeeded. with
master user proxying we can get FAIL with proxy still set.
proxy host=.. [port=..] [destuser=..] pass=.. */
if (!success)
return FALSE;
return TRUE;
}
}
{
char *line;
if (!client_read(client))
return;
/* @UNSAFE */
return;
else {
/* clear sensitive data */
}
}
{
}
static void
{
struct client_auth_reply reply;
switch (sasl_reply) {
break;
}
break;
break;
}
if (sasl_reply == SASL_SERVER_REPLY_AUTH_ABORTED) {
"Authentication aborted by client.");
} else {
data);
}
break;
else {
/* authentication itself succeeded, we just hit some
internal failure. */
}
break;
return;
}
}
const char *init_resp)
{
"SSL required for authentication");
}
client->auth_attempts++;
return 1;
}
if (!client->authenticating)
return 1;
/* don't handle input until we get the initial auth reply */
return 0;
}
{
return TRUE;
"Plaintext authentication disabled");
}
if (pass_sent) {
"Plaintext authentication not allowed "
"If anyone was listening, the password was exposed.");
}
client->auth_attempts++;
return FALSE;
}
void clients_notify_auth_connected(void)
{
if (!client->greeting_sent)
if (client->input_blocked) {
}
}
}