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

« back to all changes in this revision

Viewing changes to unix/xc/lib/X11/CopyGC.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: CopyGC.c,v 1.4 2001/02/09 02:03:32 xorgcvs Exp $ */
 
2
/*
 
3
 
 
4
Copyright 1986, 1998  The Open Group
 
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.
 
11
 
 
12
The above copyright notice and this permission notice shall be included in
 
13
all copies or substantial portions of the Software.
 
14
 
 
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
21
 
 
22
Except as contained in this notice, the name of The Open Group shall not be
 
23
used in advertising or otherwise to promote the sale, use or other dealings
 
24
in this Software without prior written authorization from The Open Group.
 
25
 
 
26
*/
 
27
/* $XFree86: xc/lib/X11/CopyGC.c,v 1.4 2001/12/14 19:53:59 dawes Exp $ */
 
28
 
 
29
#include "Xlibint.h"
 
30
 
 
31
int
 
32
XCopyGC (dpy, srcGC, mask, destGC)
 
33
     register Display *dpy;
 
34
     unsigned long mask;                /* which ones to set initially */
 
35
     GC srcGC, destGC;
 
36
{
 
37
    register XGCValues *destgv = &destGC->values,
 
38
                       *srcgv = &srcGC->values;
 
39
    register xCopyGCReq *req;
 
40
    register _XExtension *ext;
 
41
 
 
42
    LockDisplay(dpy);
 
43
 
 
44
    mask &= (1L << (GCLastBit + 1)) - 1;
 
45
    /* if some of the source values to be copied are "dirty", flush them 
 
46
       out before sending the CopyGC request. */
 
47
    if (srcGC->dirty & mask)
 
48
         _XFlushGCCache(dpy, srcGC);
 
49
 
 
50
    /* mark the copied values "not dirty" in the destination. */
 
51
    destGC->dirty &= ~mask;
 
52
 
 
53
    GetReq(CopyGC, req);
 
54
    req->srcGC = srcGC->gid;
 
55
    req->dstGC = destGC->gid;
 
56
    req->mask = mask;
 
57
 
 
58
    if (mask & GCFunction)
 
59
        destgv->function = srcgv->function;
 
60
        
 
61
    if (mask & GCPlaneMask)
 
62
        destgv->plane_mask = srcgv->plane_mask;
 
63
 
 
64
    if (mask & GCForeground)
 
65
        destgv->foreground = srcgv->foreground;
 
66
 
 
67
    if (mask & GCBackground)
 
68
        destgv->background = srcgv->background;
 
69
 
 
70
    if (mask & GCLineWidth)
 
71
        destgv->line_width = srcgv->line_width;
 
72
 
 
73
    if (mask & GCLineStyle)
 
74
        destgv->line_style = srcgv->line_style;
 
75
 
 
76
    if (mask & GCCapStyle)
 
77
        destgv->cap_style = srcgv->cap_style;
 
78
    
 
79
    if (mask & GCJoinStyle)
 
80
        destgv->join_style = srcgv->join_style;
 
81
 
 
82
    if (mask & GCFillStyle)
 
83
        destgv->fill_style = srcgv->fill_style;
 
84
 
 
85
    if (mask & GCFillRule) 
 
86
        destgv->fill_rule = srcgv->fill_rule;
 
87
 
 
88
    if (mask & GCArcMode)
 
89
        destgv->arc_mode = srcgv->arc_mode;
 
90
 
 
91
    if (mask & GCTile)
 
92
        destgv->tile = srcgv->tile;
 
93
 
 
94
    if (mask & GCStipple)
 
95
        destgv->stipple = srcgv->stipple;
 
96
 
 
97
    if (mask & GCTileStipXOrigin)
 
98
        destgv->ts_x_origin = srcgv->ts_x_origin;
 
99
 
 
100
    if (mask & GCTileStipYOrigin)
 
101
        destgv->ts_y_origin = srcgv->ts_y_origin;
 
102
 
 
103
    if (mask & GCFont) 
 
104
        destgv->font = srcgv->font;
 
105
 
 
106
    if (mask & GCSubwindowMode) 
 
107
        destgv->subwindow_mode = srcgv->subwindow_mode;
 
108
 
 
109
    if (mask & GCGraphicsExposures) 
 
110
        destgv->graphics_exposures = srcgv->graphics_exposures;
 
111
 
 
112
    if (mask & GCClipXOrigin) 
 
113
        destgv->clip_x_origin = srcgv->clip_x_origin;
 
114
 
 
115
    if (mask & GCClipYOrigin) 
 
116
        destgv->clip_y_origin = srcgv->clip_y_origin;
 
117
 
 
118
    if (mask & GCClipMask) {
 
119
        destGC->rects = srcGC->rects;
 
120
        destgv->clip_mask = srcgv->clip_mask;
 
121
        }
 
122
 
 
123
    if (mask & GCDashOffset) 
 
124
        destgv->dash_offset = srcgv->dash_offset;
 
125
 
 
126
    if (mask & GCDashList) {
 
127
        destGC->dashes = srcGC->dashes;
 
128
        destgv->dashes = srcgv->dashes;
 
129
        }
 
130
    /* call out to any extensions interested */
 
131
    for (ext = dpy->ext_procs; ext; ext = ext->next)
 
132
        if (ext->copy_GC) (*ext->copy_GC)(dpy, destGC, &ext->codes);
 
133
    UnlockDisplay(dpy);
 
134
    SyncHandle();
 
135
    return 1;
 
136
    }