Merge branch 'master' into mpx
Conflicts: Xext/sampleEVI.c
This commit is contained in:
commit
0ac1755977
|
@ -47,6 +47,8 @@
|
||||||
#include <xf86.h>
|
#include <xf86.h>
|
||||||
#include <dri.h>
|
#include <dri.h>
|
||||||
|
|
||||||
|
#include "servermd.h"
|
||||||
|
|
||||||
#define DRI_NEW_INTERFACE_ONLY
|
#define DRI_NEW_INTERFACE_ONLY
|
||||||
#include "glxserver.h"
|
#include "glxserver.h"
|
||||||
#include "glxutil.h"
|
#include "glxutil.h"
|
||||||
|
@ -308,18 +310,20 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height)
|
glxFillAlphaChannel (CARD32 *pixels, CARD32 rowstride, int width, int height)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CARD32 *p, *end, *pixels = (CARD32 *)pixmap->devPrivate.ptr;
|
CARD32 *p, *end;
|
||||||
CARD32 rowstride = pixmap->devKind / 4;
|
|
||||||
|
|
||||||
for (i = y; i < y + height; i++)
|
rowstride /= 4;
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
p = &pixels[i * rowstride + x];
|
p = pixels;
|
||||||
end = p + width;
|
end = p + width;
|
||||||
while (p < end)
|
while (p < end)
|
||||||
*p++ |= 0xFF000000;
|
*p++ |= 0xFF000000;
|
||||||
|
pixels += rowstride;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,22 +434,31 @@ nooverride:
|
||||||
type = GL_UNSIGNED_SHORT_5_6_5;
|
type = GL_UNSIGNED_SHORT_5_6_5;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
|
|
||||||
pixmap->devKind / bpp) );
|
|
||||||
|
|
||||||
if (pRegion == NULL)
|
if (pRegion == NULL)
|
||||||
{
|
{
|
||||||
if (!override && pixmap->drawable.depth == 24)
|
void *data = NULL;
|
||||||
glxFillAlphaChannel(pixmap,
|
|
||||||
pixmap->drawable.x,
|
if (!override) {
|
||||||
pixmap->drawable.y,
|
unsigned pitch = PixmapBytePad(pixmap->drawable.width,
|
||||||
|
pixmap->drawable.depth);
|
||||||
|
|
||||||
|
data = xalloc(pitch * pixmap->drawable.height);
|
||||||
|
|
||||||
|
pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x*/,
|
||||||
|
0 /*pixmap->drawable.y*/, pixmap->drawable.width,
|
||||||
|
pixmap->drawable.height, ZPixmap, ~0, data);
|
||||||
|
|
||||||
|
if (pixmap->drawable.depth == 24)
|
||||||
|
glxFillAlphaChannel(data,
|
||||||
|
pitch,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
|
|
||||||
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS,
|
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
|
||||||
pixmap->drawable.x) );
|
pitch / bpp) );
|
||||||
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS,
|
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) );
|
||||||
pixmap->drawable.y) );
|
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) );
|
||||||
|
}
|
||||||
|
|
||||||
CALL_TexImage2D( GET_DISPATCH(),
|
CALL_TexImage2D( GET_DISPATCH(),
|
||||||
(glxPixmap->target,
|
(glxPixmap->target,
|
||||||
|
@ -456,26 +469,37 @@ nooverride:
|
||||||
0,
|
0,
|
||||||
format,
|
format,
|
||||||
type,
|
type,
|
||||||
override ? NULL : pixmap->devPrivate.ptr) );
|
data) );
|
||||||
|
|
||||||
|
xfree(data);
|
||||||
} else if (!override) {
|
} else if (!override) {
|
||||||
int i, numRects;
|
int i, numRects;
|
||||||
BoxPtr p;
|
BoxPtr p;
|
||||||
|
|
||||||
numRects = REGION_NUM_RECTS (pRegion);
|
numRects = REGION_NUM_RECTS (pRegion);
|
||||||
p = REGION_RECTS (pRegion);
|
p = REGION_RECTS (pRegion);
|
||||||
|
|
||||||
|
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) );
|
||||||
|
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) );
|
||||||
|
|
||||||
for (i = 0; i < numRects; i++)
|
for (i = 0; i < numRects; i++)
|
||||||
{
|
{
|
||||||
|
unsigned pitch = PixmapBytePad(p[i].x2 - p[i].x1,
|
||||||
|
pixmap->drawable.depth);
|
||||||
|
void *data = xalloc(pitch * (p[i].y2 - p[i].y1));
|
||||||
|
|
||||||
|
pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x +*/ p[i].x1,
|
||||||
|
/*pixmap->drawable.y*/ + p[i].y1, p[i].x2 - p[i].x1,
|
||||||
|
p[i].y2 - p[i].y1, ZPixmap, ~0, data);
|
||||||
|
|
||||||
if (pixmap->drawable.depth == 24)
|
if (pixmap->drawable.depth == 24)
|
||||||
glxFillAlphaChannel(pixmap,
|
glxFillAlphaChannel(data,
|
||||||
pixmap->drawable.x + p[i].x1,
|
pitch,
|
||||||
pixmap->drawable.y + p[i].y1,
|
|
||||||
p[i].x2 - p[i].x1,
|
p[i].x2 - p[i].x1,
|
||||||
p[i].y2 - p[i].y1);
|
p[i].y2 - p[i].y1);
|
||||||
|
|
||||||
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS,
|
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
|
||||||
pixmap->drawable.x + p[i].x1) );
|
pitch / bpp) );
|
||||||
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS,
|
|
||||||
pixmap->drawable.y + p[i].y1) );
|
|
||||||
|
|
||||||
CALL_TexSubImage2D( GET_DISPATCH(),
|
CALL_TexSubImage2D( GET_DISPATCH(),
|
||||||
(glxPixmap->target,
|
(glxPixmap->target,
|
||||||
|
@ -484,7 +508,9 @@ nooverride:
|
||||||
p[i].x2 - p[i].x1, p[i].y2 - p[i].y1,
|
p[i].x2 - p[i].x1, p[i].y2 - p[i].y1,
|
||||||
format,
|
format,
|
||||||
type,
|
type,
|
||||||
pixmap->devPrivate.ptr) );
|
data) );
|
||||||
|
|
||||||
|
xfree(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
Xext/EVI.c
15
Xext/EVI.c
|
@ -34,6 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <X11/extensions/XEVIstr.h>
|
#include <X11/extensions/XEVIstr.h>
|
||||||
#include "EVIstruct.h"
|
#include "EVIstruct.h"
|
||||||
#include "modinit.h"
|
#include "modinit.h"
|
||||||
|
#include "scrnintstr.h"
|
||||||
|
|
||||||
static EviPrivPtr eviPriv;
|
static EviPrivPtr eviPriv;
|
||||||
|
|
||||||
|
@ -84,10 +85,22 @@ ProcEVIGetVisualInfo(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xEVIGetVisualInfoReq);
|
REQUEST(xEVIGetVisualInfoReq);
|
||||||
xEVIGetVisualInfoReply rep;
|
xEVIGetVisualInfoReply rep;
|
||||||
int n, n_conflict, n_info, sz_info, sz_conflict;
|
int i, n, n_conflict, n_info, sz_info, sz_conflict;
|
||||||
VisualID32 *conflict;
|
VisualID32 *conflict;
|
||||||
|
unsigned int total_visuals = 0;
|
||||||
xExtendedVisualInfo *eviInfo;
|
xExtendedVisualInfo *eviInfo;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* do this first, otherwise REQUEST_FIXED_SIZE can overflow. we assume
|
||||||
|
* here that you don't have more than 2^32 visuals over all your screens;
|
||||||
|
* this seems like a safe assumption.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < screenInfo.numScreens; i++)
|
||||||
|
total_visuals += screenInfo.screens[i]->numVisuals;
|
||||||
|
if (stuff->n_visual > total_visuals)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
|
REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
|
||||||
status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
|
status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
|
||||||
&eviInfo, &n_info, &conflict, &n_conflict);
|
&eviInfo, &n_info, &conflict, &n_conflict);
|
||||||
|
|
|
@ -77,7 +77,7 @@ endif
|
||||||
# requires X-ACE extension
|
# requires X-ACE extension
|
||||||
XSELINUX_SRCS = xselinux.c xselinux.h
|
XSELINUX_SRCS = xselinux.c xselinux.h
|
||||||
if XSELINUX
|
if XSELINUX
|
||||||
BUILTIN_SRCS += $(XSELINUX_SRCS)
|
MODULE_SRCS += $(XSELINUX_SRCS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Security extension: multi-level security to protect clients from each other
|
# Security extension: multi-level security to protect clients from each other
|
||||||
|
|
|
@ -176,6 +176,9 @@ int ProcGetReservedColormapEntries(
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq);
|
REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq);
|
||||||
|
|
||||||
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
#ifndef HAVE_SPECIAL_DESKTOP_COLORS
|
#ifndef HAVE_SPECIAL_DESKTOP_COLORS
|
||||||
citems[CUP_BLACK_PIXEL].pixel =
|
citems[CUP_BLACK_PIXEL].pixel =
|
||||||
screenInfo.screens[stuff->screen]->blackPixel;
|
screenInfo.screens[stuff->screen]->blackPixel;
|
||||||
|
|
|
@ -34,6 +34,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <X11/extensions/XEVIstr.h>
|
#include <X11/extensions/XEVIstr.h>
|
||||||
#include "EVIstruct.h"
|
#include "EVIstruct.h"
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
|
|
||||||
|
#if HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#elif !defined(UINT32_MAX)
|
||||||
|
#define UINT32_MAX 0xffffffffU
|
||||||
|
#endif
|
||||||
|
|
||||||
static int sampleGetVisualInfo(
|
static int sampleGetVisualInfo(
|
||||||
VisualID32 *visual,
|
VisualID32 *visual,
|
||||||
int n_visual,
|
int n_visual,
|
||||||
|
@ -42,24 +49,36 @@ static int sampleGetVisualInfo(
|
||||||
VisualID32 **conflict_rn,
|
VisualID32 **conflict_rn,
|
||||||
int *n_conflict_rn)
|
int *n_conflict_rn)
|
||||||
{
|
{
|
||||||
int max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
|
unsigned int max_sz_evi;
|
||||||
VisualID32 *temp_conflict;
|
VisualID32 *temp_conflict;
|
||||||
xExtendedVisualInfo *evi;
|
xExtendedVisualInfo *evi;
|
||||||
int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
|
unsigned int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
|
||||||
int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
|
register int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
|
||||||
*evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
|
|
||||||
if (!*evi_rn)
|
if (n_visual > UINT32_MAX/(sz_xExtendedVisualInfo * screenInfo.numScreens))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
|
||||||
|
|
||||||
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
|
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
|
||||||
if (screenInfo.screens[scrI]->numVisuals > max_visuals)
|
if (screenInfo.screens[scrI]->numVisuals > max_visuals)
|
||||||
max_visuals = screenInfo.screens[scrI]->numVisuals;
|
max_visuals = screenInfo.screens[scrI]->numVisuals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (n_visual > UINT32_MAX/(sz_VisualID32 * screenInfo.numScreens
|
||||||
|
* max_visuals))
|
||||||
|
return BadAlloc;
|
||||||
max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
|
max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
|
||||||
|
|
||||||
|
*evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
|
||||||
|
if (!*evi_rn)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
|
temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
|
||||||
if (!temp_conflict) {
|
if (!temp_conflict) {
|
||||||
xfree(*evi_rn);
|
xfree(*evi_rn);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
|
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
|
||||||
for (visualI = 0; visualI < n_visual; visualI++) {
|
for (visualI = 0; visualI < n_visual; visualI++) {
|
||||||
evi[sz_evi].core_visual_id = visual[visualI];
|
evi[sz_evi].core_visual_id = visual[visualI];
|
||||||
|
|
50
Xext/shm.c
50
Xext/shm.c
|
@ -757,6 +757,8 @@ ProcPanoramiXShmCreatePixmap(
|
||||||
int i, j, result, rc;
|
int i, j, result, rc;
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
REQUEST(xShmCreatePixmapReq);
|
REQUEST(xShmCreatePixmapReq);
|
||||||
|
unsigned int width, height, depth;
|
||||||
|
unsigned long size;
|
||||||
PanoramiXRes *newPix;
|
PanoramiXRes *newPix;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
|
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
|
||||||
|
@ -770,11 +772,18 @@ ProcPanoramiXShmCreatePixmap(
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
|
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
|
||||||
if (!stuff->width || !stuff->height)
|
|
||||||
|
width = stuff->width;
|
||||||
|
height = stuff->height;
|
||||||
|
depth = stuff->depth;
|
||||||
|
if (!width || !height || !depth)
|
||||||
{
|
{
|
||||||
client->errorValue = 0;
|
client->errorValue = 0;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
if (width > 32767 || height > 32767)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
if (stuff->depth != 1)
|
if (stuff->depth != 1)
|
||||||
{
|
{
|
||||||
pDepth = pDraw->pScreen->allowedDepths;
|
pDepth = pDraw->pScreen->allowedDepths;
|
||||||
|
@ -784,10 +793,18 @@ ProcPanoramiXShmCreatePixmap(
|
||||||
client->errorValue = stuff->depth;
|
client->errorValue = stuff->depth;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePmap:
|
CreatePmap:
|
||||||
VERIFY_SHMSIZE(shmdesc, stuff->offset,
|
size = PixmapBytePad(width, depth) * height;
|
||||||
PixmapBytePad(stuff->width, stuff->depth) * stuff->height,
|
if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {
|
||||||
client);
|
if (size < width * height)
|
||||||
|
return BadAlloc;
|
||||||
|
}
|
||||||
|
/* thankfully, offset is unsigned */
|
||||||
|
if (stuff->offset + size < size)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
|
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
|
||||||
|
|
||||||
if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
|
if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
@ -1086,6 +1103,8 @@ ProcShmCreatePixmap(client)
|
||||||
int i, rc;
|
int i, rc;
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
REQUEST(xShmCreatePixmapReq);
|
REQUEST(xShmCreatePixmapReq);
|
||||||
|
unsigned int width, height, depth;
|
||||||
|
unsigned long size;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
|
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
|
||||||
client->errorValue = stuff->pid;
|
client->errorValue = stuff->pid;
|
||||||
|
@ -1098,11 +1117,18 @@ ProcShmCreatePixmap(client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
|
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
|
||||||
if (!stuff->width || !stuff->height)
|
|
||||||
|
width = stuff->width;
|
||||||
|
height = stuff->height;
|
||||||
|
depth = stuff->depth;
|
||||||
|
if (!width || !height || !depth)
|
||||||
{
|
{
|
||||||
client->errorValue = 0;
|
client->errorValue = 0;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
if (width > 32767 || height > 32767)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
if (stuff->depth != 1)
|
if (stuff->depth != 1)
|
||||||
{
|
{
|
||||||
pDepth = pDraw->pScreen->allowedDepths;
|
pDepth = pDraw->pScreen->allowedDepths;
|
||||||
|
@ -1112,10 +1138,18 @@ ProcShmCreatePixmap(client)
|
||||||
client->errorValue = stuff->depth;
|
client->errorValue = stuff->depth;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePmap:
|
CreatePmap:
|
||||||
VERIFY_SHMSIZE(shmdesc, stuff->offset,
|
size = PixmapBytePad(width, depth) * height;
|
||||||
PixmapBytePad(stuff->width, stuff->depth) * stuff->height,
|
if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {
|
||||||
client);
|
if (size < width * height)
|
||||||
|
return BadAlloc;
|
||||||
|
}
|
||||||
|
/* thankfully, offset is unsigned */
|
||||||
|
if (stuff->offset + size < size)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
|
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
|
||||||
pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)(
|
pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)(
|
||||||
pDraw->pScreen, stuff->width,
|
pDraw->pScreen, stuff->width,
|
||||||
stuff->height, stuff->depth,
|
stuff->height, stuff->depth,
|
||||||
|
|
198
Xext/xace.c
198
Xext/xace.c
|
@ -24,31 +24,31 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "xacestr.h"
|
#include "xacestr.h"
|
||||||
#include "modinit.h"
|
|
||||||
|
|
||||||
CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
|
CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
|
||||||
|
|
||||||
/* Proc vectors for untrusted clients, swapped and unswapped versions.
|
|
||||||
* These are the same as the normal proc vectors except that extensions
|
|
||||||
* that haven't declared themselves secure will have ProcBadRequest plugged
|
|
||||||
* in for their major opcode dispatcher. This prevents untrusted clients
|
|
||||||
* from guessing extension major opcodes and using the extension even though
|
|
||||||
* the extension can't be listed or queried.
|
|
||||||
*/
|
|
||||||
static int (*UntrustedProcVector[256])(
|
|
||||||
ClientPtr /*client*/
|
|
||||||
);
|
|
||||||
static int (*SwappedUntrustedProcVector[256])(
|
|
||||||
ClientPtr /*client*/
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Special-cased hook functions. Called by Xserver.
|
/* Special-cased hook functions. Called by Xserver.
|
||||||
*/
|
*/
|
||||||
void XaceHookAuditBegin(ClientPtr ptr)
|
int XaceHookDispatch(ClientPtr client, int major)
|
||||||
{
|
{
|
||||||
XaceAuditRec rec = { ptr, 0 };
|
/* Call the audit begin callback, there is no return value. */
|
||||||
/* call callbacks, there is no return value. */
|
XaceAuditRec rec = { client, 0 };
|
||||||
CallCallbacks(&XaceHooks[XACE_AUDIT_BEGIN], &rec);
|
CallCallbacks(&XaceHooks[XACE_AUDIT_BEGIN], &rec);
|
||||||
|
|
||||||
|
if (major < 128) {
|
||||||
|
/* Call the core dispatch hook */
|
||||||
|
XaceCoreDispatchRec rec = { client, Success /* default allow */ };
|
||||||
|
CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
|
||||||
|
return rec.status;
|
||||||
|
} else {
|
||||||
|
/* Call the extension dispatch hook */
|
||||||
|
ExtensionEntry *ext = GetExtensionEntry(major);
|
||||||
|
XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
|
||||||
|
if (ext)
|
||||||
|
CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec);
|
||||||
|
/* On error, pretend extension doesn't exist */
|
||||||
|
return (rec.status == Success) ? Success : BadRequest;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XaceHookAuditEnd(ClientPtr ptr, int result)
|
void XaceHookAuditEnd(ClientPtr ptr, int result)
|
||||||
|
@ -221,168 +221,6 @@ int XaceHook(int hook, ...)
|
||||||
return prv ? *prv : Success;
|
return prv ? *prv : Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
ProcXaceDispatch(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xReq);
|
|
||||||
|
|
||||||
switch (stuff->data)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
} /* ProcXaceDispatch */
|
|
||||||
|
|
||||||
static int
|
|
||||||
SProcXaceDispatch(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xReq);
|
|
||||||
|
|
||||||
switch (stuff->data)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
} /* SProcXaceDispatch */
|
|
||||||
|
|
||||||
|
|
||||||
/* XaceResetProc
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* extEntry is the extension information for the XACE extension.
|
|
||||||
*
|
|
||||||
* Returns: nothing.
|
|
||||||
*
|
|
||||||
* Side Effects:
|
|
||||||
* Performs any cleanup needed by XACE at server shutdown time.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
XaceResetProc(ExtensionEntry *extEntry)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0; i<XACE_NUM_HOOKS; i++)
|
|
||||||
DeleteCallbackList(&XaceHooks[i]);
|
|
||||||
} /* XaceResetProc */
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
XaceCatchDispatchProc(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xReq);
|
|
||||||
int major = stuff->reqType;
|
|
||||||
XaceCoreDispatchRec rec = { client, Success /* default allow */ };
|
|
||||||
|
|
||||||
if (!ProcVector[major])
|
|
||||||
return BadRequest;
|
|
||||||
|
|
||||||
/* call callbacks and return result, if any. */
|
|
||||||
CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
|
|
||||||
|
|
||||||
if (rec.status != Success)
|
|
||||||
return rec.status;
|
|
||||||
|
|
||||||
return client->swapped ?
|
|
||||||
(* SwappedProcVector[major])(client) :
|
|
||||||
(* ProcVector[major])(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
XaceCatchExtProc(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xReq);
|
|
||||||
int major = stuff->reqType;
|
|
||||||
ExtensionEntry *ext = GetExtensionEntry(major);
|
|
||||||
XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
|
|
||||||
|
|
||||||
if (!ext || !ProcVector[major])
|
|
||||||
return BadRequest;
|
|
||||||
|
|
||||||
/* call callbacks and return result, if any. */
|
|
||||||
CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec);
|
|
||||||
|
|
||||||
if (rec.status != Success)
|
|
||||||
return BadRequest; /* pretend extension doesn't exist */
|
|
||||||
|
|
||||||
return client->swapped ?
|
|
||||||
(* SwappedProcVector[major])(client) :
|
|
||||||
(* ProcVector[major])(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* SecurityClientStateCallback
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* pcbl is &ClientStateCallback.
|
|
||||||
* nullata is NULL.
|
|
||||||
* calldata is a pointer to a NewClientInfoRec (include/dixstruct.h)
|
|
||||||
* which contains information about client state changes.
|
|
||||||
*
|
|
||||||
* Returns: nothing.
|
|
||||||
*
|
|
||||||
* Side Effects:
|
|
||||||
*
|
|
||||||
* If a new client is connecting, its authorization ID is copied to
|
|
||||||
* client->authID. If this is a generated authorization, its reference
|
|
||||||
* count is bumped, its timer is cancelled if it was running, and its
|
|
||||||
* trustlevel is copied to TRUSTLEVEL(client).
|
|
||||||
*
|
|
||||||
* If a client is disconnecting and the client was using a generated
|
|
||||||
* authorization, the authorization's reference count is decremented, and
|
|
||||||
* if it is now zero, the timer for this authorization is started.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
XaceClientStateCallback(
|
|
||||||
CallbackListPtr *pcbl,
|
|
||||||
pointer nulldata,
|
|
||||||
pointer calldata)
|
|
||||||
{
|
|
||||||
NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
|
|
||||||
ClientPtr client = pci->client;
|
|
||||||
|
|
||||||
switch (client->clientState)
|
|
||||||
{
|
|
||||||
case ClientStateRunning:
|
|
||||||
{
|
|
||||||
client->requestVector = client->swapped ?
|
|
||||||
SwappedUntrustedProcVector : UntrustedProcVector;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
} /* XaceClientStateCallback */
|
|
||||||
|
|
||||||
/* XaceExtensionInit
|
|
||||||
*
|
|
||||||
* Initialize the XACE Extension
|
|
||||||
*/
|
|
||||||
void XaceExtensionInit(INITARGS)
|
|
||||||
{
|
|
||||||
ExtensionEntry *extEntry;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!AddCallback(&ClientStateCallback, XaceClientStateCallback, NULL))
|
|
||||||
return;
|
|
||||||
|
|
||||||
extEntry = AddExtension(XACE_EXTENSION_NAME,
|
|
||||||
XaceNumberEvents, XaceNumberErrors,
|
|
||||||
ProcXaceDispatch, SProcXaceDispatch,
|
|
||||||
XaceResetProc, StandardMinorOpcode);
|
|
||||||
|
|
||||||
/* initialize dispatching intercept functions */
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
{
|
|
||||||
UntrustedProcVector[i] = XaceCatchDispatchProc;
|
|
||||||
SwappedUntrustedProcVector[i] = XaceCatchDispatchProc;
|
|
||||||
}
|
|
||||||
for (i = 128; i < 256; i++)
|
|
||||||
{
|
|
||||||
UntrustedProcVector[i] = XaceCatchExtProc;
|
|
||||||
SwappedUntrustedProcVector[i] = XaceCatchExtProc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XaceCensorImage
|
/* XaceCensorImage
|
||||||
*
|
*
|
||||||
* Called after pScreen->GetImage to prevent pieces or trusted windows from
|
* Called after pScreen->GetImage to prevent pieces or trusted windows from
|
||||||
|
|
10
Xext/xace.h
10
Xext/xace.h
|
@ -22,16 +22,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#ifdef XACE
|
#ifdef XACE
|
||||||
|
|
||||||
#define XACE_EXTENSION_NAME "XAccessControlExtension"
|
|
||||||
#define XACE_MAJOR_VERSION 2
|
#define XACE_MAJOR_VERSION 2
|
||||||
#define XACE_MINOR_VERSION 0
|
#define XACE_MINOR_VERSION 0
|
||||||
|
|
||||||
#include "pixmap.h" /* for DrawablePtr */
|
#include "pixmap.h" /* for DrawablePtr */
|
||||||
#include "regionstr.h" /* for RegionPtr */
|
#include "regionstr.h" /* for RegionPtr */
|
||||||
|
|
||||||
#define XaceNumberEvents 0
|
|
||||||
#define XaceNumberErrors 0
|
|
||||||
|
|
||||||
/* Default window background */
|
/* Default window background */
|
||||||
#define XaceBackgroundNoneState None
|
#define XaceBackgroundNoneState None
|
||||||
|
|
||||||
|
@ -68,8 +64,8 @@ extern int XaceHook(
|
||||||
|
|
||||||
/* Special-cased hook functions
|
/* Special-cased hook functions
|
||||||
*/
|
*/
|
||||||
|
extern int XaceHookDispatch(ClientPtr ptr, int major);
|
||||||
extern void XaceHookAuditEnd(ClientPtr ptr, int result);
|
extern void XaceHookAuditEnd(ClientPtr ptr, int result);
|
||||||
extern void XaceHookAuditBegin(ClientPtr ptr);
|
|
||||||
|
|
||||||
/* Register a callback for a given hook.
|
/* Register a callback for a given hook.
|
||||||
*/
|
*/
|
||||||
|
@ -104,13 +100,13 @@ extern void XaceCensorImage(
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define XaceHook(args...) Success
|
#define XaceHook(args...) Success
|
||||||
|
#define XaceHookDispatch(args...) Success
|
||||||
#define XaceHookAuditEnd(args...) { ; }
|
#define XaceHookAuditEnd(args...) { ; }
|
||||||
#define XaceHookAuditBegin(args...) { ; }
|
|
||||||
#define XaceCensorImage(args...) { ; }
|
#define XaceCensorImage(args...) { ; }
|
||||||
#else
|
#else
|
||||||
#define XaceHook(...) Success
|
#define XaceHook(...) Success
|
||||||
|
#define XaceHookDispatch(...) Success
|
||||||
#define XaceHookAuditEnd(...) { ; }
|
#define XaceHookAuditEnd(...) { ; }
|
||||||
#define XaceHookAuditBegin(...) { ; }
|
|
||||||
#define XaceCensorImage(...) { ; }
|
#define XaceCensorImage(...) { ; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
245
Xext/xselinux.c
245
Xext/xselinux.c
|
@ -63,6 +63,7 @@ typedef struct {
|
||||||
security_id_t sid;
|
security_id_t sid;
|
||||||
struct avc_entry_ref aeref;
|
struct avc_entry_ref aeref;
|
||||||
char *command;
|
char *command;
|
||||||
|
int privileged;
|
||||||
} SELinuxStateRec;
|
} SELinuxStateRec;
|
||||||
|
|
||||||
/* selection manager */
|
/* selection manager */
|
||||||
|
@ -71,8 +72,8 @@ typedef struct {
|
||||||
security_id_t sid;
|
security_id_t sid;
|
||||||
} SELinuxSelectionRec;
|
} SELinuxSelectionRec;
|
||||||
|
|
||||||
static ClientPtr selectionManager;
|
static ClientPtr securityManager;
|
||||||
static Window selectionWindow;
|
static Window securityWindow;
|
||||||
|
|
||||||
/* audit file descriptor */
|
/* audit file descriptor */
|
||||||
static int audit_fd;
|
static int audit_fd;
|
||||||
|
@ -287,11 +288,11 @@ SELinuxTypeToClass(RESTYPE type)
|
||||||
* Performs an SELinux permission check.
|
* Performs an SELinux permission check.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
SELinuxDoCheck(int clientIndex, SELinuxStateRec *subj, SELinuxStateRec *obj,
|
SELinuxDoCheck(SELinuxStateRec *subj, SELinuxStateRec *obj,
|
||||||
security_class_t class, Mask mode, SELinuxAuditRec *auditdata)
|
security_class_t class, Mask mode, SELinuxAuditRec *auditdata)
|
||||||
{
|
{
|
||||||
/* serverClient requests OK */
|
/* serverClient requests OK */
|
||||||
if (clientIndex == 0)
|
if (subj->privileged)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
auditdata->command = subj->command;
|
auditdata->command = subj->command;
|
||||||
|
@ -383,6 +384,7 @@ SELinuxLabelInitial(void)
|
||||||
|
|
||||||
/* Do the serverClient */
|
/* Do the serverClient */
|
||||||
state = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
state = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
||||||
|
state->privileged = 1;
|
||||||
sidput(state->sid);
|
sidput(state->sid);
|
||||||
|
|
||||||
/* Use the context of the X server process for the serverClient */
|
/* Use the context of the X server process for the serverClient */
|
||||||
|
@ -496,8 +498,8 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
obj->sid = subj->sid;
|
obj->sid = subj->sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, obj, SECCLASS_X_DEVICE,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DEVICE, rec->access_mode,
|
||||||
rec->access_mode, &auditdata);
|
&auditdata);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
rec->status = rc;
|
rec->status = rc;
|
||||||
}
|
}
|
||||||
|
@ -509,21 +511,18 @@ SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
SELinuxStateRec *subj, *obj, ev_sid;
|
SELinuxStateRec *subj, *obj, ev_sid;
|
||||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
SELinuxAuditRec auditdata = { .client = rec->client };
|
||||||
security_class_t class;
|
security_class_t class;
|
||||||
int rc, i, type, clientIndex;
|
int rc, i, type;
|
||||||
|
|
||||||
if (rec->dev) {
|
if (rec->dev)
|
||||||
subj = dixLookupPrivate(&rec->dev->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->dev->devPrivates, stateKey);
|
||||||
clientIndex = -1; /* some nonzero value */
|
else
|
||||||
} else {
|
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
||||||
clientIndex = rec->client->index;
|
|
||||||
}
|
|
||||||
|
|
||||||
obj = dixLookupPrivate(&rec->pWin->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->pWin->devPrivates, stateKey);
|
||||||
|
|
||||||
/* Check send permission on window */
|
/* Check send permission on window */
|
||||||
rc = SELinuxDoCheck(clientIndex, subj, obj, SECCLASS_X_DRAWABLE,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixSendAccess,
|
||||||
DixSendAccess, &auditdata);
|
&auditdata);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
@ -537,8 +536,7 @@ SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
auditdata.event = type;
|
auditdata.event = type;
|
||||||
rc = SELinuxDoCheck(clientIndex, subj, &ev_sid, class,
|
rc = SELinuxDoCheck(subj, &ev_sid, class, DixSendAccess, &auditdata);
|
||||||
DixSendAccess, &auditdata);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -560,8 +558,8 @@ SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
obj = dixLookupPrivate(&rec->pWin->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->pWin->devPrivates, stateKey);
|
||||||
|
|
||||||
/* Check receive permission on window */
|
/* Check receive permission on window */
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, obj, SECCLASS_X_DRAWABLE,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixReceiveAccess,
|
||||||
DixReceiveAccess, &auditdata);
|
&auditdata);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
@ -575,8 +573,7 @@ SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
auditdata.event = type;
|
auditdata.event = type;
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, &ev_sid, class,
|
rc = SELinuxDoCheck(subj, &ev_sid, class, DixReceiveAccess, &auditdata);
|
||||||
DixReceiveAccess, &auditdata);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -633,8 +630,8 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
|
|
||||||
/* Perform the security check */
|
/* Perform the security check */
|
||||||
auditdata.extension = rec->ext->name;
|
auditdata.extension = rec->ext->name;
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, obj, SECCLASS_X_EXTENSION,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_EXTENSION, rec->access_mode,
|
||||||
rec->access_mode, &auditdata);
|
&auditdata);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
rec->status = rc;
|
rec->status = rc;
|
||||||
}
|
}
|
||||||
|
@ -680,13 +677,12 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
freecon(con);
|
freecon(con);
|
||||||
avc_entry_ref_init(&obj->aeref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Perform the security check */
|
/* Perform the security check */
|
||||||
auditdata.property = rec->pProp->propertyName;
|
auditdata.property = rec->pProp->propertyName;
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, obj, SECCLASS_X_PROPERTY,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_PROPERTY, rec->access_mode,
|
||||||
rec->access_mode, &auditdata);
|
&auditdata);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
rec->status = rc;
|
rec->status = rc;
|
||||||
}
|
}
|
||||||
|
@ -741,8 +737,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
/* Perform the security check */
|
/* Perform the security check */
|
||||||
auditdata.restype = rec->rtype;
|
auditdata.restype = rec->rtype;
|
||||||
auditdata.id = rec->id;
|
auditdata.id = rec->id;
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, obj, class,
|
rc = SELinuxDoCheck(subj, obj, class, rec->access_mode, &auditdata);
|
||||||
rec->access_mode, &auditdata);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
rec->status = rc;
|
rec->status = rc;
|
||||||
}
|
}
|
||||||
|
@ -775,8 +770,7 @@ SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
|
||||||
if (is_saver)
|
if (is_saver)
|
||||||
access_mode <<= 2;
|
access_mode <<= 2;
|
||||||
|
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, obj, SECCLASS_X_SCREEN,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SCREEN, access_mode, &auditdata);
|
||||||
access_mode, &auditdata);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
rec->status = rc;
|
rec->status = rc;
|
||||||
}
|
}
|
||||||
|
@ -792,8 +786,8 @@ SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
||||||
obj = dixLookupPrivate(&rec->target->devPrivates, stateKey);
|
obj = dixLookupPrivate(&rec->target->devPrivates, stateKey);
|
||||||
|
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, obj, SECCLASS_X_CLIENT,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_CLIENT, rec->access_mode,
|
||||||
rec->access_mode, &auditdata);
|
&auditdata);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
rec->status = rc;
|
rec->status = rc;
|
||||||
}
|
}
|
||||||
|
@ -809,8 +803,8 @@ SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
||||||
obj = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
obj = dixLookupPrivate(&serverClient->devPrivates, stateKey);
|
||||||
|
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, obj, SECCLASS_X_SERVER,
|
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SERVER, rec->access_mode,
|
||||||
rec->access_mode, &auditdata);
|
&auditdata);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
rec->status = rc;
|
rec->status = rc;
|
||||||
}
|
}
|
||||||
|
@ -832,8 +826,8 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
}
|
}
|
||||||
|
|
||||||
auditdata.selection = rec->name;
|
auditdata.selection = rec->name;
|
||||||
rc = SELinuxDoCheck(rec->client->index, subj, &sel_sid,
|
rc = SELinuxDoCheck(subj, &sel_sid, SECCLASS_X_SELECTION, rec->access_mode,
|
||||||
SECCLASS_X_SELECTION, rec->access_mode, &auditdata);
|
&auditdata);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
rec->status = rc;
|
rec->status = rc;
|
||||||
}
|
}
|
||||||
|
@ -855,9 +849,9 @@ SELinuxClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
|
|
||||||
case ClientStateRetained:
|
case ClientStateRetained:
|
||||||
case ClientStateGone:
|
case ClientStateGone:
|
||||||
if (pci->client == selectionManager) {
|
if (pci->client == securityManager) {
|
||||||
selectionManager = NULL;
|
securityManager = NULL;
|
||||||
selectionWindow = 0;
|
securityWindow = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -890,8 +884,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
FatalError("SELinux: Failed to set label property on window!\n");
|
FatalError("SELinux: Failed to set label property on window!\n");
|
||||||
freecon(ctx);
|
freecon(ctx);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
FatalError("SELinux: Unexpected unlabeled client found\n");
|
FatalError("SELinux: Unexpected unlabeled client found\n");
|
||||||
|
|
||||||
state = dixLookupPrivate(&pWin->devPrivates, stateKey);
|
state = dixLookupPrivate(&pWin->devPrivates, stateKey);
|
||||||
|
@ -907,8 +900,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
FatalError("SELinux: Failed to set label property on window!\n");
|
FatalError("SELinux: Failed to set label property on window!\n");
|
||||||
freecon(ctx);
|
freecon(ctx);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
FatalError("SELinux: Unexpected unlabeled window found\n");
|
FatalError("SELinux: Unexpected unlabeled window found\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,9 +935,9 @@ SELinuxSelectionState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
|
|
||||||
case SelectionConvertSelection:
|
case SelectionConvertSelection:
|
||||||
/* redirect the convert request if necessary */
|
/* redirect the convert request if necessary */
|
||||||
if (selectionManager && selectionManager != rec->client) {
|
if (securityManager && securityManager != rec->client) {
|
||||||
rec->selection->client = selectionManager;
|
rec->selection->client = securityManager;
|
||||||
rec->selection->window = selectionWindow;
|
rec->selection->window = securityWindow;
|
||||||
} else {
|
} else {
|
||||||
rec->selection->client = rec->selection->alt_client;
|
rec->selection->client = rec->selection->alt_client;
|
||||||
rec->selection->window = rec->selection->alt_window;
|
rec->selection->window = rec->selection->alt_window;
|
||||||
|
@ -1012,39 +1004,39 @@ ProcSELinuxQueryVersion(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcSELinuxSetSelectionManager(ClientPtr client)
|
ProcSELinuxSetSecurityManager(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(SELinuxSetSelectionManagerReq);
|
REQUEST(SELinuxSetSecurityManagerReq);
|
||||||
REQUEST_SIZE_MATCH(SELinuxSetSelectionManagerReq);
|
REQUEST_SIZE_MATCH(SELinuxSetSecurityManagerReq);
|
||||||
|
|
||||||
if (stuff->window == None) {
|
if (stuff->window == None) {
|
||||||
selectionManager = NULL;
|
securityManager = NULL;
|
||||||
selectionWindow = None;
|
securityWindow = None;
|
||||||
} else {
|
} else {
|
||||||
rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW,
|
rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW,
|
||||||
client, DixGetAttrAccess);
|
client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
selectionManager = client;
|
securityManager = client;
|
||||||
selectionWindow = stuff->window;
|
securityWindow = stuff->window;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcSELinuxGetSelectionManager(ClientPtr client)
|
ProcSELinuxGetSecurityManager(ClientPtr client)
|
||||||
{
|
{
|
||||||
SELinuxGetSelectionManagerReply rep;
|
SELinuxGetSecurityManagerReply rep;
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.window = selectionWindow;
|
rep.window = securityWindow;
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
int n;
|
int n;
|
||||||
swaps(&rep.sequenceNumber, n);
|
swaps(&rep.sequenceNumber, n);
|
||||||
|
@ -1100,7 +1092,40 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSELinuxGetDeviceContext(ClientPtr client)
|
ProcSELinuxGetDeviceContext(ClientPtr client)
|
||||||
{
|
{
|
||||||
return Success;
|
char *ctx;
|
||||||
|
DeviceIntPtr dev;
|
||||||
|
SELinuxStateRec *state;
|
||||||
|
SELinuxGetContextReply rep;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
REQUEST(SELinuxGetContextReq);
|
||||||
|
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
|
||||||
|
|
||||||
|
rc = dixLookupDevice(&dev, stuff->id, client, DixGetAttrAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
state = dixLookupPrivate(&dev->devPrivates, stateKey);
|
||||||
|
rc = avc_sid_to_context(state->sid, &ctx);
|
||||||
|
if (rc != Success)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
rep.type = X_Reply;
|
||||||
|
rep.length = (strlen(ctx) + 4) >> 2;
|
||||||
|
rep.sequenceNumber = client->sequence;
|
||||||
|
rep.context_len = strlen(ctx) + 1;
|
||||||
|
|
||||||
|
if (client->swapped) {
|
||||||
|
int n;
|
||||||
|
swapl(&rep.length, n);
|
||||||
|
swaps(&rep.sequenceNumber, n);
|
||||||
|
swaps(&rep.context_len, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep);
|
||||||
|
WriteToClient(client, rep.context_len, ctx);
|
||||||
|
free(ctx);
|
||||||
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1118,7 +1143,54 @@ ProcSELinuxGetPropertyCreateContext(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSELinuxGetPropertyContext(ClientPtr client)
|
ProcSELinuxGetPropertyContext(ClientPtr client)
|
||||||
{
|
{
|
||||||
return Success;
|
char *ctx;
|
||||||
|
WindowPtr pWin;
|
||||||
|
PropertyPtr pProp;
|
||||||
|
SELinuxStateRec *state;
|
||||||
|
SELinuxGetContextReply rep;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
REQUEST(SELinuxGetPropertyContextReq);
|
||||||
|
REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq);
|
||||||
|
|
||||||
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetPropAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
pProp = wUserProps(pWin);
|
||||||
|
while (pProp) {
|
||||||
|
if (pProp->propertyName == stuff->property)
|
||||||
|
break;
|
||||||
|
pProp = pProp->next;
|
||||||
|
}
|
||||||
|
if (!pProp)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp, DixGetAttrAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
state = dixLookupPrivate(&pProp->devPrivates, stateKey);
|
||||||
|
rc = avc_sid_to_context(state->sid, &ctx);
|
||||||
|
if (rc != Success)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
rep.type = X_Reply;
|
||||||
|
rep.length = (strlen(ctx) + 4) >> 2;
|
||||||
|
rep.sequenceNumber = client->sequence;
|
||||||
|
rep.context_len = strlen(ctx) + 1;
|
||||||
|
|
||||||
|
if (client->swapped) {
|
||||||
|
int n;
|
||||||
|
swapl(&rep.length, n);
|
||||||
|
swaps(&rep.sequenceNumber, n);
|
||||||
|
swaps(&rep.context_len, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep);
|
||||||
|
WriteToClient(client, rep.context_len, ctx);
|
||||||
|
free(ctx);
|
||||||
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1136,7 +1208,40 @@ ProcSELinuxGetWindowCreateContext(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSELinuxGetWindowContext(ClientPtr client)
|
ProcSELinuxGetWindowContext(ClientPtr client)
|
||||||
{
|
{
|
||||||
return Success;
|
char *ctx;
|
||||||
|
WindowPtr pWin;
|
||||||
|
SELinuxStateRec *state;
|
||||||
|
SELinuxGetContextReply rep;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
REQUEST(SELinuxGetContextReq);
|
||||||
|
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
|
||||||
|
|
||||||
|
rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
state = dixLookupPrivate(&pWin->devPrivates, stateKey);
|
||||||
|
rc = avc_sid_to_context(state->sid, &ctx);
|
||||||
|
if (rc != Success)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
rep.type = X_Reply;
|
||||||
|
rep.length = (strlen(ctx) + 4) >> 2;
|
||||||
|
rep.sequenceNumber = client->sequence;
|
||||||
|
rep.context_len = strlen(ctx) + 1;
|
||||||
|
|
||||||
|
if (client->swapped) {
|
||||||
|
int n;
|
||||||
|
swapl(&rep.length, n);
|
||||||
|
swaps(&rep.sequenceNumber, n);
|
||||||
|
swaps(&rep.context_len, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep);
|
||||||
|
WriteToClient(client, rep.context_len, ctx);
|
||||||
|
free(ctx);
|
||||||
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1146,10 +1251,10 @@ ProcSELinuxDispatch(ClientPtr client)
|
||||||
switch (stuff->data) {
|
switch (stuff->data) {
|
||||||
case X_SELinuxQueryVersion:
|
case X_SELinuxQueryVersion:
|
||||||
return ProcSELinuxQueryVersion(client);
|
return ProcSELinuxQueryVersion(client);
|
||||||
case X_SELinuxSetSelectionManager:
|
case X_SELinuxSetSecurityManager:
|
||||||
return ProcSELinuxSetSelectionManager(client);
|
return ProcSELinuxSetSecurityManager(client);
|
||||||
case X_SELinuxGetSelectionManager:
|
case X_SELinuxGetSecurityManager:
|
||||||
return ProcSELinuxGetSelectionManager(client);
|
return ProcSELinuxGetSecurityManager(client);
|
||||||
case X_SELinuxSetDeviceCreateContext:
|
case X_SELinuxSetDeviceCreateContext:
|
||||||
return ProcSELinuxSetDeviceCreateContext(client);
|
return ProcSELinuxSetDeviceCreateContext(client);
|
||||||
case X_SELinuxGetDeviceCreateContext:
|
case X_SELinuxGetDeviceCreateContext:
|
||||||
|
@ -1188,14 +1293,14 @@ SProcSELinuxQueryVersion(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcSELinuxSetSelectionManager(ClientPtr client)
|
SProcSELinuxSetSecurityManager(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(SELinuxSetSelectionManagerReq);
|
REQUEST(SELinuxSetSecurityManagerReq);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (SELinuxSetSelectionManagerReq);
|
REQUEST_SIZE_MATCH(SELinuxSetSecurityManagerReq);
|
||||||
swapl(&stuff->window, n);
|
swapl(&stuff->window, n);
|
||||||
return ProcSELinuxSetSelectionManager(client);
|
return ProcSELinuxSetSecurityManager(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1288,10 +1393,10 @@ SProcSELinuxDispatch(ClientPtr client)
|
||||||
switch (stuff->data) {
|
switch (stuff->data) {
|
||||||
case X_SELinuxQueryVersion:
|
case X_SELinuxQueryVersion:
|
||||||
return SProcSELinuxQueryVersion(client);
|
return SProcSELinuxQueryVersion(client);
|
||||||
case X_SELinuxSetSelectionManager:
|
case X_SELinuxSetSecurityManager:
|
||||||
return SProcSELinuxSetSelectionManager(client);
|
return SProcSELinuxSetSecurityManager(client);
|
||||||
case X_SELinuxGetSelectionManager:
|
case X_SELinuxGetSecurityManager:
|
||||||
return ProcSELinuxGetSelectionManager(client);
|
return ProcSELinuxGetSecurityManager(client);
|
||||||
case X_SELinuxSetDeviceCreateContext:
|
case X_SELinuxSetDeviceCreateContext:
|
||||||
return SProcSELinuxSetDeviceCreateContext(client);
|
return SProcSELinuxSetDeviceCreateContext(client);
|
||||||
case X_SELinuxGetDeviceCreateContext:
|
case X_SELinuxGetDeviceCreateContext:
|
||||||
|
|
|
@ -31,8 +31,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
/* Extension protocol */
|
/* Extension protocol */
|
||||||
#define X_SELinuxQueryVersion 0
|
#define X_SELinuxQueryVersion 0
|
||||||
#define X_SELinuxSetSelectionManager 1
|
#define X_SELinuxSetSecurityManager 1
|
||||||
#define X_SELinuxGetSelectionManager 2
|
#define X_SELinuxGetSecurityManager 2
|
||||||
#define X_SELinuxSetDeviceCreateContext 3
|
#define X_SELinuxSetDeviceCreateContext 3
|
||||||
#define X_SELinuxGetDeviceCreateContext 4
|
#define X_SELinuxGetDeviceCreateContext 4
|
||||||
#define X_SELinuxSetDeviceContext 5
|
#define X_SELinuxSetDeviceContext 5
|
||||||
|
@ -72,13 +72,13 @@ typedef struct {
|
||||||
CARD8 SELinuxReqType;
|
CARD8 SELinuxReqType;
|
||||||
CARD16 length;
|
CARD16 length;
|
||||||
CARD32 window;
|
CARD32 window;
|
||||||
} SELinuxSetSelectionManagerReq;
|
} SELinuxSetSecurityManagerReq;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CARD8 reqType;
|
CARD8 reqType;
|
||||||
CARD8 SELinuxReqType;
|
CARD8 SELinuxReqType;
|
||||||
CARD16 length;
|
CARD16 length;
|
||||||
} SELinuxGetSelectionManagerReq;
|
} SELinuxGetSecurityManagerReq;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CARD8 type;
|
CARD8 type;
|
||||||
|
@ -91,7 +91,7 @@ typedef struct {
|
||||||
CARD32 pad4;
|
CARD32 pad4;
|
||||||
CARD32 pad5;
|
CARD32 pad5;
|
||||||
CARD32 pad6;
|
CARD32 pad6;
|
||||||
} SELinuxGetSelectionManagerReply;
|
} SELinuxGetSecurityManagerReply;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CARD8 reqType;
|
CARD8 reqType;
|
||||||
|
|
|
@ -1532,6 +1532,7 @@ SProcXvShmPutImage(ClientPtr client)
|
||||||
swapl(&stuff->gc, n);
|
swapl(&stuff->gc, n);
|
||||||
swapl(&stuff->shmseg, n);
|
swapl(&stuff->shmseg, n);
|
||||||
swapl(&stuff->id, n);
|
swapl(&stuff->id, n);
|
||||||
|
swapl(&stuff->offset, n);
|
||||||
swaps(&stuff->src_x, n);
|
swaps(&stuff->src_x, n);
|
||||||
swaps(&stuff->src_y, n);
|
swaps(&stuff->src_y, n);
|
||||||
swaps(&stuff->src_w, n);
|
swaps(&stuff->src_w, n);
|
||||||
|
@ -1540,7 +1541,6 @@ SProcXvShmPutImage(ClientPtr client)
|
||||||
swaps(&stuff->drw_y, n);
|
swaps(&stuff->drw_y, n);
|
||||||
swaps(&stuff->drw_w, n);
|
swaps(&stuff->drw_w, n);
|
||||||
swaps(&stuff->drw_h, n);
|
swaps(&stuff->drw_h, n);
|
||||||
swaps(&stuff->offset, n);
|
|
||||||
swaps(&stuff->width, n);
|
swaps(&stuff->width, n);
|
||||||
swaps(&stuff->height, n);
|
swaps(&stuff->height, n);
|
||||||
return XvProcVector[xv_ShmPutImage](client);
|
return XvProcVector[xv_ShmPutImage](client);
|
||||||
|
@ -1588,6 +1588,7 @@ SProcXvSetPortAttribute(ClientPtr client)
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
swapl(&stuff->port, n);
|
swapl(&stuff->port, n);
|
||||||
swapl(&stuff->attribute, n);
|
swapl(&stuff->attribute, n);
|
||||||
|
swapl(&stuff->value, n);
|
||||||
return XvProcVector[xv_SetPortAttribute](client);
|
return XvProcVector[xv_SetPortAttribute](client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1632,9 +1633,10 @@ SProcXvQueryImageAttributes(ClientPtr client)
|
||||||
char n;
|
char n;
|
||||||
REQUEST(xvQueryImageAttributesReq);
|
REQUEST(xvQueryImageAttributesReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
|
swapl(&stuff->port, n);
|
||||||
swapl(&stuff->id, n);
|
swapl(&stuff->id, n);
|
||||||
swaps(&stuff->width, n);
|
swaps(&stuff->width, n);
|
||||||
swaps(&stuff->width, n);
|
swaps(&stuff->height, n);
|
||||||
return XvProcVector[xv_QueryImageAttributes](client);
|
return XvProcVector[xv_QueryImageAttributes](client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,18 +302,13 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
|
||||||
xStringFeedbackCtl * f)
|
xStringFeedbackCtl * f)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
long *p;
|
|
||||||
int i, j;
|
int i, j;
|
||||||
KeySym *syms, *sup_syms;
|
KeySym *syms, *sup_syms;
|
||||||
|
|
||||||
syms = (KeySym *) (f + 1);
|
syms = (KeySym *) (f + 1);
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&f->length, n); /* swapped num_keysyms in calling proc */
|
swaps(&f->length, n); /* swapped num_keysyms in calling proc */
|
||||||
p = (long *)(syms);
|
SwapLongs((CARD32 *) syms, f->num_keysyms);
|
||||||
for (i = 0; i < f->num_keysyms; i++) {
|
|
||||||
swapl(p, n);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f->num_keysyms > s->ctrl.max_symbols)
|
if (f->num_keysyms > s->ctrl.max_symbols)
|
||||||
|
|
14
Xi/chgkmap.c
14
Xi/chgkmap.c
|
@ -75,18 +75,14 @@ int
|
||||||
SProcXChangeDeviceKeyMapping(ClientPtr client)
|
SProcXChangeDeviceKeyMapping(ClientPtr client)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
long *p;
|
unsigned int count;
|
||||||
int i, count;
|
|
||||||
|
|
||||||
REQUEST(xChangeDeviceKeyMappingReq);
|
REQUEST(xChangeDeviceKeyMappingReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
|
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
|
||||||
p = (long *)&stuff[1];
|
|
||||||
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
|
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
|
||||||
for (i = 0; i < count; i++) {
|
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
|
||||||
swapl(p, n);
|
SwapLongs((CARD32 *) (&stuff[1]), count);
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return (ProcXChangeDeviceKeyMapping(client));
|
return (ProcXChangeDeviceKeyMapping(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,10 +98,14 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
|
||||||
int ret;
|
int ret;
|
||||||
unsigned len;
|
unsigned len;
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
|
unsigned int count;
|
||||||
|
|
||||||
REQUEST(xChangeDeviceKeyMappingReq);
|
REQUEST(xChangeDeviceKeyMappingReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
|
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
|
||||||
|
|
||||||
|
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
|
||||||
|
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
|
||||||
|
|
||||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
10
Xi/chgprop.c
10
Xi/chgprop.c
|
@ -77,19 +77,15 @@ int
|
||||||
SProcXChangeDeviceDontPropagateList(ClientPtr client)
|
SProcXChangeDeviceDontPropagateList(ClientPtr client)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
long *p;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
REQUEST(xChangeDeviceDontPropagateListReq);
|
REQUEST(xChangeDeviceDontPropagateListReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
||||||
swapl(&stuff->window, n);
|
swapl(&stuff->window, n);
|
||||||
swaps(&stuff->count, n);
|
swaps(&stuff->count, n);
|
||||||
p = (long *)&stuff[1];
|
REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
|
||||||
for (i = 0; i < stuff->count; i++) {
|
stuff->count * sizeof(CARD32));
|
||||||
swapl(p, n);
|
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return (ProcXChangeDeviceDontPropagateList(client));
|
return (ProcXChangeDeviceDontPropagateList(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
Xi/grabdev.c
12
Xi/grabdev.c
|
@ -78,8 +78,6 @@ int
|
||||||
SProcXGrabDevice(ClientPtr client)
|
SProcXGrabDevice(ClientPtr client)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
long *p;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
REQUEST(xGrabDeviceReq);
|
REQUEST(xGrabDeviceReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
|
@ -87,11 +85,11 @@ SProcXGrabDevice(ClientPtr client)
|
||||||
swapl(&stuff->grabWindow, n);
|
swapl(&stuff->grabWindow, n);
|
||||||
swapl(&stuff->time, n);
|
swapl(&stuff->time, n);
|
||||||
swaps(&stuff->event_count, n);
|
swaps(&stuff->event_count, n);
|
||||||
p = (long *)&stuff[1];
|
|
||||||
for (i = 0; i < stuff->event_count; i++) {
|
if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count)
|
||||||
swapl(p, n);
|
return BadLength;
|
||||||
p++;
|
|
||||||
}
|
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
|
||||||
|
|
||||||
return (ProcXGrabDevice(client));
|
return (ProcXGrabDevice(client));
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,6 @@ int
|
||||||
SProcXGrabDeviceButton(ClientPtr client)
|
SProcXGrabDeviceButton(ClientPtr client)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
long *p;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
REQUEST(xGrabDeviceButtonReq);
|
REQUEST(xGrabDeviceButtonReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
|
@ -86,11 +84,9 @@ SProcXGrabDeviceButton(ClientPtr client)
|
||||||
swapl(&stuff->grabWindow, n);
|
swapl(&stuff->grabWindow, n);
|
||||||
swaps(&stuff->modifiers, n);
|
swaps(&stuff->modifiers, n);
|
||||||
swaps(&stuff->event_count, n);
|
swaps(&stuff->event_count, n);
|
||||||
p = (long *)&stuff[1];
|
REQUEST_FIXED_SIZE(xGrabDeviceButtonReq,
|
||||||
for (i = 0; i < stuff->event_count; i++) {
|
stuff->event_count * sizeof(CARD32));
|
||||||
swapl(p, n);
|
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (ProcXGrabDeviceButton(client));
|
return (ProcXGrabDeviceButton(client));
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,6 @@ int
|
||||||
SProcXGrabDeviceKey(ClientPtr client)
|
SProcXGrabDeviceKey(ClientPtr client)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
long *p;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
REQUEST(xGrabDeviceKeyReq);
|
REQUEST(xGrabDeviceKeyReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
|
@ -86,11 +84,8 @@ SProcXGrabDeviceKey(ClientPtr client)
|
||||||
swapl(&stuff->grabWindow, n);
|
swapl(&stuff->grabWindow, n);
|
||||||
swaps(&stuff->modifiers, n);
|
swaps(&stuff->modifiers, n);
|
||||||
swaps(&stuff->event_count, n);
|
swaps(&stuff->event_count, n);
|
||||||
p = (long *)&stuff[1];
|
REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32));
|
||||||
for (i = 0; i < stuff->event_count; i++) {
|
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
|
||||||
swapl(p, n);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return (ProcXGrabDeviceKey(client));
|
return (ProcXGrabDeviceKey(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,19 +127,16 @@ int
|
||||||
SProcXSelectExtensionEvent(ClientPtr client)
|
SProcXSelectExtensionEvent(ClientPtr client)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
long *p;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
REQUEST(xSelectExtensionEventReq);
|
REQUEST(xSelectExtensionEventReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
||||||
swapl(&stuff->window, n);
|
swapl(&stuff->window, n);
|
||||||
swaps(&stuff->count, n);
|
swaps(&stuff->count, n);
|
||||||
p = (long *)&stuff[1];
|
REQUEST_FIXED_SIZE(xSelectExtensionEventReq,
|
||||||
for (i = 0; i < stuff->count; i++) {
|
stuff->count * sizeof(CARD32));
|
||||||
swapl(p, n);
|
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return (ProcXSelectExtensionEvent(client));
|
return (ProcXSelectExtensionEvent(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ int
|
||||||
SProcXSendExtensionEvent(ClientPtr client)
|
SProcXSendExtensionEvent(ClientPtr client)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
long *p;
|
CARD32 *p;
|
||||||
int i;
|
int i;
|
||||||
xEvent eventT;
|
xEvent eventT;
|
||||||
xEvent *eventP;
|
xEvent *eventP;
|
||||||
|
@ -91,6 +91,11 @@ SProcXSendExtensionEvent(ClientPtr client)
|
||||||
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
||||||
swapl(&stuff->destination, n);
|
swapl(&stuff->destination, n);
|
||||||
swaps(&stuff->count, n);
|
swaps(&stuff->count, n);
|
||||||
|
|
||||||
|
if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count +
|
||||||
|
(stuff->num_events * (sizeof(xEvent) >> 2)))
|
||||||
|
return BadLength;
|
||||||
|
|
||||||
eventP = (xEvent *) & stuff[1];
|
eventP = (xEvent *) & stuff[1];
|
||||||
for (i = 0; i < stuff->num_events; i++, eventP++) {
|
for (i = 0; i < stuff->num_events; i++, eventP++) {
|
||||||
proc = EventSwapVector[eventP->u.u.type & 0177];
|
proc = EventSwapVector[eventP->u.u.type & 0177];
|
||||||
|
@ -100,11 +105,8 @@ SProcXSendExtensionEvent(ClientPtr client)
|
||||||
*eventP = eventT;
|
*eventP = eventT;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = (long *)(((xEvent *) & stuff[1]) + stuff->num_events);
|
p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events);
|
||||||
for (i = 0; i < stuff->count; i++) {
|
SwapLongs(p, stuff->count);
|
||||||
swapl(p, n);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return (ProcXSendExtensionEvent(client));
|
return (ProcXSendExtensionEvent(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1901,7 +1901,7 @@ if test "$KDRIVE" = yes; then
|
||||||
XEPHYR=$xephyr
|
XEPHYR=$xephyr
|
||||||
fi
|
fi
|
||||||
XEPHYR_DRI=no
|
XEPHYR_DRI=no
|
||||||
if test x$XEPHYR = xyes -a x$DRI = xyes; then
|
if test x$XEPHYR = xyes -a x$DRI = xyes && test "x$GLX" = xyes; then
|
||||||
XEPHYR_DRI=yes
|
XEPHYR_DRI=yes
|
||||||
XEPHYR_DRI_LIBS=-lGL
|
XEPHYR_DRI_LIBS=-lGL
|
||||||
AC_SUBST(XEPHYR_DRI_LIBS)
|
AC_SUBST(XEPHYR_DRI_LIBS)
|
||||||
|
|
|
@ -463,7 +463,8 @@ Dispatch(void)
|
||||||
if (result > (maxBigRequestSize << 2))
|
if (result > (maxBigRequestSize << 2))
|
||||||
result = BadLength;
|
result = BadLength;
|
||||||
else {
|
else {
|
||||||
XaceHookAuditBegin(client);
|
result = XaceHookDispatch(client, MAJOROP);
|
||||||
|
if (result == Success)
|
||||||
result = (* client->requestVector[MAJOROP])(client);
|
result = (* client->requestVector[MAJOROP])(client);
|
||||||
XaceHookAuditEnd(client, result);
|
XaceHookAuditEnd(client, result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,6 +326,13 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
|
||||||
err = BadFontName;
|
err = BadFontName;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
/* check values for firstCol, lastCol, firstRow, and lastRow */
|
||||||
|
if (pfont->info.firstCol > pfont->info.lastCol ||
|
||||||
|
pfont->info.firstRow > pfont->info.lastRow ||
|
||||||
|
pfont->info.lastCol - pfont->info.firstCol > 255) {
|
||||||
|
err = AllocError;
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
if (!pfont->fpe)
|
if (!pfont->fpe)
|
||||||
pfont->fpe = fpe;
|
pfont->fpe = fpe;
|
||||||
pfont->refcnt++;
|
pfont->refcnt++;
|
||||||
|
|
|
@ -3043,6 +3043,7 @@ UnrealizeTree(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
(* Unrealize)(pChild);
|
(* Unrealize)(pChild);
|
||||||
|
if (MapUnmapEventsEnabled(pWin))
|
||||||
DeleteWindowFromAnyEvents(pChild, FALSE);
|
DeleteWindowFromAnyEvents(pChild, FALSE);
|
||||||
if (pChild->viewable)
|
if (pChild->viewable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -790,6 +790,9 @@ exaMoveOutPixmap (PixmapPtr pPixmap);
|
||||||
void *
|
void *
|
||||||
exaGetPixmapDriverPrivate(PixmapPtr p);
|
exaGetPixmapDriverPrivate(PixmapPtr p);
|
||||||
|
|
||||||
|
CARD32
|
||||||
|
exaGetPixmapFirstPixel (PixmapPtr pPixmap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns TRUE if the given planemask covers all the significant bits in the
|
* Returns TRUE if the given planemask covers all the significant bits in the
|
||||||
* pixel values for pDrawable.
|
* pixel values for pDrawable.
|
||||||
|
|
|
@ -291,9 +291,6 @@ ExaCheckGetSpans (DrawablePtr pDrawable,
|
||||||
int nspans,
|
int nspans,
|
||||||
char *pdstStart);
|
char *pdstStart);
|
||||||
|
|
||||||
CARD32
|
|
||||||
exaGetPixmapFirstPixel (PixmapPtr pPixmap);
|
|
||||||
|
|
||||||
/* exa_accel.c */
|
/* exa_accel.c */
|
||||||
|
|
||||||
static _X_INLINE Bool
|
static _X_INLINE Bool
|
||||||
|
|
|
@ -635,7 +635,9 @@ ephyrInitScreen (ScreenPtr pScreen)
|
||||||
if (!ephyrNoDRI && !hostx_has_dri ()) {
|
if (!ephyrNoDRI && !hostx_has_dri ()) {
|
||||||
EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ;
|
EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ;
|
||||||
ephyrNoDRI = TRUE ;
|
ephyrNoDRI = TRUE ;
|
||||||
|
#ifdef GLXEXT
|
||||||
noGlxVisualInit = FALSE ;
|
noGlxVisualInit = FALSE ;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (!ephyrNoDRI) {
|
if (!ephyrNoDRI) {
|
||||||
ephyrDRIExtensionInit (pScreen) ;
|
ephyrDRIExtensionInit (pScreen) ;
|
||||||
|
@ -1029,6 +1031,7 @@ EphyrKeyboardInit (KdKeyboardInfo *ki)
|
||||||
ki->minScanCode = ki->keySyms.minKeyCode;
|
ki->minScanCode = ki->keySyms.minKeyCode;
|
||||||
ki->maxScanCode = ki->keySyms.maxKeyCode;
|
ki->maxScanCode = ki->keySyms.maxKeyCode;
|
||||||
ki->keySyms.mapWidth = ephyrKeySyms.mapWidth;
|
ki->keySyms.mapWidth = ephyrKeySyms.mapWidth;
|
||||||
|
xfree(ki->keySyms.map);
|
||||||
ki->keySyms.map = ephyrKeySyms.map;
|
ki->keySyms.map = ephyrKeySyms.map;
|
||||||
ki->name = KdSaveString("Xephyr virtual keyboard");
|
ki->name = KdSaveString("Xephyr virtual keyboard");
|
||||||
ephyrKbd = ki;
|
ephyrKbd = ki;
|
||||||
|
|
|
@ -206,7 +206,7 @@ ephyrDRIScreenInit (ScreenPtr a_screen)
|
||||||
a_screen->ClipNotify = ephyrDRIClipNotify ;
|
a_screen->ClipNotify = ephyrDRIClipNotify ;
|
||||||
|
|
||||||
is_ok = TRUE ;
|
is_ok = TRUE ;
|
||||||
out:
|
|
||||||
return is_ok ;
|
return is_ok ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
/*we are not in debug mode*/
|
/*we are not in debug mode*/
|
||||||
#define EPHYR_LOG
|
#define EPHYR_LOG(...)
|
||||||
#define EPHYR_LOG_ERROR
|
#define EPHYR_LOG_ERROR(...)
|
||||||
#endif /*NDEBUG*/
|
#endif /*NDEBUG*/
|
||||||
|
|
||||||
#define ERROR_LOG_LEVEL 3
|
#define ERROR_LOG_LEVEL 3
|
||||||
|
|
|
@ -1078,16 +1078,6 @@ out:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int is_valid ;
|
|
||||||
int local_id ;
|
|
||||||
int remote_id ;
|
|
||||||
} ResourcePair ;
|
|
||||||
|
|
||||||
#define RESOURCE_PEERS_SIZE 1024*10
|
|
||||||
static ResourcePair resource_peers[RESOURCE_PEERS_SIZE] ;
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
hostx_create_window (int a_screen_number,
|
hostx_create_window (int a_screen_number,
|
||||||
EphyrBox *a_geometry,
|
EphyrBox *a_geometry,
|
||||||
|
@ -1259,6 +1249,16 @@ hostx_has_xshape (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XEPHYR_DRI
|
#ifdef XEPHYR_DRI
|
||||||
|
typedef struct {
|
||||||
|
int is_valid ;
|
||||||
|
int local_id ;
|
||||||
|
int remote_id ;
|
||||||
|
} ResourcePair ;
|
||||||
|
|
||||||
|
#define RESOURCE_PEERS_SIZE 1024*10
|
||||||
|
static ResourcePair resource_peers[RESOURCE_PEERS_SIZE] ;
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
hostx_allocate_resource_id_peer (int a_local_resource_id,
|
hostx_allocate_resource_id_peer (int a_local_resource_id,
|
||||||
int *a_remote_resource_id)
|
int *a_remote_resource_id)
|
||||||
|
|
|
@ -548,6 +548,10 @@ MiscExtPassMessage(int scrnIndex, const char *msgtype, const char *msgval,
|
||||||
{
|
{
|
||||||
ScrnInfoPtr pScr = xf86Screens[scrnIndex];
|
ScrnInfoPtr pScr = xf86Screens[scrnIndex];
|
||||||
|
|
||||||
|
/* should check this in the protocol, but xf86NumScreens isn't exported */
|
||||||
|
if (scrnIndex >= xf86NumScreens)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
if (*pScr->HandleMessage == NULL)
|
if (*pScr->HandleMessage == NULL)
|
||||||
return BadImplementation;
|
return BadImplementation;
|
||||||
return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr);
|
return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr);
|
||||||
|
|
|
@ -38,6 +38,15 @@ static MODULESETUPPROTO(extmodSetup);
|
||||||
* Array describing extensions to be initialized
|
* Array describing extensions to be initialized
|
||||||
*/
|
*/
|
||||||
static ExtensionModule extensionModules[] = {
|
static ExtensionModule extensionModules[] = {
|
||||||
|
#ifdef XSELINUX
|
||||||
|
{
|
||||||
|
SELinuxExtensionInit,
|
||||||
|
SELINUX_EXTENSION_NAME,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
},
|
||||||
|
#endif
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
{
|
{
|
||||||
ShapeExtensionInit,
|
ShapeExtensionInit,
|
||||||
|
|
|
@ -125,12 +125,9 @@ extern void ShmRegisterFuncs(
|
||||||
ShmFuncsPtr funcs);
|
ShmFuncsPtr funcs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XACE
|
|
||||||
extern void XaceExtensionInit(INITARGS);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSELINUX
|
#ifdef XSELINUX
|
||||||
extern void SELinuxExtensionInit(INITARGS);
|
extern void SELinuxExtensionInit(INITARGS);
|
||||||
|
#include "xselinux.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
|
|
@ -401,7 +401,7 @@ xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src)
|
||||||
int flags = cursor_info->Flags;
|
int flags = cursor_info->Flags;
|
||||||
|
|
||||||
cursor_image = xf86_config->cursor_image;
|
cursor_image = xf86_config->cursor_image;
|
||||||
memset(cursor_image, 0, cursor_info->MaxWidth * stride);
|
memset(cursor_image, 0, cursor_info->MaxHeight * stride);
|
||||||
|
|
||||||
for (y = 0; y < cursor_info->MaxHeight; y++)
|
for (y = 0; y < cursor_info->MaxHeight; y++)
|
||||||
for (x = 0; x < cursor_info->MaxWidth; x++)
|
for (x = 0; x < cursor_info->MaxWidth; x++)
|
||||||
|
|
|
@ -66,6 +66,8 @@ typedef enum {
|
||||||
DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE = 1 << 5,
|
DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE = 1 << 5,
|
||||||
/* Monitor forgot to set the first detailed is preferred bit. */
|
/* Monitor forgot to set the first detailed is preferred bit. */
|
||||||
DDC_QUIRK_FIRST_DETAILED_PREFERRED = 1 << 6,
|
DDC_QUIRK_FIRST_DETAILED_PREFERRED = 1 << 6,
|
||||||
|
/* use +hsync +vsync for detailed mode */
|
||||||
|
DDC_QUIRK_DETAILED_SYNC_PP = 1 << 7,
|
||||||
} ddc_quirk_t;
|
} ddc_quirk_t;
|
||||||
|
|
||||||
static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
|
static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
|
||||||
|
@ -160,6 +162,15 @@ static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Bool quirk_detailed_sync_pp(int scrnIndex, xf86MonPtr DDC)
|
||||||
|
{
|
||||||
|
/* Bug #12439: Samsung SyncMaster 205BW */
|
||||||
|
if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
|
||||||
|
DDC->vendor.prod_id == 541)
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Bool (*detect) (int scrnIndex, xf86MonPtr DDC);
|
Bool (*detect) (int scrnIndex, xf86MonPtr DDC);
|
||||||
ddc_quirk_t quirk;
|
ddc_quirk_t quirk;
|
||||||
|
@ -195,6 +206,10 @@ static const ddc_quirk_map_t ddc_quirks[] = {
|
||||||
quirk_first_detailed_preferred, DDC_QUIRK_FIRST_DETAILED_PREFERRED,
|
quirk_first_detailed_preferred, DDC_QUIRK_FIRST_DETAILED_PREFERRED,
|
||||||
"First detailed timing was not marked as preferred."
|
"First detailed timing was not marked as preferred."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
quirk_detailed_sync_pp, DDC_QUIRK_DETAILED_SYNC_PP,
|
||||||
|
"Use +hsync +vsync for detailed timing."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
NULL, DDC_QUIRK_NONE,
|
NULL, DDC_QUIRK_NONE,
|
||||||
"No known quirks"
|
"No known quirks"
|
||||||
|
@ -341,6 +356,9 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
|
||||||
if (timing->interlaced)
|
if (timing->interlaced)
|
||||||
Mode->Flags |= V_INTERLACE;
|
Mode->Flags |= V_INTERLACE;
|
||||||
|
|
||||||
|
if (quirks & DDC_QUIRK_DETAILED_SYNC_PP)
|
||||||
|
Mode->Flags |= V_PVSYNC | V_PHSYNC;
|
||||||
|
else {
|
||||||
if (timing->misc & 0x02)
|
if (timing->misc & 0x02)
|
||||||
Mode->Flags |= V_PVSYNC;
|
Mode->Flags |= V_PVSYNC;
|
||||||
else
|
else
|
||||||
|
@ -350,6 +368,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
|
||||||
Mode->Flags |= V_PHSYNC;
|
Mode->Flags |= V_PHSYNC;
|
||||||
else
|
else
|
||||||
Mode->Flags |= V_NHSYNC;
|
Mode->Flags |= V_NHSYNC;
|
||||||
|
}
|
||||||
|
|
||||||
return Mode;
|
return Mode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,17 +142,8 @@ mtrr_open(int verbosity)
|
||||||
/* Only report absence of /proc/mtrr once. */
|
/* Only report absence of /proc/mtrr once. */
|
||||||
static Bool warned = FALSE;
|
static Bool warned = FALSE;
|
||||||
|
|
||||||
char **fn;
|
|
||||||
static char *mtrr_files[] = {
|
|
||||||
"/dev/cpu/mtrr", /* Possible future name */
|
|
||||||
"/proc/mtrr", /* Current name */
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
if (mtrr_fd == MTRR_FD_UNOPENED) {
|
if (mtrr_fd == MTRR_FD_UNOPENED) {
|
||||||
/* So open it. */
|
mtrr_fd = open("/proc/mtrr", O_WRONLY);
|
||||||
for (fn = mtrr_files; mtrr_fd < 0 && *fn; fn++)
|
|
||||||
mtrr_fd = open(*fn, O_WRONLY);
|
|
||||||
|
|
||||||
if (mtrr_fd < 0)
|
if (mtrr_fd < 0)
|
||||||
mtrr_fd = MTRR_FD_PROBLEM;
|
mtrr_fd = MTRR_FD_PROBLEM;
|
||||||
|
|
|
@ -97,5 +97,6 @@ extern int quartzHasRoot, quartzEnableRootless;
|
||||||
#define PREFS_SWAP_ALT_META "swap_alt_meta"
|
#define PREFS_SWAP_ALT_META "swap_alt_meta"
|
||||||
#define PREFS_XP_OPTIONS "xp_options"
|
#define PREFS_XP_OPTIONS "xp_options"
|
||||||
#define PREFS_ENABLE_STEREO "enable_stereo"
|
#define PREFS_ENABLE_STEREO "enable_stereo"
|
||||||
|
#define PREFS_LOGIN_SHELL "login_shell"
|
||||||
|
|
||||||
#endif /* X11APPLICATION_H */
|
#endif /* X11APPLICATION_H */
|
||||||
|
|
|
@ -164,7 +164,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
||||||
have it activated while X is active (unless using the old
|
have it activated while X is active (unless using the old
|
||||||
keymapping files) */
|
keymapping files) */
|
||||||
static TSMDocumentID x11_document;
|
static TSMDocumentID x11_document;
|
||||||
|
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
|
||||||
if (state) {
|
if (state) {
|
||||||
QuartzMessageServerThread (kXDarwinActivate, 0);
|
QuartzMessageServerThread (kXDarwinActivate, 0);
|
||||||
|
|
||||||
|
@ -314,6 +314,11 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_front_process:unused {
|
- (void) set_front_process:unused {
|
||||||
|
/* Hackery needed due to argv[0] hackery */
|
||||||
|
// [self activateX:YES];
|
||||||
|
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||||
|
SetFrontProcess(&psn);
|
||||||
|
|
||||||
QuartzMessageServerThread(kXDarwinBringAllToFront, 0);
|
QuartzMessageServerThread(kXDarwinBringAllToFront, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@
|
||||||
argv[0] = "/usr/bin/login";
|
argv[0] = "/usr/bin/login";
|
||||||
argv[1] = "-fp";
|
argv[1] = "-fp";
|
||||||
argv[2] = getlogin();
|
argv[2] = getlogin();
|
||||||
argv[3] = "/bin/sh";
|
argv[3] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"];
|
||||||
argv[4] = "-c";
|
argv[4] = "-c";
|
||||||
argv[5] = command;
|
argv[5] = command;
|
||||||
argv[6] = NULL;
|
argv[6] = NULL;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Copyright © 2003-2008, Apple Inc.
|
<string>Copyright © 2003-2008, Apple Inc.
|
||||||
Copyright © 2003, XFree86 Project, Inc.
|
Copyright © 2003, XFree86 Project, Inc.
|
||||||
Copyright © 2003-2008, X.org Project, Inc.
|
Copyright © 2003-2008, X.org Foundation, Inc.
|
||||||
</string>
|
</string>
|
||||||
<key>NSMainNibFile</key>
|
<key>NSMainNibFile</key>
|
||||||
<string>main</string>
|
<string>main</string>
|
||||||
|
|
|
@ -18,8 +18,6 @@ EXTRA_DIST = \
|
||||||
Info.plist \
|
Info.plist \
|
||||||
X11.icns \
|
X11.icns \
|
||||||
bundle-main.c \
|
bundle-main.c \
|
||||||
launcher-main.c \
|
|
||||||
server-main.c \
|
|
||||||
English.lproj/InfoPlist.strings \
|
English.lproj/InfoPlist.strings \
|
||||||
English.lproj/Localizable.strings \
|
English.lproj/Localizable.strings \
|
||||||
English.lproj/main.nib/classes.nib \
|
English.lproj/main.nib/classes.nib \
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#define DEFAULT_CLIENT "/usr/X11/bin/xterm"
|
#define DEFAULT_CLIENT "/usr/X11/bin/xterm"
|
||||||
#define DEFAULT_STARTX "/usr/X11/bin/startx"
|
#define DEFAULT_STARTX "/usr/X11/bin/startx"
|
||||||
|
#define DEFAULT_SHELL "/bin/sh"
|
||||||
|
|
||||||
static int execute(const char *command);
|
static int execute(const char *command);
|
||||||
static char *command_from_prefs(const char *key, const char *default_value);
|
static char *command_from_prefs(const char *key, const char *default_value);
|
||||||
|
@ -82,7 +83,7 @@ static int execute(const char *command) {
|
||||||
newargv[0] = "/usr/bin/login";
|
newargv[0] = "/usr/bin/login";
|
||||||
newargv[1] = "-fp";
|
newargv[1] = "-fp";
|
||||||
newargv[2] = getlogin();
|
newargv[2] = getlogin();
|
||||||
newargv[3] = "/bin/sh";
|
newargv[3] = command_from_prefs("login_shell", DEFAULT_SHELL);
|
||||||
newargv[4] = "-c";
|
newargv[4] = "-c";
|
||||||
newargv[5] = command;
|
newargv[5] = command;
|
||||||
newargv[6] = NULL;
|
newargv[6] = NULL;
|
||||||
|
|
|
@ -245,9 +245,6 @@ typedef void (*InitExtension)(INITARGS);
|
||||||
#define _XAG_SERVER_
|
#define _XAG_SERVER_
|
||||||
#include <X11/extensions/Xagstr.h>
|
#include <X11/extensions/Xagstr.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef XACE
|
|
||||||
#include "xace.h"
|
|
||||||
#endif
|
|
||||||
#ifdef XCSECURITY
|
#ifdef XCSECURITY
|
||||||
#include "securitysrv.h"
|
#include "securitysrv.h"
|
||||||
#include <X11/extensions/securstr.h>
|
#include <X11/extensions/securstr.h>
|
||||||
|
@ -324,9 +321,6 @@ extern void DbeExtensionInit(INITARGS);
|
||||||
#ifdef XAPPGROUP
|
#ifdef XAPPGROUP
|
||||||
extern void XagExtensionInit(INITARGS);
|
extern void XagExtensionInit(INITARGS);
|
||||||
#endif
|
#endif
|
||||||
#ifdef XACE
|
|
||||||
extern void XaceExtensionInit(INITARGS);
|
|
||||||
#endif
|
|
||||||
#ifdef XCSECURITY
|
#ifdef XCSECURITY
|
||||||
extern void SecurityExtensionInit(INITARGS);
|
extern void SecurityExtensionInit(INITARGS);
|
||||||
#endif
|
#endif
|
||||||
|
@ -604,9 +598,6 @@ InitExtensions(argc, argv)
|
||||||
#ifdef XAPPGROUP
|
#ifdef XAPPGROUP
|
||||||
if (!noXagExtension) XagExtensionInit();
|
if (!noXagExtension) XagExtensionInit();
|
||||||
#endif
|
#endif
|
||||||
#ifdef XACE
|
|
||||||
XaceExtensionInit();
|
|
||||||
#endif
|
|
||||||
#ifdef XCSECURITY
|
#ifdef XCSECURITY
|
||||||
if (!noSecurityExtension) SecurityExtensionInit();
|
if (!noSecurityExtension) SecurityExtensionInit();
|
||||||
#endif
|
#endif
|
||||||
|
@ -702,15 +693,9 @@ static ExtensionModule staticExtensions[] = {
|
||||||
#ifdef XAPPGROUP
|
#ifdef XAPPGROUP
|
||||||
{ XagExtensionInit, XAGNAME, &noXagExtension, NULL, NULL },
|
{ XagExtensionInit, XAGNAME, &noXagExtension, NULL, NULL },
|
||||||
#endif
|
#endif
|
||||||
#ifdef XACE
|
|
||||||
{ XaceExtensionInit, XACE_EXTENSION_NAME, NULL, NULL, NULL },
|
|
||||||
#endif
|
|
||||||
#ifdef XCSECURITY
|
#ifdef XCSECURITY
|
||||||
{ SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
|
{ SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
|
||||||
#endif
|
#endif
|
||||||
#ifdef XSELINUX
|
|
||||||
{ SELinuxExtensionInit, SELINUX_EXTENSION_NAME, NULL, NULL, NULL },
|
|
||||||
#endif
|
|
||||||
#ifdef XPRINT
|
#ifdef XPRINT
|
||||||
{ XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL },
|
{ XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL },
|
||||||
#endif
|
#endif
|
||||||
|
|
2
os/io.c
2
os/io.c
|
@ -1196,7 +1196,7 @@ AllocateOutputBuffer(void)
|
||||||
oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput));
|
oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput));
|
||||||
if (!oco)
|
if (!oco)
|
||||||
return (ConnectionOutputPtr)NULL;
|
return (ConnectionOutputPtr)NULL;
|
||||||
oco->buf = (unsigned char *) xalloc(BUFSIZE);
|
oco->buf = (unsigned char *) xcalloc(1, BUFSIZE);
|
||||||
if (!oco->buf)
|
if (!oco->buf)
|
||||||
{
|
{
|
||||||
xfree(oco);
|
xfree(oco);
|
||||||
|
|
|
@ -1796,6 +1796,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
dst->geom->sections = tmp;
|
dst->geom->sections = tmp;
|
||||||
|
dst->geom->num_sections = src->geom->num_sections;
|
||||||
|
|
||||||
for (i = 0,
|
for (i = 0,
|
||||||
ssection = src->geom->sections,
|
ssection = src->geom->sections,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user