comparison src/dnsbl.cpp @ 128:9ab51896447f stable-5-18

don't do uribl lookups on rfc1918 address space
author carl
date Thu, 27 Apr 2006 10:05:43 -0700
parents 2b1a4701e856
children c5cd1261394d
comparison
equal deleted inserted replaced
127:2b1a4701e856 128:9ab51896447f
707 bool check_uribl(mlfiPriv &priv, char *hostname, char *&found) ; 707 bool check_uribl(mlfiPriv &priv, char *hostname, char *&found) ;
708 bool check_uribl(mlfiPriv &priv, char *hostname, char *&found) { 708 bool check_uribl(mlfiPriv &priv, char *hostname, char *&found) {
709 in_addr ip; 709 in_addr ip;
710 if (inet_aton(hostname, &ip)) { 710 if (inet_aton(hostname, &ip)) {
711 const u_char *src = (const u_char *)&ip.s_addr; 711 const u_char *src = (const u_char *)&ip.s_addr;
712 if (src[0] == 127) return false; // don't do dns lookups on localhost
713 if (src[0] == 10) return false; // don't do dns lookups on rfc1918 space
714 if ((src[0] == 192) && (src[1] == 168)) return false;
715 if ((src[0] == 172) && (16 <= src[1]) && (src[1] <= 31)) return false;
712 static char adr[sizeof "255.255.255.255"]; 716 static char adr[sizeof "255.255.255.255"];
713 snprintf(adr, sizeof(adr), "%u.%u.%u.%u", src[3], src[2], src[1], src[0]); 717 snprintf(adr, sizeof(adr), "%u.%u.%u.%u", src[3], src[2], src[1], src[0]);
714 return (uriblookup(priv, adr, NULL, found)); 718 return (uriblookup(priv, adr, NULL, found));
715 } 719 }
716 720