mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
- Add IPv6 AAAA Lookups for MtaHostChk
PR: 196756 Submitted by: jvp@lateapex.net
This commit is contained in:
parent
8ed156eb79
commit
84e6522e8a
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=459031
4 changed files with 87 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
PORTNAME= spamilter
|
||||
PORTVERSION= 0.60
|
||||
PORTREVISION= 2
|
||||
PORTREVISION= 3
|
||||
CATEGORIES= mail
|
||||
MASTER_SITES= http://www.wanlink.com/spamilter/download/
|
||||
|
||||
|
|
60
mail/spamilter/files/patch-dns.c
Normal file
60
mail/spamilter/files/patch-dns.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
--- dns.c.orig 2005-07-17 19:55:13.000000000 -0500
|
||||
+++ dns.c 2015-01-21 13:58:59.000000000 -0600
|
||||
@@ -58,25 +58,48 @@
|
||||
|
||||
int dns_query_rr_a(const res_state statp, char *fmt, ...)
|
||||
{ va_list vl;
|
||||
- int x,rc = 0;
|
||||
- char *hn = NULL;
|
||||
+ int x, haveRR = 0;
|
||||
+ char *hostName = NULL;
|
||||
|
||||
va_start(vl,fmt);
|
||||
if(fmt != NULL && *fmt)
|
||||
{
|
||||
- x = vasprintf(&hn,fmt,vl);
|
||||
- if(hn != NULL && x > 0)
|
||||
- { u_char packet[NS_PACKETSZ];
|
||||
+ x = vasprintf(&hostName,fmt,vl);
|
||||
+ if(hostName != NULL && x > 0)
|
||||
+ { u_char ns_packet[NS_PACKETSZ];
|
||||
|
||||
- rc = (res_nquery(statp, hn,ns_c_in,ns_t_a,packet,sizeof(packet)) == -1 ? 0 : 1);
|
||||
+ haveRR = (res_nquery(statp, hostName, ns_c_in, ns_t_a, ns_packet, sizeof(ns_packet)) == -1 ? 0 : 1);
|
||||
}
|
||||
|
||||
- if(hn != NULL)
|
||||
- free(hn);
|
||||
+ if(hostName != NULL)
|
||||
+ free(hostName);
|
||||
}
|
||||
va_end(vl);
|
||||
|
||||
- return(rc);
|
||||
+ return haveRR;
|
||||
+}
|
||||
+
|
||||
+int dns_query_rr_aaaa(const res_state statp, char *fmt, ...)
|
||||
+{ va_list vl;
|
||||
+ int x, haveRR = 0;
|
||||
+ char *hostName = NULL;
|
||||
+
|
||||
+ va_start(vl,fmt);
|
||||
+ if(fmt != NULL && *fmt)
|
||||
+ {
|
||||
+ x = vasprintf(&hostName,fmt,vl);
|
||||
+ if(hostName != NULL && x > 0)
|
||||
+ { u_char ns_packet[NS_PACKETSZ];
|
||||
+
|
||||
+ haveRR = (res_nquery(statp, hostName, ns_c_in, ns_t_aaaa, ns_packet, sizeof(ns_packet)) == -1 ? 0 : 1);
|
||||
+ }
|
||||
+
|
||||
+ if(hostName != NULL)
|
||||
+ free(hostName);
|
||||
+ }
|
||||
+ va_end(vl);
|
||||
+
|
||||
+ return haveRR;
|
||||
}
|
||||
|
||||
int dns_rdnsbl_has_rr_a(const res_state statp, long ip, char *domain)
|
11
mail/spamilter/files/patch-dns.h
Normal file
11
mail/spamilter/files/patch-dns.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- dns.h.orig 2004-11-25 18:13:49.000000000 -0600
|
||||
+++ dns.h 2015-01-21 14:06:33.000000000 -0600
|
||||
@@ -47,6 +47,8 @@
|
||||
|
||||
#define mkip(a,b,c,d) ((((a)&0xff)<<24)|(((b)&0xff)<<16)|(((c)&0xff)<<8)|((d)&0xff))
|
||||
|
||||
+ int dns_query_rr_aaaa(const res_state statp, char *fmt, ...);
|
||||
+
|
||||
int dns_query_rr_a(const res_state statp, char *fmt, ...);
|
||||
int dns_rdnsbl_has_rr_a(const res_state statp, long ip, char *domain);
|
||||
|
15
mail/spamilter/files/patch-hndlrs.c
Normal file
15
mail/spamilter/files/patch-hndlrs.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
--- hndlrs.c.orig 2005-07-17 19:55:13.000000000 -0500
|
||||
+++ hndlrs.c 2015-01-21 14:47:27.000000000 -0600
|
||||
@@ -466,7 +466,11 @@
|
||||
if(gMtaHostIpfw)
|
||||
mlfi_MtaHostIpfwAction(priv->ipstr,"add");
|
||||
}
|
||||
- else if(gMtaHostChk && !priv->islocalnethost && !dns_query_rr_a(priv->statp,priv->helo))
|
||||
+ else if(gMtaHostChk
|
||||
+ && !priv->islocalnethost
|
||||
+ && !dns_query_rr_a(priv->statp,priv->helo)
|
||||
+ && !dns_query_rr_aaaa(priv->statp,priv->helo)
|
||||
+ )
|
||||
{
|
||||
mlfi_setreply(ctx,550,"5.7.1","Rejecting due to security policy - Invalid hostname '%s', Please see: %s#invalidhostname",priv->helo,gPolicyUrl);
|
||||
mlfi_debug("envrcpt: Invalid MTA hostname '%s'\n",priv->helo);
|
Loading…
Add table
Reference in a new issue