~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/lbx/lbxserve.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Xorg: lbxserve.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
 
2
/*
 
3
 
 
4
Copyright 1996, 1998  The Open Group
 
5
 
 
6
Permission to use, copy, modify, distribute, and sell this software and its
 
7
documentation for any purpose is hereby granted without fee, provided that
 
8
the above copyright notice appear in all copies and that both that
 
9
copyright notice and this permission notice appear in supporting
 
10
documentation.
 
11
 
 
12
The above copyright notice and this permission notice shall be included in
 
13
all copies or substantial portions of the Software.
 
14
 
 
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
21
 
 
22
Except as contained in this notice, the name of The Open Group shall not be
 
23
used in advertising or otherwise to promote the sale, use or other dealings
 
24
in this Software without prior written authorization from The Open Group.
 
25
 
 
26
*/
 
27
/*
 
28
 * Copyright 1992 Network Computing Devices
 
29
 *
 
30
 * Permission to use, copy, modify, distribute, and sell this software and its
 
31
 * documentation for any purpose is hereby granted without fee, provided that
 
32
 * the above copyright notice appear in all copies and that both that
 
33
 * copyright notice and this permission notice appear in supporting
 
34
 * documentation, and that the name of NCD. not be used in advertising or
 
35
 * publicity pertaining to distribution of the software without specific,
 
36
 * written prior permission.  NCD. makes no representations about the
 
37
 * suitability of this software for any purpose.  It is provided "as is"
 
38
 * without express or implied warranty.
 
39
 *
 
40
 * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
 
41
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
 
42
 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 
43
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 
44
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 
45
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
46
 *
 
47
 */
 
48
/* $XFree86: xc/programs/Xserver/lbx/lbxserve.h,v 1.5 2001/12/14 20:00:00 dawes Exp $ */
 
49
 
 
50
#ifndef _LBXSERVE_H_
 
51
 
 
52
#include "colormap.h"
 
53
#include "property.h"
 
54
 
 
55
#define _LBXSERVE_H_
 
56
#define _XLBX_SERVER_
 
57
#include "lbxstr.h"
 
58
#include "lbxdeltastr.h"
 
59
#include "lbxopts.h"
 
60
 
 
61
#define MAX_LBX_CLIENTS MAXCLIENTS
 
62
#define MAX_NUM_PROXIES (MAXCLIENTS >> 1)
 
63
 
 
64
typedef struct _LbxClient *LbxClientPtr;
 
65
typedef struct _LbxProxy *LbxProxyPtr;
 
66
 
 
67
typedef struct _LbxClient {
 
68
    CARD32      id;
 
69
    ClientPtr   client;
 
70
    LbxProxyPtr proxy;
 
71
    Bool        ignored;
 
72
    Bool        input_blocked;
 
73
    int         reqs_pending;
 
74
    long        bytes_in_reply;
 
75
    long        bytes_remaining;
 
76
    Drawable    drawableCache[GFX_CACHE_SIZE];
 
77
    GContext    gcontextCache[GFX_CACHE_SIZE];
 
78
    pointer     gfx_buffer;     /* tmp buffer for unpacking gfx requests */
 
79
    unsigned long       gb_size;
 
80
}           LbxClientRec;
 
81
 
 
82
typedef struct _connectionOutput *OSBufPtr;
 
