From: Michael R Sweet Date: Mon, 15 Dec 2025 17:29:43 +0000 (-0500) Subject: Hold jobs using job-password for 15 seconds (Issue #1456) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4318d8b300fac9382cc186e94a32af9e23a5d97;p=thirdparty%2Fcups.git Hold jobs using job-password for 15 seconds (Issue #1456) --- diff --git a/CHANGES.md b/CHANGES.md index 0d4b19436f..8b5e6ad54b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -88,6 +88,8 @@ Changes in CUPS v2.5b1 (YYYY-MM-DD) from the PPD file (Issue #1388) - Updated the scheduler with a more efficient algorithm for determining the supported document formats for a printer (Issue #1392) +- Updated the scheduler to hold password/PIN jobs for 15 seconds before + releasing to the printer (Issue #1456) - Deprecated the "page-border" Job Template attribute (Issue #1020) - Removed the `cups-config` utility (use `pkg-config` instead) - Fixed use-after-free in `cupsdAcceptClient()` when we log warning during error diff --git a/scheduler/ipp.c b/scheduler/ipp.c index d8d1934d03..3e75e62c24 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -1700,6 +1700,18 @@ add_job(cupsd_client_t *con, /* I - Client connection */ job->hold_until = time(NULL) + MultipleOperationTimeout; job->state->values[0].integer = IPP_JSTATE_HELD; job->state_value = IPP_JSTATE_HELD; + + if (ippFindAttribute(job->attrs, "job-password", IPP_TAG_STRING)) + ippSetString(job->attrs, &job->reasons, 0, "job-password-specified"); + } + else if (ippFindAttribute(job->attrs, "job-password", IPP_TAG_STRING)) + { + // Issue #1456: Hold PIN/passcode print jobs for 15 seconds to allow iOS clients to show generated PIN... + job->hold_until = time(NULL) + 15; + job->state->values[0].integer = IPP_JSTATE_HELD; + job->state_value = IPP_JSTATE_HELD; + + ippSetString(job->attrs, &job->reasons, 0, "job-password-specified"); } else { @@ -9951,10 +9963,18 @@ send_document(cupsd_client_t *con, /* I - Client connection */ if (!attr || !strcmp(attr->values[0].string.text, "no-hold")) { - job->state->values[0].integer = IPP_JSTATE_PENDING; - job->state_value = IPP_JSTATE_PENDING; + if (ippFindAttribute(job->attrs, "job-password", IPP_TAG_STRING)) + { + // Issue #1456: Hold PIN/passcode print jobs for 15 seconds to allow iOS clients to show generated PIN... + job->hold_until = time(NULL) + 15; + } + else + { + job->state->values[0].integer = IPP_JSTATE_PENDING; + job->state_value = IPP_JSTATE_PENDING; - ippSetString(job->attrs, &job->reasons, 0, "none"); + ippSetString(job->attrs, &job->reasons, 0, "none"); + } } else ippSetString(job->attrs, &job->reasons, 0, "job-hold-until-specified"); diff --git a/test/testhp.ppd b/test/testhp.ppd index 25d884ad52..953d5d5fcd 100644 --- a/test/testhp.ppd +++ b/test/testhp.ppd @@ -2,7 +2,7 @@ *% *% Test HP PPD file for CUPS. *% -*% Copyright © 2020-2024 by OpenPrinting. +*% Copyright © 2020-2025 by OpenPrinting. *% Copyright © 2007-2018 by Apple Inc. *% Copyright © 1997-2005 by Easy Software Products. *% @@ -10,13 +10,13 @@ *% information. *% *FormatVersion: "4.3" -*FileVersion: "2.3" +*FileVersion: "2.5" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "TESTHP.PPD" -*Manufacturer: "ESP" -*Product: "(CUPS v2.3)" -*cupsVersion: 2.3 +*Manufacturer: "OpenPrinting" +*Product: "(CUPS v2.5)" +*cupsVersion: 2.5 *cupsManualCopies: True *cupsFilter: "application/vnd.cups-raster 50 rastertohp" *cupsFilter2: "application/vnd.cups-raster application/vnd.hp-pcl 50 rastertohp" diff --git a/test/testpin.ppd b/test/testpin.ppd new file mode 100644 index 0000000000..edce18864f --- /dev/null +++ b/test/testpin.ppd @@ -0,0 +1,184 @@ +*PPD-Adobe: "4.3" +*% +*% Test PIN PPD file for CUPS. +*% +*% Copyright © 2020-2025 by OpenPrinting. +*% Copyright © 2007-2018 by Apple Inc. +*% Copyright © 1997-2005 by Easy Software Products. +*% +*% Licensed under Apache License v2.0. See the file "LICENSE" for more +*% information. +*% +*FormatVersion: "4.3" +*FileVersion: "2.5" +*LanguageVersion: English +*LanguageEncoding: ISOLatin1 +*PCFileName: "TESTPIN.PPD" +*Manufacturer: "OpenPrinting" +*Product: "(CUPS v2.5)" +*cupsVersion: 2.5 +*cupsManualCopies: True +*cupsFilter: "application/vnd.cups-raster 50 rastertohp" +*cupsFilter2: "application/vnd.cups-raster application/vnd.hp-pcl 50 rastertohp" +*ModelName: "Test PIN Printer" +*ShortNickName: "Test PIN Printer" +*NickName: "Test PIN Printer CUPS v2.5" +*PSVersion: "(3010.000) 550" +*LanguageLevel: "3" +*ColorDevice: True +*DefaultColorSpace: RGB +*FileSystem: False +*Throughput: "1" +*LandscapeOrientation: Plus90 +*VariablePaperSize: False +*TTRasterizer: Type42 + +*cupsMandatory: "job-password job-password-encryption" +*cupsJobPassword: "111111" + +*UIConstraints: *PageSize Executive *InputSlot Envelope +*UIConstraints: *PageSize Letter *InputSlot Envelope +*UIConstraints: *PageSize Legal *InputSlot Envelope +*UIConstraints: *PageSize Tabloid *InputSlot Envelope +*UIConstraints: *PageSize A3 *InputSlot Envelope +*UIConstraints: *PageSize A4 *InputSlot Envelope +*UIConstraints: *PageSize A5 *InputSlot Envelope +*UIConstraints: *PageSize B5 *InputSlot Envelope +*UIConstraints: *Resolution 600dpi *ColorModel CMYK + +*OpenUI *PageSize/Media Size: PickOne +*OrderDependency: 10 AnySetup *PageSize +*DefaultPageSize: Letter +*PageSize Letter/US Letter: "<>setpagedevice" +*PageSize Legal/US Legal: "<>setpagedevice" +*PageSize Executive/US Executive: "<>setpagedevice" +*PageSize Tabloid/US Tabloid: "<>setpagedevice" +*PageSize A3/A3: "<>setpagedevice" +*PageSize A4/A4: "<>setpagedevice" +*PageSize A5/A5: "<>setpagedevice" +*PageSize B5/B5 (JIS): "<>setpagedevice" +*PageSize EnvISOB5/Envelope B5: "<>setpagedevice" +*PageSize Env10/Envelope #10: "<>setpagedevice" +*PageSize EnvC5/Envelope C5: "<>setpagedevice" +*PageSize EnvDL/Envelope DL: "<>setpagedevice" +*PageSize EnvMonarch/Envelope Monarch: "<>setpagedevice" +*CloseUI: *PageSize + +*OpenUI *PageRegion: PickOne +*OrderDependency: 10 AnySetup *PageRegion +*DefaultPageRegion: Letter +*PageRegion Letter/US Letter: "<>setpagedevice" +*PageRegion Legal/US Legal: "<>setpagedevice" +*PageRegion Executive/US Executive: "<>setpagedevice" +*PageRegion Tabloid/US Tabloid: "<>setpagedevice" +*PageRegion A3/A3: "<>setpagedevice" +*PageRegion A4/A4: "<>setpagedevice" +*PageRegion A5/A5: "<>setpagedevice" +*PageRegion B5/B5 (JIS): "<>setpagedevice" +*PageRegion EnvISOB5/Envelope B5: "<>setpagedevice" +*PageRegion Env10/Envelope #10: "<>setpagedevice" +*PageRegion EnvC5/Envelope C5: "<>setpagedevice" +*PageRegion EnvDL/Envelope DL: "<>setpagedevice" +*PageRegion EnvMonarch/Envelope Monarch: "<>setpagedevice" +*CloseUI: *PageRegion + +*DefaultImageableArea: Letter +*ImageableArea Letter/US Letter: "18 36 594 756" +*ImageableArea Legal/US Legal: "18 36 594 972" +*ImageableArea Executive/US Executive: "18 36 504 684" +*ImageableArea Tabloid/US Tabloid: "18 36 774 1188" +*ImageableArea A3/A3: "18 36 824 1155" +*ImageableArea A4/A4: "18 36 577 806" +*ImageableArea A5/A5: "18 36 403 559" +*ImageableArea B5/JIS B5: "18 36 498 693" +*ImageableArea EnvISOB5/B5 (ISO): "18 36 463 673" +*ImageableArea Env10/Com-10: "18 36 279 648" +*ImageableArea EnvC5/EnvC5: "18 36 441 613" +*ImageableArea EnvDL/EnvDL: "18 36 294 588" +*ImageableArea EnvMonarch/Envelope Monarch: "18 36 261 504" + +*DefaultPaperDimension: Letter +*PaperDimension Letter/US Letter: "612 792" +*PaperDimension Legal/US Legal: "612 1008" +*PaperDimension Executive/US Executive: "522 756" +*PaperDimension Tabloid/US Tabloid: "792 1224" +*PaperDimension A3/A3: "842 1191" +*PaperDimension A4/A4: "595 842" +*PaperDimension A5/A5: "421 595" +*PaperDimension B5/B5 (JIS): "516 729" +*PaperDimension EnvISOB5/Envelope B5: "499 709" +*PaperDimension Env10/Envelope #10: "297 684" +*PaperDimension EnvC5/Envelope C5: "459 649" +*PaperDimension EnvDL/Envelope DL: "312 624" +*PaperDimension EnvMonarch/Envelope Monarch: "279 540" + +*OpenUI *MediaType/Media Type: PickOne +*OrderDependency: 10 AnySetup *MediaType +*DefaultMediaType: Plain +*MediaType Plain/Plain Paper: "<>setpagedevice" +*MediaType Bond/Bond Paper: "<>setpagedevice" +*MediaType Special/Special Paper: "<>setpagedevice" +*MediaType Transparency/Transparency: "<>setpagedevice" +*MediaType Glossy/Glossy Paper: "<>setpagedevice" +*CloseUI: *MediaType + +*OpenUI *InputSlot/Media Source: PickOne +*OrderDependency: 10 AnySetup *InputSlot +*DefaultInputSlot: Tray +*InputSlot Tray/Tray: "<>setpagedevice" +*InputSlot Manual/Manual Feed: "<>setpagedevice" +*InputSlot Envelope/Envelope Feed: "<>setpagedevice" +*CloseUI: *InputSlot + +*OpenUI *Resolution/Output Resolution: PickOne +*OrderDependency: 20 AnySetup *Resolution +*DefaultResolution: 300dpi +*Resolution 150dpi/150 DPI: "<>setpagedevice" +*Resolution 300dpi/300 DPI: "<>setpagedevice" +*Resolution 600dpi/600 DPI: "<>setpagedevice" +*CloseUI: *Resolution + +*OpenUI *ColorModel/Output Mode: PickOne +*OrderDependency: 10 AnySetup *ColorModel +*DefaultColorModel: CMYK +*ColorModel CMYK/CMYK Color: "<>setpagedevice" +*ColorModel RGB/CMY Color: "<>setpagedevice" +*ColorModel Gray/Grayscale: "<>setpagedevice" +*CloseUI: *ColorModel + +*DefaultFont: Courier +*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM +*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM +*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM +*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM +*Font Bookman-Demi: Standard "(001.004S)" Standard ROM +*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM +*Font Bookman-Light: Standard "(001.004S)" Standard ROM +*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM +*Font Courier: Standard "(002.004S)" Standard ROM +*Font Courier-Bold: Standard "(002.004S)" Standard ROM +*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM +*Font Courier-Oblique: Standard "(002.004S)" Standard ROM +*Font Helvetica: Standard "(001.006S)" Standard ROM +*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM +*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM +*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM +*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM +*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM +*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM +*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM +*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM +*Font Palatino-Bold: Standard "(001.005S)" Standard ROM +*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM +*Font Palatino-Italic: Standard "(001.005S)" Standard ROM +*Font Palatino-Roman: Standard "(001.005S)" Standard ROM +*Font Symbol: Special "(001.007S)" Special ROM +*Font Times-Bold: Standard "(001.007S)" Standard ROM +*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM +*Font Times-Italic: Standard "(001.007S)" Standard ROM +*Font Times-Roman: Standard "(001.007S)" Standard ROM +*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM +*Font ZapfDingbats: Special "(001.004S)" Standard ROM diff --git a/test/testps.ppd b/test/testps.ppd index 59a8c70d3b..c1415ff9ca 100644 --- a/test/testps.ppd +++ b/test/testps.ppd @@ -2,7 +2,7 @@ *% *% Test PS PPD file for CUPS. *% -*% Copyright © 2020-2024 by OpenPrinting. +*% Copyright © 2020-2025 by OpenPrinting. *% Copyright © 2007-2018 by Apple Inc. *% Copyright © 1997-2005 by Easy Software Products. *% @@ -10,15 +10,15 @@ *% information. *% *FormatVersion: "4.3" -*FileVersion: "2.3" +*FileVersion: "2.5" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "TESTPS.PPD" -*Manufacturer: "Apple" -*Product: "(CUPS v2.3)" +*Manufacturer: "OpenPrinting" +*Product: "(CUPS v2.5)" *ModelName: "Test PS Printer" *ShortNickName: "Test PS Printer" -*NickName: "Test PS Printer CUPS v2.3" +*NickName: "Test PS Printer CUPS v2.5" *PSVersion: "(3010.000) 550" *LanguageLevel: "3" *ColorDevice: True