Updates for new inbound structures

This commit is contained in:
Michiel Broek 2003-08-23 15:55:45 +00:00
parent 9a6798b299
commit ab8aabed95
6 changed files with 121 additions and 125 deletions

View File

@ -123,12 +123,10 @@ int binkp(int role)
char *nonhold_mail;
if (role == 1) {
Syslog('+', "Binkp: start outbound session");
if (orgbinkp()) {
rc = MBERR_SESSION_ERROR;
}
} else {
Syslog('+', "Binkp: start inbound session");
if (ansbinkp()) {
rc = MBERR_SESSION_ERROR;
}

View File

@ -79,8 +79,6 @@ int rx_emsi(char *data)
fa_list *tmr;
int denypw=0;
Syslog('+', "Start inbound EMSI session");
emsi_local_lcodes = LCODE_RH1;
emsi_remote_lcodes=0;
@ -207,7 +205,6 @@ int tx_emsi(char *data)
{
int rc;
Syslog('+', "Start outbound EMSI session");
emsi_local_lcodes = LCODE_PUA | LCODE_RH1;
emsi_remote_lcodes = 0;

View File

@ -67,7 +67,6 @@ int rx_ftsc(void)
{
int rc;
Syslog('+', "Start inbound FTS-0001 session");
IsDoing("FTS-0001 inbound");
session_flags |= SESSION_BARK;
@ -94,7 +93,6 @@ int tx_ftsc(void)
{
int rc;
Syslog('+', "Start outbound FTS-0001 session with %s", ascfnode(remote->addr,0x1f));
IsDoing("FTS-0001 to %s", ascfnode(remote->addr, 0x0f));
if ((rc = txftsc())) {
@ -131,10 +129,7 @@ SM_EDECL
char *nonhold_mail;
int mailsent = FALSE, mailrcvd = FALSE;
// if (localoptions & NOHOLD)
nonhold_mail = (char *)ALL_MAIL;
// else
// nonhold_mail = (char *)NONHOLD_MAIL;
nonhold_mail = (char *)ALL_MAIL;
tosend = create_filelist(remote,nonhold_mail,2);
Syslog('s', "txftsc SEND_MAIL");
@ -157,7 +152,7 @@ SM_STATE(wait_command)
* Some systems hangup after sending mail, so if we did
* send and receive mail we consider the session OK.
*/
Syslog('+', "Lost carrier, FTSC session looks complete");
Syslog('+', "Lost carrier, FTS-0001 session looks complete");
SM_SUCCESS;
} else {
Syslog('+', "got error waiting for TSYNC: received %d",c);
@ -407,8 +402,8 @@ SM_STATE(scan_packet)
* handshake by sending us a .pkt file, we store this in the old
* style ../tmp/ dir in the unprotected inbound.
*/
fpath = xstrcpy(inbound);
fpath = xstrcat(fpath,(char *)"/");
fpath = xstrcpy(CFG.inbound);
fpath = xstrcat(fpath,(char *)"/tmp/");
fpath = xstrcat(fpath,recvpktname);
mkdirs(fpath, 0700);
fp = fopen(fpath,"r");

View File

@ -33,6 +33,8 @@
#include "../lib/structs.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "../lib/users.h"
#include "../lib/records.h"
#include "config.h"
#include "lutil.h"
#include "openfile.h"
@ -82,8 +84,17 @@ FILE *openfile(char *fname, time_t remtime, off_t remsize, off_t *resofs, int(*r
* If it's there, resoffs will be set equal to remsize to signal the
* receiving protocol to skip the file.
*/
infpath = xstrcpy(tempinbound);
infpath = xstrcat(infpath, (char *)"/");
if (tempinbound == NULL) {
/*
* This is when we get a FTS-0001 handshake packet
*/
infpath = xstrcpy(CFG.inbound);
infpath = xstrcat(infpath, (char *)"/tmp/");
mkdirs(infpath, 0700);
} else {
infpath = xstrcpy(tempinbound);
infpath = xstrcat(infpath, (char *)"/");
}
infpath = xstrcat(infpath, fname);
if (stat(infpath, &st) == 0) {
/* FIXME: temp normal logging now! */

View File

@ -69,132 +69,131 @@ struct sockaddr_in peeraddr;
char *typestr(int);
char *typestr(int tp)
{
switch (tp) {
case SESSION_FTSC: return (char *)"FTSC";
case SESSION_YOOHOO: return (char *)"YooHoo/2U2";
case SESSION_EMSI: return (char *)"EMSI";
case SESSION_BINKP: return (char *)"Binkp";
default: return (char *)"Unknown";
}
switch (tp) {
case SESSION_FTSC: return (char *)"FTS-0001";
case SESSION_YOOHOO: return (char *)"YooHoo/2U2";
case SESSION_EMSI: return (char *)"EMSI";
case SESSION_BINKP: return (char *)"Binkp";
default: return (char *)"Unknown";
}
}
int session(faddr *a, node *nl, int role, int tp, char *dt)
{
int rc = MBERR_OK;
fa_list *tmpl;
int addrlen = sizeof(struct sockaddr_in);
int rc = MBERR_OK, addrlen = sizeof(struct sockaddr_in);
fa_list *tmpl;
session_flags = 0;
type = tp;
nlent = nl;
session_flags = 0;
type = tp;
nlent = nl;
if (role) {
Syslog('s', "Start outbound session type %s with %s", typestr(type), ascfnode(a,0x1f));
} else
Syslog('s', "Start inbound session type %s", typestr(type));
if (role)
Syslog('+', "Start outbound %s session with %s", typestr(type), ascfnode(a,0x1f));
else
Syslog('+', "Start inbound %s session", typestr(type));
if (getpeername(0,(struct sockaddr*)&peeraddr,&addrlen) == 0) {
Syslog('s', "TCP connection: len=%d, family=%hd, port=%hu, addr=%s",
if (getpeername(0,(struct sockaddr*)&peeraddr,&addrlen) == 0) {
Syslog('s', "TCP connection: len=%d, family=%hd, port=%hu, addr=%s",
addrlen,peeraddr.sin_family, peeraddr.sin_port, inet_ntoa(peeraddr.sin_addr));
if (role == 0) {
if (tcp_mode == TCPMODE_IBN) {
Syslog('+', "Incoming IBN/TCP connection from %s", inet_ntoa(peeraddr.sin_addr));
IsDoing("Incoming IBN/TCP");
} else if (tcp_mode == TCPMODE_ITN) {
Syslog('+', "Incoming ITN/TCP connection from %s", inet_ntoa(peeraddr.sin_addr));
IsDoing("Incoming ITN/TCP");
} else if (tcp_mode == TCPMODE_IFC) {
Syslog('+', "Incoming IFC/TCP connection from %s", inet_ntoa(peeraddr.sin_addr));
IsDoing("Incoming IFC/TCP");
} else if (tcp_mode == TCPMODE_NONE) {
WriteError("Unknown TCP connection, parameter missing");
die(MBERR_COMMANDLINE);
}
}
session_flags |= SESSION_TCP;
if (role == 0) {
if (tcp_mode == TCPMODE_IBN) {
Syslog('+', "Incoming IBN/TCP connection from %s", inet_ntoa(peeraddr.sin_addr));
IsDoing("Incoming IBN/TCP");
} else if (tcp_mode == TCPMODE_ITN) {
Syslog('+', "Incoming ITN/TCP connection from %s", inet_ntoa(peeraddr.sin_addr));
IsDoing("Incoming ITN/TCP");
} else if (tcp_mode == TCPMODE_IFC) {
Syslog('+', "Incoming IFC/TCP connection from %s", inet_ntoa(peeraddr.sin_addr));
IsDoing("Incoming IFC/TCP");
} else if (tcp_mode == TCPMODE_NONE) {
WriteError("Unknown TCP connection, parameter missing");
die(MBERR_COMMANDLINE);
}
}
session_flags |= SESSION_TCP;
}
if (data)
free(data);
data=NULL;
if (data)
free(data);
data=NULL;
if (dt)
data=xstrcpy(dt);
if (dt)
data=xstrcpy(dt);
emsi_local_protos=0;
emsi_local_opts=0;
emsi_local_lcodes=0;
emsi_local_protos=0;
emsi_local_opts=0;
emsi_local_lcodes=0;
tidy_falist(&remote);
tidy_falist(&remote);
remote=NULL;
if (a) {
remote=(fa_list*)malloc(sizeof(fa_list));
remote->next=NULL;
remote->addr=(faddr*)malloc(sizeof(faddr));
remote->addr->zone=a->zone;
remote->addr->net=a->net;
remote->addr->node=a->node;
remote->addr->point=a->point;
remote->addr->domain=xstrcpy(a->domain);
remote->addr->name=NULL;
} else {
remote=NULL;
if (a) {
remote=(fa_list*)malloc(sizeof(fa_list));
remote->next=NULL;
remote->addr=(faddr*)malloc(sizeof(faddr));
remote->addr->zone=a->zone;
remote->addr->net=a->net;
remote->addr->node=a->node;
remote->addr->point=a->point;
remote->addr->domain=xstrcpy(a->domain);
remote->addr->name=NULL;
} else {
remote=NULL;
}
remote_flags=SESSION_FNC;
if (role) {
if (type == SESSION_UNKNOWN)
(void)tx_define_type();
switch(type) {
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
case SESSION_FTSC: rc = tx_ftsc(); break;
case SESSION_YOOHOO: rc = tx_yoohoo(); break;
case SESSION_EMSI: rc = tx_emsi(data); break;
case SESSION_BINKP: rc = binkp(role); break;
}
remote_flags=SESSION_FNC;
if (role) {
if (type == SESSION_UNKNOWN)
(void)tx_define_type();
switch(type) {
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
case SESSION_FTSC: rc = tx_ftsc(); break;
case SESSION_YOOHOO: rc = tx_yoohoo(); break;
case SESSION_EMSI: rc = tx_emsi(data); break;
case SESSION_BINKP: rc = binkp(role); break;
}
} else {
if (type == SESSION_FTSC)
session_flags |= FTSC_XMODEM_CRC;
if (type == SESSION_UNKNOWN)
(void)rx_define_type();
switch(type) {
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
case SESSION_FTSC: rc = rx_ftsc(); break;
case SESSION_YOOHOO: rc = rx_yoohoo(); break;
case SESSION_EMSI: rc = rx_emsi(data); break;
case SESSION_BINKP: rc = binkp(role); break;
}
} else {
if (type == SESSION_FTSC)
session_flags |= FTSC_XMODEM_CRC;
if (type == SESSION_UNKNOWN)
(void)rx_define_type();
switch(type) {
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
case SESSION_FTSC: rc = rx_ftsc(); break;
case SESSION_YOOHOO: rc = rx_yoohoo(); break;
case SESSION_EMSI: rc = rx_emsi(data); break;
case SESSION_BINKP: rc = binkp(role); break;
}
sleep(2);
for (tmpl = remote; tmpl; tmpl = tmpl->next) {
/*
* Unlock all nodes, locks not owned by us are untouched.
*/
(void)nodeulock(tmpl->addr);
/*
* If successfull session, reset all status records.
*/
if (rc == 0)
putstatus(tmpl->addr, 0, 0);
}
tidy_falist(&remote);
if (data)
free(data);
data = NULL;
}
sleep(2);
for (tmpl = remote; tmpl; tmpl = tmpl->next) {
/*
* Unlock all nodes, locks not owned by us are untouched.
*/
(void)nodeulock(tmpl->addr);
/*
* If successfull session, reset all status records.
*/
if (rc == 0)
putstatus(tmpl->addr, 0, 0);
}
tidy_falist(&remote);
if (data)
free(data);
data = NULL;
if (emsi_local_password)
free(emsi_local_password);
if (emsi_remote_password)
free(emsi_remote_password);
if (emsi_local_password)
free(emsi_local_password);
if (emsi_remote_password)
free(emsi_remote_password);
if (nlent->addr.domain)
free(nlent->addr.domain);
if (nlent->addr.domain)
free(nlent->addr.domain);
inbound_close(rc == 0);
return rc;
inbound_close(rc == 0);
return rc;
}

View File

@ -128,8 +128,6 @@ int rx_yoohoo(void)
unsigned short capabilities,localcaps;
char *pwd = NULL;
Syslog('+', "Start inbound YooHoo session");
pwd = NULL;
localcaps = LOCALCAPS;
if (localoptions & NOZMODEM) localcaps &= ~(ZED_ZAPPER|ZED_ZIPPER);
@ -228,8 +226,6 @@ int tx_yoohoo(void)
unsigned short capabilities;
char *pwd;
Syslog('+', "Start outbound YooHoo session");
if (strlen(nodes.Spasswd))
pwd = xstrcpy(nodes.Spasswd);
else