Comparar commits
180 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 84c97c051d | |||
| 5f67be43fa | |||
| b59756883a | |||
| 6daeebb5ac | |||
| 2bad6aac2f | |||
| 9d72065fa9 | |||
| 75d3f11945 | |||
| 6bebebe247 | |||
| 1d598e87db | |||
| 3645e5efa7 | |||
| e8953be355 | |||
| 782bcf6974 | |||
| 3d7ece43ea | |||
| 290404655f | |||
| c59948f6fb | |||
| b237ae81d2 | |||
| 82c4785a4c | |||
| 9113651bca | |||
| 3034dcc946 | |||
| 2aee052bf5 | |||
| 8e47ac0199 | |||
| 30c8d1abb2 | |||
| 5e18690298 | |||
| bec850697a | |||
| 4ffdbc48d8 | |||
| accd26d222 | |||
| 08b48df256 | |||
| bb4172dade | |||
| afe94dff9d | |||
| 1f71721001 | |||
| 18a1649286 | |||
| 58c3683023 | |||
| 303be29243 | |||
| 275af5ac7b | |||
| d821d89415 | |||
| 6579c998c4 | |||
| 1377fb858c | |||
| f9ee3b81e1 | |||
| 7e50a735a8 | |||
| 56b62a3b54 | |||
| 02773ede84 | |||
| ec9996719f | |||
| affaf0737f | |||
| 49fa4983f2 | |||
| 34be0e8038 | |||
| ce0d9679a4 | |||
| fad821594f | |||
| f8913c6d2c | |||
| a75c0e5961 | |||
| 5ee613bbc6 | |||
| 02c88e673e | |||
| 46a7b416ee | |||
| c61b78bd84 | |||
| 0ae5b012b2 | |||
| 15bba96c30 | |||
| bea3713442 | |||
| 5639a7b41c | |||
| 360e815a88 | |||
| c00282bb43 | |||
| 3a16bd9c9d | |||
| a7cdcd19b8 | |||
| 79424d8b9a | |||
| 5889fea75a | |||
| 16389be3ba | |||
| f97678f279 | |||
| 979804902c | |||
| b889560c05 | |||
| c9e9d0e810 | |||
| a5dd746bd0 | |||
| 6b33281c3e | |||
| 9554d4e748 | |||
| c0a47c1101 | |||
| 4cf66fef48 | |||
| b17b635a37 | |||
| 5d8b7d2665 | |||
| e4e371946b | |||
| 46d22fe908 | |||
| 9d4ae311cb | |||
| 2cf3a36a4e | |||
| fd2f0a7af7 | |||
| aa2a77dec8 | |||
| f0f4e0366c | |||
| 4279822fe4 | |||
| c6990c1ed5 | |||
| c31737b031 | |||
| 2d947886ad | |||
| 116c301f23 | |||
| b908d72cac | |||
| 2cb1fda9fe | |||
| 0728c89bcf | |||
| 123cfe0202 | |||
| d2123aee55 | |||
| ea4dcf9ff4 | |||
| b39dd420c6 | |||
| 5614f45d77 | |||
| 5229ea1a41 | |||
| b72c5bf2ed | |||
| befbadcef6 | |||
| 7b0a28e38f | |||
| e78c14f7ea | |||
| e146105294 | |||
| e37405ea8e | |||
| 5535551fd9 | |||
| 7f14a29798 | |||
| 4b16c717e5 | |||
| 240a27f93b | |||
| 75e1a17cad | |||
| 40cc612af4 | |||
| 9449dd948a | |||
| 2793a478d0 | |||
| 5b6caf71b8 | |||
| b10aebb1d3 | |||
| 9964a31a77 | |||
| 7c7347a346 | |||
| b337f966e8 | |||
| e9b2d701da | |||
| 91d748b919 | |||
| fa76bc3dc0 | |||
| 4f272af7bb | |||
| b770b18d0f | |||
| b0a1b229b3 | |||
| 997db40489 | |||
| 07911378c0 | |||
| 345e10ca71 | |||
| 41c0a57318 | |||
| 10f9350b7e | |||
| 03bc3ef4c2 | |||
| 7e7a13a32e | |||
| 60716f946c | |||
| e34d348250 | |||
| ada3421240 | |||
| a2a13afb48 | |||
| 259b03bc46 | |||
| a375587b8c | |||
| 0bc1a539f4 | |||
| 86390cbf57 | |||
| ced9dda826 | |||
| e9faaeef18 | |||
| c9dbe83d17 | |||
| e3b9d1f520 | |||
| 9f573d7be9 | |||
| 5cc8588e8c | |||
| f198f7e1e7 | |||
| 5e59cd062f | |||
| bee711586d | |||
| e7729c5a14 | |||
| 9eb416ee89 | |||
| b74b285e47 | |||
| 48dfd9a9a2 | |||
| 4174429905 | |||
| 13be9452da | |||
| a9357c9da4 | |||
| 44b3f16133 | |||
| c536b6c583 | |||
| 03d3907a33 | |||
| 76ae98d657 | |||
| 6d086e08e4 | |||
| 49f495c32e | |||
| f8a5ad9bde | |||
| 07cb72471a | |||
| b94f7488e8 | |||
| d2d605ff77 | |||
| 6eda776e8a | |||
| a621d151e7 | |||
| 3a1e6b10c5 | |||
| 7a0e5acde2 | |||
| c5755caf42 | |||
| e44bdfe7e3 | |||
| b2f85109da | |||
| fb963b8dd1 | |||
| fdc80a913f | |||
| 1a9743f9d7 | |||
| 534dfe8e94 | |||
| f1175a5a9d | |||
| db5424ea51 | |||
| cac6b6562c | |||
| b67c2dd202 | |||
| b3f6f8d202 | |||
| 4fac83763d | |||
| 2650d637dc |
@@ -49,6 +49,7 @@ cups/testcreds
|
||||
cups/testcups
|
||||
cups/testdest
|
||||
cups/testfile
|
||||
cups/testgetdests
|
||||
cups/testhttp
|
||||
cups/testi18n
|
||||
cups/testipp
|
||||
@@ -70,6 +71,7 @@ filter/rastertohp
|
||||
filter/rastertolabel
|
||||
filter/rastertopwg
|
||||
filter/test.raster
|
||||
filter/testclient
|
||||
filter/testraster
|
||||
locale/checkpo
|
||||
locale/po2strings
|
||||
|
||||
+156
-9
@@ -1,7 +1,154 @@
|
||||
CHANGES - 2.2.4 - 2017-06-30
|
||||
CHANGES - 2.2.7 - 2018-03-22
|
||||
============================
|
||||
|
||||
CHANGES IN CUPS V2.2.4
|
||||
|
||||
Changes in CUPS v2.2.7
|
||||
----------------------
|
||||
|
||||
- NOTICE: Raw print queues are now deprecated (Issue #5269)
|
||||
- Fixed an Avahi crash bug in the scheduler (Issue #5268)
|
||||
- The IPP Everywhere PPD generator did not include the `cupsJobPassword`
|
||||
keyword, when supported (Issue #5265)
|
||||
- Systemd did not restart cupsd when configuration changes were made that
|
||||
required a restart (Issue #5263)
|
||||
- The Lexmark Optra E310 printer needs the "no-reattach" USB quirk rule
|
||||
(Issue #5259)
|
||||
- The scheduler could crash while adding an IPP Everywhere printer (Issue #5258)
|
||||
- Label printers supported by the rastertolabel driver don't support SNMP, so
|
||||
don't delay printing to test it (Issue #5256)
|
||||
- Fixed a compile issue when PAM is not available (Issue #5253)
|
||||
- Documentation fixes (Issue #5252)
|
||||
- Star Micronics printers need the "unidir" USB quirk rule (Issue #5251)
|
||||
- The scheduler now supports using temporary print queues for older IPP/1.1
|
||||
print queues like those shared by CUPS 1.3 and earlier (Issue #5241)
|
||||
- Fixed printing to some IPP Everywhere printers (Issue #5238)
|
||||
- Kerberized printing to another CUPS server did not work correctly
|
||||
(Issue #5233)
|
||||
- The `cupsRasterWritePixels` function did not correctly swap bytes for some
|
||||
formats (Issue #5225)
|
||||
- Added a USB quirk rule for Canon MP280 series printers (Issue #5221)
|
||||
- The `ppdInstallableConflict` tested too many constraints (Issue #5213)
|
||||
- More fixes for printing to old CUPS servers (Issue #5211)
|
||||
- The `cupsCopyDest` function now correctly copies the `is_default` value
|
||||
(Issue #5208)
|
||||
- The scheduler did not work with older versions of uClibc (Issue #5188)
|
||||
- The scheduler now substitutes default values for invalid job attributes when
|
||||
running in "relaxed conformance" mode (Issue #5186)
|
||||
- Fixed PAM module detection and added support for the common PAM definitions
|
||||
(Issue #5185)
|
||||
- Fixed a journald support bug in the scheduler (Issue #5181)
|
||||
- The cups-driverd program incorrectly stopped scanning PPDs as soon as a loop
|
||||
was seen (Issue #5170)
|
||||
- Fixed group validation on OpenBSD (Issue #5166)
|
||||
- Fixed the `ippserver` sample code when threading is disabled or unavailable
|
||||
(Issue #5154)
|
||||
- The `cupsEnumDests` function did not include options from the lpoptions files
|
||||
(Issue #5144)
|
||||
- The `SSLOptions` directive now supports `MinTLS` and `MaxTLS` options to
|
||||
control the minimum and maximum TLS versions that will be allowed,
|
||||
respectively (Issue #5119)
|
||||
- The scheduler did not write out dirty configuration and state files if there
|
||||
were open client connections (Issue #5118)
|
||||
- The `lpadmin` command now provides a better error message when an unsupported
|
||||
System V interface script is used (Issue #5111)
|
||||
- The `lp` and `lpr` commands now provide better error messages when the default
|
||||
printer cannot be found (Issue #5096)
|
||||
- No longer support backslash, question mark, or quotes in printer names
|
||||
(Issue #4966)
|
||||
- The CUPS library now supports the latest HTTP Digest authentication
|
||||
specification including support for SHA-256 (Issue #4862)
|
||||
- The `lpstat` command now reports when new jobs are being held (Issue #4761)
|
||||
- The `lpoptions` command incorrectly saved default options (Issue #4717)
|
||||
- The `ppdLocalizeIPPReason` function incorrectly returned a localized version
|
||||
of "none" (rdar://36566269)
|
||||
- TLS connections now properly timeout (rdar://34938533)
|
||||
- The IPP backend did not properly detect failed PDF prints (rdar://34055474)
|
||||
- Temporary files are now placed in the correct directory for sandboxed
|
||||
applications on macOS (rdar://problem/37789645)
|
||||
|
||||
|
||||
Changes in CUPS v2.2.6
|
||||
----------------------
|
||||
|
||||
- DBUS notifications could crash the scheduler (Issue #5143)
|
||||
- Added USB quirks rules for Canon MP540 and Samsung ML-2160 (Issue #5148)
|
||||
- Fixed TLS cipher suite selection with GNU TLS (Issue #5145, Issue #5150)
|
||||
- Localization updates (Issue #5152)
|
||||
|
||||
|
||||
Changes in CUPS v2.2.5
|
||||
----------------------
|
||||
|
||||
- The scheduler's `-t` option did not force all errors to the standard error
|
||||
file, making debugging of configuration problems hard (Issue #5041)
|
||||
- Fixed a typo in the CUPS Programming Manual (Issue #5042)
|
||||
- Fixed RPM packaging issue (Issue #5043, Issue #5044)
|
||||
- The `cupsGetDests` function incorrectly returned an empty list of printers if
|
||||
there was no default printer (Issue #5046)
|
||||
- The `cupsGetDests` function waited too long for network printers (Issue #5049)
|
||||
- Libtool support was completely broken with current libtool versions that use
|
||||
an incompatible command-line syntax (Issue #5050)
|
||||
- Fixed a build issue with `--enable-mallinfo` (Issue #5051)
|
||||
- The ippserver test program contained a deadlock issue (Issue #5054)
|
||||
- The `cupsLocalizeDest*` functions did not provide base localizations for
|
||||
all registered IPP attributes and values (Issue #5056)
|
||||
- The --enable-libtool configure option requires a path to the libtool program,
|
||||
but doesn't document or check for it (Issue #5062)
|
||||
- Fixed the `SSLOptions DenyCBC` option when using GNU TLS (Issue #5065)
|
||||
- Fixed the `ServerTokens None` option (Issue #5065)
|
||||
- Fixed the default `ServerAlias` value from `ServerName` (Issue #5072)
|
||||
- Fixed the adminurl field in the TXT record for fully-qualified `ServerName`
|
||||
values (Issue #5074)
|
||||
- The scheduler now creates a PID file when not running on demand with a modern
|
||||
service launcher (Issue #5080)
|
||||
- The web interface did not support newer language identifiers used by Microsoft
|
||||
web browsers (Issue #5803)
|
||||
- Updated the cups-files.conf and cupsd.conf file documentation for missing
|
||||
directives (Issue #5084)
|
||||
- Fixed an Avahi-related crash bug in the scheduler (Issue #5085, Issue #5086)
|
||||
- Fixed the interactions between the "print-quality" and "cupsPrintQuality"
|
||||
options (Issue #5090)
|
||||
- The IPP Everywhere PPD generator now sorts the supported resolutions before
|
||||
choosing them for draft, normal, and best quality modes (Issue #5091)
|
||||
- Fixed the localization unit test on Linux (Issue #5097)
|
||||
- The CUPS library did not reuse domain sockets (Issue #5098)
|
||||
- Fixed the "make check" target for some environments (Issue #5099)
|
||||
- The scheduler woke up once per second to remove old temporary queues
|
||||
(Issue #5100)
|
||||
- Added USB quirk rule for Kyocera printer (Issue #5102, Issue #5103)
|
||||
- Re-documented the limits of `file:///...` device URIs and moved the FileDevice
|
||||
directive in `cups-files.conf` to the list of deprecated configuration
|
||||
directives (Issue #5117)
|
||||
- Added USB quirk rule for HP LaserJet 1160 printer (Issue #5121)
|
||||
- Fixed the script interpreter detection in the configure script (Issue #5122)
|
||||
- The network backends now retry on more error conditions (Issue #5123)
|
||||
- Added a French translation of the web interface (Issue #5134)
|
||||
- `cupsGetDests2` was not using the supplied HTTP connection (Issue #5135)
|
||||
- `httpAddrConnect` leaked sockets in certain circumstances, causing some
|
||||
printers to hang (rdar://31965686)
|
||||
- Fixed an issue with Chinese localizations on macOS (rdar://32419311)
|
||||
- The IPP backend now always sends the "finishings" attribute for printers that
|
||||
support it because otherwise the client cannot override printer defaults
|
||||
(rdar://33169732)
|
||||
- The `cupsGetNamedDest` function did not use the local default printer
|
||||
(rdar://33228500)
|
||||
- The IPP backend incorrectly sent the "job-pages-per-set" attribute to PDF
|
||||
printers (rdar://33250434)
|
||||
- Fixed the `cups.strings` file that is used on macOS (rdar://33287650)
|
||||
- CUPS now sends the `Date` HTTP header in IPP requests (rdar://33302034)
|
||||
- The `ippCopyAttribute` function did not copy out-of-band values correctly
|
||||
(rdar://33688003)
|
||||
- Fixed the localization fallback code on macOS (rdar://33583699)
|
||||
- The scheduler did not run with a high enough priority, causing problems on
|
||||
busy systems (rdar://33789342)
|
||||
- Added support for Japanese Kaku 1 envelope size (rdar://34774110)
|
||||
- The `ipptool` program's `-P` option did not work correctly.
|
||||
- The `ipptool` program did not compare URI scheme or hostname components
|
||||
correctly for the WITH-ALL-HOSTNAMES, WITH-ALL-SCHEMES, WITH-HOSTNAME, or
|
||||
WITH-SCHEME predicates.
|
||||
|
||||
|
||||
Changes in CUPS v2.2.4
|
||||
----------------------
|
||||
|
||||
- The scheduler did not remove old job files (Issue #4987)
|
||||
@@ -39,7 +186,7 @@ CHANGES IN CUPS V2.2.4
|
||||
`DenyCBC` and `DenyTLS1.0` options (Issue #5037)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.2.3
|
||||
Changes in CUPS v2.2.3
|
||||
----------------------
|
||||
|
||||
- The IPP backend could get into an infinite loop for certain errors, causing a
|
||||
@@ -67,7 +214,7 @@ CHANGES IN CUPS V2.2.3
|
||||
- Fixed some localization issues on macOS (<rdar://problem/27245567>)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.2.2
|
||||
Changes in CUPS v2.2.2
|
||||
----------------------
|
||||
|
||||
- Fixed some issues with the Zebra ZPL printer driver (Issue #4898)
|
||||
@@ -97,7 +244,7 @@ CHANGES IN CUPS V2.2.2
|
||||
- Updated packaging files (Issue #4940)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.2.1
|
||||
Changes in CUPS v2.2.1
|
||||
----------------------
|
||||
|
||||
- Added "CreateSelfSignedCerts" directive for cups-files.conf to control whether
|
||||
@@ -111,7 +258,7 @@ CHANGES IN CUPS V2.2.1
|
||||
- Updated localizations (PR #4877, PR #4886)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.2.0
|
||||
Changes in CUPS v2.2.0
|
||||
----------------------
|
||||
|
||||
- Normalized the TLS certificate validation code and added additional error
|
||||
@@ -122,7 +269,7 @@ CHANGES IN CUPS V2.2.0
|
||||
- http*Connect did not return early when all addresses failed (Issue #4870)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.2rc1
|
||||
Changes in CUPS v2.2rc1
|
||||
-----------------------
|
||||
|
||||
- Updated the list of supported IPP Everywhere media types.
|
||||
@@ -135,14 +282,14 @@ CHANGES IN CUPS V2.2rc1
|
||||
- Updated localizations (Issue #4846, PR #4858)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.2b2
|
||||
Changes in CUPS v2.2b2
|
||||
----------------------
|
||||
|
||||
- Added Upstart support (PR #4825)
|
||||
- CUPS now supports Let's Encrypt certificates on Linux.
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.2b1
|
||||
Changes in CUPS v2.2b1
|
||||
----------------------
|
||||
|
||||
- All CUPS commands now support POSIX options (Issue #4813)
|
||||
|
||||
+34
-22
@@ -1,14 +1,28 @@
|
||||
INSTALL - CUPS v2.2.4 - 2017-06-30
|
||||
INSTALL - CUPS v2.2.7 - 2018-03-22
|
||||
==================================
|
||||
|
||||
This file describes how to compile and install CUPS from source code. For more
|
||||
information on CUPS see the file called "README.txt". A complete change log can
|
||||
be found in "CHANGES.txt".
|
||||
information on CUPS see the file called "README.md". A complete change log can
|
||||
be found in "CHANGES.md".
|
||||
|
||||
> USING CUPS REQUIRES ADDITIONAL THIRD-PARTY SUPPORT SOFTWARE AND PRINTER
|
||||
> DRIVERS. THESE ARE TYPICALLY INCLUDED WITH YOUR OPERATING SYSTEM
|
||||
> DISTRIBUTION. APPLE DOES NOT ENDORSE OR SUPPORT THIRD-PARTY SUPPORT SOFTWARE
|
||||
> FOR CUPS.
|
||||
Using CUPS requires additional third-party support software and printer drivers.
|
||||
These are typically included with your operating system distribution. Apple
|
||||
does not endorse or support third-party support software for CUPS.
|
||||
|
||||
> Note: Current versions of macOS DO NOT allow installation to /usr with the
|
||||
> default System Integrity Protection (SIP) settings. In addition, we do not
|
||||
> recommend replacing the CUPS supplied with macOS because:
|
||||
>
|
||||
> a. not all versions of CUPS are compatible with every macOS release,
|
||||
>
|
||||
> b. code signing prevents replacement of system libraries and access to the
|
||||
> system keychain (needed for encrypted printer sharing), and
|
||||
>
|
||||
> c. software updates will often replace parts of your local installation,
|
||||
> potentially rendering your system unusable.
|
||||
>
|
||||
> Apple only supports using the Clang supplied with Xcode to build CUPS on
|
||||
> macOS.
|
||||
|
||||
|
||||
BEFORE YOU BEGIN
|
||||
@@ -52,12 +66,15 @@ main CUPS source directory. To configure CUPS for your system, type:
|
||||
|
||||
The default installation will put the CUPS software in the "/etc", "/usr", and
|
||||
"/var" directories on your system, which will overwrite any existing printing
|
||||
commands on your system. Use the "--prefix" option to install the CUPS software
|
||||
commands on your system. Use the `--prefix` option to install the CUPS software
|
||||
in another location:
|
||||
|
||||
./configure --prefix=/some/directory
|
||||
|
||||
To see a complete list of configuration options, use the --help option:
|
||||
> Note: Current versions of macOS DO NOT allow installation to /usr with the
|
||||
> default System Integrity Protection (SIP) settings.
|
||||
|
||||
To see a complete list of configuration options, use the `--help` option:
|
||||
|
||||
./configure --help
|
||||
|
||||
@@ -82,26 +99,20 @@ or:
|
||||
LDFLAGS="-L/some/directory" \
|
||||
./configure ...
|
||||
|
||||
The "--enable-debug" option compiles CUPS with debugging information enabled.
|
||||
The `--enable-debug` option compiles CUPS with debugging information enabled.
|
||||
Additional debug logging support can be enabled using the
|
||||
"--enable-debug-printfs" option - these debug messages are enabled using the
|
||||
CUPS_DEBUG_LOG environment variable at run-time.
|
||||
`--enable-debug-printfs` option - these debug messages are enabled using the
|
||||
`CUPS_DEBUG_xxx` environment variables at run-time.
|
||||
|
||||
CUPS also includes an extensive set of unit tests that can be used to find and
|
||||
diagnose a variety of common problems - use the "--enable-unit-tests" configure
|
||||
option to run them at build time.
|
||||
|
||||
On macOS, use the "--with-archflags" option to build with the correct set of
|
||||
On macOS, use the `--with-archflags` option to build with the correct set of
|
||||
architectures:
|
||||
|
||||
./configure --with-archflags="-arch i386 -arch x86_64" ...
|
||||
|
||||
> Note: Current versions of macOS DO NOT allow installation to /usr with the
|
||||
> default system integrity settings. In addition, we do not recommend replacing
|
||||
> the CUPS supplied with macOS because not all versions of CUPS are compatible
|
||||
> with every macOS release, and because software updates will replace parts
|
||||
> of your local installation potentially rendering your system unusable.
|
||||
|
||||
Once you have configured things, just type:
|
||||
|
||||
make ENTER
|
||||
@@ -184,7 +195,7 @@ for FreeBSD, NetBSD, and OpenBSD. The <format> target is one of the following:
|
||||
GETTING DEBUG LOGGING FROM CUPS
|
||||
-------------------------------
|
||||
|
||||
When configured with the "--enable-debug-printfs" option, CUPS compiles in
|
||||
When configured with the `--enable-debug-printfs` option, CUPS compiles in
|
||||
additional debug logging support in the scheduler, CUPS API, and CUPS Imaging
|
||||
API. The following environment variables are used to enable and control debug
|
||||
logging:
|
||||
@@ -195,13 +206,14 @@ logging:
|
||||
the logging. The default level is 1.
|
||||
- `CUPS_DEBUG_LOG`: Specifies a log file to use. Specify the name "-" to send
|
||||
the messages to stderr. Prefix a filename with "+" to append to an existing
|
||||
file.
|
||||
file. You can include a single "%d" in the filename to embed the current
|
||||
process ID.
|
||||
|
||||
|
||||
REPORTING PROBLEMS
|
||||
------------------
|
||||
|
||||
If you have problems, READ THE DOCUMENTATION FIRST! If the documentation does
|
||||
If you have problems, *read the documentation first*! If the documentation does
|
||||
not solve your problems, please post a message on the users forum at:
|
||||
|
||||
https://www.cups.org/
|
||||
|
||||
+14
-4
@@ -11,22 +11,32 @@
|
||||
# missing or damaged, see the license at "http://www.cups.org/".
|
||||
#
|
||||
|
||||
#
|
||||
# CUPS version...
|
||||
#
|
||||
|
||||
CUPS_VERSION = @CUPS_VERSION@
|
||||
|
||||
|
||||
#
|
||||
# Programs...
|
||||
#
|
||||
|
||||
AR = @AR@
|
||||
AWK = @AWK@
|
||||
CC = @LIBTOOL@ @CC@
|
||||
CC = @LIBTOOL_CC@ @CC@
|
||||
CHMOD = @CHMOD@
|
||||
CXX = @LIBTOOL@ @CXX@
|
||||
CXX = @LIBTOOL_CXX@ @CXX@
|
||||
DSO = @DSO@
|
||||
DSOXX = @DSOXX@
|
||||
GZIP = @GZIP@
|
||||
INSTALL = @INSTALL@
|
||||
LD = @LD@
|
||||
LD_CC = @LD_CC@
|
||||
LD_CXX = @LD_CXX@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN = @LN@ -sf
|
||||
MKDIR = @MKDIR@ -p
|
||||
MV = @MV@
|
||||
RANLIB = @RANLIB@
|
||||
RM = @RM@ -f
|
||||
@@ -38,12 +48,12 @@ SHELL = /bin/sh
|
||||
# Installation programs...
|
||||
#
|
||||
|
||||
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
|
||||
INSTALL_BIN = @LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
|
||||
INSTALL_COMPDATA = $(INSTALL) -c -m 444 @INSTALL_GZIP@
|
||||
INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
|
||||
INSTALL_DATA = $(INSTALL) -c -m 444
|
||||
INSTALL_DIR = $(INSTALL) -d
|
||||
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
|
||||
INSTALL_LIB = @LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
|
||||
INSTALL_MAN = $(INSTALL) -c -m 444
|
||||
INSTALL_SCRIPT = $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@
|
||||
|
||||
|
||||
+33
-33
@@ -1,7 +1,7 @@
|
||||
README - CUPS v2.2.4 - 2017-06-30
|
||||
README - CUPS v2.2.7 - 2018-03-22
|
||||
=================================
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.md" instead...
|
||||
Looking for compile instructions? Read the file `INSTALL.md` instead...
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
@@ -30,12 +30,10 @@ READING THE DOCUMENTATION
|
||||
-------------------------
|
||||
|
||||
Once you have installed the software you can access the documentation (and a
|
||||
bunch of other stuff) online at:
|
||||
|
||||
http://localhost:631/
|
||||
bunch of other stuff) online at <http://localhost:631/>.
|
||||
|
||||
If you're having trouble getting that far, the documentation is located under
|
||||
the "doc/help" directory.
|
||||
the `doc/help` and `man` directories.
|
||||
|
||||
Please read the documentation before asking questions.
|
||||
|
||||
@@ -43,10 +41,8 @@ Please read the documentation before asking questions.
|
||||
GETTING SUPPORT AND OTHER RESOURCES
|
||||
-----------------------------------
|
||||
|
||||
If you have problems, READ THE DOCUMENTATION FIRST! We also provide two mailing
|
||||
lists which are available at:
|
||||
|
||||
https://lists.cups.org/mailman/listinfo
|
||||
If you have problems, *read the documentation first!* We also provide two
|
||||
mailing lists which are available at <https://lists.cups.org/mailman/listinfo>.
|
||||
|
||||
See the CUPS web site at <https://www.cups.org/> for other resources.
|
||||
|
||||
@@ -55,14 +51,12 @@ SETTING UP PRINTER QUEUES USING YOUR WEB BROWSER
|
||||
------------------------------------------------
|
||||
|
||||
CUPS includes a web-based administration tool that allows you to manage
|
||||
printers, classes, and jobs on your server. Open the following URL in your
|
||||
browser to access the printer administration tools:
|
||||
|
||||
http://localhost:631/admin/
|
||||
printers, classes, and jobs on your server. Open <http://localhost:631/admin/>
|
||||
in your browser to access the printer administration tools:
|
||||
|
||||
*Do not* use the hostname for your machine - it will not work with the default
|
||||
CUPS configuration. To enable administration access on other addresses, check
|
||||
the "Allow Remote Administration" box and click on the "Change Settings" button.
|
||||
the `Allow Remote Administration` box and click on the `Change Settings button.
|
||||
|
||||
You will be asked for the administration password (root or any other user in the
|
||||
sys/system/root/admin/lpadmin group on your system) when performing any
|
||||
@@ -72,10 +66,15 @@ administrative function.
|
||||
SETTING UP PRINTER QUEUES FROM THE COMMAND-LINE
|
||||
-----------------------------------------------
|
||||
|
||||
CUPS works best with PPD (PostScript Printer Description) files. In a pinch you
|
||||
can also use System V style printer interface scripts.
|
||||
CUPS currently uses PPD (PostScript Printer Description) files that describe
|
||||
printer capabilities and driver programs needed for each printer. The
|
||||
`everywhere` PPD is used for nearly all modern networks printers sold since
|
||||
about 2009. For example, the following command creates a print queue for a
|
||||
printer at address 11.22.33.44:
|
||||
|
||||
CUPS includes several sample PPD files you can use:
|
||||
lpadmin -p printername -E -v ipp://11.22.33.44/ipp/print -m everywhere
|
||||
|
||||
CUPS also includes several sample PPD files you can use for "legacy" printers:
|
||||
|
||||
Driver PPD Name
|
||||
----------------------------- ------------------------------
|
||||
@@ -94,41 +93,42 @@ CUPS includes several sample PPD files you can use:
|
||||
Zebra EPL2 Label Printer drv:///sample.drv/zebraep2.ppd
|
||||
Zebra ZPL Label Printer drv:///sample.drv/zebra.ppd
|
||||
|
||||
Run the "lpinfo -m" command to list the available drivers:
|
||||
You can run the `lpinfo -m` command to list all of the available drivers:
|
||||
|
||||
lpinfo -m
|
||||
|
||||
Run the "lpinfo -v" command to list the available printers:
|
||||
Run the `lpinfo -v` command to list the available printers:
|
||||
|
||||
lpinfo -v
|
||||
|
||||
Then use the correct URI to add the printer using the "lpadmin" command:
|
||||
Then use the correct URI to add the printer using the `lpadmin` command:
|
||||
|
||||
lpadmin -p printername -E -v device-uri -m ppd-name
|
||||
|
||||
Network printers typically use "socket" or "lpd" URIs:
|
||||
Current network printers typically use `ipp` or `ipps` URIS:
|
||||
|
||||
lpadmin -p printername -E -v ipp://11.22.33.44/ipp/print -m everywhere
|
||||
lpadmin -p printername -E -v ipps://11.22.33.44/ipp/print -m everywhere
|
||||
|
||||
Older network printers typically use `socket` or `lpd` URIs:
|
||||
|
||||
lpadmin -p printername -E -v socket://11.22.33.44 -m ppd-name
|
||||
lpadmin -p printername -E -v lpd://11.22.33.44/ -m ppd-name
|
||||
|
||||
The sample drivers provide basic printing capabilities, but generally do not
|
||||
exercise the full potential of the printers or CUPS.
|
||||
|
||||
CUPS also supports IPP Everywhere printers using the "everywhere" model, for
|
||||
example:
|
||||
|
||||
lpadmin -p printername -E -v ipp://11.22.33.44/ipp/print -m everywhere
|
||||
exercise the full potential of the printers or CUPS. Other drivers provide
|
||||
greater printing capabilities.
|
||||
|
||||
|
||||
PRINTING FILES
|
||||
--------------
|
||||
|
||||
CUPS provides both the System V "lp" and Berkeley "lpr" commands for printing:
|
||||
CUPS provides both the System V `lp` and Berkeley `lpr` commands for printing:
|
||||
|
||||
lp filename
|
||||
lpr filename
|
||||
|
||||
Both the "lp" and "lpr" commands support printing options for the driver:
|
||||
Both the `lp` and `lpr` commands support printing options for the driver:
|
||||
|
||||
lp -o media=A4 -o resolution=600dpi filename
|
||||
lpr -o media=A4 -o resolution=600dpi filename
|
||||
@@ -137,7 +137,7 @@ CUPS recognizes many types of images files as well as PDF, PostScript, and text
|
||||
files, so you can print those files directly rather than through an application.
|
||||
|
||||
If you have an application that generates output specifically for your printer
|
||||
then you need to use the "-oraw" or "-l" options:
|
||||
then you need to use the `-oraw` or `-l` options:
|
||||
|
||||
lp -o raw filename
|
||||
lpr -l filename
|
||||
@@ -148,7 +148,7 @@ This will prevent the filters from misinterpreting your print file.
|
||||
LEGAL STUFF
|
||||
-----------
|
||||
|
||||
CUPS is copyright © 2007-2017 by Apple Inc. CUPS and the CUPS logo are
|
||||
CUPS is copyright © 2007-2018 by Apple Inc. CUPS and the CUPS logo are
|
||||
trademarks of Apple Inc.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
@@ -157,4 +157,4 @@ CUPS is provided under the terms of version 2 of the GNU General Public License
|
||||
and GNU Library General Public License. This program is distributed in the hope
|
||||
that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
"doc/help/license.html" or "LICENSE.txt" files for more information.
|
||||
`doc/help/license.html` or `LICENSE.txt` files for more information.
|
||||
|
||||
+12
-12
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Backend makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 2007-2017 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -24,7 +24,7 @@ include ../Makedefs
|
||||
# UBACKENDS and ULBACKENDS are installed mode 0755 so cupsd will run them as
|
||||
# an unprivileged user...
|
||||
#
|
||||
# See http://www.cups.org/documentation.php/api-filter.html for more info...
|
||||
# See http://www.cups.org/doc/api-filter.html for more info...
|
||||
RBACKENDS = \
|
||||
ipp \
|
||||
lpd \
|
||||
@@ -207,7 +207,7 @@ uninstall:
|
||||
|
||||
test1284: test1284.o ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o test1284 test1284.o ../cups/$(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(LDFLAGS) -o test1284 test1284.o ../cups/$(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ test1284: test1284.o ../cups/$(LIBCUPSSTATIC)
|
||||
|
||||
testbackend: testbackend.o ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o testbackend testbackend.o ../cups/$(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(LDFLAGS) -o testbackend testbackend.o ../cups/$(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ testbackend: testbackend.o ../cups/$(LIBCUPSSTATIC)
|
||||
|
||||
testsupplies: testsupplies.o libbackend.a ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o testsupplies testsupplies.o libbackend.a \
|
||||
$(LD_CC) $(LDFLAGS) -o testsupplies testsupplies.o libbackend.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ)
|
||||
|
||||
@@ -249,7 +249,7 @@ libbackend.a: $(LIBOBJS)
|
||||
|
||||
dnssd: dnssd.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o dnssd dnssd.o libbackend.a $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o dnssd dnssd.o libbackend.a $(LIBS)
|
||||
if test `uname` = Darwin; then \
|
||||
$(RM) mdns; \
|
||||
$(LN) dnssd mdns; \
|
||||
@@ -262,7 +262,7 @@ dnssd: dnssd.o ../cups/$(LIBCUPS) libbackend.a
|
||||
|
||||
ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
|
||||
$(RM) http
|
||||
$(LN) ipp http
|
||||
|
||||
@@ -273,7 +273,7 @@ ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
|
||||
|
||||
lpd: lpd.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpd lpd.o libbackend.a $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o lpd lpd.o libbackend.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -282,7 +282,7 @@ lpd: lpd.o ../cups/$(LIBCUPS) libbackend.a
|
||||
|
||||
snmp: snmp.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o snmp snmp.o libbackend.a $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o snmp snmp.o libbackend.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -291,11 +291,11 @@ snmp: snmp.o ../cups/$(LIBCUPS) libbackend.a
|
||||
|
||||
socket: socket.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o socket socket.o libbackend.a $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o socket socket.o libbackend.a $(LIBS)
|
||||
|
||||
socket-static: socket.o ../cups/$(LIBCUPSSTATIC) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o socket-static socket.o libbackend.a \
|
||||
$(LD_CC) $(LDFLAGS) -o socket-static socket.o libbackend.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ)
|
||||
|
||||
@@ -306,7 +306,7 @@ socket-static: socket.o ../cups/$(LIBCUPSSTATIC) libbackend.a
|
||||
|
||||
usb: usb.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
|
||||
$(BACKLIBS) $(LIBS)
|
||||
usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c
|
||||
|
||||
|
||||
+36
-12
@@ -47,6 +47,8 @@ extern void xpc_connection_set_target_uid(xpc_connection_t connection,
|
||||
#define _CUPS_JSR_ACCOUNT_LIMIT_REACHED 0x08
|
||||
#define _CUPS_JSR_JOB_PASSWORD_WAIT 0x10
|
||||
#define _CUPS_JSR_JOB_RELEASE_WAIT 0x20
|
||||
#define _CUPS_JSR_DOCUMENT_FORMAT_ERROR 0x40
|
||||
#define _CUPS_JSR_DOCUMENT_UNPRINTABLE 0x80
|
||||
|
||||
|
||||
/*
|
||||
@@ -69,6 +71,7 @@ typedef struct _cups_monitor_s /**** Monitoring data ****/
|
||||
http_encryption_t encryption; /* Use encryption? */
|
||||
ipp_jstate_t job_state; /* Current job state */
|
||||
ipp_pstate_t printer_state; /* Current printer state */
|
||||
int retryable; /* Is this a job that should be retried? */
|
||||
} _cups_monitor_t;
|
||||
|
||||
|
||||
@@ -357,8 +360,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* that way.
|
||||
*/
|
||||
|
||||
if (!getuid() && (value = getenv("AUTH_UID")) != NULL &&
|
||||
!getenv("AUTH_PASSWORD"))
|
||||
if (!getuid() && (value = getenv("AUTH_UID")) != NULL)
|
||||
{
|
||||
uid_t uid = (uid_t)atoi(value);
|
||||
/* User ID */
|
||||
@@ -392,7 +394,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
# else /* No XPC, just try to run as the user ID */
|
||||
if (uid > 0)
|
||||
seteuid(uid);
|
||||
setuid(uid);
|
||||
# endif /* HAVE_XPC */
|
||||
}
|
||||
#endif /* HAVE_GSSAPI */
|
||||
@@ -743,8 +745,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(errno));
|
||||
|
||||
if (errno == ECONNREFUSED || errno == EHOSTDOWN ||
|
||||
errno == EHOSTUNREACH)
|
||||
if (errno == ECONNREFUSED || errno == EHOSTDOWN || errno == EHOSTUNREACH || errno == ETIMEDOUT || errno == ENOTCONN)
|
||||
{
|
||||
if (contimeout && (time(NULL) - start_time) > contimeout)
|
||||
{
|
||||
@@ -763,13 +764,13 @@ main(int argc, /* I - Number of command-line args */
|
||||
break;
|
||||
|
||||
case EHOSTUNREACH :
|
||||
default :
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("The printer is unreachable at this "
|
||||
"time."));
|
||||
break;
|
||||
|
||||
case ECONNREFUSED :
|
||||
default :
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("The printer is in use."));
|
||||
break;
|
||||
@@ -1449,6 +1450,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
monitor.encryption = cupsEncryption();
|
||||
monitor.job_state = IPP_JOB_PENDING;
|
||||
monitor.printer_state = IPP_PRINTER_IDLE;
|
||||
monitor.retryable = argc == 6 && document_format && strcmp(document_format, "image/pwg-raster") && strcmp(document_format, "image/urf");
|
||||
|
||||
if (create_job)
|
||||
{
|
||||
@@ -2569,22 +2571,24 @@ monitor_printer(
|
||||
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
{
|
||||
if (!strcmp(attr->values[i].string.text,
|
||||
"account-authorization-failed"))
|
||||
if (!strcmp(attr->values[i].string.text, "account-authorization-failed"))
|
||||
new_reasons |= _CUPS_JSR_ACCOUNT_AUTHORIZATION_FAILED;
|
||||
else if (!strcmp(attr->values[i].string.text, "account-closed"))
|
||||
new_reasons |= _CUPS_JSR_ACCOUNT_CLOSED;
|
||||
else if (!strcmp(attr->values[i].string.text, "account-info-needed"))
|
||||
new_reasons |= _CUPS_JSR_ACCOUNT_INFO_NEEDED;
|
||||
else if (!strcmp(attr->values[i].string.text,
|
||||
"account-limit-reached"))
|
||||
else if (!strcmp(attr->values[i].string.text, "account-limit-reached"))
|
||||
new_reasons |= _CUPS_JSR_ACCOUNT_LIMIT_REACHED;
|
||||
else if (!strcmp(attr->values[i].string.text, "job-password-wait"))
|
||||
new_reasons |= _CUPS_JSR_JOB_PASSWORD_WAIT;
|
||||
else if (!strcmp(attr->values[i].string.text, "job-release-wait"))
|
||||
new_reasons |= _CUPS_JSR_JOB_RELEASE_WAIT;
|
||||
if (!job_canceled &&
|
||||
(!strncmp(attr->values[i].string.text, "job-canceled-", 13) || !strcmp(attr->values[i].string.text, "aborted-by-system")))
|
||||
else if (!strcmp(attr->values[i].string.text, "document-format-error"))
|
||||
new_reasons |= _CUPS_JSR_DOCUMENT_FORMAT_ERROR;
|
||||
else if (!strcmp(attr->values[i].string.text, "document-unprintable"))
|
||||
new_reasons |= _CUPS_JSR_DOCUMENT_UNPRINTABLE;
|
||||
|
||||
if (!job_canceled && (!strncmp(attr->values[i].string.text, "job-canceled-", 13) || !strcmp(attr->values[i].string.text, "aborted-by-system")))
|
||||
job_canceled = 1;
|
||||
}
|
||||
|
||||
@@ -2602,6 +2606,26 @@ monitor_printer(
|
||||
fputs("JOBSTATE: job-password-wait\n", stderr);
|
||||
else if (new_reasons & _CUPS_JSR_JOB_RELEASE_WAIT)
|
||||
fputs("JOBSTATE: job-release-wait\n", stderr);
|
||||
else if (new_reasons & (_CUPS_JSR_DOCUMENT_FORMAT_ERROR | _CUPS_JSR_DOCUMENT_UNPRINTABLE))
|
||||
{
|
||||
if (monitor->retryable)
|
||||
{
|
||||
/*
|
||||
* Can't print this, so retry as raster...
|
||||
*/
|
||||
|
||||
job_canceled = 1;
|
||||
fputs("JOBSTATE: cups-retry-as-raster\n", stderr);
|
||||
}
|
||||
else if (new_reasons & _CUPS_JSR_DOCUMENT_FORMAT_ERROR)
|
||||
{
|
||||
fputs("JOBSTATE: document-format-error\n", stderr);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs("JOBSTATE: document-unprintable\n", stderr);
|
||||
}
|
||||
}
|
||||
else
|
||||
fputs("JOBSTATE: job-printing\n", stderr);
|
||||
|
||||
|
||||
+2
-3
@@ -867,8 +867,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
|
||||
fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(error));
|
||||
|
||||
if (error == ECONNREFUSED || error == EHOSTDOWN ||
|
||||
error == EHOSTUNREACH)
|
||||
if (errno == ECONNREFUSED || errno == EHOSTDOWN || errno == EHOSTUNREACH || errno == ETIMEDOUT || errno == ENOTCONN)
|
||||
{
|
||||
if (contimeout && (time(NULL) - start_time) > contimeout)
|
||||
{
|
||||
@@ -886,13 +885,13 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
break;
|
||||
|
||||
case EHOSTUNREACH :
|
||||
default :
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("The printer is unreachable at "
|
||||
"this time."));
|
||||
break;
|
||||
|
||||
case ECONNREFUSED :
|
||||
default :
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("The printer is in use."));
|
||||
break;
|
||||
|
||||
@@ -8,10 +8,17 @@
|
||||
# delay-close Delay close/reset of selected interface
|
||||
# no-reattach Do no re-attach usblp kernel module after printing.
|
||||
# soft-reset Do a soft reset after printing for cleanup.
|
||||
# unidir Only supported unidirectional I/O
|
||||
# unidir Only supports unidirectional I/O
|
||||
# usb-init Needs vendor USB initialization string.
|
||||
# vendor-class Uses vendor-specific class or subclass.
|
||||
# whitelist The printer is functional with the USB backend.
|
||||
#
|
||||
# To get the USB vendor and product IDs for a given printer, run the "lsusb"
|
||||
# command, which will show something like the following:
|
||||
#
|
||||
# Bus 002 Device 003: ID ab21:34dc Acme Example Printer
|
||||
#
|
||||
# The "ab21:34dc" is the vendor and product ID, separated by a colon.
|
||||
|
||||
# HP DeskJet 895C
|
||||
0x03f0 0x0004 unidir
|
||||
@@ -76,6 +83,9 @@
|
||||
# Canon, Inc. MP510 Printer (https://bugs.launchpad.net/bugs/1050009)
|
||||
0x04a9 0x1717 unidir
|
||||
|
||||
# Canon, Inc. MP540 Printer, https://bugzilla.redhat.com/967873
|
||||
0x04a9 0x1730 unidir
|
||||
|
||||
# Canon, Inc. MP550 Printer (Issue #4155)
|
||||
0x04a9 0x173d unidir
|
||||
|
||||
@@ -127,6 +137,9 @@
|
||||
# All Samsung devices (https://bugs.launchpad.net/bugs/1032456)
|
||||
0x04e8 soft-reset
|
||||
|
||||
# Samsung ML-2160 Series (https://bugzilla.redhat.com/show_bug.cgi?id=873123)
|
||||
0x04e8 0x330f unidir
|
||||
|
||||
# All Zebra devices (https://bugs.launchpad.net/bugs/1001028)
|
||||
0x0a5f unidir
|
||||
|
||||
@@ -251,5 +264,20 @@
|
||||
# Kyocera Ecosys P6026cdn (Issue #4900)
|
||||
0x0482 0x063f no-reattach
|
||||
|
||||
# Kyocera Ecosys P6130cdn (Issue #5102)
|
||||
0x0482 0x0677 no-reattach
|
||||
|
||||
# Lexmark E260dn (Issue #4994)
|
||||
0x043d 0x0123 no-reattach
|
||||
|
||||
# HP LaserJet 1160 (Issue #5121)
|
||||
0x03f0 0x1e17 delay-close
|
||||
|
||||
# Canon, Inc. MP280 series (Issue #5221)
|
||||
0x04a9 0x1746 unidir
|
||||
|
||||
# Star Micronics printers (Issue #5251)
|
||||
0x0519 unidir
|
||||
|
||||
# Lexmark Optra E310 (Issue #5259)
|
||||
0x043d 0x000c no-reattach
|
||||
|
||||
+2
-3
@@ -330,8 +330,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(error));
|
||||
|
||||
if (error == ECONNREFUSED || error == EHOSTDOWN ||
|
||||
error == EHOSTUNREACH)
|
||||
if (errno == ECONNREFUSED || errno == EHOSTDOWN || errno == EHOSTUNREACH || errno == ETIMEDOUT || errno == ENOTCONN)
|
||||
{
|
||||
if (contimeout && (time(NULL) - start_time) > contimeout)
|
||||
{
|
||||
@@ -349,13 +348,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
break;
|
||||
|
||||
case EHOSTUNREACH :
|
||||
default :
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("The printer is unreachable at this "
|
||||
"time."));
|
||||
break;
|
||||
|
||||
case ECONNREFUSED :
|
||||
default :
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("The printer is in use."));
|
||||
break;
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Berkeley commands makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2012 by Apple Inc.
|
||||
# Copyright 2007-2017 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -124,7 +124,7 @@ uninstall:
|
||||
|
||||
lpc: lpc.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpc lpc.o $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o lpc lpc.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -133,7 +133,7 @@ lpc: lpc.o ../cups/$(LIBCUPS)
|
||||
|
||||
lpq: lpq.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpq lpq.o $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o lpq lpq.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -142,7 +142,7 @@ lpq: lpq.o ../cups/$(LIBCUPS)
|
||||
|
||||
lpr: lpr.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpr lpr.o $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o lpr lpr.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -151,7 +151,7 @@ lpr: lpr.o ../cups/$(LIBCUPS)
|
||||
|
||||
lprm: lprm.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lprm lprm.o $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o lprm lprm.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
|
||||
+4
-28
@@ -32,8 +32,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
char *printer, /* Destination printer or class */
|
||||
*instance, /* Instance */
|
||||
*opt; /* Option pointer */
|
||||
const char *title, /* Job title */
|
||||
*val; /* Environment variable name */
|
||||
const char *title; /* Job title */
|
||||
int num_copies; /* Number of copies per file */
|
||||
int num_files; /* Number of files to print */
|
||||
const char *files[1000]; /* Files to print */
|
||||
@@ -345,33 +344,10 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
val = NULL;
|
||||
|
||||
if ((printer = getenv("LPDEST")) == NULL)
|
||||
{
|
||||
if ((printer = getenv("PRINTER")) != NULL)
|
||||
{
|
||||
if (!strcmp(printer, "lp"))
|
||||
printer = NULL;
|
||||
else
|
||||
val = "PRINTER";
|
||||
}
|
||||
}
|
||||
if (!cupsGetNamedDest(NULL, NULL, NULL) && cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND)
|
||||
_cupsLangPrintf(stderr, _("%s: Error - %s"), argv[0], cupsLastErrorString());
|
||||
else
|
||||
val = "LPDEST";
|
||||
|
||||
if (printer && !cupsGetNamedDest(NULL, printer, NULL))
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - %s environment variable names "
|
||||
"non-existent destination \"%s\"."), argv[0], val,
|
||||
printer);
|
||||
else if (cupsLastError() == IPP_NOT_FOUND)
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - no default destination available."),
|
||||
argv[0]);
|
||||
else
|
||||
_cupsLangPrintf(stderr, _("%s: Error - scheduler not responding."),
|
||||
argv[0]);
|
||||
_cupsLangPrintf(stderr, _("%s: Error - scheduler not responding."), argv[0]);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
+11
-11
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# CGI makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 2007-2017 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -219,7 +219,7 @@ libcupscgi.1.dylib: $(LIBOBJS) libcupscgi.exp
|
||||
|
||||
libcupscgi.la: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
|
||||
-version-info 1:0 $(LIBS)
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ libcupscgi.a: $(LIBOBJS)
|
||||
|
||||
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ admin.o -lcupscgi $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ admin.o -lcupscgi $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -249,7 +249,7 @@ admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
|
||||
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ classes.o -lcupscgi $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ classes.o -lcupscgi $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -258,7 +258,7 @@ classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
|
||||
help.cgi: help.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ help.o -lcupscgi $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ help.o -lcupscgi $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -267,7 +267,7 @@ help.cgi: help.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
|
||||
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ jobs.o -lcupscgi $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ jobs.o -lcupscgi $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -276,7 +276,7 @@ jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
|
||||
makedocset: makedocset.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ makedocset.o libcupscgi.a \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ makedocset.o libcupscgi.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(LIBZ) $(LIBGSSAPI)
|
||||
|
||||
@@ -287,7 +287,7 @@ makedocset: makedocset.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
|
||||
|
||||
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ printers.o -L. -lcupscgi $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ printers.o -L. -lcupscgi $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -296,7 +296,7 @@ printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
|
||||
testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(LIBZ) $(LIBGSSAPI)
|
||||
echo Testing CGI API...
|
||||
@@ -309,7 +309,7 @@ testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
|
||||
|
||||
testhi: testhi.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(LIBZ) $(LIBGSSAPI)
|
||||
echo Testing help index API...
|
||||
@@ -322,7 +322,7 @@ testhi: testhi.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
|
||||
|
||||
testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.a ../cups/$(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.a ../cups/$(LIBCUPSSTATIC) \
|
||||
$(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) $(LIBZ) $(LIBGSSAPI)
|
||||
|
||||
|
||||
|
||||
+2
-6
@@ -18,7 +18,6 @@
|
||||
/*#define DEBUG*/
|
||||
#include "cgi-private.h"
|
||||
#include <cups/http.h>
|
||||
#include <cups/md5-private.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -1204,7 +1203,6 @@ cgi_set_sid(void)
|
||||
{
|
||||
char buffer[512], /* SID data */
|
||||
sid[33]; /* SID string */
|
||||
_cups_md5_state_t md5; /* MD5 state */
|
||||
unsigned char sum[16]; /* MD5 sum */
|
||||
const char *remote_addr, /* REMOTE_ADDR */
|
||||
*server_name, /* SERVER_NAME */
|
||||
@@ -1225,11 +1223,9 @@ cgi_set_sid(void)
|
||||
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255,
|
||||
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255,
|
||||
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255);
|
||||
_cupsMD5Init(&md5);
|
||||
_cupsMD5Append(&md5, (unsigned char *)buffer, (int)strlen(buffer));
|
||||
_cupsMD5Finish(&md5, sum);
|
||||
cupsHashData("md5", (unsigned char *)buffer, strlen(buffer), sum, sizeof(sum));
|
||||
|
||||
cgiSetCookie(CUPS_SID, httpMD5String(sum, sid), "/", NULL, 0, 0);
|
||||
cgiSetCookie(CUPS_SID, cupsHashString(sum, sizeof(sum), sid, sizeof(sid)), "/", NULL, 0, 0);
|
||||
|
||||
return (cupsGetOption(CUPS_SID, num_cookies, cookies));
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ AC_PATH_PROG(CHMOD,chmod)
|
||||
AC_PATH_PROG(GZIP,gzip)
|
||||
AC_PATH_PROG(LD,ld)
|
||||
AC_PATH_PROG(LN,ln)
|
||||
AC_PATH_PROG(MKDIR,mkdir)
|
||||
AC_PATH_PROG(MV,mv)
|
||||
AC_PATH_PROG(RM,rm)
|
||||
AC_PATH_PROG(RMDIR,rmdir)
|
||||
@@ -305,7 +306,7 @@ fi
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
dnl Check for DBUS support
|
||||
AC_ARG_ENABLE(dbus, [ --disable-dbus build without DBUS support])
|
||||
AC_ARG_ENABLE(dbus, [ --disable-dbus build without DBUS support])
|
||||
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
|
||||
DBUSDIR="$withval")
|
||||
|
||||
@@ -388,20 +389,15 @@ case $host_os_name in
|
||||
if test "x$default_adminkey" != xdefault; then
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
|
||||
CUPS_DEFAULT_SYSTEM_AUTHKEY="$default_adminkey"
|
||||
elif grep -q system.print.operator /etc/authorization; then
|
||||
else
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
|
||||
CUPS_DEFAULT_SYSTEM_AUTHKEY="system.print.admin"
|
||||
else
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
|
||||
CUPS_DEFAULT_SYSTEM_AUTHKEY="system.preferences"
|
||||
fi
|
||||
|
||||
if test "x$default_operkey" != xdefault; then
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
|
||||
elif grep -q system.print.operator /etc/authorization; then
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
|
||||
else
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
|
||||
fi])
|
||||
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
|
||||
|
||||
|
||||
@@ -185,6 +185,15 @@ if test -n "$GCC"; then
|
||||
AC_MSG_RESULT(no))
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
|
||||
AC_MSG_CHECKING(whether compiler supports -Wno-format-truncation)
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror -Wno-format-truncation"
|
||||
AC_TRY_COMPILE(,,
|
||||
[OPTIM="$OPTIM -Wno-format-truncation"
|
||||
AC_MSG_RESULT(yes)],
|
||||
AC_MSG_RESULT(no))
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
|
||||
# Additional warning options for development testing...
|
||||
if test -d .svn; then
|
||||
OPTIM="-Werror $OPTIM"
|
||||
|
||||
@@ -38,7 +38,7 @@ if test "x$CUPS_BUNDLEDIR" != x; then
|
||||
fi
|
||||
|
||||
dnl Default executable file permissions
|
||||
AC_ARG_WITH(exe_file_perm, [ --with-exe-file-perm set default exectuable permissions value, default=0555],
|
||||
AC_ARG_WITH(exe_file_perm, [ --with-exe-file-perm set default executable permissions value, default=0555],
|
||||
CUPS_EXE_FILE_PERM="$withval",
|
||||
[case "$host_os_name" in
|
||||
linux* | gnu*)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
dnl
|
||||
dnl Libtool stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2007-2017 by Apple Inc.
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -11,9 +11,12 @@ dnl which should have been included with this file. If this file is
|
||||
dnl missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported
|
||||
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=/path/to/libtool
|
||||
build with libtool (UNSUPPORTED!)],
|
||||
[if test x$enable_libtool_unsupported != xno; then
|
||||
if test x$enable_libtool_unsupported == xyes; then
|
||||
AC_MSG_ERROR([Use --enable-libtool-unsupported=/path/to/libtool.])
|
||||
fi
|
||||
LIBTOOL="$enable_libtool_unsupported"
|
||||
enable_shared=no
|
||||
echo "WARNING: libtool is not supported or endorsed by Apple Inc."
|
||||
@@ -22,12 +25,40 @@ AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported
|
||||
LIBTOOL=""
|
||||
fi])
|
||||
|
||||
AC_SUBST(LIBTOOL)
|
||||
|
||||
if test x$LIBTOOL != x; then
|
||||
DSO="\$(LIBTOOL) --mode=link --tag=CC ${CC}"
|
||||
DSOXX="\$(LIBTOOL) --mode=link --tag=CXX ${CXX}"
|
||||
|
||||
LD_CC="\$(LIBTOOL) --mode=link --tag=CC ${CC}"
|
||||
LD_CXX="\$(LIBTOOL) --mode=link --tag=CXX ${CXX}"
|
||||
|
||||
LIBCUPS="libcups.la"
|
||||
LIBCUPSSTATIC="libcups.la"
|
||||
LIBCUPSCGI="libcupscgi.la"
|
||||
LIBCUPSIMAGE="libcupsimage.la"
|
||||
LIBCUPSMIME="libcupsmime.la"
|
||||
LIBCUPSPPDC="libcupsppdc.la"
|
||||
|
||||
LIBTOOL_CC="\$(LIBTOOL) --mode=compile --tag=CC"
|
||||
LIBTOOL_CXX="\$(LIBTOOL) --mode=compile --tag=CXX"
|
||||
LIBTOOL_INSTALL="\$(LIBTOOL) --mode=install"
|
||||
|
||||
LINKCUPS="../cups/\$(LIBCUPS)"
|
||||
LINKCUPSIMAGE="../filter/\$(LIBCUPSIMAGE)"
|
||||
DSO="\$(CC)"
|
||||
|
||||
else
|
||||
LD_CC="\$(CC)"
|
||||
LD_CXX="\$(CXX)"
|
||||
|
||||
LIBTOOL_CC=""
|
||||
LIBTOOL_CXX=""
|
||||
LIBTOOL_INSTALL=""
|
||||
fi
|
||||
|
||||
AC_SUBST(LD_CC)
|
||||
AC_SUBST(LD_CXX)
|
||||
|
||||
AC_SUBST(LIBTOOL)
|
||||
AC_SUBST(LIBTOOL_CC)
|
||||
AC_SUBST(LIBTOOL_CXX)
|
||||
AC_SUBST(LIBTOOL_INSTALL)
|
||||
|
||||
@@ -12,7 +12,7 @@ dnl missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(pam, [ --disable-pam disable PAM support])
|
||||
AC_ARG_WITH(pam_module, [ --with-pam-module specify the PAM module to use])
|
||||
AC_ARG_WITH(pam_module, [ --with-pam-module set the PAM module to use])
|
||||
|
||||
PAMDIR=""
|
||||
PAMFILE="pam.std"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
dnl
|
||||
dnl Scripting configuration stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2010 by Apple Inc.
|
||||
dnl Copyright 2007-2017 by Apple Inc.
|
||||
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -14,11 +14,13 @@ dnl
|
||||
dnl Do we have Java?
|
||||
AC_ARG_WITH(java, [ --with-java set Java interpreter for web interfaces ],
|
||||
CUPS_JAVA="$withval",
|
||||
CUPS_JAVA="")
|
||||
CUPS_JAVA="auto")
|
||||
|
||||
if test "x$CUPS_JAVA" = x; then
|
||||
if test "x$CUPS_JAVA" = xauto; then
|
||||
AC_PATH_PROG(JAVA,java)
|
||||
CUPS_JAVA="$JAVA"
|
||||
elif test "x$CUPS_JAVA" = xno; then
|
||||
CUPS_JAVA=""
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_JAVA, "$CUPS_JAVA")
|
||||
@@ -30,11 +32,13 @@ fi
|
||||
dnl Do we have Perl?
|
||||
AC_ARG_WITH(perl, [ --with-perl set Perl interpreter for web interfaces ],
|
||||
CUPS_PERL="$withval",
|
||||
CUPS_PERL="")
|
||||
CUPS_PERL="auto")
|
||||
|
||||
if test "x$CUPS_PERL" = x; then
|
||||
if test "x$CUPS_PERL" = xauto; then
|
||||
AC_PATH_PROG(PERL,perl)
|
||||
CUPS_PERL="$PERL"
|
||||
elif test "x$CUPS_PERL" = xno; then
|
||||
CUPS_PERL=""
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_PERL, "$CUPS_PERL")
|
||||
@@ -46,9 +50,9 @@ fi
|
||||
dnl Do we have PHP?
|
||||
AC_ARG_WITH(php, [ --with-php set PHP interpreter for web interfaces ],
|
||||
CUPS_PHP="$withval",
|
||||
CUPS_PHP="")
|
||||
CUPS_PHP="auto")
|
||||
|
||||
if test "x$CUPS_PHP" = x; then
|
||||
if test "x$CUPS_PHP" = xauto; then
|
||||
AC_PATH_PROG(PHPCGI,php-cgi)
|
||||
if test "x$PHPCGI" = x; then
|
||||
AC_PATH_PROG(PHP,php)
|
||||
@@ -56,6 +60,8 @@ if test "x$CUPS_PHP" = x; then
|
||||
else
|
||||
CUPS_PHP="$PHPCGI"
|
||||
fi
|
||||
elif test "x$CUPS_PHP" = xno; then
|
||||
CUPS_PHP=""
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_PHP, "$CUPS_PHP")
|
||||
@@ -69,11 +75,13 @@ fi
|
||||
dnl Do we have Python?
|
||||
AC_ARG_WITH(python, [ --with-python set Python interpreter for web interfaces ],
|
||||
CUPS_PYTHON="$withval",
|
||||
CUPS_PYTHON="")
|
||||
CUPS_PYTHON="auto")
|
||||
|
||||
if test "x$CUPS_PYTHON" = x; then
|
||||
if test "x$CUPS_PYTHON" = xauto; then
|
||||
AC_PATH_PROG(PYTHON,python)
|
||||
CUPS_PYTHON="$PYTHON"
|
||||
elif test "x$CUPS_PYTHON" = xno; then
|
||||
CUPS_PYTHON=""
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_PYTHON, "$CUPS_PYTHON")
|
||||
|
||||
@@ -61,7 +61,6 @@ if test x$enable_ssl != xno; then
|
||||
dnl Then look for GNU TLS...
|
||||
if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
|
||||
AC_PATH_TOOL(LIBGNUTLSCONFIG,libgnutls-config)
|
||||
AC_PATH_TOOL(LIBGCRYPTCONFIG,libgcrypt-config)
|
||||
if $PKGCONFIG --exists gnutls; then
|
||||
have_ssl=1
|
||||
SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
|
||||
@@ -78,7 +78,7 @@ if test x$enable_systemd != xno; then
|
||||
fi
|
||||
|
||||
dnl Upstart is also used on Linux (e.g., Chrome OS)
|
||||
AC_ARG_ENABLE(upstart, [ --enable-upstart enable upstart support])
|
||||
AC_ARG_ENABLE(upstart, [ --enable-upstart enable upstart support])
|
||||
if test "x$enable_upstart" = "xyes"; then
|
||||
if test "x$have_systemd" = "xyes"; then
|
||||
AC_MSG_ERROR(Cannot support both systemd and upstart.)
|
||||
|
||||
externo
+259
-245
@@ -1,13 +1,11 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.68 for CUPS 2.2.4.
|
||||
# Generated by GNU Autoconf 2.69 for CUPS 2.2.7.
|
||||
#
|
||||
# Report bugs to <https://github.com/apple/cups/issues>.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
|
||||
# Foundation, Inc.
|
||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||
#
|
||||
#
|
||||
# This configure script is free software; the Free Software Foundation
|
||||
@@ -136,6 +134,31 @@ export LANGUAGE
|
||||
# CDPATH.
|
||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
||||
|
||||
# Use a proper internal environment variable to ensure we don't fall
|
||||
# into an infinite loop, continuously re-executing ourselves.
|
||||
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
|
||||
_as_can_reexec=no; export _as_can_reexec;
|
||||
# We cannot yet assume a decent shell, so we have to provide a
|
||||
# neutralization value for shells without unset; and this also
|
||||
# works around shells that cannot unset nonexistent variables.
|
||||
# Preserve -v and -x to the replacement shell.
|
||||
BASH_ENV=/dev/null
|
||||
ENV=/dev/null
|
||||
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
|
||||
case $- in # ((((
|
||||
*v*x* | *x*v* ) as_opts=-vx ;;
|
||||
*v* ) as_opts=-v ;;
|
||||
*x* ) as_opts=-x ;;
|
||||
* ) as_opts= ;;
|
||||
esac
|
||||
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
|
||||
# Admittedly, this is quite paranoid, since all the known shells bail
|
||||
# out after a failed `exec'.
|
||||
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
|
||||
as_fn_exit 255
|
||||
fi
|
||||
# We don't want this to propagate to other subprocesses.
|
||||
{ _as_can_reexec=; unset _as_can_reexec;}
|
||||
if test "x$CONFIG_SHELL" = x; then
|
||||
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
|
||||
emulate sh
|
||||
@@ -169,7 +192,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
|
||||
else
|
||||
exitcode=1; echo positional parameters were not saved.
|
||||
fi
|
||||
test x\$exitcode = x0 || exit 1"
|
||||
test x\$exitcode = x0 || exit 1
|
||||
test -x / || exit 1"
|
||||
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
|
||||
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
|
||||
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
|
||||
@@ -214,21 +238,25 @@ IFS=$as_save_IFS
|
||||
|
||||
|
||||
if test "x$CONFIG_SHELL" != x; then :
|
||||
# We cannot yet assume a decent shell, so we have to provide a
|
||||
# neutralization value for shells without unset; and this also
|
||||
# works around shells that cannot unset nonexistent variables.
|
||||
# Preserve -v and -x to the replacement shell.
|
||||
BASH_ENV=/dev/null
|
||||
ENV=/dev/null
|
||||
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
|
||||
export CONFIG_SHELL
|
||||
case $- in # ((((
|
||||
*v*x* | *x*v* ) as_opts=-vx ;;
|
||||
*v* ) as_opts=-v ;;
|
||||
*x* ) as_opts=-x ;;
|
||||
* ) as_opts= ;;
|
||||
esac
|
||||
exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
|
||||
export CONFIG_SHELL
|
||||
# We cannot yet assume a decent shell, so we have to provide a
|
||||
# neutralization value for shells without unset; and this also
|
||||
# works around shells that cannot unset nonexistent variables.
|
||||
# Preserve -v and -x to the replacement shell.
|
||||
BASH_ENV=/dev/null
|
||||
ENV=/dev/null
|
||||
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
|
||||
case $- in # ((((
|
||||
*v*x* | *x*v* ) as_opts=-vx ;;
|
||||
*v* ) as_opts=-v ;;
|
||||
*x* ) as_opts=-x ;;
|
||||
* ) as_opts= ;;
|
||||
esac
|
||||
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
|
||||
# Admittedly, this is quite paranoid, since all the known shells bail
|
||||
# out after a failed `exec'.
|
||||
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if test x$as_have_required = xno; then :
|
||||
@@ -331,6 +359,14 @@ $as_echo X"$as_dir" |
|
||||
|
||||
|
||||
} # as_fn_mkdir_p
|
||||
|
||||
# as_fn_executable_p FILE
|
||||
# -----------------------
|
||||
# Test if FILE is an executable regular file.
|
||||
as_fn_executable_p ()
|
||||
{
|
||||
test -f "$1" && test -x "$1"
|
||||
} # as_fn_executable_p
|
||||
# as_fn_append VAR VALUE
|
||||
# ----------------------
|
||||
# Append the text in VALUE to the end of the definition contained in VAR. Take
|
||||
@@ -452,6 +488,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
|
||||
chmod +x "$as_me.lineno" ||
|
||||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
|
||||
|
||||
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
|
||||
# already done that, so ensure we don't try to do so again and fall
|
||||
# in an infinite loop. This has already happened in practice.
|
||||
_as_can_reexec=no; export _as_can_reexec
|
||||
# Don't try to exec as it changes $[0], causing all sort of problems
|
||||
# (the dirname of $[0] is not the place where we might find the
|
||||
# original and so on. Autoconf is especially sensitive to this).
|
||||
@@ -486,16 +526,16 @@ if (echo >conf$$.file) 2>/dev/null; then
|
||||
# ... but there are two gotchas:
|
||||
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
|
||||
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
|
||||
# In both cases, we have to default to `cp -p'.
|
||||
# In both cases, we have to default to `cp -pR'.
|
||||
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
elif ln conf$$.file conf$$ 2>/dev/null; then
|
||||
as_ln_s=ln
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
fi
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
fi
|
||||
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
|
||||
rmdir conf$$.dir 2>/dev/null
|
||||
@@ -507,28 +547,8 @@ else
|
||||
as_mkdir_p=false
|
||||
fi
|
||||
|
||||
if test -x / >/dev/null 2>&1; then
|
||||
as_test_x='test -x'
|
||||
else
|
||||
if ls -dL / >/dev/null 2>&1; then
|
||||
as_ls_L_option=L
|
||||
else
|
||||
as_ls_L_option=
|
||||
fi
|
||||
as_test_x='
|
||||
eval sh -c '\''
|
||||
if test -d "$1"; then
|
||||
test -d "$1/.";
|
||||
else
|
||||
case $1 in #(
|
||||
-*)set "./$1";;
|
||||
esac;
|
||||
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
|
||||
???[sx]*):;;*)false;;esac;fi
|
||||
'\'' sh
|
||||
'
|
||||
fi
|
||||
as_executable_p=$as_test_x
|
||||
as_test_x='test -x'
|
||||
as_executable_p=as_fn_executable_p
|
||||
|
||||
# Sed expression to map a string onto a valid CPP name.
|
||||
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
|
||||
@@ -560,8 +580,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='CUPS'
|
||||
PACKAGE_TARNAME='cups'
|
||||
PACKAGE_VERSION='2.2.4'
|
||||
PACKAGE_STRING='CUPS 2.2.4'
|
||||
PACKAGE_VERSION='2.2.7'
|
||||
PACKAGE_STRING='CUPS 2.2.7'
|
||||
PACKAGE_BUGREPORT='https://github.com/apple/cups/issues'
|
||||
PACKAGE_URL='https://www.cups.org/'
|
||||
|
||||
@@ -663,7 +683,6 @@ SSLLIBS
|
||||
SSLFLAGS
|
||||
IPPALIASES
|
||||
CUPS_SERVERKEYCHAIN
|
||||
LIBGCRYPTCONFIG
|
||||
LIBGNUTLSCONFIG
|
||||
PTHREAD_FLAGS
|
||||
CUPS_DEFAULT_GSSSERVICENAME
|
||||
@@ -679,7 +698,12 @@ ARCHFLAGS
|
||||
UNITTESTS
|
||||
OPTIM
|
||||
INSTALL_STRIP
|
||||
LIBTOOL_INSTALL
|
||||
LIBTOOL_CXX
|
||||
LIBTOOL_CC
|
||||
LIBTOOL
|
||||
LD_CXX
|
||||
LD_CC
|
||||
EXPORT_LDFLAGS
|
||||
IMGLIBS
|
||||
DSOLIBS
|
||||
@@ -748,6 +772,7 @@ SED
|
||||
RMDIR
|
||||
RM
|
||||
MV
|
||||
MKDIR
|
||||
LN
|
||||
LD
|
||||
GZIP
|
||||
@@ -1372,8 +1397,6 @@ target=$target_alias
|
||||
if test "x$host_alias" != x; then
|
||||
if test "x$build_alias" = x; then
|
||||
cross_compiling=maybe
|
||||
$as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
|
||||
If a cross compiler is detected then cross compile mode will be used" >&2
|
||||
elif test "x$build_alias" != "x$host_alias"; then
|
||||
cross_compiling=yes
|
||||
fi
|
||||
@@ -1459,7 +1482,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures CUPS 2.2.4 to adapt to many kinds of systems.
|
||||
\`configure' configures CUPS 2.2.7 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1524,7 +1547,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of CUPS 2.2.4:";;
|
||||
short | recursive ) echo "Configuration of CUPS 2.2.7:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1538,9 +1561,9 @@ Optional Features:
|
||||
--enable-libusb use libusb for USB printing
|
||||
--enable-tcp-wrappers use libwrap for TCP wrappers support
|
||||
--enable-acl build with POSIX ACL support
|
||||
--disable-dbus build without DBUS support
|
||||
--disable-dbus build without DBUS support
|
||||
--disable-shared do not create shared libraries
|
||||
--enable-libtool-unsupported
|
||||
--enable-libtool-unsupported=/path/to/libtool
|
||||
build with libtool (UNSUPPORTED!)
|
||||
--enable-debug build with debugging symbols
|
||||
--enable-debug-guards build with memory allocation guards
|
||||
@@ -1558,7 +1581,7 @@ Optional Features:
|
||||
--disable-dnssd disable DNS Service Discovery support using mDNSResponder
|
||||
--disable-launchd disable launchd support
|
||||
--disable-systemd disable systemd support
|
||||
--enable-upstart enable upstart support
|
||||
--enable-upstart enable upstart support
|
||||
--enable-page-logging enable page_log by default
|
||||
--disable-browsing disable Browsing by default
|
||||
--disable-default-shared
|
||||
@@ -1591,7 +1614,7 @@ Optional Packages:
|
||||
--with-ldarchflags set program architecture flags
|
||||
--with-domainsocket set unix domain socket name
|
||||
--with-gssservicename set default gss service name
|
||||
--with-pam-module specify the PAM module to use
|
||||
--with-pam-module set the PAM module to use
|
||||
--with-dnssd-libs set directory for DNS Service Discovery library
|
||||
--with-dnssd-includes set directory for DNS Service Discovery includes
|
||||
--with-systemd set directory for systemd service files
|
||||
@@ -1603,7 +1626,7 @@ Optional Packages:
|
||||
--with-xinetd set path for xinetd config files
|
||||
--with-languages set installed languages, default=all
|
||||
--with-bundledir set macOS localization bundle directory
|
||||
--with-exe-file-perm set default exectuable permissions value, default=0555
|
||||
--with-exe-file-perm set default executable permissions value, default=0555
|
||||
--with-config-file-perm set default ConfigFilePerm value, default=0640
|
||||
--with-cupsd-file-perm set default cupsd permissions, default=0500
|
||||
--with-log-file-perm set default LogFilePerm value, default=0644
|
||||
@@ -1705,10 +1728,10 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
CUPS configure 2.2.4
|
||||
generated by GNU Autoconf 2.68
|
||||
CUPS configure 2.2.7
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
This configure script is free software; the Free Software Foundation
|
||||
gives unlimited permission to copy, distribute and modify it.
|
||||
_ACEOF
|
||||
@@ -1859,7 +1882,7 @@ $as_echo "$ac_try_echo"; } >&5
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext && {
|
||||
test "$cross_compiling" = yes ||
|
||||
$as_test_x conftest$ac_exeext
|
||||
test -x conftest$ac_exeext
|
||||
}; then :
|
||||
ac_retval=0
|
||||
else
|
||||
@@ -2169,8 +2192,8 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by CUPS $as_me 2.2.4, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
It was created by CUPS $as_me 2.2.7, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
||||
@@ -2644,7 +2667,7 @@ fi
|
||||
ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
CUPS_VERSION="2.2.4"
|
||||
CUPS_VERSION="2.2.7"
|
||||
CUPS_REVISION=""
|
||||
CUPS_BUILD="cups-$CUPS_VERSION"
|
||||
|
||||
@@ -2690,7 +2713,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_AWK="$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -2738,7 +2761,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -2782,7 +2805,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_CC="$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3226,8 +3249,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
struct stat;
|
||||
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
|
||||
struct buf { int x; };
|
||||
FILE * (*rcsopen) (struct buf *, struct stat *, int);
|
||||
@@ -3477,7 +3499,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3521,7 +3543,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_CXX="$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3723,7 +3745,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3763,7 +3785,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_RANLIB="ranlib"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3816,7 +3838,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3856,7 +3878,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_CHMOD="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3896,7 +3918,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_GZIP="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3936,7 +3958,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_LD="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3976,7 +3998,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_LN="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -3998,6 +4020,46 @@ $as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
# Extract the first word of "mkdir", so it can be a program name with args.
|
||||
set dummy mkdir; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_MKDIR+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $MKDIR in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_MKDIR="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
MKDIR=$ac_cv_path_MKDIR
|
||||
if test -n "$MKDIR"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR" >&5
|
||||
$as_echo "$MKDIR" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
# Extract the first word of "mv", so it can be a program name with args.
|
||||
set dummy mv; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
@@ -4016,7 +4078,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -4056,7 +4118,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -4096,7 +4158,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_RMDIR="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -4136,7 +4198,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -4176,7 +4238,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_XDGOPEN="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -4252,7 +4314,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -4295,7 +4357,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -4705,7 +4767,7 @@ do
|
||||
for ac_prog in grep ggrep; do
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
|
||||
{ test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
|
||||
as_fn_executable_p "$ac_path_GREP" || continue
|
||||
# Check for GNU ac_path_GREP and select it if it is found.
|
||||
# Check for GNU $ac_path_GREP
|
||||
case `"$ac_path_GREP" --version 2>&1` in
|
||||
@@ -4771,7 +4833,7 @@ do
|
||||
for ac_prog in egrep; do
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
|
||||
{ test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
|
||||
as_fn_executable_p "$ac_path_EGREP" || continue
|
||||
# Check for GNU ac_path_EGREP and select it if it is found.
|
||||
# Check for GNU $ac_path_EGREP
|
||||
case `"$ac_path_EGREP" --version 2>&1` in
|
||||
@@ -5940,20 +6002,15 @@ if test "x$ac_cv_header_Security_Authorization_h" = xyes; then :
|
||||
if test "x$default_adminkey" != xdefault; then
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
|
||||
CUPS_DEFAULT_SYSTEM_AUTHKEY="$default_adminkey"
|
||||
elif grep -q system.print.operator /etc/authorization; then
|
||||
else
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
|
||||
CUPS_DEFAULT_SYSTEM_AUTHKEY="system.print.admin"
|
||||
else
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
|
||||
CUPS_DEFAULT_SYSTEM_AUTHKEY="system.preferences"
|
||||
fi
|
||||
|
||||
if test "x$default_operkey" != xdefault; then
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
|
||||
elif grep -q system.print.operator /etc/authorization; then
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
|
||||
else
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -6656,6 +6713,9 @@ fi
|
||||
# Check whether --enable-libtool_unsupported was given.
|
||||
if test "${enable_libtool_unsupported+set}" = set; then :
|
||||
enableval=$enable_libtool_unsupported; if test x$enable_libtool_unsupported != xno; then
|
||||
if test x$enable_libtool_unsupported == xyes; then
|
||||
as_fn_error $? "Use --enable-libtool-unsupported=/path/to/libtool." "$LINENO" 5
|
||||
fi
|
||||
LIBTOOL="$enable_libtool_unsupported"
|
||||
enable_shared=no
|
||||
echo "WARNING: libtool is not supported or endorsed by Apple Inc."
|
||||
@@ -6666,17 +6726,45 @@ if test "${enable_libtool_unsupported+set}" = set; then :
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
if test x$LIBTOOL != x; then
|
||||
DSO="\$(LIBTOOL) --mode=link --tag=CC ${CC}"
|
||||
DSOXX="\$(LIBTOOL) --mode=link --tag=CXX ${CXX}"
|
||||
|
||||
LD_CC="\$(LIBTOOL) --mode=link --tag=CC ${CC}"
|
||||
LD_CXX="\$(LIBTOOL) --mode=link --tag=CXX ${CXX}"
|
||||
|
||||
LIBCUPS="libcups.la"
|
||||
LIBCUPSSTATIC="libcups.la"
|
||||
LIBCUPSCGI="libcupscgi.la"
|
||||
LIBCUPSIMAGE="libcupsimage.la"
|
||||
LIBCUPSMIME="libcupsmime.la"
|
||||
LIBCUPSPPDC="libcupsppdc.la"
|
||||
|
||||
LIBTOOL_CC="\$(LIBTOOL) --mode=compile --tag=CC"
|
||||
LIBTOOL_CXX="\$(LIBTOOL) --mode=compile --tag=CXX"
|
||||
LIBTOOL_INSTALL="\$(LIBTOOL) --mode=install"
|
||||
|
||||
LINKCUPS="../cups/\$(LIBCUPS)"
|
||||
LINKCUPSIMAGE="../filter/\$(LIBCUPSIMAGE)"
|
||||
DSO="\$(CC)"
|
||||
|
||||
else
|
||||
LD_CC="\$(CC)"
|
||||
LD_CXX="\$(CXX)"
|
||||
|
||||
LIBTOOL_CC=""
|
||||
LIBTOOL_CXX=""
|
||||
LIBTOOL_INSTALL=""
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
INSTALL_STRIP=""
|
||||
OPTIM=""
|
||||
|
||||
@@ -6980,6 +7068,32 @@ fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Wno-format-truncation" >&5
|
||||
$as_echo_n "checking whether compiler supports -Wno-format-truncation... " >&6; }
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror -Wno-format-truncation"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
OPTIM="$OPTIM -Wno-format-truncation"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
|
||||
# Additional warning options for development testing...
|
||||
if test -d .svn; then
|
||||
OPTIM="-Werror $OPTIM"
|
||||
@@ -7737,7 +7851,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_KRB5CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -7780,7 +7894,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_ac_pt_KRB5CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -8332,7 +8446,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_LIBGNUTLSCONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -8375,7 +8489,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_ac_pt_LIBGNUTLSCONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -8411,104 +8525,6 @@ else
|
||||
LIBGNUTLSCONFIG="$ac_cv_path_LIBGNUTLSCONFIG"
|
||||
fi
|
||||
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}libgcrypt-config", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}libgcrypt-config; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_LIBGCRYPTCONFIG+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $LIBGCRYPTCONFIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_LIBGCRYPTCONFIG="$LIBGCRYPTCONFIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_path_LIBGCRYPTCONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
LIBGCRYPTCONFIG=$ac_cv_path_LIBGCRYPTCONFIG
|
||||
if test -n "$LIBGCRYPTCONFIG"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPTCONFIG" >&5
|
||||
$as_echo "$LIBGCRYPTCONFIG" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
if test -z "$ac_cv_path_LIBGCRYPTCONFIG"; then
|
||||
ac_pt_LIBGCRYPTCONFIG=$LIBGCRYPTCONFIG
|
||||
# Extract the first word of "libgcrypt-config", so it can be a program name with args.
|
||||
set dummy libgcrypt-config; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_ac_pt_LIBGCRYPTCONFIG+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $ac_pt_LIBGCRYPTCONFIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_ac_pt_LIBGCRYPTCONFIG="$ac_pt_LIBGCRYPTCONFIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_path_ac_pt_LIBGCRYPTCONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
ac_pt_LIBGCRYPTCONFIG=$ac_cv_path_ac_pt_LIBGCRYPTCONFIG
|
||||
if test -n "$ac_pt_LIBGCRYPTCONFIG"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_LIBGCRYPTCONFIG" >&5
|
||||
$as_echo "$ac_pt_LIBGCRYPTCONFIG" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
if test "x$ac_pt_LIBGCRYPTCONFIG" = x; then
|
||||
LIBGCRYPTCONFIG=""
|
||||
else
|
||||
case $cross_compiling:$ac_tool_warned in
|
||||
yes:)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
|
||||
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
|
||||
ac_tool_warned=yes ;;
|
||||
esac
|
||||
LIBGCRYPTCONFIG=$ac_pt_LIBGCRYPTCONFIG
|
||||
fi
|
||||
else
|
||||
LIBGCRYPTCONFIG="$ac_cv_path_LIBGCRYPTCONFIG"
|
||||
fi
|
||||
|
||||
if $PKGCONFIG --exists gnutls; then
|
||||
have_ssl=1
|
||||
SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
@@ -9032,6 +9048,8 @@ _ACEOF
|
||||
esac
|
||||
rm -rf conftest*
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -10050,11 +10068,11 @@ _ACEOF
|
||||
if test "${with_java+set}" = set; then :
|
||||
withval=$with_java; CUPS_JAVA="$withval"
|
||||
else
|
||||
CUPS_JAVA=""
|
||||
CUPS_JAVA="auto"
|
||||
fi
|
||||
|
||||
|
||||
if test "x$CUPS_JAVA" = x; then
|
||||
if test "x$CUPS_JAVA" = xauto; then
|
||||
# Extract the first word of "java", so it can be a program name with args.
|
||||
set dummy java; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
@@ -10073,7 +10091,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_JAVA="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -10096,6 +10114,8 @@ fi
|
||||
|
||||
|
||||
CUPS_JAVA="$JAVA"
|
||||
elif test "x$CUPS_JAVA" = xno; then
|
||||
CUPS_JAVA=""
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -10113,11 +10133,11 @@ fi
|
||||
if test "${with_perl+set}" = set; then :
|
||||
withval=$with_perl; CUPS_PERL="$withval"
|
||||
else
|
||||
CUPS_PERL=""
|
||||
CUPS_PERL="auto"
|
||||
fi
|
||||
|
||||
|
||||
if test "x$CUPS_PERL" = x; then
|
||||
if test "x$CUPS_PERL" = xauto; then
|
||||
# Extract the first word of "perl", so it can be a program name with args.
|
||||
set dummy perl; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
@@ -10136,7 +10156,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -10159,6 +10179,8 @@ fi
|
||||
|
||||
|
||||
CUPS_PERL="$PERL"
|
||||
elif test "x$CUPS_PERL" = xno; then
|
||||
CUPS_PERL=""
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -10176,11 +10198,11 @@ fi
|
||||
if test "${with_php+set}" = set; then :
|
||||
withval=$with_php; CUPS_PHP="$withval"
|
||||
else
|
||||
CUPS_PHP=""
|
||||
CUPS_PHP="auto"
|
||||
fi
|
||||
|
||||
|
||||
if test "x$CUPS_PHP" = x; then
|
||||
if test "x$CUPS_PHP" = xauto; then
|
||||
# Extract the first word of "php-cgi", so it can be a program name with args.
|
||||
set dummy php-cgi; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
@@ -10199,7 +10221,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PHPCGI="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -10240,7 +10262,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PHP="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -10266,6 +10288,8 @@ fi
|
||||
else
|
||||
CUPS_PHP="$PHPCGI"
|
||||
fi
|
||||
elif test "x$CUPS_PHP" = xno; then
|
||||
CUPS_PHP=""
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -10285,11 +10309,11 @@ fi
|
||||
if test "${with_python+set}" = set; then :
|
||||
withval=$with_python; CUPS_PYTHON="$withval"
|
||||
else
|
||||
CUPS_PYTHON=""
|
||||
CUPS_PYTHON="auto"
|
||||
fi
|
||||
|
||||
|
||||
if test "x$CUPS_PYTHON" = x; then
|
||||
if test "x$CUPS_PYTHON" = xauto; then
|
||||
# Extract the first word of "python", so it can be a program name with args.
|
||||
set dummy python; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
@@ -10308,7 +10332,7 @@ do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
@@ -10331,6 +10355,8 @@ fi
|
||||
|
||||
|
||||
CUPS_PYTHON="$PYTHON"
|
||||
elif test "x$CUPS_PYTHON" = xno; then
|
||||
CUPS_PYTHON=""
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -10776,16 +10802,16 @@ if (echo >conf$$.file) 2>/dev/null; then
|
||||
# ... but there are two gotchas:
|
||||
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
|
||||
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
|
||||
# In both cases, we have to default to `cp -p'.
|
||||
# In both cases, we have to default to `cp -pR'.
|
||||
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
elif ln conf$$.file conf$$ 2>/dev/null; then
|
||||
as_ln_s=ln
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
fi
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
fi
|
||||
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
|
||||
rmdir conf$$.dir 2>/dev/null
|
||||
@@ -10845,28 +10871,16 @@ else
|
||||
as_mkdir_p=false
|
||||
fi
|
||||
|
||||
if test -x / >/dev/null 2>&1; then
|
||||
as_test_x='test -x'
|
||||
else
|
||||
if ls -dL / >/dev/null 2>&1; then
|
||||
as_ls_L_option=L
|
||||
else
|
||||
as_ls_L_option=
|
||||
fi
|
||||
as_test_x='
|
||||
eval sh -c '\''
|
||||
if test -d "$1"; then
|
||||
test -d "$1/.";
|
||||
else
|
||||
case $1 in #(
|
||||
-*)set "./$1";;
|
||||
esac;
|
||||
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
|
||||
???[sx]*):;;*)false;;esac;fi
|
||||
'\'' sh
|
||||
'
|
||||
fi
|
||||
as_executable_p=$as_test_x
|
||||
|
||||
# as_fn_executable_p FILE
|
||||
# -----------------------
|
||||
# Test if FILE is an executable regular file.
|
||||
as_fn_executable_p ()
|
||||
{
|
||||
test -f "$1" && test -x "$1"
|
||||
} # as_fn_executable_p
|
||||
as_test_x='test -x'
|
||||
as_executable_p=as_fn_executable_p
|
||||
|
||||
# Sed expression to map a string onto a valid CPP name.
|
||||
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
|
||||
@@ -10887,8 +10901,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by CUPS $as_me 2.2.4, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
This file was extended by CUPS $as_me 2.2.7, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
CONFIG_HEADERS = $CONFIG_HEADERS
|
||||
@@ -10950,11 +10964,11 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
CUPS config.status 2.2.4
|
||||
configured by $0, generated by GNU Autoconf 2.68,
|
||||
CUPS config.status 2.2.7
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
This config.status script is free software; the Free Software Foundation
|
||||
gives unlimited permission to copy, distribute and modify it."
|
||||
|
||||
@@ -11043,7 +11057,7 @@ fi
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
if \$ac_cs_recheck; then
|
||||
set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
|
||||
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
|
||||
shift
|
||||
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
|
||||
CONFIG_SHELL='$SHELL'
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
dnl
|
||||
dnl Configuration script for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2017 by Apple Inc.
|
||||
dnl Copyright 2007-2018 by Apple Inc.
|
||||
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -15,7 +15,7 @@ dnl We need at least autoconf 2.60...
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
dnl Package name and version...
|
||||
AC_INIT([CUPS], [2.2.4], [https://github.com/apple/cups/issues], [cups], [https://www.cups.org/])
|
||||
AC_INIT([CUPS], [2.2.7], [https://github.com/apple/cups/issues], [cups], [https://www.cups.org/])
|
||||
|
||||
sinclude(config-scripts/cups-opsys.m4)
|
||||
sinclude(config-scripts/cups-common.m4)
|
||||
|
||||
+49
-25
@@ -1,8 +1,8 @@
|
||||
#
|
||||
# API library Makefile for CUPS.
|
||||
# Library Makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
# Copyright © 2007-2018 by Apple Inc.
|
||||
# Copyright © 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -89,6 +89,7 @@ TESTOBJS = \
|
||||
testcups.o \
|
||||
testdest.o \
|
||||
testfile.o \
|
||||
testgetdests.o \
|
||||
testhttp.o \
|
||||
testi18n.o \
|
||||
testipp.o \
|
||||
@@ -158,6 +159,7 @@ UNITTARGETS = \
|
||||
testcups \
|
||||
testdest \
|
||||
testfile \
|
||||
testgetdests \
|
||||
testhttp \
|
||||
testi18n \
|
||||
testipp \
|
||||
@@ -329,7 +331,7 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
|
||||
echo Linking $@...
|
||||
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
|
||||
-install_name $(libdir)/$@ \
|
||||
-current_version 2.12.0 \
|
||||
-current_version 2.13.0 \
|
||||
-compatibility_version 2.0.0 \
|
||||
-exported_symbols_list t.exp \
|
||||
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
@@ -344,8 +346,8 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
|
||||
|
||||
libcups.la: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
|
||||
-rpath $(LIBDIR) -version-info 2:12 $(LIBGSSAPI) $(SSLLIBS) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
|
||||
-rpath $(LIBDIR) -version-info 2:13 $(LIBGSSAPI) $(SSLLIBS) \
|
||||
$(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -367,7 +369,7 @@ libcups.a: $(LIBOBJS)
|
||||
libcups2.def: $(LIBOBJS) Makefile
|
||||
echo Generating $@...
|
||||
echo "LIBRARY libcups2" >libcups2.def
|
||||
echo "VERSION 2.12" >>libcups2.def
|
||||
echo "VERSION 2.13" >>libcups2.def
|
||||
echo "EXPORTS" >>libcups2.def
|
||||
(nm $(LIBOBJS) 2>/dev/null | grep "T _" | awk '{print $$3}'; \
|
||||
echo __cups_strcpy; echo __cups_strlcat; echo __cups_strlcpy) | \
|
||||
@@ -383,7 +385,7 @@ libcups2.def: $(LIBOBJS) Makefile
|
||||
|
||||
testadmin: testadmin.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testadmin.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(LDFLAGS) -o $@ testadmin.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -393,7 +395,7 @@ testadmin: testadmin.o $(LIBCUPSSTATIC)
|
||||
|
||||
testarray: testarray.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running array API tests...
|
||||
./testarray
|
||||
@@ -405,7 +407,7 @@ testarray: testarray.o $(LIBCUPSSTATIC)
|
||||
|
||||
testcache: testcache.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testcache.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(LDFLAGS) -o $@ testcache.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -415,7 +417,7 @@ testcache: testcache.o $(LIBCUPSSTATIC)
|
||||
|
||||
testconflicts: testconflicts.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testconflicts.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(LDFLAGS) -o $@ testconflicts.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -425,7 +427,7 @@ testconflicts: testconflicts.o $(LIBCUPSSTATIC)
|
||||
|
||||
testcreds: testcreds.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcreds.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcreds.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -435,7 +437,7 @@ testcreds: testcreds.o $(LIBCUPSSTATIC)
|
||||
|
||||
testcups: testcups.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testcups.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(LDFLAGS) -o $@ testcups.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -445,7 +447,7 @@ testcups: testcups.o $(LIBCUPSSTATIC)
|
||||
|
||||
testdest: testdest.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testdest.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(LDFLAGS) -o $@ testdest.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -455,19 +457,29 @@ testdest: testdest.o $(LIBCUPSSTATIC)
|
||||
|
||||
testfile: testfile.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running file API tests...
|
||||
./testfile
|
||||
|
||||
|
||||
#
|
||||
# testgetdests (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testgetdests: testgetdests.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o $@ testgetdests.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testhttp (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testhttp: testhttp.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running HTTP API tests...
|
||||
./testhttp
|
||||
@@ -479,7 +491,7 @@ testhttp: testhttp.o $(LIBCUPSSTATIC)
|
||||
|
||||
testipp: testipp.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running IPP API tests...
|
||||
./testipp
|
||||
@@ -491,7 +503,7 @@ testipp: testipp.o $(LIBCUPSSTATIC)
|
||||
|
||||
testi18n: testi18n.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running internationalization API tests...
|
||||
./testi18n
|
||||
@@ -503,10 +515,22 @@ testi18n: testi18n.o $(LIBCUPSSTATIC)
|
||||
|
||||
testlang: testlang.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Creating locale directory structure...
|
||||
$(RM) -r locale
|
||||
$(MKDIR) locale/en
|
||||
echo 'msgid "No"' > locale/en/cups_en.po
|
||||
echo 'msgstr "No"' >> locale/en/cups_en.po
|
||||
echo 'msgid "Yes"' >> locale/en/cups_en.po
|
||||
echo 'msgstr "Yes"' >> locale/en/cups_en.po
|
||||
for po in ../locale/cups_*.po; do \
|
||||
lang=`basename $$po .po | sed -e '1,$$s/^cups_//'`; \
|
||||
$(MKDIR) locale/$$lang; \
|
||||
$(LN) ../../$$po locale/$$lang; \
|
||||
done
|
||||
echo Running language API tests...
|
||||
./testlang
|
||||
LOCALEDIR=locale ./testlang
|
||||
|
||||
|
||||
#
|
||||
@@ -515,7 +539,7 @@ testlang: testlang.o $(LIBCUPSSTATIC)
|
||||
|
||||
testoptions: testoptions.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running option API tests...
|
||||
./testoptions
|
||||
@@ -527,7 +551,7 @@ testoptions: testoptions.o $(LIBCUPSSTATIC)
|
||||
|
||||
testppd: testppd.o $(LIBCUPSSTATIC) test.ppd test2.ppd
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running PPD API tests...
|
||||
./testppd
|
||||
@@ -539,7 +563,7 @@ testppd: testppd.o $(LIBCUPSSTATIC) test.ppd test2.ppd
|
||||
|
||||
testpwg: testpwg.o $(LIBCUPSSTATIC) test.ppd
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testpwg.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testpwg.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running PWG API tests...
|
||||
./testpwg test.ppd
|
||||
@@ -551,7 +575,7 @@ testpwg: testpwg.o $(LIBCUPSSTATIC) test.ppd
|
||||
|
||||
testsnmp: testsnmp.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testsnmp.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(LDFLAGS) -o $@ testsnmp.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -561,7 +585,7 @@ testsnmp: testsnmp.o $(LIBCUPSSTATIC)
|
||||
|
||||
tlscheck: tlscheck.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ tlscheck.o $(LIBCUPSSTATIC) \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ tlscheck.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<!--
|
||||
Array API header for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>Array API</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Header</th>
|
||||
<th>cups/array.h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Library</th>
|
||||
<td>-lcups</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>See Also</th>
|
||||
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
@@ -1,194 +0,0 @@
|
||||
<!--
|
||||
Array API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
|
||||
|
||||
<p>The CUPS array API provides a high-performance generic array container.
|
||||
The contents of the array container can be sorted and the container itself is
|
||||
designed for optimal speed and memory usage under a wide variety of conditions.
|
||||
Sorted arrays use a binary search algorithm from the last found or inserted
|
||||
element to quickly find matching elements in the array. Arrays created with the
|
||||
optional hash function can often find elements with a single lookup. The
|
||||
<a href='#cups_array_t'><code>cups_array_t</code></a> type is used when
|
||||
referring to a CUPS array.</p>
|
||||
|
||||
<p>The CUPS scheduler (<tt>cupsd</tt>) and many of the CUPS API
|
||||
functions use the array API to efficiently manage large lists of
|
||||
data.</p>
|
||||
|
||||
<h3><a name='MANAGING_ARRAYS'>Managing Arrays</a></h3>
|
||||
|
||||
<p>Arrays are created using either the
|
||||
<a href='#cupsArrayNew'><code>cupsArrayNew</code></a>,
|
||||
<a href='#cupsArrayNew2'><code>cupsArrayNew2</code></a>, or
|
||||
<a href='#cupsArrayNew2'><code>cupsArrayNew3</code></a> functions. The
|
||||
first function creates a new array with the specified callback function
|
||||
and user data pointer:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/array.h>
|
||||
|
||||
static int compare_func(void *first, void *second, void *user_data);
|
||||
|
||||
void *user_data;
|
||||
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew'>cupsArrayNew</a>(compare_func, user_data);
|
||||
</pre>
|
||||
|
||||
<p>The comparison function (type
|
||||
<a href="#cups_arrayfunc_t"><code>cups_arrayfunc_t</code></a>) is called
|
||||
whenever an element is added to the array and can be <code>NULL</code> to
|
||||
create an unsorted array. The function returns -1 if the first element should
|
||||
come before the second, 0 if the first and second elements should have the same
|
||||
ordering, and 1 if the first element should come after the second.</p>
|
||||
|
||||
<p>The "user_data" pointer is passed to your comparison function. Pass
|
||||
<code>NULL</code> if you do not need to associate the elements in your array
|
||||
with additional information.</p>
|
||||
|
||||
<p>The <a href='#cupsArrayNew2'><code>cupsArrayNew2</code></a> function adds
|
||||
two more arguments to support hashed lookups, which can potentially provide
|
||||
instantaneous ("O(1)") lookups in your array:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/array.h>
|
||||
|
||||
#define HASH_SIZE 512 /* Size of hash table */
|
||||
|
||||
static int compare_func(void *first, void *second, void *user_data);
|
||||
static int hash_func(void *element, void *user_data);
|
||||
|
||||
void *user_data;
|
||||
<a href='#cups_array_t'>cups_array_t</a> *hash_array = <a href='#cupsArrayNew2'>cupsArrayNew2</a>(compare_func, user_data, hash_func, HASH_SIZE);
|
||||
</pre>
|
||||
|
||||
<p>The hash function (type
|
||||
<a href="#cups_ahash_func_t"><code>cups_ahash_func_t</code></a>) should return a
|
||||
number from 0 to (hash_size-1) that (hopefully) uniquely identifies the
|
||||
element and is called whenever you look up an element in the array with
|
||||
<a href='#cupsArrayFind'><code>cupsArrayFind</code></a>. The hash size is
|
||||
only limited by available memory, but generally should not be larger than
|
||||
16384 to realize any performance improvement.</p>
|
||||
|
||||
<p>The <a href='#cupsArrayNew3'><code>cupsArrayNew3</code></a> function adds
|
||||
copy and free callbacks to support basic memory management of elements:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/array.h>
|
||||
|
||||
#define HASH_SIZE 512 /* Size of hash table */
|
||||
|
||||
static int compare_func(void *first, void *second, void *user_data);
|
||||
static void *copy_func(void *element, void *user_data);
|
||||
static void free_func(void *element, void *user_data);
|
||||
static int hash_func(void *element, void *user_data);
|
||||
|
||||
void *user_data;
|
||||
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew3'>cupsArrayNew3</a>(compare_func, user_data, NULL, 0, copy_func, free_func);
|
||||
|
||||
<a href='#cups_array_t'>cups_array_t</a> *hash_array = <a href='#cupsArrayNew3'>cupsArrayNew3</a>(compare_func, user_data, hash_func, HASH_SIZE, copy_func, free_func);
|
||||
</pre>
|
||||
|
||||
<p>Once you have created the array, you add elements using the
|
||||
<a href='#cupsArrayAdd'><code>cupsArrayAdd</code></a>
|
||||
<a href='#cupsArrayInsert'><code>cupsArrayInsert</code></a> functions.
|
||||
The first function adds an element to the array, adding the new element
|
||||
after any elements that have the same order, while the second inserts the
|
||||
element before others with the same order. For unsorted arrays,
|
||||
<a href='#cupsArrayAdd'><code>cupsArrayAdd</code></a> appends the element to
|
||||
the end of the array while
|
||||
<a href='#cupsArrayInsert'><code>cupsArrayInsert</code></a> inserts the
|
||||
element at the beginning of the array. For example, the following code
|
||||
creates a sorted array of character strings:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/array.h>
|
||||
|
||||
/* Use strcmp() to compare strings - it will ignore the user_data pointer */
|
||||
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew'>cupsArrayNew</a>((<a href='#cups_array_func_t'>cups_array_func_t</a>)strcmp, NULL);
|
||||
|
||||
/* Add four strings to the array */
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "One Fish");
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Two Fish");
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Red Fish");
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Blue Fish");
|
||||
</pre>
|
||||
|
||||
<p>Elements are removed using the
|
||||
<a href='#cupsArrayRemove'><code>cupsArrayRemove</code></a> function, for
|
||||
example:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/array.h>
|
||||
|
||||
/* Use strcmp() to compare strings - it will ignore the user_data pointer */
|
||||
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew'>cupsArrayNew</a>((<a href='#cups_array_func_t'>cups_array_func_t</a>)strcmp, NULL);
|
||||
|
||||
/* Add four strings to the array */
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "One Fish");
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Two Fish");
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Red Fish");
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Blue Fish");
|
||||
|
||||
/* Remove "Red Fish" */
|
||||
<a href='#cupsArrayRemove'>cupsArrayRemove</a>(array, "Red Fish");
|
||||
</pre>
|
||||
|
||||
<p>Finally, you free the memory used by the array using the
|
||||
<a href='#cupsArrayDelete'><code>cupsArrayDelete</code></a> function. All
|
||||
of the memory for the array and hash table (if any) is freed, however <em>CUPS
|
||||
does not free the elements unless you provide copy and free functions</em>.</p>
|
||||
|
||||
<h3><a name='FINDING_AND_ENUMERATING'>Finding and Enumerating Elements</a></h3>
|
||||
|
||||
<p>CUPS provides several functions to find and enumerate elements in an
|
||||
array. Each one sets or updates a "current index" into the array, such that
|
||||
future lookups will start where the last one left off:</p>
|
||||
|
||||
<dl>
|
||||
<dt><a href='#cupsArrayFind'><code>cupsArrayFind</code></a></dt>
|
||||
<dd>Returns the first matching element.</dd>
|
||||
<dt><a href='#cupsArrayFirst'><code>cupsArrayFirst</code></a></dt>
|
||||
<dd>Returns the first element in the array.</dd>
|
||||
<dt><a href='#cupsArrayIndex'><code>cupsArrayIndex</code></a></dt>
|
||||
<dd>Returns the Nth element in the array, starting at 0.</dd>
|
||||
<dt><a href='#cupsArrayLast'><code>cupsArrayLast</code></a></dt>
|
||||
<dd>Returns the last element in the array.</dd>
|
||||
<dt><a href='#cupsArrayNext'><code>cupsArrayNext</code></a></dt>
|
||||
<dd>Returns the next element in the array.</dd>
|
||||
<dt><a href='#cupsArrayPrev'><code>cupsArrayPrev</code></a></dt>
|
||||
<dd>Returns the previous element in the array.</dd>
|
||||
</dl>
|
||||
|
||||
<p>Each of these functions returns <code>NULL</code> when there is no
|
||||
corresponding element. For example, a simple <code>for</code> loop using the
|
||||
<a href='#cupsArrayFirst'><code>cupsArrayFirst</code></a> and
|
||||
<a href='#cupsArrayNext'><code>cupsArrayNext</code></a> functions will
|
||||
enumerate all of the strings in our previous example:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/array.h>
|
||||
|
||||
/* Use strcmp() to compare strings - it will ignore the user_data pointer */
|
||||
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew'>cupsArrayNew</a>((<a href='#cups_array_func_t'>cups_array_func_t</a>)strcmp, NULL);
|
||||
|
||||
/* Add four strings to the array */
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "One Fish");
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Two Fish");
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Red Fish");
|
||||
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Blue Fish");
|
||||
|
||||
/* Show all of the strings in the array */
|
||||
char *s;
|
||||
for (s = (char *)<a href='#cupsArrayFirst'>cupsArrayFirst</a>(array); s != NULL; s = (char *)<a href='#cupsArrayNext'>cupsArrayNext</a>(array))
|
||||
puts(s);
|
||||
</pre>
|
||||
@@ -1,38 +0,0 @@
|
||||
<!--
|
||||
CUPS API header for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>CUPS API</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Header</th>
|
||||
<th>cups/cups.h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Library</th>
|
||||
<td>-lcups</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>See Also</th>
|
||||
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
|
||||
Programming: <a href='api-array.html' target='_top'>Array API</a><br>
|
||||
Programming: <a href='api-filedir.html' target='_top'>File and Directory APIs</a><br>
|
||||
Programming: <a href='api-filter.html' target='_top'>Filter and Backend Programming</a><br>
|
||||
Programming: <a href='api-httpipp.html' target='_top'>HTTP and IPP APIs</a><br>
|
||||
Programming: <a href='api-ppd.html' target='_top'>PPD API</a><br>
|
||||
Programming: <a href='api-raster.html' target='_top'>Raster API</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
@@ -1,441 +0,0 @@
|
||||
<!--
|
||||
API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2013 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
|
||||
|
||||
<p>The CUPS API provides the convenience functions needed to support
|
||||
applications, filters, printer drivers, and backends that need to interface
|
||||
with the CUPS scheduler.</p>
|
||||
|
||||
<h3><a name='CLIENTS_AND_SERVERS'>Clients and Servers</a></h3>
|
||||
|
||||
<p>CUPS is based on the Internet Printing Protocol ("IPP"), which allows
|
||||
clients (applications) to communicate with a server (the scheduler) to get a
|
||||
list of printers, send print jobs, and so forth. You identify which server
|
||||
you want to communicate with using a pointer to the opaque structure
|
||||
<code>http_t</code>. All of the examples in this document use the
|
||||
<code>CUPS_HTTP_DEFAULT</code> constant, referring to the default connection
|
||||
to the scheduler. The <a href='api-httpipp.html' target='_top'>HTTP and IPP
|
||||
APIs</a> document provides more information on server connections.</p>
|
||||
|
||||
<h3><a name='PRINTERS_AND_CLASSES'>Printers and Classes</a></h3>
|
||||
|
||||
<p>Printers and classes (collections of printers) are accessed through
|
||||
the <a href="#cups_dest_t"><code>cups_dest_t</code></a> structure which
|
||||
includes the name (<code>name</code>), instance (<code>instance</code> -
|
||||
a way of selecting certain saved options/settings), and the options and
|
||||
attributes associated with that destination (<code>num_options</code> and
|
||||
<code>options</code>). Destinations are created using the
|
||||
<a href="#cupsGetDests"><code>cupsGetDests</code></a> function and freed
|
||||
using the <a href='#cupsFreeDests'><code>cupsFreeDests</code></a> function.
|
||||
The <a href='#cupsGetDest'><code>cupsGetDest</code></a> function finds a
|
||||
specific destination for printing:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dests;
|
||||
int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&dests);
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dest = <a href='#cupsGetDest'>cupsGetDest</a>("name", NULL, num_dests, dests);
|
||||
|
||||
/* do something with dest */
|
||||
|
||||
<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
|
||||
</pre>
|
||||
|
||||
<p>Passing <code>NULL</code> to
|
||||
<a href='#cupsGetDest'><code>cupsGetDest</code></a> for the destination name
|
||||
will return the default destination. Similarly, passing a <code>NULL</code>
|
||||
instance will return the default instance for that destination.</p>
|
||||
|
||||
<div class='table'><table summary='Table 1: Printer Attributes' width='80%'>
|
||||
<caption>Table 1: <a name='TABLE1'>Printer Attributes</a></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>"auth-info-required"</td>
|
||||
<td>The type of authentication required for printing to this
|
||||
destination: "none", "username,password", "domain,username,password",
|
||||
or "negotiate" (Kerberos)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-info"</td>
|
||||
<td>The human-readable description of the destination such as "My
|
||||
Laser Printer".</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-is-accepting-jobs"</td>
|
||||
<td>"true" if the destination is accepting new jobs, "false" if
|
||||
not.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-is-shared"</td>
|
||||
<td>"true" if the destination is being shared with other computers,
|
||||
"false" if not.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-location"</td>
|
||||
<td>The human-readable location of the destination such as "Lab 4".</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-make-and-model"</td>
|
||||
<td>The human-readable make and model of the destination such as "HP
|
||||
LaserJet 4000 Series".</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-state"</td>
|
||||
<td>"3" if the destination is idle, "4" if the destination is printing
|
||||
a job, and "5" if the destination is stopped.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-state-change-time"</td>
|
||||
<td>The UNIX time when the destination entered the current state.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-state-reasons"</td>
|
||||
<td>Additional comma-delimited state keywords for the destination
|
||||
such as "media-tray-empty-error" and "toner-low-warning".</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-type"</td>
|
||||
<td>The <a href='#cups_printer_t'><code>cups_printer_t</code></a>
|
||||
value associated with the destination.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
<h3><a name='OPTIONS'>Options</a></h3>
|
||||
|
||||
<p>Options are stored in arrays of
|
||||
<a href='#cups_option_t'><code>cups_option_t</code></a> structures. Each
|
||||
option has a name (<code>name</code>) and value (<code>value</code>)
|
||||
associated with it. The <a href='#cups_dest_t'><code>cups_dest_t</code></a>
|
||||
<code>num_options</code> and <code>options</code> members contain the
|
||||
default options for a particular destination, along with several informational
|
||||
attributes about the destination as shown in <a href='#TABLE1'>Table 1</a>.
|
||||
The <a href='#cupsGetOption'><code>cupsGetOption</code></a> function gets
|
||||
the value for the named option. For example, the following code lists the
|
||||
available destinations and their human-readable descriptions:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dests;
|
||||
int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&dests);
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
|
||||
int i;
|
||||
const char *value;
|
||||
|
||||
for (i = num_dests, dest = dests; i > 0; i --, dest ++)
|
||||
if (dest->instance == NULL)
|
||||
{
|
||||
value = <a href='#cupsGetOption'>cupsGetOption</a>("printer-info", dest->num_options, dest->options);
|
||||
printf("%s (%s)\n", dest->name, value ? value : "no description");
|
||||
}
|
||||
|
||||
<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
|
||||
</pre>
|
||||
|
||||
<p>You can create your own option arrays using the
|
||||
<a href='#cupsAddOption'><code>cupsAddOption</code></a> function, which
|
||||
adds a single named option to an array:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
int num_options = 0;
|
||||
<a href='#cups_option_t'>cups_option_t</a> *options = NULL;
|
||||
|
||||
/* The returned num_options value is updated as needed */
|
||||
num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "value", num_options, &options);
|
||||
|
||||
/* This adds a second option value */
|
||||
num_options = <a href='#cupsAddOption'>cupsAddOption</a>("second", "value", num_options, &options);
|
||||
|
||||
/* This replaces the first option we added */
|
||||
num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "new value", num_options, &options);
|
||||
</pre>
|
||||
|
||||
<p>Use a <code>for</code> loop to copy the options from a destination:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
int i;
|
||||
int num_options = 0;
|
||||
<a href='#cups_option_t'>cups_option_t</a> *options = NULL;
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
|
||||
|
||||
for (i = 0; i < dest->num_options; i ++)
|
||||
num_options = <a href='#cupsAddOption'>cupsAddOption</a>(dest->options[i].name, dest->options[i].value,
|
||||
num_options, &options);
|
||||
</pre>
|
||||
|
||||
<p>Use the <a href='#cupsFreeOptions'><code>cupsFreeOptions</code></a>
|
||||
function to free the options array when you are done using it:</p>
|
||||
|
||||
<pre class='example'>
|
||||
<a href='#cupsFreeOptions'>cupsFreeOptions</a>(num_options, options);
|
||||
</pre>
|
||||
|
||||
<h3><a name='PRINT_JOBS'>Print Jobs</a></h3>
|
||||
|
||||
<p>Print jobs are identified by a locally-unique job ID number from 1 to
|
||||
2<sup>31</sup>-1 and have options and one or more files for printing to a
|
||||
single destination. The <a href='#cupsPrintFile'><code>cupsPrintFile</code></a>
|
||||
function creates a new job with one file. The following code prints the CUPS
|
||||
test page file:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
|
||||
int num_options;
|
||||
<a href='#cups_option_t'>cups_option_t</a> *options;
|
||||
int job_id;
|
||||
|
||||
/* Print a single file */
|
||||
job_id = <a href='#cupsPrintFile'>cupsPrintFile</a>(dest->name, "/usr/share/cups/data/testprint.ps",
|
||||
"Test Print", num_options, options);
|
||||
</pre>
|
||||
|
||||
<p>The <a href='#cupsPrintFiles'><code>cupsPrintFiles</code></a> function
|
||||
creates a job with multiple files. The files are provided in a
|
||||
<code>char *</code> array:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
|
||||
int num_options;
|
||||
<a href='#cups_option_t'>cups_option_t</a> *options;
|
||||
int job_id;
|
||||
char *files[3] = { "file1.pdf", "file2.pdf", "file3.pdf" };
|
||||
|
||||
/* Print three files */
|
||||
job_id = <a href='#cupsPrintFiles'>cupsPrintFiles</a>(dest->name, 3, files, "Test Print", num_options, options);
|
||||
</pre>
|
||||
|
||||
<p>Finally, the <a href='#cupsCreateJob'><code>cupsCreateJob</code></a>
|
||||
function creates a new job with no files in it. Files are added using the
|
||||
<a href='#cupsStartDocument'><code>cupsStartDocument</code></a>,
|
||||
<a href='api-httpipp.html#cupsWriteRequestData'><code>cupsWriteRequestData</code></a>,
|
||||
and <a href='#cupsFinishDocument'><code>cupsFinishDocument</code></a> functions.
|
||||
The following example creates a job with 10 text files for printing:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
|
||||
int num_options;
|
||||
<a href='#cups_option_t'>cups_option_t</a> *options;
|
||||
int job_id;
|
||||
int i;
|
||||
char buffer[1024];
|
||||
|
||||
/* Create the job */
|
||||
job_id = <a href='#cupsCreateJob'>cupsCreateJob</a>(CUPS_HTTP_DEFAULT, dest->name, "10 Text Files",
|
||||
num_options, options);
|
||||
|
||||
/* If the job is created, add 10 files */
|
||||
if (job_id > 0)
|
||||
{
|
||||
for (i = 1; i <= 10; i ++)
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer), "file%d.txt", i);
|
||||
|
||||
<a href='#cupsStartDocument'>cupsStartDocument</a>(CUPS_HTTP_DEFAULT, dest->name, job_id, buffer,
|
||||
CUPS_FORMAT_TEXT, i == 10);
|
||||
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"File %d\n"
|
||||
"\n"
|
||||
"One fish,\n"
|
||||
"Two fish,\n
|
||||
"Red fish,\n
|
||||
"Blue fish\n", i);
|
||||
|
||||
/* cupsWriteRequestData can be called as many times as needed */
|
||||
<a href='#cupsWriteRequestData'>cupsWriteRequestData</a>(CUPS_HTTP_DEFAULT, buffer, strlen(buffer));
|
||||
|
||||
<a href='#cupsFinishDocument'>cupsFinishDocument</a>(CUPS_HTTP_DEFAULT, dest->name);
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>Once you have created a job, you can monitor its status using the
|
||||
<a href='#cupsGetJobs'><code>cupsGetJobs</code></a> function, which returns
|
||||
an array of <a href='#cups_job_t'><code>cups_job_t</code></a> structures.
|
||||
Each contains the job ID (<code>id</code>), destination name
|
||||
(<code>dest</code>), title (<code>title</code>), and other information
|
||||
associated with the job. The job array is freed using the
|
||||
<a href='#cupsFreeJobs'><code>cupsFreeJobs</code></a> function. The following
|
||||
example monitors a specific job ID, showing the current job state once every
|
||||
5 seconds until the job is completed:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
|
||||
int job_id;
|
||||
int num_jobs;
|
||||
<a href='#cups_job_t'>cups_job_t</a> *jobs;
|
||||
int i;
|
||||
ipp_jstate_t job_state = IPP_JOB_PENDING;
|
||||
|
||||
while (job_state < IPP_JOB_STOPPED)
|
||||
{
|
||||
/* Get my jobs (1) with any state (-1) */
|
||||
num_jobs = <a href='#cupsGetJobs'>cupsGetJobs</a>(&jobs, dest->name, 1, -1);
|
||||
|
||||
/* Loop to find my job */
|
||||
job_state = IPP_JOB_COMPLETED;
|
||||
|
||||
for (i = 0; i < num_jobs; i ++)
|
||||
if (jobs[i].id == job_id)
|
||||
{
|
||||
job_state = jobs[i].state;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Free the job array */
|
||||
<a href='#cupsFreeJobs'>cupsFreeJobs</a>(num_jobs, jobs);
|
||||
|
||||
/* Show the current state */
|
||||
switch (job_state)
|
||||
{
|
||||
case IPP_JOB_PENDING :
|
||||
printf("Job %d is pending.\n", job_id);
|
||||
break;
|
||||
case IPP_JOB_HELD :
|
||||
printf("Job %d is held.\n", job_id);
|
||||
break;
|
||||
case IPP_JOB_PROCESSING :
|
||||
printf("Job %d is processing.\n", job_id);
|
||||
break;
|
||||
case IPP_JOB_STOPPED :
|
||||
printf("Job %d is stopped.\n", job_id);
|
||||
break;
|
||||
case IPP_JOB_CANCELED :
|
||||
printf("Job %d is canceled.\n", job_id);
|
||||
break;
|
||||
case IPP_JOB_ABORTED :
|
||||
printf("Job %d is aborted.\n", job_id);
|
||||
break;
|
||||
case IPP_JOB_COMPLETED :
|
||||
printf("Job %d is completed.\n", job_id);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Sleep if the job is not finished */
|
||||
if (job_state < IPP_JOB_STOPPED)
|
||||
sleep(5);
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>To cancel a job, use the
|
||||
<a href='#cupsCancelJob'><code>cupsCancelJob</code></a> function with the
|
||||
job ID:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
|
||||
int job_id;
|
||||
|
||||
<a href='#cupsCancelJob'>cupsCancelJob</a>(dest->name, job_id);
|
||||
</pre>
|
||||
|
||||
<h3><a name='ERROR_HANDLING'>Error Handling</a></h3>
|
||||
|
||||
<p>If any of the CUPS API printing functions returns an error, the reason for
|
||||
that error can be found by calling the
|
||||
<a href='#cupsLastError'><code>cupsLastError</code></a> and
|
||||
<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> functions.
|
||||
<a href='#cupsLastError'><code>cupsLastError</code></a> returns the last IPP
|
||||
error code
|
||||
(<a href='api-httpipp.html#ipp_status_t'><code>ipp_status_t</code></a>)
|
||||
that was encountered, while
|
||||
<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> returns
|
||||
a (localized) human-readable string that can be shown to the user. For example,
|
||||
if any of the job creation functions returns a job ID of 0, you can use
|
||||
<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> to show
|
||||
the reason why the job could not be created:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
int job_id;
|
||||
|
||||
if (job_id == 0)
|
||||
puts(cupsLastErrorString());
|
||||
</pre>
|
||||
|
||||
<h3><a name='PASSWORDS_AND_AUTHENTICATION'>Passwords and Authentication</a></h3>
|
||||
|
||||
<p>CUPS supports authentication of any request, including submission of print
|
||||
jobs. The default mechanism for getting the username and password is to use the
|
||||
login user and a password from the console.</p>
|
||||
|
||||
<p>To support other types of applications, in particular Graphical User
|
||||
Interfaces ("GUIs"), the CUPS API provides functions to set the default
|
||||
username and to register a callback function that returns a password string.</p>
|
||||
|
||||
<p>The <a href="#cupsSetPasswordCB"><code>cupsSetPasswordCB</code></a>
|
||||
function is used to set a password callback in your program. Only one
|
||||
function can be used at any time.</p>
|
||||
|
||||
<p>The <a href="#cupsSetUser"><code>cupsSetUser</code></a> function sets the
|
||||
current username for authentication. This function can be called by your
|
||||
password callback function to change the current username as needed.</p>
|
||||
|
||||
<p>The following example shows a simple password callback that gets a
|
||||
username and password from the user:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
const char *
|
||||
my_password_cb(const char *prompt)
|
||||
{
|
||||
char user[65];
|
||||
|
||||
|
||||
puts(prompt);
|
||||
|
||||
/* Get a username from the user */
|
||||
printf("Username: ");
|
||||
if (fgets(user, sizeof(user), stdin) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/* Strip the newline from the string and set the user */
|
||||
user[strlen(user) - 1] = '\0';
|
||||
|
||||
<a href='#cupsSetUser'>cupsSetUser</a>(user);
|
||||
|
||||
/* Use getpass() to ask for the password... */
|
||||
return (getpass("Password: "));
|
||||
}
|
||||
|
||||
<a href='#cupsSetPasswordCB'>cupsSetPasswordCB</a>(my_password_cb);
|
||||
</pre>
|
||||
|
||||
<p>Similarly, a GUI could display the prompt string in a window with input
|
||||
fields for the username and password. The username should default to the
|
||||
string returned by the <a href="#cupsUser"><code>cupsUser</code></a>
|
||||
function.</p>
|
||||
@@ -1,34 +0,0 @@
|
||||
<!--
|
||||
File and Directory API header for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>File and Directory APIs</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Headers</th>
|
||||
<th>cups/file.h<br>
|
||||
cups/dir.h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Library</th>
|
||||
<td>-lcups</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>See Also</th>
|
||||
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
|
||||
Programming: <a href='api-cups.html' target='_top'>CUPS API</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
@@ -1,29 +0,0 @@
|
||||
<!--
|
||||
File and directory API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h2 class='title'><a name="OVERVIEW">Overview</a></h2>
|
||||
|
||||
<p>The CUPS file and directory APIs provide portable interfaces
|
||||
for manipulating files and listing files and directories. Unlike
|
||||
stdio <code>FILE</code> streams, the <code>cupsFile</code> functions
|
||||
allow you to open more than 256 files at any given time. They
|
||||
also manage the platform-specific details of locking, large file
|
||||
support, line endings (CR, LF, or CR LF), and reading and writing
|
||||
files using Flate ("gzip") compression. Finally, you can also
|
||||
connect, read from, and write to network connections using the
|
||||
<code>cupsFile</code> functions.</p>
|
||||
|
||||
<p>The <code>cupsDir</code> functions manage the platform-specific
|
||||
details of directory access/listing and provide a convenient way
|
||||
to get both a list of files and the information (permissions,
|
||||
size, timestamp, etc.) for each of those files.</p>
|
||||
@@ -1,37 +0,0 @@
|
||||
<!--
|
||||
HTTP and IPP API header for CUPS.
|
||||
|
||||
Copyright 2007-2016 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>HTTP and IPP APIs</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Headers</th>
|
||||
<th>cups/cups.h<br>
|
||||
cups/http.h<br>
|
||||
cups/ipp.h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Library</th>
|
||||
<td>-lcups</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>See Also</th>
|
||||
<td>Programming: <a href='api-overview.html'>Introduction to CUPS Programming</a><br>
|
||||
Programming: <a href='api-cups.html'>CUPS API</a><br>
|
||||
References: <a href='spec-ipp.html'>CUPS Implementation of IPP</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
@@ -1,315 +0,0 @@
|
||||
<!--
|
||||
HTTP and IPP API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2012 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
|
||||
|
||||
<p>The CUPS HTTP and IPP APIs provide low-level access to the HTTP and IPP
|
||||
protocols and CUPS scheduler. They are typically used by monitoring and
|
||||
administration programs to perform specific functions not supported by the
|
||||
high-level CUPS API functions.</p>
|
||||
|
||||
<p>The HTTP APIs use an opaque structure called
|
||||
<a href='#http_t'><code>http_t</code></a> to manage connections to
|
||||
a particular HTTP or IPP server. The
|
||||
<a href='#httpConnectEncrypt'><code>httpConnectEncrypt</code></a> function is
|
||||
used to create an instance of this structure for a particular server.
|
||||
The constant <code>CUPS_HTTP_DEFAULT</code> can be used with all of the
|
||||
<code>cups</code> functions to refer to the default CUPS server - the functions
|
||||
create a per-thread <a href='#http_t'><code>http_t</code></a> as needed.</p>
|
||||
|
||||
<p>The IPP APIs use two opaque structures for requests (messages sent to the CUPS scheduler) and responses (messages sent back to your application from the scheduler). The <a href='#ipp_t'><code>ipp_t</code></a> type holds a complete request or response and is allocated using the <a href='#ippNew'><code>ippNew</code></a> or <a href='#ippNewRequest'><code>ippNewRequest</code></a> functions and freed using the <a href='#ippDelete'><code>ippDelete</code></a> function.</p>
|
||||
|
||||
<p>The second opaque structure is called <a href='#ipp_attribute_t'><code>ipp_attribute_t</code></a> and holds a single IPP attribute which consists of a group tag (<a href='#ippGetGroupTag'><code>ippGetGroupTag</code></a>), a value type tag (<a href='#ippGetValueTag'><code>ippGetValueTag</code></a>), the attribute name (<a href='#ippGetName'><code>ippGetName</code></a>), and 1 or more values (<a href='#ippGetCount'><code>ippGetCount</code></a>, <a href='#ippGetBoolean'><code>ippGetBoolean</code></a>, <a href='#ippGetCollection'><code>ippGetCollection</code></a>, <a href='#ippGetDate'><code>ippGetDate</code></a>, <a href='#ippGetInteger'><code>ippGetInteger</code></a>, <a href='#ippGetRange'><code>ippGetRange</code></a>, <a href='#ippGetResolution'><code>ippGetResolution</code></a>, and <a href='#ippGetString'><code>ippGetString</code></a>). Attributes are added to an <a href='#ipp_t'><code>ipp_t</code></a> pointer using one of the <code>ippAdd</code> functions. For example, use <a href='#ippAddString'><code>ippAddString</code></a> to add the "printer-uri" and "requesting-user-name" string attributes to a request:</p>
|
||||
|
||||
<pre class='example'>
|
||||
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(IPP_GET_JOBS);
|
||||
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, "ipp://localhost/printers/");
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, cupsUser());
|
||||
</pre>
|
||||
|
||||
<p>Once you have created an IPP request, use the <code>cups</code> functions to send the request to and read the response from the server. For example, the <a href='#cupsDoRequest'><code>cupsDoRequest</code></a> function can be used for simple query operations that do not involve files:</p>
|
||||
|
||||
<pre class='example'>
|
||||
#include <cups/cups.h>
|
||||
|
||||
|
||||
<a href='#ipp_t'>ipp_t</a> *<a name='get_jobs'>get_jobs</a>(void)
|
||||
{
|
||||
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(IPP_GET_JOBS);
|
||||
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, "ipp://localhost/printers/");
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, cupsUser());
|
||||
|
||||
return (<a href='#cupsDoRequest'>cupsDoRequest</a>(CUPS_HTTP_DEFAULT, request, "/"));
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>The <a href='#cupsDoRequest'><code>cupsDoRequest</code></a> function frees the request and returns an IPP response or <code>NULL</code> pointer if the request could not be sent to the server. Once you have a response from the server, you can either use the <a href='#ippFindAttribute'><code>ippFindAttribute</code></a> and <a href='#ippFindNextAttribute'><code>ippFindNextAttribute</code></a> functions to find specific attributes, for example:</p>
|
||||
|
||||
<pre class='example'>
|
||||
<a href='#ipp_t'>ipp_t</a> *response;
|
||||
<a href='#ipp_attribute_t'>ipp_attribute_t</a> *attr;
|
||||
|
||||
attr = <a href='#ippFindAttribute'>ippFindAttribute</a>(response, "printer-state", IPP_TAG_ENUM);
|
||||
</pre>
|
||||
|
||||
<p>You can also walk the list of attributes with a simple <code>for</code> loop like this:</p>
|
||||
|
||||
<pre class='example'>
|
||||
<a href='#ipp_t'>ipp_t</a> *response;
|
||||
<a href='#ipp_attribute_t'>ipp_attribute_t</a> *attr;
|
||||
|
||||
for (attr = <a href='#ippFirstAttribute'>ippFirstAttribute</a>(response); attr != NULL; attr = <a href='#ippNextAttribute'>ippNextAttribute</a>(response))
|
||||
if (ippGetName(attr) == NULL)
|
||||
puts("--SEPARATOR--");
|
||||
else
|
||||
puts(ippGetName(attr));
|
||||
</pre>
|
||||
|
||||
<p>The <code>for</code> loop approach is normally used when collecting attributes for multiple objects (jobs, printers, etc.) in a response. Attributes with <code>NULL</code> names indicate a separator between the attributes of each object. For example, the following code will list the jobs returned from our previous <a href='#get_jobs'><code>get_jobs</code></a> example code:</p>
|
||||
|
||||
<pre class='example'>
|
||||
<a href='#ipp_t'>ipp_t</a> *response = <a href='#get_jobs'>get_jobs</a>();
|
||||
|
||||
if (response != NULL)
|
||||
{
|
||||
<a href='#ipp_attribute_t'>ipp_attribute_t</a> *attr;
|
||||
const char *attrname;
|
||||
int job_id = 0;
|
||||
const char *job_name = NULL;
|
||||
const char *job_originating_user_name = NULL;
|
||||
|
||||
puts("Job ID Owner Title");
|
||||
puts("------ ---------------- ---------------------------------");
|
||||
|
||||
for (attr = <a href='#ippFirstAttribute'>ippFirstAttribute</a>(response); attr != NULL; attr = <a href='#ippNextAttribute'>ippNextAttribute</a>(response))
|
||||
{
|
||||
/* Attributes without names are separators between jobs */
|
||||
attrname = ippGetName(attr);
|
||||
if (attrname == NULL)
|
||||
{
|
||||
if (job_id > 0)
|
||||
{
|
||||
if (job_name == NULL)
|
||||
job_name = "(withheld)";
|
||||
|
||||
if (job_originating_user_name == NULL)
|
||||
job_originating_user_name = "(withheld)";
|
||||
|
||||
printf("%5d %-16s %s\n", job_id, job_originating_user_name, job_name);
|
||||
}
|
||||
|
||||
job_id = 0;
|
||||
job_name = NULL;
|
||||
job_originating_user_name = NULL;
|
||||
continue;
|
||||
}
|
||||
else if (!strcmp(attrname, "job-id") && ippGetValueTag(attr) == IPP_TAG_INTEGER)
|
||||
job_id = ippGetInteger(attr, 0);
|
||||
else if (!strcmp(attrname, "job-name") && ippGetValueTag(attr) == IPP_TAG_NAME)
|
||||
job_name = ippGetString(attr, 0, NULL);
|
||||
else if (!strcmp(attrname, "job-originating-user-name") &&
|
||||
ippGetValueTag(attr) == IPP_TAG_NAME)
|
||||
job_originating_user_name = ippGetString(attr, 0, NULL);
|
||||
}
|
||||
|
||||
if (job_id > 0)
|
||||
{
|
||||
if (job_name == NULL)
|
||||
job_name = "(withheld)";
|
||||
|
||||
if (job_originating_user_name == NULL)
|
||||
job_originating_user_name = "(withheld)";
|
||||
|
||||
printf("%5d %-16s %s\n", job_id, job_originating_user_name, job_name);
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h3><a name='CREATING_URI_STRINGS'>Creating URI Strings</a></h3>
|
||||
|
||||
<p>To ensure proper encoding, the
|
||||
<a href='#httpAssembleURIf'><code>httpAssembleURIf</code></a> function must be
|
||||
used to format a "printer-uri" string for all printer-based requests:</p>
|
||||
|
||||
<pre class='example'>
|
||||
const char *name = "Foo";
|
||||
char uri[1024];
|
||||
<a href='#ipp_t'>ipp_t</a> *request;
|
||||
|
||||
<a href='#httpAssembleURIf'>httpAssembleURIf</a>(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, cupsServer(),
|
||||
ippPort(), "/printers/%s", name);
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
|
||||
</pre>
|
||||
|
||||
<h3><a name='SENDING_REQUESTS_WITH_FILES'>Sending Requests with Files</a></h3>
|
||||
|
||||
<p>The <a href='#cupsDoFileRequest'><code>cupsDoFileRequest</code></a> and
|
||||
<a href='#cupsDoIORequest'><code>cupsDoIORequest</code></a> functions are
|
||||
used for requests involving files. The
|
||||
<a href='#cupsDoFileRequest'><code>cupsDoFileRequest</code></a> function
|
||||
attaches the named file to a request and is typically used when sending a print
|
||||
file or changing a printer's PPD file:</p>
|
||||
|
||||
<pre class='example'>
|
||||
const char *filename = "/usr/share/cups/data/testprint.ps";
|
||||
const char *name = "Foo";
|
||||
char uri[1024];
|
||||
char resource[1024];
|
||||
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(IPP_PRINT_JOB);
|
||||
<a href='#ipp_t'>ipp_t</a> *response;
|
||||
|
||||
/* Use httpAssembleURIf for the printer-uri string */
|
||||
<a href='#httpAssembleURIf'>httpAssembleURIf</a>(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, cupsServer(),
|
||||
ippPort(), "/printers/%s", name);
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, cupsUser());
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
|
||||
NULL, "testprint.ps");
|
||||
|
||||
/* Use snprintf for the resource path */
|
||||
snprintf(resource, sizeof(resource), "/printers/%s", name);
|
||||
|
||||
response = <a href='#cupsDoFileRequest'>cupsDoFileRequest</a>(CUPS_HTTP_DEFAULT, request, resource, filename);
|
||||
</pre>
|
||||
|
||||
<p>The <a href='#cupsDoIORequest'><code>cupsDoIORequest</code></a> function
|
||||
optionally attaches a file to the request and optionally saves a file in the
|
||||
response from the server. It is used when using a pipe for the request
|
||||
attachment or when using a request that returns a file, currently only
|
||||
<code>CUPS_GET_DOCUMENT</code> and <code>CUPS_GET_PPD</code>. For example,
|
||||
the following code will download the PPD file for the sample HP LaserJet
|
||||
printer driver:</p>
|
||||
|
||||
<pre class='example'>
|
||||
char tempfile[1024];
|
||||
int tempfd;
|
||||
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(CUPS_GET_PPD);
|
||||
<a href='#ipp_t'>ipp_t</a> *response;
|
||||
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
|
||||
NULL, "laserjet.ppd");
|
||||
|
||||
tempfd = cupsTempFd(tempfile, sizeof(tempfile));
|
||||
|
||||
response = <a href='#cupsDoIORequest'>cupsDoIORequest</a>(CUPS_HTTP_DEFAULT, request, "/", -1, tempfd);
|
||||
</pre>
|
||||
|
||||
<p>The example passes <code>-1</code> for the input file descriptor to specify
|
||||
that no file is to be attached to the request. The PPD file attached to the
|
||||
response is written to the temporary file descriptor we created using the
|
||||
<code>cupsTempFd</code> function.</p>
|
||||
|
||||
<h3><a name='ASYNCHRONOUS_REQUEST_PROCESSING'>Asynchronous Request Processing</a></h3>
|
||||
|
||||
<p>The <a href='#cupsSendRequest'><code>cupsSendRequest</code></a> and
|
||||
<a href='#cupsGetResponse'><code>cupsGetResponse</code></a> support
|
||||
asynchronous communications with the server. Unlike the other request
|
||||
functions, the IPP request is not automatically freed, so remember to
|
||||
free your request with the <a href='#ippDelete'><code>ippDelete</code></a>
|
||||
function.</p>
|
||||
|
||||
<p>File data is attached to the request using the
|
||||
<a href='#cupsWriteRequestData'><code>cupsWriteRequestData</code></a>
|
||||
function, while file data returned from the server is read using the
|
||||
<a href='#cupsReadResponseData'><code>cupsReadResponseData</code></a>
|
||||
function. We can rewrite the previous <code>CUPS_GET_PPD</code> example
|
||||
to use the asynchronous functions quite easily:</p>
|
||||
|
||||
<pre class='example'>
|
||||
char tempfile[1024];
|
||||
int tempfd;
|
||||
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(CUPS_GET_PPD);
|
||||
<a href='#ipp_t'>ipp_t</a> *response;
|
||||
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
|
||||
NULL, "laserjet.ppd");
|
||||
|
||||
tempfd = cupsTempFd(tempfile, sizeof(tempfile));
|
||||
|
||||
if (<a href='#cupsSendRequest'>cupsSendRequest</a>(CUPS_HTTP_DEFAULT, request, "/") == HTTP_CONTINUE)
|
||||
{
|
||||
response = <a href='#cupsGetResponse'>cupsGetResponse</a>(CUPS_HTTP_DEFAULT, "/");
|
||||
|
||||
if (response != NULL)
|
||||
{
|
||||
ssize_t bytes;
|
||||
char buffer[8192];
|
||||
|
||||
while ((bytes = <a href='#cupsReadResponseData'>cupsReadResponseData</a>(CUPS_HTTP_DEFAULT, buffer, sizeof(buffer))) > 0)
|
||||
write(tempfd, buffer, bytes);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the request! */
|
||||
<a href='#ippDelete'>ippDelete</a>(request);
|
||||
</pre>
|
||||
|
||||
<p>The <a href='#cupsSendRequest'><code>cupsSendRequest</code></a> function
|
||||
returns the initial HTTP request status, typically either
|
||||
<code>HTTP_CONTINUE</code> or <code>HTTP_UNAUTHORIZED</code>. The latter status
|
||||
is returned when the request requires authentication of some sort. The
|
||||
<a href='#cupsDoAuthentication'><code>cupsDoAuthentication</code></a> function
|
||||
must be called when your see <code>HTTP_UNAUTHORIZED</code> and the request
|
||||
re-sent. We can add authentication support to our example code by using a
|
||||
<code>do ... while</code> loop:</p>
|
||||
|
||||
<pre class='example'>
|
||||
char tempfile[1024];
|
||||
int tempfd;
|
||||
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(CUPS_GET_PPD);
|
||||
<a href='#ipp_t'>ipp_t</a> *response;
|
||||
http_status_t status;
|
||||
|
||||
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
|
||||
NULL, "laserjet.ppd");
|
||||
|
||||
tempfd = cupsTempFd(tempfile, sizeof(tempfile));
|
||||
|
||||
/* Loop for authentication */
|
||||
do
|
||||
{
|
||||
status = <a href='#cupsSendRequest'>cupsSendRequest</a>(CUPS_HTTP_DEFAULT, request, "/");
|
||||
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
{
|
||||
/* Try to authenticate, break out of the loop if that fails */
|
||||
if (<a href='#cupsDoAuthentication'>cupsDoAuthentication</a>(CUPS_HTTP_DEFAULT, "POST", "/"))
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (status != HTTP_CONTINUE && status != HTTP_UNAUTHORIZED);
|
||||
|
||||
if (status == HTTP_CONTINUE)
|
||||
{
|
||||
response = <a href='#cupsGetResponse'>cupsGetResponse</a>(CUPS_HTTP_DEFAULT, "/");
|
||||
|
||||
if (response != NULL)
|
||||
{
|
||||
ssize_t bytes;
|
||||
char buffer[8192];
|
||||
|
||||
while ((bytes = <a href='#cupsReadResponseData'>cupsReadResponseData</a>(CUPS_HTTP_DEFAULT, buffer, sizeof(buffer))) > 0)
|
||||
write(tempfd, buffer, bytes);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the request! */
|
||||
<a href='#ippDelete'>ippDelete</a>(request);
|
||||
</pre>
|
||||
+489
-136
@@ -47,6 +47,10 @@ extern const char *cssmErrorString(int error);
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static const char *cups_auth_find(const char *www_authenticate, const char *scheme);
|
||||
static const char *cups_auth_param(const char *scheme, const char *name, char *value, size_t valsize);
|
||||
static const char *cups_auth_scheme(const char *www_authenticate, char *scheme, size_t schemesize);
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
# ifdef HAVE_GSS_ACQUIRE_CRED_EX_F
|
||||
# ifdef HAVE_GSS_GSSAPI_SPI_H
|
||||
@@ -112,8 +116,10 @@ cupsDoAuthentication(
|
||||
const char *resource) /* I - Resource path */
|
||||
{
|
||||
const char *password, /* Password string */
|
||||
*www_auth; /* WWW-Authenticate header */
|
||||
char prompt[1024], /* Prompt for user */
|
||||
*www_auth, /* WWW-Authenticate header */
|
||||
*schemedata; /* Scheme-specific data */
|
||||
char scheme[256], /* Scheme name */
|
||||
prompt[1024], /* Prompt for user */
|
||||
realm[HTTP_MAX_VALUE], /* realm="xyz" string */
|
||||
nonce[HTTP_MAX_VALUE]; /* nonce="xyz" string */
|
||||
int localauth; /* Local authentication result */
|
||||
@@ -163,122 +169,237 @@ cupsDoAuthentication(
|
||||
}
|
||||
|
||||
/*
|
||||
* Nope, see if we should retry the current username:password...
|
||||
* Nope, loop through the authentication schemes to find the first we support.
|
||||
*/
|
||||
|
||||
www_auth = http->fields[HTTP_FIELD_WWW_AUTHENTICATE];
|
||||
www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
|
||||
|
||||
if ((http->digest_tries > 1 || !http->userpass[0]) &&
|
||||
(!_cups_strncasecmp(www_auth, "Basic", 5) ||
|
||||
!_cups_strncasecmp(www_auth, "Digest", 6)))
|
||||
for (schemedata = cups_auth_scheme(www_auth, scheme, sizeof(scheme)); schemedata; schemedata = cups_auth_scheme(schemedata + strlen(scheme), scheme, sizeof(scheme)))
|
||||
{
|
||||
/*
|
||||
* Nope - get a new password from the user...
|
||||
* Check the scheme name...
|
||||
*/
|
||||
|
||||
char default_username[HTTP_MAX_VALUE];
|
||||
/* Default username */
|
||||
|
||||
cg = _cupsGlobals();
|
||||
|
||||
if (!cg->lang_default)
|
||||
cg->lang_default = cupsLangDefault();
|
||||
|
||||
if (httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "username",
|
||||
default_username))
|
||||
cupsSetUser(default_username);
|
||||
|
||||
snprintf(prompt, sizeof(prompt),
|
||||
_cupsLangString(cg->lang_default, _("Password for %s on %s? ")),
|
||||
cupsUser(),
|
||||
http->hostname[0] == '/' ? "localhost" : http->hostname);
|
||||
|
||||
http->digest_tries = _cups_strncasecmp(www_auth, "Digest", 6) != 0;
|
||||
http->userpass[0] = '\0';
|
||||
|
||||
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
|
||||
{
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(),
|
||||
password);
|
||||
}
|
||||
else if (http->status == HTTP_STATUS_UNAUTHORIZED)
|
||||
http->digest_tries ++;
|
||||
|
||||
if (http->status == HTTP_STATUS_UNAUTHORIZED && http->digest_tries >= 3)
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: Too many authentication tries (%d)",
|
||||
http->digest_tries));
|
||||
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Got a password; encode it for the server...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
if (!_cups_strncasecmp(www_auth, "Negotiate", 9))
|
||||
{
|
||||
if (!_cups_strcasecmp(scheme, "Negotiate"))
|
||||
{
|
||||
/*
|
||||
* Kerberos authentication...
|
||||
*/
|
||||
|
||||
if (_cupsSetNegotiateAuthString(http, method, resource))
|
||||
{
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_GSSAPI */
|
||||
if (_cups_strcasecmp(scheme, "Basic") && _cups_strcasecmp(scheme, "Digest"))
|
||||
continue; /* Not supported (yet) */
|
||||
|
||||
/*
|
||||
* Kerberos authentication...
|
||||
* See if we should retry the current username:password...
|
||||
*/
|
||||
|
||||
if (_cupsSetNegotiateAuthString(http, method, resource))
|
||||
if ((http->digest_tries > 1 || !http->userpass[0]) && (!_cups_strcasecmp(scheme, "Basic") || (!_cups_strcasecmp(scheme, "Digest"))))
|
||||
{
|
||||
/*
|
||||
* Nope - get a new password from the user...
|
||||
*/
|
||||
|
||||
char default_username[HTTP_MAX_VALUE];
|
||||
/* Default username */
|
||||
|
||||
cg = _cupsGlobals();
|
||||
|
||||
if (!cg->lang_default)
|
||||
cg->lang_default = cupsLangDefault();
|
||||
|
||||
if (cups_auth_param(scheme, "username", default_username, sizeof(default_username)))
|
||||
cupsSetUser(default_username);
|
||||
|
||||
snprintf(prompt, sizeof(prompt), _cupsLangString(cg->lang_default, _("Password for %s on %s? ")), cupsUser(), http->hostname[0] == '/' ? "localhost" : http->hostname);
|
||||
|
||||
http->digest_tries = _cups_strncasecmp(scheme, "Digest", 6) != 0;
|
||||
http->userpass[0] = '\0';
|
||||
|
||||
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
|
||||
{
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(), password);
|
||||
}
|
||||
else if (http->status == HTTP_STATUS_UNAUTHORIZED)
|
||||
http->digest_tries ++;
|
||||
|
||||
if (http->status == HTTP_STATUS_UNAUTHORIZED && http->digest_tries >= 3)
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: Too many authentication tries (%d)", http->digest_tries));
|
||||
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_GSSAPI */
|
||||
if (!_cups_strncasecmp(www_auth, "Basic", 5))
|
||||
{
|
||||
|
||||
/*
|
||||
* Basic authentication...
|
||||
* Got a password; encode it for the server...
|
||||
*/
|
||||
|
||||
char encode[256]; /* Base64 buffer */
|
||||
if (!_cups_strcasecmp(scheme, "Basic"))
|
||||
{
|
||||
/*
|
||||
* Basic authentication...
|
||||
*/
|
||||
|
||||
char encode[256]; /* Base64 buffer */
|
||||
|
||||
httpEncode64_2(encode, sizeof(encode), http->userpass,
|
||||
(int)strlen(http->userpass));
|
||||
httpSetAuthString(http, "Basic", encode);
|
||||
httpEncode64_2(encode, sizeof(encode), http->userpass, (int)strlen(http->userpass));
|
||||
httpSetAuthString(http, "Basic", encode);
|
||||
}
|
||||
else if (!_cups_strcasecmp(scheme, "Digest"))
|
||||
{
|
||||
/*
|
||||
* Digest authentication...
|
||||
*/
|
||||
|
||||
int i; /* Looping var */
|
||||
char algorithm[65], /* Hashing algorithm */
|
||||
opaque[HTTP_MAX_VALUE],
|
||||
/* Opaque data from server */
|
||||
cnonce[65], /* cnonce value */
|
||||
kd[65], /* Final MD5/SHA-256 digest */
|
||||
ha1[65], /* Hash of username:realm:password */
|
||||
ha2[65], /* Hash of method:request-uri */
|
||||
hdata[65], /* Hash of auth data */
|
||||
temp[1024], /* Temporary string */
|
||||
digest[1024]; /* Digest auth data */
|
||||
unsigned char hash[32]; /* Hash buffer */
|
||||
const char *hashalg; /* Hashing algorithm */
|
||||
size_t hashsize; /* Size of hash */
|
||||
|
||||
if (strcmp(nonce, http->nonce))
|
||||
{
|
||||
strlcpy(http->nonce, nonce, sizeof(http->nonce));
|
||||
http->nonce_count = 1;
|
||||
}
|
||||
else
|
||||
http->nonce_count ++;
|
||||
|
||||
cups_auth_param(schemedata, "opaque", opaque, sizeof(opaque));
|
||||
cups_auth_param(schemedata, "nonce", nonce, sizeof(nonce));
|
||||
cups_auth_param(schemedata, "realm", realm, sizeof(realm));
|
||||
|
||||
for (i = 0; i < 64; i ++)
|
||||
cnonce[i] = "0123456789ABCDEF"[CUPS_RAND() & 15];
|
||||
cnonce[64] = '\0';
|
||||
|
||||
if (cups_auth_param(schemedata, "algorithm", algorithm, sizeof(algorithm)))
|
||||
{
|
||||
/*
|
||||
* Follow RFC 2617/7616...
|
||||
*/
|
||||
|
||||
if (!_cups_strcasecmp(algorithm, "MD5"))
|
||||
{
|
||||
/*
|
||||
* RFC 2617 Digest with MD5
|
||||
*/
|
||||
|
||||
hashalg = "md5";
|
||||
}
|
||||
else if (!_cups_strcasecmp(algorithm, "SHA-256"))
|
||||
{
|
||||
/*
|
||||
* RFC 7616 Digest with SHA-256
|
||||
*/
|
||||
|
||||
hashalg = "sha2-256";
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Some other algorithm we don't support, skip this one...
|
||||
*/
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate digest value...
|
||||
*/
|
||||
|
||||
/* H(A1) = H(username:realm:password) */
|
||||
snprintf(temp, sizeof(temp), "%s:%s:%s", cupsUser(), realm, strchr(http->userpass, ':') + 1);
|
||||
hashsize = (size_t)cupsHashData(hashalg, (unsigned char *)temp, strlen(temp), hash, sizeof(hash));
|
||||
cupsHashString(hash, hashsize, ha1, sizeof(ha1));
|
||||
|
||||
/* H(A2) = H(method:uri) */
|
||||
snprintf(temp, sizeof(temp), "%s:%s", method, resource);
|
||||
hashsize = (size_t)cupsHashData(hashalg, (unsigned char *)temp, strlen(temp), hash, sizeof(hash));
|
||||
cupsHashString(hash, hashsize, ha2, sizeof(ha2));
|
||||
|
||||
/* H(data) = H(nonce:nc:cnonce:qop:H(A2)) */
|
||||
snprintf(temp, sizeof(temp), "%s:%08x:%s:auth:%s", nonce, http->nonce_count, cnonce, ha2);
|
||||
hashsize = (size_t)cupsHashData(hashalg, (unsigned char *)temp, strlen(temp), hash, sizeof(hash));
|
||||
cupsHashString(hash, hashsize, hdata, sizeof(hdata));
|
||||
|
||||
/* KD = H(H(A1):H(data)) */
|
||||
snprintf(temp, sizeof(temp), "%s:%s", ha1, hdata);
|
||||
hashsize = (size_t)cupsHashData(hashalg, (unsigned char *)temp, strlen(temp), hash, sizeof(hash));
|
||||
cupsHashString(hash, hashsize, kd, sizeof(kd));
|
||||
|
||||
/* Pass the RFC 2617/7616 WWW-Authenticate header */
|
||||
if (opaque[0])
|
||||
snprintf(digest, sizeof(digest), "username=\"%s\", realm=\"%s\", nonce=\"%s\", algorithm=%s, qop=auth, opaque=\"%s\", cnonce=\"%s\", nc=%08x, uri=\"%s\", response=\"%s\"", cupsUser(), realm, nonce, algorithm, opaque, cnonce, http->nonce_count, resource, kd);
|
||||
else
|
||||
snprintf(digest, sizeof(digest), "username=\"%s\", realm=\"%s\", nonce=\"%s\", algorithm=%s, qop=auth, cnonce=\"%s\", nc=%08x, uri=\"%s\", response=\"%s\"", cupsUser(), realm, nonce, algorithm, cnonce, http->nonce_count, resource, kd);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Use old RFC 2069 Digest method...
|
||||
*/
|
||||
|
||||
/* H(A1) = H(username:realm:password) */
|
||||
snprintf(temp, sizeof(temp), "%s:%s:%s", cupsUser(), realm, strchr(http->userpass, ':') + 1);
|
||||
hashsize = (size_t)cupsHashData("md5", (unsigned char *)temp, strlen(temp), hash, sizeof(hash));
|
||||
cupsHashString(hash, hashsize, ha1, sizeof(ha1));
|
||||
|
||||
/* H(A2) = H(method:uri) */
|
||||
snprintf(temp, sizeof(temp), "%s:%s", method, resource);
|
||||
hashsize = (size_t)cupsHashData("md5", (unsigned char *)temp, strlen(temp), hash, sizeof(hash));
|
||||
cupsHashString(hash, hashsize, ha2, sizeof(ha2));
|
||||
|
||||
/* KD = H(H(A1):nonce:H(A2)) */
|
||||
snprintf(temp, sizeof(temp), "%s:%s:%s", ha1, nonce, ha2);
|
||||
hashsize = (size_t)cupsHashData("md5", (unsigned char *)temp, strlen(temp), hash, sizeof(hash));
|
||||
cupsHashString(hash, hashsize, kd, sizeof(kd));
|
||||
|
||||
/* Pass the RFC 2069 WWW-Authenticate header */
|
||||
snprintf(digest, sizeof(digest), "username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\"", cupsUser(), realm, nonce, resource, kd);
|
||||
}
|
||||
|
||||
httpSetAuthString(http, "Digest", digest);
|
||||
}
|
||||
}
|
||||
else if (!_cups_strncasecmp(www_auth, "Digest", 6))
|
||||
|
||||
if (http->authstring)
|
||||
{
|
||||
/*
|
||||
* Digest authentication...
|
||||
*/
|
||||
DEBUG_printf(("1cupsDoAuthentication: authstring=\"%s\"", http->authstring));
|
||||
|
||||
char encode[33], /* MD5 buffer */
|
||||
digest[1024]; /* Digest auth data */
|
||||
|
||||
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "realm", realm);
|
||||
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "nonce", nonce);
|
||||
|
||||
httpMD5(cupsUser(), realm, strchr(http->userpass, ':') + 1, encode);
|
||||
httpMD5Final(nonce, method, resource, encode);
|
||||
snprintf(digest, sizeof(digest),
|
||||
"username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", "
|
||||
"response=\"%s\"", cupsUser(), realm, nonce, resource, encode);
|
||||
httpSetAuthString(http, "Digest", digest);
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: Unknown auth type: \"%s\"",
|
||||
www_auth));
|
||||
DEBUG_printf(("1cupsDoAuthentication: Unknown auth type: \"%s\"", www_auth));
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
DEBUG_printf(("1cupsDoAuthentication: authstring=\"%s\"", http->authstring));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -336,7 +457,7 @@ _cupsSetNegotiateAuthString(
|
||||
GSS_C_NO_BUFFER, &http->gssmech,
|
||||
&output_token, NULL, NULL);
|
||||
|
||||
#ifdef HAVE_GSS_ACQUIRE_CRED_EX_F
|
||||
# ifdef HAVE_GSS_ACQUIRE_CRED_EX_F
|
||||
if (major_status == GSS_S_NO_CRED)
|
||||
{
|
||||
/*
|
||||
@@ -412,7 +533,7 @@ _cupsSetNegotiateAuthString(
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_GSS_ACQUIRED_CRED_EX_F */
|
||||
# endif /* HAVE_GSS_ACQUIRED_CRED_EX_F */
|
||||
|
||||
if (GSS_ERROR(major_status))
|
||||
{
|
||||
@@ -422,11 +543,11 @@ _cupsSetNegotiateAuthString(
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
# ifdef DEBUG
|
||||
else if (major_status == GSS_S_CONTINUE_NEEDED)
|
||||
cups_gss_printf(major_status, minor_status,
|
||||
"_cupsSetNegotiateAuthString: Continuation needed!");
|
||||
#endif /* DEBUG */
|
||||
# endif /* DEBUG */
|
||||
|
||||
if (output_token.length > 0 && output_token.length <= 65536)
|
||||
{
|
||||
@@ -464,8 +585,259 @@ _cupsSetNegotiateAuthString(
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_auth_find()' - Find the named WWW-Authenticate scheme.
|
||||
*
|
||||
* The "www_authenticate" parameter points to the current position in the header.
|
||||
*
|
||||
* Returns @code NULL@ if the auth scheme is not present.
|
||||
*/
|
||||
|
||||
static const char * /* O - Start of matching scheme or @code NULL@ if not found */
|
||||
cups_auth_find(const char *www_authenticate, /* I - Pointer into WWW-Authenticate header */
|
||||
const char *scheme) /* I - Authentication scheme */
|
||||
{
|
||||
size_t schemelen = strlen(scheme); /* Length of scheme */
|
||||
|
||||
|
||||
DEBUG_printf(("8cups_auth_find(www_authenticate=\"%s\", scheme=\"%s\"(%d))", www_authenticate, scheme, (int)schemelen));
|
||||
|
||||
while (*www_authenticate)
|
||||
{
|
||||
/*
|
||||
* Skip leading whitespace and commas...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("9cups_auth_find: Before whitespace: \"%s\"", www_authenticate));
|
||||
while (isspace(*www_authenticate & 255) || *www_authenticate == ',')
|
||||
www_authenticate ++;
|
||||
DEBUG_printf(("9cups_auth_find: After whitespace: \"%s\"", www_authenticate));
|
||||
|
||||
/*
|
||||
* See if this is "Scheme" followed by whitespace or the end of the string.
|
||||
*/
|
||||
|
||||
if (!strncmp(www_authenticate, scheme, schemelen) && (isspace(www_authenticate[schemelen] & 255) || !www_authenticate[schemelen]))
|
||||
{
|
||||
/*
|
||||
* Yes, this is the start of the scheme-specific information...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("9cups_auth_find: Returning \"%s\".", www_authenticate));
|
||||
|
||||
return (www_authenticate);
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip the scheme name or param="value" string...
|
||||
*/
|
||||
|
||||
while (!isspace(*www_authenticate & 255) && *www_authenticate)
|
||||
{
|
||||
if (*www_authenticate == '\"')
|
||||
{
|
||||
/*
|
||||
* Skip quoted value...
|
||||
*/
|
||||
|
||||
www_authenticate ++;
|
||||
while (*www_authenticate && *www_authenticate != '\"')
|
||||
www_authenticate ++;
|
||||
|
||||
DEBUG_printf(("9cups_auth_find: After quoted: \"%s\"", www_authenticate));
|
||||
}
|
||||
|
||||
www_authenticate ++;
|
||||
}
|
||||
|
||||
DEBUG_printf(("9cups_auth_find: After skip: \"%s\"", www_authenticate));
|
||||
}
|
||||
|
||||
DEBUG_puts("9cups_auth_find: Returning NULL.");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_auth_param()' - Copy the value for the named authentication parameter,
|
||||
* if present.
|
||||
*/
|
||||
|
||||
static const char * /* O - Parameter value or @code NULL@ if not present */
|
||||
cups_auth_param(const char *scheme, /* I - Pointer to auth data */
|
||||
const char *name, /* I - Name of parameter */
|
||||
char *value, /* I - Value buffer */
|
||||
size_t valsize) /* I - Size of value buffer */
|
||||
{
|
||||
char *valptr = value, /* Pointer into value buffer */
|
||||
*valend = value + valsize - 1; /* Pointer to end of buffer */
|
||||
size_t namelen = strlen(name); /* Name length */
|
||||
int param; /* Is this a parameter? */
|
||||
|
||||
|
||||
DEBUG_printf(("8cups_auth_param(scheme=\"%s\", name=\"%s\", value=%p, valsize=%d)", scheme, name, (void *)value, (int)valsize));
|
||||
|
||||
while (!isspace(*scheme & 255) && *scheme)
|
||||
scheme ++;
|
||||
|
||||
while (*scheme)
|
||||
{
|
||||
while (isspace(*scheme & 255) || *scheme == ',')
|
||||
scheme ++;
|
||||
|
||||
if (!strncmp(scheme, name, namelen) && scheme[namelen] == '=')
|
||||
{
|
||||
/*
|
||||
* Found the parameter, copy the value...
|
||||
*/
|
||||
|
||||
scheme += namelen + 1;
|
||||
if (*scheme == '\"')
|
||||
{
|
||||
scheme ++;
|
||||
|
||||
while (*scheme && *scheme != '\"')
|
||||
{
|
||||
if (valptr < valend)
|
||||
*valptr++ = *scheme;
|
||||
|
||||
scheme ++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*scheme && strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~+/=", *scheme))
|
||||
{
|
||||
if (valptr < valend)
|
||||
*valptr++ = *scheme;
|
||||
|
||||
scheme ++;
|
||||
}
|
||||
}
|
||||
|
||||
*valptr = '\0';
|
||||
|
||||
DEBUG_printf(("9cups_auth_param: Returning \"%s\".", value));
|
||||
|
||||
return (value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip the param=value string...
|
||||
*/
|
||||
|
||||
param = 0;
|
||||
|
||||
while (!isspace(*scheme & 255) && *scheme)
|
||||
{
|
||||
if (*scheme == '=')
|
||||
param = 1;
|
||||
else if (*scheme == '\"')
|
||||
{
|
||||
/*
|
||||
* Skip quoted value...
|
||||
*/
|
||||
|
||||
scheme ++;
|
||||
while (*scheme && *scheme != '\"')
|
||||
scheme ++;
|
||||
}
|
||||
|
||||
scheme ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* If this wasn't a parameter, we are at the end of this scheme's
|
||||
* parameters...
|
||||
*/
|
||||
|
||||
if (!param)
|
||||
break;
|
||||
}
|
||||
|
||||
*value = '\0';
|
||||
|
||||
DEBUG_puts("9cups_auth_param: Returning NULL.");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_auth_scheme()' - Get the (next) WWW-Authenticate scheme.
|
||||
*
|
||||
* The "www_authenticate" parameter points to the current position in the header.
|
||||
*
|
||||
* Returns @code NULL@ if there are no (more) auth schemes present.
|
||||
*/
|
||||
|
||||
static const char * /* O - Start of scheme or @code NULL@ if not found */
|
||||
cups_auth_scheme(const char *www_authenticate, /* I - Pointer into WWW-Authenticate header */
|
||||
char *scheme, /* I - Scheme name buffer */
|
||||
size_t schemesize) /* I - Size of buffer */
|
||||
{
|
||||
const char *start; /* Start of scheme data */
|
||||
char *sptr = scheme, /* Pointer into scheme buffer */
|
||||
*send = scheme + schemesize - 1;/* End of scheme buffer */
|
||||
int param; /* Is this a parameter? */
|
||||
|
||||
|
||||
DEBUG_printf(("8cups_auth_scheme(www_authenticate=\"%s\", scheme=%p, schemesize=%d)", www_authenticate, (void *)scheme, (int)schemesize));
|
||||
|
||||
while (*www_authenticate)
|
||||
{
|
||||
/*
|
||||
* Skip leading whitespace and commas...
|
||||
*/
|
||||
|
||||
while (isspace(*www_authenticate & 255) || *www_authenticate == ',')
|
||||
www_authenticate ++;
|
||||
|
||||
/*
|
||||
* Parse the scheme name or param="value" string...
|
||||
*/
|
||||
|
||||
for (sptr = scheme, start = www_authenticate, param = 0; *www_authenticate && !isspace(*www_authenticate & 255); www_authenticate ++)
|
||||
{
|
||||
if (*www_authenticate == '=')
|
||||
param = 1;
|
||||
else if (!param && sptr < send)
|
||||
*sptr++ = *www_authenticate;
|
||||
else if (*www_authenticate == '\"')
|
||||
{
|
||||
/*
|
||||
* Skip quoted value...
|
||||
*/
|
||||
|
||||
www_authenticate ++;
|
||||
while (*www_authenticate && *www_authenticate != '\"')
|
||||
www_authenticate ++;
|
||||
}
|
||||
}
|
||||
|
||||
if (sptr > scheme && !param)
|
||||
{
|
||||
*sptr = '\0';
|
||||
|
||||
DEBUG_printf(("9cups_auth_scheme: Returning \"%s\".", start));
|
||||
|
||||
return (start);
|
||||
}
|
||||
}
|
||||
|
||||
*scheme = '\0';
|
||||
|
||||
DEBUG_puts("9cups_auth_scheme: Returning NULL.");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
# ifdef HAVE_GSS_ACQUIRE_CRED_EX_F
|
||||
/*
|
||||
* 'cups_gss_acquire()' - Kerberos credentials callback.
|
||||
@@ -650,6 +1022,8 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
FILE *fp; /* Certificate file */
|
||||
char trc[16], /* Try Root Certificate parameter */
|
||||
filename[1024]; /* Certificate filename */
|
||||
const char *www_auth, /* WWW-Authenticate header */
|
||||
*schemedata; /* Data for the named auth scheme */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
# if defined(HAVE_AUTHORIZATION_H)
|
||||
OSStatus status; /* Status */
|
||||
@@ -668,13 +1042,14 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
* See if we are accessing localhost...
|
||||
*/
|
||||
|
||||
if (!httpAddrLocalhost(http->hostaddr) &&
|
||||
_cups_strcasecmp(http->hostname, "localhost") != 0)
|
||||
if (!httpAddrLocalhost(http->hostaddr) && _cups_strcasecmp(http->hostname, "localhost") != 0)
|
||||
{
|
||||
DEBUG_puts("8cups_local_auth: Not a local connection!");
|
||||
return (1);
|
||||
}
|
||||
|
||||
www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
|
||||
|
||||
# if defined(HAVE_AUTHORIZATION_H)
|
||||
/*
|
||||
* Delete any previous authorization reference...
|
||||
@@ -686,12 +1061,9 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
http->auth_ref = NULL;
|
||||
}
|
||||
|
||||
if (!getenv("GATEWAY_INTERFACE") &&
|
||||
httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "authkey",
|
||||
auth_key, sizeof(auth_key)))
|
||||
if (!getenv("GATEWAY_INTERFACE") && (schemedata = cups_auth_find(www_auth, "AuthRef")) != NULL && cups_auth_param(schemedata, "key", auth_key, sizeof(auth_key)))
|
||||
{
|
||||
status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
|
||||
kAuthorizationFlagDefaults, &http->auth_ref);
|
||||
status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &http->auth_ref);
|
||||
if (status != errAuthorizationSuccess)
|
||||
{
|
||||
DEBUG_printf(("8cups_local_auth: AuthorizationCreate() returned %d (%s)",
|
||||
@@ -745,6 +1117,15 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
}
|
||||
# endif /* HAVE_AUTHORIZATION_H */
|
||||
|
||||
# ifdef HAVE_GSSAPI
|
||||
if (cups_auth_find(www_auth, "Negotiate"))
|
||||
return (1);
|
||||
# endif /* HAVE_GSSAPI */
|
||||
# ifdef HAVE_AUTHORIZATION_H
|
||||
if (cups_auth_find(www_auth, "AuthRef"))
|
||||
return (1);
|
||||
# endif /* HAVE_AUTHORIZATION_H */
|
||||
|
||||
# if defined(SO_PEERCRED) && defined(AF_LOCAL)
|
||||
/*
|
||||
* See if we can authenticate using the peer credentials provided over a
|
||||
@@ -752,16 +1133,9 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
* information...
|
||||
*/
|
||||
|
||||
if (
|
||||
# ifdef HAVE_GSSAPI
|
||||
_cups_strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9) &&
|
||||
# endif /* HAVE_GSSAPI */
|
||||
# ifdef HAVE_AUTHORIZATION_H
|
||||
!httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "authkey",
|
||||
auth_key, sizeof(auth_key)) &&
|
||||
# endif /* HAVE_AUTHORIZATION_H */
|
||||
http->hostaddr->addr.sa_family == AF_LOCAL &&
|
||||
!getenv("GATEWAY_INTERFACE")) /* Not via CGI programs... */
|
||||
if (http->hostaddr->addr.sa_family == AF_LOCAL &&
|
||||
!getenv("GATEWAY_INTERFACE") && /* Not via CGI programs... */
|
||||
cups_auth_find(www_auth, "PeerCred"))
|
||||
{
|
||||
/*
|
||||
* Verify that the current cupsUser() matches the current UID...
|
||||
@@ -784,6 +1158,9 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
}
|
||||
# endif /* SO_PEERCRED && AF_LOCAL */
|
||||
|
||||
if ((schemedata = cups_auth_find(www_auth, "Local")) == NULL)
|
||||
return (1);
|
||||
|
||||
/*
|
||||
* Try opening a certificate file for this PID. If that fails,
|
||||
* try the root certificate...
|
||||
@@ -797,33 +1174,9 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
* No certificate for this PID; see if we can get the root certificate...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("9cups_local_auth: Unable to open file %s: %s",
|
||||
filename, strerror(errno)));
|
||||
DEBUG_printf(("9cups_local_auth: Unable to open file %s: %s", filename, strerror(errno)));
|
||||
|
||||
# ifdef HAVE_GSSAPI
|
||||
if (!_cups_strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
|
||||
{
|
||||
/*
|
||||
* Kerberos required, don't try the root certificate...
|
||||
*/
|
||||
|
||||
return (1);
|
||||
}
|
||||
# endif /* HAVE_GSSAPI */
|
||||
|
||||
# ifdef HAVE_AUTHORIZATION_H
|
||||
if (httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "authkey",
|
||||
auth_key, sizeof(auth_key)))
|
||||
{
|
||||
/*
|
||||
* Don't use the root certificate as a replacement for an authkey...
|
||||
*/
|
||||
|
||||
return (1);
|
||||
}
|
||||
# endif /* HAVE_AUTHORIZATION_H */
|
||||
if (!httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "trc", trc,
|
||||
sizeof(trc)))
|
||||
if (!cups_auth_param(schemedata, "trc", trc, sizeof(trc)))
|
||||
{
|
||||
/*
|
||||
* Scheduler doesn't want us to use the root certificate...
|
||||
|
||||
+6
-3
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* API definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 2007-2018 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -47,10 +47,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 2.0204
|
||||
# define CUPS_VERSION 2.0207
|
||||
# define CUPS_VERSION_MAJOR 2
|
||||
# define CUPS_VERSION_MINOR 2
|
||||
# define CUPS_VERSION_PATCH 4
|
||||
# define CUPS_VERSION_PATCH 7
|
||||
|
||||
# define CUPS_BC_FD 3
|
||||
/* Back-channel file descriptor for
|
||||
@@ -606,6 +606,9 @@ extern ssize_t cupsHashData(const char *algorithm, const void *data, size_t dat
|
||||
extern int cupsAddIntegerOption(const char *name, int value, int num_options, cups_option_t **options) _CUPS_API_2_2_4;
|
||||
extern int cupsGetIntegerOption(const char *name, int num_options, cups_option_t *options) _CUPS_API_2_2_4;
|
||||
|
||||
/* New in CUPS 2.2.7 */
|
||||
extern const char *cupsHashString(const unsigned char *hash, size_t hashsize, char *buffer, size_t bufsize) _CUPS_API_2_2_7;
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
title: CUPS Programming Manual
|
||||
author: Michael R Sweet
|
||||
copyright: Copyright © 2007-2017 by Apple Inc. All Rights Reserved.
|
||||
version: 2.2.4
|
||||
version: 2.2.5
|
||||
...
|
||||
|
||||
> Please [file issues on Github](https://github.com/apple/cups/issues) to
|
||||
@@ -925,7 +925,7 @@ their values:
|
||||
IPP_TAG_ENUM)) != NULL)
|
||||
{
|
||||
printf("printer-state=%s\n",
|
||||
ippTagString("printer-state", ippGetInteger(attr, 0)));
|
||||
ippEnumString("printer-state", ippGetInteger(attr, 0)));
|
||||
}
|
||||
else
|
||||
puts("printer-state=unknown");
|
||||
@@ -952,7 +952,7 @@ The `ippGetCount` function returns the number of values in an attribute.
|
||||
The `ippGetInteger` and `ippGetString` functions return a single integer or
|
||||
string value from an attribute.
|
||||
|
||||
The `ippTagString` function converts a enum value to its keyword (string)
|
||||
The `ippEnumString` function converts a enum value to its keyword (string)
|
||||
equivalent.
|
||||
|
||||
Once you are done using the IPP response message, free it using the `ippDelete`
|
||||
|
||||
@@ -60,12 +60,15 @@ cupsLocalizeDestMedia(
|
||||
*ltype; /* Localized media type */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsLocalizeDestMedia(http=%p, dest=%p, dinfo=%p, flags=%x, size=%p(\"%s\"))", (void *)http, (void *)dest, (void *)dinfo, flags, (void *)size, size ? size->media : "(null)"));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!http || !dest || !dinfo || !size)
|
||||
{
|
||||
DEBUG_puts("1cupsLocalizeDestMedia: Returning NULL.");
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
return (NULL);
|
||||
}
|
||||
@@ -79,13 +82,24 @@ cupsLocalizeDestMedia(
|
||||
|
||||
key.id = size->media;
|
||||
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations, &key)) != NULL)
|
||||
{
|
||||
DEBUG_printf(("1cupsLocalizeDestMedia: Returning \"%s\".", match->str));
|
||||
return (match->str);
|
||||
}
|
||||
|
||||
/*
|
||||
* If not, get the localized size, source, and type strings...
|
||||
*/
|
||||
|
||||
lang = cupsLangDefault();
|
||||
|
||||
snprintf(temp, sizeof(temp), "media.%s", size->media);
|
||||
if ((lsize = _cupsLangString(lang, temp)) != NULL && strcmp(lsize, temp))
|
||||
{
|
||||
DEBUG_printf(("1cupsLocalizeDestMedia: Returning standard localization \"%s\".", lsize));
|
||||
return (lsize);
|
||||
}
|
||||
|
||||
pwg = pwgMediaForSize(size->width, size->length);
|
||||
|
||||
if (pwg->ppd)
|
||||
@@ -101,7 +115,7 @@ cupsLocalizeDestMedia(
|
||||
* Use inches since the size is a multiple of 1/4 inch.
|
||||
*/
|
||||
|
||||
snprintf(temp, sizeof(temp), _cupsLangString(lang, _("%g x %g")), size->width / 2540.0, size->length / 2540.0);
|
||||
snprintf(temp, sizeof(temp), _cupsLangString(lang, _("%g x %g \"")), size->width / 2540.0, size->length / 2540.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -189,6 +203,8 @@ cupsLocalizeDestMedia(
|
||||
|
||||
cupsArrayAdd(dinfo->localizations, match);
|
||||
|
||||
DEBUG_printf(("1cupsLocalizeDestMedia: Returning \"%s\".", match->str));
|
||||
|
||||
return (match->str);
|
||||
}
|
||||
|
||||
@@ -212,21 +228,23 @@ cupsLocalizeDestOption(
|
||||
{
|
||||
_cups_message_t key, /* Search key */
|
||||
*match; /* Matching entry */
|
||||
const char *localized; /* Localized string */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsLocalizeDestOption(http=%p, dest=%p, dinfo=%p, option=\"%s\")", (void *)http, (void *)dest, (void *)dinfo, option));
|
||||
|
||||
if (!http || !dest || !dinfo)
|
||||
return (option);
|
||||
|
||||
if (!dinfo->localizations)
|
||||
cups_create_localizations(http, dinfo);
|
||||
|
||||
if (cupsArrayCount(dinfo->localizations) == 0)
|
||||
return (option);
|
||||
|
||||
key.id = (char *)option;
|
||||
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
|
||||
&key)) != NULL)
|
||||
return (match->str);
|
||||
else if ((localized = _cupsLangString(cupsLangDefault(), option)) != NULL)
|
||||
return (localized);
|
||||
else
|
||||
return (option);
|
||||
}
|
||||
@@ -253,22 +271,40 @@ cupsLocalizeDestValue(
|
||||
_cups_message_t key, /* Search key */
|
||||
*match; /* Matching entry */
|
||||
char pair[256]; /* option.value pair */
|
||||
const char *localized; /* Localized string */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsLocalizeDestValue(http=%p, dest=%p, dinfo=%p, option=\"%s\", value=\"%s\")", (void *)http, (void *)dest, (void *)dinfo, option, value));
|
||||
|
||||
if (!http || !dest || !dinfo)
|
||||
return (value);
|
||||
|
||||
if (!strcmp(option, "media"))
|
||||
{
|
||||
pwg_media_t *media = pwgMediaForPWG(value);
|
||||
cups_size_t size;
|
||||
|
||||
strlcpy(size.media, value, sizeof(size.media));
|
||||
size.width = media ? media->width : 0;
|
||||
size.length = media ? media->length : 0;
|
||||
size.left = 0;
|
||||
size.right = 0;
|
||||
size.bottom = 0;
|
||||
size.top = 0;
|
||||
|
||||
return (cupsLocalizeDestMedia(http, dest, dinfo, CUPS_MEDIA_FLAGS_DEFAULT, &size));
|
||||
}
|
||||
|
||||
if (!dinfo->localizations)
|
||||
cups_create_localizations(http, dinfo);
|
||||
|
||||
if (cupsArrayCount(dinfo->localizations) == 0)
|
||||
return (value);
|
||||
|
||||
snprintf(pair, sizeof(pair), "%s.%s", option, value);
|
||||
key.id = pair;
|
||||
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
|
||||
&key)) != NULL)
|
||||
return (match->str);
|
||||
else if ((localized = _cupsLangString(cupsLangDefault(), pair)) != NULL && strcmp(localized, pair))
|
||||
return (localized);
|
||||
else
|
||||
return (value);
|
||||
}
|
||||
|
||||
+496
-419
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -2477,6 +2477,8 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
* file header...
|
||||
*/
|
||||
|
||||
inflateEnd(&fp->stream);
|
||||
|
||||
fp->compressed = 0;
|
||||
}
|
||||
else if (status < Z_OK)
|
||||
|
||||
+86
-5
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Hashing function for CUPS.
|
||||
*
|
||||
* Copyright 2015-2016 by Apple Inc.
|
||||
* Copyright © 2015-2018 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -21,6 +21,8 @@
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
#elif defined(HAVE_GNUTLS)
|
||||
# include <gnutls/crypto.h>
|
||||
#else
|
||||
# include "md5-private.h"
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
@@ -53,7 +55,24 @@ cupsHashData(const char *algorithm, /* I - Algorithm name */
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (!strcmp(algorithm, "sha"))
|
||||
if (!strcmp(algorithm, "md5"))
|
||||
{
|
||||
/*
|
||||
* MD5 (deprecated but widely used...)
|
||||
*/
|
||||
|
||||
CC_MD5_CTX ctx; /* MD5 context */
|
||||
|
||||
if (hashsize < CC_MD5_DIGEST_LENGTH)
|
||||
goto too_small;
|
||||
|
||||
CC_MD5_Init(&ctx);
|
||||
CC_MD5_Update(&ctx, data, (CC_LONG)datalen);
|
||||
CC_MD5_Final(hash, &ctx);
|
||||
|
||||
return (CC_MD5_DIGEST_LENGTH);
|
||||
}
|
||||
else if (!strcmp(algorithm, "sha"))
|
||||
{
|
||||
/*
|
||||
* SHA-1...
|
||||
@@ -171,7 +190,9 @@ cupsHashData(const char *algorithm, /* I - Algorithm name */
|
||||
unsigned char temp[64]; /* Temporary hash buffer */
|
||||
size_t tempsize = 0; /* Truncate to this size? */
|
||||
|
||||
if (!strcmp(algorithm, "sha"))
|
||||
if (!strcmp(algorithm, "md5"))
|
||||
alg = GNUTLS_DIG_MD5;
|
||||
else if (!strcmp(algorithm, "sha"))
|
||||
alg = GNUTLS_DIG_SHA1;
|
||||
else if (!strcmp(algorithm, "sha2-224"))
|
||||
alg = GNUTLS_DIG_SHA224;
|
||||
@@ -219,10 +240,20 @@ cupsHashData(const char *algorithm, /* I - Algorithm name */
|
||||
|
||||
#else
|
||||
/*
|
||||
* No hash support without CommonCrypto or GNU TLS...
|
||||
* No hash support beyond MD5 without CommonCrypto or GNU TLS...
|
||||
*/
|
||||
|
||||
if (hashsize < 64)
|
||||
if (!strcmp(algorithm, "md5"))
|
||||
{
|
||||
_cups_md5_state_t state; /* MD5 state info */
|
||||
|
||||
_cupsMD5Init(&state);
|
||||
_cupsMD5Append(&state, data, datalen);
|
||||
_cupsMD5Finish(&state, hash);
|
||||
|
||||
return (16);
|
||||
}
|
||||
else if (hashsize < 64)
|
||||
goto too_small;
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
@@ -243,3 +274,53 @@ cupsHashData(const char *algorithm, /* I - Algorithm name */
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Hash buffer too small."), 1);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsHashString()' - Format a hash value as a hexadecimal string.
|
||||
*
|
||||
* The passed buffer must be at least 2 * hashsize + 1 characters in length.
|
||||
*
|
||||
* @since CUPS 2.2.7@
|
||||
*/
|
||||
|
||||
const char * /* O - Formatted string */
|
||||
cupsHashString(
|
||||
const unsigned char *hash, /* I - Hash */
|
||||
size_t hashsize, /* I - Size of hash */
|
||||
char *buffer, /* I - String buffer */
|
||||
size_t bufsize) /* I - Size of string buffer */
|
||||
{
|
||||
char *bufptr = buffer; /* Pointer into buffer */
|
||||
static const char *hex = "0123456789abcdef";
|
||||
/* Hex characters (lowercase!) */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!hash || hashsize < 1 || !buffer || bufsize < (2 * hashsize + 1))
|
||||
{
|
||||
if (buffer)
|
||||
*buffer = '\0';
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop until we've converted the whole hash...
|
||||
*/
|
||||
|
||||
while (hashsize > 0)
|
||||
{
|
||||
*bufptr++ = hex[*hash >> 4];
|
||||
*bufptr++ = hex[*hash & 15];
|
||||
|
||||
hash ++;
|
||||
hashsize --;
|
||||
}
|
||||
|
||||
*bufptr = '\0';
|
||||
|
||||
return (buffer);
|
||||
}
|
||||
|
||||
+16
-1
@@ -65,7 +65,7 @@ httpAddrConnect2(
|
||||
int flags; /* Socket flags */
|
||||
#endif /* !WIN32 */
|
||||
int remaining; /* Remaining timeout */
|
||||
int i, /* Looping var */
|
||||
int i, j, /* Looping vars */
|
||||
nfds, /* Number of file descriptors */
|
||||
fds[100], /* Socket file descriptors */
|
||||
result; /* Result from select() or poll() */
|
||||
@@ -323,6 +323,8 @@ httpAddrConnect2(
|
||||
if (!getpeername(fds[i], (struct sockaddr *)&peer, &len))
|
||||
DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...", httpAddrString(&peer, temp, sizeof(temp)), httpAddrPort(&peer)));
|
||||
# endif /* DEBUG */
|
||||
|
||||
break;
|
||||
}
|
||||
# ifdef HAVE_POLL
|
||||
else if (pfds[i].revents & (POLLERR | POLLHUP))
|
||||
@@ -346,7 +348,20 @@ httpAddrConnect2(
|
||||
}
|
||||
|
||||
if (connaddr)
|
||||
{
|
||||
/*
|
||||
* Connected on one address, close all of the other sockets we have so
|
||||
* far and return...
|
||||
*/
|
||||
|
||||
for (j = 0; j < i; j ++)
|
||||
httpAddrClose(NULL, fds[j]);
|
||||
|
||||
for (j ++; j < nfds; j ++)
|
||||
httpAddrClose(NULL, fds[j]);
|
||||
|
||||
return (connaddr);
|
||||
}
|
||||
}
|
||||
#endif /* O_NONBLOCK */
|
||||
|
||||
|
||||
+20
-16
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Private HTTP definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 2007-2018 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -68,7 +68,6 @@ typedef int socklen_t;
|
||||
# endif /* __APPLE__ && !_SOCKLEN_T */
|
||||
|
||||
# include <cups/http.h>
|
||||
# include "md5-private.h"
|
||||
# include "ipp-private.h"
|
||||
|
||||
# ifdef HAVE_GNUTLS
|
||||
@@ -172,19 +171,24 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define _HTTP_MAX_SBUFFER 65536 /* Size of (de)compression buffer */
|
||||
# define _HTTP_RESOLVE_DEFAULT 0 /* Just resolve with default options */
|
||||
# define _HTTP_RESOLVE_STDERR 1 /* Log resolve progress to stderr */
|
||||
# define _HTTP_RESOLVE_FQDN 2 /* Resolve to a FQDN */
|
||||
# define _HTTP_RESOLVE_FAXOUT 4 /* Resolve FaxOut service? */
|
||||
|
||||
#define _HTTP_MAX_SBUFFER 65536 /* Size of (de)compression buffer */
|
||||
#define _HTTP_RESOLVE_DEFAULT 0 /* Just resolve with default options */
|
||||
#define _HTTP_RESOLVE_STDERR 1 /* Log resolve progress to stderr */
|
||||
#define _HTTP_RESOLVE_FQDN 2 /* Resolve to a FQDN */
|
||||
#define _HTTP_RESOLVE_FAXOUT 4 /* Resolve FaxOut service? */
|
||||
# define _HTTP_TLS_NONE 0 /* No TLS options */
|
||||
# define _HTTP_TLS_ALLOW_RC4 1 /* Allow RC4 cipher suites */
|
||||
# define _HTTP_TLS_ALLOW_DH 2 /* Allow DH/DHE key negotiation */
|
||||
# define _HTTP_TLS_DENY_CBC 4 /* Deny CBC cipher suites */
|
||||
# define _HTTP_TLS_SET_DEFAULT 128 /* Setting the default TLS options */
|
||||
|
||||
#define _HTTP_TLS_NONE 0 /* No TLS options */
|
||||
#define _HTTP_TLS_ALLOW_RC4 1 /* Allow RC4 cipher suites */
|
||||
#define _HTTP_TLS_ALLOW_SSL3 2 /* Allow SSL 3.0 */
|
||||
#define _HTTP_TLS_ALLOW_DH 4 /* Allow DH/DHE key negotiation */
|
||||
#define _HTTP_TLS_DENY_TLS10 16 /* Deny TLS 1.0 */
|
||||
#define _HTTP_TLS_DENY_CBC 32 /* Deny CBC cipher suites */
|
||||
# define _HTTP_TLS_SSL3 0 /* Min/max version is SSL/3.0 */
|
||||
# define _HTTP_TLS_1_0 1 /* Min/max version is TLS/1.0 */
|
||||
# define _HTTP_TLS_1_1 2 /* Min/max version is TLS/1.1 */
|
||||
# define _HTTP_TLS_1_2 3 /* Min/max version is TLS/1.2 */
|
||||
# define _HTTP_TLS_1_3 4 /* Min/max version is TLS/1.3 */
|
||||
# define _HTTP_TLS_MAX 5 /* Highest known TLS version */
|
||||
|
||||
|
||||
/*
|
||||
@@ -296,10 +300,10 @@ struct _http_s /**** HTTP connection structure ****/
|
||||
char buffer[HTTP_MAX_BUFFER];
|
||||
/* Buffer for incoming data */
|
||||
int _auth_type; /* Authentication in use (deprecated) */
|
||||
_cups_md5_state_t md5_state; /* MD5 state */
|
||||
unsigned char _md5_state[88]; /* MD5 state (deprecated) */
|
||||
char nonce[HTTP_MAX_VALUE];
|
||||
/* Nonce value */
|
||||
int nonce_count; /* Nonce count */
|
||||
unsigned nonce_count; /* Nonce count */
|
||||
http_tls_t tls; /* TLS state information */
|
||||
http_encryption_t encryption; /* Encryption requirements */
|
||||
|
||||
@@ -441,7 +445,7 @@ extern void _httpTLSInitialize(void);
|
||||
extern size_t _httpTLSPending(http_t *http);
|
||||
extern int _httpTLSRead(http_t *http, char *buf, int len);
|
||||
extern int _httpTLSSetCredentials(http_t *http);
|
||||
extern void _httpTLSSetOptions(int options);
|
||||
extern void _httpTLSSetOptions(int options, int min_version, int max_version);
|
||||
extern int _httpTLSStart(http_t *http);
|
||||
extern void _httpTLSStop(http_t *http);
|
||||
extern int _httpTLSWrite(http_t *http, const char *buf, int len);
|
||||
|
||||
@@ -502,7 +502,6 @@ httpAssembleUUID(const char *server, /* I - Server name */
|
||||
size_t bufsize) /* I - Size of buffer */
|
||||
{
|
||||
char data[1024]; /* Source string for MD5 */
|
||||
_cups_md5_state_t md5state; /* MD5 state */
|
||||
unsigned char md5sum[16]; /* MD5 digest/sum */
|
||||
|
||||
|
||||
@@ -517,9 +516,7 @@ httpAssembleUUID(const char *server, /* I - Server name */
|
||||
port, name ? name : server, number,
|
||||
(unsigned)CUPS_RAND() & 0xffff, (unsigned)CUPS_RAND() & 0xffff);
|
||||
|
||||
_cupsMD5Init(&md5state);
|
||||
_cupsMD5Append(&md5state, (unsigned char *)data, (int)strlen(data));
|
||||
_cupsMD5Finish(&md5state, md5sum);
|
||||
cupsHashData("md5", (unsigned char *)data, strlen(data), md5sum, sizeof(md5sum));
|
||||
|
||||
/*
|
||||
* Generate the UUID from the MD5...
|
||||
@@ -1360,6 +1357,9 @@ _httpStatus(cups_lang_t *lang, /* I - Language */
|
||||
case HTTP_STATUS_MOVED_PERMANENTLY :
|
||||
s = _("Moved Permanently");
|
||||
break;
|
||||
case HTTP_STATUS_FOUND :
|
||||
s = _("Found");
|
||||
break;
|
||||
case HTTP_STATUS_SEE_OTHER :
|
||||
s = _("See Other");
|
||||
break;
|
||||
|
||||
+119
-104
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* HTTP routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 2007-2018 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* This file contains Kerberos support code, copyright 2006 by
|
||||
@@ -39,6 +39,7 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void http_add_field(http_t *http, http_field_t field, const char *value, int append);
|
||||
#ifdef HAVE_LIBZ
|
||||
static void http_content_coding_finish(http_t *http);
|
||||
static void http_content_coding_start(http_t *http,
|
||||
@@ -2659,105 +2660,7 @@ httpSetField(http_t *http, /* I - HTTP connection */
|
||||
value == NULL)
|
||||
return;
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case HTTP_FIELD_ACCEPT_ENCODING :
|
||||
if (http->accept_encoding)
|
||||
_cupsStrFree(http->accept_encoding);
|
||||
|
||||
http->accept_encoding = _cupsStrAlloc(value);
|
||||
break;
|
||||
|
||||
case HTTP_FIELD_ALLOW :
|
||||
if (http->allow)
|
||||
_cupsStrFree(http->allow);
|
||||
|
||||
http->allow = _cupsStrAlloc(value);
|
||||
break;
|
||||
|
||||
case HTTP_FIELD_SERVER :
|
||||
if (http->server)
|
||||
_cupsStrFree(http->server);
|
||||
|
||||
http->server = _cupsStrAlloc(value);
|
||||
break;
|
||||
|
||||
case HTTP_FIELD_WWW_AUTHENTICATE :
|
||||
/* CUPS STR #4503 - don't override WWW-Authenticate for unknown auth schemes */
|
||||
if (http->fields[HTTP_FIELD_WWW_AUTHENTICATE][0] &&
|
||||
_cups_strncasecmp(value, "Basic ", 6) &&
|
||||
_cups_strncasecmp(value, "Digest ", 7) &&
|
||||
_cups_strncasecmp(value, "Negotiate ", 10))
|
||||
{
|
||||
DEBUG_printf(("1httpSetField: Ignoring unknown auth scheme in \"%s\".", value));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fall through to copy */
|
||||
|
||||
default :
|
||||
strlcpy(http->fields[field], value, HTTP_MAX_VALUE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (field == HTTP_FIELD_AUTHORIZATION)
|
||||
{
|
||||
/*
|
||||
* Special case for Authorization: as its contents can be
|
||||
* longer than HTTP_MAX_VALUE
|
||||
*/
|
||||
|
||||
if (http->field_authorization)
|
||||
free(http->field_authorization);
|
||||
|
||||
http->field_authorization = strdup(value);
|
||||
}
|
||||
else if (field == HTTP_FIELD_HOST)
|
||||
{
|
||||
/*
|
||||
* Special-case for Host: as we don't want a trailing "." on the hostname and
|
||||
* need to bracket IPv6 numeric addresses.
|
||||
*/
|
||||
|
||||
char *ptr = strchr(value, ':');
|
||||
|
||||
if (value[0] != '[' && ptr && strchr(ptr + 1, ':'))
|
||||
{
|
||||
/*
|
||||
* Bracket IPv6 numeric addresses...
|
||||
*
|
||||
* This is slightly inefficient (basically copying twice), but is an edge
|
||||
* case and not worth optimizing...
|
||||
*/
|
||||
|
||||
snprintf(http->fields[HTTP_FIELD_HOST],
|
||||
sizeof(http->fields[HTTP_FIELD_HOST]), "[%s]", value);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Check for a trailing dot on the hostname...
|
||||
*/
|
||||
|
||||
ptr = http->fields[HTTP_FIELD_HOST];
|
||||
|
||||
if (*ptr)
|
||||
{
|
||||
ptr += strlen(ptr) - 1;
|
||||
|
||||
if (*ptr == '.')
|
||||
*ptr = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_LIBZ
|
||||
else if (field == HTTP_FIELD_CONTENT_ENCODING &&
|
||||
http->data_encoding != HTTP_ENCODING_FIELDS)
|
||||
{
|
||||
DEBUG_puts("1httpSetField: Calling http_content_coding_start.");
|
||||
http_content_coding_start(http, value);
|
||||
}
|
||||
#endif /* HAVE_LIBZ */
|
||||
http_add_field(http, field, value, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -3035,7 +2938,7 @@ _httpUpdate(http_t *http, /* I - HTTP connection */
|
||||
httpSetCookie(http, value);
|
||||
}
|
||||
else if ((field = httpFieldValue(line)) != HTTP_FIELD_UNKNOWN)
|
||||
httpSetField(http, field, value);
|
||||
http_add_field(http, field, value, 1);
|
||||
#ifdef DEBUG
|
||||
else
|
||||
DEBUG_printf(("1_httpUpdate: unknown field %s seen!", line));
|
||||
@@ -3689,6 +3592,118 @@ httpWriteResponse(http_t *http, /* I - HTTP connection */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'http_add_field()' - Add a value for a HTTP field, appending if needed.
|
||||
*/
|
||||
|
||||
static void
|
||||
http_add_field(http_t *http, /* I - HTTP connection */
|
||||
http_field_t field, /* I - HTTP field */
|
||||
const char *value, /* I - Value string */
|
||||
int append) /* I - Append value? */
|
||||
{
|
||||
char newvalue[1024]; /* New value string */
|
||||
const char *oldvalue; /* Old field value */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Optionally append the new value to the existing one...
|
||||
*/
|
||||
|
||||
if (append && field != HTTP_FIELD_ACCEPT_ENCODING && field != HTTP_FIELD_ACCEPT_LANGUAGE && field != HTTP_FIELD_ACCEPT_RANGES && field != HTTP_FIELD_ALLOW && field != HTTP_FIELD_LINK && field != HTTP_FIELD_TRANSFER_ENCODING && field != HTTP_FIELD_UPGRADE && field != HTTP_FIELD_WWW_AUTHENTICATE)
|
||||
append = 0;
|
||||
|
||||
if (field == HTTP_FIELD_HOST)
|
||||
{
|
||||
/*
|
||||
* Special-case for Host: as we don't want a trailing "." on the hostname and
|
||||
* need to bracket IPv6 numeric addresses.
|
||||
*/
|
||||
|
||||
char *ptr = strchr(value, ':');
|
||||
|
||||
if (value[0] != '[' && ptr && strchr(ptr + 1, ':'))
|
||||
{
|
||||
/*
|
||||
* Bracket IPv6 numeric addresses...
|
||||
*/
|
||||
|
||||
snprintf(newvalue, sizeof(newvalue), "[%s]", value);
|
||||
value = newvalue;
|
||||
}
|
||||
else if (*value && value[strlen(value) - 1] == '.')
|
||||
{
|
||||
/*
|
||||
* Strip the trailing dot on the hostname...
|
||||
*/
|
||||
|
||||
strlcpy(newvalue, value, sizeof(newvalue));
|
||||
newvalue[strlen(newvalue) - 1] = '\0';
|
||||
value = newvalue;
|
||||
}
|
||||
}
|
||||
else if (append && *value && (oldvalue = httpGetField(http, field)) != NULL && *oldvalue)
|
||||
{
|
||||
snprintf(newvalue, sizeof(newvalue), "%s, %s", oldvalue, value);
|
||||
value = newvalue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the new value...
|
||||
*/
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case HTTP_FIELD_ACCEPT_ENCODING :
|
||||
if (http->accept_encoding)
|
||||
_cupsStrFree(http->accept_encoding);
|
||||
|
||||
http->accept_encoding = _cupsStrAlloc(value);
|
||||
break;
|
||||
|
||||
case HTTP_FIELD_ALLOW :
|
||||
if (http->allow)
|
||||
_cupsStrFree(http->allow);
|
||||
|
||||
http->allow = _cupsStrAlloc(value);
|
||||
break;
|
||||
|
||||
case HTTP_FIELD_SERVER :
|
||||
if (http->server)
|
||||
_cupsStrFree(http->server);
|
||||
|
||||
http->server = _cupsStrAlloc(value);
|
||||
break;
|
||||
|
||||
default :
|
||||
strlcpy(http->fields[field], value, HTTP_MAX_VALUE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (field == HTTP_FIELD_AUTHORIZATION)
|
||||
{
|
||||
/*
|
||||
* Special case for Authorization: as its contents can be
|
||||
* longer than HTTP_MAX_VALUE
|
||||
*/
|
||||
|
||||
if (http->field_authorization)
|
||||
free(http->field_authorization);
|
||||
|
||||
http->field_authorization = strdup(value);
|
||||
}
|
||||
#ifdef HAVE_LIBZ
|
||||
else if (field == HTTP_FIELD_CONTENT_ENCODING &&
|
||||
http->data_encoding != HTTP_ENCODING_FIELDS)
|
||||
{
|
||||
DEBUG_puts("1http_add_field: Calling http_content_coding_start.");
|
||||
http_content_coding_start(http, value);
|
||||
}
|
||||
#endif /* HAVE_LIBZ */
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
/*
|
||||
* 'http_content_coding_finish()' - Finish doing any content encoding.
|
||||
@@ -4056,7 +4071,7 @@ http_read(http_t *http, /* I - HTTP connection */
|
||||
|
||||
DEBUG_printf(("http_read(http=%p, buffer=%p, length=" CUPS_LLFMT ")", (void *)http, (void *)buffer, CUPS_LLCAST length));
|
||||
|
||||
if (!http->blocking)
|
||||
if (!http->blocking || http->timeout_value > 0.0)
|
||||
{
|
||||
while (!httpWait(http, http->wait_value))
|
||||
{
|
||||
@@ -4651,7 +4666,7 @@ http_write(http_t *http, /* I - HTTP connection */
|
||||
{
|
||||
DEBUG_printf(("3http_write: About to write %d bytes.", (int)length));
|
||||
|
||||
if (http->timeout_cb)
|
||||
if (http->timeout_value > 0.0)
|
||||
{
|
||||
#ifdef HAVE_POLL
|
||||
struct pollfd pfd; /* Polled file descriptor */
|
||||
@@ -4695,7 +4710,7 @@ http_write(http_t *http, /* I - HTTP connection */
|
||||
http->error = errno;
|
||||
return (-1);
|
||||
}
|
||||
else if (nfds == 0 && !(*http->timeout_cb)(http, http->timeout_data))
|
||||
else if (nfds == 0 && (!http->timeout_cb || !(*http->timeout_cb)(http, http->timeout_data)))
|
||||
{
|
||||
#ifdef WIN32
|
||||
http->error = WSAEWOULDBLOCK;
|
||||
|
||||
+5
-2
@@ -248,10 +248,11 @@ typedef enum http_status_e /**** HTTP status codes ****/
|
||||
|
||||
HTTP_STATUS_MULTIPLE_CHOICES = 300, /* Multiple files match request */
|
||||
HTTP_STATUS_MOVED_PERMANENTLY, /* Document has moved permanently */
|
||||
HTTP_STATUS_MOVED_TEMPORARILY, /* Document has moved temporarily */
|
||||
HTTP_STATUS_SEE_OTHER, /* See this other link... */
|
||||
HTTP_STATUS_FOUND, /* Document was found at a different URI */
|
||||
HTTP_STATUS_SEE_OTHER, /* See this other link */
|
||||
HTTP_STATUS_NOT_MODIFIED, /* File not modified */
|
||||
HTTP_STATUS_USE_PROXY, /* Must use a proxy to access this URI */
|
||||
HTTP_STATUS_TEMPORARY_REDIRECT = 307, /* Temporary redirection */
|
||||
|
||||
HTTP_STATUS_BAD_REQUEST = 400, /* Bad request */
|
||||
HTTP_STATUS_UNAUTHORIZED, /* Unauthorized to access host */
|
||||
@@ -285,6 +286,8 @@ typedef enum http_status_e /**** HTTP status codes ****/
|
||||
HTTP_STATUS_CUPS_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/macOS 10.7@ */
|
||||
HTTP_STATUS_CUPS_WEBIF_DISABLED /* Web interface is disabled @private@ */
|
||||
|
||||
# define HTTP_STATUS_MOVED_TEMPORARILY HTTP_STATUS_FOUND /* Renamed in RFC 7231 */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
/* Old names for this enumeration */
|
||||
# define HTTP_ERROR HTTP_STATUS_ERROR
|
||||
|
||||
+16
-4
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Internet Printing Protocol support functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* Copyright © 2007-2018 by Apple Inc.
|
||||
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -960,9 +960,12 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
|
||||
"feed-orientation-supported",
|
||||
"finishings",
|
||||
"finishings-col",
|
||||
"finishings-col-database",
|
||||
"finishings-col-default",
|
||||
"finishings-col-ready",
|
||||
"finishings-col-supported",
|
||||
"finishings-default",
|
||||
"finishings-ready",
|
||||
"finishings-supported",
|
||||
"font-name-requested",
|
||||
"font-name-requested-default",
|
||||
@@ -1001,6 +1004,7 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
|
||||
"media-bottom-margin-supported",
|
||||
"media-col",
|
||||
"media-col-default",
|
||||
"media-col-ready",
|
||||
"media-col-supported",
|
||||
"media-color-supported",
|
||||
"media-default",
|
||||
@@ -1015,6 +1019,7 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
|
||||
"media-left-margin-supported",
|
||||
"media-order-count-supported",
|
||||
"media-pre-printed-supported",
|
||||
"media-ready",
|
||||
"media-recycled-supported",
|
||||
"media-right-margin-supported",
|
||||
"media-size-supported",
|
||||
@@ -1277,9 +1282,12 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
|
||||
"feed-orientation-supported",
|
||||
"finishings",
|
||||
"finishings-col",
|
||||
"finishings-col-database",
|
||||
"finishings-col-default",
|
||||
"finishings-col-ready",
|
||||
"finishings-col-supported",
|
||||
"finishings-default",
|
||||
"finishings-ready",
|
||||
"finishings-supported",
|
||||
"font-name-requested",
|
||||
"font-name-requested-default",
|
||||
@@ -1383,6 +1391,7 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
|
||||
"media-bottom-margin-supported",
|
||||
"media-col",
|
||||
"media-col-default",
|
||||
"media-col-ready",
|
||||
"media-col-supported",
|
||||
"media-color-supported",
|
||||
"media-default",
|
||||
@@ -1397,6 +1406,7 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
|
||||
"media-left-margin-supported",
|
||||
"media-order-count-supported",
|
||||
"media-pre-printed-supported",
|
||||
"media-ready",
|
||||
"media-recycled-supported",
|
||||
"media-right-margin-supported",
|
||||
"media-size-supported",
|
||||
@@ -1582,10 +1592,12 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
|
||||
"job-page-limit", /* CUPS extension */
|
||||
"job-password-encryption-supported",
|
||||
"job-password-supported",
|
||||
"job-presets-supported", /* IPP Presets */
|
||||
"job-quota-period", /* CUPS extension */
|
||||
"job-resolvers-supported",
|
||||
"job-settable-attributes-supported",
|
||||
"job-spooling-supported",
|
||||
"job-triggers-supported", /* IPP Presets */
|
||||
"jpeg-k-octets-supported", /* CUPS extension */
|
||||
"jpeg-x-dimension-supported", /* CUPS extension */
|
||||
"jpeg-y-dimension-supported", /* CUPS extension */
|
||||
@@ -1599,8 +1611,6 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
|
||||
"marker-message", /* CUPS extension */
|
||||
"marker-names", /* CUPS extension */
|
||||
"marker-types", /* CUPS extension */
|
||||
"media-col-ready",
|
||||
"media-ready",
|
||||
"member-names", /* CUPS extension */
|
||||
"member-uris", /* CUPS extension */
|
||||
"multiple-destination-uris-supported",/* IPP FaxOut */
|
||||
@@ -1623,6 +1633,8 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
|
||||
"printer-charge-info",
|
||||
"printer-charge-info-uri",
|
||||
"printer-commands", /* CUPS extension */
|
||||
"printer-config-change-date-time",
|
||||
"printer-config-change-time",
|
||||
"printer-current-time",
|
||||
"printer-detailed-status-messages",
|
||||
"printer-device-id",
|
||||
|
||||
+35
-5
@@ -1509,6 +1509,16 @@ ippCopyAttribute(
|
||||
dstattr = ippAddSeparator(dst);
|
||||
break;
|
||||
|
||||
case IPP_TAG_UNSUPPORTED_VALUE :
|
||||
case IPP_TAG_DEFAULT :
|
||||
case IPP_TAG_UNKNOWN :
|
||||
case IPP_TAG_NOVALUE :
|
||||
case IPP_TAG_NOTSETTABLE :
|
||||
case IPP_TAG_DELETEATTR :
|
||||
case IPP_TAG_ADMINDEFINE :
|
||||
dstattr = ippAddOutOfBand(dst, srcattr->group_tag, srcattr->value_tag & ~IPP_TAG_CUPS_CONST, srcattr->name);
|
||||
break;
|
||||
|
||||
case IPP_TAG_INTEGER :
|
||||
case IPP_TAG_ENUM :
|
||||
dstattr = ippAddIntegers(dst, srcattr->group_tag, srcattr->value_tag,
|
||||
@@ -1828,12 +1838,19 @@ ippDelete(ipp_t *ipp) /* I - IPP message */
|
||||
|
||||
ipp->use --;
|
||||
if (ipp->use > 0)
|
||||
{
|
||||
DEBUG_printf(("4debug_retain: %p IPP message (use=%d)", (void *)ipp, ipp->use));
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_printf(("4debug_free: %p IPP message", (void *)ipp));
|
||||
|
||||
for (attr = ipp->attrs; attr != NULL; attr = next)
|
||||
{
|
||||
next = attr->next;
|
||||
|
||||
DEBUG_printf(("4debug_free: %p %s %s%s (%d values)", (void *)attr, attr->name, attr->num_values > 1 ? "1setOf " : "", ippTagString(attr->value_tag), attr->num_values));
|
||||
|
||||
ipp_free_values(attr, 0, attr->num_values);
|
||||
|
||||
if (attr->name)
|
||||
@@ -1870,6 +1887,8 @@ ippDeleteAttribute(
|
||||
if (!attr)
|
||||
return;
|
||||
|
||||
DEBUG_printf(("4debug_free: %p %s %s%s (%d values)", (void *)attr, attr->name, attr->num_values > 1 ? "1setOf " : "", ippTagString(attr->value_tag), attr->num_values));
|
||||
|
||||
/*
|
||||
* Find the attribute in the list...
|
||||
*/
|
||||
@@ -2705,6 +2724,8 @@ ippNew(void)
|
||||
* Set default version - usually 2.0...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("4debug_alloc: %p IPP message", (void *)temp));
|
||||
|
||||
if (cg->server_version == 0)
|
||||
_cupsSetDefaults();
|
||||
|
||||
@@ -4285,18 +4306,22 @@ ippSetString(ipp_t *ipp, /* I - IPP message */
|
||||
{
|
||||
char *temp; /* Temporary string */
|
||||
_ipp_value_t *value; /* Current value */
|
||||
ipp_tag_t value_tag; /* Value tag */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (attr && *attr)
|
||||
value_tag = (*attr)->value_tag & IPP_TAG_CUPS_MASK;
|
||||
else
|
||||
value_tag = IPP_TAG_ZERO;
|
||||
|
||||
if (!ipp || !attr || !*attr ||
|
||||
((*attr)->value_tag != IPP_TAG_TEXTLANG &&
|
||||
(*attr)->value_tag != IPP_TAG_NAMELANG &&
|
||||
((*attr)->value_tag < IPP_TAG_TEXT ||
|
||||
(*attr)->value_tag > IPP_TAG_MIMETYPE)) ||
|
||||
element < 0 || element > (*attr)->num_values || !strvalue)
|
||||
(value_tag < IPP_TAG_TEXT && value_tag != IPP_TAG_TEXTLANG &&
|
||||
value_tag != IPP_TAG_NAMELANG) || value_tag > IPP_TAG_MIMETYPE ||
|
||||
!strvalue)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
@@ -6402,6 +6427,8 @@ ipp_add_attr(ipp_t *ipp, /* I - IPP message */
|
||||
* Initialize attribute...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("4debug_alloc: %p %s %s%s (%d values)", (void *)attr, name, num_values > 1 ? "1setOf " : "", ippTagString(value_tag), num_values));
|
||||
|
||||
if (name)
|
||||
attr->name = _cupsStrAlloc(name);
|
||||
|
||||
@@ -6958,6 +6985,9 @@ ipp_set_value(ipp_t *ipp, /* IO - IPP message */
|
||||
* Reset pointers in the list...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("4debug_free: %p %s", (void *)*attr, temp->name));
|
||||
DEBUG_printf(("4debug_alloc: %p %s %s%s (%d)", (void *)temp, temp->name, temp->num_values > 1 ? "1setOf " : "", ippTagString(temp->value_tag), temp->num_values));
|
||||
|
||||
if (ipp->current == *attr && ipp->prev)
|
||||
{
|
||||
/*
|
||||
|
||||
+5
-5
@@ -79,11 +79,11 @@ extern "C" {
|
||||
|
||||
typedef enum ipp_dstate_e /**** Document states @exclude all@ ****/
|
||||
{
|
||||
IPP_DOCUMENT_PENDING = 3, /* Document is pending */
|
||||
IPP_DOCUMENT_PROCESSING = 5, /* Document is processing */
|
||||
IPP_DOCUMENT_CANCELED = 7, /* Document is canceled */
|
||||
IPP_DOCUMENT_ABORTED, /* Document is aborted */
|
||||
IPP_DOCUMENT_COMPLETED /* Document is completed */
|
||||
IPP_DSTATE_PENDING = 3, /* Document is pending */
|
||||
IPP_DSTATE_PROCESSING = 5, /* Document is processing */
|
||||
IPP_DSTATE_CANCELED = 7, /* Document is canceled */
|
||||
IPP_DSTATE_ABORTED, /* Document is aborted */
|
||||
IPP_DSTATE_COMPLETED /* Document is completed */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_DOCUMENT_PENDING IPP_DSTATE_PENDING
|
||||
|
||||
+65
-7
@@ -123,7 +123,9 @@ static const _apple_language_locale_t apple_language_locale[] =
|
||||
{ "nb", "no" },
|
||||
{ "nb_NO", "no" },
|
||||
{ "zh-Hans", "zh_CN" },
|
||||
{ "zh_HANS", "zh_CN" },
|
||||
{ "zh-Hant", "zh_TW" },
|
||||
{ "zh_HANT", "zh_TW" },
|
||||
{ "zh-Hant_CN", "zh_TW" }
|
||||
};
|
||||
#endif /* __APPLE__ */
|
||||
@@ -254,8 +256,16 @@ _cupsAppleLocale(CFStringRef languageName, /* I - Apple language ID */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
CFStringRef localeName; /* Locale as a CF string */
|
||||
#ifdef DEBUG
|
||||
char temp[1024]; /* Temporary string */
|
||||
|
||||
|
||||
if (!CFStringGetCString(languageName, temp, (CFIndex)sizeof(temp), kCFStringEncodingASCII))
|
||||
temp[0] = '\0';
|
||||
|
||||
DEBUG_printf(("_cupsAppleLocale(languageName=%p(%s), locale=%p, localsize=%d)", (void *)languageName, temp, (void *)locale, (int)localesize));
|
||||
#endif /* DEBUG */
|
||||
|
||||
localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault, languageName);
|
||||
|
||||
if (localeName)
|
||||
@@ -267,6 +277,8 @@ _cupsAppleLocale(CFStringRef languageName, /* I - Apple language ID */
|
||||
if (!CFStringGetCString(localeName, locale, (CFIndex)localesize, kCFStringEncodingASCII))
|
||||
*locale = '\0';
|
||||
|
||||
DEBUG_printf(("_cupsAppleLocale: locale=\"%s\"", locale));
|
||||
|
||||
CFRelease(localeName);
|
||||
|
||||
/*
|
||||
@@ -278,8 +290,12 @@ _cupsAppleLocale(CFStringRef languageName, /* I - Apple language ID */
|
||||
sizeof(apple_language_locale[0]));
|
||||
i ++)
|
||||
{
|
||||
if (!strcmp(locale, apple_language_locale[i].language))
|
||||
size_t len = strlen(apple_language_locale[i].language);
|
||||
|
||||
if (!strcmp(locale, apple_language_locale[i].language) ||
|
||||
(!strncmp(locale, apple_language_locale[i].language, len) && (locale[len] == '_' || locale[len] == '-')))
|
||||
{
|
||||
DEBUG_printf(("_cupsAppleLocale: Updating locale to \"%s\".", apple_language_locale[i].locale));
|
||||
strlcpy(locale, apple_language_locale[i].locale, localesize);
|
||||
break;
|
||||
}
|
||||
@@ -296,7 +312,10 @@ _cupsAppleLocale(CFStringRef languageName, /* I - Apple language ID */
|
||||
}
|
||||
|
||||
if (!*locale)
|
||||
{
|
||||
DEBUG_puts("_cupsAppleLocale: Returning NULL.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert language subtag into region subtag...
|
||||
@@ -304,10 +323,14 @@ _cupsAppleLocale(CFStringRef languageName, /* I - Apple language ID */
|
||||
|
||||
if (locale[2] == '-')
|
||||
locale[2] = '_';
|
||||
else if (locale[3] == '-')
|
||||
locale[3] = '_';
|
||||
|
||||
if (!strchr(locale, '.'))
|
||||
strlcat(locale, ".UTF-8", localesize);
|
||||
|
||||
DEBUG_printf(("_cupsAppleLocale: Returning \"%s\".", locale));
|
||||
|
||||
return (locale);
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
@@ -669,6 +692,15 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*ptr++ = (char)toupper(*language & 255);
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
/*
|
||||
* Map Chinese region codes to legacy country codes.
|
||||
*/
|
||||
|
||||
if (!strcmp(language, "zh") && !strcmp(country, "HANS"))
|
||||
strlcpy(country, "CN", sizeof(country));
|
||||
if (!strcmp(language, "zh") && !strcmp(country, "HANT"))
|
||||
strlcpy(country, "TW", sizeof(country));
|
||||
}
|
||||
|
||||
if (*language == '.' && !charset[0])
|
||||
@@ -688,7 +720,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* Force a POSIX locale for an invalid language name...
|
||||
*/
|
||||
|
||||
if (strlen(langname) != 2)
|
||||
if (strlen(langname) != 2 && strlen(langname) != 3)
|
||||
{
|
||||
strlcpy(langname, "C", sizeof(langname));
|
||||
country[0] = '\0';
|
||||
@@ -828,6 +860,9 @@ _cupsLangString(cups_lang_t *lang, /* I - Language */
|
||||
{
|
||||
const char *s; /* Localized message */
|
||||
|
||||
|
||||
DEBUG_printf(("_cupsLangString(lang=%p, message=\"%s\")", (void *)lang, message));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
@@ -1126,6 +1161,8 @@ _cupsMessageLookup(cups_array_t *a, /* I - Message array */
|
||||
*match; /* Matching message */
|
||||
|
||||
|
||||
DEBUG_printf(("_cupsMessageLookup(a=%p, m=\"%s\")", (void *)a, m));
|
||||
|
||||
/*
|
||||
* Lookup the message string; if it doesn't exist in the catalog,
|
||||
* then return the message that was passed to us...
|
||||
@@ -1336,11 +1373,13 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
{
|
||||
char filename[1024], /* Path to cups.strings file */
|
||||
applelang[256], /* Apple language ID */
|
||||
baselang[3]; /* Base language */
|
||||
baselang[4]; /* Base language */
|
||||
CFURLRef url; /* URL to cups.strings file */
|
||||
CFReadStreamRef stream = NULL; /* File stream */
|
||||
CFPropertyListRef plist = NULL; /* Localization file */
|
||||
#ifdef DEBUG
|
||||
const char *cups_strings = getenv("CUPS_STRINGS");
|
||||
/* Test strings file */
|
||||
CFErrorRef error = NULL; /* Error when opening file */
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -1351,6 +1390,15 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
* Load the cups.strings file...
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
if (cups_strings)
|
||||
{
|
||||
DEBUG_puts("1appleMessageLoad: Using debug CUPS_STRINGS file.");
|
||||
strlcpy(filename, cups_strings, sizeof(filename));
|
||||
}
|
||||
else
|
||||
#endif /* DEBUG */
|
||||
|
||||
snprintf(filename, sizeof(filename),
|
||||
CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings",
|
||||
_cupsAppleLanguage(locale, applelang, sizeof(applelang)));
|
||||
@@ -1363,6 +1411,7 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
* Try with original locale string...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("1appleMessageLoad: \"%s\": %s", filename, strerror(errno)));
|
||||
snprintf(filename, sizeof(filename), CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", locale);
|
||||
}
|
||||
|
||||
@@ -1374,18 +1423,23 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
* Try with just the language code...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("1appleMessageLoad: \"%s\": %s", filename, strerror(errno)));
|
||||
|
||||
strlcpy(baselang, locale, sizeof(baselang));
|
||||
if (baselang[3] == '-' || baselang[3] == '_')
|
||||
baselang[3] = '\0';
|
||||
|
||||
snprintf(filename, sizeof(filename), CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", baselang);
|
||||
}
|
||||
|
||||
DEBUG_printf(("1appleMessageLoad: filename=\"%s\"", filename));
|
||||
|
||||
if (access(filename, 0))
|
||||
{
|
||||
/*
|
||||
* Try alternate lproj directory names...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("1appleMessageLoad: \"%s\": %s", filename, strerror(errno)));
|
||||
|
||||
if (!strncmp(locale, "en", 2))
|
||||
locale = "English";
|
||||
else if (!strncmp(locale, "nb", 2))
|
||||
@@ -1402,7 +1456,7 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
locale = "Japanese";
|
||||
else if (!strncmp(locale, "es", 2))
|
||||
locale = "Spanish";
|
||||
else if (!strcmp(locale, "zh_HK") || !strncmp(locale, "zh-Hant", 7))
|
||||
else if (!strcmp(locale, "zh_HK") || !strncasecmp(locale, "zh-Hant", 7) || !strncasecmp(locale, "zh_Hant", 7))
|
||||
{
|
||||
/*
|
||||
* <rdar://problem/22130168>
|
||||
@@ -1423,14 +1477,18 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
*/
|
||||
|
||||
strlcpy(baselang, locale, sizeof(baselang));
|
||||
if (baselang[2] == '-' || baselang[2] == '_')
|
||||
baselang[2] = '\0';
|
||||
|
||||
locale = baselang;
|
||||
}
|
||||
|
||||
snprintf(filename, sizeof(filename),
|
||||
CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", locale);
|
||||
DEBUG_printf(("1appleMessageLoad: alternate filename=\"%s\"", filename));
|
||||
}
|
||||
|
||||
DEBUG_printf(("1appleMessageLoad: filename=\"%s\"", filename));
|
||||
|
||||
url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
|
||||
(UInt8 *)filename,
|
||||
(CFIndex)strlen(filename), false);
|
||||
|
||||
+86
-84
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Private MD5 implementation for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 2005 by Easy Software Products
|
||||
* Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
|
||||
*
|
||||
@@ -43,70 +43,71 @@
|
||||
#include "md5-private.h"
|
||||
#include "string-private.h"
|
||||
|
||||
#define T1 0xd76aa478
|
||||
#define T2 0xe8c7b756
|
||||
#define T3 0x242070db
|
||||
#define T4 0xc1bdceee
|
||||
#define T5 0xf57c0faf
|
||||
#define T6 0x4787c62a
|
||||
#define T7 0xa8304613
|
||||
#define T8 0xfd469501
|
||||
#define T9 0x698098d8
|
||||
#define T10 0x8b44f7af
|
||||
#define T11 0xffff5bb1
|
||||
#define T12 0x895cd7be
|
||||
#define T13 0x6b901122
|
||||
#define T14 0xfd987193
|
||||
#define T15 0xa679438e
|
||||
#define T16 0x49b40821
|
||||
#define T17 0xf61e2562
|
||||
#define T18 0xc040b340
|
||||
#define T19 0x265e5a51
|
||||
#define T20 0xe9b6c7aa
|
||||
#define T21 0xd62f105d
|
||||
#define T22 0x02441453
|
||||
#define T23 0xd8a1e681
|
||||
#define T24 0xe7d3fbc8
|
||||
#define T25 0x21e1cde6
|
||||
#define T26 0xc33707d6
|
||||
#define T27 0xf4d50d87
|
||||
#define T28 0x455a14ed
|
||||
#define T29 0xa9e3e905
|
||||
#define T30 0xfcefa3f8
|
||||
#define T31 0x676f02d9
|
||||
#define T32 0x8d2a4c8a
|
||||
#define T33 0xfffa3942
|
||||
#define T34 0x8771f681
|
||||
#define T35 0x6d9d6122
|
||||
#define T36 0xfde5380c
|
||||
#define T37 0xa4beea44
|
||||
#define T38 0x4bdecfa9
|
||||
#define T39 0xf6bb4b60
|
||||
#define T40 0xbebfbc70
|
||||
#define T41 0x289b7ec6
|
||||
#define T42 0xeaa127fa
|
||||
#define T43 0xd4ef3085
|
||||
#define T44 0x04881d05
|
||||
#define T45 0xd9d4d039
|
||||
#define T46 0xe6db99e5
|
||||
#define T47 0x1fa27cf8
|
||||
#define T48 0xc4ac5665
|
||||
#define T49 0xf4292244
|
||||
#define T50 0x432aff97
|
||||
#define T51 0xab9423a7
|
||||
#define T52 0xfc93a039
|
||||
#define T53 0x655b59c3
|
||||
#define T54 0x8f0ccc92
|
||||
#define T55 0xffeff47d
|
||||
#define T56 0x85845dd1
|
||||
#define T57 0x6fa87e4f
|
||||
#define T58 0xfe2ce6e0
|
||||
#define T59 0xa3014314
|
||||
#define T60 0x4e0811a1
|
||||
#define T61 0xf7537e82
|
||||
#define T62 0xbd3af235
|
||||
#define T63 0x2ad7d2bb
|
||||
#define T64 0xeb86d391
|
||||
#if !defined(__APPLE__) && !defined(HAVE_GNUTLS)
|
||||
# define T1 0xd76aa478
|
||||
# define T2 0xe8c7b756
|
||||
# define T3 0x242070db
|
||||
# define T4 0xc1bdceee
|
||||
# define T5 0xf57c0faf
|
||||
# define T6 0x4787c62a
|
||||
# define T7 0xa8304613
|
||||
# define T8 0xfd469501
|
||||
# define T9 0x698098d8
|
||||
# define T10 0x8b44f7af
|
||||
# define T11 0xffff5bb1
|
||||
# define T12 0x895cd7be
|
||||
# define T13 0x6b901122
|
||||
# define T14 0xfd987193
|
||||
# define T15 0xa679438e
|
||||
# define T16 0x49b40821
|
||||
# define T17 0xf61e2562
|
||||
# define T18 0xc040b340
|
||||
# define T19 0x265e5a51
|
||||
# define T20 0xe9b6c7aa
|
||||
# define T21 0xd62f105d
|
||||
# define T22 0x02441453
|
||||
# define T23 0xd8a1e681
|
||||
# define T24 0xe7d3fbc8
|
||||
# define T25 0x21e1cde6
|
||||
# define T26 0xc33707d6
|
||||
# define T27 0xf4d50d87
|
||||
# define T28 0x455a14ed
|
||||
# define T29 0xa9e3e905
|
||||
# define T30 0xfcefa3f8
|
||||
# define T31 0x676f02d9
|
||||
# define T32 0x8d2a4c8a
|
||||
# define T33 0xfffa3942
|
||||
# define T34 0x8771f681
|
||||
# define T35 0x6d9d6122
|
||||
# define T36 0xfde5380c
|
||||
# define T37 0xa4beea44
|
||||
# define T38 0x4bdecfa9
|
||||
# define T39 0xf6bb4b60
|
||||
# define T40 0xbebfbc70
|
||||
# define T41 0x289b7ec6
|
||||
# define T42 0xeaa127fa
|
||||
# define T43 0xd4ef3085
|
||||
# define T44 0x04881d05
|
||||
# define T45 0xd9d4d039
|
||||
# define T46 0xe6db99e5
|
||||
# define T47 0x1fa27cf8
|
||||
# define T48 0xc4ac5665
|
||||
# define T49 0xf4292244
|
||||
# define T50 0x432aff97
|
||||
# define T51 0xab9423a7
|
||||
# define T52 0xfc93a039
|
||||
# define T53 0x655b59c3
|
||||
# define T54 0x8f0ccc92
|
||||
# define T55 0xffeff47d
|
||||
# define T56 0x85845dd1
|
||||
# define T57 0x6fa87e4f
|
||||
# define T58 0xfe2ce6e0
|
||||
# define T59 0xa3014314
|
||||
# define T60 0x4e0811a1
|
||||
# define T61 0xf7537e82
|
||||
# define T62 0xbd3af235
|
||||
# define T63 0x2ad7d2bb
|
||||
# define T64 0xeb86d391
|
||||
|
||||
static void
|
||||
_cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
|
||||
@@ -116,10 +117,10 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
|
||||
c = pms->abcd[2], d = pms->abcd[3];
|
||||
unsigned int t;
|
||||
|
||||
#ifndef ARCH_IS_BIG_ENDIAN
|
||||
# define ARCH_IS_BIG_ENDIAN 1 /* slower, default implementation */
|
||||
#endif
|
||||
#if ARCH_IS_BIG_ENDIAN
|
||||
# ifndef ARCH_IS_BIG_ENDIAN
|
||||
# define ARCH_IS_BIG_ENDIAN 1 /* slower, default implementation */
|
||||
# endif
|
||||
# if ARCH_IS_BIG_ENDIAN
|
||||
|
||||
/*
|
||||
* On big-endian machines, we must arrange the bytes in the right
|
||||
@@ -133,7 +134,7 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
|
||||
X[i] = (unsigned)xp[0] + ((unsigned)xp[1] << 8) +
|
||||
((unsigned)xp[2] << 16) + ((unsigned)xp[3] << 24);
|
||||
|
||||
#else /* !ARCH_IS_BIG_ENDIAN */
|
||||
# else /* !ARCH_IS_BIG_ENDIAN */
|
||||
|
||||
/*
|
||||
* On little-endian machines, we can process properly aligned data
|
||||
@@ -150,15 +151,15 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
|
||||
memcpy(xbuf, data, 64);
|
||||
X = xbuf;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
# define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
|
||||
/* Round 1. */
|
||||
/* Let [abcd k s i] denote the operation
|
||||
a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
|
||||
#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
|
||||
#define SET(a, b, c, d, k, s, Ti)\
|
||||
# define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
|
||||
# define SET(a, b, c, d, k, s, Ti)\
|
||||
t = a + F(b,c,d) + X[k] + Ti;\
|
||||
a = ROTATE_LEFT(t, s) + b
|
||||
/* Do the following 16 operations. */
|
||||
@@ -178,13 +179,13 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
|
||||
SET(d, a, b, c, 13, 12, T14);
|
||||
SET(c, d, a, b, 14, 17, T15);
|
||||
SET(b, c, d, a, 15, 22, T16);
|
||||
#undef SET
|
||||
# undef SET
|
||||
|
||||
/* Round 2. */
|
||||
/* Let [abcd k s i] denote the operation
|
||||
a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
|
||||
#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
|
||||
#define SET(a, b, c, d, k, s, Ti)\
|
||||
# define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
|
||||
# define SET(a, b, c, d, k, s, Ti)\
|
||||
t = a + G(b,c,d) + X[k] + Ti;\
|
||||
a = ROTATE_LEFT(t, s) + b
|
||||
/* Do the following 16 operations. */
|
||||
@@ -204,13 +205,13 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
|
||||
SET(d, a, b, c, 2, 9, T30);
|
||||
SET(c, d, a, b, 7, 14, T31);
|
||||
SET(b, c, d, a, 12, 20, T32);
|
||||
#undef SET
|
||||
# undef SET
|
||||
|
||||
/* Round 3. */
|
||||
/* Let [abcd k s t] denote the operation
|
||||
a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
|
||||
#define H(x, y, z) ((x) ^ (y) ^ (z))
|
||||
#define SET(a, b, c, d, k, s, Ti)\
|
||||
# define H(x, y, z) ((x) ^ (y) ^ (z))
|
||||
# define SET(a, b, c, d, k, s, Ti)\
|
||||
t = a + H(b,c,d) + X[k] + Ti;\
|
||||
a = ROTATE_LEFT(t, s) + b
|
||||
/* Do the following 16 operations. */
|
||||
@@ -230,13 +231,13 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
|
||||
SET(d, a, b, c, 12, 11, T46);
|
||||
SET(c, d, a, b, 15, 16, T47);
|
||||
SET(b, c, d, a, 2, 23, T48);
|
||||
#undef SET
|
||||
# undef SET
|
||||
|
||||
/* Round 4. */
|
||||
/* Let [abcd k s t] denote the operation
|
||||
a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
|
||||
#define I(x, y, z) ((y) ^ ((x) | ~(z)))
|
||||
#define SET(a, b, c, d, k, s, Ti)\
|
||||
# define I(x, y, z) ((y) ^ ((x) | ~(z)))
|
||||
# define SET(a, b, c, d, k, s, Ti)\
|
||||
t = a + I(b,c,d) + X[k] + Ti;\
|
||||
a = ROTATE_LEFT(t, s) + b
|
||||
/* Do the following 16 operations. */
|
||||
@@ -256,7 +257,7 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
|
||||
SET(d, a, b, c, 11, 10, T62);
|
||||
SET(c, d, a, b, 2, 15, T63);
|
||||
SET(b, c, d, a, 9, 21, T64);
|
||||
#undef SET
|
||||
# undef SET
|
||||
|
||||
/* Then perform the following additions. (That is increment each
|
||||
of the four registers by the value it had before this block
|
||||
@@ -337,3 +338,4 @@ _cupsMD5Finish(_cups_md5_state_t *pms, unsigned char digest[16])
|
||||
for (i = 0; i < 16; ++i)
|
||||
digest[i] = (unsigned char)(pms->abcd[i >> 2] >> ((i & 3) << 3));
|
||||
}
|
||||
#endif /* !__APPLE__ && !HAVE_GNUTLS */
|
||||
|
||||
+16
-36
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* MD5 password support for CUPS.
|
||||
* MD5 password support for CUPS (deprecated).
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -17,12 +17,15 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <cups/cups.h>
|
||||
#include "http-private.h"
|
||||
#include "string-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'httpMD5()' - Compute the MD5 sum of the username:group:password.
|
||||
*
|
||||
* @deprecated@
|
||||
*/
|
||||
|
||||
char * /* O - MD5 sum */
|
||||
@@ -31,7 +34,6 @@ httpMD5(const char *username, /* I - User name */
|
||||
const char *passwd, /* I - Password string */
|
||||
char md5[33]) /* O - MD5 string */
|
||||
{
|
||||
_cups_md5_state_t state; /* MD5 state info */
|
||||
unsigned char sum[16]; /* Sum data */
|
||||
char line[256]; /* Line to sum */
|
||||
|
||||
@@ -41,15 +43,13 @@ httpMD5(const char *username, /* I - User name */
|
||||
*/
|
||||
|
||||
snprintf(line, sizeof(line), "%s:%s:%s", username, realm, passwd);
|
||||
_cupsMD5Init(&state);
|
||||
_cupsMD5Append(&state, (unsigned char *)line, (int)strlen(line));
|
||||
_cupsMD5Finish(&state, sum);
|
||||
cupsHashData("md5", (unsigned char *)line, strlen(line), sum, sizeof(sum));
|
||||
|
||||
/*
|
||||
* Return the sum...
|
||||
*/
|
||||
|
||||
return (httpMD5String(sum, md5));
|
||||
return ((char *)cupsHashString(sum, sizeof(sum), md5, 33));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,8 @@ httpMD5(const char *username, /* I - User name */
|
||||
* 'httpMD5Final()' - Combine the MD5 sum of the username, group, and password
|
||||
* with the server-supplied nonce value, method, and
|
||||
* request-uri.
|
||||
*
|
||||
* @deprecated@
|
||||
*/
|
||||
|
||||
char * /* O - New sum */
|
||||
@@ -65,7 +67,6 @@ httpMD5Final(const char *nonce, /* I - Server nonce value */
|
||||
const char *resource, /* I - Resource path */
|
||||
char md5[33]) /* IO - MD5 sum */
|
||||
{
|
||||
_cups_md5_state_t state; /* MD5 state info */
|
||||
unsigned char sum[16]; /* Sum data */
|
||||
char line[1024]; /* Line of data */
|
||||
char a2[33]; /* Hash of method and resource */
|
||||
@@ -76,10 +77,8 @@ httpMD5Final(const char *nonce, /* I - Server nonce value */
|
||||
*/
|
||||
|
||||
snprintf(line, sizeof(line), "%s:%s", method, resource);
|
||||
_cupsMD5Init(&state);
|
||||
_cupsMD5Append(&state, (unsigned char *)line, (int)strlen(line));
|
||||
_cupsMD5Finish(&state, sum);
|
||||
httpMD5String(sum, a2);
|
||||
cupsHashData("md5", (unsigned char *)line, strlen(line), sum, sizeof(sum));
|
||||
cupsHashString(sum, sizeof(sum), a2, sizeof(a2));
|
||||
|
||||
/*
|
||||
* Then combine A1 (MD5 of username, realm, and password) with the nonce
|
||||
@@ -88,17 +87,16 @@ httpMD5Final(const char *nonce, /* I - Server nonce value */
|
||||
*/
|
||||
|
||||
snprintf(line, sizeof(line), "%s:%s:%s", md5, nonce, a2);
|
||||
cupsHashData("md5", (unsigned char *)line, strlen(line), sum, sizeof(sum));
|
||||
|
||||
_cupsMD5Init(&state);
|
||||
_cupsMD5Append(&state, (unsigned char *)line, (int)strlen(line));
|
||||
_cupsMD5Finish(&state, sum);
|
||||
|
||||
return (httpMD5String(sum, md5));
|
||||
return ((char *)cupsHashString(sum, sizeof(sum), md5, 33));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpMD5String()' - Convert an MD5 sum to a character string.
|
||||
*
|
||||
* @deprecated@
|
||||
*/
|
||||
|
||||
char * /* O - MD5 sum in hex */
|
||||
@@ -106,23 +104,5 @@ httpMD5String(const unsigned char *sum, /* I - MD5 sum data */
|
||||
char md5[33])
|
||||
/* O - MD5 sum in hex */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char *md5ptr; /* Pointer into MD5 string */
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
/* Hex digits */
|
||||
|
||||
|
||||
/*
|
||||
* Convert the MD5 sum to hexadecimal...
|
||||
*/
|
||||
|
||||
for (i = 16, md5ptr = md5; i > 0; i --, sum ++)
|
||||
{
|
||||
*md5ptr++ = hex[*sum >> 4];
|
||||
*md5ptr++ = hex[*sum & 15];
|
||||
}
|
||||
|
||||
*md5ptr = '\0';
|
||||
|
||||
return (md5);
|
||||
return ((char *)cupsHashString(sum, 16, md5, 33));
|
||||
}
|
||||
|
||||
@@ -80,6 +80,11 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
if (!_cups_strcasecmp(name, "cupsPrintQuality"))
|
||||
num_options = cupsRemoveOption("print-quality", num_options, options);
|
||||
else if (!_cups_strcasecmp(name, "print-quality"))
|
||||
num_options = cupsRemoveOption("cupsPrintQuality", num_options, options);
|
||||
|
||||
/*
|
||||
* Look for an existing option with the same name...
|
||||
*/
|
||||
|
||||
+174
-90
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PPD cache implementation for CUPS.
|
||||
*
|
||||
* Copyright 2010-2017 by Apple Inc.
|
||||
* Copyright © 2010-2018 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -78,6 +78,8 @@ _cupsConvertOptions(
|
||||
int num_finishings = 0, /* Number of finishing values */
|
||||
finishings[10]; /* Finishing enum values */
|
||||
ppd_choice_t *choice; /* Marked choice */
|
||||
int finishings_copies = copies;
|
||||
/* Number of copies for finishings */
|
||||
|
||||
|
||||
/*
|
||||
@@ -366,13 +368,13 @@ _cupsConvertOptions(
|
||||
{
|
||||
ippAddIntegers(request, IPP_TAG_JOB, IPP_TAG_ENUM, "finishings", num_finishings, finishings);
|
||||
|
||||
if (copies > 1 && (keyword = cupsGetOption("job-impressions", num_options, options)) != NULL)
|
||||
if (copies != finishings_copies && (keyword = cupsGetOption("job-impressions", num_options, options)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Send job-pages-per-set attribute to apply finishings correctly...
|
||||
*/
|
||||
|
||||
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-pages-per-set", atoi(keyword) / copies);
|
||||
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-pages-per-set", atoi(keyword) / finishings_copies);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2084,11 +2086,16 @@ _ppdCacheGetFinishingValues(
|
||||
|
||||
DEBUG_printf(("_ppdCacheGetFinishingValues(pc=%p, num_options=%d, options=%p, max_values=%d, values=%p)", pc, num_options, options, max_values, values));
|
||||
|
||||
if (!pc || !pc->finishings || num_options < 1 || max_values < 1 || !values)
|
||||
if (!pc || max_values < 1 || !values)
|
||||
{
|
||||
DEBUG_puts("_ppdCacheGetFinishingValues: Bad arguments, returning 0.");
|
||||
return (0);
|
||||
}
|
||||
else if (!pc->finishings)
|
||||
{
|
||||
DEBUG_puts("_ppdCacheGetFinishingValues: No finishings support, returning 0.");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Go through the finishings options and see what is set...
|
||||
@@ -2114,7 +2121,7 @@ _ppdCacheGetFinishingValues(
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
DEBUG_printf(("_ppdCacheGetFinishingValues: Adding %d.", f->value));
|
||||
DEBUG_printf(("_ppdCacheGetFinishingValues: Adding %d (%s)", f->value, ippEnumString("finishings", f->value)));
|
||||
|
||||
values[num_values ++] = f->value;
|
||||
|
||||
@@ -2123,6 +2130,17 @@ _ppdCacheGetFinishingValues(
|
||||
}
|
||||
}
|
||||
|
||||
if (num_values == 0)
|
||||
{
|
||||
/*
|
||||
* Always have at least "finishings" = 'none'...
|
||||
*/
|
||||
|
||||
DEBUG_puts("_ppdCacheGetFinishingValues: Adding 3 (none).");
|
||||
values[0] = IPP_FINISHINGS_NONE;
|
||||
num_values ++;
|
||||
}
|
||||
|
||||
DEBUG_printf(("_ppdCacheGetFinishingValues: Returning %d.", num_values));
|
||||
|
||||
return (num_values);
|
||||
@@ -2949,6 +2967,8 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
|
||||
is_pwg = 0; /* Does the printer support PWG Raster? */
|
||||
pwg_media_t *pwg; /* PWG media size */
|
||||
int xres, yres; /* Resolution values */
|
||||
int resolutions[1000];
|
||||
/* Array of resolution indices */
|
||||
cups_lang_t *lang = cupsLangDefault();
|
||||
/* Localization info */
|
||||
struct lconv *loc = localeconv();
|
||||
@@ -3097,6 +3117,41 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
|
||||
cupsFilePuts(fp, "*cupsSNMPSupplies: False\n");
|
||||
cupsFilePuts(fp, "*cupsLanguages: \"en\"\n");
|
||||
|
||||
/*
|
||||
* Password/PIN printing...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-password-supported", IPP_TAG_INTEGER)) != NULL)
|
||||
{
|
||||
char pattern[33]; /* Password pattern */
|
||||
int maxlen = ippGetInteger(attr, 0);
|
||||
/* Maximum length */
|
||||
const char *repertoire = ippGetString(ippFindAttribute(response, "job-password-repertoire-configured", IPP_TAG_KEYWORD), 0, NULL);
|
||||
/* Type of password */
|
||||
|
||||
if (maxlen > (int)(sizeof(pattern) - 1))
|
||||
maxlen = sizeof(pattern) - 1;
|
||||
|
||||
if (!repertoire || !strcmp(repertoire, "iana_us-ascii_digits"))
|
||||
memset(pattern, '1', maxlen);
|
||||
else if (!strcmp(repertoire, "iana_us-ascii_letters"))
|
||||
memset(pattern, 'A', maxlen);
|
||||
else if (!strcmp(repertoire, "iana_us-ascii_complex"))
|
||||
memset(pattern, 'C', maxlen);
|
||||
else if (!strcmp(repertoire, "iana_us-ascii_any"))
|
||||
memset(pattern, '.', maxlen);
|
||||
else if (!strcmp(repertoire, "iana_utf-8_digits"))
|
||||
memset(pattern, 'N', maxlen);
|
||||
else if (!strcmp(repertoire, "iana_utf-8_letters"))
|
||||
memset(pattern, 'U', maxlen);
|
||||
else
|
||||
memset(pattern, '*', maxlen);
|
||||
|
||||
pattern[maxlen] = '\0';
|
||||
|
||||
cupsFilePrintf(fp, "*cupsPassword: \"%s\"\n", pattern);
|
||||
}
|
||||
|
||||
/*
|
||||
* Filters...
|
||||
*/
|
||||
@@ -3105,24 +3160,18 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
|
||||
{
|
||||
is_apple = ippContainsString(attr, "image/urf");
|
||||
is_pdf = ippContainsString(attr, "application/pdf");
|
||||
is_pwg = ippContainsString(attr, "image/pwg-raster");
|
||||
is_pwg = ippContainsString(attr, "image/pwg-raster") && !is_apple;
|
||||
|
||||
for (i = 0, count = ippGetCount(attr); i < count; i ++)
|
||||
{
|
||||
const char *format = ippGetString(attr, i, NULL);
|
||||
/* PDL */
|
||||
|
||||
/*
|
||||
* Write cupsFilter2 lines for supported formats...
|
||||
*/
|
||||
|
||||
if (!_cups_strcasecmp(format, "application/pdf"))
|
||||
cupsFilePuts(fp, "*cupsFilter2: \"application/vnd.cups-pdf application/pdf 10 -\"\n");
|
||||
else if (!_cups_strcasecmp(format, "image/jpeg") || !_cups_strcasecmp(format, "image/png"))
|
||||
cupsFilePrintf(fp, "*cupsFilter2: \"%s %s 0 -\"\n", format, format);
|
||||
else if (!_cups_strcasecmp(format, "image/pwg-raster") || !_cups_strcasecmp(format, "image/urf"))
|
||||
cupsFilePrintf(fp, "*cupsFilter2: \"%s %s 100 -\"\n", format, format);
|
||||
}
|
||||
if (ippContainsString(attr, "image/jpeg"))
|
||||
cupsFilePuts(fp, "*cupsFilter2: \"image/jpeg image/jpeg 0 -\"\n");
|
||||
if (ippContainsString(attr, "image/png"))
|
||||
cupsFilePuts(fp, "*cupsFilter2: \"image/png image/png 0 -\"\n");
|
||||
if (is_pdf)
|
||||
cupsFilePuts(fp, "*cupsFilter2: \"application/vnd.cups-pdf application/pdf 10 -\"\n");
|
||||
if (is_apple)
|
||||
cupsFilePuts(fp, "*cupsFilter2: \"image/urf image/urf 100 -\"\n");
|
||||
if (is_pwg)
|
||||
cupsFilePuts(fp, "*cupsFilter2: \"image/pwg-raster image/pwg-raster 100 -\"\n");
|
||||
}
|
||||
|
||||
if (!is_apple && !is_pdf && !is_pwg)
|
||||
@@ -3581,8 +3630,8 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
|
||||
* ColorModel...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(response, "pwg-raster-document-type-supported", IPP_TAG_KEYWORD)) == NULL)
|
||||
if ((attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) == NULL)
|
||||
if ((attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) == NULL)
|
||||
if ((attr = ippFindAttribute(response, "pwg-raster-document-type-supported", IPP_TAG_KEYWORD)) == NULL)
|
||||
if ((attr = ippFindAttribute(response, "print-color-mode-supported", IPP_TAG_KEYWORD)) == NULL)
|
||||
attr = ippFindAttribute(response, "output-mode-supported", IPP_TAG_KEYWORD);
|
||||
|
||||
@@ -3661,7 +3710,36 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
|
||||
"*Duplex DuplexTumble/%s: \"<</Duplex true/Tumble true>>setpagedevice\"\n"
|
||||
"*CloseUI: *Duplex\n", _cupsLangString(lang, _("2-Sided Printing")), _cupsLangString(lang, _("Off (1-Sided)")), _cupsLangString(lang, _("Long-Edge (Portrait)")), _cupsLangString(lang, _("Short-Edge (Landscape)")));
|
||||
|
||||
if ((attr = ippFindAttribute(response, "pwg-raster-document-sheet-back", IPP_TAG_KEYWORD)) != NULL)
|
||||
if ((attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
for (i = 0, count = ippGetCount(attr); i < count; i ++)
|
||||
{
|
||||
const char *dm = ippGetString(attr, i, NULL);
|
||||
/* DM value */
|
||||
|
||||
if (!_cups_strcasecmp(dm, "DM1"))
|
||||
{
|
||||
cupsFilePuts(fp, "*cupsBackSide: Normal\n");
|
||||
break;
|
||||
}
|
||||
else if (!_cups_strcasecmp(dm, "DM2"))
|
||||
{
|
||||
cupsFilePuts(fp, "*cupsBackSide: Flipped\n");
|
||||
break;
|
||||
}
|
||||
else if (!_cups_strcasecmp(dm, "DM3"))
|
||||
{
|
||||
cupsFilePuts(fp, "*cupsBackSide: Rotated\n");
|
||||
break;
|
||||
}
|
||||
else if (!_cups_strcasecmp(dm, "DM4"))
|
||||
{
|
||||
cupsFilePuts(fp, "*cupsBackSide: ManualTumble\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "pwg-raster-document-sheet-back", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
const char *keyword = ippGetString(attr, 0, NULL);
|
||||
/* Keyword value */
|
||||
@@ -3675,35 +3753,6 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
|
||||
else
|
||||
cupsFilePuts(fp, "*cupsBackSide: Rotated\n");
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
for (i = 0, count = ippGetCount(attr); i < count; i ++)
|
||||
{
|
||||
const char *dm = ippGetString(attr, i, NULL);
|
||||
/* DM value */
|
||||
|
||||
if (!_cups_strcasecmp(dm, "DM1"))
|
||||
{
|
||||
cupsFilePuts(fp, "*cupsBackSide: Normal\n");
|
||||
break;
|
||||
}
|
||||
else if (!_cups_strcasecmp(dm, "DM2"))
|
||||
{
|
||||
cupsFilePuts(fp, "*cupsBackSide: Flipped\n");
|
||||
break;
|
||||
}
|
||||
else if (!_cups_strcasecmp(dm, "DM3"))
|
||||
{
|
||||
cupsFilePuts(fp, "*cupsBackSide: Rotated\n");
|
||||
break;
|
||||
}
|
||||
else if (!_cups_strcasecmp(dm, "DM4"))
|
||||
{
|
||||
cupsFilePuts(fp, "*cupsBackSide: ManualTumble\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3962,42 +4011,14 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
|
||||
|
||||
quality = ippFindAttribute(response, "print-quality-supported", IPP_TAG_ENUM);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "pwg-raster-document-resolution-supported", IPP_TAG_RESOLUTION)) != NULL)
|
||||
if ((attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
count = ippGetCount(attr);
|
||||
|
||||
pwg_ppdize_resolution(attr, count / 2, &xres, &yres, ppdname, sizeof(ppdname));
|
||||
cupsFilePrintf(fp, "*DefaultResolution: %s\n", ppdname);
|
||||
|
||||
cupsFilePrintf(fp, "*OpenUI *cupsPrintQuality/%s: PickOne\n"
|
||||
"*OrderDependency: 10 AnySetup *cupsPrintQuality\n"
|
||||
"*DefaultcupsPrintQuality: Normal\n", _cupsLangString(lang, _("Print Quality")));
|
||||
if (count > 2 || ippContainsInteger(quality, IPP_QUALITY_DRAFT))
|
||||
{
|
||||
pwg_ppdize_resolution(attr, 0, &xres, &yres, NULL, 0);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), xres, yres);
|
||||
}
|
||||
pwg_ppdize_resolution(attr, count / 2, &xres, &yres, NULL, 0);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality Normal/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Normal")), xres, yres);
|
||||
if (count > 1 || ippContainsInteger(quality, IPP_QUALITY_HIGH))
|
||||
{
|
||||
if (count > 1)
|
||||
pwg_ppdize_resolution(attr, count - 1, &xres, &yres, NULL, 0);
|
||||
else
|
||||
pwg_ppdize_resolution(attr, 0, &xres, &yres, NULL, 0);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality High/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("High")), xres, yres);
|
||||
}
|
||||
|
||||
cupsFilePuts(fp, "*CloseUI: *cupsPrintQuality\n");
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
int lowdpi = 0, hidpi = 0; /* Lower and higher resolution */
|
||||
int lowdpi = 0, hidpi = 0; /* Lower and higher resolution */
|
||||
|
||||
for (i = 0, count = ippGetCount(attr); i < count; i ++)
|
||||
{
|
||||
const char *rs = ippGetString(attr, i, NULL);
|
||||
/* RS value */
|
||||
/* RS value */
|
||||
|
||||
if (_cups_strncasecmp(rs, "RS", 2))
|
||||
continue;
|
||||
@@ -4027,18 +4048,81 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
|
||||
cupsFilePrintf(fp, "*DefaultResolution: %ddpi\n", lowdpi);
|
||||
|
||||
cupsFilePrintf(fp, "*OpenUI *cupsPrintQuality/%s: PickOne\n"
|
||||
"*OrderDependency: 10 AnySetup *cupsPrintQuality\n"
|
||||
"*DefaultcupsPrintQuality: Normal\n", _cupsLangString(lang, _("Print Quality")));
|
||||
"*OrderDependency: 10 AnySetup *cupsPrintQuality\n"
|
||||
"*DefaultcupsPrintQuality: Normal\n", _cupsLangString(lang, _("Print Quality")));
|
||||
if ((lowdpi & 1) == 0)
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), lowdpi, lowdpi / 2);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), lowdpi, lowdpi / 2);
|
||||
else if (ippContainsInteger(quality, IPP_QUALITY_DRAFT))
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), lowdpi, lowdpi);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), lowdpi, lowdpi);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality Normal/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Normal")), lowdpi, lowdpi);
|
||||
if (hidpi > lowdpi || ippContainsInteger(quality, IPP_QUALITY_HIGH))
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality High/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("High")), hidpi, hidpi);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality High/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("High")), hidpi, hidpi);
|
||||
cupsFilePuts(fp, "*CloseUI: *cupsPrintQuality\n");
|
||||
}
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "pwg-raster-document-resolution-supported", IPP_TAG_RESOLUTION)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Make a sorted list of resolutions.
|
||||
*/
|
||||
|
||||
count = ippGetCount(attr);
|
||||
if (count > (int)(sizeof(resolutions) / sizeof(resolutions[0])))
|
||||
count = (int)(sizeof(resolutions) / sizeof(resolutions[0]));
|
||||
|
||||
for (i = 0; i < count; i ++)
|
||||
resolutions[i] = i;
|
||||
|
||||
for (i = 0; i < (count - 1); i ++)
|
||||
{
|
||||
for (j = i + 1; j < count; j ++)
|
||||
{
|
||||
int ix, iy, /* First X and Y resolution */
|
||||
jx, jy, /* Second X and Y resolution */
|
||||
temp; /* Swap variable */
|
||||
ipp_res_t units; /* Resolution units */
|
||||
|
||||
ix = ippGetResolution(attr, resolutions[i], &iy, &units);
|
||||
jx = ippGetResolution(attr, resolutions[j], &jy, &units);
|
||||
|
||||
if (ix > jx || (ix == jx && iy > jy))
|
||||
{
|
||||
/*
|
||||
* Swap these two resolutions...
|
||||
*/
|
||||
|
||||
temp = resolutions[i];
|
||||
resolutions[i] = resolutions[j];
|
||||
resolutions[j] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate print quality options...
|
||||
*/
|
||||
|
||||
pwg_ppdize_resolution(attr, resolutions[count / 2], &xres, &yres, ppdname, sizeof(ppdname));
|
||||
cupsFilePrintf(fp, "*DefaultResolution: %s\n", ppdname);
|
||||
|
||||
cupsFilePrintf(fp, "*OpenUI *cupsPrintQuality/%s: PickOne\n"
|
||||
"*OrderDependency: 10 AnySetup *cupsPrintQuality\n"
|
||||
"*DefaultcupsPrintQuality: Normal\n", _cupsLangString(lang, _("Print Quality")));
|
||||
if (count > 2 || ippContainsInteger(quality, IPP_QUALITY_DRAFT))
|
||||
{
|
||||
pwg_ppdize_resolution(attr, resolutions[0], &xres, &yres, NULL, 0);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), xres, yres);
|
||||
}
|
||||
pwg_ppdize_resolution(attr, resolutions[count / 2], &xres, &yres, NULL, 0);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality Normal/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Normal")), xres, yres);
|
||||
if (count > 1 || ippContainsInteger(quality, IPP_QUALITY_HIGH))
|
||||
{
|
||||
pwg_ppdize_resolution(attr, resolutions[count - 1], &xres, &yres, NULL, 0);
|
||||
cupsFilePrintf(fp, "*cupsPrintQuality High/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("High")), xres, yres);
|
||||
}
|
||||
|
||||
cupsFilePuts(fp, "*CloseUI: *cupsPrintQuality\n");
|
||||
}
|
||||
else if (is_apple || is_pwg)
|
||||
goto bad_ppd;
|
||||
else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Option conflict management routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 2007-2018 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
enum
|
||||
{
|
||||
_PPD_NORMAL_CONSTRAINTS,
|
||||
_PPD_OPTION_CONSTRAINTS,
|
||||
_PPD_INSTALLABLE_CONSTRAINTS,
|
||||
_PPD_ALL_CONSTRAINTS
|
||||
@@ -998,7 +997,7 @@ ppd_test_constraints(
|
||||
if (!consts->installable && which == _PPD_INSTALLABLE_CONSTRAINTS)
|
||||
continue; /* Skip non-installable option constraint */
|
||||
|
||||
if (which == _PPD_OPTION_CONSTRAINTS && option)
|
||||
if ((which == _PPD_OPTION_CONSTRAINTS || which == _PPD_INSTALLABLE_CONSTRAINTS) && option)
|
||||
{
|
||||
/*
|
||||
* Skip constraints that do not involve the current option...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PPD localization routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 2007-2018 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -277,7 +277,7 @@ ppdLocalizeIPPReason(
|
||||
|
||||
if (!locattr)
|
||||
{
|
||||
if (lang && (!scheme || !strcmp(scheme, "text")))
|
||||
if (lang && (!scheme || !strcmp(scheme, "text")) && strcmp(reason, "none"))
|
||||
{
|
||||
/*
|
||||
* Try to localize a standard printer-state-reason keyword...
|
||||
|
||||
+15
-1
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Option marking routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -253,6 +253,7 @@ cupsMarkOptions(
|
||||
*/
|
||||
|
||||
for (i = num_options, optptr = options; i > 0; i --, optptr ++)
|
||||
{
|
||||
if (!_cups_strcasecmp(optptr->name, "media") ||
|
||||
!_cups_strcasecmp(optptr->name, "output-bin") ||
|
||||
!_cups_strcasecmp(optptr->name, "output-mode") ||
|
||||
@@ -341,6 +342,19 @@ cupsMarkOptions(
|
||||
ppd_mark_option(ppd, "MirrorPrint", optptr->value);
|
||||
else
|
||||
ppd_mark_option(ppd, optptr->name, optptr->value);
|
||||
}
|
||||
|
||||
if (print_quality)
|
||||
{
|
||||
int pq = atoi(print_quality); /* print-quaity value */
|
||||
|
||||
if (pq == IPP_QUALITY_DRAFT)
|
||||
ppd_mark_option(ppd, "cupsPrintQuality", "Draft");
|
||||
else if (pq == IPP_QUALITY_HIGH)
|
||||
ppd_mark_option(ppd, "cupsPrintQuality", "High");
|
||||
else
|
||||
ppd_mark_option(ppd, "cupsPrintQuality", "Normal");
|
||||
}
|
||||
|
||||
ppd_debug_marked(ppd, "After...");
|
||||
|
||||
|
||||
+28
-99
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* PPD utilities for CUPS.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright © 2007-2018 by Apple Inc.
|
||||
* Copyright © 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -216,6 +216,27 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL
|
||||
const char *tmpdir; /* TMPDIR environment variable */
|
||||
struct timeval curtime; /* Current time */
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* On macOS and iOS, the TMPDIR environment variable is not always the
|
||||
* best location to place temporary files due to sandboxing. Instead,
|
||||
* the confstr function should be called to get the proper per-user,
|
||||
* per-process TMPDIR value.
|
||||
*/
|
||||
|
||||
char tmppath[1024]; /* Temporary directory */
|
||||
|
||||
if ((tmpdir = getenv("TMPDIR")) != NULL && access(tmpdir, W_OK))
|
||||
tmpdir = NULL;
|
||||
|
||||
if (!tmpdir)
|
||||
{
|
||||
if (confstr(_CS_DARWIN_USER_TEMP_DIR, tmppath, sizeof(tmppath)))
|
||||
tmpdir = tmppath;
|
||||
else
|
||||
tmpdir = "/private/tmp"; /* This should never happen */
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* Previously we put root temporary files in the default CUPS temporary
|
||||
* directory under /var/spool/cups. However, since the scheduler cleans
|
||||
@@ -224,11 +245,8 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL
|
||||
*/
|
||||
|
||||
if ((tmpdir = getenv("TMPDIR")) == NULL)
|
||||
# ifdef __APPLE__
|
||||
tmpdir = "/private/tmp"; /* /tmp is a symlink to /private/tmp */
|
||||
# else
|
||||
tmpdir = "/tmp";
|
||||
# endif /* __APPLE__ */
|
||||
tmpdir = "/tmp";
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
/*
|
||||
* Make the temporary name using the specified directory...
|
||||
@@ -511,23 +529,16 @@ cups_get_printer_uri(
|
||||
int depth) /* I - Depth of query */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int http_port; /* Port number */
|
||||
http_t *http2; /* Alternate HTTP connection */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
char uri[HTTP_MAX_URI], /* printer-uri attribute */
|
||||
scheme[HTTP_MAX_URI], /* Scheme name */
|
||||
username[HTTP_MAX_URI], /* Username:password */
|
||||
classname[255], /* Temporary class name */
|
||||
http_hostname[HTTP_MAX_HOST];
|
||||
/* Hostname associated with connection */
|
||||
username[HTTP_MAX_URI]; /* Username:password */
|
||||
static const char * const requested_attrs[] =
|
||||
{ /* Requested attributes */
|
||||
"device-uri",
|
||||
"member-uris",
|
||||
"printer-uri-supported",
|
||||
"printer-type"
|
||||
"printer-uri-supported"
|
||||
};
|
||||
|
||||
|
||||
@@ -549,15 +560,6 @@ cups_get_printer_uri(
|
||||
|
||||
DEBUG_printf(("5cups_get_printer_uri: printer-uri=\"%s\"", uri));
|
||||
|
||||
/*
|
||||
* Get the hostname and port number we are connected to...
|
||||
*/
|
||||
|
||||
httpGetHostname(http, http_hostname, sizeof(http_hostname));
|
||||
http_port = httpAddrPort(http->hostaddr);
|
||||
|
||||
DEBUG_printf(("5cups_get_printer_uri: http_hostname=\"%s\"", http_hostname));
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
|
||||
* attributes:
|
||||
@@ -582,31 +584,7 @@ cups_get_printer_uri(
|
||||
|
||||
if ((response = cupsDoRequest(http, request, resource)) != NULL)
|
||||
{
|
||||
const char *device_uri = NULL; /* device-uri value */
|
||||
|
||||
if ((attr = ippFindAttribute(response, "device-uri", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
device_uri = attr->values[0].string.text;
|
||||
DEBUG_printf(("5cups_get_printer_uri: device-uri=\"%s\"", device_uri));
|
||||
}
|
||||
|
||||
if (device_uri &&
|
||||
(((!strncmp(device_uri, "ipp://", 6) || !strncmp(device_uri, "ipps://", 7)) &&
|
||||
(strstr(device_uri, "/printers/") != NULL || strstr(device_uri, "/classes/") != NULL)) ||
|
||||
((strstr(device_uri, "._ipp.") != NULL || strstr(device_uri, "._ipps.") != NULL) &&
|
||||
!strcmp(device_uri + strlen(device_uri) - 5, "/cups"))))
|
||||
{
|
||||
/*
|
||||
* Statically-configured shared printer.
|
||||
*/
|
||||
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, _httpResolveURI(device_uri, uri, sizeof(uri), _HTTP_RESOLVE_DEFAULT, NULL, NULL), scheme, sizeof(scheme), username, sizeof(username), host, hostsize, port, resource, resourcesize);
|
||||
ippDelete(response);
|
||||
|
||||
DEBUG_printf(("5cups_get_printer_uri: Resolved to host=\"%s\", port=%d, resource=\"%s\"", host, *port, resource));
|
||||
return (1);
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL)
|
||||
if ((attr = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Get the first actual printer name in the class...
|
||||
@@ -631,55 +609,6 @@ cups_get_printer_uri(
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* No printers in this class - try recursively looking for a printer,
|
||||
* but not more than 3 levels deep...
|
||||
*/
|
||||
|
||||
if (depth < 3)
|
||||
{
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
{
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[i].string.text,
|
||||
scheme, sizeof(scheme), username, sizeof(username),
|
||||
host, hostsize, port, resource, resourcesize);
|
||||
if (!strncmp(resource, "/classes/", 9))
|
||||
{
|
||||
/*
|
||||
* Found a class! Connect to the right server...
|
||||
*/
|
||||
|
||||
if (!_cups_strcasecmp(http_hostname, host) && *port == http_port)
|
||||
http2 = http;
|
||||
else if ((http2 = httpConnect2(host, *port, NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL)) == NULL)
|
||||
{
|
||||
DEBUG_puts("8cups_get_printer_uri: Unable to connect to server");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up printers on that server...
|
||||
*/
|
||||
|
||||
strlcpy(classname, resource + 9, sizeof(classname));
|
||||
|
||||
cups_get_printer_uri(http2, classname, host, hostsize, port,
|
||||
resource, resourcesize, depth + 1);
|
||||
|
||||
/*
|
||||
* Close the connection as needed...
|
||||
*/
|
||||
|
||||
if (http2 != http)
|
||||
httpClose(http2);
|
||||
|
||||
if (*host)
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
|
||||
@@ -189,6 +189,7 @@ static pwg_media_t const cups_pwg_media[] =
|
||||
_PWG_MEDIA_MM("jis_b1_728x1030mm", "jis-b1", "B1", 728, 1030),
|
||||
_PWG_MEDIA_MM("jis_b0_1030x1456mm", "jis-b0", "B0", 1030, 1456),
|
||||
_PWG_MEDIA_MM("jis_exec_216x330mm", NULL, "216x330mm", 216, 330),
|
||||
_PWG_MEDIA_MM("jpn_kaku1_270x382mm", NULL, "EnvKaku1", 270, 382),
|
||||
_PWG_MEDIA_MM("jpn_kaku2_240x332mm", NULL, "EnvKaku2", 240, 332),
|
||||
_PWG_MEDIA_MM("jpn_kaku3_216x277mm", NULL, "EnvKaku3", 216, 277),
|
||||
_PWG_MEDIA_MM("jpn_kaku4_197x267mm", NULL, "EnvKaku4", 197, 267),
|
||||
|
||||
+17
-17
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* IPP utilities for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -131,13 +131,12 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Get the default connection as needed...
|
||||
*/
|
||||
|
||||
if (!http)
|
||||
if ((http = _cupsConnect()) == NULL)
|
||||
{
|
||||
ippDelete(request);
|
||||
if (!http && (http = _cupsConnect()) == NULL)
|
||||
{
|
||||
ippDelete(request);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have a file to send...
|
||||
@@ -151,9 +150,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Can't get file information!
|
||||
*/
|
||||
|
||||
_cupsSetError(errno == EBADF ? IPP_STATUS_ERROR_NOT_FOUND : IPP_STATUS_ERROR_NOT_AUTHORIZED,
|
||||
NULL, 0);
|
||||
|
||||
_cupsSetError(errno == EBADF ? IPP_STATUS_ERROR_NOT_FOUND : IPP_STATUS_ERROR_NOT_AUTHORIZED, NULL, 0);
|
||||
ippDelete(request);
|
||||
|
||||
return (NULL);
|
||||
@@ -169,9 +166,8 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Can't send a directory...
|
||||
*/
|
||||
|
||||
ippDelete(request);
|
||||
|
||||
_cupsSetError(IPP_STATUS_ERROR_NOT_POSSIBLE, strerror(EISDIR), 0);
|
||||
ippDelete(request);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
@@ -186,8 +182,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
else
|
||||
length = ippLength(request);
|
||||
|
||||
DEBUG_printf(("2cupsDoIORequest: Request length=%ld, total length=%ld",
|
||||
(long)ippLength(request), (long)length));
|
||||
DEBUG_printf(("2cupsDoIORequest: Request length=%ld, total length=%ld", (long)ippLength(request), (long)length));
|
||||
|
||||
/*
|
||||
* Clear any "Local" authentication data since it is probably stale...
|
||||
@@ -596,6 +591,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
int got_status; /* Did we get the status? */
|
||||
ipp_state_t state; /* State of IPP processing */
|
||||
http_status_t expect; /* Expect: header to use */
|
||||
char date[256]; /* Date: header value */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", length=" CUPS_LLFMT ")", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource, CUPS_LLCAST length));
|
||||
@@ -615,9 +611,8 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Get the default connection as needed...
|
||||
*/
|
||||
|
||||
if (!http)
|
||||
if ((http = _cupsConnect()) == NULL)
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
if (!http && (http = _cupsConnect()) == NULL)
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
|
||||
/*
|
||||
* If the prior request was not flushed out, do so now...
|
||||
@@ -685,6 +680,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
httpClearFields(http);
|
||||
httpSetExpect(http, expect);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
|
||||
httpSetField(http, HTTP_FIELD_DATE, httpGetDateString2(time(NULL), date, (int)sizeof(date)));
|
||||
httpSetLength(http, length);
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
@@ -996,7 +992,11 @@ _cupsConnect(void)
|
||||
*/
|
||||
|
||||
if (strcmp(cg->http->hostname, cg->server) ||
|
||||
#ifdef AF_LOCAL
|
||||
(httpAddrFamily(cg->http->hostaddr) != AF_LOCAL && cg->ipp_port != httpAddrPort(cg->http->hostaddr)) ||
|
||||
#else
|
||||
cg->ipp_port != httpAddrPort(cg->http->hostaddr) ||
|
||||
#endif /* AF_LOCAL */
|
||||
(cg->http->encryption != cg->encryption &&
|
||||
cg->http->encryption == HTTP_ENCRYPTION_NEVER))
|
||||
{
|
||||
|
||||
+25
-7
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Temp file utilities for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright © 2007-2018 by Apple Inc.
|
||||
* Copyright © 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -42,8 +42,10 @@ cupsTempFd(char *filename, /* I - Pointer to buffer */
|
||||
int fd; /* File descriptor for temp file */
|
||||
int tries; /* Number of tries */
|
||||
const char *tmpdir; /* TMPDIR environment var */
|
||||
#if defined(__APPLE__) || defined(WIN32)
|
||||
char tmppath[1024]; /* Temporary directory */
|
||||
#endif /* __APPLE__ || WIN32 */
|
||||
#ifdef WIN32
|
||||
char tmppath[1024]; /* Windows temporary directory */
|
||||
DWORD curtime; /* Current time */
|
||||
#else
|
||||
struct timeval curtime; /* Current time */
|
||||
@@ -60,6 +62,26 @@ cupsTempFd(char *filename, /* I - Pointer to buffer */
|
||||
GetTempPath(sizeof(tmppath), tmppath);
|
||||
tmpdir = tmppath;
|
||||
}
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
/*
|
||||
* On macOS and iOS, the TMPDIR environment variable is not always the best
|
||||
* location to place temporary files due to sandboxing. Instead, the confstr
|
||||
* function should be called to get the proper per-user, per-process TMPDIR
|
||||
* value.
|
||||
*/
|
||||
|
||||
if ((tmpdir = getenv("TMPDIR")) != NULL && access(tmpdir, W_OK))
|
||||
tmpdir = NULL;
|
||||
|
||||
if (!tmpdir)
|
||||
{
|
||||
if (confstr(_CS_DARWIN_USER_TEMP_DIR, tmppath, sizeof(tmppath)))
|
||||
tmpdir = tmppath;
|
||||
else
|
||||
tmpdir = "/private/tmp"; /* This should never happen */
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
* Previously we put root temporary files in the default CUPS temporary
|
||||
@@ -69,11 +91,7 @@ cupsTempFd(char *filename, /* I - Pointer to buffer */
|
||||
*/
|
||||
|
||||
if ((tmpdir = getenv("TMPDIR")) == NULL)
|
||||
# if defined(__APPLE__) && !TARGET_OS_IOS
|
||||
tmpdir = "/private/tmp"; /* /tmp is a symlink to /private/tmp */
|
||||
# else
|
||||
tmpdir = "/tmp";
|
||||
# endif /* __APPLE__ && !TARGET_OS_IOS */
|
||||
#endif /* WIN32 */
|
||||
|
||||
/*
|
||||
|
||||
+31
-16
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* CUPS API test program for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -47,7 +47,9 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
cups_dest_t *dests, /* Destinations */
|
||||
*dest, /* Current destination */
|
||||
*named_dest; /* Current named destination */
|
||||
const char *ppdfile; /* PPD file */
|
||||
const char *dest_name, /* Destination name */
|
||||
*dval, /* Destination value */
|
||||
*ppdfile; /* PPD file */
|
||||
ppd_file_t *ppd; /* PPD file data */
|
||||
int num_jobs; /* Number of jobs for queue */
|
||||
cups_job_t *jobs; /* Jobs for queue */
|
||||
@@ -360,11 +362,19 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* cupsGetDest(printer)
|
||||
*/
|
||||
|
||||
printf("cupsGetDest(\"%s\"): ", dests[num_dests / 2].name);
|
||||
for (i = 0, dest_name = NULL; i < num_dests; i ++)
|
||||
{
|
||||
if ((dval = cupsGetOption("printer-is-temporary", dests[i].num_options, dest[i].options)) != NULL && !strcmp(dval, "false"))
|
||||
{
|
||||
dest_name = dests[i].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printf("cupsGetDest(\"%s\"): ", dest_name ? dest_name : "(null)");
|
||||
fflush(stdout);
|
||||
|
||||
if ((dest = cupsGetDest(dests[num_dests / 2].name, NULL, num_dests,
|
||||
dests)) == NULL)
|
||||
if ((dest = cupsGetDest(dest_name, NULL, num_dests, dests)) == NULL)
|
||||
{
|
||||
puts("FAIL");
|
||||
return (1);
|
||||
@@ -380,8 +390,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
dest->instance ? dest->instance : "(null)");
|
||||
fflush(stdout);
|
||||
|
||||
if ((named_dest = cupsGetNamedDest(NULL, dest->name,
|
||||
dest->instance)) == NULL ||
|
||||
if ((named_dest = cupsGetNamedDest(NULL, dest->name, dest->instance)) == NULL ||
|
||||
!dests_equal(dest, named_dest))
|
||||
{
|
||||
if (named_dest)
|
||||
@@ -408,7 +417,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
fputs("cupsPrintFile: ", stdout);
|
||||
fflush(stdout);
|
||||
|
||||
if (cupsPrintFile(dest->name, "../data/testprint", "Test Page",
|
||||
if (cupsPrintFile(dest->name, "../test/testfile.pdf", "Test Page",
|
||||
dest->num_options, dest->options) <= 0)
|
||||
{
|
||||
printf("FAIL (%s)\n", cupsLastErrorString());
|
||||
@@ -421,7 +430,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* cupsGetPPD(printer)
|
||||
*/
|
||||
|
||||
fputs("cupsGetPPD(): ", stdout);
|
||||
fputs("cupsGetPPD: ", stdout);
|
||||
fflush(stdout);
|
||||
|
||||
if ((ppdfile = cupsGetPPD(dest->name)) == NULL)
|
||||
@@ -436,7 +445,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* ppdOpenFile()
|
||||
*/
|
||||
|
||||
fputs("ppdOpenFile(): ", stdout);
|
||||
fputs("ppdOpenFile: ", stdout);
|
||||
fflush(stdout);
|
||||
|
||||
if ((ppd = ppdOpenFile(ppdfile)) == NULL)
|
||||
@@ -550,33 +559,39 @@ show_diffs(cups_dest_t *a, /* I - First destination */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_option_t *aoption; /* Current option */
|
||||
cups_option_t *boption; /* Current option */
|
||||
const char *bval; /* Option value */
|
||||
|
||||
|
||||
if (!a || !b)
|
||||
return;
|
||||
|
||||
puts(" Item cupsGetDest cupsGetNamedDest");
|
||||
puts(" -------------------- -------------------- --------------------");
|
||||
puts(" Item cupsGetDest cupsGetNamedDest");
|
||||
puts(" -------------------- ------------------------ ------------------------");
|
||||
|
||||
if (_cups_strcasecmp(a->name, b->name))
|
||||
printf(" name %-20.20s %-20.20s\n", a->name, b->name);
|
||||
printf(" name %-24.24s %-24.24s\n", a->name, b->name);
|
||||
|
||||
if ((a->instance && !b->instance) ||
|
||||
(!a->instance && b->instance) ||
|
||||
(a->instance && _cups_strcasecmp(a->instance, b->instance)))
|
||||
printf(" instance %-20.20s %-20.20s\n",
|
||||
printf(" instance %-24.24s %-24.24s\n",
|
||||
a->instance ? a->instance : "(null)",
|
||||
b->instance ? b->instance : "(null)");
|
||||
|
||||
if (a->num_options != b->num_options)
|
||||
printf(" num_options %-20d %-20d\n", a->num_options,
|
||||
printf(" num_options %-24d %-24d\n", a->num_options,
|
||||
b->num_options);
|
||||
|
||||
for (i = a->num_options, aoption = a->options; i > 0; i --, aoption ++)
|
||||
if ((bval = cupsGetOption(aoption->name, b->num_options,
|
||||
b->options)) == NULL ||
|
||||
strcmp(aoption->value, bval))
|
||||
printf(" %-20.20s %-20.20s %-20.20s\n", aoption->name,
|
||||
printf(" %-20.20s %-24.24s %-24.24s\n", aoption->name,
|
||||
aoption->value, bval ? bval : "(null)");
|
||||
|
||||
for (i = b->num_options, boption = b->options; i > 0; i --, boption ++)
|
||||
if (!cupsGetOption(boption->name, a->num_options, a->options))
|
||||
printf(" %-20.20s %-24.24s %-24.24s\n", boption->name,
|
||||
boption->value, "(null)");
|
||||
}
|
||||
|
||||
+53
-8
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* CUPS destination API test program for CUPS.
|
||||
*
|
||||
* Copyright 2012-2016 by Apple Inc.
|
||||
* Copyright 2012-2017 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -105,6 +105,14 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
else if (!strncmp(argv[1], "ipp://", 6) || !strncmp(argv[1], "ipps://", 7))
|
||||
dest = cupsGetDestWithURI(NULL, argv[1]);
|
||||
else if (!strcmp(argv[1], "default"))
|
||||
{
|
||||
dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
|
||||
if (dest && dest->instance)
|
||||
printf("default is \"%s/%s\".\n", dest->name, dest->instance);
|
||||
else
|
||||
printf("default is \"%s\".\n", dest->name);
|
||||
}
|
||||
else
|
||||
dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, argv[1], NULL);
|
||||
|
||||
@@ -463,10 +471,37 @@ show_default(http_t *http, /* I - Connection to destination */
|
||||
cups_dinfo_t *dinfo, /* I - Destination information */
|
||||
const char *option) /* I - Option */
|
||||
{
|
||||
(void)http;
|
||||
(void)dest;
|
||||
(void)dinfo;
|
||||
(void)option;
|
||||
if (!strcmp(option, "media"))
|
||||
{
|
||||
/*
|
||||
* Show default media option...
|
||||
*/
|
||||
|
||||
cups_size_t size; /* Media size information */
|
||||
|
||||
if (cupsGetDestMediaDefault(http, dest, dinfo, CUPS_MEDIA_FLAGS_DEFAULT, &size))
|
||||
printf("%s (%.2fx%.2fmm, margins=[%.2f %.2f %.2f %.2f])\n", size.media, size.width * 0.01, size.length * 0.01, size.left * 0.01, size.bottom * 0.01, size.right * 0.01, size.top * 0.01);
|
||||
else
|
||||
puts("FAILED");
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show default other option...
|
||||
*/
|
||||
|
||||
ipp_attribute_t *defattr; /* Default attribute */
|
||||
|
||||
if ((defattr = cupsFindDestDefault(http, dest, dinfo, option)) != NULL)
|
||||
{
|
||||
char value[1024]; /* Value of default attribute */
|
||||
|
||||
ippAttributeString(defattr, value, sizeof(value));
|
||||
puts(value);
|
||||
}
|
||||
else
|
||||
puts("FAILED");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -594,7 +629,7 @@ show_supported(http_t *http, /* I - Connection to destination */
|
||||
}
|
||||
else if (!value)
|
||||
{
|
||||
printf("%s (%s)\n", option, cupsCheckDestSupported(http, dest, dinfo, option, NULL) ? "supported" : "not-supported");
|
||||
printf("%s (%s - %s)\n", option, cupsLocalizeDestOption(http, dest, dinfo, option), cupsCheckDestSupported(http, dest, dinfo, option, NULL) ? "supported" : "not-supported");
|
||||
|
||||
if ((attr = cupsFindDestSupported(http, dest, dinfo, option)) != NULL)
|
||||
{
|
||||
@@ -609,7 +644,13 @@ show_supported(http_t *http, /* I - Connection to destination */
|
||||
|
||||
case IPP_TAG_ENUM :
|
||||
for (i = 0; i < count; i ++)
|
||||
printf(" %s\n", ippEnumString(option, ippGetInteger(attr, i)));
|
||||
{
|
||||
int val = ippGetInteger(attr, i);
|
||||
char valstr[256];
|
||||
|
||||
snprintf(valstr, sizeof(valstr), "%d", val);
|
||||
printf(" %s (%s)\n", ippEnumString(option, ippGetInteger(attr, i)), cupsLocalizeDestValue(http, dest, dinfo, option, valstr));
|
||||
}
|
||||
break;
|
||||
|
||||
case IPP_TAG_RANGE :
|
||||
@@ -635,11 +676,15 @@ show_supported(http_t *http, /* I - Connection to destination */
|
||||
}
|
||||
break;
|
||||
|
||||
case IPP_TAG_KEYWORD :
|
||||
for (i = 0; i < count; i ++)
|
||||
printf(" %s (%s)\n", ippGetString(attr, i, NULL), cupsLocalizeDestValue(http, dest, dinfo, option, ippGetString(attr, i, NULL)));
|
||||
break;
|
||||
|
||||
case IPP_TAG_TEXTLANG :
|
||||
case IPP_TAG_NAMELANG :
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_URI :
|
||||
case IPP_TAG_URISCHEME :
|
||||
case IPP_TAG_CHARSET :
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* CUPS cupsGetDests API test program for CUPS.
|
||||
*
|
||||
* Copyright 2017 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cups.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Loop calling cupsGetDests.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(void)
|
||||
{
|
||||
int num_dests; /* Number of destinations */
|
||||
cups_dest_t *dests; /* Destinations */
|
||||
struct timeval start, end; /* Start and stop time */
|
||||
double secs; /* Total seconds to run cupsGetDests */
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
gettimeofday(&start, NULL);
|
||||
num_dests = cupsGetDests(&dests);
|
||||
gettimeofday(&end, NULL);
|
||||
secs = end.tv_sec - start.tv_sec + 0.000001 * (end.tv_usec - start.tv_usec);
|
||||
|
||||
printf("Found %d printers in %.3f seconds...\n", num_dests, secs);
|
||||
|
||||
cupsFreeDests(num_dests, dests);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
+5
-155
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* IPP test program for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -810,88 +810,9 @@ void
|
||||
print_attributes(ipp_t *ipp, /* I - IPP request */
|
||||
int indent) /* I - Indentation */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ipp_tag_t group; /* Current group */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
_ipp_value_t *val; /* Current value */
|
||||
static const char * const tags[] = /* Value/group tag strings */
|
||||
{
|
||||
"reserved-00",
|
||||
"operation-attributes-tag",
|
||||
"job-attributes-tag",
|
||||
"end-of-attributes-tag",
|
||||
"printer-attributes-tag",
|
||||
"unsupported-attributes-tag",
|
||||
"subscription-attributes-tag",
|
||||
"event-attributes-tag",
|
||||
"reserved-08",
|
||||
"reserved-09",
|
||||
"reserved-0A",
|
||||
"reserved-0B",
|
||||
"reserved-0C",
|
||||
"reserved-0D",
|
||||
"reserved-0E",
|
||||
"reserved-0F",
|
||||
"unsupported",
|
||||
"default",
|
||||
"unknown",
|
||||
"no-value",
|
||||
"reserved-14",
|
||||
"not-settable",
|
||||
"delete-attr",
|
||||
"admin-define",
|
||||
"reserved-18",
|
||||
"reserved-19",
|
||||
"reserved-1A",
|
||||
"reserved-1B",
|
||||
"reserved-1C",
|
||||
"reserved-1D",
|
||||
"reserved-1E",
|
||||
"reserved-1F",
|
||||
"reserved-20",
|
||||
"integer",
|
||||
"boolean",
|
||||
"enum",
|
||||
"reserved-24",
|
||||
"reserved-25",
|
||||
"reserved-26",
|
||||
"reserved-27",
|
||||
"reserved-28",
|
||||
"reserved-29",
|
||||
"reserved-2a",
|
||||
"reserved-2b",
|
||||
"reserved-2c",
|
||||
"reserved-2d",
|
||||
"reserved-2e",
|
||||
"reserved-2f",
|
||||
"octetString",
|
||||
"dateTime",
|
||||
"resolution",
|
||||
"rangeOfInteger",
|
||||
"begCollection",
|
||||
"textWithLanguage",
|
||||
"nameWithLanguage",
|
||||
"endCollection",
|
||||
"reserved-38",
|
||||
"reserved-39",
|
||||
"reserved-3a",
|
||||
"reserved-3b",
|
||||
"reserved-3c",
|
||||
"reserved-3d",
|
||||
"reserved-3e",
|
||||
"reserved-3f",
|
||||
"reserved-40",
|
||||
"textWithoutLanguage",
|
||||
"nameWithoutLanguage",
|
||||
"reserved-43",
|
||||
"keyword",
|
||||
"uri",
|
||||
"uriScheme",
|
||||
"charset",
|
||||
"naturalLanguage",
|
||||
"mimeMediaType",
|
||||
"memberName"
|
||||
};
|
||||
char buffer[2048]; /* Value string */
|
||||
|
||||
|
||||
for (group = IPP_TAG_ZERO, attr = ipp->attrs; attr; attr = attr->next)
|
||||
@@ -907,83 +828,12 @@ print_attributes(ipp_t *ipp, /* I - IPP request */
|
||||
{
|
||||
group = attr->group_tag;
|
||||
|
||||
printf("\n%*s%s:\n\n", indent - 4, "", tags[group]);
|
||||
printf("\n%*s%s:\n\n", indent - 4, "", ippTagString(group));
|
||||
}
|
||||
|
||||
printf("%*s%s (", indent, "", attr->name ? attr->name : "(null)");
|
||||
if (attr->num_values > 1)
|
||||
printf("1setOf ");
|
||||
printf("%s):", tags[attr->value_tag]);
|
||||
ippAttributeString(attr, buffer, sizeof(buffer));
|
||||
|
||||
switch (attr->value_tag)
|
||||
{
|
||||
case IPP_TAG_ENUM :
|
||||
case IPP_TAG_INTEGER :
|
||||
for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
|
||||
printf(" %d", val->integer);
|
||||
putchar('\n');
|
||||
break;
|
||||
|
||||
case IPP_TAG_BOOLEAN :
|
||||
for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
|
||||
printf(" %s", val->boolean ? "true" : "false");
|
||||
putchar('\n');
|
||||
break;
|
||||
|
||||
case IPP_TAG_RANGE :
|
||||
for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
|
||||
printf(" %d-%d", val->range.lower, val->range.upper);
|
||||
putchar('\n');
|
||||
break;
|
||||
|
||||
case IPP_TAG_DATE :
|
||||
{
|
||||
char vstring[256]; /* Formatted time */
|
||||
|
||||
for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
|
||||
printf(" (%s)", _cupsStrDate(vstring, sizeof(vstring), ippDateToTime(val->date)));
|
||||
}
|
||||
putchar('\n');
|
||||
break;
|
||||
|
||||
case IPP_TAG_RESOLUTION :
|
||||
for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
|
||||
printf(" %dx%d%s", val->resolution.xres, val->resolution.yres,
|
||||
val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
|
||||
putchar('\n');
|
||||
break;
|
||||
|
||||
case IPP_TAG_STRING :
|
||||
case IPP_TAG_TEXTLANG :
|
||||
case IPP_TAG_NAMELANG :
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_URI :
|
||||
case IPP_TAG_URISCHEME :
|
||||
case IPP_TAG_CHARSET :
|
||||
case IPP_TAG_LANGUAGE :
|
||||
case IPP_TAG_MIMETYPE :
|
||||
for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
|
||||
printf(" \"%s\"", val->string.text);
|
||||
putchar('\n');
|
||||
break;
|
||||
|
||||
case IPP_TAG_BEGIN_COLLECTION :
|
||||
putchar('\n');
|
||||
|
||||
for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
|
||||
{
|
||||
if (i)
|
||||
putchar('\n');
|
||||
print_attributes(val->collection, indent + 4);
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
printf("UNKNOWN (%d values)\n", attr->num_values);
|
||||
break;
|
||||
}
|
||||
printf("%*s%s (%s%s): %s\n", indent, "", attr->name ? attr->name : "(null)", attr->num_values > 1 ? "1setOf " : "", ippTagString(attr->value_tag), buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+146
-3
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Localization test program for CUPS.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -19,6 +19,16 @@
|
||||
|
||||
#include "cups-private.h"
|
||||
#include "ppd-private.h"
|
||||
#ifdef __APPLE__
|
||||
# include <CoreFoundation/CoreFoundation.h>
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int test_string(cups_lang_t *language, const char *msgid);
|
||||
|
||||
|
||||
/*
|
||||
@@ -71,8 +81,9 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
printf("Language = \"%s\"\n", language->language);
|
||||
printf("Encoding = \"%s\"\n", _cupsEncodingName(language->encoding));
|
||||
printf("No = \"%s\"\n", _cupsLangString(language, "No"));
|
||||
printf("Yes = \"%s\"\n", _cupsLangString(language, "Yes"));
|
||||
|
||||
errors += test_string(language, "No");
|
||||
errors += test_string(language, "Yes");
|
||||
|
||||
if (language != language2)
|
||||
{
|
||||
@@ -138,9 +149,141 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
}
|
||||
|
||||
printf("media-empty: %s\n", ppdLocalizeIPPReason(ppd, "media-empty", NULL, buffer, sizeof(buffer)));
|
||||
|
||||
ppdClose(ppd);
|
||||
}
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Test all possible language IDs for compatibility with _cupsAppleLocale...
|
||||
*/
|
||||
|
||||
CFIndex j, /* Looping var */
|
||||
num_locales; /* Number of locales */
|
||||
CFArrayRef locales; /* Locales */
|
||||
CFStringRef locale_id, /* Current locale ID */
|
||||
language_id; /* Current language ID */
|
||||
char locale_str[256], /* Locale ID C string */
|
||||
language_str[256], /* Language ID C string */
|
||||
*bufptr; /* Pointer to ".UTF-8" in POSIX locale */
|
||||
size_t buflen; /* Length of POSIX locale */
|
||||
# if TEST_COUNTRY_CODES
|
||||
CFIndex k, /* Looping var */
|
||||
num_country_codes; /* Number of country codes */
|
||||
CFArrayRef country_codes; /* Country codes */
|
||||
CFStringRef country_code, /* Current country code */
|
||||
temp_id; /* Temporary language ID */
|
||||
char country_str[256]; /* Country code C string */
|
||||
# endif /* TEST_COUNTRY_CODES */
|
||||
|
||||
locales = CFLocaleCopyAvailableLocaleIdentifiers();
|
||||
num_locales = CFArrayGetCount(locales);
|
||||
|
||||
# if TEST_COUNTRY_CODES
|
||||
country_codes = CFLocaleCopyISOCountryCodes();
|
||||
num_country_codes = CFArrayGetCount(country_codes);
|
||||
# endif /* TEST_COUNTRY_CODES */
|
||||
|
||||
printf("%d locales are available:\n", (int)num_locales);
|
||||
|
||||
for (j = 0; j < num_locales; j ++)
|
||||
{
|
||||
locale_id = CFArrayGetValueAtIndex(locales, j);
|
||||
language_id = CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, locale_id);
|
||||
|
||||
if (!locale_id || !CFStringGetCString(locale_id, locale_str, (CFIndex)sizeof(locale_str), kCFStringEncodingASCII))
|
||||
{
|
||||
printf("%d: FAIL (unable to get locale ID string)\n", (int)j + 1);
|
||||
errors ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!language_id || !CFStringGetCString(language_id, language_str, (CFIndex)sizeof(language_str), kCFStringEncodingASCII))
|
||||
{
|
||||
printf("%d %s: FAIL (unable to get language ID string)\n", (int)j + 1, locale_str);
|
||||
errors ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_cupsAppleLocale(language_id, buffer, sizeof(buffer)))
|
||||
{
|
||||
printf("%d %s(%s): FAIL (unable to convert language ID string to POSIX locale)\n", (int)j + 1, locale_str, language_str);
|
||||
errors ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((bufptr = strstr(buffer, ".UTF-8")) != NULL)
|
||||
buflen = (size_t)(bufptr - buffer);
|
||||
else
|
||||
buflen = strlen(buffer);
|
||||
|
||||
if ((language = cupsLangGet(buffer)) == NULL)
|
||||
{
|
||||
printf("%d %s(%s): FAIL (unable to load POSIX locale \"%s\")\n", (int)j + 1, locale_str, language_str, buffer);
|
||||
errors ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncasecmp(language->language, buffer, buflen))
|
||||
{
|
||||
printf("%d %s(%s): FAIL (unable to load POSIX locale \"%s\", got \"%s\")\n", (int)j + 1, locale_str, language_str, buffer, language->language);
|
||||
errors ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("%d %s(%s): PASS (POSIX locale is \"%s\")\n", (int)j + 1, locale_str, language_str, buffer);
|
||||
}
|
||||
|
||||
CFRelease(locales);
|
||||
|
||||
# if TEST_COUNTRY_CODES
|
||||
CFRelease(country_codes);
|
||||
# endif /* TEST_COUNTRY_CODES */
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
if (errors == 0)
|
||||
puts("ALL TESTS PASSED");
|
||||
|
||||
return (errors > 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'test_string()' - Test the localization of a string.
|
||||
*/
|
||||
|
||||
static int /* O - 1 on failure, 0 on success */
|
||||
test_string(cups_lang_t *language, /* I - Language */
|
||||
const char *msgid) /* I - Message */
|
||||
{
|
||||
const char *msgstr; /* Localized string */
|
||||
|
||||
|
||||
/*
|
||||
* Get the localized string and then see if we got what we expected.
|
||||
*
|
||||
* For the POSIX locale, the string pointers should be the same.
|
||||
* For any other locale, the string pointers should be different.
|
||||
*/
|
||||
|
||||
msgstr = _cupsLangString(language, msgid);
|
||||
if (strcmp(language->language, "C") && msgid == msgstr)
|
||||
{
|
||||
printf("%-8s = \"%s\" (FAIL - no message catalog loaded)\n", msgid, msgstr);
|
||||
return (1);
|
||||
}
|
||||
else if (!strcmp(language->language, "C") && msgid != msgstr)
|
||||
{
|
||||
printf("%-8s = \"%s\" (FAIL - POSIX locale is localized)\n", msgid, msgstr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
printf("%-8s = \"%s\" (PASS)\n", msgid, msgstr);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -876,6 +876,13 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
host[256], /* Hostname */
|
||||
resource[256]; /* Resource path */
|
||||
int port; /* Port number */
|
||||
static const char * const pattrs[] =/* Requested printer attributes */
|
||||
{
|
||||
"job-template",
|
||||
"printer-defaults",
|
||||
"printer-description",
|
||||
"media-col-database"
|
||||
};
|
||||
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, argv[1], scheme, sizeof(scheme), userpass, sizeof(userpass), host, sizeof(host), &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK)
|
||||
{
|
||||
@@ -892,6 +899,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, argv[1]);
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]), NULL, pattrs);
|
||||
response = cupsDoRequest(http, request, resource);
|
||||
|
||||
if (_ppdCreateFromIPP(buffer, sizeof(buffer), response))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Private threading definitions for CUPS.
|
||||
*
|
||||
* Copyright 2009-2016 by Apple Inc.
|
||||
* Copyright 2009-2017 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -99,6 +99,7 @@ extern void _cupsRWLockWrite(_cups_rwlock_t *rwlock);
|
||||
extern void _cupsRWUnlock(_cups_rwlock_t *rwlock);
|
||||
extern void _cupsThreadCancel(_cups_thread_t thread);
|
||||
extern _cups_thread_t _cupsThreadCreate(_cups_thread_func_t func, void *arg);
|
||||
extern void _cupsThreadDetach(_cups_thread_t thread);
|
||||
extern void *_cupsThreadWait(_cups_thread_t thread);
|
||||
|
||||
# ifdef __cplusplus
|
||||
|
||||
+46
-5
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Threading primitives for CUPS.
|
||||
*
|
||||
* Copyright 2009-2016 by Apple Inc.
|
||||
* Copyright © 2009-2018 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -56,8 +56,16 @@ _cupsCondWait(_cups_cond_t *cond, /* I - Condition */
|
||||
{
|
||||
struct timespec abstime; /* Timeout */
|
||||
|
||||
abstime.tv_sec = (long)timeout;
|
||||
abstime.tv_nsec = (long)(1000000000 * (timeout - (long)timeout));
|
||||
clock_gettime(CLOCK_REALTIME, &abstime);
|
||||
|
||||
abstime.tv_sec += (long)timeout;
|
||||
abstime.tv_nsec += (long)(1000000000 * (timeout - (long)timeout));
|
||||
|
||||
while (abstime.tv_nsec >= 1000000000)
|
||||
{
|
||||
abstime.tv_nsec -= 1000000000;
|
||||
abstime.tv_sec ++;
|
||||
};
|
||||
|
||||
pthread_cond_timedwait(cond, mutex, &abstime);
|
||||
}
|
||||
@@ -172,6 +180,17 @@ _cupsThreadCreate(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsThreadDetach()' - Tell the OS that the thread is running independently.
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsThreadDetach(_cups_thread_t thread)/* I - Thread ID */
|
||||
{
|
||||
pthread_detach(thread);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsThreadWait()' - Wait for a thread to exit.
|
||||
*/
|
||||
@@ -343,6 +362,18 @@ _cupsThreadCreate(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsThreadDetach()' - Tell the OS that the thread is running independently.
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsThreadDetach(_cups_thread_t thread)/* I - Thread ID */
|
||||
{
|
||||
// TODO: Implement me
|
||||
(void)thread;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsThreadWait()' - Wait for a thread to exit.
|
||||
*/
|
||||
@@ -490,8 +521,7 @@ _cupsThreadCreate(
|
||||
_cups_thread_func_t func, /* I - Entry point */
|
||||
void *arg) /* I - Entry point context */
|
||||
{
|
||||
fputs("DEBUG: CUPS was compiled without threading support, no thread "
|
||||
"created.\n", stderr);
|
||||
fputs("DEBUG: CUPS was compiled without threading support, no thread created.\n", stderr);
|
||||
|
||||
(void)func;
|
||||
(void)arg;
|
||||
@@ -500,6 +530,17 @@ _cupsThreadCreate(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsThreadDetach()' - Tell the OS that the thread is running independently.
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsThreadDetach(_cups_thread_t thread)/* I - Thread ID */
|
||||
{
|
||||
(void)thread;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsThreadWait()' - Wait for a thread to exit.
|
||||
*/
|
||||
|
||||
+64
-21
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* TLS support code for CUPS on macOS.
|
||||
*
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* Copyright © 2007-2018 by Apple Inc.
|
||||
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -53,7 +53,9 @@ static char *tls_keypath = NULL;
|
||||
/* Server cert keychain path */
|
||||
static _cups_mutex_t tls_mutex = _CUPS_MUTEX_INITIALIZER;
|
||||
/* Mutex for keychain/certs */
|
||||
static int tls_options = -1;/* Options for TLS connections */
|
||||
static int tls_options = -1,/* Options for TLS connections */
|
||||
tls_min_version = _HTTP_TLS_1_0,
|
||||
tls_max_version = _HTTP_TLS_MAX;
|
||||
|
||||
|
||||
/*
|
||||
@@ -807,7 +809,6 @@ httpCredentialsString(
|
||||
CFStringRef cf_name; /* CF common name string */
|
||||
char name[256]; /* Common name associated with cert */
|
||||
time_t expiration; /* Expiration date of cert */
|
||||
_cups_md5_state_t md5_state; /* MD5 state */
|
||||
unsigned char md5_digest[16]; /* MD5 result */
|
||||
|
||||
if ((cf_name = SecCertificateCopySubjectSummary(secCert)) != NULL)
|
||||
@@ -820,9 +821,7 @@ httpCredentialsString(
|
||||
|
||||
expiration = (time_t)(SecCertificateNotValidAfter(secCert) + kCFAbsoluteTimeIntervalSince1970);
|
||||
|
||||
_cupsMD5Init(&md5_state);
|
||||
_cupsMD5Append(&md5_state, first->data, (int)first->datalen);
|
||||
_cupsMD5Finish(&md5_state, md5_digest);
|
||||
cupsHashData("md5", first->data, first->datalen, md5_digest, sizeof(md5_digest));
|
||||
|
||||
snprintf(buffer, bufsize, "%s / %s / %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", name, httpGetDateString(expiration), md5_digest[0], md5_digest[1], md5_digest[2], md5_digest[3], md5_digest[4], md5_digest[5], md5_digest[6], md5_digest[7], md5_digest[8], md5_digest[9], md5_digest[10], md5_digest[11], md5_digest[12], md5_digest[13], md5_digest[14], md5_digest[15]);
|
||||
|
||||
@@ -1139,9 +1138,16 @@ _httpTLSRead(http_t *http, /* I - HTTP connection */
|
||||
*/
|
||||
|
||||
void
|
||||
_httpTLSSetOptions(int options) /* I - Options */
|
||||
_httpTLSSetOptions(int options, /* I - Options */
|
||||
int min_version, /* I - Minimum TLS version */
|
||||
int max_version) /* I - Maximum TLS version */
|
||||
{
|
||||
tls_options = options;
|
||||
if (!(options & _HTTP_TLS_SET_DEFAULT) || tls_options < 0)
|
||||
{
|
||||
tls_options = options;
|
||||
tls_min_version = min_version;
|
||||
tls_max_version = max_version;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1173,7 +1179,7 @@ _httpTLSStart(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
DEBUG_puts("4_httpTLSStart: Setting defaults.");
|
||||
_cupsSetDefaults();
|
||||
DEBUG_printf(("4_httpTLSStart: tls_options=%x", tls_options));
|
||||
DEBUG_printf(("4_httpTLSStart: tls_options=%x, tls_min_version=%d, tls_max_version=%d", tls_options, tls_min_version, tls_max_version));
|
||||
}
|
||||
|
||||
#ifdef HAVE_SECKEYCHAINOPEN
|
||||
@@ -1216,17 +1222,24 @@ _httpTLSStart(http_t *http) /* I - HTTP connection */
|
||||
|
||||
if (!error)
|
||||
{
|
||||
SSLProtocol minProtocol;
|
||||
static const SSLProtocol protocols[] = /* Min/max protocol versions */
|
||||
{
|
||||
kSSLProtocol3,
|
||||
kTLSProtocol1,
|
||||
kTLSProtocol11,
|
||||
kTLSProtocol12,
|
||||
kTLSProtocol12, /* TODO: update to 1.3 when 1.3 is supported */
|
||||
kTLSProtocol12 /* TODO: update to 1.3 when 1.3 is supported */
|
||||
};
|
||||
|
||||
if (tls_options & _HTTP_TLS_DENY_TLS10)
|
||||
minProtocol = kTLSProtocol11;
|
||||
else if (tls_options & _HTTP_TLS_ALLOW_SSL3)
|
||||
minProtocol = kSSLProtocol3;
|
||||
else
|
||||
minProtocol = kTLSProtocol1;
|
||||
error = SSLSetProtocolVersionMin(http->tls, protocols[tls_min_version]);
|
||||
DEBUG_printf(("4_httpTLSStart: SSLSetProtocolVersionMin(%d), error=%d", protocols[tls_min_version], (int)error));
|
||||
|
||||
error = SSLSetProtocolVersionMin(http->tls, minProtocol);
|
||||
DEBUG_printf(("4_httpTLSStart: SSLSetProtocolVersionMin(%d), error=%d", minProtocol, (int)error));
|
||||
if (!error)
|
||||
{
|
||||
error = SSLSetProtocolVersionMax(http->tls, protocols[tls_max_version]);
|
||||
DEBUG_printf(("4_httpTLSStart: SSLSetProtocolVersionMax(%d), error=%d", protocols[tls_max_version], (int)error));
|
||||
}
|
||||
}
|
||||
|
||||
# if HAVE_SSLSETENABLEDCIPHERS
|
||||
@@ -1369,6 +1382,9 @@ _httpTLSStart(http_t *http) /* I - HTTP connection */
|
||||
case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 :
|
||||
case TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 :
|
||||
case TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 :
|
||||
case TLS_RSA_WITH_3DES_EDE_CBC_SHA :
|
||||
case TLS_RSA_WITH_AES_128_CBC_SHA :
|
||||
case TLS_RSA_WITH_AES_256_CBC_SHA :
|
||||
if (tls_options & _HTTP_TLS_DENY_CBC)
|
||||
{
|
||||
DEBUG_printf(("4_httpTLSStart: Excluding CBC cipher suite %d", supported[i]));
|
||||
@@ -1522,7 +1538,28 @@ _httpTLSStart(http_t *http) /* I - HTTP connection */
|
||||
|
||||
if (!error)
|
||||
{
|
||||
int done = 0; /* Are we done yet? */
|
||||
int done = 0; /* Are we done yet? */
|
||||
double old_timeout; /* Old timeout value */
|
||||
http_timeout_cb_t old_cb; /* Old timeout callback */
|
||||
void *old_data; /* Old timeout data */
|
||||
|
||||
/*
|
||||
* Enforce a minimum timeout of 10 seconds for the TLS handshake...
|
||||
*/
|
||||
|
||||
old_timeout = http->timeout_value;
|
||||
old_cb = http->timeout_cb;
|
||||
old_data = http->timeout_data;
|
||||
|
||||
if (!old_cb || old_timeout < 10.0)
|
||||
{
|
||||
DEBUG_puts("4_httpTLSStart: Setting timeout to 10 seconds.");
|
||||
httpSetTimeout(http, 10.0, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do the TLS handshake...
|
||||
*/
|
||||
|
||||
while (!error && !done)
|
||||
{
|
||||
@@ -1643,6 +1680,12 @@ _httpTLSStart(http_t *http) /* I - HTTP connection */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore the previous timeout settings...
|
||||
*/
|
||||
|
||||
httpSetTimeout(http, old_timeout, old_cb, old_data);
|
||||
}
|
||||
|
||||
if (error)
|
||||
@@ -2075,7 +2118,7 @@ http_cdsa_read(
|
||||
|
||||
http = (http_t *)connection;
|
||||
|
||||
if (!http->blocking)
|
||||
if (!http->blocking || http->timeout_value > 0.0)
|
||||
{
|
||||
/*
|
||||
* Make sure we have data before we read...
|
||||
|
||||
+97
-23
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* TLS support code for CUPS using GNU TLS.
|
||||
*
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* Copyright © 2007-2018 by Apple Inc.
|
||||
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -35,7 +35,9 @@ static char *tls_keypath = NULL;
|
||||
/* Server cert keychain path */
|
||||
static _cups_mutex_t tls_mutex = _CUPS_MUTEX_INITIALIZER;
|
||||
/* Mutex for keychain/certs */
|
||||
static int tls_options = -1;/* Options for TLS connections */
|
||||
static int tls_options = -1,/* Options for TLS connections */
|
||||
tls_min_version = _HTTP_TLS_1_0,
|
||||
tls_max_version = _HTTP_TLS_MAX;
|
||||
|
||||
|
||||
/*
|
||||
@@ -397,7 +399,7 @@ httpCredentialsAreValidForName(
|
||||
for (i = 0; i < count; i ++)
|
||||
{
|
||||
rserial_size = sizeof(rserial);
|
||||
if (!gnutls_x509_crl_get_crt_serial(tls_crl, (unsigned)i, rserial, &rserial_size, NULL) && cserial_size == rserial_size && !memcmp(cserial, rserial, rserial_size))
|
||||
if (!gnutls_x509_crl_get_crt_serial(tls_crl, (unsigned)i, rserial, &rserial_size, NULL) && cserial_size == rserial_size && !memcmp(cserial, rserial, (int)rserial_size))
|
||||
{
|
||||
result = 0;
|
||||
break;
|
||||
@@ -646,7 +648,6 @@ httpCredentialsString(
|
||||
char name[256]; /* Common name associated with cert */
|
||||
size_t namelen; /* Length of name */
|
||||
time_t expiration; /* Expiration date of cert */
|
||||
_cups_md5_state_t md5_state; /* MD5 state */
|
||||
unsigned char md5_digest[16]; /* MD5 result */
|
||||
|
||||
namelen = sizeof(name) - 1;
|
||||
@@ -657,9 +658,7 @@ httpCredentialsString(
|
||||
|
||||
expiration = gnutls_x509_crt_get_expiration_time(cert);
|
||||
|
||||
_cupsMD5Init(&md5_state);
|
||||
_cupsMD5Append(&md5_state, first->data, (int)first->datalen);
|
||||
_cupsMD5Finish(&md5_state, md5_digest);
|
||||
cupsHashData("md5", first->data, first->datalen, md5_digest, sizeof(md5_digest));
|
||||
|
||||
snprintf(buffer, bufsize, "%s / %s / %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", name, httpGetDateString(expiration), md5_digest[0], md5_digest[1], md5_digest[2], md5_digest[3], md5_digest[4], md5_digest[5], md5_digest[6], md5_digest[7], md5_digest[8], md5_digest[9], md5_digest[10], md5_digest[11], md5_digest[12], md5_digest[13], md5_digest[14], md5_digest[15]);
|
||||
|
||||
@@ -1094,7 +1093,7 @@ http_gnutls_read(
|
||||
|
||||
http = (http_t *)ptr;
|
||||
|
||||
if (!http->blocking)
|
||||
if (!http->blocking || http->timeout_value > 0.0)
|
||||
{
|
||||
/*
|
||||
* Make sure we have data before we read...
|
||||
@@ -1224,9 +1223,16 @@ _httpTLSSetCredentials(http_t *http) /* I - Connection to server */
|
||||
*/
|
||||
|
||||
void
|
||||
_httpTLSSetOptions(int options) /* I - Options */
|
||||
_httpTLSSetOptions(int options, /* I - Options */
|
||||
int min_version, /* I - Minimum TLS version */
|
||||
int max_version) /* I - Maximum TLS version */
|
||||
{
|
||||
tls_options = options;
|
||||
if (!(options & _HTTP_TLS_SET_DEFAULT) || tls_options < 0)
|
||||
{
|
||||
tls_options = options;
|
||||
tls_min_version = min_version;
|
||||
tls_max_version = max_version;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1242,8 +1248,21 @@ _httpTLSStart(http_t *http) /* I - Connection to server */
|
||||
int status; /* Status of handshake */
|
||||
gnutls_certificate_credentials_t *credentials;
|
||||
/* TLS credentials */
|
||||
char priority_string[1024];
|
||||
char priority_string[2048];
|
||||
/* Priority string */
|
||||
int version; /* Current version */
|
||||
double old_timeout; /* Old timeout value */
|
||||
http_timeout_cb_t old_cb; /* Old timeout callback */
|
||||
void *old_data; /* Old timeout data */
|
||||
static const char * const versions[] =/* SSL/TLS versions */
|
||||
{
|
||||
"VERS-SSL3.0",
|
||||
"VERS-TLS1.0",
|
||||
"VERS-TLS1.1",
|
||||
"VERS-TLS1.2",
|
||||
"VERS-TLS1.3",
|
||||
"VERS-TLS-ALL"
|
||||
};
|
||||
|
||||
|
||||
DEBUG_printf(("3_httpTLSStart(http=%p)", http));
|
||||
@@ -1505,21 +1524,50 @@ _httpTLSStart(http_t *http) /* I - Connection to server */
|
||||
|
||||
strlcpy(priority_string, "NORMAL", sizeof(priority_string));
|
||||
|
||||
if (tls_options & _HTTP_TLS_DENY_TLS10)
|
||||
strlcat(priority_string, ":+VERS-TLS-ALL:-VERS-TLS1.0:-VERS-SSL3.0", sizeof(priority_string));
|
||||
else if (tls_options & _HTTP_TLS_ALLOW_SSL3)
|
||||
strlcat(priority_string, ":+VERS-TLS-ALL", sizeof(priority_string));
|
||||
if (tls_max_version < _HTTP_TLS_MAX)
|
||||
{
|
||||
/*
|
||||
* Require specific TLS versions...
|
||||
*/
|
||||
|
||||
strlcat(priority_string, ":-VERS-TLS-ALL", sizeof(priority_string));
|
||||
for (version = tls_min_version; version <= tls_max_version; version ++)
|
||||
{
|
||||
strlcat(priority_string, ":+", sizeof(priority_string));
|
||||
strlcat(priority_string, versions[version], sizeof(priority_string));
|
||||
}
|
||||
}
|
||||
else if (tls_min_version == _HTTP_TLS_SSL3)
|
||||
{
|
||||
/*
|
||||
* Allow all versions of TLS and SSL/3.0...
|
||||
*/
|
||||
|
||||
strlcat(priority_string, ":+VERS-TLS-ALL:+VERS-SSL3.0", sizeof(priority_string));
|
||||
}
|
||||
else
|
||||
strlcat(priority_string, ":+VERS-TLS-ALL:-VERS-SSL3.0", sizeof(priority_string));
|
||||
{
|
||||
/*
|
||||
* Require a minimum version...
|
||||
*/
|
||||
|
||||
if (!(tls_options & _HTTP_TLS_ALLOW_RC4))
|
||||
strlcat(priority_string, ":-ARCFOUR-128", sizeof(priority_string));
|
||||
strlcat(priority_string, ":+VERS-TLS-ALL", sizeof(priority_string));
|
||||
for (version = 0; version < tls_min_version; version ++)
|
||||
{
|
||||
strlcat(priority_string, ":-", sizeof(priority_string));
|
||||
strlcat(priority_string, versions[version], sizeof(priority_string));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(tls_options & _HTTP_TLS_ALLOW_DH))
|
||||
strlcat(priority_string, ":!ANON-DH", sizeof(priority_string));
|
||||
if (tls_options & _HTTP_TLS_ALLOW_RC4)
|
||||
strlcat(priority_string, ":+ARCFOUR-128", sizeof(priority_string));
|
||||
else
|
||||
strlcat(priority_string, ":!ARCFOUR-128", sizeof(priority_string));
|
||||
|
||||
if (!(tls_options & _HTTP_TLS_DENY_CBC))
|
||||
strlcat(priority_string, ":!CBC", sizeof(priority_string));
|
||||
strlcat(priority_string, ":!ANON-DH", sizeof(priority_string));
|
||||
|
||||
if (tls_options & _HTTP_TLS_DENY_CBC)
|
||||
strlcat(priority_string, ":!AES-128-CBC:!AES-256-CBC:!CAMELLIA-128-CBC:!CAMELLIA-256-CBC:!3DES-CBC", sizeof(priority_string));
|
||||
|
||||
#ifdef HAVE_GNUTLS_PRIORITY_SET_DIRECT
|
||||
gnutls_priority_set_direct(http->tls, priority_string, NULL);
|
||||
@@ -1539,6 +1587,24 @@ _httpTLSStart(http_t *http) /* I - Connection to server */
|
||||
#endif /* HAVE_GNUTLS_TRANSPORT_SET_PULL_TIMEOUT_FUNCTION */
|
||||
gnutls_transport_set_push_function(http->tls, http_gnutls_write);
|
||||
|
||||
/*
|
||||
* Enforce a minimum timeout of 10 seconds for the TLS handshake...
|
||||
*/
|
||||
|
||||
old_timeout = http->timeout_value;
|
||||
old_cb = http->timeout_cb;
|
||||
old_data = http->timeout_data;
|
||||
|
||||
if (!old_cb || old_timeout < 10.0)
|
||||
{
|
||||
DEBUG_puts("4_httpTLSStart: Setting timeout to 10 seconds.");
|
||||
httpSetTimeout(http, 10.0, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do the TLS handshake...
|
||||
*/
|
||||
|
||||
while ((status = gnutls_handshake(http->tls)) != GNUTLS_E_SUCCESS)
|
||||
{
|
||||
DEBUG_printf(("5_httpStartTLS: gnutls_handshake returned %d (%s)",
|
||||
@@ -1556,10 +1622,18 @@ _httpTLSStart(http_t *http) /* I - Connection to server */
|
||||
free(credentials);
|
||||
http->tls = NULL;
|
||||
|
||||
httpSetTimeout(http, old_timeout, old_cb, old_data);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore the previous timeout settings...
|
||||
*/
|
||||
|
||||
httpSetTimeout(http, old_timeout, old_cb, old_data);
|
||||
|
||||
http->tls_credentials = credentials;
|
||||
|
||||
return (0);
|
||||
|
||||
+28
-18
@@ -2,7 +2,7 @@
|
||||
* TLS support for CUPS on Windows using the Security Support Provider
|
||||
* Interface (SSPI).
|
||||
*
|
||||
* Copyright 2010-2015 by Apple Inc.
|
||||
* Copyright 2010-2018 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -52,7 +52,9 @@
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static int tls_options = -1;/* Options for TLS connections */
|
||||
static int tls_options = -1,/* Options for TLS connections */
|
||||
tls_min_version = _HTTP_TLS_1_0,
|
||||
tls_max_version = _HTTP_TLS_MAX;
|
||||
|
||||
|
||||
/*
|
||||
@@ -351,7 +353,6 @@ httpCredentialsString(
|
||||
SYSTEMTIME systime; /* System time */
|
||||
struct tm tm; /* UNIX date/time */
|
||||
time_t expiration; /* Expiration date of cert */
|
||||
_cups_md5_state_t md5_state; /* MD5 state */
|
||||
unsigned char md5_digest[16]; /* MD5 result */
|
||||
|
||||
FileTimeToSystemTime(&(cert->pCertInfo->NotAfter), &systime);
|
||||
@@ -378,9 +379,7 @@ httpCredentialsString(
|
||||
else
|
||||
strlcpy(cert_name, "unknown", sizeof(cert_name));
|
||||
|
||||
_cupsMD5Init(&md5_state);
|
||||
_cupsMD5Append(&md5_state, first->data, (int)first->datalen);
|
||||
_cupsMD5Finish(&md5_state, md5_digest);
|
||||
cupsHashData("md5", first->data, first->datalen, md5_digest, sizeof(md5_digest));
|
||||
|
||||
snprintf(buffer, bufsize, "%s / %s / %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", cert_name, httpGetDateString(expiration), md5_digest[0], md5_digest[1], md5_digest[2], md5_digest[3], md5_digest[4], md5_digest[5], md5_digest[6], md5_digest[7], md5_digest[8], md5_digest[9], md5_digest[10], md5_digest[11], md5_digest[12], md5_digest[13], md5_digest[14], md5_digest[15]);
|
||||
|
||||
@@ -911,9 +910,16 @@ _httpTLSRead(http_t *http, /* I - HTTP connection */
|
||||
*/
|
||||
|
||||
void
|
||||
_httpTLSSetOptions(int options) /* I - Options */
|
||||
_httpTLSSetOptions(int options, /* I - Options */
|
||||
int min_version, /* I - Minimum TLS version */
|
||||
int max_version) /* I - Maximum TLS version */
|
||||
{
|
||||
tls_options = options;
|
||||
if (!(options & _HTTP_TLS_SET_DEFAULT) || tls_options < 0)
|
||||
{
|
||||
tls_options = options;
|
||||
tls_min_version = min_version;
|
||||
tls_max_version = max_version;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1761,34 +1767,38 @@ http_sspi_find_credentials(
|
||||
#ifdef SP_PROT_TLS1_2_SERVER
|
||||
if (http->mode == _HTTP_MODE_SERVER)
|
||||
{
|
||||
if (tls_options & _HTTP_TLS_DENY_TLS10)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_1_SERVER;
|
||||
else if (tls_options & _HTTP_TLS_ALLOW_SSL3)
|
||||
if (tls_min_version == _HTTP_TLS_SSL3)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_0_SERVER | SP_PROT_SSL3_SERVER;
|
||||
else
|
||||
else if (tls_min_version == _HTTP_TLS_1_0)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_0_SERVER;
|
||||
else if (tls_min_version == _HTTP_TLS_1_1)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_1_SERVER;
|
||||
else
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_SERVER;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tls_options & _HTTP_TLS_DENY_TLS10)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_CLIENT | SP_PROT_TLS1_1_CLIENT;
|
||||
else if (tls_options & _HTTP_TLS_ALLOW_SSL3)
|
||||
if (tls_min_version == _HTTP_TLS_SSL3)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_CLIENT | SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_0_CLIENT | SP_PROT_SSL3_CLIENT;
|
||||
else
|
||||
else if (tls_min_version == _HTTP_TLS_1_0)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_CLIENT | SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_0_CLIENT;
|
||||
else if (tls_min_version == _HTTP_TLS_1_1)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_CLIENT | SP_PROT_TLS1_1_CLIENT;
|
||||
else
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_2_CLIENT;
|
||||
}
|
||||
|
||||
#else
|
||||
if (http->mode == _HTTP_MODE_SERVER)
|
||||
{
|
||||
if (tls_options & _HTTP_TLS_ALLOW_SSL3)
|
||||
if (tls_min_version == _HTTP_TLS_SSL3)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_SERVER | SP_PROT_SSL3_SERVER;
|
||||
else
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_SERVER;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tls_options & _HTTP_TLS_ALLOW_SSL3)
|
||||
if (tls_min_version == _HTTP_TLS_SSL3)
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_CLIENT | SP_PROT_SSL3_CLIENT;
|
||||
else
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_CLIENT;
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
* Include platform-specific TLS code...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
|
||||
+16
-3
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* TLS check program for CUPS.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -54,6 +54,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
int af = AF_UNSPEC, /* Address family */
|
||||
tls_options = _HTTP_TLS_NONE,
|
||||
/* TLS options */
|
||||
tls_min_version = _HTTP_TLS_1_0,
|
||||
tls_max_version = _HTTP_TLS_MAX,
|
||||
verbose = 0; /* Verbosity */
|
||||
ipp_t *request, /* IPP Get-Printer-Attributes request */
|
||||
*response; /* IPP Get-Printer-Attributes response */
|
||||
@@ -82,9 +84,18 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
{
|
||||
tls_options |= _HTTP_TLS_ALLOW_DH;
|
||||
}
|
||||
else if (!strcmp(argv[i], "--no-cbc"))
|
||||
{
|
||||
tls_options |= _HTTP_TLS_DENY_CBC;
|
||||
}
|
||||
else if (!strcmp(argv[i], "--no-tls10"))
|
||||
{
|
||||
tls_options |= _HTTP_TLS_DENY_TLS10;
|
||||
tls_min_version = _HTTP_TLS_1_1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "--tls10"))
|
||||
{
|
||||
tls_min_version = _HTTP_TLS_1_0;
|
||||
tls_max_version = _HTTP_TLS_1_0;
|
||||
}
|
||||
else if (!strcmp(argv[i], "--rc4"))
|
||||
{
|
||||
@@ -140,7 +151,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if (!port)
|
||||
port = 631;
|
||||
|
||||
_httpTLSSetOptions(tls_options);
|
||||
_httpTLSSetOptions(tls_options, tls_min_version, tls_max_version);
|
||||
|
||||
http = httpConnect2(server, port, NULL, af, HTTP_ENCRYPTION_ALWAYS, 1, 30000, NULL);
|
||||
if (!http)
|
||||
@@ -729,8 +740,10 @@ usage(void)
|
||||
puts("");
|
||||
puts("Options:");
|
||||
puts(" --dh Allow DH/DHE key exchange");
|
||||
puts(" --no-cbc Disable CBC cipher suites");
|
||||
puts(" --no-tls10 Disable TLS/1.0");
|
||||
puts(" --rc4 Allow RC4 encryption");
|
||||
puts(" --tls10 Only use TLS/1.0");
|
||||
puts(" --verbose Be verbose");
|
||||
puts(" -4 Connect using IPv4 addresses only");
|
||||
puts(" -6 Connect using IPv6 addresses only");
|
||||
|
||||
+40
-14
@@ -54,7 +54,9 @@
|
||||
typedef struct _cups_client_conf_s /**** client.conf config data ****/
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
int ssl_options; /* SSLOptions values */
|
||||
int ssl_options, /* SSLOptions values */
|
||||
ssl_min_version,/* Minimum SSL/TLS version */
|
||||
ssl_max_version;/* Maximum SSL/TLS version */
|
||||
#endif /* HAVE_SSL */
|
||||
int trust_first, /* Trust on first use? */
|
||||
any_root, /* Allow any (e.g., self-signed) root */
|
||||
@@ -957,7 +959,7 @@ _cupsSetDefaults(void)
|
||||
cg->validate_certs = cc.validate_certs;
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
_httpTLSSetOptions(cc.ssl_options);
|
||||
_httpTLSSetOptions(cc.ssl_options | _HTTP_TLS_SET_DEFAULT, cc.ssl_min_version, cc.ssl_max_version);
|
||||
#endif /* HAVE_SSL */
|
||||
}
|
||||
|
||||
@@ -1164,18 +1166,22 @@ cups_init_client_conf(
|
||||
|
||||
memset(cc, 0, sizeof(_cups_client_conf_t));
|
||||
|
||||
cc->encryption = (http_encryption_t)-1;
|
||||
cc->trust_first = -1;
|
||||
cc->any_root = -1;
|
||||
cc->expired_certs = -1;
|
||||
cc->validate_certs = -1;
|
||||
#ifdef HAVE_SSL
|
||||
cc->ssl_min_version = _HTTP_TLS_1_0;
|
||||
cc->ssl_max_version = _HTTP_TLS_MAX;
|
||||
#endif /* HAVE_SSL */
|
||||
cc->encryption = (http_encryption_t)-1;
|
||||
cc->trust_first = -1;
|
||||
cc->any_root = -1;
|
||||
cc->expired_certs = -1;
|
||||
cc->validate_certs = -1;
|
||||
|
||||
/*
|
||||
* Load settings from the org.cups.PrintingPrefs plist (which trump
|
||||
* everything...)
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) && defined(HAVE_SSL)
|
||||
char sval[1024]; /* String value */
|
||||
int bval; /* Boolean value */
|
||||
|
||||
@@ -1196,7 +1202,7 @@ cups_init_client_conf(
|
||||
|
||||
if (cups_apple_get_boolean(kValidateCertsKey, &bval))
|
||||
cc->validate_certs = bval;
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* __APPLE__ && HAVE_SSL */
|
||||
}
|
||||
|
||||
|
||||
@@ -1336,7 +1342,9 @@ cups_set_ssl_options(
|
||||
* SSLOptions [AllowRC4] [AllowSSL3] [AllowDH] [DenyTLS1.0] [None]
|
||||
*/
|
||||
|
||||
int options = _HTTP_TLS_NONE; /* SSL/TLS options */
|
||||
int options = _HTTP_TLS_NONE, /* SSL/TLS options */
|
||||
min_version = _HTTP_TLS_1_0, /* Minimum SSL/TLS version */
|
||||
max_version = _HTTP_TLS_MAX; /* Maximum SSL/TLS version */
|
||||
char temp[256], /* Copy of value */
|
||||
*start, /* Start of option */
|
||||
*end; /* End of option */
|
||||
@@ -1364,20 +1372,38 @@ cups_set_ssl_options(
|
||||
if (!_cups_strcasecmp(start, "AllowRC4"))
|
||||
options |= _HTTP_TLS_ALLOW_RC4;
|
||||
else if (!_cups_strcasecmp(start, "AllowSSL3"))
|
||||
options |= _HTTP_TLS_ALLOW_SSL3;
|
||||
min_version = _HTTP_TLS_SSL3;
|
||||
else if (!_cups_strcasecmp(start, "AllowDH"))
|
||||
options |= _HTTP_TLS_ALLOW_DH;
|
||||
else if (!_cups_strcasecmp(start, "DenyCBC"))
|
||||
options |= _HTTP_TLS_DENY_CBC;
|
||||
else if (!_cups_strcasecmp(start, "DenyTLS1.0"))
|
||||
options |= _HTTP_TLS_DENY_TLS10;
|
||||
min_version = _HTTP_TLS_1_1;
|
||||
else if (!_cups_strcasecmp(start, "MaxTLS1.0"))
|
||||
max_version = _HTTP_TLS_1_0;
|
||||
else if (!_cups_strcasecmp(start, "MaxTLS1.1"))
|
||||
max_version = _HTTP_TLS_1_1;
|
||||
else if (!_cups_strcasecmp(start, "MaxTLS1.2"))
|
||||
max_version = _HTTP_TLS_1_2;
|
||||
else if (!_cups_strcasecmp(start, "MaxTLS1.3"))
|
||||
max_version = _HTTP_TLS_1_3;
|
||||
else if (!_cups_strcasecmp(start, "MinTLS1.0"))
|
||||
min_version = _HTTP_TLS_1_0;
|
||||
else if (!_cups_strcasecmp(start, "MinTLS1.1"))
|
||||
min_version = _HTTP_TLS_1_1;
|
||||
else if (!_cups_strcasecmp(start, "MinTLS1.2"))
|
||||
min_version = _HTTP_TLS_1_2;
|
||||
else if (!_cups_strcasecmp(start, "MinTLS1.3"))
|
||||
min_version = _HTTP_TLS_1_3;
|
||||
else if (!_cups_strcasecmp(start, "None"))
|
||||
options = _HTTP_TLS_NONE;
|
||||
}
|
||||
|
||||
cc->ssl_options = options;
|
||||
cc->ssl_options = options;
|
||||
cc->ssl_max_version = max_version;
|
||||
cc->ssl_min_version = min_version;
|
||||
|
||||
DEBUG_printf(("4cups_set_ssl_options(cc=%p, value=\"%s\") options=%x", (void *)cc, value, options));
|
||||
DEBUG_printf(("4cups_set_ssl_options(cc=%p, value=\"%s\") options=%x, min_version=%d, max_version=%d", (void *)cc, value, options, min_version, max_version));
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
|
||||
+3
-1
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* API versioning definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright © 2007-2018 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -71,6 +71,7 @@
|
||||
# define _CUPS_API_2_0 AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
|
||||
# define _CUPS_API_2_2 AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
|
||||
# define _CUPS_API_2_2_4 AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
|
||||
# define _CUPS_API_2_2_7
|
||||
# else
|
||||
# define _CUPS_API_1_1_19
|
||||
# define _CUPS_API_1_1_20
|
||||
@@ -84,6 +85,7 @@
|
||||
# define _CUPS_API_2_0
|
||||
# define _CUPS_API_2_2
|
||||
# define _CUPS_API_2_2_4
|
||||
# define _CUPS_API_2_2_7
|
||||
# endif /* __APPLE__ && !_CUPS_SOURCE */
|
||||
|
||||
/*
|
||||
|
||||
+3
-3
@@ -140,9 +140,9 @@
|
||||
#media "EnvYou4/Envelope You4" 298 666
|
||||
#media "EnvYou4Rotated/Envelope You4 Long Edge" 666 298
|
||||
#media "Executive/Executive" 522 756
|
||||
#media "FanFoldGerman/FanFold German" 612 864
|
||||
#media "FanFoldGermanLegal/FanFold Legal German" 612 936
|
||||
#media "FanFoldUS/Fanfold US" 1071 792
|
||||
#media "FanFoldGerman/European Fanfold" 612 864
|
||||
#media "FanFoldGermanLegal/European Fanfold Legal" 612 936
|
||||
#media "FanFoldUS/US Fanfold" 1071 792
|
||||
#media "Folio/Folio" 595 935
|
||||
#media "ISOB0/B0" 2835 4008
|
||||
#media "ISOB1/B1" 2004 2835
|
||||
|
||||
Arquivo binário não exibido.
@@ -8,7 +8,7 @@
|
||||
<meta name="creator" content="Mini-XML v2.11">
|
||||
<meta name="author" content="Michael R Sweet">
|
||||
<meta name="copyright" content="Copyright © 2007-2017 by Apple Inc. All Rights Reserved.">
|
||||
<meta name="version" content="2.2.4">
|
||||
<meta name="version" content="2.2.5">
|
||||
<style type="text/css"><!--
|
||||
body, p, h1, h2, h3, h4 {
|
||||
font-family: sans-serif;
|
||||
@@ -1098,7 +1098,7 @@ if ((attr = ippFindAttribute(response, "printer-state",
|
||||
IPP_TAG_ENUM)) != NULL)
|
||||
{
|
||||
printf("printer-state=%s\n",
|
||||
ippTagString("printer-state", ippGetInteger(attr, 0)));
|
||||
ippEnumString("printer-state", ippGetInteger(attr, 0)));
|
||||
}
|
||||
else
|
||||
puts("printer-state=unknown");
|
||||
@@ -1122,7 +1122,7 @@ if ((attr = ippFindAttribute(response, "printer-state-reasons",
|
||||
</code></pre>
|
||||
<p>The <code>ippGetCount</code> function returns the number of values in an attribute.</p>
|
||||
<p>The <code>ippGetInteger</code> and <code>ippGetString</code> functions return a single integer or string value from an attribute.</p>
|
||||
<p>The <code>ippTagString</code> function converts a enum value to its keyword (string) equivalent.</p>
|
||||
<p>The <code>ippEnumString</code> function converts a enum value to its keyword (string) equivalent.</p>
|
||||
<p>Once you are done using the IPP response message, free it using the <code>ippDelete</code> function:</p>
|
||||
<pre><code>ippDelete(response);
|
||||
</code></pre>
|
||||
@@ -6125,12 +6125,12 @@ are server-oriented...</p>
|
||||
<tr><th>HTTP_STATUS_ERROR </th> <td class="description">An error response from httpXxxx()</td></tr>
|
||||
<tr><th>HTTP_STATUS_EXPECTATION_FAILED </th> <td class="description">The expectation given in an Expect header field was not met</td></tr>
|
||||
<tr><th>HTTP_STATUS_FORBIDDEN </th> <td class="description">Forbidden to access this URI</td></tr>
|
||||
<tr><th>HTTP_STATUS_FOUND </th> <td class="description">Document was found at a different URI</td></tr>
|
||||
<tr><th>HTTP_STATUS_GATEWAY_TIMEOUT </th> <td class="description">Gateway connection timed out</td></tr>
|
||||
<tr><th>HTTP_STATUS_GONE </th> <td class="description">Server has gone away</td></tr>
|
||||
<tr><th>HTTP_STATUS_LENGTH_REQUIRED </th> <td class="description">A content length or encoding is required</td></tr>
|
||||
<tr><th>HTTP_STATUS_METHOD_NOT_ALLOWED </th> <td class="description">Method is not allowed</td></tr>
|
||||
<tr><th>HTTP_STATUS_MOVED_PERMANENTLY </th> <td class="description">Document has moved permanently</td></tr>
|
||||
<tr><th>HTTP_STATUS_MOVED_TEMPORARILY </th> <td class="description">Document has moved temporarily</td></tr>
|
||||
<tr><th>HTTP_STATUS_MULTIPLE_CHOICES </th> <td class="description">Multiple files match request</td></tr>
|
||||
<tr><th>HTTP_STATUS_NONE <span class="info"> CUPS 1.7/macOS 10.9 </span></th> <td class="description">No Expect value </td></tr>
|
||||
<tr><th>HTTP_STATUS_NOT_ACCEPTABLE </th> <td class="description">Not Acceptable</td></tr>
|
||||
@@ -6149,10 +6149,11 @@ are server-oriented...</p>
|
||||
<tr><th>HTTP_STATUS_REQUEST_TIMEOUT </th> <td class="description">Request timed out</td></tr>
|
||||
<tr><th>HTTP_STATUS_REQUEST_TOO_LARGE </th> <td class="description">Request entity too large</td></tr>
|
||||
<tr><th>HTTP_STATUS_RESET_CONTENT </th> <td class="description">Content was reset/recreated</td></tr>
|
||||
<tr><th>HTTP_STATUS_SEE_OTHER </th> <td class="description">See this other link...</td></tr>
|
||||
<tr><th>HTTP_STATUS_SEE_OTHER </th> <td class="description">See this other link</td></tr>
|
||||
<tr><th>HTTP_STATUS_SERVER_ERROR </th> <td class="description">Internal server error</td></tr>
|
||||
<tr><th>HTTP_STATUS_SERVICE_UNAVAILABLE </th> <td class="description">Service is unavailable</td></tr>
|
||||
<tr><th>HTTP_STATUS_SWITCHING_PROTOCOLS </th> <td class="description">HTTP upgrade to TLS/SSL</td></tr>
|
||||
<tr><th>HTTP_STATUS_TEMPORARY_REDIRECT </th> <td class="description">Temporary redirection</td></tr>
|
||||
<tr><th>HTTP_STATUS_UNAUTHORIZED </th> <td class="description">Unauthorized to access host</td></tr>
|
||||
<tr><th>HTTP_STATUS_UNSUPPORTED_MEDIATYPE </th> <td class="description">The requested media type is unsupported</td></tr>
|
||||
<tr><th>HTTP_STATUS_UPGRADE_REQUIRED </th> <td class="description">Upgrade to SSL/TLS required</td></tr>
|
||||
|
||||
@@ -40,13 +40,16 @@ CUPS adds the remote hostname ("name@server.example.com") for you. The default n
|
||||
<b>Note: This directive is not supported on macOS 10.7 or later.</b>
|
||||
<dt><b>ServerName </b><i>hostname-or-ip-address</i>[<i>:port</i>]<b>/version=1.1</b>
|
||||
<dd style="margin-left: 5.0em">Specifies the address and optionally the port to use when connecting to a server running CUPS 1.3.12 and earlier.
|
||||
<dt><b>SSLOptions </b>[<i>AllowDH</i>] [<i>AllowRC4</i>] [<i>AllowSSL3</i>] [<i>DenyTLS1.0</i>]
|
||||
<dt><b>SSLOptions </b>[<i>AllowDH</i>] [<i>AllowRC4</i>] [<i>AllowSSL3</i>] [<i>DenyCBC</i>] [<i>DenyTLS1.0</i>]
|
||||
<dd style="margin-left: 5.0em"><dt><b>SSLOptions None</b>
|
||||
<dd style="margin-left: 5.0em">Sets encryption options (only in /etc/cups/client.conf).
|
||||
By default, CUPS only supports encryption using TLS v1.0 or higher using known secure cipher suites.
|
||||
The <i>AllowDH</i> option enables cipher suites using plain Diffie-Hellman key negotiation.
|
||||
The <i>AllowRC4</i> option enables the 128-bit RC4 cipher suites, which are required for some older clients that do not implement newer ones.
|
||||
Security is reduced when <i>Allow</i> options are used.
|
||||
Security is enhanced when <i>Deny</i> options are used.
|
||||
The <i>AllowDH</i> option enables cipher suites using plain Diffie-Hellman key negotiation (not supported on systems using GNU TLS).
|
||||
The <i>AllowRC4</i> option enables the 128-bit RC4 cipher suites, which are required for some older clients.
|
||||
The <i>AllowSSL3</i> option enables SSL v3.0, which is required for some older clients that do not support TLS v1.0.
|
||||
The <i>DenyCBC</i> option disables all CBC cipher suites.
|
||||
The <i>DenyTLS1.0</i> option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1.
|
||||
<dt><b>TrustOnFirstUse Yes</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>TrustOnFirstUse No</b>
|
||||
|
||||
@@ -36,6 +36,9 @@ The server name may be included in filenames using the string "%s", for example:
|
||||
|
||||
</pre>
|
||||
The default is "/var/log/cups/access_log".
|
||||
<dt><a name="CacheDir"></a><b>CacheDir </b><i>directory</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the directory to use for long-lived temporary (cache) files.
|
||||
The default is "/var/spool/cups/cache" or "/var/cache/cups" depending on the platform.
|
||||
<dt><a name="ConfigFilePerm"></a><b>ConfigFilePerm </b><i>mode</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the permissions for all configuration files that the scheduler writes.
|
||||
The default is "0644" on macOS and "0640" on all other operating systems.
|
||||
@@ -92,10 +95,6 @@ The <i>kind</i> strings are:
|
||||
<dt><b>permissions</b>
|
||||
<dd style="margin-left: 5.0em">Bad startup file permissions are fatal, for example shared TLS certificate and key files with world-read permissions.
|
||||
</div>
|
||||
<dt><a name="FileDevice"></a><b>FileDevice Yes</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>FileDevice No</b>
|
||||
<dd style="margin-left: 5.0em">Specifies whether the file pseudo-device can be used for new printer queues.
|
||||
The URI "file:///dev/null" is always allowed.
|
||||
<dt><a name="Group"></a><b>Group </b><i>group-name-or-number</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the group name or ID that will be used when executing external programs.
|
||||
The default group is operating system specific but is usually "lp" or "nobody".
|
||||
@@ -137,6 +136,9 @@ macOS uses its keychain database to store certificates and keys while other plat
|
||||
<dt><a name="ServerRoot"></a><b>ServerRoot </b><i>directory</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the directory containing the server configuration files.
|
||||
The default is "/etc/cups".
|
||||
<dt><a name="StateDir"></a><b>StateDir </b><i>directory</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the directory to use for PID and local certificate files.
|
||||
The default is "/var/run/cups" or "/etc/cups" depending on the platform.
|
||||
<dt><a name="SyncOnClose"></a><b>SyncOnClose Yes</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>SyncOnClose No</b>
|
||||
<dd style="margin-left: 5.0em">Specifies whether the scheduler calls
|
||||
@@ -147,12 +149,42 @@ The default is "No".
|
||||
<dd style="margin-left: 5.0em">Specifies the group(s) to use for <i>@SYSTEM</i> group authentication.
|
||||
The default contains "admin", "lpadmin", "root", "sys", and/or "system".
|
||||
<dt><a name="TempDir"></a><b>TempDir </b><i>directory</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the directory where temporary files are stored.
|
||||
<dd style="margin-left: 5.0em">Specifies the directory where short-term temporary files are stored.
|
||||
The default is "/var/spool/cups/tmp".
|
||||
<dt><a name="User"></a><b>User </b><i>username</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the user name or ID that is used when running external programs.
|
||||
The default is "lp".
|
||||
</dl>
|
||||
<h3><a name="DEPRECATED_DIRECTIVES">Deprecated Directives</a></h3>
|
||||
The following directives are deprecated and will be removed from a future version of CUPS:
|
||||
<dl class="man">
|
||||
<dt><a name="FileDevice"></a><b>FileDevice Yes</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>FileDevice No</b>
|
||||
<dd style="margin-left: 5.0em">Specifies whether the file pseudo-device can be used for new printer queues.
|
||||
The URI "file:///dev/null" is always allowed.
|
||||
File devices cannot be used with "raw" print queues - a PPD file is required.
|
||||
The specified file is overwritten for every print job.
|
||||
Writing to directories is not supported.
|
||||
<dt><a name="FontPath"></a><b>FontPath </b><i>directory[:...:directoryN]</i>
|
||||
<dd style="margin-left: 5.0em">Specifies a colon separated list of directories where fonts can be found.
|
||||
On Linux the
|
||||
<b>font-config</b>(1)
|
||||
mechanism is used instead.
|
||||
On macOS the Font Book application manages system-installed fonts.
|
||||
<dt><a name="LPDConfigFile"></a><b> LPDConfigFile </b><i>filename</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the LPD service configuration file to update.
|
||||
<dt><a name="Printcap"></a><b>Printcap </b><i>filename</i>
|
||||
<dd style="margin-left: 5.0em">Specifies a file that is filled with a list of local print queues.
|
||||
<dt><a name="PrintcapFormat"></a><b>PrintcapFormat bsd</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>PrintcapFormat plist</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>PrintcapFormat solaris</b>
|
||||
<dd style="margin-left: 5.0em">Specifies the format to use for the Printcap file.
|
||||
"bsd" is the historical LPD printcap file format.
|
||||
"plist" is the Apple plist file format.
|
||||
"solaris" is the historical Solaris LPD printcap file format.
|
||||
<dt><a name="SMBConfigFile"></a><b>SMBConfigFile </b><i>filename</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the SMB service configuration file to update.
|
||||
</dl>
|
||||
<h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
|
||||
<a href="man-classes.conf.html?TOPIC=Man+Pages"><b>classes.conf</b>(5),</a>
|
||||
<a href="man-cups.html?TOPIC=Man+Pages"><b>cups</b>(1),</a>
|
||||
|
||||
@@ -56,16 +56,6 @@ The default is "No".
|
||||
<dd style="margin-left: 5.0em"><br>
|
||||
Specifies whether shared printers are advertised.
|
||||
The default is "No".
|
||||
<dt><a name="Classification"></a><b>Classification </b><i>banner</i>
|
||||
<dd style="margin-left: 5.0em"><br>
|
||||
Specifies the security classification of the server.
|
||||
Any valid banner name can be used, including "classified", "confidential", "secret", "topsecret", and "unclassified", or the banner can be omitted to disable secure printing functions.
|
||||
The default is no classification banner.
|
||||
<dt><a name="ClassifyOverride"></a><b>ClassifyOverride Yes</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>ClassifyOverride No</b>
|
||||
<dd style="margin-left: 5.0em"><br>
|
||||
Specifies whether users may override the classification (cover page) of individual print jobs using the "job-sheets" option.
|
||||
The default is "No".
|
||||
<dt><a name="DefaultAuthType"></a><b>DefaultAuthType Basic</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>DefaultAuthType Negotiate</b>
|
||||
<dd style="margin-left: 5.0em"><br>
|
||||
@@ -230,24 +220,6 @@ The default is "1048576" (1MB).
|
||||
<dt><a name="MultipleOperationTimeout"></a><b>MultipleOperationTimeout </b><i>seconds</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the maximum amount of time to allow between files in a multiple file print job.
|
||||
The default is "300" (5 minutes).
|
||||
<dt><a name="PageLogFormat"></a><b>PageLogFormat </b><i>format-string</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the format of PageLog lines.
|
||||
Sequences beginning with percent (%) characters are replaced with the corresponding information, while all other characters are copied literally.
|
||||
The following percent sequences are recognized:
|
||||
<pre class="man">
|
||||
|
||||
"%%" inserts a single percent character.
|
||||
"%{name}" inserts the value of the specified IPP attribute.
|
||||
"%C" inserts the number of copies for the current page.
|
||||
"%P" inserts the current page number.
|
||||
"%T" inserts the current date and time in common log format.
|
||||
"%j" inserts the job ID.
|
||||
"%p" inserts the printer name.
|
||||
"%u" inserts the username.
|
||||
|
||||
</pre>
|
||||
The default is the empty string, which disables page logging.
|
||||
The string "%p %u %j %T %P %C %{job-billing} %{job-originating-host-name} %{job-name} %{media} %{sides}" creates a page log with the standard items.
|
||||
<dt><a name="PassEnv"></a><b>PassEnv </b><i>variable </i>[ ... <i>variable </i>]
|
||||
<dd style="margin-left: 5.0em">Passes the specified environment variable(s) to child processes.
|
||||
<dt><a name="Policy"></a><b><Policy </b><i>name</i><b>> </b>... <b></Policy></b>
|
||||
@@ -270,9 +242,6 @@ The default is "Yes".
|
||||
<dt><a name="ReloadTimeout"></a><b>ReloadTimeout </b><i>seconds</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the amount of time to wait for job completion before restarting the scheduler.
|
||||
The default is "30".
|
||||
<dt><a name="RIPCache"></a><b>RIPCache </b><i>size</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the maximum amount of memory to use when converting documents into bitmaps for a printer.
|
||||
The default is "128m".
|
||||
<dt><a name="ServerAdmin"></a><b>ServerAdmin </b><i>email-address</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the email address of the server administrator.
|
||||
The default value is "root@ServerName".
|
||||
@@ -310,12 +279,17 @@ The default is "Minimal".
|
||||
<dd style="margin-left: 5.0em"><dt><b>SSLListen [</b><i>ipv6-address</i><b>]:</b><i>port</i>
|
||||
<dd style="margin-left: 5.0em"><dt><b>SSLListen *:</b><i>port</i>
|
||||
<dd style="margin-left: 5.0em">Listens on the specified address and port for encrypted connections.
|
||||
<dt><a name="SSLOptions"></a><b>SSLOptions </b>[<i>AllowRC4</i>] [<i>AllowSSL3</i>]
|
||||
<dt><a name="SSLOptions"></a><b>SSLOptions </b>[<i>AllowDH</i>] [<i>AllowRC4</i>] [<i>AllowSSL3</i>] [<i>DenyCBC</i>] [<i>DenyTLS1.0</i>]
|
||||
<dd style="margin-left: 5.0em"><dt><b>SSLOptions None</b>
|
||||
<dd style="margin-left: 5.0em">Sets encryption options.
|
||||
By default, CUPS only supports encryption using TLS v1.0 or higher using known secure cipher suites.
|
||||
The <i>AllowRC4</i> option enables the 128-bit RC4 cipher suites, which are required for some older clients that do not implement newer ones.
|
||||
Security is reduced when <i>Allow</i> options are used.
|
||||
Security is enhanced when <i>Deny</i> options are used.
|
||||
The <i>AllowDH</i> option enables cipher suites using plain Diffie-Hellman key negotiation (not supported on systems using GNU TLS).
|
||||
The <i>AllowRC4</i> option enables the 128-bit RC4 cipher suites, which are required for some older clients.
|
||||
The <i>AllowSSL3</i> option enables SSL v3.0, which is required for some older clients that do not support TLS v1.0.
|
||||
The <i>DenyCBC</i> option disables all CBC cipher suites.
|
||||
The <i>DenyTLS1.0</i> option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1.
|
||||
<dt><a name="SSLPort"></a><b>SSLPort </b><i>port</i>
|
||||
<dd style="margin-left: 5.0em">Listens on the specified port for encrypted connections.
|
||||
<dt><a name="StrictConformance"></a><b>StrictConformance Yes</b>
|
||||
@@ -564,6 +538,41 @@ file.
|
||||
<dd style="margin-left: 5.0em">Specifies the list of subscription values to make private.
|
||||
The "default" values are "notify-events", "notify-pull-method", "notify-recipient-uri", "notify-subscriber-user-name", and "notify-user-data".
|
||||
</dl>
|
||||
<h3><a name="DEPRECATED_DIRECTIVES">Deprecated Directives</a></h3>
|
||||
The following directives are deprecated and will be removed in a future release of CUPS:
|
||||
<dl class="man">
|
||||
<dt><a name="Classification"></a><b>Classification </b><i>banner</i>
|
||||
<dd style="margin-left: 5.0em"><br>
|
||||
Specifies the security classification of the server.
|
||||
Any valid banner name can be used, including "classified", "confidential", "secret", "topsecret", and "unclassified", or the banner can be omitted to disable secure printing functions.
|
||||
The default is no classification banner.
|
||||
<dt><a name="ClassifyOverride"></a><b>ClassifyOverride Yes</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>ClassifyOverride No</b>
|
||||
<dd style="margin-left: 5.0em"><br>
|
||||
Specifies whether users may override the classification (cover page) of individual print jobs using the "job-sheets" option.
|
||||
The default is "No".
|
||||
<dt><a name="PageLogFormat"></a><b>PageLogFormat </b><i>format-string</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the format of PageLog lines.
|
||||
Sequences beginning with percent (%) characters are replaced with the corresponding information, while all other characters are copied literally.
|
||||
The following percent sequences are recognized:
|
||||
<pre class="man">
|
||||
|
||||
"%%" inserts a single percent character.
|
||||
"%{name}" inserts the value of the specified IPP attribute.
|
||||
"%C" inserts the number of copies for the current page.
|
||||
"%P" inserts the current page number.
|
||||
"%T" inserts the current date and time in common log format.
|
||||
"%j" inserts the job ID.
|
||||
"%p" inserts the printer name.
|
||||
"%u" inserts the username.
|
||||
|
||||
</pre>
|
||||
The default is the empty string, which disables page logging.
|
||||
The string "%p %u %j %T %P %C %{job-billing} %{job-originating-host-name} %{job-name} %{media} %{sides}" creates a page log with the standard items.
|
||||
<dt><a name="RIPCache"></a><b>RIPCache </b><i>size</i>
|
||||
<dd style="margin-left: 5.0em">Specifies the maximum amount of memory to use when converting documents into bitmaps for a printer.
|
||||
The default is "128m".
|
||||
</dl>
|
||||
<h2 class="title"><a name="CONFORMING_TO">Conforming To</a></h2>
|
||||
The <b>cupsd.conf</b> file format is based on the Apache HTTP Server configuration file format.
|
||||
<h2 class="title"><a name="EXAMPLES">Examples</a></h2>
|
||||
|
||||
@@ -51,6 +51,8 @@ ipptool - perform internet printing protocol requests
|
||||
<b>-f</b>
|
||||
<i>filename</i>
|
||||
] [
|
||||
<b>-h</b>
|
||||
] [
|
||||
<b>-i</b>
|
||||
<i>seconds</i>
|
||||
] [
|
||||
@@ -134,6 +136,8 @@ This option is incompatible with the <b>-i</b> (interval) and <b>-n</b> (repeat-
|
||||
<dd style="margin-left: 5.0em">Defines the named variable.
|
||||
<dt><b>-f</b><i> filename</i>
|
||||
<dd style="margin-left: 5.0em">Defines the default request filename for tests.
|
||||
<dt><b>-h</b>
|
||||
<dd style="margin-left: 5.0em">Validate HTTP response headers.
|
||||
<dt><b>-i</b><i> seconds</i>
|
||||
<dd style="margin-left: 5.0em">Specifies that the (last)
|
||||
<i>testfile</i>
|
||||
|
||||
@@ -139,9 +139,11 @@ command-line. Support for content length requests is required for conformance wi
|
||||
<h3><a name="TEST_DIRECTIVES">Test Directives</a></h3>
|
||||
The following directives are understood within a <i>test</i>:
|
||||
<dl class="man">
|
||||
<dt><b>ATTR </b><i>tag attribute-name value(s)</i>
|
||||
<dt><b>ATTR </b><i>out-of-band-tag attribute-name</i>
|
||||
<dd style="margin-left: 5.0em"><dt><b>ATTR </b><i>tag attribute-name value(s)</i>
|
||||
<dd style="margin-left: 5.0em">Adds an attribute to the test request.
|
||||
Values are separated by the comma (",") character - escape commas using the "" character.
|
||||
Out-of-band tags (admin-define, delete-attribute, no-value, not-settable, unknown, unsupported) have no value.
|
||||
Values for other tags are separated by the comma (",") character - escape commas using the "" character.
|
||||
Common attributes and values are listed in the IANA IPP registry - see references below.
|
||||
<dt><b>ATTR collection </b><i>attribute-name </i><b>{ MEMBER </b><i>tag member-name value(s) ... </i><b>}</b> [ <i>... </i><b>,{ </b><i>... </i><b>} </b>]
|
||||
<dd style="margin-left: 5.0em">Adds a collection attribute to the test request.
|
||||
@@ -303,7 +305,7 @@ Specifies the maximum number of times to repeat. The default value is 1000.
|
||||
<dd style="margin-left: 5.0em">Specifies that the current test should be repeated when the response status-code matches or does not match the value specified by the STATUS directive.
|
||||
</dl>
|
||||
<h3><a name="OPERATION_CODES">Operation Codes</a></h3>
|
||||
Operation codes correspond to the hexadecimal numbers (0xHHHH) and names from RFC 2911 and other IPP extension specifications. Here is a complete list of names supported by
|
||||
Operation codes correspond to the hexadecimal numbers (0xHHHH) and names from RFC 8011 and other IPP extension specifications. Here is a complete list of names supported by
|
||||
<a href="man-ipptool.html?TOPIC=Man+Pages"><b>ipptool</b>(8):</a>
|
||||
<pre class="man">
|
||||
|
||||
@@ -376,7 +378,7 @@ Operation codes correspond to the hexadecimal numbers (0xHHHH) and names from RF
|
||||
Validate-Job
|
||||
</pre>
|
||||
<h3><a name="STATUS_CODES">Status Codes</a></h3>
|
||||
Status codes correspond to the hexadecimal numbers (0xHHHH) and names from RFC 2911 and other IPP extension specifications. Here is a complete list of the names supported by
|
||||
Status codes correspond to the hexadecimal numbers (0xHHHH) and names from RFC 8011 and other IPP extension specifications. Here is a complete list of the names supported by
|
||||
<a href="man-ipptool.html?TOPIC=Man+Pages"><b>ipptool</b>(8):</a>
|
||||
<pre class="man">
|
||||
|
||||
@@ -439,7 +441,7 @@ Status codes correspond to the hexadecimal numbers (0xHHHH) and names from RFC 2
|
||||
successful-ok-too-many-events
|
||||
</pre>
|
||||
<h3><a name="TAGS">Tags</a></h3>
|
||||
Value and group tags correspond to the names from RFC 2911 and other IPP extension specifications. Here are the group tags:
|
||||
Value and group tags correspond to the names from RFC 8011 and other IPP extension specifications. Here are the group tags:
|
||||
<pre class="man">
|
||||
|
||||
document-attributes-tag
|
||||
|
||||
@@ -80,6 +80,7 @@ Use the <i>-m</i> option with the
|
||||
<a href="man-lpinfo.html?TOPIC=Man+Pages"><b>lpinfo</b>(8)</a>
|
||||
command to get a list of supported models.
|
||||
The model "raw" clears any existing PPD file and the model "everywhere" queries the printer referred to by the specified IPP <i>device-uri</i>.
|
||||
Note: The "raw" model is deprecated and will not be supported in a future version of CUPS.
|
||||
<dt><b>-o cupsIPPSupplies=true</b>
|
||||
<dd style="margin-left: 5.0em"><dt><b>-o cupsIPPSupplies=false</b>
|
||||
<dd style="margin-left: 5.0em">Specifies whether IPP supply level values should be reported.
|
||||
|
||||
+24
-12
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Filter makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2012 by Apple Inc.
|
||||
# Copyright 2007-2017 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -29,6 +29,7 @@ LIBTARGETS = \
|
||||
libcupsimage.a
|
||||
UNITTARGETS = \
|
||||
rasterbench \
|
||||
testclient \
|
||||
testraster
|
||||
TARGETS = \
|
||||
$(LIBTARGETS) \
|
||||
@@ -38,7 +39,7 @@ IMAGEOBJS = error.o interpret.o raster.o
|
||||
OBJS = $(IMAGEOBJS) \
|
||||
commandtops.o gziptoany.o common.o pstops.o \
|
||||
rasterbench.o rastertoepson.o rastertohp.o rastertolabel.o \
|
||||
rastertopwg.o testraster.o
|
||||
rastertopwg.o testclient.o testraster.o
|
||||
|
||||
|
||||
#
|
||||
@@ -216,7 +217,7 @@ apihelp:
|
||||
|
||||
commandtops: commandtops.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ commandtops.o $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ commandtops.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -225,7 +226,7 @@ commandtops: commandtops.o ../cups/$(LIBCUPS)
|
||||
|
||||
gziptoany: gziptoany.o ../Makedefs ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ gziptoany.o $(LIBZ) $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ gziptoany.o $(LIBZ) $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -295,7 +296,7 @@ libcupsimage.a: $(IMAGEOBJS)
|
||||
|
||||
pstops: pstops.o common.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ pstops.o common.o $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ pstops.o common.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -304,7 +305,7 @@ pstops: pstops.o common.o ../cups/$(LIBCUPS)
|
||||
|
||||
rastertoepson: rastertoepson.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ rastertoepson.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ rastertoepson.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -313,7 +314,7 @@ rastertoepson: rastertoepson.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
|
||||
|
||||
rastertohp: rastertohp.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ rastertohp.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ rastertohp.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -322,7 +323,7 @@ rastertohp: rastertohp.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
|
||||
|
||||
rastertolabel: rastertolabel.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ rastertolabel.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ rastertolabel.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
@@ -331,22 +332,33 @@ rastertolabel: rastertolabel.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
|
||||
|
||||
rastertopwg: rastertopwg.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ rastertopwg.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ rastertopwg.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
|
||||
|
||||
rastertopwg-static: rastertopwg.o ../cups/$(LIBCUPSSTATIC) libcupsimage.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ rastertopwg.o libcupsimage.a \
|
||||
$(LD_CC) $(LDFLAGS) -o $@ rastertopwg.o libcupsimage.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(IMGLIBS) $(DSOLIBS) $(COMMONLIBS) \
|
||||
$(SSLLIBS) $(DNSSDLIBS) $(LIBGSSAPI)
|
||||
|
||||
|
||||
#
|
||||
# testclient (dependency on static libraries is intentional)
|
||||
#
|
||||
|
||||
testclient: testclient.o ../cups/$(LIBCUPSSTATIC) libcupsimage.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o $@ testclient.o \
|
||||
libcupsimage.a ../cups/$(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testraster
|
||||
#
|
||||
|
||||
testraster: testraster.o ../cups/$(LIBCUPSSTATIC) libcupsimage.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testraster.o libcupsimage.a \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testraster.o libcupsimage.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(IMGLIBS) $(DSOLIBS) $(COMMONLIBS) \
|
||||
$(SSLLIBS) $(DNSSDLIBS) $(LIBGSSAPI)
|
||||
echo Running raster API tests...
|
||||
@@ -359,7 +371,7 @@ testraster: testraster.o ../cups/$(LIBCUPSSTATIC) libcupsimage.a
|
||||
|
||||
rasterbench: rasterbench.o libcupsimage.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ rasterbench.o libcupsimage.a $(LIBS)
|
||||
$(LD_CC) $(LDFLAGS) -o $@ rasterbench.o libcupsimage.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
|
||||
+229
-39
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Raster file routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 2007-2018 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* This file is part of the CUPS Imaging library.
|
||||
@@ -50,11 +50,96 @@ struct _cups_raster_s /**** Raster stream data ****/
|
||||
*bufend; /* End of current (read) buffer */
|
||||
size_t bufsize; /* Buffer size */
|
||||
#ifdef DEBUG
|
||||
size_t iocount; /* Number of bytes read/written */
|
||||
size_t iostart, /* Start of read/write buffer */
|
||||
iocount; /* Number of bytes read/written */
|
||||
#endif /* DEBUG */
|
||||
unsigned apple_page_count;/* Apple raster page count */
|
||||
};
|
||||
|
||||
typedef void (*_cups_copyfunc_t)(void *dst, const void *src, size_t bytes);
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char * const cups_color_spaces[] =
|
||||
{ /* Color spaces */
|
||||
"CUPS_CSPACE_W",
|
||||
"CUPS_CSPACE_RGB",
|
||||
"CUPS_CSPACE_RGBA",
|
||||
"CUPS_CSPACE_K",
|
||||
"CUPS_CSPACE_CMY",
|
||||
"CUPS_CSPACE_YMC",
|
||||
"CUPS_CSPACE_CMYK",
|
||||
"CUPS_CSPACE_YMCK",
|
||||
"CUPS_CSPACE_KCMY",
|
||||
"CUPS_CSPACE_KCMYcm",
|
||||
"CUPS_CSPACE_GMCK",
|
||||
"CUPS_CSPACE_GMCS",
|
||||
"CUPS_CSPACE_WHITE",
|
||||
"CUPS_CSPACE_GOLD",
|
||||
"CUPS_CSPACE_SILVER",
|
||||
"CUPS_CSPACE_CIEXYZ",
|
||||
"CUPS_CSPACE_CIELab",
|
||||
"CUPS_CSPACE_RGBW",
|
||||
"CUPS_CSPACE_SW",
|
||||
"CUPS_CSPACE_SRGB",
|
||||
"CUPS_CSPACE_ADOBERGB",
|
||||
"21",
|
||||
"22",
|
||||
"23",
|
||||
"24",
|
||||
"25",
|
||||
"26",
|
||||
"27",
|
||||
"28",
|
||||
"29",
|
||||
"30",
|
||||
"31",
|
||||
"CUPS_CSPACE_ICC1",
|
||||
"CUPS_CSPACE_ICC2",
|
||||
"CUPS_CSPACE_ICC3",
|
||||
"CUPS_CSPACE_ICC4",
|
||||
"CUPS_CSPACE_ICC5",
|
||||
"CUPS_CSPACE_ICC6",
|
||||
"CUPS_CSPACE_ICC7",
|
||||
"CUPS_CSPACE_ICC8",
|
||||
"CUPS_CSPACE_ICC9",
|
||||
"CUPS_CSPACE_ICCA",
|
||||
"CUPS_CSPACE_ICCB",
|
||||
"CUPS_CSPACE_ICCC",
|
||||
"CUPS_CSPACE_ICCD",
|
||||
"CUPS_CSPACE_ICCE",
|
||||
"CUPS_CSPACE_ICCF",
|
||||
"47",
|
||||
"CUPS_CSPACE_DEVICE1",
|
||||
"CUPS_CSPACE_DEVICE2",
|
||||
"CUPS_CSPACE_DEVICE3",
|
||||
"CUPS_CSPACE_DEVICE4",
|
||||
"CUPS_CSPACE_DEVICE5",
|
||||
"CUPS_CSPACE_DEVICE6",
|
||||
"CUPS_CSPACE_DEVICE7",
|
||||
"CUPS_CSPACE_DEVICE8",
|
||||
"CUPS_CSPACE_DEVICE9",
|
||||
"CUPS_CSPACE_DEVICEA",
|
||||
"CUPS_CSPACE_DEVICEB",
|
||||
"CUPS_CSPACE_DEVICEC",
|
||||
"CUPS_CSPACE_DEVICED",
|
||||
"CUPS_CSPACE_DEVICEE",
|
||||
"CUPS_CSPACE_DEVICEF"
|
||||
};
|
||||
static const char * const cups_modes[] =
|
||||
{ /* Open modes */
|
||||
"CUPS_RASTER_READ",
|
||||
"CUPS_RASTER_WRITE",
|
||||
"CUPS_RASTER_WRITE_COMPRESSED",
|
||||
"CUPS_RASTER_WRITE_PWG",
|
||||
"CUPS_RASTER_WRITE_APPLE"
|
||||
};
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
@@ -62,13 +147,12 @@ struct _cups_raster_s /**** Raster stream data ****/
|
||||
|
||||
static ssize_t cups_raster_io(cups_raster_t *r, unsigned char *buf, size_t bytes);
|
||||
static unsigned cups_raster_read_header(cups_raster_t *r);
|
||||
static ssize_t cups_raster_read(cups_raster_t *r, unsigned char *buf,
|
||||
size_t bytes);
|
||||
static ssize_t cups_raster_read(cups_raster_t *r, unsigned char *buf, size_t bytes);
|
||||
static int cups_raster_update(cups_raster_t *r);
|
||||
static ssize_t cups_raster_write(cups_raster_t *r,
|
||||
const unsigned char *pixels);
|
||||
static ssize_t cups_raster_write(cups_raster_t *r, const unsigned char *pixels);
|
||||
static ssize_t cups_read_fd(void *ctx, unsigned char *buf, size_t bytes);
|
||||
static void cups_swap(unsigned char *buf, size_t bytes);
|
||||
static void cups_swap_copy(unsigned char *dst, const unsigned char *src, size_t bytes);
|
||||
static ssize_t cups_write_fd(void *ctx, unsigned char *buf, size_t bytes);
|
||||
|
||||
|
||||
@@ -356,6 +440,8 @@ cupsRasterOpen(int fd, /* I - File descriptor */
|
||||
@code CUPS_RASTER_WRITE_COMPRESSED@,
|
||||
or @code CUPS_RASTER_WRITE_PWG@ */
|
||||
{
|
||||
DEBUG_printf(("cupsRasterOpen(fd=%d, mode=%s)", fd, cups_modes[mode]));
|
||||
|
||||
if (mode == CUPS_RASTER_READ)
|
||||
return (cupsRasterOpenIO(cups_read_fd, (void *)((intptr_t)fd), mode));
|
||||
else
|
||||
@@ -387,12 +473,15 @@ cupsRasterOpenIO(
|
||||
cups_raster_t *r; /* New stream */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsRasterOpenIO(iocb=%p, ctx=%p, mode=%s)", (void *)iocb, ctx, cups_modes[mode]));
|
||||
|
||||
_cupsRasterClearError();
|
||||
|
||||
if ((r = calloc(sizeof(cups_raster_t), 1)) == NULL)
|
||||
{
|
||||
_cupsRasterAddError("Unable to allocate memory for raster stream: %s\n",
|
||||
strerror(errno));
|
||||
DEBUG_puts("1cupsRasterOpenIO: Returning NULL.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -412,6 +501,7 @@ cupsRasterOpenIO(
|
||||
_cupsRasterAddError("Unable to read header from raster stream: %s\n",
|
||||
strerror(errno));
|
||||
free(r);
|
||||
DEBUG_puts("1cupsRasterOpenIO: Unable to read header, returning NULL.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -426,6 +516,7 @@ cupsRasterOpenIO(
|
||||
{
|
||||
_cupsRasterAddError("Unknown raster format %08x!\n", r->sync);
|
||||
free(r);
|
||||
DEBUG_puts("1cupsRasterOpenIO: Unknown format, returning NULL.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -435,6 +526,8 @@ cupsRasterOpenIO(
|
||||
r->sync == CUPS_RASTER_REVSYNCapple)
|
||||
r->compressed = 1;
|
||||
|
||||
DEBUG_printf(("1cupsRasterOpenIO: sync=%08x", r->sync));
|
||||
|
||||
if (r->sync == CUPS_RASTER_REVSYNC ||
|
||||
r->sync == CUPS_RASTER_REVSYNCv1 ||
|
||||
r->sync == CUPS_RASTER_REVSYNCv2 ||
|
||||
@@ -452,12 +545,14 @@ cupsRasterOpenIO(
|
||||
_cupsRasterAddError("Unable to read header from raster stream: %s\n",
|
||||
strerror(errno));
|
||||
free(r);
|
||||
DEBUG_puts("1cupsRasterOpenIO: Unable to read header, returning NULL.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DEBUG_printf(("1cupsRasterOpenIO: r->swapped=%d, r->sync=%08x\n", r->swapped, r->sync));
|
||||
#ifdef DEBUG
|
||||
r->iostart = r->iocount;
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -496,10 +591,13 @@ cupsRasterOpenIO(
|
||||
_cupsRasterAddError("Unable to write raster stream header: %s\n",
|
||||
strerror(errno));
|
||||
free(r);
|
||||
DEBUG_puts("1cupsRasterOpenIO: Unable to write header, returning NULL.");
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_printf(("1cupsRasterOpenIO: compressed=%d, swapped=%d, returning %p", r->compressed, r->swapped, (void *)r));
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
@@ -522,6 +620,8 @@ cupsRasterReadHeader(
|
||||
cups_raster_t *r, /* I - Raster stream */
|
||||
cups_page_header_t *h) /* I - Pointer to header data */
|
||||
{
|
||||
DEBUG_printf(("cupsRasterReadHeader(r=%p, h=%p)", (void *)r, (void *)h));
|
||||
|
||||
/*
|
||||
* Get the raster header...
|
||||
*/
|
||||
@@ -529,6 +629,7 @@ cupsRasterReadHeader(
|
||||
if (!cups_raster_read_header(r))
|
||||
{
|
||||
memset(h, 0, sizeof(cups_page_header_t));
|
||||
DEBUG_puts("1cupsRasterReadHeader: Unable to read page header, returning 0.");
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -538,6 +639,14 @@ cupsRasterReadHeader(
|
||||
|
||||
memcpy(h, &(r->header), sizeof(cups_page_header_t));
|
||||
|
||||
DEBUG_printf(("1cupsRasterReadHeader: cupsColorSpace=%s", cups_color_spaces[h->cupsColorSpace]));
|
||||
DEBUG_printf(("1cupsRasterReadHeader: cupsBitsPerColor=%u", h->cupsBitsPerColor));
|
||||
DEBUG_printf(("1cupsRasterReadHeader: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
|
||||
DEBUG_printf(("1cupsRasterReadHeader: cupsBytesPerLine=%u", h->cupsBytesPerLine));
|
||||
DEBUG_printf(("1cupsRasterReadHeader: cupsWidth=%u", h->cupsWidth));
|
||||
DEBUG_printf(("1cupsRasterReadHeader: cupsHeight=%u", h->cupsHeight));
|
||||
|
||||
DEBUG_puts("1cupsRasterReadHeader: Returning 1.");
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -563,6 +672,7 @@ cupsRasterReadHeader2(
|
||||
if (!cups_raster_read_header(r))
|
||||
{
|
||||
memset(h, 0, sizeof(cups_page_header2_t));
|
||||
DEBUG_puts("1cupsRasterReadHeader2: Unable to read header, returning 0.");
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -572,6 +682,14 @@ cupsRasterReadHeader2(
|
||||
|
||||
memcpy(h, &(r->header), sizeof(cups_page_header2_t));
|
||||
|
||||
DEBUG_printf(("1cupsRasterReadHeader2: cupsColorSpace=%s", cups_color_spaces[h->cupsColorSpace]));
|
||||
DEBUG_printf(("1cupsRasterReadHeader2: cupsBitsPerColor=%u", h->cupsBitsPerColor));
|
||||
DEBUG_printf(("1cupsRasterReadHeader2: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
|
||||
DEBUG_printf(("1cupsRasterReadHeader2: cupsBytesPerLine=%u", h->cupsBytesPerLine));
|
||||
DEBUG_printf(("1cupsRasterReadHeader2: cupsWidth=%u", h->cupsWidth));
|
||||
DEBUG_printf(("1cupsRasterReadHeader2: cupsHeight=%u", h->cupsHeight));
|
||||
|
||||
DEBUG_puts("1cupsRasterReadHeader2: Returning 1.");
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -777,7 +895,10 @@ cupsRasterReadPixels(cups_raster_t *r, /* I - Raster stream */
|
||||
r->header.cupsBitsPerPixel == 12 ||
|
||||
r->header.cupsBitsPerPixel == 16) &&
|
||||
r->swapped)
|
||||
cups_swap(ptr, (size_t)bytes);
|
||||
{
|
||||
DEBUG_puts("1cupsRasterReadPixels: Swapping bytes.");
|
||||
cups_swap(ptr, (size_t)cupsBytesPerLine);
|
||||
}
|
||||
|
||||
/*
|
||||
* Update pointers...
|
||||
@@ -847,8 +968,20 @@ cupsRasterWriteHeader(
|
||||
cups_raster_t *r, /* I - Raster stream */
|
||||
cups_page_header_t *h) /* I - Raster page header */
|
||||
{
|
||||
DEBUG_printf(("cupsRasterWriteHeader(r=%p, h=%p)", (void *)r, (void *)h));
|
||||
|
||||
if (r == NULL || r->mode == CUPS_RASTER_READ)
|
||||
{
|
||||
DEBUG_puts("1cupsRasterWriteHeader: Returning 0.");
|
||||
return (0);
|
||||
}
|
||||
|
||||
DEBUG_printf(("1cupsRasterWriteHeader: cupsColorSpace=%s", cups_color_spaces[h->cupsColorSpace]));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader: cupsBitsPerColor=%u", h->cupsBitsPerColor));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader: cupsBytesPerLine=%u", h->cupsBytesPerLine));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader: cupsWidth=%u", h->cupsWidth));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader: cupsHeight=%u", h->cupsHeight));
|
||||
|
||||
/*
|
||||
* Make a copy of the header, and compute the number of raster
|
||||
@@ -859,7 +992,20 @@ cupsRasterWriteHeader(
|
||||
memcpy(&(r->header), h, sizeof(cups_page_header_t));
|
||||
|
||||
if (!cups_raster_update(r))
|
||||
{
|
||||
DEBUG_puts("1cupsRasterWriteHeader: Unable to update parameters, returning 0.");
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (r->mode == CUPS_RASTER_WRITE_APPLE)
|
||||
{
|
||||
r->rowheight = h->HWResolution[0] / h->HWResolution[1];
|
||||
|
||||
if (h->HWResolution[0] != (r->rowheight * h->HWResolution[1]))
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
r->rowheight = 1;
|
||||
|
||||
/*
|
||||
* Write the raster header...
|
||||
@@ -1019,8 +1165,20 @@ cupsRasterWriteHeader2(
|
||||
cups_raster_t *r, /* I - Raster stream */
|
||||
cups_page_header2_t *h) /* I - Raster page header */
|
||||
{
|
||||
DEBUG_printf(("cupsRasterWriteHeader(r=%p, h=%p)", (void *)r, (void *)h));
|
||||
|
||||
if (r == NULL || r->mode == CUPS_RASTER_READ)
|
||||
{
|
||||
DEBUG_puts("1cupsRasterWriteHeader2: Returning 0.");
|
||||
return (0);
|
||||
}
|
||||
|
||||
DEBUG_printf(("1cupsRasterWriteHeader2: cupsColorSpace=%s", cups_color_spaces[h->cupsColorSpace]));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader2: cupsBitsPerColor=%u", h->cupsBitsPerColor));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader2: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader2: cupsBytesPerLine=%u", h->cupsBytesPerLine));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader2: cupsWidth=%u", h->cupsWidth));
|
||||
DEBUG_printf(("1cupsRasterWriteHeader2: cupsHeight=%u", h->cupsHeight));
|
||||
|
||||
/*
|
||||
* Make a copy of the header, and compute the number of raster
|
||||
@@ -1030,7 +1188,10 @@ cupsRasterWriteHeader2(
|
||||
memcpy(&(r->header), h, sizeof(cups_page_header2_t));
|
||||
|
||||
if (!cups_raster_update(r))
|
||||
{
|
||||
DEBUG_puts("1cupsRasterWriteHeader: Unable to update parameters, returning 0.");
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (r->mode == CUPS_RASTER_WRITE_APPLE)
|
||||
{
|
||||
@@ -1202,7 +1363,6 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */
|
||||
r->header.cupsBitsPerPixel == 16))
|
||||
{
|
||||
unsigned char *bufptr; /* Pointer into write buffer */
|
||||
unsigned count; /* Remaining count */
|
||||
|
||||
/*
|
||||
* Allocate a write buffer as needed...
|
||||
@@ -1223,21 +1383,10 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */
|
||||
}
|
||||
|
||||
/*
|
||||
* Byte swap the pixels...
|
||||
* Byte swap the pixels and write them...
|
||||
*/
|
||||
|
||||
for (bufptr = r->buffer, count = len; count > 1; count -= 2, bufptr += 2)
|
||||
{
|
||||
bufptr[1] = *p++;
|
||||
bufptr[0] = *p++;
|
||||
}
|
||||
|
||||
if (count) /* This should never happen... */
|
||||
*bufptr = *p;
|
||||
|
||||
/*
|
||||
* Write the byte-swapped buffer...
|
||||
*/
|
||||
cups_swap_copy(r->buffer, p, len);
|
||||
|
||||
bytes = cups_raster_io(r, r->buffer, len);
|
||||
}
|
||||
@@ -1368,7 +1517,7 @@ cups_raster_read_header(
|
||||
size_t len; /* Length for read/swap */
|
||||
|
||||
|
||||
DEBUG_printf(("3cups_raster_read_header(r=%p), r->mode=%d", (void *)r, r ? r->mode : 0));
|
||||
DEBUG_printf(("3cups_raster_read_header(r=%p), r->mode=%s", (void *)r, r ? cups_modes[r->mode] : ""));
|
||||
|
||||
if (r == NULL || r->mode != CUPS_RASTER_READ)
|
||||
return (0);
|
||||
@@ -1523,10 +1672,7 @@ cups_raster_io(cups_raster_t *r, /* I - Raster stream */
|
||||
|
||||
DEBUG_printf(("6cups_raster_io: count=%d, total=%d", (int)count, (int)total));
|
||||
if (count == 0)
|
||||
{
|
||||
DEBUG_puts("6cups_raster_io: Returning 0.");
|
||||
return (0);
|
||||
}
|
||||
break;
|
||||
else if (count < 0)
|
||||
{
|
||||
DEBUG_puts("6cups_raster_io: Returning -1 on error.");
|
||||
@@ -1538,6 +1684,7 @@ cups_raster_io(cups_raster_t *r, /* I - Raster stream */
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
DEBUG_printf(("6cups_raster_io: iocount=" CUPS_LLFMT, CUPS_LLCAST r->iocount));
|
||||
DEBUG_printf(("6cups_raster_io: Returning " CUPS_LLFMT ".", CUPS_LLCAST total));
|
||||
|
||||
return (total);
|
||||
@@ -1558,7 +1705,7 @@ cups_raster_read(cups_raster_t *r, /* I - Raster stream */
|
||||
total; /* Total bytes read */
|
||||
|
||||
|
||||
DEBUG_printf(("5cups_raster_read(r=%p, buf=%p, bytes=" CUPS_LLFMT ")", (void *)r, (void *)buf, CUPS_LLCAST bytes));
|
||||
DEBUG_printf(("4cups_raster_read(r=%p, buf=%p, bytes=" CUPS_LLFMT "), offset=" CUPS_LLFMT, (void *)r, (void *)buf, CUPS_LLCAST bytes, CUPS_LLCAST (r->iostart + r->bufptr - r->buffer)));
|
||||
|
||||
if (!r->compressed)
|
||||
return (cups_raster_io(r, buf, bytes));
|
||||
@@ -1602,7 +1749,7 @@ cups_raster_read(cups_raster_t *r, /* I - Raster stream */
|
||||
{
|
||||
count = (ssize_t)bytes - total;
|
||||
|
||||
DEBUG_printf(("6cups_raster_read: count=" CUPS_LLFMT ", remaining=" CUPS_LLFMT ", buf=%p, bufptr=%p, bufend=%p", CUPS_LLCAST count, CUPS_LLCAST remaining, (void *)buf, (void *)r->bufptr, (void *)r->bufend));
|
||||
DEBUG_printf(("5cups_raster_read: count=" CUPS_LLFMT ", remaining=" CUPS_LLFMT ", buf=%p, bufptr=%p, bufend=%p", CUPS_LLCAST count, CUPS_LLCAST remaining, (void *)buf, (void *)r->bufptr, (void *)r->bufend));
|
||||
|
||||
if (remaining == 0)
|
||||
{
|
||||
@@ -1612,6 +1759,10 @@ cups_raster_read(cups_raster_t *r, /* I - Raster stream */
|
||||
* Read into the raster buffer and then copy...
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
r->iostart += (size_t)(r->bufend - r->buffer);
|
||||
#endif /* DEBUG */
|
||||
|
||||
remaining = (*r->iocb)(r->ctx, r->buffer, r->bufsize);
|
||||
if (remaining <= 0)
|
||||
return (0);
|
||||
@@ -1635,6 +1786,7 @@ cups_raster_read(cups_raster_t *r, /* I - Raster stream */
|
||||
return (0);
|
||||
|
||||
#ifdef DEBUG
|
||||
r->iostart += (size_t)count;
|
||||
r->iocount += (size_t)count;
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -1687,7 +1839,7 @@ cups_raster_read(cups_raster_t *r, /* I - Raster stream */
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_printf(("6cups_raster_read: Returning %ld", (long)total));
|
||||
DEBUG_printf(("5cups_raster_read: Returning %ld", (long)total));
|
||||
|
||||
return (total);
|
||||
}
|
||||
@@ -1850,11 +2002,24 @@ cups_raster_write(
|
||||
unsigned char *wptr; /* Pointer into write buffer */
|
||||
unsigned bpp, /* Bytes per pixel */
|
||||
count; /* Count */
|
||||
_cups_copyfunc_t cf; /* Copy function */
|
||||
|
||||
|
||||
DEBUG_printf(("3cups_raster_write(r=%p, pixels=%p)", (void *)r, (void *)pixels));
|
||||
|
||||
/*
|
||||
* Determine whether we need to swap bytes...
|
||||
*/
|
||||
|
||||
if (r->swapped && (r->header.cupsBitsPerColor == 16 || r->header.cupsBitsPerPixel == 12 || r->header.cupsBitsPerPixel == 16))
|
||||
{
|
||||
DEBUG_puts("4cups_raster_write: Swapping bytes when writing.");
|
||||
cf = (_cups_copyfunc_t)cups_swap_copy;
|
||||
}
|
||||
else
|
||||
cf = (_cups_copyfunc_t)memcpy;
|
||||
|
||||
/*
|
||||
* Allocate a write buffer as needed...
|
||||
*/
|
||||
|
||||
@@ -1905,8 +2070,8 @@ cups_raster_write(
|
||||
*/
|
||||
|
||||
*wptr++ = 0;
|
||||
for (count = bpp; count > 0; count --)
|
||||
*wptr++ = *start++;
|
||||
(*cf)(wptr, start, bpp);
|
||||
wptr += bpp;
|
||||
}
|
||||
else if (!memcmp(start, ptr, bpp))
|
||||
{
|
||||
@@ -1919,8 +2084,9 @@ cups_raster_write(
|
||||
break;
|
||||
|
||||
*wptr++ = (unsigned char)(count - 1);
|
||||
for (count = bpp; count > 0; count --)
|
||||
*wptr++ = *ptr++;
|
||||
(*cf)(wptr, ptr, bpp);
|
||||
wptr += bpp;
|
||||
ptr += bpp;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1941,7 +2107,7 @@ cups_raster_write(
|
||||
*wptr++ = (unsigned char)(257 - count);
|
||||
|
||||
count *= bpp;
|
||||
memcpy(wptr, start, count);
|
||||
(*cf)(wptr, start, count);
|
||||
wptr += count;
|
||||
}
|
||||
}
|
||||
@@ -1973,11 +2139,11 @@ cups_read_fd(void *ctx, /* I - File descriptor as pointer */
|
||||
#endif /* WIN32 */
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
DEBUG_printf(("4cups_read_fd: %s", strerror(errno)));
|
||||
DEBUG_printf(("8cups_read_fd: %s", strerror(errno)));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
DEBUG_printf(("4cups_read_fd: Returning %d bytes.", (int)count));
|
||||
DEBUG_printf(("8cups_read_fd: Returning %d bytes.", (int)count));
|
||||
|
||||
return (count);
|
||||
}
|
||||
@@ -2009,6 +2175,30 @@ cups_swap(unsigned char *buf, /* I - Buffer to swap */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_swap_copy()' - Copy and swap bytes in raster data...
|
||||
*/
|
||||
|
||||
static void
|
||||
cups_swap_copy(
|
||||
unsigned char *dst, /* I - Destination */
|
||||
const unsigned char *src, /* I - Source */
|
||||
size_t bytes) /* I - Number of bytes to swap */
|
||||
{
|
||||
bytes /= 2;
|
||||
|
||||
while (bytes > 0)
|
||||
{
|
||||
dst[0] = src[1];
|
||||
dst[1] = src[0];
|
||||
|
||||
dst += 2;
|
||||
src += 2;
|
||||
bytes --;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_write_fd()' - Write bytes to a file.
|
||||
*/
|
||||
@@ -2030,7 +2220,7 @@ cups_write_fd(void *ctx, /* I - File descriptor pointer */
|
||||
#endif /* WIN32 */
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
DEBUG_printf(("4cups_write_fd: %s", strerror(errno)));
|
||||
DEBUG_printf(("8cups_write_fd: %s", strerror(errno)));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,960 @@
|
||||
/*
|
||||
* Simulated client test program for CUPS.
|
||||
*
|
||||
* Copyright 2017 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/raster.h>
|
||||
#include <cups/string-private.h>
|
||||
#include <cups/thread-private.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local types...
|
||||
*/
|
||||
|
||||
typedef struct _client_monitor_s
|
||||
{
|
||||
const char *uri, /* Printer URI */
|
||||
*hostname, /* Hostname */
|
||||
*user, /* Username */
|
||||
*resource; /* Resource path */
|
||||
int port; /* Port number */
|
||||
http_encryption_t encryption; /* Use encryption? */
|
||||
ipp_pstate_t printer_state; /* Current printer state */
|
||||
char printer_state_reasons[1024];
|
||||
/* Current printer-state-reasons */
|
||||
int job_id; /* Job ID for submitted job */
|
||||
ipp_jstate_t job_state; /* Current job state */
|
||||
char job_state_reasons[1024];
|
||||
/* Current job-state-reasons */
|
||||
} _client_monitor_t;
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static const char *make_raster_file(ipp_t *response, int grayscale, char *tempname, size_t tempsize, const char **format);
|
||||
static void *monitor_printer(_client_monitor_t *monitor);
|
||||
static void show_attributes(const char *title, int request, ipp_t *ipp);
|
||||
static void show_capabilities(ipp_t *response);
|
||||
static void usage(void);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
const char *opt, /* Current option */
|
||||
*uri = NULL, /* Printer URI */
|
||||
*printfile = NULL,
|
||||
/* Print file */
|
||||
*printformat = NULL;
|
||||
/* Print format */
|
||||
int keepfile = 0, /* Keep temp file? */
|
||||
grayscale = 0, /* Force grayscale? */
|
||||
verbosity = 0; /* Verbosity */
|
||||
char tempfile[1024] = "",
|
||||
/* Temporary file (if any) */
|
||||
scheme[32], /* URI scheme */
|
||||
userpass[256], /* Username:password */
|
||||
hostname[256], /* Hostname */
|
||||
resource[256]; /* Resource path */
|
||||
int port; /* Port number */
|
||||
http_encryption_t encryption; /* Encryption mode */
|
||||
_client_monitor_t monitor; /* Monitoring data */
|
||||
http_t *http; /* HTTP connection */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
static const char * const pattrs[] = /* Printer attributes we are interested in */
|
||||
{
|
||||
"job-template",
|
||||
"printer-defaults",
|
||||
"printer-description",
|
||||
"media-col-database",
|
||||
"media-col-ready"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Parse command-line options...
|
||||
*/
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
{
|
||||
if (argv[i][0] == '-')
|
||||
{
|
||||
for (opt = argv[i] + 1; *opt; opt ++)
|
||||
{
|
||||
switch (*opt)
|
||||
{
|
||||
case 'd' : /* -d document-format */
|
||||
if (printformat)
|
||||
{
|
||||
puts("Document format can only be specified once.");
|
||||
usage();
|
||||
return (1);
|
||||
}
|
||||
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
puts("Expected document format after '-d'.");
|
||||
usage();
|
||||
return (1);
|
||||
}
|
||||
|
||||
printformat = argv[i];
|
||||
break;
|
||||
|
||||
case 'f' : /* -f print-file */
|
||||
if (printfile)
|
||||
{
|
||||
puts("Print file can only be specified once.");
|
||||
usage();
|
||||
return (1);
|
||||
}
|
||||
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
puts("Expected print file after '-f'.");
|
||||
usage();
|
||||
return (1);
|
||||
}
|
||||
|
||||
printfile = argv[i];
|
||||
break;
|
||||
|
||||
case 'g' :
|
||||
grayscale = 1;
|
||||
break;
|
||||
|
||||
case 'k' :
|
||||
keepfile = 1;
|
||||
break;
|
||||
|
||||
case 'v' :
|
||||
verbosity ++;
|
||||
break;
|
||||
|
||||
default :
|
||||
printf("Unknown option '-%c'.\n", *opt);
|
||||
usage();
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (uri || (strncmp(argv[i], "ipp://", 6) && strncmp(argv[i], "ipps://", 7)))
|
||||
{
|
||||
printf("Unknown command-line argument '%s'.\n", argv[i]);
|
||||
usage();
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
uri = argv[i];
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure we have everything we need.
|
||||
*/
|
||||
|
||||
if (!uri)
|
||||
{
|
||||
puts("Expected printer URI.");
|
||||
usage();
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Connect to the printer...
|
||||
*/
|
||||
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass, sizeof(userpass), hostname, sizeof(hostname), &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK)
|
||||
{
|
||||
printf("Bad printer URI '%s'.\n", uri);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (!port)
|
||||
port = IPP_PORT;
|
||||
|
||||
if (!strcmp(scheme, "https") || !strcmp(scheme, "ipps"))
|
||||
encryption = HTTP_ENCRYPTION_ALWAYS;
|
||||
else
|
||||
encryption = HTTP_ENCRYPTION_IF_REQUESTED;
|
||||
|
||||
if ((http = httpConnect2(hostname, port, NULL, AF_UNSPEC, encryption, 1, 0, NULL)) == NULL)
|
||||
{
|
||||
printf("Unable to connect to '%s' on port %d: %s\n", hostname, port, cupsLastErrorString());
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Query printer status and capabilities...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
|
||||
|
||||
response = cupsDoRequest(http, request, resource);
|
||||
|
||||
if (verbosity)
|
||||
show_capabilities(response);
|
||||
|
||||
/*
|
||||
* Now figure out what we will be printing...
|
||||
*/
|
||||
|
||||
if (printfile)
|
||||
{
|
||||
/*
|
||||
* User specified a print file, figure out the format...
|
||||
*/
|
||||
|
||||
if ((opt = strrchr(printfile, '.')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Guess the format from the extension...
|
||||
*/
|
||||
|
||||
if (!strcmp(opt, ".jpg"))
|
||||
printformat = "image/jpeg";
|
||||
else if (!strcmp(opt, ".pdf"))
|
||||
printformat = "application/pdf";
|
||||
else if (!strcmp(opt, ".ps"))
|
||||
printformat = "application/postscript";
|
||||
else if (!strcmp(opt, ".pwg"))
|
||||
printformat = "image/pwg-raster";
|
||||
else if (!strcmp(opt, ".urf"))
|
||||
printformat = "image/urf";
|
||||
else
|
||||
printformat = "application/octet-stream";
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Tell the printer to auto-detect...
|
||||
*/
|
||||
|
||||
printformat = "application/octet-stream";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* No file specified, make something to test with...
|
||||
*/
|
||||
|
||||
if ((printfile = make_raster_file(response, grayscale, tempfile, sizeof(tempfile), &printformat)) == NULL)
|
||||
return (1);
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
/*
|
||||
* Start monitoring the printer in the background...
|
||||
*/
|
||||
|
||||
memset(&monitor, 0, sizeof(monitor));
|
||||
|
||||
monitor.uri = uri;
|
||||
monitor.hostname = hostname;
|
||||
monitor.resource = resource;
|
||||
monitor.port = port;
|
||||
monitor.encryption = encryption;
|
||||
|
||||
_cupsThreadCreate((_cups_thread_func_t)monitor_printer, &monitor);
|
||||
|
||||
/*
|
||||
* Create the job and wait for completion...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_OP_CREATE_JOB);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
|
||||
|
||||
if ((opt = strrchr(printfile, '/')) != NULL)
|
||||
opt ++;
|
||||
else
|
||||
opt = printfile;
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL, opt);
|
||||
|
||||
if (verbosity)
|
||||
show_attributes("Create-Job request", 1, request);
|
||||
|
||||
response = cupsDoRequest(http, request, resource);
|
||||
|
||||
if (verbosity)
|
||||
show_attributes("Create-Job response", 0, response);
|
||||
|
||||
if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
|
||||
{
|
||||
printf("Unable to create print job: %s\n", cupsLastErrorString());
|
||||
|
||||
monitor.job_state = IPP_JSTATE_ABORTED;
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) == NULL)
|
||||
{
|
||||
puts("No job-id returned in Create-Job request.");
|
||||
|
||||
monitor.job_state = IPP_JSTATE_ABORTED;
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
monitor.job_id = ippGetInteger(attr, 0);
|
||||
|
||||
printf("CREATED JOB %d, sending %s of type %s\n", monitor.job_id, printfile, printformat);
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
request = ippNewRequest(IPP_OP_SEND_DOCUMENT);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", monitor.job_id);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", NULL, printformat);
|
||||
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);
|
||||
|
||||
if (verbosity)
|
||||
show_attributes("Send-Document request", 1, request);
|
||||
|
||||
response = cupsDoFileRequest(http, request, resource, printfile);
|
||||
|
||||
if (verbosity)
|
||||
show_attributes("Send-Document response", 0, response);
|
||||
|
||||
if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
|
||||
{
|
||||
printf("Unable to print file: %s\n", cupsLastErrorString());
|
||||
|
||||
monitor.job_state = IPP_JSTATE_ABORTED;
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
puts("WAITING FOR JOB TO COMPLETE");
|
||||
|
||||
while (monitor.job_state < IPP_JSTATE_CANCELED)
|
||||
sleep(1);
|
||||
|
||||
/*
|
||||
* Cleanup after ourselves...
|
||||
*/
|
||||
|
||||
cleanup:
|
||||
|
||||
httpClose(http);
|
||||
|
||||
if (tempfile[0] && !keepfile)
|
||||
unlink(tempfile);
|
||||
|
||||
return (monitor.job_state == IPP_JSTATE_COMPLETED);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'make_raster_file()' - Create a temporary raster file.
|
||||
*/
|
||||
|
||||
static const char * /* O - Print filename */
|
||||
make_raster_file(ipp_t *response, /* I - Printer attributes */
|
||||
int grayscale, /* I - Force grayscale? */
|
||||
char *tempname, /* I - Temporary filename buffer */
|
||||
size_t tempsize, /* I - Size of temp file buffer */
|
||||
const char **format) /* O - Print format */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
count; /* Number of values */
|
||||
ipp_attribute_t *attr; /* Printer attribute */
|
||||
const char *type = NULL; /* Raster type (colorspace + bits) */
|
||||
pwg_media_t *media = NULL; /* Media size */
|
||||
int xdpi = 0, /* Horizontal resolution */
|
||||
ydpi = 0; /* Vertical resolution */
|
||||
int fd; /* Temporary file */
|
||||
cups_mode_t mode; /* Raster mode */
|
||||
cups_raster_t *ras; /* Raster stream */
|
||||
cups_page_header2_t header; /* Page header */
|
||||
unsigned char *line, /* Line of raster data */
|
||||
*lineptr; /* Pointer into line */
|
||||
unsigned y, /* Current position on page */
|
||||
xcount, ycount, /* Current count for X and Y */
|
||||
xrep, yrep, /* Repeat count for X and Y */
|
||||
xoff, yoff, /* Offsets for X and Y */
|
||||
yend; /* End Y value */
|
||||
int temprow, /* Row in template */
|
||||
tempcolor; /* Template color */
|
||||
const char *template; /* Pointer into template */
|
||||
const unsigned char *color; /* Current color */
|
||||
static const unsigned char colors[][3] =
|
||||
{ /* Colors for test */
|
||||
{ 191, 191, 191 },
|
||||
{ 127, 127, 127 },
|
||||
{ 63, 63, 63 },
|
||||
{ 0, 0, 0 },
|
||||
{ 255, 0, 0 },
|
||||
{ 255, 127, 0 },
|
||||
{ 255, 255, 0 },
|
||||
{ 127, 255, 0 },
|
||||
{ 0, 255, 0 },
|
||||
{ 0, 255, 127 },
|
||||
{ 0, 255, 255 },
|
||||
{ 0, 127, 255 },
|
||||
{ 0, 0, 255 },
|
||||
{ 127, 0, 255 },
|
||||
{ 255, 0, 255 }
|
||||
};
|
||||
static const char * const templates[] =
|
||||
{ /* Raster template */
|
||||
" CCC U U PPPP SSS TTTTT EEEEE SSS TTTTT 000 1 222 333 4 55555 66 77777 888 999 ",
|
||||
"C C U U P P S S T E S S T 0 0 11 2 2 3 3 4 4 5 6 7 8 8 9 9 ",
|
||||
"C U U P P S T E S T 0 0 1 2 3 4 4 5 6 7 8 8 9 9 ",
|
||||
"C U U PPPP SSS ----- T EEEE SSS T 0 0 0 1 22 333 44444 555 6666 7 888 9999 ",
|
||||
"C U U P S T E S T 0 0 1 2 3 4 5 6 6 7 8 8 9 ",
|
||||
"C C U U P S S T E S S T 0 0 1 2 3 3 4 5 5 6 6 7 8 8 9 ",
|
||||
" CCC UUU P SSS T EEEEE SSS T 000 111 22222 333 4 555 666 7 888 99 ",
|
||||
" "
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Figure out the output format...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(response, "document-format-supported", IPP_TAG_MIMETYPE)) == NULL)
|
||||
{
|
||||
puts("No supported document formats, aborting.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (*format)
|
||||
{
|
||||
if (!ippContainsString(attr, *format))
|
||||
{
|
||||
printf("Printer does not support document-format '%s'.\n", *format);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (!strcmp(*format, "image/urf"))
|
||||
mode = CUPS_RASTER_WRITE_APPLE;
|
||||
else if (!strcmp(*format, "image/pwg-raster"))
|
||||
mode = CUPS_RASTER_WRITE_PWG;
|
||||
else
|
||||
{
|
||||
printf("Unable to generate document-format '%s'.\n", *format);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
else if (ippContainsString(attr, "image/urf"))
|
||||
{
|
||||
/*
|
||||
* Apple Raster format...
|
||||
*/
|
||||
|
||||
*format = "image/urf";
|
||||
mode = CUPS_RASTER_WRITE_APPLE;
|
||||
}
|
||||
else if (ippContainsString(attr, "image/pwg-raster"))
|
||||
{
|
||||
/*
|
||||
* PWG Raster format...
|
||||
*/
|
||||
|
||||
*format = "image/pwg-raster";
|
||||
mode = CUPS_RASTER_WRITE_PWG;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* No supported raster format...
|
||||
*/
|
||||
|
||||
puts("Printer does not support Apple or PWG raster files, aborting.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Figure out the the media, resolution, and color mode...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(response, "media-default", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Use default media...
|
||||
*/
|
||||
|
||||
media = pwgMediaForPWG(ippGetString(attr, 0, NULL));
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "media-ready", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Use ready media...
|
||||
*/
|
||||
|
||||
if (ippContainsString(attr, "na_letter_8.5x11in"))
|
||||
media = pwgMediaForPWG("na_letter_8.5x11in");
|
||||
else if (ippContainsString(attr, "iso_a4_210x297mm"))
|
||||
media = pwgMediaForPWG("iso_a4_210x297mm");
|
||||
else
|
||||
media = pwgMediaForPWG(ippGetString(attr, 0, NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
puts("No default or ready media reported by printer, aborting.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (mode == CUPS_RASTER_WRITE_APPLE && (attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
for (i = 0, count = ippGetCount(attr); i < count; i ++)
|
||||
{
|
||||
const char *val = ippGetString(attr, i, NULL);
|
||||
|
||||
if (!strncmp(val, "RS", 2))
|
||||
xdpi = ydpi = atoi(val + 2);
|
||||
else if (!strncmp(val, "W8", 2) && !type)
|
||||
type = "sgray_8";
|
||||
else if (!strncmp(val, "SRGB24", 6) && !grayscale)
|
||||
type = "srgb_8";
|
||||
}
|
||||
}
|
||||
else if (mode == CUPS_RASTER_WRITE_PWG && (attr = ippFindAttribute(response, "pwg-raster-document-resolution-supported", IPP_TAG_RESOLUTION)) != NULL)
|
||||
{
|
||||
for (i = 0, count = ippGetCount(attr); i < count; i ++)
|
||||
{
|
||||
int tempxdpi, tempydpi;
|
||||
ipp_res_t tempunits;
|
||||
|
||||
tempxdpi = ippGetResolution(attr, 0, &tempydpi, &tempunits);
|
||||
|
||||
if (i == 0 || tempxdpi < xdpi || tempydpi < ydpi)
|
||||
{
|
||||
xdpi = tempxdpi;
|
||||
ydpi = tempydpi;
|
||||
}
|
||||
}
|
||||
|
||||
if ((attr = ippFindAttribute(response, "pwg-raster-document-type-supported", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
if (!grayscale && ippContainsString(attr, "srgb_8"))
|
||||
type = "srgb_8";
|
||||
else if (ippContainsString(attr, "sgray_8"))
|
||||
type = "sgray_8";
|
||||
}
|
||||
}
|
||||
|
||||
if (xdpi < 72 || ydpi < 72)
|
||||
{
|
||||
puts("No supported raster resolutions, aborting.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (!type)
|
||||
{
|
||||
puts("No supported color spaces or bit depths, aborting.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make the raster context and details...
|
||||
*/
|
||||
|
||||
if (!cupsRasterInitPWGHeader(&header, media, type, xdpi, ydpi, "one-sided", NULL))
|
||||
{
|
||||
printf("Unable to initialize raster context: %s\n", cupsRasterErrorString());
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
header.cupsInteger[CUPS_RASTER_PWG_TotalPageCount] = 1;
|
||||
|
||||
if (header.cupsWidth > (4 * header.HWResolution[0]))
|
||||
{
|
||||
xoff = header.HWResolution[0] / 2;
|
||||
yoff = header.HWResolution[1] / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
xoff = 0;
|
||||
yoff = 0;
|
||||
}
|
||||
|
||||
xrep = (header.cupsWidth - 2 * xoff) / 140;
|
||||
yrep = xrep * header.HWResolution[1] / header.HWResolution[0];
|
||||
yend = header.cupsHeight - yoff;
|
||||
|
||||
/*
|
||||
* Prepare the raster file...
|
||||
*/
|
||||
|
||||
if ((line = malloc(header.cupsBytesPerLine)) == NULL)
|
||||
{
|
||||
printf("Unable to allocate %u bytes for raster output: %s\n", header.cupsBytesPerLine, strerror(errno));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if ((fd = cupsTempFd(tempname, (int)tempsize)) < 0)
|
||||
{
|
||||
printf("Unable to create temporary print file: %s\n", strerror(errno));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if ((ras = cupsRasterOpen(fd, mode)) == NULL)
|
||||
{
|
||||
printf("Unable to open raster stream: %s\n", cupsRasterErrorString());
|
||||
close(fd);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a single page consisting of the template dots repeated over the page.
|
||||
*/
|
||||
|
||||
cupsRasterWriteHeader2(ras, &header);
|
||||
|
||||
memset(line, 0xff, header.cupsBytesPerLine);
|
||||
|
||||
for (y = 0; y < yoff; y ++)
|
||||
cupsRasterWritePixels(ras, line, header.cupsBytesPerLine);
|
||||
|
||||
for (temprow = 0, tempcolor = 0; y < yend;)
|
||||
{
|
||||
template = templates[temprow];
|
||||
color = colors[tempcolor];
|
||||
|
||||
temprow ++;
|
||||
if (temprow >= (int)(sizeof(templates) / sizeof(templates[0])))
|
||||
{
|
||||
temprow = 0;
|
||||
tempcolor ++;
|
||||
if (tempcolor >= (int)(sizeof(colors) / sizeof(colors[0])))
|
||||
tempcolor = 0;
|
||||
else if (tempcolor > 3 && header.cupsColorSpace == CUPS_CSPACE_SW)
|
||||
tempcolor = 0;
|
||||
}
|
||||
|
||||
memset(line, 0xff, header.cupsBytesPerLine);
|
||||
|
||||
if (header.cupsColorSpace == CUPS_CSPACE_SW)
|
||||
{
|
||||
/*
|
||||
* Do grayscale output...
|
||||
*/
|
||||
|
||||
for (lineptr = line + xoff; *template; template ++)
|
||||
{
|
||||
if (*template != ' ')
|
||||
{
|
||||
for (xcount = xrep; xcount > 0; xcount --)
|
||||
*lineptr++ = *color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lineptr += xrep;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Do color output...
|
||||
*/
|
||||
|
||||
for (lineptr = line + 3 * xoff; *template; template ++)
|
||||
{
|
||||
if (*template != ' ')
|
||||
{
|
||||
for (xcount = xrep; xcount > 0; xcount --, lineptr += 3)
|
||||
memcpy(lineptr, color, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineptr += 3 * xrep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ycount = yrep; ycount > 0 && y < yend; ycount --, y ++)
|
||||
cupsRasterWritePixels(ras, line, header.cupsBytesPerLine);
|
||||
}
|
||||
|
||||
memset(line, 0xff, header.cupsBytesPerLine);
|
||||
|
||||
for (y = 0; y < header.cupsHeight; y ++)
|
||||
cupsRasterWritePixels(ras, line, header.cupsBytesPerLine);
|
||||
|
||||
cupsRasterClose(ras);
|
||||
|
||||
close(fd);
|
||||
|
||||
printf("PRINT FILE: %s\n", tempname);
|
||||
|
||||
return (tempname);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'monitor_printer()' - Monitor the job and printer states.
|
||||
*/
|
||||
|
||||
static void * /* O - Thread exit code */
|
||||
monitor_printer(
|
||||
_client_monitor_t *monitor) /* I - Monitoring data */
|
||||
{
|
||||
http_t *http; /* Connection to printer */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* Attribute in response */
|
||||
ipp_pstate_t printer_state; /* Printer state */
|
||||
char printer_state_reasons[1024];
|
||||
/* Printer state reasons */
|
||||
ipp_jstate_t job_state; /* Job state */
|
||||
char job_state_reasons[1024];/* Printer state reasons */
|
||||
static const char * const jattrs[] = /* Job attributes we want */
|
||||
{
|
||||
"job-state",
|
||||
"job-state-reasons"
|
||||
};
|
||||
static const char * const pattrs[] = /* Printer attributes we want */
|
||||
{
|
||||
"printer-state",
|
||||
"printer-state-reasons"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Open a connection to the printer...
|
||||
*/
|
||||
|
||||
http = httpConnect2(monitor->hostname, monitor->port, NULL, AF_UNSPEC, monitor->encryption, 1, 0, NULL);
|
||||
|
||||
/*
|
||||
* Loop until the job is canceled, aborted, or completed.
|
||||
*/
|
||||
|
||||
printer_state = (ipp_pstate_t)0;
|
||||
printer_state_reasons[0] = '\0';
|
||||
|
||||
job_state = (ipp_jstate_t)0;
|
||||
job_state_reasons[0] = '\0';
|
||||
|
||||
while (monitor->job_state < IPP_JSTATE_CANCELED)
|
||||
{
|
||||
/*
|
||||
* Reconnect to the printer as needed...
|
||||
*/
|
||||
|
||||
if (httpGetFd(http) < 0)
|
||||
httpReconnect2(http, 30000, NULL);
|
||||
|
||||
if (httpGetFd(http) >= 0)
|
||||
{
|
||||
/*
|
||||
* Connected, so check on the printer state...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, monitor->uri);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
|
||||
|
||||
response = cupsDoRequest(http, request, monitor->resource);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL)
|
||||
printer_state = (ipp_pstate_t)ippGetInteger(attr, 0);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-state-reasons", IPP_TAG_KEYWORD)) != NULL)
|
||||
ippAttributeString(attr, printer_state_reasons, sizeof(printer_state_reasons));
|
||||
|
||||
if (printer_state != monitor->printer_state || strcmp(printer_state_reasons, monitor->printer_state_reasons))
|
||||
{
|
||||
printf("PRINTER: %s (%s)\n", ippEnumString("printer-state", printer_state), printer_state_reasons);
|
||||
|
||||
monitor->printer_state = printer_state;
|
||||
strlcpy(monitor->printer_state_reasons, printer_state_reasons, sizeof(monitor->printer_state_reasons));
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
if (monitor->job_id > 0)
|
||||
{
|
||||
/*
|
||||
* Check the status of the job itself...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_OP_GET_JOB_ATTRIBUTES);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, monitor->uri);
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", monitor->job_id);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(jattrs) / sizeof(jattrs[0])), NULL, jattrs);
|
||||
|
||||
response = cupsDoRequest(http, request, monitor->resource);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM)) != NULL)
|
||||
job_state = (ipp_jstate_t)ippGetInteger(attr, 0);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-state-reasons", IPP_TAG_KEYWORD)) != NULL)
|
||||
ippAttributeString(attr, job_state_reasons, sizeof(job_state_reasons));
|
||||
|
||||
if (job_state != monitor->job_state || strcmp(job_state_reasons, monitor->job_state_reasons))
|
||||
{
|
||||
printf("JOB %d: %s (%s)\n", monitor->job_id, ippEnumString("job-state", job_state), job_state_reasons);
|
||||
|
||||
monitor->job_state = job_state;
|
||||
strlcpy(monitor->job_state_reasons, job_state_reasons, sizeof(monitor->job_state_reasons));
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
}
|
||||
|
||||
if (monitor->job_state < IPP_JSTATE_CANCELED)
|
||||
{
|
||||
/*
|
||||
* Sleep for 5 seconds...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleanup and return...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_attributes()' - Show attributes in a request or response.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_attributes(const char *title, /* I - Title */
|
||||
int request, /* I - 1 for request, 0 for response */
|
||||
ipp_t *ipp) /* I - IPP request/response */
|
||||
{
|
||||
int minor, major = ippGetVersion(ipp, &minor);
|
||||
/* IPP version number */
|
||||
ipp_tag_t group = IPP_TAG_ZERO;
|
||||
/* Current group tag */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
const char *name; /* Attribute name */
|
||||
char buffer[1024]; /* Value */
|
||||
|
||||
|
||||
printf("%s:\n", title);
|
||||
printf(" version=%d.%d\n", major, minor);
|
||||
printf(" request-id=%d\n", ippGetRequestId(ipp));
|
||||
if (!request)
|
||||
printf(" status-code=%s\n", ippErrorString(ippGetStatusCode(ipp)));
|
||||
|
||||
for (attr = ippFirstAttribute(ipp); attr; attr = ippNextAttribute(ipp))
|
||||
{
|
||||
if (group != ippGetGroupTag(attr))
|
||||
{
|
||||
group = ippGetGroupTag(attr);
|
||||
if (group)
|
||||
printf(" %s:\n", ippTagString(group));
|
||||
}
|
||||
|
||||
if ((name = ippGetName(attr)) != NULL)
|
||||
{
|
||||
ippAttributeString(attr, buffer, sizeof(buffer));
|
||||
printf(" %s(%s%s)=%s\n", name, ippGetCount(attr) > 1 ? "1setOf " : "", ippTagString(ippGetValueTag(attr)), buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_capabilities()' - Show printer capabilities.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_capabilities(ipp_t *response) /* I - Printer attributes */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ipp_attribute_t *attr; /* Attribute */
|
||||
char buffer[1024]; /* Attribute value buffer */
|
||||
static const char * const pattrs[] = /* Attributes we want to show */
|
||||
{
|
||||
"copies-default",
|
||||
"copies-supported",
|
||||
"finishings-default",
|
||||
"finishings-ready",
|
||||
"finishings-supported",
|
||||
"media-default",
|
||||
"media-ready",
|
||||
"media-supported",
|
||||
"output-bin-default",
|
||||
"output-bin-supported",
|
||||
"print-color-mode-default",
|
||||
"print-color-mode-supported",
|
||||
"sides-default",
|
||||
"sides-supported",
|
||||
"document-format-default",
|
||||
"document-format-supported",
|
||||
"pwg-raster-document-resolution-supported",
|
||||
"pwg-raster-document-type-supported",
|
||||
"urf-supported"
|
||||
};
|
||||
|
||||
|
||||
puts("CAPABILITIES:");
|
||||
for (i = 0; i < (int)(sizeof(pattrs) / sizeof(pattrs[0])); i ++)
|
||||
{
|
||||
if ((attr = ippFindAttribute(response, pattrs[i], IPP_TAG_ZERO)) != NULL)
|
||||
{
|
||||
ippAttributeString(attr, buffer, sizeof(buffer));
|
||||
printf(" %s=%s\n", pattrs[i], buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'usage()' - Show program usage...
|
||||
*/
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
puts("Usage: ./testclient printer-uri [options]");
|
||||
puts("Options:");
|
||||
puts(" -d document-format Generate the specified format");
|
||||
puts(" -f print-file Print the named file");
|
||||
puts(" -g Force grayscale printing");
|
||||
puts(" -k Keep temporary files");
|
||||
puts(" -v Be more verbose");
|
||||
}
|
||||
+7
-9
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Locale file makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2014 by Apple Inc.
|
||||
# Copyright 2007-2017 by Apple Inc.
|
||||
# Copyright 1993-2007 by Easy Software Products.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -131,8 +131,8 @@ pot: checkpo po2strings
|
||||
cd ..; xgettext -o locale/cups.pot -cTRANSLATORS -s \
|
||||
--keyword=_ --no-wrap \
|
||||
--copyright-holder="Apple Inc." \
|
||||
--package-name="CUPS" --package-version="1.6" \
|
||||
--msgid-bugs-address="http://www.cups.org/str.php" \
|
||||
--package-name="CUPS" --package-version="$(CUPS_VERSION)" \
|
||||
--msgid-bugs-address="https://github.com/apple/cups/issues" \
|
||||
*/*.c */*.cxx
|
||||
(cat cups.header; tail +6 cups.pot; cat cups.footer) > cups.pot.N
|
||||
mv cups.pot.N cups.pot
|
||||
@@ -158,14 +158,12 @@ pot: checkpo po2strings
|
||||
|
||||
checkpo: checkpo.o ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o checkpo checkpo.o \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o checkpo checkpo.o \
|
||||
../cups/$(LIBCUPSSTATIC) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ)
|
||||
|
||||
checkall: checkpo
|
||||
for file in *.po; do \
|
||||
./checkpo $$file; \
|
||||
done
|
||||
./checkpo *.po *.strings
|
||||
|
||||
|
||||
#
|
||||
@@ -177,7 +175,7 @@ checkall: checkpo
|
||||
|
||||
po2strings: po2strings.o ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o po2strings po2strings.o \
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o po2strings po2strings.o \
|
||||
../cups/$(LIBCUPSSTATIC) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ)
|
||||
|
||||
@@ -191,7 +189,7 @@ po2strings: po2strings.o ../cups/$(LIBCUPSSTATIC)
|
||||
|
||||
strings2po: strings2po.o
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o strings2po strings2po.o
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o strings2po strings2po.o
|
||||
|
||||
|
||||
#
|
||||
|
||||
+160
-6
@@ -2,7 +2,7 @@
|
||||
* Verify that translations in the .po file have the same number and type of
|
||||
* printf-style format strings.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2007-2017 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* checkpo filename.po [... filenameN.po]
|
||||
* checkpo filename.{po,strings} [... filenameN.{po,strings}]
|
||||
*
|
||||
* Compile with:
|
||||
*
|
||||
@@ -29,11 +29,14 @@
|
||||
|
||||
static char *abbreviate(const char *s, char *buf, int bufsize);
|
||||
static cups_array_t *collect_formats(const char *id);
|
||||
static cups_array_t *cups_load_strings(const char *filename);
|
||||
static int cups_read_strings(cups_file_t *fp, char *buffer, size_t bufsize, char **id, char **str);
|
||||
static char *cups_scan_strings(char *buffer);
|
||||
static void free_formats(cups_array_t *fmts);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Validate .po files.
|
||||
* 'main()' - Validate .po and .strings files.
|
||||
*/
|
||||
|
||||
int /* O - Exit code */
|
||||
@@ -57,12 +60,12 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
puts("Usage: checkpo filename.po [... filenameN.po]");
|
||||
puts("Usage: checkpo filename.{po,strings} [... filenameN.{po,strings}]");
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check every .po file on the command-line...
|
||||
* Check every .po or .strings file on the command-line...
|
||||
*/
|
||||
|
||||
for (i = 1, status = 0; i < argc; i ++)
|
||||
@@ -71,7 +74,12 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Use the CUPS .po loader to get the message strings...
|
||||
*/
|
||||
|
||||
if ((po = _cupsMessageLoad(argv[i], 1)) == NULL)
|
||||
if (strstr(argv[i], ".strings"))
|
||||
po = cups_load_strings(argv[i]);
|
||||
else
|
||||
po = _cupsMessageLoad(argv[i], 1);
|
||||
|
||||
if (!po)
|
||||
{
|
||||
perror(argv[i]);
|
||||
return (1);
|
||||
@@ -382,6 +390,152 @@ collect_formats(const char *id) /* I - msgid string */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_load_strings()' - Load a .strings file into a _cups_msg_t array.
|
||||
*/
|
||||
|
||||
static cups_array_t * /* O - CUPS array of _cups_msg_t values */
|
||||
cups_load_strings(const char *filename) /* I - File to load */
|
||||
{
|
||||
cups_file_t *fp; /* .strings file */
|
||||
cups_array_t *po; /* Localization array */
|
||||
_cups_message_t *m; /* Localization message */
|
||||
char buffer[8192], /* Message buffer */
|
||||
*id, /* ID string */
|
||||
*str; /* Translated message */
|
||||
|
||||
|
||||
if ((fp = cupsFileOpen(filename, "r")) == NULL)
|
||||
return (NULL);
|
||||
|
||||
po = _cupsMessageNew(NULL);
|
||||
|
||||
while (cups_read_strings(fp, buffer, sizeof(buffer), &id, &str))
|
||||
{
|
||||
if ((m = malloc(sizeof(_cups_message_t))) == NULL)
|
||||
break;
|
||||
|
||||
m->id = strdup(id);
|
||||
m->str = strdup(str);
|
||||
|
||||
if (m->id && m->str)
|
||||
cupsArrayAdd(po, m);
|
||||
else
|
||||
{
|
||||
if (m->id)
|
||||
free(m->id);
|
||||
|
||||
if (m->str)
|
||||
free(m->str);
|
||||
|
||||
free(m);
|
||||
|
||||
cupsArrayDelete(po);
|
||||
po = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
return (po);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_read_strings()' - Read a pair of strings from a .strings file.
|
||||
*/
|
||||
|
||||
static int /* O - 1 on success, 0 on failure */
|
||||
cups_read_strings(cups_file_t *strings, /* I - .strings file */
|
||||
char *buffer, /* I - Line buffer */
|
||||
size_t bufsize, /* I - Size of line buffer */
|
||||
char **id, /* O - Pointer to ID string */
|
||||
char **str) /* O - Pointer to translation string */
|
||||
{
|
||||
char *bufptr; /* Pointer into buffer */
|
||||
|
||||
|
||||
while (cupsFileGets(strings, buffer, bufsize))
|
||||
{
|
||||
if (buffer[0] != '\"')
|
||||
continue;
|
||||
|
||||
*id = buffer + 1;
|
||||
bufptr = cups_scan_strings(buffer);
|
||||
|
||||
if (*bufptr != '\"')
|
||||
continue;
|
||||
|
||||
*bufptr++ = '\0';
|
||||
|
||||
while (*bufptr && *bufptr != '\"')
|
||||
bufptr ++;
|
||||
|
||||
if (!*bufptr)
|
||||
continue;
|
||||
|
||||
*str = bufptr + 1;
|
||||
bufptr = cups_scan_strings(bufptr);
|
||||
|
||||
if (*bufptr != '\"')
|
||||
continue;
|
||||
|
||||
*bufptr = '\0';
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_scan_strings()' - Scan a quoted string.
|
||||
*/
|
||||
|
||||
static char * /* O - End of string */
|
||||
cups_scan_strings(char *buffer) /* I - Start of string */
|
||||
{
|
||||
char *bufptr; /* Pointer into string */
|
||||
|
||||
|
||||
for (bufptr = buffer + 1; *bufptr && *bufptr != '\"'; bufptr ++)
|
||||
{
|
||||
if (*bufptr == '\\')
|
||||
{
|
||||
if (bufptr[1] >= '0' && bufptr[1] <= '3' &&
|
||||
bufptr[2] >= '0' && bufptr[2] <= '7' &&
|
||||
bufptr[3] >= '0' && bufptr[3] <= '7')
|
||||
{
|
||||
/*
|
||||
* Decode \nnn octal escape...
|
||||
*/
|
||||
|
||||
*bufptr = (char)(((((bufptr[1] - '0') << 3) | (bufptr[2] - '0')) << 3) | (bufptr[3] - '0'));
|
||||
_cups_strcpy(bufptr + 1, bufptr + 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Decode \C escape...
|
||||
*/
|
||||
|
||||
_cups_strcpy(bufptr, bufptr + 1);
|
||||
if (*bufptr == 'n')
|
||||
*bufptr = '\n';
|
||||
else if (*bufptr == 'r')
|
||||
*bufptr = '\r';
|
||||
else if (*bufptr == 't')
|
||||
*bufptr = '\t';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (bufptr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'free_formats()' - Free all of the format strings.
|
||||
*/
|
||||
|
||||
+4298
-5
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Message catalog template for CUPS.
|
||||
#
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 2007-2017 by Apple Inc.
|
||||
# Copyright 2005-2007 by Easy Software Products.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
|
||||
+5080
-757
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+2184
-28
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+7017
-12
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+7008
-12
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+7015
-16
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+7023
-15
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+7348
-287
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+7017
-12
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+7021
-13
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário