]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/cups-str4609.patch
reiserfsprogs: Update to 3.6.27
[ipfire-2.x.git] / src / patches / cups-str4609.patch
CommitLineData
b720e702
MT
1diff -up cups-1.7.5/cgi-bin/ipp-var.c.str4609 cups-1.7.5/cgi-bin/ipp-var.c
2--- cups-1.7.5/cgi-bin/ipp-var.c.str4609 2014-05-22 15:59:21.000000000 +0200
3+++ cups-1.7.5/cgi-bin/ipp-var.c 2015-06-10 10:31:45.297965345 +0200
4@@ -1206,21 +1206,7 @@ cgiSetIPPObjectVars(
5 * Rewrite URIs...
6 */
7
8- if (!strcmp(name, "member_uris"))
9- {
10- char url[1024]; /* URL for class member... */
11-
12-
13- cgiRewriteURL(attr->values[i].string.text, url,
14- sizeof(url), NULL);
15-
16- snprintf(valptr, sizeof(value) - (valptr - value),
17- "<A HREF=\"%s\">%s</A>", url,
18- strrchr(attr->values[i].string.text, '/') + 1);
19- }
20- else
21- cgiRewriteURL(attr->values[i].string.text, valptr,
22- sizeof(value) - (valptr - value), NULL);
23+ cgiRewriteURL(attr->values[i].string.text, valptr, sizeof(value) - (valptr - value), NULL);
24 break;
25 }
26
27diff -up cups-1.7.5/cgi-bin/template.c.str4609 cups-1.7.5/cgi-bin/template.c
28--- cups-1.7.5/cgi-bin/template.c.str4609 2014-03-05 22:11:32.000000000 +0100
29+++ cups-1.7.5/cgi-bin/template.c 2015-06-10 10:31:45.297965345 +0200
30@@ -659,39 +659,7 @@ cgi_puts(const char *s, /* I - String
31 while (*s)
32 {
33 if (*s == '<')
34- {
35- /*
36- * Pass <A HREF="url"> and </A>, otherwise quote it...
37- */
38-
39- if (!_cups_strncasecmp(s, "<A HREF=\"", 9))
40- {
41- fputs("<A HREF=\"", out);
42- s += 9;
43-
44- while (*s && *s != '\"')
45- {
46- if (*s == '&')
47- fputs("&amp;", out);
48- else
49- putc(*s, out);
50-
51- s ++;
52- }
53-
54- if (*s)
55- s ++;
56-
57- fputs("\">", out);
58- }
59- else if (!_cups_strncasecmp(s, "</A>", 4))
60- {
61- fputs("</A>", out);
62- s += 3;
63- }
64- else
65- fputs("&lt;", out);
66- }
67+ fputs("&lt;", out);
68 else if (*s == '>')
69 fputs("&gt;", out);
70 else if (*s == '\"')
71diff -up cups-1.7.5/scheduler/client.c.str4609 cups-1.7.5/scheduler/client.c
72--- cups-1.7.5/scheduler/client.c.str4609 2015-06-10 10:31:45.280965399 +0200
73+++ cups-1.7.5/scheduler/client.c 2015-06-10 10:31:45.300965335 +0200
74@@ -598,7 +598,12 @@ cupsdCloseClient(cupsd_client_t *con) /*
75 httpClearCookie(HTTP(con));
76 httpClearFields(HTTP(con));
77
78- cupsdClearString(&con->filename);
79+ if (con->filename)
80+ {
81+ unlink(con->filename);
82+ cupsdClearString(&con->filename);
83+ }
84+
85 cupsdClearString(&con->command);
86 cupsdClearString(&con->options);
87 cupsdClearString(&con->query_string);
88diff -up cups-1.7.5/scheduler/env.c.str4609 cups-1.7.5/scheduler/env.c
89--- cups-1.7.5/scheduler/env.c.str4609 2015-06-10 10:31:45.208965629 +0200
90+++ cups-1.7.5/scheduler/env.c 2015-06-10 10:31:45.300965335 +0200
91@@ -131,6 +131,13 @@ cupsdSetEnv(const char *name, /* I - Na
92 return;
93
94 /*
95+ * Do not allow dynamic linker variables when running as root...
96+ */
97+
98+ if (!RunUser && (!strncmp(name, "DYLD_", 5) || !strncmp(name, "LD_", 3)))
99+ return;
100+
101+ /*
102 * See if this variable has already been defined...
103 */
104
105diff -up cups-1.7.5/scheduler/ipp.c.str4609 cups-1.7.5/scheduler/ipp.c
106--- cups-1.7.5/scheduler/ipp.c.str4609 2015-06-10 10:31:45.287965377 +0200
107+++ cups-1.7.5/scheduler/ipp.c 2015-06-10 10:31:45.299965339 +0200
108@@ -412,8 +412,7 @@ cupsdProcessIPPRequest(
109 * Remote unauthenticated user masquerading as local root...
110 */
111
112- _cupsStrFree(username->values[0].string.text);
113- username->values[0].string.text = _cupsStrAlloc(RemoteRoot);
114+ ippSetString(con->request, &username, 0, RemoteRoot);
115 }
116 }
117
118@@ -1576,7 +1575,7 @@ add_job(cupsd_client_t *con, /* I - Cl
119 cupsdSetString(&job->username, con->username);
120
121 if (attr)
122- cupsdSetString(&attr->values[0].string.text, con->username);
123+ ippSetString(job->attrs, &attr, 0, con->username);
124 }
125 else if (attr)
126 {
127@@ -1594,9 +1593,8 @@ add_job(cupsd_client_t *con, /* I - Cl
128 "job-originating-user-name", NULL, job->username);
129 else
130 {
131- attr->group_tag = IPP_TAG_JOB;
132- _cupsStrFree(attr->name);
133- attr->name = _cupsStrAlloc("job-originating-user-name");
134+ ippSetGroupTag(job->attrs, &attr, IPP_TAG_JOB);
135+ ippSetName(job->attrs, &attr, "job-originating-user-name");
136 }
137
138 if (con->username[0] || auth_info)
139@@ -1630,48 +1628,11 @@ add_job(cupsd_client_t *con, /* I - Cl
140 * Also, we can only have 1 value and it must be a name value.
141 */
142
143- switch (attr->value_tag)
144- {
145- case IPP_TAG_STRING :
146- case IPP_TAG_TEXTLANG :
147- case IPP_TAG_NAMELANG :
148- case IPP_TAG_TEXT :
149- case IPP_TAG_NAME :
150- case IPP_TAG_KEYWORD :
151- case IPP_TAG_URI :
152- case IPP_TAG_URISCHEME :
153- case IPP_TAG_CHARSET :
154- case IPP_TAG_LANGUAGE :
155- case IPP_TAG_MIMETYPE :
156- /*
157- * Free old strings...
158- */
159-
160- for (i = 0; i < attr->num_values; i ++)
161- {
162- _cupsStrFree(attr->values[i].string.text);
163- attr->values[i].string.text = NULL;
164- if (attr->values[i].string.language)
165- {
166- _cupsStrFree(attr->values[i].string.language);
167- attr->values[i].string.language = NULL;
168- }
169- }
170-
171- default :
172- break;
173- }
174-
175- /*
176- * Use the default connection hostname instead...
177- */
178-
179- attr->value_tag = IPP_TAG_NAME;
180- attr->num_values = 1;
181- attr->values[0].string.text = _cupsStrAlloc(con->http.hostname);
182+ ippDeleteAttribute(job->attrs, attr);
183+ ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-originating-host-name", NULL, con->http.hostname);
184 }
185-
186- attr->group_tag = IPP_TAG_JOB;
187+ else
188+ ippSetGroupTag(job->attrs, &attr, IPP_TAG_JOB);
189 }
190 else
191 {
192@@ -1767,8 +1728,8 @@ add_job(cupsd_client_t *con, /* I - Cl
193
194 attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-sheets",
195 2, NULL, NULL);
196- attr->values[0].string.text = _cupsStrRetain(printer->job_sheets[0]);
197- attr->values[1].string.text = _cupsStrRetain(printer->job_sheets[1]);
198+ ippSetString(job->attrs, &attr, 0, printer->job_sheets[0]);
199+ ippSetString(job->attrs, &attr, 1, printer->job_sheets[1]);
200 }
201
202 job->job_sheets = attr;
203@@ -1794,7 +1755,7 @@ add_job(cupsd_client_t *con, /* I - Cl
204 * Force the leading banner to have the classification on it...
205 */
206
207- cupsdSetString(&attr->values[0].string.text, Classification);
208+ ippSetString(job->attrs, &attr, 0, Classification);
209
210 cupsdLogJob(job, CUPSD_LOG_NOTICE, "CLASSIFICATION FORCED "
211 "job-sheets=\"%s,none\", "
212@@ -1811,7 +1772,7 @@ add_job(cupsd_client_t *con, /* I - Cl
213 * Can't put two different security markings on the same document!
214 */
215
216- cupsdSetString(&attr->values[1].string.text, attr->values[0].string.text);
217+ ippSetString(job->attrs, &attr, 1, attr->values[0].string.text);
218
219 cupsdLogJob(job, CUPSD_LOG_NOTICE, "CLASSIFICATION FORCED "
220 "job-sheets=\"%s,%s\", "
221@@ -1851,18 +1812,18 @@ add_job(cupsd_client_t *con, /* I - Cl
222 if (attr->num_values > 1 &&
223 !strcmp(attr->values[0].string.text, attr->values[1].string.text))
224 {
225- cupsdSetString(&(attr->values[0].string.text), Classification);
226- cupsdSetString(&(attr->values[1].string.text), Classification);
227+ ippSetString(job->attrs, &attr, 0, Classification);
228+ ippSetString(job->attrs, &attr, 1, Classification);
229 }
230 else
231 {
232 if (attr->num_values == 1 ||
233 strcmp(attr->values[0].string.text, "none"))
234- cupsdSetString(&(attr->values[0].string.text), Classification);
235+ ippSetString(job->attrs, &attr, 0, Classification);
236
237 if (attr->num_values > 1 &&
238 strcmp(attr->values[1].string.text, "none"))
239- cupsdSetString(&(attr->values[1].string.text), Classification);
240+ ippSetString(job->attrs, &attr, 1, Classification);
241 }
242
243 if (attr->num_values > 1)
244@@ -3098,8 +3059,8 @@ authenticate_job(cupsd_client_t *con, /
245
246 if (attr)
247 {
248- attr->value_tag = IPP_TAG_KEYWORD;
249- cupsdSetString(&(attr->values[0].string.text), "no-hold");
250+ ippSetValueTag(job->attrs, &attr, IPP_TAG_KEYWORD);
251+ ippSetString(job->attrs, &attr, 0, "no-hold");
252 }
253
254 /*
255@@ -8224,11 +8185,7 @@ print_job(cupsd_client_t *con, /* I -
256 filetype->type);
257
258 if (format)
259- {
260- _cupsStrFree(format->values[0].string.text);
261-
262- format->values[0].string.text = _cupsStrAlloc(mimetype);
263- }
264+ ippSetString(con->request, &format, 0, mimetype);
265 else
266 ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
267 "document-format", NULL, mimetype);
268@@ -8765,10 +8722,8 @@ release_job(cupsd_client_t *con, /* I -
269
270 if (attr)
271 {
272- _cupsStrFree(attr->values[0].string.text);
273-
274- attr->value_tag = IPP_TAG_KEYWORD;
275- attr->values[0].string.text = _cupsStrAlloc("no-hold");
276+ ippSetValueTag(job->attrs, &attr, IPP_TAG_KEYWORD);
277+ ippSetString(job->attrs, &attr, 0, "no-hold");
278
279 cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, cupsdFindDest(job->dest), job,
280 "Job job-hold-until value changed by user.");
281@@ -9461,11 +9416,7 @@ send_document(cupsd_client_t *con, /* I
282
283 if ((jformat = ippFindAttribute(job->attrs, "document-format",
284 IPP_TAG_MIMETYPE)) != NULL)
285- {
286- _cupsStrFree(jformat->values[0].string.text);
287-
288- jformat->values[0].string.text = _cupsStrAlloc(mimetype);
289- }
290+ ippSetString(job->attrs, &jformat, 0, mimetype);
291 else
292 ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
293 "document-format", NULL, mimetype);
294diff -up cups-1.7.5/scheduler/job.c.str4609 cups-1.7.5/scheduler/job.c
295--- cups-1.7.5/scheduler/job.c.str4609 2015-06-10 10:31:45.288965374 +0200
296+++ cups-1.7.5/scheduler/job.c 2015-06-10 10:31:45.299965339 +0200
297@@ -375,7 +375,7 @@ cupsdCheckJobs(void)
298
299 if ((attr = ippFindAttribute(job->attrs, "job-actual-printer-uri",
300 IPP_TAG_URI)) != NULL)
301- cupsdSetString(&attr->values[0].string.text, printer->uri);
302+ ippSetString(job->attrs, &attr, 0, printer->uri);
303 else
304 ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI,
305 "job-actual-printer-uri", NULL, printer->uri);
306@@ -2109,7 +2109,7 @@ cupsdMoveJob(cupsd_job_t *job, /* I
307
308 if ((attr = ippFindAttribute(job->attrs, "job-printer-uri",
309 IPP_TAG_URI)) != NULL)
310- cupsdSetString(&(attr->values[0].string.text), p->uri);
311+ ippSetString(job->attrs, &attr, 0, p->uri);
312
313 cupsdAddEvent(CUPSD_EVENT_JOB_STOPPED, p, job,
314 "Job #%d moved from %s to %s.", job->id, olddest,
315@@ -2306,7 +2306,7 @@ cupsdSetJobHoldUntil(cupsd_job_t *job, /
316 attr = ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME);
317
318 if (attr)
319- cupsdSetString(&(attr->values[0].string.text), when);
320+ ippSetString(job->attrs, &attr, 0, when);
321 else
322 attr = ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_KEYWORD,
323 "job-hold-until", NULL, when);
324@@ -2560,8 +2560,8 @@ cupsdSetJobState(
325
326 if (attr)
327 {
328- attr->value_tag = IPP_TAG_KEYWORD;
329- cupsdSetString(&(attr->values[0].string.text), "no-hold");
330+ ippSetValueTag(job->attrs, &attr, IPP_TAG_KEYWORD);
331+ ippSetString(job->attrs, &attr, 0, "no-hold");
332 }
333
334 default :
335@@ -4598,7 +4598,7 @@ start_job(cupsd_job_t *job, /* I -
336 "job-printer-state-message",
337 IPP_TAG_TEXT);
338 if (job->printer_message)
339- cupsdSetString(&(job->printer_message->values[0].string.text), "");
340+ ippSetString(job->attrs, &job->printer_message, 0, "");
341
342 ippSetString(job->attrs, &job->reasons, 0, "job-printing");
343 cupsdSetJobState(job, IPP_JOB_PROCESSING, CUPSD_JOB_DEFAULT, NULL);
344@@ -5216,15 +5216,14 @@ update_job_attrs(cupsd_job_t *job, /* I
345 if (job->state_value != IPP_JOB_PROCESSING &&
346 job->status_level == CUPSD_LOG_INFO)
347 {
348- cupsdSetString(&(job->printer_message->values[0].string.text), "");
349+ ippSetString(job->attrs, &job->printer_message, 0, "");
350
351 job->dirty = 1;
352 cupsdMarkDirty(CUPSD_DIRTY_JOBS);
353 }
354 else if (job->printer->state_message[0] && do_message)
355 {
356- cupsdSetString(&(job->printer_message->values[0].string.text),
357- job->printer->state_message);
358+ ippSetString(job->attrs, &job->printer_message, 0, job->printer->state_message);
359
360 job->dirty = 1;
361 cupsdMarkDirty(CUPSD_DIRTY_JOBS);
362diff -up cups-1.7.5/scheduler/main.c.str4609 cups-1.7.5/scheduler/main.c
363--- cups-1.7.5/scheduler/main.c.str4609 2015-06-10 10:31:45.265965447 +0200
364+++ cups-1.7.5/scheduler/main.c 2015-06-10 10:31:45.300965335 +0200
365@@ -1205,8 +1205,8 @@ cupsdAddString(cups_array_t **a, /* IO -
366 if (!*a)
367 *a = cupsArrayNew3((cups_array_func_t)strcmp, NULL,
368 (cups_ahash_func_t)NULL, 0,
369- (cups_acopy_func_t)_cupsStrAlloc,
370- (cups_afree_func_t)_cupsStrFree);
371+ (cups_acopy_func_t)strdup,
372+ (cups_afree_func_t)free);
373
374 return (cupsArrayAdd(*a, (char *)s));
375 }
376@@ -1236,7 +1236,7 @@ cupsdClearString(char **s) /* O - Strin
377 {
378 if (s && *s)
379 {
380- _cupsStrFree(*s);
381+ free(*s);
382 *s = NULL;
383 }
384 }
385@@ -1317,10 +1317,10 @@ cupsdSetString(char **s, /* O - N
386 return;
387
388 if (*s)
389- _cupsStrFree(*s);
390+ free(*s);
391
392 if (v)
393- *s = _cupsStrAlloc(v);
394+ *s = strdup(v);
395 else
396 *s = NULL;
397 }
398@@ -1351,13 +1351,13 @@ cupsdSetStringf(char **s, /* O -
399 vsnprintf(v, sizeof(v), f, ap);
400 va_end(ap);
401
402- *s = _cupsStrAlloc(v);
403+ *s = strdup(v);
404 }
405 else
406 *s = NULL;
407
408 if (olds)
409- _cupsStrFree(olds);
410+ free(olds);
411 }
412
413
414@@ -1804,8 +1804,7 @@ process_children(void)
415 }
416
417 if (job->printer_message)
418- cupsdSetString(&(job->printer_message->values[0].string.text),
419- message);
420+ ippSetString(job->attrs, &job->printer_message, 0, message);
421 }
422 }
423