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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_VTsw.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
/*
 
2
 * (c) Copyright 1998 by Sebastien Marineau
 
3
 *                      <sebastien@qnx.com>
 
4
 *
 
5
 * Permission is hereby granted, free of charge, to any person obtaining a
 
6
 * copy of this software and associated documentation files (the "Software"),
 
7
 * to deal in the Software without restriction, including without limitation
 
8
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
9
 * and/or sell copies of the Software, and to permit persons to whom the
 
10
 * Software is furnished to do so, subject to the following conditions:
 
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
 
18
 * HOLGER VEIT  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 
19
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
 
20
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
21
 * SOFTWARE.
 
22
 *
 
23
 * Except as contained in this notice, the name of Sebastien Marineau shall not
 
24
 * used in advertising or otherwise to promote the sale, use or other dealings
 
25
 * in this Software without prior written authorization from Sebastien Marineau.
 
26
 *
 
27
 * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_VTsw.c,v 1.1 1999/12/27 00:45:47 robin Exp $
 
28
 */
 
29
 
 
30
/* This module contains the code to use _select_receive to handle
 
31
 * messages from the Mouse and Input driver. These cannot be select'ed on.
 
32
 */
 
33
 
 
34
/* This module contains the functions which are used to do 
 
35
 * VT switching to a text console and back... Experimental.
 
36
 */
 
37
#include "X.h"
 
38
#include "input.h"
 
39
#include "scrnintstr.h"
 
40
 
 
41
#include "xf86.h"
 
42
#include "xf86Priv.h"
 
43
#include "xf86_OSlib.h"
 
44
 
 
45
#include <sys/console.h>
 
46
 
 
47
int QNX_console_exist[10];
 
48
Bool QNX_vtswitch_pending = FALSE;
 
49
int QNX_con_toactivate = -1;
 
50
extern struct _console_ctrl *QNX_con_ctrl;
 
51
extern unsigned QNX_con_mask, QNX_con_bits;
 
52
extern pid_t QNX_console_proxy;
 
53
extern int QNX_our_console;
 
54
 
 
55
/* This gets called to determine if a VT switch has been requested */
 
56
Bool xf86VTSwitchPending()
 
57
{
 
58
        return(xf86Info.vtRequestsPending ? TRUE : FALSE);
 
59
}
 
60
 
 
61
/* This is called to do OS-specific stuff when we switch away from
 
62
 * our console.
 
63
 */
 
64
Bool xf86VTSwitchAway()
 
65
{
 
66
        int ret;
 
67
        unsigned event, bits;
 
68
 
 
69
        ErrorF("Called VT switch away!\n");
 
70
 
 
71
        /* First check wether we are trying to switch to our console... */
 
72
        if (xf86Info.vtRequestsPending == QNX_our_console) {
 
73
                xf86Info.vtRequestsPending = FALSE;
 
74
                return (FALSE);
 
75
                }
 
76
 
 
77
        /* Reenable console switching */
 
78
        QNX_con_bits &= ~QNX_con_mask;
 
79
        bits = console_ctrl(QNX_con_ctrl, -1, QNX_con_bits, QNX_con_mask);
 
80
        QNX_con_mask = 0;
 
81
 
 
82
        /* And activate the new console. Check if it is valid first... */
 
83
        ret = console_active(QNX_con_ctrl, xf86Info.vtRequestsPending);
 
84
        ErrorF("xf86VTSwitchAway: Made console %d active, ret %d\n", 
 
85
                xf86Info.vtRequestsPending, ret);
 
86
        xf86Info.vtRequestsPending = FALSE;
 
87
 
 
88
        if (ret == -1) {
 
89
                QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH;
 
90
                QNX_con_bits = console_ctrl (QNX_con_ctrl, 
 
91
                        QNX_our_console, QNX_con_mask, QNX_con_mask);
 
92
                return (FALSE);
 
93
                }
 
94
        /* Arm the console with the proxy so we know when we come back */
 
95
        console_state(QNX_con_ctrl, QNX_our_console, 0L, _CON_EVENT_ACTIVE); 
 
96
        event = _CON_EVENT_ACTIVE;
 
97
        console_arm (QNX_con_ctrl, QNX_our_console, QNX_console_proxy, event);
 
98
 
 
99
        return(TRUE);
 
100
}
 
101
 
 
102
/* And this is called when we are switching back to the server */
 
103
Bool xf86VTSwitchTo()
 
104
{
 
105
        unsigned bits, mask;
 
106
 
 
107
        ErrorF("Called VT switch to the server!\n");
 
108
        QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH;
 
109
        QNX_con_bits = console_ctrl (QNX_con_ctrl, QNX_our_console, QNX_con_mask, QNX_con_mask);
 
110
        xf86Info.vtRequestsPending = FALSE;
 
111
        return(TRUE);
 
112
}