@@ -58,7 +58,7 @@ OPTION(ENABLE_LIBUNWIND "Use libunwind to print crash traces [default: OFF]" | |||
OPTION(ENABLE_LUA_TRACE "Trace all Lua C API invocations [default: OFF]" OFF) | |||
OPTION(ENABLE_LUA_REPL "Enables Lua repl (requires C++11 compiler) [default: ON]" ON) | |||
OPTION(SYSTEM_ZSTD "Use system zstd instead of bundled one [default: OFF]" OFF) | |||
OPTION(SYSTEM_FMT "Use system fmt instead of bundled one [defalut: OFF]" OFF) | |||
OPTION(SYSTEM_FMT "Use system fmt instead of bundled one [default: OFF]" OFF) | |||
OPTION(SYSTEM_DOCTEST "Use system doctest instead of bundled one [default: OFF]" OFF) | |||
############################# INCLUDE SECTION ############################################# |
@@ -88,7 +88,7 @@ group "mime_types" { | |||
.include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/mime_types_group.conf" | |||
} | |||
# Used to limit maximium score | |||
# Used to limit maximum score | |||
group "excessqp" { | |||
max_score = 2.4; | |||
.include(try=true; priority=1; duplicate=merge) "$LOCAL_CONFDIR/local.d/excessqp_group.conf" |
@@ -271,12 +271,12 @@ sub print_markdown { | |||
} | |||
} | |||
if ($m->{'stucts'}) { | |||
if ( scalar(@{ $m->{'stucts'} }) > 0 ) { | |||
print "\n## Stucts\n\nThe module `$mname` defines the following stucts.\n\n"; | |||
if ($m->{'structs'}) { | |||
if ( scalar(@{ $m->{'structs'} }) > 0 ) { | |||
print "\n## Structs\n\nThe module `$mname` defines the following structs.\n\n"; | |||
foreach ( @{ $m->{'stucts'} } ) { | |||
print_stuct_markdown( "Stuct", $_->{'name'}, $_ ); | |||
foreach ( @{ $m->{'structs'} } ) { | |||
print_struct_markdown( "Struct", $_->{'name'}, $_ ); | |||
print "\nBack to [module description](#$m->{'id'}).\n\n"; | |||
@@ -31,7 +31,7 @@ worker { | |||
count = 1; | |||
# Password for normal commands (use rspamadm pw) | |||
password = "$2$anydoddx67ggcs74owybhcwqsq3z67q4$udympbo8pfcfqkeiiuj7gegabk5jpt8edmhseujhar9ooyuzig5b"; | |||
# Password for privilleged commands (use rspamadm pw) | |||
# Password for privileged commands (use rspamadm pw) | |||
enable_password = "$2$nx6sqkxtewx9c5s3hxjmabaxdcr46pk9$45qajkbyqx77abapiqugpjpsojj38zcqn7xnp3ekqyu674koux4b"; | |||
# Path to webiu static files | |||
static_dir = "${WWWDIR}"; |
@@ -407,7 +407,7 @@ | |||
<div class="row"> | |||
<div class="col-lg-6"> | |||
<div class="card bg-light shadow card-body card p-2"> | |||
<p>Learn Bayessian classifier:</p> | |||
<p>Learn Bayesian classifier:</p> | |||
<form class="form-inline"> | |||
<div class="form-group"> | |||
<div class="btn-group"> |
@@ -174,7 +174,7 @@ This guide is forked from https://github.com/Olivine-Labs/lua-style-guide | |||
end | |||
``` | |||
- Never name a parameter `arg`, this will take precendence over the `arg` object that is given to every function scope in older versions of Lua. | |||
- Never name a parameter `arg`, this will take precedence over the `arg` object that is given to every function scope in older versions of Lua. | |||
```lua | |||
-- bad |
@@ -396,7 +396,7 @@ return function(cfg) | |||
local actions_set = lua_util.list_to_hash(actions_defs) | |||
-- Now check actions section for garbadge | |||
-- Now check actions section for garbage | |||
actions_set['unknown_weight'] = true | |||
actions_set['grow_factor'] = true | |||
actions_set['subject'] = true |
@@ -558,7 +558,7 @@ local function process_action(task, pdf, obj) | |||
local extracted_js = maybe_extract_object_stream(js, pdf, task) | |||
if not extracted_js then | |||
lua_util.debugm(N, task, 'invalid type for javascript from %s:%s: %s', | |||
lua_util.debugm(N, task, 'invalid type for JavaScript from %s:%s: %s', | |||
obj.major, obj.minor, js) | |||
else | |||
js = extracted_js | |||
@@ -571,7 +571,7 @@ local function process_action(task, pdf, obj) | |||
lua_util.debugm(N, task, 'extracted javascript from %s:%s: %s', | |||
obj.major, obj.minor, obj.js.data) | |||
else | |||
lua_util.debugm(N, task, 'invalid type for javascript from %s:%s: %s', | |||
lua_util.debugm(N, task, 'invalid type for JavaScript from %s:%s: %s', | |||
obj.major, obj.minor, js) | |||
end | |||
elseif obj.dict.F then | |||
@@ -654,7 +654,7 @@ process_dict = function(task, pdf, obj, dict) | |||
if obj.dict.S and obj.dict.JS then | |||
obj.type = 'Javascript' | |||
lua_util.debugm(N, task, 'implicit type for Javascript object %s:%s', | |||
lua_util.debugm(N, task, 'implicit type for JavaScript object %s:%s', | |||
obj.major, obj.minor) | |||
else | |||
lua_util.debugm(N, task, 'no type for %s:%s', | |||
@@ -757,7 +757,7 @@ process_dict = function(task, pdf, obj, dict) | |||
local extracted_js = maybe_extract_object_stream(js, pdf, task) | |||
if not extracted_js then | |||
lua_util.debugm(N, task, 'invalid type for javascript from %s:%s: %s', | |||
lua_util.debugm(N, task, 'invalid type for JavaScript from %s:%s: %s', | |||
obj.major, obj.minor, js) | |||
else | |||
js = extracted_js | |||
@@ -770,7 +770,7 @@ process_dict = function(task, pdf, obj, dict) | |||
lua_util.debugm(N, task, 'extracted javascript from %s:%s: %s', | |||
obj.major, obj.minor, obj.js.data) | |||
else | |||
lua_util.debugm(N, task, 'invalid type for javascript from %s:%s: %s', | |||
lua_util.debugm(N, task, 'invalid type for JavaScript from %s:%s: %s', | |||
obj.major, obj.minor, js) | |||
end | |||
end | |||
@@ -1248,7 +1248,7 @@ local function process_pdf(input, mpart, task) | |||
pdf_object.openaction.object.major, pdf_object.openaction.object.minor) | |||
table.insert(pdf_output.fuzzy_hashes, pdf_object.openaction.bin_hash) | |||
else | |||
lua_util.debugm(N, task, "pdf: skip fuzzy hash from Javascript: %s, too short: %s", | |||
lua_util.debugm(N, task, "pdf: skip fuzzy hash from JavaScript: %s, too short: %s", | |||
pdf_object.openaction.hash, #pdf_object.openaction.data) | |||
end | |||
end | |||
@@ -1256,13 +1256,13 @@ local function process_pdf(input, mpart, task) | |||
-- All hashes | |||
for h,sc in pairs(pdf_object.scripts) do | |||
if config.min_js_fuzzy and #sc.data >= config.min_js_fuzzy then | |||
lua_util.debugm(N, task, "pdf: add fuzzy hash from Javascript: %s; size = %s; object: %s:%s", | |||
lua_util.debugm(N, task, "pdf: add fuzzy hash from JavaScript: %s; size = %s; object: %s:%s", | |||
sc.hash, | |||
#sc.data, | |||
sc.object.major, sc.object.minor) | |||
table.insert(pdf_output.fuzzy_hashes, h) | |||
else | |||
lua_util.debugm(N, task, "pdf: skip fuzzy hash from Javascript: %s, too short: %s", | |||
lua_util.debugm(N, task, "pdf: skip fuzzy hash from JavaScript: %s, too short: %s", | |||
sc.hash, #sc.data) | |||
end | |||
end |
@@ -246,7 +246,7 @@ local function mime_types_check(task, part, rule) | |||
local id = part:get_id() | |||
lua_util.debugm(N, task, 'check binary part %s: %s', id, ct) | |||
-- For bad mime mime parts we implicitly enable fuzzy check | |||
-- For bad mime parts we implicitly enable fuzzy check | |||
local mime_trace = (task:get_symbol('MIME_TRACE') or {})[1] | |||
local opts = {} | |||
@@ -239,7 +239,7 @@ local function meta_words_function(task) | |||
0, -- ascii characters rate | |||
0, -- non-ascii characters rate | |||
0, -- capital characters rate | |||
0, -- numeric cahracters | |||
0, -- numeric characters | |||
} | |||
for _,p in ipairs(tp) do | |||
local stats = p:get_stats() | |||
@@ -385,7 +385,7 @@ local metafunctions = { | |||
'ascii_characters_rate', | |||
'non_ascii_characters_rate', | |||
'capital_characters_rate', | |||
'numeric_cahracters' | |||
'numeric_characters' | |||
}, | |||
description = [[Functions for words data matching: | |||
- average length of the words |
@@ -79,7 +79,7 @@ local function redis_query_sentinel(ev_base, params, initialised) | |||
for _,m in ipairs(result) do | |||
local master = flatten_redis_table(m) | |||
-- Wrap IPv6-adresses in brackets | |||
-- Wrap IPv6-addresses in brackets | |||
if (master.ip:match(":")) then | |||
master.ip = "["..master.ip.."]" | |||
end | |||
@@ -110,7 +110,7 @@ local function redis_query_sentinel(ev_base, params, initialised) | |||
lutil.debugm(N, rspamd_config, | |||
'found slave for master %s with ip %s and port %s', | |||
v.name, slave.ip, slave.port) | |||
-- Wrap IPv6-adresses in brackets | |||
-- Wrap IPv6-addresses in brackets | |||
if (slave.ip:match(":")) then | |||
slave.ip = "["..slave.ip.."]" | |||
end |
@@ -405,7 +405,7 @@ local function check_parts_match(task, rule) | |||
lua_util.debugm(rule.name, task, '%s: extension matched: |%s|%s|', rule.log_prefix, ext, ext2) | |||
return true | |||
elseif match_filter(task, rule, fname, rule.mime_parts_filter_regex, 'regex') then | |||
lua_util.debugm(rule.name, task, '%s: filname regex matched', rule.log_prefix) | |||
lua_util.debugm(rule.name, task, '%s: filename regex matched', rule.log_prefix) | |||
return true | |||
end | |||
end |
@@ -135,7 +135,7 @@ local function fprot_check(task, content, digest, rule, maybe_part) | |||
rule['symbol'], rule['type']) | |||
end | |||
else | |||
-- returncodes: 1: infected, 2: suspicious, 3: both, 4-255: some error occured | |||
-- returncodes: 1: infected, 2: suspicious, 3: both, 4-255: some error occurred | |||
-- see http://www.f-prot.com/support/helpfiles/unix/appendix_c.html for more detail | |||
local vname = string.match(data, '^[1-3] <[%w%s]-: (.-)>') | |||
if not vname then |
@@ -149,7 +149,7 @@ local function sophos_check(task, content, digest, rule, maybe_part) | |||
rspamd_logger.warnx(task, 'Message is oversized (REJ 4): %s', data) | |||
common.yield_result(task, rule, 'SAVDI: Message oversized (REJ 4)', | |||
0.0, 'fail', maybe_part) | |||
-- excplicitly set REJ1 message when SAVDIreports a protocol error | |||
-- explicitly set REJ1 message when SAVDIreports a protocol error | |||
elseif string.find(data, 'REJ 1') then | |||
rspamd_logger.errx(task, 'SAVDI (Protocol error (REJ 1)): %s', data) | |||
common.yield_result(task, rule, 'SAVDI: Protocol error (REJ 1)', |
@@ -16,7 +16,7 @@ limitations under the License. | |||
--[[[ | |||
-- @module virustotal | |||
-- This module contains Virustotal integration support | |||
-- https://www.virustotal.com/ | |||
--]] | |||
@@ -481,7 +481,7 @@ exports.combine_selectors = function(_, selectors, delimiter) | |||
return rspamd_text.fromtable(selectors, delimiter) | |||
end | |||
else | |||
-- We need to do a spill on each table selector and make a cortezian product | |||
-- We need to do a spill on each table selector and make a cortesian product | |||
-- e.g. s:tbl:s -> s:telt1:s + s:telt2:s ... | |||
local tbl = {} | |||
local res = {} |
@@ -396,7 +396,7 @@ exports.convert_sqlite_to_redis = convert_sqlite_to_redis | |||
-- symbol_ham = YYY | |||
-- db_spam = XXX.sqlite | |||
-- db_ham = YYY.sqlite | |||
-- learn_cache = ZZZ.sqlite | |||
-- per_user = true/false | |||
-- label = str | |||
-- } |
@@ -74,10 +74,10 @@ local function rspamd_str_split(s, sep) | |||
end | |||
--[[[ | |||
-- @function lua_util.str_split(text, delimiter) | |||
-- Splits text into a numeric table by delimiter | |||
-- @param {string} text delimited text | |||
-- @param {string} delimiter the delimiter | |||
-- @return {table} numeric table containing string parts | |||
--]] | |||
@@ -77,7 +77,7 @@ local default_possible_verdicts = { | |||
}, | |||
uncertain = { | |||
can_learn = false, | |||
description = 'not certainity in verdict' | |||
description = 'not certainty in verdict' | |||
} | |||
} | |||
@@ -152,7 +152,7 @@ exports.gen_munging_callback = function(munging_opts, settings) | |||
if munging_opts.munge_map_condition then | |||
local accepted,trace = munging_opts.munge_map_condition:process(task) | |||
if not accepted then | |||
lua_util.debugm(task, 'skip munging, maps condition not satisified: (%s)', | |||
lua_util.debugm(task, 'skip munging, maps condition not satisfied: (%s)', | |||
trace) | |||
-- Excepted | |||
return | |||
@@ -274,7 +274,7 @@ end | |||
-- Used to check dmarc record, check elements and produce dmarc policy processed | |||
-- result. | |||
-- Returns: | |||
-- false,false - record is garbage | |||
-- false,error_message - record is invalid | |||
-- true,policy_table - record is valid and parsed | |||
]] | |||
@@ -349,7 +349,7 @@ local function dmarc_check_record(log_obj, record, is_tld) | |||
end | |||
result.raw_elts = elts | |||
else | |||
return false,false -- Ignore garbadge | |||
return false,false -- Ignore garbage | |||
end | |||
return true, result |
@@ -456,7 +456,7 @@ local function can_push_train_vector(rule, task, learn_type, nspam, nham) | |||
if nspam <= train_opts.max_trains then | |||
if train_opts.spam_skip_prob then | |||
if coin <= train_opts.spam_skip_prob then | |||
rspamd_logger.infox(task, 'skip %s sample probabilisticaly; probability %s (%s skip chance)', learn_type, | |||
rspamd_logger.infox(task, 'skip %s sample probabilistically; probability %s (%s skip chance)', learn_type, | |||
coin, train_opts.spam_skip_prob) | |||
return false | |||
end | |||
@@ -471,7 +471,7 @@ local function can_push_train_vector(rule, task, learn_type, nspam, nham) | |||
if nham <= train_opts.max_trains then | |||
if train_opts.ham_skip_prob then | |||
if coin <= train_opts.ham_skip_prob then | |||
rspamd_logger.infox(task, 'skip %s sample probabilisticaly; probability %s (%s skip chance)', learn_type, | |||
rspamd_logger.infox(task, 'skip %s sample probabilistically; probability %s (%s skip chance)', learn_type, | |||
coin, train_opts.ham_skip_prob) | |||
return false | |||
end | |||
@@ -533,7 +533,7 @@ local function spawn_train(params) | |||
else | |||
local inputs, outputs = {}, {} | |||
-- Used to show sparsed vectors in a convenient format (for debugging only) | |||
-- Used to show parsed vectors in a convenient format (for debugging only) | |||
local function debug_vec(t) | |||
local ret = {} | |||
for i,v in ipairs(t) do |
@@ -165,7 +165,7 @@ local function days_list(days) | |||
end | |||
local function get_excluded_symbols(known_symbols, correlations, seen_total) | |||
-- Walk results once to collect all symbols & count ocurrences | |||
-- Walk results once to collect all symbols & count occurrences | |||
local remove = {} | |||
local known_symbols_list = {} |
@@ -38,7 +38,7 @@ local function process_filename(fname) | |||
return fname | |||
end | |||
local function output_dot(opts, nodes, adjastency) | |||
local function output_dot(opts, nodes, adjacency) | |||
rspamd_logger.messagex("digraph rspamd {") | |||
for k,node in pairs(nodes) do | |||
local attrs = {"shape=box"} | |||
@@ -62,7 +62,7 @@ local function output_dot(opts, nodes, adjastency) | |||
table.concat(attrs, ',')) | |||
end | |||
end | |||
for _,adj in ipairs(adjastency) do | |||
for _,adj in ipairs(adjacency) do | |||
local attrs = {} | |||
local skip = false | |||
@@ -91,7 +91,7 @@ end | |||
local function load_config_traced(opts) | |||
local glob_traces = {} | |||
local adjastency = {} | |||
local adjacency = {} | |||
local nodes = {} | |||
local function maybe_match_glob(file) | |||
@@ -105,7 +105,7 @@ local function load_config_traced(opts) | |||
end | |||
local function add_dep(from, node, args) | |||
adjastency[#adjastency + 1] = { | |||
adjacency[#adjacency + 1] = { | |||
from = from, | |||
to = node, | |||
args = args | |||
@@ -157,7 +157,7 @@ local function load_config_traced(opts) | |||
os.exit(1) | |||
end | |||
output_dot(opts, nodes, adjastency) | |||
output_dot(opts, nodes, adjacency) | |||
end | |||
@@ -445,7 +445,7 @@ local function check_redis_classifier(cls, changes) | |||
end | |||
if not symbol_spam or not symbol_ham then | |||
printf("Calssifier has no symbols defined") | |||
printf("Classifier has no symbols defined") | |||
return | |||
end | |||
@@ -381,9 +381,9 @@ local function extract_handler(opts) | |||
end | |||
if opts.words then | |||
local howw = opts['words_format'] or 'stem' | |||
local how_words = opts['words_format'] or 'stem' | |||
table.insert(out_elts[fname], 'meta_words: ' .. | |||
print_words(task:get_meta_words(howw), howw == 'full')) | |||
print_words(task:get_meta_words(how_words), how_words == 'full')) | |||
end | |||
if opts.text or opts.html then | |||
@@ -402,9 +402,9 @@ local function extract_handler(opts) | |||
end | |||
if opts.words then | |||
local howw = opts['words_format'] or 'stem' | |||
table.insert(out_elts[fname], print_words(part:get_words(howw), | |||
howw == 'full')) | |||
local how_words = opts['words_format'] or 'stem' | |||
table.insert(out_elts[fname], print_words(part:get_words(how_words), | |||
how_words == 'full')) | |||
else | |||
table.insert(out_elts[fname], tostring(part:get_content(how))) | |||
end | |||
@@ -416,9 +416,9 @@ local function extract_handler(opts) | |||
end | |||
if opts.words then | |||
local howw = opts['words_format'] or 'stem' | |||
table.insert(out_elts[fname], print_words(part:get_words(howw), | |||
howw == 'full')) | |||
local how_words = opts['words_format'] or 'stem' | |||
table.insert(out_elts[fname], print_words(part:get_words(how_words), | |||
how_words == 'full')) | |||
else | |||
if opts.structure then | |||
local hc = part:get_html() |
@@ -67,7 +67,7 @@ rspamd_config.BOUNCE = { | |||
return true, 1.0, 'DSN' | |||
end | |||
-- Apply heuristics for non-standard bounecs | |||
-- Apply heuristics for non-standard bounces | |||
local bounce_sender | |||
local mime_from = task:get_from('mime') | |||
if mime_from then | |||
@@ -95,7 +95,7 @@ rspamd_config.BOUNCE = { | |||
-- Look for a message/rfc822(-headers) part inside | |||
local rfc822_part | |||
parts[10] = nil -- limit numbe of parts to check | |||
parts[10] = nil -- limit number of parts to check | |||
for _, p in ipairs(parts) do | |||
local mime_type, mime_subtype = p:get_type() | |||
if (mime_subtype == 'rfc822' or mime_subtype == 'rfc822-headers') and |
@@ -344,7 +344,7 @@ local check_mime_id = rspamd_config:register_symbol{ | |||
missing_mime = true | |||
end | |||
-- Check presense of MIME specific headers | |||
-- Check presence of MIME specific headers | |||
local has_ct_header = task:has_header('Content-Type') | |||
local has_cte_header = task:has_header('Content-Transfer-Encoding') | |||
@@ -630,7 +630,7 @@ reconf['FAKE_REPLY'] = { | |||
group = 'headers' | |||
} | |||
-- Mime-OLE is needed but absent (e.g. fake Outlook or fake Exchange) | |||
local has_msmail_pri = 'header_exists(X-MSMail-Priority)' | |||
local has_mimeole = 'header_exists(X-MimeOLE)' | |||
local has_squirrelmail_in_mailer = 'X-Mailer=/SquirrelMail\\b/H' | |||
@@ -838,14 +838,14 @@ reconf['CT_EXTRA_SEMI'] = { | |||
reconf['SUBJECT_ENDS_EXCLAIM'] = { | |||
re = 'Subject=/!\\s*$/H', | |||
description = 'Subject ends with an exclaimation', | |||
description = 'Subject ends with an exclamation', | |||
score = 0.0, | |||
group = 'headers' | |||
} | |||
reconf['SUBJECT_HAS_EXCLAIM'] = { | |||
re = string.format('%s & !%s', 'Subject=/!/H', 'Subject=/!\\s*$/H'), | |||
description = 'Subject contains an exclaimation', | |||
description = 'Subject contains an exclamation', | |||
score = 0.0, | |||
group = 'headers' | |||
} | |||
@@ -969,7 +969,7 @@ local bad_x_mailers = { | |||
[[(?:Mozilla )?Thunderbird \d]], | |||
-- Was used by Yahoo Groups in 2000s, no one expected to use this in 2020s | |||
[[eGroups Message Poster]], | |||
-- Regexp for genuene iOS X-Mailer is below, anything which doesn't match it, | |||
-- Regexp for genuine iOS X-Mailer is below, anything which doesn't match it, | |||
-- but starts with 'iPhone Mail' or 'iPad Mail' is likely fake | |||
[[i(?:Phone|Pad) Mail]], | |||
} |
@@ -139,7 +139,7 @@ struct rspamd_controller_worker_ctx { | |||
gboolean use_ssl; | |||
/* Webui password */ | |||
gchar *password; | |||
/* Privilleged password */ | |||
/* Privileged password */ | |||
gchar *enable_password; | |||
/* Cached versions of the passwords */ | |||
rspamd_ftok_t cached_password; | |||
@@ -1442,7 +1442,7 @@ rspamd_controller_handle_legacy_history ( | |||
g_strstrip (syms[j]); | |||
if (strlen (syms[j]) == 0) { | |||
/* Empty garbadge */ | |||
/* Empty garbage */ | |||
continue; | |||
} | |||
@@ -3242,7 +3242,7 @@ rspamd_controller_handle_custom (struct rspamd_http_connection_entry *conn_ent, | |||
} | |||
if (!rspamd_controller_check_password (conn_ent, session, msg, | |||
cmd->privilleged)) { | |||
cmd->privileged)) { | |||
return 0; | |||
} | |||
if (cmd->require_message && (rspamd_http_message_get_body (msg, NULL) == NULL)) { |
@@ -1376,7 +1376,7 @@ rspamd_fuzzy_extensions_from_wire (struct fuzzy_session *s, guchar *buf, gsize b | |||
p = buf; | |||
/* | |||
* Memory layout: n_ext of struct rspamd_fuzzy_cmd_extension | |||
* payload for each extension in a continious data segment | |||
* payload for each extension in a continuous data segment | |||
*/ | |||
storage = g_malloc (n_ext * sizeof (struct rspamd_fuzzy_cmd_extension) + | |||
st_len); |
@@ -256,7 +256,7 @@ XOR (const uint8_t *input1, const uint8_t *input2, uint8_t *output) | |||
*/ | |||
/* | |||
* Sigma function that defines the diagonal connections of a DBG | |||
* diagonal front: flip the (g-i)th bit (Inverse Buttferly Graph) | |||
* diagonal front: flip the (g-i)th bit (Inverse Butterfly Graph) | |||
* diagonal back: flip the i-(g-1)th bit (Regular Butterfly Graph) | |||
*/ | |||
static uint64_t |
@@ -82,11 +82,11 @@ struct rspamd_language_elt { | |||
const gchar *name; /* e.g. "en" or "ru" */ | |||
gint flags; /* enum rspamd_language_elt_flags */ | |||
enum rspamd_language_category category; | |||
guint trigramms_words; | |||
guint trigrams_words; | |||
guint stop_words; | |||
gdouble mean; | |||
gdouble std; | |||
guint occurencies; /* total number of parts with this language */ | |||
guint occurrences; /* total number of parts with this language */ | |||
}; | |||
struct rspamd_ngramm_elt { | |||
@@ -175,12 +175,12 @@ KHASH_INIT (rspamd_stopwords_hash, rspamd_ftok_t *, | |||
struct rspamd_lang_detector { | |||
GPtrArray *languages; | |||
khash_t(rspamd_trigram_hash) *trigramms[RSPAMD_LANGUAGE_MAX]; /* trigramms frequencies */ | |||
khash_t(rspamd_trigram_hash) *trigrams[RSPAMD_LANGUAGE_MAX]; /* trigrams frequencies */ | |||
struct rspamd_stop_word_elt stop_words[RSPAMD_LANGUAGE_MAX]; | |||
khash_t(rspamd_stopwords_hash) *stop_words_norm; | |||
UConverter *uchar_converter; | |||
gsize short_text_limit; | |||
gsize total_occurencies; /* number of all languages found */ | |||
gsize total_occurrences; /* number of all languages found */ | |||
ref_entry_t ref; | |||
}; | |||
@@ -398,7 +398,7 @@ rspamd_language_detector_read_file (struct rspamd_config *cfg, | |||
return; | |||
} | |||
else { | |||
nelt->trigramms_words = ucl_object_toint (ucl_array_find_index (n_words, | |||
nelt->trigrams_words = ucl_object_toint (ucl_array_find_index (n_words, | |||
2)); | |||
} | |||
@@ -541,7 +541,7 @@ rspamd_language_detector_read_file (struct rspamd_config *cfg, | |||
} | |||
nelt->category = cat; | |||
htb = d->trigramms[cat]; | |||
htb = d->trigrams[cat]; | |||
GPtrArray *ngramms; | |||
guint nsym; | |||
@@ -638,7 +638,7 @@ rspamd_language_detector_read_file (struct rspamd_config *cfg, | |||
if (!(nelt->flags & RS_LANGUAGE_LATIN) && | |||
rspamd_language_detector_ucs_is_latin (ucs_elt->s, nsym)) { | |||
ucs_elt->freq = 0; | |||
/* Skip latin ngramm for non-latin language to avoid garbadge */ | |||
/* Skip latin ngramm for non-latin language to avoid garbage */ | |||
skipped ++; | |||
continue; | |||
} | |||
@@ -673,12 +673,12 @@ rspamd_language_detector_read_file (struct rspamd_config *cfg, | |||
nelt->mean = mean; | |||
nelt->std = std; | |||
msg_debug_lang_det_cfg ("loaded %s language, %d trigramms, " | |||
msg_debug_lang_det_cfg ("loaded %s language, %d trigrams, " | |||
"%d ngramms loaded; " | |||
"std=%.2f, mean=%.2f, skipped=%d, loaded=%d, stop_words=%d; " | |||
"(%s)", | |||
nelt->name, | |||
(gint)nelt->trigramms_words, | |||
(gint)nelt->trigrams_words, | |||
total, | |||
std, mean, | |||
skipped, loaded, nelt->stop_words, | |||
@@ -756,7 +756,7 @@ rspamd_language_detector_dtor (struct rspamd_lang_detector *d) | |||
{ | |||
if (d) { | |||
for (guint i = 0; i < RSPAMD_LANGUAGE_MAX; i ++) { | |||
kh_destroy (rspamd_trigram_hash, d->trigramms[i]); | |||
kh_destroy (rspamd_trigram_hash, d->trigrams[i]); | |||
rspamd_multipattern_destroy (d->stop_words[i].mp); | |||
g_array_free (d->stop_words[i].ranges, TRUE); | |||
} | |||
@@ -837,7 +837,7 @@ rspamd_language_detector_init (struct rspamd_config *cfg) | |||
/* Map from ngramm in ucs32 to GPtrArray of rspamd_language_elt */ | |||
for (i = 0; i < RSPAMD_LANGUAGE_MAX; i ++) { | |||
ret->trigramms[i] = kh_init (rspamd_trigram_hash); | |||
ret->trigrams[i] = kh_init (rspamd_trigram_hash); | |||
#ifdef WITH_HYPERSCAN | |||
ret->stop_words[i].mp = rspamd_multipattern_create ( | |||
RSPAMD_MULTIPATTERN_ICASE|RSPAMD_MULTIPATTERN_UTF8| | |||
@@ -872,7 +872,7 @@ rspamd_language_detector_init (struct rspamd_config *cfg) | |||
for (i = 0; i < RSPAMD_LANGUAGE_MAX; i ++) { | |||
GError *err = NULL; | |||
kh_foreach_value (ret->trigramms[i], schain, { | |||
kh_foreach_value (ret->trigrams[i], schain, { | |||
chain = &schain; | |||
rspamd_language_detector_process_chain (cfg, chain); | |||
}); | |||
@@ -883,11 +883,11 @@ rspamd_language_detector_init (struct rspamd_config *cfg) | |||
g_error_free (err); | |||
} | |||
total += kh_size (ret->trigramms[i]); | |||
total += kh_size (ret->trigrams[i]); | |||
} | |||
msg_info_config ("loaded %d languages, " | |||
"%d trigramms", | |||
"%d trigrams", | |||
(gint)ret->languages->len, | |||
(gint)total); | |||
@@ -1053,7 +1053,7 @@ rspamd_language_detector_process_ngramm_full (struct rspamd_task *task, | |||
struct rspamd_lang_detector *d, | |||
UChar32 *window, | |||
khash_t(rspamd_candidates_hash) *candidates, | |||
khash_t(rspamd_trigram_hash) *trigramms) | |||
khash_t(rspamd_trigram_hash) *trigrams) | |||
{ | |||
guint i; | |||
gint ret; | |||
@@ -1063,9 +1063,9 @@ rspamd_language_detector_process_ngramm_full (struct rspamd_task *task, | |||
khiter_t k; | |||
gdouble prob; | |||
k = kh_get (rspamd_trigram_hash, trigramms, window); | |||
if (k != kh_end (trigramms)) { | |||
chain = &kh_value (trigramms, k); | |||
k = kh_get (rspamd_trigram_hash, trigrams, window); | |||
if (k != kh_end (trigrams)) { | |||
chain = &kh_value (trigrams, k); | |||
} | |||
if (chain) { | |||
@@ -1110,7 +1110,7 @@ rspamd_language_detector_detect_word (struct rspamd_task *task, | |||
struct rspamd_lang_detector *d, | |||
rspamd_stat_token_t *tok, | |||
khash_t(rspamd_candidates_hash) *candidates, | |||
khash_t(rspamd_trigram_hash) *trigramms) | |||
khash_t(rspamd_trigram_hash) *trigrams) | |||
{ | |||
const guint wlen = 3; | |||
UChar32 window[3]; | |||
@@ -1120,7 +1120,7 @@ rspamd_language_detector_detect_word (struct rspamd_task *task, | |||
while ((cur = rspamd_language_detector_next_ngramm (tok, window, wlen, cur)) | |||
!= -1) { | |||
rspamd_language_detector_process_ngramm_full (task, | |||
d, window, candidates, trigramms); | |||
d, window, candidates, trigrams); | |||
} | |||
} | |||
@@ -1215,7 +1215,7 @@ rspamd_language_detector_detect_type (struct rspamd_task *task, | |||
if (tok->unicode.len >= 3) { | |||
rspamd_language_detector_detect_word (task, d, tok, candidates, | |||
d->trigramms[cat]); | |||
d->trigrams[cat]); | |||
} | |||
} | |||
@@ -1308,14 +1308,14 @@ rspamd_language_detector_cmp_heuristic (gconstpointer a, gconstpointer b, | |||
gdouble adj; | |||
gdouble proba_adjusted, probb_adjusted, freqa, freqb; | |||
if (cbd->d->total_occurencies == 0) { | |||
if (cbd->d->total_occurrences == 0) { | |||
return 0; | |||
} | |||
freqa = ((gdouble)canda->elt->occurencies) / | |||
(gdouble)cbd->d->total_occurencies; | |||
freqb = ((gdouble)candb->elt->occurencies) / | |||
(gdouble)cbd->d->total_occurencies; | |||
freqa = ((gdouble)canda->elt->occurrences) / | |||
(gdouble)cbd->d->total_occurrences; | |||
freqb = ((gdouble)candb->elt->occurrences) / | |||
(gdouble)cbd->d->total_occurrences; | |||
proba_adjusted = canda->prob; | |||
probb_adjusted = candb->prob; | |||
@@ -1796,7 +1796,7 @@ rspamd_language_detector_detect (struct rspamd_task *task, | |||
if (!ret) { | |||
if (part->utf_words->len < default_short_text_limit) { | |||
r = rs_detect_none; | |||
msg_debug_lang_det ("text is too short for trigramms detection: " | |||
msg_debug_lang_det ("text is too short for trigrams detection: " | |||
"%d words; at least %d words required", | |||
(int)part->utf_words->len, | |||
(int)default_short_text_limit); | |||
@@ -1832,7 +1832,7 @@ rspamd_language_detector_detect (struct rspamd_task *task, | |||
candidates); | |||
if (r == rs_detect_none) { | |||
msg_debug_lang_det ("no trigramms found, fallback to english"); | |||
msg_debug_lang_det ("no trigrams found, fallback to english"); | |||
rspamd_language_detector_set_language (task, part, "en", NULL); | |||
} else if (r == rs_detect_multiple) { | |||
/* Check our guess */ | |||
@@ -1841,7 +1841,7 @@ rspamd_language_detector_detect (struct rspamd_task *task, | |||
std = 0.0; | |||
cand_len = 0; | |||
/* Check distirbution */ | |||
/* Check distribution */ | |||
kh_foreach_value (candidates, cand, { | |||
if (!isnan (cand->prob)) { | |||
mean += cand->prob; | |||
@@ -1863,7 +1863,7 @@ rspamd_language_detector_detect (struct rspamd_task *task, | |||
std /= cand_len; | |||
} | |||
msg_debug_lang_det ("trigramms checked, %d candidates, %.3f mean, %.4f stddev", | |||
msg_debug_lang_det ("trigrams checked, %d candidates, %.3f mean, %.4f stddev", | |||
cand_len, mean, std); | |||
if (cand_len > 0 && std / fabs (mean) < 0.25) { | |||
@@ -1902,8 +1902,8 @@ rspamd_language_detector_detect (struct rspamd_task *task, | |||
if (result->len > 0 && !frequency_heuristic_applied) { | |||
cand = g_ptr_array_index (result, 0); | |||
cand->elt->occurencies++; | |||
d->total_occurencies++; | |||
cand->elt->occurrences++; | |||
d->total_occurrences++; | |||
} | |||
if (part->languages != NULL) { |
@@ -480,7 +480,7 @@ rspamd_mime_part_get_cd (struct rspamd_task *task, struct rspamd_mime_part *part | |||
cd = rspamd_mempool_alloc0 (task->task_pool, sizeof (*cd)); | |||
cd->type = RSPAMD_CT_INLINE; | |||
/* We can also have content dispositon definitions in Content-Type */ | |||
/* We can also have content disposition definitions in Content-Type */ | |||
if (part->ct && part->ct->attrs) { | |||
RSPAMD_FTOK_ASSIGN (&srch, "name"); | |||
found = g_hash_table_lookup (part->ct->attrs, &srch); | |||
@@ -539,7 +539,7 @@ rspamd_mime_part_get_cd (struct rspamd_task *task, struct rspamd_mime_part *part | |||
cd = rspamd_mempool_alloc0 (task->task_pool, sizeof (*cd)); | |||
cd->type = RSPAMD_CT_INLINE; | |||
/* We can also have content dispositon definitions in Content-Type */ | |||
/* We can also have content disposition definitions in Content-Type */ | |||
if (part->ct->attrs) { | |||
RSPAMD_FTOK_ASSIGN (&srch, "name"); | |||
found = g_hash_table_lookup (part->ct->attrs, &srch); |
@@ -583,7 +583,7 @@ received_process_from(rspamd_mempool_t *pool, | |||
if (!seen_ip_in_data) { | |||
if (rh.real_ip.size() != 0) { | |||
/* Get anounced hostname (usually helo) */ | |||
/* Get announced hostname (usually helo) */ | |||
received_process_rdns(pool, | |||
rpart.data.as_view(), | |||
rh.from_hostname); |
@@ -142,7 +142,7 @@ rspamd_add_passthrough_result (struct rspamd_task *task, | |||
scan_result = task->result; | |||
} | |||
/* Find the speicific action config */ | |||
/* Find the specific action config */ | |||
struct rspamd_action_config *action_config = NULL; | |||
for (unsigned int i = 0; i < scan_result->nactions; i ++) { |
@@ -129,7 +129,7 @@ enum rspamd_symbol_flags { | |||
RSPAMD_SYMBOL_FLAG_NORMAL = 0, | |||
RSPAMD_SYMBOL_FLAG_IGNORE_METRIC = (1 << 1), | |||
RSPAMD_SYMBOL_FLAG_ONEPARAM = (1 << 2), | |||
RSPAMD_SYMBOL_FLAG_UNGROUPPED = (1 << 3), | |||
RSPAMD_SYMBOL_FLAG_UNGROUPED = (1 << 3), | |||
RSPAMD_SYMBOL_FLAG_DISABLED = (1 << 4), | |||
RSPAMD_SYMBOL_FLAG_UNSCORED = (1 << 5), | |||
}; |
@@ -1106,7 +1106,7 @@ rspamd_include_map_handler (const guchar *data, gsize len, | |||
* $RUNDIR - local states directory | |||
* $DBDIR - databases dir | |||
* $LOGDIR - logs dir | |||
* $PLUGINSDIR - pluggins dir | |||
* $PLUGINSDIR - plugins dir | |||
* $PREFIX - installation prefix | |||
* $VERSION - rspamd version | |||
*/ | |||
@@ -1274,7 +1274,7 @@ rspamd_config_check_statfiles (struct rspamd_classifier_config *cf) | |||
/* We have only one statfile */ | |||
return FALSE; | |||
} | |||
/* We have not detected any statfile that has different class, so turn on euristic based on symbol's name */ | |||
/* We have not detected any statfile that has different class, so turn on heuristic based on symbol's name */ | |||
has_other = FALSE; | |||
cur = cf->statfiles; | |||
while (cur) { | |||
@@ -1567,11 +1567,11 @@ rspamd_config_new_symbol (struct rspamd_config *cfg, const gchar *symbol, | |||
/* Search for symbol group */ | |||
if (group == NULL) { | |||
group = "ungrouped"; | |||
sym_def->flags |= RSPAMD_SYMBOL_FLAG_UNGROUPPED; | |||
sym_def->flags |= RSPAMD_SYMBOL_FLAG_UNGROUPED; | |||
} | |||
else { | |||
if (strcmp (group, "ungrouped") == 0) { | |||
sym_def->flags |= RSPAMD_SYMBOL_FLAG_UNGROUPPED; | |||
sym_def->flags |= RSPAMD_SYMBOL_FLAG_UNGROUPED; | |||
} | |||
} | |||
@@ -1584,7 +1584,7 @@ rspamd_config_new_symbol (struct rspamd_config *cfg, const gchar *symbol, | |||
sym_def->gr = sym_group; | |||
g_hash_table_insert (sym_group->symbols, sym_def->name, sym_def); | |||
if (!(sym_def->flags & RSPAMD_SYMBOL_FLAG_UNGROUPPED)) { | |||
if (!(sym_def->flags & RSPAMD_SYMBOL_FLAG_UNGROUPED)) { | |||
g_ptr_array_add (sym_def->groups, sym_group); | |||
} | |||
} | |||
@@ -1622,7 +1622,7 @@ rspamd_config_add_symbol (struct rspamd_config *cfg, | |||
} | |||
if (!has_group) { | |||
/* Non-empty group has a priority over non-groupped one */ | |||
/* Non-empty group has a priority over non-grouped one */ | |||
sym_group = g_hash_table_lookup (cfg->groups, group); | |||
if (sym_group == NULL) { | |||
@@ -1630,13 +1630,13 @@ rspamd_config_add_symbol (struct rspamd_config *cfg, | |||
sym_group = rspamd_config_new_group (cfg, group); | |||
} | |||
if ((!sym_def->gr) || (sym_def->flags & RSPAMD_SYMBOL_FLAG_UNGROUPPED)) { | |||
if ((!sym_def->gr) || (sym_def->flags & RSPAMD_SYMBOL_FLAG_UNGROUPED)) { | |||
sym_def->gr = sym_group; | |||
sym_def->flags &= ~RSPAMD_SYMBOL_FLAG_UNGROUPPED; | |||
sym_def->flags &= ~RSPAMD_SYMBOL_FLAG_UNGROUPED; | |||
} | |||
g_hash_table_insert (sym_group->symbols, sym_def->name, sym_def); | |||
sym_def->flags &= ~(RSPAMD_SYMBOL_FLAG_UNGROUPPED); | |||
sym_def->flags &= ~(RSPAMD_SYMBOL_FLAG_UNGROUPED); | |||
g_ptr_array_add (sym_def->groups, sym_group); | |||
} | |||
} | |||
@@ -1755,7 +1755,7 @@ rspamd_config_add_symbol_group (struct rspamd_config *cfg, | |||
} | |||
if (!has_group) { | |||
/* Non-empty group has a priority over non-groupped one */ | |||
/* Non-empty group has a priority over non-grouped one */ | |||
sym_group = g_hash_table_lookup (cfg->groups, group); | |||
if (sym_group == NULL) { | |||
@@ -1768,7 +1768,7 @@ rspamd_config_add_symbol_group (struct rspamd_config *cfg, | |||
} | |||
g_hash_table_insert (sym_group->symbols, sym_def->name, sym_def); | |||
sym_def->flags &= ~(RSPAMD_SYMBOL_FLAG_UNGROUPPED); | |||
sym_def->flags &= ~(RSPAMD_SYMBOL_FLAG_UNGROUPED); | |||
g_ptr_array_add (sym_def->groups, sym_group); | |||
return TRUE; |
@@ -114,7 +114,7 @@ public: | |||
/** | |||
* Compile CSS declaration to the html block | |||
* @param pool used to carry memory requred for html_block | |||
* @param pool used to carry memory required for html_block | |||
* @return html block structure | |||
*/ | |||
auto compile_to_block(rspamd_mempool_t *pool) const -> rspamd::html::html_block *; |
@@ -289,7 +289,7 @@ rspamd_dkim_key_t *rspamd_dkim_parse_key (const gchar *txt, gsize *keylen, | |||
GError **err); | |||
/** | |||
* Canonocalise header using relaxed algorithm | |||
* Canonicalise header using relaxed algorithm | |||
* @param hname | |||
* @param hvalue | |||
* @param out |
@@ -335,7 +335,7 @@ rspamd_fuzzy_digest_hash (gconstpointer key) | |||
{ | |||
guint ret; | |||
/* Distirbuted uniformly already */ | |||
/* Distributed uniformly already */ | |||
memcpy (&ret, key, sizeof (ret)); | |||
return ret; |
@@ -250,7 +250,7 @@ html_parse_tag_content(rspamd_mempool_t *pool, | |||
ignore_bad_tag, | |||
tag_end, | |||
slash_after_value, | |||
slash_in_unqouted_value, | |||
slash_in_unquoted_value, | |||
} state; | |||
state = static_cast<enum tag_parser_state>(parser_env.cur_state); | |||
@@ -418,7 +418,7 @@ html_parse_tag_content(rspamd_mempool_t *pool, | |||
*/ | |||
if (*in == '>') { | |||
/* | |||
* Attribtute name followed by end of tag | |||
* Attribute name followed by end of tag | |||
* Should be okay (empty attribute). The rest is handled outside | |||
* this automata. | |||
*/ | |||
@@ -514,7 +514,7 @@ html_parse_tag_content(rspamd_mempool_t *pool, | |||
case parse_value: | |||
if (*in == '/') { | |||
state = slash_in_unqouted_value; | |||
state = slash_in_unquoted_value; | |||
} | |||
else if (g_ascii_isspace (*in) || *in == '>' || *in == '"') { | |||
store_component_value(); | |||
@@ -570,9 +570,9 @@ html_parse_tag_content(rspamd_mempool_t *pool, | |||
state = parse_attr_name; | |||
} | |||
break; | |||
case slash_in_unqouted_value: | |||
case slash_in_unquoted_value: | |||
if (*in == '>') { | |||
/* That slash was in fact closing tag slash, wohoo */ | |||
/* That slash was in fact closing tag slash, woohoo */ | |||
tag->flags |= FL_CLOSED; | |||
state = tag_end; | |||
store_component_value(); |
@@ -237,7 +237,7 @@ html_check_displayed_url(rspamd_mempool_t *pool, | |||
gsize dlen; | |||
if (visible_part.empty()) { | |||
/* No dispalyed url, just some text within <a> tag */ | |||
/* No displayed url, just some text within <a> tag */ | |||
return; | |||
} | |||
@@ -1353,7 +1353,7 @@ rspamd_http_connection_copy_msg (struct rspamd_http_message *msg, GError **err) | |||
if (msg->body_buf.len > 0) { | |||
if (msg->flags & RSPAMD_HTTP_FLAG_SHMEM) { | |||
/* Avoid copying by just maping a shared segment */ | |||
/* Avoid copying by just mapping a shared segment */ | |||
new_msg->flags |= RSPAMD_HTTP_FLAG_SHMEM_IMMUTABLE; | |||
storage = &new_msg->body_buf.c; |
@@ -129,7 +129,7 @@ rspamd_http_context_parse_proxy (struct rspamd_http_context *ctx, | |||
struct upstream_list *uls; | |||
if (!ctx->ups_ctx) { | |||
msg_err ("cannot parse http_proxy %s - upstreams context is udefined", name); | |||
msg_err ("cannot parse http_proxy %s - upstreams context is undefined", name); | |||
return; | |||
} | |||
@@ -466,12 +466,12 @@ rspamd_common_logv (rspamd_logger_t *rspamd_log, gint level_flags, | |||
if (!(rspamd_log->flags & RSPAMD_LOG_FLAG_RSPAMADM)) { | |||
if ((nescaped = rspamd_log_line_need_escape (logbuf, end - logbuf)) != 0) { | |||
gsize unsecaped_len = end - logbuf; | |||
gchar *logbuf_escaped = g_alloca (unsecaped_len + nescaped * 4); | |||
gsize unescaped_len = end - logbuf; | |||
gchar *logbuf_escaped = g_alloca (unescaped_len + nescaped * 4); | |||
log_line = logbuf_escaped; | |||
end = rspamd_log_line_hex_escape (logbuf, unsecaped_len, | |||
logbuf_escaped, unsecaped_len + nescaped * 4); | |||
end = rspamd_log_line_hex_escape (logbuf, unescaped_len, | |||
logbuf_escaped, unescaped_len + nescaped * 4); | |||
} | |||
} | |||
@@ -1128,7 +1128,7 @@ rspamd_map_schedule_periodic (struct rspamd_map *map, int how) | |||
/* Now, we do some sanity checks for jittered seconds */ | |||
if (!(how & RSPAMD_MAP_SCHEDULE_INIT)) { | |||
/* Never allow too low interval between timer checks, it is epxensive */ | |||
/* Never allow too low interval between timer checks, it is expensive */ | |||
if (jittered_sec < min_timer_interval) { | |||
jittered_sec = rspamd_time_jitter (min_timer_interval, 0); | |||
} |
@@ -1308,7 +1308,7 @@ rspamd_re_map_finalize (struct rspamd_regexp_map_helper *re_map) | |||
#if !defined(__aarch64__) && !defined(__powerpc64__) | |||
if (!(map->cfg->libs_ctx->crypto_ctx->cpu_config & CPUID_SSSE3)) { | |||
msg_info_map ("disable hyperscan for map %s, ssse3 instructons are not supported by CPU", | |||
msg_info_map ("disable hyperscan for map %s, ssse3 instructions are not supported by CPU", | |||
map->name); | |||
return; | |||
} |
@@ -441,7 +441,7 @@ rspamd_re_cache_init (struct rspamd_re_cache *cache, struct rspamd_config *cfg) | |||
sizeof (fl)); | |||
rspamd_cryptobox_hash_update (&st_global, (const guchar *) &fl, | |||
sizeof (fl)); | |||
/* Numberic order */ | |||
/* Numeric order */ | |||
rspamd_cryptobox_hash_update (re_class->st, (const guchar *)&i, | |||
sizeof (i)); | |||
rspamd_cryptobox_hash_update (&st_global, (const guchar *)&i, | |||
@@ -1744,7 +1744,7 @@ static gchar * | |||
rspamd_re_cache_hs_pattern_from_pcre (rspamd_regexp_t *re) | |||
{ | |||
/* | |||
* Workaroung for bug in ragel 7.0.0.11 | |||
* Workaround for bug in ragel 7.0.0.11 | |||
* https://github.com/intel/hyperscan/issues/133 | |||
*/ | |||
const gchar *pat = rspamd_regexp_get_pattern (re); |
@@ -424,7 +424,7 @@ cache_logic_cmp (const void *p1, const void *p2, gpointer ud) | |||
if (o1 == o2) { | |||
/* Heurstic */ | |||
/* Heuristic */ | |||
if (i1->priority == i2->priority) { | |||
avg_freq = ((gdouble) cache->total_hits / cache->used_items); | |||
avg_weight = (cache->total_weight / cache->used_items); | |||
@@ -3194,7 +3194,7 @@ rspamd_symcache_finalize_item (struct rspamd_task *task, | |||
* one more time | |||
*/ | |||
msg_debug_cache_task ("postpone finalisation of %s(%d) as there are %d " | |||
"async events pendning", | |||
"async events pending", | |||
item->symbol, item->id, dyn_item->async_events); | |||
return; |
@@ -528,7 +528,7 @@ gboolean rspamd_symcache_is_item_allowed (struct rspamd_task *task, | |||
gboolean exec_only); | |||
/** | |||
* Returns symbcache item flags | |||
* Returns symcache item flags | |||
* @param item | |||
* @return | |||
*/ | |||
@@ -547,7 +547,7 @@ const gchar* rspamd_symcache_item_name (struct rspamd_symcache_item *item); | |||
const struct rspamd_symcache_item_stat * | |||
rspamd_symcache_item_stat (struct rspamd_symcache_item *item); | |||
/** | |||
* Returns if an item is enabled (for virutal it also means that parent should be enabled) | |||
* Returns if an item is enabled (for virtual it also means that parent should be enabled) | |||
* @param item | |||
* @return | |||
*/ |
@@ -44,7 +44,7 @@ | |||
struct spf_resolved_element { | |||
GPtrArray *elts; | |||
gchar *cur_domain; | |||
gboolean redirected; /* Ingnore level, it's redirected */ | |||
gboolean redirected; /* Ignore level, it's redirected */ | |||
}; | |||
struct spf_record { | |||
@@ -796,7 +796,7 @@ spf_process_txt_record (struct spf_record *rec, struct spf_resolved_element *res | |||
gboolean ret = FALSE; | |||
/* | |||
* We prefer spf version 1 as other records are mostly likely garbadge | |||
* We prefer spf version 1 as other records are mostly likely garbage | |||
* or incorrect records (e.g. spf2 records) | |||
*/ | |||
LL_FOREACH (reply->entries, elt) { | |||
@@ -1134,7 +1134,7 @@ parse_spf_domain_mask (struct spf_record *rec, struct spf_addr *addr, | |||
parse_ipv4_mask, | |||
parse_second_slash, | |||
parse_ipv6_mask, | |||
skip_garbadge | |||
skip_garbage | |||
} state = 0; | |||
const gchar *p = addr->spf_string, *host, *c; | |||
gchar *hostbuf; | |||
@@ -1183,7 +1183,7 @@ parse_spf_domain_mask (struct spf_record *rec, struct spf_addr *addr, | |||
state = parse_ipv4_mask; | |||
} | |||
else { | |||
state = skip_garbadge; | |||
state = skip_garbage; | |||
} | |||
cur_mask = 0; | |||
break; | |||
@@ -1216,7 +1216,7 @@ parse_spf_domain_mask (struct spf_record *rec, struct spf_addr *addr, | |||
} | |||
p++; | |||
break; | |||
case skip_garbadge: | |||
case skip_garbage: | |||
p++; | |||
break; | |||
} |
@@ -32,7 +32,7 @@ extern "C" { | |||
enum rspamd_command { | |||
CMD_SKIP = 0, | |||
CMD_PING, | |||
CMD_CHECK_SPAMC, /* Legacy spamasassin format */ | |||
CMD_CHECK_SPAMC, /* Legacy spamassassin format */ | |||
CMD_CHECK_RSPAMC, /* Legacy rspamc format (like SA one) */ | |||
CMD_CHECK, /* Legacy check - metric json reply */ | |||
CMD_CHECK_V2, /* Modern check - symbols in json reply */ |
@@ -230,7 +230,7 @@ struct rspamd_url_flag_name { | |||
{"schema_encoded", RSPAMD_URL_FLAG_SCHEMAENCODED, -1}, | |||
{"path_encoded", RSPAMD_URL_FLAG_PATHENCODED, -1}, | |||
{"query_encoded", RSPAMD_URL_FLAG_QUERYENCODED, -1}, | |||
{"missing_slahes", RSPAMD_URL_FLAG_MISSINGSLASHES, -1}, | |||
{"missing_slashes", RSPAMD_URL_FLAG_MISSINGSLASHES, -1}, | |||
{"idn", RSPAMD_URL_FLAG_IDN, -1}, | |||
{"has_port", RSPAMD_URL_FLAG_HAS_PORT, -1}, | |||
{"has_user", RSPAMD_URL_FLAG_HAS_USER, -1}, |
@@ -140,7 +140,7 @@ void rspamd_url_deinit(void); | |||
* @param pool memory pool | |||
* @param task task object | |||
* @param part current text part | |||
* @param is_html turn on html euristic | |||
* @param is_html turn on html heuristic | |||
*/ | |||
void rspamd_url_text_extract(rspamd_mempool_t *pool, | |||
struct rspamd_task *task, |
@@ -682,7 +682,7 @@ rspamd_controller_send_ucl (struct rspamd_http_connection_entry *entry, | |||
static void | |||
rspamd_worker_drop_priv (struct rspamd_main *rspamd_main) | |||
{ | |||
if (rspamd_main->is_privilleged) { | |||
if (rspamd_main->is_privileged) { | |||
if (setgid (rspamd_main->workers_gid) == -1) { | |||
msg_err_main ("cannot setgid to %d (%s), aborting", | |||
(gint) rspamd_main->workers_gid, |
@@ -88,7 +88,7 @@ typedef gint (*rspamd_controller_func_t) ( | |||
struct rspamd_custom_controller_command { | |||
const gchar *command; | |||
struct module_ctx *ctx; | |||
gboolean privilleged; | |||
gboolean privileged; | |||
gboolean require_message; | |||
rspamd_controller_func_t handler; | |||
}; |
@@ -449,13 +449,13 @@ rspamd_stat_cache_redis_check (struct rspamd_task *task, | |||
gchar *h; | |||
if (rspamd_session_blocked (task->s)) { | |||
return RSPAMD_LEARN_INGORE; | |||
return RSPAMD_LEARN_IGNORE; | |||
} | |||
h = rspamd_mempool_get_variable (task->task_pool, "words_hash"); | |||
if (h == NULL) { | |||
return RSPAMD_LEARN_INGORE; | |||
return RSPAMD_LEARN_IGNORE; | |||
} | |||
if (redisAsyncCommand (rt->redis, rspamd_stat_cache_redis_get, rt, | |||
@@ -483,7 +483,7 @@ rspamd_stat_cache_redis_learn (struct rspamd_task *task, | |||
gint flag; | |||
if (rt == NULL || rt->ctx == NULL || rspamd_session_blocked (task->s)) { | |||
return RSPAMD_LEARN_INGORE; | |||
return RSPAMD_LEARN_IGNORE; | |||
} | |||
h = rspamd_mempool_get_variable (task->task_pool, "words_hash"); |
@@ -184,7 +184,7 @@ rspamd_stat_cache_sqlite3_check (struct rspamd_task *task, | |||
gint64 flag; | |||
if (task->tokens == NULL || task->tokens->len == 0) { | |||
return RSPAMD_LEARN_INGORE; | |||
return RSPAMD_LEARN_IGNORE; | |||
} | |||
if (ctx != NULL && ctx->db != NULL) { | |||
@@ -223,7 +223,7 @@ rspamd_stat_cache_sqlite3_check (struct rspamd_task *task, | |||
/* Already learned */ | |||
msg_warn_task ("already seen stat hash: %*bs", | |||
rspamd_cryptobox_HASHBYTES, out); | |||
return RSPAMD_LEARN_INGORE; | |||
return RSPAMD_LEARN_IGNORE; | |||
} | |||
else { | |||
/* Need to relearn */ | |||
@@ -248,7 +248,7 @@ rspamd_stat_cache_sqlite3_learn (struct rspamd_task *task, | |||
h = rspamd_mempool_get_variable (task->task_pool, "words_hash"); | |||
if (h == NULL) { | |||
return RSPAMD_LEARN_INGORE; | |||
return RSPAMD_LEARN_IGNORE; | |||
} | |||
flag = !!is_spam ? 1 : 0; |
@@ -105,7 +105,7 @@ struct rspamd_stat_ctx { | |||
typedef enum rspamd_learn_cache_result { | |||
RSPAMD_LEARN_OK = 0, | |||
RSPAMD_LEARN_UNLEARN, | |||
RSPAMD_LEARN_INGORE | |||
RSPAMD_LEARN_IGNORE | |||
} rspamd_learn_t; | |||
struct rspamd_stat_ctx *rspamd_stat_get_ctx (void); |
@@ -29,7 +29,7 @@ | |||
#define RSPAMD_LEARN_OP 1 | |||
#define RSPAMD_UNLEARN_OP 2 | |||
static const gdouble similarity_treshold = 80.0; | |||
static const gdouble similarity_threshold = 80.0; | |||
static void | |||
rspamd_stat_tokenize_parts_metadata (struct rspamd_stat_ctx *st_ctx, | |||
@@ -153,7 +153,7 @@ rspamd_stat_process_tokenize (struct rspamd_stat_ctx *st_ctx, | |||
} | |||
if (pdiff != NULL && (1.0 - *pdiff) * 100.0 > similarity_treshold) { | |||
if (pdiff != NULL && (1.0 - *pdiff) * 100.0 > similarity_threshold) { | |||
msg_debug_bayes ("message has two common parts (%.2f), so skip the last one", | |||
*pdiff); | |||
break; | |||
@@ -540,7 +540,7 @@ rspamd_stat_cache_check (struct rspamd_stat_ctx *st_ctx, | |||
learn_res = cl->cache->check (task, spam, rt); | |||
} | |||
if (learn_res == RSPAMD_LEARN_INGORE) { | |||
if (learn_res == RSPAMD_LEARN_IGNORE) { | |||
/* Do not learn twice */ | |||
g_set_error (err, rspamd_stat_quark (), 404, "<%s> has been already " | |||
"learned as %s, ignore it", MESSAGE_FIELD (task, message_id), | |||
@@ -1038,7 +1038,7 @@ rspamd_stat_check_autolearn (struct rspamd_task *task) | |||
} | |||
} | |||
else if (ucl_object_type (obj) == UCL_STRING) { | |||
/* Legacy sript */ | |||
/* Legacy script */ | |||
lua_script = ucl_object_tostring (obj); | |||
if (luaL_dostring (L, lua_script) != 0) { |
@@ -60,7 +60,7 @@ void *rspamd_inet_library_get_lib_ctx (void); | |||
void rspamd_inet_library_destroy (void); | |||
/** | |||
* Create new inet address structure based on the address familiy and opaque init pointer | |||
* Create new inet address structure based on the address family and opaque init pointer | |||
* @param af | |||
* @param init | |||
* @return new inet addr |
@@ -22,7 +22,7 @@ typedef struct rspamd_lru_element_s rspamd_lru_element_t; | |||
/** | |||
* Create new lru hash | |||
* @param maxsize maximum elements in a hash | |||
* @param maxage maximum age of elemnt | |||
* @param maxage maximum age of element | |||
* @param hash_func pointer to hash function | |||
* @param key_equal_func pointer to function for comparing keys | |||
* @return new rspamd_hash object | |||
@@ -35,7 +35,7 @@ rspamd_lru_hash_t *rspamd_lru_hash_new (gint maxsize, | |||
/** | |||
* Create new lru hash | |||
* @param maxsize maximum elements in a hash | |||
* @param maxage maximum age of elemnt | |||
* @param maxage maximum age of element | |||
* @param hash_func pointer to hash function | |||
* @param key_equal_func pointer to function for comparing keys | |||
* @return new rspamd_hash object |
@@ -703,7 +703,7 @@ rspamd_mempool_adjust_entry (struct rspamd_mempool_entry_point *e) | |||
qsort (sz, G_N_ELEMENTS (sz), sizeof (gint), cmp_int); | |||
jitter = rspamd_random_uint64_fast () % 10; | |||
/* | |||
* Take stochaistic quantiles | |||
* Take stochastic quantiles | |||
*/ | |||
sel_pos = sz[50 + jitter]; | |||
sel_neg = sz[4 + jitter]; |
@@ -355,7 +355,7 @@ gsize rspamd_mempool_get_wasted_size (rspamd_mempool_t *pool); | |||
* Set memory pool variable | |||
* @param pool memory pool object | |||
* @param name name of variable | |||
* @param gpointer value value of variable | |||
* @param gpointer value of variable | |||
* @param destructor pointer to function-destructor | |||
*/ | |||
void rspamd_mempool_set_variable (rspamd_mempool_t *pool, |
@@ -42,7 +42,7 @@ struct rrd_file_head { | |||
gdouble float_cookie; /* is it the correct double representation ? */ | |||
/* Data Base Structure Definition **** */ | |||
gulong ds_cnt; /* how many different ds provid input to the rrd */ | |||
gulong ds_cnt; /* how many different ds provide input to the rrd */ | |||
gulong rra_cnt; /* how many rras will be maintained in the rrd */ | |||
gulong pdp_step; /* pdp interval in seconds */ | |||
@@ -153,12 +153,12 @@ enum rrd_cdp_param { | |||
* prediction algorithm. */ | |||
CDP_hw_last_intercept, | |||
/* Last iteration intercept coefficient for the Holt-Winters | |||
* prediction algorihtm. */ | |||
* prediction algorithm. */ | |||
CDP_hw_slope, | |||
/* Current slope coefficient for the Holt-Winters | |||
* prediction algorithm. */ | |||
CDP_hw_last_slope, | |||
/* Last iteration slope coeffient. */ | |||
/* Last iteration slope coefficient. */ | |||
CDP_null_count, | |||
/* Number of sequential Unknown (DNAN) values + 1 preceding | |||
* the current prediction. |
@@ -50,7 +50,7 @@ typedef guint64 (*rspamd_shingles_filter) (guint64 *input, gsize count, | |||
* if needed | |||
* @param input array of `rspamd_fstring_t` | |||
* @param key secret key used to generate shingles | |||
* @param pool pool to allocate shigles array | |||
* @param pool pool to allocate shingles array | |||
* @param filter hashes filtering function | |||
* @param filterd opaque data for filtering function | |||
* @return shingles array | |||
@@ -66,7 +66,7 @@ struct rspamd_shingle *rspamd_shingles_from_text (GArray *input, | |||
* Generate shingles from the DCT matrix of an image | |||
* @param dct discrete cosine transfor matrix (must be 64x64) | |||
* @param key secret key used to generate shingles | |||
* @param pool pool to allocate shigles array | |||
* @param pool pool to allocate shingles array | |||
* @param filter hashes filtering function | |||
* @param filterd opaque data for filtering function | |||
* @return shingles array |
@@ -2465,7 +2465,7 @@ decode: | |||
continue; | |||
} | |||
else { | |||
/* Hack, hack, hack, treat =<garbadge> as =<garbadge> */ | |||
/* Hack, hack, hack, treat =<garbage> as =<garbage> */ | |||
if (end - o > 1) { | |||
*o++ = '='; | |||
*o++ = *(p - 1); |
@@ -752,7 +752,7 @@ rspamd_upstream_set_inactive (struct upstream_list *ls, struct upstream *upstrea | |||
g_ptr_array_remove_index (ls->alive, upstream->active_idx); | |||
upstream->active_idx = -1; | |||
/* We need to update all indicies */ | |||
/* We need to update all indices */ | |||
for (i = 0; i < ls->alive->len; i ++) { | |||
cur = g_ptr_array_index (ls->alive, i); | |||
cur->active_idx = i; |
@@ -249,7 +249,7 @@ gboolean rspamd_upstream_add_addr (struct upstream *up, | |||
const gchar *rspamd_upstream_name (struct upstream *up); | |||
/** | |||
* Returns the port of the current addres for the upstream | |||
* Returns the port of the current address for the upstream | |||
* @param up | |||
* @return | |||
*/ |
@@ -372,7 +372,7 @@ rspamd_prefer_v4_hack (const struct addrinfo *a1, const struct addrinfo *a2) | |||
* Make a universal socket | |||
* @param credits host, ip or path to unix socket | |||
* @param port port (used for network sockets) | |||
* @param async make this socket asynced | |||
* @param async make this socket async | |||
* @param is_server make this socket as server socket | |||
* @param try_resolve try name resolution for a socket (BLOCKING) | |||
*/ | |||
@@ -764,7 +764,7 @@ rspamd_pidfile_open (const gchar *path, mode_t mode, pid_t * pidptr) | |||
/* | |||
* Open the PID file and obtain exclusive lock. | |||
* We truncate PID file here only to remove old PID immediatelly, | |||
* We truncate PID file here only to remove old PID immediately, | |||
* PID file will be truncated again in pidfile_write(), so | |||
* pidfile_write() can be called multiple times. | |||
*/ |
@@ -70,7 +70,7 @@ gint rspamd_socket_unix (const gchar *, | |||
* @param credits host, ip or path to unix socket | |||
* @param port port (used for network sockets) | |||
* @param type type of socket (SO_STREAM or SO_DGRAM) | |||
* @param async make this socket asynced | |||
* @param async make this socket async | |||
* @param is_server make this socket as server socket | |||
* @param try_resolve try name resolution for a socket (BLOCKING) | |||
*/ |
@@ -256,7 +256,7 @@ LUA_FUNCTION_DEF (config, register_callback_symbol_priority); | |||
/*** | |||
* @method rspamd_config:register_dependency(id|name, depname) | |||
* Create a dependency on symbol identified by name for symbol identified by ID or name. | |||
* This affects order of checks only (a symbol is still checked if its dependencys are disabled). | |||
* This affects order of checks only (a symbol is still checked if its dependencies are disabled). | |||
* @param {number|string} id id or name of source (numeric id is returned by all register_*_symbol) | |||
* @param {string} depname dependency name | |||
* @example | |||
@@ -350,7 +350,7 @@ LUA_FUNCTION_DEF (config, get_metric_symbol); | |||
/** | |||
* @method rspamd_config:get_action(name) | |||
* Gets data for a specific action in config. This function returns number reperesenting action's score | |||
* Gets data for a specific action in config. This function returns number representing action's score | |||
* | |||
* @param {string} name name of action | |||
* @return {number} action's score or nil in case of undefined score or action | |||
@@ -495,7 +495,7 @@ LUA_FUNCTION_DEF (config, register_settings_id); | |||
/*** | |||
* @method rspamd_config:__newindex(name, callback) | |||
* This metamethod is called if new indicies are added to the `rspamd_config` object. | |||
* This metamethod is called if new indices are added to the `rspamd_config` object. | |||
* Technically, it is the equivalent of @see rspamd_config:register_symbol where `weight` is 1.0. | |||
* There is also table form invocation that allows to control more things: | |||
* | |||
@@ -734,7 +734,7 @@ LUA_FUNCTION_DEF (config, register_monitored); | |||
* | |||
* - `default`: default option value | |||
* - `type`: type of an option (`string`, `number`, `object`, `array` etc) | |||
* - `reqired`: if an option is required | |||
* - `required`: if an option is required | |||
* | |||
* @param {string} path documentation path (e.g. module name) | |||
* @param {string} option name of the option | |||
@@ -2885,7 +2885,7 @@ lua_config_newindex (lua_State *L) | |||
} | |||
else | |||
{ | |||
/* Fill in missing fields from lua defintion if they are not set */ | |||
/* Fill in missing fields from lua definition if they are not set */ | |||
if (sym->description == NULL) { | |||
lua_pushstring (L, "description"); | |||
lua_gettable (L, -2); | |||
@@ -2909,12 +2909,12 @@ lua_config_newindex (lua_State *L) | |||
} | |||
lua_pop (L, 1); | |||
if (group) { | |||
if (sym->flags & RSPAMD_SYMBOL_FLAG_UNGROUPPED) { | |||
if (sym->flags & RSPAMD_SYMBOL_FLAG_UNGROUPED) { | |||
/* Unset the "ungrouped" group */ | |||
sym->gr = NULL; | |||
} | |||
/* Add the group. If the symbol was ungrouped, this will | |||
* clear RSPAMD_SYMBOL_FLAG_UNGROUPPED from the flags. */ | |||
* clear RSPAMD_SYMBOL_FLAG_UNGROUPED from the flags. */ | |||
rspamd_config_add_symbol_group (cfg, name, group); | |||
} | |||
} | |||
@@ -3570,8 +3570,8 @@ lua_metric_symbol_inserter (gpointer k, gpointer v, gpointer ud) | |||
lua_pushboolean (L, true); | |||
lua_settable (L, -3); | |||
} | |||
if (s->flags & RSPAMD_SYMBOL_FLAG_UNGROUPPED) { | |||
lua_pushstring (L, "ungroupped"); | |||
if (s->flags & RSPAMD_SYMBOL_FLAG_UNGROUPED) { | |||
lua_pushstring (L, "ungrouped"); | |||
lua_pushboolean (L, true); | |||
lua_settable (L, -3); | |||
} |
@@ -532,7 +532,7 @@ err: | |||
* * `mempool` - pool memory pool for storing intermediate data | |||
* * `name` - host name to resolve | |||
* * `callback` - callback callback function to be called upon name resolution is finished; must be of type `function (resolver, to_resolve, results, err)` | |||
* * `forced` - true if needed to override notmal limit for DNS requests | |||
* * `forced` - true if needed to override normal limit for DNS requests | |||
* @return {boolean} `true` if DNS request has been scheduled | |||
*/ | |||
static int | |||
@@ -562,7 +562,7 @@ lua_dns_resolver_resolve_a (lua_State *L) | |||
* * `mempool` - pool memory pool for storing intermediate data | |||
* * `name` - host name to resolve | |||
* * `callback` - callback callback function to be called upon name resolution is finished; must be of type `function (resolver, to_resolve, results, err)` | |||
* * `forced` - true if needed to override notmal limit for DNS requests | |||
* * `forced` - true if needed to override normal limit for DNS requests | |||
* @return {boolean} `true` if DNS request has been scheduled | |||
*/ | |||
static int | |||
@@ -592,7 +592,7 @@ lua_dns_resolver_resolve_ptr (lua_State *L) | |||
* * `mempool` - pool memory pool for storing intermediate data | |||
* * `name` - host name to resolve | |||
* * `callback` - callback callback function to be called upon name resolution is finished; must be of type `function (resolver, to_resolve, results, err)` | |||
* * `forced` - true if needed to override notmal limit for DNS requests | |||
* * `forced` - true if needed to override normal limit for DNS requests | |||
* @return {boolean} `true` if DNS request has been scheduled | |||
*/ | |||
static int | |||
@@ -622,7 +622,7 @@ lua_dns_resolver_resolve_txt (lua_State *L) | |||
* * `mempool` - pool memory pool for storing intermediate data | |||
* * `name` - host name to resolve | |||
* * `callback` - callback callback function to be called upon name resolution is finished; must be of type `function (resolver, to_resolve, results, err)` | |||
* * `forced` - true if needed to override notmal limit for DNS requests | |||
* * `forced` - true if needed to override normal limit for DNS requests | |||
* @return {boolean} `true` if DNS request has been scheduled | |||
*/ | |||
static int | |||
@@ -652,7 +652,7 @@ lua_dns_resolver_resolve_mx (lua_State *L) | |||
* * `mempool` - pool memory pool for storing intermediate data | |||
* * `name` - host name to resolve | |||
* * `callback` - callback callback function to be called upon name resolution is finished; must be of type `function (resolver, to_resolve, results, err)` | |||
* * `forced` - true if needed to override notmal limit for DNS requests | |||
* * `forced` - true if needed to override normal limit for DNS requests | |||
* @return {boolean} `true` if DNS request has been scheduled | |||
*/ | |||
static int |
@@ -318,7 +318,7 @@ LUA_FUNCTION_DEF (mimepart, get_header_full); | |||
* * By default headers are searched in caseless matter. | |||
* @param {string} name name of header to get | |||
* @param {boolean} case_sensitive case sensitiveness flag to search for a header | |||
* @return {number} number of header's occurrencies or 0 if not found | |||
* @return {number} number of header's occurrences or 0 if not found | |||
*/ | |||
LUA_FUNCTION_DEF (mimepart, get_header_count); | |||
@@ -559,7 +559,7 @@ LUA_FUNCTION_DEF (mimepart, is_specific); | |||
/*** | |||
* @method mime_part:get_urls([need_emails|list_protos][, need_images]) | |||
* Get all URLs found in a mime part. Telephone urls and emails are not included unless explicitly asked in `list_protos` | |||
* @param {boolean} need_emails if `true` then reutrn also email urls, this can be a comma separated string of protocols desired or a table (e.g. `mailto` or `telephone`) | |||
* @param {boolean} need_emails if `true` then return also email urls, this can be a comma separated string of protocols desired or a table (e.g. `mailto` or `telephone`) | |||
* @param {boolean} need_images return urls from images (<img src=...>) as well | |||
* @return {table rspamd_url} list of all urls found | |||
*/ | |||
@@ -1868,7 +1868,7 @@ lua_mimepart_is_attachment (lua_State * L) | |||
lua_pushboolean (L, true); | |||
} | |||
else { | |||
/* Image or an embeded object */ | |||
/* Image or an embedded object */ | |||
lua_pushboolean (L, false); | |||
} | |||
} |
@@ -188,7 +188,7 @@ lua_redis_dtor (struct lua_redis_ctx *ctx) | |||
struct redisAsyncContext *ac; | |||
ud = &ctx->async; | |||
msg_debug_lua_redis ("desctructing %p", ctx); | |||
msg_debug_lua_redis ("destructing %p", ctx); | |||
if (ud->ctx) { | |||
@@ -792,7 +792,7 @@ lua_regexp_split (lua_State *L) | |||
/*** | |||
* @method re:destroy() | |||
* Destroy regexp from caches if needed (the pointer is removed by garbadge collector) | |||
* Destroy regexp from caches if needed (the pointer is removed by garbage collector) | |||
*/ | |||
static gint | |||
lua_regexp_destroy (lua_State *L) |
@@ -174,7 +174,7 @@ LUA_FUNCTION_DEF (task, adjust_result); | |||
/*** | |||
* @method task:remove_result(symbol[, shadow_result]) | |||
* Removes the symbol from a named or unamed/default result | |||
* Removes the symbol from a named or unnamed/default result | |||
* @param {string} symbol symbol to remove | |||
* @param {string} shadow_result name of shadow result | |||
* @return {boolean} true if a symbol has been removed | |||
@@ -241,7 +241,7 @@ LUA_FUNCTION_DEF (task, append_message); | |||
/*** | |||
* @method task:get_urls([need_emails|list_protos][, need_images]) | |||
* Get all URLs found in a message. Telephone urls and emails are not included unless explicitly asked in `list_protos` | |||
* @param {boolean} need_emails if `true` then reutrn also email urls, this can be a comma separated string of protocols desired or a table (e.g. `mailto` or `telephone`) | |||
* @param {boolean} need_emails if `true` then return also email urls, this can be a comma separated string of protocols desired or a table (e.g. `mailto` or `telephone`) | |||
* @param {boolean} need_images return urls from images (<img src=...>) as well | |||
* @return {table rspamd_url} list of all urls found | |||
@example | |||
@@ -267,14 +267,14 @@ LUA_FUNCTION_DEF (task, get_urls); | |||
* - If both parameters are nil then all urls are included | |||
* @param {table} flags_include included flags | |||
* @param {table} flags_exclude excluded flags | |||
* @param {table} protocols_mask incude only specific protocols | |||
* @param {table} protocols_mask include only specific protocols | |||
* @return {table rspamd_url} list of urls matching conditions | |||
*/ | |||
LUA_FUNCTION_DEF (task, get_urls_filtered); | |||
/*** | |||
* @method task:has_urls([need_emails]) | |||
* Returns 'true' if a task has urls listed | |||
* @param {boolean} need_emails if `true` then reutrn also email urls | |||
* @param {boolean} need_emails if `true` then return also email urls | |||
* @return {boolean} true if a task has urls (urls or emails if `need_emails` is true) | |||
*/ | |||
LUA_FUNCTION_DEF (task, has_urls); | |||
@@ -413,7 +413,7 @@ LUA_FUNCTION_DEF (task, get_header_full); | |||
* * By default headers are searched in caseless matter. | |||
* @param {string} name name of header to get | |||
* @param {boolean} case_sensitive case sensitiveness flag to search for a header | |||
* @return {number} number of header's occurrencies or 0 if not found | |||
* @return {number} number of header's occurrences or 0 if not found | |||
*/ | |||
LUA_FUNCTION_DEF (task, get_header_count); | |||
/*** | |||
@@ -443,7 +443,7 @@ LUA_FUNCTION_DEF (task, get_headers); | |||
* Order in remove starts from 1, where 0 means 'remove all', and negative value means | |||
* remove from the end | |||
* Order in addition means addition from the top: 0 means the most top header, 1 one after, etc | |||
* negative order means addtion to the end, e.g. -1 is appending header. | |||
* negative order means addition to the end, e.g. -1 is appending header. | |||
* @return {bool} true if header could be modified (always true unless we don't have an unparsed message) | |||
*/ | |||
LUA_FUNCTION_DEF (task, modify_header); | |||
@@ -2269,7 +2269,7 @@ lua_task_set_pre_result (lua_State * L) | |||
RSPAMD_LUA_PARSE_ARGUMENTS_DEFAULT, | |||
"*action=S;message=S;module=S;score=D;priority=i;flags=S;result=S", | |||
&act_str, &message, &module, &score, &priority, &fl_str, &res_name)) { | |||
gint ret = luaL_error (L, "invald arguments: %s", err->message); | |||
gint ret = luaL_error (L, "invalid arguments: %s", err->message); | |||
g_error_free (err); | |||
return ret; | |||
@@ -5808,7 +5808,7 @@ lua_task_set_milter_reply (lua_State *L) | |||
* UCL itself cannot do it directly. So the trick is to extract the | |||
* original object, pack it into an array and then insert it back. | |||
* | |||
* I wish there was a simplier way to do it... | |||
* I wish there was a simpler way to do it... | |||
*/ | |||
const ucl_object_t *add_hdrs = ucl_object_lookup (prev, "add_headers"); | |||
const ucl_object_t *nadd_hdrs = ucl_object_lookup (reply, "add_headers"); | |||
@@ -7025,7 +7025,7 @@ lua_image_get_filename (lua_State *L) | |||
return 1; | |||
} | |||
/* Arvhive methods */ | |||
/* Archive methods */ | |||
static gint | |||
lua_archive_get_type (lua_State *L) | |||
{ |
@@ -100,7 +100,7 @@ LUA_FUNCTION_DEF (tcp, request); | |||
* @function rspamd_tcp.connect_sync() | |||
* | |||
* Creates pseudo-synchronous TCP connection. | |||
* Each method of the connection requiring IO, becames a yielding point, | |||
* Each method of the connection requiring IO, becomes a yielding point, | |||
* i.e. current thread Lua thread is get suspended and resumes as soon as IO is done | |||
* | |||
* This class represents low-level API, using of "lua_tcp_sync" module is recommended. |
@@ -101,7 +101,7 @@ LUA_FUNCTION_DEF (text, save_in_file); | |||
LUA_FUNCTION_DEF (text, span); | |||
/*** | |||
* @method rspamd_text:sub(start[, len]) | |||
* Returns a substrin for lua_text similar to string.sub from Lua | |||
* Returns a substring for lua_text similar to string.sub from Lua | |||
* @return {rspamd_text} new rspamd_text with span (must be careful when using with owned texts...) | |||
*/ | |||
LUA_FUNCTION_DEF (text, sub); | |||
@@ -194,7 +194,7 @@ LUA_FUNCTION_DEF (text, base32); | |||
* @method rspamd_text:base64([line_length, [nline, [fold]]]) | |||
* Returns a text encoded in base64 (new rspamd_text is allocated) | |||
* | |||
* @param {number} line_length return text splited with newlines up to this attribute | |||
* @param {number} line_length return text split with newlines up to this attribute | |||
* @param {string} nline newline type: `cr`, `lf`, `crlf` | |||
* @param {boolean} fold use folding when splitting into lines (false by default) | |||
* @return {rspamd_text} new text encoded in base64 |
@@ -53,7 +53,7 @@ lua_thread_pool_free (struct lua_thread_pool *pool); | |||
/** | |||
* Extracts a thread from the list of available ones. | |||
* It immediately becames running one and should be used to run a Lua script/function straight away. | |||
* It immediately becomes the running one and should be used to run a Lua script/function straight away. | |||
* as soon as the code is finished, it should be either returned into list of available threads by | |||
* calling lua_thread_pool_return() or terminated by calling lua_thread_pool_terminate_entry() | |||
* if the code finished with error. |
@@ -599,8 +599,8 @@ lua_url_get_protocol (lua_State *L) | |||
/*** | |||
* @method url:get_count() | |||
* Return number of occurrencies for this particular URL | |||
* @return {number} number of occurrencies | |||
* Return number of occurrences for this particular URL | |||
* @return {number} number of occurrences | |||
*/ | |||
static gint | |||
lua_url_get_count (lua_State *L) | |||
@@ -871,7 +871,7 @@ lua_url_all (lua_State *L) | |||
* - `host_encoded`: URL host part is encoded | |||
* - `schema_encoded`: URL schema part is encoded | |||
* - `query_encoded`: URL query part is encoded | |||
* - `missing_slahes`: URL has some slashes missing | |||
* - `missing_slashes`: URL has some slashes missing | |||
* - `idn`: URL has international characters | |||
* - `has_port`: URL has port | |||
* - `has_user`: URL has user part |
@@ -54,7 +54,7 @@ LUA_FUNCTION_DEF (util, create_event_base); | |||
LUA_FUNCTION_DEF (util, load_rspamd_config); | |||
/*** | |||
* @function util.config_from_ucl(any, string) | |||
* Load rspamd config from ucl reperesented by any lua table | |||
* Load rspamd config from ucl represented by any lua table | |||
* @return {confg} new configuration object suitable for access | |||
*/ | |||
LUA_FUNCTION_DEF (util, config_from_ucl); | |||
@@ -68,7 +68,7 @@ LUA_FUNCTION_DEF (util, config_from_ucl); | |||
LUA_FUNCTION_DEF (util, encode_base64); | |||
/*** | |||
* @function util.encode_qp(input[, str_len, [newlines_type]]) | |||
* Encodes data in quouted printable breaking lines if needed | |||
* Encodes data in quoted printable breaking lines if needed | |||
* @param {text or string} input input data | |||
* @param {number} str_len optional size of lines or 0 if split is not needed | |||
* @return {rspamd_text} encoded data chunk | |||
@@ -77,7 +77,7 @@ LUA_FUNCTION_DEF (util, encode_qp); | |||
/*** | |||
* @function util.decode_qp(input) | |||
* Decodes data from quouted printable | |||
* Decodes data from quoted printable | |||
* @param {text or string} input input data | |||
* @return {rspamd_text} decoded data chunk | |||
*/ | |||
@@ -127,9 +127,9 @@ LUA_FUNCTION_DEF (util, tokenize_text); | |||
LUA_FUNCTION_DEF (util, process_message); | |||
/*** | |||
* @function util.tanh(num) | |||
* Calculates hyperbolic tanhent of the specified floating point value | |||
* Calculates hyperbolic tangent of the specified floating point value | |||
* @param {number} num input number | |||
* @return {number} hyperbolic tanhent of the variable | |||
* @return {number} hyperbolic tangent of the variable | |||
*/ | |||
LUA_FUNCTION_DEF (util, tanh); | |||
@@ -34,7 +34,7 @@ static const struct luaL_reg xmlrpclib_m[] = { | |||
INIT_LOG_MODULE(xmlrpc) | |||
enum lua_xmlrpc_state { | |||
read_method_responce = 0, | |||
read_method_response = 0, | |||
read_params = 1, | |||
read_param = 2, | |||
read_param_value = 3, | |||
@@ -115,7 +115,7 @@ xmlrpc_start_element (GMarkupParseContext *context, | |||
msg_debug_xmlrpc ("got start element %s on state %d", name, last_state); | |||
switch (ud->parser_state) { | |||
case read_method_responce: | |||
case read_method_response: | |||
/* Expect tag methodResponse */ | |||
if (g_ascii_strcasecmp (name, "methodResponse") == 0) { | |||
ud->parser_state = read_params; | |||
@@ -342,7 +342,7 @@ xmlrpc_end_element (GMarkupParseContext *context, | |||
msg_debug_xmlrpc ("got end element %s on state %d", name, last_state); | |||
switch (ud->parser_state) { | |||
case read_method_responce: | |||
case read_method_response: | |||
ud->parser_state = error_state; | |||
break; | |||
case read_params: | |||
@@ -615,7 +615,7 @@ lua_xmlrpc_parse_reply (lua_State *L) | |||
if (data != NULL) { | |||
ud.L = L; | |||
ud.parser_state = read_method_responce; | |||
ud.parser_state = read_method_response; | |||
ud.param_count = 0; | |||
ud.st = g_queue_new (); | |||
@@ -19,7 +19,7 @@ | |||
* Allowed options: | |||
* - symbol (string): symbol to insert (default: 'R_BAD_CHARSET') | |||
* - threshold (double): value that would be used as threshold in expression characters_changed / total_characters | |||
* (e.g. if threshold is 0.1 than charset change should occure more often than in 10 symbols), default: 0.1 | |||
* (e.g. if threshold is 0.1 than charset change should occur more often than in 10 symbols), default: 0.1 | |||
*/ | |||
@@ -4081,21 +4081,21 @@ fuzzy_attach_controller (struct module_ctx *ctx, GHashTable *commands) | |||
struct rspamd_custom_controller_command *cmd; | |||
cmd = rspamd_mempool_alloc (fctx->fuzzy_pool, sizeof (*cmd)); | |||
cmd->privilleged = TRUE; | |||
cmd->privileged = TRUE; | |||
cmd->require_message = TRUE; | |||
cmd->handler = fuzzy_add_handler; | |||
cmd->ctx = ctx; | |||
g_hash_table_insert (commands, "/fuzzyadd", cmd); | |||
cmd = rspamd_mempool_alloc (fctx->fuzzy_pool, sizeof (*cmd)); | |||
cmd->privilleged = TRUE; | |||
cmd->privileged = TRUE; | |||
cmd->require_message = TRUE; | |||
cmd->handler = fuzzy_delete_handler; | |||
cmd->ctx = ctx; | |||
g_hash_table_insert (commands, "/fuzzydel", cmd); | |||
cmd = rspamd_mempool_alloc (fctx->fuzzy_pool, sizeof (*cmd)); | |||
cmd->privilleged = TRUE; | |||
cmd->privileged = TRUE; | |||
cmd->require_message = FALSE; | |||
cmd->handler = fuzzy_deletehash_handler; | |||
cmd->ctx = ctx; |
@@ -247,7 +247,7 @@ local expiry_script = [[ | |||
local tokens = {} | |||
-- Tokens occurrences distribution counters | |||
local occurr = { | |||
local occur = { | |||
ham = {}, | |||
spam = {}, | |||
total = {} | |||
@@ -277,7 +277,7 @@ local expiry_script = [[ | |||
for k,v in pairs({['ham']=ham, ['spam']=spam, ['total']=total}) do | |||
if tonumber(v) > 19 then v = 20 end | |||
occurr[k][v] = occurr[k][v] and occurr[k][v] + 1 or 1 | |||
occur[k][v] = occur[k][v] and occur[k][v] + 1 or 1 | |||
end | |||
end | |||
end | |||
@@ -359,33 +359,33 @@ local expiry_script = [[ | |||
local occ_distr = {} | |||
for _,cl in pairs({'ham', 'spam', 'total'}) do | |||
local occurr_key = pattern_sha1 .. '_occurrence_' .. cl | |||
local occur_key = pattern_sha1 .. '_occurrence_' .. cl | |||
if cursor ~= 0 then | |||
local n | |||
for i,v in ipairs(redis.call('HGETALL', occurr_key)) do | |||
for i,v in ipairs(redis.call('HGETALL', occur_key)) do | |||
if i % 2 == 1 then | |||
n = tonumber(v) | |||
else | |||
occurr[cl][n] = occurr[cl][n] and occurr[cl][n] + v or v | |||
occur[cl][n] = occur[cl][n] and occur[cl][n] + v or v | |||
end | |||
end | |||
local str = '' | |||
if occurr[cl][0] ~= nil then | |||
str = '0:' .. occurr[cl][0] .. ',' | |||
if occur[cl][0] ~= nil then | |||
str = '0:' .. occur[cl][0] .. ',' | |||
end | |||
for k,v in ipairs(occurr[cl]) do | |||
for k,v in ipairs(occur[cl]) do | |||
if k == 20 then k = '>19' end | |||
str = str .. k .. ':' .. v .. ',' | |||
end | |||
table.insert(occ_distr, str) | |||
else | |||
redis.call('DEL', occurr_key) | |||
redis.call('DEL', occur_key) | |||
end | |||
if next(occurr[cl]) ~= nil then | |||
redis.call('HMSET', occurr_key, unpack_function(hash2list(occurr[cl]))) | |||
if next(occur[cl]) ~= nil then | |||
redis.call('HMSET', occur_key, unpack_function(hash2list(occur[cl]))) | |||
end | |||
end | |||
@@ -335,7 +335,7 @@ local function bimi_callback(task) | |||
-- We can either check BIMI via DNS or check Redis cache | |||
-- BIMI check is an external check, so we might prefer Redis to be checked | |||
-- first. On the other hand, DNS request is cheaper and counting low BIMI | |||
-- adoptation we would need to have both Redis and DNS request to hit no | |||
-- adaptation we would need to have both Redis and DNS request to hit no | |||
-- result. So, it might be better to check DNS first at this stage... | |||
check_bimi_dns(task, dmarc_domain_maybe) | |||
end |
@@ -41,7 +41,7 @@ local settings = { | |||
max_memory = 50 * 1024 * 1024, -- How many memory should be occupied before sending collection | |||
max_interval = 60, -- Maximum collection interval | |||
}, | |||
collect_garbage = false, -- Peform GC collection after sending the data | |||
collect_garbage = false, -- Perform GC collection after sending the data | |||
check_timeout = 10.0, -- Periodic timeout | |||
timeout = 5.0, | |||
bayes_spam_symbols = {'BAYES_SPAM'}, |
@@ -86,7 +86,7 @@ local function check_ml_mailman(task) | |||
return false | |||
end | |||
-- Mailmain 3 allows to disable all List-* headers in settings, but by default it adds them. | |||
-- Mailman 3 allows to disable all List-* headers in settings, but by default it adds them. | |||
-- In all other cases all Mailman message should have List-Id header | |||
if not task:has_header('List-Id') then | |||
return false |
@@ -1305,7 +1305,7 @@ if opts and type(opts) == 'table' then | |||
end | |||
end, fun.filter(function(r) return not r['prefilter'] end, rules)) | |||
-- prefilter symbils | |||
-- prefilter symbols | |||
fun.each(function(rule) | |||
rspamd_config:register_symbol({ | |||
type = 'prefilter', |
@@ -384,16 +384,16 @@ local function gen_rbl_callback(rule) | |||
end | |||
else | |||
local to_resolve | |||
local orign = req | |||
local origin = req | |||
if not resolve_ip then | |||
orign = maybe_make_hash(req, rule) | |||
origin = maybe_make_hash(req, rule) | |||
to_resolve = string.format('%s.%s', | |||
orign, | |||
origin, | |||
rule.rbl) | |||
else | |||
-- First, resolve origin stuff without hashing or anything | |||
to_resolve = orign | |||
to_resolve = origin | |||
end | |||
nreq = { |
@@ -44,7 +44,7 @@ local function whitelist_cb(symbol, rule, task) | |||
local mult | |||
local how = 'wl' | |||
-- Can be overriden | |||
-- Can be overridden | |||
if rule.blacklist then how = 'bl' end | |||
local function parse_val(val) |
@@ -211,7 +211,7 @@ rspamd_write_pid (struct rspamd_main *main) | |||
return -1; | |||
} | |||
if (main->is_privilleged) { | |||
if (main->is_privileged) { | |||
/* Force root user as owner of pid file */ | |||
#ifdef HAVE_PIDFILE_FILENO | |||
if (fchown (pidfile_fileno (main->pfh), 0, 0) == -1) { | |||
@@ -226,7 +226,7 @@ rspamd_write_pid (struct rspamd_main *main) | |||
return 0; | |||
} | |||
/* Detect privilleged mode */ | |||
/* Detect privileged mode */ | |||
static void | |||
detect_priv (struct rspamd_main *rspamd_main) | |||
{ | |||
@@ -239,16 +239,16 @@ detect_priv (struct rspamd_main *rspamd_main) | |||
if (euid == 0) { | |||
if (!rspamd_main->cfg->rspamd_user && !is_insecure) { | |||
msg_err_main ( | |||
"cannot run rspamd workers as root user, please add -u and -g options to select a proper unprivilleged user or specify --insecure flag"); | |||
"cannot run rspamd workers as root user, please add -u and -g options to select a proper unprivileged user or specify --insecure flag"); | |||
exit (EXIT_FAILURE); | |||
} | |||
else if (is_insecure) { | |||
rspamd_main->is_privilleged = TRUE; | |||
rspamd_main->is_privileged = TRUE; | |||
rspamd_main->workers_uid = 0; | |||
rspamd_main->workers_gid = 0; | |||
} | |||
else { | |||
rspamd_main->is_privilleged = TRUE; | |||
rspamd_main->is_privileged = TRUE; | |||
pwd = getpwnam (rspamd_main->cfg->rspamd_user); | |||
if (pwd == NULL) { | |||
msg_err_main ("user specified does not exists (%s), aborting", | |||
@@ -271,7 +271,7 @@ detect_priv (struct rspamd_main *rspamd_main) | |||
} | |||
} | |||
else { | |||
rspamd_main->is_privilleged = FALSE; | |||
rspamd_main->is_privileged = FALSE; | |||
rspamd_main->workers_uid = (uid_t)-1; | |||
rspamd_main->workers_gid = (gid_t)-1; | |||
} |
@@ -308,7 +308,7 @@ struct rspamd_main { | |||
rspamd_logger_t *logger; | |||
uid_t workers_uid; /**< worker's uid running to */ | |||
gid_t workers_gid; /**< worker's gid running to */ | |||
gboolean is_privilleged; /**< true if run in privilleged mode */ | |||
gboolean is_privileged; /**< true if run in privileged mode */ | |||
gboolean wanna_die; /**< no respawn of processes */ | |||
gboolean cores_throttling; /**< turn off cores when limits are exceeded */ | |||
struct roll_history *history; /**< rolling history */ | |||
@@ -362,7 +362,7 @@ struct rspamd_external_libs_ctx { | |||
*/ | |||
void register_custom_controller_command (const gchar *name, | |||
controller_func_t handler, | |||
gboolean privilleged, | |||
gboolean privileged, | |||
gboolean require_message); | |||
#ifdef __cplusplus |
@@ -28,7 +28,7 @@ However, there are some moment to highlight: | |||
- To make it possible, we explicitly run `umask 0000` in "build" and "functional" stages in .circleci/config.yml | |||
- After run, we persist coverage data in "coverage.${CIRCLE\_JOB}.dump" during this build flow, see `capture_coverage_data`, | |||
to use it on the final stage. | |||
- we user `cpp-coverals` because it is able to save data for coveralls without actually sending it. We send on our own | |||
- we use `cpp-coveralls` because it is able to save data for coveralls without actually sending it. We send on our own | |||
along with Lua-coverage. | |||
Lua coverage | |||
@@ -40,7 +40,7 @@ First part contains nothing interesting, just see `test/lua/tests.lua`. | |||
1. Coverage collecting is initiated and dumped in `test/functional/lua/test_coverage.lua` (there are a lot of comments inside). | |||
This file should be included on the very early stage of test run. Usually it's included via config. | |||
2. Coverage is dumped into ${TMPDIR}/%{woker_name}.luacov.stats.out | |||
2. Coverage is dumped into ${TMPDIR}/%{worker_name}.luacov.stats.out | |||
3. All worker coverage reports are merged into `lua_coverage_report.json` (see `collect_lua_coverage()`) | |||
4. finally, `lua_coverage_report.json` is persisted in build flow (see `functional` stage) | |||
@@ -124,7 +124,7 @@ create_realistic_split (struct rspamd_cryptobox_segment *seg, int mseg, | |||
} | |||
static int | |||
create_constrainted_split (struct rspamd_cryptobox_segment *seg, int mseg, | |||
create_constrained_split (struct rspamd_cryptobox_segment *seg, int mseg, | |||
int constraint, | |||
guchar *begin, guchar *end) | |||
{ | |||
@@ -291,14 +291,14 @@ start: | |||
msg_info ("realistic split of %d chunks encryption: %.0f", cnt, t2 - t1); | |||
cnt = create_constrainted_split (seg, max_seg + 1, 32, begin, end); | |||
cnt = create_constrained_split (seg, max_seg + 1, 32, begin, end); | |||
t1 = rspamd_get_ticks (TRUE); | |||
rspamd_cryptobox_encryptv_nm_inplace (seg, cnt, nonce, key, mac, mode); | |||
t2 = rspamd_get_ticks (TRUE); | |||
check_result (key, nonce, mac, begin, end); | |||
msg_info ("constrainted split of %d chunks encryption: %.0f", cnt, t2 - t1); | |||
msg_info ("constrained split of %d chunks encryption: %.0f", cnt, t2 - t1); | |||
for (i = 0; i < random_fuzz_cnt; i ++) { | |||
ms = ottery_rand_range (i % max_seg * 2) + 1; | |||
@@ -328,7 +328,7 @@ start: | |||
} | |||
for (i = 0; i < random_fuzz_cnt; i ++) { | |||
ms = ottery_rand_range (i % max_seg * 10) + 1; | |||
cnt = create_constrainted_split (seg, ms, i, begin, end); | |||
cnt = create_constrained_split (seg, ms, i, begin, end); | |||
t1 = rspamd_get_ticks (TRUE); | |||
rspamd_cryptobox_encryptv_nm_inplace (seg, cnt, nonce, key, mac, mode); | |||
t2 = rspamd_get_ticks (TRUE); | |||
@@ -336,7 +336,7 @@ start: | |||
check_result (key, nonce, mac, begin, end); | |||
if (i % 1000 == 0) { | |||
msg_info ("constrainted fuzz iterations: %d", i); | |||
msg_info ("constrained fuzz iterations: %d", i); | |||
} | |||
} | |||
@@ -8,8 +8,8 @@ | |||
#include <sys/wait.h> | |||
#endif | |||
#define TEST_BUF "test bufffer" | |||
#define TEST2_BUF "test bufffertest bufffer" | |||
#define TEST_BUF "test buffer" | |||
#define TEST2_BUF "test buffertest buffer" | |||
void | |||
rspamd_mem_pool_test_func () |
@@ -35,7 +35,7 @@ main (int argc, char **argv) | |||
rspamd_main->server_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0); | |||
cfg = rspamd_config_new (RSPAMD_CONFIG_INIT_DEFAULT); | |||
cfg->libs_ctx = rspamd_init_libs (); | |||
/* More agressive GC, workaround for 'not enough memory' test failures */ | |||
/* More aggressive GC, workaround for 'not enough memory' test failures */ | |||
cfg->lua_gc_step *= 2; | |||
rspamd_main->cfg = cfg; | |||
cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0); |
@@ -30,7 +30,7 @@ def dump_file(json_file): | |||
warn("{}: no source_files, not a coveralls.io payload?".format(json_file)) | |||
return 1 | |||
print("{} ({} soource files)".format(json_file, len(data['source_files']))) | |||
print("{} ({} source files)".format(json_file, len(data['source_files']))) | |||
for src_file in sorted(data['source_files'], key=itemgetter('name')): | |||
covered_lines = not_skipped_lines = 0 |