83
 
 
84
typedef struct _LbxProxy {
 
85
    LbxProxyPtr next;
 
86
    /* this array is indexed by lbx proxy index */
 
87
    LbxClientPtr lbxClients[MAX_LBX_CLIENTS];
 
88
    LbxClientPtr curRecv,
 
89
                curDix;
 
90
    int         fd;
 
91
    int         pid;            /* proxy ID */
 
92
    int         uid;
 
93
    int         numClients;
 
94
    int         maxIndex;
 
95
    Bool        aborted;
 
96
    int         grabClient;
 
97
    pointer     compHandle;
 
98
    Bool        dosquishing;
 
99
    Bool        useTags;
 
100
    LBXDeltasRec indeltas;
 
101
    LBXDeltasRec outdeltas;
 
102
    char        *iDeltaBuf;
 
103
    char        *replyBuf;
 
104
    char        *oDeltaBuf;
 
105
    OSBufPtr    ofirst;
 
106
    OSBufPtr    olast;
 
107
    CARD32      cur_send_id;
 
108
 
 
109
    LbxStreamOpts streamOpts;
 
110
 
 
111
    int         numBitmapCompMethods;
 
112
    unsigned char       *bitmapCompMethods;   /* array of indices */
 
113
    int         numPixmapCompMethods;
 
114
    unsigned char       *pixmapCompMethods;   /* array of indices */
 
115
    int         **pixmapCompDepths;   /* depths supported from each method */
 
116
 
 
117
    struct _ColormapRec *grabbedCmaps; /* chained via lbx private */
 
118
    int         motion_allowed_events;
 
119
    lbxMotionCache motionCache;
 
120
}           LbxProxyRec;
 
121
 
 
122
/* This array is indexed by server client index, not lbx proxy index */
 
123
 
 
124
extern LbxClientPtr lbxClients[MAXCLIENTS];
 
125
 
 
126
#define LbxClient(client)   (lbxClients[(client)->index])
 
127
#define LbxProxy(client)    (LbxClient(client)->proxy)
 
128
#define LbxMaybeProxy(client)   (LbxClient(client) ? LbxProxy(client) : 0)
 
129
#define LbxProxyID(client)  (LbxProxy(client)->pid)
 
130
#define LbxProxyClient(proxy) ((proxy)->lbxClients[0]->client)
 
131
 
 
132
extern int LbxEventCode;
 
133
 
 
134
 
 
135
/* os/connection.c */
 
136
extern ClientPtr AllocLbxClientConnection ( ClientPtr client, 
 
137
                                            LbxProxyPtr proxy );
 
138
extern void LbxProxyConnection ( ClientPtr client, LbxProxyPtr proxy );
 
139
 
 
140
/* os/libxio.c */
 
141
extern int UncompressedWriteToClient ( ClientPtr who, int count, char *buf );
 
142
extern void LbxForceOutput ( LbxProxyPtr proxy );
 
143
extern void SwitchClientInput ( ClientPtr client, Bool pending );
 
144
extern int PrepareLargeReqBuffer ( ClientPtr client );
 
145
extern Bool AppendFakeRequest ( ClientPtr client, char *data, int count );
 
146
extern void LbxFreeOsBuffers ( LbxProxyPtr proxy );
 
147
extern Bool AllocateLargeReqBuffer ( ClientPtr client, int size );
 
148
extern Bool AddToLargeReqBuffer ( ClientPtr client, char *data, int size );
 
149
extern void LbxPrimeInput ( ClientPtr client, LbxProxyPtr proxy );
 
150
 
 
151
/* lbxcmap.c */
 
152
extern int LbxCmapInit ( void );
 
153
extern Bool LbxCheckColorRequest ( ClientPtr client, ColormapPtr pmap, 
 
154
                                   xReq *req );
 
155
extern int LbxCheckCmapGrabbed ( ColormapPtr pmap );
 
156
extern void LbxDisableSmartGrab ( ColormapPtr pmap );
 
157
extern void LbxBeginFreeCellsEvent ( ColormapPtr pmap );
 
158
extern void LbxAddFreeCellToEvent ( ColormapPtr pmap, Pixel pixel );
 
159
extern void LbxEndFreeCellsEvent ( ColormapPtr pmap );
 
160
extern void LbxSortPixelList ( Pixel *pixels, int count );
 
161
extern int ProcLbxGrabCmap ( ClientPtr client );
 
162
extern void LbxReleaseCmap ( ColormapPtr pmap, Bool smart );
 
163
extern int ProcLbxReleaseCmap ( ClientPtr client );
 
164
extern int ProcLbxAllocColor ( ClientPtr client );
 
165
extern int ProcLbxIncrementPixel ( ClientPtr client );
 
166
 
 
167
/* lbxdix.h */
 
