diff --git a/0001-Add-NoSystem-SSLOptions-value.patch b/0001-Add-NoSystem-SSLOptions-value.patch new file mode 100644 index 0000000000000000000000000000000000000000..879ce15f5c0280924212736e4444968726ad0ee2 --- /dev/null +++ b/0001-Add-NoSystem-SSLOptions-value.patch @@ -0,0 +1,183 @@ +From 40e62848ab3aa94b98dfaf1334e1c478c266bc73 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Tue, 7 Jan 2025 15:12:15 +0100 +Subject: [PATCH] Add `NoSystem` SSLOptions value + +In case using system crypto policy breaks communication with device +irreversibly (f.e. if device does not support better key exchange +algorithm), the new option value gives a way how to opt-out from crypto +policy if user do not want to change default system crypto policy for +the whole machine. +--- + CHANGES.md | 1 + + cups/http-private.h | 3 ++- + cups/tls-gnutls.c | 7 ++++++- + cups/usersys.c | 2 ++ + doc/help/man-client.conf.html | 3 ++- + doc/help/man-cupsd.conf.html | 5 +++-- + man/client.conf.5 | 3 ++- + man/cupsd.conf.5 | 3 ++- + scheduler/conf.c | 2 ++ + 9 files changed, 22 insertions(+), 7 deletions(-) + +diff --git a/cups/http-private.h b/cups/http-private.h +index 5f77b8ef0..f248bbb8d 100644 +--- a/cups/http-private.h ++++ b/cups/http-private.h +@@ -131,7 +131,8 @@ extern "C" { + # define _HTTP_TLS_ALLOW_RC4 1 /* Allow RC4 cipher suites */ + # define _HTTP_TLS_ALLOW_DH 2 /* Allow DH/DHE key negotiation */ + # define _HTTP_TLS_DENY_CBC 4 /* Deny CBC cipher suites */ +-# define _HTTP_TLS_SET_DEFAULT 128 /* Setting the default TLS options */ ++# define _HTTP_TLS_NO_SYSTEM 8 /* No system crypto policy */ ++# define _HTTP_TLS_SET_DEFAULT 128 /* Setting the default TLS options */ + + # define _HTTP_TLS_SSL3 0 /* Min/max version is SSL/3.0 */ + # define _HTTP_TLS_1_0 1 /* Min/max version is TLS/1.0 */ +diff --git a/cups/tls-gnutls.c b/cups/tls-gnutls.c +index 719161da7..e8224b217 100644 +--- a/cups/tls-gnutls.c ++++ b/cups/tls-gnutls.c +@@ -1285,6 +1285,8 @@ _httpTLSStart(http_t *http) /* I - Connection to server */ + + DEBUG_printf(("3_httpTLSStart(http=%p)", http)); + ++ priority_string[0] = '\0'; ++ + if (tls_options < 0) + { + DEBUG_puts("4_httpTLSStart: Setting defaults."); +@@ -1504,7 +1506,10 @@ _httpTLSStart(http_t *http) /* I - Connection to server */ + return (-1); + } + +- strlcpy(priority_string, "@SYSTEM,NORMAL", sizeof(priority_string)); ++ if (!(tls_options & _HTTP_TLS_NO_SYSTEM)) ++ strlcpy(priority_string, "@SYSTEM,", sizeof(priority_string)); ++ ++ strlcat(priority_string, "NORMAL", sizeof(priority_string)); + + if (tls_max_version < _HTTP_TLS_MAX) + { +diff --git a/cups/usersys.c b/cups/usersys.c +index f752159b0..607587307 100644 +--- a/cups/usersys.c ++++ b/cups/usersys.c +@@ -1608,6 +1608,8 @@ cups_set_ssl_options( + min_version = _HTTP_TLS_1_3; + else if (!_cups_strcasecmp(start, "None")) + options = _HTTP_TLS_NONE; ++ else if (!_cups_strcasecmp(start, "NoSystem")) ++ options |= _HTTP_TLS_NO_SYSTEM; + } + + cc->ssl_options = options; +diff --git a/doc/help/man-client.conf.html b/doc/help/man-client.conf.html +index 81cd73a1a..9194481bb 100644 +--- a/doc/help/man-client.conf.html ++++ b/doc/help/man-client.conf.html +@@ -44,7 +44,7 @@ CUPS adds the remote hostname ("name@server.example.com") for you. The default n + Note: This directive is not supported on macOS 10.7 or later. +
ServerName hostname-or-ip-address[:port]/version=1.1 +
Specifies the address and optionally the port to use when connecting to a server running CUPS 1.3.12 and earlier. +-
SSLOptions [AllowDH] [AllowRC4] [AllowSSL3] [DenyCBC] [DenyTLS1.0] [MaxTLS1.0] [MaxTLS1.1] [MaxTLS1.2] [MaxTLS1.3] [MinTLS1.0] [MinTLS1.1] [MinTLS1.2] [MinTLS1.3] ++
SSLOptions [AllowDH] [AllowRC4] [AllowSSL3] [DenyCBC] [DenyTLS1.0] [MaxTLS1.0] [MaxTLS1.1] [MaxTLS1.2] [MaxTLS1.3] [MinTLS1.0] [MinTLS1.1] [MinTLS1.2] [MinTLS1.3] [NoSystem] +
SSLOptions None +
Sets encryption options (only in /etc/cups/client.conf). + By default, CUPS only supports encryption using TLS v1.0 or higher using known secure cipher suites. +@@ -57,6 +57,7 @@ The DenyCBC option disables all CBC cipher suites. + The DenyTLS1.0 option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1. + The MinTLS options set the minimum TLS version to support. + The MaxTLS options set the maximum TLS version to support. ++The NoSystem option disables applying system cryptographic policy. + Not all operating systems support TLS 1.3 at this time. +
TrustOnFirstUse Yes +
TrustOnFirstUse No +diff --git a/doc/help/man-cupsd.conf.html b/doc/help/man-cupsd.conf.html +index 4fd42f314..4a5395387 100644 +--- a/doc/help/man-cupsd.conf.html ++++ b/doc/help/man-cupsd.conf.html +@@ -285,7 +285,7 @@ The default is "Minimal". +
SSLListen [ipv6-address]:port +
SSLListen *:port +
Listens on the specified address and port for encrypted connections. +-
SSLOptions [AllowDH] [AllowRC4] [AllowSSL3] [DenyCBC] [DenyTLS1.0] [MaxTLS1.0] [MaxTLS1.1] [MaxTLS1.2] [MaxTLS1.3] [MinTLS1.0] [MinTLS1.1] [MinTLS1.2] [MinTLS1.3] ++
SSLOptions [AllowDH] [AllowRC4] [AllowSSL3] [DenyCBC] [DenyTLS1.0] [MaxTLS1.0] [MaxTLS1.1] [MaxTLS1.2] [MaxTLS1.3] [MinTLS1.0] [MinTLS1.1] [MinTLS1.2] [MinTLS1.3] [NoSystem] +
SSLOptions None +
Sets encryption options (only in /etc/cups/client.conf). + By default, CUPS only supports encryption using TLS v1.0 or higher using known secure cipher suites. +@@ -298,6 +298,7 @@ The DenyCBC option disables all CBC cipher suites. + The DenyTLS1.0 option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1. + The MinTLS options set the minimum TLS version to support. + The MaxTLS options set the maximum TLS version to support. ++The NoSystem option disables applying system cryptographic policy. + Not all operating systems support TLS 1.3 at this time. +
SSLPort port +
Listens on the specified port for encrypted connections. +@@ -632,7 +633,7 @@ Require authentication for accesses from outside the 10. network: + subscriptions.conf(5), + CUPS Online Help (http://localhost:631/help) +

Copyright

+-Copyright © 2020-2023 by OpenPrinting. ++Copyright © 2020-2024 by OpenPrinting. + + + +diff --git a/man/client.conf.5 b/man/client.conf.5 +index 54808c09f..56d6ec3ec 100644 +--- a/man/client.conf.5 ++++ b/man/client.conf.5 +@@ -67,7 +67,7 @@ Specifies the address and optionally the port to use when connecting to the serv + Specifies the address and optionally the port to use when connecting to a server running CUPS 1.3.12 and earlier. + .\"#SSLOptions + .TP 5 +-\fBSSLOptions \fR[\fIAllowDH\fR] [\fIAllowRC4\fR] [\fIAllowSSL3\fR] [\fIDenyCBC\fR] [\fIDenyTLS1.0\fR] [\fIMaxTLS1.0\fR] [\fIMaxTLS1.1\fR] [\fIMaxTLS1.2\fR] [\fIMaxTLS1.3\fR] [\fIMinTLS1.0\fR] [\fIMinTLS1.1\fR] [\fIMinTLS1.2\fR] [\fIMinTLS1.3\fR] ++\fBSSLOptions \fR[\fIAllowDH\fR] [\fIAllowRC4\fR] [\fIAllowSSL3\fR] [\fIDenyCBC\fR] [\fIDenyTLS1.0\fR] [\fIMaxTLS1.0\fR] [\fIMaxTLS1.1\fR] [\fIMaxTLS1.2\fR] [\fIMaxTLS1.3\fR] [\fIMinTLS1.0\fR] [\fIMinTLS1.1\fR] [\fIMinTLS1.2\fR] [\fIMinTLS1.3\fR] [\fINoSystem\fR] + .TP 5 + \fBSSLOptions None\fR + Sets encryption options (only in /etc/cups/client.conf). +@@ -81,6 +81,7 @@ The \fIDenyCBC\fR option disables all CBC cipher suites. + The \fIDenyTLS1.0\fR option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1. + The \fIMinTLS\fR options set the minimum TLS version to support. + The \fIMaxTLS\fR options set the maximum TLS version to support. ++The \fINoSystem\fR option disables applying system cryptographic policy. + Not all operating systems support TLS 1.3 at this time. + .\"#TrustOnFirstUse + .TP 5 +diff --git a/man/cupsd.conf.5 b/man/cupsd.conf.5 +index fd5762dfd..4e1a7ca81 100644 +--- a/man/cupsd.conf.5 ++++ b/man/cupsd.conf.5 +@@ -447,7 +447,7 @@ Listens on the specified address and port for encrypted connections. + .\"#SSLOptions + .TP 5 + .TP 5 +-\fBSSLOptions \fR[\fIAllowDH\fR] [\fIAllowRC4\fR] [\fIAllowSSL3\fR] [\fIDenyCBC\fR] [\fIDenyTLS1.0\fR] [\fIMaxTLS1.0\fR] [\fIMaxTLS1.1\fR] [\fIMaxTLS1.2\fR] [\fIMaxTLS1.3\fR] [\fIMinTLS1.0\fR] [\fIMinTLS1.1\fR] [\fIMinTLS1.2\fR] [\fIMinTLS1.3\fR] ++\fBSSLOptions \fR[\fIAllowDH\fR] [\fIAllowRC4\fR] [\fIAllowSSL3\fR] [\fIDenyCBC\fR] [\fIDenyTLS1.0\fR] [\fIMaxTLS1.0\fR] [\fIMaxTLS1.1\fR] [\fIMaxTLS1.2\fR] [\fIMaxTLS1.3\fR] [\fIMinTLS1.0\fR] [\fIMinTLS1.1\fR] [\fIMinTLS1.2\fR] [\fIMinTLS1.3\fR] [\fINoSystem\fR] + .TP 5 + \fBSSLOptions None\fR + Sets encryption options (only in /etc/cups/client.conf). +@@ -461,6 +461,7 @@ The \fIDenyCBC\fR option disables all CBC cipher suites. + The \fIDenyTLS1.0\fR option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1. + The \fIMinTLS\fR options set the minimum TLS version to support. + The \fIMaxTLS\fR options set the maximum TLS version to support. ++The \fINoSystem\fR option disables applying system cryptographic policy. + Not all operating systems support TLS 1.3 at this time. + .\"#SSLPort + .TP 5 +diff --git a/scheduler/conf.c b/scheduler/conf.c +index 3184d72f0..3bf176479 100644 +--- a/scheduler/conf.c ++++ b/scheduler/conf.c +@@ -3054,6 +3054,8 @@ read_cupsd_conf(cups_file_t *fp) /* I - File to read from */ + min_version = _HTTP_TLS_1_3; + else if (!_cups_strcasecmp(start, "None")) + options = _HTTP_TLS_NONE; ++ else if (!_cups_strcasecmp(start, "NoSystem")) ++ options |= _HTTP_TLS_NO_SYSTEM; + else if (_cups_strcasecmp(start, "NoEmptyFragments")) + cupsdLogMessage(CUPSD_LOG_WARN, "Unknown SSL option %s at line %d.", start, linenum); + } +-- +2.47.1 + diff --git a/0001-Fix-Coverity-discovered-issues.patch b/0001-Fix-Coverity-discovered-issues.patch new file mode 100644 index 0000000000000000000000000000000000000000..bd40965249911d877a1669f4be0fa52dcd381632 --- /dev/null +++ b/0001-Fix-Coverity-discovered-issues.patch @@ -0,0 +1,28 @@ +From 08d2576b02fced09b94bcc205cfa7d08300abac3 Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +Date: Wed, 13 Sep 2023 13:47:55 -0400 +Subject: [PATCH] Fix Coverity-discovered issues. + +--- + cups/raster-stream.c | 2 +- + scheduler/ipp.c | 13 +++++-------- + scheduler/job.c | 2 -- + tools/ipptool.c | 15 +++++++++------ + 4 files changed, 15 insertions(+), 17 deletions(-) + +diff --git a/scheduler/job.c b/scheduler/job.c +index 278bfb501..6b5ae84ec 100644 +--- a/scheduler/job.c ++++ b/scheduler/job.c +@@ -767,8 +767,6 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ + cupsdLogJob(job, CUPSD_LOG_DEBUG, + "Unable to add decompression filter - %s", strerror(errno)); + +- cupsArrayDelete(filters); +- + abort_message = "Stopping job because the scheduler ran out of memory."; + + goto abort_job; +-- +2.47.0 + diff --git a/0001-Fix-IPP-everywhere-printer-setup-Issue-1033.patch b/0001-Fix-IPP-everywhere-printer-setup-Issue-1033.patch new file mode 100644 index 0000000000000000000000000000000000000000..7fe1a356762db458e3bca25b71ba9dfe8c96e9db --- /dev/null +++ b/0001-Fix-IPP-everywhere-printer-setup-Issue-1033.patch @@ -0,0 +1,44 @@ +From 313c388dbc023bbcb75d1efed800d0cfc992a6cc Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +Date: Wed, 14 Aug 2024 21:18:54 -0400 +Subject: [PATCH] Fix IPP everywhere printer setup (Issue #1033) + +--- + CHANGES.md | 1 + + scheduler/ipp.c | 6 +++--- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/scheduler/ipp.c b/scheduler/ipp.c +index 37623c54e..d334f70cf 100644 +--- a/scheduler/ipp.c ++++ b/scheduler/ipp.c +@@ -5346,7 +5346,7 @@ create_local_bg_thread( + + request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES); + ippSetVersion(request, 2, 0); +- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printer->device_uri); ++ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, device_uri); + ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs); + + response = cupsDoRequest(http, request, resource); +@@ -5367,7 +5367,7 @@ create_local_bg_thread( + + request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES); + ippSetVersion(request, 1, 1); +- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printer->device_uri); ++ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, device_uri); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", NULL, "all"); + + response = cupsDoRequest(http, request, resource); +@@ -5390,7 +5390,7 @@ create_local_bg_thread( + request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES); + ippSetVersion(request, 2, 0); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, +- "printer-uri", NULL, uri); ++ "printer-uri", NULL, device_uri); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, + "requested-attributes", NULL, "media-col-database"); + response2 = cupsDoRequest(http, request, resource); +-- +2.46.0 + diff --git a/0001-Fix-make-and-model-whitespace-trimming-Issue-1096.patch b/0001-Fix-make-and-model-whitespace-trimming-Issue-1096.patch new file mode 100644 index 0000000000000000000000000000000000000000..d9e7dcfae01a2e5d844cfe954a1e9caa336ef1ac --- /dev/null +++ b/0001-Fix-make-and-model-whitespace-trimming-Issue-1096.patch @@ -0,0 +1,26 @@ +From 5cc470c8d95df40f32e8a401b2946886c91b03d1 Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +Date: Fri, 15 Nov 2024 11:55:07 -0500 +Subject: [PATCH] Fix make-and-model whitespace trimming (Issue #1096) + +--- + CHANGES.md | 1 + + cups/ppd-cache.c | 2 ++ + 2 files changed, 3 insertions(+) + +diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c +index a6163a0e1..a3198a795 100644 +--- a/cups/ppd-cache.c ++++ b/cups/ppd-cache.c +@@ -3293,6 +3293,8 @@ _ppdCreateFromIPP2( + mptr --; + if (*mptr == ' ') + *mptr = '\0'; ++ else ++ break; + } + + if (!make[0]) +-- +2.47.0 + diff --git a/0001-cgi-Fix-checkbox-support-fixes-1008.patch b/0001-cgi-Fix-checkbox-support-fixes-1008.patch new file mode 100644 index 0000000000000000000000000000000000000000..4614c75dab6b041c7bd0f160d9ed010de4b432bd --- /dev/null +++ b/0001-cgi-Fix-checkbox-support-fixes-1008.patch @@ -0,0 +1,759 @@ +From f37d3eb8a091addda1b34d6d264e8a4ac25cec25 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Mon, 22 Jul 2024 12:32:32 +0200 +Subject: [PATCH] cgi: Fix checkbox support (fixes #1008) + +There was a change in CGI script regarding checkboxes, however it did +not propagate into templates. Based on the change, the only valid check +was if the variable value was checkbox, but some browsers (at least +Firefox) send on as a default value for input form of type checkbox. + +Additionally, the value checkbox looks like typo, because we use checked +as value for checkboxes in admin CGI program, so I updated +cgiGetCheckbox() as well. + +To fix the behavior, we have to set VALUE="CHECKED" into every tag in +every templates for all checkboxes - this value will be sent in the +input form, so it will properly match with cgiGetCheckbox() logic now. + +In the end, I have found out "Preserve Job History" checkbox from +template was handled as text field, which did not look correct. + +Fixes #1008 +--- + cgi-bin/admin.c | 12 +++++++----- + cgi-bin/var.c | 2 +- + templates/add-printer.tmpl | 2 +- + templates/admin.tmpl | 30 ++++++++++++++--------------- + templates/da/add-printer.tmpl | 2 +- + templates/da/admin.tmpl | 30 ++++++++++++++--------------- + templates/da/modify-printer.tmpl | 2 +- + templates/de/add-printer.tmpl | 2 +- + templates/de/admin.tmpl | 30 ++++++++++++++--------------- + templates/de/modify-printer.tmpl | 2 +- + templates/es/add-printer.tmpl | 2 +- + templates/es/admin.tmpl | 30 ++++++++++++++--------------- + templates/es/modify-printer.tmpl | 2 +- + templates/fr/add-printer.tmpl | 2 +- + templates/fr/admin.tmpl | 30 ++++++++++++++--------------- + templates/fr/modify-printer.tmpl | 2 +- + templates/ja/add-printer.tmpl | 2 +- + templates/ja/admin.tmpl | 30 ++++++++++++++--------------- + templates/ja/modify-printer.tmpl | 2 +- + templates/modify-printer.tmpl | 2 +- + templates/pl/add-printer.tmpl | 2 +- + templates/pl/admin.tmpl | 30 ++++++++++++++--------------- + templates/pl/modify-printer.tmpl | 2 +- + templates/pt_BR/add-printer.tmpl | 2 +- + templates/pt_BR/admin.tmpl | 30 ++++++++++++++--------------- + templates/pt_BR/modify-printer.tmpl | 2 +- + templates/ru/add-printer.tmpl | 2 +- + templates/ru/admin.tmpl | 30 ++++++++++++++--------------- + templates/ru/modify-printer.tmpl | 2 +- + 29 files changed, 161 insertions(+), 159 deletions(-) + +diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c +index 107700e46..62e1c8fd0 100644 +--- a/cgi-bin/admin.c ++++ b/cgi-bin/admin.c +@@ -1314,9 +1314,9 @@ do_config_server(http_t *http) /* I - HTTP connection */ + browse_web_if = cgiGetCheckbox("BROWSE_WEB_IF") ? "Yes" : "No"; + max_clients = cgiGetTextfield("MAX_CLIENTS"); + max_log_size = cgiGetTextfield("MAX_LOG_SIZE"); +- preserve_jobs = cgiGetTextfield("PRESERVE_JOBS"); ++ preserve_jobs = cgiGetCheckbox("PRESERVE_JOBS") ? "1" : "0"; + +- if (preserve_jobs) ++ if (atoi(preserve_jobs)) + { + max_jobs = cgiGetTextfield("MAX_JOBS"); + preserve_job_history = cgiGetTextfield("PRESERVE_JOB_HISTORY"); +@@ -1325,10 +1325,12 @@ do_config_server(http_t *http) /* I - HTTP connection */ + if (!max_jobs || atoi(max_jobs) < 0) + max_jobs = "500"; + +- if (!preserve_job_history) +- preserve_job_history = "On"; ++ if (!preserve_job_history || !preserve_job_history[0] || ++ (strcasecmp(preserve_job_history, "yes") && strcasecmp(preserve_job_history, "no") && !atoi(preserve_job_history))) ++ preserve_job_history = "Yes"; + +- if (!preserve_job_files) ++ if (!preserve_job_files || !preserve_job_files[0] || ++ (strcasecmp(preserve_job_files, "yes") && strcasecmp(preserve_job_files, "no") && !atoi(preserve_job_files))) + preserve_job_files = "1d"; + } + else +diff --git a/cgi-bin/var.c b/cgi-bin/var.c +index 822f8b93c..e97d2a8fc 100644 +--- a/cgi-bin/var.c ++++ b/cgi-bin/var.c +@@ -191,7 +191,7 @@ cgiGetCheckbox(const char *name) /* I - Name of form field */ + int ret; /* Return value */ + + +- ret = value && !_cups_strcasecmp(value, "checkbox"); ++ ret = value && !_cups_strcasecmp(value, "checked"); + + if (!ret && value) + { +diff --git a/templates/add-printer.tmpl b/templates/add-printer.tmpl +index 339fe662f..7e4f559aa 100644 +--- a/templates/add-printer.tmpl ++++ b/templates/add-printer.tmpl +@@ -32,7 +32,7 @@ + + + Sharing: +- ++ + + + +diff --git a/templates/admin.tmpl b/templates/admin.tmpl +index b8f528737..a954f2b7f 100644 +--- a/templates/admin.tmpl ++++ b/templates/admin.tmpl +@@ -38,23 +38,23 @@ + +

Advanced
+ +- +-
++ ++
+         Max clients\: +
+-         
+-         
+-
+- {have_gssapi?
:} +-
+-
++         
++         
++
++ {have_gssapi?
:} ++
++
+         Maximum jobs (0 for no limit)\: +
+         Retain Metadata\: +
+         Retain Documents\: +
+-
++
+         Max log file size\: +

+ +@@ -62,12 +62,12 @@ + +

Advanced
+ +-
+-         
+-
+- {have_gssapi?
:} +-
+-

++
++         
++
++ {have_gssapi?
:} ++
++

+ + } +

