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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_plain.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: css_plain.c,v 1.4 2001/02/09 02:04:11 xorgcvs Exp $ */
 
2
/*
 
3
 
 
4
Copyright 1989, 1990, 1991, 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
 
13
in all copies or substantial portions of the Software.
 
14
 
 
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
16
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
17
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
18
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
 
19
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 
20
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
21
OTHER DEALINGS IN THE SOFTWARE.
 
22
 
 
23
Except as contained in this notice, the name of The Open Group shall
 
24
not be used in advertising or otherwise to promote the sale, use or
 
25
other dealings in this Software without prior written authorization
 
26
from The Open Group.
 
27
 
 
28
 
 
29
Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. 
 
30
All Rights Reserved
 
31
 
 
32
Permission to use, copy, modify, and distribute this software and its
 
33
documentation for any purpose and without fee is hereby granted,
 
34
provided that the above copyright notice appear in all copies and that
 
35
both that copyright notice and this permission notice appear in
 
36
supporting documentation, and that the name of Sun Microsystems
 
37
not be used in advertising or publicity pertaining to distribution
 
38
of the software without specific, written prior permission.
 
39
 
 
40
SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
41
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
 
42
SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
 
43
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
44
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
45
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
46
SOFTWARE.
 
47
 
 
48
*/
 
49
/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/css_plain.c,v 1.10 2001/12/14 19:57:34 dawes Exp $ */
 
50
/*
 
51
 * this file contains the element handling procedures for elements
 
52
 * which are stored in the format they are received.  This includes
 
53
 * PEX elements stored in PEX format and any imp. dep. elements which
 
54
 * are not defined by PEX.
 
55
 */
 
56
 
 
57
#include "ddpex.h"
 
58
#include "miStrMacro.h"
 
59
#include "pexos.h"
 
60
 
 
61
 
 
62
extern ocTableType ParseOCTable[];
 
63
extern destroyTableType DestroyOCTable[];
 
64
extern ocTableType CopyOCTable[];
 
65
extern ocTableType InquireOCTable[];
 
66
extern ocTableType ReplaceOCTable[];
 
67
 
 
68
#define SET_STR_HEADER(pStruct, pheader)                                \
 
69
    register miStructPtr pheader = (miStructPtr) pStruct->deviceData
 
70
 
 
71
#define PEX_EL_TYPE(POC) ((ddElementInfo *)(POC))->elementType
 
72
 
 
73
 
 
74
ddpex4rtn
 
75
createCSS_Plain(pStruct, pPEXOC, ppCSSElement)
 
76
/* in */
 
77
        diStructHandle  pStruct;
 
78
        ddPointer       pPEXOC;
 
79
/* out */
 
80
        miGenericElementStr **ppCSSElement;
 
81
{
 
82
        ddpex4rtn       err = Success;
 
83
        SET_STR_HEADER(pStruct, pheader);
 
84
 
 
85
        *ppCSSElement = (miGenericElementPtr) NULL;
 
86
 
 
87
        /*
 
88
         * Parse into server native format
 
89
         * If we make it here OC is either proprietary or valid PEXOC
 
90
         * still need to check proprietary to avoid Null Function Ptrs
 
91
         */
 
92
        if (MI_HIGHBIT_ON(PEX_EL_TYPE(pPEXOC)))
 
93
                err = (*ParseOCTable[MI_OC_PROP]) (pPEXOC, ppCSSElement);
 
94
        else
 
95
                err = (*ParseOCTable[PEX_EL_TYPE(pPEXOC)])
 
96
                        (pPEXOC, ppCSSElement);
 
97
 
 
98
        if (err != Success)
 
99
                return (PEXERR(PEXOutputCommandError));
 
100
 
 
101
        (*ppCSSElement)->pStruct = pStruct;
 
102
        (*ppCSSElement)->element.pexOClength =
 
103
                ((ddElementInfo *) pPEXOC)->length;     /* protocol size, not
 
104
                                                         * parsed size */
 
105
        (*ppCSSElement)->element.elementType =
 
106
                ((ddElementInfo *) pPEXOC)->elementType;
 
107
 
 
108
        MISTR_NUM_EL(pheader)++;
 
109
        MISTR_LENGTH(pheader) += ((ddElementInfo *) pPEXOC)->length;
 
110
 
 
111
        return (Success);
 
112
}
 
113
 
 
114
ddpex4rtn
 
115
destroyCSS_Plain(pStruct, pCSSElement)
 
116
/* in */
 
117
        diStructHandle  pStruct;
 
118
        miGenericElementPtr pCSSElement;
 
119
/* out */
 