168
extern void LbxDixInit ( void );
 
169
extern void LbxResetTags ( void );
 
170
extern int LbxSendConnSetup ( ClientPtr client, char *reason );
 
171
extern int LbxGetModifierMapping ( ClientPtr client );
 
172
extern int LbxGetKeyboardMapping ( ClientPtr client );
 
173
extern int LbxQueryFont ( ClientPtr client );
 
174
extern int LbxTagData ( ClientPtr client, XID tag, unsigned long len, 
 
175
                        pointer data );
 
176
extern int LbxInvalidateTag ( ClientPtr client, XID tag );
 
177
extern void LbxAllowMotion ( ClientPtr client, int num );
 
178
extern void LbxFlushModifierMapTag ( void );
 
179
extern void LbxFlushKeyboardMapTag ( void );
 
180
extern void LbxFreeFontTag ( FontPtr pfont );
 
181
extern void LbxSendInvalidateTag ( ClientPtr client, XID tag, int tagtype );
 
182
extern Bool LbxFlushQTag ( XID tag );
 
183
extern void ProcessQTagZombies ( void );
 
184
extern void LbxQueryTagData ( ClientPtr client, int owner_pid, XID tag, 
 
185
                              int tagtype );
 
186
 
 
187
/* lbxexts.c */
 
188
extern Bool LbxAddExtension ( char *name, int opcode, int ev_base, 
 
189
                              int err_base );
 
190
extern Bool LbxAddExtensionAlias ( int idx, char *alias );
 
191
extern void LbxDeclareExtensionSecurity ( char *extname, Bool secure );
 
192
extern Bool LbxRegisterExtensionGenerationMasks ( int idx, int num_reqs, 
 
193
                                                  char *rep_mask, 
 
194
                                                  char *ev_mask );
 
195
extern int LbxQueryExtension ( ClientPtr client, char *ename, int nlen );
 
196
extern void LbxCloseDownExtensions ( void );
 
197
extern void LbxSetReqMask ( CARD8 *mask, int req, Bool on );
 
198
 
 
199
/* lbxgfx.c */
 
200
extern int LbxDecodePoly( ClientPtr client, CARD8 xreqtype,
 
201
                          int (*decode_rtn)(char *, char *, short *) );
 
202
extern int LbxDecodeFillPoly ( ClientPtr client );
 
203
extern int LbxDecodeCopyArea ( ClientPtr client );
 
204
extern int LbxDecodeCopyPlane ( ClientPtr client );
 
205
extern int LbxDecodePolyText ( ClientPtr client );
 
206
extern int LbxDecodeImageText ( ClientPtr client );
 
207
extern int LbxDecodePutImage ( ClientPtr client );
 
208
extern int LbxDecodeGetImage ( ClientPtr client );
 
209
extern int LbxDecodePoints ( char *in, char *inend, short *out );
 
210
extern int LbxDecodeSegment ( char *in, char *inend, short *out );
 
211
extern int LbxDecodeRectangle ( char *in, char *inend, short *out );
 
212
extern int LbxDecodeArc ( char *in, char *inend, short *out );
 
213
 
 
214
/* lbxmain.c */
 
215
extern LbxProxyPtr LbxPidToProxy ( int pid );
 
216
extern void LbxReencodeOutput ( ClientPtr client, char *pbuf, int *pcount,
 
217
                                char *cbuf, int *ccount );
 
218
extern void LbxExtensionInit ( void );
 
219
extern void LbxCloseClient ( ClientPtr client );
 
220
extern void LbxSetForBlock ( LbxClientPtr lbxClient );
 
221
extern int ProcLbxDispatch ( ClientPtr client );
 
222
extern int ProcLbxSwitch ( ClientPtr client );
 
223
extern int ProcLbxQueryVersion ( ClientPtr client );
 
224
extern int ProcLbxStartProxy ( ClientPtr client );
 
225
extern int ProcLbxStopProxy ( ClientPtr client );
 
226
extern int ProcLbxBeginLargeRequest ( ClientPtr client );
 