+diff --git a/templates/da/add-printer.tmpl b/templates/da/add-printer.tmpl +index ed206678b..ed34c33f2 100644 +--- a/templates/da/add-printer.tmpl ++++ b/templates/da/add-printer.tmpl +@@ -32,7 +32,7 @@ + + + Deling: +- ++ + + + +diff --git a/templates/da/admin.tmpl b/templates/da/admin.tmpl +index 87f83e0ef..de33275f3 100644 +--- a/templates/da/admin.tmpl ++++ b/templates/da/admin.tmpl +@@ -38,23 +38,23 @@ + +

Avanceret
+ +- +-
++ ++
+         Maks. klienter\: +
+-         
+-         
+-
+- {have_gssapi?
:} +-
+-
++         
++         
++
++ {have_gssapi?
:} ++
++
+         Maksimum jobs (0 for ubegrænset)\: +
+         Bevar metadata\: +
+         Bevar dokumenter\: +
+-
++
+         Maks. størrelse på logfil\: +

+ +@@ -62,12 +62,12 @@ + +

Avanceret
+ +-
+-         
+-
+- {have_gssapi?
:} +-
+-

++
++         
++
++ {have_gssapi?
:} ++
++

+ + } +

+diff --git a/templates/da/modify-printer.tmpl b/templates/da/modify-printer.tmpl +index 9eb32af9d..4e175194a 100644 +--- a/templates/da/modify-printer.tmpl ++++ b/templates/da/modify-printer.tmpl +@@ -26,7 +26,7 @@ + + + Deling: +- ++ + + + +diff --git a/templates/de/add-printer.tmpl b/templates/de/add-printer.tmpl +index b54fb225f..acb44d4f2 100644 +--- a/templates/de/add-printer.tmpl ++++ b/templates/de/add-printer.tmpl +@@ -32,7 +32,7 @@ + + + Freigabe: +- ++ + + + +diff --git a/templates/de/admin.tmpl b/templates/de/admin.tmpl +index bbfa2b097..70fdc92b4 100644 +--- a/templates/de/admin.tmpl ++++ b/templates/de/admin.tmpl +@@ -38,23 +38,23 @@ + +

Erweitert
+ +- +-
++ ++
+         Maximale Anzahl an Clients\: +
+-         
+-         
+-
+- {have_gssapi?
:} +-
+-
++         
++         
++
++ {have_gssapi?
:} ++
++
+         Maximale Auftragsanzahl (0 für unbegrenzt)\: +
+         Metadaten aufbewahren\: +
+         Dokumente aufbewahren\: +
+-
++
+         Maximale Protokoll-Dateigröße\: +

+ +@@ -62,12 +62,12 @@ + +

Erweitert
+ +-
+-         
+-
+- {have_gssapi?
:} +-
+-

++
++         
++
++ {have_gssapi?
:} ++
++

+ + } +

+diff --git a/templates/de/modify-printer.tmpl b/templates/de/modify-printer.tmpl +index 8844bfa79..57c70715c 100644 +--- a/templates/de/modify-printer.tmpl ++++ b/templates/de/modify-printer.tmpl +@@ -26,7 +26,7 @@ + + + Freigabe: +- ++ + + + +diff --git a/templates/es/add-printer.tmpl b/templates/es/add-printer.tmpl +index 05bf42164..d67cda778 100644 +--- a/templates/es/add-printer.tmpl ++++ b/templates/es/add-printer.tmpl +@@ -32,7 +32,7 @@ + + + Compartición: +- ++ + + + +diff --git a/templates/es/admin.tmpl b/templates/es/admin.tmpl +index d75c8adfe..573ca51bd 100644 +--- a/templates/es/admin.tmpl ++++ b/templates/es/admin.tmpl +@@ -38,23 +38,23 @@ + +

