r4256 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Aug 30 07:53:20 EDT 2008
Author: div0
Date: 2008-08-30 07:53:20 -0400 (Sat, 30 Aug 2008)
New Revision: 4256
Modified:
trunk/data/qcsrc/server/campaign.qc
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/clientcommands.qc
trunk/data/qcsrc/server/ctf.qc
trunk/data/qcsrc/server/domination.qc
trunk/data/qcsrc/server/g_damage.qc
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/ipban.qc
trunk/data/qcsrc/server/keyhunt.qc
trunk/data/qcsrc/server/miscfunctions.qc
trunk/data/qcsrc/server/teamplay.qc
trunk/data/qcsrc/server/vote.qc
Log:
get rid of ServerConsoleEcho workaround; fix a remote DP-console command execution hole in the process :P
Modified: trunk/data/qcsrc/server/campaign.qc
===================================================================
--- trunk/data/qcsrc/server/campaign.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/campaign.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -12,7 +12,7 @@
void CampaignBailout(string s)
{
cvar_set("g_campaign", "0");
- ServerConsoleEcho(strcat("campaign initialization failed: ", s), TRUE);
+ print("campaign initialization failed: ", s, "\n");
return;
}
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/cl_client.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -1083,10 +1083,10 @@
s = "player";
else
s = "bot";
- GameLogEcho(strcat(":join:", ftos(self.playerid), ":", s, ":", self.netname), TRUE);
+ GameLogEcho(strcat(":join:", ftos(self.playerid), ":", s, ":", self.netname));
s = strcat(":team:", ftos(self.playerid), ":");
s = strcat(s, ftos(self.team));
- GameLogEcho(s, FALSE);
+ GameLogEcho(s);
}
self.netname_previous = strzone(self.netname);
@@ -1233,7 +1233,7 @@
detach_entcs();
if(cvar("sv_eventlog"))
- GameLogEcho(strcat(":part:", ftos(self.playerid)), FALSE);
+ GameLogEcho(strcat(":part:", ftos(self.playerid)));
bprint ("^4",self.netname);
bprint ("^4 disconnected\n");
@@ -1949,7 +1949,7 @@
if(self.netname_previous != self.netname)
{
if(cvar("sv_eventlog"))
- GameLogEcho(strcat(":name:", ftos(self.playerid), ":", self.netname), TRUE);
+ GameLogEcho(strcat(":name:", ftos(self.playerid), ":", self.netname));
if(self.netname_previous)
strunzone(self.netname_previous);
self.netname_previous = strzone(self.netname);
Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/clientcommands.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -96,7 +96,7 @@
}
else
sprint(self, msgstr);
- ServerConsoleEcho(strcat("NOTE: ", playername(self), "^7 is flooding."), TRUE);
+ print("NOTE: ", playername(self), "^7 is flooding.\n");
}
else if(teamsay)
{
@@ -131,7 +131,6 @@
}
else
bprint(msgstr);
- //ServerConsoleEcho(substring(msgstr, 1, strlen(msgstr) - 2), TRUE);
}
strunzone(msgstr);
@@ -370,7 +369,7 @@
if(cmd != "playerskin")
if(cmd != "god") if(cmd != "notarget") if(cmd != "fly") if(cmd != "give") if(cmd != "noclip")
{
- ServerConsoleEcho(strcat("WARNING: Invalid clientcommand by ", self.netname, ": ", s), TRUE);
+ print("WARNING: Invalid clientcommand by ", self.netname, ": ", s, "\n");
return;
}
*/
@@ -452,7 +451,7 @@
reset_map();
if(cvar("sv_eventlog"))
- GameLogEcho(":restart", FALSE);
+ GameLogEcho(":restart");
}
/**
Modified: trunk/data/qcsrc/server/ctf.qc
===================================================================
--- trunk/data/qcsrc/server/ctf.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/ctf.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -74,7 +74,7 @@
s = strcat(s, ":", ftos(flagteam));
if(actor != world)
s = strcat(s, ":", ftos(actor.playerid));
- GameLogEcho(s, FALSE);
+ GameLogEcho(s);
}
void RegenFlag(entity e)
Modified: trunk/data/qcsrc/server/domination.qc
===================================================================
--- trunk/data/qcsrc/server/domination.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/domination.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -29,7 +29,7 @@
s = strcat(":dom:", mode);
s = strcat(s, ":", ftos(team_before));
s = strcat(s, ":", ftos(actor.playerid));
- GameLogEcho(s, FALSE);
+ GameLogEcho(s);
}
void() dom_spawnteams;
Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/g_damage.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -137,7 +137,7 @@
s = strcat(s, ":victimitems=");
s = AppendItemcodes(s, killed);
}
- GameLogEcho(s, FALSE);
+ GameLogEcho(s);
}
void Obituary (entity attacker, entity targ, float deathtype)
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/g_world.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -265,7 +265,7 @@
{
s = strcat(cvar_string("sv_eventlog_files_counter"), ".");
s = strcat(s, ftos(random()));
- GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s), FALSE);
+ GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s));
s = ":gameinfo:mutators:LIST";
if(cvar("g_grappling_hook"))
s = strcat(s, ":grappling_hook");
@@ -289,8 +289,8 @@
s = strcat(s, ":midair");
if(cvar("g_minstagib"))
s = strcat(s, ":minstagib");
- GameLogEcho(s, FALSE);
- GameLogEcho(":gameinfo:end", FALSE);
+ GameLogEcho(s);
+ GameLogEcho(":gameinfo:end");
}
cvar_set("nextmap", "");
@@ -886,9 +886,9 @@
s = strcat(s, GetGametype(), "_", GetMapname(), ":", ftos(rint(time)));
if(to_console)
- ServerConsoleEcho(s, FALSE);
+ print(s, "\n");
if(to_eventlog)
- GameLogEcho(s, FALSE);
+ GameLogEcho(s);
if(to_file)
{
file = fopen(cvar_string("sv_logscores_filename"), FILE_APPEND);
@@ -899,10 +899,9 @@
}
s = strcat(":labels:player:", GetPlayerScoreString(world, 0));
- if(to_console)
- ServerConsoleEcho(s, TRUE);
+ print(s, "\n");
if(to_eventlog)
- GameLogEcho(s, TRUE);
+ GameLogEcho(s);
if(to_file)
fputs(file, strcat(s, "\n"));
@@ -918,9 +917,9 @@
s = strcat(s, "spectator:");
if(to_console)
- ServerConsoleEcho(strcat(s, other.netname), TRUE);
+ print(s, other.netname, "\n");
if(to_eventlog)
- GameLogEcho(strcat(s, ftos(other.playerid), ":", other.netname), TRUE);
+ GameLogEcho(strcat(s, ftos(other.playerid), ":", other.netname));
if(to_file)
fputs(file, strcat(s, other.netname, "\n"));
}
@@ -930,9 +929,9 @@
{
s = strcat(":labels:teamscores:", GetTeamScoreString(0, 0));
if(to_console)
- ServerConsoleEcho(s, TRUE);
+ print(s, "\n");
if(to_eventlog)
- GameLogEcho(s, TRUE);
+ GameLogEcho(s);
if(to_file)
fputs(file, strcat(s, "\n"));
@@ -941,18 +940,18 @@
s = strcat(":teamscores:see-labels:", GetTeamScoreString(i, 0));
s = strcat(s, ":", ftos(i));
if(to_console)
- ServerConsoleEcho(s, TRUE);
+ print(s, "\n");
if(to_eventlog)
- GameLogEcho(s, TRUE);
+ GameLogEcho(s);
if(to_file)
fputs(file, strcat(s, "\n"));
}
}
if(to_console)
- ServerConsoleEcho(":end", FALSE);
+ print(":end\n");
if(to_eventlog)
- GameLogEcho(":end", FALSE);
+ GameLogEcho(":end");
if(to_file)
{
fputs(file, ":end\n");
@@ -1028,7 +1027,7 @@
DumpStats(TRUE);
if(cvar("sv_eventlog"))
- GameLogEcho(":gameover", FALSE);
+ GameLogEcho(":gameover");
GameLogClose();
@@ -1342,7 +1341,7 @@
if(e)
sprint(e, strcat(s, "\n"));
else
- ServerConsoleEcho(s, TRUE);
+ print(s, "\n");
}
void ShuffleMaplist()
@@ -1712,7 +1711,7 @@
strunzone(mapvote_suggestions[i]);
mapvote_suggestions[i] = strzone(m);
if(cvar("sv_eventlog"))
- GameLogEcho(strcat(":vote:suggested:", m, ":", ftos(self.playerid)), TRUE);
+ GameLogEcho(strcat(":vote:suggested:", m, ":", ftos(self.playerid)));
return strcat("Suggestion of ", m, " accepted.");
}
@@ -1907,9 +1906,9 @@
}
result = strcat(result, ":didn't vote:", ftos(didntvote));
- GameLogEcho(result, FALSE);
+ GameLogEcho(result);
if(mapvote_maps_suggested[mappos])
- GameLogEcho(strcat(":vote:suggestion_accepted:", mapvote_maps[mappos]), FALSE);
+ GameLogEcho(strcat(":vote:suggestion_accepted:", mapvote_maps[mappos]));
}
FOR_EACH_REALCLIENT(other)
@@ -2008,7 +2007,7 @@
}
result = strcat(result, ":didn't vote:", ftos(didntvote));
if(cvar("sv_eventlog"))
- GameLogEcho(result, FALSE);
+ GameLogEcho(result);
}
return FALSE;
@@ -2236,7 +2235,7 @@
clients_found = 0;
FOR_EACH_REALCLIENT(self)
{
- ServerConsoleEcho(strcat("Redirecting: sending connect command to ", self.netname), FALSE);
+ print("Redirecting: sending connect command to ", self.netname, "\n");
if(redirection_target == "self")
stuffcmd(self, "\ndisconnect; reconnect\n");
else
@@ -2244,7 +2243,7 @@
++clients_found;
}
- ServerConsoleEcho(strcat("Redirecting: ", ftos(clients_found), " clients left."), FALSE);
+ print("Redirecting: ", ftos(clients_found), " clients left.\n");
if(time > redirection_timeout || clients_found == 0)
localcmd("\nwait; wait; wait; quit\n");
Modified: trunk/data/qcsrc/server/ipban.qc
===================================================================
--- trunk/data/qcsrc/server/ipban.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/ipban.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -78,7 +78,7 @@
msg = strcat("#", ftos(i), ": ");
msg = strcat(msg, ban_ip[i], " is still banned for ");
msg = strcat(msg, ftos(ban_expire[i] - time), " seconds");
- ServerConsoleEcho(msg, FALSE);
+ print(msg, "\n");
}
}
@@ -149,7 +149,7 @@
return FALSE;
// okay, insert our new victim as i
Ban_Delete(i);
- ServerConsoleEcho(strcat(ip, " has been banned for ", ftos(bantime), " seconds"), FALSE);
+ print(ip, " has been banned for ", ftos(bantime), " seconds\n");
ban_expire[i] = time + bantime;
ban_ip[i] = strzone(ip);
ban_count = max(ban_count, i + 1);
Modified: trunk/data/qcsrc/server/keyhunt.qc
===================================================================
--- trunk/data/qcsrc/server/keyhunt.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/keyhunt.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -143,7 +143,7 @@
s = strcat(s, ":", ftos(frags_owner), ":");
if(key)
s = strcat(s, key.netname);
- GameLogEcho(s, FALSE);
+ GameLogEcho(s);
}
vector kh_AttachedOrigin(entity e) // runs when a team captures the flag, it can run 2 or 3 times.
Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/miscfunctions.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -141,34 +141,8 @@
centerprint(head, s);
}
-void ServerConsoleEcho(string s, float check_dangerous)
+void GameLogEcho(string s)
{
- local string ch;
- if (checkextension("DP_SV_PRINT"))
- print(s, "\n");
- else
- {
- localcmd("echo \"");
- if(check_dangerous)
- {
- while(strlen(s))
- {
- ch = substring(s, 0, 1);
- if(ch != "\"" && ch != "\r" && ch != "\n")
- localcmd(ch);
- s = substring(s, 1, strlen(s) - 1);
- }
- }
- else
- {
- localcmd(s);
- }
- localcmd("\"\n");
- }
-}
-
-void GameLogEcho(string s, float check_dangerous)
-{
string fn;
float matches;
@@ -196,7 +170,7 @@
}
if(cvar("sv_eventlog_console"))
{
- ServerConsoleEcho(s, check_dangerous);
+ print(s, "\n");
}
}
Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/teamplay.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -82,7 +82,7 @@
return;
str = strcat(":team:", ftos(pl.playerid), ":");
str = strcat(str, ftos(pl.team));
- GameLogEcho(str, FALSE);
+ GameLogEcho(str);
}
void WriteGameCvars()
@@ -1201,7 +1201,7 @@
steam = COLOR_TEAM3;
else if(source_team == 4)
steam = COLOR_TEAM4;
- ServerConsoleEcho(strcat("Team ", ftos(source_team), " too large, complaining."), TRUE);
+ print("Team ", ftos(source_team), " too large, complaining.\n");
FOR_EACH_REALPLAYER(head)
{
if(head.team == steam)
Modified: trunk/data/qcsrc/server/vote.qc
===================================================================
--- trunk/data/qcsrc/server/vote.qc 2008-08-30 11:49:34 UTC (rev 4255)
+++ trunk/data/qcsrc/server/vote.qc 2008-08-30 11:53:20 UTC (rev 4256)
@@ -137,7 +137,7 @@
}
bprint("\{1}^2* ^3", VoteNetname(votecaller), "^2 calls a vote for ", votecalledvote_display, "\n");
if(cvar("sv_eventlog"))
- GameLogEcho(strcat(":vote:vcall:", ftos(votecaller.playerid), ":", votecalledvote_display), TRUE);
+ GameLogEcho(strcat(":vote:vcall:", ftos(votecaller.playerid), ":", votecalledvote_display));
VoteCount(); // needed if you are the only one
} else {
print_to(e, "^1This vote is not ok. See help for more info.");
@@ -175,7 +175,7 @@
}
bprint("\{1}^2* ^3", VoteNetname(votecaller), "^2 calls a vote to become ^3master^2.\n");
if(cvar("sv_eventlog"))
- GameLogEcho(strcat(":vote:vcall:", ftos(votecaller.playerid), ":", votecalledvote_display), FALSE);
+ GameLogEcho(strcat(":vote:vcall:", ftos(votecaller.playerid), ":", votecalledvote_display));
VoteCount(); // needed if you are the only one
}
} else {
@@ -216,7 +216,7 @@
}
bprint("\{1}^2* ^3", VoteNetname(e), "^2 used his ^3master^2 status to do \"^2", dovote_display, "^2\".\n");
if(cvar("sv_eventlog"))
- GameLogEcho(strcat(":vote:vdo:", ftos(e.playerid), ":", dovote_display), FALSE);
+ GameLogEcho(strcat(":vote:vdo:", ftos(e.playerid), ":", dovote_display));
localcmd(strcat(dovote, "\n"));
} else {
print_to(e, "^1This command is not ok. See help for more info.");
@@ -233,13 +233,13 @@
if (e)
e.vote_master = granted;
if(granted) {
- ServerConsoleEcho(strcat("Accepted master login from ", VoteNetname(e)), TRUE);
+ print("Accepted master login from ", VoteNetname(e), "\n");
bprint("\{1}^2* ^3", VoteNetname(e), "^2 logged in as ^3master^2\n");
if(cvar("sv_eventlog"))
- GameLogEcho(strcat(":vote:vlogin:", ftos(e.playerid)), FALSE);
+ GameLogEcho(strcat(":vote:vlogin:", ftos(e.playerid)));
}
else
- ServerConsoleEcho(strcat("REJECTED master login from ", VoteNetname(e)), TRUE);
+ print("REJECTED master login from ", VoteNetname(e), "\n");
}
else
print_to(e, "^1Login to become master is NOT allowed.");
@@ -465,7 +465,7 @@
void VoteStop(entity stopper) {
bprint("\{1}^2* ^3", VoteNetname(stopper), "^2 stopped ^3", VoteNetname(votecaller), "^2's vote\n");
if(cvar("sv_eventlog"))
- GameLogEcho(strcat(":vote:vstop:", ftos(stopper.playerid)), FALSE);
+ GameLogEcho(strcat(":vote:vstop:", ftos(stopper.playerid)));
if(stopper == votecaller) {
// no wait for next vote so you can correct your vote
if(votecaller) {
@@ -507,7 +507,7 @@
s = strcat(s, ":", ftos(abstaincount));
s = strcat(s, ":", ftos(notvoters));
s = strcat(s, ":", ftos(mincount));
- GameLogEcho(s, FALSE);
+ GameLogEcho(s);
}
}
More information about the nexuiz-commits
mailing list