From: Michael R Sweet Date: Tue, 21 Sep 2021 13:59:45 +0000 (-0400) Subject: Update mapping of media-source, media-type, and output-bin to match both PPD X-Git-Tag: v2.4b1~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a638ae1409cd62749106796c3aaaffe58be87711;p=thirdparty%2Fcups.git Update mapping of media-source, media-type, and output-bin to match both PPD and PWG names (Issue #238) Add printer-privacy-policy-uri, printer-mandatory-job-attributes, and printer-requested-job-attributes to PPD file. --- diff --git a/CHANGES.md b/CHANGES.md index b4d7e17a06..ab69945bbf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ Changes in OpenPrinting CUPS ============================ -CUPS v2.4rc1 (Pending) +CUPS v2.4-b1 (Pending) ---------------------- - Added support for CUPS running in a Snapcraft snap. @@ -57,6 +57,7 @@ CUPS v2.4rc1 (Pending) - Hardened `ippReadIO` to prevent invalid IPP messages from being propagated (Issue #195, Issue #196) - The scheduler now supports the "everywhere" model directly (Issue #201) +- Fixed some IPP Everywhere option mapping problems (Issue #238) - Fixed support for "job-hold-until" with the Restart-Job operation (Issue #250) - Documentation fixes (Issue #92, Issue #163, Issue #177, Issue #184) - Localization updates (Issue #123, Issue #129, Issue #134, Issue #146, diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c index d10e825cb6..ecce6af72f 100644 --- a/cups/ppd-cache.c +++ b/cups/ppd-cache.c @@ -2,7 +2,7 @@ * PPD cache implementation for CUPS. * * Copyright © 2021 by OpenPrinting. - * Copyright © 2010-2019 by Apple Inc. + * Copyright © 2010-2021 by Apple Inc. * * Licensed under Apache License v2.0. See the file "LICENSE" for more * information. @@ -2083,7 +2083,7 @@ _ppdCacheGetBin( for (i = 0; i < pc->num_bins; i ++) - if (!_cups_strcasecmp(output_bin, pc->bins[i].ppd)) + if (!_cups_strcasecmp(output_bin, pc->bins[i].ppd) || !_cups_strcasecmp(output_bin, pc->bins[i].pwg)) return (pc->bins[i].pwg); return (NULL); @@ -2770,7 +2770,7 @@ _ppdCacheGetSource( return (NULL); for (i = pc->num_sources, source = pc->sources; i > 0; i --, source ++) - if (!_cups_strcasecmp(input_slot, source->ppd)) + if (!_cups_strcasecmp(input_slot, source->ppd) || !_cups_strcasecmp(input_slot, source->pwg)) return (source->pwg); return (NULL); @@ -2799,7 +2799,7 @@ _ppdCacheGetType( return (NULL); for (i = pc->num_types, type = pc->types; i > 0; i --, type ++) - if (!_cups_strcasecmp(media_type, type->ppd)) + if (!_cups_strcasecmp(media_type, type->ppd) || !_cups_strcasecmp(media_type, type->pwg)) return (type->pwg); return (NULL); @@ -3259,6 +3259,45 @@ _ppdCreateFromIPP2( if (ippGetBoolean(ippFindAttribute(supported, "job-accounting-user-id-supported", IPP_TAG_BOOLEAN), 0)) cupsFilePuts(fp, "*cupsJobAccountingUserId: True\n"); + if ((attr = ippFindAttribute(supported, "printer-privacy-policy-uri", IPP_TAG_URI)) != NULL) + cupsFilePrintf(fp, "*cupsPrivacyURI: \"%s\"\n", ippGetString(attr, 0, NULL)); + + if ((attr = ippFindAttribute(supported, "printer-mandatory-job-attributes", IPP_TAG_KEYWORD)) != NULL) + { + char prefix = '\"'; // Prefix for string + + cupsFilePuts(fp, "*cupsMandatory: \""); + for (i = 0, count = ippGetCount(attr); i < count; i ++) + { + keyword = ippGetString(attr, i, NULL); + + if (strcmp(keyword, "attributes-charset") && strcmp(keyword, "attributes-natural-language") && strcmp(keyword, "printer-uri")) + { + cupsFilePrintf(fp, "%c%s", prefix, keyword); + prefix = ','; + } + } + cupsFilePuts(fp, "\"\n"); + } + + if ((attr = ippFindAttribute(supported, "printer-requested-job-attributes", IPP_TAG_KEYWORD)) != NULL) + { + char prefix = '\"'; // Prefix for string + + cupsFilePuts(fp, "*cupsRequested: \""); + for (i = 0, count = ippGetCount(attr); i < count; i ++) + { + keyword = ippGetString(attr, i, NULL); + + if (strcmp(keyword, "attributes-charset") && strcmp(keyword, "attributes-natural-language") && strcmp(keyword, "printer-uri")) + { + cupsFilePrintf(fp, "%c%s", prefix, keyword); + prefix = ','; + } + } + cupsFilePuts(fp, "\"\n"); + } + /* * Password/PIN printing... */ @@ -4316,7 +4355,7 @@ _ppdCreateFromIPP2( "TriplePortrait", "TripleLandscape", "TripleRevPortrait", - "TripleRevLandscape", + "TripleRevLandscape" "QuadPortrait", "QuadLandscape", "QuadRevPortrait",