Commit 6bc37b98 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Mike Gabriel

AUDIT messages should contain uid for local accesses (X.org bug #1997)

commit fbfb35189ef6666707097704b43e052cb2f919ae Author: Alan Coopersmith <alan.coopersmith@sun.com> Date: Wed Nov 1 15:11:48 2006 -0800 Bug #1997: AUDIT messages should contain uid for local accesses <https://bugs.freedesktop.org/show_bug.cgi?id=1997>
parent 0338cbc3
...@@ -534,6 +534,9 @@ AuthAudit (ClientPtr client, Bool letin, ...@@ -534,6 +534,9 @@ AuthAudit (ClientPtr client, Bool letin,
char addr[128]; char addr[128];
char *out = addr; char *out = addr;
int client_uid;
char client_uid_string[32];
if (!len) if (!len)
strcpy(out, "local host"); strcpy(out, "local host");
else else
...@@ -563,14 +566,22 @@ AuthAudit (ClientPtr client, Bool letin, ...@@ -563,14 +566,22 @@ AuthAudit (ClientPtr client, Bool letin,
default: default:
strcpy(out, "unknown address"); 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) 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, client->index, letin ? "connected" : "rejected", addr,
(int)proto_n, auth_proto, auth_id); client_uid_string, (int)proto_n, auth_proto, auth_id);
else else
AuditF("client %d %s from %s\n", AuditF("client %d %s from %s%s\n",
client->index, letin ? "connected" : "rejected", addr); client->index, letin ? "connected" : "rejected", addr,
client_uid_string);
} }
XID XID
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment