moved address lists to state variable

master
Sergey Dorofeev 13 years ago
parent 1aff894fc3
commit 3e9e152054

@ -68,8 +68,7 @@ int req_createsrif(char *sname, char *req, char *rsp)
else
fprintf(fp, "Sysop SysOp\n");
if( state.handshake && state.handshake->remote_address
&& (aptr = state.handshake->remote_address(state.handshake)) )
if( aptr = session_1remote_address() )
fprintf(fp, "AKA %s\n", ftn_addrstr(abuf, *aptr));
else
return -1;

@ -73,7 +73,7 @@ int sendstr(int s, const char *buf) {
void netspool_start(s_netspool_state *state, const char *host, const char *port, const char *address, const char *password)
void netspool_start(s_netspool_state *state, const char *host, const char *port, const char *addresses, const char *password)
{
int s, r;
struct addrinfo hint;
@ -126,9 +126,12 @@ void netspool_start(s_netspool_state *state, const char *host, const char *port,
if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; }
//puts(strbuf); -- hello from remote
snprintf(strbuf, STRBUF, "ADDRESS %s", address);
r = sendstr(s, strbuf);
if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; }
while (*addresses) { // stop when zero length string under pointer
snprintf(strbuf, STRBUF, "ADDRESS %s", addresses);
r = sendstr(s, strbuf);
if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; }
addresses += strlen(addresses)+1; // go to next string
}
snprintf(strbuf, STRBUF, "PASSWORD %s", password);
r = sendstr(s, strbuf);

