summaryrefslogtreecommitdiff
path: root/patches/source/cups/str4609-1.4.patch
blob: d896b6bd093f375865fa50442094d02b55ff36a1 (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
Index: cgi-bin/ipp-var.c
===================================================================
--- cgi-bin/ipp-var.c	(revision 12588)
+++ cgi-bin/ipp-var.c	(working copy)
@@ -1230,21 +1230,7 @@
 	      * Rewrite URIs...
 	      */

-              if (!strcmp(name, "member_uris"))
-	      {
-		char	url[1024];	/* URL for class member... */
-
-
-		cgiRewriteURL(attr->values[i].string.text, url,
-		              sizeof(url), NULL);
-
-                snprintf(valptr, sizeof(value) - (valptr - value),
-		         "<A HREF=\"%s\">%s</A>", url,
-			 strrchr(attr->values[i].string.text, '/') + 1);
-	      }
-	      else
-		cgiRewriteURL(attr->values[i].string.text, valptr,
-		              sizeof(value) - (valptr - value), NULL);
+	      cgiRewriteURL(attr->values[i].string.text, valptr, sizeof(value) - (valptr - value), NULL);
               break;
             }

Index: cgi-bin/template.c
===================================================================
--- cgi-bin/template.c	(revision 12588)
+++ cgi-bin/template.c	(working copy)
@@ -659,39 +659,7 @@
   while (*s)
   {
     if (*s == '<')
-    {
-     /*
-      * Pass <A HREF="url"> and </A>, otherwise quote it...
-      */
-
-      if (!strncasecmp(s, "<A HREF=\"", 9))
-      {
-        fputs("<A HREF=\"", out);
-	s += 9;
-
-	while (*s && *s != '\"')
-	{
-          if (*s == '&')
-            fputs("&amp;", out);
-	  else
-	    putc(*s, out);
-
-	  s ++;
-	}
-
-        if (*s)
-	  s ++;
-
-	fputs("\">", out);
-      }
-      else if (!strncasecmp(s, "</A>", 4))
-      {
-        fputs("</A>", out);
-	s += 3;
-      }
-      else
-        fputs("&lt;", out);
-    }
+      fputs("&lt;", out);
     else if (*s == '>')
       fputs("&gt;", out);
     else if (*s == '\"')
Index: scheduler/ipp.c
===================================================================
--- scheduler/ipp.c	(revision 12588)
+++ scheduler/ipp.c	(working copy)
@@ -498,8 +498,8 @@
 	    * Remote unauthenticated user masquerading as local root...
 	    */

-	    _cupsStrFree(username->values[0].string.text);
-	    username->values[0].string.text = _cupsStrAlloc(RemoteRoot);
+            _cupsStrFree(username->values[0].string.text);
+            username->values[0].string.text = _cupsStrAlloc(RemoteRoot);
 	  }
 	}

@@ -1638,7 +1638,10 @@
     cupsdSetString(&job->username, con->username);

     if (attr)
-      cupsdSetString(&attr->values[0].string.text, con->username);
+    {
+      _cupsStrFree(attr->values[0].string.text);
+      attr->values[0].string.text = _cupsStrAlloc(con->username);
+    }
   }
   else if (attr)
   {
@@ -1689,48 +1692,11 @@
       * Also, we can only have 1 value and it must be a name value.
       */

-      switch (attr->value_tag)
-      {
-        case IPP_TAG_STRING :
-	case IPP_TAG_TEXTLANG :
-	case IPP_TAG_NAMELANG :
-	case IPP_TAG_TEXT :
-	case IPP_TAG_NAME :
-	case IPP_TAG_KEYWORD :
-	case IPP_TAG_URI :
-	case IPP_TAG_URISCHEME :
-	case IPP_TAG_CHARSET :
-	case IPP_TAG_LANGUAGE :
-	case IPP_TAG_MIMETYPE :
-	   /*
-	    * Free old strings...
-	    */
-
-	    for (i = 0; i < attr->num_values; i ++)
-	    {
-	      _cupsStrFree(attr->values[i].string.text);
-	      attr->values[i].string.text = NULL;
-	      if (attr->values[i].string.charset)
-	      {
-		_cupsStrFree(attr->values[i].string.charset);
-		attr->values[i].string.charset = NULL;
-	      }
-            }
-
-	default :
-            break;
-      }
-
-     /*
-      * Use the default connection hostname instead...
-      */
-
-      attr->value_tag             = IPP_TAG_NAME;
-      attr->num_values            = 1;
-      attr->values[0].string.text = _cupsStrAlloc(con->http.hostname);
+      ippDeleteAttribute(job->attrs, attr);
+      ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-originating-host-name", NULL, con->http.hostname);
     }
