smtp-server-cmd-xclient.c revision 56dd928c164ec5c0d1158a1760154b58c5f1f6e7
/* Copyright (c) 2013-2017 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "istream.h"
#include "smtp-syntax.h"
#include "smtp-reply.h"
#include "smtp-server-private.h"
/* XCLIENT command (http://www.postfix.org/XCLIENT_README.html) */
static bool
{
The XCLIENT command may be sent at any time, except in the middle
of a mail delivery transaction (i.e. between MAIL and DOT, or MAIL
and RSET). */
"XCLIENT not permitted during a mail transaction");
return FALSE;
}
return TRUE;
}
{
struct smtp_proxy_data *proxy_data =
/* failure */
return;
}
/* success */
}
{
/* all preceeding commands have finished and now the transaction state is
clear. This provides the opportunity to re-check the protocol state */
if (!cmd_xclient_check_state(cmd))
return;
/* succes; send greeting */
return;
}
static void
{
struct smtp_proxy_data_field *field;
return;
if (!array_is_created(fields))
}
const char *params)
{
struct smtp_proxy_data *proxy_data;
const char *const *argv;
/* xclient-command = XCLIENT 1*( SP attribute-name"="attribute-value )
attribute-name = ( NAME | ADDR | PORT | PROTO | HELO | LOGIN )
attribute-value = xtext
*/
/* check transaction state as far as possible */
if (!cmd_xclient_check_state(cmd))
return;
/* check whether client is trusted */
if (!smtp_server_connection_is_trusted(conn)) {
"You are not from trusted IP");
return;
}
struct smtp_param param;
const char *error;
"Invalid parameter: %s", error);
return;
}
"Invalid %s parameter: %s",
return;
}
continue;
}
"Invalid ADDR parameter");
return;
}
continue;
proxy_data->helo =
continue;
continue;
"Invalid PORT parameter");
return;
}
else {
"Invalid PROTO parameter");
return;
}
&proxy_data->timeout_secs) < 0) {
"Invalid TIMEOUT parameter");
return;
}
&proxy_data->ttl_plus_1) < 0) {
"Invalid TTL parameter");
return;
}
proxy_data->ttl_plus_1++;
} else {
}
}
if (array_is_created(&extra_fields)) {
}
/* specific implementation of XCLIENT command */
}
}