Add ability to ban/whitelist via server vita

This commit is contained in:
RonaldReagan
2021-04-25 12:43:06 -06:00
parent f1803b2f52
commit 9391547af7
4 changed files with 14 additions and 5 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ enum { DISC_PROTOCOL = 0, DISC_EOP, DISC_CN, DISC_TAGT, DISC_DUP, DISC_OVERFLOW,
DISC_REMOVED = 32, DISC_SOPLOGINFAIL, DISC_BADNICK, DISC_ANNOY, DISC_SPAM, DISC_DOS, DISC_SPEEDING, DISC_FISHSLAP, DISC_AFK, // disconnected
DISC_KICK = 48, DISC_BAN, DISC_VOTEKICK, DISC_VOTEBAN, DISC_OPKICK, DISC_OPBAN, DISC_TKKICK, DISC_TKBAN, DISC_FFKICK, DISC_FFBAN, DISC_AUTOKICK, DISC_AUTOBAN,
DISC_UNKNOWN = 99, DISC_BECAUSE };
enum { BAN_NONE = 0, BAN_VOTE, BAN_AUTO, BAN_BLACKLIST, BAN_MASTER };
enum { BAN_NONE = 0, BAN_VOTE, BAN_AUTO, BAN_BLACKLIST, BAN_VITA, BAN_MASTER };
#define EXT_ACK -1
#define EXT_VERSION 104
+3 -2
View File
@@ -1026,8 +1026,9 @@ extern void dumpexecutionstack(stream *f);
extern const char *currentserver(int i);
// server
enum { /* timecodes */ VS_FIRSTLOGIN = 0, VS_LASTLOGIN, VS_MUTE, VS_NOVOTE, VS_BAN, VS_ADMIN, VS_OWNER, VS_MAPUPLOAD,
/* stats/counters */ VS_MINUTESCONNECTED, VS_MINUTESACTIVE, VS_FLAGS, VS_FRAGS, VS_DEATHS, VS_TKS, VS_DAMAGE, VS_FF, VS_NUM, VS_NUMCOUNTERS = VS_MINUTESCONNECTED };
enum { /* timecodes */ VS_FIRSTLOGIN = 0, VS_LASTLOGIN, VS_BAN, VS_WHITELISTED, VS_ADMIN, VS_OWNER,
/* stats/counters */ VS_MINUTESCONNECTED, VS_MINUTESACTIVE, VS_FLAGS, VS_FRAGS, VS_DEATHS, VS_TKS, VS_DAMAGE, VS_FF,
/* meta */ VS_NUM, VS_NUMCOUNTERS = VS_MINUTESCONNECTED };
extern const char *vskeywords[VS_NUM + 1], *vsnames[VS_NUM + 1];
extern int modeacronyms;
extern void servertoclient(int chan, uchar *buf, int len, bool demo = false);
+8
View File
@@ -2404,6 +2404,7 @@ int getbantype(int cn)
if(!valid_client(cn)) return BAN_NONE;
client &c = *clients[cn];
if(c.type==ST_LOCAL) return BAN_NONE;
if(c.checkvitadate(VS_BAN)) return BAN_VITA;
if(checkgban(c.peer->address.host)) return BAN_MASTER;
if(ipblacklist.check(c.peer->address.host)) return BAN_BLACKLIST;
loopv(bans)
@@ -3102,6 +3103,13 @@ void process(ENetPacket *packet, int sender, int chan)
int bl = 0, wl = nickblacklist.checkwhitelist(*cl);
if(wl == NWL_PASS) concatstring(tags, ", nickname whitelist match");
if(wl == NWL_UNLISTED) bl = nickblacklist.checkblacklist(cl->name);
bool vitawhitelist = cl->checkvitadate(VS_WHITELISTED);
if (vitawhitelist) {
concatstring(tags, ", vita whitelist match");
banned = false;
}
if(matchreconnect && !banned)
{ // former player reconnecting to a server in match mode
cl->isauthed = true;
+2 -2
View File
@@ -1983,8 +1983,8 @@ void serverparameters_dumpdocu(char *fname)
// player ID bookkeeping
const char *vskeywords[VS_NUM + 1] = { "first", "last", "mute", "novote", "ban", "admin", "owner", "mapupload", "minconn", "minact", "flags", "frags", "deaths", "tks", "damage", "ff", "" };
const char *vsnames[VS_NUM + 1] = { "first login", "last login", "muted until", "novote until", "banned until", "admin until", "owner until", "mapupload until",
const char *vskeywords[VS_NUM + 1] = { "first", "last", "ban", "whitelist", "admin", "owner", "minconn", "minact", "flags", "frags", "deaths", "tks", "damage", "ff", "" };
const char *vsnames[VS_NUM + 1] = { "first login", "last login", "banned until", "whitelisted untils", "admin until", "owner until",
"minutes connected", "minutes active", "flags", "frags", "deaths", "teamkills", "damage dealt", "team damage dealt", "" };
hashtable<uchar32, vita_s> vitas;