Skip to content
Snippets Groups Projects
Commit 8d7326d9 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Refactor the get_pw() and get_ticpw() methods

First look for a linked node matching the node address string as passed,
then look for a match using the normalized address (removing .0 and @domain).
The "ALL" wildcard should not be used for password lookups.

This should fix reported issue 240.
parent db78a985
Branches
Tags
No related merge requests found
......@@ -80,36 +80,24 @@ function SBBSEchoCfg (fname)
}
SBBSEchoCfg.prototype.get_ticpw = function(node)
{
if (!fidoaddr.is_valid(node)) throw 'get_ticpw: Invalid address ' + node;
var n = node;
while(n) {
if (this.ticpass[n] !== undefined)
return this.ticpass[n];
if (n === 'ALL')
break;
if (n.indexOf('@') !== -1)
n = n.replace(/@.*$/,'');
if (n.indexOf('ALL') !== -1)
n = n.replace(/[0-9]+[^0-9]ALL$/, 'ALL');
else
n = n.replace(/[0-9]+$/, 'ALL');
}
var addr = fidoaddr.parse(node);
if (!addr) throw new Error('get_ticpw: Invalid address ' + node);
if (this.ticpass[node] !== undefined)
return this.ticpass[node];
node = fidoaddr.to_str(addr);
if (this.ticpass[node] !== undefined)
return this.ticpass[node];
return undefined;
};
SBBSEchoCfg.prototype.get_pw = function(node)
{
if (!fidoaddr.is_valid(node)) throw 'get_pw: Invalid address ' + node;
var n = node;
while(n) {
if (this.pktpass[n] !== undefined)
return this.pktpass[n];
if (n === 'ALL')
break;
if (n.indexOf('ALL') !== -1)
n = n.replace(/[0-9]+[^0-9]ALL$/, 'ALL');
else
n = n.replace(/[0-9]+$/, 'ALL');
}
var addr = fidoaddr.parse(node);
if (!addr) throw new Error('get_pw: Invalid address ' + node);
if (this.pktpass[node] !== undefined)
return this.pktpass[node];
node = fidoaddr.to_str(addr);
if (this.pktpass[node] !== undefined)
return this.pktpass[node];
return undefined;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment