pop3-proxy.c revision ab45534d66792946b5794ab99a843d2f2b1d556f
/* Copyright (c) 2004-2012 Dovecot authors, see the included COPYING file */
#include "login-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 (client->proxy_xclient) {
/* remote supports XCLIENT, send it */
"XCLIENT ADDR=%s PORT=%u\r\n",
} else {
}
/* send USER command */
} else {
/* master user login - use AUTH PLAIN. */
}
}
{
switch (client->proxy_state) {
case POP3_PROXY_BANNER:
/* this is a banner */
"proxy: Remote returned invalid banner: %s",
return -1;
}
if ((ssl_flags & PROXY_SSL_FLAG_STARTTLS) == 0) {
} else {
}
return 0;
case POP3_PROXY_STARTTLS:
"proxy: Remote STLS failed: %s",
return -1;
}
return -1;
}
return 1;
case POP3_PROXY_XCLIENT:
"proxy: Remote XCLIENT failed: %s",
return -1;
}
return 1;
case POP3_PROXY_LOGIN1:
break;
/* USER successful, send PASS */
} else {
if (*line != '+')
break;
/* AUTH successful, send the authentication data */
}
return 0;
case POP3_PROXY_LOGIN2:
break;
/* Login successful. Send this line to client. */
return 1;
}
/* Login failed. Pass through the error message to client.
If the backend server isn't Dovecot, the error message may
be different from Dovecot's "user doesn't exist" error. This
would allow an attacker to find out what users exist in the
system.
The optimal way to handle this would be to replace the
backend's "password failed" error message with Dovecot's
AUTH_FAILED_MSG, but this would require a new setting and
the sysadmin to actually bother setting it properly.
So for now we'll just forward the error message. This
shouldn't be a real problem since of course everyone will
be using only Dovecot as their backend :) */
} else {
}
line += 5;
}
return -1;
}
{
}
{
}