surbl_test_tags (struct rspamd_task *task, struct redirector_param *param,
struct rspamd_url *url)
{
- struct rspamd_url_tag *tag = NULL, *rtag = NULL, *cur;
- struct rspamd_url *redirected_url = NULL;
+ struct rspamd_url_tag *tag = NULL, *cur;
gchar *ftld = NULL;
rspamd_ftok_t tld;
gboolean processed = FALSE;
if (url->tags) {
tag = g_hash_table_lookup (url->tags, "surbl");
- rtag = g_hash_table_lookup (url->tags, "redirector");
}
- if (rtag) {
- /* This is a redirected URL */
- gint r;
-
- redirected_url = rspamd_mempool_alloc0 (task->task_pool,
- sizeof (*redirected_url));
- r = rspamd_url_parse (redirected_url, (gchar *)rtag->data,
- strlen (rtag->data),
- task->task_pool);
-
- if (r == URI_ERRNO_OK) {
- if (!g_hash_table_lookup (task->urls, redirected_url)) {
- g_hash_table_insert (task->urls, redirected_url,
- redirected_url);
- redirected_url->phished_url = url;
- redirected_url->flags |= RSPAMD_URL_FLAG_REDIRECTED;
- }
- }
- else {
- redirected_url = NULL;
- }
- }
-
- if (tag || redirected_url) {
- if (redirected_url) {
- tld.begin = redirected_url->tld;
- tld.len = redirected_url->tldlen;
- }
- else {
- tld.begin = url->tld;
- tld.len = url->tldlen;
- }
+ if (tag) {
+ tld.begin = url->tld;
+ tld.len = url->tldlen;
ftld = rspamd_mempool_ftokdup (task->task_pool, &tld);
}
processed = TRUE;
}
- else if (redirected_url && param->suffix) {
- /* Just register surbl call for the redirected url */
- make_surbl_requests (redirected_url,
- param->task,
- param->suffix,
- FALSE,
- param->tree);
-
- if (surbl_module_ctx->redirector_symbol != NULL) {
- rspamd_task_insert_result (param->task,
- surbl_module_ctx->redirector_symbol,
- 1,
- ftld);
- }
-
- processed = TRUE;
- }
return processed;
}