|
|
1.1 root 1: /* sbbs_ini.c */
2:
3: /* Synchronet initialization (.ini) file routines */
4:
1.1.1.2 ! root 5: /* $Id: sbbs_ini.c,v 1.139 2011/09/23 06:54:39 rswindell Exp $ */
1.1 root 6:
7: /****************************************************************************
8: * @format.tab-size 4 (Plain Text/Source Code File Header) *
9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
10: * *
1.1.1.2 ! root 11: * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
1.1 root 12: * *
13: * This program is free software; you can redistribute it and/or *
14: * modify it under the terms of the GNU General Public License *
15: * as published by the Free Software Foundation; either version 2 *
16: * of the License, or (at your option) any later version. *
17: * See the GNU General Public License for more details: gpl.txt or *
18: * http://www.fsf.org/copyleft/gpl.html *
19: * *
20: * Anonymous FTP access to the most recent released source is available at *
21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
22: * *
23: * Anonymous CVS access to the development source and modification history *
24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
26: * (just hit return, no password is necessary) *
27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
28: * *
29: * For Synchronet coding style and modification guidelines, see *
30: * http://www.synchro.net/source.html *
31: * *
32: * You are encouraged to submit any modifications (preferably in Unix diff *
33: * format) via e-mail to [email protected] *
34: * *
35: * Note: If this box doesn't appear square, then you need to fix your tabs. *
36: ****************************************************************************/
37:
38: #define STARTUP_INI_BITDESC_TABLES
39:
40: #include <string.h> /* strchr, memset */
41:
42: #include "dirwrap.h" /* backslash */
43: #include "sbbs_ini.h"
44: #include "sbbsdefs.h" /* JAVASCRIPT_* macros */
45:
46: static const char* nulstr="";
47: static const char* strAutoStart="AutoStart";
48: static const char* strCtrlDirectory="CtrlDirectory";
49: static const char* strTempDirectory="TempDirectory";
50: static const char* strOptions="Options";
51: static const char* strInterface="Interface";
52: static const char* strPort="Port";
53: static const char* strMaxClients="MaxClients";
54: static const char* strMaxInactivity="MaxInactivity";
55: static const char* strHostName="HostName";
56: static const char* strLogLevel="LogLevel";
57: static const char* strBindRetryCount="BindRetryCount";
58: static const char* strBindRetryDelay="BindRetryDelay";
59: static const char* strAnswerSound="AnswerSound";
60: static const char* strHangupSound="HangupSound";
61: static const char* strHackAttemptSound="HackAttemptSound";
1.1.1.2 ! root 62: static const char* strLoginAttemptDelay="LoginAttemptDelay";
! 63: static const char* strLoginAttemptThrottle="LoginAttemptThrottle";
! 64: static const char* strLoginAttemptHackThreshold="LoginAttemptHackThreshold";
! 65: static const char* strLoginAttemptFilterThreshold="LoginAttemptFilterThreshold";
1.1 root 66: static const char* strJavaScriptMaxBytes ="JavaScriptMaxBytes";
67: static const char* strJavaScriptContextStack ="JavaScriptContextStack";
68: static const char* strJavaScriptThreadStack ="JavaScriptThreadStack";
69: static const char* strJavaScriptBranchLimit ="JavaScriptBranchLimit";
70: static const char* strJavaScriptGcInterval ="JavaScriptGcInterval";
71: static const char* strJavaScriptYieldInterval ="JavaScriptYieldInterval";
1.1.1.2 ! root 72: static const char* strJavaScriptLoadPath ="JavaScriptLoadPath";
1.1 root 73: static const char* strSemFileCheckFrequency ="SemFileCheckFrequency";
74:
1.1.1.2 ! root 75: #define DEFAULT_LOG_LEVEL LOG_DEBUG
! 76: #define DEFAULT_MAX_MSG_SIZE (20*1024*1024) /* 20MB */
! 77: #define DEFAULT_MAX_MSGS_WAITING 100
! 78: #define DEFAULT_CONNECT_TIMEOUT 30 /* seconds */
! 79: #define DEFAULT_BIND_RETRY_COUNT 2
! 80: #define DEFAULT_BIND_RETRY_DELAY 15
! 81: #define DEFAULT_LOGIN_ATTEMPT_DELAY 5000 /* milliseconds */
! 82: #define DEFAULT_LOGIN_ATTEMPT_THROTTLE 1000 /* milliseconds */
! 83: #define DEFAULT_LOGIN_ATTEMPT_HACKLOG 10 /* write to hack.log after this many consecutive unique attempts */
! 84: #define DEFAULT_LOGIN_ATTEMPT_FILTER 0 /* filter client IP address after this many consecutive unique attempts */
1.1 root 85:
86: void sbbs_get_ini_fname(char* ini_file, char* ctrl_dir, char* pHostName)
87: {
1.1.1.2 ! root 88: /* pHostName is no longer used since iniFileName calls gethostname() itself */
! 89:
! 90: #if defined(_WINSOCKAPI_)
! 91: WSADATA WSAData;
! 92: WSAStartup(MAKEWORD(1,1), &WSAData); /* req'd for gethostname */
! 93: #endif
! 94:
1.1 root 95: #if defined(__unix__) && defined(PREFIX)
96: sprintf(ini_file,PREFIX"/etc/sbbs.ini");
97: if(fexistcase(ini_file))
98: return;
99: #endif
100: iniFileName(ini_file,MAX_PATH,ctrl_dir,"sbbs.ini");
1.1.1.2 ! root 101:
! 102: #if defined(_WINSOCKAPI_)
! 103: WSACleanup();
! 104: #endif
1.1 root 105: }
106:
107: static void sbbs_fix_js_settings(js_startup_t* js)
108: {
109: /* Some sanity checking here */
110: if(js->max_bytes==0) js->max_bytes=JAVASCRIPT_MAX_BYTES;
111: if(js->cx_stack==0) js->cx_stack=JAVASCRIPT_CONTEXT_STACK;
112: }
113:
114: void sbbs_get_js_settings(
115: str_list_t list
116: ,const char* section
117: ,js_startup_t* js
118: ,js_startup_t* defaults)
119: {
1.1.1.2 ! root 120: char value[INI_MAX_VALUE_LEN];
! 121: char* p;
! 122:
! 123: js->max_bytes = (ulong)iniGetBytes(list,section,strJavaScriptMaxBytes ,/* unit: */1,defaults->max_bytes);
! 124: js->cx_stack = (ulong)iniGetBytes(list,section,strJavaScriptContextStack ,/* unit: */1,defaults->cx_stack);
! 125: js->thread_stack = (ulong)iniGetBytes(list,section,strJavaScriptThreadStack ,/* unit: */1,defaults->thread_stack);
1.1 root 126: js->branch_limit = iniGetInteger(list,section,strJavaScriptBranchLimit ,defaults->branch_limit);
127: js->gc_interval = iniGetInteger(list,section,strJavaScriptGcInterval ,defaults->gc_interval);
128: js->yield_interval = iniGetInteger(list,section,strJavaScriptYieldInterval ,defaults->yield_interval);
129:
1.1.1.2 ! root 130: /* Get JavaScriptLoadPath, use default is key is missing, use blank if key value is blank */
! 131: if((p=iniGetExistingString(list, section, strJavaScriptLoadPath, nulstr, value)) == NULL) {
! 132: if(defaults!=js)
! 133: SAFECOPY(js->load_path, defaults->load_path);
! 134: } else
! 135: SAFECOPY(js->load_path, p);
! 136:
1.1 root 137: sbbs_fix_js_settings(js);
138: }
139:
140: BOOL sbbs_set_js_settings(
141: str_list_t* lp
142: ,const char* section
143: ,js_startup_t* js
144: ,js_startup_t* defaults
145: ,ini_style_t* style)
146: {
147: BOOL failure=FALSE;
148: js_startup_t global_defaults = {
149: JAVASCRIPT_MAX_BYTES
150: ,JAVASCRIPT_CONTEXT_STACK
151: ,JAVASCRIPT_THREAD_STACK
152: ,JAVASCRIPT_BRANCH_LIMIT
153: ,JAVASCRIPT_GC_INTERVAL
154: ,JAVASCRIPT_YIELD_INTERVAL
1.1.1.2 ! root 155: ,JAVASCRIPT_LOAD_PATH
1.1 root 156: };
1.1.1.2 ! root 157: SAFECOPY(global_defaults.load_path, JAVASCRIPT_LOAD_PATH);
1.1 root 158:
159: if(defaults==NULL)
160: defaults=&global_defaults;
161:
162: sbbs_fix_js_settings(js);
163:
164: if(js->max_bytes==defaults->max_bytes)
165: iniRemoveValue(lp,section,strJavaScriptMaxBytes);
166: else
1.1.1.2 ! root 167: failure|=iniSetBytes(lp,section,strJavaScriptMaxBytes,/*unit: */1, js->max_bytes,style)==NULL;
1.1 root 168:
169: if(js->cx_stack==defaults->cx_stack)
170: iniRemoveValue(lp,section,strJavaScriptContextStack);
171: else
1.1.1.2 ! root 172: failure|=iniSetBytes(lp,section,strJavaScriptContextStack,/*unit: */1,js->cx_stack,style)==NULL;
1.1 root 173:
174: if(js->thread_stack==defaults->thread_stack)
175: iniRemoveValue(lp,section,strJavaScriptThreadStack);
176: else
1.1.1.2 ! root 177: failure|=iniSetBytes(lp,section,strJavaScriptThreadStack,/*unit: */1,js->thread_stack,style)==NULL;
1.1 root 178:
179: if(js->branch_limit==defaults->branch_limit)
180: iniRemoveValue(lp,section,strJavaScriptBranchLimit);
181: else
182: failure|=iniSetInteger(lp,section,strJavaScriptBranchLimit,js->branch_limit,style)==NULL;
183:
184: if(js->gc_interval==defaults->gc_interval)
185: iniRemoveValue(lp,section,strJavaScriptGcInterval);
186: else
187: failure|=iniSetInteger(lp,section,strJavaScriptGcInterval,js->gc_interval,style)==NULL;
188:
189: if(js->yield_interval==defaults->yield_interval)
190: iniRemoveValue(lp,section,strJavaScriptYieldInterval);
191: else
192: failure|=iniSetInteger(lp,section,strJavaScriptYieldInterval,js->yield_interval,style)==NULL;
193:
1.1.1.2 ! root 194: if(strcmp(js->load_path,defaults->load_path)==0)
! 195: iniRemoveKey(lp,section,strJavaScriptLoadPath);
! 196: else
! 197: failure|=iniSetString(lp,section,strJavaScriptLoadPath,js->load_path,style)==NULL;
! 198:
1.1 root 199: return(!failure);
200: }
201:
202: static void get_ini_globals(str_list_t list, global_startup_t* global)
203: {
204: const char* section = "Global";
205: char value[INI_MAX_VALUE_LEN];
206: char* p;
207:
208: p=iniGetString(list,section,strCtrlDirectory,nulstr,value);
209: if(*p) {
210: SAFECOPY(global->ctrl_dir,value);
211: backslash(global->ctrl_dir);
212: }
213:
214: p=iniGetString(list,section,strTempDirectory,nulstr,value);
215: #if defined(__unix__)
216: if(*p==0)
217: p=_PATH_TMP; /* Good idea to use "/tmp" on Unix */
218: #endif
219: if(*p) {
220: SAFECOPY(global->temp_dir,value);
221: backslash(global->temp_dir);
222: }
223:
224: p=iniGetString(list,section,strHostName,nulstr,value);
225: if(*p)
226: SAFECOPY(global->host_name,value);
227:
228: global->sem_chk_freq=iniGetShortInt(list,section,strSemFileCheckFrequency,0);
229: global->interface_addr=iniGetIpAddress(list,section,strInterface,INADDR_ANY);
230: global->log_level=iniGetLogLevel(list,section,strLogLevel,DEFAULT_LOG_LEVEL);
231: global->bind_retry_count=iniGetInteger(list,section,strBindRetryCount,DEFAULT_BIND_RETRY_COUNT);
232: global->bind_retry_delay=iniGetInteger(list,section,strBindRetryDelay,DEFAULT_BIND_RETRY_DELAY);
1.1.1.2 ! root 233: global->login_attempt_delay=iniGetInteger(list,section,strLoginAttemptDelay,DEFAULT_LOGIN_ATTEMPT_DELAY);
! 234: global->login_attempt_throttle=iniGetInteger(list,section,strLoginAttemptThrottle,DEFAULT_LOGIN_ATTEMPT_THROTTLE);
! 235: global->login_attempt_hack_threshold=iniGetInteger(list,section,strLoginAttemptHackThreshold,DEFAULT_LOGIN_ATTEMPT_HACKLOG);
! 236: global->login_attempt_filter_threshold=iniGetInteger(list,section,strLoginAttemptFilterThreshold,DEFAULT_LOGIN_ATTEMPT_FILTER);
1.1 root 237:
238: /* Setup default values here */
239: global->js.max_bytes = JAVASCRIPT_MAX_BYTES;
240: global->js.cx_stack = JAVASCRIPT_CONTEXT_STACK;
241: global->js.thread_stack = JAVASCRIPT_THREAD_STACK;
242: global->js.branch_limit = JAVASCRIPT_BRANCH_LIMIT;
243: global->js.gc_interval = JAVASCRIPT_GC_INTERVAL;
244: global->js.yield_interval = JAVASCRIPT_YIELD_INTERVAL;
1.1.1.2 ! root 245: SAFECOPY(global->js.load_path, JAVASCRIPT_LOAD_PATH);
1.1 root 246:
247: /* Read .ini values here */
248: sbbs_get_js_settings(list, section, &global->js, &global->js);
249: }
250:
251:
252: void sbbs_read_ini(
253: FILE* fp
254: ,global_startup_t* global
255: ,BOOL* run_bbs
256: ,bbs_startup_t* bbs
257: ,BOOL* run_ftp
258: ,ftp_startup_t* ftp
259: ,BOOL* run_web
260: ,web_startup_t* web
261: ,BOOL* run_mail
262: ,mail_startup_t* mail
263: ,BOOL* run_services
264: ,services_startup_t* services
265: )
266: {
267: const char* section;
268: const char* default_term_ansi;
269: const char* default_dosemu_path;
270: char value[INI_MAX_VALUE_LEN];
271: str_list_t list;
272: global_startup_t global_buf;
273:
274: if(global==NULL) {
275: memset(&global_buf,0,sizeof(global_buf));
276: global=&global_buf;
277: }
278:
279: list=iniReadFile(fp);
280:
281: get_ini_globals(list, global);
282:
283: if(global->ctrl_dir[0]) {
284: if(bbs!=NULL) SAFECOPY(bbs->ctrl_dir,global->ctrl_dir);
285: if(ftp!=NULL) SAFECOPY(ftp->ctrl_dir,global->ctrl_dir);
286: if(web!=NULL) SAFECOPY(web->ctrl_dir,global->ctrl_dir);
287: if(mail!=NULL) SAFECOPY(mail->ctrl_dir,global->ctrl_dir);
288: if(services!=NULL) SAFECOPY(services->ctrl_dir,global->ctrl_dir);
289: }
290:
291: /***********************************************************************/
292: section = "BBS";
293:
294: if(run_bbs!=NULL)
295: *run_bbs=iniGetBool(list,section,strAutoStart,TRUE);
296:
297: if(bbs!=NULL) {
298:
299: bbs->telnet_interface
300: =iniGetIpAddress(list,section,"TelnetInterface",global->interface_addr);
301: bbs->telnet_port
302: =iniGetShortInt(list,section,"TelnetPort",IPPORT_TELNET);
303:
304: bbs->rlogin_interface
305: =iniGetIpAddress(list,section,"RLoginInterface",global->interface_addr);
306: bbs->rlogin_port
307: =iniGetShortInt(list,section,"RLoginPort",513);
308:
309: bbs->ssh_interface
310: =iniGetIpAddress(list,section,"SSHInterface",global->interface_addr);
311: bbs->ssh_port
312: =iniGetShortInt(list,section,"SSHPort",22);
313:
314: bbs->first_node
315: =iniGetShortInt(list,section,"FirstNode",1);
316: bbs->last_node
317: =iniGetShortInt(list,section,"LastNode",4);
318:
319: bbs->outbuf_highwater_mark
320: =iniGetShortInt(list,section,"OutbufHighwaterMark"
321: #ifdef TCP_MAXSEG /* Auto-tune if possible. Would this be defined here? */
322: ,0
323: #else
324: ,1024
325: #endif
326: );
327: bbs->outbuf_drain_timeout
328: =iniGetShortInt(list,section,"OutbufDrainTimeout",10);
329:
330: bbs->sem_chk_freq
331: =iniGetShortInt(list,section,strSemFileCheckFrequency,global->sem_chk_freq);
332:
333: /* JavaScript operating parameters */
334: sbbs_get_js_settings(list, section, &bbs->js, &global->js);
335:
336: SAFECOPY(bbs->host_name
337: ,iniGetString(list,section,strHostName,global->host_name,value));
338:
339: SAFECOPY(bbs->temp_dir
340: ,iniGetString(list,section,strTempDirectory,global->temp_dir,value));
341:
342: /* Set default terminal type to "stock" termcap closest to "ansi-bbs" */
343: #if defined(__FreeBSD__)
344: default_term_ansi="cons25";
345: #else
346: default_term_ansi="pc3";
347: #endif
348:
349: SAFECOPY(bbs->xtrn_term_ansi
350: ,iniGetString(list,section,"ExternalTermANSI",default_term_ansi,value));
351: SAFECOPY(bbs->xtrn_term_dumb
352: ,iniGetString(list,section,"ExternalTermDumb","dumb",value));
353:
354: #if defined(__FreeBSD__)
1.1.1.2 ! root 355: default_dosemu_path="/usr/local/bin/doscmd";
1.1 root 356: #else
357: default_dosemu_path="/usr/bin/dosemu.bin";
358: #endif
359:
360: SAFECOPY(bbs->dosemu_path
361: ,iniGetString(list,section,"DOSemuPath",default_dosemu_path,value));
362:
363: SAFECOPY(bbs->answer_sound
364: ,iniGetString(list,section,strAnswerSound,nulstr,value));
365: SAFECOPY(bbs->hangup_sound
366: ,iniGetString(list,section,strHangupSound,nulstr,value));
367:
368: bbs->log_level
369: =iniGetLogLevel(list,section,strLogLevel,global->log_level);
370: bbs->options
371: =iniGetBitField(list,section,strOptions,bbs_options
372: ,BBS_OPT_XTRN_MINIMIZED|BBS_OPT_SYSOP_AVAILABLE);
373:
374: bbs->bind_retry_count=iniGetInteger(list,section,strBindRetryCount,global->bind_retry_count);
375: bbs->bind_retry_delay=iniGetInteger(list,section,strBindRetryDelay,global->bind_retry_delay);
1.1.1.2 ! root 376: bbs->login_attempt_delay=iniGetInteger(list,section,strLoginAttemptDelay,global->login_attempt_delay);
! 377: bbs->login_attempt_throttle=iniGetInteger(list,section,strLoginAttemptThrottle,global->login_attempt_throttle);
! 378: bbs->login_attempt_hack_threshold=iniGetInteger(list,section,strLoginAttemptHackThreshold,global->login_attempt_hack_threshold);
! 379: bbs->login_attempt_filter_threshold=iniGetInteger(list,section,strLoginAttemptFilterThreshold,global->login_attempt_filter_threshold);
1.1 root 380: }
381:
382: /***********************************************************************/
383: section = "FTP";
384:
385: if(run_ftp!=NULL)
386: *run_ftp=iniGetBool(list,section,strAutoStart,TRUE);
387:
388: if(ftp!=NULL) {
389:
390: ftp->interface_addr
391: =iniGetIpAddress(list,section,strInterface,global->interface_addr);
392: ftp->port
393: =iniGetShortInt(list,section,strPort,IPPORT_FTP);
394: ftp->max_clients
395: =iniGetShortInt(list,section,strMaxClients,10);
396: ftp->max_inactivity
397: =iniGetShortInt(list,section,strMaxInactivity,300); /* seconds */
398: ftp->qwk_timeout
399: =iniGetShortInt(list,section,"QwkTimeout",600); /* seconds */
400: ftp->sem_chk_freq
401: =iniGetShortInt(list,section,strSemFileCheckFrequency,global->sem_chk_freq);
402:
403: /* Passive transfer settings (for stupid firewalls/NATs) */
404: ftp->pasv_ip_addr
405: =iniGetIpAddress(list,section,"PasvIpAddress",0);
406: ftp->pasv_port_low
407: =iniGetShortInt(list,section,"PasvPortLow",IPPORT_RESERVED);
408: ftp->pasv_port_high
409: =iniGetShortInt(list,section,"PasvPortHigh",0xffff);
410:
411:
412: /* JavaScript Operating Parameters */
413: sbbs_get_js_settings(list, section, &ftp->js, &global->js);
414:
415: SAFECOPY(ftp->host_name
416: ,iniGetString(list,section,strHostName,global->host_name,value));
417:
418: SAFECOPY(ftp->index_file_name
419: ,iniGetString(list,section,"IndexFileName","00index",value));
420: SAFECOPY(ftp->html_index_file
421: ,iniGetString(list,section,"HtmlIndexFile","00index.html",value));
422: SAFECOPY(ftp->html_index_script
423: ,iniGetString(list,section,"HtmlIndexScript","ftp-html.js",value));
424:
425: SAFECOPY(ftp->answer_sound
426: ,iniGetString(list,section,strAnswerSound,nulstr,value));
427: SAFECOPY(ftp->hangup_sound
428: ,iniGetString(list,section,strHangupSound,nulstr,value));
429: SAFECOPY(ftp->hack_sound
430: ,iniGetString(list,section,strHackAttemptSound,nulstr,value));
431:
432: SAFECOPY(ftp->temp_dir
433: ,iniGetString(list,section,strTempDirectory,global->temp_dir,value));
434:
435: ftp->log_level
436: =iniGetLogLevel(list,section,strLogLevel,global->log_level);
437: ftp->options
438: =iniGetBitField(list,section,strOptions,ftp_options
439: ,FTP_OPT_INDEX_FILE|FTP_OPT_HTML_INDEX_FILE|FTP_OPT_ALLOW_QWK);
440:
441: ftp->bind_retry_count=iniGetInteger(list,section,strBindRetryCount,global->bind_retry_count);
442: ftp->bind_retry_delay=iniGetInteger(list,section,strBindRetryDelay,global->bind_retry_delay);
1.1.1.2 ! root 443: ftp->login_attempt_delay=iniGetInteger(list,section,strLoginAttemptDelay,global->login_attempt_delay);
! 444: ftp->login_attempt_throttle=iniGetInteger(list,section,strLoginAttemptThrottle,global->login_attempt_throttle);
! 445: ftp->login_attempt_hack_threshold=iniGetInteger(list,section,strLoginAttemptHackThreshold,global->login_attempt_hack_threshold);
! 446: ftp->login_attempt_filter_threshold=iniGetInteger(list,section,strLoginAttemptFilterThreshold,global->login_attempt_filter_threshold);
1.1 root 447: }
448:
449: /***********************************************************************/
450: section = "Mail";
451:
452: if(run_mail!=NULL)
453: *run_mail=iniGetBool(list,section,strAutoStart,TRUE);
454:
455: if(mail!=NULL) {
456:
457: mail->interface_addr
458: =iniGetIpAddress(list,section,strInterface,global->interface_addr);
459: mail->smtp_port
460: =iniGetShortInt(list,section,"SMTPPort",IPPORT_SMTP);
1.1.1.2 ! root 461: mail->submission_port
! 462: =iniGetShortInt(list,section,"SubmissionPort",IPPORT_SUBMISSION);
1.1 root 463: mail->pop3_port
464: =iniGetShortInt(list,section,"POP3Port",IPPORT_POP3);
465: mail->relay_port
466: =iniGetShortInt(list,section,"RelayPort",IPPORT_SMTP);
467: mail->max_clients
468: =iniGetShortInt(list,section,strMaxClients,10);
469: mail->max_inactivity
470: =iniGetShortInt(list,section,strMaxInactivity,120); /* seconds */
471: mail->max_delivery_attempts
472: =iniGetShortInt(list,section,"MaxDeliveryAttempts",50);
473: mail->rescan_frequency
474: =iniGetShortInt(list,section,"RescanFrequency",3600); /* 60 minutes */
475: mail->sem_chk_freq
476: =iniGetShortInt(list,section,strSemFileCheckFrequency,global->sem_chk_freq);
477: mail->lines_per_yield
478: =iniGetShortInt(list,section,"LinesPerYield",10);
479: mail->max_recipients
480: =iniGetShortInt(list,section,"MaxRecipients",100);
481: mail->max_msg_size
482: =iniGetInteger(list,section,"MaxMsgSize",DEFAULT_MAX_MSG_SIZE);
1.1.1.2 ! root 483: mail->max_msgs_waiting
! 484: =iniGetInteger(list,section,"MaxMsgsWaiting",DEFAULT_MAX_MSGS_WAITING);
! 485: mail->connect_timeout
! 486: =iniGetInteger(list,section,"ConnectTimeout",DEFAULT_CONNECT_TIMEOUT);
1.1 root 487:
488: SAFECOPY(mail->host_name
489: ,iniGetString(list,section,strHostName,global->host_name,value));
490:
491: SAFECOPY(mail->temp_dir
492: ,iniGetString(list,section,strTempDirectory,global->temp_dir,value));
493:
494: SAFECOPY(mail->relay_server
495: ,iniGetString(list,section,"RelayServer",nulstr,value));
496: SAFECOPY(mail->relay_user
497: ,iniGetString(list,section,"RelayUsername",nulstr,value));
498: SAFECOPY(mail->relay_pass
499: ,iniGetString(list,section,"RelayPassword",nulstr,value));
500:
501: SAFECOPY(mail->dns_server
502: ,iniGetString(list,section,"DNSServer",nulstr,value));
503:
504: SAFECOPY(mail->default_user
505: ,iniGetString(list,section,"DefaultUser",nulstr,value));
506:
507: SAFECOPY(mail->default_charset
508: ,iniGetString(list,section,"DefaultCharset",nulstr,value));
509:
510: SAFECOPY(mail->dnsbl_hdr
511: ,iniGetString(list,section,"DNSBlacklistHeader","X-DNSBL",value));
512: SAFECOPY(mail->dnsbl_tag
513: ,iniGetString(list,section,"DNSBlacklistSubject","SPAM",value));
514:
515: SAFECOPY(mail->pop3_sound
516: ,iniGetString(list,section,"POP3Sound",nulstr,value));
517: SAFECOPY(mail->inbound_sound
518: ,iniGetString(list,section,"InboundSound",nulstr,value));
519: SAFECOPY(mail->outbound_sound
520: ,iniGetString(list,section,"OutboundSound",nulstr,value));
521:
522: /* JavaScript Operating Parameters */
523: sbbs_get_js_settings(list, section, &mail->js, &global->js);
524:
525: mail->log_level
526: =iniGetLogLevel(list,section,strLogLevel,global->log_level);
527: mail->options
528: =iniGetBitField(list,section,strOptions,mail_options
529: ,MAIL_OPT_ALLOW_POP3);
530:
531: mail->bind_retry_count=iniGetInteger(list,section,strBindRetryCount,global->bind_retry_count);
532: mail->bind_retry_delay=iniGetInteger(list,section,strBindRetryDelay,global->bind_retry_delay);
1.1.1.2 ! root 533: mail->login_attempt_delay=iniGetInteger(list,section,strLoginAttemptDelay,global->login_attempt_delay);
! 534: mail->login_attempt_throttle=iniGetInteger(list,section,strLoginAttemptThrottle,global->login_attempt_throttle);
! 535: mail->login_attempt_hack_threshold=iniGetInteger(list,section,strLoginAttemptHackThreshold,global->login_attempt_hack_threshold);
! 536: mail->login_attempt_filter_threshold=iniGetInteger(list,section,strLoginAttemptFilterThreshold,global->login_attempt_filter_threshold);
1.1 root 537: }
538:
539: /***********************************************************************/
540: section = "Services";
541:
542: if(run_services!=NULL)
543: *run_services=iniGetBool(list,section,strAutoStart,TRUE);
544:
545: if(services!=NULL) {
546:
547: services->interface_addr
548: =iniGetIpAddress(list,section,strInterface,global->interface_addr);
549:
550: services->sem_chk_freq
551: =iniGetShortInt(list,section,strSemFileCheckFrequency,global->sem_chk_freq);
552:
553: /* JavaScript operating parameters */
554: sbbs_get_js_settings(list, section, &services->js, &global->js);
555:
556: SAFECOPY(services->host_name
557: ,iniGetString(list,section,strHostName,global->host_name,value));
558:
559: SAFECOPY(services->temp_dir
560: ,iniGetString(list,section,strTempDirectory,global->temp_dir,value));
561:
562: SAFECOPY(services->answer_sound
563: ,iniGetString(list,section,strAnswerSound,nulstr,value));
564: SAFECOPY(services->hangup_sound
565: ,iniGetString(list,section,strHangupSound,nulstr,value));
566:
567: services->log_level
568: =iniGetLogLevel(list,section,strLogLevel,global->log_level);
569: services->options
570: =iniGetBitField(list,section,strOptions,service_options
571: ,BBS_OPT_NO_HOST_LOOKUP);
572:
573: services->bind_retry_count=iniGetInteger(list,section,strBindRetryCount,global->bind_retry_count);
574: services->bind_retry_delay=iniGetInteger(list,section,strBindRetryDelay,global->bind_retry_delay);
1.1.1.2 ! root 575: services->login_attempt_delay=iniGetInteger(list,section,strLoginAttemptDelay,global->login_attempt_delay);
! 576: services->login_attempt_throttle=iniGetInteger(list,section,strLoginAttemptThrottle,global->login_attempt_throttle);
! 577: services->login_attempt_hack_threshold=iniGetInteger(list,section,strLoginAttemptHackThreshold,global->login_attempt_hack_threshold);
! 578: services->login_attempt_filter_threshold=iniGetInteger(list,section,strLoginAttemptFilterThreshold,global->login_attempt_filter_threshold);
1.1 root 579: }
580:
581: /***********************************************************************/
582: section = "Web";
583:
584: if(run_web!=NULL)
585: *run_web=iniGetBool(list,section,strAutoStart,FALSE);
586:
587: if(web!=NULL) {
588:
589: web->interface_addr
590: =iniGetIpAddress(list,section,strInterface,global->interface_addr);
591: web->port
592: =iniGetShortInt(list,section,strPort,IPPORT_HTTP);
593: web->max_clients
594: =iniGetShortInt(list,section,strMaxClients,10);
595: web->max_inactivity
596: =iniGetShortInt(list,section,strMaxInactivity,120); /* seconds */
597: web->sem_chk_freq
598: =iniGetShortInt(list,section,strSemFileCheckFrequency,global->sem_chk_freq);
599:
600: /* JavaScript operating parameters */
601: sbbs_get_js_settings(list, section, &web->js, &global->js);
602:
603: SAFECOPY(web->host_name
604: ,iniGetString(list,section,strHostName,global->host_name,value));
605:
606: SAFECOPY(web->temp_dir
607: ,iniGetString(list,section,strTempDirectory,global->temp_dir,value));
608:
609: SAFECOPY(web->root_dir
610: ,iniGetString(list,section,"RootDirectory",WEB_DEFAULT_ROOT_DIR,value));
611: SAFECOPY(web->error_dir
612: ,iniGetString(list,section,"ErrorDirectory",WEB_DEFAULT_ERROR_DIR,value));
613: SAFECOPY(web->cgi_dir
614: ,iniGetString(list,section,"CGIDirectory",WEB_DEFAULT_CGI_DIR,value));
1.1.1.2 ! root 615: SAFECOPY(web->default_auth_list
! 616: ,iniGetString(list,section,"Authentication",WEB_DEFAULT_AUTH_LIST,value));
1.1 root 617: SAFECOPY(web->logfile_base
618: ,iniGetString(list,section,"HttpLogFile",nulstr,value));
619:
620: SAFECOPY(web->default_cgi_content
621: ,iniGetString(list,section,"DefaultCGIContent",WEB_DEFAULT_CGI_CONTENT,value));
622:
623: iniFreeStringList(web->index_file_name);
624: web->index_file_name
625: =iniGetStringList(list,section,"IndexFileNames", "," ,"index.html,index.ssjs");
626: iniFreeStringList(web->cgi_ext);
627: web->cgi_ext
628: =iniGetStringList(list,section,"CGIExtensions", "," ,".cgi");
629: SAFECOPY(web->ssjs_ext
630: ,iniGetString(list,section,"JavaScriptExtension",".ssjs",value));
631: SAFECOPY(web->js_ext
632: ,iniGetString(list,section,"EmbJavaScriptExtension",".bbs",value));
633:
634: web->max_inactivity
635: =iniGetShortInt(list,section,strMaxInactivity,120); /* seconds */
636: web->max_cgi_inactivity
637: =iniGetShortInt(list,section,"MaxCgiInactivity",120); /* seconds */
638:
639: SAFECOPY(web->answer_sound
640: ,iniGetString(list,section,strAnswerSound,nulstr,value));
641: SAFECOPY(web->hangup_sound
642: ,iniGetString(list,section,strHangupSound,nulstr,value));
643: SAFECOPY(web->hack_sound
644: ,iniGetString(list,section,strHackAttemptSound,nulstr,value));
645:
646: web->log_level
647: =iniGetLogLevel(list,section,strLogLevel,global->log_level);
648: web->options
649: =iniGetBitField(list,section,strOptions,web_options
650: ,BBS_OPT_NO_HOST_LOOKUP | WEB_OPT_HTTP_LOGGING);
651: web->outbuf_highwater_mark
652: =iniGetShortInt(list,section,"OutbufHighwaterMark"
653: #ifdef TCP_MAXSEG /* Auto-tune if possible. Would this be defined here? */
654: ,0
655: #else
656: ,1024
657: #endif
658: );
659: web->outbuf_drain_timeout
660: =iniGetShortInt(list,section,"OutbufDrainTimeout",10);
661:
662: web->bind_retry_count=iniGetInteger(list,section,strBindRetryCount,global->bind_retry_count);
663: web->bind_retry_delay=iniGetInteger(list,section,strBindRetryDelay,global->bind_retry_delay);
1.1.1.2 ! root 664: web->login_attempt_delay=iniGetInteger(list,section,strLoginAttemptDelay,global->login_attempt_delay);
! 665: web->login_attempt_throttle=iniGetInteger(list,section,strLoginAttemptThrottle,global->login_attempt_throttle);
! 666: web->login_attempt_hack_threshold=iniGetInteger(list,section,strLoginAttemptHackThreshold,global->login_attempt_hack_threshold);
! 667: web->login_attempt_filter_threshold=iniGetInteger(list,section,strLoginAttemptFilterThreshold,global->login_attempt_filter_threshold);
1.1 root 668: }
669:
670: iniFreeStringList(list);
671: }
672:
673: BOOL sbbs_write_ini(
674: FILE* fp
675: ,scfg_t* cfg
676: ,global_startup_t* global
677: ,BOOL run_bbs
678: ,bbs_startup_t* bbs
679: ,BOOL run_ftp
680: ,ftp_startup_t* ftp
681: ,BOOL run_web
682: ,web_startup_t* web
683: ,BOOL run_mail
684: ,mail_startup_t* mail
685: ,BOOL run_services
686: ,services_startup_t* services
687: )
688: {
689: const char* section;
690: BOOL result=FALSE;
691: str_list_t list;
692: str_list_t* lp;
693: ini_style_t style;
694: global_startup_t global_buf;
695:
696: memset(&style, 0, sizeof(style));
697: style.key_prefix = "\t";
698: style.bit_separator = " | ";
699:
700: if((list=iniReadFile(fp))==NULL)
701: return(FALSE);
702:
703: if(global==NULL) {
704: get_ini_globals(list, &global_buf);
705: global = &global_buf;
706: }
707:
708: lp=&list;
709:
710: do { /* try */
711:
712: /***********************************************************************/
713: if(global!=&global_buf) {
714: section = "Global";
715:
1.1.1.2 ! root 716: iniSetString(lp,section,strCtrlDirectory,global->ctrl_dir,&style);
! 717: iniSetString(lp,section,strTempDirectory,global->temp_dir,&style);
! 718: iniSetString(lp,section,strHostName,global->host_name,&style);
! 719: iniSetShortInt(lp,section,strSemFileCheckFrequency,global->sem_chk_freq,&style);
! 720: iniSetIpAddress(lp,section,strInterface,global->interface_addr,&style);
! 721: iniSetLogLevel(lp,section,strLogLevel,global->log_level,&style);
! 722: iniSetInteger(lp,section,strBindRetryCount,global->bind_retry_count,&style);
! 723: iniSetInteger(lp,section,strBindRetryDelay,global->bind_retry_delay,&style);
! 724: iniSetInteger(lp,section,strLoginAttemptDelay,global->login_attempt_delay,&style);
! 725: iniSetInteger(lp,section,strLoginAttemptThrottle,global->login_attempt_throttle,&style);
! 726: iniSetInteger(lp,section,strLoginAttemptHackThreshold,global->login_attempt_hack_threshold,&style);
! 727: iniSetInteger(lp,section,strLoginAttemptFilterThreshold,global->login_attempt_filter_threshold,&style);
1.1 root 728:
729: /* JavaScript operating parameters */
730: if(!sbbs_set_js_settings(lp,section,&global->js,NULL,&style))
731: break;
732: }
733:
734: /***********************************************************************/
735: if(bbs!=NULL) {
736:
737: section = "BBS";
738:
739: if(!iniSetBool(lp,section,strAutoStart,run_bbs,&style))
740: break;
741:
742: if(bbs->telnet_interface==global->interface_addr)
743: iniRemoveValue(lp,section,"TelnetInterface");
744: else if(!iniSetIpAddress(lp,section,"TelnetInterface",bbs->telnet_interface,&style))
745: break;
746:
747: if(!iniSetShortInt(lp,section,"TelnetPort",bbs->telnet_port,&style))
748: break;
749:
750: if(bbs->rlogin_interface==global->interface_addr)
751: iniRemoveValue(lp,section,"RLoginInterface");
752: else if(!iniSetIpAddress(lp,section,"RLoginInterface",bbs->rlogin_interface,&style))
753: break;
754: if(!iniSetShortInt(lp,section,"RLoginPort",bbs->rlogin_port,&style))
755: break;
756:
757: if(bbs->ssh_interface==global->interface_addr)
758: iniRemoveValue(lp,section,"SSHInterface");
759: else if(!iniSetIpAddress(lp,section,"SSHInterface",bbs->ssh_interface,&style))
760: break;
761: if(!iniSetShortInt(lp,section,"SSHPort",bbs->ssh_port,&style))
762: break;
763:
764: if(!iniSetShortInt(lp,section,"FirstNode",bbs->first_node,&style))
765: break;
766: if(!iniSetShortInt(lp,section,"LastNode",bbs->last_node,&style))
767: break;
768: if(!iniSetShortInt(lp,section,"OutbufHighwaterMark",bbs->outbuf_highwater_mark,&style))
769: break;
770: if(!iniSetShortInt(lp,section,"OutbufDrainTimeout",bbs->outbuf_drain_timeout,&style))
771: break;
772:
773: if(bbs->sem_chk_freq==global->sem_chk_freq)
774: iniRemoveValue(lp,section,strSemFileCheckFrequency);
775: else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,bbs->sem_chk_freq,&style))
776: break;
777:
778: if(bbs->log_level==global->log_level)
779: iniRemoveValue(lp,section,strLogLevel);
780: else if(!iniSetLogLevel(lp,section,strLogLevel,bbs->log_level,&style))
781: break;
782:
783: /* JavaScript operating parameters */
784: if(!sbbs_set_js_settings(lp,section,&bbs->js,&global->js,&style))
785: break;
786:
787: if(strcmp(bbs->host_name,global->host_name)==0
788: || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
789: iniRemoveKey(lp,section,strHostName);
790: else if(!iniSetString(lp,section,strHostName,bbs->host_name,&style))
791: break;
792:
793: if(stricmp(bbs->temp_dir,global->temp_dir)==0)
794: iniRemoveKey(lp,section,strTempDirectory);
795: else if(!iniSetString(lp,section,strTempDirectory,bbs->temp_dir,&style))
796: break;
797:
798: if(!iniSetString(lp,section,"ExternalTermANSI",bbs->xtrn_term_ansi,&style))
799: break;
800: if(!iniSetString(lp,section,"ExternalTermDumb",bbs->xtrn_term_dumb,&style))
801: break;
802: if(!iniSetString(lp,section,"DOSemuPath",bbs->dosemu_path,&style))
803: break;
804:
805: if(!iniSetString(lp,section,strAnswerSound,bbs->answer_sound,&style))
806: break;
807: if(!iniSetString(lp,section,strHangupSound,bbs->hangup_sound,&style))
808: break;
809:
810: if(!iniSetBitField(lp,section,strOptions,bbs_options,bbs->options,&style))
811: break;
812:
813: if(bbs->bind_retry_count==global->bind_retry_count)
814: iniRemoveValue(lp,section,strBindRetryCount);
815: else if(!iniSetInteger(lp,section,strBindRetryCount,bbs->bind_retry_count,&style))
816: break;
817: if(bbs->bind_retry_delay==global->bind_retry_delay)
818: iniRemoveValue(lp,section,strBindRetryDelay);
819: else if(!iniSetInteger(lp,section,strBindRetryDelay,bbs->bind_retry_delay,&style))
820: break;
821: }
822: /***********************************************************************/
823: if(ftp!=NULL) {
824:
825: section = "FTP";
826:
827: if(!iniSetBool(lp,section,strAutoStart,run_ftp,&style))
828: break;
829:
830: if(ftp->interface_addr==global->interface_addr)
831: iniRemoveValue(lp,section,strInterface);
832: else if(!iniSetIpAddress(lp,section,strInterface,ftp->interface_addr,&style))
833: break;
834:
835: if(!iniSetShortInt(lp,section,strPort,ftp->port,&style))
836: break;
837: if(!iniSetShortInt(lp,section,strMaxClients,ftp->max_clients,&style))
838: break;
839: if(!iniSetShortInt(lp,section,strMaxInactivity,ftp->max_inactivity,&style))
840: break;
841: if(!iniSetShortInt(lp,section,"QwkTimeout",ftp->qwk_timeout,&style))
842: break;
843:
844: /* Passive transfer settings */
845: if(!iniSetIpAddress(lp,section,"PasvIpAddress",ftp->pasv_ip_addr,&style))
846: break;
847: if(!iniSetShortInt(lp,section,"PasvPortLow",ftp->pasv_port_low,&style))
848: break;
849: if(!iniSetShortInt(lp,section,"PasvPortHigh",ftp->pasv_port_high,&style))
850: break;
851:
852: if(ftp->sem_chk_freq==global->sem_chk_freq)
853: iniRemoveValue(lp,section,strSemFileCheckFrequency);
854: else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,ftp->sem_chk_freq,&style))
855: break;
856:
857: if(ftp->log_level==global->log_level)
858: iniRemoveValue(lp,section,strLogLevel);
859: else if(!iniSetLogLevel(lp,section,strLogLevel,ftp->log_level,&style))
860: break;
861:
862: /* JavaScript Operating Parameters */
863: if(!sbbs_set_js_settings(lp,section,&ftp->js,&global->js,&style))
864: break;
865:
866: if(strcmp(ftp->host_name,global->host_name)==0
867: || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
868: iniRemoveKey(lp,section,strHostName);
869: else if(!iniSetString(lp,section,strHostName,ftp->host_name,&style))
870: break;
871:
872: if(stricmp(ftp->temp_dir,global->temp_dir)==0)
873: iniRemoveKey(lp,section,strTempDirectory);
874: else if(!iniSetString(lp,section,strTempDirectory,ftp->temp_dir,&style))
875: break;
876:
877: if(!iniSetString(lp,section,"IndexFileName",ftp->index_file_name,&style))
878: break;
879: if(!iniSetString(lp,section,"HtmlIndexFile",ftp->html_index_file,&style))
880: break;
881: if(!iniSetString(lp,section,"HtmlIndexScript",ftp->html_index_script,&style))
882: break;
883:
884: if(!iniSetString(lp,section,strAnswerSound,ftp->answer_sound,&style))
885: break;
886: if(!iniSetString(lp,section,strHangupSound,ftp->hangup_sound,&style))
887: break;
888: if(!iniSetString(lp,section,strHackAttemptSound,ftp->hack_sound,&style))
889: break;
890:
891: if(!iniSetBitField(lp,section,strOptions,ftp_options,ftp->options,&style))
892: break;
893:
894: if(ftp->bind_retry_count==global->bind_retry_count)
895: iniRemoveValue(lp,section,strBindRetryCount);
896: else if(!iniSetInteger(lp,section,strBindRetryCount,ftp->bind_retry_count,&style))
897: break;
898: if(ftp->bind_retry_delay==global->bind_retry_delay)
899: iniRemoveValue(lp,section,strBindRetryDelay);
900: else if(!iniSetInteger(lp,section,strBindRetryDelay,ftp->bind_retry_delay,&style))
901: break;
902: }
903:
904: /***********************************************************************/
905: if(mail!=NULL) {
906:
907: section = "Mail";
908:
909: if(!iniSetBool(lp,section,strAutoStart,run_mail,&style))
910: break;
911:
912: if(mail->interface_addr==global->interface_addr)
913: iniRemoveValue(lp,section,strInterface);
914: else if(!iniSetIpAddress(lp,section,strInterface,mail->interface_addr,&style))
915: break;
916:
917: if(mail->sem_chk_freq==global->sem_chk_freq)
918: iniRemoveValue(lp,section,strSemFileCheckFrequency);
919: else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,mail->sem_chk_freq,&style))
920: break;
921:
922: if(mail->log_level==global->log_level)
923: iniRemoveValue(lp,section,strLogLevel);
924: else if(!iniSetLogLevel(lp,section,strLogLevel,mail->log_level,&style))
925: break;
926:
927: if(!iniSetShortInt(lp,section,"SMTPPort",mail->smtp_port,&style))
928: break;
929: if(!iniSetShortInt(lp,section,"POP3Port",mail->pop3_port,&style))
930: break;
931: if(!iniSetShortInt(lp,section,"RelayPort",mail->relay_port,&style))
932: break;
933: if(!iniSetShortInt(lp,section,strMaxClients,mail->max_clients,&style))
934: break;
935: if(!iniSetShortInt(lp,section,strMaxInactivity,mail->max_inactivity,&style))
936: break;
937: if(!iniSetShortInt(lp,section,"MaxDeliveryAttempts",mail->max_delivery_attempts,&style))
938: break;
939: if(!iniSetShortInt(lp,section,"RescanFrequency",mail->rescan_frequency,&style))
940: break;
941: if(!iniSetShortInt(lp,section,"LinesPerYield",mail->lines_per_yield,&style))
942: break;
943: if(!iniSetShortInt(lp,section,"MaxRecipients",mail->max_recipients,&style))
944: break;
945: if(!iniSetInteger(lp,section,"MaxMsgSize",mail->max_msg_size,&style))
946: break;
1.1.1.2 ! root 947: if(!iniSetInteger(lp,section,"MaxMsgsWaiting",mail->max_msgs_waiting,&style))
! 948: break;
! 949: if(!iniSetInteger(lp,section,"ConnectTimeout",mail->connect_timeout,&style))
! 950: break;
1.1 root 951:
952: if(strcmp(mail->host_name,global->host_name)==0
953: || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
954: iniRemoveKey(lp,section,strHostName);
955: else if(!iniSetString(lp,section,strHostName,mail->host_name,&style))
956: break;
957:
958: if(stricmp(mail->temp_dir,global->temp_dir)==0)
959: iniRemoveKey(lp,section,strTempDirectory);
960: else if(!iniSetString(lp,section,strTempDirectory,mail->temp_dir,&style))
961: break;
962:
963: if(!iniSetString(lp,section,"RelayServer",mail->relay_server,&style))
964: break;
965: if(!iniSetString(lp,section,"RelayUsername",mail->relay_user,&style))
966: break;
967: if(!iniSetString(lp,section,"RelayPassword",mail->relay_pass,&style))
968: break;
969:
970: if(!iniSetString(lp,section,"DNSServer",mail->dns_server,&style))
971: break;
972:
973: if(!iniSetString(lp,section,"DefaultCharset",mail->default_charset,&style))
974: break;
975:
976: if(!iniSetString(lp,section,"DefaultUser",mail->default_user,&style))
977: break;
978:
979: if(!iniSetString(lp,section,"DNSBlacklistHeader",mail->dnsbl_hdr,&style))
980: break;
981: if(!iniSetString(lp,section,"DNSBlacklistSubject",mail->dnsbl_tag,&style))
982: break;
983:
984: if(!iniSetString(lp,section,"POP3Sound",mail->pop3_sound,&style))
985: break;
986: if(!iniSetString(lp,section,"InboundSound",mail->inbound_sound,&style))
987: break;
988: if(!iniSetString(lp,section,"OutboundSound",mail->outbound_sound,&style))
989: break;
990:
991: /* JavaScript Operating Parameters */
992: if(!sbbs_set_js_settings(lp,section,&mail->js,&global->js,&style))
993: break;
994:
995: if(!iniSetBitField(lp,section,strOptions,mail_options,mail->options,&style))
996: break;
997:
998: if(mail->bind_retry_count==global->bind_retry_count)
999: iniRemoveValue(lp,section,strBindRetryCount);
1000: else if(!iniSetInteger(lp,section,strBindRetryCount,mail->bind_retry_count,&style))
1001: break;
1002: if(mail->bind_retry_delay==global->bind_retry_delay)
1003: iniRemoveValue(lp,section,strBindRetryDelay);
1004: else if(!iniSetInteger(lp,section,strBindRetryDelay,mail->bind_retry_delay,&style))
1005: break;
1006: }
1007:
1008: /***********************************************************************/
1009: if(services!=NULL) {
1010:
1011: section = "Services";
1012:
1013: if(!iniSetBool(lp,section,strAutoStart,run_services,&style))
1014: break;
1015:
1016: if(services->interface_addr==global->interface_addr)
1017: iniRemoveValue(lp,section,strInterface);
1018: else if(!iniSetIpAddress(lp,section,strInterface,services->interface_addr,&style))
1019: break;
1020:
1021: if(services->sem_chk_freq==global->sem_chk_freq)
1022: iniRemoveValue(lp,section,strSemFileCheckFrequency);
1023: else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,services->sem_chk_freq,&style))
1024: break;
1025:
1026: if(services->log_level==global->log_level)
1027: iniRemoveValue(lp,section,strLogLevel);
1028: else if(!iniSetLogLevel(lp,section,strLogLevel,services->log_level,&style))
1029: break;
1030:
1031: /* Configurable JavaScript default parameters */
1032: if(!sbbs_set_js_settings(lp,section,&services->js,&global->js,&style))
1033: break;
1034:
1035: if(strcmp(services->host_name,global->host_name)==0
1036: || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
1037: iniRemoveKey(lp,section,strHostName);
1038: else if(!iniSetString(lp,section,strHostName,services->host_name,&style))
1039: break;
1040:
1041: if(stricmp(services->temp_dir,global->temp_dir)==0)
1042: iniRemoveKey(lp,section,strTempDirectory);
1043: else if(!iniSetString(lp,section,strTempDirectory,services->temp_dir,&style))
1044: break;
1045:
1046: if(!iniSetString(lp,section,strAnswerSound,services->answer_sound,&style))
1047: break;
1048: if(!iniSetString(lp,section,strHangupSound,services->hangup_sound,&style))
1049: break;
1050:
1051: if(!iniSetBitField(lp,section,strOptions,service_options,services->options,&style))
1052: break;
1053:
1054: if(services->bind_retry_count==global->bind_retry_count)
1055: iniRemoveValue(lp,section,strBindRetryCount);
1056: else if(!iniSetInteger(lp,section,strBindRetryCount,services->bind_retry_count,&style))
1057: break;
1058: if(services->bind_retry_delay==global->bind_retry_delay)
1059: iniRemoveValue(lp,section,strBindRetryDelay);
1060: else if(!iniSetInteger(lp,section,strBindRetryDelay,services->bind_retry_delay,&style))
1061: break;
1062: }
1063:
1064: /***********************************************************************/
1065: if(web!=NULL) {
1066:
1067: section = "Web";
1068:
1069: if(!iniSetBool(lp,section,strAutoStart,run_web,&style))
1070: break;
1071:
1072: if(web->interface_addr==global->interface_addr)
1073: iniRemoveValue(lp,section,strInterface);
1074: else if(!iniSetIpAddress(lp,section,strInterface,web->interface_addr,&style))
1075: break;
1076:
1077: if(!iniSetShortInt(lp,section,strPort,web->port,&style))
1078: break;
1079: if(!iniSetShortInt(lp,section,strMaxClients,web->max_clients,&style))
1080: break;
1081: if(!iniSetShortInt(lp,section,strMaxInactivity,web->max_inactivity,&style))
1082: break;
1083:
1084: if(web->sem_chk_freq==global->sem_chk_freq)
1085: iniRemoveValue(lp,section,strSemFileCheckFrequency);
1086: else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,web->sem_chk_freq,&style))
1087: break;
1088:
1089: if(web->log_level==global->log_level)
1090: iniRemoveValue(lp,section,strLogLevel);
1091: else if(!iniSetLogLevel(lp,section,strLogLevel,web->log_level,&style))
1092: break;
1093:
1094: /* JavaScript Operating Parameters */
1095: if(!sbbs_set_js_settings(lp,section,&web->js,&global->js,&style))
1096: break;
1097:
1098: if(strcmp(web->host_name,global->host_name)==0
1099: || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
1100: iniRemoveKey(lp,section,strHostName);
1101: else if(!iniSetString(lp,section,strHostName,web->host_name,&style))
1102: break;
1103:
1104: if(stricmp(web->temp_dir,global->temp_dir)==0)
1105: iniRemoveKey(lp,section,strTempDirectory);
1106: else if(!iniSetString(lp,section,strTempDirectory,web->temp_dir,&style))
1107: break;
1108:
1109: if(!iniSetString(lp,section,"RootDirectory",web->root_dir,&style))
1110: break;
1111: if(!iniSetString(lp,section,"ErrorDirectory",web->error_dir,&style))
1112: break;
1113: if(!iniSetString(lp,section,"CGIDirectory",web->cgi_dir,&style))
1114: break;
1.1.1.2 ! root 1115: if(!iniSetString(lp,section,"Authentication",web->default_auth_list,&style))
! 1116: break;
1.1 root 1117: if(!iniSetString(lp,section,"HttpLogFile",web->logfile_base,&style))
1118: break;
1119:
1120: if(!iniSetString(lp,section,"DefaultCGIContent",web->default_cgi_content,&style))
1121: break;
1122:
1123: if(!iniSetStringList(lp,section,"IndexFileNames", "," ,web->index_file_name,&style))
1124: break;
1125: if(!iniSetStringList(lp,section,"CGIExtensions", "," ,web->cgi_ext,&style))
1126: break;
1127:
1128: if(!iniSetString(lp,section,"JavaScriptExtension",web->ssjs_ext,&style))
1129: break;
1130:
1131: if(!iniSetShortInt(lp,section,strMaxInactivity,web->max_inactivity,&style))
1132: break;
1133: if(!iniSetShortInt(lp,section,"MaxCgiInactivity",web->max_cgi_inactivity,&style))
1134: break;
1135:
1136: if(!iniSetString(lp,section,strAnswerSound,web->answer_sound,&style))
1137: break;
1138: if(!iniSetString(lp,section,strHangupSound,web->hangup_sound,&style))
1139: break;
1140: if(!iniSetString(lp,section,strHackAttemptSound,web->hack_sound,&style))
1141: break;
1142:
1143: if(!iniSetBitField(lp,section,strOptions,web_options,web->options,&style))
1144: break;
1145:
1146: if(web->bind_retry_count==global->bind_retry_count)
1147: iniRemoveValue(lp,section,strBindRetryCount);
1148: else if(!iniSetInteger(lp,section,strBindRetryCount,web->bind_retry_count,&style))
1149: break;
1150: if(web->bind_retry_delay==global->bind_retry_delay)
1151: iniRemoveValue(lp,section,strBindRetryDelay);
1152: else if(!iniSetInteger(lp,section,strBindRetryDelay,web->bind_retry_delay,&style))
1153: break;
1154: if(!iniSetShortInt(lp,section,"OutbufHighwaterMark",web->outbuf_highwater_mark,&style))
1155: break;
1156: if(!iniSetShortInt(lp,section,"OutbufDrainTimeout",web->outbuf_drain_timeout,&style))
1157: break;
1158: }
1159:
1160: /***********************************************************************/
1161: result=iniWriteFile(fp,list);
1162:
1163: } while(0); /* finally */
1164:
1165: iniFreeStringList(list);
1166:
1167: return(result);
1168: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.