2004-06-01 23:09:25 +02:00
|
|
|
/************************************************************
|
|
|
|
|
2009-09-02 23:56:52 +02:00
|
|
|
Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
|
2004-06-01 23:09:25 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2006-12-02 02:48:15 +01:00
|
|
|
#ifdef XACE
|
|
|
|
|
2007-03-21 19:49:56 +01:00
|
|
|
#define XACE_MAJOR_VERSION 2
|
2004-06-01 23:09:25 +02:00
|
|
|
#define XACE_MINOR_VERSION 0
|
|
|
|
|
2008-02-06 03:06:05 +01:00
|
|
|
#include "pixmap.h"
|
|
|
|
#include "region.h"
|
|
|
|
#include "window.h"
|
|
|
|
#include "property.h"
|
2008-02-29 23:55:31 +01:00
|
|
|
#include "selection.h"
|
2004-06-01 23:09:25 +02:00
|
|
|
|
2007-12-18 05:11:29 +01:00
|
|
|
/* Default window background */
|
2008-02-16 01:53:45 +01:00
|
|
|
#define XaceBackgroundNoneState(w) ((w)->forcedBG ? BackgroundPixel : None)
|
2007-12-18 05:11:29 +01:00
|
|
|
|
2004-06-01 23:09:25 +02:00
|
|
|
/* 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
|
2007-09-28 21:04:33 +02:00
|
|
|
#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_AUDIT_BEGIN 15
|
|
|
|
#define XACE_AUDIT_END 16
|
|
|
|
#define XACE_NUM_HOOKS 17
|
2004-06-01 23:09:25 +02:00
|
|
|
|
2009-01-05 19:49:57 +01:00
|
|
|
extern _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
|
2004-06-01 23:09:25 +02:00
|
|
|
|
|
|
|
/* Entry point for hook functions. Called by Xserver.
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
* Required by libdbe and libextmod
|
2004-06-01 23:09:25 +02:00
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
extern _X_EXPORT int XaceHook(int /*hook */ ,
|
|
|
|
... /*appropriate args for hook */
|
|
|
|
);
|
2004-06-01 23:09:25 +02:00
|
|
|
|
2015-06-04 20:23:19 +02:00
|
|
|
/* determine whether any callbacks are present for the XACE hook */
|
|
|
|
extern _X_EXPORT int XaceHookIsSet(int hook);
|
|
|
|
|
2007-11-06 22:26:09 +01:00
|
|
|
/* Special-cased hook functions
|
|
|
|
*/
|
2009-01-05 19:49:57 +01:00
|
|
|
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
|
|
|
|
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
2012-03-21 20:55:09 +01:00
|
|
|
PropertyPtr *ppProp,
|
|
|
|
Mask access_mode);
|
|
|
|
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
|
|
|
|
Mask access_mode);
|
2009-01-05 19:49:57 +01:00
|
|
|
extern _X_EXPORT void XaceHookAuditEnd(ClientPtr ptr, int result);
|
2007-11-06 22:26:09 +01:00
|
|
|
|
2006-08-03 20:26:06 +02:00
|
|
|
/* Register a callback for a given hook.
|
2004-06-01 23:09:25 +02:00
|
|
|
*/
|
|
|
|
#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)
|
|
|
|
|
2008-12-18 19:58:35 +01:00
|
|
|
/* XTrans wrappers for use by security modules
|
|
|
|
*/
|
2009-01-05 19:49:57 +01:00
|
|
|
extern _X_EXPORT int XaceGetConnectionNumber(ClientPtr ptr);
|
|
|
|
extern _X_EXPORT int XaceIsLocal(ClientPtr ptr);
|
2004-06-01 23:09:25 +02:00
|
|
|
|
|
|
|
/* From the original Security extension...
|
|
|
|
*/
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2004-06-01 23:09:25 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
#else /* XACE */
|
2006-12-02 02:48:15 +01:00
|
|
|
|
2007-12-18 05:11:29 +01:00
|
|
|
/* Default window background */
|
2008-02-16 01:53:45 +01:00
|
|
|
#define XaceBackgroundNoneState(w) None
|
2007-12-18 05:11:29 +01:00
|
|
|
|
2006-12-02 02:48:15 +01:00
|
|
|
/* Define calls away when XACE is not being built. */
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
2007-04-17 22:01:56 +02:00
|
|
|
#define XaceHook(args...) Success
|
2015-10-27 13:23:13 +01:00
|
|
|
#define XaceHookIsSet(args...) 0
|
2008-01-25 23:28:17 +01:00
|
|
|
#define XaceHookDispatch(args...) Success
|
2008-02-06 02:07:08 +01:00
|
|
|
#define XaceHookPropertyAccess(args...) Success
|
2008-02-13 01:59:10 +01:00
|
|
|
#define XaceHookSelectionAccess(args...) Success
|
2007-11-06 22:26:09 +01:00
|
|
|
#define XaceHookAuditEnd(args...) { ; }
|
2006-12-02 02:48:15 +01:00
|
|
|
#define XaceCensorImage(args...) { ; }
|
|
|
|
#else
|
2007-04-17 22:01:56 +02:00
|
|
|
#define XaceHook(...) Success
|
2015-10-27 13:23:13 +01:00
|
|
|
#define XaceHookIsSet(...) 0
|
2008-01-25 23:28:17 +01:00
|
|
|
#define XaceHookDispatch(...) Success
|
2008-02-06 02:07:08 +01:00
|
|
|
#define XaceHookPropertyAccess(...) Success
|
2008-02-13 01:59:10 +01:00
|
|
|
#define XaceHookSelectionAccess(...) Success
|
2007-11-06 22:26:09 +01:00
|
|
|
#define XaceHookAuditEnd(...) { ; }
|
2006-12-02 02:48:15 +01:00
|
|
|
#define XaceCensorImage(...) { ; }
|
|
|
|
#endif
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
#endif /* XACE */
|
2006-12-02 02:48:15 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
#endif /* _XACE_H */
|