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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/Xi/chgprop.c

  • 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: chgprop.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
 
2
 
 
3
/************************************************************
 
4
 
 
5
Copyright 1989, 1998  The Open Group
 
6
 
 
7
Permission to use, copy, modify, distribute, and sell this software and its
 
8
documentation for any purpose is hereby granted without fee, provided that
 
9
the above copyright notice appear in all copies and that both that
 
10
copyright notice and this permission notice appear in supporting
 
11
documentation.
 
12
 
 
13
The above copyright notice and this permission notice shall be included in
 
14
all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
19
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
22
 
 
23
Except as contained in this notice, the name of The Open Group shall not be
 
24
used in advertising or otherwise to promote the sale, use or other dealings
 
25
in this Software without prior written authorization from The Open Group.
 
26
 
 
27
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
 
28
 
 
29
                        All Rights Reserved
 
30
 
 
31
Permission to use, copy, modify, and distribute this software and its
 
32
documentation for any purpose and without fee is hereby granted,
 
33
provided that the above copyright notice appear in all copies and that
 
34
both that copyright notice and this permission notice appear in
 
35
supporting documentation, and that the name of Hewlett-Packard not be
 
36
used in advertising or publicity pertaining to distribution of the
 
37
software without specific, written prior permission.
 
38
 
 
39
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 
40
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 
41
HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 
42
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
43
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
44
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
45
SOFTWARE.
 
46
 
 
47
********************************************************/
 
48
/* $XFree86: xc/programs/Xserver/Xi/chgprop.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
 
49
 
 
50
/***********************************************************************
 
51
 *
 
52
 * Function to modify the dont-propagate-list for an extension input device.
 
53
 *
 
54
 */
 
55
 
 
56
#define  NEED_EVENTS
 
57
#define  NEED_REPLIES
 
58
#include "X.h"                          /* for inputstr.h    */
 
59
#include "Xproto.h"                     /* Request macro     */
 
60
#include "inputstr.h"                   /* DeviceIntPtr      */
 
61
#include "windowstr.h"
 
62
#include "XI.h"
 
63
#include "XIproto.h"
 
64
#include "extnsionst.h"
 
65
#include "extinit.h"                    /* LookupDeviceIntRec */
 
66
 
 
67
#include "exevents.h"
 
68
#include "exglobals.h"
 
69
 
 
70
#include "chgprop.h"
 
71
#include "grabdev.h"
 
72
 
 
73
/***********************************************************************
 
74
 *
 
75
 * This procedure returns the extension version.
 
76
 *
 
77
 */
 
78
 
 
79
int
 
80
SProcXChangeDeviceDontPropagateList(client)
 
81
    register ClientPtr client;
 
82
    {
 
83
    register char n;
 
84
    register long *p;
 
85
    register int i;
 
86
 
 
87
    REQUEST(xChangeDeviceDontPropagateListReq);
 
88
    swaps(&stuff->length, n);
 
89
    REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
 
90
    swapl(&stuff->window, n);
 
91
    swaps(&stuff->count, n);
 
92
    p = (long *) &stuff[1];
 
93
    for (i=0; i<stuff->count; i++)
 
94
        {
 
95
        swapl(p, n);
 
96
        p++;
 
97
        }
 
98
    return(ProcXChangeDeviceDontPropagateList(client));
 
99
    }
 
100
 
 
101
/***********************************************************************
 
102
 *
 
103
 * This procedure changes the dont-propagate list for the specified window.
 
104
 *
 
105
 */
 
106
 
 
107
int
 
108
ProcXChangeDeviceDontPropagateList (client)
 
109
    register ClientPtr client;
 
110
    {
 
111
    int                 i;
 
112
    WindowPtr           pWin;
 
113
    struct              tmask tmp[EMASKSIZE];
 
114
    OtherInputMasks     *others;
 
115
 
 
116
    REQUEST(xChangeDeviceDontPropagateListReq);
 
117
    REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
 
118
 
 
119
    if (stuff->length !=(sizeof(xChangeDeviceDontPropagateListReq)>>2) + 
 
120
        stuff->count)
 
121
        {
 
122
        SendErrorToClient (client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
 
123
            BadLength);
 
124
        return Success;
 
125
        }
 
126
 
 
127
    pWin = (WindowPtr) LookupWindow (stuff->window, client);
 
128
    if (!pWin)
 
129
        {
 
130
        client->errorValue = stuff->window;
 
131
        SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, 
 
132
                BadWindow);
 
133
        return Success;
 
134
        }
 
135
 
 
136
    if (stuff->mode != AddToList && stuff->mode != DeleteFromList)
 
137
        {
 
138
        client->errorValue = stuff->window;
 
139
        SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, 
 
140
                BadMode);
 
141
        return Success;
 
142
        }
 
143
 
 
144
    if (CreateMaskFromList (client, (XEventClass *)&stuff[1], 
 
145
        stuff->count, tmp, NULL, X_ChangeDeviceDontPropagateList) != Success)
 
146
            return Success;
 
147
 
 
148
    others = wOtherInputMasks(pWin);
 
149
    if (!others && stuff->mode == DeleteFromList)
 
150
        return Success;
 
151
    for (i=0; i<EMASKSIZE; i++)
 
152
        {
 
153
        if (tmp[i].mask == 0)
 
154
            continue;
 
155
 
 
156
        if (stuff->mode == DeleteFromList)
 
157
            tmp[i].mask = (others->dontPropagateMask[i] & ~tmp[i].mask);
 
158
        else if (others)
 
159
            tmp[i].mask |= others->dontPropagateMask[i];
 
160
 
 
161
        if (DeviceEventSuppressForWindow (pWin,client,tmp[i].mask,i) != Success)
 
162
            {
 
163
            SendErrorToClient ( client, IReqCode, X_ChangeDeviceDontPropagateList, 0, 
 
164
                BadClass);
 
165
            return Success;
 
166
            }
 
167
        }
 
168
 
 
169
    return Success;
 
170
    }