Added nodelist override settings

This commit is contained in:
Michiel Broek 2002-07-13 12:58:35 +00:00
parent 4982b8bd2b
commit e9562655ae
8 changed files with 839 additions and 721 deletions

View File

@ -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

View File

@ -478,9 +478,21 @@ MSN/EAZ the device should listen to. This should for an MSN be your telephone
number <b>with</b> the area code but <b>without</b> the leading 0. For an
EAZ the last digit of your EAZ.
<p> The ISDN ports </p>
<pre>port ttyI0<br>modem-type data<br>init-chat "" ATZ OK AT&amp;E714015437&amp;W0 OK AT&amp;B512 OK<br><br>port ttyI1<br>modem-type data<br>init-chat "" ATZ OK AT&amp;E714017198&amp;W0 OK AT&amp;B512 OK<br><br></pre>
From the mbsetup menu #5 "Edit Modem types" configure the ISDN modem type.
<pre>
<pre>
port ttyI0
modem-type data
init-chat "" ATZ OK
AT&amp;E714015437&amp;W0 OK
AT&amp;B512 OK
port ttyI1
modem-type data
init-chat "" ATZ OK
AT&amp;E714017198&amp;W0 OK
AT&amp;B512 OK
</pre>
From the mbsetup menu #5 "Edit Modem types" configure the ISDN modem type.
<pre>
Modem type ISDN Linux
Init string ATZ\r
Init string

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -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 }

View File

