From 61ca58e6e9e04aac35da74a0784e7a63c23a4042 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Wed, 14 May 2003 20:25:51 +0000 Subject: [PATCH] Fix for stone-age packets --- ChangeLog | 14 ++++++++++++++ lib/getheader.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 791cbbaf..0efa55eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,11 +11,25 @@ v0.37.4 10-May-2003 Added check for inconv.h in configure script for UNIX98 character set conversion. + common.a: + The getheader function changed to support stone-age .pkt's. + If the packet year has a Y2K bug, the year is fixed. This is + only cosmetic for logging. + If the zone info is missing, the zone is guessed from 2d aka + matching against the system aka's. Then all mail in the .pkt + file is also assumed to be in that zone if there is no zone + info in the messages also. + Guess what, these packets do still exist in Fidonet, it took + 5 years to find them! If you want to check, call 5:5/0 + mbcico: The binkp transmitter does now escape the unsafe filename characters. The binkp receiver now does process escaped filenames. + mbfido: + Stone age packet support, see common.a. + v0.37.3 09-Apr-2003 - 10-May-2003 diff --git a/lib/getheader.c b/lib/getheader.c index 0b7d2bc9..7e179199 100644 --- a/lib/getheader.c +++ b/lib/getheader.c @@ -4,7 +4,7 @@ * Purpose ...............: Read fidonet .pkt header * ***************************************************************************** - * Copyright (C) 1997-2002 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -84,6 +84,14 @@ int getheader(faddr *f, faddr *t, FILE *pkt, char *pname) t->zone = (buffer[0x25] << 8) + buffer[0x24]; year = (buffer[0x05] << 8) + buffer[0x04]; + /* + * Check for Y2K bugs, if there are any this is not important, + * it is just for logging! + */ + if (year < 50) + year = year + 2000; + else if (year < 1900) + year = year + 1900; month = (buffer[0x07] << 8) + buffer[0x06] + 1; day = (buffer[0x09] << 8) + buffer[0x08]; hour = (buffer[0x0b] << 8) + buffer[0x0a]; @@ -106,8 +114,28 @@ int getheader(faddr *f, faddr *t, FILE *pkt, char *pname) t->zone = buffer[0x30] + (buffer[0x31] << 8); f->point = buffer[0x32] + (buffer[0x33] << 8); t->point = buffer[0x34] + (buffer[0x35] << 8); + } else { + /* + * Stone age @%#$@ + */ + f->zone = buffer[0x22] + (buffer[0x23] << 8); + t->zone = buffer[0x24] + (buffer[0x25] << 8); + if ((f->zone == 0) && (t->zone == 0)) { + /* + * No zone info, since the packet should be for us, guess the zone + * against our aka's from the setup using a 2d test. + */ + for (i = 0; i < 40; i++) { + if ((CFG.akavalid[i]) && (t->net == CFG.aka[i].net) && (t->node == CFG.aka[i].node)) { + t->zone = CFG.aka[i].zone; + f->zone = CFG.aka[i].zone; + Syslog('!', "Warning, zone %d assumed", CFG.aka[i].zone); + break; + } + } + } } - + for (i = 0; i < 8; i++) pktpwd[i] = buffer[0x1a + i]; pktpwd[8]='\0';