mirror of
https://github.com/matrix-construct/construct
synced 2024-09-08 17:55:47 +02:00
Only accept 127.0.0.x as a dnsbl listing.
This commit is contained in:
parent
85e132a46f
commit
137d856d65
1 changed files with 9 additions and 1 deletions
|
@ -65,6 +65,7 @@ static struct Blacklist *find_blacklist(char *name)
|
||||||
static void blacklist_dns_callback(void *vptr, struct DNSReply *reply)
|
static void blacklist_dns_callback(void *vptr, struct DNSReply *reply)
|
||||||
{
|
{
|
||||||
struct BlacklistClient *blcptr = (struct BlacklistClient *) vptr;
|
struct BlacklistClient *blcptr = (struct BlacklistClient *) vptr;
|
||||||
|
int listed = 0;
|
||||||
|
|
||||||
if (blcptr == NULL || blcptr->client_p == NULL)
|
if (blcptr == NULL || blcptr->client_p == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -77,8 +78,15 @@ static void blacklist_dns_callback(void *vptr, struct DNSReply *reply)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reply != NULL)
|
||||||
|
{
|
||||||
|
/* only accept 127.0.0.x as a listing */
|
||||||
|
listed = reply->addr.ss_family == AF_INET &&
|
||||||
|
!memcmp(&((struct sockaddr_in *)&reply->addr)->sin_addr, "\177\0\0", 3);
|
||||||
|
}
|
||||||
|
|
||||||
/* they have a blacklist entry for this client */
|
/* they have a blacklist entry for this client */
|
||||||
if (reply != NULL && blcptr->client_p->preClient->dnsbl_listed == NULL)
|
if (listed && blcptr->client_p->preClient->dnsbl_listed == NULL)
|
||||||
{
|
{
|
||||||
blcptr->client_p->preClient->dnsbl_listed = blcptr->blacklist;
|
blcptr->client_p->preClient->dnsbl_listed = blcptr->blacklist;
|
||||||
/* reference to blacklist moves from blcptr to client_p->preClient... */
|
/* reference to blacklist moves from blcptr to client_p->preClient... */
|
||||||
|
|
Loading…
Reference in a new issue