Avanzada
+ +- +-
++ ++
+         Número máximo de clientes\: +
+-         
+-         
+-
+- {have_gssapi?
:} +-
+-
++         
++         
++
++ {have_gssapi?
:} ++
++
+         Número máximo de trabajos (0 sin límite)\: +
+         Retener metadatos\: +
+         Retener documentos\: +
+-
++
+         Tamaño máximo del archivo de registro\: +

+ +@@ -62,12 +62,12 @@ + +

Avanzada
+ +-
+-         
+-
+- {have_gssapi?
:} +-
+-

++
++         
++
++ {have_gssapi?
:} ++
++

+ + } +

+diff --git a/templates/es/modify-printer.tmpl b/templates/es/modify-printer.tmpl +index 1da5bb6fa..e29cf62d4 100644 +--- a/templates/es/modify-printer.tmpl ++++ b/templates/es/modify-printer.tmpl +@@ -26,7 +26,7 @@ + + + Compartida: +- ++ + + + +diff --git a/templates/fr/add-printer.tmpl b/templates/fr/add-printer.tmpl +index b3a35f5bd..d18206d6a 100644 +--- a/templates/fr/add-printer.tmpl ++++ b/templates/fr/add-printer.tmpl +@@ -32,7 +32,7 @@ + + + Partage : +- ++ + + + +diff --git a/templates/fr/admin.tmpl b/templates/fr/admin.tmpl +index a2dd61708..be68137cd 100644 +--- a/templates/fr/admin.tmpl ++++ b/templates/fr/admin.tmpl +@@ -38,23 +38,23 @@ + +

