enum rspamd_received_type {
RSPAMD_RECEIVED_SMTP = 0,
RSPAMD_RECEIVED_ESMTP,
+ RSPAMD_RECEIVED_ESMTPA,
RSPAMD_RECEIVED_ESMTPS,
RSPAMD_RECEIVED_LMTP,
RSPAMD_RECEIVED_IMAP,
gchar *real_ip;
gchar *by_hostname;
rspamd_inet_addr_t *addr;
+ time_t timestamp;
enum rspamd_received_type type;
- gint is_error;
};
struct raw_header {
for (i = 0; i < task->received->len; i ++) {
rh = g_ptr_array_index (task->received, i);
- if (rh->is_error || G_UNLIKELY (
- rh->from_ip == NULL &&
+ if (G_UNLIKELY (rh->from_ip == NULL &&
rh->real_ip == NULL &&
rh->real_hostname == NULL &&
rh->by_hostname == NULL)) {
case RSPAMD_RECEIVED_ESMTPS:
proto = "esmtps";
break;
+ case RSPAMD_RECEIVED_ESMTPA:
+ proto = "esmtpa";
+ break;
case RSPAMD_RECEIVED_LMTP:
proto = "lmtp";
break;
Addtl_Link = Atom;
Link = "TCP" | Addtl_Link;
Attdl_Protocol = Atom;
- Protocol = "ESMTP" %ESMTP_proto | "SMTP" %SMTP_proto | "ESMTPS" %ESMTPS_proto | "LMTP" %LMTP_proto | "IMAP" %IMAP_proto | Attdl_Protocol;
+ Protocol = "ESMTP" %ESMTP_proto |
+ "SMTP" %SMTP_proto |
+ "ESMTPS" %ESMTPS_proto |
+ "ESMTPA" %ESMTPA_proto |
+ "LMTP" %LMTP_proto |
+ "IMAP" %IMAP_proto |
+ Attdl_Protocol;
TCP_info = address_literal >Real_IP_Start %Real_IP_End |
( Domain >Real_Domain_Start %Real_Domain_End FWS address_literal >Real_IP_Start %Real_IP_End );
For = CFWS "FOR"i FWS ( Path | Mailbox ) %For_End;
Additional_Registered_Clauses = CFWS Atom FWS String;
Opt_info = Via? With? ID? For? Additional_Registered_Clauses?;
- Received = From_domain By_domain Opt_info CFWS? ";" FWS date_time;
+ Received = From_domain By_domain Opt_info CFWS? ";" FWS date_time >Date_Start %Date_End;
}%%
action ESMTPS_proto {
rh->type = RSPAMD_RECEIVED_ESMTPS;
}
+ action ESMTPA_proto {
+ rh->type = RSPAMD_RECEIVED_ESMTPA;
+ }
action ESMTP_proto {
rh->type = RSPAMD_RECEIVED_ESMTP;
}
rh->type = RSPAMD_RECEIVED_IMAP;
}
+ action Date_Start {
+ date_start = p;
+ }
+ action Date_End {
+ if (date_start && p > date_start) {
+ guint len;
+ char *tdate;
+
+ len = p - date_start;
+ tdate = g_malloc (len + 1);
+ rspamd_strlcpy (tdate, date_start, len + 1);
+ rh->timestamp = g_mime_utils_header_decode_date (tdate, NULL);
+ g_free (tdate);
+ }
+ }
+
include smtp_received "smtp_received.rl";
main := Received;
*real_ip_start, *real_ip_end,
*reported_domain_start, *reported_domain_end,
*reported_ip_start, *reported_ip_end,
- *ip_start, *ip_end;
+ *ip_start, *ip_end, *date_start;
const char *p = data, *pe = data + len, *eof;
int cs, in_v6 = 0;
reported_ip_end = NULL;
ip_start = NULL;
ip_end = NULL;
+ date_start = NULL;
rh->type = RSPAMD_RECEIVED_UNKNOWN;
memset (&for_addr, 0, sizeof (for_addr));