spf_interpret.c File Reference

#include "spf_sys_config.h"
#include <ctype.h>
#include "spf.h"
#include "spf_dns.h"
#include "spf_internal.h"
#include "spf_dns_internal.h"
#include "spf_server.h"

Include dependency graph for spf_interpret.c:

Go to the source code of this file.


#define DONE(result, reason, err)   SPF_i_done(spf_response, result, reason, err)
#define DONE_MECH(result)   DONE(result, SPF_REASON_MECH, SPF_E_SUCCESS)
#define INET_NTOP(af, src, dst, cnt)
#define SPF_ADD_DNS_MECH()   do { spf_response->num_dns_mech++; } while(0)
#define SPF_FREE_LOOKUP_DATA()   do { if (buf != NULL) { free(buf); buf = NULL; } } while(0)


SPF_errcode_t SPF_i_done (SPF_response_t *spf_response, SPF_result_t result, SPF_reason_t reason, SPF_errcode_t err)
SPF_errcode_t SPF_record_interpret (SPF_record_t *spf_record, SPF_request_t *spf_request, SPF_response_t *spf_response, int depth)

Define Documentation

#define DONE ( result,
err   )     SPF_i_done(spf_response, result, reason, err)

Definition at line 374 of file spf_interpret.c.

Referenced by SPF_record_interpret().

#define DONE_MECH ( result   )     DONE(result, SPF_REASON_MECH, SPF_E_SUCCESS)

Definition at line 377 of file spf_interpret.c.

Referenced by SPF_record_interpret().


Definition at line 376 of file spf_interpret.c.

Referenced by SPF_record_interpret().


Definition at line 375 of file spf_interpret.c.

Referenced by SPF_record_interpret().

#define INET_NTOP ( af,
cnt   ) 


do {         if (inet_ntop(af, src, dst, cnt) == NULL)                 snprintf(dst, cnt, "ip-error" );                         } while(0)

Definition at line 418 of file spf_interpret.c.

Referenced by SPF_record_interpret().

#define SPF_ADD_DNS_MECH (  )     do { spf_response->num_dns_mech++; } while(0)

Referenced by SPF_record_interpret().

#define SPF_FREE_LOOKUP_DATA (  )     do { if (buf != NULL) { free(buf); buf = NULL; } } while(0)

Referenced by SPF_record_interpret().

#define SPF_GET_LOOKUP_DATA (  ) 


do {                                                                                                            if ( data == data_end )                                                                         lookup = spf_request->cur_dom;                                          else {                                                                                                          err = SPF_record_expand_data( spf_server,                                                               spf_request, spf_response,                                                              data, ((char *)data_end - (char *)data),                                                                &buf, &buf_len );                                               if (err == SPF_E_NO_MEMORY) {                                                           SPF_FREE_LOOKUP_DATA();                                                                 return DONE_TEMPERR(err);                                                       }                                                                                                               if (err) {                                                                                                      SPF_FREE_LOOKUP_DATA();                                                                 return DONE_PERMERR(err);                                                       }                                                                                                               lookup = buf;                                                                           }                                                                                                       } while(0)

Referenced by SPF_record_interpret().

#define SPF_MAYBE_SKIP_CIDR (  ) 


do {                 if ( data < data_end && data->dc.parm_type == PARM_CIDR )                         data = SPF_data_next( data );         } while(0)

Referenced by SPF_record_interpret().

Function Documentation

SPF_errcode_t SPF_i_done ( SPF_response_t spf_response,
SPF_result_t  result,
SPF_reason_t  reason,
SPF_errcode_t  err 

This must be called with EITHER spf_response->spf_record_exp != NULL OR result in { SPF_RESULT_PASS SPF_RESULT_INVALID SPF_RESULT_TEMPERROR SPF_RESULT_PERMERROR } or the library will abort when it tries to generate an explanation.

Definition at line 388 of file spf_interpret.c.

References SPF_response_struct::err, SPF_response_struct::reason, SPF_response_struct::result, SPF_ASSERT_NOTNULL, SPF_response_struct::spf_request, and SPF_request_struct::spf_server.

Referenced by SPF_request_query_fallback(), SPF_request_query_mailfrom(), and SPF_request_query_rcptto().

SPF_errcode_t SPF_record_interpret ( SPF_record_t spf_record,
SPF_request_t spf_request,
SPF_response_t spf_response,
int  depth 

Definition at line 584 of file spf_interpret.c.

References SPF_dns_rr_data_t::a, SPF_dns_rr_data_t::aaaa, SPF_request_struct::client_ver, SPF_request_struct::cur_dom, SPF_server_struct::debug, DONE, DONE_MECH, DONE_PERMERR, DONE_TEMPERR, FALSE, SPF_dns_rr_t::herrno, INET_NTOP, SPF_request_struct::ipv4, SPF_request_struct::ipv6, SPF_server_struct::local_policy, SPF_server_struct::max_dns_mech, SPF_server_struct::max_dns_mx, SPF_server_struct::max_dns_ptr, MECH_A, MECH_ALL, MECH_EXISTS, SPF_record_struct::mech_first, MECH_INCLUDE, MECH_IP4, MECH_IP6, MECH_MX, MECH_PTR, MECH_REDIRECT, SPF_mech_t::mech_type, SPF_dns_rr_data_t::mx, ns_t_a, ns_t_aaaa, ns_t_mx, ns_t_ptr, NULL, SPF_response_struct::num_dns_mech, SPF_record_struct::num_mech, SPF_dns_rr_t::num_rr, PREFIX_FAIL, PREFIX_SOFTFAIL, SPF_mech_t::prefix_type, PREFIX_UNKNOWN, SPF_dns_rr_data_t::ptr, SPF_response_struct::reason, SPF_server_struct::resolver, SPF_response_struct::result, SPF_dns_rr_t::rr, SPF_dns_rr_t::rr_type, SPF_ADD_DNS_MECH, SPF_ASSERT_NOTNULL, SPF_debugf, SPF_dns_lookup(), SPF_dns_rlookup(), SPF_dns_rlookup6(), SPF_dns_rr_free(), SPF_E_BIG_DNS, SPF_E_DNS_ERROR, SPF_E_INCLUDE_RETURNED_NONE, SPF_E_NO_MEMORY, SPF_E_NOT_CONFIG, SPF_E_RECURSIVE, SPF_E_SUCCESS, SPF_E_UNKNOWN_MECH, SPF_FREE_LOOKUP_DATA, SPF_GET_LOOKUP_DATA, SPF_MAYBE_SKIP_CIDR, SPF_REASON_DEFAULT, SPF_REASON_LOCALHOST, SPF_REASON_MECH, SPF_REASON_NONE, SPF_response_struct::spf_record_exp, SPF_record_expand_data(), SPF_record_free(), SPF_record_interpret(), SPF_request_is_loopback(), SPF_response_errcode(), SPF_response_free(), SPF_response_new(), SPF_response_result(), SPF_RESULT_FAIL, SPF_RESULT_INVALID, SPF_RESULT_NEUTRAL, SPF_RESULT_NONE, SPF_RESULT_PASS, SPF_RESULT_PERMERROR, SPF_RESULT_SOFTFAIL, SPF_RESULT_TEMPERROR, SPF_record_struct::spf_server, SPF_server_get_record(), SPF_strerror(), SPF_strreason(), SPF_strresult(), TRUE, TRY_AGAIN, and SPF_request_struct::use_local_policy.

Referenced by SPF_record_interpret().

Here is the call graph for this function:

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