commit 4266f57: [Minor] Support commonly mistaken spf ipv4/ipv6 elements

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Jul 30 15:35:07 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-30 16:34:14 +0100
URL: https://github.com/rspamd/rspamd/commit/4266f574abbf6523355c127ba09738fe54d00130 (HEAD -> master)

[Minor] Support commonly mistaken spf ipv4/ipv6 elements

---
 src/libserver/spf.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index c42428268..999423c7d 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -31,7 +31,9 @@
 #define SPF_ALL "all"
 #define SPF_A "a"
 #define SPF_IP4 "ip4"
+#define SPF_IP4_ALT "ipv4"
 #define SPF_IP6 "ip6"
+#define SPF_IP6_ALT "ipv6"
 #define SPF_PTR "ptr"
 #define SPF_MX "mx"
 #define SPF_EXISTS "exists"
@@ -2191,16 +2193,19 @@ spf_process_element (struct spf_record *rec,
 			break;
 		case 'i':
 			/* include or ip4 */
-			if (g_ascii_strncasecmp (begin, SPF_IP4,
-					sizeof (SPF_IP4) - 1) == 0) {
+			if (g_ascii_strncasecmp (begin, SPF_IP4, sizeof (SPF_IP4) - 1) == 0) {
 				res = parse_spf_ip4 (rec, addr);
 			}
-			else if (g_ascii_strncasecmp (begin, SPF_INCLUDE,
-					sizeof (SPF_INCLUDE) - 1) == 0) {
+			else if (g_ascii_strncasecmp (begin, SPF_INCLUDE, sizeof (SPF_INCLUDE) - 1) == 0) {
 				res = parse_spf_include (rec, addr);
 			}
-			else if (g_ascii_strncasecmp (begin, SPF_IP6, sizeof (SPF_IP6) -
-														  1) == 0) {
+			else if (g_ascii_strncasecmp (begin, SPF_IP6, sizeof (SPF_IP6) - 1) == 0) {
+				res = parse_spf_ip6 (rec, addr);
+			}
+			else if (g_ascii_strncasecmp (begin, SPF_IP4_ALT, sizeof (SPF_IP4_ALT) - 1) == 0) {
+				res = parse_spf_ip4 (rec, addr);
+			}
+			else if (g_ascii_strncasecmp (begin, SPF_IP6_ALT, sizeof (SPF_IP6_ALT) - 1) == 0) {
 				res = parse_spf_ip6 (rec, addr);
 			}
 			else {


More information about the Commits mailing list