From 076ca2c763876307b45980a52db420af96fff629 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Mon, 11 Sep 2023 11:13:47 +0200 Subject: [Feature] rbl: support checking numeric URLs in isolation --- src/plugins/lua/rbl.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index 6dce0e0f1..c5cdbef1c 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -572,6 +572,9 @@ local function gen_rbl_callback(rule) if rule.images then table.insert(ex_params.flags, 'image') end + if rule.numeric_urls then + table.insert(ex_params.flags, 'numeric') + end end local urls = lua_util.extract_specific_urls(ex_params) @@ -805,7 +808,7 @@ local function gen_rbl_callback(rule) description[#description + 1] = 'replyto' end - if rule.urls or rule.content_urls or rule.images then + if rule.urls or rule.content_urls or rule.images or rule.numeric_urls then pipeline[#pipeline + 1] = check_urls description[#description + 1] = 'urls' end -- cgit v1.2.3 From 09e96ca03adbdf73ab8ceb7491023b168c1364cb Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 11 Sep 2023 16:30:51 +0100 Subject: [Fix] Fix grammar definition for content-disposition attributes --- src/ragel/content_disposition.rl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ragel/content_disposition.rl b/src/ragel/content_disposition.rl index 6087d3d17..ef316f7e6 100644 --- a/src/ragel/content_disposition.rl +++ b/src/ragel/content_disposition.rl @@ -13,8 +13,8 @@ (((FWS? qcontent)* FWS?) >Quoted_Str_Start %Quoted_Str_End) DQUOTE) CFWS?; token = 0x21..0x27 | 0x2a..0x2b | 0x2c..0x2e | 0x30..0x39 | 0x41..0x5a | 0x5e..0x7e; - value = (quoted_string | (token -- '"' | 0x3d | utf8_2c | utf8_3c | utf8_4c)+) >Param_Value_Start %Param_Value_End; - attribute = (quoted_string | (token -- '"' | 0x3d)+) >Param_Name_Start %Param_Name_End; + value = (quoted_string | (token -- ('"' | 0x3d | utf8_2c | utf8_3c | utf8_4c)+)) >Param_Value_Start %Param_Value_End; + attribute = (quoted_string | (token -- ('"' | '='))+) >Param_Name_Start %Param_Name_End; parameter = CFWS? attribute FWS? "=" FWS? value CFWS?; ietf_token = token+; -- cgit v1.2.3 From 204b31837bfc1fc14c3f296b7f3748cae7e3944d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 11 Sep 2023 16:43:43 +0100 Subject: [Minor] Misplaced brace... --- src/ragel/content_disposition.rl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ragel/content_disposition.rl b/src/ragel/content_disposition.rl index ef316f7e6..862015ea1 100644 --- a/src/ragel/content_disposition.rl +++ b/src/ragel/content_disposition.rl @@ -13,7 +13,7 @@ (((FWS? qcontent)* FWS?) >Quoted_Str_Start %Quoted_Str_End) DQUOTE) CFWS?; token = 0x21..0x27 | 0x2a..0x2b | 0x2c..0x2e | 0x30..0x39 | 0x41..0x5a | 0x5e..0x7e; - value = (quoted_string | (token -- ('"' | 0x3d | utf8_2c | utf8_3c | utf8_4c)+)) >Param_Value_Start %Param_Value_End; + value = (quoted_string | (token -- ('"' | 0x3d | utf8_2c | utf8_3c | utf8_4c))+) >Param_Value_Start %Param_Value_End; attribute = (quoted_string | (token -- ('"' | '='))+) >Param_Name_Start %Param_Name_End; parameter = CFWS? attribute FWS? "=" FWS? value CFWS?; -- cgit v1.2.3 From 798184ee605a5b5997cc99a04d2a1f8463bce6f7 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Tue, 12 Sep 2023 11:04:31 +0200 Subject: [Minor] API docs: lua_ip: fix function name - Also clarify description - Make sure example is appropriate --- src/lua/lua_ip.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/lua/lua_ip.c b/src/lua/lua_ip.c index 92a066406..ac24dc52b 100644 --- a/src/lua/lua_ip.c +++ b/src/lua/lua_ip.c @@ -87,24 +87,24 @@ LUA_FUNCTION_DEF(ip, to_table); * @see ip:to_table() is that this method returns just hex strings for ipv6 * addresses. * @return {table or nil} string octets of IP address or `nil` if IP is invalid + * @example +local ip = rspamd_ip.from_string('fe80::11') +print(table.concat(ip:str_octets(), ".")) +-- Output: +-- f.e.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.1 */ LUA_FUNCTION_DEF(ip, str_octets); /*** - * @method ip:str_octets() + * @method ip:inversed_str_octets() * Converts valid IP address to the table of string octets in reversed order. The difference from * @see ip:to_table() is that this method returns just hex strings for ipv6 - * addresses. + * addresses in reversed order. * @return {table or nil} string octets of IP address or `nil` if IP is invalid * @example -local ip = rspamd_ip.from_string('127.0.0.1') -for _,o in ipairs(ip:to_table()) do - print(o) -end +local ip = rspamd_ip.from_string('fe80::11') +print(table.concat(ip:inversed_str_octets(), ".")) -- Output: --- 1 --- 0 --- 0 --- 127 +-- 1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f */ LUA_FUNCTION_DEF(ip, inversed_str_octets); /*** -- cgit v1.2.3