]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Hold jobs using job-password for 15 seconds (Issue #1456) master
authorMichael R Sweet <msweet@msweet.org>
Mon, 15 Dec 2025 17:29:43 +0000 (12:29 -0500)
committerMichael R Sweet <msweet@msweet.org>
Mon, 15 Dec 2025 17:29:43 +0000 (12:29 -0500)
CHANGES.md
scheduler/ipp.c
test/testhp.ppd
test/testpin.ppd [new file with mode: 0644]
test/testps.ppd

index 0d4b19436f4b6a819823edb0a1fc54271dfb88a3..8b5e6ad54b057739da0f5002eea2b804ce72cdda 100644 (file)
@@ -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
index d8d1934d033ed2552c3a232c54693319e88e6d7b..3e75e62c248d39a81c4223e8454c06154bee2967 100644 (file)
@@ -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");
index 25d884ad528a3eb05f9aa6caf38fc20a321b9b98..953d5d5fcde55f587f8aa6102641789b60b747d0 100644 (file)
@@ -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.
 *%
 *% 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 (file)
index 0000000..edce188
--- /dev/null
@@ -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:    "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*PageSize Legal/US Legal:      "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+*PageSize Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
+*PageSize Tabloid/US Tabloid:  "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
+*PageSize A3/A3:               "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
+*PageSize A4/A4:               "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+*PageSize A5/A5:               "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
+*PageSize B5/B5 (JIS):         "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
+*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
+*PageSize Env10/Envelope #10:  "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
+*PageSize EnvC5/Envelope C5:   "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
+*PageSize EnvDL/Envelope DL:   "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
+*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 10 AnySetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/US Letter:  "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*PageRegion Legal/US Legal:    "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+*PageRegion Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
+*PageRegion Tabloid/US Tabloid:        "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
+*PageRegion A3/A3:             "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
+*PageRegion A4/A4:             "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+*PageRegion A5/A5:             "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
+*PageRegion B5/B5 (JIS):       "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
+*PageRegion Env10/Envelope #10:        "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>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:  "<</MediaType(Plain)/cupsMediaType 0>>setpagedevice"
+*MediaType Bond/Bond Paper:    "<</MediaType(Bond)/cupsMediaType 1>>setpagedevice"
+*MediaType Special/Special Paper: "<</MediaType(Special)/cupsMediaType 2>>setpagedevice"
+*MediaType Transparency/Transparency: "<</MediaType(Transparency)/cupsMediaType 3>>setpagedevice"
+*MediaType Glossy/Glossy Paper:        "<</MediaType(Glossy)/cupsMediaType 4>>setpagedevice"
+*CloseUI: *MediaType
+
+*OpenUI *InputSlot/Media Source: PickOne
+*OrderDependency: 10 AnySetup *InputSlot
+*DefaultInputSlot: Tray
+*InputSlot Tray/Tray: "<</cupsMediaPosition 1>>setpagedevice"
+*InputSlot Manual/Manual Feed: "<</cupsMediaPosition 2>>setpagedevice"
+*InputSlot Envelope/Envelope Feed: "<</cupsMediaPosition 3>>setpagedevice"
+*CloseUI: *InputSlot
+
+*OpenUI *Resolution/Output Resolution: PickOne
+*OrderDependency: 20 AnySetup *Resolution
+*DefaultResolution: 300dpi
+*Resolution 150dpi/150 DPI: "<</HWResolution[150 150]>>setpagedevice"
+*Resolution 300dpi/300 DPI: "<</HWResolution[300 300]>>setpagedevice"
+*Resolution 600dpi/600 DPI: "<</HWResolution[600 600]>>setpagedevice"
+*CloseUI: *Resolution
+
+*OpenUI *ColorModel/Output Mode: PickOne
+*OrderDependency: 10 AnySetup *ColorModel
+*DefaultColorModel: CMYK
+*ColorModel CMYK/CMYK Color: "<</cupsColorOrder 1/cupsColorSpace 8/cupsCompression 2>>setpagedevice"
+*ColorModel RGB/CMY Color: "<</cupsColorOrder 1/cupsColorSpace 4/cupsCompression 2>>setpagedevice"
+*ColorModel Gray/Grayscale: "<</cupsColorOrder 0/cupsColorSpace 3/cupsCompression 2>>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
index 59a8c70d3bd9b4c6112711ce21297e644b317834..c1415ff9cabffaebdd996c66185093e45b098f4a 100644 (file)
@@ -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.
 *%
 *% 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