~sbeattie/ubuntu/lucid/vnc4/lp556147

« back to all changes in this revision

Viewing changes to unix/xc/extras/X-TrueType/DOSENCODING/main.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
/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */
 
2
/* ===FileName: ===
 
3
   Copyright (c) 1998 Takuya SHIOZAKI, All Rights reserved.
 
4
   Copyright (c) 1998 X-TrueType Server Project, All rights reserved. 
 
5
   Copyright (c) 1998,1999 Pablo Saratxaga <srtxg@chanae.alphanet.ch>
 
6
   
 
7
===Notice
 
8
   Redistribution and use in source and binary forms, with or without
 
9
   modification, are permitted provided that the following conditions
 
10
   are met:
 
11
   1. Redistributions of source code must retain the above copyright
 
12
      notice, this list of conditions and the following disclaimer.
 
13
   2. Redistributions in binary form must reproduce the above copyright
 
14
      notice, this list of conditions and the following disclaimer in the
 
15
      documentation and/or other materials provided with the distribution.
 
16
 
 
17
   THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 
18
   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
19
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
20
   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 
21
   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
22
   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 
23
   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
24
   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
25
   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 
26
   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
27
   SUCH DAMAGE.
 
28
 
 
29
   Major Release ID: X-TrueType Server Version 1.3 [Aoi MATSUBARA Release 3]
 
30
 
 
31
Notice===
 
32
 
 
33
    Table build by looking into the unicode chart, and various DOS
 
34
    and Windows fonts, DOS manuals and GNU libc internationalization
 
35
    charset tables.
 
36
 
 
37
    support for those encodings may seem useless for X11, but doesmu users
 
38
    can appreciate it, as well as users of any kind of DOS emulator.
 
39
    Also several True Type fonts made primarly for Windows are completly
 
40
    broken, that is the unicode codes they told are wrong, they claim to
 
41
    be cp1252 while they are not. So the alias -misc-fontspecific can
 
42
    be helpfull to use TTF fonts wrongly encoded (that is the case of
 
43
    all the vietnamese fonts I've seen so far, they have to be called
 
44
    whith -misc-fontspecific instead of -viscii1.1-1 *sigh*)
 
45
 
 
46
 */
 
47
 
 
48
#include "xttversion.h"
 
49
 
 
50
static char const * const releaseID =
 
51
    _XTT_RELEASE_NAME;
 
52
 
 
53
#include "xttcommon.h"
 
54
#include "xttcap.h"
 
55
#include "xttcconv.h"
 
56
#include "xttcconvP.h"
 
57
 
 
58
 
 
59
typedef enum
 
60
{
 
61
    CP437,
 
62
    CP850,
 
63
    CP1252
 
64
} CharSetMagic;
 
65
 
 
66
static CharSetRelation const charSetRelations[] = {
 
67
    { "ibm",       NULL,        "cp437",  CP437,  { 0x00, 0xff, 0, 0, 0x20 } },
 
68
    { "ibm",       NULL,        "cp850",  CP850,  { 0x00, 0xff, 0, 0, 0x20 } },
 
69
    { "microsoft", NULL,       "cp1252", CP1252,  { 0x00, 0xff, 0, 0, 0x20 } },
 
70
    { "ansi",      NULL,            "0", CP1252,  { 0x00, 0xff, 0, 0, 0x20 } },
 
71
    { "microsoft", NULL,       "win3.1", CP1252,  { 0x00, 0xff, 0, 0, 0x20 } },
 
72
    { "microsoft", NULL, "fontspecific", CP1252,  { 0x00, 0xff, 0, 0, 0x20 } },
 
73
    { "misc",      NULL, "fontspecific", CP1252,  { 0x00, 0xff, 0, 0, 0x20 } },
 
74
    { NULL, NULL, NULL, 0, { 0, 0, 0, 0, 0 } }
 
75
};
 
76
 
 
77
 
 
78
CODECONV_TEMPLATE(cc_cp437_to_ucs2);
 
79
CODECONV_TEMPLATE(cc_cp850_to_ucs2);
 
80
CODECONV_TEMPLATE(cc_cp1252_to_ucs2);
 
81
static MapIDRelation const mapIDRelations[] = {
 
82
    { CP437,    EPlfmISO,     EEncISO10646,    cc_cp437_to_ucs2,    NULL },
 
83
    { CP437,    EPlfmUnicode, EEncAny,         cc_cp437_to_ucs2,    NULL },
 
84
    { CP437,    EPlfmMS,      EEncMSUnicode,   cc_cp437_to_ucs2,    NULL },
 
85
    { CP850,    EPlfmISO,     EEncISO10646,    cc_cp850_to_ucs2,    NULL },
 
86
    { CP850,    EPlfmUnicode, EEncAny,         cc_cp850_to_ucs2,    NULL },
 
87
    { CP850,    EPlfmMS,      EEncMSUnicode,   cc_cp850_to_ucs2,    NULL },
 
88
    { CP1252,   EPlfmISO,     EEncISO10646,    cc_cp1252_to_ucs2,   NULL },
 
89
    { CP1252,   EPlfmUnicode, EEncAny,         cc_cp1252_to_ucs2,   NULL },
 
90
    { CP1252,   EPlfmMS,      EEncMSUnicode,   cc_cp1252_to_ucs2,   NULL },
 
91
    { -1, 0, 0, NULL, NULL }
 
92
};
 
93
 
 
94
STD_ENTRYFUNC_TEMPLATE(DOSENCODING_entrypoint)
 
95
 
 
96
/* end of file */