From 8def4032431881068523afa07bcf3bd76acfe241 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Wed, 12 Feb 2003 20:20:59 +0000 Subject: [PATCH] Some small updates --- ChangeLog | 7 ++++++ mbfido/mbdiff.c | 19 +++++++++++------ mbfido/postecho.c | 23 ++++---------------- mbtask/mbtask.c | 3 ++- mbtask/mbtask.h | 1 - mbtask/taskstat.c | 54 ++++++++++++++++++++++++----------------------- mbtask/taskstat.h | 7 ++++-- 7 files changed, 58 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index 720ab080..95d025dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,6 +54,8 @@ v0.37.01 14-Jan-2003. Added experimental code where tossing mail is not started as long as there are mailers running, but not longer as 30 mins. This should make the whole system less nervous. + Modified this code, didn't work, the toss was always started + at once. mbfile: In the import function several bugfixes for reading files.bbs. @@ -66,6 +68,11 @@ v0.37.01 14-Jan-2003. The nodes statistocs are expanded with flow counters. If echomail is accepted in a unsecure area or the unsecure commandline option is set, a violation is logged as warning. + Removed some debugging tests and log messages. + + mbdiff: + If unpacking a diff file fails, a second attempt is done after + a sync and one second delay. mbsetup: Added protection against wrong database sizes depending on diff --git a/mbfido/mbdiff.c b/mbfido/mbdiff.c index c1667008..4d24d724 100644 --- a/mbfido/mbdiff.c +++ b/mbfido/mbdiff.c @@ -296,13 +296,18 @@ int main(int argc, char **argv) } if (execute(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) { - show_log = TRUE; - free(cmd); - free(onl); - free(wrk); - free(ond); - WriteError("Unpack error"); - die(MBERR_EXEC_FAILED); + Syslog('!', "Warning: unpack error, trying again after a sync"); + sync(); + sleep(1); + if (execute(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) { + show_log = TRUE; + free(cmd); + free(onl); + free(wrk); + free(ond); + WriteError("Fatal: unpack error"); + die(MBERR_EXEC_FAILED); + } } free(cmd); sync(); diff --git a/mbfido/postecho.c b/mbfido/postecho.c index ccdb8dc5..fe4bbd34 100644 --- a/mbfido/postecho.c +++ b/mbfido/postecho.c @@ -144,7 +144,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m { char *buf, *msgid = NULL, *reply = NULL, *p, *q, sbe[16]; int First = TRUE, rc = 0, i, kludges = TRUE, dupe = FALSE, bad = TRUE, seenlen, oldnet; - faddr *Faddr, *ta; + faddr *Faddr; unsigned long crc; sysconnect Link; fa_list *sbl = NULL, *ptl = NULL, *tmpl; @@ -221,28 +221,13 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m } if (!strncmp(buf, "\001MSGID: ", 8)) { msgid = xstrcpy(buf + 8); - /* - * Extra test to see if the address is correct, only logging. - */ - p = strtok(buf, " \n"); - p = strtok(NULL, " \n"); - if ((ta = parsefnode(p))) { - if ((ta->zone != f->zone) || (ta->point != f->point) || (ta->node != f->node) || (ta->net != f->net)) { - p = xstrcpy(ascfnode(f, 0x1f)); - Syslog('!', "ERROR: origin=%s, msgid=%s", p, ascfnode(ta, 0x1f)); - free(p); - } - } } if (!strncmp(buf, "\001REPLY: ", 8)) reply = xstrcpy(buf + 8); if (!strncmp(buf, "SEEN-BY:", 8)) { -// if (Link.aka.zone == msgs.Aka.zone) { - p = xstrcpy(buf + 9); - fill_list(&sbl, p, NULL); - free(p); -// } else -// Syslog('m', "Strip zone SB lines"); + p = xstrcpy(buf + 9); + fill_list(&sbl, p, NULL); + free(p); } if (!strncmp(buf, "\001PATH:", 6)) { p = xstrcpy(buf + 7); diff --git a/mbtask/mbtask.c b/mbtask/mbtask.c index c9f92149..627f43f9 100644 --- a/mbtask/mbtask.c +++ b/mbtask/mbtask.c @@ -104,6 +104,7 @@ extern int pots_free; /* POTS lines free */ extern int isdn_free; /* ISDN lines free */ extern pp_list *pl; /* List of tty ports */ extern int ipmailers; /* TCP/IP mail sessions */ +extern int tosswait; /* Toss wait timer */ @@ -839,7 +840,7 @@ void scheduler(void) { struct passwd *pw; int running = 0, rc, i, rlen, found; - static int LOADhi = FALSE, oldmin = 70, olddo = 70, oldsec = 70, tosswait = TOSSWAIT_TIME; + static int LOADhi = FALSE, oldmin = 70, olddo = 70, oldsec = 70; char *cmd = NULL, opts[41], port[21]; static char doing[32], buf[2048]; time_t now; diff --git a/mbtask/mbtask.h b/mbtask/mbtask.h index f3b762fd..4b63a0ca 100644 --- a/mbtask/mbtask.h +++ b/mbtask/mbtask.h @@ -12,7 +12,6 @@ #define SLOWRUN 20 #define TMPNAME "TMP." #define LCKNAME "LOCKTASK" -#define TOSSWAIT_TIME 30 diff --git a/mbtask/taskstat.c b/mbtask/taskstat.c index 7d634e5d..6bab012b 100644 --- a/mbtask/taskstat.c +++ b/mbtask/taskstat.c @@ -4,7 +4,7 @@ * Purpose ...............: Keep track of server status * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -51,12 +51,12 @@ int s_msglink = FALSE; int s_newnews = FALSE; int s_bbsopen = FALSE; int s_do_inet = FALSE; +int tosswait = TOSSWAIT_TIME; extern int UPSalarm; extern int ptimer; extern int rescan; - extern struct taskrec TCFG; extern int internet; extern int ZMH; @@ -340,31 +340,33 @@ char *getseq(void) int sem_set(char *sem, int value) { - Syslog('s', "%s semafore \"%s\"", value?"Set":"Clear", sem); + Syslog('s', "%s semafore \"%s\"", value?"Set":"Clear", sem); - if (!strcmp(sem, "scanout")) { - s_scanout = value; - if (value) - rescan = TRUE; - } else if (!strcmp(sem, "mailout")) { - s_mailout = value; - } else if (!strcmp(sem, "mailin")) { - s_mailin = value; - } else if (!strcmp(sem, "mbindex")) { - s_index = value; - } else if (!strcmp(sem, "newnews")) { - s_newnews = value; - } else if (!strcmp(sem, "msglink")) { - s_msglink = value; - } else if (!strcmp(sem, "reqindex")) { - s_reqindex = value; - } else if (!strcmp(sem, "do_inet")) { - s_do_inet = value; - } else { - return FALSE; - } - ptimer = PAUSETIME; - return TRUE; + if (!strcmp(sem, "scanout")) { + s_scanout = value; + if (value) + rescan = TRUE; + } else if (!strcmp(sem, "mailout")) { + s_mailout = value; + } else if (!strcmp(sem, "mailin")) { + s_mailin = value; + if (value) + tosswait = TOSSWAIT_TIME; + } else if (!strcmp(sem, "mbindex")) { + s_index = value; + } else if (!strcmp(sem, "newnews")) { + s_newnews = value; + } else if (!strcmp(sem, "msglink")) { + s_msglink = value; + } else if (!strcmp(sem, "reqindex")) { + s_reqindex = value; + } else if (!strcmp(sem, "do_inet")) { + s_do_inet = value; + } else { + return FALSE; + } + ptimer = PAUSETIME; + return TRUE; } diff --git a/mbtask/taskstat.h b/mbtask/taskstat.h index 21f0540b..21dd5907 100644 --- a/mbtask/taskstat.h +++ b/mbtask/taskstat.h @@ -1,9 +1,12 @@ -/* $Id$ */ - #ifndef _TASKSTAT_H #define _TASKSTAT_H +/* $Id$ */ + + #define PAUSETIME 3 +#define TOSSWAIT_TIME 30 + void status_init(void); /* Initialize status module */ void stat_inc_clients(void); /* Increase connected clients */