binkp start for CRC support

This commit is contained in:
Michiel Broek 2002-06-16 08:58:53 +00:00
parent 899a73b4de
commit 2af1d25bdf
3 changed files with 25 additions and 6 deletions

View File

@ -21,6 +21,8 @@ v0.35.01 05-Jun-2002
mbcico:
Now uses the new session password field for session handshake.
The binkd version string now includes the OS and CPU type.
If a transmitted file via binkp is skipped by the remote it
will stay in the queue for the next session.
mbfile:
Added -v commandline switch to supress virus checking for the

3
TODO
View File

@ -143,3 +143,6 @@ mbsetup:
Fileecho groups <=> Newfile reports
Fileecho groups <=> BBS Areas
install:
U: On RedHat 7.3 the big-endian menus are installed.

View File

@ -84,6 +84,7 @@ static int MBflag = FALSE;
static int NDflag = FALSE;
static int CRYPTflag = FALSE;
static int CRAMflag = FALSE;
static int CRCflag = FALSE;
unsigned long nethold, mailhold;
int transferred = FALSE;
int batchnr = 0;
@ -368,9 +369,10 @@ void b_nul(char *msg)
NDflag = TRUE;
if (strstr(msg, (char *)"CRYPT") != NULL)
CRYPTflag = TRUE;
if (strstr(msg, (char *)"CRAM-") != NULL) {
if (strstr(msg, (char *)"CRAM-") != NULL)
CRAMflag = TRUE;
}
if (strstr(msg, (char *)"CRC") != NULL)
CRCflag = TRUE;
} else
Syslog('+', "M_NUL \"%s\"", msg);
}
@ -799,7 +801,7 @@ int binkp_batch(file_list *to_send)
int sverr, cmd = FALSE, GotFrame = FALSE;
int blklen = 0, c, Found = FALSE;
unsigned short header = 0;
char *rname, *lname, *gname;
char *rname, *lname, *gname, *rcrc;
long rsize, roffs, lsize, gsize, goffset;
time_t rtime, ltime, gtime;
off_t rxbytes;
@ -821,6 +823,7 @@ int binkp_batch(file_list *to_send)
txbuf = calloc(MAX_BLKSIZE + 3, sizeof(unsigned char));
rxbuf = calloc(MAX_BLKSIZE + 3, sizeof(unsigned char));
rname = calloc(512, sizeof(char));
rcrc = calloc(512, sizeof(char));
lname = calloc(512, sizeof(char));
gname = calloc(512, sizeof(char));
TfState = Switch;
@ -1090,7 +1093,18 @@ int binkp_batch(file_list *to_send)
case MM_FILE: if ((RxState == RxWaitFile) || (RxState == RxEndOfBatch)) {
RxState = RxAcceptFile;
Syslog('b', "MM_FILE %s", rxbuf+1);
if (strlen(rxbuf) < 512) {
/*
* Check against buffer overflow
*/
if (CRCflag)
sscanf(rxbuf+1, "%s %ld %ld %ld %s", rname, &rsize, &rtime, &roffs, rcrc);
else
sscanf(rxbuf+1, "%s %ld %ld %ld", rname, &rsize, &rtime, &roffs);
} else {
Syslog('+', "Got corrupted FILE frame, size %d bytes", strlen(rxbuf));
}
} else {
Syslog('+', "Binkp: got unexpected FILE frame %s", rxbuf+1);
}
@ -1190,8 +1204,7 @@ int binkp_batch(file_list *to_send)
execute_disposition(tsl);
} else {
for (tmp = bll; tmp; tmp = tmp->next) {
if ((strcmp(tmp->local, tsl->local) == 0) &&
((tmp->state == Got) || (tmp->state == Skipped))) {
if ((strcmp(tmp->local, tsl->local) == 0) && (tmp->state == Got)) {
execute_disposition(tsl);
}
}
@ -1210,6 +1223,7 @@ int binkp_batch(file_list *to_send)
free(txbuf);
free(rxbuf);
free(rname);
free(rcrc);
free(lname);
free(gname);
Syslog('+', "Binkp: batch %d completed rc=%d", batchnr, rc);