Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit bd04c690 authored by Rob Swindell's avatar Rob Swindell 💬

Make the node.cnf loading optional in load_cfg()

Don't return an error if the node#/node.cnf file can't be opened for all uses of load_cfg() except from the terminal server. This fixes #214 for Tracker1
parent b3814554
Pipeline #1316 failed with stage
in 9 minutes and 44 seconds
......@@ -732,7 +732,7 @@ int main(int argc, char **argv)
fprintf(stderr,"!ERROR changing directory to: %s", scfg.ctrl_dir);
printf("\nLoading configuration files from %s\n",scfg.ctrl_dir);
if(!load_cfg(&scfg,NULL,TRUE,error, sizeof(error))) {
if(!load_cfg(&scfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, error, sizeof(error))) {
fprintf(stderr,"!ERROR loading configuration files: %s\n",error);
exit(1);
}
......
......@@ -131,7 +131,7 @@ void __fastcall TConfigWizard::FormShow(TObject *Sender)
scfg.size=sizeof(scfg);
char error[256];
SAFECOPY(error,UNKNOWN_LOAD_ERROR);
if(!load_cfg(&scfg,NULL,FALSE,error,sizeof(error))) {
if(!load_cfg(&scfg, /* text: */NULL, /* prep: */FALSE, /* node: */FALSE, error, sizeof(error))) {
Application->MessageBox(error,"ERROR Loading Configuration"
,MB_OK|MB_ICONEXCLAMATION);
Close();
......
......@@ -1950,7 +1950,7 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender)
SAFECOPY(error,UNKNOWN_LOAD_ERROR);
StatusBar->Panels->Items[STATUSBAR_LAST_PANEL]->Text="Loading configuration...";
if(!load_cfg(&cfg, NULL, TRUE, error, sizeof(error))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, error, sizeof(error))) {
Application->MessageBox(error,"ERROR Loading Configuration"
,MB_OK|MB_ICONEXCLAMATION);
Application->Terminate();
......@@ -3121,7 +3121,7 @@ void __fastcall TMainForm::reload_config(void)
char error[256];
SAFECOPY(error,UNKNOWN_LOAD_ERROR);
StatusBar->Panels->Items[STATUSBAR_LAST_PANEL]->Text="Reloading configuration...";
if(!load_cfg(&cfg, NULL, TRUE, error, sizeof(error))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, error, sizeof(error))) {
Application->MessageBox(error,"ERROR Re-loading Configuration"
,MB_OK|MB_ICONEXCLAMATION);
Application->Terminate();
......
......@@ -113,7 +113,7 @@ int main(int argc, char **argv)
SAFECOPY(cfg.ctrl_dir, p);
backslash(cfg.ctrl_dir);
load_cfg(&cfg, NULL, TRUE, str, sizeof(str));
load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str));
chdir(cfg.ctrl_dir);
dirnum=libnum=-1;
......
......@@ -111,7 +111,7 @@ int main(int argc,char **argv)
cfg.size=sizeof(cfg);
SAFECOPY(cfg.ctrl_dir,p);
if(!load_cfg(&cfg,NULL,TRUE,str, sizeof(str))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str))) {
fprintf(stderr,"!ERROR loading configuration files: %s\n",str);
return(1);
}
......
......@@ -153,7 +153,7 @@ int main(int argc, char **argv)
fprintf(stderr,"!ERROR changing directory to: %s", scfg.ctrl_dir);
printf("\nLoading configuration files from %s\n",scfg.ctrl_dir);
if(!load_cfg(&scfg,NULL,TRUE,error, sizeof(error))) {
if(!load_cfg(&scfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, error, sizeof(error))) {
fprintf(stderr,"!ERROR loading configuration files: %s\n",error);
exit(1);
}
......
......@@ -5175,7 +5175,7 @@ void DLLCALL ftp_server(void* arg)
lprintf(LOG_INFO,"Loading configuration files from %s", scfg.ctrl_dir);
scfg.size=sizeof(scfg);
SAFECOPY(error,UNKNOWN_LOAD_ERROR);
if(!load_cfg(&scfg, text, TRUE, error, sizeof(error))) {
if(!load_cfg(&scfg, text, /* prep: */TRUE, /* node: */FALSE, error, sizeof(error))) {
lprintf(LOG_CRIT,"!ERROR %s",error);
lprintf(LOG_CRIT,"!Failed to load configuration files");
cleanup(1,__LINE__);
......
......@@ -53,7 +53,7 @@ int chat_open(int node_num, char *ctrl_dir)
memset(&cfg,0,sizeof(cfg));
cfg.size=sizeof(cfg);
SAFECOPY(cfg.ctrl_dir,ctrl_dir);
if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str)))
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str)))
return(-1);
nodenum=node_num;
......
......@@ -76,7 +76,7 @@ void refresh_events(void)
/* Read .cfg files here */
free_cfg(&cfg);
if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str))) {
char error[256];
SAFEPRINTF(error, "ERROR Loading Configuration Files: %s", str);
display_message("Load Error",error,"gtk-dialog-error");
......
......@@ -89,8 +89,8 @@ int refresh_globals(void)
gtk_combo_box_set_active(GTK_COMBO_BOX(cTempQWKFileType), 0);
}
/* Read .cfg files here */
if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
/* Read .cnf files here */
if(!load_cfg(&cfg, /* text */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str))) {
fprintf(stderr,"Cannot load configuration data: %s\n", str);
return(-1);
}
......
......@@ -125,7 +125,7 @@ G_MODULE_EXPORT void update_userlist_callback(GtkWidget *wiggy, gpointer data)
char str[1024];
free_cfg(&cfg);
if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str))) {
char error[256];
SAFEPRINTF(error, "ERROR Loading Configuration Data: %s", str);
display_message("Load Error",error,"gtk-dialog-error");
......
......@@ -39,7 +39,7 @@ int main(int argc, char **argv)
}
cfg.size=sizeof(cfg);
if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str))) {
fprintf(stderr,"Cannot load configuration data (%s)",str);
return(-1);
}
......
......@@ -1407,7 +1407,7 @@ int main(int argc, char **argv, char** env)
fprintf(errfp,"!ERROR changing directory to: %s\n", scfg.ctrl_dir);
fprintf(statfp,"\nLoading configuration files from %s\n",scfg.ctrl_dir);
if(!load_cfg(&scfg,text,TRUE,error, sizeof(error))) {
if(!load_cfg(&scfg, text, /* prep: */TRUE, /* node: */FALSE, error, sizeof(error))) {
fprintf(errfp,"!ERROR loading configuration files: %s\n",error);
return(do_bail(1));
}
......
......@@ -40,7 +40,7 @@ char * readtext(long *line, FILE *stream, long dflt);
/****************************************************************************/
/* Initializes system and node configuration information and data variables */
/****************************************************************************/
BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error, size_t maxerrlen)
BOOL load_cfg(scfg_t* cfg, char* text[], BOOL prep, BOOL req_node, char* error, size_t maxerrlen)
{
int i;
#ifdef SBBS
......@@ -73,7 +73,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error, size_t
SAFECOPY(cfg->node_dir,cfg->node_path[cfg->node_num-1]);
prep_dir(cfg->ctrl_dir, cfg->node_dir, sizeof(cfg->node_dir));
if(read_node_cfg(cfg, error, maxerrlen)==FALSE)
if(read_node_cfg(cfg, error, maxerrlen)==FALSE && req_node)
return(FALSE);
if(read_msgs_cfg(cfg, error, maxerrlen)==FALSE)
return(FALSE);
......
......@@ -29,7 +29,7 @@
extern "C" {
#endif
DLLEXPORT BOOL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error, size_t);
DLLEXPORT BOOL load_cfg(scfg_t* cfg, char* text[], BOOL prep, BOOL req_node, char* error, size_t);
DLLEXPORT void free_cfg(scfg_t* cfg);
DLLEXPORT void free_text(char* text[]);
DLLEXPORT ushort sys_timezone(scfg_t* cfg);
......
......@@ -6088,7 +6088,7 @@ void DLLCALL mail_server(void* arg)
lprintf(LOG_INFO,"Loading configuration files from %s", scfg.ctrl_dir);
scfg.size=sizeof(scfg);
SAFECOPY(error,UNKNOWN_LOAD_ERROR);
if(!load_cfg(&scfg, text, TRUE, error, sizeof(error))) {
if(!load_cfg(&scfg, text, /* prep: */TRUE, /* node: */FALSE, error, sizeof(error))) {
lprintf(LOG_CRIT,"!ERROR %s",error);
lprintf(LOG_CRIT,"!Failed to load configuration files");
cleanup(1);
......
......@@ -5131,7 +5131,7 @@ void DLLCALL bbs_thread(void* arg)
scfg.size=sizeof(scfg);
scfg.node_num=startup->first_node;
SAFECOPY(logstr,UNKNOWN_LOAD_ERROR);
if(!load_cfg(&scfg, text, TRUE, logstr, sizeof(logstr))) {
if(!load_cfg(&scfg, text, /* prep: */TRUE, /* node_req: */TRUE, logstr, sizeof(logstr))) {
lprintf(LOG_CRIT,"!ERROR %s",logstr);
lprintf(LOG_CRIT,"!FAILED to load configuration files");
cleanup(1);
......@@ -5744,10 +5744,10 @@ NO_SSH:
SAFECOPY(cfg->ctrl_dir, startup->ctrl_dir);
lprintf(LOG_INFO,"Node %d Loading configuration files from %s", cfg->node_num, cfg->ctrl_dir);
SAFECOPY(logstr,UNKNOWN_LOAD_ERROR);
if(!load_cfg(cfg, node_text[i - 1], TRUE, logstr, sizeof(logstr))) {
if(!load_cfg(cfg, node_text[i - 1], /* prep: */TRUE, /* node_req: */TRUE, logstr, sizeof(logstr))) {
lprintf(LOG_WARNING, "Node %d LOAD ERROR: %s, falling back to Node %d", cfg->node_num, logstr, first_node);
cfg->node_num = first_node;
if(!load_cfg(cfg, node_text[i - 1], TRUE, logstr, sizeof(logstr))) {
if(!load_cfg(cfg, node_text[i - 1], /* prep: */TRUE, /* node: */TRUE, logstr, sizeof(logstr))) {
lprintf(LOG_CRIT,"!ERROR %s",logstr);
lprintf(LOG_CRIT,"!FAILED to load configuration files");
sbbs->bprintf("\r\nFAILED: %s", logstr);
......
......@@ -103,7 +103,7 @@ int main(int argc, char **argv)
fprintf(stderr,"!ERROR changing directory to: %s", scfg.ctrl_dir);
printf("\nLoading configuration files from %s\n",scfg.ctrl_dir);
if(!load_cfg(&scfg,NULL,TRUE,error, sizeof(error))) {
if(!load_cfg(&scfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, error, sizeof(error))) {
fprintf(stderr,"!ERROR loading configuration files: %s\n",error);
exit(1);
}
......
......@@ -244,7 +244,7 @@ int main(int argc, char **argv)
cfg.size=sizeof(cfg);
SAFECOPY(cfg.ctrl_dir, get_ctrl_dir(/* warn: */TRUE));
if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str))) {
printf("\7\n%s\n",str);
}
......
......@@ -1914,7 +1914,7 @@ int main(int argc, char** argv)
scfg.size=sizeof(scfg);
SAFECOPY(error,UNKNOWN_LOAD_ERROR);
lprintf(LOG_INFO,"Loading configuration files from %s", scfg.ctrl_dir);
if(!load_cfg(&scfg, NULL /* text.dat */, TRUE /* prep */, error, sizeof(error))) {
if(!load_cfg(&scfg, /* text: */ NULL, /* prep: */ TRUE, /* node: */ FALSE, error, sizeof(error))) {
lprintf(LOG_ERR,"!ERROR Loading Configuration Files: %s", error);
return(-1);
}
......
......@@ -6259,7 +6259,7 @@ int main(int argc, char **argv)
printf("\nLoading configuration files from %s\n", scfg.ctrl_dir);
scfg.size=sizeof(scfg);
SAFECOPY(str,UNKNOWN_LOAD_ERROR);
if(!load_cfg(&scfg, NULL, true, str, sizeof(str))) {
if(!load_cfg(&scfg, /* text: */NULL, /* prep: */true, /* node: */false, str, sizeof(str))) {
fprintf(stderr,"!ERROR %s\n",str);
fprintf(stderr,"!Failed to load configuration files\n");
bail(1);
......
......@@ -1805,7 +1805,7 @@ void DLLCALL services_thread(void* arg)
lprintf(LOG_INFO,"Loading configuration files from %s", scfg.ctrl_dir);
scfg.size=sizeof(scfg);
SAFECOPY(error,UNKNOWN_LOAD_ERROR);
if(!load_cfg(&scfg, text, TRUE, error, sizeof(error))) {
if(!load_cfg(&scfg, text, /* prep: */TRUE, /* node: */FALSE, error, sizeof(error))) {
lprintf(LOG_CRIT,"!ERROR %s",error);
lprintf(LOG_CRIT,"!Failed to load configuration files");
cleanup(1);
......
......@@ -109,7 +109,7 @@ int main(int argc, char **argv)
cfg.size=sizeof(cfg);
SAFECOPY(cfg.ctrl_dir,p);
if(!load_cfg(&cfg,NULL,TRUE,str, sizeof(str))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str))) {
fprintf(stderr,"!ERROR loading configuration files: %s\n",str);
return(1);
}
......
/* Synchronet for *nix user editor */
/* $Id: uedit.c,v 1.65 2020/08/17 00:48:48 rswindell Exp $ */
// vi: tabstop=4
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -16,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -1945,7 +1930,7 @@ int main(int argc, char** argv) {
memset(&cfg,0,sizeof(cfg));
cfg.size=sizeof(cfg);
SAFECOPY(cfg.ctrl_dir,bbs_startup.ctrl_dir);
if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str))) {
printf("ERROR! %s\n",str);
exit(1);
}
......
/* Synchronet for *nix node activity monitor */
/* $Id: umonitor.c,v 1.99 2020/08/17 00:48:52 rswindell Exp $ */
// vi: tabstop=4
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -16,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -892,7 +877,7 @@ int main(int argc, char** argv) {
memset(&cfg,0,sizeof(cfg));
cfg.size=sizeof(cfg);
SAFECOPY(cfg.ctrl_dir,bbs_startup.ctrl_dir);
if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, str, sizeof(str))) {
printf("ERROR! %s\n",str);
exit(1);
}
......
......@@ -46,7 +46,7 @@ bool SBBS_User_ListApp::OnInit()
dlg->ShowModal();
return false;
}
if(!load_cfg(&cfg, NULL, TRUE, errstr)) {
if(!load_cfg(&cfg, /* text: */NULL, /* prep: */TRUE, /* node: */FALSE, errstr, sizeof(errstr))) {
wxString str(errstr,wxConvUTF8);
wxMessageDialog *dlg = new wxMessageDialog(NULL, _("ERROR: \"")+str+_("\"loading config"), _("Config Error"));
dlg->ShowModal();
......
......@@ -7005,7 +7005,7 @@ void DLLCALL web_server(void* arg)
lprintf(LOG_INFO,"Loading configuration files from %s", scfg.ctrl_dir);
scfg.size=sizeof(scfg);
SAFECOPY(logstr,UNKNOWN_LOAD_ERROR);
if(!load_cfg(&scfg, text, TRUE, logstr, sizeof(logstr))) {
if(!load_cfg(&scfg, text, /* prep: */TRUE, /* node: */FALSE, logstr, sizeof(logstr))) {
lprintf(LOG_CRIT,"!ERROR %s",logstr);
lprintf(LOG_CRIT,"!FAILED to load configuration files");
cleanup(1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment