Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
e90fd7f27c
!172 [sync] PR-167: add back lspp patch
From: @openeuler-sync-bot 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2024-10-17 11:41:40 +00:00
Funda Wang
18b133a771 add back lspp patch
(cherry picked from commit 1f1ffc8a1d3b08f900ad3a2ee5001e5e40969641)
2024-10-17 19:19:57 +08:00
openeuler-ci-bot
bb910a7cb5
!160 fix CVE-2024-47175
From: @zppzhangpan 
Reviewed-by: @yanan-rock 
Signed-off-by: @yanan-rock
2024-10-08 07:16:11 +00:00
zppzhangpan
c195b24c6f fix CVE-2024-47175 2024-10-08 14:35:05 +08:00
openeuler-ci-bot
7d77331dbf
!154 [sync] PR-150: Fix regression of fixing CVE-2024-35235 (upstream issue#985)
From: @openeuler-sync-bot 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2024-08-31 06:20:21 +00:00
Funda Wang
dfad1e568c Fix regression of fixing CVE-2024-35235 (upstream issue#985)
(cherry picked from commit be911a8909ae120039e39a712140a7037a589ce4)
2024-08-31 11:21:02 +08:00
openeuler-ci-bot
e1aaa0aa9b
!141 [sync] PR-139: fix CVE-2024-35235
From: @openeuler-sync-bot 
Reviewed-by: @dou33 
Signed-off-by: @dou33
2024-06-12 05:38:33 +00:00
baiguo
93ae5be9b0 Fix domain socket handling
(cherry picked from commit 62ef24b391923b9a14cc66c17f5ac4224b932a3b)
2024-06-12 11:45:21 +08:00
openeuler-ci-bot
08a02181a9
!137 [sync] PR-136: fix pkgconfig file generating and delete deprecated parameters
From: @openeuler-sync-bot 
Reviewed-by: @weidongkl 
Signed-off-by: @weidongkl
2024-03-29 07:11:36 +00:00
Hajduk137
72a6ee13d2 fix pkgconfig dir
(cherry picked from commit a4afa9b29e703d1f995e332806079f097b57ea0f)
2024-03-29 11:55:41 +08:00
12 changed files with 3940 additions and 84 deletions

View File

@ -0,0 +1,72 @@
From 9939a70b750edd9d05270060cc5cf62ca98cfbe5 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Mon, 9 Sep 2024 10:03:10 -0400
Subject: [PATCH] Mirror IPP Everywhere printer changes from master.
---
cups/ppd-cache.c | 10 +++++-----
scheduler/ipp.c | 9 ++++++++-
2 files changed, 13 insertions(+), 6 deletions(-)
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -4350,10 +4350,10 @@ _ppdCreateFromIPP2(
}
cupsFilePuts(fp, "\"\n");
- if ((attr = ippFindAttribute(supported, "printer-more-info", IPP_TAG_URI)) != NULL)
+ if ((attr = ippFindAttribute(supported, "printer-more-info", IPP_TAG_URI)) != NULL && ippValidateAttribute(attr))
cupsFilePrintf(fp, "*APSupplies: \"%s\"\n", ippGetString(attr, 0, NULL));
- if ((attr = ippFindAttribute(supported, "printer-charge-info-uri", IPP_TAG_URI)) != NULL)
+ if ((attr = ippFindAttribute(supported, "printer-charge-info-uri", IPP_TAG_URI)) != NULL && ippValidateAttribute(attr))
cupsFilePrintf(fp, "*cupsChargeInfoURI: \"%s\"\n", ippGetString(attr, 0, NULL));
if ((attr = ippFindAttribute(supported, "printer-strings-uri", IPP_TAG_URI)) != NULL)
@@ -4422,10 +4422,10 @@ _ppdCreateFromIPP2(
if (ippGetBoolean(ippFindAttribute(supported, "job-accounting-user-id-supported", IPP_TAG_BOOLEAN), 0))
cupsFilePuts(fp, "*cupsJobAccountingUserId: True\n");
- if ((attr = ippFindAttribute(supported, "printer-privacy-policy-uri", IPP_TAG_URI)) != NULL)
+ if ((attr = ippFindAttribute(supported, "printer-privacy-policy-uri", IPP_TAG_URI)) != NULL && ippValidateAttribute(attr))
cupsFilePrintf(fp, "*cupsPrivacyURI: \"%s\"\n", ippGetString(attr, 0, NULL));
- if ((attr = ippFindAttribute(supported, "printer-mandatory-job-attributes", IPP_TAG_KEYWORD)) != NULL)
+ if ((attr = ippFindAttribute(supported, "printer-mandatory-job-attributes", IPP_TAG_KEYWORD)) != NULL && ippValidateAttribute(attr))
{
char prefix = '\"'; // Prefix for string
@@ -4443,7 +4443,7 @@ _ppdCreateFromIPP2(
cupsFilePuts(fp, "\"\n");
}
- if ((attr = ippFindAttribute(supported, "printer-requested-job-attributes", IPP_TAG_KEYWORD)) != NULL)
+ if ((attr = ippFindAttribute(supported, "printer-requested-job-attributes", IPP_TAG_KEYWORD)) != NULL && ippValidateAttribute(attr))
{
char prefix = '\"'; // Prefix for string
--- a/scheduler/ipp.c
+++ b/scheduler/ipp.c
@@ -1,7 +1,7 @@
/*
* IPP routines for the CUPS scheduler.
*
- * Copyright © 2020-2023 by OpenPrinting
+ * Copyright © 2020-2024 by OpenPrinting
* Copyright © 2007-2021 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
@@ -5413,6 +5413,13 @@ create_local_bg_thread(
}
}
+ // Validate response from printer...
+ if (!ippValidateAttributes(response))
+ {
+ send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Printer returned invalid data: %s"), cupsLastErrorString());
+ goto finish_response;
+ }
+
// TODO: Grab printer icon file...
httpClose(http);

View File

@ -0,0 +1,143 @@
From 04bb2af4521b56c1699a2c2431c56c05a7102e69 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Mon, 9 Sep 2024 14:05:42 -0400
Subject: [PATCH] Refactor make-and-model code.
---
cups/ppd-cache.c | 103 +++++++++++++++++++++++++++++++++++++++--------
1 file changed, 87 insertions(+), 16 deletions(-)
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -4230,9 +4230,10 @@ _ppdCreateFromIPP2(
ipp_t *media_col, /* Media collection */
*media_size; /* Media size collection */
char make[256], /* Make and model */
- *model, /* Model name */
+ *mptr, /* Pointer into make and model */
ppdname[PPD_MAX_NAME];
/* PPD keyword */
+ const char *model; /* Model name */
int i, j, /* Looping vars */
count, /* Number of values */
bottom, /* Largest bottom margin */
@@ -4293,34 +4294,104 @@ _ppdCreateFromIPP2(
}
/*
- * Standard stuff for PPD file...
+ * Get a sanitized make and model...
*/
- cupsFilePuts(fp, "*PPD-Adobe: \"4.3\"\n");
- cupsFilePuts(fp, "*FormatVersion: \"4.3\"\n");
- cupsFilePrintf(fp, "*FileVersion: \"%d.%d\"\n", CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR);
- cupsFilePuts(fp, "*LanguageVersion: English\n");
- cupsFilePuts(fp, "*LanguageEncoding: ISOLatin1\n");
- cupsFilePuts(fp, "*PSVersion: \"(3010.000) 0\"\n");
- cupsFilePuts(fp, "*LanguageLevel: \"3\"\n");
- cupsFilePuts(fp, "*FileSystem: False\n");
- cupsFilePuts(fp, "*PCFileName: \"ippeve.ppd\"\n");
+ if ((attr = ippFindAttribute(supported, "printer-make-and-model", IPP_TAG_TEXT)) != NULL && ippValidateAttribute(attr))
+ {
+ /*
+ * Sanitize the model name to only contain PPD-safe characters.
+ */
- if ((attr = ippFindAttribute(supported, "printer-make-and-model", IPP_TAG_TEXT)) != NULL)
strlcpy(make, ippGetString(attr, 0, NULL), sizeof(make));
+
+ for (mptr = make; *mptr; mptr ++)
+ {
+ if (*mptr < ' ' || *mptr >= 127 || *mptr == '\"')
+ {
+ /*
+ * Truncate the make and model on the first bad character...
+ */
+
+ *mptr = '\0';
+ break;
+ }
+ }
+
+ while (mptr > make)
+ {
+ /*
+ * Strip trailing whitespace...
+ */
+
+ mptr --;
+ if (*mptr == ' ')
+ *mptr = '\0';
+ }
+
+ if (!make[0])
+ {
+ /*
+ * Use a default make and model if nothing remains...
+ */
+
+ strlcpy(make, "Unknown", sizeof(make));
+ }
+ }
else
- strlcpy(make, "Unknown Printer", sizeof(make));
+ {
+ /*
+ * Use a default make and model...
+ */
+
+ strlcpy(make, "Unknown", sizeof(make));
+ }
if (!_cups_strncasecmp(make, "Hewlett Packard ", 16) || !_cups_strncasecmp(make, "Hewlett-Packard ", 16))
{
+ /*
+ * Normalize HP printer make and model...
+ */
+
model = make + 16;
strlcpy(make, "HP", sizeof(make));
+
+ if (!_cups_strncasecmp(model, "HP ", 3))
+ model += 3;
+ }
+ else if ((mptr = strchr(make, ' ')) != NULL)
+ {
+ /*
+ * Separate "MAKE MODEL"...
+ */
+
+ while (*mptr && *mptr == ' ')
+ *mptr++ = '\0';
+
+ model = mptr;
}
- else if ((model = strchr(make, ' ')) != NULL)
- *model++ = '\0';
else
- model = make;
+ {
+ /*
+ * No separate model name...
+ */
+
+ model = "Printer";
+ }
+
+ /*
+ * Standard stuff for PPD file...
+ */
+ cupsFilePuts(fp, "*PPD-Adobe: \"4.3\"\n");
+ cupsFilePuts(fp, "*FormatVersion: \"4.3\"\n");
+ cupsFilePrintf(fp, "*FileVersion: \"%d.%d\"\n", CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR);
+ cupsFilePuts(fp, "*LanguageVersion: English\n");
+ cupsFilePuts(fp, "*LanguageEncoding: ISOLatin1\n");
+ cupsFilePuts(fp, "*PSVersion: \"(3010.000) 0\"\n");
+ cupsFilePuts(fp, "*LanguageLevel: \"3\"\n");
+ cupsFilePuts(fp, "*FileSystem: False\n");
+ cupsFilePuts(fp, "*PCFileName: \"ippeve.ppd\"\n");
cupsFilePrintf(fp, "*Manufacturer: \"%s\"\n", make);
cupsFilePrintf(fp, "*ModelName: \"%s\"\n", model);
cupsFilePrintf(fp, "*Product: \"(%s)\"\n", model);

View File

@ -0,0 +1,111 @@
From e0630cd18f76340d302000f2bf6516e99602b844 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Mon, 9 Sep 2024 15:59:57 -0400
Subject: [PATCH] PPDize preset and template names.
---
cups/ppd-cache.c | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -5993,12 +5993,14 @@ _ppdCreateFromIPP2(
cupsArrayAdd(templates, (void *)keyword);
+ pwg_ppdize_name(keyword, ppdname, sizeof(ppdname));
+
snprintf(msgid, sizeof(msgid), "finishing-template.%s", keyword);
if ((msgstr = _cupsLangString(lang, msgid)) == msgid || !strcmp(msgid, msgstr))
if ((msgstr = _cupsMessageLookup(strings, msgid)) == msgid)
msgstr = keyword;
- cupsFilePrintf(fp, "*cupsFinishingTemplate %s: \"\n", keyword);
+ cupsFilePrintf(fp, "*cupsFinishingTemplate %s: \"\n", ppdname);
for (finishing_attr = ippFirstAttribute(finishing_col); finishing_attr; finishing_attr = ippNextAttribute(finishing_col))
{
if (ippGetValueTag(finishing_attr) == IPP_TAG_BEGIN_COLLECTION)
@@ -6011,7 +6013,7 @@ _ppdCreateFromIPP2(
}
}
cupsFilePuts(fp, "\"\n");
- cupsFilePrintf(fp, "*%s.cupsFinishingTemplate %s/%s: \"\"\n", lang->language, keyword, msgstr);
+ cupsFilePrintf(fp, "*%s.cupsFinishingTemplate %s/%s: \"\"\n", lang->language, ppdname, msgstr);
cupsFilePuts(fp, "*End\n");
}
@@ -6057,7 +6059,8 @@ _ppdCreateFromIPP2(
if (!preset || !preset_name)
continue;
- cupsFilePrintf(fp, "*APPrinterPreset %s: \"\n", preset_name);
+ pwg_ppdize_name(preset_name, ppdname, sizeof(ppdname));
+ cupsFilePrintf(fp, "*APPrinterPreset %s: \"\n", ppdname);
for (member = ippFirstAttribute(preset); member; member = ippNextAttribute(preset))
{
member_name = ippGetName(member);
@@ -6098,7 +6101,10 @@ _ppdCreateFromIPP2(
fin_col = ippGetCollection(member, i);
if ((keyword = ippGetString(ippFindAttribute(fin_col, "finishing-template", IPP_TAG_ZERO), 0, NULL)) != NULL)
- cupsFilePrintf(fp, "*cupsFinishingTemplate %s\n", keyword);
+ {
+ pwg_ppdize_name(keyword, ppdname, sizeof(ppdname));
+ cupsFilePrintf(fp, "*cupsFinishingTemplate %s\n", ppdname);
+ }
}
}
else if (!strcmp(member_name, "media"))
@@ -6125,13 +6131,13 @@ _ppdCreateFromIPP2(
if ((keyword = ippGetString(ippFindAttribute(media_col, "media-source", IPP_TAG_ZERO), 0, NULL)) != NULL)
{
pwg_ppdize_name(keyword, ppdname, sizeof(ppdname));
- cupsFilePrintf(fp, "*InputSlot %s\n", keyword);
+ cupsFilePrintf(fp, "*InputSlot %s\n", ppdname);
}
if ((keyword = ippGetString(ippFindAttribute(media_col, "media-type", IPP_TAG_ZERO), 0, NULL)) != NULL)
{
pwg_ppdize_name(keyword, ppdname, sizeof(ppdname));
- cupsFilePrintf(fp, "*MediaType %s\n", keyword);
+ cupsFilePrintf(fp, "*MediaType %s\n", ppdname);
}
}
else if (!strcmp(member_name, "print-quality"))
@@ -6177,7 +6183,10 @@ _ppdCreateFromIPP2(
cupsFilePuts(fp, "\"\n*End\n");
if ((localized_name = _cupsMessageLookup(strings, preset_name)) != preset_name)
- cupsFilePrintf(fp, "*%s.APPrinterPreset %s/%s: \"\"\n", lang->language, preset_name, localized_name);
+ {
+ pwg_ppdize_name(preset_name, ppdname, sizeof(ppdname));
+ cupsFilePrintf(fp, "*%s.APPrinterPreset %s/%s: \"\"\n", lang->language, ppdname, localized_name);
+ }
}
}
@@ -6561,7 +6570,7 @@ pwg_ppdize_name(const char *ipp, /* I -
*end; /* End of name buffer */
- if (!ipp)
+ if (!ipp || !_cups_isalnum(*ipp))
{
*name = '\0';
return;
@@ -6576,8 +6585,14 @@ pwg_ppdize_name(const char *ipp, /* I -
ipp ++;
*ptr++ = (char)toupper(*ipp++ & 255);
}
- else
+ else if (*ipp == '_' || *ipp == '.' || *ipp == '-' || _cups_isalnum(*ipp))
+ {
*ptr++ = *ipp++;
+ }
+ else
+ {
+ ipp ++;
+ }
}
*ptr = '\0';

View File

@ -0,0 +1,241 @@
From 1e6ca5913eceee906038bc04cc7ccfbe2923bdfd Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Mon, 23 Sep 2024 09:36:39 -0400
Subject: [PATCH] Quote PPD localized strings.
---
cups/ppd-cache.c | 93 +++++++++++++++++++++++++++---------------------
1 file changed, 53 insertions(+), 40 deletions(-)
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -32,6 +32,7 @@
static int cups_connect(http_t **http, const char *url, char *resource, size_t ressize);
static int cups_get_url(http_t **http, const char *url, char *name, size_t namesize);
static const char *ppd_inputslot_for_keyword(_ppd_cache_t *pc, const char *keyword);
+static void ppd_put_string(cups_file_t *fp, cups_lang_t *lang, cups_array_t *strings, const char *ppd_option, const char *ppd_choice, const char *pwg_msgid);
static void pwg_add_finishing(cups_array_t *finishings, ipp_finishings_t template, const char *name, const char *value);
static void pwg_add_message(cups_array_t *a, const char *msg, const char *str);
static int pwg_compare_finishings(_pwg_finishings_t *a, _pwg_finishings_t *b);
@@ -4427,7 +4428,7 @@ _ppdCreateFromIPP2(
if ((attr = ippFindAttribute(supported, "printer-charge-info-uri", IPP_TAG_URI)) != NULL && ippValidateAttribute(attr))
cupsFilePrintf(fp, "*cupsChargeInfoURI: \"%s\"\n", ippGetString(attr, 0, NULL));
- if ((attr = ippFindAttribute(supported, "printer-strings-uri", IPP_TAG_URI)) != NULL)
+ if ((attr = ippFindAttribute(supported, "printer-strings-uri", IPP_TAG_URI)) != NULL && ippValidateAttribute(attr))
{
http_t *http = NULL; /* Connection to printer */
char stringsfile[1024]; /* Temporary strings file */
@@ -4471,7 +4472,7 @@ _ppdCreateFromIPP2(
response = cupsDoRequest(http, request, resource);
- if ((attr = ippFindAttribute(response, "printer-strings-uri", IPP_TAG_URI)) != NULL)
+ if ((attr = ippFindAttribute(response, "printer-strings-uri", IPP_TAG_URI)) != NULL && ippValidateAttribute(attr))
cupsFilePrintf(fp, "*cupsStringsURI %s: \"%s\"\n", keyword, ippGetString(attr, 0, NULL));
ippDelete(response);
@@ -5061,18 +5062,16 @@ _ppdCreateFromIPP2(
cupsFilePrintf(fp, "*DefaultInputSlot: %s\n", ppdname);
for (j = 0; j < (int)(sizeof(sources) / sizeof(sources[0])); j ++)
+ {
if (!strcmp(sources[j], keyword))
{
snprintf(msgid, sizeof(msgid), "media-source.%s", keyword);
- if ((msgstr = _cupsLangString(lang, msgid)) == msgid || !strcmp(msgid, msgstr))
- if ((msgstr = _cupsMessageLookup(strings, msgid)) == msgid)
- msgstr = keyword;
-
cupsFilePrintf(fp, "*InputSlot %s: \"<</MediaPosition %d>>setpagedevice\"\n", ppdname, j);
- cupsFilePrintf(fp, "*%s.InputSlot %s/%s: \"\"\n", lang->language, ppdname, msgstr);
+ ppd_put_string(fp, lang, strings, "InputSlot", ppdname, msgid);
break;
}
+ }
}
cupsFilePuts(fp, "*CloseUI: *InputSlot\n");
}
@@ -5098,12 +5097,9 @@ _ppdCreateFromIPP2(
pwg_ppdize_name(keyword, ppdname, sizeof(ppdname));
snprintf(msgid, sizeof(msgid), "media-type.%s", keyword);
- if ((msgstr = _cupsLangString(lang, msgid)) == msgid || !strcmp(msgid, msgstr))
- if ((msgstr = _cupsMessageLookup(strings, msgid)) == msgid)
- msgstr = keyword;
cupsFilePrintf(fp, "*MediaType %s: \"<</MediaType(%s)>>setpagedevice\"\n", ppdname, ppdname);
- cupsFilePrintf(fp, "*%s.MediaType %s/%s: \"\"\n", lang->language, ppdname, msgstr);
+ ppd_put_string(fp, lang, strings, "MediaType", ppdname, msgid);
}
cupsFilePuts(fp, "*CloseUI: *MediaType\n");
}
@@ -5564,12 +5560,9 @@ _ppdCreateFromIPP2(
pwg_ppdize_name(keyword, ppdname, sizeof(ppdname));
snprintf(msgid, sizeof(msgid), "output-bin.%s", keyword);
- if ((msgstr = _cupsLangString(lang, msgid)) == msgid || !strcmp(msgid, msgstr))
- if ((msgstr = _cupsMessageLookup(strings, msgid)) == msgid)
- msgstr = keyword;
cupsFilePrintf(fp, "*OutputBin %s: \"\"\n", ppdname);
- cupsFilePrintf(fp, "*%s.OutputBin %s/%s: \"\"\n", lang->language, ppdname, msgstr);
+ ppd_put_string(fp, lang, strings, "OutputBin", ppdname, msgid);
if ((tray_ptr = ippGetOctetString(trays, i, &tray_len)) != NULL)
{
@@ -5688,9 +5681,6 @@ _ppdCreateFromIPP2(
cupsArrayAdd(names, (char *)keyword);
snprintf(msgid, sizeof(msgid), "finishings.%d", value);
- if ((msgstr = _cupsLangString(lang, msgid)) == msgid || !strcmp(msgid, msgstr))
- if ((msgstr = _cupsMessageLookup(strings, msgid)) == msgid)
- msgstr = keyword;
if (value >= IPP_FINISHINGS_NONE && value <= IPP_FINISHINGS_LAMINATE)
ppd_keyword = base_keywords[value - IPP_FINISHINGS_NONE];
@@ -5705,7 +5695,7 @@ _ppdCreateFromIPP2(
continue;
cupsFilePrintf(fp, "*StapleLocation %s: \"\"\n", ppd_keyword);
- cupsFilePrintf(fp, "*%s.StapleLocation %s/%s: \"\"\n", lang->language, ppd_keyword, msgstr);
+ ppd_put_string(fp, lang, strings, "StapleLocation", ppd_keyword, msgid);
cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*StapleLocation %s\"\n", value, keyword, ppd_keyword);
}
@@ -5768,9 +5758,6 @@ _ppdCreateFromIPP2(
cupsArrayAdd(names, (char *)keyword);
snprintf(msgid, sizeof(msgid), "finishings.%d", value);
- if ((msgstr = _cupsLangString(lang, msgid)) == msgid || !strcmp(msgid, msgstr))
- if ((msgstr = _cupsMessageLookup(strings, msgid)) == msgid)
- msgstr = keyword;
if (value >= IPP_FINISHINGS_NONE && value <= IPP_FINISHINGS_LAMINATE)
ppd_keyword = base_keywords[value - IPP_FINISHINGS_NONE];
@@ -5785,7 +5772,7 @@ _ppdCreateFromIPP2(
continue;
cupsFilePrintf(fp, "*FoldType %s: \"\"\n", ppd_keyword);
- cupsFilePrintf(fp, "*%s.FoldType %s/%s: \"\"\n", lang->language, ppd_keyword, msgstr);
+ ppd_put_string(fp, lang, strings, "FoldType", ppd_keyword, msgid);
cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*FoldType %s\"\n", value, keyword, ppd_keyword);
}
@@ -5856,9 +5843,6 @@ _ppdCreateFromIPP2(
cupsArrayAdd(names, (char *)keyword);
snprintf(msgid, sizeof(msgid), "finishings.%d", value);
- if ((msgstr = _cupsLangString(lang, msgid)) == msgid || !strcmp(msgid, msgstr))
- if ((msgstr = _cupsMessageLookup(strings, msgid)) == msgid)
- msgstr = keyword;
if (value >= IPP_FINISHINGS_NONE && value <= IPP_FINISHINGS_LAMINATE)
ppd_keyword = base_keywords[value - IPP_FINISHINGS_NONE];
@@ -5873,7 +5857,7 @@ _ppdCreateFromIPP2(
continue;
cupsFilePrintf(fp, "*PunchMedia %s: \"\"\n", ppd_keyword);
- cupsFilePrintf(fp, "*%s.PunchMedia %s/%s: \"\"\n", lang->language, ppd_keyword, msgstr);
+ ppd_put_string(fp, lang, strings, "PunchMedia", ppd_keyword, msgid);
cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*PunchMedia %s\"\n", value, keyword, ppd_keyword);
}
@@ -5944,9 +5928,6 @@ _ppdCreateFromIPP2(
cupsArrayAdd(names, (char *)keyword);
snprintf(msgid, sizeof(msgid), "finishings.%d", value);
- if ((msgstr = _cupsLangString(lang, msgid)) == msgid || !strcmp(msgid, msgstr))
- if ((msgstr = _cupsMessageLookup(strings, msgid)) == msgid)
- msgstr = keyword;
if (value == IPP_FINISHINGS_TRIM)
ppd_keyword = "Auto";
@@ -5954,7 +5935,7 @@ _ppdCreateFromIPP2(
ppd_keyword = trim_keywords[value - IPP_FINISHINGS_TRIM_AFTER_PAGES];
cupsFilePrintf(fp, "*CutMedia %s: \"\"\n", ppd_keyword);
- cupsFilePrintf(fp, "*%s.CutMedia %s/%s: \"\"\n", lang->language, ppd_keyword, msgstr);
+ ppd_put_string(fp, lang, strings, "CutMedia", ppd_keyword, msgid);
cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*CutMedia %s\"\n", value, keyword, ppd_keyword);
}
@@ -5996,9 +5977,6 @@ _ppdCreateFromIPP2(
pwg_ppdize_name(keyword, ppdname, sizeof(ppdname));
snprintf(msgid, sizeof(msgid), "finishing-template.%s", keyword);
- if ((msgstr = _cupsLangString(lang, msgid)) == msgid || !strcmp(msgid, msgstr))
- if ((msgstr = _cupsMessageLookup(strings, msgid)) == msgid)
- msgstr = keyword;
cupsFilePrintf(fp, "*cupsFinishingTemplate %s: \"\n", ppdname);
for (finishing_attr = ippFirstAttribute(finishing_col); finishing_attr; finishing_attr = ippNextAttribute(finishing_col))
@@ -6013,7 +5991,7 @@ _ppdCreateFromIPP2(
}
}
cupsFilePuts(fp, "\"\n");
- cupsFilePrintf(fp, "*%s.cupsFinishingTemplate %s/%s: \"\"\n", lang->language, ppdname, msgstr);
+ ppd_put_string(fp, lang, strings, "cupsFinishingTemplate", ppdname, msgid);
cupsFilePuts(fp, "*End\n");
}
@@ -6182,11 +6160,9 @@ _ppdCreateFromIPP2(
cupsFilePuts(fp, "\"\n*End\n");
- if ((localized_name = _cupsMessageLookup(strings, preset_name)) != preset_name)
- {
- pwg_ppdize_name(preset_name, ppdname, sizeof(ppdname));
- cupsFilePrintf(fp, "*%s.APPrinterPreset %s/%s: \"\"\n", lang->language, ppdname, localized_name);
- }
+ snprintf(msgid, sizeof(msgid), "preset-name.%s", preset_name);
+ pwg_ppdize_name(preset_name, ppdname, sizeof(ppdname));
+ ppd_put_string(fp, lang, strings, "APPrinterPreset", ppdname, msgid);
}
}
@@ -6457,6 +6433,43 @@ cups_get_url(http_t **http, /* IO -
}
+/*
+ * 'ppd_put_strings()' - Write localization attributes to a PPD file.
+ */
+
+static void
+ppd_put_string(cups_file_t *fp, /* I - PPD file */
+ cups_lang_t *lang, /* I - Language */
+ cups_array_t *strings, /* I - Strings */
+ const char *ppd_option,/* I - PPD option */
+ const char *ppd_choice,/* I - PPD choice */
+ const char *pwg_msgid) /* I - PWG message ID */
+{
+ const char *text; /* Localized text */
+
+
+ if ((text = _cupsLangString(lang, pwg_msgid)) == pwg_msgid || !strcmp(pwg_msgid, text))
+ {
+ if ((text = _cupsMessageLookup(strings, pwg_msgid)) == pwg_msgid)
+ return;
+ }
+
+ // Add the first line of localized text...
+ cupsFilePrintf(fp, "*%s.%s %s/", lang->language, ppd_option, ppd_choice);
+ while (*text && *text != '\n')
+ {
+ // Escape ":" and "<"...
+ if (*text == ':' || *text == '<')
+ cupsFilePrintf(fp, "<%02X>", *text);
+ else
+ cupsFilePutChar(fp, *text);
+
+ text ++;
+ }
+ cupsFilePuts(fp, ": \"\"\n");
+}
+
+
/*
* 'pwg_add_finishing()' - Add a finishings value.
*/

View File

@ -0,0 +1,32 @@
From 2abe1ba8a66864aa82cd9836b37e57103b8e1a3b Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Mon, 23 Sep 2024 10:11:31 -0400
Subject: [PATCH] Fix warnings for unused vars.
---
cups/ppd-cache.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -4256,8 +4256,7 @@ _ppdCreateFromIPP2(
int have_qdraft = 0,/* Have draft quality? */
have_qhigh = 0; /* Have high quality? */
char msgid[256]; /* Message identifier (attr.value) */
- const char *keyword, /* Keyword value */
- *msgstr; /* Localized string */
+ const char *keyword; /* Keyword value */
cups_array_t *strings = NULL;/* Printer strings file */
struct lconv *loc = localeconv();
/* Locale data */
@@ -6027,9 +6026,8 @@ _ppdCreateFromIPP2(
{
ipp_t *preset = ippGetCollection(attr, i);
/* Preset collection */
- const char *preset_name = ippGetString(ippFindAttribute(preset, "preset-name", IPP_TAG_ZERO), 0, NULL),
+ const char *preset_name = ippGetString(ippFindAttribute(preset, "preset-name", IPP_TAG_ZERO), 0, NULL);
/* Preset name */
- *localized_name; /* Localized preset name */
ipp_attribute_t *member; /* Member attribute in preset */
const char *member_name; /* Member attribute name */
char member_value[256]; /* Member attribute value */

View File

@ -0,0 +1,52 @@
From 6131f6a73c188f3db0ec94ae488991ce80cfd7ea Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Fri, 14 Jun 2024 15:10:21 -0400
Subject: [PATCH] Don't abort early if there are no listen sockets after
loading cupsd.conf (Issue #985)
---
scheduler/conf.c | 2 +-
scheduler/main.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/scheduler/conf.c b/scheduler/conf.c
index ebf8ca8ccd..34b30e56d1 100644
--- a/scheduler/conf.c
+++ b/scheduler/conf.c
@@ -1048,7 +1048,7 @@ cupsdReadConfiguration(void)
* as an error and exit!
*/
- if (cupsArrayCount(Listeners) == 0)
+ if (cupsArrayCount(Listeners) == 0 && !OnDemand)
{
/*
* No listeners!
diff --git a/scheduler/main.c b/scheduler/main.c
index 4472863081..70f3159df6 100644
--- a/scheduler/main.c
+++ b/scheduler/main.c
@@ -2036,6 +2036,23 @@ service_checkin(void)
service_add_listener(fd, 0);
}
#endif /* HAVE_LAUNCHD */
+
+ if (cupsArrayCount(Listeners) == 0)
+ {
+ /*
+ * No listeners!
+ */
+
+ cupsdLogMessage(CUPSD_LOG_EMERG,
+ "No valid Listen or Port lines were found in the "
+ "configuration file.");
+
+ /*
+ * Commit suicide...
+ */
+
+ cupsdEndProcess(getpid(), 0);
+ }
}

View File

@ -0,0 +1,95 @@
From a436956f374b0fd7f5da9df482e4f5840fa1c0d2 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Mon, 3 Jun 2024 18:53:58 +020
Subject: [PATCH] Fix domain socket handling
Reference: https://github.com/OpenPrinting/cups/commit/a436956f374b0fd7f5da9df482e4f5840fa1c0d2
---
cups/http-addr.c | 37 +++++++++++++++++++------------------
scheduler/conf.c | 19 +++++++++++++++++++
2 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/cups/http-addr.c b/cups/http-addr.c
index 254857c..29a821f 100644
--- a/cups/http-addr.c
+++ b/cups/http-addr.c
@@ -210,27 +210,28 @@ httpAddrListen(http_addr_t *addr, /* I - Address to bind to */
* Remove any existing domain socket file...
*/
- unlink(addr->un.sun_path);
-
- /*
- * Save the current umask and set it to 0 so that all users can access
- * the domain socket...
- */
-
- mask = umask(0);
-
- /*
- * Bind the domain socket...
- */
+ if ((status = unlink(addr->un.sun_path)) < 0)
+ {
+ DEBUG_printf(("1httpAddrListen: Unable to unlink \"%s\": %s", addr->un.sun_path, strerror(errno)));
- status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr));
+ if (errno == ENOENT)
+ status = 0;
+ }
- /*
- * Restore the umask and fix permissions...
- */
+ if (!status)
+ {
+ // Save the current umask and set it to 0 so that all users can access
+ // the domain socket...
+ mask = umask(0);
+ // Bind the domain socket...
+ if ((status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr))) < 0)
+ {
+ DEBUG_printf(("1httpAddrListen: Unable to bind domain socket \"%s\": %s", addr->un.sun_path, strerror(errno)));
+ }
- umask(mask);
- chmod(addr->un.sun_path, 0140777);
+ // Restore the umask...
+ umask(mask);
+ }
}
else
#endif /* AF_LOCAL */
diff --git a/scheduler/conf.c b/scheduler/conf.c
index 4fa7eb1..8e54c47 100644
--- a/scheduler/conf.c
+++ b/scheduler/conf.c
@@ -3082,6 +3082,25 @@ read_cupsd_conf(cups_file_t *fp) /* I - File to read from */
cupsd_listener_t *lis; /* New listeners array */
+ /*
+ * If we are launched on-demand, do not use domain sockets from the config
+ * file. Also check that the domain socket path is not too long...
+ */
+
+#ifdef HAVE_ONDEMAND
+ if (*value == '/' && OnDemand)
+ {
+ if (strcmp(value, CUPS_DEFAULT_DOMAINSOCKET))
+ cupsdLogMessage(CUPSD_LOG_INFO, "Ignoring %s address %s at line %d - only using domain socket from launchd/systemd.", line, value, linenum);
+ continue;
+ }
+#endif // HAVE_ONDEMAND
+
+ if (*value == '/' && strlen(value) > (sizeof(addr->addr.un.sun_path) - 1))
+ {
+ cupsdLogMessage(CUPSD_LOG_INFO, "Ignoring %s address %s at line %d - too long.", line, value, linenum);
+ continue;
+ }
/*
* Get the address list...
--
2.27.0

View File

@ -1,46 +0,0 @@
From ee02b74ad03b52a5226f80dd2f551c1b565cdbb2 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <michael.r.sweet@gmail.com>
Date: Wed, 12 Jan 2022 08:12:24 -0500
Subject: [PATCH] Remove legacy code for RIP_MAX_CACHE environment variable
(Issue #323)
Reference:https://github.com/OpenPrinting/cups/commit/ee02b74ad03b52a5226f80dd2f551c1b565cdbb2
---
CHANGES.md | 12 +++++++++---
scheduler/job.c | 7 ++-----
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/scheduler/job.c b/scheduler/job.c
index fd69f71c9c..fbacc4cd12 100644
--- a/scheduler/job.c
+++ b/scheduler/job.c
@@ -541,10 +541,8 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */
/* PRINTER_LOCATION env variable */
printer_name[255],
/* PRINTER env variable */
- *printer_state_reasons = NULL,
+ *printer_state_reasons = NULL;
/* PRINTER_STATE_REASONS env var */
- rip_max_cache[255];
- /* RIP_MAX_CACHE env variable */
cupsdLogMessage(CUPSD_LOG_DEBUG2,
@@ -749,7 +747,7 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */
raw_file = !strcmp(job->filetypes[job->current_file]->super, "application") &&
!strcmp(job->filetypes[job->current_file]->type, "vnd.cups-raw");
-
+
if ((job->compressions[job->current_file] && (!job->printer->remote || job->num_files == 1)) ||
(!job->printer->remote && (job->printer->raw || raw_file) && job->num_files > 1))
{
@@ -1051,7 +1049,6 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */
envp[envc ++] = apple_language;
#endif /* __APPLE__ */
envp[envc ++] = ppd;
- envp[envc ++] = rip_max_cache;
envp[envc ++] = content_type;
envp[envc ++] = device_uri;
envp[envc ++] = printer_info;

File diff suppressed because it is too large Load Diff

2033
cups-lspp.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
Name: cups
Epoch: 1
Version: 2.4.7
Release: 1
Release: 6
Summary: CUPS is the standards-based, open source printing system for linux operating systems.
License: Apache-2.0
Url: https://openprinting.github.io/cups/
@ -23,8 +23,17 @@ Patch7: cups-uri-compat.patch
Patch8: cups-freebind.patch
Patch9: cups-ipp-multifile.patch
Patch10: cups-web-devices-timeout.patch
Patch11: cups-lspp.patch
Patch6004: fix-httpAddrGetList-test-case-fail.patch
Patch6005: backport-Fix-CVE-2024-35235.patch
Patch6006: backport-Fix-CVE-2024-35235-regression.patch
Patch6007: backport-delay-creating-driverless-printer-until-ppd-generated.patch
Patch6008: backport-0001-CVE-2024-47175.patch
Patch6009: backport-0002-CVE-2024-47175.patch
Patch6010: backport-0003-CVE-2024-47175.patch
Patch6011: backport-0004-CVE-2024-47175.patch
Patch6012: backport-0005-CVE-2024-47175.patch
BuildRequires: pam-devel pkgconf-pkg-config pkgconfig(gnutls) libacl-devel openldap-devel pkgconfig(libusb-1.0)
BuildRequires: krb5-devel pkgconfig(avahi-client) systemd pkgconfig(libsystemd) pkgconfig(dbus-1) python3-cups
@ -63,7 +72,7 @@ programs.
Summary: CUPS printing system - development environment
License: Apache-2.0
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires: gnutls-devel krb5-devel zlib-devel
Requires: gnutls-devel krb5-devel zlib-devel pkgconf-pkg-config
%description devel
CUPS is the standards-based, open source printing system developed by Apple Inc.
@ -145,20 +154,20 @@ export CFLAGS="$RPM_OPT_FLAGS -fstack-protector-all -DLDAP_DEPRECATED=1"
# --enable-debug to avoid stripping binaries
%configure --with-docdir=%{_datadir}/%{name}/www --enable-debug \
--enable-lspp \
--enable-webif \
--enable-relro \
--enable-page-logging \
--enable-sync-on-close \
--with-exe-file-perm=0755 \
--with-cupsd-file-perm=0755 \
--with-log-file-perm=0600 \
--enable-relro \
--with-dbusdir=%{_sysconfdir}/dbus-1 \
--enable-avahi \
--enable-threads \
--enable-gnutls \
--enable-webif \
--with-xinetd=no \
--with-access-log-level=actions \
--enable-page-logging \
--with-pkgconfpath=%{_libdir}/pkgconfig \
--with-dnssd=avahi \
--with-tls=gnutls \
--with-rundir=%{_rundir}/cups \
--enable-sync-on-close \
localedir=%{_datadir}/locale
%make_build
@ -333,21 +342,6 @@ rm -f %{_exec_prefix}/lib/cups/backend/smb
%dir %attr(1770,root,lp) %{_localstatedir}/spool/cups/tmp
%dir %attr(0710,root,lp) %{_localstatedir}/spool/cups
%dir %attr(0755,root,lp) %{_localstatedir}/log/cups
# client subpackage
%exclude %{_mandir}/man1/lp*.1.gz
%exclude %{_mandir}/man1/cancel-cups.1.gz
%exclude %{_mandir}/man8/lpc-cups.8.gz
# devel subpackage
%exclude %{_mandir}/man1/cups-config.1.gz
# ipptool subpackage
%exclude %{_mandir}/man1/ipptool.1.gz
%exclude %{_mandir}/man5/ipptoolfile.5.gz
# lpd subpackage
%exclude %{_mandir}/man8/cups-lpd.8.gz
# printerapp
%exclude %{_mandir}/man1/ippeveprinter.1.gz
%exclude %{_mandir}/man7/ippevepcl.7.gz
%exclude %{_mandir}/man7/ippeveps.7.gz
%dir %attr(0755,root,lp) %{_rundir}/cups
%dir %attr(0511,lp,sys) %{_rundir}/cups/certs
%dir %attr(0755,root,lp) %{_sysconfdir}/cups
@ -376,9 +370,6 @@ rm -f %{_exec_prefix}/lib/cups/backend/smb
%{_bindir}/cancel*
%{_bindir}/lp*
%{_sbindir}/lpc.cups
%{_mandir}/man1/cancel-cups.1.gz
%{_mandir}/man1/lp*.1.gz
%{_mandir}/man8/lpc-cups.8.gz
%files libs
%{license} LICENSE
@ -403,12 +394,12 @@ rm -f %{_exec_prefix}/lib/cups/backend/smb
%{_bindir}/cups-config
%{_includedir}/cups
%{_libdir}/*.so
%{_libdir}/pkgconfig/cups.pc
%{_rpmconfigdir}/macros.d/macros.cups
%{_prefix}/lib/pkgconfig/cups.pc
%files lpd
%{cups_serverbin}/daemon/cups-lpd
%{_mandir}/man8/cups-lpd.8.gz
%attr(0644, root, root)%{_unitdir}/cups-lpd.socket
%attr(0644, root, root)%{_unitdir}/cups-lpd@.service
@ -417,21 +408,15 @@ rm -f %{_exec_prefix}/lib/cups/backend/smb
%{_bindir}/ipptool
%dir %{_datadir}/cups/ipptool
%{_datadir}/cups/ipptool/*
%{_mandir}/man1/ipptool.1.gz
%{_mandir}/man5/ipptoolfile.5.gz
%files printerapp
%{_bindir}/ippeveprinter
%dir %{cups_serverbin}/command
%{cups_serverbin}/command/ippevepcl
%{cups_serverbin}/command/ippeveps
%{_mandir}/man1/ippeveprinter.1.gz
%{_mandir}/man7/ippevepcl.7.gz
%{_mandir}/man7/ippeveps.7.gz
%files help
%{_mandir}/man[1578]/*
%{_mandir}/man1/cups-config.1.gz
%{_mandir}/man?/*
%doc README.md CREDITS.md CHANGES.md
%doc %{_datadir}/%{name}/www/index.html
%doc %{_datadir}/%{name}/www/help
@ -446,6 +431,23 @@ rm -f %{_exec_prefix}/lib/cups/backend/smb
%doc %{_datadir}/%{name}/www/apple-touch-icon.png
%changelog
* Sat Oct 12 2024 Funda Wang <fundawang@yeah.net> - 1:2.4.7-6
- fix file conflicts regarding man pages
- add back lspp patch
* Tue Oct 8 2024 zhangpan <zhangpan103@h-partners.com> - 1:2.4.7-5
- fix CVE-2024-47175
* Wed Aug 14 2024 Funda Wang <fundawang@yeah.net> - 1:2.4.7-4
- Fix regression of fixing CVE-2024-35235 (upstream issue#985)
* Wed Jun 12 2024 baiguo <baiguo@kylinos.cn> - 1:2.4.7-3
- fix CVE-2024-35235
* Tue Mar 26 2024 zhaojunfei <junfei.oerv@isrc.iscas.ac.cn> - 1:2.4.7-2
- fix pkgconfig file generating
- eliminate deprecated configure parameters
* Fri Dec 29 2023 wangrui <wangrui.oerv@isrc.iscas.ac.cn> - 1:2.4.7-1
- update to 2.4.7 version

View File

@ -1,4 +1,4 @@
version_control: github
src_repo: apple/cups
src_repo: OpenPrinting/cups
tag_prefix: ^v
seperator: .
separator: .