1 | /************************************************************
|
---|
2 |
|
---|
3 | Author: Eamon Walsh <[email protected]>
|
---|
4 |
|
---|
5 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | this permission notice appear in supporting documentation. This permission
|
---|
8 | notice shall be included in all copies or substantial portions of the
|
---|
9 | Software.
|
---|
10 |
|
---|
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
14 | AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
15 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
16 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
17 |
|
---|
18 | ********************************************************/
|
---|
19 |
|
---|
20 | #ifndef _XACE_H
|
---|
21 | #define _XACE_H
|
---|
22 |
|
---|
23 | #ifdef XACE
|
---|
24 |
|
---|
25 | #define XACE_MAJOR_VERSION 2
|
---|
26 | #define XACE_MINOR_VERSION 0
|
---|
27 |
|
---|
28 | #include "pixmap.h"
|
---|
29 | #include "region.h"
|
---|
30 | #include "window.h"
|
---|
31 | #include "property.h"
|
---|
32 | #include "selection.h"
|
---|
33 |
|
---|
34 | /* Default window background */
|
---|
35 | #define XaceBackgroundNoneState(w) ((w)->forcedBG ? BackgroundPixel : None)
|
---|
36 |
|
---|
37 | /* security hooks */
|
---|
38 | /* Constants used to identify the available security hooks
|
---|
39 | */
|
---|
40 | #define XACE_CORE_DISPATCH 0
|
---|
41 | #define XACE_EXT_DISPATCH 1
|
---|
42 | #define XACE_RESOURCE_ACCESS 2
|
---|
43 | #define XACE_DEVICE_ACCESS 3
|
---|
44 | #define XACE_PROPERTY_ACCESS 4
|
---|
45 | #define XACE_SEND_ACCESS 5
|
---|
46 | #define XACE_RECEIVE_ACCESS 6
|
---|
47 | #define XACE_CLIENT_ACCESS 7
|
---|
48 | #define XACE_EXT_ACCESS 8
|
---|
49 | #define XACE_SERVER_ACCESS 9
|
---|
50 | #define XACE_SELECTION_ACCESS 10
|
---|
51 | #define XACE_SCREEN_ACCESS 11
|
---|
52 | #define XACE_SCREENSAVER_ACCESS 12
|
---|
53 | #define XACE_AUTH_AVAIL 13
|
---|
54 | #define XACE_KEY_AVAIL 14
|
---|
55 | #define XACE_AUDIT_BEGIN 15
|
---|
56 | #define XACE_AUDIT_END 16
|
---|
57 | #define XACE_NUM_HOOKS 17
|
---|
58 |
|
---|
59 | extern CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
|
---|
60 |
|
---|
61 | /* Entry point for hook functions. Called by Xserver.
|
---|
62 | */
|
---|
63 | extern int XaceHook(
|
---|
64 | int /*hook*/,
|
---|
65 | ... /*appropriate args for hook*/
|
---|
66 | );
|
---|
67 |
|
---|
68 | /* Special-cased hook functions
|
---|
69 | */
|
---|
70 | extern int XaceHookDispatch(ClientPtr ptr, int major);
|
---|
71 | extern int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
---|
72 | PropertyPtr *ppProp, Mask access_mode);
|
---|
73 | extern int XaceHookSelectionAccess(ClientPtr ptr,
|
---|
74 | Selection **ppSel, Mask access_mode);
|
---|
75 | extern void XaceHookAuditEnd(ClientPtr ptr, int result);
|
---|
76 |
|
---|
77 | /* Register a callback for a given hook.
|
---|
78 | */
|
---|
79 | #define XaceRegisterCallback(hook,callback,data) \
|
---|
80 | AddCallback(XaceHooks+(hook), callback, data)
|
---|
81 |
|
---|
82 | /* Unregister an existing callback for a given hook.
|
---|
83 | */
|
---|
84 | #define XaceDeleteCallback(hook,callback,data) \
|
---|
85 | DeleteCallback(XaceHooks+(hook), callback, data)
|
---|
86 |
|
---|
87 |
|
---|
88 | /* From the original Security extension...
|
---|
89 | */
|
---|
90 |
|
---|
91 | extern void XaceCensorImage(
|
---|
92 | ClientPtr client,
|
---|
93 | RegionPtr pVisibleRegion,
|
---|
94 | long widthBytesLine,
|
---|
95 | DrawablePtr pDraw,
|
---|
96 | int x, int y, int w, int h,
|
---|
97 | unsigned int format,
|
---|
98 | char * pBuf
|
---|
99 | );
|
---|
100 |
|
---|
101 | #else /* XACE */
|
---|
102 |
|
---|
103 | /* Default window background */
|
---|
104 | #define XaceBackgroundNoneState(w) None
|
---|
105 |
|
---|
106 | /* Define calls away when XACE is not being built. */
|
---|
107 |
|
---|
108 | #ifdef __GNUC__
|
---|
109 | #define XaceHook(args...) Success
|
---|
110 | #define XaceHookDispatch(args...) Success
|
---|
111 | #define XaceHookPropertyAccess(args...) Success
|
---|
112 | #define XaceHookSelectionAccess(args...) Success
|
---|
113 | #define XaceHookAuditEnd(args...) { ; }
|
---|
114 | #define XaceCensorImage(args...) { ; }
|
---|
115 | #else
|
---|
116 | #define XaceHook(...) Success
|
---|
117 | #define XaceHookDispatch(...) Success
|
---|
118 | #define XaceHookPropertyAccess(...) Success
|
---|
119 | #define XaceHookSelectionAccess(...) Success
|
---|
120 | #define XaceHookAuditEnd(...) { ; }
|
---|
121 | #define XaceCensorImage(...) { ; }
|
---|
122 | #endif
|
---|
123 |
|
---|
124 | #endif /* XACE */
|
---|
125 |
|
---|
126 | #endif /* _XACE_H */
|
---|