X Strike Force XFree86 SVN commit: r2260 - in branches/4.1.0/woody/debian: . patches
Author: dnusinow
Date: 2005-05-15 15:55:07 -0500 (Sun, 15 May 2005)
New Revision: 2260
Added:
branches/4.1.0/woody/debian/patches/077_SECURITY_more_libXpm_vulnerabilities.diff
Modified:
branches/4.1.0/woody/debian/changelog
branches/4.1.0/woody/debian/patches/400_hppa_support.diff
Log:
- Backport Xpm from X.org 6.8.2 in order to fix #308783, which allows the
Xpm s_popen function to potentially overwrite user's files. This function
was removed wholesale in upstream, which is why the massive backport fix.
- Update patch 400_hppa_support.diff to not attempt to patch XpmI.h,
because this hunk is made obsolete by the above.
- Increment changelog for woody7 release
Modified: branches/4.1.0/woody/debian/changelog
===================================================================
--- branches/4.1.0/woody/debian/changelog 2005-05-15 18:03:38 UTC (rev 2259)
+++ branches/4.1.0/woody/debian/changelog 2005-05-15 20:55:07 UTC (rev 2260)
@@ -1,3 +1,15 @@
+xfree86 (4.1.0-16woody7) UNRELEASED; urgency=high
+
+ * Security update release. Resolves the following issue:
+ + Xpm's s_popen was unsafe and potentially allowed for user files to be
+ overwritten. Changes from X.org 6.8.2 to Xpm applied as patch
+ 077_SECURITY_more_libXpm_vulnerabilities.diff. (Closes: #308783)
+
+ * Update patch 400_hppa_support.diff to not attempt to patch XpmI.h, because
+ this hunk is made obsolete by the above.
+
+ -- Branden Robinson <branden@debian.org> Thu, 10 Mar 2005 17:08:14 -0500
+
xfree86 (4.1.0-16woody6) stable-security; urgency=high
* Security update release. Resolves the following issue:
Added: branches/4.1.0/woody/debian/patches/077_SECURITY_more_libXpm_vulnerabilities.diff
===================================================================
--- branches/4.1.0/woody/debian/patches/077_SECURITY_more_libXpm_vulnerabilities.diff 2005-05-15 18:03:38 UTC (rev 2259)
+++ branches/4.1.0/woody/debian/patches/077_SECURITY_more_libXpm_vulnerabilities.diff 2005-05-15 20:55:07 UTC (rev 2260)
@@ -0,0 +1,1001 @@
+diff -ruN xc-old/extras/Xpm/cxpm/cxpm.c xc/extras/Xpm/cxpm/cxpm.c
+--- xc-old/extras/Xpm/cxpm/cxpm.c Mon Jan 11 05:23:13 1999
++++ xc/extras/Xpm/cxpm/cxpm.c Sun May 15 19:03:14 2005
+@@ -22,6 +22,7 @@
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Arnaud LE HORS.
+ */
++/* $XFree86: xc/extras/Xpm/cxpm/cxpm.c,v 1.2 2001/08/01 00:44:34 tsi Exp $ */
+
+ /*****************************************************************************\
+ * cxpm.c: *
+@@ -46,8 +47,9 @@
+ * note that 's' could stand both for "special" and "slow" ;-)
+ */
+ static int
+-sGetc(data)
++sGetc(data, file)
+ xpmData *data;
++ FILE *file;
+ {
+ int c = getc(data->stream.file);
+ if (c == '\n') {
+@@ -60,9 +62,10 @@
+ }
+
+ static void
+-sUngetc(data, c)
++sUngetc(data, c, file)
+ xpmData *data;
+ int c;
++ FILE *file;
+ {
+ ungetc(c, data->stream.file);
+ if (c == '\n') {
+@@ -117,6 +120,7 @@
+ }
+ }
+
++int
+ main(argc, argv)
+ int argc;
+ char **argv;
+diff -ruN xc-old/extras/Xpm/lib/Attrib.c xc/extras/Xpm/lib/Attrib.c
+--- xc-old/extras/Xpm/lib/Attrib.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/Attrib.c Sun May 15 19:03:14 2005
+@@ -54,7 +54,7 @@
+ XpmColor **colorTable, **color;
+ unsigned int a;
+
+- if (ncolors >= UINT_MAX / sizeof(XpmColor *))
++ if (ncolors >= UINT_MAX / sizeof(XpmColor *))
+ return XpmNoMemory;
+
+ colorTable = (XpmColor **) XpmMalloc(ncolors * sizeof(XpmColor *));
+diff -ruN xc-old/extras/Xpm/lib/CrBufFrI.c xc/extras/Xpm/lib/CrBufFrI.c
+--- xc-old/extras/Xpm/lib/CrBufFrI.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/CrBufFrI.c Sun May 15 19:03:14 2005
+@@ -34,6 +34,8 @@
+
+ /* October 2004, source code review by Thomas Biege <thomas@suse.de> */
+
++/* $XFree86$ */
++
+ #include "XpmI.h"
+
+ LFUNC(WriteColors, int, (char **dataptr, unsigned int *data_size,
+diff -ruN xc-old/extras/Xpm/lib/CrDatFrI.c xc/extras/Xpm/lib/CrDatFrI.c
+--- xc-old/extras/Xpm/lib/CrDatFrI.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/CrDatFrI.c Sun May 15 19:03:14 2005
+@@ -31,6 +31,7 @@
+ * *
+ * Developed by Arnaud Le Hors *
+ \*****************************************************************************/
++/* $XFree86$ */
+
+ /* October 2004, source code review by Thomas Biege <thomas@suse.de> */
+
+@@ -131,7 +132,7 @@
+ /* 2nd check superfluous if we do not need header_nlines any further */
+ if(header_nlines <= image->ncolors ||
+ header_nlines >= UINT_MAX / sizeof(char *))
+- return(XpmNoMemory);
++ return(XpmNoMemory);
+
+ header_size = sizeof(char *) * header_nlines;
+ if (header_size >= UINT_MAX / sizeof(char *))
+@@ -262,7 +263,7 @@
+ s = buf + cpp;
+
+ if(sizeof(buf) <= (s-buf))
+- return XpmNoMemory;
++ return XpmNoMemory;
+
+ for (key = 1; key <= NKEYS; key++, defaults++) {
+ if ((s2 = *defaults)) {
+@@ -276,7 +277,7 @@
+ #endif
+ /* does s point out-of-bounds? */
+ if(sizeof(buf) < (s-buf))
+- return XpmNoMemory;
++ return XpmNoMemory;
+ }
+ }
+ /* what about using strdup()? */
+diff -ruN xc-old/extras/Xpm/lib/Imakefile xc/extras/Xpm/lib/Imakefile
+--- xc-old/extras/Xpm/lib/Imakefile Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/Imakefile Sun May 15 19:03:14 2005
+@@ -104,15 +104,13 @@
+ CrBufFrI.c CrDatFrP.c CrPFrBuf.c RdFToI.c WrFFrI.c \
+ CrBufFrP.c CrIFrBuf.c CrPFrDat.c RdFToP.c WrFFrP.c \
+ CrDatFrI.c CrIFrDat.c RdFToDat.c WrFFrDat.c \
+- Attrib.c CrIFrP.c CrPFrI.c Image.c Info.c RdFToBuf.c WrFFrBuf.c \
+- s_popen.c
++ Attrib.c CrIFrP.c CrPFrI.c Image.c Info.c RdFToBuf.c WrFFrBuf.c
+
+ OBJS = data.o create.o misc.o rgb.o scan.o parse.o hashtab.o \
+ CrBufFrI.o CrDatFrP.o CrPFrBuf.o RdFToI.o WrFFrI.o \
+ CrBufFrP.o CrIFrBuf.o CrPFrDat.o RdFToP.o WrFFrP.o \
+ CrDatFrI.o CrIFrDat.o RdFToDat.o WrFFrDat.o \
+- Attrib.o CrIFrP.o CrPFrI.o Image.o Info.o RdFToBuf.o WrFFrBuf.o \
+- s_popen.o
++ Attrib.o CrIFrP.o CrPFrI.o Image.o Info.o RdFToBuf.o WrFFrBuf.o
+
+ INCLUDES = -I.
+ LINTLIBS = $(LINTXTOLL) $(LINTXLIB)
+diff -ruN xc-old/extras/Xpm/lib/RdFToI.c xc/extras/Xpm/lib/RdFToI.c
+--- xc-old/extras/Xpm/lib/RdFToI.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/RdFToI.c Sun May 15 19:03:14 2005
+@@ -31,19 +31,16 @@
+ * *
+ * Developed by Arnaud Le Hors *
+ \*****************************************************************************/
++/* $XFree86$ */
+
+ /* October 2004, source code review by Thomas Biege <thomas@suse.de> */
+
+ #include "XpmI.h"
+-#include <sys/stat.h>
+-#if !defined(NO_ZPIPE) && defined(WIN32)
+-# define popen _popen
+-# define pclose _pclose
+-# if defined(STAT_ZFILE)
+-# include <io.h>
+-# define stat _stat
+-# define fstat _fstat
+-# endif
++#ifndef NO_ZPIPE
++#include <fcntl.h>
++#include <errno.h>
++#include <sys/types.h>
++#include <sys/wait.h>
+ #endif
+
+ LFUNC(OpenReadFile, int, (char *filename, xpmData *mdata));
+@@ -121,89 +118,131 @@
+ }
+ #endif /* CXPMPROG */
+
+-/*
+- * open the given file to be read as an xpmData which is returned.
+- */
+ #ifndef NO_ZPIPE
+- FILE *s_popen(char *cmd, const char *type);
+-#else
+-# define s_popen popen
++/* Do not depend on errno after read_through */
++FILE*
++xpmPipeThrough(fd, cmd, arg1, mode)
++ int fd;
++ const char* cmd;
++ const char* arg1;
++ const char* mode;
++{
++ FILE* fp;
++ int status, fds[2], in = 0, out = 1;
++ pid_t pid;
++ if ( 'w' == *mode )
++ out = 0, in = 1;
++ if ( pipe(fds) < 0 )
++ return NULL;
++ pid = fork();
++ if ( pid < 0 )
++ goto fail1;
++ if ( 0 == pid )
++ {
++ close(fds[in]);
++ if ( dup2(fds[out], out) < 0 )
++ goto err;
++ close(fds[out]);
++ if ( dup2(fd, in) < 0 )
++ goto err;
++ close(fd);
++ pid = fork();
++ if ( pid < 0 )
++ goto err;
++ if ( 0 == pid )
++ {
++ execlp(cmd, cmd, arg1, NULL);
++ perror(cmd);
++ goto err;
++ }
++ _exit(0);
++ err:
++ _exit(1);
++ }
++ close(fds[out]);
++ /* calling process: wait for first child */
++ while ( waitpid(pid, &status, 0) < 0 && EINTR == errno )
++ ;
++ if ( WIFSIGNALED(status) ||
++ (WIFEXITED(status) && WEXITSTATUS(status) != 0) )
++ goto fail2;
++ fp = fdopen(fds[in], mode);
++ if ( !fp )
++ goto fail2;
++ close(fd); /* still open in 2nd child */
++ return fp;
++fail1:
++ close(fds[out]);
++fail2:
++ close(fds[in]);
++ return NULL;
++}
+ #endif
+
++/*
++ * open the given file to be read as an xpmData which is returned.
++ */
+ static int
+ OpenReadFile(filename, mdata)
+ char *filename;
+ xpmData *mdata;
+ {
+-#ifndef NO_ZPIPE
+- char buf[BUFSIZ];
+-# ifdef STAT_ZFILE
+- char *compressfile;
+- struct stat status;
+-# endif
+-#endif
+-
+ if (!filename) {
+ mdata->stream.file = (stdin);
+ mdata->type = XPMFILE;
+ } else {
+-#ifndef NO_ZPIPE
+- size_t len = strlen(filename);
+-
+- if (len == 0)
+- return(XpmOpenFailed);
+- if ((len > 2) && !strcmp(".Z", filename + (len - 2))) {
+- mdata->type = XPMPIPE;
+- snprintf(buf, sizeof(buf), "uncompress -c \"%s\"", filename);
+- if (!(mdata->stream.file = s_popen(buf, "r")))
+- return (XpmOpenFailed);
+-
+- } else if ((len > 3) && !strcmp(".gz", filename + (len - 3))) {
+- mdata->type = XPMPIPE;
+- snprintf(buf, sizeof(buf), "gunzip -qc \"%s\"", filename);
+- if (!(mdata->stream.file = s_popen(buf, "r")))
+- return (XpmOpenFailed);
+-
+- } else {
+-# ifdef STAT_ZFILE
+- if (!(compressfile = (char *) XpmMalloc(len + 4)))
++ int fd = open(filename, O_RDONLY);
++#if defined(NO_ZPIPE)
++ if ( fd < 0 )
++ return XpmOpenFailed;
++#else
++ const char* ext = NULL;
++ if ( fd >= 0 )
++ ext = strrchr(filename, '.');
++#ifdef STAT_ZFILE /* searching for z-files if the given name not found */
++ else
++ {
++ size_t len = strlen(filename);
++ char *compressfile = (char *) XpmMalloc(len + 4);
++ if ( !compressfile )
+ return (XpmNoMemory);
+-
+- snprintf(compressfile, len+4, "%s.Z", filename);
+- if (!stat(compressfile, &status)) {
+- snprintf(buf, sizeof(buf), "uncompress -c \"%s\"", compressfile);
+- if (!(mdata->stream.file = s_popen(buf, "r"))) {
++ strcpy(compressfile, filename);
++ strcpy(compressfile + len, ext = ".Z");
++ fd = open(compressfile, O_RDONLY);
++ if ( fd < 0 )
++ {
++ strcpy(compressfile + len, ext = ".gz");
++ fd = open(compressfile, O_RDONLY);
++ if ( fd < 0 )
++ {
+ XpmFree(compressfile);
+- return (XpmOpenFailed);
+- }
+- mdata->type = XPMPIPE;
+- } else {
+- snprintf(compressfile, len+4, "%s.gz", filename);
+- if (!stat(compressfile, &status)) {
+- snprintf(buf, sizeof(buf), "gunzip -c \"%s\"", compressfile);
+- if (!(mdata->stream.file = s_popen(buf, "r"))) {
+- XpmFree(compressfile);
+- return (XpmOpenFailed);
+- }
+- mdata->type = XPMPIPE;
+- } else {
+-# endif
+-#endif
+- if (!(mdata->stream.file = fopen(filename, "r"))) {
+-#if !defined(NO_ZPIPE) && defined(STAT_ZFILE)
+- XpmFree(compressfile);
+-#endif
+- return (XpmOpenFailed);
+- }
+- mdata->type = XPMFILE;
+-#ifndef NO_ZPIPE
+-# ifdef STAT_ZFILE
++ return XpmOpenFailed;
+ }
+ }
+ XpmFree(compressfile);
+-# endif
+ }
+ #endif
++ if ( ext && !strcmp(ext, ".Z") )
++ {
++ mdata->type = XPMPIPE;
++ mdata->stream.file = xpmPipeThrough(fd, "uncompress", "-c", "r");
++ }
++ else if ( ext && !strcmp(ext, ".gz") )
++ {
++ mdata->type = XPMPIPE;
++ mdata->stream.file = xpmPipeThrough(fd, "gunzip", "-qc", "r");
++ }
++ else
++#endif /* z-files */
++ {
++ mdata->type = XPMFILE;
++ mdata->stream.file = fdopen(fd, "r");
++ }
++ if (!mdata->stream.file)
++ {
++ close(fd);
++ return (XpmOpenFailed);
++ }
+ }
+ mdata->CommentLength = 0;
+ #ifdef CXPMPROG
+@@ -220,15 +259,6 @@
+ xpmDataClose(mdata)
+ xpmData *mdata;
+ {
+- switch (mdata->type) {
+- case XPMFILE:
+- if (mdata->stream.file != (stdin))
+- fclose(mdata->stream.file);
+- break;
+-#ifndef NO_ZPIPE
+- case XPMPIPE:
++ if (mdata->stream.file != (stdin))
+ fclose(mdata->stream.file);
+- break;
+-#endif
+- }
+ }
+diff -ruN xc-old/extras/Xpm/lib/WrFFrI.c xc/extras/Xpm/lib/WrFFrI.c
+--- xc-old/extras/Xpm/lib/WrFFrI.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/WrFFrI.c Sun May 15 19:03:14 2005
+@@ -31,18 +31,21 @@
+ * *
+ * Developed by Arnaud Le Hors *
+ \*****************************************************************************/
++/* $XFree86$ */
+
+ /*
+ * The code related to AMIGA has been added by
+ * Lorens Younes (d93-hyo@nada.kth.se) 4/96
+ */
+
+-/* October 2004, source code review by Thomas Biege <thomas@suse.de> */
+-
+ #include "XpmI.h"
+-#if !defined(NO_ZPIPE) && defined(WIN32)
+-# define popen _popen
+-# define pclose _pclose
++
++#ifndef NO_ZPIPE
++#include "sys/wait.h"
++#include "sys/types.h"
++#include "fcntl.h"
++#include "unistd.h"
++#include "errno.h"
+ #endif
+
+ /* MS Windows define a function called WriteFile @#%#&!!! */
+@@ -123,7 +126,7 @@
+ /* let's try to make a valid C syntax name */
+ if (index(name, '.')) {
+ strncpy(new_name, name, sizeof(new_name));
+- new_name[sizeof(new_name)-1] = 0;
++ new_name[sizeof(new_name)-1] = '\0';
+ /* change '.' to '_' */
+ name = s = new_name;
+ while ((dot = index(s, '.'))) {
+@@ -133,8 +136,7 @@
+ }
+ if (index(name, '-')) {
+ if (name != new_name) {
+- strncpy(new_name, name, sizeof(new_name));
+- new_name[sizeof(new_name)-1] = 0;
++ strcpy(new_name, name);
+ name = new_name;
+ }
+ /* change '-' to '_' */
+@@ -251,8 +253,8 @@
+ unsigned int x, y, h;
+
+ h = height - 1;
+- if (cpp != 0 && width >= (UINT_MAX - 3)/cpp)
+- return XpmNoMemory;
++ if (cpp != 0 && width >= (UINT_MAX - 3)/cpp)
++ return XpmNoMemory;
+ p = buf = (char *) XpmMalloc(width * cpp + 3);
+ if (!buf)
+ return (XpmNoMemory);
+@@ -300,55 +302,48 @@
+ fprintf(file, ",\n\"XPMENDEXT\"");
+ }
+
++
++#ifndef NO_ZPIPE
++FUNC(xpmPipeThrough, FILE*, (int fd,
++ const char* cmd,
++ const char* arg1,
++ const char* mode));
++#endif
++
+ /*
+ * open the given file to be written as an xpmData which is returned
+ */
+-#ifndef NO_ZPIPE
+- FILE *s_popen(char *cmd, const char *type);
+-#else
+-# define s_popen popen
+-#endif
+ static int
+ OpenWriteFile(filename, mdata)
+ char *filename;
+ xpmData *mdata;
+ {
+-#ifndef NO_ZPIPE
+- char buf[BUFSIZ];
+-
+-#endif
+-
+ if (!filename) {
+ mdata->stream.file = (stdout);
+ mdata->type = XPMFILE;
+ } else {
+ #ifndef NO_ZPIPE
+- size_t len = strlen(filename);
+-
+- if (len == 0)
+- return(XpmOpenFailed);
+-
++ size_t len;
++#endif
++ int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644);
++ if ( fd < 0 )
++ return(XpmOpenFailed);
++#ifndef NO_ZPIPE
++ len = strlen(filename);
+ if (len > 2 && !strcmp(".Z", filename + (len - 2))) {
+- snprintf(buf, sizeof(buf), "compress > \"%s\"", filename);
+- if (!(mdata->stream.file = s_popen(buf, "w")))
+- return (XpmOpenFailed);
+-
++ mdata->stream.file = xpmPipeThrough(fd, "compress", NULL, "w");
+ mdata->type = XPMPIPE;
+ } else if (len > 3 && !strcmp(".gz", filename + (len - 3))) {
+- snprintf(buf, sizeof(buf), "gzip -q > \"%s\"", filename);
+- if (!(mdata->stream.file = s_popen(buf, "w")))
+- return (XpmOpenFailed);
+-
++ mdata->stream.file = xpmPipeThrough(fd, "gzip", "-q", "w");
+ mdata->type = XPMPIPE;
+- } else {
++ } else
+ #endif
+- if (!(mdata->stream.file = fopen(filename, "w")))
+- return (XpmOpenFailed);
+-
++ {
++ mdata->stream.file = fdopen(fd, "w");
+ mdata->type = XPMFILE;
+-#ifndef NO_ZPIPE
+ }
+-#endif
++ if (!mdata->stream.file)
++ return (XpmOpenFailed);
+ }
+ return (XpmSuccess);
+ }
+@@ -360,15 +355,7 @@
+ xpmDataClose(mdata)
+ xpmData *mdata;
+ {
+- switch (mdata->type) {
+- case XPMFILE:
+- if (mdata->stream.file != (stdout))
+- fclose(mdata->stream.file);
+- break;
+-#ifndef NO_ZPIPE
+- case XPMPIPE:
++ if (mdata->stream.file != (stdout))
+ fclose(mdata->stream.file);
+- break;
+-#endif
+- }
+ }
++
+diff -ruN xc-old/extras/Xpm/lib/XpmI.h xc/extras/Xpm/lib/XpmI.h
+--- xc-old/extras/Xpm/lib/XpmI.h Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/XpmI.h Sun May 15 19:03:14 2005
+@@ -22,7 +22,7 @@
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from GROUPE BULL.
+ */
+-/* $XFree86: xc/extras/Xpm/lib/XpmI.h,v 1.3 2000/08/31 19:03:54 tsi Exp $ */
++/* $XFree86: xc/extras/Xpm/lib/XpmI.h,v 1.7 2001/11/01 23:35:25 dawes Exp $ */
+
+ /*****************************************************************************\
+ * XpmI.h: *
+@@ -52,44 +52,15 @@
+ #include <sys/types.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <limits.h>
+ /* stdio.h doesn't declare popen on a Sequent DYNIX OS */
+ #ifdef sequent
+ extern FILE *popen();
+ #endif
+
+-#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32) || defined(linux)
+-#include <string.h>
+-
+-#ifndef index
+-#define index strchr
+-#endif
+-
+-#ifndef rindex
+-#define rindex strrchr
+-#endif
+-
+-#else /* defined(SYSV) || defined(SVR4) || defined(VMS) */
+-#include <strings.h>
+-#endif
+-
+-
+-
+-#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32)
+-#ifndef bcopy
+-#define bcopy(source, dest, count) memcpy(dest, source, count)
+-#endif
+-#ifndef bzero
+-#define bzero(b, len) memset(b, 0, len)
+-#endif
+-#endif
+-
+-/* the following is defined in X11R6 but not in previous versions */
+-#if defined(__alpha) || defined(__alpha__) || \
+- defined(ia64) || defined(__ia64__)
+-#ifndef LONG64
+-#define LONG64
+-#endif
+-#endif
++#include <X11/Xos.h>
++#include <X11/Xfuncs.h>
++#include <X11/Xmd.h>
+
+ #ifdef VMS
+ #include <unixio.h>
+@@ -124,7 +95,7 @@
+ #ifndef SIZE_MAX
+ # ifdef ULONG_MAX
+ # define SIZE_MAX ULONG_MAX
+-# else
++# else
+ # define SIZE_MAX UINT_MAX
+ # endif
+ #endif
+diff -ruN xc-old/extras/Xpm/lib/create.c xc/extras/Xpm/lib/create.c
+--- xc-old/extras/Xpm/lib/create.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/create.c Sun May 15 19:03:14 2005
+@@ -1,3 +1,4 @@
++/* $XdotOrg: xc/extras/Xpm/lib/create.c,v 1.2.4.2 2004/12/17 01:09:36 gisburn Exp $ */
+ /*
+ * Copyright (C) 1989-95 GROUPE BULL
+ *
+@@ -32,6 +33,7 @@
+ * *
+ * Developed by Arnaud Le Hors *
+ \*****************************************************************************/
++/* $XFree86: xc/extras/Xpm/lib/create.c,v 1.4 2003/05/27 22:26:20 tsi Exp $ */
+
+ /*
+ * The code related to FOR_MSW has been added by
+@@ -127,7 +129,9 @@
+
+ LFUNC(PutPixel1, int, (XImage *ximage, int x, int y, unsigned long pixel));
+ LFUNC(PutPixel, int, (XImage *ximage, int x, int y, unsigned long pixel));
++#if !defined(WORD64) && !defined(LONG64)
+ LFUNC(PutPixel32, int, (XImage *ximage, int x, int y, unsigned long pixel));
++#endif
+ LFUNC(PutPixel32MSB, int, (XImage *ximage, int x, int y, unsigned long pixel));
+ LFUNC(PutPixel32LSB, int, (XImage *ximage, int x, int y, unsigned long pixel));
+ LFUNC(PutPixel16MSB, int, (XImage *ximage, int x, int y, unsigned long pixel));
+@@ -768,7 +772,6 @@
+ unsigned int depth;
+ int bitmap_format;
+ XpmFreeColorsFunc freeColors;
+- void *closure;
+
+ /* variables to return */
+ XImage *ximage = NULL;
+@@ -815,14 +818,10 @@
+ freeColors = attributes->free_colors;
+ else
+ freeColors = FreeColors;
+- if (attributes && (attributes->valuemask & XpmColorClosure))
+- closure = attributes->color_closure;
+- else
+- closure = NULL;
+
+ ErrorStatus = XpmSuccess;
+
+- if (image->ncolors >= UINT_MAX / sizeof(Pixel))
++ if (image->ncolors >= UINT_MAX / sizeof(Pixel))
+ return (XpmNoMemory);
+
+ /* malloc pixels index tables */
+@@ -1003,7 +1002,7 @@
+ }
+ /* now that bytes_per_line must have been set properly alloc data */
+ if((*image_return)->bytes_per_line == 0 || height == 0)
+- return XpmNoMemory;
++ return XpmNoMemory;
+ (*image_return)->data =
+ (char *) XpmMalloc((*image_return)->bytes_per_line * height);
+
+@@ -1830,6 +1829,7 @@
+ return 1;
+ }
+
++#if !defined(WORD64) && !defined(LONG64)
+ static int
+ PutPixel32(ximage, x, y, pixel)
+ register XImage *ximage;
+@@ -1846,6 +1846,7 @@
+ *((unsigned long *)addr) = pixel;
+ return 1;
+ }
++#endif
+
+ static int
+ PutPixel32MSB(ximage, x, y, pixel)
+@@ -1895,9 +1896,9 @@
+ unsigned long pixel;
+ {
+ unsigned char *addr;
+-
++
+ if(x < 0 || y < 0)
+- return 0;
++ return 0;
+
+ addr = &((unsigned char *)ximage->data) [ZINDEX16(x, y, ximage)];
+ addr[0] = pixel >> 8;
+@@ -1913,9 +1914,9 @@
+ unsigned long pixel;
+ {
+ unsigned char *addr;
+-
++
+ if(x < 0 || y < 0)
+- return 0;
++ return 0;
+
+ addr = &((unsigned char *)ximage->data) [ZINDEX16(x, y, ximage)];
+ addr[1] = pixel >> 8;
+@@ -1993,7 +1994,6 @@
+ unsigned int depth;
+ int bitmap_format;
+ XpmFreeColorsFunc freeColors;
+- void *closure;
+
+ /* variables to return */
+ XImage *ximage = NULL;
+@@ -2051,10 +2051,6 @@
+ freeColors = attributes->free_colors;
+ else
+ freeColors = FreeColors;
+- if (attributes && (attributes->valuemask & XpmColorClosure))
+- closure = attributes->color_closure;
+- else
+- closure = NULL;
+
+ cmts = info && (info->valuemask & XpmReturnComments);
+
+@@ -2103,7 +2099,7 @@
+ xpmGetCmt(data, &colors_cmt);
+
+ /* malloc pixels index tables */
+- if (ncolors >= UINT_MAX / sizeof(Pixel))
++ if (ncolors >= UINT_MAX / sizeof(Pixel))
+ RETURN(XpmNoMemory);
+
+ image_pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * ncolors);
+diff -ruN xc-old/extras/Xpm/lib/data.c xc/extras/Xpm/lib/data.c
+--- xc-old/extras/Xpm/lib/data.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/data.c Sun May 15 19:03:14 2005
+@@ -31,16 +31,18 @@
+ * *
+ * Developed by Arnaud Le Hors *
+ \*****************************************************************************/
++/* $XFree86: xc/extras/Xpm/lib/data.c,v 1.3 2001/10/28 03:32:10 tsi Exp $ */
+
+ /* October 2004, source code review by Thomas Biege <thomas@suse.de> */
+
+ #ifndef CXPMPROG
++#if 0
+ /* Official version number */
+ static char *RCS_Version = "$XpmVersion: 3.4k $";
+
+ /* Internal version number */
+ static char *RCS_Id = "Id: xpm.shar,v 3.71 1998/03/19 19:47:14 lehors Exp $";
+-
++#endif
+ #include "XpmI.h"
+ #endif
+ #include <ctype.h>
+@@ -377,7 +379,7 @@
+ *cmt = NULL;
+ else if (data->CommentLength != 0 && data->CommentLength < UINT_MAX - 1) {
+ if( (*cmt = (char *) XpmMalloc(data->CommentLength + 1)) == NULL)
+- return XpmNoMemory;
++ return XpmNoMemory;
+ strncpy(*cmt, data->Comment, data->CommentLength);
+ (*cmt)[data->CommentLength] = '\0';
+ data->CommentLength = 0;
+@@ -388,14 +390,10 @@
+
+ xpmDataType xpmDataTypes[] =
+ {
+- "", "!", "\n", '\0', '\n', "", "", "", "", /* Natural type */
+- "C", "/*", "*/", '"', '"', ",\n", "static char *", "[] = {\n", "};\n",
+- "Lisp", ";", "\n", '"', '"', "\n", "(setq ", " '(\n", "))\n",
+-#ifdef VMS
+- NULL
+-#else
+- NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL
+-#endif
++ {"", "!", "\n", '\0', '\n', "", "", "", ""}, /* Natural type */
++ {"C", "/*", "*/", '"', '"', ",\n", "static char *", "[] = {\n", "};\n"},
++ {"Lisp", ";", "\n", '"', '"', "\n", "(setq ", " '(\n", "))\n"},
++ {NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL}
+ };
+
+ /*
+diff -ruN xc-old/extras/Xpm/lib/hashtab.c xc/extras/Xpm/lib/hashtab.c
+--- xc-old/extras/Xpm/lib/hashtab.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/hashtab.c Sun May 15 19:03:14 2005
+@@ -144,7 +144,7 @@
+ HASH_TABLE_GROWS
+ table->size = size;
+ table->limit = size / 3;
+- if (size >= UINT_MAX / sizeof(*atomTable))
++ if (size >= UINT_MAX / sizeof(*atomTable))
+ return (XpmNoMemory);
+ atomTable = (xpmHashAtom *) XpmMalloc(size * sizeof(*atomTable));
+ if (!atomTable)
+diff -ruN xc-old/extras/Xpm/lib/parse.c xc/extras/Xpm/lib/parse.c
+--- xc-old/extras/Xpm/lib/parse.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/parse.c Sun May 15 19:03:14 2005
+@@ -1,3 +1,4 @@
++/* $XdotOrg: xc/extras/Xpm/lib/parse.c,v 1.2.4.2 2004/12/17 01:09:36 gisburn Exp $ */
+ /*
+ * Copyright (C) 1989-95 GROUPE BULL
+ *
+@@ -22,7 +23,7 @@
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from GROUPE BULL.
+ */
+-/* $XFree86$ */
++/* $XFree86: xc/extras/Xpm/lib/parse.c,v 1.2 2000/09/26 15:56:43 tsi Exp $ */
+
+ /*****************************************************************************\
+ * parse.c: *
+@@ -33,6 +34,7 @@
+ * *
+ * Developed by Arnaud Le Hors *
+ \*****************************************************************************/
++/* $XFree86$ */
+
+ /*
+ * The code related to FOR_MSW has been added by
+@@ -374,7 +376,7 @@
+ unsigned int a, x, y;
+
+ if ((height > 0 && width >= UINT_MAX / height) ||
+- width * height >= UINT_MAX / sizeof(unsigned int))
++ width * height >= UINT_MAX / sizeof(unsigned int))
+ return XpmNoMemory;
+ #ifndef FOR_MSW
+ iptr2 = (unsigned int *) XpmMalloc(sizeof(unsigned int) * width * height);
+diff -ruN xc-old/extras/Xpm/lib/scan.c xc/extras/Xpm/lib/scan.c
+--- xc-old/extras/Xpm/lib/scan.c Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/scan.c Sun May 15 19:03:14 2005
+@@ -31,6 +31,7 @@
+ * *
+ * Developed by Arnaud Le Hors *
+ \*****************************************************************************/
++/* $XFree86: xc/extras/Xpm/lib/scan.c,v 1.2 2001/10/28 03:32:11 tsi Exp $ */
+
+ /*
+ * The code related to FOR_MSW has been added by
+@@ -108,8 +109,8 @@
+ LFUNC(ScanTransparentColor, int, (XpmColor *color, unsigned int cpp,
+ XpmAttributes *attributes));
+
+-LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors,
+- unsigned int ncolors,
++LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors,
++ unsigned int ncolors,
+ Pixel *pixels, unsigned int mask,
+ unsigned int cpp, XpmAttributes *attributes));
+
+@@ -242,7 +243,7 @@
+ if (!pmap.pixelindex)
+ RETURN(XpmNoMemory);
+
+- if (pmap.size >= UINT_MAX / sizeof(Pixel))
++ if (pmap.size >= UINT_MAX / sizeof(Pixel))
+ RETURN(XpmNoMemory);
+
+ pmap.pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * pmap.size);
+diff -ruN xc-old/extras/Xpm/lib/xpm.h xc/extras/Xpm/lib/xpm.h
+--- xc-old/extras/Xpm/lib/xpm.h Sun May 15 18:56:53 2005
++++ xc/extras/Xpm/lib/xpm.h Sun May 15 19:03:14 2005
+@@ -22,6 +22,7 @@
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from GROUPE BULL.
+ */
++/* $XFree86: xc/extras/Xpm/lib/xpm.h,v 1.2 2001/08/22 23:36:44 dawes Exp $ */
+
+ /*****************************************************************************\
+ * xpm.h: *
+@@ -84,16 +85,6 @@
+ # define PIXEL_ALREADY_TYPEDEFED
+ #endif
+
+-/* make sure we know whether function prototypes are needed or not */
+-#ifndef NeedFunctionPrototypes
+-# if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
+-# define NeedFunctionPrototypes 1
+-# else
+-# define NeedFunctionPrototypes 0
+-# endif
+-#endif
+-
+-
+ /* Return ErrorStatus codes:
+ * null if full success
+ * positive if partial success
+@@ -149,23 +140,19 @@
+ } XpmInfo;
+
+ typedef int (*XpmAllocColorFunc)(
+-#if NeedFunctionPrototypes
+ Display* /* display */,
+ Colormap /* colormap */,
+ char* /* colorname */,
+ XColor* /* xcolor */,
+ void* /* closure */
+-#endif
+ );
+
+ typedef int (*XpmFreeColorsFunc)(
+-#if NeedFunctionPrototypes
+ Display* /* display */,
+ Colormap /* colormap */,
+ Pixel* /* pixels */,
+ int /* npixels */,
+ void* /* closure */
+-#endif
+ );
+
+ typedef struct {
+@@ -289,22 +276,15 @@
+
+
+ /* macros for forward declarations of functions with prototypes */
+-#if NeedFunctionPrototypes
+ #define FUNC(f, t, p) extern t f p
+ #define LFUNC(f, t, p) static t f p
+-#else
+-#define FUNC(f, t, p) extern t f()
+-#define LFUNC(f, t, p) static t f()
+-#endif
+
+
+ /*
+ * functions declarations
+ */
+
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
++_XFUNCPROTOBEGIN
+
+ /* FOR_MSW, all ..Pixmap.. are excluded, only the ..XImage.. are used */
+ /* Same for Amiga! */
+@@ -458,10 +438,7 @@
+
+ FUNC(XpmFree, void, (void *ptr));
+
+-#ifdef __cplusplus
+-} /* for C++ V2.0 */
+-#endif
+-
++_XFUNCPROTOEND
+
+ /* backward compatibility */
+
+diff -ruN xc-old/extras/Xpm/sxpm/sxpm.c xc/extras/Xpm/sxpm/sxpm.c
+--- xc-old/extras/Xpm/sxpm/sxpm.c Mon Jan 11 05:23:12 1999
++++ xc/extras/Xpm/sxpm/sxpm.c Sun May 15 19:03:14 2005
+@@ -22,6 +22,7 @@
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from GROUPE BULL.
+ */
++/* $XFree86: xc/extras/Xpm/sxpm/sxpm.c,v 1.2 2001/08/01 00:44:34 tsi Exp $ */
+
+ /*****************************************************************************\
+ * sxpm.c: *
+@@ -126,6 +127,7 @@
+ {"-icon", ".icon", XrmoptionSepArg, (XtPointer) NULL},
+ };
+
++int
+ main(argc, argv)
+ int argc;
+ char **argv;
+@@ -549,6 +551,9 @@
+ XtMainLoop();
+ }
+ Punt(0);
++
++ /* Muffle gcc */
++ return 0;
+ }
+
+ void
+@@ -686,7 +691,6 @@
+ void
+ VersionInfo()
+ {
+- int num;
+ int format, libmajor;
+ char libminor;
+
+diff -ruN xc-old/extras/Xpm/sxpm/sxpm.man xc/extras/Xpm/sxpm/sxpm.man
+--- xc-old/extras/Xpm/sxpm/sxpm.man Mon Jan 11 05:23:12 1999
++++ xc/extras/Xpm/sxpm/sxpm.man Sun May 15 19:03:14 2005
+@@ -21,6 +21,7 @@
+ .\"used in advertising or otherwise to promote the sale, use or other dealings
+ .\"in this Software without prior written authorization from GROUPE BULL.
+ .\"
++.\" $XFree86$
+ .nr )S 12
+ .TH SXPM 1
+ .PD
+@@ -102,13 +103,13 @@
+ Do not use the clipmask if there is any.
+ .TP 8
+ .B \-sc \fIsymbol colorname\fP
+-Override default color to \fIsymbol\fP to \fIcolorname\fp.
++Override default color to \fIsymbol\fP to \fIcolorname\fP.
+ .TP 8
+ .B \-sp \fIsymbol pixelvalue\fP
+-Override default color to \fIsymbol\fP to \fIpixelvalue\fp.
++Override default color to \fIsymbol\fP to \fIpixelvalue\fP.
+ .TP 8
+ .B \-cp \fIcolorname pixelvalue\fP
+-Override default color to \fIcolorname\fP to \fIpixelvalue\fp.
++Override default color to \fIcolorname\fP to \fIpixelvalue\fP.
+ .TP 8
+ .B \-rgb \fIfilename\fP
+ Search color names in the file \fIfilename\fP and write them out instead of
Modified: branches/4.1.0/woody/debian/patches/400_hppa_support.diff
===================================================================
--- branches/4.1.0/woody/debian/patches/400_hppa_support.diff 2005-05-15 18:03:38 UTC (rev 2259)
+++ branches/4.1.0/woody/debian/patches/400_hppa_support.diff 2005-05-15 20:55:07 UTC (rev 2260)
@@ -40,19 +40,6 @@
# ifndef XF86Server
# define XF86Server YES
# endif
-diff -ur xc-dist/extras/Xpm/lib/XpmI.h xc/extras/Xpm/lib/XpmI.h
---- xc-dist/extras/Xpm/lib/XpmI.h Sun Jul 29 03:33:09 2001
-+++ xc/extras/Xpm/lib/XpmI.h Thu Dec 2 00:06:20 2004
-@@ -85,7 +85,8 @@
-
- /* the following is defined in X11R6 but not in previous versions */
- #if defined(__alpha) || defined(__alpha__) || \
-- defined(ia64) || defined(__ia64__)
-+ defined(ia64) || defined(__ia64__) || \
-+ (defined(__hppa__) && defined(__LP64__))
- #ifndef LONG64
- #define LONG64
- #endif
diff -ur xc-dist/include/DPS/dpsconfig.h xc/include/DPS/dpsconfig.h
--- xc-dist/include/DPS/dpsconfig.h Sun Jul 29 03:33:12 2001
+++ xc/include/DPS/dpsconfig.h Sun Jul 29 03:43:14 2001
Reply to: