smtp-server-reply.c revision 1d4c4128808d04cf4b8396ce04ce524da9194782
/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "array.h"
#include "istream.h"
#include "ostream.h"
#include "smtp-reply.h"
#include "smtp-server-private.h"
/*
* Logging
*/
const char *format, ...)
{
i_debug("%s-server: conn %s: "
"command %s; %u reply [%u/%u]: %s",
} else {
i_debug("%s-server: conn %s: "
"command %s; %u reply: %s",
}
}
}
/*
* Reply
*/
{
return;
return;
}
struct smtp_server_reply *
const char *enh_code)
{
struct smtp_server_reply *reply;
/* RFC 5321, Section 4.2:
In the absence of extensions negotiated with the client, SMTP servers
MUST NOT send reply codes whose first digits are other than 2, 3, 4,
or 5. Clients that receive such out-of-range codes SHOULD normally
treat them as fatal errors and terminate the mail transaction.
*/
/* RFC 2034, Section 4:
All status codes returned by the server must agree with the primary
response code, that is, a 2xx response must incorporate a 2.X.X code,
a 4xx response must incorporate a 4.X.X code, and a 5xx response must
incorporate a 5.X.X code.
*/
/* get rid of any existing reply */
} else {
}
} else {
}
return reply;
}
struct smtp_server_reply *
{
}
struct smtp_server_reply *
{
struct smtp_server_reply *reply;
return reply;
}
{
unsigned int i;
return;
for (i = 0; i < cmd->replies_expected; i++) {
struct smtp_server_reply *reply =
}
}
const char *text)
{
if (*text == '\0')
return;
do {
const char *p;
if (p == NULL) {
} else {
else
text = p + 1;
}
}
{
}
{
struct smtp_server_reply *reply;
}
{
}
const char *fmt, ...)
{
}
{
}
const struct smtp_reply *from)
{
}
static void ATTR_FORMAT(4, 0)
{
struct smtp_server_reply *reply;
const char *text;
unsigned int i = 0;
/* find the first unsent reply */
for (; i < cmd->replies_expected; i++) {
struct smtp_server_reply *reply =
break;
}
}
/* compose the reply text */
/* submit remaining replies */
for (; i < cmd->replies_expected; i++) {
}
}
const char *fmt, ...)
{
}
const char *fmt, ...)
{
}
{
struct smtp_server_reply *reply;
}
{
const char *text, *p;
for (;;) {
text = p + 1;
if (text_len <= prefix_len)
break;
text_len -= prefix_len;
text += prefix_len;
}
}
const char **error_r)
{
char *text;
int ret = 0;
/* substitute '-' with ' ' in last line */
if (text[0] != ' ') {
text[0] = ' ';
}
}
ret = -1;
}
}
return ret;
}
const char **error_r)
{
int ret;
return 0;
T_BEGIN {
} T_END;
return ret;
}
/*
* EHLO reply
*/
struct smtp_server_reply *
{
struct smtp_server_reply *reply;
return reply;
}
const char *keyword)
{
}
{
if (*param_fmt != '\0') {
}
}
{
static const char *base_fields =
"ADDR PORT PROTO HELO LOGIN TTL TIMEOUT";
return;
return;
}
NULL));
}