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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_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
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_VTsw.c,v 3.6 1998/07/25 16:56:33 dawes Exp $ */
 
2
/*
 
3
 * Derived from VTsw_usl.c which is
 
4
 * Copyright 1993 by David Wexelblat <dwex@goblin.org>
 
5
 * by S_ren Schmidt (sos@login.dkuug.dk)
 
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, and that the name of David Wexelblat not be used in
 
12
 * advertising or publicity pertaining to distribution of the software without
 
13
 * specific, written prior permission.  David Wexelblat makes no representations
 
14
 * about the suitability of this software for any purpose.  It is provided
 
15
 * "as is" without express or implied warranty.
 
16
 *
 
17
 * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
18
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 
19
 * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
20
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 
21
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 
22
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
23
 * PERFORMANCE OF THIS SOFTWARE.
 
24
 *
 
25
 */
 
26
/* $XConsortium: bsd_VTsw.c /main/4 1996/02/21 17:50:57 kaleb $ */
 
27
 
 
28
#include "X.h"
 
29
#include "xf86.h"
 
30
#include "xf86Priv.h"
 
31
#include "xf86_OSlib.h"
 
32
 
 
33
/*
 
34
 * Handle the VT-switching interface for OSs that use USL-style ioctl()s
 
35
 * (the bsd, sysv, sco, and linux subdirs).
 
36
 */
 
37
 
 
38
/*
 
39
 * This function is the signal handler for the VT-switching signal.  It
 
40
 * is only referenced inside the OS-support layer.
 
41
 */
 
42
void
 
43
xf86VTRequest(int sig)
 
44
{
 
45
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
 
46
        if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
 
47
                xf86Info.vtRequestsPending = TRUE;
 
48
        }       
 
49
#endif
 
50
        return;
 
51
}
 
52
 
 
53
Bool
 
54
xf86VTSwitchPending()
 
55
{
 
56
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
 
57
        if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
 
58
                return(xf86Info.vtRequestsPending ? TRUE : FALSE);
 
59
        }
 
60
#endif
 
61
        return FALSE;
 
62
}
 
63
 
 
64
Bool
 
65
xf86VTSwitchAway()
 
66
{
 
67
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
 
68
        if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
 
69
                xf86Info.vtRequestsPending = FALSE;
 
70
                if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
 
71
                        return(FALSE);
 
72
                else
 
73
                        return(TRUE);
 
74
        }
 
75
#endif
 
76
        return FALSE;
 
77
}
 
78
 
 
79
Bool
 
80
xf86VTSwitchTo()
 
81
{
 
82
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
 
83
        if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
 
84
                xf86Info.vtRequestsPending = FALSE;
 
85
                if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
 
86
                        return(FALSE);
 
87
                else
 
88
                        return(TRUE);
 
89
        }
 
90
#endif
 
91
        return(TRUE);
 
92
}