Merge commit '777bf90abeac37087a3d0538b847742523d5acf2'
This commit is contained in:
commit
0b113f7cdf
|
@ -101,6 +101,10 @@ int XaceHook(int hook, ...)
|
||||||
} u;
|
} u;
|
||||||
int *prv = NULL; /* points to return value from callback */
|
int *prv = NULL; /* points to return value from callback */
|
||||||
va_list ap; /* argument list */
|
va_list ap; /* argument list */
|
||||||
|
|
||||||
|
if (!XaceHooks[hook])
|
||||||
|
return Success;
|
||||||
|
|
||||||
va_start(ap, hook);
|
va_start(ap, hook);
|
||||||
|
|
||||||
/* Marshal arguments for passing to callback.
|
/* Marshal arguments for passing to callback.
|
||||||
|
|
|
@ -300,7 +300,7 @@ ProcXF86BigfontQueryVersion(
|
||||||
#endif
|
#endif
|
||||||
reply.capabilities =
|
reply.capabilities =
|
||||||
#ifdef HAS_SHM
|
#ifdef HAS_SHM
|
||||||
(LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
|
(client->local && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
|
||||||
#else
|
#else
|
||||||
0
|
0
|
||||||
#endif
|
#endif
|
||||||
|
@ -367,7 +367,7 @@ ProcXF86BigfontQueryFont(
|
||||||
#else
|
#else
|
||||||
switch (client->req_len) {
|
switch (client->req_len) {
|
||||||
case 2: /* client with version 1.0 libX11 */
|
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;
|
break;
|
||||||
case 3: /* client with version 1.1 libX11 */
|
case 3: /* client with version 1.1 libX11 */
|
||||||
stuff_flags = stuff->flags;
|
stuff_flags = stuff->flags;
|
||||||
|
|
|
@ -425,9 +425,11 @@ Dispatch(void)
|
||||||
client->minorOp = ext->MinorOpcode(client);
|
client->minorOp = ext->MinorOpcode(client);
|
||||||
}
|
}
|
||||||
#ifdef XSERVER_DTRACE
|
#ifdef XSERVER_DTRACE
|
||||||
XSERVER_REQUEST_START(LookupMajorName(client->majorOp), client->majorOp,
|
if (XSERVER_REQUEST_START_ENABLED())
|
||||||
((xReq *)client->requestBuffer)->length,
|
XSERVER_REQUEST_START(LookupMajorName(client->majorOp),
|
||||||
client->index, client->requestBuffer);
|
client->majorOp,
|
||||||
|
((xReq *)client->requestBuffer)->length,
|
||||||
|
client->index, client->requestBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (result > (maxBigRequestSize << 2))
|
if (result > (maxBigRequestSize << 2))
|
||||||
result = BadLength;
|
result = BadLength;
|
||||||
|
@ -438,8 +440,10 @@ Dispatch(void)
|
||||||
XaceHookAuditEnd(client, result);
|
XaceHookAuditEnd(client, result);
|
||||||
}
|
}
|
||||||
#ifdef XSERVER_DTRACE
|
#ifdef XSERVER_DTRACE
|
||||||
XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp), client->majorOp,
|
if (XSERVER_REQUEST_DONE_ENABLED())
|
||||||
client->sequence, client->index, result);
|
XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp),
|
||||||
|
client->majorOp, client->sequence,
|
||||||
|
client->index, result);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (client->noClientException != Success)
|
if (client->noClientException != Success)
|
||||||
|
@ -3578,12 +3582,14 @@ ProcInitialConnection(ClientPtr client)
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
xConnClientPrefix *prefix;
|
xConnClientPrefix *prefix;
|
||||||
int whichbyte = 1;
|
int whichbyte = 1;
|
||||||
|
char order;
|
||||||
|
|
||||||
prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
|
prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
|
||||||
if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B'))
|
order = prefix->byteOrder;
|
||||||
|
if (order != 'l' && order != 'B' && order != 'r' && order != 'R')
|
||||||
return client->noClientException = -1;
|
return client->noClientException = -1;
|
||||||
if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) ||
|
if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
|
||||||
(!(*(char *) &whichbyte) && (prefix->byteOrder == 'l')))
|
(!(*(char *) &whichbyte) && (order == 'l' || order == 'r')))
|
||||||
{
|
{
|
||||||
client->swapped = TRUE;
|
client->swapped = TRUE;
|
||||||
SwapConnClientPrefix(prefix);
|
SwapConnClientPrefix(prefix);
|
||||||
|
@ -3595,6 +3601,10 @@ ProcInitialConnection(ClientPtr client)
|
||||||
{
|
{
|
||||||
swaps(&stuff->length);
|
swaps(&stuff->length);
|
||||||
}
|
}
|
||||||
|
if (order == 'r' || order == 'R')
|
||||||
|
{
|
||||||
|
client->local = FALSE;
|
||||||
|
}
|
||||||
ResetCurrentRequest(client);
|
ResetCurrentRequest(client);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,13 +202,12 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
*pDraw = NULL;
|
*pDraw = NULL;
|
||||||
client->errorValue = id;
|
|
||||||
|
|
||||||
if (id == INVALID)
|
|
||||||
return BadDrawable;
|
|
||||||
|
|
||||||
rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
|
rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
client->errorValue = id;
|
||||||
|
|
||||||
if (rc == BadValue)
|
if (rc == BadValue)
|
||||||
return BadDrawable;
|
return BadDrawable;
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
|
|
@ -586,7 +586,7 @@ ProcXF86DRIQueryDirectRenderingCapable (register ClientPtr client)
|
||||||
}
|
}
|
||||||
rep.isCapable = isCapable;
|
rep.isCapable = isCapable;
|
||||||
|
|
||||||
if (!LocalClient(client) || client->swapped)
|
if (!client->local || client->swapped)
|
||||||
rep.isCapable = 0;
|
rep.isCapable = 0;
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
|
@ -1253,7 +1253,7 @@ ProcXF86DRIDispatch (register ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
return DRIErrorBase + XF86DRIClientNotLocal;
|
return DRIErrorBase + XF86DRIClientNotLocal;
|
||||||
|
|
||||||
switch (stuff->data)
|
switch (stuff->data)
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
|
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
|
||||||
#define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA"
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edidMakeAtom(int i, const char *name, CARD8 *data, int size)
|
edidMakeAtom(int i, const char *name, CARD8 *data, int size)
|
||||||
|
@ -52,59 +51,21 @@ edidMakeAtom(int i, const char *name, CARD8 *data, int size)
|
||||||
static void
|
static void
|
||||||
addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
|
addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
|
||||||
{
|
{
|
||||||
int i, scrnIndex = pScrn->scrnIndex;
|
int scrnIndex = pScrn->scrnIndex;
|
||||||
Bool makeEDID1prop = FALSE;
|
|
||||||
Bool makeEDID2prop = FALSE;
|
|
||||||
|
|
||||||
if (DDC->flags & MONITOR_DISPLAYID) {
|
if (DDC->flags & MONITOR_DISPLAYID) {
|
||||||
/* Don't bother, use RANDR already */
|
/* Don't bother, use RANDR already */
|
||||||
return;
|
return;
|
||||||
} else if (DDC->ver.version == 1) {
|
} else if (DDC->ver.version == 1) {
|
||||||
makeEDID1prop = TRUE;
|
int size = 128 +
|
||||||
} else if (DDC->ver.version == 2) {
|
(DDC->flags & EDID_COMPLETE_RAWDATA ? DDC->no_sections * 128 : 0);
|
||||||
int checksum1;
|
|
||||||
int checksum2;
|
|
||||||
makeEDID2prop = TRUE;
|
|
||||||
|
|
||||||
/* Some monitors (eg Panasonic PanaSync4)
|
edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC->rawData, size);
|
||||||
* report version==2 because they used EDID v2 spec document,
|
|
||||||
* although they use EDID v1 data structure :-(
|
|
||||||
*
|
|
||||||
* Try using checksum to determine when we have such a monitor.
|
|
||||||
*/
|
|
||||||
checksum2 = 0;
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
checksum2 += DDC->rawData[i];
|
|
||||||
if (checksum2 % 256) {
|
|
||||||
xf86DrvMsg(scrnIndex, X_INFO, "Monitor EDID v2 checksum failed\n");
|
|
||||||
xf86DrvMsg(scrnIndex, X_INFO,
|
|
||||||
"XFree86_DDC_EDID2_RAWDATA property may be bad\n");
|
|
||||||
checksum1 = 0;
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
checksum1 += DDC->rawData[i];
|
|
||||||
if (!(checksum1 % 256)) {
|
|
||||||
xf86DrvMsg(scrnIndex, X_INFO,
|
|
||||||
"Monitor EDID v1 checksum passed,\n");
|
|
||||||
xf86DrvMsg(scrnIndex, X_INFO,
|
|
||||||
"XFree86_DDC_EDID1_RAWDATA property created\n");
|
|
||||||
makeEDID1prop = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n",
|
xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n",
|
||||||
DDC->ver.version, DDC->ver.revision);
|
DDC->ver.version, DDC->ver.revision);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (makeEDID1prop) {
|
|
||||||
int size = 128 +
|
|
||||||
(DDC->flags & EDID_COMPLETE_RAWDATA ? DDC->no_sections * 128 : 0);
|
|
||||||
|
|
||||||
edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC->rawData, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (makeEDID2prop)
|
|
||||||
edidMakeAtom(scrnIndex, EDID2_ATOM_NAME, DDC->rawData, 256);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
|
|
@ -928,7 +928,7 @@ ProcXDGADispatch (ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
return DGAErrorBase + XF86DGAClientNotLocal;
|
return DGAErrorBase + XF86DGAClientNotLocal;
|
||||||
|
|
||||||
#ifdef DGA_REQ_DEBUG
|
#ifdef DGA_REQ_DEBUG
|
||||||
|
|
|
@ -1527,7 +1527,7 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.permissions = XF86VM_READ_PERMISSION;
|
rep.permissions = XF86VM_READ_PERMISSION;
|
||||||
if (xf86GetVidModeEnabled() &&
|
if (xf86GetVidModeEnabled() &&
|
||||||
(xf86GetVidModeAllowNonLocal() || LocalClient (client))) {
|
(xf86GetVidModeAllowNonLocal() || client->local)) {
|
||||||
rep.permissions |= XF86VM_WRITE_PERMISSION;
|
rep.permissions |= XF86VM_WRITE_PERMISSION;
|
||||||
}
|
}
|
||||||
if(client->swapped) {
|
if(client->swapped) {
|
||||||
|
@ -1597,7 +1597,7 @@ ProcXF86VidModeDispatch(ClientPtr client)
|
||||||
default:
|
default:
|
||||||
if (!xf86GetVidModeEnabled())
|
if (!xf86GetVidModeEnabled())
|
||||||
return VidModeErrorBase + XF86VidModeExtensionDisabled;
|
return VidModeErrorBase + XF86VidModeExtensionDisabled;
|
||||||
if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) {
|
if (xf86GetVidModeAllowNonLocal() || client->local) {
|
||||||
switch (stuff->data) {
|
switch (stuff->data) {
|
||||||
case X_XF86VidModeAddModeLine:
|
case X_XF86VidModeAddModeLine:
|
||||||
return ProcXF86VidModeAddModeLine(client);
|
return ProcXF86VidModeAddModeLine(client);
|
||||||
|
@ -2017,7 +2017,7 @@ SProcXF86VidModeDispatch(ClientPtr client)
|
||||||
default:
|
default:
|
||||||
if (!xf86GetVidModeEnabled())
|
if (!xf86GetVidModeEnabled())
|
||||||
return VidModeErrorBase + XF86VidModeExtensionDisabled;
|
return VidModeErrorBase + XF86VidModeExtensionDisabled;
|
||||||
if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
|
if (xf86GetVidModeAllowNonLocal() || client->local) {
|
||||||
switch (stuff->data) {
|
switch (stuff->data) {
|
||||||
case X_XF86VidModeAddModeLine:
|
case X_XF86VidModeAddModeLine:
|
||||||
return SProcXF86VidModeAddModeLine(client);
|
return SProcXF86VidModeAddModeLine(client);
|
||||||
|
|
|
@ -130,7 +130,7 @@ ProcXF86DRIQueryDirectRenderingCapable(
|
||||||
}
|
}
|
||||||
rep.isCapable = isCapable;
|
rep.isCapable = isCapable;
|
||||||
|
|
||||||
if (!LocalClient(client) || client->swapped)
|
if (!client->local || client->swapped)
|
||||||
rep.isCapable = 0;
|
rep.isCapable = 0;
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
|
@ -557,7 +557,7 @@ ProcXF86DRIDispatch (
|
||||||
return ProcXF86DRIQueryDirectRenderingCapable(client);
|
return ProcXF86DRIQueryDirectRenderingCapable(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
return DRIErrorBase + XF86DRIClientNotLocal;
|
return DRIErrorBase + XF86DRIClientNotLocal;
|
||||||
|
|
||||||
switch (stuff->data)
|
switch (stuff->data)
|
||||||
|
|
|
@ -547,7 +547,7 @@ ProcDRI2Dispatch (ClientPtr client)
|
||||||
return ProcDRI2QueryVersion(client);
|
return ProcDRI2QueryVersion(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
|
|
||||||
switch (stuff->data) {
|
switch (stuff->data) {
|
||||||
|
|
|
@ -630,7 +630,7 @@ ProcAppleWMDispatch (
|
||||||
return ProcAppleWMQueryVersion(client);
|
return ProcAppleWMQueryVersion(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
return WMErrorBase + AppleWMClientNotLocal;
|
return WMErrorBase + AppleWMClientNotLocal;
|
||||||
|
|
||||||
switch (stuff->data)
|
switch (stuff->data)
|
||||||
|
@ -693,7 +693,7 @@ SProcAppleWMDispatch (
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
/* It is bound to be non-local when there is byte swapping */
|
/* It is bound to be non-local when there is byte swapping */
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
return WMErrorBase + AppleWMClientNotLocal;
|
return WMErrorBase + AppleWMClientNotLocal;
|
||||||
|
|
||||||
/* only local clients are allowed WM access */
|
/* only local clients are allowed WM access */
|
||||||
|
|
|
@ -133,7 +133,7 @@ ProcAppleDRIQueryDirectRenderingCapable(
|
||||||
}
|
}
|
||||||
rep.isCapable = isCapable;
|
rep.isCapable = isCapable;
|
||||||
|
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
rep.isCapable = 0;
|
rep.isCapable = 0;
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
|
@ -365,7 +365,7 @@ ProcAppleDRIDispatch (
|
||||||
return ProcAppleDRIQueryDirectRenderingCapable(client);
|
return ProcAppleDRIQueryDirectRenderingCapable(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
return DRIErrorBase + AppleDRIClientNotLocal;
|
return DRIErrorBase + AppleDRIClientNotLocal;
|
||||||
|
|
||||||
switch (stuff->data)
|
switch (stuff->data)
|
||||||
|
|
|
@ -548,7 +548,7 @@ ProcWindowsWMDispatch (ClientPtr client)
|
||||||
return ProcWindowsWMQueryVersion(client);
|
return ProcWindowsWMQueryVersion(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
return WMErrorBase + WindowsWMClientNotLocal;
|
return WMErrorBase + WindowsWMClientNotLocal;
|
||||||
|
|
||||||
switch (stuff->data)
|
switch (stuff->data)
|
||||||
|
@ -598,7 +598,7 @@ SProcWindowsWMDispatch (ClientPtr client)
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
/* It is bound to be non-local when there is byte swapping */
|
/* It is bound to be non-local when there is byte swapping */
|
||||||
if (!LocalClient(client))
|
if (!client->local)
|
||||||
return WMErrorBase + WindowsWMClientNotLocal;
|
return WMErrorBase + WindowsWMClientNotLocal;
|
||||||
|
|
||||||
/* only local clients are allowed WM access */
|
/* only local clients are allowed WM access */
|
||||||
|
|
|
@ -90,23 +90,23 @@ typedef struct _Client {
|
||||||
Mask clientAsMask;
|
Mask clientAsMask;
|
||||||
pointer requestBuffer;
|
pointer requestBuffer;
|
||||||
pointer osPrivate; /* for OS layer, including scheduler */
|
pointer osPrivate; /* for OS layer, including scheduler */
|
||||||
Bool swapped;
|
char swapped;
|
||||||
|
char local;
|
||||||
|
char big_requests;
|
||||||
|
char closeDownMode;
|
||||||
|
char clientGone;
|
||||||
|
char noClientException; /* this client died or needs to be
|
||||||
|
* killed */
|
||||||
|
char clientState;
|
||||||
ReplySwapPtr pSwapReplyFunc;
|
ReplySwapPtr pSwapReplyFunc;
|
||||||
XID errorValue;
|
XID errorValue;
|
||||||
int sequence;
|
int sequence;
|
||||||
int closeDownMode;
|
|
||||||
int clientGone;
|
|
||||||
int noClientException; /* this client died or needs to be
|
|
||||||
* killed */
|
|
||||||
int ignoreCount; /* count for Attend/IgnoreClient */
|
int ignoreCount; /* count for Attend/IgnoreClient */
|
||||||
SaveSetElt *saveSet;
|
|
||||||
int numSaved;
|
int numSaved;
|
||||||
int (**requestVector) (
|
SaveSetElt *saveSet;
|
||||||
ClientPtr /* pClient */);
|
int (**requestVector) (ClientPtr /* pClient */);
|
||||||
CARD32 req_len; /* length of current request */
|
CARD32 req_len; /* length of current request */
|
||||||
Bool big_requests; /* supports large requests */
|
|
||||||
int priority;
|
int priority;
|
||||||
ClientState clientState;
|
|
||||||
PrivateRec *devPrivates;
|
PrivateRec *devPrivates;
|
||||||
unsigned short xkbClientFlags;
|
unsigned short xkbClientFlags;
|
||||||
unsigned short mapNotifyMask;
|
unsigned short mapNotifyMask;
|
||||||
|
@ -114,16 +114,16 @@ typedef struct _Client {
|
||||||
unsigned short vMajor,vMinor;
|
unsigned short vMajor,vMinor;
|
||||||
KeyCode minKC,maxKC;
|
KeyCode minKC,maxKC;
|
||||||
|
|
||||||
unsigned long replyBytesRemaining;
|
unsigned int replyBytesRemaining;
|
||||||
int smart_priority;
|
int smart_priority;
|
||||||
long smart_start_tick;
|
int smart_start_tick;
|
||||||
long smart_stop_tick;
|
int smart_stop_tick;
|
||||||
long smart_check_tick;
|
int smart_check_tick;
|
||||||
|
|
||||||
DeviceIntPtr clientPtr;
|
DeviceIntPtr clientPtr;
|
||||||
ClientIdPtr clientIds;
|
ClientIdPtr clientIds;
|
||||||
unsigned short majorOp, minorOp;
|
unsigned short majorOp, minorOp;
|
||||||
} ClientRec;
|
} ClientRec;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scheduling interface
|
* Scheduling interface
|
||||||
|
|
|
@ -353,8 +353,6 @@ typedef struct sockaddr * sockaddrPtr;
|
||||||
|
|
||||||
extern _X_EXPORT int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client);
|
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 *);
|
extern _X_EXPORT int LocalClientCred(ClientPtr, int *, int *);
|
||||||
|
|
||||||
#define LCC_UID_SET (1 << 0)
|
#define LCC_UID_SET (1 << 0)
|
||||||
|
|
|
@ -87,8 +87,8 @@ typedef struct _WindowOpt {
|
||||||
struct _OtherClients *otherClients; /* default: NULL */
|
struct _OtherClients *otherClients; /* default: NULL */
|
||||||
struct _GrabRec *passiveGrabs; /* default: NULL */
|
struct _GrabRec *passiveGrabs; /* default: NULL */
|
||||||
PropertyPtr userProps; /* default: NULL */
|
PropertyPtr userProps; /* default: NULL */
|
||||||
unsigned long backingBitPlanes; /* default: ~0L */
|
CARD32 backingBitPlanes; /* default: ~0L */
|
||||||
unsigned long backingPixel; /* default: 0 */
|
CARD32 backingPixel; /* default: 0 */
|
||||||
RegionPtr boundingShape; /* default: NULL */
|
RegionPtr boundingShape; /* default: NULL */
|
||||||
RegionPtr clipShape; /* default: NULL */
|
RegionPtr clipShape; /* default: NULL */
|
||||||
RegionPtr inputShape; /* default: NULL */
|
RegionPtr inputShape; /* default: NULL */
|
||||||
|
|
|
@ -1045,13 +1045,6 @@ ComputeLocalClient(ClientPtr client)
|
||||||
return FALSE;
|
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
|
* Return the uid and gid of a connected local client
|
||||||
*
|
*
|
||||||
|
@ -1209,7 +1202,7 @@ AuthorizedClient(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
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
|
/* Add a host to the access control list. This is the external interface
|
||||||
|
|
|
@ -745,7 +745,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
|
||||||
free(oc);
|
free(oc);
|
||||||
return NullClient;
|
return NullClient;
|
||||||
}
|
}
|
||||||
oc->local_client = ComputeLocalClient(client);
|
client->local = ComputeLocalClient(client);
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
ConnectionTranslation[fd] = client->index;
|
ConnectionTranslation[fd] = client->index;
|
||||||
#else
|
#else
|
||||||
|
@ -873,6 +873,8 @@ EstablishNewConnections(ClientPtr clientUnused, pointer closure)
|
||||||
* Fail a connection due to lack of client or file descriptor space
|
* Fail a connection due to lack of client or file descriptor space
|
||||||
************/
|
************/
|
||||||
|
|
||||||
|
#define BOTIMEOUT 200 /* in milliseconds */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ErrorConnMax(XtransConnInfo trans_conn)
|
ErrorConnMax(XtransConnInfo trans_conn)
|
||||||
{
|
{
|
||||||
|
@ -880,7 +882,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
|
||||||
xConnSetupPrefix csp;
|
xConnSetupPrefix csp;
|
||||||
char pad[3];
|
char pad[3];
|
||||||
struct iovec iov[3];
|
struct iovec iov[3];
|
||||||
char byteOrder = 0;
|
char order = 0;
|
||||||
int whichbyte = 1;
|
int whichbyte = 1;
|
||||||
struct timeval waittime;
|
struct timeval waittime;
|
||||||
fd_set mask;
|
fd_set mask;
|
||||||
|
@ -893,16 +895,16 @@ ErrorConnMax(XtransConnInfo trans_conn)
|
||||||
FD_SET(fd, &mask);
|
FD_SET(fd, &mask);
|
||||||
(void)Select(fd + 1, &mask, NULL, NULL, &waittime);
|
(void)Select(fd + 1, &mask, NULL, NULL, &waittime);
|
||||||
/* try to read the byte-order of the connection */
|
/* try to read the byte-order of the connection */
|
||||||
(void)_XSERVTransRead(trans_conn, &byteOrder, 1);
|
(void)_XSERVTransRead(trans_conn, &order, 1);
|
||||||
if ((byteOrder == 'l') || (byteOrder == 'B'))
|
if (order == 'l' || order == 'B' || order == 'r' || order == 'R')
|
||||||
{
|
{
|
||||||
csp.success = xFalse;
|
csp.success = xFalse;
|
||||||
csp.lengthReason = sizeof(NOROOM) - 1;
|
csp.lengthReason = sizeof(NOROOM) - 1;
|
||||||
csp.length = (sizeof(NOROOM) + 2) >> 2;
|
csp.length = (sizeof(NOROOM) + 2) >> 2;
|
||||||
csp.majorVersion = X_PROTOCOL;
|
csp.majorVersion = X_PROTOCOL;
|
||||||
csp.minorVersion = X_PROTOCOL_REVISION;
|
csp.minorVersion = X_PROTOCOL_REVISION;
|
||||||
if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
|
if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
|
||||||
(!(*(char *) &whichbyte) && (byteOrder == 'l')))
|
(!(*(char *) &whichbyte) && (order == 'l' || order == 'r')))
|
||||||
{
|
{
|
||||||
swaps(&csp.majorVersion);
|
swaps(&csp.majorVersion);
|
||||||
swaps(&csp.minorVersion);
|
swaps(&csp.minorVersion);
|
||||||
|
@ -1030,7 +1032,7 @@ CloseDownConnection(ClientPtr client)
|
||||||
if (FlushCallback)
|
if (FlushCallback)
|
||||||
CallCallbacks(&FlushCallback, NULL);
|
CallCallbacks(&FlushCallback, NULL);
|
||||||
|
|
||||||
if (oc->output && oc->output->count)
|
if (oc->output)
|
||||||
FlushClient(client, oc, (char *)NULL, 0);
|
FlushClient(client, oc, (char *)NULL, 0);
|
||||||
#ifdef XDMCP
|
#ifdef XDMCP
|
||||||
XdmcpCloseDisplay(oc->fd);
|
XdmcpCloseDisplay(oc->fd);
|
||||||
|
|
21
os/io.c
21
os/io.c
|
@ -84,6 +84,23 @@ SOFTWARE.
|
||||||
CallbackListPtr ReplyCallback;
|
CallbackListPtr ReplyCallback;
|
||||||
CallbackListPtr FlushCallback;
|
CallbackListPtr FlushCallback;
|
||||||
|
|
||||||
|
typedef struct _connectionInput {
|
||||||
|
struct _connectionInput *next;
|
||||||
|
char *buffer; /* contains current client input */
|
||||||
|
char *bufptr; /* pointer to current start of data */
|
||||||
|
int bufcnt; /* count of bytes in buffer */
|
||||||
|
int lenLastReq;
|
||||||
|
int size;
|
||||||
|
unsigned int ignoreBytes; /* bytes to ignore before the next request */
|
||||||
|
} ConnectionInput, *ConnectionInputPtr;
|
||||||
|
|
||||||
|
typedef struct _connectionOutput {
|
||||||
|
struct _connectionOutput *next;
|
||||||
|
unsigned char *buf;
|
||||||
|
int size;
|
||||||
|
int count;
|
||||||
|
} ConnectionOutput, *ConnectionOutputPtr;
|
||||||
|
|
||||||
static ConnectionInputPtr AllocateInputBuffer(void);
|
static ConnectionInputPtr AllocateInputBuffer(void);
|
||||||
static ConnectionOutputPtr AllocateOutputBuffer(void);
|
static ConnectionOutputPtr AllocateOutputBuffer(void);
|
||||||
|
|
||||||
|
@ -112,6 +129,8 @@ static OsCommPtr AvailableInput = (OsCommPtr)NULL;
|
||||||
((xBigReq *)(req))->length)
|
((xBigReq *)(req))->length)
|
||||||
|
|
||||||
#define MAX_TIMES_PER 10
|
#define MAX_TIMES_PER 10
|
||||||
|
#define BUFSIZE 4096
|
||||||
|
#define BUFWATERMARK 8192
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A lot of the code in this file manipulates a ConnectionInputPtr:
|
* A lot of the code in this file manipulates a ConnectionInputPtr:
|
||||||
|
@ -889,7 +908,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
|
||||||
long notWritten;
|
long notWritten;
|
||||||
long todo;
|
long todo;
|
||||||
|
|
||||||
if (!oco)
|
if (!oco || !oco->count)
|
||||||
return 0;
|
return 0;
|
||||||
written = 0;
|
written = 0;
|
||||||
padsize = padlength[extraCount & 3];
|
padsize = padlength[extraCount & 3];
|
||||||
|
|
23
os/osdep.h
23
os/osdep.h
|
@ -52,10 +52,6 @@ SOFTWARE.
|
||||||
#ifndef _OSDEP_H_
|
#ifndef _OSDEP_H_
|
||||||
#define _OSDEP_H_ 1
|
#define _OSDEP_H_ 1
|
||||||
|
|
||||||
#define BOTIMEOUT 200 /* in milliseconds */
|
|
||||||
#define BUFSIZE 4096
|
|
||||||
#define BUFWATERMARK 8192
|
|
||||||
|
|
||||||
#if defined(XDMCP) || defined(HASXDMAUTH)
|
#if defined(XDMCP) || defined(HASXDMAUTH)
|
||||||
#include <X11/Xdmcp.h>
|
#include <X11/Xdmcp.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,22 +108,8 @@ typedef Bool (*AddAuthorFunc)(unsigned name_length, const char *name,
|
||||||
unsigned data_length, char *data);
|
unsigned data_length, char *data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct _connectionInput {
|
typedef struct _connectionInput *ConnectionInputPtr;
|
||||||
struct _connectionInput *next;
|
typedef struct _connectionOutput *ConnectionOutputPtr;
|
||||||
char *buffer; /* contains current client input */
|
|
||||||
char *bufptr; /* pointer to current start of data */
|
|
||||||
int bufcnt; /* count of bytes in buffer */
|
|
||||||
int lenLastReq;
|
|
||||||
int size;
|
|
||||||
unsigned int ignoreBytes; /* bytes to ignore before the next request */
|
|
||||||
} ConnectionInput, *ConnectionInputPtr;
|
|
||||||
|
|
||||||
typedef struct _connectionOutput {
|
|
||||||
struct _connectionOutput *next;
|
|
||||||
int size;
|
|
||||||
unsigned char *buf;
|
|
||||||
int count;
|
|
||||||
} ConnectionOutput, *ConnectionOutputPtr;
|
|
||||||
|
|
||||||
struct _osComm;
|
struct _osComm;
|
||||||
|
|
||||||
|
@ -166,7 +148,6 @@ typedef struct _osComm {
|
||||||
XID auth_id; /* authorization id */
|
XID auth_id; /* authorization id */
|
||||||
CARD32 conn_time; /* timestamp if not established, else 0 */
|
CARD32 conn_time; /* timestamp if not established, else 0 */
|
||||||
struct _XtransConnInfo *trans_conn; /* transport connection object */
|
struct _XtransConnInfo *trans_conn; /* transport connection object */
|
||||||
Bool local_client;
|
|
||||||
} OsCommRec, *OsCommPtr;
|
} OsCommRec, *OsCommPtr;
|
||||||
|
|
||||||
extern int FlushClient(
|
extern int FlushClient(
|
||||||
|
|
Loading…
Reference in New Issue