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

« back to all changes in this revision

Viewing changes to unix/xc/lib/X11/PrOfId.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: PrOfId.c,v 1.3 2000/08/17 19:44:48 cpqbld Exp $ */
 
2
 
 
3
/*
 
4
 * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
 
5
 *      All Rights Reserved
 
6
 * 
 
7
 * This file is a component of an X Window System-specific implementation
 
8
 * of Xcms based on the TekColor Color Management System.  Permission is
 
9
 * hereby granted to use, copy, modify, sell, and otherwise distribute this
 
10
 * software and its documentation for any purpose and without fee, provided
 
11
 * that this copyright, permission, and disclaimer notice is reproduced in
 
12
 * all copies of this software and in supporting documentation.  TekColor
 
13
 * is a trademark of Tektronix, Inc.
 
14
 * 
 
15
 * Tektronix makes no representation about the suitability of this software
 
16
 * for any purpose.  It is provided "as is" and with all faults.
 
17
 * 
 
18
 * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
 
19
 * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 
20
 * PARTICULAR PURPOSE.  IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
 
21
 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
 
22
 * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
 
23
 * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 
24
 * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
 
25
 *
 
26
 *
 
27
 *      NAME
 
28
 *              XcmsPrOfId.c
 
29
 *
 
30
 *      DESCRIPTION
 
31
 *              Source for XcmsPrefixOfFormat()
 
32
 *
 
33
 *
 
34
 */
 
35
 
 
36
#include "Xlibint.h"
 
37
#include "Xcmsint.h"
 
38
 
 
39
/*
 
40
 *      EXTERNS
 
41
 */
 
42
extern XcmsColorSpace **_XcmsDIColorSpaces;
 
43
extern XcmsColorSpace **_XcmsDDColorSpaces;
 
44
 
 
45
 
 
46
/*
 
47
 *      NAME
 
48
 *              XcmsPrefixOfId
 
49
 *
 
50
 *      SYNOPSIS
 
51
 */
 
52
char *
 
53
XcmsPrefixOfFormat(id)
 
54
    XcmsColorFormat     id;
 
55
/*
 
56
 *      DESCRIPTION
 
57
 *              Returns the color space prefix for the specified color
 
58
 *              space ID if the color space is found in the Color
 
59
 *              Conversion Context.
 
60
 *
 
61
 *      RETURNS
 
62
 *              Returns a color space prefix.
 
63
 *
 
64
 *      CAVEATS
 
65
 *              Space is allocated for the returned string, therefore,
 
66
 *              the application is responsible for freeing (using XFree)
 
67
 *              the space.
 
68
 *
 
69
 */
 
70
{
 
71
    XcmsColorSpace      **papColorSpaces;
 
72
    char *prefix;
 
73
 
 
74
    /*
 
75
     * First try Device-Independent color spaces
 
76
     */
 
77
    papColorSpaces = _XcmsDIColorSpaces;
 
78
    if (papColorSpaces != NULL) {
 
79
        while (*papColorSpaces != NULL) {
 
80
            if ((*papColorSpaces)->id == id) {
 
81
                prefix = (char *)Xmalloc((strlen((*papColorSpaces)->prefix) +
 
82
                1) * sizeof(char));
 
83
                strcpy(prefix, (*papColorSpaces)->prefix);
 
84
                return(prefix);
 
85
            }
 
86
            papColorSpaces++;
 
87
        }
 
88
    }
 
89
 
 
90
    /*
 
91
     * Next try Device-Dependent color spaces
 
92
     */
 
93
    papColorSpaces = _XcmsDDColorSpaces;
 
94
    if (papColorSpaces != NULL) {
 
95
        while (*papColorSpaces != NULL) {
 
96
            if ((*papColorSpaces)->id == id) {
 
97
                prefix = (char *)Xmalloc((strlen((*papColorSpaces)->prefix) +
 
98
                1) * sizeof(char));
 
99
                strcpy(prefix, (*papColorSpaces)->prefix);
 
100
                return(prefix);
 
101
            }
 
102
            papColorSpaces++;
 
103
        }
 
104
    }
 
105
 
 
106
    return(NULL);
 
107
}