RHEL-69638 IPP Everywhere permanent queue is not removed if PPD generation fails

Resolves: RHEL-69638
This commit is contained in:
Zdenek Dohnal 2024-12-02 16:39:18 +01:00
parent d164c1b7f0
commit 14a4ae58dc
2 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,81 @@
From 2e3f15832140454e2d21b327bfa4b05612b50b9a Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
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

View File

@ -22,7 +22,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 2.4.10
Release: 8%{?dist}
Release: 9%{?dist}
# backend/failover.c - BSD-3-Clause
# cups/md5* - Zlib
# scheduler/colorman.c - Apache-2.0 WITH LLVM-exception AND BSD-2-Clause
@ -98,6 +98,8 @@ Patch1007: 0001-ppdize-preset-and-template-names.patch
Patch1008: 0001-quote-ppd-localized-strings.patch
Patch1009: 0001-fix-warnings-for-unused-vars.patch
Patch1010: 0001-Fix-make-and-model-whitespace-trimming-Issue-1096.patch
# RHEL-69638 IPP Everywhere permanent queue is not removed if PPD generation fails
Patch1011: 0001-scheduler-Clean-up-failed-IPP-Everywhere-permanent-q.patch
##### Patches removed because IMHO they aren't no longer needed
@ -349,6 +351,8 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in
%patch -P 1008 -p1 -b .quote-ppd-strings
%patch -P 1009 -p1 -b .unused-vars
%patch -P 1010 -p1 -b .trim-make-model
# RHEL-69638 IPP Everywhere permanent queue is not removed if PPD generation fails
%patch -P 1011 -p1 -b .clean-failed-eve
# Log to the system journal by default (bug #1078781, bug #1519331).
@ -818,6 +822,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man7/ippeveps.7.gz
%changelog
* Mon Dec 02 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.4.10-9
- RHEL-69638 IPP Everywhere permanent queue is not removed if PPD generation fails
* Mon Nov 25 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.4.10-8
- RHEL-45525 cups-2.4.10-2.el10: RHEL SAST Automation: address 1 High impact true positive(s)
- RHEL-60354 CVE-2024-47175 cups: remote command injection via attacker controlled data in PPD file