Clean up eols in xover output and add 'open_clients' config option
This commit is contained in:
parent
e790a1295b
commit
aef9df41a8
|
@ -42,6 +42,7 @@ return [
|
||||||
'expire_days' => '0',
|
'expire_days' => '0',
|
||||||
'pathhost' => 'unconfigured',
|
'pathhost' => 'unconfigured',
|
||||||
'article_database' => '1',
|
'article_database' => '1',
|
||||||
|
'open_clients' => ''
|
||||||
'thissitekey' => '<site_key>'
|
'thissitekey' => '<site_key>'
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -19,10 +19,8 @@
|
||||||
if(($ok_group[0] == ':') || (trim($ok_group) == "")) {
|
if(($ok_group[0] == ':') || (trim($ok_group) == "")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(strpos($ok_group, "\t") == false) {
|
$ok_group = preg_split("/( |\t)/", trim($ok_group), 2);
|
||||||
$ok_group=preg_replace('/ /', "\t", $ok_group, 1);
|
fputs($fp1, $ok_group[0]."\r\n");
|
||||||
}
|
|
||||||
fputs($fp1, $ok_group);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,11 @@
|
||||||
$cryptoSetup = stream_socket_enable_crypto($msgsock, TRUE, STREAM_CRYPTO_METHOD_TLSv1_0_SERVER | STREAM_CRYPTO_METHOD_TLSv1_1_SERVER | STREAM_CRYPTO_METHOD_TLSv1_2_SERVER);
|
$cryptoSetup = stream_socket_enable_crypto($msgsock, TRUE, STREAM_CRYPTO_METHOD_TLSv1_0_SERVER | STREAM_CRYPTO_METHOD_TLSv1_1_SERVER | STREAM_CRYPTO_METHOD_TLSv1_2_SERVER);
|
||||||
}
|
}
|
||||||
stream_set_timeout($msgsock, 300);
|
stream_set_timeout($msgsock, 300);
|
||||||
|
$client = stream_socket_get_name($msgsock, 1);
|
||||||
|
$client_ip = explode(':', $client);
|
||||||
|
if(strpos($CONFIG['open_clients'], $client_ip[0]) !== false) {
|
||||||
|
$auth_ok = 1;
|
||||||
|
}
|
||||||
/* Send instructions. */
|
/* Send instructions. */
|
||||||
$msg = "200 Rocksolid Light NNTP Server ready (no posting)\r\n";
|
$msg = "200 Rocksolid Light NNTP Server ready (no posting)\r\n";
|
||||||
fwrite($msgsock, $msg, strlen($msg));
|
fwrite($msgsock, $msg, strlen($msg));
|
||||||
|
@ -35,7 +40,7 @@ set_time_limit(0);
|
||||||
if(stripos($buf, 'AUTHINFO PASS') !== false) {
|
if(stripos($buf, 'AUTHINFO PASS') !== false) {
|
||||||
file_put_contents($logfile, "\n".format_log_date()." AUTHINFO PASS (hidden)", FILE_APPEND);
|
file_put_contents($logfile, "\n".format_log_date()." AUTHINFO PASS (hidden)", FILE_APPEND);
|
||||||
} else {
|
} else {
|
||||||
file_put_contents($logfile, "\n".format_log_date()." ".$buf, FILE_APPEND);
|
file_put_contents($logfile, "\n".format_log_date()." ".$client." ".$buf, FILE_APPEND);
|
||||||
}
|
}
|
||||||
$command = explode(' ', $buf);
|
$command = explode(' ', $buf);
|
||||||
$command[0] = strtolower($command[0]);
|
$command[0] = strtolower($command[0]);
|
||||||
|
@ -563,7 +568,8 @@ function get_xover($articles, $msgsock) {
|
||||||
$article=preg_split("/[\s,]+/", $overviewline);
|
$article=preg_split("/[\s,]+/", $overviewline);
|
||||||
for($i=$first; $i<=$last; $i++) {
|
for($i=$first; $i<=$last; $i++) {
|
||||||
if($article[0] === strval($i)) {
|
if($article[0] === strval($i)) {
|
||||||
fwrite($msgsock, $overviewline."\r\n", strlen($overviewline));
|
$overviewline = trim($overviewline)."\r\n";
|
||||||
|
fwrite($msgsock, $overviewline, strlen($overviewline));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -934,7 +940,7 @@ function get_list($mode) {
|
||||||
$name = preg_split("/( |\t)/", $findgroup, 2);
|
$name = preg_split("/( |\t)/", $findgroup, 2);
|
||||||
if($name[0][0] === ':')
|
if($name[0][0] === ':')
|
||||||
continue;
|
continue;
|
||||||
$ok_article = get_article_list($nntp_group);
|
$ok_article = get_article_list($findgroup);
|
||||||
sort($ok_article);
|
sort($ok_article);
|
||||||
$last = $ok_article[key(array_slice($ok_article, -1, 1, true))];
|
$last = $ok_article[key(array_slice($ok_article, -1, 1, true))];
|
||||||
$first = $ok_article[0];
|
$first = $ok_article[0];
|
||||||
|
|
|
@ -57,6 +57,7 @@ return [
|
||||||
'nocem_groups' => 'The list of groups to monitor for nocem messages (space separated)',
|
'nocem_groups' => 'The list of groups to monitor for nocem messages (space separated)',
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
|
'open_clients' => 'Space separated list of ip addresses of clients allowed to post without authenticating',
|
||||||
'article_database' => 'Enable storing articles in database files (1=database, blank=tradspool)',
|
'article_database' => 'Enable storing articles in database files (1=database, blank=tradspool)',
|
||||||
'expire_days' => 'Posts should be expired after how many days (zero for never)',
|
'expire_days' => 'Posts should be expired after how many days (zero for never)',
|
||||||
'pathhost' => 'The pathhost to use in your XRef header. (maybe a one word name for your site)',
|
'pathhost' => 'The pathhost to use in your XRef header. (maybe a one word name for your site)',
|
||||||
|
|
Loading…
Reference in New Issue