Skip to content
Snippets Groups Projects
Commit d0e5401b authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Merge branch 'master' of gitlab.synchro.net:main/sbbs

parents 6ec583a7 bbe7f4e2
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
/* Synchronet FidoNet-related routines */
/* $Id: fido.cpp,v 1.82 2020/07/15 06:12:56 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -15,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -94,39 +80,3 @@ bool sbbs_t::lookup_netuser(char *into)
fclose(stream);
return(false);
}
/****************************************************************************/
/* Returns the FidoNet address kept in str as ASCII. */
/****************************************************************************/
faddr_t atofaddr(scfg_t* cfg, char *str)
{
char *p;
faddr_t addr;
addr.zone=addr.net=addr.node=addr.point=0;
if((p=strchr(str,':'))!=NULL) {
addr.zone=atoi(str);
addr.net=atoi(p+1);
}
else {
if(cfg->total_faddrs)
addr.zone=cfg->faddr[0].zone;
else
addr.zone=1;
addr.net=atoi(str);
}
if(!addr.zone) /* no such thing as zone 0 */
addr.zone=1;
if((p=strchr(str,'/'))!=NULL)
addr.node=atoi(p+1);
else {
if(cfg->total_faddrs)
addr.net=cfg->faddr[0].net;
else
addr.net=1;
addr.node=atoi(str);
}
if((p=strchr(str,'.'))!=NULL)
addr.point=atoi(p+1);
return(addr);
}
......@@ -2971,6 +2971,7 @@ static void smtp_thread(void* arg)
if(startup->inbound_sound[0] && !(startup->options&MAIL_OPT_MUTE))
PlaySound(startup->inbound_sound, NULL, SND_ASYNC|SND_FILENAME);
#endif
SAFEPRINTF(domain_list,"%sdomains.cfg",scfg.ctrl_dir);
addr_len=sizeof(server_addr);
......@@ -4664,7 +4665,6 @@ static void smtp_thread(void* arg)
*cp=0;
dest_port=atoi(cp+1);
}
SAFEPRINTF(domain_list,"%sdomains.cfg",scfg.ctrl_dir);
if((stricmp(dest_host,scfg.sys_inetaddr)!=0
&& stricmp(dest_host,startup->host_name)!=0
&& findstr(dest_host,domain_list)==FALSE)
......@@ -4927,7 +4927,10 @@ static void smtp_thread(void* arg)
&& scfg.sys_misc&SM_FWDTONET
&& (user.misc&NETMAIL || forward)
&& tp!=NULL && smb_netaddr_type(user.netmail)==NET_INTERNET
&& !strstr(tp,scfg.sys_inetaddr)) {
&& stricmp(tp + 1, scfg.sys_inetaddr) != 0
&& stricmp(tp + 1, startup->host_name) != 0
&& findstr(tp + 1, domain_list)==FALSE
) {
lprintf(LOG_INFO,"%04d %s %s Forwarding to: %s"
,socket, client.protocol, client_id, user.netmail);
fprintf(rcptlst,"%s=%u\n",smb_hfieldtype(RECIPIENTNETTYPE),NET_INTERNET);
......
/* netmail.cpp */
/* Synchronet network mail-related functions */
/* $Id: netmail.cpp,v 1.69 2020/05/01 00:10:07 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,30 +13,25 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#include "sbbs.h"
#include "qwk.h"
faddr_t atofaddr(scfg_t* cfg, char *str);
void pt_zone_kludge(fmsghdr_t hdr,int fido);
/****************************************************************************/
/* Returns the FidoNet address (struct) parsed from str (in ASCII text). */
/****************************************************************************/
static faddr_t atofaddr(scfg_t* cfg, const char *str)
{
return smb_atofaddr(&cfg->faddr[0], str);
}
/****************************************************************************/
/* Send FidoNet/QWK/Internet NetMail from BBS */
/****************************************************************************/
......@@ -1431,18 +1422,35 @@ bool sbbs_t::qnetmail(const char *into, const char *subj, long mode, smb_t* resm
extern "C" BOOL is_supported_netmail_addr(scfg_t* cfg, const char* addr)
{
const char* p;
fidoaddr_t faddr;
if((p = strchr(addr, '@')) == NULL)
return FALSE;
p++;
switch (smb_netaddr_type(addr)) {
case NET_FIDO:
return INT_TO_BOOL(cfg->total_faddrs && (cfg->netmail_misc&NMAIL_ALLOW));
if(!(cfg->netmail_misc&NMAIL_ALLOW))
return FALSE;
if(cfg->total_faddrs < 1)
return FALSE;
faddr = atofaddr(cfg, p);
for(int i = 0; i < cfg->total_faddrs; i++)
if(memcmp(&cfg->faddr[i], &faddr, sizeof(faddr)) == 0)
return FALSE;
return TRUE;
case NET_INTERNET:
return INT_TO_BOOL(cfg->inetmail_misc&NMAIL_ALLOW);
if(!(cfg->inetmail_misc&NMAIL_ALLOW))
return FALSE;
if(stricmp(p, cfg->sys_inetaddr) == 0)
return FALSE;
char domain_list[MAX_PATH + 1];
SAFEPRINTF(domain_list, "%sdomains.cfg", cfg->ctrl_dir);
return findstr(p, domain_list) == FALSE;
case NET_QWK:
{
char fulladdr[256] = "";
const char* p = strchr(addr, '@');
if(p == NULL)
return FALSE;
qwk_route(cfg, p + 1, fulladdr, sizeof(fulladdr)-1);
qwk_route(cfg, p, fulladdr, sizeof(fulladdr)-1);
return fulladdr[0] != 0;
}
default:
......
......@@ -570,16 +570,17 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
time_t elapsed = time(NULL)-start;
if(elapsed < 1)
elapsed = 1;
byte_estimate_to_str(ftell(qwk), tmp, sizeof(tmp), 1024, 1);
if(online == ON_REMOTE)
bprintf("\r\n\r\n\1n\1hPacked %lu messages (%lu bytes) in %lu seconds "
bprintf("\r\n\r\n\1n\1hPacked %lu messages (%s bytes) in %lu seconds "
"(%lu messages/second)."
,(*msgcnt)+mailmsgs
,ftell(qwk)
,elapsed
,tmp
,(ulong)elapsed
,((*msgcnt)+mailmsgs) / elapsed);
lprintf(LOG_INFO, "packed %lu messages (%lu bytes) in %lu seconds (%lu msgs/sec)"
lprintf(LOG_INFO, "packed %lu messages (%s bytes) in %lu seconds (%lu msgs/sec)"
,(*msgcnt)+mailmsgs
,ftell(qwk)
,tmp
,(ulong)elapsed
,((*msgcnt)+mailmsgs)/elapsed);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment