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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/kdrive/kinfo.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
 * Id: kinfo.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
 
3
 *
 
4
 * Copyright � 1999 Keith Packard
 
5
 *
 
6
 * Permission to use, copy, modify, distribute, and sell this software and its
 
7
 * documentation for any purpose is hereby granted without fee, provided that
 
8
 * the above copyright notice appear in all copies and that both that
 
9
 * copyright notice and this permission notice appear in supporting
 
10
 * documentation, and that the name of Keith Packard not be used in
 
11
 * advertising or publicity pertaining to distribution of the software without
 
12
 * specific, written prior permission.  Keith Packard makes no
 
13
 * representations about the suitability of this software for any purpose.  It
 
14
 * is provided "as is" without express or implied warranty.
 
15
 *
 
16
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
17
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 
18
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
19
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 
20
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 
21
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
22
 * PERFORMANCE OF THIS SOFTWARE.
 
23
 */
 
24
/* $XFree86: xc/programs/Xserver/hw/kdrive/kinfo.c,v 1.3 2001/10/12 06:33:07 keithp Exp $ */
 
25
 
 
26
#include "kdrive.h"
 
27
 
 
28
KdCardInfo  *kdCardInfo;
 
29
 
 
30
KdCardInfo *
 
31
KdCardInfoAdd (KdCardFuncs  *funcs,
 
32
               KdCardAttr   *attr,
 
33
               void         *closure)
 
34
{
 
35
    KdCardInfo  *ci, **prev;
 
36
 
 
37
    ci = (KdCardInfo *) xalloc (sizeof (KdCardInfo));
 
38
    if (!ci)
 
39
        return 0;
 
40
    bzero (ci, sizeof (KdCardInfo));
 
41
    for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
 
42
    *prev = ci;
 
43
    ci->cfuncs = funcs;
 
44
    ci->attr = *attr;
 
45
    ci->closure = closure;
 
46
    ci->screenList = 0;
 
47
    ci->selected = 0;
 
48
    ci->next = 0;
 
49
    return ci;
 
50
}
 
51
 
 
52
KdCardInfo *
 
53
KdCardInfoLast (void)
 
54
{
 
55
    KdCardInfo  *ci;
 
56
 
 
57
    if (!kdCardInfo)
 
58
        return 0;
 
59
    for (ci = kdCardInfo; ci->next; ci = ci->next);
 
60
    return ci;
 
61
}
 
62
 
 
63
void
 
64
KdCardInfoDispose (KdCardInfo *ci)
 
65
{
 
66
    KdCardInfo  **prev;
 
67
 
 
68
    for (prev = &kdCardInfo; *prev; prev = &(*prev)->next)
 
69
        if (*prev == ci)
 
70
        {
 
71
            *prev = ci->next;
 
72
            xfree (ci);
 
73
            break;
 
74
        }
 
75
}
 
76
 
 
77
KdScreenInfo *
 
78
KdScreenInfoAdd (KdCardInfo *ci)
 
79
{
 
80
    KdScreenInfo    *si, **prev;
 
81
    int             n;
 
82
 
 
83
    si = (KdScreenInfo *) xalloc (sizeof (KdScreenInfo));
 
84
    if (!si)
 
85
        return 0;
 
86
    bzero (si, sizeof (KdScreenInfo));
 
87
    for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
 
88
    *prev = si;
 
89
    si->next = 0;
 
90
    si->card = ci;
 
91
    si->mynum = n;
 
92
    return si;
 
93
}
 
94
 
 
95
void
 
96
KdScreenInfoDispose (KdScreenInfo *si)
 
97
{
 
98
    KdCardInfo      *ci = si->card;
 
99
    KdScreenInfo    **prev;
 
100
 
 
101
    for (prev = &ci->screenList; *prev; prev = &(*prev)->next)
 
102
        if (*prev == si)
 
103
        {
 
104
            *prev = si->next;
 
105
            xfree (si);
 
106
            if (!ci->screenList)
 
107
                KdCardInfoDispose (ci);
 
108
            break;
 
109
        }
 
110
}
 
111
 
 
112
KdMouseInfo *kdMouseInfo;
 
113
 
 
114
KdMouseInfo *
 
115
KdMouseInfoAdd (void)
 
116
{
 
117
    KdMouseInfo *mi, **prev;
 
118
 
 
119
    mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
 
120
    if (!mi)
 
121
        return 0;
 
122
    bzero (mi, sizeof (KdMouseInfo));
 
123
    for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
 
124
    *prev = mi;
 
125
    return mi;
 
126
}
 
127
 
 
128
void
 
129
KdMouseInfoDispose (KdMouseInfo *mi)
 
130
{
 
131
    KdMouseInfo **prev;
 
132
 
 
133
    for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
 
134
        if (*prev == mi)
 
135
        {
 
136
            *prev = mi->next;
 
137
            if (mi->name)
 
138
                xfree (mi->name);
 
139
            if (mi->prot)
 
140
                xfree (mi->prot);
 
141
            xfree (mi);
 
142
            break;
 
143
        }
 
144
}