/* -------------------------------------------------------------------- */ void newgroup(void) { label groupname; int slot, i; getString("group", groupname, NAMESIZE, FALSE, ECHO, ""); if ( (groupexists(groupname) != ERROR) || !strlen(groupname) ) { mPrintf("\n We already have a \'%s\' group.", groupname); return; } /* search for a free group slot */ for (i = 0, slot = 0; i < MAXGROUPS && !slot ; i++) { if (!grpBuf.group[i].g_inuse) slot = i; } if (!slot) { mPrintf("\n Group table full."); return; } getString("group description", grpBuf.group[slot].desc, 79, FALSE, ECHO,""); grpBuf.group[slot].lockout = (getYesNo("Lock group from aides", 0 )); grpBuf.group[slot].hidden = (getYesNo("Hide group", 0 )); grpBuf.group[slot].autoAdd = (getYesNo("Auto-Add group", 0 )); strcpy(grpBuf.group[slot].groupname, groupname); grpBuf.group[slot].g_inuse = 1; /* increment group generation # */ grpBuf.group[slot].groupgen = (uchar)((grpBuf.group[slot].groupgen + 1) % MAXGROUPGEN); if (getYesNo(confirm, 0)) { putGroup(); sprintf(msgBuf->mbtext, "Group %s created", grpBuf.group[slot].groupname ); trap(msgBuf->mbtext, T_SYSOP); logBuf.groups[slot] = grpBuf.group[slot].groupgen; storeLog(); } else { getGroup(); } }
void Logger::nucleoInd(TLogInd && logInd) { std::lock_guard<std::mutex> lockGuard(mDataMtx); auto storedLog = std::make_shared<StoredLog>(); storedLog->log = std::string(logInd.data, logInd.length); storedLog->severity = logInd.severity; storedLog->source = LogSource::Nucleo; fillWithActualTime(storedLog); storeLog(std::move(storedLog)); }
void Logger::storeLog(ELogSeverity severity, const std::string & format, va_list vaList) { auto storedLog = std::make_shared<StoredLog>(); storedLog->log.resize(220); vsprintf(const_cast<char*>(storedLog->log.c_str()), format.c_str(), vaList ); storedLog->log.shrink_to_fit(); storedLog->severity = severity; storedLog->source = LogSource::Raspberry; fillWithActualTime(storedLog); storeLog(std::move(storedLog)); }
void Logger::error(const std::string & format, ...) { std::lock_guard<std::mutex> lockGuard(mDataMtx); if (!isLogShouldBePrinted(ELogSeverity_Error)) { return; } va_list vaList; va_start(vaList, format); storeLog(ELogSeverity_Error, format, vaList); va_end(vaList); }
/* -------------------------------------------------------------------- */ int newlog(void) { int ourSlot, i, v; /* ulong newpointer; */ /* * get a new slot for this user */ thisSlot = newslot(); if (thisSlot == ERROR) { thisSlot = 0; return(ERROR); } ourSlot = logTab[thisSlot].ltlogSlot; /* * Fill in the account. */ v = logBuf.VERIFIED; getLog(&logBuf, ourSlot); memset(&logBuf, 0, sizeof(logBuf)); setlogconfig(); #ifdef GOODBYE /* Moved to new user */ strcpy(logBuf.lbname, fullnm); strcpy(logBuf.lbin, in); strcpy(logBuf.lbpw, pw); #endif logBuf.surname[0] = '\0'; /* no starting surname */ logBuf.title [0] = '\0'; /* no starting title */ logBuf.forward[0] = '\0'; /* no starting forwarding */ logBuf.lbflags.L_INUSE = TRUE; logBuf.lbflags.PROBLEM = cfg.user[D_PROBLEM]; logBuf.lbflags.PERMANENT = cfg.user[D_PERMANENT]; logBuf.lbflags.NOACCOUNT = cfg.user[D_NOACCOUNT]; logBuf.lbflags.NETUSER = cfg.user[D_NETWORK]; logBuf.lbflags.NOMAIL = cfg.user[D_NOMAIL]; logBuf.lbflags.AIDE = cfg.user[D_AIDE]; /* aide = cfg.user[D_AIDE]; */ logBuf.lbflags.SYSOP = cfg.user[D_SYSOP]; /* sysop = cfg.user[D_SYSOP]; */ logBuf.BOARDERS = cfg.user[D_BOARDER]; logBuf.VERIFIED = v; /* logBuf.IBMGRAPH = FALSE; */ logBuf.DISPLAYTS = TRUE; logBuf.SUBJECTS = TRUE; logBuf.SIGNATURES = TRUE; logBuf.TWIRLY = FALSE; logBuf.VERBOSE = FALSE; logBuf.MSGPAUSE = FALSE; logBuf.MSGCLS = FALSE; /* should this be a cfg.user thing? */ logBuf.MINIBIN = TRUE; logBuf.ROOMINFO = TRUE; logBuf.HALLTELL = TRUE; /* elegia */ strcpy(logBuf.prompt, cfg.prompt); strcpy(logBuf.dstamp, cfg.datestamp); strcpy(logBuf.vdstamp, cfg.vdatestamp); strcpy(logBuf.netPrefix, cfg.netPrefix); strcpy(logBuf.msg_header, cfg.msg_header); strcpy(logBuf.vmsg_header, cfg.vmsg_header); #ifdef GOODBYE for (i = 1; i < MAXVISIT; i++) { logBuf.lbvisit[i] = cfg.oldest; } logBuf.lbvisit[ 0 ]= cfg.newest; logBuf.lbvisit[ (MAXVISIT-1) ]= cfg.oldest; #endif for (i = 0; i < MAXROOMS; i++) { logBuf.newpointer[i] = cfg.oldest; } initroomgen(); /**********************************************************************/ /* Icky Hack designed to make #oldcount functional */ /**********************************************************************/ #ifdef GOODBYE if (cfg.oldcount) { newpointer = (cfg.newest - cfg.oldcount); if (newpointer < cfg.oldest) newpointer = cfg.oldest; logBuf.lbvisit[0] = newpointer; /* pushed down later by setlbvisit() */ for (i = 0; i < MAXROOMS; i++) { logBuf.lbroom[i].lvisit = 0; /* becomes==1 later by setlbvisit() */ } } #endif /**********************************************************************/ /* ^^^ Disgusting? Wasn't it? ^^^ Hope it works! */ /**********************************************************************/ cleargroupgen(); /* * put user into group NULL */ logBuf.groups[0] = grpBuf.group[0].groupgen; /* * put user into auto-add groups */ for (i=0; i<MAXGROUPS; i++) { if (grpBuf.group[i].autoAdd) { logBuf.groups[i] = grpBuf.group[i].groupgen; } } /* * accurate read-userlog for first time call */ logBuf.callno = cfg.callno + 1; logBuf.credits = (float)0; #ifdef GOODBYE /* This stuff moved to newUser() time(&logBuf.calltime); setsysconfig(); /* * trap it */ sprintf( msgBuf->mbtext, "New user %s", logBuf.lbname); trap(msgBuf->mbtext, T_LOGIN); loggedIn = TRUE; slideLTab(thisSlot); storeLog(); #endif /* End of stuff moved to newUser() */ return(TRUE); }
/* -------------------------------------------------------------------- */ void newUser(char *initials, char *password) { label fullnm; char InitPw[80]; char Initials[80]; char passWord[80]; char *semicolon; int lines; int abort, good = 0; char firstime = 1; if (!CARRIER) return; unlisted = FALSE; /* default to [Y] for list in userlog for new users */ roomtell = TRUE; /* default to [Y] for display of room descriptions */ /* this only initializes log.buf, does not write it out */ if (newlog() == ERROR) return; logBuf.linesScreen = cfg.linesScreen; /* askTerm(); */ configure(TRUE); /* make sure new users configure reasonably */ lines = logBuf.linesScreen; tutorial("password.blb"); do { do { /* getNormStr("full name", fullnm, NAMESIZE, ECHO); */ enterName(cfg.enter_name, fullnm, NULL); if ( (personexists(fullnm) != ERROR ) || (strcmpi(fullnm, "Sysop") == SAMESTRING) || (strcmpi(fullnm, "Aide") == SAMESTRING) || !strlen(fullnm) ) { mPrintf("We already have a %s\n", fullnm); good = FALSE; } else (good = TRUE); } while(!good && CARRIER); if (!CARRIER) return; if (firstime) { strcpy(Initials, initials); } else { getNormStr("your initials", InitPw, 40, NO_ECHO); dospCR(); semicolon = strchr(InitPw, ';'); if( semicolon ) { normalizepw(InitPw, Initials, passWord); } else { strcpy(Initials, InitPw); } /* dont allow anything over 19 characters */ Initials[19] = '\0'; } do { if (firstime) { strcpy(passWord, password); } else if (!semicolon) { getNormStr("password", passWord, NAMESIZE, NO_ECHO); dospCR(); } firstime = FALSE; /* keeps from going in infinite loop */ semicolon = FALSE; if ( pwexists(passWord) != ERROR || strlen(passWord) < 2) { good = FALSE; mPrintf("\n Poor password\n "); } else good = TRUE; } while( !good && CARRIER ); displaypw(fullnm, Initials, passWord); abort = getYesNo("OK",2); if (abort == 2) return; /* check for Abort at (Y/N/A)[A]: */ } while ( (!abort) && CARRIER); if (CARRIER) { /* Moved from newlog() */ strcpy(logBuf.lbname, fullnm); strcpy(logBuf.lbin, Initials); strcpy(logBuf.lbpw, passWord); /* This stuff moved from newlog() time(&logBuf.calltime); setsysconfig(); /* * trap it */ sprintf( msgBuf->mbtext, "New user %s", logBuf.lbname); if (onConsole) strcat(msgBuf->mbtext, " (Console)"); trap(msgBuf->mbtext, T_LOGIN); loggedIn = TRUE; slideLTab(thisSlot); storeLog(); /* End of stuff moved from newlog() */ } logBuf.linesScreen = (uchar)lines; }
/* -------------------------------------------------------------------- */ void newPW(void) { char InitPw[42]; char passWord[42]; char Initials[42]; char oldPw[42]; char *semicolon; int goodpw; /* display old pw & initials */ displaypw(logBuf.lbname, logBuf.lbin, logBuf.lbpw); if (!getYesNo(confirm, 0)) return; strcpy(oldPw, logBuf.lbpw); getNormStr("your new initials", InitPw, 40, NO_ECHO); dospCR(); semicolon = strchr(InitPw, ';'); if(semicolon) { normalizepw(InitPw, Initials, passWord); } else strcpy(Initials, InitPw); /* dont allow anything over 19 characters */ Initials[19] = '\0'; do { if (!semicolon) { getNormStr("new password", passWord, NAMESIZE, NO_ECHO); dospCR(); } goodpw = ( ((pwexists(passWord) == ERROR) && strlen(passWord) >= 2) || (strcmpi(passWord, oldPw) == SAMESTRING)); if ( !goodpw) mPrintf("\n Poor password\n "); semicolon = FALSE; } while ( !goodpw && CARRIER); strcpy(logBuf.lbin, Initials); strcpy(logBuf.lbpw, passWord); /* insure against loss of carrier */ if (CARRIER) { logTab[0].ltinhash = hash(Initials); logTab[0].ltpwhash = hash(passWord); storeLog(); } /* display new pw & initials */ displaypw(logBuf.lbname, logBuf.lbin, logBuf.lbpw); /* trap it */ trap("Password changed", T_PASSWORD); }
configure() { void config_menu(); char abt = ' ', new_name[NAMESIZE]; int h,i, good; pause_override = TRUE; config_menu(); while( abt != 'X' && (carrDet() || ra.onConsole)){ mPrintf("Selection: "); abt = (char) toupper(iChar()); switch(abt) { case 'A' : if (!ra.expert) tutorial("wide.blb"); ra.termWidth = getNumber(" Terminal Width", 15, 132); --ra.termWidth; break; case 'B': if (!ra.expert) tutorial("lineht.blb"); ra.logBuf.pause_at = (ra.logBuf.pause_at & 0x80) | ((char) getNumber ("Screen Height in Lines (11-45): ", 11, 45) & 0x7f); break; case 'C': if (!ra.expert) tutorial("lf.blb"); sprintf(format, "\n Linefeed Added: %s\n ", (ra.termLF ^= LFMASK) ? " Yes" : " No "); mPrintf(format); break; case 'D': if (!ra.expert) tutorial("tab.blb"); sprintf(format, "\n Tabs Sent: %s\n ", (ra.termTab ^= TABMASK) ? " Yes" : " No"); mPrintf(format); break; case 'E': if (!ra.expert) tutorial("lasto.blb"); sprintf(format, "\n Show Last Old Message with New: %s \n ", (ra.lasto ^= LOMASK) ? " Yes " : " No"); mPrintf(format); break; case 'F': if (!ra.expert) tutorial("hlp.blb"); sprintf(format, "\n Expert Mode On: %s\n ", (ra.expert ^= EXPERT) ? " Yes " : " No"); mPrintf(format); break; case 'G': if (!ra.expert) tutorial("more.blb"); sprintf(format, "\n Screen Pause is On: %s\n ", (ra.termMore ^= MORE) ? " Yes" : " No"); mPrintf(format); if (ra.termMore) { if (getYesNo (" Pause Between Messages ") ) ra.logBuf.pause_at |= 0x80; else ra.logBuf.pause_at &= 0x7f; } else ra.logBuf.pause_at &= 0x7f; break; case 'H': if (!ra.expert) tutorial("pace.blb"); sprintf(format, "\n Controlled Typeout is %s\n ", (ra.nopace ^= NOPACE) ? "Off" : "On"); mPrintf(format); if (ra.nopace) ra.logBuf.lbnulls |= NOPACE; else ra.logBuf.lbnulls &= ~NOPACE; break; case 'X': break; default: { if( !ra.loggedIn) return; config_menu(); break; } } } storeLog(); pause_override = FALSE; return TRUE; }
/* -------------------------------------------------------------------- */ 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(); }
Bool TERMWINDOWMEMBER net_callout(const char *nodenm) { Bool NetResult = FALSE; char String[80]; if (!read_net_messages()) { cPrintf(getmsg(59)); return (FALSE); } SetDoWhat(NETWORKING); strftime(String, sizeof(String) - 1, cfg.vdatestamp, 0l); cPrintf(getnetmsg(170), String); doccr(); #ifdef WINCIT if (!ReadNodesCit(this, &node, nodenm, MODEM, FALSE)) #else if (!ReadNodesCit(&node, nodenm, MODEM, FALSE)) #endif { cPrintf(getmsg(206), nodenm); doccr(); dump_net_messages(); return (FALSE); } // login user MS.Read = 0; MS.Entered = 0; const l_slot slot = FindPersonByName(node->GetName()); if (slot == CERROR) { cPrintf(getnetmsg(13)); dump_net_messages(); return (FALSE); } ThisSlot = slot; ThisLog = LTab(slot).GetLogIndex(); loggedIn = TRUE; label Buffer; if (CurrentUser->Load(ThisLog)) { setlbvisit(); StatusLine.Update(WC_TWp); callout = TRUE; #ifdef WINCIT trap(T_NETWORK, WindowCaption, getnetmsg(14), CurrentUser->GetName(Buffer, sizeof(Buffer))); #else trap(T_NETWORK, getnetmsg(14), CurrentUser->GetName(Buffer, sizeof(Buffer))); #endif // node logged in NetResult = net_master(); // be sure to hang up if (CommPort->HaveConnection()) { CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82)); Hangup(); if (w) { destroyCitWindow(w, FALSE); } } // terminate user if (NetResult == TRUE) { CurrentUser->SetCallNumber(cfg.callno); time(&logtimestamp); CurrentUser->SetCallTime(logtimestamp); CurrentUser->SetLastMessage(MessageDat.NewestMessage()); storeLog(); loggedIn = FALSE; // trap it #ifdef WINCIT trap(T_NETWORK, WindowCaption, getnetmsg(15), CurrentUser->GetName(Buffer, sizeof(Buffer))); #else trap(T_NETWORK, getnetmsg(15), CurrentUser->GetName(Buffer, sizeof(Buffer))); #endif OC.SetOutFlag(IMPERVIOUS); cPrintf(getnetmsg(16), CurrentUser->GetName(Buffer, sizeof(Buffer))); delete MS.AbortedMessage; MS.AbortedMessage = NULL; #ifndef WINCIT trap(T_NETWORK, getnetmsg(17), MS.Entered); trap(T_NETWORK, getnetmsg(18), MS.Read); trap(T_NETWORK, getnetmsg(19), MS.Expired); trap(T_NETWORK, getnetmsg(20), MS.Duplicate); #else trap(T_NETWORK, WindowCaption, getnetmsg(17), MS.Entered); trap(T_NETWORK, WindowCaption, getnetmsg(18), MS.Read); trap(T_NETWORK, WindowCaption, getnetmsg(19), MS.Expired); trap(T_NETWORK, WindowCaption, getnetmsg(20), MS.Duplicate); #endif } else { loggedIn = FALSE; Bool SaveTrapit = cfg.trapit[T_NETWORK]; if (node->GetNetFail() > 0) { cfg.trapit[T_NETWORK] = TRUE; } if (node->GetNetFail() < 0) { cfg.trapit[T_NETWORK] = FALSE; } #ifdef WINCIT trap(T_NETWORK, WindowCaption, getnetmsg(21), CurrentUser->GetName(Buffer, sizeof(Buffer))); #else trap(T_NETWORK, getnetmsg(21), CurrentUser->GetName(Buffer, sizeof(Buffer))); #endif cfg.trapit[T_NETWORK] = SaveTrapit; } } else { loggedIn = FALSE; } setdefaultconfig(FALSE); // user terminated callout = FALSE; CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(19)); Initport(); if (w) { destroyCitWindow(w, FALSE); } freeNode(&node); dump_net_messages(); return (NetResult); }