diff options
Diffstat (limited to 'xserver/xfixes')
-rw-r--r-- | xserver/xfixes/Makefile.in | 70 | ||||
-rw-r--r-- | xserver/xfixes/cursor.c | 97 | ||||
-rw-r--r-- | xserver/xfixes/region.c | 81 | ||||
-rw-r--r-- | xserver/xfixes/saveset.c | 11 | ||||
-rw-r--r-- | xserver/xfixes/select.c | 22 | ||||
-rw-r--r-- | xserver/xfixes/xfixes.c | 12 | ||||
-rw-r--r-- | xserver/xfixes/xfixesint.h | 7 |
7 files changed, 172 insertions, 128 deletions
diff --git a/xserver/xfixes/Makefile.in b/xserver/xfixes/Makefile.in index 9e3822a5f..ddb3b888c 100644 --- a/xserver/xfixes/Makefile.in +++ b/xserver/xfixes/Makefile.in @@ -112,8 +112,6 @@ BSD_KQUEUE_APM_FALSE = @BSD_KQUEUE_APM_FALSE@ BSD_KQUEUE_APM_TRUE = @BSD_KQUEUE_APM_TRUE@ BUILDDOCS_FALSE = @BUILDDOCS_FALSE@ BUILDDOCS_TRUE = @BUILDDOCS_TRUE@ -BUILD_DARWIN_FALSE = @BUILD_DARWIN_FALSE@ -BUILD_DARWIN_TRUE = @BUILD_DARWIN_TRUE@ BUILD_DATE = @BUILD_DATE@ BUILD_IOPORT_FALSE = @BUILD_IOPORT_FALSE@ BUILD_IOPORT_TRUE = @BUILD_IOPORT_TRUE@ @@ -185,6 +183,10 @@ DMX_FALSE = @DMX_FALSE@ DMX_TRUE = @DMX_TRUE@ DPMSExtension_FALSE = @DPMSExtension_FALSE@ DPMSExtension_TRUE = @DPMSExtension_TRUE@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRI2_FALSE = @DRI2_FALSE@ +DRI2_TRUE = @DRI2_TRUE@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ @@ -214,7 +216,7 @@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@ FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_FALSE = @GLX_FALSE@ GLX_TRUE = @GLX_TRUE@ @@ -228,8 +230,8 @@ HAVE_AGL_FRAMEWORK_FALSE = @HAVE_AGL_FRAMEWORK_FALSE@ HAVE_AGL_FRAMEWORK_TRUE = @HAVE_AGL_FRAMEWORK_TRUE@ HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@ HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@ -HAVE_X_PLUGIN_FALSE = @HAVE_X_PLUGIN_FALSE@ -HAVE_X_PLUGIN_TRUE = @HAVE_X_PLUGIN_TRUE@ +HAVE_XPLUGIN_FALSE = @HAVE_XPLUGIN_FALSE@ +HAVE_XPLUGIN_TRUE = @HAVE_XPLUGIN_TRUE@ HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@ HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@ HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@ @@ -270,6 +272,9 @@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KDRIVE_TRUE = @KDRIVE_TRUE@ +LAUNCHD = @LAUNCHD@ +LAUNCHD_FALSE = @LAUNCHD_FALSE@ +LAUNCHD_TRUE = @LAUNCHD_TRUE@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -324,6 +329,8 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -331,12 +338,11 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PERL = @PERL@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ -PLIST_VENDOR_WEB = @PLIST_VENDOR_WEB@ -PLIST_VERSION_STRING = @PLIST_VERSION_STRING@ PPC_VIDEO_FALSE = @PPC_VIDEO_FALSE@ PPC_VIDEO_TRUE = @PPC_VIDEO_TRUE@ PROJECTROOT = @PROJECTROOT@ @@ -348,13 +354,12 @@ RECORD_FALSE = @RECORD_FALSE@ RECORD_TRUE = @RECORD_TRUE@ RES_FALSE = @RES_FALSE@ RES_TRUE = @RES_TRUE@ -RGB_DB = @RGB_DB@ SCREENSAVER_FALSE = @SCREENSAVER_FALSE@ SCREENSAVER_TRUE = @SCREENSAVER_TRUE@ SECURE_RPC_FALSE = @SECURE_RPC_FALSE@ SECURE_RPC_TRUE = @SECURE_RPC_TRUE@ SED = @SED@ -SERVERCONFIGdir = @SERVERCONFIGdir@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SGI_VIDEO_FALSE = @SGI_VIDEO_FALSE@ SGI_VIDEO_TRUE = @SGI_VIDEO_TRUE@ @@ -370,20 +375,21 @@ SPARC64_VIDEO_TRUE = @SPARC64_VIDEO_TRUE@ STRIP = @STRIP@ SUN_KBD_MODE_FALSE = @SUN_KBD_MODE_FALSE@ SUN_KBD_MODE_TRUE = @SUN_KBD_MODE_TRUE@ -SYS_LIBS = @SYS_LIBS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_FALSE = @TSLIB_FALSE@ TSLIB_LIBS = @TSLIB_LIBS@ TSLIB_TRUE = @TSLIB_TRUE@ USE_CURSES_FALSE = @USE_CURSES_FALSE@ USE_CURSES_TRUE = @USE_CURSES_TRUE@ -USE_RGB_BUILTIN_FALSE = @USE_RGB_BUILTIN_FALSE@ -USE_RGB_BUILTIN_TRUE = @USE_RGB_BUILTIN_TRUE@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ VENDOR_NAME = @VENDOR_NAME@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ +X11APP_ARCHS = @X11APP_ARCHS@ +X11APP_FALSE = @X11APP_FALSE@ +X11APP_TRUE = @X11APP_TRUE@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XACE_FALSE = @XACE_FALSE@ @@ -400,18 +406,22 @@ XDMCP_LIBS = @XDMCP_LIBS@ XDMCP_TRUE = @XDMCP_TRUE@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ -XEGLMODULES_LIBS = @XEGLMODULES_LIBS@ XEGL_FALSE = @XEGL_FALSE@ XEGL_LIBS = @XEGL_LIBS@ +XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ XEGL_TRUE = @XEGL_TRUE@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ XEPHYR_FALSE = @XEPHYR_FALSE@ +XEPHYR_HAS_DRI_FALSE = @XEPHYR_HAS_DRI_FALSE@ +XEPHYR_HAS_DRI_TRUE = @XEPHYR_HAS_DRI_TRUE@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XEPHYR_TRUE = @XEPHYR_TRUE@ -XERRORDB_PATH = @XERRORDB_PATH@ XEVIE_FALSE = @XEVIE_FALSE@ XEVIE_TRUE = @XEVIE_TRUE@ XF86BIGFONT_FALSE = @XF86BIGFONT_FALSE@ @@ -435,10 +445,12 @@ XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ XGLX_FALSE = @XGLX_FALSE@ XGLX_LIBS = @XGLX_LIBS@ +XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ XGLX_TRUE = @XGLX_TRUE@ XGL_FALSE = @XGL_FALSE@ XGL_LIBS = @XGL_LIBS@ XGL_MODULE_PATH = @XGL_MODULE_PATH@ +XGL_SYS_LIBS = @XGL_SYS_LIBS@ XGL_TRUE = @XGL_TRUE@ XINERAMA_FALSE = @XINERAMA_FALSE@ XINERAMA_TRUE = @XINERAMA_TRUE@ @@ -452,19 +464,18 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_FALSE = @XNEST_FALSE@ XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XNEST_TRUE = @XNEST_TRUE@ XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ -XORG_BUS_FREEBSDPCI_FALSE = @XORG_BUS_FREEBSDPCI_FALSE@ -XORG_BUS_FREEBSDPCI_TRUE = @XORG_BUS_FREEBSDPCI_TRUE@ +XORG_BUS_BSDPCI_FALSE = @XORG_BUS_BSDPCI_FALSE@ +XORG_BUS_BSDPCI_TRUE = @XORG_BUS_BSDPCI_TRUE@ XORG_BUS_IX86PCI_FALSE = @XORG_BUS_IX86PCI_FALSE@ XORG_BUS_IX86PCI_TRUE = @XORG_BUS_IX86PCI_TRUE@ XORG_BUS_LINUXPCI_FALSE = @XORG_BUS_LINUXPCI_FALSE@ XORG_BUS_LINUXPCI_TRUE = @XORG_BUS_LINUXPCI_TRUE@ -XORG_BUS_NETBSDPCI_FALSE = @XORG_BUS_NETBSDPCI_FALSE@ -XORG_BUS_NETBSDPCI_TRUE = @XORG_BUS_NETBSDPCI_TRUE@ XORG_BUS_PPCPCI_FALSE = @XORG_BUS_PPCPCI_FALSE@ XORG_BUS_PPCPCI_TRUE = @XORG_BUS_PPCPCI_TRUE@ XORG_BUS_SPARCPCI_FALSE = @XORG_BUS_SPARCPCI_FALSE@ @@ -472,7 +483,6 @@ XORG_BUS_SPARCPCI_TRUE = @XORG_BUS_SPARCPCI_TRUE@ XORG_BUS_SPARC_FALSE = @XORG_BUS_SPARC_FALSE@ XORG_BUS_SPARC_TRUE = @XORG_BUS_SPARC_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ -XORG_CORE_LIBS = @XORG_CORE_LIBS@ XORG_FALSE = @XORG_FALSE@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -482,23 +492,31 @@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ XORG_TRUE = @XORG_TRUE@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_FALSE = @XPRINT_FALSE@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XPRINT_TRUE = @XPRINT_TRUE@ XP_USE_FREETYPE_FALSE = @XP_USE_FREETYPE_FALSE@ XP_USE_FREETYPE_TRUE = @XP_USE_FREETYPE_TRUE@ XQUARTZ_FALSE = @XQUARTZ_FALSE@ XQUARTZ_TRUE = @XQUARTZ_TRUE@ +XREGISTRY_FALSE = @XREGISTRY_FALSE@ +XREGISTRY_TRUE = @XREGISTRY_TRUE@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDLSERVER_FALSE = @XSDLSERVER_FALSE@ XSDLSERVER_TRUE = @XSDLSERVER_TRUE@ XSDL_INCS = @XSDL_INCS@ XSDL_LIBS = @XSDL_LIBS@ +XSELINUX_FALSE = @XSELINUX_FALSE@ +XSELINUX_TRUE = @XSELINUX_TRUE@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ @@ -506,12 +524,14 @@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_DTRACE_FALSE = @XSERVER_DTRACE_FALSE@ XSERVER_DTRACE_TRUE = @XSERVER_DTRACE_TRUE@ XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XTRAP_FALSE = @XTRAP_FALSE@ XTRAP_TRUE = @XTRAP_TRUE@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_FALSE = @XVFB_FALSE@ XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XVFB_TRUE = @XVFB_TRUE@ XVMC_FALSE = @XVMC_FALSE@ XVMC_TRUE = @XVMC_TRUE@ @@ -536,7 +556,7 @@ XWIN_PRIMARYFB_TRUE = @XWIN_PRIMARYFB_TRUE@ XWIN_RANDR_FALSE = @XWIN_RANDR_FALSE@ XWIN_RANDR_TRUE = @XWIN_RANDR_TRUE@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ -XWIN_SYSTEM_LIBS = @XWIN_SYSTEM_LIBS@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ XWIN_TRUE = @XWIN_TRUE@ XWIN_XV_FALSE = @XWIN_XV_FALSE@ XWIN_XV_TRUE = @XWIN_XV_TRUE@ @@ -544,6 +564,11 @@ X_PRIVSEP_FALSE = @X_PRIVSEP_FALSE@ X_PRIVSEP_TRUE = @X_PRIVSEP_TRUE@ YACC = @YACC@ __XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ ac_ct_CC = @ac_ct_CC@ @@ -586,6 +611,7 @@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +launchagentsdir = @launchagentsdir@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ diff --git a/xserver/xfixes/cursor.c b/xserver/xfixes/cursor.c index 6596578f5..d51251f19 100644 --- a/xserver/xfixes/cursor.c +++ b/xserver/xfixes/cursor.c @@ -1,6 +1,4 @@ /* - * $Id: cursor.c,v 1.1 2006/11/26 18:15:08 matthieu Exp $ - * * Copyright © 2006 Sun Microsystems * * Permission to use, copy, modify, distribute, and sell this software and its @@ -53,12 +51,12 @@ #include "servermd.h" #include "inputstr.h" #include "windowstr.h" +#include "xace.h" static RESTYPE CursorClientType; static RESTYPE CursorHideCountType; static RESTYPE CursorWindowType; -static int CursorScreenPrivateIndex = -1; -static int CursorGeneration; +static DevPrivateKey CursorScreenPrivateKey = &CursorScreenPrivateKey; static CursorPtr CursorCurrent; static CursorPtr pInvisibleCursor = NULL; @@ -115,9 +113,9 @@ typedef struct _CursorScreen { CursorHideCountPtr pCursorHideCounts; } CursorScreenRec, *CursorScreenPtr; -#define GetCursorScreen(s) ((CursorScreenPtr) ((s)->devPrivates[CursorScreenPrivateIndex].ptr)) -#define GetCursorScreenIfSet(s) ((CursorScreenPrivateIndex != -1) ? GetCursorScreen(s) : NULL) -#define SetCursorScreen(s,p) ((s)->devPrivates[CursorScreenPrivateIndex].ptr = (pointer) (p)) +#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey)) +#define GetCursorScreenIfSet(s) GetCursorScreen(s) +#define SetCursorScreen(s,p) dixSetPrivate(&(s)->devPrivates, CursorScreenPrivateKey, p) #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) @@ -143,7 +141,8 @@ CursorDisplayCursor (ScreenPtr pScreen, CursorCurrent = pCursor; for (e = cursorEvents; e; e = e->next) { - if (e->eventMask & XFixesDisplayCursorNotifyMask) + if ((e->eventMask & XFixesDisplayCursorNotifyMask) && + !e->pClient->clientGone) { xXFixesCursorNotifyEvent ev; ev.type = XFixesEventBase + XFixesCursorNotify; @@ -172,8 +171,6 @@ CursorCloseScreen (int index, ScreenPtr pScreen) deleteCursorHideCountsForScreen(pScreen); ret = (*pScreen->CloseScreen) (index, pScreen); xfree (cs); - if (index == 0) - CursorScreenPrivateIndex = -1; return ret; } @@ -239,12 +236,12 @@ ProcXFixesSelectCursorInput (ClientPtr client) { REQUEST (xXFixesSelectCursorInputReq); WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); + if (rc != Success) + return rc; if (stuff->eventMask & ~CursorAllEvents) { client->errorValue = stuff->eventMask; @@ -347,14 +344,16 @@ ProcXFixesGetCursorImage (ClientPtr client) xXFixesGetCursorImageReply *rep; CursorPtr pCursor; CARD32 *image; - int npixels; - int width, height; - int x, y; + int npixels, width, height, rc, x, y; REQUEST_SIZE_MATCH(xXFixesGetCursorImageReq); pCursor = CursorCurrent; if (!pCursor) return BadCursor; + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR, + pCursor, RT_NONE, NULL, DixReadAccess); + if (rc != Success) + return rc; GetSpritePosition (&x, &y); width = pCursor->bits->width; height = pCursor->bits->height; @@ -415,7 +414,7 @@ ProcXFixesSetCursorName (ClientPtr client) Atom atom; REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); - VERIFY_CURSOR(pCursor, stuff->cursor, client, SecurityWriteAccess); + VERIFY_CURSOR(pCursor, stuff->cursor, client, DixSetAttrAccess); tchar = (char *) &stuff[1]; atom = MakeAtom (tchar, stuff->nbytes, TRUE); if (atom == BAD_RESOURCE) @@ -448,7 +447,7 @@ ProcXFixesGetCursorName (ClientPtr client) int len; REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq); - VERIFY_CURSOR(pCursor, stuff->cursor, client, SecurityReadAccess); + VERIFY_CURSOR(pCursor, stuff->cursor, client, DixGetAttrAccess); if (pCursor->name) str = NameForAtom (pCursor->name); else @@ -497,12 +496,16 @@ ProcXFixesGetCursorImageAndName (ClientPtr client) char *name; int nbytes, nbytesRound; int width, height; - int x, y; + int rc, x, y; REQUEST_SIZE_MATCH(xXFixesGetCursorImageAndNameReq); pCursor = CursorCurrent; if (!pCursor) return BadCursor; + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR, + pCursor, RT_NONE, NULL, DixReadAccess|DixGetAttrAccess); + if (rc != Success) + return rc; GetSpritePosition (&x, &y); width = pCursor->bits->width; height = pCursor->bits->height; @@ -679,8 +682,10 @@ ProcXFixesChangeCursor (ClientPtr client) REQUEST(xXFixesChangeCursorReq); REQUEST_SIZE_MATCH(xXFixesChangeCursorReq); - VERIFY_CURSOR (pSource, stuff->source, client, SecurityReadAccess); - VERIFY_CURSOR (pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_CURSOR (pSource, stuff->source, client, + DixReadAccess|DixGetAttrAccess); + VERIFY_CURSOR (pDestination, stuff->destination, client, + DixWriteAccess|DixSetAttrAccess); ReplaceCursor (pSource, TestForCursor, (pointer) pDestination); return (client->noClientException); @@ -702,7 +707,8 @@ SProcXFixesChangeCursor (ClientPtr client) static Bool TestForCursorName (CursorPtr pCursor, pointer closure) { - return (pCursor->name == (Atom) closure); + Atom *pName = closure; + return (pCursor->name == *pName); } int @@ -714,11 +720,12 @@ ProcXFixesChangeCursorByName (ClientPtr client) REQUEST(xXFixesChangeCursorByNameReq); REQUEST_FIXED_SIZE(xXFixesChangeCursorByNameReq, stuff->nbytes); - VERIFY_CURSOR(pSource, stuff->source, client, SecurityReadAccess); + VERIFY_CURSOR(pSource, stuff->source, client, + DixReadAccess|DixGetAttrAccess); tchar = (char *) &stuff[1]; name = MakeAtom (tchar, stuff->nbytes, FALSE); if (name) - ReplaceCursor (pSource, TestForCursorName, (pointer) name); + ReplaceCursor (pSource, TestForCursorName, &name); return (client->noClientException); } @@ -842,10 +849,11 @@ ProcXFixesHideCursor (ClientPtr client) REQUEST_SIZE_MATCH (xXFixesHideCursorReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) { + ret = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (ret != Success) { client->errorValue = stuff->window; - return BadWindow; + return (ret == BadValue) ? BadWindow : ret; } /* @@ -863,6 +871,11 @@ ProcXFixesHideCursor (ClientPtr client) * This is the first time this client has hid the cursor * for this screen. */ + ret = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen, + DixHideAccess); + if (ret != Success) + return ret; + ret = createCursorHideCount(client, pWin->drawable.pScreen); if (ret == Success) { @@ -889,14 +902,16 @@ ProcXFixesShowCursor (ClientPtr client) { WindowPtr pWin; CursorHideCountPtr pChc; + int rc; REQUEST(xXFixesShowCursorReq); REQUEST_SIZE_MATCH (xXFixesShowCursorReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) { + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (rc != Success) { client->errorValue = stuff->window; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } /* @@ -908,6 +923,11 @@ ProcXFixesShowCursor (ClientPtr client) return BadMatch; } + rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen, + DixShowAccess); + if (rc != Success) + return rc; + pChc->hideCount--; if (pChc->hideCount <= 0) { FreeResource(pChc->resource, 0); @@ -981,6 +1001,7 @@ createInvisibleCursor (void) CursorPtr pCursor; static unsigned int *psrcbits, *pmaskbits; CursorMetricRec cm; + int rc; psrcbits = (unsigned int *) xalloc(4); pmaskbits = (unsigned int *) xalloc(4); @@ -995,12 +1016,13 @@ createInvisibleCursor (void) cm.xhot = 0; cm.yhot = 0; - pCursor = AllocCursor( + rc = AllocARGBCursor( (unsigned char *)psrcbits, (unsigned char *)pmaskbits, - &cm, + NULL, &cm, 0, 0, 0, - 0, 0, 0); + 0, 0, 0, + &pCursor, serverClient, (XID)0); return pCursor; } @@ -1010,13 +1032,6 @@ XFixesCursorInit (void) { int i; - if (CursorGeneration != serverGeneration) - { - CursorScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (CursorScreenPrivateIndex < 0) - return FALSE; - CursorGeneration = serverGeneration; - } for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; diff --git a/xserver/xfixes/region.c b/xserver/xfixes/region.c index 7c529373a..d90b1e0ff 100644 --- a/xserver/xfixes/region.c +++ b/xserver/xfixes/region.c @@ -1,6 +1,4 @@ /* - * $Id: region.c,v 1.1 2006/11/26 18:15:09 matthieu Exp $ - * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -111,18 +109,18 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client) { RegionPtr pRegion; PixmapPtr pPixmap; + int rc; REQUEST (xXFixesCreateRegionFromBitmapReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq); LEGAL_NEW_RESOURCE (stuff->region, client); - pPixmap = (PixmapPtr) SecurityLookupIDByType (client, stuff->bitmap, - RT_PIXMAP, - SecurityReadAccess); - if (!pPixmap) + rc = dixLookupResource((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP, + client, DixReadAccess); + if (rc != Success) { client->errorValue = stuff->bitmap; - return BadPixmap; + return (rc == BadValue) ? BadPixmap : rc; } if (pPixmap->drawable.depth != 1) return BadMatch; @@ -157,15 +155,17 @@ ProcXFixesCreateRegionFromWindow (ClientPtr client) RegionPtr pRegion; Bool copy = TRUE; WindowPtr pWin; + int rc; REQUEST (xXFixesCreateRegionFromWindowReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq); LEGAL_NEW_RESOURCE (stuff->region, client); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (rc != Success) { client->errorValue = stuff->window; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } switch (stuff->kind) { case WindowRegionBounding: @@ -220,12 +220,15 @@ ProcXFixesCreateRegionFromGC (ClientPtr client) { RegionPtr pRegion, pClip; GCPtr pGC; + int rc; REQUEST (xXFixesCreateRegionFromGCReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq); LEGAL_NEW_RESOURCE (stuff->region, client); - SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityReadAccess); + rc = dixLookupGC(&pGC, stuff->gc, client, DixGetAttrAccess); + if (rc != Success) + return rc; switch (pGC->clientClipType) { case CT_PIXMAP: @@ -273,7 +276,7 @@ ProcXFixesCreateRegionFromPicture (ClientPtr client) REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq); LEGAL_NEW_RESOURCE (stuff->region, client); - VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityReadAccess, + VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess, RenderErrBase + BadPicture); switch (pPicture->clientClipType) { @@ -321,7 +324,7 @@ ProcXFixesDestroyRegion (ClientPtr client) RegionPtr pRegion; REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq); - VERIFY_REGION(pRegion, stuff->region, client, SecurityWriteAccess); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); FreeResource (stuff->region, RT_NONE); return(client->noClientException); } @@ -346,7 +349,7 @@ ProcXFixesSetRegion (ClientPtr client) REQUEST (xXFixesSetRegionReq); REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq); - VERIFY_REGION(pRegion, stuff->region, client, SecurityWriteAccess); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq); if (things & 4) @@ -384,8 +387,8 @@ ProcXFixesCopyRegion (ClientPtr client) RegionPtr pSource, pDestination; REQUEST (xXFixesCopyRegionReq); - VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); if (!REGION_COPY(pScreen, pDestination, pSource)) return BadAlloc; @@ -414,9 +417,9 @@ ProcXFixesCombineRegion (ClientPtr client) REQUEST (xXFixesCombineRegionReq); REQUEST_SIZE_MATCH (xXFixesCombineRegionReq); - VERIFY_REGION(pSource1, stuff->source1, client, SecurityReadAccess); - VERIFY_REGION(pSource2, stuff->source2, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource1, stuff->source1, client, DixReadAccess); + VERIFY_REGION(pSource2, stuff->source2, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); switch (stuff->xfixesReqType) { case X_XFixesUnionRegion: @@ -461,8 +464,8 @@ ProcXFixesInvertRegion (ClientPtr client) REQUEST(xXFixesInvertRegionReq); REQUEST_SIZE_MATCH(xXFixesInvertRegionReq); - VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); /* Compute bounds, limit to 16 bits */ bounds.x1 = stuff->x; @@ -509,7 +512,7 @@ ProcXFixesTranslateRegion (ClientPtr client) REQUEST(xXFixesTranslateRegionReq); REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq); - VERIFY_REGION(pRegion, stuff->region, client, SecurityWriteAccess); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); REGION_TRANSLATE(pScreen, pRegion, stuff->dx, stuff->dy); return (client->noClientException); @@ -536,8 +539,8 @@ ProcXFixesRegionExtents (ClientPtr client) REQUEST(xXFixesRegionExtentsReq); REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq); - VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); REGION_RESET (0, pDestination, REGION_EXTENTS (0, pSource)); @@ -569,7 +572,7 @@ ProcXFixesFetchRegion (ClientPtr client) REQUEST(xXFixesFetchRegionReq); REQUEST_SIZE_MATCH(xXFixesFetchRegionReq); - VERIFY_REGION(pRegion, stuff->region, client, SecurityReadAccess); + VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess); pExtent = REGION_EXTENTS (0, pRegion); pBox = REGION_RECTS (pRegion); @@ -630,11 +633,15 @@ ProcXFixesSetGCClipRegion (ClientPtr client) GCPtr pGC; RegionPtr pRegion; XID vals[2]; + int rc; REQUEST(xXFixesSetGCClipRegionReq); - REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); - SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityWriteAccess); - VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, SecurityReadAccess); + + rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess); + if (rc != Success) + return rc; + + VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess); if (pRegion) { @@ -676,16 +683,18 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client) ScreenPtr pScreen; RegionPtr pRegion; RegionPtr *pDestRegion; + int rc; REQUEST(xXFixesSetWindowShapeRegionReq); REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); - pWin = (WindowPtr) LookupIDByType (stuff->dest, RT_WINDOW); - if (!pWin) + rc = dixLookupResource((pointer *)&pWin, stuff->dest, RT_WINDOW, + client, DixSetAttrAccess); + if (rc != Success) { client->errorValue = stuff->dest; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } - VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, SecurityWriteAccess); + VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess); pScreen = pWin->drawable.pScreen; switch (stuff->destKind) { case ShapeBounding: @@ -775,11 +784,11 @@ ProcXFixesSetPictureClipRegion (ClientPtr client) REQUEST(xXFixesSetPictureClipRegionReq); REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq); - VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess, RenderErrBase + BadPicture); pScreen = pPicture->pDrawable->pScreen; ps = GetPictureScreen (pScreen); - VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, SecurityReadAccess); + VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess); return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin, pRegion); @@ -815,8 +824,8 @@ ProcXFixesExpandRegion (ClientPtr client) int i; REQUEST_SIZE_MATCH (xXFixesExpandRegionReq); - VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); nBoxes = REGION_NUM_RECTS(pSource); pSrc = REGION_RECTS(pSource); diff --git a/xserver/xfixes/saveset.c b/xserver/xfixes/saveset.c index a576430d6..31664ab65 100644 --- a/xserver/xfixes/saveset.c +++ b/xserver/xfixes/saveset.c @@ -1,6 +1,4 @@ /* - * $Id: saveset.c,v 1.1 2006/11/26 18:15:09 matthieu Exp $ - * * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -37,10 +35,9 @@ ProcXFixesChangeSaveSet(ClientPtr client) REQUEST(xXFixesChangeSaveSetReq); REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + result = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); + if (result != Success) + return result; if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) return BadMatch; if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete)) @@ -75,5 +72,5 @@ SProcXFixesChangeSaveSet(ClientPtr client) swaps(&stuff->length, n); swapl(&stuff->window, n); - return ProcXFixesChangeSaveSet(client); + return (*ProcXFixesVector[stuff->xfixesReqType])(client); } diff --git a/xserver/xfixes/select.c b/xserver/xfixes/select.c index 69029015c..12a165fd0 100644 --- a/xserver/xfixes/select.c +++ b/xserver/xfixes/select.c @@ -1,6 +1,4 @@ /* - * $Id: select.c,v 1.1 2006/11/26 18:15:08 matthieu Exp $ - * * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -27,6 +25,7 @@ #endif #include "xfixesint.h" +#include "xace.h" static RESTYPE SelectionClientType, SelectionWindowType; static Bool SelectionCallbackRegistered = FALSE; @@ -78,7 +77,9 @@ XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args) } for (e = selectionEvents; e; e = e->next) { - if (e->selection == selection->selection && (e->eventMask & eventMask)) + if (e->selection == selection->selection && + (e->eventMask & eventMask) && + !e->pClient->clientGone) { xXFixesSelectionNotifyEvent ev; @@ -131,8 +132,13 @@ XFixesSelectSelectionInput (ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask) { + int rc; SelectionEventPtr *prev, e; + rc = XaceHook(XACE_SELECTION_ACCESS, pClient, selection, DixGetAttrAccess); + if (rc != Success) + return rc; + for (prev = &selectionEvents; (e = *prev); prev = &e->next) { if (e->selection == selection && @@ -193,12 +199,12 @@ ProcXFixesSelectSelectionInput (ClientPtr client) { REQUEST (xXFixesSelectSelectionInputReq); WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); + if (rc != Success) + return rc; if (stuff->eventMask & ~SelectionAllEvents) { client->errorValue = stuff->eventMask; @@ -218,7 +224,7 @@ SProcXFixesSelectSelectionInput (ClientPtr client) swapl(&stuff->window, n); swapl(&stuff->selection, n); swapl(&stuff->eventMask, n); - return ProcXFixesSelectSelectionInput(client); + return (*ProcXFixesVector[stuff->xfixesReqType])(client); } void diff --git a/xserver/xfixes/xfixes.c b/xserver/xfixes/xfixes.c index aa30ec000..0db49895e 100644 --- a/xserver/xfixes/xfixes.c +++ b/xserver/xfixes/xfixes.c @@ -1,6 +1,4 @@ /* - * $Id: xfixes.c,v 1.1 2006/11/26 18:15:08 matthieu Exp $ - * * Copyright © 2006 Sun Microsystems * * Permission to use, copy, modify, distribute, and sell this software and its @@ -55,10 +53,10 @@ #define SERVER_XFIXES_MAJOR 4 #define SERVER_XFIXES_MINOR 0 -unsigned char XFixesReqCode; +static unsigned char XFixesReqCode; int XFixesEventBase; int XFixesErrorBase; -int XFixesClientPrivateIndex; +static DevPrivateKey XFixesClientPrivateKey = &XFixesClientPrivateKey; static int ProcXFixesQueryVersion(ClientPtr client) @@ -169,7 +167,7 @@ SProcXFixesQueryVersion(ClientPtr client) return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } -int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { +static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ SProcXFixesQueryVersion, SProcXFixesChangeSaveSet, @@ -241,9 +239,7 @@ XFixesExtensionInit(void) { ExtensionEntry *extEntry; - XFixesClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (XFixesClientPrivateIndex, - sizeof (XFixesClientRec))) + if (!dixRequestPrivate(XFixesClientPrivateKey, sizeof (XFixesClientRec))) return; if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0)) return; diff --git a/xserver/xfixes/xfixesint.h b/xserver/xfixes/xfixesint.h index c8887ef15..33a3205ed 100644 --- a/xserver/xfixes/xfixesint.h +++ b/xserver/xfixes/xfixesint.h @@ -1,6 +1,4 @@ /* - * $Id: xfixesint.h,v 1.1 2006/11/26 18:15:09 matthieu Exp $ - * * Copyright © 2006 Sun Microsystems * * Permission to use, copy, modify, distribute, and sell this software and its @@ -61,19 +59,16 @@ #include "selection.h" #include "xfixes.h" -extern unsigned char XFixesReqCode; extern int XFixesEventBase; -extern int XFixesClientPrivateIndex; typedef struct _XFixesClient { CARD32 major_version; CARD32 minor_version; } XFixesClientRec, *XFixesClientPtr; -#define GetXFixesClient(pClient) ((XFixesClientPtr) (pClient)->devPrivates[XFixesClientPrivateIndex].ptr) +#define GetXFixesClient(pClient) ((XFixesClientPtr)dixLookupPrivate(&(pClient)->devPrivates, XFixesClientPrivateKey)) extern int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr); -extern int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr); /* Initialize extension at server startup time */ |