Annotation of sbbs/sbbs3/sbbs_ini.c, revision 1.1.1.1

1.1       root        1: /* sbbs_ini.c */
                      2: 
                      3: /* Synchronet console configuration (.ini) file routines */
                      4: 
                      5: /* $Id: sbbs_ini.c,v 1.97 2005/01/01 01:11:44 rswindell Exp $ */
                      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:  *                                                                                                                                                     *
                     11:  * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html         *
                     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 "dirwrap.h"   /* backslash */
                     41: #include "sbbs_ini.h"
                     42: #include "sbbsdefs.h"  /* JAVASCRIPT_* macros */
                     43: 
                     44: static const char*     nulstr="";
                     45: static const char*  strCtrlDirectory="CtrlDirectory";
                     46: static const char*  strTempDirectory="TempDirectory";
                     47: static const char*     strOptions="Options";
                     48: static const char*     strInterface="Interface";
                     49: static const char*     strHostName="HostName";
                     50: static const char*     strLogMask="LogMask";
                     51: static const char*     strBindRetryCount="BindRetryCount";
                     52: static const char*     strBindRetryDelay="BindRetryDelay";
                     53: 
                     54: #if defined(SBBSNTSVCS) && 0   /* sbbs_ini.obj is shared with sbbs.exe (!) */
                     55:        #define DEFAULT_LOG_MASK                0x3f    /* EMERG|ALERT|CRIT|ERR|WARNING|NOTICE */
                     56: #else
                     57:        #define DEFAULT_LOG_MASK                0xff    /* EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|DEBUG */
                     58: #endif
                     59: #define DEFAULT_MAX_MSG_SIZE    (10*1024*1024) /* 10MB */
                     60: #define DEFAULT_BIND_RETRY_COUNT       2
                     61: #define DEFAULT_BIND_RETRY_DELAY       15
                     62: 
                     63: void sbbs_get_ini_fname(char* ini_file, char* ctrl_dir, char* pHostName)
                     64: {
                     65:     char       host_name[128];
                     66:     char       path[MAX_PATH+1];
                     67:        char*   p;
                     68: 
                     69:     if(pHostName!=NULL)
                     70:                SAFECOPY(host_name,pHostName);
                     71:        else {
                     72: #if defined(_WINSOCKAPI_)
                     73:         WSADATA WSAData;
                     74:         WSAStartup(MAKEWORD(1,1), &WSAData); /* req'd for gethostname */
                     75: #endif
                     76:        gethostname(host_name,sizeof(host_name)-1);
                     77: #if defined(_WINSOCKAPI_)
                     78:         WSACleanup();
                     79: #endif
                     80:     }
                     81:        SAFECOPY(path,ctrl_dir);
                     82:        backslash(path);
                     83:        sprintf(ini_file,"%s%s.ini",path,host_name);
                     84:        if(fexistcase(ini_file))
                     85:                return;
                     86:        if((p=strchr(host_name,'.'))!=NULL) {
                     87:                *p=0;
                     88:                sprintf(ini_file,"%s%s.ini",path,host_name);
                     89:                if(fexistcase(ini_file))
                     90:                        return;
                     91:        }
                     92: #if defined(__unix__) && defined(PREFIX)
                     93:        sprintf(ini_file,PREFIX"/etc/sbbs.ini");
                     94:        if(fexistcase(ini_file))
                     95:                return;
                     96: #endif
                     97:        sprintf(ini_file,"%ssbbs.ini",path);
                     98: }
                     99: 
                    100: static void read_ini_globals(FILE* fp, global_startup_t* global)
                    101: {
                    102:        const char* section = "Global";
                    103:        char            value[INI_MAX_VALUE_LEN];
                    104:        char*           p;
                    105: 
                    106:        p=iniReadString(fp,section,strCtrlDirectory,nulstr,value);
                    107:        if(*p) {
                    108:            SAFECOPY(global->ctrl_dir,value);
                    109:                backslash(global->ctrl_dir);
                    110:     }
                    111: 
                    112:        p=iniReadString(fp,section,strTempDirectory,nulstr,value);
                    113:        if(*p) {
                    114:            SAFECOPY(global->temp_dir,value);
                    115:                backslash(global->temp_dir);
                    116:     }
                    117: 
                    118:        p=iniReadString(fp,section,strHostName,nulstr,value);
                    119:        if(*p)
                    120:         SAFECOPY(global->host_name,value);
                    121: 
                    122:        global->sem_chk_freq=iniReadShortInt(fp,section,strSemFileCheckFrequency,0);
                    123:        global->interface_addr=iniReadIpAddress(fp,section,strInterface,INADDR_ANY);
                    124:        global->log_mask=iniReadBitField(fp,section,strLogMask,log_mask_bits,DEFAULT_LOG_MASK);
                    125:        global->bind_retry_count=iniReadInteger(fp,section,strBindRetryCount,DEFAULT_BIND_RETRY_COUNT);
                    126:        global->bind_retry_delay=iniReadInteger(fp,section,strBindRetryDelay,DEFAULT_BIND_RETRY_DELAY);
                    127: 
                    128:        global->js.max_bytes            = iniReadInteger(fp,section,strJavaScriptMaxBytes               ,JAVASCRIPT_MAX_BYTES);
                    129:        global->js.cx_stack                     = iniReadInteger(fp,section,strJavaScriptContextStack   ,JAVASCRIPT_CONTEXT_STACK);
                    130:        global->js.branch_limit         = iniReadInteger(fp,section,strJavaScriptBranchLimit    ,JAVASCRIPT_BRANCH_LIMIT);
                    131:        global->js.gc_interval          = iniReadInteger(fp,section,strJavaScriptGcInterval             ,JAVASCRIPT_GC_INTERVAL);
                    132:        global->js.yield_interval       = iniReadInteger(fp,section,strJavaScriptYieldInterval  ,JAVASCRIPT_YIELD_INTERVAL);
                    133: }
                    134: 
                    135: 
                    136: void sbbs_read_ini(
                    137:         FILE*                                  fp
                    138:        ,global_startup_t*              global
                    139:        ,BOOL*                                  run_bbs
                    140:        ,bbs_startup_t*                 bbs
                    141:        ,BOOL*                                  run_ftp
                    142:        ,ftp_startup_t*                 ftp
                    143:        ,BOOL*                                  run_web
                    144:        ,web_startup_t*                 web
                    145:        ,BOOL*                                  run_mail                
                    146:        ,mail_startup_t*                mail
                    147:        ,BOOL*                                  run_services
                    148:        ,services_startup_t*    services
                    149:        )
                    150: {
                    151:        const char*     section;
                    152:        const char* default_term_ansi;
                    153:        const char*     default_cgi_temp;
                    154:        const char*     default_dosemu_path;
                    155:        char            value[INI_MAX_VALUE_LEN];
                    156:        global_startup_t global_buf;
                    157: 
                    158:        if(global==NULL) {
                    159:                memset(&global_buf,0,sizeof(global_buf));
                    160:                global=&global_buf;
                    161:        }
                    162: 
                    163:        read_ini_globals(fp, global);
                    164: 
                    165:        if(global->ctrl_dir[0]) {
                    166:                if(bbs!=NULL)           SAFECOPY(bbs->ctrl_dir,global->ctrl_dir);
                    167:                if(ftp!=NULL)           SAFECOPY(ftp->ctrl_dir,global->ctrl_dir);
                    168:                if(mail!=NULL)          SAFECOPY(mail->ctrl_dir,global->ctrl_dir);
                    169:                if(services!=NULL)      SAFECOPY(services->ctrl_dir,global->ctrl_dir);
                    170:        }
                    171:        if(global->temp_dir[0]) {
                    172:                if(bbs!=NULL)           SAFECOPY(bbs->temp_dir,global->temp_dir);
                    173:                if(ftp!=NULL)           SAFECOPY(ftp->temp_dir,global->temp_dir);
                    174:        }
                    175:                                                                                                        
                    176:        /***********************************************************************/
                    177:        if(bbs!=NULL) {
                    178: 
                    179:                section = "BBS";
                    180: 
                    181:                if(run_bbs!=NULL)
                    182:                        *run_bbs=iniReadBool(fp,section,"AutoStart",TRUE);
                    183: 
                    184:                bbs->telnet_interface
                    185:                        =iniReadIpAddress(fp,section,"TelnetInterface",global->interface_addr);
                    186:                bbs->telnet_port
                    187:                        =iniReadShortInt(fp,section,"TelnetPort",IPPORT_TELNET);
                    188: 
                    189:                bbs->rlogin_interface
                    190:                        =iniReadIpAddress(fp,section,"RLoginInterface",global->interface_addr);
                    191:                bbs->rlogin_port
                    192:                        =iniReadShortInt(fp,section,"RLoginPort",513);
                    193: 
                    194:                bbs->first_node
                    195:                        =iniReadShortInt(fp,section,"FirstNode",1);
                    196:                bbs->last_node
                    197:                        =iniReadShortInt(fp,section,"LastNode",4);
                    198: 
                    199:                bbs->outbuf_highwater_mark
                    200:                        =iniReadShortInt(fp,section,"OutbufHighwaterMark",1024);
                    201:                bbs->outbuf_drain_timeout
                    202:                        =iniReadShortInt(fp,section,"OutbufDrainTimeout",10);
                    203: 
                    204:                bbs->sem_chk_freq
                    205:                        =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq);
                    206: 
                    207:                bbs->xtrn_polls_before_yield
                    208:                        =iniReadInteger(fp,section,"ExternalYield",10);
                    209: 
                    210:                /* JavaScript operating parameters */
                    211:                bbs->js_max_bytes
                    212:                        =iniReadInteger(fp,section,strJavaScriptMaxBytes                ,global->js.max_bytes);
                    213:                bbs->js_cx_stack
                    214:                        =iniReadInteger(fp,section,strJavaScriptContextStack    ,global->js.cx_stack);
                    215:                bbs->js_branch_limit
                    216:                        =iniReadInteger(fp,section,strJavaScriptBranchLimit     ,global->js.branch_limit);
                    217:                bbs->js_gc_interval
                    218:                        =iniReadInteger(fp,section,strJavaScriptGcInterval      ,global->js.gc_interval);
                    219:                bbs->js_yield_interval
                    220:                        =iniReadInteger(fp,section,strJavaScriptYieldInterval,global->js.yield_interval);
                    221: 
                    222:                SAFECOPY(bbs->host_name
                    223:                        ,iniReadString(fp,section,strHostName,global->host_name,value));
                    224: 
                    225:                /* Set default terminal type to "stock" termcap closest to "ansi-bbs" */
                    226:        #if defined(__FreeBSD__)
                    227:                default_term_ansi="cons25";
                    228:        #else
                    229:                default_term_ansi="pc3";
                    230:        #endif
                    231: 
                    232:                SAFECOPY(bbs->xtrn_term_ansi
                    233:                        ,iniReadString(fp,section,"ExternalTermANSI",default_term_ansi,value));
                    234:                SAFECOPY(bbs->xtrn_term_dumb
                    235:                        ,iniReadString(fp,section,"ExternalTermDumb","dumb",value));
                    236: 
                    237:        #if defined(__FreeBSD__)
                    238:                default_dosemu_path="/usr/bin/doscmd";
                    239:        #else
                    240:                default_dosemu_path="/usr/bin/dosemu.bin";
                    241:        #endif
                    242: 
                    243:                SAFECOPY(bbs->dosemu_path
                    244:                        ,iniReadString(fp,section,"DOSemuPath",default_dosemu_path,value));
                    245: 
                    246:                SAFECOPY(bbs->answer_sound
                    247:                        ,iniReadString(fp,section,"AnswerSound",nulstr,value));
                    248:                SAFECOPY(bbs->hangup_sound
                    249:                        ,iniReadString(fp,section,"HangupSound",nulstr,value));
                    250: 
                    251:                bbs->log_mask
                    252:                        =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask);
                    253:                bbs->options
                    254:                        =iniReadBitField(fp,section,strOptions,bbs_options
                    255:                                ,BBS_OPT_XTRN_MINIMIZED|BBS_OPT_SYSOP_AVAILABLE);
                    256: 
                    257:                bbs->bind_retry_count=iniReadInteger(fp,section,strBindRetryCount,global->bind_retry_count);
                    258:                bbs->bind_retry_delay=iniReadInteger(fp,section,strBindRetryDelay,global->bind_retry_delay);
                    259:        }
                    260: 
                    261:        /***********************************************************************/
                    262:        if(ftp!=NULL) {
                    263: 
                    264:                section = "FTP";
                    265: 
                    266:                if(run_ftp!=NULL)
                    267:                        *run_ftp=iniReadBool(fp,section,"AutoStart",TRUE);
                    268: 
                    269:                ftp->interface_addr
                    270:                        =iniReadIpAddress(fp,section,strInterface,global->interface_addr);
                    271:                ftp->port
                    272:                        =iniReadShortInt(fp,section,"Port",IPPORT_FTP);
                    273:                ftp->max_clients
                    274:                        =iniReadShortInt(fp,section,"MaxClients",10);
                    275:                ftp->max_inactivity
                    276:                        =iniReadShortInt(fp,section,"MaxInactivity",300);       /* seconds */
                    277:                ftp->qwk_timeout
                    278:                        =iniReadShortInt(fp,section,"QwkTimeout",600);          /* seconds */
                    279:                ftp->sem_chk_freq
                    280:                        =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq);
                    281: 
                    282:                /* JavaScript Operating Parameters */
                    283:                ftp->js_max_bytes
                    284:                        =iniReadInteger(fp,section,strJavaScriptMaxBytes                ,global->js.max_bytes);
                    285:                ftp->js_cx_stack
                    286:                        =iniReadInteger(fp,section,strJavaScriptContextStack    ,global->js.cx_stack);
                    287: 
                    288:                SAFECOPY(ftp->host_name
                    289:                        ,iniReadString(fp,section,strHostName,global->host_name,value));
                    290: 
                    291:                SAFECOPY(ftp->index_file_name
                    292:                        ,iniReadString(fp,section,"IndexFileName","00index",value));
                    293:                SAFECOPY(ftp->html_index_file
                    294:                        ,iniReadString(fp,section,"HtmlIndexFile","00index.html",value));
                    295:                SAFECOPY(ftp->html_index_script
                    296:                        ,iniReadString(fp,section,"HtmlIndexScript","ftp-html.js",value));
                    297: 
                    298:                SAFECOPY(ftp->answer_sound
                    299:                        ,iniReadString(fp,section,"AnswerSound",nulstr,value));
                    300:                SAFECOPY(ftp->hangup_sound
                    301:                        ,iniReadString(fp,section,"HangupSound",nulstr,value));
                    302:                SAFECOPY(ftp->hack_sound
                    303:                        ,iniReadString(fp,section,"HackAttemptSound",nulstr,value));
                    304: 
                    305:                ftp->log_mask
                    306:                        =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask);
                    307:                ftp->options
                    308:                        =iniReadBitField(fp,section,strOptions,ftp_options
                    309:                                ,FTP_OPT_INDEX_FILE|FTP_OPT_HTML_INDEX_FILE|FTP_OPT_ALLOW_QWK);
                    310: 
                    311:                ftp->bind_retry_count=iniReadInteger(fp,section,strBindRetryCount,global->bind_retry_count);
                    312:                ftp->bind_retry_delay=iniReadInteger(fp,section,strBindRetryDelay,global->bind_retry_delay);
                    313:        }
                    314: 
                    315:        /***********************************************************************/
                    316:        if(mail!=NULL) {
                    317: 
                    318:                section = "Mail";
                    319: 
                    320:                if(run_mail!=NULL)
                    321:                        *run_mail=iniReadBool(fp,section,"AutoStart",TRUE);
                    322: 
                    323:                mail->interface_addr
                    324:                        =iniReadIpAddress(fp,section,strInterface,global->interface_addr);
                    325:                mail->smtp_port
                    326:                        =iniReadShortInt(fp,section,"SMTPPort",IPPORT_SMTP);
                    327:                mail->pop3_port
                    328:                        =iniReadShortInt(fp,section,"POP3Port",IPPORT_POP3);
                    329:                mail->relay_port
                    330:                        =iniReadShortInt(fp,section,"RelayPort",IPPORT_SMTP);
                    331:                mail->max_clients
                    332:                        =iniReadShortInt(fp,section,"MaxClients",10);
                    333:                mail->max_inactivity
                    334:                        =iniReadShortInt(fp,section,"MaxInactivity",120);               /* seconds */
                    335:                mail->max_delivery_attempts
                    336:                        =iniReadShortInt(fp,section,"MaxDeliveryAttempts",50);
                    337:                mail->rescan_frequency
                    338:                        =iniReadShortInt(fp,section,"RescanFrequency",3600);    /* 60 minutes */
                    339:                mail->sem_chk_freq
                    340:                        =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq);
                    341:                mail->lines_per_yield
                    342:                        =iniReadShortInt(fp,section,"LinesPerYield",10);
                    343:                mail->max_recipients
                    344:                        =iniReadShortInt(fp,section,"MaxRecipients",100);
                    345:                mail->max_msg_size
                    346:                        =iniReadInteger(fp,section,"MaxMsgSize",DEFAULT_MAX_MSG_SIZE);
                    347: 
                    348:                SAFECOPY(mail->host_name
                    349:                        ,iniReadString(fp,section,strHostName,global->host_name,value));
                    350: 
                    351:                SAFECOPY(mail->relay_server
                    352:                        ,iniReadString(fp,section,"RelayServer",mail->relay_server,value));
                    353:                SAFECOPY(mail->relay_user
                    354:                        ,iniReadString(fp,section,"RelayUsername",mail->relay_user,value));
                    355:                SAFECOPY(mail->relay_pass
                    356:                        ,iniReadString(fp,section,"RelayPassword",mail->relay_pass,value));
                    357: 
                    358:                SAFECOPY(mail->dns_server
                    359:                        ,iniReadString(fp,section,"DNSServer",mail->dns_server,value));
                    360: 
                    361:                SAFECOPY(mail->default_user
                    362:                        ,iniReadString(fp,section,"DefaultUser",nulstr,value));
                    363: 
                    364:                SAFECOPY(mail->dnsbl_hdr
                    365:                        ,iniReadString(fp,section,"DNSBlacklistHeader","X-DNSBL",value));
                    366:                SAFECOPY(mail->dnsbl_tag
                    367:                        ,iniReadString(fp,section,"DNSBlacklistSubject","SPAM",value));
                    368: 
                    369:                SAFECOPY(mail->pop3_sound
                    370:                        ,iniReadString(fp,section,"POP3Sound",nulstr,value));
                    371:                SAFECOPY(mail->inbound_sound
                    372:                        ,iniReadString(fp,section,"InboundSound",nulstr,value));
                    373:                SAFECOPY(mail->outbound_sound
                    374:                        ,iniReadString(fp,section,"OutboundSound",nulstr,value));
                    375: 
                    376:                /* JavaScript Operating Parameters */
                    377:                mail->js_max_bytes
                    378:                        =iniReadInteger(fp,section,strJavaScriptMaxBytes                ,global->js.max_bytes);
                    379:                mail->js_cx_stack
                    380:                        =iniReadInteger(fp,section,strJavaScriptContextStack    ,global->js.cx_stack);
                    381: 
                    382:                mail->log_mask
                    383:                        =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask);
                    384:                mail->options
                    385:                        =iniReadBitField(fp,section,strOptions,mail_options
                    386:                                ,MAIL_OPT_ALLOW_POP3);
                    387: 
                    388:                mail->bind_retry_count=iniReadInteger(fp,section,strBindRetryCount,global->bind_retry_count);
                    389:                mail->bind_retry_delay=iniReadInteger(fp,section,strBindRetryDelay,global->bind_retry_delay);
                    390:        }
                    391: 
                    392:        /***********************************************************************/
                    393:        if(services!=NULL) {
                    394: 
                    395:                section = "Services";
                    396: 
                    397:                if(run_services!=NULL)
                    398:                        *run_services=iniReadBool(fp,section,"AutoStart",TRUE);
                    399: 
                    400:                services->interface_addr
                    401:                        =iniReadIpAddress(fp,section,strInterface,global->interface_addr);
                    402: 
                    403:                services->sem_chk_freq
                    404:                        =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq);
                    405: 
                    406:                /* Configurable JavaScript default parameters */
                    407:                services->js_max_bytes
                    408:                        =iniReadInteger(fp,section,strJavaScriptMaxBytes                ,global->js.max_bytes);
                    409:                services->js_cx_stack
                    410:                        =iniReadInteger(fp,section,strJavaScriptContextStack    ,global->js.cx_stack);
                    411:                services->js_branch_limit
                    412:                        =iniReadInteger(fp,section,strJavaScriptBranchLimit     ,global->js.branch_limit);
                    413:                services->js_gc_interval
                    414:                        =iniReadInteger(fp,section,strJavaScriptGcInterval      ,global->js.gc_interval);
                    415:                services->js_yield_interval
                    416:                        =iniReadInteger(fp,section,strJavaScriptYieldInterval,global->js.yield_interval);
                    417: 
                    418:                SAFECOPY(services->host_name
                    419:                        ,iniReadString(fp,section,strHostName,global->host_name,value));
                    420: 
                    421:                SAFECOPY(services->answer_sound
                    422:                        ,iniReadString(fp,section,"AnswerSound",nulstr,value));
                    423:                SAFECOPY(services->hangup_sound
                    424:                        ,iniReadString(fp,section,"HangupSound",nulstr,value));
                    425: 
                    426:                services->log_mask
                    427:                        =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask);
                    428:                services->options
                    429:                        =iniReadBitField(fp,section,strOptions,service_options
                    430:                                ,BBS_OPT_NO_HOST_LOOKUP);
                    431: 
                    432:                services->bind_retry_count=iniReadInteger(fp,section,strBindRetryCount,global->bind_retry_count);
                    433:                services->bind_retry_delay=iniReadInteger(fp,section,strBindRetryDelay,global->bind_retry_delay);
                    434:        }
                    435: 
                    436:        /***********************************************************************/
                    437:        if(web!=NULL) {
                    438: 
                    439:                section = "Web";
                    440: 
                    441:                if(run_web!=NULL)
                    442:                        *run_web=iniReadBool(fp,section,"AutoStart",FALSE);
                    443: 
                    444:                web->interface_addr
                    445:                        =iniReadIpAddress(fp,section,strInterface,global->interface_addr);
                    446:                web->port
                    447:                        =iniReadShortInt(fp,section,"Port",IPPORT_HTTP);
                    448:                web->max_clients
                    449:                        =iniReadShortInt(fp,section,"MaxClients",10);
                    450:                web->max_inactivity
                    451:                        =iniReadShortInt(fp,section,"MaxInactivity",120);               /* seconds */
                    452:                web->sem_chk_freq
                    453:                        =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq);
                    454: 
                    455:                /* JavaScript Operating Parameters */
                    456:                web->js_max_bytes
                    457:                        =iniReadInteger(fp,section,strJavaScriptMaxBytes                ,global->js.max_bytes);
                    458:                web->js_cx_stack
                    459:                        =iniReadInteger(fp,section,strJavaScriptContextStack    ,global->js.cx_stack);
                    460:                web->js_branch_limit
                    461:                        =iniReadInteger(fp,section,strJavaScriptBranchLimit             ,global->js.branch_limit);
                    462:                web->js_gc_interval
                    463:                        =iniReadInteger(fp,section,strJavaScriptGcInterval              ,global->js.gc_interval);
                    464:                web->js_yield_interval
                    465:                        =iniReadInteger(fp,section,strJavaScriptYieldInterval   ,global->js.yield_interval);
                    466: 
                    467:                SAFECOPY(web->host_name
                    468:                        ,iniReadString(fp,section,strHostName,global->host_name,value));
                    469: 
                    470:                SAFECOPY(web->root_dir
                    471:                        ,iniReadString(fp,section,"RootDirectory",WEB_DEFAULT_ROOT_DIR,value));
                    472:                SAFECOPY(web->error_dir
                    473:                        ,iniReadString(fp,section,"ErrorDirectory",WEB_DEFAULT_ERROR_DIR,value));
                    474:                SAFECOPY(web->cgi_dir
                    475:                        ,iniReadString(fp,section,"CGIDirectory",WEB_DEFAULT_CGI_DIR,value));
                    476:                SAFECOPY(web->logfile_base
                    477:                        ,iniReadString(fp,section,"HttpLogFile",nulstr,value));
                    478: 
                    479:                iniFreeStringList(web->index_file_name);
                    480:                web->index_file_name
                    481:                        =iniReadStringList(fp,section,"IndexFileNames", "," ,"index.html,index.ssjs");
                    482:                iniFreeStringList(web->cgi_ext);
                    483:                web->cgi_ext
                    484:                        =iniReadStringList(fp,section,"CGIExtensions", "," ,".cgi");
                    485:                SAFECOPY(web->ssjs_ext
                    486:                        ,iniReadString(fp,section,"JavaScriptExtension",".ssjs",value));
                    487:                SAFECOPY(web->js_ext
                    488:                        ,iniReadString(fp,section,"EmbJavaScriptExtension",".bbs",value));
                    489: 
                    490:                web->max_inactivity
                    491:                        =iniReadShortInt(fp,section,"MaxInactivity",120);               /* seconds */
                    492:                web->max_cgi_inactivity
                    493:                        =iniReadShortInt(fp,section,"MaxCgiInactivity",120);    /* seconds */
                    494: 
                    495: 
                    496:                default_cgi_temp = _PATH_TMP;
                    497:                SAFECOPY(web->cgi_temp_dir
                    498:                        ,iniReadString(fp,section,"CGITempDirectory",default_cgi_temp,value));
                    499: 
                    500:                web->log_mask
                    501:                        =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask);
                    502:                web->options
                    503:                        =iniReadBitField(fp,section,strOptions,web_options
                    504:                                ,BBS_OPT_NO_HOST_LOOKUP | WEB_OPT_HTTP_LOGGING);
                    505: 
                    506:                web->bind_retry_count=iniReadInteger(fp,section,strBindRetryCount,global->bind_retry_count);
                    507:                web->bind_retry_delay=iniReadInteger(fp,section,strBindRetryDelay,global->bind_retry_delay);
                    508:        }
                    509: }
                    510: 
                    511: BOOL sbbs_write_ini(
                    512:         FILE*                                  fp
                    513:     ,scfg_t*                cfg
                    514:        ,global_startup_t*              global
                    515:        ,BOOL                                   run_bbs
                    516:        ,bbs_startup_t*                 bbs
                    517:        ,BOOL                                   run_ftp
                    518:        ,ftp_startup_t*                 ftp
                    519:        ,BOOL                                   run_web
                    520:        ,web_startup_t*                 web
                    521:        ,BOOL                                   run_mail                
                    522:        ,mail_startup_t*                mail
                    523:        ,BOOL                                   run_services
                    524:        ,services_startup_t*    services
                    525:        )
                    526: {
                    527:        const char*     section;
                    528:        BOOL            result=FALSE;
                    529:        str_list_t      list;
                    530:        str_list_t*     lp;
                    531:        ini_style_t style;
                    532:        global_startup_t        global_buf;
                    533: 
                    534:        if(global==NULL) {
                    535:                read_ini_globals(fp, &global_buf);
                    536:                global = &global_buf;
                    537:        }
                    538:        
                    539:        memset(&style, 0, sizeof(style));
                    540:        style.key_prefix = "\t";
                    541:     style.bit_separator = " | ";
                    542: 
                    543:        if((list=iniReadFile(fp))==NULL)
                    544:                return(FALSE);
                    545:        
                    546:        lp=&list;
                    547: 
                    548:        do { /* try */
                    549: 
                    550:        /***********************************************************************/
                    551:        if(global!=&global_buf) {
                    552:                section = "Global";
                    553: 
                    554:                if(global->ctrl_dir[0]==0)
                    555:                        iniRemoveKey(lp,section,strCtrlDirectory);
                    556:                else
                    557:                        iniSetString(lp,section,strCtrlDirectory,global->ctrl_dir,&style);
                    558: 
                    559:                if(global->temp_dir[0]==0)
                    560:                        iniRemoveKey(lp,section,strTempDirectory);
                    561:                else
                    562:                        iniSetString(lp,section,strTempDirectory,global->temp_dir,&style);
                    563: 
                    564:                if(global->host_name[0]==0)
                    565:                        iniRemoveKey(lp,section,strHostName);
                    566:                else
                    567:                        iniSetString(lp,section,strHostName,global->host_name,&style);
                    568:        
                    569:                if(global->sem_chk_freq==0)
                    570:                        iniRemoveKey(lp,section,strSemFileCheckFrequency);
                    571:                else
                    572:                        iniSetShortInt(lp,section,strSemFileCheckFrequency,global->sem_chk_freq,&style);
                    573:                if(global->interface_addr==INADDR_ANY)
                    574:                        iniRemoveKey(lp,section,strInterface);
                    575:                else
                    576:                        iniSetIpAddress(lp,section,strInterface,global->interface_addr,&style);
                    577:                if(global->log_mask==DEFAULT_LOG_MASK)
                    578:                        iniRemoveKey(lp,section,strLogMask);
                    579:                else
                    580:                        iniSetBitField(lp,section,strLogMask,log_mask_bits,global->log_mask,&style);
                    581: 
                    582:                if(global->bind_retry_count==DEFAULT_BIND_RETRY_COUNT)
                    583:                        iniRemoveKey(lp,section,strBindRetryCount);
                    584:                else
                    585:                        iniSetInteger(lp,section,strBindRetryCount,global->bind_retry_count,&style);
                    586:                if(global->bind_retry_delay==DEFAULT_BIND_RETRY_DELAY)
                    587:                        iniRemoveKey(lp,section,strBindRetryDelay);
                    588:                else
                    589:                        iniSetInteger(lp,section,strBindRetryDelay,global->bind_retry_delay,&style);
                    590: 
                    591:                if(global->js.max_bytes==JAVASCRIPT_MAX_BYTES)
                    592:                        iniRemoveKey(lp,section,strJavaScriptMaxBytes);
                    593:                else
                    594:                        iniSetInteger(lp,section,strJavaScriptMaxBytes,global->js.max_bytes,&style);
                    595:                if(global->js.cx_stack==JAVASCRIPT_CONTEXT_STACK)
                    596:                        iniRemoveKey(lp,section,strJavaScriptContextStack);
                    597:                else
                    598:                        iniSetInteger(lp,section,strJavaScriptContextStack,global->js.cx_stack,&style);
                    599:                if(global->js.branch_limit==JAVASCRIPT_BRANCH_LIMIT)
                    600:                        iniRemoveKey(lp,section,strJavaScriptBranchLimit);
                    601:                else
                    602:                        iniSetInteger(lp,section,strJavaScriptBranchLimit,global->js.branch_limit,&style);
                    603:                if(global->js.gc_interval==JAVASCRIPT_GC_INTERVAL)
                    604:                        iniRemoveKey(lp,section,strJavaScriptGcInterval);
                    605:                else
                    606:                        iniSetInteger(lp,section,strJavaScriptGcInterval,global->js.gc_interval,&style);
                    607:                if(global->js.yield_interval==JAVASCRIPT_YIELD_INTERVAL)
                    608:                        iniRemoveKey(lp,section,strJavaScriptYieldInterval);
                    609:                else
                    610:                        iniSetInteger(lp,section,strJavaScriptYieldInterval,global->js.yield_interval,&style);
                    611:        }
                    612: 
                    613:        /***********************************************************************/
                    614:        if(bbs!=NULL) {
                    615: 
                    616:                section = "BBS";
                    617: 
                    618:                if(!iniSetBool(lp,section,"AutoStart",run_bbs,&style))
                    619:                        break;
                    620: 
                    621:                if(bbs->telnet_interface==global->interface_addr)
                    622:                        iniRemoveValue(lp,section,"TelnetInterface");
                    623:                else if(!iniSetIpAddress(lp,section,"TelnetInterface",bbs->telnet_interface,&style))
                    624:                        break;
                    625: 
                    626:                if(!iniSetShortInt(lp,section,"TelnetPort",bbs->telnet_port,&style))
                    627:                        break;
                    628: 
                    629:                if(bbs->rlogin_interface==global->interface_addr)
                    630:                        iniRemoveValue(lp,section,"RLoginInterface");
                    631:                else if(!iniSetIpAddress(lp,section,"RLoginInterface",bbs->rlogin_interface,&style))
                    632:                        break;
                    633: 
                    634:                if(!iniSetShortInt(lp,section,"RLoginPort",bbs->rlogin_port,&style))
                    635:                        break;
                    636:                if(!iniSetShortInt(lp,section,"FirstNode",bbs->first_node,&style))
                    637:                        break;
                    638:                if(!iniSetShortInt(lp,section,"LastNode",bbs->last_node,&style))
                    639:                        break;
                    640:                if(!iniSetShortInt(lp,section,"OutbufHighwaterMark",bbs->outbuf_highwater_mark,&style))
                    641:                        break;
                    642:                if(!iniSetShortInt(lp,section,"OutbufDrainTimeout",bbs->outbuf_drain_timeout,&style))
                    643:                        break;
                    644: 
                    645:                if(bbs->sem_chk_freq==global->sem_chk_freq)
                    646:                        iniRemoveValue(lp,section,strSemFileCheckFrequency);
                    647:                else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,bbs->sem_chk_freq,&style))
                    648:                        break;
                    649: 
                    650:                if(bbs->log_mask==global->log_mask)
                    651:                        iniRemoveValue(lp,section,strLogMask);
                    652:                else if(!iniSetBitField(lp,section,strLogMask,log_mask_bits,bbs->log_mask,&style))
                    653:                        break;
                    654: 
                    655:                if(!iniSetInteger(lp,section,"ExternalYield",bbs->xtrn_polls_before_yield,&style))
                    656:                        break;
                    657: 
                    658:                /* JavaScript operating parameters */
                    659:                
                    660:                if(bbs->js_max_bytes==global->js.max_bytes)
                    661:                        iniRemoveValue(lp,section,strJavaScriptMaxBytes);
                    662:                else if(!iniSetInteger(lp,section,strJavaScriptMaxBytes         ,bbs->js_max_bytes,&style))
                    663:                        break;
                    664: 
                    665:                if(bbs->js_cx_stack==global->js.cx_stack)
                    666:                        iniRemoveValue(lp,section,strJavaScriptContextStack);
                    667:                else if(!iniSetInteger(lp,section,strJavaScriptContextStack     ,bbs->js_cx_stack,&style))
                    668:                        break;
                    669: 
                    670:                if(bbs->js_branch_limit==global->js.branch_limit)
                    671:                        iniRemoveValue(lp,section,strJavaScriptBranchLimit);
                    672:                else if(!iniSetInteger(lp,section,strJavaScriptBranchLimit      ,bbs->js_branch_limit,&style))
                    673:                        break;
                    674: 
                    675:                if(bbs->js_gc_interval==global->js.gc_interval)
                    676:                        iniRemoveValue(lp,section,strJavaScriptGcInterval);
                    677:                else if(!iniSetInteger(lp,section,strJavaScriptGcInterval       ,bbs->js_gc_interval,&style))
                    678:                        break;
                    679: 
                    680:                if(bbs->js_yield_interval==global->js.yield_interval)
                    681:                        iniRemoveValue(lp,section,strJavaScriptYieldInterval);
                    682:                else if(!iniSetInteger(lp,section,strJavaScriptYieldInterval,bbs->js_yield_interval,&style))
                    683:                        break;
                    684: 
                    685:                if(strcmp(bbs->host_name,global->host_name)==0
                    686:             || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
                    687:                        iniRemoveKey(lp,section,strHostName);
                    688:                else if(!iniSetString(lp,section,strHostName,bbs->host_name,&style))
                    689:                        break;
                    690: 
                    691:                if(!iniSetString(lp,section,"ExternalTermANSI",bbs->xtrn_term_ansi,&style))
                    692:                        break;
                    693:                if(!iniSetString(lp,section,"ExternalTermDumb",bbs->xtrn_term_dumb,&style))
                    694:                        break;
                    695:                if(!iniSetString(lp,section,"DOSemuPath",bbs->dosemu_path,&style))
                    696:                        break;
                    697: 
                    698:                if(!iniSetString(lp,section,"AnswerSound",bbs->answer_sound,&style))
                    699:                        break;
                    700:                if(!iniSetString(lp,section,"HangupSound",bbs->hangup_sound,&style))
                    701:                        break;
                    702: 
                    703:                if(!iniSetBitField(lp,section,strOptions,bbs_options,bbs->options,&style))
                    704:                        break;
                    705: 
                    706:                if(bbs->bind_retry_count==global->bind_retry_count)
                    707:                        iniRemoveValue(lp,section,strBindRetryCount);
                    708:                else if(!iniSetInteger(lp,section,strBindRetryCount,bbs->bind_retry_count,&style))
                    709:                        break;
                    710:                if(bbs->bind_retry_delay==global->bind_retry_delay)
                    711:                        iniRemoveValue(lp,section,strBindRetryCount);
                    712:                else if(!iniSetInteger(lp,section,strBindRetryDelay,bbs->bind_retry_delay,&style))
                    713:                        break;
                    714:        }
                    715:        /***********************************************************************/
                    716:        if(ftp!=NULL) {
                    717: 
                    718:                section = "FTP";
                    719: 
                    720:                if(!iniSetBool(lp,section,"AutoStart",run_ftp,&style))
                    721:                        break;
                    722: 
                    723:                if(ftp->interface_addr==global->interface_addr)
                    724:                        iniRemoveValue(lp,section,strInterface);
                    725:                else if(!iniSetIpAddress(lp,section,strInterface,ftp->interface_addr,&style))
                    726:                        break;
                    727: 
                    728:                if(!iniSetShortInt(lp,section,"Port",ftp->port,&style))
                    729:                        break;
                    730:                if(!iniSetShortInt(lp,section,"MaxClients",ftp->max_clients,&style))
                    731:                        break;
                    732:                if(!iniSetShortInt(lp,section,"MaxInactivity",ftp->max_inactivity,&style))
                    733:                        break;
                    734:                if(!iniSetShortInt(lp,section,"QwkTimeout",ftp->qwk_timeout,&style))
                    735:                        break;
                    736: 
                    737:                if(ftp->sem_chk_freq==global->sem_chk_freq)
                    738:                        iniRemoveValue(lp,section,strSemFileCheckFrequency);
                    739:                else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,ftp->sem_chk_freq,&style))
                    740:                        break;
                    741: 
                    742:                if(ftp->log_mask==global->log_mask)
                    743:                        iniRemoveValue(lp,section,strLogMask);
                    744:                else if(!iniSetBitField(lp,section,strLogMask,log_mask_bits,ftp->log_mask,&style))
                    745:                        break;
                    746: 
                    747:                /* JavaScript Operating Parameters */
                    748:                
                    749:                if(ftp->js_max_bytes==global->js.max_bytes)
                    750:                        iniRemoveValue(lp,section,strJavaScriptMaxBytes);
                    751:                else if(!iniSetInteger(lp,section,strJavaScriptMaxBytes         ,ftp->js_max_bytes,&style))
                    752:                        break;
                    753: 
                    754:                if(ftp->js_cx_stack==global->js.cx_stack)
                    755:                        iniRemoveValue(lp,section,strJavaScriptContextStack);
                    756:                else if(!iniSetInteger(lp,section,strJavaScriptContextStack     ,ftp->js_cx_stack,&style))
                    757:                        break;
                    758: 
                    759:                if(strcmp(ftp->host_name,global->host_name)==0
                    760:             || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
                    761:                        iniRemoveKey(lp,section,strHostName);
                    762:                else if(!iniSetString(lp,section,strHostName,ftp->host_name,&style))
                    763:                        break;
                    764: 
                    765:                if(!iniSetString(lp,section,"IndexFileName",ftp->index_file_name,&style))
                    766:                        break;
                    767:                if(!iniSetString(lp,section,"HtmlIndexFile",ftp->html_index_file,&style))
                    768:                        break;
                    769:                if(!iniSetString(lp,section,"HtmlIndexScript",ftp->html_index_script,&style))
                    770:                        break;
                    771: 
                    772:                if(!iniSetString(lp,section,"AnswerSound",ftp->answer_sound,&style))
                    773:                        break;
                    774:                if(!iniSetString(lp,section,"HangupSound",ftp->hangup_sound,&style))
                    775:                        break;
                    776:                if(!iniSetString(lp,section,"HackAttemptSound",ftp->hack_sound,&style))
                    777:                        break;
                    778:        
                    779:                if(!iniSetBitField(lp,section,strOptions,ftp_options,ftp->options,&style))
                    780:                        break;
                    781: 
                    782:                if(ftp->bind_retry_count==global->bind_retry_count)
                    783:                        iniRemoveValue(lp,section,strBindRetryCount);
                    784:                else if(!iniSetInteger(lp,section,strBindRetryCount,ftp->bind_retry_count,&style))
                    785:                        break;
                    786:                if(ftp->bind_retry_delay==global->bind_retry_delay)
                    787:                        iniRemoveValue(lp,section,strBindRetryCount);
                    788:                else if(!iniSetInteger(lp,section,strBindRetryDelay,ftp->bind_retry_delay,&style))
                    789:                        break;
                    790:        }
                    791: 
                    792:        /***********************************************************************/
                    793:        if(mail!=NULL) {
                    794: 
                    795:                section = "Mail";
                    796: 
                    797:                if(!iniSetBool(lp,section,"AutoStart",run_mail,&style))
                    798:                        break;
                    799: 
                    800:                if(mail->interface_addr==global->interface_addr)
                    801:                        iniRemoveValue(lp,section,strInterface);
                    802:                else if(!iniSetIpAddress(lp,section,strInterface,mail->interface_addr,&style))
                    803:                        break;
                    804: 
                    805:                if(mail->sem_chk_freq==global->sem_chk_freq)
                    806:                        iniRemoveValue(lp,section,strSemFileCheckFrequency);
                    807:                else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,mail->sem_chk_freq,&style))
                    808:                        break;
                    809: 
                    810:                if(mail->log_mask==global->log_mask)
                    811:                        iniRemoveValue(lp,section,strLogMask);
                    812:                else if(!iniSetBitField(lp,section,strLogMask,log_mask_bits,mail->log_mask,&style))
                    813:                        break;
                    814: 
                    815:                if(!iniSetShortInt(lp,section,"SMTPPort",mail->smtp_port,&style))
                    816:                        break;
                    817:                if(!iniSetShortInt(lp,section,"POP3Port",mail->pop3_port,&style))
                    818:                        break;
                    819:                if(!iniSetShortInt(lp,section,"RelayPort",mail->relay_port,&style))
                    820:                        break;
                    821:                if(!iniSetShortInt(lp,section,"MaxClients",mail->max_clients,&style))
                    822:                        break;
                    823:                if(!iniSetShortInt(lp,section,"MaxInactivity",mail->max_inactivity,&style))
                    824:                        break;
                    825:                if(!iniSetShortInt(lp,section,"MaxDeliveryAttempts",mail->max_delivery_attempts,&style))
                    826:                        break;
                    827:                if(!iniSetShortInt(lp,section,"RescanFrequency",mail->rescan_frequency,&style))
                    828:                        break;
                    829:                if(!iniSetShortInt(lp,section,"LinesPerYield",mail->lines_per_yield,&style))
                    830:                        break;
                    831:                if(!iniSetShortInt(lp,section,"MaxRecipients",mail->max_recipients,&style))
                    832:                        break;
                    833:                if(!iniSetInteger(lp,section,"MaxMsgSize",mail->max_msg_size,&style))
                    834:                        break;
                    835: 
                    836:                if(strcmp(mail->host_name,global->host_name)==0
                    837:             || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
                    838:                        iniRemoveKey(lp,section,strHostName);
                    839:                else if(!iniSetString(lp,section,strHostName,mail->host_name,&style))
                    840:                        break;
                    841: 
                    842:                if(!iniSetString(lp,section,"RelayServer",mail->relay_server,&style))
                    843:                        break;
                    844:                if(!iniSetString(lp,section,"RelayUsername",mail->relay_user,&style))
                    845:                        break;
                    846:                if(!iniSetString(lp,section,"RelayPassword",mail->relay_pass,&style))
                    847:                        break;
                    848: 
                    849:                if(!iniSetString(lp,section,"DNSServer",mail->dns_server,&style))
                    850:                        break;
                    851: 
                    852:                if(!iniSetString(lp,section,"DefaultUser",mail->default_user,&style))
                    853:                        break;
                    854: 
                    855:                if(!iniSetString(lp,section,"DNSBlacklistHeader",mail->dnsbl_hdr,&style))
                    856:                        break;
                    857:                if(!iniSetString(lp,section,"DNSBlacklistSubject",mail->dnsbl_tag,&style))
                    858:                        break;
                    859: 
                    860:                if(!iniSetString(lp,section,"POP3Sound",mail->pop3_sound,&style))
                    861:                        break;
                    862:                if(!iniSetString(lp,section,"InboundSound",mail->inbound_sound,&style))
                    863:                        break;
                    864:                if(!iniSetString(lp,section,"OutboundSound",mail->outbound_sound,&style))
                    865:                        break;
                    866: 
                    867:                /* JavaScript Operating Parameters */
                    868:                if(mail->js_max_bytes==global->js.max_bytes)
                    869:                        iniRemoveValue(lp,section,strJavaScriptMaxBytes);
                    870:                else if(!iniSetInteger(lp,section,strJavaScriptMaxBytes         ,mail->js_max_bytes,&style))
                    871:                        break;
                    872: 
                    873:                if(mail->js_cx_stack==global->js.cx_stack)
                    874:                        iniRemoveValue(lp,section,strJavaScriptContextStack);
                    875:                else if(!iniSetInteger(lp,section,strJavaScriptContextStack     ,mail->js_cx_stack,&style))
                    876:                        break;
                    877: 
                    878:                if(!iniSetBitField(lp,section,strOptions,mail_options,mail->options,&style))
                    879:                        break;
                    880: 
                    881:                if(mail->bind_retry_count==global->bind_retry_count)
                    882:                        iniRemoveValue(lp,section,strBindRetryCount);
                    883:                else if(!iniSetInteger(lp,section,strBindRetryCount,mail->bind_retry_count,&style))
                    884:                        break;
                    885:                if(mail->bind_retry_delay==global->bind_retry_delay)
                    886:                        iniRemoveValue(lp,section,strBindRetryCount);
                    887:                else if(!iniSetInteger(lp,section,strBindRetryDelay,mail->bind_retry_delay,&style))
                    888:                        break;
                    889:        }
                    890: 
                    891:        /***********************************************************************/
                    892:        if(services!=NULL) {
                    893: 
                    894:                section = "Services";
                    895: 
                    896:                if(!iniSetBool(lp,section,"AutoStart",run_services,&style))
                    897:                        break;
                    898: 
                    899:                if(services->interface_addr==global->interface_addr)
                    900:                        iniRemoveValue(lp,section,strInterface);
                    901:                else if(!iniSetIpAddress(lp,section,strInterface,services->interface_addr,&style))
                    902:                        break;
                    903: 
                    904:                if(services->sem_chk_freq==global->sem_chk_freq)
                    905:                        iniRemoveValue(lp,section,strSemFileCheckFrequency);
                    906:                else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,services->sem_chk_freq,&style))
                    907:                        break;
                    908: 
                    909:                if(services->log_mask==global->log_mask)
                    910:                        iniRemoveValue(lp,section,strLogMask);
                    911:                else if(!iniSetBitField(lp,section,strLogMask,log_mask_bits,services->log_mask,&style))
                    912:                        break;
                    913: 
                    914:                /* Configurable JavaScript default parameters */
                    915:                if(services->js_max_bytes==global->js.max_bytes)
                    916:                        iniRemoveValue(lp,section,strJavaScriptMaxBytes);
                    917:                else if(!iniSetInteger(lp,section,strJavaScriptMaxBytes         ,services->js_max_bytes,&style))
                    918:                        break;
                    919: 
                    920:                if(services->js_cx_stack==global->js.cx_stack)
                    921:                        iniRemoveValue(lp,section,strJavaScriptContextStack);
                    922:                else if(!iniSetInteger(lp,section,strJavaScriptContextStack     ,services->js_cx_stack,&style))
                    923:                        break;
                    924: 
                    925:                if(services->js_branch_limit==global->js.branch_limit)
                    926:                        iniRemoveValue(lp,section,strJavaScriptBranchLimit);
                    927:                else if(!iniSetInteger(lp,section,strJavaScriptBranchLimit      ,services->js_branch_limit,&style))
                    928:                        break;
                    929: 
                    930:                if(services->js_gc_interval==global->js.gc_interval)
                    931:                        iniRemoveValue(lp,section,strJavaScriptGcInterval);
                    932:                else if(!iniSetInteger(lp,section,strJavaScriptGcInterval       ,services->js_gc_interval,&style))
                    933:                        break;
                    934: 
                    935:                if(services->js_yield_interval==global->js.yield_interval)
                    936:                        iniRemoveValue(lp,section,strJavaScriptYieldInterval);
                    937:                else if(!iniSetInteger(lp,section,strJavaScriptYieldInterval    ,services->js_yield_interval,&style))
                    938:                        break;
                    939: 
                    940:                if(strcmp(services->host_name,global->host_name)==0
                    941:             || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
                    942:                        iniRemoveKey(lp,section,strHostName);
                    943:                else if(!iniSetString(lp,section,strHostName,services->host_name,&style))
                    944:                        break;
                    945: 
                    946:                if(!iniSetString(lp,section,"AnswerSound",services->answer_sound,&style))
                    947:                        break;
                    948:                if(!iniSetString(lp,section,"HangupSound",services->hangup_sound,&style))
                    949:                        break;
                    950: 
                    951:                if(!iniSetBitField(lp,section,strOptions,service_options,services->options,&style))
                    952:                        break;
                    953: 
                    954:                if(services->bind_retry_count==global->bind_retry_count)
                    955:                        iniRemoveValue(lp,section,strBindRetryCount);
                    956:                else if(!iniSetInteger(lp,section,strBindRetryCount,services->bind_retry_count,&style))
                    957:                        break;
                    958:                if(services->bind_retry_delay==global->bind_retry_delay)
                    959:                        iniRemoveValue(lp,section,strBindRetryCount);
                    960:                else if(!iniSetInteger(lp,section,strBindRetryDelay,services->bind_retry_delay,&style))
                    961:                        break;
                    962:        }
                    963: 
                    964:        /***********************************************************************/
                    965:        if(web!=NULL) {
                    966: 
                    967:                section = "Web";
                    968: 
                    969:                if(!iniSetBool(lp,section,"AutoStart",run_web,&style))
                    970:                        break;
                    971: 
                    972:                if(web->interface_addr==global->interface_addr)
                    973:                        iniRemoveValue(lp,section,strInterface);
                    974:                else if(!iniSetIpAddress(lp,section,strInterface,web->interface_addr,&style))
                    975:                        break;
                    976: 
                    977:                if(!iniSetShortInt(lp,section,"Port",web->port,&style))
                    978:                        break;
                    979:                if(!iniSetShortInt(lp,section,"MaxClients",web->max_clients,&style))
                    980:                        break;
                    981:                if(!iniSetShortInt(lp,section,"MaxInactivity",web->max_inactivity,&style))
                    982:                        break;
                    983: 
                    984:                if(web->sem_chk_freq==global->sem_chk_freq)
                    985:                        iniRemoveValue(lp,section,strSemFileCheckFrequency);
                    986:                else if(!iniSetShortInt(lp,section,strSemFileCheckFrequency,web->sem_chk_freq,&style))
                    987:                        break;
                    988: 
                    989:                if(web->log_mask==global->log_mask)
                    990:                        iniRemoveValue(lp,section,strLogMask);
                    991:                else if(!iniSetBitField(lp,section,strLogMask,log_mask_bits,web->log_mask,&style))
                    992:                        break;
                    993: 
                    994:                /* JavaScript Operating Parameters */
                    995:                if(web->js_max_bytes==global->js.max_bytes)
                    996:                        iniRemoveValue(lp,section,strJavaScriptMaxBytes);
                    997:                else if(!iniSetInteger(lp,section,strJavaScriptMaxBytes         ,web->js_max_bytes,&style))
                    998:                        break;
                    999: 
                   1000:                if(web->js_cx_stack==global->js.cx_stack)
                   1001:                        iniRemoveValue(lp,section,strJavaScriptContextStack);
                   1002:                else if(!iniSetInteger(lp,section,strJavaScriptContextStack     ,web->js_cx_stack,&style))
                   1003:                        break;
                   1004: 
                   1005:                if(web->js_branch_limit==global->js.branch_limit)
                   1006:                        iniRemoveValue(lp,section,strJavaScriptBranchLimit);
                   1007:                else if(!iniSetInteger(lp,section,strJavaScriptBranchLimit      ,web->js_branch_limit,&style))
                   1008:                        break;
                   1009: 
                   1010:                if(web->js_gc_interval==global->js.gc_interval)
                   1011:                        iniRemoveValue(lp,section,strJavaScriptGcInterval);
                   1012:                else if(!iniSetInteger(lp,section,strJavaScriptGcInterval       ,web->js_gc_interval,&style))
                   1013:                        break;
                   1014: 
                   1015:                if(web->js_yield_interval==global->js.yield_interval)
                   1016:                        iniRemoveValue(lp,section,strJavaScriptYieldInterval);
                   1017:                else if(!iniSetInteger(lp,section,strJavaScriptYieldInterval,web->js_yield_interval,&style))
                   1018:                        break;
                   1019: 
                   1020:                if(strcmp(web->host_name,global->host_name)==0
                   1021:             || strcmp(bbs->host_name,cfg->sys_inetaddr)==0)
                   1022:                        iniRemoveKey(lp,section,strHostName);
                   1023:                else if(!iniSetString(lp,section,strHostName,web->host_name,&style))
                   1024:                        break;
                   1025: 
                   1026:                if(!iniSetString(lp,section,"RootDirectory",web->root_dir,&style))
                   1027:                        break;
                   1028:                if(!iniSetString(lp,section,"ErrorDirectory",web->error_dir,&style))
                   1029:                        break;
                   1030:                if(!iniSetString(lp,section,"CGIDirectory",web->cgi_dir,&style))
                   1031:                        break;
                   1032: 
                   1033:                if(!iniSetStringList(lp,section,"IndexFileNames", "," ,web->index_file_name,&style))
                   1034:                        break;
                   1035:                if(!iniSetStringList(lp,section,"CGIExtensions", "," ,web->cgi_ext,&style))
                   1036:                        break;
                   1037: 
                   1038:                if(!iniSetString(lp,section,"JavaScriptExtension",web->ssjs_ext,&style))
                   1039:                        break;
                   1040: 
                   1041:                if(!iniSetShortInt(lp,section,"MaxInactivity",web->max_inactivity,&style))
                   1042:                        break;
                   1043:                if(!iniSetShortInt(lp,section,"MaxCgiInactivity",web->max_cgi_inactivity,&style))
                   1044:                        break;
                   1045: 
                   1046:                if(!iniSetString(lp,section,"CGITempDirectory",web->cgi_temp_dir,&style))
                   1047:                        break;
                   1048: 
                   1049:                if(!iniSetBitField(lp,section,strOptions,web_options,web->options,&style))
                   1050:                        break;
                   1051: 
                   1052:                if(web->bind_retry_count==global->bind_retry_count)
                   1053:                        iniRemoveValue(lp,section,strBindRetryCount);
                   1054:                else if(!iniSetInteger(lp,section,strBindRetryCount,web->bind_retry_count,&style))
                   1055:                        break;
                   1056:                if(web->bind_retry_delay==global->bind_retry_delay)
                   1057:                        iniRemoveValue(lp,section,strBindRetryCount);
                   1058:                else if(!iniSetInteger(lp,section,strBindRetryDelay,web->bind_retry_delay,&style))
                   1059:                        break;
                   1060:        }
                   1061: 
                   1062:        /***********************************************************************/
                   1063:        result=iniWriteFile(fp,list);
                   1064: 
                   1065:        } while(0);     /* finally */
                   1066: 
                   1067:        strListFree(&list);
                   1068: 
                   1069:        return(result);
                   1070: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.