Some tosser fixes

This commit is contained in:
Michiel Broek 2002-12-11 18:26:05 +00:00
parent 24f21f05cd
commit bfdd6705f5
4 changed files with 342 additions and 332 deletions

View File

@ -94,6 +94,8 @@ v0.35.06
processing.
During toss the Nopper code is called to prevent timeout when
a very large packet is tossed that takes longer then 10 mins.
When more then 1024 dupes were tossed, mbfido crashed because
a temp file wasn't closed.
mbcico:
With filetransfer errors, the attempts counter was not

View File

@ -72,7 +72,7 @@ int InitMsgs(void)
}
int smsgarea(char *w, int);
int smsgarea(char *, int);
int smsgarea(char *what, int newsgroup)
{
FILE *fil;

View File

@ -142,15 +142,15 @@ int EchoOut(fidoaddr aka, char *toname, char *fromname, char *subj, FILE *fp, in
*/
int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t mdate, int flags, int cost, FILE *fp, int tonews)
{
char *buf, *msgid = NULL, *reply = NULL, *p, *q, sbe[16];
int First = TRUE, rc = 0, i, kludges = TRUE;
int dupe = FALSE, bad = TRUE, seenlen, oldnet;
char *buf, *msgid = NULL, *reply = NULL, *p, *q, sbe[16], datestr[21];
int First = TRUE, rc = 0, i, kludges = TRUE, dupe = FALSE, bad = TRUE, seenlen, oldnet;
faddr *Faddr;
unsigned long crc;
sysconnect Link;
fa_list *sbl = NULL, *ptl = NULL, *tmpl;
qualify *qal = NULL, *tmpq;
FILE *nfp, *qp;
struct tm *tm;
memset(&Link, 0, sizeof(Link));
crc = 0xffffffff;
@ -246,7 +246,20 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
Syslog('!', "No origin line found");
else
crc = upd_crc32(orig, crc, strlen(orig));
/*
* Some tossers don't bother the seconds in the message, also some
* rescanning software changes the seconds of a message. Do the
* timestamp check without the seconds.
*/
tm = gmtime(&mdate);
memset(&datestr, 0, sizeof(datestr));
sprintf(datestr, "%04d%02d%02d%02d%02d", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
// crc = upd_crc32(datestr, crc, strlen(datestr));
// NOT ACTIVATED BEFORE A LOT OF DUPES AT MY HUB ARE PROCESSED
crc = upd_crc32((char *)&mdate, crc, sizeof(mdate));
if (msgid != NULL) {
crc = upd_crc32(msgid, crc, strlen(msgid));
} else {
@ -468,6 +481,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
free(msgid);
if (reply)
free(reply);
fclose(nfp);
return rc;
}

View File

@ -104,8 +104,7 @@ char *aread(char *s, int count, FILE *fp)
return(NULL);
if (s == NULL)
return NULL;
if (at_zero)
{
if (at_zero) {
at_zero=0;
return NULL;
}
@ -131,6 +130,7 @@ char *aread(char *s, int count, FILE *fp)
i++;
break;
}
s[i]='\0';
return s;
}
@ -149,8 +149,7 @@ char *aread(char *s, int count, FILE *fp)
* 5 - Locking error.
*
*/
int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj,
time_t mdate, int flags, int cost, FILE *fp)
int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t mdate, int flags, int cost, FILE *fp)
{
char *buf, *marea = NULL;
int echomail = FALSE, rc = 0, bad = FALSE, Known = FALSE, FirstLine;
@ -159,7 +158,6 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj,
if (CFG.slow_util && do_quiet)
usleep(1);
Nopper();
memset(&Link, 0, sizeof(Link));
/*
@ -176,7 +174,7 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj,
Known = TRUE;
}
buf = calloc(2048, sizeof(char));
buf = calloc(2049, sizeof(char));
marea = NULL;
/*
@ -318,17 +316,15 @@ int TossPkt(char *fn)
*/
int getmessage(FILE *pkt, faddr *p_from, faddr *p_to)
{
char buf[2048];
char *orig = NULL;
char *p, *l, *r;
int tmp, rc, maxrc = 0;
char buf[2048], *orig = NULL, *p, *l, *r, *subj = NULL;
int tmp, rc, maxrc = 0, result, flags, cost;
static faddr f, t;
faddr *o;
int result, flags, cost;
time_t mdate = 0L;
FILE *fp;
unsigned char buffer[0x0e];
char *subj = NULL;
Nopper();
result = fread(&buffer, 1, sizeof(buffer), pkt);
if (result == 0) {
@ -336,20 +332,17 @@ int getmessage(FILE *pkt, faddr *p_from, faddr *p_to)
return 0;
}
switch(tmp = (buffer[0x01] << 8) + buffer[0x00]) {
case 0:
if (result == 2)
switch (tmp = (buffer[0x01] << 8) + buffer[0x00]) {
case 0: if (result == 2)
return 0;
else {
Syslog('!', "Junk after logical end of packet, skipped");
return 5;
}
case 2:
break;
case 2: break;
default:
Syslog('!', "bad message type: 0x%04x",tmp);
default:Syslog('!', "bad message type: 0x%04x",tmp);
return 2;
}
@ -445,7 +438,8 @@ int getmessage(FILE *pkt, faddr *p_from, faddr *p_to)
*/
if (!strncmp(buf," * Origin:",10)) {
p=buf+10;
while (*p == ' ') p++;
while (*p == ' ')
p++;
if ((l=strrchr(p,'(')) && (r=strrchr(p,')')) && (l < r)) {
*l = '\0';
*r = '\0';