Default domain nodelists lookups made working

This commit is contained in:
Michiel Broek 2003-02-06 20:06:07 +00:00
parent 561533ead6
commit 780beffadc
3 changed files with 35 additions and 9 deletions

View File

@ -30,6 +30,9 @@ v0.37.01 14-Jan-2003.
nodelist.a:
Added experimental support for IP nodes lookup using a default
domain method. This is not the final implementation yet!
Update, this works now as described in a FSP-xxxx that is in
discussion in the FTSC. This will also work for current
practice.
common.a:
Removed charset conversion/translation.

View File

@ -628,9 +628,24 @@ node *getnlent(faddr *addr)
goto retdummy;
/*
* First, lookup node in index. NOTE -- NOT 5D YET
* Search domainname for the requested aka, should not fail.
*/
path = calloc(PATH_MAX, sizeof(char));
sprintf(path, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
if ((fp = fopen(path, "r"))) {
fread(&fidonethdr, sizeof(fidonethdr), 1, fp);
while (fread(&fidonet, fidonethdr.recsize, 1, fp) == 1) {
for (i = 0; i < 6; i++) {
if (addr->zone == fidonet.zone[i])
nodebuf.addr.domain = xstrcpy(fidonet.domain);
}
}
fclose(fp);
}
/*
* First, lookup node in index. NOTE -- NOT 5D YET
*/
sprintf(path, "%s/%s", CFG.nodelists, "node.index");
if ((fp = fopen(path, "r")) == NULL) {
WriteError("$Can't open %s", path);
@ -1039,14 +1054,18 @@ node *getnlent(faddr *addr)
memset(&tbuf, 0, sizeof(tbuf));
} else if (strcasecmp((*tmpa)->name, "defdomain") == 0) {
Syslog('n', "Trying default domain");
for (tmpd = &nl_domsuffix; *tmpd; tmpd=&((*tmpd)->next)) {
if ((*tmpd)->zone == nodebuf.addr.zone) {
sprintf(tbuf, "f%d.n%d.z%d.%s.%s", nodebuf.addr.node, nodebuf.addr.net,
nodebuf.addr.zone, nodebuf.addr.domain, (*tmpd)->name);
Syslog('n', "Will try default domain \"%s\"", tbuf);
nodebuf.url = xstrcat(nodebuf.url, tbuf);
break;
if (nodebuf.addr.domain) {
for (tmpd = &nl_domsuffix; *tmpd; tmpd=&((*tmpd)->next)) {
if ((*tmpd)->zone == nodebuf.addr.zone) {
sprintf(tbuf, "f%d.n%d.z%d.%s.%s", nodebuf.addr.node, nodebuf.addr.net,
nodebuf.addr.zone, nodebuf.addr.domain, (*tmpd)->name);
Syslog('n', "Will try default domain \"%s\"", tbuf);
nodebuf.url = xstrcat(nodebuf.url, tbuf);
break;
}
}
} else {
Syslog('+', "getnlent: no domain name for zone %d, check setup", nodebuf.addr.zone);
}
if (strlen(tbuf))
break;

View File

@ -164,12 +164,16 @@ search field8
search defdomain
# The default searchdomain, will be prefixed with f1.n2.z3.fidonet.
# The default searchdomain, will be prefixed with f1.n2.z3.fidonet or
# f33.n44.z55.othernet. Add other networks here.
# Node 3:2/1 will look like: f1.n2.z3.fidonet.net
#
# Zone Suffix (without leading dot!)
domsuffix 1 net
domsuffix 2 net
domsuffix 3 net
domsuffix 4 net
domsuffix 5 net
domsuffix 6 net
domsuffix 92 mbse.ym