From 6bc37b980515995b0944632e5a062246683f1d97 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 15 Feb 2017 14:18:35 +0000 Subject: AUDIT messages should contain uid for local accesses (X.org bug #1997) commit fbfb35189ef6666707097704b43e052cb2f919ae Author: Alan Coopersmith Date: Wed Nov 1 15:11:48 2006 -0800 Bug #1997: AUDIT messages should contain uid for local accesses --- nx-X11/programs/Xserver/os/connection.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c index 0a52214b0..151605cfb 100644 --- a/nx-X11/programs/Xserver/os/connection.c +++ b/nx-X11/programs/Xserver/os/connection.c @@ -534,6 +534,9 @@ AuthAudit (ClientPtr client, Bool letin, char addr[128]; char *out = addr; + int client_uid; + char client_uid_string[32]; + if (!len) strcpy(out, "local host"); else @@ -563,14 +566,22 @@ AuthAudit (ClientPtr client, Bool letin, default: strcpy(out, "unknown address"); } - + + if (LocalClientCred(client, &client_uid, NULL) != -1) { + snprintf(client_uid_string, sizeof(client_uid_string), + " (uid %d)", client_uid); + } else { + client_uid_string[0] = '\0'; + } + if (proto_n) - AuditF("client %d %s from %s\n Auth name: %.*s ID: %d\n", + AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n", client->index, letin ? "connected" : "rejected", addr, - (int)proto_n, auth_proto, auth_id); + client_uid_string, (int)proto_n, auth_proto, auth_id); else - AuditF("client %d %s from %s\n", - client->index, letin ? "connected" : "rejected", addr); + AuditF("client %d %s from %s%s\n", + client->index, letin ? "connected" : "rejected", addr, + client_uid_string); } XID -- cgit v1.2.3