Fixed a bug where mbtask would not stop calling undialable nodes

This commit is contained in:
Michiel Broek 2003-02-08 14:21:33 +00:00
parent af926964ba
commit e52324bf3a
4 changed files with 367 additions and 389 deletions

View File

@ -117,7 +117,6 @@ static int getkwd(char **dest)
(*tmpm)->name = xstrcpy(v);
tmp = strtoul(p, NULL, 0);
(*tmpm)->value = tmp;
// Syslog('n', "getkwd: %s(%d): \"%s\" \"%s\" \"%08x\"", nlpath, linecnt, MBSE_SS(k), (*tmpm)->name, (*tmpm)->value);
return 0;
}
@ -161,8 +160,6 @@ static int getmdm(char **dest)
tmp2 = strtoul(q, NULL, 0);
(*tmpm)->mask = tmp1;
(*tmpm)->value = tmp2;
// Syslog('n', "getmdm: %s(%d): \"%s\" \"%s\" \"%08x\" \"%08x\"", nlpath, linecnt, MBSE_SS(k),
// (*tmpm)->name, (*tmpm)->mask, (*tmpm)->value);
return 0;
}
@ -185,7 +182,6 @@ static int getarr(char **dest)
(*tmpm) = (nodelist_array *) xmalloc(sizeof(nodelist_array));
(*tmpm)->next = NULL;
(*tmpm)->name = xstrcpy(v);
// Syslog('n', "getarr: %s(%d): \"%s\" \"%s\"", nlpath, linecnt, MBSE_SS(k), (*tmpm)->name);
return 0;
}
@ -216,7 +212,6 @@ static int getdom(char **dest)
tmp = strtod(v, NULL);
(*tmpm)->zone = tmp;
(*tmpm)->name = xstrcpy(p);
// Syslog('n', "getdom: %s(%d): \"%s\" \"%d\" \"%s\"", nlpath, linecnt, MBSE_SS(k), (*tmpm)->zone, (*tmpm)->name);
return 0;
}
@ -259,8 +254,6 @@ static int getsrv(char **dest)
(*tmpm)->service = xstrcpy(p);
tmp = strtoul(q, NULL, 0);
(*tmpm)->port = tmp;
// Syslog('n', "getsrv: %s(%d): \"%s\" \"%s\" \"%s\" \"%d\"", nlpath, linecnt, MBSE_SS(k),
// (*tmpm)->flag, (*tmpm)->service, (*tmpm)->port);
return 0;
}
@ -459,8 +452,6 @@ int initnl(void)
continue;
}
// Syslog('n', "\"%s\" \"%s\" - parsed", MBSE_SS(k), MBSE_SS(v));
for (i = 0; keytab[i].key; i++)
if (strcasecmp(k,keytab[i].key) == 0)
break;
@ -636,12 +627,18 @@ node *getnlent(faddr *addr)
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])
if (addr->zone == fidonet.zone[i]) {
nodebuf.addr.domain = xstrcpy(fidonet.domain);
Found = TRUE;
break;
}
}
if (Found)
break;
}
fclose(fp);
}
Found = FALSE;
/*
* First, lookup node in index. NOTE -- NOT 5D YET
@ -735,7 +732,6 @@ node *getnlent(faddr *addr)
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('n', "getnlent: node record is present");
break;
}
}
@ -783,7 +779,7 @@ node *getnlent(faddr *addr)
if ((q=strchr(p,',')))
*q++ = '\0';
if (ndrecord && strlen(nd.Nl_hostname)) {
Syslog('n', "getnlent: system name override with %s", nd.Nl_hostname);
Syslog('+', "getnlent: %s system name override with %s", ascfnode(addr,0xff), nd.Nl_hostname);
nodebuf.name = nd.Nl_hostname;
} else
nodebuf.name = p;
@ -843,7 +839,7 @@ node *getnlent(faddr *addr)
* Process the nodelist flags.
*/
if (ndrecord && strlen(nd.Nl_flags)) {
Syslog('n', "getnlent: flags override %s", nd.Nl_flags);
Syslog('+', "getnlent: %s flags override %s", ascfnode(addr,0xff), nd.Nl_flags);
q = nd.Nl_flags;
}
ixflag = 0;
@ -900,7 +896,7 @@ node *getnlent(faddr *addr)
break;
}
/*
* Linse starting with ;E space are real errors.
* Lines starting with ;E space are real errors.
*/
if (strncmp(ebuf, (char *)";E ", 3) == 0)
break;
@ -1011,7 +1007,6 @@ node *getnlent(faddr *addr)
for (p = q; p; p = q) {
if ((q = strchr(p, ',')))
*q++ = '\0';
Syslog('n', "\"%s\"", MBSE_SS(p));
if ((r = strchr(p, ':'))) {
r++;
/*

View File

@ -4,7 +4,7 @@
* Purpose ...............: Read mailer last call status
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -42,8 +42,7 @@ char *stsname(faddr *);
char *stsname(faddr *addr)
{
static char buf[PATH_MAX];
char *p, *domain=NULL;
char zpref[8];
char *p, *domain=NULL, zpref[8];
int i;
sprintf(buf, "%s", CFG.outbound);
@ -67,8 +66,7 @@ char *stsname(faddr *addr)
break;
}
if ((domain != NULL) && (strlen(CFG.aka[0].domain) != 0) &&
(strcasecmp(domain,CFG.aka[0].domain) != 0)) {
if ((domain != NULL) && (strlen(CFG.aka[0].domain) != 0) && (strcasecmp(domain,CFG.aka[0].domain) != 0)) {
if ((p = strrchr(buf,'/')))
p++;
else
@ -77,8 +75,7 @@ char *stsname(faddr *addr)
for (; *p; p++)
*p = tolower(*p);
for (i = 0; i < 40; i++)
if ((strlen(CFG.aka[i].domain)) &&
(strcasecmp(CFG.aka[i].domain, domain) == 0))
if ((strlen(CFG.aka[i].domain)) && (strcasecmp(CFG.aka[i].domain, domain) == 0))
break;
/*

View File

@ -4,7 +4,7 @@
* Purpose ...............: mbtask - Scan mail outbound status
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -395,7 +395,6 @@ int outstat()
else
tmin = 30;
sprintf(be, "%02d:%02d", thour, tmin);
// Syslog('o', "Setting next hour for Txx node at %s", be);
set_next(thour, tmin);
if (strcmp(as, be) > 0) {
/*
@ -609,7 +608,6 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
(strcasecmp((*tmp)->addr.domain,addr->domain) == 0)))
break;
if (*tmp == NULL) {
Syslog('-', "%s", ascfnode(addr, 0xff));
nlent = getnlent(addr);
*tmp = (struct _alist *)malloc(sizeof(struct _alist));
(*tmp)->next = NULL;
@ -679,7 +677,8 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
if (*p == '\\')
*p='/';
for (p = buf; *p && isspace(*p); p++);
if (*p == '~') continue;
if (*p == '~')
continue;
if ((*p == '#') || (*p == '-') || (*p == '^') || (*p == '@'))
p++;
if (stat(p, &st) != 0) {

View File

@ -4,7 +4,7 @@
* Purpose ...............: Outbound scanning
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -52,18 +52,16 @@ extern struct _fidonet fidonet;
static int scan_dir(int (*)(faddr*,char,int,char*),char*,int);
static int scan_dir(int (*)(faddr*, char, int, char *), char *, int);
static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispoint)
{
char fname[PATH_MAX];
char flavor = '?';
char fname[PATH_MAX], flavor = '?';
DIR *dp = NULL;
struct dirent *de;
int rc = 0, isflo, fage;
time_t t_start;
t_start = time(NULL);
// Syslog('o' ,"scan_dir \"%s\" (%s)",MBSE_SS(dname),ispoint?"point":"node");
if ((dp = opendir(dname)) == NULL) {
Syslog('-', "Creating directory %s", dname);
@ -78,10 +76,8 @@ static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispo
}
}
while ((de=readdir(dp)))
if ((strlen(de->d_name) == 12) && (de->d_name[8] == '.') &&
(strspn(de->d_name,"0123456789abcdefABCDEF") == 8)) {
// Syslog('o' ,"checking: \"%s\"",de->d_name);
while ((de=readdir(dp))) {
if ((strlen(de->d_name) == 12) && (de->d_name[8] == '.') && (strspn(de->d_name,"0123456789abcdefABCDEF") == 8)) {
addr.point= 0;
strncpy(fname,dname,PATH_MAX-2);
strcat(fname,"/");
@ -124,7 +120,6 @@ static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispo
isflo=OUT_POL;
else
isflo=-1;
// Syslog('o' ,"%s \"%s\"", (isflo == OUT_FLO) ? "flo file" : "packet", de->d_name);
if ((rc=fn(&addr,flavor,isflo,fname)))
goto exout;
} else if ((strncasecmp(de->d_name+9,"su",2) == 0) ||
@ -138,12 +133,10 @@ static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispo
if ((rc = fn(&addr, flavor, isflo, fname)))
goto exout;
// Syslog('o' ,"arcmail file \"%s\"",de->d_name);
sprintf(fname, "%s/%s", dname, de->d_name);
fage = (int)((t_start - file_time(fname)) / 86400);
if (file_size(fname) == 0) {
// Syslog('o', "Age %d days", fage);
/*
* Remove truncated ARCmail that has a day extension
* other then the current day or if the file is older
@ -162,8 +155,7 @@ static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispo
if (unlink(fname) == 0)
Syslog('+', "Removed ARCmail %s, %d days", fname, fage);
}
} else {
// Syslog('o' ,"skipping \"%s\"",de->d_name);
}
}
}
@ -178,8 +170,7 @@ int scanout(int (*fn)(faddr *, char, int, char *))
{
int i, j, rc = 0;
unsigned short zone = 0;
char fext[5];
char *p = NULL, *q = NULL;
char fext[5], *p = NULL, *q = NULL;
DIR *dp;
if ((dp = opendir(CFG.outbound)) == NULL) {
@ -197,8 +188,7 @@ int scanout(int (*fn)(faddr *, char, int, char *))
if (SearchFidonet(zone)) {
for (j = 0; j < 6; j++) {
/*
* Create outbound directory name for
* the primary aka of that zone.
* Create outbound directory name for the primary aka of that zone.
*/
p = xstrcpy(CFG.outbound);
if (zone != CFG.aka[0].zone) {
@ -209,18 +199,15 @@ int scanout(int (*fn)(faddr *, char, int, char *))
}
/*
* Not primary zones in the domain get
* a directory extension.
* Not primary zones in the domain get a directory extension.
*/
if (fidonet.zone[j]) {
if (j) {
sprintf(fext, ".%03x", fidonet.zone[j]);
p = xstrcat(p, fext);
}
// Syslog('o', "Zone %d Dir %s", fidonet.zone[j], p);
addr.zone = fidonet.zone[j];
addr.domain = fidonet.domain;
if ((rc = scan_dir(fn, p, 0))) {
if (p)
free(p);