diff --git a/exec/newslink.js b/exec/newslink.js index dccf8f4a0e22a78f2d2bdab4046b6b48bfd632e8..898b54885d61aaeff71a12949295f409a6db1164 100644 --- a/exec/newslink.js +++ b/exec/newslink.js @@ -52,6 +52,7 @@ var email_addresses = true; // Include e-mail addresses in headers var import_amount = 0; // Import a fixed number of messages per group var lines_per_yield = 5; // Release time-slices ever x number of lines var yield_length = 1; // Length of yield (in milliseconds) +var max_newsgroups_per_article = 5; // Used for spam-detection // Parse arguments for(i=0;i<argc;i++) { @@ -183,6 +184,9 @@ while(!cfg_file.eof) { case "yield_length": yield_length=parseInt(str[1]); break; + case "max_newsgroups_per_article": + max_newsgroups_per_article=parseInt(str[1]); + break; default: print("!UNRECOGNIZED configuration keyword: " + str[0]); @@ -672,6 +676,16 @@ for(i in area) { continue; } + if(max_newsgroups_per_article && hdr.newsgroups!=undefined) { + var ngarray=hdr.newsgroups.split(','); + if(ngarray.length>max_newsgroups_per_article) { + var reason = format("Too many newsgroups (%d): %s",ngarray.length, hdr.newsgroups); + printf("!%s\r\n",reason); + system.spamlog("NNTP","NOT IMPORTED",reason,hdr.from,server,hdr.to); + continue; + } + } + if(hdr.to==newsgroup && hdr.newsgroups!=undefined) hdr.to=hdr.newsgroups; @@ -686,8 +700,8 @@ for(i in area) { continue; if(flags.indexOf('s')==-1 && system.trashcan("subject",hdr.subject)) { - printf("!BLOCKED subject: %s\r\n",hdr.subject); var reason = format("Blocked subject (%s)",hdr.subject); + printf("!%s\r\n",reason); system.spamlog("NNTP","NOT IMPORTED",reason,hdr.from,server,hdr.to); continue; }