Avancé
+ +- +-
++ ++
+         Nombre maximum de clients \: +
+-         
+-         
+-
+- {have_gssapi?
:} +-
+-
++         
++         
++
++ {have_gssapi?
:} ++
++
+         Nombre maximum de tâches (0 pour aucune limite)\: +
+         Conserver les méta-données \: +
+         Conserver les documents \: +
+-
++
+         Taille maximum du journal système \: +

+ +@@ -62,12 +62,12 @@ + +

Avancé
+ +-
+-         
+-
+- {have_gssapi?
:} +-
+-

++
++         
++
++ {have_gssapi?
:} ++
++

+ + } +

+diff --git a/templates/fr/modify-printer.tmpl b/templates/fr/modify-printer.tmpl +index 56376912c..64cb58843 100644 +--- a/templates/fr/modify-printer.tmpl ++++ b/templates/fr/modify-printer.tmpl +@@ -26,7 +26,7 @@ + + + Partage : +- ++ + + + +diff --git a/templates/ja/add-printer.tmpl b/templates/ja/add-printer.tmpl +index 450624a39..f162a29f5 100644 +--- a/templates/ja/add-printer.tmpl ++++ b/templates/ja/add-printer.tmpl +@@ -32,7 +32,7 @@ + + + 共有: +- ++ + + + +diff --git a/templates/ja/admin.tmpl b/templates/ja/admin.tmpl +index 15faa9156..a7055bff0 100644 +--- a/templates/ja/admin.tmpl ++++ b/templates/ja/admin.tmpl +@@ -38,23 +38,23 @@ + +

詳細
+ +- +-
++ ++
+         最大クライアント数\: +
+-         
+-         
+-
+- {have_gssapi?
:} +-
+-
++         
++         
++
++ {have_gssapi?
:} ++
++
+         最大ジョブ数 (0 は無制限)\: +
+         メタデータを保持\: +
+         ドキュメントを保持\: +
+-
++
+         最大ログファイルサイズ\: +

+ +@@ -62,12 +62,12 @@ + +

詳細
+ +-
+-         
+-
+- {have_gssapi?
:} +-
+-

++
++         
++
++ {have_gssapi?
:} ++
++

+ + } +

+diff --git a/templates/ja/modify-printer.tmpl b/templates/ja/modify-printer.tmpl +index a3ac71644..0276c90a0 100644 +--- a/templates/ja/modify-printer.tmpl ++++ b/templates/ja/modify-printer.tmpl +@@ -26,7 +26,7 @@ + + + 共有: +- ++ + + + +diff --git a/templates/modify-printer.tmpl b/templates/modify-printer.tmpl +index 1aed9f39c..ef4d094b9 100644 +--- a/templates/modify-printer.tmpl ++++ b/templates/modify-printer.tmpl +@@ -26,7 +26,7 @@ + + + Sharing: +- ++ + + + +diff --git a/templates/pt_BR/add-printer.tmpl b/templates/pt_BR/add-printer.tmpl +index ce82480f6..48ad27841 100644 +--- a/templates/pt_BR/add-printer.tmpl ++++ b/templates/pt_BR/add-printer.tmpl +@@ -32,7 +32,7 @@ + + + Compartilhamento: +- ++ + + + +diff --git a/templates/pt_BR/admin.tmpl b/templates/pt_BR/admin.tmpl +index 7dedf031c..d6cf283fe 100644 +--- a/templates/pt_BR/admin.tmpl ++++ b/templates/pt_BR/admin.tmpl +@@ -38,23 +38,23 @@ + +

Avançado
+ +- +-
++ ++
+         Máximo de clientes\: +
+-         
+-         
+-
+- {have_gssapi?
:} +-
+-
++         
++         
++
++ {have_gssapi?
:} ++
++
+         Máximo de trabalhos (0 para sem limite)\: +
+         Reter metadados\: +
+         Reter documentos\: +
+-
++
+         Tamanho máximo do arquivo de log\: +

+ +@@ -62,12 +62,12 @@ + +

Avançado
+ +-
+-         
+-
+- {have_gssapi?
:} +-
+-

++
++         
++
++ {have_gssapi?
:} ++
++

+ + } +

+diff --git a/templates/pt_BR/modify-printer.tmpl b/templates/pt_BR/modify-printer.tmpl +index f8d28c55e..41a23287a 100644 +--- a/templates/pt_BR/modify-printer.tmpl ++++ b/templates/pt_BR/modify-printer.tmpl +@@ -26,7 +26,7 @@ + + + Compartilhamento: +- ++ + + + +diff --git a/templates/ru/add-printer.tmpl b/templates/ru/add-printer.tmpl +index 9a6d043e1..9b94964d7 100644 +--- a/templates/ru/add-printer.tmpl ++++ b/templates/ru/add-printer.tmpl +@@ -32,7 +32,7 @@ + + + Совместный доступ: +- ++ + + + +diff --git a/templates/ru/admin.tmpl b/templates/ru/admin.tmpl +index 0e7fa4dd8..07d136994 100644 +--- a/templates/ru/admin.tmpl ++++ b/templates/ru/admin.tmpl +@@ -37,23 +37,23 @@ + +

