format patches

This commit is contained in:
jiangdingyuan 2023-10-26 10:31:04 +08:00
parent 567d7d21f0
commit 26fb869b6f
9 changed files with 84 additions and 60 deletions

View File

@ -9,7 +9,7 @@ Forwarded: yes
1 file changed, 10 deletions(-)
diff --git a/scheduler/cups-driverd.cxx b/scheduler/cups-driverd.cxx
index 66c95cb..41f207e 100644
index ef45e92..eac4756 100644
--- a/scheduler/cups-driverd.cxx
+++ b/scheduler/cups-driverd.cxx
@@ -241,7 +241,6 @@ add_ppd(const char *filename, /* I - PPD filename */

View File

@ -12,7 +12,7 @@ Bug-Debian: https://bugs.debian.org/640124
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c
index 37f93b5..ac9cc42 100644
index 863e885..f81fd71 100644
--- a/cgi-bin/admin.c
+++ b/cgi-bin/admin.c
@@ -1635,6 +1635,7 @@ do_config_server(http_t *http) /* I - HTTP connection */

View File

@ -9,7 +9,7 @@ Bug: https://github.com/OpenPrinting/cups/pull/36
1 file changed, 2 insertions(+)
diff --git a/scheduler/conf.c b/scheduler/conf.c
index 535d40f..cb49078 100644
index b185351..070ab5d 100644
--- a/scheduler/conf.c
+++ b/scheduler/conf.c
@@ -1132,10 +1132,12 @@ cupsdReadConfiguration(void)

View File

@ -17,7 +17,7 @@ Forwarded: not-needed
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/cups-config.in b/cups-config.in
index d081df9..efe2bf9 100755
index 1f49bb9..89e6fbc 100755
--- a/cups-config.in
+++ b/cups-config.in
@@ -18,7 +18,7 @@ prefix=@prefix@

View File

@ -30,7 +30,7 @@ index f571fc8..e44c2c0 100644
CXX = @LIBTOOL_CXX@ @CXX@
DSO = @DSO@
diff --git a/configure.ac b/configure.ac
index 76793ce..9eaeaa3 100644
index 5ad5ead..8543cc2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,16 @@ sinclude(config-scripts/cups-opsys.m4)
@ -64,7 +64,7 @@ index 621fe60..e01591a 100644
+mantohtml: mantohtml.c
+ $(CC_FOR_BUILD) -o $@ $<
diff --git a/man/mantohtml.c b/man/mantohtml.c
index 0c9c883..6ba901a 100644
index a46b70e..16ac191 100644
--- a/man/mantohtml.c
+++ b/man/mantohtml.c
@@ -11,8 +11,10 @@

View File

@ -9,7 +9,7 @@ Forwarded: not-needed
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cups/testhttp.c b/cups/testhttp.c
index 2cda4f7..73f8e34 100644
index 66a112e..a4b8eeb 100644
--- a/cups/testhttp.c
+++ b/cups/testhttp.c
@@ -417,8 +417,7 @@ main(int argc, /* I - Number of command-line arguments */

View File

@ -8,7 +8,7 @@ Reprotest insist in running these tests as root; skip them there.
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh
index bcace0d..251bc43 100755
index 39b53c3..21bc308 100755
--- a/test/run-stp-tests.sh
+++ b/test/run-stp-tests.sh
@@ -19,7 +19,8 @@ argcount=$#

View File

@ -1,6 +1,20 @@
From: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Date: Thu, 26 Oct 2023 10:31:04 +0800
Subject: ppd-cache-add-auto-presets
---
cups/ppd-cache.c | 1225 +++++++++++++++++++++++++++++++++++++++++++++----
cups/ppd-private.h | 19 +-
cups/string-private.h | 2 +
cups/string.c | 30 ++
scheduler/job.c | 83 +++-
5 files changed, 1269 insertions(+), 90 deletions(-)
diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c
index 40881cd..6e8d31d 100644
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -504,6 +504,8 @@
@@ -504,6 +504,8 @@ _ppdCacheCreateWithFile(
_pwg_print_color_mode_t print_color_mode;
/* Print color mode for preset */
_pwg_print_quality_t print_quality; /* Print quality for preset */
@ -9,7 +23,7 @@
DEBUG_printf(("_ppdCacheCreateWithFile(filename=\"%s\")", filename));
@@ -929,6 +931,28 @@
@@ -929,6 +931,28 @@ _ppdCacheCreateWithFile(
cupsParseOptions(valueptr, 0,
pc->presets[print_color_mode] + print_quality);
}
@ -38,7 +52,7 @@
else if (!_cups_strcasecmp(line, "SidesOption"))
pc->sides_option = strdup(value);
else if (!_cups_strcasecmp(line, "Sides1Sided"))
@@ -1056,6 +1080,7 @@
@@ -1056,6 +1080,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
*ppd_option; /* Other PPD option */
ppd_choice_t *choice; /* Current InputSlot/MediaType */
pwg_map_t *map; /* Current source/type map */
@ -46,18 +60,18 @@
ppd_attr_t *ppd_attr; /* Current PPD preset attribute */
int num_options; /* Number of preset options and props */
cups_option_t *options; /* Preset options and properties */
@@ -1512,6 +1537,10 @@
@@ -1511,6 +1536,10 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
if ((ppd_attr = ppdFindAttr(ppd, "APPrinterPreset", NULL)) != NULL)
{
/*
+ /*
+ * "Classic" Mac OS approach
+ */
+
+ /*
/*
* Copy and convert APPrinterPreset (output-mode + print-quality) data...
*/
@@ -1611,114 +1640,133 @@
@@ -1611,114 +1640,133 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
_ppdParseOptions(ppd_attr->value, 0,
pc->presets[pwg_print_color_mode] +
pwg_print_quality, _PPD_PARSE_OPTIONS);
@ -173,16 +187,29 @@
+ /*
+ * Copy and convert ColorModel (output-mode) data...
+ */
+
- num_options = pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
- [pwg_print_quality];
- options = calloc((size_t)num_options, sizeof(cups_option_t));
+ cups_option_t *coption, /* Color option */
+ *moption; /* Monochrome option */
+
- if (options)
+ for (pwg_print_quality = _PWG_PRINT_QUALITY_DRAFT;
+ pwg_print_quality < _PWG_PRINT_QUALITY_MAX;
+ pwg_print_quality ++)
+ {
+ if (pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR][pwg_print_quality])
+ {
{
- for (i = num_options, moption = options,
- coption = pc->presets[_PWG_PRINT_COLOR_MODE_COLOR]
- [pwg_print_quality];
- i > 0;
- i --, moption ++, coption ++)
- {
- moption->name = _cupsStrRetain(coption->name);
- moption->value = _cupsStrRetain(coption->value);
- }
+ /*
+ * Copy the color options...
+ */
@ -191,22 +218,9 @@
+ [pwg_print_quality];
+ options = calloc(sizeof(cups_option_t), (size_t)num_options);
- num_options = pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
- [pwg_print_quality];
- options = calloc((size_t)num_options, sizeof(cups_option_t));
-
- if (options)
- {
- for (i = num_options, moption = options,
- coption = pc->presets[_PWG_PRINT_COLOR_MODE_COLOR]
- [pwg_print_quality];
- i > 0;
- i --, moption ++, coption ++)
- pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
+ if (options)
{
- moption->name = _cupsStrRetain(coption->name);
- moption->value = _cupsStrRetain(coption->value);
- }
+ {
+ for (i = num_options, moption = options,
+ coption = pc->presets[_PWG_PRINT_COLOR_MODE_COLOR]
+ [pwg_print_quality];
@ -216,8 +230,7 @@
+ moption->name = _cupsStrRetain(coption->name);
+ moption->value = _cupsStrRetain(coption->value);
+ }
- pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
+
+ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
num_options;
- pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
@ -232,14 +245,15 @@
- /*
- * Add the grayscale option to the preset...
- */
+ else if (pwg_print_quality != _PWG_PRINT_QUALITY_NORMAL)
+ continue;
-
- pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
- cupsAddOption(color_option, gray_choice,
- pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
- [pwg_print_quality],
- pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME] +
+ else if (pwg_print_quality != _PWG_PRINT_QUALITY_NORMAL)
+ continue;
+
+ /*
+ * Add the grayscale option to the preset...
+ */
@ -275,10 +289,11 @@
/*
* Copy and convert Duplex (sides) data...
*/
@@ -2052,13 +2100,996 @@
@@ -2051,6 +2099,989 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
}
/*
+/*
+ * '_ppdCacheAssignPresets()' - Go through all the options and choices in
+ * the PPD to find out which influence
+ * color/bw, print quality, and content
@ -1261,10 +1276,10 @@
+ }
+}
+
+/*
/*
* '_ppdCacheDestroy()' - Free all memory used for PWG mapping data.
*/
@@ -2058,7 +3089,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
void
_ppdCacheDestroy(_ppd_cache_t *pc) /* I - PPD cache and mapping data */
{
@ -1273,7 +1288,7 @@
pwg_map_t *map; /* Current map */
pwg_size_t *size; /* Current size */
@@ -2137,6 +3168,15 @@
@@ -2137,6 +3168,15 @@ _ppdCacheDestroy(_ppd_cache_t *pc) /* I - PPD cache and mapping data */
cupsArrayDelete(pc->strings);
@ -1289,10 +1304,11 @@
free(pc);
}
@@ -3025,6 +4065,21 @@
@@ -3024,6 +4064,21 @@ _ppdCacheWriteFile(
cupsFilePutChar(fp, '\n');
}
/*
+ /*
+ * Optimization Presets...
+ */
+
@ -1307,13 +1323,14 @@
+ cupsFilePutChar(fp, '\n');
+ }
+
+ /*
/*
* Duplex/sides...
*/
diff --git a/cups/ppd-private.h b/cups/ppd-private.h
index 11324c7..2188b2d 100644
--- a/cups/ppd-private.h
+++ b/cups/ppd-private.h
@@ -36,7 +36,7 @@
@@ -36,7 +36,7 @@ extern "C" {
* Constants...
*/
@ -1322,7 +1339,7 @@
/*
@@ -101,6 +101,16 @@
@@ -101,6 +101,16 @@ typedef enum _pwg_print_quality_e /**** PWG print-quality values ****/
_PWG_PRINT_QUALITY_MAX
} _pwg_print_quality_t;
@ -1339,7 +1356,7 @@
typedef struct _pwg_finishings_s /**** PWG finishings mapping data ****/
{
ipp_finishings_t value; /* finishings value */
@@ -131,6 +141,11 @@
@@ -131,6 +141,11 @@ struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
/* Number of print-color-mode/print-quality options */
cups_option_t *presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
/* print-color-mode/print-quality options */
@ -1351,7 +1368,7 @@
char *sides_option, /* PPD option for sides */
*sides_1sided, /* Choice for one-sided */
*sides_2sided_long, /* Choice for two-sided-long-edge */
@@ -214,6 +229,8 @@
@@ -214,6 +229,8 @@ extern const char *_pwgMediaTypeForType(const char *media_type,
extern const char *_pwgPageSizeForMedia(pwg_media_t *media,
char *name, size_t namesize) _CUPS_PRIVATE;
@ -1360,9 +1377,11 @@
/*
* C++ magic...
diff --git a/cups/string-private.h b/cups/string-private.h
index 335e579..76037e3 100644
--- a/cups/string-private.h
+++ b/cups/string-private.h
@@ -150,6 +150,8 @@
@@ -150,6 +150,8 @@ extern int _cups_strcasecmp(const char *, const char *) _CUPS_PRIVATE;
extern int _cups_strncasecmp(const char *, const char *, size_t n) _CUPS_PRIVATE;
@ -1371,9 +1390,11 @@
# ifndef HAVE_STRLCAT
extern size_t _cups_strlcat(char *, const char *, size_t) _CUPS_PRIVATE;
# define strlcat _cups_strlcat
diff --git a/cups/string.c b/cups/string.c
index b4fc120..a479a7c 100644
--- a/cups/string.c
+++ b/cups/string.c
@@ -671,6 +671,36 @@
@@ -671,6 +671,36 @@ _cups_strncasecmp(const char *s, /* I - First string */
return (-1);
}
@ -1410,9 +1431,11 @@
#ifndef HAVE_STRLCAT
/*
diff --git a/scheduler/job.c b/scheduler/job.c
index 5ac782e..9add55b 100644
--- a/scheduler/job.c
+++ b/scheduler/job.c
@@ -3653,9 +3653,13 @@
@@ -3653,9 +3653,13 @@ get_options(cupsd_job_t *job, /* I - Job */
cups_option_t *pwgppds, /* PWG->PPD options */
*pwgppd, /* Current PWG->PPD option */
*preset; /* Current preset option */
@ -1428,7 +1451,7 @@
const char *ppd; /* PPD option choice */
int exact; /* Did we get an exact match? */
static char *options = NULL;/* Full list of options */
@@ -3677,7 +3681,7 @@
@@ -3677,7 +3681,7 @@ get_options(cupsd_job_t *job, /* I - Job */
if (pc &&
!ippFindAttribute(job->attrs, "com.apple.print.DocumentTicket.PMSpoolFormat", IPP_TAG_ZERO) &&
!ippFindAttribute(job->attrs, "APPrinterPreset", IPP_TAG_ZERO) &&
@ -1437,7 +1460,7 @@
{
/*
* Map print-color-mode and print-quality to a preset...
@@ -3739,6 +3743,12 @@
@@ -3739,6 +3743,12 @@ get_options(cupsd_job_t *job, /* I - Job */
}
}
@ -1450,7 +1473,7 @@
if (pc->num_presets[print_color_mode][print_quality] > 0)
{
/*
@@ -3753,7 +3763,72 @@
@@ -3753,7 +3763,72 @@ get_options(cupsd_job_t *job, /* I - Job */
{
if (!ippFindAttribute(job->attrs, preset->name, IPP_TAG_ZERO))
{

View File

@ -1,4 +1,3 @@
From a9a7daa77699bd58001c25df8a61a8029a217ddf Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Fri, 1 Sep 2023 16:47:29 +0200
Subject: [PATCH] raster-interpret.c: Fix CVE-2023-4504
@ -11,9 +10,11 @@ a valid PostScript character.
cups/raster-interpret.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/cups/raster-interpret.c b/cups/raster-interpret.c
index 97662ec..429a3f7 100644
--- a/cups/raster-interpret.c
+++ b/cups/raster-interpret.c
@@ -1113,7 +1113,19 @@ scan_ps(_cups_ps_stack_t *st, /* I - S
@@ -1113,7 +1113,19 @@ scan_ps(_cups_ps_stack_t *st, /* I - Stack */
cur ++;