Compare commits
6
Commits
7fd0d85557
..
0.26
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fb8e32a9b | ||
|
|
235a6a3072 | ||
|
|
4da486264b | ||
|
|
25cfb143dc | ||
|
|
4e86852c41 | ||
|
|
324b11aad7 |
@@ -270,3 +270,6 @@ Alexey Khromov (zx@zxalexis.ru)
|
||||
+ Added flags for TIC files (inctic_flag) and files (incfile_flag)
|
||||
+ Fixed nodelist index creation
|
||||
+ Added support for TCP port description in IBN/IFC/ITN flags
|
||||
|
||||
0.26
|
||||
+ Fixed incorrect binkp protocol realization in unprotected sessions.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
0.25.3
|
||||
0.26
|
||||
|
||||
+36
-10
@@ -95,12 +95,12 @@ int binkp_loop(s_binkp_state *bstate) {
|
||||
bstate->emptyloop = 0;
|
||||
bstate->continuesend = false;
|
||||
|
||||
unsigned short read_pos=0;
|
||||
unsigned short read_blklen=0;
|
||||
unsigned short want_read=BINKP_HEADER;
|
||||
uint16_t read_pos=0;
|
||||
uint16_t read_blklen=0;
|
||||
uint16_t want_read=BINKP_HEADER;
|
||||
|
||||
unsigned short write_pos=0;
|
||||
unsigned short have_to_write=0;
|
||||
uint16_t write_pos=0;
|
||||
uint16_t have_to_write=0;
|
||||
|
||||
int n, m;
|
||||
bool no_more_to_send = false;
|
||||
@@ -140,6 +140,7 @@ int binkp_loop(s_binkp_state *bstate) {
|
||||
return PRC_ERROR;
|
||||
}
|
||||
writebuf[1] = block_length&0xff;
|
||||
// TODO: FIX unprotected mode
|
||||
if (bstate->mode==bmode_transfer && bstate->remote_data->options&BINKP_OPT_CRYPT)
|
||||
encrypt_buf(writebuf, have_to_write, bstate->remote_data->keys_out);
|
||||
}
|
||||
@@ -209,15 +210,19 @@ int binkp_loop(s_binkp_state *bstate) {
|
||||
log("read: remote socket shutdown");
|
||||
return PRC_REMOTEABORTED;
|
||||
}
|
||||
if (bstate->mode==bmode_transfer && bstate->remote_data->options & BINKP_OPT_CRYPT)
|
||||
// TODO: FIX unprotected mode
|
||||
if (bstate->mode==bmode_transfer && bstate->remote_data->options & BINKP_OPT_CRYPT) {
|
||||
decrypt_buf(readbuf+read_pos, n, bstate->remote_data->keys_in);
|
||||
} else {
|
||||
DEB((D_24554,"binkp: not encripted transfer"));
|
||||
};
|
||||
DEB((D_24554, "got %d bytes", n));
|
||||
want_read -= n;
|
||||
read_pos += n;
|
||||
if (read_pos == BINKP_HEADER) {
|
||||
// have read header, want read body
|
||||
DEB((D_24554, "it should be 0: %d", want_read));
|
||||
want_read = ((unsigned short)(readbuf[0]&0x7F)<<8) | readbuf[1];
|
||||
want_read = ((uint16_t)(readbuf[0]&0x7F)<<8) | (uint16_t)readbuf[1];
|
||||
DEB((D_24554, "got block header, block length %u", want_read));
|
||||
} // no else here: if want_read may be zero here for zero length block
|
||||
}
|
||||
@@ -420,6 +425,7 @@ case 7:
|
||||
// seems not to remove files from inbound until successful session end is enough to eliminate dupes
|
||||
// if (!nodelist_checkflag (state.node.flags, "ND"))
|
||||
// strcat(buf+1, " ND");
|
||||
// TODO: add GZ BZ2 and maybe EXTCMD
|
||||
*block_length = 1 + strlen(buf+1);
|
||||
DEB((D_24554, "send M_NUL %s", buf+1));
|
||||
return 1;
|
||||
@@ -517,21 +523,41 @@ case 3: // send password on outgoing or pw confirmation on incoming
|
||||
|
||||
|
||||
case 4:
|
||||
char *p;
|
||||
char pbuf[32];
|
||||
int pwset = 0;
|
||||
|
||||
if (bstate->mode==bmode_incoming_handshake) {
|
||||
DEB((D_24554, "incoming handshake is complete"));
|
||||
bstate->complete = true;
|
||||
char *p;
|
||||
char pbuf[32];
|
||||
|
||||
for (i=0;i<state.n_remoteaddr;i++)
|
||||
if( !session_get_password(state.remoteaddrs[i].addr, pbuf, sizeof(pbuf)) ){
|
||||
pwset = 1;
|
||||
init_keys(bstate->remote_data->keys_in, pbuf?pbuf:"-");
|
||||
init_keys(bstate->remote_data->keys_out, "-");
|
||||
for (p=pbuf?pbuf:"-"; *p; p++)
|
||||
update_keys(bstate->remote_data->keys_out, (int)*p);
|
||||
}
|
||||
//TODO: FIX incoming options
|
||||
}
|
||||
else {
|
||||
//TODO: Fix outgoing options
|
||||
DEB((D_24554, "outgoing handshake: everything is sent"));
|
||||
for (i=0;i<state.n_remoteaddr;i++)
|
||||
if( !session_get_password(state.remoteaddrs[i].addr, pbuf, sizeof(pbuf)) ){
|
||||
pwset = 1;
|
||||
}
|
||||
|
||||
}
|
||||
// We have password-protected link. Remote options are already set,
|
||||
// Now we determine how to CRYPT or not to CRYPT our file transfer
|
||||
// Our CRYPT flag is always sent, so if the other side have CRYPT
|
||||
// and link is password is set - The CRYPT must be
|
||||
// Literally: if we have no pass -> drop the CRYPT flag
|
||||
if ( !pwset ) {
|
||||
DEB((D_24554, "binkp handshake: password NOT set, dropping CRYPT"));
|
||||
bstate->remote_data->options &= !BINKP_OPT_CRYPT;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
@@ -1150,7 +1176,7 @@ void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer)
|
||||
}
|
||||
else
|
||||
strnxcpy(remote_data->opt, buffer+4, sizeof(remote_data->opt));
|
||||
|
||||
DEB((D_24554,"Process OPT"));
|
||||
binkp_parse_options(remote_data, buffer+4);
|
||||
}
|
||||
else if( strncmp(buffer, "VER ", 4) == 0 )
|
||||
|
||||
@@ -304,7 +304,7 @@ void binkp_set_sysinfo(s_binkp_sysinfo *binkp, s_faddr *remote_addr, bool caller
|
||||
void binkp_parse_options(s_binkp_sysinfo *binkp, char *options)
|
||||
{
|
||||
char *p, *n;
|
||||
|
||||
DEB((D_24554,"binkp: parse_options: %s", options));
|
||||
for( p = string_token(options, &n, NULL, 0); p;
|
||||
p = string_token(NULL, &n, NULL, 0) )
|
||||
{
|
||||
|
||||
@@ -481,7 +481,7 @@ int call_system_tcpip(int callwith) // only TCPIP values
|
||||
char abuf[BF_MAXADDRSTR+1];
|
||||
int rc = BFERR_NOERROR;
|
||||
char * pbuf;
|
||||
char * target;
|
||||
char * target = 0;
|
||||
int resflg;
|
||||
/*
|
||||
* Set verbal line name to "tcpip" value
|
||||
@@ -542,6 +542,7 @@ defalt:
|
||||
{
|
||||
target = strchr(p, ',');
|
||||
if ( target ) target[0] = '\0';
|
||||
target = 0;
|
||||
target = strrchr(p, ':');
|
||||
if ( target ) {
|
||||
target++;
|
||||
|
||||
Reference in New Issue
Block a user