31 #define MAX_IPBAN_URIS (URI_GET_IPBAN_END - URI_GET_IPBAN + 1) 39 uri =
strcat(uri,
"&ip=", uri_escape(ip));
40 uri =
strcat(uri,
"&duration=",
ftos(bantime));
41 uri =
strcat(uri,
"&reason=", uri_escape(reason));
46 for(i = 0; i < n; ++i)
61 uri =
strcat(uri,
"&ip=", uri_escape(ip));
66 for(i = 0; i < n; ++i)
93 LOG_INFO(
"Received ban list for invalid ID");
100 string prelude =
strcat(
"Received ban list from ", uri,
": ");
104 LOG_INFO(prelude,
"rejected (unexpected)");
112 LOG_INFO(prelude,
"rejected (too late)");
117 if(syncinterval == 0)
119 LOG_INFO(prelude,
"rejected (syncing disabled)");
133 LOG_INFO(prelude,
"error: received HTML instead of a ban list");
139 LOG_INFO(prelude,
"error: received carriage returns");
150 LOG_INFO(prelude,
"error: received invalid item count: ",
ftos(n));
156 for(i = 0; i < n; i += 4)
160 reason =
argv(i + 2);
161 serverip =
argv(i + 3);
163 LOG_TRACE(
"received ban list item ",
ftos(i / 4),
": ip=", ip);
174 for(j = 0; j < l; ++j)
177 LOG_INFO(
"Invalid character ",
substring(ip, j, 1),
" in IP address ", ip,
". Skipping this ban.");
190 Ban_Insert(ip, timeleft,
strcat(
"ban synced from ", serverip,
" at ", uri), 0);
191 LOG_INFO(
"Ban list syncing: accepted ban of ", ip,
" by ", serverip,
" at ", uri,
": ", reason);
220 string s =
argv(0);
for(i = 1; i < argc; ++i) s =
strcat(s,
";",
argv(i));
231 for(i = 0; i < n; ++i)
315 ban_count = (n - 1) / 2;
323 entity e =
new(bansyncer);
325 e.nextthink =
time + 1;
333 LOG_INFO(
"^2Listing all existing active bans:");
350 LOG_INFO(
"^2Done listing all active (",
ftos(n),
") bans.");
356 float i1, i2, i3, i4;
359 if(client.crypto_idfp_signed)
364 s = client.netaddress;
413 float i, b, e, ipbanned;
429 for(i = b; i < e; ++i)
435 if(
ban_ip1 == s) ipbanned =
true;
436 if(
ban_ip2 == s) ipbanned =
true;
437 if(
ban_ip3 == s) ipbanned =
true;
438 if(
ban_ip4 == s) ipbanned =
true;
455 if (!client.crypto_idfp)
456 LOG_INFOF(
"^1NOTE:^7 banned client %s just tried to enter\n",
459 LOG_INFOF(
"^1NOTE:^7 banned client %s (%s) just tried to enter\n",
460 client.netaddress, client.crypto_idfp);
463 sprint(client,
"You are banned from this server.\n");
473 if (client.ban_checked)
return false;
474 client.ban_checked =
true;
491 reason =
strcat(reason,
": affects ");
493 reason =
strcat(reason,
", ");
494 reason =
strcat(reason, it.netname);
496 s =
strcat(s,
"^1NOTE:^7 banned client ", it.netname,
"^7 has to go\n");
505 float Ban_Insert(
string ip,
float bantime,
string reason,
float dosync)
519 LOG_TRACE(ip,
"'s ban has been prolonged to ",
ftos(bantime),
" seconds from now");
559 LOG_INFO(ip,
" could not get banned due to no free ban slot");
564 LOG_TRACE(ip,
" has been banned for ",
ftos(bantime),
" seconds");
567 ban_count =
max(ban_count, i + 1);
string autocvar_g_banned_list
float Ban_Insert(string ip, float bantime, string reason, float dosync)
float OnlineBanList_Timeout
bool autocvar_g_banned_list_idmode
float autocvar_g_ban_sync_interval
string Ban_Enforce(float j, string reason)
bool autocvar_g_ban_telluser
#define IS_REAL_CLIENT(v)
float ban_expire[BAN_MAX]
const int URI_GET_DISCARD
void OnlineBanList_URI_Get_Callback(float id, float status, string data)
#define FOREACH_CLIENTSLOT(cond, body)
bool Ban_MaybeEnforceBan(entity client)
float Ban_IsClientBanned(entity client, float idx)
void OnlineBanList_SendUnban(string ip)
bool autocvar_g_ban_sync_trusted_servers_verify
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
float Ban_GetClientIP(entity client)
void OnlineBanList_SendBan(string ip, float bantime, string reason)
float Ban_Delete(float i)
bool Ban_MaybeEnforceBanOnce(entity client)
float OnlineBanList_RequestWaiting[MAX_IPBAN_URIS]
string autocvar_g_ban_sync_uri
void Ban_KickBanClient(entity client, float bantime, float masksize, string reason)
string autocvar_g_ban_sync_trusted_servers
#define tokenizebyseparator
void OnlineBanList_Think(entity this)
float autocvar_g_ban_sync_timeout
string OnlineBanList_Servers