summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------contrib/snowball0
-rw-r--r--src/libserver/cfg_utils.c34
2 files changed, 33 insertions, 1 deletions
diff --git a/contrib/snowball b/contrib/snowball
-Subproject 558c36912b3ca63e2917d7df504a92dbc78e1b7
+Subproject 4bc9f365c4b674d0dd0cfd14c314a866f00e088
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index ded0e0eb9..e28f6445e 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -66,7 +66,39 @@ rspamd_parse_bind_line (struct rspamd_config *cfg,
return FALSE;
}
- tokens = g_strsplit_set (str, ":", 0);
+ if (str[0] == '[') {
+ /* This is an ipv6 address */
+ gsize len, ntok;
+ const gchar *start, *ip_pos;
+
+ start = str + 1;
+
+ len = strcspn (start, "]");
+ if (start[len] != ']') {
+ return FALSE;
+ }
+
+ ip_pos = start;
+ start += len + 1;
+ ntok = 1;
+
+ if (*start == ':') {
+ ntok = 2;
+ start ++;
+ }
+
+ tokens = g_malloc_n (ntok + 1, sizeof (gchar *));
+ tokens[ntok] = NULL;
+ tokens[0] = g_malloc (len + 1);
+ rspamd_strlcpy (tokens[0], ip_pos, len + 1);
+
+ if (ntok > 1) {
+ tokens[1] = g_strdup (start);
+ }
+ }
+ else {
+ tokens = g_strsplit_set (str, ":", 0);
+ }
if (!tokens || !tokens[0]) {
return FALSE;
}