client.c revision d920a34dfe72ce74a362dae8083e021b4a1720ec
/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */
#include "login-common.h"
#include "base64.h"
#include "buffer.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "randgen.h"
#include "hostpid.h"
#include "safe-memset.h"
#include "str.h"
#include "strescape.h"
#include "master-service.h"
#include "client.h"
#include "client-authenticate.h"
#include "auth-client.h"
#include "ssl-proxy.h"
#include "pop3-proxy.h"
#include "pop3-login-settings.h"
/* Disconnect client when it sends too many bad commands */
#define CLIENT_MAX_BAD_COMMANDS 3
{
return TRUE;
}
{
return TRUE;
}
{
const char *const *tmp;
"You are not from trusted IP - ignoring");
return TRUE;
}
else
}
}
}
if (!args_ok) {
"Invalid parameters");
return TRUE;
}
/* args ok, set them and reset the state */
return TRUE;
}
const char *args)
{
/* Compatibility with Zimbra's patched nginx */
}
"Unknown command.");
return FALSE;
}
{
if (!client_read(client))
return;
/* if a command starts an authentication, stop processing further
commands until the authentication is finished. */
break;
}
}
{
return FALSE;
*args++ = '\0';
client->bad_counter = 0;
"Too many invalid bad commands.");
"Disconnected: Too many bad commands");
return FALSE;
}
return TRUE;
}
{
struct pop3_client *pop3_client;
return &pop3_client->common;
}
void **other_sets ATTR_UNUSED)
{
}
{
}
{
unsigned char buffer[16];
/* disabled, no need to present the challenge */
return NULL;
}
return i_strdup_printf("<%x.%x.%lx.%s@%s>",
(unsigned long)ioloop_time,
}
{
/* Dovecot extension to avoid extra roundtrip for CAPA */
}
}
static void
{
if (success)
else
}
{
}
const char *text)
{
const char *prefix = "-ERR";
switch (reply) {
case POP3_CMD_REPLY_OK:
prefix = "+OK";
break;
case POP3_CMD_REPLY_TEMPFAIL:
break;
if (text[0] == '[')
prefix = "-ERR";
else
prefix = "-ERR [AUTH]";
break;
case POP3_CMD_REPLY_ERROR:
break;
}
T_BEGIN {
} T_END;
}
static void
const char *text)
{
else
}
static void pop3_login_die(void)
{
/* do nothing. pop3 connections typically die pretty quick anyway. */
}
static void pop3_login_preinit(void)
{
}
static void pop3_login_init(void)
{
/* override the default login_die() */
}
static void pop3_login_deinit(void)
{
}
static struct client_vfuncs pop3_client_vfuncs = {
NULL,
NULL,
NULL,
};
static const struct login_binary pop3_login_binary = {
.protocol = "pop3",
.process_name = "pop3-login",
.default_port = 110,
.default_ssl_port = 995,
.init = pop3_login_init,
};
{
}