0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

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 85e132a46f
commit 137d856d65

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... */