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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/ilbm/ilbmbstore.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
/* $XFree86: xc/programs/Xserver/ilbm/ilbmbstore.c,v 3.0 1996/08/18 01:53:43 dawes Exp $ */
 
2
/* $XConsortium: ilbmbstore.c,v 5.7 94/04/17 20:28:18 dpw Exp $ */
 
3
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
 
4
/*
 
5
 
 
6
Copyright (c) 1987  X Consortium
 
7
 
 
8
Permission is hereby granted, free of charge, to any person obtaining
 
9
a copy of this software and associated documentation files (the
 
10
"Software"), to deal in the Software without restriction, including
 
11
without limitation the rights to use, copy, modify, merge, publish,
 
12
distribute, sublicense, and/or sell copies of the Software, and to
 
13
permit persons to whom the Software is furnished to do so, subject to
 
14
the following conditions:
 
15
 
 
16
The above copyright notice and this permission notice shall be included
 
17
in all copies or substantial portions of the Software.
 
18
 
 
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
20
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
21
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
22
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
 
23
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 
24
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
25
OTHER DEALINGS IN THE SOFTWARE.
 
26
 
 
27
Except as contained in this notice, the name of the X Consortium shall
 
28
not be used in advertising or otherwise to promote the sale, use or
 
29
other dealings in this Software without prior written authorization
 
30
from the X Consortium.
 
31
 
 
32
*/
 
33
 
 
34
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
 
35
   to use interleaved bitplanes instead of normal bitplanes */
 
36
 
 
37
#include        "ilbm.h"
 
38
#include        "X.h"
 
39
#include        "mibstore.h"
 
40
#include        "regionstr.h"
 
41
#include        "scrnintstr.h"
 
42
#include        "pixmapstr.h"
 
43
#include        "windowstr.h"
 
44
 
 
45
/*-
 
46
 *-----------------------------------------------------------------------
 
47
 * ilbmSaveAreas --
 
48
 *              Function called by miSaveAreas to actually fetch the areas to be
 
49
 *              saved into the backing pixmap. This is very simple to do, since
 
50
 *              ilbmDoBitblt is designed for this very thing. The region to save is
 
51
 *              already destination-relative and we're given the offset to the
 
52
 *              window origin, so we have only to create an array of points of the
 
53
 *              u.l. corners of the boxes in the region translated to the screen
 
54
 *              coordinate system and fetch the screen pixmap out of its devPrivate
 
55
 *              field....
 
56
 *
 
57
 * Results:
 
58
 *              None.
 
59
 *
 
60
 * Side Effects:
 
61
 *              Data are copied from the screen into the pixmap.
 
62
 *
 
63
 *-----------------------------------------------------------------------
 
64
 */
 
65
void
 
66
ilbmSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
 
67
        PixmapPtr                               pPixmap;                /* Backing pixmap */
 
68
        RegionPtr                               prgnSave;               /* Region to save (pixmap-relative) */
 
69
        int                                                     xorg;                                   /* X origin of region */
 
70
        int                                                     yorg;                                   /* Y origin of region */
 
71
        WindowPtr                               pWin;
 
72
{
 
73
        register DDXPointPtr pPt;
 
74
        DDXPointPtr                             pPtsInit;
 
75
        register BoxPtr         pBox;
 
76
        register int            numRects;
 
77
 
 
78
        numRects = REGION_NUM_RECTS(prgnSave);
 
79
        pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec));
 
80
        if (!pPtsInit)
 
81
                return;
 
82
 
 
83
        pBox = REGION_RECTS(prgnSave);
 
84
        pPt = pPtsInit;
 
85
        while (numRects--) {
 
86
                pPt->x = pBox->x1 + xorg;
 
87
                pPt->y = pBox->y1 + yorg;
 
88
                pPt++;
 
89
                pBox++;
 
90
        }
 
91
 
 
92
        ilbmDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivates[ilbmScreenPrivateIndex].ptr,
 
93
                                (DrawablePtr)pPixmap,
 
94
                                GXcopy,
 
95
                                prgnSave,
 
96
                                pPtsInit, wBackingBitPlanes (pWin));
 
97
 
 
98
        DEALLOCATE_LOCAL(pPtsInit);
 
99
}
 
100
 
 
101
/*-
 
102
 *-----------------------------------------------------------------------
 
103
 * ilbmRestoreAreas --
 
104
 *              Function called by miRestoreAreas to actually fetch the areas to be
 
105
 *              restored from the backing pixmap. This is very simple to do, since
 
106
 *              ilbmDoBitblt is designed for this very thing. The region to restore is
 
107
 *              already destination-relative and we're given the offset to the
 
108
 *              window origin, so we have only to create an array of points of the
 
109
 *              u.l. corners of the boxes in the region translated to the pixmap
 
110
 *              coordinate system and fetch the screen pixmap out of its devPrivate
 
111
 *              field....
 
112
 *
 
113
 * Results:
 
114
 *              None.
 
115
 *
 
116
 * Side Effects:
 
117
 *              Data are copied from the pixmap into the screen.
 
118
 *
 
119
 *-----------------------------------------------------------------------
 
120
 */
 
121
void
 
122
ilbmRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
 
123
        PixmapPtr                               pPixmap;                /* Backing pixmap */
 
124
        RegionPtr                               prgnRestore;            /* Region to restore (screen-relative)*/
 
125
        int                                                     xorg;                                   /* X origin of window */
 
126
        int                                                     yorg;                                   /* Y origin of window */
 
127
        WindowPtr                               pWin;
 
128
{
 
129
        register DDXPointPtr pPt;
 
130
        DDXPointPtr                             pPtsInit;
 
131
        register BoxPtr         pBox;
 
132
        register int            numRects;
 
133
 
 
134
        numRects = REGION_NUM_RECTS(prgnRestore);
 
135
        pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec));
 
136
        if (!pPtsInit)
 
137
                return;
 
138
 
 
139
        pBox = REGION_RECTS(prgnRestore);
 
140
        pPt = pPtsInit;
 
141
        while (numRects--) {
 
142
                pPt->x = pBox->x1 - xorg;
 
143
                pPt->y = pBox->y1 - yorg;
 
144
                pPt++;
 
145
                pBox++;
 
146
        }
 
147
 
 
148
        ilbmDoBitblt((DrawablePtr)pPixmap,
 
149
                                (DrawablePtr)pPixmap->drawable.pScreen->devPrivates[ilbmScreenPrivateIndex].ptr,
 
150
                                GXcopy,
 
151
                                prgnRestore,
 
152
                                pPtsInit, wBackingBitPlanes (pWin));
 
153
 
 
154
        DEALLOCATE_LOCAL(pPtsInit);
 
155
}