Compare commits

..

8 Commits

8 changed files with 115 additions and 17 deletions

View File

@ -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.

57
archlinux/PKGBUILD Normal file
View File

@ -0,0 +1,57 @@
pkgname=bforce
pkgver=r235.a1c93b8
pkgrel=1
pkgdesc="binkleyforce FTN mailer"
arch=('i686' 'x86_64' 'aarch64')
url="https://prj.zxalexis.ru/gitea/zx/bforce/"
license=('GPL2')
source=(
"${pkgname}::git+https://prj.zxalexis.ru/gitea/zx/bforce.git"
)
makedepends=('git' 'gcc' 'make' 'glibc')
provides=('bforce')
build() {
cd "${srcdir}/${pkgname}/source"
./configure --prefix=/ --disable-syslog --with-owner=fido --with-group=uucp
make
}
prepare() {
cd "${pkgname}"
printf "$( pwd )\n"
}
pkgver() {
cd "$pkgname"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
package() {
cd ${pkgdir}
mkdir -p ${pkgdir}/etc
mkdir -p ${pkgdir}/usr/bin
mkdir -p ${pkgdir}/usr/local/bin
mkdir -p ${pkgdir}/usr/share/doc/bforce
mkdir -p ${pkgdir}/var/log/bforce
mkdir -p ${pkgdir}/var/spool/bforce
mkdir -p ${pkgdir}/var/spool/bforce/bt/in
mkdir -p ${pkgdir}/var/spool/bforce/bt/pin
mkdir -p ${pkgdir}/var/spool/bforce/bt/out
mkdir -p ${pkgdir}/var/spool/bforce/ndl
mkdir -p ${pkgdir}/var/spool/bforce/bforce
/usr/bin/install -c ${srcdir}/${pkgname}/source/bin/bforce ${pkgdir}/usr/bin/bforce
/usr/bin/install -c ${srcdir}/${pkgname}/source/bin/bfindex ${pkgdir}/usr/bin/bfindex
/usr/bin/install -c ${srcdir}/${pkgname}/source/bin/bfstat ${pkgdir}/usr/bin/bfstat
/usr/bin/install -c ${srcdir}/${pkgname}/source/bin/nlookup ${pkgdir}/usr/bin/nlookup
/usr/bin/install -c -m 644 ${srcdir}/${pkgname}/examples/bforce.conf ${pkgdir}/etc/bforce.conf.sample
/usr/bin/install -c -m 644 ${srcdir}/${pkgname}/examples/bforce.subst ${pkgdir}/etc/bforce.subst.sample
/usr/bin/install -c -m 644 ${srcdir}/${pkgname}/examples/bforce.passwd ${pkgdir}/etc/bforce.passwd.sample
/usr/bin/install -c -m 644 ${srcdir}/${pkgname}/examples/freq.aliases ${pkgdir}/etc/freq.aliases.sample
/usr/bin/install -c -m 644 ${srcdir}/${pkgname}/examples/freq.dirs ${pkgdir}/etc/freq.dirs.sample
/usr/bin/install -c ${srcdir}/${pkgname}/contrib/outman ${pkgdir}/usr/local/bin/outman
echo "Please, edit /usr/local/bin/outman"
cp ${srcdir}/${pkgname}/docs/* ${pkgdir}/usr/share/doc/bforce/
}
sha256sums=('SKIP')

7
archlinux/bforce.install Normal file
View File

@ -0,0 +1,7 @@
post_install() {
chmod
}
post_upgrade() {
post_install
}

View File

@ -10,10 +10,10 @@
# These files are considered legacy and are unnecessary on legacy-free
# systems.
d /run/lock 0777 root lock -
L /var/lock - - - - ../run/lock
z /run/lock 0777 root lock -
z /var/lock 0777 root lock - ../run/lock
# /run/lock/subsys is used for serializing SysV service execution, and
# hence without use on SysV-less systems.
d /run/lock/subsys 0775 root lock -
z /run/lock/subsys 0775 root lock -

View File

@ -1 +1 @@
0.25.3
0.26

View File

@ -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
}
@ -228,6 +233,7 @@ int binkp_loop(s_binkp_state *bstate) {
block_length = read_pos - BINKP_HEADER;
DEB((D_24554, "binkp: complete block is received %d %hu", block_type, block_length));
m = binkp_doreceiveblock(bstate, readbuf+BINKP_HEADER, block_type, block_length);
DEB((D_24554, "binkp: dorecieveblock result is %d", m));
if(m==1) {
DEB((D_24554, "block is successfully accepted"));
read_pos = 0;
@ -419,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;
@ -516,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;
}
@ -651,7 +678,10 @@ bstate->extracmd[0] = BPMSG_ERR; strcpy(bstate->extracmd+1, msg); bstate->extrai
int binkp_doreceiveblock(s_binkp_state *bstate, char *buf, int block_type, unsigned short block_length)
{
DEB((D_24554, "dorecieveblock_type: %d", block_type));
DEB((D_24554, "dorecieveblock_bytes: %x %x %x %x", buf[0], buf[1], buf[2], buf[3]));
switch (block_type) {
case BINKP_BLK_CMD:
if (block_length<1) {
PROTO_ERROR("Zero length command received")
@ -1146,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 )

View File

@ -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) )
{

View File

@ -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++;