diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-19 13:06:49 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-19 13:06:49 +0000 |
commit | 2287a9092a9300cc56a05a9e83771e0bf05dc064 (patch) | |
tree | 7408f8d9e2b5e9d01806e1347f1bb0f38918ab7a /src/libserver | |
parent | 970a8f6bf3b0f0b601567483c29f91af72d99008 (diff) | |
download | rspamd-2287a9092a9300cc56a05a9e83771e0bf05dc064.tar.gz rspamd-2287a9092a9300cc56a05a9e83771e0bf05dc064.zip |
Use flags for urls
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/html.c | 2 | ||||
-rw-r--r-- | src/libserver/protocol.c | 2 | ||||
-rw-r--r-- | src/libserver/url.c | 6 | ||||
-rw-r--r-- | src/libserver/url.h | 9 |
4 files changed, 12 insertions, 7 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c index 2d1896d84..daea7f7ff 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -859,7 +859,7 @@ rspamd_html_url_is_phished (rspamd_mempool_t *pool, if (href_url->tldlen != text_url->tldlen || memcmp (href_url->tld, text_url->tld, href_url->tldlen) != 0) { - href_url->is_phished = TRUE; + href_url->flags |= RSPAMD_URL_FLAG_PHISHED; href_url->phished_url = text_url; } } diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index 7e91f6a1e..d20c50ff8 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -645,7 +645,7 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud) ucl_object_insert_key (obj, elt, "surbl", 0, false); } - elt = ucl_object_frombool (url->is_phished); + elt = ucl_object_frombool (url->flags & RSPAMD_URL_FLAG_PHISHED); ucl_object_insert_key (obj, elt, "phished", 0, false); } ucl_array_append (cb->top, obj); diff --git a/src/libserver/url.c b/src/libserver/url.c index 186697483..f0a65df8c 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -1093,7 +1093,7 @@ rspamd_url_is_ip (struct rspamd_url *uri, rspamd_mempool_t *pool) uri->hostlen = strlen (uri->host); uri->tld = uri->host; uri->tldlen = uri->hostlen; - uri->is_numeric = TRUE; + uri->flags |= RSPAMD_URL_FLAG_NUMERIC; ret = TRUE; } else if (inet_pton (AF_INET6, buf, &in6) == 1) { @@ -1103,7 +1103,7 @@ rspamd_url_is_ip (struct rspamd_url *uri, rspamd_mempool_t *pool) uri->hostlen = strlen (uri->host); uri->tld = uri->host; uri->tldlen = uri->hostlen; - uri->is_numeric = TRUE; + uri->flags |= RSPAMD_URL_FLAG_NUMERIC; ret = TRUE; } else { @@ -1175,7 +1175,7 @@ rspamd_url_is_ip (struct rspamd_url *uri, rspamd_mempool_t *pool) uri->hostlen = strlen (uri->host); uri->tld = uri->host; uri->tldlen = uri->hostlen; - uri->is_numeric = TRUE; + uri->flags |= RSPAMD_URL_FLAG_NUMERIC|RSPAMD_URL_FLAG_OBSCURED; ret = TRUE; } } diff --git a/src/libserver/url.h b/src/libserver/url.h index f1c850b80..90b6d5c61 100644 --- a/src/libserver/url.h +++ b/src/libserver/url.h @@ -8,6 +8,12 @@ struct rspamd_task; struct mime_text_part; +enum rspamd_url_flags { + RSPAMD_URL_FLAG_PHISHED = 1 << 0, + RSPAMD_URL_FLAG_NUMERIC = 1 << 1, + RSPAMD_URL_FLAG_OBSCURED = 1 << 2, +}; + struct rspamd_url { gchar *string; gint protocol; @@ -35,8 +41,7 @@ struct rspamd_url { guint tldlen; guint urllen; - gboolean is_phished; /* URI maybe phishing */ - gboolean is_numeric; /* URI contains IP address */ + enum rspamd_url_flags flags; }; enum uri_errno { |