From 243e4a7518c9ea3441c564aa656f7f161cb2a2bd Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 23 Jul 2024 15:44:33 +0200 Subject: [PATCH] RHEL-49449 Fix checkbox support in web ui Resolves: RHEL-49449 --- ...-cgi-Fix-checkbox-support-fixes-1008.patch | 759 ++++++++++++++++++ cups.spec | 9 +- 2 files changed, 767 insertions(+), 1 deletion(-) create mode 100644 0001-cgi-Fix-checkbox-support-fixes-1008.patch 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 0000000..4614c75 --- /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/cups.spec b/cups.spec index 0788287..9831780 100644 --- a/cups.spec +++ b/cups.spec @@ -22,7 +22,7 @@ Summary: CUPS printing system Name: cups Epoch: 1 Version: 2.4.10 -Release: 2%{?dist} +Release: 3%{?dist} # backend/failover.c - BSD-3-Clause # cups/md5* - Zlib # scheduler/colorman.c - Apache-2.0 WITH LLVM-exception AND BSD-2-Clause @@ -81,6 +81,8 @@ Patch100: cups-lspp.patch %endif #### UPSTREAM PATCHES (starts with 1000) #### +# RHEL-49449 Fix checkbox support in web ui +Patch1000: 0001-cgi-Fix-checkbox-support-fixes-1008.patch ##### Patches removed because IMHO they aren't no longer needed @@ -309,6 +311,8 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in %patch -P 12 -p1 -b .dymo-deviceid # UPSTREAM PATCHES +# RHEL-49449 Fix checkbox support in web ui +%patch -P 1000 -p1 -b .cgi-checkbox %if %{lspp} @@ -783,6 +787,9 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man7/ippeveps.7.gz %changelog +* Tue Jul 23 2024 Zdenek Dohnal - 1:2.4.10-3 +- RHEL-49449 Fix checkbox support in web ui + * Mon Jun 24 2024 Troy Dawson - 1:2.4.10-2 - Bump release for June 2024 mass rebuild