Дополнительные параметры
+ +- +-
++ ++
+         Максимум клиентов\: +
+-         
+-         
+-
+- {have_gssapi?
:} +-
+-
++         
++         
++
++ {have_gssapi?
:} ++
++
+         Количество заданий (0 без ограничений)\: +
+         Записывать метаданные(Retain Metadata)\: +
+         Существующие документы(Retain Documents)\: +
+-
++
+         Максимальный размер журнала\: +

+ +@@ -61,13 +61,13 @@ + +

Дополнительные параметры
+ +-
+-         

++
++ {have_gssapi?
:} ++
++

+ + } +

+diff --git a/templates/ru/modify-printer.tmpl b/templates/ru/modify-printer.tmpl +index 811c2d8cc..e381ca027 100644 +--- a/templates/ru/modify-printer.tmpl ++++ b/templates/ru/modify-printer.tmpl +@@ -26,7 +26,7 @@ + + + Совместный доступ: +- ++ + + + +-- +2.45.2 + diff --git a/0001-dest.c-Don-t-look-for-user-config-in-cupsGetNamedDes.patch b/0001-dest.c-Don-t-look-for-user-config-in-cupsGetNamedDes.patch new file mode 100644 index 0000000000000000000000000000000000000000..3efed92e3b8e05b45445be20945ef668da592c42 --- /dev/null +++ b/0001-dest.c-Don-t-look-for-user-config-in-cupsGetNamedDes.patch @@ -0,0 +1,57 @@ +From 8dce8d76c1f9ae1769284e3a3b9405f906956a10 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Wed, 9 Oct 2024 10:31:18 +0200 +Subject: [PATCH] dest.c: Don't look for user config in cupsGetNamedDest as + root + +We were still looking into ~/.cups/lpoptions as root in the function, +which IMHO is not expected. + +Merged from master +--- + cups/dest.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/cups/dest.c b/cups/dest.c +index b48d8f219..3eeb50933 100644 +--- a/cups/dest.c ++++ b/cups/dest.c +@@ -1784,7 +1784,11 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT + else + instance = NULL; + } ++#if _WIN32 + else if (cg->home) ++#else ++ else if (cg->home && getuid() != 0) ++#endif + { + /* + * No default in the environment, try the user's lpoptions files... +@@ -1899,7 +1903,11 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT + snprintf(filename, sizeof(filename), "%s/lpoptions", cg->cups_serverroot); + cups_get_dests(filename, dest_name, instance, 0, 1, 1, &dest); + ++#if _WIN32 + if (cg->home) ++#else ++ if (cg->home && getuid() != 0) ++#endif // _WIN32 + { + #if _WIN32 + snprintf(filename, sizeof(filename), "%s/AppData/Local/cups/lpoptions", cg->home); +@@ -3493,7 +3501,11 @@ cups_enum_dests( + snprintf(filename, sizeof(filename), "%s/lpoptions", cg->cups_serverroot); + data.num_dests = cups_get_dests(filename, NULL, NULL, 1, user_default != NULL, data.num_dests, &data.dests); + ++#if _WIN32 + if (cg->home) ++#else ++ if (cg->home && getuid() != 0) ++#endif // _WIN32 + { + #if _WIN32 + snprintf(filename, sizeof(filename), "%s/AppData/Local/cups/lpoptions", cg->home); +-- +2.47.0 + diff --git a/0001-fix-warnings-for-unused-vars.patch b/0001-fix-warnings-for-unused-vars.patch new file mode 100644 index 0000000000000000000000000000000000000000..85b5aef74d9a5995dd1859e82a8dcd13cd97c3ac --- /dev/null +++ b/0001-fix-warnings-for-unused-vars.patch @@ -0,0 +1,37 @@ +From 2abe1ba8a66864aa82cd9836b37e57103b8e1a3b Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +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(-) + +diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c +index 85ede0f18..a6163a0e1 100644 +--- a/cups/ppd-cache.c ++++ b/cups/ppd-cache.c +@@ -3222,8 +3222,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 */ +@@ -5009,9 +5008,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 */ +-- +2.46.1 + diff --git a/0001-mirror-ipp-everywhere-printer-changes-from-master.patch b/0001-mirror-ipp-everywhere-printer-changes-from-master.patch new file mode 100644 index 0000000000000000000000000000000000000000..dc8c1fcd3c242c840aff755b8a13db9a29882d00 --- /dev/null +++ b/0001-mirror-ipp-everywhere-printer-changes-from-master.patch @@ -0,0 +1,79 @@ +From 9939a70b750edd9d05270060cc5cf62ca98cfbe5 Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +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(-) + +diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c +index 9cdb90a4f..8a99a865c 100644 +--- a/cups/ppd-cache.c ++++ b/cups/ppd-cache.c +@@ -3316,10 +3316,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) +@@ -3388,10 +3388,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 + +@@ -3409,7 +3409,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 + +diff --git a/scheduler/ipp.c b/scheduler/ipp.c +index d334f70cf..2d80a960e 100644 +--- 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. + * +@@ -5417,6 +5417,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); + +-- +2.46.1 + diff --git a/0001-ppdize-preset-and-template-names.patch b/0001-ppdize-preset-and-template-names.patch new file mode 100644 index 0000000000000000000000000000000000000000..ec88f368805bdd667327ee587ba9fc62cb151ca9 --- /dev/null +++ b/0001-ppdize-preset-and-template-names.patch @@ -0,0 +1,116 @@ +From e0630cd18f76340d302000f2bf6516e99602b844 Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +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(-) + +diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c +index 986c64f73..18c38d0ee 100644 +--- a/cups/ppd-cache.c ++++ b/cups/ppd-cache.c +@@ -4975,12 +4975,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) +@@ -4993,7 +4995,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"); + } + +@@ -5039,7 +5041,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); +@@ -5080,7 +5083,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")) +@@ -5107,13 +5113,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")) +@@ -5159,7 +5165,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); ++ } + } + } + +@@ -5543,7 +5552,7 @@ pwg_ppdize_name(const char *ipp, /* I - IPP keyword */ + *end; /* End of name buffer */ + + +- if (!ipp) ++ if (!ipp || !_cups_isalnum(*ipp)) + { + *name = '\0'; + return; +@@ -5558,8 +5567,14 @@ pwg_ppdize_name(const char *ipp, /* I - IPP keyword */ + ipp ++; + *ptr++ = (char)toupper(*ipp++ & 255); + } +- else ++ else if (*ipp == '_' || *ipp == '.' || *ipp == '-' || _cups_isalnum(*ipp)) ++ { + *ptr++ = *ipp++; ++ } ++ else ++ { ++ ipp ++; ++ } + } + + *ptr = '\0'; +-- +2.46.1 + diff --git a/0001-quote-ppd-localized-strings.patch b/0001-quote-ppd-localized-strings.patch new file mode 100644 index 0000000000000000000000000000000000000000..cca336daf06878b67f7d5fda1059ec833161255c --- /dev/null +++ b/0001-quote-ppd-localized-strings.patch @@ -0,0 +1,246 @@ +From 1e6ca5913eceee906038bc04cc7ccfbe2923bdfd Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +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(-) + +diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c +index 18c38d0ee..85ede0f18 100644 +--- 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); +@@ -3393,7 +3394,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 */ +@@ -3437,7 +3438,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); +@@ -4043,18 +4044,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: \"<>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"); + } +@@ -4080,12 +4079,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: \"<>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"); + } +@@ -4546,12 +4542,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) + { +@@ -4670,9 +4663,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]; +@@ -4687,7 +4677,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); + } + +@@ -4750,9 +4740,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]; +@@ -4767,7 +4754,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); + } + +@@ -4838,9 +4825,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]; +@@ -4855,7 +4839,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); + } + +@@ -4926,9 +4910,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"; +@@ -4936,7 +4917,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); + } + +@@ -4978,9 +4959,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)) +@@ -4995,7 +4973,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"); + } + +@@ -5164,11 +5142,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); + } + } + +@@ -5439,6 +5415,43 @@ cups_get_url(http_t **http, /* IO - Current HTTP connection */ + } + + ++/* ++ * '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. + */ +-- +2.46.1 + diff --git a/0001-refactor-make-and-model-code.patch b/0001-refactor-make-and-model-code.patch new file mode 100644 index 0000000000000000000000000000000000000000..36b45a6a3cf6ad677a24eb6f3e8508a5757444a3 --- /dev/null +++ b/0001-refactor-make-and-model-code.patch @@ -0,0 +1,148 @@ +From 04bb2af4521b56c1699a2c2431c56c05a7102e69 Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +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(-) + +diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c +index 8a99a865c..986c64f73 100644 +--- a/cups/ppd-cache.c ++++ b/cups/ppd-cache.c +@@ -3196,9 +3196,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 */ +@@ -3259,34 +3260,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); +-- +2.46.1 + diff --git a/0001-scheduler-Clean-up-failed-IPP-Everywhere-permanent-q.patch b/0001-scheduler-Clean-up-failed-IPP-Everywhere-permanent-q.patch new file mode 100644 index 0000000000000000000000000000000000000000..8bf2f064969bf68549b2a58efc567f269aec33de --- /dev/null +++ b/0001-scheduler-Clean-up-failed-IPP-Everywhere-permanent-q.patch @@ -0,0 +1,81 @@ +From 2e3f15832140454e2d21b327bfa4b05612b50b9a Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Mon, 2 Dec 2024 14:20:26 +0100 +Subject: [PATCH] scheduler: Clean up failed IPP Everywhere permanent queues + +If creating of permanent queue with IPP Everywhere model fails +in separate thread, the print queue is created as raw. +It would be great if we remove such queue if creation fails, +and marking them as temporary would make them to be removed automatically. +--- + scheduler/ipp.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/scheduler/ipp.c b/scheduler/ipp.c +index 2d80a960e..089267c86 100644 +--- a/scheduler/ipp.c ++++ b/scheduler/ipp.c +@@ -5294,6 +5294,7 @@ create_local_bg_thread( + /* Force printer to timeout and be deleted */ + _cupsRWLockWrite(&printer->lock); + printer->state_time = 0; ++ printer->temporary = 1; + _cupsRWUnlock(&printer->lock); + + send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Couldn't resolve mDNS URI \"%s\"."), printer->device_uri); +@@ -5314,6 +5315,7 @@ create_local_bg_thread( + /* Force printer to timeout and be deleted */ + _cupsRWLockWrite(&printer->lock); + printer->state_time = 0; ++ printer->temporary = 1; + _cupsRWUnlock(&printer->lock); + + send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Bad device URI \"%s\"."), device_uri); +@@ -5332,6 +5334,7 @@ create_local_bg_thread( + /* Force printer to timeout and be deleted */ + _cupsRWLockWrite(&printer->lock); + printer->state_time = 0; ++ printer->temporary = 1; + _cupsRWUnlock(&printer->lock); + + send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Unable to connect to %s:%d: %s"), host, port, cupsLastErrorString()); +@@ -5420,6 +5423,12 @@ create_local_bg_thread( + // Validate response from printer... + if (!ippValidateAttributes(response)) + { ++ /* Force printer to timeout and be deleted */ ++ _cupsRWLockWrite(&printer->lock); ++ printer->state_time = 0; ++ printer->temporary = 1; ++ _cupsRWUnlock(&printer->lock); ++ + send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Printer returned invalid data: %s"), cupsLastErrorString()); + goto finish_response; + } +@@ -5453,6 +5462,7 @@ create_local_bg_thread( + /* Force printer to timeout and be deleted */ + _cupsRWLockWrite(&printer->lock); + printer->state_time = 0; ++ printer->temporary = 1; + _cupsRWUnlock(&printer->lock); + + send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Unable to read generated PPD: %s"), strerror(errno)); +@@ -5468,6 +5478,7 @@ create_local_bg_thread( + /* Force printer to timeout and be deleted */ + _cupsRWLockWrite(&printer->lock); + printer->state_time = 0; ++ printer->temporary = 1; + _cupsRWUnlock(&printer->lock); + + send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Unable to create PPD for printer: %s"), strerror(errno)); +@@ -5501,6 +5512,7 @@ create_local_bg_thread( + /* Force printer to timeout and be deleted */ + _cupsRWLockWrite(&printer->lock); + printer->state_time = 0; ++ printer->temporary = 1; + _cupsRWUnlock(&printer->lock); + + send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Unable to create PPD: %s"), cupsLastErrorString()); +-- +2.47.1 + diff --git a/0001-tls-gnutls.c-Use-system-crypto-policy-if-available.patch b/0001-tls-gnutls.c-Use-system-crypto-policy-if-available.patch new file mode 100644 index 0000000000000000000000000000000000000000..2cfdb23baece52f5e49ec606005452ed2ccdc977 --- /dev/null +++ b/0001-tls-gnutls.c-Use-system-crypto-policy-if-available.patch @@ -0,0 +1,31 @@ +From 331a202a87db30b5d1d5386ccc99de6843eef03e Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Fri, 6 Dec 2024 07:59:16 +0100 +Subject: [PATCH] tls-gnutls.c: Use system crypto policy if available + +Some Linux systems provide a way how to control cryptography on system or service level via cryptographic policies. OpenSSL implementation reflects system changes to some degree, however GnuTLS implementation does not take system policy into account. + +GnuTLS supports fallback mechanism, so we can fallback to NORMAL if @System is not defined on the system. + +Fortunately, the current GnuTLS implementation allows overrides via priority strings (so no "this cipher/hash is disabled" if we enabled them in our application by priority string), so allowing to honor system policy can save us work if someone wants to disable a specific cipher, so we don't have to implement it in libcups. +--- + CHANGES.md | 2 ++ + cups/tls-gnutls.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/cups/tls-gnutls.c b/cups/tls-gnutls.c +index f3f71a055..719161da7 100644 +--- a/cups/tls-gnutls.c ++++ b/cups/tls-gnutls.c +@@ -1504,7 +1504,7 @@ _httpTLSStart(http_t *http) /* I - Connection to server */ + return (-1); + } + +- strlcpy(priority_string, "NORMAL", sizeof(priority_string)); ++ strlcpy(priority_string, "@SYSTEM,NORMAL", sizeof(priority_string)); + + if (tls_max_version < _HTTP_TLS_MAX) + { +-- +2.47.1 + diff --git a/cups-fix-device-uri-in-webui.patch b/cups-fix-device-uri-in-webui.patch new file mode 100644 index 0000000000000000000000000000000000000000..d702f88cdd61651e642bb4817016ebbc7eee749d --- /dev/null +++ b/cups-fix-device-uri-in-webui.patch @@ -0,0 +1,44 @@ +diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c +index e0f1136..02ff51d 100644 +--- a/cgi-bin/admin.c ++++ b/cgi-bin/admin.c +@@ -636,7 +636,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + }; + + +- ptr = cgiGetTextfield("DEVICE_URI"); ++ ptr = cgiGetVariable("DEVICE_URI"); + fprintf(stderr, "DEBUG: do_am_printer: DEVICE_URI=\"%s\"\n", + ptr ? ptr : "(null)"); + +@@ -697,7 +697,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + } + } + +- if ((var = cgiGetTextfield("DEVICE_URI")) != NULL) ++ if ((var = cgiGetVariable("DEVICE_URI")) != NULL) + { + if ((uriptr = strrchr(var, '|')) != NULL) + { +@@ -1130,7 +1130,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-info", + NULL, cgiGetTextfield("PRINTER_INFO")); + +- strlcpy(uri, cgiGetTextfield("DEVICE_URI"), sizeof(uri)); ++ strlcpy(uri, cgiGetVariable("DEVICE_URI"), sizeof(uri)); + + /* + * Strip make and model from URI... +diff --git a/cgi-bin/var.c b/cgi-bin/var.c +index 6ad945d..a4993ff 100644 +--- a/cgi-bin/var.c ++++ b/cgi-bin/var.c +@@ -288,7 +288,7 @@ cgiGetTextfield(const char *name) /* I - Name of form field */ + value = NULL; + } + +- return (value); ++ return (value ? strdup(value) : NULL); + } + + diff --git a/cups.spec b/cups.spec index ee388423ff111fa4ac8842db5013685f5d1d026f..5f80b21e17a1367fc4de6b1155196acab98fe233 100644 --- a/cups.spec +++ b/cups.spec @@ -1,4 +1,5 @@ -%define anolis_release 1 +ExclusiveArch: x86_64 aarch64 +%define anolis_release 2 %global use_alternatives 1 %global lspp 1 @@ -68,6 +69,34 @@ Patch100: cups-lspp.patch %endif #### UPSTREAM PATCHES (starts with 1000) #### +# Fix CGI checkbox support (Issue #1008) +Patch1000: 0001-cgi-Fix-checkbox-support-fixes-1008.patch +# Fix device URI parsing in web UI +Patch1001: cups-fix-device-uri-in-webui.patch +# Fix IPP everywhere printer setup (Issue #1033) +Patch1002: 0001-Fix-IPP-everywhere-printer-setup-Issue-1033.patch +# Don't look for user config in cupsGetNamedDevices +Patch1003: 0001-dest.c-Don-t-look-for-user-config-in-cupsGetNamedDes.patch +# Fix Coverity discovered issues +Patch1004: 0001-Fix-Coverity-discovered-issues.patch +# Mirror IPP everywhere printer changes from master +Patch1005: 0001-mirror-ipp-everywhere-printer-changes-from-master.patch +# Refactor make and model code to prevent PPD corruption +Patch1006: 0001-refactor-make-and-model-code.patch +# Ppdize preset and template names +Patch1007: 0001-ppdize-preset-and-template-names.patch +# Quote PPD localized strings properly +Patch1008: 0001-quote-ppd-localized-strings.patch +# Fix warnings for unused variables +Patch1009: 0001-fix-warnings-for-unused-vars.patch +# Fix make and model whitespace trimming (Issue #1096) +Patch1010: 0001-Fix-make-and-model-whitespace-trimming-Issue-1096.patch +# Clean up failed IPP Everywhere permanent queues +Patch1011: 0001-scheduler-Clean-up-failed-IPP-Everywhere-permanent-q.patch +# Use system crypto policy if available (RHEL-68415) +Patch1012: 0001-tls-gnutls.c-Use-system-crypto-policy-if-available.patch +# Add NoSystem-SSLOptions value (RHEL-68415) +Patch1013: 0001-Add-NoSystem-SSLOptions-value.patch ##### Patches removed because IMHO they aren't no longer needed @@ -299,6 +328,20 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in %patch -P 12 -p1 -b .dymo-deviceid # UPSTREAM PATCHES +%patch -P 1000 -p1 -b .cgi-checkbox-fix +%patch -P 1001 -p1 -b .fix-device-uri-webui +%patch -P 1002 -p1 -b .ipp-everywhere-setup +%patch -P 1003 -p1 -b .dest-no-user-config +%patch -P 1004 -p1 -b .coverity-fixes +%patch -P 1005 -p1 -b .mirror-ipp-everywhere +%patch -P 1006 -p1 -b .refactor-make-model +%patch -P 1007 -p1 -b .ppdize-names +%patch -P 1008 -p1 -b .quote-ppd-localized +%patch -P 1009 -p1 -b .fix-unused-vars +%patch -P 1010 -p1 -b .fix-make-model-trim +%patch -P 1011 -p1 -b .scheduler-cleanup-ipp-everywhere +%patch -P 1012 -p1 -b .tls-gnutls-system-crypto +%patch -P 1013 -p1 -b .add-nosystem-ssloptions %if %{lspp} @@ -786,6 +829,22 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man7/ippeveps.7.* %changelog +* Sun Mar 22 2026 wenjie2025 - 1:2.4.10-2 +- Fix CGI checkbox support (Issue #1008) +- Fix device URI parsing in web UI +- Fix IPP Everywhere printer setup (Issue #1033) +- Prevent root from loading untrusted user lpoptions files +- Fix potential crashes from unsafe cupsArrayDelete calls +- Validate IPP attributes and responses from printers +- Refactor make and model code to prevent PPD corruption +- Convert IPP names to valid PPD keywords +- Properly escape PPD localized strings +- Remove unused variables to silence compiler warnings +- Fix make and model whitespace trimming (Issue #1096) +- Clean up failed IPP Everywhere permanent queues +- Use system crypto policy if available +- Add NoSystem-SSLOptions value + * Thu Jul 04 2024 mgb01105731 - 1:2.4.10-1 - update to 2.4.10