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

« back to all changes in this revision

Viewing changes to unix/xc/lib/Xt/ActionHook.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: ActionHook.c,v 1.4 2001/02/09 02:03:53 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
/* $XFree86: xc/lib/Xt/ActionHook.c,v 1.3 2001/12/14 19:56:05 dawes Exp $ */
 
64
 
 
65
/* 
 
66
 * Contains XtAppAddActionHook, XtRemoveActionHook
 
67
 */
 
68
 
 
69
#include "IntrinsicI.h"
 
70
 
 
71
 
 
72
/*ARGSUSED*/
 
73
static void FreeActionHookList(
 
74
    Widget widget,              /* unused (and invalid) */
 
75
    XtPointer closure,          /* ActionHook* */
 
76
    XtPointer call_data)        /* unused */
 
77
{
 
78
    ActionHook list = *(ActionHook*)closure;
 
79
    while (list != NULL) {
 
80
        ActionHook next = list->next;
 
81
        XtFree( (XtPointer)list );
 
82
        list = next;
 
83
    }
 
84
}
 
85
 
 
86
 
 
87
XtActionHookId XtAppAddActionHook( app, proc, closure )
 
88
    XtAppContext app;
 
89
    XtActionHookProc proc;
 
90
    XtPointer closure;
 
91
{
 
92
    ActionHook hook = XtNew(ActionHookRec);
 
93
    LOCK_APP(app);
 
94
    hook->next = app->action_hook_list;
 
95
    hook->app = app;
 
96
    hook->proc = proc;
 
97
    hook->closure = closure;
 
98
    if (app->action_hook_list == NULL) {
 
99
        _XtAddCallback( &app->destroy_callbacks,
 
100
                        FreeActionHookList,
 
101
                        (XtPointer)&app->action_hook_list
 
102
                      );
 
103
    }
 
104
    app->action_hook_list = hook;
 
105
    UNLOCK_APP(app);
 
106
    return (XtActionHookId)hook;
 
107
}
 
108
 
 
109
 
 
110
void XtRemoveActionHook( id )
 
111
    XtActionHookId id;
 
112
{
 
113
    ActionHook *p, hook = (ActionHook)id;
 
114
    XtAppContext app = hook->app;
 
115
    LOCK_APP(app);
 
116
    for (p = &app->action_hook_list; p != NULL && *p != hook; p = &(*p)->next);
 
117
    if (p) {
 
118
        *p = hook->next;
 
119
        XtFree( (XtPointer)hook );
 
120
        if (app->action_hook_list == NULL)
 
121
            _XtRemoveCallback(&app->destroy_callbacks, FreeActionHookList,
 
122
                              (XtPointer) &app->action_hook_list);
 
123
    }
 
124
#ifdef DEBUG
 
125
    else {
 
126
        XtAppWarningMsg(app, "badId", "xtRemoveActionHook", XtCXtToolkitError,
 
127
                        "XtRemoveActionHook called with bad or old hook id",
 
128
                        (String*)NULL, (Cardinal*)NULL);
 
129
    }
 
130
#endif /*DEBUG*/
 
131
    UNLOCK_APP(app);
 
132
}