[PATCH 3/7] dix: Pull client-is-local flag up to the ClientRec

Adam Jackson ajax at redhat.com
Fri Jun 17 11:36:33 PDT 2011


Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 Xext/xf86bigfont.c                    |    4 ++--
 hw/kdrive/ephyr/ephyrdriext.c         |    4 ++--
 hw/xfree86/dixmods/extmod/xf86dga2.c  |    2 +-
 hw/xfree86/dixmods/extmod/xf86vmode.c |    6 +++---
 hw/xfree86/dri/xf86dri.c              |    4 ++--
 hw/xfree86/dri2/dri2ext.c             |    2 +-
 hw/xquartz/applewm.c                  |    4 ++--
 hw/xquartz/xpr/appledri.c             |    8 ++++----
 hw/xwin/winwindowswm.c                |    4 ++--
 include/dixstruct.h                   |    1 +
 include/os.h                          |    2 --
 os/access.c                           |    9 +--------
 os/connection.c                       |    2 +-
 os/osdep.h                            |    1 -
 14 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index de82744..315f15a 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -300,7 +300,7 @@ ProcXF86BigfontQueryVersion(
 #endif
     reply.capabilities =
 #ifdef HAS_SHM
-	(LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
+	(client->local && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
 #else
 	0
 #endif
@@ -367,7 +367,7 @@ ProcXF86BigfontQueryFont(
 #else
     switch (client->req_len) {
 	case 2: /* client with version 1.0 libX11 */
-	    stuff_flags = (LocalClient(client) && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
+	    stuff_flags = (client->local && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
 	    break;
 	case 3: /* client with version 1.1 libX11 */
 	    stuff_flags = stuff->flags;
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 6945f5b..cb6e190 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -588,7 +588,7 @@ ProcXF86DRIQueryDirectRenderingCapable (register ClientPtr client)
     }
     rep.isCapable = isCapable;
 
-    if (!LocalClient(client) || client->swapped)
+    if (!client->local || client->swapped)
 	rep.isCapable = 0;
 
     if (client->swapped) {
@@ -1255,7 +1255,7 @@ ProcXF86DRIDispatch (register ClientPtr	client)
         }
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + XF86DRIClientNotLocal;
 
     switch (stuff->data)
diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 4bcf77e..4b17f15 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -928,7 +928,7 @@ ProcXDGADispatch (ClientPtr client)
 {
     REQUEST(xReq);
 
-    if (!LocalClient(client))
+    if (!client->local)
 	return DGAErrorBase + XF86DGAClientNotLocal;
 
 #ifdef DGA_REQ_DEBUG
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 4737f2d..ade2535 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1535,7 +1535,7 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.permissions = XF86VM_READ_PERMISSION;
     if (xf86GetVidModeEnabled() &&
-	(xf86GetVidModeAllowNonLocal() || LocalClient (client))) {
+	(xf86GetVidModeAllowNonLocal() || client->local)) {
 	rep.permissions |= XF86VM_WRITE_PERMISSION;
     }
     if(client->swapped) {
@@ -1605,7 +1605,7 @@ ProcXF86VidModeDispatch(ClientPtr client)
     default:
 	if (!xf86GetVidModeEnabled())
 	    return VidModeErrorBase + XF86VidModeExtensionDisabled;
-	if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) {
+	if (xf86GetVidModeAllowNonLocal() || client->local) {
 	    switch (stuff->data) {
 	    case X_XF86VidModeAddModeLine:
 		return ProcXF86VidModeAddModeLine(client);
@@ -2045,7 +2045,7 @@ SProcXF86VidModeDispatch(ClientPtr client)
     default:
 	if (!xf86GetVidModeEnabled())
 	    return VidModeErrorBase + XF86VidModeExtensionDisabled;
-	if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+	if (xf86GetVidModeAllowNonLocal() || client->local) {
 	    switch (stuff->data) {
 	    case X_XF86VidModeAddModeLine:
 		return SProcXF86VidModeAddModeLine(client);
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index e02644a..46bc8ea 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -132,7 +132,7 @@ ProcXF86DRIQueryDirectRenderingCapable(
     }
     rep.isCapable = isCapable;
 
-    if (!LocalClient(client) || client->swapped)
+    if (!client->local || client->swapped)
 	rep.isCapable = 0;
 
     if (client->swapped) {
@@ -559,7 +559,7 @@ ProcXF86DRIDispatch (
 	return ProcXF86DRIQueryDirectRenderingCapable(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
 	return DRIErrorBase + XF86DRIClientNotLocal;
 
     switch (stuff->data)
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4e48e65..4283138 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -548,7 +548,7 @@ ProcDRI2Dispatch (ClientPtr client)
 	return ProcDRI2QueryVersion(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
 	return BadRequest;
 
     switch (stuff->data) {
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 2f26e61..34ba3bb 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -631,7 +631,7 @@ ProcAppleWMDispatch (
         return ProcAppleWMQueryVersion(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + AppleWMClientNotLocal;
 
     switch (stuff->data)
@@ -695,7 +695,7 @@ SProcAppleWMDispatch (
     REQUEST(xReq);
 
     /* It is bound to be non-local when there is byte swapping */
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + AppleWMClientNotLocal;
 
     /* only local clients are allowed WM access */
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index ff70a38..8366b5b 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -131,7 +131,7 @@ ProcAppleDRIQueryDirectRenderingCapable(
     }
     rep.isCapable = isCapable;
 
-    if (!LocalClient(client))
+    if (!client->local)
         rep.isCapable = 0;
 
     WriteToClient(client, 
@@ -278,7 +278,7 @@ ProcAppleDRICreatePixmap(ClientPtr client)
 	
     rep.stringLength = strlen(path) + 1;
 		
-    /* No need for swapping, because this only runs if LocalClient is true. */
+    /* No need for swapping, because this only runs if client->local is true. */
     rep.type = X_Reply;
     rep.length = sizeof(rep) + rep.stringLength;
     rep.sequenceNumber = client->sequence;
@@ -333,7 +333,7 @@ ProcAppleDRIDispatch (
         return ProcAppleDRIQueryDirectRenderingCapable(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + AppleDRIClientNotLocal;
 
     switch (stuff->data)
@@ -386,7 +386,7 @@ SProcAppleDRIDispatch (
     REQUEST(xReq);
 
     /* It is bound to be non-local when there is byte swapping */
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + AppleDRIClientNotLocal;
 
     /* only local clients are allowed DRI access */
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 7138409..866c927 100644
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -548,7 +548,7 @@ ProcWindowsWMDispatch (ClientPtr client)
       return ProcWindowsWMQueryVersion(client);
     }
 
-  if (!LocalClient(client))
+  if (!client->local)
     return WMErrorBase + WindowsWMClientNotLocal;
 
   switch (stuff->data)
@@ -598,7 +598,7 @@ SProcWindowsWMDispatch (ClientPtr client)
   REQUEST(xReq);
 
   /* It is bound to be non-local when there is byte swapping */
-  if (!LocalClient(client))
+  if (!client->local)
     return WMErrorBase + WindowsWMClientNotLocal;
 
   /* only local clients are allowed WM access */
diff --git a/include/dixstruct.h b/include/dixstruct.h
index 64a250f..b151122 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -92,6 +92,7 @@ typedef struct _Client {
     pointer     requestBuffer;
     pointer     osPrivate;	/* for OS layer, including scheduler */
     char        swapped;
+    char	local;
     char        big_requests;
     char        closeDownMode;
     char        clientGone;
diff --git a/include/os.h b/include/os.h
index 506dc5d..82817c3 100644
--- a/include/os.h
+++ b/include/os.h
@@ -353,8 +353,6 @@ typedef struct sockaddr * sockaddrPtr;
 
 extern _X_EXPORT int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client);
 
-extern _X_EXPORT int LocalClient(ClientPtr /* client */);
-
 extern _X_EXPORT int LocalClientCred(ClientPtr, int *, int *);
 
 #define LCC_UID_SET	(1 << 0)
diff --git a/os/access.c b/os/access.c
index b7b1927..0ba1ea9 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1047,13 +1047,6 @@ ComputeLocalClient(ClientPtr client)
     return FALSE;
 }
 
-Bool LocalClient(ClientPtr client)
-{
-    if (!client->osPrivate)
-        return FALSE;
-    return ((OsCommPtr)client->osPrivate)->local_client;
-}
-
 /*
  * Return the uid and gid of a connected local client
  * 
@@ -1211,7 +1204,7 @@ AuthorizedClient(ClientPtr client)
     if (rc != Success)
 	return rc;
 
-    return LocalClient(client) ? Success : BadAccess;
+    return client->local ? Success : BadAccess;
 }
 
 /* Add a host to the access control list.  This is the external interface
diff --git a/os/connection.c b/os/connection.c
index 0c580ab..fbc8e40 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -746,7 +746,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
 	free(oc);
 	return NullClient;
     }
-    oc->local_client = ComputeLocalClient(client);
+    client->local = ComputeLocalClient(client);
 #if !defined(WIN32)
     ConnectionTranslation[fd] = client->index;
 #else
diff --git a/os/osdep.h b/os/osdep.h
index 67f6f5e..34a4b1e 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -172,7 +172,6 @@ typedef struct _osComm {
     XID	auth_id;		/* authorization id */
     CARD32 conn_time;		/* timestamp if not established, else 0  */
     struct _XtransConnInfo *trans_conn; /* transport connection object */
-    Bool local_client;
 } OsCommRec, *OsCommPtr;
 
 extern int FlushClient(
-- 
1.7.5.4



More information about the xorg-devel mailing list