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

Move login username/number parsing into a the C++ code (from login.js) since we

need that internal for SSH and RLogin support of fast-logons.
So, now, even if logging in via SSH or Rlogin, the sys_status SS_FASTLOGON
flag will be set when the user specifies "!username-or-number" during logon and
then the logon.js can use that to determine what to display (or not) to the
user, during logon.

The QWK logon support ("*username-or-number") is also handled in this new
sbbs_t method: parse_login().

This means the fast_logon_char is no longer configurable (hard-coded to '!')
and the modopts.ini options are going to be parsed by logon.js from the [logon]
section (not the [login] section).

You still must set fast_logon=true in the [logon] section of modopts.ini to
enable the fast-logon option for users.
parent 570ea3a0
......@@ -99,7 +99,7 @@ bool sbbs_t::answer()
,LEN_ALIAS*2,str2
,terminal);
SAFECOPY(rlogin_term, terminal);
SAFECOPY(rlogin_name, str2);
SAFECOPY(rlogin_name, parse_login(str2));
SAFECOPY(rlogin_pass, str);
/* Truncate terminal speed (e.g. "/57600") from terminal-type string
(but keep full terminal type/speed string in rlogin_term): */
......@@ -192,7 +192,7 @@ bool sbbs_t::answer()
pthread_mutex_lock(&ssh_mutex);
ctmp = get_crypt_attribute(ssh_session, CRYPT_SESSINFO_USERNAME);
if (ctmp) {
SAFECOPY(rlogin_name, ctmp);
SAFECOPY(rlogin_name, parse_login(ctmp));
free_crypt_attrstr(ctmp);
ctmp = get_crypt_attribute(ssh_session, CRYPT_SESSINFO_PASSWORD);
if (ctmp) {
......
......@@ -36,6 +36,22 @@
#include "sbbs.h"
#include "cmdshell.h"
char* sbbs_t::parse_login(char* str)
{
sys_status &= ~(SS_QWKLOGON|SS_FASTLOGON);
if(*str == '*') {
sys_status |= SS_QWKLOGON;
return str + 1;
}
if(*str == '!') {
sys_status |= SS_FASTLOGON;
return str + 1;
}
return str;
}
int sbbs_t::login(char *username, char *pw_prompt, const char* user_pw, const char* sys_pw)
{
char str[128];
......@@ -43,32 +59,20 @@ int sbbs_t::login(char *username, char *pw_prompt, const char* user_pw, const ch
long useron_misc=useron.misc;
useron.number=0;
#if 0
if(cfg.node_dollars_per_call && noyes(text[AreYouSureQ]))
return(LOGIC_FALSE);
#endif
SAFECOPY(str,username);
if(str[0]=='*') {
memmove(str,str+1,strlen(str));
qwklogon=1;
}
else
qwklogon=0;
username = parse_login(username);
if(!(cfg.node_misc&NM_NO_NUM) && isdigit((uchar)str[0])) {
useron.number=atoi(str);
if(!(cfg.node_misc&NM_NO_NUM) && isdigit((uchar)username[0])) {
useron.number=atoi(username);
getuserdat(&cfg,&useron);
if(useron.number && useron.misc&(DELETED|INACTIVE))
useron.number=0;
}
if(!useron.number) {
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);
useron.number=matchuser(&cfg,username,FALSE);
if(!useron.number && (uchar)username[0]<0x7f && str[1]
&& isalpha(username[0]) && strchr(username,' ') && cfg.node_misc&NM_LOGON_R)
useron.number=userdatdupe(0,U_NAME,LEN_NAME,username);
if(useron.number) {
getuserdat(&cfg,&useron);
if(useron.number && useron.misc&(DELETED|INACTIVE))
......@@ -77,7 +81,7 @@ int sbbs_t::login(char *username, char *pw_prompt, const char* user_pw, const ch
if(!useron.number) {
if((cfg.node_misc&NM_LOGON_P) && pw_prompt != NULL) {
SAFECOPY(useron.alias,str);
SAFECOPY(useron.alias,username);
bputs(pw_prompt);
console|=CON_R_ECHOX;
getstr(str,LEN_PASS*2,K_UPPER|K_LOWPRIO|K_TAB);
......@@ -92,9 +96,9 @@ int sbbs_t::login(char *username, char *pw_prompt, const char* user_pw, const ch
,0,useron.alias);
logline(LOG_NOTICE,"+!",tmp);
} else {
badlogin(str, NULL);
badlogin(username, NULL);
bputs(text[UnknownUser]);
sprintf(tmp,"Unknown User '%s'",str);
sprintf(tmp,"Unknown User '%s'",username);
logline(LOG_NOTICE,"+!",tmp);
}
useron.misc=useron_misc;
......
......@@ -70,7 +70,7 @@ bool sbbs_t::logon()
#endif
if(useron.rest&FLAG('Q'))
qwklogon=1;
sys_status |= SS_QWKLOGON;
if(SYSOP && !(cfg.sys_misc&SM_R_SYSOP)) {
hangup();
return(false);
......@@ -202,7 +202,7 @@ bool sbbs_t::logon()
sprintf(str,"%smsgs/n%3.3u.ixb",cfg.data_dir,cfg.node_num);
remove(str); /* remove any pending node message indices */
if(!SYSOP && online==ON_REMOTE && !qwklogon) {
if(!SYSOP && online==ON_REMOTE && !(sys_status&SS_QWKLOGON)) {
rioctl(IOCM|ABORT); /* users can't abort anything */
rioctl(IOCS|ABORT);
}
......@@ -224,7 +224,7 @@ bool sbbs_t::logon()
gettimeleft();
sprintf(str,"%sfile/%04u.dwn",cfg.data_dir,useron.number);
batch_add_list(str);
if(!qwklogon) { /* QWK Nodes don't go through this */
if(!(sys_status&SS_QWKLOGON)) { /* QWK Nodes don't go through this */
if(cfg.sys_pwdays
&& (ulong)logontime>(useron.pwmod+((ulong)cfg.sys_pwdays*24UL*60UL*60UL))) {
......@@ -417,7 +417,7 @@ bool sbbs_t::logon()
,useron.number,useron.alias,totallogons,useron.ltoday);
logline("++",str);
if(!qwklogon && cfg.logon_mod[0])
if(!(sys_status&SS_QWKLOGON) && cfg.logon_mod[0])
exec_bin(cfg.logon_mod,&main_csi);
if(thisnode.status!=NODE_QUIET && (!REALSYSOP || cfg.sys_misc&SM_SYSSTAT)) {
......@@ -442,7 +442,7 @@ bool sbbs_t::logon()
external(cmdstr(cfg.sys_logon,nulstr,nulstr,NULL),EX_STDOUT); /* EX_SH */
}
if(qwklogon)
if(sys_status&SS_QWKLOGON)
return(true);
sys_status|=SS_PAUSEON; /* always force pause on during this section */
......
......@@ -4311,11 +4311,8 @@ void sbbs_t::reset_logon_vars(void)
{
int i;
/* bools */
qwklogon=false;
sys_status&=~(SS_USERON|SS_TMPSYSOP|SS_LCHAT|SS_ABORT
|SS_PAUSEON|SS_PAUSEOFF|SS_EVENT|SS_NEWUSER|SS_NEWDAY);
|SS_PAUSEON|SS_PAUSEOFF|SS_EVENT|SS_NEWUSER|SS_NEWDAY|SS_QWKLOGON|SS_FASTLOGON);
cid[0]=0;
wordwrap[0]=0;
question[0]=0;
......@@ -4502,7 +4499,7 @@ void node_thread(void* arg)
login_success = true;
listAddNodeData(&current_logins, sbbs->client.addr, strlen(sbbs->client.addr)+1, sbbs->cfg.node_num, LAST_NODE);
if(sbbs->qwklogon) {
if(sbbs->sys_status&SS_QWKLOGON) {
sbbs->getsmsg(sbbs->useron.number);
sbbs->qwk_sec();
} else while(sbbs->useron.number
......@@ -4663,6 +4660,16 @@ void node_thread(void* arg)
[External Code]
node_threads_running {value=0 mutex={DebugInfo=0x00000000 <NULL> LockCount=-6 RecursionCount=0 ...} } protected_uint32_t
and again on July-10-2019:
ntdll.dll!RtlpWaitOnCriticalSection() Unknown
ntdll.dll!RtlpEnterCriticalSectionContended() Unknown
ntdll.dll!_RtlEnterCriticalSection@4() Unknown
sbbs.dll!pthread_mutex_lock(_RTL_CRITICAL_SECTION * mutex) Line 171 C
sbbs.dll!protected_uint32_adjust(protected_uint32_t * i, int adjustment) Line 244 C
sbbs.dll!update_clients() Line 187 C++
> sbbs.dll!node_thread(void * arg) Line 4668 C++
*/
update_clients();
thread_down();
......
......@@ -800,6 +800,7 @@ public:
/* login.ccp */
int login(char *user_name, char *pw_prompt, const char* user_pw = NULL, const char* sys_pw = NULL);
void badlogin(char* user, char* passwd, const char* protocol=NULL, xp_sockaddr* addr=NULL, bool delay=true);
char* parse_login(char*);
/* answer.cpp */
bool answer();
......@@ -955,7 +956,6 @@ public:
BOOL hacklog(char* prot, char* text);
/* qwk.cpp */
bool qwklogon;
ulong qwkmail_last;
void qwk_sec(void);
uint total_qwknodes;
......
......@@ -714,6 +714,8 @@ typedef enum { /* Values for xtrn_t.event */
#define SS_FILEXFER (1L<<27) /* File transfer in progress, halt spy */
#define SS_SSH (1L<<28) /* Current login via SSH */
#define SS_MOFF (1L<<29) /* Disable automatic messages */
#define SS_QWKLOGON (1L<<30) /* QWK logon */
#define SS_FASTLOGON (1<<31) /* Fast logon */
/* Bits in 'mode' for getkey and getstr */
#define K_NONE 0 /* Use as a place holder for no mode flags */
......
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