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

« back to all changes in this revision

Viewing changes to unix/xc/lib/XThrStub/UIThrStubs.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
 * $XFree86: xc/lib/XThrStub/UIThrStubs.c,v 3.4 2003/01/15 02:55:16 dawes Exp $
 
3
 *
 
4
 * Copyright (c) 1995 David E. Wexelblat.  All rights reserved
 
5
 *
 
6
 * Permission is hereby granted, free of charge, to any person obtaining
 
7
 * a copy of this software and associated documentation files (the
 
8
 * "Software"), to deal in the Software without restriction, including
 
9
 * without limitation the rights to use, copy, modify, merge, publish,
 
10
 * distribute, sublicense, and/or sell copies of the Software, and to
 
11
 * permit persons to whom the Software is furnished to do so, subject to
 
12
 * the following conditions:
 
13
 * 
 
14
 * The above copyright notice and this permission notice shall be included
 
15
 * in all copies or substantial portions of the Software.
 
16
 * 
 
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
18
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
19
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
20
 * IN NO EVENT SHALL DAVID E. WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR
 
21
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 
22
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
23
 * OTHER DEALINGS IN THE SOFTWARE.
 
24
 * 
 
25
 * Except as contained in this notice, the name of David E. Wexelblat shall
 
26
 * not be used in advertising or otherwise to promote the sale, use or
 
27
 * other dealings in this Software without prior written authorization
 
28
 * from David E. Wexelblat.
 
29
 * 
 
30
 */
 
31
 
 
32
/*
 
33
 * Stubs for thread functions needed by the X library.  Supports 
 
34
 * UnixWare 2.x threads; may support Solaris 2 threads as well, but not
 
35
 * tested.  Defining things this way removes the dependency of the X
 
36
 * library on the threads library, but still supports threads if the user
 
37
 * specificies the thread library on the link line.
 
38
 */
 
39
 
 
40
/*
 
41
 * Modifications by Carlos A M dos Santos, XFree86 Project, November 1999.
 
42
 *
 
43
 * Explanation from <X11/Xos_r.h>:
 
44
 * The structure below is complicated, mostly because P1003.1c (the
 
45
 * IEEE POSIX Threads spec) went through lots of drafts, and some
 
46
 * vendors shipped systems based on draft API that were changed later.
 
47
 * Unfortunately POSIX did not provide a feature-test macro for
 
48
 * distinguishing each of the drafts.
 
49
 */
 
50
 
 
51
#ifdef CTHREADS
 
52
#include <cthreads.h>
 
53
typedef cthread_t xthread_t;
 
54
#define xthread_self cthread_self
 
55
#pragma weak cthread_self = _Xthr_self_stub_
 
56
#define xmutex_init mutex_init
 
57
#pragma weak mutex_init = _Xthr_zero_stub_
 
58
#pragma weak mutex_clear = _Xthr_zero_stub_
 
59
#pragma weak mutex_lock = _Xthr_zero_stub_
 
60
#pragma weak mutex_unlock = _Xthr_zero_stub_
 
61
#pragma weak condition_init = _Xthr_zero_stub_
 
62
#pragma weak condition_clear = _Xthr_zero_stub_
 
63
#pragma weak condition_wait = _Xthr_zero_stub_
 
64
#pragma weak condition_signal = _Xthr_zero_stub_
 
65
#pragma weak condition_broadcast = _Xthr_zero_stub_
 
66
#else /* !CTHREADS */
 
67
#if defined(SVR4) && !defined(__sgi)
 
68
#include <thread.h>
 
69
typedef thread_t xthread_t;
 
70
#pragma weak thr_self = _Xthr_self_stub_
 
71
#pragma weak mutex_init = _Xthr_zero_stub_
 
72
#pragma weak mutex_destroy = _Xthr_zero_stub_
 
73
#pragma weak mutex_lock = _Xthr_zero_stub_
 
74
#pragma weak mutex_unlock = _Xthr_zero_stub_
 
75
#pragma weak cond_init = _Xthr_zero_stub_
 
76
#pragma weak cond_destroy = _Xthr_zero_stub_
 
77
#pragma weak cond_wait = _Xthr_zero_stub_
 
