From 7d4510a090b0b67e511514fb7b0c69de4e79ef47 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sat, 18 Aug 2018 09:01:32 -0400 Subject: [PATCH] Sync up with changes from 2.2.x. --- CHANGES.md | 4 +++- scheduler/ipp.c | 21 ++++++++++----------- systemv/lpadmin.c | 8 ++++++++ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f5112b0fbc..30834f94e3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -CHANGES - 2.3b6 - 2018-07-18 +CHANGES - 2.3b6 - 2018-08-18 ============================ Changes in CUPS v2.3b6 @@ -20,6 +20,8 @@ Changes in CUPS v2.3b6 - Fixed some typos in the label printer drivers (Issue #5350) - The scheduler was being backgrounded on macOS, causing applications to spin (rdar://40436080) +- The scheduler did not validate that required initial request attributes were + in the operation group (rdar://41098178) - Authentication in the web interface did not work on macOS (rdar://41444473) - Fixed a memory leak for some IPP (extension) syntaxes. diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 979b31a8b7..1fe068f113 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -248,7 +248,7 @@ cupsdProcessIPPRequest( */ attr = con->request->attrs; - if (attr && attr->name && !strcmp(attr->name, "attributes-charset") && (attr->value_tag & IPP_TAG_MASK) == IPP_TAG_CHARSET) + if (attr && attr->name && !strcmp(attr->name, "attributes-charset") && (attr->value_tag & IPP_TAG_MASK) == IPP_TAG_CHARSET && attr->group_tag == IPP_TAG_OPERATION) charset = attr; else charset = NULL; @@ -256,7 +256,7 @@ cupsdProcessIPPRequest( if (attr) attr = attr->next; - if (attr && attr->name && !strcmp(attr->name, "attributes-natural-language") && (attr->value_tag & IPP_TAG_MASK) == IPP_TAG_LANGUAGE) + if (attr && attr->name && !strcmp(attr->name, "attributes-natural-language") && (attr->value_tag & IPP_TAG_MASK) == IPP_TAG_LANGUAGE && attr->group_tag == IPP_TAG_OPERATION) { language = attr; @@ -274,12 +274,12 @@ cupsdProcessIPPRequest( else language = NULL; - if ((attr = ippFindAttribute(con->request, "printer-uri", IPP_TAG_URI)) != NULL) + if ((attr = ippFindAttribute(con->request, "printer-uri", IPP_TAG_URI)) != NULL && attr->group_tag == IPP_TAG_OPERATION) uri = attr; - else if ((attr = ippFindAttribute(con->request, "job-uri", IPP_TAG_URI)) != NULL) + else if ((attr = ippFindAttribute(con->request, "job-uri", IPP_TAG_URI)) != NULL && attr->group_tag == IPP_TAG_OPERATION) uri = attr; - else if (con->request->request.op.operation_id == CUPS_GET_PPD) - uri = ippFindAttribute(con->request, "ppd-name", IPP_TAG_NAME); + else if (con->request->request.op.operation_id == CUPS_GET_PPD && (attr = ippFindAttribute(con->request, "ppd-name", IPP_TAG_NAME)) != NULL && attr->group_tag == IPP_TAG_OPERATION) + uri = attr; else uri = NULL; @@ -2012,7 +2012,7 @@ add_job_subscriptions( host[HTTP_MAX_URI], /* Host portion of URI */ resource[HTTP_MAX_URI]; /* Resource portion of URI */ int port; /* Port portion of URI */ - + struct stat info; /* File information */ recipient = attr->values[0].string.text; @@ -2028,9 +2028,8 @@ add_job_subscriptions( return; } - snprintf(notifier, sizeof(notifier), "%s/notifier/%s", ServerBin, - scheme); - if (access(notifier, X_OK) || !strcmp(scheme, ".") || !strcmp(scheme, "..")) + snprintf(notifier, sizeof(notifier), "%s/notifier/%s", ServerBin, scheme); + if (access(notifier, X_OK) || stat(notifier, &info) || !S_ISREG(info.st_mode)) { send_ipp_status(con, IPP_NOT_POSSIBLE, _("notify-recipient-uri URI \"%s\" uses unknown " @@ -5756,7 +5755,7 @@ create_subscriptions( snprintf(notifier, sizeof(notifier), "%s/notifier/%s", ServerBin, scheme); - if (access(notifier, X_OK)) + if (access(notifier, X_OK) || !strcmp(scheme, ".") || !strcmp(scheme, "..")) { send_ipp_status(con, IPP_NOT_POSSIBLE, _("notify-recipient-uri URI \"%s\" uses unknown " diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c index aaebd3eed5..bd4eb0164a 100644 --- a/systemv/lpadmin.c +++ b/systemv/lpadmin.c @@ -608,10 +608,18 @@ main(int argc, /* I - Number of command-line arguments */ if (ppd_name && !strcmp(ppd_name, "raw")) { +#ifdef __APPLE__ + _cupsLangPuts(stderr, _("lpadmin: Raw queues are no longer supported on macOS.")); +#else _cupsLangPuts(stderr, _("lpadmin: Raw queues are deprecated and will stop working in a future version of CUPS.")); +#endif /* __APPLE__ */ if (device_uri && (!strncmp(device_uri, "ipp://", 6) || !strncmp(device_uri, "ipps://", 7)) && strstr(device_uri, "/printers/")) _cupsLangPuts(stderr, _("lpadmin: Use the 'everywhere' model for shared printers.")); + +#ifdef __APPLE__ + return (1); +#endif /* __APPLE__ */ } else if (ppd_name && !strcmp(ppd_name, "everywhere") && device_uri) { -- 2.47.2