From: Michael R Sweet Date: Sun, 7 Mar 2021 22:44:06 +0000 (-0500) Subject: Add ReadyPaperSizes directive for cupsd.conf. X-Git-Tag: v2.4b1~188^2~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe80a7e9f38eed20313431d6790f12ea30ee603a;p=thirdparty%2Fcups.git Add ReadyPaperSizes directive for cupsd.conf. --- diff --git a/CHANGES.md b/CHANGES.md index 33fffc30a5..a26671c06f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,8 +4,8 @@ Changes in OpenPrinting CUPS CUPS v2.4rc1 (Pending) ---------------------- -- Added support for CUPS running in a snapcraft snap. -- Added extra check for administrative inquiries from snapped clients. +- Added support for CUPS running in a Snapcraft snap. +- Added support for AirPrint and Mopria clients (Issue #105) - Fixed Kerberos authentication for the web interface (Issue #19) - The ZPL sample driver now supports more "standard" label sizes (Issue #70) - The IPP backend did not return the correct status code when a job was canceled diff --git a/man/cupsd.conf.5 b/man/cupsd.conf.5 index 897917405a..f32f748591 100644 --- a/man/cupsd.conf.5 +++ b/man/cupsd.conf.5 @@ -8,7 +8,7 @@ .\" Licensed under Apache License v2.0. See the file "LICENSE" for more .\" information. .\" -.TH cupsd.conf 5 "CUPS" "2021-03-06" "OpenPrinting" +.TH cupsd.conf 5 "CUPS" "2021-03-07" "OpenPrinting" .SH NAME cupsd.conf \- server configuration file for cups .SH DESCRIPTION @@ -370,6 +370,12 @@ Specifies whether the job history is preserved after a job is printed. If a numeric value is specified, the job history is preserved for the indicated number of seconds after printing. If "Yes", the job history is preserved until the MaxJobs limit is reached. The default is "Yes". +.\"#ReadyPaperSizes +.TP 5 +\fBReadyPaperSizes \fIsizename[,...]\fR +Specifies a list of potential paper sizes that are reported as "ready" (loaded). +The actual list will only contain sizes that each printer supports. +The default is "Letter,Legal,Tabloid,4x6,Env10" for North America and "A3,A4,A5,A6,EnvDL" elsewhere. .\"#ReloadTimeout .TP 5 \fBReloadTimeout \fIseconds\fR diff --git a/scheduler/conf.c b/scheduler/conf.c index 1008e2abf1..0fdbd8d721 100644 --- a/scheduler/conf.c +++ b/scheduler/conf.c @@ -624,6 +624,8 @@ cupsdReadConfiguration(void) cupsdSetString(&DefaultLanguage, language->language); cupsdClearString(&DefaultPaperSize); + cupsArrayDelete(ReadyPaperSizes); + ReadyPaperSizes = NULL; cupsdSetString(&TempDir, NULL); @@ -1274,6 +1276,17 @@ cupsdReadConfiguration(void) cupsdSetString(&DefaultPaperSize, "A4"); } + if (!ReadyPaperSizes) + { + // Build default list of common sizes for North America and worldwide... + if (!strcasecmp(DefaultPaperSize, "Letter")) + ReadyPaperSizes = _cupsArrayNewStrings("Letter,Legal,Tabloid,4x6,Env10", ','); + else if (!strcasecmp(DefaultPaperSize, "A4")) + ReadyPaperSizes = _cupsArrayNewStrings("A4,A3,A5,A6,EnvDL", ','); + else + ReadyPaperSizes = _cupsArrayNewStrings(DefaultPaperSize, ','); + } + /* * Update classification setting as needed... */ @@ -3318,6 +3331,17 @@ read_cupsd_conf(cups_file_t *fp) /* I - File to read from */ cupsdLogMessage(CUPSD_LOG_WARN, "Unknown LogTimeFormat %s on line %d of %s.", value, linenum, ConfigurationFile); } + else if (!_cups_strcasecmp(line, "ReadyPaperSizes") && value) + { + /* + * ReadyPaperSizes sizename[,sizename,...] + */ + + if (ReadyPaperSizes) + _cupsArrayAddStrings(ReadyPaperSizes, value, ','); + else + ReadyPaperSizes = _cupsArrayNewStrings(value, ','); + } else if (!_cups_strcasecmp(line, "ServerTokens") && value) { /* diff --git a/scheduler/conf.h b/scheduler/conf.h index 5a2f8bdb9a..adc205a9a7 100644 --- a/scheduler/conf.h +++ b/scheduler/conf.h @@ -148,6 +148,8 @@ VAR char *AccessLog VALUE(NULL), /* Remote root user */ *Classification VALUE(NULL); /* Classification of system */ +VAR cups_array_t *ReadyPaperSizes VALUE(NULL); + /* List of paper sizes to list as ready */ VAR uid_t User VALUE(1), /* User ID for server */ RunUser VALUE(0); diff --git a/xcode/CUPS.xcodeproj/project.pbxproj b/xcode/CUPS.xcodeproj/project.pbxproj index 4208d10a21..51bbfc5562 100644 --- a/xcode/CUPS.xcodeproj/project.pbxproj +++ b/xcode/CUPS.xcodeproj/project.pbxproj @@ -3455,8 +3455,6 @@ 724379C41333FFC7009631B9 /* usb-darwin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "usb-darwin.c"; path = "../backend/usb-darwin.c"; sourceTree = ""; }; 724379C51333FFC7009631B9 /* usb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = usb.c; path = ../backend/usb.c; sourceTree = ""; }; 724379CA1334000E009631B9 /* ieee1284.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ieee1284.c; path = ../backend/ieee1284.c; sourceTree = ""; }; - 72496E161A13A03B0051899C /* org.cups.cups-lpd.socket */ = {isa = PBXFileReference; lastKnownFileType = text; name = "org.cups.cups-lpd.socket"; path = "../scheduler/org.cups.cups-lpd.socket"; sourceTree = SOURCE_ROOT; }; - 72496E171A13A03B0051899C /* org.cups.cups-lpdAT.service.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = "org.cups.cups-lpdAT.service.in"; path = "../scheduler/org.cups.cups-lpdAT.service.in"; sourceTree = SOURCE_ROOT; }; 724FA5351CC0370C0092477B /* testadmin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testadmin; sourceTree = BUILT_PRODUCTS_DIR; }; 724FA5481CC037370092477B /* testarray */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testarray; sourceTree = BUILT_PRODUCTS_DIR; }; 724FA55B1CC037500092477B /* testcache */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testcache; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -3601,9 +3599,6 @@ 72E65BD318DC7A9800097E89 /* spec-ppd.header */ = {isa = PBXFileReference; lastKnownFileType = text; name = "spec-ppd.header"; path = "../filter/spec-ppd.header"; sourceTree = ""; }; 72E65BD418DC7A9800097E89 /* spec-ppd.shtml */ = {isa = PBXFileReference; lastKnownFileType = text.html.other; name = "spec-ppd.shtml"; path = "../filter/spec-ppd.shtml"; sourceTree = ""; }; 72E65BD518DC818400097E89 /* org.cups.cups-lpd.plist.in */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = "org.cups.cups-lpd.plist.in"; path = "../scheduler/org.cups.cups-lpd.plist.in"; sourceTree = SOURCE_ROOT; }; - 72E65BD618DC818400097E89 /* org.cups.cupsd.path.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = org.cups.cupsd.path.in; path = ../scheduler/org.cups.cupsd.path.in; sourceTree = SOURCE_ROOT; }; - 72E65BD718DC818400097E89 /* org.cups.cupsd.service.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = org.cups.cupsd.service.in; path = ../scheduler/org.cups.cupsd.service.in; sourceTree = SOURCE_ROOT; }; - 72E65BD818DC818400097E89 /* org.cups.cupsd.socket.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = org.cups.cupsd.socket.in; path = ../scheduler/org.cups.cupsd.socket.in; sourceTree = SOURCE_ROOT; }; 72E65BD918DC850A00097E89 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = ../Makefile; sourceTree = ""; }; 72E65BDC18DC852700097E89 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = ../scheduler/Makefile; sourceTree = SOURCE_ROOT; }; 72E65BDE18DCA35700097E89 /* CHANGES.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CHANGES.md; path = ../CHANGES.md; sourceTree = ""; xcLanguageSpecificationIdentifier = ""; }; @@ -5064,12 +5059,7 @@ 72E65BDC18DC852700097E89 /* Makefile */, 7226369B18AE6D19004ED309 /* org.cups.cups-lpd.plist */, 72E65BD518DC818400097E89 /* org.cups.cups-lpd.plist.in */, - 72496E171A13A03B0051899C /* org.cups.cups-lpdAT.service.in */, - 72496E161A13A03B0051899C /* org.cups.cups-lpd.socket */, - 72E65BD618DC818400097E89 /* org.cups.cupsd.path.in */, 7226369C18AE6D19004ED309 /* org.cups.cupsd.plist */, - 72E65BD718DC818400097E89 /* org.cups.cupsd.service.in */, - 72E65BD818DC818400097E89 /* org.cups.cupsd.socket.in */, 72220F6913330B0C00FCA411 /* auth.c */, 72220F6A13330B0C00FCA411 /* auth.h */, 72220F6B13330B0C00FCA411 /* banners.c */,