]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix spf module for inet_addr.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 21 Apr 2014 13:55:50 +0000 (14:55 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 21 Apr 2014 13:55:50 +0000 (14:55 +0100)
src/spf.c

index 2219a5b8f79a7f5ab43631e52dae645f66308114..12f1513d49587b4ad9020c587af119167e85ffef 100644 (file)
--- a/src/spf.c
+++ b/src/spf.c
@@ -1019,13 +1019,9 @@ expand_spf_macro (struct rspamd_task *task, struct spf_record *rec, gchar *begin
                                switch (g_ascii_tolower (*p)) {
                                        case 'i':
 #ifdef HAVE_INET_PTON
-                                               if (task->from_addr.ipv6) {
-                                                       inet_ntop (AF_INET6, &task->from_addr.d.in6, ip_buf, sizeof (ip_buf));
-                                               }
-                                               else {
-                                                       inet_ntop (AF_INET, &task->from_addr.d.in4, ip_buf, sizeof (ip_buf));
-                                               }
-                                               len = strlen (ip_buf);
+                                               len = rspamd_strlcpy (ip_buf,
+                                                               rspamd_inet_address_to_string (&task->from_addr),
+                                                               sizeof (ip_buf));
                                                memcpy (c, ip_buf, len);
 #else
                                                tmp = inet_ntoa (task->from_addr);