Skip to content
Browse files

use prefixes in the blacklist

  • Loading branch information...
1 parent 5de5389 commit 625b024db19d630eb4456d49093fce74319ba0d0 @thejh committed Jun 2, 2012
Showing with 99 additions and 65 deletions.
  1. +82 −61 conf/domains.blacklist
  2. +16 −3 src/blacklist.c
  3. +1 −1 src/blacklist.h
View
143 conf/domains.blacklist
@@ -1,61 +1,82 @@
-platform.twitter.com
-facebook.net
-facebook.com
-chartbeat.net
-chartbeat.com
-crwdcntrl.net
-google-analytics.com
-scorecardresearch.com
-contextly.com
-widgets.twimg.com
-quantserve.com
-doubleclick.net
-atdmt.com
-stumbleupon.com
-tweetmeme.com
-statcounter.com
-yadro.ru
-widgets.digg.com
-serving-sys.com
-revsci.net
-pixel.redditmedia.com
-adlog.com.com
-crowdscience.com
-bkrtx.com
-googlesyndication.com
-clicktale.com
-clicktale.net
-linkedin.com
-gigya.com
-marketo.net
-api.twitter.com
-dw.com.com
-imrworldwide.com
-questionmarket.com
-bwp.news.com
-stats.wired.com
-platform.tumblr.com
-sharethis.com
-ivwbox.de
-rl.heise.de
-nuggad.net
-cpx.golem.de
-vgwort.de
-plista.com
-intellitxt.com
-api.flattr.com
-googleadservices.com
-addthis.com
-addthisedge.com
-meebo.com
-meebocdn.net
-mmismm.com
-csi.gstatic.com
-adition.com
-smartadserver.com
-adtechus.com
-yieldmanager.com
-advertising.com
-atwola.com
-adsymptotic.com
-adzerk.net
+b platform.twitter.com
+b search.twitter.com
+b facebook.net
+b facebook.com
+b chartbeat.net
+b chartbeat.com
+b crwdcntrl.net
+b google-analytics.com
+b scorecardresearch.com
+b contextly.com
+b widgets.twimg.com
+b quantserve.com
+b doubleclick.net
+b atdmt.com
+b stumbleupon.com
+b tweetmeme.com
+b statcounter.com
+b yadro.ru
+b widgets.digg.com
+b serving-sys.com
+b revsci.net
+b pixel.redditmedia.com
+b adlog.com.com
+b crowdscience.com
+b bkrtx.com
+b googlesyndication.com
+b clicktale.com
+b clicktale.net
+b linkedin.com
+b gigya.com
+b marketo.net
+b api.twitter.com
+b dw.com.com
+b imrworldwide.com
+b questionmarket.com
+b bwp.news.com
+b stats.wired.com
+b platform.tumblr.com
+b sharethis.com
+b ivwbox.de
+b rl.heise.de
+b nuggad.net
+b cpx.golem.de
+b vgwort.de
+b plista.com
+b intellitxt.com
+b api.flattr.com
+b googleadservices.com
+b addthis.com
+b addthisedge.com
+b meebo.com
+b meebocdn.net
+b mmismm.com
+b csi.gstatic.com
+b adition.com
+b smartadserver.com
+b adtechus.com
+b yieldmanager.com
+b advertising.com
+b atwola.com
+b adsymptotic.com
+b adzerk.net
+b sitestat.com
+b oewabox.at
+b adworx.at
+b admeld.com
+b mathtag.com
+b adnxs.com
+b krxd.net
+b technoratimedia.com
+b adadvisor.net
+b invitemedia.com
+b agkn.com
+b collective-media.net
+b clkads.com
+b ic.tynt.com
+b getclicky.com
+b googletagservices.com
+b maxymiser.com
+
+# unfortunate... but I can't think of a better way right now
+b disqus.com
View
19 src/blacklist.c
@@ -12,6 +12,7 @@
struct bl_entry {
char *domain;
char forbidden;
+ char filter;
};
@@ -57,12 +58,24 @@ void reload_blacklist() {
int i = 0;
while (fgets(line, 1024, f) != NULL) {
if (strlen(line) < 3 || line[0] == '#') continue;
+ if (line[1] != ' ') assert(0 /*invalid configuration file*/);
char *r_i = strchr(line, '\r');
char *n_i = strchr(line, '\n');
if (r_i != NULL) *r_i = '\0';
if (n_i != NULL) *n_i = '\0';
- blacklist[i].forbidden = 1;
- blacklist[i++].domain = strdup(line);
+ blacklist[i++].domain = strdup(line+2);
+ switch (line[0]) {
+ case 'b': {
+ blacklist[i].forbidden = 1;
+ blacklist[i].filter = 0;
+ break;
+ }
+ case 'f': {
+ blacklist[i].forbidden = 0;
+ blacklist[i].filter = 1;
+ break;
+ }
+ }
}
assert(i == blacklist_size);
fclose(f);
@@ -76,7 +89,7 @@ int bl_check(char *host) {
data_filter *bl_get_data_filter(char *url, int url_size) {
struct bl_entry *e = get_bl_entry_by_url(url, url_size);
- if (e == NULL) return NULL;
+ if (e == NULL || e->filter == 0) return NULL;
YADA return NULL;
}
View
2 src/blacklist.h
@@ -1,4 +1,4 @@
-typedef int data_filter; // FIXME!
+typedef char data_filter(char *, int); // FIXME!
void reload_blacklist();
int bl_check(char *host);

0 comments on commit 625b024

Please sign in to comment.
Something went wrong with that request. Please try again.