|
|
1.1 ! root 1: /* login.cpp */ ! 2: ! 3: /* Synchronet user login routine */ ! 4: ! 5: /* $Id: login.cpp,v 1.2 2000/12/11 23:21:12 rswindell Exp $ */ ! 6: ! 7: /**************************************************************************** ! 8: * @format.tab-size 4 (Plain Text/Source Code File Header) * ! 9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * ! 10: * * ! 11: * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html * ! 12: * * ! 13: * This program is free software; you can redistribute it and/or * ! 14: * modify it under the terms of the GNU General Public License * ! 15: * as published by the Free Software Foundation; either version 2 * ! 16: * of the License, or (at your option) any later version. * ! 17: * See the GNU General Public License for more details: gpl.txt or * ! 18: * http://www.fsf.org/copyleft/gpl.html * ! 19: * * ! 20: * Anonymous FTP access to the most recent released source is available at * ! 21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * ! 22: * * ! 23: * Anonymous CVS access to the development source and modification history * ! 24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: * ! 25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login * ! 26: * (just hit return, no password is necessary) * ! 27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src * ! 28: * * ! 29: * For Synchronet coding style and modification guidelines, see * ! 30: * http://www.synchro.net/source.html * ! 31: * * ! 32: * You are encouraged to submit any modifications (preferably in Unix diff * ! 33: * format) via e-mail to [email protected] * ! 34: * * ! 35: * Note: If this box doesn't appear square, then you need to fix your tabs. * ! 36: ****************************************************************************/ ! 37: ! 38: #include "sbbs.h" ! 39: #include "cmdshell.h" ! 40: ! 41: int sbbs_t::login(char *str, char *pw) ! 42: { ! 43: char tmp[512]; ! 44: long useron_misc=useron.misc; ! 45: ! 46: useron.number=0; ! 47: if(cfg.node_dollars_per_call && noyes(text[AreYouSureQ])) ! 48: return(LOGIC_FALSE); ! 49: ! 50: if(str[0]=='*') { ! 51: memmove(str,str+1,strlen(str)); ! 52: qwklogon=1; } ! 53: else ! 54: qwklogon=0; ! 55: ! 56: if(!(cfg.node_misc&NM_NO_NUM) && isdigit(str[0])) { ! 57: useron.number=atoi(str); ! 58: getuserdat(&cfg,&useron); ! 59: if(useron.number && useron.misc&(DELETED|INACTIVE)) ! 60: useron.number=0; } ! 61: ! 62: if(!useron.number) { ! 63: useron.number=matchuser(&cfg,str); ! 64: if(!useron.number && (uchar)str[0]<0x7f && str[1] ! 65: && isalpha(str[0]) && strchr(str,SP) && cfg.node_misc&NM_LOGON_R) ! 66: useron.number=userdatdupe(0,U_NAME,LEN_NAME,str,0); ! 67: if(useron.number) { ! 68: getuserdat(&cfg,&useron); ! 69: if(useron.number && useron.misc&(DELETED|INACTIVE)) ! 70: useron.number=0; } } ! 71: ! 72: if(!useron.number) { ! 73: if(cfg.node_misc&NM_LOGON_P) { ! 74: strcpy(useron.alias,str); ! 75: bputs(pw); ! 76: console|=CON_R_ECHOX; ! 77: if(!(cfg.sys_misc&SM_ECHO_PW)) ! 78: console|=CON_L_ECHOX; ! 79: getstr(str,LEN_PASS,K_UPPER|K_LOWPRIO|K_TAB); ! 80: console&=~(CON_R_ECHOX|CON_L_ECHOX); ! 81: bputs(text[InvalidLogon]); ! 82: sprintf(tmp,"(%04u) %-25s Password: '%s'" ! 83: ,0,useron.alias,str); ! 84: logline("+!",tmp); } ! 85: else { ! 86: bputs(text[UnknownUser]); ! 87: sprintf(tmp,"Unknown User '%s'",str); ! 88: logline("+!",tmp); } ! 89: useron.misc=useron_misc; ! 90: return(LOGIC_FALSE); } ! 91: ! 92: if(!online) { ! 93: useron.number=0; ! 94: return(LOGIC_FALSE); } ! 95: ! 96: if((online==ON_REMOTE || cfg.sys_misc&SM_REQ_PW || cfg.node_misc&NM_SYSPW) ! 97: && (useron.pass[0] || REALSYSOP) ! 98: && (!cfg.node_dollars_per_call || cfg.sys_misc&SM_REQ_PW)) { ! 99: bputs(pw); ! 100: console|=CON_R_ECHOX; ! 101: if(!(cfg.sys_misc&SM_ECHO_PW)) ! 102: console|=CON_L_ECHOX; ! 103: getstr(str,LEN_PASS,K_UPPER|K_LOWPRIO|K_TAB); ! 104: console&=~(CON_R_ECHOX|CON_L_ECHOX); ! 105: if(!online) { ! 106: useron.number=0; ! 107: return(LOGIC_FALSE); } ! 108: if(stricmp(useron.pass,str)) { ! 109: bputs(text[InvalidLogon]); ! 110: sprintf(tmp,"(%04u) %-25s Password: '%s' Attempt: '%s'" ! 111: ,useron.number,useron.alias,useron.pass,str); ! 112: logline("+!",tmp); ! 113: useron.number=0; ! 114: useron.misc=useron_misc; ! 115: return(LOGIC_FALSE); } ! 116: if(REALSYSOP && !chksyspass(0)) { ! 117: bputs(text[InvalidLogon]); ! 118: useron.number=0; ! 119: useron.misc=useron_misc; ! 120: return(LOGIC_FALSE); } } ! 121: ! 122: return(LOGIC_TRUE); ! 123: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.