Removed binkp CRC mode

This commit is contained in:
Michiel Broek 2003-11-30 14:36:53 +00:00
parent d03acf0726
commit dadda455f2
15 changed files with 117 additions and 254 deletions

View File

@ -2,6 +2,18 @@ $Id$
v0.39.3 26-Nov-2003 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 v0.39.2 21-Nov-2003 - 26-Nov-2003
general: general:

View File

@ -289,8 +289,8 @@ int getfilecase(char *, char *);
/* /*
* From nodelock.c * From nodelock.c
*/ */
int nodelock(faddr *); int nodelock(faddr *, pid_t);
int nodeulock(faddr *); int nodeulock(faddr *, pid_t);
/* /*

View File

@ -36,11 +36,11 @@
int nodelock(faddr *addr) int nodelock(faddr *addr, pid_t mypid)
{ {
char *fn, *tfn, *p, tmp[16]; char *fn, *tfn, *p, tmp[16];
FILE *fp; FILE *fp;
pid_t pid, mypid; pid_t pid;
int tmppid, sverr; int tmppid, sverr;
time_t ltime, now; time_t ltime, now;
@ -48,7 +48,6 @@ int nodelock(faddr *addr)
tfn = xstrcpy(fn); tfn = xstrcpy(fn);
if ((p=strrchr(tfn,'/'))) if ((p=strrchr(tfn,'/')))
*++p='\0'; *++p='\0';
mypid = getpid();
sprintf(tmp, "aa%d", mypid); sprintf(tmp, "aa%d", mypid);
tfn = xstrcat(tfn, tmp); tfn = xstrcat(tfn, tmp);
mkdirs(tfn, 0770); 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 lock is our own lock, then it's ok and we are ready.
*/ */
if (getpid() == pid) { if (mypid == pid) {
unlink(tfn); unlink(tfn);
free(tfn); free(tfn);
return 0; return 0;
@ -135,11 +134,11 @@ int nodelock(faddr *addr)
int nodeulock(faddr *addr) int nodeulock(faddr *addr, pid_t mypid)
{ {
char *fn; char *fn;
FILE *fp; FILE *fp;
pid_t pid, mypid; pid_t pid;
int tmppid; int tmppid;
fn = bsyname(addr); fn = bsyname(addr);
@ -151,7 +150,6 @@ int nodeulock(faddr *addr)
fscanf(fp, "%d", &tmppid); fscanf(fp, "%d", &tmppid);
pid = tmppid; pid = tmppid;
fclose(fp); fclose(fp);
mypid = getpid();
if (pid == mypid) { if (pid == mypid) {
unlink(fn); unlink(fn);

View File

@ -717,7 +717,7 @@ struct sysconfig {
unsigned NoFreqs : 1; /* Don't allow requests */ unsigned NoFreqs : 1; /* Don't allow requests */
unsigned NoCall : 1; /* Don't call */ unsigned NoCall : 1; /* Don't call */
unsigned NoMD5 : 1; /* Don't do MD5 */ 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 NoEMSI : 1; /* Don't do EMSI */
unsigned NoWazoo : 1; /* Don't do Yooho/2U2 */ unsigned NoWazoo : 1; /* Don't do Yooho/2U2 */
unsigned NoZmodem : 1; /* Don't do Zmodem */ unsigned NoZmodem : 1; /* Don't do Zmodem */
@ -1197,7 +1197,7 @@ struct _nodes {
unsigned xNoJanus : 1; /* Don't use Janus */ unsigned xNoJanus : 1; /* Don't use Janus */
unsigned NoHydra : 1; /* Don't use Hydra */ unsigned NoHydra : 1; /* Don't use Hydra */
unsigned CRC32 : 1; /* Allow binkp CRC32 */ unsigned xCRC32 : 1;
unsigned PackNetmail : 1; /* Pack netmail */ unsigned PackNetmail : 1; /* Pack netmail */
unsigned ARCmailCompat : 1; /* ARCmail Compatibility */ unsigned ARCmailCompat : 1; /* ARCmail Compatibility */
unsigned ARCmailAlpha : 1; /* Allow a..z ARCmail name */ unsigned ARCmailAlpha : 1; /* Allow a..z ARCmail name */

View File

@ -54,7 +54,6 @@
#include "config.h" #include "config.h"
#include "md5b.h" #include "md5b.h"
#include "inbound.h" #include "inbound.h"
#include "mbcico.h"
/* /*
@ -78,7 +77,6 @@ static char *bstate[] = {
*/ */
void binkp_init(void); void binkp_init(void);
void binkp_deinit(void); void binkp_deinit(void);
void *binkp_readbuf(void);
char *unix2binkp(char *); char *unix2binkp(char *);
char *binkp2unix(char *); char *binkp2unix(char *);
int binkp_expired(void); int binkp_expired(void);
@ -128,14 +126,10 @@ static int CRAMflag = FALSE; /* CRAM option flag */
static int Secure = FALSE; /* Secure session */ static int Secure = FALSE; /* Secure session */
unsigned long nethold, mailhold; /* Trafic for the remote */ unsigned long nethold, mailhold; /* Trafic for the remote */
int transferred = FALSE; /* Anything transferred in batch */ 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 */ unsigned char *MD_challenge = NULL; /* Received CRAM challenge data */
int ext_rand = 0; int ext_rand = 0;
static int read_state;
struct binkprec { struct binkprec {
int role; /* 1=orig, 0=answer */ int role; /* 1=orig, 0=answer */
int RxState; /* Receiver state */ int RxState; /* Receiver state */
@ -145,17 +139,14 @@ struct binkprec {
long roffs; /* Receiver offset */ long roffs; /* Receiver offset */
char *rname; /* Receiver filename */ char *rname; /* Receiver filename */
time_t rtime; /* Receiver filetime */ time_t rtime; /* Receiver filetime */
unsigned long rcrc; /* Receiver crc */
long lsize; /* Local filesize */ long lsize; /* Local filesize */
char *lname; /* Local filename */ char *lname; /* Local filename */
time_t ltime; /* Local filetime */ time_t ltime; /* Local filetime */
unsigned long tcrc; /* Transmitter crc */
long gsize; /* GET filesize */ long gsize; /* GET filesize */
long goffset; /* GET offset */ long goffset; /* GET offset */
char *gname; /* GET filename */ char *gname; /* GET filename */
time_t gtime; /* GET filetime */ time_t gtime; /* GET filetime */
int MBflag; /* MB option flag */ int MBflag; /* MB option flag */
int CRCflag; /* CRC option flag */
int Major; /* Remote major protocol version */ int Major; /* Remote major protocol version */
int Minor; /* Remote minor protocol version */ int Minor; /* Remote minor protocol version */
}; };
@ -166,30 +157,16 @@ struct binkprec bp; /* Global structure */
void binkp_init(void) void binkp_init(void)
{ {
int frk;
bp.rname = calloc(512, sizeof(char)); bp.rname = calloc(512, sizeof(char));
bp.lname = calloc(512, sizeof(char)); bp.lname = calloc(512, sizeof(char));
bp.gname = calloc(512, sizeof(char)); bp.gname = calloc(512, sizeof(char));
bp.MBflag = WeCan; bp.MBflag = WeCan;
if (CFG.NoCRC32)
bp.CRCflag = No;
else
bp.CRCflag = WeCan;
bp.Major = 1; bp.Major = 1;
bp.Minor = 0; bp.Minor = 0;
bp.DidSendGET = FALSE; 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) void binkp_deinit(void)
{ {
if (bp.rname) 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 binkp(int role)
{ {
int rc = MBERR_OK; 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"); Syslog('b', "Binkp: resync(%d) DidSendGET=%s", off, bp.DidSendGET ?"TRUE":"FALSE");
if (!bp.DidSendGET) { 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; bp.DidSendGET = TRUE;
Syslog('+', "Binkp: already %lu bytes received, requested restart with offset", (unsigned long)off); Syslog('+', "Binkp: already %lu bytes received, requested restart with offset", (unsigned long)off);
return -1; /* Signal openfile not to open the file */ return -1; /* Signal openfile not to open the file */
@ -645,17 +595,6 @@ void b_nul(char *msg)
MD_challenge = MD_getChallenge(msg, NULL); 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 } else
Syslog('+', "Binkp: M_NUL \"%s\"", msg); Syslog('+', "Binkp: M_NUL \"%s\"", msg);
} }
@ -706,15 +645,15 @@ SM_STATE(WaitConn)
/* /*
* Build options we want * Build options we want
*/ */
p = xstrcpy((char *)"OPT"); // p = xstrcpy((char *)"OPT");
if ((noderecord(remote->addr)) && nodes.CRC32 && (bp.CRCflag == WeCan)) { // if ((noderecord(remote->addr)) && nodes.CRC32 && (bp.CRCflag == WeCan)) {
p = xstrcat(p, (char *)" CRC"); // p = xstrcat(p, (char *)" CRC");
bp.CRCflag = WeWant; // bp.CRCflag = WeWant;
Syslog('b', "CRCflag WeCan => WeWant"); // Syslog('b', "CRCflag WeCan => WeWant");
} // }
if (strcmp(p, (char *)"OPT")) // if (strcmp(p, (char *)"OPT"))
binkp_send_control(MM_NUL, p); // binkp_send_control(MM_NUL, p);
free(p); // free(p);
b_banner(); b_banner();
/* /*
@ -785,7 +724,7 @@ SM_STATE(WaitAddr)
for (tmpa = remote; tmpa; tmpa = tmpa->next) { for (tmpa = remote; tmpa; tmpa = tmpa->next) {
Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f)); 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)); binkp_send_control(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f));
SM_ERROR; SM_ERROR;
} }
@ -1025,7 +964,7 @@ SM_STATE(WaitAddr)
for (tmpa = remote; tmpa; tmpa = tmpa->next) { for (tmpa = remote; tmpa; tmpa = tmpa->next) {
Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f)); 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)); binkp_send_control(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f));
SM_ERROR; SM_ERROR;
} }
@ -1055,16 +994,6 @@ SM_STATE(WaitAddr)
// binkp_send_control(MM_NUL,"OPT MB"); // binkp_send_control(MM_NUL,"OPT MB");
// bp.MBflag = Active; // 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.zone = remote->addr->zone;
history.aka.net = remote->addr->net; 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; long txpos = 0, rxpos = 0, stxpos = 0, written;
int sverr, cmd = FALSE, GotFrame = FALSE, blklen = 0, c, Found = FALSE; int sverr, cmd = FALSE, GotFrame = FALSE, blklen = 0, c, Found = FALSE;
unsigned short header = 0; unsigned short header = 0;
unsigned long rxcrc = 0;
off_t rxbytes; off_t rxbytes;
binkp_list *bll = NULL, *tmp, *tmpg, *cursend = NULL; binkp_list *bll = NULL, *tmp, *tmpg, *cursend = NULL;
file_list *tsl; file_list *tsl;
@ -1248,8 +1176,6 @@ int binkp_batch(file_list *to_send)
txtvstart.tv_sec = txtvstart.tv_usec = 0; txtvstart.tv_sec = txtvstart.tv_usec = 0;
txtvend.tv_sec = txtvend.tv_usec = 0; txtvend.tv_sec = txtvend.tv_usec = 0;
tz.tz_minuteswest = tz.tz_dsttime = 0; tz.tz_minuteswest = tz.tz_dsttime = 0;
bp.rcrc = 0;
bp.tcrc = 0;
batchnr++; batchnr++;
Syslog('+', "Binkp: starting batch %d", 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)) { while ((bp.RxState != RxDone) || (bp.TxState != TxDone)) {
Nopper(); Nopper();
Syslog('-', "read state %d", read_state);
if (binkp_expired()) { if (binkp_expired()) {
Syslog('!', "Binkp: Transfer timeout"); Syslog('!', "Binkp: Transfer timeout");
Syslog('b', "Binkp: TxState=%s, RxState=%s, rxlen=%d", txstate[bp.TxState], rxstate[bp.RxState], rxlen); 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_start = 0L;
txflock.l_len = 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"); txfp = fopen(tmp->local, "r");
if (txfp == NULL) { if (txfp == NULL) {
sverr = errno; sverr = errno;
@ -1378,15 +1297,9 @@ int binkp_batch(file_list *to_send)
txpos = stxpos = tmp->offset; txpos = stxpos = tmp->offset;
Syslog('+', "Binkp: send \"%s\" as \"%s\"", MBSE_SS(tmp->local), MBSE_SS(tmp->remote)); 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)); 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), binkp_send_control(MM_FILE, "%s %lu %ld %ld", MBSE_SS(tmp->remote),
(unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset); (unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset);
}
gettimeofday(&txtvstart, &tz); gettimeofday(&txtvstart, &tz);
tmp->state = Sending; tmp->state = Sending;
cursend = tmp; cursend = tmp;
@ -1542,16 +1455,11 @@ int binkp_batch(file_list *to_send)
case MM_FILE: Syslog('b', "Binkp: got FILE: %s", rxbuf+1); case MM_FILE: Syslog('b', "Binkp: got FILE: %s", rxbuf+1);
if ((bp.RxState == RxWaitFile) || (bp.RxState == RxEndOfBatch)) { if ((bp.RxState == RxWaitFile) || (bp.RxState == RxEndOfBatch)) {
bp.RxState = RxAcceptFile; bp.RxState = RxAcceptFile;
if (strlen(rxbuf) < 512) {
/* /*
* Check against buffer overflow * Check against buffer overflow
*/ */
bp.rcrc = 0; if (strlen(rxbuf) < 512) {
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 { } else {
Syslog('+', "Binkp: got corrupted FILE frame, size %d bytes", strlen(rxbuf)); 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 (blklen) {
if (bp.RxState == RxReceData) { if (bp.RxState == RxReceData) {
written = fwrite(rxbuf, 1, blklen, rxfp); written = fwrite(rxbuf, 1, blklen, rxfp);
if (bp.CRCflag == Active)
rxcrc = upd_crc32(rxbuf, rxcrc, blklen);
if (!written && blklen) { if (!written && blklen) {
Syslog('+', "Binkp: file write error"); Syslog('+', "Binkp: file write error");
bp.RxState = RxDone; bp.RxState = RxDone;
@ -1575,31 +1481,8 @@ int binkp_batch(file_list *to_send)
rxpos += written; rxpos += written;
if (rxpos == bp.rsize) { if (rxpos == bp.rsize) {
bp.RxState = RxWaitFile; 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); binkp_send_control(MM_GOT, "%s %ld %ld", bp.rname, bp.rsize, bp.rtime);
closefile(); closefile();
}
rxpos = rxpos - rxbytes; rxpos = rxpos - rxbytes;
gettimeofday(&rxtvend, &tz); gettimeofday(&rxtvend, &tz);
Syslog('+', "Binkp: %s %s", rxerror?"ERROR":"OK", transfertime(rxtvstart, rxtvend, rxpos, FALSE)); Syslog('+', "Binkp: %s %s", rxerror?"ERROR":"OK", transfertime(rxtvstart, rxtvend, rxpos, FALSE));
@ -1632,12 +1515,7 @@ int binkp_batch(file_list *to_send)
break; break;
case RxAcceptFile: case RxAcceptFile:
if (bp.CRCflag == Active) 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 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);
(void)binkp2unix(bp.rname); (void)binkp2unix(bp.rname);
rxfp = openfile(binkp2unix(bp.rname), bp.rtime, bp.rsize, &rxbytes, resync); 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); gettimeofday(&rxtvstart, &tz);
rxpos = bp.roffs; 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; rxerror = FALSE;
if (!diskfree(CFG.freespace)) { if (!diskfree(CFG.freespace)) {
@ -1689,9 +1559,6 @@ int binkp_batch(file_list *to_send)
* be deleted at the remote. * be deleted at the remote.
*/ */
Syslog('+', "Binkp: already got %s, sending GOT", bp.rname); 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; bp.RxState = RxWaitFile;
rxfp = NULL; rxfp = NULL;
@ -1700,9 +1567,6 @@ int binkp_batch(file_list *to_send)
* Some error, request to skip it * Some error, request to skip it
*/ */
Syslog('+', "Binkp: error file %s, sending SKIP", bp.rname); 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; bp.RxState = RxWaitFile;
} else { } else {

View File

@ -59,7 +59,7 @@ extern char *forcedphone;
extern char *forcedline; extern char *forcedline;
extern char *inetaddr; extern char *inetaddr;
extern char *protocol; extern char *protocol;
extern pid_t mypid;
int portopen(faddr *addr) int portopen(faddr *addr)
@ -71,7 +71,7 @@ int portopen(faddr *addr)
Syslog('d', "portopen inetaddr %s", inetaddr); Syslog('d', "portopen inetaddr %s", inetaddr);
if ((rc = opentcp(inetaddr))) { if ((rc = opentcp(inetaddr))) {
Syslog('+', "Cannot connect %s", inetaddr); Syslog('+', "Cannot connect %s", inetaddr);
nodeulock(addr); nodeulock(addr, mypid);
return MBERR_NO_CONNECTION; return MBERR_NO_CONNECTION;
} }
return MBERR_OK; return MBERR_OK;
@ -85,13 +85,13 @@ int portopen(faddr *addr)
if (load_port(p)) { if (load_port(p)) {
if ((rc = openport(p, ttyinfo.portspeed))) { if ((rc = openport(p, ttyinfo.portspeed))) {
Syslog('+', "Cannot open port %s",p); Syslog('+', "Cannot open port %s",p);
nodeulock(addr); nodeulock(addr, mypid);
putstatus(addr, 10, MBERR_PORTERROR); putstatus(addr, 10, MBERR_PORTERROR);
return MBERR_PORTERROR; return MBERR_PORTERROR;
} }
return MBERR_OK; return MBERR_OK;
} else { } else {
nodeulock(addr); nodeulock(addr, mypid);
putstatus(addr, 0, MBERR_PORTERROR); putstatus(addr, 0, MBERR_PORTERROR);
return MBERR_PORTERROR; return MBERR_PORTERROR;
} }
@ -118,7 +118,7 @@ int call(faddr *addr)
* First check if node is locked, if not lock it immediatly * First check if node is locked, if not lock it immediatly
* or stop further waste of time and logfile space. * or stop further waste of time and logfile space.
*/ */
if (nodelock(addr)) { if (nodelock(addr, mypid)) {
Syslog('+', "System %s is locked", ascfnode(addr, 0x1f)); Syslog('+', "System %s is locked", ascfnode(addr, 0x1f));
putstatus(addr, 0, MBERR_NODE_LOCKED); putstatus(addr, 0, MBERR_NODE_LOCKED);
return MBERR_NODE_LOCKED; return MBERR_NODE_LOCKED;
@ -127,7 +127,7 @@ int call(faddr *addr)
if ((nlent = getnlent(addr)) == NULL) { if ((nlent = getnlent(addr)) == NULL) {
WriteError("Cannot call %s: fatal in nodelist lookup", ascfnode(addr, 0x1f)); WriteError("Cannot call %s: fatal in nodelist lookup", ascfnode(addr, 0x1f));
putstatus(addr,0,MBERR_NODE_NOT_IN_LIST); putstatus(addr,0,MBERR_NODE_NOT_IN_LIST);
nodeulock(addr); nodeulock(addr, mypid);
return MBERR_NODE_NOT_IN_LIST; return MBERR_NODE_NOT_IN_LIST;
} }
@ -190,7 +190,7 @@ int call(faddr *addr)
WriteError("No IP address, abort call"); WriteError("No IP address, abort call");
rc = MBERR_NO_IP_ADDRESS; rc = MBERR_NO_IP_ADDRESS;
putstatus(addr, 10, rc); putstatus(addr, 10, rc);
nodeulock(addr); nodeulock(addr, mypid);
return rc; return rc;
} }
} else { } else {
@ -228,7 +228,7 @@ int call(faddr *addr)
if ((rc == MBERR_OK) && (forcedphone)) { if ((rc == MBERR_OK) && (forcedphone)) {
if ((rc = dialphone(forcedphone))) { if ((rc = dialphone(forcedphone))) {
Syslog('+', "Dial failed"); 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)); Syslog('+', "Cannot call %s (%s)", ascfnode(addr,0x1f), MBSE_SS(nlent->name));
rc = MBERR_NO_CONNECTION; rc = MBERR_NO_CONNECTION;
putstatus(addr, 10, rc); putstatus(addr, 10, rc);
nodeulock(addr); nodeulock(addr, mypid);
return rc; return rc;
} }

View File

@ -46,6 +46,7 @@
extern int Loaded; extern int Loaded;
extern int mypid;
char *emsiencode(char *s) char *emsiencode(char *s)
@ -371,7 +372,7 @@ int scanemsidat(char *buf)
for (tmpa = remote; tmpa; tmpa = tmpa->next) { for (tmpa = remote; tmpa; tmpa = tmpa->next) {
Syslog('+', "address : %s",ascfnode(tmpa->addr,0x1f)); 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 * With the loaded flag we prevent removing the noderecord
* when the remote presents us an address we don't know about. * when the remote presents us an address we don't know about.

View File

@ -433,7 +433,7 @@ SM_STATE(scan_packet)
(*tmpl)->addr->name=NULL; (*tmpl)->addr->name=NULL;
(*tmpl)->addr->domain=NULL; (*tmpl)->addr->domain=NULL;
for (tmpl=&remote;*tmpl;tmpl=&((*tmpl)->next)) { for (tmpl=&remote;*tmpl;tmpl=&((*tmpl)->next)) {
(void)nodelock((*tmpl)->addr); (void)nodelock((*tmpl)->addr, mypid);
/* try lock all remotes, ignore locking result */ /* try lock all remotes, ignore locking result */
if (!Loaded) if (!Loaded)
if (noderecord((*tmpl)->addr)) if (noderecord((*tmpl)->addr))

View File

@ -3,12 +3,6 @@
/* $Id$ */ /* $Id$ */
/*
* Global threads for mbcico
*/
#define NUM_THREADS 4
pthread_t threads[NUM_THREADS];
void usage(void); void usage(void);
void free_mem(void); void free_mem(void);

View File

@ -51,6 +51,7 @@
extern int tcp_mode; extern int tcp_mode;
extern pid_t mypid;
node *nlent; 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. * 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. * If successfull session, reset all status records.
*/ */

View File

@ -171,7 +171,7 @@ static int tty_read(char *buf, int size, int tot)
fd_set readfds, writefds, exceptfds; fd_set readfds, writefds, exceptfds;
struct timeval seltimer; struct timeval seltimer;
Syslog('t', "tty_read(buf, %d, %d)", size, tot); // Syslog('t', "tty_read(buf, %d, %d)", size, tot);
if (size == 0) if (size == 0)
return 0; return 0;

View File

@ -577,7 +577,7 @@ int checkhello(void)
} }
for (tmpn = remote; tmpn; tmpn = tmpn->next) { for (tmpn = remote; tmpn; tmpn = tmpn->next) {
(void)nodelock(tmpn->addr); (void)nodelock(tmpn->addr, mypid);
/* /*
* lock all remotes, ignore locking result * lock all remotes, ignore locking result
*/ */

View File

@ -48,6 +48,7 @@ static char *dow[] = {(char *)"su", (char *)"mo", (char *)"tu", (char *)"we",
extern int do_quiet; extern int do_quiet;
extern int flushed; extern int flushed;
extern pid_t mypid;
/* /*
@ -167,7 +168,7 @@ void flush_dir(char *ndir)
} }
} }
} else { } else {
if (nodelock(&noden)) { if (nodelock(&noden, mypid)) {
Syslog('+', "Mail and files stay in queue, will be added later"); Syslog('+', "Mail and files stay in queue, will be added later");
if (noden.domain) if (noden.domain)
free(noden.domain); free(noden.domain);
@ -250,7 +251,7 @@ void flush_dir(char *ndir)
if (nodes.Session_out == S_DIR) if (nodes.Session_out == S_DIR)
remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p'); remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p');
else else
nodeulock(&noden); nodeulock(&noden, mypid);
if (noden.domain) if (noden.domain)
free(noden.domain); free(noden.domain);
return; return;
@ -425,7 +426,7 @@ void flush_dir(char *ndir)
if (nodes.Session_out == S_DIR) if (nodes.Session_out == S_DIR)
remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p'); remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p');
else else
nodeulock(&noden); nodeulock(&noden, mypid);
if (noden.domain) if (noden.domain)
free(noden.domain); free(noden.domain);
return; return;
@ -592,7 +593,7 @@ void flush_dir(char *ndir)
if (nodes.Session_out == S_DIR) if (nodes.Session_out == S_DIR)
remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p'); remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p');
else else
nodeulock(&noden); nodeulock(&noden, mypid);
if (noden.domain) if (noden.domain)
free(noden.domain); free(noden.domain);

View File

@ -1227,18 +1227,17 @@ void s_mailer(void)
mvprintw(16, 2, "10. No EMSI session"); mvprintw(16, 2, "10. No EMSI session");
mvprintw(17, 2, "11. No Yooho/2U2"); mvprintw(17, 2, "11. No Yooho/2U2");
mvprintw(13,31, "12. No Zmodem"); mvprintw(14,31, "12. No Zmodem");
mvprintw(14,31, "13. No Zedzap"); mvprintw(15,31, "13. No Zedzap");
mvprintw(15,31, "14. No Hydra"); mvprintw(16,31, "14. No Hydra");
mvprintw(16,31, "15. No MD5"); mvprintw(17,31, "15. No MD5");
mvprintw(17,31, "16. No CRC32");
mvprintw(12,59, "17. Phonetrans 1-10"); mvprintw(12,59, "16. Phonetrans 1-10");
mvprintw(13,59, "18. Phonetrans 11-20"); mvprintw(13,59, "17. Phonetrans 11-20");
mvprintw(14,59, "19. Phonetrans 21-30"); mvprintw(14,59, "18. Phonetrans 21-30");
mvprintw(15,59, "20. Phonetrans 31-40"); mvprintw(15,59, "19. Phonetrans 31-40");
mvprintw(16,59, "21. Max. files"); mvprintw(16,59, "20. Max. files");
mvprintw(17,59, "22. Max. MB."); mvprintw(17,59, "21. Max. MB.");
} }
@ -1293,16 +1292,15 @@ void e_mailer(void)
show_bool(16,23, CFG.NoEMSI); show_bool(16,23, CFG.NoEMSI);
show_bool(17,23, CFG.NoWazoo); show_bool(17,23, CFG.NoWazoo);
show_bool(13,52, CFG.NoZmodem); show_bool(14,52, CFG.NoZmodem);
show_bool(14,52, CFG.NoZedzap); show_bool(15,52, CFG.NoZedzap);
show_bool(15,52, CFG.NoHydra); show_bool(16,52, CFG.NoHydra);
show_bool(16,52, CFG.NoMD5); show_bool(17,52, CFG.NoMD5);
show_bool(17,52, CFG.NoCRC32);
show_int( 16,75, CFG.Req_Files); show_int( 16,75, CFG.Req_Files);
show_int( 17,75, CFG.Req_MBytes); show_int( 17,75, CFG.Req_MBytes);
switch(select_menu(22)) { switch(select_menu(21)) {
case 0: return; case 0: return;
case 1: E_LOGL(CFG.cico_loglevel, "1.14.1", s_mailer) 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") 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 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 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 12:E_BOOL(14,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 13:E_BOOL(15,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 14:E_BOOL(16,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 15:E_BOOL(17,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 17:e_trans(0, 17); break; case 16:e_trans(0, 17); break;
case 18:e_trans(10, 18); break; case 17:e_trans(10, 18); break;
case 19:e_trans(20, 19); break; case 18:e_trans(20, 19); break;
case 20:e_trans(30, 20); break; case 19:e_trans(30, 20); break;
case 21:E_INT(16,75, CFG.Req_Files, "Maximum ^files^ to request, 0 is unlimited") case 20: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 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 Zedzap %s\n", getboolean(CFG.NoZedzap));
fprintf(fp, " No Hydra %s\n", getboolean(CFG.NoHydra)); fprintf(fp, " No Hydra %s\n", getboolean(CFG.NoHydra));
fprintf(fp, " No MD5 passwords %s\n", getboolean(CFG.NoMD5)); 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 files %d\n", CFG.Req_Files);
fprintf(fp, " Max request MBytes %d\n", CFG.Req_MBytes); fprintf(fp, " Max request MBytes %d\n", CFG.Req_MBytes);

View File

@ -796,12 +796,11 @@ void SessionScreen(void)
mvprintw(17, 6, "11. No Filerequest"); mvprintw(17, 6, "11. No Filerequest");
mvprintw(18, 6, "12. Don't call"); mvprintw(18, 6, "12. Don't call");
mvprintw(13,41, "13. 8.3 names"); mvprintw(14,41, "13. 8.3 names");
mvprintw(14,41, "14. No Zmodem"); mvprintw(15,41, "14. No Zmodem");
mvprintw(15,41, "15. No Zedzap"); mvprintw(16,41, "15. No Zedzap");
mvprintw(16,41, "16. No Hydra"); mvprintw(17,41, "16. No Hydra");
mvprintw(17,41, "17. binkp CRC32"); mvprintw(18,41, "17. binkp old esc");
mvprintw(18,41, "18. binkp old esc");
} }
@ -826,14 +825,13 @@ void SessionEdit(void)
show_bool(17,26, nodes.NoFreqs); show_bool(17,26, nodes.NoFreqs);
show_bool(18,26, nodes.NoCall); show_bool(18,26, nodes.NoCall);
show_bool(13,61, nodes.FNC); show_bool(14,61, nodes.FNC);
show_bool(14,61, nodes.NoZmodem); show_bool(15,61, nodes.NoZmodem);
show_bool(15,61, nodes.NoZedzap); show_bool(16,61, nodes.NoZedzap);
show_bool(16,61, nodes.NoHydra); show_bool(17,61, nodes.NoHydra);
show_bool(17,61, nodes.CRC32);
show_bool(18,61, nodes.WrongEscape); show_bool(18,61, nodes.WrongEscape);
switch(select_menu(18)) { switch(select_menu(17)) {
case 0: return; case 0: return;
case 1: E_STR( 7,26,15, nodes.Spasswd, "The ^Session password^ for this node") 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") 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 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 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 13:E_BOOL(14,61, nodes.FNC, "Node needs ^DOS 8.3^ filenames")
case 14:E_BOOL(14,61, nodes.NoZmodem, "Disable ^Zmodem^ protocol with this node") case 14:E_BOOL(15,61, nodes.NoZmodem, "Disable ^Zmodem^ protocol with this node")
case 15:E_BOOL(15,61, nodes.NoZedzap, "Disable ^Zedzap^ protocol with this node") case 15:E_BOOL(16,61, nodes.NoZedzap, "Disable ^Zedzap^ protocol with this node")
case 16:E_BOOL(16,61, nodes.NoHydra, "Disable ^Hydra^ protocol with this node") case 16:E_BOOL(17,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 17:E_BOOL(18,61, nodes.WrongEscape, "Use the ^old escape^ for long filenames (Argus, Irex)")
case 18: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 Zmodem %s\n", getboolean(nodes.NoZmodem));
fprintf(fp, " No Zedzap %s", getboolean(nodes.NoZedzap)); fprintf(fp, " No Zedzap %s", getboolean(nodes.NoZedzap));
fprintf(fp, " No Hydra %s", getboolean(nodes.NoHydra)); fprintf(fp, " No Hydra %s", getboolean(nodes.NoHydra));
fprintf(fp, " binkp CRC32 %s\n", getboolean(nodes.CRC32)); fprintf(fp, " binkp old esc %s\n", getboolean(nodes.WrongEscape));
fprintf(fp, " binkp old esc %s", getboolean(nodes.WrongEscape));
fprintf(fp, " Mail forward %s", getboolean(nodes.MailFwd)); fprintf(fp, " Mail forward %s", getboolean(nodes.MailFwd));
fprintf(fp, " Check mailpwd %s\n", getboolean(nodes.MailPwdCheck)); fprintf(fp, " Check mailpwd %s", getboolean(nodes.MailPwdCheck));
fprintf(fp, " ARCmail comp. %s", getboolean(nodes.ARCmailCompat)); fprintf(fp, " ARCmail comp. %s\n", getboolean(nodes.ARCmailCompat));
fprintf(fp, " ACRmail a..z %s", getboolean(nodes.ARCmailAlpha)); fprintf(fp, " ACRmail a..z %s", getboolean(nodes.ARCmailAlpha));
fprintf(fp, " Send message %s\n", getboolean(nodes.Message)); fprintf(fp, " Send message %s", getboolean(nodes.Message));
fprintf(fp, " Send .TIC %s", getboolean(nodes.Tic)); fprintf(fp, " Send .TIC %s\n", getboolean(nodes.Tic));
fprintf(fp, " File forward %s", getboolean(nodes.FileFwd)); fprintf(fp, " File forward %s", getboolean(nodes.FileFwd));
fprintf(fp, " Advanced TIC %s\n", getboolean(nodes.AdvTic)); fprintf(fp, " Advanced TIC %s", getboolean(nodes.AdvTic));
fprintf(fp, " Advanded SB %s", getboolean(nodes.TIC_AdvSB)); fprintf(fp, " Advanded SB %s\n", getboolean(nodes.TIC_AdvSB));
fprintf(fp, " Sent To lines %s", getboolean(nodes.TIC_To)); fprintf(fp, " Sent To lines %s", getboolean(nodes.TIC_To));
fprintf(fp, " Billing %s\n", getboolean(nodes.Billing)); fprintf(fp, " Billing %s", getboolean(nodes.Billing));
fprintf(fp, " Bill direct %s", getboolean(nodes.BillDirect)); fprintf(fp, " Bill direct %s\n", getboolean(nodes.BillDirect));
fprintf(fp, " Uplink add + %s\n", getboolean(nodes.AddPlus)); fprintf(fp, " Uplink add + %s", getboolean(nodes.AddPlus));
fprintf(fp, " Security flags %s\n\n", getflag(nodes.Security.flags, nodes.Security.notflags)); 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)); fprintf(fp, " Outb session %s\n", get_sessiontype(nodes.Session_out));