diff -cNr inn-1.7-kr-beta/include/patchlevel.h inn-1.7-kr/include/patchlevel.h *** inn-1.7-kr-beta/include/patchlevel.h Fri Oct 17 05:06:38 1997 --- inn-1.7-kr/include/patchlevel.h Wed Nov 26 22:40:53 1997 *************** *** 13,20 **** ** Try to avoid changing these. */ #define RELEASE "1" ! #define PATCHLEVEL "7" ! #define DATE "16-Oct-1997" /* --- 13,20 ---- ** Try to avoid changing these. */ #define RELEASE "1" ! #define PATCHLEVEL "7-kr" ! #define DATE "26-Nov-1997" /* diff -cNr inn-1.7-kr-beta/innd/art.c inn-1.7-kr/innd/art.c *** inn-1.7-kr-beta/innd/art.c Mon Nov 17 15:32:12 1997 --- inn-1.7-kr/innd/art.c Wed Nov 26 20:22:26 1997 *************** *** 1905,1910 **** --- 1905,1912 ---- if (Data.MessageID != NULL && Mode == OMrunning && !HISwrite(&Data, "")) syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); + #else + HISrememberID(Data.MessageID); #endif /* defined(DO_REMEMBER_TRASH) */ ARTreject(buff, article); return buff; *************** *** 1912,1918 **** #if defined(DO_PERL) pathForPerl = HeaderFind(article->Data, "Path", 4) ; ! if ((perlrc = (char *)HandleArticle(Data.Body)) != NULL) { (void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, perlrc); syslog(L_NOTICE, "rejecting[perl] %s %s", HDR(_message_id), buff); ARTlog(&Data, ART_REJECT, buff); --- 1914,1923 ---- #if defined(DO_PERL) pathForPerl = HeaderFind(article->Data, "Path", 4) ; ! TMRstart(TMR_FILTER); ! perlrc = (char *)HandleArticle(Data.Body); ! TMRstop(TMR_FILTER); ! if (perlrc != NULL) { (void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, perlrc); syslog(L_NOTICE, "rejecting[perl] %s %s", HDR(_message_id), buff); ARTlog(&Data, ART_REJECT, buff); *************** *** 1920,1925 **** --- 1925,1932 ---- if (Data.MessageID && Mode == OMrunning && !HISwrite(&Data, "")) syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); + #else + HISrememberID(Data.MessageID); #endif /* defined(DO_REMEMBER_TRASH) */ ARTreject(buff, article); return buff; *************** *** 1964,1969 **** --- 1971,1978 ---- if (Data.MessageID && Mode == OMrunning && !HISwrite(&Data,"")) syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); + #else + HISrememberID(Data.MessageID); #endif /* defined(DO_REMEMBER_TRASH) */ ARTreject(buff, article); return buff; *************** *** 2007,2012 **** --- 2016,2023 ---- if (Data.MessageID && Mode == OMrunning && !HISwrite(&Data, "")) syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); + #else + HISrememberID(Data.MessageID); #endif /* defined(DO_REMEMBER_TRASH) */ DISPOSE(distributions); ARTreject(buff, article); *************** *** 2116,2121 **** --- 2127,2134 ---- if (Mode == OMrunning && !HISwrite(&Data, "")) syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); + #else + HISrememberID(Data.MessageID); #endif /* defined(DO_REMEMBER_TRASH) */ if (distributions) DISPOSE(distributions); *************** *** 2187,2192 **** --- 2200,2207 ---- if (Mode == OMrunning && !HISwrite(&Data, "")) syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); + #else + HISrememberID(Data.MessageID); #endif /* defined(DO_REMEMBER_TRASH) */ if (distributions) DISPOSE(distributions); *************** *** 2203,2208 **** --- 2218,2225 ---- if (Mode == OMrunning && !HISwrite(&Data, "")) syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); + #else + HISrememberID(Data.MessageID); #endif /* defined(DO_REMEMBER_TRASH) */ if (distributions) DISPOSE(distributions); *************** *** 2310,2315 **** --- 2327,2334 ---- if (Mode == OMrunning && !HISwrite(&Data, "")) syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); + #else + HISrememberID(Data.MessageID); #endif /* defined(DO_REMEMBER_TRASH) */ if (distributions) DISPOSE(distributions); diff -cNr inn-1.7-kr-beta/innd/his.c inn-1.7-kr/innd/his.c *** inn-1.7-kr-beta/innd/his.c Mon Oct 20 19:46:59 1997 --- inn-1.7-kr/innd/his.c Wed Nov 26 20:22:31 1997 *************** *** 225,230 **** --- 225,253 ---- /* + ** Remember MessageID in the cache. An alternative to REMEMBER_TRASH + */ + void + HISrememberID(MessageID) + char *MessageID; + { + #if (HIS_CACHE_SIZE > 0) + long hashes[2], pos; + + if (MessageID) { + TMRstart(TMR_HISHAVE); /* Let's count into TMR_HISHAVE */ + dbzhash64(MessageID, strlen(MessageID), hashes); + pos = hashes[1] % HIS_CACHE_SIZE; + HIScache[pos] = hashes[0] | 0x80000000; + HIScacheLookups++; + HIScacheHits++; + TMRstop(TMR_HISHAVE); + } + #endif + } + + + /* ** Have we already seen an article? */ BOOL diff -cNr inn-1.7-kr-beta/innd/timer.c inn-1.7-kr/innd/timer.c *** inn-1.7-kr-beta/innd/timer.c Sat Oct 18 11:15:52 1997 --- inn-1.7-kr/innd/timer.c Wed Nov 26 13:29:07 1997 *************** *** 100,105 **** --- 100,106 ---- case TMR_ARTCNCL: str = "artcncl"; break; case TMR_HISHAVE: str = "hishave"; break; case TMR_HISGREP: str = "hisgrep"; break; + case TMR_FILTER: str = "filter"; break; } sprintf(buf, "%s %d(%d) ", str, cumulative[i], count[i]); cumulative[i] = count[i] = 0; diff -cNr inn-1.7-kr-beta/innd/timer.h inn-1.7-kr/innd/timer.h *** inn-1.7-kr-beta/innd/timer.h Sat Oct 18 11:15:52 1997 --- inn-1.7-kr/innd/timer.h Wed Nov 26 13:28:16 1997 *************** *** 12,17 **** --- 12,18 ---- #define TMR_ARTCNCL 7 #define TMR_HISHAVE 8 #define TMR_HISGREP 9 + #define TMR_FILTER 10 extern void TMRinit(); extern void TMRmainloophook(); diff -cNr inn-1.7-kr-beta/patches/README inn-1.7-kr/patches/README *** inn-1.7-kr-beta/patches/README Wed Nov 19 20:06:08 1997 --- inn-1.7-kr/patches/README Wed Nov 26 20:28:21 1997 *************** *** 38,40 **** --- 38,48 ---- 97/11/19 cleanqp-uue-related.patch. Bypass uuencoded message and treat multipart/related messages. + + 97/11/25 Released inn-1.7-kr-beta. jem@xpat.com and sysuh@kigam.re.kr + + 97/11/26 innlog-19971126.patch. Cleaner Daily report. Simplified + inn_filter summary. + + 97/11/26 HISremberID() added. An alternative to DO_REMEMBER_TRASH + but no history overhead. diff -cNr inn-1.7-kr-beta/patches/applied/innlog-19971126.patch inn-1.7-kr/patches/applied/innlog-19971126.patch *** inn-1.7-kr-beta/patches/applied/innlog-19971126.patch Thu Jan 1 09:00:00 1970 --- inn-1.7-kr/patches/applied/innlog-19971126.patch Wed Nov 26 10:44:22 1997 *************** *** 0 **** --- 1,301 ---- + *** innlog.pl.OLD Wed Nov 26 08:14:51 1997 + --- innlog.pl Wed Nov 26 10:23:00 1997 + *************** + *** 147,152 **** + --- 147,159 ---- + # + ########################################################################## + + + $WANT_DETAILED_FILTER_REASON = 0; # set 1 for detailed report. + + $MaxCurious = 20; + + $MaxGethostFailed = 20; + + $MaxUnwantedClients = 20; + + $MaxClientTimeouts = 20; + + $MaxNnrpdUnrecognized = 20; + + + ## Uncomment next line if you want to create a Web page + #$HTML = "comment_or_uncomment"; + + *************** + *** 700,705 **** + --- 707,719 ---- + ($reason) = $left =~ /^rejecting\[perl\] <[^>]+> \d+ (.*)$/; + if ($reason) + { + + if ($reason =~ /^(new EMP detected) (\S+)/) { + + $reason = $1; + + $reason .= " " . $2 if ($WANT_DETAILED_FILTER_REASON); + + } elsif ($reason =~ /^(\S+) (\S+)/) { + + $reason = $1; + + $reason .= " " . $2 if ($WANT_DETAILED_FILTER_REASON); + + } + $innd_filter_perl{$reason}++; + next LINE; + } + *************** + *** 1104,1113 **** + --- 1118,1132 ---- + } + # closed periodic + next LINE if ($server) = $left =~ /(\S+):\d+ closed periodic$/; + + next LINE if ($server) = $left =~ /(\S+):\d+ periodic close$/; + + # connection vanishing + + next LINE if ($server) = $left =~ /(\S+):\d+ connection vanishing$/; + # new hand-prepared backlog file. + next LINE if ($server) = $left =~ /(\S+) new hand-prepared/; + # grabbing external tape file + next LINE if ($server) = $left =~ /(\S+) grabbing external tape file/; + + # hostChkCxns - maxConnections was 2 now 3 + + next LINE if ($server) = $left =~ /(\S+) hostChkCxns - maxConnections was/; + + # final (child) + ($server, $seconds, $offered, $accepted, $refused, $rejected) = $left =~ + *************** + *** 1126,1132 **** + # final (real) + ($server, $seconds, $offered, $accepted, $refused, + $rejected, $missing, $spooled) = $left =~ + ! /(\S+) final seconds (\d+) offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) spooled (\d+)$/; + if ($server) + { + $server =~ tr/A-Z/a-z/ unless ($CASE_SENSITIVE); + --- 1145,1151 ---- + # final (real) + ($server, $seconds, $offered, $accepted, $refused, + $rejected, $missing, $spooled) = $left =~ + ! /(\S+) final seconds (\d+) offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) spooled (\d+)/; + if ($server) + { + $server =~ tr/A-Z/a-z/ unless ($CASE_SENSITIVE); + *************** + *** 1157,1162 **** + --- 1176,1192 ---- + $innfeed_spooled{$server} += $spooled; + next LINE; + } + + # final (only seconds spooled on_close sleeping) + + ($server, $seconds, $spooled) = $left =~ + + /(\S+) final seconds (\d+) spooled (\d+) on_close \d+ sleeping \d+$/; + + if ($server) + + { + + $server =~ tr/A-Z/a-z/ unless ($CASE_SENSITIVE); + + $server =~ s/\d+$//; + + $innfeed_seconds{$server} += $seconds; + + $innfeed_spooled{$server} += $spooled; + + next LINE; + + } + # checkpoint + ($server) = $left =~ /(\S+) checkpoint seconds.*$/; + if ($server) + *************** + *** 2377,2388 **** + --- 2407,2421 ---- + print HTML "
\n"; + print HTML "\n\n"; + } + + $total_innd_filter_perl = 0; + foreach $reason (sort (keys (%innd_filter_perl))) + { + printf STDOUT ("%-64.64s %7d\n", $reason, $innd_filter_perl{$reason, }); + printf HTML ("\n", + $reason, $innd_filter_perl{$reason}) if ($HTML); + + $total_innd_filter_perl += $innd_filter_perl{$reason, }; + } + + printf STDOUT ("%-64.64s %7d\n", "Total", $total_innd_filter_perl); + print HTML "
Reason Number
%s%d


