VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/7.0/X11/extensions/security.h@ 17234

Last change on this file since 17234 was 17234, checked in by vboxsync, 16 years ago

Additions/x11/x11include: blast! Corrected svn:keywords property on all files as per http://linserv.germany/vbox/wiki/SvnKeywords

  • Property svn:eol-style set to native
File size: 6.4 KB
Line 
1/* $Xorg: security.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ */
2/*
3Copyright 1996, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall
23not be used in advertising or otherwise to promote the sale, use or
24other dealings in this Software without prior written authorization
25from The Open Group.
26*/
27/* $XFree86: xc/include/extensions/security.h,v 1.3 2001/12/14 19:53:29 dawes Exp $ */
28
29#ifndef _SECURITY_H
30#define _SECURITY_H
31
32#define _XAUTH_STRUCT_ONLY
33#include <X11/Xauth.h>
34
35/* constants that server, library, and application all need */
36
37#define XSecurityNumberEvents 1
38#define XSecurityNumberErrors 2
39#define XSecurityBadAuthorization 0
40#define XSecurityBadAuthorizationProtocol 1
41
42/* trust levels */
43#define XSecurityClientTrusted 0
44#define XSecurityClientUntrusted 1
45
46/* authorization attribute masks */
47#define XSecurityTimeout (1<<0)
48#define XSecurityTrustLevel (1<<1)
49#define XSecurityGroup (1<<2)
50#define XSecurityEventMask (1<<3)
51#define XSecurityAllAuthorizationAttributes \
52 (XSecurityTimeout | XSecurityTrustLevel | XSecurityGroup | XSecurityEventMask)
53
54/* event masks */
55#define XSecurityAuthorizationRevokedMask (1<<0)
56#define XSecurityAllEventMasks XSecurityAuthorizationRevokedMask
57
58/* event offsets */
59#define XSecurityAuthorizationRevoked 0
60
61#define XSecurityAuthorizationName "XC-QUERY-SECURITY-1"
62#define XSecurityAuthorizationNameLen 19
63
64
65#ifndef _SECURITY_SERVER
66
67_XFUNCPROTOBEGIN
68
69Status XSecurityQueryExtension (
70 Display *dpy,
71 int *major_version_return,
72 int *minor_version_return);
73
74Xauth *XSecurityAllocXauth(void);
75
76void XSecurityFreeXauth(Xauth *auth);
77
78/* type for returned auth ids */
79typedef unsigned long XSecurityAuthorization;
80
81typedef struct {
82 unsigned int timeout;
83 unsigned int trust_level;
84 XID group;
85 long event_mask;
86} XSecurityAuthorizationAttributes;
87
88Xauth *XSecurityGenerateAuthorization(
89 Display *dpy,
90 Xauth *auth_in,
91 unsigned long valuemask,
92 XSecurityAuthorizationAttributes *attributes,
93 XSecurityAuthorization *auth_id_return);
94
95Status XSecurityRevokeAuthorization(
96 Display *dpy,
97 XSecurityAuthorization auth_id);
98
99_XFUNCPROTOEND
100
101typedef struct {
102 int type; /* event base + XSecurityAuthorizationRevoked */
103 unsigned long serial; /* # of last request processed by server */
104 Bool send_event; /* true if this came from a SendEvent request */
105 Display *display; /* Display the event was read from */
106 XSecurityAuthorization auth_id; /* revoked authorization id */
107} XSecurityAuthorizationRevokedEvent;
108
109#else /* _SECURITY_SERVER */
110
111#include "input.h" /* for DeviceIntPtr */
112#include "property.h" /* for PropertyPtr */
113#include "pixmap.h" /* for DrawablePtr */
114#include "resource.h" /* for RESTYPE */
115
116/* resource type to pass in LookupIDByType for authorizations */
117extern RESTYPE SecurityAuthorizationResType;
118
119/* this is what we store for an authorization */
120typedef struct {
121 XID id; /* resource ID */
122 CARD32 timeout; /* how long to live in seconds after refcnt == 0 */
123 unsigned int trustLevel; /* trusted/untrusted */
124 XID group; /* see embedding extension */
125 unsigned int refcnt; /* how many clients connected with this auth */
126 unsigned int secondsRemaining; /* overflow time amount for >49 days */
127 OsTimerPtr timer; /* timer for this auth */
128 struct _OtherClients *eventClients; /* clients wanting events */
129} SecurityAuthorizationRec, *SecurityAuthorizationPtr;
130
131/* The following callback is called when a GenerateAuthorization request
132 * is processed to sanity check the group argument. The call data will
133 * be a pointer to a SecurityValidateGroupInfoRec (below).
134 * Functions registered on this callback are expected to examine the
135 * group and set the valid field to TRUE if they recognize the group as a
136 * legitimate group. If they don't recognize it, they should not change the
137 * valid field.
138 */
139extern CallbackListPtr SecurityValidateGroupCallback;
140typedef struct {
141 XID group; /* the group that was sent in GenerateAuthorization */
142 Bool valid; /* did anyone recognize it? if so, set to TRUE */
143} SecurityValidateGroupInfoRec;
144
145/* Proc vectors for untrusted clients, swapped and unswapped versions.
146 * These are the same as the normal proc vectors except that extensions
147 * that haven't declared themselves secure will have ProcBadRequest plugged
148 * in for their major opcode dispatcher. This prevents untrusted clients
149 * from guessing extension major opcodes and using the extension even though
150 * the extension can't be listed or queried.
151 */
152extern int (*UntrustedProcVector[256])(ClientPtr client);
153extern int (*SwappedUntrustedProcVector[256])(ClientPtr client);
154
155extern Bool SecurityCheckDeviceAccess(ClientPtr client, DeviceIntPtr dev,
156 Bool fromRequest);
157
158extern void SecurityAudit(char *format, ...);
159
160#ifdef LBX
161extern Bool SecuritySameLevel(ClientPtr client, XID authId);
162#endif
163
164extern int XSecurityOptions(int argc, char **argv, int i);
165
166/* Give this value or higher to the -audit option to get security messages */
167#define SECURITY_AUDIT_LEVEL 4
168
169extern void SecurityCensorImage(
170 ClientPtr client,
171 RegionPtr pVisibleRegion,
172 long widthBytesLine,
173 DrawablePtr pDraw,
174 int x, int y, int w, int h,
175 unsigned int format,
176 char * pBuf);
177
178#define SecurityAllowOperation 0
179#define SecurityIgnoreOperation 1
180#define SecurityErrorOperation 2
181
182char
183SecurityCheckPropertyAccess(
184 ClientPtr client,
185 WindowPtr pWin,
186 ATOM propertyName,
187 Mask access_mode);
188
189#define SECURITY_POLICY_FILE_VERSION "version-1"
190
191char **SecurityGetSitePolicyStrings(int *n);
192
193#endif /* _SECURITY_SERVER */
194
195#endif /* _SECURITY_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette