Created attachment 1823[details]
rconInfo-svn1102M.diff
Adds logging of arguments to rcon commands.
Comment 2David Severwright
2009-02-27 09:04:55 EST
Created attachment 1985[details]
rconlog.diff
This patch logs all rcon commands to a file specified by sv_rconLog, along with timestamps and the IP etc.
Patch against ioq3 r1499.
In a few cases there you're declaring variables after the beginning of a code block, which if I recall correctly isn't allowed in C89.
Also I think that clearing the cvar on failure isn't such a great idea. Could easily lead to moments like "well of course it's not logging, the cvar's blank" ..."huh, I guess I must have not set it properly then" and other such confusions. Trying to open the file every time is not expensive resourcewise, nor is the issue of console spam particularly relevant since you're going to be printing at least one other line anyway.
You could even make it such that it simply returns an error to whoever sent the command if the log variable is set but could not be written.
And while I'm there, I'd personally think ordering the timestamp year, month, day might be more logical. I realise that at this stage I'm mostly just being fussy though :)
Potential crash bug if % is allowed in the netcode (such as in trem):
Replace Com_Printf(message) with Com_Printf("%s", message)
Otherwise I could just put a bunch of %s in the rcon message and it would crash the server even if the password is wrong.
Comment 5David Severwright
2009-02-27 14:53:39 EST
Created attachment 1986[details]
rconlog-2.diff
Fixed the % thing (oops), fixed the c89 stuff (not that it compiles as c89 anyway).
The cvar is now never cleared, the error is duplicated to the remote user if the password is correct.
The date is now also in yyyy-mm-dd HH:MM:SS format.
I'm sorry, but I don't think ioquake3 needs yet another log file or cvar for this matter. I applied your first patch though so that rcon commands are mirrored in the general server log. If you need timestamps in front of rcon messages, one should think about adding timestamps directly in the Com_Printf() function.
Thank you for your patch!
Created attachment 1823 [details] rconInfo-svn1102M.diff Adds logging of arguments to rcon commands.
Created attachment 1985 [details] rconlog.diff This patch logs all rcon commands to a file specified by sv_rconLog, along with timestamps and the IP etc. Patch against ioq3 r1499.
Created attachment 1986 [details] rconlog-2.diff Fixed the % thing (oops), fixed the c89 stuff (not that it compiles as c89 anyway). The cvar is now never cleared, the error is duplicated to the remote user if the password is correct. The date is now also in yyyy-mm-dd HH:MM:SS format.