@ -61,7 +61,7 @@ typedef struct {
int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned short *block_length);
int binkp_doreceiveblock(s_binkp_state *bstate, char *buf, int block_type, unsigned short block_length);
void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer);
void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer);
void binkp_process_ADR(char *buffer);
int binkp_loop(s_binkp_state *bstate) {
unsigned char readbuf[BINKP_HEADER+BINKP_MAXBLOCK+1];
@ -419,20 +419,20 @@ case 2:
buf[0] = BPMSG_ADR;
wr_pos = 1;
int i;
for( i = 0; i < bstate->local_data->anum; i++ )
for( i = 0; i < state.n_localaddr; i++ )
{
if (i) wr_pos += sprintf(buf+wr_pos, " ");
if (bstate->local_data->addrs[i].addr.point) {
if (state.localaddrs[i].addr.point) {
wr_pos += sprintf(buf+wr_pos, "%d:%d/%d.%d@%s",
bstate->local_data->addrs[i].addr.zone, bstate->local_data->addrs[i].addr.net,
bstate->local_data->addrs[i].addr.node, bstate->local_data->addrs[i].addr.point,
bstate->local_data->addrs[i].addr.domain);
state.localaddrs[i].addr.zone, state.localaddrs[i].addr.net,
state.localaddrs[i].addr.node, state.localaddrs[i].addr.point,
state.localaddrs[i].addr.domain);
}
else {
wr_pos += sprintf(buf+wr_pos, "%d:%d/%d@%s",
bstate->local_data->addrs[i].addr.zone, bstate->local_data->addrs[i].addr.net,
bstate->local_data->addrs[i].addr.node,
bstate->local_data->addrs[i].addr.domain);
state.localaddrs[i].addr.zone, state.localaddrs[i].addr.net,
state.localaddrs[i].addr.node,
state.localaddrs[i].addr.domain);
}
}
*block_type = BINKP_BLK_CMD;
@ -635,9 +635,9 @@ case BPMSG_ADR: /* List of addresses */
return -1;
}
if( bstate->extracmd[0] !=-1 ) return 0; // suspend !!!
binkp_process_ADR(bstate->remote_data, buf+1);
binkp_process_ADR(buf+1);
if( !bstate->remote_data->anum ) {
if( !state.n_remoteaddr ) {
log("error: remote did not supplied any addresses");
if( bstate->extracmd[0] !=-1 ) return 0; // suspend
bstate->extracmd[0] = BPMSG_BSY;
@ -653,9 +653,9 @@ case BPMSG_ADR: /* List of addresses */
bstate->extraislast = false;
sprintf(bstate->extracmd+1,"OPT MB");
s_override ovr;
for(i = 0; i < bstate->remote_data->anum; i++) {
for(i = 0; i < state.n_remoteaddr; i++) {
ovr.sFlags = "";
override_get (&ovr, bstate->remote_data->addrs[i].addr, 0);
override_get (&ovr, state.remoteaddrs[i].addr, 0);
if (nodelist_checkflag (ovr.sFlags, "NR")==0) {
strcat (bstate->extracmd+1, " NR");
break;
@ -666,7 +666,7 @@ case BPMSG_ADR: /* List of addresses */
if (bstate->mode == bmode_outgoing_handshake) {
// check that remote has the address we call
if( session_addrs_check_genuine(bstate->remote_data->addrs, bstate->remote_data->anum,
if( session_addrs_check_genuine(state.remoteaddrs, state.n_remoteaddr,
state.node.addr) ) {
log("error: remote does not have the called address");
bstate->extracmd[0] = BPMSG_ERR;
@ -678,7 +678,7 @@ case BPMSG_ADR: /* List of addresses */
strncpy(bstate->remote_data->passwd, bstate->local_data->passwd, BINKP_MAXPASSWD);
bstate->remote_data->passwd[BINKP_MAXPASSWD] = '\0';
if( session_addrs_check(bstate->remote_data->addrs, bstate->remote_data->anum,
if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr,
bstate->remote_data->passwd, NULL, 0) ) {
log("error: Security violation");
bstate->extracmd[0] = BPMSG_ERR;
@ -715,7 +715,7 @@ case BPMSG_PWD: /* Session password */
return 1;
}
// lock addresses
if( session_addrs_lock(bstate->remote_data->addrs, bstate->remote_data->anum) ) {
if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) ) {
log("error locking addresses of the remote");
if( bstate->extracmd[0] !=-1 ) return 0; // suspend if extra is occupied
bstate->extracmd[0] = BPMSG_BSY;
@ -815,7 +815,7 @@ case BPMSG_OK: /* Password was acknowleged (data ignored) */
log("unexpected M_OK");
return -1;
}
if (session_addrs_lock(bstate->remote_data->addrs, bstate->remote_data->anum)) {
if (session_addrs_lock(state.remoteaddrs, state.n_remoteaddr)) {
log("error: unable to lock");
if (bstate->extracmd[0]!=-1) return 0;
bstate->extracmd[0] = BPMSG_BSY;
@ -1148,7 +1148,7 @@ void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer)
log("BinkP NUL: \"%s\"", string_printable(buffer)); // NUL cannot be invalid as it is optional info
}
void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer)
void binkp_process_ADR(char *buffer)
{
s_faddr addr;
char *p, *q;
@ -1158,7 +1158,7 @@ void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer)
if( ftn_addrparse(&addr, p, FALSE) )
log("BinkP got unparsable address \"%s\"", string_printable(p));
else
session_addrs_add(&remote_data->addrs, &remote_data->anum, addr);
session_addrs_add(&state.remoteaddrs, &state.n_remoteaddr, addr);
}
}
@ -1167,19 +1167,19 @@ int binkp_auth_incoming(s_binkp_sysinfo *remote_data)
if( remote_data->challenge_length > 0
&& strncmp(remote_data->passwd, "CRAM-MD5-", 9) == 0 )
{
log("md5 auth addrs %s", remote_data->addrs);
log("md5 auth anum %d", remote_data->anum);
log("md5 auth passwd %s", remote_data->passwd + 9);
log("md5 auth challenge %s", remote_data->challenge);
log("md5 auth challenge len %d", remote_data->challenge_length);
return session_addrs_check(remote_data->addrs,
remote_data->anum,
//log("md5 auth addrs %s", remote_data->addrs);
//log("md5 auth anum %d", remote_data->anum);
//log("md5 auth passwd %s", remote_data->passwd + 9);
//log("md5 auth challenge %s", remote_data->challenge);
//log("md5 auth challenge len %d", remote_data->challenge_length);
return session_addrs_check(state.remoteaddrs,
state.n_remoteaddr,
remote_data->passwd + 9,
remote_data->challenge,
remote_data->challenge_length);
}
log("plain-text auth");
return session_addrs_check(remote_data->addrs, remote_data->anum,
return session_addrs_check(state.remoteaddrs, state.n_remoteaddr,
remote_data->passwd, NULL, 0);
}

@ -48,7 +48,7 @@ s_handshake_protocol handshake_protocol_binkp = {
binkp_incoming2,
binkp_outgoing2,
/* Section 2 */
binkp_remote_address,
// binkp_remote_address,
binkp_remote_password,
binkp_remote_sysop_name,
binkp_remote_system_name,
@ -58,7 +58,7 @@ s_handshake_protocol handshake_protocol_binkp = {
binkp_remote_mailer,
NULL,
/* Section 3 */
binkp_local_address,
// binkp_local_address,
binkp_local_password
};
@ -113,9 +113,9 @@ int binkp_incoming2(s_handshake_protocol *THIS)
rc = binkp_incoming(local_data, remote_data);
binkp_log_sysinfo(remote_data);
if( remote_data->anum > 0 )
if( state.n_remoteaddr > 0 )
{
session_remote_lookup(remote_data->addrs, remote_data->anum);
session_remote_lookup(state.remoteaddrs, state.n_remoteaddr);
session_remote_log_status();
binkp_log_options(remote_data);
}
@ -125,8 +125,8 @@ int binkp_incoming2(s_handshake_protocol *THIS)
/*
* Create mail/files queue
*/
session_create_files_queue(remote_data->addrs,
remote_data->anum);
session_create_files_queue(state.remoteaddrs,
state.n_remoteaddr);
session_set_send_options();
session_set_inbound();
session_set_freqs_status();
@ -155,9 +155,9 @@ int binkp_outgoing2(s_handshake_protocol *THIS)
rc = binkp_outgoing(local_data, remote_data);
binkp_log_sysinfo(remote_data);
if( remote_data->anum > 0 )
if( state.n_remoteaddr > 0 )
{
session_remote_lookup(remote_data->addrs, remote_data->anum);
session_remote_lookup(state.remoteaddrs, state.n_remoteaddr);
session_remote_log_status();
binkp_log_options(remote_data);
}
@ -167,8 +167,7 @@ int binkp_outgoing2(s_handshake_protocol *THIS)
/*
* Create mail/files queue
*/
session_create_files_queue(remote_data->addrs,
remote_data->anum);
session_create_files_queue(state.remoteaddrs, state.n_remoteaddr);
session_set_send_options();
session_set_inbound();
}
@ -176,7 +175,7 @@ int binkp_outgoing2(s_handshake_protocol *THIS)
return rc;
}
s_faddr *binkp_remote_address(s_handshake_protocol *THIS)
/*s_faddr *binkp_remote_address(s_handshake_protocol *THIS)
{
ASSERT(THIS);
ASSERT(THIS->remote_data);
@ -185,7 +184,7 @@ s_faddr *binkp_remote_address(s_handshake_protocol *THIS)
return &((s_binkp_sysinfo *)THIS->remote_data)->addrs[0].addr;
return NULL;
}
} */
char *binkp_remote_password(s_handshake_protocol *THIS)
{
@ -264,7 +263,7 @@ char *binkp_remote_mailer(s_handshake_protocol *THIS)
return NULL;
}
s_faddr *binkp_local_address(s_handshake_protocol *THIS)
/*s_faddr *binkp_local_address(s_handshake_protocol *THIS)
{
ASSERT(THIS);
ASSERT(THIS->local_data);
@ -273,7 +272,7 @@ s_faddr *binkp_local_address(s_handshake_protocol *THIS)
return &((s_binkp_sysinfo *)THIS->local_data)->addrs[0].addr;
return NULL;
}
} */
char *binkp_local_password(s_handshake_protocol *THIS)
{

@ -146,11 +146,9 @@ void binkp_log_sysinfo(s_binkp_sysinfo *binkp)
int i;
char abuf[BF_MAXADDRSTR+1];
if( binkp->anum )
for( i = 0; i < binkp->anum; i++ )
{
log(" Address : %s", ftn_addrstr(abuf, binkp->addrs[i].addr));
}
for( i = 0; i < state.n_remoteaddr; i++ ) {
log(" Address : %s", ftn_addrstr(abuf, state.remoteaddrs[i].addr));
}
if( *binkp->systname && *binkp->phone )
log(" System : %s (%s)",
@ -220,25 +218,21 @@ void binkp_set_sysinfo(s_binkp_sysinfo *binkp, s_faddr *remote_addr, bool caller
const char *p_flags = conf_string(cf_flags);
/* free previously allocated memory */
if( binkp->addrs )
free(binkp->addrs);
// if( binkp->addrs )
// free(binkp->addrs);
memset(binkp, '\0', sizeof(s_binkp_sysinfo));
/* Set best primary address */
if( remote_addr )
{
if(remote_addr) {
primary = session_get_bestaka(*remote_addr);
/* Add primary address */
if( primary )
session_addrs_add(&binkp->addrs, &binkp->anum, *primary);
if (primary) session_addrs_add(&state.localaddrs, &state.n_localaddr, *primary);
}
/* Add other AKAs */
for( addr_ptr = conf_first(cf_address); addr_ptr;
addr_ptr = conf_next(addr_ptr) )
{
for( addr_ptr = conf_first(cf_address); addr_ptr; addr_ptr = conf_next(addr_ptr) ) {
for( hide_ptr = conf_first(cf_hide_our_aka); hide_ptr;
hide_ptr = conf_next(hide_ptr) )
{
@ -247,12 +241,11 @@ void binkp_set_sysinfo(s_binkp_sysinfo *binkp, s_faddr *remote_addr, bool caller
}
if( !hide_ptr && primary != &addr_ptr->d.falist.addr )
session_addrs_add(&binkp->addrs, &binkp->anum,
session_addrs_add(&state.localaddrs, &state.n_localaddr,
addr_ptr->d.falist.addr);
}
if( binkp->anum == 0 )
log("warning: no addresses will be presented to remote");
if (state.n_localaddr == 0) log("warning: no addresses will be presented to remote");
/* session password */
if( caller )

@ -41,12 +41,13 @@ const char *Protocols[] =
* Zero value on success and non-zero if nothing to send
*/
static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_filehint *hint)
static int prot_get_next_file(s_filelist **dest, s_protinfo *pi)
{
log("prot_get_next_file"); // %s %d", hint->fn, hint->sz);
s_filelist *ptrl = NULL;
s_filelist *best = NULL;
s_fsqueue *q = &state.queue;
s_filehint *hint = NULL; // M_GET hinting does not work good here as it spec net_name and it is unknown here (especially for PKTs)
*dest = NULL;
@ -116,24 +117,48 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_filehint *hin
/*log("netspool next file");*/
if(state.netspool.state == NS_NOTINIT) {
/*log("new netspool connection");*/
char password[100];
char address[300];
#define ADDRBUF 3000
#define SMALLBUF 128
char password[SMALLBUF];
char address[SMALLBUF];
char addresses[ADDRBUF];
int i, pos, alen;
char *host = conf_string(cf_netspool_host);
char *port = conf_string(cf_netspool_port);
if(host==NULL) {
//log("netspool is not configured");
state.netspool.state = NS_UNCONF;
} else {
snprintf(address, 299, state.node.addr.point? "%d:%d/%d.%d": "%d:%d/%d",
state.node.addr.zone, state.node.addr.net,
state.node.addr.node, state.node.addr.point);
if (state.n_remoteaddr==0) {
log("cannot start netspool: list of remote addresses has zero length");
return -1;
}
for(i=0, pos=0; i<state.n_remoteaddr; i++) {
alen=snprintf(address, SMALLBUF, state.remoteaddrs[i].addr.point? "%d:%d/%d.%d": "%d:%d/%d",
state.remoteaddrs[i].addr.zone, state.remoteaddrs[i].addr.net,
state.remoteaddrs[i].addr.node, state.remoteaddrs[i].addr.point);
if (!state.remoteaddrs[i].good) {
log("ignoring addr %s", address);
continue;
}
if (pos+alen+1 > ADDRBUF-1) { // space for zero length string as end marker
log("no buffer space for address %s", address);
break;
}
log("add address %s", address);
memcpy (addresses+pos, address, alen);
pos += alen;
addresses[pos++] = 0;
}
addresses[pos++] = 0;
if(state.protected) {
session_get_password(state.node.addr, password, 100);
session_get_password(state.remoteaddrs[0].addr, password, SMALLBUF);
} else {
password[0] = 0;
}
log("netspool start %s %s %s (pwd)", host, port, address);
netspool_start(&state.netspool, host, port, address, password);
log("netspool start %s %s", host, port);
netspool_start(&state.netspool, host, port, addresses, password);
}
}
@ -257,7 +282,7 @@ int p_tx_fopen(s_protinfo *pi, s_filehint *hint)
}
get_next_file:
if( prot_get_next_file(&ptrl, pi, hint) ) {
if( prot_get_next_file(&ptrl, pi) ) {
log("no next file");
return 1;
}

@ -610,7 +610,7 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc,
const char *p_emsifr = conf_string(cf_emsi_FR_time);
/* free previously allocated memory */
if( emsi->addrs ) free(emsi->addrs);
// if( emsi->addrs ) free(emsi->addrs);
memset(emsi, '\0', sizeof(s_emsi));
@ -624,7 +624,7 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc,
/* Add primary address */
if( primary )
session_addrs_add(&emsi->addrs, &emsi->anum, *primary);
session_addrs_add(&state.localaddrs, &state.n_localaddr, *primary);
/* Add other AKAs */
for( addr_ptr = conf_first(cf_address); addr_ptr;
@ -638,11 +638,11 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc,
}
if( !hide_ptr && primary != &addr_ptr->d.falist.addr )
session_addrs_add(&emsi->addrs, &emsi->anum,
session_addrs_add(&state.localaddrs, &state.n_localaddr,
addr_ptr->d.falist.addr);
}
if( emsi->anum == 0 )
if( state.localaddrs == 0 )
log("warning: no addresses will be presented to remote");
/* session password */

@ -24,7 +24,7 @@ void emsi_init(s_handshake_protocol *THIS);
void emsi_deinit(s_handshake_protocol *THIS);
int emsi_incoming(s_handshake_protocol *THIS);
int emsi_outgoing(s_handshake_protocol *THIS);
s_faddr *emsi_remote_address(s_handshake_protocol *THIS);
//s_faddr *emsi_remote_address(s_handshake_protocol *THIS);
char *emsi_remote_password(s_handshake_protocol *THIS);
char *emsi_remote_sysop_name(s_handshake_protocol *THIS);
char *emsi_remote_system_name(s_handshake_protocol *THIS);
@ -33,7 +33,7 @@ char *emsi_remote_phone(s_handshake_protocol *THIS);
char *emsi_remote_flags(s_handshake_protocol *THIS);
char *emsi_remote_mailer(s_handshake_protocol *THIS);
int emsi_remote_traffic(s_handshake_protocol *THIS, s_traffic *dest);
s_faddr *emsi_local_address(s_handshake_protocol *THIS);
//s_faddr *emsi_local_address(s_handshake_protocol *THIS);
char *emsi_local_password(s_handshake_protocol *THIS);
s_handshake_protocol handshake_protocol_emsi = {
@ -49,7 +49,7 @@ s_handshake_protocol handshake_protocol_emsi = {
emsi_incoming,
emsi_outgoing,
/* Section 2 */
emsi_remote_address,
// emsi_remote_address,
emsi_remote_password,
emsi_remote_sysop_name,
emsi_remote_system_name,
@ -59,7 +59,7 @@ s_handshake_protocol handshake_protocol_emsi = {
emsi_remote_mailer,
emsi_remote_traffic,
/* Section 3 */
emsi_local_address,
// emsi_local_address,
emsi_local_password
};
@ -151,7 +151,7 @@ int emsi_incoming(s_handshake_protocol *THIS)
/*
* Check password(s)
*/
if( session_addrs_check(remote_emsi->addrs, remote_emsi->anum,
if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr,
remote_emsi->passwd, NULL, 0) )
{
rc = HRC_BAD_PASSWD;
@ -161,7 +161,7 @@ int emsi_incoming(s_handshake_protocol *THIS)
else
{
/* Lock (create BSY) remote addresses */
if( session_addrs_lock(remote_emsi->addrs, remote_emsi->anum) )
if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) )
{
log("all remote addresses are busy");
rc = HRC_BUSY;
@ -172,7 +172,7 @@ int emsi_incoming(s_handshake_protocol *THIS)
* We know caller's address so we can process
* more expressions and fill state.node structure..
*/
session_remote_lookup(remote_emsi->addrs, remote_emsi->anum);
session_remote_lookup(state.remoteaddrs, state.n_remoteaddr);
if( session_check_speed() )
rc = HRC_LOW_SPEED;
@ -219,8 +219,8 @@ int emsi_incoming(s_handshake_protocol *THIS)
/*
* Create mail/files queue
*/
session_create_files_queue(remote_emsi->addrs,
remote_emsi->anum);
session_create_files_queue(state.remoteaddrs,
state.n_remoteaddr);
/*
* Set FREQ processor status
@ -290,21 +290,21 @@ int emsi_outgoing(s_handshake_protocol *THIS)
/*
* Make sure expected address was presented
*/
if( session_addrs_check_genuine(remote_emsi->addrs,
remote_emsi->anum, state.node.addr) )
if( session_addrs_check_genuine(state.remoteaddrs,
state.n_remoteaddr, state.node.addr) )
return HRC_NO_ADDRESS;
/*
* Check password(s)
*/
if( session_addrs_check(remote_emsi->addrs, remote_emsi->anum,
if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr,
remote_emsi->passwd, NULL, 0) )
return HRC_BAD_PASSWD;
/*
* Lock (create BSY) remote addresses
*/
(void)session_addrs_lock(remote_emsi->addrs, remote_emsi->anum);
(void)session_addrs_lock(state.remoteaddrs, state.n_remoteaddr);
/*
* Set protocol we will use ("options" ignored)
@ -341,13 +341,12 @@ int emsi_outgoing(s_handshake_protocol *THIS)
/*
* Create mail/files queue
*/
session_create_files_queue(remote_emsi->addrs,
remote_emsi->anum);
session_create_files_queue(state.remoteaddrs, state.n_remoteaddr);
return HRC_OK;
}
s_faddr *emsi_remote_address(s_handshake_protocol *THIS)
/*s_faddr *emsi_remote_address(s_handshake_protocol *THIS)
{
ASSERT(THIS);
ASSERT(THIS->remote_data);
@ -356,7 +355,7 @@ s_faddr *emsi_remote_address(s_handshake_protocol *THIS)
return &((s_emsi *)THIS->remote_data)->addrs[0].addr;
return NULL;
}
} */
char *emsi_remote_password(s_handshake_protocol *THIS)
{
@ -456,7 +455,7 @@ int emsi_remote_traffic(s_handshake_protocol *THIS, s_traffic *dest)
return -1;
}
s_faddr *emsi_local_address(s_handshake_protocol *THIS)
/*s_faddr *emsi_local_address(s_handshake_protocol *THIS)
{
ASSERT(THIS);
ASSERT(THIS->local_data);
@ -465,7 +464,7 @@ s_faddr *emsi_local_address(s_handshake_protocol *THIS)
return &((s_emsi *)THIS->local_data)->addrs[0].addr;
return NULL;
}
} */
char *emsi_local_password(s_handshake_protocol *THIS)
{

@ -116,10 +116,10 @@ char *emsi_createdat(s_emsi *emsi)
/* our addresses, akas, etc :) */
tmp = add_char(tmp, '{');
for( i = 0; i < emsi->anum; i++ )
for( i = 0; i < state.n_localaddr; i++ )
{
if( i ) tmp = add_char(tmp, ' ');
tmp = add_str(tmp, ftn_addrstr(abuf, emsi->addrs[i].addr));
tmp = add_str(tmp, ftn_addrstr(abuf, state.localaddrs[i].addr));
}
tmp = add_char(tmp, '}');
@ -146,27 +146,27 @@ char *emsi_createdat(s_emsi *emsi)
if( emsi->linkcodes.FNC ) tmp = add_str(tmp, "FNC,");
if( emsi->linkcodes.RMA ) tmp = add_str(tmp, "RMA,");
if( emsi->linkcodes.RH1 ) tmp = add_str(tmp, "RH1,");
for( i = 0; i < emsi->anum; i++ )
for( i = 0; i < state.n_localaddr; i++ )
{
if( emsi->addrs[i].flags & EMSI_FLAG_PU )
if( state.localaddrs[i].flags & EMSI_FLAG_PU )
tmp = add_nflag(tmp, "PU", i);
if( emsi->addrs[i].flags & EMSI_FLAG_HA )
if( state.localaddrs[i].flags & EMSI_FLAG_HA )
tmp = add_nflag(tmp, "HA", i);
if( emsi->addrs[i].flags & EMSI_FLAG_PM )
if( state.localaddrs[i].flags & EMSI_FLAG_PM )
tmp = add_nflag(tmp, "PM", i);
if( emsi->addrs[i].flags & EMSI_FLAG_NF )
if( state.localaddrs[i].flags & EMSI_FLAG_NF )
tmp = add_nflag(tmp, "NF", i);
if( emsi->addrs[i].flags & EMSI_FLAG_NX )
if( state.localaddrs[i].flags & EMSI_FLAG_NX )
tmp = add_nflag(tmp, "NX", i);
if( emsi->addrs[i].flags & EMSI_FLAG_NR )
if( state.localaddrs[i].flags & EMSI_FLAG_NR )
tmp = add_nflag(tmp, "NR", i);
if( emsi->addrs[i].flags & EMSI_FLAG_HN )
if( state.localaddrs[i].flags & EMSI_FLAG_HN )
tmp = add_nflag(tmp, "HN", i);
if( emsi->addrs[i].flags & EMSI_FLAG_HX )
if( state.localaddrs[i].flags & EMSI_FLAG_HX )
tmp = add_nflag(tmp, "HX", i);
if( emsi->addrs[i].flags & EMSI_FLAG_HF )
if( state.localaddrs[i].flags & EMSI_FLAG_HF )
tmp = add_nflag(tmp, "HF", i);
if( emsi->addrs[i].flags & EMSI_FLAG_HR )
if( state.localaddrs[i].flags & EMSI_FLAG_HR )
tmp = add_nflag(tmp, "HR", i);
}
if( tmp[strlen(tmp+1)] == ',' )
@ -468,10 +468,10 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
if( ftn_addrparse(&addr, p, FALSE) )
log("unparsable address \"%s\" skipped", p);
else
session_addrs_add(&emsi->addrs, &emsi->anum, addr);
session_addrs_add(&state.remoteaddrs, &state.n_remoteaddr, addr);
}
if( emsi->anum == 0 )
if( state.n_remoteaddr == 0 )
{
log("parsable addresses not found");
return(1);
@ -502,24 +502,24 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
else if( !strcmp(p, "RMA") ) emsi->linkcodes.RMA = 1;
else if( !strcmp(p, "RH1") ) emsi->linkcodes.RH1 = 1;
/* check EMSI-II address dependend flags */
else if( ((i=nflgcmp(p, "HA")) >= 0) && (i < emsi->anum) )
emsi->addrs[i].flags |= EMSI_FLAG_HA;
else if( ((i=nflgcmp(p, "PM")) >= 0) && (i < emsi->anum) )
emsi->addrs[i].flags |= EMSI_FLAG_PM;
else if( ((i=nflgcmp(p, "NF")) >= 0) && (i < emsi->anum) )
emsi->addrs[i].flags |= EMSI_FLAG_NF;
else if( ((i=nflgcmp(p, "NX")) >= 0) && (i < emsi->anum) )
emsi->addrs[i].flags |= EMSI_FLAG_NX;
else if( ((i=nflgcmp(p, "NR")) >= 0) && (i < emsi->anum) )
emsi->addrs[i].flags |= EMSI_FLAG_NR;
else if( ((i=nflgcmp(p, "HN")) >= 0) && (i < emsi->anum) )
emsi->addrs[i].flags |= EMSI_FLAG_HN;
else if( ((i=nflgcmp(p, "HX")) >= 0) && (i < emsi->anum) )
emsi->addrs[i].flags |= EMSI_FLAG_HX;
else if( ((i=nflgcmp(p, "HF")) >= 0) && (i < emsi->anum) )
emsi->addrs[i].flags |= EMSI_FLAG_HF;
else if( ((i=nflgcmp(p, "HR")) >= 0) && (i < emsi->anum) )
emsi->addrs[i].flags |= EMSI_FLAG_HR;
else if( ((i=nflgcmp(p, "HA")) >= 0) && (i < state.n_remoteaddr) )
state.remoteaddrs[i].flags |= EMSI_FLAG_HA;
else if( ((i=nflgcmp(p, "PM")) >= 0) && (i < state.n_remoteaddr) )
state.remoteaddrs[i].flags |= EMSI_FLAG_PM;
else if( ((i=nflgcmp(p, "NF")) >= 0) && (i < state.n_remoteaddr) )
state.remoteaddrs[i].flags |= EMSI_FLAG_NF;
else if( ((i=nflgcmp(p, "NX")) >= 0) && (i < state.n_remoteaddr) )
state.remoteaddrs[i].flags |= EMSI_FLAG_NX;
else if( ((i=nflgcmp(p, "NR")) >= 0) && (i < state.n_remoteaddr) )
state.remoteaddrs[i].flags |= EMSI_FLAG_NR;
else if( ((i=nflgcmp(p, "HN")) >= 0) && (i < state.n_remoteaddr) )
state.remoteaddrs[i].flags |= EMSI_FLAG_HN;
else if( ((i=nflgcmp(p, "HX")) >= 0) && (i < state.n_remoteaddr) )
state.remoteaddrs[i].flags |= EMSI_FLAG_HX;
else if( ((i=nflgcmp(p, "HF")) >= 0) && (i < state.n_remoteaddr) )
state.remoteaddrs[i].flags |= EMSI_FLAG_HF;
else if( ((i=nflgcmp(p, "HR")) >= 0) && (i < state.n_remoteaddr) )
state.remoteaddrs[i].flags |= EMSI_FLAG_HR;
}
/* compatibility codes */
@ -670,14 +670,14 @@ void emsi_logdat(s_emsi *emsi)
if( emsi->have_emsi )
{
if( emsi->anum )
if( state.n_remoteaddr )
{
for( i = 0; i < emsi->anum; i++ )
for( i = 0; i < state.n_remoteaddr; i++ )
{
if( emsi->addrs[i].busy )
log(" Address : %s (Busy)", ftn_addrstr(abuf, emsi->addrs[i].addr));
if( state.remoteaddrs[i].busy )
log(" Address : %s (Busy)", ftn_addrstr(abuf, state.remoteaddrs[i].addr));
else
log(" Address : %s", ftn_addrstr(abuf, emsi->addrs[i].addr));
log(" Address : %s", ftn_addrstr(abuf, state.remoteaddrs[i].addr));
}
}
else

@ -64,35 +64,35 @@ static int yoohoo_getword(const char *buf)
* Return value:
* None
*/
static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *hello)
static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *myhello)
{
char *p, *q;
ASSERT(buffer && hello);
ASSERT(buffer && myhello);
memset(buffer, '\0', YOOHOO_HELLOLEN);
p = buffer;
p = yoohoo_putword(p, 0x6f);
p = yoohoo_putword(p, 0x01); /* Hello version */
p = yoohoo_putword(p, hello->product_code); /* Product code */
p = yoohoo_putword(p, hello->version_maj); /* Major version */
p = yoohoo_putword(p, hello->version_min); /* Minor version */
p = yoohoo_putword(p, myhello->product_code); /* Product code */
p = yoohoo_putword(p, myhello->version_maj); /* Major version */
p = yoohoo_putword(p, myhello->version_min); /* Minor version */
strnxcpy(p, hello->system, 60); /* Node name */
strnxcpy(p, myhello->system, 60); /* Node name */
/*
* Add domain after the end of 'Node name'
* TODO: check it for buffer overflows %-I
*/
if( hello->anum > 0 && hello->addrs[0].addr.domain
&& *hello->addrs[0].addr.domain )
if( state.n_localaddr > 0 && state.localaddrs[0].addr.domain
&& *state.localaddrs[0].addr.domain )
{
char *q;
if( strlen(hello->system) + strlen(hello->addrs[0].addr.domain) > 57 )
if( strlen(myhello->system) + strlen(state.localaddrs[0].addr.domain) > 57 )
{
if( strlen(hello->addrs[0].addr.domain) < 60 )
q = p + (60 - strlen(hello->addrs[0].addr.domain));
if( strlen(state.localaddrs[0].addr.domain) < 60 )
q = p + (60 - strlen(state.localaddrs[0].addr.domain));
else
q = p;
@ -100,29 +100,29 @@ static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *hello)
}
else
{
q = p + strlen(hello->system) + 1;
q = p + strlen(myhello->system) + 1;
}
strnxcpy(q, hello->addrs[0].addr.domain, 60-(q-p));
strnxcpy(q, state.localaddrs[0].addr.domain, 60-(q-p));
}
p += 60;
strnxcpy(p, hello->sysop, 20); /* SysOp name */
strnxcpy(p, myhello->sysop, 20); /* SysOp name */
p += 20;
if( hello->anum > 0 )
if( state.n_localaddr > 0 )
{
p = yoohoo_putword(p, hello->addrs[0].addr.zone);
p = yoohoo_putword(p, hello->addrs[0].addr.net);
p = yoohoo_putword(p, hello->addrs[0].addr.node);
p = yoohoo_putword(p, hello->addrs[0].addr.point);
p = yoohoo_putword(p, state.localaddrs[0].addr.zone);
p = yoohoo_putword(p, state.localaddrs[0].addr.net);
p = yoohoo_putword(p, state.localaddrs[0].addr.node);
p = yoohoo_putword(p, state.localaddrs[0].addr.point);
}
else
p += 8;
strncpy(p, hello->passwd, 8); /* Session password */
strncpy(p, myhello->passwd, 8); /* Session password */
p += 8;
p += 8; /* Reserved 8 bytes */
p = yoohoo_putword(p, hello->capabilities); /* Capabilities */
p = yoohoo_putword(p, myhello->capabilities); /* Capabilities */
p += 12; /* Reserved 12 bytes */
#ifdef DEBUG
@ -145,11 +145,11 @@ static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *hello)
* Return value:
* None
*/
static int yoohoo_get_hello(s_yoohoo_sysinfo *hello, const char *buffer)
static int yoohoo_get_hello(s_yoohoo_sysinfo *remhello, const char *buffer)
{
s_faddr addr;
ASSERT(buffer && hello);
ASSERT(buffer && remhello);
#ifdef DEBUG
{
@ -159,16 +159,16 @@ static int yoohoo_get_hello(s_yoohoo_sysinfo *hello, const char *buffer)
}
#endif
memset(hello, '\0', sizeof(s_yoohoo_sysinfo));
memset(remhello, '\0', sizeof(s_yoohoo_sysinfo));
if( yoohoo_getword(buffer+2) != 0x01 )
log("YooHoo hello version is %d!", yoohoo_getword(buffer+2));
hello->product_code = yoohoo_getword(buffer+4);
hello->version_maj = yoohoo_getword(buffer+6);
hello->version_min = yoohoo_getword(buffer+8);
strnxcpy(hello->system, buffer+10, MIN(sizeof(hello->system),60+1));
strnxcpy(hello->sysop, buffer+70, MIN(sizeof(hello->sysop),20+1));
remhello->product_code = yoohoo_getword(buffer+4);
remhello->version_maj = yoohoo_getword(buffer+6);
remhello->version_min = yoohoo_getword(buffer+8);
strnxcpy(remhello->system, buffer+10, MIN(sizeof(remhello->system),60+1));
strnxcpy(remhello->sysop, buffer+70, MIN(sizeof(remhello->sysop),20+1));
/*
* Extract address
@ -178,11 +178,11 @@ static int yoohoo_get_hello(s_yoohoo_sysinfo *hello, const char *buffer)
addr.net = yoohoo_getword(buffer+92);
addr.node = yoohoo_getword(buffer+94);
addr.point = yoohoo_getword(buffer+96);
session_addrs_add(&hello->addrs, &hello->anum, addr);
session_addrs_add(&state.remoteaddrs, &state.n_remoteaddr, addr);
strnxcpy(hello->passwd, buffer+98, MIN(sizeof(hello->passwd),8+1));
strnxcpy(remhello->passwd, buffer+98, MIN(sizeof(remhello->passwd),8+1));
/* Reserved 8 bytes */
hello->capabilities = yoohoo_getword(buffer+114);
remhello->capabilities = yoohoo_getword(buffer+114);
/* Reserved 12 bytes */
return 0;
@ -466,11 +466,11 @@ void yoohoo_set_sysinfo(s_yoohoo_sysinfo *local_data, int hrc,
* Set our local address
*/
if( primary )
session_addrs_add(&local_data->addrs, &local_data->anum, *primary);
session_addrs_add(&state.localaddrs, &state.n_localaddr, *primary);
else if( (addr_ptr = conf_first(cf_address)) )
session_addrs_add(&local_data->addrs, &local_data->anum, addr_ptr->d.falist.addr);
session_addrs_add(&state.localaddrs, &state.n_localaddr, addr_ptr->d.falist.addr);
if( !local_data->anum )
if( !state.n_localaddr )
log("warning: no addresses will be presented to remote");
/*
@ -557,35 +557,35 @@ void yoohoo_set_sysinfo(s_yoohoo_sysinfo *local_data, int hrc,
* Return value:
* None
*/
void yoohoo_log_sysinfo(s_yoohoo_sysinfo *yoohoo)
void yoohoo_log_sysinfo(s_yoohoo_sysinfo *remyoohoo)
{
int i;
char abuf[BF_MAXADDRSTR+1];
if( yoohoo->anum )
for( i = 0; i < yoohoo->anum; i++ )
if( state.n_remoteaddr )
for( i = 0; i < state.n_remoteaddr; i++ )
{
log(" Address : %s", ftn_addrstr(abuf, yoohoo->addrs[i].addr));
log(" Address : %s", ftn_addrstr(abuf, state.remoteaddrs[i].addr));
}
else
log(" Address : <none>");
if( yoohoo->system[0] )
log(" System : %s", string_printable(yoohoo->system));
if( remyoohoo->system[0] )
log(" System : %s", string_printable(remyoohoo->system));
#ifdef BFORCE_LOG_PASSWD
if( yoohoo->passwd[0] )
log(" Password : %s", string_printable(yoohoo->passwd));
if( remyoohoo->passwd[0] )
log(" Password : %s", string_printable(remyoohoo->passwd));
#endif
if( yoohoo->sysop[0] )
log(" SysOp : %s", string_printable(yoohoo->sysop));
if( remyoohoo->sysop[0] )
log(" SysOp : %s", string_printable(remyoohoo->sysop));
if( yoohoo->product_code || yoohoo->version_maj || yoohoo->version_min )
if( remyoohoo->product_code || remyoohoo->version_maj || remyoohoo->version_min )
{
log(" Mailer : %s [%02x] %d.%d",
"?", yoohoo->product_code,
yoohoo->version_maj, yoohoo->version_min);
"?", remyoohoo->product_code,
remyoohoo->version_maj, remyoohoo->version_min);
}
}

@ -24,7 +24,7 @@ void yoohoo_init(s_handshake_protocol *THIS);
void yoohoo_deinit(s_handshake_protocol *THIS);
int yoohoo_incoming(s_handshake_protocol *THIS);
int yoohoo_outgoing(s_handshake_protocol *THIS);
s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS);
//s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS);
char *yoohoo_remote_password(s_handshake_protocol *THIS);
char *yoohoo_remote_sysop_name(s_handshake_protocol *THIS);
char *yoohoo_remote_system_name(s_handshake_protocol *THIS);
@ -32,7 +32,7 @@ char *yoohoo_remote_location(s_handshake_protocol *THIS);
char *yoohoo_remote_phone(s_handshake_protocol *THIS);
char *yoohoo_remote_flags(s_handshake_protocol *THIS);
char *yoohoo_remote_mailer(s_handshake_protocol *THIS);
s_faddr *yoohoo_local_address(s_handshake_protocol *THIS);
//s_faddr *yoohoo_local_address(s_handshake_protocol *THIS);
char *yoohoo_local_password(s_handshake_protocol *THIS);
s_handshake_protocol handshake_protocol_yoohoo = {
@ -48,7 +48,7 @@ s_handshake_protocol handshake_protocol_yoohoo = {
yoohoo_incoming,
yoohoo_outgoing,
/* Section 2 */
yoohoo_remote_address,
// yoohoo_remote_address,
yoohoo_remote_password,
yoohoo_remote_sysop_name,
yoohoo_remote_system_name,
@ -58,7 +58,7 @@ s_handshake_protocol handshake_protocol_yoohoo = {
NULL,
NULL,
/* Section 3 */
yoohoo_local_address,
// yoohoo_local_address,
yoohoo_local_password
};
@ -113,7 +113,7 @@ int yoohoo_incoming(s_handshake_protocol *THIS)
/*
* Check password(s)
*/
if( session_addrs_check(remote_data->addrs, remote_data->anum,
if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr,
remote_data->passwd, NULL, 0) )
{
rc = HRC_BAD_PASSWD;
@ -123,8 +123,8 @@ int yoohoo_incoming(s_handshake_protocol *THIS)
else
{
/* Lock (create BSY) remote addresses */
if( session_addrs_lock(remote_data->addrs,
remote_data->anum) )
if( session_addrs_lock(state.remoteaddrs,
state.n_remoteaddr) )
{
log("all remote addresses are busy");
rc = HRC_BUSY;
@ -135,7 +135,7 @@ int yoohoo_incoming(s_handshake_protocol *THIS)
* Fill state.node with a first valid
* address, try to lookup it in nodelist
*/
session_remote_lookup(remote_data->addrs, remote_data->anum);
session_remote_lookup(state.remoteaddrs, state.n_remoteaddr);
if( session_check_speed() )
rc = HRC_LOW_SPEED;
@ -180,7 +180,7 @@ int yoohoo_incoming(s_handshake_protocol *THIS)
/*
* Create mail/files queue
*/
session_create_files_queue(remote_data->addrs, remote_data->anum);
session_create_files_queue(state.remoteaddrs, state.n_remoteaddr);
/*
* Set FREQ processor status
@ -238,23 +238,23 @@ int yoohoo_outgoing(s_handshake_protocol *THIS)
/*
* Make sure expected address was presented
*/
if( session_addrs_check_genuine(remote_data->addrs,
remote_data->anum,
if( session_addrs_check_genuine(state.remoteaddrs,
state.n_remoteaddr,
state.node.addr) )
return HRC_NO_ADDRESS;
/*
* Check password(s)
*/
if( session_addrs_check(remote_data->addrs, remote_data->anum,
if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr,
remote_data->passwd, NULL, 0) )
return HRC_BAD_PASSWD;
/*
* Lock (create BSY) remote addresses
*/
(void)session_addrs_lock(remote_data->addrs,
remote_data->anum);
(void)session_addrs_lock(state.remoteaddrs,
state.n_remoteaddr);
/*
* Set protocol we will use ("options" ignored)
@ -289,13 +289,12 @@ int yoohoo_outgoing(s_handshake_protocol *THIS)
/*
* Create mail/files queue
*/
session_create_files_queue(remote_data->addrs,
remote_data->anum);
session_create_files_queue(state.remoteaddrs, state.n_remoteaddr);
return HRC_OK;
}
s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS)
/*s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS)
{
ASSERT(THIS);
ASSERT(THIS->remote_data);
@ -304,7 +303,7 @@ s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS)
return &((s_yoohoo_sysinfo *)THIS->remote_data)->addrs[0].addr;
return NULL;
}
} */
char *yoohoo_remote_password(s_handshake_protocol *THIS)
{
@ -339,7 +338,7 @@ char *yoohoo_remote_system_name(s_handshake_protocol *THIS)
return NULL;
}
s_faddr *yoohoo_local_address(s_handshake_protocol *THIS)
/*s_faddr *yoohoo_local_address(s_handshake_protocol *THIS)
{
ASSERT(THIS);
ASSERT(THIS->local_data);
@ -348,7 +347,7 @@ s_faddr *yoohoo_local_address(s_handshake_protocol *THIS)
return &((s_yoohoo_sysinfo *)THIS->local_data)->addrs[0].addr;
return NULL;
}
} */
char *yoohoo_local_password(s_handshake_protocol *THIS)
{

@ -58,7 +58,7 @@ static void zmodem_add_empty_packet(s_protinfo *pi)
memset(&pkt, '\0', sizeof(s_packet));
pkt.dest = state.node.addr;
pkt.orig = *state.handshake->remote_address(state.handshake);
if (session_1remote_address()) pkt.orig = *session_1remote_address();
if( pkt_createpacket(p_tmpname, &pkt) )
{

@ -52,8 +52,7 @@ int session_run_command(const char *execstr)
if( state.handshake )
{
if( state.handshake->remote_address
&& (addr = state.handshake->remote_address(state.handshake)) )
if( addr = session_1remote_address() )
{
exec_env_add(&eopts, "REM_ADDR_FTN",
ftn_addrstr_fido(abuf, *addr));
@ -61,8 +60,7 @@ int session_run_command(const char *execstr)
ftn_addrstr_inet(abuf, *addr));
}
if( state.handshake->local_address
&& (addr = state.handshake->local_address(state.handshake)) )
if( addr = session_1local_address() )
{
exec_env_add(&eopts, "LOC_ADDR_FTN",
ftn_addrstr_fido(abuf, *addr));
@ -166,27 +164,38 @@ void init_state(s_state *pstate)
void deinit_state(s_state *pstate)
{
if( pstate->linename )
free(pstate->linename);
if( pstate->cidstr )
free(pstate->cidstr);
if( pstate->peername )
free(pstate->peername);
if( pstate->connstr )
free(pstate->connstr);
if( pstate->inbound )
free(pstate->inbound);
if( pstate->tinbound )
free(pstate->tinbound);
if( pstate->mailfor )
deinit_falist(pstate->mailfor);
if (pstate->linename) free(pstate->linename);
if (pstate->cidstr) free(pstate->cidstr);
if (pstate->peername) free(pstate->peername);
if (pstate->connstr) free(pstate->connstr);
if (pstate->inbound) free(pstate->inbound);
if (pstate->tinbound) free(pstate->tinbound);
if (pstate->mailfor) deinit_falist(pstate->mailfor);
deinit_fsqueue(&pstate->queue);
if( state.handshake && state.handshake->deinit )
if (state.handshake && state.handshake->deinit) {
state.handshake->deinit(state.handshake);
}
if (pstate->remoteaddrs) free (pstate->remoteaddrs);
if (pstate->localaddrs) free (pstate->localaddrs);
memset(pstate, '\0', sizeof(s_state));
pstate->session_rc = -1;
}
s_faddr *session_1remote_address()
{
if (state.n_remoteaddr > 0) return &state.remoteaddrs[0].addr;
return NULL;
}
s_faddr *session_1local_address()
{
if (state.n_localaddr > 0) return &state.localaddrs[0].addr;
return NULL;
}

@ -65,8 +65,8 @@ typedef enum binkp_mode {
typedef struct {
s_sysaddr *addrs;
int anum;
// s_sysaddr *addrs;
// int anum;
char passwd[BINKP_MAXPASSWD+1];
char systname[BINKP_MAXSYSTNAME+1];
char location[BINKP_MAXLOCATION+1];

@ -143,8 +143,8 @@ struct emsi
* {EMSI_DAT} (main handshake information)
*/
bool have_emsi;
s_sysaddr *addrs; /* dynamicaly allocated array */
int anum; /* number of used entries in it */
// s_sysaddr *addrs; /* dynamicaly allocated array */
// int anum; /* number of used entries in it */
char passwd[EMSI_MAXPASSWD+1];
s_linkcodes linkcodes; /* XXn linkcodes contained in eaddr */
s_compcodes compcodes;

@ -22,8 +22,8 @@
*/
typedef struct
{
s_sysaddr *addrs; /* FTN address */
int anum;
// s_sysaddr *addrs; /* FTN address */
// int anum;
int product_code; /* product code */
int version_maj; /* major revision of the product */
int version_min; /* minor revision of the product */

@ -20,6 +20,14 @@
#include "io.h"
#include "nodelist.h"
#include "outbound.h"
typedef struct sysaddr {
s_faddr addr;
bool busy;
bool good;
int flags;
} s_sysaddr;
#include "prot_common.h"
#ifdef NETSPOOL
@ -62,13 +70,6 @@ typedef enum reqstat {
#define HRC_TEMP_ERR 7 /* Any other temporary handshake error */
#define HRC_OTHER_ERR 8 /* Any other error (e.g. timeout, NO CARRIER) */
typedef struct sysaddr {
s_faddr addr;
bool busy;
bool good;
int flags;
} s_sysaddr;
typedef struct {
char passwd[128];
char challenge[128];
@ -109,7 +110,7 @@ typedef struct handshake_protocol
/*
* 2. Remote system information extract methods
*/
s_faddr* (*remote_address)(struct handshake_protocol *THIS);
// s_faddr* (*remote_address)(struct handshake_protocol *THIS);
char* (*remote_password)(struct handshake_protocol *THIS);
char* (*remote_sysop_name)(struct handshake_protocol *THIS);
char* (*remote_system_name)(struct handshake_protocol *THIS);
@ -122,7 +123,7 @@ typedef struct handshake_protocol
/*
* 3. Local system information extract methods
*/
s_faddr* (*local_address)(struct handshake_protocol *THIS);
// s_faddr* (*local_address)(struct handshake_protocol *THIS);
char* (*local_password)(struct handshake_protocol *THIS);
} s_handshake_protocol;
@ -162,6 +163,10 @@ const s_modemport *modemport;
#ifdef NETSPOOL
s_netspool_state netspool;
#endif
s_sysaddr *remoteaddrs;
int n_remoteaddr;
s_sysaddr *localaddrs;
int n_localaddr;
};
typedef struct state s_state;
@ -187,7 +192,8 @@ int session_init_outgoing();
int session_init_incoming();
/* s_main.c */
extern s_state state;
extern s_state state; // IF YOU WANT MAKE THIS PROGRAM MULTITHREAD, MAKE THIS VARIBLE LOCAL TO THE THREADS AND PASS IT TO SUBROUTINES
// YOU SHOULD ADD IT TO ALL FUNCTIONS: IT IS MANY OF HANDWORK BUT EASY TO DO
s_faddr *session_get_bestaka(s_faddr addr);
int session_addrs_lock(s_sysaddr *addrs, int anum);
@ -213,6 +219,9 @@ void session_traffic(void);
void session_update_history(s_traffic *send, s_traffic *recv, int rc);
int session(void);
s_faddr* session_1remote_address();
s_faddr* session_1local_address();
/* sess_call.c */
int call_system(s_faddr addr, const s_bforce_opts *opts);
int call_system_modem(void);

Loading…
Cancel
Save