Fixed IP port override if there is a port added to a protocol

This commit is contained in:
Michiel Broek 2004-08-07 19:59:46 +00:00
parent 0afef11716
commit 4a1d20986b
3 changed files with 31 additions and 6 deletions

View File

@ -12,6 +12,9 @@ v0.61.3 25-Jul-2004
Removed the fdn parameter from the attach and un_attach
functions, not needed anymore.
libnodelist.a:
Fixed IP port override if there is a port added to a protocol.
mbfido:
Changed netmail counters in the .msg import function.
Fixed logging of 0 articles in scannews.

View File

@ -236,7 +236,7 @@ static int getsrv(char **dest)
(*tmpm)->flag = xstrcpy(v);
(*tmpm)->service = xstrcpy(p);
tmp = strtoul(q, NULL, 0);
(*tmpm)->port = tmp;
(*tmpm)->defport = (*tmpm)->tmpport = tmp;
return 0;
}
@ -816,6 +816,12 @@ node *getnlent(faddr *addr)
*q++ = '\0';
nodebuf.speed = atoi(p);
/*
* Reset all possible overridden portnumbers to the default from nodelist.conf
*/
for (tmps = &nl_service; *tmps; tmps=&((*tmps)->next))
(*tmps)->tmpport = (*tmps)->defport;
/*
* Process the nodelist flags.
*/
@ -844,8 +850,23 @@ node *getnlent(faddr *addr)
if (strcasecmp(p, (*tmpm)->name) == 0)
nodebuf.dflags |= (*tmpm)->value;
for (tmpm = &nl_tcpip; *tmpm; tmpm=&((*tmpm)->next))
if (strncasecmp(p, (*tmpm)->name, strlen((*tmpm)->name)) == 0)
if (strncasecmp(p, (*tmpm)->name, strlen((*tmpm)->name)) == 0) {
nodebuf.iflags |= (*tmpm)->value;
/*
* Parse the IP flag for a optional port number.
*/
if ((r = strrchr(p, ':'))) {
*r++;
for (tmps = &nl_service; *tmps; tmps=&((*tmps)->next)) {
if (strncmp(p, (*tmps)->flag, 3) == 0) {
if (atoi(r)) {
(*tmps)->tmpport = atoi(r);
Syslog('n', "getnlent: port override %s %s to %d", (*tmpm)->name, p, (*tmps)->tmpport);
}
}
}
}
}
for (tmpf = &nl_request; *tmpf; tmpf=&((*tmpf)->next))
if (strcasecmp(p, (*tmpf)->name) == 0)
nodebuf.xflags = (*tmpf)->value;
@ -900,8 +921,8 @@ node *getnlent(faddr *addr)
for (tmps = &nl_service; *tmps; tmps=&((*tmps)->next)) {
if (strcmp((*tmps)->flag, (*tmpm)->name) == 0) {
sprintf(tbuf, "%s", (*tmps)->service);
tport = (*tmps)->port;
Syslog('n', "getnlent: protocol %s at port %d", (*tmps)->service, (*tmps)->port);
tport = (*tmps)->tmpport;
Syslog('n', "getnlent: protocol %s at port %d", (*tmps)->service, (*tmps)->tmpport);
}
}
}
@ -1062,7 +1083,7 @@ node *getnlent(faddr *addr)
* for this protocol.
*/
sprintf(tbuf, ":%lu", tport);
Syslog('n', "getnlent: adding default port %s", tbuf);
Syslog('n', "getnlent: adding port %s", tbuf);
nodebuf.url = xstrcat(nodebuf.url, tbuf);
}

View File

@ -76,7 +76,8 @@ typedef struct _nodelist_service {
struct _nodelist_service *next;
char *flag;
char *service;
unsigned long port;
unsigned long defport; /* Configured default port */
unsigned long tmpport; /* Override port for call */
} nodelist_service;