xserver: Branch 'server-1.2-branch' - 3 commits

Alan Coopersmith alanc at kemper.freedesktop.org
Fri Nov 3 23:51:15 EET 2006


 hw/xfree86/Makefile.am |    9 ++++-----
 os/connection.c        |   42 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 42 insertions(+), 9 deletions(-)

New commits:
diff-tree 19a4be9bf3b38206dbd9313229d9e107d4617e33 (from bc6f95af33caa5b05c1e7bb750592ebd39266270)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Nov 1 16:17:49 2006 -0800

    If getpeerucred() is available, include pid & zoneid in audit messages too
    (cherry picked from a7b944f0d96c3e0e15e75378a04def1ac96089fb commit)

diff --git a/os/connection.c b/os/connection.c
index 60f3b9f..6ca4010 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -165,6 +165,11 @@ extern __const__ int _nfiles;
 #include <netdnet/dn.h>
 #endif /* DNETCONN */
 
+#ifdef HAS_GETPEERUCRED
+# include <ucred.h>
+# include <zone.h>
+#endif
+
 int lastfdesc;			/* maximum file descriptor */
 
 fd_set WellKnownConnections;	/* Listener mask */
@@ -550,8 +555,13 @@ AuthAudit (ClientPtr client, Bool letin,
     char addr[128];
     char *out = addr;
     int client_uid;
-    char client_uid_string[32];
-    
+    char client_uid_string[64];
+#ifdef HAS_GETPEERUCRED
+    ucred_t *peercred = NULL;
+    pid_t client_pid = -1;
+    zoneid_t client_zid = -1;
+#endif
+
     if (!len)
         strcpy(out, "local host");
     else
@@ -588,10 +598,24 @@ AuthAudit (ClientPtr client, Bool letin,
 	    strcpy(out, "unknown address");
 	}
 
+#ifdef HAS_GETPEERUCRED
+    if (getpeerucred(((OsCommPtr)client->osPrivate)->fd, &peercred) >= 0) {
+	client_uid = ucred_geteuid(peercred);
+	client_pid = ucred_getpid(peercred);
+	client_zid = ucred_getzoneid(peercred);
+
+	ucred_free(peercred);
+	snprintf(client_uid_string, sizeof(client_uid_string),
+		 " (uid %ld, pid %ld, zone %ld)",
+		 (long) client_uid, (long) client_pid, (long) client_zid);
+    }
+#else    
     if (LocalClientCred(client, &client_uid, NULL) != -1) {
 	snprintf(client_uid_string, sizeof(client_uid_string),
 		 " (uid %d)", client_uid);
-    } else {
+    }
+#endif
+    else {
 	client_uid_string[0] = '\0';
     }
     
diff-tree bc6f95af33caa5b05c1e7bb750592ebd39266270 (from f1ef85689a47e1d77b3946ae3ba2cb96fbb27457)
Author: Alan Coopersmith <alan.coopersmith at 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>
    (cherry picked from fbfb35189ef6666707097704b43e052cb2f919ae commit)

diff --git a/os/connection.c b/os/connection.c
index 571ba58..60f3b9f 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -549,7 +549,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
@@ -585,14 +587,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
diff-tree f1ef85689a47e1d77b3946ae3ba2cb96fbb27457 (from 00e82378398052d365d1b131092e676ede7535d1)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Tue Oct 31 16:05:48 2006 -0800

    Fix automake error: BUILT_SOURCES was defined multiple times on Solaris
    (cherry picked from c03311a1e78daa291477a67b1bb7206772108c5d commit)

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 64c54f8..72befea 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -58,12 +58,15 @@ Xorg_LDADD = $(XORG_LIBS) \
 
 Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 
+BUILT_SOURCES = xorg.conf.example
+CLEAN = xorg.conf.example xorg.conf.example.pre
+EXTRA_DIST = xorgconf.cpp
 
 if SOLARIS_ASM_INLINE
 # Needs to be built before any files are compiled when using Sun compilers
 # so in*/out* inline definitions are properly processed.
 
-BUILT_SOURCES = os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il
+BUILT_SOURCES += os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il
 
 os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il:
 	cd os-support/solaris ; make solaris-$(SOLARIS_INOUT_ARCH).il
@@ -84,10 +87,6 @@ endif
 optionsdir = $(libdir)/X11
 dist_options_DATA = Options
 
-BUILT_SOURCES = xorg.conf.example
-CLEAN = xorg.conf.example xorg.conf.example.pre
-EXTRA_DIST = xorgconf.cpp
-
 CPP_FILES_FLAGS = \
 	-DRGBPATH=\"$(RGB_DB)\" \
 	-DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \



More information about the xorg-commit mailing list