Compare commits
193
Commits
5713fedeab
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0ac538e4f | ||
|
|
6fb4ace5cc | ||
|
|
6b73c068a0 | ||
|
|
eead012999 | ||
|
|
981a9aba37 | ||
|
|
901072385e | ||
|
|
926124dffc | ||
|
|
5eb6ddc45b | ||
|
|
144eacc0d6 | ||
|
|
1eacadd453 | ||
|
|
e94fcfc054 | ||
|
|
6bcd460e15 | ||
|
|
0999c65b1a | ||
|
|
72f46f357d | ||
|
|
162a22f0a4 | ||
|
|
81b326ca45 | ||
|
|
7903fd08af | ||
|
|
a2479e18f0 | ||
|
|
4c796b042c | ||
|
|
64cfc794dc | ||
|
|
c5dc00c084 | ||
|
|
22fa90589b | ||
|
|
ccd0e13c05 | ||
|
|
3a9ee4727a | ||
|
|
ff329a7602 | ||
|
|
5a036bb150 | ||
|
|
245f11724d | ||
|
|
4d14e01c68 | ||
|
|
df0c511487 | ||
|
|
f8dd598312 | ||
|
|
c695876504 | ||
|
|
0db3aee60f | ||
|
|
f4d89f2fb2 | ||
|
|
9ac18a21a6 | ||
|
|
537daec883 | ||
|
|
ee9c78d129 | ||
|
|
14d2f2992d | ||
|
|
78aac4f18c | ||
|
|
df5a915287 | ||
|
|
b95128f87a | ||
|
|
6d042318d5 | ||
|
|
cf7208408c | ||
|
|
aae6656a4a | ||
|
|
4297b51dca | ||
|
|
b9e68f295e | ||
|
|
c665ce0aaf | ||
|
|
2807cd61ff | ||
|
|
330da47169 | ||
|
|
1d696c0ba0 | ||
|
|
5a49ebdfe5 | ||
|
|
42246c136f | ||
|
|
d8d953b0b3 | ||
|
|
c91ca40037 | ||
|
|
81bbffb312 | ||
|
|
46dc91c446 | ||
|
|
be3fcc0b5e | ||
|
|
416c79b637 | ||
|
|
6612f8fc89 | ||
|
|
2b63aa8cd7 | ||
|
|
b14e52133d | ||
|
|
07edf66b72 | ||
|
|
8261016c7e | ||
|
|
4d48c2abe9 | ||
|
|
7f7e420b13 | ||
|
|
52b3b230b9 | ||
|
|
416795159f | ||
|
|
04f62c7725 | ||
|
|
ddf8f3f9e0 | ||
|
|
6245ad3e10 | ||
|
|
e3a1f7e52e | ||
|
|
e94fffb110 | ||
|
|
a7cda5b70f | ||
|
|
0d4a4945fe | ||
|
|
c658e03af5 | ||
|
|
57e5e00ca3 | ||
|
|
1f7d70b755 | ||
|
|
3c60f8de01 | ||
|
|
c47397c800 | ||
|
|
224115fffe | ||
|
|
875ea3505f | ||
|
|
d581b113c8 | ||
|
|
a296d43987 | ||
|
|
aa32dac10e | ||
|
|
6a1a0a6838 | ||
|
|
83ce06579c | ||
|
|
8339af8eac | ||
|
|
2477709da4 | ||
|
|
136eca95f1 | ||
|
|
030322225f | ||
|
|
92bd4cae56 | ||
|
|
1837ebd57c | ||
|
|
2eb30b7644 | ||
|
|
7733d5d663 | ||
|
|
6a2320d922 | ||
|
|
5f10b52c77 | ||
|
|
55fc94a95b | ||
|
|
1667d8a800 | ||
|
|
5eced105c8 | ||
|
|
7486b9c141 | ||
|
|
2fbe1d3e54 | ||
|
|
fa8e081584 | ||
|
|
981d4f00b3 | ||
|
|
26ecb8b64c | ||
|
|
526338f720 | ||
|
|
06f48fe1c1 | ||
|
|
4767b57ec9 | ||
|
|
8892e3f740 | ||
|
|
21eeae69cc | ||
|
|
9799f977b9 | ||
|
|
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 | ||
|
|
51034e6e59 | ||
|
|
6235b78239 | ||
|
|
b3f2e1bfc6 | ||
|
|
75aececd6b | ||
|
|
7ad43e1e40 | ||
|
|
0663d62be8 | ||
|
|
ccf473515d | ||
|
|
de81a82f43 | ||
|
|
6ebf2fc7a3 | ||
|
|
2c58629de4 | ||
|
|
721fa8fdf1 | ||
|
|
fdbeb83ab6 | ||
|
|
deafdc34c7 | ||
|
|
7879eb0cdc | ||
|
|
bcf0d456ee | ||
|
|
39dd885dd0 | ||
|
|
8b10d9f48a | ||
|
|
27b4c624b3 | ||
|
|
c2e418676b | ||
|
|
0b2630f624 | ||
|
|
097b39faa7 | ||
|
|
30e860885f | ||
|
|
132a6641f4 | ||
|
|
f80d94413f | ||
|
|
ae156c4689 | ||
|
|
2827504df4 | ||
|
|
c2f9843291 | ||
|
|
d94ba35438 | ||
|
|
a6a1dc2881 | ||
|
|
c766c4a9f7 | ||
|
|
6547b13983 | ||
|
|
89c030d26c | ||
|
|
a01ea3fd63 | ||
|
|
634fc3e3e5 | ||
|
|
ad1776c805 | ||
|
|
59e7a8ddaf | ||
|
|
9325df9e52 | ||
|
|
413bea3d2e | ||
|
|
52228a87bf | ||
|
|
19866b8def | ||
|
|
4a8d737bdf | ||
|
|
91906fca27 | ||
|
|
a31eee639f | ||
|
|
a27bb47b57 | ||
|
|
d9cde2accc | ||
|
|
9383985bf9 |
@@ -0,0 +1,66 @@
|
||||
name: Altlinux build
|
||||
run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} 🚀
|
||||
on:
|
||||
- push
|
||||
- workflow_dispatch
|
||||
if: ${{ github.ref }} == 'refs/head/master'
|
||||
jobs:
|
||||
build-alt:
|
||||
## runs-on: alt-latest
|
||||
container:
|
||||
image: prj.zxalexis.ru/zx/alt-rpmbuild
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
steps:
|
||||
- name: Checking environment
|
||||
continue-on-error: true
|
||||
run: printenv
|
||||
- name: Installing prerequisites - update apt
|
||||
run: apt-get update
|
||||
## - name: Installing prerequisites - install nodejs for actions & git
|
||||
## run: apt-get install -y git nodejs su
|
||||
## - name: Installing build environment
|
||||
## continue-on-error: true
|
||||
## run: |
|
||||
## apt-get install -y gcc rpm-build rpmlint make python gear hasher fakeroot patch rpmdevtools
|
||||
- name: Installing needed software
|
||||
run: apt-get install -y bison tcl
|
||||
- name: Adding build user
|
||||
run: useradd -d /builder -g users -m builder
|
||||
- name: Fetching sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Getting version info
|
||||
run: |
|
||||
echo "BFORCE_VER=$(cat ${{ env.GITHUB_WORKSPACE }}/source/.version)" >> $GITHUB_ENV
|
||||
- name: Compressing source to tar.gz archive
|
||||
run: |
|
||||
tar -cvzf ../bforce-${{ env.BFORCE_VER }}.tar.gz -C ${{ env.GITHUB_WORKSPACE }}/.. bforce
|
||||
cp -v ${{ env.GITHUB_WORKSPACE }}/rpm/bforce.spec /builder/
|
||||
chown builder /builder/bforce.spec
|
||||
echo '-------------------------------------------------------'
|
||||
pwd
|
||||
ls /builder
|
||||
sed -i 's/^# %setup/%setup/' /builder/bforce.spec
|
||||
- name: Building buildtree
|
||||
run: |
|
||||
su - builder -c "cd /builder && mkdir -pv rpmbuild/{RPMS,SRPMS,SOURCES,BUILD,SPECS}"
|
||||
ls /builder -l
|
||||
mkdir -pv /builder/rpmbuild/SOURCES
|
||||
mv ${{ env.GITHUB_WORKSPACE }}/../bforce-${{ env.BFORCE_VER }}.tar.gz /builder/rpmbuild/SOURCES/
|
||||
chown -R builder /builder/*
|
||||
- name: Building binary and source RPM
|
||||
run: |
|
||||
su - builder -c 'rpmbuild -bb /builder/bforce.spec --define "_topdir /builder/rpmbuild"'
|
||||
- name: Constructing artifact name and version
|
||||
run: |
|
||||
echo "BFORCE_VERLONG=$(cat ${{ env.GITHUB_WORKSPACE }}/source/.version)-$(date +%Y%m%d)" >> $GITHUB_ENV
|
||||
- name: Retrieving artifact files
|
||||
run: mkdir bforce && cp /builder/rpmbuild/RPMS/x86_64/bforce-*.rpm bforce
|
||||
- name: Try to upload artifacts bin
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bforce-${{ env.BFORCE_VERLONG }}-Alt
|
||||
path: /builder/rpmbuild/RPMS/x86_64
|
||||
- name: Echo OK
|
||||
run: echo "All OK"
|
||||
@@ -0,0 +1,79 @@
|
||||
name: Archlinux build
|
||||
run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} 🚀
|
||||
on:
|
||||
- push
|
||||
- workflow_dispatch
|
||||
if: ${{ github.ref }} == 'refs/head/master'
|
||||
jobs:
|
||||
build-arch:
|
||||
runs-on: arch-latest
|
||||
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
steps:
|
||||
- name: Checking environment
|
||||
continue-on-error: true
|
||||
run: printenv
|
||||
- name: Installing prerequisites - update pacman
|
||||
run: pacman -Sy
|
||||
- name: Installing prerequisites - install nodejs for actions & git
|
||||
run: pacman --disable-sandbox --noconfirm -v -S git nodejs
|
||||
- name: Adding user builder
|
||||
continue-on-error: true
|
||||
run: useradd -d /builder -g users -m builder
|
||||
- name: Downloading PKGBUILD
|
||||
run: |
|
||||
su - builder -c "curl -O http://zxprj:3001/zx/bforce/raw/branch/master/archlinux/bforce.install"
|
||||
su - builder -c "curl -o PKGBUILD http://zxprj:3001/zx/bforce/raw/branch/master/archlinux/PKGBUILD.ci"
|
||||
- name: Building archlinux package
|
||||
run: |
|
||||
su -w GITHUB_SHA,GITHUB_REF_NAME,GITHUB_REF_TYPE - builder -c makepkg
|
||||
su - builder -c "ls -la"
|
||||
- name: Constructing artifact name and version
|
||||
run: |
|
||||
echo "BFORCE_VER=$(cat /builder/src/bforce/source/.version)-$(date +%Y%m%d)" >> $GITHUB_ENV
|
||||
- name: Retrieving artifact files
|
||||
run: mkdir bforce && cp /builder/bforce-*.pkg.tar.zst bforce
|
||||
- name: Try to upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bforce-${{ env.BFORCE_VER }}-Arch
|
||||
path: bforce
|
||||
make-test:
|
||||
runs-on: arch-latest
|
||||
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
steps:
|
||||
- name: Checking environment
|
||||
continue-on-error: true
|
||||
run: printenv
|
||||
- name: Installing prerequisites - update pacman
|
||||
run: pacman -Sy
|
||||
- name: Installing prerequisites - install nodejs for actions & git
|
||||
run: pacman --disable-sandbox --noconfirm -v -S git nodejs socat
|
||||
- name: Downloading source tree
|
||||
continue-on-error: false
|
||||
uses: actions/checkout@v3
|
||||
- name: Constructing artifact name and version
|
||||
run: |
|
||||
echo "BFORCE_VER=$(cat ${{ github.workspace }}/source/.version)-$(date +%Y%m%d)" >> $GITHUB_ENV
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: bforce-${{ env.BFORCE_VER }}-Arch
|
||||
- name: Display structure of downloaded files
|
||||
run: ls -R
|
||||
- name: Installing archlinux package
|
||||
run: |
|
||||
ls -la
|
||||
pacman --noconfirm -v -U bforce-*.pkg.tar.zst
|
||||
cd ${{ github.workspace }}/tests
|
||||
echo '-----------------------------------------'
|
||||
ls -la
|
||||
- name: Testing package in clean environment
|
||||
run: |
|
||||
cd ${{ github.workspace }}/tests
|
||||
echo '------------>>> TESTING <<<--------------'
|
||||
BFBIN=/usr/bin/bforce ./mktests.sh
|
||||
@@ -0,0 +1,52 @@
|
||||
name: Debian build
|
||||
run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} 🚀
|
||||
on:
|
||||
- push
|
||||
- workflow_dispatch
|
||||
jobs:
|
||||
build-ubuntu:
|
||||
runs-on: ubuntu-latest
|
||||
branches:
|
||||
- 'master'
|
||||
- 'zx'
|
||||
steps:
|
||||
- name: Checking environment
|
||||
continue-on-error: true
|
||||
run: printenv
|
||||
- name: Installing build-essentials
|
||||
continue-on-error: false
|
||||
run: |
|
||||
apt update
|
||||
apt install -y build-essential fakeroot devscripts debhelper pkg-config --no-install-recommends
|
||||
- name: Installing dependencies
|
||||
continue-on-error: false
|
||||
run: |
|
||||
echo '---- bison ----'
|
||||
apt install -y bison
|
||||
echo '---- tcl ------'
|
||||
apt install -y tcl
|
||||
- name: Cloning source
|
||||
uses: actions/checkout@v4
|
||||
- name: Getting version info
|
||||
run: |
|
||||
echo "BFORCE_VER=$(cat ${{ env.GITHUB_WORKSPACE }}/source/.version)-$(date +%Y%m%d)" >> $GITHUB_ENV
|
||||
- name: Building package
|
||||
continue-on-error: false
|
||||
run: |
|
||||
pwd
|
||||
echo '---------------------'
|
||||
cd ${GITHUB_WORKSPACE}/debian
|
||||
ls -l
|
||||
debuild -us -uc -b
|
||||
echo '---build complete---'
|
||||
ls -l ${{ env.GITHUB_WORKSPACE }}/../
|
||||
- name: Collecting artifacts
|
||||
run: |
|
||||
mkdir -pv ${{ env.GITHUB_WORKSPACE }}/artifacts
|
||||
mv -v ${{ env.GITHUB_WORKSPACE }}/../*.deb ${{ env.GITHUB_WORKSPACE }}/artifacts/
|
||||
- name: Try to upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bforce-${{ env.BFORCE_VER }}-Ubuntu
|
||||
path: ${{ env.GITHUB_WORKSPACE }}/artifacts/bforce*.deb
|
||||
- run: echo "This job's over"
|
||||
@@ -0,0 +1,9 @@
|
||||
*.o
|
||||
debian/Makefile
|
||||
source/Makefile
|
||||
source/bin/
|
||||
source/bforce/expression.c
|
||||
source/config.log
|
||||
source/config.status
|
||||
source/include/config.h
|
||||
bforce.geany
|
||||
@@ -0,0 +1,5 @@
|
||||
language: c
|
||||
compiler:
|
||||
- gcc
|
||||
# Change this to your needs
|
||||
script: cd source && ./configure && make
|
||||
@@ -58,3 +58,247 @@
|
||||
then sending/receiving. Recode tables are compartible with HPT. New
|
||||
config keywords: "Recode_file_in", "Recode_file_out", "Recode_intro_in"
|
||||
|
||||
Konstantin Stepanenkov, 2:5030/1251
|
||||
0.22.7.kst1
|
||||
===========
|
||||
|
||||
* Attempt to fix warnings, when compiling with -Wall.
|
||||
+ make update -- install only binaries.
|
||||
* Better EMSI handling, when calling to cisco.
|
||||
+ Correct ZMH support in daemon.
|
||||
* Some fixes in contributed perl scripts.
|
||||
|
||||
0.22.7.kst2
|
||||
===========
|
||||
|
||||
+ Added option --with-uucp-lockdir=... to configure.
|
||||
* Using strncpy(3) instead of strcpy(3) if possible.
|
||||
|
||||
Added patches by Maxi Rovnich @ 2:5030/872:
|
||||
+ Support for maximum 'no dialtone' count.
|
||||
+ Support for download resyncing, while checking for free space.
|
||||
+ Ignore all files, but *.pnt, *.req, *.?lo and *.?ut in BSO.
|
||||
|
||||
0.22.7.kst3
|
||||
===========
|
||||
|
||||
* Compilation failed with --disable-hangup-watch-cd. Fixed.
|
||||
+ Ability to write daemon pid in file.
|
||||
* -f option had reverse meaning. Thanks to Eugene Korovin @ 2:5080/196.72
|
||||
+ -q option terminates daemon process (only if pidfile is used).
|
||||
|
||||
0.22.7.kst4
|
||||
===========
|
||||
|
||||
* Hydra was broken in kst2. Fixed.
|
||||
+ Bidirectional session drops only if rxcps and txcps are less than
|
||||
mincps at the same time.
|
||||
|
||||
0.22.7.kst5
|
||||
===========
|
||||
|
||||
+ port tcpip patch by Serge N. Pokhodyaev @ 2:5020/1838
|
||||
* lock fix, when outbound on not lockable filesystem.
|
||||
Patch by Andrew Dolgov @ 2:5030/394.41
|
||||
|
||||
0.22.7.kst6
|
||||
===========
|
||||
|
||||
* traffic wasn't shown if no files in boxes.
|
||||
Patch by Alexander Shiyan @ 2:5030/39.2
|
||||
* bfstat now correctly shows age of files.
|
||||
Patch by Alexander Shiyan @ 2:5030/39.2
|
||||
* logging 'undefined cmd' fixed.
|
||||
Thanks to Pavel I.Osipov @ 2:5020/770.50
|
||||
|
||||
0.22.8.kst7
|
||||
===========
|
||||
|
||||
Some changes taken from 0.22.8 by Alexander Belkin:
|
||||
* some bugfixes
|
||||
+ new environment variable $RC (session return code)
|
||||
+ sending of EMSI_ACK every time after recving of EMSI_DAT
|
||||
+ support for nodelist IBN flag
|
||||
|
||||
0.22.8.kst8
|
||||
===========
|
||||
|
||||
* fixed bug with flags CM in override
|
||||
* fixed bug with sending HUP to daemon
|
||||
|
||||
Andrey Slusar <anray@users.sourceforge.net>
|
||||
Evgeniy Kozhuhovskiy <e.kozhuhovskiy@gmail.com>
|
||||
Sergey Babitch <vpooh@users.sourceforge.net>
|
||||
|
||||
0.22.8.ugenk1
|
||||
=============
|
||||
+ initial release, based on bforce 0.22.8.kst8
|
||||
* fixed problem with worktime detecting
|
||||
+ makefiles fixed (removed make update, now make install installs config files with extension .sample)
|
||||
+ added --with-user and --with-group options to ``configure'' script.
|
||||
+ installation directories by default are compliance with default fidogate installation
|
||||
|
||||
0.22.8.ugenk2
|
||||
=============
|
||||
* pathes by Andrey Slusar @ 2:467/126
|
||||
(total 12: patch-bforce.c, patch-bfstat.c, patch-daemon.c, patch-expression.y,
|
||||
patch-nlookup.c, patch-prot_binkp.c, patch-prot_emsi.c, patch-prot_yoohoo.c, patch-prot_zmrecv.c,
|
||||
patch-prot_zmsend.c, patch-sess_call.c, patch-sess_stat.c)
|
||||
+ added syslog support (see SYSLOG)
|
||||
+ fixed nlookup (broken in ugenk1)
|
||||
+ spec file now goes with bforce
|
||||
|
||||
0.22.8.ugenk3
|
||||
=============
|
||||
+ fixed working with syslog (not tested yet, any volonteers?)
|
||||
* some bugfixes
|
||||
|
||||
0.22.8.ugenk4
|
||||
=============
|
||||
+ fixed problems with license (thnx to Jonathan Gonzales V. from gnu.org)
|
||||
+ added nomail flag
|
||||
- project moved to sourceforge.net (projectname - binkforce)
|
||||
+ now --enable-syslog is by default! Read SYSLOG for details
|
||||
+ nodelist mask detection (see sample config for details)
|
||||
+ contrib/outman now supports bso (thnx to Andrew Leonov @ 2:4641/500.119)
|
||||
|
||||
0.22.8.ugenk5
|
||||
=============
|
||||
+ fixed ``got unexpected emsi sequence "EMSI_INQC816"''
|
||||
+ added some features to INSTALL.ru
|
||||
* added documentation about incoming sessions over ip/pstn by Igor Mitichev
|
||||
|
||||
0.22.8.ugenk6
|
||||
=============
|
||||
+ some changes in autoconf
|
||||
* added Type to nlookup
|
||||
* fixed 'Ñ' in FAQ
|
||||
* added buggy-emsi option in configure. use it in case of problems with stupid mailers
|
||||
* fixed hydra
|
||||
|
||||
0.22.9
|
||||
======
|
||||
+ Changed version for compliance with *BSD ports
|
||||
+ Added possibility to run external program for each override and
|
||||
hidden. See bforce.subst.sample for examples and
|
||||
docs/readme.txt for details.
|
||||
+ Implement binkp/1.1 (Multiple Batch Mode and Non-reliable Mode).
|
||||
+ Turn on FREQ at binkp sessions.
|
||||
|
||||
fidoman (Sergey Dorofeev)
|
||||
=== 2012-03 ===
|
||||
|
||||
$DEBUGLEVEL, $DEBUGFILE removed - please use configuration options
|
||||
|
||||
DNS zone support
|
||||
|
||||
=== 2012-02 ===
|
||||
|
||||
Netspool support
|
||||
24554 protocol remake
|
||||
|
||||
=== 2011-12-25 ===
|
||||
|
||||
Cmdline processing code is partially rewritten.
|
||||
New key -u for selection proto for IP session.
|
||||
Added code to get node IP address from nodelist (INA flag).
|
||||
Some maybe noisy messages in log added.
|
||||
Some code rearrangements in session_call.
|
||||
Added feature to try all available connection ways if not specified one
|
||||
on calls from command line (IP methods then modem).
|
||||
|
||||
=== 2011-12-15 ===
|
||||
|
||||
Patch io_unix_tio.diff for OpenBSD systems running telnetted serial modem.
|
||||
|
||||
=== 2011-12-13 ===
|
||||
|
||||
Split inbound feature have added.
|
||||
Received files from different links are placed in separate folders in inbound.
|
||||
Use option "split_inbound" to enable this feature.
|
||||
|
||||
|
||||
Alexander Skovpen <a.n.skovpen@gmail.com>
|
||||
Max N. Boyarov <zotrix@users.noreply.github.com>
|
||||
|
||||
|
||||
Alexey Khromov (zx@zxalexis.ru)
|
||||
======
|
||||
0.24.1
|
||||
+ Added pre-init debugging (primarily of config readout) to stderr by -v
|
||||
option. Vanished out errorful calls to "log" and "debug" before log and
|
||||
debug files initialization.
|
||||
+ Fixed build on 64-bit systems (amd64 and aarch64)
|
||||
+ Initially added config options incpkt_flag and incbdl_flag to raise
|
||||
up flag-driven tosser manipulation
|
||||
|
||||
0.24.2
|
||||
+ Fixed environment variables while executing external programs
|
||||
on handshake or session end
|
||||
+ Fixed flags working on arcmail/netmail recieve
|
||||
|
||||
0.25
|
||||
+ EMSI handshake logic reworked to comply with EMSI-II std (FTSC-0088)
|
||||
+ New option: proto_order - dezired protocol order for outgoing calls
|
||||
in EMSI session handshake
|
||||
EMSI-II-compliance works as follows:
|
||||
* if both (caller and callee) expose EII flag - selected proto
|
||||
will be first in caller compat.options compatible with callee
|
||||
* if caller is EMSI-I-compliant and does not show EII flad -
|
||||
selection by callee internal order from compatible with caller
|
||||
+ Changed ifcico protocol port hardcoded to num and not name from
|
||||
/etc/services line (as of abscence of latter)
|
||||
+ Config example reworked to include new options
|
||||
+ New option: emsi_send_tz - to send TZUTC EMSI-handshake part.
|
||||
|
||||
0.25.1
|
||||
+ Added testing script for PSTN comms (tests folder).
|
||||
|
||||
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.
|
||||
+ Fixed binkp override appliance in incoming handshake
|
||||
|
||||
0.26.1
|
||||
+ Fixed binkp stuck on overrides in config
|
||||
+ ReDebianized
|
||||
+ Added CI automation: builds for Archlinux and Ubuntu
|
||||
|
||||
0.26.2
|
||||
+ Added tests with socat and integrate it with CI
|
||||
+ Fixed some minor lint errors by PVS-Studio
|
||||
+ Fixed RPM spec-file to make builds for AltLinux
|
||||
+ Added fail2ban filter to contrib
|
||||
+ Fixed node/point-lists indexing and parsing for points listed
|
||||
|
||||
0.27
|
||||
+ Fixed warnings from PVS-Studio analyser
|
||||
+ Fixed getaddrinfo switching through available ip-addresses
|
||||
+ Reduced SYN-SENT timeout to 3 secs to avoid blocking on hosts with services down
|
||||
+ nlookup - new option -o to show configured overrides and hidden lines
|
||||
+ nlookup - new option -t to show calltable
|
||||
+ Added support for multiply INA: addresses of a node
|
||||
+ Added automatic rolling of all available adresses on callout
|
||||
+ Added automatic rolling of all available hidden phone numbers on callout
|
||||
+ Full rework of overrides in config:
|
||||
* override (not hidden) changes phone,ipaddr and flags (old behaviour - add flags)
|
||||
* hidden flags temporary rolls instead of original
|
||||
* INA in hidden flags sets remote address, protoflags change protocols
|
||||
* ipaddr in hidden flags overwrites original and has max priority
|
||||
* phone in hidden lines do not affect ip callout in case without flags
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
=== 2012-03 ===
|
||||
|
||||
$DEBUGLEVEL, $DEBUGFILE removed - please use configuration options
|
||||
|
||||
DNS zone support
|
||||
|
||||
=== 2012-02 ===
|
||||
|
||||
Netspool support
|
||||
24554 protocol remake
|
||||
|
||||
=== 2011-12-25 ===
|
||||
|
||||
Cmdline processing code is partially rewritten.
|
||||
New key -u for selection proto for IP session.
|
||||
Added code to get node IP address from nodelist (INA flag).
|
||||
Some maybe noisy messages in log added.
|
||||
Some code rearrangements in session_call.
|
||||
Added feature to try all available connection ways if not specified one
|
||||
on calls from command line (IP methods then modem).
|
||||
|
||||
=== 2011-12-15 ===
|
||||
|
||||
Patch io_unix_tio.diff for OpenBSD systems running telnetted serial modem.
|
||||
|
||||
=== 2011-12-13 ===
|
||||
|
||||
Split inbound feature have added.
|
||||
Received files from different links are placed in separate folders in inbound.
|
||||
Use option "split_inbound" to enable this feature.
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
0.22.7.kst1
|
||||
===========
|
||||
|
||||
* Attempt to fix warnings, when compiling with -Wall.
|
||||
+ make update -- install only binaries.
|
||||
* Better EMSI handling, when calling to cisco.
|
||||
+ Correct ZMH support in daemon.
|
||||
* Some fixes in contributed perl scripts.
|
||||
|
||||
0.22.7.kst2
|
||||
===========
|
||||
|
||||
+ Added option --with-uucp-lockdir=... to configure.
|
||||
* Using strncpy(3) instead of strcpy(3) if possible.
|
||||
|
||||
Added patches by Maxi Rovnich @ 2:5030/872:
|
||||
+ Support for maximum 'no dialtone' count.
|
||||
+ Support for download resyncing, while checking for free space.
|
||||
+ Ignore all files, but *.pnt, *.req, *.?lo and *.?ut in BSO.
|
||||
|
||||
0.22.7.kst3
|
||||
===========
|
||||
|
||||
* Compilation failed with --disable-hangup-watch-cd. Fixed.
|
||||
+ Ability to write daemon pid in file.
|
||||
* -f option had reverse meaning. Thanks to Eugene Korovin @ 2:5080/196.72
|
||||
+ -q option terminates daemon process (only if pidfile is used).
|
||||
|
||||
0.22.7.kst4
|
||||
===========
|
||||
|
||||
* Hydra was broken in kst2. Fixed.
|
||||
+ Bidirectional session drops only if rxcps and txcps are less than
|
||||
mincps at the same time.
|
||||
|
||||
0.22.7.kst5
|
||||
===========
|
||||
|
||||
+ port tcpip patch by Serge N. Pokhodyaev @ 2:5020/1838
|
||||
* lock fix, when outbound on not lockable filesystem.
|
||||
Patch by Andrew Dolgov @ 2:5030/394.41
|
||||
|
||||
0.22.7.kst6
|
||||
===========
|
||||
|
||||
* traffic wasn't shown if no files in boxes.
|
||||
Patch by Alexander Shiyan @ 2:5030/39.2
|
||||
* bfstat now correctly shows age of files.
|
||||
Patch by Alexander Shiyan @ 2:5030/39.2
|
||||
* logging 'undefined cmd' fixed.
|
||||
Thanks to Pavel I.Osipov @ 2:5020/770.50
|
||||
|
||||
0.22.8.kst7
|
||||
===========
|
||||
|
||||
Some changes taken from 0.22.8 by Alexander Belkin:
|
||||
* some bugfixes
|
||||
+ new environment variable $RC (session return code)
|
||||
+ sending of EMSI_ACK every time after recving of EMSI_DAT
|
||||
+ support for nodelist IBN flag
|
||||
|
||||
0.22.8.kst8
|
||||
===========
|
||||
|
||||
* fixed bug with flags CM in override
|
||||
* fixed bug with sending HUP to daemon
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
0.22.8.ugenk1
|
||||
=============
|
||||
+ initial release, based on bforce 0.22.8.kst8
|
||||
* fixed problem with worktime detecting
|
||||
+ makefiles fixed (removed make update, now make install installs config files with extension .sample)
|
||||
+ added --with-user and --with-group options to ``configure'' script.
|
||||
+ installation directories by default are compliance with default fidogate installation
|
||||
|
||||
0.22.8.ugenk2
|
||||
=============
|
||||
* pathes by Andrey Slusar @ 2:467/126
|
||||
(total 12: patch-bforce.c, patch-bfstat.c, patch-daemon.c, patch-expression.y,
|
||||
patch-nlookup.c, patch-prot_binkp.c, patch-prot_emsi.c, patch-prot_yoohoo.c, patch-prot_zmrecv.c,
|
||||
patch-prot_zmsend.c, patch-sess_call.c, patch-sess_stat.c)
|
||||
+ added syslog support (see SYSLOG)
|
||||
+ fixed nlookup (broken in ugenk1)
|
||||
+ spec file now goes with bforce
|
||||
|
||||
0.22.8.ugenk3
|
||||
=============
|
||||
+ fixed working with syslog (not tested yet, any volonteers?)
|
||||
* some bugfixes
|
||||
|
||||
0.22.8.ugenk4
|
||||
=============
|
||||
+ fixed problems with license (thnx to Jonathan Gonzales V. from gnu.org)
|
||||
+ added nomail flag
|
||||
- project moved to sourceforge.net (projectname - binkforce)
|
||||
+ now --enable-syslog is by default! Read SYSLOG for details
|
||||
+ nodelist mask detection (see sample config for details)
|
||||
+ contrib/outman now supports bso (thnx to Andrew Leonov @ 2:4641/500.119)
|
||||
|
||||
0.22.8.ugenk5
|
||||
=============
|
||||
+ fixed ``got unexpected emsi sequence "EMSI_INQC816"''
|
||||
+ added some features to INSTALL.ru
|
||||
* added documentation about incoming sessions over ip/pstn by Igor Mitichev
|
||||
|
||||
0.22.8.ugenk6
|
||||
=============
|
||||
+ some changes in autoconf
|
||||
* added Type to nlookup
|
||||
* fixed 'Ñ' in FAQ
|
||||
* added buggy-emsi option in configure. use it in case of problems with stupid mailers
|
||||
* fixed hydra
|
||||
|
||||
0.22.9
|
||||
======
|
||||
+ Changed version for compliance with *BSD ports
|
||||
+ Added possibility to run external program for each override and
|
||||
hidden. See bforce.subst.sample for examples and
|
||||
docs/readme.txt for details.
|
||||
+ Implement binkp/1.1 (Multiple Batch Mode and Non-reliable Mode).
|
||||
+ Turn on FREQ at binkp sessions.
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
BinkleyForce FAQ.
|
||||
|
||||
v. 1.15 от 26 марта 2002.
|
||||
27 апреля 2025
|
||||
|
||||
Q: А как для многолинейки сделать разные строки инициализации?
|
||||
A: /DR/
|
||||
@@ -43,6 +43,8 @@ Q:
|
||||
A: /All/
|
||||
ugenkXX. Брать на http://sourceforge.net/projects/binkforce,
|
||||
или с cvs там же.
|
||||
A: /AK/
|
||||
Переехало оттуда в гит, но лучше искать в профильных эхах.
|
||||
|
||||
Q: Как подключать нодлисты с цифровыми расширениями? Маски в конфиге bforce не
|
||||
задаются.
|
||||
@@ -81,7 +83,7 @@ A: /KAS/
|
||||
/GM/
|
||||
Это мое и лежит оно тyт
|
||||
http://btrieve.virtualave.net/files/bf0224-filebox.diff.rar
|
||||
в моем патче, в отличие от пpедыдyщего, не все подpд имеют тип
|
||||
в моем патче, в отличие от пpедыдyщего, не все подpяд имеют тип
|
||||
TYPE_FILEBOX.
|
||||
мыло - это TYPE_NETMAIL, эхи - TYPE_ARCMAIL и т.д.
|
||||
Это yдобно дл пpосмотpа статистики поинтy - что на него лежит.
|
||||
@@ -101,17 +103,55 @@ A: /AB/
|
||||
Hу что-нибудь вроде:
|
||||
override 2:5020/??? phone none ipaddr f???.n5020.z2.fidonet.net
|
||||
Еще можно добавить флаги: BINKP - дл BinkP или IFC - для EMSI/..
|
||||
A: /AK/
|
||||
Формат override-строки такой:
|
||||
override <фидоадрес> [hidden] [Phone <тлф>] [Ipaddr <dns|ip>] [Flags <флаги>]
|
||||
ip-адрес/днс-имя сервера можно подменить как через Ipaddr, так и через
|
||||
флаги, поставив INA:адрес
|
||||
|
||||
Пример override:
|
||||
1) [флаги нодлиста: CM,IBN,INA:coolbbs.spb.ru,INA:cool2.spb.ru,BEER:lager]
|
||||
override 2:5030/xxx hidden Flags IFC,INA:reservbbs.dyndns.org \
|
||||
hidden Ipaddr 188.34.34.22 \
|
||||
hidden Ipaddr 234.43.44.23 Flags IFC,CM
|
||||
|
||||
Порядок дозвона (до первого успешного установления сессии):
|
||||
1. coolbbs.spb.ru:binkp
|
||||
2. reservbbs.dyndns.org:ifcico
|
||||
3. 188.34.34.22:binkp
|
||||
4. 234.43.44.23:ifcico
|
||||
5. cool2.spb.ru:binkp
|
||||
|
||||
2) [флаги нодлиста: CM,IBN,IFC,INA:coolbbs3.spb.ru,BEER:porter]
|
||||
override 2:5030/xxx Phone None Flags IFC,INA:rybak3.dyndns.org \
|
||||
hidden Ipaddr 188.34.35.22
|
||||
|
||||
Порядок дозвона (до первого успешного установления сессии):
|
||||
1. rybak3.dyndns.org:ifcico
|
||||
3. 188.34.35.22:ifcico
|
||||
override без опции hidden заменяет нодлистовые поля!
|
||||
|
||||
Проверить настроенные override-s и порядок дозвона можно с помощью
|
||||
программы nlookup: опция -o показывает override, опция -t - порядок
|
||||
дозвона (IP+PSTN)
|
||||
|
||||
Q: Демон забивает на указание ip...и звонит по нодлистовому телефону. Вот как
|
||||
это пофиксить?
|
||||
A: /AB/
|
||||
Это бага така. Для этого и прописываетс "phone none".
|
||||
A: /AK/
|
||||
Приоритеты c версии 0.26.x за ip-дозвоном, демон для ip-узлов не
|
||||
производит дозвон, для PSTN-only - не ищет ip-адрес. При ручном дозвоне
|
||||
используются все способы соединения из нодлиста, сначала IP, потом модем
|
||||
|
||||
Q: Я не понял, почему aftersession запускается, когда еще есть bsy?! Весь
|
||||
нужный эффект теряется (bforce 0.22.3).
|
||||
A: /AB/
|
||||
Почему теряется? Он же в отдельной сессии запускаться может и бфорсу не
|
||||
обязательно ждать его завершения.
|
||||
A: /AK/
|
||||
aftersession запускается, когда уже есть принятый пакет в inbound.
|
||||
процесс получает значения переменных окружения от демона
|
||||
|
||||
Q: subst'ы было бы неплохо расширить т.к. очень не хватает AT~S91=7~DP :-(
|
||||
A: /SNP/
|
||||
@@ -122,7 +162,7 @@ Q:
|
||||
A: /SNP/
|
||||
inbound_directory (Protected) /var/spool/fido/inb-protected
|
||||
inbound_directory /var/spool/fido/inb
|
||||
Прим.: начина с 0.22.3 пример конфига имеет аналогичный порядок.
|
||||
Прим.: начиная с 0.22.3 пример конфига имеет аналогичный порядок.
|
||||
|
||||
Q: Статистику после сессии собрать так и не смог. Пишет: "can't get modem
|
||||
statistic: Modem not response". Модем IDC-2814BXL/VR+.
|
||||
@@ -140,7 +180,7 @@ A: /AB/
|
||||
fido stream tcp nowait root /usr/bin/bforce bforce -i auto
|
||||
|
||||
Q: А как бы сделать так, чтобы можно было прописать другую директорию для
|
||||
локов? У мен, например, они в /var/spool/lock лежат...
|
||||
локов? У меня, например, они в /var/spool/lock лежат...
|
||||
A: /AB/
|
||||
Либо поправить autoconf (configure.in), либо ручками в config.h прописать.
|
||||
/EK/
|
||||
@@ -159,6 +199,8 @@ A: /AB/
|
||||
Q: Пример конфига 'override 2:5029/9 Phone Unpublished' не работает :-(
|
||||
A: /VS/
|
||||
override 2:5029/9 Phone None
|
||||
A: /AK/
|
||||
Уже работает
|
||||
|
||||
Q: У меня прописано несколько hidden'ов, но bforce упорно звонит только по
|
||||
одному из них.
|
||||
@@ -167,6 +209,8 @@ A: /PVC/
|
||||
UUE. Также доступен для фреков на 2:5020/2091 как
|
||||
bforce-0.22.4-0.22.4pl2.diff.bz2. Время для фреков c 1:00 до 5:20, c
|
||||
7:40-9:00.
|
||||
A: /AK/
|
||||
Исправлено в 0.27
|
||||
|
||||
Q: Подскажите, пожалyйста, как запpетить непаpольные соединения.
|
||||
A: /AB/
|
||||
@@ -208,6 +252,9 @@ A: /AS/
|
||||
| /var/src/cvs/bforce/ > grep -r 'BFCONFIG' ./
|
||||
| ./source/bforce/conf_read.c: const char *name = getenv("BFCONFIG");
|
||||
`----
|
||||
A: /AK/
|
||||
Опция -с <config> для всех программ комплекта
|
||||
|
||||
===
|
||||
|
||||
Thanx to:
|
||||
@@ -223,6 +270,7 @@ MR = Maxi Rovnich, 2:5030/872
|
||||
PVC = Peter V. Chernikoff, 2:5020/2091
|
||||
SNP = Serge N. Pokhodyaev, 2:5020/1838
|
||||
VS = Valery Shishkov, 2:5040/9
|
||||
AK = Alexey Khromov, 2:5030/723
|
||||
|
||||
Исправления и добавления в виде пар вопрос/ответ будут с благодарностью приняты
|
||||
в netmail.
|
||||
|
||||
@@ -1,4 +1,35 @@
|
||||
Basic Installation
|
||||
Prerequisites
|
||||
====================
|
||||
|
||||
C compiler (GCC in linux and clang in BSD will work well)
|
||||
make
|
||||
yacc or it's GNU's recreation named bison
|
||||
Tcl optional for a couple of scripts
|
||||
|
||||
Installing with packages
|
||||
=
|
||||
|
||||
Debian-based systesms (Debian, *buntu, Mint, Astra)
|
||||
====================
|
||||
|
||||
Install build system for packaging:
|
||||
|
||||
apt install build-essential fakeroot devscripts debhelper pkg-config
|
||||
apt install bison tcl
|
||||
|
||||
Use debuild to make deb-s:
|
||||
|
||||
cd <SRCDIR>/debian
|
||||
debuild -us -uc -b
|
||||
|
||||
RPM-based systems (RHEL, CentOS, Altlinux, SimplyLinux, RedOS)
|
||||
=====================
|
||||
|
||||
mkdir -p ./rpmbuild/{RPMS,BUILD}
|
||||
rpmbuild -bb <SRCDIR>/rpm/bforce.spec --define "_topdir $( pwd )/rpmbuild" --define "_builddir <SRCDIR>/source"
|
||||
|
||||
|
||||
Manual Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
+54
-14
@@ -1,37 +1,58 @@
|
||||
В этом файле описывается процесс установки и настройки
|
||||
фидонет-совместимого мейлера bforce 0.22.8.ugenk1.
|
||||
фидонет-совместимого мейлера bforce 0.xx.
|
||||
|
||||
В данном документе приняты следующие обозначения:
|
||||
|
||||
<SRCDIR> - путь, куда вы распаковали тарболл с исходными
|
||||
текстами bforce 0.22.8.ugenk1 (далее bforce)
|
||||
<SRCDIR> - путь, куда вы распаковали тарболл с исходными текстами
|
||||
bforce 0.xx (далее bforce)
|
||||
Тарболл - файл с расширением tar.gz, или tar.bz2
|
||||
|
||||
|
||||
Требования к системе
|
||||
====================
|
||||
|
||||
Для компиляции bforce вам потребуется компилятор (для
|
||||
gnu/bsd-систем gcc), так же GNU make (make для линукс,
|
||||
gmake для bsd).
|
||||
Для компиляции bforce вам потребуется компилятор с языка С,
|
||||
так же GNU make (make для линукс, gmake для bsd) и yacc (в linux -
|
||||
bison). Опционально - tcl
|
||||
|
||||
Обратитесь к документации по вашей системе того, что бы
|
||||
узнать как установить вышеперечисленное программное обеспечение.
|
||||
Создание пакета
|
||||
=
|
||||
|
||||
Debian-based системы (Debian, *buntu, Mint, Astra)
|
||||
====================
|
||||
|
||||
Установка программ и набора скриптов для сборки пакетов:
|
||||
|
||||
apt install build-essential fakeroot devscripts debhelper pkg-config
|
||||
apt install bison tcl
|
||||
|
||||
Для создания пакета из скачанных исходников достаточно воспользоваться
|
||||
командой debuild:
|
||||
|
||||
cd <SRCDIR>/debian
|
||||
debuild -us -uc -b
|
||||
|
||||
RPM-based системы (RHEL, CentOS, Altlinux, SimplyLinux, RedOS)
|
||||
=====================
|
||||
|
||||
mkdir -p ./rpmbuild/{RPMS,BUILD}
|
||||
rpmbuild -bb <SRCDIR>/rpm/bforce.spec --define "_topdir $( pwd )/rpmbuild" --define "_builddir <SRCDIR>/source"
|
||||
|
||||
Установка вручную
|
||||
=
|
||||
|
||||
Процесс компиляции
|
||||
==================
|
||||
|
||||
Распакуйте тарболл следующими командами:
|
||||
|
||||
gzip -d bforce-0.22.8.ugenk1.tar.gz
|
||||
gzip -d bforce-master.tar.gz
|
||||
или
|
||||
bzip2 -d bforce-0.22.8.ugenk1.tar.bz2
|
||||
bzip2 -d bforce-master.tar.bz2
|
||||
|
||||
tar -xvf bforce-0.22.8.ugenk1.tar
|
||||
tar -xvf bforce-master.tar
|
||||
|
||||
Перейдите в директорию bforce-0.22.8.ugenk1/source:
|
||||
cd <SRCDIR>/bforce-0.22.8.ugenk1/source
|
||||
Перейдите в директорию bforce/source:
|
||||
cd <SRCDIR>/bforce/source
|
||||
|
||||
Для создания Makefile, который наиболее подходит к вашей
|
||||
системе, наберите:
|
||||
@@ -76,6 +97,11 @@ gmake install
|
||||
Настройка
|
||||
=========
|
||||
|
||||
Рекомендуется установить системную переменную BFCONFIG,
|
||||
указывающую на местоположение конфигурации bforce.
|
||||
Проще всего через /etc/environment для общесистемной или
|
||||
.profile для переменной пользователя.
|
||||
|
||||
Для нормальной работы вам нужно отредактировать конфигурационные файлы
|
||||
bforce. По умолчанию они находятся в /usr/local/fido/etc и называются
|
||||
bforce.conf - основной конфигурационный файл bforce
|
||||
@@ -125,6 +151,19 @@ cat `which mgetty` |strings |grep FIDO |wc -l
|
||||
|
||||
где news - это пользователь, из-под которого у вас работает ftn-подсистема.
|
||||
|
||||
Bforce при ИСХОДЯЩИХ звонках использует файлы блокировки порта модема,
|
||||
при несовпадении каталога или невозможности создания файла
|
||||
mgetty сбросит модем во время звонка.
|
||||
Поэтому настоятельно рекомендуется проверить права на папку /var/lock
|
||||
и то, на какой ФС она расположенв.
|
||||
Современные системы имеют тенденцию к применению /var/lock как ссылки
|
||||
на /run/lock, а ФС /run монтируется и создается на tmpfs при каждой
|
||||
загрузке с помощью systemd-tempfiles.
|
||||
Для изменения поведения необходимо создать файл в /etc/tempfiles.d/,
|
||||
совпадающим (за исключением части имени -part) c именем файла в
|
||||
/usr/lib/systemd/systemd-tempfiles.d.
|
||||
Рабочий пример legacy-part.conf в папке contrib.
|
||||
|
||||
Совместная работа с inetd/xinetd
|
||||
================================
|
||||
К сожалению (или к счастью), bforce не умеет самостоятельно принимать входящие
|
||||
@@ -150,6 +189,7 @@ init.d/bforce - init-
|
||||
bfha - bforce history analyzer (bfha)
|
||||
bfha/README - bfha README
|
||||
bfha/bfha.pl - собственно, bfha
|
||||
legacy-part.conf - файл для донастройки прав на /run/lock в systemd
|
||||
u-srif - продвинутый freq-процессор
|
||||
u-srif/u-srif-index.py \ с поддержой отчетов,
|
||||
u-srif/u-srif-lookup.py \ ограничений,
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
$Id$:
|
||||
|
||||
BinkleyForce FTN mailer
|
||||
-----------------------
|
||||
|
||||
BinkleyForce is a simple ifcico like FTN mailer. It can works via
|
||||
TCP/IP as well as on modem links. Look sample configs for more
|
||||
information.
|
||||
|
||||
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)
|
||||
any later version. See the COPYING file for further information.
|
||||
|
||||
Known Bugs
|
||||
----------
|
||||
- BinkD use and expect local file time at BinkP sessions, but
|
||||
BinkleyForce allways use UTC time (?)
|
||||
|
||||
Bug Reports
|
||||
-----------
|
||||
|
||||
E-Mail : adb@newmail.ru
|
||||
FidoNet : Alexander Belkin, 2:5020/1398.11
|
||||
|
||||
New Versions
|
||||
------------
|
||||
|
||||
http://adb.newmail.ru
|
||||
|
||||
|
||||
Copyright (c) 1998-2000 Alexander Belkin, Moscow, Russia.
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
BinkleyForce FTN mailer (Branch KST)
|
||||
------------------------------------
|
||||
|
||||
Bug Reports
|
||||
-----------
|
||||
|
||||
E-Mail : kst@moecho.org
|
||||
FidoNet : Konstantin Stepanenkov, 2:5030/1251
|
||||
|
||||
New Versions
|
||||
------------
|
||||
|
||||
http://kst.spb.ru/bforce/
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||

|
||||

|
||||

|
||||
|
||||
BinkleyForce FTN mailer
|
||||
-----------------------
|
||||
|
||||
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)
|
||||
any later version. See the COPYING file for further information.
|
||||
|
||||
Known Bugs
|
||||
----------
|
||||
|
||||
~~BinkleyForce has no support (yet) for multiple INA: addresses~~
|
||||
~~Can not rotate hidden lines~~
|
||||
~~Can not rotate supported IP protocols in case of failure~~
|
||||
|
||||
- Can not (yet) apply flags to hidden phone lines.
|
||||
|
||||
Bug Reports
|
||||
-----------
|
||||
|
||||
E-Mail : zx@zxalexis.ru
|
||||
FidoNet : Alexey Khromov, 2:5030/723
|
||||
|
||||
New Versions
|
||||
------------
|
||||
|
||||
https://prj.zxalexis.ru/gitea/zx/bforce
|
||||
|
||||
SAST Tools
|
||||
----------
|
||||
[PVS-Studio](https://pvs-studio.com/pvs-studio/?utm_source=website&utm_medium=github&utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code.
|
||||
|
||||
Older Sources
|
||||
-------------
|
||||
https://github.com/zotrix/binkleyforce/
|
||||
https://sourceforge.net/projects/binkforce/
|
||||
|
||||
Copyright <br>
|
||||
> (c) 1998-2000 Alexander Belkin, Moscow, Russia.<br>
|
||||
> (c) 2004-2007 Evgeniy Kozhuhovskiy 2:450/256, 2:450/267<br>
|
||||
> (c) 2005 Andrey Slusar<br>
|
||||
> (c) 2006-2016 Max N. Boyarov<br>
|
||||
> (c) 2007-2008 Sergey Babitch<br>
|
||||
> (c) 2011-2014 Sergey Dorofeev<br>
|
||||
> (c) 2014 Alexander Skovpen<br>
|
||||
> (c) 2024-2025 Alexey Khromov<br>
|
||||
@@ -1,14 +0,0 @@
|
||||
BinkleyForce FTN mailer (Branch ugenk)
|
||||
------------------------------------
|
||||
|
||||
Bug Reports
|
||||
-----------
|
||||
|
||||
E-Mail : e.kozhuhovskiy@gmail.com
|
||||
FidoNet : Evgeniy Kozhuhovskiy, 2:450/256, 2:450/267
|
||||
|
||||
New Versions
|
||||
------------
|
||||
|
||||
http://ugenk.bas-net.by/
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
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}/usr/share/man/man1
|
||||
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 ${srcdir}/${pkgname}/man/*.1 ${pkgdir}/usr/share/man/man1/
|
||||
/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,64 @@
|
||||
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}"
|
||||
git checkout "${GITHUB_SHA}"
|
||||
printf "$( pwd )\n"
|
||||
}
|
||||
|
||||
pkgver() {
|
||||
cd "$pkgname"
|
||||
if [ "${GITHUB_REF_TYPE}" = "tags" ]; then
|
||||
printf "v%s" "${GITHUB_REF_NAME}"
|
||||
else
|
||||
printf "r%s.%s.%s" "$(git rev-list --count ${GITHUB_SHA})" "$(git rev-parse --short ${GITHUB_SHA})" "${GITHUB_REF_NAME}"
|
||||
fi
|
||||
}
|
||||
|
||||
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}/usr/share/man/man1
|
||||
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 ${srcdir}/${pkgname}/man/*.1 ${pkgdir}/usr/share/man/man1/
|
||||
/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
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
# Fail2Ban filter for bforce bf-log.tcpip log file
|
||||
# Detecting unauthorized access
|
||||
# Typically logged in /var/log/bforce/bf-debug
|
||||
|
||||
# Apr 10 17:34:20 [944134] TCP/IP connect from 72.138.46.4 on port 5590
|
||||
# Apr 10 17:34:21 [944134] Session ended up, rc=21, inetd=1
|
||||
# Apr 10 17:34:21 [944134] session rc = 21 ("Cannot handshake with remote")
|
||||
# Apr 10 17:34:21 [944135] Answering TCPIP call...
|
||||
# Apr 10 17:34:21 [944135] TCP/IP connect from 72.138.46.4 on port 7714
|
||||
# Apr 10 17:34:21 [944135] Session ended up, rc=21, inetd=1
|
||||
# Apr 10 17:34:21 [944135] session rc = 21 ("Cannot handshake with remote")
|
||||
|
||||
[INCLUDES]
|
||||
|
||||
# Read common prefixes. If any customizations available -- read them from
|
||||
# common.local
|
||||
before = common.conf
|
||||
|
||||
[Init]
|
||||
maxlines = 5
|
||||
|
||||
[Definition]
|
||||
prefregex = \[<F-MLFID>\d+</F-MLFID>\] TCP/IP connect from <HOST> on port \d+$
|
||||
failregex = session rc \= 21
|
||||
ignoreregex =
|
||||
@@ -0,0 +1,8 @@
|
||||
[bforce]
|
||||
enabled = true
|
||||
port = 24554,60179
|
||||
filter = bforce
|
||||
logpath = /opt/fidonms/logs/bf-log.tcpip
|
||||
maxretry = 5
|
||||
findtime = 60
|
||||
bantime = 600
|
||||
@@ -0,0 +1,19 @@
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See tmpfiles.d(5) for details
|
||||
|
||||
# These files are considered legacy and are unnecessary on legacy-free
|
||||
# systems.
|
||||
|
||||
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.
|
||||
|
||||
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 /etc/bforce/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 /etc/bforce/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 /etc/bforce/bforce.conf -i auto
|
||||
}
|
||||
Vendored
-263
@@ -1,263 +0,0 @@
|
||||
# Makefile.in generated by automake 1.8.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = ../debian
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES)
|
||||
mkinstalldirs = $(mkdir_p)
|
||||
CONFIG_HEADER = $(top_builddir)/include/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
DEFS = @DEFS@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GROUP = @GROUP@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
OBJEXT = @OBJEXT@
|
||||
OWNER = @OWNER@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SHELL = @SHELL@
|
||||
YACC = @YACC@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
|
||||
# $Id$
|
||||
EXTRA_DIST = copyright changelog rules conffiles \
|
||||
control dirs init.d
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ../debian/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu ../debian/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
uninstall-info-am:
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
bforce for Debian
|
||||
-----------------
|
||||
|
||||
See CHANGES.ugenk
|
||||
|
||||
-- Evgeniy Kozhuhovskiy <e.kozhuhovskiy@gmail.com>, Thu Feb 10 23:54:48 2005
|
||||
Vendored
+39
@@ -1,3 +1,42 @@
|
||||
bforce (0.27.1) UNRELEASED; urgency=medium
|
||||
|
||||
* Fixed build under GCC15
|
||||
|
||||
-- Alexey Khromov <zx@zxalexis.ru> Sun, 22 Mar 2026 19:19:54 +0300
|
||||
|
||||
bforce (0.27) UNRELEASED; urgency=medium
|
||||
|
||||
* Fixed warnings from PVS-Studio analyser
|
||||
* Fixed getaddrinfo switching through available ip-addresses
|
||||
* Reduced SYN-SENT timeout to 3 secs to avoid blocking on hosts with services down
|
||||
* nlookup - new option -o to show configured overrides and hidden lines
|
||||
* nlookup - new option -t to show calltable
|
||||
* Added support for multiply INA: addresses of a node
|
||||
* Added automatic rolling of all available adresses on callout
|
||||
* Added automatic rolling of all available hidden phone numbers on callout
|
||||
* Full rework of overrides in config
|
||||
|
||||
-- Alexey Khromov <zx@zxalexis.ru> Sat, 26 Apr 2025 21:19:54 +0300
|
||||
|
||||
bforce (0.26.2) UNRELEASED; urgency=medium
|
||||
|
||||
* Added tests to CI actions
|
||||
* Fixed nodelist indexing for points handling
|
||||
|
||||
-- Alexey Khromov <zx@zxalexis.ru> Sat, 19 Apr 2025 07:43:54 +0300
|
||||
|
||||
bforce (0.26.1) UNRELEASED; urgency=medium
|
||||
|
||||
* Fixed for ubuntu/debian builds and CI actions
|
||||
|
||||
-- Alexey Khromov <zx@zxalexis.ru> Sun, 13 Apr 2025 20:06:54 +0300
|
||||
|
||||
bforce (0.26) UNRELEASED; urgency=medium
|
||||
|
||||
* Fixed for IPv6 and build on amd64 and aarch64 platforms
|
||||
|
||||
-- Alexey Khromov <zx@zxalexis.ru> Sun, 13 Apr 2025 12:53:54 +0000
|
||||
|
||||
bforce (0.22.9-3) unstable; urgency=low
|
||||
|
||||
* fixes in init.d script
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
4
|
||||
3
|
||||
|
||||
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
/etc/bforce/bforce.conf
|
||||
/etc/bforce/bforce.subst
|
||||
/etc/bforce/bforce.passwd
|
||||
/etc/bforce/freq.dirs
|
||||
/etc/bforce/freq.aliases
|
||||
|
||||
Vendored
+2
-2
@@ -1,13 +1,13 @@
|
||||
Source: bforce
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Evgeniy Kozhuhovskiy <e.kozhuhovskiy@gmail.com>
|
||||
Maintainer: Alexey Khromov <zx@zxalexis.ru>
|
||||
Build-Depends: debhelper (>> 3.0.0), bison (>> 1.0.0)
|
||||
Standards-Version: 3.5.10
|
||||
|
||||
Package: bforce
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Depends: ${shlibs:Depends}, tclsh:any
|
||||
Description: Binkey Force FTN mailer
|
||||
FTN mailer is a program that transmit files (netmail and echomail)
|
||||
between your FTN node and other.
|
||||
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
usr/bin
|
||||
usr/lib/bforce
|
||||
usr/lib/systemd/system
|
||||
etc/bforce
|
||||
etc/default
|
||||
etc/default/bforce
|
||||
|
||||
Vendored
+2
-6
@@ -1,9 +1,5 @@
|
||||
README
|
||||
README.kst
|
||||
README.ugenk
|
||||
README.md
|
||||
TODO
|
||||
CHANGES
|
||||
CHANGES.kst
|
||||
CHANGES.ugenk
|
||||
INSTALL
|
||||
INSTALL.ru
|
||||
SYSLOG
|
||||
|
||||
Vendored
+9
-9
@@ -26,15 +26,15 @@ set -e
|
||||
case "$1" in
|
||||
configure)
|
||||
|
||||
if ! grep -s news /etc/group >/dev/null 2>&1; then
|
||||
addgroup --system news
|
||||
fi
|
||||
|
||||
if ! id uucp >/dev/null 2>&1; then
|
||||
adduser --system --disabled-password uucp
|
||||
chsh -s /bin/sh uucp
|
||||
adduser uucp dialout
|
||||
fi
|
||||
# if ! grep -s news /etc/group >/dev/null 2>&1; then
|
||||
# addgroup --system news
|
||||
# fi
|
||||
#
|
||||
# if ! id uucp >/dev/null 2>&1; then
|
||||
# adduser --system --disabled-password uucp
|
||||
# chsh -s /bin/sh uucp
|
||||
# adduser uucp dialout
|
||||
# fi
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
|
||||
Vendored
+6
-7
@@ -6,8 +6,7 @@
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
# This is the debhelper compatibility version to use.
|
||||
export DH_COMPAT=3
|
||||
|
||||
export DH_COMPAT=11
|
||||
|
||||
PACKAGE = bforce
|
||||
|
||||
@@ -49,7 +48,7 @@ clean:
|
||||
rm -f build-stamp configure-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) -C source clean
|
||||
# -$(MAKE) -C source clean
|
||||
dh_clean
|
||||
rm -f source/config.cache source/include/config.h source/config.log\
|
||||
source/config.status source/Makefile
|
||||
@@ -57,7 +56,7 @@ clean:
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_prep
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/bforce.
|
||||
@@ -74,7 +73,7 @@ install: build
|
||||
/usr/bin/install -c -m 600 -o $(USER) -g $(GROUP) examples/bforce.passwd $(CURDIR)/debian/bforce/etc/bforce/bforce.passwd
|
||||
/usr/bin/install -c -m 644 -o $(USER) -g $(GROUP) examples/freq.aliases $(CURDIR)/debian/bforce/etc/bforce/freq.aliases
|
||||
/usr/bin/install -c -m 644 -o $(USER) -g $(GROUP) examples/freq.dirs $(CURDIR)/debian/bforce/etc/bforce/freq.dirs
|
||||
|
||||
/usr/bin/install -c -m 660 contrib/systemd/bforce.service $(CURDIR)/debian/bforce/usr/lib/systemd/system/bforce.service
|
||||
/usr/bin/install $(CURDIR)/debian/bfha.def $(CURDIR)/debian/bforce/etc/default/bforce/bfha
|
||||
/usr/bin/install $(CURDIR)/contrib/bfha/bfha-debian.pl $(CURDIR)/debian/bforce/usr/lib/bforce/bfha.pl
|
||||
|
||||
@@ -92,8 +91,8 @@ binary-arch: build install
|
||||
# dh_installlogrotate
|
||||
dh_installinit
|
||||
# dh_installcron
|
||||
dh_installman $(CURDIR)/debian/bfindex.1 $(CURDIR)/debian/bforce.1 \
|
||||
$(CURDIR)/debian/bfstat.1 $(CURDIR)/debian/nlookup.1
|
||||
dh_installman $(CURDIR)/man/bfindex.1 $(CURDIR)/man/bforce.1 \
|
||||
$(CURDIR)/man/bfstat.1 $(CURDIR)/man/nlookup.1 $(CURDIR)/man/outman.1
|
||||
# dh_installinfo
|
||||
dh_installchangelogs CHANGES
|
||||
dh_link
|
||||
|
||||
+46
-4
@@ -63,6 +63,12 @@ address 20:26/100.0@easynet
|
||||
#
|
||||
options NoDirZap NoJanus NoChat
|
||||
|
||||
# Protocol order for outgoing EMSI calls
|
||||
# Tolerant to Options (i.e. you can order all kind of protos
|
||||
# as of TZA,KER,JAN and SLK are not supported at all
|
||||
# Default: HYD,JAN,DZA,ZAP,ZMO,TZA,SLK,KER
|
||||
proto_order HYD,ZMO,ZAP,DZA,JAN,TZA,KER,SLK
|
||||
|
||||
#
|
||||
# Domain outbounds
|
||||
# Domain <domain_name> <outbound_dir> <zone>
|
||||
@@ -78,8 +84,8 @@ options NoDirZap NoJanus NoChat
|
||||
#log_file /var/log/bforce/bf-log
|
||||
|
||||
# Debugging information completness level. Debugging is disabled by
|
||||
# default. Allowed debug levels: config, nodelist, outbound, info, hshake,
|
||||
# ttyio, modem, prot, freq, daemon, full
|
||||
# default. Allowed debug levels: config, override, event, nodelist, outbound,
|
||||
# info, hshake, ttyio, modem, prot, freq, statem, daemon, 24554, free, full
|
||||
|
||||
#debug_file /var/log/bforce/bf-debug
|
||||
#debug_level info hshake prot
|
||||
@@ -91,6 +97,18 @@ options NoDirZap NoJanus NoChat
|
||||
#
|
||||
nodial_flag /etc/nodial
|
||||
|
||||
#
|
||||
# Incoming flags
|
||||
# Netmail:
|
||||
#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
|
||||
#
|
||||
@@ -102,13 +120,13 @@ split_inbound yes
|
||||
#
|
||||
# Path to your 4D outbound (use zone as extension)
|
||||
#
|
||||
#outbound_directory /var/spool/fido/bt/out
|
||||
outbound_directory /var/spool/fido/bt/out
|
||||
|
||||
#
|
||||
# Path to your AmigaDos style 4D outbound.
|
||||
# (You can use all outbound styles at the same time)
|
||||
#
|
||||
amiga_outbound_directory /var/spool/fido/bt/out
|
||||
#amiga_outbound_directory /var/spool/fido/bt/out
|
||||
|
||||
#
|
||||
# Directory with your nodelists (for nodelist without full path)
|
||||
@@ -246,6 +264,10 @@ mode_request 100660
|
||||
# '~' 1 second delay
|
||||
# '`' 1/4 second delay
|
||||
|
||||
# Modem lock directory (/var/lock as in FHS-3.0
|
||||
# if you have it on tmpfs by systemd - read INSTALL.ru)
|
||||
# uucp_lock_directory /var/lock
|
||||
|
||||
#
|
||||
# Yor modem devices names (will use first not locked one)
|
||||
# ModemDev <device>[<:lock_speed>]
|
||||
@@ -335,6 +357,9 @@ max_speed 57600
|
||||
flags XW,V34B,IDC,LMD
|
||||
emsi_OH_time 22:00-07:30
|
||||
emsi_FR_time 22:30-05:30
|
||||
#emsi_send_tz no
|
||||
#emsi_send_time no
|
||||
|
||||
|
||||
#
|
||||
# Our receiver buffer size [bytes]
|
||||
@@ -435,6 +460,23 @@ skip_files_recv *.pif *.swp
|
||||
# setsid - run command in a new session
|
||||
# useshell - run command by calling a shell (/bin/sh)
|
||||
#
|
||||
# Bforce will make environment for external programs
|
||||
# which include these variables:
|
||||
# $REM_ADDR_FTN - remote ftn address
|
||||
# $REM_ADDR_INET - remote inet address
|
||||
# $LOC_ADDR_FTN - local ftn address
|
||||
# $LOC_ADDR_INET - local inet address
|
||||
# $PASSWORD - session password
|
||||
# $MAILER - remote mailer
|
||||
# $LOCATION - remote location
|
||||
# $SYSOP - remote SysOp name
|
||||
# $SYSTEM_NAME - remote station name
|
||||
# $PHONE - remote phone
|
||||
# $FLAGS - remote flags
|
||||
# $PROTECTED - password protected on both sides
|
||||
# $LISTED - present in nodelist
|
||||
# $INBOUND - current inbound path for this remote
|
||||
#
|
||||
#run_after_handshake [logout]/bin/echo "Hello, world!"
|
||||
#run_after_session [nowait,setsid]/usr/local/lib/ftp/run-in
|
||||
#
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.SH NAME
|
||||
bfindex \- nodelist compiler for bforce
|
||||
.SH SYNOPSYS
|
||||
\fBbfindex [-fh]\fR
|
||||
\fBbfindex [-fh] [-C\fIconfig\fB]\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBbfindex\fP is a nodelist compiler for BinkleyForce FTN mailer.
|
||||
@@ -2,7 +2,7 @@
|
||||
.SH NAME
|
||||
bfstat \- binkley style outbound statistic
|
||||
.SH SYNOPSYS
|
||||
\fBbfstat [-afhprst] [-n \fInumber\fB]\fR
|
||||
\fBbfstat [-afhprst] [-n \fInumber\fB] [-C\fIconfig\fB]\fR
|
||||
.SH DESCRIPTION
|
||||
\fBbfstat\fP help you to see your outbound statistic in human readable
|
||||
form.
|
||||
@@ -2,7 +2,7 @@
|
||||
.SH NAME
|
||||
Bnlookup \- Nodelist search tool for bforce
|
||||
.SH SYNOPSYS
|
||||
\fBnlookup [-rh]\fR
|
||||
\fBnlookup [-otrh] [-C\fIconfig\fB]\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBnlookup\fP is a nodelist search tool for BinkleyForce FTN mailer.
|
||||
@@ -13,6 +13,12 @@ show nodelist string
|
||||
\fB\-m\fR
|
||||
show sysops e-mail (see FSP-1004.001 - p2)
|
||||
.P
|
||||
\fB\-t\fR
|
||||
show calltable
|
||||
.P
|
||||
\fB\-o\fR
|
||||
show overrides
|
||||
.P
|
||||
\fB-h\fR
|
||||
show help message
|
||||
.SH SEE ALSO
|
||||
+34
-20
@@ -1,54 +1,68 @@
|
||||
Summary: Bforce, Fidonet mailer
|
||||
Name: bforce
|
||||
Version: 0.22.8
|
||||
Release: ugenk4
|
||||
Version: 0.27.1
|
||||
Release: %{_vendor}1
|
||||
Copyright: GPL
|
||||
Group: Fidonet/mailer
|
||||
Source0: bforce-%{version}.%{release}.tar.gz
|
||||
Source0: bforce-%{version}.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{name}-root
|
||||
|
||||
%description
|
||||
BFORCE is a FTN mailer. Supports PSTN and binkp sessions.
|
||||
|
||||
%prep
|
||||
#%setup -q -n %{name}-%{version}.%{release}
|
||||
cd source
|
||||
./configure --prefix=/usr --disable-log-passwd --sysconfdir=/etc/bforce --bindir=/usr/bin --with-owner=uucp --with-group=news
|
||||
# uncomment this to build from tarball
|
||||
# %setup -q -n %{name}
|
||||
echo "------------ PREPARING RPM BUILD IN $(pwd) ------------"
|
||||
export RPM_PACKAGE_VERSION=$(cat %{_builddir}/%{name}/source/.version)
|
||||
cd %{_builddir}/%{name}/source
|
||||
%{_builddir}/%{name}/source/configure --prefix=/usr --disable-log-passwd --sysconfdir=/etc/bforce --bindir=/usr/bin --with-owner=uucp --with-group=news CFLAGS='-g1'
|
||||
|
||||
%build
|
||||
cd source
|
||||
echo "------------ BUILDING RPM IN $(pwd) ------------"
|
||||
cd %{_builddir}/%{name}/source
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/bforce
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/
|
||||
mkdir -p $RPM_BUILD_ROOT/var/log/bforce
|
||||
mkdir -p $RPM_BUILD_ROOT/var/spool/fido/bt/pin
|
||||
mkdir -p $RPM_BUILD_ROOT/var/spool/fido/bt/in
|
||||
mkdir -p $RPM_BUILD_ROOT/var/spool/fido/ndl
|
||||
mkdir -p $RPM_BUILD_ROOT/var/spool/fido/bforce
|
||||
mkdir -p $RPM_BUILD_ROOT/$RPM_DOC_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION
|
||||
|
||||
|
||||
install -o uucp -g news source/bin/bforce $RPM_BUILD_ROOT/usr/bin/bforce
|
||||
install -o uucp -g news source/bin/bfindex $RPM_BUILD_ROOT/usr/bin/bfindex
|
||||
install -o uucp -g news source/bin/bfstat $RPM_BUILD_ROOT/usr/bin/bfstat
|
||||
install -o uucp -g news source/bin/nlookup $RPM_BUILD_ROOT/usr/bin/nlookup
|
||||
install -o uucp -g news examples/bforce.conf $RPM_BUILD_ROOT/etc/bforce/bforce.conf.sample
|
||||
install -o uucp -g news examples/bforce.passwd $RPM_BUILD_ROOT/etc/bforce/bforce.passwd.sample
|
||||
install -o uucp -g news examples/bforce.subst $RPM_BUILD_ROOT/etc/bforce/bforce.subst.sample
|
||||
install -o uucp -g news examples/freq.aliases $RPM_BUILD_ROOT/etc/bforce/freq.aliases.sample
|
||||
install -o uucp -g news examples/freq.dirs $RPM_BUILD_ROOT/etc/bforce/freq.dirs.sample
|
||||
install -m755 -o uucp -g news contrib/outman $RPM_BUILD_ROOT/usr/bin/outman
|
||||
|
||||
install %{_builddir}/%{name}/source/bin/bforce $RPM_BUILD_ROOT/usr/bin/bforce
|
||||
install %{_builddir}/%{name}/source/bin/bfindex $RPM_BUILD_ROOT/usr/bin/bfindex
|
||||
install %{_builddir}/%{name}/source/bin/bfstat $RPM_BUILD_ROOT/usr/bin/bfstat
|
||||
install %{_builddir}/%{name}/source/bin/nlookup $RPM_BUILD_ROOT/usr/bin/nlookup
|
||||
install %{_builddir}/%{name}/examples/bforce.conf $RPM_BUILD_ROOT/etc/bforce/bforce.conf.sample
|
||||
install %{_builddir}/%{name}/examples/bforce.passwd $RPM_BUILD_ROOT/etc/bforce/bforce.passwd.sample
|
||||
install %{_builddir}/%{name}/examples/bforce.subst $RPM_BUILD_ROOT/etc/bforce/bforce.subst.sample
|
||||
install %{_builddir}/%{name}/examples/freq.aliases $RPM_BUILD_ROOT/etc/bforce/freq.aliases.sample
|
||||
install %{_builddir}/%{name}/examples/freq.dirs $RPM_BUILD_ROOT/etc/bforce/freq.dirs.sample
|
||||
install %{_builddir}/%{name}/contrib/outman $RPM_BUILD_ROOT/usr/bin/outman
|
||||
install %{_builddir}/%{name}/contrib/systemd/bforce.service $RPM_BUILD_ROOT/usr/lib/systemd/system/bforce.service
|
||||
cp %{_builddir}/%{name}/man/*.1 $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
cp %{_builddir}/%{name}/{README.md,CHANGES,COPYING,INSTALL,INSTALL.ru,SYSLOG,TODO} $RPM_BUILD_ROOT/$RPM_DOC_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION/
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%doc README README.kst CHANGES CHANGES.kst CHANGES.ugenk COPYING INSTALL.ru README.ugenk SYSLOG TODO
|
||||
%{_mandir}/man1/bforce.1.xz
|
||||
%{_mandir}/man1/bfindex.1.xz
|
||||
%{_mandir}/man1/bfstat.1.xz
|
||||
%{_mandir}/man1/nlookup.1.xz
|
||||
%{_mandir}/man1/outman.1.xz
|
||||
%defattr(-, root, root)
|
||||
|
||||
%attr(550,uucp,news) /usr/bin/bforce
|
||||
@@ -56,7 +70,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%attr(550,uucp,news) /usr/bin/bfstat
|
||||
%attr(550,uucp,news) /usr/bin/nlookup
|
||||
%attr(550,uucp,news) /usr/bin/outman
|
||||
%attr(644,root,root) /usr/share/doc/bforce-0.22.8/*
|
||||
%attr(644,root,root) /usr/share/doc/bforce-%{version}/*
|
||||
%dir %attr(770,uucp,news) /var/log/bforce
|
||||
%dir %attr(770,uucp,news) /var/spool/fido/ndl
|
||||
%attr(775,uucp,news) /var/spool/fido/bt
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
0.23
|
||||
0.27.1
|
||||
|
||||
+16
-3
@@ -12,14 +12,15 @@ exec_prefix=@exec_prefix@
|
||||
CC = @CC@
|
||||
INCLUDES = -I./include
|
||||
CFLAGS = @CFLAGS@ -fno-builtin
|
||||
LIBS = @LIBS@
|
||||
YACC = @YACC@
|
||||
LIBS = @LIBS@ @CLOCK_LIB@
|
||||
YACC = @YACC@ -l
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
SRCDIR = @srcdir@
|
||||
SRCDIRCONF = $(SRCDIR)/../examples
|
||||
CONTRIBDIR = $(SRCDIR)/../contrib
|
||||
CONTRIBMAN = $(SRCDIR)/../man
|
||||
|
||||
OWNER = @OWNER@
|
||||
GROUP = @GROUP@
|
||||
@@ -27,6 +28,8 @@ CONFDIR = @sysconfdir@
|
||||
BINDIR = @bindir@
|
||||
LOGDIR = @LOGDIR@
|
||||
SPOOLDIR = @SPOOLDIR@
|
||||
MANDIR = /usr/share/man/man1
|
||||
SYSTEMDDIR = /var/lib/systemd/system
|
||||
|
||||
DAEMON_LOGFILE = $(LOGDIR)/bf-daemon
|
||||
BFORCE_LOGFILE = $(LOGDIR)/bf-log
|
||||
@@ -146,6 +149,7 @@ clean:
|
||||
rm -f ./bin/core
|
||||
clean-am:
|
||||
rm -f ./Makefile
|
||||
rm -f ../debian/Makefile
|
||||
rm -f ./include/config.h
|
||||
rm -f ./config.log
|
||||
rm -f ./config.status
|
||||
@@ -174,6 +178,7 @@ installdirs:
|
||||
if [ ! -d $(SPOOLDIR)/bt/out ]; then mkdir -p $(SPOOLDIR)/bt/out; fi
|
||||
if [ ! -d $(SPOOLDIR)/ndl ]; then mkdir -p $(SPOOLDIR)/ndl; fi
|
||||
if [ ! -d $(SPOOLDIR)/bforce ]; then mkdir -p $(SPOOLDIR); fi
|
||||
if [ ! -d $(MANDIR)/man1 ]; then mkdir -p $(MANDIR)/man1; fi
|
||||
chown $(OWNER):$(GROUP) $(CONFDIR)
|
||||
chown $(OWNER):$(GROUP) $(LOGDIR)
|
||||
chown $(OWNER):$(GROUP) $(SPOOLDIR)/bt/in
|
||||
@@ -195,9 +200,17 @@ install-config:
|
||||
$(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/freq.aliases $(CONFDIR)/freq.aliases.sample
|
||||
$(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/freq.dirs $(CONFDIR)/freq.dirs.sample
|
||||
|
||||
install-man:
|
||||
$(INSTALL) $(CONTRIBMAN)/bforce.1 $(MANDIR)/man1/bforce.1
|
||||
$(INSTALL) $(CONTRIBMAN)/bfindex.1 $(MANDIR)/man1/bfindex.1
|
||||
$(INSTALL) $(CONTRIBMAN)/bfstat.1 $(MANDIR)/man1/bforce.1
|
||||
$(INSTALL) $(CONTRIBMAN)/nlookup.1 $(MANDIR)/man1/bforce.1
|
||||
$(INSTALL) $(CONTRIBMAN)/outman.1 $(MANDIR)/man1/bforce.1
|
||||
|
||||
install-contrib:
|
||||
$(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(CONTRIBDIR)/outman $(BINDIR)/outman
|
||||
$(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(CONTRIBDIR)/systemd/bforce.service $(SYSTEMDDIR)/bforce.service
|
||||
@echo "Please, edit $(BINDIR)/outman"
|
||||
|
||||
install: install-bin install-config
|
||||
install: install-bin install-config install-man
|
||||
|
||||
|
||||
+46
-10
@@ -23,6 +23,8 @@
|
||||
/* PID of our child process (if use fork) */
|
||||
pid_t child_pid = 0;
|
||||
|
||||
char * mainenv[EXEC_MAX_NUM_ENVS+1];
|
||||
|
||||
const char *BFERR[] = {
|
||||
/* 00 */ "Successfull",
|
||||
/* 01 */ "Fatal error occured",
|
||||
@@ -102,6 +104,7 @@ static void usage(void)
|
||||
" -S <connect_str> connect string (for slave mode only)\n"
|
||||
" -p <port> override modem port (must be defined in config)\n"
|
||||
" -u binkp|ifcico|telnet protocol to use over TCP/IP\n"
|
||||
" -v display early debug info on stderr\n"
|
||||
" -h show this help message\n"
|
||||
"\n",
|
||||
conf_getconfname()
|
||||
@@ -252,12 +255,26 @@ int main(int argc, char *argv[], char *envp[])
|
||||
int rc = 0;
|
||||
int ch = 0;
|
||||
opts.runmode = MODE_UNDEFINED;
|
||||
int i = 0;
|
||||
|
||||
mainenv[0] = NULL;
|
||||
i=0;
|
||||
if ( envp[0] ) {
|
||||
while (envp[i]) {
|
||||
mainenv[i] = malloc(strlen(envp[i])+2);
|
||||
if ( mainenv[i] ) {
|
||||
strcpy(mainenv[i], envp[i]);
|
||||
mainenv[++i] = NULL;
|
||||
DEB((D_FREE, "Program ENV: %s\n", mainenv[(i-1)]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memset(&opts, '\0', sizeof(s_bforce_opts));
|
||||
|
||||
// parsing
|
||||
|
||||
while( (ch=getopt(argc, argv, "hfI:p:n:l:a:u:oiC:S:dq")) != EOF )
|
||||
while( (ch=getopt(argc, argv, "hfI:p:n:l:a:u:oivC:S:dq")) != (int)-1 )
|
||||
{
|
||||
switch( ch ) {
|
||||
case 'h':
|
||||
@@ -308,6 +325,9 @@ int main(int argc, char *argv[], char *envp[])
|
||||
//if( opts.runmode != MODE_ANSWER || opts.inetd ) { usage(); exit(BFERR_FATALERROR); }
|
||||
opts.inetd = 1;
|
||||
break;
|
||||
case 'v':
|
||||
opts.earlydbg = TRUE;
|
||||
break;
|
||||
case 'C':
|
||||
if( opts.confname || !optarg ) { usage(); exit(BFERR_FATALERROR); }
|
||||
opts.confname = (char *)xstrcpy(optarg);
|
||||
@@ -334,11 +354,6 @@ int main(int argc, char *argv[], char *envp[])
|
||||
}
|
||||
}
|
||||
|
||||
if( opts.inetd && opts.runmode != MODE_ANSWER && opts.runmode != MODE_CALL_STDIO )
|
||||
{
|
||||
usage();
|
||||
exit(BFERR_FATALERROR);
|
||||
}
|
||||
|
||||
/* Expression checker use it, so init first */
|
||||
init_state(&state);
|
||||
@@ -423,6 +438,15 @@ int main(int argc, char *argv[], char *envp[])
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if( opts.inetd && opts.runmode != MODE_ANSWER && opts.runmode != MODE_CALL_STDIO )
|
||||
{
|
||||
usage();
|
||||
exit(BFERR_FATALERROR);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* if( (rc = log_open(BFORCE_LOGFILE, NULL, NULL)) ) //compiled in
|
||||
{
|
||||
log("can't continue without logging");
|
||||
@@ -431,20 +455,21 @@ int main(int argc, char *argv[], char *envp[])
|
||||
|
||||
/* Process primary config file */
|
||||
if( opts.confname && *opts.confname )
|
||||
rc = conf_readconf(opts.confname, 0);
|
||||
rc = conf_readconf(opts.confname, 0, opts.earlydbg);
|
||||
else
|
||||
rc = conf_readconf(conf_getconfname(), 0);
|
||||
rc = conf_readconf(conf_getconfname(), 0, opts.earlydbg);
|
||||
|
||||
if( rc ) gotoexit(BFERR_FATALERROR);
|
||||
|
||||
/* Process additional config file, ignore errors */
|
||||
if( opts.incname && *opts.incname )
|
||||
(void)conf_readconf(opts.incname, 1);
|
||||
if (conf_readconf(opts.incname, 1, opts.earlydbg))
|
||||
gotoexit(BFERR_FATALERROR);
|
||||
|
||||
/* Reopen log file if it was defined in config */
|
||||
if( log_reopen(log_getfilename(LOG_FILE_SESSION), NULL, NULL) )
|
||||
{
|
||||
log("can't continue without logging");
|
||||
DEB((D_CONFIG, "can't continue without logging"));
|
||||
gotoexit(BFERR_FATALERROR);
|
||||
}
|
||||
|
||||
@@ -455,6 +480,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
switch( opts.runmode )
|
||||
{
|
||||
case MODE_DAEMON:
|
||||
DEB((D_STATEM, "Daemon mode"));
|
||||
log("Daemon mode");
|
||||
rc = bforce_daemon(&opts);
|
||||
break;
|
||||
@@ -462,14 +488,17 @@ case MODE_CALL_DEFAULT:
|
||||
case MODE_CALL_IP:
|
||||
case MODE_CALL_MODEM:
|
||||
case MODE_CALL_STDIO:
|
||||
DEB((D_STATEM, "Outgoing call"));
|
||||
log("Outgoing call");
|
||||
rc = bforce_master(&opts);
|
||||
break;
|
||||
case MODE_ANSWER:
|
||||
DEB((D_STATEM, "Start answer"));
|
||||
log("Start answer");
|
||||
rc = bforce_slave(&opts);
|
||||
break;
|
||||
default:
|
||||
DEB((D_STATEM, "Could not determine run mode"));
|
||||
log("Could not determine run mode");
|
||||
}
|
||||
|
||||
@@ -478,6 +507,13 @@ exit:
|
||||
deinit_conf();
|
||||
deinit_opts(&opts);
|
||||
|
||||
/* de-init sessenv */
|
||||
i=0;
|
||||
while(mainenv[i]) {
|
||||
DEB((D_FREE, "De-init session ENV: %s\n", mainenv[(i)]));
|
||||
free(mainenv[i++]);
|
||||
}
|
||||
|
||||
/* Shutdown logging services */
|
||||
if( log_isopened() ) log_close();
|
||||
DEB((D_FREE, "good exit"));
|
||||
|
||||
@@ -67,8 +67,9 @@ void deinit_cval_entry(s_cval_entry *dest, bforce_config_keyword type)
|
||||
deinit_translate(&dest->d.translate);
|
||||
break;
|
||||
default:
|
||||
DEB((D_CONFIG, "deinit_cval_entry: type %d doesn't use dynamic memory",
|
||||
type));
|
||||
//DEB((D_CONFIG, "deinit_cval_entry: type %d doesn't use dynamic memory",
|
||||
// type));
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,14 @@ s_cval_entry *conf_first(bforce_config_keyword keyword)
|
||||
{
|
||||
s_cval_entry *ptrl;
|
||||
|
||||
for( ptrl = bforce_config[keyword].data; ptrl; ptrl = ptrl->next )
|
||||
if( !ptrl->expr.expr || eventexpr(&ptrl->expr) )
|
||||
return ptrl;
|
||||
DEB((D_CONFIG, "conf_first entry nr %d",(int16_t)keyword));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -32,9 +36,11 @@ s_cval_entry *conf_next(s_cval_entry *ptrl)
|
||||
ASSERT(ptrl);
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
DEB((D_CONFIG, "conf_next ptrl not found"));
|
||||
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_cval_entry *ptrl;
|
||||
|
||||
DEB((D_CONFIG, "conf_override entry"));
|
||||
for( ptrl = conf_first(keyword); ptrl; ptrl = conf_next(ptrl) )
|
||||
if( !ftn_addrcomp(ptrl->d.override.addr, addr) )
|
||||
return &ptrl->d.override;
|
||||
|
||||
@@ -84,6 +84,8 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = {
|
||||
CONF_KEY(emsi_FR_time, CT_STRING),
|
||||
CONF_KEY(emsi_OH_time, CT_STRING),
|
||||
CONF_KEY(emsi_slave_sends_nak, CT_BOOLEAN),
|
||||
CONF_KEY(emsi_send_tz, CT_BOOLEAN),
|
||||
CONF_KEY(emsi_send_time, CT_BOOLEAN),
|
||||
CONF_KEY(filebox, CT_FILEBOX),
|
||||
CONF_KEY(filebox_directory, CT_PATH),
|
||||
CONF_KEY(flags, CT_STRING),
|
||||
@@ -96,6 +98,10 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = {
|
||||
CONF_KEY(freq_limit_time, CT_NUMBER),
|
||||
CONF_KEY(freq_min_speed, CT_NUMBER),
|
||||
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),
|
||||
@@ -142,6 +148,7 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = {
|
||||
CONF_KEY(password, CT_PASSWORD),
|
||||
CONF_KEY(phone, CT_STRING),
|
||||
CONF_KEY(phone_translate, CT_TRANSLATE),
|
||||
CONF_KEY(proto_order, CT_STRING),
|
||||
CONF_KEY(recode_file_in, CT_STRING),
|
||||
CONF_KEY(recode_file_out, CT_STRING),
|
||||
CONF_KEY(recode_intro_in, CT_STRING),
|
||||
@@ -655,7 +662,7 @@ static int proc_domain(s_domain *dest, char *value)
|
||||
if( p_path[strlen(p_path)-1] == DIRSEPCHR )
|
||||
dest->path = xstrcpy(p_path);
|
||||
else
|
||||
dest->path = string_concat(p_path, DIRSEPSTR, NULL);
|
||||
dest->path = string_concat(p_path, DIRSEPSTR, '\0');
|
||||
return(PROC_RC_OK);
|
||||
}
|
||||
else
|
||||
@@ -744,7 +751,7 @@ static int proc_path(s_string *dest, char *value)
|
||||
if( value[strlen(value)-1] == DIRSEPCHR )
|
||||
dest->str = xstrcpy(value);
|
||||
else
|
||||
dest->str = string_concat(value, DIRSEPSTR, NULL);
|
||||
dest->str = string_concat(value, DIRSEPSTR, '\0');
|
||||
|
||||
return(PROC_RC_OK);
|
||||
}
|
||||
@@ -997,7 +1004,7 @@ static int proc_filebox(s_filebox *dest, char *value)
|
||||
if( p_path[strlen(p_path)-1] == DIRSEPCHR )
|
||||
dest->path = xstrcpy(p_path);
|
||||
else
|
||||
dest->path = string_concat(p_path, DIRSEPSTR, NULL);
|
||||
dest->path = string_concat(p_path, DIRSEPSTR, '\0');
|
||||
dest->flavor = flavor;
|
||||
return rc;
|
||||
}
|
||||
|
||||
+67
-113
@@ -129,9 +129,11 @@ static void conf_parsestr(char *str, char **key, char **expr, char **value)
|
||||
return;
|
||||
}
|
||||
|
||||
int conf_readconf(const char *confname, int inclevel)
|
||||
int conf_readconf(const char *confname, int inclevel, bool earlydbg)
|
||||
{
|
||||
// printf("%s %d\n", confname, inclevel);
|
||||
if (earlydbg)
|
||||
fprintf(stderr,"BF-DEBUG: Parsing config file: %s %d\n", confname, inclevel);
|
||||
|
||||
FILE *fp = NULL;
|
||||
char tmp[BF_MAXCFGLINE + 1];
|
||||
int rc, maxrc = 0;
|
||||
@@ -156,7 +158,8 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
{
|
||||
if( i != (int)bforce_config[i].real_key )
|
||||
{
|
||||
log("invalid config table: found %d instead of %d",
|
||||
if (earlydbg)
|
||||
fprintf(stderr,"BF-DEBUG: invalid config table: found %d instead of %d\n",
|
||||
bforce_config[i].real_key, i);
|
||||
return -1;
|
||||
}
|
||||
@@ -165,11 +168,12 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
|
||||
if( (fp = file_open(confname,"r")) == NULL )
|
||||
{
|
||||
logerr("can't open config file \"%s\"", confname);
|
||||
return(PROC_RC_IGNORE);
|
||||
if (earlydbg)
|
||||
fprintf(stderr,"BF-DEBUG: can't open config file \"%s\"\n", confname);
|
||||
return(PROC_RC_ABORT);
|
||||
}
|
||||
|
||||
DEB((D_CONFIG, "readconfig: start reading config \"%s\"", confname));
|
||||
if (earlydbg)
|
||||
fprintf(stderr,"BF-DEBUG: start reading config \"%s\"\n", confname);
|
||||
|
||||
while( fgets(tmp, sizeof(tmp), fp) )
|
||||
{
|
||||
@@ -180,7 +184,9 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
{
|
||||
if( isifexpr )
|
||||
{
|
||||
log("warning: automatically close expression at empty line %d", line);
|
||||
if (earlydbg)
|
||||
fprintf(stderr,"BF-DEBUG: warning: automatically close expression at empty line %d\n", line);
|
||||
|
||||
if( ifexpr ) { free(ifexpr); ifexpr = NULL; }
|
||||
isifexpr = FALSE;
|
||||
}
|
||||
@@ -188,7 +194,10 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
if( !isappend )
|
||||
continue;
|
||||
|
||||
log("warning: appending empty or comment line %d", line);
|
||||
if (earlydbg)
|
||||
fprintf(stderr,"BF-DEBUG: warning: appending empty or comment line %d\n", line);
|
||||
|
||||
|
||||
isappend = FALSE;
|
||||
}
|
||||
|
||||
@@ -230,9 +239,10 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
p_value = NULL;
|
||||
|
||||
conf_parsestr(fullstr ? fullstr : tmp, &p_key, &p_expr, &p_value);
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: conf_readconf: [%d] key \"%s\" expr \"%s\" value \"%s\"\n",
|
||||
line, p_key, p_expr, p_value);
|
||||
|
||||
DEB((D_CONFIG, "conf_readconf: [%d] key \"%s\" expr \"%s\" value \"%s\"",
|
||||
line, p_key, p_expr, p_value));
|
||||
|
||||
if( p_value )
|
||||
{
|
||||
@@ -256,19 +266,24 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
{
|
||||
if( value == NULL || expr )
|
||||
{
|
||||
log("incorrect usage of `%s' directive", p_key);
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive\n", p_key);
|
||||
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
else if( inclevel < MAXINCLUDELEVEL )
|
||||
{
|
||||
DEB((D_CONFIG, "conf_readconf: process inlude file \"%s\"", value));
|
||||
rc = conf_readconf(value, inclevel + 1);
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: conf_readconf: process inlude file \"%s\"\n", value);
|
||||
|
||||
rc = conf_readconf(value, inclevel + 1, earlydbg);
|
||||
if( rc ) rc = PROC_RC_IGNORE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEB((D_CONFIG, "conf_readconf: too deep include"));
|
||||
log("including level too deep");
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: conf_readconf: too deep include\n");
|
||||
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
}
|
||||
@@ -276,7 +291,9 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
{
|
||||
if( value || isifexpr )
|
||||
{
|
||||
log("incorrect usage of `%s' directive", p_key);
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive\n", p_key);
|
||||
|
||||
rc = PROC_RC_ABORT;
|
||||
}
|
||||
else
|
||||
@@ -292,7 +309,9 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
{
|
||||
if( value || expr || !isifexpr )
|
||||
{
|
||||
log("incorrect usage of `%s' directive", p_key);
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive\n", p_key);
|
||||
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
else
|
||||
@@ -301,69 +320,12 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
isifexpr = FALSE;
|
||||
}
|
||||
}
|
||||
/* else if( strcasecmp(p_key+1, "logfile") == 0 )
|
||||
{
|
||||
if( value == NULL || expr )
|
||||
{
|
||||
log("incorrect usage of `%s' directive", p_key);
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( log_reopen(value, NULL, NULL) )
|
||||
{
|
||||
log("can't continue without logging");
|
||||
rc = PROC_RC_ABORT;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( strcasecmp(p_key+1, "debugfile") == 0 )
|
||||
{
|
||||
if( value == NULL || expr )
|
||||
{
|
||||
log("incorrect usage of `%s' directive", p_key);
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
else
|
||||
#ifdef DEBUG
|
||||
{
|
||||
if( debug_isopened() ) debug_close();
|
||||
debug_setfilename(value);
|
||||
}
|
||||
#else
|
||||
{
|
||||
log("incorrect directive `%s': no debug code", p_key);
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if( strcasecmp(p_key+1, "debuglevel") == 0 )
|
||||
{
|
||||
if( value == NULL || expr )
|
||||
{
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
else
|
||||
#ifdef DEBUG
|
||||
{
|
||||
unsigned long newlevel = 0L;
|
||||
|
||||
if( debug_parsestring(value, &newlevel) )
|
||||
{
|
||||
rc = PROC_RC_WARN;
|
||||
}
|
||||
debug_setlevel(newlevel, 1);
|
||||
}
|
||||
#else
|
||||
{
|
||||
log("incorrect directive `%s': no debug code", p_key);
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
else
|
||||
{
|
||||
log("unknown directive `%s'", p_key);
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: unknown directive `%s'\n", p_key);
|
||||
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
}
|
||||
@@ -371,7 +333,9 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
{
|
||||
if( isifexpr && expr )
|
||||
{
|
||||
log("can't use expressions inside $ifexpr block");
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: can't use expressions inside $ifexpr block\n");
|
||||
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
else if( isifexpr )
|
||||
@@ -385,7 +349,9 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
}
|
||||
else
|
||||
{
|
||||
log("incorrect config string");
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: incorrect config string %s\n", fullstr);
|
||||
|
||||
rc = PROC_RC_IGNORE;
|
||||
}
|
||||
|
||||
@@ -400,13 +366,19 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
case PROC_RC_OK:
|
||||
break;
|
||||
case PROC_RC_WARN:
|
||||
log("warning in config \"%s\" line %d", confname, line);
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: warning in config \"%s\" line %d\n", confname, line);
|
||||
|
||||
break;
|
||||
case PROC_RC_IGNORE:
|
||||
log("ignore line %d in config \"%s\"", line, confname);
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: ignore line %d in config \"%s\"\n", line, confname);
|
||||
|
||||
break;
|
||||
case PROC_RC_ABORT:
|
||||
log("fatal error in config \"%s\" in line %d", confname, line);
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: fatal error in config \"%s\" in line %d\n", confname, line);
|
||||
|
||||
break;
|
||||
default:
|
||||
ASSERT_MSG();
|
||||
@@ -418,54 +390,36 @@ int conf_readconf(const char *confname, int inclevel)
|
||||
file_close(fp);
|
||||
|
||||
if( isifexpr )
|
||||
{ maxrc = 1; log("unterminated directive `#ifexp'"); }
|
||||
{
|
||||
maxrc = 1;
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: unterminated directive `#ifexp'\n");
|
||||
|
||||
}
|
||||
|
||||
if( fullstr )
|
||||
free(fullstr);
|
||||
if( ifexpr )
|
||||
free(ifexpr);
|
||||
|
||||
DEB((D_CONFIG, "readconfig: exit with maxrc = %d", maxrc));
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: readconfig: exit with maxrc = %d\n", maxrc);
|
||||
|
||||
|
||||
/* update subsystems */
|
||||
if (inclevel==0) { // end of main config
|
||||
if( log_reopen(log_getfilename(LOG_FILE_SESSION), NULL, NULL) )
|
||||
{
|
||||
log("can't continue without logging");
|
||||
if (earlydbg)
|
||||
fprintf(stderr, "BF-DEBUG: can't continue without logging\n");
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
debug_configure();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
return maxrc;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/*void debug_override(void)
|
||||
{
|
||||
s_cval_entry *ptrl;
|
||||
char abuf[BF_MAXADDRSTR+1];
|
||||
|
||||
DEB((D_CONFIG, "debug_override: BEGIN"));
|
||||
|
||||
for( ptrl = bforce_config[cf_override].data; ptrl; ptrl = ptrl->next )
|
||||
{
|
||||
DEB((D_CONFIG, "log_overridelist: address %s",
|
||||
ftn_addrstr(abuf, ptrl->d.override.addr)));
|
||||
DEB((D_CONFIG, "log_overridelist: \tIpaddr = \"%s\"",
|
||||
ptrl->d.override.sIpaddr));
|
||||
DEB((D_CONFIG, "log_overridelist: \tPhone = \"%s\"",
|
||||
ptrl->d.override.sPhone));
|
||||
DEB((D_CONFIG, "log_overridelist: \tWorktime = \"%s\"",
|
||||
timevec_string(abuf, &ptrl->d.override.worktime, sizeof(abuf))));
|
||||
DEB((D_CONFIG, "log_overridelist: \tFlags = \"%s\"",
|
||||
ptrl->d.override.sFlags));
|
||||
}
|
||||
|
||||
DEB((D_CONFIG, "debug_override: END"));
|
||||
}*/
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
+80
-16
@@ -76,8 +76,8 @@ s_daemon_queue daemon_queues[] = {
|
||||
/*
|
||||
* Positions of the certain queues in the 'daemon_queues' array
|
||||
*/
|
||||
#define MODEM_QUEUE 0
|
||||
#define TCPIP_QUEUE 1
|
||||
#define MODEM_QUEUE 1
|
||||
#define TCPIP_QUEUE 0
|
||||
|
||||
static RETSIGTYPE daemon_sighandler_chld(int sig)
|
||||
{
|
||||
@@ -161,7 +161,7 @@ static int daemon_sysentry_init(s_sysentry *sysent)
|
||||
strcpy(msg, "freqs holded");
|
||||
}
|
||||
|
||||
if( msg && *msg )
|
||||
if( *msg )
|
||||
log("QUEUE: add %s (%s)", ftn_addrstr(abuf, sysent->node.addr), msg);
|
||||
else
|
||||
log("QUEUE: add %s", ftn_addrstr(abuf, sysent->node.addr));
|
||||
@@ -178,7 +178,7 @@ static int daemon_sysentry_deinit(s_sysentry *sysent)
|
||||
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_host = FALSE;
|
||||
@@ -194,7 +194,7 @@ static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
|
||||
if( modem_isgood_phone(ovrd->sPhone) )
|
||||
good_phone = TRUE;
|
||||
}
|
||||
else if( node && node->phone && *node->phone )
|
||||
else if( node && *node->phone )
|
||||
{
|
||||
if( modem_isgood_phone(node->phone) )
|
||||
good_phone = TRUE;
|
||||
@@ -208,6 +208,11 @@ static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
|
||||
if( tcpip_isgood_host(ovrd->sIpaddr) )
|
||||
good_host = TRUE;
|
||||
}
|
||||
else if ( node && *node->host )
|
||||
{
|
||||
if( tcpip_isgood_host(node->host) )
|
||||
good_host = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check work time
|
||||
@@ -231,6 +236,16 @@ static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
|
||||
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_host )
|
||||
@@ -323,9 +338,23 @@ static bool daemon_node_cancall(s_sysentry *syst, bool ign_wtime, bool tcpip)
|
||||
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 */
|
||||
if( syst->overrides )
|
||||
{
|
||||
DEB((D_DAEMON, "daemon: node_cancall OVR-IN"));
|
||||
if( syst->lineptr && syst->lineptr->hidden )
|
||||
{
|
||||
line = syst->line + 1;
|
||||
@@ -363,11 +392,18 @@ static bool daemon_node_cancall(s_sysentry *syst, bool ign_wtime, bool tcpip)
|
||||
}
|
||||
line++;
|
||||
}
|
||||
|
||||
}
|
||||
else /* Node without overriden parameters */
|
||||
{
|
||||
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;
|
||||
@@ -687,6 +723,8 @@ int daemon_rescan_sysqueue(s_sysqueue *q, s_daemon_queue dqs[])
|
||||
|
||||
#ifdef DEBUG
|
||||
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
|
||||
|
||||
return 0;
|
||||
@@ -755,6 +793,7 @@ int daemon_pidfile(int cmd)
|
||||
pid_t hispid, mypid = getpid();
|
||||
FILE *pf;
|
||||
struct stat sb;
|
||||
int res;
|
||||
|
||||
if( !pidfile )
|
||||
return 0;
|
||||
@@ -768,7 +807,13 @@ int daemon_pidfile(int cmd)
|
||||
return -1;
|
||||
}
|
||||
|
||||
fscanf(pf, "%d", &hispid);
|
||||
res = fscanf(pf, "%d", &hispid);
|
||||
if (res != 1) {
|
||||
log("daemon pidfile: not readable");
|
||||
fclose(pf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fclose(pf);
|
||||
|
||||
if( hispid ) {
|
||||
@@ -807,7 +852,13 @@ int daemon_pidfile(int cmd)
|
||||
return -1;
|
||||
}
|
||||
|
||||
fscanf(pf, "%d", &hispid);
|
||||
res = fscanf(pf, "%d", &hispid);
|
||||
if (res != 1) {
|
||||
log("daemon pidfile: not readable");
|
||||
fclose(pf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fclose(pf);
|
||||
|
||||
if( !hispid || (hispid == mypid) ) {
|
||||
@@ -831,7 +882,13 @@ int daemon_pidfile(int cmd)
|
||||
return -1;
|
||||
}
|
||||
|
||||
fscanf(pf, "%d", &hispid);
|
||||
res = fscanf(pf, "%d", &hispid);
|
||||
if (res != 1) {
|
||||
log("daemon pidfile: not readable");
|
||||
fclose(pf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fclose(pf);
|
||||
unlink(pidfile);
|
||||
|
||||
@@ -938,15 +995,15 @@ int daemon_run(const char *confname, const char *incname, bool quit)
|
||||
|
||||
/* Read primary config file */
|
||||
if( confname && *confname )
|
||||
rc = conf_readconf(confname, 0);
|
||||
rc = conf_readconf(confname, 0, false);
|
||||
else
|
||||
rc = conf_readconf(conf_getconfname(), 0);
|
||||
rc = conf_readconf(conf_getconfname(), 0, false);
|
||||
|
||||
if( rc )
|
||||
return(BFERR_FATALERROR);
|
||||
|
||||
/* Read additional config file (manual include) */
|
||||
if( incname && *incname && conf_readconf(incname, 1) )
|
||||
if( incname && *incname && conf_readconf(incname, 1, false) )
|
||||
log("cannot read additional config (ignore)");
|
||||
|
||||
dmstate = DM_Start;
|
||||
@@ -978,7 +1035,7 @@ int daemon_run(const char *confname, const char *incname, bool quit)
|
||||
/*
|
||||
* Check rescan timer
|
||||
*/
|
||||
if( !timer_running(timer_rescan) || timer_expired(timer_rescan) )
|
||||
if( timer_expired(timer_rescan) )
|
||||
{
|
||||
(void)daemon_rescan_sysqueue(&daemon_sys_queue,
|
||||
daemon_queues);
|
||||
@@ -988,16 +1045,23 @@ int daemon_run(const char *confname, const char *incname, bool quit)
|
||||
/*
|
||||
* Check alive timer
|
||||
*/
|
||||
if( !timer_running(timer_alive) || timer_expired(timer_alive) )
|
||||
if( timer_expired(timer_alive) )
|
||||
{
|
||||
daemon_alive_message(&daemon_sys_queue);
|
||||
timer_set(&timer_alive, DAEMON_ALIVE_TIMER);
|
||||
}
|
||||
|
||||
if( max_modem > 0 )
|
||||
daemon_queue_do(&daemon_queues[MODEM_QUEUE]);
|
||||
if( max_tcpip > 0 )
|
||||
{
|
||||
DEB((D_DAEMON,"daemon: daemon_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);
|
||||
break;
|
||||
|
||||
@@ -39,8 +39,8 @@ static s_modemport *daemon_getfree_port(const char *lockdir)
|
||||
|
||||
static int daemon_call_branch(s_sysentry *syst, const char *lockdir, s_modemport *port)
|
||||
{
|
||||
int rc = BFERR_NOERROR;
|
||||
char abuf[BF_MAXADDRSTR+1];
|
||||
//int rc = BFERR_NOERROR;
|
||||
//char abuf[BF_MAXADDRSTR+1];
|
||||
|
||||
/*
|
||||
* First of all restore the default signal handlers
|
||||
@@ -54,7 +54,12 @@ static int daemon_call_branch(s_sysentry *syst, const char *lockdir, s_modemport
|
||||
|
||||
s_bforce_opts opts;
|
||||
// TODO: add hiddenline round-robin
|
||||
memset(&opts, '\0', sizeof(s_bforce_opts));
|
||||
|
||||
opts.hiddline = 0;
|
||||
if ( syst->tcpip )
|
||||
opts.runmode = MODE_CALL_IP;
|
||||
else
|
||||
opts.runmode = MODE_CALL_DEFAULT;
|
||||
opts.ipproto = NULL;
|
||||
opts.phone = NULL;
|
||||
@@ -62,7 +67,7 @@ static int daemon_call_branch(s_sysentry *syst, const char *lockdir, s_modemport
|
||||
opts.inetd = 0;
|
||||
opts.connect = NULL;
|
||||
opts.device = NULL;
|
||||
|
||||
DEB((D_DAEMON, "daemon_call: calling call_system from branch"));
|
||||
// log("doing call_system");
|
||||
return call_system(syst->node.addr, &opts);
|
||||
}
|
||||
@@ -88,7 +93,10 @@ int daemon_call(s_sysentry *syst)
|
||||
* Check whether this node is allready locked
|
||||
*/
|
||||
if( out_bsy_check(syst->node.addr) )
|
||||
{
|
||||
DEB((D_DAEMON, "daemon_call: node locked by .bsy file"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set state structure to make expressions works properly now
|
||||
@@ -101,6 +109,7 @@ int daemon_call(s_sysentry *syst)
|
||||
|
||||
if( syst->tcpip == FALSE )
|
||||
{
|
||||
DEB((D_DAEMON, "daemon_call: tcpip false - prep modem line"));
|
||||
if( (p_lockdir = conf_string(cf_uucp_lock_directory)) == NULL )
|
||||
p_lockdir = BFORCE_LOCK_DIR;
|
||||
|
||||
@@ -110,6 +119,9 @@ int daemon_call(s_sysentry *syst)
|
||||
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",
|
||||
ftn_addrstr(abuf, syst->node.addr), syst->line,
|
||||
@@ -138,7 +150,7 @@ int daemon_call(s_sysentry *syst)
|
||||
}
|
||||
|
||||
/* Now we are in child process */
|
||||
|
||||
DEB((D_DAEMON, "daemon_call: fork success - calling..."));
|
||||
exit(daemon_call_branch(syst, p_lockdir, modemport));
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ int daemon_line_add(const char *name, int type)
|
||||
int i;
|
||||
|
||||
for( i = 0; i < lines_num; i++ )
|
||||
if( !strcmp(lines_tab[i].name, name) )
|
||||
if( (lines_tab) && !strcmp(lines_tab[i].name, name) )
|
||||
return i;
|
||||
|
||||
log("register new line \"%s\"", name);
|
||||
@@ -90,13 +90,12 @@ bool daemon_line_isready(const char *name)
|
||||
void daemon_lines_deinit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if( lines_tab )
|
||||
{
|
||||
for( i = 0; i < lines_num; i++ )
|
||||
if( lines_tab[i].name )
|
||||
free(lines_tab[i].name);
|
||||
|
||||
if( lines_tab )
|
||||
{
|
||||
free(lines_tab);
|
||||
lines_tab = NULL;
|
||||
}
|
||||
|
||||
+926
-787
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,7 @@
|
||||
%token LOGOP
|
||||
|
||||
%expect 2
|
||||
|
||||
%{
|
||||
#include "includes.h"
|
||||
#include "confread.h"
|
||||
@@ -136,7 +137,7 @@ elemexp : INCOMING
|
||||
}
|
||||
| FLAG flagstring
|
||||
{
|
||||
$$ = $2;
|
||||
$$ = $2; //-V1037
|
||||
}
|
||||
| CONNSPEED AROP NUMBER
|
||||
{
|
||||
@@ -162,7 +163,7 @@ elemexp : INCOMING
|
||||
}
|
||||
| TIME timestring
|
||||
{
|
||||
$$ = $2;
|
||||
$$ = $2; //-V1037
|
||||
}
|
||||
| EXEC TEXT
|
||||
{
|
||||
@@ -193,7 +194,7 @@ flagstring : TEXT
|
||||
}
|
||||
| TEXT COMMA flagstring
|
||||
{
|
||||
$$ = expr_check_logic($1, OR, $3);
|
||||
$$ = expr_check_logic($1, OR, $3); //-V1037
|
||||
}
|
||||
;
|
||||
timestring : TEXT
|
||||
@@ -204,7 +205,7 @@ timestring : TEXT
|
||||
}
|
||||
| TEXT COMMA timestring
|
||||
{
|
||||
$$ = expr_check_logic($1, OR, $3);
|
||||
$$ = expr_check_logic($1, OR, $3); //-V1037
|
||||
}
|
||||
;
|
||||
%%
|
||||
@@ -359,7 +360,14 @@ static int expr_check_mailer(const char *str)
|
||||
|
||||
static int expr_check_addr(const char *str)
|
||||
{
|
||||
s_faddr addr;
|
||||
s_faddr addr = {
|
||||
.inetform = false,
|
||||
.zone = 0,
|
||||
.net = 0,
|
||||
.node = 0,
|
||||
.point = 0,
|
||||
.domain = '\0' };
|
||||
|
||||
#ifdef DEBUG
|
||||
char abuf1[BF_MAXADDRSTR+1];
|
||||
char abuf2[BF_MAXADDRSTR+1];
|
||||
@@ -367,6 +375,7 @@ static int expr_check_addr(const char *str)
|
||||
DEB((D_EVENT, "[yacc] addr: \"%s\" (session with \"%s\")",
|
||||
ftn_addrstr(abuf1, addr),
|
||||
ftn_addrstr(abuf2, state.node.addr)));
|
||||
|
||||
#endif
|
||||
|
||||
if( !state.valid )
|
||||
|
||||
@@ -115,7 +115,7 @@ static void req_readfrlist(char *fname, s_frlist **frlist, int magic)
|
||||
(*ptrl) = (s_frlist*)xmalloc(sizeof(s_frlist));
|
||||
memset(*ptrl, '\0', sizeof(s_frlist));
|
||||
|
||||
if( path && *path ) (*ptrl)->path = xstrcpy(path);
|
||||
if( *path ) (*ptrl)->path = xstrcpy(path);
|
||||
if( !magic && *(path + strlen(path) - 1) != DIRSEPCHR )
|
||||
{
|
||||
/* add trailing DIRSEP ('/' or ..) to paths */
|
||||
@@ -200,9 +200,18 @@ static void req_proc_ext(s_freq *freq, char *reqname)
|
||||
char srfname[L_tmpnam+5];
|
||||
char rspname[L_tmpnam+5];
|
||||
char *comline = NULL;
|
||||
char *chunk;
|
||||
|
||||
if( tmpnam(srfname) )
|
||||
chunk = xmalloc(L_tmpnam+1);
|
||||
if ( chunk )
|
||||
{
|
||||
getrandname(chunk, L_tmpnam);
|
||||
chunk[L_tmpnam]='\0';
|
||||
strnxcpy(srfname, chunk, L_tmpnam);
|
||||
free(chunk);
|
||||
|
||||
//if( tmpnam(srfname) )
|
||||
//{
|
||||
strncpy(rspname, srfname, L_tmpnam+4);
|
||||
rspname[L_tmpnam+4] = '\0';
|
||||
strcat(srfname, ".srf");
|
||||
|
||||
@@ -68,7 +68,8 @@ int req_createsrif(char *sname, char *req, char *rsp)
|
||||
else
|
||||
fprintf(fp, "Sysop SysOp\n");
|
||||
|
||||
if( aptr = session_1remote_address() )
|
||||
aptr = session_1remote_address();
|
||||
if( aptr )
|
||||
fprintf(fp, "AKA %s\n", ftn_addrstr(abuf, *aptr));
|
||||
else
|
||||
return -1;
|
||||
|
||||
+109
-31
@@ -16,33 +16,77 @@
|
||||
#include "logger.h"
|
||||
#include "util.h"
|
||||
#include "io.h"
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#define DEFAULT_PORT 60179 /* Birthday .. mother fucker :) */
|
||||
|
||||
struct addrinfo *paddrinfo = NULL;
|
||||
|
||||
static RETSIGTYPE tcpip_interrupt(int sig)
|
||||
{
|
||||
tty_abort = TRUE;
|
||||
log("terminating on signal %d", sig);
|
||||
(void)log("terminating on signal %d", sig);
|
||||
}
|
||||
|
||||
static RETSIGTYPE tcpip_brokenpipe(int sig)
|
||||
{
|
||||
tty_abort = TRUE;
|
||||
if( tty_online )
|
||||
log("connection closed");
|
||||
(void)log("connection closed");
|
||||
else
|
||||
log("terminating on signal %d", sig);
|
||||
(void)log("terminating on signal %d", sig);
|
||||
}
|
||||
|
||||
static int tcpip_connect2(struct sockaddr_in server)
|
||||
static int tcpip_connect2(struct addrinfo *ai)
|
||||
{
|
||||
int fd;
|
||||
int fd = -1;
|
||||
bool connected = FALSE;
|
||||
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
||||
int synRetries = 2; // Send a total of 3 SYN packets => Timeout ~7s
|
||||
int usertimeout = 3000;
|
||||
struct addrinfo *rai;
|
||||
|
||||
DEB((D_INFO, "tcpip_connect2: trying \"%s\" at port %d",
|
||||
inet_ntoa(server.sin_addr), (int)ntohs(server.sin_port)));
|
||||
|
||||
if( (fd = socket(AF_INET, SOCK_STREAM, 0)) < 0 )
|
||||
for (rai = ai; rai != NULL; rai = rai->ai_next)
|
||||
{
|
||||
if (getnameinfo(rai->ai_addr, rai->ai_addrlen, hbuf, sizeof(hbuf), sbuf,
|
||||
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0)
|
||||
DEB((D_INFO, "tcpip_connect2: trying host=%s, serv=%s", hbuf, sbuf));
|
||||
|
||||
fd = socket (rai->ai_family, rai->ai_socktype, rai->ai_protocol);
|
||||
|
||||
if ( fd == -1 )
|
||||
{
|
||||
DEB((D_INFO, "tcpip_connect2: socket error"));
|
||||
}
|
||||
else
|
||||
{
|
||||
DEB((D_INFO, "tcpip_connect2: socket opened - try to connect"));
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_SYNCNT, &synRetries, sizeof(synRetries));
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &usertimeout, sizeof(usertimeout));
|
||||
if( connect(fd, rai->ai_addr, rai->ai_addrlen) == -1 )
|
||||
{
|
||||
DEB((D_INFO, "tcpip_connect2: can't connect %s", hbuf));
|
||||
logerr("can't connect to %s", hbuf);
|
||||
close(fd);
|
||||
fd = -1;
|
||||
} else {
|
||||
DEB((D_INFO, "tcpip_connect2: connect"));
|
||||
connected = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
hbuf[0]='\0';
|
||||
sbuf[0]='\0';
|
||||
if (!connected) {
|
||||
DEB((D_INFO, "tcpip_connect2: socket not opened - returning"));
|
||||
|
||||
}
|
||||
}
|
||||
DEB((D_INFO, "tcpip_connect2: socket: %d", fd));
|
||||
if ((fd < 0) || !connected)
|
||||
{
|
||||
DEB((D_INFO, "tcpip_connect2: can't create socket and connect"));
|
||||
logerr("can't create socket");
|
||||
return(1);
|
||||
}
|
||||
@@ -53,6 +97,7 @@ static int tcpip_connect2(struct sockaddr_in server)
|
||||
(void)close(0);
|
||||
if( dup(fd) != 0 )
|
||||
{
|
||||
DEB((D_INFO, "tcpip_connect2: can't dup socket to stdin"));
|
||||
logerr("cannot dup socket to stdin");
|
||||
return(1);
|
||||
}
|
||||
@@ -72,7 +117,7 @@ static int tcpip_connect2(struct sockaddr_in server)
|
||||
logerr("cannot dup stdin to stderr");
|
||||
return(1);
|
||||
}
|
||||
|
||||
DEB((D_INFO, "tcpip_connect2: stdin|out|err are connected"));
|
||||
if( fd > 2 ) (void)close(fd);
|
||||
|
||||
/* switch off stdio buffering */
|
||||
@@ -83,24 +128,25 @@ static int tcpip_connect2(struct sockaddr_in server)
|
||||
clearerr(stdin);
|
||||
clearerr(stdout);
|
||||
clearerr(stderr);
|
||||
|
||||
if( connect(0, (struct sockaddr*)&server, sizeof(server)) == -1 )
|
||||
{
|
||||
logerr("can't connect to %s", inet_ntoa(server.sin_addr));
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
return 1;
|
||||
}
|
||||
DEB((D_INFO, "tcpip_connect2: start connecting"));
|
||||
//if( connect(0, rai->ai_addr, rai->ai_addrlen) == -1 )
|
||||
//{
|
||||
// DEB((D_INFO, "tcpip_connect2: can't connect %s", hbuf));
|
||||
// logerr("can't connect to %s", hbuf);
|
||||
//
|
||||
// close(0);
|
||||
// close(1);
|
||||
// close(2);
|
||||
// return 1;
|
||||
//}
|
||||
|
||||
if( tcpip_init() )
|
||||
{
|
||||
tcpip_shutdown();
|
||||
return 1;
|
||||
}
|
||||
|
||||
log("TCP/IP connect to %s on port %d",
|
||||
inet_ntoa(server.sin_addr), (int)ntohs(server.sin_port));
|
||||
DEB((D_INFO, "tcpip_connect2: TCP/IP connect success to %s on service %s", hbuf, sbuf));
|
||||
(void)log("TCP/IP connect success to %s on service %s", hbuf, sbuf);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -108,14 +154,23 @@ static int tcpip_connect2(struct sockaddr_in server)
|
||||
int tcpip_connect(const char *hostname, e_tcpmode tcpmode)
|
||||
{
|
||||
int rc = 0;
|
||||
struct hostent *he = NULL;
|
||||
struct servent *se = NULL;
|
||||
struct sockaddr_in server;
|
||||
//struct hostent *he = NULL;
|
||||
//struct servent *se = NULL;
|
||||
//struct sockaddr_in server;
|
||||
//struct sockaddr_storage server;
|
||||
|
||||
struct addrinfo *aisave = NULL;
|
||||
struct addrinfo aihints;
|
||||
int nameres = 0;
|
||||
|
||||
|
||||
char *host = xstrcpy(hostname);
|
||||
char *p = strrchr(host, ':');
|
||||
const char *port = NULL;
|
||||
|
||||
server.sin_family = AF_INET;
|
||||
|
||||
// AF_INET - only IPv4
|
||||
//server.sin_family = AF_INET;
|
||||
|
||||
if( p )
|
||||
{ *p++ = '\0'; port = p; }
|
||||
@@ -123,18 +178,34 @@ int tcpip_connect(const char *hostname, e_tcpmode tcpmode)
|
||||
port = "binkp";
|
||||
else if( tcpmode == TCPMODE_TELNET )
|
||||
port = "telnet";
|
||||
else /* Default service name is "fido" */
|
||||
port = "fido";
|
||||
else /* Can not rely on /etc/services - it is not well-known port */
|
||||
port = "60179";
|
||||
|
||||
// Do not need it
|
||||
/*
|
||||
if( ISDEC(port) )
|
||||
server.sin_port = htons(atoi(port));
|
||||
else if( (se = getservbyname(port, "tcp")) )
|
||||
server.sin_port = se->s_port;
|
||||
else
|
||||
{ log("invalid port or service name \"%s\"", port); rc = 1; }
|
||||
*/
|
||||
//if( rc == 0 )
|
||||
//{
|
||||
DEB((D_INFO, "tcpip_connect: port is %s", port));
|
||||
memset( &aihints, 0, sizeof( aihints) );
|
||||
aihints.ai_family = AF_UNSPEC;
|
||||
//aihints.ai_socktype = SOCK_STREAM;
|
||||
aihints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
if( rc == 0 )
|
||||
nameres = getaddrinfo ( host, port, &aihints, &paddrinfo );
|
||||
if ( nameres != 0 )
|
||||
{
|
||||
rc = 1;
|
||||
log("Resolver error for host %s, port %s: \"%s\".", host, port, gai_strerror(nameres));
|
||||
}
|
||||
// GetHostByName works with IPv4 only and *deprecated*
|
||||
/*
|
||||
if( (he = gethostbyname(host)) )
|
||||
{
|
||||
memcpy(&server.sin_addr, he->h_addr, he->h_length);
|
||||
@@ -159,12 +230,19 @@ int tcpip_connect(const char *hostname, e_tcpmode tcpmode)
|
||||
log("unknown error while resolving host \"%s\"", host);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
//}
|
||||
|
||||
if( host ) { free(host); host = NULL; }
|
||||
DEB((D_INFO, "tcpip_connect: resolver got result!"));
|
||||
aisave = paddrinfo;
|
||||
|
||||
return rc ? rc : tcpip_connect2(server);
|
||||
if (rc == 0 )
|
||||
rc = tcpip_connect2(paddrinfo);
|
||||
|
||||
freeaddrinfo( aisave );
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int tcpip_init(void)
|
||||
|
||||
@@ -77,7 +77,7 @@ static char *lock_getname(const char *lockdir, const s_modemport *modemport)
|
||||
|
||||
ASSERT(modemport != NULL);
|
||||
|
||||
if( lockdir && *lockdir )
|
||||
if( *lockdir )
|
||||
lckname = (char *)xstrcpy(lockdir);
|
||||
else
|
||||
lckname = (char *)xstrcpy(BFORCE_LOCK_DIR);
|
||||
@@ -116,7 +116,7 @@ static pid_t lock_read_pid(const char *lckname)
|
||||
if( len == sizeof(pid) || sscanf(buf, "%d", &pid) != 1 || pid == 0 )
|
||||
{
|
||||
/* We found binary lock file? */
|
||||
pid = *((int *)buf);
|
||||
pid = *((u_int *)buf); //-V1032
|
||||
#ifndef LOCK_BINARY
|
||||
log("warning: found binary lock file %s", lckname);
|
||||
#endif
|
||||
@@ -197,12 +197,15 @@ static int lock_create(const char *lckname, const char *tmpname)
|
||||
int rc, fd;
|
||||
int tries;
|
||||
|
||||
|
||||
#ifdef LOCK_BINARY
|
||||
pid_t pid;
|
||||
#else
|
||||
char buf[32];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
ASSERT(lckname != NULL && tmpname != NULL);
|
||||
|
||||
if( (fd = open(tmpname, O_CREAT | O_RDWR, 0644)) < 0 )
|
||||
@@ -299,7 +302,6 @@ int port_checklock(const char *lockdir, const s_modemport *modemport)
|
||||
|
||||
rc = lock_check(lckname);
|
||||
|
||||
if( lckname )
|
||||
free(lckname);
|
||||
|
||||
return rc;
|
||||
@@ -312,20 +314,24 @@ int port_lock(const char *lockdir, const s_modemport *modemport)
|
||||
{
|
||||
int rc;
|
||||
char *lckname;
|
||||
char *tmpname, *p_tmpname;
|
||||
char *tmpname, *p_tmpname, *chunk;
|
||||
|
||||
if( lockdir && *lockdir )
|
||||
if( *lockdir )
|
||||
tmpname = xstrcpy(lockdir);
|
||||
else
|
||||
tmpname = xstrcpy(BFORCE_LOCK_DIR);
|
||||
|
||||
tmpname = xstrcat(tmpname, "bfXXXXXX");
|
||||
//tmpname = xstrcat(tmpname, "bfXXXXXX");
|
||||
|
||||
if( (p_tmpname = mktemp(tmpname)) == NULL )
|
||||
{
|
||||
logerr("can't generate unique file name from \"%s\"", tmpname);
|
||||
free(tmpname); return 1;
|
||||
}
|
||||
chunk = xmalloc(7);
|
||||
getrandname(chunk,6);
|
||||
p_tmpname = string_concat(tmpname, "bf", chunk, '\0');
|
||||
|
||||
//if( (p_tmpname = mktemp(tmpname)) == NULL )
|
||||
//{
|
||||
// logerr("can't generate unique file name from \"%s\"", tmpname);
|
||||
// free(tmpname); return 1;
|
||||
//}
|
||||
|
||||
if( (lckname = lock_getname(lockdir, modemport)) == NULL )
|
||||
{
|
||||
@@ -340,7 +346,6 @@ int port_lock(const char *lockdir, const s_modemport *modemport)
|
||||
|
||||
if( tmpname )
|
||||
free(tmpname);
|
||||
if( lckname )
|
||||
free(lckname);
|
||||
|
||||
return rc;
|
||||
|
||||
@@ -118,6 +118,9 @@ int tio_get(int fd, TIO *tio)
|
||||
{
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
return tcgetattr(fd, tio);
|
||||
#else
|
||||
DEB(("io_unix_tio: TERMIOS not supported!"));
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -127,6 +130,9 @@ int tio_set(int fd, TIO *tio)
|
||||
{
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
return tcsetattr(fd, TCSANOW, tio);
|
||||
#else
|
||||
DEB(("io_unix_tio: TERMIOS not supported!"));
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ int tty_putc(unsigned char ch, int timeout)
|
||||
|
||||
int tty_puts(const unsigned char *s, int timeout)
|
||||
{
|
||||
return tty_write_timeout(s, strlen(s), timeout);
|
||||
return tty_write_timeout(s, strlen((char *)s), timeout);
|
||||
}
|
||||
|
||||
int tty_getc(int timeout)
|
||||
|
||||
+33
-19
@@ -58,6 +58,7 @@ struct debuglevel {
|
||||
{ "Daemon", D_DAEMON },
|
||||
{ "Free", D_FREE },
|
||||
{ "24554", D_24554 },
|
||||
{ "Index", D_INDEX },
|
||||
// { "Daemon", D_DAEMON },
|
||||
{ "Full", D_FULL },
|
||||
{ NULL, 0 }
|
||||
@@ -106,11 +107,15 @@ int log_open(const char *logname, const char *ext, const char *tty)
|
||||
|
||||
if( logname )
|
||||
{
|
||||
DEB((D_INFO,"log_open: Opening log file %s", logname));
|
||||
|
||||
strnxcpy(log_name, logname, sizeof(log_name));
|
||||
|
||||
// May be NULL, so check both
|
||||
if( tty && *tty )
|
||||
strnxcpy(log_ttyname, tty, sizeof(log_ttyname));
|
||||
|
||||
// May be NULL, so check both
|
||||
if( ext && *ext )
|
||||
{
|
||||
strnxcpy(log_extension, ext, sizeof(log_extension));
|
||||
@@ -119,7 +124,7 @@ int log_open(const char *logname, const char *ext, const char *tty)
|
||||
}
|
||||
}
|
||||
|
||||
if( log_name )
|
||||
if( log_name[0] )
|
||||
{
|
||||
/* Open previously set log file */
|
||||
|
||||
@@ -140,9 +145,11 @@ int log_close(void)
|
||||
|
||||
ASSERT(log_fp);
|
||||
|
||||
if( log_fp )
|
||||
if( log_fp ) //-V0547
|
||||
{
|
||||
rc = fclose(log_fp); log_fp = NULL;
|
||||
rc = fclose(log_fp);
|
||||
DEB((D_INFO,"Closing log file."));
|
||||
log_fp = NULL;
|
||||
}
|
||||
|
||||
return rc;
|
||||
@@ -155,7 +162,7 @@ int log_reopen(const char *logname, const char *ext, const char *tty)
|
||||
if( log_isopened() )
|
||||
{
|
||||
if( !strcmp(logname, log_name)
|
||||
&& !strcmp(log_extension ? log_extension : "", ext ? ext : "") )
|
||||
&& !strcmp(log_extension, ext ? ext : "") )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -166,7 +173,7 @@ int log_reopen(const char *logname, const char *ext, const char *tty)
|
||||
}
|
||||
|
||||
|
||||
int log(const char *s, ...)
|
||||
void log(const char *s, ...)
|
||||
|
||||
{
|
||||
char timestr[40];
|
||||
@@ -206,10 +213,10 @@ int log(const char *s, ...)
|
||||
|
||||
va_end(args);
|
||||
|
||||
return 0;
|
||||
//return 0;
|
||||
}
|
||||
|
||||
int logerr(const char *s, ...)
|
||||
void logerr(const char *s, ...)
|
||||
{
|
||||
char timestr[40];
|
||||
va_list args;
|
||||
@@ -275,7 +282,7 @@ int logerr(const char *s, ...)
|
||||
|
||||
va_end(args);
|
||||
|
||||
return 0;
|
||||
//return 0;
|
||||
}
|
||||
|
||||
#endif /* USE_SYSLOG */
|
||||
@@ -283,6 +290,8 @@ int logerr(const char *s, ...)
|
||||
|
||||
#ifdef USE_SYSLOG
|
||||
|
||||
bool slog_active = FALSE;
|
||||
|
||||
const char *log_getfilename(int whatfor)
|
||||
{
|
||||
const char *p = "/dev/null";
|
||||
@@ -291,21 +300,26 @@ const char *log_getfilename(int whatfor)
|
||||
|
||||
bool log_isopened(void)
|
||||
{
|
||||
return TRUE;
|
||||
return slog_active;
|
||||
}
|
||||
|
||||
int log_open(const char *logname, const char *ext, const char *tty)
|
||||
{
|
||||
char *p = "bforce ";
|
||||
p = xstrcat(p, BF_VERSION);
|
||||
int fac = conf_number(cf_syslog_facility);
|
||||
if( tty && *tty )
|
||||
strncpy(p, tty, sizeof(p));
|
||||
strncpy(p, tty, strlen(p));
|
||||
openlog(p, LOG_PID, fac);
|
||||
slog_active = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int log_reopen(const char *logname, const char *ext, const char *tty)
|
||||
{
|
||||
if ( !slog_active ) {
|
||||
return (log_reopen(logname, ext, tty));
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -317,7 +331,7 @@ int log_close(void)
|
||||
|
||||
}
|
||||
|
||||
int log(const char *s, ...)
|
||||
void log(const char *s, ...)
|
||||
|
||||
{
|
||||
char timestr[40];
|
||||
@@ -344,10 +358,10 @@ int log(const char *s, ...)
|
||||
|
||||
va_end(args);
|
||||
|
||||
return 0;
|
||||
//return 0;
|
||||
}
|
||||
|
||||
int logerr(const char *s, ...)
|
||||
void logerr(const char *s, ...)
|
||||
|
||||
{
|
||||
char timestr[40];
|
||||
@@ -366,7 +380,7 @@ int logerr(const char *s, ...)
|
||||
|
||||
va_end(args);
|
||||
|
||||
return 0;
|
||||
// return 0;
|
||||
}
|
||||
|
||||
#endif /* USE_SYSLOG */
|
||||
@@ -450,7 +464,7 @@ int debug_open()
|
||||
|
||||
ASSERT(debug_fp == NULL);
|
||||
|
||||
if( debug_name )
|
||||
if( debug_name[0] )
|
||||
{
|
||||
|
||||
char log_name[PATH_MAX];
|
||||
@@ -504,7 +518,7 @@ int debug_close(void)
|
||||
|
||||
ASSERT(debug_fp != NULL);
|
||||
|
||||
if( debug_fp )
|
||||
if( debug_fp ) //-V0547
|
||||
{
|
||||
fprintf(debug_fp, "****************************************************\n");
|
||||
fprintf(debug_fp, " Closing binkleyforce debug file at %s\n",
|
||||
@@ -517,7 +531,7 @@ int debug_close(void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int debug(unsigned long what, const char *str, ...)
|
||||
void debug(unsigned long what, const char *str, ...)
|
||||
{
|
||||
char buf[40];
|
||||
va_list args;
|
||||
@@ -530,7 +544,7 @@ int debug(unsigned long what, const char *str, ...)
|
||||
debug_open();
|
||||
}
|
||||
|
||||
if( debug_fp )
|
||||
if( debug_fp != NULL )
|
||||
{
|
||||
fprintf(debug_fp, "%s ", time_string_log(buf, sizeof(buf), 0));
|
||||
va_start(args, str);
|
||||
@@ -541,7 +555,7 @@ int debug(unsigned long what, const char *str, ...)
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
//return 0;
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -243,7 +243,8 @@ void netspool_acknowledge(s_netspool_state *state)
|
||||
|
||||
void netspool_end(s_netspool_state *state)
|
||||
{
|
||||
sendstr(state->socket, "END satisfied");
|
||||
int i;
|
||||
i = sendstr(state->socket, "END satisfied");
|
||||
close(state->socket);
|
||||
state->state = NS_NOTINIT;
|
||||
}
|
||||
|
||||
+165
-12
@@ -56,20 +56,27 @@ int nodelist_checkflag(const char *nodeflags, const char *flag)
|
||||
const char *searchbase = nodeflags;
|
||||
char *q;
|
||||
|
||||
while( p = strstr(searchbase, flag) )
|
||||
DEB((D_NODELIST, "nodelist: checking flag \"%s\" in flags \"%s\"", flag, nodeflags));
|
||||
if ( nodeflags ) {
|
||||
while( p = strcasestr(searchbase, flag) ) // p - found flag
|
||||
{
|
||||
if( p == searchbase || *(p-1) == ',' )
|
||||
if ( ((p == searchbase)) || (*(p-1) == ','))
|
||||
{
|
||||
if( (q = strchr(p, ',')) == NULL || (q - p) == strlen(flag) )
|
||||
if( (q = strchr(p, ',')) == NULL || (q - p) == strlen(flag) ) {
|
||||
DEB((D_NODELIST, "nodelist: found flag %s", flag));
|
||||
return 0;
|
||||
if( (strchrnul(p, ':') - p) == strlen(flag) )
|
||||
}
|
||||
if( (strchrnul(p, ':') - p) == strlen(flag) ) {
|
||||
DEB((D_NODELIST, "nodelist: found flag %s", flag));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
searchbase = p + 1; // avoid finding again the same
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -191,6 +198,54 @@ int nodelist_parse_Txy(s_node *node, const char *xy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Pointlist string parser
|
||||
*
|
||||
* Arguments:
|
||||
* node put here all obtained information
|
||||
* str pointer to the nodelist string
|
||||
*
|
||||
* Return value:
|
||||
* zero value if string was parsed successfuly, and non-zero if wasn't
|
||||
*/
|
||||
int nodelist_parsepoint(s_node *node, char *str)
|
||||
{
|
||||
char *argv[NODELIST_POSFLAGS+1];
|
||||
char *p;
|
||||
int cnt;
|
||||
|
||||
DEB((D_NODELIST,"nodelist: parsepoint %s", str));
|
||||
|
||||
cnt = string_parse(argv, NODELIST_POSFLAGS+1, str, ',');
|
||||
if( cnt < NODELIST_POSFLAGS-1 )
|
||||
return -1;
|
||||
DEB((D_NODELIST,"nodelist: parsepoint OK: %d", cnt));
|
||||
strnxcpy(node->name, argv[NODELIST_POSNAME], sizeof(node->name));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint sys: %s", node->name));
|
||||
strnxcpy(node->location, argv[NODELIST_POSLOCATION], sizeof(node->location));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint loc: %s", node->location));
|
||||
strnxcpy(node->sysop, argv[NODELIST_POSSYSOP], sizeof(node->sysop));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint zyz: %s", node->sysop));
|
||||
strnxcpy(node->phone, argv[NODELIST_POSPHONE], sizeof(node->phone));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint pho: %s", node->phone));
|
||||
if (argv[NODELIST_POSFLAGS])
|
||||
strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags));
|
||||
DEB((D_NODELIST,"nodelist: parsepoint fl: %s", node->flags));
|
||||
if (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
|
||||
*/
|
||||
string_replchar(node->name, '_', ' ');
|
||||
string_replchar(node->location, '_', ' ');
|
||||
string_replchar(node->sysop, '_', ' ');
|
||||
node->keyword = KEYWORD_POINT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Nodelist string parser
|
||||
*
|
||||
@@ -205,7 +260,7 @@ int nodelist_parsestring(s_node *node, char *str)
|
||||
{
|
||||
char *argv[NODELIST_POSFLAGS+1];
|
||||
char *p;
|
||||
|
||||
DEB((D_NODELIST,"nodelist: parsestring %s", str));
|
||||
if( string_parse(argv, NODELIST_POSFLAGS+1, str, ',') != NODELIST_POSFLAGS+1 )
|
||||
return -1;
|
||||
|
||||
@@ -243,7 +298,7 @@ int nodelist_parsestring(s_node *node, char *str)
|
||||
strnxcpy(node->phone, argv[NODELIST_POSPHONE], sizeof(node->phone));
|
||||
strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags));
|
||||
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
|
||||
*/
|
||||
@@ -291,11 +346,86 @@ int nodelist_parsestring(s_node *node, char *str)
|
||||
node->do_ifcico = nodelist_checkflag(node->flags, "IFC") == 0;
|
||||
node->do_telnet = nodelist_checkflag(node->flags, "ITN") == 0;
|
||||
|
||||
//TODO: Add more INA flags to array
|
||||
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;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Hidden adresses adder
|
||||
*
|
||||
* Arguments:
|
||||
* node a node for which we add HIDDEN lines with IpAddr
|
||||
* str pointer to the flags string
|
||||
*
|
||||
* Return value:
|
||||
* -1 if error
|
||||
* zero value if string had no hidden INA:, pos - num of INA's above
|
||||
* first
|
||||
*/
|
||||
|
||||
int nodelist_parsehiddenina(s_node *node,s_override *ov) {
|
||||
|
||||
int rc = 0;
|
||||
s_override *ovr;
|
||||
s_override *ovrbase = ov;
|
||||
|
||||
|
||||
char *tmp, *p, *q;
|
||||
const char *searchbase = node->flags;
|
||||
int flaglen = 3;
|
||||
|
||||
tmp = xmalloc(BNI_MAXHOST+1);
|
||||
|
||||
while( p = strstr(searchbase, "INA") )
|
||||
{
|
||||
if( p == node->flags || *(p-1) == ',' ) // match flag
|
||||
{
|
||||
if( *(p+flaglen) == 0 || *(p+flaglen) == ',' )
|
||||
{
|
||||
// empty flag
|
||||
memset(tmp, '\0', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( *(p+flaglen) == ':' ) {
|
||||
// flag has data
|
||||
p += flaglen + 1; // start of data
|
||||
q = strchrnul(p, ','); // end of data: comma or EOS
|
||||
strncpy(tmp, p, q-p);
|
||||
tmp[q-p]='\0';
|
||||
DEB((D_NODELIST, "nodelist: host INA is %s", node->host));
|
||||
if (!strcmp(tmp, node->host)) {
|
||||
DEB((D_NODELIST, "nodelist: found host INA %s", tmp));
|
||||
|
||||
|
||||
} else {
|
||||
DEB((D_NODELIST, "nodelist: found hidden INA %s", tmp));
|
||||
rc += 1;
|
||||
// let's find last override to add
|
||||
while (ovrbase->hidden != NULL) ovrbase = ovrbase->hidden;
|
||||
// and add new element to hiddens:
|
||||
ovr = xmalloc(sizeof(s_override));
|
||||
memset(ovr,'\0',sizeof(s_override));
|
||||
ovr->hidden = NULL;
|
||||
ovr->sIpaddr = xstrcpy(tmp);
|
||||
ovr->addr = node->addr;
|
||||
ovrbase->hidden = ovr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
searchbase = p + 1;
|
||||
}
|
||||
free(tmp);
|
||||
return rc;
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Open nodelist, nodelist index, do some checks
|
||||
*
|
||||
@@ -452,7 +582,7 @@ s_nodelist *nodelist_open(const char *dir, char *name, int mode)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
DEB((D_NODELIST, "nodelist_open: endianness = %x", (uint32_t) tmp.endian));
|
||||
return xmemcpy(&tmp, sizeof(s_nodelist));
|
||||
}
|
||||
|
||||
@@ -500,6 +630,7 @@ int nodelist_checkheader(s_nodelist *nlp)
|
||||
(long)nlstat.st_size, (long)nlsize);
|
||||
return -1;
|
||||
}
|
||||
nlp->endian = buffer_getlong(buffer + 12);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -530,7 +661,7 @@ int nodelist_createheader(s_nodelist *nlp)
|
||||
|
||||
buffer_putlong(hdrbuf + 0, nlstat.st_mtime);
|
||||
buffer_putlong(hdrbuf + 4, nlstat.st_size);
|
||||
|
||||
buffer_putlong(hdrbuf + 12, (long) 0xDEADBEEF);
|
||||
if( fseek(nlp->fp_index, 0L, SEEK_SET) == -1 )
|
||||
{
|
||||
logerr("cannot seek to zero offset of index");
|
||||
@@ -561,10 +692,10 @@ int nodelist_close(s_nodelist *nlp)
|
||||
|
||||
ASSERT(nlp && nlp->fp_nodelist && nlp->fp_index);
|
||||
|
||||
if( nlp->fp_nodelist && file_close(nlp->fp_nodelist) )
|
||||
if( nlp->fp_nodelist && file_close(nlp->fp_nodelist) ) //-V0560
|
||||
logerr("cannot close nodelist \"%s\"", nlp->name_nodelist);
|
||||
|
||||
if( nlp->fp_index && file_close(nlp->fp_index) )
|
||||
if( nlp->fp_index && file_close(nlp->fp_index) ) //-V0560
|
||||
{
|
||||
logerr("cannot close nodelist index \"%s\"", nlp->name_index);
|
||||
rc = 1;
|
||||
@@ -587,7 +718,9 @@ int nodelist_putindex(s_nodelist *nlp, const s_bni *bni)
|
||||
buffer_putint(buffer + 6, bni->point);
|
||||
buffer_putint(buffer + 8, bni->hub);
|
||||
buffer_putlong(buffer + 10, bni->offset);
|
||||
|
||||
if (bni->point != 0) {
|
||||
DEB((D_NODELIST, "nodelist: findindex found point z: %d, n: %d, l: %d, p: %d, offset: %l", bni->zone, bni->net, bni->node, bni->point, bni->offset));
|
||||
}
|
||||
if( fwrite(buffer, sizeof(buffer), 1, nlp->fp_index) != 1 )
|
||||
{
|
||||
logerr("error writing nodelist index file \"%s\"", nlp->name_index);
|
||||
@@ -622,6 +755,10 @@ int nodelist_findindex(s_nodelist *nlp, s_bni *bni, s_faddr addr)
|
||||
bni->point = buffer_getint(p + 6);
|
||||
bni->hub = buffer_getint(p + 8);
|
||||
bni->offset = buffer_getlong(p + 10);
|
||||
if ((uint32_t)nlp->endian == 0xBEEFDEAD) {
|
||||
swap_long((char *)&bni->offset);
|
||||
}
|
||||
DEB((D_NODELIST, "nodelist: findindex found" ));
|
||||
return 0;
|
||||
}
|
||||
p += NODELIST_ENTRYSIZE;
|
||||
@@ -661,6 +798,7 @@ int nodelist_lookup_string(char *buffer, size_t buflen, s_faddr addr)
|
||||
*/
|
||||
for( ptrl = conf_first(cf_nodelist); ptrl; ptrl = conf_next(ptrl) )
|
||||
{
|
||||
DEB((D_NODELIST,"nl_lookup_string: using %s",ptrl->d.falist.what));
|
||||
if( ftn_addrcomp_mask(addr, ptrl->d.falist.addr) == 0 )
|
||||
{
|
||||
if( (nlp = nodelist_open(ndldir, ptrl->d.falist.what, NODELIST_READ)) )
|
||||
@@ -691,11 +829,25 @@ int nodelist_lookup(s_node *node, s_faddr addr)
|
||||
if( nodelist_lookup_string(buf, sizeof(buf), addr) == 0 )
|
||||
{
|
||||
node->listed = TRUE;
|
||||
if (addr.point == 0)
|
||||
{
|
||||
if( nodelist_parsestring(node, buf) == -1 )
|
||||
{
|
||||
DEB((D_NODELIST,"invalid nodelist string for address %s",
|
||||
ftn_addrstr(abuf, addr)));
|
||||
log("invalid nodelist string for address %s",
|
||||
ftn_addrstr(abuf, addr));
|
||||
}
|
||||
} else {
|
||||
if ( nodelist_parsepoint(node, buf) == -1 )
|
||||
{
|
||||
DEB((D_NODELIST,"invalid nodelist string for address %s",
|
||||
ftn_addrstr(abuf, addr)));
|
||||
log("invalid nodelist string for address %s",
|
||||
ftn_addrstr(abuf, addr));
|
||||
}
|
||||
node->addr = addr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -711,5 +863,6 @@ void nodelist_initnode(s_node *node, s_faddr addr)
|
||||
strcpy(node->sysop, "<none>");
|
||||
strcpy(node->location, "<none>");
|
||||
strcpy(node->phone, "<none>");
|
||||
strcpy(node->flags, "<none>");
|
||||
}
|
||||
|
||||
|
||||
+21
-7
@@ -73,9 +73,18 @@ int exec_options_parse(char *str)
|
||||
|
||||
void exec_options_init(s_exec_options *eopt)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
memset(eopt, '\0', sizeof(s_exec_options));
|
||||
eopt->umask = EXEC_DEFAULT_UMASK;
|
||||
eopt->envp[0] = NULL;
|
||||
|
||||
while(mainenv[i]) {
|
||||
DEB((D_FREE,"EXEC: Added ENV variable: %s\n", mainenv[i]));
|
||||
eopt->envp[i] = xmalloc(strlen(mainenv[i]) + 2);
|
||||
strcpy(eopt->envp[i],mainenv[i]);
|
||||
eopt->envp[++i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void exec_options_deinit(s_exec_options *eopt)
|
||||
@@ -143,10 +152,11 @@ int exec_redirect_descriptor(int desc, const char *fname, int flags)
|
||||
{
|
||||
log("exec error: cannot open \"%s\" <--> %d (got %d)",
|
||||
fname, desc, fd);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0; //cppcheck-suppress resourceLeak
|
||||
}
|
||||
|
||||
int exec_command(s_exec_options *eopt)
|
||||
@@ -320,6 +330,7 @@ int xsystem(const char *command, const char *p_input, const char *p_output)
|
||||
{
|
||||
pid_t pid;
|
||||
int status;
|
||||
int fd;
|
||||
|
||||
ASSERT(command != NULL);
|
||||
|
||||
@@ -333,27 +344,30 @@ int xsystem(const char *command, const char *p_input, const char *p_output)
|
||||
if( p_input )
|
||||
{
|
||||
close(0);
|
||||
if( open(p_input, O_RDONLY) != 0 )
|
||||
fd = open(p_input, O_RDONLY);
|
||||
if( fd != 0 )
|
||||
{
|
||||
logerr("can't open stdin \"%s\"", p_input);
|
||||
close(fd);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
if( p_output )
|
||||
{
|
||||
close(1);
|
||||
if( open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600) != 1 )
|
||||
fd = open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600);
|
||||
if( fd != 1 )
|
||||
{
|
||||
logerr("can't open stdout \"%s\"", p_output);
|
||||
close(fd);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
if( p_output )
|
||||
{
|
||||
close(2);
|
||||
if( open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600) != 2 )
|
||||
fd = open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600);
|
||||
if( fd != 2 )
|
||||
{
|
||||
logerr("can't open stderr \"%s\"", p_output);
|
||||
close(fd);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ static int out_bsy_convert_csy_to_bsy(s_bsylist *ptrl)
|
||||
out_bsy_file_link(lockname, ".csy", lockname, ".bsy")
|
||||
|
||||
/* Create BSY file in 4D outbound */
|
||||
if( !isfailed && ptrl->name_4d )
|
||||
if( ptrl->name_4d )
|
||||
{
|
||||
switch( LINK_CSY_TO_BSY(ptrl->name_4d) ) {
|
||||
case PLOCK_OK: locked_4d = TRUE; break;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ char *out_getname_4d(s_faddr addr)
|
||||
else
|
||||
sprintf(buf, "%04x%04x.pnt/%08x", addr.net, addr.node, addr.point);
|
||||
|
||||
dest = string_concat(p_outbound, buf, NULL);
|
||||
dest = string_concat(p_outbound, buf, '\0');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -55,7 +55,7 @@ char *out_getname_4d(s_faddr addr)
|
||||
else
|
||||
sprintf(buf, ".%03x/%04x%04x.pnt/%08x", addr.zone, addr.net, addr.node, addr.point);
|
||||
|
||||
dest = string_concat(out_root, out_main, buf, NULL);
|
||||
dest = string_concat(out_root, out_main, buf, '\0');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ char *out_getname_domain(s_faddr addr)
|
||||
else
|
||||
sprintf(buf, "%04x%04x.pnt/%08x", addr.net, addr.node, addr.point);
|
||||
|
||||
dest = string_concat(cfptr->d.domain.path, buf, NULL);
|
||||
dest = string_concat(cfptr->d.domain.path, buf, '\0');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ char *out_getname_amiga(s_faddr addr)
|
||||
if( p_amigaoutbound && *p_amigaoutbound )
|
||||
{
|
||||
sprintf(buf, "%d.%d.%d.%d", addr.zone, addr.net, addr.node, addr.point);
|
||||
dest = string_concat(p_amigaoutbound, buf, NULL);
|
||||
dest = string_concat(p_amigaoutbound, buf, '\0');
|
||||
}
|
||||
|
||||
return dest;
|
||||
|
||||
@@ -155,7 +155,7 @@ static int out_scan_bso_dir(s_outbound_callback_data *callback,
|
||||
|
||||
if( alst || !fa_list )
|
||||
{
|
||||
p = string_concat(path, dirent->d_name, "/", NULL);
|
||||
p = string_concat(path, dirent->d_name, "/", '\0');
|
||||
out_scan_bso_dir(callback, fa_list, addr, p, 1);
|
||||
if( p ) { free(p); p = NULL; }
|
||||
}
|
||||
@@ -178,7 +178,7 @@ static int out_scan_bso_dir(s_outbound_callback_data *callback,
|
||||
|
||||
if( alst || !fa_list )
|
||||
{
|
||||
callback->path = string_concat(path, dirent->d_name, NULL);
|
||||
callback->path = string_concat(path, dirent->d_name, '\0');
|
||||
callback->addr = *addr;
|
||||
callback->type = OUTB_TYPE_BSO;
|
||||
callback->flavor = -1;
|
||||
@@ -250,7 +250,7 @@ static int out_scan_bso(s_outbound_callback_data *callback,
|
||||
|
||||
if( alst || mailfor == NULL )
|
||||
{
|
||||
newpath = string_concat(out_root, dirent->d_name, "/", NULL);
|
||||
newpath = string_concat(out_root, dirent->d_name, "/", '\0');
|
||||
out_scan_bso_dir(callback, mailfor, &addr, newpath, 0);
|
||||
free(newpath);
|
||||
}
|
||||
@@ -272,7 +272,7 @@ static int out_parse_name_lbox(s_faddr *addr, const char *filename)
|
||||
ASSERT(addr && filename);
|
||||
|
||||
memset(&tmp, '\0', sizeof(s_faddr));
|
||||
if( sscanf(filename, "%d.%d.%d.%d",
|
||||
if( sscanf(filename, "%u.%u.%u.%u",
|
||||
&tmp.zone, &tmp.net, &tmp.node, &tmp.point) == 4 )
|
||||
{
|
||||
*addr = tmp;
|
||||
@@ -296,7 +296,7 @@ static int out_scan_fbox_dir(s_outbound_callback_data *callback,
|
||||
|
||||
while( (dirent = readdir(dir)) )
|
||||
{
|
||||
callback->path = string_concat(path, dirent->d_name, NULL);
|
||||
callback->path = string_concat(path, dirent->d_name, '\0');
|
||||
if( is_regfile(callback->path) )
|
||||
{
|
||||
callback->addr = addr;
|
||||
@@ -340,7 +340,7 @@ static int out_scan_lbox(s_outbound_callback_data *callback,
|
||||
alst = alst->next );
|
||||
if( alst )
|
||||
{
|
||||
newpath = string_concat(path, dirent->d_name, "/", NULL);
|
||||
newpath = string_concat(path, dirent->d_name, "/", '\0');
|
||||
(void)out_scan_fbox_dir(callback, newpath, addr, FLAVOR_HOLD);
|
||||
free(newpath);
|
||||
}
|
||||
@@ -348,7 +348,7 @@ static int out_scan_lbox(s_outbound_callback_data *callback,
|
||||
else
|
||||
{
|
||||
/* Scan all fileboxes */
|
||||
newpath = string_concat(path, dirent->d_name, "/", NULL);
|
||||
newpath = string_concat(path, dirent->d_name, "/", '\0');
|
||||
(void)out_scan_fbox_dir(callback, newpath, addr, FLAVOR_HOLD);
|
||||
free(newpath);
|
||||
}
|
||||
@@ -377,7 +377,7 @@ int out_parse_name_aso(s_faddr *addr, const char *filename)
|
||||
ASSERT(addr && filename);
|
||||
|
||||
memset(&tmp, '\0', sizeof(s_faddr));
|
||||
if( sscanf(filename, "%d.%d.%d.%d.%*s", &tmp.zone,
|
||||
if( sscanf(filename, "%u.%u.%u.%u.%*s", &tmp.zone,
|
||||
&tmp.net, &tmp.node, &tmp.point) == 4 )
|
||||
{
|
||||
*addr = tmp;
|
||||
@@ -424,7 +424,7 @@ static int out_scan_aso(s_outbound_callback_data *callback,
|
||||
|
||||
if( alst || !mailfor )
|
||||
{
|
||||
callback->path = string_concat(path, dirent->d_name, NULL);
|
||||
callback->path = string_concat(path, dirent->d_name, '\0');
|
||||
callback->addr = addr;
|
||||
callback->type = OUTB_TYPE_ASO;
|
||||
callback->flavor = -1;
|
||||
|
||||
@@ -186,9 +186,9 @@ int out_handle_sysqueue(s_outbound_callback_data *callback)
|
||||
}
|
||||
|
||||
/* Try to found existing entry for this address */
|
||||
if( (sentry = out_getsysentry((s_sysqueue*)callback->dest,
|
||||
callback->addr)) == NULL )
|
||||
return -1;
|
||||
sentry = out_getsysentry((s_sysqueue*)callback->dest,
|
||||
callback->addr);
|
||||
// if (!sentry) return -1;
|
||||
|
||||
if( type == TYPE_NETMAIL || type == TYPE_REQUEST || type == TYPE_FILEBOX )
|
||||
{
|
||||
@@ -283,7 +283,7 @@ void log_sysqueue(const s_sysqueue *q)
|
||||
if( q->systab[i].flavors & FLAVOR_CRASH ) strcat(tmp, "Crash,");
|
||||
if( q->systab[i].flavors & FLAVOR_NORMAL ) strcat(tmp, "Normal,");
|
||||
if( q->systab[i].flavors & FLAVOR_HOLD ) strcat(tmp, "Hold,");
|
||||
if( tmp[0] ) tmp[strlen(tmp)-1] = '\0';
|
||||
if( strlen(tmp)>0 ) tmp[strlen(tmp)-1] = '\0';
|
||||
DEB((D_OUTBOUND, "log_sysqueue: \tflavors: \"%s\"", tmp));
|
||||
|
||||
tmp[0] = '\0';
|
||||
@@ -294,7 +294,7 @@ void log_sysqueue(const s_sysqueue *q)
|
||||
if( q->systab[i].types & TYPE_FILEECHO ) strcat(tmp, "fileecho,");
|
||||
if( q->systab[i].types & TYPE_FILEBOX ) strcat(tmp, "filebox,");
|
||||
if( q->systab[i].types & TYPE_FROMFLO ) strcat(tmp, "fromflo,");
|
||||
if( tmp[0] ) tmp[strlen(tmp)-1] = '\0';
|
||||
if( strlen(tmp)>0 ) tmp[strlen(tmp)-1] = '\0';
|
||||
DEB((D_OUTBOUND, "log_sysqueue: \ttypes: \"%s\"", tmp));
|
||||
}
|
||||
DEB((D_OUTBOUND, "log_sysqueue: END"));
|
||||
|
||||
+118
-59
@@ -64,6 +64,8 @@ int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned
|
||||
int binkp_doreceiveblock(s_binkp_state *bstate, char *buf, int block_type, unsigned short block_length);
|
||||
void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer);
|
||||
void binkp_process_ADR(char *buffer);
|
||||
int binkp_auth_incoming(s_binkp_sysinfo *remote_data);
|
||||
|
||||
|
||||
int binkp_loop(s_binkp_state *bstate) {
|
||||
unsigned char readbuf[BINKP_HEADER+BINKP_MAXBLOCK+1];
|
||||
@@ -93,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;
|
||||
@@ -115,13 +117,14 @@ int binkp_loop(s_binkp_state *bstate) {
|
||||
|
||||
// session criterium handshake criterium
|
||||
while (!bstate->complete || bstate->waiting_got) {
|
||||
DEB((D_24554, "loop s: %d r: %d p: %d sp: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete,
|
||||
DEB((D_24554, ">>> BinkP loop sendcpl: %d recvcpl: %d phase: %d subphase: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete,
|
||||
bstate->phase, bstate->subphase));
|
||||
if (bstate->continuesend) {
|
||||
no_more_to_send = 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);
|
||||
if(m==1 || m==3) {
|
||||
//DEB((D_24554, "got block for sending %d %hu", block_type, block_length));
|
||||
@@ -137,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);
|
||||
}
|
||||
@@ -206,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
|
||||
}
|
||||
@@ -225,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;
|
||||
@@ -265,15 +274,16 @@ int binkp_loop(s_binkp_state *bstate) {
|
||||
have_to_write -= n;
|
||||
}
|
||||
}
|
||||
DEB((D_24554,"+++ BinkP Loop ended with rc=%d", bstate->rc));
|
||||
return bstate->rc;
|
||||
}
|
||||
|
||||
int binkp_outgoing(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data)
|
||||
{
|
||||
char *p;
|
||||
init_keys(remote_data->keys_out, local_data->passwd ? local_data->passwd : "-");
|
||||
init_keys(remote_data->keys_out, local_data->passwd[0] ? local_data->passwd : "-");
|
||||
init_keys(remote_data->keys_in, "-");
|
||||
for (p=local_data->passwd ? local_data->passwd : "-"; *p; p++)
|
||||
for (p=local_data->passwd[0] ? local_data->passwd : "-"; *p; p++)
|
||||
update_keys(remote_data->keys_in, (int)*p);
|
||||
s_binkp_state s;
|
||||
s.mode = bmode_outgoing_handshake;
|
||||
@@ -336,8 +346,8 @@ int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned
|
||||
{
|
||||
int my_sf, wr_pos;
|
||||
int n; // read file
|
||||
if (bstate->extracmd[0]!=-1) {
|
||||
DEB((D_24554, "send command from receiver %d %s", bstate->extracmd[0], bstate->extracmd+1));
|
||||
if (bstate->extracmd[0]!=(char)-1) {
|
||||
DEB((D_24554, "Send cmd to remote %d %s", bstate->extracmd[0], bstate->extracmd+1));
|
||||
buf[0] = bstate->extracmd[0];
|
||||
strcpy(buf+1, bstate->extracmd+1);
|
||||
*block_type = BINKP_BLK_CMD;
|
||||
@@ -415,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;
|
||||
@@ -458,8 +469,10 @@ case 2:
|
||||
|
||||
case 3: // send password on outgoing or pw confirmation on incoming
|
||||
// special empty password is sent if there is no password for the remote addr
|
||||
if (bstate->mode==bmode_incoming_handshake) {
|
||||
if (bstate->password_received) {
|
||||
if (bstate->mode==bmode_incoming_handshake)
|
||||
{
|
||||
if (bstate->password_received)
|
||||
{
|
||||
DEB((D_24554, "send OK, password verified"));
|
||||
buf[0] = BPMSG_OK;
|
||||
*block_type = BINKP_BLK_CMD;
|
||||
@@ -470,8 +483,10 @@ case 3: // send password on outgoing or pw confirmation on incoming
|
||||
DEB((D_24554, "waiting for password from remote"));
|
||||
return 0; // nothing to send
|
||||
}
|
||||
else if (bstate->mode==bmode_outgoing_handshake) {
|
||||
if (!bstate->address_established) {
|
||||
else
|
||||
{
|
||||
if (!bstate->address_established)
|
||||
{
|
||||
DEB((D_24554, "address not received still"));
|
||||
return 0;
|
||||
}
|
||||
@@ -480,53 +495,81 @@ case 3: // send password on outgoing or pw confirmation on incoming
|
||||
buf[0] = BPMSG_PWD;
|
||||
*block_type = BINKP_BLK_CMD;
|
||||
|
||||
if( bstate->local_data->passwd == '\0' ) {
|
||||
if( bstate->local_data->passwd[0] == '\0' )
|
||||
{
|
||||
*block_length = 1 + sprintf(buf+1, "-");
|
||||
}
|
||||
else if( bstate->remote_data->options & BINKP_OPT_MD5 ) {
|
||||
else
|
||||
if( bstate->remote_data->options & BINKP_OPT_MD5 )
|
||||
{
|
||||
char digest_bin[16];
|
||||
char digest_hex[33];
|
||||
|
||||
if(bstate->remote_data->challenge_length==0) {
|
||||
if(bstate->remote_data->challenge_length==0)
|
||||
{
|
||||
DEB((D_24554, "waiting for challenge"));
|
||||
return 0;
|
||||
}
|
||||
md5_cram_get(bstate->local_data->passwd, bstate->remote_data->challenge,
|
||||
bstate->remote_data->challenge_length, digest_bin);
|
||||
|
||||
md5_cram_get(bstate->local_data->passwd,
|
||||
bstate->remote_data->challenge,
|
||||
bstate->remote_data->challenge_length,
|
||||
digest_bin);
|
||||
|
||||
/* Encode digest to the hex string */
|
||||
string_bin_to_hex(digest_hex, digest_bin, 16);
|
||||
|
||||
*block_length = 1 + sprintf(buf+1, "CRAM-MD5-%s", digest_hex);
|
||||
*block_length = 1 + sprintf(buf+1,
|
||||
"CRAM-MD5-%s", digest_hex);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
*block_length = 1 + sprintf(buf+1, "%s", bstate->local_data->passwd);
|
||||
}
|
||||
bstate->phase += 1;
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
log("impossible mode");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
case 4:
|
||||
;
|
||||
char pbuf[32];
|
||||
int pwset = 0;
|
||||
|
||||
if (bstate->mode==bmode_incoming_handshake) {
|
||||
char * p;
|
||||
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)) ){
|
||||
init_keys(bstate->remote_data->keys_in, pbuf?pbuf:"-");
|
||||
pwset = 1;
|
||||
init_keys(bstate->remote_data->keys_in, pbuf[0]?pbuf:"-");
|
||||
init_keys(bstate->remote_data->keys_out, "-");
|
||||
for (p=pbuf?pbuf:"-"; *p; p++)
|
||||
for (p=pbuf[0]?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;
|
||||
}
|
||||
@@ -561,7 +604,7 @@ case 4:
|
||||
case 1: //send M_FILE - M_GET forcibly sets this phase. M_GET must open needed file
|
||||
DEB((D_24554, "send M_FILE"));
|
||||
buf[0] = BPMSG_FILE;
|
||||
*block_length = 1+sprintf(buf+1, "%s %ld %ld 0", bstate->pi->send->net_name,
|
||||
*block_length = 1+sprintf(buf+1, "%s %zu %lu 0", bstate->pi->send->net_name,
|
||||
bstate->pi->send->bytes_total, bstate->pi->send->mod_time);
|
||||
DEB((D_24554, "M_FILE: %s", buf+1));
|
||||
*block_type = BINKP_BLK_CMD;
|
||||
@@ -623,7 +666,7 @@ case 4:
|
||||
return 1;
|
||||
|
||||
case 5:
|
||||
DEB((D_24554, "nothing to send"));
|
||||
DEB((D_24554, "BinkP_GetForSend: nothing to send"));
|
||||
return 2;
|
||||
|
||||
|
||||
@@ -647,7 +690,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")
|
||||
@@ -664,12 +710,11 @@ case BPMSG_ADR: /* List of addresses */
|
||||
if (bstate->address_established) {
|
||||
PROTO_ERROR("remote tries to change address");
|
||||
}
|
||||
if( bstate->extracmd[0] !=-1 ) return 0; // suspend !!!
|
||||
if( bstate->extracmd[0] != (char)0xFF ) return 0; // suspend !!!
|
||||
binkp_process_ADR(buf+1);
|
||||
|
||||
if( !state.n_remoteaddr ) {
|
||||
log("error: remote did not supplied any addresses");
|
||||
if( bstate->extracmd[0] !=-1 ) return 0; // suspend
|
||||
bstate->extracmd[0] = BPMSG_BSY;
|
||||
strcpy(bstate->extracmd+1, "No addresses was presented");
|
||||
bstate->extraislast = true;
|
||||
@@ -681,16 +726,19 @@ case BPMSG_ADR: /* List of addresses */
|
||||
DEB((D_24554, "sending options"));
|
||||
bstate->extracmd[0] = BPMSG_NUL;
|
||||
bstate->extraislast = false;
|
||||
sprintf(bstate->extracmd+1,"OPT MB");
|
||||
sprintf(bstate->extracmd+1,"OPT MB CRYPT");
|
||||
s_override ovr;
|
||||
DEB((D_24554, "process adr overrides"));
|
||||
for(i = 0; i < state.n_remoteaddr; i++) {
|
||||
ovr.sFlags = "";
|
||||
override_get (&ovr, state.remoteaddrs[i].addr, 0);
|
||||
DEB((D_24554, "got adr overrides"));
|
||||
if (nodelist_checkflag (ovr.sFlags, "NR")==0) {
|
||||
strcat (bstate->extracmd+1, " NR");
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEB((D_24554, "process adr overrides"));
|
||||
}
|
||||
// further use extracmd only for errors
|
||||
|
||||
@@ -736,7 +784,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;
|
||||
@@ -745,7 +793,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)0xFF ) return 0; // suspend if extra is occupied
|
||||
bstate->extracmd[0] = BPMSG_BSY;
|
||||
strcpy(bstate->extracmd+1, "All addresses are busy");
|
||||
bstate->extraislast = true;
|
||||
@@ -766,6 +814,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;
|
||||
@@ -782,9 +831,9 @@ 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);
|
||||
sprintf(bstate->extracmd+1, "%s %zu %lu %zu", recvfi.fn, recvfi.sz, recvfi.tm, recvfi.offs);
|
||||
bstate->extraislast = false;
|
||||
return 1;
|
||||
}
|
||||
@@ -794,7 +843,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) {
|
||||
@@ -802,7 +851,7 @@ case 0:
|
||||
bstate->frs = frs_data;
|
||||
return 1;
|
||||
}
|
||||
DEB((D_24554, "making M_GET to skip downloaded part"));
|
||||
DEB((D_24554, "making M_GET to skip downloaded part, file: %s, size %ld, time %ld, mode 0",recvfi.fn,recvfi.sz, recvfi.tm ));
|
||||
bstate->extracmd[0] = BPMSG_GET;
|
||||
sprintf(bstate->extracmd+1, "%s %ld %ld %ld",
|
||||
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
|
||||
@@ -831,7 +880,7 @@ case 2:
|
||||
default:
|
||||
PROTO_ERROR("p_rx_fopen_error");
|
||||
}
|
||||
PROTO_ERROR("never should get here");
|
||||
// PROTO_ERROR("never should get here");
|
||||
|
||||
case BPMSG_OK: /* Password was acknowleged (data ignored) */
|
||||
DEB((D_24554, "received M_OK len=%d", block_length));
|
||||
@@ -840,7 +889,7 @@ case BPMSG_OK: /* Password was acknowleged (data ignored) */
|
||||
}
|
||||
if (session_addrs_lock(state.remoteaddrs, state.n_remoteaddr)) {
|
||||
log("error: unable to lock");
|
||||
if (bstate->extracmd[0]!=-1) return 0;
|
||||
if (bstate->extracmd[0]!= (char)0xFF) return 0;
|
||||
bstate->extracmd[0] = BPMSG_BSY;
|
||||
strcpy(bstate->extracmd+1, "All addresses are busy");
|
||||
bstate->extraislast = true;
|
||||
@@ -916,10 +965,10 @@ got_skip:
|
||||
|
||||
check_that_all_files_are_confirmed:
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < bstate->pi->n_sentfiles; i++) {
|
||||
int j;
|
||||
for (j = 0; j < bstate->pi->n_sentfiles; j++) {
|
||||
if (bstate->pi->sentfiles[i].status == FSTAT_WAITACK) {
|
||||
DEB((D_24554, "sent file %d waits for acknowlede", i));
|
||||
DEB((D_24554, "sent file %d waits for acknowlede", j));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -950,7 +999,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));
|
||||
|
||||
if (bstate->extracmd[0] != -1) return 0;
|
||||
if (bstate->extracmd[0] != (char)0xFF) return 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"));
|
||||
@@ -1040,14 +1089,14 @@ case BINKP_BLK_DATA:
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (bstate->extracmd[0] != -1) return 0;
|
||||
if (bstate->extracmd[0] != (char)0xFF) return 0;
|
||||
|
||||
long int n;
|
||||
n = p_rx_writefile(buf, block_length, bstate->pi);
|
||||
|
||||
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);
|
||||
@@ -1076,11 +1125,13 @@ 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 ) {
|
||||
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) ) {
|
||||
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,
|
||||
@@ -1088,7 +1139,8 @@ case BINKP_BLK_DATA:
|
||||
bstate->extraislast = false;
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
DEB((D_24554, "some error committing file"));
|
||||
bstate->extracmd[0] = BPMSG_SKIP;
|
||||
sprintf(bstate->extracmd+1, "%s %ld %ld",
|
||||
@@ -1097,12 +1149,14 @@ case BINKP_BLK_DATA:
|
||||
bstate->extraislast = false;
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
DEB((D_24554, "data block accepted"));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
PROTO_ERROR("never should be here");
|
||||
PROTO_ERROR("never should be here"); //-V0779
|
||||
default:
|
||||
PROTO_ERROR("impossible block_type");
|
||||
}
|
||||
@@ -1113,7 +1167,7 @@ default:
|
||||
|
||||
void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer)
|
||||
{
|
||||
char *p, *q;
|
||||
|
||||
|
||||
if( strncmp(buffer, "SYS ", 4) == 0 )
|
||||
strnxcpy(remote_data->systname, buffer+4, sizeof(remote_data->systname));
|
||||
@@ -1136,14 +1190,16 @@ 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 )
|
||||
{
|
||||
char *p;
|
||||
/* <mailer> [<protocol>/<vermaj>.<vermin>] */
|
||||
if( (p = strchr(buffer+4, ' ')) )
|
||||
{
|
||||
char *q;
|
||||
strnxcpy(remote_data->progname, buffer+4,
|
||||
MIN(sizeof(remote_data->progname), p - (buffer+4) + 1));
|
||||
++p;
|
||||
@@ -1177,13 +1233,16 @@ void binkp_process_ADR(char *buffer)
|
||||
{
|
||||
s_faddr addr;
|
||||
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) )
|
||||
{
|
||||
DEB((D_24554, "binkp_process_ADR got token \"%s\" ",p ));
|
||||
if( ftn_addrparse(&addr, p, FALSE) )
|
||||
log("BinkP got unparsable address \"%s\"", string_printable(p));
|
||||
else
|
||||
else {
|
||||
session_addrs_add(&state.remoteaddrs, &state.n_remoteaddr, addr);
|
||||
DEB((D_24554, "process ADR complete"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ int binkp_parsfinfo(const char *str, s_bpfinfo *fi, bool with_offset)
|
||||
return -1;
|
||||
}
|
||||
DEB((D_24554, "info to parse: %s", str));
|
||||
r = sscanf(str, with_offset? "%s %d %d %d": "%s %d %d", &fi->fn, &fi->sz, &fi->tm, &fi->offs);
|
||||
r = sscanf(str, with_offset? "%s %ld %ld %ld": "%s %ld %ld", &fi->fn, &fi->sz, &fi->tm, &fi->offs);
|
||||
chkslash = fi->fn;
|
||||
while (1) {
|
||||
chkslash = strchr(chkslash, '/');
|
||||
@@ -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) )
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi)
|
||||
/* local queue */
|
||||
for( ptrl = q->fslist; ptrl; ptrl = ptrl->next ) {
|
||||
//DEB((D_OUTBOUND, "scan %s", ptrl->fname));
|
||||
if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue;
|
||||
if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue; //-V0547
|
||||
if( ptrl->status == STATUS_WILLSEND )
|
||||
{
|
||||
if( pi->reqs_only )
|
||||
@@ -100,7 +100,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi)
|
||||
}
|
||||
|
||||
for( ptrl = pi->filelist; ptrl; ptrl = ptrl->next ) {
|
||||
if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue;
|
||||
if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue; //-V0547
|
||||
if( ptrl->status == STATUS_WILLSEND )
|
||||
{
|
||||
*dest = ptrl;
|
||||
@@ -112,7 +112,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi)
|
||||
/* network queue */
|
||||
#ifdef NETSPOOL
|
||||
|
||||
if (hint) return 1; // cannot choose
|
||||
if (hint) return 1; //-V0547 cannot choose
|
||||
|
||||
/*DEB((D_OUTBOUND, log("netspool next file");*/
|
||||
if(state.netspool.state == NS_NOTINIT) {
|
||||
@@ -296,8 +296,8 @@ get_next_file:
|
||||
pi->send_left_num -= 1;
|
||||
pi->send_left_size -= ptrl->size;
|
||||
|
||||
if( pi->send_left_size < 0 )
|
||||
pi->send_left_size = 0;
|
||||
//if( pi->send_left_size < 0 )
|
||||
// pi->send_left_size = 0;
|
||||
if( pi->send_left_num < 0 )
|
||||
pi->send_left_num = 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)
|
||||
{
|
||||
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;
|
||||
@@ -860,6 +865,8 @@ int p_rx_fopen(s_protinfo *pi, char *fn, size_t sz, time_t tm, mode_t mode)
|
||||
size_t minfree = 0;
|
||||
size_t needed_bytes_total = 0;
|
||||
|
||||
DEB((D_FREE, "P_RX_FOPEN: File: %s, Size: %ld", fn, sz));
|
||||
|
||||
/*
|
||||
* Check. May be we are receiving this file allready
|
||||
*/
|
||||
@@ -1046,7 +1053,7 @@ int p_rx_fopen(s_protinfo *pi, char *fn, size_t sz, time_t tm, mode_t mode)
|
||||
/*
|
||||
* Check, there is enough space in our inbound
|
||||
*/
|
||||
if (openmode == "a") needed_bytes_total = minfree + pi->recv->bytes_total - pi->recv->bytes_skipped;
|
||||
if ( strcmp(openmode, "a") == 0 ) needed_bytes_total = minfree + pi->recv->bytes_total - pi->recv->bytes_skipped;
|
||||
else needed_bytes_total = minfree + pi->recv->bytes_total;
|
||||
|
||||
if( minfree > 0 && getfreespace(state.inbound) < needed_bytes_total )
|
||||
|
||||
@@ -286,9 +286,9 @@ static int sm_tx_waitseq(s_tx_emsidat *d)
|
||||
|
||||
static s_states st_tx_emsidat[] =
|
||||
{
|
||||
{ "sm_tx_init", sm_tx_init },
|
||||
{ "sm_tx_senddat", sm_tx_senddat },
|
||||
{ "sm_tx_waitseq", sm_tx_waitseq }
|
||||
{ "sm_tx_init", (int (*)(void *))sm_tx_init },
|
||||
{ "sm_tx_senddat", (int (*)(void *))sm_tx_senddat },
|
||||
{ "sm_tx_waitseq", (int (*)(void *))sm_tx_waitseq }
|
||||
};
|
||||
|
||||
int emsi_send_emsidat(s_emsi *local_emsi)
|
||||
@@ -449,8 +449,8 @@ static int sm_rx_waitseq(s_rx_emsidat *d)
|
||||
static int sm_rx_getdat(s_rx_emsidat *d)
|
||||
{
|
||||
int rc = 0;
|
||||
int pos = 0;
|
||||
int emsi_len = 0;
|
||||
u_int pos = 0;
|
||||
u_int emsi_len = 0;
|
||||
short unsigned ourcrc;
|
||||
short unsigned remcrc;
|
||||
char *emsi_dat = NULL;
|
||||
@@ -570,10 +570,10 @@ static int sm_rx_getdat(s_rx_emsidat *d)
|
||||
|
||||
static s_states st_rx_emsidat[] =
|
||||
{
|
||||
{ "sm_rx_init", sm_rx_init },
|
||||
{ "sm_rx_sendnak", sm_rx_sendnak },
|
||||
{ "sm_rx_waitseq", sm_rx_waitseq },
|
||||
{ "sm_rx_getdat", sm_rx_getdat }
|
||||
{ "sm_rx_init", (int (*)(void *))sm_rx_init },
|
||||
{ "sm_rx_sendnak", (int (*)(void *))sm_rx_sendnak },
|
||||
{ "sm_rx_waitseq", (int (*)(void *))sm_rx_waitseq },
|
||||
{ "sm_rx_getdat", (int (*)(void *))sm_rx_getdat }
|
||||
};
|
||||
|
||||
int emsi_recv_emsidat(s_emsi *remote_emsi)
|
||||
@@ -598,6 +598,8 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc,
|
||||
s_cval_entry *addr_ptr;
|
||||
s_cval_entry *hide_ptr;
|
||||
s_faddr *primary = NULL;
|
||||
char xdt[EMSI_MAXXDATETIME+1];
|
||||
time_t xtm = 0;
|
||||
|
||||
const long options = conf_options(cf_options);
|
||||
const long speed = conf_number(cf_max_speed);
|
||||
@@ -737,6 +739,10 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc,
|
||||
{ emsi->compcodes.JAN = 1; }
|
||||
if( (options & OPTIONS_NO_HYDRA) != OPTIONS_NO_HYDRA )
|
||||
{ emsi->compcodes.HYD = 1; }
|
||||
DEB((D_HSHAKE,"Generated compcodes for caller: NCP:%x.ZMO:%x.ZAP:%x.DZA:%x.JAN:%x.HYD:%x.KER:%x.SLK:%x.TZA:%x",
|
||||
emsi->compcodes.NCP, emsi->compcodes.ZMO, emsi->compcodes.ZAP,
|
||||
emsi->compcodes.DZA, emsi->compcodes.JAN, emsi->compcodes.HYD,
|
||||
emsi->compcodes.KER, emsi->compcodes.SLK, emsi->compcodes.TZA));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -813,6 +819,22 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc,
|
||||
strnxcpy(emsi->flags, p_flags ? p_flags : "MO", sizeof(emsi->flags));
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/* Data for {TZUTC} and {XDATETIME} field */
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
if ( conf_boolean(cf_emsi_send_tz) ) {
|
||||
emsi->have_tzutc = 1;
|
||||
emsi->tzutc = (int)(time_gmtoffset());
|
||||
}
|
||||
|
||||
if ( conf_boolean(cf_emsi_send_time) ) {
|
||||
emsi->have_xdatetime = 1;
|
||||
|
||||
strnxcpy(xdt,time_string_format(xdt, EMSI_MAXXDATETIME, "%d.%m.%Y %H:%M:%S %z", xtm),EMSI_MAXXDATETIME);
|
||||
strnxcpy(emsi->xdatetime, xdt, sizeof(emsi->xdatetime));
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/* Data for {OHFR} field */
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
@@ -113,13 +113,13 @@ void emsi_deinit(s_handshake_protocol *THIS)
|
||||
ASSERT(THIS->remote_data);
|
||||
ASSERT(THIS->local_data);
|
||||
|
||||
if( THIS->remote_data )
|
||||
if( THIS->remote_data ) //-V0547
|
||||
{
|
||||
memset(THIS->remote_data, '\0', sizeof(s_emsi));
|
||||
free(THIS->remote_data);
|
||||
}
|
||||
|
||||
if( THIS->local_data )
|
||||
if( THIS->local_data ) //-V0547
|
||||
{
|
||||
memset(THIS->local_data, '\0', sizeof(s_emsi));
|
||||
free(THIS->local_data);
|
||||
@@ -134,6 +134,7 @@ int emsi_incoming(s_handshake_protocol *THIS)
|
||||
int rc = HRC_OK;
|
||||
s_emsi *remote_emsi = NULL;
|
||||
s_emsi *local_emsi = NULL;
|
||||
char *p = NULL;
|
||||
|
||||
ASSERT(THIS);
|
||||
ASSERT(THIS->remote_data);
|
||||
@@ -198,7 +199,34 @@ int emsi_incoming(s_handshake_protocol *THIS)
|
||||
|
||||
/*
|
||||
* Set protocol that we will use
|
||||
* EMSI-II compatible as of v0.25
|
||||
*/
|
||||
if ( remote_emsi->compcodes.EII ) {
|
||||
/* EMSI-II relies on protocol order sent by CALLER
|
||||
* we must agree on first matching protocol
|
||||
*/
|
||||
p = xstrcpy( remote_emsi->proto_order );
|
||||
THIS->protocol = PROT_NOPROT;
|
||||
for ( p = strtok( p, "," ); p ; p=strtok( NULL, "," ) ) {
|
||||
if ( !strcmp(p, "ZMO") && !(options & OPTIONS_NO_ZMODEM)) {
|
||||
if ( THIS->protocol == PROT_NOPROT ) THIS->protocol = PROT_ZMODEM;
|
||||
}
|
||||
if ( !strcmp(p, "HYD") && !(options & OPTIONS_NO_HYDRA)) {
|
||||
if ( THIS->protocol == PROT_NOPROT ) THIS->protocol = PROT_HYDRA;
|
||||
}
|
||||
if ( !strcmp(p, "ZAP") && !(options & OPTIONS_NO_ZEDZAP)) {
|
||||
if ( THIS->protocol == PROT_NOPROT ) THIS->protocol = PROT_ZEDZAP;
|
||||
}
|
||||
if ( !strcmp(p, "DZA") && !(options & OPTIONS_NO_DIRZAP)) {
|
||||
if ( THIS->protocol == PROT_NOPROT ) THIS->protocol = PROT_DIRZAP;
|
||||
}
|
||||
/* if ( !strcmp(p, "JAN") && !(options & OPTIONS_NO_JANUS)) {
|
||||
if ( THIS->protocol == PROT_NOPROT ) THIS->protocol = PROT_JANUS;
|
||||
} */
|
||||
}
|
||||
|
||||
} else {
|
||||
/* EMSI-I relies on our self order, not the CALLER's */
|
||||
if( remote_emsi->compcodes.HYD && !(options & OPTIONS_NO_HYDRA) )
|
||||
THIS->protocol = PROT_HYDRA;
|
||||
else if( remote_emsi->compcodes.ZAP && !(options & OPTIONS_NO_ZEDZAP) )
|
||||
@@ -208,8 +236,9 @@ int emsi_incoming(s_handshake_protocol *THIS)
|
||||
else /* NCP */
|
||||
{
|
||||
THIS->protocol = PROT_NOPROT;
|
||||
rc = HRC_NO_PROTOS;
|
||||
}
|
||||
}
|
||||
if ( THIS->protocol == PROT_NOPROT ) rc = HRC_NO_PROTOS;
|
||||
|
||||
/*
|
||||
* Check EMSI flags and set corresponding local HOLD flags
|
||||
|
||||
+182
-31
@@ -65,7 +65,7 @@ static char *add_str(char *source, const char *add)
|
||||
{
|
||||
len += 2;
|
||||
dest = (char *)xrealloc(dest, len);
|
||||
sprintf(&dest[pos], "\\%02hd", *(unsigned char*)add);
|
||||
sprintf(&dest[pos], "\\%02hhu", *(unsigned char*)add);
|
||||
add += 1;
|
||||
pos += 3;
|
||||
}
|
||||
@@ -103,6 +103,10 @@ char *emsi_createdat(s_emsi *emsi)
|
||||
char *tmp = NULL;
|
||||
char buf[100];
|
||||
char abuf[BF_MAXADDRSTR+1];
|
||||
char *p_order = NULL;
|
||||
char *ord = NULL;
|
||||
|
||||
|
||||
|
||||
tmp = (char *)xstrcpy("**EMSI_DAT0000");
|
||||
|
||||
@@ -179,14 +183,78 @@ char *emsi_createdat(s_emsi *emsi)
|
||||
tmp = add_char(tmp, '}');
|
||||
}
|
||||
|
||||
/* compatibility_codes */
|
||||
/* compatibility_codes (EMSI behavior as FTS-0088) */
|
||||
tmp = add_char(tmp, '{');
|
||||
if( emsi->compcodes.NCP ) tmp = add_str(tmp, "NCP,");
|
||||
if( emsi->compcodes.ZMO ) tmp = add_str(tmp, "ZMO,");
|
||||
if( emsi->compcodes.ZAP ) tmp = add_str(tmp, "ZAP,");
|
||||
if( emsi->compcodes.DZA ) tmp = add_str(tmp, "DZA,");
|
||||
if( emsi->compcodes.JAN ) tmp = add_str(tmp, "JAN,");
|
||||
|
||||
p_order = conf_string(cf_proto_order);
|
||||
|
||||
if ( !p_order ) {
|
||||
if( emsi->compcodes.HYD ) tmp = add_str(tmp, "HYD,");
|
||||
if( emsi->compcodes.JAN ) tmp = add_str(tmp, "JAN,");
|
||||
if( emsi->compcodes.DZA ) tmp = add_str(tmp, "DZA,");
|
||||
if( emsi->compcodes.ZAP ) tmp = add_str(tmp, "ZAP,");
|
||||
if( emsi->compcodes.ZMO ) tmp = add_str(tmp, "ZMO,");
|
||||
if( emsi->compcodes.TZA ) tmp = add_str(tmp, "TZA,");
|
||||
if( emsi->compcodes.SLK ) tmp = add_str(tmp, "SLK,");
|
||||
if( emsi->compcodes.KER ) tmp = add_str(tmp, "KER,");
|
||||
if( emsi->compcodes.NCP ) tmp = add_str(tmp, "NCP,");
|
||||
} else {
|
||||
ord = xmalloc(4);
|
||||
if (ord)
|
||||
{
|
||||
DEB((D_HSHAKE,"Protocol order found: %s", p_order));
|
||||
ord = strncpy(ord, p_order,3);
|
||||
ord[3] = '\0';
|
||||
DEB((D_HSHAKE,"Protocol order chunk: %s", ord));
|
||||
if ( !strcmp(ord,"HYD") )
|
||||
if ( emsi->compcodes.HYD) tmp = add_str(tmp, "HYD,");
|
||||
if ( !strcmp(ord,"JAN") )
|
||||
if ( emsi->compcodes.JAN) tmp = add_str(tmp, "JAN,");
|
||||
if ( !strcmp(ord,"DZA") )
|
||||
if ( emsi->compcodes.DZA) tmp = add_str(tmp, "DZA,");
|
||||
if ( !strcmp(ord,"ZAP") )
|
||||
if ( emsi->compcodes.ZAP) tmp = add_str(tmp, "ZAP,");
|
||||
if ( !strcmp(ord,"ZMO") )
|
||||
if ( emsi->compcodes.ZMO) tmp = add_str(tmp, "ZMO,");
|
||||
if ( !strcmp(ord,"TZA") )
|
||||
if ( emsi->compcodes.TZA) tmp = add_str(tmp, "TZA,");
|
||||
if ( !strcmp(ord,"SLK") )
|
||||
if ( emsi->compcodes.SLK) tmp = add_str(tmp, "SLK,");
|
||||
if ( !strcmp(ord,"KER") )
|
||||
if ( emsi->compcodes.KER) tmp = add_str(tmp, "KER,");
|
||||
if ( !strcmp(ord,"NCP") )
|
||||
if ( emsi->compcodes.NCP) tmp = add_str(tmp, "NCP,");
|
||||
p_order = strchr(p_order, ',');
|
||||
if ( p_order ) p_order = p_order+1; /* skip ',' */
|
||||
while ( p_order ) {
|
||||
ord = strncpy(ord, p_order,3);
|
||||
ord[3] = '\0';
|
||||
DEB((D_HSHAKE,"Protocol order chunk: %s", ord));
|
||||
if ( !strcmp(ord,"HYD") )
|
||||
if ( emsi->compcodes.HYD) tmp = add_str(tmp, "HYD,");
|
||||
if ( !strcmp(ord,"JAN") )
|
||||
if ( emsi->compcodes.JAN) tmp = add_str(tmp, "JAN,");
|
||||
if ( !strcmp(ord,"DZA") )
|
||||
if ( emsi->compcodes.DZA) tmp = add_str(tmp, "DZA,");
|
||||
if ( !strcmp(ord,"ZAP") )
|
||||
if ( emsi->compcodes.ZAP) tmp = add_str(tmp, "ZAP,");
|
||||
if ( !strcmp(ord,"ZMO") )
|
||||
if ( emsi->compcodes.ZMO) tmp = add_str(tmp, "ZMO,");
|
||||
if ( !strcmp(ord,"TZA") )
|
||||
if ( emsi->compcodes.TZA) tmp = add_str(tmp, "TZA,");
|
||||
if ( !strcmp(ord,"SLK") )
|
||||
if ( emsi->compcodes.SLK) tmp = add_str(tmp, "SLK,");
|
||||
if ( !strcmp(ord,"KER") )
|
||||
if ( emsi->compcodes.KER) tmp = add_str(tmp, "KER,");
|
||||
if ( !strcmp(ord,"NCP") )
|
||||
if ( emsi->compcodes.NCP) tmp = add_str(tmp, "NCP,");
|
||||
p_order = strchr(p_order, ',');
|
||||
if ( p_order ) p_order = p_order+1; /* skip ',' */
|
||||
}
|
||||
free(ord);
|
||||
}
|
||||
}
|
||||
|
||||
if( emsi->compcodes.FRQ ) tmp = add_str(tmp, "FRQ,");
|
||||
if( emsi->compcodes.NRQ ) tmp = add_str(tmp, "NRQ,");
|
||||
if( emsi->compcodes.ARC ) tmp = add_str(tmp, "ARC,");
|
||||
@@ -325,10 +393,15 @@ char *emsi_createdat(s_emsi *emsi)
|
||||
|
||||
tmp = add_char(tmp, '{');
|
||||
tmp = add_char(tmp, '[');
|
||||
sprintf(buf, "+%04d", emsi->tzutc);
|
||||
tmp = add_str(tmp, buf);
|
||||
/* BUGGY */
|
||||
// sprintf(buf, "+%04d", emsi->tzutc);
|
||||
ord = xmalloc(6);
|
||||
ord = xstrcpy(time_string_gmtoffset(ord));
|
||||
ord[5] = '\0';
|
||||
tmp = add_str(tmp, ord);
|
||||
tmp = add_char(tmp, ']');
|
||||
tmp = add_char(tmp, '}');
|
||||
free(ord);
|
||||
}
|
||||
|
||||
/* {XDATE} indentifier.. What's the fucking invention :-/
|
||||
@@ -366,7 +439,7 @@ char *emsi_createdat(s_emsi *emsi)
|
||||
* Write total length of <data_pkt>
|
||||
*/
|
||||
sprintf(buf, "%04hX", (short unsigned)strlen(tmp+14));
|
||||
memcpy(tmp+10, buf, 4);
|
||||
memcpy(tmp+10, buf, 4); //-V1086
|
||||
|
||||
return(tmp);
|
||||
}
|
||||
@@ -378,7 +451,7 @@ char *emsi_createdat(s_emsi *emsi)
|
||||
static char *get_field(char **str, char from, char to)
|
||||
{
|
||||
char *dst, *src, *dest = NULL;
|
||||
int ch;
|
||||
u_int ch;
|
||||
|
||||
src = *str;
|
||||
|
||||
@@ -450,6 +523,8 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
||||
{
|
||||
int i;
|
||||
char *tmp, *p, *q, *n;
|
||||
unsigned int tzh, tzm,tzn ;
|
||||
char *tzc, *otmp;
|
||||
|
||||
while( (tmp=get_field(&emsi_dat, '{', '}')) != NULL )
|
||||
{
|
||||
@@ -479,7 +554,7 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
||||
|
||||
/* password */
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->passwd, p, sizeof(emsi->passwd));
|
||||
if( *p ) strnxcpy(emsi->passwd, p, sizeof(emsi->passwd));
|
||||
|
||||
/* link codes */
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
@@ -525,13 +600,64 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
||||
/* compatibility codes */
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
DEB((D_HSHAKE, "parse_emsidat: compatibility codes: %s", p));
|
||||
emsi->proto_order[0] = '\0';
|
||||
|
||||
for( p = strtok(p, ","); p; p=strtok(NULL, ",") )
|
||||
{
|
||||
if( !strcmp(p, "ZMO") ) emsi->compcodes.ZMO = 1;
|
||||
/* if( !strcmp(p, "ZMO") ) emsi->compcodes.ZMO = 1;
|
||||
else if( !strcmp(p, "ZAP") ) emsi->compcodes.ZAP = 1;
|
||||
else if( !strcmp(p, "DZA") ) emsi->compcodes.DZA = 1;
|
||||
else if( !strcmp(p, "JAN") ) emsi->compcodes.JAN = 1;
|
||||
else if( !strcmp(p, "HYD") ) emsi->compcodes.HYD = 1;
|
||||
*/
|
||||
if ( !strcmp(p, "ZMO") ) {
|
||||
emsi->compcodes.ZMO = 1;
|
||||
otmp = strcat(emsi->proto_order,"ZMO,");
|
||||
strcpy(emsi->proto_order, otmp);
|
||||
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
||||
}
|
||||
else if ( !strcmp(p, "ZAP") ) {
|
||||
emsi->compcodes.ZAP = 1;
|
||||
otmp = strcat(emsi->proto_order,"ZAP,");
|
||||
strcpy(emsi->proto_order, otmp);
|
||||
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
||||
}
|
||||
else if ( !strcmp(p, "DZA") ) {
|
||||
emsi->compcodes.DZA = 1;
|
||||
otmp = strcat(emsi->proto_order,"DZA,");
|
||||
strcpy(emsi->proto_order, otmp);
|
||||
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
||||
}
|
||||
else if ( !strcmp(p, "JAN") ) {
|
||||
emsi->compcodes.JAN = 1;
|
||||
otmp = strcat(emsi->proto_order,"JAN,");
|
||||
strcpy(emsi->proto_order, otmp);
|
||||
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
||||
}
|
||||
else if ( !strcmp(p, "HYD") ) {
|
||||
emsi->compcodes.HYD = 1;
|
||||
otmp = strcat(emsi->proto_order,"HYD,");
|
||||
strcpy(emsi->proto_order, otmp);
|
||||
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
||||
}
|
||||
else if ( !strcmp(p, "KER") ) {
|
||||
emsi->compcodes.KER = 1;
|
||||
otmp = strcat(emsi->proto_order,"KER,");
|
||||
strcpy(emsi->proto_order, otmp);
|
||||
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
||||
}
|
||||
else if ( !strcmp(p, "TZA") ) {
|
||||
emsi->compcodes.TZA = 1;
|
||||
otmp = strcat(emsi->proto_order,"TZA,");
|
||||
strcpy(emsi->proto_order, otmp);
|
||||
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
||||
}
|
||||
else if ( !strcmp(p, "SLK") ) {
|
||||
emsi->compcodes.SLK = 1;
|
||||
otmp = strcat(emsi->proto_order,"SLK,");
|
||||
strcpy(emsi->proto_order, otmp);
|
||||
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
||||
}
|
||||
else if( !strcmp(p, "NCP") ) emsi->compcodes.NCP = 1;
|
||||
else if( !strcmp(p, "NRQ") ) emsi->compcodes.NRQ = 1;
|
||||
else if( !strcmp(p, "ARC") ) emsi->compcodes.ARC = 1;
|
||||
@@ -542,19 +668,23 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
||||
else if( !strcmp(p, "BBS") ) emsi->compcodes.BBS = 1;
|
||||
else if( !strcmp(p, "HFR") ) emsi->compcodes.HFR = 1;
|
||||
}
|
||||
/* Delete last comma from order list */
|
||||
if (strlen(emsi->proto_order) > 0)
|
||||
emsi->proto_order[strlen(emsi->proto_order)-1] = '\0';
|
||||
DEB((D_HSHAKE,"Ordered compcodes: %s",emsi->proto_order));
|
||||
|
||||
/* mailer information */
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->m_pid, p, sizeof(emsi->m_pid));
|
||||
if( *p ) strnxcpy(emsi->m_pid, p, sizeof(emsi->m_pid));
|
||||
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->m_name, p, sizeof(emsi->m_name));
|
||||
if( *p ) strnxcpy(emsi->m_name, p, sizeof(emsi->m_name));
|
||||
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->m_ver, p, sizeof(emsi->m_ver));
|
||||
if( *p ) strnxcpy(emsi->m_ver, p, sizeof(emsi->m_ver));
|
||||
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->m_reg, p, sizeof(emsi->m_reg));;
|
||||
if( *p ) strnxcpy(emsi->m_reg, p, sizeof(emsi->m_reg));;
|
||||
}
|
||||
else if( strcmp(tmp, "IDENT") == 0 )
|
||||
{
|
||||
@@ -562,17 +692,17 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
||||
|
||||
if( (tmp=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->sname, p, sizeof(emsi->sname));
|
||||
if( *p ) strnxcpy(emsi->sname, p, sizeof(emsi->sname));
|
||||
if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->location, p, sizeof(emsi->location));
|
||||
if( *p ) strnxcpy(emsi->location, p, sizeof(emsi->location));
|
||||
if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->sysop, p, sizeof(emsi->sysop));
|
||||
if( *p ) strnxcpy(emsi->sysop, p, sizeof(emsi->sysop));
|
||||
if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->phone, p, sizeof(emsi->phone));;
|
||||
if( *p ) strnxcpy(emsi->phone, p, sizeof(emsi->phone));;
|
||||
if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1);
|
||||
if( p && *p ) sscanf(p, "%d", &emsi->speed);
|
||||
if( *p ) sscanf(p, "%d", &emsi->speed);
|
||||
if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1);
|
||||
if( p && *p ) strnxcpy(emsi->flags, p, sizeof(emsi->flags));
|
||||
if( *p ) strnxcpy(emsi->flags, p, sizeof(emsi->flags));
|
||||
}
|
||||
else if( strcmp(tmp, "TRX#") == 0 )
|
||||
{
|
||||
@@ -590,9 +720,9 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
||||
else if( strcmp(tmp, "TRAF") == 0 )
|
||||
{
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
if( p && *p )
|
||||
if( *p )
|
||||
{
|
||||
if( sscanf(p, "%08X %08X", &emsi->netmail_size, &emsi->arcmail_size) == 2 )
|
||||
if( sscanf(p, "%08zX %08zX", &emsi->netmail_size, &emsi->arcmail_size) == 2 )
|
||||
{
|
||||
emsi->have_traf = 1;
|
||||
}
|
||||
@@ -606,9 +736,9 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
||||
{
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
if( (p=get_field(&p, '[', ']')) == NULL ) return(1);
|
||||
if( p && *p )
|
||||
if( *p )
|
||||
{
|
||||
if( sscanf(p, "%08X", &emsi->files_size) == 1 )
|
||||
if( sscanf(p, "%08zX", &emsi->files_size) == 1 )
|
||||
{
|
||||
emsi->have_moh = 1;
|
||||
}
|
||||
@@ -646,13 +776,34 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
||||
}
|
||||
else if( strcmp(tmp, "TZUTC") == 0 )
|
||||
{
|
||||
emsi->have_tzutc = 1;
|
||||
|
||||
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
||||
if( (p=get_field(&p, '[', ']')) == NULL ) return(1);
|
||||
/* Parse EMSI TZUTC in fmt (+|-)HHMM */
|
||||
if( *p ) {
|
||||
tzc = malloc(2);
|
||||
if (tzc)
|
||||
{
|
||||
DEB((D_HSHAKE, "Got TZUTC=%s for parsing", p));
|
||||
tzn = sscanf( p, "%1c%02u%02u", tzc, &tzh, &tzm);
|
||||
tzc[1] = '\0';
|
||||
if ( tzn == 3) {
|
||||
DEB((D_HSHAKE, "Got TZC=%s , H=%u, M=%u", tzc, tzh,tzm));
|
||||
emsi->have_tzutc = 1;
|
||||
if ( strcmp(tzc, "-") == 0 ) {
|
||||
emsi->tzutc = -(tzh*60 + tzm);
|
||||
} else {
|
||||
emsi->tzutc = tzh*60 + tzm;
|
||||
}
|
||||
} else {
|
||||
DEB((D_HSHAKE,"TZUTC value not parsed!"));
|
||||
}
|
||||
free(tzc);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEB((D_HSHAKE, "Step - no known EMSI-part - got %s", tmp));
|
||||
strnxcat(emsi->addons, "{", sizeof(emsi->addons));
|
||||
strnxcat(emsi->addons, tmp, sizeof(emsi->addons));
|
||||
strnxcat(emsi->addons, "}", sizeof(emsi->addons));
|
||||
@@ -730,7 +881,7 @@ void emsi_logdat(s_emsi *emsi)
|
||||
if( emsi->compcodes.HFR )
|
||||
strcat(flags, "HFR,");
|
||||
|
||||
if( *flags )
|
||||
if( *flags && (strlen(flags) > 0) )
|
||||
{
|
||||
flags[strlen(flags)-1] = '\0';
|
||||
log(" Options : %s", flags);
|
||||
@@ -771,7 +922,7 @@ void emsi_logdat(s_emsi *emsi)
|
||||
if( emsi->have_emsi )
|
||||
{
|
||||
if( emsi->m_name[0] || emsi->m_pid[0]
|
||||
|| emsi->m_ver[0] || emsi->m_reg )
|
||||
|| emsi->m_ver[0] || emsi->m_reg[0] )
|
||||
{
|
||||
log(" Mailer : %s [%s] %s/%s",
|
||||
emsi->m_name[0] ? string_printable(emsi->m_name) : "?",
|
||||
|
||||
+21
-17
@@ -100,7 +100,8 @@ char *hydra_pkttype_names[] =
|
||||
"HPKT_EOFACK",
|
||||
"HPKT_END",
|
||||
"HPKT_IDLE",
|
||||
"HPKT_DEVDATA"
|
||||
"HPKT_DEVDATA",
|
||||
"HPKT_DEVDACK"
|
||||
};
|
||||
|
||||
char *hydra_char_names[] =
|
||||
@@ -285,10 +286,11 @@ static char *hydra_putword(char *buf, int val)
|
||||
|
||||
static long hydra_getlong(const char *buf)
|
||||
{
|
||||
return ( (unsigned long) ((unsigned char) buf[0]) )
|
||||
| ( (unsigned long) ((unsigned char) buf[1]) << 8 )
|
||||
| ( (unsigned long) ((unsigned char) buf[2]) << 16 )
|
||||
| ( (unsigned long) ((unsigned char) buf[3]) << 24 );
|
||||
return (int32_t)(( (uint32_t) ((uint8_t) buf[0]) )
|
||||
| ( (uint32_t) ((uint8_t) buf[1]) << 8 )
|
||||
| ( (uint32_t) ((uint8_t) buf[2]) << 16 )
|
||||
| ( (uint32_t) ((uint8_t) buf[3]) << 24 ));
|
||||
//return ( buf[3]<<24 | buf[2]<<16 | buf[1]<<8 | buf[0]);
|
||||
}
|
||||
|
||||
static int hydra_getword(const char *buf)
|
||||
@@ -479,7 +481,7 @@ static char *hydra_putuueblock(char *buf, char *src, size_t szsrc)
|
||||
*buf++ = HYDRA_UUENC(src[0] >> 2);
|
||||
*buf++ = HYDRA_UUENC(((src[0] << 4) & 0x30) | ((src[1] >> 4) & 0x0f));
|
||||
*buf++ = HYDRA_UUENC(((src[1] << 2) & 0x3c) | ((src[2] >> 6) & 0x03));
|
||||
*buf++ = HYDRA_UUENC(src[2] & 0x3f);
|
||||
*buf++ = HYDRA_UUENC(src[2] & 0x3f); //-V0578
|
||||
}
|
||||
|
||||
if( szsrc > 0 )
|
||||
@@ -1049,8 +1051,8 @@ static int hydra_parse_init(s_hydrainfo *hi, char *pkt, size_t pktlen)
|
||||
if( appinf && canopt && desopt && window && prefix )
|
||||
{
|
||||
char buf[256];
|
||||
long txwindow = 0L;
|
||||
long rxwindow = 0L;
|
||||
unsigned long txwindow = 0UL;
|
||||
unsigned long rxwindow = 0UL;
|
||||
|
||||
DEB((D_PROT, "hydra: revtime = \"%s\"", time_string_long(buf, sizeof(buf), revtime)));
|
||||
DEB((D_PROT, "hydra: appinf = \"%s\"", appinf));
|
||||
@@ -1073,8 +1075,8 @@ static int hydra_parse_init(s_hydrainfo *hi, char *pkt, size_t pktlen)
|
||||
|
||||
sscanf(window, "%08lx%08lx", &txwindow, &rxwindow);
|
||||
|
||||
if( txwindow < 0 ) txwindow = 0L;
|
||||
if( rxwindow < 0 ) rxwindow = 0L;
|
||||
//if( txwindow < 0 ) txwindow = 0L;
|
||||
//if( rxwindow < 0 ) rxwindow = 0L;
|
||||
|
||||
/*
|
||||
* Log other's hydra information only at 1st batch
|
||||
@@ -1548,7 +1550,9 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
|
||||
/*
|
||||
* Check current CPS, session time limits, etc.
|
||||
*/
|
||||
if( (rc = p_info(pi, 1)) ) gotoexit(rc);
|
||||
rc = p_info(pi, 1);
|
||||
|
||||
if( rc != PRC_NOERROR ) gotoexit(rc);
|
||||
|
||||
/*
|
||||
* Send/receive as much data as possible, but without delays
|
||||
@@ -1591,7 +1595,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
|
||||
break;
|
||||
|
||||
case HPKT_START:
|
||||
if( txstate == HTX_START || txstate == HTX_SWAIT )
|
||||
if( txstate == HTX_START || txstate == HTX_SWAIT ) //-V0560
|
||||
{
|
||||
txtries = 0;
|
||||
txstate = HTX_INIT;
|
||||
@@ -1612,7 +1616,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
|
||||
break;
|
||||
|
||||
case HPKT_INITACK:
|
||||
if( txstate == HTX_INIT || txstate == HTX_INITACK )
|
||||
if( txstate == HTX_INIT || txstate == HTX_INITACK ) //-V0560
|
||||
{
|
||||
txtries = 0;
|
||||
txstate = HTX_RINIT;
|
||||
@@ -1637,7 +1641,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
|
||||
char *p;
|
||||
|
||||
/* Get file modification time and size */
|
||||
sscanf(hi->ibuf, "%08lx%08x%*08x%*08x%*08x",
|
||||
sscanf(hi->ibuf, "%08lx%08zx%*08zx%*08zx%*08zx",
|
||||
(unsigned long *)&modtime, &filesize);
|
||||
|
||||
/* Convert local time -> UTC */
|
||||
@@ -1706,7 +1710,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
|
||||
break;
|
||||
|
||||
case HPKT_FINFOACK:
|
||||
if( txstate == HTX_FINFO || txstate == HTX_FINFOACK )
|
||||
if( txstate == HTX_FINFO || txstate == HTX_FINFOACK ) //-V0560
|
||||
{
|
||||
long offs = 0L;
|
||||
|
||||
@@ -1721,7 +1725,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
|
||||
{
|
||||
log("Hydra: got invalid FINFOACK packet (ignored)");
|
||||
}
|
||||
else if( (offs = hydra_getlong(hi->ibuf)) == 0 )
|
||||
else if( (offs = hydra_getlong(hi->ibuf)) == 0 ) //-V0560 do not touch
|
||||
{
|
||||
txlastack = 0;
|
||||
txtries = 0;
|
||||
@@ -1989,7 +1993,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( rxstate == HRX_Skip || rxstate == HRX_SkipAck )
|
||||
else if( rxstate == HRX_Skip || rxstate == HRX_SkipAck ) //-V0560
|
||||
{
|
||||
if( hi->isize < 4 )
|
||||
{
|
||||
|
||||
@@ -85,13 +85,12 @@ static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *myhello)
|
||||
* Add domain after the end of 'Node name'
|
||||
* TODO: check it for buffer overflows %-I
|
||||
*/
|
||||
if( state.n_localaddr > 0 && state.localaddrs[0].addr.domain
|
||||
&& *state.localaddrs[0].addr.domain )
|
||||
if( state.n_localaddr > 0 && *state.localaddrs[0].addr.domain )
|
||||
{
|
||||
char *q;
|
||||
if( strlen(myhello->system) + strlen(state.localaddrs[0].addr.domain) > 57 )
|
||||
{
|
||||
if( strlen(state.localaddrs[0].addr.domain) < 60 )
|
||||
if( strlen(state.localaddrs[0].addr.domain) < 60 ) //-V0547
|
||||
q = p + (60 - strlen(state.localaddrs[0].addr.domain));
|
||||
else
|
||||
q = p;
|
||||
|
||||
@@ -81,13 +81,13 @@ void yoohoo_deinit(s_handshake_protocol *THIS)
|
||||
ASSERT(THIS->remote_data);
|
||||
ASSERT(THIS->local_data);
|
||||
|
||||
if( THIS->remote_data )
|
||||
if( THIS->remote_data ) //-V0547
|
||||
{
|
||||
memset(THIS->remote_data, '\0', sizeof(s_yoohoo_sysinfo));
|
||||
free(THIS->remote_data);
|
||||
}
|
||||
|
||||
if( THIS->local_data )
|
||||
if( THIS->local_data ) //-V0547
|
||||
{
|
||||
memset(THIS->local_data, '\0', sizeof(s_yoohoo_sysinfo));
|
||||
free(THIS->local_data);
|
||||
|
||||
@@ -67,7 +67,7 @@ static const char *FrameTypes[] =
|
||||
"ZCOMMAND",
|
||||
"ZSTDERR",
|
||||
"Unused"
|
||||
#define FRTYPES 22 /* Total number of frame types in this array */
|
||||
#define FRTYPES 20 /* Total number of frame types in this array */
|
||||
/* not including psuedo negative entries */
|
||||
};
|
||||
#endif
|
||||
@@ -360,12 +360,12 @@ static int noxrd7(void)
|
||||
if( (c = GETCHAR(Z_Rxwait)) < 0 )
|
||||
return(c);
|
||||
|
||||
switch( c &= 0177 ) {
|
||||
switch( c &= 0x7F ) { // was octal 0177
|
||||
case XON:
|
||||
case XOFF:
|
||||
continue;
|
||||
default:
|
||||
if( Z_Ctlesc && !(c & 0140) )
|
||||
if( Z_Ctlesc && !(c & 0x60) ) //was octal 0140 b01100000 hex 0x60
|
||||
continue;
|
||||
case '\r':
|
||||
case '\n':
|
||||
@@ -1056,8 +1056,8 @@ static int zrhhdr(char *hdr)
|
||||
/* There is some characters available.. */
|
||||
|
||||
switch( (c = GETCHAR(1)) ) {
|
||||
case 0215:
|
||||
case 015:
|
||||
case 0x8D: //was octal 0215 dec 141 b 10001101 hex 0x8D ZCRC
|
||||
case 0x0D: //was octal 015 dec 13 b 00001101 hex 0x0D ZCRC
|
||||
/* Throw away possible cr/lf */
|
||||
if( (c = GETCHAR(1)) < 0 && c != ZTIMER )
|
||||
return(c);
|
||||
|
||||
@@ -248,8 +248,8 @@ int rx_zmodem(s_protinfo *pi, bool caller)
|
||||
break;
|
||||
} /* end of switch(rxstate) */
|
||||
|
||||
|
||||
if( rxstate != ZRX_INIT && rxstate != ZRX_GOTFILE
|
||||
// && rxstate != ZRX_GOTFILE - always true, :131 changes it
|
||||
if( rxstate != ZRX_INIT
|
||||
&& rxstate != ZRX_SENDRPOS && rxstate != ZRX_WAITDATA
|
||||
&& rxstate != ZRX_SKIP && rxstate != ZRX_REFUSE )
|
||||
{
|
||||
@@ -548,7 +548,7 @@ static int zmodem_proc_ZFILE(s_protinfo *pi, char *blkptr, size_t blklen)
|
||||
fileiptr = blkptr + strlen(blkptr) + 1;
|
||||
|
||||
if( fileiptr >= (blkptr + blklen) ||
|
||||
sscanf(fileiptr, "%d%lo", &filesize, (unsigned long *)&filetime) < 1 )
|
||||
sscanf(fileiptr, "%zu%lo", &filesize, (unsigned long *)&filetime) < 1 )
|
||||
{
|
||||
log("zmodem: got invalid ZFILE packet");
|
||||
return 1;
|
||||
|
||||
@@ -47,14 +47,18 @@ static void zmodem_add_empty_packet(s_protinfo *pi)
|
||||
s_filelist **ptrl;
|
||||
s_packet pkt;
|
||||
char tmpname[] = "/tmp/bfXXXXXX";
|
||||
char *chunk;
|
||||
char *p_tmpname;
|
||||
|
||||
if( (p_tmpname = mktemp(tmpname)) == NULL )
|
||||
{
|
||||
logerr("cannot generate temp. file name for packet from \"%s\"", tmpname);
|
||||
chunk = xmalloc(7);
|
||||
if (!chunk) {
|
||||
logerr("cannot generate temp. file name for packet");
|
||||
return;
|
||||
}
|
||||
getrandname(chunk, 6);
|
||||
p_tmpname = string_concat("/tmp/bf", chunk, '\0');
|
||||
|
||||
free(chunk);
|
||||
memset(&pkt, '\0', sizeof(s_packet));
|
||||
|
||||
pkt.dest = state.node.addr;
|
||||
@@ -129,6 +133,7 @@ int tx_zmodem(s_protinfo *pi, bool caller)
|
||||
int dtype, n;
|
||||
int ftype;
|
||||
char c, *p;
|
||||
int ichar = 0;
|
||||
long unsigned crc32;
|
||||
enum ztxstates txstate;
|
||||
time_t deadtimer;
|
||||
@@ -386,7 +391,8 @@ int tx_zmodem(s_protinfo *pi, bool caller)
|
||||
break;
|
||||
} /* end of switch(txstate) */
|
||||
|
||||
if( txstate != ZTX_START && txstate != ZTX_RQINIT
|
||||
// txstate != ZTX_START always true
|
||||
if( txstate != ZTX_RQINIT
|
||||
&& txstate != ZTX_FINFO && txstate != ZTX_DATA
|
||||
&& txstate != ZTX_EOF && txstate != ZTX_FIN )
|
||||
{
|
||||
@@ -644,8 +650,8 @@ int tx_zmodem(s_protinfo *pi, bool caller)
|
||||
log(" Send file's CRC-32 ");
|
||||
crc32 = 0xFFFFFFFFL;
|
||||
|
||||
while( ((c = getc(pi->send->fp)) != EOF) && --Z_Rxpos )
|
||||
crc32 = updcrc32(c, crc32);
|
||||
while( ((ichar = getc(pi->send->fp)) != EOF) && --Z_Rxpos )
|
||||
crc32 = updcrc32(ichar, crc32);
|
||||
|
||||
crc32 = ~crc32;
|
||||
|
||||
|
||||
+25
-13
@@ -22,8 +22,16 @@
|
||||
int answ_system(e_session type, char *connstr, int inetd)
|
||||
{
|
||||
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);
|
||||
char clienthost[NI_MAXHOST];
|
||||
char clientport[NI_MAXSERV];
|
||||
int clientres = 0;
|
||||
int rc = 0;
|
||||
char *p;
|
||||
|
||||
@@ -71,20 +79,23 @@ int answ_system(e_session type, char *connstr, int inetd)
|
||||
|
||||
if( inetd )
|
||||
{
|
||||
log("Answering TCPIP call...");
|
||||
if( connstr && *connstr )
|
||||
state.connstr = (char*)xstrcpy(connstr);
|
||||
else if( getpeername(0, (struct sockaddr*)&client, &clientlen) == -1 )
|
||||
logerr("can't get client address");
|
||||
else
|
||||
{
|
||||
#ifdef IPV6
|
||||
>char addr_str[INET6_ADDRSTRLEN+1];
|
||||
state.peername = (char*)xstrcpy(inet_ntop(AF_INET6, client.sin6_addr, addr_str, INET6_ADDRSTRLEN));
|
||||
state.peerport = (long)ntohs(client.sin6_port);
|
||||
#else
|
||||
state.peername = (char*)xstrcpy(inet_ntoa(client.sin_addr));
|
||||
state.peerport = (long)ntohs(client.sin_port);
|
||||
#endif
|
||||
if(getpeername(0, &client.a, &clientlen))
|
||||
log("sess_answ: can't detrmine socket client");
|
||||
clientres = getnameinfo( &client.a, clientlen,
|
||||
clienthost, sizeof(clienthost), clientport,
|
||||
sizeof(clientport), NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
if ( clientres == 0 )
|
||||
{
|
||||
state.peername = (char*)xstrcpy(clienthost);
|
||||
state.peerport = (long)atol(clientport);
|
||||
}
|
||||
else
|
||||
log("sess_answ: can't get client address: ", gai_strerror(clientres));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,9 +127,10 @@ int answ_system(e_session type, char *connstr, int inetd)
|
||||
port_carrier(0, TRUE);
|
||||
|
||||
rc = session();
|
||||
|
||||
if( (inetd != 0) && (state.inet = FALSE) )
|
||||
log("Session ended up, rc=%d, inetd=%d", rc, inetd);
|
||||
if( ( !inetd ) )
|
||||
{
|
||||
log("Deactivating modem port");
|
||||
port_deinit(0, &oldtio);
|
||||
port_close();
|
||||
}
|
||||
|
||||
+310
-60
@@ -210,7 +210,7 @@ int call_system_quiet(const char *connstr, bool inet)
|
||||
if( (exec_cmd = conf_string(cf_run_before_session)) != NULL )
|
||||
{
|
||||
exec_result = system(exec_cmd);
|
||||
if( exec_result = 0 )
|
||||
if( exec_result == 0 )
|
||||
log("external application %s executed with zero return code (%i)", exec_cmd, exec_result);
|
||||
else
|
||||
logerr("external application %s executed with non-zero return code %i", exec_cmd, exec_result);
|
||||
@@ -378,7 +378,7 @@ int call_system_modem(void)
|
||||
|
||||
log("calling with modem %s (%s, %s)",
|
||||
ftn_addrstr(abuf, state.node.addr),
|
||||
(state.node.name && *state.node.name) ? state.node.name : "<none>",
|
||||
( *state.node.name) ? state.node.name : "<none>",
|
||||
string_printable(dialstring));
|
||||
|
||||
/*
|
||||
@@ -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,27 +507,68 @@ 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:
|
||||
default:
|
||||
log("invalid protocol for TCP/IP module");
|
||||
return BFERR_FATALERROR;
|
||||
}
|
||||
|
||||
log("calling with internet %s (%s, %s)",
|
||||
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>");
|
||||
(*state.node.name ) ? state.node.name : "<none>",
|
||||
( *state.node.host) ? state.node.host : "<none>");
|
||||
|
||||
if( (rc = tcpip_connect(state.node.host, state.tcpmode)) == 0
|
||||
&& (rc = tcpip_init() == 0) )
|
||||
memset(abuf, '\0', BF_MAXADDRSTR+1);
|
||||
pbuf = xmalloc(1024);
|
||||
|
||||
resflg = nodelist_lookup_string(pbuf, 1024, state.node.addr);
|
||||
if ( ! resflg )
|
||||
{
|
||||
|
||||
const char *p = string_casestr(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);
|
||||
rc = session();
|
||||
@@ -532,7 +578,7 @@ defalt:
|
||||
{
|
||||
rc = BFERR_CANT_CONNECT10;
|
||||
}
|
||||
|
||||
free(pbuf);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -543,9 +589,9 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
char s[300];
|
||||
snprintf(s, 299, "bforce calling system %d:%d/%d.%d", addr.zone, addr.net, addr.node, addr.point );
|
||||
log(s);
|
||||
|
||||
DEB((D_EVENT, s));
|
||||
// find suitable way of connection and try to make session
|
||||
|
||||
s_override *tmpovr;
|
||||
int rc = 0;
|
||||
int runrc = 0;
|
||||
char abuf[BF_MAXADDRSTR+1];
|
||||
@@ -553,7 +599,9 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
char *errmsg = NULL;
|
||||
int call_mustuse = 0;
|
||||
int call_mayuse = 0;
|
||||
|
||||
char origphone[BNI_MAXPHONE+1];
|
||||
char origflags[BNI_MAXFLAGS+1];
|
||||
char orighost[BNI_MAXHOST+1];
|
||||
init_state(&state);
|
||||
|
||||
state.caller = TRUE;
|
||||
@@ -567,13 +615,40 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
gotoexit(BFERR_PHONE_UNKNOWN);
|
||||
}
|
||||
|
||||
// We can do it even if no nodelist string for node
|
||||
// we got overrides, so apply ALL configs, except tuned by options
|
||||
// BEFORE we decide how to call
|
||||
if (state.override.sFlags) {
|
||||
(void)strnxcpy(state.node.flags, state.override.sFlags, strlen(state.override.sFlags)+1);
|
||||
state.node.do_binkp = (nodelist_checkflag(state.node.flags, "IBN") == 0);
|
||||
state.node.do_ifcico = (nodelist_checkflag(state.node.flags, "IFC") == 0);
|
||||
state.node.do_telnet = (nodelist_checkflag(state.node.flags, "ITN") == 0);
|
||||
memset(state.node.host,'\0',sizeof(state.node.host));
|
||||
nodelist_flagvalue(state.node.flags, "INA",state.node.host);
|
||||
|
||||
DEB((D_EVENT, "sess_call: applied override flags=%s", state.node.flags));
|
||||
}
|
||||
if (state.override.sPhone && !(opts->phone)) {
|
||||
(void)strnxcpy(state.node.phone, state.override.sPhone, strlen(state.override.sPhone)+1);
|
||||
DEB((D_EVENT, "sess_call: applied override phone=%s", state.node.phone));
|
||||
}
|
||||
if (state.override.sIpaddr && !(opts->iphost)) {
|
||||
(void)strnxcpy(state.node.host, state.override.sIpaddr, strlen(state.override.sIpaddr)+1);
|
||||
DEB((D_EVENT, "sess_call: applied override ipaddr=%s", state.node.host));
|
||||
}
|
||||
if (nodelist_parsehiddenina(&state.node, &state.override) > 0) {
|
||||
DEB((D_EVENT, "sess_call: got hidden INAs"));
|
||||
}
|
||||
|
||||
|
||||
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 */
|
||||
|
||||
// 1. If call method specified in cmdline, do use it
|
||||
// 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)
|
||||
|
||||
DEB((D_EVENT, "Calling init, runmode=%d", opts->runmode));
|
||||
// 1st - get all allowed call ways
|
||||
// 2nd - gather information reqired to call and remove unavailable ways (no info, node does not support)
|
||||
|
||||
@@ -581,7 +656,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
|
||||
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 )
|
||||
{
|
||||
@@ -593,7 +668,14 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
}
|
||||
else if( opts->runmode == MODE_CALL_IP )
|
||||
{
|
||||
if( strcasecmp(opts->ipproto, "binkp") == 0 )
|
||||
DEB((D_EVENT, "sess_call: MODE_CALL_IP - from cli"));
|
||||
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;
|
||||
}
|
||||
@@ -605,31 +687,29 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
{
|
||||
call_mustuse = CALL_TCPIP_TELNET;
|
||||
}
|
||||
else if( opts->ipproto == NULL ) // determine from nodelist/override
|
||||
{
|
||||
call_mayuse = CALL_TCPIP_ANY;
|
||||
call_mustuse = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEB((D_EVENT, "Unknown protocol %s", opts->ipproto));
|
||||
log("Unknown protocol");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log("Unknown protocol");
|
||||
DEB((D_EVENT, "Unknown runmode %d", opts->runmode));
|
||||
log("Unknown runmode");
|
||||
return -1;
|
||||
}
|
||||
|
||||
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);
|
||||
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 )
|
||||
if( (call_mayuse & CALL_MODEM) )
|
||||
{
|
||||
// 1. use phone from opts
|
||||
// 2. use overrides
|
||||
@@ -639,18 +719,19 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
{
|
||||
(void)strnxcpy(state.node.phone, opts->phone, sizeof(state.node.phone));
|
||||
//log("phone from options");
|
||||
}
|
||||
else if( state.override.sPhone )
|
||||
{
|
||||
(void)strnxcpy(state.node.phone, state.override.sPhone, sizeof(state.node.phone));
|
||||
//log("phone from override");
|
||||
}
|
||||
} // Moved to top
|
||||
//else if( state.override.sPhone )
|
||||
//{
|
||||
// (void)strnxcpy(state.node.phone, state.override.sPhone, sizeof(state.node.phone));
|
||||
// //log("phone from override");
|
||||
//}
|
||||
|
||||
if( !modem_isgood_phone(state.node.phone) )
|
||||
{
|
||||
log("bad phone, excluding modem");
|
||||
DEB((D_EVENT, "sess_call: 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);
|
||||
@@ -684,7 +765,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);
|
||||
@@ -695,16 +776,16 @@ 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));
|
||||
/*
|
||||
* Apply overrides to the node information
|
||||
* Apply overrides to the node information - 2025 moved to start
|
||||
*/
|
||||
|
||||
if( state.override.sFlags )
|
||||
{
|
||||
strnxcat(state.node.flags, ",", sizeof(state.node.flags));
|
||||
strnxcat(state.node.flags, state.override.sFlags, sizeof(state.node.flags));
|
||||
}
|
||||
//if( state.override.sFlags )
|
||||
//{
|
||||
// strnxcat(state.node.flags, ",", sizeof(state.node.flags));
|
||||
// strnxcat(state.node.flags, state.override.sFlags, sizeof(state.node.flags));
|
||||
//}
|
||||
|
||||
// state.node nodelist
|
||||
// state.override config
|
||||
@@ -712,41 +793,55 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
|
||||
// filter unavailable protos if not obligated to use it
|
||||
|
||||
if( !(call_mustuse & CALL_TCPIP_BINKP) && (call_mayuse & CALL_TCPIP_BINKP) )
|
||||
// Decide protos on calling by flags with override
|
||||
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, "IBN") != 0 )
|
||||
if( state.node.do_binkp == 0 )
|
||||
{
|
||||
call_mayuse &= ~CALL_TCPIP_BINKP;
|
||||
}
|
||||
}
|
||||
|
||||
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 )
|
||||
if( state.node.do_ifcico == 0 )
|
||||
{
|
||||
call_mayuse &= ~CALL_TCPIP_IFCICO;
|
||||
}
|
||||
}
|
||||
|
||||
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, "TLN") != 0 )
|
||||
if( state.node.do_telnet == 0 )
|
||||
{
|
||||
call_mayuse &= ~CALL_TCPIP_TELNET;
|
||||
}
|
||||
}
|
||||
snprintf(s, 299, "after 1 check: may use %d must use %d", call_mayuse, call_mustuse);
|
||||
log(s);
|
||||
DEB((D_EVENT, s));
|
||||
|
||||
if( opts->iphost && *opts->iphost )
|
||||
{
|
||||
memset(state.node.host,'\0',sizeof(state.node.host));
|
||||
(void)strnxcpy(state.node.host, opts->iphost, sizeof(state.node.host));
|
||||
}
|
||||
else if( state.override.sIpaddr )
|
||||
{
|
||||
(void)strnxcpy(state.node.host,
|
||||
state.override.sIpaddr, sizeof(state.node.host));
|
||||
}
|
||||
// Moved to start
|
||||
//else if( state.override.sIpaddr )
|
||||
//{
|
||||
// (void)strnxcpy(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 %s", 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) {
|
||||
@@ -761,17 +856,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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
// log(s);
|
||||
|
||||
@@ -798,7 +897,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
}
|
||||
if( NULL != state.override.run && strlen(state.override.run) > 0 )
|
||||
{
|
||||
if ( (runrc = system(state.override.run) != 0 ))
|
||||
if ( (runrc = system(state.override.run)) != 0 )
|
||||
{
|
||||
logerr("run script \"%s\" executed with non-zero return value", state.override.run);
|
||||
}
|
||||
@@ -807,29 +906,132 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
|
||||
// try allowed methods and break if rc == 0
|
||||
rc = -1;
|
||||
// START CALLING
|
||||
// ROTATE HIDDEN LINES IF ANY
|
||||
|
||||
if( rc && call_mayuse & CALL_STDIO )
|
||||
|
||||
//snprintf(s, 299, "before call: may use %d must use %d", call_mayuse, call_mustuse);
|
||||
//log(s);
|
||||
//DEB((D_EVENT, s));
|
||||
// Hidden lines - if smth is not in place - use orig overriden hard
|
||||
memcpy(&origphone, &state.node.phone,sizeof(origphone));
|
||||
memcpy(&origflags, &state.node.flags,sizeof(origflags));
|
||||
memcpy(&orighost, &state.node.host,sizeof(orighost));
|
||||
|
||||
if( call_mayuse & CALL_STDIO )
|
||||
{
|
||||
DEB((D_EVENT,"sess_call: calling stdio, mayuse=%x", call_mayuse));
|
||||
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, mayuse=%x", call_mayuse));
|
||||
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, mayuse=%x", call_mayuse));
|
||||
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, mayuse=%x", call_mayuse));
|
||||
rc = call_system_tcpip(CALL_TCPIP_TELNET);
|
||||
}
|
||||
tmpovr = &state.override;
|
||||
while (tmpovr->hidden != NULL && rc) {
|
||||
DEB((D_EVENT, "sess_call: starting hidden, current is %x", tmpovr->hidden));
|
||||
tmpovr = tmpovr->hidden;
|
||||
|
||||
if( rc && call_mayuse & CALL_MODEM )
|
||||
if (tmpovr->sFlags) {
|
||||
if (nodelist_checkflag(tmpovr->sFlags, "INA") == 0) {
|
||||
memset(state.node.host,'\0',sizeof(state.node.host));
|
||||
nodelist_flagvalue(tmpovr->sFlags, "INA",state.node.host);
|
||||
}
|
||||
(void)strnxcpy(state.node.flags, tmpovr->sFlags, strlen(tmpovr->sFlags)+1);
|
||||
call_mayuse |= call_mustuse;
|
||||
state.node.do_binkp = nodelist_checkflag(state.node.flags, "IBN") == 0;
|
||||
state.node.do_ifcico = nodelist_checkflag(state.node.flags, "IFC") == 0;
|
||||
state.node.do_telnet = nodelist_checkflag(state.node.flags, "ITN") == 0;
|
||||
|
||||
DEB((D_EVENT, "sess_call: applied hidden flags=%s", state.node.flags));
|
||||
} else {
|
||||
memcpy(&state.node.flags, &origflags, sizeof(origflags));
|
||||
call_mayuse |= call_mustuse;
|
||||
state.node.do_binkp = nodelist_checkflag(state.node.flags, "IBN") == 0;
|
||||
state.node.do_ifcico = nodelist_checkflag(state.node.flags, "IFC") == 0;
|
||||
state.node.do_telnet = nodelist_checkflag(state.node.flags, "ITN") == 0;
|
||||
DEB((D_EVENT, "sess_call: applied original flags=%s", state.node.flags));
|
||||
}
|
||||
if (tmpovr->sPhone && !(opts->phone)) {
|
||||
(void)strnxcpy(state.node.phone, tmpovr->sPhone, strlen(tmpovr->sPhone)+1);
|
||||
DEB((D_EVENT, "sess_call: ?skipping hidden phone=%s", state.node.phone));
|
||||
if ( !(tmpovr->sFlags) && !(tmpovr->sIpaddr) ) continue; // skip only telephone
|
||||
} else {
|
||||
memcpy(&state.node.phone, &origphone, sizeof(origphone));
|
||||
DEB((D_EVENT, "sess_call: applied original phone=%s", state.node.phone));
|
||||
}
|
||||
if (tmpovr->sIpaddr && !(opts->iphost)) {
|
||||
(void)strnxcpy(state.node.host, tmpovr->sIpaddr, strlen(tmpovr->sIpaddr)+1);
|
||||
DEB((D_EVENT, "sess_call: applied hidden ipaddr=%s", state.node.host));
|
||||
}
|
||||
|
||||
if( (call_mustuse & CALL_TCPIP_BINKP) && (call_mayuse & CALL_TCPIP_BINKP) )
|
||||
{
|
||||
//if( nodelist_checkflag(state.node.flags, "IBN") != 0 )
|
||||
if( state.node.do_binkp == 0 )
|
||||
{
|
||||
call_mayuse &= ~CALL_TCPIP_BINKP;
|
||||
}
|
||||
}
|
||||
|
||||
if( (call_mustuse & CALL_TCPIP_IFCICO) && (call_mayuse & CALL_TCPIP_IFCICO) )
|
||||
{
|
||||
//if( nodelist_checkflag(state.node.flags, "IFC") != 0 )
|
||||
if( state.node.do_ifcico == 0 )
|
||||
{
|
||||
call_mayuse &= ~CALL_TCPIP_IFCICO;
|
||||
}
|
||||
}
|
||||
|
||||
if( (call_mustuse & CALL_TCPIP_TELNET) && (call_mayuse & CALL_TCPIP_TELNET) )
|
||||
{
|
||||
//if( nodelist_checkflag(state.node.flags, "TLN") != 0 )
|
||||
if( state.node.do_telnet == 0 )
|
||||
{
|
||||
call_mayuse &= ~CALL_TCPIP_TELNET;
|
||||
}
|
||||
}
|
||||
|
||||
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) )
|
||||
{
|
||||
DEB((D_EVENT,"sess_call: calling ifcico"));
|
||||
rc = call_system_tcpip(CALL_TCPIP_IFCICO);
|
||||
}
|
||||
|
||||
if( rc && (call_mayuse & CALL_TCPIP_TELNET) )
|
||||
{
|
||||
DEB((D_EVENT,"sess_call: calling telnet"));
|
||||
rc = call_system_tcpip(CALL_TCPIP_TELNET);
|
||||
}
|
||||
DEB((D_EVENT, "sess_call: finished hidden, next is %x", tmpovr->hidden));
|
||||
}
|
||||
|
||||
|
||||
// DIALING_
|
||||
if( rc && (call_mayuse & CALL_MODEM) )
|
||||
{
|
||||
DEB((D_EVENT,"sess_call: calling MODEM"));
|
||||
setproctitle("bforce calling %.32s, %.32s",
|
||||
ftn_addrstr(abuf, state.node.addr), state.node.phone);
|
||||
rc = -1;
|
||||
@@ -850,6 +1052,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
|
||||
if( port_lock(p_lockdir, state.modemport) == 0 ) /* Successfuly locked port */
|
||||
{
|
||||
DEB((D_EVENT,"sess_call: call_system_modem running"));
|
||||
rc = call_system_modem();
|
||||
port_unlock(p_lockdir, state.modemport);
|
||||
}
|
||||
@@ -862,7 +1065,54 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
{
|
||||
errmsg = "unable to get modem port";
|
||||
}
|
||||
|
||||
tmpovr = &state.override;
|
||||
while (tmpovr->hidden != NULL && rc) {
|
||||
DEB((D_EVENT, "sess_call: starting hidden, current is %x", tmpovr->hidden));
|
||||
tmpovr = tmpovr->hidden;
|
||||
|
||||
// As for now - no effect in phone calls
|
||||
if (tmpovr->sFlags) {
|
||||
(void)strnxcpy(state.node.flags, tmpovr->sFlags, strlen(tmpovr->sFlags)+1);
|
||||
DEB((D_EVENT, "sess_call: applied hidden flags=%s", state.node.flags));
|
||||
} else {
|
||||
memcpy(&state.node.flags, &origflags, sizeof(origflags));
|
||||
DEB((D_EVENT, "sess_call: applied original flags=%s", state.node.flags));
|
||||
}
|
||||
if (tmpovr->sPhone && !(opts->phone)) {
|
||||
(void)strnxcpy(state.node.phone, tmpovr->sPhone, strlen(tmpovr->sPhone)+1);
|
||||
DEB((D_EVENT, "sess_call: applied hidden phone=%s", state.node.phone));
|
||||
} else {
|
||||
DEB((D_EVENT, "sess_call: no hidden phone - skipping"));
|
||||
continue;
|
||||
}
|
||||
|
||||
if( state.modemport )
|
||||
{
|
||||
|
||||
if( port_lock(p_lockdir, state.modemport) == 0 ) /* Successfuly locked port */
|
||||
{
|
||||
DEB((D_EVENT,"sess_call: hidden call_system_modem running"));
|
||||
rc = call_system_modem();
|
||||
port_unlock(p_lockdir, state.modemport);
|
||||
}
|
||||
else
|
||||
{
|
||||
errmsg = "cannot lock modem port";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errmsg = "unable to get modem port";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// END_DIALING
|
||||
}
|
||||
|
||||
// END CALLING
|
||||
|
||||
if( rc )
|
||||
{
|
||||
|
||||
@@ -135,15 +135,17 @@ int override_get(s_override *dest, s_faddr addr, int line)
|
||||
{
|
||||
s_override *p;
|
||||
int curline = 0;
|
||||
|
||||
p = conf_override(cf_override, addr);
|
||||
|
||||
curline = 0;
|
||||
if (line > 0)
|
||||
{
|
||||
while( p && curline < line )
|
||||
{
|
||||
p = p->hidden;
|
||||
++curline;
|
||||
}
|
||||
}
|
||||
|
||||
if( p && curline == line )
|
||||
{
|
||||
|
||||
@@ -223,7 +223,8 @@ int session_init_outgoing()
|
||||
}
|
||||
else if( c == ENQ )
|
||||
{
|
||||
if( enq_need && ++enqcount >= enq_need && canyoohoo )
|
||||
if ( ++enqcount >= enq_need && canyoohoo )
|
||||
//if( enq_need && ++enqcount >= enq_need && canyoohoo )
|
||||
{
|
||||
DEB((D_HSHAKE, "tx_init: exit with YooHoo"));
|
||||
state.session = SESSION_YOOHOO;
|
||||
@@ -232,7 +233,8 @@ int session_init_outgoing()
|
||||
}
|
||||
else if( c == TSYNC )
|
||||
{
|
||||
if( nak_need && ++nakcount > nak_need && canftsc )
|
||||
if( ++nakcount > nak_need && canftsc )
|
||||
//if( nak_need && ++nakcount > nak_need && canftsc )
|
||||
{
|
||||
DEB((D_HSHAKE, "tx_init: exit with FTS-1"));
|
||||
state.session = SESSION_FTSC;
|
||||
|
||||
@@ -264,7 +264,7 @@ int session_check_addr(s_faddr addr)
|
||||
int session_get_password(s_faddr addr, char *buffer, size_t buflen)
|
||||
{
|
||||
s_cval_entry *pwd_ptr;
|
||||
|
||||
buffer[0]='\0';
|
||||
for( pwd_ptr = conf_first(cf_password); pwd_ptr;
|
||||
pwd_ptr = conf_next(pwd_ptr) )
|
||||
{
|
||||
@@ -311,6 +311,7 @@ int session_set_inbound(void)
|
||||
{
|
||||
struct stat st;
|
||||
char *p_inb;
|
||||
int res;
|
||||
|
||||
p_inb = conf_string(cf_inbound_directory);
|
||||
if( !p_inb ) {
|
||||
@@ -341,8 +342,12 @@ int session_set_inbound(void)
|
||||
} */
|
||||
log("inbound: %s", buf);
|
||||
state.inbound = (char*)xstrcpy(buf);
|
||||
snprintf( buf, PATH_MAX+30, "/bin/mkdir -p %s -m 700", state.inbound ); /* 30 additional chars allowed */
|
||||
system( buf );
|
||||
snprintf( buf, PATH_MAX+30, "/bin/mkdir -p -m 700 %s", state.inbound ); /* 30 additional chars allowed */
|
||||
res = system( buf );
|
||||
if (res != 0) {
|
||||
log("Inbound create error: %d", res);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -607,7 +612,7 @@ void session_traffic_log(bool incoming, s_traffic *traff)
|
||||
strcat(msg, buf);
|
||||
strcat(msg, " files, ");
|
||||
}
|
||||
if( *msg )
|
||||
if( *msg && strlen(msg)>2 )
|
||||
msg[strlen(msg)-2] = '\0';
|
||||
}
|
||||
|
||||
@@ -695,6 +700,7 @@ int session(void)
|
||||
s_traffic traff_send;
|
||||
s_traffic traff_recv;
|
||||
char *p;
|
||||
int fd = -1;
|
||||
|
||||
memset(&traff_send, '\0', sizeof(s_traffic));
|
||||
memset(&traff_recv, '\0', sizeof(s_traffic));
|
||||
@@ -890,6 +896,74 @@ int session(void)
|
||||
*/
|
||||
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 (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 );
|
||||
if (fd == -1) {
|
||||
DEB((D_EVENT, "Error raising netmail flag"));
|
||||
log("Error creating flag for netmail in %s", p);
|
||||
} else {
|
||||
/* all ok - closing file */
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
if ( (p = conf_string(cf_incarc_flag)) )
|
||||
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);
|
||||
if (fd == -1) {
|
||||
DEB((D_EVENT, "Error raising arcmail flag"));
|
||||
log("Error creating flag for arcmail in %s", p);
|
||||
} else {
|
||||
/* all ok - closing file */
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -58,11 +58,11 @@ static char *session_stat_get_stsfile(s_faddr *addr, int linenum)
|
||||
addr->zone, addr->net,
|
||||
addr->node, addr->point);
|
||||
else
|
||||
sprintf(buf, "%u.%u.%u.%u-%u.sts",
|
||||
sprintf(buf, "%u.%u.%u.%u-%d.sts",
|
||||
addr->zone, addr->net,
|
||||
addr->node, addr->point, linenum);
|
||||
|
||||
yield = string_concat(p_stsdir, buf, NULL);
|
||||
yield = string_concat(p_stsdir, buf, '\0');
|
||||
}
|
||||
|
||||
return yield;
|
||||
@@ -70,12 +70,14 @@ static char *session_stat_get_stsfile(s_faddr *addr, int linenum)
|
||||
|
||||
static int session_stat_read_stsfile(FILE *fp, s_sess_stat *stat)
|
||||
{
|
||||
int res;
|
||||
|
||||
if( fseek(fp, 0, SEEK_SET) == -1 )
|
||||
return -1;
|
||||
|
||||
memset(stat, '\0', sizeof(s_sess_stat));
|
||||
|
||||
fscanf(fp, "%u %u %u %u %u %u %lu %lu %lu %lu",
|
||||
res = fscanf(fp, "%u %u %u %u %u %u %lu %lu %lu %lu",
|
||||
(unsigned int *) &stat->tries,
|
||||
(unsigned int *) &stat->tries_noconn,
|
||||
(unsigned int *) &stat->tries_noansw,
|
||||
@@ -86,7 +88,10 @@ static int session_stat_read_stsfile(FILE *fp, s_sess_stat *stat)
|
||||
(unsigned long *) &stat->hold_freqs,
|
||||
(unsigned long *) &stat->last_success_out,
|
||||
(unsigned long *) &stat->last_success_in);
|
||||
|
||||
if (res == 0) {
|
||||
log("Read STS unsuccessfull...");
|
||||
return -1;
|
||||
}
|
||||
/* Set last successfull session time */
|
||||
stat->last_success = MAX(stat->last_success_out, stat->last_success_in);
|
||||
|
||||
@@ -278,15 +283,14 @@ int session_stat_update(s_faddr *addr, s_sess_stat *stat, bool caller, int rc)
|
||||
stat->tries_nodial++;
|
||||
if( BFERR_CANT_CONNECT10 <= rc && rc <= BFERR_CANT_CONNECT19 )
|
||||
stat->tries_noconn++;
|
||||
if( rc >= BFERR_CONNECT_TOOLOW )
|
||||
stat->tries_sessns++;
|
||||
|
||||
/* Reset some counters */
|
||||
if( rc >= BFERR_CONNECT_TOOLOW )
|
||||
{
|
||||
stat->tries_sessns++;
|
||||
/* Reset some counters */
|
||||
stat->tries_noansw = TRIES_RESET;
|
||||
stat->tries_noconn = TRIES_RESET;
|
||||
}
|
||||
|
||||
if( rc > BFERR_HANDSHAKE_ERROR )
|
||||
stat->tries_hshake = TRIES_RESET;
|
||||
}
|
||||
|
||||
+29
-3
@@ -109,6 +109,22 @@ int file_lock_wait(FILE *fp, bool exclusive)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void getrandname(char * buf, u_int size)
|
||||
{
|
||||
srand((unsigned int)time(NULL));
|
||||
char c;
|
||||
int i;
|
||||
for (i = 0; i<size; i++)
|
||||
{
|
||||
c = rand();
|
||||
// Only ASCII 0..9A..Z
|
||||
while ( (c > 90) || (c < 48) || ( ( c > 57) && ( c < 65 ) ) )
|
||||
c = rand();
|
||||
buf[i] = c;
|
||||
}
|
||||
buf[size]='\0';
|
||||
}
|
||||
|
||||
bool file_name_issafe(int ch)
|
||||
{
|
||||
if( ch == '!' ) return TRUE;
|
||||
@@ -145,17 +161,27 @@ char *file_name_makesafe(char *filename)
|
||||
char *file_getname(char *filename)
|
||||
{
|
||||
char *p = strrchr(filename, '/');
|
||||
DEB((D_FREE, "File_getname: %s", (p ? p + 1 : filename) ));
|
||||
return p ? p + 1 : filename;
|
||||
}
|
||||
|
||||
char *file_gettmp(void)
|
||||
{
|
||||
char *tmp = xstrcpy("/tmp/bforce-XXXXXX");
|
||||
char *res = mktemp(tmp);
|
||||
char *chunk = xmalloc(7);
|
||||
char *res = NULL;
|
||||
if (chunk)
|
||||
{
|
||||
getrandname(chunk,6);
|
||||
chunk[6] = '\0';
|
||||
|
||||
char *tmp = xstrcpy("/tmp/bforce-");
|
||||
|
||||
res = string_concat(tmp, chunk, '\0');
|
||||
|
||||
free(chunk);
|
||||
if( !res )
|
||||
free(tmp);
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -326,6 +327,7 @@ int ftn_addrparse(s_faddr *addr, const char *s, bool wildcard)
|
||||
addr->node = DEFAULT_NODE;
|
||||
addr->point = 0;
|
||||
|
||||
DEB((D_INFO, "u_ftn: parsing ftnaddr %s", s));
|
||||
if( addr->inetform )
|
||||
badaddr = ftn_addrparse_inet(addr, s, wildcard);
|
||||
else
|
||||
|
||||
+14
-4
@@ -81,6 +81,7 @@ void *xrealloc(void *buf, size_t size)
|
||||
else if( (tmp = (char*)(buf ? realloc(buf, size) : malloc(size))) == NULL )
|
||||
{
|
||||
log("failed to reallocate %ld bytes -> abort", size);
|
||||
if( buf ) free(buf);
|
||||
abort();
|
||||
}
|
||||
|
||||
@@ -175,7 +176,7 @@ int strcasemask(const char *str, const char *mask)
|
||||
}
|
||||
}
|
||||
|
||||
return( *s != '\0' || *m != '\0' );
|
||||
return( *s != '\0' || *m != '\0' ); //-V0560 It seems more logical
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -289,7 +290,7 @@ char *buffer_putint(char *buffer, int val)
|
||||
*/
|
||||
long buffer_getlong(const char *buffer)
|
||||
{
|
||||
return ( (unsigned long) ((unsigned char) buffer[0]) )
|
||||
return (long)( (unsigned long) ((unsigned char) buffer[0]) )
|
||||
| ( (unsigned long) ((unsigned char) buffer[1]) << 8 )
|
||||
| ( (unsigned long) ((unsigned char) buffer[2]) << 16 )
|
||||
| ( (unsigned long) ((unsigned char) buffer[3]) << 24 );
|
||||
@@ -306,10 +307,19 @@ long buffer_getlong(const char *buffer)
|
||||
*/
|
||||
int buffer_getint(const char *buffer)
|
||||
{
|
||||
return ( (unsigned int) ((unsigned char) buffer[0]) )
|
||||
return (int)( (unsigned int) ((unsigned char) buffer[0]) )
|
||||
| ( (unsigned int) ((unsigned char) buffer[1]) << 8 );
|
||||
}
|
||||
|
||||
void swap_long(char *buffer){
|
||||
char *temp = xmemcpy(buffer, sizeof(uint32_t));
|
||||
temp[0] = buffer[2];
|
||||
temp[1] = buffer[3];
|
||||
temp[2] = buffer[0];
|
||||
temp[3] = buffer[1];
|
||||
memcpy(buffer,temp,sizeof(uint32_t));
|
||||
}
|
||||
|
||||
void printf_usage(const char *ident, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
@@ -328,7 +338,7 @@ void printf_usage(const char *ident, const char *fmt, ...)
|
||||
else
|
||||
printf("Sorry, no usage information available\n\n");
|
||||
|
||||
printf("Mail bug reports to <adb@newmail.ru>\n");
|
||||
printf("Mail bug reports to <zx@zxalexis.ru>\n");
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
+10
-10
@@ -152,7 +152,13 @@ int plock_link(const char *lockname, const char *tmpname)
|
||||
int plock_create(const char *lockname)
|
||||
{
|
||||
int rc;
|
||||
char *tmpname, *p;
|
||||
char *tmpname, *p, *chunk;
|
||||
chunk = xmalloc(7);
|
||||
if (!chunk) {
|
||||
logerr("can't malloc mem for generation of lock name");
|
||||
DEB((D_FREE, "plock freed"));
|
||||
return PLOCK_ERROR;
|
||||
}
|
||||
|
||||
ASSERT(lockname != NULL);
|
||||
|
||||
@@ -166,16 +172,10 @@ int plock_create(const char *lockname)
|
||||
DEB((D_FREE, "plock freed"));
|
||||
return PLOCK_ERROR;
|
||||
}
|
||||
tmpname = xstrcat(tmpname, "bforce-XXXXXX");
|
||||
tmpname = xstrcat(tmpname, "bforce-");
|
||||
|
||||
if( (p = mktemp(tmpname)) == NULL )
|
||||
{
|
||||
logerr("can't generate unique file name from \"%s\"", tmpname);
|
||||
DEB((D_FREE, "plock free"));
|
||||
free(tmpname);
|
||||
DEB((D_FREE, "plock freed"));
|
||||
return PLOCK_ERROR;
|
||||
}
|
||||
getrandname(chunk,6);
|
||||
p = string_concat(tmpname,chunk,'\0');
|
||||
|
||||
if( (rc = plock_write(p)) == PLOCK_OK )
|
||||
rc = plock_link(lockname, p);
|
||||
|
||||
+23
-10
@@ -60,8 +60,12 @@ char *xstrcpy(const char *src)
|
||||
return NULL;
|
||||
|
||||
tmp = xmalloc(strlen(src)+1);
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
else
|
||||
strcpy(tmp, src);
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -85,7 +89,7 @@ char *xstrcat(char *src, const char *add)
|
||||
|
||||
size = (src ? strlen(src) : 0) + strlen(add);
|
||||
tmp = (char*)xmalloc(size+1);
|
||||
|
||||
if (tmp) {
|
||||
if( src )
|
||||
{
|
||||
strcpy(tmp, src);
|
||||
@@ -94,6 +98,7 @@ char *xstrcat(char *src, const char *add)
|
||||
*tmp = '\0';
|
||||
|
||||
strcat(tmp, add);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
@@ -216,7 +221,7 @@ char *string_chomp(char *str)
|
||||
|
||||
ASSERT(str != NULL);
|
||||
|
||||
if( str && *str )
|
||||
if( *str )
|
||||
{
|
||||
p = str + strlen(str + 1);
|
||||
if( *p == '\n' )
|
||||
@@ -383,7 +388,7 @@ char *string_trimright(char *str)
|
||||
|
||||
ASSERT(str != NULL);
|
||||
|
||||
if( str && *str )
|
||||
if( *str )
|
||||
{
|
||||
p = str + strlen(str+1);
|
||||
while( p >= str && isspace(*p) ) *p-- = '\0';
|
||||
@@ -407,7 +412,7 @@ char *string_trimleft(char *str)
|
||||
|
||||
ASSERT(str != NULL);
|
||||
|
||||
if( str && *str )
|
||||
if( *str )
|
||||
{
|
||||
p = str;
|
||||
while( isspace(*p) ) p++;
|
||||
@@ -433,7 +438,7 @@ char *string_trimboth(char *str)
|
||||
|
||||
ASSERT(str != NULL);
|
||||
|
||||
if( str && *str )
|
||||
if( *str )
|
||||
{
|
||||
/* Remove leading spaces */
|
||||
p = str;
|
||||
@@ -598,6 +603,8 @@ int string_parse(char **dest, int items, char *str, int separator)
|
||||
{
|
||||
int count = 0;
|
||||
char *p = str;
|
||||
//if ( *((unsigned char *)p) == separator )
|
||||
// p++;
|
||||
|
||||
dest[count++] = str;
|
||||
|
||||
@@ -606,6 +613,7 @@ int string_parse(char **dest, int items, char *str, int separator)
|
||||
if( *((unsigned char *)p) == separator )
|
||||
{
|
||||
*p++ = '\0';
|
||||
// DEB((D_INDEX,"Parsed string: %s", dest[count]));
|
||||
dest[count++] = p;
|
||||
} else
|
||||
++p;
|
||||
@@ -673,7 +681,7 @@ char *string_translate(const char *str, const char *find, const char *repl)
|
||||
size_t sz_find = strlen(find);
|
||||
size_t sz_repl = strlen(repl);
|
||||
size_t sz_dest = strlen(str);
|
||||
char *dest, *p;
|
||||
char *tmp, *dest, *p;
|
||||
|
||||
p = dest = xstrcpy(str);
|
||||
|
||||
@@ -686,9 +694,13 @@ char *string_translate(const char *str, const char *find, const char *repl)
|
||||
size_t offset = p - dest;
|
||||
size_t newsize = sz_dest + (sz_repl - sz_find);
|
||||
|
||||
if( newsize > sz_dest )
|
||||
dest = xrealloc(dest, newsize+1);
|
||||
|
||||
if( newsize > sz_dest ) {
|
||||
tmp = xrealloc(dest, newsize+1);
|
||||
if (!tmp) {
|
||||
free(dest);
|
||||
return NULL;
|
||||
} else dest = tmp;
|
||||
}
|
||||
if( sz_repl > sz_find )
|
||||
memmove(dest + offset + (sz_repl - sz_find), dest + offset, sz_dest - offset + 1);
|
||||
else if( sz_repl < sz_find )
|
||||
@@ -839,6 +851,7 @@ char *string_concat(const char *str, ...)
|
||||
va_end(args);
|
||||
|
||||
yield = xmalloc(yield_len + 1);
|
||||
if (yield) {
|
||||
strncpy(yield, str, yield_len);
|
||||
yield[yield_len] = '\0';
|
||||
yield_ptr = yield + strlen(yield);
|
||||
@@ -850,7 +863,7 @@ char *string_concat(const char *str, ...)
|
||||
yield_ptr += strlen(p);
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
}
|
||||
return yield;
|
||||
}
|
||||
|
||||
|
||||
+13
-10
@@ -173,18 +173,20 @@ long time_gmtoffset(void)
|
||||
time_t tt = time(NULL);
|
||||
struct tm local = *localtime(&tt);
|
||||
struct tm gmt = *gmtime(&tt);
|
||||
long tz = gmt.tm_yday - local.tm_yday;
|
||||
long tz = 0; /* = local.tm_yday - gmt.tm_yday;
|
||||
|
||||
if( tz > 1 )
|
||||
tz = -24;
|
||||
else if( tz < -1 )
|
||||
tz = 24;
|
||||
tz = +24;
|
||||
else
|
||||
tz *= 24;
|
||||
tz *= 24; */
|
||||
|
||||
tz += gmt.tm_hour - local.tm_hour;
|
||||
/*tz += gmt.tm_hour - local.tm_hour;
|
||||
tz *= 60;
|
||||
tz += gmt.tm_min - local.tm_min;
|
||||
tz += gmt.tm_min - local.tm_min;*/
|
||||
|
||||
tz = (gmt.tm_hour*60+gmt.tm_min) - (local.tm_hour*60+local.tm_min);
|
||||
|
||||
return tz;
|
||||
}
|
||||
@@ -200,12 +202,13 @@ long time_gmtoffset(void)
|
||||
*/
|
||||
char *time_string_gmtoffset(char *buffer)
|
||||
{
|
||||
long tz = time_gmtoffset();
|
||||
long tz = -time_gmtoffset();
|
||||
char sign = (tz > 0)?'+':'-';
|
||||
int hour = tz/60;
|
||||
int mint = tz%60;
|
||||
tz = abs(tz);
|
||||
unsigned int hour = tz/60;
|
||||
unsigned int mint = tz%60;
|
||||
|
||||
sprintf(buffer, "%c%02d%02d", sign, hour, mint);
|
||||
sprintf(buffer, "%c%02u%02u", sign, hour, mint);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
@@ -466,7 +469,7 @@ int timevec_parse(s_timevec *dest, const char *str)
|
||||
|
||||
end_day = beg_day;
|
||||
|
||||
if( beg_day >= DAY_MONDAY && beg_day <= DAY_SUNDAY )
|
||||
if( beg_day <= DAY_SUNDAY )
|
||||
str += 3;
|
||||
else if( beg_day == DAY_ANY )
|
||||
str += 3;
|
||||
|
||||
+51
-15
@@ -29,11 +29,12 @@ bool eventexpr(s_expr *expr)
|
||||
static void usage(void)
|
||||
{
|
||||
printf_usage("nodelist compiler",
|
||||
"usage: bfindex [-fh]\n"
|
||||
"usage: bfindex [-fh] [-C config]\n"
|
||||
"\n"
|
||||
"options:\n"
|
||||
" -f force nodelist compiling\n"
|
||||
" -h show this help message\n"
|
||||
" -C config use config\n"
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
@@ -42,6 +43,7 @@ static int nodelist_makeindex(s_nodelist *nlp, s_faddr addr)
|
||||
{
|
||||
s_bni bni;
|
||||
char buf[1024];
|
||||
bool modepoint = FALSE;
|
||||
long countnodes = 0L;
|
||||
long countlines = 0L;
|
||||
enum nodelist_keyword keyword;
|
||||
@@ -52,6 +54,9 @@ static int nodelist_makeindex(s_nodelist *nlp, s_faddr addr)
|
||||
bni.node = addr.node;
|
||||
bni.point = addr.point;
|
||||
|
||||
DEB((D_INDEX, "Start create index for addr: %u:%u/%u.%u", bni.zone,
|
||||
bni.net, bni.node, bni.point));
|
||||
|
||||
if( nodelist_createheader(nlp) == -1 )
|
||||
{
|
||||
log("cannot create nodelist index header");
|
||||
@@ -80,13 +85,16 @@ static int nodelist_makeindex(s_nodelist *nlp, s_faddr addr)
|
||||
|
||||
if( (p = strchr(buf, ',')) )
|
||||
{
|
||||
//DEB((D_INDEX, "index: parse comma: %s", p ));
|
||||
*p++ = '\0';
|
||||
if( (q = strchr(p, ',')) ) *q = '\0';
|
||||
|
||||
}
|
||||
|
||||
if( p == NULL || *p == '\0' )
|
||||
{
|
||||
log("incorrect nodelist line %ld: Short line", countlines);
|
||||
DEB((D_INDEX,"incorrect nodelist line %ld: Short line", countlines));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -94,20 +102,28 @@ static int nodelist_makeindex(s_nodelist *nlp, s_faddr addr)
|
||||
{
|
||||
log("incorrect nodelist line %d: Bad keyword \"%s\"",
|
||||
countlines, buf);
|
||||
DEB((D_INDEX,"incorrect nodelist line %d: Bad keyword \"%s\"",
|
||||
countlines, buf));
|
||||
continue;
|
||||
}
|
||||
|
||||
//DEB((D_INDEX,"index: keyword=%d", keyword));
|
||||
if( keyword == KEYWORD_BOSS )
|
||||
{
|
||||
s_faddr tmpaddr;
|
||||
|
||||
if( ftn_addrparse(&tmpaddr, p, FALSE) )
|
||||
{
|
||||
DEB((D_INDEX,"incorrect nodelist line %ld: Bad boss address \"%s\"",
|
||||
countlines, p));
|
||||
log("incorrect nodelist line %ld: Bad boss address \"%s\"",
|
||||
countlines, p);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEB((D_INDEX,"index: parsing Boss %u:%u/%u.0",
|
||||
tmpaddr.zone, tmpaddr.net, tmpaddr.node));
|
||||
if (addr.point == -1 )
|
||||
modepoint = true;
|
||||
bni.zone = tmpaddr.zone;
|
||||
bni.net = tmpaddr.net;
|
||||
bni.node = tmpaddr.node;
|
||||
@@ -127,40 +143,47 @@ 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;
|
||||
modepoint = false;
|
||||
break;
|
||||
case KEYWORD_REGION:
|
||||
case KEYWORD_HOST: //-V1037
|
||||
bni.net = value;
|
||||
bni.node = 0;
|
||||
bni.point = 0;
|
||||
bni.hub = 0;
|
||||
modepoint = false;
|
||||
break;
|
||||
case KEYWORD_HOST:
|
||||
bni.net = value;
|
||||
bni.node = 0;
|
||||
bni.point = 0;
|
||||
bni.hub = 0;
|
||||
break;
|
||||
case KEYWORD_HUB:
|
||||
case KEYWORD_HUB: //-V1037
|
||||
bni.node = value;
|
||||
bni.point = 0;
|
||||
bni.hub = value;
|
||||
modepoint = false;
|
||||
break;
|
||||
case KEYWORD_EMPTY:
|
||||
if (modepoint)
|
||||
{
|
||||
//DEB((D_INDEX,"found empty value=%u",value ));
|
||||
bni.point = value;
|
||||
break;
|
||||
}
|
||||
case KEYWORD_PVT:
|
||||
case KEYWORD_HOLD:
|
||||
case KEYWORD_DOWN:
|
||||
bni.node = value;
|
||||
bni.point = 0;
|
||||
modepoint = false;
|
||||
break;
|
||||
case KEYWORD_POINT:
|
||||
DEB((D_INDEX,"index: kw point"));
|
||||
bni.point = value;
|
||||
break;
|
||||
default:
|
||||
ASSERT_MSG();
|
||||
DEB((D_INDEX,"index: default assert"));
|
||||
}
|
||||
|
||||
if( nodelist_putindex(nlp, &bni) == -1 )
|
||||
@@ -182,10 +205,12 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
s_cval_entry *cfptr;
|
||||
char *nodelistdir = NULL;
|
||||
char *confname = NULL;
|
||||
time_t starttime = 0L;
|
||||
bool forcecompile = FALSE;
|
||||
long countnodes = 0L;
|
||||
char c;
|
||||
int rc = 0;
|
||||
|
||||
/* Initialise random number generation */
|
||||
(void)srand((unsigned)time(0));
|
||||
@@ -193,7 +218,7 @@ int main(int argc, char *argv[])
|
||||
(void)setlocale(LC_ALL, "");
|
||||
/* Set our name (for logging only) */
|
||||
|
||||
while( (c = getopt(argc, argv, "hf")) != EOF )
|
||||
while( (c = getopt(argc, argv, "hfC:")) != (char)-1 )
|
||||
{
|
||||
switch( c ) {
|
||||
case 'f':
|
||||
@@ -202,21 +227,32 @@ int main(int argc, char *argv[])
|
||||
case 'h':
|
||||
usage();
|
||||
exit(0);
|
||||
case 'C':
|
||||
if( confname || !optarg ) { usage(); exit(5); }
|
||||
confname = (char *)xstrcpy(optarg);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
exit(5);
|
||||
}
|
||||
|
||||
if( conf_readconf(conf_getconfname(), 0) )
|
||||
}
|
||||
|
||||
if( confname && *confname )
|
||||
rc = conf_readconf(confname, 0, false);
|
||||
else
|
||||
rc = conf_readconf(conf_getconfname(), 0, false);
|
||||
|
||||
if( rc )
|
||||
{
|
||||
log("Can not find config");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if( log_open(log_getfilename(LOG_FILE_SESSION), NULL, NULL) )
|
||||
{
|
||||
log("can't continue without logging");
|
||||
exit(1);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* Ignore some terminating signals */
|
||||
|
||||
+19
-4
@@ -44,7 +44,7 @@ bool eventexpr(s_expr *expr)
|
||||
static void usage(void)
|
||||
{
|
||||
printf_usage("outbound viewer",
|
||||
"usage: bfstat [-afhprst] [-n<number>]\n"
|
||||
"usage: bfstat [-C config] [-afhprst] [-n<number>]\n"
|
||||
"\n"
|
||||
"options:\n"
|
||||
" -a sort by FTN address (default)\n"
|
||||
@@ -56,6 +56,7 @@ static void usage(void)
|
||||
" -r reverse order while sorting\n"
|
||||
" -s sort by total files size\n"
|
||||
" -t disable total sizes printing\n"
|
||||
" -C config use config file\n"
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
@@ -248,12 +249,14 @@ int main(int argc, char *argv[])
|
||||
s_opts opts;
|
||||
s_sysqueue queue;
|
||||
s_outbound_callback_data ocb;
|
||||
char *confname = NULL;
|
||||
char c;
|
||||
int i;
|
||||
int rc = 0;
|
||||
|
||||
bfstat_opts_default(&opts);
|
||||
|
||||
while( (c = getopt(argc, argv, "acfhn:prst")) != EOF )
|
||||
while( (c = getopt(argc, argv, "acfhn:prst")) != (char)-1 )
|
||||
{
|
||||
switch( c ) {
|
||||
case 'h':
|
||||
@@ -288,6 +291,10 @@ int main(int argc, char *argv[])
|
||||
if( ISDEC(optarg) )
|
||||
opts.nodeslimit = atoi(optarg);
|
||||
break;
|
||||
case 'C':
|
||||
if( confname || !optarg ) { usage(); exit(BFERR_FATALERROR); }
|
||||
confname = (char *)xstrcpy(optarg);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
exit(1);
|
||||
@@ -301,8 +308,16 @@ int main(int argc, char *argv[])
|
||||
/* Initialise current locale */
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
||||
if( conf_readconf(conf_getconfname(), 0) )
|
||||
exit(1);
|
||||
if( confname && *confname )
|
||||
rc = conf_readconf(confname, 0, false);
|
||||
else
|
||||
rc = conf_readconf(conf_getconfname(), 0, false);
|
||||
|
||||
if( rc )
|
||||
{
|
||||
log("Can not find config");
|
||||
exit(BFERR_FATALERROR);
|
||||
}
|
||||
|
||||
memset(&ocb, '\0', sizeof(s_outbound_callback_data));
|
||||
ocb.callback = out_handle_sysqueue;
|
||||
|
||||
+211
-6
@@ -28,12 +28,15 @@ bool eventexpr(s_expr *expr)
|
||||
static void usage(void)
|
||||
{
|
||||
printf_usage("nodelist lookup utility",
|
||||
"usage: nlookup [-rmh] <address>\n"
|
||||
"usage: nlookup [-C config] [-romh] <address>\n"
|
||||
"\n"
|
||||
"options:\n"
|
||||
" -r show nodelist string\n"
|
||||
" -m show email address\n"
|
||||
" -o show overrides\n"
|
||||
" -t show calltable\n"
|
||||
" -h show this help message\n"
|
||||
" -C config use config file\n"
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
@@ -42,7 +45,7 @@ void print_nodemail(const s_node *node)
|
||||
{
|
||||
char abuf[BF_MAXADDRSTR+1];
|
||||
|
||||
if( node->sysop && *node->sysop && strcmp(node->sysop, "<none>") )
|
||||
if( *node->sysop && strcmp(node->sysop, "<none>") )
|
||||
{
|
||||
char username[BNI_MAXSYSOP+1];
|
||||
|
||||
@@ -67,7 +70,7 @@ void print_nodeinfo(const s_node *node)
|
||||
printf("Phone : %s\n", node->phone);
|
||||
printf("Sysop : %s\n", node->sysop);
|
||||
printf("Location : %s\n", node->location);
|
||||
printf("Speed : %lu\n", node->speed);
|
||||
printf("Speed : %ld\n", node->speed);
|
||||
printf("Flags : %s\n", node->flags);
|
||||
|
||||
if( node->worktime.num )
|
||||
@@ -82,7 +85,7 @@ void print_nodeinfo(const s_node *node)
|
||||
timevec_check(&node->worktime, now) ? "false" : "true");
|
||||
}
|
||||
|
||||
if( node->sysop && *node->sysop && strcmp(node->sysop, "<none>") )
|
||||
if( (node->keyword != KEYWORD_POINT) && *node->sysop && strcmp(node->sysop, "<none>") )
|
||||
{
|
||||
char username[BNI_MAXSYSOP+1];
|
||||
|
||||
@@ -122,20 +125,174 @@ void print_nodeinfo(const s_node *node)
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void print_overrides(const s_override *override_info)
|
||||
{
|
||||
s_override *p;
|
||||
char abuf[BF_MAXADDRSTR+1];
|
||||
int lin = 0;
|
||||
printf("----------- Overrides ------------\n");
|
||||
printf("Address : %s\n", ftn_addrstr(abuf, override_info->addr));
|
||||
printf("IpAddr : %s\n", override_info->sIpaddr);
|
||||
printf("Phone : %s\n", override_info->sPhone);
|
||||
printf("Flags : %s\n", override_info->sFlags);
|
||||
printf("Run before: %s\n", override_info->run);
|
||||
p = override_info->hidden;
|
||||
if (p) {
|
||||
printf("Hidden lines:\n");
|
||||
|
||||
while( p )
|
||||
{
|
||||
printf(" %5d: ",++lin);
|
||||
if (p->sIpaddr) printf("IpAddr: %s, ", p->sIpaddr);
|
||||
if (p->sPhone) printf("Phone: %s", p->sPhone);
|
||||
if (p->sFlags) printf("Flags: %s", p->sFlags);
|
||||
printf("\n");
|
||||
p = p->hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool check_phone(const char *str)
|
||||
{
|
||||
if( !str || !str[0] )
|
||||
return FALSE;
|
||||
|
||||
if( str[0] == '-' && str[1] == '\0' )
|
||||
return FALSE;
|
||||
|
||||
if( string_casestr(str, "unpublished") )
|
||||
return FALSE;
|
||||
|
||||
if( string_casestr(str, "unknown") )
|
||||
return FALSE;
|
||||
|
||||
if( string_casestr(str, "none") )
|
||||
return FALSE;
|
||||
|
||||
if( string_casestr(str, "00-00-000000") )
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void print_calltable(s_faddr addr){
|
||||
s_node nnode;
|
||||
s_override *ovr, *tmpovr;
|
||||
char *tmphost, *tmpphone;
|
||||
int rc,ln = 0;
|
||||
|
||||
|
||||
if( nodelist_lookup(&nnode, addr) == 0 )
|
||||
{
|
||||
// we got nodelist string
|
||||
ovr = conf_override(cf_override, addr);
|
||||
// be aware - ovr may not be, but second INA may
|
||||
if (ovr) {
|
||||
ovr->addr = addr;
|
||||
if (ovr->sIpaddr) strcpy (nnode.host, ovr->sIpaddr);
|
||||
if (ovr->sPhone) strcpy (nnode.phone, ovr->sPhone);
|
||||
if (ovr->sFlags) strcpy (nnode.flags, ovr->sFlags);
|
||||
} else {
|
||||
ovr = xmalloc(sizeof(s_override));
|
||||
memset(ovr,'\0',sizeof(s_override));
|
||||
ovr->addr=addr;
|
||||
ovr->hidden=NULL;
|
||||
ovr->sIpaddr=NULL;
|
||||
}
|
||||
rc = nodelist_parsehiddenina(&nnode, ovr);
|
||||
|
||||
} else {
|
||||
// we have no nodelist string - only overrides
|
||||
ovr = conf_override(cf_override, addr);
|
||||
if (ovr) {
|
||||
ovr->addr = addr;
|
||||
if (ovr->sIpaddr) strcpy (nnode.host, ovr->sIpaddr);
|
||||
if (ovr->sPhone) strcpy (nnode.phone, ovr->sPhone);
|
||||
if (ovr->sFlags) strcpy (nnode.flags, ovr->sFlags);
|
||||
}
|
||||
}
|
||||
// Let's print this table
|
||||
// begin with HOST itself
|
||||
ln = 0;
|
||||
if (nnode.host[0]) {
|
||||
tmphost = nnode.host;
|
||||
}
|
||||
if (!nodelist_checkflag(nnode.flags, "IBN")) {
|
||||
ln +=1;
|
||||
printf ("%5d. %s:binkp\n", ln, tmphost);
|
||||
}
|
||||
if (!nodelist_checkflag(nnode.flags, "IFC")) {
|
||||
ln +=1;
|
||||
printf ("%5d. %s:ifcico\n", ln, tmphost);
|
||||
}
|
||||
if (!nodelist_checkflag(nnode.flags, "ITN")) {
|
||||
ln +=1;
|
||||
printf ("%5d. %s:telnet\n", ln, tmphost);
|
||||
}
|
||||
if (ovr->hidden) {
|
||||
tmpovr = ovr;
|
||||
while (ovr->hidden != NULL) {
|
||||
ovr = ovr->hidden;
|
||||
if (ovr->sIpaddr) {
|
||||
tmphost = ovr->sIpaddr;
|
||||
if (!nodelist_checkflag(nnode.flags, "IBN")) {
|
||||
ln +=1;
|
||||
printf ("%5d. %s:binkp\n", ln, tmphost);
|
||||
}
|
||||
if (!nodelist_checkflag(nnode.flags, "IFC")) {
|
||||
ln +=1;
|
||||
printf ("%5d. %s:ifcico\n", ln, tmphost);
|
||||
}
|
||||
if (!nodelist_checkflag(nnode.flags, "ITN")) {
|
||||
ln +=1;
|
||||
printf ("%5d. %s:telnet\n", ln, tmphost);
|
||||
}
|
||||
}
|
||||
}
|
||||
ovr = tmpovr;
|
||||
}
|
||||
|
||||
// Calltable for pstn
|
||||
if (nnode.phone[0] && check_phone(nnode.phone) ) {
|
||||
tmpphone = nnode.phone;
|
||||
ln +=1;
|
||||
printf ("%5d. PSTN %s\n", ln, tmpphone);
|
||||
if (ovr->hidden) {
|
||||
tmpovr = ovr;
|
||||
while (ovr->hidden != NULL) {
|
||||
ovr = ovr->hidden;
|
||||
if (ovr->sPhone && check_phone(ovr->sPhone)) {
|
||||
tmpphone = ovr->sPhone;
|
||||
ln +=1;
|
||||
printf ("%5d. PSTN %s\n", ln, tmpphone);
|
||||
}
|
||||
}
|
||||
ovr = tmpovr;
|
||||
}
|
||||
}
|
||||
// free ovr elements
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
s_node node;
|
||||
s_faddr addr;
|
||||
s_override *ovr;
|
||||
char ch;
|
||||
int rc = 0;
|
||||
char *confname = NULL;
|
||||
bool rawstring = FALSE;
|
||||
bool emailaddr = FALSE;
|
||||
bool overrides = FALSE;
|
||||
bool calltable = FALSE;
|
||||
|
||||
/* Initialise random number generation */
|
||||
(void)srand((unsigned)time(0));
|
||||
/* Initialise current locale */
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
||||
while( (ch=getopt(argc, argv, "hrm")) != EOF )
|
||||
while( (ch=getopt(argc, argv, "hdrtmoC:")) != (char)-1 )
|
||||
{
|
||||
switch( ch ) {
|
||||
case 'h':
|
||||
@@ -147,6 +304,16 @@ int main(int argc, char *argv[])
|
||||
case 'm':
|
||||
emailaddr = TRUE;
|
||||
break;
|
||||
case 't':
|
||||
calltable = TRUE;
|
||||
break;
|
||||
case 'o':
|
||||
overrides = TRUE;
|
||||
break;
|
||||
case 'C':
|
||||
if( confname || !optarg ) { usage(); exit(BFERR_FATALERROR); }
|
||||
confname = (char *)xstrcpy(optarg);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
exit(BFERR_FATALERROR);
|
||||
@@ -159,8 +326,18 @@ int main(int argc, char *argv[])
|
||||
exit(BFERR_FATALERROR);
|
||||
}
|
||||
|
||||
if( conf_readconf(conf_getconfname(), 0) )
|
||||
if( confname && *confname )
|
||||
rc = conf_readconf(confname, 0, false);
|
||||
else
|
||||
rc = conf_readconf(conf_getconfname(), 0, false);
|
||||
|
||||
if( rc )
|
||||
{
|
||||
DEB((D_NODELIST,"nlookup: Can not find config"));
|
||||
exit(BFERR_FATALERROR);
|
||||
}
|
||||
|
||||
DEB((D_NODELIST,"Starting nlookup"));
|
||||
|
||||
if( rawstring )
|
||||
{
|
||||
@@ -171,11 +348,39 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if( nodelist_lookup(&node, addr) == 0 )
|
||||
{
|
||||
// Overrides
|
||||
ovr = conf_override(cf_override, addr);
|
||||
|
||||
if (addr.point == 0) {
|
||||
if( emailaddr )
|
||||
print_nodemail(&node);
|
||||
else
|
||||
print_nodeinfo(&node);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_nodeinfo(&node);
|
||||
}
|
||||
if (overrides && ovr) {
|
||||
print_overrides(ovr);
|
||||
}
|
||||
if (calltable) {
|
||||
printf ("----------- Calltable ------------\n");
|
||||
print_calltable(addr);
|
||||
}
|
||||
} else {
|
||||
if (overrides) {
|
||||
ovr = conf_override(cf_override, addr);
|
||||
if (ovr) {
|
||||
printf ("-------- No nodelist info --------");
|
||||
print_overrides(ovr);
|
||||
if (calltable) {
|
||||
printf ("----- Calltable-on-overrides -----\n");
|
||||
print_calltable(addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deinit_conf();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user