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 _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
|
---|
60 |
|
---|
61 | /* Entry point for hook functions. Called by Xserver.
|
---|
62 | * Required by libdbe and libextmod
|
---|
63 | */
|
---|
64 | extern _X_EXPORT int XaceHook(int /*hook */ ,
|
---|
65 | ... /*appropriate args for hook */
|
---|
66 | );
|
---|
67 |
|
---|
68 | /* Special-cased hook functions
|
---|
69 | */
|
---|
70 | extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
|
---|
71 | extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
---|
72 | PropertyPtr *ppProp,
|
---|
73 | Mask access_mode);
|
---|
74 | extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
|
---|
75 | Mask access_mode);
|
---|
76 | extern _X_EXPORT void XaceHookAuditEnd(ClientPtr ptr, int result);
|
---|
77 |
|
---|
78 | /* Register a callback for a given hook.
|
---|
79 | */
|
---|
80 | #define XaceRegisterCallback(hook,callback,data) \
|
---|
81 | AddCallback(XaceHooks+(hook), callback, data)
|
---|
82 |
|
---|
83 | /* Unregister an existing callback for a given hook.
|
---|
84 | */
|
---|
85 | #define XaceDeleteCallback(hook,callback,data) \
|
---|
86 | DeleteCallback(XaceHooks+(hook), callback, data)
|
---|
87 |
|
---|
88 | /* XTrans wrappers for use by security modules
|
---|
89 | */
|
---|
90 | extern _X_EXPORT int XaceGetConnectionNumber(ClientPtr ptr);
|
---|
91 | extern _X_EXPORT int XaceIsLocal(ClientPtr ptr);
|
---|
92 |
|
---|
93 | /* From the original Security extension...
|
---|
94 | */
|
---|
95 |
|
---|
96 | extern _X_EXPORT void XaceCensorImage(ClientPtr client,
|
---|
97 | RegionPtr pVisibleRegion,
|
---|
98 | long widthBytesLine,
|
---|
99 | DrawablePtr pDraw,
|
---|
100 | int x, int y, int w, int h,
|
---|
101 | unsigned int format, char *pBuf);
|
---|
102 |
|
---|
103 | #else /* XACE */
|
---|
104 |
|
---|
105 | /* Default window background */
|
---|
106 | #define XaceBackgroundNoneState(w) None
|
---|
107 |
|
---|
108 | /* Define calls away when XACE is not being built. */
|
---|
109 |
|
---|
110 | #ifdef __GNUC__
|
---|
111 | #define XaceHook(args...) Success
|
---|
112 | #define XaceHookDispatch(args...) Success
|
---|
113 | #define XaceHookPropertyAccess(args...) Success
|
---|
114 | #define XaceHookSelectionAccess(args...) Success
|
---|
115 | #define XaceHookAuditEnd(args...) { ; }
|
---|
116 | #define XaceCensorImage(args...) { ; }
|
---|
117 | #else
|
---|
118 | #define XaceHook(...) Success
|
---|
119 | #define XaceHookDispatch(...) Success
|
---|
120 | #define XaceHookPropertyAccess(...) Success
|
---|
121 | #define XaceHookSelectionAccess(...) Success
|
---|
122 | #define XaceHookAuditEnd(...) { ; }
|
---|
123 | #define XaceCensorImage(...) { ; }
|
---|
124 | #endif
|
---|
125 |
|
---|
126 | #endif /* XACE */
|
---|
127 |
|
---|
128 | #endif /* _XACE_H */
|
---|