aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-21 14:52:35 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-21 14:52:35 +0100
commit0b70166de4b2a9e115353a611121abf6b8b668ca (patch)
tree68a2d5dfbe761a7fb876d748c694b49c293c1636 /src
parente1ff872f1a1070ec27ba9c5d011e19044941a3a8 (diff)
downloadrspamd-0b70166de4b2a9e115353a611121abf6b8b668ca.tar.gz
rspamd-0b70166de4b2a9e115353a611121abf6b8b668ca.zip
Fix includes.
Diffstat (limited to 'src')
-rw-r--r--src/filter.h1
-rw-r--r--src/protocol.h2
-rw-r--r--src/util.c18
-rw-r--r--src/util.h2
4 files changed, 13 insertions, 10 deletions
diff --git a/src/filter.h b/src/filter.h
index b06dbeef1..258bd9447 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -8,6 +8,7 @@
#include "config.h"
#include "symbols_cache.h"
+#include "task.h"
struct rspamd_task;
struct rspamd_settings;
diff --git a/src/protocol.h b/src/protocol.h
index 912b8744c..8d2efe118 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -9,6 +9,7 @@
#include "config.h"
#include "filter.h"
#include "http.h"
+#include "task.h"
#define RSPAMD_BASE_ERROR 500
#define RSPAMD_FILTER_ERROR RSPAMD_BASE_ERROR + 1
@@ -17,7 +18,6 @@
#define RSPAMD_LENGTH_ERROR RSPAMD_BASE_ERROR + 4
#define RSPAMD_STATFILE_ERROR RSPAMD_BASE_ERROR + 5
-struct rspamd_task;
struct metric;
/**
diff --git a/src/util.c b/src/util.c
index cba37f110..03b38e087 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2083,21 +2083,23 @@ restart:
}
gboolean
-rspamd_ip_is_valid (void *ptr, int af)
+rspamd_ip_is_valid (rspamd_inet_addr_t *addr)
{
const struct in_addr ip4_any = { INADDR_ANY }, ip4_none = { INADDR_NONE };
const struct in6_addr ip6_any = IN6ADDR_ANY_INIT;
gboolean ret = FALSE;
- if (G_LIKELY (af == AF_INET)) {
- if (memcmp (ptr, &ip4_any, sizeof (struct in_addr)) != 0 &&
- memcmp (ptr, &ip4_none, sizeof (struct in_addr)) != 0) {
+ if (G_LIKELY (addr->af == AF_INET)) {
+ if (memcmp (&addr->addr.s4.sin_addr, &ip4_any, sizeof (struct in_addr)) != 0 &&
+ memcmp (&addr->addr.s4.sin_addr, &ip4_none,
+ sizeof (struct in_addr)) != 0) {
ret = TRUE;
}
}
- else if (G_UNLIKELY (af == AF_INET6)) {
- if (memcmp (ptr, &ip6_any, sizeof (struct in6_addr)) != 0) {
+ else if (G_UNLIKELY (addr->af == AF_INET6)) {
+ if (memcmp (&addr->addr.s6.sin6_addr, &ip6_any,
+ sizeof (struct in6_addr)) != 0) {
ret = TRUE;
}
}
@@ -2264,9 +2266,9 @@ rspamd_inet_address_get_port (rspamd_inet_addr_t *addr)
{
switch (addr->af) {
case AF_INET:
- return addr->addr.s4.sin_port;
+ return ntohs (addr->addr.s4.sin_port);
case AF_INET6:
- return addr->addr.s6.sin6_port;
+ return ntohs (addr->addr.s6.sin6_port);
}
return 0;
diff --git a/src/util.h b/src/util.h
index 00b3f1f7d..0605fe87d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -448,7 +448,7 @@ gint rspamd_read_passphrase (gchar *buf, gint size, gint rwflag, gpointer key);
* @param af address family (AF_INET or AF_INET6)
* @return TRUE if the address is valid
*/
-gboolean rspamd_ip_is_valid (void *ptr, int af);
+gboolean rspamd_ip_is_valid (rspamd_inet_addr_t *addr);
/**
* Emit UCL object to gstring