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

« back to all changes in this revision

Viewing changes to unix/xc/lib/Xt/GetActKey.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: GetActKey.c,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */
 
2
 
 
3
/*LINTLIBRARY*/
 
4
 
 
5
/***********************************************************
 
6
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
 
7
Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
 
8
 
 
9
                        All Rights Reserved
 
10
 
 
11
Permission to use, copy, modify, and distribute this software and its 
 
12
documentation for any purpose and without fee is hereby granted, 
 
13
provided that the above copyright notice appear in all copies and that
 
14
both that copyright notice and this permission notice appear in 
 
15
supporting documentation, and that the names of Digital or Sun not be
 
16
used in advertising or publicity pertaining to distribution of the
 
17
software without specific, written prior permission.  
 
18
 
 
19
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 
20
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 
21
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 
22
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
23
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
24
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
25
SOFTWARE.
 
26
 
 
27
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
 
28
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
 
29
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
 
30
ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 
31
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
 
32
PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
 
33
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
 
34
THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
35
 
 
36
******************************************************************/
 
37
 
 
38
/*
 
39
 
 
40
Copyright 1987, 1988, 1998  The Open Group
 
41
 
 
42
Permission to use, copy, modify, distribute, and sell this software and its
 
43
documentation for any purpose is hereby granted without fee, provided that
 
44
the above copyright notice appear in all copies and that both that
 
45
copyright notice and this permission notice appear in supporting
 
46
documentation.
 
47
 
 
48
The above copyright notice and this permission notice shall be included in
 
49
all copies or substantial portions of the Software.
 
50
 
 
51
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
52
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
53
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
54
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
55
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
56
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
57
 
 
58
Except as contained in this notice, the name of The Open Group shall not be
 
59
used in advertising or otherwise to promote the sale, use or other dealings
 
60
in this Software without prior written authorization from The Open Group.
 
61
 
 
62
*/
 
63
 
 
64
#include "IntrinsicI.h"
 
65
 
 
66
KeySym XtGetActionKeysym(event, modifiers_return)
 
67
    XEvent *event;
 
68
    Modifiers *modifiers_return;
 
69
{
 
70
    TMKeyContext tm_context;
 
71
    Modifiers modifiers;
 
72
    KeySym keysym, retval;
 
73
 
 
74
    LOCK_PROCESS;
 
75
    tm_context= _XtGetPerDisplay(event->xany.display)->tm_context;
 
76
    if (event->xany.type != KeyPress && event->xany.type != KeyRelease) {
 
77
        UNLOCK_PROCESS;
 
78
        return NoSymbol;
 
79
    }
 
80
    if (tm_context != NULL
 
81
        && event == tm_context->event
 
82
        && event->xany.serial == tm_context->serial ) {
 
83
 
 
84
        if (modifiers_return != NULL)
 
85
            *modifiers_return = tm_context->modifiers;
 
86
        retval = tm_context->keysym;
 
87
        UNLOCK_PROCESS;
 
88
        return retval;
 
89
    }
 
90
 
 
91
    XtTranslateKeycode( event->xany.display, (KeyCode)event->xkey.keycode,
 
92
                        event->xkey.state, &modifiers, &keysym );
 
93
 
 
94
    if (modifiers_return != NULL)
 
95
        *modifiers_return = event->xkey.state & modifiers;
 
96
 
 
97
    UNLOCK_PROCESS;
 
98
    return keysym;
 
99
}