78
#pragma weak cond_signal = _Xthr_zero_stub_
 
79
#pragma weak cond_broadcast = _Xthr_zero_stub_
 
80
#else /* !SVR4 */
 
81
#ifdef WIN32
 
82
    /*
 
83
     * Don't know what to do here. Is there something do be done at all?
 
84
     */
 
85
#else /* !WIN32 */
 
86
#ifdef USE_TIS_SUPPORT
 
87
#include <tis.h>
 
88
typedef pthread_t xthread_t;
 
89
#pragma weak tis_self = _Xthr_self_stub_
 
90
#pragma weak tis_mutex_init = _Xthr_zero_stub_
 
91
#pragma weak tis_mutex_destroy = _Xthr_zero_stub_
 
92
#pragma weak tis_mutex_lock = _Xthr_zero_stub_
 
93
#pragma weak tis_mutex_unlock = _Xthr_zero_stub_
 
94
#pragma weak tis_cond_init = _Xthr_zero_stub_
 
95
#pragma weak tis_cond_destroy = _Xthr_zero_stub_
 
96
#pragma weak tis_cond_wait = _Xthr_zero_stub_
 
97
#pragma weak tis_cond_signal = _Xthr_zero_stub_
 
98
#pragma weak tis_cond_broadcast = _Xthr_zero_stub_
 
99
#else
 
100
#include <pthread.h>
 
101
typedef pthread_t xthread_t;
 
102
#if __GNUC__ >= 3
 
103
xthread_t pthread_self()    __attribute__ ((weak, alias ("_Xthr_self_stub_")));
 
104
int pthread_mutex_init()    __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
105
int pthread_mutex_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
106
int pthread_mutex_lock()    __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
107
int pthread_mutex_unlock()  __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
108
int pthread_cond_init()     __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
109
int pthread_cond_destroy()  __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
110
int pthread_cond_wait()     __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
111
int pthread_cond_signal()   __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
112
int pthread_cond_broadcast() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
113
int pthread_key_create()    __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
114
void *pthread_getspecific()  __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
115
int pthread_setspecific()   __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
 
116
#else   /* __GNUC__ */
 
117
#pragma weak pthread_self = _Xthr_self_stub_
 
118
#pragma weak pthread_mutex_init = _Xthr_zero_stub_
 
119
#pragma weak pthread_mutex_destroy = _Xthr_zero_stub_
 
120
#pragma weak pthread_mutex_lock = _Xthr_zero_stub_
 
121
#pragma weak pthread_mutex_unlock = _Xthr_zero_stub_
 
122
#pragma weak pthread_cond_init = _Xthr_zero_stub_
 
123
#pragma weak pthread_cond_destroy = _Xthr_zero_stub_
 
124
#pragma weak pthread_cond_wait = _Xthr_zero_stub_
 
125
#pragma weak pthread_cond_signal = _Xthr_zero_stub_
 
126
#pragma weak pthread_cond_broadcast = _Xthr_zero_stub_
 
127
/* These are added for libGL */
 
128
#pragma weak pthread_key_create = _Xthr_zero_stub_
 
129
#pragma weak pthread_getspecific = _Xthr_zero_stub_
 
130
#pragma weak pthread_setspecific = _Xthr_zero_stub_
 
131
#endif  /* __GNUC__ */
 
132
#if defined(_DECTHREADS_) || defined(linux)
 
133
#pragma weak pthread_equal = _Xthr_equal_stub_  /* See Xthreads.h! */
 
134
int
 
135
_Xthr_equal_stub_()
 
136
{
 
137
    return(1);
 
138
}
 
139
#endif /* _DECTHREADS_ || linux */
 
140
#endif /* USE_TIS_SUPPORT */
 
141
#endif /* WIN32 */
 
142
#endif /* SVR4 */
 
143
#endif /* CTHREADS */
 
144
 
 
145
static xthread_t 
 
146
_Xthr_self_stub_()
 
147
{
 
148
    static xthread_t _X_no_thread_id;
 
149
 
 
150
    return(_X_no_thread_id);    /* defined by <X11/Xthreads.h> */
 
151
}
 
152
 
 
153
static int 
 
154
_Xthr_zero_stub_()
 
155
{
 
156
    return(0);
 
157
}