[PATCH 3/7] dix: Pull client-is-local flag up to the ClientRec
Adam Jackson
ajax at redhat.com
Thu Sep 20 13:56:04 PDT 2012
Reviewed-by: Daniel Stone <daniel at fooishbar.org>
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
Xext/xf86bigfont.c | 4 ++--
hw/kdrive/ephyr/ephyrdriext.c | 4 ++--
hw/xfree86/common/xf86DGA.c | 2 +-
hw/xfree86/common/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 | 6 +++---
hw/xwin/winwindowswm.c | 4 ++--
include/dixstruct.h | 1 +
include/os.h | 3 ---
os/access.c | 10 +---------
os/connection.c | 2 +-
os/osdep.h | 1 -
14 files changed, 21 insertions(+), 32 deletions(-)
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index b4ef5e4..faf81f7 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -288,7 +288,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
.gid = getegid(),
#ifdef HAS_SHM
.signature = signature,
- .capabilities = (LocalClient(client) && !client->swapped)
+ .capabilities = (client->local && !client->swapped)
? XF86Bigfont_CAP_LocalShm : 0
#else
.signature = 0,
@@ -357,7 +357,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
#else
switch (client->req_len) {
case 2: /* client with version 1.0 libX11 */
- stuff_flags = (LocalClient(client) &&
+ stuff_flags = (client->local &&
!client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
break;
case 3: /* client with version 1.1 libX11 */
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index a42be07..1a98a2d 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -561,7 +561,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
return BadValue;
}
- if (!LocalClient(client) || client->swapped)
+ if (!client->local || client->swapped)
isCapable = 0;
rep = (xXF86DRIQueryDirectRenderingCapableReply) {
@@ -1229,7 +1229,7 @@ ProcXF86DRIDispatch(register ClientPtr client)
}
}
- if (!LocalClient(client))
+ if (!client->local)
return DRIErrorBase + XF86DRIClientNotLocal;
switch (stuff->data) {
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index a441dee..c25a274 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -2095,7 +2095,7 @@ ProcXDGADispatch(ClientPtr client)
{
REQUEST(xReq);
- if (!LocalClient(client))
+ if (!client->local)
return DGAErrorBase + XF86DGAClientNotLocal;
#ifdef DGA_REQ_DEBUG
diff --git a/hw/xfree86/common/xf86vmode.c b/hw/xfree86/common/xf86vmode.c
index 7cd2eed..cad0e6a 100644
--- a/hw/xfree86/common/xf86vmode.c
+++ b/hw/xfree86/common/xf86vmode.c
@@ -1590,7 +1590,7 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
return BadValue;
if (xf86GetVidModeEnabled() &&
- (xf86GetVidModeAllowNonLocal() || LocalClient(client))) {
+ (xf86GetVidModeAllowNonLocal() || client->local)) {
rep.permissions |= XF86VM_WRITE_PERMISSION;
}
if (client->swapped) {
@@ -1659,7 +1659,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);
@@ -2083,7 +2083,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 ba74bb0..0b2e8fa 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -118,7 +118,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
return BadValue;
}
- if (!LocalClient(client) || client->swapped)
+ if (!client->local || client->swapped)
isCapable = 0;
rep = (xXF86DRIQueryDirectRenderingCapableReply) {
@@ -528,7 +528,7 @@ ProcXF86DRIDispatch(register ClientPtr client)
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 ee610c0..e1decec 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -588,7 +588,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 d41a81d..aea0a45 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -612,7 +612,7 @@ ProcAppleWMDispatch(register ClientPtr client)
return ProcAppleWMQueryVersion(client);
}
- if (!LocalClient(client))
+ if (!client->local)
return WMErrorBase + AppleWMClientNotLocal;
switch (stuff->data) {
@@ -684,7 +684,7 @@ SProcAppleWMDispatch(register ClientPtr client)
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 f77848f..9aac072 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -129,7 +129,7 @@ ProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client)
}
rep.isCapable = isCapable;
- if (!LocalClient(client))
+ if (!client->local)
rep.isCapable = 0;
if (client->swapped) {
@@ -354,7 +354,7 @@ ProcAppleDRIDispatch(register ClientPtr client)
return ProcAppleDRIQueryDirectRenderingCapable(client);
}
- if (!LocalClient(client))
+ if (!client->local)
return DRIErrorBase + AppleDRIClientNotLocal;
switch (stuff->data) {
@@ -469,7 +469,7 @@ SProcAppleDRIDispatch(register ClientPtr client)
return SProcAppleDRIQueryDirectRenderingCapable(client);
}
- if (!LocalClient(client))
+ if (!client->local)
return DRIErrorBase + AppleDRIClientNotLocal;
switch (stuff->data) {
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 5d513a8..88c3757 100644
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -525,7 +525,7 @@ ProcWindowsWMDispatch(ClientPtr client)
return ProcWindowsWMQueryVersion(client);
}
- if (!LocalClient(client))
+ if (!client->local)
return WMErrorBase + WindowsWMClientNotLocal;
switch (stuff->data) {
@@ -575,7 +575,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 b2a168a..875f6ca 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -91,6 +91,7 @@ typedef struct _Client {
pointer requestBuffer;
pointer osPrivate; /* for OS layer, including scheduler */
Bool swapped;
+ Bool local;
ReplySwapPtr pSwapReplyFunc;
XID errorValue;
int sequence;
diff --git a/include/os.h b/include/os.h
index 9e323f3..e324216 100644
--- a/include/os.h
+++ b/include/os.h
@@ -407,9 +407,6 @@ 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 550f2ed..104b6a7 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1007,14 +1007,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
*
@@ -1176,7 +1168,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 721ad65..d27116a 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -764,7 +764,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 587bd03..55db16f 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -162,7 +162,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(ClientPtr /*who */ ,
--
1.7.7.6
More information about the xorg-devel
mailing list