Version 0.25.3 Fixes for daemon mode, flags, nodelist index
This commit is contained in:
		
						commit
						9bc3a14dd0
					
				
							
								
								
									
										13
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								CHANGES
									
									
									
									
									
								
							@ -257,3 +257,16 @@ Alexey Khromov (zx@zxalexis.ru)
 | 
				
			|||||||
0.25.2
 | 
					0.25.2
 | 
				
			||||||
 + Adopted for outgoing IPv6 communication
 | 
					 + Adopted for outgoing IPv6 communication
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					0.25.3
 | 
				
			||||||
 | 
					 + Fixed IPv6 address logging in inetd connections
 | 
				
			||||||
 | 
					 + Fixed outgoing proto detection and order - as Direct, BinkP, Ifcico, 
 | 
				
			||||||
 | 
					   Telnet, Modem first allowed to connect. You may change this order 
 | 
				
			||||||
 | 
					   individually by override flags.
 | 
				
			||||||
 | 
					 + Daemon mode now tries to make outgoing tcp calls prior to modem
 | 
				
			||||||
 | 
					 + Daemon mode - fixed working time for tcp nodes (CM)
 | 
				
			||||||
 | 
					 + Fixed some x64 errors in comparisons to integers
 | 
				
			||||||
 | 
					 + Added systemd and xinetd service files to contrib folder
 | 
				
			||||||
 | 
					 + Fixed flag files creation
 | 
				
			||||||
 | 
					 + Added flags for TIC files (inctic_flag) and files (incfile_flag)
 | 
				
			||||||
 | 
					 + Fixed nodelist index creation
 | 
				
			||||||
 | 
					 + Added support for TCP port description in IBN/IFC/ITN flags
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										23
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								README.md
									
									
									
									
									
								
							@ -1,10 +1,26 @@
 | 
				
			|||||||
BinkleyForce FTN mailer
 | 
					BinkleyForce FTN mailer
 | 
				
			||||||
-----------------------
 | 
					-----------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BinkleyForce is a simple ifcico like FTN mailer. It can works via
 | 
					BinkleyForce is a simple ifcico like FTN mailer. It can work via
 | 
				
			||||||
TCP/IP as well as on modem links. Look sample configs for more
 | 
					TCP/IP as well as on modem links. Look sample configs for more
 | 
				
			||||||
information.
 | 
					information.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Supported Features
 | 
				
			||||||
 | 
					------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						- PSTN dial-out with EMSI-II/EMSI/YooHoo handshake
 | 
				
			||||||
 | 
						- PSTN protocols: Hydra, ZedZap, ZModem
 | 
				
			||||||
 | 
						- PSTN dial-in through mgetty
 | 
				
			||||||
 | 
						- TCP/IP dial-out through IPv4 and IPv6 networks
 | 
				
			||||||
 | 
						- TCP/IP protocols - ifcico / BinkP 1.1
 | 
				
			||||||
 | 
						- TCP/IP dial-in through xinetd/inetd
 | 
				
			||||||
 | 
						- Daemon mode for outbound queue managing
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Linux 2.4.11+, FreeBSD (6+ AFAIR) compatible.
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					Licence
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This program is free software; you can redistribute it and/or modify
 | 
					This program is free software; you can redistribute it and/or modify
 | 
				
			||||||
it under the terms of the GNU General Public License as published by
 | 
					it under the terms of the GNU General Public License as published by
 | 
				
			||||||
the Free Software Foundation; either version 2, or (at your option)
 | 
					the Free Software Foundation; either version 2, or (at your option)
 | 
				
			||||||
@ -12,8 +28,9 @@ any later version. See the COPYING file for further information.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Known Bugs
 | 
					Known Bugs
 | 
				
			||||||
----------
 | 
					----------
 | 
				
			||||||
    - BinkD use and expect local file time at BinkP sessions, but
 | 
					    - BinkleyForce has no support (yet) for multiple INA: addresses
 | 
				
			||||||
      BinkleyForce always use UTC time (?)
 | 
					    - Can not rotate hidden lines
 | 
				
			||||||
 | 
					    - Can not rotate supported IP protocols in case of failure
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bug Reports
 | 
					Bug Reports
 | 
				
			||||||
-----------
 | 
					-----------
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										92
									
								
								contrib/mkpoll.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										92
									
								
								contrib/mkpoll.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,92 @@
 | 
				
			|||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Directories and static values
 | 
				
			||||||
 | 
					DEFZONE=2
 | 
				
			||||||
 | 
					# Default outbound
 | 
				
			||||||
 | 
					# OUTBOUND="."
 | 
				
			||||||
 | 
					# Our AKA
 | 
				
			||||||
 | 
					# AKA="2:5030/723@fidonet"
 | 
				
			||||||
 | 
					# FLO Extension
 | 
				
			||||||
 | 
					FLOEXT="dlo"
 | 
				
			||||||
 | 
					# BFCONFIG=/opt/fidonms/etc/bforce.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "${BFCONFIG}" == "" ]; then
 | 
				
			||||||
 | 
						BFCONF="/etc/bforce/bforce.conf"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						BFCONF=${BFCONFIG}
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "$1" == "" ]; then
 | 
				
			||||||
 | 
						echo "No FTN provided. Usage: mkpoll <address>"
 | 
				
			||||||
 | 
						exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Address to create poll 
 | 
				
			||||||
 | 
					FTNA=$1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Outbound address
 | 
				
			||||||
 | 
					OUTB=""
 | 
				
			||||||
 | 
					if [ -f "${BFCONF}" ]; then
 | 
				
			||||||
 | 
						# We have config!
 | 
				
			||||||
 | 
						OUTB=$(grep -E "^outbound_directory" ${BFCONF} | awk '{print $2}')
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						OUTB=${OUTBOUND}
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#echo "FTNA: ${FTNA} OUTB: ${OUTB}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FZONE=$(echo -n ${FTNA}| awk -F':' '{print $1}')
 | 
				
			||||||
 | 
					FNET=$(echo -n ${FTNA} | awk -F':' '{print $2}' | awk -F'/' '{ print $1 }')
 | 
				
			||||||
 | 
					FNODE=$(echo -n ${FTNA}| awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $1 }')
 | 
				
			||||||
 | 
					FPNT=$(echo -n ${FTNA} | awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $2 }')
 | 
				
			||||||
 | 
					FDOM=$(echo -n ${FTNA} | awk -F'@' '{print $2}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# echo "Dest ZONE: ${FZONE}, NET: ${FNET}, NODE: ${FNODE}, PNT: ${FPNT} DOM: ${FDOM}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Our AKA
 | 
				
			||||||
 | 
					FAKA=""
 | 
				
			||||||
 | 
					if [ -f "${BFCONF}" ]; then
 | 
				
			||||||
 | 
						# We have config!
 | 
				
			||||||
 | 
						FAKA=$(grep -E "^address" ${BFCONF} | awk '{print $2}')
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						FAKA=${AKA}
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AZONE=$(echo -n ${FAKA}| awk -F':' '{print $1}')
 | 
				
			||||||
 | 
					ANET=$(echo -n ${FAKA} | awk -F':' '{print $2}' | awk -F'/' '{ print $1 }')
 | 
				
			||||||
 | 
					ANODE=$(echo -n ${FAKA}| awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $1 }')
 | 
				
			||||||
 | 
					APNT=$(echo -n ${FAKA} | awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $2 }')
 | 
				
			||||||
 | 
					ADOM=$(echo -n ${FAKA} | awk -F'@' '{print $2}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# echo "Our ZONE: ${AZONE}, NET: ${ANET}, NODE: ${ANODE}, PNT: ${APNT} DOM: ${ADOM}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FTNB=$( printf "%04x%04x" ${FNET} ${FNODE} )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "${FPNT}" == "" ]; then
 | 
				
			||||||
 | 
						FPNT="0"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FFLO=""
 | 
				
			||||||
 | 
					if [ "${AZONE}" == "${FZONE}" ] && [ "${FNET}" == "${ANET}" ] && [ "${FNODE}" == "${ANODE}" ] && [ ! "${FPNT}" == "0" ]; then
 | 
				
			||||||
 | 
						# echo "Point operations!"
 | 
				
			||||||
 | 
						FLOFIL=$( printf "%08x.${FLOEXT}" ${FPNT} )
 | 
				
			||||||
 | 
						PNTDIR=$( echo -n "${OUTB}/${FTNB}.pnt")
 | 
				
			||||||
 | 
						FFLO=$( echo -n "${PNTDIR}/${FLOFIL}" )
 | 
				
			||||||
 | 
					elif [ ! "${DEFZONE}" == "${FZONE}" ]; then
 | 
				
			||||||
 | 
						# Interzonal poll
 | 
				
			||||||
 | 
						FLOFIL=$( echo -n "${FTNB}.${FLOEXT}" )
 | 
				
			||||||
 | 
						FDIR=$( printf "%03x" ${FZONE} )
 | 
				
			||||||
 | 
						FFLO=$( echo -n "${OUTB}.${FDIR}/${FLOFIL}" )
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						# Normal in-zone poll
 | 
				
			||||||
 | 
						FLOFIL=$( echo -n "${FTNB}.${FLOEXT}" )
 | 
				
			||||||
 | 
						FFLO=$( echo -n "${OUTB}/${FLOFIL}" )
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# echo "FloFile: ${FFLO}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ! -f "${FFLO}" ]; then
 | 
				
			||||||
 | 
						touch "${FFLO}"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										13
									
								
								contrib/systemd/bforce.service
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								contrib/systemd/bforce.service
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					[Unit]
 | 
				
			||||||
 | 
					Description=Binkleyforce Outbound server
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Service]
 | 
				
			||||||
 | 
					Type=forking
 | 
				
			||||||
 | 
					PIDFile=/tmp/bforce.pid
 | 
				
			||||||
 | 
					User=fido
 | 
				
			||||||
 | 
					Group=fido
 | 
				
			||||||
 | 
					ExecStart=/usr/bin/bforce -d -C /opt/fidonms/etc/bforce.conf
 | 
				
			||||||
 | 
					ExecStop=/usr/bin/bforce -q
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Install]
 | 
				
			||||||
 | 
					WantedBy=multi-user.target
 | 
				
			||||||
							
								
								
									
										13
									
								
								contrib/xinetd.d/bforce-binkp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								contrib/xinetd.d/bforce-binkp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					#binkleyforce ifc (port 60179) EMSI-over-ip
 | 
				
			||||||
 | 
					service binkp
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    disable	= no
 | 
				
			||||||
 | 
					    socket_type	= stream
 | 
				
			||||||
 | 
					#    flags	= IPv4
 | 
				
			||||||
 | 
					    protocol	= tcp
 | 
				
			||||||
 | 
					    port	= 24554
 | 
				
			||||||
 | 
					    wait	= no
 | 
				
			||||||
 | 
					    user	= fido
 | 
				
			||||||
 | 
					    server	= /usr/bin/bforce
 | 
				
			||||||
 | 
					    server_args	= -C /opt/fidonms/etc/bforce.conf -i binkp
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										13
									
								
								contrib/xinetd.d/bforce-ifcico
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								contrib/xinetd.d/bforce-ifcico
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					#binkleyforce ifc (port 60179) EMSI-over-ip
 | 
				
			||||||
 | 
					service ifc
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    disable	= no
 | 
				
			||||||
 | 
					    socket_type	= stream
 | 
				
			||||||
 | 
					#    flags	= IPv4
 | 
				
			||||||
 | 
					    protocol	= tcp
 | 
				
			||||||
 | 
					    port	= 60179
 | 
				
			||||||
 | 
					    wait	= no
 | 
				
			||||||
 | 
					    user	= fido
 | 
				
			||||||
 | 
					    server	= /usr/bin/bforce
 | 
				
			||||||
 | 
					    server_args	= -C /opt/fidonms/etc/bforce.conf -i auto
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -103,6 +103,11 @@ nodial_flag /etc/nodial
 | 
				
			|||||||
