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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.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
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c,v 3.17 2003/02/17 15:11:58 dawes Exp $ */
 
2
/*
 
3
 * (c) Copyright 1994,1999 by Holger Veit
 
4
 *                      <Holger.Veit@gmd.de>
 
5
 * Modified 1996 by Sebastien Marineau <marineau@genie.uottawa.ca>
 
6
 *
 
7
 * Permission is hereby granted, free of charge, to any person obtaining a 
 
8
 * copy of this software and associated documentation files (the "Software"), 
 
9
 * to deal in the Software without restriction, including without limitation 
 
10
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 
11
 * and/or sell copies of the Software, and to permit persons to whom the 
 
12
 * Software is furnished to do so, subject to the following conditions:
 
13
 *
 
14
 * The above copyright notice and this permission notice shall be included in
 
15
 * all copies or substantial portions of the Software.
 
16
 * 
 
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
18
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
19
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL 
 
20
 * HOLGER VEIT  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
 
21
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 
 
22
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
 
23
 * SOFTWARE.
 
24
 * 
 
25
 * Except as contained in this notice, the name of Holger Veit shall not be
 
26
 * used in advertising or otherwise to promote the sale, use or other dealings
 
27
 * in this Software without prior written authorization from Holger Veit.
 
28
 *
 
29
 */
 
30
/* $XConsortium: os2_io.c /main/9 1996/05/13 16:38:07 kaleb $ */
 
31
 
 
32
#define I_NEED_OS2_H
 
33
#include "X.h"
 
34
#include "Xpoll.h"
 
35
#include "compiler.h"
 
36
#include <time.h>
 
37
 
 
38
#define INCL_DOSPROCESS
 
39
#define INCL_KBD
 
40
#define INCL_MOU
 
41
#include "xf86.h"
 
42
#include "xf86Priv.h"
 
43
#include "xf86_OSlib.h"
 
44
 
 
45
int os2MouseQueueQuery();
 
46
int os2KbdQueueQuery();
 
47
void os2RecoverFromPopup();
 
48
void os2CheckPopupPending();
 
49
extern BOOL os2PopupErrorPending;
 
50
int _select2 (int, fd_set *, fd_set *,fd_set *, struct timeval *);
 
51
 
 
52
 
 
53
/***************************************************************************/
 
54
 
 
55
void xf86SoundKbdBell(loudness, pitch, duration)
 
56
int loudness;
 
57
int pitch;
 
58
int duration;
 
59
{
 
60
        DosBeep((ULONG)pitch, (ULONG)duration);
 
61
}
 
62
 
 
63
void xf86SetKbdLeds(leds)
 
64
int leds;
 
65
{
 
66
        KBDINFO kinfo;
 
67
        APIRET rc;
 
68
 
 
69
        rc = KbdGetStatus(&kinfo,(HKBD)xf86Info.consoleFd);
 
70
        if (!rc) {
 
71
                kinfo.fsMask = 0x10;
 
72
                kinfo.fsState &= ~0x70;
 
73
                kinfo.fsState |= (leds&0x70);
 
74
                KbdSetStatus(&kinfo,(HKBD)xf86Info.consoleFd);
 
75
        }
 
76
}
 
77
 
 
78
int xf86GetKbdLeds()
 
79
{
 
80
        KBDINFO kinfo;
 
81
        APIRET rc;
 
82
 
 
83
        rc = KbdGetStatus(&kinfo,(HKBD)xf86Info.consoleFd);
 
84
        return rc ? 0 : kinfo.fsState & 0x70;
 
85
}
 
86
 
 
87
#if NeedFunctionPrototypes
 
88
void xf86SetKbdRepeat(char rad)
 
89
#else
 
90
void xf86SetKbdRepeat(rad)
 
91
char rad;
 
92
#endif
 
93
{
 
94
        /*notyet*/
 
95
}
 
96
 
 
97
void xf86KbdInit()
 
98
{
 
99
        /*none required*/
 
100
}
 
101
 
 
102
 
 
103
USHORT OrigKbdState;
 
104
USHORT OrigKbdInterim;
 
105
 
 
106
typedef struct {
 
107
    USHORT state;
 
108
    UCHAR makeCode;
 
109
    UCHAR breakCode;
 
110
    USHORT keyID;
 
111
} HOTKEYPARAM;
 
112
 
 
113
 
 
114
int xf86KbdOn()
 
