View | Details | Raw Unified | Return to bug 196756 | Differences between
and this patch

Collapse All | Expand All

(-)spamilter.new/dns.c (-9 / +32 lines)
Lines 58-82 Link Here
58
58
59
int dns_query_rr_a(const res_state statp, char *fmt, ...)
59
int dns_query_rr_a(const res_state statp, char *fmt, ...)
60
{	va_list	vl;
60
{	va_list	vl;
61
	int	x,rc = 0;
61
	int	x, haveRR = 0;
62
	char	*hn = NULL;
62
	char	*hostName = NULL;
63
63
64
	va_start(vl,fmt);
64
	va_start(vl,fmt);
65
	if(fmt != NULL && *fmt)
65
	if(fmt != NULL && *fmt)
66
	{
66
	{
67
		x = vasprintf(&hn,fmt,vl);
67
		x = vasprintf(&hostName,fmt,vl);
68
		if(hn != NULL && x > 0)
68
		if(hostName != NULL && x > 0)
69
		{	u_char	packet[NS_PACKETSZ];
69
		{	u_char	ns_packet[NS_PACKETSZ];
70
70
71
			rc = (res_nquery(statp, hn,ns_c_in,ns_t_a,packet,sizeof(packet)) == -1 ? 0 : 1);
71
			haveRR = (res_nquery(statp, hostName, ns_c_in, ns_t_a, ns_packet, sizeof(ns_packet)) == -1 ? 0 : 1);
72
		}
72
		}
73
73
74
		if(hn != NULL)
74
		if(hostName != NULL)
75
			free(hn);
75
			free(hostName);
76
	}
76
	}
77
	va_end(vl);
77
	va_end(vl);
78
78
79
	return(rc);
79
	return haveRR;
80
}
81
82
int dns_query_rr_aaaa(const res_state statp, char *fmt, ...)
83
{	va_list	vl;
84
	int	x, haveRR = 0;
85
	char	*hostName = NULL;
86
87
	va_start(vl,fmt);
88
	if(fmt != NULL && *fmt)
89
	{
90
		x = vasprintf(&hostName,fmt,vl);
91
		if(hostName != NULL && x > 0)
92
		{	u_char	ns_packet[NS_PACKETSZ];
93
94
			haveRR = (res_nquery(statp, hostName, ns_c_in, ns_t_aaaa, ns_packet, sizeof(ns_packet)) == -1 ? 0 : 1);
95
		}
96
97
		if(hostName != NULL)
98
			free(hostName);
99
	}
100
	va_end(vl);
101
102
	return haveRR;
80
}
103
}
81
104
82
int dns_rdnsbl_has_rr_a(const res_state statp, long ip, char *domain)
105
int dns_rdnsbl_has_rr_a(const res_state statp, long ip, char *domain)
(-)spamilter.new/dns.h (+2 lines)
Lines 47-52 Link Here
47
47
48
	#define mkip(a,b,c,d) ((((a)&0xff)<<24)|(((b)&0xff)<<16)|(((c)&0xff)<<8)|((d)&0xff))
48
	#define mkip(a,b,c,d) ((((a)&0xff)<<24)|(((b)&0xff)<<16)|(((c)&0xff)<<8)|((d)&0xff))
49
49
50
	int dns_query_rr_aaaa(const res_state statp, char *fmt, ...);
51
50
	int dns_query_rr_a(const res_state statp, char *fmt, ...);
52
	int dns_query_rr_a(const res_state statp, char *fmt, ...);
51
	int dns_rdnsbl_has_rr_a(const res_state statp, long ip, char *domain);
53
	int dns_rdnsbl_has_rr_a(const res_state statp, long ip, char *domain);
52
54
(-)spamilter.new/hndlrs.c (-1 / +4 lines)
Lines 466-472 Link Here
466
						if(gMtaHostIpfw)
466
						if(gMtaHostIpfw)
467
							mlfi_MtaHostIpfwAction(priv->ipstr,"add");
467
							mlfi_MtaHostIpfwAction(priv->ipstr,"add");
468
					}
468
					}
469
					else if(gMtaHostChk && !priv->islocalnethost && !dns_query_rr_a(priv->statp,priv->helo))
469
					else if(gMtaHostChk
470
						&& !priv->islocalnethost
471
						&& !( dns_query_rr_a(priv->statp,priv->helo) || dns_query_rr_a(priv->statp,priv->helo))
472
						)
470
					{
473
					{
471
						mlfi_setreply(ctx,550,"5.7.1","Rejecting due to security policy - Invalid hostname '%s', Please see: %s#invalidhostname",priv->helo,gPolicyUrl);
474
						mlfi_setreply(ctx,550,"5.7.1","Rejecting due to security policy - Invalid hostname '%s', Please see: %s#invalidhostname",priv->helo,gPolicyUrl);
472
						mlfi_debug("envrcpt: Invalid MTA hostname '%s'\n",priv->helo);
475
						mlfi_debug("envrcpt: Invalid MTA hostname '%s'\n",priv->helo);

Return to bug 196756