Log remote-IP on login attempts
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 21 Nov 2010 18:55:40 +0000 (19:55 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 22 Nov 2010 19:03:45 +0000 (20:03 +0100)
By Stuart Cianos

citadel/citserver.c
citadel/citserver.h

index 859c25fa9d3b46b22cf19212245b32f7470bf248..1df958512e88cdf024b5adf3391f77cf487f7b6d 100644 (file)
@@ -1032,10 +1032,10 @@ void do_command_loop(void) {
 
        /* Log the server command, but don't show passwords... */
        if ( (strncasecmp(cmdbuf, "PASS", 4)) && (strncasecmp(cmdbuf, "SETP", 4)) ) {
-               CtdlLogPrintf(CTDL_INFO, "%s\n", cmdbuf);
+               CtdlLogPrintf(CTDL_INFO, "CtdlCommand [%s] [%s] %s\n", CTDLUSERIP, CC->curr_user, cmdbuf);
        }
        else {
-               CtdlLogPrintf(CTDL_INFO, "<password command hidden from log>\n");
+               CtdlLogPrintf(CTDL_INFO, "CtdlCommand [%s] [%s] <password command hidden from log>\n", CTDLUSERIP, CC->curr_user);
        }
 
        buffer_output();
index 02815f5956e37bbe6f63c2243edfe19e811722c0..437f4b28aa21c7583379f51371d58f2e92ccf41b 100644 (file)
@@ -29,6 +29,8 @@ struct UserProcList {
        char user[64];
 };
 
+#define CTDLUSERIP      (IsEmptyStr(CC->cs_addr) ? "localsocket" : CC->cs_addr)
+
 void cit_backtrace(void);
 void cit_panic_backtrace(int SigNum);
 void master_startup (void);