115
{
 
116
        KBDINFO info;
 
117
        APIRET rc;
 
118
        int i,k;
 
119
        ULONG len;
 
120
 
 
121
 
 
122
        KbdGetStatus(&info,(HKBD)xf86Info.consoleFd);
 
123
        OrigKbdState=info.fsMask;
 
124
        OrigKbdInterim=info.fsInterim;
 
125
        info.fsMask &= ~0x09;
 
126
        info.fsMask |= 0x136;
 
127
        info.fsInterim &= ~0x20;
 
128
        KbdSetStatus(&info,(HKBD)xf86Info.consoleFd);
 
129
        return -1;
 
130
}
 
131
 
 
132
int xf86KbdOff()
 
133
{
 
134
        ULONG len;
 
135
        APIRET rc;
 
136
        KBDINFO info;
 
137
 
 
138
        info.fsMask=OrigKbdState;
 
139
        info.fsInterim=OrigKbdInterim;
 
140
        KbdSetStatus(&info,(HKBD)xf86Info.consoleFd);
 
141
        return -1;
 
142
}
 
143
 
 
144
#if 0 /*OBSOLETE*/
 
145
void xf86MouseInit(mouse)
 
146
MouseDevPtr mouse;
 
147
{
 
148
        HMOU fd;
 
149
        APIRET rc;
 
150
        USHORT nbut;
 
151
 
 
152
        if (serverGeneration == 1) {
 
153
                rc = MouOpen((PSZ)NULL,(PHMOU)&fd);
 
154
                if (rc != 0)
 
155
                        FatalError("Cannot open mouse, rc=%d\n", rc);
 
156
                        mouse->mseFd = fd;
 
157
        }
 
158
        
 
159
        /* flush mouse queue */
 
160
        MouFlushQue(fd);
 
161
 
 
162
        /* check buttons */
 
163
        rc = MouGetNumButtons(&nbut,fd);
 
164
        if (rc == 0)
 
165
                xf86Msg(X_INFO,"OsMouse has %d button(s).\n",nbut);
 
166
}
 
167
#endif
 
168
 
 
169
#if 0 /*OBSOLETE*/
 
170
int xf86MouseOn(mouse)
 
171
MouseDevPtr mouse;
 
172
{
 
173
#if 0
 
174
        HMOU fd;
 
175
        APIRET rc;
 
176
        USHORT nbut;
 
177
#endif
 
178
        xf86Msg (X_ERROR,
 
179
                "Calling MouseOn, a bad thing.... Must be some bug in the code!\n");
 
180
 
 
181
#if 0
 
182
        if (serverGeneration == 1) {
 
183
                rc = MouOpen((PSZ)NULL,(PHMOU)&fd);
 
184
                if (rc != 0)
 
185
                        FatalError("Cannot open mouse, rc=%d\n", rc);
 
186
                        mouse->mseFd = fd;
 
187
        }
 
188
        
 
189
        /* flush mouse queue */
 
190
        MouFlushQue(fd);
 
191
 
 
192
        /* check buttons */
 
193
        rc = MouGetNumButtons(&nbut,fd);
 
194
        if (rc == 0)
 
195
                xf86Msg(X_INFO,"OsMouse has %d button(s).\n",nbut);
 
196
 
 
197
        return (mouse->mseFd);
 
198
#endif
 
199
}
 
200
#endif
 
201
 
 
202
#if 0 /*OBSOLETE*/
 
203
/* This table is a bit irritating, because these mouse types are infact
 
204
 * defined in the OS/2 kernel, but I want to force the user to put
 
205
 * "OsMouse" in the config file, and not worry about the particular mouse
 
206
 * type that is connected.
 
207
 */
 
208
Bool xf86SupportedMouseTypes[] =
 
209
{
 
210
        FALSE,  /* Microsoft */
 
211
        FALSE,  /* MouseSystems */
 
212
        FALSE,  /* MMSeries */
 
213
        FALSE,  /* Logitech */
 
214
        FALSE,  /* BusMouse */
 
215
        FALSE,  /* MouseMan */
 
216
        FALSE,  /* PS/2 */
 
217
        FALSE,  /* Hitachi Tablet */
 
218
};
 
219
 
 
220
int xf86NumMouseTypes = sizeof(xf86SupportedMouseTypes) /
 
221
                        sizeof(xf86SupportedMouseTypes[0]);
 
222
#endif
 
223
 
 
224
#include "xf86OSKbd.h"
 
225
 
 
226
Bool
 
227
xf86OSKbdPreInit(InputInfoPtr pInfo)
 
228
{
 
229
    return FALSE;
 
230
}