\n" if ($HTML); + print "\n"; + + *************** + *** 3814,3820 **** + print HTML "\n" if ($HTML); + if (($curious eq "ok") && ($WANT_CURIOUS)) + { + ! print "Curious NNRP server explorers :\n"; + print "System Conn\n"; + if ($HTML) + { + --- 3847,3857 ---- + print HTML "\n" if ($HTML); + if (($curious eq "ok") && ($WANT_CURIOUS)) + { + ! if ($MaxCurious < scalar(keys (%nnrpd_groups))) { + ! print "Curious NNRP server explorers [top $MaxCurious]:\n"; + ! } else { + ! print "Curious NNRP server explorers :\n"; + ! } + print "System Conn\n"; + if ($HTML) + { + *************** + *** 3827,3832 **** + --- 3864,3870 ---- + (keys (%nnrpd_groups))) + { + my $tmp; + + last if (--$MaxCurious < 0); + if (($nnrpd_groups{"$serv"} == 0) && ($nnrpd_post_ok{"$serv"} == 0)) + { + $tmp = $serv eq '?'?" (getpeername failure)":""; + *************** + *** 3847,3853 **** + if (%nnrpd_no_permission) + { + print HTML "\n" if ($HTML); + ! print "NNRP no permission clients :\n"; + print "System Conn\n"; + if ($HTML) + { + --- 3885,3895 ---- + if (%nnrpd_no_permission) + { + print HTML "\n" if ($HTML); + ! if ($MaxUnwantedClients < scalar(keys (%nnrpd_no_permission))) { + ! print "NNRP no permission clients [top $MaxUnwantedClients]:\n"; + ! } else { + ! print "NNRP no permission clients :\n"; + ! } + print "System Conn\n"; + if ($HTML) + { + *************** + *** 3859,3864 **** + --- 3901,3907 ---- + foreach $client (sort {$nnrpd_no_permission{$b} <=> $nnrpd_no_permission{$a}} + (keys (%nnrpd_no_permission))) + { + + last if (--$MaxUnwantedClients < 0); + printf STDOUT ("%-64.64s %5d\n", + $client, $nnrpd_no_permission{$client}); + if ($HTML) + *************** + *** 3874,3880 **** + if ((%nnrpd_gethostbyaddr) && ($WANT_GETHOSTFAILED)) + { + print HTML "\n" if ($HTML); + ! print "NNRP gethostbyaddr failures :\n"; + print "IP Conn\n"; + if ($HTML) + { + --- 3917,3927 ---- + if ((%nnrpd_gethostbyaddr) && ($WANT_GETHOSTFAILED)) + { + print HTML "\n" if ($HTML); + ! if ($MaxGethostFailed < scalar(keys (%nnrpd_gethostbyaddr))) { + ! print "NNRP gethostbyaddr failures [top $MaxGethostFailed]:\n"; + ! } else { + ! print "NNRP gethostbyaddr failures :\n"; + ! } + print "IP Conn\n"; + if ($HTML) + { + *************** + *** 3883,3890 **** + print HTML " Connections "; + print HTML "\n\n"; + } + ! foreach $ip (sort(keys (%nnrpd_gethostbyaddr))) + { + printf STDOUT ("%-64.64s %5d\n", + $ip, $nnrpd_gethostbyaddr{$ip}); + if ($HTML) + --- 3930,3939 ---- + print HTML " Connections "; + print HTML "\n\n"; + } + ! foreach $ip (sort {$nnrpd_gethostbyaddr{$b} <=> $nnrpd_gethostbyaddr{$a}} + ! (keys (%nnrpd_gethostbyaddr))) + { + + last if (--$MaxGethostFailed < 0); + printf STDOUT ("%-64.64s %5d\n", + $ip, $nnrpd_gethostbyaddr{$ip}); + if ($HTML) + *************** + *** 3912,3918 **** + if (%nnrpd_unrecognized) + { + print HTML "\n" if ($HTML); + ! print "NNRP unrecognized commands (by host) :\n"; + print "System Commands\n"; + if ($HTML) + { + --- 3961,3971 ---- + if (%nnrpd_unrecognized) + { + print HTML "\n" if ($HTML); + ! if ($MaxNnrpdUnrecognized < scalar(keys (%nnrpd_unrecognized))) { + ! print "NNRP unrecognized commands (by host) [top $MaxNnrpdUnrecognized]:\n"; + ! } else { + ! print "NNRP unrecognized commands (by host) :\n"; + ! } + print "System Commands\n"; + if ($HTML) + { + *************** + *** 3921,3928 **** + print HTML " Commands "; + print HTML "\n\n"; + } + ! foreach $client (sort(keys (%nnrpd_unrecognized))) + { + printf STDOUT ("%-64.64s %5d\n", + $client, $nnrpd_unrecognized{$client}); + if ($HTML) + --- 3974,3983 ---- + print HTML " Commands "; + print HTML "\n\n"; + } + ! foreach $client (sort {$nnrpd_unrecognized{$b} <=> $nnrpd_unrecognized{$a}} + ! (keys (%nnrpd_unrecognized))) + { + + last if (--$MaxNnrpdUnrecognized < 0); + printf STDOUT ("%-64.64s %5d\n", + $client, $nnrpd_unrecognized{$client}); + if ($HTML) + *************** + *** 3962,3968 **** + $t_p = 0; + $t_c = 0; + print HTML "\n" if ($HTML); + ! print "NNRP client timeouts :\n"; + print "System Conn Peer\n"; + if ($HTML) + { + --- 4017,4027 ---- + $t_p = 0; + $t_c = 0; + print HTML "\n" if ($HTML); + ! if ($MaxClientTimeouts < scalar(keys (%nnrpd_timeout))) { + ! print "NNRP client timeouts [top $MaxClientTimeouts]:\n"; + ! } else { + ! print "NNRP client timeouts :\n"; + ! } + print "System Conn Peer\n"; + if ($HTML) + { + *************** + *** 3971,3981 **** + print HTML " Timeouts Reset by Peer "; + print HTML "\n\n"; + } + ! foreach $client (sort(keys (%nnrpd_timeout))) + { + $t_o += $nnrpd_timeout{$client}; + $t_p += $nnrpd_reset_peer{$client}; + $t_c++; + printf STDOUT ("%-64.64s %5d %5d\n", + $client, $nnrpd_timeout{$client}, $nnrpd_reset_peer{$client}); + if ($HTML) + --- 4030,4042 ---- + print HTML " Timeouts Reset by Peer "; + print HTML "\n\n"; + } + ! foreach $client (sort {$nnrpd_timeout{$b} <=> $nnrpd_timeout{$a}} + ! (keys (%nnrpd_timeout))) + { + $t_o += $nnrpd_timeout{$client}; + $t_p += $nnrpd_reset_peer{$client}; + $t_c++; + + next if (--$MaxClientTimeouts < 0); + printf STDOUT ("%-64.64s %5d %5d\n", + $client, $nnrpd_timeout{$client}, $nnrpd_reset_peer{$client}); + if ($HTML) diff -cNr inn-1.7-kr-beta/samples/filter_innd.pl inn-1.7-kr/samples/filter_innd.pl *** inn-1.7-kr-beta/samples/filter_innd.pl Tue Nov 25 16:36:53 1997 --- inn-1.7-kr/samples/filter_innd.pl Thu Nov 27 10:08:50 1997 *************** *** 12,18 **** # and any other non-null string to reject. If rejecting the string returned # will be part of the logged reason. # ! sub filter_before_reload { ## ## Set global variables, which should not change between articles ## --- 12,18 ---- # and any other non-null string to reject. If rejecting the string returned # will be part of the logged reason. # ! sub filter_after_reload { ## ## Set global variables, which should not change between articles ## *************** *** 23,29 **** $ArticleHistSize = 50000; # keep history of last N message ids $ControlPassthru = 1; # true (non-zero) to exempt cmsgs from filtering $EMPHistSize = 20000; # number of EMP ids to hold in memory ! $checkstat = 500; # number of passes between filter variable file stats $ReplyPassthru = 1; # true (non-zero) to exempt replies from filtering. $PostHistFilterMax = 100; # Max value of rate posting filter. $PostHistFilterTrip = 16; # Maximum allowed sustained posting rate (arts/minute) --- 23,29 ---- $ArticleHistSize = 50000; # keep history of last N message ids $ControlPassthru = 1; # true (non-zero) to exempt cmsgs from filtering $EMPHistSize = 20000; # number of EMP ids to hold in memory ! $EMPLogSyncDelay = 600; # time between successive logs in seconds. $ReplyPassthru = 1; # true (non-zero) to exempt replies from filtering. $PostHistFilterMax = 100; # Max value of rate posting filter. $PostHistFilterTrip = 16; # Maximum allowed sustained posting rate (arts/minute) *************** *** 41,60 **** ## configdir: where all of the pattern match variable data ## is stored, in filenames the same as the variable name. ## - ## filterfile: The installed name of this file, used to stat - ## for changes, to force filter_before_reload re-runs. - ## ## =()< $emplog = '@<_PATH_MOST_LOGS>@/emplog';>()= $emplog = '/var/log/news/emplog'; ## =()< $configdir = '@<_PATH_NEWSLIB>@/perlfilt';>()= $configdir = '/var/news/etc/perlfilt'; - ## =()< $filterfile = '@<_PATH_PERL_FILTER_INND>@';>()= - $filterfile = '/usr/news/bin/control/filter_innd.pl'; - - ## - ## Start statcount at zero to force an immediate pattern load - ## - $statcount = 0; ## ## To keep perl -w quiet, we set some variables. --- 41,50 ---- *************** *** 72,77 **** --- 62,70 ---- 'zapmid', 'zappath', 'zapsubj', 'ignorefrom', 'ignoresubs', 'zapposting', 'zappathend'); + ## Load configs + &Load_Configs(); + ## ## Load the saved EMP list ## *************** *** 83,90 **** my ($tmpsub, $tmpfrom, $i, $pathend); $rval = ''; - $now = time(); ## ## Trim the posting-host history hash every minute. ## --- 76,84 ---- my ($tmpsub, $tmpfrom, $i, $pathend); $rval = ''; $now = time(); + + ## ## Trim the posting-host history hash every minute. ## *************** *** 93,111 **** } ## ! ## Every $checkstat passes, check to see if any of our config files have been ! ## updated. If so, read and parse them. ## - if ( $statcount <= 0 ) { - &Check_Configs; - } - else { - $statcount--; - } - if ( $hdr{'Control'} && ($hdr{'Control'} =~ /cancel/oi || $hdr{'Subject'} =~ /cmsg cancel/oi )) { if ($hdr{'__BODY__'} =~ /Usenet Cancel Engine/om) { ! return 'Usenet Cancel Engine'; } } ## --- 87,97 ---- } ## ! ## Process control messages. This must be cheapest if no body searching. ## if ( $hdr{'Control'} && ($hdr{'Control'} =~ /cancel/oi || $hdr{'Subject'} =~ /cmsg cancel/oi )) { if ($hdr{'__BODY__'} =~ /Usenet Cancel Engine/om) { ! return 'Usenet-Cancel-Engine'; } } ## *************** *** 114,119 **** --- 100,125 ---- ## return "" if (($ControlPassthru) && ($hdr{'Control'})); return "" if (($ControlPassthru) && ($hdr{'Also-Control'})); + + + ## + ## ECP filter is cheaper one. + ## + + ## Split newsgroups line by "," + ## filter out resulting arrays whose size is larger than the limit. + my (@newsgroups_hdr) = split(/,/, $hdr{'Newsgroups'}); + + if ($hdr{'Approved'}) { + return "ECP-Mod" if ($#newsgroups_hdr >= $MaxCrosspostsMod && + $hdr{'Newsgroups'} !~ /answer/); + } elsif ($#newsgroups_hdr >= $MaxCrosspostsUnmod) { + return "ECP"; + } elsif ($#newsgroups_hdr >= $MaxSexCrossPost) { + return "SexCP" if($hdr{'Newsgroups'} =~ /\.sex\.|erotic|nude|porn|fetish/o); + } + + ## ## Allow apparent followup messages to pass through. We require ## strict formatting, including an "re:" in the subject line, *************** *** 149,154 **** --- 155,162 ---- { return ''; } + + ## ## Just because I don't like typing so much, set a postinghost variable. ## *************** *** 330,356 **** } ## - ## ECP filter - ## - - ## Split newsgroups line by "," - my (@newsgroups_hdr) = split(/,/, $hdr{'Newsgroups'}); - if ( - ($#newsgroups_hdr >= $MaxSexCrossPost) && - ($hdr{'Newsgroups'} =~ /\.sex\.|erotic|nude|porn|fetish/o) - ) { - $rval = "SexCP"; - } - - ## filter out resulting arrays whose size is larger than the limit. - if ($hdr{'Approved'}) { - $rval = "ECP-Mod" if ($#newsgroups_hdr >= $MaxCrosspostsMod && - $hdr{'Newsgroups'} !~ /answer/); - } else { - $rval = "ECP" if ($#newsgroups_hdr >= $MaxCrosspostsUnmod); - } - - ## ## EMP filter ## --- 338,343 ---- *************** *** 358,367 **** push(@history, $i); ## Use a Breidbart Index calculation if ( exists $history{$i} ) { ! $history{$i} += sqrt($#newsgroups_hdr + 1); } else { ! $history{$i} = sqrt($#newsgroups_hdr + 1); } ## If post appears more than high limit, save for --- 345,354 ---- push(@history, $i); ## Use a Breidbart Index calculation if ( exists $history{$i} ) { ! $history{$i} += fast_sqrt($#newsgroups_hdr + 1); } else { ! $history{$i} = fast_sqrt($#newsgroups_hdr + 1); } ## If post appears more than high limit, save for *************** *** 395,404 **** $EMP{$Key} = 1; push(@EMP_Hist, $Key); ! &filter_before_reload() unless ($emplog); ! open (EMPLOG, ">$emplog") || die "Cannot write $emplog: $!"; ! print EMPLOG join("\n", (@EMP_Hist)), "\n"; ! close EMPLOG; $rval = "new EMP detected $Key"; } --- 382,393 ---- $EMP{$Key} = 1; push(@EMP_Hist, $Key); ! if (($now - $lastEMPLogTime) > $EMPLogSyncDelay) { ! $lastEMPLogTime = $now; ! open (EMPLOG, ">$emplog") || die "filter_art: Cannot write $emplog: $!"; ! print EMPLOG join("\n", (@EMP_Hist)), "\n"; ! close EMPLOG; ! } $rval = "new EMP detected $Key"; } *************** *** 434,439 **** --- 423,438 ---- } } + sub Load_Configs { + ## + ## Load configs + ## + my ($conf_var); + foreach $conf_var (@zaplist) { + &Read_Config($conf_var) if ( -r "$configdir/$conf_var" ); + } + } + sub load_emp { local ($entry, %seen); ## Load up the EMP list *************** *** 456,489 **** } } - sub Check_Configs { - ## - ## Check to see if any of our config files have been updated. - ## If so, call Read_Config to read and parse them. - ## - my ($conf_var, @slist, @mtime); - $statcount = $checkstat; - foreach $conf_var (@zaplist) { - $OldMtime{$conf_var} = 0 unless (exists $OldMtime{$conf_var}); - if ( -r "$configdir/$conf_var" ) { - @slist = stat("$configdir/$conf_var"); - $mtime = $slist[9]; - if ( $mtime > $OldMtime{$conf_var} ) { - &Read_Config($conf_var); - $OldMtime{$conf_var} = $mtime; - } - } - } - ## Also check to see if the main file has been changed, - ## and reload our startup function, if so. - @slist = stat("$filterfile"); - $mtime = $slist[9]; - if ( $mtime > $OldMtime{$filterfile} ) { - &filter_before_reload(); - $OldMtime{$filterfile} = $mtime; - } - } - sub Trim_Post_Hist { my ($host, $count); ## --- 455,460 ---- *************** *** 506,508 **** --- 477,500 ---- $PostHistTrim = $now; } + sub fast_sqrt { + ## + ## I guess sqrt() can be replaced by a table lookup. + ## + my ($n) = $_[0]; + + ## Is my lookup table initialized? + &init_sqrt_table() unless ($sqrtTable[0] > 0); + return $sqrtTable[$n] if ($n < $sqrtTable[0]); + return sqrt($n); + } + + sub init_sqrt_table { + my ($i); + + $sqrtTable[0] = 200; # should be greater than $MaxCrosspostsMod. + + for ($i = 1; $i < $sqrtTable[0]; $i++) { + $sqrtTable[$i] = sqrt($i); + } + } diff -cNr inn-1.7-kr-beta/samples/innlog.pl inn-1.7-kr/samples/innlog.pl *** inn-1.7-kr-beta/samples/innlog.pl Sun Nov 23 16:48:49 1997 --- inn-1.7-kr/samples/innlog.pl Wed Nov 26 15:56:20 1997 *************** *** 147,152 **** --- 147,159 ---- # ########################################################################## + $WANT_DETAILED_FILTER_REASON = 0; # set 1 for detailed report. + $MaxCurious = 20; + $MaxGethostFailed = 20; + $MaxUnwantedClients = 20; + $MaxClientTimeouts = 20; + $MaxNnrpdUnrecognized = 20; + ## Uncomment next line if you want to create a Web page #$HTML = "comment_or_uncomment"; *************** *** 700,705 **** --- 707,719 ---- ($reason) = $left =~ /^rejecting\[perl\] <[^>]+> \d+ (.*)$/; if ($reason) { + if ($reason =~ /^(new EMP detected) (\S+)/) { + $reason = $1; + $reason .= " " . $2 if ($WANT_DETAILED_FILTER_REASON); + } elsif ($reason =~ /^(\S+) (\S+)/) { + $reason = $1; + $reason .= " " . $2 if ($WANT_DETAILED_FILTER_REASON); + } $innd_filter_perl{$reason}++; next LINE; } *************** *** 860,871 **** next LINE; } # time (from the Greco's patch) ! # ME time X idle X(X) artwrite X(X) artlink X(X) hiswrite X(X) hissync X(X) sitesend X(X) artctrl X(X) artcncl X(X) hishave X(X) hisgrep X(X) { my ($server, $t1, $id1, $id2, $art1, $art2, $art3, $art4, $his1, $his2, $his3, $his4, $sit1, $sit2, $art5, $art6, ! $art7, $art8, $his5, $his6, $his7, $his8) = $left =~ ! /(\S+) time (\d+) idle (\d+)\((\d+)\) artwrite (\d+)\((\d+)\) artlink (\d+)\((\d+)\) hiswrite (\d+)\((\d+)\) hissync (\d+)\((\d+)\) sitesend (\d+)\((\d+)\) artctrl (\d+)\((\d+)\) artcncl (\d+)\((\d+)\) hishave (\d+)\((\d+)\) hisgrep (\d+)\((\d+)\)/; if ($server) { $innd_time_num++; --- 874,886 ---- next LINE; } # time (from the Greco's patch) ! # ME time X idle X(X) artwrite X(X) artlink X(X) hiswrite X(X) hissync X(X) sitesend X(X) artctrl X(X) artcncl X(X) hishave X(X) hisgrep X(X) { + my ($fil1, $fil2); my ($server, $t1, $id1, $id2, $art1, $art2, $art3, $art4, $his1, $his2, $his3, $his4, $sit1, $sit2, $art5, $art6, ! $art7, $art8, $his5, $his6, $his7, $his8, $rem) = $left =~ ! /(\S+) time (\d+) idle (\d+)\((\d+)\) artwrite (\d+)\((\d+)\) artlink (\d+)\((\d+)\) hiswrite (\d+)\((\d+)\) hissync (\d+)\((\d+)\) sitesend (\d+)\((\d+)\) artctrl (\d+)\((\d+)\) artcncl (\d+)\((\d+)\) hishave (\d+)\((\d+)\) hisgrep (\d+)\((\d+)\)(.*)/; if ($server) { $innd_time_num++; *************** *** 891,896 **** --- 906,914 ---- $innd_time_call_hishave += $his6; $innd_time_hisgrep +=$his7 ; $innd_time_call_hisgrep += $his8; + ($fil1, $fil2) = $rem =~ /filter (\d+)\((\d+)\)/; + $innd_time_filter += $fil1; + $innd_time_call_filter += $fil2; next LINE; } } *************** *** 1104,1113 **** --- 1122,1136 ---- } # closed periodic next LINE if ($server) = $left =~ /(\S+):\d+ closed periodic$/; + next LINE if ($server) = $left =~ /(\S+):\d+ periodic close$/; + # connection vanishing + next LINE if ($server) = $left =~ /(\S+):\d+ connection vanishing$/; # new hand-prepared backlog file. next LINE if ($server) = $left =~ /(\S+) new hand-prepared/; # grabbing external tape file next LINE if ($server) = $left =~ /(\S+) grabbing external tape file/; + # hostChkCxns - maxConnections was 2 now 3 + next LINE if ($server) = $left =~ /(\S+) hostChkCxns - maxConnections was/; # final (child) ($server, $seconds, $offered, $accepted, $refused, $rejected) = $left =~ *************** *** 1126,1132 **** # final (real) ($server, $seconds, $offered, $accepted, $refused, $rejected, $missing, $spooled) = $left =~ ! /(\S+) final seconds (\d+) offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) spooled (\d+)$/; if ($server) { $server =~ tr/A-Z/a-z/ unless ($CASE_SENSITIVE); --- 1149,1155 ---- # final (real) ($server, $seconds, $offered, $accepted, $refused, $rejected, $missing, $spooled) = $left =~ ! /(\S+) final seconds (\d+) offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) spooled (\d+)/; if ($server) { $server =~ tr/A-Z/a-z/ unless ($CASE_SENSITIVE); *************** *** 1157,1162 **** --- 1180,1196 ---- $innfeed_spooled{$server} += $spooled; next LINE; } + # final (only seconds spooled on_close sleeping) + ($server, $seconds, $spooled) = $left =~ + /(\S+) final seconds (\d+) spooled (\d+) on_close \d+ sleeping \d+$/; + if ($server) + { + $server =~ tr/A-Z/a-z/ unless ($CASE_SENSITIVE); + $server =~ s/\d+$//; + $innfeed_seconds{$server} += $seconds; + $innfeed_spooled{$server} += $spooled; + next LINE; + } # checkpoint ($server) = $left =~ /(\S+) checkpoint seconds.*$/; if ($server) *************** *** 2377,2388 **** --- 2411,2425 ---- print HTML "

