Add ability to require auth for all commands to nntp server. Enable in overrides.inc.php.

This commit is contained in:
Retro_Guy 2024-03-11 03:15:30 -07:00
parent df0adaf253
commit 2ae7f672c2
2 changed files with 22 additions and 1 deletions

View File

@ -19,6 +19,9 @@ return [
// Log posts?
'enable_post_log' => false,
// Require authentication for all commands to nntp server
'nntp_full_auth_required' => false,
// Disable name/email spoof option in Configuration
'disable_change_name' => false,

View File

@ -2,11 +2,17 @@
function interact($msgsock, $use_crypto = false)
{
global $CONFIG, $logdir, $lockdir, $logfile, $installed_path, $config_path, $config_dir, $groupconfig, $workpath, $path, $spooldir, $nntp_group, $nntp_article, $auth_ok, $user, $pass;
global $CONFIG, $OVERRIDES, $logdir, $lockdir, $logfile, $installed_path, $config_path, $config_dir, $groupconfig, $workpath, $path, $spooldir, $nntp_group, $nntp_article, $auth_ok, $user, $pass;
$workpath = $spooldir . "/";
$path = $workpath . "articles/";
$groupconfig = $spooldir . "/spoolnews/groups.txt";
if(isset($OVERRIDES['nntp_full_auth_required']) && $OVERRIDES['nntp_full_auth_required'] == true) {
$nntp_full_auth_required = true;
} else {
$nntp_full_auth_required = false;
}
$logfile = $logdir . '/nntp.log';
$nntp_group = "";
$nntp_article = "";
@ -49,6 +55,18 @@ function interact($msgsock, $use_crypto = false)
}
$command = explode(' ', $buf);
$command[0] = strtolower($command[0]);
// Check if auth required for everything or only posting
if($nntp_full_auth_required == true && $auth_ok == 0) {
if($command[0] == 'authinfo' || $command[0] == 'quit' || $command[0] == 'mode') {
// Ok to continue
} else {
// Auth is required. Try again
$msg = "480 Authentication Required\r\n";
fwrite($msgsock, $msg, strlen($msg));
continue;
}
}
if (isset($command[1])) {}
if ($command[0] == 'date') {
$msg = '111 ' . date('YmdHis') . "\r\n";