Better checking for empty *.msg netmails

This commit is contained in:
Michiel Broek 2005-02-03 20:23:29 +00:00
parent be82b565ac
commit 7d2e269c05
3 changed files with 159 additions and 135 deletions

View File

@ -12,6 +12,13 @@ v0.71.2 16-Jan-2005
data frames, this will case uncompress error -5 because zero data frames, this will case uncompress error -5 because zero
bytes can't be compressed ar all. bytes can't be compressed ar all.
mbfido:
Empty *.msg netmails for our own system are dropped with and
logged (just like received empty netmails). Empty netmails to
remote systems are still stored in the netmail base.
Added debug logging for exporting netmails from the messagebase
so that we later can decide to mark these messages auto deleted.
mbnntp: mbnntp:
Does now send the right mime headers recognised by new clients. Does now send the right mime headers recognised by new clients.
Fixed compile problem with some compilers. Fixed compile problem with some compilers.

View File

@ -4,7 +4,7 @@
* Purpose ...............: Read *.msg messages * Purpose ...............: Read *.msg messages
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -92,10 +92,11 @@ int toss_msgs(void)
* 3 = Missing zone info * 3 = Missing zone info
* 4 = No ftn network or netmailboard in setup * 4 = No ftn network or netmailboard in setup
* 5 = Can't open JAM area * 5 = Can't open JAM area
* 6 = Empty local netmail, dropped.
*/ */
int toss_onemsg(char *msgname) int toss_onemsg(char *msgname)
{ {
int rc = 0, islocal; int rc = 0, islocal, empty = TRUE;
char *temp, *dospath, *flagstr = NULL, *l, *r, *msgid = NULL; char *temp, *dospath, *flagstr = NULL, *l, *r, *msgid = NULL;
char fromUserName[36], toUserName[36], subject[72], DateTime[20]; char fromUserName[36], toUserName[36], subject[72], DateTime[20];
FILE *fp, *np; FILE *fp, *np;
@ -230,7 +231,12 @@ int toss_onemsg(char *msgname)
flagstr = xstrcpy(buf + 8); flagstr = xstrcpy(buf + 8);
Syslog('m', "^aFLAGS: %s", flagstr); Syslog('m', "^aFLAGS: %s", flagstr);
} }
if (buf[0] != '\0') {
if ((buf[0] != '\001') && (strcmp(buf, (char *)"--- ")))
empty = FALSE;
} }
}
Syslog('m', "Mail is %sempty", empty ? "":"not ");
Syslog('m', "From %d:%d/%d.%d to %d:%d/%d.%d", origZone, origNet, origNode, origPoint, destZone, destNet, destNode, destPoint); Syslog('m', "From %d:%d/%d.%d to %d:%d/%d.%d", origZone, origNet, origNode, origPoint, destZone, destNet, destNode, destPoint);
@ -291,6 +297,14 @@ int toss_onemsg(char *msgname)
/* /*
* Message is local, make the message appear as a received netmail * Message is local, make the message appear as a received netmail
*/ */
if (empty) {
Syslog('+', "Empty local netmail for %s dropped", toUserName);
Msg_UnLock();
Msg_Close();
fclose(fp);
free(temp);
return 6;
}
islocal = TRUE; islocal = TRUE;
if ((strncasecmp(toUserName, "sysop", 5) == 0) || if ((strncasecmp(toUserName, "sysop", 5) == 0) ||
(strncasecmp(toUserName, "postmaster", 10) == 0) || (strncasecmp(toUserName, "postmaster", 10) == 0) ||

View File

@ -4,7 +4,7 @@
* Purpose ...............: Scan for outgoing mail. * Purpose ...............: Scan for outgoing mail.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -116,8 +116,7 @@ void ScanMail(int DoAll)
} }
if ((i != scanned) || (i == 0)) { if ((i != scanned) || (i == 0)) {
Syslog('+', "Not all messages exported, forcing full mail scan"); Syslog('+', "Not all messages exported, forcing full mail scan to fix this");
Syslog('+', "i=%d scanned=%d", i, scanned);
DoFull = TRUE; DoFull = TRUE;
} }
free(Fname); free(Fname);
@ -775,7 +774,7 @@ void ExportNews(unsigned long MsgNum, fa_list **sbl)
void ExportNet(unsigned long MsgNum, int UUCPgate) void ExportNet(unsigned long MsgNum, int UUCPgate)
{ {
char *p, *q, ext[4], fromname[37], flavor, MailFrom[128], MailTo[128]; char *p, *q, ext[4], fromname[37], flavor, MailFrom[128], MailTo[128];
int i, rc, flags = 0, first, is_fmpt = FALSE, is_topt = FALSE, is_intl = FALSE, mypoint = FALSE; int i, rc, flags = 0, first, is_fmpt = FALSE, is_topt = FALSE, is_intl = FALSE, mypoint = FALSE, empty = TRUE;
FILE *qp, *fp, *fl; FILE *qp, *fp, *fl;
fidoaddr Dest, Route, *dest; fidoaddr Dest, Route, *dest;
time_t now; time_t now;
@ -802,9 +801,13 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
is_intl = TRUE; is_intl = TRUE;
if (strncmp(p, "--- ", 4) == 0) if (strncmp(p, "--- ", 4) == 0)
break; break;
if ((p[0] != '\001') && (p[0] != '\0')) {
empty = FALSE;
}
} while ((p = (char *)MsgText_Next()) != NULL); } while ((p = (char *)MsgText_Next()) != NULL);
} }
} }
Syslog('m', " netmail is %sempt", empty ? "":"not ");
/* /*
* Check if this a netmail to our own local UUCP gate. * Check if this a netmail to our own local UUCP gate.