imap-proxy.c revision 45155bb1250cf5a120278f349465aded513a100f
/* Copyright (c) 2004-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "str.h"
#include "str-sanitize.h"
#include "safe-memset.h"
#include "client.h"
#include "imap-quote.h"
#include "imap-proxy.h"
{
const char *msg;
if (!client->proxy_login_sent) {
/* this is a banner */
"proxy: Remote returned invalid banner: %s",
return -1;
}
/* send LOGIN command */
return 0;
/* Login successful. Send this line to client. */
(void)client_skip_line(client);
return -1;
/* Login failed. Send our own failure reply so client can't
figure out if user exists or not just by looking at the
reply string. */
/* allow client input again */
return -1;
} else {
/* probably some untagged reply */
return 0;
}
}
struct imap_client *client)
{
const char *line;
/* remote authentication failed, 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:
/* buffer full */
"proxy: Remote input buffer full");
return;
case -1:
/* disconnected */
return;
}
break;
}
}
{
return -1;
}
/* connection_queue_add() decided that we were the oldest
connection and killed us. */
return -1;
}
return -1;
/* disable input until authentication is finished */
return 0;
}