diff --git a/ChangeLog b/ChangeLog index e92e7af7..82cc984f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ v0.39.7 14-Jan-2004 Removed the check to disable calling points. Added a check to see if we get a URL to call other systems. If nodelist info fails, increase error counter in steps of 10. + Merged tmail patches from Przemyslaw Kwiatkowski. mbfido: Removed sync calls that are now in execute. @@ -29,6 +30,7 @@ v0.39.7 14-Jan-2004 mbtask: Will call points if a call method is available. + Merged tmail patches from Przemyslaw Kwiatkowski. script: New scripts are installed with an extension of .new, you need diff --git a/mbcico/Makefile b/mbcico/Makefile index 4ddf1474..2c6dc878 100644 --- a/mbcico/Makefile +++ b/mbcico/Makefile @@ -9,7 +9,7 @@ SRCS = zmmisc.c zmrle.c zmrecv.c zmsend.c binkp.c md5b.c \ answer.c chat.c dial.c dietifna.c emsidat.c filelist.c \ openfile.c openport.c opentcp.c rdoptions.c yoohoo.c \ recvbark.c respfreq.c sendbark.c tcp.c tcpproto.c wazoo.c \ - filetime.c ftsc.c atoul.c portsel.c shortbox.c \ + filetime.c ftsc.c atoul.c portsel.c \ ttyio.c lutil.c scanout.c emsi.c ulock.c \ callstat.c session.c call.c mbcico.c \ outstat.c nlinfo.c mbout.c mbtelind.c mbtelout.c @@ -18,7 +18,7 @@ HDRS = zmodem.h binkp.h config.h statetbl.h md5b.h \ answer.h chat.h dial.h dietifna.h emsidat.h filelist.h \ openfile.h openport.h opentcp.h rdoptions.h yoohoo.h \ recvbark.h respfreq.h sendbark.h tcp.h tcpproto.h wazoo.h \ - filetime.h ftsc.h atoul.h portsel.h shortbox.h \ + filetime.h ftsc.h atoul.h portsel.h \ ttyio.h lutil.h scanout.h emsi.h ulock.h \ callstat.h session.h call.h mbcico.h \ outstat.h nlinfo.h mbtelind.h mbtelout.h @@ -27,7 +27,7 @@ MBCICO_OBJS = zmmisc.o zmrle.o zmrecv.o zmsend.o binkp.o md5b.o \ answer.o chat.o dial.o dietifna.o emsidat.o filelist.o \ openfile.o openport.o opentcp.o rdoptions.o yoohoo.o \ recvbark.o respfreq.o sendbark.o tcp.o tcpproto.o wazoo.o \ - filetime.o ftsc.o atoul.o portsel.o shortbox.o \ + filetime.o ftsc.o atoul.o portsel.o \ ttyio.o lutil.o scanout.o emsi.o ulock.o \ callstat.o session.o call.o mbcico.o MBOUT_OBJS = outstat.o nlinfo.o mbout.o scanout.o callstat.o @@ -112,7 +112,7 @@ chat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records dial.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbnode.h ../lib/mberrors.h config.h chat.h ttyio.h session.h dial.h dietifna.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h emsi.h dietifna.h respfreq.h filelist.h xmrecv.h xmsend.h emsidat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h emsi.h session.h lutil.h config.h emsidat.h filetime.h -filelist.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h shortbox.h session.h filelist.h +filelist.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h session.h filelist.h openfile.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ../lib/users.h ../lib/records.h config.h lutil.h openfile.h openport.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h mbcico.h openport.h opentcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h ttyio.h openport.h opentcp.h @@ -128,7 +128,6 @@ filetime.o: ../config.h ../lib/libs.h filetime.h ftsc.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/mberrors.h session.h ttyio.h statetbl.h config.h ftsc.h rdoptions.h recvbark.h filelist.h sendbark.h respfreq.h xmrecv.h xmsend.h inbound.h atoul.o: ../config.h ../lib/libs.h atoul.h portsel.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h portsel.h -shortbox.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h shortbox.h ttyio.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ttyio.h lutil.h lutil.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h lutil.h scanout.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbftn.h config.h scanout.h lutil.h diff --git a/mbcico/filelist.c b/mbcico/filelist.c index 69f8d73b..5c181b67 100644 --- a/mbcico/filelist.c +++ b/mbcico/filelist.c @@ -37,7 +37,6 @@ #include "../lib/common.h" #include "../lib/nodelist.h" #include "config.h" -#include "shortbox.h" #include "session.h" #include "filelist.h" @@ -288,11 +287,15 @@ file_list *create_filelist(fa_list *al, char *fl, int create) { file_list *st = NULL, *tmpf; fa_list *tmpa; - char flavor, *tmpfl, *nm, *temp, tmpreq[13]; + char flavor, *tmpfl, *nm, *temp, tmpreq[13], digit[6], *temp2; struct stat stbuf; int packets = 0; FILE *fp; unsigned char buffer[2]; + faddr *fa; + DIR *dp = NULL; + struct dirent *de; + struct stat sb; Syslog('o', "Create_filelist(%s,\"%s\",%d)", al?ascfnode(al->addr,0x1f):"", MBSE_SS(fl), create); made_request = 0; @@ -309,30 +312,6 @@ file_list *create_filelist(fa_list *al, char *fl, int create) check_filebox(nodes.OutBox, st); } - /* - * Check T-Mail style fileboxes - */ - temp = calloc(PATH_MAX, sizeof(char)); - if (strlen(CFG.tmailshort)) { - sprintf(temp, "%s/%s", CFG.tmailshort, shortboxname(tmpa->addr)); - check_filebox(temp, st); - if (strchr(fl, 'h')) { - sprintf(temp, "%s/%sh", CFG.tmailshort, shortboxname(tmpa->addr)); - check_filebox(temp, st); - } - } - if (strlen(CFG.tmaillong)) { - sprintf(temp, "%s/%d.%d.%d.%d", CFG.tmaillong, tmpa->addr->zone, - tmpa->addr->net, tmpa->addr->node, tmpa->addr->point); - check_filebox(temp, st); - if (strchr(fl, 'h')) { - sprintf(temp, "%s/%d.%d.%d.%d.h", CFG.tmaillong, tmpa->addr->zone, - tmpa->addr->net, tmpa->addr->node, tmpa->addr->point); - check_filebox(temp, st); - } - } - free(temp); - /* * Check spool files, these are more or less useless but they * create a filelist of files to send which are never send. @@ -391,6 +370,114 @@ file_list *create_filelist(fa_list *al, char *fl, int create) } } + /* + * Check T-Mail style fileboxes + */ + temp = calloc(PATH_MAX, sizeof(char)); + if (strlen(CFG.tmailshort) && (dp = opendir(CFG.tmailshort))) { + Syslog('o', "Checking T-Mail short box \"%s\"", CFG.tmailshort); + while ((de = readdir(dp))) { + if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { + sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name); + if (stat(temp, &sb) == 0) { + Syslog('o' ,"checking \"%s\"", de->d_name); + if (S_ISDIR(sb.st_mode)) { + int i; + char b=0; + for (i=0; (i<8) && (!b); ++i) { + char c = tolower(de->d_name[i]); + if ( (c<'0') || (c>'v') || ((c>'9') && (c<'a')) ) + b=1; + } + if (de->d_name[8]!='.') + b=1; + for (i=9; (i<11) && (!b); ++i) { + char c = tolower(de->d_name[i]); + if ( (c<'0') || (c>'v') || ((c>'9') && (c<'a')) ) + b=1; + } + if (b) + continue; + if (de->d_name[11]==0) + flavor='o'; + else if ((tolower(de->d_name[11])=='h') && (de->d_name[12]==0)) + flavor='h'; + else + continue; + fa = (faddr*)malloc(sizeof(faddr)); + fa->name = NULL; + fa->domain = NULL; + memset(&digit, 0, sizeof(digit)); + digit[0] = de->d_name[0]; + digit[1] = de->d_name[1]; + fa->zone = strtol(digit, NULL, 32); + memset(&digit, 0, sizeof(digit)); + digit[0] = de->d_name[2]; + digit[1] = de->d_name[3]; + digit[2] = de->d_name[4]; + fa->net = strtol(digit, NULL, 32); + memset(&digit, 0, sizeof(digit)); + digit[0] = de->d_name[5]; + digit[1] = de->d_name[6]; + digit[2] = de->d_name[7]; + fa->node = strtol(digit, NULL, 32); + memset(&digit, 0, sizeof(digit)); + digit[0] = de->d_name[9]; + digit[1] = de->d_name[10]; + fa->point = strtol(digit, NULL, 32); + for (tmpa = al; tmpa; tmpa = tmpa->next) { + if ((fa->zone==tmpa->addr->zone) && (fa->net==tmpa->addr->net) && + (fa->node==tmpa->addr->node) && (fa->point==tmpa->addr->point) && + strchr(fl, flavor)) + check_filebox(temp, st); + } + tidy_faddr(fa); + } + } + } + } + closedir(dp); + } + + if (strlen(CFG.tmaillong) && (dp = opendir(CFG.tmaillong))) { + temp2 = calloc(PATH_MAX, sizeof(char)); + Syslog('o', "Checking T-Mail long box \"%s\"", CFG.tmaillong); + while ((de = readdir(dp))) { + if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { + sprintf(temp, "%s/%s", CFG.tmaillong, de->d_name); + if (stat(temp, &sb) == 0) { + Syslog('o' ,"checking \"%s\"", de->d_name); + if (S_ISDIR(sb.st_mode)) { + char c, d; + int n; + sprintf(temp2, "%s", de->d_name); + fa = (faddr*)malloc(sizeof(faddr)); + fa->name = NULL; + fa->domain = NULL; + n = sscanf(temp2, "%u.%u.%u.%u.%c%c", &(fa->zone), &(fa->net), &(fa->node), &(fa->point), &c, &d); + if ((n==4) || ((n==5) && (tolower(c)=='h'))) { + if (n==4) + flavor = 'o'; + else + flavor = 'h'; + for (tmpa = al; tmpa; tmpa = tmpa->next) { + if ((fa->zone==tmpa->addr->zone) && (fa->net==tmpa->addr->net) && + (fa->node==tmpa->addr->node) && (fa->point==tmpa->addr->point) && + strchr(fl, flavor)) + check_filebox(temp, st); + } + } + tidy_faddr(fa); + } + } + } + } + closedir(dp); + free(temp2); + } + free(temp); + + Syslog('o', "B4 FTS-0001 checkpoint"); /* * For FTS-0001 we need to create at least one packet. diff --git a/mbcico/outstat.c b/mbcico/outstat.c index 6bab585f..a91581b7 100644 --- a/mbcico/outstat.c +++ b/mbcico/outstat.c @@ -199,6 +199,28 @@ int outstat() if (stat(temp, &sb) == 0) { Syslog('o' ,"checking \"%s\"", de->d_name); if (S_ISDIR(sb.st_mode)) { + int i; + char b=0; + for (i=0; (i<8) && (!b); ++i) { + char c = tolower(de->d_name[i]); + if ( (c<'0') || (c>'v') || ((c>'9') && (c<'a')) ) + b=1; + } + if (de->d_name[8]!='.') + b=1; + for (i=9; (i<11) && (!b); ++i) { + char c = tolower(de->d_name[i]); + if ( (c<'0') || (c>'v') || ((c>'9') && (c<'a')) ) + b=1; + } + if (b) + continue; + if (de->d_name[11]==0) + flavor='o'; + else if ((tolower(de->d_name[11])=='h') && (de->d_name[12]==0)) + flavor='h'; + else + continue; fa = (faddr*)malloc(sizeof(faddr)); fa->name = NULL; fa->domain = NULL; @@ -223,10 +245,6 @@ int outstat() if (SearchFidonet(fa->zone)) { fa->domain = xstrcpy(fidonet.domain); } - if ((strlen(de->d_name) == 12) && (tolower(de->d_name[11]) == 'h')) - flavor = 'h'; - else - flavor = 'o'; checkdir(temp, fa, flavor); tidy_faddr(fa); } @@ -244,22 +262,23 @@ int outstat() if (stat(temp, &sb) == 0) { Syslog('o' ,"checking \"%s\"", de->d_name); if (S_ISDIR(sb.st_mode)) { + char c, d; + int n; sprintf(temp2, "%s", de->d_name); fa = (faddr*)malloc(sizeof(faddr)); fa->name = NULL; fa->domain = NULL; - fa->zone = atoi(strtok(temp2, ".\n\r\0")); - fa->net = atoi(strtok(NULL, ".\n\r\0")); - fa->node = atoi(strtok(NULL, ".\n\r\0")); - fa->point = atoi(strtok(NULL, ".\n\r\0")); - if (SearchFidonet(fa->zone)) { - fa->domain = xstrcpy(fidonet.domain); + n = sscanf(temp2, "%u.%u.%u.%u.%c%c", &(fa->zone), &(fa->net), &(fa->node), &(fa->point), &c, &d); + if ((n==4) || ((n==5) && (tolower(c)=='h'))) { + if (SearchFidonet(fa->zone)) { + fa->domain = xstrcpy(fidonet.domain); + } + if (n==4) + flavor = 'o'; + else + flavor = 'h'; + checkdir(temp, fa, flavor); } - if (tolower(de->d_name[strlen(de->d_name) -1]) == 'h') - flavor = 'h'; - else - flavor = 'o'; - checkdir(temp, fa, flavor); tidy_faddr(fa); } } diff --git a/mbtask/outstat.c b/mbtask/outstat.c index b0b1e62c..d7004cdb 100644 --- a/mbtask/outstat.c +++ b/mbtask/outstat.c @@ -347,84 +347,97 @@ int outstat() * Start checking T-Mail fileboxes */ if (strlen(CFG.tmailshort) && (dp = opendir(CFG.tmailshort))) { - while ((de = readdir(dp))) { - if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { - sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name); - if (stat(temp, &sb) == 0) { - if (S_ISDIR(sb.st_mode)) { - fa = (faddr*)malloc(sizeof(faddr)); - fa->name = NULL; - fa->domain = NULL; - memset(&digit, 0, sizeof(digit)); - digit[0] = de->d_name[0]; - digit[1] = de->d_name[1]; - fa->zone = strtol(digit, NULL, 32); - memset(&digit, 0, sizeof(digit)); - digit[0] = de->d_name[2]; - digit[1] = de->d_name[3]; - digit[2] = de->d_name[4]; - fa->net = strtol(digit, NULL, 32); - memset(&digit, 0, sizeof(digit)); - digit[0] = de->d_name[5]; - digit[1] = de->d_name[6]; - digit[2] = de->d_name[7]; - fa->node = strtol(digit, NULL, 32); - memset(&digit, 0, sizeof(digit)); - digit[0] = de->d_name[9]; - digit[1] = de->d_name[10]; - fa->point = strtol(digit, NULL, 32); - if (SearchFidonet(fa->zone)) { - fa->domain = xstrcpy(fidonet.domain); - } - if ((strlen(de->d_name) == 12) && (tolower(de->d_name[11]) == 'h')) - flavor = 'h'; - else - flavor = 'o'; - checkdir(temp, fa, flavor); + Syslog('o', "Checking T-Mail short box \"%s\"", CFG.tmailshort); + while ((de = readdir(dp))) { + if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { + sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name); + if (stat(temp, &sb) == 0) { + Syslog('o' ,"checking \"%s\"", de->d_name); + if (S_ISDIR(sb.st_mode)) { + int i; + char b=0; + for (i=0; (i<8) && (!b); ++i) { + char c = tolower(de->d_name[i]); + if ( (c<'0') || (c>'v') || ((c>'9') && (c<'a')) ) b=1; + } + if (de->d_name[8]!='.') b=1; + for (i=9; (i<11) && (!b); ++i) { + char c = tolower(de->d_name[i]); + if ( (c<'0') || (c>'v') || ((c>'9') && (c<'a')) ) b=1; + } + if (b) continue; + if (de->d_name[11]==0) flavor='o'; + else if ((tolower(de->d_name[11])=='h') && (de->d_name[12]==0)) flavor='h'; + else continue; + fa = (faddr*)malloc(sizeof(faddr)); + fa->name = NULL; + fa->domain = NULL; + memset(&digit, 0, sizeof(digit)); + digit[0] = de->d_name[0]; + digit[1] = de->d_name[1]; + fa->zone = strtol(digit, NULL, 32); + memset(&digit, 0, sizeof(digit)); + digit[0] = de->d_name[2]; + digit[1] = de->d_name[3]; + digit[2] = de->d_name[4]; + fa->net = strtol(digit, NULL, 32); + memset(&digit, 0, sizeof(digit)); + digit[0] = de->d_name[5]; + digit[1] = de->d_name[6]; + digit[2] = de->d_name[7]; + fa->node = strtol(digit, NULL, 32); + memset(&digit, 0, sizeof(digit)); + digit[0] = de->d_name[9]; + digit[1] = de->d_name[10]; + fa->point = strtol(digit, NULL, 32); + if (SearchFidonet(fa->zone)) { + fa->domain = xstrcpy(fidonet.domain); + } + checkdir(temp, fa, flavor); if (fa->domain) free(fa->domain); free(fa); - } - } - } - } - closedir(dp); + } + } + } + } + closedir(dp); } if (strlen(CFG.tmaillong) && (dp = opendir(CFG.tmaillong))) { - temp2 = calloc(PATH_MAX, sizeof(char)); - while ((de = readdir(dp))) { - if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { - sprintf(temp, "%s/%s", CFG.tmaillong, de->d_name); - if (stat(temp, &sb) == 0) { - if (S_ISDIR(sb.st_mode)) { - sprintf(temp2, "%s", de->d_name); - fa = (faddr*)malloc(sizeof(faddr)); - fa->name = NULL; - fa->domain = NULL; - fa->zone = atoi(strtok(temp2, ".\n\r\0")); - fa->net = atoi(strtok(NULL, ".\n\r\0")); - fa->node = atoi(strtok(NULL, ".\n\r\0")); - fa->point = atoi(strtok(NULL, ".\n\r\0")); - if (SearchFidonet(fa->zone)) { - fa->domain = xstrcpy(fidonet.domain); - } - if (tolower(de->d_name[strlen(de->d_name) -1]) == 'h') - flavor = 'h'; - else - flavor = 'o'; - checkdir(temp, fa, flavor); + temp2 = calloc(PATH_MAX, sizeof(char)); + Syslog('o', "Checking T-Mail long box \"%s\"", CFG.tmaillong); + while ((de = readdir(dp))) { + if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { + sprintf(temp, "%s/%s", CFG.tmaillong, de->d_name); + if (stat(temp, &sb) == 0) { + Syslog('o' ,"checking \"%s\"", de->d_name); + if (S_ISDIR(sb.st_mode)) { + char c, d; + int n; + sprintf(temp2, "%s", de->d_name); + fa = (faddr*)malloc(sizeof(faddr)); + fa->name = NULL; + fa->domain = NULL; + n = sscanf(temp2, "%u.%u.%u.%u.%c%c", &(fa->zone), &(fa->net), &(fa->node), &(fa->point), &c, &d); + if ((n==4) || ((n==5) && (tolower(c)=='h'))) { + if (SearchFidonet(fa->zone)) { + fa->domain = xstrcpy(fidonet.domain); + } + if (n==4) flavor = 'o'; + else flavor = 'h'; + checkdir(temp, fa, flavor); + } if (fa->domain) free(fa->domain); free(fa); - } - } - } - } - closedir(dp); - free(temp2); + } + } + } + } + closedir(dp); + free(temp2); } - /* * During processing the outbound list, determine when the next event will occur, * ie. the time when the callout status of a node changes because of starting a