spf_internal.h File Reference

#include "spf_record.h"

Include dependency graph for spf_internal.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define TRUE   1
#define FALSE   0
#define NULL   ((void *)0)
#define array_elem(x)   ((long int)(sizeof( x ) / sizeof( *x )))
#define SPF_MAX_DNS_MECH   10
#define SPF_MAX_DNS_PTR   10
#define SPF_MAX_DNS_MX   10
#define _ALIGN_SZ   4
#define SPF_WRAP_FUNCTION(name, proto, args)


char * SPF_sanitize (SPF_server_t *spf_server, char *str)
void SPF_print_sizeof (void)
SPF_errcode_t SPF_realloc (char **bufp, size_t *buflenp, int buflen)

Define Documentation

#define _ALIGN_SZ   4

Definition at line 73 of file spf_internal.h.

#define array_elem (  )     ((long int)(sizeof( x ) / sizeof( *x )))

Definition at line 31 of file spf_internal.h.

Referenced by SPF_dns_test_new(), and SPF_record_expand_data().

#define FALSE   0

Definition at line 24 of file spf_internal.h.

Referenced by main(), SPF_dns_get_client_dom(), SPF_record_interpret(), SPF_record_stringify(), and SPF_request_is_loopback().

#define NULL   ((void *)0)

Definition at line 28 of file spf_internal.h.

Referenced by _getopt_internal(), main(), ns_initparse(), ns_name_ntol(), ns_name_ntop(), ns_name_pack(), ns_name_pton(), ns_name_rollback(), ns_parserr(), ns_skiprr(), SPF_debugv(), SPF_debugx(), SPF_debugx2(), SPF_dns_cache_new(), SPF_dns_cache_set_ttl(), SPF_dns_free(), SPF_dns_lookup(), SPF_dns_null_new(), SPF_dns_resolv_new(), SPF_dns_rr_buf_realloc(), SPF_dns_rr_dup(), SPF_dns_rr_new(), SPF_dns_rr_new_init(), SPF_dns_set_conserve_cache(), SPF_dns_test_new(), SPF_dns_zone_add_str(), SPF_dns_zone_new(), SPF_errorv(), SPF_errorx(), SPF_errorx2(), SPF_infov(), SPF_infox(), SPF_infox2(), SPF_realloc(), SPF_record_compile(), SPF_record_expand_data(), SPF_record_interpret(), SPF_record_print(), SPF_record_stringify(), SPF_request_get_client_dom(), SPF_request_get_exp(), SPF_request_query_rcptto(), SPF_request_set_env_from(), SPF_request_set_helo_dom(), SPF_request_set_ipv4(), SPF_request_set_ipv4_str(), SPF_request_set_ipv6(), SPF_request_set_ipv6_str(), SPF_response_add_error(), SPF_response_add_warn(), SPF_sanitize(), SPF_server_get_record(), SPF_server_new(), SPF_server_set_explanation(), SPF_server_set_localpolicy(), SPF_server_set_rec_dom(), SPF_warningv(), SPF_warningx(), and SPF_warningx2().

#define SPF_MAX_DNS_MECH   10

It is a bad idea to change this for two reasons.

First, the obvious reason is the delays caused on the mail server you are running. DNS lookups that timeout can be *very* time consuming, and even successful DNS lookups can take 200-500ms. Many MTAs can't afford to wait long and even 2sec is pretty bad.

The second, and more important reason, is the SPF records come from a third party which may be malicious. This third party can direct DNS lookups to be sent to anyone. If there isn't a limit, then it is easy for someone to create a distributed denial of service attack simply by sending a bunch of emails. Unlike the delays on your system caused by many DNS lookups, you might not even notice that you are being used as part of a DDoS attack.

Definition at line 55 of file spf_internal.h.

#define SPF_MAX_DNS_MX   10

It is a bad idea to change this for the same reasons as mentioned above for SPF_MAX_DNS_MECH

Definition at line 69 of file spf_internal.h.

#define SPF_MAX_DNS_PTR   10

It is a bad idea to change this for the same reasons as mentioned above for SPF_MAX_DNS_MECH

Definition at line 62 of file spf_internal.h.

Referenced by SPF_dns_get_client_dom().

#define SPF_WRAP_FUNCTION ( name,
args   ) 


SPF_errcode_t name proto {                         SPF_errcode_t err = name ## _real args;                         SPF_debug(#name " returns %d\n", err);                         return err;                 }                 SPF_errcode_t name ## _real proto
A wrapper for reporting errors from sub-functions. SPF_errcode_t foo(int a) { ... } becomes: SPF_WRAP_FUNCTION(SPF_foo, (int a), (a)) { .... } As yet unused.

Definition at line 152 of file spf_internal.h.

#define TRUE   1

Definition at line 23 of file spf_internal.h.

Referenced by main(), SPF_dns_zone_add_str(), SPF_record_compile_macro(), SPF_record_interpret(), SPF_record_stringify(), SPF_request_get_exp(), SPF_request_is_loopback(), and SPF_server_get_record().

Function Documentation

void SPF_print_sizeof ( void   ) 

Definition at line 82 of file spf_print.c.

References SPF_infof.

SPF_errcode_t SPF_realloc ( char **  bufp,
size_t *  buflenp,
int  buflen 

This is NOT a general-purpose realloc. It is used only for text buffers. It will allocate at least 64 bytes of storage.

Definition at line 183 of file spf_utils.c.


Referenced by SPF_record_expand_data(), and SPF_record_stringify().

char* SPF_sanitize ( SPF_server_t spf_server,
char *  str 

Sanitizes a string for printing.

This replaces all nonprintable characters in str with a '?'. The source string is modified in-place.

Definition at line 54 of file spf_utils.c.

References NULL, SPF_server_struct::sanitize, and SPF_ASSERT_NOTNULL.

Generated on Tue Nov 4 13:27:42 2008 for libspf2 by  doxygen 1.5.4