Initial changes to format of spam.log.

This commit is contained in:
Retro_Guy 2023-12-31 09:51:53 -07:00
parent 9d2cd5d603
commit 9013d73f2a
3 changed files with 16 additions and 12 deletions

View File

@ -1363,10 +1363,10 @@ function check_spam($subject, $from, $newsgroups, $ref, $body, $msgid, $useheade
}
unlink($spamfile);
if ($res === 1) {
file_put_contents($logfile, "\n" . format_log_date() . " identified spam: " . $from . " " . $newsgroups . " " . $msgid, FILE_APPEND);
file_put_contents($logfile, "\n" . format_log_date() . " spamc:\tSPAM\t" . $msgid . "\t" . $newsgroups . "\t" . $from, FILE_APPEND);
file_put_contents($spamdir . '/' . $msgid, $spamresult);
} else {
file_put_contents($logfile, "\n" . format_log_date() . " clean message: " . $from . " " . $newsgroups . " " . $msgid, FILE_APPEND);
file_put_contents($logfile, "\n" . format_log_date() . " spamc:\tHAM\t" . $msgid . "\t" . $newsgroups . "\t" . $from, FILE_APPEND);
}
return array(
'res' => $res,
@ -1794,7 +1794,7 @@ function get_config_file_value($configfile, $request)
}
}
// This function is specific to user configuration values
// This function is specific to $config_dir configuration values
function get_config_value($configfile, $request)
{
global $config_dir;

View File

@ -395,6 +395,12 @@ function process_post($message, $group)
}
}
}
if ($no_mid == 1) {
$identity = $subject . "," . $from[1] . "," . $ngroups[1] . "," . $references . "," . $body;
$msgid = '<' . md5($identity) . '$1@' . trim($CONFIG['email_tail'], '@') . '>';
} else {
$msgid = $mid[1];
}
/*
* SPAM CHECK
*/
@ -416,7 +422,7 @@ function process_post($message, $group)
$section = get_section_by_group($group);
@mkdir($spooldir . "/" . $section . "/outgoing", 0755, 'recursive');
$postfilename = $spooldir . '/' . $section . '/outgoing/' . $mid[1] . '.msg';
$postfilename = $spooldir . '/' . $section . '/outgoing/' . $msgid . '.msg';
$postfilehandle = fopen($postfilename, 'w');
if ($no_date == 1) {
$article_date = time();
@ -426,11 +432,7 @@ function process_post($message, $group)
$date_rep = $finddate[1];
}
if ($no_mid == 1) {
$identity = $subject . "," . $from[1] . "," . $ngroups[1] . "," . $references . "," . $body;
$msgid = '<' . md5($identity) . '$1@' . trim($CONFIG['email_tail'], '@') . '>';
fputs($postfilehandle, "Message-ID: " . $msgid . "\r\n");
} else {
$msgid = $mid[1];
}
if ($no_org == 1) {
fputs($postfilehandle, "Organization: " . $CONFIG['organization'] . "\r\n");

View File

@ -39,6 +39,7 @@ if (isset($OVERRIDES['save_nocem_messages']) && $OVERRIDES['save_nocem_messages'
$file_groups = $config_path . "groups.txt";
$local_groupfile = $spooldir . "/" . $config_name . "/local_groups.txt";
$logfile = $logdir . '/spoolnews.log';
$spamlog = $logdir . '/spam.log';
# END MAIN CONFIGURATION
@mkdir($spooldir . "/" . $config_name, 0755, 'recursive');
@ -150,7 +151,7 @@ echo "\nSpoolnews Done\n";
function get_articles($ns, $group)
{
global $enable_rslight, $rslight_gpg, $spooldir, $nocem_dir, $save_nocem_messages, $CONFIG, $OVERRIDES, $user_ban_file, $maxarticles_per_run, $maxfirstrequest, $workpath, $path, $remote_groupfile, $local_groupfile, $local, $logdir, $config_name, $logfile;
global $enable_rslight, $rslight_gpg, $spooldir, $nocem_dir, $save_nocem_messages, $CONFIG, $OVERRIDES, $user_ban_file, $maxarticles_per_run, $maxfirstrequest, $workpath, $path, $remote_groupfile, $local_groupfile, $local, $logdir, $config_name, $spamlog, $logfile;
if ($ns == false) {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Lost connection to " . $CONFIG['remote_server'] . ":" . $CONFIG['remote_port'], FILE_APPEND);
@ -158,7 +159,7 @@ function get_articles($ns, $group)
}
$grouppath = $path . preg_replace('/\./', '/', $group);
$banned_names = file($user_ban_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
// $banned_names = file($user_ban_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$msgid_filter = get_config_value('header_filters.conf', 'Message-ID');
$subject_filter = get_config_value('header_filters.conf', 'Subject');
$from_filter = get_config_value('header_filters.conf', 'From');
@ -376,9 +377,10 @@ function get_articles($ns, $group)
$lines = $lines - 1;
$bytes = $bytes + ($lines * 2);
// Don't spool article if $banned != 0
if ($banned != false) {
if ($banned !== false) {
unlink($articleHandle);
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Skipping: " . $CONFIG['remote_server'] . " " . $group . ":" . $article . " banned in " . $banned, FILE_APPEND);
file_put_contents($spamlog, "\n" . format_log_date() . " ".$banned." :\tSPAM\t" . $mid[1] . "\t" . $groupnames[1] . "\t" . $from[1], FILE_APPEND);
// file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Skipping: " . $CONFIG['remote_server'] . " " . $group . ":" . $article . " banned in " . $banned, FILE_APPEND);
$article ++;
} else {
if ((strpos($CONFIG['nocem_groups'], $group) !== false) && ($CONFIG['enable_nocem'] == true)) {