pop3-proxy.c revision f8a78c816b4dbfda42f13d8ee152e0cdb28c6a4a
/* Copyright (c) 2004-2009 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "base64.h"
#include "safe-memset.h"
#include "str.h"
#include "str-sanitize.h"
#include "client.h"
#include "pop3-proxy.h"
{
return;
}
{
if (send_line)
/* call this last - it may destroy the client */
}
{
}
{
switch (client->proxy_state) {
case 0:
/* this is a banner */
"proxy: Remote returned invalid banner: %s",
return -1;
}
/* send USER command */
} else {
/* master user login - use AUTH PLAIN. */
}
client->proxy_state++;
return 0;
case 1:
break;
/* USER successful, send PASS */
} else {
if (*line != '+')
break;
/* AUTH successful, send the authentication data */
}
client->proxy_state++;
return 0;
case 2:
break;
/* Login successful. Send this line to client. */
client->proxy_user) != 0) {
/* remote username is different, log it */
}
}
return 1;
}
/* Login failed. Pass through the error message to client
(see imap-proxy code for potential problems with this) */
else
if (verbose_auth) {
client->proxy_user) != 0) {
/* remote username is different, log it */
}
}
else
}
return -1;
}
struct pop3_client *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:
"proxy: Remote input buffer full");
return;
case -1:
"proxy: Remote disconnected");
return;
}
break;
}
}
const char *password)
{
return -1;
}
/* connection_queue_add() decided that we were the oldest
connection and killed us. */
return -1;
}
return -1;
}
return -1;
}
client->proxy_state = 0;
/* disable input until authentication is finished */
return 0;
}