head 1.38; access; symbols milter-greylist-4-5-13:1.38 milter-greylist-4-5-12:1.38 milter-greylist-4-5-11:1.38 milter-greylist-4-5-10:1.38 milter-greylist-4-9-10:1.38 milter-greylist-4-5-8:1.38 milter-greylist-4-5-9:1.38 milter-greylist-4-5-7:1.37 milter-greylist-4-5-6:1.37 milter-greylist-4-5:1.37 milter-greylist-4-5-5:1.37 milter-greylist-4-5-4:1.37 milter-greylist-4-5-3:1.36 milter-greylist-4-5-2:1.35 milter-greylist-4-5-1:1.33 milter-greylist-4-4-3:1.33 milter-greylist-4-4-2:1.33 milter-greylist-4-4-1:1.33 milter-greylist-4-4:1.33 milter-greylist-4-4-rc1:1.33 milter-greylist-4-4-alpha4:1.33 milter-greylist-4-4-alpha3:1.33 milter-greylist-4-4-alpha2:1.33 milter-greylist-4-4-alpha1:1.33 milter-greylist-4-2-7:1.31.2.1 milter-greylist-4-3-9:1.32 milter-greylist-4-2-6:1.31.2.1 milter-gresylit-4-2-6:1.31.2.1 milter-greylist-4-3-8:1.32 milter-greylist-4-3-7:1.31 milter-greylist-4-2-5:1.31 milter-greylist-4-3-6:1.31 milter-greylist-4-2-4:1.31 milter-greylist-4-3-5:1.31 milter-greylist-4-3-4:1.31 milter-greylist-4-2-3:1.31 milter-greylist-4-3-3:1.31 rmilter-greylist-4-2-3:1.31 milter-greylist-4-3-2:1.31 milter-greylist-4-3-1:1.31 milter-greylist-2-2-2:1.31 milter-greylist-4-2-2:1.31 milter-greylist-4-2-1:1.31 milter-greylist-4-2:1.31 milter-greylist-4-2-rc1:1.31 milter-greylist-4-2-beta1:1.31 milter-greylist-4-2-branch:1.31.0.2 milter-greylist-4-2-base:1.31 milter-greylist-4-2-0-base:1.31 milter-greylist-4-1-12:1.31 milter-greylist-4-1-11:1.31 milter-greylist-4-1-10:1.31 milter-greylist-4-1-9:1.31 milter-greylist-4-1-8:1.31 milter-greylist-4-1-7:1.31 milter-greylist-4-1-6:1.31 milter-greylist-4-0-1:1.26 milter-greylist-4-0-1-rc1:1.26 milter-greylist-4-1-5:1.31 milter-greylist-4-1-4:1.31 milter-greylist-4-1-3:1.31 milter-greylist-4-1-2:1.30 milter-greylist-4-1-1:1.29 milter-greylist-4-0-branch:1.26.0.2 milter-greylist-4-0-base:1.26 milter-greylist-4-0:1.26 milter-greylist-4-0-rc2:1.26 milter-greylist-4-0-rc1:1.26 milter-greylist-4-0-beta4:1.26 milter-greylist-4-0-beta3:1.26 milter-greylist-4-0-beta2:1.26 milter-greylist-4-0-beta1:1.26 milter-greylist-4-0-alpha6:1.25 milter-greylist-4-0-alpha5:1.25 milter-greylist-4-0-alpha4:1.25 milter-greylist-4-0-alpha3:1.25 milter-greylist-4-0-alpha2:1.25 milter-greylist-4-0-alpha1:1.25 milter-greylist-3-1-8:1.25 milter-greylist-3-1-7:1.25 milter-greylist-3-1-6:1.25 milter-greylist-3-1-5:1.25 milter-greylist-3-1-5-alpha1:1.25 milter-greylist-3-0-1-beta1:1.23 milter-greylist-3-1-4:1.24 milter-greylist-3-1-3:1.23 milter-greylist-3-1-2:1.23 milter-greylist-3-1-1:1.23 milter-greylist-3-0:1.23 milter-greylist-3-0-rc7:1.23 milter-greylist-3-0-rc6:1.23 milter-greylist-3-0-rc5:1.23 milter-greylist-3-0-rc4:1.23 milter-greylist-3-0-rc3:1.23 milter-greylist-3-0-rc2:1.23 milter-greylist-3-0-rc1:1.23 milter-greylist-3-0-alpha6:1.23 milter-greylist-3-0-branch:1.23.0.2 milter-greylist-3-0-base:1.23 milter-greylist-3-0-alpha5:1.23 milter-greylist-3-0-alpha4:1.23 milter-greylist-3-0-alpha3:1.23 milter-greylist-3-0-alpha2:1.22 milter-greylist-3-0-alpha1:1.22 milter-greylist-2-1-12:1.22 milter-greylist-2-1-11:1.22 milter-greylist-2-1-10:1.22 milter-greylist-2-1-9:1.22 milter-greylist-2-1-9a1:1.22 milter-greylist-2-1-8:1.22 milter-greylist-2-1-7:1.22 milter-greylist-2-1-6:1.21 milter-greylist-2-1-5:1.21 milter-greylist-2-1-4:1.21 milter-greylist-2-1-3:1.21 milter-greylist-2-1-2:1.21 milter-greylist-2-1-1:1.21 milter-greylist-2-0-2:1.21 milter-greylist-2-0-1:1.21 milter-greylist-2-0-1-b1:1.21 milter-greylist-2-0-release:1.20 milter-greylist-2-0-rc5:1.20 milter-greylist-2-0-rc4:1.20 milter-greylist-2-0-rc3:1.20 milter-grey-list-2-0-rc3:1.20 milter-grey-list-2-0-rc2:1.19 milter-grey-list-2-0-rc1:1.19 milter-greylist-2-0-beta7:1.19 milter-greylist-2-0-beta6:1.19 milter-gre-ylist-2-0-beta5:1.19 milter-greylist-2-0-beta5:1.19 milter-greylist-2-0-beta4:1.19 milter-greylist-2-0-beta3:1.19 milter-greylist-2-0-beta2:1.18 milter-greylist-2-0:1.18.0.2 milter-greylist-2-0-base:1.18 milter-greylist-2-0-beta1:1.18 milter-greylist-1-7-5:1.17 before_delayed_tempfail:1.17 milter-greylist-1-7-4:1.17 milter-greylist-1-7-3:1.17 milter-greylist-1-7-2:1.16 milter-greylist-1-6-0:1.14 milter-greylist-1-7-1:1.14 milter-greylist-1-6rc1:1.14 milter-greylist-1-6:1.14.0.2 milter-greylist-1-6-base:1.14 milter-greylist-1-5-12:1.14 milter-greylist-1-5-11:1.14 milter-greylist-1-5-10:1.14 milter-greylist-1-5-9:1.14 milter-greylist-1-5-8:1.14 milter-greylist-1-5-7:1.14 milter-greylist-1-5-6:1.14 milter-greylist-1-5-5:1.14 milter-greylist-1-5-4:1.14 milter-greylist-1-5-3:1.13 milter-greylist-1-5-2:1.13 milter-greylist-1-5-1:1.13 milter-greylist-1-4:1.13.0.4 milter-greylist-1-4-base:1.13 milter-greylist-1-3-9:1.13 milter-greylist-1-3-8:1.13 milter-greylist-1-3-7:1.13 milter-greylist-1-3-6:1.13 milter-greylist-1-3-5:1.13 milter-greylist-1-3-4:1.13 milter-greylist-1-3-3:1.13 BDB:1.13.0.2 BDB-base:1.13 before_BDB:1.13 milter-greylist-1-2-2:1.12 milter-greylist-1-3-2:1.12 milter-greylist-1-2-1:1.12 milter-greylist-1-2-0:1.12 milter-greylist-1-2:1.12.0.2 milter-greylist-1-2-base:1.12 milter-greylist-1-1-16:1.12 milter-greylist-1-1-15:1.11 milter-greylis-1-1-15:1.11 milter-greylis-1-1-16:1.12 milter-greylist-1-1-14:1.11 milter-greylist-1-1-13:1.11 milter-greylist-1-1-12:1.11 milter-greylist-1-1-11:1.11 milter-greylist-1-1-10:1.9 milter-greylist-1-10rc1:1.9 milter-greylist-1-1-9:1.7 milter-greylist-1-1-8:1.7 milter-greylist-1-1-7:1.7 milter-greylist-1-1-6:1.7 milter-greylist-1-1-5:1.4 milter-greylist-1-1-4:1.4 milter-greylist-1-1-3:1.4 milter-greylist-1-1-2:1.4; locks; strict; comment @ * @; 1.38 date 2013.10.04.08.01.10; author manu; state Exp; branches; next 1.37; 1.37 date 2013.08.18.12.23.14; author manu; state Exp; branches; next 1.36; 1.36 date 2013.08.16.11.21.36; author manu; state Exp; branches; next 1.35; 1.35 date 2013.08.13.03.45.35; author manu; state Exp; branches; next 1.34; 1.34 date 2013.08.12.04.17.24; author manu; state Exp; branches; next 1.33; 1.33 date 2011.08.17.01.06.50; author manu; state Exp; branches; next 1.32; 1.32 date 2010.05.23.08.59.03; author manu; state Exp; branches; next 1.31; 1.31 date 2008.07.31.10.56.40; author manu; state Exp; branches 1.31.2.1; next 1.30; 1.30 date 2008.05.27.04.49.59; author manu; state Exp; branches; next 1.29; 1.29 date 2007.11.08.04.32.06; author manu; state Exp; branches; next 1.28; 1.28 date 2007.11.07.00.02.27; author manu; state Exp; branches; next 1.27; 1.27 date 2007.11.06.11.39.33; author manu; state Exp; branches; next 1.26; 1.26 date 2007.07.08.21.02.28; author manu; state Exp; branches; next 1.25; 1.25 date 2007.01.28.02.16.33; author manu; state Exp; branches; next 1.24; 1.24 date 2007.01.09.22.22.43; author manu; state Exp; branches; next 1.23; 1.23 date 2006.08.27.20.54.41; author manu; state Exp; branches; next 1.22; 1.22 date 2006.07.27.12.48.24; author manu; state Exp; branches; next 1.21; 1.21 date 2005.10.03.07.58.53; author manu; state Exp; branches; next 1.20; 1.20 date 2005.06.05.21.42.30; author manu; state Exp; branches; next 1.19; 1.19 date 2005.02.14.15.16.30; author manu; state Exp; branches; next 1.18; 1.18 date 2005.02.03.21.15.33; author manu; state Exp; branches; next 1.17; 1.17 date 2004.12.09.22.01.17; author manu; state Exp; branches; next 1.16; 1.16 date 2004.12.08.22.23.09; author manu; state Exp; branches; next 1.15; 1.15 date 2004.12.08.17.49.48; author manu; state Exp; branches; next 1.14; 1.14 date 2004.08.01.09.27.03; author manu; state Exp; branches; next 1.13; 1.13 date 2004.05.04.20.50.33; author manu; state Exp; branches; next 1.12; 1.12 date 2004.04.14.08.46.14; author manu; state Exp; branches; next 1.11; 1.11 date 2004.04.08.15.27.51; author manu; state Exp; branches; next 1.10; 1.10 date 2004.04.08.11.32.53; author manu; state Exp; branches; next 1.9; 1.9 date 2004.04.07.09.09.09; author manu; state Exp; branches; next 1.8; 1.8 date 2004.04.04.14.14.00; author manu; state Exp; branches; next 1.7; 1.7 date 2004.04.01.14.03.52; author manu; state Exp; branches; next 1.6; 1.6 date 2004.04.01.13.57.50; author manu; state Exp; branches; next 1.5; 1.5 date 2004.04.01.13.39.45; author manu; state Exp; branches; next 1.4; 1.4 date 2004.03.30.16.07.21; author manu; state Exp; branches; next 1.3; 1.3 date 2004.03.30.16.00.10; author manu; state Exp; branches; next 1.2; 1.2 date 2004.03.30.14.17.47; author manu; state Exp; branches; next 1.1; 1.1 date 2004.03.30.12.26.03; author manu; state Exp; branches; next ; 1.31.2.1 date 2010.05.23.09.01.11; author manu; state Exp; branches; next ; desc @@ 1.38 log @FreeBSD build fix (John Wood) @ text @/* $Id: spf.c,v 1.37 2013/08/18 12:23:14 manu Exp $ */ /* * Copyright (c) 2004-2007 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: spf.c,v 1.37 2013/08/18 12:23:14 manu Exp $"); #endif #endif #include #include #include #include #include #include #include #include #include #include #include #include "conf.h" #include "spf.h" #include "acl.h" #include "milter-greylist.h" #ifdef USE_DMALLOC #include #endif #ifdef __FreeBSD__ #define HAVE_NS_TYPE #endif #if (defined(HAVE_SPF) || defined(HAVE_SPF_ALT) || \ defined(HAVE_SPF2_10) || defined(HAVE_SPF2)) static int spf_check_internal(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); static int spf_check_self(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); #endif #ifdef HAVE_SPF #include #ifndef SPF_FALSE #define SPF_FALSE 0 #endif static int spf_check_internal(ad, as, ap, priv) acl_data_t *ad; acl_stage_t as; struct acl_param *ap; struct mlfi_priv *priv; { struct sockaddr *sa = SA(&priv->priv_addr); socklen_t salen = priv->priv_addrlen; char *helo = priv->priv_helo; char *fromp = priv->priv_from; peer_info_t *p = NULL; char addr[IPADDRSTRLEN]; int result = 0; struct timeval tv1, tv2, tv3; enum spf_status status; char *statestr = ""; if (conf.c_debug) gettimeofday(&tv1, NULL); if (sa->sa_family != AF_INET) /* libspf doesn't support IPv6 */ return result; if (!iptostring(sa, salen, addr, sizeof(addr))) return result; if ((p = SPF_init("milter-greylist", addr, NULL, NULL, NULL, SPF_FALSE, SPF_FALSE)) == NULL) { mg_log(LOG_ERR, "SPF_Init failed"); goto out1; } SPF_smtp_helo(p, helo); SPF_smtp_from(p, from); p->RES = SPF_policy_main(p); status = ad ? *(enum spf_status *)ad : MGSPF_PASS; switch (status) { case MGSPF_PASS: result = (p->RES == SPF_PASS); statestr = "pass"; break; case MGSPF_FAIL: result = (p->RES == SPF_H_FAIL); statestr = "fail"; break; case MGSPF_SOFTFAIL: result = (p->RES == SPF_S_FAIL); statestr = "softfail"; break; case MGSPF_NEUTRAL: result = (p->RES == SPF_NEUTRAL); statestr = "neutral"; break; case MGSPF_UNKNOWN: result = (p->RES == SPF_UNKNOWN || p->RES == SPF_UNMECH); statestr = "unknown"; break; case MGSPF_ERROR: result = (p->RES == SPF_ERROR); statestr = "error"; break; case MGSPF_NONE: result = (p->RES == SPF_NONE); statestr = "none"; break; default: mg_log(LOG_ERR, "Internal error: unexpected spf_status %d", " spf raw result %d", status, p->RES); exit(EX_SOFTWARE); break; } if (conf.c_debug) mg_log(LOG_DEBUG, "SPF return code %d (test %s, result %d)", p->RES, statestr, result); SPF_close(p); out1: if (conf.c_debug) { gettimeofday(&tv2, NULL); timersub(&tv2, &tv1, &tv3); mg_log(LOG_DEBUG, "SPF lookup performed in %ld.%06lds", tv3.tv_sec, tv3.tv_usec); } return result; } #endif /* HAVE_SPF */ #if defined(HAVE_SPF_ALT) || defined(HAVE_SPF2_10) || defined(HAVE_SPF2) /* SMTP needs at least 64 chars for local part and 255 for doamin... */ #ifndef NS_MAXDNAME #define NS_MAXDNAME 1025 #endif #endif #ifdef HAVE_SPF_ALT #include #include #include #endif #ifdef HAVE_SPF2_10 #include #include #include #endif #if defined(HAVE_SPF_ALT) || defined(HAVE_SPF2_10) static int spf_check_internal(ad, as, ap, priv) acl_data_t *ad; acl_stage_t as; struct acl_param *ap; struct mlfi_priv *priv; { struct sockaddr *sa = SA(&priv->priv_addr); socklen_t salen = priv->priv_addrlen; char *helo = priv->priv_helo; char *fromp = priv->priv_from; SPF_config_t spfconf; SPF_dns_config_t dnsconf; char addr[IPADDRSTRLEN]; char from[NS_MAXDNAME + 1]; SPF_output_t out; int result = 0; struct timeval tv1, tv2, tv3; size_t len; enum spf_status status; char *statestr = ""; if (conf.c_debug) gettimeofday(&tv1, NULL); if ((spfconf = SPF_create_config()) == NULL) { mg_log(LOG_ERR, "SPF_create_config failed"); goto out1; } if ((dnsconf = SPF_dns_create_config_resolv(NULL, 0)) == NULL) { mg_log(LOG_ERR, "SPF_dns_create_config_resolv faile"); goto out2; } /* * Get the IP address */ if (!iptostring(sa, salen, addr, sizeof(addr))) { mg_log(LOG_ERR, "SPF_set_ip_str failed"); goto out3; } if (SPF_set_ip_str(spfconf, addr) != 0) { mg_log(LOG_ERR, "SPF_set_ip_str failed"); goto out3; } /* HELO string */ if (SPF_set_helo_dom(spfconf, helo) != 0) { mg_log(LOG_ERR, "SPF_set_helo failed"); goto out3; } /* * And the enveloppe source e-mail */ if (fromp[0] == '<') fromp++; /* strip leading < */ strncpy(from, fromp, NS_MAXDNAME); from[NS_MAXDNAME] = '\0'; len = strlen(from); if (fromp[len - 1] == '>') from[len - 1] = '\0'; /* strip trailing > */ if (SPF_set_env_from(spfconf, from) != 0) { mg_log(LOG_ERR, "SPF_set_env_from failed"); goto out3; } /* * Get the SPF result */ SPF_init_output(&out); #if 0 &&((SPF_LIB_VERSION_MAJOR == 0) && (SPF_LIB_VERSION_MINOR <= 3)) out = SPF_result(spfconf, dnsconf, NULL); #else out = SPF_result(spfconf, dnsconf); #endif status = ad ? *(enum spf_status *)ad : MGSPF_PASS; switch (status) { case MGSPF_PASS: result = (out.result == SPF_RESULT_PASS); statestr = "pass"; break; case MGSPF_FAIL: result = (out.result == SPF_RESULT_FAIL); statestr = "fail"; break; case MGSPF_SOFTFAIL: result = (out.result == SPF_RESULT_SOFTFAIL); statestr = "softfail"; break; case MGSPF_NEUTRAL: result = (out.result == SPF_RESULT_NEUTRAL); statestr = "neutral"; break; case MGSPF_UNKNOWN: result = (out.result == SPF_RESULT_UNKNOWN); statestr = "unknown"; break; case MGSPF_ERROR: result = (out.result == SPF_RESULT_ERROR); statestr = "error"; break; case MGSPF_NONE: result = (out.result == SPF_RESULT_NONE); statestr = "none"; break; default: mg_log(LOG_ERR, "Internal error: unexpected spf_status %d", " spf_alt/spf_2_10 raw result %d", status, out.result); exit(EX_SOFTWARE); break; } if (conf.c_debug) mg_log(LOG_DEBUG, "SPF return code %d (test %s, result %d)", out.result, statestr, result); SPF_free_output(&out); out3: SPF_dns_destroy_config_resolv(dnsconf); out2: SPF_destroy_config(spfconf); out1: if (conf.c_debug) { gettimeofday(&tv2, NULL); timersub(&tv2, &tv1, &tv3); mg_log(LOG_DEBUG, "SPF lookup performed in %ld.%06lds", tv3.tv_sec, tv3.tv_usec); } return result; } #endif /* HAVE_SPF_ALT */ #ifdef HAVE_SPF2 #include static int spf_check_internal(ad, as, ap, priv) acl_data_t *ad; acl_stage_t as; struct acl_param *ap; struct mlfi_priv *priv; { struct sockaddr *sa = SA(&priv->priv_addr); char *helo = priv->priv_helo; char *fromp = priv->priv_from; SPF_server_t *spf_server; SPF_request_t *spf_request; SPF_response_t *spf_response; char from[NS_MAXDNAME + 1]; int res, result = 0; struct timeval tv1, tv2, tv3; size_t len; enum spf_status status; char *statestr = ""; if (conf.c_debug) gettimeofday(&tv1, NULL); if ((spf_server = SPF_server_new(SPF_DNS_CACHE, 0)) == NULL) { mg_log(LOG_ERR, "SPF_server_new failed"); goto out1; } if ((spf_request = SPF_request_new(spf_server)) == NULL) { mg_log(LOG_ERR, "SPF_request_new failed"); goto out2; } /* * Get the IP address */ switch (sa->sa_family) { case AF_INET: res = SPF_request_set_ipv4(spf_request, *SADDR4(sa)); break; #ifdef AF_INET6 case AF_INET6: res = SPF_request_set_ipv6(spf_request, *SADDR6(sa)); break; #endif default: mg_log(LOG_ERR, "unknown address family %d", sa->sa_family); goto out3; } if (res != 0) { mg_log(LOG_ERR, "SPF_request_set_ip_str failed"); goto out3; } /* HELO string */ if (SPF_request_set_helo_dom(spf_request, helo) != 0) { mg_log(LOG_ERR, "SPF_request_set_helo_dom failed"); goto out3; } /* * And the enveloppe source e-mail */ if (fromp[0] == '<') fromp++; /* strip leading < */ strncpy(from, fromp, NS_MAXDNAME); from[NS_MAXDNAME] = '\0'; len = strlen(from); if (fromp[len - 1] == '>') from[len - 1] = '\0'; /* strip trailing > */ if (SPF_request_set_env_from(spf_request, from) != 0) { mg_log(LOG_ERR, "SPF_request_set_env_from failed"); goto out3; } /* * Get the SPF result */ SPF_request_query_mailfrom(spf_request, &spf_response); res = SPF_response_result(spf_response); status = ad ? *(enum spf_status *)ad : MGSPF_PASS; switch (status) { case MGSPF_PASS: result = (res == SPF_RESULT_PASS); statestr = "pass"; break; case MGSPF_FAIL: result = (res == SPF_RESULT_FAIL); statestr = "fail"; break; case MGSPF_SOFTFAIL: result = (res == SPF_RESULT_SOFTFAIL); statestr = "softfail"; break; case MGSPF_NEUTRAL: result = (res == SPF_RESULT_NEUTRAL); statestr = "neutral"; break; case MGSPF_UNKNOWN: result = (res == SPF_RESULT_PERMERROR || res == SPF_RESULT_INVALID); statestr = "unknown"; break; case MGSPF_ERROR: result = (res == SPF_RESULT_TEMPERROR); statestr = "error"; break; case MGSPF_NONE: result = (res == SPF_RESULT_NONE); statestr = "none"; break; default: mg_log(LOG_ERR, "Internal error: unexpected spf_status %d", " spf2 raw result %d", status, res); exit(EX_SOFTWARE); break; } if (conf.c_debug) mg_log(LOG_DEBUG, "SPF return code %d (test %s, result %d)", res, statestr, result); SPF_response_free(spf_response); out3: SPF_request_free(spf_request); out2: SPF_server_free(spf_server); out1: if (conf.c_debug) { gettimeofday(&tv2, NULL); timersub(&tv2, &tv1, &tv3); mg_log(LOG_DEBUG, "SPF lookup performed in %ld.%06lds", tv3.tv_sec, tv3.tv_usec); } return result; } #endif /* HAVE_SPF2 */ #if (defined(HAVE_SPF) || defined(HAVE_SPF_ALT) || \ defined(HAVE_SPF2_10) || defined(HAVE_SPF2)) char * acl_print_spf(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { char *tmpstr; enum spf_status status; status = ad ? *(enum spf_status *)ad : MGSPF_PASS; switch (status) { case MGSPF_PASS: tmpstr = "pass"; break; case MGSPF_FAIL: tmpstr = "fail"; break; case MGSPF_SOFTFAIL: tmpstr = "softfail"; break; case MGSPF_NEUTRAL: tmpstr = "neutral"; break; case MGSPF_UNKNOWN: tmpstr = "unknown"; break; case MGSPF_ERROR: tmpstr = "error"; break; case MGSPF_NONE: tmpstr = "none"; break; case MGSPF_SELF: tmpstr = "self"; break; default: mg_log(LOG_ERR, "Internal error: unexpected spf_status %d", status); exit(EX_SOFTWARE); break; } snprintf(buf, len, "%s", tmpstr); return buf; } void acl_add_spf(ad, data) acl_data_t *ad; void *data; { ad->spf_status = *(enum spf_status *)data; return; } int spf_check(ad, as, ap, priv) acl_data_t *ad; acl_stage_t as; struct acl_param *ap; struct mlfi_priv *priv; { enum spf_status status; status = ad ? *(enum spf_status *)ad : MGSPF_PASS; switch (status) { case MGSPF_PASS: case MGSPF_FAIL: case MGSPF_SOFTFAIL: case MGSPF_NEUTRAL: case MGSPF_UNKNOWN: case MGSPF_ERROR: case MGSPF_NONE: return spf_check_internal(ad, as, ap, priv); break; case MGSPF_SELF: return spf_check_self(ad, as, ap, priv); break; default: break; } mg_log(LOG_ERR, "Internal error: unexpected spf_status %d", status); exit(EX_SOFTWARE); return 0; } /* * Check if the SPF record is wide open: the simpliest * way of doing it is to check whether our own IP * validates the record. * That is a problem for Postfix and CommSuite installations, * as the local IP is not available ({if_addr} milter macro). * For now such MTAs must define "localaddr" in config. */ static int spf_check_self(ad, as, ap, priv) acl_data_t *ad; acl_stage_t as; struct acl_param *ap; struct mlfi_priv *priv; { int retval = 0; sockaddr_t saved_addr; acl_data_t tmp_ad; char *ip; (void)memcpy(&saved_addr, &priv->priv_addr, sizeof(saved_addr)); switch (conf.c_localaddr.ss_family) { case AF_INET: (void)memcpy(&priv->priv_addr, &conf.c_localaddr, sizeof(struct sockaddr_in)); break; #ifdef AF_INET6 case AF_INET6: (void)memcpy(&priv->priv_addr, &conf.c_localaddr, sizeof(struct sockaddr_in6)); break; #endif /* AF_INET6 */ default: /* localaddr unspecified, try fallback to {if_addr} */ ip = local_ipstr(priv); if (strcmp(ip, "0.0.0.0") == 0) { mg_log(LOG_ERR, "spf self used without localaddr specified " "and no {if_addr} macro is available"); return 0; } if (strncmp(ip, "IPv6:", strlen("IPv6:")) == 0) { #ifdef AF_INET6 if (inet_pton(AF_INET6, ip + strlen("IPv6:"), SADDR6(SA(&priv->priv_addr))) <= 0) { mg_log(LOG_ERR, "Invalid IPv6 local address %s", ip); exit(EX_SOFTWARE); } #else /* AF_INET6 */ mg_log(LOG_ERR, "IPv6 support not compiled but local IP is IPv6"); exit(EX_SOFTWARE); #endif /* AF_INET6 */ } else { if (inet_pton(AF_INET, ip, SADDR4(SA(&priv->priv_addr))) <= 0) { mg_log(LOG_ERR, "Invalid IPv4 local address %s", ip); exit(EX_SOFTWARE); } } break; } if (ad == NULL) (void)memset(&tmp_ad, 0, sizeof(tmp_ad)); else (void)memcpy(&tmp_ad, ad, sizeof(tmp_ad)); tmp_ad.spf_status = MGSPF_PASS; retval = spf_check_internal(&tmp_ad, as, ap, priv); (void)memcpy(&priv->priv_addr, &saved_addr, sizeof(priv->priv_addr)); return retval; } #endif @ 1.37 log @Typos in man page, style (Jim Klimov) @ text @d1 1 a1 1 /* $Id: spf.c,v 1.36 2013/08/16 11:21:36 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.36 2013/08/16 11:21:36 manu Exp $"); d62 5 @ 1.36 log @more meaningful message @ text @d1 1 a1 1 /* $Id: spf.c,v 1.35 2013/08/13 03:45:35 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.35 2013/08/13 03:45:35 manu Exp $"); d306 1 a306 1 mg_log(LOG_DEBUG, "SPF return code %d (%s, result %d)", d451 1 a451 1 mg_log(LOG_DEBUG, "SPF return code %d (%s, result %d)", @ 1.35 log @Use localaddr for p0f and %V format string (Jim Klimov) @ text @d1 1 a1 1 /* $Id: spf.c,v 1.34 2013/08/12 04:17:24 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.34 2013/08/12 04:17:24 manu Exp $"); d151 1 a151 1 mg_log(LOG_DEBUG, "SPF return code %d (%s, result %d)", @ 1.34 log @ More verbosity in SPF logs (Jim Klimov) @ text @d1 1 a1 1 /* $Id: spf.c,v 1.33 2011/08/17 01:06:50 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.33 2011/08/17 01:06:50 manu Exp $"); d569 3 a571 3 * That is a problem for Postfix installations, as the * local IP is not available. For now this clause is * not available on Postfix. d598 1 a598 2 default: #ifndef USE_POSTFIX d600 6 a626 4 #else /* USE_POSTFIX */ mg_log(LOG_ERR, "spf self used without localaddr specified"); return 0; #endif /* USE_POSTFIX */ @ 1.33 log @localaddr option so that Postifix user can use spf self @ text @d1 1 a1 1 /* $Id: spf.c,v 1.32 2010/05/23 08:59:03 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.32 2010/05/23 08:59:03 manu Exp $"); d94 1 a112 3 if (conf.c_debug) mg_log(LOG_DEBUG, "SPF return code %d", p->RES); d117 1 d121 1 d125 1 d129 1 d133 1 d137 1 d141 1 d144 2 a145 1 mg_log(LOG_ERR, "Internal error: unexpected spf_status"); d150 4 d209 1 d272 1 d276 1 d280 1 d284 1 d288 1 d292 1 d296 1 d299 2 a300 1 mg_log(LOG_ERR, "Internal error: unexpected spf_status"); d306 2 a307 1 mg_log(LOG_DEBUG, "SPF return code %d", out.result); d348 1 d416 1 d420 1 d424 1 d428 1 d433 1 d437 1 d441 1 d444 2 a445 1 mg_log(LOG_ERR, "Internal error: unexpected spf_status"); d451 2 a452 1 mg_log(LOG_DEBUG, "SPF return code %d", res); d513 2 a514 1 mg_log(LOG_ERR, "Internal error: unexpected spf_status"); d558 2 a559 1 mg_log(LOG_ERR, "Internal error: unexpected spf_status"); @ 1.32 log @Fix SPF on Postfix (Kouhei Sutou) @ text @d1 1 a1 1 /* $Id: spf.c,v 1.31 2008/07/31 10:56:40 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.31 2008/07/31 10:56:40 manu Exp $"); a496 6 #ifdef USE_POSTFIX if (ad->spf_status == MGSPF_SELF) { mg_log(LOG_ERR, "spf self clause is broken on Postfix"); exit(EX_DATAERR); } #endif a548 1 #ifndef USE_POSTFIX d553 1 a553 1 memcpy(&saved_addr, &priv->priv_addr, sizeof(saved_addr)); d555 5 a559 2 ip = local_ipstr(priv); if (strncmp(ip, "IPv6:", strlen("IPv6:")) == 0) { d561 17 a577 2 if (inet_pton(AF_INET6, ip + strlen("IPv6:"), SADDR6(SA(&priv->priv_addr))) <= 0) { d579 1 a579 1 "Invalid IPv6 local address %s", ip); a580 5 } #else /* AF_INET6 */ mg_log(LOG_ERR, "IPv6 support not compiled but local IP is IPv6"); exit(EX_SOFTWARE); d582 7 a588 6 } else { if (inet_pton(AF_INET, ip, SADDR4(SA(&priv->priv_addr))) <= 0) { mg_log(LOG_ERR, "Invalid IPv4 local address %s", ip); exit(EX_SOFTWARE); d590 5 d598 1 a598 1 memset(&tmp_ad, 0, sizeof(tmp_ad)); d600 1 a600 1 memcpy(&tmp_ad, ad, sizeof(tmp_ad)); d606 2 a607 2 memcpy(&priv->priv_addr, &saved_addr, sizeof(saved_addr)); #endif /* !USE_POSTFIX */ @ 1.31 log @fix build of SPF code @ text @d1 1 a1 1 /* $Id: spf.c,v 1.30 2008/05/27 04:49:59 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.30 2008/05/27 04:49:59 manu Exp $"); d496 1 d498 4 a501 2 mg_log(LOG_ERR, "spf self clause is broken on Postfix"); exit(EX_DATAERR); a502 1 ad->spf_status = *(enum spf_status *)data; @ 1.31.2.1 log @Fix SPF on Postfix (Kouhei Sutou) @ text @d1 1 a1 1 /* $Id: spf.c,v 1.31 2008/07/31 10:56:40 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.31 2008/07/31 10:56:40 manu Exp $"); a495 1 ad->spf_status = *(enum spf_status *)data; d497 2 a498 4 if (ad->spf_status == MGSPF_SELF) { mg_log(LOG_ERR, "spf self clause is broken on Postfix"); exit(EX_DATAERR); } d500 1 @ 1.30 log @Fix a crash when using SPF (Johann Klasek) @ text @d1 1 a1 1 /* $Id: spf.c,v 1.29 2007/11/08 04:32:06 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.29 2007/11/08 04:32:06 manu Exp $"); d584 1 a584 1 memsey(&tmp_ad, 0, sizeof(tmp_ad)); @ 1.29 log @More SPF fixes (Benoit Branciard) @ text @d1 1 a1 1 /* $Id: spf.c,v 1.28 2007/11/07 00:02:27 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.28 2007/11/07 00:02:27 manu Exp $"); d93 1 d115 2 a116 1 switch (*(enum spf_status *)ad) { d198 1 d257 2 a258 1 switch (*(enum spf_status *)ad) { d327 1 d391 2 a392 1 switch (*(enum spf_status *)ad) { d454 4 a457 1 switch (*(enum spf_status *)ad) { d511 4 a514 1 switch (*(enum spf_status *)ad) { d583 5 a587 1 memcpy(&tmp_ad, ad, sizeof(tmp_ad)); @ 1.28 log @Build fixes (Benoit Branciard) @ text @d1 1 a1 1 /* $Id: spf.c,v 1.27 2007/11/06 11:39:33 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.27 2007/11/06 11:39:33 manu Exp $"); d114 27 a140 2 if (p->RES == SPF_PASS) result = 1; d253 28 a280 2 if (out.result == SPF_RESULT_PASS) result = 1; d384 30 a413 2 if ((res = SPF_response_result(spf_response)) == SPF_RESULT_PASS) result = 1; a544 1 int error; d549 1 a549 1 if (strcmp(ip, "IPv6:") == 0) { d551 2 a552 2 if ((error = inet_pton(AF_INET6, ip + strlen("IPv6:", SADDR6(SA(&priv->priv_addr)))) != 0) d554 1 a554 2 "Invalid IPv6 local address (%d)", error); d563 2 a564 2 error = inet_pton(AF_INET, ip, SADDR4(SA(&priv->priv_addr))); if (error != 0) { d566 1 a566 2 "Invalid IPv4 local address (%d)", error); @ 1.27 log @Add SPF status selection to ACL @ text @d1 1 a1 1 /* $Id: spf.c,v 1.26 2007/07/08 21:02:28 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.26 2007/07/08 21:02:28 manu Exp $"); d471 1 a471 1 if (strchr(ip, ':') != NULL) { d473 5 a477 3 error = inet_pton(AF_INET6, ip, SADDR6(SA(&priv->priv_addr))); if (error != 0) { mg_log(LOG_ERR, "Invalid IPv6 local address"); d488 3 a490 1 mg_log(LOG_ERR, "Invalid IPv4 local address"); @ 1.26 log @Add hooks for libdmalloc @ text @d1 1 a1 1 /* $Id: spf.c,v 1.25 2007/01/28 02:16:33 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.25 2007/01/28 02:16:33 manu Exp $"); d42 2 d55 6 d62 7 a68 1 #include "acl.h" a76 4 #ifdef USE_DMALLOC #include #endif d78 2 a79 2 int spf_check(ad, as, ap, priv) d152 2 a153 2 int spf_check(ad, as, ap, priv) d255 2 a256 2 int spf_check(ad, as, ap, priv) d355 1 d357 145 @ 1.25 log @ACL clauses can now be negated @ text @d1 1 a1 1 /* $Id: spf.c,v 1.24 2007/01/09 22:22:43 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.24 2007/01/09 22:22:43 manu Exp $"); d63 5 @ 1.24 log @Add SPF, SMTP AUTH and STARTTLS to the ACL. This has not been tested at all, but at least it should not break existing setups if people do not use the new features. @ text @d1 1 a1 1 /* $Id: spf.c,v 1.23 2006/08/27 20:54:41 manu Exp $ */ d4 1 a4 1 * Copyright (c) 2004 Emmanuel Dreyfus d37 1 a37 1 __RCSID("$Id: spf.c,v 1.23 2006/08/27 20:54:41 manu Exp $"); d76 1 a76 1 int result = EXF_NONE; d100 1 a100 1 result = EXF_SPF; d153 1 a153 1 int result = EXF_NONE; d214 1 a214 1 result = EXF_SPF; d254 1 a254 1 int res, result = EXF_NONE; d319 1 a319 1 result = EXF_SPF; @ 1.23 log @Remove the need of LOG_PERROR, make sure no log is missed @ text @d1 1 a1 1 /* $Id: spf.c,v 1.22 2006/07/27 12:48:24 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.22 2006/07/27 12:48:24 manu Exp $"); d64 5 a68 5 spf_check(sa, salen, helo, from) struct sockaddr *sa; socklen_t salen; char *helo; char *from; d70 4 d138 5 a142 5 spf_alt_check(sa, salen, helo, fromp) struct sockaddr *sa; socklen_t salen; char *helo; char *fromp; d144 4 d208 1 a208 1 #if ((SPF_LIB_VERSION_MAJOR == 0) && (SPF_LIB_VERSION_MINOR <= 3)) d241 5 a245 5 spf2_check(sa, salen, helo, fromp) struct sockaddr *sa; socklen_t salen; char *helo; char *fromp; d247 3 @ 1.22 log @Define NS_MAXDNAME if missing @ text @d1 1 a1 1 /* $Id: spf.c,v 1.21 2005/10/03 07:58:53 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.21 2005/10/03 07:58:53 manu Exp $"); d85 1 a85 1 syslog(LOG_ERR, "SPF_Init failed"); d93 1 a93 1 syslog(LOG_DEBUG, "SPF return code %d", p->RES); d104 1 a104 1 syslog(LOG_DEBUG, "SPF lookup performed in %ld.%06lds", d153 1 a153 1 syslog(LOG_ERR, "SPF_create_config failed"); d158 1 a158 1 syslog(LOG_ERR, "SPF_dns_create_config_resolv faile"); d166 1 a166 1 syslog(LOG_ERR, "SPF_set_ip_str failed"); d170 1 a170 1 syslog(LOG_ERR, "SPF_set_ip_str failed"); d176 1 a176 1 syslog(LOG_ERR, "SPF_set_helo failed"); d192 1 a192 1 syslog(LOG_ERR, "SPF_set_env_from failed"); d209 1 a209 1 syslog(LOG_DEBUG, "SPF return code %d", out.result); d220 1 a220 1 syslog(LOG_DEBUG, "SPF lookup performed in %ld.%06lds", d251 1 a251 1 syslog(LOG_ERR, "SPF_server_new failed"); d256 1 a256 1 syslog(LOG_ERR, "SPF_request_new failed"); d273 1 a273 1 syslog(LOG_ERR, "unknown address family %d", sa->sa_family); d277 1 a277 1 syslog(LOG_ERR, "SPF_request_set_ip_str failed"); d283 1 a283 1 syslog(LOG_ERR, "SPF_request_set_helo_dom failed"); d299 1 a299 1 syslog(LOG_ERR, "SPF_request_set_env_from failed"); d311 1 a311 1 syslog(LOG_DEBUG, "SPF return code %d", res); d322 1 a322 1 syslog(LOG_DEBUG, "SPF lookup performed in %ld.%06lds", @ 1.21 log @Add newer libspf2 support, by Hajimu UMEMOTO @ text @d1 1 a1 1 /* $Id: spf.c,v 1.20 2005/06/05 21:42:30 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.20 2005/06/05 21:42:30 manu Exp $"); d115 1 d118 1 @ 1.20 log @SPF build fix @ text @d1 1 a1 1 /* $Id: spf.c,v 1.19 2005/02/14 15:16:30 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.19 2005/02/14 15:16:30 manu Exp $"); d113 5 d124 1 a124 1 #ifdef HAVE_SPF2 d130 1 a130 3 #if defined(HAVE_SPF_ALT) || defined(HAVE_SPF2) /* SMTP needs at least 64 chars for local part and 255 for doamin... */ #define NS_MAXDNAME 1025 d226 102 @ 1.19 log @Fix build problem with spf @ text @d1 1 a1 1 /* $Id: spf.c,v 1.18 2005/02/03 21:15:33 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.18 2005/02/03 21:15:33 manu Exp $"); d56 3 a61 3 #ifndef SPF_TRUE #define SPF_TRUE 1 #endif a62 2 #ifdef HAVE_SPF #include @ 1.18 log @Fix build problem with libspf @ text @d1 1 a1 1 /* $Id: spf.c,v 1.17 2004/12/09 22:01:17 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.17 2004/12/09 22:01:17 manu Exp $"); d56 7 @ 1.17 log @Builds again with SPF enabled @ text @d1 1 a1 1 /* $Id: spf.c,v 1.16 2004/12/08 22:23:09 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.16 2004/12/08 22:23:09 manu Exp $"); d79 1 a79 1 NULL, NULL, NULL, FALSE, FALSE)) == NULL) { @ 1.16 log @New ACL framework for whitelist and greylist (Remy Card) Tell MX peers about autowhitelist prolongation (Remy Card) @ text @d1 1 a1 1 /* $Id: spf.c,v 1.15 2004/12/08 17:49:48 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.15 2004/12/08 17:49:48 manu Exp $"); d54 1 @ 1.15 log @Suppports libspf2 @ text @d1 1 a1 1 /* $Id: spf.c,v 1.14 2004/08/01 09:27:03 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.14 2004/08/01 09:27:03 manu Exp $"); a52 1 #include "except.h" @ 1.14 log @Full blown IPv6 support, from Hajimu Umemoto Correctly clean rc-debian.sh @ text @d1 1 a1 1 /* $Id: spf.c,v 1.13 2004/05/04 20:50:33 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.13 2004/05/04 20:50:33 manu Exp $"); d112 7 d120 1 @ 1.13 log @Reorder headers to build on FreeBSD @ text @d1 1 a1 1 /* $Id: spf.c,v 1.12 2004/04/14 08:46:14 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.12 2004/04/14 08:46:14 manu Exp $"); d59 3 a61 2 spf_check(in, helo, from) struct in_addr *in; d66 1 a66 1 char addr[IPADDRLEN + 1]; d73 4 a76 1 inet_ntop(AF_INET, in, addr, IPADDRLEN); d116 3 a118 2 spf_alt_check(in, helo, fromp) struct in_addr *in; d124 1 a124 1 char addr[IPADDRLEN + 1]; d147 4 a150 1 inet_ntop(AF_INET, in, addr, IPADDRLEN); @ 1.12 log @More buid problems on FreeBSD @ text @d1 1 a1 1 /* $Id: spf.c,v 1.11 2004/04/08 15:27:51 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.11 2004/04/08 15:27:51 manu Exp $"); d48 1 a49 1 #include @ 1.11 log @Strip leading < to e-mail addresses for SPF @ text @d1 1 a1 1 /* $Id: spf.c,v 1.10 2004/04/08 11:32:53 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.10 2004/04/08 11:32:53 manu Exp $"); d46 1 @ 1.10 log @ksh: q: not found @ text @d1 1 a1 1 /* $Id: spf.c,v 1.9 2004/04/07 09:09:09 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.9 2004/04/07 09:09:09 manu Exp $"); d147 6 d156 2 a162 5 if (SPF_set_helo_dom(spfconf, helo) != 0) { syslog(LOG_ERR, "SPF_set_helo failed"); goto out3; } @ 1.9 log @Check for libspf_alt version @ text @d1 1 a1 1 /* $Id: spf.c,v 1.8 2004/04/04 14:14:00 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.8 2004/04/04 14:14:00 manu Exp $"); d58 1 a58 1 spf_check(in, from) d60 1 d78 1 a78 1 /* SPF_smtp_helo(p, helo); */ /* For when from is <> */ d111 1 a111 1 spf_alt_check(in, fromp) d113 1 d155 5 @ 1.8 log @Enable libspf use @ text @d1 1 a1 1 /* $Id: spf.c,v 1.7 2004/04/01 14:03:52 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.7 2004/04/01 14:03:52 manu Exp $"); d105 1 d163 1 d165 3 @ 1.7 log @Log debug messages only when running in debug mode. @ text @d1 1 a1 1 /* $Id: spf.c,v 1.6 2004/04/01 13:57:50 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.6 2004/04/01 13:57:50 manu Exp $"); d56 1 d62 36 a97 1 return EXF_NONE; /* Unimplemented */ @ 1.6 log @Measure how long SPF take in debug mode @ text @d1 1 a1 1 /* $Id: spf.c,v 1.5 2004/04/01 13:39:45 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.5 2004/04/01 13:39:45 manu Exp $"); a126 2 syslog(LOG_DEBUG, "SPF out.result = %d", out.result); d129 3 @ 1.5 log @libspf_alt use was not thread safe. At all. @ text @d1 1 a1 1 /* $Id: spf.c,v 1.4 2004/03/30 16:07:21 manu Exp $ */ d37 1 a37 1 __RCSID("$Id: spf.c,v 1.4 2004/03/30 16:07:21 manu Exp $"); d50 1 d83 1 d86 3 d138 7 @ 1.4 log @Bad RCSID tag @ text @d1 1 a1 1 /* $Id: spf.c,v 1.3 2004/03/30 16:00:10 manu Exp $ */ d37 1 a37 1 __RCSID("$Id$"); a68 3 SPF_config_t spfconf = NULL; SPF_dns_config_t dnsconf = NULL; d76 2 d84 8 a91 8 if (spfconf == NULL) spfconf = SPF_create_config(); if (dnsconf == NULL) dnsconf = SPF_dns_create_config_resolv(NULL, 0); if ((spfconf == NULL) || (dnsconf == NULL)) { syslog(LOG_ERR, "spf_alt_check init failed"); return EXF_NONE; d100 1 a100 2 SPF_reset_config(spfconf); return EXF_NONE; d114 1 a114 2 SPF_reset_config(spfconf); return EXF_NONE; a126 1 SPF_reset_config(spfconf); d128 5 a132 1 @ 1.3 log @Strip trailing > at the end of addresses before handing them to libspf. @ text @d1 1 a1 1 /* $Id: spf.c,v 1.2 2004/03/30 14:17:47 manu Exp $ */ d37 1 a37 1 __RCSID("$Id"); @ 1.2 log @Compelted SPF implementation with libspf_alt @ text @d1 1 a1 1 /* $Id: spf.c,v 1.1 2004/03/30 12:26:03 manu Exp $ */ d43 2 d53 1 d72 2 d75 1 a75 1 spf_alt_check(in, from) d77 1 a77 1 char *from; d80 1 d83 1 d95 4 d101 1 d105 9 d116 1 d120 3 d125 1 @ 1.1 log @SPF support framework @ text @d1 1 a1 1 /* $Id$ */ d41 3 d49 1 d57 1 a57 1 return 0; d59 9 a67 1 #endif a68 1 #ifdef HAVE_ALT_SPF d74 34 a107 1 return 0; a108 2 #endif d110 1 @