Compare commits
38
Commits
0.25.2
...
727f7cfdf3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
727f7cfdf3 | ||
|
|
36747d9071 | ||
|
|
9fa59cacca | ||
|
|
b66dd2156c | ||
|
|
80275d30d3 | ||
|
|
a62ae3afca | ||
|
|
a9f98cdee9 | ||
|
|
10d30223d1 | ||
|
|
c5fc6e9245 | ||
|
|
29000cfdd7 | ||
|
|
de6ef3936b | ||
|
|
8db2ee4260 | ||
|
|
25081b1bae | ||
|
|
deaa8140f5 | ||
|
|
7fb8e32a9b | ||
|
|
235a6a3072 | ||
|
|
4da486264b | ||
|
|
25cfb143dc | ||
|
|
4e86852c41 | ||
|
|
324b11aad7 | ||
|
|
7fd0d85557 | ||
|
|
0cb9a2b2cf | ||
|
|
9bc3a14dd0 | ||
|
|
abb1153cf3 | ||
|
|
3f9d10e467 | ||
|
|
46312ebc1b | ||
|
|
5ef2b09861 | ||
|
|
f72259cfe3 | ||
|
|
73a3376a3d | ||
|
|
983440fc29 | ||
|
|
5a7bac039a | ||
|
|
bba77edecd | ||
|
|
9aed37b92e | ||
|
|
3526bc5ece | ||
|
|
a1c93b8016 | ||
|
|
e6266e8eab | ||
|
|
34daba8a0e | ||
|
|
ea4e8c806f |
@@ -0,0 +1,21 @@
|
|||||||
|
name: Archlinux build
|
||||||
|
run-name: ${{ gitea.name}} building 🚀
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: arch-latest
|
||||||
|
steps:
|
||||||
|
- run: echo "🎉 The job was automatically triggered by a ${{ gitea_event_name }} event."
|
||||||
|
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||||
|
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||||
|
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||||
|
- name: List files in the repository
|
||||||
|
run: |
|
||||||
|
ls ${{ gitea.basedir }}
|
||||||
|
- run: echo "🍏 This job's status is ${{ gitea.status }}."
|
||||||
|
- run: mkdir ${{gitea.basedir}}/../build
|
||||||
|
- run: cp ${{ gitea.basedir }}/archlinux/PKGBUILD.local ${{gitea.basedir}}/../build/PKGBUILD
|
||||||
|
- run: cd ${{gitea.basedir}}/../build && ls && makepkg
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
name: Gitea Actions Demo
|
||||||
|
run-name: $ is testing out Gitea Actions 🚀
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
Explore-Gitea-Actions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: echo "🎉 The job was automatically triggered by a ${{ gitea_event_name }} event."
|
||||||
|
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||||
|
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: ischanx/checkout@v4
|
||||||
|
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||||
|
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||||
|
- name: List files in the repository
|
||||||
|
run: |
|
||||||
|
ls ${{ gitea.basedir }}
|
||||||
|
- run: echo "🍏 This job's status is ${{ gitea.status }}."
|
||||||
|
|
||||||
@@ -7,6 +7,3 @@ source/config.log
|
|||||||
source/config.status
|
source/config.status
|
||||||
source/include/config.h
|
source/include/config.h
|
||||||
bforce.geany
|
bforce.geany
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -257,3 +257,21 @@ Alexey Khromov (zx@zxalexis.ru)
|
|||||||
0.25.2
|
0.25.2
|
||||||
+ Adopted for outgoing IPv6 communication
|
+ 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.
|
||||||
|
+ Fixed binkp override appliance in incoming handshake
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,26 @@
|
|||||||
BinkleyForce FTN mailer
|
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
|
TCP/IP as well as on modem links. Look sample configs for more
|
||||||
information.
|
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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2, or (at your option)
|
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
|
Known Bugs
|
||||||
----------
|
----------
|
||||||
- BinkD use and expect local file time at BinkP sessions, but
|
- BinkleyForce has no support (yet) for multiple INA: addresses
|
||||||
BinkleyForce always use UTC time (?)
|
- Can not rotate hidden lines
|
||||||
|
- Can not rotate supported IP protocols in case of failure
|
||||||
|
|
||||||
Bug Reports
|
Bug Reports
|
||||||
-----------
|
-----------
|
||||||
|
|||||||
@@ -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')
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
post_install() {
|
||||||
|
chmod
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
post_install
|
||||||
|
}
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
# These files are considered legacy and are unnecessary on legacy-free
|
# These files are considered legacy and are unnecessary on legacy-free
|
||||||
# systems.
|
# systems.
|
||||||
|
|
||||||
d /run/lock 0777 root lock -
|
z /run/lock 0777 root lock -
|
||||||
L /var/lock - - - - ../run/lock
|
z /var/lock 0777 root lock - ../run/lock
|
||||||
|
|
||||||
# /run/lock/subsys is used for serializing SysV service execution, and
|
# /run/lock/subsys is used for serializing SysV service execution, and
|
||||||
# hence without use on SysV-less systems.
|
# hence without use on SysV-less systems.
|
||||||
|
|
||||||
d /run/lock/subsys 0775 root lock -
|
z /run/lock/subsys 0775 root lock -
|
||||||
|
|||||||
Executable
+92
@@ -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
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -103,6 +103,11 @@ nodial_flag /etc/nodial
|
|||||||
#incnet_flag /var/spool/fido/flags/mail
|
#incnet_flag /var/spool/fido/flags/mail
|
||||||
# Arcmail:
|
# Arcmail:
|
||||||
#incarc_flag /var/spool/fido/flags/echo
|
#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
|
# Inbound directories
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
0.25.2
|
0.26
|
||||||
|
|||||||
@@ -20,10 +20,14 @@ s_cval_entry *conf_first(bforce_config_keyword keyword)
|
|||||||
{
|
{
|
||||||
s_cval_entry *ptrl;
|
s_cval_entry *ptrl;
|
||||||
|
|
||||||
for( ptrl = bforce_config[keyword].data; ptrl; ptrl = ptrl->next )
|
DEB((D_CONFIG, "conf_first entry nr %d",(int16_t)keyword));
|
||||||
if( !ptrl->expr.expr || eventexpr(&ptrl->expr) )
|
|
||||||
return ptrl;
|
|
||||||
|
|
||||||
|
for( ptrl = bforce_config[keyword].data; ptrl; ptrl = ptrl->next )
|
||||||
|
if( !ptrl->expr.expr || eventexpr(&ptrl->expr) ) {
|
||||||
|
DEB((D_CONFIG, "conf_first ptrl found"));
|
||||||
|
return ptrl;
|
||||||
|
}
|
||||||
|
DEB((D_CONFIG, "conf_first ptrl not found"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,9 +36,11 @@ s_cval_entry *conf_next(s_cval_entry *ptrl)
|
|||||||
ASSERT(ptrl);
|
ASSERT(ptrl);
|
||||||
|
|
||||||
for( ptrl = ptrl->next; ptrl; ptrl = ptrl->next )
|
for( ptrl = ptrl->next; ptrl; ptrl = ptrl->next )
|
||||||
if( !ptrl->expr.expr || eventexpr(&ptrl->expr) )
|
if( !ptrl->expr.expr || eventexpr(&ptrl->expr) ) {
|
||||||
|
DEB((D_CONFIG, "conf_next ptrl found"));
|
||||||
return ptrl;
|
return ptrl;
|
||||||
|
}
|
||||||
|
DEB((D_CONFIG, "conf_next ptrl not found"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +97,7 @@ long conf_number(bforce_config_keyword keyword)
|
|||||||
s_override *conf_override(bforce_config_keyword keyword, s_faddr addr)
|
s_override *conf_override(bforce_config_keyword keyword, s_faddr addr)
|
||||||
{
|
{
|
||||||
s_cval_entry *ptrl;
|
s_cval_entry *ptrl;
|
||||||
|
DEB((D_CONFIG, "conf_override entry"));
|
||||||
for( ptrl = conf_first(keyword); ptrl; ptrl = conf_next(ptrl) )
|
for( ptrl = conf_first(keyword); ptrl; ptrl = conf_next(ptrl) )
|
||||||
if( !ftn_addrcomp(ptrl->d.override.addr, addr) )
|
if( !ftn_addrcomp(ptrl->d.override.addr, addr) )
|
||||||
return &ptrl->d.override;
|
return &ptrl->d.override;
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = {
|
|||||||
CONF_KEY(freq_srif_command, CT_STRING),
|
CONF_KEY(freq_srif_command, CT_STRING),
|
||||||
CONF_KEY(incnet_flag, CT_STRING),
|
CONF_KEY(incnet_flag, CT_STRING),
|
||||||
CONF_KEY(incarc_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(hide_our_aka, CT_ADDRESS),
|
||||||
CONF_KEY(history_file, CT_STRING),
|
CONF_KEY(history_file, CT_STRING),
|
||||||
CONF_KEY(hydra_options, CT_OPTIONS),
|
CONF_KEY(hydra_options, CT_OPTIONS),
|
||||||
|
|||||||
+49
-4
@@ -178,7 +178,7 @@ static int daemon_sysentry_deinit(s_sysentry *sysent)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
|
static int daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
|
||||||
{
|
{
|
||||||
bool good_phone = FALSE;
|
bool good_phone = FALSE;
|
||||||
bool good_host = FALSE;
|
bool good_host = FALSE;
|
||||||
@@ -208,6 +208,11 @@ static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
|
|||||||
if( tcpip_isgood_host(ovrd->sIpaddr) )
|
if( tcpip_isgood_host(ovrd->sIpaddr) )
|
||||||
good_host = TRUE;
|
good_host = TRUE;
|
||||||
}
|
}
|
||||||
|
else if ( node && *node->host )
|
||||||
|
{
|
||||||
|
if( tcpip_isgood_host(node->host) )
|
||||||
|
good_host = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check work time
|
* Check work time
|
||||||
@@ -231,6 +236,16 @@ static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
|
|||||||
good_time = TRUE;
|
good_time = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Must be more complicated, i.e. call to IP even if modem is not good time
|
||||||
|
if ( good_host )
|
||||||
|
{
|
||||||
|
good_time = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEB((D_DAEMON, "daemon: node_cancall_line good_phone: %d, good_time:%d, good_host:%d",
|
||||||
|
good_phone, good_time, good_host));
|
||||||
|
|
||||||
if( good_time )
|
if( good_time )
|
||||||
{
|
{
|
||||||
if( good_host )
|
if( good_host )
|
||||||
@@ -323,9 +338,23 @@ static bool daemon_node_cancall(s_sysentry *syst, bool ign_wtime, bool tcpip)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make check for tcpip out */
|
||||||
|
if ( tcpip )
|
||||||
|
{
|
||||||
|
rc = daemon_node_cancall_line(&syst->node, NULL);
|
||||||
|
DEB((D_DAEMON, "daemon tcpip: node_cancall rc=%d", rc));
|
||||||
|
if ( rc == 2 )
|
||||||
|
{
|
||||||
|
syst->tcpip = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Make checks for all lines */
|
/* Make checks for all lines */
|
||||||
if( syst->overrides )
|
if( syst->overrides )
|
||||||
{
|
{
|
||||||
|
DEB((D_DAEMON, "daemon: node_cancall OVR-IN"));
|
||||||
if( syst->lineptr && syst->lineptr->hidden )
|
if( syst->lineptr && syst->lineptr->hidden )
|
||||||
{
|
{
|
||||||
line = syst->line + 1;
|
line = syst->line + 1;
|
||||||
@@ -363,11 +392,18 @@ static bool daemon_node_cancall(s_sysentry *syst, bool ign_wtime, bool tcpip)
|
|||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else /* Node without overriden parameters */
|
else /* Node without overriden parameters */
|
||||||
{
|
{
|
||||||
syst->line = line = 0;
|
syst->line = line = 0;
|
||||||
return daemon_node_cancall_line(&syst->node, NULL);
|
rc = daemon_node_cancall_line(&syst->node, NULL);
|
||||||
|
DEB((D_DAEMON, "daemon: node_cancall rc=%d", rc));
|
||||||
|
if ( rc )
|
||||||
|
{
|
||||||
|
syst->tcpip = (rc == 2) ? TRUE : FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -687,6 +723,8 @@ int daemon_rescan_sysqueue(s_sysqueue *q, s_daemon_queue dqs[])
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
log_sysqueue(q);
|
log_sysqueue(q);
|
||||||
|
DEB((D_DAEMON, "daemon rescan_sysqueue daemon queue: MODEM: %d, %d; TCPIP: %d, %d",
|
||||||
|
dqs[MODEM_QUEUE].circle, dqs[MODEM_QUEUE].current, dqs[TCPIP_QUEUE].circle, dqs[TCPIP_QUEUE].current));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1010,10 +1048,17 @@ int daemon_run(const char *confname, const char *incname, bool quit)
|
|||||||
timer_set(&timer_alive, DAEMON_ALIVE_TIMER);
|
timer_set(&timer_alive, DAEMON_ALIVE_TIMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( max_modem > 0 )
|
|
||||||
daemon_queue_do(&daemon_queues[MODEM_QUEUE]);
|
|
||||||
if( max_tcpip > 0 )
|
if( max_tcpip > 0 )
|
||||||
|
{
|
||||||
|
DEB((D_DAEMON,"daemon: daemon_tcpip_queue"));
|
||||||
daemon_queue_do(&daemon_queues[TCPIP_QUEUE]);
|
daemon_queue_do(&daemon_queues[TCPIP_QUEUE]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( max_modem > 0 )
|
||||||
|
{
|
||||||
|
DEB((D_DAEMON,"daemon: daemon_modem_queue"));
|
||||||
|
daemon_queue_do(&daemon_queues[MODEM_QUEUE]);
|
||||||
|
}
|
||||||
|
|
||||||
(void)sleep(DAEMON_IDLE_SLEEP);
|
(void)sleep(DAEMON_IDLE_SLEEP);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -54,15 +54,20 @@ static int daemon_call_branch(s_sysentry *syst, const char *lockdir, s_modemport
|
|||||||
|
|
||||||
s_bforce_opts opts;
|
s_bforce_opts opts;
|
||||||
// TODO: add hiddenline round-robin
|
// TODO: add hiddenline round-robin
|
||||||
opts.hiddline=0;
|
memset(&opts, '\0', sizeof(s_bforce_opts));
|
||||||
opts.runmode = MODE_CALL_DEFAULT;
|
|
||||||
|
opts.hiddline = 0;
|
||||||
|
if ( syst->tcpip )
|
||||||
|
opts.runmode = MODE_CALL_IP;
|
||||||
|
else
|
||||||
|
opts.runmode = MODE_CALL_DEFAULT;
|
||||||
opts.ipproto = NULL;
|
opts.ipproto = NULL;
|
||||||
opts.phone = NULL;
|
opts.phone = NULL;
|
||||||
opts.force = 0;
|
opts.force = 0;
|
||||||
opts.inetd = 0;
|
opts.inetd = 0;
|
||||||
opts.connect = NULL;
|
opts.connect = NULL;
|
||||||
opts.device = NULL;
|
opts.device = NULL;
|
||||||
|
DEB((D_DAEMON, "daemon_call: calling call_system from branch"));
|
||||||
// log("doing call_system");
|
// log("doing call_system");
|
||||||
return call_system(syst->node.addr, &opts);
|
return call_system(syst->node.addr, &opts);
|
||||||
}
|
}
|
||||||
@@ -88,7 +93,10 @@ int daemon_call(s_sysentry *syst)
|
|||||||
* Check whether this node is allready locked
|
* Check whether this node is allready locked
|
||||||
*/
|
*/
|
||||||
if( out_bsy_check(syst->node.addr) )
|
if( out_bsy_check(syst->node.addr) )
|
||||||
|
{
|
||||||
|
DEB((D_DAEMON, "daemon_call: node locked by .bsy file"));
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set state structure to make expressions works properly now
|
* Set state structure to make expressions works properly now
|
||||||
@@ -101,6 +109,7 @@ int daemon_call(s_sysentry *syst)
|
|||||||
|
|
||||||
if( syst->tcpip == FALSE )
|
if( syst->tcpip == FALSE )
|
||||||
{
|
{
|
||||||
|
DEB((D_DAEMON, "daemon_call: tcpip false - prep modem line"));
|
||||||
if( (p_lockdir = conf_string(cf_uucp_lock_directory)) == NULL )
|
if( (p_lockdir = conf_string(cf_uucp_lock_directory)) == NULL )
|
||||||
p_lockdir = BFORCE_LOCK_DIR;
|
p_lockdir = BFORCE_LOCK_DIR;
|
||||||
|
|
||||||
@@ -110,6 +119,9 @@ int daemon_call(s_sysentry *syst)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DEB((D_DAEMON, "call %s line %d via %s",
|
||||||
|
ftn_addrstr(abuf, syst->node.addr), syst->line,
|
||||||
|
syst->tcpip ? "TCP/IP" : modemport->name));
|
||||||
|
|
||||||
log("call %s line %d via %s",
|
log("call %s line %d via %s",
|
||||||
ftn_addrstr(abuf, syst->node.addr), syst->line,
|
ftn_addrstr(abuf, syst->node.addr), syst->line,
|
||||||
@@ -138,7 +150,7 @@ int daemon_call(s_sysentry *syst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now we are in child process */
|
/* Now we are in child process */
|
||||||
|
DEB((D_DAEMON, "daemon_call: fork success - calling..."));
|
||||||
exit(daemon_call_branch(syst, p_lockdir, modemport));
|
exit(daemon_call_branch(syst, p_lockdir, modemport));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ static int tcpip_connect2(struct addrinfo *ai)
|
|||||||
if ( fd == -1 )
|
if ( fd == -1 )
|
||||||
{
|
{
|
||||||
DEB((D_INFO, "tcpip_connect2: socket error"));
|
DEB((D_INFO, "tcpip_connect2: socket error"));
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ int tio_get(int fd, TIO *tio)
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_TERMIOS_H
|
#ifdef HAVE_TERMIOS_H
|
||||||
return tcgetattr(fd, tio);
|
return tcgetattr(fd, tio);
|
||||||
|
#else
|
||||||
|
DEB(("io_unix_tio: TERMIOS not supported!"));
|
||||||
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,6 +130,9 @@ int tio_set(int fd, TIO *tio)
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_TERMIOS_H
|
#ifdef HAVE_TERMIOS_H
|
||||||
return tcsetattr(fd, TCSANOW, tio);
|
return tcsetattr(fd, TCSANOW, tio);
|
||||||
|
#else
|
||||||
|
DEB(("io_unix_tio: TERMIOS not supported!"));
|
||||||
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +183,7 @@ int tio_get_speed(TIO *tio)
|
|||||||
return speedtab[i].nspeed;
|
return speedtab[i].nspeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
return-1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tio_set_flow_control(int fd, TIO *tio, int flow)
|
int tio_set_flow_control(int fd, TIO *tio, int flow)
|
||||||
|
|||||||
@@ -106,11 +106,15 @@ int log_open(const char *logname, const char *ext, const char *tty)
|
|||||||
|
|
||||||
if( logname )
|
if( logname )
|
||||||
{
|
{
|
||||||
|
DEB((D_INFO,"log_open: Opening log file %s", logname));
|
||||||
|
|
||||||
strnxcpy(log_name, logname, sizeof(log_name));
|
strnxcpy(log_name, logname, sizeof(log_name));
|
||||||
|
|
||||||
|
// May be NULL, so check both
|
||||||
if( tty && *tty )
|
if( tty && *tty )
|
||||||
strnxcpy(log_ttyname, tty, sizeof(log_ttyname));
|
strnxcpy(log_ttyname, tty, sizeof(log_ttyname));
|
||||||
|
|
||||||
|
// May be NULL, so check both
|
||||||
if( ext && *ext )
|
if( ext && *ext )
|
||||||
{
|
{
|
||||||
strnxcpy(log_extension, ext, sizeof(log_extension));
|
strnxcpy(log_extension, ext, sizeof(log_extension));
|
||||||
@@ -142,7 +146,9 @@ int log_close(void)
|
|||||||
|
|
||||||
if( log_fp )
|
if( log_fp )
|
||||||
{
|
{
|
||||||
rc = fclose(log_fp); log_fp = NULL;
|
rc = fclose(log_fp);
|
||||||
|
DEB((D_INFO,"Closing log file."));
|
||||||
|
log_fp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|||||||
+20
-10
@@ -56,17 +56,24 @@ int nodelist_checkflag(const char *nodeflags, const char *flag)
|
|||||||
const char *searchbase = nodeflags;
|
const char *searchbase = nodeflags;
|
||||||
char *q;
|
char *q;
|
||||||
|
|
||||||
while( p = strstr(searchbase, flag) )
|
DEB((D_NODELIST, "nodelist: checking flag \"%s\" in flags \"%s\"", flag, nodeflags));
|
||||||
{
|
if ( nodeflags ) {
|
||||||
if( p == searchbase || *(p-1) == ',' )
|
while( p = strcasestr(searchbase, flag) ) // p - found flag
|
||||||
{
|
{
|
||||||
if( (q = strchr(p, ',')) == NULL || (q - p) == strlen(flag) )
|
if( (p == searchbase) || (p != searchbase && *(p-1) == ',') )
|
||||||
return 0;
|
{
|
||||||
if( (strchrnul(p, ':') - p) == strlen(flag) )
|
if( (q = strchr(p, ',')) == NULL || (q - p) == strlen(flag) ) {
|
||||||
return 0;
|
DEB((D_NODELIST, "nodelist: found flag %s", flag));
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
if( (strchrnul(p, ':') - p) == strlen(flag) ) {
|
||||||
|
DEB((D_NODELIST, "nodelist: found flag %s", flag));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
searchbase = p + 1; // avoid finding again the same
|
searchbase = p + 1; // avoid finding again the same
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -243,7 +250,7 @@ int nodelist_parsestring(s_node *node, char *str)
|
|||||||
strnxcpy(node->phone, argv[NODELIST_POSPHONE], sizeof(node->phone));
|
strnxcpy(node->phone, argv[NODELIST_POSPHONE], sizeof(node->phone));
|
||||||
strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags));
|
strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags));
|
||||||
node->speed = atoi(argv[NODELIST_POSSPEED]);
|
node->speed = atoi(argv[NODELIST_POSSPEED]);
|
||||||
|
DEB((D_NODELIST, "nodelist: Parsed common values SYS: %s, ZYZ: %s, LOC: %s, PHONE: %s", node->name, node->sysop, node->location, node->phone));
|
||||||
/*
|
/*
|
||||||
* Replace all '_' by space character
|
* Replace all '_' by space character
|
||||||
*/
|
*/
|
||||||
@@ -291,8 +298,11 @@ int nodelist_parsestring(s_node *node, char *str)
|
|||||||
node->do_ifcico = nodelist_checkflag(node->flags, "IFC") == 0;
|
node->do_ifcico = nodelist_checkflag(node->flags, "IFC") == 0;
|
||||||
node->do_telnet = nodelist_checkflag(node->flags, "ITN") == 0;
|
node->do_telnet = nodelist_checkflag(node->flags, "ITN") == 0;
|
||||||
|
|
||||||
|
//TODO: Add more INA flags to array
|
||||||
nodelist_flagvalue(node->flags, "INA", node->host);
|
nodelist_flagvalue(node->flags, "INA", node->host);
|
||||||
|
|
||||||
|
DEB((D_NODELIST, "nodelist: Parsed inet values IBN: %d, IFC: %d, ITN: %d, INA: %s", node->do_binkp, node->do_ifcico, node->do_telnet, node->host));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ int out_filetype(const char *fname)
|
|||||||
else
|
else
|
||||||
p_nam = fname;
|
p_nam = fname;
|
||||||
|
|
||||||
|
DEB((D_EVENT, "outb_fsqueue: getting type of file %s", p_nam));
|
||||||
/*
|
/*
|
||||||
* Get file name extension
|
* Get file name extension
|
||||||
*/
|
*/
|
||||||
@@ -39,12 +40,19 @@ int out_filetype(const char *fname)
|
|||||||
|
|
||||||
for( i = 0; outtab[i].ext; i++ )
|
for( i = 0; outtab[i].ext; i++ )
|
||||||
if( strcasemask(p_ext, outtab[i].ext) == 0 )
|
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;
|
return outtab[i].type;
|
||||||
|
}
|
||||||
|
|
||||||
for( i = 0; exttab[i].ext; i++ )
|
for( i = 0; exttab[i].ext; i++ )
|
||||||
if( strcasemask(p_ext, exttab[i].ext) == 0 )
|
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;
|
return exttab[i].type;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEB((D_EVENT, "outb_fsqueue: got type UNKNOWN", exttab[i].type, p_ext ));
|
||||||
return TYPE_UNKNOWN;
|
return TYPE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+93
-51
@@ -95,12 +95,12 @@ int binkp_loop(s_binkp_state *bstate) {
|
|||||||
bstate->emptyloop = 0;
|
bstate->emptyloop = 0;
|
||||||
bstate->continuesend = false;
|
bstate->continuesend = false;
|
||||||
|
|
||||||
unsigned short read_pos=0;
|
uint16_t read_pos=0;
|
||||||
unsigned short read_blklen=0;
|
uint16_t read_blklen=0;
|
||||||
unsigned short want_read=BINKP_HEADER;
|
uint16_t want_read=BINKP_HEADER;
|
||||||
|
|
||||||
unsigned short write_pos=0;
|
uint16_t write_pos=0;
|
||||||
unsigned short have_to_write=0;
|
uint16_t have_to_write=0;
|
||||||
|
|
||||||
int n, m;
|
int n, m;
|
||||||
bool no_more_to_send = false;
|
bool no_more_to_send = false;
|
||||||
@@ -124,7 +124,7 @@ int binkp_loop(s_binkp_state *bstate) {
|
|||||||
bstate->continuesend = false;
|
bstate->continuesend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) {
|
if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=(char)-1)) {
|
||||||
m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length);
|
m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length);
|
||||||
if(m==1 || m==3) {
|
if(m==1 || m==3) {
|
||||||
//DEB((D_24554, "got block for sending %d %hu", block_type, block_length));
|
//DEB((D_24554, "got block for sending %d %hu", block_type, block_length));
|
||||||
@@ -140,6 +140,7 @@ int binkp_loop(s_binkp_state *bstate) {
|
|||||||
return PRC_ERROR;
|
return PRC_ERROR;
|
||||||
}
|
}
|
||||||
writebuf[1] = block_length&0xff;
|
writebuf[1] = block_length&0xff;
|
||||||
|
// TODO: FIX unprotected mode
|
||||||
if (bstate->mode==bmode_transfer && bstate->remote_data->options&BINKP_OPT_CRYPT)
|
if (bstate->mode==bmode_transfer && bstate->remote_data->options&BINKP_OPT_CRYPT)
|
||||||
encrypt_buf(writebuf, have_to_write, bstate->remote_data->keys_out);
|
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");
|
log("read: remote socket shutdown");
|
||||||
return PRC_REMOTEABORTED;
|
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);
|
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));
|
DEB((D_24554, "got %d bytes", n));
|
||||||
want_read -= n;
|
want_read -= n;
|
||||||
read_pos += n;
|
read_pos += n;
|
||||||
if (read_pos == BINKP_HEADER) {
|
if (read_pos == BINKP_HEADER) {
|
||||||
// have read header, want read body
|
// have read header, want read body
|
||||||
DEB((D_24554, "it should be 0: %d", want_read));
|
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));
|
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
|
} // 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;
|
block_length = read_pos - BINKP_HEADER;
|
||||||
DEB((D_24554, "binkp: complete block is received %d %hu", block_type, block_length));
|
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);
|
m = binkp_doreceiveblock(bstate, readbuf+BINKP_HEADER, block_type, block_length);
|
||||||
|
DEB((D_24554, "binkp: dorecieveblock result is %d", m));
|
||||||
if(m==1) {
|
if(m==1) {
|
||||||
DEB((D_24554, "block is successfully accepted"));
|
DEB((D_24554, "block is successfully accepted"));
|
||||||
read_pos = 0;
|
read_pos = 0;
|
||||||
@@ -340,7 +346,7 @@ int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned
|
|||||||
{
|
{
|
||||||
int my_sf, wr_pos;
|
int my_sf, wr_pos;
|
||||||
int n; // read file
|
int n; // read file
|
||||||
if (bstate->extracmd[0]!=-1) {
|
if (bstate->extracmd[0]!=(char)-1) {
|
||||||
DEB((D_24554, "Send cmd to remote %d %s", bstate->extracmd[0], bstate->extracmd+1));
|
DEB((D_24554, "Send cmd to remote %d %s", bstate->extracmd[0], bstate->extracmd+1));
|
||||||
buf[0] = bstate->extracmd[0];
|
buf[0] = bstate->extracmd[0];
|
||||||
strcpy(buf+1, bstate->extracmd+1);
|
strcpy(buf+1, bstate->extracmd+1);
|
||||||
@@ -419,6 +425,7 @@ case 7:
|
|||||||
// seems not to remove files from inbound until successful session end is enough to eliminate dupes
|
// seems not to remove files from inbound until successful session end is enough to eliminate dupes
|
||||||
// if (!nodelist_checkflag (state.node.flags, "ND"))
|
// if (!nodelist_checkflag (state.node.flags, "ND"))
|
||||||
// strcat(buf+1, " ND");
|
// strcat(buf+1, " ND");
|
||||||
|
// TODO: add GZ BZ2 and maybe EXTCMD
|
||||||
*block_length = 1 + strlen(buf+1);
|
*block_length = 1 + strlen(buf+1);
|
||||||
DEB((D_24554, "send M_NUL %s", buf+1));
|
DEB((D_24554, "send M_NUL %s", buf+1));
|
||||||
return 1;
|
return 1;
|
||||||
@@ -516,27 +523,47 @@ case 3: // send password on outgoing or pw confirmation on incoming
|
|||||||
|
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
char *p;
|
||||||
|
char pbuf[32];
|
||||||
|
int pwset = 0;
|
||||||
|
|
||||||
if (bstate->mode==bmode_incoming_handshake) {
|
if (bstate->mode==bmode_incoming_handshake) {
|
||||||
DEB((D_24554, "incoming handshake is complete"));
|
DEB((D_24554, "incoming handshake is complete"));
|
||||||
bstate->complete = true;
|
bstate->complete = true;
|
||||||
char *p;
|
|
||||||
char pbuf[32];
|
|
||||||
for (i=0;i<state.n_remoteaddr;i++)
|
for (i=0;i<state.n_remoteaddr;i++)
|
||||||
if( !session_get_password(state.remoteaddrs[i].addr, pbuf, sizeof(pbuf)) ){
|
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_in, pbuf?pbuf:"-");
|
||||||
init_keys(bstate->remote_data->keys_out, "-");
|
init_keys(bstate->remote_data->keys_out, "-");
|
||||||
for (p=pbuf?pbuf:"-"; *p; p++)
|
for (p=pbuf?pbuf:"-"; *p; p++)
|
||||||
update_keys(bstate->remote_data->keys_out, (int)*p);
|
update_keys(bstate->remote_data->keys_out, (int)*p);
|
||||||
}
|
}
|
||||||
|
//TODO: FIX incoming options
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
//TODO: Fix outgoing options
|
||||||
DEB((D_24554, "outgoing handshake: everything is sent"));
|
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;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (bstate->mode == bmode_transfer) {
|
else if (bstate->mode == bmode_transfer) {
|
||||||
|
|
||||||
switch (bstate->phase) {
|
switch (bstate->phase) {
|
||||||
send_next_file:
|
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)
|
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) {
|
switch (block_type) {
|
||||||
|
|
||||||
case BINKP_BLK_CMD:
|
case BINKP_BLK_CMD:
|
||||||
if (block_length<1) {
|
if (block_length<1) {
|
||||||
PROTO_ERROR("Zero length command received")
|
PROTO_ERROR("Zero length command received")
|
||||||
@@ -668,12 +698,12 @@ case BPMSG_ADR: /* List of addresses */
|
|||||||
if (bstate->address_established) {
|
if (bstate->address_established) {
|
||||||
PROTO_ERROR("remote tries to change address");
|
PROTO_ERROR("remote tries to change address");
|
||||||
}
|
}
|
||||||
if( bstate->extracmd[0] !=-1 ) return 0; // suspend !!!
|
if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend !!!
|
||||||
binkp_process_ADR(buf+1);
|
binkp_process_ADR(buf+1);
|
||||||
|
|
||||||
if( !state.n_remoteaddr ) {
|
if( !state.n_remoteaddr ) {
|
||||||
log("error: remote did not supplied any addresses");
|
log("error: remote did not supplied any addresses");
|
||||||
if( bstate->extracmd[0] !=-1 ) return 0; // suspend
|
if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend
|
||||||
bstate->extracmd[0] = BPMSG_BSY;
|
bstate->extracmd[0] = BPMSG_BSY;
|
||||||
strcpy(bstate->extracmd+1, "No addresses was presented");
|
strcpy(bstate->extracmd+1, "No addresses was presented");
|
||||||
bstate->extraislast = true;
|
bstate->extraislast = true;
|
||||||
@@ -687,14 +717,17 @@ case BPMSG_ADR: /* List of addresses */
|
|||||||
bstate->extraislast = false;
|
bstate->extraislast = false;
|
||||||
sprintf(bstate->extracmd+1,"OPT MB CRYPT");
|
sprintf(bstate->extracmd+1,"OPT MB CRYPT");
|
||||||
s_override ovr;
|
s_override ovr;
|
||||||
|
DEB((D_24554, "process adr overrides"));
|
||||||
for(i = 0; i < state.n_remoteaddr; i++) {
|
for(i = 0; i < state.n_remoteaddr; i++) {
|
||||||
ovr.sFlags = "";
|
ovr.sFlags = "";
|
||||||
override_get (&ovr, state.remoteaddrs[i].addr, 0);
|
override_get (&ovr, state.remoteaddrs[i].addr, 0);
|
||||||
|
DEB((D_24554, "got adr overrides"));
|
||||||
if (nodelist_checkflag (ovr.sFlags, "NR")==0) {
|
if (nodelist_checkflag (ovr.sFlags, "NR")==0) {
|
||||||
strcat (bstate->extracmd+1, " NR");
|
strcat (bstate->extracmd+1, " NR");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DEB((D_24554, "process adr overrides"));
|
||||||
}
|
}
|
||||||
// further use extracmd only for errors
|
// further use extracmd only for errors
|
||||||
|
|
||||||
@@ -740,7 +773,7 @@ case BPMSG_PWD: /* Session password */
|
|||||||
/* Do authorization */
|
/* Do authorization */
|
||||||
if( binkp_auth_incoming(bstate->remote_data) ) {
|
if( binkp_auth_incoming(bstate->remote_data) ) {
|
||||||
log("error: invalid password");
|
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;
|
bstate->extracmd[0] = BPMSG_ERR;
|
||||||
strcpy(bstate->extracmd+1, "Security violation");
|
strcpy(bstate->extracmd+1, "Security violation");
|
||||||
bstate->extraislast = true;
|
bstate->extraislast = true;
|
||||||
@@ -749,7 +782,7 @@ case BPMSG_PWD: /* Session password */
|
|||||||
// lock addresses
|
// lock addresses
|
||||||
if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) ) {
|
if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) ) {
|
||||||
log("error locking addresses of the remote");
|
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;
|
bstate->extracmd[0] = BPMSG_BSY;
|
||||||
strcpy(bstate->extracmd+1, "All addresses are busy");
|
strcpy(bstate->extracmd+1, "All addresses are busy");
|
||||||
bstate->extraislast = true;
|
bstate->extraislast = true;
|
||||||
@@ -770,6 +803,7 @@ case BPMSG_FILE: /* File information */
|
|||||||
s_bpfinfo recvfi;
|
s_bpfinfo recvfi;
|
||||||
if( binkp_parsfinfo(buf+1, &recvfi, true) ) {
|
if( binkp_parsfinfo(buf+1, &recvfi, true) ) {
|
||||||
log ("M_FILE parse error: %s", buf + 1);
|
log ("M_FILE parse error: %s", buf + 1);
|
||||||
|
DEB((D_24554, "M_FILE parse error: %s", buf + 1 ));
|
||||||
PROTO_ERROR("invalid M_FILE");
|
PROTO_ERROR("invalid M_FILE");
|
||||||
}
|
}
|
||||||
bstate->batch_recv_count += 1;
|
bstate->batch_recv_count += 1;
|
||||||
@@ -786,9 +820,9 @@ case BPMSG_FILE: /* File information */
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
DEB((D_24554, "no, skipping; TODO: accept it"));
|
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;
|
bstate->extracmd[0] = BPMSG_SKIP;
|
||||||
sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm);
|
sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm, recvfi.offs);
|
||||||
bstate->extraislast = false;
|
bstate->extraislast = false;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -798,7 +832,7 @@ case BPMSG_FILE: /* File information */
|
|||||||
PROTO_ERROR("invalid mode for M_FILE");
|
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)) {
|
switch(p_rx_fopen(bstate->pi, recvfi.fn, recvfi.sz, recvfi.tm, 0)) {
|
||||||
case 0:
|
case 0:
|
||||||
if (bstate->pi->recv->bytes_skipped == recvfi.offs) {
|
if (bstate->pi->recv->bytes_skipped == recvfi.offs) {
|
||||||
@@ -844,7 +878,7 @@ case BPMSG_OK: /* Password was acknowleged (data ignored) */
|
|||||||
}
|
}
|
||||||
if (session_addrs_lock(state.remoteaddrs, state.n_remoteaddr)) {
|
if (session_addrs_lock(state.remoteaddrs, state.n_remoteaddr)) {
|
||||||
log("error: unable to lock");
|
log("error: unable to lock");
|
||||||
if (bstate->extracmd[0]!=-1) return 0;
|
if (bstate->extracmd[0]!= (char)-1) return 0;
|
||||||
bstate->extracmd[0] = BPMSG_BSY;
|
bstate->extracmd[0] = BPMSG_BSY;
|
||||||
strcpy(bstate->extracmd+1, "All addresses are busy");
|
strcpy(bstate->extracmd+1, "All addresses are busy");
|
||||||
bstate->extraislast = true;
|
bstate->extraislast = true;
|
||||||
@@ -954,7 +988,7 @@ case BPMSG_GET: /* Get a file from offset */
|
|||||||
}
|
}
|
||||||
DEB((D_24554, "M_GET file %s size %d time %d offset %d", getfi.fn, getfi.sz, getfi.tm, getfi.offs));
|
DEB((D_24554, "M_GET file %s size %d time %d offset %d", getfi.fn, getfi.sz, getfi.tm, getfi.offs));
|
||||||
|
|
||||||
if (bstate->extracmd[0] != -1) return 0;
|
if (bstate->extracmd[0] != (char)-1) return 0;
|
||||||
|
|
||||||
if (bstate->pi->send) if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) {
|
if (bstate->pi->send) if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) {
|
||||||
DEB((D_24554, "M_GET for currently transmitted file"));
|
DEB((D_24554, "M_GET for currently transmitted file"));
|
||||||
@@ -1044,14 +1078,14 @@ case BINKP_BLK_DATA:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bstate->extracmd[0] != -1) return 0;
|
if (bstate->extracmd[0] != (char)-1) return 0;
|
||||||
|
|
||||||
long int n;
|
long int n;
|
||||||
n = p_rx_writefile(buf, block_length, bstate->pi);
|
n = p_rx_writefile(buf, block_length, bstate->pi);
|
||||||
|
|
||||||
if( n < 0 ) {
|
if( n < 0 ) {
|
||||||
log("error writing local file");
|
log("error writing local file");
|
||||||
if( n == -2 ) {
|
if( n == (long int)-2 ) {
|
||||||
bstate->extracmd[0] = BPMSG_GOT;
|
bstate->extracmd[0] = BPMSG_GOT;
|
||||||
sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
|
sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
|
||||||
(long)bstate->pi->recv->mod_time);
|
(long)bstate->pi->recv->mod_time);
|
||||||
@@ -1080,28 +1114,33 @@ case BINKP_BLK_DATA:
|
|||||||
p_rx_fclose(bstate->pi);
|
p_rx_fclose(bstate->pi);
|
||||||
PROTO_ERROR("extra data for file")
|
PROTO_ERROR("extra data for file")
|
||||||
}
|
}
|
||||||
else if( bstate->pi->recv->bytes_received == bstate->pi->recv->bytes_total ) {
|
else if( bstate->pi->recv->bytes_received == bstate->pi->recv->bytes_total )
|
||||||
DEB((D_24554, "receive completed"));
|
{
|
||||||
bstate->frs = frs_nothing;
|
DEB((D_24554, "receive completed"));
|
||||||
bstate->pi->recv->status = FSTAT_SUCCESS;
|
bstate->frs = frs_nothing;
|
||||||
if( !p_rx_fclose(bstate->pi) ) {
|
bstate->pi->recv->status = FSTAT_SUCCESS;
|
||||||
bstate->extracmd[0] = BPMSG_GOT;
|
if( !p_rx_fclose(bstate->pi) )
|
||||||
sprintf(bstate->extracmd+1, "%s %ld %ld",
|
{
|
||||||
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
|
bstate->extracmd[0] = BPMSG_GOT;
|
||||||
(long)bstate->pi->recv->mod_time);
|
sprintf(bstate->extracmd+1, "%s %ld %ld",
|
||||||
bstate->extraislast = false;
|
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
|
||||||
return 1;
|
(long)bstate->pi->recv->mod_time);
|
||||||
}
|
bstate->extraislast = false;
|
||||||
else {
|
return 1;
|
||||||
DEB((D_24554, "some error committing file"));
|
}
|
||||||
bstate->extracmd[0] = BPMSG_SKIP;
|
else
|
||||||
sprintf(bstate->extracmd+1, "%s %ld %ld",
|
{
|
||||||
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
|
DEB((D_24554, "some error committing file"));
|
||||||
(long)bstate->pi->recv->mod_time);
|
bstate->extracmd[0] = BPMSG_SKIP;
|
||||||
bstate->extraislast = false;
|
sprintf(bstate->extracmd+1, "%s %ld %ld",
|
||||||
return 1;
|
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
|
||||||
}
|
(long)bstate->pi->recv->mod_time);
|
||||||
} else {
|
bstate->extraislast = false;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DEB((D_24554, "data block accepted"));
|
DEB((D_24554, "data block accepted"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1140,7 +1179,7 @@ void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
strnxcpy(remote_data->opt, buffer+4, sizeof(remote_data->opt));
|
strnxcpy(remote_data->opt, buffer+4, sizeof(remote_data->opt));
|
||||||
|
DEB((D_24554,"Process OPT"));
|
||||||
binkp_parse_options(remote_data, buffer+4);
|
binkp_parse_options(remote_data, buffer+4);
|
||||||
}
|
}
|
||||||
else if( strncmp(buffer, "VER ", 4) == 0 )
|
else if( strncmp(buffer, "VER ", 4) == 0 )
|
||||||
@@ -1181,13 +1220,16 @@ void binkp_process_ADR(char *buffer)
|
|||||||
{
|
{
|
||||||
s_faddr addr;
|
s_faddr addr;
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
DEB((D_24554, "process ADR: %s", buffer));
|
||||||
for( p = string_token(buffer, &q, NULL, 0); p; p = string_token(NULL, &q, NULL, 0) )
|
for( p = string_token(buffer, &q, NULL, 0); p; p = string_token(NULL, &q, NULL, 0) )
|
||||||
{
|
{
|
||||||
|
DEB((D_24554, "binkp_process_ADR got token \"%s\" ",p ));
|
||||||
if( ftn_addrparse(&addr, p, FALSE) )
|
if( ftn_addrparse(&addr, p, FALSE) )
|
||||||
log("BinkP got unparsable address \"%s\"", string_printable(p));
|
log("BinkP got unparsable address \"%s\"", string_printable(p));
|
||||||
else
|
else {
|
||||||
session_addrs_add(&state.remoteaddrs, &state.n_remoteaddr, addr);
|
session_addrs_add(&state.remoteaddrs, &state.n_remoteaddr, addr);
|
||||||
|
DEB((D_24554, "process ADR complete"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
void binkp_parse_options(s_binkp_sysinfo *binkp, char *options)
|
||||||
{
|
{
|
||||||
char *p, *n;
|
char *p, *n;
|
||||||
|
DEB((D_24554,"binkp: parse_options: %s", options));
|
||||||
for( p = string_token(options, &n, NULL, 0); p;
|
for( p = string_token(options, &n, NULL, 0); p;
|
||||||
p = string_token(NULL, &n, NULL, 0) )
|
p = string_token(NULL, &n, NULL, 0) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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)
|
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 )
|
if( type & TYPE_REQANSW )
|
||||||
{
|
{
|
||||||
traf->freqed_size += size;
|
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_time += xtime;
|
||||||
traf->arcmail_num++;
|
traf->arcmail_num++;
|
||||||
}
|
}
|
||||||
|
else if( type & TYPE_TICFILE )
|
||||||
|
{
|
||||||
|
traf->ticfile_num++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
traf->files_size += size;
|
traf->files_size += size;
|
||||||
|
|||||||
+21
-11
@@ -22,8 +22,16 @@
|
|||||||
int answ_system(e_session type, char *connstr, int inetd)
|
int answ_system(e_session type, char *connstr, int inetd)
|
||||||
{
|
{
|
||||||
TIO oldtio;
|
TIO oldtio;
|
||||||
struct sockaddr_in client;
|
union {
|
||||||
|
struct sockaddr a;
|
||||||
|
struct sockaddr_in in;
|
||||||
|
struct sockaddr_in6 in6;
|
||||||
|
} client;
|
||||||
|
//struct sockaddr_storage client;
|
||||||
int clientlen = sizeof(client);
|
int clientlen = sizeof(client);
|
||||||
|
char clienthost[NI_MAXHOST];
|
||||||
|
char clientport[NI_MAXSERV];
|
||||||
|
int clientres = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@@ -74,18 +82,20 @@ int answ_system(e_session type, char *connstr, int inetd)
|
|||||||
log("Answering TCPIP call...");
|
log("Answering TCPIP call...");
|
||||||
if( connstr && *connstr )
|
if( connstr && *connstr )
|
||||||
state.connstr = (char*)xstrcpy(connstr);
|
state.connstr = (char*)xstrcpy(connstr);
|
||||||
else if( getpeername(0, (struct sockaddr*)&client, &clientlen) == -1 )
|
|
||||||
logerr("can't get client address");
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef IPV6
|
if(getpeername(0, &client.a, &clientlen))
|
||||||
>char addr_str[INET6_ADDRSTRLEN+1];
|
log("sess_answ: can't detrmine socket client");
|
||||||
state.peername = (char*)xstrcpy(inet_ntop(AF_INET6, client.sin6_addr, addr_str, INET6_ADDRSTRLEN));
|
clientres = getnameinfo( &client.a, clientlen,
|
||||||
state.peerport = (long)ntohs(client.sin6_port);
|
clienthost, sizeof(clienthost), clientport,
|
||||||
#else
|
sizeof(clientport), NI_NUMERICHOST | NI_NUMERICSERV);
|
||||||
state.peername = (char*)xstrcpy(inet_ntoa(client.sin_addr));
|
if ( clientres == 0 )
|
||||||
state.peerport = (long)ntohs(client.sin_port);
|
{
|
||||||
#endif
|
state.peername = (char*)xstrcpy(clienthost);
|
||||||
|
state.peerport = (long)atol(clientport);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
log("sess_answ: can't get client address: ", gai_strerror(clientres));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+102
-32
@@ -480,10 +480,15 @@ int call_system_tcpip(int callwith) // only TCPIP values
|
|||||||
{
|
{
|
||||||
char abuf[BF_MAXADDRSTR+1];
|
char abuf[BF_MAXADDRSTR+1];
|
||||||
int rc = BFERR_NOERROR;
|
int rc = BFERR_NOERROR;
|
||||||
|
char * pbuf;
|
||||||
|
char * target = 0;
|
||||||
|
int resflg;
|
||||||
/*
|
/*
|
||||||
* Set verbal line name to "tcpip" value
|
* 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.linename = xstrcpy("tcpip");
|
||||||
state.inet = TRUE;
|
state.inet = TRUE;
|
||||||
@@ -502,14 +507,17 @@ int call_system_tcpip(int callwith) // only TCPIP values
|
|||||||
case CALL_TCPIP_BINKP:
|
case CALL_TCPIP_BINKP:
|
||||||
state.tcpmode = TCPMODE_BINKP;
|
state.tcpmode = TCPMODE_BINKP;
|
||||||
state.session = SESSION_BINKP;
|
state.session = SESSION_BINKP;
|
||||||
|
target = xstrcpy("IBN");
|
||||||
break;
|
break;
|
||||||
case CALL_TCPIP_IFCICO:
|
case CALL_TCPIP_IFCICO:
|
||||||
state.tcpmode = TCPMODE_RAW;
|
state.tcpmode = TCPMODE_RAW;
|
||||||
state.session = SESSION_UNKNOWN;
|
state.session = SESSION_UNKNOWN;
|
||||||
|
target = xstrcpy("IFC");
|
||||||
break;
|
break;
|
||||||
case CALL_TCPIP_TELNET:
|
case CALL_TCPIP_TELNET:
|
||||||
state.tcpmode = TCPMODE_TELNET;
|
state.tcpmode = TCPMODE_TELNET;
|
||||||
state.session = SESSION_UNKNOWN;
|
state.session = SESSION_UNKNOWN;
|
||||||
|
target = xstrcpy("ITN");
|
||||||
break;
|
break;
|
||||||
defalt:
|
defalt:
|
||||||
log("invalid protocol for TCP/IP module");
|
log("invalid protocol for TCP/IP module");
|
||||||
@@ -521,7 +529,45 @@ defalt:
|
|||||||
(state.node.name && *state.node.name ) ? state.node.name : "<none>",
|
(state.node.name && *state.node.name ) ? state.node.name : "<none>",
|
||||||
(state.node.host && *state.node.host) ? state.node.host : "<none>");
|
(state.node.host && *state.node.host) ? state.node.host : "<none>");
|
||||||
|
|
||||||
if( (rc = tcpip_connect(state.node.host, state.tcpmode)) == 0
|
memset(abuf, '\0', BF_MAXADDRSTR+1);
|
||||||
|
pbuf = xmalloc(1024);
|
||||||
|
|
||||||
|
resflg = nodelist_lookup_string(pbuf, 1024, state.node.addr);
|
||||||
|
if ( ! resflg )
|
||||||
|
{
|
||||||
|
|
||||||
|
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) )
|
&& (rc = tcpip_init() == 0) )
|
||||||
{
|
{
|
||||||
TTYSTATUS(1);
|
TTYSTATUS(1);
|
||||||
@@ -532,7 +578,7 @@ defalt:
|
|||||||
{
|
{
|
||||||
rc = BFERR_CANT_CONNECT10;
|
rc = BFERR_CANT_CONNECT10;
|
||||||
}
|
}
|
||||||
|
free(pbuf);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,7 +589,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
char s[300];
|
char s[300];
|
||||||
snprintf(s, 299, "bforce calling system %d:%d/%d.%d", addr.zone, addr.net, addr.node, addr.point );
|
snprintf(s, 299, "bforce calling system %d:%d/%d.%d", addr.zone, addr.net, addr.node, addr.point );
|
||||||
log(s);
|
log(s);
|
||||||
|
DEB((D_EVENT, s));
|
||||||
// find suitable way of connection and try to make session
|
// find suitable way of connection and try to make session
|
||||||
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@@ -568,12 +614,13 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
state.listed = state.node.listed;
|
state.listed = state.node.listed;
|
||||||
|
//DEB((D_EVENT, "Calling init, listed=%d", state.listed));
|
||||||
state.node.addr.domain[0] = '\0'; /* Discard domain for node address */
|
state.node.addr.domain[0] = '\0'; /* Discard domain for node address */
|
||||||
|
|
||||||
// 1. If call method specified in cmdline, do use it
|
// 1. If call method specified in cmdline, do use it
|
||||||
// 2. If not, use nodelist data and overrides and call all available methods
|
// 2. If not, use nodelist data and overrides and call all available methods
|
||||||
// If override contains Phone or IP flags, ignore nodelist connect methods (but save INA if not overrided)
|
// If override contains Phone or IP flags, ignore nodelist connect methods (but save INA if not overrided)
|
||||||
|
DEB((D_EVENT, "Calling init, runmode=%d", opts->runmode));
|
||||||
// 1st - get all allowed call ways
|
// 1st - get all allowed call ways
|
||||||
// 2nd - gather information reqired to call and remove unavailable ways (no info, node does not support)
|
// 2nd - gather information reqired to call and remove unavailable ways (no info, node does not support)
|
||||||
|
|
||||||
@@ -581,7 +628,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
|
|
||||||
if( opts->runmode == MODE_CALL_DEFAULT )
|
if( opts->runmode == MODE_CALL_DEFAULT )
|
||||||
{
|
{
|
||||||
call_mayuse = CALL_MODEM | CALL_TCPIP_ANY;
|
call_mustuse = CALL_MODEM | CALL_TCPIP_ANY;
|
||||||
}
|
}
|
||||||
else if( opts->runmode == MODE_CALL_STDIO )
|
else if( opts->runmode == MODE_CALL_STDIO )
|
||||||
{
|
{
|
||||||
@@ -593,7 +640,14 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
}
|
}
|
||||||
else if( opts->runmode == MODE_CALL_IP )
|
else if( opts->runmode == MODE_CALL_IP )
|
||||||
{
|
{
|
||||||
if( strcasecmp(opts->ipproto, "binkp") == 0 )
|
DEB((D_EVENT, "Calling init, MODE_CALL_IP"));
|
||||||
|
if( !(opts->ipproto) ) // determine from nodelist/override
|
||||||
|
{
|
||||||
|
DEB((D_EVENT, "ipproto not set"));
|
||||||
|
call_mayuse = CALL_TCPIP_ANY;
|
||||||
|
call_mustuse = 0;
|
||||||
|
}
|
||||||
|
else if( strcasecmp(opts->ipproto, "binkp") == 0 )
|
||||||
{
|
{
|
||||||
call_mustuse = CALL_TCPIP_BINKP;
|
call_mustuse = CALL_TCPIP_BINKP;
|
||||||
}
|
}
|
||||||
@@ -605,20 +659,17 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
{
|
{
|
||||||
call_mustuse = CALL_TCPIP_TELNET;
|
call_mustuse = CALL_TCPIP_TELNET;
|
||||||
}
|
}
|
||||||
else if( opts->ipproto == NULL ) // determine from nodelist/override
|
|
||||||
{
|
|
||||||
call_mayuse = CALL_TCPIP_ANY;
|
|
||||||
call_mustuse = 0;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
DEB((D_EVENT, "Unknown protocol %s", opts->ipproto));
|
||||||
log("Unknown protocol");
|
log("Unknown protocol");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log("Unknown protocol");
|
DEB((D_EVENT, "Unknown runmode %d", opts->runmode));
|
||||||
|
log("Unknown runmode");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,9 +678,10 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
//char s[300];
|
//char s[300];
|
||||||
//snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
|
//snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
|
||||||
//log(s);
|
//log(s);
|
||||||
|
//DEB((D_EVENT, s));
|
||||||
|
|
||||||
|
|
||||||
if( call_mayuse & CALL_MODEM )
|
if( (call_mayuse & CALL_MODEM) )
|
||||||
{
|
{
|
||||||
// 1. use phone from opts
|
// 1. use phone from opts
|
||||||
// 2. use overrides
|
// 2. use overrides
|
||||||
@@ -650,7 +702,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
{
|
{
|
||||||
log("bad phone, excluding modem");
|
log("bad phone, excluding modem");
|
||||||
call_mayuse &= ~CALL_MODEM;
|
call_mayuse &= ~CALL_MODEM;
|
||||||
if( call_mustuse & CALL_MODEM )
|
if( !(call_mayuse) )
|
||||||
{
|
{
|
||||||
errmsg = "don't know phone number";
|
errmsg = "don't know phone number";
|
||||||
gotoexit(BFERR_PHONE_UNKNOWN);
|
gotoexit(BFERR_PHONE_UNKNOWN);
|
||||||
@@ -684,7 +736,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
{
|
{
|
||||||
call_mayuse &= ~CALL_MODEM;
|
call_mayuse &= ~CALL_MODEM;
|
||||||
log("bad worktime, excluding modem");
|
log("bad worktime, excluding modem");
|
||||||
if( call_mustuse & CALL_MODEM )
|
if( !(call_mayuse) )
|
||||||
{
|
{
|
||||||
errmsg = "not works now, try later";
|
errmsg = "not works now, try later";
|
||||||
gotoexit(BFERR_NOTWORKING);
|
gotoexit(BFERR_NOTWORKING);
|
||||||
@@ -693,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);
|
//snprintf(s, 299, "after phone check: may use %d must use %d", call_mayuse, call_mustuse);
|
||||||
// log(s);
|
//log(s);
|
||||||
|
//DEB((D_EVENT, s));
|
||||||
/*
|
/*
|
||||||
* Apply overrides to the node information
|
* Apply overrides to the node information
|
||||||
*/
|
*/
|
||||||
@@ -714,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( !(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;
|
call_mayuse &= ~CALL_TCPIP_BINKP;
|
||||||
}
|
}
|
||||||
@@ -722,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( !(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;
|
call_mayuse &= ~CALL_TCPIP_IFCICO;
|
||||||
}
|
}
|
||||||
@@ -730,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( !(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;
|
call_mayuse &= ~CALL_TCPIP_TELNET;
|
||||||
}
|
}
|
||||||
@@ -746,7 +801,12 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
state.override.sIpaddr, sizeof(state.node.host));
|
state.override.sIpaddr, sizeof(state.node.host));
|
||||||
}
|
}
|
||||||
|
|
||||||
if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) ) {
|
//DEB((D_EVENT, "Calling init, IPHOST", 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);
|
char *fidodnszone = conf_string(cf_fidodnszone);
|
||||||
if (fidodnszone) {
|
if (fidodnszone) {
|
||||||
if (addr.point) {
|
if (addr.point) {
|
||||||
@@ -761,17 +821,21 @@ 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;
|
call_mayuse &= ~CALL_TCPIP_ANY;
|
||||||
log("bad host, exclude IP");
|
log("bad host, exclude IP");
|
||||||
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);
|
gotoexit(BFERR_PHONE_UNKNOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DEB((D_EVENT,"sess_call: may use %d must use %d", call_mayuse, call_mustuse));
|
||||||
// snprintf(s, 299, "after IP check: may use %d must use %d", call_mayuse, call_mustuse);
|
// snprintf(s, 299, "after IP check: may use %d must use %d", call_mayuse, call_mustuse);
|
||||||
// log(s);
|
// log(s);
|
||||||
|
|
||||||
@@ -808,28 +872,33 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
// try allowed methods and break if rc == 0
|
// try allowed methods and break if rc == 0
|
||||||
rc = -1;
|
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);
|
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);
|
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);
|
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);
|
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",
|
setproctitle("bforce calling %.32s, %.32s",
|
||||||
ftn_addrstr(abuf, state.node.addr), state.node.phone);
|
ftn_addrstr(abuf, state.node.addr), state.node.phone);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
@@ -850,6 +919,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
|||||||
|
|
||||||
if( port_lock(p_lockdir, state.modemport) == 0 ) /* Successfuly locked port */
|
if( port_lock(p_lockdir, state.modemport) == 0 ) /* Successfuly locked port */
|
||||||
{
|
{
|
||||||
|
DEB((D_EVENT,"sess_call: call_system_modem running"));
|
||||||
rc = call_system_modem();
|
rc = call_system_modem();
|
||||||
port_unlock(p_lockdir, state.modemport);
|
port_unlock(p_lockdir, state.modemport);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,14 +135,16 @@ int override_get(s_override *dest, s_faddr addr, int line)
|
|||||||
{
|
{
|
||||||
s_override *p;
|
s_override *p;
|
||||||
int curline = 0;
|
int curline = 0;
|
||||||
|
|
||||||
p = conf_override(cf_override, addr);
|
p = conf_override(cf_override, addr);
|
||||||
|
|
||||||
curline = 0;
|
curline = 0;
|
||||||
while( p && curline < line )
|
if (line > 0)
|
||||||
{
|
{
|
||||||
p = p->hidden;
|
while( p && curline < line )
|
||||||
++curline;
|
{
|
||||||
|
p = p->hidden;
|
||||||
|
++curline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( p && curline == line )
|
if( p && curline == line )
|
||||||
@@ -152,7 +154,7 @@ int override_get(s_override *dest, s_faddr addr, int line)
|
|||||||
}
|
}
|
||||||
else if( line == 0 )
|
else if( line == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -897,11 +897,20 @@ int session(void)
|
|||||||
p_log_txrxstat(&pi);
|
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
|
* Raise flags if session incoming traffic was not empty
|
||||||
*/
|
*/
|
||||||
if ( (p = conf_string(cf_incnet_flag)) )
|
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"));
|
DEB((D_EVENT, "Incoming netmail > 0, raising flag"));
|
||||||
log("Raising flag for netmail in %s", p);
|
log("Raising flag for netmail in %s", p);
|
||||||
fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
|
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 ( (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"));
|
DEB((D_EVENT, "Incoming arcmail > 0, raising flag"));
|
||||||
log("Raising flag for arcmail in %s", p);
|
log("Raising flag for arcmail in %s", p);
|
||||||
fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
|
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
|
* Save session traffic before deiniting
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -189,7 +189,8 @@ static int ftn_addrparse_fido(s_faddr *addr, const char *s, bool wildcard)
|
|||||||
{
|
{
|
||||||
strnxcpy(addr->domain, string_printable(p), sizeof(addr->domain));
|
strnxcpy(addr->domain, string_printable(p), sizeof(addr->domain));
|
||||||
}
|
}
|
||||||
|
DEB((D_INFO,"u_ftn: Parsed ftn address z:%d, net:%d, node:%d, point:%d",
|
||||||
|
addr->zone, addr->net, addr->node, addr->point));
|
||||||
return badaddr;
|
return badaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,6 +327,7 @@ int ftn_addrparse(s_faddr *addr, const char *s, bool wildcard)
|
|||||||
addr->node = DEFAULT_NODE;
|
addr->node = DEFAULT_NODE;
|
||||||
addr->point = 0;
|
addr->point = 0;
|
||||||
|
|
||||||
|
DEB((D_INFO, "u_ftn: parsing ftnaddr %s", s));
|
||||||
if( addr->inetform )
|
if( addr->inetform )
|
||||||
badaddr = ftn_addrparse_inet(addr, s, wildcard);
|
badaddr = ftn_addrparse_inet(addr, s, wildcard);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ void *xrealloc(void *buf, size_t size)
|
|||||||
else if( (tmp = (char*)(buf ? realloc(buf, size) : malloc(size))) == NULL )
|
else if( (tmp = (char*)(buf ? realloc(buf, size) : malloc(size))) == NULL )
|
||||||
{
|
{
|
||||||
log("failed to reallocate %ld bytes -> abort", size);
|
log("failed to reallocate %ld bytes -> abort", size);
|
||||||
|
if( buf ) free(buf);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ static int nodelist_makeindex(s_nodelist *nlp, s_faddr addr)
|
|||||||
switch(keyword) {
|
switch(keyword) {
|
||||||
case KEYWORD_ZONE:
|
case KEYWORD_ZONE:
|
||||||
bni.zone = value;
|
bni.zone = value;
|
||||||
bni.net = 0;
|
bni.net = value; // zxalexis
|
||||||
bni.node = 0;
|
bni.node = 0;
|
||||||
bni.point = 0;
|
bni.point = 0;
|
||||||
bni.hub = 0;
|
bni.hub = 0;
|
||||||
|
|||||||
+117
-115
@@ -141,8 +141,8 @@ typedef struct override {
|
|||||||
char *sPhone;
|
char *sPhone;
|
||||||
char *sFlags;
|
char *sFlags;
|
||||||
s_timevec worktime;
|
s_timevec worktime;
|
||||||
s_timevec freqtime;
|
s_timevec freqtime;
|
||||||
char *run;
|
char *run;
|
||||||
struct override *hidden; /* Hidden lines list */
|
struct override *hidden; /* Hidden lines list */
|
||||||
} s_override;
|
} s_override;
|
||||||
|
|
||||||
@@ -159,128 +159,130 @@ typedef struct filebox {
|
|||||||
} s_filebox;
|
} s_filebox;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
cf_address,
|
cf_address, // 0
|
||||||
cf_amiga_outbound_directory,
|
cf_amiga_outbound_directory, // 1
|
||||||
cf_binkp_timeout,
|
cf_binkp_timeout, // 2
|
||||||
cf_daemon_circle,
|
cf_daemon_circle, // 3
|
||||||
cf_daemon_circle_crash,
|
cf_daemon_circle_crash, // 4
|
||||||
cf_daemon_circle_direct,
|
cf_daemon_circle_direct, // 5
|
||||||
cf_daemon_circle_immed,
|
cf_daemon_circle_immed, // 6
|
||||||
cf_daemon_circle_modem,
|
cf_daemon_circle_modem, // 7
|
||||||
cf_daemon_circle_normal,
|
cf_daemon_circle_normal, // 8
|
||||||
cf_daemon_circle_rescan,
|
cf_daemon_circle_rescan, // 9
|
||||||
cf_daemon_maxclients_modem,
|
cf_daemon_maxclients_modem, // 10
|
||||||
cf_daemon_maxclients_tcpip,
|
cf_daemon_maxclients_tcpip, // 11
|
||||||
cf_daemon_pid_file,
|
cf_daemon_pid_file, // 12
|
||||||
cf_delay_files_recv,
|
cf_delay_files_recv, // 13
|
||||||
cf_delay_files_send,
|
cf_delay_files_send, // 14
|
||||||
cf_disable_aka_matching,
|
cf_disable_aka_matching, // 15
|
||||||
cf_domain,
|
cf_domain, // 16
|
||||||
cf_emsi_FR_time,
|
cf_emsi_FR_time, // 17
|
||||||
cf_emsi_OH_time,
|
cf_emsi_OH_time, // 18
|
||||||
cf_emsi_slave_sends_nak,
|
cf_emsi_slave_sends_nak, // 19
|
||||||
cf_emsi_send_tz,
|
cf_emsi_send_tz, // 20
|
||||||
cf_emsi_send_time,
|
cf_emsi_send_time, // 21
|
||||||
cf_filebox,
|
cf_filebox, // 22
|
||||||
cf_filebox_directory,
|
cf_filebox_directory, // 23
|
||||||
cf_flags,
|
cf_flags, // 24
|
||||||
cf_flo_translate,
|
cf_flo_translate, // 25
|
||||||
cf_freq_alias_list,
|
cf_freq_alias_list, // 26
|
||||||
cf_freq_dir_list,
|
cf_freq_dir_list, // 27
|
||||||
cf_freq_ignore_masks,
|
cf_freq_ignore_masks, // 28
|
||||||
cf_freq_limit_number,
|
cf_freq_limit_number, // 29
|
||||||
cf_freq_limit_size,
|
cf_freq_limit_size, // 30
|
||||||
cf_freq_limit_time,
|
cf_freq_limit_time, // 31
|
||||||
cf_freq_min_speed,
|
cf_freq_min_speed, // 32
|
||||||
cf_freq_srif_command,
|
cf_freq_srif_command, // 33
|
||||||
cf_incnet_flag,
|
cf_incnet_flag, // 34
|
||||||
cf_incarc_flag,
|
cf_incarc_flag, // 35
|
||||||
cf_hide_our_aka,
|
cf_inctic_flag, // 36
|
||||||
cf_history_file,
|
cf_incfile_flag, // 37
|
||||||
cf_hydra_options,
|
cf_hide_our_aka, // 38
|
||||||
cf_hydra_mincps_recv,
|
cf_history_file, // 39
|
||||||
cf_hydra_mincps_send,
|
cf_hydra_options, // 40
|
||||||
cf_hydra_tx_window,
|
cf_hydra_mincps_recv, // 41
|
||||||
cf_hydra_rx_window,
|
cf_hydra_mincps_send, // 42
|
||||||
cf_inbound_directory,
|
cf_hydra_tx_window, // 43
|
||||||
cf_location,
|
cf_hydra_rx_window, // 44
|
||||||
cf_log_file,
|
cf_inbound_directory, // 45
|
||||||
cf_log_file_daemon,
|
cf_location, // 46
|
||||||
cf_max_speed,
|
cf_log_file, // 47
|
||||||
cf_maxtries,
|
cf_log_file_daemon, // 48
|
||||||
cf_maxtries_nodial,
|
cf_max_speed, // 49
|
||||||
cf_maxtries_noansw,
|
cf_maxtries, // 50
|
||||||
cf_maxtries_noconn,
|
cf_maxtries_nodial, // 51
|
||||||
cf_maxtries_hshake,
|
cf_maxtries_noansw, // 52
|
||||||
cf_maxtries_sessions,
|
cf_maxtries_noconn, // 53
|
||||||
cf_min_cps_recv,
|
cf_maxtries_hshake, // 54
|
||||||
cf_min_cps_send,
|
cf_maxtries_sessions, // 55
|
||||||
cf_min_cps_time,
|
cf_min_cps_recv, // 56
|
||||||
cf_min_free_space,
|
cf_min_cps_send, // 57
|
||||||
cf_min_speed_in,
|
cf_min_cps_time, // 58
|
||||||
cf_min_speed_out,
|
cf_min_free_space, // 59
|
||||||
cf_mode_netmail,
|
cf_min_speed_in, // 60
|
||||||
cf_mode_arcmail,
|
cf_min_speed_out, // 61
|
||||||
cf_mode_request,
|
cf_mode_netmail, // 62
|
||||||
cf_mode_ticfile,
|
cf_mode_arcmail, // 63
|
||||||
cf_mode_default,
|
cf_mode_request, // 64
|
||||||
cf_modem_can_send_break,
|
cf_mode_ticfile, // 65
|
||||||
cf_modem_dial_prefix,
|
cf_mode_default, // 66
|
||||||
cf_modem_dial_suffix,
|
cf_modem_can_send_break, // 67
|
||||||
cf_modem_dial_response,
|
cf_modem_dial_prefix, // 68
|
||||||
cf_modem_hangup_command,
|
cf_modem_dial_suffix, // 69
|
||||||
cf_modem_port,
|
cf_modem_dial_response, // 70
|
||||||
cf_modem_reset_command,
|
cf_modem_hangup_command, // 71
|
||||||
cf_modem_stat_command,
|
cf_modem_port, // 72
|
||||||
cf_nodelist,
|
cf_modem_reset_command, // 73
|
||||||
cf_nodelist_directory,
|
cf_modem_stat_command, // 74
|
||||||
cf_nodial_flag,
|
cf_nodelist, // 75
|
||||||
cf_override,
|
cf_nodelist_directory, // 76
|
||||||
cf_options,
|
cf_nodial_flag, // 77
|
||||||
cf_outbound_directory,
|
cf_override, // 78
|
||||||
cf_password,
|
cf_options, // 79
|
||||||
cf_phone,
|
cf_outbound_directory, // 80
|
||||||
cf_phone_translate,
|
cf_password, // 81
|
||||||
cf_proto_order,
|
cf_phone, // 82
|
||||||
cf_recode_file_in,
|
cf_phone_translate, // 83
|
||||||
cf_recode_file_out,
|
cf_proto_order, // 84
|
||||||
cf_recode_intro_in,
|
cf_recode_file_in, // 85
|
||||||
cf_recv_buffer_size,
|
cf_recode_file_out, // 86
|
||||||
cf_rescan_delay,
|
cf_recode_intro_in, // 87
|
||||||
cf_run_after_handshake,
|
cf_recv_buffer_size, // 88
|
||||||
cf_run_after_session,
|
cf_rescan_delay, // 89
|
||||||
cf_run_before_session,
|
cf_run_after_handshake, // 90
|
||||||
cf_session_limit_in,
|
cf_run_after_session, // 91
|
||||||
cf_session_limit_out,
|
cf_run_before_session, // 92
|
||||||
cf_skip_files_recv,
|
cf_session_limit_in, // 93
|
||||||
cf_status_directory,
|
cf_session_limit_out, // 94
|
||||||
cf_system_name,
|
cf_skip_files_recv, // 95
|
||||||
cf_sysop_name,
|
cf_status_directory, // 96
|
||||||
cf_uucp_lock_directory,
|
cf_system_name, // 97
|
||||||
cf_wait_carrier_in,
|
cf_sysop_name, // 98
|
||||||
cf_wait_carrier_out,
|
cf_uucp_lock_directory, // 99
|
||||||
cf_zmodem_mincps_recv,
|
cf_wait_carrier_in, // 100
|
||||||
cf_zmodem_mincps_send,
|
cf_wait_carrier_out, // 101
|
||||||
cf_zmodem_send_dummy_pkt,
|
cf_zmodem_mincps_recv, // 102
|
||||||
cf_zmodem_skip_by_pos,
|
cf_zmodem_mincps_send, // 103
|
||||||
cf_zmodem_start_block_size,
|
cf_zmodem_send_dummy_pkt, // 104
|
||||||
cf_zmodem_tx_window,
|
cf_zmodem_skip_by_pos, // 105
|
||||||
cf_nomail_flag,
|
cf_zmodem_start_block_size, // 106
|
||||||
cf_bind_ip,
|
cf_zmodem_tx_window, // 107
|
||||||
cf_recieved_to_lower,
|
cf_nomail_flag, // 108
|
||||||
|
cf_bind_ip, // 109
|
||||||
|
cf_recieved_to_lower, // 110
|
||||||
#ifdef USE_SYSLOG
|
#ifdef USE_SYSLOG
|
||||||
cf_syslog_facility,
|
cf_syslog_facility,
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cf_debug_file,
|
cf_debug_file, // 111
|
||||||
cf_debug_level,
|
cf_debug_level, // 112
|
||||||
#endif
|
#endif
|
||||||
cf_split_inbound,
|
cf_split_inbound, // 113
|
||||||
#ifdef NETSPOOL
|
#ifdef NETSPOOL
|
||||||
cf_netspool_host,
|
cf_netspool_host,
|
||||||
cf_netspool_port,
|
cf_netspool_port,
|
||||||
#endif
|
#endif
|
||||||
cf_fidodnszone,
|
cf_fidodnszone, // 114
|
||||||
BFORCE_NUMBER_OF_KEYWORDS
|
BFORCE_NUMBER_OF_KEYWORDS
|
||||||
} bforce_config_keyword;
|
} bforce_config_keyword;
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ typedef struct traffic {
|
|||||||
int freqed_num;
|
int freqed_num;
|
||||||
int freqed_time;
|
int freqed_time;
|
||||||
size_t freqed_size;
|
size_t freqed_size;
|
||||||
|
int ticfile_num;
|
||||||
} s_traffic;
|
} s_traffic;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user