120
{
 
121
        ddpex4rtn       err = Success;
 
122
        SET_STR_HEADER(pStruct, pheader);
 
123
 
 
124
        MISTR_NUM_EL(pheader)--;
 
125
        MISTR_LENGTH(pheader) -= MISTR_EL_LENGTH(pCSSElement);
 
126
 
 
127
        /*
 
128
         * Free the parsed format
 
129
         * If we make it here OC is either proprietary or valid PEXOC
 
130
         * still need to check proprietary to avoid Null Function Ptrs
 
131
         * even though we use the same destroy routine
 
132
         */
 
133
 
 
134
        if (MI_HIGHBIT_ON(pCSSElement->element.elementType))
 
135
            (*DestroyOCTable[MI_OC_PROP]) (pCSSElement);
 
136
        else 
 
137
            (*DestroyOCTable[(int) (pCSSElement->element.elementType)])
 
138
                (pCSSElement);
 
139
 
 
140
        return (err);
 
141
}
 
142
 
 
143
ddpex4rtn
 
144
copyCSS_Plain(pSrcCSSElement, pDestStruct, ppDestCSSElement)
 
145
/* in */
 
146
        miGenericElementPtr pSrcCSSElement;
 
147
        diStructHandle  pDestStruct;
 
148
/* out */
 
149
        miGenericElementStr **ppDestCSSElement;
 
150
{
 
151
        ddpex4rtn       err = Success;
 
152
        SET_STR_HEADER(pDestStruct, pheader);
 
153
 
 
154
        *ppDestCSSElement = (miGenericElementPtr) NULL;
 
155
 
 
156
        /*
 
157
         * If we make it here OC is either proprietary or valid PEXOC
 
158
         * still need to check proprietary to avoid Null Function Ptrs
 
159
        */
 
160
        if (MI_HIGHBIT_ON(pSrcCSSElement->element.elementType))
 
161
            err = (*CopyOCTable[MI_OC_PROP])
 
162
                    (pSrcCSSElement, ppDestCSSElement);
 
163
        else 
 
164
            err = (*CopyOCTable[(int) (pSrcCSSElement->element.elementType)])
 
165
                    (pSrcCSSElement, ppDestCSSElement);
 
166
 
 
167
        if (err != Success)
 
168
                return (err);
 
169
 
 
170
        (*ppDestCSSElement)->pStruct = pDestStruct;
 
171
        (*ppDestCSSElement)->element.pexOClength =
 
172
                pSrcCSSElement->element.pexOClength;
 
173
        (*ppDestCSSElement)->element.elementType =
 
174
                pSrcCSSElement->element.elementType;
 
175
 
 
176
        MISTR_NUM_EL(pheader)++;
 
177
        MISTR_LENGTH(pheader) += MISTR_EL_LENGTH(*ppDestCSSElement);
 
178
 
 
179
        return (Success);
 
180
}
 
181
 
 
182
ddpex4rtn
 
183
replaceCSS_Plain(pStruct, pCSSElement, pPEXOC)
 
184
        diStructHandle  pStruct;
 
185
        miGenericElementPtr pCSSElement;
 
186
        ddElementInfo  *pPEXOC;
 
187
{
 
188
        ddpex4rtn       err = Success;
 
189
 
 
190
        /*
 
191
         * If we make it here OC is either proprietary or valid PEXOC
 
192
         * still need to check proprietary to avoid Null Function Ptrs
 
193
        */
 
194
        if (MI_HIGHBIT_ON(pCSSElement->element.elementType))
 
195
            err = (*ReplaceOCTable[MI_OC_PROP]) (pPEXOC, &pCSSElement);
 
196
        else 
 
197
            err = (*ReplaceOCTable[(int) (pCSSElement->element.elementType)])
 
198
                    (pPEXOC, &pCSSElement);
 
199
 
 
200
        if (err == Success) {
 
201
                pCSSElement->pStruct = pStruct;
 
202
                pCSSElement->element.elementType = pPEXOC->elementType;
 
203
                pCSSElement->element.pexOClength = pPEXOC->length;
 
204
        }
 
205
        return (err);
 
206
}
 
207
 
 
208
ddpex4rtn
 
209
inquireCSS_Plain(pCSSElement, pBuf, ppPEXOC)
 
210
        miGenericElementPtr pCSSElement;
 
211
        ddBuffer       *pBuf;
 
212
        ddElementInfo  **ppPEXOC;
 
213
{
 
214
        ddpex4rtn       err = Success;
 
215
 
 
216
        /*
 
217
         * If we make it here OC is either proprietary or valid PEXOC
 
218
         * still need to check proprietary to avoid Null Function Ptrs
 
219
        */
 
220
        if (MI_HIGHBIT_ON(pCSSElement->element.elementType))
 
221
            err = (*InquireOCTable[MI_OC_PROP]) (pCSSElement, pBuf, ppPEXOC);
 
222
        else 
 
223
            err = (*InquireOCTable[(int) (pCSSElement->element.elementType)])
 
224
                    (pCSSElement, pBuf, ppPEXOC);
 
225
        return (err);
 
226
}