RSPAMD_FTOK_ASSIGN (&t2, "esmtp");
- if (rspamd_ftok_starts_with (&t1, &t2) == 0) {
+ if (rspamd_ftok_starts_with (&t1, &t2)) {
/*
* esmtp, esmtps, esmtpsa
*/
rh->type = RSPAMD_RECEIVED_ESMTPS;
rh->flags |= RSPAMD_RECEIVED_FLAG_SSL;
}
+ continue;
}
else if (t1.len == t2.len + 2) {
if (t1.begin[t2.len - 1] == 's' &&
rh->flags |= RSPAMD_RECEIVED_FLAG_AUTHENTICATED;
rh->flags |= RSPAMD_RECEIVED_FLAG_SSL;
}
+ continue;
}
else if (t1.len == t2.len) {
rh->type = RSPAMD_RECEIVED_ESMTP;
+ continue;
}
}
if (rspamd_ftok_cmp (&t1, &t2) == 0) {
rh->type = RSPAMD_RECEIVED_LMTP;
+ continue;
}
RSPAMD_FTOK_ASSIGN (&t2, "imap");
if (rspamd_ftok_cmp (&t1, &t2) == 0) {
rh->type = RSPAMD_RECEIVED_IMAP;
+ continue;
}
RSPAMD_FTOK_ASSIGN (&t2, "local");
if (rspamd_ftok_cmp (&t1, &t2) == 0) {
rh->type = RSPAMD_RECEIVED_LOCAL;
+ continue;
}
RSPAMD_FTOK_ASSIGN (&t2, "http");
- if (rspamd_ftok_starts_with (&t1, &t2) == 0) {
+ if (rspamd_ftok_starts_with (&t1, &t2)) {
if (t1.len == t2.len + 1) {
if (t1.begin[t2.len] == 's') {
rh->type = RSPAMD_RECEIVED_HTTP;
else if (t1.len == t2.len) {
rh->type = RSPAMD_RECEIVED_HTTP;
}
+
+ continue;
}
}
]]
local cases = {
+ {[[from server.chat-met-vreemden.nl (unknown [IPv6:2a01:7c8:aab6:26d:5054:ff:fed1:1da2])
+ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
+ (Client did not present a certificate)
+ by mx1.freebsd.org (Postfix) with ESMTPS id CF0171862
+ for <test@example.com>; Mon, 6 Jul 2015 09:01:20 +0000 (UTC)
+ (envelope-from upwest201diana@outlook.com)]],
+ {
+ real_ip = '2a01:7c8:aab6:26d:5054:ff:fed1:1da2',
+ from_hostname = 'server.chat-met-vreemden.nl',
+ real_hostname = '',
+ by_hostname = 'mx1.freebsd.org',
+ },
+ },
{[[from out-9.smtp.github.com (out-9.smtp.github.com [192.30.254.192])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
real_ip = '65.19.167.131',
by_hostname = 'mail01.someotherdomain.org',
}
- }
+ },
}
local task = ffi.C.rspamd_task_new(nil, nil)
end
elseif k == 'from_ip' then
if #v > 0 then
- local got_string = tostring(rspamd_ip.from_string(ffi_string(hdr.from_ip)))
+ local got_string = tostring((rspamd_ip.from_string(ffi_string(hdr.from_ip) or '')) or '')
local expected_string = tostring(rspamd_ip.from_string(v))
assert_equal(expected_string, got_string,
string.format('%s: from_ip: %s, expected: %s',
end
elseif k == 'real_ip' then
if #v > 0 then
- local got_string = tostring(rspamd_ip.from_string(ffi_string(hdr.from_ip)))
+ local got_string = tostring((rspamd_ip.from_string(ffi_string(hdr.from_ip) or '')) or '')
local expected_string = tostring(rspamd_ip.from_string(v))
assert_equal(expected_string, got_string,
string.format('%s: real_ip: %s, expected: %s',