static void command_loop(void) { char c, more = FALSE, help = FALSE; int i; while (!ExitToMsdos) { if (sysReq && !loggedIn && !haveCarrier) { sysReq = FALSE; if (cfg.offhook) { offhook(); } else { drop_dtr(); } ringSystemREQ(); } if (parm.door) { if (!loggedIn && cfg.forcelogin) { for (i = 0; !loggedIn && i < 4; ++i) doLogin(2); if (!loggedIn) { ExitToMsdos = 1; break; } } } more = getCommand(&c); outFlag = IMPERVIOUS; if (chatkey) chat(); if (eventkey && !haveCarrier) { do_cron(CRON_TIMEOUT); eventkey = FALSE; } if (sysopkey) help = doSysop(); else help = doRegular(more, c); if (help) { if (!gl_user.expert) mPrintf("\n '?' for menu, 'H' for help.\n \n"); else mPrintf(" ?\n \n"); } } }
void doLogin(char moreYet) /* TRUE to accept following parameters */ { char InitPw[NAMESIZE*2+2]; char passWord[NAMESIZE*2+2]; char Initials[NAMESIZE*2+2]; char *semicolon; if (justLostCarrier || ExitToMsdos) return; if (moreYet == 2) moreYet = FALSE; else mPrintf("\bLogin"); /* we want to be in console mode when we log in from local */ if (!gotCarrier() && !loggedIn) { whichIO = CONSOLE; onConsole = (char) (whichIO == CONSOLE); /* update25(); */ do_idle(0); if (cfg.offhook) offhook(); } if (loggedIn) { mPrintf("\n Already logged in!\n "); return; } getNormStr((moreYet) ? "" : "your initials", InitPw, NAMESIZE*2+2, NO_ECHO); dospCR(); semicolon = strchr(InitPw, ';'); if (!semicolon) { strncpy(Initials, InitPw,NAMESIZE); Initials[NAMESIZE] = '\0'; getNormStr("password", passWord, NAMESIZE, NO_ECHO); dospCR(); } else normalizepw(InitPw, Initials, passWord, semicolon); /* don't allow anything over NAMESIZE characters */ Initials[NAMESIZE] = '\0'; login(Initials, passWord); }
void sbbs_t::logout() { char str[256]; char tmp[512]; int i,j; ushort ttoday; node_t node; struct tm tm; now=time(NULL); if(localtime_r(&now,&tm)==NULL) return; if(!useron.number) { /* Not logged in, so do nothing */ if(!online) { sprintf(str,"%s T:%3u sec\r\n" ,hhmmtostr(&cfg,&tm,tmp) ,(uint)(now-answertime)); logline("@-",str); } return; } strcpy(lastuseron,useron.alias); /* for use with WFC status display */ if(useron.rest&FLAG('G')) { /* Reset guest's msg scan cfg */ putuserrec(&cfg,useron.number,U_NAME,LEN_NAME,nulstr); batdn_total=0; } batch_create_list(); if(sys_status&SS_USERON && thisnode.status!=NODE_QUIET && !(useron.rest&FLAG('Q'))) for(i=1;i<=cfg.sys_nodes;i++) if(i!=cfg.node_num) { getnodedat(i,&node,0); if((node.status==NODE_INUSE || node.status==NODE_QUIET) && !(node.misc&NODE_AOFF) && node.useron!=useron.number) { sprintf(str,text[NodeLoggedOff],cfg.node_num ,thisnode.misc&NODE_ANON ? text[UNKNOWN_USER] : useron.alias); putnmsg(&cfg,i,str); } } if(!online) { /* NOT re-login */ #if 0 /* too soon, handled in node_thread */ getnodedat(cfg.node_num,&thisnode,1); thisnode.status=NODE_WFC; thisnode.misc&=~(NODE_INTR|NODE_MSGW|NODE_NMSG |NODE_UDAT|NODE_POFF|NODE_AOFF|NODE_EXT); putnodedat(cfg.node_num,&thisnode); #endif #if 0 /* beep? */ if(sys_status&SS_SYSALERT) { mswait(500); offhook(); CLS; lputs("\r\n\r\nAlerting Sysop..."); while(!lkbrd(1)) { sbbs_beep(1000,200); nosound(); mswait(200); } lkbrd(0); } #endif sys_status&=~SS_SYSALERT; if(cfg.sys_logout[0]) /* execute system logout event */ external(cmdstr(cfg.sys_logout,nulstr,nulstr,NULL),EX_OUTL|EX_OFFLINE); } if(cfg.logout_mod[0]) exec_bin(cfg.logout_mod,&main_csi); backout(); sprintf(str,"%smsgs/%4.4u.msg",cfg.data_dir,useron.number); if(!flength(str)) /* remove any 0 byte message files */ remove(str); delfiles(cfg.temp_dir,ALLFILES); putmsgptrs(); if(!REALSYSOP) logofflist(); useron.laston=(time32_t)now; ttoday=useron.ttoday-useron.textra; /* billable time used prev calls */ if(ttoday>=cfg.level_timeperday[useron.level]) i=0; else i=cfg.level_timeperday[useron.level]-ttoday; if(i>cfg.level_timepercall[useron.level]) /* i=amount of time without min */ i=cfg.level_timepercall[useron.level]; j=(int)(now-starttime)/60; /* j=billable time online in min */ if(i<0) i=0; if(j<0) j=0; if(useron.min && j>i) { j-=i; /* j=time to deduct from min */ sprintf(str,"Minute Adjustment: %d",-j); logline(">>",str); if(useron.min>(ulong)j) useron.min-=j; else useron.min=0L; putuserrec(&cfg,useron.number,U_MIN,10,ultoa(useron.min,str,10)); } if(timeleft>0 && starttime-logontime>0) /* extra time */ useron.textra+=(ushort)((starttime-logontime)/60); putuserrec(&cfg,useron.number,U_TEXTRA,5,ultoa(useron.textra,str,10)); putuserrec(&cfg,useron.number,U_NS_TIME,8,ultoa((ulong)last_ns_time,str,16)); logoutuserdat(&cfg, &useron, now, logontime); getusrsubs(); getusrdirs(); if(usrgrps>0) putuserrec(&cfg,useron.number,U_CURSUB,0,cfg.sub[usrsub[curgrp][cursub[curgrp]]]->code); if(usrlibs>0) putuserrec(&cfg,useron.number,U_CURDIR,0,cfg.dir[usrdir[curlib][curdir[curlib]]]->code); hhmmtostr(&cfg,&tm,str); strcat(str," "); if(sys_status&SS_USERON) sprintf(tmp,"T:%3u R:%3lu P:%3lu E:%3lu F:%3lu " "U:%3luk %lu D:%3luk %lu" ,(uint)(now-logontime)/60,posts_read,logon_posts ,logon_emails,logon_fbacks,logon_ulb/1024UL,logon_uls ,logon_dlb/1024UL,logon_dls); else sprintf(tmp,"T:%3u sec",(uint)(now-answertime)); strcat(str,tmp); strcat(str,"\r\n"); logline("@-",str); sys_status&=~SS_USERON; answertime=now; // Incase we're relogging on }
void TERMWINDOWMEMBER Net1Cleanup(void) { int t, i; label fn, here, there; char line[100]; CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82)); Hangup(); if (w) { destroyCitWindow(w, FALSE); } if (cfg.offhook == 1) { offhook(); } sprintf(line, sbs, cfg.transpath, node->GetMailFileName()); unlink(line); OC.SetOutFlag(IMPERVIOUS); doccr(); cPrintf(getnetmsg(22)); doccr(); cPrintf(getnetmsg(23)); doccr(); cPrintf(getnetmsg(24)); doccr(); int Rooms = 0, TotalNew = 0, TotalExpired = 0, TotalDuplicate = 0; int ThisNew, ThisExpired, ThisDuplicate, ThisError; for (t = get_first_room(here, there), i = 0; t; t = get_next_room(here, there), i++) { sprintf(fn, getnetmsg(127), i); KBReady(); const r_slot rm = RoomExists(here); if (rm != CERROR && CurrentUser->CanAccessRoom(rm)) { cPrintf(getnetmsg(166), deansi(here)); if (ReadMsgFl(rm, fn, NULL, &ThisNew, &ThisExpired, &ThisDuplicate, &ThisError, CurrentUser)) { if (ThisNew) { OC.ansiattr = cfg.cattr; } cPrintf(getnetmsg(133), ThisNew); OC.ansiattr = cfg.attr; cPrintf(getnetmsg(134)); if (ThisExpired) { OC.ansiattr = cfg.cattr; } cPrintf(getnetmsg(133), ThisExpired); OC.ansiattr = cfg.attr; cPrintf(getnetmsg(134)); if (ThisDuplicate) { OC.ansiattr = cfg.cattr; } cPrintf(getnetmsg(133), ThisDuplicate); OC.ansiattr = cfg.attr; TotalNew += ThisNew; TotalExpired += ThisExpired; TotalDuplicate += ThisDuplicate; Rooms++; } else { amPrintf(getnetmsg(28), there, bn); netError = TRUE; cPrintf(getnetmsg(29)); } doccr(); } else { cPrintf(getnetmsg(30), deansi(here)); amPrintf(getnetmsg(31), here, bn); netError = TRUE; doccr(); } unlink(fn); } cPrintf(getnetmsg(24)); doccr(); cPrintf(getnetmsg(32)); if (Rooms) { OC.ansiattr = cfg.cattr; } cPrintf(getnetmsg(133), Rooms); OC.ansiattr = cfg.attr; cPrintf(getnetmsg(134)); if (TotalNew) { OC.ansiattr = cfg.cattr; } cPrintf(getnetmsg(133), TotalNew); OC.ansiattr = cfg.attr; cPrintf(getnetmsg(134)); if (TotalExpired) { OC.ansiattr = cfg.cattr; } cPrintf(getnetmsg(133), TotalExpired); OC.ansiattr = cfg.attr; cPrintf(getnetmsg(134)); if (TotalDuplicate) { OC.ansiattr = cfg.cattr; } cPrintf(getnetmsg(133), dup); OC.ansiattr = cfg.attr; doccr(); cPrintf(getnetmsg(33)); doccr(); doccr(); cPrintf(getnetmsg(34)); doccr(); ReadMsgFl(MAILROOM, getnetmsg(164), NULL, &ThisNew, &ThisExpired, &ThisDuplicate, &ThisError, NULL); label New, Routed, Rejected; CopyStringToBuffer(New, ltoac(i == CERROR ? 0 : i)); CopyStringToBuffer(Routed, ltoac(ThisExpired)); CopyStringToBuffer(Rejected, ltoac(ThisDuplicate)); cPrintf(getnetmsg(35), New, ThisNew == 1 ? cfg.Lmsg_nym : cfg.Lmsgs_nym, Routed, Rejected, ltoac(ThisNew + ThisExpired + ThisDuplicate)); doccr(); changedir(LocalTempPath); ambigUnlink(getnetmsg(162)); ambigUnlink(getnetmsg(163)); unlink(getnetmsg(164)); changedir(cfg.homepath); MS.Expired = TotalExpired; MS.Duplicate = TotalDuplicate; MS.Entered = TotalNew + ThisNew; if (netError) { label Buffer; amPrintf(getnetmsg(36), bn, CurrentUser->GetName(Buffer, sizeof(Buffer)), bn); SaveAideMess(NULL); } readNetCmdTmp(CONSOLE); // we are no longer calling out... callout = FALSE; }
/* -------------------------------------------------------------------- */ void doLogin(char moreYet) { int foundIt; char InitPw[NAMESIZE+NAMESIZE+2]; char password[NAMESIZE+NAMESIZE+2]; char initials[NAMESIZE+NAMESIZE+2]; char *semicolon; Mflush(); if (!CARRIER) return; if (login_user || login_pw) /* handle command line log-ins */ { if (!modStat) if (cfg.offhook) offhook(); /* login using initials and pw */ if (login_pw) { normalizepw(cmd_login, initials, password); login_pw = FALSE; } else if (login_user) { normalizeString(cmd_login); if (findPerson(cmd_login, &logBuf) != ERROR) { strcpy(initials, logBuf.lbin); strcpy(password, logBuf.lbpw); } login_user = FALSE; } } else /* ask user for initials and password */ { if (moreYet == 2) moreYet = FALSE; else { /* dont print Login when hitting 'L' from console mode */ if (!(!moreYet && !loggedIn && !modStat)) { mPrintf("Login "); } } if (loggedIn) { mPrintf("\n Already logged in!\n "); return; } if (!modStat) if (cfg.offhook) offhook(); getNormStr((moreYet) ? "" : "your initials", InitPw, NAMESIZE+NAMESIZE+1, NO_ECHO); if (!CARRIER) return; dospCR(); semicolon = strchr(InitPw, ';'); if (!semicolon) { strcpy(initials, InitPw); getNormStr( "password", password, NAMESIZE, NO_ECHO); dospCR(); } else { normalizepw(InitPw, initials, password); } /* dont allow anything over 19 characters */ initials[NAMESIZE] = '\0'; } /* reset transmitted & received */ transmitted = 0l; received = 0l; /* reset read & entered */ mread = 0; entered = 0; foundIt = ((pwslot(initials, password)) != ERROR); if (foundIt && *password) { loggedIn = TRUE; update25(); /* trap it */ if (!logBuf.lbflags.NODE) { sprintf( msgBuf->mbtext, "Login %s", logBuf.lbname); if (onConsole) strcat(msgBuf->mbtext, " (Console)"); trap(msgBuf->mbtext, T_LOGIN); } else { sprintf( msgBuf->mbtext, "NetLogin %s", logBuf.lbname); trap(msgBuf->mbtext, T_NETWORK); } } else { loginNew(initials, password); } if (!loggedIn) return; heldMessage = FALSE; setsysconfig(); setgroupgen(); setroomgen(); setlbvisit(); slideLTab(thisSlot); /* cant log in now. */ if (cfg.accounting && !logBuf.lbflags.NOACCOUNT) { negotiate(); logincrement(); if (!logincheck()) { Hangup(); return; } } /* can't log in now. */ if (logBuf.VERIFIED && !onConsole) { tutorial("verified.blb"); Hangup(); return; } if (logBuf.lbflags.NODE) { #ifdef TRASH if (debug) { readnode(); cPrintf("Node: \"%s\" \"%s\"", node.ndname, node.ndregion); doccr(); cPrintf("Phone: \"%s\" %d", node.ndphone, node.nddialto); doccr(); cPrintf("Login: \"%s\" %d", node.ndlogin, node.ndwaitto); doccr(); cPrintf("Baud: %d Protocol: \"%s\"\n ", node.ndbaud, node.ndprotocol); cPrintf("Expire:%d Waitout: %d", node.ndexpire, node.ndwaitto); doccr(); cPrintf("Network: %d ZIP: %s UNZIP: %s", node.network, node.zip, node.unzip); doccr(); } #endif time(&logtimestamp); return; } if (logBuf.PSYCHO) { backout = TRUE; } /* reverse engineering Minibin?!?! */ if (logBuf.MINIBIN) { minibin(); } changedir(cfg.helppath); if ( filexists("bulletin.blb") ) { tutorial("bulletin.blb"); } gotodefaulthall(); roomtalley(); mf.mfLim = 0; /* just to make sure. */ mf.mfMai = 0; mf.mfPub = 0; mf.mfUser[0]=0; nochat(TRUE); /* reset chats */ /* verbose = FALSE; */ verbose = logBuf.VERBOSE; /* hmmm... where to put this */ if (roomBuf.rbflags.APLIC && roomBuf.rbflags.AUTOAPP ) ExeAplic(); showMessages(NEWoNLY, FALSE); verbose = FALSE; if (expert) listRooms(NEWRMS, FALSE); else listRooms(OLDNEW, FALSE); outFlag = OUTOK; setio(whichIO, echo, outFlag); /* record login time, date */ time(&logtimestamp); cfg.callno++; storeLog(); }