#incnet_flag /var/spool/fido/flags/mail
 | 
					#incnet_flag /var/spool/fido/flags/mail
 | 
				
			||||||
# Arcmail:
 | 
					# Arcmail:
 | 
				
			||||||
#incarc_flag /var/spool/fido/flags/echo
 | 
					#incarc_flag /var/spool/fido/flags/echo
 | 
				
			||||||
 | 
					# FileEcho TIC
 | 
				
			||||||
 | 
					#inctic_flag /var/spool/fido/flags/tick
 | 
				
			||||||
 | 
					# Regular file recieve
 | 
				
			||||||
 | 
					#incfile_flag /var/spool/fido/flags/alert
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Inbound directories
 | 
					# Inbound directories
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
0.25.2
 | 
					0.25.3
 | 
				
			||||||
 | 
				
			|||||||
@ -100,6 +100,8 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = {
 | 
				
			|||||||
	CONF_KEY(freq_srif_command,          CT_STRING),
 | 
						CONF_KEY(freq_srif_command,          CT_STRING),
 | 
				
			||||||
	CONF_KEY(incnet_flag,                CT_STRING),
 | 
						CONF_KEY(incnet_flag,                CT_STRING),
 | 
				
			||||||
	CONF_KEY(incarc_flag,                CT_STRING),
 | 
						CONF_KEY(incarc_flag,                CT_STRING),
 | 
				
			||||||
 | 
						CONF_KEY(inctic_flag,				 CT_STRING),
 | 
				
			||||||
 | 
						CONF_KEY(incfile_flag,				 CT_STRING),
 | 
				
			||||||
	CONF_KEY(hide_our_aka,               CT_ADDRESS),
 | 
						CONF_KEY(hide_our_aka,               CT_ADDRESS),
 | 
				
			||||||
	CONF_KEY(history_file,               CT_STRING),
 | 
						CONF_KEY(history_file,               CT_STRING),
 | 
				
			||||||
	CONF_KEY(hydra_options,              CT_OPTIONS),
 | 
						CONF_KEY(hydra_options,              CT_OPTIONS),
 | 
				
			||||||
 | 
				
			|||||||
@ -178,7 +178,7 @@ static int daemon_sysentry_deinit(s_sysentry *sysent)
 | 
				
			|||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
 | 
					static int daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	bool good_phone = FALSE;
 | 
						bool good_phone = FALSE;
 | 
				
			||||||
	bool good_host = FALSE;
 | 
						bool good_host = FALSE;
 | 
				
			||||||
@ -208,6 +208,11 @@ static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
 | 
				
			|||||||
		if( tcpip_isgood_host(ovrd->sIpaddr) )
 | 
							if( tcpip_isgood_host(ovrd->sIpaddr) )
 | 
				
			||||||
			good_host = TRUE;
 | 
								good_host = TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						else if ( node && *node->host )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if( tcpip_isgood_host(node->host) )
 | 
				
			||||||
 | 
								good_host = TRUE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Check work time
 | 
						 * Check work time
 | 
				
			||||||
@ -231,6 +236,16 @@ static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
 | 
				
			|||||||
			good_time = TRUE;
 | 
								good_time = TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// Must be more complicated, i.e. call to IP even if modem is not good time
 | 
				
			||||||
 | 
						if ( good_host )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							good_time = TRUE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						DEB((D_DAEMON, "daemon: node_cancall_line good_phone: %d, good_time:%d, good_host:%d", 
 | 
				
			||||||
 | 
										good_phone, good_time, good_host));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	if( good_time )
 | 
						if( good_time )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if( good_host )
 | 
							if( good_host )
 | 
				
			||||||
@ -323,9 +338,23 @@ static bool daemon_node_cancall(s_sysentry *syst, bool ign_wtime, bool tcpip)
 | 
				
			|||||||
			return FALSE;
 | 
								return FALSE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						/* Make check for tcpip out */
 | 
				
			||||||
 | 
						if ( tcpip )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							rc = daemon_node_cancall_line(&syst->node, NULL);
 | 
				
			||||||
 | 
							DEB((D_DAEMON, "daemon tcpip: node_cancall rc=%d", rc));
 | 
				
			||||||
 | 
							if ( rc == 2 )
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								syst->tcpip = TRUE;
 | 
				
			||||||
 | 
								return TRUE;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	/* Make checks for all lines */
 | 
						/* Make checks for all lines */
 | 
				
			||||||
	if( syst->overrides )
 | 
						if( syst->overrides )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							DEB((D_DAEMON, "daemon: node_cancall OVR-IN"));
 | 
				
			||||||
		if( syst->lineptr && syst->lineptr->hidden )
 | 
							if( syst->lineptr && syst->lineptr->hidden )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			line = syst->line + 1;
 | 
								line = syst->line + 1;
 | 
				
			||||||
@ -363,11 +392,18 @@ static bool daemon_node_cancall(s_sysentry *syst, bool ign_wtime, bool tcpip)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			line++;
 | 
								line++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else /* Node without overriden parameters */
 | 
						else /* Node without overriden parameters */
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		syst->line = line = 0;
 | 
							syst->line = line = 0;
 | 
				
			||||||
		return daemon_node_cancall_line(&syst->node, NULL);
 | 
							rc = daemon_node_cancall_line(&syst->node, NULL);
 | 
				
			||||||
 | 
							DEB((D_DAEMON, "daemon: node_cancall rc=%d", rc));
 | 
				
			||||||
 | 
							if ( rc )
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								syst->tcpip = (rc == 2) ? TRUE : FALSE;
 | 
				
			||||||
 | 
								return TRUE;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	return FALSE;
 | 
						return FALSE;
 | 
				
			||||||
@ -687,6 +723,8 @@ int daemon_rescan_sysqueue(s_sysqueue *q, s_daemon_queue dqs[])
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
#ifdef DEBUG
 | 
					#ifdef DEBUG
 | 
				
			||||||
	log_sysqueue(q);
 | 
						log_sysqueue(q);
 | 
				
			||||||
 | 
						DEB((D_DAEMON, "daemon rescan_sysqueue daemon queue: MODEM: %d, %d; TCPIP: %d, %d",
 | 
				
			||||||
 | 
							dqs[MODEM_QUEUE].circle, dqs[MODEM_QUEUE].current, dqs[TCPIP_QUEUE].circle, dqs[TCPIP_QUEUE].current));
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
@ -1010,10 +1048,17 @@ int daemon_run(const char *confname, const char *incname, bool quit)
 | 
				
			|||||||
				timer_set(&timer_alive, DAEMON_ALIVE_TIMER);
 | 
									timer_set(&timer_alive, DAEMON_ALIVE_TIMER);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			if( max_modem > 0 )
 | 
					 | 
				
			||||||
				daemon_queue_do(&daemon_queues[MODEM_QUEUE]);
 | 
					 | 
				
			||||||
			if( max_tcpip > 0 ) 
 | 
								if( max_tcpip > 0 ) 
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									DEB((D_DAEMON,"daemon: daemon_tcpip_queue"));
 | 
				
			||||||
				daemon_queue_do(&daemon_queues[TCPIP_QUEUE]);
 | 
									daemon_queue_do(&daemon_queues[TCPIP_QUEUE]);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								if( max_modem > 0 )
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									DEB((D_DAEMON,"daemon: daemon_modem_queue"));
 | 
				
			||||||
 | 
									daemon_queue_do(&daemon_queues[MODEM_QUEUE]);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			(void)sleep(DAEMON_IDLE_SLEEP);
 | 
								(void)sleep(DAEMON_IDLE_SLEEP);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
				
			|||||||
@ -54,15 +54,20 @@ static int daemon_call_branch(s_sysentry *syst, const char *lockdir, s_modemport
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        s_bforce_opts opts;
 | 
					        s_bforce_opts opts;
 | 
				
			||||||
        // TODO: add hiddenline round-robin
 | 
					        // TODO: add hiddenline round-robin
 | 
				
			||||||
        opts.hiddline=0;
 | 
					        memset(&opts, '\0', sizeof(s_bforce_opts));
 | 
				
			||||||
        opts.runmode = MODE_CALL_DEFAULT;
 | 
					        
 | 
				
			||||||
 | 
					        opts.hiddline = 0;
 | 
				
			||||||
 | 
					        if ( syst->tcpip )
 | 
				
			||||||
 | 
								opts.runmode = MODE_CALL_IP;
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								opts.runmode = MODE_CALL_DEFAULT;
 | 
				
			||||||
        opts.ipproto = NULL;
 | 
					        opts.ipproto = NULL;
 | 
				
			||||||
        opts.phone = NULL;
 | 
					        opts.phone = NULL;
 | 
				
			||||||
        opts.force = 0;
 | 
					        opts.force = 0;
 | 
				
			||||||
        opts.inetd = 0;
 | 
					        opts.inetd = 0;
 | 
				
			||||||
        opts.connect = NULL;
 | 
					        opts.connect = NULL;
 | 
				
			||||||
        opts.device = NULL;
 | 
					        opts.device = NULL;
 | 
				
			||||||
 | 
					    DEB((D_DAEMON, "daemon_call: calling call_system from branch"));
 | 
				
			||||||
//        log("doing call_system");
 | 
					//        log("doing call_system");
 | 
				
			||||||
	return call_system(syst->node.addr, &opts);
 | 
						return call_system(syst->node.addr, &opts);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -88,7 +93,10 @@ int daemon_call(s_sysentry *syst)
 | 
				
			|||||||
	 * Check whether this node is allready locked
 | 
						 * Check whether this node is allready locked
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if( out_bsy_check(syst->node.addr) ) 
 | 
						if( out_bsy_check(syst->node.addr) ) 
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							DEB((D_DAEMON, "daemon_call: node locked by .bsy file"));
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Set state structure to make expressions works properly now
 | 
						 * Set state structure to make expressions works properly now
 | 
				
			||||||
@ -101,6 +109,7 @@ int daemon_call(s_sysentry *syst)
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	if( syst->tcpip == FALSE )
 | 
						if( syst->tcpip == FALSE )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							DEB((D_DAEMON, "daemon_call: tcpip false - prep modem line"));
 | 
				
			||||||
		if( (p_lockdir = conf_string(cf_uucp_lock_directory)) == NULL )
 | 
							if( (p_lockdir = conf_string(cf_uucp_lock_directory)) == NULL )
 | 
				
			||||||
			p_lockdir = BFORCE_LOCK_DIR;
 | 
								p_lockdir = BFORCE_LOCK_DIR;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@ -110,6 +119,9 @@ int daemon_call(s_sysentry *syst)
 | 
				
			|||||||
			return 1;
 | 
								return 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						DEB((D_DAEMON, "call %s line %d via %s",
 | 
				
			||||||
 | 
							ftn_addrstr(abuf, syst->node.addr), syst->line,
 | 
				
			||||||
 | 
							syst->tcpip ? "TCP/IP" : modemport->name));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	log("call %s line %d via %s",
 | 
						log("call %s line %d via %s",
 | 
				
			||||||
		ftn_addrstr(abuf, syst->node.addr), syst->line,
 | 
							ftn_addrstr(abuf, syst->node.addr), syst->line,
 | 
				
			||||||
@ -138,7 +150,7 @@ int daemon_call(s_sysentry *syst)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/* Now we are in child process */
 | 
						/* Now we are in child process */
 | 
				
			||||||
	
 | 
						DEB((D_DAEMON, "daemon_call: fork success - calling..."));
 | 
				
			||||||
	exit(daemon_call_branch(syst, p_lockdir, modemport));
 | 
						exit(daemon_call_branch(syst, p_lockdir, modemport));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -54,7 +54,6 @@ static int tcpip_connect2(struct addrinfo *ai)
 | 
				
			|||||||
		if ( fd == -1 ) 
 | 
							if ( fd == -1 ) 
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			DEB((D_INFO, "tcpip_connect2: socket error"));
 | 
								DEB((D_INFO, "tcpip_connect2: socket error"));
 | 
				
			||||||
			continue;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else break;
 | 
							else break;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
				
			|||||||
@ -118,6 +118,9 @@ int tio_get(int fd, TIO *tio)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
#ifdef HAVE_TERMIOS_H
 | 
					#ifdef HAVE_TERMIOS_H
 | 
				
			||||||
	return tcgetattr(fd, tio);
 | 
						return tcgetattr(fd, tio);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
						DEB(("io_unix_tio: TERMIOS not supported!"));
 | 
				
			||||||
 | 
						return -1;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -127,6 +130,9 @@ int tio_set(int fd, TIO *tio)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
#ifdef HAVE_TERMIOS_H
 | 
					#ifdef HAVE_TERMIOS_H
 | 
				
			||||||
	return tcsetattr(fd, TCSANOW, tio);
 | 
						return tcsetattr(fd, TCSANOW, tio);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
						DEB(("io_unix_tio: TERMIOS not supported!"));
 | 
				
			||||||
 | 
						return -1;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -177,7 +183,7 @@ int tio_get_speed(TIO *tio)
 | 
				
			|||||||
			return speedtab[i].nspeed;
 | 
								return speedtab[i].nspeed;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	return-1;
 | 
						return -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tio_set_flow_control(int fd, TIO *tio, int flow)
 | 
					int tio_set_flow_control(int fd, TIO *tio, int flow)
 | 
				
			||||||
 | 
				
			|||||||
@ -106,11 +106,15 @@ int log_open(const char *logname, const char *ext, const char *tty)
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	if( logname )
 | 
						if( logname )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							DEB((D_INFO,"log_open: Opening log file %s", logname));
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		strnxcpy(log_name, logname, sizeof(log_name));
 | 
							strnxcpy(log_name, logname, sizeof(log_name));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							// May be NULL, so check both
 | 
				
			||||||
		if( tty && *tty )
 | 
							if( tty && *tty )
 | 
				
			||||||
			strnxcpy(log_ttyname, tty, sizeof(log_ttyname));
 | 
								strnxcpy(log_ttyname, tty, sizeof(log_ttyname));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							// May be NULL, so check both
 | 
				
			||||||
		if( ext && *ext )
 | 
							if( ext && *ext )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			strnxcpy(log_extension, ext, sizeof(log_extension));
 | 
								strnxcpy(log_extension, ext, sizeof(log_extension));
 | 
				
			||||||
@ -142,7 +146,9 @@ int log_close(void)
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	if( log_fp )
 | 
						if( log_fp )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		rc = fclose(log_fp); log_fp = NULL;
 | 
							rc = fclose(log_fp); 
 | 
				
			||||||
 | 
							DEB((D_INFO,"Closing log file."));
 | 
				
			||||||
 | 
							log_fp = NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	return rc;	
 | 
						return rc;	
 | 
				
			||||||
 | 
				
			|||||||
@ -243,7 +243,7 @@ int nodelist_parsestring(s_node *node, char *str)
 | 
				
			|||||||
	strnxcpy(node->phone, argv[NODELIST_POSPHONE], sizeof(node->phone));
 | 
						strnxcpy(node->phone, argv[NODELIST_POSPHONE], sizeof(node->phone));
 | 
				
			||||||
	strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags));
 | 
						strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags));
 | 
				
			||||||
	node->speed = atoi(argv[NODELIST_POSSPEED]);
 | 
						node->speed = atoi(argv[NODELIST_POSSPEED]);
 | 
				
			||||||
	
 | 
						DEB((D_NODELIST, "nodelist: Parsed common values SYS: %s, ZYZ: %s, LOC: %s, PHONE: %s", node->name, node->sysop, node->location, node->phone));
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Replace all '_' by space character
 | 
						 * Replace all '_' by space character
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
@ -291,8 +291,11 @@ int nodelist_parsestring(s_node *node, char *str)
 | 
				
			|||||||
	node->do_ifcico = nodelist_checkflag(node->flags, "IFC") == 0;
 | 
						node->do_ifcico = nodelist_checkflag(node->flags, "IFC") == 0;
 | 
				
			||||||
	node->do_telnet = nodelist_checkflag(node->flags, "ITN") == 0;
 | 
						node->do_telnet = nodelist_checkflag(node->flags, "ITN") == 0;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						//TODO: Add more INA flags to array
 | 
				
			||||||
	nodelist_flagvalue(node->flags, "INA", node->host);
 | 
						nodelist_flagvalue(node->flags, "INA", node->host);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						DEB((D_NODELIST, "nodelist: Parsed inet values IBN: %d, IFC: %d, ITN: %d, INA: %s", node->do_binkp, node->do_ifcico, node->do_telnet, node->host)); 
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -31,6 +31,7 @@ int out_filetype(const char *fname)
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
		p_nam = fname;
 | 
							p_nam = fname;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						DEB((D_EVENT, "outb_fsqueue: getting type of file %s", p_nam));
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 *  Get file name extension
 | 
						 *  Get file name extension
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
@ -39,12 +40,19 @@ int out_filetype(const char *fname)
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	for( i = 0; outtab[i].ext; i++ )
 | 
						for( i = 0; outtab[i].ext; i++ )
 | 
				
			||||||
		if( strcasemask(p_ext, outtab[i].ext) == 0 )
 | 
							if( strcasemask(p_ext, outtab[i].ext) == 0 )
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								DEB((D_EVENT, "outb_fsqueue: got type %d from outtab ext %s", outtab[i].type, p_ext ));
 | 
				
			||||||
			return outtab[i].type;
 | 
								return outtab[i].type;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	for( i = 0; exttab[i].ext; i++ )
 | 
						for( i = 0; exttab[i].ext; i++ )
 | 
				
			||||||
		if( strcasemask(p_ext, exttab[i].ext) == 0 )
 | 
							if( strcasemask(p_ext, exttab[i].ext) == 0 )
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								DEB((D_EVENT, "outb_fsqueue: got type %d from exttab ext %s", exttab[i].type, p_ext ));
 | 
				
			||||||
			return exttab[i].type;
 | 
								return exttab[i].type;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						DEB((D_EVENT, "outb_fsqueue: got type UNKNOWN", exttab[i].type, p_ext ));
 | 
				
			||||||
	return TYPE_UNKNOWN;
 | 
						return TYPE_UNKNOWN;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -740,7 +740,7 @@ case BPMSG_PWD:              /* Session password */
 | 
				
			|||||||
            /* Do authorization */
 | 
					            /* Do authorization */
 | 
				
			||||||
	    if( binkp_auth_incoming(bstate->remote_data) ) {
 | 
						    if( binkp_auth_incoming(bstate->remote_data) ) {
 | 
				
			||||||
	        log("error: invalid password");
 | 
						        log("error: invalid password");
 | 
				
			||||||
	        if( bstate->extracmd[0] !=-1 ) return 0; // suspend if extra is occupied
 | 
						        if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend if extra is occupied
 | 
				
			||||||
	        bstate->extracmd[0] = BPMSG_ERR;
 | 
						        bstate->extracmd[0] = BPMSG_ERR;
 | 
				
			||||||
	        strcpy(bstate->extracmd+1, "Security violation");
 | 
						        strcpy(bstate->extracmd+1, "Security violation");
 | 
				
			||||||
	        bstate->extraislast = true;
 | 
						        bstate->extraislast = true;
 | 
				
			||||||
@ -749,7 +749,7 @@ case BPMSG_PWD:              /* Session password */
 | 
				
			|||||||
	    // lock addresses
 | 
						    // lock addresses
 | 
				
			||||||
	    if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) ) {
 | 
						    if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) ) {
 | 
				
			||||||
	        log("error locking addresses of the remote");
 | 
						        log("error locking addresses of the remote");
 | 
				
			||||||
	        if( bstate->extracmd[0] !=-1 ) return 0; // suspend if extra is occupied
 | 
						        if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend if extra is occupied
 | 
				
			||||||
	        bstate->extracmd[0] = BPMSG_BSY;
 | 
						        bstate->extracmd[0] = BPMSG_BSY;
 | 
				
			||||||
	        strcpy(bstate->extracmd+1, "All addresses are busy");
 | 
						        strcpy(bstate->extracmd+1, "All addresses are busy");
 | 
				
			||||||
	        bstate->extraislast = true;
 | 
						        bstate->extraislast = true;
 | 
				
			||||||
@ -770,6 +770,7 @@ case BPMSG_FILE:             /* File information */
 | 
				
			|||||||
            s_bpfinfo recvfi;
 | 
					            s_bpfinfo recvfi;
 | 
				
			||||||
            if( binkp_parsfinfo(buf+1, &recvfi, true) ) {
 | 
					            if( binkp_parsfinfo(buf+1, &recvfi, true) ) {
 | 
				
			||||||
		log ("M_FILE parse error: %s", buf + 1);
 | 
							log ("M_FILE parse error: %s", buf + 1);
 | 
				
			||||||
 | 
							DEB((D_24554, "M_FILE parse error: %s", buf + 1 ));
 | 
				
			||||||
		PROTO_ERROR("invalid M_FILE");
 | 
							PROTO_ERROR("invalid M_FILE");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            bstate->batch_recv_count += 1;
 | 
					            bstate->batch_recv_count += 1;
 | 
				
			||||||
@ -786,9 +787,9 @@ case BPMSG_FILE:             /* File information */
 | 
				
			|||||||
		    return 1;
 | 
							    return 1;
 | 
				
			||||||
	        }
 | 
						        }
 | 
				
			||||||
	        DEB((D_24554, "no, skipping; TODO: accept it"));
 | 
						        DEB((D_24554, "no, skipping; TODO: accept it"));
 | 
				
			||||||
		if( bstate->extracmd[0] != -1 ) return 0;
 | 
							if( bstate->extracmd[0] != (char)-1 ) return 0;
 | 
				
			||||||
		bstate->extracmd[0] = BPMSG_SKIP;
 | 
							bstate->extracmd[0] = BPMSG_SKIP;
 | 
				
			||||||
		sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm);
 | 
							sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm, recvfi.offs);
 | 
				
			||||||
		bstate->extraislast = false;
 | 
							bstate->extraislast = false;
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
@ -798,7 +799,7 @@ case BPMSG_FILE:             /* File information */
 | 
				
			|||||||
	        PROTO_ERROR("invalid mode for M_FILE");
 | 
						        PROTO_ERROR("invalid mode for M_FILE");
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if( bstate->extracmd[0] != -1 ) return 0;
 | 
					            if( bstate->extracmd[0] != (char)-1 ) return 0;
 | 
				
			||||||
	    switch(p_rx_fopen(bstate->pi, recvfi.fn, recvfi.sz, recvfi.tm, 0)) {
 | 
						    switch(p_rx_fopen(bstate->pi, recvfi.fn, recvfi.sz, recvfi.tm, 0)) {
 | 
				
			||||||
case 0:
 | 
					case 0:
 | 
				
			||||||
		if (bstate->pi->recv->bytes_skipped == recvfi.offs) {
 | 
							if (bstate->pi->recv->bytes_skipped == recvfi.offs) {
 | 
				
			||||||
@ -1051,7 +1052,7 @@ case BINKP_BLK_DATA:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if( n < 0 ) {
 | 
						if( n < 0 ) {
 | 
				
			||||||
	    log("error writing local file");
 | 
						    log("error writing local file");
 | 
				
			||||||
	    if( n == -2 ) {
 | 
						    if( n == (long int)-2 ) {
 | 
				
			||||||
		bstate->extracmd[0] = BPMSG_GOT;
 | 
							bstate->extracmd[0] = BPMSG_GOT;
 | 
				
			||||||
		sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
 | 
							sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
 | 
				
			||||||
							(long)bstate->pi->recv->mod_time);
 | 
												(long)bstate->pi->recv->mod_time);
 | 
				
			||||||
@ -1080,28 +1081,33 @@ case BINKP_BLK_DATA:
 | 
				
			|||||||
		p_rx_fclose(bstate->pi);
 | 
							p_rx_fclose(bstate->pi);
 | 
				
			||||||
		PROTO_ERROR("extra data for file")
 | 
							PROTO_ERROR("extra data for file")
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
	    else if( bstate->pi->recv->bytes_received == bstate->pi->recv->bytes_total ) {
 | 
						    else if( bstate->pi->recv->bytes_received == bstate->pi->recv->bytes_total ) 
 | 
				
			||||||
		DEB((D_24554, "receive completed"));
 | 
						    {
 | 
				
			||||||
		bstate->frs = frs_nothing;
 | 
								DEB((D_24554, "receive completed"));
 | 
				
			||||||
		bstate->pi->recv->status = FSTAT_SUCCESS;
 | 
								bstate->frs = frs_nothing;
 | 
				
			||||||
		if( !p_rx_fclose(bstate->pi) ) {
 | 
								bstate->pi->recv->status = FSTAT_SUCCESS;
 | 
				
			||||||
			bstate->extracmd[0] = BPMSG_GOT;
 | 
								if( !p_rx_fclose(bstate->pi) ) 
 | 
				
			||||||
			sprintf(bstate->extracmd+1, "%s %ld %ld",
 | 
								{
 | 
				
			||||||
					bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
 | 
									bstate->extracmd[0] = BPMSG_GOT;
 | 
				
			||||||
					(long)bstate->pi->recv->mod_time);
 | 
									sprintf(bstate->extracmd+1, "%s %ld %ld",
 | 
				
			||||||
			bstate->extraislast = false;
 | 
											bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
 | 
				
			||||||
			return 1;
 | 
											(long)bstate->pi->recv->mod_time);
 | 
				
			||||||
		}
 | 
									bstate->extraislast = false;
 | 
				
			||||||
		else {
 | 
									return 1;
 | 
				
			||||||
		    DEB((D_24554, "some error committing file"));
 | 
								}
 | 
				
			||||||
		    bstate->extracmd[0] = BPMSG_SKIP;
 | 
								else 
 | 
				
			||||||
		    sprintf(bstate->extracmd+1, "%s %ld %ld",
 | 
								{
 | 
				
			||||||
								bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
 | 
								    DEB((D_24554, "some error committing file"));
 | 
				
			||||||
								(long)bstate->pi->recv->mod_time);
 | 
								    bstate->extracmd[0] = BPMSG_SKIP;
 | 
				
			||||||
		    bstate->extraislast = false;
 | 
								    sprintf(bstate->extracmd+1, "%s %ld %ld",
 | 
				
			||||||
		    return 1;
 | 
														bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
 | 
				
			||||||
		}
 | 
														(long)bstate->pi->recv->mod_time);
 | 
				
			||||||
	    } else {
 | 
								    bstate->extraislast = false;
 | 
				
			||||||
 | 
								    return 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
						    } 
 | 
				
			||||||
 | 
						    else 
 | 
				
			||||||
 | 
						    {
 | 
				
			||||||
	        DEB((D_24554, "data block accepted"));
 | 
						        DEB((D_24554, "data block accepted"));
 | 
				
			||||||
	        return 1;
 | 
						        return 1;
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
 | 
				
			|||||||
@ -415,6 +415,7 @@ int p_tx_rewind(s_protinfo *pi, size_t pos)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void prot_traffic_update(s_traffic *traf, size_t size, int xtime, int type)
 | 
					void prot_traffic_update(s_traffic *traf, size_t size, int xtime, int type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						DEB((D_EVENT, "prot_common: Adding type %d with size %ld to stats", type, size));
 | 
				
			||||||
	if( type & TYPE_REQANSW )
 | 
						if( type & TYPE_REQANSW )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		traf->freqed_size += size;
 | 
							traf->freqed_size += size;
 | 
				
			||||||
@ -433,6 +434,10 @@ void prot_traffic_update(s_traffic *traf, size_t size, int xtime, int type)
 | 
				
			|||||||
		traf->arcmail_time += xtime;
 | 
							traf->arcmail_time += xtime;
 | 
				
			||||||
		traf->arcmail_num++;
 | 
							traf->arcmail_num++;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						else if( type & TYPE_TICFILE )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							traf->ticfile_num++;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		traf->files_size += size;
 | 
							traf->files_size += size;
 | 
				
			||||||
 | 
				
			|||||||
@ -22,8 +22,16 @@
 | 
				
			|||||||
int answ_system(e_session type, char *connstr, int inetd)
 | 
					int answ_system(e_session type, char *connstr, int inetd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TIO oldtio;
 | 
						TIO oldtio;
 | 
				
			||||||
	struct sockaddr_in client;
 | 
						union {
 | 
				
			||||||
 | 
					                struct sockaddr a;
 | 
				
			||||||
 | 
					                struct sockaddr_in in;
 | 
				
			||||||
 | 
					                struct sockaddr_in6 in6;
 | 
				
			||||||
 | 
					        } client;
 | 
				
			||||||
 | 
						//struct sockaddr_storage client;
 | 
				
			||||||
	int clientlen = sizeof(client);
 | 
						int clientlen = sizeof(client);
 | 
				
			||||||
 | 
						char clienthost[NI_MAXHOST];
 | 
				
			||||||
 | 
						char clientport[NI_MAXSERV];
 | 
				
			||||||
 | 
						int clientres = 0;
 | 
				
			||||||
	int rc = 0;
 | 
						int rc = 0;
 | 
				
			||||||
	char *p;
 | 
						char *p;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@ -74,18 +82,20 @@ int answ_system(e_session type, char *connstr, int inetd)
 | 
				
			|||||||
		log("Answering TCPIP call...");
 | 
							log("Answering TCPIP call...");
 | 
				
			||||||
		if( connstr && *connstr )
 | 
							if( connstr && *connstr )
 | 
				
			||||||
			state.connstr = (char*)xstrcpy(connstr);
 | 
								state.connstr = (char*)xstrcpy(connstr);
 | 
				
			||||||
		else if( getpeername(0, (struct sockaddr*)&client, &clientlen) == -1 )
 | 
					 | 
				
			||||||
			logerr("can't get client address");
 | 
					 | 
				
			||||||
		else 
 | 
							else 
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
#ifdef IPV6
 | 
								if(getpeername(0, &client.a, &clientlen)) 
 | 
				
			||||||
			>char addr_str[INET6_ADDRSTRLEN+1];
 | 
									log("sess_answ: can't detrmine socket client");
 | 
				
			||||||
			state.peername = (char*)xstrcpy(inet_ntop(AF_INET6, client.sin6_addr, addr_str, INET6_ADDRSTRLEN));
 | 
								clientres = getnameinfo( &client.a, clientlen,
 | 
				
			||||||
			state.peerport = (long)ntohs(client.sin6_port);
 | 
										clienthost, sizeof(clienthost), clientport, 
 | 
				
			||||||
#else
 | 
										sizeof(clientport), NI_NUMERICHOST | NI_NUMERICSERV);
 | 
				
			||||||
			state.peername = (char*)xstrcpy(inet_ntoa(client.sin_addr));
 | 
								if ( clientres == 0 )
 | 
				
			||||||
			state.peerport = (long)ntohs(client.sin_port);
 | 
								{
 | 
				
			||||||
#endif
 | 
									state.peername = (char*)xstrcpy(clienthost);
 | 
				
			||||||
 | 
									state.peerport = (long)atol(clientport);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									log("sess_answ: can't get client address: ", gai_strerror(clientres));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
				
			|||||||
@ -480,10 +480,15 @@ int call_system_tcpip(int callwith) // only TCPIP values
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	char abuf[BF_MAXADDRSTR+1];
 | 
						char abuf[BF_MAXADDRSTR+1];
 | 
				
			||||||
	int rc = BFERR_NOERROR;
 | 
						int rc = BFERR_NOERROR;
 | 
				
			||||||
	
 | 
						char * pbuf;
 | 
				
			||||||
 | 
						char * target;
 | 
				
			||||||
 | 
						int resflg;
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Set verbal line name to "tcpip" value
 | 
						 * Set verbal line name to "tcpip" value
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
 | 
						memset(abuf, '\0', BF_MAXADDRSTR+1);
 | 
				
			||||||
 | 
						target = xmalloc(1024);
 | 
				
			||||||
 | 
						memset(target, '\0', 1024);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	state.linename = xstrcpy("tcpip");
 | 
						state.linename = xstrcpy("tcpip");
 | 
				
			||||||
	state.inet = TRUE;
 | 
						state.inet = TRUE;
 | 
				
			||||||
@ -502,14 +507,17 @@ int call_system_tcpip(int callwith) // only TCPIP values
 | 
				
			|||||||
case CALL_TCPIP_BINKP:
 | 
					case CALL_TCPIP_BINKP:
 | 
				
			||||||
		state.tcpmode = TCPMODE_BINKP;
 | 
							state.tcpmode = TCPMODE_BINKP;
 | 
				
			||||||
		state.session = SESSION_BINKP;
 | 
							state.session = SESSION_BINKP;
 | 
				
			||||||
 | 
							target = xstrcpy("IBN");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
case CALL_TCPIP_IFCICO:
 | 
					case CALL_TCPIP_IFCICO:
 | 
				
			||||||
		state.tcpmode = TCPMODE_RAW;
 | 
							state.tcpmode = TCPMODE_RAW;
 | 
				
			||||||
		state.session = SESSION_UNKNOWN;
 | 
							state.session = SESSION_UNKNOWN;
 | 
				
			||||||
 | 
							target = xstrcpy("IFC");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
case CALL_TCPIP_TELNET:
 | 
					case CALL_TCPIP_TELNET:
 | 
				
			||||||
		state.tcpmode = TCPMODE_TELNET;
 | 
							state.tcpmode = TCPMODE_TELNET;
 | 
				
			||||||
		state.session = SESSION_UNKNOWN;
 | 
							state.session = SESSION_UNKNOWN;
 | 
				
			||||||
 | 
							target = xstrcpy("ITN");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
defalt:
 | 
					defalt:
 | 
				
			||||||
		log("invalid protocol for TCP/IP module");
 | 
							log("invalid protocol for TCP/IP module");
 | 
				
			||||||
@ -521,7 +529,44 @@ defalt:
 | 
				
			|||||||
		(state.node.name  && *state.node.name ) ? state.node.name  : "<none>",
 | 
							(state.node.name  && *state.node.name ) ? state.node.name  : "<none>",
 | 
				
			||||||
		(state.node.host && *state.node.host) ? state.node.host : "<none>");
 | 
							(state.node.host && *state.node.host) ? state.node.host : "<none>");
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( (rc = tcpip_connect(state.node.host, state.tcpmode)) == 0
 | 
						memset(abuf, '\0', BF_MAXADDRSTR+1);
 | 
				
			||||||
 | 
						pbuf = xmalloc(1024);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						resflg = nodelist_lookup_string(pbuf, 1024, state.node.addr);
 | 
				
			||||||
 | 
						if ( ! resflg ) 
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							char *p = strcasestr(pbuf, target);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if ( p ) 
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								target = strchr(p, ',');
 | 
				
			||||||
 | 
								if ( target ) target[0] = '\0';
 | 
				
			||||||
 | 
								target = strrchr(p, ':');
 | 
				
			||||||
 | 
								if ( target ) {
 | 
				
			||||||
 | 
									target++;
 | 
				
			||||||
 | 
									strcpy(abuf,target);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						free(pbuf);
 | 
				
			||||||
 | 
						pbuf = xstrcpy(state.node.host);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if ( ! resflg )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if ( abuf[0] != '\0' )
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								// port not empty
 | 
				
			||||||
 | 
								DEB((D_EVENT, "Modifying host address %s with port %s", pbuf, abuf));
 | 
				
			||||||
 | 
								pbuf = xstrcat(pbuf, ":");
 | 
				
			||||||
 | 
								pbuf = xstrcat(pbuf, abuf);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if( (rc = tcpip_connect(pbuf, state.tcpmode)) == 0
 | 
				
			||||||
	 && (rc = tcpip_init() == 0) )
 | 
						 && (rc = tcpip_init() == 0) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		TTYSTATUS(1);
 | 
							TTYSTATUS(1);
 | 
				
			||||||
@ -532,7 +577,7 @@ defalt:
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		rc = BFERR_CANT_CONNECT10;
 | 
							rc = BFERR_CANT_CONNECT10;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						free(pbuf);
 | 
				
			||||||
	return rc;
 | 
						return rc;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -543,7 +588,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
	char s[300];
 | 
						char s[300];
 | 
				
			||||||
	snprintf(s, 299, "bforce calling system %d:%d/%d.%d", addr.zone, addr.net, addr.node, addr.point );
 | 
						snprintf(s, 299, "bforce calling system %d:%d/%d.%d", addr.zone, addr.net, addr.node, addr.point );
 | 
				
			||||||
	log(s);
 | 
						log(s);
 | 
				
			||||||
	
 | 
						DEB((D_EVENT, s));
 | 
				
			||||||
	// find suitable way of connection and try to make session
 | 
						// find suitable way of connection and try to make session
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
        int rc = 0;
 | 
					        int rc = 0;
 | 
				
			||||||
@ -568,12 +613,13 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	state.listed    = state.node.listed;
 | 
						state.listed    = state.node.listed;
 | 
				
			||||||
 | 
						//DEB((D_EVENT, "Calling init, listed=%d", state.listed));
 | 
				
			||||||
	state.node.addr.domain[0] = '\0'; /* Discard domain for node address */
 | 
						state.node.addr.domain[0] = '\0'; /* Discard domain for node address */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 1. If call method specified in cmdline, do use it
 | 
						// 1. If call method specified in cmdline, do use it
 | 
				
			||||||
	// 2. If not, use nodelist data and overrides and call all available methods
 | 
						// 2. If not, use nodelist data and overrides and call all available methods
 | 
				
			||||||
	//    If override contains Phone or IP flags, ignore nodelist connect methods (but save INA if not overrided)
 | 
						//    If override contains Phone or IP flags, ignore nodelist connect methods (but save INA if not overrided)
 | 
				
			||||||
 | 
						DEB((D_EVENT, "Calling init, runmode=%d", opts->runmode));
 | 
				
			||||||
	// 1st - get all allowed call ways
 | 
						// 1st - get all allowed call ways
 | 
				
			||||||
	// 2nd - gather information reqired to call and remove unavailable ways (no info, node does not support)
 | 
						// 2nd - gather information reqired to call and remove unavailable ways (no info, node does not support)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -581,7 +627,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if( opts->runmode == MODE_CALL_DEFAULT )
 | 
						if( opts->runmode == MODE_CALL_DEFAULT )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		call_mayuse = CALL_MODEM | CALL_TCPIP_ANY;
 | 
							call_mustuse = CALL_MODEM | CALL_TCPIP_ANY;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if( opts->runmode == MODE_CALL_STDIO )
 | 
						else if( opts->runmode == MODE_CALL_STDIO )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -593,7 +639,14 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	else if( opts->runmode == MODE_CALL_IP )
 | 
						else if( opts->runmode == MODE_CALL_IP )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if( strcasecmp(opts->ipproto, "binkp") == 0 )
 | 
							DEB((D_EVENT, "Calling init, MODE_CALL_IP"));
 | 
				
			||||||
 | 
							if( !(opts->ipproto) ) // determine from nodelist/override
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								DEB((D_EVENT, "ipproto not set"));
 | 
				
			||||||
 | 
								call_mayuse = CALL_TCPIP_ANY;
 | 
				
			||||||
 | 
								call_mustuse = 0;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else if( strcasecmp(opts->ipproto, "binkp") == 0 )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			call_mustuse = CALL_TCPIP_BINKP;
 | 
								call_mustuse = CALL_TCPIP_BINKP;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -605,20 +658,17 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			call_mustuse = CALL_TCPIP_TELNET;
 | 
								call_mustuse = CALL_TCPIP_TELNET;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if( opts->ipproto == NULL ) // determine from nodelist/override
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			call_mayuse = CALL_TCPIP_ANY;
 | 
					 | 
				
			||||||
			call_mustuse = 0;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
								DEB((D_EVENT, "Unknown protocol %s", opts->ipproto));
 | 
				
			||||||
			log("Unknown protocol");
 | 
								log("Unknown protocol");
 | 
				
			||||||
			return -1;
 | 
								return -1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		log("Unknown protocol");
 | 
							DEB((D_EVENT, "Unknown runmode %d", opts->runmode));
 | 
				
			||||||
 | 
							log("Unknown runmode");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@ -627,9 +677,10 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
       //char s[300];
 | 
					       //char s[300];
 | 
				
			||||||
       //snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
 | 
					       //snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
 | 
				
			||||||
       //log(s);
 | 
					       //log(s);
 | 
				
			||||||
 | 
					       //DEB((D_EVENT, s));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( call_mayuse & CALL_MODEM )
 | 
						if( (call_mayuse & CALL_MODEM) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// 1. use phone from opts
 | 
							// 1. use phone from opts
 | 
				
			||||||
		// 2. use overrides
 | 
							// 2. use overrides
 | 
				
			||||||
@ -650,7 +701,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			log("bad phone, excluding modem");
 | 
								log("bad phone, excluding modem");
 | 
				
			||||||
			call_mayuse &= ~CALL_MODEM;
 | 
								call_mayuse &= ~CALL_MODEM;
 | 
				
			||||||
			if( call_mustuse & CALL_MODEM )
 | 
								if( !(call_mayuse) )
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				errmsg = "don't know phone number";
 | 
									errmsg = "don't know phone number";
 | 
				
			||||||
				gotoexit(BFERR_PHONE_UNKNOWN);
 | 
									gotoexit(BFERR_PHONE_UNKNOWN);
 | 
				
			||||||
@ -684,7 +735,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
				call_mayuse &= ~CALL_MODEM;
 | 
									call_mayuse &= ~CALL_MODEM;
 | 
				
			||||||
				log("bad worktime, excluding modem");
 | 
									log("bad worktime, excluding modem");
 | 
				
			||||||
				if( call_mustuse & CALL_MODEM )
 | 
									if( !(call_mayuse) )
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					errmsg = "not works now, try later";
 | 
										errmsg = "not works now, try later";
 | 
				
			||||||
					gotoexit(BFERR_NOTWORKING);
 | 
										gotoexit(BFERR_NOTWORKING);
 | 
				
			||||||
@ -693,9 +744,9 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//       snprintf(s, 299, "after phone check: may use %d must use %d", call_mayuse, call_mustuse);
 | 
					       //snprintf(s, 299, "after phone check: may use %d must use %d", call_mayuse, call_mustuse);
 | 
				
			||||||
//       log(s);
 | 
					       //log(s);
 | 
				
			||||||
 | 
						   //DEB((D_EVENT, s));
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Apply overrides to the node information
 | 
						 * Apply overrides to the node information
 | 
				
			||||||
	 */	
 | 
						 */	
 | 
				
			||||||
@ -714,7 +765,8 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	if( !(call_mustuse & CALL_TCPIP_BINKP) && (call_mayuse & CALL_TCPIP_BINKP) )
 | 
						if( !(call_mustuse & CALL_TCPIP_BINKP) && (call_mayuse & CALL_TCPIP_BINKP) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if( nodelist_checkflag(state.node.flags, "BINKP") != 0 && nodelist_checkflag(state.node.flags, "IBN") != 0 )
 | 
							//if( nodelist_checkflag(state.node.flags, "BINKP") != 0 && nodelist_checkflag(state.node.flags, "IBN") != 0 )
 | 
				
			||||||
 | 
							if( state.node.do_binkp == 0 )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			call_mayuse &= ~CALL_TCPIP_BINKP;
 | 
								call_mayuse &= ~CALL_TCPIP_BINKP;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -722,7 +774,8 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if( !(call_mustuse & CALL_TCPIP_IFCICO) && (call_mayuse & CALL_TCPIP_IFCICO) )
 | 
						if( !(call_mustuse & CALL_TCPIP_IFCICO) && (call_mayuse & CALL_TCPIP_IFCICO) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if( nodelist_checkflag(state.node.flags, "IFC") != 0 && nodelist_checkflag(state.node.flags, "IFC") != 0 )
 | 
							//if( nodelist_checkflag(state.node.flags, "IFC") != 0 && nodelist_checkflag(state.node.flags, "IFC") != 0 )
 | 
				
			||||||
 | 
							if( state.node.do_ifcico == 0 )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			call_mayuse &= ~CALL_TCPIP_IFCICO;
 | 
								call_mayuse &= ~CALL_TCPIP_IFCICO;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -730,7 +783,8 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if( !(call_mustuse & CALL_TCPIP_TELNET) && (call_mayuse & CALL_TCPIP_TELNET) )
 | 
						if( !(call_mustuse & CALL_TCPIP_TELNET) && (call_mayuse & CALL_TCPIP_TELNET) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if( nodelist_checkflag(state.node.flags, "TELN") != 0 && nodelist_checkflag(state.node.flags, "TLN") != 0 )
 | 
							//if( nodelist_checkflag(state.node.flags, "TELN") != 0 && nodelist_checkflag(state.node.flags, "TLN") != 0 )
 | 
				
			||||||
 | 
							if( state.node.do_telnet == 0 )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			call_mayuse &= ~CALL_TCPIP_TELNET;
 | 
								call_mayuse &= ~CALL_TCPIP_TELNET;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -746,7 +800,12 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
				state.override.sIpaddr, sizeof(state.node.host));
 | 
									state.override.sIpaddr, sizeof(state.node.host));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) ) {
 | 
						//DEB((D_EVENT, "Calling init, IPHOST", state.node.host));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// We have at least one protocol and not valid address - try to
 | 
				
			||||||
 | 
						// find INA with through Fidonet DNS
 | 
				
			||||||
 | 
						if( (call_mayuse & CALL_TCPIP_ANY) && !tcpip_isgood_host(state.node.host) ) 
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
	    char *fidodnszone = conf_string(cf_fidodnszone);
 | 
						    char *fidodnszone = conf_string(cf_fidodnszone);
 | 
				
			||||||
	    if (fidodnszone) {
 | 
						    if (fidodnszone) {
 | 
				
			||||||
	        if (addr.point) {
 | 
						        if (addr.point) {
 | 
				
			||||||
@ -761,17 +820,21 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
	    }
 | 
						    }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) )
 | 
						// We have no valid tcpip protocols OR not valid address
 | 
				
			||||||
 | 
						if( !(call_mayuse & CALL_TCPIP_ANY) || !tcpip_isgood_host(state.node.host) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		call_mayuse &= ~CALL_TCPIP_ANY;
 | 
							call_mayuse &= ~CALL_TCPIP_ANY;
 | 
				
			||||||
		log("bad host, exclude IP");
 | 
							log("bad host, exclude IP");
 | 
				
			||||||
		if( call_mustuse & CALL_TCPIP_ANY )
 | 
							DEB((D_EVENT, "bad host or proto -> exclude IP, mayuse=%d", call_mayuse));
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// If we had ONLY tcpip command - go out with error
 | 
				
			||||||
 | 
							if( !(call_mayuse) )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			errmsg = "don't know host name";
 | 
								errmsg = "Aborting, don't know host name";
 | 
				
			||||||
			gotoexit(BFERR_PHONE_UNKNOWN);
 | 
								gotoexit(BFERR_PHONE_UNKNOWN);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						DEB((D_EVENT,"sess_call: may use %d must use %d", call_mayuse, call_mustuse));
 | 
				
			||||||
//       snprintf(s, 299, "after IP check: may use %d must use %d", call_mayuse, call_mustuse);
 | 
					//       snprintf(s, 299, "after IP check: may use %d must use %d", call_mayuse, call_mustuse);
 | 
				
			||||||
//       log(s);
 | 
					//       log(s);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@ -808,28 +871,33 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
	// try allowed methods and break if rc == 0
 | 
						// try allowed methods and break if rc == 0
 | 
				
			||||||
	rc = -1;
 | 
						rc = -1;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( rc && call_mayuse & CALL_STDIO )
 | 
						if( rc && (call_mayuse & CALL_STDIO) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							DEB((D_EVENT,"sess_call: calling stdio"));
 | 
				
			||||||
		rc = call_system_quiet(opts->connect, opts->inetd);
 | 
							rc = call_system_quiet(opts->connect, opts->inetd);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( rc && call_mayuse & CALL_TCPIP_BINKP )
 | 
						if( rc && (call_mayuse & CALL_TCPIP_BINKP) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							DEB((D_EVENT,"sess_call: calling binkp"));
 | 
				
			||||||
		rc = call_system_tcpip(CALL_TCPIP_BINKP);
 | 
							rc = call_system_tcpip(CALL_TCPIP_BINKP);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( rc && call_mayuse & CALL_TCPIP_IFCICO )
 | 
						if( rc && (call_mayuse & CALL_TCPIP_IFCICO) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							DEB((D_EVENT,"sess_call: calling ifcico"));
 | 
				
			||||||
		rc = call_system_tcpip(CALL_TCPIP_IFCICO);
 | 
							rc = call_system_tcpip(CALL_TCPIP_IFCICO);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( rc && call_mayuse & CALL_TCPIP_TELNET )
 | 
						if( rc && (call_mayuse & CALL_TCPIP_TELNET) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							DEB((D_EVENT,"sess_call: calling telnet"));
 | 
				
			||||||
		rc = call_system_tcpip(CALL_TCPIP_TELNET);
 | 
							rc = call_system_tcpip(CALL_TCPIP_TELNET);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( rc && call_mayuse & CALL_MODEM )
 | 
						if( rc && (call_mayuse & CALL_MODEM) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							DEB((D_EVENT,"sess_call: calling MODEM"));
 | 
				
			||||||
		setproctitle("bforce calling %.32s, %.32s",
 | 
							setproctitle("bforce calling %.32s, %.32s",
 | 
				
			||||||
			ftn_addrstr(abuf, state.node.addr), state.node.phone);
 | 
								ftn_addrstr(abuf, state.node.addr), state.node.phone);
 | 
				
			||||||
		rc = -1;
 | 
							rc = -1;
 | 
				
			||||||
@ -850,6 +918,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		    if( port_lock(p_lockdir, state.modemport) == 0 ) /* Successfuly locked port */
 | 
							    if( port_lock(p_lockdir, state.modemport) == 0 ) /* Successfuly locked port */
 | 
				
			||||||
		    {
 | 
							    {
 | 
				
			||||||
 | 
									DEB((D_EVENT,"sess_call: call_system_modem running"));
 | 
				
			||||||
		    	rc = call_system_modem();
 | 
							    	rc = call_system_modem();
 | 
				
			||||||
		    	port_unlock(p_lockdir, state.modemport);
 | 
							    	port_unlock(p_lockdir, state.modemport);
 | 
				
			||||||
		    }
 | 
							    }
 | 
				
			||||||
 | 
				
			|||||||
@ -897,11 +897,20 @@ int session(void)
 | 
				
			|||||||
		p_log_txrxstat(&pi);
 | 
							p_log_txrxstat(&pi);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							// Protocol info - real info from protocol
 | 
				
			||||||
 | 
							DEB((D_EVENT,"sess_main: Pi stats> Net: %d, Arc: %d, Fil: %d, Tic: %d",
 | 
				
			||||||
 | 
								pi.traffic_rcvd.netmail_num, pi.traffic_rcvd.arcmail_num,
 | 
				
			||||||
 | 
								pi.traffic_rcvd.files_num, pi.traffic_rcvd.ticfile_num));
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// Session info - HANDSHAKE info for traffic
 | 
				
			||||||
 | 
							DEB((D_EVENT,"sess_main: Sess stats> Net: %d, Arc: %d, Fil: %d, Tic: %d",
 | 
				
			||||||
 | 
								state.traff_recv.netmail_num, state.traff_recv.arcmail_num,
 | 
				
			||||||
 | 
								state.traff_recv.files_num, state.traff_recv.ticfile_num));
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Raise flags if session incoming traffic was not empty
 | 
							 * Raise flags if session incoming traffic was not empty
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		if ( (p = conf_string(cf_incnet_flag)) )
 | 
							if ( (p = conf_string(cf_incnet_flag)) )
 | 
				
			||||||
			if (state.traff_recv.netmail_size > 0) {
 | 
								if (pi.traffic_rcvd.netmail_size > 0) {
 | 
				
			||||||
				DEB((D_EVENT, "Incoming netmail > 0, raising flag"));
 | 
									DEB((D_EVENT, "Incoming netmail > 0, raising flag"));
 | 
				
			||||||
				log("Raising flag for netmail in %s", p);
 | 
									log("Raising flag for netmail in %s", p);
 | 
				
			||||||
				fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
 | 
									fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
 | 
				
			||||||
@ -915,7 +924,7 @@ int session(void)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if ( (p = conf_string(cf_incarc_flag)) )
 | 
							if ( (p = conf_string(cf_incarc_flag)) )
 | 
				
			||||||
			if (state.traff_recv.arcmail_size > 0) {
 | 
								if (pi.traffic_rcvd.arcmail_size > 0) {
 | 
				
			||||||
				DEB((D_EVENT, "Incoming arcmail > 0, raising flag"));
 | 
									DEB((D_EVENT, "Incoming arcmail > 0, raising flag"));
 | 
				
			||||||
				log("Raising flag for arcmail in %s", p);
 | 
									log("Raising flag for arcmail in %s", p);
 | 
				
			||||||
				fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
 | 
									fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
 | 
				
			||||||
@ -928,6 +937,33 @@ int session(void)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							if ( (p = conf_string(cf_inctic_flag)) )
 | 
				
			||||||
 | 
								if (pi.traffic_rcvd.ticfile_num > 0) {
 | 
				
			||||||
 | 
									DEB((D_EVENT, "Incoming TIC files > 0, raising flag"));
 | 
				
			||||||
 | 
									log("Raising flag for TIC in %s", p);
 | 
				
			||||||
 | 
									fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
 | 
				
			||||||
 | 
									if (fd == -1) {
 | 
				
			||||||
 | 
										DEB((D_EVENT, "Error raising ticfiles flag"));
 | 
				
			||||||
 | 
										log("Error creating flag for ticfiles in %s", p);
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										/* all ok - closing file */
 | 
				
			||||||
 | 
										close(fd);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							if ( (p = conf_string(cf_incfile_flag)) )
 | 
				
			||||||
 | 
								if (pi.traffic_rcvd.files_size > 0) {
 | 
				
			||||||
 | 
									DEB((D_EVENT, "Incoming FILES > 0, raising flag"));
 | 
				
			||||||
 | 
									log("Raising flag for files in %s", p);
 | 
				
			||||||
 | 
									fd = open(p, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
 | 
				
			||||||
 | 
									if (fd == -1) {
 | 
				
			||||||
 | 
										DEB((D_EVENT, "Error raising files flag"));
 | 
				
			||||||
 | 
										log("Error creating flag for files in %s", p);
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										/* all ok - closing file */
 | 
				
			||||||
 | 
										close(fd);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Save session traffic before deiniting
 | 
							 * Save session traffic before deiniting
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
 | 
				
			|||||||
@ -189,7 +189,8 @@ static int ftn_addrparse_fido(s_faddr *addr, const char *s, bool wildcard)
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		strnxcpy(addr->domain, string_printable(p), sizeof(addr->domain));
 | 
							strnxcpy(addr->domain, string_printable(p), sizeof(addr->domain));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						DEB((D_INFO,"u_ftn: Parsed ftn address z:%d, net:%d, node:%d, point:%d",
 | 
				
			||||||
 | 
							addr->zone, addr->net, addr->node, addr->point));
 | 
				
			||||||
	return badaddr;
 | 
						return badaddr;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -326,6 +327,7 @@ int ftn_addrparse(s_faddr *addr, const char *s, bool wildcard)
 | 
				
			|||||||
		addr->node  = DEFAULT_NODE;
 | 
							addr->node  = DEFAULT_NODE;
 | 
				
			||||||
		addr->point = 0;
 | 
							addr->point = 0;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							DEB((D_INFO, "u_ftn: parsing ftnaddr %s", s));
 | 
				
			||||||
		if( addr->inetform )
 | 
							if( addr->inetform )
 | 
				
			||||||
			badaddr = ftn_addrparse_inet(addr, s, wildcard);
 | 
								badaddr = ftn_addrparse_inet(addr, s, wildcard);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
 | 
				
			|||||||
@ -81,6 +81,7 @@ void *xrealloc(void *buf, size_t size)
 | 
				
			|||||||
	else if( (tmp = (char*)(buf ? realloc(buf, size) : malloc(size))) == NULL )
 | 
						else if( (tmp = (char*)(buf ? realloc(buf, size) : malloc(size))) == NULL )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		log("failed to reallocate %ld bytes -> abort", size);
 | 
							log("failed to reallocate %ld bytes -> abort", size);
 | 
				
			||||||
 | 
							if( buf ) free(buf);
 | 
				
			||||||
		abort();
 | 
							abort();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
				
			|||||||
@ -127,7 +127,7 @@ static int nodelist_makeindex(s_nodelist *nlp, s_faddr addr)
 | 
				
			|||||||
			switch(keyword) {
 | 
								switch(keyword) {
 | 
				
			||||||
			case KEYWORD_ZONE:
 | 
								case KEYWORD_ZONE:
 | 
				
			||||||
				bni.zone  = value;
 | 
									bni.zone  = value;
 | 
				
			||||||
				bni.net   = 0;
 | 
									bni.net   = value; // zxalexis
 | 
				
			||||||
				bni.node  = 0;
 | 
									bni.node  = 0;
 | 
				
			||||||
				bni.point = 0;
 | 
									bni.point = 0;
 | 
				
			||||||
				bni.hub   = 0;
 | 
									bni.hub   = 0;
 | 
				
			||||||
 | 
				
			|||||||
@ -195,6 +195,8 @@ typedef enum {
 | 
				
			|||||||
	cf_freq_srif_command,
 | 
						cf_freq_srif_command,
 | 
				
			||||||
	cf_incnet_flag,
 | 
						cf_incnet_flag,
 | 
				
			||||||
	cf_incarc_flag,
 | 
						cf_incarc_flag,
 | 
				
			||||||
 | 
						cf_inctic_flag,
 | 
				
			||||||
 | 
						cf_incfile_flag,
 | 
				
			||||||
	cf_hide_our_aka,
 | 
						cf_hide_our_aka,
 | 
				
			||||||
	cf_history_file,
 | 
						cf_history_file,
 | 
				
			||||||
	cf_hydra_options,
 | 
						cf_hydra_options,
 | 
				
			||||||
 | 
				
			|||||||
@ -44,6 +44,7 @@ typedef struct traffic {
 | 
				
			|||||||
	int    freqed_num;
 | 
						int    freqed_num;
 | 
				
			||||||
	int    freqed_time;
 | 
						int    freqed_time;
 | 
				
			||||||
	size_t freqed_size;
 | 
						size_t freqed_size;
 | 
				
			||||||
 | 
						int    ticfile_num;
 | 
				
			||||||
} s_traffic;
 | 
					} s_traffic;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user