diff --git a/ChangeLog b/ChangeLog index 3736a31d..0fee2567 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ v0.71.6 02-Sep-2005 mbcico: Changed compression state logic. Removed soft-cr filter during message import. + Record previous session state so we can better react on failed + sessions. mbfido: If some newsarticles are not accepted for post, don't treat diff --git a/mbcico/Makefile b/mbcico/Makefile index 54a0f5e1..a98a5ca4 100644 --- a/mbcico/Makefile +++ b/mbcico/Makefile @@ -90,7 +90,7 @@ zmmisc.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ttyio.h session.h zmode zmrle.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ttyio.h session.h zmodem.h zmrecv.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h lutil.h ttyio.h session.h zmodem.h config.h emsi.h openfile.h filelist.h openport.h zmsend.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ttyio.h session.h zmodem.h lutil.h emsi.h filelist.h -binkp.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h md5b.h inbound.h +binkp.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h md5b.h inbound.h callstat.h md5b.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h lutil.h md5b.h xmsend.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h session.h ttyio.h statetbl.h xmsend.h m7send.h filelist.h filetime.h xmrecv.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h session.h ttyio.h statetbl.h config.h lutil.h openfile.h m7recv.h xmrecv.h filelist.h filetime.h @@ -108,7 +108,7 @@ openfile.o: ../config.h ../lib/mbselib.h config.h lutil.h openfile.h openport.o: ../config.h ../lib/mbselib.h ulock.h ttyio.h mbcico.h openport.h opentcp.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ../lib/users.h ../lib/mbsedb.h session.h ttyio.h openport.h opentcp.h rdoptions.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ../lib/users.h ../lib/mbsedb.h session.h config.h -yoohoo.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ../lib/users.h ../lib/mbsedb.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h inbound.h +yoohoo.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ../lib/users.h ../lib/mbsedb.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h inbound.h callstat.h recvbark.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ttyio.h session.h statetbl.h recvbark.h respfreq.h filelist.h respfreq.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ../lib/msg.h ../lib/users.h ../lib/mbsedb.h session.h lutil.h config.h atoul.h respfreq.h filelist.h sendbark.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ttyio.h session.h statetbl.h sendbark.h xmrecv.h @@ -123,7 +123,7 @@ telnet.o: ../config.h ../lib/mbselib.h telnet.h ttyio.o: ../config.h ../lib/mbselib.h ttyio.h lutil.h lutil.o: ../config.h ../lib/mbselib.h lutil.h scanout.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h config.h scanout.h lutil.h -emsi.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h ttyio.h session.h statetbl.h config.h emsi.h emsidat.h hydra.h rdoptions.h tcp.h wazoo.h inbound.h +emsi.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h ttyio.h session.h statetbl.h config.h emsi.h emsidat.h hydra.h rdoptions.h tcp.h wazoo.h inbound.h callstat.h ulock.o: ../config.h ../lib/mbselib.h callstat.o: ../config.h ../lib/mbselib.h callstat.h session.o: ../config.h ../lib/mbselib.h ../lib/nodelist.h ttyio.h statetbl.h emsi.h ftsc.h session.h yoohoo.h mbcico.h binkp.h callstat.h inbound.h opentcp.h telnet.h diff --git a/mbcico/binkp.c b/mbcico/binkp.c index d6a5896a..614da79d 100644 --- a/mbcico/binkp.c +++ b/mbcico/binkp.c @@ -49,6 +49,7 @@ #include "config.h" #include "md5b.h" #include "inbound.h" +#include "callstat.h" /* @@ -72,6 +73,7 @@ extern int Loaded; extern pid_t mypid; extern struct sockaddr_in peeraddr; extern int most_debug; +extern int laststat; extern unsigned long sentbytes; @@ -211,6 +213,7 @@ struct binkprec { }; + #ifdef USE_EXPERIMENT void *z_idata = NULL; /* Data for zstream */ void *z_odata = NULL; /* Data for zstream */ @@ -257,8 +260,8 @@ static int file_transfer(void); /* File transfer state */ int binkp(int role) { - int rc = 0; - + int rc = 0; + Syslog('+', "Binkp: start session"); memset(&bp, 0, sizeof(bp)); bp.Role = role; @@ -308,6 +311,7 @@ int binkp(int role) #endif #endif bp.buggyIrex = FALSE; + laststat = 0; if (role == 1) { if (orgbinkp()) { @@ -400,6 +404,7 @@ SM_EDECL unsigned long bufl; fa_list **tmp, *tmpa; faddr *fa, ra; + callstat *cst; SM_START(ConnInit) @@ -476,6 +481,9 @@ SM_STATE(WaitAddr) } } if (!dupe) { + cst = getstatus(fa); + if (cst->trystat) + laststat = cst->trystat; *tmp = (fa_list*)malloc(sizeof(fa_list)); (*tmp)->next = NULL; (*tmp)->addr = fa; @@ -633,6 +641,7 @@ SM_STATE(WaitOk) SM_STATE(Opts) + Syslog('b', "Binkp: last session was %d", laststat); IsDoing("Binkp to %s", ascfnode(remote->addr, 0xf)); binkp_set_comp_state(); SM_SUCCESS; @@ -670,6 +679,7 @@ SM_EDECL unsigned long bufl; fa_list **tmp, *tmpa; faddr *fa; + callstat *cst; SM_START(ConnInit) @@ -748,6 +758,9 @@ SM_STATE(WaitAddr) } } if (!dupe) { + cst = getstatus(fa); + if (cst->trystat) + laststat = cst->trystat; *tmp = (fa_list*)malloc(sizeof(fa_list)); (*tmp)->next = NULL; (*tmp)->addr = fa; @@ -927,7 +940,8 @@ SM_STATE(Opts) binkp_send_comp_opts(); binkp_set_comp_state(); - + Syslog('b', "Binkp: last session status %d", laststat); + SM_SUCCESS; SM_END diff --git a/mbcico/callstat.c b/mbcico/callstat.c index 42ce4667..29a7d0da 100644 --- a/mbcico/callstat.c +++ b/mbcico/callstat.c @@ -53,6 +53,11 @@ callstat *getstatus(faddr *addr) +/* + * If sts == 0, set last status Ok. + * if sts == -1, leave last status as it is. + * else, store status and set random next call time. + */ void putstatus(faddr *addr, int incr, int sts) { FILE *fp; @@ -61,7 +66,7 @@ void putstatus(faddr *addr, int incr, int sts) cst = getstatus(addr); if ((fp = fopen(stsname(addr), "w"))) { - if (sts == 0) { + if ((sts == 0) || (sts == -1)) { j = cst->tryno = 0; } else { cst->tryno += incr; @@ -75,7 +80,8 @@ void putstatus(faddr *addr, int incr, int sts) Syslog('d', "Next call allowed over %d seconds", j); } - cst->trystat = sts; + if (sts != -1) + cst->trystat = sts; cst->trytime = time(NULL) + j; fwrite(cst, sizeof(callstat), 1, fp); diff --git a/mbcico/emsi.c b/mbcico/emsi.c index be45379b..0d6f58cf 100644 --- a/mbcico/emsi.c +++ b/mbcico/emsi.c @@ -44,6 +44,7 @@ #include "tcp.h" #include "wazoo.h" #include "inbound.h" +#include "callstat.h" #define LOCAL_PROTOS (PROT_ZMO | PROT_ZAP | PROT_HYD | PROT_TCP) @@ -53,6 +54,7 @@ static int txemsi(void); static char *intro; static int caller; +extern int laststat; extern int most_debug; extern pid_t mypid; @@ -70,10 +72,11 @@ int emsi_akas = 0; int rx_emsi(char *data) { - int rc, protect = FALSE; - fa_list *tmr; - int denypw=0; - + int rc, protect = FALSE; + fa_list *tmr; + int denypw=0; + callstat *cst; + emsi_local_lcodes = LCODE_RH1; emsi_remote_lcodes=0; @@ -126,12 +129,18 @@ int rx_emsi(char *data) emsi_local_password = NULL; - for (tmr = remote; tmr; tmr = tmr->next) + for (tmr = remote; tmr; tmr = tmr->next) { if (((nlent = getnlent(tmr->addr))) && (nlent->pflag != NL_DUMMY)) { Syslog('+', "Remote is a listed system"); UserCity(mypid, nlent->sysop, nlent->location); break; } + cst = getstatus(tmr->addr); + if (cst->trystat) + laststat = cst->trystat; + } + Syslog('s', "Last connection status %d", laststat); + if (nlent) rdoptions(TRUE); @@ -188,8 +197,6 @@ int rx_emsi(char *data) return rxtcp(); else if (emsi_local_protos & PROT_HYD) return hydra(0); -// else if (emsi_local_protos & PROT_JAN) -// return janus(); else return rxwazoo(); } @@ -198,8 +205,8 @@ int rx_emsi(char *data) int tx_emsi(char *data) { - int rc; - + int rc; + emsi_local_lcodes = LCODE_PUA | LCODE_RH1; emsi_remote_lcodes = 0; diff --git a/mbcico/outstat.c b/mbcico/outstat.c index 009db2d4..bb2e22e2 100644 --- a/mbcico/outstat.c +++ b/mbcico/outstat.c @@ -528,7 +528,7 @@ int pollnode(faddr *addr, int stop) (cst->trystat == MBERR_UNKNOWN_SESSION) || (cst->trystat == MBERR_NO_PORT_AVAILABLE) || (cst->trystat == MBERR_MODEM_ERROR)) { - putstatus(addr, 0, 0); + putstatus(addr, 0, -1); } CreateSema((char *)"scanout"); } @@ -547,7 +547,7 @@ int reset(faddr *addr) if (addr == NULL) return 0; - putstatus(addr, 0, 0); + putstatus(addr, 0, -1); Syslog('+', "Reset try-counter for %s", ascfnode(addr, 0x1f)); if (!do_quiet) printf("Reset try-counter for %s\n", ascfnode(addr, 0x1f)); diff --git a/mbcico/session.c b/mbcico/session.c index 2eda22ee..79fc3db5 100644 --- a/mbcico/session.c +++ b/mbcico/session.c @@ -4,7 +4,7 @@ * Purpose ...............: Fidonet mailer * ***************************************************************************** - * Copyright (C) 1997-2004 + * Copyright (C) 1997-2005 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -53,6 +53,7 @@ node *nlent = NULL; fa_list *remote = NULL; int session_flags; int remote_flags; +int laststat = 0; /* Last session status with remote */ int tx_define_type(void); int rx_define_type(void); diff --git a/mbcico/yoohoo.c b/mbcico/yoohoo.c index 0b6e6b4f..b89b81f1 100644 --- a/mbcico/yoohoo.c +++ b/mbcico/yoohoo.c @@ -52,6 +52,7 @@ #include "dietifna.h" #include "yoohoo.h" #include "inbound.h" +#include "callstat.h" /*------------------------------------------------------------------------*/ @@ -113,6 +114,7 @@ typedef struct _Hello { extern int Loaded; extern pid_t mypid; +extern int laststat; Hello hello2; Hello gethello2(unsigned char[]); @@ -124,6 +126,7 @@ int rx_yoohoo(void) int rc, protect = FALSE; unsigned short capabilities,localcaps; char *pwd = NULL; + callstat *cst; pwd = NULL; y_akas = 0; @@ -169,6 +172,11 @@ int rx_yoohoo(void) strncpy(history.location, nlent->location, 35); UserCity(mypid, nlent->sysop, nlent->location); } + cst = getstatus(remote->addr); + if (cst->trystat) + laststat = cst->trystat; + Syslog('s', "Last session status %d", laststat); + if (nlent) rdoptions(Loaded);