Only accept 127.0.0.x as a dnsbl listing.

This commit is contained in:
Jilles Tjoelker 2008-01-02 22:32:09 +01:00
parent 3055cb798c
commit bc71fb3f36
1 changed files with 9 additions and 1 deletions

View File

@ -65,6 +65,7 @@ static struct Blacklist *find_blacklist(char *name)
static void blacklist_dns_callback(void *vptr, struct DNSReply *reply)
{
struct BlacklistClient *blcptr = (struct BlacklistClient *) vptr;
int listed = 0;
if (blcptr == NULL || blcptr->client_p == NULL)
return;
@ -77,8 +78,15 @@ static void blacklist_dns_callback(void *vptr, struct DNSReply *reply)
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 */
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;
/* reference to blacklist moves from blcptr to client_p->preClient... */