Fix auth for Synchronet servers after config changes

This commit is contained in:
Retro_Guy 2020-12-04 21:46:12 -07:00
parent dac0ef26b7
commit 4cbf15ab90
2 changed files with 11 additions and 3 deletions

View File

@ -42,12 +42,16 @@ $CONFIG = include($config_file);
*/
function nntp_open($nserver=0,$nport=0) {
global $text_error,$CONFIG;
global $server,$port;
global $server,$port,$synchro_user,$synchro_pass;
// echo "<br>NNTP OPEN<br>";
if(!isset($CONFIG['enable_nntp']) || $CONFIG['enable_nntp'] != true) {
$CONFIG['server_auth_user'] = $CONFIG['remote_auth_user'];
$CONFIG['server_auth_pass'] = $CONFIG['remote_auth_pass'];
}
if(isset($synchro_user)) {
$CONFIG['server_auth_user'] = $synchro_user;
$CONFIG['server_auth_pass'] = $synchro_pass;
}
$authorize=((isset($CONFIG['server_auth_user'])) && (isset($CONFIG['server_auth_pass'])) &&
($CONFIG['server_auth_user'] != ""));
if ($nserver==0) $nserver=$server;
@ -83,6 +87,8 @@ function nntp_open($nserver=0,$nport=0) {
}
}
if ($ns==false) echo "<p>".$text_error["connection_failed"]."</p>";
unset($synchro_user);
unset($synchro_pass);
return $ns;
}

View File

@ -59,6 +59,8 @@ if ((isset($post_port)) && ($post_port!=""))
include "head.inc";
include $file_newsportal;
global $synchro_user,$synchro_pass;
// check to which groups the user is allowed to post to
$thisgroup=_rawurldecode($_REQUEST['group']);
if($testgroup) {
@ -109,8 +111,8 @@ if(!strcmp($name, $CONFIG['anonusername']) && (isset($CONFIG['anonuser']))) {
}
if (isset($CONFIG['synchronet']) && ($CONFIG['synchronet'] == true)) {
$CONFIG['server_auth_user']=$name;
$CONFIG['server_auth_pass']=$userpass;
$synchro_user=$name;
$synchro_pass=$userpass;
}
if($name=="")