s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
spf.c File Reference
#include "stralloc.h"
#include "alloc.h"
#include "ip.h"
#include "ipalloc.h"
#include "ipme.h"
#include "str.h"
#include "fmt.h"
#include "scan.h"
#include "byte.h"
#include "now.h"
#include "dns.h"
#include "case.h"
#include "spf.h"
Include dependency graph for spf.c:

Go to the source code of this file.

Data Structures

struct  spf_aliases
 
struct  mechanisms
 

Functions

int spf_query (const char *remoteip, const char *helo, const char *mf, const char *local, const int flagip)
 spf_query prepares the SPF TXT record query
 
int spf_lookup (stralloc *domain)
 spf_lookup calles the actual (recursive) SPF DNS query
 
int spf_mechanism (char *mechanism, char *spfspec, char *prefix, char *domain)
 spf_mechanism evaluates the provided mechanisms in the SPF record [RFC7208 Sec 5.]
 
int spf_include (char *spfspec, char *prefix)
 spf_include deals with recursive evaluation of SPF record [RFC7208 Sec. 5.2]
 
int spf_parse (stralloc *sa, char *spfspec, char *domain)
 spf_parse parses the substructure of the SPF record and calls spf_macros
 
int spf_macros (stralloc *expand, char *macro, char *domain)
 spf_macros deals with macros in the SPF specificaton [RFC7208 Sec. 7ff]
 
int spf_info (char *s, const char *t)
 

Variables

stralloc spfinfo = {0}
 
stralloc spfrecord = {0}
 
stralloc spflocalrules
 
stralloc spfexplain
 
stralloc spfmf = {0}
 
stralloc spfhelo = {0}
 
stralloc dnsname = {0}
 
stralloc spflocal = {0}
 
stralloc spfexpmsg = {0}
 
stralloc expdomain = {0}
 
int flagip6
 
stralloc domain = {0}
 
stralloc identity = {0}
 
char ip4remote [4] = {0, 0, 0, 0}
 
char ip6remote [16] = {16 * 0}
 

Function Documentation

◆ spf_include()

int spf_include ( char *  spfspec,
char *  prefix 
)

spf_include deals with recursive evaluation of SPF record [RFC7208 Sec. 5.2]

Parameters
inputpointer to included SPF specification; CIDR prefix length
Returns
int r = 1 ok; 0 failure

Definition at line 431 of file spf.c.

Here is the call graph for this function:

◆ spf_info()

int spf_info ( char *  s,
const char *  t 
)

Definition at line 640 of file spf.c.

Here is the caller graph for this function:

◆ spf_lookup()

int spf_lookup ( stralloc *  domain)

spf_lookup calles the actual (recursive) SPF DNS query

Parameters
inputpointer to stralloc domain (fqdn) @input stralloc spflocalrules (if provided – for artificial results) @output stralloc spfdata with RDATA (+ artificial information)
Returns
int r = SPF return code

Definition at line 158 of file spf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spf_macros()

int spf_macros ( stralloc *  expand,
char *  macro,
char *  domain 
)

spf_macros deals with macros in the SPF specificaton [RFC7208 Sec. 7ff]

Parameters
inputpointer to SPF macro, pointer to domain output: pointer to stralloc expand(ed information)
Returns
int r = 1 ok; 0 failure

Definition at line 502 of file spf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spf_mechanism()

int spf_mechanism ( char *  mechanism,
char *  spfspec,
char *  prefix,
char *  domain 
)

spf_mechanism evaluates the provided mechanisms in the SPF record [RFC7208 Sec 5.]

Parameters
inputpointer to mechanism, SPF specification from record, CIDR prefix length, domain @input stralloc spflocalrules (if provided) @output pointer to spfspec: data evaluated
Returns
int r

Definition at line 391 of file spf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spf_parse()

int spf_parse ( stralloc *  sa,
char *  spfspec,
char *  domain 
)

spf_parse parses the substructure of the SPF record and calls spf_macros

Parameters
inputpointer to SPF specification, pointer to domain output: stralloc sa – @output pointer to spfspec: with found data
Returns
int r = 1 ok; 0 failure

Definition at line 461 of file spf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spf_query()

int spf_query ( const char *  remoteip,
const char *  helo,
const char *  mf,
const char *  local,
const int  flagip 
)

spf_query prepares the SPF TXT record query

Parameters
inputpointer to remoteip, helo, mf, localhost, and flagIP6
Returns
int r = SPF return code

Definition at line 58 of file spf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dnsname

stralloc dnsname = {0}

Definition at line 27 of file spf.c.

◆ domain

stralloc domain = {0}

Definition at line 34 of file spf.c.

◆ expdomain

stralloc expdomain = {0}

Definition at line 31 of file spf.c.

◆ flagip6

int flagip6

Definition at line 32 of file spf.c.

◆ identity

stralloc identity = {0}

Definition at line 35 of file spf.c.

◆ ip4remote

char ip4remote[4] = {0, 0, 0, 0}

Definition at line 38 of file spf.c.

◆ ip6remote

char ip6remote[16] = {16 * 0}

Definition at line 39 of file spf.c.

◆ spfexplain

stralloc spfexplain

Definition at line 23 of file spf.c.

◆ spfexpmsg

stralloc spfexpmsg = {0}

Definition at line 30 of file spf.c.

◆ spfhelo

stralloc spfhelo = {0}

Definition at line 26 of file spf.c.

◆ spfinfo

stralloc spfinfo = {0}

Definition at line 17 of file spf.c.

◆ spflocal

stralloc spflocal = {0}

Definition at line 28 of file spf.c.

◆ spflocalrules

stralloc spflocalrules

Definition at line 22 of file spf.c.

◆ spfmf

stralloc spfmf = {0}

Definition at line 25 of file spf.c.

◆ spfrecord

stralloc spfrecord = {0}

Definition at line 18 of file spf.c.