summaryrefslogtreecommitdiff
path: root/debian/patches/0043-Stop-parsing-the-Emulators-keywords-in-PPD-files-Iss.patch
blob: 95378ee799b3195f5779ae3aa1a15cf50288c3d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
From fb2f9b86fabc11f9b0fad804199064bdd555201e Mon Sep 17 00:00:00 2001
From: Michael R Sweet <michael.r.sweet@gmail.com>
Date: Mon, 21 Jan 2019 13:44:43 -0500
Subject: Stop parsing the Emulators keywords in PPD files (Issue #5475)

This also addresses a potential memory leak...
---
 cups/ppd.c | 76 ++----------------------------------------------------
 cups/ppd.h |  8 +++---
 2 files changed, 6 insertions(+), 78 deletions(-)

diff --git a/cups/ppd.c b/cups/ppd.c
index 5f27484aa..968ea8bf3 100644
--- a/cups/ppd.c
+++ b/cups/ppd.c
@@ -1,8 +1,8 @@
 /*
  * PPD file routines for CUPS.
  *
- * Copyright 2007-2018 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright © 2007-2019 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
  * property of Apple Inc. and are protected by Federal copyright
@@ -117,7 +117,6 @@ void
 ppdClose(ppd_file_t *ppd)		/* I - PPD file record */
 {
   int			i;		/* Looping var */
-  ppd_emul_t		*emul;		/* Current emulation */
   ppd_group_t		*group;		/* Current group */
   char			**font;		/* Current font */
   ppd_attr_t		**attr;		/* Current attribute */
@@ -144,21 +143,6 @@ ppdClose(ppd_file_t *ppd)		/* I - PPD file record */
   _cupsStrFree(ppd->jcl_end);
   _cupsStrFree(ppd->jcl_ps);
 
- /*
-  * Free any emulations...
-  */
-
-  if (ppd->num_emulations > 0)
-  {
-    for (i = ppd->num_emulations, emul = ppd->emulations; i > 0; i --, emul ++)
-    {
-      _cupsStrFree(emul->start);
-      _cupsStrFree(emul->stop);
-    }
-
-    ppd_free(ppd->emulations);
-  }
-
  /*
   * Free any UI groups, subgroups, and options...
   */
@@ -443,7 +427,6 @@ _ppdOpen(
     _ppd_localization_t	localization)	/* I - Localization to load */
 {
   int			i, j, k;	/* Looping vars */
-  int			count;		/* Temporary count */
   _ppd_line_t		line;		/* Line buffer */
   ppd_file_t		*ppd;		/* PPD file record */
   ppd_group_t		*group,		/* Current group */
@@ -461,7 +444,6 @@ _ppdOpen(
 					/* Human-readable text from file */
 			*string,	/* Code/text from file */
 			*sptr,		/* Pointer into string */
-			*nameptr,	/* Pointer into name */
 			*temp,		/* Temporary string pointer */
 			**tempfonts;	/* Temporary fonts pointer */
   float			order;		/* Order dependency number */
@@ -1203,60 +1185,6 @@ _ppdOpen(
       else if (!strcmp(string, "Plus90"))
         ppd->landscape = 90;
     }
-    else if (!strcmp(keyword, "Emulators") && string)
-    {
-      for (count = 1, sptr = string; sptr != NULL;)
-        if ((sptr = strchr(sptr, ' ')) != NULL)
-	{
-	  count ++;
-	  while (*sptr == ' ')
-	    sptr ++;
-	}
-
-      ppd->num_emulations = count;
-      if ((ppd->emulations = calloc((size_t)count, sizeof(ppd_emul_t))) == NULL)
-      {
-        pg->ppd_status = PPD_ALLOC_ERROR;
-
-	goto error;
-      }
-
-      for (i = 0, sptr = string; i < count; i ++)
-      {
-        for (nameptr = ppd->emulations[i].name;
-	     *sptr != '\0' && *sptr != ' ';
-	     sptr ++)
-	  if (nameptr < (ppd->emulations[i].name + sizeof(ppd->emulations[i].name) - 1))
-	    *nameptr++ = *sptr;
-
-	*nameptr = '\0';
-
-	while (*sptr == ' ')
-	  sptr ++;
-      }
-    }
-    else if (!strncmp(keyword, "StartEmulator_", 14))
-    {
-      ppd_decode(string);
-
-      for (i = 0; i < ppd->num_emulations; i ++)
-        if (!strcmp(keyword + 14, ppd->emulations[i].name))
-	{
-	  ppd->emulations[i].start = string;
-	  string = NULL;
-	}
-    }
-    else if (!strncmp(keyword, "StopEmulator_", 13))
-    {
-      ppd_decode(string);
-
-      for (i = 0; i < ppd->num_emulations; i ++)
-        if (!strcmp(keyword + 13, ppd->emulations[i].name))
-	{
-	  ppd->emulations[i].stop = string;
-	  string = NULL;
-	}
-    }
     else if (!strcmp(keyword, "JobPatchFile"))
     {
      /*
diff --git a/cups/ppd.h b/cups/ppd.h
index 6e628cb60..ae63c0d66 100644
--- a/cups/ppd.h
+++ b/cups/ppd.h
@@ -5,8 +5,8 @@
  * -D_PPD_DEPRECATED="" TO YOUR COMPILE OPTIONS.  THIS HEADER AND THESE
  * FUNCTIONS WILL BE REMOVED IN A FUTURE RELEASE OF CUPS.
  *
- * Copyright 2007-2015 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright © 2007-2019 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
  * property of Apple Inc. and are protected by Federal copyright
@@ -304,8 +304,8 @@ typedef struct ppd_file_s		/**** PPD File ****/
   int		throughput;		/* Pages per minute */
   ppd_cs_t	colorspace;		/* Default colorspace */
   char		*patches;		/* Patch commands to be sent to printer */
-  int		num_emulations;		/* Number of emulations supported */
-  ppd_emul_t	*emulations;		/* Emulations and the code to invoke them */
+  int		num_emulations;		/* Number of emulations supported (no longer supported) @private@ */
+  ppd_emul_t	*emulations;		/* Emulations and the code to invoke them (no longer supported) @private@ */
   char		*jcl_begin;		/* Start JCL commands */
   char		*jcl_ps;		/* Enter PostScript interpreter */
   char		*jcl_end;		/* End JCL commands */