\n"; print HTML "\n\n"; } + $total_innd_filter_perl = 0; foreach $reason (sort (keys (%innd_filter_perl))) { printf STDOUT ("%-64.64s %7d\n", $reason, $innd_filter_perl{$reason, }); printf HTML ("\n", $reason, $innd_filter_perl{$reason}) if ($HTML); + $total_innd_filter_perl += $innd_filter_perl{$reason, }; } + printf STDOUT ("%-64.64s %7d\n", "Total", $total_innd_filter_perl); print HTML "
Reason Number
%s%d


\n" if ($HTML); print "\n"; *************** *** 2443,2448 **** --- 2480,2493 ---- $innd_time_call_hisgrep == 0 ? 0 : $innd_time_hisgrep / $innd_time_call_hisgrep if ($innd_time_grep); ; + printf STDOUT "%-29.29s %13s %5.1f%% %10d %10.3f\n", "spam filter", + ms2time ($innd_time_filter), + 100 * $innd_time_filter / $innd_time_times, $innd_time_call_filter, + $innd_time_call_filter == 0 ? 0 : + $innd_time_filter / $innd_time_call_filter if ($innd_time_grep); + ; + printf STDOUT "%-29.29s %13s %5.1f%%\n", "Total innd time", + ms2time ($innd_time_times), 100.0; print "\n"; if ($HTML) { *************** *** 3814,3820 **** print HTML "\n" if ($HTML); if (($curious eq "ok") && ($WANT_CURIOUS)) { ! print "Curious NNRP server explorers :\n"; print "System Conn\n"; if ($HTML) { --- 3859,3869 ---- print HTML "\n" if ($HTML); if (($curious eq "ok") && ($WANT_CURIOUS)) { ! if ($MaxCurious < scalar(keys (%nnrpd_groups))) { ! print "Curious NNRP server explorers [top $MaxCurious]:\n"; ! } else { ! print "Curious NNRP server explorers :\n"; ! } print "System Conn\n"; if ($HTML) { *************** *** 3827,3832 **** --- 3876,3882 ---- (keys (%nnrpd_groups))) { my $tmp; + last if (--$MaxCurious < 0); if (($nnrpd_groups{"$serv"} == 0) && ($nnrpd_post_ok{"$serv"} == 0)) { $tmp = $serv eq '?'?" (getpeername failure)":""; *************** *** 3847,3853 **** if (%nnrpd_no_permission) { print HTML "\n" if ($HTML); ! print "NNRP no permission clients :\n"; print "System Conn\n"; if ($HTML) { --- 3897,3907 ---- if (%nnrpd_no_permission) { print HTML "\n" if ($HTML); ! if ($MaxUnwantedClients < scalar(keys (%nnrpd_no_permission))) { ! print "NNRP no permission clients [top $MaxUnwantedClients]:\n"; ! } else { ! print "NNRP no permission clients :\n"; ! } print "System Conn\n"; if ($HTML) { *************** *** 3859,3864 **** --- 3913,3919 ---- foreach $client (sort {$nnrpd_no_permission{$b} <=> $nnrpd_no_permission{$a}} (keys (%nnrpd_no_permission))) { + last if (--$MaxUnwantedClients < 0); printf STDOUT ("%-64.64s %5d\n", $client, $nnrpd_no_permission{$client}); if ($HTML) *************** *** 3874,3880 **** if ((%nnrpd_gethostbyaddr) && ($WANT_GETHOSTFAILED)) { print HTML "\n" if ($HTML); ! print "NNRP gethostbyaddr failures :\n"; print "IP Conn\n"; if ($HTML) { --- 3929,3939 ---- if ((%nnrpd_gethostbyaddr) && ($WANT_GETHOSTFAILED)) { print HTML "\n" if ($HTML); ! if ($MaxGethostFailed < scalar(keys (%nnrpd_gethostbyaddr))) { ! print "NNRP gethostbyaddr failures [top $MaxGethostFailed]:\n"; ! } else { ! print "NNRP gethostbyaddr failures :\n"; ! } print "IP Conn\n"; if ($HTML) { *************** *** 3883,3890 **** print HTML " Connections "; print HTML "\n\n"; } ! foreach $ip (sort(keys (%nnrpd_gethostbyaddr))) { printf STDOUT ("%-64.64s %5d\n", $ip, $nnrpd_gethostbyaddr{$ip}); if ($HTML) --- 3942,3951 ---- print HTML " Connections "; print HTML "\n\n"; } ! foreach $ip (sort {$nnrpd_gethostbyaddr{$b} <=> $nnrpd_gethostbyaddr{$a}} ! (keys (%nnrpd_gethostbyaddr))) { + last if (--$MaxGethostFailed < 0); printf STDOUT ("%-64.64s %5d\n", $ip, $nnrpd_gethostbyaddr{$ip}); if ($HTML) *************** *** 3912,3918 **** if (%nnrpd_unrecognized) { print HTML "\n" if ($HTML); ! print "NNRP unrecognized commands (by host) :\n"; print "System Commands\n"; if ($HTML) { --- 3973,3983 ---- if (%nnrpd_unrecognized) { print HTML "\n" if ($HTML); ! if ($MaxNnrpdUnrecognized < scalar(keys (%nnrpd_unrecognized))) { ! print "NNRP unrecognized commands (by host) [top $MaxNnrpdUnrecognized]:\n"; ! } else { ! print "NNRP unrecognized commands (by host) :\n"; ! } print "System Commands\n"; if ($HTML) { *************** *** 3921,3928 **** print HTML " Commands "; print HTML "\n\n"; } ! foreach $client (sort(keys (%nnrpd_unrecognized))) { printf STDOUT ("%-64.64s %5d\n", $client, $nnrpd_unrecognized{$client}); if ($HTML) --- 3986,3995 ---- print HTML " Commands "; print HTML "\n\n"; } ! foreach $client (sort {$nnrpd_unrecognized{$b} <=> $nnrpd_unrecognized{$a}} ! (keys (%nnrpd_unrecognized))) { + last if (--$MaxNnrpdUnrecognized < 0); printf STDOUT ("%-64.64s %5d\n", $client, $nnrpd_unrecognized{$client}); if ($HTML) *************** *** 3962,3968 **** $t_p = 0; $t_c = 0; print HTML "\n" if ($HTML); ! print "NNRP client timeouts :\n"; print "System Conn Peer\n"; if ($HTML) { --- 4029,4039 ---- $t_p = 0; $t_c = 0; print HTML "\n" if ($HTML); ! if ($MaxClientTimeouts < scalar(keys (%nnrpd_timeout))) { ! print "NNRP client timeouts [top $MaxClientTimeouts]:\n"; ! } else { ! print "NNRP client timeouts :\n"; ! } print "System Conn Peer\n"; if ($HTML) { *************** *** 3971,3981 **** print HTML " Timeouts Reset by Peer "; print HTML "\n\n"; } ! foreach $client (sort(keys (%nnrpd_timeout))) { $t_o += $nnrpd_timeout{$client}; $t_p += $nnrpd_reset_peer{$client}; $t_c++; printf STDOUT ("%-64.64s %5d %5d\n", $client, $nnrpd_timeout{$client}, $nnrpd_reset_peer{$client}); if ($HTML) --- 4042,4054 ---- print HTML " Timeouts Reset by Peer "; print HTML "\n\n"; } ! foreach $client (sort {$nnrpd_timeout{$b} <=> $nnrpd_timeout{$a}} ! (keys (%nnrpd_timeout))) { $t_o += $nnrpd_timeout{$client}; $t_p += $nnrpd_reset_peer{$client}; $t_c++; + next if (--$MaxClientTimeouts < 0); printf STDOUT ("%-64.64s %5d %5d\n", $client, $nnrpd_timeout{$client}, $nnrpd_reset_peer{$client}); if ($HTML) diff -cNr inn-1.7-kr-beta/samples/startup_innd.pl inn-1.7-kr/samples/startup_innd.pl *** inn-1.7-kr-beta/samples/startup_innd.pl Sun Nov 23 21:10:37 1997 --- inn-1.7-kr/samples/startup_innd.pl Thu Nov 27 08:41:45 1997 *************** *** 18,24 **** my $before_count = 1 ; # Gets no arguments, and its caller expects no return value. ! sub x_filter_before_reload { if ($before_count == 1) { # Do one thing # print "First time (before)\n" ; --- 18,24 ---- my $before_count = 1 ; # Gets no arguments, and its caller expects no return value. ! sub filter_before_reload { if ($before_count == 1) { # Do one thing # print "First time (before)\n" ; *************** *** 32,38 **** my $after_count = 1 ; # Gets no arguments, and its caller expects no return value. ! sub filter_after_reload { if ($after_count == 1) { # Do one thing # print "First time (after)\n" ; --- 32,38 ---- my $after_count = 1 ; # Gets no arguments, and its caller expects no return value. ! sub x_filter_after_reload { if ($after_count == 1) { # Do one thing # print "First time (after)\n" ; diff -cNr inn-1.7-kr-beta/site/FAQ.suh inn-1.7-kr/site/FAQ.suh *** inn-1.7-kr-beta/site/FAQ.suh Thu Jan 1 09:00:00 1970 --- inn-1.7-kr/site/FAQ.suh Thu Nov 27 10:05:11 1997 *************** *** 0 **** --- 1,28 ---- + INN FAQ + + Áú¹® 1. innd¸¦ Æ÷Æ® 120À¸·Î ÀÛµ¿½ÃŰ·Á¸é? + + 1) any-port.patch´Â ¾ÆÁ÷ ºÒ¿ÏÀüÇÏ´Ù°í »ý°¢ÇÕ´Ï´Ù. + ÀÌÀ¯´Â Æ÷½ºÆÃ½Ã ¹Ýµå½Ã innd°¡ 119·Î ÀÛµ¿ÇÏ´Â Á¦ 2 ÀÇ ´º½º¼­¹ö¸¦ + »ç¿ëÇØ¾ß¸¸ ÇÕ´Ï´Ù. ÀÌ·¯ÇÑ ¹®Á¦°¡ ´ÙÀ½ ¹öÁ¯¿¡¼­´Â ÇØ°áµÇ¸®¶ó º¾´Ï´Ù. + + µû¶ó¼­ È®½ÇÀ» ±âÇϱâ À§ÇØ inn-1.7-kr/include/configdata.h¿¡¼­ + 119¶ó´Â ¼ýÀÚ¸¦ 120À¸·Î ¹Ù²Ù°í (ÇÑÁÙ¹Û¿¡ ¾øÀ½), inn-1.7-kr µð·ºÅ丮¿¡¼­ + ´Ù½Ã "make; su; make update; exit" ¸í·ÉÀ» ÁÝ´Ï´Ù. + + 2) ´ÙÀ½Àº /etc/inetd.conf¿¡ nntp °ü·Ã ÁÙÀ» ³Ö´Â °ÍÀÔ´Ï´Ù. + À̰ÍÀº OS¿Í ½Ã½ºÅÛ¿¡ µû¶ó ´Ù¸¨´Ï´Ù. + + - Linux/Slackware + nntp stream tcp nowait news /usr/sbin/tcpd /usr/local/news/etc/nntp + + - Solaris-2.x + nntp stream tcp nowait news /usr/local/news/etc/in.nnrpd in.nnrpd + + ´Ù¸¥ ½Ã½ºÅÛÀº À§ÀÇ ¿¹¹®À» Âü°íÇÏ¿© °¢ÀÚ ½ÇÇèÇØº¸½Ã±â ¹Ù¶ø´Ï´Ù. + + 3) inetd¸¦ Àç°¡µ¿½Ã۰í "telnet localhost nntp" µîÀ¸·Î nnrp°¡ + ÀÛµ¿ÇÏ´ÂÁö¸¦ È®ÀÎÇÕ´Ï´Ù. + + 4) ´º½º°ø±Þó¿¡ Æ÷Æ® 120À¸·Î ´º½º¸¦ ¼Û½ÅÇØ´Þ¶ó°í ¾ê±âÇÕ´Ï´Ù. + diff -cNr inn-1.7-kr-beta/site/perlfilt/ignoregroups inn-1.7-kr/site/perlfilt/ignoregroups *** inn-1.7-kr-beta/site/perlfilt/ignoregroups Wed Nov 5 07:08:42 1997 --- inn-1.7-kr/site/perlfilt/ignoregroups Wed Nov 26 11:52:36 1997 *************** *** 5,7 **** --- 5,8 ---- news.lists.filters rec.boats.marketplace alt.shoe.lesbians.moderated + han.news.stats