Bad netmail goes into the badmail area

This commit is contained in:
Michiel Broek 2002-10-19 11:43:45 +00:00
parent 1c8e9f2769
commit 9c5300b9b6
3 changed files with 127 additions and 105 deletions

View File

@ -33,6 +33,8 @@ v0.35.04 29-Sep-2002
Removed some debug logging with files replace. Removed some debug logging with files replace.
Fixed trashing news dupes file when mbfido was called multiple Fixed trashing news dupes file when mbfido was called multiple
times. Improved program locking. times. Improved program locking.
Netmail received for a zone/net without netmail board will be
stored in the badmail area.
mbsetup: mbsetup:
Added setup for the nodes record for security flags. Added setup for the nodes record for security flags.

4
TODO
View File

@ -81,6 +81,10 @@ mbfido:
L: Add netmail notification of changed areas. L: Add netmail notification of changed areas.
L: Maybe store insecure echomail in badmail area.
L: Maybe store echomail for unknown areas in badmail area.
mbcico: mbcico:
L: Implement modem connect response translation for ISDN lines, i.e. L: Implement modem connect response translation for ISDN lines, i.e.
make the CAUSE responses human readable. see McMail for this make the CAUSE responses human readable. see McMail for this

View File

@ -64,16 +64,29 @@ extern int net_bad; /* Bad netmails (tracking errors */
*/ */
int storenet(faddr *f, faddr *t, time_t mdate, int flags, char *Subj, char *msgid, char *reply, FILE *fp, char *flagstr) int storenet(faddr *f, faddr *t, time_t mdate, int flags, char *Subj, char *msgid, char *reply, FILE *fp, char *flagstr)
{ {
int result, i, empty = TRUE; int result = FALSE, i, empty = TRUE, bad;
unsigned long crc2; unsigned long crc2;
char *Buf; char *Buf;
if (SearchNetBoard(t->zone, t->net)) { if (! SearchNetBoard(t->zone, t->net)) {
bad = TRUE;
WriteError("Can't find netmail board for %d:%d/%d", t->zone, t->net, t->node);
if (strlen(CFG.badboard) == 0) {
Syslog('+', "Killing bad message, no badmail area");
net_bad++;
return 2;
} else {
if ((result = Msg_Open(CFG.badboard)))
Syslog('+', "Tossing in bad board");
}
} else {
bad = FALSE;
StatAdd(&msgs.Received, 1L); StatAdd(&msgs.Received, 1L);
msgs.LastRcvd = time(NULL); msgs.LastRcvd = time(NULL);
UpdateMsgs(); UpdateMsgs();
result = Msg_Open(msgs.Base); result = Msg_Open(msgs.Base);
}
if (!result) { if (!result) {
WriteError("Can't open msgbase %s", msgs.Base); WriteError("Can't open msgbase %s", msgs.Base);
net_bad++; net_bad++;
@ -95,10 +108,13 @@ int storenet(faddr *f, faddr *t, time_t mdate, int flags, char *Subj, char *msgi
/* /*
* Set flags for the message base. * Set flags for the message base.
*/ */
if ((msgs.MsgKinds == BOTH) || (msgs.MsgKinds == PRIVATE)) if (bad) {
Msg.Private = (((flags & M_PVT) ? TRUE:FALSE) || flag_on((char *)"PVT", flagstr)); Msg.Private = (((flags & M_PVT) ? TRUE:FALSE) || flag_on((char *)"PVT", flagstr));
else } else if ((msgs.MsgKinds == BOTH) || (msgs.MsgKinds == PRIVATE)) {
Msg.Private = (((flags & M_PVT) ? TRUE:FALSE) || flag_on((char *)"PVT", flagstr));
} else {
Msg.Private = TRUE; /* Allways */ Msg.Private = TRUE; /* Allways */
}
Msg.Crash = ((flags & M_CRASH) || flag_on((char *)"CRA", flagstr)); Msg.Crash = ((flags & M_CRASH) || flag_on((char *)"CRA", flagstr));
Msg.FileAttach = ((flags & M_FILE) || flag_on((char *)"FIL", flagstr)); Msg.FileAttach = ((flags & M_FILE) || flag_on((char *)"FIL", flagstr));
Msg.Intransit = ((flags & M_TRANSIT)); Msg.Intransit = ((flags & M_TRANSIT));
@ -142,18 +158,23 @@ int storenet(faddr *f, faddr *t, time_t mdate, int flags, char *Subj, char *msgi
*(Buf + i) = '\0'; *(Buf + i) = '\0';
} }
if (*(Buf) != '\0') { if (*(Buf) != '\0') {
if ((*(Buf) != '\001') && if ((*(Buf) != '\001') && (strcmp(Buf, (char *)"--- ")))
(strcmp(Buf, (char *)"--- ")))
empty = FALSE; empty = FALSE;
} }
} }
free(Buf); free(Buf);
if (!empty) { if (!empty) {
if (bad)
Syslog('+', "Import netmail to %s in badmail board", usr.sUserName);
else
Syslog('+', "Import netmail to %s", usr.sUserName); Syslog('+', "Import netmail to %s", usr.sUserName);
rewind(fp); rewind(fp);
Msg_Write(fp); Msg_Write(fp);
Msg_AddMsg(); Msg_AddMsg();
if (bad)
net_bad++;
else
net_imp++; net_imp++;
} else { } else {
Syslog('+', "Empty netmail for %s dropped", usr.sUserName); Syslog('+', "Empty netmail for %s dropped", usr.sUserName);
@ -163,15 +184,10 @@ int storenet(faddr *f, faddr *t, time_t mdate, int flags, char *Subj, char *msgi
return 0; return 0;
} else { } else {
WriteError("Can't lock msgbase %s", msgs.Base); WriteError("Can't lock msgbase %s, netmail is lost", msgs.Base);
Msg_Close(); Msg_Close();
return 1; return 1;
} }
} else {
WriteError("Can't find a netmail board");
net_bad++;
return 2;
} /* if SearchNetBoard() */
} }