From a752d6537da6b754e0d7b1dabf268a395561e33a Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Mon, 27 May 2024 05:57:59 -0700 Subject: [PATCH] Improve handling for multiline Newsgroups header. --- Rocksolid_Light/rslight/scripts/rslight-lib.php | 6 ++++++ Rocksolid_Light/rslight/scripts/spoolnews.php | 8 ++++++++ Rocksolid_Light/version.txt | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Rocksolid_Light/rslight/scripts/rslight-lib.php b/Rocksolid_Light/rslight/scripts/rslight-lib.php index d33442d..3329c57 100644 --- a/Rocksolid_Light/rslight/scripts/rslight-lib.php +++ b/Rocksolid_Light/rslight/scripts/rslight-lib.php @@ -356,6 +356,7 @@ function process_post($message, $group) $body = ""; $ref = 0; $sub = 0; + $ng = 0; $response = ""; $bytes = 0; $lines = 0; @@ -372,6 +373,7 @@ function process_post($message, $group) if (strpos($line, ': ') !== false) { $ref = 0; $sub = 0; + $ng = 0; } if (stripos($line, "Path: ") === 0) { $response = "441 Posting failed (Header preloading denied)\r\n"; @@ -403,12 +405,16 @@ function process_post($message, $group) if (stripos($line, "Newsgroups: ") === 0) { $ngroups = explode(': ', $line); $newsgroups = $ngroups[1]; + $ng = 1; } if (stripos($line, "References: ") === 0) { $references_line = explode(': ', $line); $references = $references_line[1]; $ref = 1; } + if (preg_match('/^\s/', $line) && $ng == 1) { + $newsgroups .= $newsgroups; + } if (preg_match('/^\s/', $line) && $ref == 1) { $references = $references . $line; } diff --git a/Rocksolid_Light/rslight/scripts/spoolnews.php b/Rocksolid_Light/rslight/scripts/spoolnews.php index 8fccc26..71bfe66 100644 --- a/Rocksolid_Light/rslight/scripts/spoolnews.php +++ b/Rocksolid_Light/rslight/scripts/spoolnews.php @@ -292,6 +292,7 @@ function get_articles($ns, $group) $bytes = 0; $ref = 0; $sub = 0; + $ng = 0; $banned = false; $integrity = false; $is_header = 1; @@ -312,6 +313,7 @@ function get_articles($ns, $group) if (strpos($response, ': ') !== false) { $ref = 0; $sub = 0; + $ng = 0; } // Find article date if (stripos($response, "Date: ") === 0) { @@ -372,6 +374,7 @@ function get_articles($ns, $group) $current_article['xref'] .= ' ' . $agroup . ':' . $artnum; } } + $ng = 1; } if (stripos($response, "Xref: ") === 0) { if (isset($CONFIG['enable_nntp']) && $CONFIG['enable_nntp'] == true) { @@ -388,6 +391,11 @@ function get_articles($ns, $group) $references = $this_references[1]; $ref = 1; } + if (preg_match('/^\s/', $response) && $ng == 1) { + $addgroups = preg_split("/\ |\,/", trim($response)); + $allgroups = array_merge($allgroups, $addgroups); + } + if (preg_match('/^\s/', $response) && $ref == 1) { $references = $references . $response; } diff --git a/Rocksolid_Light/version.txt b/Rocksolid_Light/version.txt index 91bd098..28620ec 100644 --- a/Rocksolid_Light/version.txt +++ b/Rocksolid_Light/version.txt @@ -1 +1 @@ -0.9.87 +0.9.875