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 fcdb34df authored by rswindell's avatar rswindell

Simplify majority usage of sbbs_t::userdatdupe() by using default arguments.

Updated copyright dates.
parent c19623ed
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -108,7 +108,7 @@ bool sbbs_t::answer()
,startup->options&BBS_OPT_USE_2ND_RLOGIN ? str2 : str);
SAFECOPY(rlogin_pass
,startup->options&BBS_OPT_USE_2ND_RLOGIN ? str : str2);
useron.number=userdatdupe(0, U_ALIAS, LEN_ALIAS, rlogin_name, 0, 0);
useron.number=userdatdupe(0, U_ALIAS, LEN_ALIAS, rlogin_name);
if(useron.number) {
getuserdat(&cfg,&useron);
useron.misc&=~TERM_FLAGS;
......@@ -192,7 +192,7 @@ bool sbbs_t::answer()
rlogin_pass[i]=0;
lprintf(LOG_DEBUG,"Node %d SSH login: '%s'"
,cfg.node_num, rlogin_name);
useron.number=userdatdupe(0, U_ALIAS, LEN_ALIAS, rlogin_name, 0, 0);
useron.number=userdatdupe(0, U_ALIAS, LEN_ALIAS, rlogin_name);
if(useron.number) {
getuserdat(&cfg,&useron);
useron.misc&=~TERM_FLAGS;
......@@ -208,7 +208,13 @@ bool sbbs_t::answer()
else
sprintf(str,"(%04u) %-25s FAILED Password attempt"
,0,useron.alias);
logline(LOG_NOTICE,"+!",str);
/* crash here Sept-12-2010
str 0x06b3fc4c "(0000) Guest FAILED Password attempt: 'alex2010@sdf.lonestar.org'"
and Oct-6-2010
str 0x070ffc4c "(0000) Woot903 FAILED Password attempt: 'p67890pppsdsjhsdfhhfhnhnfhfhfdhjksdjkfdskw3902391=`'" char [261]
*/
logline(LOG_NOTICE,"+!",str);
bputs(text[PasswordPrompt]);
console|=CON_R_ECHOX;
getstr(tmp,LEN_PASS*2,K_UPPER|K_LOWPRIO|K_TAB);
......@@ -338,7 +344,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, 0, 0);
useron.number=userdatdupe(0, U_NOTE, LEN_NOTE, cid);
if(useron.number) {
getuserdat(&cfg, &useron);
if(!(useron.misc&AUTOLOGON) || !(useron.exempt&FLAG('V')))
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -1282,7 +1282,7 @@ int sbbs_t::getnodetopage(int all, int telegram)
return(-1);
if(str[0]=='\'') {
j=userdatdupe(0,U_HANDLE,LEN_HANDLE,str+1,0,0);
j=userdatdupe(0,U_HANDLE,LEN_HANDLE,str+1);
if(!j) {
bputs(text[UnknownUser]);
return(0);
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -1603,8 +1603,7 @@ int sbbs_t::exec(csi_t *csi)
if(trashcan(csi->str,"name"))
break;
if(cfg.uq&UQ_DUPREAL
&& userdatdupe(useron.number,U_NAME,LEN_NAME
,csi->str,0,0))
&& userdatdupe(useron.number,U_NAME,LEN_NAME,csi->str))
break;
sprintf(useron.name,"%.*s",LEN_NAME,csi->str);
putuserrec(&cfg,useron.number,U_NAME,LEN_NAME
......@@ -1615,8 +1614,7 @@ int sbbs_t::exec(csi_t *csi)
if(trashcan(csi->str,"name"))
break;
if(cfg.uq&UQ_DUPHAND
&& userdatdupe(useron.number,U_HANDLE,LEN_HANDLE
,csi->str,0,0))
&& userdatdupe(useron.number,U_HANDLE,LEN_HANDLE,csi->str))
break;
sprintf(useron.handle,"%.*s",LEN_HANDLE,csi->str);
putuserrec(&cfg,useron.number,U_HANDLE,LEN_HANDLE
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -184,7 +184,7 @@ int sbbs_t::exec_function(csi_t *csi)
netmail(csi->str,nulstr,0);
}
else if((i=finduser(csi->str))!=0
|| (cfg.msg_misc&MM_REALNAME && (i=userdatdupe(0,U_NAME,LEN_NAME,csi->str,false,false))!=0))
|| (cfg.msg_misc&MM_REALNAME && (i=userdatdupe(0,U_NAME,LEN_NAME,csi->str))!=0))
email(i,nulstr,nulstr,WM_EMAIL);
csi->logic=!i;
return(0);
......@@ -219,7 +219,7 @@ int sbbs_t::exec_function(csi_t *csi)
netmail(csi->str,nulstr,WM_FILE);
}
else if((i=finduser(csi->str))!=0
|| (cfg.msg_misc&MM_REALNAME && (i=userdatdupe(0,U_NAME,LEN_NAME,csi->str,false,false))!=0))
|| (cfg.msg_misc&MM_REALNAME && (i=userdatdupe(0,U_NAME,LEN_NAME,csi->str))!=0))
email(i,nulstr,nulstr,WM_EMAIL|WM_FILE);
csi->logic=!i;
return(0);
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -70,7 +70,7 @@ int sbbs_t::login(char *username, char *pw)
useron.number=matchuser(&cfg,str,FALSE);
if(!useron.number && (uchar)str[0]<0x7f && str[1]
&& isalpha(str[0]) && strchr(str,' ') && cfg.node_misc&NM_LOGON_R)
useron.number=userdatdupe(0,U_NAME,LEN_NAME,str,0,0);
useron.number=userdatdupe(0,U_NAME,LEN_NAME,str);
if(useron.number) {
getuserdat(&cfg,&useron);
if(useron.number && useron.misc&(DELETED|INACTIVE))
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -1421,7 +1421,7 @@ static BOOL email_addr_is_exempt(const char* addr)
if(*(p=netmail)=='<')
p++;
truncstr(p,">");
return userdatdupe(&scfg, 0, U_NETMAIL, LEN_NETMAIL, p, FALSE, FALSE);
return userdatdupe(&scfg, 0, U_NETMAIL, LEN_NETMAIL, p, /* del */FALSE, /* next */FALSE);
}
static void exempt_email_addr(const char* comment
......@@ -2120,7 +2120,7 @@ static uint smtp_matchuser(scfg_t *scfg, char *str, BOOL aliases, BOOL datdupe)
goto end;
if(datdupe)
usernum=userdatdupe(scfg, 0, U_NAME, LEN_NAME, name, FALSE, FALSE);
usernum=userdatdupe(scfg, 0, U_NAME, LEN_NAME, name, /* del */FALSE, /* next */FALSE);
else
usernum=matchuser(scfg, name, aliases);
......@@ -3600,7 +3600,7 @@ static void smtp_thread(void* arg)
SAFEPRINTF(relay_list,"%srelay.cfg",scfg.ctrl_dir);
if(relay_user.number==0 /* not authenticated, search for IP */
&& startup->options&MAIL_OPT_SMTP_AUTH_VIA_IP) {
relay_user.number=userdatdupe(&scfg, 0, U_NOTE, LEN_NOTE, host_ip, FALSE, FALSE);
relay_user.number=userdatdupe(&scfg, 0, U_NOTE, LEN_NOTE, host_ip, /* del */FALSE, /* next */FALSE);
if(relay_user.number) {
getuserdat(&scfg,&relay_user);
if(relay_user.laston < time(NULL)-(60*60)) /* logon in past hour? */
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -115,7 +115,7 @@ BOOL sbbs_t::newuser()
useron.prot=cfg.new_prot;
SAFECOPY(useron.comp,client_name); /* hostname or CID name */
SAFECOPY(useron.note,cid); /* IP address or CID number */
if((i=userdatdupe(0,U_NOTE,LEN_NOTE,cid,true,false))!=0) { /* Duplicate IP address */
if((i=userdatdupe(0,U_NOTE,LEN_NOTE,cid, /* del */true))!=0) { /* Duplicate IP address */
sprintf(useron.comment,"Warning: same IP address as user #%d %s"
,i,username(&cfg,i,str));
logline(LOG_NOTICE,"N!",useron.comment);
......@@ -218,8 +218,7 @@ BOOL sbbs_t::newuser()
if (!check_name(&cfg,useron.name)
|| !strchr(useron.name,' ')
|| (cfg.uq&UQ_DUPREAL
&& userdatdupe(useron.number,U_NAME,LEN_NAME
,useron.name,0,0)))
&& userdatdupe(useron.number,U_NAME,LEN_NAME,useron.name)))
bputs(text[YouCantUseThatName]);
else
break;
......@@ -242,7 +241,7 @@ BOOL sbbs_t::newuser()
,K_LINE|K_EDIT|K_AUTODEL|(cfg.uq&UQ_NOEXASC))
|| strchr(useron.handle,0xff)
|| (cfg.uq&UQ_DUPHAND
&& userdatdupe(0,U_HANDLE,LEN_HANDLE,useron.handle,0,0))
&& userdatdupe(0,U_HANDLE,LEN_HANDLE,useron.handle))
|| trashcan(useron.handle,"name"))
bputs(text[YouCantUseThatName]);
else
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -135,7 +135,7 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode)
if(stricmp(touser,"ALL")
&& !(cfg.sub[subnum]->misc&(SUB_PNET|SUB_FIDO|SUB_QNET|SUB_INET|SUB_ANON))) {
if(cfg.sub[subnum]->misc&SUB_NAME) {
if(!userdatdupe(useron.number,U_NAME,LEN_NAME,touser,0,0)) {
if(!userdatdupe(useron.number,U_NAME,LEN_NAME,touser)) {
bputs(text[UnknownUser]);
return(false);
}
......@@ -457,6 +457,21 @@ extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, client_t*
if(smb->subnum==INVALID_SUB) { /* e-mail */
/* exception here during recycle:
sbbs.dll!savemsg(scfg_t * cfg, smb_t * smb, smbmsg_t * msg, client_t * client, char * msgbuf) Line 473 + 0xf bytes C++
sbbs.dll!js_save_msg(JSContext * cx, JSObject * obj, unsigned int argc, long * argv, long * rval) Line 1519 + 0x25 bytes C
js32.dll!js_Invoke(JSContext * cx, unsigned int argc, unsigned int flags) Line 1375 + 0x17 bytes C
js32.dll!js_Interpret(JSContext * cx, unsigned char * pc, long * result) Line 3944 + 0xf bytes C
js32.dll!js_Execute(JSContext * cx, JSObject * chain, JSScript * script, JSStackFrame * down, unsigned int flags, long * result) Line 1633 + 0x13 bytes C
js32.dll!JS_ExecuteScript(JSContext * cx, JSObject * obj, JSScript * script, long * rval) Line 4188 + 0x19 bytes C
sbbs.dll!sbbs_t::js_execfile(const char * cmd, const char * startup_dir) Line 686 + 0x27 bytes C++
sbbs.dll!sbbs_t::external(const char * cmdline, long mode, const char * startup_dir) Line 413 + 0x1e bytes C++
sbbs.dll!event_thread(void * arg) Line 2745 + 0x71 bytes C++
apparently the event_thread is sharing an scfg_t* with another thread! */
smb->status.max_crcs=cfg->mail_maxcrcs;
smb->status.max_age=cfg->mail_maxage;
smb->status.max_msgs=0; /* unlimited */
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -891,7 +891,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
i=atoi(str);
if(!i) {
if(cfg.sub[subnum]->misc&SUB_NAME)
i=userdatdupe(0,U_NAME,LEN_NAME,str,0,0);
i=userdatdupe(0,U_NAME,LEN_NAME,str);
else
i=matchuser(&cfg,str,TRUE /* sysop_alias */);
}
......@@ -957,7 +957,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
if(noyes(text[AreYouSureQ]))
break;
purgeuser(cfg.sub[subnum]->misc&SUB_NAME
? userdatdupe(0,U_NAME,LEN_NAME,msg.from,0,0)
? userdatdupe(0,U_NAME,LEN_NAME,msg.from)
: matchuser(&cfg,msg.from,FALSE));
break;
case 'C': /* Change message attributes */
......@@ -1023,7 +1023,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
break;
case 'U': /* User edit */
useredit(cfg.sub[subnum]->misc&SUB_NAME
? userdatdupe(0,U_NAME,LEN_NAME,msg.from,0,0)
? userdatdupe(0,U_NAME,LEN_NAME,msg.from)
: matchuser(&cfg,msg.from,TRUE /* sysop_alias */));
break;
case 'V': /* Validate message */
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -440,7 +440,7 @@ public:
uint getusrgrp(uint subnum);
uint userdatdupe(uint usernumber, uint offset, uint datlen, char *dat
,bool del, bool next);
,bool del=false, bool next=false);
ulong gettimeleft(bool handle_out_of_time=true);
bool gettimeleft_inside;
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment