diff --git a/ChangeLog b/ChangeLog index e233b27e..102217a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,11 +4,18 @@ $Id$ v0.35.03 06-Jul-2002 + common.a: + Added nodelist override to the nodelist lookup function. + lang: Corrected a spelling error in the Dutch language file. mbcico: Changed IsDoing information. + Makes use of the node nodelist override settings. + + mbout: + Makes use of the node nodelist override settings. newuser: Check for Unix accounts is now case sensitive. @@ -26,6 +33,10 @@ v0.35.03 06-Jul-2002 Now forces callmode to None if the callflag was cleared. The test to add a node to the calllist now also checks the internal call flag. + Makes use of the node nodelist override settings. + + mbsetup: + Enabled setting of nodelist override settings in menu 7.x.3 script: The bbsdoor.sh and rundoor.sh scripts are now only installed diff --git a/html/faq.html b/html/faq.html index bbd56d68..b9679044 100644 --- a/html/faq.html +++ b/html/faq.html @@ -478,9 +478,21 @@ MSN/EAZ the device should listen to. This should for an MSN be your telephone number with the area code but without the leading 0. For an EAZ the last digit of your EAZ.
The ISDN ports
-port ttyI0- From the mbsetup menu #5 "Edit Modem types" configure the ISDN modem type. -
modem-type data
init-chat "" ATZ OK AT&E714015437&W0 OK AT&B512 OK
port ttyI1
modem-type data
init-chat "" ATZ OK AT&E714017198&W0 OK AT&B512 OK
++port ttyI0 +modem-type data +init-chat "" ATZ OK +AT&E714015437&W0 OK +AT&B512 OK + +port ttyI1 +modem-type data +init-chat "" ATZ OK +AT&E714017198&W0 OK +AT&B512 OK ++From the mbsetup menu #5 "Edit Modem types" configure the ISDN modem type. +Modem type ISDN Linux Init string ATZ\r Init string diff --git a/html/images/nodes3.png b/html/images/nodes3.png index 3cbb9550..f35d8d04 100644 Binary files a/html/images/nodes3.png and b/html/images/nodes3.png differ diff --git a/html/manual.css b/html/manual.css index ce14f386..388e2477 100644 --- a/html/manual.css +++ b/html/manual.css @@ -5,7 +5,7 @@ */ -BODY { background-color: white; font-family: Arial, Helvetica; } +BODY { background-color: white; font-family: Arial, Helvetica; font-size=10pt; } /* * H1 is the page header, H3 the paragraph header, H5 is topright update date. @@ -19,6 +19,10 @@ A:link { color: blue } A:visited { color: darkblue } A:active { color: red } +TABLE { color: black; } +TH { font-family: Arial, Helvetica; font-size: 12pt; font-weight: bold; } +TD { font-family: Arial, Helvetica; font-size: 12pt; } + PRE { color: brown; font-family: fixed; } CODE { color: brown; font-family: fixed; } HR { border-top: solid medium navy } diff --git a/html/setup/nodes.html b/html/setup/nodes.html index d744db4f..d03b0627 100644 --- a/html/setup/nodes.html +++ b/html/setup/nodes.html @@ -12,10 +12,9 @@-Last update 28-Jun-2002
-
+
-Last update 13-Jul-2002
MBSE BBS Setup - Fidonet nodes.
+MBSE BBS Setup - Fidonet nodes.
Introduction
@@ -33,28 +32,44 @@ This screen has the general information for the node. The contact info fields ar just for private use, these fields are only used in this screen. The Outbox dir is for files to sent to the node, all file you put in there will be sent to the remote if user mbse has read/write access to the file. Only real files are allowed, not symlinks etc. --Sysop name The name of the system operator. -Outbox dir Private extra outbound directory for this node. -Pvt. phone Contact info, node private phone. -Pvt. fax Contact info, node private fax. -Pvt. cellphone Contact info, node cellphone (GSM). -Pvt. e-mail Contact info, node e-mail address. -Pvt. remark Contact info, node remark. -Route via A route via Fido address. All mail for this - node will be send via this Aka, even mail - and files for other networks. This can be - usefull if this node has internet access - so you can send everything to this node - over the internet. -Netmail direct Set "direct" flag in netmail to this node. -Netmail crash Send netmail always "crash" to this node. -Netmail hold Put mail on "hold" for this node. -Pack netmail Should netmail be packed in arcmail archives. -Send notify Send automatic generated notify messages. -Language The language to use for areamgr msgs. -Deleted If this node must be deleted. -++
+ Sysop name The name of the system +operator. The name entered here is used in Areamgr and Filemgr messages etc. + Outbox dir Private extra outbound +directory for this node. Any file dropped into this directory will be sent to +the node and removed after it is sent. + Pvt. phone Contact info, node private +phone. + Pvt. fax Contact info, node private +fax. + Pvt. cellphone Contact info, node +cellphone (GSM). + Pvt. e-mail Contact info, node e-mail +address. + Pvt. remark Contact info, node +remark. + Route via A route via Fido address. All +mail for this node will be send via this Aka, even mail and files for other +networks. This can be usefull if this node has internet access so you can send +everything to this node over the internet. Note that to force calling this node +via internetr, ISDN or pots can also be done by using nodelist flags override. See +section 3. This setting is more usefull to force routing via another node or +aka. + Netmail direct Set "direct" flag in +netmail to this node. + Netmail crash Send netmail always "crash" +to this node. + Netmail hold Put mail on "hold" for this +node. + Pack netmail Should netmail be packed in +arcmail archives. + Send notify Send automatic generated +notify messages. + Language The language to use for areamgr +msgs. + Deleted If this node must be +deleted.
@@ -68,32 +83,32 @@ In this screen you can setup 20 aka's for the node.
Edit node session
-In this screen you can setup the session defaults. Items 5/8 will be added later. -
-Session passwd This is the mailer session password. -Dial command You can put an override here for the normal - dial command. If you leave this empty the - command from the modem setup is used. -Phone number 1 An alternative phone number/ip address to dial. -Phone number 2 An alternative phone number/ip address to dial. - Use these above commands if the node has - another phone number as mentioned in the - nodelist. If you call this node via TCP/IP - and the IP address can't be resolved by - the nodelist, you may enter an IP address - or hostname here. -No EMSI Disable EMSI handshake. -No YooHoo/2U2 Disable FTSC-0006 handshake. -No Filerequest Disable filerquest from this node. -Don't call Do not call this node. -8.3 names Set this if the node only accepts 8.3 filenames. -No Zmodem Disable Zmodem protocol. -No Zedzap Disable Zedzap protocol. -No Hydra Disable Hydra protocol. -No TCP/IP IBN Disbale TCP/IP IBN (binkp) protocol. -No TCP/IP IFC Disable TCP/IP IFC (ifcico) protocol. -No TCP/IP ITN Disable TCP/IP ITN (telnet) protocol. -+In this screen you can setup the session defaults. Items 7 and 8 will be added later. ++
Session passwd This is the mailer session password. + Dial command You can put an override here for the normal dial command. If you leave this empty the command from the modem setup is used. + Phone number 1 An alternative phone number/ip address to dial. + Phone number 2 An alternative phone number/ip address to dial. Use these above commands if the node has another phone number as mentioned in the nodelist. + Nodelist flags Override for the +nodelist flags, the nodelist flags are completly ignored if you enter something +here so make sure all flags you need are here. All aka's of this node will use +the same flags. This can be usefull to force calling this node via the internet. + Inet hostname The FQDN hostname or +IP address of this node. This replaces the original system name from the +nodelist and this is then used to make the internet TCP/IP connection. This can +be usefull if the FQDN is not present in the nodelist. + No EMSI Disable EMSI handshake. + No YooHoo/2U2 Disable FTSC-0006 handshake. + No Filerequest Disable filerequest from this node. + Don't call Do not call this node. + 8.3 names Set this if the node only accepts 8.3 filenames. + No Zmodem Disable Zmodem protocol. + No Zedzap Disable Zedzap protocol. + No Hydra Disable Hydra protocol. + No TCP/IP IBN Disbale TCP/IP IBN (binkp) protocol. + No TCP/IP IFC Disable TCP/IP IFC (ifcico) protocol. + No TCP/IP ITN Disable TCP/IP ITN (telnet) protocol. +
@@ -101,19 +116,15 @@ In this screen you can setup the session defaults. Items 5/8 will be added later
Edit node - mail processing
-
-PKT password The password to insert in .pkt files. -Check PKT pwd Check password in received .pkt files. If not, - errors or missing passwords are only logged. - If set, errors or missing password are refused - and the .pkt files are renamed to .bad -UplMgr program The name of the Areamgr program of this node. - This could be AreaFix, AreaMgr etc. -UplMgr passwd The password for the Areamgr of this node. -Mail forward Not in use yet. -ARCmail comp. Use ARCmail 0.60 file naming convention for out of zone mail. -ARCmail a..z Allow a..z last character for ARCmail filenames. -++
PKT password The password to insert in .pkt files. + Check PKT pwd Check password in received .pkt files. If not, errors or missing passwords are only logged. If set, errors or missing password are refused and the .pkt files are renamed to .bad + UplMgr program The name of the Areamgr program of this node. This could be AreaFix, AreaMgr etc. + UplMgr passwd The password for the Areamgr of this node. + Mail forward Not in use yet. + ARCmail comp. Use ARCmail 0.60 file naming convention for out of zone mail. + ARCmail a..z Allow a..z last character for ARCmail filenames. +
@@ -129,25 +140,24 @@ carefull not to allow a node to connect areas from networks he has no aka in.
File setup
-
-Files password The password for .tic files. -Mgr password The password for the Areamgr and Filemgr. -UplMgr program The name of the Filemgr progrom of this node. - This could be FileMgr, Allfix, Raid etc. -UplMgr passwd The password of the Filemgr if this node. -UplMgr Add + Add a "+" in the command to connect areas. -Incl. message Send a netmail message for each file to send. -Send TIC file Send .tic file to this node. -Advanced TIC Send advanced or standard .tic files. -File forward Forward TIC files for this node (not yet). -Billing Is Costsharing active for this node. -Bill direct Send the bill direct or on command. -Credit The credit this node has in units. -Debet The debet we have with this node (informational). -Add Add (or substract) factor to the bill. -Warn level The debet level when to write a warning mesage. -Stop level The debet level when to stop sending files. -++
Files password The password for .tic files. + Mgr password The password for the Areamgr and Filemgr. + UplMgr program The name of the Filemgr progrom of this node. This could be FileMgr, Allfix, Raid etc. + UplMgr passwd The password of the Filemgr if this node. + UplMgr Add + Add a "+" in the command to connect areas. + Incl. message Send a netmail message for each file to send. + Send TIC file Send .tic file to this node. + Advanced TIC Send advanced or standard .tic files. + File forward Forward TIC files for this node (not yet). + Billing Is Costsharing active for this node. + Bill direct Send the bill direct or on command. + Credit The credit this node has in units. + Debet The debet we have with this node (informational). + Add Add (or substract) factor to the bill. + Warn level The debet level when to write a warning mesage. + Stop level The debet level when to stop sending files. +
diff --git a/lib/nodelist.c b/lib/nodelist.c index d739c291..f93bd7c8 100644 --- a/lib/nodelist.c +++ b/lib/nodelist.c @@ -174,446 +174,481 @@ int comp_node(struct _nlidx fap1, struct _ixentry fap2) node *getnlent(faddr *addr) { - FILE *fp; - static node nodebuf; - static char buf[256], *p, *q; - struct _ixentry xaddr; - int i, j, Found = FALSE; - int ixflag, stdflag; - char *mydomain, *path; - struct _nlfil fdx; - struct _nlidx ndx; - long lowest, highest, current; + FILE *fp; + static node nodebuf; + static char buf[256], *p, *q; + struct _ixentry xaddr; + int i, j, Found = FALSE, ixflag, stdflag, ndrecord = FALSE; + char *mydomain, *path; + struct _nlfil fdx; + struct _nlidx ndx; + long lowest, highest, current; + struct _nodeshdr ndhdr; + static struct _nodes nd; - Syslog('s', "getnlent: %s", ascfnode(addr,0xff)); + Syslog('s', "getnlent: %s", ascfnode(addr,0xff)); - mydomain = xstrcpy(CFG.aka[0].domain); - if (mydomain == NULL) - mydomain = (char *)NULLDOMAIN; + mydomain = xstrcpy(CFG.aka[0].domain); + if (mydomain == NULL) + mydomain = (char *)NULLDOMAIN; - nodebuf.addr.domain = NULL; - nodebuf.addr.zone = 0; - nodebuf.addr.net = 0; - nodebuf.addr.node = 0; - nodebuf.addr.point = 0; - nodebuf.addr.name = NULL; - nodebuf.upnet = 0; - nodebuf.upnode = 0; - nodebuf.region = 0; - nodebuf.type = 0; - nodebuf.pflag = 0; - nodebuf.name = NULL; - nodebuf.location = NULL; - nodebuf.sysop = NULL; - nodebuf.phone = NULL; - nodebuf.speed = 0; - nodebuf.mflags = 0L; - nodebuf.oflags = 0L; - nodebuf.xflags = 0L; - nodebuf.iflags = 0L; - nodebuf.dflags = 0L; - nodebuf.uflags[0] = NULL; - nodebuf.t1 = '\0'; - nodebuf.t2 = '\0'; + nodebuf.addr.domain = NULL; + nodebuf.addr.zone = 0; + nodebuf.addr.net = 0; + nodebuf.addr.node = 0; + nodebuf.addr.point = 0; + nodebuf.addr.name = NULL; + nodebuf.upnet = 0; + nodebuf.upnode = 0; + nodebuf.region = 0; + nodebuf.type = 0; + nodebuf.pflag = 0; + nodebuf.name = NULL; + nodebuf.location = NULL; + nodebuf.sysop = NULL; + nodebuf.phone = NULL; + nodebuf.speed = 0; + nodebuf.mflags = 0L; + nodebuf.oflags = 0L; + nodebuf.xflags = 0L; + nodebuf.iflags = 0L; + nodebuf.dflags = 0L; + nodebuf.uflags[0] = NULL; + nodebuf.t1 = '\0'; + nodebuf.t2 = '\0'; - if (addr == NULL) - goto retdummy; + if (addr == NULL) + goto retdummy; - if (addr->zone == 0) - addr->zone = CFG.aka[0].zone; - xaddr.zone = addr->zone; - nodebuf.addr.zone = addr->zone; - xaddr.net = addr->net; - nodebuf.addr.net = addr->net; - xaddr.node = addr->node; - nodebuf.addr.node = addr->node; - xaddr.point = addr->point; - nodebuf.addr.point = addr->point; + if (addr->zone == 0) + addr->zone = CFG.aka[0].zone; + xaddr.zone = addr->zone; + nodebuf.addr.zone = addr->zone; + xaddr.net = addr->net; + nodebuf.addr.net = addr->net; + xaddr.node = addr->node; + nodebuf.addr.node = addr->node; + xaddr.point = addr->point; + nodebuf.addr.point = addr->point; - if (initnl()) - goto retdummy; + if (initnl()) + goto retdummy; - /* - * First, lookup node in index. NOTE -- NOT 5D YET - */ - path = calloc(PATH_MAX, sizeof(char)); - sprintf(path, "%s/%s", CFG.nodelists, "node.index"); - if ((fp = fopen(path, "r")) == NULL) { - WriteError("$Can't open %s", path); - free(path); - goto retdummy; - } - - fseek(fp, 0, SEEK_END); - highest = ftell(fp) / sizeof(ndx); - lowest = 0; - - while (TRUE) { - current = ((highest - lowest) / 2) + lowest; - fseek(fp, current * sizeof(ndx), SEEK_SET); - if (fread(&ndx, sizeof(ndx), 1, fp) != 1) - break; - - if (comp_node(ndx, xaddr) == 0) { - Found = TRUE; - break; - } - if (comp_node(ndx, xaddr) < 0) - lowest = current; - else - highest = current; - if ((highest - lowest) <= 1) - break; - } - - fclose(fp); - - if (!Found) { - free(path); - goto retdummy; - } - - sprintf(path, "%s/%s", CFG.nodelists, "node.files"); - if ((fp = fopen(path, "r")) == NULL) { - WriteError("$Can't open %s", path); - free(path); - goto retdummy; - } - - /* - * Get filename from node.files - */ - for (i = 0; i < (ndx.fileno +1); i++) - fread(&fdx, sizeof(fdx), 1, fp); - fclose(fp); - - /* CHECK DOMAIN HERE */ - - /* - * Open and read in real nodelist - */ - sprintf(path, "%s/%s", CFG.nodelists, fdx.filename); - if ((fp = fopen(path, "r")) == NULL) { - WriteError("$Can't open %s", path); - free(path); - goto retdummy; - } + /* + * First, lookup node in index. NOTE -- NOT 5D YET + */ + path = calloc(PATH_MAX, sizeof(char)); + sprintf(path, "%s/%s", CFG.nodelists, "node.index"); + if ((fp = fopen(path, "r")) == NULL) { + WriteError("$Can't open %s", path); free(path); + goto retdummy; + } - if (fseek(fp, ndx.offset, SEEK_SET) != 0) { - WriteError("$Seek failed for nodelist entry"); - fclose(fp); - goto retdummy; + fseek(fp, 0, SEEK_END); + highest = ftell(fp) / sizeof(ndx); + lowest = 0; + + while (TRUE) { + current = ((highest - lowest) / 2) + lowest; + fseek(fp, current * sizeof(ndx), SEEK_SET); + if (fread(&ndx, sizeof(ndx), 1, fp) != 1) + break; + + if (comp_node(ndx, xaddr) == 0) { + Found = TRUE; + break; } - - if (fgets(buf, sizeof(buf)-1, fp) == NULL) { - WriteError("$fgets failed for nodelist entry"); - fclose(fp); - goto retdummy; - } - fclose(fp); - - nodebuf.type = ndx.type; - nodebuf.pflag = ndx.pflag; - - if (*(p = buf + strlen(buf) -1) == '\n') - *p = '\0'; - if (*(p = buf + strlen(buf) -1) == '\r') - *p = '\0'; - for (p = buf; *p; p++) - if (*p == '_') - *p = ' '; - - p = buf; - - if ((q = strchr(p,','))) - *q++ = '\0'; - - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - nodebuf.name = p; - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - nodebuf.location = p; - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - nodebuf.sysop = p; - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - if (strcasecmp(p, "-Unpublished-") == 0) - nodebuf.phone = NULL; + if (comp_node(ndx, xaddr) < 0) + lowest = current; else - nodebuf.phone = p; - p = q; - if (p == NULL) - goto badsyntax; + highest = current; + if ((highest - lowest) <= 1) + break; + } - if ((q=strchr(p,','))) - *q++ = '\0'; - nodebuf.speed = atoi(p); + fclose(fp); - /* - * Process the nodelist flags. - */ - ixflag = 0; - stdflag = TRUE; - for (p = q; p; p = q) { - if ((q = strchr(p, ','))) - *q++ = '\0'; - if ((strncasecmp(p, "U", 1) == 0) && (strlen(p) == 1)) { - stdflag = FALSE; - } else { - /* - * Experimental: process authorized flags and - * User flags both as authorized. - */ - for (j = 0; fkey[j].key; j++) - if (strcasecmp(p, fkey[j].key) == 0) - nodebuf.mflags |= fkey[j].flag; - for (j = 0; okey[j].key; j++) - if (strcasecmp(p, okey[j].key) == 0) - nodebuf.oflags |= okey[j].flag; - for (j = 0; dkey[j].key; j++) - if (strcasecmp(p, dkey[j].key) == 0) - nodebuf.dflags |= dkey[j].flag; - for (j = 0; ikey[j].key; j++) - if (strncasecmp(p, ikey[j].key, strlen(ikey[j].key)) == 0) - nodebuf.iflags |= ikey[j].flag; - for (j = 0; xkey[j].key; j++) - if (strcasecmp(p, xkey[j].key) == 0) - nodebuf.xflags |= xkey[j].flag; - if ((p[0] == 'T') && (strlen(p) == 3)) { - /* - * System open hours flag - */ - nodebuf.t1 = p[1]; - nodebuf.t2 = p[2]; - } - if (!stdflag) { - if (ixflag < MAXUFLAGS) { - nodebuf.uflags[ixflag++] = p; - if (ixflag < MAXUFLAGS) - nodebuf.uflags[ixflag] = NULL; - } - } + if (!Found) { + free(path); + goto retdummy; + } + + sprintf(path, "%s/%s", CFG.nodelists, "node.files"); + if ((fp = fopen(path, "r")) == NULL) { + WriteError("$Can't open %s", path); + free(path); + goto retdummy; + } + + /* + * Get filename from node.files + */ + for (i = 0; i < (ndx.fileno +1); i++) + fread(&fdx, sizeof(fdx), 1, fp); + fclose(fp); + + /* CHECK DOMAIN HERE */ + + /* + * Open and read in real nodelist + */ + sprintf(path, "%s/%s", CFG.nodelists, fdx.filename); + if ((fp = fopen(path, "r")) == NULL) { + WriteError("$Can't open %s", path); + free(path); + goto retdummy; + } + + if (fseek(fp, ndx.offset, SEEK_SET) != 0) { + WriteError("$Seek failed for nodelist entry"); + fclose(fp); + goto retdummy; + } + + if (fgets(buf, sizeof(buf)-1, fp) == NULL) { + WriteError("$fgets failed for nodelist entry"); + fclose(fp); + goto retdummy; + } + fclose(fp); + + /* + * Load noderecord if this node has one, if there is one then + * nodelist overrides in this record will be used instead of + * the nodelist entries. + */ + sprintf(path, "%s/etc/nodes.data", getenv("MBSE_ROOT")); + if ((fp = fopen(path, "r")) != NULL) { + fread(&ndhdr, sizeof(nodeshdr), 1, fp); + + while (fread(&nd, ndhdr.recsize, 1, fp) == 1) { + fseek(fp, ndhdr.filegrp + ndhdr.mailgrp, SEEK_CUR); + for (i = 0; i < 20; i++) { + if ((addr->zone == nd.Aka[i].zone) && (addr->net == nd.Aka[i].net) && + (addr->node == nd.Aka[i].node) && (addr->point == nd.Aka[i].point)) { + ndrecord = TRUE; + Syslog('s', "getnlent: node record is present"); + break; } + } + if (ndrecord) + break; } - nodebuf.addr.name = nodebuf.sysop; - nodebuf.addr.domain = xstrcpy(fdx.domain); - nodebuf.upnet = ndx.upnet; - nodebuf.upnode = ndx.upnode; - nodebuf.region = ndx.region; - if (addr->domain == NULL) - addr->domain = xstrcpy(nodebuf.addr.domain); + fclose(fp); + } + free(path); + + nodebuf.type = ndx.type; + nodebuf.pflag = ndx.pflag; - Syslog('s', "getnlent: system %s, %s", nodebuf.name, nodebuf.location); - Syslog('s', "getnlent: sysop %s, %s", nodebuf.sysop, nodebuf.phone); - if (nodebuf.mflags) - Syslog('S', "getnlent: mflags 0x%08lx", nodebuf.mflags); - if (nodebuf.oflags) - Syslog('S', "getnlent: oflags 0x%08lx", nodebuf.oflags); - if (nodebuf.dflags) - Syslog('S', "getnlent: dflags 0x%08lx", nodebuf.dflags); - if (nodebuf.iflags) - Syslog('S', "getnlent: iflags 0x%08lx", nodebuf.iflags); - if (nodebuf.xflags) - Syslog('S', "getnlent: xflags 0x%08lx", nodebuf.xflags); - for (j = 0; nodebuf.uflags[j]; j++) - Syslog('S', "getnlent: uflag %s", nodebuf.uflags[j]); + if (*(p = buf + strlen(buf) -1) == '\n') + *p = '\0'; + if (*(p = buf + strlen(buf) -1) == '\r') + *p = '\0'; + for (p = buf; *p; p++) + if (*p == '_') + *p = ' '; - moflags(nodebuf.mflags); - diflags(nodebuf.dflags); - ipflags(nodebuf.iflags); - olflags(nodebuf.oflags); - rqflags(nodebuf.xflags); - free(mydomain); + p = buf; - return &nodebuf; + if ((q = strchr(p,','))) + *q++ = '\0'; + + p = q; + if (p == NULL) + goto badsyntax; + + if ((q=strchr(p,','))) + *q++ = '\0'; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get system name + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + if (ndrecord && strlen(nd.Nl_hostname)) { + Syslog('s', "getnlent: system name override with %s", nd.Nl_hostname); + nodebuf.name = nd.Nl_hostname; + } else + nodebuf.name = p; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get location + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + nodebuf.location = p; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get sysop name + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + nodebuf.sysop = p; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get phone number + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + if (strcasecmp(p, "-Unpublished-") == 0) + nodebuf.phone = NULL; + else + nodebuf.phone = p; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get modem speed + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + nodebuf.speed = atoi(p); + + /* + * Process the nodelist flags. + */ + if (ndrecord && strlen(nd.Nl_flags)) { + Syslog('s', "getnlent: flags override %s", nd.Nl_flags); + q = nd.Nl_flags; + } + ixflag = 0; + stdflag = TRUE; + for (p = q; p; p = q) { + if ((q = strchr(p, ','))) + *q++ = '\0'; + if ((strncasecmp(p, "U", 1) == 0) && (strlen(p) == 1)) { + stdflag = FALSE; + } else { + /* + * Process authorized flags and user flags both as authorized. + */ + for (j = 0; fkey[j].key; j++) + if (strcasecmp(p, fkey[j].key) == 0) + nodebuf.mflags |= fkey[j].flag; + for (j = 0; okey[j].key; j++) + if (strcasecmp(p, okey[j].key) == 0) + nodebuf.oflags |= okey[j].flag; + for (j = 0; dkey[j].key; j++) + if (strcasecmp(p, dkey[j].key) == 0) + nodebuf.dflags |= dkey[j].flag; + for (j = 0; ikey[j].key; j++) + if (strncasecmp(p, ikey[j].key, strlen(ikey[j].key)) == 0) + nodebuf.iflags |= ikey[j].flag; + for (j = 0; xkey[j].key; j++) + if (strcasecmp(p, xkey[j].key) == 0) + nodebuf.xflags |= xkey[j].flag; + if ((p[0] == 'T') && (strlen(p) == 3)) { + /* + * System open hours flag + */ + nodebuf.t1 = p[1]; + nodebuf.t2 = p[2]; + } + if (!stdflag) { + if (ixflag < MAXUFLAGS) { + nodebuf.uflags[ixflag++] = p; + if (ixflag < MAXUFLAGS) + nodebuf.uflags[ixflag] = NULL; + } + } + } + } + + nodebuf.addr.name = nodebuf.sysop; + nodebuf.addr.domain = xstrcpy(fdx.domain); + nodebuf.upnet = ndx.upnet; + nodebuf.upnode = ndx.upnode; + nodebuf.region = ndx.region; + if (addr->domain == NULL) + addr->domain = xstrcpy(nodebuf.addr.domain); + + Syslog('s', "getnlent: system %s, %s", nodebuf.name, nodebuf.location); + Syslog('s', "getnlent: sysop %s, %s", nodebuf.sysop, nodebuf.phone); + moflags(nodebuf.mflags); + diflags(nodebuf.dflags); + ipflags(nodebuf.iflags); + olflags(nodebuf.oflags); + rqflags(nodebuf.xflags); + free(mydomain); + + return &nodebuf; badsyntax: - WriteError("nodelist %d offset +%lu: bad syntax in line \"%s\"", - ndx.fileno, (unsigned long)ndx.offset, buf); - /* fallthrough */ + WriteError("nodelist %d offset +%lu: bad syntax in line \"%s\"", ndx.fileno, (unsigned long)ndx.offset, buf); + /* fallthrough */ retdummy: - memset(&nodebuf, 0, sizeof(nodebuf)); - nodebuf.pflag = NL_DUMMY; - nodebuf.name = (char *)"Unknown"; - nodebuf.location = (char *)"Nowhere"; - nodebuf.sysop = (char *)"Sysop"; - nodebuf.phone = NULL; - nodebuf.speed = 2400; - free(mydomain); + memset(&nodebuf, 0, sizeof(nodebuf)); + nodebuf.pflag = NL_DUMMY; + nodebuf.name = (char *)"Unknown"; + nodebuf.location = (char *)"Nowhere"; + nodebuf.sysop = (char *)"Sysop"; + nodebuf.phone = NULL; + nodebuf.speed = 2400; + free(mydomain); - return &nodebuf; + return &nodebuf; } void olflags(unsigned long flags) { - char *t; + char *t; - t = xstrcpy((char *)"Mailer flags :"); - if (flags & OL_CM) - t = xstrcat(t, (char *)" CM"); - if (flags & OL_MO) - t = xstrcat(t, (char *)" MO"); - if (flags & OL_LO) - t = xstrcat(t, (char *)" LO"); - if (flags & OL_MN) - t = xstrcat(t, (char *)" MN"); - Syslog('s', "%s", t); - free(t); + t = xstrcpy((char *)"Mailer flags :"); + if (flags & OL_CM) + t = xstrcat(t, (char *)" CM"); + if (flags & OL_MO) + t = xstrcat(t, (char *)" MO"); + if (flags & OL_LO) + t = xstrcat(t, (char *)" LO"); + if (flags & OL_MN) + t = xstrcat(t, (char *)" MN"); + Syslog('s', "%s", t); + free(t); } void rqflags(unsigned long flags) { - char *t; + char *t; - t = xstrcpy((char *)"Request flags:"); - if (flags & RQ_RQ_BR) - t = xstrcat(t, (char *)" RQ_BR"); - if (flags & RQ_RQ_BU) - t = xstrcat(t, (char *)" RQ_BU"); - if (flags & RQ_RQ_WR) - t = xstrcat(t, (char *)" RQ_WR"); - if (flags & RQ_RQ_WU) - t = xstrcat(t, (char *)" RQ_WU"); - Syslog('s', "%s", t); - free(t); + t = xstrcpy((char *)"Request flags:"); + if (flags & RQ_RQ_BR) + t = xstrcat(t, (char *)" RQ_BR"); + if (flags & RQ_RQ_BU) + t = xstrcat(t, (char *)" RQ_BU"); + if (flags & RQ_RQ_WR) + t = xstrcat(t, (char *)" RQ_WR"); + if (flags & RQ_RQ_WU) + t = xstrcat(t, (char *)" RQ_WU"); + Syslog('s', "%s", t); + free(t); } void moflags(unsigned long flags) { - char *t; + char *t; - if (!flags) - return; - t = xstrcpy((char *)"Modem flags :"); - if (flags & NL_V22) - t = xstrcat(t, (char *)" V22"); - if (flags & NL_V29) - t = xstrcat(t, (char *)" V29"); - if (flags & NL_V32) - t = xstrcat(t, (char *)" V32"); - if (flags & NL_V32B) - t = xstrcat(t, (char *)" V32B"); - if (flags & NL_V34) - t = xstrcat(t, (char *)" V34"); - if (flags & NL_V42) - t = xstrcat(t, (char *)" V42"); - if (flags & NL_V42B) - t = xstrcat(t, (char *)" V42B"); - if (flags & NL_MNP) - t = xstrcat(t, (char *)" MNP"); - if (flags & NL_H96) - t = xstrcat(t, (char *)" H96"); - if (flags & NL_HST) - t = xstrcat(t, (char *)" HST"); - if (flags & NL_H14) - t = xstrcat(t, (char *)" H14"); - if (flags & NL_H16) - t = xstrcat(t, (char *)" H16"); - if (flags & NL_MAX) - t = xstrcat(t, (char *)" MAX"); - if (flags & NL_PEP) - t = xstrcat(t, (char *)" PEP"); - if (flags & NL_CSP) - t = xstrcat(t, (char *)" CSP"); - if (flags & NL_V32T) - t = xstrcat(t, (char *)" V32T"); - if (flags & NL_VFC) - t = xstrcat(t, (char *)" VFC"); - if (flags & NL_ZYX) - t = xstrcat(t, (char *)" ZYX"); - if (flags & NL_X2C) - t = xstrcat(t, (char *)" X2C"); - if (flags & NL_X2S) - t = xstrcat(t, (char *)" X2S"); - if (flags & NL_V90C) - t = xstrcat(t, (char *)" V90C"); - if (flags & NL_V90S) - t = xstrcat(t, (char *)" V90S"); - Syslog('s', "%s", t); - free(t); + if (!flags) + return; + t = xstrcpy((char *)"Modem flags :"); + if (flags & NL_V22) + t = xstrcat(t, (char *)" V22"); + if (flags & NL_V29) + t = xstrcat(t, (char *)" V29"); + if (flags & NL_V32) + t = xstrcat(t, (char *)" V32"); + if (flags & NL_V32B) + t = xstrcat(t, (char *)" V32B"); + if (flags & NL_V34) + t = xstrcat(t, (char *)" V34"); + if (flags & NL_V42) + t = xstrcat(t, (char *)" V42"); + if (flags & NL_V42B) + t = xstrcat(t, (char *)" V42B"); + if (flags & NL_MNP) + t = xstrcat(t, (char *)" MNP"); + if (flags & NL_H96) + t = xstrcat(t, (char *)" H96"); + if (flags & NL_HST) + t = xstrcat(t, (char *)" HST"); + if (flags & NL_H14) + t = xstrcat(t, (char *)" H14"); + if (flags & NL_H16) + t = xstrcat(t, (char *)" H16"); + if (flags & NL_MAX) + t = xstrcat(t, (char *)" MAX"); + if (flags & NL_PEP) + t = xstrcat(t, (char *)" PEP"); + if (flags & NL_CSP) + t = xstrcat(t, (char *)" CSP"); + if (flags & NL_V32T) + t = xstrcat(t, (char *)" V32T"); + if (flags & NL_VFC) + t = xstrcat(t, (char *)" VFC"); + if (flags & NL_ZYX) + t = xstrcat(t, (char *)" ZYX"); + if (flags & NL_X2C) + t = xstrcat(t, (char *)" X2C"); + if (flags & NL_X2S) + t = xstrcat(t, (char *)" X2S"); + if (flags & NL_V90C) + t = xstrcat(t, (char *)" V90C"); + if (flags & NL_V90S) + t = xstrcat(t, (char *)" V90S"); + Syslog('s', "%s", t); + free(t); } void diflags(unsigned long flags) { - char *t; + char *t; - if (!flags) - return; + if (!flags) + return; - t = xstrcpy((char *)"ISDN flags :"); - if (flags & ND_V110L) - t = xstrcat(t, (char *)" V110L"); - if (flags & ND_V110H) - t = xstrcat(t, (char *)" V110H"); - if (flags & ND_V120L) - t = xstrcat(t, (char *)" V120L"); - if (flags & ND_V120H) - t = xstrcat(t, (char *)" V120H"); - if (flags & ND_X75) - t = xstrcat(t, (char *)" X75"); - Syslog('s', "%s", t); - free(t); + t = xstrcpy((char *)"ISDN flags :"); + if (flags & ND_V110L) + t = xstrcat(t, (char *)" V110L"); + if (flags & ND_V110H) + t = xstrcat(t, (char *)" V110H"); + if (flags & ND_V120L) + t = xstrcat(t, (char *)" V120L"); + if (flags & ND_V120H) + t = xstrcat(t, (char *)" V120H"); + if (flags & ND_X75) + t = xstrcat(t, (char *)" X75"); + Syslog('s', "%s", t); + free(t); } void ipflags(unsigned long flags) { - char *t; + char *t; - if (!flags) - return; + if (!flags) + return; - t = xstrcpy((char *)"TCP/IP flags :"); - if (flags & IP_IBN) - t = xstrcat(t, (char *)" IBN"); - if (flags & IP_IFC) - t = xstrcat(t, (char *)" IFC"); - if (flags & IP_ITN) - t = xstrcat(t, (char *)" ITN"); - if (flags & IP_IVM) - t = xstrcat(t, (char *)" IVM"); - if (flags & IP_IP) - t = xstrcat(t, (char *)" IP"); - if (flags & IP_IFT) - t = xstrcat(t, (char *)" IFT"); - Syslog('s', "%s", t); - free(t); + t = xstrcpy((char *)"TCP/IP flags :"); + if (flags & IP_IBN) + t = xstrcat(t, (char *)" IBN"); + if (flags & IP_IFC) + t = xstrcat(t, (char *)" IFC"); + if (flags & IP_ITN) + t = xstrcat(t, (char *)" ITN"); + if (flags & IP_IVM) + t = xstrcat(t, (char *)" IVM"); + if (flags & IP_IP) + t = xstrcat(t, (char *)" IP"); + if (flags & IP_IFT) + t = xstrcat(t, (char *)" IFT"); + Syslog('s', "%s", t); + free(t); } diff --git a/mbsetup/m_node.c b/mbsetup/m_node.c index 79b525ca..0bd0ef05 100644 --- a/mbsetup/m_node.c +++ b/mbsetup/m_node.c @@ -752,8 +752,8 @@ void SessionScreen(void) mvprintw( 8, 6, "2. Dial command"); mvprintw( 9, 6, "3. Phone number 1"); mvprintw(10, 6, "4. Phone number 2"); -// mvprintw(11, 6, "5. Nodelist flags"); -// mvprintw(12, 6, "6. Inet hostname"); + mvprintw(11, 6, "5. Nodelist flags"); + mvprintw(12, 6, "6. Inet hostname"); // mvprintw(13, 6, "7. Outbound sess."); // mvprintw(14, 6, "8. Inbound sess."); mvprintw(15, 6, "9. No EMSI"); @@ -805,8 +805,8 @@ void SessionEdit(void) case 2: E_STR( 8,26,40, nodes.dial, "If needed, give a special modem ^dial command^ for this node") case 3: E_STR( 9,26,20, nodes.phone[0], "Enter ^phone number^ to override the nodelist") case 4: E_STR( 10,26,20, nodes.phone[1], "Enter ^phone number^ to override the nodelist") -// case 5: E_STR( 11,26,54, nodes.Nl_flags, "^Nodelist flags^ override") -// case 6: E_STR( 12,26,40, nodes.Nl_hostname, "Node internet ^hostname/IP address^ override") + case 5: E_STR( 11,26,54, nodes.Nl_flags, "^Nodelist flags^ override") + case 6: E_STR( 12,26,40, nodes.Nl_hostname, "Node internet ^hostname/IP address^ override") case 9: E_BOOL(15,26, nodes.NoEMSI, "Disable ^EMSI handshake^ with this node") case 10:E_BOOL(16,26, nodes.NoWaZOO, "Disable ^YooHoo/2U2 handshake^ (FTSC-0006) with this node") diff --git a/mbtask/nodelist.c b/mbtask/nodelist.c index 22490ddb..f5019d10 100644 --- a/mbtask/nodelist.c +++ b/mbtask/nodelist.c @@ -172,278 +172,324 @@ int comp_node(struct _nlidx fap1, struct _ixentry fap2) node *getnlent(faddr *addr) { - FILE *fp; - static node nodebuf; - static char buf[256], *p, *q; - struct _ixentry xaddr; - int i, j, Found = FALSE; - int ixflag, stdflag; - char *mydomain, *path; - struct _nlfil fdx; - struct _nlidx ndx; - long lowest, highest, current; + FILE *fp; + static node nodebuf; + static char buf[256], *p, *q; + struct _ixentry xaddr; + int i, j, Found = FALSE, ixflag, stdflag, ndrecord = FALSE; + char *mydomain, *path; + struct _nlfil fdx; + struct _nlidx ndx; + long lowest, highest, current; + struct _nodeshdr ndhdr; + static struct _nodes nd; - mydomain = xstrcpy(CFG.aka[0].domain); - if (mydomain == NULL) - mydomain = (char *)NULLDOMAIN; + mydomain = xstrcpy(CFG.aka[0].domain); + if (mydomain == NULL) + mydomain = (char *)NULLDOMAIN; - nodebuf.addr.domain = NULL; - nodebuf.addr.zone = 0; - nodebuf.addr.net = 0; - nodebuf.addr.node = 0; - nodebuf.addr.point = 0; - nodebuf.addr.name = NULL; - nodebuf.upnet = 0; - nodebuf.upnode = 0; - nodebuf.region = 0; - nodebuf.type = 0; - nodebuf.pflag = 0; - nodebuf.name = NULL; - nodebuf.location = NULL; - nodebuf.sysop = NULL; - nodebuf.phone = NULL; - nodebuf.speed = 0; - nodebuf.mflags = 0L; - nodebuf.oflags = 0L; - nodebuf.xflags = 0L; - nodebuf.iflags = 0L; - nodebuf.dflags = 0L; - nodebuf.uflags[0] = NULL; - nodebuf.t1 = '\0'; - nodebuf.t2 = '\0'; + nodebuf.addr.domain = NULL; + nodebuf.addr.zone = 0; + nodebuf.addr.net = 0; + nodebuf.addr.node = 0; + nodebuf.addr.point = 0; + nodebuf.addr.name = NULL; + nodebuf.upnet = 0; + nodebuf.upnode = 0; + nodebuf.region = 0; + nodebuf.type = 0; + nodebuf.pflag = 0; + nodebuf.name = NULL; + nodebuf.location = NULL; + nodebuf.sysop = NULL; + nodebuf.phone = NULL; + nodebuf.speed = 0; + nodebuf.mflags = 0L; + nodebuf.oflags = 0L; + nodebuf.xflags = 0L; + nodebuf.iflags = 0L; + nodebuf.dflags = 0L; + nodebuf.uflags[0] = NULL; + nodebuf.t1 = '\0'; + nodebuf.t2 = '\0'; - if (addr == NULL) - goto retdummy; + if (addr == NULL) + goto retdummy; - if (addr->zone == 0) - addr->zone = CFG.aka[0].zone; - xaddr.zone = addr->zone; - nodebuf.addr.zone = addr->zone; - xaddr.net = addr->net; - nodebuf.addr.net = addr->net; - xaddr.node = addr->node; - nodebuf.addr.node = addr->node; - xaddr.point = addr->point; - nodebuf.addr.point = addr->point; + if (addr->zone == 0) + addr->zone = CFG.aka[0].zone; + xaddr.zone = addr->zone; + nodebuf.addr.zone = addr->zone; + xaddr.net = addr->net; + nodebuf.addr.net = addr->net; + xaddr.node = addr->node; + nodebuf.addr.node = addr->node; + xaddr.point = addr->point; + nodebuf.addr.point = addr->point; - if (initnl()) - goto retdummy; + if (initnl()) + goto retdummy; - /* - * First, lookup node in index. NOTE -- NOT 5D YET - */ - path = calloc(128, sizeof(char)); - sprintf(path, "%s/%s", CFG.nodelists, "node.index"); - if ((fp = fopen(path, "r")) == NULL) { - tasklog('?', "$Can't open %s", path); - free(path); - goto retdummy; - } - - fseek(fp, 0, SEEK_END); - highest = ftell(fp) / sizeof(ndx); - lowest = 0; - - while (TRUE) { - current = ((highest - lowest) / 2) + lowest; - fseek(fp, current * sizeof(ndx), SEEK_SET); - if (fread(&ndx, sizeof(ndx), 1, fp) != 1) - break; - - if (comp_node(ndx, xaddr) == 0) { - Found = TRUE; - break; - } - if (comp_node(ndx, xaddr) < 0) - lowest = current; - else - highest = current; - if ((highest - lowest) <= 1) - break; - } - - fclose(fp); - - if (!Found) { - free(path); - goto retdummy; - } - - sprintf(path, "%s/%s", CFG.nodelists, "node.files"); - if ((fp = fopen(path, "r")) == NULL) { - tasklog('?', "$Can't open %s", path); - free(path); - goto retdummy; - } - - /* - * Get filename from node.files - */ - for (i = 0; i < (ndx.fileno +1); i++) - fread(&fdx, sizeof(fdx), 1, fp); - fclose(fp); - - /* CHECK DOMAIN HERE */ - - /* - * Open and read in real nodelist - */ - sprintf(path, "%s/%s", CFG.nodelists, fdx.filename); - if ((fp = fopen(path, "r")) == NULL) { - tasklog('?', "$Can't open %s", path); - free(path); - goto retdummy; - } + /* + * First, lookup node in index. NOTE -- NOT 5D YET + */ + path = calloc(128, sizeof(char)); + sprintf(path, "%s/%s", CFG.nodelists, "node.index"); + if ((fp = fopen(path, "r")) == NULL) { + tasklog('?', "$Can't open %s", path); free(path); + goto retdummy; + } - if (fseek(fp, ndx.offset, SEEK_SET) != 0) { - tasklog('?', "$Seek failed for nodelist entry"); - fclose(fp); - goto retdummy; + fseek(fp, 0, SEEK_END); + highest = ftell(fp) / sizeof(ndx); + lowest = 0; + + while (TRUE) { + current = ((highest - lowest) / 2) + lowest; + fseek(fp, current * sizeof(ndx), SEEK_SET); + if (fread(&ndx, sizeof(ndx), 1, fp) != 1) + break; + + if (comp_node(ndx, xaddr) == 0) { + Found = TRUE; + break; } - - if (fgets(buf, sizeof(buf)-1, fp) == NULL) { - tasklog('?', "$fgets failed for nodelist entry"); - fclose(fp); - goto retdummy; - } - fclose(fp); - - nodebuf.type = ndx.type; - nodebuf.pflag = ndx.pflag; - - if (*(p = buf + strlen(buf) -1) == '\n') - *p = '\0'; - if (*(p = buf + strlen(buf) -1) == '\r') - *p = '\0'; - for (p = buf; *p; p++) - if (*p == '_') - *p = ' '; - - p = buf; - - if ((q = strchr(p,','))) - *q++ = '\0'; - - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - nodebuf.name = p; - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - nodebuf.location = p; - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - nodebuf.sysop = p; - p = q; - if (p == NULL) - goto badsyntax; - - if ((q=strchr(p,','))) - *q++ = '\0'; - if (strcasecmp(p, "-Unpublished-") == 0) - nodebuf.phone = NULL; + if (comp_node(ndx, xaddr) < 0) + lowest = current; else - nodebuf.phone = p; - p = q; - if (p == NULL) - goto badsyntax; + highest = current; + if ((highest - lowest) <= 1) + break; + } - if ((q=strchr(p,','))) - *q++ = '\0'; - nodebuf.speed = atoi(p); + fclose(fp); - /* - * Process the nodelist flags. - */ - ixflag = 0; - stdflag = TRUE; - for (p = q; p; p = q) { - if ((q = strchr(p, ','))) - *q++ = '\0'; - if ((strncasecmp(p, "U", 1) == 0) && (strlen(p) == 1)) { - stdflag = FALSE; - } else { - /* - * Experimental: process authorized flags and - * User flags both as authorized. - */ - for (j = 0; fkey[j].key; j++) - if (strcasecmp(p, fkey[j].key) == 0) - nodebuf.mflags |= fkey[j].flag; - for (j = 0; okey[j].key; j++) - if (strcasecmp(p, okey[j].key) == 0) - nodebuf.oflags |= okey[j].flag; - for (j = 0; dkey[j].key; j++) - if (strcasecmp(p, dkey[j].key) == 0) - nodebuf.dflags |= dkey[j].flag; - for (j = 0; ikey[j].key; j++) - if (strncasecmp(p, ikey[j].key, strlen(ikey[j].key)) == 0) - nodebuf.iflags |= ikey[j].flag; - for (j = 0; xkey[j].key; j++) - if (strcasecmp(p, xkey[j].key) == 0) - nodebuf.xflags |= xkey[j].flag; - if ((p[0] == 'T') && (strlen(p) == 3)) { - /* - * System open hours flag - */ - nodebuf.t1 = p[1]; - nodebuf.t2 = p[2]; - } - if (!stdflag) { - if (ixflag < MAXUFLAGS) { - nodebuf.uflags[ixflag++] = p; - if (ixflag < MAXUFLAGS) - nodebuf.uflags[ixflag] = NULL; - } - } + if (!Found) { + free(path); + goto retdummy; + } + + sprintf(path, "%s/%s", CFG.nodelists, "node.files"); + if ((fp = fopen(path, "r")) == NULL) { + tasklog('?', "$Can't open %s", path); + free(path); + goto retdummy; + } + + /* + * Get filename from node.files + */ + for (i = 0; i < (ndx.fileno +1); i++) + fread(&fdx, sizeof(fdx), 1, fp); + fclose(fp); + + /* CHECK DOMAIN HERE */ + + /* + * Open and read in real nodelist + */ + sprintf(path, "%s/%s", CFG.nodelists, fdx.filename); + if ((fp = fopen(path, "r")) == NULL) { + tasklog('?', "$Can't open %s", path); + free(path); + goto retdummy; + } + + if (fseek(fp, ndx.offset, SEEK_SET) != 0) { + tasklog('?', "$Seek failed for nodelist entry"); + fclose(fp); + goto retdummy; + } + + if (fgets(buf, sizeof(buf)-1, fp) == NULL) { + tasklog('?', "$fgets failed for nodelist entry"); + fclose(fp); + goto retdummy; + } + fclose(fp); + + /* + * Load noderecord if this node has one, if there is one then + * nodelist overrides in this record will be used instead of + * the nodelist entries. + */ + sprintf(path, "%s/etc/nodes.data", getenv("MBSE_ROOT")); + if ((fp = fopen(path, "r")) != NULL) { + fread(&ndhdr, sizeof(ndhdr), 1, fp); + + while (fread(&nd, ndhdr.recsize, 1, fp) == 1) { + fseek(fp, ndhdr.filegrp + ndhdr.mailgrp, SEEK_CUR); + for (i = 0; i < 20; i++) { + if ((addr->zone == nd.Aka[i].zone) && (addr->net == nd.Aka[i].net) && + (addr->node == nd.Aka[i].node) && (addr->point == nd.Aka[i].point)) { + ndrecord = TRUE; + break; } + } + if (ndrecord) + break; } - nodebuf.addr.name = nodebuf.sysop; - nodebuf.addr.domain = xstrcpy(fdx.domain); - nodebuf.upnet = ndx.upnet; - nodebuf.upnode = ndx.upnode; - nodebuf.region = ndx.region; - if (addr->domain == NULL) - addr->domain = xstrcpy(nodebuf.addr.domain); + fclose(fp); + } + free(path); - free(mydomain); - return &nodebuf; + nodebuf.type = ndx.type; + nodebuf.pflag = ndx.pflag; + + if (*(p = buf + strlen(buf) -1) == '\n') + *p = '\0'; + if (*(p = buf + strlen(buf) -1) == '\r') + *p = '\0'; + for (p = buf; *p; p++) + if (*p == '_') + *p = ' '; + + p = buf; + + if ((q = strchr(p,','))) + *q++ = '\0'; + + p = q; + if (p == NULL) + goto badsyntax; + + if ((q=strchr(p,','))) + *q++ = '\0'; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get system name + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + if (ndrecord && strlen(nd.Nl_hostname)) + nodebuf.name = nd.Nl_hostname; + else + nodebuf.name = p; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get location + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + nodebuf.location = p; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get sysop name + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + nodebuf.sysop = p; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get phone number + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + if (strcasecmp(p, "-Unpublished-") == 0) + nodebuf.phone = NULL; + else + nodebuf.phone = p; + p = q; + if (p == NULL) + goto badsyntax; + + /* + * Get modem speed + */ + if ((q=strchr(p,','))) + *q++ = '\0'; + nodebuf.speed = atoi(p); + + /* + * Process the nodelist flags, get them from the node override + * field if this is present, else use the nodelist. + */ + if (ndrecord && strlen(nd.Nl_flags)) + q = nd.Nl_flags; + ixflag = 0; + stdflag = TRUE; + for (p = q; p; p = q) { + if ((q = strchr(p, ','))) + *q++ = '\0'; + if ((strncasecmp(p, "U", 1) == 0) && (strlen(p) == 1)) { + stdflag = FALSE; + } else { + /* + * Experimental: process authorized flags and + * User flags both as authorized. + */ + for (j = 0; fkey[j].key; j++) + if (strcasecmp(p, fkey[j].key) == 0) + nodebuf.mflags |= fkey[j].flag; + for (j = 0; okey[j].key; j++) + if (strcasecmp(p, okey[j].key) == 0) + nodebuf.oflags |= okey[j].flag; + for (j = 0; dkey[j].key; j++) + if (strcasecmp(p, dkey[j].key) == 0) + nodebuf.dflags |= dkey[j].flag; + for (j = 0; ikey[j].key; j++) + if (strncasecmp(p, ikey[j].key, strlen(ikey[j].key)) == 0) + nodebuf.iflags |= ikey[j].flag; + for (j = 0; xkey[j].key; j++) + if (strcasecmp(p, xkey[j].key) == 0) + nodebuf.xflags |= xkey[j].flag; + if ((p[0] == 'T') && (strlen(p) == 3)) { + /* + * System open hours flag + */ + nodebuf.t1 = p[1]; + nodebuf.t2 = p[2]; + } + if (!stdflag) { + if (ixflag < MAXUFLAGS) { + nodebuf.uflags[ixflag++] = p; + if (ixflag < MAXUFLAGS) + nodebuf.uflags[ixflag] = NULL; + } + } + } + } + + nodebuf.addr.name = nodebuf.sysop; + nodebuf.addr.domain = xstrcpy(fdx.domain); + nodebuf.upnet = ndx.upnet; + nodebuf.upnode = ndx.upnode; + nodebuf.region = ndx.region; + if (addr->domain == NULL) + addr->domain = xstrcpy(nodebuf.addr.domain); + + free(mydomain); + return &nodebuf; badsyntax: - tasklog('?', "nodelist %d offset +%lu: bad syntax in line \"%s\"", - ndx.fileno, (unsigned long)ndx.offset, buf); - /* fallthrough */ + tasklog('?', "nodelist %d offset +%lu: bad syntax in line \"%s\"", ndx.fileno, (unsigned long)ndx.offset, buf); + /* fallthrough */ retdummy: - memset(&nodebuf, 0, sizeof(nodebuf)); - nodebuf.pflag = NL_DUMMY; - nodebuf.name = (char *)"Unknown"; - nodebuf.location = (char *)"Nowhere"; - nodebuf.sysop = (char *)"Sysop"; - nodebuf.phone = NULL; - nodebuf.speed = 2400; - free(mydomain); + memset(&nodebuf, 0, sizeof(nodebuf)); + nodebuf.pflag = NL_DUMMY; + nodebuf.name = (char *)"Unknown"; + nodebuf.location = (char *)"Nowhere"; + nodebuf.sysop = (char *)"Sysop"; + nodebuf.phone = NULL; + nodebuf.speed = 2400; + free(mydomain); - return &nodebuf; + return &nodebuf; }