Add PID/GID/UID of communications parters with unix domain sockets to login-loglines.
authorWilfried Goesgens <dothebart@citadel.org>
Mon, 22 Nov 2010 19:41:28 +0000 (20:41 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 22 Nov 2010 19:41:28 +0000 (20:41 +0100)
This is an addition to Stuarts patch.

citadel/citserver.c
citadel/citserver.h
citadel/context.h

index 1df958512e88cdf024b5adf3391f77cf487f7b6d..93a02389fb06d367c75308e1e59fb72294e9a583 100644 (file)
@@ -905,6 +905,7 @@ void begin_session(CitContext *con)
        *con->fake_username = '\0';
        *con->fake_hostname = '\0';
        *con->fake_roomname = '\0';
+       *con->cs_clientinfo = '\0';
        generate_nonce(con);
        safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
        safestrncpy(con->cs_addr, "", sizeof con->cs_addr);
@@ -945,6 +946,11 @@ void begin_session(CitContext *con)
                                   database, after a reverse lookup on the UID to get the account name.
                                   We can take this opportunity to check to see if this is a legit account.
                                */
+                               snprintf(con->cs_clientinfo, sizeof(con->cs_clientinfo),
+                                        "PID: "F_PID_T"; UID: "F_UID_T"; GID: "F_XPID_T" ", 
+                                        credentials.pid,
+                                        credentials.uid,
+                                        credentials.gid);
                        }
                }
 #endif
index 437f4b28aa21c7583379f51371d58f2e92ccf41b..c7cb29b0cddbdc073ffecf4e1dc5cc38d029bcb2 100644 (file)
@@ -29,7 +29,7 @@ struct UserProcList {
        char user[64];
 };
 
-#define CTDLUSERIP      (IsEmptyStr(CC->cs_addr) ? "localsocket" : CC->cs_addr)
+#define CTDLUSERIP      (IsEmptyStr(CC->cs_addr) ?  CC->cs_clientinfo: CC->cs_addr)
 
 void cit_backtrace(void);
 void cit_panic_backtrace(int SigNum);
index b4607da63dc8ca37ab65b512b867722ce83c19b6..3b05a2b0d8a7dd1659cdea2eeae93685f0208669 100644 (file)
@@ -63,6 +63,7 @@ struct CitContext {
        int cs_clientdev;       /* client developer ID */
        int cs_clienttyp;       /* client type code */
        int cs_clientver;       /* client version number */
+       char cs_clientinfo[256];/* if its a unix domain socket, some info for logging. */
        uid_t cs_UDSclientUID;  /* the uid of the client when talking via UDS */
        char cs_clientname[32]; /* name of client software */
        char cs_host[64];       /* host logged in from */