@ -12,10 +12,9 @@
</HEAD>
<BODY>
<BLOCKQUOTE>
<h5>Last update 28-Jun-2002</h5>
<P>&nbsp;<P>
<div align=right><h5>Last update 13-Jul-2002</h5></div>
<H1>MBSE BBS Setup - Fidonet nodes.</H1>
<div align=center><H1>MBSE BBS Setup - Fidonet nodes.</H1></div>
<P>
<h3>Introduction</H3>
@ -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.
<pre>
<strong>Sysop name </strong>The name of the system operator.
<strong>Outbox dir </strong>Private extra outbound directory for this node.
<strong>Pvt. phone </strong>Contact info, node private phone.
<strong>Pvt. fax </strong>Contact info, node private fax.
<strong>Pvt. cellphone </strong>Contact info, node cellphone (GSM).
<strong>Pvt. e-mail </strong>Contact info, node e-mail address.
<strong>Pvt. remark </strong>Contact info, node remark.
<strong>Route via </strong>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.
<strong>Netmail direct </strong>Set "direct" flag in netmail to this node.
<strong>Netmail crash </strong>Send netmail always "crash" to this node.
<strong>Netmail hold </strong>Put mail on "hold" for this node.
<strong>Pack netmail </strong>Should netmail be packed in arcmail archives.
<strong>Send notify </strong>Send automatic generated notify messages.
<strong>Language </strong>The language to use for areamgr msgs.
<strong>Deleted </strong>If this node must be deleted.
</pre>
<p><table>
<tr><th nowrap align=left valign=top>Sysop name</th><td>The name of the system
operator. The name entered here is used in Areamgr and Filemgr messages etc.</td></tr>
<tr><th nowrap align=left valign=top>Outbox dir</th><td>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.</td></tr>
<tr><th nowrap align=left valign=top>Pvt. phone</th><td>Contact info, node private
phone.</td></tr>
<tr><th nowrap align=left valign=top>Pvt. fax</th><td>Contact info, node private
fax.</td></tr>
<tr><th nowrap align=left valign=top>Pvt. cellphone</th><td>Contact info, node
cellphone (GSM).</td></tr>
<tr><th nowrap align=left valign=top>Pvt. e-mail</th><td>Contact info, node e-mail
address.</td></tr>
<tr><th nowrap align=left valign=top>Pvt. remark</th><td>Contact info, node
remark.</td></tr>
<tr><th nowrap align=left valign=top>Route via</th><td>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.</td></tr>
<tr><th nowrap align=left valign=top>Netmail direct</th><td>Set "direct" flag in
netmail to this node.</td></tr>
<tr><th nowrap align=left valign=top>Netmail crash</th><td>Send netmail always "crash"
to this node.</td></tr>
<tr><th nowrap align=left valign=top>Netmail hold</th><td>Put mail on "hold" for this
node.</td></tr>
<tr><th nowrap align=left valign=top>Pack netmail</th><td>Should netmail be packed in
arcmail archives.</td></tr>
<tr><th nowrap align=left valign=top>Send notify</th><td>Send automatic generated
notify messages.</td></tr>
<tr><th nowrap align=left valign=top>Language</th><td>The language to use for areamgr
msgs.</td></tr>
<tr><th nowrap align=left valign=top>Deleted</th><td>If this node must be
deleted.</td></tr>
</table>
<P>
<IMG SRC="../images/nodes1.png">
<P>&nbsp;<p>
@ -68,32 +83,32 @@ In this screen you can setup 20 aka's for the node.
<H3>Edit node session</H3>
<p>
In this screen you can setup the session defaults. Items 5/8 will be added later.
<pre>
<strong>Session passwd </strong>This is the mailer session password.
<strong>Dial command </strong>You can put an override here for the normal
dial command. If you leave this empty the
command from the modem setup is used.
<strong>Phone number 1 </strong>An alternative phone number/ip address to dial.
<strong>Phone number 2 </strong>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.
<strong>No EMSI </strong>Disable EMSI handshake.
<strong>No YooHoo/2U2 </strong>Disable FTSC-0006 handshake.
<strong>No Filerequest </strong>Disable filerquest from this node.
<strong>Don't call </strong>Do not call this node.
<strong>8.3 names </strong>Set this if the node only accepts 8.3 filenames.
<strong>No Zmodem </strong>Disable Zmodem protocol.
<strong>No Zedzap </strong>Disable Zedzap protocol.
<strong>No Hydra </strong>Disable Hydra protocol.
<strong>No TCP/IP IBN </strong>Disbale TCP/IP IBN (binkp) protocol.
<strong>No TCP/IP IFC </strong>Disable TCP/IP IFC (ifcico) protocol.
<strong>No TCP/IP ITN </strong>Disable TCP/IP ITN (telnet) protocol.
</pre>
In this screen you can setup the session defaults. Items 7 and 8 will be added later.
<p><table>
<tr><th nowrap align=left valign=top>Session passwd</th><td>This is the mailer session password.
<tr><th nowrap align=left valign=top>Dial command</th><td>You can put an override here for the normal dial command. If you leave this empty the command from the modem setup is used.
<tr><th nowrap align=left valign=top>Phone number 1</th><td>An alternative phone number/ip address to dial.
<tr><th nowrap align=left valign=top>Phone number 2</th><td>An alternative phone number/ip address to dial. Use these above commands if the node has another phone number as mentioned in the nodelist.
<tr><th nowrap align=left valign=top>Nodelist flags</th><td>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.
<tr><th nowrap align=left valign=top>Inet hostname</th><td>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.
<tr><th nowrap align=left valign=top>No EMSI</th><td>Disable EMSI handshake.
<tr><th nowrap align=left valign=top>No YooHoo/2U2</th><td>Disable FTSC-0006 handshake.
<tr><th nowrap align=left valign=top>No Filerequest</th><td>Disable filerequest from this node.
<tr><th nowrap align=left valign=top>Don't call</th><td>Do not call this node.
<tr><th nowrap align=left valign=top>8.3 names</th><td>Set this if the node only accepts 8.3 filenames.
<tr><th nowrap align=left valign=top>No Zmodem</th><td>Disable Zmodem protocol.
<tr><th nowrap align=left valign=top>No Zedzap</th><td>Disable Zedzap protocol.
<tr><th nowrap align=left valign=top>No Hydra</th><td>Disable Hydra protocol.
<tr><th nowrap align=left valign=top>No TCP/IP IBN</th><td>Disbale TCP/IP IBN (binkp) protocol.
<tr><th nowrap align=left valign=top>No TCP/IP IFC</th><td>Disable TCP/IP IFC (ifcico) protocol.
<tr><th nowrap align=left valign=top>No TCP/IP ITN</th><td>Disable TCP/IP ITN (telnet) protocol.
</table>
<p>
<IMG SRC="../images/nodes3.png">
<P>&nbsp;<p>
@ -101,19 +116,15 @@ In this screen you can setup the session defaults. Items 5/8 will be added later
<H3>Edit node - mail processing</H3>
<P>
<pre>
<strong>PKT password </strong>The password to insert in .pkt files.
<strong>Check PKT pwd </strong>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
<strong>UplMgr program </strong>The name of the Areamgr program of this node.
This could be AreaFix, AreaMgr etc.
<strong>UplMgr passwd </strong>The password for the Areamgr of this node.
<strong>Mail forward </strong>Not in use yet.
<strong>ARCmail comp. </strong>Use ARCmail 0.60 file naming convention for out of zone mail.
<strong>ARCmail a..z </strong>Allow a..z last character for ARCmail filenames.
</pre>
<p><table>
<tr><th nowrap align=left valign=top>PKT password</th><td>The password to insert in .pkt files.
<tr><th nowrap align=left valign=top>Check PKT pwd</th><td>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
<tr><th nowrap align=left valign=top>UplMgr program</th><td>The name of the Areamgr program of this node. This could be AreaFix, AreaMgr etc.
<tr><th nowrap align=left valign=top>UplMgr passwd</th><td>The password for the Areamgr of this node.
<tr><th nowrap align=left valign=top>Mail forward</th><td>Not in use yet.
<tr><th nowrap align=left valign=top>ARCmail comp.</th><td>Use ARCmail 0.60 file naming convention for out of zone mail.
<tr><th nowrap align=left valign=top>ARCmail a..z</th><td>Allow a..z last character for ARCmail filenames.
</table>
<P>
<IMG SRC="../images/nodes4.gif">
<P>&nbsp;<p>
@ -129,25 +140,24 @@ carefull not to allow a node to connect areas from networks he has no aka in.
<H3>File setup</H3>
<P>
<pre>
<strong>Files password </strong>The password for .tic files.
<strong>Mgr password </strong>The password for the Areamgr and Filemgr.
<strong>UplMgr program </strong>The name of the Filemgr progrom of this node.
This could be FileMgr, Allfix, Raid etc.
<strong>UplMgr passwd </strong>The password of the Filemgr if this node.
<strong>UplMgr Add + </strong>Add a "+" in the command to connect areas.
<strong>Incl. message </strong>Send a netmail message for each file to send.
<strong>Send TIC file </strong>Send .tic file to this node.
<strong>Advanced TIC </strong>Send advanced or standard .tic files.
<strong>File forward </strong>Forward TIC files for this node (not yet).
<strong>Billing </strong>Is Costsharing active for this node.
<strong>Bill direct </strong>Send the bill direct or on command.
<strong>Credit </strong>The credit this node has in units.
<strong>Debet </strong>The debet we have with this node (informational).
<strong>Add </strong>Add (or substract) factor to the bill.
<strong>Warn level </strong>The debet level when to write a warning mesage.
<strong>Stop level </strong>The debet level when to stop sending files.
</pre>
<p><table>
<tr><th nowrap align=left valign=top>Files password</th><td>The password for .tic files.
<tr><th nowrap align=left valign=top>Mgr password</th><td>The password for the Areamgr and Filemgr.
<tr><th nowrap align=left valign=top>UplMgr program</th><td>The name of the Filemgr progrom of this node. This could be FileMgr, Allfix, Raid etc.
<tr><th nowrap align=left valign=top>UplMgr passwd</th><td>The password of the Filemgr if this node.
<tr><th nowrap align=left valign=top>UplMgr Add +</th><td>Add a "+" in the command to connect areas.
<tr><th nowrap align=left valign=top>Incl. message</th><td>Send a netmail message for each file to send.
<tr><th nowrap align=left valign=top>Send TIC file</th><td>Send .tic file to this node.
<tr><th nowrap align=left valign=top>Advanced TIC</th><td>Send advanced or standard .tic files.
<tr><th nowrap align=left valign=top>File forward</th><td>Forward TIC files for this node (not yet).
<tr><th nowrap align=left valign=top>Billing</th><td>Is Costsharing active for this node.
<tr><th nowrap align=left valign=top>Bill direct</th><td>Send the bill direct or on command.
<tr><th nowrap align=left valign=top>Credit</th><td>The credit this node has in units.
<tr><th nowrap align=left valign=top>Debet</th><td>The debet we have with this node (informational).
<tr><th nowrap align=left valign=top>Add</th><td>Add (or substract) factor to the bill.
<tr><th nowrap align=left valign=top>Warn level</th><td>The debet level when to write a warning mesage.
<tr><th nowrap align=left valign=top>Stop level</th><td>The debet level when to stop sending files.
</table>
<P>
<IMG SRC="../images/nodes6.gif">
<P>&nbsp;<p>

View File

@ -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);
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]);
nodebuf.type = ndx.type;
nodebuf.pflag = ndx.pflag;
moflags(nodebuf.mflags);
diflags(nodebuf.dflags);
ipflags(nodebuf.iflags);
olflags(nodebuf.oflags);
rqflags(nodebuf.xflags);
free(mydomain);
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 = ' ';
return &nodebuf;
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)) {
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);
}

View File

@ -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")

View File

@ -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;
}