Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit dbbfabf1 authored by deuce's avatar deuce

Update to 3.17a

New Features:
- Multiple bindings for each service
  Use comma-separated interfaces on Interface= lines in the ini file.
  Default is now "0.0.0.0,::"
- IPv6 support
- TLS support for the webserver and (non-static) services
  New TLS option in services.ini (ie: Options=TLS)
- Decrease LEN_SCAN_CMD to 35 chars, increase the CID field to 45 chars,
  and rename the MAIL_CMD string to IPADDR.  I think this frees up the
  note field for SysOp use.
parent b1968555
......@@ -230,6 +230,8 @@ Options=INDEX_FILE | HTML_INDEX_FILE | ALLOW_QWK
AutoStart=true
Interface=
Port=80
TLSInterface=
TLSPort=443
MaxClients=150
RootDirectory=../web/root
ErrorDirectory=error
......
......@@ -28,6 +28,7 @@
; Global socket options set here, in root section
SNDBUF = 8192
RCVBUF = 8192
IPV6_V6ONLY = 1
; TCP-specific options set here
[tcp]
......
......@@ -771,12 +771,13 @@ var LEN_FCDT =9; /* 9 digits for file credit values */
var LEN_TITLE =70; /* Message title */
var LEN_MAIN_CMD =34; /* Storage in user.dat for custom commands */
var LEN_XFER_CMD =40;
var LEN_SCAN_CMD =40;
var LEN_MAIL_CMD =40;
var LEN_CID =25; /* Caller ID (phone number) */
var LEN_SCAN_CMD =35;
var LEN_IPADDR =45;
var LEN_CID =45; /* Caller ID (phone number or IP address) */
var LEN_ARSTR =40; /* Max length of Access Requirement string */
var LEN_CHATACTCMD =9; /* Chat action command */
var LEN_CHATACTOUT =65; /* Chat action output string */ /************************************************/
var LEN_CHATACTOUT =65; /* Chat action output string */
/************************************************/
/********************************************/
......@@ -833,8 +834,8 @@ var U_CURXTRN =U_CURSUB+16; /* Current xtrn (internal code) */
var U_MAIN_CMD =U_CURXTRN+8+2; /* unused */
var U_XFER_CMD =U_MAIN_CMD+LEN_MAIN_CMD; /* unused */
var U_SCAN_CMD =U_XFER_CMD+LEN_XFER_CMD+2; /* unused */
var U_MAIL_CMD =U_SCAN_CMD+LEN_SCAN_CMD; /* unused */
var U_FREECDT =U_MAIL_CMD+LEN_MAIL_CMD+2;
var U_IPADDR =U_SCAN_CMD+LEN_SCAN_CMD; /* unused */
var U_FREECDT =U_IPADDR+LEN_IPADDR+2;
var U_FLAGS3 =U_FREECDT+10; /* Flag set #3 */
var U_FLAGS4 =U_FLAGS3+8; /* Flag set #4 */
var U_XEDIT =U_FLAGS4+8; /* External editor (code */
......
......@@ -52,7 +52,7 @@ bool sbbs_t::answer()
useron.number=0;
answertime=logontime=starttime=now=time(NULL);
/* Caller ID is IP address */
SAFECOPY(cid,inet_ntoa(client_addr.sin_addr));
SAFECOPY(cid,client_ipaddr);
memset(&tm,0,sizeof(tm));
localtime_r(&now,&tm);
......@@ -349,7 +349,7 @@ bool sbbs_t::answer()
/* AutoLogon via IP or Caller ID here */
if(!useron.number && !(sys_status&SS_RLOGIN)
&& (startup->options&BBS_OPT_AUTO_LOGON) && cid[0]) {
useron.number=userdatdupe(0, U_NOTE, LEN_NOTE, cid);
useron.number=userdatdupe(0, U_IPADDR, LEN_IPADDR, cid);
if(useron.number) {
getuserdat(&cfg, &useron);
if(!(useron.misc&AUTOLOGON) || !(useron.exempt&FLAG('V')))
......@@ -436,8 +436,8 @@ bool sbbs_t::answer()
/* Save the IP to the user's note */
if(cid[0]) {
SAFECOPY(useron.note,cid);
putuserrec(&cfg,useron.number,U_NOTE,LEN_NOTE,useron.note);
SAFECOPY(useron.ipaddr,cid);
putuserrec(&cfg,useron.number,U_IPADDR,LEN_IPADDR,useron.ipaddr);
}
/* Save host name to the user's computer description */
......
......@@ -636,11 +636,8 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen)
if(!strcmp(sp,"CID") || !strcmp(sp,"IP"))
return(cid);
if(!strcmp(sp,"LOCAL-IP")) {
struct in_addr in_addr;
in_addr.s_addr=local_addr;
return(inet_ntoa(in_addr));
}
if(!strcmp(sp,"LOCAL-IP"))
return(local_addr);
if(!strcmp(sp,"CRLF"))
return("\r\n");
......
......@@ -631,7 +631,7 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client)
if(client!=NULL)
p=client->addr;
else
p=user->note;
p=user->ipaddr;
if(!findstr_in_string(p,(char*)*ptrptr))
result=_not;
else
......
......@@ -39,18 +39,18 @@
#define _CLIENT_H
#include "gen_defs.h" /* WORD, DWORD */
#include "sockwrap.h" /* INET6_ADDRSTRLEN */
#include <time.h> /* time_t */
/* Used for sbbsctrl->client window */
typedef struct {
size_t size; /* size of this struct */
char addr[16]; /* IP address */
char host[64]; /* host name */
char addr[INET6_ADDRSTRLEN]; /* IP address */
char host[256]; /* host name */
WORD port; /* TCP port number */
time32_t time; /* connect time */
const char* protocol; /* protocol description */
const char* user; /* user name */
char pad[32]; /* padding for future expansion */
} client_t;
/* Used for ctrl/client.dab */
......
......@@ -596,6 +596,7 @@ enum {
,USER_STRING_MODEM
,USER_STRING_COMMENT
,USER_STRING_NETMAIL
,USER_STRING_IPADDR
};
......
......@@ -55,25 +55,25 @@ void __fastcall TFtpCfgDlg::FormShow(TObject *Sender)
{
char str[128];
if(MainForm->ftp_startup.interface_addr==0)
if(MainForm->ftp_startup.outgoing4.s_addr==0)
NetworkInterfaceEdit->Text="<ANY>";
else {
sprintf(str,"%d.%d.%d.%d"
,(MainForm->ftp_startup.interface_addr>>24)&0xff
,(MainForm->ftp_startup.interface_addr>>16)&0xff
,(MainForm->ftp_startup.interface_addr>>8)&0xff
,MainForm->ftp_startup.interface_addr&0xff
,(MainForm->ftp_startup.outgoing4.s_addr>>24)&0xff
,(MainForm->ftp_startup.outgoing4.s_addr>>16)&0xff
,(MainForm->ftp_startup.outgoing4.s_addr>>8)&0xff
,MainForm->ftp_startup.outgoing4.s_addr&0xff
);
NetworkInterfaceEdit->Text=AnsiString(str);
}
if(MainForm->ftp_startup.pasv_ip_addr==0)
if(MainForm->ftp_startup.pasv_ip_addr.s_addr==0)
PasvIpAddrEdit->Text="<unspecified>";
else {
sprintf(str,"%d.%d.%d.%d"
,(MainForm->ftp_startup.pasv_ip_addr>>24)&0xff
,(MainForm->ftp_startup.pasv_ip_addr>>16)&0xff
,(MainForm->ftp_startup.pasv_ip_addr>>8)&0xff
,MainForm->ftp_startup.pasv_ip_addr&0xff
,(MainForm->ftp_startup.pasv_ip_addr.s_addr>>24)&0xff
,(MainForm->ftp_startup.pasv_ip_addr.s_addr>>16)&0xff
,(MainForm->ftp_startup.pasv_ip_addr.s_addr>>8)&0xff
,MainForm->ftp_startup.pasv_ip_addr.s_addr&0xff
);
PasvIpAddrEdit->Text=AnsiString(str);
}
......@@ -135,9 +135,9 @@ void __fastcall TFtpCfgDlg::OKBtnClick(TObject *Sender)
while(*p && *p!='.') p++;
if(*p=='.') p++;
addr|=atoi(p);
MainForm->ftp_startup.interface_addr=addr;
MainForm->ftp_startup.outgoing4.s_addr=addr;
} else
MainForm->ftp_startup.interface_addr=0;
MainForm->ftp_startup.outgoing4.s_addr=0;
SAFECOPY(str,PasvIpAddrEdit->Text.c_str());
p=str;
while(*p && *p<=' ') p++;
......@@ -152,9 +152,9 @@ void __fastcall TFtpCfgDlg::OKBtnClick(TObject *Sender)
while(*p && *p!='.') p++;
if(*p=='.') p++;
addr|=atoi(p);
MainForm->ftp_startup.pasv_ip_addr=addr;
MainForm->ftp_startup.pasv_ip_addr.s_addr=addr;
} else
MainForm->ftp_startup.pasv_ip_addr=0;
MainForm->ftp_startup.pasv_ip_addr.s_addr=0;
MainForm->ftp_startup.max_clients=MaxClientsEdit->Text.ToIntDef(FTP_DEFAULT_MAX_CLIENTS);
MainForm->ftp_startup.max_inactivity=MaxInactivityEdit->Text.ToIntDef(FTP_DEFAULT_MAX_INACTIVITY);
......
......@@ -78,7 +78,7 @@ void __fastcall TLoginAttemptsForm::FillListView(TObject *Sender)
Item->Caption=AnsiString(attempt->count-attempt->dupes);
Item->Data=(void*)attempt->time;
Item->SubItems->Add(attempt->dupes);
Item->SubItems->Add(inet_ntoa(attempt->addr));
Item->SubItems->Add("TODO: Add addresses");
Item->SubItems->Add(attempt->prot);
Item->SubItems->Add(attempt->user);
Item->SubItems->Add(attempt->pass);
......
......@@ -75,14 +75,14 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender)
{
char str[128];
if(MainForm->mail_startup.interface_addr==0)
if(MainForm->mail_startup.outgoing4.s_addr==0)
NetworkInterfaceEdit->Text="<ANY>";
else {
sprintf(str,"%d.%d.%d.%d"
,(MainForm->mail_startup.interface_addr>>24)&0xff
,(MainForm->mail_startup.interface_addr>>16)&0xff
,(MainForm->mail_startup.interface_addr>>8)&0xff
,MainForm->mail_startup.interface_addr&0xff
,(MainForm->mail_startup.outgoing4.s_addr>>24)&0xff
,(MainForm->mail_startup.outgoing4.s_addr>>16)&0xff
,(MainForm->mail_startup.outgoing4.s_addr>>8)&0xff
,MainForm->mail_startup.outgoing4.s_addr&0xff
);
NetworkInterfaceEdit->Text=AnsiString(str);
}
......@@ -233,9 +233,9 @@ void __fastcall TMailCfgDlg::OKBtnClick(TObject *Sender)
while(*p && *p!='.') p++;
if(*p=='.') p++;
addr|=atoi(p);
MainForm->mail_startup.interface_addr=addr;
MainForm->mail_startup.outgoing4.s_addr=addr;
} else
MainForm->mail_startup.interface_addr=0;
MainForm->mail_startup.outgoing4.s_addr=0;
MainForm->mail_startup.smtp_port=SMTPPortEdit->Text.ToIntDef(IPPORT_SMTP);
MainForm->mail_startup.submission_port=SubPortEdit->Text.ToIntDef(IPPORT_SUBMISSION);
......
......@@ -845,9 +845,7 @@ __fastcall TMainForm::TMainForm(TComponent* Owner)
bbs_startup.last_node=4;
bbs_startup.options=BBS_OPT_XTRN_MINIMIZED|BBS_OPT_SYSOP_AVAILABLE;
bbs_startup.telnet_port=IPPORT_TELNET;
bbs_startup.telnet_interface=INADDR_ANY;
bbs_startup.rlogin_port=513;
bbs_startup.rlogin_interface=INADDR_ANY;
bbs_startup.lputs=lputs;
bbs_startup.event_lputs=lputs;
bbs_startup.errormsg=errormsg;
......@@ -867,7 +865,6 @@ __fastcall TMainForm::TMainForm(TComponent* Owner)
mail_startup.smtp_port=IPPORT_SMTP;
mail_startup.relay_port=IPPORT_SMTP;
mail_startup.pop3_port=110;
mail_startup.interface_addr=INADDR_ANY;
mail_startup.lputs=lputs;
mail_startup.errormsg=errormsg;
mail_startup.status=mail_status;
......@@ -890,7 +887,6 @@ __fastcall TMainForm::TMainForm(TComponent* Owner)
ftp_startup.size=sizeof(ftp_startup);
ftp_startup.cbdata=&ftp_log_list;
ftp_startup.port=IPPORT_FTP;
ftp_startup.interface_addr=INADDR_ANY;
ftp_startup.lputs=lputs;
ftp_startup.errormsg=errormsg;
ftp_startup.status=ftp_status;
......@@ -927,7 +923,6 @@ __fastcall TMainForm::TMainForm(TComponent* Owner)
memset(&services_startup,0,sizeof(services_startup));
services_startup.size=sizeof(services_startup);
services_startup.cbdata=&services_log_list;
services_startup.interface_addr=INADDR_ANY;
services_startup.lputs=lputs;
services_startup.errormsg=errormsg;
services_startup.status=services_status;
......@@ -2018,10 +2013,12 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender)
if(Registry->ValueExists("JS_YieldInterval"))
global.js.yield_interval=Registry->ReadInteger("JS_YieldInterval");
/*
if(Registry->ValueExists("TelnetInterface"))
bbs_startup.telnet_interface=Registry->ReadInteger("TelnetInterface");
if(Registry->ValueExists("RLoginInterface"))
bbs_startup.rlogin_interface=Registry->ReadInteger("RLoginInterface");
*/
if(Registry->ValueExists("TelnetPort"))
bbs_startup.telnet_port=Registry->ReadInteger("TelnetPort");
......@@ -2060,8 +2057,10 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender)
if(Registry->ValueExists("MailMaxInactivity"))
mail_startup.max_inactivity=Registry->ReadInteger("MailMaxInactivity");
/*
if(Registry->ValueExists("MailInterface"))
mail_startup.interface_addr=Registry->ReadInteger("MailInterface");
*/
if(Registry->ValueExists("MailMaxDeliveryAttempts"))
mail_startup.max_delivery_attempts
......@@ -2140,8 +2139,10 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender)
if(Registry->ValueExists("FtpQwkTimeout"))
ftp_startup.qwk_timeout=Registry->ReadInteger("FtpQwkTimeout");
/*
if(Registry->ValueExists("FtpInterface"))
ftp_startup.interface_addr=Registry->ReadInteger("FtpInterface");
*/
if(Registry->ValueExists("FtpPort"))
ftp_startup.port=Registry->ReadInteger("FtpPort");
......@@ -2173,9 +2174,11 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender)
if(Registry->ValueExists("FtpOptions"))
ftp_startup.options=Registry->ReadInteger("FtpOptions");
/*
if(Registry->ValueExists("ServicesInterface"))
services_startup.interface_addr
=Registry->ReadInteger("ServicesInterface");
*/
if(Registry->ValueExists("ServicesAnswerSound"))
SAFECOPY(services_startup.answer_sound
......
......@@ -23,15 +23,17 @@ __fastcall TServicesCfgDlg::TServicesCfgDlg(TComponent* Owner)
void __fastcall TServicesCfgDlg::FormShow(TObject *Sender)
{
char str[128];
if(MainForm->services_startup.interface_addr==0)
/*
TODO: This is broken and stuff.
*/
if(MainForm->services_startup.outgoing4.s_addr==0)
NetworkInterfaceEdit->Text="<ANY>";
else {
sprintf(str,"%d.%d.%d.%d"
,(MainForm->services_startup.interface_addr>>24)&0xff
,(MainForm->services_startup.interface_addr>>16)&0xff
,(MainForm->services_startup.interface_addr>>8)&0xff
,MainForm->services_startup.interface_addr&0xff
,(MainForm->services_startup.outgoing4.s_addr>>24)&0xff
,(MainForm->services_startup.outgoing4.s_addr>>16)&0xff
,(MainForm->services_startup.outgoing4.s_addr>>8)&0xff
,MainForm->services_startup.outgoing4.s_addr&0xff
);
NetworkInterfaceEdit->Text=AnsiString(str);
}
......@@ -99,9 +101,9 @@ void __fastcall TServicesCfgDlg::OKButtonClick(TObject *Sender)
while(*p && *p!='.') p++;
if(*p=='.') p++;
addr|=atoi(p);
MainForm->services_startup.interface_addr=addr;
MainForm->services_startup.outgoing4.s_addr=addr;
} else
MainForm->services_startup.interface_addr=0;
MainForm->services_startup.outgoing4.s_addr=0;
MainForm->ServicesAutoStart=AutoStartCheckBox->Checked;
......
......@@ -55,37 +55,37 @@ void __fastcall TTelnetCfgDlg::FormShow(TObject *Sender)
{
char str[128];
if(MainForm->bbs_startup.telnet_interface==0)
if(MainForm->bbs_startup.outgoing4.s_addr==0)
TelnetInterfaceEdit->Text="<ANY>";
else {
sprintf(str,"%d.%d.%d.%d"
,(MainForm->bbs_startup.telnet_interface>>24)&0xff
,(MainForm->bbs_startup.telnet_interface>>16)&0xff
,(MainForm->bbs_startup.telnet_interface>>8)&0xff
,MainForm->bbs_startup.telnet_interface&0xff
,(MainForm->bbs_startup.outgoing4.s_addr>>24)&0xff
,(MainForm->bbs_startup.outgoing4.s_addr>>16)&0xff
,(MainForm->bbs_startup.outgoing4.s_addr>>8)&0xff
,MainForm->bbs_startup.outgoing4.s_addr&0xff
);
TelnetInterfaceEdit->Text=AnsiString(str);
}
if(MainForm->bbs_startup.rlogin_interface==0)
if(MainForm->bbs_startup.outgoing4.s_addr==0)
RLoginInterfaceEdit->Text="<ANY>";
else {
sprintf(str,"%d.%d.%d.%d"
,(MainForm->bbs_startup.rlogin_interface>>24)&0xff
,(MainForm->bbs_startup.rlogin_interface>>16)&0xff
,(MainForm->bbs_startup.rlogin_interface>>8)&0xff
,MainForm->bbs_startup.rlogin_interface&0xff
,(MainForm->bbs_startup.outgoing4.s_addr>>24)&0xff
,(MainForm->bbs_startup.outgoing4.s_addr>>16)&0xff
,(MainForm->bbs_startup.outgoing4.s_addr>>8)&0xff
,MainForm->bbs_startup.outgoing4.s_addr&0xff
);
RLoginInterfaceEdit->Text=AnsiString(str);
}
if(MainForm->bbs_startup.ssh_interface==0)
if(MainForm->bbs_startup.outgoing4.s_addr==0)
SshInterfaceEdit->Text="<ANY>";
else {
sprintf(str,"%d.%d.%d.%d"
,(MainForm->bbs_startup.ssh_interface>>24)&0xff
,(MainForm->bbs_startup.ssh_interface>>16)&0xff
,(MainForm->bbs_startup.ssh_interface>>8)&0xff
,MainForm->bbs_startup.ssh_interface&0xff
,(MainForm->bbs_startup.outgoing4.s_addr>>24)&0xff
,(MainForm->bbs_startup.outgoing4.s_addr>>16)&0xff
,(MainForm->bbs_startup.outgoing4.s_addr>>8)&0xff
,MainForm->bbs_startup.outgoing4.s_addr&0xff
);
SshInterfaceEdit->Text=AnsiString(str);
}
......@@ -148,9 +148,9 @@ void __fastcall TTelnetCfgDlg::OKBtnClick(TObject *Sender)
while(*p && *p!='.') p++;
if(*p=='.') p++;
addr|=atoi(p);
MainForm->bbs_startup.telnet_interface=addr;
MainForm->bbs_startup.outgoing4.s_addr=addr;
} else
MainForm->bbs_startup.telnet_interface=0;
MainForm->bbs_startup.outgoing4.s_addr=0;
SAFECOPY(str,RLoginInterfaceEdit->Text.c_str());
p=str;
......@@ -166,9 +166,9 @@ void __fastcall TTelnetCfgDlg::OKBtnClick(TObject *Sender)
while(*p && *p!='.') p++;
if(*p=='.') p++;
addr|=atoi(p);
MainForm->bbs_startup.rlogin_interface=addr;
MainForm->bbs_startup.outgoing4.s_addr=addr;
} else
MainForm->bbs_startup.rlogin_interface=0;
MainForm->bbs_startup.outgoing4.s_addr=0;
SAFECOPY(str,SshInterfaceEdit->Text.c_str());
p=str;
......@@ -184,9 +184,9 @@ void __fastcall TTelnetCfgDlg::OKBtnClick(TObject *Sender)
while(*p && *p!='.') p++;
if(*p=='.') p++;
addr|=atoi(p);
MainForm->bbs_startup.ssh_interface=addr;
MainForm->bbs_startup.outgoing4.s_addr=addr;
} else
MainForm->bbs_startup.ssh_interface=0;
MainForm->bbs_startup.outgoing4.s_addr=0;
MainForm->bbs_startup.telnet_port=TelnetPortEdit->Text.ToIntDef(23);
MainForm->bbs_startup.rlogin_port=RLoginPortEdit->Text.ToIntDef(513);
......
......@@ -58,14 +58,14 @@ void __fastcall TWebCfgDlg::FormShow(TObject *Sender)
char str[128];
char** p;
if(MainForm->web_startup.interface_addr==0)
if(MainForm->web_startup.outgoing4.s_addr==0)
NetworkInterfaceEdit->Text="<ANY>";
else {
sprintf(str,"%d.%d.%d.%d"
,(MainForm->web_startup.interface_addr>>24)&0xff
,(MainForm->web_startup.interface_addr>>16)&0xff
,(MainForm->web_startup.interface_addr>>8)&0xff
,MainForm->web_startup.interface_addr&0xff
,(MainForm->web_startup.outgoing4.s_addr>>24)&0xff
,(MainForm->web_startup.outgoing4.s_addr>>16)&0xff
,(MainForm->web_startup.outgoing4.s_addr>>8)&0xff
,MainForm->web_startup.outgoing4.s_addr&0xff
);
NetworkInterfaceEdit->Text=AnsiString(str);
}
......@@ -140,10 +140,10 @@ void __fastcall TWebCfgDlg::OKBtnClick(TObject *Sender)
while(*p && *p!='.') p++;
if(*p=='.') p++;
addr|=atoi(p);
MainForm->web_startup.interface_addr=addr;
MainForm->web_startup.outgoing4.s_addr=addr;
} else
MainForm->web_startup.interface_addr=0;
MainForm->web_startup.max_clients=MaxClientsEdit->Text.ToIntDef(0);
MainForm->web_startup.outgoing4.s_addr=0;
MainForm->web_startup.max_clients=MaxClientsEdit->Text.ToIntDef(10);
MainForm->web_startup.max_inactivity=MaxInactivityEdit->Text.ToIntDef(WEB_DEFAULT_MAX_INACTIVITY);
MainForm->web_startup.port=PortEdit->Text.ToIntDef(IPPORT_HTTP);
MainForm->WebAutoStart=AutoStartCheckBox->Checked;
......
......@@ -1658,6 +1658,12 @@ int sbbs_t::exec(csi_t *csi)
,useron.phone);
csi->logic=LOGIC_TRUE;
break;
case USER_STRING_IPADDR:
sprintf(useron.ipaddr,"%.*s",LEN_IPADDR,csi->str);
putuserrec(&cfg,useron.number,U_IPADDR,LEN_IPADDR
,useron.phone);
csi->logic=LOGIC_TRUE;
break;
case USER_STRING_COMMENT:
sprintf(useron.comment,"%.*s",LEN_COMMENT,csi->str);
putuserrec(&cfg,useron.number,U_COMMENT,LEN_COMMENT
......
......@@ -42,6 +42,7 @@
#define TIMEOUT_SOCK_LISTEN 30 /* seconds */
#define TIMEOUT_FTP_RESPONSE 300 /* seconds */
/* TODO: IPv6 */
int sbbs_t::exec_net(csi_t* csi)
{
char str[512],rsp[512],buf[1025],ch,*p,**pp,**pp1,**pp2;
......@@ -67,7 +68,7 @@ int sbbs_t::exec_net(csi_t* csi)
SOCKADDR_IN addr;
memset(&addr,0,sizeof(addr));
addr.sin_addr.s_addr = htonl(startup->telnet_interface);
addr.sin_addr.s_addr = htonl(startup->outgoing4.s_addr);
addr.sin_family = AF_INET;
if((i=bind(sock, (struct sockaddr *) &addr, sizeof (addr)))!=0) {
......@@ -550,10 +551,10 @@ SOCKET sbbs_t::ftp_data_sock(csi_t* csi, SOCKET ctrl_sock, SOCKADDR_IN* addr)
}
memset(addr,0,sizeof(SOCKADDR_IN));
addr->sin_addr.s_addr = htonl(startup->telnet_interface);
addr->sin_addr.s_addr = htonl(startup->outgoing4.s_addr);
addr->sin_family = AF_INET;
if(bind(data_sock, (struct sockaddr *)addr,sizeof(SOCKADDR_IN))!= 0) {
if(bind(data_sock, (struct sockaddr *)addr,xp_sockaddr_len(addr))!= 0) {
csi->socket_error=ERROR_VALUE;
close_socket(data_sock);
return(INVALID_SOCKET);
......@@ -645,24 +646,25 @@ bool sbbs_t::ftp_get(csi_t* csi, SOCKET ctrl_sock, char* src, char* dest, bool d
BOOL data_avail;
ulong total=0;
SOCKET data_sock;
SOCKADDR_IN addr;
union xp_sockaddr addr;
socklen_t addr_len;
FILE* fp=NULL;
struct timeval tv;
fd_set socket_set;
if((data_sock=ftp_data_sock(csi, ctrl_sock, &addr))==INVALID_SOCKET)
if((data_sock=ftp_data_sock(csi, ctrl_sock, &addr.in))==INVALID_SOCKET)
return(false);
if(csi->ftp_mode&CS_FTP_PASV) {
#if 0 // Debug
bprintf("Connecting to %s:%hd\r\n"
,inet_ntoa(addr.sin_addr)
,ntohs(addr.sin_port));
,inet_ntoa(addr.in.sin_addr)
,ntohs(addr.in.sin_port));
#endif
if(connect(data_sock,(struct sockaddr *)&addr,sizeof(addr))!=0) {
/* TODO: IPv6 */
if(connect(data_sock,&addr.addr,sizeof(SOCKADDR_IN))!=0) {
csi->socket_error=ERROR_VALUE;
close_socket(data_sock);
return(false);
......@@ -699,7 +701,7 @@ bool sbbs_t::ftp_get(csi_t* csi, SOCKET ctrl_sock, char* src, char* dest, bool d
SOCKET accept_sock;
addr_len=sizeof(addr);
if((accept_sock=accept_socket(data_sock,(struct sockaddr*)&addr,&addr_len))
if((accept_sock=accept_socket(data_sock,&addr,&addr_len))
==INVALID_SOCKET) {
csi->socket_error=ERROR_VALUE;
closesocket(data_sock);
......@@ -770,7 +772,7 @@ bool sbbs_t::ftp_put(csi_t* csi, SOCKET ctrl_sock, char* src, char* dest)
int result;
ulong total=0;
SOCKET data_sock;
SOCKADDR_IN addr;
union xp_sockaddr addr;
socklen_t addr_len;
FILE* fp=NULL;
bool error=false;
......@@ -782,7 +784,7 @@ bool sbbs_t::ftp_put(csi_t* csi, SOCKET ctrl_sock, char* src, char* dest)
if(!fexistcase(path))
return(false);
if((data_sock=ftp_data_sock(csi, ctrl_sock, &addr))==INVALID_SOCKET) {
if((data_sock=ftp_data_sock(csi, ctrl_sock, &addr.in))==INVALID_SOCKET) {
bprintf("ftp: failure, line %d",__LINE__);
return(false);
}
......@@ -791,11 +793,11 @@ bool sbbs_t::ftp_put(csi_t* csi, SOCKET ctrl_sock, char* src, char* dest)
#if 0 // Debug
bprintf("Connecting to %s:%hd\r\n"
,inet_ntoa(addr.sin_addr)
,ntohs(addr.sin_port));
,inet_ntoa(addr.in.sin_addr)