From dadda455f2af09e4302528be261cb8cec32478d3 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 30 Nov 2003 14:36:53 +0000 Subject: [PATCH] Removed binkp CRC mode --- ChangeLog | 12 +++ lib/common.h | 4 +- lib/nodelock.c | 12 ++- lib/structs.h | 4 +- mbcico/binkp.c | 184 ++++++--------------------------------------- mbcico/call.c | 18 ++--- mbcico/emsidat.c | 3 +- mbcico/ftsc.c | 2 +- mbcico/mbcico.h | 6 -- mbcico/session.c | 5 +- mbcico/ttyio.c | 2 +- mbcico/yoohoo.c | 2 +- mbfido/queue.c | 9 ++- mbsetup/m_global.c | 54 ++++++------- mbsetup/m_node.c | 54 ++++++------- 15 files changed, 117 insertions(+), 254 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e2e338f..bee4c45b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,18 @@ $Id$ v0.39.3 26-Nov-2003 + general: + Since this version Posix threads are being used, please let + me know if this doesn't compile on you system. + + mbcico: + Dropped binkp CRC support because it will be incompatible with + future extensions. + + mbsetup: + Removed binkp CRC settings. + + v0.39.2 21-Nov-2003 - 26-Nov-2003 general: diff --git a/lib/common.h b/lib/common.h index 0192635a..58299781 100644 --- a/lib/common.h +++ b/lib/common.h @@ -289,8 +289,8 @@ int getfilecase(char *, char *); /* * From nodelock.c */ -int nodelock(faddr *); -int nodeulock(faddr *); +int nodelock(faddr *, pid_t); +int nodeulock(faddr *, pid_t); /* diff --git a/lib/nodelock.c b/lib/nodelock.c index ad2d6fca..b9ea6d78 100644 --- a/lib/nodelock.c +++ b/lib/nodelock.c @@ -36,11 +36,11 @@ -int nodelock(faddr *addr) +int nodelock(faddr *addr, pid_t mypid) { char *fn, *tfn, *p, tmp[16]; FILE *fp; - pid_t pid, mypid; + pid_t pid; int tmppid, sverr; time_t ltime, now; @@ -48,7 +48,6 @@ int nodelock(faddr *addr) tfn = xstrcpy(fn); if ((p=strrchr(tfn,'/'))) *++p='\0'; - mypid = getpid(); sprintf(tmp, "aa%d", mypid); tfn = xstrcat(tfn, tmp); mkdirs(tfn, 0770); @@ -96,7 +95,7 @@ int nodelock(faddr *addr) /* * If lock is our own lock, then it's ok and we are ready. */ - if (getpid() == pid) { + if (mypid == pid) { unlink(tfn); free(tfn); return 0; @@ -135,11 +134,11 @@ int nodelock(faddr *addr) -int nodeulock(faddr *addr) +int nodeulock(faddr *addr, pid_t mypid) { char *fn; FILE *fp; - pid_t pid, mypid; + pid_t pid; int tmppid; fn = bsyname(addr); @@ -151,7 +150,6 @@ int nodeulock(faddr *addr) fscanf(fp, "%d", &tmppid); pid = tmppid; fclose(fp); - mypid = getpid(); if (pid == mypid) { unlink(fn); diff --git a/lib/structs.h b/lib/structs.h index 05f36d2a..ddb0f0c9 100644 --- a/lib/structs.h +++ b/lib/structs.h @@ -717,7 +717,7 @@ struct sysconfig { unsigned NoFreqs : 1; /* Don't allow requests */ unsigned NoCall : 1; /* Don't call */ unsigned NoMD5 : 1; /* Don't do MD5 */ - unsigned NoCRC32 : 1; /* Don't do CRC32 */ + unsigned xNoCRC32 : 1; unsigned NoEMSI : 1; /* Don't do EMSI */ unsigned NoWazoo : 1; /* Don't do Yooho/2U2 */ unsigned NoZmodem : 1; /* Don't do Zmodem */ @@ -1197,7 +1197,7 @@ struct _nodes { unsigned xNoJanus : 1; /* Don't use Janus */ unsigned NoHydra : 1; /* Don't use Hydra */ - unsigned CRC32 : 1; /* Allow binkp CRC32 */ + unsigned xCRC32 : 1; unsigned PackNetmail : 1; /* Pack netmail */ unsigned ARCmailCompat : 1; /* ARCmail Compatibility */ unsigned ARCmailAlpha : 1; /* Allow a..z ARCmail name */ diff --git a/mbcico/binkp.c b/mbcico/binkp.c index 3b882f32..4d947f19 100644 --- a/mbcico/binkp.c +++ b/mbcico/binkp.c @@ -54,7 +54,6 @@ #include "config.h" #include "md5b.h" #include "inbound.h" -#include "mbcico.h" /* @@ -78,7 +77,6 @@ static char *bstate[] = { */ void binkp_init(void); void binkp_deinit(void); -void *binkp_readbuf(void); char *unix2binkp(char *); char *binkp2unix(char *); int binkp_expired(void); @@ -128,14 +126,10 @@ static int CRAMflag = FALSE; /* CRAM option flag */ static int Secure = FALSE; /* Secure session */ unsigned long nethold, mailhold; /* Trafic for the remote */ int transferred = FALSE; /* Anything transferred in batch */ -int batchnr = 0, crc_errors = 0; +int batchnr = 0; unsigned char *MD_challenge = NULL; /* Received CRAM challenge data */ int ext_rand = 0; - -static int read_state; - - struct binkprec { int role; /* 1=orig, 0=answer */ int RxState; /* Receiver state */ @@ -145,17 +139,14 @@ struct binkprec { long roffs; /* Receiver offset */ char *rname; /* Receiver filename */ time_t rtime; /* Receiver filetime */ - unsigned long rcrc; /* Receiver crc */ long lsize; /* Local filesize */ char *lname; /* Local filename */ time_t ltime; /* Local filetime */ - unsigned long tcrc; /* Transmitter crc */ long gsize; /* GET filesize */ long goffset; /* GET offset */ char *gname; /* GET filename */ time_t gtime; /* GET filetime */ int MBflag; /* MB option flag */ - int CRCflag; /* CRC option flag */ int Major; /* Remote major protocol version */ int Minor; /* Remote minor protocol version */ }; @@ -166,30 +157,16 @@ struct binkprec bp; /* Global structure */ void binkp_init(void) { - int frk; - bp.rname = calloc(512, sizeof(char)); bp.lname = calloc(512, sizeof(char)); bp.gname = calloc(512, sizeof(char)); bp.MBflag = WeCan; - if (CFG.NoCRC32) - bp.CRCflag = No; - else - bp.CRCflag = WeCan; bp.Major = 1; bp.Minor = 0; bp.DidSendGET = FALSE; - - read_state = 0; - - frk = pthread_create(&threads[0], NULL, binkp_readbuf, NULL); - Syslog('-', "pthread_create returnd %d", frk); - - Syslog('+', "Binkp: init complete"); } - void binkp_deinit(void) { if (bp.rname) @@ -201,29 +178,6 @@ void binkp_deinit(void) } - -/* - * Read buffer, executed in a second process - */ -void *binkp_readbuf(void) -{ - /* - * Just for testing - */ - Syslog('!', "Entering binkp_readbuf"); - - while (TRUE) { - read_state++; - if (read_state > 20) - read_state = 0; - usleep(100000); - Syslog('!', "readstate now %d", read_state); - } - Syslog('!', "SHOULD NOT BE HERE"); -} - - - int binkp(int role) { int rc = MBERR_OK; @@ -493,11 +447,7 @@ int resync(off_t off) { Syslog('b', "Binkp: resync(%d) DidSendGET=%s", off, bp.DidSendGET ?"TRUE":"FALSE"); if (!bp.DidSendGET) { - if (bp.CRCflag == Active) { - binkp_send_control(MM_GET, "%s %ld %ld %ld %lx", bp.rname, bp.rsize, bp.rtime, off, bp.rcrc); - } else { - binkp_send_control(MM_GET, "%s %ld %ld %ld", bp.rname, bp.rsize, bp.rtime, off); - } + binkp_send_control(MM_GET, "%s %ld %ld %ld", bp.rname, bp.rsize, bp.rtime, off); bp.DidSendGET = TRUE; Syslog('+', "Binkp: already %lu bytes received, requested restart with offset", (unsigned long)off); return -1; /* Signal openfile not to open the file */ @@ -645,17 +595,6 @@ void b_nul(char *msg) MD_challenge = MD_getChallenge(msg, NULL); } } - if (strstr(msg, (char *)"CRC") != NULL) { - if (bp.CRCflag == WeCan) { - bp.CRCflag = TheyWant; - Syslog('b', "CRCflag WeCan => TheyWant"); - } else if (bp.CRCflag == WeWant) { - bp.CRCflag = Active; - Syslog('b', "CRCflag WeWant => Active"); - } else { - Syslog('b', "CRCflag is %s and received CRC option", opstate[bp.CRCflag]); - } - } } else Syslog('+', "Binkp: M_NUL \"%s\"", msg); } @@ -706,15 +645,15 @@ SM_STATE(WaitConn) /* * Build options we want */ - p = xstrcpy((char *)"OPT"); - if ((noderecord(remote->addr)) && nodes.CRC32 && (bp.CRCflag == WeCan)) { - p = xstrcat(p, (char *)" CRC"); - bp.CRCflag = WeWant; - Syslog('b', "CRCflag WeCan => WeWant"); - } - if (strcmp(p, (char *)"OPT")) - binkp_send_control(MM_NUL, p); - free(p); +// p = xstrcpy((char *)"OPT"); +// if ((noderecord(remote->addr)) && nodes.CRC32 && (bp.CRCflag == WeCan)) { +// p = xstrcat(p, (char *)" CRC"); +// bp.CRCflag = WeWant; +// Syslog('b', "CRCflag WeCan => WeWant"); +// } +// if (strcmp(p, (char *)"OPT")) +// binkp_send_control(MM_NUL, p); +// free(p); b_banner(); /* @@ -785,7 +724,7 @@ SM_STATE(WaitAddr) for (tmpa = remote; tmpa; tmpa = tmpa->next) { Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f)); - if (nodelock(tmpa->addr)) { + if (nodelock(tmpa->addr, mypid)) { binkp_send_control(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f)); SM_ERROR; } @@ -1025,7 +964,7 @@ SM_STATE(WaitAddr) for (tmpa = remote; tmpa; tmpa = tmpa->next) { Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f)); - if (nodelock(tmpa->addr)) { + if (nodelock(tmpa->addr, mypid)) { binkp_send_control(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f)); SM_ERROR; } @@ -1055,16 +994,6 @@ SM_STATE(WaitAddr) // binkp_send_control(MM_NUL,"OPT MB"); // bp.MBflag = Active; // } - if (bp.CRCflag == TheyWant) { - if (Loaded && nodes.CRC32 && !CFG.NoCRC32) { - binkp_send_control(MM_NUL,"OPT CRC"); - Syslog('+', "Binkp: using file transfers with CRC32 checking"); - bp.CRCflag = Active; - } else { - Syslog('b', "Binkp: CRC32 support is diabled here"); - bp.CRCflag = No; - } - } history.aka.zone = remote->addr->zone; history.aka.net = remote->addr->net; @@ -1234,7 +1163,6 @@ int binkp_batch(file_list *to_send) long txpos = 0, rxpos = 0, stxpos = 0, written; int sverr, cmd = FALSE, GotFrame = FALSE, blklen = 0, c, Found = FALSE; unsigned short header = 0; - unsigned long rxcrc = 0; off_t rxbytes; binkp_list *bll = NULL, *tmp, *tmpg, *cursend = NULL; file_list *tsl; @@ -1248,8 +1176,6 @@ int binkp_batch(file_list *to_send) txtvstart.tv_sec = txtvstart.tv_usec = 0; txtvend.tv_sec = txtvend.tv_usec = 0; tz.tz_minuteswest = tz.tz_dsttime = 0; - bp.rcrc = 0; - bp.tcrc = 0; batchnr++; Syslog('+', "Binkp: starting batch %d", batchnr); @@ -1279,8 +1205,6 @@ int binkp_batch(file_list *to_send) while ((bp.RxState != RxDone) || (bp.TxState != TxDone)) { Nopper(); - Syslog('-', "read state %d", read_state); - if (binkp_expired()) { Syslog('!', "Binkp: Transfer timeout"); Syslog('b', "Binkp: TxState=%s, RxState=%s, rxlen=%d", txstate[bp.TxState], rxstate[bp.RxState], rxlen); @@ -1351,11 +1275,6 @@ int binkp_batch(file_list *to_send) txflock.l_start = 0L; txflock.l_len = 0L; - if (bp.CRCflag == Active) - bp.tcrc = file_crc(tmp->local, FALSE); - else - bp.tcrc = 0; - txfp = fopen(tmp->local, "r"); if (txfp == NULL) { sverr = errno; @@ -1378,15 +1297,9 @@ int binkp_batch(file_list *to_send) txpos = stxpos = tmp->offset; Syslog('+', "Binkp: send \"%s\" as \"%s\"", MBSE_SS(tmp->local), MBSE_SS(tmp->remote)); - if ((bp.CRCflag == Active) && bp.tcrc) { - Syslog('+', "Binkp: size %lu bytes, dated %s, crc %lx", (unsigned long)tmp->size, date(tmp->date), bp.tcrc); - binkp_send_control(MM_FILE, "%s %lu %ld %ld %lx", MBSE_SS(tmp->remote), - (unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset, bp.tcrc); - } else { - Syslog('+', "Binkp: size %lu bytes, dated %s", (unsigned long)tmp->size, date(tmp->date)); - binkp_send_control(MM_FILE, "%s %lu %ld %ld", MBSE_SS(tmp->remote), + Syslog('+', "Binkp: size %lu bytes, dated %s", (unsigned long)tmp->size, date(tmp->date)); + binkp_send_control(MM_FILE, "%s %lu %ld %ld", MBSE_SS(tmp->remote), (unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset); - } gettimeofday(&txtvstart, &tz); tmp->state = Sending; cursend = tmp; @@ -1542,16 +1455,11 @@ int binkp_batch(file_list *to_send) case MM_FILE: Syslog('b', "Binkp: got FILE: %s", rxbuf+1); if ((bp.RxState == RxWaitFile) || (bp.RxState == RxEndOfBatch)) { bp.RxState = RxAcceptFile; + /* + * Check against buffer overflow + */ if (strlen(rxbuf) < 512) { - /* - * Check against buffer overflow - */ - bp.rcrc = 0; - if (bp.CRCflag == Active) { - sscanf(rxbuf+1, "%s %ld %ld %ld %lx", bp.rname, &bp.rsize, &bp.rtime, &bp.roffs, &bp.rcrc); - } else { - sscanf(rxbuf+1, "%s %ld %ld %ld", bp.rname, &bp.rsize, &bp.rtime, &bp.roffs); - } + sscanf(rxbuf+1, "%s %ld %ld %ld", bp.rname, &bp.rsize, &bp.rtime, &bp.roffs); } else { Syslog('+', "Binkp: got corrupted FILE frame, size %d bytes", strlen(rxbuf)); } @@ -1566,8 +1474,6 @@ int binkp_batch(file_list *to_send) if (blklen) { if (bp.RxState == RxReceData) { written = fwrite(rxbuf, 1, blklen, rxfp); - if (bp.CRCflag == Active) - rxcrc = upd_crc32(rxbuf, rxcrc, blklen); if (!written && blklen) { Syslog('+', "Binkp: file write error"); bp.RxState = RxDone; @@ -1575,31 +1481,8 @@ int binkp_batch(file_list *to_send) rxpos += written; if (rxpos == bp.rsize) { bp.RxState = RxWaitFile; - if ((bp.CRCflag == Active) && bp.rcrc) { - rxcrc = rxcrc ^ 0xffffffff; - if (bp.rcrc == rxcrc) { - binkp_send_control(MM_GOT, "%s %ld %ld %lx", bp.rname, bp.rsize, bp.rtime, bp.rcrc); - closefile(); - } else { - rxerror = TRUE; - crc_errors++; - binkp_send_control(MM_SKIP, "%s %ld %ld %lx", bp.rname, bp.rsize, bp.rtime, bp.rcrc); - Syslog('+', "Binkp: file CRC error nr %d, sending SKIP frame", crc_errors); - if (crc_errors >= 3) { - WriteError("Binkp: file CRC error nr %d, aborting session", crc_errors); - binkp_send_control(MM_ERR, "Too much CRC errors, aborting session"); - bp.RxState = RxDone; - rc = MBERR_FTRANSFER; - } - closefile(); - } - } else { - /* - * ACK without CRC check - */ - binkp_send_control(MM_GOT, "%s %ld %ld", bp.rname, bp.rsize, bp.rtime); - closefile(); - } + binkp_send_control(MM_GOT, "%s %ld %ld", bp.rname, bp.rsize, bp.rtime); + closefile(); rxpos = rxpos - rxbytes; gettimeofday(&rxtvend, &tz); Syslog('+', "Binkp: %s %s", rxerror?"ERROR":"OK", transfertime(rxtvstart, rxtvend, rxpos, FALSE)); @@ -1632,12 +1515,7 @@ int binkp_batch(file_list *to_send) break; case RxAcceptFile: - if (bp.CRCflag == Active) - Syslog('+', "Binkp: receive file \"%s\" date %s size %ld offset %ld crc %lx", - bp.rname, date(bp.rtime), bp.rsize, bp.roffs, bp.rcrc); - else - Syslog('+', "Binkp: receive file \"%s\" date %s size %ld offset %ld", - bp.rname, date(bp.rtime), bp.rsize, bp.roffs); + Syslog('+', "Binkp: receive file \"%s\" date %s size %ld offset %ld", bp.rname, date(bp.rtime), bp.rsize, bp.roffs); (void)binkp2unix(bp.rname); rxfp = openfile(binkp2unix(bp.rname), bp.rtime, bp.rsize, &rxbytes, resync); @@ -1653,14 +1531,6 @@ int binkp_batch(file_list *to_send) gettimeofday(&rxtvstart, &tz); rxpos = bp.roffs; - - /* - * FIXME: if we have a rxpos, we are appending a partial received file. - * We now need to know the CRC of the already received part! - * Note, file is open in a+ mode, so we can read the already received - * part and calculate the crc. For now, don't use CRC32 mode. - */ - rxcrc = 0xffffffff; rxerror = FALSE; if (!diskfree(CFG.freespace)) { @@ -1689,10 +1559,7 @@ int binkp_batch(file_list *to_send) * be deleted at the remote. */ Syslog('+', "Binkp: already got %s, sending GOT", bp.rname); - if ((bp.CRCflag == Active) && bp.rcrc) - binkp_send_control(MM_GOT, "%s %ld %ld %lx", bp.rname, bp.rsize, bp.rtime, bp.rcrc); - else - binkp_send_control(MM_GOT, "%s %ld %ld", bp.rname, bp.rsize, bp.rtime); + binkp_send_control(MM_GOT, "%s %ld %ld", bp.rname, bp.rsize, bp.rtime); bp.RxState = RxWaitFile; rxfp = NULL; } else if (!rxfp) { @@ -1700,10 +1567,7 @@ int binkp_batch(file_list *to_send) * Some error, request to skip it */ Syslog('+', "Binkp: error file %s, sending SKIP", bp.rname); - if ((bp.CRCflag == Active) && bp.rcrc) - binkp_send_control(MM_SKIP, "%s %ld %ld %lx", bp.rname, bp.rsize, bp.rtime, bp.rcrc); - else - binkp_send_control(MM_SKIP, "%s %ld %ld", bp.rname, bp.rsize, bp.rtime); + binkp_send_control(MM_SKIP, "%s %ld %ld", bp.rname, bp.rsize, bp.rtime); bp.RxState = RxWaitFile; } else { Syslog('b', "rsize=%d, rxbytes=%d, roffs=%d", bp.rsize, rxbytes, bp.roffs); diff --git a/mbcico/call.c b/mbcico/call.c index cbea3b60..e2df5144 100644 --- a/mbcico/call.c +++ b/mbcico/call.c @@ -59,7 +59,7 @@ extern char *forcedphone; extern char *forcedline; extern char *inetaddr; extern char *protocol; - +extern pid_t mypid; int portopen(faddr *addr) @@ -71,7 +71,7 @@ int portopen(faddr *addr) Syslog('d', "portopen inetaddr %s", inetaddr); if ((rc = opentcp(inetaddr))) { Syslog('+', "Cannot connect %s", inetaddr); - nodeulock(addr); + nodeulock(addr, mypid); return MBERR_NO_CONNECTION; } return MBERR_OK; @@ -85,13 +85,13 @@ int portopen(faddr *addr) if (load_port(p)) { if ((rc = openport(p, ttyinfo.portspeed))) { Syslog('+', "Cannot open port %s",p); - nodeulock(addr); + nodeulock(addr, mypid); putstatus(addr, 10, MBERR_PORTERROR); return MBERR_PORTERROR; } return MBERR_OK; } else { - nodeulock(addr); + nodeulock(addr, mypid); putstatus(addr, 0, MBERR_PORTERROR); return MBERR_PORTERROR; } @@ -118,7 +118,7 @@ int call(faddr *addr) * First check if node is locked, if not lock it immediatly * or stop further waste of time and logfile space. */ - if (nodelock(addr)) { + if (nodelock(addr, mypid)) { Syslog('+', "System %s is locked", ascfnode(addr, 0x1f)); putstatus(addr, 0, MBERR_NODE_LOCKED); return MBERR_NODE_LOCKED; @@ -127,7 +127,7 @@ int call(faddr *addr) if ((nlent = getnlent(addr)) == NULL) { WriteError("Cannot call %s: fatal in nodelist lookup", ascfnode(addr, 0x1f)); putstatus(addr,0,MBERR_NODE_NOT_IN_LIST); - nodeulock(addr); + nodeulock(addr, mypid); return MBERR_NODE_NOT_IN_LIST; } @@ -190,7 +190,7 @@ int call(faddr *addr) WriteError("No IP address, abort call"); rc = MBERR_NO_IP_ADDRESS; putstatus(addr, 10, rc); - nodeulock(addr); + nodeulock(addr, mypid); return rc; } } else { @@ -228,7 +228,7 @@ int call(faddr *addr) if ((rc == MBERR_OK) && (forcedphone)) { if ((rc = dialphone(forcedphone))) { Syslog('+', "Dial failed"); - nodeulock(addr); + nodeulock(addr, mypid); } } @@ -264,7 +264,7 @@ int call(faddr *addr) Syslog('+', "Cannot call %s (%s)", ascfnode(addr,0x1f), MBSE_SS(nlent->name)); rc = MBERR_NO_CONNECTION; putstatus(addr, 10, rc); - nodeulock(addr); + nodeulock(addr, mypid); return rc; } diff --git a/mbcico/emsidat.c b/mbcico/emsidat.c index ce330357..b3f4f3af 100644 --- a/mbcico/emsidat.c +++ b/mbcico/emsidat.c @@ -46,6 +46,7 @@ extern int Loaded; +extern int mypid; char *emsiencode(char *s) @@ -371,7 +372,7 @@ int scanemsidat(char *buf) for (tmpa = remote; tmpa; tmpa = tmpa->next) { Syslog('+', "address : %s",ascfnode(tmpa->addr,0x1f)); - (void)nodelock(tmpa->addr); + (void)nodelock(tmpa->addr, mypid); /* * With the loaded flag we prevent removing the noderecord * when the remote presents us an address we don't know about. diff --git a/mbcico/ftsc.c b/mbcico/ftsc.c index 63417519..3be6ebd5 100644 --- a/mbcico/ftsc.c +++ b/mbcico/ftsc.c @@ -433,7 +433,7 @@ SM_STATE(scan_packet) (*tmpl)->addr->name=NULL; (*tmpl)->addr->domain=NULL; for (tmpl=&remote;*tmpl;tmpl=&((*tmpl)->next)) { - (void)nodelock((*tmpl)->addr); + (void)nodelock((*tmpl)->addr, mypid); /* try lock all remotes, ignore locking result */ if (!Loaded) if (noderecord((*tmpl)->addr)) diff --git a/mbcico/mbcico.h b/mbcico/mbcico.h index 68d9b68c..7bdcfe19 100644 --- a/mbcico/mbcico.h +++ b/mbcico/mbcico.h @@ -3,12 +3,6 @@ /* $Id$ */ -/* - * Global threads for mbcico - */ -#define NUM_THREADS 4 -pthread_t threads[NUM_THREADS]; - void usage(void); void free_mem(void); diff --git a/mbcico/session.c b/mbcico/session.c index 446ff803..426fb3dd 100644 --- a/mbcico/session.c +++ b/mbcico/session.c @@ -50,7 +50,8 @@ #include "opentcp.h" -extern int tcp_mode; +extern int tcp_mode; +extern pid_t mypid; node *nlent; @@ -170,7 +171,7 @@ int session(faddr *a, node *nl, int role, int tp, char *dt) /* * Unlock all nodes, locks not owned by us are untouched. */ - (void)nodeulock(tmpl->addr); + (void)nodeulock(tmpl->addr, mypid); /* * If successfull session, reset all status records. */ diff --git a/mbcico/ttyio.c b/mbcico/ttyio.c index c63a0142..bd4c3ca3 100644 --- a/mbcico/ttyio.c +++ b/mbcico/ttyio.c @@ -171,7 +171,7 @@ static int tty_read(char *buf, int size, int tot) fd_set readfds, writefds, exceptfds; struct timeval seltimer; - Syslog('t', "tty_read(buf, %d, %d)", size, tot); +// Syslog('t', "tty_read(buf, %d, %d)", size, tot); if (size == 0) return 0; diff --git a/mbcico/yoohoo.c b/mbcico/yoohoo.c index 4dd75013..01998f1f 100644 --- a/mbcico/yoohoo.c +++ b/mbcico/yoohoo.c @@ -577,7 +577,7 @@ int checkhello(void) } for (tmpn = remote; tmpn; tmpn = tmpn->next) { - (void)nodelock(tmpn->addr); + (void)nodelock(tmpn->addr, mypid); /* * lock all remotes, ignore locking result */ diff --git a/mbfido/queue.c b/mbfido/queue.c index ea4d609d..8647ebb5 100644 --- a/mbfido/queue.c +++ b/mbfido/queue.c @@ -48,6 +48,7 @@ static char *dow[] = {(char *)"su", (char *)"mo", (char *)"tu", (char *)"we", extern int do_quiet; extern int flushed; +extern pid_t mypid; /* @@ -167,7 +168,7 @@ void flush_dir(char *ndir) } } } else { - if (nodelock(&noden)) { + if (nodelock(&noden, mypid)) { Syslog('+', "Mail and files stay in queue, will be added later"); if (noden.domain) free(noden.domain); @@ -250,7 +251,7 @@ void flush_dir(char *ndir) if (nodes.Session_out == S_DIR) remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p'); else - nodeulock(&noden); + nodeulock(&noden, mypid); if (noden.domain) free(noden.domain); return; @@ -425,7 +426,7 @@ void flush_dir(char *ndir) if (nodes.Session_out == S_DIR) remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p'); else - nodeulock(&noden); + nodeulock(&noden, mypid); if (noden.domain) free(noden.domain); return; @@ -592,7 +593,7 @@ void flush_dir(char *ndir) if (nodes.Session_out == S_DIR) remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p'); else - nodeulock(&noden); + nodeulock(&noden, mypid); if (noden.domain) free(noden.domain); diff --git a/mbsetup/m_global.c b/mbsetup/m_global.c index 6a2fb37a..e8e0531b 100644 --- a/mbsetup/m_global.c +++ b/mbsetup/m_global.c @@ -1227,18 +1227,17 @@ void s_mailer(void) mvprintw(16, 2, "10. No EMSI session"); mvprintw(17, 2, "11. No Yooho/2U2"); - mvprintw(13,31, "12. No Zmodem"); - mvprintw(14,31, "13. No Zedzap"); - mvprintw(15,31, "14. No Hydra"); - mvprintw(16,31, "15. No MD5"); - mvprintw(17,31, "16. No CRC32"); + mvprintw(14,31, "12. No Zmodem"); + mvprintw(15,31, "13. No Zedzap"); + mvprintw(16,31, "14. No Hydra"); + mvprintw(17,31, "15. No MD5"); - mvprintw(12,59, "17. Phonetrans 1-10"); - mvprintw(13,59, "18. Phonetrans 11-20"); - mvprintw(14,59, "19. Phonetrans 21-30"); - mvprintw(15,59, "20. Phonetrans 31-40"); - mvprintw(16,59, "21. Max. files"); - mvprintw(17,59, "22. Max. MB."); + mvprintw(12,59, "16. Phonetrans 1-10"); + mvprintw(13,59, "17. Phonetrans 11-20"); + mvprintw(14,59, "18. Phonetrans 21-30"); + mvprintw(15,59, "19. Phonetrans 31-40"); + mvprintw(16,59, "20. Max. files"); + mvprintw(17,59, "21. Max. MB."); } @@ -1293,16 +1292,15 @@ void e_mailer(void) show_bool(16,23, CFG.NoEMSI); show_bool(17,23, CFG.NoWazoo); - show_bool(13,52, CFG.NoZmodem); - show_bool(14,52, CFG.NoZedzap); - show_bool(15,52, CFG.NoHydra); - show_bool(16,52, CFG.NoMD5); - show_bool(17,52, CFG.NoCRC32); + show_bool(14,52, CFG.NoZmodem); + show_bool(15,52, CFG.NoZedzap); + show_bool(16,52, CFG.NoHydra); + show_bool(17,52, CFG.NoMD5); show_int( 16,75, CFG.Req_Files); show_int( 17,75, CFG.Req_MBytes); - switch(select_menu(22)) { + switch(select_menu(21)) { case 0: return; case 1: E_LOGL(CFG.cico_loglevel, "1.14.1", s_mailer) case 2: E_STR( 8,23,20,CFG.Phone, "The mailer default ^phone number^ for this system") @@ -1316,18 +1314,17 @@ void e_mailer(void) case 10:E_BOOL(16,23, CFG.NoEMSI, "If set then ^EMSI handshake^ is diabled") case 11:E_BOOL(17,23, CFG.NoWazoo, "If set then ^YooHoo/2U2^ (FTSC-0006) is disabled") - case 12:E_BOOL(13,52, CFG.NoZmodem, "If set then the ^Zmodem^ protocol is disabled") - case 13:E_BOOL(14,52, CFG.NoZedzap, "If set then the ^Zedzap^ protocol is disabled") - case 14:E_BOOL(15,52, CFG.NoHydra, "If set then the ^Hydra^ protocol is disabled") - case 15:E_BOOL(16,52, CFG.NoMD5, "Disable ^MD5 crypted^ passwords with binkp sessions") - case 16:E_BOOL(17,52, CFG.NoCRC32, "Disable ^CRC32^ file transfers with binkp sessions") + case 12:E_BOOL(14,52, CFG.NoZmodem, "If set then the ^Zmodem^ protocol is disabled") + case 13:E_BOOL(15,52, CFG.NoZedzap, "If set then the ^Zedzap^ protocol is disabled") + case 14:E_BOOL(16,52, CFG.NoHydra, "If set then the ^Hydra^ protocol is disabled") + case 15:E_BOOL(17,52, CFG.NoMD5, "Disable ^MD5 crypted^ passwords with binkp sessions") - case 17:e_trans(0, 17); break; - case 18:e_trans(10, 18); break; - case 19:e_trans(20, 19); break; - case 20:e_trans(30, 20); break; - case 21:E_INT(16,75, CFG.Req_Files, "Maximum ^files^ to request, 0 is unlimited") - case 22:E_INT(17,75, CFG.Req_MBytes, "Maximum ^MBytes^ to request, 0 is unlimited") + case 16:e_trans(0, 17); break; + case 17:e_trans(10, 18); break; + case 18:e_trans(20, 19); break; + case 19:e_trans(30, 20); break; + case 20:E_INT(16,75, CFG.Req_Files, "Maximum ^files^ to request, 0 is unlimited") + case 21:E_INT(17,75, CFG.Req_MBytes, "Maximum ^MBytes^ to request, 0 is unlimited") } } } @@ -1919,7 +1916,6 @@ int global_doc(FILE *fp, FILE *toc, int page) fprintf(fp, " No Zedzap %s\n", getboolean(CFG.NoZedzap)); fprintf(fp, " No Hydra %s\n", getboolean(CFG.NoHydra)); fprintf(fp, " No MD5 passwords %s\n", getboolean(CFG.NoMD5)); - fprintf(fp, " No CRC32 transfers %s\n", getboolean(CFG.NoCRC32)); fprintf(fp, " Max request files %d\n", CFG.Req_Files); fprintf(fp, " Max request MBytes %d\n", CFG.Req_MBytes); diff --git a/mbsetup/m_node.c b/mbsetup/m_node.c index bc95be81..533215e4 100644 --- a/mbsetup/m_node.c +++ b/mbsetup/m_node.c @@ -796,12 +796,11 @@ void SessionScreen(void) mvprintw(17, 6, "11. No Filerequest"); mvprintw(18, 6, "12. Don't call"); - mvprintw(13,41, "13. 8.3 names"); - mvprintw(14,41, "14. No Zmodem"); - mvprintw(15,41, "15. No Zedzap"); - mvprintw(16,41, "16. No Hydra"); - mvprintw(17,41, "17. binkp CRC32"); - mvprintw(18,41, "18. binkp old esc"); + mvprintw(14,41, "13. 8.3 names"); + mvprintw(15,41, "14. No Zmodem"); + mvprintw(16,41, "15. No Zedzap"); + mvprintw(17,41, "16. No Hydra"); + mvprintw(18,41, "17. binkp old esc"); } @@ -826,14 +825,13 @@ void SessionEdit(void) show_bool(17,26, nodes.NoFreqs); show_bool(18,26, nodes.NoCall); - show_bool(13,61, nodes.FNC); - show_bool(14,61, nodes.NoZmodem); - show_bool(15,61, nodes.NoZedzap); - show_bool(16,61, nodes.NoHydra); - show_bool(17,61, nodes.CRC32); + show_bool(14,61, nodes.FNC); + show_bool(15,61, nodes.NoZmodem); + show_bool(16,61, nodes.NoZedzap); + show_bool(17,61, nodes.NoHydra); show_bool(18,61, nodes.WrongEscape); - switch(select_menu(18)) { + switch(select_menu(17)) { case 0: return; case 1: E_STR( 7,26,15, nodes.Spasswd, "The ^Session password^ for this node") case 2: E_STR( 8,26,40, nodes.dial, "If needed, give a special modem ^dial command^ for this node") @@ -850,12 +848,11 @@ void SessionEdit(void) case 11:E_BOOL(17,26, nodes.NoFreqs, "Disallow ^file requests^ from this node") case 12:E_BOOL(18,26, nodes.NoCall, "Don't ^call^ this node") - case 13:E_BOOL(13,61, nodes.FNC, "Node needs ^DOS 8.3^ filenames") - case 14:E_BOOL(14,61, nodes.NoZmodem, "Disable ^Zmodem^ protocol with this node") - case 15:E_BOOL(15,61, nodes.NoZedzap, "Disable ^Zedzap^ protocol with this node") - case 16:E_BOOL(16,61, nodes.NoHydra, "Disable ^Hydra^ protocol with this node") - case 17:E_BOOL(17,61, nodes.CRC32, "Enable ^binkp CRC32^ file transfers with this node") - case 18:E_BOOL(18,61, nodes.WrongEscape, "Use the ^old escape^ for long filenames (Argus, Irex)") + case 13:E_BOOL(14,61, nodes.FNC, "Node needs ^DOS 8.3^ filenames") + case 14:E_BOOL(15,61, nodes.NoZmodem, "Disable ^Zmodem^ protocol with this node") + case 15:E_BOOL(16,61, nodes.NoZedzap, "Disable ^Zedzap^ protocol with this node") + case 16:E_BOOL(17,61, nodes.NoHydra, "Disable ^Hydra^ protocol with this node") + case 17:E_BOOL(18,61, nodes.WrongEscape, "Use the ^old escape^ for long filenames (Argus, Irex)") } } } @@ -1485,21 +1482,20 @@ int node_doc(FILE *fp, FILE *toc, int page) fprintf(fp, " No Zmodem %s\n", getboolean(nodes.NoZmodem)); fprintf(fp, " No Zedzap %s", getboolean(nodes.NoZedzap)); fprintf(fp, " No Hydra %s", getboolean(nodes.NoHydra)); - fprintf(fp, " binkp CRC32 %s\n", getboolean(nodes.CRC32)); - fprintf(fp, " binkp old esc %s", getboolean(nodes.WrongEscape)); + fprintf(fp, " binkp old esc %s\n", getboolean(nodes.WrongEscape)); fprintf(fp, " Mail forward %s", getboolean(nodes.MailFwd)); - fprintf(fp, " Check mailpwd %s\n", getboolean(nodes.MailPwdCheck)); - fprintf(fp, " ARCmail comp. %s", getboolean(nodes.ARCmailCompat)); + fprintf(fp, " Check mailpwd %s", getboolean(nodes.MailPwdCheck)); + fprintf(fp, " ARCmail comp. %s\n", getboolean(nodes.ARCmailCompat)); fprintf(fp, " ACRmail a..z %s", getboolean(nodes.ARCmailAlpha)); - fprintf(fp, " Send message %s\n", getboolean(nodes.Message)); - fprintf(fp, " Send .TIC %s", getboolean(nodes.Tic)); + fprintf(fp, " Send message %s", getboolean(nodes.Message)); + fprintf(fp, " Send .TIC %s\n", getboolean(nodes.Tic)); fprintf(fp, " File forward %s", getboolean(nodes.FileFwd)); - fprintf(fp, " Advanced TIC %s\n", getboolean(nodes.AdvTic)); - fprintf(fp, " Advanded SB %s", getboolean(nodes.TIC_AdvSB)); + fprintf(fp, " Advanced TIC %s", getboolean(nodes.AdvTic)); + fprintf(fp, " Advanded SB %s\n", getboolean(nodes.TIC_AdvSB)); fprintf(fp, " Sent To lines %s", getboolean(nodes.TIC_To)); - fprintf(fp, " Billing %s\n", getboolean(nodes.Billing)); - fprintf(fp, " Bill direct %s", getboolean(nodes.BillDirect)); - fprintf(fp, " Uplink add + %s\n", getboolean(nodes.AddPlus)); + fprintf(fp, " Billing %s", getboolean(nodes.Billing)); + fprintf(fp, " Bill direct %s\n", getboolean(nodes.BillDirect)); + fprintf(fp, " Uplink add + %s", getboolean(nodes.AddPlus)); fprintf(fp, " Security flags %s\n\n", getflag(nodes.Security.flags, nodes.Security.notflags)); fprintf(fp, " Outb session %s\n", get_sessiontype(nodes.Session_out));