elt = ucl_object_frombool (url->flags & RSPAMD_URL_FLAG_REDIRECTED);
ucl_object_insert_key (obj, elt, "redirected", 0, false);
- if (url->phished_url) {
- encoded = rspamd_url_encode (url->phished_url, &enclen, task->task_pool);
- elt = rspamd_protocol_extended_url (task, url->phished_url, encoded,
+ if (url->linked_url) {
+ encoded = rspamd_url_encode (url->linked_url, &enclen, task->task_pool);
+ elt = rspamd_protocol_extended_url (task, url->linked_url, encoded,
enclen);
- ucl_object_insert_key (obj, elt, "orig_url", 0, false);
+ ucl_object_insert_key (obj, elt, "linked_url", 0, false);
}
return obj;
{"content", RSPAMD_URL_FLAG_CONTENT, -1},
{"no_tld", RSPAMD_URL_FLAG_NO_TLD, -1},
{"truncated", RSPAMD_URL_FLAG_TRUNCATED, -1},
+ {"redirect_target", RSPAMD_URL_FLAG_REDIRECT_TARGET, -1},
};
RSPAMD_URL_FLAG_CONTENT = 1u << 21u,
RSPAMD_URL_FLAG_NO_TLD = 1u << 22u,
RSPAMD_URL_FLAG_TRUNCATED = 1u << 23u,
+ RSPAMD_URL_FLAG_REDIRECT_TARGET = 1u << 24u,
};
-#define RSPAMD_URL_MAX_FLAG_SHIFT (24u)
+#define RSPAMD_URL_MAX_FLAG_SHIFT (25u)
struct rspamd_url_tag {
const gchar *data;
gchar *raw;
gchar *visible_part;
- struct rspamd_url *phished_url;
+ struct rspamd_url *linked_url;
guint32 flags;
struct rspamd_lua_url *purl, *url = lua_check_url (L, 1);
if (url) {
- if (url->url->phished_url != NULL) {
+ if (url->url->linked_url != NULL) {
if (url->url->flags &
(RSPAMD_URL_FLAG_PHISHED|RSPAMD_URL_FLAG_REDIRECTED)) {
purl = lua_newuserdata (L, sizeof (struct rspamd_lua_url));
rspamd_lua_setclass (L, "rspamd{url}", -1);
- purl->url = url->url->phished_url;
+ purl->url = url->url->linked_url;
return 1;
}
redir = lua_check_url (L, -1);
url->url->flags |= RSPAMD_URL_FLAG_REDIRECTED;
- url->url->phished_url = redir->url;
+ url->url->linked_url = redir->url;
}
}
else {
}
url->url->flags |= RSPAMD_URL_FLAG_REDIRECTED;
- url->url->phished_url = redir->url;
+ url->url->linked_url = redir->url;
/* Push back on stack */
lua_pushvalue (L, 2);
lua_createtable (L, 0, 4);
- PUSH_FLAG (RSPAMD_URL_FLAG_PHISHED);
- PUSH_FLAG (RSPAMD_URL_FLAG_NUMERIC);
- PUSH_FLAG (RSPAMD_URL_FLAG_OBSCURED);
- PUSH_FLAG (RSPAMD_URL_FLAG_REDIRECTED);
- PUSH_FLAG (RSPAMD_URL_FLAG_HTML_DISPLAYED);
- PUSH_FLAG (RSPAMD_URL_FLAG_FROM_TEXT);
- PUSH_FLAG (RSPAMD_URL_FLAG_SUBJECT);
- PUSH_FLAG (RSPAMD_URL_FLAG_HOSTENCODED);
- PUSH_FLAG (RSPAMD_URL_FLAG_SCHEMAENCODED);
- PUSH_FLAG (RSPAMD_URL_FLAG_PATHENCODED);
- PUSH_FLAG (RSPAMD_URL_FLAG_QUERYENCODED);
- PUSH_FLAG (RSPAMD_URL_FLAG_MISSINGSLASHES);
- PUSH_FLAG (RSPAMD_URL_FLAG_IDN);
- PUSH_FLAG (RSPAMD_URL_FLAG_HAS_PORT);
- PUSH_FLAG (RSPAMD_URL_FLAG_HAS_USER);
- PUSH_FLAG (RSPAMD_URL_FLAG_SCHEMALESS);
- PUSH_FLAG (RSPAMD_URL_FLAG_UNNORMALISED);
- PUSH_FLAG (RSPAMD_URL_FLAG_ZW_SPACES);
- PUSH_FLAG (RSPAMD_URL_FLAG_DISPLAY_URL);
- PUSH_FLAG (RSPAMD_URL_FLAG_IMAGE);
- PUSH_FLAG (RSPAMD_URL_FLAG_CONTENT);
- PUSH_FLAG (RSPAMD_URL_FLAG_TRUNCATED);
+ for (gint i = 0; i < RSPAMD_URL_MAX_FLAG_SHIFT; i ++) {
+ PUSH_FLAG (1u << i);
+ }
}
else {
return luaL_error (L, "invalid arguments");