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

O-restriction forces sent netmail to come from user's alias too

Users with the 'O' restriction (automatically set if a new user has the same "real name" as another account, and that's allowed by the sysop) will send netmail from their alias and not their real name to prevent impersonation of another user.
parent 5fcc9090
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2666 passed
......@@ -536,7 +536,7 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode, bool
if(!strcmp(sp,"EMAILADDR"))
return(usermailaddr(&cfg, str
,cfg.inetmail_misc&NMAIL_ALIAS ? useron.alias : useron.name));
,(cfg.inetmail_misc&NMAIL_ALIAS) || (useron.rest&FLAG('O')) ? useron.alias : useron.name));
if(strcmp(sp, "NETMAIL") == 0)
return useron.netmail;
......
......@@ -181,7 +181,7 @@ static JSBool js_user_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
break;
case USER_PROP_EMAIL:
s=usermailaddr(scfg, tmp
,scfg->inetmail_misc&NMAIL_ALIAS ? p->user->alias : p->user->name);
,(scfg->inetmail_misc&NMAIL_ALIAS) || (p->user->rest&FLAG('O')) ? p->user->alias : p->user->name);
break;
case USER_PROP_ADDRESS:
s=p->user->address;
......
......@@ -154,7 +154,7 @@ bool sbbs_t::netmail(const char *into, const char *title, long mode, smb_t* resm
truncsp(to); /* Truncate off space */
SAFECOPY(from, cfg.netmail_misc&NMAIL_ALIAS ? useron.alias : useron.name);
SAFECOPY(from, (cfg.netmail_misc&NMAIL_ALIAS) || (useron.rest&FLAG('O')) ? useron.alias : useron.name);
/* Look-up in nodelist? */
......@@ -620,7 +620,7 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub)
smb_hfield(&msg,RECIPIENTNETADDR,strlen(to),to);
bprintf(text[NetMailing],name,to
,cfg.inetmail_misc&NMAIL_ALIAS ? useron.alias : useron.name
,(cfg.inetmail_misc&NMAIL_ALIAS) || (useron.rest&FLAG('O')) ? useron.alias : useron.name
,cfg.sys_inetaddr);
}
......@@ -770,7 +770,7 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub)
strcat(str,tmp);
}
else
SAFECOPY(str,cfg.netmail_misc&NMAIL_ALIAS ? useron.alias : useron.name);
SAFECOPY(str,(cfg.netmail_misc&NMAIL_ALIAS) || (useron.rest&FLAG('O')) ? useron.alias : useron.name);
SAFECOPY(hdr.from,str);
SAFECOPY(hdr.to,to);
......@@ -992,7 +992,7 @@ bool sbbs_t::inetmail(const char *into, const char *subj, long mode, smb_t* resm
/* Get this user's Internet mailing address */
usermailaddr(&cfg,your_addr
,cfg.inetmail_misc&NMAIL_ALIAS ? useron.alias : useron.name);
,(cfg.inetmail_misc&NMAIL_ALIAS) || (useron.rest&FLAG('O')) ? useron.alias : useron.name);
if(rcpt_count > 1) { /* remove "self" from reply-all list */
int found = strListFind(rcpt_list, your_addr, /* case_sensitive */FALSE);
......@@ -1141,7 +1141,7 @@ bool sbbs_t::inetmail(const char *into, const char *subj, long mode, smb_t* resm
if(rcpt_count > 1)
smb_hfield_str(&msg, RECIPIENTLIST, to_list);
smb_hfield_str(&msg,SENDER,cfg.inetmail_misc&NMAIL_ALIAS ? useron.alias : useron.name);
smb_hfield_str(&msg,SENDER,(cfg.inetmail_misc&NMAIL_ALIAS) || (useron.rest&FLAG('O')) ? useron.alias : useron.name);
SAFEPRINTF(str,"%u",useron.number);
smb_hfield_str(&msg,SENDEREXT,str);
......
......@@ -236,7 +236,7 @@ BOOL sbbs_t::newuser()
if(!useron.name[0])
SAFECOPY(useron.name,useron.alias);
else if(!(cfg.uq&UQ_DUPREAL) && userdatdupe(useron.number,U_NAME,LEN_NAME,useron.name) > 0)
useron.rest |= FLAG('O'); // Can't post using real name (it's a duplicate)
useron.rest |= FLAG('O'); // Can't post or send netmail using real name (it's a duplicate)
if(!online) return(FALSE);
if(!useron.handle[0])
SAFECOPY(useron.handle,useron.alias);
......
......@@ -506,6 +506,9 @@ void net_cfg()
"contain their alias as the `From User`, set this option to `Yes`. If you\n"
"want all NetMail to be sent using users' real names, set this option to\n"
"`No`.\n"
"\n"
"Users with the '`O`' restriction flag will always send netmail using\n"
"their alias (their real name is a duplicate of another user account)."
;
i=uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0
,"Use Aliases in NetMail",uifcYesNoOpts);
......@@ -752,6 +755,9 @@ void net_cfg()
"Internet E-mail contain their alias as the `From User`, set this option to\n"
"`Yes`. If you want all E-mail to be sent using users' real names, set this\n"
"option to `No`.\n"
"\n"
"Users with the '`O`' restriction flag will always send netmail using\n"
"their alias (their real name is a duplicate of another user account)."
;
i=uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0
,"Use Aliases in Internet E-mail",uifcYesNoOpts);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment