Added callout hiddenline rotation and multiply INA
This commit is contained in:
parent
72f46f357d
commit
0999c65b1a
16
CHANGES
16
CHANGES
@ -286,3 +286,19 @@ Alexey Khromov (zx@zxalexis.ru)
|
||||
+ 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
|
||||
|
14
debian/changelog
vendored
14
debian/changelog
vendored
@ -1,3 +1,17 @@
|
||||
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
|
||||
|
@ -2,7 +2,7 @@
|
||||
.SH NAME
|
||||
Bnlookup \- Nodelist search tool for bforce
|
||||
.SH SYNOPSYS
|
||||
\fBnlookup [-rh] [-C\fIconfig\fB]\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
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: Bforce, Fidonet mailer
|
||||
Name: bforce
|
||||
Version: 0.26.2
|
||||
Release: %{_vendor}.1
|
||||
Version: 0.27
|
||||
Release: %{_vendor}1
|
||||
Copyright: GPL
|
||||
Group: Fidonet/mailer
|
||||
Source0: bforce-%{version}.tar.gz
|
||||
|
@ -1 +1 @@
|
||||
0.26.2
|
||||
0.27
|
||||
|
@ -137,7 +137,7 @@ elemexp : INCOMING
|
||||
}
|
||||
| FLAG flagstring
|
||||
{
|
||||
$$ = $2;
|
||||
$$ = $2; //-V1037
|
||||
}
|
||||
| CONNSPEED AROP NUMBER
|
||||
{
|
||||
@ -163,7 +163,7 @@ elemexp : INCOMING
|
||||
}
|
||||
| TIME timestring
|
||||
{
|
||||
$$ = $2;
|
||||
$$ = $2; //-V1037
|
||||
}
|
||||
| EXEC TEXT
|
||||
{
|
||||
@ -194,7 +194,7 @@ flagstring : TEXT
|
||||
}
|
||||
| TEXT COMMA flagstring
|
||||
{
|
||||
$$ = expr_check_logic($1, OR, $3);
|
||||
$$ = expr_check_logic($1, OR, $3); //-V1037
|
||||
}
|
||||
;
|
||||
timestring : TEXT
|
||||
@ -205,7 +205,7 @@ timestring : TEXT
|
||||
}
|
||||
| TEXT COMMA timestring
|
||||
{
|
||||
$$ = expr_check_logic($1, OR, $3);
|
||||
$$ = expr_check_logic($1, OR, $3); //-V1037
|
||||
}
|
||||
;
|
||||
%%
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "logger.h"
|
||||
#include "util.h"
|
||||
#include "io.h"
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#define DEFAULT_PORT 60179 /* Birthday .. mother fucker :) */
|
||||
|
||||
@ -39,10 +40,13 @@ static RETSIGTYPE tcpip_brokenpipe(int sig)
|
||||
static int tcpip_connect2(struct addrinfo *ai)
|
||||
{
|
||||
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;
|
||||
|
||||
|
||||
for (rai = ai; rai != NULL; rai = rai->ai_next)
|
||||
{
|
||||
if (getnameinfo(rai->ai_addr, rai->ai_addrlen, hbuf, sizeof(hbuf), sbuf,
|
||||
@ -57,23 +61,32 @@ static int tcpip_connect2(struct addrinfo *ai)
|
||||
}
|
||||
else
|
||||
{
|
||||
DEB((D_INFO, "tcpip_connect2: socket opened - breaking"));
|
||||
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);
|
||||
} else
|
||||
fd = -1;
|
||||
} else {
|
||||
DEB((D_INFO, "tcpip_connect2: connect"));
|
||||
connected = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEB((D_INFO, "tcpip_connect2: socket not opened - returning"));
|
||||
hbuf[0]='\0';
|
||||
sbuf[0]='\0';
|
||||
if (!connected) {
|
||||
DEB((D_INFO, "tcpip_connect2: socket not opened - returning"));
|
||||
|
||||
}
|
||||
}
|
||||
DEB((D_INFO, "tcpip_connect2: socket success: %d", fd));
|
||||
if (fd < 0 )
|
||||
DEB((D_INFO, "tcpip_connect2: socket: %d", fd));
|
||||
if ((fd < 0) || !connected)
|
||||
{
|
||||
DEB((D_INFO, "tcpip_connect2: can't create socket"));
|
||||
DEB((D_INFO, "tcpip_connect2: can't create socket and connect"));
|
||||
logerr("can't create socket");
|
||||
return(1);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ int nodelist_checkflag(const char *nodeflags, const char *flag)
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -387,7 +387,7 @@ int nodelist_parsehiddenina(s_node *node,s_override *ov) {
|
||||
if( *(p+flaglen) == 0 || *(p+flaglen) == ',' )
|
||||
{
|
||||
// empty flag
|
||||
strncpy(tmp, p,'\0');
|
||||
memset(tmp, '\0', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -397,10 +397,11 @@ int nodelist_parsehiddenina(s_node *node,s_override *ov) {
|
||||
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;
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -133,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;
|
||||
@ -390,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 )
|
||||
{
|
||||
@ -648,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;
|
||||
|
||||
|
@ -591,7 +591,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
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];
|
||||
@ -599,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;
|
||||
@ -613,6 +615,32 @@ 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 */
|
||||
@ -640,7 +668,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
}
|
||||
else if( opts->runmode == MODE_CALL_IP )
|
||||
{
|
||||
DEB((D_EVENT, "Calling init, MODE_CALL_IP"));
|
||||
DEB((D_EVENT, "sess_call: MODE_CALL_IP - from cli"));
|
||||
if( !(opts->ipproto) ) // determine from nodelist/override
|
||||
{
|
||||
DEB((D_EVENT, "ipproto not set"));
|
||||
@ -676,9 +704,9 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
call_mayuse |= call_mustuse; // it simplifies logics: all required is allowed
|
||||
|
||||
//char s[300];
|
||||
//snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
|
||||
snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
|
||||
//log(s);
|
||||
//DEB((D_EVENT, s));
|
||||
DEB((D_EVENT, s));
|
||||
|
||||
|
||||
if( (call_mayuse & CALL_MODEM) )
|
||||
@ -691,16 +719,17 @@ 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_mayuse) )
|
||||
{
|
||||
@ -749,14 +778,14 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
|
||||
//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
|
||||
@ -764,44 +793,50 @@ 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));
|
||||
//}
|
||||
|
||||
//DEB((D_EVENT, "Calling init, IPHOST", 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
|
||||
@ -871,31 +906,129 @@ 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
|
||||
|
||||
|
||||
//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"));
|
||||
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) )
|
||||
{
|
||||
DEB((D_EVENT,"sess_call: calling 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) )
|
||||
{
|
||||
DEB((D_EVENT,"sess_call: calling 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) )
|
||||
{
|
||||
DEB((D_EVENT,"sess_call: calling 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 (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"));
|
||||
@ -932,8 +1065,55 @@ 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 )
|
||||
{
|
||||
log("no connection effort was successful");
|
||||
|
@ -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;
|
||||
|
@ -60,7 +60,11 @@ char *xstrcpy(const char *src)
|
||||
return NULL;
|
||||
|
||||
tmp = xmalloc(strlen(src)+1);
|
||||
strcpy(tmp, src);
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
else
|
||||
strcpy(tmp, src);
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
@ -85,15 +89,16 @@ 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);
|
||||
free(src);
|
||||
} else
|
||||
*tmp = '\0';
|
||||
|
||||
if( src )
|
||||
{
|
||||
strcpy(tmp, src);
|
||||
free(src);
|
||||
} else
|
||||
*tmp = '\0';
|
||||
|
||||
strcat(tmp, add);
|
||||
strcat(tmp, add);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
@ -676,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);
|
||||
|
||||
@ -689,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 )
|
||||
@ -842,18 +851,19 @@ char *string_concat(const char *str, ...)
|
||||
va_end(args);
|
||||
|
||||
yield = xmalloc(yield_len + 1);
|
||||
strncpy(yield, str, yield_len);
|
||||
yield[yield_len] = '\0';
|
||||
yield_ptr = yield + strlen(yield);
|
||||
if (yield) {
|
||||
strncpy(yield, str, yield_len);
|
||||
yield[yield_len] = '\0';
|
||||
yield_ptr = yield + strlen(yield);
|
||||
|
||||
va_start(args, str);
|
||||
while( (p = va_arg(args, char *)) )
|
||||
{
|
||||
strcpy(yield_ptr, p);
|
||||
yield_ptr += strlen(p);
|
||||
va_start(args, str);
|
||||
while( (p = va_arg(args, char *)) )
|
||||
{
|
||||
strcpy(yield_ptr, p);
|
||||
yield_ptr += strlen(p);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
return yield;
|
||||
}
|
||||
|
||||
|
@ -70,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 )
|
||||
@ -214,7 +214,7 @@ void print_calltable(s_faddr addr){
|
||||
// Let's print this table
|
||||
// begin with HOST itself
|
||||
ln = 0;
|
||||
if (nnode.host) {
|
||||
if (nnode.host[0]) {
|
||||
tmphost = nnode.host;
|
||||
}
|
||||
if (!nodelist_checkflag(nnode.flags, "IBN")) {
|
||||
@ -253,7 +253,7 @@ void print_calltable(s_faddr addr){
|
||||
}
|
||||
|
||||
// Calltable for pstn
|
||||
if (nnode.phone && check_phone(nnode.phone) ) {
|
||||
if (nnode.phone[0] && check_phone(nnode.phone) ) {
|
||||
tmpphone = nnode.phone;
|
||||
ln +=1;
|
||||
printf ("%5d. PSTN %s\n", ln, tmpphone);
|
||||
|
@ -3,7 +3,7 @@ dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
#AC_INIT(bforce/bforce.c)
|
||||
AC_INIT([bforce],[0.26.2],[zx@zxalexis.ru])
|
||||
AC_INIT([bforce],[0.27],[zx@zxalexis.ru])
|
||||
AC_CONFIG_HEADER(include/config.h)
|
||||
AC_CANONICAL_SYSTEM
|
||||
dnl # Minimum Autoconf version required.
|
||||
|
@ -185,6 +185,6 @@ int nodelist_lookup_string(char *buffer, size_t buflen, s_faddr addr);
|
||||
int nodelist_lookup(s_node *node, s_faddr addr);
|
||||
void nodelist_initnode(s_node *node, s_faddr addr);
|
||||
int nodelist_parsehiddenina(s_node *node, s_override *ov);
|
||||
|
||||
int nodelist_flagvalue(const char *nodeflags, const char *flag, char *res);
|
||||
|
||||
#endif /* _NODELIST_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user