Bug 3748 - Slightly more logging for rcon.
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: GIT MASTER
Hardware: PC All
: P3 enhancement
Assignee: Tim Angus
QA Contact: Tremulous Bugs
URL:
Depends on:
Blocks:
 
Reported: 2008-08-16 16:54 EDT by David Severwright
Modified: 2009-09-17 12:57:59 EDT
1 user (show)

See Also:


Attachments
rconInfo-svn1102M.diff (728 bytes, patch)
2008-08-16 16:55 EDT, David Severwright
rconlog.diff (2.98 KB, patch)
2009-02-27 09:04 EST, David Severwright
rconlog-2.diff (3.29 KB, patch)
2009-02-27 14:53 EST, David Severwright

Description David Severwright 2008-08-16 16:54:51 EDT
Adds the arguments to the print so you know what's being done.
Comment 1 David Severwright 2008-08-16 16:55:39 EDT
Created attachment 1823 [details]
rconInfo-svn1102M.diff

Adds logging of arguments to rcon commands.
Comment 2 David 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.
Comment 3 Ben Millwood 2009-02-27 12:45:03 EST
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 :)
Comment 4 Amanieu d'Antras 2009-02-27 13:20:23 EST
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 5 David 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.
Comment 6 Thilo Schulz 2009-09-17 12:57:59 EDT
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!