Several echomail errors now toss to badboard
This commit is contained in:
parent
1867e658e0
commit
458df00f3c
@ -3,6 +3,13 @@ $Id$
|
||||
|
||||
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:
|
||||
Fixed permissions.
|
||||
|
||||
|
6
TODO
6
TODO
@ -86,18 +86,12 @@ mbfido:
|
||||
|
||||
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.
|
||||
|
||||
L: Add %from command to areamgr/filemgr.
|
||||
|
||||
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.
|
||||
|
||||
N: Let mbfido areas with a special switch update area descriptions.
|
||||
|
20
lib/dbmsgs.c
20
lib/dbmsgs.c
@ -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;
|
||||
|
||||
@ -86,7 +87,9 @@ int smsgarea(char *what, int newsgroup)
|
||||
msgs_pos = ftell(fil) - msgshdr.recsize;
|
||||
sysstart = ftell(fil);
|
||||
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;
|
||||
fclose(fil);
|
||||
msgs_crc = 0xffffffff;
|
||||
@ -124,14 +127,21 @@ int smsgarea(char *what, int newsgroup)
|
||||
|
||||
int SearchMsgs(char *Area)
|
||||
{
|
||||
return smsgarea(Area, FALSE);
|
||||
return smsgarea(Area, FALSE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SearchMsgsNews(char *Group)
|
||||
{
|
||||
return smsgarea(Group, TRUE);
|
||||
return smsgarea(Group, TRUE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SearchBadBoard(void)
|
||||
{
|
||||
return smsgarea((char *)"xXxX", FALSE, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,6 +125,7 @@ int msgs_cnt; /* Msgs records in database */
|
||||
int InitMsgs(void); /* Initialize msgs database */
|
||||
int SearchMsgs(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 MsgSystemConnect(sysconnect *, int); /* Connect/change/delete system*/
|
||||
int GetMsgSystem(sysconnect *, int);/* Get connected system */
|
||||
|
@ -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();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbfido", CFG.location, CFG.logfile,
|
||||
|
@ -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,
|
||||
* 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];
|
||||
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;
|
||||
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.
|
||||
*/
|
||||
@ -157,6 +161,15 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
|
||||
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)) {
|
||||
bad = FALSE;
|
||||
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) {
|
||||
Syslog('+', "Node %s not connected to area %s", ascfnode(p_from, 0x1f), msgs.Tag);
|
||||
echo_bad++;
|
||||
return 4;
|
||||
bad = FALSE;
|
||||
Link.receivefrom = TRUE;
|
||||
isbad = 7; /* Force to goto badboard */
|
||||
}
|
||||
if (Link.cutoff && !bad) {
|
||||
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) {
|
||||
crc = upd_crc32(msgid, crc, strlen(msgid));
|
||||
} else {
|
||||
if (check_dupe) {
|
||||
if (check_dupe && !isbad) {
|
||||
/*
|
||||
* If a MSGID is missing it is possible that dupes from some offline
|
||||
* 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);
|
||||
else
|
||||
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,
|
||||
* 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
|
||||
*/
|
||||
if (!dupe) {
|
||||
if (!dupe && !isbad) {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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;
|
||||
while (GetMsgSystem(&Link, First)) {
|
||||
First = FALSE;
|
||||
if ((Link.aka.zone) && (Link.sendto) && (!Link.pause) && (!Link.cutoff)) {
|
||||
First = FALSE;
|
||||
if ((Link.aka.zone) && (Link.sendto) && (!Link.pause) && (!Link.cutoff)) {
|
||||
Faddr = fido2faddr(Link.aka);
|
||||
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 {
|
||||
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->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.
|
||||
*/
|
||||
for (tmpq = qal; tmpq; tmpq = tmpq->next) {
|
||||
if (tmpq->send) {
|
||||
sprintf(sbe, "%u/%u", tmpq->aka.net, tmpq->aka.node);
|
||||
if (tmpq->send) {
|
||||
sprintf(sbe, "%u/%u", tmpq->aka.net, tmpq->aka.node);
|
||||
fill_list(&sbl, sbe, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* $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
|
||||
|
@ -684,7 +684,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
|
||||
Syslog('m', "========== Fido end");
|
||||
|
||||
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
|
||||
rc = postnetmail(ofp, fmsg->from, fmsg->to, origin, fmsg->subj, fmsg->date,
|
||||
fmsg->flags, FALSE, fmsg->from->zone, fmsg->to->zone);
|
||||
|
@ -136,15 +136,16 @@ char *aread(char *s, int count, FILE *fp)
|
||||
* 1 - Can't access messagebase.
|
||||
* 2 - Cannot open mareas.data
|
||||
* 3 - Echomail without Origin line.
|
||||
* 4 - Echomail from unknown node, disconnected node.
|
||||
* 4 - Echomail from unknown node or disconnected node.
|
||||
* 5 - Locking error.
|
||||
* 6 - Unknown echomail area.
|
||||
*
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
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");
|
||||
echo_bad++;
|
||||
echo_in++;
|
||||
bad = TRUE;
|
||||
bad = 3;
|
||||
free(buf);
|
||||
free(marea);
|
||||
return 3;
|
||||
@ -201,23 +202,20 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t
|
||||
Syslog('m', "Unknown echo area %s", marea);
|
||||
if (!create_msgarea(marea, p_from)) {
|
||||
WriteError("Create echomail area %s failed", marea);
|
||||
echo_bad++;
|
||||
echo_in++;
|
||||
bad = TRUE;
|
||||
free(marea);
|
||||
free(buf);
|
||||
return 4;
|
||||
bad = 6;
|
||||
}
|
||||
SearchNode(Link.aka);
|
||||
if (!SearchMsgs(marea)) {
|
||||
WriteError("Unknown echo area %s", marea);
|
||||
echo_bad++;
|
||||
echo_in++;
|
||||
bad = TRUE;
|
||||
free(marea);
|
||||
free(buf);
|
||||
return 4;
|
||||
}
|
||||
if (bad == 0) {
|
||||
SearchNode(Link.aka);
|
||||
if (!SearchMsgs(marea)) {
|
||||
WriteError("Unknown echo area %s", marea);
|
||||
echo_bad++;
|
||||
echo_in++;
|
||||
bad = 4;
|
||||
free(marea);
|
||||
free(buf);
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
echomail = TRUE;
|
||||
free(marea);
|
||||
@ -227,12 +225,23 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t
|
||||
} /* end of checking kludges */
|
||||
|
||||
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.
|
||||
*/
|
||||
if (!t->zone)
|
||||
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
|
||||
rc = postnetmail(fp, f, t, orig, subj, mdate, flags, TRUE, p_from->zone, tzone);
|
||||
|
||||
|
Reference in New Issue
Block a user