-
-    attr->group_tag = IPP_TAG_JOB;
+    else
+      attr->group_tag = IPP_TAG_JOB;
   }
   else
   {
@@ -1822,8 +1788,8 @@

       attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-sheets",
                            2, NULL, NULL);
-      attr->values[0].string.text = _cupsStrRetain(printer->job_sheets[0]);
-      attr->values[1].string.text = _cupsStrRetain(printer->job_sheets[1]);
+      attr->values[0].string.text = _cupsStrAlloc(printer->job_sheets[0]);
+      attr->values[1].string.text = _cupsStrAlloc(printer->job_sheets[1]);
     }

     job->job_sheets = attr;
@@ -1849,7 +1815,8 @@
           * Force the leading banner to have the classification on it...
 	  */

-          cupsdSetString(&attr->values[0].string.text, Classification);
+	  _cupsStrFree(attr->values[0].string.text);
+	  attr->values[0].string.text = _cupsStrAlloc(Classification);

 	  cupsdLogJob(job, CUPSD_LOG_NOTICE, "CLASSIFICATION FORCED "
 	                		     "job-sheets=\"%s,none\", "
@@ -1866,7 +1833,8 @@
 	  * Can't put two different security markings on the same document!
 	  */

-          cupsdSetString(&attr->values[1].string.text, attr->values[0].string.text);
+	  _cupsStrFree(attr->values[1].string.text);
+	  attr->values[1].string.text = _cupsStrAlloc(attr->values[0].string.text);

 	  cupsdLogJob(job, CUPSD_LOG_NOTICE, "CLASSIFICATION FORCED "
 	                		     "job-sheets=\"%s,%s\", "
@@ -1906,18 +1874,26 @@
         if (attr->num_values > 1 &&
 	    !strcmp(attr->values[0].string.text, attr->values[1].string.text))
 	{
-          cupsdSetString(&(attr->values[0].string.text), Classification);
-          cupsdSetString(&(attr->values[1].string.text), Classification);
+	  _cupsStrFree(attr->values[0].string.text);
+	  attr->values[0].string.text = _cupsStrAlloc(Classification);
+	  _cupsStrFree(attr->values[1].string.text);
+	  attr->values[1].string.text = _cupsStrAlloc(Classification);
 	}
         else
 	{
           if (attr->num_values == 1 ||
 	      strcmp(attr->values[0].string.text, "none"))
-            cupsdSetString(&(attr->values[0].string.text), Classification);
+	  {
+	    _cupsStrFree(attr->values[0].string.text);
+	    attr->values[0].string.text = _cupsStrAlloc(Classification);
+	  }

           if (attr->num_values > 1 &&
 	      strcmp(attr->values[1].string.text, "none"))
-            cupsdSetString(&(attr->values[1].string.text), Classification);
+	  {
+	    _cupsStrFree(attr->values[1].string.text);
+	    attr->values[1].string.text = _cupsStrAlloc(Classification);
+	  }
         }

         if (attr->num_values > 1)
@@ -3845,7 +3821,8 @@
   if (attr)
   {
     attr->value_tag = IPP_TAG_KEYWORD;
-    cupsdSetString(&(attr->values[0].string.text), "no-hold");
+    _cupsStrFree(attr->values[0].string.text);
+    attr->values[0].string.text = _cupsStrAlloc("no-hold");
   }

  /*
@@ -8832,7 +8809,6 @@
     if (format)
     {
       _cupsStrFree(format->values[0].string.text);
-
       format->values[0].string.text = _cupsStrAlloc(mimetype);
     }
     else
@@ -9371,9 +9347,8 @@

   if (attr)
   {
+    attr->value_tag = IPP_TAG_KEYWORD;
     _cupsStrFree(attr->values[0].string.text);
-
-    attr->value_tag = IPP_TAG_KEYWORD;
     attr->values[0].string.text = _cupsStrAlloc("no-hold");

     cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, cupsdFindDest(job->dest), job,
@@ -10065,7 +10040,6 @@
                                     IPP_TAG_MIMETYPE)) != NULL)
     {
       _cupsStrFree(jformat->values[0].string.text);
-
       jformat->values[0].string.text = _cupsStrAlloc(mimetype);
     }
     else
Index: scheduler/job.c
===================================================================
--- scheduler/job.c	(revision 12588)
+++ scheduler/job.c	(working copy)
@@ -397,7 +397,10 @@

           if ((attr = ippFindAttribute(job->attrs, "job-actual-printer-uri",
 	                               IPP_TAG_URI)) != NULL)
-            cupsdSetString(&attr->values[0].string.text, printer->uri);
+          {
+            _cupsStrFree(attr->values[0].string.text);
+            attr->values[0].string.text = _cupsStrAlloc(printer->uri);
+          }
 	  else
 	    ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI,
 	                 "job-actual-printer-uri", NULL, printer->uri);
@@ -1830,7 +1833,10 @@

   if ((attr = ippFindAttribute(job->attrs, "job-printer-uri",
                                IPP_TAG_URI)) != NULL)
-    cupsdSetString(&(attr->values[0].string.text), p->uri);
+  {
+    _cupsStrFree(attr->values[0].string.text);
+    attr->values[0].string.text = _cupsStrAlloc(p->uri);
+  }

   cupsdAddEvent(CUPSD_EVENT_JOB_STOPPED, p, job,
                 "Job #%d moved from %s to %s.", job->id, olddest,
@@ -2026,7 +2032,10 @@
       attr = ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME);

     if (attr)
-      cupsdSetString(&(attr->values[0].string.text), when);
+    {
+      _cupsStrFree(attr->values[0].string.text);
+      attr->values[0].string.text = _cupsStrAlloc(when);
+    }
     else
       attr = ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_KEYWORD,
                           "job-hold-until", NULL, when);
@@ -2272,7 +2281,8 @@
 	if (attr)
 	{
 	  attr->value_tag = IPP_TAG_KEYWORD;
-	  cupsdSetString(&(attr->values[0].string.text), "no-hold");
+	  _cupsStrFree(attr->values[0].string.text);
+	  attr->values[0].string.text = _cupsStrAlloc("no-hold");
 	}

     default :
@@ -3989,7 +3999,10 @@
   job->status_level  = CUPSD_LOG_INFO;

   if (job->printer_message)
-    cupsdSetString(&(job->printer_message->values[0].string.text), "");
+  {
+    _cupsStrFree(job->printer_message->values[0].string.text);
+    job->printer_message->values[0].string.text = _cupsStrAlloc("");
+  }

  /*
   * Create the backchannel pipes and make them non-blocking...
@@ -4547,10 +4560,15 @@

   if (job->state_value != IPP_JOB_PROCESSING &&
       job->status_level == CUPSD_LOG_INFO)
-    cupsdSetString(&(job->printer_message->values[0].string.text), "");
+  {
+    _cupsStrFree(job->printer_message->values[0].string.text);
+    job->printer_message->values[0].string.text = _cupsStrAlloc("");
+  }
   else if (job->printer->state_message[0] && do_message)
-    cupsdSetString(&(job->printer_message->values[0].string.text),
-		   job->printer->state_message);
+  {
+    _cupsStrFree(job->printer_message->values[0].string.text);
+    job->printer_message->values[0].string.text = _cupsStrAlloc(job->printer->state_message);
+  }

  /*
   * ... and the printer-state-reasons value...