227
extern int ProcLbxLargeRequestData ( ClientPtr client );
 
228
extern int ProcLbxEndLargeRequest ( ClientPtr client );
 
229
extern int ProcLbxInternAtoms ( ClientPtr client );
 
230
extern int ProcLbxGetWinAttrAndGeom ( ClientPtr client );
 
231
extern int ProcLbxNewClient ( ClientPtr client );
 
232
extern int ProcLbxEstablishConnection ( ClientPtr client );
 
233
extern int ProcLbxCloseClient ( ClientPtr client );
 
234
extern int ProcLbxModifySequence ( ClientPtr client );
 
235
extern int ProcLbxAllowMotion ( ClientPtr client );
 
236
extern int ProcLbxGetModifierMapping ( ClientPtr client );
 
237
extern int ProcLbxGetKeyboardMapping ( ClientPtr client );
 
238
extern int ProcLbxQueryFont ( ClientPtr client );
 
239
extern int ProcLbxChangeProperty ( ClientPtr client );
 
240
extern int ProcLbxGetProperty ( ClientPtr client );
 
241
extern int ProcLbxTagData ( ClientPtr client );
 
242
extern int ProcLbxInvalidateTag ( ClientPtr client );
 
243
extern int ProcLbxPolyPoint ( ClientPtr client );
 
244
extern int ProcLbxPolyLine ( ClientPtr client );
 
245
extern int ProcLbxPolySegment ( ClientPtr client );
 
246
extern int ProcLbxPolyRectangle ( ClientPtr client );
 
247
extern int ProcLbxPolyArc ( ClientPtr client );
 
248
extern int ProcLbxFillPoly ( ClientPtr client );
 
249
extern int ProcLbxPolyFillRectangle ( ClientPtr client );
 
250
extern int ProcLbxPolyFillArc ( ClientPtr client );
 
251
extern int ProcLbxCopyArea ( ClientPtr client );
 
252
extern int ProcLbxCopyPlane ( ClientPtr client );
 
253
extern int ProcLbxPolyText ( ClientPtr client );
 
254
extern int ProcLbxImageText ( ClientPtr client );
 
255
extern int ProcLbxQueryExtension ( ClientPtr client );
 
256
extern int ProcLbxPutImage ( ClientPtr client );
 
257
extern int ProcLbxGetImage ( ClientPtr client );
 
258
extern int ProcLbxSync ( ClientPtr client );
 
259
 
 
260
/* lbxprop.c */
 
261
extern int LbxChangeProperty ( ClientPtr client );
 
262
extern int LbxGetProperty ( ClientPtr client );
 
263
extern void LbxStallPropRequest ( ClientPtr client, PropertyPtr pProp );
 
264
extern int LbxChangeWindowProperty ( ClientPtr client, WindowPtr pWin, 
 
265
                                     Atom property, Atom type, int format, 
 
266
                                     int mode, unsigned long len, 
 
267
                                     Bool have_data, pointer value, 
 
268
                                     Bool sendevent, XID *tag );
 
269
/* lbxsquish.c */
 
270
extern int LbxSquishEvent ( char *buf );
 
271
 
 
272
/* lbwswap.c */
 
273
extern int SProcLbxDispatch( ClientPtr client );
 
274
extern int SProcLbxSwitch ( ClientPtr client );
 
275
extern int SProcLbxBeginLargeRequest ( ClientPtr client );
 
276
extern int SProcLbxLargeRequestData ( ClientPtr client );
 
277
extern int SProcLbxEndLargeRequest ( ClientPtr client );
 
278
extern void LbxWriteSConnSetupPrefix ( ClientPtr pClient, 
 
279
                                       xLbxConnSetupPrefix *pcsp );
 
280
extern void LbxSwapFontInfo ( xLbxFontInfo *pr, Bool compressed );
 
281
 
 
282
/* lbxzerorep.c */
 
283
extern void ZeroReplyPadBytes ( char *buf, int reqType );
 
284
 
 
285
#endif                          /* _LBXSERVE_H_ */