From 77bd6cd640c36be4e709bab2f1cdce310c1db321 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Fri, 16 Aug 2024 02:54:00 -0700 Subject: [PATCH 01/11] Increment version to 0.9.142 --- Rocksolid_Light/common/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rocksolid_Light/common/version.txt b/Rocksolid_Light/common/version.txt index b8a1bd1..1a02c2d 100644 --- a/Rocksolid_Light/common/version.txt +++ b/Rocksolid_Light/common/version.txt @@ -1 +1 @@ -0.9.141 +0.9.142 From 8ebf69f76651bc2f78aae8e8f5b48327e26774fa Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sat, 17 Aug 2024 10:12:49 -0700 Subject: [PATCH 02/11] Add nntp.restart semaphore and fix issue with nntp.disable. --- Rocksolid_Light/rslight/scripts/nntp-ssl.php | 9 ++++++++- Rocksolid_Light/rslight/scripts/nntp.php | 11 ++++++++++- Rocksolid_Light/rslight/scripts/rslight-lib.php | 5 ----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Rocksolid_Light/rslight/scripts/nntp-ssl.php b/Rocksolid_Light/rslight/scripts/nntp-ssl.php index 02ac674..687625b 100755 --- a/Rocksolid_Light/rslight/scripts/nntp-ssl.php +++ b/Rocksolid_Light/rslight/scripts/nntp-ssl.php @@ -2,12 +2,19 @@ include "config.inc.php"; include ("$file_newsportal"); include $config_dir . "/scripts/rslight-lib.php"; + $lockfile = $lockdir . '/rslight-nntp-ssl.lock'; if (file_exists($config_dir . "/nntp.disable")) { clearstatcache(true, $config_dir . "/nntp.disable"); - $parent_pid = file_get_contents($lockdir . '/rslight-nntp.lock', IGNORE_NEW_LINES); + $parent_pid = file_get_contents($lockfile); posix_kill($parent_pid, SIGTERM); exit(); } + if (file_exists($config_dir . "/nntp.restart")) { + clearstatcache(true, $config_dir . "/nntp.restart"); + $parent_pid = file_get_contents($lockfile); + posix_kill($parent_pid, SIGTERM); + unlink($config_dir . "/nntp.restart"); + } /** * Listens for requests and forks on each connection */ diff --git a/Rocksolid_Light/rslight/scripts/nntp.php b/Rocksolid_Light/rslight/scripts/nntp.php index 012b180..13a2947 100755 --- a/Rocksolid_Light/rslight/scripts/nntp.php +++ b/Rocksolid_Light/rslight/scripts/nntp.php @@ -2,12 +2,21 @@ include "config.inc.php"; include ("$file_newsportal"); include $config_dir . "/scripts/rslight-lib.php"; + $lockfile = $lockdir . '/rslight-nntp.lock'; if (file_exists($config_dir . "/nntp.disable")) { clearstatcache(true, $config_dir . "/nntp.disable"); - $parent_pid = file_get_contents($lockdir . '/rslight-nntp.lock', IGNORE_NEW_LINES); + $parent_pid = file_get_contents($lockfile); posix_kill($parent_pid, SIGTERM); exit(); } + if (file_exists($config_dir . "/nntp.restart")) { + clearstatcache(true, $config_dir . "/nntp.restart"); + $parent_pid = file_get_contents($lockfile); + posix_kill($parent_pid, SIGTERM); + if (!is_numeric($CONFIG['local_ssl_port'])) { + unlink($config_dir . "/nntp.restart"); + } + } /** * Listens for requests and forks on each connection */ diff --git a/Rocksolid_Light/rslight/scripts/rslight-lib.php b/Rocksolid_Light/rslight/scripts/rslight-lib.php index cd36e60..451ccac 100644 --- a/Rocksolid_Light/rslight/scripts/rslight-lib.php +++ b/Rocksolid_Light/rslight/scripts/rslight-lib.php @@ -34,11 +34,6 @@ function interact($msgsock, $use_crypto = false) $msg = ""; set_time_limit(30); $buf = fgets($msgsock, 2048); - if (file_exists($config_dir . "/nntp.disable")) { - $parent_pid = file_get_contents($lockdir . '/rslight-nntp.lock', IGNORE_NEW_LINES); - posix_kill($parent_pid, SIGTERM); - exit(); - } if ($buf === false) { // file_put_contents($logfile, "\n".format_log_date()." socket read failed: reason: " . socket_strerror(socket_last_error($msgsock)), FILE_APPEND); break; From 095b757bc59a3e748cdb4e4bd4b58f8bb27f5a0b Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 18 Aug 2024 01:44:14 -0700 Subject: [PATCH 03/11] Use nntp.reload instead of nntp.restart for congruentia. --- Rocksolid_Light/rslight/scripts/nntp-ssl.php | 9 ++++----- Rocksolid_Light/rslight/scripts/nntp.php | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Rocksolid_Light/rslight/scripts/nntp-ssl.php b/Rocksolid_Light/rslight/scripts/nntp-ssl.php index 687625b..5efa2f4 100755 --- a/Rocksolid_Light/rslight/scripts/nntp-ssl.php +++ b/Rocksolid_Light/rslight/scripts/nntp-ssl.php @@ -9,11 +9,11 @@ posix_kill($parent_pid, SIGTERM); exit(); } - if (file_exists($config_dir . "/nntp.restart")) { - clearstatcache(true, $config_dir . "/nntp.restart"); + if (file_exists($config_dir . "/nntp.reload")) { + clearstatcache(true, $config_dir . "/nntp.reload"); $parent_pid = file_get_contents($lockfile); posix_kill($parent_pid, SIGTERM); - unlink($config_dir . "/nntp.restart"); + unlink($config_dir . "/nntp.reload"); } /** * Listens for requests and forks on each connection @@ -49,9 +49,8 @@ function server_loop($address, $port) { GLOBAL $__server_listening; - GLOBAL $CONFIG, $logdir, $lockdir, $webserver_uid, $webserver_gid, $installed_path, $config_path, $groupconfig, $workpath, $path, $spooldir, $ssldir, $nntp_group, $auth_ok; + GLOBAL $CONFIG, $logdir, $lockfile, $webserver_uid, $webserver_gid, $installed_path, $config_path, $groupconfig, $workpath, $path, $spooldir, $ssldir, $nntp_group, $auth_ok; $logfile = $logdir . '/nntp.log'; - $lockfile = $lockdir . '/rslight-nntp-ssl.lock'; $pid = file_get_contents($lockfile); if (posix_getsid($pid) === false || ! is_file($lockfile)) { print "Starting Rocksolid Light NNTP Server...\n"; diff --git a/Rocksolid_Light/rslight/scripts/nntp.php b/Rocksolid_Light/rslight/scripts/nntp.php index 13a2947..11e7854 100755 --- a/Rocksolid_Light/rslight/scripts/nntp.php +++ b/Rocksolid_Light/rslight/scripts/nntp.php @@ -51,9 +51,8 @@ function server_loop($address, $port) { GLOBAL $__server_listening; - GLOBAL $CONFIG, $logdir, $lockdir, $webserver_uid, $webserver_gid, $installed_path, $config_path, $groupconfig, $workpath, $path, $spooldir, $nntp_group, $auth_ok; + GLOBAL $CONFIG, $logdir, $lockfile, $webserver_uid, $webserver_gid, $installed_path, $config_path, $groupconfig, $workpath, $path, $spooldir, $nntp_group, $auth_ok; $logfile = $logdir . '/nntp.log'; - $lockfile = $lockdir . '/rslight-nntp.lock'; $pid = file_get_contents($lockfile); if (posix_getsid($pid) === false || ! is_file($lockfile)) { print "Starting Rocksolid Light NNTP Server...\n"; From 3c397371c04c339a5bebb71633b35afdff597e66 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Tue, 20 Aug 2024 04:47:55 -0700 Subject: [PATCH 04/11] Change nntp.restart to nntp.reload in nntp.php. --- Rocksolid_Light/rslight/scripts/nntp.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Rocksolid_Light/rslight/scripts/nntp.php b/Rocksolid_Light/rslight/scripts/nntp.php index 11e7854..957b3e8 100755 --- a/Rocksolid_Light/rslight/scripts/nntp.php +++ b/Rocksolid_Light/rslight/scripts/nntp.php @@ -9,12 +9,12 @@ posix_kill($parent_pid, SIGTERM); exit(); } - if (file_exists($config_dir . "/nntp.restart")) { - clearstatcache(true, $config_dir . "/nntp.restart"); + if (file_exists($config_dir . "/nntp.reload")) { + clearstatcache(true, $config_dir . "/nntp.reload"); $parent_pid = file_get_contents($lockfile); posix_kill($parent_pid, SIGTERM); if (!is_numeric($CONFIG['local_ssl_port'])) { - unlink($config_dir . "/nntp.restart"); + unlink($config_dir . "/nntp.reload"); } } /** From 2c303650adbb6e72381c372b26028eaf86e6f7b2 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Tue, 20 Aug 2024 04:48:32 -0700 Subject: [PATCH 05/11] Display comment above article if references header is missing. --- Rocksolid_Light/rocksolid/lib/message.inc.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Rocksolid_Light/rocksolid/lib/message.inc.php b/Rocksolid_Light/rocksolid/lib/message.inc.php index f724717..9574d7d 100644 --- a/Rocksolid_Light/rocksolid/lib/message.inc.php +++ b/Rocksolid_Light/rocksolid/lib/message.inc.php @@ -808,6 +808,7 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl $local_poster = true; } $body = $article_data->body[$attachment]; + $notice = false; if ($head) { // User blocklist if ($userdata = get_user_mail_auth_data($_COOKIE['mail_name'])) { @@ -837,6 +838,11 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl return "no-archive"; } + if(stripos($head->subject, "Re: ") === 0) { + if(!isset($head->references)) { + $notice = '

(article missing references header)


'; + } + } if(isset($head->content_type[0])) { if(!strpos($head->content_type[0], "/")) { echo '

(message #' . $head->number . ' not displayed - malformed header)


'; @@ -845,6 +851,7 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl } if (($head->content_type[$attachment] == "text/plain") && ($attachment == 0)) { show_header($head, $group, $local_poster); + echo $notice; // X-Face if (($face = display_full_headers($head->number, $group, $head->name, $head->from, true)) && ($OVERRIDES['disable_xface'] != true)) { $pngfile = '../tmp/face-' . hash('ripemd160', $face); From a6249e50bcc3ea4cfc800fb8baf1470dfd671bb8 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Tue, 20 Aug 2024 05:11:12 -0700 Subject: [PATCH 06/11] Place article header checks (for display) in function in message.inc.php. --- Rocksolid_Light/rocksolid/lib/message.inc.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Rocksolid_Light/rocksolid/lib/message.inc.php b/Rocksolid_Light/rocksolid/lib/message.inc.php index 9574d7d..d347df2 100644 --- a/Rocksolid_Light/rocksolid/lib/message.inc.php +++ b/Rocksolid_Light/rocksolid/lib/message.inc.php @@ -808,7 +808,6 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl $local_poster = true; } $body = $article_data->body[$attachment]; - $notice = false; if ($head) { // User blocklist if ($userdata = get_user_mail_auth_data($_COOKIE['mail_name'])) { @@ -838,11 +837,9 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl return "no-archive"; } - if(stripos($head->subject, "Re: ") === 0) { - if(!isset($head->references)) { - $notice = '

(article missing references header)


'; - } - } + // Any header checks to display notice in article display + $notice = display_header_notice($head); + if(isset($head->content_type[0])) { if(!strpos($head->content_type[0], "/")) { echo '

(message #' . $head->number . ' not displayed - malformed header)


'; @@ -1048,4 +1045,14 @@ function articleflat_pageselect($group, $id, $article_count, $first) $return .= ''; } return $return; +} + +function display_header_notice($head) { + $notice = false; + if(stripos($head->subject, "Re: ") === 0) { + if(!isset($head->references)) { + $notice = '

(article missing references header)


'; + } + } + return $notice; } \ No newline at end of file From 1f3ab5e3a6fb262d832a020aa9895f0d402d6f63 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Tue, 20 Aug 2024 05:46:24 -0700 Subject: [PATCH 07/11] Set displayed link for copy mid/link to reduce confusion. --- Rocksolid_Light/rocksolid/lib/message.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rocksolid_Light/rocksolid/lib/message.inc.php b/Rocksolid_Light/rocksolid/lib/message.inc.php index d347df2..5388be0 100644 --- a/Rocksolid_Light/rocksolid/lib/message.inc.php +++ b/Rocksolid_Light/rocksolid/lib/message.inc.php @@ -563,7 +563,7 @@ function show_header_short($head, $group, $local_poster = false)

id); ?>

  -copy mid @@ -571,7 +571,7 @@ function show_header_short($head, $group, $local_poster = false)

number . '&group=' . urlencode($group) . '#' . $head->number; ?>

  -copy link From 02c1733392a7ba375eb8f74eab2cb9bbc24f5add Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sat, 24 Aug 2024 12:26:29 -0700 Subject: [PATCH 08/11] Remove tmp files after successful posting. --- Rocksolid_Light/rslight/scripts/rslight-lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Rocksolid_Light/rslight/scripts/rslight-lib.php b/Rocksolid_Light/rslight/scripts/rslight-lib.php index 451ccac..3101b6f 100644 --- a/Rocksolid_Light/rslight/scripts/rslight-lib.php +++ b/Rocksolid_Light/rslight/scripts/rslight-lib.php @@ -1245,6 +1245,7 @@ function insert_article($section, $nntp_group, $filename, $subject_i, $from_i, $ } else { $this_snippet = get_search_snippet($body); } + unlink($tmp_file); } else { rename($tmp_file, $tradspool_out_file); } From c82e01062a56908ff27e29ba60c2c1923aed9f99 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 25 Aug 2024 13:33:05 -0700 Subject: [PATCH 09/11] Fix bug in snippets sometimes not converting charset properly. --- Rocksolid_Light/rocksolid/newsportal.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index c46ace3..dc41c7c 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -1826,7 +1826,8 @@ function get_search_snippet($body, $content_type = '', $content_transfer_encodin $body = quoted_printable_decode($body); } if ($content_type !== '') { - $mysnippet = recode_charset($body, $content_type, "utf8"); + $content_type = explode(';', $content_type); + $mysnippet = recode_charset($body, $content_type[0]); } else { $mysnippet = $body; } From 031181c2537479a4e1ea81780b4babae2194a33f Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 25 Aug 2024 13:33:22 -0700 Subject: [PATCH 10/11] Remove spinning wheel while loading page. --- Rocksolid_Light/common/header.php | 42 +------------------------------ 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/Rocksolid_Light/common/header.php b/Rocksolid_Light/common/header.php index 2fdb872..de4174e 100644 --- a/Rocksolid_Light/common/header.php +++ b/Rocksolid_Light/common/header.php @@ -8,34 +8,6 @@ if (basename(getcwd()) == 'mods') { include ($rootdir . 'common/config.inc.php'); $CONFIG = include $config_file; -?> - - - -'; -echo '
'; -?> - +?> From 75546cdb7829efab18f2d3c4d7e6fcd8962b2a60 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 25 Aug 2024 13:41:28 -0700 Subject: [PATCH 11/11] Add short delay when using nntp.reload to allow port to be released before trying to bind again. --- Rocksolid_Light/rslight/scripts/nntp-ssl.php | 2 ++ Rocksolid_Light/rslight/scripts/nntp.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Rocksolid_Light/rslight/scripts/nntp-ssl.php b/Rocksolid_Light/rslight/scripts/nntp-ssl.php index 5efa2f4..2407f9e 100755 --- a/Rocksolid_Light/rslight/scripts/nntp-ssl.php +++ b/Rocksolid_Light/rslight/scripts/nntp-ssl.php @@ -14,6 +14,8 @@ $parent_pid = file_get_contents($lockfile); posix_kill($parent_pid, SIGTERM); unlink($config_dir . "/nntp.reload"); + unlink($lockfile); + sleep(5); } /** * Listens for requests and forks on each connection diff --git a/Rocksolid_Light/rslight/scripts/nntp.php b/Rocksolid_Light/rslight/scripts/nntp.php index 957b3e8..2d8ef5f 100755 --- a/Rocksolid_Light/rslight/scripts/nntp.php +++ b/Rocksolid_Light/rslight/scripts/nntp.php @@ -16,6 +16,8 @@ if (!is_numeric($CONFIG['local_ssl_port'])) { unlink($config_dir . "/nntp.reload"); } + unlink($lockfile); + sleep(5); } /** * Listens for requests and forks on each connection