xace.h revision 05b261ec
105b261ecSmrg/************************************************************
205b261ecSmrg
305b261ecSmrgAuthor: Eamon Walsh <ewalsh@epoch.ncsc.mil>
405b261ecSmrg
505b261ecSmrgPermission to use, copy, modify, distribute, and sell this software and its
605b261ecSmrgdocumentation for any purpose is hereby granted without fee, provided that
705b261ecSmrgthis permission notice appear in supporting documentation.  This permission
805b261ecSmrgnotice shall be included in all copies or substantial portions of the
905b261ecSmrgSoftware.
1005b261ecSmrg
1105b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1205b261ecSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1305b261ecSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1405b261ecSmrgAUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1505b261ecSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1605b261ecSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1705b261ecSmrg
1805b261ecSmrg********************************************************/
1905b261ecSmrg
2005b261ecSmrg#ifndef _XACE_H
2105b261ecSmrg#define _XACE_H
2205b261ecSmrg
2305b261ecSmrg/* Hook return codes */
2405b261ecSmrg#define XaceErrorOperation  0
2505b261ecSmrg#define XaceAllowOperation  1
2605b261ecSmrg#define XaceIgnoreOperation 2
2705b261ecSmrg
2805b261ecSmrg#ifdef XACE
2905b261ecSmrg
3005b261ecSmrg#define XACE_EXTENSION_NAME		"XAccessControlExtension"
3105b261ecSmrg#define XACE_MAJOR_VERSION		1
3205b261ecSmrg#define XACE_MINOR_VERSION		0
3305b261ecSmrg
3405b261ecSmrg#include "pixmap.h"     /* for DrawablePtr */
3505b261ecSmrg#include "regionstr.h"  /* for RegionPtr */
3605b261ecSmrg
3705b261ecSmrg#define XaceNumberEvents		0
3805b261ecSmrg#define XaceNumberErrors		0
3905b261ecSmrg
4005b261ecSmrg/* security hooks */
4105b261ecSmrg/* Constants used to identify the available security hooks
4205b261ecSmrg */
4305b261ecSmrg#define XACE_CORE_DISPATCH		0
4405b261ecSmrg#define XACE_EXT_DISPATCH		1
4505b261ecSmrg#define XACE_RESOURCE_ACCESS		2
4605b261ecSmrg#define XACE_DEVICE_ACCESS		3
4705b261ecSmrg#define XACE_PROPERTY_ACCESS		4
4805b261ecSmrg#define XACE_DRAWABLE_ACCESS		5
4905b261ecSmrg#define XACE_MAP_ACCESS			6
5005b261ecSmrg#define XACE_BACKGRND_ACCESS		7
5105b261ecSmrg#define XACE_EXT_ACCESS			8
5205b261ecSmrg#define XACE_HOSTLIST_ACCESS		9
5305b261ecSmrg#define XACE_SITE_POLICY		10
5405b261ecSmrg#define XACE_DECLARE_EXT_SECURE		11
5505b261ecSmrg#define XACE_AUTH_AVAIL			12
5605b261ecSmrg#define XACE_KEY_AVAIL			13
5705b261ecSmrg#define XACE_WINDOW_INIT		14
5805b261ecSmrg#define XACE_AUDIT_BEGIN		15
5905b261ecSmrg#define XACE_AUDIT_END			16
6005b261ecSmrg#define XACE_NUM_HOOKS			17
6105b261ecSmrg
6205b261ecSmrgextern CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
6305b261ecSmrg
6405b261ecSmrg/* Entry point for hook functions.  Called by Xserver.
6505b261ecSmrg */
6605b261ecSmrgextern int XaceHook(
6705b261ecSmrg    int /*hook*/,
6805b261ecSmrg    ... /*appropriate args for hook*/
6905b261ecSmrg    );
7005b261ecSmrg
7105b261ecSmrg/* Register a callback for a given hook.
7205b261ecSmrg */
7305b261ecSmrg#define XaceRegisterCallback(hook,callback,data) \
7405b261ecSmrg    AddCallback(XaceHooks+(hook), callback, data)
7505b261ecSmrg
7605b261ecSmrg/* Unregister an existing callback for a given hook.
7705b261ecSmrg */
7805b261ecSmrg#define XaceDeleteCallback(hook,callback,data) \
7905b261ecSmrg    DeleteCallback(XaceHooks+(hook), callback, data)
8005b261ecSmrg
8105b261ecSmrg
8205b261ecSmrg/* From the original Security extension...
8305b261ecSmrg */
8405b261ecSmrg
8505b261ecSmrgextern void XaceCensorImage(
8605b261ecSmrg    ClientPtr client,
8705b261ecSmrg    RegionPtr pVisibleRegion,
8805b261ecSmrg    long widthBytesLine,
8905b261ecSmrg    DrawablePtr pDraw,
9005b261ecSmrg    int x, int y, int w, int h,
9105b261ecSmrg    unsigned int format,
9205b261ecSmrg    char * pBuf
9305b261ecSmrg    );
9405b261ecSmrg
9505b261ecSmrg#else /* XACE */
9605b261ecSmrg
9705b261ecSmrg/* Define calls away when XACE is not being built. */
9805b261ecSmrg
9905b261ecSmrg#ifdef __GNUC__
10005b261ecSmrg#define XaceHook(args...) XaceAllowOperation
10105b261ecSmrg#define XaceCensorImage(args...) { ; }
10205b261ecSmrg#else
10305b261ecSmrg#define XaceHook(...) XaceAllowOperation
10405b261ecSmrg#define XaceCensorImage(...) { ; }
10505b261ecSmrg#endif
10605b261ecSmrg
10705b261ecSmrg#endif /* XACE */
10805b261ecSmrg
10905b261ecSmrg#endif /* _XACE_H */
110