commit 8426459: [Feature] Add flag to url object when visible part is url_like
Miecio Za
miecio at miecio.net
Sat Mar 9 14:21:04 UTC 2019
Author: Miecio Za
Date: 2019-02-27 12:04:10 +0100
URL: https://github.com/rspamd/rspamd/commit/84264594d874881dd4556dc476d8a3af842787e7
[Feature] Add flag to url object when visible part is url_like
Flag is similar to phished but does not require domains to be
different
---
src/libserver/html.c | 3 +++
src/libserver/url.h | 1 +
src/lua/lua_url.c | 2 ++
3 files changed, 6 insertions(+)
diff --git a/src/libserver/html.c b/src/libserver/html.c
index 70b66ccc0..cdcaf4ebb 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -2384,6 +2384,9 @@ rspamd_html_check_displayed_url (rspamd_mempool_t *pool,
dest->len - href_offset,
&url_found, &displayed_url);
+ if (url_found) {
+ url->flags |= RSPAMD_URL_FLAG_DISPLAY_URL;
+ }
if (exceptions && url_found) {
ex = rspamd_mempool_alloc (pool,
sizeof (*ex));
diff --git a/src/libserver/url.h b/src/libserver/url.h
index 571424099..1a117c450 100644
--- a/src/libserver/url.h
+++ b/src/libserver/url.h
@@ -28,6 +28,7 @@ enum rspamd_url_flags {
RSPAMD_URL_FLAG_SCHEMALESS = 1 << 15,
RSPAMD_URL_FLAG_UNNORMALISED = 1 << 16,
RSPAMD_URL_FLAG_ZW_SPACES = 1 << 17,
+ RSPAMD_URL_FLAG_DISPLAY_URL = 1 << 18,
};
struct rspamd_url_tag {
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index 7bad50359..58c6a83be 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -901,6 +901,7 @@ lua_url_all (lua_State *L)
* - `schemaless`: URL has no schema
* - `unnormalised`: URL has some unicode unnormalities
* - `zw_spaces`: URL has some zero width spaces
+ * - `url_displayed`: URL has some other url-like string in visible part
* @return {table} URL flags
*/
#define PUSH_FLAG(fl, name) do { \
@@ -941,6 +942,7 @@ lua_url_get_flags (lua_State *L)
PUSH_FLAG (RSPAMD_URL_FLAG_SCHEMALESS, "schemaless");
PUSH_FLAG (RSPAMD_URL_FLAG_UNNORMALISED, "unnormalised");
PUSH_FLAG (RSPAMD_URL_FLAG_ZW_SPACES, "zw_spaces");
+ PUSH_FLAG (RSPAMD_URL_FLAG_DISPLAY_URL, "url_displayed");
}
else {
return luaL_error (L, "invalid arguments");
More information about the Commits
mailing list