--- sbbs/src/sbbs3/newuser.cpp 2018/04/24 16:41:23 1.1.1.1 +++ sbbs/src/sbbs3/newuser.cpp 2018/04/24 16:42:43 1.1.1.2 @@ -2,13 +2,13 @@ /* Synchronet new user routine */ -/* $Id: newuser.cpp,v 1.1.1.1 2018/04/24 16:41:23 root Exp $ */ +/* $Id: newuser.cpp,v 1.1.1.2 2018/04/24 16:42:43 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 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 * @@ -68,7 +68,7 @@ BOOL sbbs_t::newuser() getnodedat(cfg.node_num,&thisnode,0); if(thisnode.misc&NODE_LOCK) { bputs(text[NodeLocked]); - logline("N!","New user locked node logon attempt"); + logline(LOG_WARNING,"N!","New user locked node logon attempt"); hangup(); return(FALSE); } @@ -80,7 +80,7 @@ BOOL sbbs_t::newuser() } getnodedat(cfg.node_num,&thisnode,1); thisnode.status=NODE_NEWUSER; - thisnode.connection=0xffff; + thisnode.connection=node_connection; putnodedat(cfg.node_num,&thisnode); memset(&useron,0,sizeof(user_t)); /* Initialize user info to null */ if(cfg.new_pass[0] && online==ON_REMOTE) { @@ -91,7 +91,7 @@ BOOL sbbs_t::newuser() if(!strcmp(str,cfg.new_pass)) break; sprintf(tmp,"NUP Attempted: '%s'",str); - logline("N!",tmp); + logline(LOG_NOTICE,"N!",tmp); } if(c==4) { sprintf(str,"%snupguess.msg",cfg.text_dir); @@ -113,11 +113,12 @@ BOOL sbbs_t::newuser() useron.expire=0; useron.sex=' '; useron.prot=cfg.new_prot; - SAFECOPY(useron.note,cid); /* Caller ID if supported, NULL otherwise */ - if((i=userdatdupe(0,U_NOTE,LEN_NOTE,cid,true))!=0) { /* Duplicate IP address */ + 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, /* del */true))!=0) { /* Duplicate IP address */ sprintf(useron.comment,"Warning: same IP address as user #%d %s" ,i,username(&cfg,i,str)); - logline("N!",useron.comment); + logline(LOG_NOTICE,"N!",useron.comment); } SAFECOPY(useron.alias,"New"); /* just for status line */ @@ -159,14 +160,14 @@ BOOL sbbs_t::newuser() while(online) { - if(autoterm || yesno(text[AutoTerminalQ])) { + if(autoterm || (text[AutoTerminalQ][0] && yesno(text[AutoTerminalQ]))) { useron.misc|=AUTOTERM; useron.misc|=autoterm; } else useron.misc&=~AUTOTERM; if(!(useron.misc&AUTOTERM)) { - if(yesno(text[AnsiTerminalQ])) + if(text[AnsiTerminalQ][0] && yesno(text[AnsiTerminalQ])) useron.misc|=ANSI; else useron.misc&=~ANSI; @@ -174,14 +175,14 @@ BOOL sbbs_t::newuser() if(useron.misc&ANSI) { useron.rows=0; /* Auto-rows */ - if(useron.misc&(RIP|WIP|HTML) || yesno(text[ColorTerminalQ])) + if(useron.misc&(RIP|WIP|HTML) || text[ColorTerminalQ][0]==0 || yesno(text[ColorTerminalQ])) useron.misc|=COLOR; else useron.misc&=~COLOR; } else useron.rows=24; - if(!yesno(text[ExAsciiTerminalQ])) + if(text[ExAsciiTerminalQ][0] && !yesno(text[ExAsciiTerminalQ])) useron.misc|=NO_EXASCII; else useron.misc&=~NO_EXASCII; @@ -200,35 +201,28 @@ BOOL sbbs_t::newuser() bputs(text[EnterYourRealName]); getstr(useron.alias,LEN_ALIAS,kmode); truncsp(useron.alias); - if(useron.alias[0]<=' ' || !isalpha(useron.alias[0]) - || alias(&cfg,useron.alias,tmp)!=useron.alias - || !stricmp(useron.alias,cfg.sys_id) - || strchr(useron.alias,0xff) - || matchuser(&cfg,useron.alias,TRUE /* sysop_alias */) - || trashcan(useron.alias,"name") + if (!check_name(&cfg,useron.alias) || (!(cfg.uq&UQ_ALIASES) && !strchr(useron.alias,' '))) { bputs(text[YouCantUseThatName]); - if(!yesno(text[ContinueQ])) + if(text[ContinueQ][0] && !yesno(text[ContinueQ])) return(FALSE); - continue; + continue; } break; } if(!online) return(FALSE); - if(cfg.uq&UQ_ALIASES && cfg.uq&UQ_REALNAME) { + if((cfg.uq&UQ_ALIASES) && (cfg.uq&UQ_REALNAME)) { while(online) { bputs(text[EnterYourRealName]); - if(!getstr(useron.name,LEN_NAME,kmode) - || trashcan(useron.name,"name") - || strchr(useron.name,0xff) + getstr(useron.name,LEN_NAME,kmode); + if (!check_name(&cfg,useron.name) || !strchr(useron.name,' ') - || (cfg.uq&UQ_DUPREAL - && userdatdupe(useron.number,U_NAME,LEN_NAME - ,useron.name,0))) + || ((cfg.uq&UQ_DUPREAL) + && userdatdupe(useron.number,U_NAME,LEN_NAME,useron.name))) bputs(text[YouCantUseThatName]); else break; - if(!yesno(text[ContinueQ])) + if(text[ContinueQ][0] && !yesno(text[ContinueQ])) return(FALSE); } } @@ -241,18 +235,18 @@ BOOL sbbs_t::newuser() if(!online) return(FALSE); if(!useron.handle[0]) sprintf(useron.handle,"%.*s",LEN_HANDLE,useron.alias); - while(cfg.uq&UQ_HANDLE && online) { + while((cfg.uq&UQ_HANDLE) && online) { bputs(text[EnterYourHandle]); if(!getstr(useron.handle,LEN_HANDLE ,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)) + || ((cfg.uq&UQ_DUPHAND) + && userdatdupe(0,U_HANDLE,LEN_HANDLE,useron.handle)) || trashcan(useron.handle,"name")) bputs(text[YouCantUseThatName]); else break; - if(!yesno(text[ContinueQ])) + if(text[ContinueQ][0] && !yesno(text[ContinueQ])) return(FALSE); } if(!online) return(FALSE); @@ -263,12 +257,12 @@ BOOL sbbs_t::newuser() break; } if(!online) return(FALSE); - while(cfg.uq&UQ_LOCATION && online) { + while((cfg.uq&UQ_LOCATION) && online) { bputs(text[EnterYourCityState]); if(getstr(useron.location,LEN_LOCATION,kmode) - && (cfg.uq&UQ_NOCOMMAS || strchr(useron.location,','))) + && ((cfg.uq&UQ_NOCOMMAS) || strchr(useron.location,','))) break; - bputs("\r\nYou must include a comma between the city and state.\r\n"); + bputs(text[CommaInLocationRequired]); useron.location[0]=0; } if(cfg.uq&UQ_ADDRESS) @@ -280,8 +274,11 @@ BOOL sbbs_t::newuser() } if(!online) return(FALSE); if(cfg.uq&UQ_PHONE) { - usa=yesno(text[CallingFromNorthAmericaQ]); - while(online) { + if(text[CallingFromNorthAmericaQ][0]) + usa=yesno(text[CallingFromNorthAmericaQ]); + else + usa=false; + while(online && text[EnterYourPhoneNumber][0]) { bputs(text[EnterYourPhoneNumber]); if(!usa) { if(getstr(useron.phone,LEN_PHONE @@ -302,7 +299,7 @@ BOOL sbbs_t::newuser() bputs(text[EnterYourSex]); useron.sex=(char)getkeys("MF",0); } - while(cfg.uq&UQ_BIRTH && online) { + while((cfg.uq&UQ_BIRTH) && online) { bprintf(text[EnterYourBirthday] ,cfg.sys_misc&SM_EURODATE ? "DD/MM/YY" : "MM/DD/YY"); if(gettmplt(useron.birth,"nn/nn/nn",K_EDIT)==8 && getage(&cfg,useron.birth)) @@ -315,11 +312,11 @@ BOOL sbbs_t::newuser() && !trashcan(useron.netmail,"email")) break; } - if(useron.netmail[0] && cfg.sys_misc&SM_FWDTONET && yesno(text[ForwardMailQ])) + if(useron.netmail[0] && cfg.sys_misc&SM_FWDTONET && text[ForwardMailQ][0] && yesno(text[ForwardMailQ])) useron.misc|=NETMAIL; else useron.misc&=~NETMAIL; - if(yesno(text[UserInfoCorrectQ])) + if(text[UserInfoCorrectQ][0]==0 || yesno(text[UserInfoCorrectQ])) break; } if(!online) return(FALSE); @@ -346,24 +343,24 @@ BOOL sbbs_t::newuser() /* Default editor (moved here, after terminal type setup Jan-2003) */ for(i=0;icode,cfg.new_xedit) && chk_ar(cfg.xedit[i]->ar,&useron)) + if(!stricmp(cfg.xedit[i]->code,cfg.new_xedit) && chk_ar(cfg.xedit[i]->ar,&useron,&client)) break; if(iname,cfg.xedit[i]->ar); + uselect(1,i,text[ExternalEditorHeading],cfg.xedit[i]->name,cfg.xedit[i]->ar); if((int)(i=uselect(0,useron.xedit ? useron.xedit-1 : 0,0,0,0))>=0) useron.xedit=i+1; } else useron.xedit=0; } - if(cfg.total_shells>1 && cfg.uq&UQ_CMDSHELL) { + if(cfg.total_shells>1 && (cfg.uq&UQ_CMDSHELL)) { for(i=0;iname,cfg.shell[i]->ar); + uselect(1,i,text[CommandShellHeading],cfg.shell[i]->name,cfg.shell[i]->ar); if((int)(i=uselect(0,useron.shell,0,0,0))>=0) useron.shell=i; } @@ -383,7 +380,7 @@ BOOL sbbs_t::newuser() bprintf(text[YourPasswordIs],useron.pass); - if(cfg.sys_misc&SM_PWEDIT && yesno(text[NewPasswordQ])) + if(cfg.sys_misc&SM_PWEDIT && text[NewPasswordQ][0] && yesno(text[NewPasswordQ])) while(online) { bputs(text[NewPassword]); getstr(str,LEN_PASS,K_UPPER|K_LINE); @@ -402,7 +399,7 @@ BOOL sbbs_t::newuser() bprintf(text[NewUserPasswordVerify]); console|=CON_R_ECHOX; str[0]=0; - getstr(str,LEN_PASS,K_UPPER); + getstr(str,LEN_PASS*2,K_UPPER); console&=~(CON_R_ECHOX|CON_L_ECHOX); if(!strcmp(str,useron.pass)) break; if(cfg.sys_misc&SM_ECHO_PW) @@ -413,9 +410,9 @@ BOOL sbbs_t::newuser() else sprintf(tmp,"%s FAILED Password verification" ,useron.alias); - logline(nulstr,tmp); + logline(LOG_NOTICE,nulstr,tmp); if(++c==4) { - logline("N!","Couldn't figure out password."); + logline(LOG_NOTICE,"N!","Couldn't figure out password."); hangup(); } bputs(text[IncorrectPassword]); @@ -454,7 +451,7 @@ BOOL sbbs_t::newuser() if(!(cfg.uq&UQ_NODEF)) maindflts(&useron); - delallmail(useron.number); + delallmail(useron.number, MAIL_ANY); if(useron.number!=1 && cfg.node_valuser) { sprintf(str,"%sfeedback.msg",cfg.text_dir); @@ -471,7 +468,7 @@ BOOL sbbs_t::newuser() } /* give 'em a 2nd try */ if(!useron.fbacks && !useron.emails) { bprintf(text[NoFeedbackWarning],username(&cfg,cfg.node_valuser,tmp)); - logline("N!","Aborted feedback"); + logline(LOG_NOTICE,"N!","Aborted feedback"); hangup(); putuserrec(&cfg,useron.number,U_COMMENT,60,"Didn't leave feedback"); putuserrec(&cfg,useron.number,U_MISC,8