forked from trusteddomainproject/OpenDMARC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopendmarc_spf_dns.c
756 lines (701 loc) · 17.3 KB
/
opendmarc_spf_dns.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
#include "opendmarc_internal.h"
/* libbsd if found */
#ifdef USE_BSD_H
# include <bsd/string.h>
#endif /* USE_BSD_H */
/* libstrl if needed */
#ifdef USE_STRL_H
# include <strl.h>
#endif /* USE_STRL_H */
/* opendmarc_strl if needed */
#ifdef USE_DMARCSTRL_H
# include <opendmarc_strl.h>
#endif /* USE_DMARCSTRL_H */
#include <netdb.h>
#include "dmarc.h"
#if WITH_SPF && ! HAVE_SPF2_H
/*
** Beware that some Linux versions incorrectly define
** MAXHOSTNAMELEN as 64, but DNS lookups require a length
** of 255. So we don't use MAXHOSTNAMELEN here.
*/
#define MAXDNSHOSTNAME 256
#ifndef MAXPACKET
# define MAXPACKET (8192)
#endif
#ifndef T_SPF
# define T_SPF (99)
#endif
/***************************************************************************************************
** opendmarc_spf_dns_lookup_a_actual -- Looks type of address that is sought
**
** Arguments:
** domain -- the domain name to look up.
** sought -- type of lookup A or AAAA
** ary -- array of strings containing list of IP addresses
** cnt -- Pointer to count of lines in array
** Returns:
** ary -- on success
** NULL -- otherise, and place the h_errno error into reply
** Side Effects:
** Makes a connection to the local name server and blocks
** waiting for a reply.
***************************************************************************************************/
char **
opendmarc_spf_dns_lookup_a_actual(char *domain, int sought, char **ary, int *cnt)
{
char * bp;
u_char * cp;
u_char * eom = NULL;
char hbuf[MAXDNSHOSTNAME];
char namebuf[MAXDNSHOSTNAME + 1];
u_char a_buf[MAXPACKET];
struct in_addr in;
uint32_t a;
HEADER hdr;
int k;
short l = 0;
int class = -1;
int acnt = -1;
int qdcnt = -1;
u_short type = 0;
u_long ttl = 0;
#if HAVE_RES_NINIT
struct __res_state resp;
#endif /* HAVE_RES_NINIT */
/*
* If a null or empy domain was given to us, just say it
* was not found.
*/
if (domain == NULL || *domain == '\0')
{
return NULL;
}
#ifdef HAVE_RES_NINIT
memset(&resp, '\0', sizeof resp);
res_ninit(&resp);
#endif /* HAVE_RES_NINIT */
/*
* Copy the domain so we can scribble on it. The orginal
* may point to a static string.
*/
(void) memcpy(hbuf, domain, sizeof hbuf);
bp = hbuf;
/*
* Make sure host ends in a dot to short circuit lookups
*/
bp = hbuf + strlen(hbuf) - 1;
if (*bp != '.')
*++bp = '.';
*++bp = '\0';
/*
* Make user host does not begin with a dot.
*/
bp = hbuf;
if (*bp == '.')
++bp;
#ifdef HAVE_RES_NINIT
k = res_nquery(&resp, bp, C_IN, sought, a_buf, sizeof a_buf);
res_nclose(&resp);
#else /* HAVE_RES_NINIT */
k = res_query(bp, C_IN, sought, a_buf, sizeof a_buf);
#endif /* HAVE_RES_NINIT */
if (k < 0)
{
return NULL;
}
if (k > (int)(sizeof a_buf))
{
k = sizeof a_buf;
}
(void) memcpy(&hdr, a_buf, sizeof hdr);
cp = (u_char *)&a_buf + HFIXEDSZ;
eom = (u_char *)&a_buf + k;
(void) memset(namebuf, '\0', sizeof namebuf);
/* skip question part of response -- we know what we asked */
for (qdcnt = ntohs(hdr.qdcount); qdcnt > 0; qdcnt--)
{
k = dn_expand((unsigned char *) &a_buf, eom, cp, namebuf, sizeof namebuf);
cp += k;
if (cp + INT16SZ + INT16SZ > eom)
{
return NULL;
}
GETSHORT(type, cp);
GETSHORT(class, cp);
}
if (hdr.rcode != NOERROR)
{
return NULL;
}
acnt = ntohs((unsigned short) hdr.ancount);
if (acnt == 0)
{
return NULL;
}
while (--acnt >= 0 && cp < eom)
{
if ((k = dn_expand((unsigned char *) &a_buf, eom, cp,
namebuf, sizeof namebuf)) < 0)
{
break;
}
cp += k;
GETSHORT(type, cp);
GETSHORT(class, cp);
GETLONG(ttl, cp);
GETSHORT(l, cp);
if (type == T_CNAME)
{
char cname[MAXDNSHOSTNAME + 1];
k = dn_expand((u_char *) &a_buf, eom, cp,
cname, MAXDNSHOSTNAME);
cp += k;
continue;
}
if (type != type)
{
cp += l;
continue;
}
GETLONG(a, cp);
(void) memcpy(&in.s_addr, &a, sizeof(uint32_t));
in.s_addr = ntohl(in.s_addr);
(void) memset(hbuf, '\0', sizeof hbuf);
(void) strncpy(hbuf, inet_ntoa(in), sizeof hbuf);
ary = opendmarc_util_pushnargv(hbuf, ary, cnt);
}
return ary;
}
/***************************************************************************************************
** opendmarc_spf_dns_lookup_a -- Looks up the IPv4 and IPv6 addresses of the domain
**
** Arguments:
** domain -- the domain name to look up.
** ary -- array of strings containing list of IP addresses
** cnt -- Pointer to count of lines in array
** Returns:
** ary -- on success
** NULL -- otherise, and place the h_errno error into reply
** Side Effects:
** Makes a connection to the local name server and blocks
** waiting for a reply.
***************************************************************************************************/
char **
opendmarc_spf_dns_lookup_a(char *domain, char **ary, int *cnt)
{
char **retp;
retp = opendmarc_spf_dns_lookup_a_actual(domain, T_A, ary, cnt);
#ifdef T_AAAA
retp = opendmarc_spf_dns_lookup_a_actual(domain, T_AAAA, ary, cnt);
#endif /* T_AAAA */
return retp;
}
/***************************************************************************************************
** opendmarc_spf_dns_lookup_mx -- Looks up the MX records for a domain
**
** Arguments:
** domain -- The domain name to look up.
** ary -- Array of strings containing list MX hosts
## Note that spf only cares if they exist.
** cnt -- Pointer to count of lines in array
** Returns:
** ary -- on success
** NULL -- otherise, and place the h_errno error into reply
** Side Effects:
** Makes a connection to the local name server and blocks
** waiting for a reply.
***************************************************************************************************/
char **
opendmarc_spf_dns_lookup_mx(char *domain, char **ary, int *cnt)
{
register u_char *eob, *cp;
register int k;
u_char buf[BUFSIZ];
HEADER *hp;
union {
HEADER h;
u_char u[PACKETSZ];
} q;
int acnt, qdcnt;
u_short pref;
u_short type;
u_long ttl;
#if HAVE_RES_NINIT
struct __res_state resp;
#endif /* HAVE_RES_NINIT */
if (domain == NULL)
{
return NULL;
}
#ifdef HAVE_RES_NINIT
memset(&resp, '\0', sizeof resp);
res_ninit(&resp);
k = res_nquery(&resp, domain, C_IN, T_MX, (u_char *) &q, sizeof(q));
res_nclose(&resp);
#else /* HAVE_RES_NINIT */
k = res_query(domain, C_IN, T_MX, (u_char *) &q, sizeof(q));
#endif /* HAVE_RES_NINIT */
if (k < 0)
{
return NULL;
}
hp = &(q.h);
cp = q.u + HFIXEDSZ;
eob = q.u + k;
for (qdcnt = ntohs(hp->qdcount); qdcnt--; cp += k + QFIXEDSZ)
if ((k = dn_skipname(cp, eob)) < 0)
{
return NULL;
}
acnt = ntohs(hp->ancount);
while (--acnt >= 0 && cp < eob)
{
if ((k = dn_expand(q.u, eob, cp, (char *)buf, BUFSIZ-1)) < 0)
break;
cp += k;
if (cp > eob)
break;
GETSHORT(type, cp);
cp += INT16SZ;
GETLONG(ttl, cp);
GETSHORT(k, cp);
if (type != T_MX)
{
cp += k;
continue;
}
GETSHORT(pref, cp);
if ((k = dn_expand(q.u, eob, cp, (char *)buf, BUFSIZ-1)) < 0)
break;
cp += k;
ary = opendmarc_spf_dns_lookup_a((char *)buf, ary, cnt);
}
return ary;
}
/***************************************************************************************************
** opendmarc_spf_dns_lookup_ptr -- Looks up IP address to get domain
**
** Arguments:
** domain -- The domain name to look up.
** ary -- Array of strings containing list MX hosts
## Note that spf only cares if they exist.
** cnt -- Pointer to count of lines in array
** Returns:
** ary -- on success
** NULL -- otherise, and place the h_errno error into reply
** Side Effects:
** Makes a connection to the local name server and blocks
** waiting for a reply.
***************************************************************************************************/
char **
opendmarc_spf_dns_lookup_ptr(char *ip, char **ary, int *cnt)
{
register u_char *eob, *cp;
register int k;
u_char buf[BUFSIZ];
char ip_buf[512];
HEADER *hp;
union {
HEADER h;
u_char u[PACKETSZ];
} q;
int acnt, qdcnt;
u_short type;
u_long ttl;
char *icp;
#if HAVE_RES_NINIT
struct __res_state resp;
#endif /* HAVE_RES_NINIT */
if (ip == NULL)
{
return NULL;
}
(void) memset(buf, '\0', sizeof buf);
(void) memset(ip_buf, '\0', sizeof ip_buf);
(void) strlcpy(ip_buf, ip, sizeof ip_buf);
icp = strrchr(ip_buf, '.');
if (icp == NULL)
return NULL;
strlcpy((char *)buf, icp+1, sizeof buf);
*icp = '\0';
icp = strrchr(ip_buf, '.');
if (icp == NULL)
return NULL;
strlcat((char *)buf, ".", sizeof buf);
strlcat((char *)buf, icp+1, sizeof buf);
*icp = '\0';
icp = strrchr(ip_buf, '.');
if (icp == NULL)
return NULL;
strlcat((char *)buf, ".", sizeof buf);
strlcat((char *)buf, icp+1, sizeof buf);
*icp = '\0';
icp = ip_buf;
strlcat((char *)buf, ".", sizeof buf);
strlcat((char *)buf, icp, sizeof buf);
strlcat((char *)buf, ".in-addr.arpa.", sizeof buf);
#ifdef HAVE_RES_NINIT
memset(&resp, '\0', sizeof resp);
res_ninit(&resp);
k = res_nquery(&resp, (char *)buf, C_IN, T_PTR, (u_char *) &q, sizeof(q));
res_nclose(&resp);
#else /* HAVE_RES_NINIT */
k = res_query((char *)buf, C_IN, T_PTR, (u_char *) &q, sizeof(q));
#endif /* HAVE_RES_NINIT */
if (k < 0)
{
return NULL;
}
hp = &(q.h);
cp = q.u + HFIXEDSZ;
eob = q.u + k;
for (qdcnt = ntohs(hp->qdcount); qdcnt--; cp += k + QFIXEDSZ)
{
if ((k = dn_skipname(cp, eob)) < 0)
{
return NULL;
}
}
acnt = ntohs(hp->ancount);
while (--acnt >= 0 && cp < eob)
{
char ptr[MAXDNSHOSTNAME + 1];
if ((k = dn_expand(q.u, eob, cp, (char *)buf, BUFSIZ-1)) < 0)
break;
cp += k;
if (cp > eob)
break;
GETSHORT(type, cp);
cp += INT16SZ;
GETLONG(ttl, cp);
GETSHORT(k, cp);
k = dn_expand(q.u, eob, cp, ptr, MAXDNSHOSTNAME);
ary = opendmarc_util_pushnargv(ptr, ary, cnt);
cp += k;
continue;
}
return ary;
}
/***************************************************************
** opendmarc_spf_dns_does_domain_exist -- does an a, aaaa, or mx record exist?
**
** Arguments:
** domain -- the domain name to look up.
** reply -- pointer to an integer
**
** Returns:
** TRUE -- if any of those records existed.
** FALSE -- otherise, and place the h_errno error
** into reply
**
** Side Effects:
** Makes a connection to the local name server and bloks
** waiting for a reply.
***************************************************************/
int
opendmarc_spf_dns_does_domain_exist(char *domain, int *reply)
{
HEADER hdr;
u_char a_q[MAXPACKET];
u_char aaaa_q[MAXPACKET];
u_char mx_q[MAXPACKET];
int r;
int * rp;
#if HAVE_RES_NINIT
struct __res_state resp;
#endif /* HAVE_RES_NINIT */
if (reply == NULL)
rp = &r;
else
rp = reply;
if (domain == NULL || *domain == '\0')
{
*rp = HOST_NOT_FOUND;
return FALSE;
}
/*
* Make sure the domain exists.
*/
#ifdef HAVE_RES_NINIT
memset(&resp, '\0', sizeof resp);
res_ninit(&resp);
(void) res_nquery(&resp, domain, C_IN, T_A, a_q, sizeof a_q);
#ifdef T_AAAA
(void) res_nquery(&resp, domain, C_IN, T_AAAA, aaaa_q, sizeof aaaa_q);
#endif /* T_AAAA */
(void) res_nquery(&resp, domain, C_IN, T_MX, mx_q, sizeof mx_q);
res_nclose(&resp);
#else /* HAVE_RES_NINIT */
(void) res_query(domain, C_IN, T_A, a_q, sizeof a_q);
#ifdef T_AAAA
(void) res_query(domain, C_IN, T_AAAA, aaaa_q, sizeof aaaa_q);
#endif /* T_AAAA */
(void) res_query(domain, C_IN, T_MX, mx_q, sizeof mx_q);
#endif /* HAVE_RES_NINIT */
memcpy(&hdr, a_q, sizeof hdr);
*rp = hdr.rcode;
if (hdr.rcode == NOERROR)
return TRUE;
memcpy(&hdr, aaaa_q, sizeof hdr);
*rp = hdr.rcode;
if (hdr.rcode == NOERROR)
return TRUE;
memcpy(&hdr, aaaa_q, sizeof hdr);
*rp = hdr.rcode;
if (hdr.rcode == NOERROR)
return TRUE;
return FALSE;
}
/***************************************************************************************************
** opendmarc_dns_get_record -- looks up and returns the txt record
**
** Arguments:
** domain -- the domain name to look up.
** reply -- pointer to an integer
** txt -- where to scribble the found txt record
** txtlen -- size of txt record buffer
** cname -- buffer to hold CNAME if one found
** cnamelen -- size of cname buffer
** spfcheck -- restrict text records returned to just those beginning with v= or spf2.0
**
** Returns:
** txt -- on success
** NULL -- otherise, and place the h_errno error
** into reply
** NULL -- if no data, but cname may still contain a hostname
**
** Side Effects:
** Makes a connection to the local name server and blocks
** waiting for a reply.
***************************************************************************************************/
char *
opendmarc_spf_dns_get_record(char *domain, int *reply, char *txt, size_t txtlen, char *cname, size_t cnamelen, int spfcheck)
{
u_char * eom = NULL;
u_char * eop = NULL;
u_char * cp = NULL;
int k;
u_char * p = NULL;
int ch = 0;
short l = 0;
HEADER hdr;
int class = -1;
int acnt = -1;
int qdcnt = -1;
u_short type = 0;
u_long ttl = 0;
char * bp = NULL;
int r = 0;
int * rp = NULL;
u_char txt_buf[MAXPACKET];
char hbuf[MAXDNSHOSTNAME];
char namebuf[MAXDNSHOSTNAME + 1];
#if HAVE_RES_NINIT
struct __res_state resp;
#endif /* HAVE_RES_NINIT */
if (reply == NULL)
rp = &r;
else
rp = reply;
/*
* If a null or empy domain was given to us, just say it
* was not found.
*/
*rp = 0;
if (domain == NULL || *domain == '\0')
{
*rp = HOST_NOT_FOUND;
return NULL;
}
if (cname != NULL && cnamelen > 0)
(void) memset(cname, '\0', cnamelen);
/*
* Copy the domain so we can scribble on it. The orginal
* may point to a static string.
*/
(void) memcpy(hbuf, domain, sizeof hbuf);
bp = hbuf;
if (txt != NULL)
(void) memset(txt, '\0', txtlen);
/*
* Make sure host ends in a dot to short circuit lookups
*/
bp = hbuf + strlen(hbuf) - 1;
if (*bp != '.')
*++bp = '.';
*++bp = '\0';
/*
* Make user host does not begin with a dot.
*/
bp = hbuf;
if (*bp == '.')
++bp;
#ifdef HAVE_RES_NINIT
memset(&resp, '\0', sizeof resp);
res_ninit(&resp);
k = res_nquery(&resp, bp, C_IN, T_TXT, txt_buf, sizeof txt_buf);
#else /* HAVE_RES_NINIT */
k = res_query(bp, C_IN, T_TXT, txt_buf, sizeof txt_buf);
#endif /* HAVE_RES_NINIT */
if (k < 0)
{
/*
* TXT records apppear more common than SPF records, so
* we fall back to SPF instead of looking up SPF first.
*/
if (h_errno == NO_DATA || h_errno == NXDOMAIN)
{
#ifdef HAVE_RES_NINIT
k = res_nquery(&resp, bp, C_IN, T_SPF, txt_buf, sizeof txt_buf);
#else /* HAVE_RES_NINIT */
k = res_query(bp, C_IN, T_SPF, txt_buf, sizeof txt_buf);
#endif /* HAVE_RES_NINIT */
if (k >= 0)
goto got_spf_record;
}
*rp = h_errno;
#ifdef HAVE_RES_NINIT
res_nclose(&resp);
#endif /* HAVE_RES_NINIT */
return NULL;
}
got_spf_record:
#ifdef HAVE_RES_NINIT
res_nclose(&resp);
#endif /* HAVE_RES_NINIT */
if (k > (int)(sizeof txt_buf))
k = sizeof txt_buf;
(void) memcpy(&hdr, txt_buf, sizeof hdr);
cp = (u_char *)&txt_buf + HFIXEDSZ;
eom = (u_char *)&txt_buf + k;
(void) memset(namebuf, '\0', sizeof namebuf);
/* skip question part of response -- we know what we asked */
for (qdcnt = ntohs(hdr.qdcount); qdcnt > 0; qdcnt--)
{
(void) dn_expand((unsigned char *) &txt_buf, eom, cp, namebuf, sizeof namebuf);
if ((k = dn_skipname(cp, eom)) < 0)
{
*rp = NO_DATA;
return NULL;
}
cp += k;
if (cp + INT16SZ + INT16SZ > eom)
{
*rp = NO_DATA;
return NULL;
}
GETSHORT(type, cp);
GETSHORT(class, cp);
}
if (hdr.rcode != NOERROR)
{
*rp = NO_DATA;
return NULL;
}
acnt = ntohs((unsigned short) hdr.ancount);
if (acnt == 0)
{
*rp = NO_DATA;
return NULL;
}
while (--acnt >= 0 && cp < eom)
{
if ((k = dn_expand((unsigned char *) &txt_buf, eom, cp,
namebuf, sizeof namebuf)) < 0)
{
*rp = NO_DATA;
return NULL;
}
cp += k;
if (cp + INT16SZ + INT16SZ > eom)
{
/* currupt answer */
*rp = NO_DATA;
return NULL;
}
GETSHORT(type, cp);
GETSHORT(class, cp);
if (type == T_CNAME)
{
/*
* CNAMEs are supposed to be invisible, but somtimes
* a CNAME points to a TXT record that times out, so
* all we get on the initial query is the CNAME.
*/
char xname[MAXDNSHOSTNAME + 1];
char * xp;
size_t xlen;
if (cname == NULL || cnamelen == 0)
{
xp = xname;
xlen = sizeof xname;
}
else
{
xp = cname;
xlen = cnamelen;
}
k = dn_expand((u_char *) &txt_buf, eom, (u_char *)cname, xp, xlen);
cp += k;
continue;
}
else if (type != T_TXT)
{
*rp = NO_DATA;
return NULL;
}
/* we may want to cache the ttl later */
GETLONG(ttl, cp);
if (cp + INT16SZ > eom)
{
/* no payload length */
*rp = NO_DATA;
return NULL;
}
GETSHORT(l, cp);
if (cp + l > eom)
{
/* payload length greater than remaining buffer */
*rp = NO_DATA;
return NULL;
}
if (txt != NULL)
{
(void) memset(txt, '\0', txtlen);
/*
* copy the returned record into txt
*/
p = (u_char *)txt;
eop = (u_char *)txt + txtlen -1;
while (l > 0 && p < eop)
{
ch = *cp++;
l--;
while (ch > 0 && p < eop)
{
*p++ = *cp++;
ch--;
l--;
}
}
}
if (spfcheck == TRUE)
{
/*
* Honor both SPF and Sender Identity type records
* But ignore mfrom/pra, because DMARC uses only SPF records.
*/
if (strstr(txt, "v=spf") != NULL || strncasecmp(txt, "spf2.0", 6) == 0)
{
*rp = 0;
return txt;
}
}
cp += l;
continue;
}
*rp = NO_DATA;
return NULL;
}
#endif /* WITH_SPF && ! HAVE_SPF2_H */