mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-14 22:40:29 +01:00
Building with -Dxace=false was generating many failures of the form:
../dix/cursor.c: In function ‘AllocARGBCursor’:
../dix/cursor.c:281:10: error: implicit declaration of function
‘XaceHookResourceAccess’; did you mean ‘XaceHookPropertyAccess’?
[-Werror=implicit-function-declaration]
281 | rc = XaceHookResourceAccess(client, cid, X11_RESTYPE_CURSOR,
| ^~~~~~~~~~~~~~~~~~~~~~
| XaceHookPropertyAccess
Fixes: ae3c57333 ("xace: typesafe hook function for XACE_RESOURCE_ACCESS")
Fixes: 9524ffee8 ("xace: typesafe hook function for XACE_DEVICE_ACCESS")
Fixes: 67e468c8b ("xace: typesafe hook function for XACE_SEND_ACCESS")
Fixes: 3dfe00d5e ("xace: typesafe hook function for XACE_RECEIVE_ACCESS")
Fixes: 922b7685d ("xace: typesafe hook function for XACE_CLIENT_ACCESS")
Fixes: 0f6bb23bc ("xace: typesafe hook function for XACE_EXT_ACCESS")
Fixes: 47d6c3ad7 ("xace: typesafe hook function for XACE_SERVER_ACCESS")
Fixes: 51d8bcfc0 ("xace: typesafe hook function for XACE_SCREEN_ACCESS")
Fixes: 305f2d59d ("xace: typesafe hook function for XACE_SCREENSAVER_ACCESS")
Fixes: 591d95c79 ("xace: typesafe hook function for XACE_AUTH_AVAIL")
Fixes: facdaae4e ("xace: typesafe hook function for XACE_KEY_AVAIL")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
(cherry picked from commit 8bbf497e22)
172 lines
6.2 KiB
C
172 lines
6.2 KiB
C
/************************************************************
|
|
|
|
Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
|
|
|
|
Permission to use, copy, modify, distribute, and sell this software and its
|
|
documentation for any purpose is hereby granted without fee, provided that
|
|
this permission notice appear in supporting documentation. This permission
|
|
notice 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
|
|
AUTHOR 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 _XACE_H
|
|
#define _XACE_H
|
|
|
|
#ifdef XACE
|
|
|
|
#define XACE_MAJOR_VERSION 2
|
|
#define XACE_MINOR_VERSION 0
|
|
|
|
#include "extnsionst.h"
|
|
#include "pixmap.h"
|
|
#include "region.h"
|
|
#include "window.h"
|
|
#include "property.h"
|
|
#include "selection.h"
|
|
|
|
/* Default window background */
|
|
#define XaceBackgroundNoneState(w) ((w)->forcedBG ? BackgroundPixel : None)
|
|
|
|
/* security hooks */
|
|
/* Constants used to identify the available security hooks
|
|
*/
|
|
#define XACE_CORE_DISPATCH 0
|
|
#define XACE_EXT_DISPATCH 1
|
|
#define XACE_RESOURCE_ACCESS 2
|
|
#define XACE_DEVICE_ACCESS 3
|
|
#define XACE_PROPERTY_ACCESS 4
|
|
#define XACE_SEND_ACCESS 5
|
|
#define XACE_RECEIVE_ACCESS 6
|
|
#define XACE_CLIENT_ACCESS 7
|
|
#define XACE_EXT_ACCESS 8
|
|
#define XACE_SERVER_ACCESS 9
|
|
#define XACE_SELECTION_ACCESS 10
|
|
#define XACE_SCREEN_ACCESS 11
|
|
#define XACE_SCREENSAVER_ACCESS 12
|
|
#define XACE_AUTH_AVAIL 13
|
|
#define XACE_KEY_AVAIL 14
|
|
#define XACE_NUM_HOOKS 15
|
|
|
|
extern _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
|
|
|
|
/* Entry point for hook functions. Called by Xserver.
|
|
* Required by libdbe and libextmod
|
|
*/
|
|
extern _X_EXPORT int XaceHook(int /*hook */ ,
|
|
... /*appropriate args for hook */
|
|
);
|
|
|
|
/* determine whether any callbacks are present for the XACE hook */
|
|
extern _X_EXPORT int XaceHookIsSet(int hook);
|
|
|
|
/* Special-cased hook functions
|
|
*/
|
|
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
|
|
#define XaceHookDispatch(c, m) \
|
|
((XaceHooks[XACE_EXT_DISPATCH] && (m) >= EXTENSION_BASE) ? \
|
|
XaceHookDispatch((c), (m)) : \
|
|
Success)
|
|
|
|
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
|
PropertyPtr *ppProp,
|
|
Mask access_mode);
|
|
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
|
|
Mask access_mode);
|
|
|
|
/* needs to be exported for in-tree modsetting, but not part of public API */
|
|
_X_EXPORT int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
|
|
RESTYPE ptype, void *parent, Mask access_mode);
|
|
|
|
int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode);
|
|
|
|
int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win,
|
|
xEventPtr ev, int count);
|
|
int XaceHookReceiveAccess(ClientPtr client, WindowPtr win, xEventPtr ev, int count);
|
|
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode);
|
|
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext);
|
|
int XaceHookServerAccess(ClientPtr client, Mask access_mode);
|
|
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
|
|
int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
|
|
int XaceHookAuthAvail(ClientPtr client, XID authId);
|
|
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count);
|
|
|
|
|
|
/* Register a callback for a given hook.
|
|
*/
|
|
#define XaceRegisterCallback(hook,callback,data) \
|
|
AddCallback(XaceHooks+(hook), callback, data)
|
|
|
|
/* Unregister an existing callback for a given hook.
|
|
*/
|
|
#define XaceDeleteCallback(hook,callback,data) \
|
|
DeleteCallback(XaceHooks+(hook), callback, data)
|
|
|
|
/* XTrans wrappers for use by security modules
|
|
*/
|
|
extern _X_EXPORT int XaceGetConnectionNumber(ClientPtr ptr);
|
|
extern _X_EXPORT int XaceIsLocal(ClientPtr ptr);
|
|
|
|
/* From the original Security extension...
|
|
*/
|
|
|
|
extern _X_EXPORT void XaceCensorImage(ClientPtr client,
|
|
RegionPtr pVisibleRegion,
|
|
long widthBytesLine,
|
|
DrawablePtr pDraw,
|
|
int x, int y, int w, int h,
|
|
unsigned int format, char *pBuf);
|
|
|
|
#else /* XACE */
|
|
|
|
/* Default window background */
|
|
#define XaceBackgroundNoneState(w) None
|
|
|
|
/* Define calls away when XACE is not being built. */
|
|
|
|
#ifdef __GNUC__
|
|
#define XaceHookIsSet(args...) 0
|
|
#define XaceHookDispatch(args...) Success
|
|
#define XaceHookPropertyAccess(args...) Success
|
|
#define XaceHookSelectionAccess(args...) Success
|
|
#define XaceHookResourceAccess(args...) Success
|
|
#define XaceHookDeviceAccess(args...) Success
|
|
#define XaceHookSendAccess(args...) Success
|
|
#define XaceHookReceiveAccess(args...) Success
|
|
#define XaceHookClientAccess(args...) Success
|
|
#define XaceHookExtAccess(args...) Success
|
|
#define XaceHookServerAccess(args...) Success
|
|
#define XaceHookScreenAccess(args...) Success
|
|
#define XaceHookScreensaverAccess(args...) Success
|
|
#define XaceHookAuthAvail(args...) Success
|
|
#define XaceHookKeyAvail(args...) Success
|
|
#define XaceCensorImage(args...) { ; }
|
|
#else
|
|
#define XaceHookIsSet(...) 0
|
|
#define XaceHookDispatch(...) Success
|
|
#define XaceHookPropertyAccess(...) Success
|
|
#define XaceHookSelectionAccess(...) Success
|
|
#define XaceHookResourceAccess(...) Success
|
|
#define XaceHookDeviceAccess(...) Success
|
|
#define XaceHookSendAccess(...) Success
|
|
#define XaceHookReceiveAccess(...) Success
|
|
#define XaceHookClientAccess(...) Success
|
|
#define XaceHookExtAccess(...) Success
|
|
#define XaceHookServerAccess(...) Success
|
|
#define XaceHookScreenAccess(...) Success
|
|
#define XaceHookScreensaverAccess(...) Success
|
|
#define XaceHookAuthAvail(...) Success
|
|
#define XaceHookKeyAvail(...) Success
|
|
#define XaceCensorImage(...) { ; }
|
|
#endif
|
|
|
|
#endif /* XACE */
|
|
|
|
#endif /* _XACE_H */
|