|
|
1.1 ! root 1: /* rechocfg.C */ ! 2: ! 3: /* Synchronet FidoNet EchoMail Scanning/Tossing and NetMail Tossing Utility */ ! 4: ! 5: /* $Id: rechocfg.c,v 1.22 2006/12/29 01:23:41 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 2000 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: /* Portions written by Allen Christiansen 1994-1996 */ ! 39: ! 40: #include <time.h> ! 41: #include <errno.h> ! 42: #include <stdio.h> ! 43: #include <ctype.h> ! 44: #include <fcntl.h> ! 45: #include <stdarg.h> ! 46: #include <stdlib.h> ! 47: #include <string.h> ! 48: #include <sys/stat.h> ! 49: ! 50: #include "sbbs.h" ! 51: #include "sbbsecho.h" ! 52: #include "filewrap.h" /* O_DENYNONE */ ! 53: ! 54: #ifdef __WATCOMC__ ! 55: #include <mem.h> ! 56: #define O_DENYNONE SH_DENYNO ! 57: #endif ! 58: ! 59: extern long misc; ! 60: extern config_t cfg; ! 61: ! 62: /****************************************************************************** ! 63: Here we take a string and put a terminator in place of the first TAB or SPACE ! 64: ******************************************************************************/ ! 65: char *cleanstr(char *instr) ! 66: { ! 67: int i; ! 68: ! 69: for(i=0;instr[i];i++) ! 70: if((uchar)instr[i]<=' ') ! 71: break; ! 72: instr[i]=0; ! 73: return(instr); ! 74: } ! 75: ! 76: /****************************************************************************/ ! 77: /* Returns the FidoNet address kept in str as ASCII. */ ! 78: /****************************************************************************/ ! 79: faddr_t atofaddr(char *instr) ! 80: { ! 81: char *p,str[51]; ! 82: faddr_t addr; ! 83: ! 84: sprintf(str,"%.50s",instr); ! 85: cleanstr(str); ! 86: if(!stricmp(str,"ALL")) { ! 87: addr.zone=addr.net=addr.node=addr.point=0xffff; ! 88: return(addr); } ! 89: addr.zone=addr.net=addr.node=addr.point=0; ! 90: if((p=strchr(str,':'))!=NULL) { ! 91: if(!strnicmp(str,"ALL:",4)) ! 92: addr.zone=0xffff; ! 93: else ! 94: addr.zone=atoi(str); ! 95: p++; ! 96: if(!strnicmp(p,"ALL",3)) ! 97: addr.net=0xffff; ! 98: else ! 99: addr.net=atoi(p); } ! 100: else { ! 101: #ifdef SCFG ! 102: if(total_faddrs) ! 103: addr.zone=faddr[0].zone; ! 104: else ! 105: #endif ! 106: addr.zone=1; ! 107: addr.net=atoi(str); } ! 108: if(!addr.zone) /* no such thing as zone 0 */ ! 109: addr.zone=1; ! 110: if((p=strchr(str,'/'))!=NULL) { ! 111: p++; ! 112: if(!strnicmp(p,"ALL",3)) ! 113: addr.node=0xffff; ! 114: else ! 115: addr.node=atoi(p); } ! 116: else { ! 117: if(!addr.net) { ! 118: #ifdef SCFG ! 119: if(total_faddrs) ! 120: addr.net=faddr[0].net; ! 121: else ! 122: #endif ! 123: addr.net=1; } ! 124: addr.node=atoi(str); } ! 125: if((p=strchr(str,'.'))!=NULL) { ! 126: p++; ! 127: if(!strnicmp(p,"ALL",3)) ! 128: addr.point=0xffff; ! 129: else ! 130: addr.point=atoi(p); } ! 131: return(addr); ! 132: } ! 133: ! 134: /****************************************************************************** ! 135: This function returns the number of the node in the SBBSECHO.CFG file which ! 136: matches the address passed to it (or cfg.nodecfgs if no match). ! 137: ******************************************************************************/ ! 138: int matchnode(faddr_t addr, int exact) ! 139: { ! 140: int i; ! 141: ! 142: if(exact!=2) { ! 143: for(i=0;i<cfg.nodecfgs;i++) /* Look for exact match */ ! 144: if(!memcmp(&cfg.nodecfg[i].faddr,&addr,sizeof(faddr_t))) ! 145: break; ! 146: if(exact || i<cfg.nodecfgs) ! 147: return(i); } ! 148: ! 149: for(i=0;i<cfg.nodecfgs;i++) /* Look for point match */ ! 150: if(cfg.nodecfg[i].faddr.point==0xffff ! 151: && addr.zone==cfg.nodecfg[i].faddr.zone ! 152: && addr.net==cfg.nodecfg[i].faddr.net ! 153: && addr.node==cfg.nodecfg[i].faddr.node) ! 154: break; ! 155: if(i<cfg.nodecfgs) ! 156: return(i); ! 157: ! 158: for(i=0;i<cfg.nodecfgs;i++) /* Look for node match */ ! 159: if(cfg.nodecfg[i].faddr.node==0xffff ! 160: && addr.zone==cfg.nodecfg[i].faddr.zone ! 161: && addr.net==cfg.nodecfg[i].faddr.net) ! 162: break; ! 163: if(i<cfg.nodecfgs) ! 164: return(i); ! 165: ! 166: for(i=0;i<cfg.nodecfgs;i++) /* Look for net match */ ! 167: if(cfg.nodecfg[i].faddr.net==0xffff ! 168: && addr.zone==cfg.nodecfg[i].faddr.zone) ! 169: break; ! 170: if(i<cfg.nodecfgs) ! 171: return(i); ! 172: ! 173: for(i=0;i<cfg.nodecfgs;i++) /* Look for total wild */ ! 174: if(cfg.nodecfg[i].faddr.zone==0xffff) ! 175: break; ! 176: return(i); ! 177: } ! 178: ! 179: void read_echo_cfg() ! 180: { ! 181: uchar str[1025],tmp[512],*p,*tp; ! 182: short attr=0; ! 183: int i,j,file; ! 184: FILE *stream; ! 185: faddr_t addr,route_addr; ! 186: ! 187: ! 188: /****** READ IN SBBSECHO.CFG FILE *******/ ! 189: ! 190: printf("\nReading %s\n",cfg.cfgfile); ! 191: if((stream=fnopen(&file,cfg.cfgfile,O_RDONLY))==NULL) { ! 192: printf("Unable to open %s for read.\n",cfg.cfgfile); ! 193: bail(1); } ! 194: ! 195: cfg.maxpktsize=DFLT_PKT_SIZE; ! 196: cfg.maxbdlsize=DFLT_BDL_SIZE; ! 197: cfg.badecho=-1; ! 198: cfg.log=LOG_DEFAULTS; ! 199: cfg.check_path=TRUE; ! 200: ! 201: while(1) { ! 202: if(!fgets(str,256,stream)) ! 203: break; ! 204: truncsp(str); ! 205: p=str; ! 206: while(*p && *p<=' ') p++; ! 207: if(*p==';') ! 208: continue; ! 209: sprintf(tmp,"%-.25s",p); ! 210: tp=strchr(tmp,' '); ! 211: if(tp) ! 212: *tp=0; /* Chop off at space */ ! 213: #if 0 ! 214: strupr(tmp); /* Convert code to uppercase */ ! 215: #endif ! 216: while(*p>' ') p++; /* Skip code */ ! 217: while(*p && *p<=' ') p++; /* Skip white space */ ! 218: ! 219: if(!stricmp(tmp,"PACKER")) { /* Archive Definition */ ! 220: if((cfg.arcdef=(arcdef_t *)realloc(cfg.arcdef ! 221: ,sizeof(arcdef_t)*(cfg.arcdefs+1)))==NULL) { ! 222: printf("\nError allocating %u bytes of memory for arcdef #%u.\n" ! 223: ,sizeof(arcdef_t)*(cfg.arcdefs+1),cfg.arcdefs+1); ! 224: bail(1); } ! 225: sprintf(cfg.arcdef[cfg.arcdefs].name,"%-.25s",p); ! 226: tp=cfg.arcdef[cfg.arcdefs].name; ! 227: while(*tp && *tp>' ') tp++; ! 228: *tp=0; ! 229: while(*p && *p>' ') p++; ! 230: while(*p && *p<=' ') p++; ! 231: cfg.arcdef[cfg.arcdefs].byteloc=atoi(p); ! 232: while(*p && *p>' ') p++; ! 233: while(*p && *p<=' ') p++; ! 234: sprintf(cfg.arcdef[cfg.arcdefs].hexid,"%-.25s",p); ! 235: tp=cfg.arcdef[cfg.arcdefs].hexid; ! 236: while(*tp && *tp>' ') tp++; ! 237: *tp=0; ! 238: while(fgets(str,256,stream) && strnicmp(str,"END",3)) { ! 239: p=str; ! 240: while(*p && *p<=' ') p++; ! 241: if(!strnicmp(p,"PACK ",5)) { ! 242: p+=5; ! 243: while(*p && *p<=' ') p++; ! 244: sprintf(cfg.arcdef[cfg.arcdefs].pack,"%-.80s",p); ! 245: truncsp(cfg.arcdef[cfg.arcdefs].pack); ! 246: continue; } ! 247: if(!strnicmp(p,"UNPACK ",7)) { ! 248: p+=7; ! 249: while(*p && *p<=' ') p++; ! 250: sprintf(cfg.arcdef[cfg.arcdefs].unpack,"%-.80s",p); ! 251: truncsp(cfg.arcdef[cfg.arcdefs].unpack); } } ! 252: ++cfg.arcdefs; ! 253: continue; } ! 254: ! 255: if(!stricmp(tmp,"REGNUM")) ! 256: continue; ! 257: ! 258: if(!stricmp(tmp,"NOPATHCHECK")) { ! 259: cfg.check_path=FALSE; ! 260: continue; ! 261: } ! 262: ! 263: if(!stricmp(tmp,"NOTIFY")) { ! 264: cfg.notify=atoi(cleanstr(p)); ! 265: continue; } ! 266: ! 267: if(!stricmp(tmp,"LOG")) { ! 268: cleanstr(p); ! 269: if(!stricmp(p,"ALL")) ! 270: cfg.log=0xffffffffUL; ! 271: else if(!stricmp(p,"DEFAULT")) ! 272: cfg.log=LOG_DEFAULTS; ! 273: else if(!stricmp(p,"NONE")) ! 274: cfg.log=0L; ! 275: else ! 276: cfg.log=strtol(cleanstr(p),0,16); ! 277: continue; } ! 278: ! 279: if(!stricmp(tmp,"NOSWAP")) { ! 280: continue; } ! 281: ! 282: if(!stricmp(tmp,"SECURE_ECHOMAIL")) { ! 283: misc|=SECURE; ! 284: continue; } ! 285: ! 286: if(!stricmp(tmp,"STRIP_LF")) { ! 287: misc|=STRIP_LF; ! 288: continue; } ! 289: ! 290: if(!stricmp(tmp,"STORE_SEENBY")) { ! 291: misc|=STORE_SEENBY; ! 292: continue; } ! 293: ! 294: if(!stricmp(tmp,"STORE_PATH")) { ! 295: misc|=STORE_PATH; ! 296: continue; } ! 297: ! 298: if(!stricmp(tmp,"STORE_KLUDGE")) { ! 299: misc|=STORE_KLUDGE; ! 300: continue; } ! 301: ! 302: if(!stricmp(tmp,"FUZZY_ZONE")) { ! 303: misc|=FUZZY_ZONE; ! 304: continue; } ! 305: ! 306: if(!stricmp(tmp,"TRUNC_BUNDLES")) { ! 307: misc|=TRUNC_BUNDLES; ! 308: continue; } ! 309: ! 310: if(!stricmp(tmp,"FLO_MAILER")) { ! 311: misc|=FLO_MAILER; ! 312: continue; } ! 313: ! 314: if(!stricmp(tmp,"ELIST_ONLY")) { ! 315: misc|=ELIST_ONLY; ! 316: continue; } ! 317: ! 318: if(!stricmp(tmp,"KILL_EMPTY")) { ! 319: misc|=KILL_EMPTY_MAIL; ! 320: continue; } ! 321: ! 322: if(!stricmp(tmp,"AREAFILE")) { ! 323: sprintf(cfg.areafile,"%-.80s",cleanstr(p)); ! 324: continue; } ! 325: ! 326: if(!stricmp(tmp,"LOGFILE")) { ! 327: sprintf(cfg.logfile,"%-.80s",cleanstr(p)); ! 328: continue; } ! 329: ! 330: if(!stricmp(tmp,"INBOUND")) { /* Inbound directory */ ! 331: sprintf(cfg.inbound,"%-.80s",cleanstr(p)); ! 332: backslash(cfg.inbound); ! 333: continue; } ! 334: ! 335: if(!stricmp(tmp,"SECURE_INBOUND")) { /* Secure Inbound directory */ ! 336: sprintf(cfg.secure,"%-.80s",cleanstr(p)); ! 337: backslash(cfg.secure); ! 338: continue; } ! 339: ! 340: if(!stricmp(tmp,"OUTBOUND")) { /* Outbound directory */ ! 341: sprintf(cfg.outbound,"%-.80s",cleanstr(p)); ! 342: backslash(cfg.outbound); ! 343: continue; } ! 344: ! 345: if(!stricmp(tmp,"ARCSIZE")) { /* Maximum bundle size */ ! 346: cfg.maxbdlsize=atol(p); ! 347: continue; } ! 348: ! 349: if(!stricmp(tmp,"PKTSIZE")) { /* Maximum packet size */ ! 350: cfg.maxpktsize=atol(p); ! 351: continue; } ! 352: ! 353: if(!stricmp(tmp,"USEPACKER")) { /* Which packer to use */ ! 354: if(!*p) ! 355: continue; ! 356: strcpy(str,p); ! 357: p=str; ! 358: while(*p && *p>' ') p++; ! 359: if(!*p) ! 360: continue; ! 361: *p=0; ! 362: p++; ! 363: for(i=0;i<cfg.arcdefs;i++) ! 364: if(!strnicmp(cfg.arcdef[i].name,str ! 365: ,strlen(cfg.arcdef[i].name))) ! 366: break; ! 367: if(i==cfg.arcdefs) /* i = number of arcdef til done */ ! 368: i=0xffff; /* Uncompressed type if not found */ ! 369: while(*p) { ! 370: while(*p && *p<=' ') p++; ! 371: if(!*p) ! 372: break; ! 373: addr=atofaddr(p); ! 374: while(*p && *p>' ') p++; ! 375: j=matchnode(addr,1); ! 376: if(j==cfg.nodecfgs) { ! 377: cfg.nodecfgs++; ! 378: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg ! 379: ,sizeof(nodecfg_t)*(j+1)))==NULL) { ! 380: printf("\nError allocating memory for nodecfg #%u.\n" ! 381: ,j+1); ! 382: bail(1); } ! 383: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t)); ! 384: cfg.nodecfg[j].faddr=addr; } ! 385: cfg.nodecfg[j].arctype=i; } } ! 386: ! 387: if(!stricmp(tmp,"PKTPWD")) { /* Packet Password */ ! 388: if(!*p) ! 389: continue; ! 390: addr=atofaddr(p); ! 391: while(*p && *p>' ') p++; /* Skip address */ ! 392: while(*p && *p<=' ') p++; /* Find beginning of password */ ! 393: j=matchnode(addr,1); ! 394: if(j==cfg.nodecfgs) { ! 395: cfg.nodecfgs++; ! 396: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg ! 397: ,sizeof(nodecfg_t)*(j+1)))==NULL) { ! 398: printf("\nError allocating memory for nodecfg #%u.\n" ! 399: ,j+1); ! 400: bail(1); } ! 401: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t)); ! 402: cfg.nodecfg[j].faddr=addr; } ! 403: sprintf(cfg.nodecfg[j].pktpwd,"%.8s",p); } ! 404: ! 405: if(!stricmp(tmp,"PKTTYPE")) { /* Packet Type to Use */ ! 406: if(!*p) ! 407: continue; ! 408: strcpy(str,p); ! 409: p=str; ! 410: while(*p && *p>' ') p++; ! 411: *p=0; ! 412: p++; ! 413: while(*p) { ! 414: while(*p && *p<=' ') p++; ! 415: if(!*p) ! 416: break; ! 417: addr=atofaddr(p); ! 418: while(*p && *p>' ') p++; ! 419: j=matchnode(addr,1); ! 420: if(j==cfg.nodecfgs) { ! 421: cfg.nodecfgs++; ! 422: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg ! 423: ,sizeof(nodecfg_t)*(j+1)))==NULL) { ! 424: printf("\nError allocating memory for nodecfg #%u.\n" ! 425: ,j+1); ! 426: bail(1); } ! 427: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t)); ! 428: cfg.nodecfg[j].faddr=addr; } ! 429: if(!strcmp(str,"2+")) ! 430: cfg.nodecfg[j].pkt_type=PKT_TWO_PLUS; ! 431: else if(!strcmp(str,"2.2")) ! 432: cfg.nodecfg[j].pkt_type=PKT_TWO_TWO; ! 433: else if(!strcmp(str,"2")) ! 434: cfg.nodecfg[j].pkt_type=PKT_TWO; } } ! 435: ! 436: if(!stricmp(tmp,"SEND_NOTIFY")) { /* Nodes to send notify lists to */ ! 437: while(*p) { ! 438: while(*p && *p<=' ') p++; ! 439: if(!*p) ! 440: break; ! 441: addr=atofaddr(p); ! 442: while(*p && *p>' ') p++; ! 443: j=matchnode(addr,1); ! 444: if(j==cfg.nodecfgs) { ! 445: cfg.nodecfgs++; ! 446: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg ! 447: ,sizeof(nodecfg_t)*(j+1)))==NULL) { ! 448: printf("\nError allocating memory for nodecfg #%u.\n" ! 449: ,j+1); ! 450: bail(1); } ! 451: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t)); ! 452: cfg.nodecfg[j].faddr=addr; } ! 453: cfg.nodecfg[j].attr|=SEND_NOTIFY; } } ! 454: ! 455: if(!stricmp(tmp,"PASSIVE") ! 456: || !stricmp(tmp,"HOLD") ! 457: || !stricmp(tmp,"CRASH") ! 458: || !stricmp(tmp,"DIRECT")) { /* Set node attributes */ ! 459: if(!stricmp(tmp,"PASSIVE")) ! 460: attr=ATTR_PASSIVE; ! 461: else if(!stricmp(tmp,"CRASH")) ! 462: attr=ATTR_CRASH; ! 463: else if(!stricmp(tmp,"HOLD")) ! 464: attr=ATTR_HOLD; ! 465: else if(!stricmp(tmp,"DIRECT")) ! 466: attr=ATTR_DIRECT; ! 467: while(*p) { ! 468: while(*p && *p<=' ') p++; ! 469: if(!*p) ! 470: break; ! 471: addr=atofaddr(p); ! 472: while(*p && *p>' ') p++; ! 473: j=matchnode(addr,1); ! 474: if(j==cfg.nodecfgs) { ! 475: cfg.nodecfgs++; ! 476: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg ! 477: ,sizeof(nodecfg_t)*(j+1)))==NULL) { ! 478: printf("\nError allocating memory for nodecfg #%u.\n" ! 479: ,j+1); ! 480: bail(1); } ! 481: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t)); ! 482: cfg.nodecfg[j].faddr=addr; } ! 483: cfg.nodecfg[j].attr|=attr; } } ! 484: ! 485: if(!stricmp(tmp,"ROUTE_TO")) { ! 486: while(*p && *p<=' ') p++; ! 487: if(*p) { ! 488: route_addr=atofaddr(p); ! 489: while(*p && *p>' ') p++; } ! 490: while(*p) { ! 491: while(*p && *p<=' ') p++; ! 492: if(!*p) ! 493: break; ! 494: addr=atofaddr(p); ! 495: while(*p && *p>' ') p++; ! 496: j=matchnode(addr,1); ! 497: if(j==cfg.nodecfgs) { ! 498: cfg.nodecfgs++; ! 499: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg ! 500: ,sizeof(nodecfg_t)*(j+1)))==NULL) { ! 501: printf("\nError allocating memory for nodecfg #%u.\n" ! 502: ,j+1); ! 503: bail(1); } ! 504: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t)); ! 505: cfg.nodecfg[j].faddr=addr; } ! 506: cfg.nodecfg[j].route=route_addr; } } ! 507: ! 508: if(!stricmp(tmp,"AREAFIX")) { /* Areafix stuff here */ ! 509: if(!*p) ! 510: continue; ! 511: addr=atofaddr(p); ! 512: i=matchnode(addr,1); ! 513: if(i==cfg.nodecfgs) { ! 514: cfg.nodecfgs++; ! 515: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg ! 516: ,sizeof(nodecfg_t)*(i+1)))==NULL) { ! 517: printf("\nError allocating memory for nodecfg #%u.\n" ! 518: ,i+1); ! 519: bail(1); } ! 520: memset(&cfg.nodecfg[i],0,sizeof(nodecfg_t)); ! 521: cfg.nodecfg[i].faddr=addr; } ! 522: cfg.nodecfg[i].flag=NULL; ! 523: while(*p && *p>' ') p++; /* Get to the end of the address */ ! 524: while(*p && *p<=' ') p++; /* Skip over whitespace chars */ ! 525: tp=p; ! 526: while(*p && *p>' ') p++; /* Find end of password */ ! 527: *p=0; /* and terminate the string */ ! 528: ++p; ! 529: sprintf(cfg.nodecfg[i].password,"%-.25s",tp); ! 530: while(*p && *p<=' ') p++; /* Search for more chars */ ! 531: if(!*p) /* Nothing else there */ ! 532: continue; ! 533: while(*p) { ! 534: tp=p; ! 535: while(*p && *p>' ') p++; /* Find end of this flag */ ! 536: *p=0; /* and terminate it */ ! 537: ++p; ! 538: for(j=0;j<cfg.nodecfg[i].numflags;j++) ! 539: if(!strnicmp(cfg.nodecfg[i].flag[j].flag,tp ! 540: ,strlen(cfg.nodecfg[i].flag[j].flag))) ! 541: break; ! 542: if(j==cfg.nodecfg[i].numflags) { ! 543: if((cfg.nodecfg[i].flag= ! 544: (flag_t *)realloc(cfg.nodecfg[i].flag ! 545: ,sizeof(flag_t)*(j+1)))==NULL) { ! 546: printf("\nError allocating memory for nodecfg #%u " ! 547: "flag #%u.\n",cfg.nodecfgs,j+1); ! 548: bail(1); } ! 549: cfg.nodecfg[i].numflags++; ! 550: sprintf(cfg.nodecfg[i].flag[j].flag,"%.4s",tp); } ! 551: while(*p && *p<=' ') p++; } } ! 552: ! 553: if(!stricmp(tmp,"ECHOLIST")) { /* Echolists go here */ ! 554: if((cfg.listcfg=(echolist_t *)realloc(cfg.listcfg ! 555: ,sizeof(echolist_t)*(cfg.listcfgs+1)))==NULL) { ! 556: printf("\nError allocating memory for echolist cfg #%u.\n" ! 557: ,cfg.listcfgs+1); ! 558: bail(1); } ! 559: memset(&cfg.listcfg[cfg.listcfgs],0,sizeof(echolist_t)); ! 560: ++cfg.listcfgs; ! 561: /* Need to forward requests? */ ! 562: if(!strnicmp(p,"FORWARD ",8) || !strnicmp(p,"HUB ",4)) { ! 563: if(!strnicmp(p,"HUB ",4)) ! 564: cfg.listcfg[cfg.listcfgs-1].misc|=NOFWD; ! 565: while(*p && *p>' ') p++; ! 566: while(*p && *p<=' ') p++; ! 567: if(*p) ! 568: cfg.listcfg[cfg.listcfgs-1].forward=atofaddr(p); ! 569: while(*p && *p>' ') p++; ! 570: while(*p && *p<=' ') p++; ! 571: if(*p && !(cfg.listcfg[cfg.listcfgs-1].misc&NOFWD)) { ! 572: tp=p; ! 573: while(*p && *p>' ') p++; ! 574: *p=0; ! 575: ++p; ! 576: while(*p && *p<=' ') p++; ! 577: SAFECOPY(cfg.listcfg[cfg.listcfgs-1].password,tp); } } ! 578: else ! 579: cfg.listcfg[cfg.listcfgs-1].misc|=NOFWD; ! 580: if(!*p) ! 581: continue; ! 582: tp=p; ! 583: while(*p && *p>' ') p++; ! 584: *p=0; ! 585: p++; ! 586: ! 587: sprintf(cfg.listcfg[cfg.listcfgs-1].listpath,"%-.128s",tp); ! 588: cfg.listcfg[cfg.listcfgs-1].numflags=0; ! 589: cfg.listcfg[cfg.listcfgs-1].flag=NULL; ! 590: while(*p && *p<=' ') p++; /* Skip over whitespace chars */ ! 591: while(*p) { ! 592: tp=p; ! 593: while(*p && *p>' ') p++; /* Find end of this flag */ ! 594: *p=0; /* and terminate it */ ! 595: ++p; ! 596: for(j=0;j<cfg.listcfg[cfg.listcfgs-1].numflags;j++) ! 597: if(!strnicmp(cfg.listcfg[cfg.listcfgs-1].flag[j].flag,tp ! 598: ,strlen(cfg.listcfg[cfg.listcfgs-1].flag[j].flag))) ! 599: break; ! 600: if(j==cfg.listcfg[cfg.listcfgs-1].numflags) { ! 601: if((cfg.listcfg[cfg.listcfgs-1].flag= ! 602: (flag_t *)realloc(cfg.listcfg[cfg.listcfgs-1].flag ! 603: ,sizeof(flag_t)*(j+1)))==NULL) { ! 604: printf("\nError allocating memory for listcfg #%u " ! 605: "flag #%u.\n",cfg.listcfgs,j+1); ! 606: bail(1); } ! 607: cfg.listcfg[cfg.listcfgs-1].numflags++; ! 608: sprintf(cfg.listcfg[cfg.listcfgs-1].flag[j].flag,"%.4s",tp); } ! 609: while(*p && *p<=' ') p++; } } ! 610: ! 611: /* Message disabled why? ToDo */ ! 612: /* printf("Unrecognized line in SBBSECHO.CFG file.\n"); */ ! 613: } ! 614: fclose(stream); ! 615: printf("\n"); ! 616: } ! 617:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.