diff --git a/0001-Fix-memory-leaks-found-by-Coverity-Issue-5375.patch b/0001-Fix-memory-leaks-found-by-Coverity-Issue-5375.patch deleted file mode 100644 index ec224c3ffdfea5c093cbdc6b7a9fe2acfb3996e9..0000000000000000000000000000000000000000 --- a/0001-Fix-memory-leaks-found-by-Coverity-Issue-5375.patch +++ /dev/null @@ -1,206 +0,0 @@ -diff --git a/backend/ipp.c b/backend/ipp.c -index 32eb3aaa4..2a880bd75 100644 ---- a/backend/ipp.c -+++ b/backend/ipp.c -@@ -3612,6 +3612,8 @@ update_reasons(ipp_attribute_t *attr, /* I - printer-state-reasons or NULL */ - } - } - -+ cupsArrayDelete(new_reasons); -+ - _cupsMutexUnlock(&report_mutex); - - /* -diff --git a/cgi-bin/search.c b/cgi-bin/search.c -index 3956afc33..ad1f5ed0e 100644 ---- a/cgi-bin/search.c -+++ b/cgi-bin/search.c -@@ -361,4 +362,5 @@ void - cgiFreeSearch(void *search) /* I - Search context */ - { - regfree((regex_t *)search); -+ free(search); - } -diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c -index 5d510140b..688901a7d 100644 ---- a/cups/http-addrlist.c -+++ b/cups/http-addrlist.c -@@ -612,6 +613,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p - if (!temp) - { - httpAddrFreeList(first); -+ freeaddrinfo(results); - _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0); - return (NULL); - } -diff --git a/cups/http.c b/cups/http.c -index a9235b087..d9332cc83 100644 ---- a/cups/http.c -+++ b/cups/http.c -@@ -3915,7 +3915,7 @@ http_create( - if ((http = calloc(sizeof(http_t), 1)) == NULL) - { - _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0); -- httpAddrFreeList(addrlist); -+ httpAddrFreeList(myaddrlist); - return (NULL); - } - -diff --git a/ppdc/ppdc-source.cxx b/ppdc/ppdc-source.cxx -index be24cebae..4e8cba7bb 100644 ---- a/ppdc/ppdc-source.cxx -+++ b/ppdc/ppdc-source.cxx -@@ -2665,6 +2666,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read - // Add it to the current option... - if (!o) - { -+ c->release(); - _cupsLangPrintf(stderr, - _("ppdc: Choice found on line %d of %s with no " - "Option."), fp->line, fp->filename); -diff --git a/scheduler/cups-driverd.cxx b/scheduler/cups-driverd.cxx -index 657eee0a0..b518a9325 100644 ---- a/scheduler/cups-driverd.cxx -+++ b/scheduler/cups-driverd.cxx -@@ -153,7 +153,7 @@ static ppd_info_t *add_ppd(const char *filename, const char *name, - size_t size, int model_number, int type, - const char *scheme); - static int cat_drv(const char *name, int request_id); --static int cat_ppd(const char *name, int request_id); -+static void cat_ppd(const char *name, int request_id); - static int cat_static(const char *name, int request_id); - static int cat_tar(const char *name, int request_id); - static int compare_inodes(struct stat *a, struct stat *b); -@@ -163,12 +163,12 @@ static int compare_names(const ppd_info_t *p0, - const ppd_info_t *p1); - static int compare_ppds(const ppd_info_t *p0, - const ppd_info_t *p1); --static int dump_ppds_dat(const char *filename); -+static void dump_ppds_dat(const char *filename); - static void free_array(cups_array_t *a); - static cups_file_t *get_file(const char *name, int request_id, - const char *subdir, char *buffer, - size_t bufsize, char **subfile); --static int list_ppds(int request_id, int limit, const char *opt); -+static void list_ppds(int request_id, int limit, const char *opt); - static int load_drivers(cups_array_t *include, - cups_array_t *exclude); - static int load_drv(const char *filename, const char *name, -@@ -204,13 +204,13 @@ main(int argc, /* I - Number of command-line args */ - */ - - if (argc == 3 && !strcmp(argv[1], "cat")) -- return (cat_ppd(argv[2], 0)); -+ cat_ppd(argv[2], 0); - else if ((argc == 2 || argc == 3) && !strcmp(argv[1], "dump")) -- return (dump_ppds_dat(argv[2])); -+ dump_ppds_dat(argv[2]); - else if (argc == 4 && !strcmp(argv[1], "get")) -- return (cat_ppd(argv[3], atoi(argv[2]))); -+ cat_ppd(argv[3], atoi(argv[2])); - else if (argc == 5 && !strcmp(argv[1], "list")) -- return (list_ppds(atoi(argv[2]), atoi(argv[3]), argv[4])); -+ list_ppds(atoi(argv[2]), atoi(argv[3]), argv[4]); - else - { - fputs("Usage: cups-driverd cat ppd-name\n", stderr); -@@ -428,7 +428,7 @@ cat_drv(const char *name, /* I - PPD name */ - * 'cat_ppd()' - Copy a PPD file to stdout. - */ - --static int /* O - Exit code */ -+static void - cat_ppd(const char *name, /* I - PPD name */ - int request_id) /* I - Request ID for response? */ - { -@@ -445,7 +445,7 @@ cat_ppd(const char *name, /* I - PPD name */ - if (strstr(name, "../")) - { - fputs("ERROR: Invalid PPD name.\n", stderr); -- return (1); -+ exit(1); - } - - strlcpy(scheme, name, sizeof(scheme)); -@@ -475,11 +475,11 @@ cat_ppd(const char *name, /* I - PPD name */ - puts("Content-Type: application/ipp\n"); - - if (!scheme[0]) -- return (cat_static(name, request_id)); -+ exit(cat_static(name, request_id)); - else if (!strcmp(scheme, "drv")) -- return (cat_drv(name, request_id)); -+ exit(cat_drv(name, request_id)); - else if (!strcmp(scheme, "file")) -- return (cat_tar(name, request_id)); -+ exit(cat_tar(name, request_id)); - else - { - /* -@@ -517,7 +517,7 @@ cat_ppd(const char *name, /* I - PPD name */ - cupsdSendIPPTrailer(); - } - -- return (1); -+ exit(1); - } - - /* -@@ -547,15 +547,15 @@ cat_ppd(const char *name, /* I - PPD name */ - - fprintf(stderr, "ERROR: [cups-driverd] Unable to execute \"%s\" - %s\n", - line, strerror(errno)); -- return (1); -+ exit(1); - } - } - - /* -- * Return with no errors... -+ * Exit with no errors... - */ - -- return (0); -+ exit(0); - } - - -@@ -778,7 +778,7 @@ compare_ppds(const ppd_info_t *p0, /* I - First PPD file */ - * 'dump_ppds_dat()' - Dump the contents of the ppds.dat file. - */ - --static int /* O - Exit status */ -+static void - dump_ppds_dat(const char *filename) /* I - Filename */ - { - char temp[1024]; /* ppds.dat filename */ -@@ -810,7 +810,7 @@ dump_ppds_dat(const char *filename) /* I - Filename */ - ppd->record.make_and_model, ppd->record.device_id, - ppd->record.scheme); - -- return (0); -+ exit(0); - } - - -@@ -1004,7 +1004,7 @@ get_file(const char *name, /* I - Name */ - * 'list_ppds()' - List PPD files. - */ - --static int /* O - Exit code */ -+static void - list_ppds(int request_id, /* I - Request ID */ - int limit, /* I - Limit */ - const char *opt) /* I - Option argument */ -@@ -1566,7 +1566,7 @@ list_ppds(int request_id, /* I - Request ID */ - if (request_id) - cupsdSendIPPTrailer(); - -- return (0); -+ exit(0); - } - - --- -2.17.1 - diff --git a/CVE-2018-4300.patch b/CVE-2018-4300.patch deleted file mode 100644 index 20ff3229aa76f496ae1f01bf3a976d8516cd02d4..0000000000000000000000000000000000000000 --- a/CVE-2018-4300.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/cgi-bin/var.c 2013-06-07 09:12:52.000000000 +0800 -+++ b/cgi-bin/var.c 2019-04-20 18:23:17.835000000 +0800 -@@ -1222,6 +1222,7 @@ cgi_set_sid(void) - *server_name, /* SERVER_NAME */ - *server_port; /* SERVER_PORT */ - -+ struct timeval curtime; /* Current time */ - - if ((remote_addr = getenv("REMOTE_ADDR")) == NULL) - remote_addr = "REMOTE_ADDR"; -@@ -1230,7 +1231,8 @@ cgi_set_sid(void) - if ((server_port = getenv("SERVER_PORT")) == NULL) - server_port = "SERVER_PORT"; - -- CUPS_SRAND(time(NULL)); -+ gettimeofday(&curtime, NULL); -+ CUPS_SRAND(curtime.tv_sec + curtime.tv_usec); - snprintf(buffer, sizeof(buffer), "%s:%s:%s:%02X%02X%02X%02X%02X%02X%02X%02X", - remote_addr, server_name, server_port, - (unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255, diff --git a/CVE-2019-2228.patch b/CVE-2019-2228.patch deleted file mode 100644 index 6daa793b6f976159a645c8c1cff6afc5dd12fbd7..0000000000000000000000000000000000000000 --- a/CVE-2019-2228.patch +++ /dev/null @@ -1,40 +0,0 @@ -From a7f63f254bcb43f52dc45ab5d883ae6517678544 Mon Sep 17 00:00:00 2001 -From: Michael R Sweet -Date: Fri, 13 Dec 2019 09:30:46 -0500 -Subject: [PATCH] CVE-2019-2228: Fix ippSetValueTag validation of default - language. - ---- - CHANGES.md | 2 ++ - cups/ipp.c | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/CHANGES.md b/CHANGES.md -index 7220dc9..06f96bc 100644 ---- a/CHANGES.md -+++ b/CHANGES.md -@@ -5,6 +5,8 @@ CHANGES - 2.2.8 - 2018-06-05 - Changes in CUPS v2.2.8 - ---------------------- - -+- CVE-2019-2228: The `ippSetValuetag` function did not validate the default -+ language value. - - Additional changes for the scheduler to substitute default values for invalid - job attributes when running in "relaxed conformance" mode (Issue #5229) - - The `ipptool` program no longer checks for duplicate attributes when running -diff --git a/cups/ipp.c b/cups/ipp.c -index 5807de8..1143550 100644 ---- a/cups/ipp.c -+++ b/cups/ipp.c -@@ -4654,7 +4654,7 @@ ippSetValueTag( - return (0); - - if (ipp->attrs && ipp->attrs->next && ipp->attrs->next->name && -- !strcmp(ipp->attrs->next->name, "attributes-natural-language")) -+ !strcmp(ipp->attrs->next->name, "attributes-natural-language") && (ipp->attrs->next->value_tag & IPP_TAG_CUPS_MASK) == IPP_TAG_LANGUAGE) - { - /* - * Use the language code from the IPP message... --- -1.8.3.1 - diff --git a/CVE-2019-8675-CVE-2019-8696.patch b/CVE-2019-8675-CVE-2019-8696.patch deleted file mode 100644 index 08d1ebce693ec35806c85bc9c03518dbb41e4c5d..0000000000000000000000000000000000000000 --- a/CVE-2019-8675-CVE-2019-8696.patch +++ /dev/null @@ -1,187 +0,0 @@ -From f24e6cf6a39300ad0c3726a41a4aab51ad54c109 Mon Sep 17 00:00:00 2001 -From: Michael R Sweet -Date: Thu, 15 Aug 2019 14:08:31 -0400 -Subject: [PATCH] Fix multiple security/disclosure issues: - -- CVE-2019-8696 and CVE-2019-8675: Fixed SNMP buffer overflows (rdar://51685251) -- Fixed IPP buffer overflow (rdar://50035411) -- Fixed memory disclosure issue in the scheduler (rdar://51373853) -- Fixed DoS issues in the scheduler (rdar://51373929) ---- - CHANGES.md | 6 +++++- - cups/http.c | 9 +++++++-- - cups/ipp.c | 9 ++------- - cups/snmp.c | 20 +++++++++++++++++++- - scheduler/client.c | 23 ++++++++++++----------- - 5 files changed, 45 insertions(+), 22 deletions(-) - -diff --git a/cups/http.c b/cups/http.c -index 5c14ef68e..3fadb5acb 100644 ---- a/cups/http.c -+++ b/cups/http.c -@@ -1905,7 +1905,7 @@ httpPrintf(http_t *http, /* I - HTTP connection */ - ...) /* I - Additional args as needed */ - { - ssize_t bytes; /* Number of bytes to write */ -- char buf[16384]; /* Buffer for formatted string */ -+ char buf[65536]; /* Buffer for formatted string */ - va_list ap; /* Variable argument pointer */ - - -@@ -1917,7 +1917,12 @@ httpPrintf(http_t *http, /* I - HTTP connection */ - - DEBUG_printf(("3httpPrintf: (" CUPS_LLFMT " bytes) %s", CUPS_LLCAST bytes, buf)); - -- if (http->data_encoding == HTTP_ENCODING_FIELDS) -+ if (bytes > (ssize_t)(sizeof(buf) - 1)) -+ { -+ http->error = ENOMEM; -+ return (-1); -+ } -+ else if (http->data_encoding == HTTP_ENCODING_FIELDS) - return ((int)httpWrite2(http, buf, (size_t)bytes)); - else - { -diff --git a/cups/ipp.c b/cups/ipp.c -index eaa8c78ca..b0762fdcb 100644 ---- a/cups/ipp.c -+++ b/cups/ipp.c -@@ -4553,9 +4553,7 @@ ippSetValueTag( - break; - - case IPP_TAG_NAME : -- if (temp_tag != IPP_TAG_KEYWORD && temp_tag != IPP_TAG_URI && -- temp_tag != IPP_TAG_URISCHEME && temp_tag != IPP_TAG_LANGUAGE && -- temp_tag != IPP_TAG_MIMETYPE) -+ if (temp_tag != IPP_TAG_KEYWORD) - return (0); - - (*attr)->value_tag = (ipp_tag_t)(IPP_TAG_NAME | ((*attr)->value_tag & IPP_TAG_CUPS_CONST)); -@@ -4563,10 +4561,7 @@ ippSetValueTag( - - case IPP_TAG_NAMELANG : - case IPP_TAG_TEXTLANG : -- if (value_tag == IPP_TAG_NAMELANG && -- (temp_tag != IPP_TAG_NAME && temp_tag != IPP_TAG_KEYWORD && -- temp_tag != IPP_TAG_URI && temp_tag != IPP_TAG_URISCHEME && -- temp_tag != IPP_TAG_LANGUAGE && temp_tag != IPP_TAG_MIMETYPE)) -+ if (value_tag == IPP_TAG_NAMELANG && (temp_tag != IPP_TAG_NAME && temp_tag != IPP_TAG_KEYWORD)) - return (0); - - if (value_tag == IPP_TAG_TEXTLANG && temp_tag != IPP_TAG_TEXT) -diff --git a/cups/snmp.c b/cups/snmp.c -index 8437528dd..fc9396177 100644 ---- a/cups/snmp.c -+++ b/cups/snmp.c -@@ -1233,6 +1233,9 @@ asn1_get_integer( - int value; /* Integer value */ - - -+ if (*buffer >= bufend) -+ return (0); -+ - if (length > sizeof(int)) - { - (*buffer) += length; -@@ -1259,6 +1262,9 @@ asn1_get_length(unsigned char **buffer, /* IO - Pointer in buffer */ - unsigned length; /* Length */ - - -+ if (*buffer >= bufend) -+ return (0); -+ - length = **buffer; - (*buffer) ++; - -@@ -1301,6 +1307,9 @@ asn1_get_oid( - int number; /* OID number */ - - -+ if (*buffer >= bufend) -+ return (0); -+ - valend = *buffer + length; - oidptr = oid; - oidend = oid + oidsize - 1; -@@ -1349,9 +1358,12 @@ asn1_get_packed( - int value; /* Value */ - - -+ if (*buffer >= bufend) -+ return (0); -+ - value = 0; - -- while ((**buffer & 128) && *buffer < bufend) -+ while (*buffer < bufend && (**buffer & 128)) - { - value = (value << 7) | (**buffer & 127); - (*buffer) ++; -@@ -1379,6 +1391,9 @@ asn1_get_string( - char *string, /* I - String buffer */ - size_t strsize) /* I - String buffer size */ - { -+ if (*buffer >= bufend) -+ return (NULL); -+ - if (length > (unsigned)(bufend - *buffer)) - length = (unsigned)(bufend - *buffer); - -@@ -1421,6 +1436,9 @@ asn1_get_type(unsigned char **buffer, /* IO - Pointer in buffer */ - int type; /* Type */ - - -+ if (*buffer >= bufend) -+ return (0); -+ - type = **buffer; - (*buffer) ++; - -diff --git a/scheduler/client.c b/scheduler/client.c -index a21b909a8..680508047 100644 ---- a/scheduler/client.c -+++ b/scheduler/client.c -@@ -568,6 +568,17 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ - - cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cupsdReadClient: error=%d, used=%d, state=%s, data_encoding=HTTP_ENCODING_%s, data_remaining=" CUPS_LLFMT ", request=%p(%s), file=%d", httpError(con->http), (int)httpGetReady(con->http), httpStateString(httpGetState(con->http)), httpIsChunked(con->http) ? "CHUNKED" : "LENGTH", CUPS_LLCAST httpGetRemaining(con->http), con->request, con->request ? ippStateString(ippGetState(con->request)) : "", con->file); - -+ if (httpError(con->http) == EPIPE && !httpGetReady(con->http) && recv(httpGetFd(con->http), buf, 1, MSG_PEEK) < 1) -+ { -+ /* -+ * Connection closed... -+ */ -+ -+ cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on EOF."); -+ cupsdCloseClient(con); -+ return; -+ } -+ - if (httpGetState(con->http) == HTTP_STATE_GET_SEND || - httpGetState(con->http) == HTTP_STATE_POST_SEND || - httpGetState(con->http) == HTTP_STATE_STATUS) -@@ -577,17 +588,6 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ - * connection and we need to shut it down... - */ - -- if (!httpGetReady(con->http) && recv(httpGetFd(con->http), buf, 1, MSG_PEEK) < 1) -- { -- /* -- * Connection closed... -- */ -- -- cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on EOF."); -- cupsdCloseClient(con); -- return; -- } -- - cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on unexpected HTTP read state %s.", httpStateString(httpGetState(con->http))); - cupsdCloseClient(con); - return; -@@ -2209,6 +2209,7 @@ cupsdSendError(cupsd_client_t *con, /* I - Connection */ - strlcpy(location, httpGetField(con->http, HTTP_FIELD_LOCATION), sizeof(location)); - - httpClearFields(con->http); -+ httpClearCookie(con->http); - - httpSetField(con->http, HTTP_FIELD_LOCATION, location); - diff --git a/cups-2.2.8-source.tar.gz b/cups-2.3.3-source.tar.gz similarity index 47% rename from cups-2.2.8-source.tar.gz rename to cups-2.3.3-source.tar.gz index cb0b749e89bc83d96fd7fd74d5fa9f72685402af..245bf6edc9ce9826403b8f5a5898987736799132 100644 Binary files a/cups-2.2.8-source.tar.gz and b/cups-2.3.3-source.tar.gz differ diff --git a/cups-accesslog-null.patch b/cups-accesslog-null.patch deleted file mode 100644 index fdb7d6132580c29bfa3b6b311b278f2d9d337c36..0000000000000000000000000000000000000000 --- a/cups-accesslog-null.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/scheduler/log.c b/scheduler/log.c -index 74790dc35..b6226201f 100644 ---- a/scheduler/log.c -+++ b/scheduler/log.c -@@ -1046,7 +1047,7 @@ cupsdLogRequest(cupsd_client_t *con, /* I - Request to log */ - * Filter requests as needed... - */ - -- if (AccessLogLevel == CUPSD_ACCESSLOG_NONE) -+ if (AccessLogLevel == CUPSD_ACCESSLOG_NONE || !AccessLog) - return (1); - else if (AccessLogLevel < CUPSD_ACCESSLOG_ALL) - { diff --git a/cups-autostart-when-enabled.patch b/cups-autostart-when-enabled.patch new file mode 100644 index 0000000000000000000000000000000000000000..ea6a2c3d370888d42d68ede4625bba210fd5feb4 --- /dev/null +++ b/cups-autostart-when-enabled.patch @@ -0,0 +1,10 @@ +diff --git a/scheduler/org.cups.cupsd.service.in b/scheduler/org.cups.cupsd.service.in +index bf308a5..add238b 100644 +--- a/scheduler/org.cups.cupsd.service.in ++++ b/scheduler/org.cups.cupsd.service.in +@@ -10,4 +10,4 @@ Restart=on-failure + + [Install] + Also=cups.socket cups.path +-WantedBy=printer.target ++WantedBy=printer.target multi-user.target diff --git a/cups-driverd-timeout.patch b/cups-driverd-timeout.patch new file mode 100644 index 0000000000000000000000000000000000000000..b7240a34d0db603a635711d75acd493c93c6dcb6 --- /dev/null +++ b/cups-driverd-timeout.patch @@ -0,0 +1,21 @@ +diff -up cups-1.7b1/scheduler/ipp.c.driverd-timeout cups-1.7b1/scheduler/ipp.c +--- cups-1.7b1/scheduler/ipp.c.driverd-timeout 2013-04-19 12:24:43.003841810 +0200 ++++ cups-1.7b1/scheduler/ipp.c 2013-04-19 12:24:43.204839107 +0200 +@@ -4556,7 +4556,7 @@ copy_model(cupsd_client_t *con, /* I - + close(temppipe[1]); + + /* +- * Wait up to 30 seconds for the PPD file to be copied... ++ * Wait up to 70 seconds for the PPD file to be copied... + */ + + total = 0; +@@ -4576,7 +4576,7 @@ copy_model(cupsd_client_t *con, /* I - + FD_SET(temppipe[0], &input); + FD_SET(CGIPipes[0], &input); + +- timeout.tv_sec = 30; ++ timeout.tv_sec = 70; + timeout.tv_usec = 0; + + if ((i = select(maxfd, &input, NULL, NULL, &timeout)) < 0) diff --git a/cups-dymo-deviceid.patch b/cups-dymo-deviceid.patch index cc2995d7fab8df4ba9455e0918875e8c51b0813f..3ff1ffdb7718663557d58a43e0cafc947ea79c9b 100644 --- a/cups-dymo-deviceid.patch +++ b/cups-dymo-deviceid.patch @@ -1,11 +1,11 @@ -diff -up cups-1.6.2/ppdc/sample.drv.dymo-deviceid cups-1.6.2/ppdc/sample.drv ---- cups-1.6.2/ppdc/sample.drv.dymo-deviceid 2013-06-18 16:57:02.110662953 +0100 -+++ cups-1.6.2/ppdc/sample.drv 2013-06-18 16:58:56.513989117 +0100 -@@ -125,6 +125,7 @@ Version "1.5" +diff -up cups-2.3.1/ppdc/sample.drv.dymo-deviceid cups-2.3.1/ppdc/sample.drv +--- cups-2.3.1/ppdc/sample.drv.dymo-deviceid 2019-12-16 09:22:34.476492212 +0100 ++++ cups-2.3.1/ppdc/sample.drv 2019-12-16 09:23:44.665003895 +0100 +@@ -129,6 +129,7 @@ Version "2.3" { - Manufacturer "Dymo" + Manufacturer "DYMO" ModelName "Label Printer" + Attribute "1284DeviceID" "" "MFG:DYMO;MDL:LabelWriter 400;" - Attribute NickName "" "Dymo Label Printer" + Attribute NickName "" "DYMO Label Printer" PCFileName "dymo.ppd" DriverType label diff --git a/cups-eggcups.patch b/cups-eggcups.patch index b1eb218463fda423c83f18b9ee3a06de923464ce..b49638eb3a3ead00a90be48e63b756b0a0f84a36 100644 --- a/cups-eggcups.patch +++ b/cups-eggcups.patch @@ -1,7 +1,7 @@ -diff -up cups-2.2.5/backend/ipp.c.eggcups cups-2.2.5/backend/ipp.c ---- cups-2.2.5/backend/ipp.c.eggcups 2017-10-13 20:22:26.000000000 +0200 -+++ cups-2.2.5/backend/ipp.c 2017-10-17 18:56:42.409024451 +0200 -@@ -149,6 +149,70 @@ static char tmpfilename[1024] = ""; +diff -up cups-2.3.0/backend/ipp.c.eggcups cups-2.3.0/backend/ipp.c +--- cups-2.3.0/backend/ipp.c.eggcups 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/backend/ipp.c 2019-10-07 12:14:25.385111933 +0200 +@@ -143,6 +143,70 @@ static char tmpfilename[1024] = ""; static char mandatory_attrs[1024] = ""; /* cupsMandatory value */ @@ -72,7 +72,7 @@ diff -up cups-2.2.5/backend/ipp.c.eggcups cups-2.2.5/backend/ipp.c /* * Local functions... -@@ -1743,6 +1807,15 @@ main(int argc, /* I - Number of comm +@@ -1768,6 +1832,15 @@ main(int argc, /* I - Number of comm fprintf(stderr, "DEBUG: Print job accepted - job ID %d.\n", job_id); } @@ -88,22 +88,22 @@ diff -up cups-2.2.5/backend/ipp.c.eggcups cups-2.2.5/backend/ipp.c ippDelete(response); if (job_canceled) -diff -up cups-2.2.5/backend/Makefile.eggcups cups-2.2.5/backend/Makefile ---- cups-2.2.5/backend/Makefile.eggcups 2017-10-17 18:56:42.409024451 +0200 -+++ cups-2.2.5/backend/Makefile 2017-10-17 18:59:11.696781116 +0200 -@@ -262,7 +262,7 @@ dnssd: dnssd.o ../cups/$(LIBCUPS) libbac +diff -up cups-2.3.0/backend/Makefile.eggcups cups-2.3.0/backend/Makefile +--- cups-2.3.0/backend/Makefile.eggcups 2019-10-07 12:14:25.385111933 +0200 ++++ cups-2.3.0/backend/Makefile 2019-10-07 12:16:00.457569406 +0200 +@@ -257,7 +257,7 @@ dnssd: dnssd.o ../cups/$(LIBCUPS) libbac ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a echo Linking $@... -- $(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) -+ $(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(SERVERLIBS) - $(RM) http - $(LN) ipp http - -diff -up cups-2.2.5/scheduler/subscriptions.c.eggcups cups-2.2.5/scheduler/subscriptions.c ---- cups-2.2.5/scheduler/subscriptions.c.eggcups 2017-10-13 20:22:26.000000000 +0200 -+++ cups-2.2.5/scheduler/subscriptions.c 2017-10-17 18:56:42.409024451 +0200 -@@ -1291,13 +1291,13 @@ cupsd_send_dbus(cupsd_eventmask_t event, +- $(LD_CC) $(ALL_LDFLAGS) -o ipp ipp.o libbackend.a $(LINKCUPS) ++ $(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LINKCUPS) $(SERVERLIBS) + $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ + $(RM) http https ipps + for file in $(IPPALIASES); do \ +diff -up cups-2.3.0/scheduler/subscriptions.c.eggcups cups-2.3.0/scheduler/subscriptions.c +--- cups-2.3.0/scheduler/subscriptions.c.eggcups 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/scheduler/subscriptions.c 2019-10-07 12:18:21.736478684 +0200 +@@ -1257,13 +1257,13 @@ cupsd_send_dbus(cupsd_eventmask_t event, what = "PrinterAdded"; else if (event & CUPSD_EVENT_PRINTER_DELETED) what = "PrinterRemoved"; @@ -112,14 +112,14 @@ diff -up cups-2.2.5/scheduler/subscriptions.c.eggcups cups-2.2.5/scheduler/subsc else if (event & CUPSD_EVENT_JOB_CREATED) what = "JobQueuedLocal"; else if ((event & CUPSD_EVENT_JOB_STATE) && job && - job->state_value == IPP_JOB_PROCESSING) + job->state_value == IPP_JOB_PROCESSING) what = "JobStartedLocal"; + else if (event & (CUPSD_EVENT_PRINTER_CHANGED|CUPSD_EVENT_JOB_STATE_CHANGED|CUPSD_EVENT_PRINTER_STATE_CHANGED)) + what = "QueueChanged"; else return; -@@ -1333,7 +1333,7 @@ cupsd_send_dbus(cupsd_eventmask_t event, +@@ -1299,7 +1299,7 @@ cupsd_send_dbus(cupsd_eventmask_t event, dbus_message_append_iter_init(message, &iter); if (dest) dbus_message_iter_append_string(&iter, dest->name); diff --git a/cups-epson-A6-crash.patch b/cups-epson-A6-crash.patch deleted file mode 100644 index e8813b1c2957d2f674f187c2d7c20a390986140a..0000000000000000000000000000000000000000 --- a/cups-epson-A6-crash.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/filter/rastertoepson.c b/filter/rastertoepson.c -index 73e8d0600..4522e6b48 100644 ---- a/filter/rastertoepson.c -+++ b/filter/rastertoepson.c -@@ -301,7 +302,7 @@ StartPage( - - if (DotBytes) - { -- if ((LineBuffers[0] = calloc((size_t)DotBytes, header->cupsWidth * (size_t)(Shingling + 1))) == NULL) -+ if ((LineBuffers[0] = calloc((size_t)DotBytes, (header->cupsWidth + 7) * (size_t)(Shingling + 1))) == NULL) - { - fputs("ERROR: Unable to allocate memory\n", stderr); - exit(1); diff --git a/cups-etimedout.patch b/cups-etimedout.patch new file mode 100644 index 0000000000000000000000000000000000000000..31defda0eb4d0f1803cc92446f398a570bde2113 --- /dev/null +++ b/cups-etimedout.patch @@ -0,0 +1,25 @@ +diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c +index e4ffc3d..a989055 100644 +--- a/cups/http-addrlist.c ++++ b/cups/http-addrlist.c +@@ -240,7 +240,10 @@ httpAddrConnect2( + } + + if (!addrlist && nfds == 0) ++ { ++ errno = EHOSTDOWN; + break; ++ } + + /* + * See if we can connect to any of the addresses so far... +@@ -371,6 +374,9 @@ httpAddrConnect2( + remaining -= 250; + } + ++ if (remaining <= 0) ++ errno = ETIMEDOUT; ++ + while (nfds > 0) + { + nfds --; diff --git a/cups-failover-backend.patch b/cups-failover-backend.patch new file mode 100644 index 0000000000000000000000000000000000000000..1bcf6276ba8b56e29b16561db15c8137cfbb1d5e --- /dev/null +++ b/cups-failover-backend.patch @@ -0,0 +1,876 @@ +diff -up cups-2.3.3/backend/failover.c.failover cups-2.3.3/backend/failover.c +--- cups-2.3.3/backend/failover.c.failover 2020-06-11 08:49:20.515264358 +0200 ++++ cups-2.3.3/backend/failover.c 2020-06-11 08:49:20.515264358 +0200 +@@ -0,0 +1,837 @@ ++/* ++ * Failover Backend for the Common UNIX Printing System (CUPS). ++ * ++ * Copyright (c) 2014, Red Hat, Inc. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * * Neither the name of Red Hat, Inc. nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT, ++ * INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY ++ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ++ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ++ * DAMAGE. ++ * ++ * Original version by Clark Hale, Red Hat, Inc. ++ * ++ * This backend presents a fake printer that will choose the first ++ * available printer from a list of IPP URIs. ++ * ++ * Option failover contains a comma separated list of IPP URIs. The ++ * URIs are attempted in-order. ++ * ++ * Option failover-retries contains an integer that indicates how many ++ * times to iterate through the failover list before completely ++ * failing. ++ * ++ * Contents: ++ * main() - Checks each printer in a failover list, and ++ * sends job data to the first available printer ++ * move_job() - Sends and IPP Move-Job request ++ * check_printer() - Checks a printer's attributes to see ++ * if it's enabled and accepting jobs ++ * read_config() - Read the backends configuration from ++ * options ++ * get_printer_attributes() - Sends an IPP Get-Attributes request to ++ * a URI ++ * sigterm_handler() - Handle SIGTERM that cancels the job ++ * password_cb() - Password call back used to disable password ++ * prompt ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include "backend-private.h" ++ ++/* ++ * Return Values ++ */ ++typedef enum fo_state_e ++{ ++ FO_PRINTER_GOOD = 0, ++ FO_PRINTER_BAD, ++ FO_PRINTER_BUSY, ++ FO_AUTH_REQUIRED ++} fo_state_t; ++ ++/* ++ * Constants ++ */ ++#define FAILOVER_DEFAULT_RETRIES (3) ++#define FAILOVER_PASSWORD_RETRIES_MAX (3) ++ ++/* ++ * Local Functions ++ */ ++static int check_printer(const char *device_uri); ++static int read_config(cups_array_t *printer_array, int *retries, ++ const char *options); ++static int get_printer_attributes(const char *device_uri, ++ ipp_t **attributes); ++static int move_job(int jobid, const char *dest); ++static void sigterm_handler(int sig); ++static const char *password_cb(const char *); ++ ++/* ++ * Global Variables ++ */ ++static int job_canceled = 0; /* Job canceled */ ++static char *password = NULL; /* password for device */ ++static int password_retries = 0; ++static const char *auth_info_required = "none"; ++ ++/* ++ * 'main()' - Checks each printer in a failover list, and ++ * sends job data to the first available printer ++ * Usage: ++ * printer-uri job-id user title copies options [file] ++ * ++ * The printer-uri option is not used, but it still required to fit ++ * to the backend(7) standards. ++ */ ++int ++main(int argc, char *argv[]) ++{ ++ const char *selected_uri = NULL; /* URI of selected printer */ ++ const char *tmp_device_uri; /* Device URI to check */ ++ cups_array_t *printer_array; /* Array of available printers */ ++ int printer_count = 0; /* current printer array index */ ++ int retry_max = 1; /* maximum retries before exit */ ++ int retry_count = 0; /* current retry number */ ++ int auth_failed_count = 0; /* auth failures per loop */ ++ int rc = CUPS_BACKEND_OK; ++#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) ++ struct sigaction action; /* Actions for POSIX signals */ ++#endif /* HAVE_SIGACTION && !HAVE_SIGSET */ ++ ++ /* ++ * Check args ++ */ ++ if (argc == 1) ++ { ++ /* ++ * print out discovery data ++ */ ++ char *backendName; ++ ++ if ((backendName = strrchr(argv[0], '/')) != NULL) ++ backendName++; ++ else ++ backendName = argv[0]; ++ ++ _cupsLangPrintf(stderr,"network %s \"Unknown\" \"%s (%s)\"\n", ++ backendName, ++ _cupsLangString(cupsLangDefault(), _("Failover Printer")), ++ backendName); ++ ++ return (CUPS_BACKEND_OK); ++ } ++ else if (argc < 6) ++ { ++ _cupsLangPrintf(stderr, ++ _("Usage: %s job-id user title copies options [file]"), ++ argv[0]); ++ return (CUPS_BACKEND_STOP); ++ } ++ ++ fprintf(stderr, "DEBUG: Failover backend starting up.\n"); ++ ++ /* ++ * Don't buffer status messages ++ */ ++ setbuf(stderr, NULL); ++ ++ /* ++ * Ignore SIGPIPE and catch SIGTERM signals... ++ */ ++#ifdef HAVE_SIGSET ++ sigset(SIGPIPE, SIG_IGN); ++ sigset(SIGTERM, sigterm_handler); ++#elif defined(HAVE_SIGACTION) ++ memset(&action, 0, sizeof(action)); ++ action.sa_handler = SIG_IGN; ++ sigaction(SIGPIPE, &action, NULL); ++ ++ sigemptyset(&action.sa_mask); ++ sigaddset(&action.sa_mask, SIGTERM); ++ action.sa_handler = sigterm_handler; ++ sigaction(SIGTERM, &action, NULL); ++#else ++ signal(SIGPIPE, SIG_IGN); ++ signal(SIGTERM, sigterm_handler); ++#endif /* HAVE_SIGSET */ ++ ++ printer_array = cupsArrayNew(NULL, NULL); ++ ++ /* ++ * Read Configuration ++ */ ++ if ((rc = read_config(printer_array, &retry_max, ++ argv[5])) != CUPS_BACKEND_OK) ++ { ++ fprintf(stderr, "ERROR: Failed to read configuration options!\n"); ++ goto cleanup; ++ } ++ ++ /* ++ * Main Retry Loop ++ */ ++ for (retry_count = 0; retry_count < retry_max; retry_count++) ++ { ++ fprintf(stderr, "DEBUG: Retry loop #%d\n", retry_count + 1); ++ ++ /* ++ * Reset Counters ++ */ ++ printer_count = 0; ++ auth_failed_count = 0; ++ ++ tmp_device_uri = (char *)cupsArrayFirst(printer_array); ++ ++ do ++ { ++ if (job_canceled) ++ { ++ fprintf(stderr, "DEBUG: Job Canceled\n"); ++ goto cleanup; ++ } ++ ++ fprintf(stderr,"DEBUG: Checking printer #%d: %s\n", ++ printer_count+1, tmp_device_uri); ++ ++ rc = check_printer(tmp_device_uri); ++ ++ // Printer is available and not busy. ++ if ( rc == FO_PRINTER_GOOD ) ++ { ++ selected_uri = tmp_device_uri; ++ break; ++ } ++ // Printer is busy ++ else if (rc == FO_PRINTER_BUSY) ++ { ++ fprintf(stderr, "DEBUG: Waiting for job to complete.\n"); ++ sleep(2); ++ continue; ++ } ++ // Authorization is required to access the printer. ++ else if (rc == FO_AUTH_REQUIRED) ++ { ++ auth_failed_count++; ++ fprintf(stderr, "DEBUG: auth_failed_count = %d\n", auth_failed_count); ++ } ++ // Printer is stopped or not accepting jobs ++ else ++ { ++ if (!printer_count) ++ fprintf(stderr, "INFO: Primary Printer, %s, not available. " ++ "Attempting Failovers...\n", ++ tmp_device_uri); ++ else ++ fprintf(stderr, "INFO: Failover Printer, %s, not available. " ++ "Attempting Failovers..\n", ++ tmp_device_uri); ++ printer_count++; ++ tmp_device_uri = (char *)cupsArrayNext(printer_array); ++ } ++ } while (tmp_device_uri != NULL); ++ ++ if (selected_uri && !printer_count) ++ fprintf(stderr, "STATE: -primary-printer-failed\n"); ++ else ++ fprintf(stderr, "STATE: +primary-printer-failed\n"); ++ ++ if (job_canceled) ++ { ++ fprintf(stderr, "DEBUG: Job Canceled\n"); ++ goto cleanup; ++ } ++ ++ if (!selected_uri && auth_failed_count == printer_count) ++ { ++ fprintf(stderr, "ERROR: All failover printers failed with " ++ "authorization issues.\n"); ++ rc = CUPS_BACKEND_AUTH_REQUIRED; ++ fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required); ++ goto cleanup; ++ } ++ else if (!selected_uri && retry_count + 1 < retry_max) ++ { ++ fprintf(stderr, "INFO: No suitable printer found...retrying...\n"); ++ sleep(2); ++ continue; ++ } ++ else if (selected_uri) ++ { ++ fprintf(stderr, "DEBUG: Using printer, %s.\n", selected_uri); ++ break; ++ } ++ } ++ ++ if (!selected_uri) ++ { ++ fprintf(stderr, "ERROR: No suitable printer found. Aborting print\n"); ++ rc = CUPS_BACKEND_FAILED; ++ goto cleanup; ++ } ++ ++ rc = move_job(atoi(argv[1]), selected_uri); ++ ++ if (job_canceled) ++ rc = CUPS_BACKEND_OK; ++ ++cleanup : ++ if (job_canceled) ++ rc = CUPS_BACKEND_OK; ++ ++ tmp_device_uri = (char *)cupsArrayFirst(printer_array); ++ do ++ { ++ free((void *)tmp_device_uri); ++ } while ((tmp_device_uri = (char *)cupsArrayNext(printer_array)) != NULL); ++ ++ cupsArrayDelete(printer_array); ++ sleep(2); ++ return (rc); ++} ++ ++/* ++ * 'check_printer()' - Checks the status of a remote printer and returns ++ * back a good/bad/busy status. ++ */ ++int ++check_printer(const char *device_uri) ++{ ++ ipp_t *attributes = NULL; /* attributes for device_uri */ ++ ipp_attribute_t *tmp_attribute; /* for examining attribs */ ++ int rc = FO_PRINTER_GOOD; /* return code */ ++ char *reason; /* printer state reason */ ++ int i; ++ ++ fprintf(stderr, "DEBUG: Checking printer %s\n",device_uri); ++ ++ rc = get_printer_attributes(device_uri, &attributes); ++ if ( rc != CUPS_BACKEND_OK ) ++ { ++ fprintf(stderr, "DEBUG: Failed to get attributes from printer: %s\n", ++ device_uri); ++ if ( rc == CUPS_BACKEND_AUTH_REQUIRED ) ++ return (FO_AUTH_REQUIRED); ++ else ++ return (FO_PRINTER_BAD); ++ } ++ ++ /* ++ * Check if printer is accepting jobs ++ */ ++ if ((tmp_attribute = ippFindAttribute(attributes, ++ "printer-is-accepting-jobs", ++ IPP_TAG_BOOLEAN)) != NULL && ++ !tmp_attribute->values[0].boolean) ++ { ++ fprintf(stderr, ++ "DEBUG: Printer, %s, is not accepting jobs.\n", ++ device_uri); ++ ++ rc = FO_PRINTER_BAD; ++ } ++ ++ /* ++ * Check if printer is stopped or busy processing ++ */ ++ if ((tmp_attribute = ippFindAttribute(attributes, ++ "printer-state", ++ IPP_TAG_ENUM)) != NULL) ++ { ++ // Printer Stopped ++ if ( tmp_attribute->values[0].integer == IPP_PRINTER_STOPPED ) ++ { ++ fprintf(stderr, "DEBUG: Printer, %s, stopped.\n", device_uri); ++ rc = FO_PRINTER_BAD; ++ } ++ // Printer Busy ++ else if ( tmp_attribute->values[0].integer == IPP_PRINTER_PROCESSING ) ++ { ++ fprintf(stderr, "DEBUG: Printer %s is busy.\n", device_uri); ++ rc = FO_PRINTER_BUSY; ++ } ++ } ++ ++ /* ++ * Parse through the printer-state-reasons ++ */ ++ if ((tmp_attribute = ippFindAttribute(attributes, "printer-state-reasons", ++ IPP_TAG_KEYWORD)) != NULL) ++ { ++ for (i = 0; i < tmp_attribute->num_values; i++) ++ { ++ reason = tmp_attribute->values[i].string.text; ++ int len = strlen(reason); ++ ++ if (len > 8 && !strcmp(reason + len - 8, "-warning")) ++ { ++ fprintf(stderr, "DEBUG: Printer Supply Warning, %s\n", reason); ++ rc = FO_PRINTER_BAD; ++ } ++ else if (len > 6 && !strcmp(reason + len - 6, "-error")) ++ { ++ fprintf(stderr, "DEBUG: Printer Supply Error, %s\n", reason); ++ rc = FO_PRINTER_BAD; ++ } ++ } ++ } ++ ++ return (rc); ++} ++ ++/* ++ * 'read_config()' - Parses the failover and failover-retries options ++ * ++ */ ++static int ++read_config(cups_array_t *printer_array, int *retries, const char *options) ++{ ++ ++ const char *tmp; /* temporary ptr */ ++ char *tok_tmp; /* temporary ptr for option parsing */ ++ int jobopts_count = 0; /* number of options */ ++ cups_option_t *jobopts = NULL; /* job options */ ++ ++ ++ fprintf(stderr, "DEBUG: Reading Configuration.\n"); ++ jobopts_count = cupsParseOptions(options, 0, &jobopts); ++ ++ if (!jobopts_count) ++ { ++ fprintf(stderr, ++ "ERROR: No job options! Cannot find failover options!\n"); ++ return (CUPS_BACKEND_STOP); ++ } ++ ++ /* ++ * Get attributes from the primary printer ++ */ ++ fprintf(stderr, "DEBUG: Searching for failover option.\n"); ++ ++ if ((tmp = cupsGetOption("failover", jobopts_count, jobopts)) != NULL) ++ { ++ fprintf(stderr, "DEBUG: Failover option contents: %s.\n", tmp); ++ ++ tok_tmp = strdup(tmp); ++ ++ tmp = strtok(tok_tmp, ","); ++ do ++ { ++ cupsArrayAdd(printer_array, strdup(tmp)); ++ } while ((tmp = strtok(NULL,",")) != NULL); ++ ++ free(tok_tmp); ++ } ++ else ++ { ++ /* ++ * The queue is misconfigured, so return back CUPS_BACKEND_STOP ++ */ ++ fprintf(stderr, "ERROR: failover option not specified!\n"); ++ return (CUPS_BACKEND_STOP); ++ } ++ ++ /* ++ * Get the failover-retries value, if it exists. ++ */ ++ fprintf(stderr, "DEBUG: Searching for failover-retries option.\n"); ++ ++ if ((tmp = cupsGetOption("failover-retries", ++ jobopts_count, jobopts)) != NULL) ++ { ++ fprintf(stderr, "DEBUG: failover-retries option contents: %s.\n", tmp); ++ *retries = atoi(tmp); ++ } ++ else ++ { ++ *retries = FAILOVER_DEFAULT_RETRIES; ++ fprintf(stderr, "DEBUG: Failed to get failover-retries option\n"); ++ fprintf(stderr, "DEBUG: Defaulted to %d retries\n", *retries); ++ } ++ ++ return (CUPS_BACKEND_OK); ++} ++ ++/* ++ * 'get_printer_attributes()' - Sends an IPP Get-Attributes request to ++ * a URI ++ */ ++int ++get_printer_attributes(const char *device_uri, ipp_t **attributes) ++{ ++ char uri[HTTP_MAX_URI]; /* Updated URI without login */ ++ int version; /* IPP version */ ++ char scheme[256]; /* Scheme in URI */ ++ ipp_status_t ipp_status; /* Status of IPP request */ ++ char hostname[1024]; /* Hostname */ ++ char resource[1024]; /* Resource infoo */ ++ char addrname[256]; /* Address name */ ++ int port; /* IPP Port number */ ++ char portname[255]; /* Port as string */ ++ http_t *http; /* HTTP connection */ ++ ipp_t *request; /* IPP request */ ++ int rc = CUPS_BACKEND_OK; /* Return Code */ ++ char username[256]; /* Username for device URI */ ++ char *option_ptr; /* for parsing resource opts */ ++ const char * const pattrs[] = /* Printer attributes wanted */ ++ { ++ "printer-is-accepting-jobs", ++ "printer-state", ++ "printer-state-reasons" ++ }; ++ ++ if (job_canceled) ++ return (CUPS_BACKEND_OK); ++ ++ fprintf(stderr, "DEBUG: Getting Printer Attributes.\n"); ++ fprintf(stderr, "DEBUG: Device URL %s.\n", device_uri); ++ ++ /* ++ * Parse device_uri ++ */ ++ if (httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme), ++ username, sizeof(username), hostname, sizeof(hostname), ++ &port, resource, sizeof(resource)) != HTTP_URI_OK) ++ { ++ fprintf(stderr, "ERROR: Problem parsing device_uri, %s\n", device_uri); ++ return (CUPS_BACKEND_STOP); ++ } ++ ++ if (!port) ++ port = IPP_PORT; ++ ++ sprintf(portname, "%d", port); ++ ++ fprintf(stderr, "DEBUG: Getting Printer Attributes.\n"); ++ ++ /* ++ * Configure password ++ */ ++ cupsSetPasswordCB(password_cb); ++ ++ /* ++ * reset, in case a previous attempt for ++ * another printer left residue ++ */ ++ cupsSetUser(NULL); ++ password = NULL; ++ password_retries = 0; ++ ++ if (*username) ++ { ++ if ((password = strchr(username, ':')) != NULL) ++ { ++ *password = '\0'; ++ password++; ++ } ++ ++ cupsSetUser(username); ++ } ++ else if (!getuid()) ++ { ++ const char *username_env; ++ ++ if ((username_env = getenv("AUTH_USERNAME")) != NULL) ++ { ++ cupsSetUser(username_env); ++ password = getenv("AUTH_PASSWORD"); ++ } ++ } ++ ++ /* ++ * Try connecting to the remote server... ++ */ ++ fprintf(stderr, "DEBUG: Connecting to %s:%d\n", hostname, port); ++ _cupsLangPuts(stderr, _("INFO: Connecting to printer...\n")); ++ ++ http = httpConnectEncrypt(hostname, port, cupsEncryption()); ++ ++ /* ++ * Deal the socket not being open. ++ */ ++ if (!http) ++ { ++ int error = errno; /* Connection error */ ++ ++ switch (error) ++ { ++ case EHOSTDOWN : ++ _cupsLangPuts(stderr, _("WARNING: " ++ "The printer may not exist or " ++ "is unavailable at this time.\n")); ++ break; ++ case EHOSTUNREACH : ++ _cupsLangPuts(stderr, _("WARNING: " ++ "The printer is unreachable at this " ++ "time.\n")); ++ break; ++ case ECONNREFUSED : ++ _cupsLangPuts(stderr, _("WARNING: " ++ "Connection Refused.\n")); ++ break; ++ default : ++ fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(errno)); ++ break; ++ } ++ ++ rc = CUPS_BACKEND_FAILED; ++ sleep(5); ++ goto prt_available_cleanup; ++ } ++ ++ ++#ifdef AF_INET6 ++ if (http->hostaddr->addr.sa_family == AF_INET6) ++ fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6)...\n", ++ httpAddrString(http->hostaddr, addrname, sizeof(addrname)), ++ ntohs(http->hostaddr->ipv6.sin6_port)); ++ else ++#endif /* AF_INET6 */ ++ if (http->hostaddr->addr.sa_family == AF_INET) ++ fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4)...\n", ++ httpAddrString(http->hostaddr, addrname, sizeof(addrname)), ++ ntohs(http->hostaddr->ipv4.sin_port)); ++ ++ /* ++ * Search the resource string for options. ++ * We only care about version, for the moment. ++ */ ++ version = 11; ++ ++ if ((option_ptr = strchr(resource, '?')) != NULL) ++ { ++ *option_ptr++ = '\0'; ++ ++ if ((option_ptr = strstr(option_ptr, "version="))!=NULL) ++ { ++ int minor; /* minor version from URI */ ++ int major; /* major version from URI */ ++ char *version_str; /* ipp version */ ++ ++ option_ptr += 8; ++ version_str = option_ptr; ++ ++ while (*option_ptr && *option_ptr != '&' && *option_ptr != '+') ++ option_ptr++; ++ ++ if (*option_ptr) ++ *option_ptr = '\0'; ++ ++ sscanf(version_str, "%d.%d", &major, &minor); ++ ++ version = (major * 10) + minor; ++ ++ switch(version) ++ { ++ case 10 : ++ case 11 : ++ case 20 : ++ case 21 : ++ fprintf(stderr, ++ "DEBUG: Set version to %d from URI\n", ++ version); ++ break; ++ default : ++ _cupsLangPrintf(stderr, ++ _("DEBUG: Invalid version, %d, from URI. " ++ "Using default of 1.1 \n"), ++ version); ++ version = 11; ++ } ++ } ++ } ++ ++ ++ /* ++ * Build a URI for the printer. We can't use the URI in argv[0] ++ * because it might contain username:password information... ++ */ ++ if (httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), scheme, NULL, ++ hostname, port, resource) != HTTP_URI_OK) ++ { ++ fprintf(stderr, "ERROR: Problem assembling printer URI from host %s, " ++ "port %d, resource %s\n", hostname, port, resource); ++ return (CUPS_BACKEND_STOP); ++ } ++ ++ /* ++ * Build the IPP request... ++ */ ++ request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); ++ request->request.op.version[0] = version / 10; ++ request->request.op.version[1] = version % 10; ++ ++ 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); ++ ++ /* ++ * Do the request... ++ */ ++ fputs("DEBUG: Getting supported attributes...\n", stderr); ++ ++ fprintf(stderr, "DEBUG: IPP Request Structure Built.\n"); ++ ++ *attributes = cupsDoRequest(http, request, resource); ++ ipp_status = cupsLastError(); ++ ++ fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n", ++ ippErrorString(ipp_status), cupsLastErrorString()); ++ ++ if (ipp_status > IPP_OK_CONFLICT) ++ { ++ fprintf(stderr, "DEBUG: Get-Printer-Attributes returned %s.\n", ++ ippErrorString(ipp_status)); ++ switch(ipp_status) ++ { ++ case IPP_FORBIDDEN : ++ case IPP_NOT_AUTHORIZED : ++ _cupsLangPuts(stderr, _("ERROR: Not Authorized.\n")); ++ rc = CUPS_BACKEND_AUTH_REQUIRED; ++ break; ++ case IPP_PRINTER_BUSY : ++ case IPP_SERVICE_UNAVAILABLE : ++ _cupsLangPuts(stderr, _("ERROR: " ++ "The printer is not responding.\n")); ++ rc = CUPS_BACKEND_FAILED; ++ break; ++ case IPP_BAD_REQUEST : ++ case IPP_VERSION_NOT_SUPPORTED : ++ fprintf(stderr, "ERROR: Destination does not support IPP version %d\n", ++ version); ++ case IPP_NOT_FOUND : ++ _cupsLangPuts(stderr, _("ERROR: " ++ "The printer configuration is incorrect or the " ++ "printer no longer exists.\n")); ++ rc = CUPS_BACKEND_STOP; ++ break; ++ default : ++ rc = CUPS_BACKEND_FAILED; ++ } ++ goto prt_available_cleanup; ++ } ++ ++prt_available_cleanup : ++ httpClose(http); ++ return (rc); ++} ++ ++static int ++move_job(int jobid, /* Job ID */ ++ const char *dest) /* Destination ipp address */ ++{ ++ ipp_t *request; /* IPP Request */ ++ char job_uri[HTTP_MAX_URI]; /* job-uri */ ++ ++ http_t* http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption()); ++ ++ if (!http) ++ { ++ _cupsLangPrintf(stderr, ++ _("failover: Unable to connect to server: %s\n"), ++ strerror(errno)); ++ return (CUPS_BACKEND_FAILED); ++ } ++ ++ /* ++ * Build a CUPS_MOVE_JOB request, which requires the following ++ * attributes: ++ * ++ * job-uri/printer-uri ++ * job-printer-uri ++ * requesting-user-name ++ */ ++ ++ request = ippNewRequest(CUPS_MOVE_JOB); ++ ++ snprintf(job_uri, sizeof(job_uri), "ipp://localhost/jobs/%d", jobid); ++ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, ++ job_uri); ++ ++ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, ++ "requesting-user-name", ++ NULL, cupsUser()); ++ ++ ippAddString(request, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", ++ NULL, dest); ++ ++ /* ++ * Do the request and get back a response... ++ */ ++ ++ ippDelete(cupsDoRequest(http, request, "/jobs")); ++ ++ httpClose(http); ++ ++ if (cupsLastError() > IPP_OK_CONFLICT) ++ { ++ _cupsLangPrintf(stderr, "failover: %s\n", cupsLastErrorString()); ++ return (CUPS_BACKEND_FAILED); ++ } ++ else ++ return (CUPS_BACKEND_OK); ++} ++ ++/* ++ * 'sigterm_handler()' - handles a sigterm, i.e. job canceled ++ */ ++static void ++sigterm_handler(int sig) ++{ ++ if (!job_canceled) ++ { ++ write(2, "DEBUG: Got SIGTERM.\n", 20); ++ job_canceled = 1; ++ } ++ else ++ { ++ /* ++ * Job has already been canceled, so just exit ++ */ ++ exit(1); ++ } ++} ++ ++/* ++ * 'password_cb()' - Disable the password prompt for cupsDoFileRequest(). ++ */ ++static const char * /* O - Password */ ++password_cb(const char *prompt) /* I - Prompt (not used) */ ++{ ++ auth_info_required = "username,password"; ++ password_retries++; ++ ++ if(password_retries < FAILOVER_PASSWORD_RETRIES_MAX) ++ return (password); ++ else ++ return (NULL); ++} +diff -up cups-2.3.3/backend/Makefile.failover cups-2.3.3/backend/Makefile +--- cups-2.3.3/backend/Makefile.failover 2020-04-27 20:04:29.000000000 +0200 ++++ cups-2.3.3/backend/Makefile 2020-06-11 08:52:31.212642019 +0200 +@@ -22,6 +22,7 @@ include ../Makedefs + RBACKENDS = \ + ipp \ + lpd \ ++ failover \ + $(DNSSD_BACKEND) + UBACKENDS = \ + snmp \ +@@ -45,6 +46,7 @@ LIBOBJS = \ + OBJS = \ + ipp.o \ + lpd.o \ ++ failover.o \ + dnssd.o \ + snmp.o \ + socket.o \ +@@ -276,6 +278,15 @@ lpd: lpd.o ../cups/$(LIBCUPS) libbackend + + + # ++# failover ++# ++ ++failover: failover.o ../cups/$(LIBCUPS) libbackend.a ++ echo Linking $@... ++ $(LD_CC) $(ALL_LDFLAGS) -o failover failover.o libbackend.a $(LINKCUPS) ++ ++ ++# + # snmp + # + diff --git a/cups-ippeve-webui.patch b/cups-ippeve-webui.patch deleted file mode 100644 index 049d6b9792afe74c6c1859dadcd7fba9f2f66d90..0000000000000000000000000000000000000000 --- a/cups-ippeve-webui.patch +++ /dev/null @@ -1,124 +0,0 @@ -diff --git a/backend/dnssd.c b/backend/dnssd.c -index 34781d5ce..7074f4294 100644 ---- a/backend/dnssd.c -+++ b/backend/dnssd.c -@@ -1252,6 +1252,13 @@ query_callback( - strlcat(make_and_model, " ", sizeof(make_and_model)); - strlcat(make_and_model, model, sizeof(make_and_model)); - -+ if (!_cups_strncasecmp(make_and_model, "EPSON EPSON ", 12)) -+ _cups_strcpy(make_and_model, make_and_model + 6); -+ else if (!_cups_strncasecmp(make_and_model, "HP HP ", 6)) -+ _cups_strcpy(make_and_model, make_and_model + 3); -+ else if (!_cups_strncasecmp(make_and_model, "Lexmark International Lexmark ", 30)) -+ _cups_strcpy(make_and_model, make_and_model + 22); -+ - device->make_and_model = strdup(make_and_model); - } - else -diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c -index f788083fb..a3b5057b0 100644 ---- a/cgi-bin/admin.c -+++ b/cgi-bin/admin.c -@@ -928,6 +929,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")) - { - /* -@@ -1076,6 +1079,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */ - 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(); - } -diff --git a/templates/choose-model.tmpl b/templates/choose-model.tmpl -index ee9338cc5..d72534236 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 cb9b6f3bc..a08a8e3e0 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 8a5a4ba90..74f0a9bb9 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 1e154f18a..3038b3fe3 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 daf1375fd..b3c286b11 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 55d8bd8d5..a5939ee9c 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 2f0d6d9ba..86507814d 100644 ---- a/templates/ru/choose-model.tmpl -+++ b/templates/ru/choose-model.tmpl -@@ -39,6 +39,7 @@ - - - diff --git a/cups-ipptool-mdns-uri.patch b/cups-ipptool-mdns-uri.patch new file mode 100644 index 0000000000000000000000000000000000000000..6919e96e4411c1a8d3dd8a869931a3397673cdbc --- /dev/null +++ b/cups-ipptool-mdns-uri.patch @@ -0,0 +1,43 @@ +diff --git a/cups/ipp-vars.c b/cups/ipp-vars.c +index 395b0eb..60aa991 100644 +--- a/cups/ipp-vars.c ++++ b/cups/ipp-vars.c +@@ -13,6 +13,7 @@ + */ + + #include ++#include + #include "ipp-private.h" + #include "string-private.h" + #include "debug-internal.h" +@@ -221,9 +222,29 @@ _ippVarsSet(_ipp_vars_t *v, /* I - IPP variables */ + if (!strcmp(name, "uri")) + { + char uri[1024]; /* New printer URI */ ++ char resolved[1024]; /* Resolved mDNS URI */ ++ char value_uri[1024]; /* URI from value */ + http_uri_status_t uri_status; /* URI status */ + +- if ((uri_status = httpSeparateURI(HTTP_URI_CODING_ALL, value, v->scheme, sizeof(v->scheme), v->username, sizeof(v->username), v->host, sizeof(v->host), &(v->port), v->resource, sizeof(v->resource))) < HTTP_URI_STATUS_OK) ++ snprintf(value_uri, sizeof(value_uri), "%s", value); ++ value_uri[1023] = '\0'; ++ ++ if (strstr(value_uri, "._tcp")) ++ { ++ /* ++ * Resolve URI... ++ */ ++ ++ if (!_httpResolveURI(value_uri, resolved, sizeof(resolved), _HTTP_RESOLVE_DEFAULT, NULL, NULL)) ++ { ++ return (0); ++ } ++ ++ snprintf(value_uri, sizeof(value_uri), "%s", resolved); ++ value_uri[1023] = '\0'; ++ } ++ ++ if ((uri_status = httpSeparateURI(HTTP_URI_CODING_ALL, value_uri, v->scheme, sizeof(v->scheme), v->username, sizeof(v->username), v->host, sizeof(v->host), &(v->port), v->resource, sizeof(v->resource))) < HTTP_URI_STATUS_OK) + return (0); + + if (v->username[0]) diff --git a/cups-ippvalidateattr-regression.patch b/cups-ippvalidateattr-regression.patch deleted file mode 100644 index 8185bf88731c0f4979b313ba254fd5ba0ae5bc37..0000000000000000000000000000000000000000 --- a/cups-ippvalidateattr-regression.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff --git a/cups/ipp.c b/cups/ipp.c -index 95d53cc44..325de02b9 100644 ---- a/cups/ipp.c -+++ b/cups/ipp.c -@@ -5033,16 +5033,19 @@ ippValidateAttribute( - break; - } - -- if (*ptr < ' ' || *ptr == 0x7f) -- { -- ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad control character (PWG 5100.14 section 8.3)."), attr->name, attr->values[i].string.text); -- return (0); -- } -- else if (*ptr) -- { -- ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.2)."), attr->name, attr->values[i].string.text); -- return (0); -- } -+ if (*ptr) -+ { -+ if (*ptr < ' ' || *ptr == 0x7f) -+ { -+ ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad control character (PWG 5100.14 section 8.3)."), attr->name, attr->values[i].string.text); -+ return (0); -+ } -+ else -+ { -+ ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.2)."), attr->name, attr->values[i].string.text); -+ return (0); -+ } -+ } - - if ((ptr - attr->values[i].string.text) > (IPP_MAX_TEXT - 1)) - { -@@ -5091,16 +5094,19 @@ ippValidateAttribute( - break; - } - -- if (*ptr < ' ' || *ptr == 0x7f) -- { -- ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad control character (PWG 5100.14 section 8.1)."), attr->name, attr->values[i].string.text); -- return (0); -- } -- else if (*ptr) -+ if (*ptr) - { -- ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.3)."), attr->name, attr->values[i].string.text); -- return (0); -- } -+ if (*ptr < ' ' || *ptr == 0x7f) -+ { -+ ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad control character (PWG 5100.14 section 8.1)."), attr->name, attr->values[i].string.text); -+ return (0); -+ } -+ else -+ { -+ ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.3)."), attr->name, attr->values[i].string.text); -+ return (0); -+ } -+ } - - if ((ptr - attr->values[i].string.text) > (IPP_MAX_NAME - 1)) - { diff --git a/cups-logrotate.patch b/cups-logrotate.patch new file mode 100644 index 0000000000000000000000000000000000000000..6b8eb8ce5495b6777080e87ec919c7580e12358d --- /dev/null +++ b/cups-logrotate.patch @@ -0,0 +1,63 @@ +diff -up cups-2.1b1/scheduler/log.c.logrotate cups-2.1b1/scheduler/log.c +--- cups-2.1b1/scheduler/log.c.logrotate 2015-06-04 20:00:31.000000000 +0200 ++++ cups-2.1b1/scheduler/log.c 2015-06-29 13:25:09.623350218 +0200 +@@ -26,6 +26,9 @@ + # include + #endif /* HAVE_ASL_H */ + #include ++#include ++#include ++#include + + + /* +@@ -135,12 +138,10 @@ cupsdCheckLogFile(cups_file_t **lf, /* I + } + + /* +- * Format the filename as needed... ++ * Format the filename... + */ + +- if (!*lf || +- (strncmp(logname, "/dev/", 5) && cupsFileTell(*lf) > MaxLogSize && +- MaxLogSize > 0)) ++ if (strncmp(logname, "/dev/", 5)) + { + /* + * Handle format strings... +@@ -254,6 +255,34 @@ cupsdCheckLogFile(cups_file_t **lf, /* I + /* + * Change ownership and permissions of non-device logs... + */ ++ ++ fchown(cupsFileNumber(*lf), RunUser, Group); ++ fchmod(cupsFileNumber(*lf), LogFilePerm); ++ } ++ } ++ ++ /* ++ * Has someone else (i.e. logrotate) already rotated the log for us? ++ */ ++ else if (strncmp(filename, "/dev/", 5)) ++ { ++ struct stat st; ++ if (stat(filename, &st) || st.st_size == 0) ++ { ++ /* File is either missing or has zero size. */ ++ ++ cupsFileClose(*lf); ++ if ((*lf = cupsFileOpen(filename, "a")) == NULL) ++ { ++ syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename, ++ strerror(errno)); ++ ++ return (0); ++ } ++ ++ /* ++ * Change ownership and permissions of non-device logs... ++ */ + + fchown(cupsFileNumber(*lf), RunUser, Group); + fchmod(cupsFileNumber(*lf), LogFilePerm); diff --git a/cups-lpr-help.patch b/cups-lpr-help.patch deleted file mode 100644 index f025698fee1d7c4856d4bc2ca36f3fa308fab51e..0000000000000000000000000000000000000000 --- a/cups-lpr-help.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff -up cups-2.2b2/berkeley/lpr.c.lpr-help cups-2.2b2/berkeley/lpr.c ---- cups-2.2b2/berkeley/lpr.c.lpr-help 2016-06-24 17:43:35.000000000 +0200 -+++ cups-2.2b2/berkeley/lpr.c 2016-06-27 15:11:30.646348752 +0200 -@@ -18,6 +18,31 @@ - #include - - -+static void -+usage (const char *name) -+{ -+ _cupsLangPrintf(stdout, -+"Usage: %s [OPTION] [ file(s) ]\n" -+"Print files.\n\n" -+" -E force encryption\n" -+" -H server[:port] specify alternate server\n" -+" -C title, -J title, -T title\n" -+" set the job name\n\n" -+" -P destination/instance print to named printer\n" -+" -U username specify alternate username\n" -+" -# num-copies set number of copies\n" -+" -h disable banner printing\n" -+" -l print without filtering\n" -+" -m send email on completion\n" -+" -o option[=value] set a job option\n" -+" -p format text file with header\n" -+" -q hold job for printing\n" -+" -r delete files after printing\n" -+"\nWith no file given, read standard input.\n" -+, name); -+} -+ -+ - /* - * 'main()' - Parse options and send files for printing. - */ -@@ -281,6 +306,12 @@ main(int argc, /* I - Number of comm - break; - - default : -+ if (!strcmp (argv[i], "--help")) -+ { -+ usage (argv[0]); -+ return (0); -+ } -+ - _cupsLangPrintf(stderr, _("%s: Error - unknown option \"%c\"."), argv[0], *opt); - return (1); - } diff --git a/cups-lspp.patch b/cups-lspp.patch index 667cda196d3a6b6cc26e1cb10eecb30a75aefa5a..7c094d210e453316157b3ce8c2d0ddf9709c856f 100644 --- a/cups-lspp.patch +++ b/cups-lspp.patch @@ -1,7 +1,7 @@ -diff -up cups-2.2.8/config.h.in.lspp cups-2.2.8/config.h.in ---- cups-2.2.8/config.h.in.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/config.h.in 2018-06-08 17:34:38.682653959 +0200 -@@ -730,4 +730,11 @@ static __inline int _cups_abs(int i) { r +diff -up cups-2.3.0/config.h.in.lspp cups-2.3.0/config.h.in +--- cups-2.3.0/config.h.in.lspp 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/config.h.in 2019-10-07 12:24:43.058597468 +0200 +@@ -684,4 +684,11 @@ static __inline int _cups_abs(int i) { r # endif /* __GNUC__ || __STDC_VERSION__ */ #endif /* !HAVE_ABS && !abs */ @@ -13,9 +13,9 @@ diff -up cups-2.2.8/config.h.in.lspp cups-2.2.8/config.h.in + + #endif /* !_CUPS_CONFIG_H_ */ -diff -up cups-2.2.8/config-scripts/cups-lspp.m4.lspp cups-2.2.8/config-scripts/cups-lspp.m4 ---- cups-2.2.8/config-scripts/cups-lspp.m4.lspp 2018-06-08 17:34:38.682653959 +0200 -+++ cups-2.2.8/config-scripts/cups-lspp.m4 2018-06-08 17:34:38.682653959 +0200 +diff -up cups-2.3.0/config-scripts/cups-lspp.m4.lspp cups-2.3.0/config-scripts/cups-lspp.m4 +--- cups-2.3.0/config-scripts/cups-lspp.m4.lspp 2019-10-07 12:24:43.058597468 +0200 ++++ cups-2.3.0/config-scripts/cups-lspp.m4 2019-10-07 12:24:43.058597468 +0200 @@ -0,0 +1,36 @@ +dnl +dnl LSPP code for the Common UNIX Printing System (CUPS). @@ -53,22 +53,22 @@ diff -up cups-2.2.8/config-scripts/cups-lspp.m4.lspp cups-2.2.8/config-scripts/c + ;; + esac +fi -diff -up cups-2.2.8/configure.ac.lspp cups-2.2.8/configure.ac ---- cups-2.2.8/configure.ac.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/configure.ac 2018-06-08 17:34:38.682653959 +0200 -@@ -38,6 +38,8 @@ sinclude(config-scripts/cups-startup.m4) +diff -up cups-2.3.0/configure.ac.lspp cups-2.3.0/configure.ac +--- cups-2.3.0/configure.ac.lspp 2019-10-07 12:24:43.058597468 +0200 ++++ cups-2.3.0/configure.ac 2019-10-07 12:39:20.122546282 +0200 +@@ -34,6 +34,8 @@ sinclude(config-scripts/cups-dnssd.m4) + sinclude(config-scripts/cups-startup.m4) sinclude(config-scripts/cups-defaults.m4) - sinclude(config-scripts/cups-scripting.m4) +sinclude(config-scripts/cups-lspp.m4) + INSTALL_LANGUAGES="" UNINSTALL_LANGUAGES="" LANGFILES="" -diff -up cups-2.2.8/filter/common.c.lspp cups-2.2.8/filter/common.c ---- cups-2.2.8/filter/common.c.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/filter/common.c 2018-06-08 17:34:38.682653959 +0200 -@@ -17,6 +17,12 @@ +diff -up cups-2.3.0/filter/common.c.lspp cups-2.3.0/filter/common.c +--- cups-2.3.0/filter/common.c.lspp 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/filter/common.c 2019-10-07 12:24:43.059597461 +0200 +@@ -11,6 +11,12 @@ * Include necessary headers... */ @@ -81,7 +81,7 @@ diff -up cups-2.2.8/filter/common.c.lspp cups-2.2.8/filter/common.c #include "common.h" #include -@@ -299,6 +305,18 @@ WriteLabelProlog(const char *label, /* I +@@ -293,6 +299,18 @@ WriteLabelProlog(const char *label, /* I { const char *classification; /* CLASSIFICATION environment variable */ const char *ptr; /* Temporary string pointer */ @@ -100,7 +100,7 @@ diff -up cups-2.2.8/filter/common.c.lspp cups-2.2.8/filter/common.c /* -@@ -321,6 +339,124 @@ WriteLabelProlog(const char *label, /* I +@@ -315,6 +333,124 @@ WriteLabelProlog(const char *label, /* I return; } @@ -225,7 +225,7 @@ diff -up cups-2.2.8/filter/common.c.lspp cups-2.2.8/filter/common.c /* * Set the classification + page label string... */ -@@ -401,7 +537,10 @@ WriteLabelProlog(const char *label, /* I +@@ -395,7 +531,10 @@ WriteLabelProlog(const char *label, /* I printf(" %.0f moveto ESPpl show\n", top - 14.0); puts("pop"); puts("}bind put"); @@ -236,10 +236,10 @@ diff -up cups-2.2.8/filter/common.c.lspp cups-2.2.8/filter/common.c /* -diff -up cups-2.2.8/filter/pstops.c.lspp cups-2.2.8/filter/pstops.c ---- cups-2.2.8/filter/pstops.c.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/filter/pstops.c 2018-06-08 17:34:38.683653951 +0200 -@@ -3176,6 +3176,18 @@ write_label_prolog(pstops_doc_t *doc, /* +diff -up cups-2.3.0/filter/pstops.c.lspp cups-2.3.0/filter/pstops.c +--- cups-2.3.0/filter/pstops.c.lspp 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/filter/pstops.c 2019-10-07 12:24:43.059597461 +0200 +@@ -3170,6 +3170,18 @@ write_label_prolog(pstops_doc_t *doc, /* { const char *classification; /* CLASSIFICATION environment variable */ const char *ptr; /* Temporary string pointer */ @@ -258,7 +258,7 @@ diff -up cups-2.2.8/filter/pstops.c.lspp cups-2.2.8/filter/pstops.c /* -@@ -3198,6 +3210,124 @@ write_label_prolog(pstops_doc_t *doc, /* +@@ -3192,6 +3204,124 @@ write_label_prolog(pstops_doc_t *doc, /* return; } @@ -383,7 +383,7 @@ diff -up cups-2.2.8/filter/pstops.c.lspp cups-2.2.8/filter/pstops.c /* * Set the classification + page label string... */ -@@ -3276,7 +3406,10 @@ write_label_prolog(pstops_doc_t *doc, /* +@@ -3270,7 +3400,10 @@ write_label_prolog(pstops_doc_t *doc, /* doc_printf(doc, " %.0f moveto ESPpl show\n", top - 14.0); doc_puts(doc, "pop\n"); doc_puts(doc, "}bind put\n"); @@ -394,22 +394,22 @@ diff -up cups-2.2.8/filter/pstops.c.lspp cups-2.2.8/filter/pstops.c /* -diff -up cups-2.2.8/Makedefs.in.lspp cups-2.2.8/Makedefs.in ---- cups-2.2.8/Makedefs.in.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/Makedefs.in 2018-06-08 17:34:38.683653951 +0200 -@@ -161,7 +161,7 @@ LDFLAGS = -L../cgi-bin -L../cups -L../f - @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM) - LINKCUPS = @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(SSLLIBS) $(LIBZ) - LINKCUPSIMAGE = @LINKCUPSIMAGE@ --LIBS = $(LINKCUPS) $(COMMONLIBS) -+LIBS = $(LINKCUPS) $(COMMONLIBS) @LIBAUDIT@ @LIBSELINUX@ +diff -up cups-2.3.0/Makedefs.in.lspp cups-2.3.0/Makedefs.in +--- cups-2.3.0/Makedefs.in.lspp 2019-10-07 12:24:43.059597461 +0200 ++++ cups-2.3.0/Makedefs.in 2019-10-07 12:37:19.200565805 +0200 +@@ -174,7 +174,7 @@ IPPFIND_MAN = @IPPFIND_MAN@ + LDFLAGS = @LDFLAGS@ + LINKCUPS = @LINKCUPS@ + LINKCUPSSTATIC = ../cups/$(LIBCUPSSTATIC) $(LIBS) +-LIBS = $(LIBGSSAPI) $(DNSSDLIBS) $(SSLLIBS) $(LIBZ) $(COMMONLIBS) ++LIBS = $(LIBGSSAPI) $(DNSSDLIBS) $(SSLLIBS) $(LIBZ) $(COMMONLIBS) @LIBAUDIT@ @LIBSELINUX@ ONDEMANDFLAGS = @ONDEMANDFLAGS@ ONDEMANDLIBS = @ONDEMANDLIBS@ OPTIM = @OPTIM@ -diff -up cups-2.2.8/scheduler/client.c.lspp cups-2.2.8/scheduler/client.c ---- cups-2.2.8/scheduler/client.c.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/scheduler/client.c 2018-06-08 17:34:38.729653586 +0200 -@@ -22,12 +22,20 @@ +diff -up cups-2.3.0/scheduler/client.c.lspp cups-2.3.0/scheduler/client.c +--- cups-2.3.0/scheduler/client.c.lspp 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/scheduler/client.c 2019-10-07 12:33:10.459693580 +0200 +@@ -19,12 +19,20 @@ #define _HTTP_NO_PRIVATE #include "cupsd.h" @@ -430,7 +430,7 @@ diff -up cups-2.2.8/scheduler/client.c.lspp cups-2.2.8/scheduler/client.c /* -@@ -268,6 +276,59 @@ cupsdAcceptClient(cupsd_listener_t *lis) +@@ -265,6 +273,59 @@ cupsdAcceptClient(cupsd_listener_t *lis) } #endif /* HAVE_TCPD_H */ @@ -490,9 +490,9 @@ diff -up cups-2.2.8/scheduler/client.c.lspp cups-2.2.8/scheduler/client.c #ifdef AF_LOCAL if (httpAddrFamily(httpGetAddress(con->http)) == AF_LOCAL) { -@@ -562,6 +623,13 @@ cupsdReadClient(cupsd_client_t *con) /* +@@ -558,6 +619,13 @@ cupsdReadClient(cupsd_client_t *con) /* + struct stat filestats; /* File information */ mime_type_t *type; /* MIME type of file */ - cupsd_printer_t *p; /* Printer */ static unsigned request_id = 0; /* Request ID for temp files */ +#ifdef WITH_LSPP + security_context_t spoolcon; /* context of the job file */ @@ -504,7 +504,7 @@ diff -up cups-2.2.8/scheduler/client.c.lspp cups-2.2.8/scheduler/client.c status = HTTP_STATUS_CONTINUE; -@@ -1938,6 +2006,73 @@ cupsdReadClient(cupsd_client_t *con) /* +@@ -1679,6 +1747,73 @@ cupsdReadClient(cupsd_client_t *con) /* fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC); } @@ -578,7 +578,7 @@ diff -up cups-2.2.8/scheduler/client.c.lspp cups-2.2.8/scheduler/client.c if (httpGetState(con->http) != HTTP_STATE_POST_SEND) { if (!httpWait(con->http, 0)) -@@ -3485,6 +3620,49 @@ is_path_absolute(const char *path) /* I +@@ -3174,6 +3309,49 @@ is_path_absolute(const char *path) /* I return (1); } @@ -628,10 +628,10 @@ diff -up cups-2.2.8/scheduler/client.c.lspp cups-2.2.8/scheduler/client.c /* * 'pipe_command()' - Pipe the output of a command to the remote client. -diff -up cups-2.2.8/scheduler/client.h.lspp cups-2.2.8/scheduler/client.h ---- cups-2.2.8/scheduler/client.h.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/scheduler/client.h 2018-06-08 17:34:38.729653586 +0200 -@@ -16,6 +16,13 @@ +diff -up cups-2.3.0/scheduler/client.h.lspp cups-2.3.0/scheduler/client.h +--- cups-2.3.0/scheduler/client.h.lspp 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/scheduler/client.h 2019-10-07 12:24:43.113597079 +0200 +@@ -13,6 +13,13 @@ #endif /* HAVE_AUTHORIZATION_H */ @@ -645,7 +645,7 @@ diff -up cups-2.2.8/scheduler/client.h.lspp cups-2.2.8/scheduler/client.h /* * HTTP client structure... */ -@@ -66,6 +73,10 @@ struct cupsd_client_s +@@ -63,6 +70,10 @@ struct cupsd_client_s #ifdef HAVE_AUTHORIZATION_H AuthorizationRef authref; /* Authorization ref */ #endif /* HAVE_AUTHORIZATION_H */ @@ -656,7 +656,7 @@ diff -up cups-2.2.8/scheduler/client.h.lspp cups-2.2.8/scheduler/client.h }; #define HTTP(con) ((con)->http) -@@ -139,6 +150,9 @@ extern void cupsdStartListening(void); +@@ -136,6 +147,9 @@ extern void cupsdStartListening(void); extern void cupsdStopListening(void); extern void cupsdUpdateCGI(void); extern void cupsdWriteClient(cupsd_client_t *con); @@ -666,10 +666,10 @@ diff -up cups-2.2.8/scheduler/client.h.lspp cups-2.2.8/scheduler/client.h #ifdef HAVE_SSL extern int cupsdEndTLS(cupsd_client_t *con); -diff -up cups-2.2.8/scheduler/conf.c.lspp cups-2.2.8/scheduler/conf.c ---- cups-2.2.8/scheduler/conf.c.lspp 2018-06-08 17:34:38.676654007 +0200 -+++ cups-2.2.8/scheduler/conf.c 2018-06-08 17:34:38.730653578 +0200 -@@ -40,6 +40,9 @@ +diff -up cups-2.3.0/scheduler/conf.c.lspp cups-2.3.0/scheduler/conf.c +--- cups-2.3.0/scheduler/conf.c.lspp 2019-10-07 12:24:43.049597531 +0200 ++++ cups-2.3.0/scheduler/conf.c 2019-10-07 12:24:43.113597079 +0200 +@@ -37,6 +37,9 @@ # define INADDR_NONE 0xffffffff #endif /* !INADDR_NONE */ @@ -700,7 +700,7 @@ diff -up cups-2.2.8/scheduler/conf.c.lspp cups-2.2.8/scheduler/conf.c /* -@@ -863,6 +873,25 @@ cupsdReadConfiguration(void) +@@ -864,6 +874,25 @@ cupsdReadConfiguration(void) RunUser = getuid(); @@ -726,7 +726,7 @@ diff -up cups-2.2.8/scheduler/conf.c.lspp cups-2.2.8/scheduler/conf.c cupsdLogMessage(CUPSD_LOG_INFO, "Remote access is %s.", RemotePort ? "enabled" : "disabled"); -@@ -1274,7 +1303,19 @@ cupsdReadConfiguration(void) +@@ -1275,7 +1304,19 @@ cupsdReadConfiguration(void) cupsdClearString(&Classification); if (Classification) @@ -746,7 +746,7 @@ diff -up cups-2.2.8/scheduler/conf.c.lspp cups-2.2.8/scheduler/conf.c /* * Check the MaxClients setting, and then allocate memory for it... -@@ -3832,6 +3873,18 @@ read_location(cups_file_t *fp, /* I - C +@@ -3830,6 +3871,18 @@ read_location(cups_file_t *fp, /* I - C return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum); } @@ -765,10 +765,10 @@ diff -up cups-2.2.8/scheduler/conf.c.lspp cups-2.2.8/scheduler/conf.c /* * 'read_policy()' - Read a definition. -diff -up cups-2.2.8/scheduler/conf.h.lspp cups-2.2.8/scheduler/conf.h ---- cups-2.2.8/scheduler/conf.h.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/scheduler/conf.h 2018-06-08 17:34:38.730653578 +0200 -@@ -246,6 +246,13 @@ VAR char *ServerKeychain VALUE(NULL); +diff -up cups-2.3.0/scheduler/conf.h.lspp cups-2.3.0/scheduler/conf.h +--- cups-2.3.0/scheduler/conf.h.lspp 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/scheduler/conf.h 2019-10-07 12:24:43.113597079 +0200 +@@ -243,6 +243,13 @@ VAR char *ServerKeychain VALUE(NULL); /* Keychain holding cert + key */ #endif /* HAVE_SSL */ @@ -782,7 +782,7 @@ diff -up cups-2.2.8/scheduler/conf.h.lspp cups-2.2.8/scheduler/conf.h #ifdef HAVE_ONDEMAND VAR int IdleExitTimeout VALUE(60); /* Time after which an idle cupsd will exit */ -@@ -264,6 +271,9 @@ VAR int HaveServerCreds VALUE(0); +@@ -261,6 +268,9 @@ VAR int HaveServerCreds VALUE(0); VAR gss_cred_id_t ServerCreds; /* Server's GSS credentials */ #endif /* HAVE_GSSAPI */ @@ -792,11 +792,11 @@ diff -up cups-2.2.8/scheduler/conf.h.lspp cups-2.2.8/scheduler/conf.h /* * Prototypes... -diff -up cups-2.2.8/scheduler/cupsd.h.lspp cups-2.2.8/scheduler/cupsd.h ---- cups-2.2.8/scheduler/cupsd.h.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/scheduler/cupsd.h 2018-06-08 17:34:38.730653578 +0200 -@@ -11,6 +11,8 @@ - * file is missing or damaged, see the license at "http://www.cups.org/". +diff -up cups-2.3.0/scheduler/cupsd.h.lspp cups-2.3.0/scheduler/cupsd.h +--- cups-2.3.0/scheduler/cupsd.h.lspp 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/scheduler/cupsd.h 2019-10-07 12:31:38.458480578 +0200 +@@ -8,6 +8,8 @@ + * information. */ +/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */ @@ -804,9 +804,9 @@ diff -up cups-2.2.8/scheduler/cupsd.h.lspp cups-2.2.8/scheduler/cupsd.h /* * Include necessary headers. -@@ -36,13 +38,20 @@ +@@ -33,6 +35,14 @@ # include - #endif /* WIN32 */ + #endif /* _WIN32 */ +#include "config.h" +#ifdef WITH_LSPP @@ -819,18 +819,11 @@ diff -up cups-2.2.8/scheduler/cupsd.h.lspp cups-2.2.8/scheduler/cupsd.h #include "mime.h" #if defined(HAVE_CDSASSL) - # include - #endif /* HAVE_CDSASSL */ - -- - /* - * Some OS's don't have hstrerror(), most notably Solaris... - */ -diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c ---- cups-2.2.8/scheduler/ipp.c.lspp 2018-06-08 17:34:38.652654197 +0200 -+++ cups-2.2.8/scheduler/ipp.c 2018-06-08 17:37:19.166378937 +0200 -@@ -14,6 +14,9 @@ - * missing or damaged, see the license at "http://www.cups.org/". +diff -up cups-2.3.0/scheduler/ipp.c.lspp cups-2.3.0/scheduler/ipp.c +--- cups-2.3.0/scheduler/ipp.c.lspp 2019-10-07 12:24:43.016597764 +0200 ++++ cups-2.3.0/scheduler/ipp.c 2019-10-07 12:31:01.243798920 +0200 +@@ -11,6 +11,9 @@ + * information. */ +/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */ @@ -839,8 +832,8 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c /* * Include necessary headers... */ -@@ -37,6 +40,14 @@ extern int mbr_check_membership_by_id(uu - # endif /* HAVE_MEMBERSHIPPRIV_H */ +@@ -27,6 +30,14 @@ extern int mbr_group_name_to_uuid(const + extern int mbr_check_membership_by_id(uuid_t user, gid_t group, int* ismember); #endif /* __APPLE__ */ +#ifdef WITH_LSPP @@ -854,7 +847,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c /* * Local functions... -@@ -61,6 +72,9 @@ static void cancel_all_jobs(cupsd_client +@@ -51,6 +62,9 @@ static void cancel_all_jobs(cupsd_client static void cancel_job(cupsd_client_t *con, ipp_attribute_t *uri); static void cancel_subscription(cupsd_client_t *con, int id); static int check_rss_recipient(const char *recipient); @@ -864,7 +857,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c static int check_quotas(cupsd_client_t *con, cupsd_printer_t *p); static void close_job(cupsd_client_t *con, ipp_attribute_t *uri); static void copy_attrs(ipp_t *to, ipp_t *from, cups_array_t *ra, -@@ -1250,6 +1264,21 @@ add_job(cupsd_client_t *con, /* I - Cl +@@ -1240,6 +1254,21 @@ add_job(cupsd_client_t *con, /* I - Cl "time-at-creation", "time-at-processing" }; @@ -886,7 +879,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job(%p[%d], %p(%s), %p(%s/%s))", -@@ -1578,6 +1607,106 @@ add_job(cupsd_client_t *con, /* I - Cl +@@ -1568,6 +1597,106 @@ add_job(cupsd_client_t *con, /* I - Cl attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME); @@ -993,7 +986,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c if ((job = cupsdAddJob(priority, printer->name)) == NULL) { send_ipp_status(con, IPP_INTERNAL_ERROR, -@@ -1586,6 +1715,32 @@ add_job(cupsd_client_t *con, /* I - Cl +@@ -1576,6 +1705,32 @@ add_job(cupsd_client_t *con, /* I - Cl return (NULL); } @@ -1026,7 +1019,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c job->dtype = printer->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE); job->attrs = con->request; job->dirty = 1; -@@ -1773,6 +1928,29 @@ add_job(cupsd_client_t *con, /* I - Cl +@@ -1763,6 +1918,29 @@ add_job(cupsd_client_t *con, /* I - Cl ippSetString(job->attrs, &attr, 0, printer->job_sheets[0]); ippSetString(job->attrs, &attr, 1, printer->job_sheets[1]); } @@ -1056,7 +1049,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c job->job_sheets = attr; -@@ -1803,6 +1981,9 @@ add_job(cupsd_client_t *con, /* I - Cl +@@ -1793,6 +1971,9 @@ add_job(cupsd_client_t *con, /* I - Cl "job-sheets=\"%s,none\", " "job-originating-user-name=\"%s\"", Classification, job->username); @@ -1066,7 +1059,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c } else if (attr->num_values == 2 && strcmp(attr->values[0].string.text, -@@ -1821,6 +2002,9 @@ add_job(cupsd_client_t *con, /* I - Cl +@@ -1811,6 +1992,9 @@ add_job(cupsd_client_t *con, /* I - Cl "job-originating-user-name=\"%s\"", attr->values[0].string.text, attr->values[1].string.text, job->username); @@ -1076,7 +1069,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c } else if (strcmp(attr->values[0].string.text, Classification) && strcmp(attr->values[0].string.text, "none") && -@@ -1841,6 +2025,9 @@ add_job(cupsd_client_t *con, /* I - Cl +@@ -1831,6 +2015,9 @@ add_job(cupsd_client_t *con, /* I - Cl "job-originating-user-name=\"%s\"", attr->values[0].string.text, attr->values[1].string.text, job->username); @@ -1086,7 +1079,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c } } else if (strcmp(attr->values[0].string.text, Classification) && -@@ -1881,8 +2068,52 @@ add_job(cupsd_client_t *con, /* I - Cl +@@ -1871,8 +2058,52 @@ add_job(cupsd_client_t *con, /* I - Cl "job-sheets=\"%s\", " "job-originating-user-name=\"%s\"", Classification, job->username); @@ -1139,7 +1132,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c /* * See if we need to add the starting sheet... -@@ -3656,6 +3887,128 @@ check_rss_recipient( +@@ -3648,6 +3879,128 @@ check_rss_recipient( } @@ -1268,7 +1261,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c /* * 'check_quotas()' - Check quotas for a printer and user. */ -@@ -4112,6 +4465,15 @@ copy_banner(cupsd_client_t *con, /* I - +@@ -4103,6 +4456,15 @@ copy_banner(cupsd_client_t *con, /* I - char attrname[255], /* Name of attribute */ *s; /* Pointer into name */ ipp_attribute_t *attr; /* Attribute */ @@ -1284,7 +1277,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c cupsdLogMessage(CUPSD_LOG_DEBUG2, -@@ -4147,6 +4509,85 @@ copy_banner(cupsd_client_t *con, /* I - +@@ -4138,6 +4500,85 @@ copy_banner(cupsd_client_t *con, /* I - fchmod(cupsFileNumber(out), 0640); fchown(cupsFileNumber(out), RunUser, Group); @@ -1370,7 +1363,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c /* * Try the localized banner file under the subdirectory... -@@ -4241,6 +4682,24 @@ copy_banner(cupsd_client_t *con, /* I - +@@ -4232,6 +4673,24 @@ copy_banner(cupsd_client_t *con, /* I - else s = attrname; @@ -1395,7 +1388,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c if (!strcmp(s, "printer-name")) { cupsFilePuts(out, job->dest); -@@ -6480,6 +6939,22 @@ get_job_attrs(cupsd_client_t *con, /* I +@@ -6439,6 +6898,22 @@ get_job_attrs(cupsd_client_t *con, /* I exclude = cupsdGetPrivateAttrs(policy, con, printer, job->username); @@ -1418,7 +1411,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c /* * Copy attributes... */ -@@ -6877,6 +7352,11 @@ get_jobs(cupsd_client_t *con, /* I - C +@@ -6836,6 +7311,11 @@ get_jobs(cupsd_client_t *con, /* I - C if (username[0] && _cups_strcasecmp(username, job->username)) continue; @@ -1430,7 +1423,7 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c if (count > 0) ippAddSeparator(con->response); -@@ -11475,6 +11955,11 @@ validate_user(cupsd_job_t *job, /* I +@@ -11445,6 +11925,11 @@ validate_user(cupsd_job_t *job, /* I strlcpy(username, get_username(con), userlen); @@ -1442,11 +1435,11 @@ diff -up cups-2.2.8/scheduler/ipp.c.lspp cups-2.2.8/scheduler/ipp.c /* * Check the username against the owner... */ -diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c ---- cups-2.2.8/scheduler/job.c.lspp 2018-06-08 17:34:38.657654158 +0200 -+++ cups-2.2.8/scheduler/job.c 2018-06-08 17:34:38.733653554 +0200 -@@ -11,6 +11,9 @@ - * missing or damaged, see the license at "http://www.cups.org/". +diff -up cups-2.3.0/scheduler/job.c.lspp cups-2.3.0/scheduler/job.c +--- cups-2.3.0/scheduler/job.c.lspp 2019-10-07 12:24:43.024597707 +0200 ++++ cups-2.3.0/scheduler/job.c 2019-10-07 12:30:13.092210820 +0200 +@@ -8,6 +8,9 @@ + * information. */ +/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */ @@ -1455,7 +1448,7 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c /* * Include necessary headers... */ -@@ -26,6 +29,14 @@ +@@ -23,6 +26,14 @@ # endif /* HAVE_IOKIT_PWR_MGT_IOPMLIBPRIVATE_H */ #endif /* __APPLE__ */ @@ -1470,7 +1463,7 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c /* * Design Notes for Job Management -@@ -547,6 +558,14 @@ cupsdContinueJob(cupsd_job_t *job) /* I +@@ -544,6 +555,14 @@ cupsdContinueJob(cupsd_job_t *job) /* I /* PRINTER_STATE_REASONS env var */ rip_max_cache[255]; /* RIP_MAX_CACHE env variable */ @@ -1485,7 +1478,7 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c cupsdLogMessage(CUPSD_LOG_DEBUG2, -@@ -1083,6 +1102,67 @@ cupsdContinueJob(cupsd_job_t *job) /* I +@@ -1080,6 +1099,67 @@ cupsdContinueJob(cupsd_job_t *job) /* I if (final_content_type[0]) envp[envc ++] = final_content_type; @@ -1553,7 +1546,7 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c if (Classification && !banner_page) { if ((attr = ippFindAttribute(job->attrs, "job-sheets", -@@ -1862,6 +1942,22 @@ cupsdLoadJob(cupsd_job_t *job) /* I - J +@@ -1858,6 +1938,22 @@ cupsdLoadJob(cupsd_job_t *job) /* I - J ippSetString(job->attrs, &job->reasons, 0, "none"); } @@ -1576,7 +1569,7 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c job->impressions = ippFindAttribute(job->attrs, "job-impressions-completed", IPP_TAG_INTEGER); job->sheets = ippFindAttribute(job->attrs, "job-media-sheets-completed", IPP_TAG_INTEGER); job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME); -@@ -2275,6 +2371,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J +@@ -2273,6 +2369,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J { char filename[1024]; /* Job control filename */ cups_file_t *fp; /* Job file */ @@ -1591,7 +1584,7 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSaveJob(job=%p(%d)): job->attrs=%p", -@@ -2297,6 +2401,78 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J +@@ -2295,6 +2399,78 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J fchown(cupsFileNumber(fp), RunUser, Group); @@ -1670,7 +1663,7 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c job->attrs->state = IPP_IDLE; if (ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL, -@@ -3943,6 +4119,19 @@ get_options(cupsd_job_t *job, /* I - Jo +@@ -3995,6 +4171,19 @@ get_options(cupsd_job_t *job, /* I - Jo banner_page) continue; @@ -1690,7 +1683,7 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c /* * Otherwise add them to the list... */ -@@ -4704,6 +4893,18 @@ start_job(cupsd_job_t *job, /* I - +@@ -4805,6 +4994,18 @@ start_job(cupsd_job_t *job, /* I - cupsd_printer_t *printer) /* I - Printer to print job */ { const char *filename; /* Support filename */ @@ -1709,7 +1702,7 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c ipp_attribute_t *cancel_after = ippFindAttribute(job->attrs, "job-cancel-after", IPP_TAG_INTEGER); -@@ -4892,6 +5093,113 @@ start_job(cupsd_job_t *job, /* I - +@@ -4993,6 +5194,113 @@ start_job(cupsd_job_t *job, /* I - fcntl(job->side_pipes[1], F_SETFD, fcntl(job->side_pipes[1], F_GETFD) | FD_CLOEXEC); @@ -1823,11 +1816,11 @@ diff -up cups-2.2.8/scheduler/job.c.lspp cups-2.2.8/scheduler/job.c /* * Now start the first file in the job... */ -diff -up cups-2.2.8/scheduler/job.h.lspp cups-2.2.8/scheduler/job.h ---- cups-2.2.8/scheduler/job.h.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/scheduler/job.h 2018-06-08 17:34:38.733653554 +0200 -@@ -11,6 +11,13 @@ - * missing or damaged, see the license at "http://www.cups.org/". +diff -up cups-2.3.0/scheduler/job.h.lspp cups-2.3.0/scheduler/job.h +--- cups-2.3.0/scheduler/job.h.lspp 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/scheduler/job.h 2019-10-07 12:29:54.364371023 +0200 +@@ -7,6 +7,13 @@ + * Licensed under Apache License v2.0. See the file "LICENSE" for more information. */ +/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */ @@ -1840,7 +1833,7 @@ diff -up cups-2.2.8/scheduler/job.h.lspp cups-2.2.8/scheduler/job.h /* * Constants... */ -@@ -88,6 +95,10 @@ struct cupsd_job_s /**** Job request * +@@ -84,6 +91,10 @@ struct cupsd_job_s /**** Job request * int progress; /* Printing progress */ int num_keywords; /* Number of PPD keywords */ cups_option_t *keywords; /* PPD keywords */ @@ -1851,10 +1844,10 @@ diff -up cups-2.2.8/scheduler/job.h.lspp cups-2.2.8/scheduler/job.h }; typedef struct cupsd_joblog_s /**** Job log message ****/ -diff -up cups-2.2.8/scheduler/main.c.lspp cups-2.2.8/scheduler/main.c ---- cups-2.2.8/scheduler/main.c.lspp 2018-06-08 17:34:38.663654110 +0200 -+++ cups-2.2.8/scheduler/main.c 2018-06-08 17:34:38.734653546 +0200 -@@ -56,6 +56,9 @@ +diff -up cups-2.3.0/scheduler/main.c.lspp cups-2.3.0/scheduler/main.c +--- cups-2.3.0/scheduler/main.c.lspp 2019-10-07 12:24:43.037597616 +0200 ++++ cups-2.3.0/scheduler/main.c 2019-10-07 12:24:43.119597037 +0200 +@@ -57,6 +57,9 @@ # include #endif /* HAVE_SYS_PARAM_H */ @@ -1864,7 +1857,7 @@ diff -up cups-2.2.8/scheduler/main.c.lspp cups-2.2.8/scheduler/main.c /* * Local functions... -@@ -122,6 +125,9 @@ main(int argc, /* I - Number of comm +@@ -123,6 +126,9 @@ main(int argc, /* I - Number of comm #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Actions for POSIX signals */ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */ @@ -1900,7 +1893,7 @@ diff -up cups-2.2.8/scheduler/main.c.lspp cups-2.2.8/scheduler/main.c /* * Let the system know we are busy while we bring up cupsd... */ -@@ -1188,6 +1213,11 @@ main(int argc, /* I - Number of comm +@@ -1201,6 +1226,11 @@ main(int argc, /* I - Number of comm cupsdStopSelect(); @@ -1912,11 +1905,11 @@ diff -up cups-2.2.8/scheduler/main.c.lspp cups-2.2.8/scheduler/main.c return (!stop_scheduler); } -diff -up cups-2.2.8/scheduler/printers.c.lspp cups-2.2.8/scheduler/printers.c ---- cups-2.2.8/scheduler/printers.c.lspp 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/scheduler/printers.c 2018-06-08 17:34:38.734653546 +0200 -@@ -11,6 +11,8 @@ - * missing or damaged, see the license at "http://www.cups.org/". +diff -up cups-2.3.0/scheduler/printers.c.lspp cups-2.3.0/scheduler/printers.c +--- cups-2.3.0/scheduler/printers.c.lspp 2019-08-23 17:19:38.000000000 +0200 ++++ cups-2.3.0/scheduler/printers.c 2019-10-07 12:29:17.956658129 +0200 +@@ -8,6 +8,8 @@ + * information. */ +/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */ @@ -1924,7 +1917,7 @@ diff -up cups-2.2.8/scheduler/printers.c.lspp cups-2.2.8/scheduler/printers.c /* * Include necessary headers... */ -@@ -35,6 +37,10 @@ +@@ -32,6 +34,10 @@ # include #endif /* __APPLE__ */ @@ -1935,7 +1928,7 @@ diff -up cups-2.2.8/scheduler/printers.c.lspp cups-2.2.8/scheduler/printers.c /* * Local functions... -@@ -2202,6 +2208,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p) +@@ -2252,6 +2258,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p) ipp_attribute_t *attr; /* Attribute data */ char *name, /* Current user/group name */ *filter; /* Current filter */ @@ -1948,8 +1941,8 @@ diff -up cups-2.2.8/scheduler/printers.c.lspp cups-2.2.8/scheduler/printers.c +#endif /* WITH_LSPP */ - DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name, -@@ -2329,6 +2342,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p) + /* +@@ -2378,6 +2391,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p) attr->values[1].string.text = _cupsStrAlloc(Classification ? Classification : p->job_sheets[1]); } diff --git a/cups-manual-copies.patch b/cups-manual-copies.patch new file mode 100644 index 0000000000000000000000000000000000000000..5d9c1af9c3ebbb00ba1de75c0129cad90689c7c8 --- /dev/null +++ b/cups-manual-copies.patch @@ -0,0 +1,13 @@ +diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c +index 94a125a..79aab32 100644 +--- a/cups/ppd-cache.c ++++ b/cups/ppd-cache.c +@@ -3228,7 +3228,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ + cupsFilePuts(fp, "*cupsFilter2: \"application/vnd.cups-pdf application/pdf 10 -\"\n"); + } + else +- cupsFilePuts(fp, "*cupsManualCopies: true\n"); ++ cupsFilePuts(fp, "*cupsManualCopies: True\n"); + if (is_apple) + cupsFilePuts(fp, "*cupsFilter2: \"image/urf image/urf 100 -\"\n"); + if (is_pwg) diff --git a/cups-multilib.patch b/cups-multilib.patch index 3c6bc397ab9d41d77ef98098542216e0b4b9b205..c8d5686beebb17ec01eb956f3227cd0189b5a1d7 100644 --- a/cups-multilib.patch +++ b/cups-multilib.patch @@ -1,16 +1,14 @@ -diff -up cups-1.5b1/cups-config.in.multilib cups-1.5b1/cups-config.in ---- cups-1.5b1/cups-config.in.multilib 2010-06-16 02:48:25.000000000 +0200 -+++ cups-1.5b1/cups-config.in 2011-05-23 17:33:31.000000000 +0200 -@@ -22,8 +22,10 @@ prefix=@prefix@ +diff -up cups-2.3.0/cups-config.in.multilib cups-2.3.0/cups-config.in +--- cups-2.3.0/cups-config.in.multilib 2019-10-07 12:10:09.508859587 +0200 ++++ cups-2.3.0/cups-config.in 2019-10-07 12:11:56.614025934 +0200 +@@ -17,7 +17,9 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ includedir=@includedir@ -libdir=@libdir@ --imagelibdir=@libdir@ +# Fetch libdir from gnutls's pkg-config script. This is a bit +# of a cheat, but the cups-devel package requires gnutls-devel anyway. +libdir=`pkg-config --variable=libdir gnutls` -+imagelibdir=`pkg-config --variable=libdir gnutls` datarootdir=@datadir@ datadir=@datadir@ sysconfdir=@sysconfdir@ diff --git a/cups-no-gzip-man.patch b/cups-no-gzip-man.patch deleted file mode 100644 index c476b7b47afc6cadce1e877a1a661ff37d6fa219..0000000000000000000000000000000000000000 --- a/cups-no-gzip-man.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -up cups-2.2.4/config-scripts/cups-manpages.m4.no-gzip-man cups-2.2.4/config-scripts/cups-manpages.m4 ---- cups-2.2.4/config-scripts/cups-manpages.m4.no-gzip-man 2017-06-30 20:37:09.470034273 +0200 -+++ cups-2.2.4/config-scripts/cups-manpages.m4 2017-06-30 20:39:15.982884832 +0200 -@@ -53,10 +53,10 @@ case "$host_os_name" in - ;; - linux* | gnu* | darwin*) - # Linux, GNU Hurd, and macOS -- MAN1EXT=1.gz -- MAN5EXT=5.gz -- MAN7EXT=7.gz -- MAN8EXT=8.gz -+ MAN1EXT=1 -+ MAN5EXT=5 -+ MAN7EXT=7 -+ MAN8EXT=8 - MAN8DIR=8 - ;; - *) diff --git a/cups-ppdleak.patch b/cups-ppdleak.patch new file mode 100644 index 0000000000000000000000000000000000000000..3354f76a2aa13129b7d090e3490366bed6e1d941 --- /dev/null +++ b/cups-ppdleak.patch @@ -0,0 +1,22 @@ +diff --git a/ppdc/ppdc-import.cxx b/ppdc/ppdc-import.cxx +index 04b587d..60d8834 100644 +--- a/ppdc/ppdc-import.cxx ++++ b/ppdc/ppdc-import.cxx +@@ -27,7 +27,7 @@ ppdcSource::import_ppd(const char *f) // I - Filename + char line[256], // Comment line + *ptr; // Pointer into line + int cost; // Cost for filter +- ppd_file_t *ppd; // PPD file data ++ ppd_file_t *ppd = NULL; // PPD file data + ppd_group_t *group; // PPD group + ppd_option_t *option; // PPD option + ppd_choice_t *choice; // PPD choice +@@ -323,5 +323,8 @@ ppdcSource::import_ppd(const char *f) // I - Filename + } + } + ++ if (ppd) ++ ppdClose(ppd); ++ + return (1); + } diff --git a/cups-prioritize-print-color-mode.patch b/cups-prioritize-print-color-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..feb71197df46102e74b9bbdd4721e4dbd1b6803a --- /dev/null +++ b/cups-prioritize-print-color-mode.patch @@ -0,0 +1,15 @@ +diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c +index 5965e38..94a125a 100644 +--- a/cups/ppd-cache.c ++++ b/cups/ppd-cache.c +@@ -3735,8 +3735,8 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ + */ + + if ((attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) == NULL) +- if ((attr = ippFindAttribute(response, "pwg-raster-document-type-supported", IPP_TAG_KEYWORD)) == NULL) +- if ((attr = ippFindAttribute(response, "print-color-mode-supported", IPP_TAG_KEYWORD)) == NULL) ++ if ((attr = ippFindAttribute(response, "print-color-mode-supported", IPP_TAG_KEYWORD)) == NULL) ++ if ((attr = ippFindAttribute(response, "pwg-raster-document-type-supported", IPP_TAG_KEYWORD)) == NULL) + attr = ippFindAttribute(response, "output-mode-supported", IPP_TAG_KEYWORD); + + if (attr) diff --git a/cups-rastertopwg-crash.patch b/cups-rastertopwg-crash.patch new file mode 100644 index 0000000000000000000000000000000000000000..4c378b91e485bdeb7051895b2570052f67b277c2 --- /dev/null +++ b/cups-rastertopwg-crash.patch @@ -0,0 +1,14 @@ +diff --git a/filter/rastertopwg.c b/filter/rastertopwg.c +index 1e63e4e..b3a2e87 100644 +--- a/filter/rastertopwg.c ++++ b/filter/rastertopwg.c +@@ -260,7 +260,8 @@ main(int argc, /* I - Number of command-line args */ + } + + if (inheader.cupsPageSizeName[0] && +- (pwg_size = _ppdCacheGetSize(cache, inheader.cupsPageSizeName)) != NULL) ++ (pwg_size = _ppdCacheGetSize(cache, inheader.cupsPageSizeName)) != NULL && ++ pwg_size->map.pwg) + { + strlcpy(outheader.cupsPageSizeName, pwg_size->map.pwg, + sizeof(outheader.cupsPageSizeName)); diff --git a/cups-synconclose.patch b/cups-synconclose.patch index 8aee02b4cb549457fd017a3b8218f1ed6f652ef8..380be9421f49dabc4e432822242a530153d49d57 100644 --- a/cups-synconclose.patch +++ b/cups-synconclose.patch @@ -1,6 +1,6 @@ -diff -up cups-2.0.2/conf/cups-files.conf.in.LGOyhq cups-2.0.2/conf/cups-files.conf.in ---- cups-2.0.2/conf/cups-files.conf.in.LGOyhq 2015-02-10 13:51:24.912193296 +0100 -+++ cups-2.0.2/conf/cups-files.conf.in 2015-02-10 13:52:49.400997262 +0100 +diff -up cups-2.2.12/conf/cups-files.conf.in.synconclose cups-2.2.12/conf/cups-files.conf.in +--- cups-2.2.12/conf/cups-files.conf.in.synconclose 2019-08-16 00:35:30.000000000 +0200 ++++ cups-2.2.12/conf/cups-files.conf.in 2019-08-19 09:58:14.646567949 +0200 @@ -7,7 +7,7 @@ #FatalErrors @CUPS_FATAL_ERRORS@ @@ -10,10 +10,10 @@ diff -up cups-2.0.2/conf/cups-files.conf.in.LGOyhq cups-2.0.2/conf/cups-files.co # Default user and group for filters/backends/helper programs; this cannot be # any user or group that resolves to ID 0 for security reasons... -diff -up cups-2.0.2/doc/help/man-cups-files.conf.html.LGOyhq cups-2.0.2/doc/help/man-cups-files.conf.html ---- cups-2.0.2/doc/help/man-cups-files.conf.html.LGOyhq 2015-02-10 13:52:49.400997262 +0100 -+++ cups-2.0.2/doc/help/man-cups-files.conf.html 2015-02-10 13:53:07.057747311 +0100 -@@ -136,7 +136,7 @@ The default is "/etc/cups". +diff -up cups-2.2.12/doc/help/man-cups-files.conf.html.synconclose cups-2.2.12/doc/help/man-cups-files.conf.html +--- cups-2.2.12/doc/help/man-cups-files.conf.html.synconclose 2019-08-16 00:35:30.000000000 +0200 ++++ cups-2.2.12/doc/help/man-cups-files.conf.html 2019-08-19 09:58:14.646567949 +0200 +@@ -150,7 +150,7 @@ The default is "/var/run/cups" or "/etc/
Specifies whether the scheduler calls fsync(2) after writing configuration or state files. @@ -22,10 +22,10 @@ diff -up cups-2.0.2/doc/help/man-cups-files.conf.html.LGOyhq cups-2.0.2/doc/help
SystemGroup group-name [ ... group-name ]
Specifies the group(s) to use for @SYSTEM group authentication. The default contains "admin", "lpadmin", "root", "sys", and/or "system". -diff -up cups-2.0.2/man/cups-files.conf.man.in.LGOyhq cups-2.0.2/man/cups-files.conf.man.in ---- cups-2.0.2/man/cups-files.conf.man.in.LGOyhq 2015-02-10 13:52:49.400997262 +0100 -+++ cups-2.0.2/man/cups-files.conf.man.in 2015-02-10 13:53:23.753510964 +0100 -@@ -201,7 +201,7 @@ The default is "/etc/cups". +diff -up cups-2.2.12/man/cups-files.conf.man.in.synconclose cups-2.2.12/man/cups-files.conf.man.in +--- cups-2.2.12/man/cups-files.conf.5.synconclose 2019-08-16 00:35:30.000000000 +0200 ++++ cups-2.2.12/man/cups-files.conf.5 2019-08-19 09:58:14.646567949 +0200 +@@ -214,7 +214,7 @@ The default is "/var/run/cups" or "/etc/ Specifies whether the scheduler calls .BR fsync (2) after writing configuration or state files. @@ -34,15 +34,15 @@ diff -up cups-2.0.2/man/cups-files.conf.man.in.LGOyhq cups-2.0.2/man/cups-files. .\"#SystemGroup .TP 5 \fBSystemGroup \fIgroup-name \fR[ ... \fIgroup-name\fR ] -diff -up cups-2.0.2/scheduler/conf.c.LGOyhq cups-2.0.2/scheduler/conf.c ---- cups-2.0.2/scheduler/conf.c.LGOyhq 2015-02-10 13:51:24.991192177 +0100 -+++ cups-2.0.2/scheduler/conf.c 2015-02-10 13:52:49.401997248 +0100 -@@ -717,7 +717,7 @@ cupsdReadConfiguration(void) +diff -up cups-2.2.12/scheduler/conf.c.synconclose cups-2.2.12/scheduler/conf.c +--- cups-2.2.12/scheduler/conf.c.synconclose 2019-08-19 09:58:14.647567941 +0200 ++++ cups-2.2.12/scheduler/conf.c 2019-08-19 09:59:36.066927455 +0200 +@@ -735,7 +735,7 @@ cupsdReadConfiguration(void) RootCertDuration = 300; Sandboxing = CUPSD_SANDBOXING_STRICT; StrictConformance = FALSE; - SyncOnClose = FALSE; + SyncOnClose = TRUE; - Timeout = DEFAULT_TIMEOUT; + Timeout = 900; WebInterface = CUPS_DEFAULT_WEBIF; diff --git a/cups-systemd-socket.patch b/cups-systemd-socket.patch index cacd19f7b596d852afb601f3fec6dd77baf5c515..260ac29d7d5568e8c3608adf7d826f064494cca4 100644 --- a/cups-systemd-socket.patch +++ b/cups-systemd-socket.patch @@ -1,7 +1,7 @@ -diff -up cups-2.2.8/scheduler/main.c.systemd-socket cups-2.2.8/scheduler/main.c ---- cups-2.2.8/scheduler/main.c.systemd-socket 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/scheduler/main.c 2018-09-19 10:38:09.285892238 +0200 -@@ -681,8 +681,16 @@ main(int argc, /* I - Number of comm +diff -up cups-2.2.12/scheduler/main.c.systemd-socket cups-2.2.12/scheduler/main.c +--- cups-2.2.12/scheduler/main.c.systemd-socket 2019-08-16 00:35:30.000000000 +0200 ++++ cups-2.2.12/scheduler/main.c 2019-08-19 09:31:09.703370325 +0200 +@@ -674,8 +674,16 @@ main(int argc, /* I - Number of comm #ifdef HAVE_ONDEMAND if (OnDemand) @@ -19,9 +19,9 @@ diff -up cups-2.2.8/scheduler/main.c.systemd-socket cups-2.2.8/scheduler/main.c #endif /* HAVE_ONDEMAND */ if (fg) cupsdAddEvent(CUPSD_EVENT_SERVER_STARTED, NULL, NULL, "Scheduler started in foreground."); -diff -up cups-2.2.8/scheduler/org.cups.cupsd.path.in.systemd-socket cups-2.2.8/scheduler/org.cups.cupsd.path.in ---- cups-2.2.8/scheduler/org.cups.cupsd.path.in.systemd-socket 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/scheduler/org.cups.cupsd.path.in 2018-09-19 10:46:11.246666713 +0200 +diff -up cups-2.2.12/scheduler/org.cups.cupsd.path.in.systemd-socket cups-2.2.12/scheduler/org.cups.cupsd.path.in +--- cups-2.2.12/scheduler/org.cups.cupsd.path.in.systemd-socket 2019-08-16 00:35:30.000000000 +0200 ++++ cups-2.2.12/scheduler/org.cups.cupsd.path.in 2019-08-19 09:31:09.703370325 +0200 @@ -1,6 +1,6 @@ [Unit] Description=CUPS Scheduler @@ -30,14 +30,15 @@ diff -up cups-2.2.8/scheduler/org.cups.cupsd.path.in.systemd-socket cups-2.2.8/s [Path] PathExists=@CUPS_CACHEDIR@/org.cups.cupsd -diff -up cups-2.2.8/scheduler/org.cups.cupsd.service.in.systemd-socket cups-2.2.8/scheduler/org.cups.cupsd.service.in ---- cups-2.2.8/scheduler/org.cups.cupsd.service.in.systemd-socket 2018-06-05 18:06:54.000000000 +0200 -+++ cups-2.2.8/scheduler/org.cups.cupsd.service.in 2018-09-19 10:41:11.378295760 +0200 -@@ -1,12 +1,13 @@ +diff -up cups-2.2.12/scheduler/org.cups.cupsd.service.in.systemd-socket cups-2.2.12/scheduler/org.cups.cupsd.service.in +--- cups-2.2.12/scheduler/org.cups.cupsd.service.in.systemd-socket 2019-08-19 09:31:09.703370325 +0200 ++++ cups-2.2.12/scheduler/org.cups.cupsd.service.in 2019-08-19 09:54:58.890036404 +0200 +@@ -1,13 +1,13 @@ [Unit] Description=CUPS Scheduler Documentation=man:cupsd(8) -+After=network.target +-After=sssd.service ++After=sssd.service network.target [Service] ExecStart=@sbindir@/cupsd -l @@ -49,9 +50,9 @@ diff -up cups-2.2.8/scheduler/org.cups.cupsd.service.in.systemd-socket cups-2.2. -Also=org.cups.cupsd.socket org.cups.cupsd.path +Also=cups.socket cups.path WantedBy=printer.target -diff -up cups-2.2.8/scheduler/org.cups.cupsd.socket.in.systemd-socket cups-2.2.8/scheduler/org.cups.cupsd.socket.in ---- cups-2.2.8/scheduler/org.cups.cupsd.socket.in.systemd-socket 2018-09-19 10:42:21.411681757 +0200 -+++ cups-2.2.8/scheduler/org.cups.cupsd.socket.in 2018-09-19 10:42:44.819476530 +0200 +diff -up cups-2.2.12/scheduler/org.cups.cupsd.socket.in.systemd-socket cups-2.2.12/scheduler/org.cups.cupsd.socket.in +--- cups-2.2.12/scheduler/org.cups.cupsd.socket.in.systemd-socket 2019-08-16 00:35:30.000000000 +0200 ++++ cups-2.2.12/scheduler/org.cups.cupsd.socket.in 2019-08-19 09:31:09.703370325 +0200 @@ -1,6 +1,6 @@ [Unit] Description=CUPS Scheduler @@ -60,9 +61,9 @@ diff -up cups-2.2.8/scheduler/org.cups.cupsd.socket.in.systemd-socket cups-2.2.8 [Socket] ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@ -diff -up cups-2.2.8/scheduler/org.cups.cups-lpd.socket.systemd-socket cups-2.2.8/scheduler/org.cups.cups-lpd.socket ---- cups-2.2.8/scheduler/org.cups.cups-lpd.socket.systemd-socket 2018-09-19 10:53:59.222563802 +0200 -+++ cups-2.2.8/scheduler/org.cups.cups-lpd.socket 2018-09-19 10:54:16.483412464 +0200 +diff -up cups-2.2.12/scheduler/org.cups.cups-lpd.socket.systemd-socket cups-2.2.12/scheduler/org.cups.cups-lpd.socket +--- cups-2.2.12/scheduler/org.cups.cups-lpd.socket.systemd-socket 2019-08-16 00:35:30.000000000 +0200 ++++ cups-2.2.12/scheduler/org.cups.cups-lpd.socket 2019-08-19 09:31:09.703370325 +0200 @@ -1,6 +1,6 @@ [Unit] Description=CUPS LPD Server Socket diff --git a/cups-uri-compat.patch b/cups-uri-compat.patch index a77acaddd9e6bfea46846206488d2f27589f75f7..2520a5bec6dcaa9dc3518ed0510a1fcced03e0a8 100644 --- a/cups-uri-compat.patch +++ b/cups-uri-compat.patch @@ -26,8 +26,8 @@ diff -up cups-1.5b1/backend/usb-unix.c.uri-compat cups-1.5b1/backend/usb-unix.c + { + char *x = e + mfrlen; + if (!strncmp (x, "%20", 3)) -+ /* Take mfr name out of mdl name for compatibility -+ * before bug #507244 was fixed. */ ++ /* Take mfr name out of mdl name for compatibility with ++ * Fedora 11 before bug #507244 was fixed. */ + strcpy (e, x + 3); puts(fixed_uri); + } + } diff --git a/cups-web-devices-timeout.patch b/cups-web-devices-timeout.patch new file mode 100644 index 0000000000000000000000000000000000000000..fa3a320f930681e77340c8adaf63abbce2faf963 --- /dev/null +++ b/cups-web-devices-timeout.patch @@ -0,0 +1,19 @@ +diff -up cups-1.7rc1/cgi-bin/admin.c.web-devices-timeout cups-1.7rc1/cgi-bin/admin.c +--- cups-1.7rc1/cgi-bin/admin.c.web-devices-timeout 2013-05-29 12:51:34.000000000 +0100 ++++ cups-1.7rc1/cgi-bin/admin.c 2013-08-16 16:01:17.308264287 +0100 +@@ -1019,13 +1019,13 @@ do_am_printer(http_t *http, /* I - HTTP + } + + /* +- * Scan for devices for up to 30 seconds... ++ * Scan for devices for up to 10 seconds... + */ + + fputs("DEBUG: Getting list of devices...\n", stderr); + + current_device = 0; +- if (cupsGetDevices(http, 5, CUPS_INCLUDE_ALL, CUPS_EXCLUDE_NONE, ++ if (cupsGetDevices(http, 10, CUPS_INCLUDE_ALL, CUPS_EXCLUDE_NONE, + (cups_device_cb_t)choose_device_cb, + (void *)title) == IPP_OK) + { diff --git a/cups-webui-uri.patch b/cups-webui-uri.patch new file mode 100644 index 0000000000000000000000000000000000000000..7021205c072e208ee9b07e5f0d41577e09a5ed40 --- /dev/null +++ b/cups-webui-uri.patch @@ -0,0 +1,13 @@ +diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c +index a87e6be..4600d33 100644 +--- a/cgi-bin/admin.c ++++ b/cgi-bin/admin.c +@@ -974,6 +974,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + + cgiSetVariable("TEMPLATE_NAME", template); + } ++ ++ cgiSetVariable("DEVICE_URI", var); + } + } + diff --git a/cups-ypbind.patch b/cups-ypbind.patch index f942708a60fa42f8f75d1017c34eda78947b3ce1..17e90a57d6436aea432297d2f54c72137674a4df 100644 --- a/cups-ypbind.patch +++ b/cups-ypbind.patch @@ -1,12 +1,12 @@ -diff -up cups-2.2.0/scheduler/org.cups.cupsd.service.in.ypbind cups-2.2.0/scheduler/org.cups.cupsd.service.in ---- cups-2.2.0/scheduler/org.cups.cupsd.service.in.ypbind 2017-09-22 16:51:39.053585694 +0200 -+++ cups-2.2.0/scheduler/org.cups.cupsd.service.in 2017-09-22 16:52:02.588403584 +0200 +diff -up cups-2.2.12/scheduler/org.cups.cupsd.service.in.ypbind cups-2.2.12/scheduler/org.cups.cupsd.service.in +--- cups-2.2.12/scheduler/org.cups.cupsd.service.in.ypbind 2019-08-19 10:00:47.586326493 +0200 ++++ cups-2.2.12/scheduler/org.cups.cupsd.service.in 2019-08-19 10:01:39.295890076 +0200 @@ -1,7 +1,7 @@ [Unit] Description=CUPS Scheduler Documentation=man:cupsd(8) --After=network.target -+After=network.target ypbind.service +-After=sssd.service network.target ++After=sssd.service network.target ypbind.service [Service] ExecStart=@sbindir@/cupsd -l diff --git a/cups.spec b/cups.spec index 489e3e2ed2412157287fbf840b7d326b538ad47c..451818e7be2ba806ad8bb83cedaf53da8d23be79 100644 --- a/cups.spec +++ b/cups.spec @@ -1,7 +1,8 @@ +%global cups_serverbin %{_exec_prefix}/lib/cups Name: cups Epoch: 1 -Version: 2.2.8 -Release: 9 +Version: 2.3.3 +Release: 1 Summary: CUPS is the standards-based, open source printing system for linux operating systems. License: GPLv2+ and LGPLv2+ with exceptions and AML Url: http://www.cups.org/ @@ -12,39 +13,44 @@ Source3: cups.logrotate Source4: ncp.backend Source5: macros.cups -Patch1: cups-no-gzip-man.patch -Patch2: cups-system-auth.patch -Patch3: cups-multilib.patch -Patch5: cups-banners.patch -Patch7: cups-no-export-ssllibs.patch -Patch8: cups-direct-usb.patch -Patch12: cups-eggcups.patch -Patch16: cups-usb-paperout.patch -Patch19: cups-uri-compat.patch -Patch22: cups-hp-deviceid-oid.patch -Patch24: cups-ricoh-deviceid-oid.patch -Patch25: cups-systemd-socket.patch -Patch30: cups-freebind.patch -Patch35: cups-ipp-multifile.patch -Patch37: cups-synconclose.patch -Patch38: cups-ypbind.patch -Patch100: cups-lspp.patch -Patch9: cups-lpr-help.patch -Patch18: cups-filter-debug.patch -Patch29: cups-dymo-deviceid.patch -Patch41: cups-accesslog-null.patch -Patch42: cups-epson-A6-crash.patch -Patch43: cups-ippvalidateattr-regression.patch -Patch44: cups-ippeve-webui.patch -Patch45: 0001-Fix-memory-leaks-found-by-Coverity-Issue-5375.patch -Patch6000: CVE-2018-4300.patch -Patch6001: CVE-2019-8675-CVE-2019-8696.patch -Patch6002: CVE-2019-2228.patch - -Provides: cupsddk cupsddk-drivers cups-filesystem cups-client cups-ipptool cups-lpd +Patch1: cups-system-auth.patch +Patch2: cups-multilib.patch +Patch3: cups-banners.patch +Patch4: cups-no-export-ssllibs.patch +Patch5: cups-direct-usb.patch +Patch6: cups-eggcups.patch +Patch7: cups-driverd-timeout.patch +Patch8: cups-logrotate.patch +Patch9: cups-usb-paperout.patch +Patch10: cups-uri-compat.patch +Patch11: cups-hp-deviceid-oid.patch +Patch12: cups-ricoh-deviceid-oid.patch +Patch13: cups-systemd-socket.patch +Patch14: cups-freebind.patch +Patch15: cups-ipp-multifile.patch +Patch16: cups-web-devices-timeout.patch +Patch17: cups-synconclose.patch +Patch18: cups-ypbind.patch +Patch19: cups-lspp.patch +Patch20: cups-failover-backend.patch +Patch21: cups-filter-debug.patch +Patch22: cups-dymo-deviceid.patch +Patch23: cups-autostart-when-enabled.patch +Patch24: cups-prioritize-print-color-mode.patch +Patch25: cups-ppdleak.patch +Patch26: cups-rastertopwg-crash.patch +Patch27: cups-etimedout.patch +Patch28: cups-webui-uri.patch +Patch29: cups-ipptool-mdns-uri.patch +Patch30: cups-manual-copies.patch + +Provides: cupsddk cupsddk-drivers cups-filesystem cups-client cups-ipptool cups-lpd Provides: lpd lpr /usr/bin/lpq /usr/bin/lpr /usr/bin/lp /usr/bin/cancel /usr/bin/lprm /usr/bin/lpstat Obsoletes: cups-client cups-filesystem cups-lpd cups-ipptool +Provides: cups-printerapp = %{version}-%{release} +Obsoletes: cups-printerapp < %{version}-%{release} + BuildRequires: pam-devel pkgconf-pkg-config pkgconfig(gnutls) libacl-devel openldap-devel pkgconfig(libusb-1.0) BuildRequires: krb5-devel pkgconfig(avahi-client) systemd pkgconfig(libsystemd) pkgconfig(dbus-1) python3-cups BuildRequires: automake zlib-devel gcc gcc-c++ libselinux-devel audit-libs-devel @@ -253,14 +259,17 @@ rm -f %{_exec_prefix}/lib/cups/backend/smb %{_unitdir}/cups-lpd.socket %{_unitdir}/cups-lpd@.service %{_bindir}/cupstestppd -%{_bindir}/cupstestdsc +#%%{_bindir}/cupstestdsc %{_bindir}/ppd* %{_bindir}/cancel* %{_bindir}/lp* %{_bindir}/ipptool %{_bindir}/ippfind +%{_bindir}/ippeveprinter %{_sbindir}/* -%{_sbindir}/lpc.cups +%dir %{cups_serverbin}/command +%{cups_serverbin}/command/ippevepcl +%{cups_serverbin}/command/ippeveps %{_exec_prefix}/lib/cups/backend/* %{_exec_prefix}/lib/cups/cgi-bin @@ -301,7 +310,7 @@ rm -f %{_exec_prefix}/lib/cups/backend/smb %{_datadir}/cups/ipptool/* %files libs -%{license} LICENSE.txt +%{license} LICENSE NOTICE %{_libdir}/lib*.so.* %files devel @@ -312,13 +321,6 @@ rm -f %{_exec_prefix}/lib/cups/backend/smb %files help %{_mandir}/man[1578]/* -%{_mandir}/man1/cancel-cups.1.gz -%{_mandir}/man1/cups-config.1.gz -%{_mandir}/man1/ipptool.1.gz -%{_mandir}/man1/lp*.1.gz -%{_mandir}/man5/ipptoolfile.5.gz -%{_mandir}/man8/cups-lpd.8.gz -%{_mandir}/man8/lpc-cups.8.gz %doc README.md CREDITS.md CHANGES.md %doc %{_datadir}/%{name}/www/index.html @@ -332,11 +334,23 @@ rm -f %{_exec_prefix}/lib/cups/backend/smb %doc %{_datadir}/%{name}/www/apple-touch-icon.png %changelog -* Thu Mar 26 chenzhen - 2.2.8-9 +* Mon Jul 20 2020 wangye - 2.3.3-1 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:upgrade to 2.3.3 + +* Fri Jun 12 2020 hanhui - 2.2.13-1 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:upgrade to 2.2.13 + +* Thu Mar 26 2020 gaihuiying - 2.2.8-9 - Type:cves - ID:CVE-2019-2228 - SUG:restart -- DESC: fix CVE-2019-2228 +- DESC:fix CVE-2019-2228 * Sat Jan 11 2020 openEuler Buildteam - 2.2.8-8 - Type:enhancement