From d6d3999ccb2cb72d55820770260172eccbbb68d7 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 16 Apr 2012 09:17:34 +0200 Subject: libX11 xserver pixman mesa git update 16 Apr 2012 --- xorg-server/Xext/bigreq.c | 16 +-- xorg-server/Xext/dpmsproc.h | 2 +- xorg-server/Xext/geint.h | 107 +++++++------- xorg-server/Xext/panoramiX.h | 29 ++-- xorg-server/Xext/panoramiXh.h | 16 +-- xorg-server/Xext/securitysrv.h | 45 +++--- xorg-server/Xext/shmint.h | 14 +- xorg-server/Xext/syncsdk.h | 93 ++++++------ xorg-server/Xext/xacestr.h | 2 +- xorg-server/Xext/xselinux.h | 116 +++++++-------- xorg-server/Xext/xselinux_ext.c | 308 ++++++++++++++++++++-------------------- 11 files changed, 373 insertions(+), 375 deletions(-) (limited to 'xorg-server/Xext') diff --git a/xorg-server/Xext/bigreq.c b/xorg-server/Xext/bigreq.c index a939e1699..49355c4a4 100644 --- a/xorg-server/Xext/bigreq.c +++ b/xorg-server/Xext/bigreq.c @@ -43,16 +43,16 @@ from The Open Group. void BigReqExtensionInit(INITARGS); static int -ProcBigReqDispatch (ClientPtr client) +ProcBigReqDispatch(ClientPtr client) { REQUEST(xBigReqEnableReq); xBigReqEnableReply rep; if (client->swapped) { - swaps(&stuff->length); + swaps(&stuff->length); } if (stuff->brReqType != X_BigReqEnable) - return BadRequest; + return BadRequest; REQUEST_SIZE_MATCH(xBigReqEnableReq); client->big_requests = TRUE; memset(&rep, 0, sizeof(xBigReqEnableReply)); @@ -61,10 +61,10 @@ ProcBigReqDispatch (ClientPtr client) rep.sequenceNumber = client->sequence; rep.max_request_size = maxBigRequestSize; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.max_request_size); + swaps(&rep.sequenceNumber); + swapl(&rep.max_request_size); } - WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep); + WriteToClient(client, sizeof(xBigReqEnableReply), (char *) &rep); return Success; } @@ -72,6 +72,6 @@ void BigReqExtensionInit(INITARGS) { AddExtension(XBigReqExtensionName, 0, 0, - ProcBigReqDispatch, ProcBigReqDispatch, - NULL, StandardMinorOpcode); + ProcBigReqDispatch, ProcBigReqDispatch, + NULL, StandardMinorOpcode); } diff --git a/xorg-server/Xext/dpmsproc.h b/xorg-server/Xext/dpmsproc.h index c1df56fdf..7494dfd6f 100644 --- a/xorg-server/Xext/dpmsproc.h +++ b/xorg-server/Xext/dpmsproc.h @@ -9,7 +9,7 @@ #include "dixstruct.h" -int DPMSSet(ClientPtr client, int level); +int DPMSSet(ClientPtr client, int level); Bool DPMSSupported(void); #endif diff --git a/xorg-server/Xext/geint.h b/xorg-server/Xext/geint.h index 5c64a20f4..f76d14809 100644 --- a/xorg-server/Xext/geint.h +++ b/xorg-server/Xext/geint.h @@ -1,53 +1,54 @@ -/* - * Copyright 2007-2008 Peter Hutterer - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Peter Hutterer, University of South Australia, NICTA - */ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef _GEINT_H_ -#define _GEINT_H_ - -#include -#include -#include "misc.h" -#include "os.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include - -extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec; -#define GEClientPrivateKey (&GEClientPrivateKeyRec) - -typedef struct _GEClientInfo { - CARD32 major_version; - CARD32 minor_version; -} GEClientInfoRec, *GEClientInfoPtr; - -#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey))) - -extern _X_EXPORT int (*ProcGEVector[/*GENumRequests*/])(ClientPtr); -extern _X_EXPORT int (*SProcGEVector[/*GENumRequests*/])(ClientPtr); - -#endif /* _GEINT_H_ */ +/* + * Copyright 2007-2008 Peter Hutterer + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Peter Hutterer, University of South Australia, NICTA + */ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#ifndef _GEINT_H_ +#define _GEINT_H_ + +#include +#include +#include "misc.h" +#include "os.h" +#include "dixstruct.h" +#include "extnsionst.h" +#include + +extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec; + +#define GEClientPrivateKey (&GEClientPrivateKeyRec) + +typedef struct _GEClientInfo { + CARD32 major_version; + CARD32 minor_version; +} GEClientInfoRec, *GEClientInfoPtr; + +#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey))) + +extern _X_EXPORT int (*ProcGEVector[ /*GENumRequests */ ]) (ClientPtr); +extern _X_EXPORT int (*SProcGEVector[ /*GENumRequests */ ]) (ClientPtr); + +#endif /* _GEINT_H_ */ diff --git a/xorg-server/Xext/panoramiX.h b/xorg-server/Xext/panoramiX.h index 71651e558..6578dfa17 100644 --- a/xorg-server/Xext/panoramiX.h +++ b/xorg-server/Xext/panoramiX.h @@ -26,7 +26,6 @@ Equipment Corporation. ******************************************************************/ - /* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ /* @@ -47,25 +46,25 @@ Equipment Corporation. #include "dixstruct.h" typedef struct _PanoramiXInfo { - XID id ; + XID id; } PanoramiXInfo; typedef struct { PanoramiXInfo info[MAXSCREENS]; RESTYPE type; union { - struct { - char visibility; - char class; - char root; - } win; - struct { - Bool shared; - } pix; - struct { - Bool root; - } pict; - char raw_data[4]; + struct { + char visibility; + char class; + char root; + } win; + struct { + Bool shared; + } pix; + struct { + Bool root; + } pict; + char raw_data[4]; } u; } PanoramiXRes; @@ -77,4 +76,4 @@ typedef struct { #define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared) #define IS_ROOT_DRAWABLE(d) (((d)->type == XRT_WINDOW) && (d)->u.win.root) -#endif /* _PANORAMIX_H_ */ +#endif /* _PANORAMIX_H_ */ diff --git a/xorg-server/Xext/panoramiXh.h b/xorg-server/Xext/panoramiXh.h index 31b8f90b6..2762a59ac 100644 --- a/xorg-server/Xext/panoramiXh.h +++ b/xorg-server/Xext/panoramiXh.h @@ -16,7 +16,7 @@ extern int PanoramiXUnmapSubwindows(ClientPtr client); extern int PanoramiXConfigureWindow(ClientPtr client); extern int PanoramiXCirculateWindow(ClientPtr client); extern int PanoramiXGetGeometry(ClientPtr client); -extern int PanoramiXTranslateCoords(ClientPtr client); +extern int PanoramiXTranslateCoords(ClientPtr client); extern int PanoramiXCreatePixmap(ClientPtr client); extern int PanoramiXFreePixmap(ClientPtr client); extern int PanoramiXChangeGC(ClientPtr client); @@ -40,7 +40,7 @@ extern int PanoramiXPolyFillRectangle(ClientPtr client); extern int PanoramiXPutImage(ClientPtr client); extern int PanoramiXGetImage(ClientPtr client); extern int PanoramiXPolyText8(ClientPtr client); -extern int PanoramiXPolyText16(ClientPtr client); +extern int PanoramiXPolyText16(ClientPtr client); extern int PanoramiXImageText8(ClientPtr client); extern int PanoramiXImageText16(ClientPtr client); extern int PanoramiXCreateColormap(ClientPtr client); @@ -57,11 +57,11 @@ extern int PanoramiXAllocColorPlanes(ClientPtr client); #define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr) -PROC_EXTERN(ProcPanoramiXQueryVersion); -PROC_EXTERN(ProcPanoramiXGetState); -PROC_EXTERN(ProcPanoramiXGetScreenCount); -PROC_EXTERN(ProcPanoramiXGetScreenSize); - +PROC_EXTERN(ProcPanoramiXQueryVersion); +PROC_EXTERN(ProcPanoramiXGetState); +PROC_EXTERN(ProcPanoramiXGetScreenCount); +PROC_EXTERN(ProcPanoramiXGetScreenSize); + PROC_EXTERN(ProcXineramaQueryScreens); PROC_EXTERN(ProcXineramaIsActive); @@ -70,4 +70,4 @@ extern int SProcPanoramiXDispatch(ClientPtr client); extern int connBlockScreenStart; extern xConnSetupPrefix connSetupPrefix; -extern int (* SavedProcVector[256]) (ClientPtr client); +extern int (*SavedProcVector[256]) (ClientPtr client); diff --git a/xorg-server/Xext/securitysrv.h b/xorg-server/Xext/securitysrv.h index 3d3894a18..8904242d6 100644 --- a/xorg-server/Xext/securitysrv.h +++ b/xorg-server/Xext/securitysrv.h @@ -32,52 +32,51 @@ from The Open Group. /* Allow client side portions of to compile */ #ifndef Status -# define Status int -# define NEED_UNDEF_Status +#define Status int +#define NEED_UNDEF_Status #endif #ifndef Display -# define Display void -# define NEED_UNDEF_Display +#define Display void +#define NEED_UNDEF_Display #endif #include #ifdef NEED_UNDEF_Status -# undef Status -# undef NEED_UNDEF_Status +#undef Status +#undef NEED_UNDEF_Status #endif #ifdef NEED_UNDEF_Display -# undef Display -# undef NEED_UNDEF_Display +#undef Display +#undef NEED_UNDEF_Display #endif - -#include "input.h" /* for DeviceIntPtr */ -#include "property.h" /* for PropertyPtr */ -#include "pixmap.h" /* for DrawablePtr */ -#include "resource.h" /* for RESTYPE */ +#include "input.h" /* for DeviceIntPtr */ +#include "property.h" /* for PropertyPtr */ +#include "pixmap.h" /* for DrawablePtr */ +#include "resource.h" /* for RESTYPE */ /* resource type to pass in LookupIDByType for authorizations */ extern RESTYPE SecurityAuthorizationResType; /* this is what we store for an authorization */ typedef struct { - XID id; /* resource ID */ - CARD32 timeout; /* how long to live in seconds after refcnt == 0 */ - unsigned int trustLevel; /* trusted/untrusted */ - XID group; /* see embedding extension */ - unsigned int refcnt; /* how many clients connected with this auth */ - unsigned int secondsRemaining; /* overflow time amount for >49 days */ - OsTimerPtr timer; /* timer for this auth */ + XID id; /* resource ID */ + CARD32 timeout; /* how long to live in seconds after refcnt == 0 */ + unsigned int trustLevel; /* trusted/untrusted */ + XID group; /* see embedding extension */ + unsigned int refcnt; /* how many clients connected with this auth */ + unsigned int secondsRemaining; /* overflow time amount for >49 days */ + OsTimerPtr timer; /* timer for this auth */ struct _OtherClients *eventClients; /* clients wanting events */ } SecurityAuthorizationRec, *SecurityAuthorizationPtr; typedef struct { - XID group; /* the group that was sent in GenerateAuthorization */ - Bool valid; /* did anyone recognize it? if so, set to TRUE */ + XID group; /* the group that was sent in GenerateAuthorization */ + Bool valid; /* did anyone recognize it? if so, set to TRUE */ } SecurityValidateGroupInfoRec; /* Give this value or higher to the -audit option to get security messages */ #define SECURITY_AUDIT_LEVEL 4 -#endif /* _SECURITY_SRV_H */ +#endif /* _SECURITY_SRV_H */ diff --git a/xorg-server/Xext/shmint.h b/xorg-server/Xext/shmint.h index 8f8a00d4f..fa6941c90 100644 --- a/xorg-server/Xext/shmint.h +++ b/xorg-server/Xext/shmint.h @@ -42,28 +42,28 @@ int /* sh */, \ int /* dx */, \ int /* dy */, \ - char * /* data */ + char * /* data */ #define XSHM_CREATE_PIXMAP_ARGS \ ScreenPtr /* pScreen */, \ int /* width */, \ int /* height */, \ int /* depth */, \ - char * /* addr */ + char * /* addr */ typedef struct _ShmFuncs { - PixmapPtr (* CreatePixmap)(XSHM_CREATE_PIXMAP_ARGS); - void (* PutImage)(XSHM_PUT_IMAGE_ARGS); + PixmapPtr (*CreatePixmap) (XSHM_CREATE_PIXMAP_ARGS); + void (*PutImage) (XSHM_PUT_IMAGE_ARGS); } ShmFuncs, *ShmFuncsPtr; extern _X_EXPORT void -ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs); + ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs); extern _X_EXPORT void -ShmRegisterFbFuncs(ScreenPtr pScreen); + ShmRegisterFbFuncs(ScreenPtr pScreen); extern _X_EXPORT RESTYPE ShmSegType; extern _X_EXPORT int ShmCompletionCode; extern _X_EXPORT int BadShmSegCode; -#endif /* _SHMINT_H_ */ +#endif /* _SHMINT_H_ */ diff --git a/xorg-server/Xext/syncsdk.h b/xorg-server/Xext/syncsdk.h index eab5451f1..f1b99d010 100644 --- a/xorg-server/Xext/syncsdk.h +++ b/xorg-server/Xext/syncsdk.h @@ -1,47 +1,46 @@ -/* - * Copyright © 2010 NVIDIA Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef _SYNCSDK_H_ -#define _SYNCSDK_H_ - -#include "misync.h" - -extern _X_EXPORT int -SyncVerifyFence(SyncFence **ppFence, XID fid, ClientPtr client, Mask mode); - -#define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \ - do { \ - int rc; \ - rc = SyncVerifyFence(&(pFence), (fid), (client), (mode)); \ - if (Success != rc) return rc; \ - } while (0) - -#define VERIFY_SYNC_FENCE_OR_NONE(pFence, fid, client, mode) \ - do { \ - pFence = 0; \ - if (None != fid) \ - VERIFY_SYNC_FENCE((pFence), (fid), (client), (mode)); \ - } while (0) - -#endif /* _SYNCSDK_H_ */ - +/* + * Copyright © 2010 NVIDIA Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _SYNCSDK_H_ +#define _SYNCSDK_H_ + +#include "misync.h" + +extern _X_EXPORT int + SyncVerifyFence(SyncFence ** ppFence, XID fid, ClientPtr client, Mask mode); + +#define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \ + do { \ + int rc; \ + rc = SyncVerifyFence(&(pFence), (fid), (client), (mode)); \ + if (Success != rc) return rc; \ + } while (0) + +#define VERIFY_SYNC_FENCE_OR_NONE(pFence, fid, client, mode) \ + do { \ + pFence = 0; \ + if (None != fid) \ + VERIFY_SYNC_FENCE((pFence), (fid), (client), (mode)); \ + } while (0) + +#endif /* _SYNCSDK_H_ */ diff --git a/xorg-server/Xext/xacestr.h b/xorg-server/Xext/xacestr.h index 84216c8c0..989b0339f 100644 --- a/xorg-server/Xext/xacestr.h +++ b/xorg-server/Xext/xacestr.h @@ -144,4 +144,4 @@ typedef struct { int requestResult; } XaceAuditRec; -#endif /* _XACESTR_H */ +#endif /* _XACESTR_H */ diff --git a/xorg-server/Xext/xselinux.h b/xorg-server/Xext/xselinux.h index 57239821e..5be7088c8 100644 --- a/xorg-server/Xext/xselinux.h +++ b/xorg-server/Xext/xselinux.h @@ -53,87 +53,87 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define X_SELinuxGetClientContext 22 typedef struct { - CARD8 reqType; - CARD8 SELinuxReqType; - CARD16 length; - CARD8 client_major; - CARD8 client_minor; + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD8 client_major; + CARD8 client_minor; } SELinuxQueryVersionReq; typedef struct { - CARD8 type; - CARD8 pad1; - CARD16 sequenceNumber; - CARD32 length; - CARD16 server_major; - CARD16 server_minor; - CARD32 pad2; - CARD32 pad3; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 server_major; + CARD16 server_minor; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; } SELinuxQueryVersionReply; typedef struct { - CARD8 reqType; - CARD8 SELinuxReqType; - CARD16 length; - CARD32 context_len; + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD32 context_len; } SELinuxSetCreateContextReq; typedef struct { - CARD8 reqType; - CARD8 SELinuxReqType; - CARD16 length; + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; } SELinuxGetCreateContextReq; typedef struct { - CARD8 reqType; - CARD8 SELinuxReqType; - CARD16 length; - CARD32 id; - CARD32 context_len; + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD32 id; + CARD32 context_len; } SELinuxSetContextReq; typedef struct { - CARD8 reqType; - CARD8 SELinuxReqType; - CARD16 length; - CARD32 id; + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD32 id; } SELinuxGetContextReq; typedef struct { - CARD8 reqType; - CARD8 SELinuxReqType; - CARD16 length; - CARD32 window; - CARD32 property; + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD32 window; + CARD32 property; } SELinuxGetPropertyContextReq; typedef struct { - CARD8 type; - CARD8 pad1; - CARD16 sequenceNumber; - CARD32 length; - CARD32 context_len; - CARD32 pad2; - CARD32 pad3; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 context_len; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; } SELinuxGetContextReply; typedef struct { - CARD8 type; - CARD8 pad1; - CARD16 sequenceNumber; - CARD32 length; - CARD32 count; - CARD32 pad2; - CARD32 pad3; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 count; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; } SELinuxListItemsReply; -#endif /* _XSELINUX_H */ +#endif /* _XSELINUX_H */ diff --git a/xorg-server/Xext/xselinux_ext.c b/xorg-server/Xext/xselinux_ext.c index a18a36706..342abb1a6 100644 --- a/xorg-server/Xext/xselinux_ext.c +++ b/xorg-server/Xext/xselinux_ext.c @@ -44,7 +44,6 @@ typedef struct { CARD32 id; } SELinuxListItemRec; - /* * Extension Dispatch */ @@ -53,8 +52,9 @@ static security_context_t SELinuxCopyContext(char *ptr, unsigned len) { security_context_t copy = malloc(len + 1); + if (!copy) - return NULL; + return NULL; strncpy(copy, ptr, len); copy[len] = '\0'; return copy; @@ -71,12 +71,12 @@ ProcSELinuxQueryVersion(ClientPtr client) rep.server_major = SELINUX_MAJOR_VERSION; rep.server_minor = SELINUX_MINOR_VERSION; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swaps(&rep.server_major); - swaps(&rep.server_minor); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swaps(&rep.server_major); + swaps(&rep.server_minor); } - WriteToClient(client, sizeof(rep), (char *)&rep); + WriteToClient(client, sizeof(rep), (char *) &rep); return Success; } @@ -88,9 +88,9 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid) int len = 0; if (sid) { - if (avc_sid_to_context_raw(sid, &ctx) < 0) - return BadValue; - len = strlen(ctx) + 1; + if (avc_sid_to_context_raw(sid, &ctx) < 0) + return BadValue; + len = strlen(ctx) + 1; } rep.type = X_Reply; @@ -99,12 +99,12 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid) rep.context_len = len; if (client->swapped) { - swapl(&rep.length); - swaps(&rep.sequenceNumber); - swapl(&rep.context_len); + swapl(&rep.length); + swaps(&rep.sequenceNumber); + swapl(&rep.context_len); } - WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep); + WriteToClient(client, sizeof(SELinuxGetContextReply), (char *) &rep); WriteToClient(client, len, ctx); freecon(ctx); return Success; @@ -123,20 +123,20 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset) REQUEST_FIXED_SIZE(SELinuxSetCreateContextReq, stuff->context_len); if (stuff->context_len > 0) { - ctx = SELinuxCopyContext((char *)(stuff + 1), stuff->context_len); - if (!ctx) - return BadAlloc; + ctx = SELinuxCopyContext((char *) (stuff + 1), stuff->context_len); + if (!ctx) + return BadAlloc; } ptr = dixLookupPrivate(privPtr, subjectKey); - pSid = (security_id_t *)(ptr + offset); + pSid = (security_id_t *) (ptr + offset); *pSid = NULL; rc = Success; if (stuff->context_len > 0) { - if (security_check_context_raw(ctx) < 0 || - avc_context_to_sid_raw(ctx, pSid) < 0) - rc = BadValue; + if (security_check_context_raw(ctx) < 0 || + avc_context_to_sid_raw(ctx, pSid) < 0) + rc = BadValue; } free(ctx); @@ -152,11 +152,11 @@ ProcSELinuxGetCreateContext(ClientPtr client, unsigned offset) REQUEST_SIZE_MATCH(SELinuxGetCreateContextReq); if (offset == CTX_DEV) - ptr = dixLookupPrivate(&serverClient->devPrivates, subjectKey); + ptr = dixLookupPrivate(&serverClient->devPrivates, subjectKey); else - ptr = dixLookupPrivate(&client->devPrivates, subjectKey); + ptr = dixLookupPrivate(&client->devPrivates, subjectKey); - pSid = (security_id_t *)(ptr + offset); + pSid = (security_id_t *) (ptr + offset); return SELinuxSendContextReply(client, *pSid); } @@ -174,19 +174,19 @@ ProcSELinuxSetDeviceContext(ClientPtr client) REQUEST_FIXED_SIZE(SELinuxSetContextReq, stuff->context_len); if (stuff->context_len < 1) - return BadLength; - ctx = SELinuxCopyContext((char *)(stuff + 1), stuff->context_len); + return BadLength; + ctx = SELinuxCopyContext((char *) (stuff + 1), stuff->context_len); if (!ctx) - return BadAlloc; + return BadAlloc; rc = dixLookupDevice(&dev, stuff->id, client, DixManageAccess); if (rc != Success) - goto out; + goto out; if (security_check_context_raw(ctx) < 0 || - avc_context_to_sid_raw(ctx, &sid) < 0) { - rc = BadValue; - goto out; + avc_context_to_sid_raw(ctx, &sid) < 0) { + rc = BadValue; + goto out; } subj = dixLookupPrivate(&dev->devPrivates, subjectKey); @@ -195,7 +195,7 @@ ProcSELinuxSetDeviceContext(ClientPtr client) obj->sid = sid; rc = Success; -out: + out: free(ctx); return rc; } @@ -212,7 +212,7 @@ ProcSELinuxGetDeviceContext(ClientPtr client) rc = dixLookupDevice(&dev, stuff->id, client, DixGetAttrAccess); if (rc != Success) - return rc; + return rc; subj = dixLookupPrivate(&dev->devPrivates, subjectKey); return SELinuxSendContextReply(client, subj->sid); @@ -231,12 +231,12 @@ ProcSELinuxGetDrawableContext(ClientPtr client) rc = dixLookupDrawable(&pDraw, stuff->id, client, 0, DixGetAttrAccess); if (rc != Success) - return rc; + return rc; if (pDraw->type == DRAWABLE_PIXMAP) - privatePtr = &((PixmapPtr)pDraw)->devPrivates; + privatePtr = &((PixmapPtr) pDraw)->devPrivates; else - privatePtr = &((WindowPtr)pDraw)->devPrivates; + privatePtr = &((WindowPtr) pDraw)->devPrivates; obj = dixLookupPrivate(privatePtr, objectKey); return SELinuxSendContextReply(client, obj->sid); @@ -255,12 +255,12 @@ ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey) rc = dixLookupWindow(&pWin, stuff->window, client, DixGetPropAccess); if (rc != Success) - return rc; + return rc; rc = dixLookupProperty(&pProp, pWin, stuff->property, client, - DixGetAttrAccess); + DixGetAttrAccess); if (rc != Success) - return rc; + return rc; obj = dixLookupPrivate(&pProp->devPrivates, privKey); return SELinuxSendContextReply(client, obj->sid); @@ -278,7 +278,7 @@ ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey) rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess); if (rc != Success) - return rc; + return rc; obj = dixLookupPrivate(&pSel->devPrivates, privKey); return SELinuxSendContextReply(client, obj->sid); @@ -296,23 +296,23 @@ ProcSELinuxGetClientContext(ClientPtr client) rc = dixLookupClient(&target, stuff->id, client, DixGetAttrAccess); if (rc != Success) - return rc; + return rc; subj = dixLookupPrivate(&target->devPrivates, subjectKey); return SELinuxSendContextReply(client, subj->sid); } static int -SELinuxPopulateItem(SELinuxListItemRec *i, PrivateRec **privPtr, CARD32 id, - int *size) +SELinuxPopulateItem(SELinuxListItemRec * i, PrivateRec ** privPtr, CARD32 id, + int *size) { SELinuxObjectRec *obj = dixLookupPrivate(privPtr, objectKey); SELinuxObjectRec *data = dixLookupPrivate(privPtr, dataKey); if (avc_sid_to_context_raw(obj->sid, &i->octx) < 0) - return BadValue; + return BadValue; if (avc_sid_to_context_raw(data->sid, &i->dctx) < 0) - return BadValue; + return BadValue; i->id = id; i->octx_len = bytes_to_int32(strlen(i->octx) + 1); @@ -323,19 +323,20 @@ SELinuxPopulateItem(SELinuxListItemRec *i, PrivateRec **privPtr, CARD32 id, } static void -SELinuxFreeItems(SELinuxListItemRec *items, int count) +SELinuxFreeItems(SELinuxListItemRec * items, int count) { int k; + for (k = 0; k < count; k++) { - freecon(items[k].octx); - freecon(items[k].dctx); + freecon(items[k].octx); + freecon(items[k].dctx); } free(items); } static int -SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items, - int size, int count) +SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items, + int size, int count) { int rc, k, pos = 0; SELinuxListItemsReply rep; @@ -343,31 +344,31 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items, buf = calloc(size, sizeof(CARD32)); if (size && !buf) { - rc = BadAlloc; - goto out; + rc = BadAlloc; + goto out; } /* Fill in the buffer */ for (k = 0; k < count; k++) { - buf[pos] = items[k].id; - if (client->swapped) - swapl(buf + pos); - pos++; - - buf[pos] = items[k].octx_len * 4; - if (client->swapped) - swapl(buf + pos); - pos++; - - buf[pos] = items[k].dctx_len * 4; - if (client->swapped) - swapl(buf + pos); - pos++; - - memcpy((char *)(buf + pos), items[k].octx, strlen(items[k].octx) + 1); - pos += items[k].octx_len; - memcpy((char *)(buf + pos), items[k].dctx, strlen(items[k].dctx) + 1); - pos += items[k].dctx_len; + buf[pos] = items[k].id; + if (client->swapped) + swapl(buf + pos); + pos++; + + buf[pos] = items[k].octx_len * 4; + if (client->swapped) + swapl(buf + pos); + pos++; + + buf[pos] = items[k].dctx_len * 4; + if (client->swapped) + swapl(buf + pos); + pos++; + + memcpy((char *) (buf + pos), items[k].octx, strlen(items[k].octx) + 1); + pos += items[k].octx_len; + memcpy((char *) (buf + pos), items[k].dctx, strlen(items[k].dctx) + 1); + pos += items[k].dctx_len; } /* Send reply to client */ @@ -377,18 +378,18 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items, rep.count = count; if (client->swapped) { - swapl(&rep.length); - swaps(&rep.sequenceNumber); - swapl(&rep.count); + swapl(&rep.length); + swaps(&rep.sequenceNumber); + swapl(&rep.count); } - WriteToClient(client, sizeof(SELinuxListItemsReply), (char *)&rep); - WriteToClient(client, size * 4, (char *)buf); + WriteToClient(client, sizeof(SELinuxListItemsReply), (char *) &rep); + WriteToClient(client, size * 4, (char *) buf); /* Free stuff and return */ rc = Success; free(buf); -out: + out: SELinuxFreeItems(items, count); return rc; } @@ -407,27 +408,27 @@ ProcSELinuxListProperties(ClientPtr client) rc = dixLookupWindow(&pWin, stuff->id, client, DixListPropAccess); if (rc != Success) - return rc; + return rc; /* Count the number of properties and allocate items */ count = 0; for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) - count++; + count++; items = calloc(count, sizeof(SELinuxListItemRec)); if (count && !items) - return BadAlloc; + return BadAlloc; /* Fill in the items and calculate size */ i = 0; size = 0; for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) { - id = pProp->propertyName; - rc = SELinuxPopulateItem(items + i, &pProp->devPrivates, id, &size); - if (rc != Success) { - SELinuxFreeItems(items, count); - return rc; - } - i++; + id = pProp->propertyName; + rc = SELinuxPopulateItem(items + i, &pProp->devPrivates, id, &size); + if (rc != Success) { + SELinuxFreeItems(items, count); + return rc; + } + i++; } return SELinuxSendItemsToClient(client, items, size, count); @@ -446,22 +447,22 @@ ProcSELinuxListSelections(ClientPtr client) /* Count the number of selections and allocate items */ count = 0; for (pSel = CurrentSelections; pSel; pSel = pSel->next) - count++; + count++; items = calloc(count, sizeof(SELinuxListItemRec)); if (count && !items) - return BadAlloc; + return BadAlloc; /* Fill in the items and calculate size */ i = 0; size = 0; for (pSel = CurrentSelections; pSel; pSel = pSel->next) { - id = pSel->selection; - rc = SELinuxPopulateItem(items + i, &pSel->devPrivates, id, &size); - if (rc != Success) { - SELinuxFreeItems(items, count); - return rc; - } - i++; + id = pSel->selection; + rc = SELinuxPopulateItem(items + i, &pSel->devPrivates, id, &size); + if (rc != Success) { + SELinuxFreeItems(items, count); + return rc; + } + i++; } return SELinuxSendItemsToClient(client, items, size, count); @@ -473,53 +474,53 @@ ProcSELinuxDispatch(ClientPtr client) REQUEST(xReq); switch (stuff->data) { case X_SELinuxQueryVersion: - return ProcSELinuxQueryVersion(client); + return ProcSELinuxQueryVersion(client); case X_SELinuxSetDeviceCreateContext: - return ProcSELinuxSetCreateContext(client, CTX_DEV); + return ProcSELinuxSetCreateContext(client, CTX_DEV); case X_SELinuxGetDeviceCreateContext: - return ProcSELinuxGetCreateContext(client, CTX_DEV); + return ProcSELinuxGetCreateContext(client, CTX_DEV); case X_SELinuxSetDeviceContext: - return ProcSELinuxSetDeviceContext(client); + return ProcSELinuxSetDeviceContext(client); case X_SELinuxGetDeviceContext: - return ProcSELinuxGetDeviceContext(client); + return ProcSELinuxGetDeviceContext(client); case X_SELinuxSetDrawableCreateContext: - return ProcSELinuxSetCreateContext(client, CTX_WIN); + return ProcSELinuxSetCreateContext(client, CTX_WIN); case X_SELinuxGetDrawableCreateContext: - return ProcSELinuxGetCreateContext(client, CTX_WIN); + return ProcSELinuxGetCreateContext(client, CTX_WIN); case X_SELinuxGetDrawableContext: - return ProcSELinuxGetDrawableContext(client); + return ProcSELinuxGetDrawableContext(client); case X_SELinuxSetPropertyCreateContext: - return ProcSELinuxSetCreateContext(client, CTX_PRP); + return ProcSELinuxSetCreateContext(client, CTX_PRP); case X_SELinuxGetPropertyCreateContext: - return ProcSELinuxGetCreateContext(client, CTX_PRP); + return ProcSELinuxGetCreateContext(client, CTX_PRP); case X_SELinuxSetPropertyUseContext: - return ProcSELinuxSetCreateContext(client, USE_PRP); + return ProcSELinuxSetCreateContext(client, USE_PRP); case X_SELinuxGetPropertyUseContext: - return ProcSELinuxGetCreateContext(client, USE_PRP); + return ProcSELinuxGetCreateContext(client, USE_PRP); case X_SELinuxGetPropertyContext: - return ProcSELinuxGetPropertyContext(client, objectKey); + return ProcSELinuxGetPropertyContext(client, objectKey); case X_SELinuxGetPropertyDataContext: - return ProcSELinuxGetPropertyContext(client, dataKey); + return ProcSELinuxGetPropertyContext(client, dataKey); case X_SELinuxListProperties: - return ProcSELinuxListProperties(client); + return ProcSELinuxListProperties(client); case X_SELinuxSetSelectionCreateContext: - return ProcSELinuxSetCreateContext(client, CTX_SEL); + return ProcSELinuxSetCreateContext(client, CTX_SEL); case X_SELinuxGetSelectionCreateContext: - return ProcSELinuxGetCreateContext(client, CTX_SEL); + return ProcSELinuxGetCreateContext(client, CTX_SEL); case X_SELinuxSetSelectionUseContext: - return ProcSELinuxSetCreateContext(client, USE_SEL); + return ProcSELinuxSetCreateContext(client, USE_SEL); case X_SELinuxGetSelectionUseContext: - return ProcSELinuxGetCreateContext(client, USE_SEL); + return ProcSELinuxGetCreateContext(client, USE_SEL); case X_SELinuxGetSelectionContext: - return ProcSELinuxGetSelectionContext(client, objectKey); + return ProcSELinuxGetSelectionContext(client, objectKey); case X_SELinuxGetSelectionDataContext: - return ProcSELinuxGetSelectionContext(client, dataKey); + return ProcSELinuxGetSelectionContext(client, dataKey); case X_SELinuxListSelections: - return ProcSELinuxListSelections(client); + return ProcSELinuxListSelections(client); case X_SELinuxGetClientContext: - return ProcSELinuxGetClientContext(client); + return ProcSELinuxGetClientContext(client); default: - return BadRequest; + return BadRequest; } } @@ -620,63 +621,62 @@ SProcSELinuxDispatch(ClientPtr client) switch (stuff->data) { case X_SELinuxQueryVersion: - return SProcSELinuxQueryVersion(client); + return SProcSELinuxQueryVersion(client); case X_SELinuxSetDeviceCreateContext: - return SProcSELinuxSetCreateContext(client, CTX_DEV); + return SProcSELinuxSetCreateContext(client, CTX_DEV); case X_SELinuxGetDeviceCreateContext: - return ProcSELinuxGetCreateContext(client, CTX_DEV); + return ProcSELinuxGetCreateContext(client, CTX_DEV); case X_SELinuxSetDeviceContext: - return SProcSELinuxSetDeviceContext(client); + return SProcSELinuxSetDeviceContext(client); case X_SELinuxGetDeviceContext: - return SProcSELinuxGetDeviceContext(client); + return SProcSELinuxGetDeviceContext(client); case X_SELinuxSetDrawableCreateContext: - return SProcSELinuxSetCreateContext(client, CTX_WIN); + return SProcSELinuxSetCreateContext(client, CTX_WIN); case X_SELinuxGetDrawableCreateContext: - return ProcSELinuxGetCreateContext(client, CTX_WIN); + return ProcSELinuxGetCreateContext(client, CTX_WIN); case X_SELinuxGetDrawableContext: - return SProcSELinuxGetDrawableContext(client); + return SProcSELinuxGetDrawableContext(client); case X_SELinuxSetPropertyCreateContext: - return SProcSELinuxSetCreateContext(client, CTX_PRP); + return SProcSELinuxSetCreateContext(client, CTX_PRP); case X_SELinuxGetPropertyCreateContext: - return ProcSELinuxGetCreateContext(client, CTX_PRP); + return ProcSELinuxGetCreateContext(client, CTX_PRP); case X_SELinuxSetPropertyUseContext: - return SProcSELinuxSetCreateContext(client, USE_PRP); + return SProcSELinuxSetCreateContext(client, USE_PRP); case X_SELinuxGetPropertyUseContext: - return ProcSELinuxGetCreateContext(client, USE_PRP); + return ProcSELinuxGetCreateContext(client, USE_PRP); case X_SELinuxGetPropertyContext: - return SProcSELinuxGetPropertyContext(client, objectKey); + return SProcSELinuxGetPropertyContext(client, objectKey); case X_SELinuxGetPropertyDataContext: - return SProcSELinuxGetPropertyContext(client, dataKey); + return SProcSELinuxGetPropertyContext(client, dataKey); case X_SELinuxListProperties: - return SProcSELinuxListProperties(client); + return SProcSELinuxListProperties(client); case X_SELinuxSetSelectionCreateContext: - return SProcSELinuxSetCreateContext(client, CTX_SEL); + return SProcSELinuxSetCreateContext(client, CTX_SEL); case X_SELinuxGetSelectionCreateContext: - return ProcSELinuxGetCreateContext(client, CTX_SEL); + return ProcSELinuxGetCreateContext(client, CTX_SEL); case X_SELinuxSetSelectionUseContext: - return SProcSELinuxSetCreateContext(client, USE_SEL); + return SProcSELinuxSetCreateContext(client, USE_SEL); case X_SELinuxGetSelectionUseContext: - return ProcSELinuxGetCreateContext(client, USE_SEL); + return ProcSELinuxGetCreateContext(client, USE_SEL); case X_SELinuxGetSelectionContext: - return SProcSELinuxGetSelectionContext(client, objectKey); + return SProcSELinuxGetSelectionContext(client, objectKey); case X_SELinuxGetSelectionDataContext: - return SProcSELinuxGetSelectionContext(client, dataKey); + return SProcSELinuxGetSelectionContext(client, dataKey); case X_SELinuxListSelections: - return ProcSELinuxListSelections(client); + return ProcSELinuxListSelections(client); case X_SELinuxGetClientContext: - return SProcSELinuxGetClientContext(client); + return SProcSELinuxGetClientContext(client); default: - return BadRequest; + return BadRequest; } } - /* * Extension Setup / Teardown */ static void -SELinuxResetProc(ExtensionEntry *extEntry) +SELinuxResetProc(ExtensionEntry * extEntry) { SELinuxFlaskReset(); SELinuxLabelReset(); @@ -689,15 +689,15 @@ SELinuxExtensionInit(INITARGS) /* Check SELinux mode on system, configuration file, and boolean */ if (!is_selinux_enabled()) { - LogMessage(X_INFO, "SELinux: Disabled on system\n"); - return; + LogMessage(X_INFO, "SELinux: Disabled on system\n"); + return; } if (selinuxEnforcingState == SELINUX_MODE_DISABLED) { - LogMessage(X_INFO, "SELinux: Disabled in configuration file\n"); - return; + LogMessage(X_INFO, "SELinux: Disabled in configuration file\n"); + return; } if (!security_get_boolean_active("xserver_object_manager")) { - LogMessage(X_INFO, "SELinux: Disabled by boolean\n"); + LogMessage(X_INFO, "SELinux: Disabled by boolean\n"); return; } @@ -707,9 +707,9 @@ SELinuxExtensionInit(INITARGS) /* Add extension to server */ extEntry = AddExtension(SELINUX_EXTENSION_NAME, - SELinuxNumberEvents, SELinuxNumberErrors, - ProcSELinuxDispatch, SProcSELinuxDispatch, - SELinuxResetProc, StandardMinorOpcode); + SELinuxNumberEvents, SELinuxNumberErrors, + ProcSELinuxDispatch, SProcSELinuxDispatch, + SELinuxResetProc, StandardMinorOpcode); AddExtensionAlias("Flask", extEntry); } -- cgit v1.2.3