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 2b61e79e authored by rswindell's avatar rswindell

Give all the things that can execute JS, access to the text.dat strings via the

(new) scfg_t.text member. This will make it much easier for non-Terminal Server
JS modules (and the functions they execute) make use of the text.dat strings.
parent c1cf7bc8
......@@ -67,6 +67,7 @@ JSContext* js_cx;
JSObject* js_glob;
js_callback_t cb;
scfg_t scfg;
char* text[TOTAL_TEXT];
ulong js_max_bytes=JAVASCRIPT_MAX_BYTES;
ulong js_cx_stack=JAVASCRIPT_CONTEXT_STACK;
FILE* confp;
......@@ -1391,7 +1392,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,NULL,TRUE,error)) {
if(!load_cfg(&scfg,text,TRUE,error)) {
fprintf(errfp,"!ERROR loading configuration files: %s\n",error);
return(do_bail(1));
}
......
......@@ -118,6 +118,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error)
,TOTAL_TEXT,fname);
return(FALSE);
}
cfg->text = text;
}
#endif
......@@ -306,6 +307,9 @@ void DLLCALL free_cfg(scfg_t* cfg)
free_chat_cfg(cfg);
free_xtrn_cfg(cfg);
free_attr_cfg(cfg);
if(cfg->text != NULL)
free_text(cfg->text);
}
void DLLCALL free_text(char* text[])
......
......@@ -89,6 +89,7 @@ int dns_getmx(char* name, char* mx, char* mx2
static mail_startup_t* startup=NULL;
static scfg_t scfg;
static char* text[TOTAL_TEXT];
static struct xpms_set *mail_set=NULL;
static BOOL terminated=FALSE;
static protected_uint32_t active_clients;
......@@ -6038,7 +6039,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, NULL, TRUE, error)) {
if(!load_cfg(&scfg, text, TRUE, error)) {
lprintf(LOG_CRIT,"!ERROR %s",error);
lprintf(LOG_CRIT,"!Failed to load configuration files");
cleanup(1);
......
......@@ -614,6 +614,7 @@ typedef struct
uint16_t user_backup_level;
uint16_t mail_backup_level;
char** text;
// Run-time state information (not configuration)
int tls_certificate;
......
......@@ -71,6 +71,7 @@
static services_startup_t* startup=NULL;
static scfg_t scfg;
static char* text[TOTAL_TEXT];
static volatile BOOL terminated=FALSE;
static time_t uptime=0;
static ulong served=0;
......@@ -1815,7 +1816,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, NULL, TRUE, error)) {
if(!load_cfg(&scfg, text, TRUE, error)) {
lprintf(LOG_CRIT,"!ERROR %s",error);
lprintf(LOG_CRIT,"!Failed to load configuration files");
cleanup(1);
......
......@@ -95,6 +95,7 @@ static const char* error_416="416 Requested Range Not Satisfiable";
static const char* error_500="500 Internal Server Error";
static const char* error_503="503 Service Unavailable\r\nConnection: close\r\nContent-Length: 0\r\n\r\n";
static const char* unknown=STR_UNKNOWN_USER;
static char* text[TOTAL_TEXT];
static int len_503 = 0;
#define TIMEOUT_THREAD_WAIT 60 /* Seconds */
......@@ -6990,7 +6991,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, NULL, TRUE, logstr)) {
if(!load_cfg(&scfg, text, TRUE, 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