diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2017-11-21 22:40:53 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2017-11-21 22:40:53 +0200 |
commit | c659e6efca03b4a75df03ee46b0c3b8694ff1bbb (patch) | |
tree | 36922e6c1cddb09c85448847958cf45941e18934 | |
parent | b3eb87d52052e399757ac111f12a8ba077089263 (diff) | |
download | mailfromd-c659e6efca03b4a75df03ee46b0c3b8694ff1bbb.tar.gz mailfromd-c659e6efca03b4a75df03ee46b0c3b8694ff1bbb.tar.bz2 |
Ensure case-insensitive comparison of SPF record marker.
* lib/dns.c (spf_lookup): ignore case when looking for v=spf1
-rw-r--r-- | lib/dns.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -570,6 +570,9 @@ txt_lookup(const char *name, struct dns_reply *reply) return status; } +#define VSPF1_STR "v=spf1" +#define VSPF1_LEN (sizeof(VSPF1_STR)-1) + dns_status spf_lookup(const char *domain, char **rec) { @@ -583,9 +586,10 @@ spf_lookup(const char *domain, char **rec) status = dns_not_found; for (i = 0; i < reply.count; i++) { - if (memcmp(reply.data.str[i], "v=spf1", 6) == 0 - && (reply.data.str[i][6] == 0 - || mu_isspace(reply.data.str[i][6]))) { + if (mu_c_strncasecmp(reply.data.str[i], + VSPF1_STR, VSPF1_LEN) == 0 + && (reply.data.str[i][VSPF1_LEN] == 0 + || mu_isspace(reply.data.str[i][VSPF1_LEN]))) { *rec = mu_strdup(reply.data.str[i]); status = dns_success; break; |