From a17bb816f83ece8c844476b372d08e313f08b858 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 10 2022 07:15:42 +0000 Subject: import cups-2.2.6-44.el8 --- diff --git a/SOURCES/0001-Add-with-idle-exit-timeout-configure-option.patch b/SOURCES/0001-Add-with-idle-exit-timeout-configure-option.patch new file mode 100644 index 0000000..5a638e1 --- /dev/null +++ b/SOURCES/0001-Add-with-idle-exit-timeout-configure-option.patch @@ -0,0 +1,33 @@ +diff -up cups-2.2.6/conf/cupsd.conf.in.idleexittimeout cups-2.2.6/conf/cupsd.conf.in +--- cups-2.2.6/conf/cupsd.conf.in.idleexittimeout 2017-11-01 15:57:53.000000000 +0100 ++++ cups-2.2.6/conf/cupsd.conf.in 2021-11-29 11:45:37.416058954 +0100 +@@ -22,6 +22,9 @@ DefaultAuthType Basic + # Web interface setting... + WebInterface @CUPS_WEBIF@ + ++# Timeout after cupsd exits if idle (applied only if cupsd runs on-demand - with -l) ++IdleExitTimeout @EXIT_TIMEOUT@ ++ + # Restrict access to the server... + + Order allow,deny +diff -up cups-2.2.6/config-scripts/cups-defaults.m4.idleexittimeout cups-2.2.6/config-scripts/cups-defaults.m4 +--- cups-2.2.6/config-scripts/cups-defaults.m4.idleexittimeout 2021-11-29 11:45:37.416058954 +0100 ++++ cups-2.2.6/config-scripts/cups-defaults.m4 2021-11-29 11:46:31.680612421 +0100 +@@ -425,3 +425,16 @@ esac + + AC_SUBST(CUPS_WEBIF) + AC_DEFINE_UNQUOTED(CUPS_DEFAULT_WEBIF, $CUPS_DEFAULT_WEBIF) ++ ++dnl Set default value of IdleExitTimeout ++AC_ARG_WITH([idle_exit_timeout], AS_HELP_STRING([--with-idle-exit-timeout], [set the default value for IdleExitTimeout, default=60]), [ ++ AS_IF([test "x$withval" = "xno"], [ ++ EXIT_TIMEOUT=0 ++ ], [ ++ EXIT_TIMEOUT=$withval ++ ]) ++], [ ++ EXIT_TIMEOUT=60 ++]) ++ ++AC_SUBST([EXIT_TIMEOUT]) diff --git a/SOURCES/0001-Add-with-systemd-timeoutstartsec-configure-option.patch b/SOURCES/0001-Add-with-systemd-timeoutstartsec-configure-option.patch new file mode 100644 index 0000000..af83a6c --- /dev/null +++ b/SOURCES/0001-Add-with-systemd-timeoutstartsec-configure-option.patch @@ -0,0 +1,33 @@ +diff -up cups-2.3.3op2/config-scripts/cups-defaults.m4.conf-timeoutstartsec cups-2.3.3op2/config-scripts/cups-defaults.m4 +--- cups-2.3.3op2/config-scripts/cups-defaults.m4.conf-timeoutstartsec 2021-11-29 13:50:14.568976028 +0100 ++++ cups-2.3.3op2/config-scripts/cups-defaults.m4 2021-11-29 13:51:02.785567762 +0100 +@@ -482,3 +482,18 @@ AC_ARG_WITH([idle_exit_timeout], AS_HELP + ]) + + AC_SUBST([EXIT_TIMEOUT]) ++ ++dnl set TimeoutStartSec for cups.service ++dnl - if used as --without-*, it sets TimeoutStartSec to infinity ++AC_ARG_WITH([systemd-timeoutstartsec], ++ AS_HELP_STRING([--with-systemd-timeoutstartsec], ++ [set TimeoutStartSec value in cups.service, default=default value in systemd]), [ ++ AS_IF([ test "x$withval" = "xno" ], [ ++ TIMEOUTSTARTSEC="TimeoutStartSec=infinity" ++ ], [ ++ TIMEOUTSTARTSEC="TimeoutStartSec=$withval" ++ ]) ++], [ ++ TIMEOUTSTARTSEC="" ++]) ++AC_SUBST([TIMEOUTSTARTSEC]) +diff -up cups-2.3.3op2/scheduler/org.cups.cupsd.service.in.conf-timeoutstartsec cups-2.3.3op2/scheduler/org.cups.cupsd.service.in +--- cups-2.3.3op2/scheduler/org.cups.cupsd.service.in.conf-timeoutstartsec 2021-11-29 13:50:14.551976172 +0100 ++++ cups-2.3.3op2/scheduler/org.cups.cupsd.service.in 2021-11-29 13:50:14.568976028 +0100 +@@ -8,6 +8,7 @@ Requires=cups.socket + ExecStart=@sbindir@/cupsd -l + Type=notify + Restart=on-failure ++@TIMEOUTSTARTSEC@ + + [Install] + Also=cups.socket cups.path diff --git a/SOURCES/0001-Fix-handling-of-MaxJobTime-0-Issue-5438.patch b/SOURCES/0001-Fix-handling-of-MaxJobTime-0-Issue-5438.patch new file mode 100644 index 0000000..e7f586c --- /dev/null +++ b/SOURCES/0001-Fix-handling-of-MaxJobTime-0-Issue-5438.patch @@ -0,0 +1,43 @@ +From 3e4dd41459dabc5d18edbe06eb5b81291885204b Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +Date: Wed, 5 Dec 2018 12:18:19 -0500 +Subject: [PATCH] Fix handling of MaxJobTime 0 (Issue #5438) + +--- + CHANGES.md | 5 +++-- + scheduler/job.c | 4 +++- + scheduler/printers.c | 2 +- + 3 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/scheduler/job.c b/scheduler/job.c +index 3cbe56aa8..638f256db 100644 +--- a/scheduler/job.c ++++ b/scheduler/job.c +@@ -5148,8 +5148,10 @@ update_job(cupsd_job_t *job) /* I - Job to check */ + + if (cancel_after) + job->cancel_time = time(NULL) + ippGetInteger(cancel_after, 0); +- else ++ else if (MaxJobTime > 0) + job->cancel_time = time(NULL) + MaxJobTime; ++ else ++ job->cancel_time = 0; + } + } + } +diff --git a/scheduler/printers.c b/scheduler/printers.c +index bb99907ad..68239d85d 100644 +--- a/scheduler/printers.c ++++ b/scheduler/printers.c +@@ -3370,7 +3370,7 @@ add_printer_defaults(cupsd_printer_t *p)/* I - Printer */ + "document-format-default", NULL, "application/octet-stream"); + + if (!cupsGetOption("job-cancel-after", p->num_options, p->options)) +- ippAddInteger(p->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, ++ ippAddInteger(p->attrs, IPP_TAG_PRINTER, MaxJobTime > 0 ? IPP_TAG_INTEGER : IPP_TAG_NOVALUE, + "job-cancel-after-default", MaxJobTime); + + if (!cupsGetOption("job-hold-until", p->num_options, p->options)) +-- +2.31.1 + diff --git a/SOURCES/0001-Fix-lpadmin-with-cupsIPPSupplies-and-cupsSNMPSupplie.patch b/SOURCES/0001-Fix-lpadmin-with-cupsIPPSupplies-and-cupsSNMPSupplie.patch new file mode 100644 index 0000000..8f8fa71 --- /dev/null +++ b/SOURCES/0001-Fix-lpadmin-with-cupsIPPSupplies-and-cupsSNMPSupplie.patch @@ -0,0 +1,62 @@ +From 9539c53065170e97836503074e770d7b5fbf9f83 Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +Date: Tue, 16 Jul 2019 09:27:13 -0400 +Subject: [PATCH] Fix lpadmin with cupsIPPSupplies and cupsSNMPSupplies (Issue + #5610) + +--- + CHANGES.md | 2 ++ + systemv/lpadmin.c | 9 +++++++-- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c +index f428368d4..ca6d386b2 100644 +--- a/systemv/lpadmin.c ++++ b/systemv/lpadmin.c +@@ -1467,6 +1467,7 @@ set_printer_options( + (boolval = cupsGetOption("cupsIPPSupplies", num_options, + options)) != NULL) + { ++ ppdchanged = 1; + wrote_ipp_supplies = 1; + cupsFilePrintf(out, "*cupsIPPSupplies: %s\n", + (!_cups_strcasecmp(boolval, "true") || +@@ -1477,6 +1478,7 @@ set_printer_options( + (boolval = cupsGetOption("cupsSNMPSupplies", num_options, + options)) != NULL) + { ++ ppdchanged = 1; + wrote_snmp_supplies = 1; + cupsFilePrintf(out, "*cupsSNMPSupplies: %s\n", + (!_cups_strcasecmp(boolval, "true") || +@@ -1537,6 +1539,8 @@ set_printer_options( + (boolval = cupsGetOption("cupsIPPSupplies", num_options, + options)) != NULL) + { ++ ppdchanged = 1; ++ + cupsFilePrintf(out, "*cupsIPPSupplies: %s\n", + (!_cups_strcasecmp(boolval, "true") || + !_cups_strcasecmp(boolval, "yes") || +@@ -1547,6 +1551,8 @@ set_printer_options( + (boolval = cupsGetOption("cupsSNMPSupplies", num_options, + options)) != NULL) + { ++ ppdchanged = 1; ++ + cupsFilePrintf(out, "*cupsSNMPSupplies: %s\n", + (!_cups_strcasecmp(boolval, "true") || + !_cups_strcasecmp(boolval, "yes") || +@@ -1561,8 +1567,7 @@ set_printer_options( + * Do the request... + */ + +- ippDelete(cupsDoFileRequest(http, request, "/admin/", +- ppdchanged ? tempfile : file)); ++ ippDelete(cupsDoFileRequest(http, request, "/admin/", ppdchanged ? tempfile : file)); + + /* + * Clean up temp files... (TODO: catch signals in case we CTRL-C during +-- +2.31.1 + diff --git a/SOURCES/0001-cgi-bin-ipp-var.c-Use-guest-user-for-Move-Job-when-n.patch b/SOURCES/0001-cgi-bin-ipp-var.c-Use-guest-user-for-Move-Job-when-n.patch new file mode 100644 index 0000000..d2c0716 --- /dev/null +++ b/SOURCES/0001-cgi-bin-ipp-var.c-Use-guest-user-for-Move-Job-when-n.patch @@ -0,0 +1,16 @@ +diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c +index 92f1501..7edc058 100644 +--- a/cgi-bin/ipp-var.c ++++ b/cgi-bin/ipp-var.c +@@ -275,10 +275,7 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */ + */ + + if ((user = getenv("REMOTE_USER")) == NULL) +- { +- puts("Status: 401\n"); +- exit(0); +- } ++ user = "guest"; + + /* + * See if the user has already selected a new destination... diff --git a/SOURCES/0001-cups-dests.c-cupsGetNamedDest-set-IPP_STATUS_ERROR_N.patch b/SOURCES/0001-cups-dests.c-cupsGetNamedDest-set-IPP_STATUS_ERROR_N.patch new file mode 100644 index 0000000..3d12cc0 --- /dev/null +++ b/SOURCES/0001-cups-dests.c-cupsGetNamedDest-set-IPP_STATUS_ERROR_N.patch @@ -0,0 +1,65 @@ +From 4ddeb8544e2e5c63a405d9e093ac24704f3deb03 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Tue, 21 Jul 2020 12:54:22 +0200 +Subject: [PATCH] cups/dests.c: cupsGetNamedDest() - set + IPP_STATUS_ERROR_NOT_FOUND error if queue was not found lp.c/lpr.c: check for + IPP_STATUS_ERROR_NOT_FOUND and generate a proper message if hit + +--- + berkeley/lpr.c | 6 ++++++ + cups/dest.c | 3 +++ + systemv/lp.c | 6 ++++++ + 3 files changed, 15 insertions(+) + +diff --git a/berkeley/lpr.c b/berkeley/lpr.c +index 627fa6a4e..a8f78b881 100644 +--- a/berkeley/lpr.c ++++ b/berkeley/lpr.c +@@ -234,6 +234,12 @@ main(int argc, /* I - Number of command-line arguments */ + _cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]); + return (1); + } ++ else if (cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND) ++ { ++ _cupsLangPrintf(stderr, ++ _("%s: Error - The printer or class does not exist."), argv[0]); ++ return (1); ++ } + break; + + case '#' : /* Number of copies */ +diff --git a/cups/dest.c b/cups/dest.c +index cde987a09..2017792a7 100644 +--- a/cups/dest.c ++++ b/cups/dest.c +@@ -1839,7 +1839,10 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT + cupsEnumDests(0, 1000, NULL, 0, 0, (cups_dest_cb_t)cups_name_cb, &data); + + if (!data.dest) ++ { ++ _cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, _("The printer or class does not exist."), 1); + return (NULL); ++ } + + dest = data.dest; + } +diff --git a/systemv/lp.c b/systemv/lp.c +index 298c15825..d918b4b14 100644 +--- a/systemv/lp.c ++++ b/systemv/lp.c +@@ -161,6 +161,12 @@ main(int argc, /* I - Number of command-line arguments */ + "name."), argv[0]); + return (1); + } ++ else if (cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND) ++ { ++ _cupsLangPrintf(stderr, ++ _("%s: Error - The printer or class does not exist."), argv[0]); ++ return (1); ++ } + break; + + case 'f' : /* Form */ +-- +2.31.1 + diff --git a/SOURCES/0001-scheduler-job.c-use-gziptoany-for-raw-files-not-just.patch b/SOURCES/0001-scheduler-job.c-use-gziptoany-for-raw-files-not-just.patch new file mode 100644 index 0000000..025361f --- /dev/null +++ b/SOURCES/0001-scheduler-job.c-use-gziptoany-for-raw-files-not-just.patch @@ -0,0 +1,38 @@ +From 08e9b6e1f8497a8159d6bd7cd6dc96ae79a2e704 Mon Sep 17 00:00:00 2001 +From: Bryan Mason +Date: Thu, 15 Jul 2021 16:26:27 -0700 +Subject: [PATCH] scheduler/job.c: use gziptoany for raw files (not just raw + printers) + +--- + scheduler/job.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/scheduler/job.c b/scheduler/job.c +index d8c2efcc6..b448acda5 100644 +--- a/scheduler/job.c ++++ b/scheduler/job.c +@@ -501,6 +501,7 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ + int backroot; /* Run backend as root? */ + int pid; /* Process ID of new filter process */ + int banner_page; /* 1 if banner page, 0 otherwise */ ++ int raw_file; /* 1 if file type is vnd.cups-raw */ + int filterfds[2][2] = { { -1, -1 }, { -1, -1 } }; + /* Pipes used between filters */ + int envc; /* Number of environment variables */ +@@ -746,8 +747,11 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ + * Add decompression/raw filter as needed... + */ + ++ 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 && job->num_files > 1)) ++ (!job->printer->remote && (job->printer->raw || raw_file) && job->num_files > 1)) + { + /* + * Add gziptoany filter to the front of the list... +-- +2.31.1 + diff --git a/SOURCES/cups-ippeve-web-support.patch b/SOURCES/cups-ippeve-web-support.patch new file mode 100644 index 0000000..d799c23 --- /dev/null +++ b/SOURCES/cups-ippeve-web-support.patch @@ -0,0 +1,315 @@ +diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c +index a604a8a..e678f24 100644 +--- a/cgi-bin/admin.c ++++ b/cgi-bin/admin.c +@@ -974,6 +974,13 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + + cgiSetVariable("TEMPLATE_NAME", template); + } ++ ++ /* ++ * Set DEVICE_URI to the actual device uri, without make and model from ++ * html form. ++ */ ++ ++ cgiSetVariable("DEVICE_URI", var); + } + } + +@@ -1137,6 +1144,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + else if (!file && + (!cgiGetVariable("PPD_NAME") || cgiGetVariable("SELECT_MAKE"))) + { ++ int ipp_everywhere = !strncmp(var, "ipp://", 6) || !strncmp(var, "ipps://", 7) || (!strncmp(var, "dnssd://", 8) && (strstr(var, "_ipp._tcp") || strstr(var, "_ipps._tcp"))); ++ + if (modify && !cgiGetVariable("SELECT_MAKE")) + { + /* +@@ -1282,9 +1291,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + cgiStartHTML(title); + if (!cgiGetVariable("PPD_MAKE")) + cgiSetVariable("PPD_MAKE", cgiGetVariable("CURRENT_MAKE")); +- if (!modify) +- cgiSetVariable("CURRENT_MAKE_AND_MODEL", +- cgiGetArray("PPD_MAKE_AND_MODEL", 0)); ++ if (ipp_everywhere) ++ cgiSetVariable("SHOW_IPP_EVERYWHERE", "1"); + cgiCopyTemplateLang("choose-model.tmpl"); + cgiEndHTML(); + } +@@ -4219,6 +4227,11 @@ get_printer_ppd(const char *uri, /* I - Printer URI */ + host[256], /* Hostname */ + resource[256]; /* Resource path */ + int port; /* Port number */ ++ static const char * const pattrs[] = /* Printer attributes we need */ ++ { ++ "all", ++ "media-col-database" ++ }; + + + /* +@@ -4259,6 +4272,7 @@ get_printer_ppd(const char *uri, /* I - Printer URI */ + + request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); ++ ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs); + response = cupsDoRequest(http, request, resource); + + if (!_ppdCreateFromIPP(buffer, bufsize, response)) +diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c +index e5f89ee..b8139c8 100644 +--- a/cups/ppd-cache.c ++++ b/cups/ppd-cache.c +@@ -3089,8 +3089,8 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ + cupsFilePrintf(fp, "*Manufacturer: \"%s\"\n", make); + cupsFilePrintf(fp, "*ModelName: \"%s\"\n", model); + cupsFilePrintf(fp, "*Product: \"(%s)\"\n", model); +- cupsFilePrintf(fp, "*NickName: \"%s\"\n", model); +- cupsFilePrintf(fp, "*ShortNickName: \"%s\"\n", model); ++ cupsFilePrintf(fp, "*NickName: \"%s - IPP Everywhere\"\n", model); ++ cupsFilePrintf(fp, "*ShortNickName: \"%s - IPP Everywhere\"\n", model); + + if ((attr = ippFindAttribute(response, "color-supported", IPP_TAG_BOOLEAN)) != NULL && ippGetBoolean(attr, 0)) + cupsFilePuts(fp, "*ColorDevice: True\n"); +diff --git a/scheduler/ipp.c b/scheduler/ipp.c +index 5e9a985..4ed3c39 100644 +--- a/scheduler/ipp.c ++++ b/scheduler/ipp.c +@@ -5829,6 +5829,12 @@ create_local_bg_thread( + ipp_t *request, /* Request to printer */ + *response; /* Response from printer */ + ipp_attribute_t *attr; /* Attribute in response */ ++ ipp_status_t status; /* Status code */ ++ static const char * const pattrs[] = /* Printer attributes we need */ ++ { ++ "all", ++ "media-col-database" ++ }; + + + /* +@@ -5861,12 +5867,35 @@ create_local_bg_thread( + cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Connected to %s:%d, sending Get-Printer-Attributes request...", printer->name, host, port); + + 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_KEYWORD, "requested-attributes", NULL, "all"); ++ ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs); + + response = cupsDoRequest(http, request, resource); ++ status = cupsLastError(); ++ ++ cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Get-Printer-Attributes returned %s (%s)", printer->name, ippErrorString(cupsLastError()), cupsLastErrorString()); ++ ++ if (status == IPP_STATUS_ERROR_BAD_REQUEST || status == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED) ++ { ++ /* ++ * Try request using IPP/1.1, in case we are talking to an old CUPS server or ++ * printer... ++ */ + +- cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Get-Printer-Attributes returned %s", printer->name, ippErrorString(cupsLastError())); ++ ippDelete(response); ++ ++ cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Re-sending Get-Printer-Attributes request using IPP/1.1...", printer->name); ++ ++ 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_KEYWORD, "requested-attributes", NULL, "all"); ++ ++ response = cupsDoRequest(http, request, resource); ++ ++ cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: IPP/1.1 Get-Printer-Attributes returned %s (%s)", printer->name, ippErrorString(cupsLastError()), cupsLastErrorString()); ++ } + + // TODO: Grab printer icon file... + httpClose(http); +@@ -5877,6 +5906,8 @@ create_local_bg_thread( + + if (_ppdCreateFromIPP(fromppd, sizeof(fromppd), response)) + { ++ _cupsRWLockWrite(&printer->lock); ++ + if ((!printer->info || !*(printer->info)) && (attr = ippFindAttribute(response, "printer-info", IPP_TAG_TEXT)) != NULL) + cupsdSetString(&printer->info, ippGetString(attr, 0, NULL)); + +@@ -5886,6 +5917,8 @@ create_local_bg_thread( + if ((!printer->geo_location || !*(printer->geo_location)) && (attr = ippFindAttribute(response, "printer-geo-location", IPP_TAG_URI)) != NULL) + cupsdSetString(&printer->geo_location, ippGetString(attr, 0, NULL)); + ++ _cupsRWUnlock(&printer->lock); ++ + if ((from = cupsFileOpen(fromppd, "r")) == NULL) + { + cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Unable to read generated PPD: %s", printer->name, strerror(errno)); +diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c +index bb53565..f3510ca 100644 +--- a/systemv/lpadmin.c ++++ b/systemv/lpadmin.c +@@ -33,7 +33,7 @@ static int delete_printer_from_class(http_t *http, char *printer, + static int delete_printer_option(http_t *http, char *printer, + char *option); + static int enable_printer(http_t *http, char *printer); +-static char *get_printer_ppd(const char *uri, char *buffer, size_t bufsize); ++static char *get_printer_ppd(const char *uri, char *buffer, size_t bufsize, int *num_options, cups_option_t **options); + static cups_ptype_t get_printer_type(http_t *http, char *printer, char *uri, + size_t urisize); + static int set_printer_options(http_t *http, char *printer, +@@ -593,7 +593,7 @@ main(int argc, /* I - Number of command-line arguments */ + + if ((ppd_name = cupsGetOption("ppd-name", num_options, options)) != NULL && !strcmp(ppd_name, "everywhere") && (device_uri = cupsGetOption("device-uri", num_options, options)) != NULL) + { +- if ((file = get_printer_ppd(device_uri, evefile, sizeof(evefile))) == NULL) ++ if ((file = get_printer_ppd(device_uri, evefile, sizeof(evefile), &num_options, &options)) == NULL) + return (1); + + num_options = cupsRemoveOption("ppd-name", num_options, &options); +@@ -1144,20 +1144,29 @@ enable_printer(http_t *http, /* I - Server connection */ + * 'get_printer_ppd()' - Get an IPP Everywhere PPD file for the given URI. + */ + +-static char * /* O - Filename or NULL */ +-get_printer_ppd(const char *uri, /* I - Printer URI */ +- char *buffer, /* I - Filename buffer */ +- size_t bufsize) /* I - Size of filename buffer */ ++static char * /* O - Filename or NULL */ ++get_printer_ppd( ++ const char *uri, /* I - Printer URI */ ++ char *buffer, /* I - Filename buffer */ ++ size_t bufsize, /* I - Size of filename buffer */ ++ int *num_options, /* IO - Number of options */ ++ cups_option_t **options) /* IO - Options */ + { + http_t *http; /* Connection to printer */ + ipp_t *request, /* Get-Printer-Attributes request */ + *response; /* Get-Printer-Attributes response */ ++ ipp_attribute_t *attr; /* Attribute from response */ + char resolved[1024], /* Resolved URI */ + scheme[32], /* URI scheme */ + userpass[256], /* Username:password */ + host[256], /* Hostname */ + resource[256]; /* Resource path */ + int port; /* Port number */ ++ static const char * const pattrs[] = /* Attributes to use */ ++ { ++ "all", ++ "media-col-database" ++ }; + + + /* +@@ -1198,9 +1207,26 @@ get_printer_ppd(const char *uri, /* I - Printer URI */ + + request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); ++ ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]), NULL, pattrs); + response = cupsDoRequest(http, request, resource); + +- if (!_ppdCreateFromIPP(buffer, bufsize, response)) ++ if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE) ++ { ++ _cupsLangPrintf(stderr, _("%s: Unable to query printer: %s"), "lpadmin", cupsLastErrorString()); ++ buffer[0] = '\0'; ++ } ++ else if (_ppdCreateFromIPP(buffer, bufsize, response)) ++ { ++ if (!cupsGetOption("printer-geo-location", *num_options, *options) && (attr = ippFindAttribute(response, "printer-geo-location", IPP_TAG_URI)) != NULL) ++ *num_options = cupsAddOption("printer-geo-location", ippGetString(attr, 0, NULL), *num_options, options); ++ ++ if (!cupsGetOption("printer-info", *num_options, *options) && (attr = ippFindAttribute(response, "printer-info", IPP_TAG_TEXT)) != NULL) ++ *num_options = cupsAddOption("printer-info", ippGetString(attr, 0, NULL), *num_options, options); ++ ++ if (!cupsGetOption("printer-location", *num_options, *options) && (attr = ippFindAttribute(response, "printer-location", IPP_TAG_TEXT)) != NULL) ++ *num_options = cupsAddOption("printer-location", ippGetString(attr, 0, NULL), *num_options, options); ++ } ++ else + _cupsLangPrintf(stderr, _("%s: Unable to create PPD file: %s"), "lpadmin", strerror(errno)); + + ippDelete(response); +diff --git a/templates/choose-model.tmpl b/templates/choose-model.tmpl +index ee9338c..9c9b71f 100644 +--- a/templates/choose-model.tmpl ++++ b/templates/choose-model.tmpl +@@ -39,6 +39,7 @@ + + + +diff --git a/templates/de/choose-model.tmpl b/templates/de/choose-model.tmpl +index cb9b6f3..c73ccb2 100644 +--- a/templates/de/choose-model.tmpl ++++ b/templates/de/choose-model.tmpl +@@ -39,6 +39,7 @@ Drucker {?printer_is_shared=?nicht:{?printer_is_shared=0?nicht:}} im Netzwerk fr + + + +diff --git a/templates/es/choose-model.tmpl b/templates/es/choose-model.tmpl +index 8a5a4ba..b5624f2 100644 +--- a/templates/es/choose-model.tmpl ++++ b/templates/es/choose-model.tmpl +@@ -39,6 +39,7 @@ + + + +diff --git a/templates/fr/choose-model.tmpl b/templates/fr/choose-model.tmpl +index a4e771c..07cf93c 100644 +--- a/templates/fr/choose-model.tmpl ++++ b/templates/fr/choose-model.tmpl +@@ -39,6 +39,7 @@ + + + +diff --git a/templates/ja/choose-model.tmpl b/templates/ja/choose-model.tmpl +index daf1375..6a6e4e4 100644 +--- a/templates/ja/choose-model.tmpl ++++ b/templates/ja/choose-model.tmpl +@@ -39,6 +39,7 @@ + + + +diff --git a/templates/pt_BR/choose-model.tmpl b/templates/pt_BR/choose-model.tmpl +index 55d8bd8..0ed6a3c 100644 +--- a/templates/pt_BR/choose-model.tmpl ++++ b/templates/pt_BR/choose-model.tmpl +@@ -39,6 +39,7 @@ + + + +diff --git a/templates/ru/choose-model.tmpl b/templates/ru/choose-model.tmpl +index 2f0d6d9..dedbd49 100644 +--- a/templates/ru/choose-model.tmpl ++++ b/templates/ru/choose-model.tmpl +@@ -39,6 +39,7 @@ + + + diff --git a/SOURCES/cups-restart-job-hold-until.patch b/SOURCES/cups-restart-job-hold-until.patch new file mode 100644 index 0000000..d235518 --- /dev/null +++ b/SOURCES/cups-restart-job-hold-until.patch @@ -0,0 +1,20 @@ +diff --git a/scheduler/ipp.c b/scheduler/ipp.c +index e0dbc4a..5e9a985 100644 +--- a/scheduler/ipp.c ++++ b/scheduler/ipp.c +@@ -9891,11 +9891,10 @@ restart_job(cupsd_client_t *con, /* I - Client connection */ + cupsdLogJob(job, CUPSD_LOG_DEBUG, + "Restarted by \"%s\" with job-hold-until=%s.", + username, attr->values[0].string.text); +- cupsdSetJobHoldUntil(job, attr->values[0].string.text, 0); +- +- cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED | CUPSD_EVENT_JOB_STATE, +- NULL, job, "Job restarted by user with job-hold-until=%s", +- attr->values[0].string.text); ++ cupsdSetJobHoldUntil(job, attr->values[0].string.text, 1); ++ cupsdSetJobState(job, IPP_JOB_HELD, CUPSD_JOB_DEFAULT, ++ "Job restarted by user with job-hold-until=%s", ++ attr->values[0].string.text); + } + else + { diff --git a/SPECS/cups.spec b/SPECS/cups.spec index 8051d01..1d2ac8b 100644 --- a/SPECS/cups.spec +++ b/SPECS/cups.spec @@ -15,7 +15,7 @@ Summary: CUPS printing system Name: cups Epoch: 1 Version: 2.2.6 -Release: 40%{?dist} +Release: 44%{?dist} License: GPLv2+ and LGPLv2 with exceptions and AML Url: http://www.cups.org/ Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz @@ -111,8 +111,26 @@ Patch61: cups-sssd.patch Patch62: cups-fix-preservejob-times.patch # 1927452 - CVE-2020-10001 cups: access to uninitialized buffer in ipp.c [rhel-8] Patch63: cups-cve202010001.patch - -Patch100: cups-lspp.patch +# 2006987 - Unauthenticated users can't move print jobs in Web UI +Patch64: 0001-cgi-bin-ipp-var.c-Use-guest-user-for-Move-Job-when-n.patch +# 2017919 - Setting 'MaxJobTime 0' does not set a job time to unlimited +Patch65: 0001-Fix-handling-of-MaxJobTime-0-Issue-5438.patch +# 1726383 - "lpadmin -p -o cupsSNMPSupplies:false" doesn't work +Patch66: 0001-Fix-lpadmin-with-cupsIPPSupplies-and-cupsSNMPSupplie.patch +# 1982891 - Printing of banner before PCL file only prints banner +Patch67: 0001-scheduler-job.c-use-gziptoany-for-raw-files-not-just.patch +# 2006591 - Trying to restart and hold a job doesn't work +Patch68: cups-restart-job-hold-until.patch +# 1811716 - lpr to non-existent printer reports incorrect error +Patch69: 0001-cups-dests.c-cupsGetNamedDest-set-IPP_STATUS_ERROR_N.patch +# 2015182 - RFE: Implement IdleExitTimeout configuration during build +Patch70: 0001-Add-with-idle-exit-timeout-configure-option.patch +# 2013865 - RFE: Implement TimeoutStartSec configuration during build +Patch71: 0001-Add-with-systemd-timeoutstartsec-configure-option.patch +# 2032965 - [RFE] RHEL8 - CUPS Web UI supports adding IPP Everywhere +Patch72: cups-ippeve-web-support.patch + +Patch1000: cups-lspp.patch Requires: %{name}-filesystem = %{epoch}:%{version}-%{release} Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} @@ -311,7 +329,7 @@ Sends IPP requests to the specified URI and tests and/or displays the results. %if %{lspp} # LSPP support. -%patch100 -p1 -b .lspp +%patch1000 -p1 -b .lspp %endif # substitute default values for invalid job attributes (upstream #5186 and #5229) @@ -365,6 +383,24 @@ Sends IPP requests to the specified URI and tests and/or displays the results. %patch62 -p1 -b .cups-fix-preservejob-times # 1927452 - CVE-2020-10001 cups: access to uninitialized buffer in ipp.c [rhel-8] %patch63 -p1 -b .cve202010001 +# 2006987 - Unauthenticated users can't move print jobs in Web UI +%patch64 -p1 -b .move-job +# 2017919 - Setting 'MaxJobTime 0' does not set a job time to unlimited +%patch65 -p1 -b .maxjobtime +# 1726383 - "lpadmin -p -o cupsSNMPSupplies:false" doesn't work +%patch66 -p1 -b .supplies +# 1982891 - Printing of banner before PCL file only prints banner +%patch67 -p1 -b .banner-rawfiles +# 2006591 - Trying to restart and hold a job doesn't work +%patch68 -p1 -b .restart-hold-job +# 1811716 - lpr to non-existent printer reports incorrect error +%patch69 -p1 -b .lplpr-better-error +# 2015182 - RFE: Implement IdleExitTimeout configuration during build +%patch70 -p1 -b .idleexittimeout +# 2013865 - RFE: Implement TimeoutStartSec configuration during build +%patch71 -p1 -b .timeoutstartsec +# 2032965 - [RFE] RHEL8 - CUPS Web UI supports adding IPP Everywhere +%patch72 -p1 -b .ippeve-web-support sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in @@ -414,6 +450,10 @@ export CXX=g++ --with-xinetd=no \ --with-access-log-level=actions \ --enable-page-logging \ +%if 0%{?rhel} + --without-idle-exit-timeout \ + --without-systemd-timeoutstartsec \ +%endif localedir=%{_datadir}/locale # If we got this far, all prerequisite libraries must be here. @@ -567,6 +607,11 @@ then %{_bindir}/systemctl enable cups.service > /dev/null 2>&1 fi +# 2013865 - if the directive is not in cupsd.conf, add it (needed during upgrades if +# user had changed the config file) +grep '^\s*IdleExitTimeout' %{_sysconfdir}/cups/cupsd.conf &> /dev/null || echo -e '\nIdleExitTimeout 0' \ +>> %{_sysconfdir}/cups/cupsd.conf + exit 0 %post client @@ -775,6 +820,26 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man5/ipptoolfile.5.gz %changelog +* Wed Jan 19 2022 Zdenek Dohnal - 1:2.2.6-44 +- 2015182 - RFE: Implement IdleExitTimeout configuration during build + +* Thu Jan 06 2022 Zdenek Dohnal - 1:2.2.6-43 +- 2032965 - [RFE] RHEL8 - CUPS Web UI supports adding IPP Everywhere + +* Thu Dec 16 2021 Zdenek Dohnal - 1:2.2.6-42 +- 2013865 - RFE: Implement TimeoutStartSec configuration during build + +* Mon Nov 29 2021 Zdenek Dohnal - 1:2.2.6-42 +- 2015182 - RFE: Implement IdleExitTimeout configuration during build + +* Wed Nov 03 2021 Zdenek Dohnal - 1:2.2.6-41 +- 2006987 - Unauthenticated users can't move print jobs in Web UI +- 2017919 - Setting 'MaxJobTime 0' does not set a job time to unlimited +- 1726383 - "lpadmin -p -o cupsSNMPSupplies:false" doesn't work +- 1982891 - Printing of banner before PCL file only prints banner +- 2006591 - Trying to restart and hold a job doesn't work +- 1811716 - lpr to non-existent printer reports incorrect error + * Fri May 14 2021 Zdenek Dohnal - 1:2.2.6-40 - 1955964 - PreserveJobHistory doesn't work with seconds - 1927452 - CVE-2020-10001 cups: access to uninitialized buffer in ipp.c [rhel-8]