21 Commits
Author SHA1 Message Date
zx 7fb8e32a9b Ver 0.26 changelog 2025-03-20 21:28:39 +03:00
zx 235a6a3072 Ver 0.26 2025-03-20 18:40:08 +03:00
zx 4da486264b Fix unprotected handshake options 2025-03-20 18:37:19 +03:00
zx 25cfb143dc fix typo 2025-03-20 12:32:11 +03:00
zx 4e86852c41 Debug for decryption in passwordless transfer 2025-03-20 12:28:07 +03:00
zx 324b11aad7 test fix for binkp sz and call entry 2025-03-19 21:17:28 +03:00
zx 7fd0d85557 Larger debug of binkp state 2025-03-19 18:56:32 +03:00
zx 0cb9a2b2cf Added Archlinux PKGBUILD 2025-03-18 23:53:39 +03:00
zx 9bc3a14dd0 Version 0.25.3 Fixes for daemon mode, flags, nodelist index 2024-07-05 11:13:12 +03:00
zx abb1153cf3 small fix 2024-07-05 09:16:24 +03:00
zx 3f9d10e467 Fixed nodelist index for root zone nodes, added support for IBN:port 2024-07-04 23:05:23 +03:00
zx 46312ebc1b Fixed flag creation, added flags inctic_flag incfile_flag 2024-07-03 22:42:20 +03:00
zx 5ef2b09861 Added systemd and xinetd service files 2024-07-02 23:28:00 +03:00
zx f72259cfe3 mFix aarch64 binkp FSM 2024-07-02 23:17:07 +03:00
zx 73a3376a3d Fixed outgoing proto detection and order - as Direct, BinkP, Ifcico, Telnet, Modem first allowed to connect. You may change this order individually by override flags 2024-07-02 21:51:58 +03:00
zx a1c93b8016 Fixed binkp read deadlock #2 on some arches (aarch64) 2024-06-22 22:56:49 +03:00
zx 34daba8a0e Fixed binkp deadlock on some arches (aarch64) 2024-06-22 21:28:07 +03:00
zx 51034e6e59 Version 0.25.2: IPv6 outgoing added 2024-06-21 23:01:58 +03:00
zx b3f2e1bfc6 Added tests for PSTN protocols, minor fixes, version 0.25.1 2024-06-09 15:29:39 +03:00
zx de81a82f43 Version 0.25. EMSI-II compliant, TZUTC fixed, protocol order for outgoing 2024-05-28 20:49:18 +03:00
zx 721fa8fdf1 Update to 0.24.2 2024-05-20 23:52:02 +03:00
22 changed files with 457 additions and 79 deletions
+16
View File
@@ -257,3 +257,19 @@ Alexey Khromov (zx@zxalexis.ru)
0.25.2
+ Adopted for outgoing IPv6 communication
0.25.3
+ Fixed IPv6 address logging in inetd connections
+ Fixed outgoing proto detection and order - as Direct, BinkP, Ifcico,
Telnet, Modem first allowed to connect. You may change this order
individually by override flags.
+ Daemon mode now tries to make outgoing tcp calls prior to modem
+ Daemon mode - fixed working time for tcp nodes (CM)
+ Fixed some x64 errors in comparisons to integers
+ Added systemd and xinetd service files to contrib folder
+ Fixed flag files creation
+ 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.
+20 -3
View File
@@ -1,10 +1,26 @@
BinkleyForce FTN mailer
-----------------------
BinkleyForce is a simple ifcico like FTN mailer. It can works via
BinkleyForce is a simple ifcico like FTN mailer. It can work via
TCP/IP as well as on modem links. Look sample configs for more
information.
Supported Features
------------------
- PSTN dial-out with EMSI-II/EMSI/YooHoo handshake
- PSTN protocols: Hydra, ZedZap, ZModem
- PSTN dial-in through mgetty
- TCP/IP dial-out through IPv4 and IPv6 networks
- TCP/IP protocols - ifcico / BinkP 1.1
- TCP/IP dial-in through xinetd/inetd
- Daemon mode for outbound queue managing
Linux 2.4.11+, FreeBSD (6+ AFAIR) compatible.
Licence
-------
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
@@ -12,8 +28,9 @@ any later version. See the COPYING file for further information.
Known Bugs
----------
- BinkD use and expect local file time at BinkP sessions, but
BinkleyForce always use UTC time (?)
- BinkleyForce has no support (yet) for multiple INA: addresses
- Can not rotate hidden lines
- Can not rotate supported IP protocols in case of failure
Bug Reports
-----------
+57
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
View File
@@ -0,0 +1,7 @@
post_install() {
chmod
}
post_upgrade() {
post_install
}
+3 -3
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 -
+92
View File
@@ -0,0 +1,92 @@
#!/bin/sh
# Directories and static values
DEFZONE=2
# Default outbound
# OUTBOUND="."
# Our AKA
# AKA="2:5030/723@fidonet"
# FLO Extension
FLOEXT="dlo"
# BFCONFIG=/opt/fidonms/etc/bforce.conf
if [ "${BFCONFIG}" == "" ]; then
BFCONF="/etc/bforce/bforce.conf"
else
BFCONF=${BFCONFIG}
fi
if [ "$1" == "" ]; then
echo "No FTN provided. Usage: mkpoll <address>"
exit 1
fi
# Address to create poll
FTNA=$1
# Outbound address
OUTB=""
if [ -f "${BFCONF}" ]; then
# We have config!
OUTB=$(grep -E "^outbound_directory" ${BFCONF} | awk '{print $2}')
else
OUTB=${OUTBOUND}
fi
#echo "FTNA: ${FTNA} OUTB: ${OUTB}"
FZONE=$(echo -n ${FTNA}| awk -F':' '{print $1}')
FNET=$(echo -n ${FTNA} | awk -F':' '{print $2}' | awk -F'/' '{ print $1 }')
FNODE=$(echo -n ${FTNA}| awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $1 }')
FPNT=$(echo -n ${FTNA} | awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $2 }')
FDOM=$(echo -n ${FTNA} | awk -F'@' '{print $2}')
# echo "Dest ZONE: ${FZONE}, NET: ${FNET}, NODE: ${FNODE}, PNT: ${FPNT} DOM: ${FDOM}"
# Our AKA
FAKA=""
if [ -f "${BFCONF}" ]; then
# We have config!
FAKA=$(grep -E "^address" ${BFCONF} | awk '{print $2}')
else
FAKA=${AKA}
fi
AZONE=$(echo -n ${FAKA}| awk -F':' '{print $1}')
ANET=$(echo -n ${FAKA} | awk -F':' '{print $2}' | awk -F'/' '{ print $1 }')
ANODE=$(echo -n ${FAKA}| awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $1 }')
APNT=$(echo -n ${FAKA} | awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $2 }')
ADOM=$(echo -n ${FAKA} | awk -F'@' '{print $2}')
# echo "Our ZONE: ${AZONE}, NET: ${ANET}, NODE: ${ANODE}, PNT: ${APNT} DOM: ${ADOM}"
FTNB=$( printf "%04x%04x" ${FNET} ${FNODE} )
if [ "${FPNT}" == "" ]; then
FPNT="0"
fi
FFLO=""
if [ "${AZONE}" == "${FZONE}" ] && [ "${FNET}" == "${ANET}" ] && [ "${FNODE}" == "${ANODE}" ] && [ ! "${FPNT}" == "0" ]; then
# echo "Point operations!"
FLOFIL=$( printf "%08x.${FLOEXT}" ${FPNT} )
PNTDIR=$( echo -n "${OUTB}/${FTNB}.pnt")
FFLO=$( echo -n "${PNTDIR}/${FLOFIL}" )
elif [ ! "${DEFZONE}" == "${FZONE}" ]; then
# Interzonal poll
FLOFIL=$( echo -n "${FTNB}.${FLOEXT}" )
FDIR=$( printf "%03x" ${FZONE} )
FFLO=$( echo -n "${OUTB}.${FDIR}/${FLOFIL}" )
else
# Normal in-zone poll
FLOFIL=$( echo -n "${FTNB}.${FLOEXT}" )
FFLO=$( echo -n "${OUTB}/${FLOFIL}" )
fi
# echo "FloFile: ${FFLO}"
if [ ! -f "${FFLO}" ]; then
touch "${FFLO}"
fi
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=Binkleyforce Outbound server
[Service]
Type=forking
PIDFile=/tmp/bforce.pid
User=fido
Group=fido
ExecStart=/usr/bin/bforce -d -C /opt/fidonms/etc/bforce.conf
ExecStop=/usr/bin/bforce -q
[Install]
WantedBy=multi-user.target
+13
View File
@@ -0,0 +1,13 @@
#binkleyforce ifc (port 60179) EMSI-over-ip
service binkp
{
disable = no
socket_type = stream
# flags = IPv4
protocol = tcp
port = 24554
wait = no
user = fido
server = /usr/bin/bforce
server_args = -C /opt/fidonms/etc/bforce.conf -i binkp
}
+13
View File
@@ -0,0 +1,13 @@
#binkleyforce ifc (port 60179) EMSI-over-ip
service ifc
{
disable = no
socket_type = stream
# flags = IPv4
protocol = tcp
port = 60179
wait = no
user = fido
server = /usr/bin/bforce
server_args = -C /opt/fidonms/etc/bforce.conf -i auto
}
+5
View File
@@ -103,6 +103,11 @@ nodial_flag /etc/nodial
#incnet_flag /var/spool/fido/flags/mail
# Arcmail:
#incarc_flag /var/spool/fido/flags/echo
# FileEcho TIC
#inctic_flag /var/spool/fido/flags/tick
# Regular file recieve
#incfile_flag /var/spool/fido/flags/alert
#
# Inbound directories
+1 -1
View File
@@ -1 +1 @@
0.25.3
0.26
+2
View File
@@ -100,6 +100,8 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = {
CONF_KEY(freq_srif_command, CT_STRING),
CONF_KEY(incnet_flag, CT_STRING),
CONF_KEY(incarc_flag, CT_STRING),
CONF_KEY(inctic_flag, CT_STRING),
CONF_KEY(incfile_flag, CT_STRING),
CONF_KEY(hide_our_aka, CT_ADDRESS),
CONF_KEY(history_file, CT_STRING),
CONF_KEY(hydra_options, CT_OPTIONS),
+2 -2
View File
@@ -1050,13 +1050,13 @@ int daemon_run(const char *confname, const char *incname, bool quit)
if( max_tcpip > 0 )
{
DEB((D_INFO,"daemon: daemon_tcpip_queue"));
DEB((D_DAEMON,"daemon: daemon_tcpip_queue"));
daemon_queue_do(&daemon_queues[TCPIP_QUEUE]);
}
if( max_modem > 0 )
{
DEB((D_INFO,"daemon: daemon_modem_queue"));
DEB((D_DAEMON,"daemon: daemon_modem_queue"));
daemon_queue_do(&daemon_queues[MODEM_QUEUE]);
}
+8
View File
@@ -31,6 +31,7 @@ int out_filetype(const char *fname)
else
p_nam = fname;
DEB((D_EVENT, "outb_fsqueue: getting type of file %s", p_nam));
/*
* Get file name extension
*/
@@ -39,12 +40,19 @@ int out_filetype(const char *fname)
for( i = 0; outtab[i].ext; i++ )
if( strcasemask(p_ext, outtab[i].ext) == 0 )
{
DEB((D_EVENT, "outb_fsqueue: got type %d from outtab ext %s", outtab[i].type, p_ext ));
return outtab[i].type;
}
for( i = 0; exttab[i].ext; i++ )
if( strcasemask(p_ext, exttab[i].ext) == 0 )
{
DEB((D_EVENT, "outb_fsqueue: got type %d from exttab ext %s", exttab[i].type, p_ext ));
return exttab[i].type;
}
DEB((D_EVENT, "outb_fsqueue: got type UNKNOWN", exttab[i].type, p_ext ));
return TYPE_UNKNOWN;
}
+74 -38
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,27 +523,47 @@ 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;
}
}
else if (bstate->mode == bmode_transfer) {
else if (bstate->mode == bmode_transfer) {
switch (bstate->phase) {
send_next_file:
@@ -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")
@@ -740,7 +770,7 @@ case BPMSG_PWD: /* Session password */
/* Do authorization */
if( binkp_auth_incoming(bstate->remote_data) ) {
log("error: invalid password");
if( bstate->extracmd[0] !=-1 ) return 0; // suspend if extra is occupied
if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend if extra is occupied
bstate->extracmd[0] = BPMSG_ERR;
strcpy(bstate->extracmd+1, "Security violation");
bstate->extraislast = true;
@@ -749,7 +779,7 @@ case BPMSG_PWD: /* Session password */
// lock addresses
if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) ) {
log("error locking addresses of the remote");
if( bstate->extracmd[0] !=-1 ) return 0; // suspend if extra is occupied
if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend if extra is occupied
bstate->extracmd[0] = BPMSG_BSY;
strcpy(bstate->extracmd+1, "All addresses are busy");
bstate->extraislast = true;
@@ -770,6 +800,7 @@ case BPMSG_FILE: /* File information */
s_bpfinfo recvfi;
if( binkp_parsfinfo(buf+1, &recvfi, true) ) {
log ("M_FILE parse error: %s", buf + 1);
DEB((D_24554, "M_FILE parse error: %s", buf + 1 ));
PROTO_ERROR("invalid M_FILE");
}
bstate->batch_recv_count += 1;
@@ -786,7 +817,7 @@ case BPMSG_FILE: /* File information */
return 1;
}
DEB((D_24554, "no, skipping; TODO: accept it"));
if( bstate->extracmd[0] != -1 ) return 0;
if( bstate->extracmd[0] != (char)-1 ) return 0;
bstate->extracmd[0] = BPMSG_SKIP;
sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm, recvfi.offs);
bstate->extraislast = false;
@@ -798,7 +829,7 @@ case BPMSG_FILE: /* File information */
PROTO_ERROR("invalid mode for M_FILE");
}
if( bstate->extracmd[0] != -1 ) return 0;
if( bstate->extracmd[0] != (char)-1 ) return 0;
switch(p_rx_fopen(bstate->pi, recvfi.fn, recvfi.sz, recvfi.tm, 0)) {
case 0:
if (bstate->pi->recv->bytes_skipped == recvfi.offs) {
@@ -1051,7 +1082,7 @@ case BINKP_BLK_DATA:
if( n < 0 ) {
log("error writing local file");
if( n == -2 ) {
if( n == (long int)-2 ) {
bstate->extracmd[0] = BPMSG_GOT;
sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
(long)bstate->pi->recv->mod_time);
@@ -1080,28 +1111,33 @@ case BINKP_BLK_DATA:
p_rx_fclose(bstate->pi);
PROTO_ERROR("extra data for file")
}
else if( bstate->pi->recv->bytes_received == bstate->pi->recv->bytes_total ) {
DEB((D_24554, "receive completed"));
bstate->frs = frs_nothing;
bstate->pi->recv->status = FSTAT_SUCCESS;
if( !p_rx_fclose(bstate->pi) ) {
bstate->extracmd[0] = BPMSG_GOT;
sprintf(bstate->extracmd+1, "%s %ld %ld",
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
(long)bstate->pi->recv->mod_time);
bstate->extraislast = false;
return 1;
}
else {
DEB((D_24554, "some error committing file"));
bstate->extracmd[0] = BPMSG_SKIP;
sprintf(bstate->extracmd+1, "%s %ld %ld",
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
(long)bstate->pi->recv->mod_time);
bstate->extraislast = false;
return 1;
}
} else {
else if( bstate->pi->recv->bytes_received == bstate->pi->recv->bytes_total )
{
DEB((D_24554, "receive completed"));
bstate->frs = frs_nothing;
bstate->pi->recv->status = FSTAT_SUCCESS;
if( !p_rx_fclose(bstate->pi) )
{
bstate->extracmd[0] = BPMSG_GOT;
sprintf(bstate->extracmd+1, "%s %ld %ld",
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
(long)bstate->pi->recv->mod_time);
bstate->extraislast = false;
return 1;
}
else
{
DEB((D_24554, "some error committing file"));
bstate->extracmd[0] = BPMSG_SKIP;
sprintf(bstate->extracmd+1, "%s %ld %ld",
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
(long)bstate->pi->recv->mod_time);
bstate->extraislast = false;
return 1;
}
}
else
{
DEB((D_24554, "data block accepted"));
return 1;
}
@@ -1140,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 )
+1 -1
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) )
{
+5
View File
@@ -415,6 +415,7 @@ int p_tx_rewind(s_protinfo *pi, size_t pos)
void prot_traffic_update(s_traffic *traf, size_t size, int xtime, int type)
{
DEB((D_EVENT, "prot_common: Adding type %d with size %ld to stats", type, size));
if( type & TYPE_REQANSW )
{
traf->freqed_size += size;
@@ -433,6 +434,10 @@ void prot_traffic_update(s_traffic *traf, size_t size, int xtime, int type)
traf->arcmail_time += xtime;
traf->arcmail_num++;
}
else if( type & TYPE_TICFILE )
{
traf->ticfile_num++;
}
else
{
traf->files_size += size;
+81 -26
View File
@@ -480,10 +480,15 @@ int call_system_tcpip(int callwith) // only TCPIP values
{
char abuf[BF_MAXADDRSTR+1];
int rc = BFERR_NOERROR;
char * pbuf;
char * target = 0;
int resflg;
/*
* Set verbal line name to "tcpip" value
*/
memset(abuf, '\0', BF_MAXADDRSTR+1);
target = xmalloc(1024);
memset(target, '\0', 1024);
state.linename = xstrcpy("tcpip");
state.inet = TRUE;
@@ -502,14 +507,17 @@ int call_system_tcpip(int callwith) // only TCPIP values
case CALL_TCPIP_BINKP:
state.tcpmode = TCPMODE_BINKP;
state.session = SESSION_BINKP;
target = xstrcpy("IBN");
break;
case CALL_TCPIP_IFCICO:
state.tcpmode = TCPMODE_RAW;
state.session = SESSION_UNKNOWN;
target = xstrcpy("IFC");
break;
case CALL_TCPIP_TELNET:
state.tcpmode = TCPMODE_TELNET;
state.session = SESSION_UNKNOWN;
target = xstrcpy("ITN");
break;
defalt:
log("invalid protocol for TCP/IP module");
@@ -520,8 +528,46 @@ defalt:
ftn_addrstr(abuf, state.node.addr),
(state.node.name && *state.node.name ) ? state.node.name : "<none>",
(state.node.host && *state.node.host) ? state.node.host : "<none>");
memset(abuf, '\0', BF_MAXADDRSTR+1);
pbuf = xmalloc(1024);
resflg = nodelist_lookup_string(pbuf, 1024, state.node.addr);
if ( ! resflg )
{
if( (rc = tcpip_connect(state.node.host, state.tcpmode)) == 0
char *p = strcasestr(pbuf, target);
if ( p )
{
target = strchr(p, ',');
if ( target ) target[0] = '\0';
target = 0;
target = strrchr(p, ':');
if ( target ) {
target++;
strcpy(abuf,target);
}
}
}
free(pbuf);
pbuf = xstrcpy(state.node.host);
if ( ! resflg )
{
if ( abuf[0] != '\0' )
{
// port not empty
DEB((D_EVENT, "Modifying host address %s with port %s", pbuf, abuf));
pbuf = xstrcat(pbuf, ":");
pbuf = xstrcat(pbuf, abuf);
}
}
if( (rc = tcpip_connect(pbuf, state.tcpmode)) == 0
&& (rc = tcpip_init() == 0) )
{
TTYSTATUS(1);
@@ -532,7 +578,7 @@ defalt:
{
rc = BFERR_CANT_CONNECT10;
}
free(pbuf);
return rc;
}
@@ -568,7 +614,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
}
state.listed = state.node.listed;
DEB((D_EVENT, "Calling init, listed=%d", state.listed));
//DEB((D_EVENT, "Calling init, listed=%d", state.listed));
state.node.addr.domain[0] = '\0'; /* Discard domain for node address */
// 1. If call method specified in cmdline, do use it
@@ -630,9 +676,9 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
call_mayuse |= call_mustuse; // it simplifies logics: all required is allowed
//char s[300];
snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
log(s);
DEB((D_EVENT, s));
//snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
//log(s);
//DEB((D_EVENT, s));
if( (call_mayuse & CALL_MODEM) )
@@ -656,7 +702,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
{
log("bad phone, excluding modem");
call_mayuse &= ~CALL_MODEM;
if( call_mustuse & CALL_MODEM )
if( !(call_mayuse) )
{
errmsg = "don't know phone number";
gotoexit(BFERR_PHONE_UNKNOWN);
@@ -690,7 +736,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
{
call_mayuse &= ~CALL_MODEM;
log("bad worktime, excluding modem");
if( call_mustuse & CALL_MODEM )
if( !(call_mayuse) )
{
errmsg = "not works now, try later";
gotoexit(BFERR_NOTWORKING);
@@ -699,9 +745,9 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
}
}
snprintf(s, 299, "after phone check: may use %d must use %d", call_mayuse, call_mustuse);
log(s);
DEB((D_EVENT, s));
//snprintf(s, 299, "after phone check: may use %d must use %d", call_mayuse, call_mustuse);
//log(s);
//DEB((D_EVENT, s));
/*
* Apply overrides to the node information
*/
@@ -720,7 +766,8 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
if( !(call_mustuse & CALL_TCPIP_BINKP) && (call_mayuse & CALL_TCPIP_BINKP) )
{
if( nodelist_checkflag(state.node.flags, "BINKP") != 0 && nodelist_checkflag(state.node.flags, "IBN") != 0 )
//if( nodelist_checkflag(state.node.flags, "BINKP") != 0 && nodelist_checkflag(state.node.flags, "IBN") != 0 )
if( state.node.do_binkp == 0 )
{
call_mayuse &= ~CALL_TCPIP_BINKP;
}
@@ -728,7 +775,8 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
if( !(call_mustuse & CALL_TCPIP_IFCICO) && (call_mayuse & CALL_TCPIP_IFCICO) )
{
if( nodelist_checkflag(state.node.flags, "IFC") != 0 && nodelist_checkflag(state.node.flags, "IFC") != 0 )
//if( nodelist_checkflag(state.node.flags, "IFC") != 0 && nodelist_checkflag(state.node.flags, "IFC") != 0 )
if( state.node.do_ifcico == 0 )
{
call_mayuse &= ~CALL_TCPIP_IFCICO;
}
@@ -736,7 +784,8 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
if( !(call_mustuse & CALL_TCPIP_TELNET) && (call_mayuse & CALL_TCPIP_TELNET) )
{
if( nodelist_checkflag(state.node.flags, "TELN") != 0 && nodelist_checkflag(state.node.flags, "TLN") != 0 )
//if( nodelist_checkflag(state.node.flags, "TELN") != 0 && nodelist_checkflag(state.node.flags, "TLN") != 0 )
if( state.node.do_telnet == 0 )
{
call_mayuse &= ~CALL_TCPIP_TELNET;
}
@@ -752,9 +801,12 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
state.override.sIpaddr, sizeof(state.node.host));
}
DEB((D_EVENT, "Calling init, IPHOST", state.node.host));
//DEB((D_EVENT, "Calling init, IPHOST", state.node.host));
if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) ) {
// We have at least one protocol and not valid address - try to
// find INA with through Fidonet DNS
if( (call_mayuse & CALL_TCPIP_ANY) && !tcpip_isgood_host(state.node.host) )
{
char *fidodnszone = conf_string(cf_fidodnszone);
if (fidodnszone) {
if (addr.point) {
@@ -769,14 +821,17 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
}
}
if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) )
// We have no valid tcpip protocols OR not valid address
if( !(call_mayuse & CALL_TCPIP_ANY) || !tcpip_isgood_host(state.node.host) )
{
call_mayuse &= ~CALL_TCPIP_ANY;
log("bad host, exclude IP");
DEB((D_EVENT, "bad host %s, exclude IP", state.node.host));
if( call_mustuse & CALL_TCPIP_ANY )
DEB((D_EVENT, "bad host or proto -> exclude IP, mayuse=%d", call_mayuse));
// If we had ONLY tcpip command - go out with error
if( !(call_mayuse) )
{
errmsg = "don't know host name";
errmsg = "Aborting, don't know host name";
gotoexit(BFERR_PHONE_UNKNOWN);
}
}
@@ -817,31 +872,31 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
// try allowed methods and break if rc == 0
rc = -1;
if( rc && call_mayuse & CALL_STDIO )
if( rc && (call_mayuse & CALL_STDIO) )
{
DEB((D_EVENT,"sess_call: calling stdio"));
rc = call_system_quiet(opts->connect, opts->inetd);
}
if( rc && call_mayuse & CALL_TCPIP_BINKP )
if( rc && (call_mayuse & CALL_TCPIP_BINKP) )
{
DEB((D_EVENT,"sess_call: calling binkp"));
rc = call_system_tcpip(CALL_TCPIP_BINKP);
}
if( rc && call_mayuse & CALL_TCPIP_IFCICO )
if( rc && (call_mayuse & CALL_TCPIP_IFCICO) )
{
DEB((D_EVENT,"sess_call: calling ifcico"));
rc = call_system_tcpip(CALL_TCPIP_IFCICO);
}
if( rc && call_mayuse & CALL_TCPIP_TELNET )
if( rc && (call_mayuse & CALL_TCPIP_TELNET) )
{
DEB((D_EVENT,"sess_call: calling telnet"));
rc = call_system_tcpip(CALL_TCPIP_TELNET);
}
if( rc && call_mayuse & CALL_MODEM )
if( rc && (call_mayuse & CALL_MODEM) )
{
DEB((D_EVENT,"sess_call: calling MODEM"));
setproctitle("bforce calling %.32s, %.32s",
+40 -4
View File
@@ -895,13 +895,22 @@ int session(void)
* Write total amount of received/sent bytes, files, etc.
*/
p_log_txrxstat(&pi);
// Protocol info - real info from protocol
DEB((D_EVENT,"sess_main: Pi stats> Net: %d, Arc: %d, Fil: %d, Tic: %d",
pi.traffic_rcvd.netmail_num, pi.traffic_rcvd.arcmail_num,
pi.traffic_rcvd.files_num, pi.traffic_rcvd.ticfile_num));
// Session info - HANDSHAKE info for traffic
DEB((D_EVENT,"sess_main: Sess stats> Net: %d, Arc: %d, Fil: %d, Tic: %d",
state.traff_recv.netmail_num, state.traff_recv.arcmail_num,
state.traff_recv.files_num, state.traff_recv.ticfile_num));
/*
* Raise flags if session incoming traffic was not empty
*/
if ( (p = conf_string(cf_incnet_flag)) )
if (state.traff_recv.netmail_size > 0) {
if (pi.traffic_rcvd.netmail_size > 0) {
DEB((D_EVENT, "Incoming netmail > 0, raising flag"));
log("Raising flag for netmail in %s", p);
fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
@@ -915,7 +924,7 @@ int session(void)
}
if ( (p = conf_string(cf_incarc_flag)) )
if (state.traff_recv.arcmail_size > 0) {
if (pi.traffic_rcvd.arcmail_size > 0) {
DEB((D_EVENT, "Incoming arcmail > 0, raising flag"));
log("Raising flag for arcmail in %s", p);
fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
@@ -928,6 +937,33 @@ int session(void)
}
}
if ( (p = conf_string(cf_inctic_flag)) )
if (pi.traffic_rcvd.ticfile_num > 0) {
DEB((D_EVENT, "Incoming TIC files > 0, raising flag"));
log("Raising flag for TIC in %s", p);
fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
if (fd == -1) {
DEB((D_EVENT, "Error raising ticfiles flag"));
log("Error creating flag for ticfiles in %s", p);
} else {
/* all ok - closing file */
close(fd);
}
}
if ( (p = conf_string(cf_incfile_flag)) )
if (pi.traffic_rcvd.files_size > 0) {
DEB((D_EVENT, "Incoming FILES > 0, raising flag"));
log("Raising flag for files in %s", p);
fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
if (fd == -1) {
DEB((D_EVENT, "Error raising files flag"));
log("Error creating flag for files in %s", p);
} else {
/* all ok - closing file */
close(fd);
}
}
/*
* Save session traffic before deiniting
*/
+1 -1
View File
@@ -127,7 +127,7 @@ static int nodelist_makeindex(s_nodelist *nlp, s_faddr addr)
switch(keyword) {
case KEYWORD_ZONE:
bni.zone = value;
bni.net = 0;
bni.net = value; // zxalexis
bni.node = 0;
bni.point = 0;
bni.hub = 0;
+2
View File
@@ -195,6 +195,8 @@ typedef enum {
cf_freq_srif_command,
cf_incnet_flag,
cf_incarc_flag,
cf_inctic_flag,
cf_incfile_flag,
cf_hide_our_aka,
cf_history_file,
cf_hydra_options,
+1
View File
@@ -44,6 +44,7 @@ typedef struct traffic {
int freqed_num;
int freqed_time;
size_t freqed_size;
int ticfile_num;
} s_traffic;
/*