Several echomail errors now toss to badboard

This commit is contained in:
Michiel Broek 2004-08-12 12:50:52 +00:00
parent 1867e658e0
commit 458df00f3c
9 changed files with 100 additions and 47 deletions

View File

@ -3,6 +3,13 @@ $Id$
v0.61.4 11-Aug-2004 v0.61.4 11-Aug-2004
mbfido:
No help was displayed when no valid command was given.
Echomail for non-existing areas now finally is stored in the
badmail area.
Echomail received from not connected nodes is stored in the
badmail area unless the area allowes it.
mbuser: mbuser:
Fixed permissions. Fixed permissions.

6
TODO
View File

@ -86,18 +86,12 @@ mbfido:
N: Add macro's for stats of all months. N: Add macro's for stats of all months.
L: Implement netmail K/S flag to mark netmail Deleted. CHECK!
N: Implement file requests for directory nodes. N: Implement file requests for directory nodes.
L: Add %from command to areamgr/filemgr. L: Add %from command to areamgr/filemgr.
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.
L: Make it possible to only virus scan the complete archives. L: Make it possible to only virus scan the complete archives.
N: Let mbfido areas with a special switch update area descriptions. N: Let mbfido areas with a special switch update area descriptions.

View File

@ -67,8 +67,9 @@ int InitMsgs(void)
} }
int smsgarea(char *, int);
int smsgarea(char *what, int newsgroup) int smsgarea(char *, int, int);
int smsgarea(char *what, int newsgroup, int bad)
{ {
FILE *fil; FILE *fil;
@ -86,7 +87,9 @@ int smsgarea(char *what, int newsgroup)
msgs_pos = ftell(fil) - msgshdr.recsize; msgs_pos = ftell(fil) - msgshdr.recsize;
sysstart = ftell(fil); sysstart = ftell(fil);
fseek(fil, msgshdr.syssize, SEEK_CUR); fseek(fil, msgshdr.syssize, SEEK_CUR);
if (((!strcasecmp(what, msgs.Tag) && !newsgroup) || (!strcmp(what, msgs.Newsgroup) && newsgroup)) && msgs.Active) { if (((!strcasecmp(what, msgs.Tag) && !newsgroup && !bad) ||
(!strcmp(what, msgs.Newsgroup) && newsgroup && !bad) ||
(!strcmp(CFG.badboard, msgs.Base) && bad)) && msgs.Active) {
sysrecord = 0; sysrecord = 0;
fclose(fil); fclose(fil);
msgs_crc = 0xffffffff; msgs_crc = 0xffffffff;
@ -124,14 +127,21 @@ int smsgarea(char *what, int newsgroup)
int SearchMsgs(char *Area) int SearchMsgs(char *Area)
{ {
return smsgarea(Area, FALSE); return smsgarea(Area, FALSE, FALSE);
} }
int SearchMsgsNews(char *Group) int SearchMsgsNews(char *Group)
{ {
return smsgarea(Group, TRUE); return smsgarea(Group, TRUE, FALSE);
}
int SearchBadBoard(void)
{
return smsgarea((char *)"xXxX", FALSE, TRUE);
} }

View File

@ -125,6 +125,7 @@ int msgs_cnt; /* Msgs records in database */
int InitMsgs(void); /* Initialize msgs database */ int InitMsgs(void); /* Initialize msgs database */
int SearchMsgs(char *); /* Search specified msg area */ int SearchMsgs(char *); /* Search specified msg area */
int SearchMsgsNews(char *); /* Search specified msg area */ int SearchMsgsNews(char *); /* Search specified msg area */
int SearchBadBoard(void); /* Search system badboard */
int MsgSystemConnected(sysconnect); /* Is system connected */ int MsgSystemConnected(sysconnect); /* Is system connected */
int MsgSystemConnect(sysconnect *, int); /* Connect/change/delete system*/ int MsgSystemConnect(sysconnect *, int); /* Connect/change/delete system*/
int GetMsgSystem(sysconnect *, int);/* Get connected system */ int GetMsgSystem(sysconnect *, int);/* Get connected system */

View File

@ -414,6 +414,10 @@ int main(int argc, char **argv)
} }
} }
if ((!do_areas) && (!do_toss) && (!do_scan) && (!do_tic) && (!do_notify) && (!do_roll) &&
(!do_tags) && (!do_stat) && (!do_test) && (!do_news) && (!do_uucp) && (!do_mail))
Help();
ProgName(); ProgName();
pw = getpwuid(getuid()); pw = getpwuid(getuid());
InitClient(pw->pw_name, (char *)"mbfido", CFG.location, CFG.logfile, InitClient(pw->pw_name, (char *)"mbfido", CFG.location, CFG.logfile,

View File

@ -130,7 +130,8 @@ int EchoOut(fidoaddr aka, char *toname, char *fromname, char *subj, FILE *fp, in
* For echomail, the crc32 is calculated over the ^AREA kludge, subject, * For echomail, the crc32 is calculated over the ^AREA kludge, subject,
* message date, origin line, message id. * message date, origin line, message id.
*/ */
int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t mdate, int flags, int cost, FILE *fp, int tonews) int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t mdate, int flags,
int cost, FILE *fp, int tonews, int isbad)
{ {
char *buf, *msgid = NULL, *reply = NULL, *p, *q, sbe[16]; char *buf, *msgid = NULL, *reply = NULL, *p, *q, sbe[16];
int First = TRUE, rc = 0, i, kludges = TRUE, dupe = FALSE, bad = TRUE, seenlen, oldnet; int First = TRUE, rc = 0, i, kludges = TRUE, dupe = FALSE, bad = TRUE, seenlen, oldnet;
@ -146,6 +147,9 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
crc = 0xffffffff; crc = 0xffffffff;
echo_in++; echo_in++;
if (isbad)
Syslog('m', "postecho isbad=%d", isbad);
/* /*
* p_from is set for tossed echomail, it is NULL for local posted echomail and gated news. * p_from is set for tossed echomail, it is NULL for local posted echomail and gated news.
*/ */
@ -157,6 +161,15 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
break; break;
} }
} }
/*
* Echomail for unknow area was passed, make sure we pass the next tests
*/
if (isbad == 6) {
bad = FALSE;
Link.receivefrom = TRUE;
}
if (bad && (msgs.UnSecure || do_unsec)) { if (bad && (msgs.UnSecure || do_unsec)) {
bad = FALSE; bad = FALSE;
memset(&Link, 0, sizeof(Link)); memset(&Link, 0, sizeof(Link));
@ -164,8 +177,9 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
} }
if (bad) { if (bad) {
Syslog('+', "Node %s not connected to area %s", ascfnode(p_from, 0x1f), msgs.Tag); Syslog('+', "Node %s not connected to area %s", ascfnode(p_from, 0x1f), msgs.Tag);
echo_bad++; bad = FALSE;
return 4; Link.receivefrom = TRUE;
isbad = 7; /* Force to goto badboard */
} }
if (Link.cutoff && !bad) { if (Link.cutoff && !bad) {
Syslog('+', "Echomail from %s in %s refused, cutoff", ascfnode(p_from, 0x1f), msgs.Tag); Syslog('+', "Echomail from %s in %s refused, cutoff", ascfnode(p_from, 0x1f), msgs.Tag);
@ -247,7 +261,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
if (msgid != NULL) { if (msgid != NULL) {
crc = upd_crc32(msgid, crc, strlen(msgid)); crc = upd_crc32(msgid, crc, strlen(msgid));
} else { } else {
if (check_dupe) { if (check_dupe && !isbad) {
/* /*
* If a MSGID is missing it is possible that dupes from some offline * If a MSGID is missing it is possible that dupes from some offline
* readers slip through because these readers use the same date for * readers slip through because these readers use the same date for
@ -264,13 +278,13 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
} }
} }
} }
if (check_dupe) if (check_dupe && !isbad)
dupe = CheckDupe(crc, D_ECHOMAIL, CFG.toss_dupes); dupe = CheckDupe(crc, D_ECHOMAIL, CFG.toss_dupes);
else else
dupe = FALSE; dupe = FALSE;
if (!dupe && !msgs.UnSecure && !do_unsec) { if (!dupe && !msgs.UnSecure && !do_unsec && !isbad) {
/* /*
* Check if the message is for us. Don't check point address, * Check if the message is for us. Don't check point address,
* echomail messages don't have point destination set. * echomail messages don't have point destination set.
@ -303,11 +317,26 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
} }
} }
if (isbad) {
/*
* If the isbad was passed, this is echomail with an error that maybe
* later can be retossed from the bad board. Store it as original as
* possible.
*/
Syslog('m', "storeecho to bad isbad=%d", isbad);
rc = storeecho(f, t, mdate, flags, subj, msgid, reply, TRUE, FALSE, fp);
free(buf);
if (msgid)
free(msgid);
if (reply)
free(reply);
return rc;
}
/* /*
* The echomail message is accepted for post/forward/gate * The echomail message is accepted for post/forward/gate
*/ */
if (!dupe) { if (!dupe && !isbad) {
if (msgs.Aka.zone != Link.aka.zone) { if (msgs.Aka.zone != Link.aka.zone) {
/* /*
@ -336,7 +365,6 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
uniq_list(&sbl); uniq_list(&sbl);
} }
/* /*
* Add our system to the path for later export. * Add our system to the path for later export.
*/ */
@ -350,13 +378,13 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
*/ */
First = TRUE; First = TRUE;
while (GetMsgSystem(&Link, First)) { while (GetMsgSystem(&Link, First)) {
First = FALSE; First = FALSE;
if ((Link.aka.zone) && (Link.sendto) && (!Link.pause) && (!Link.cutoff)) { if ((Link.aka.zone) && (Link.sendto) && (!Link.pause) && (!Link.cutoff)) {
Faddr = fido2faddr(Link.aka); Faddr = fido2faddr(Link.aka);
if (p_from == NULL) { if (p_from == NULL) {
fill_qualify(&qal, Link.aka, FALSE, in_list(Faddr, &sbl, FALSE)); fill_qualify(&qal, Link.aka, FALSE, in_list(Faddr, &sbl, FALSE));
} else { } else {
fill_qualify(&qal, Link.aka, ((p_from->zone == Link.aka.zone) && fill_qualify(&qal, Link.aka, ((p_from->zone == Link.aka.zone) &&
(p_from->net == Link.aka.net) && (p_from->node == Link.aka.node) && (p_from->net == Link.aka.net) && (p_from->node == Link.aka.node) &&
(p_from->point == Link.aka.point)), in_list(Faddr, &sbl, FALSE)); (p_from->point == Link.aka.point)), in_list(Faddr, &sbl, FALSE));
} }
@ -370,8 +398,8 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
* When ready, filter the dupes and sort the SEEN-BY entries. * When ready, filter the dupes and sort the SEEN-BY entries.
*/ */
for (tmpq = qal; tmpq; tmpq = tmpq->next) { for (tmpq = qal; tmpq; tmpq = tmpq->next) {
if (tmpq->send) { if (tmpq->send) {
sprintf(sbe, "%u/%u", tmpq->aka.net, tmpq->aka.node); sprintf(sbe, "%u/%u", tmpq->aka.net, tmpq->aka.node);
fill_list(&sbl, sbe, NULL); fill_list(&sbl, sbe, NULL);
} }
} }

View File

@ -4,7 +4,7 @@
/* $Id$ */ /* $Id$ */
int postecho(faddr *, faddr *, faddr *, char *, char *, time_t, int, int, FILE *, int); int postecho(faddr *, faddr *, faddr *, char *, char *, time_t, int, int, FILE *, int, int);
#endif #endif

View File

@ -684,7 +684,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
Syslog('m', "========== Fido end"); Syslog('m', "========== Fido end");
if (newsmode) if (newsmode)
rc = postecho(NULL, fmsg->from, fmsg->to, origin, fmsg->subj, fmsg->date, fmsg->flags, 0, ofp, FALSE); rc = postecho(NULL, fmsg->from, fmsg->to, origin, fmsg->subj, fmsg->date, fmsg->flags, 0, ofp, FALSE, 0);
else else
rc = postnetmail(ofp, fmsg->from, fmsg->to, origin, fmsg->subj, fmsg->date, rc = postnetmail(ofp, fmsg->from, fmsg->to, origin, fmsg->subj, fmsg->date,
fmsg->flags, FALSE, fmsg->from->zone, fmsg->to->zone); fmsg->flags, FALSE, fmsg->from->zone, fmsg->to->zone);

View File

@ -136,15 +136,16 @@ char *aread(char *s, int count, FILE *fp)
* 1 - Can't access messagebase. * 1 - Can't access messagebase.
* 2 - Cannot open mareas.data * 2 - Cannot open mareas.data
* 3 - Echomail without Origin line. * 3 - Echomail without Origin line.
* 4 - Echomail from unknown node, disconnected node. * 4 - Echomail from unknown node or disconnected node.
* 5 - Locking error. * 5 - Locking error.
* 6 - Unknown echomail area.
* *
*/ */
int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t mdate, int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t mdate,
int flags, int cost, FILE *fp, unsigned int tzone) int flags, int cost, FILE *fp, unsigned int tzone)
{ {
char *buf, *marea = NULL; char *buf, *marea = NULL;
int echomail = FALSE, rc = 0, bad = FALSE, Known = FALSE, FirstLine; int echomail = FALSE, rc = 0, bad = 0, Known = FALSE, FirstLine;
sysconnect Link; sysconnect Link;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
@ -190,7 +191,7 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t
Syslog('!', "Echomail without Origin line"); Syslog('!', "Echomail without Origin line");
echo_bad++; echo_bad++;
echo_in++; echo_in++;
bad = TRUE; bad = 3;
free(buf); free(buf);
free(marea); free(marea);
return 3; return 3;
@ -201,22 +202,19 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t
Syslog('m', "Unknown echo area %s", marea); Syslog('m', "Unknown echo area %s", marea);
if (!create_msgarea(marea, p_from)) { if (!create_msgarea(marea, p_from)) {
WriteError("Create echomail area %s failed", marea); WriteError("Create echomail area %s failed", marea);
echo_bad++; bad = 6;
echo_in++;
bad = TRUE;
free(marea);
free(buf);
return 4;
} }
SearchNode(Link.aka); if (bad == 0) {
if (!SearchMsgs(marea)) { SearchNode(Link.aka);
WriteError("Unknown echo area %s", marea); if (!SearchMsgs(marea)) {
echo_bad++; WriteError("Unknown echo area %s", marea);
echo_in++; echo_bad++;
bad = TRUE; echo_in++;
free(marea); bad = 4;
free(buf); free(marea);
return 4; free(buf);
return 4;
}
} }
} }
echomail = TRUE; echomail = TRUE;
@ -227,12 +225,23 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t
} /* end of checking kludges */ } /* end of checking kludges */
if (echomail) { if (echomail) {
if (bad) {
/*
* Bad, load the badmail record
*/
if ((strlen(CFG.badboard) == 0) && !SearchBadBoard()) {
Syslog('+', "No badmail area, killing message");
free(buf);
return 6;
}
UpdateMsgs();
}
/* /*
* At this point, the destination zone is not yet set. * At this point, the destination zone is not yet set.
*/ */
if (!t->zone) if (!t->zone)
t->zone = tzone; t->zone = tzone;
rc = postecho(p_from, f, t, orig, subj, mdate, flags, cost, fp, TRUE); rc = postecho(p_from, f, t, orig, subj, mdate, flags, cost, fp, TRUE, bad);
} else } else
rc = postnetmail(fp, f, t, orig, subj, mdate, flags, TRUE, p_from->zone, tzone); rc = postnetmail(fp, f, t, orig, subj, mdate, flags, TRUE, p_from->zone, tzone);