xserver: Branch 'master'

Eamon Walsh ewalsh at kemper.freedesktop.org
Tue Feb 12 16:59:35 PST 2008


 Xext/xace.c    |   18 +++++++-----------
 Xext/xace.h    |    4 ++++
 dix/dispatch.c |   10 ++++------
 3 files changed, 15 insertions(+), 17 deletions(-)

New commits:
commit 0d492b2166c4026b9078ffd86d89a31ebe590be4
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Tue Feb 12 19:59:10 2008 -0500

    XACE: Move the selection access hook to its own function.

diff --git a/Xext/xace.c b/Xext/xace.c
index b2c7e4a..e88debc 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -63,6 +63,13 @@ int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
     return rec.status;
 }
 
+int XaceHookSelectionAccess(ClientPtr client, Atom name, Mask access_mode)
+{
+    XaceSelectionAccessRec rec = { client, name, access_mode, Success };
+    CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec);
+    return rec.status;
+}
+
 void XaceHookAuditEnd(ClientPtr ptr, int result)
 {
     XaceAuditRec rec = { ptr, result };
@@ -169,17 +176,6 @@ int XaceHook(int hook, ...)
 	    prv = &rec.status;
 	    break;
 	}
-	case XACE_SELECTION_ACCESS: {
-	    XaceSelectionAccessRec rec = {
-		va_arg(ap, ClientPtr),
-		va_arg(ap, Atom),
-		va_arg(ap, Mask),
-		Success /* default allow */
-	    };
-	    calldata = &rec;
-	    prv = &rec.status;
-	    break;
-	}
 	case XACE_SCREEN_ACCESS:
 	case XACE_SCREENSAVER_ACCESS: {
 	    XaceScreenAccessRec rec = {
diff --git a/Xext/xace.h b/Xext/xace.h
index 6f1f267..2016ca3 100644
--- a/Xext/xace.h
+++ b/Xext/xace.h
@@ -69,6 +69,8 @@ extern int XaceHook(
 extern int XaceHookDispatch(ClientPtr ptr, int major);
 extern int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
 				  PropertyPtr pProp, Mask access_mode);
+extern int XaceHookSelectionAccess(ClientPtr ptr, Atom name,
+				   Mask access_mode);
 extern void XaceHookAuditEnd(ClientPtr ptr, int result);
 
 /* Register a callback for a given hook.
@@ -106,12 +108,14 @@ extern void XaceCensorImage(
 #define XaceHook(args...) Success
 #define XaceHookDispatch(args...) Success
 #define XaceHookPropertyAccess(args...) Success
+#define XaceHookSelectionAccess(args...) Success
 #define XaceHookAuditEnd(args...) { ; }
 #define XaceCensorImage(args...) { ; }
 #else
 #define XaceHook(...) Success
 #define XaceHookDispatch(...) Success
 #define XaceHookPropertyAccess(...) Success
+#define XaceHookSelectionAccess(...) Success
 #define XaceHookAuditEnd(...) { ; }
 #define XaceCensorImage(...) { ; }
 #endif
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 0bca441..3589fba 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -995,8 +995,8 @@ ProcSetSelectionOwner(ClientPtr client)
     {
 	int i = 0;
 
-	rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->selection,
-		      DixSetAttrAccess);
+	rc = XaceHookSelectionAccess(client, stuff->selection,
+				     DixSetAttrAccess);
 	if (rc != Success)
 	    return rc;
 
@@ -1081,8 +1081,7 @@ ProcGetSelectionOwner(ClientPtr client)
 	int rc, i;
         xGetSelectionOwnerReply reply;
 
-	rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->id,
-		      DixGetAttrAccess);
+	rc = XaceHookSelectionAccess(client, stuff->id, DixGetAttrAccess);
 	if (rc != Success)
 	    return rc;
 
@@ -1127,8 +1126,7 @@ ProcConvertSelection(ClientPtr client)
     rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess);
     if (rc != Success)
         return rc;
-    rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->selection,
-		  DixReadAccess);
+    rc = XaceHookSelectionAccess(client, stuff->selection, DixReadAccess);
     if (rc != Success)
 	return rc;
 


More information about the xorg-commit mailing list