From e1be7134a699b90c0a016608b1f185d54bdf983e Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Fri, 26 Jan 2018 04:28:58 +0000 Subject: [PATCH] Don't require sysop system password re-authentication unless 15 minutes or more have elapsed since the last system password (SY:) prompt. Similar to Linux 'sudo' command. Might make this time configurable rather than hard-coded at some point, but 15 minutes seems like a good default. --- src/sbbs3/con_hi.cpp | 6 ++++-- src/sbbs3/main.cpp | 1 + src/sbbs3/sbbs.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sbbs3/con_hi.cpp b/src/sbbs3/con_hi.cpp index 611ba5dc54..8774b12b42 100644 --- a/src/sbbs3/con_hi.cpp +++ b/src/sbbs3/con_hi.cpp @@ -1,6 +1,5 @@ -/* con_hi.cpp */ - /* Synchronet hi-level console routines */ +// vi: tabstop=4 /* $Id$ */ @@ -155,6 +154,8 @@ bool sbbs_t::chksyspass(const char* sys_pw) logline(LOG_NOTICE,"S!","Remote sysop access disabled"); return(false); } + if(time(NULL) - last_sysop_auth < 15*60) + return true; if(sys_pw != NULL) SAFECOPY(str, sys_pw); else { @@ -172,5 +173,6 @@ bool sbbs_t::chksyspass(const char* sys_pw) logline(LOG_NOTICE,"S!",str2); return(false); } + last_sysop_auth = time(NULL); return(true); } diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index d453d3bd54..25eaa49bd5 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -3162,6 +3162,7 @@ sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const scanposts_inside = false; scansubs_inside = false; timeleft = 60*10; /* just incase this is being used for calling gettimeleft() */ + last_sysop_auth = 0; uselect_total = 0; lbuflen = 0; keybufbot=keybuftop=0; /* initialize [unget]keybuf pointers */ diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h index dbaf9f0cb5..df2c6d2b07 100644 --- a/src/sbbs3/sbbs.h +++ b/src/sbbs3/sbbs.h @@ -463,6 +463,7 @@ public: ulong console; /* Defines current Console settings */ char wordwrap[81]; /* Word wrap buffer */ time_t now, /* Used to store current time in Unix format */ + last_sysop_auth,/* Time sysop was last authenticated */ answertime, /* Time call was answered */ logontime, /* Time user logged on */ starttime, /* Time stamp to use for time left calcs */ -- GitLab