1750904 - cups is unable to add ppd with custom/Custom option

This commit is contained in:
Zdenek Dohnal 2019-10-16 15:52:01 +02:00
parent 47ff5d0a0d
commit 775c3bb584
3 changed files with 56 additions and 7 deletions

View File

@ -0,0 +1,49 @@
From 2a06655e5c1925f09d5a2e38cd073eb1b6f069ad Mon Sep 17 00:00:00 2001
From: Michael R Sweet <michael.r.sweet@gmail.com>
Date: Tue, 15 Oct 2019 17:05:55 -0400
Subject: [PATCH] PPD files containing custom option keywords did not work
(Issue #5639)
diff --git a/cups/ppd.c b/cups/ppd.c
index fae19c42e..ff52df2e1 100644
--- a/cups/ppd.c
+++ b/cups/ppd.c
@@ -1874,9 +1874,9 @@ _ppdOpen(
{
if (!_cups_strcasecmp(name, "custom") || !_cups_strncasecmp(name, "custom.", 7))
{
- pg->ppd_status = PPD_ILLEGAL_OPTION_KEYWORD;
-
- goto error;
+ char cname[PPD_MAX_NAME]; /* Rewrite with a leading underscore */
+ snprintf(cname, sizeof(cname), "_%s", name);
+ strlcpy(name, cname, sizeof(name));
}
if ((size = ppdPageSize(ppd, name)) == NULL)
@@ -1903,9 +1903,9 @@ _ppdOpen(
{
if (!_cups_strcasecmp(name, "custom") || !_cups_strncasecmp(name, "custom.", 7))
{
- pg->ppd_status = PPD_ILLEGAL_OPTION_KEYWORD;
-
- goto error;
+ char cname[PPD_MAX_NAME]; /* Rewrite with a leading underscore */
+ snprintf(cname, sizeof(cname), "_%s", name);
+ strlcpy(name, cname, sizeof(name));
}
if ((size = ppdPageSize(ppd, name)) == NULL)
@@ -1939,9 +1939,9 @@ _ppdOpen(
if (!_cups_strcasecmp(name, "custom") || !_cups_strncasecmp(name, "custom.", 7))
{
- pg->ppd_status = PPD_ILLEGAL_OPTION_KEYWORD;
-
- goto error;
+ char cname[PPD_MAX_NAME]; /* Rewrite with a leading underscore */
+ snprintf(cname, sizeof(cname), "_%s", name);
+ strlcpy(name, cname, sizeof(name));
}
if (!strcmp(keyword, "PageSize"))

View File

@ -3,10 +3,6 @@ From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Mon, 29 Jul 2019 10:33:06 +0200
Subject: [PATCH] SIGSEGV in CUPS web ui when adding a printer
---
cgi-bin/var.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/cgi-bin/var.c b/cgi-bin/var.c
index 306375bd6..fb9d051c0 100644
--- a/cgi-bin/var.c
@ -21,6 +17,3 @@ index 306375bd6..fb9d051c0 100644
return (strdup(var->values[element]));
}
--
2.21.0

View File

@ -100,6 +100,10 @@ Patch29: cups-dymo-deviceid.patch
Patch40: 0001-Add-workaround-for-systemd-s-lack-of-true-launch-on-.patch
# SIGSEGV in web ui
Patch41: 0001-SIGSEGV-in-CUPS-web-ui-when-adding-a-printer.patch
# some ppds use custom keyword, which is incorrect - the correct is 'Custom Size' and ppd
# parser ended with error when encountered it. Now the parser adds underscore to incorrect
# keyword and continues
Patch42: 0001-PPD-files-containing-custom-option-keywords-did-not-.patch
##### Patches removed because IMHO they aren't no longer needed
##### but still I'll leave them in git in case their removal
@ -347,6 +351,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
%patch40 -p1 -b .cupsctl-not-working
# 1720688 - [abrt] cups: __strlen_avx2(): printers.cgi killed by SIGSEGV
%patch41 -p1 -b .webui-sigsegv
# 1750904 - cups is unable to add ppd with custom/Custom option
%patch42 -p1 -b .ppd-custom-option
# if cupsd is set to log into /var/log/cups, then 'MaxLogSize 0' needs to be
# in cupsd.conf to disable cupsd logrotate functionality and use logrotated
@ -755,6 +761,7 @@ rm -f %{cups_serverbin}/backend/smb
%changelog
* Wed Oct 16 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.2.12-3
- 1720688 - [abrt] cups: __strlen_avx2(): printers.cgi killed by SIGSEGV
- 1750904 - cups is unable to add ppd with custom/Custom option
* Fri Sep 13 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.2.12-2
- fix cupsctl usage