Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 45a6252b81 |
@@ -1,6 +1,90 @@
|
||||
CHANGES-1.5.txt
|
||||
---------------
|
||||
|
||||
CHANGES IN CUPS V1.5.4
|
||||
|
||||
- Documentation updates (STR #4112, STR #4130, STR #4134)
|
||||
- Fixes for libusb-based USB backend (STR #4128)
|
||||
- The lpq command did not show the owner or title of jobs unless passed
|
||||
a username on the command-line (STR #4135)
|
||||
- Localized empty strings contained the message catalog metadata
|
||||
(STR #4119)
|
||||
- Fixed a crash in the libusb-based USB backend (STR #4099)
|
||||
- The cups-lpd mini-daemon no longer handled jobs with multiple copies
|
||||
(STR #4118)
|
||||
- Multiple libusb backend fixes (STR #4098, STR #4100)
|
||||
- The IPP backend no longer tries to get the job status for printers
|
||||
that do not implement the required operation (STR #4083)
|
||||
- Sending a document in an unsupported format to an IPP printer now
|
||||
automatically cancels the job (STR #4093)
|
||||
- Fix some error reporting issues when printing from /dev/null and
|
||||
other unusual situations (STR #4015)
|
||||
- The scheduler now sets the CUPS_MAX_MESSAGE environment variable for
|
||||
filters (STR #4074)
|
||||
- Fixed a build issue when using older versions of autoconf (STR #4084)
|
||||
- The IPP backend now treats the client-error-not-possible status code
|
||||
as a job history issue, allowing IPP printing to Windows to work
|
||||
(STR #4047)
|
||||
- The IPP backend incorrectly included the document-format and
|
||||
compression attributes in Create-Job requests (STR #4086)
|
||||
- The libusb-based USB backend did not work on non-Linux platforms
|
||||
(STR #4088)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.5.3
|
||||
|
||||
- httpReconnect() did not reset the read/write buffers (STR #4065)
|
||||
- Compiling without threading support failed (STR #4060)
|
||||
- Fixed compile problem with old versions of OpenSSL (STR #4036)
|
||||
- The network backends did not check SNMP supply levels regularly
|
||||
(STR #4040)
|
||||
- The online help always included the "help on help" text (STR #4042)
|
||||
- Fixed a SSL handshake issue on OS X (STR #4045)
|
||||
- The scheduler could crash if a PPD file contained an invalid paper
|
||||
size (STR #4049)
|
||||
- The CUPS polling daemon did not reinitialize its connection to the
|
||||
remote server on errors in all cases (STR #4031)
|
||||
- PostScript auto-configuration was slow and unreliable with some
|
||||
printers (STR #4028)
|
||||
- Missing localizations caused empty output (STR #4033)
|
||||
- The cups-driverd program could temporarily "forget" a PPD file if it
|
||||
was updated in place.
|
||||
- The dnssd backend now prefers IPPS over IPP.
|
||||
- The USB backend now uses and requires LIBUSB 1.0 or later (STR #3477)
|
||||
- The LIBUSB-based USB backend now supports the back-channel (STR #2890)
|
||||
- Changed how timeouts are implemented in the LPD backend (STR #4013)
|
||||
- Added more supported color names for SNMP supplies (STR #3981)
|
||||
- The default InputSlot setting was never used (STR #3957)
|
||||
- POSIX ACLs are now set properly on certificate files (STR #3970)
|
||||
- Supplies with commas in their names were not reported correctly
|
||||
(STR #4020)
|
||||
- The cupsGetPPD3() function created a temporary file when one was not
|
||||
needed (STR #4018)
|
||||
- The scheduler now ensures that job notifications contain a value for
|
||||
the notify-printer-uri attribute (STR #4014)
|
||||
- The lp and lpr commands did not cancel jobs queued from stdin on an
|
||||
error (STR #4015)
|
||||
- Fixed the IPP backend's handling of HTTP/1.0 compatibility (STR #3988)
|
||||
- The IPP backend did not always setup username/password authentication
|
||||
for printers (STR #3985)
|
||||
- The IPP backend no longer re-queues print jobs that are too large for
|
||||
the printer/server (STR #3977)
|
||||
- The RPM spec file did not work (STR #4021, STR #4057)
|
||||
- Encryption did not work when the server name ended with "."
|
||||
(STR #4011)
|
||||
- The multi-purpose tray is now mapped to the IPP "by-pass-tray"
|
||||
(STR #4009)
|
||||
- The correct media size was not always passed to IPP printers
|
||||
(STR #4001)
|
||||
- Finishing options were not passed to IPP printers (STR #3995)
|
||||
- Fixed iCloud-based Back to My Mac printing (STR #3996)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.5.2
|
||||
|
||||
- Reposted what should have been CUPS 1.5.1.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.5.1
|
||||
|
||||
- Documentation updates (STR #3885, STR #3886, STR #3946, STR #3969)
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
CHANGES-IPPTOOL.txt - 2012-01-10
|
||||
--------------------------------
|
||||
|
||||
This file provides a list of changes to the ipptool binary distribution posted
|
||||
on cups.org.
|
||||
|
||||
|
||||
2012-01-10
|
||||
|
||||
- Fixed an issue with the IPP/1.1 test file where the "waiting for job
|
||||
completion" test did not work.
|
||||
- The attribute groups out of order error was not shown for the
|
||||
operation-attributes-tag group.
|
||||
|
||||
|
||||
2011-12-02
|
||||
|
||||
- Fixed a truncated XML output bug that would happen for certain errors.
|
||||
- Fixed the order-of-groups tests.
|
||||
- Fixed "WITH-VALUE >N" for rangeOfInteger attributes.
|
||||
- The Windows installer was missing the get-printer-attributes.test
|
||||
file.
|
||||
- The Linux binaries are now compiled for all LSB 4.x-compliant Linux
|
||||
distributions.
|
||||
- The Linux binaries no longer support SSL or TLS.
|
||||
|
||||
|
||||
2011-10-05
|
||||
|
||||
- Fixed a crasher bug that showed up on Windows.
|
||||
- The IPP/1.1 test would hang if the initial Print-Job test failed.
|
||||
- Fixed a typo in the IPP/2.0 test.
|
||||
|
||||
|
||||
2011-10-03
|
||||
|
||||
- Using OF-TYPE with the "no-value" or "unknown" out-of-band value tags
|
||||
now works without special WITH-VALUE strings.
|
||||
- ipptool now shows an error when an attribute appears more than once
|
||||
within the same attribute group.
|
||||
- ipptool did not display attributes as specified by the DISPLAY
|
||||
directive when a test error failed.
|
||||
- Fixed one spot where DEFINE-VALUE was still treated as an error when
|
||||
the EXPECT test failed.
|
||||
- uriScheme values were not displayed properly.
|
||||
- Updated the IPP/1.1 tests to properly validate support for
|
||||
job-hold-until-default and job-hold-until-supported when the Hold-Job
|
||||
operation is supported.
|
||||
- Updated the IPP/1.1 tests to properly check for the various standard
|
||||
media sizes for the printing tests.
|
||||
- Updated the IPP/1.1 tests to accept "no-value" for media-default an
|
||||
orientation-requested-default.
|
||||
- Updated the IPP/1.1 tests to accept "unknown" for job-state.
|
||||
- Updated the IPP/1.1 tests to not perform the bogus URI printing tests
|
||||
unless the "document-uri" variable is defined.
|
||||
- Updated the IPP/2.0 tests to properly validate media-col
|
||||
"media-xxx-supported" attributes.
|
||||
- Updated the IPP/2.2 tests to properly validate media-ready and
|
||||
media-col-ready.
|
||||
|
||||
|
||||
2011-09-28
|
||||
|
||||
- Test output now includes a summary and overall score at the end.
|
||||
- The MATCH-VALUE predicate now correctly deals with a failed EXPECT
|
||||
condition.
|
||||
- The IPP/1.1 test suite now looks for legacy media names and uses them
|
||||
if the corresponding PWG standard names are not present.
|
||||
- The IPP/1.1 test suite now tests the Print-Job+Release-Job when the
|
||||
printer supports the job-hold-until attribute, Hold-Job operation, and
|
||||
Release-Job operation.
|
||||
|
||||
|
||||
2011-09-21
|
||||
|
||||
- Fixes for HTTP chunking, timeout, and encryption issues reported by
|
||||
various users.
|
||||
- Greatly improved IPP tests with added IPP/2.2 tests.
|
||||
- New test documents - 1-page and 4-page mixed A4/Letter PDF/PS and a
|
||||
couple JPEGs.
|
||||
- New REPEAT directives to programmatically repeat tests as needed.
|
||||
|
||||
|
||||
2011-08-16
|
||||
|
||||
- The Windows version no longer requires Visual Studio to be installed.
|
||||
- The Windows version now supports SSL.
|
||||
- Added "ipps" URI support.
|
||||
- Added a new "-T" option.
|
||||
- Added support for fractional seconds for the -i option and DELAY
|
||||
directive.
|
||||
- Added support for authentication.
|
||||
- Added DEFINE-MATCH, DEFINE-NO-MATCH, DEFINE-VALUE, IF-NOT-DEFINED,
|
||||
IGNORE-ERRORS, SKIP-IF-DEFINED, SKIP-IF-NOT-DEFINED,
|
||||
SKIP-PREVIOUS-ERROR directives.
|
||||
- WITH-VALUE now supports variable expansion.
|
||||
- Updated the IPP/1.1 conformance test to skip the "my-jobs different
|
||||
user" test if the printer URI contains a username.
|
||||
- Updated the IPP conformance tests to validate media, media-default,
|
||||
and media-supported values.
|
||||
- No longer error out if a Printer returns a different version number in
|
||||
the response when the request contains the version 0.0.
|
||||
|
||||
|
||||
2010-10-16
|
||||
|
||||
- Initial release of standalone binary.
|
||||
+143
-1
@@ -1,8 +1,150 @@
|
||||
CHANGES.txt - 1.6b1 - 2012-01-30
|
||||
CHANGES.txt - 1.6.2 - 2013-03-18
|
||||
--------------------------------
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.6.2
|
||||
|
||||
- Documentation fixes (STR #4229, STR #4239, STR #4234, STR #4248,
|
||||
STR #4259)
|
||||
- Security: All file, directory, user, and group settings are now stored
|
||||
in a separate cups-files.conf configuration file that cannot be set
|
||||
through the CUPS web interface or APIs (STR #4223)
|
||||
- Added a Czech localization (STR #4201)
|
||||
- Added a French localization (STR #4247)
|
||||
- Added a Russian localization (STR #4228, STR #4285)
|
||||
- Updated the Catalan localization (STR #4202)
|
||||
- Local certificate authentication did not guard against an empty
|
||||
certification file (STR #4293)
|
||||
- The scheduler did not reject device URIs with spaces.
|
||||
- Added USB quirk rule for Epson Stylus Photo 750 (STR #4286)
|
||||
- The IPP backend could crash if the printer disconnects early
|
||||
(STR #4284)
|
||||
- cupsGetPPD did not work with statically-configured CUPS shared
|
||||
queues (STR #4178)
|
||||
- The scheduler did not support long MIME media types (STR #4270)
|
||||
- The cupsfilter command did not set the CHARSET environment variable
|
||||
for the text filters (STR #4273)
|
||||
- The lp command did not show errors for unknown "--foo" (STR #4261)
|
||||
- Bad IPP responses could crash ipptool (STR #4262)
|
||||
- Updated USB quirk rules for Canon and Xerox printers (STR #4217,
|
||||
STR #4263)
|
||||
- Added USB blacklisting for printers that require a custom backend
|
||||
(STR #4218)
|
||||
- The PPD compiler did not correctly JCL options (STR #4115, STR #4203)
|
||||
- The ipptool program now supports DEFINE-MATCH and DEFINE-NO-MATCH
|
||||
predicates for STATUS directives.
|
||||
- Fixed a problem with local Kerberos authentication (STR #4140)
|
||||
- Coverity scan: fixed some minor issues (STR #4242)
|
||||
- The scheduler did not remove color profiles after deleting a printer
|
||||
(STR #4232, STR #4276)
|
||||
- The CUPS library did not always detect a timed out connection to the
|
||||
server which could cause temporary loss of printing from applications
|
||||
(STR #4187)
|
||||
- The ipptool program now supports variable substitution in OPERATION
|
||||
and DELAY directives (STR #4175)
|
||||
- The IPP backend now stops queues when the server configuration
|
||||
prevents successful job submission (STR #4125)
|
||||
- The XML output of ipptool contained empty dictionaries (STR #4136)
|
||||
- The scheduler did not delete job control backup files (STR #4244)
|
||||
- cupsGetPPD3 could return a local PPD instead of the correct remote
|
||||
PPD.
|
||||
- The scheduler incorrectly advertised auth-info-required for local
|
||||
queues needing local authentication (STR #4205)
|
||||
- CUPS 1.6 clients using the ServerName directive in client.conf did not
|
||||
work with CUPS 1.3.x or older servers (STR #4231, STR #4291)
|
||||
- The SNMP backend now tries to work around broken printers that use a
|
||||
newline to separate key/value pairs.
|
||||
- The IPP backend did not send a cancel request to printers when a job
|
||||
was canceled and the printer did not support Create-Job.
|
||||
- Fixed EPM packaging files (STR #4199)
|
||||
- OpenBSD build fix (STR #4195, STR #4196, STR #4197)
|
||||
- The scheduler could crash when using Avahi (STR #4183, STR #4192,
|
||||
STR #4200, STR #4213)
|
||||
- The IPP backend could get stuck in an endless loop on certain network
|
||||
errors (STR #4194)
|
||||
- 32-bit builds failed on Debian (STR #4133)
|
||||
- The scheduler no longer accepts or sends job description attributes.
|
||||
- The IPP backend now works around some conformance issues for broken
|
||||
printers (STR #4190)
|
||||
- cupsBackendReport() now filters out all control characters from the
|
||||
reported 1284 device IDs (STR #4124)
|
||||
- The scheduler no longer allows job-name values that are not valid
|
||||
network Unicode strings (STR #4072)
|
||||
- The web interface did not preserve the order of classes, jobs, or
|
||||
printers (STR #4170)
|
||||
- The network backends now support disabling of SNMP supply level
|
||||
queries via the "snmp" URI option (STR #4106)
|
||||
- The IPP backend did not specify the compression used (STR #4181)
|
||||
- ipptool did not support octetString values.
|
||||
- The scheduler did not recognize dnssd: or ipps: URIs as Bonjour shared
|
||||
queues (STR #4158)
|
||||
- Applications could not get the PPD file for statically-configured
|
||||
Bonjour-shared print queues (STR #4159)
|
||||
- The cupsd.conf file included obsolete browsing directives (STR #4157)
|
||||
- Fixed a USB backend compatibility issue on systems using libusb
|
||||
(STR #4155, STR #4191)
|
||||
- Some Bonjour features were not available on systems with Avahi
|
||||
(STR #4156)
|
||||
- CUPS now includes the port number in the Host: header for HTTP
|
||||
requests.
|
||||
- Fixed REPEAT-MATCH for STATUS and EXPECT - was incorrectly erroring
|
||||
out.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.6.1
|
||||
|
||||
- Documentation fix (STR #4149)
|
||||
- RPM packaging fixes (STR #4129, #4145)
|
||||
- The Japanese and English web interface headers were swapped
|
||||
(STR #4148)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.6.0
|
||||
|
||||
- Document changes (STR #4131)
|
||||
- Added new Catalan (STR #4107) and Spanish (STR #4137) localizations.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.6rc1
|
||||
|
||||
- Added a new Japanese localization (STR #4122)
|
||||
- The SNMP backend no longer exits if it is unable to obtain an IPv6
|
||||
socket (STR #4109)
|
||||
- The LPD backend incorrectly used "localhost" in the control file
|
||||
instead of the current hostname.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.6b1
|
||||
|
||||
- Documentation updates (STR #3927, STR #3980, STR #4010, STR #4068)
|
||||
- The scheduler now consolidates all PPD updates from filters at the
|
||||
end of the job (STR #4075)
|
||||
- CUPS now supports color management using colord (STR #3808)
|
||||
- CUPS now supports Bonjour using Avahi (STR #3066)
|
||||
- The PreserveJobFiles and PreserveJobHistory directives now support
|
||||
specification of a time interval (STR #3143)
|
||||
- PPD files can now be archived in (gzip'd) tar files to further reduce
|
||||
the disk space used by PPD files (STR #3772)
|
||||
- The network backends now deal with printers that report their levels
|
||||
in percent but do not specify a maximum capacity of 100 (STR #3551)
|
||||
- The network backends now report full/almost-full waste bins in
|
||||
printers along with end-of-life for cleaning pads (STR #4017)
|
||||
- Added a configure option to set the permissions of the installed
|
||||
cupsd (STR #3459)
|
||||
- Added a new WITH-ALL-VALUES directive to ipptool EXPECT predicates
|
||||
(STR #3949)
|
||||
- CUPS now supports a User directive in client.conf and the CUPS_USER
|
||||
environment variable for overriding the default username (STR #3114)
|
||||
- Now set the PJL USERNAME variable as needed (STR #3100)
|
||||
- Added support for usernames and passwords longer than 32 characters
|
||||
(STR #2856)
|
||||
- Added a new MaxHoldTime directive to automatically cancel jobs that
|
||||
have been held indefinitely after a specific number of seconds
|
||||
(STR #2291)
|
||||
- The LPD backend now uses the originating host name when it is not the
|
||||
local system (STR #2053)
|
||||
- CUPS now prefers the suffix "dpcm" when reporting resolution in dots-
|
||||
per-centimeter (STR #4006)
|
||||
- The configure script and build system no longer support building of
|
||||
separate 32-bit and 64-bit libraries.
|
||||
- The "brightness", "columns", "fitplot", "gamma", "hue",
|
||||
|
||||
+6
-4
@@ -1,4 +1,4 @@
|
||||
CREDITS.txt - 2010-03-13
|
||||
CREDITS.txt - 2012-07-16
|
||||
------------------------
|
||||
|
||||
Few projects are completed by one person, and CUPS is no exception. We'd
|
||||
@@ -17,7 +17,7 @@ like to thank the following individuals for their contributions:
|
||||
Wang Jian - CUPS RPM corrections.
|
||||
Roderick Johnstone - Beta tester of the millenium.
|
||||
Till Kamppeter - Bug fixes, beta testing, evangelism.
|
||||
I–aki Larra–aga - Basque localization.
|
||||
Iñaki Larrañaga - Basque localization.
|
||||
Kenshi Muto - Japanese localization, patches, and
|
||||
testing.
|
||||
Tomohiro Kato - Japanese localization.
|
||||
@@ -27,16 +27,18 @@ like to thank the following individuals for their contributions:
|
||||
Mark Lawrence - Microsoft interoperability testing.
|
||||
Jeff Licquia - Bug fixes, beta testing, evangelism.
|
||||
Jason McMullan - Original CUPS RPM distributions.
|
||||
Àngel Mompó - Catalan localization.
|
||||
Wes Morgan - *BSD fixes.
|
||||
Daniel Nylander - Swedish localization.
|
||||
Niklas 'Nille' �kerstršm - Swedish localization.
|
||||
Niklas 'Nille' Åkerström - Swedish localization.
|
||||
Naruiko Ogasawara - Japanese localization.
|
||||
Giulio Orsero - Bug fixes and testing.
|
||||
Michal Osowiecki - Polish localization.
|
||||
Citra Paska - Indonesian localization.
|
||||
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
|
||||
Vincenzo Reale - Italian localization.
|
||||
Petter Reinholdtsen - HP-UX compiler stuff.
|
||||
Juan Pablo Gonz‡lez Riopedre - Spanish localization.
|
||||
Juan Pablo González Riopedre - Spanish localization.
|
||||
Opher Shachar - Hebrew localization.
|
||||
Stuart Stevens - HP JetDirect IPP information.
|
||||
Andrea Suatoni - IRIX desktop integration and testing.
|
||||
|
||||
+12
-6
@@ -1,14 +1,20 @@
|
||||
INSTALL - CUPS v1.5.0 - 2011-07-25
|
||||
INSTALL - CUPS v1.6.2 - 2013-03-18
|
||||
----------------------------------
|
||||
|
||||
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".
|
||||
|
||||
**** IF YOU HAVE A NON-POSTSCRIPT PRINTER AND ARE NOT ****
|
||||
**** RUNNING MAC OS X, YOU WILL ALSO NEED TO INSTALL GPL ****
|
||||
**** GHOSTSCRIPT WITH THE "cups" DRIVER AFTER YOU INSTALL ****
|
||||
**** 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. ****
|
||||
**** ****
|
||||
*******************************************************************************
|
||||
*******************************************************************************
|
||||
|
||||
|
||||
BEFORE YOU BEGIN
|
||||
@@ -34,7 +40,7 @@ BEFORE YOU BEGIN
|
||||
PostScript filter needed by non-PostScript printers. You *must* download
|
||||
GPL Ghostscript separately from the CUPS web site if you want to print
|
||||
PostScript files to non-PostScript printers on operating systems other than
|
||||
Mac OS X.
|
||||
OS X.
|
||||
|
||||
|
||||
COMPILING THE SUBVERSION REPOSITORY CODE
|
||||
|
||||
+52
-11
@@ -1,4 +1,4 @@
|
||||
IPPTOOL.txt - 2011-12-02
|
||||
IPPTOOL.txt - 2012-02-06
|
||||
------------------------
|
||||
|
||||
See the file CHANGES-IPPTOOL.txt for a list of changes to this software.
|
||||
@@ -6,11 +6,11 @@ See the file CHANGES-IPPTOOL.txt for a list of changes to this software.
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
Starting with CUPS 1.5, CUPS now installs a user program called ipptool that
|
||||
can be used to send arbitrary IPP requests to a CUPS server or IPP printer.
|
||||
This tool started life as part of the CUPS automated test suite and has
|
||||
grown to support complex conformance tests and a simple way to query
|
||||
printer, job, and subscription attributes.
|
||||
CUPS includes a user program called ipptool that can be used to send
|
||||
arbitrary IPP requests to a CUPS server or IPP printer. This tool started
|
||||
life as part of the CUPS automated test suite and has grown to support
|
||||
complex conformance tests and a simple way to query printer, job, and
|
||||
subscription attributes.
|
||||
|
||||
|
||||
BASIC USAGE
|
||||
@@ -46,6 +46,22 @@ BASIC USAGE
|
||||
75,pending-held,testfile.txt,msweet
|
||||
|
||||
|
||||
STANDARD TEST FILES
|
||||
|
||||
The following standard test files are included with ipptool:
|
||||
|
||||
create-printer-subscription.test Creates a printer subscription for
|
||||
state change notifications
|
||||
get-completed-jobs.test Shows a list of completed jobs
|
||||
get-jobs.test Shows a list of pending jobs
|
||||
get-printer-attributes.test Shows printer attributes
|
||||
ipp-1.1.test IPP/1.1 conformance test suite
|
||||
ipp-2.0.test IPP/2.0 conformance test suite
|
||||
ipp-2.1.test IPP/2.1 conformance test suite
|
||||
ipp-2.2.test IPP/2.2 conformance test suite
|
||||
print-job.test Prints a file
|
||||
|
||||
|
||||
CONFORMANCE TESTS
|
||||
|
||||
We provide basic IPP conformance tests for IPP/1.1, IPP/2.0, IPP/2.1, and
|
||||
@@ -71,6 +87,29 @@ CONFORMANCE TESTS
|
||||
onepage-a4.ps
|
||||
onepage-letter.pdf
|
||||
onepage-letter.ps
|
||||
testfile.jpg
|
||||
testfile.pcl
|
||||
testfile.pdf
|
||||
testfile.ps
|
||||
testfile.txt
|
||||
|
||||
Useful options include the following:
|
||||
|
||||
-4 Connect using IPv4
|
||||
-6 Connect using IPv6
|
||||
-C Send chunked requests (default)
|
||||
-d name=val Define a variable
|
||||
-E Test IPP with HTTP Upgrade to TLS
|
||||
-L Send requests using the Content-Length header (HTTP/1.0)
|
||||
-S Test IPP over HTTPS (default for ipps: URIs)
|
||||
-T seconds Set a timeout for responses in seconds
|
||||
-v Be verbose, showing all attributes sent and received
|
||||
|
||||
The printer-uri must be a URI supported by the printer using the "ipp" or
|
||||
"ipps" scheme, for example:
|
||||
|
||||
ipp://192.168.0.1/ipp
|
||||
ipps://192.168.0.1/ipp/print
|
||||
|
||||
Print-by-reference (URL) printing can be tested by defining the document-uri
|
||||
variable to a URL, for example:
|
||||
@@ -80,7 +119,9 @@ CONFORMANCE TESTS
|
||||
The standard test files are available on cups.org under the "test"
|
||||
directory, for example:
|
||||
|
||||
http://www.cups.org/test/document-a4.pdf
|
||||
ipptool -tf document-a4.pdf \
|
||||
-d document-uri=http://www.cups.org/test/document-a4.pdf \
|
||||
ipp://192.168.0.1/ipp -I -V 2.0 ipp-2.0.test
|
||||
|
||||
The "document" test files contain 4 pages each. Doing the IPP conformance
|
||||
tests will will produce up to 90 pages on various media, depending on the
|
||||
@@ -90,7 +131,8 @@ CONFORMANCE TESTS
|
||||
READING THE DOCUMENTATION
|
||||
|
||||
The command usage is described in the ipptest(1) man page, while the file
|
||||
format is described in the ipptestfile(5) man page.
|
||||
format is described in the ipptestfile(5) man page. Both are provided in
|
||||
HTML format with the standalone releases of ipptool.
|
||||
|
||||
|
||||
GETTING SUPPORT AND OTHER RESOURCES
|
||||
@@ -118,8 +160,7 @@ REPORTING BUGS
|
||||
test with debug logging enabled. Run the following commands on Windows to
|
||||
enable debug logging:
|
||||
|
||||
set CUPS_DEBUG_LOG=ipptool.log
|
||||
set CUPS_DEBUG_LEVEL=6
|
||||
setdebug.bat
|
||||
|
||||
For Linux and Mac OS X use:
|
||||
|
||||
@@ -133,7 +174,7 @@ REPORTING BUGS
|
||||
|
||||
LEGAL STUFF
|
||||
|
||||
CUPS is Copyright 2007-2011 by Apple Inc. CUPS and the CUPS logo are
|
||||
CUPS is Copyright 2007-2012 by Apple Inc. CUPS and the CUPS logo are
|
||||
trademarks of Apple Inc.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
CUPS License Agreement
|
||||
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
Copyright 2007-2012 by Apple Inc.
|
||||
1 Infinite Loop
|
||||
Cupertino, CA 95014 USA
|
||||
|
||||
@@ -68,11 +68,11 @@ the following special exceptions:
|
||||
source code of the Apple OS-Developed Software.
|
||||
|
||||
b. An Apple Operating System means any operating system
|
||||
software developed and/or marketed by Apple Computer,
|
||||
Inc., including but not limited to all existing
|
||||
releases and versions of Apple's Darwin, Mac OS X,
|
||||
and Mac OS X Server products and all follow-on
|
||||
releases and future versions thereof.
|
||||
software developed and/or marketed by Apple Inc.,
|
||||
including but not limited to all existing releases and
|
||||
versions of Apple's Darwin, OS X, and OS X Server
|
||||
products and all follow-on releases and future
|
||||
versions thereof.
|
||||
|
||||
c. This exception is only available for Apple
|
||||
OS-Developed Software and does not apply to software
|
||||
|
||||
+3
-1
@@ -24,7 +24,7 @@ CHMOD = @CHMOD@
|
||||
CXX = @LIBTOOL@ @CXX@
|
||||
DSO = @DSO@
|
||||
DSOXX = @DSOXX@
|
||||
HTMLDOC = @HTMLDOC@
|
||||
GZIP = @GZIP@
|
||||
INSTALL = @INSTALL@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
@@ -41,6 +41,7 @@ SHELL = /bin/sh
|
||||
#
|
||||
|
||||
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @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
|
||||
@@ -62,6 +63,7 @@ CUPS_PRIMARY_SYSTEM_GROUP = @CUPS_PRIMARY_SYSTEM_GROUP@
|
||||
#
|
||||
|
||||
CUPS_CONFIG_FILE_PERM = @CUPS_CONFIG_FILE_PERM@
|
||||
CUPS_CUPSD_FILE_PERM = @CUPS_CUPSD_FILE_PERM@
|
||||
CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@
|
||||
|
||||
#
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Top-level Makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2010 by Apple Inc.
|
||||
# Copyright 2007-2012 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -275,10 +275,10 @@ docset: apihelp
|
||||
doc/help/api-*.tokens
|
||||
$(RM) doc/help/api-*.tokens
|
||||
echo Indexing docset...
|
||||
/Developer/usr/bin/docsetutil index org.cups.docset
|
||||
/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil index org.cups.docset
|
||||
echo Generating docset archive and feed...
|
||||
$(RM) org.cups.docset.atom
|
||||
/Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
|
||||
/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
|
||||
--atom org.cups.docset.atom \
|
||||
--download-url http://www.cups.org/org.cups.docset.xar \
|
||||
org.cups.docset
|
||||
|
||||
+5
-6
@@ -1,14 +1,13 @@
|
||||
README - CUPS v1.5.0 - 2011-07-25
|
||||
----------------------------------
|
||||
README - CUPS v1.6.2 - 2013-03-18
|
||||
---------------------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
instead...
|
||||
Looking for compile instructions? Read the file "INSTALL.txt" instead...
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
CUPS is a standards-based, open source printing system developed by Apple
|
||||
Inc. for Mac OS® X and other UNIX®-like operating systems. CUPS uses the
|
||||
Inc. for OS® X and other UNIX®-like operating systems. CUPS uses the
|
||||
Internet Printing Protocol ("IPP") and provides System V and Berkeley
|
||||
command-line interfaces, a web interface, and a C API to manage printers and
|
||||
print jobs. It supports printing to both local (parallel, serial, USB) and
|
||||
@@ -150,7 +149,7 @@ PRINTING FILES
|
||||
|
||||
LEGAL STUFF
|
||||
|
||||
CUPS is Copyright 2007-2011 by Apple Inc. CUPS and the CUPS logo are
|
||||
CUPS is Copyright 2007-2013 by Apple Inc. CUPS and the CUPS logo are
|
||||
trademarks of Apple Inc.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
|
||||
+57
-59
@@ -1,72 +1,70 @@
|
||||
ipp.o: ipp.c backend-private.h ../cups/cups-private.h ../cups/cups.h \
|
||||
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
|
||||
../cups/array.h ../cups/language.h ../cups/string-private.h \
|
||||
../config.h ../cups/debug-private.h ../cups/ppd-private.h \
|
||||
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
|
||||
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
|
||||
../cups/backend.h ../cups/sidechannel.h ../cups/array-private.h
|
||||
ipp.o: ipp.c backend-private.h ../cups/cups-private.h \
|
||||
../cups/string-private.h ../config.h ../cups/debug-private.h \
|
||||
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
|
||||
../cups/http.h ../cups/array.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
|
||||
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h \
|
||||
../cups/array-private.h
|
||||
lpd.o: lpd.c ../cups/http-private.h ../config.h ../cups/http.h \
|
||||
../cups/versioning.h ../cups/array.h ../cups/md5-private.h \
|
||||
../cups/ipp-private.h ../cups/ipp.h backend-private.h \
|
||||
../cups/cups-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/language.h ../cups/string-private.h ../cups/debug-private.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/pwg-private.h \
|
||||
../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
|
||||
../cups/sidechannel.h
|
||||
dnssd.o: dnssd.c backend-private.h ../cups/cups-private.h ../cups/cups.h \
|
||||
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
|
||||
../cups/array.h ../cups/language.h ../cups/string-private.h \
|
||||
../config.h ../cups/debug-private.h ../cups/ppd-private.h \
|
||||
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
|
||||
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
|
||||
../cups/backend.h ../cups/sidechannel.h
|
||||
snmp.o: snmp.c backend-private.h ../cups/cups-private.h ../cups/cups.h \
|
||||
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
|
||||
../cups/array.h ../cups/language.h ../cups/string-private.h \
|
||||
../config.h ../cups/debug-private.h ../cups/ppd-private.h \
|
||||
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
|
||||
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
|
||||
../cups/backend.h ../cups/sidechannel.h
|
||||
../cups/cups-private.h ../cups/string-private.h \
|
||||
../cups/debug-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
|
||||
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
|
||||
dnssd.o: dnssd.c backend-private.h ../cups/cups-private.h \
|
||||
../cups/string-private.h ../config.h ../cups/debug-private.h \
|
||||
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
|
||||
../cups/http.h ../cups/array.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
|
||||
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
|
||||
snmp.o: snmp.c backend-private.h ../cups/cups-private.h \
|
||||
../cups/string-private.h ../config.h ../cups/debug-private.h \
|
||||
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
|
||||
../cups/http.h ../cups/array.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
|
||||
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
|
||||
socket.o: socket.c ../cups/http-private.h ../config.h ../cups/http.h \
|
||||
../cups/versioning.h ../cups/array.h ../cups/md5-private.h \
|
||||
../cups/ipp-private.h ../cups/ipp.h backend-private.h \
|
||||
../cups/cups-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/language.h ../cups/string-private.h ../cups/debug-private.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/pwg-private.h \
|
||||
../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
|
||||
../cups/sidechannel.h
|
||||
../cups/cups-private.h ../cups/string-private.h \
|
||||
../cups/debug-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
|
||||
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
|
||||
test1284.o: test1284.c ../cups/string-private.h ../config.h ieee1284.c \
|
||||
backend-private.h ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
|
||||
../cups/language.h ../cups/debug-private.h ../cups/ppd-private.h \
|
||||
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
|
||||
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
|
||||
../cups/backend.h ../cups/sidechannel.h
|
||||
backend-private.h ../cups/cups-private.h ../cups/debug-private.h \
|
||||
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
|
||||
../cups/http.h ../cups/array.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
|
||||
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
|
||||
testbackend.o: testbackend.c ../cups/string-private.h ../config.h \
|
||||
../cups/cups.h ../cups/file.h ../cups/versioning.h ../cups/ipp.h \
|
||||
../cups/http.h ../cups/array.h ../cups/language.h \
|
||||
../cups/sidechannel.h
|
||||
testsupplies.o: testsupplies.c backend-private.h ../cups/cups-private.h \
|
||||
../cups/cups.h ../cups/file.h ../cups/versioning.h ../cups/ipp.h \
|
||||
../cups/http.h ../cups/array.h ../cups/language.h \
|
||||
../cups/string-private.h ../config.h ../cups/debug-private.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/pwg-private.h \
|
||||
../cups/http-private.h ../cups/md5-private.h ../cups/ipp-private.h \
|
||||
../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
|
||||
../cups/sidechannel.h
|
||||
usb.o: usb.c backend-private.h ../cups/cups-private.h ../cups/cups.h \
|
||||
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
|
||||
../cups/array.h ../cups/language.h ../cups/string-private.h \
|
||||
../config.h ../cups/debug-private.h ../cups/ppd-private.h \
|
||||
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
|
||||
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
|
||||
../cups/backend.h ../cups/sidechannel.h usb-darwin.c \
|
||||
../cups/file-private.h
|
||||
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
|
||||
../cups/http.h ../cups/array.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
|
||||
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
|
||||
usb.o: usb.c backend-private.h ../cups/cups-private.h \
|
||||
../cups/string-private.h ../config.h ../cups/debug-private.h \
|
||||
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
|
||||
../cups/http.h ../cups/array.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
|
||||
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h \
|
||||
usb-darwin.c ../cups/file-private.h
|
||||
|
||||
+12
-4
@@ -21,6 +21,12 @@ include ../Makedefs
|
||||
# Object files...
|
||||
#
|
||||
|
||||
# RBACKENDS are installed mode 0700 so cupsd will run them as root...
|
||||
#
|
||||
# UBACKENDS 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...
|
||||
RBACKENDS = \
|
||||
ipp \
|
||||
lpd \
|
||||
@@ -122,7 +128,7 @@ install-exec: $(INSTALLXPC)
|
||||
$(RM) $(SERVERBIN)/backend/$$file; \
|
||||
$(LN) ipp $(SERVERBIN)/backend/$$file; \
|
||||
done
|
||||
if test "x$(DNSSD_BACKEND)" != x; then \
|
||||
if test "x$(DNSSD_BACKEND)" != x -a `uname` = Darwin; then \
|
||||
$(RM) $(SERVERBIN)/backend/mdns; \
|
||||
$(LN) $(DNSSD_BACKEND) $(SERVERBIN)/backend/mdns; \
|
||||
fi
|
||||
@@ -226,8 +232,10 @@ libbackend.a: $(LIBOBJS)
|
||||
dnssd: dnssd.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o dnssd dnssd.o libbackend.a $(LIBS)
|
||||
$(RM) mdns
|
||||
$(LN) dnssd mdns
|
||||
if test `uname` = Darwin; then \
|
||||
$(RM) mdns; \
|
||||
$(LN) dnssd mdns; \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
@@ -274,7 +282,7 @@ socket: socket.o ../cups/$(LIBCUPS) libbackend.a
|
||||
|
||||
usb: usb.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
|
||||
$(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
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Backend support definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -259,6 +259,20 @@ extern "C" {
|
||||
#define CUPS_TC_inserts 33
|
||||
#define CUPS_TC_covers 34
|
||||
|
||||
#define CUPS_TC_tenThousandthsOfInches 3
|
||||
#define CUPS_TC_micrometers 4
|
||||
#define CUPS_TC_impressions 7
|
||||
#define CUPS_TC_sheets 8
|
||||
#define CUPS_TC_hours 11
|
||||
#define CUPS_TC_thousandthsOfOunces 12
|
||||
#define CUPS_TC_tenthsOfGrams 13
|
||||
#define CUPS_TC_hundrethsOfFluidOunces 14
|
||||
#define CUPS_TC_tenthsOfMilliliters 15
|
||||
#define CUPS_TC_feet 16
|
||||
#define CUPS_TC_meters 17
|
||||
#define CUPS_TC_items 18
|
||||
#define CUPS_TC_percent 19
|
||||
|
||||
/* These come from RFC 3808 to define character sets we support */
|
||||
/* Also see http://www.iana.org/assignments/character-sets */
|
||||
#define CUPS_TC_csASCII 3
|
||||
|
||||
+561
-246
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+327
-99
@@ -45,8 +45,12 @@
|
||||
# define kPMPrintUIToolAgent "com.apple.printuitool.agent"
|
||||
# define kPMStartJob 100
|
||||
# define kPMWaitForJob 101
|
||||
# ifdef HAVE_XPC_PRIVATE_H
|
||||
# include <xpc/private.h>
|
||||
# else
|
||||
extern void xpc_connection_set_target_uid(xpc_connection_t connection,
|
||||
uid_t uid);
|
||||
# endif /* HAVE_XPC_PRIVATE_H */
|
||||
#endif /* HAVE_GSSAPI && HAVE_XPC */
|
||||
|
||||
|
||||
@@ -62,7 +66,8 @@ typedef struct _cups_monitor_s /**** Monitoring data ****/
|
||||
*resource; /* Resource path */
|
||||
int port, /* Port number */
|
||||
version, /* IPP version */
|
||||
job_id; /* Job ID for submitted job */
|
||||
job_id, /* Job ID for submitted job */
|
||||
get_job_attrs; /* Support Get-Job-Attributes? */
|
||||
const char *job_name; /* Job name for submitted job */
|
||||
http_encryption_t encryption; /* Use encryption? */
|
||||
ipp_jstate_t job_state; /* Current job state */
|
||||
@@ -81,6 +86,7 @@ static int child_pid = 0; /* Child process ID */
|
||||
#endif /* HAVE_GSSAPI && HAVE_XPC */
|
||||
static const char * const jattrs[] = /* Job attributes we want */
|
||||
{
|
||||
"job-id",
|
||||
"job-impressions-completed",
|
||||
"job-media-sheets-completed",
|
||||
"job-name",
|
||||
@@ -90,7 +96,9 @@ static const char * const jattrs[] = /* Job attributes we want */
|
||||
};
|
||||
static int job_canceled = 0;
|
||||
/* Job cancelled? */
|
||||
static char *password = NULL;
|
||||
static char username[256] = "",
|
||||
/* Username for device URI */
|
||||
*password = NULL;
|
||||
/* Password for device URI */
|
||||
static int password_tries = 0;
|
||||
/* Password tries */
|
||||
@@ -162,7 +170,7 @@ static const char *password_cb(const char *);
|
||||
static void report_attr(ipp_attribute_t *attr);
|
||||
static void report_printer_state(ipp_t *ipp);
|
||||
#if defined(HAVE_GSSAPI) && defined(HAVE_XPC)
|
||||
static int run_as_user(int argc, char *argv[], uid_t uid,
|
||||
static int run_as_user(char *argv[], uid_t uid,
|
||||
const char *device_uri, int fd);
|
||||
#endif /* HAVE_GSSAPI && HAVE_XPC */
|
||||
static void sigterm_handler(int sig);
|
||||
@@ -189,7 +197,6 @@ main(int argc, /* I - Number of command-line args */
|
||||
const char *device_uri; /* Device URI */
|
||||
char scheme[255], /* Scheme in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info */
|
||||
resource[1024], /* Resource info (printer name) */
|
||||
addrname[256], /* Address name */
|
||||
*optptr, /* Pointer to URI options */
|
||||
@@ -197,6 +204,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
*value, /* Value of option */
|
||||
sep; /* Separator character */
|
||||
http_addrlist_t *addrlist; /* Address of printer */
|
||||
int snmp_enabled = 1; /* Is SNMP enabled? */
|
||||
int snmp_fd, /* SNMP socket */
|
||||
start_count, /* Page count via SNMP at start */
|
||||
page_count, /* Page count via SNMP */
|
||||
@@ -236,6 +244,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
ipp_attribute_t *printer_state; /* printer-state attribute */
|
||||
ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs */
|
||||
int create_job = 0, /* Does printer support Create-Job? */
|
||||
get_job_attrs = 0, /* Does printer support Get-Job-Attributes? */
|
||||
send_document = 0, /* Does printer support Send-Document? */
|
||||
validate_job = 0; /* Does printer support Validate-Job? */
|
||||
int copies, /* Number of copies for job */
|
||||
@@ -341,7 +350,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
if (uid > 0)
|
||||
{
|
||||
if (argc == 6)
|
||||
return (run_as_user(argc, argv, uid, device_uri, 0));
|
||||
return (run_as_user(argv, uid, device_uri, 0));
|
||||
else
|
||||
{
|
||||
int status = 0; /* Exit status */
|
||||
@@ -350,7 +359,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
{
|
||||
if ((fd = open(argv[i], O_RDONLY)) >= 0)
|
||||
{
|
||||
status = run_as_user(argc, argv, uid, device_uri, fd);
|
||||
status = run_as_user(argv, uid, device_uri, fd);
|
||||
close(fd);
|
||||
}
|
||||
else
|
||||
@@ -501,6 +510,16 @@ main(int argc, /* I - Number of command-line args */
|
||||
value);
|
||||
}
|
||||
}
|
||||
else if (!_cups_strcasecmp(name, "snmp"))
|
||||
{
|
||||
/*
|
||||
* Enable/disable SNMP stuff...
|
||||
*/
|
||||
|
||||
snmp_enabled = !value[0] || !_cups_strcasecmp(value, "on") ||
|
||||
_cups_strcasecmp(value, "yes") ||
|
||||
_cups_strcasecmp(value, "true");
|
||||
}
|
||||
else if (!_cups_strcasecmp(name, "version"))
|
||||
{
|
||||
if (!strcmp(value, "1.0"))
|
||||
@@ -610,7 +629,10 @@ main(int argc, /* I - Number of command-line args */
|
||||
const char *ptr = getenv("AUTH_USERNAME");
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
strlcpy(username, ptr, sizeof(username));
|
||||
cupsSetUser(ptr);
|
||||
}
|
||||
|
||||
password = getenv("AUTH_PASSWORD");
|
||||
}
|
||||
@@ -637,6 +659,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
update_reasons(NULL, "-connecting-to-device");
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
if (job_canceled)
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
http = _httpCreate(hostname, port, addrlist, cupsEncryption(), AF_UNSPEC);
|
||||
@@ -646,11 +671,14 @@ main(int argc, /* I - Number of command-line args */
|
||||
* See if the printer supports SNMP...
|
||||
*/
|
||||
|
||||
if ((snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family)) >= 0)
|
||||
{
|
||||
if (snmp_enabled)
|
||||
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
|
||||
else
|
||||
snmp_fd = -1;
|
||||
|
||||
if (snmp_fd >= 0)
|
||||
have_supplies = !backendSNMPSupplies(snmp_fd, &(addrlist->addr),
|
||||
&start_count, NULL);
|
||||
}
|
||||
else
|
||||
have_supplies = start_count = 0;
|
||||
|
||||
@@ -741,7 +769,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
case ECONNREFUSED :
|
||||
default :
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("The printer is busy."));
|
||||
_("The printer is in use."));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -764,7 +792,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
while (http->fd < 0);
|
||||
|
||||
if (job_canceled || !http)
|
||||
if (job_canceled)
|
||||
return (CUPS_BACKEND_OK);
|
||||
else if (!http)
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
|
||||
update_reasons(NULL, "-connecting-to-device");
|
||||
@@ -839,7 +869,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
|
||||
ippErrorString(ipp_status), cupsLastErrorString());
|
||||
|
||||
if (ipp_status > IPP_OK_CONFLICT)
|
||||
if (ipp_status <= IPP_OK_CONFLICT)
|
||||
password_tries = 0;
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Get-Printer-Attributes returned %s.\n",
|
||||
ippErrorString(ipp_status));
|
||||
@@ -854,7 +886,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
|
||||
|
||||
report_printer_state(supported);
|
||||
|
||||
@@ -872,14 +904,14 @@ main(int argc, /* I - Number of command-line args */
|
||||
if (version >= 20)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("Printer does not support IPP/%d.%d, trying "
|
||||
_("The printer does not support IPP/%d.%d, trying "
|
||||
"IPP/%s."), version / 10, version % 10, "1.1");
|
||||
version = 11;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("Printer does not support IPP/%d.%d, trying "
|
||||
_("The printer does not support IPP/%d.%d, trying "
|
||||
"IPP/%s."), version / 10, version % 10, "1.0");
|
||||
version = 10;
|
||||
}
|
||||
@@ -896,20 +928,27 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
|
||||
else if (ipp_status == IPP_FORBIDDEN ||
|
||||
ipp_status == IPP_AUTHENTICATION_CANCELED)
|
||||
{
|
||||
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
|
||||
"Negotiate", 9))
|
||||
const char *www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
|
||||
/* WWW-Authenticate field value */
|
||||
|
||||
if (!strncmp(www_auth, "Negotiate", 9))
|
||||
auth_info_required = "negotiate";
|
||||
else if (www_auth[0])
|
||||
auth_info_required = "username,password";
|
||||
|
||||
fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
|
||||
return (CUPS_BACKEND_AUTH_REQUIRED);
|
||||
}
|
||||
else
|
||||
else if (ipp_status != IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "ERROR",
|
||||
_("Unable to get printer status."));
|
||||
sleep(10);
|
||||
|
||||
httpReconnect(http);
|
||||
}
|
||||
|
||||
ippDelete(supported);
|
||||
@@ -937,9 +976,15 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
if ((printer_state = ippFindAttribute(supported,
|
||||
"printer-state-reasons",
|
||||
IPP_TAG_KEYWORD)) != NULL && !busy)
|
||||
IPP_TAG_KEYWORD)) == NULL)
|
||||
{
|
||||
update_reasons(NULL, "+cups-ipp-conformance-failure-report,"
|
||||
"cups-ipp-missing-printer-state-reasons");
|
||||
}
|
||||
else if (!busy)
|
||||
{
|
||||
for (i = 0; i < printer_state->num_values; i ++)
|
||||
{
|
||||
if (!strcmp(printer_state->values[0].string.text,
|
||||
"spool-area-full") ||
|
||||
!strncmp(printer_state->values[0].string.text, "spool-area-full-",
|
||||
@@ -948,14 +993,12 @@ main(int argc, /* I - Number of command-line args */
|
||||
busy = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
update_reasons(NULL, "+cups-ipp-conformance-failure-report,"
|
||||
"cups-ipp-missing-printer-state-reasons");
|
||||
|
||||
if (busy)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
|
||||
|
||||
report_printer_state(supported);
|
||||
|
||||
@@ -1014,6 +1057,12 @@ main(int argc, /* I - Number of command-line args */
|
||||
if ((operations_sup = ippFindAttribute(supported, "operations-supported",
|
||||
IPP_TAG_ENUM)) != NULL)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: operations-supported (%d values)\n",
|
||||
operations_sup->num_values);
|
||||
for (i = 0; i < operations_sup->num_values; i ++)
|
||||
fprintf(stderr, "DEBUG: [%d] = %s\n", i,
|
||||
ippOpString(operations_sup->values[i].integer));
|
||||
|
||||
for (i = 0; i < operations_sup->num_values; i ++)
|
||||
if (operations_sup->values[i].integer == IPP_PRINT_JOB)
|
||||
break;
|
||||
@@ -1054,13 +1103,18 @@ main(int argc, /* I - Number of command-line args */
|
||||
create_job = 1;
|
||||
else if (operations_sup->values[i].integer == IPP_SEND_DOCUMENT)
|
||||
send_document = 1;
|
||||
else if (operations_sup->values[i].integer == IPP_GET_JOB_ATTRIBUTES)
|
||||
get_job_attrs = 1;
|
||||
}
|
||||
|
||||
if (!send_document)
|
||||
if (create_job && !send_document)
|
||||
{
|
||||
fputs("DEBUG: Printer supports Create-Job but not Send-Document.\n",
|
||||
stderr);
|
||||
create_job = 0;
|
||||
|
||||
update_reasons(NULL, "+cups-ipp-conformance-failure-report,"
|
||||
"cups-ipp-missing-send-document");
|
||||
}
|
||||
|
||||
if (!validate_job)
|
||||
@@ -1077,7 +1131,10 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
report_printer_state(supported);
|
||||
}
|
||||
while (ipp_status > IPP_OK_CONFLICT);
|
||||
while (!job_canceled && ipp_status > IPP_OK_CONFLICT);
|
||||
|
||||
if (job_canceled)
|
||||
return (CUPS_BACKEND_OK);
|
||||
|
||||
/*
|
||||
* See if the printer is accepting jobs and is not stopped; if either
|
||||
@@ -1128,12 +1185,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
copies = atoi(argv[4]);
|
||||
|
||||
if (copies_sup || argc < 7)
|
||||
{
|
||||
copies_remaining = 1;
|
||||
|
||||
if (argc < 7 && !_cups_strncasecmp(final_content_type, "image/", 6))
|
||||
copies = 1;
|
||||
}
|
||||
else
|
||||
copies_remaining = copies;
|
||||
|
||||
@@ -1168,7 +1220,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
if (format_sup != NULL)
|
||||
{
|
||||
for (i = 0; i < format_sup->num_values; i ++)
|
||||
if (!_cups_strcasecmp(final_content_type, format_sup->values[i].string.text))
|
||||
if (!_cups_strcasecmp(final_content_type,
|
||||
format_sup->values[i].string.text))
|
||||
{
|
||||
document_format = final_content_type;
|
||||
break;
|
||||
@@ -1178,7 +1231,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
{
|
||||
for (i = 0; i < format_sup->num_values; i ++)
|
||||
if (!_cups_strcasecmp("application/octet-stream",
|
||||
format_sup->values[i].string.text))
|
||||
format_sup->values[i].string.text))
|
||||
{
|
||||
document_format = "application/octet-stream";
|
||||
break;
|
||||
@@ -1186,6 +1239,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: final_content_type=\"%s\", document_format=\"%s\"\n",
|
||||
final_content_type, document_format ? document_format : "(null)");
|
||||
|
||||
/*
|
||||
* If the printer does not support HTTP/1.1 (which IPP requires), copy stdin
|
||||
* to a temporary file so that we can do a HTTP/1.0 submission...
|
||||
@@ -1203,8 +1259,17 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Copying print data."));
|
||||
|
||||
compatsize = backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
|
||||
backendNetworkSideCB);
|
||||
if ((compatsize = write(fd, buffer, bytes)) < 0)
|
||||
{
|
||||
perror("DEBUG: Unable to write temporary file");
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if ((bytes = backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
|
||||
backendNetworkSideCB)) < 0)
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
|
||||
compatsize += bytes;
|
||||
|
||||
close(fd);
|
||||
|
||||
@@ -1220,6 +1285,17 @@ main(int argc, /* I - Number of command-line args */
|
||||
compatsize = fileinfo.st_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the printer only claims to support IPP/1.0, or if the user specifically
|
||||
* included version=1.0 in the URI, then do not try to use Create-Job or
|
||||
* Send-Document. This is another dreaded compatibility hack, but
|
||||
* unfortunately there are enough broken printers out there that we need
|
||||
* this for now...
|
||||
*/
|
||||
|
||||
if (version == 10)
|
||||
create_job = send_document = 0;
|
||||
|
||||
/*
|
||||
* Start monitoring the printer in the background...
|
||||
*/
|
||||
@@ -1231,6 +1307,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
monitor.port = port;
|
||||
monitor.version = version;
|
||||
monitor.job_id = 0;
|
||||
monitor.get_job_attrs = get_job_attrs;
|
||||
monitor.encryption = cupsEncryption();
|
||||
monitor.job_state = IPP_JOB_PENDING;
|
||||
monitor.printer_state = IPP_PRINTER_IDLE;
|
||||
@@ -1271,29 +1348,21 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
if (ipp_status == IPP_SERVICE_UNAVAILABLE || ipp_status == IPP_PRINTER_BUSY)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
|
||||
sleep(10);
|
||||
}
|
||||
else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN ||
|
||||
else if (ipp_status == IPP_DOCUMENT_FORMAT)
|
||||
goto cleanup;
|
||||
else if (ipp_status == IPP_FORBIDDEN ||
|
||||
ipp_status == IPP_AUTHENTICATION_CANCELED)
|
||||
{
|
||||
/*
|
||||
* Update auth-info-required as needed...
|
||||
*/
|
||||
const char *www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
|
||||
/* WWW-Authenticate field value */
|
||||
|
||||
fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
|
||||
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
|
||||
|
||||
/*
|
||||
* Normal authentication goes through the password callback, which sets
|
||||
* auth_info_required to "username,password". Kerberos goes directly
|
||||
* through GSSAPI, so look for Negotiate in the WWW-Authenticate header
|
||||
* here and set auth_info_required as needed...
|
||||
*/
|
||||
|
||||
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
|
||||
"Negotiate", 9))
|
||||
if (!strncmp(www_auth, "Negotiate", 9))
|
||||
auth_info_required = "negotiate";
|
||||
else if (www_auth[0])
|
||||
auth_info_required = "username,password";
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -1307,7 +1376,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
"cups-ipp-missing-validate-job");
|
||||
break;
|
||||
}
|
||||
else if (ipp_status < IPP_REDIRECTION_OTHER_SITE)
|
||||
else if (ipp_status < IPP_REDIRECTION_OTHER_SITE ||
|
||||
ipp_status == IPP_BAD_REQUEST)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1429,7 +1499,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
ipp_status == IPP_NOT_POSSIBLE ||
|
||||
ipp_status == IPP_PRINTER_BUSY)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
|
||||
sleep(10);
|
||||
|
||||
if (num_files == 0)
|
||||
@@ -1442,7 +1512,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
else if (ipp_status == IPP_ERROR_JOB_CANCELED)
|
||||
else if (ipp_status == IPP_ERROR_JOB_CANCELED ||
|
||||
ipp_status == IPP_NOT_AUTHORIZED)
|
||||
goto cleanup;
|
||||
else
|
||||
{
|
||||
@@ -1453,21 +1524,24 @@ main(int argc, /* I - Number of command-line args */
|
||||
_cupsLangPrintFilter(stderr, "ERROR",
|
||||
_("Print file was not accepted."));
|
||||
|
||||
if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
|
||||
if (ipp_status == IPP_FORBIDDEN ||
|
||||
ipp_status == IPP_AUTHENTICATION_CANCELED)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
|
||||
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
|
||||
const char *www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
|
||||
/* WWW-Authenticate field value */
|
||||
|
||||
/*
|
||||
* Normal authentication goes through the password callback, which sets
|
||||
* auth_info_required to "username,password". Kerberos goes directly
|
||||
* through GSSAPI, so look for Negotiate in the WWW-Authenticate header
|
||||
* here and set auth_info_required as needed...
|
||||
if (!strncmp(www_auth, "Negotiate", 9))
|
||||
auth_info_required = "negotiate";
|
||||
else if (www_auth[0])
|
||||
auth_info_required = "username,password";
|
||||
}
|
||||
else if (ipp_status == IPP_REQUEST_VALUE)
|
||||
{
|
||||
/*
|
||||
* Print file is too large, abort this job...
|
||||
*/
|
||||
|
||||
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
|
||||
"Negotiate", 9))
|
||||
auth_info_required = "negotiate";
|
||||
goto cleanup;
|
||||
}
|
||||
else
|
||||
sleep(10);
|
||||
@@ -1494,6 +1568,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
else
|
||||
{
|
||||
password_tries = 0;
|
||||
monitor.job_id = job_id = job_id_attr->values[0].integer;
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("Print file accepted - job ID %d."), job_id);
|
||||
@@ -1536,8 +1611,13 @@ main(int argc, /* I - Number of command-line args */
|
||||
if ((i + 1) >= num_files)
|
||||
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
|
||||
"document-format", NULL, document_format);
|
||||
if (document_format)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
|
||||
"document-format", NULL, document_format);
|
||||
|
||||
if (compression)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"compression", NULL, compression);
|
||||
|
||||
fprintf(stderr, "DEBUG: Sending file %d using chunking...\n", i + 1);
|
||||
http_status = cupsSendRequest(http, request, resource, 0);
|
||||
@@ -1562,10 +1642,11 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
if (fd >= 0)
|
||||
{
|
||||
while (!job_canceled &&
|
||||
while (!job_canceled && http_status == HTTP_CONTINUE &&
|
||||
(bytes = read(fd, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
if (cupsWriteRequestData(http, buffer, bytes) != HTTP_CONTINUE)
|
||||
if ((http_status = cupsWriteRequestData(http, buffer, bytes))
|
||||
!= HTTP_CONTINUE)
|
||||
break;
|
||||
else
|
||||
{
|
||||
@@ -1595,8 +1676,13 @@ main(int argc, /* I - Number of command-line args */
|
||||
_("Unable to add document to print job."));
|
||||
break;
|
||||
}
|
||||
else if (num_files == 0 || fd < 0)
|
||||
break;
|
||||
else
|
||||
{
|
||||
password_tries = 0;
|
||||
|
||||
if (num_files == 0 || fd < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1608,7 +1694,72 @@ main(int argc, /* I - Number of command-line args */
|
||||
else if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
|
||||
ipp_status == IPP_NOT_POSSIBLE ||
|
||||
ipp_status == IPP_PRINTER_BUSY)
|
||||
{
|
||||
if (argc == 6)
|
||||
{
|
||||
/*
|
||||
* Need to reprocess the entire job; if we have a job ID, cancel the
|
||||
* job first...
|
||||
*/
|
||||
|
||||
if (job_id > 0)
|
||||
cancel_job(http, uri, job_id, resource, argv[2], version);
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (ipp_status == IPP_REQUEST_VALUE ||
|
||||
ipp_status == IPP_ERROR_JOB_CANCELED ||
|
||||
ipp_status == IPP_NOT_AUTHORIZED ||
|
||||
ipp_status == IPP_INTERNAL_ERROR)
|
||||
{
|
||||
/*
|
||||
* Print file is too large, job was canceled, we need new
|
||||
* authentication data, or we had some sort of error...
|
||||
*/
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
else if (ipp_status == IPP_UPGRADE_REQUIRED)
|
||||
{
|
||||
/*
|
||||
* Server is configured incorrectly; the policy for Create-Job and
|
||||
* Send-Document has to be the same (auth or no auth, encryption or
|
||||
* no encryption). Force the queue to stop since printing will never
|
||||
* work.
|
||||
*/
|
||||
|
||||
fputs("DEBUG: The server or printer is configured incorrectly.\n",
|
||||
stderr);
|
||||
fputs("DEBUG: The policy for Create-Job and Send-Document must have the "
|
||||
"same authentication and encryption requirements.\n", stderr);
|
||||
|
||||
ipp_status = IPP_INTERNAL_ERROR;
|
||||
|
||||
if (job_id > 0)
|
||||
cancel_job(http, uri, job_id, resource, argv[2], version);
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
else if (ipp_status == IPP_NOT_FOUND)
|
||||
{
|
||||
/*
|
||||
* Printer does not actually implement support for Create-Job/
|
||||
* Send-Document, so log the conformance issue and stop the printer.
|
||||
*/
|
||||
|
||||
fputs("DEBUG: This printer claims to support Create-Job and "
|
||||
"Send-Document, but those operations failed.\n", stderr);
|
||||
fputs("DEBUG: Add '?version=1.0' to the device URI to use legacy "
|
||||
"compatibility mode.\n", stderr);
|
||||
update_reasons(NULL, "+cups-ipp-conformance-failure-report,"
|
||||
"cups-ipp-missing-send-document");
|
||||
|
||||
ipp_status = IPP_INTERNAL_ERROR; /* Force queue to stop */
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
else
|
||||
copies_remaining --;
|
||||
|
||||
@@ -1616,7 +1767,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Wait for the job to complete...
|
||||
*/
|
||||
|
||||
if (!job_id || !waitjob)
|
||||
if (!job_id || !waitjob || !get_job_attrs)
|
||||
continue;
|
||||
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Waiting for job to complete."));
|
||||
@@ -1659,7 +1810,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
response = cupsDoRequest(http, request, resource);
|
||||
ipp_status = cupsLastError();
|
||||
|
||||
if (ipp_status == IPP_NOT_FOUND)
|
||||
if (ipp_status == IPP_NOT_FOUND || ipp_status == IPP_NOT_POSSIBLE)
|
||||
{
|
||||
/*
|
||||
* Job has gone away and/or the server has no job history...
|
||||
@@ -1676,16 +1827,14 @@ main(int argc, /* I - Number of command-line args */
|
||||
fprintf(stderr, "DEBUG: Get-Job-Attributes: %s (%s)\n",
|
||||
ippErrorString(ipp_status), cupsLastErrorString());
|
||||
|
||||
if (ipp_status > IPP_OK_CONFLICT)
|
||||
if (ipp_status <= IPP_OK_CONFLICT)
|
||||
password_tries = 0;
|
||||
else
|
||||
{
|
||||
if (ipp_status != IPP_SERVICE_UNAVAILABLE &&
|
||||
ipp_status != IPP_NOT_POSSIBLE &&
|
||||
ipp_status != IPP_PRINTER_BUSY)
|
||||
{
|
||||
ippDelete(response);
|
||||
|
||||
_cupsLangPrintFilter(stderr, "ERROR",
|
||||
_("Unable to get print job status."));
|
||||
ipp_status = IPP_OK;
|
||||
break;
|
||||
}
|
||||
@@ -1761,7 +1910,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Cancel the job as needed...
|
||||
*/
|
||||
|
||||
if (job_canceled && job_id)
|
||||
if (job_canceled > 0 && job_id > 0)
|
||||
cancel_job(http, uri, job_id, resource, argv[2], version);
|
||||
|
||||
/*
|
||||
@@ -1775,7 +1924,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
*/
|
||||
|
||||
if (have_supplies &&
|
||||
!backendSNMPSupplies(snmp_fd, http->hostaddr, &page_count, NULL) &&
|
||||
!backendSNMPSupplies(snmp_fd, &(http->addrlist->addr), &page_count,
|
||||
NULL) &&
|
||||
page_count > start_count)
|
||||
fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
|
||||
|
||||
@@ -1830,16 +1980,25 @@ main(int argc, /* I - Number of command-line args */
|
||||
return (CUPS_BACKEND_AUTH_REQUIRED);
|
||||
else if (ipp_status == IPP_INTERNAL_ERROR)
|
||||
return (CUPS_BACKEND_STOP);
|
||||
else if (ipp_status == IPP_DOCUMENT_FORMAT ||
|
||||
ipp_status == IPP_CONFLICT)
|
||||
else if (ipp_status == IPP_CONFLICT)
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
else if (ipp_status == IPP_REQUEST_VALUE ||
|
||||
ipp_status == IPP_DOCUMENT_FORMAT || job_canceled < 0)
|
||||
{
|
||||
if (ipp_status == IPP_REQUEST_VALUE)
|
||||
_cupsLangPrintFilter(stderr, "ERROR", _("Print job too large."));
|
||||
else if (ipp_status == IPP_DOCUMENT_FORMAT)
|
||||
_cupsLangPrintFilter(stderr, "ERROR",
|
||||
_("Printer cannot print supplied content."));
|
||||
else
|
||||
_cupsLangPrintFilter(stderr, "ERROR", _("Print job canceled at printer."));
|
||||
|
||||
return (CUPS_BACKEND_CANCEL);
|
||||
}
|
||||
else if (ipp_status > IPP_OK_CONFLICT && ipp_status != IPP_ERROR_JOB_CANCELED)
|
||||
return (CUPS_BACKEND_RETRY_CURRENT);
|
||||
else
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Ready to print."));
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1935,6 +2094,9 @@ check_printer_state(
|
||||
fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
|
||||
ippErrorString(cupsLastError()), cupsLastErrorString());
|
||||
|
||||
if (cupsLastError() <= IPP_OK_CONFLICT)
|
||||
password_tries = 0;
|
||||
|
||||
/*
|
||||
* Return the printer-state value...
|
||||
*/
|
||||
@@ -2042,6 +2204,8 @@ monitor_printer(
|
||||
http = _httpCreate(monitor->hostname, monitor->port, NULL, monitor->encryption,
|
||||
AF_UNSPEC);
|
||||
httpSetTimeout(http, 30.0, timeout_cb, NULL);
|
||||
if (username[0])
|
||||
cupsSetUser(username);
|
||||
cupsSetPasswordCB(password_cb);
|
||||
|
||||
/*
|
||||
@@ -2071,7 +2235,8 @@ monitor_printer(
|
||||
* Check the status of the job itself...
|
||||
*/
|
||||
|
||||
job_op = monitor->job_id > 0 ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS;
|
||||
job_op = (monitor->job_id > 0 && monitor->get_job_attrs) ?
|
||||
IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS;
|
||||
request = ippNewRequest(job_op);
|
||||
request->request.op.version[0] = monitor->version / 10;
|
||||
request->request.op.version[1] = monitor->version % 10;
|
||||
@@ -2096,9 +2261,12 @@ monitor_printer(
|
||||
|
||||
response = cupsDoRequest(http, request, monitor->resource);
|
||||
|
||||
fprintf(stderr, "DEBUG: %s: %s (%s)\n", ippOpString(job_op),
|
||||
fprintf(stderr, "DEBUG: (monitor) %s: %s (%s)\n", ippOpString(job_op),
|
||||
ippErrorString(cupsLastError()), cupsLastErrorString());
|
||||
|
||||
if (cupsLastError() <= IPP_OK_CONFLICT)
|
||||
password_tries = 0;
|
||||
|
||||
if (job_op == IPP_GET_JOB_ATTRIBUTES)
|
||||
{
|
||||
if ((attr = ippFindAttribute(response, "job-state",
|
||||
@@ -2157,6 +2325,14 @@ monitor_printer(
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
fprintf(stderr, "DEBUG: (monitor) job-state=%s\n",
|
||||
ippEnumString("job-state", monitor->job_state));
|
||||
|
||||
if (!job_canceled &&
|
||||
(monitor->job_state == IPP_JOB_CANCELED ||
|
||||
monitor->job_state == IPP_JOB_ABORTED))
|
||||
job_canceled = -1;
|
||||
|
||||
/*
|
||||
* Disconnect from the printer - we'll reconnect on the next poll...
|
||||
*/
|
||||
@@ -2177,7 +2353,7 @@ monitor_printer(
|
||||
* Cancel the job if necessary...
|
||||
*/
|
||||
|
||||
if (job_canceled && monitor->job_id > 0)
|
||||
if (job_canceled > 0 && monitor->job_id > 0)
|
||||
if (!httpReconnect(http))
|
||||
cancel_job(http, monitor->uri, monitor->job_id, monitor->resource,
|
||||
monitor->user, monitor->version);
|
||||
@@ -2258,7 +2434,7 @@ new_request(
|
||||
fprintf(stderr, "DEBUG: job-name=\"%s\"\n", title);
|
||||
}
|
||||
|
||||
if (format)
|
||||
if (format && op != IPP_CREATE_JOB)
|
||||
{
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
|
||||
"document-format", NULL, format);
|
||||
@@ -2266,7 +2442,7 @@ new_request(
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
if (compression)
|
||||
if (compression && op != IPP_CREATE_JOB)
|
||||
{
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"compression", NULL, compression);
|
||||
@@ -2405,9 +2581,46 @@ new_request(
|
||||
NULL, "two-sided-short-edge");
|
||||
}
|
||||
|
||||
if (doc_handling_sup &&
|
||||
(!format || _cups_strncasecmp(format, "image/", 6)) &&
|
||||
(keyword = cupsGetOption("collate", num_options, options)) != NULL)
|
||||
if ((keyword = cupsGetOption("multiple-document-handling",
|
||||
num_options, options)) != NULL)
|
||||
{
|
||||
if (strstr(keyword, "uncollated"))
|
||||
keyword = "false";
|
||||
else
|
||||
keyword = "true";
|
||||
}
|
||||
else if ((keyword = cupsGetOption("collate", num_options,
|
||||
options)) == NULL)
|
||||
keyword = "true";
|
||||
|
||||
if (format)
|
||||
{
|
||||
if (!_cups_strcasecmp(format, "image/gif") ||
|
||||
!_cups_strcasecmp(format, "image/jp2") ||
|
||||
!_cups_strcasecmp(format, "image/jpeg") ||
|
||||
!_cups_strcasecmp(format, "image/png") ||
|
||||
!_cups_strcasecmp(format, "image/tiff") ||
|
||||
!_cups_strncasecmp(format, "image/x-", 8))
|
||||
{
|
||||
/*
|
||||
* Collation makes no sense for single page image formats...
|
||||
*/
|
||||
|
||||
keyword = "false";
|
||||
}
|
||||
else if (!_cups_strncasecmp(format, "image/", 6) ||
|
||||
!_cups_strcasecmp(format, "application/vnd.cups-raster"))
|
||||
{
|
||||
/*
|
||||
* Multi-page image formats will have copies applied by the upstream
|
||||
* filters...
|
||||
*/
|
||||
|
||||
copies = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (doc_handling_sup)
|
||||
{
|
||||
if (!_cups_strcasecmp(keyword, "true"))
|
||||
collate_str = "separate-documents-collated-copies";
|
||||
@@ -2421,6 +2634,9 @@ new_request(
|
||||
"multiple-document-handling", NULL, collate_str);
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= doc_handling_sup->num_values)
|
||||
copies = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2466,10 +2682,10 @@ new_request(
|
||||
* When talking to another CUPS server, send all options...
|
||||
*/
|
||||
|
||||
cupsEncodeOptions(request, num_options, options);
|
||||
cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB);
|
||||
}
|
||||
|
||||
if (copies > 1)
|
||||
if (copies > 1 && (!pc || copies <= pc->max_copies))
|
||||
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies", copies);
|
||||
}
|
||||
|
||||
@@ -2484,6 +2700,9 @@ new_request(
|
||||
static const char * /* O - Password */
|
||||
password_cb(const char *prompt) /* I - Prompt (not used) */
|
||||
{
|
||||
fprintf(stderr, "DEBUG: password_cb(prompt=\"%s\"), password=%p, "
|
||||
"password_tries=%d\n", prompt, password, password_tries);
|
||||
|
||||
(void)prompt;
|
||||
|
||||
/*
|
||||
@@ -2546,17 +2765,23 @@ report_attr(ipp_attribute_t *attr) /* I - Attribute */
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
*valptr++ = '\'';
|
||||
*valptr++ = '\"';
|
||||
for (attrptr = attr->values[i].string.text;
|
||||
*attrptr && valptr < (value + sizeof(value) - 10);
|
||||
attrptr ++)
|
||||
{
|
||||
if (*attrptr == '\\' || *attrptr == '\"')
|
||||
if (*attrptr == '\\' || *attrptr == '\"' || *attrptr == '\'')
|
||||
{
|
||||
*valptr++ = '\\';
|
||||
*valptr++ = '\\';
|
||||
*valptr++ = '\\';
|
||||
}
|
||||
|
||||
*valptr++ = *attrptr;
|
||||
}
|
||||
*valptr++ = '\"';
|
||||
*valptr++ = '\'';
|
||||
break;
|
||||
|
||||
default :
|
||||
@@ -2713,8 +2938,7 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */
|
||||
*/
|
||||
|
||||
static int /* O - Exit status */
|
||||
run_as_user(int argc, /* I - Number of command-line args */
|
||||
char *argv[], /* I - Command-line arguments */
|
||||
run_as_user(char *argv[], /* I - Command-line arguments */
|
||||
uid_t uid, /* I - User ID */
|
||||
const char *device_uri, /* I - Device URI */
|
||||
int fd) /* I - File to print */
|
||||
@@ -2905,6 +3129,8 @@ sigterm_handler(int sig) /* I - Signal */
|
||||
{
|
||||
(void)sig; /* remove compiler warnings... */
|
||||
|
||||
write(2, "DEBUG: Got SIGTERM.\n", 20);
|
||||
|
||||
#if defined(HAVE_GSSAPI) && defined(HAVE_XPC)
|
||||
if (child_pid)
|
||||
{
|
||||
@@ -2919,6 +3145,8 @@ sigterm_handler(int sig) /* I - Signal */
|
||||
* Flag that the job should be canceled...
|
||||
*/
|
||||
|
||||
write(2, "DEBUG: job_canceled = 1.\n", 25);
|
||||
|
||||
job_canceled = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
+71
-78
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Line Printer Daemon backend for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -19,7 +19,6 @@
|
||||
* main() - Send a file to the printer or server.
|
||||
* lpd_command() - Send an LPR command sequence and wait for a reply.
|
||||
* lpd_queue() - Queue a file using the Line Printer Daemon protocol.
|
||||
* lpd_timeout() - Handle timeout alarms...
|
||||
* lpd_write() - Write a buffer of data to an LPD server.
|
||||
* rresvport_af() - A simple implementation of rresvport_af().
|
||||
* sigterm_handler() - Handle 'terminate' signals that stop the backend.
|
||||
@@ -87,14 +86,13 @@ static int abort_job = 0; /* Non-zero if we get SIGTERM */
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int lpd_command(int lpd_fd, int timeout, char *format, ...);
|
||||
static int lpd_command(int lpd_fd, char *format, ...);
|
||||
static int lpd_queue(const char *hostname, http_addrlist_t *addrlist,
|
||||
const char *printer, int print_fd, int snmp_fd,
|
||||
int mode, const char *user, const char *title,
|
||||
int copies, int banner, int format, int order,
|
||||
int reserve, int manual_copies, int timeout,
|
||||
int contimeout);
|
||||
static void lpd_timeout(int sig);
|
||||
int contimeout, const char *orighost);
|
||||
static int lpd_write(int lpd_fd, char *buffer, int length);
|
||||
#ifndef HAVE_RRESVPORT_AF
|
||||
static int rresvport_af(int *port, int family);
|
||||
@@ -128,6 +126,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
int port; /* Port number */
|
||||
char portname[256]; /* Port name (string) */
|
||||
http_addrlist_t *addrlist; /* List of addresses for printer */
|
||||
int snmp_enabled = 1; /* Is SNMP enabled? */
|
||||
int snmp_fd; /* SNMP socket */
|
||||
int fd; /* Print file */
|
||||
int status; /* Status of LPD job */
|
||||
@@ -146,6 +145,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
int num_jobopts; /* Number of job options */
|
||||
cups_option_t *jobopts = NULL; /* Job options */
|
||||
|
||||
|
||||
/*
|
||||
@@ -193,6 +194,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
num_jobopts = cupsParseOptions(argv[5], 0, &jobopts);
|
||||
|
||||
/*
|
||||
* Extract the hostname and printer name from the URI...
|
||||
*/
|
||||
@@ -354,7 +357,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*/
|
||||
|
||||
if (!value[0] || !_cups_strcasecmp(value, "on") ||
|
||||
!_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true") ||
|
||||
!_cups_strcasecmp(value, "yes") ||
|
||||
!_cups_strcasecmp(value, "true") ||
|
||||
!_cups_strcasecmp(value, "rfc1179"))
|
||||
reserve = RESERVE_RFC1179;
|
||||
else if (!_cups_strcasecmp(value, "any"))
|
||||
@@ -369,7 +373,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*/
|
||||
|
||||
manual_copies = !value[0] || !_cups_strcasecmp(value, "on") ||
|
||||
!_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true");
|
||||
!_cups_strcasecmp(value, "yes") ||
|
||||
!_cups_strcasecmp(value, "true");
|
||||
}
|
||||
else if (!_cups_strcasecmp(name, "sanitize_title"))
|
||||
{
|
||||
@@ -378,7 +383,18 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*/
|
||||
|
||||
sanitize_title = !value[0] || !_cups_strcasecmp(value, "on") ||
|
||||
!_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true");
|
||||
!_cups_strcasecmp(value, "yes") ||
|
||||
!_cups_strcasecmp(value, "true");
|
||||
}
|
||||
else if (!_cups_strcasecmp(name, "snmp"))
|
||||
{
|
||||
/*
|
||||
* Enable/disable SNMP stuff...
|
||||
*/
|
||||
|
||||
snmp_enabled = !value[0] || !_cups_strcasecmp(value, "on") ||
|
||||
_cups_strcasecmp(value, "yes") ||
|
||||
_cups_strcasecmp(value, "true");
|
||||
}
|
||||
else if (!_cups_strcasecmp(name, "timeout"))
|
||||
{
|
||||
@@ -426,7 +442,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
}
|
||||
|
||||
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
|
||||
if (snmp_enabled)
|
||||
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
|
||||
else
|
||||
snmp_fd = -1;
|
||||
|
||||
/*
|
||||
* Wait for data from the filter...
|
||||
@@ -527,7 +546,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
status = lpd_queue(hostname, addrlist, resource + 1, fd, snmp_fd, mode,
|
||||
username, title, copies, banner, format, order, reserve,
|
||||
manual_copies, timeout, contimeout);
|
||||
manual_copies, timeout, contimeout,
|
||||
cupsGetOption("job-originating-host-name", num_jobopts,
|
||||
jobopts));
|
||||
|
||||
if (!status)
|
||||
fprintf(stderr, "PAGE: 1 %d\n", atoi(argv[4]));
|
||||
@@ -535,7 +556,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
else
|
||||
status = lpd_queue(hostname, addrlist, resource + 1, fd, snmp_fd, mode,
|
||||
username, title, 1, banner, format, order, reserve, 1,
|
||||
timeout, contimeout);
|
||||
timeout, contimeout,
|
||||
cupsGetOption("job-originating-host-name", num_jobopts,
|
||||
jobopts));
|
||||
|
||||
/*
|
||||
* Remove the temporary file if necessary...
|
||||
@@ -564,7 +587,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
static int /* O - Status of command */
|
||||
lpd_command(int fd, /* I - Socket connection to LPD host */
|
||||
int timeout, /* I - Seconds to wait for a response */
|
||||
char *format, /* I - printf()-style format string */
|
||||
...) /* I - Additional args as necessary */
|
||||
{
|
||||
@@ -609,18 +631,12 @@ lpd_command(int fd, /* I - Socket connection to LPD host */
|
||||
|
||||
fputs("DEBUG: Reading command status...\n", stderr);
|
||||
|
||||
alarm(timeout);
|
||||
|
||||
if (recv(fd, &status, 1, 0) < 1)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("Printer did not respond after %d seconds."),
|
||||
timeout);
|
||||
_cupsLangPrintFilter(stderr, "WARNING", _("The printer did not respond."));
|
||||
status = errno;
|
||||
}
|
||||
|
||||
alarm(0);
|
||||
|
||||
fprintf(stderr, "DEBUG: lpd_command returning %d\n", status);
|
||||
|
||||
return (status);
|
||||
@@ -647,7 +663,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
int reserve, /* I - Reserve ports? */
|
||||
int manual_copies,/* I - Do copies by hand... */
|
||||
int timeout, /* I - Timeout... */
|
||||
int contimeout) /* I - Connection timeout */
|
||||
int contimeout, /* I - Connection timeout */
|
||||
const char *orighost) /* I - job-originating-host-name */
|
||||
{
|
||||
char localhost[255]; /* Local host name */
|
||||
int error; /* Error number */
|
||||
@@ -666,26 +683,12 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
size_t nbytes; /* Number of bytes written */
|
||||
off_t tbytes; /* Total bytes written */
|
||||
char buffer[32768]; /* Output buffer */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
/*
|
||||
* Setup an alarm handler for timeouts...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGALRM, lpd_timeout);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = lpd_timeout;
|
||||
sigaction(SIGALRM, &action, NULL);
|
||||
#ifdef WIN32
|
||||
DWORD tv; /* Timeout in milliseconds */
|
||||
#else
|
||||
signal(SIGALRM, lpd_timeout);
|
||||
#endif /* HAVE_SIGSET */
|
||||
struct timeval tv; /* Timeout in secs and usecs */
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Remember when we started trying to connect to the printer...
|
||||
@@ -839,7 +842,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
case ECONNREFUSED :
|
||||
default :
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("The printer is busy."));
|
||||
_("The printer is in use."));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -864,6 +867,23 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the timeout...
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
tv = (DWORD)(timeout * 1000);
|
||||
|
||||
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv));
|
||||
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv));
|
||||
#else
|
||||
tv.tv_sec = timeout;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
|
||||
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
|
||||
#endif /* WIN32 */
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Connected to printer."));
|
||||
|
||||
@@ -926,14 +946,17 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
* literal output...
|
||||
*/
|
||||
|
||||
if (lpd_command(fd, timeout, "\002%s\n",
|
||||
if (lpd_command(fd, "\002%s\n",
|
||||
printer)) /* Receive print job(s) */
|
||||
{
|
||||
close(fd);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
httpGetHostname(NULL, localhost, sizeof(localhost));
|
||||
if (orighost && _cups_strcasecmp(orighost, "localhost"))
|
||||
strlcpy(localhost, orighost, sizeof(localhost));
|
||||
else
|
||||
httpGetHostname(NULL, localhost, sizeof(localhost));
|
||||
|
||||
snprintf(control, sizeof(control),
|
||||
"H%.31s\n" /* RFC 1179, Section 7.2 - host name <= 31 chars */
|
||||
@@ -978,7 +1001,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
* Send the control file...
|
||||
*/
|
||||
|
||||
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
|
||||
if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", strlen(control),
|
||||
(int)getpid() % 1000, localhost))
|
||||
{
|
||||
close(fd);
|
||||
@@ -997,17 +1020,12 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm(timeout);
|
||||
|
||||
if (read(fd, &status, 1) < 1)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("Printer did not respond after %d seconds."),
|
||||
timeout);
|
||||
_("The printer did not respond."));
|
||||
status = errno;
|
||||
}
|
||||
|
||||
alarm(0);
|
||||
}
|
||||
|
||||
if (status != 0)
|
||||
@@ -1033,7 +1051,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
* Send the print file...
|
||||
*/
|
||||
|
||||
if (lpd_command(fd, timeout, "\003" CUPS_LLFMT " dfA%03.3d%.15s\n",
|
||||
if (lpd_command(fd, "\003" CUPS_LLFMT " dfA%03.3d%.15s\n",
|
||||
CUPS_LLCAST filestats.st_size, (int)getpid() % 1000,
|
||||
localhost))
|
||||
{
|
||||
@@ -1084,17 +1102,12 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
* want to requeue it over and over...
|
||||
*/
|
||||
|
||||
alarm(timeout);
|
||||
|
||||
if (recv(fd, &status, 1, 0) < 1)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("Printer did not respond after %d seconds."),
|
||||
timeout);
|
||||
_("The printer did not respond."));
|
||||
status = 0;
|
||||
}
|
||||
|
||||
alarm(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1121,7 +1134,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
* Send control file...
|
||||
*/
|
||||
|
||||
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
|
||||
if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", strlen(control),
|
||||
(int)getpid() % 1000, localhost))
|
||||
{
|
||||
close(fd);
|
||||
@@ -1139,17 +1152,12 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm(timeout);
|
||||
|
||||
if (read(fd, &status, 1) < 1)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("Printer did not respond after %d seconds."),
|
||||
timeout);
|
||||
_("The printer did not respond."));
|
||||
status = errno;
|
||||
}
|
||||
|
||||
alarm(0);
|
||||
}
|
||||
|
||||
if (status != 0)
|
||||
@@ -1192,21 +1200,6 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'lpd_timeout()' - Handle timeout alarms...
|
||||
*/
|
||||
|
||||
static void
|
||||
lpd_timeout(int sig) /* I - Signal number */
|
||||
{
|
||||
(void)sig;
|
||||
|
||||
#if !defined(HAVE_SIGSET) && !defined(HAVE_SIGACTION)
|
||||
signal(SIGALRM, lpd_timeout);
|
||||
#endif /* !HAVE_SIGSET && !HAVE_SIGACTION */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'lpd_write()' - Write a buffer of data to an LPD server.
|
||||
*/
|
||||
|
||||
+29
-3
@@ -92,7 +92,7 @@ backendNetworkSideCB(
|
||||
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
|
||||
else if (backendDrainOutput(print_fd, device_fd))
|
||||
status = CUPS_SC_STATUS_IO_ERROR;
|
||||
else
|
||||
else
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
|
||||
datalen = 0;
|
||||
@@ -119,8 +119,35 @@ backendNetworkSideCB(
|
||||
|
||||
if (snmp_fd >= 0)
|
||||
{
|
||||
char *dataptr; /* Pointer into data */
|
||||
cups_snmp_t packet; /* Packet from printer */
|
||||
const char *snmp_value; /* CUPS_SNMP_VALUE env var */
|
||||
|
||||
if ((snmp_value = getenv("CUPS_SNMP_VALUE")) != NULL)
|
||||
{
|
||||
const char *snmp_count; /* CUPS_SNMP_COUNT env var */
|
||||
int count; /* Repetition count */
|
||||
|
||||
if ((snmp_count = getenv("CUPS_SNMP_COUNT")) != NULL)
|
||||
{
|
||||
if ((count = atoi(snmp_count)) <= 0)
|
||||
count = 1;
|
||||
}
|
||||
else
|
||||
count = 1;
|
||||
|
||||
for (dataptr = data + strlen(data) + 1;
|
||||
count > 0 && dataptr < (data + sizeof(data) - 1);
|
||||
count --, dataptr += strlen(dataptr))
|
||||
strlcpy(dataptr, snmp_value, sizeof(data) - (dataptr - data));
|
||||
|
||||
fprintf(stderr, "DEBUG: Returning %s %s\n", data,
|
||||
data + strlen(data) + 1);
|
||||
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
datalen = dataptr - data;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!_cupsSNMPStringToOID(data, packet.object_name, CUPS_SNMP_MAX_OID))
|
||||
{
|
||||
@@ -141,7 +168,6 @@ backendNetworkSideCB(
|
||||
{
|
||||
if (_cupsSNMPRead(snmp_fd, &packet, 1.0))
|
||||
{
|
||||
char *dataptr; /* Pointer into data */
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
@@ -172,7 +198,7 @@ backendNetworkSideCB(
|
||||
case CUPS_ASN1_OCTET_STRING :
|
||||
if (packet.object_value.string.num_bytes < 0)
|
||||
i = 0;
|
||||
else if (packet.object_value.string.num_bytes <
|
||||
else if (packet.object_value.string.num_bytes <
|
||||
(sizeof(data) - (dataptr - data)))
|
||||
i = packet.object_value.string.num_bytes;
|
||||
else
|
||||
|
||||
+32
-12
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Common run loop APIs for CUPS backends.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -92,7 +92,8 @@ backendDrainOutput(int print_fd, /* I - Print file descriptor */
|
||||
|
||||
if (errno != EAGAIN || errno != EINTR)
|
||||
{
|
||||
_cupsLangPrintError("ERROR", _("Unable to read print data"));
|
||||
fprintf(stderr, "DEBUG: Read failed: %s\n", strerror(errno));
|
||||
_cupsLangPrintFilter(stderr, "ERROR", _("Unable to read print data."));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -250,7 +251,7 @@ backendRunLoop(
|
||||
{
|
||||
fputs("STATE: +offline-report\n", stderr);
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("Printer is not currently connected."));
|
||||
_("The printer is not connected."));
|
||||
offline = 1;
|
||||
}
|
||||
else if (errno == EINTR && total_bytes == 0)
|
||||
@@ -319,7 +320,9 @@ backendRunLoop(
|
||||
|
||||
if (errno != EAGAIN || errno != EINTR)
|
||||
{
|
||||
_cupsLangPrintError("ERROR", _("Unable to read print data"));
|
||||
fprintf(stderr, "DEBUG: Read failed: %s\n", strerror(errno));
|
||||
_cupsLangPrintFilter(stderr, "ERROR",
|
||||
_("Unable to read print data."));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -368,7 +371,7 @@ backendRunLoop(
|
||||
{
|
||||
fputs("STATE: +offline-report\n", stderr);
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("Printer is not currently connected."));
|
||||
_("The printer is not connected."));
|
||||
offline = 1;
|
||||
}
|
||||
}
|
||||
@@ -389,7 +392,8 @@ backendRunLoop(
|
||||
if (offline && update_state)
|
||||
{
|
||||
fputs("STATE: -offline-report\n", stderr);
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Printer is now connected."));
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("The printer is now connected."));
|
||||
offline = 0;
|
||||
}
|
||||
|
||||
@@ -434,9 +438,11 @@ backendWaitLoop(
|
||||
int use_bc, /* I - Use back-channel? */
|
||||
_cups_sccb_t side_cb) /* I - Side-channel callback */
|
||||
{
|
||||
fd_set input; /* Input set for reading */
|
||||
time_t curtime, /* Current time */
|
||||
snmp_update = 0; /* Last SNMP status update */
|
||||
int nfds; /* Number of file descriptors */
|
||||
fd_set input; /* Input set for reading */
|
||||
time_t curtime = 0, /* Current time */
|
||||
snmp_update = 0;/* Last SNMP status update */
|
||||
struct timeval timeout; /* Timeout for select() */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: backendWaitLoop(snmp_fd=%d, addr=%p, side_cb=%p)\n",
|
||||
@@ -446,6 +452,9 @@ backendWaitLoop(
|
||||
* Now loop until we receive data from stdin...
|
||||
*/
|
||||
|
||||
if (snmp_fd >= 0)
|
||||
snmp_update = time(NULL) + 5;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/*
|
||||
@@ -457,7 +466,18 @@ backendWaitLoop(
|
||||
if (side_cb)
|
||||
FD_SET(CUPS_SC_FD, &input);
|
||||
|
||||
if (select(CUPS_SC_FD + 1, &input, NULL, NULL, NULL) < 0)
|
||||
if (snmp_fd >= 0)
|
||||
{
|
||||
curtime = time(NULL);
|
||||
timeout.tv_sec = curtime >= snmp_update ? 0 : snmp_update - curtime;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
nfds = select(CUPS_SC_FD + 1, &input, NULL, NULL, &timeout);
|
||||
}
|
||||
else
|
||||
nfds = select(CUPS_SC_FD + 1, &input, NULL, NULL, NULL);
|
||||
|
||||
if (nfds < 0)
|
||||
{
|
||||
/*
|
||||
* Pause printing to clear any pending errors...
|
||||
@@ -501,10 +521,10 @@ backendWaitLoop(
|
||||
* Do SNMP updates periodically...
|
||||
*/
|
||||
|
||||
if (snmp_fd >= 0 && time(&curtime) >= snmp_update)
|
||||
if (snmp_fd >= 0 && curtime >= snmp_update)
|
||||
{
|
||||
if (backendSNMPSupplies(snmp_fd, addr, NULL, NULL))
|
||||
snmp_update = INT_MAX;
|
||||
snmp_fd = -1;
|
||||
else
|
||||
snmp_update = curtime + 5;
|
||||
}
|
||||
|
||||
+122
-31
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* SNMP supplies functions for CUPS.
|
||||
*
|
||||
* Copyright 2008-2011 by Apple Inc.
|
||||
* Copyright 2008-2012 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -36,14 +36,21 @@
|
||||
#define CUPS_MAX_SUPPLIES 32 /* Maximum number of supplies for a printer */
|
||||
#define CUPS_SUPPLY_TIMEOUT 2.0 /* Timeout for SNMP lookups */
|
||||
|
||||
#define CUPS_DEVELOPER_LOW 1
|
||||
#define CUPS_DEVELOPER_EMPTY 2
|
||||
#define CUPS_MARKER_SUPPLY_LOW 4
|
||||
#define CUPS_MARKER_SUPPLY_EMPTY 8
|
||||
#define CUPS_OPC_NEAR_EOL 16
|
||||
#define CUPS_OPC_LIFE_OVER 32
|
||||
#define CUPS_TONER_LOW 64
|
||||
#define CUPS_TONER_EMPTY 128
|
||||
#define CUPS_DEVELOPER_LOW 0x0001
|
||||
#define CUPS_DEVELOPER_EMPTY 0x0002
|
||||
#define CUPS_MARKER_SUPPLY_LOW 0x0004
|
||||
#define CUPS_MARKER_SUPPLY_EMPTY 0x0008
|
||||
#define CUPS_OPC_NEAR_EOL 0x0010
|
||||
#define CUPS_OPC_LIFE_OVER 0x0020
|
||||
#define CUPS_TONER_LOW 0x0040
|
||||
#define CUPS_TONER_EMPTY 0x0080
|
||||
#define CUPS_WASTE_ALMOST_FULL 0x0100
|
||||
#define CUPS_WASTE_FULL 0x0200
|
||||
#define CUPS_CLEANER_NEAR_EOL 0x0400 /* Proposed JPS3 */
|
||||
#define CUPS_CLEANER_LIFE_OVER 0x0800 /* Proposed JPS3 */
|
||||
|
||||
#define CUPS_SNMP_NONE 0x0000
|
||||
#define CUPS_SNMP_CAPACITY 0x0001 /* Supply levels reported as percentages */
|
||||
|
||||
|
||||
/*
|
||||
@@ -75,6 +82,8 @@ static http_addr_t current_addr; /* Current address */
|
||||
static int current_state = -1;
|
||||
/* Current device state bits */
|
||||
static int charset = -1; /* Character set for supply names */
|
||||
static unsigned quirks = CUPS_SNMP_NONE;
|
||||
/* Quirks we have to work around */
|
||||
static int num_supplies = 0;
|
||||
/* Number of supplies found */
|
||||
static backend_supplies_t supplies[CUPS_MAX_SUPPLIES];
|
||||
@@ -146,10 +155,17 @@ static const int prtMarkerSuppliesType[] =
|
||||
(sizeof(prtMarkerSuppliesType) /
|
||||
sizeof(prtMarkerSuppliesType[0]));
|
||||
/* Offset to supply index */
|
||||
static const int prtMarkerSuppliesSupplyUnit[] =
|
||||
{ CUPS_OID_prtMarkerSuppliesSupplyUnit, -1 },
|
||||
/* Units OID */
|
||||
prtMarkerSuppliesSupplyUnitOffset =
|
||||
(sizeof(prtMarkerSuppliesSupplyUnit) /
|
||||
sizeof(prtMarkerSuppliesSupplyUnit[0]));
|
||||
/* Offset to supply index */
|
||||
|
||||
static const backend_state_t const printer_states[] =
|
||||
{
|
||||
{ CUPS_TC_lowPaper, "media-low-report" },
|
||||
/* { CUPS_TC_lowPaper, "media-low-report" }, */
|
||||
{ CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty, "media-empty-warning" },
|
||||
/* { CUPS_TC_lowToner, "toner-low-report" }, */ /* now use prtMarkerSupplies */
|
||||
/* { CUPS_TC_noToner, "toner-empty-warning" }, */ /* now use prtMarkerSupplies */
|
||||
@@ -173,7 +189,11 @@ static const backend_state_t const supply_states[] =
|
||||
{ CUPS_OPC_NEAR_EOL, "opc-near-eol-report" },
|
||||
{ CUPS_OPC_LIFE_OVER, "opc-life-over-warning" },
|
||||
{ CUPS_TONER_LOW, "toner-low-report" },
|
||||
{ CUPS_TONER_EMPTY, "toner-empty-warning" }
|
||||
{ CUPS_TONER_EMPTY, "toner-empty-warning" },
|
||||
{ CUPS_WASTE_ALMOST_FULL, "waste-receptacle-almost-full-report" },
|
||||
{ CUPS_WASTE_FULL, "waste-receptacle-full-warning" },
|
||||
{ CUPS_CLEANER_NEAR_EOL, "cleaner-life-almost-over-report" },
|
||||
{ CUPS_CLEANER_LIFE_OVER, "cleaner-life-over-warning" },
|
||||
};
|
||||
|
||||
|
||||
@@ -231,6 +251,9 @@ backendSNMPSupplies(
|
||||
{
|
||||
if (supplies[i].max_capacity > 0 && supplies[i].level >= 0)
|
||||
percent = 100 * supplies[i].level / supplies[i].max_capacity;
|
||||
else if (supplies[i].level >= 0 && supplies[i].level <= 100 &&
|
||||
(quirks & CUPS_SNMP_CAPACITY))
|
||||
percent = supplies[i].level;
|
||||
else
|
||||
percent = 50;
|
||||
|
||||
@@ -245,9 +268,6 @@ backendSNMPSupplies(
|
||||
else
|
||||
new_supply_state |= CUPS_TONER_LOW;
|
||||
break;
|
||||
case CUPS_TC_wasteToner :
|
||||
case CUPS_TC_wasteInk :
|
||||
break;
|
||||
case CUPS_TC_ink :
|
||||
case CUPS_TC_inkCartridge :
|
||||
case CUPS_TC_inkRibbon :
|
||||
@@ -273,13 +293,31 @@ backendSNMPSupplies(
|
||||
else
|
||||
new_supply_state |= CUPS_OPC_NEAR_EOL;
|
||||
break;
|
||||
case CUPS_TC_wasteInk :
|
||||
case CUPS_TC_wastePaper :
|
||||
case CUPS_TC_wasteToner :
|
||||
case CUPS_TC_wasteWater :
|
||||
case CUPS_TC_wasteWax :
|
||||
if (percent <= 1)
|
||||
new_supply_state |= CUPS_WASTE_FULL;
|
||||
else
|
||||
new_supply_state |= CUPS_WASTE_ALMOST_FULL;
|
||||
break;
|
||||
case CUPS_TC_cleanerUnit :
|
||||
case CUPS_TC_fuserCleaningPad :
|
||||
if (percent <= 1)
|
||||
new_supply_state |= CUPS_CLEANER_LIFE_OVER;
|
||||
else
|
||||
new_supply_state |= CUPS_CLEANER_NEAR_EOL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i)
|
||||
*ptr++ = ',';
|
||||
|
||||
if (supplies[i].max_capacity > 0 && supplies[i].level >= 0)
|
||||
if ((supplies[i].max_capacity > 0 || (quirks & CUPS_SNMP_CAPACITY)) &&
|
||||
supplies[i].level >= 0)
|
||||
sprintf(ptr, "%d", percent);
|
||||
else
|
||||
strcpy(ptr, "-1");
|
||||
@@ -408,7 +446,7 @@ backend_init_supplies(
|
||||
cachefilename[1024], /* Cache filename */
|
||||
description[CUPS_SNMP_MAX_STRING],
|
||||
/* Device description string */
|
||||
value[CUPS_MAX_SUPPLIES * (CUPS_SNMP_MAX_STRING * 2 + 3)],
|
||||
value[CUPS_MAX_SUPPLIES * (CUPS_SNMP_MAX_STRING * 4 + 3)],
|
||||
/* Value string */
|
||||
*ptr, /* Pointer into value string */
|
||||
*name_ptr; /* Pointer into name string */
|
||||
@@ -477,6 +515,12 @@ backend_init_supplies(
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ppdattr = ppdFindAttr(ppd, "cupsSNMPQuirks", NULL)) != NULL)
|
||||
{
|
||||
if (!_cups_strcasecmp(ppdattr->value, "capacity"))
|
||||
quirks |= CUPS_SNMP_CAPACITY;
|
||||
}
|
||||
|
||||
ppdClose(ppd);
|
||||
|
||||
/*
|
||||
@@ -659,7 +703,8 @@ backend_init_supplies(
|
||||
fprintf(stderr, "ATTR: marker-colors=%s\n", value);
|
||||
|
||||
/*
|
||||
* Output the marker-names attribute...
|
||||
* Output the marker-names attribute (the double quoting is necessary to deal
|
||||
* with embedded quotes and commas in the marker names...)
|
||||
*/
|
||||
|
||||
for (i = 0, ptr = value; i < num_supplies; i ++)
|
||||
@@ -667,15 +712,21 @@ backend_init_supplies(
|
||||
if (i)
|
||||
*ptr++ = ',';
|
||||
|
||||
*ptr++ = '\'';
|
||||
*ptr++ = '\"';
|
||||
for (name_ptr = supplies[i].name; *name_ptr;)
|
||||
{
|
||||
if (*name_ptr == '\\' || *name_ptr == '\"')
|
||||
if (*name_ptr == '\\' || *name_ptr == '\"' || *name_ptr == '\'')
|
||||
{
|
||||
*ptr++ = '\\';
|
||||
*ptr++ = '\\';
|
||||
*ptr++ = '\\';
|
||||
}
|
||||
|
||||
*ptr++ = *name_ptr++;
|
||||
}
|
||||
*ptr++ = '\"';
|
||||
*ptr++ = '\'';
|
||||
}
|
||||
|
||||
*ptr = '\0';
|
||||
@@ -712,16 +763,33 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
|
||||
void *data) /* I - User data (unused) */
|
||||
{
|
||||
int i, j, k; /* Looping vars */
|
||||
static const char * const colors[8][2] =
|
||||
static const char * const colors[][2] =
|
||||
{ /* Standard color names */
|
||||
{ "black", "#000000" },
|
||||
{ "blue", "#0000FF" },
|
||||
{ "cyan", "#00FFFF" },
|
||||
{ "green", "#00FF00" },
|
||||
{ "magenta", "#FF00FF" },
|
||||
{ "red", "#FF0000" },
|
||||
{ "white", "#FFFFFF" },
|
||||
{ "yellow", "#FFFF00" }
|
||||
{ "black", "#000000" },
|
||||
{ "blue", "#0000FF" },
|
||||
{ "brown", "#A52A2A" },
|
||||
{ "cyan", "#00FFFF" },
|
||||
{ "dark-gray", "#404040" },
|
||||
{ "dark gray", "#404040" },
|
||||
{ "dark-yellow", "#FFCC00" },
|
||||
{ "dark yellow", "#FFCC00" },
|
||||
{ "gold", "#FFD700" },
|
||||
{ "gray", "#808080" },
|
||||
{ "green", "#00FF00" },
|
||||
{ "light-black", "#606060" },
|
||||
{ "light black", "#606060" },
|
||||
{ "light-cyan", "#E0FFFF" },
|
||||
{ "light cyan", "#E0FFFF" },
|
||||
{ "light-gray", "#D3D3D3" },
|
||||
{ "light gray", "#D3D3D3" },
|
||||
{ "light-magenta", "#FF77FF" },
|
||||
{ "light magenta", "#FF77FF" },
|
||||
{ "magenta", "#FF00FF" },
|
||||
{ "orange", "#FFA500" },
|
||||
{ "red", "#FF0000" },
|
||||
{ "silver", "#C0C0C0" },
|
||||
{ "white", "#FFFFFF" },
|
||||
{ "yellow", "#FFFF00" }
|
||||
};
|
||||
|
||||
|
||||
@@ -743,7 +811,8 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
|
||||
if (supplies[j].colorant == i)
|
||||
{
|
||||
for (k = 0; k < (int)(sizeof(colors) / sizeof(colors[0])); k ++)
|
||||
if (!strcmp(colors[k][0], (char *)packet->object_value.string.bytes))
|
||||
if (!_cups_strcasecmp(colors[k][0],
|
||||
(char *)packet->object_value.string.bytes))
|
||||
{
|
||||
strcpy(supplies[j].color, colors[k][1]);
|
||||
break;
|
||||
@@ -834,7 +903,6 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
|
||||
{
|
||||
char *src, *dst; /* Pointers into strings */
|
||||
|
||||
|
||||
/*
|
||||
* Loop safe because both the object_value and supplies char arrays
|
||||
* are CUPS_SNMP_MAX_STRING elements long.
|
||||
@@ -879,7 +947,8 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
|
||||
|
||||
supplies[i - 1].level = packet->object_value.integer;
|
||||
}
|
||||
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesMaxCapacity))
|
||||
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesMaxCapacity) &&
|
||||
!(quirks & CUPS_SNMP_CAPACITY))
|
||||
{
|
||||
/*
|
||||
* Get max capacity...
|
||||
@@ -896,7 +965,9 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
|
||||
if (i > num_supplies)
|
||||
num_supplies = i;
|
||||
|
||||
supplies[i - 1].max_capacity = packet->object_value.integer;
|
||||
if (supplies[i - 1].max_capacity == 0 &&
|
||||
packet->object_value.integer > 0)
|
||||
supplies[i - 1].max_capacity = packet->object_value.integer;
|
||||
}
|
||||
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesType))
|
||||
{
|
||||
@@ -917,6 +988,26 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
|
||||
|
||||
supplies[i - 1].type = packet->object_value.integer;
|
||||
}
|
||||
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesSupplyUnit))
|
||||
{
|
||||
/*
|
||||
* Get units for capacity...
|
||||
*/
|
||||
|
||||
i = packet->object_name[prtMarkerSuppliesSupplyUnitOffset];
|
||||
if (i < 1 || i > CUPS_MAX_SUPPLIES ||
|
||||
packet->object_type != CUPS_ASN1_INTEGER)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "DEBUG2: prtMarkerSuppliesSupplyUnit.1.%d = %d\n", i,
|
||||
packet->object_value.integer);
|
||||
|
||||
if (i > num_supplies)
|
||||
num_supplies = i;
|
||||
|
||||
if (packet->object_value.integer == CUPS_TC_percent)
|
||||
supplies[i - 1].max_capacity = 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
-2
@@ -251,7 +251,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
#ifdef AF_INET6
|
||||
if ((ipv6 = _cupsSNMPOpen(AF_INET6)) < 0)
|
||||
return (1);
|
||||
perror("DEBUG: Unable to create IPv6 socket");
|
||||
#else
|
||||
ipv6 = -1;
|
||||
#endif /* AF_INET6 */
|
||||
@@ -1025,6 +1025,11 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
|
||||
* Description is the IEEE-1284 device ID...
|
||||
*/
|
||||
|
||||
char *ptr; /* Pointer into device ID */
|
||||
|
||||
for (ptr = (char *)packet.object_value.string.bytes; *ptr; ptr ++)
|
||||
if (*ptr == '\n')
|
||||
*ptr = ';'; /* A lot of bad printers put a newline */
|
||||
if (!device->id)
|
||||
device->id = strdup((char *)packet.object_value.string.bytes);
|
||||
|
||||
@@ -1066,8 +1071,11 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
|
||||
*/
|
||||
|
||||
char make_model[256]; /* Make and model */
|
||||
char *ptr; /* Pointer into device ID */
|
||||
|
||||
|
||||
for (ptr = (char *)packet.object_value.string.bytes; *ptr; ptr ++)
|
||||
if (*ptr == '\n')
|
||||
*ptr = ';'; /* A lot of bad printers put a newline */
|
||||
if (device->id)
|
||||
free(device->id);
|
||||
|
||||
|
||||
+19
-7
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* AppSocket backend for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -87,6 +87,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
http_addrlist_t *addrlist, /* Address list */
|
||||
*addr; /* Connected address */
|
||||
char addrname[256]; /* Address name */
|
||||
int snmp_enabled = 1; /* Is SNMP enabled? */
|
||||
int snmp_fd, /* SNMP socket */
|
||||
start_count, /* Page count via SNMP at start */
|
||||
page_count, /* Page count via SNMP */
|
||||
@@ -246,6 +247,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
waiteof = !value[0] || !_cups_strcasecmp(value, "on") ||
|
||||
!_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true");
|
||||
}
|
||||
else if (!_cups_strcasecmp(name, "snmp"))
|
||||
{
|
||||
/*
|
||||
* Enable/disable SNMP stuff...
|
||||
*/
|
||||
|
||||
snmp_enabled = !value[0] || !_cups_strcasecmp(value, "on") ||
|
||||
_cups_strcasecmp(value, "yes") ||
|
||||
_cups_strcasecmp(value, "true");
|
||||
}
|
||||
else if (!_cups_strcasecmp(name, "contimeout"))
|
||||
{
|
||||
/*
|
||||
@@ -286,11 +297,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* See if the printer supports SNMP...
|
||||
*/
|
||||
|
||||
if ((snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family)) >= 0)
|
||||
{
|
||||
if (snmp_enabled)
|
||||
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
|
||||
else
|
||||
snmp_fd = -1;
|
||||
|
||||
if (snmp_fd >= 0)
|
||||
have_supplies = !backendSNMPSupplies(snmp_fd, &(addrlist->addr),
|
||||
&start_count, NULL);
|
||||
}
|
||||
else
|
||||
have_supplies = start_count = 0;
|
||||
|
||||
@@ -371,7 +385,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
case ECONNREFUSED :
|
||||
default :
|
||||
_cupsLangPrintFilter(stderr, "WARNING",
|
||||
_("The printer is busy."));
|
||||
_("The printer is in use."));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -472,8 +486,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
if (print_fd != 0)
|
||||
close(print_fd);
|
||||
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Ready to print."));
|
||||
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
|
||||
+14
-8
@@ -98,12 +98,18 @@ main(int argc, /* I - Number of command-line args */
|
||||
(ptr = strrchr(libpath, '/')) != NULL && !strcmp(ptr, "/backend"))
|
||||
{
|
||||
strlcpy(ptr, "/cups", sizeof(libpath) - (ptr - libpath));
|
||||
if (access(libpath, 0))
|
||||
if (!access(libpath, 0))
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
fprintf(stderr, "Setting DYLD_LIBRARY_PATH to \"%s\".\n", libpath);
|
||||
setenv("DYLD_LIBRARY_PATH", libpath, 1);
|
||||
#else
|
||||
fprintf(stderr, "Setting LD_LIBRARY_PATH to \"%s\".\n", libpath);
|
||||
setenv("LD_LIBRARY_PATH", libpath, 1);
|
||||
#endif /* __APPLE__ */
|
||||
}
|
||||
else
|
||||
perror(libpath);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -567,13 +573,13 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
length = sizeof(buffer);
|
||||
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
|
||||
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %s\n", oid,
|
||||
statuses[scstatus], buffer);
|
||||
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %d bytes (%s)\n", oid,
|
||||
statuses[scstatus], (int)length, buffer);
|
||||
|
||||
length = sizeof(buffer);
|
||||
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
|
||||
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %s\n", oid,
|
||||
statuses[scstatus], buffer);
|
||||
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %d bytes (%s)\n", oid,
|
||||
statuses[scstatus], (int)length, buffer);
|
||||
}
|
||||
|
||||
length = 0;
|
||||
@@ -632,13 +638,13 @@ sigterm_handler(int sig) /* I - Signal */
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
puts("Usage: testbackend [-cancel] [-d] [-ps | -pcl] [-s [-oid OID] "
|
||||
puts("Usage: testbackend [-cancel] [-d] [-ps | -pcl] [-s [-get OID] "
|
||||
"[-walk OID]] [-t] device-uri job-id user title copies options [file]");
|
||||
puts("");
|
||||
puts("Options:");
|
||||
puts(" -cancel Simulate a canceled print job after 2 seconds.");
|
||||
puts(" -d Show log messages from backend.");
|
||||
puts(" -oid OID Lookup the specified SNMP OID.");
|
||||
puts(" -get OID Lookup the specified SNMP OID.");
|
||||
puts(" (.1.3.6.1.2.1.43.10.2.1.4.1.1 is a good one for printers)");
|
||||
puts(" -pcl Send PCL+PJL query and test page to backend.");
|
||||
puts(" -ps Send PostScript query and test page to backend.");
|
||||
@@ -661,7 +667,7 @@ walk_cb(const char *oid, /* I - OID */
|
||||
int datalen, /* I - Length of data */
|
||||
void *context) /* I - Context (unused) */
|
||||
{
|
||||
printf("CUPS_SC_CMD_SNMP_WALK %s=%s (%d bytes)\n", oid, data, datalen);
|
||||
printf("CUPS_SC_CMD_SNMP_WALK %s, %d bytes (%s)\n", oid, datalen, data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Copyright 2005-2011 Apple Inc. All rights reserved.
|
||||
* Copyright 2005-2012 Apple Inc. All rights reserved.
|
||||
*
|
||||
* IMPORTANT: This Apple software is supplied to you by Apple Computer,
|
||||
* Inc. ("Apple") in consideration of your agreement to the following
|
||||
@@ -820,10 +820,10 @@ print_device(const char *uri, /* I - Device URI */
|
||||
/*
|
||||
* If it didn't exit abort the pending read and wait an additional second...
|
||||
*/
|
||||
|
||||
|
||||
if (!g.read_thread_done)
|
||||
{
|
||||
fputs("DEBUG: Read thread still active, aborting the pending read...\n",
|
||||
fputs("DEBUG: Read thread still active, aborting the pending read...\n",
|
||||
stderr);
|
||||
|
||||
g.wait_eof = 0;
|
||||
@@ -833,7 +833,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
gettimeofday(&tv, NULL);
|
||||
cond_timeout.tv_sec = tv.tv_sec + 1;
|
||||
cond_timeout.tv_nsec = tv.tv_usec * 1000;
|
||||
|
||||
|
||||
while (!g.read_thread_done)
|
||||
{
|
||||
if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex,
|
||||
@@ -1283,7 +1283,7 @@ static Boolean find_device_cb(void *refcon,
|
||||
if (!keepLooking && g.status_timer != NULL)
|
||||
{
|
||||
fputs("STATE: -offline-report\n", stderr);
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Printer is now online."));
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is now online."));
|
||||
CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), g.status_timer, kCFRunLoopDefaultMode);
|
||||
CFRelease(g.status_timer);
|
||||
g.status_timer = NULL;
|
||||
@@ -1304,7 +1304,7 @@ static void status_timer_cb(CFRunLoopTimerRef timer,
|
||||
(void)info;
|
||||
|
||||
fputs("STATE: +offline-report\n", stderr);
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Printer is offline."));
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is offline."));
|
||||
|
||||
if (getenv("CLASS") != NULL)
|
||||
{
|
||||
|
||||
+1248
-228
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+4
-10
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* This file is included from "usb.c" when compiled on UNIX/Linux.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -128,16 +128,12 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
if (errno == EBUSY)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("Printer busy, will retry in 10 seconds."));
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
|
||||
sleep(10);
|
||||
}
|
||||
else if (errno == ENXIO || errno == EIO || errno == ENOENT ||
|
||||
errno == ENODEV)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("Printer not connected, will retry in 30 "
|
||||
"seconds."));
|
||||
sleep(30);
|
||||
}
|
||||
else
|
||||
@@ -425,8 +421,7 @@ open_device(const char *uri, /* I - Device URI */
|
||||
*/
|
||||
|
||||
if (busy)
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("Printer is busy, will retry in 5 seconds."));
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
|
||||
|
||||
sleep(5);
|
||||
}
|
||||
@@ -509,8 +504,7 @@ open_device(const char *uri, /* I - Device URI */
|
||||
|
||||
if (busy)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "INFO",
|
||||
_("Printer is busy, will retry in 5 seconds."));
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* USB port backend for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -55,7 +55,7 @@ int print_device(const char *uri, const char *hostname,
|
||||
* Include the vendor-specific USB implementation...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_USB_H
|
||||
#ifdef HAVE_LIBUSB
|
||||
# include "usb-libusb.c"
|
||||
#elif defined(__APPLE__)
|
||||
# include "usb-darwin.c"
|
||||
@@ -118,7 +118,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+25
-28
@@ -1,28 +1,25 @@
|
||||
lpc.o: lpc.c ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
|
||||
../cups/language.h ../cups/string-private.h ../config.h \
|
||||
../cups/debug-private.h ../cups/ppd-private.h ../cups/ppd.h \
|
||||
../cups/pwg-private.h ../cups/http-private.h ../cups/md5-private.h \
|
||||
../cups/ipp-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/thread-private.h
|
||||
lpq.o: lpq.c ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
|
||||
../cups/language.h ../cups/string-private.h ../config.h \
|
||||
../cups/debug-private.h ../cups/ppd-private.h ../cups/ppd.h \
|
||||
../cups/pwg-private.h ../cups/http-private.h ../cups/md5-private.h \
|
||||
../cups/ipp-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/thread-private.h
|
||||
lpr.o: lpr.c ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
|
||||
../cups/language.h ../cups/string-private.h ../config.h \
|
||||
../cups/debug-private.h ../cups/ppd-private.h ../cups/ppd.h \
|
||||
../cups/pwg-private.h ../cups/http-private.h ../cups/md5-private.h \
|
||||
../cups/ipp-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/thread-private.h
|
||||
lprm.o: lprm.c ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
|
||||
../cups/language.h ../cups/string-private.h ../config.h \
|
||||
../cups/debug-private.h ../cups/ppd-private.h ../cups/ppd.h \
|
||||
../cups/pwg-private.h ../cups/http-private.h ../cups/md5-private.h \
|
||||
../cups/ipp-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/thread-private.h
|
||||
lpc.o: lpc.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
|
||||
../cups/debug-private.h ../cups/versioning.h ../cups/ipp-private.h \
|
||||
../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
|
||||
lpq.o: lpq.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
|
||||
../cups/debug-private.h ../cups/versioning.h ../cups/ipp-private.h \
|
||||
../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
|
||||
lpr.o: lpr.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
|
||||
../cups/debug-private.h ../cups/versioning.h ../cups/ipp-private.h \
|
||||
../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/http-private.h \
|
||||
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
|
||||
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
|
||||
lprm.o: lprm.c ../cups/cups-private.h ../cups/string-private.h \
|
||||
../config.h ../cups/debug-private.h ../cups/versioning.h \
|
||||
../cups/ipp-private.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
|
||||
../cups/http-private.h ../cups/md5-private.h \
|
||||
../cups/language-private.h ../cups/transcode.h ../cups/language.h \
|
||||
../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
|
||||
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
|
||||
|
||||
+3
-2
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* "lpc" command for CUPS.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -364,7 +364,8 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
for (ptr = printer;
|
||||
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
|
||||
ptr ++, dptr ++);
|
||||
ptr ++, dptr ++)
|
||||
/* do nothing */;
|
||||
|
||||
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' ||
|
||||
isspace(*dptr & 255)))
|
||||
|
||||
+7
-3
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* "lpq" command for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -371,6 +371,7 @@ show_jobs(const char *command, /* I - Command name */
|
||||
* attributes-natural-language
|
||||
* job-uri or printer-uri
|
||||
* requested-attributes
|
||||
* requesting-user-name
|
||||
*/
|
||||
|
||||
request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
|
||||
@@ -399,6 +400,9 @@ show_jobs(const char *command, /* I - Command name */
|
||||
"requesting-user-name", NULL, user);
|
||||
ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
|
||||
}
|
||||
else
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, cupsUser());
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes",
|
||||
@@ -447,8 +451,8 @@ show_jobs(const char *command, /* I - Command name */
|
||||
jobpriority = 50;
|
||||
#endif /* __osf__ */
|
||||
jobstate = IPP_JOB_PENDING;
|
||||
jobname = "untitled";
|
||||
jobuser = NULL;
|
||||
jobname = "unknown";
|
||||
jobuser = "unknown";
|
||||
jobdest = NULL;
|
||||
jobcopies = 1;
|
||||
|
||||
|
||||
+9
-4
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* "lpr" command for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -89,7 +89,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
cupsSetUser(argv[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'H' : /* Connect to host */
|
||||
if (argv[i][2] != '\0')
|
||||
cupsSetServer(argv[i] + 2);
|
||||
@@ -377,7 +377,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
const char *format; /* Document format */
|
||||
ssize_t bytes; /* Bytes read */
|
||||
|
||||
|
||||
if (cupsGetOption("raw", num_options, options))
|
||||
format = CUPS_FORMAT_RAW;
|
||||
else if ((format = cupsGetOption("document-format", num_options,
|
||||
@@ -395,11 +394,17 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Error - unable to queue from stdin - %s."),
|
||||
argv[0], httpStatus(status));
|
||||
cupsFinishDocument(CUPS_HTTP_DEFAULT, printer);
|
||||
cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
|
||||
job_id = 0;
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
|
||||
cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (job_id < 1)
|
||||
|
||||
+67
-45
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Administration CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -523,7 +523,7 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(_("Add RSS Subscription"));
|
||||
cgiShowIPPError(_("Unable to add RSS subscription:"));
|
||||
cgiShowIPPError(_("Unable to add RSS subscription"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -810,8 +810,8 @@ do_am_class(http_t *http, /* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(modify ? _("Unable to modify class:") :
|
||||
_("Unable to add class:"));
|
||||
cgiShowIPPError(modify ? _("Unable to modify class") :
|
||||
_("Unable to add class"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1055,8 +1055,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
else
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(modify ? _("Unable to modify printer:") :
|
||||
_("Unable to add printer:"));
|
||||
cgiShowIPPError(modify ? _("Unable to modify printer") :
|
||||
_("Unable to add printer"));
|
||||
cgiEndHTML();
|
||||
return;
|
||||
}
|
||||
@@ -1317,7 +1317,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
else
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(_("Unable to get list of printer drivers:"));
|
||||
cgiShowIPPError(_("Unable to get list of printer drivers"));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
@@ -1415,8 +1415,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(modify ? _("Unable to modify printer:") :
|
||||
_("Unable to add printer:"));
|
||||
cgiShowIPPError(modify ? _("Unable to modify printer") :
|
||||
_("Unable to add printer"));
|
||||
}
|
||||
else if (modify)
|
||||
{
|
||||
@@ -1522,7 +1522,7 @@ do_cancel_subscription(http_t *http)/* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(_("Cancel RSS Subscription"));
|
||||
cgiShowIPPError(_("Unable to cancel RSS subscription:"));
|
||||
cgiShowIPPError(_("Unable to cancel RSS subscription"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1557,6 +1557,8 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
int advanced, /* Advanced settings shown? */
|
||||
changed; /* Have settings changed? */
|
||||
const char *debug_logging, /* DEBUG_LOGGING value */
|
||||
*preserve_jobs = NULL,
|
||||
/* PRESERVE_JOBS value */
|
||||
*remote_admin, /* REMOTE_ADMIN value */
|
||||
*remote_any, /* REMOTE_ANY value */
|
||||
*share_printers,/* SHARE_PRINTERS value */
|
||||
@@ -1611,19 +1613,36 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
*/
|
||||
|
||||
browse_web_if = cgiGetVariable("BROWSE_WEB_IF") ? "Yes" : "No";
|
||||
preserve_job_history = cgiGetVariable("PRESERVE_JOB_HISTORY") ? "Yes" : "No";
|
||||
preserve_job_files = cgiGetVariable("PRESERVE_JOB_FILES") ? "Yes" : "No";
|
||||
max_clients = cgiGetVariable("MAX_CLIENTS");
|
||||
max_jobs = cgiGetVariable("MAX_JOBS");
|
||||
max_log_size = cgiGetVariable("MAX_LOG_SIZE");
|
||||
preserve_jobs = cgiGetVariable("PRESERVE_JOBS");
|
||||
|
||||
if (preserve_jobs)
|
||||
{
|
||||
max_jobs = cgiGetVariable("MAX_JOBS");
|
||||
preserve_job_history = cgiGetVariable("PRESERVE_JOB_HISTORY");
|
||||
preserve_job_files = cgiGetVariable("PRESERVE_JOB_FILES");
|
||||
|
||||
if (!max_jobs || atoi(max_jobs) < 0)
|
||||
max_jobs = "500";
|
||||
|
||||
if (!preserve_job_history)
|
||||
preserve_job_history = "On";
|
||||
|
||||
if (!preserve_job_files)
|
||||
preserve_job_files = "1d";
|
||||
}
|
||||
else
|
||||
{
|
||||
max_jobs = "0";
|
||||
preserve_job_history = "No";
|
||||
preserve_job_files = "No";
|
||||
}
|
||||
|
||||
if (!max_clients || atoi(max_clients) <= 0)
|
||||
max_clients = "100";
|
||||
|
||||
if (!max_jobs || atoi(max_jobs) <= 0)
|
||||
max_jobs = "500";
|
||||
|
||||
if (!max_log_size || atof(max_log_size) <= 0.0)
|
||||
if (!max_log_size || atoi(max_log_size) <= 0.0)
|
||||
max_log_size = "1m";
|
||||
}
|
||||
|
||||
@@ -1635,7 +1654,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Change Settings")));
|
||||
cgiSetVariable("MESSAGE",
|
||||
cgiText(_("Unable to change server settings:")));
|
||||
cgiText(_("Unable to change server settings")));
|
||||
cgiSetVariable("ERROR", cupsLastErrorString());
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
@@ -1674,7 +1693,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
if ((current_preserve_job_files = cupsGetOption("PreserveJobFiles",
|
||||
num_settings,
|
||||
settings)) == NULL)
|
||||
current_preserve_job_files = "No";
|
||||
current_preserve_job_files = "1d";
|
||||
|
||||
if ((current_max_clients = cupsGetOption("MaxClients", num_settings,
|
||||
settings)) == NULL)
|
||||
@@ -1777,7 +1796,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
|
||||
cgiStartHTML(cgiText(_("Change Settings")));
|
||||
cgiSetVariable("MESSAGE",
|
||||
cgiText(_("Unable to change server settings:")));
|
||||
cgiText(_("Unable to change server settings")));
|
||||
cgiSetVariable("ERROR", cupsLastErrorString());
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
}
|
||||
@@ -1828,7 +1847,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
if ((tempfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Edit Configuration File")));
|
||||
cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file:")));
|
||||
cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file")));
|
||||
cgiSetVariable("ERROR", strerror(errno));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
@@ -1840,7 +1859,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
if ((temp = cupsFileOpenFd(tempfd, "w")) == NULL)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Edit Configuration File")));
|
||||
cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file:")));
|
||||
cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file")));
|
||||
cgiSetVariable("ERROR", strerror(errno));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
@@ -1890,7 +1909,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
else if (status != HTTP_CREATED)
|
||||
{
|
||||
cgiSetVariable("MESSAGE",
|
||||
cgiText(_("Unable to upload cupsd.conf file:")));
|
||||
cgiText(_("Unable to upload cupsd.conf file")));
|
||||
cgiSetVariable("ERROR", httpStatus(status));
|
||||
|
||||
cgiStartHTML(cgiText(_("Edit Configuration File")));
|
||||
@@ -1937,7 +1956,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Edit Configuration File")));
|
||||
cgiSetVariable("MESSAGE",
|
||||
cgiText(_("Unable to access cupsd.conf file:")));
|
||||
cgiText(_("Unable to access cupsd.conf file")));
|
||||
cgiSetVariable("ERROR", strerror(errno));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
@@ -1950,7 +1969,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Edit Configuration File")));
|
||||
cgiSetVariable("MESSAGE",
|
||||
cgiText(_("Unable to access cupsd.conf file:")));
|
||||
cgiText(_("Unable to access cupsd.conf file")));
|
||||
cgiSetVariable("ERROR",
|
||||
cgiText(_("Unable to edit cupsd.conf files larger than "
|
||||
"1MB")));
|
||||
@@ -1974,7 +1993,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
|
||||
cgiStartHTML(cgiText(_("Edit Configuration File")));
|
||||
cgiSetVariable("MESSAGE",
|
||||
cgiText(_("Unable to access cupsd.conf file:")));
|
||||
cgiText(_("Unable to access cupsd.conf file")));
|
||||
cgiSetVariable("ERROR", strerror(errno));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
@@ -2131,7 +2150,7 @@ do_delete_class(http_t *http) /* I - HTTP connection */
|
||||
cgiStartHTML(cgiText(_("Delete Class")));
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Unable to delete class:"));
|
||||
cgiShowIPPError(_("Unable to delete class"));
|
||||
else
|
||||
cgiCopyTemplateLang("class-deleted.tmpl");
|
||||
|
||||
@@ -2216,7 +2235,7 @@ do_delete_printer(http_t *http) /* I - HTTP connection */
|
||||
cgiStartHTML(cgiText(_("Delete Printer")));
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Unable to delete printer:"));
|
||||
cgiShowIPPError(_("Unable to delete printer"));
|
||||
else
|
||||
cgiCopyTemplateLang("printer-deleted.tmpl");
|
||||
|
||||
@@ -2620,10 +2639,6 @@ do_menu(http_t *http) /* I - HTTP connection */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
cgiSetVariable("KERBEROS", "");
|
||||
|
||||
#ifdef HAVE_DNSSD
|
||||
cgiSetVariable("HAVE_DNSSD", "1");
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
if ((val = cupsGetOption("BrowseWebIF", num_settings,
|
||||
settings)) == NULL)
|
||||
val = "No";
|
||||
@@ -2636,18 +2651,25 @@ do_menu(http_t *http) /* I - HTTP connection */
|
||||
settings)) == NULL)
|
||||
val = "Yes";
|
||||
|
||||
if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") ||
|
||||
!_cups_strcasecmp(val, "true"))
|
||||
if (val &&
|
||||
(!_cups_strcasecmp(val, "0") || !_cups_strcasecmp(val, "no") ||
|
||||
!_cups_strcasecmp(val, "off") || !_cups_strcasecmp(val, "false") ||
|
||||
!_cups_strcasecmp(val, "disabled")))
|
||||
{
|
||||
cgiSetVariable("PRESERVE_JOB_HISTORY", "CHECKED");
|
||||
cgiSetVariable("PRESERVE_JOB_HISTORY", "0");
|
||||
cgiSetVariable("PRESERVE_JOB_FILES", "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
cgiSetVariable("PRESERVE_JOBS", "CHECKED");
|
||||
cgiSetVariable("PRESERVE_JOB_HISTORY", val);
|
||||
|
||||
if ((val = cupsGetOption("PreserveJobFiles", num_settings,
|
||||
settings)) == NULL)
|
||||
val = "No";
|
||||
val = "1d";
|
||||
|
||||
cgiSetVariable("PRESERVE_JOB_FILES", val);
|
||||
|
||||
if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") ||
|
||||
!_cups_strcasecmp(val, "true"))
|
||||
cgiSetVariable("PRESERVE_JOB_FILES", "CHECKED");
|
||||
}
|
||||
|
||||
if ((val = cupsGetOption("MaxClients", num_settings, settings)) == NULL)
|
||||
@@ -2815,7 +2837,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Unable to get printer attributes:"));
|
||||
cgiShowIPPError(_("Unable to get printer attributes"));
|
||||
else
|
||||
cgiCopyTemplateLang("users.tmpl");
|
||||
|
||||
@@ -2965,7 +2987,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Set Allowed Users")));
|
||||
cgiShowIPPError(_("Unable to change printer:"));
|
||||
cgiShowIPPError(_("Unable to change printer"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3052,7 +3074,7 @@ do_set_default(http_t *http) /* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(_("Unable to set server default:"));
|
||||
cgiShowIPPError(_("Unable to set server default"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3161,7 +3183,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
if ((ppd = ppdOpenFile(filename)) == NULL)
|
||||
{
|
||||
cgiSetVariable("ERROR", ppdErrorString(ppdLastError(&i)));
|
||||
cgiSetVariable("MESSAGE", cgiText(_("Unable to open PPD file:")));
|
||||
cgiSetVariable("MESSAGE", cgiText(_("Unable to open PPD file")));
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
@@ -3782,7 +3804,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(_("Unable to set options:"));
|
||||
cgiShowIPPError(_("Unable to set options"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3881,7 +3903,7 @@ do_set_sharing(http_t *http) /* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Set Publishing")));
|
||||
cgiShowIPPError(_("Unable to change printer-is-shared attribute:"));
|
||||
cgiShowIPPError(_("Unable to change printer-is-shared attribute"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Class status CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -257,7 +257,7 @@ do_class_op(http_t *http, /* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(_("Unable to do maintenance command:"));
|
||||
cgiShowIPPError(_("Unable to do maintenance command"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -380,7 +380,7 @@ show_all_classes(http_t *http, /* I - Connection to server */
|
||||
sprintf(val, "%d", count);
|
||||
cgiSetVariable("TOTAL", val);
|
||||
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL)
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL && *var)
|
||||
ascending = !_cups_strcasecmp(var, "asc");
|
||||
else
|
||||
ascending = 1;
|
||||
@@ -447,7 +447,7 @@ show_all_classes(http_t *http, /* I - Connection to server */
|
||||
* Show the error...
|
||||
*/
|
||||
|
||||
cgiShowIPPError(_("Unable to get class list:"));
|
||||
cgiShowIPPError(_("Unable to get class list"));
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
@@ -546,7 +546,7 @@ show_class(http_t *http, /* I - Connection to server */
|
||||
*/
|
||||
|
||||
cgiStartHTML(pclass);
|
||||
cgiShowIPPError(_("Unable to get class status:"));
|
||||
cgiShowIPPError(_("Unable to get class status"));
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
|
||||
+15
-10
@@ -39,7 +39,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
const char *query; /* Search query */
|
||||
const char *cache_dir; /* CUPS_CACHEDIR environment variable */
|
||||
const char *docroot; /* CUPS_DOCROOT environment variable */
|
||||
const char *helpfile; /* Current help file */
|
||||
const char *helpfile, /* Current help file */
|
||||
*helptitle = NULL; /* Current help title */
|
||||
const char *topic; /* Current topic */
|
||||
char topic_data[1024]; /* Topic form data */
|
||||
const char *section; /* Current section */
|
||||
@@ -88,7 +89,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
perror(filename);
|
||||
|
||||
cgiStartHTML(cgiText(_("Online Help")));
|
||||
cgiSetVariable("ERROR", "Unable to load help index!");
|
||||
cgiSetVariable("ERROR", cgiText(_("Unable to load help index.")));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
@@ -129,7 +130,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
perror(filename);
|
||||
|
||||
cgiStartHTML(cgiText(_("Online Help")));
|
||||
cgiSetVariable("ERROR", "Unable to access help file!");
|
||||
cgiSetVariable("ERROR", cgiText(_("Unable to access help file.")));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
@@ -139,7 +140,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if ((n = helpFindNode(hi, helpfile, NULL)) == NULL)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Online Help")));
|
||||
cgiSetVariable("ERROR", "Help file not in index!");
|
||||
cgiSetVariable("ERROR", cgiText(_("Help file not in index.")));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
@@ -147,12 +148,11 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the page title and save the help file...
|
||||
* Save the page title and help file...
|
||||
*/
|
||||
|
||||
cgiSetVariable("HELPFILE", helpfile);
|
||||
cgiSetVariable("HELPTITLE", n->text);
|
||||
cgiSetVariable("TOPIC", n->section);
|
||||
helptitle = n->text;
|
||||
topic = n->section;
|
||||
|
||||
/*
|
||||
* Send a standard page header...
|
||||
@@ -170,6 +170,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Online Help")));
|
||||
|
||||
topic = cgiGetVariable("TOPIC");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -180,7 +182,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
cgiSetVariable("QUERY", "");
|
||||
|
||||
query = cgiGetVariable("QUERY");
|
||||
topic = cgiGetVariable("TOPIC");
|
||||
si = helpSearchIndex(hi, query, topic, helpfile);
|
||||
|
||||
cgiClearVariables();
|
||||
@@ -188,6 +189,10 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
cgiSetVariable("QUERY", query);
|
||||
if (topic)
|
||||
cgiSetVariable("TOPIC", topic);
|
||||
if (helpfile)
|
||||
cgiSetVariable("HELPFILE", helpfile);
|
||||
if (helptitle)
|
||||
cgiSetVariable("HELPTITLE", helptitle);
|
||||
|
||||
fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n",
|
||||
query ? query : "(null)", topic ? topic : "(null)");
|
||||
@@ -356,7 +361,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
else
|
||||
{
|
||||
perror(filename);
|
||||
cgiSetVariable("ERROR", "Unable to open help file.");
|
||||
cgiSetVariable("ERROR", cgiText(_("Unable to open help file.")));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* CGI <-> IPP variable routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -792,7 +792,7 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
|
||||
cgiStartHTML(cgiText(_("Print Test Page")));
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Unable to print test page:"));
|
||||
cgiShowIPPError(_("Unable to print test page"));
|
||||
else
|
||||
{
|
||||
cgiSetVariable("PRINTER_NAME", dest);
|
||||
@@ -1219,7 +1219,7 @@ cgiSetIPPObjectVars(
|
||||
"%dx%d%s", attr->values[i].resolution.xres,
|
||||
attr->values[i].resolution.yres,
|
||||
attr->values[i].resolution.units == IPP_RES_PER_INCH ?
|
||||
"dpi" : "dpc");
|
||||
"dpi" : "dpcm");
|
||||
break;
|
||||
|
||||
case IPP_TAG_URI :
|
||||
@@ -1432,7 +1432,7 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
|
||||
"ipp://localhost/");
|
||||
|
||||
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
|
||||
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL && *which_jobs)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
|
||||
NULL, which_jobs);
|
||||
|
||||
@@ -1480,10 +1480,11 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
|
||||
if (first < 0)
|
||||
first = 0;
|
||||
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL)
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL && *var)
|
||||
ascending = !_cups_strcasecmp(var, "asc");
|
||||
else
|
||||
ascending = !which_jobs || !_cups_strcasecmp(which_jobs, "not-completed");
|
||||
ascending = !which_jobs || !*which_jobs ||
|
||||
!_cups_strcasecmp(which_jobs, "not-completed");
|
||||
|
||||
section = cgiGetVariable("SECTION");
|
||||
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Job status CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -195,7 +195,7 @@ do_job_op(http_t *http, /* I - HTTP connection */
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Job operation failed:"));
|
||||
cgiShowIPPError(_("Job operation failed"));
|
||||
else if (op == IPP_CANCEL_JOB)
|
||||
cgiCopyTemplateLang("job-cancel.tmpl");
|
||||
else if (op == IPP_HOLD_JOB)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Xcode documentation set generator.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -31,7 +31,7 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi.h"
|
||||
#include "cgi-private.h"
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Printer status CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -266,7 +266,7 @@ do_printer_op(http_t *http, /* I - HTTP connection */
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(_("Unable to do maintenance command:"));
|
||||
cgiShowIPPError(_("Unable to do maintenance command"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -397,7 +397,7 @@ show_all_printers(http_t *http, /* I - Connection to server */
|
||||
sprintf(val, "%d", count);
|
||||
cgiSetVariable("TOTAL", val);
|
||||
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL)
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL && *var)
|
||||
ascending = !_cups_strcasecmp(var, "asc");
|
||||
else
|
||||
ascending = 1;
|
||||
@@ -464,7 +464,7 @@ show_all_printers(http_t *http, /* I - Connection to server */
|
||||
* Show the error...
|
||||
*/
|
||||
|
||||
cgiShowIPPError(_("Unable to get printer list:"));
|
||||
cgiShowIPPError(_("Unable to get printer list"));
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
@@ -566,7 +566,7 @@ show_printer(http_t *http, /* I - Connection to server */
|
||||
*/
|
||||
|
||||
cgiStartHTML(printer);
|
||||
cgiShowIPPError(_("Unable to get printer status:"));
|
||||
cgiShowIPPError(_("Unable to get printer status"));
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
|
||||
@@ -167,6 +167,8 @@ cgiClearVariables(void)
|
||||
_cgi_var_t *v; /* Current variable */
|
||||
|
||||
|
||||
fputs("DEBUG: cgiClearVariables called.\n", stderr);
|
||||
|
||||
for (v = form_vars, i = form_count; i > 0; v ++, i --)
|
||||
{
|
||||
_cupsStrFree(v->name);
|
||||
@@ -401,6 +403,8 @@ cgiSetArray(const char *name, /* I - Name of variable */
|
||||
if (name == NULL || value == NULL || element < 0 || element > 100000)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "DEBUG: cgiSetArray: %s[%d]=\"%s\"\n", name, element, value);
|
||||
|
||||
if ((var = cgi_find_variable(name)) == NULL)
|
||||
{
|
||||
cgi_add_variable(name, element, value);
|
||||
@@ -532,6 +536,8 @@ cgiSetVariable(const char *name, /* I - Name of variable */
|
||||
if (name == NULL || value == NULL)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "cgiSetVariable: %s=\"%s\"\n", name, value);
|
||||
|
||||
if ((var = cgi_find_variable(name)) == NULL)
|
||||
{
|
||||
cgi_add_variable(name, 0, value);
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ include ../Makedefs
|
||||
# Config files...
|
||||
#
|
||||
|
||||
KEEP = cupsd.conf snmp.conf
|
||||
KEEP = cups-files.conf cupsd.conf snmp.conf
|
||||
REPLACE = mime.convs mime.types
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Sample file/directory/user/group configuration file for the CUPS scheduler.
|
||||
# See "man cups-files.conf" for a complete description of this file.
|
||||
#
|
||||
|
||||
# List of events that are considered fatal errors for the scheduler...
|
||||
#FatalErrors @CUPS_FATAL_ERRORS@
|
||||
|
||||
# Default user and group for filters/backends/helper programs; this cannot be
|
||||
# any user or group that resolves to ID 0 for security reasons...
|
||||
#User @CUPS_USER@
|
||||
#Group @CUPS_GROUP@
|
||||
|
||||
# Administrator user group, used to match @SYSTEM in cupsd.conf policy rules...
|
||||
SystemGroup @CUPS_SYSTEM_GROUPS@
|
||||
@CUPS_SYSTEM_AUTHKEY@
|
||||
|
||||
# User that is substituted for unauthenticated (remote) root accesses...
|
||||
#RemoteRoot remroot
|
||||
|
||||
# Do we allow file: device URIs other than to /dev/null?
|
||||
#FileDevice No
|
||||
|
||||
# Permissions for configuration and log files...
|
||||
#ConfigFilePerm 0@CUPS_CONFIG_FILE_PERM@
|
||||
#LogFilePerm 0@CUPS_LOG_FILE_PERM@
|
||||
|
||||
# Location of the file logging all access to the scheduler; may be the name
|
||||
# "syslog". If not an absolute path, the value of ServerRoot is used as the
|
||||
# root directory. Also see the "AccessLogLevel" directive in cupsd.conf.
|
||||
AccessLog @CUPS_LOGDIR@/access_log
|
||||
|
||||
# Location of cache files used by the scheduler...
|
||||
#CacheDir @CUPS_CACHEDIR@
|
||||
|
||||
# Location of data files used by the scheduler...
|
||||
#DataDir @CUPS_DATADIR@
|
||||
|
||||
# Location of the static web content served by the scheduler...
|
||||
#DocumentRoot @CUPS_DOCROOT@
|
||||
|
||||
# Location of the file logging all messages produced by the scheduler and any
|
||||
# helper programs; may be the name "syslog". If not an absolute path, the value
|
||||
# of ServerRoot is used as the root directory. Also see the "LogLevel"
|
||||
# directive in cupsd.conf.
|
||||
ErrorLog @CUPS_LOGDIR@/error_log
|
||||
|
||||
# Location of fonts used by older print filters...
|
||||
#FontPath @CUPS_FONTPATH@
|
||||
|
||||
# Location of LPD configuration
|
||||
#LPDConfigFile @CUPS_DEFAULT_LPD_CONFIG_FILE@
|
||||
|
||||
# Location of the file logging all pages printed by the scheduler and any
|
||||
# helper programs; may be the name "syslog". If not an absolute path, the value
|
||||
# of ServerRoot is used as the root directory. Also see the "PageLogFormat"
|
||||
# directive in cupsd.conf.
|
||||
PageLog @CUPS_LOGDIR@/page_log
|
||||
|
||||
# Location of the file listing all of the local printers...
|
||||
#Printcap @CUPS_DEFAULT_PRINTCAP@
|
||||
|
||||
# Format of the Printcap file...
|
||||
#PrintcapFormat bsd
|
||||
#PrintcapFormat plist
|
||||
#PrintcapFormat solaris
|
||||
|
||||
# Location of all spool files...
|
||||
#RequestRoot @CUPS_REQUESTS@
|
||||
|
||||
# Location of helper programs...
|
||||
#ServerBin @CUPS_SERVERBIN@
|
||||
|
||||
# SSL/TLS certificate for the scheduler...
|
||||
#ServerCertificate @CUPS_SERVERCERT@
|
||||
|
||||
# SSL/TLS private key for the scheduler...
|
||||
#ServerKey @CUPS_SERVERKEY@
|
||||
|
||||
# Location of other configuration files...
|
||||
#ServerRoot @CUPS_SERVERROOT@
|
||||
|
||||
# Location of Samba configuration file...
|
||||
#SMBConfigFile @CUPS_DEFAULT_SMB_CONFIG_FILE@
|
||||
|
||||
# Location of scheduler state files...
|
||||
#StateDir @CUPS_STATEDIR@
|
||||
|
||||
# Location of scheduler/helper temporary files. This directory is emptied on
|
||||
# scheduler startup and cannot be one of the standard (public) temporary
|
||||
# directory locations for security reasons...
|
||||
#TempDir @CUPS_REQUESTS@/tmp
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -9,18 +9,12 @@
|
||||
# for troubleshooting...
|
||||
LogLevel @CUPS_LOG_LEVEL@
|
||||
|
||||
# Administrator user group...
|
||||
SystemGroup @CUPS_SYSTEM_GROUPS@
|
||||
@CUPS_SYSTEM_AUTHKEY@
|
||||
|
||||
# Only listen for connections from the local machine.
|
||||
Listen localhost:@DEFAULT_IPP_PORT@
|
||||
@CUPS_LISTEN_DOMAINSOCKET@
|
||||
|
||||
# Show shared printers on the local network.
|
||||
Browsing On
|
||||
BrowseOrder allow,deny
|
||||
BrowseAllow all
|
||||
BrowseLocalProtocols @CUPS_BROWSE_LOCAL_PROTOCOLS@
|
||||
|
||||
# Default authentication type, when authentication is required...
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 10192 2012-01-20 21:49:02Z mike $"
|
||||
dnl "$Id: cups-common.m4 10785 2013-01-08 16:29:26Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2007-2012 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
|
||||
@@ -20,11 +20,11 @@ dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Version number information...
|
||||
CUPS_VERSION="1.6svn"
|
||||
CUPS_VERSION="1.6.2"
|
||||
CUPS_REVISION=""
|
||||
if test -z "$CUPS_REVISION" -a -d .svn; then
|
||||
CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
|
||||
fi
|
||||
#if test -z "$CUPS_REVISION" -a -d .svn; then
|
||||
# CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
|
||||
#fi
|
||||
CUPS_BUILD="cups-$CUPS_VERSION"
|
||||
|
||||
AC_ARG_WITH(cups_build, [ --with-cups-build set "cups-config --build" string ],
|
||||
@@ -50,7 +50,7 @@ AC_PROG_CXX
|
||||
AC_PROG_RANLIB
|
||||
AC_PATH_PROG(AR,ar)
|
||||
AC_PATH_PROG(CHMOD,chmod)
|
||||
AC_PATH_PROG(HTMLDOC,htmldoc)
|
||||
AC_PATH_PROG(GZIP,gzip)
|
||||
AC_PATH_PROG(LD,ld)
|
||||
AC_PATH_PROG(LN,ln)
|
||||
AC_PATH_PROG(MV,mv)
|
||||
@@ -92,8 +92,9 @@ dnl Check for pkg-config, which is used for some other tests later on...
|
||||
AC_PATH_PROG(PKGCONFIG, pkg-config)
|
||||
|
||||
dnl Check for libraries...
|
||||
AC_SEARCH_LIBS(fmod, m)
|
||||
AC_SEARCH_LIBS(abs, m, AC_DEFINE(HAVE_ABS))
|
||||
AC_SEARCH_LIBS(crypt, crypt)
|
||||
AC_SEARCH_LIBS(fmod, m)
|
||||
AC_SEARCH_LIBS(getspent, sec gen)
|
||||
|
||||
LIBMALLOC=""
|
||||
@@ -129,6 +130,7 @@ AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
|
||||
AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
|
||||
AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
|
||||
AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
|
||||
AC_CHECK_HEADER(stdint.h,AC_DEFINE(HAVE_STDINT_H))
|
||||
AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
|
||||
AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
|
||||
AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
|
||||
@@ -225,19 +227,20 @@ AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing])
|
||||
LIBUSB=""
|
||||
AC_SUBST(LIBUSB)
|
||||
|
||||
if test x$enable_libusb = xyes; then
|
||||
check_libusb=yes
|
||||
elif test x$enable_libusb != xno -a $uname != Darwin; then
|
||||
check_libusb=yes
|
||||
else
|
||||
check_libusb=no
|
||||
fi
|
||||
|
||||
if test $check_libusb = yes; then
|
||||
AC_CHECK_LIB(usb, usb_get_string_simple,[
|
||||
AC_CHECK_HEADER(usb.h,
|
||||
AC_DEFINE(HAVE_USB_H)
|
||||
LIBUSB="-lusb")])
|
||||
if test "x$PKGCONFIG" != x; then
|
||||
if test x$enable_libusb = xyes -o $uname != Darwin; then
|
||||
AC_MSG_CHECKING(for libusb-1.0)
|
||||
if $PKGCONFIG --exists libusb-1.0; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_LIBUSB)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags libusb-1.0`"
|
||||
LIBUSB="`$PKGCONFIG --libs libusb-1.0`"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
elif test x$enable_libusb = xyes; then
|
||||
AC_MSG_ERROR(Need pkg-config to enable libusb support.)
|
||||
fi
|
||||
|
||||
dnl See if we have libwrap for TCP wrappers support...
|
||||
@@ -254,12 +257,17 @@ if test x$enable_tcp_wrappers = xyes; then
|
||||
fi
|
||||
|
||||
dnl ZLIB
|
||||
INSTALL_GZIP=""
|
||||
LIBZ=""
|
||||
AC_CHECK_HEADER(zlib.h,
|
||||
AC_CHECK_LIB(z, gzgets,
|
||||
AC_DEFINE(HAVE_LIBZ)
|
||||
LIBZ="-lz"
|
||||
LIBS="$LIBS -lz"))
|
||||
LIBS="$LIBS -lz"
|
||||
if test "x$GZIP" != z; then
|
||||
INSTALL_GZIP="-z"
|
||||
fi))
|
||||
AC_SUBST(INSTALL_GZIP)
|
||||
AC_SUBST(LIBZ)
|
||||
|
||||
dnl Flags for "ar" command...
|
||||
@@ -348,12 +356,6 @@ case $uname in
|
||||
dnl Check for dynamic store function...
|
||||
AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName)
|
||||
|
||||
dnl Check for new ColorSync APIs...
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS="$LIBS -framework ApplicationServices"
|
||||
AC_CHECK_FUNCS(ColorSyncRegisterDevice)
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
dnl Check for the new membership functions in MacOSX 10.4...
|
||||
AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
|
||||
AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
|
||||
@@ -401,8 +403,8 @@ case $uname in
|
||||
if test $uversion -ge 100; then
|
||||
AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
|
||||
fi
|
||||
if test $uversion -ge 110; then
|
||||
# Broken public headers in 10.7...
|
||||
if test $uversion -ge 110 -a $uversion -lt 120; then
|
||||
# Broken public headers in 10.7.x...
|
||||
AC_MSG_CHECKING(for sandbox/private.h presence)
|
||||
if test -f /usr/local/include/sandbox/private.h; then
|
||||
AC_MSG_RESULT(yes)
|
||||
@@ -416,6 +418,8 @@ case $uname in
|
||||
AC_CHECK_HEADER(xpc/xpc.h,
|
||||
AC_DEFINE(HAVE_XPC)
|
||||
INSTALLXPC="install-xpc")
|
||||
AC_CHECK_HEADER(xpc/private.h,
|
||||
AC_DEFINE(HAVE_XPC_PRIVATE_H))
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -449,5 +453,5 @@ esac
|
||||
AC_SUBST(BUILDDIRS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 10192 2012-01-20 21:49:02Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 10785 2013-01-08 16:29:26Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-defaults.m4 10104 2011-11-04 06:37:03Z mike $"
|
||||
dnl "$Id: cups-defaults.m4 10710 2012-11-26 18:26:01Z mike $"
|
||||
dnl
|
||||
dnl Default cupsd configuration settings for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2007-2012 by Apple Inc.
|
||||
dnl Copyright 2006-2007 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
dnl Default languages...
|
||||
LANGUAGES="`ls -1 locale/cups_*.po | sed -e '1,$s/locale\/cups_//' -e '1,$s/\.po//' | tr '\n' ' '`"
|
||||
LANGUAGES="`ls -1 locale/cups_*.po 2>/dev/null | sed -e '1,$s/locale\/cups_//' -e '1,$s/\.po//' | tr '\n' ' '`"
|
||||
|
||||
AC_ARG_WITH(languages, [ --with-languages set installed languages, default=all ],[
|
||||
case "$withval" in
|
||||
@@ -24,8 +24,8 @@ AC_ARG_WITH(languages, [ --with-languages set installed languages, defau
|
||||
esac])
|
||||
AC_SUBST(LANGUAGES)
|
||||
|
||||
dnl Mac OS X bundle-based localization support
|
||||
AC_ARG_WITH(bundledir, [ --with-bundledir set Mac OS X localization bundle directory ],
|
||||
dnl OS X bundle-based localization support
|
||||
AC_ARG_WITH(bundledir, [ --with-bundledir set OS X localization bundle directory ],
|
||||
CUPS_BUNDLEDIR="$withval",
|
||||
if test "x$uname" = xDarwin -a $uversion -ge 100; then
|
||||
CUPS_BUNDLEDIR="/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A"
|
||||
@@ -50,6 +50,12 @@ AC_ARG_WITH(config_file_perm, [ --with-config-file-perm set default ConfigFileP
|
||||
AC_SUBST(CUPS_CONFIG_FILE_PERM)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
|
||||
|
||||
dnl Default permissions for cupsd
|
||||
AC_ARG_WITH(cupsd_file_perm, [ --with-cupsd-file-perm set default cupsd permissions, default=0500],
|
||||
CUPS_CUPSD_FILE_PERM="$withval",
|
||||
CUPS_CUPSD_FILE_PERM="500")
|
||||
AC_SUBST(CUPS_CUPSD_FILE_PERM)
|
||||
|
||||
dnl Default LogFilePerm
|
||||
AC_ARG_WITH(log_file_perm, [ --with-log-file-perm set default LogFilePerm value, default=0644],
|
||||
CUPS_LOG_FILE_PERM="$withval",
|
||||
@@ -96,7 +102,7 @@ AC_ARG_WITH(local_protocols, [ --with-local-protocols set default BrowseLocalP
|
||||
|
||||
if test x$with_local_protocols != xno; then
|
||||
if test "x$default_local_protocols" = "xdefault"; then
|
||||
if test "x$DNSSDLIBS" != "x"; then
|
||||
if test "x$DNSSD_BACKEND" != "x"; then
|
||||
CUPS_BROWSE_LOCAL_PROTOCOLS="dnssd"
|
||||
else
|
||||
CUPS_BROWSE_LOCAL_PROTOCOLS=""
|
||||
@@ -299,6 +305,7 @@ else
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LPD_CONFIG_FILE, "$CUPS_DEFAULT_LPD_CONFIG_FILE")
|
||||
AC_SUBST(CUPS_DEFAULT_LPD_CONFIG_FILE)
|
||||
|
||||
dnl Default SMB config file...
|
||||
AC_ARG_WITH(smbconfigfile, [ --with-smbconfigfile set default SMBConfigFile URI],
|
||||
@@ -320,6 +327,7 @@ else
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SMB_CONFIG_FILE, "$CUPS_DEFAULT_SMB_CONFIG_FILE")
|
||||
AC_SUBST(CUPS_DEFAULT_SMB_CONFIG_FILE)
|
||||
|
||||
dnl Default MaxCopies value...
|
||||
AC_ARG_WITH(max-copies, [ --with-max-copies set default max copies value, default=9999 ],
|
||||
@@ -367,7 +375,7 @@ AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl Web interface...
|
||||
AC_ARG_ENABLE(webif, [ --enable-webif enable the web interface by default, default=no for Mac OS X])
|
||||
AC_ARG_ENABLE(webif, [ --enable-webif enable the web interface by default, default=no for OS X])
|
||||
case "x$enable_webif" in
|
||||
xno)
|
||||
CUPS_WEBIF=No
|
||||
@@ -392,5 +400,5 @@ AC_SUBST(CUPS_WEBIF)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_WEBIF, $CUPS_DEFAULT_WEBIF)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-defaults.m4 10104 2011-11-04 06:37:03Z mike $".
|
||||
dnl End of "$Id: cups-defaults.m4 10710 2012-11-26 18:26:01Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-directories.m4 9771 2011-05-12 05:21:56Z mike $"
|
||||
dnl "$Id: cups-directories.m4 10622 2012-10-01 01:55:23Z mike $"
|
||||
dnl
|
||||
dnl Directory stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2007-2012 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
|
||||
@@ -106,7 +106,7 @@ if test "$libdir" = "\${exec_prefix}/lib"; then
|
||||
libdir="$exec_prefix/lib32"
|
||||
;;
|
||||
Linux*)
|
||||
if test -d /usr/lib64; then
|
||||
if test -d /usr/lib64 -a ! -d /usr/lib64/fakeroot; then
|
||||
libdir="$exec_prefix/lib64"
|
||||
fi
|
||||
;;
|
||||
@@ -424,7 +424,7 @@ AC_SUBST(CUPS_SERVERROOT)
|
||||
# Transient run-time state
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin (Mac OS X)
|
||||
# Darwin (OS X)
|
||||
CUPS_STATEDIR="$CUPS_SERVERROOT"
|
||||
;;
|
||||
*)
|
||||
@@ -436,5 +436,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
|
||||
AC_SUBST(CUPS_STATEDIR)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-directories.m4 9771 2011-05-12 05:21:56Z mike $".
|
||||
dnl End of "$Id: cups-directories.m4 10622 2012-10-01 01:55:23Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-dnssd.m4 9771 2011-05-12 05:21:56Z mike $"
|
||||
dnl "$Id: cups-dnssd.m4 10471 2012-05-16 22:57:03Z mike $"
|
||||
dnl
|
||||
dnl DNS Service Discovery (aka Bonjour) stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2007-2012 by Apple Inc.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -12,7 +12,8 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support])
|
||||
AC_ARG_ENABLE(avahi, [ --disable-avahi disable DNS Service Discovery support using Avahi])
|
||||
AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support using mDNSResponder])
|
||||
AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library],
|
||||
LDFLAGS="-L$withval $LDFLAGS"
|
||||
DSOFLAGS="-L$withval $DSOFLAGS",)
|
||||
@@ -23,14 +24,25 @@ AC_ARG_WITH(dnssd-includes, [ --with-dnssd-includes set directory for DNS Ser
|
||||
DNSSDLIBS=""
|
||||
DNSSD_BACKEND=""
|
||||
|
||||
if test x$enable_dnssd != xno; then
|
||||
if test "x$PKGCONFIG" != x -a x$enable_avahi != xno; then
|
||||
AC_MSG_CHECKING(for Avahi)
|
||||
if $PKGCONFIG --exists avahi-client; then
|
||||
AC_MSG_RESULT(yes)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`"
|
||||
DNSSDLIBS="`$PKGCONFIG --libs avahi-client`"
|
||||
DNSSD_BACKEND="dnssd"
|
||||
AC_DEFINE(HAVE_AVAHI)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$DNSSD_BACKEND" = x -a x$enable_dnssd != xno; then
|
||||
AC_CHECK_HEADER(dns_sd.h, [
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin and MacOS X...
|
||||
AC_DEFINE(HAVE_DNSSD)
|
||||
AC_DEFINE(HAVE_COREFOUNDATION)
|
||||
AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
|
||||
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
|
||||
DNSSD_BACKEND="dnssd"
|
||||
;;
|
||||
@@ -60,5 +72,5 @@ AC_SUBST(DNSSDLIBS)
|
||||
AC_SUBST(DNSSD_BACKEND)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-dnssd.m4 9771 2011-05-12 05:21:56Z mike $".
|
||||
dnl End of "$Id: cups-dnssd.m4 10471 2012-05-16 22:57:03Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-gssapi.m4 10137 2011-12-02 04:04:49Z mike $"
|
||||
dnl "$Id: cups-gssapi.m4 10785 2013-01-08 16:29:26Z mike $"
|
||||
dnl
|
||||
dnl GSSAPI/Kerberos library detection for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2007-2012 by Apple Inc.
|
||||
dnl Copyright 2006-2007 by Easy Software Products.
|
||||
dnl
|
||||
dnl This file contains Kerberos support code, copyright 2006 by
|
||||
@@ -26,7 +26,7 @@ if test x$enable_gssapi != xno; then
|
||||
if test "x$KRB5CONFIG" != x; then
|
||||
case "$uname" in
|
||||
Darwin)
|
||||
# Mac OS X weak-links to the Kerberos framework...
|
||||
# OS X weak-links to the Kerberos framework...
|
||||
LIBGSSAPI="-weak_framework Kerberos"
|
||||
AC_MSG_CHECKING(for GSS framework)
|
||||
if test -d /System/Library/Frameworks/GSS.framework; then
|
||||
@@ -86,13 +86,6 @@ if test x$enable_gssapi != xno; then
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_MSG_CHECKING(for GSS/gssapi_krb5.h presence)
|
||||
if test -f $gssdir/Headers/gssapi_krb5.h; then
|
||||
AC_DEFINE(HAVE_GSSAPI_KRB5_H)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_MSG_CHECKING(for GSS/gssapi_spi.h presence)
|
||||
if test -f $gssdir/PrivateHeaders/gssapi_spi.h; then
|
||||
AC_MSG_RESULT(yes)
|
||||
@@ -105,16 +98,14 @@ if test x$enable_gssapi != xno; then
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test $uversion -ge 110; then
|
||||
# Broken public headers in 10.7...
|
||||
if test $uversion -ge 110 -a $uversion -lt 120; then
|
||||
# Broken public headers in 10.7.x...
|
||||
AC_MSG_ERROR(Run 'sudo mkdir -p $gssdir/PrivateHeaders' and 'sudo touch $gssdir/PrivateHeaders/gssapi_spi.h' to build CUPS.)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H))
|
||||
AC_CHECK_HEADER(gssapi/gssapi.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_H))
|
||||
AC_CHECK_HEADER(gssapi/gssapi_generic.h, AC_DEFINE(HAVE_GSSAPI_GENERIC_H))
|
||||
AC_CHECK_HEADER(gssapi/gssapi_krb5.h, AC_DEFINE(HAVE_GSSAPI_KRB5_H))
|
||||
fi
|
||||
|
||||
SAVELIBS="$LIBS"
|
||||
@@ -167,5 +158,5 @@ AC_SUBST(CUPS_DEFAULT_GSSSERVICENAME)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME")
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-gssapi.m4 10137 2011-12-02 04:04:49Z mike $".
|
||||
dnl End of "$Id: cups-gssapi.m4 10785 2013-01-08 16:29:26Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-manpages.m4 9771 2011-05-12 05:21:56Z mike $"
|
||||
dnl "$Id: cups-manpages.m4 10424 2012-04-23 17:26:57Z mike $"
|
||||
dnl
|
||||
dnl Manpage stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2007-2012 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
|
||||
@@ -68,7 +68,7 @@ case "$uname" in
|
||||
MAN8DIR=1m
|
||||
;;
|
||||
Linux* | GNU* | Darwin*)
|
||||
# Linux, GNU Hurd, and Mac OS X
|
||||
# Linux, GNU Hurd, and OS X
|
||||
MAN1EXT=1.gz
|
||||
MAN5EXT=5.gz
|
||||
MAN7EXT=7.gz
|
||||
@@ -92,5 +92,5 @@ AC_SUBST(MAN8EXT)
|
||||
AC_SUBST(MAN8DIR)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-manpages.m4 9771 2011-05-12 05:21:56Z mike $".
|
||||
dnl End of "$Id: cups-manpages.m4 10424 2012-04-23 17:26:57Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-pam.m4 9771 2011-05-12 05:21:56Z mike $"
|
||||
dnl "$Id: cups-pam.m4 10424 2012-04-23 17:26:57Z mike $"
|
||||
dnl
|
||||
dnl PAM stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2007-2012 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
|
||||
@@ -61,7 +61,7 @@ if test x$enable_pam != xno; then
|
||||
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin/Mac OS X
|
||||
# Darwin/OS X
|
||||
if test "x$with_pam_module" != x; then
|
||||
PAMFILE="pam.$with_pam_module"
|
||||
elif test -f /usr/lib/pam/pam_opendirectory.so.2; then
|
||||
@@ -98,5 +98,5 @@ AC_SUBST(PAMMOD)
|
||||
AC_SUBST(PAMMODAUTH)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-pam.m4 9771 2011-05-12 05:21:56Z mike $".
|
||||
dnl End of "$Id: cups-pam.m4 10424 2012-04-23 17:26:57Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-ssl.m4 9837 2011-06-16 20:12:16Z mike $"
|
||||
dnl "$Id: cups-ssl.m4 10710 2012-11-26 18:26:01Z mike $"
|
||||
dnl
|
||||
dnl OpenSSL/GNUTLS stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2007-2012 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
|
||||
@@ -27,6 +27,8 @@ AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenS
|
||||
SSLFLAGS=""
|
||||
SSLLIBS=""
|
||||
have_ssl=0
|
||||
CUPS_SERVERCERT=""
|
||||
CUPS_SERVERKEY=""
|
||||
|
||||
if test x$enable_ssl != xno; then
|
||||
dnl Look for CDSA...
|
||||
@@ -36,6 +38,7 @@ if test x$enable_ssl != xno; then
|
||||
have_ssl=1
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_CDSASSL)
|
||||
CUPS_SERVERCERT="/Library/Keychains/System.keychain"
|
||||
|
||||
dnl Check for the various security headers...
|
||||
AC_CHECK_HEADER(Security/SecureTransportPriv.h,
|
||||
@@ -56,12 +59,6 @@ if test x$enable_ssl != xno; then
|
||||
AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
|
||||
AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
|
||||
|
||||
dnl Check for SSLSetProtocolVersionMax...
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS="$LIBS -framework Security"
|
||||
AC_CHECK_FUNC(SSLSetProtocolVersionMax)
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
dnl Check for SecCertificateCopyData..
|
||||
AC_MSG_CHECKING(for SecCertificateCopyData)
|
||||
if test $uversion -ge 100; then
|
||||
@@ -112,6 +109,9 @@ if test x$enable_ssl != xno; then
|
||||
fi
|
||||
|
||||
if test $have_ssl = 1; then
|
||||
CUPS_SERVERCERT="ssl/server.crt"
|
||||
CUPS_SERVERKEY="ssl/server.key"
|
||||
|
||||
if $PKGCONFIG --exists gcrypt; then
|
||||
SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
|
||||
SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
|
||||
@@ -124,7 +124,7 @@ if test x$enable_ssl != xno; then
|
||||
|
||||
dnl Check for the OpenSSL library last...
|
||||
if test $have_ssl = 0 -a "x$enable_openssl" != "xno"; then
|
||||
AC_CHECK_HEADER(openssl/ssl.h,
|
||||
AC_CHECK_HEADER(openssl/ssl.h,[
|
||||
dnl Save the current libraries so the crypto stuff isn't always
|
||||
dnl included...
|
||||
SAVELIBS="$LIBS"
|
||||
@@ -136,9 +136,9 @@ if test x$enable_ssl != xno; then
|
||||
dnl case the RSAREF libraries are needed.
|
||||
|
||||
for libcrypto in \
|
||||
"-lcrypto" \
|
||||
"-lcrypto -lrsaref" \
|
||||
"-lcrypto -lRSAglue -lrsaref"
|
||||
"-lcrypto" \
|
||||
"-lcrypto -lrsaref" \
|
||||
"-lcrypto -lRSAglue -lrsaref"
|
||||
do
|
||||
AC_CHECK_LIB(ssl,SSL_new,
|
||||
[have_ssl=1
|
||||
@@ -153,7 +153,15 @@ if test x$enable_ssl != xno; then
|
||||
fi
|
||||
done
|
||||
|
||||
LIBS="$SAVELIBS")
|
||||
if test "x${SSLLIBS}" != "x"; then
|
||||
CUPS_SERVERCERT="ssl/server.crt"
|
||||
CUPS_SERVERKEY="ssl/server.key"
|
||||
|
||||
LIBS="$SAVELIBS $SSLLIBS"
|
||||
AC_CHECK_FUNCS(SSL_set_tlsext_host_name)
|
||||
fi
|
||||
|
||||
LIBS="$SAVELIBS"])
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -166,6 +174,8 @@ elif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes -o x$enable_openssl = x
|
||||
AC_MSG_ERROR([Unable to enable SSL support.])
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_SERVERCERT)
|
||||
AC_SUBST(CUPS_SERVERKEY)
|
||||
AC_SUBST(IPPALIASES)
|
||||
AC_SUBST(SSLFLAGS)
|
||||
AC_SUBST(SSLLIBS)
|
||||
@@ -173,7 +183,6 @@ AC_SUBST(SSLLIBS)
|
||||
EXPORT_SSLLIBS="$SSLLIBS"
|
||||
AC_SUBST(EXPORT_SSLLIBS)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-ssl.m4 9837 2011-06-16 20:12:16Z mike $".
|
||||
dnl End of "$Id: cups-ssl.m4 10710 2012-11-26 18:26:01Z mike $".
|
||||
dnl
|
||||
|
||||
+43
-48
@@ -174,6 +174,13 @@
|
||||
#undef HAVE_SCSI_SG_H
|
||||
|
||||
|
||||
/*
|
||||
* Use <stdint.h>?
|
||||
*/
|
||||
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
|
||||
/*
|
||||
* Use <string.h>, <strings.h>, and/or <bstring.h>?
|
||||
*/
|
||||
@@ -295,6 +302,13 @@
|
||||
#undef HAVE_SSL
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SSL_set_tlsext_host_name function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SSL_SET_TLSEXT_HOST_NAME
|
||||
|
||||
|
||||
/*
|
||||
* What Security framework headers do we have?
|
||||
*/
|
||||
@@ -338,13 +352,6 @@
|
||||
#undef HAVE_SECPOLICYCREATESSL
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SSLSetProtocolVersionMax function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SSLSETPROTOCOLVERSIONMAX
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the cssmErrorString function?
|
||||
*/
|
||||
@@ -352,25 +359,6 @@
|
||||
#undef HAVE_CSSMERRORSTRING
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SLP library?
|
||||
*/
|
||||
|
||||
#undef HAVE_LIBSLP
|
||||
|
||||
|
||||
/*
|
||||
* Do we have an LDAP library?
|
||||
*/
|
||||
|
||||
#undef HAVE_LDAP
|
||||
#undef HAVE_OPENLDAP
|
||||
#undef HAVE_MOZILLA_LDAP
|
||||
#undef HAVE_LDAP_SSL_H
|
||||
#undef HAVE_LDAP_SSL
|
||||
#undef HAVE_LDAP_REBIND_PROC
|
||||
|
||||
|
||||
/*
|
||||
* Do we have libpaper?
|
||||
*/
|
||||
@@ -379,12 +367,19 @@
|
||||
|
||||
|
||||
/*
|
||||
* Do we have DNS Service Discovery (aka Bonjour)?
|
||||
* Do we have mDNSResponder for DNS Service Discovery (aka Bonjour)?
|
||||
*/
|
||||
|
||||
#undef HAVE_DNSSD
|
||||
|
||||
|
||||
/*
|
||||
* Do we have Avahi for DNS Service Discovery (aka Bonjour)?
|
||||
*/
|
||||
|
||||
#undef HAVE_AVAHI
|
||||
|
||||
|
||||
/*
|
||||
* Do we have <sys/ioctl.h>?
|
||||
*/
|
||||
@@ -523,14 +518,6 @@
|
||||
#define CUPS_GHOSTSCRIPT "/usr/bin/gs"
|
||||
|
||||
|
||||
/*
|
||||
* Do we have Darwin's CoreFoundation and SystemConfiguration frameworks?
|
||||
*/
|
||||
|
||||
#undef HAVE_COREFOUNDATION
|
||||
#undef HAVE_SYSTEMCONFIGURATION
|
||||
|
||||
|
||||
/*
|
||||
* Do we have CoreFoundation public and private headers?
|
||||
*/
|
||||
@@ -555,7 +542,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* Do we have Mac OS X 10.4's mbr_XXX functions?
|
||||
* Do we have OS X 10.4's mbr_XXX functions?
|
||||
*/
|
||||
|
||||
#undef HAVE_MEMBERSHIP_H
|
||||
@@ -595,11 +582,8 @@
|
||||
#undef HAVE_GSS_GSSAPI_H
|
||||
#undef HAVE_GSS_GSSAPI_SPI_H
|
||||
#undef HAVE_GSSAPI
|
||||
#undef HAVE_GSSAPI_GENERIC_H
|
||||
#undef HAVE_GSSAPI_GSSAPI_H
|
||||
#undef HAVE_GSSAPI_H
|
||||
#undef HAVE_GSSAPI_KRB5_H
|
||||
#undef HAVE_KRB5_H
|
||||
|
||||
|
||||
/*
|
||||
@@ -687,7 +671,7 @@
|
||||
* Do we have libusb?
|
||||
*/
|
||||
|
||||
#undef HAVE_USB_H
|
||||
#undef HAVE_LIBUSB
|
||||
|
||||
|
||||
/*
|
||||
@@ -717,24 +701,18 @@
|
||||
|
||||
|
||||
/*
|
||||
* Location of Mac OS X localization bundle, if any.
|
||||
* Location of OS X localization bundle, if any.
|
||||
*/
|
||||
|
||||
#undef CUPS_BUNDLEDIR
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the ColorSyncRegisterDevice function?
|
||||
*/
|
||||
|
||||
#undef HAVE_COLORSYNCREGISTERDEVICE
|
||||
|
||||
|
||||
/*
|
||||
* Do we have XPC?
|
||||
*/
|
||||
|
||||
#undef HAVE_XPC
|
||||
#undef HAVE_XPC_PRIVATE_H
|
||||
|
||||
|
||||
/*
|
||||
@@ -744,6 +722,23 @@
|
||||
#undef HAVE_MXML_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the C99 abs() function?
|
||||
*/
|
||||
|
||||
#undef HAVE_ABS
|
||||
#if !defined(HAVE_ABS) && !defined(abs)
|
||||
# if defined(__GNUC__) || __STDC_VERSION__ >= 199901L
|
||||
# define abs(x) _cups_abs(x)
|
||||
static inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
|
||||
# elif defined(_MSC_VER)
|
||||
# define abs(x) _cups_abs(x)
|
||||
static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
|
||||
# else
|
||||
# define abs(x) ((x) < 0 ? -(x) : (x))
|
||||
# endif /* __GNUC__ || __STDC_VERSION__ */
|
||||
#endif /* !HAVE_ABS && !abs */
|
||||
|
||||
#endif /* !_CUPS_CONFIG_H_ */
|
||||
|
||||
/*
|
||||
|
||||
+5
-1
@@ -3,7 +3,7 @@ dnl "$Id$"
|
||||
dnl
|
||||
dnl Configuration script for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2012 by Apple Inc.
|
||||
dnl Copyright 2007-2013 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
|
||||
@@ -60,6 +60,7 @@ AC_SUBST(INSTALL_LANGUAGES)
|
||||
AC_SUBST(UNINSTALL_LANGUAGES)
|
||||
|
||||
AC_OUTPUT(Makedefs
|
||||
conf/cups-files.conf
|
||||
conf/cupsd.conf
|
||||
conf/mime.convs
|
||||
conf/pam.std
|
||||
@@ -67,13 +68,16 @@ AC_OUTPUT(Makedefs
|
||||
cups-config
|
||||
data/testprint
|
||||
desktop/cups.desktop
|
||||
doc/help/ref-cups-files-conf.html
|
||||
doc/help/ref-cupsd-conf.html
|
||||
doc/help/standard.html
|
||||
doc/index.html
|
||||
man/client.conf.man
|
||||
man/cups-deviced.man
|
||||
man/cups-driverd.man
|
||||
man/cups-files.conf.man
|
||||
man/cups-lpd.man
|
||||
man/cups-snmp.man
|
||||
man/cupsaddsmb.man
|
||||
man/cupsd.conf.man
|
||||
man/cupsd.man
|
||||
|
||||
+220
-210
@@ -1,211 +1,221 @@
|
||||
adminutil.o: adminutil.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h adminutil.h
|
||||
adminutil.o: adminutil.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h adminutil.h
|
||||
array.o: array.c string-private.h ../config.h debug-private.h \
|
||||
../cups/versioning.h array-private.h ../cups/array.h
|
||||
attr.o: attr.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
auth.o: auth.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
attr.o: attr.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
auth.o: auth.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
backchannel.o: backchannel.c cups.h file.h versioning.h ipp.h http.h \
|
||||
array.h language.h
|
||||
backend.o: backend.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h backend.h
|
||||
conflicts.o: conflicts.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
custom.o: custom.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
debug.o: debug.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
dest.o: dest.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
dest-job.o: dest-job.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
dest-localization.o: dest-localization.c cups-private.h ../cups/cups.h \
|
||||
file.h versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
dest-options.o: dest-options.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
backend.o: backend.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h backend.h
|
||||
conflicts.o: conflicts.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
custom.o: custom.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
debug.o: debug.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
dest.o: dest.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
dest-job.o: dest-job.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
dest-localization.o: dest-localization.c cups-private.h string-private.h \
|
||||
../config.h debug-private.h ../cups/versioning.h ipp-private.h \
|
||||
../cups/ipp.h http.h array.h http-private.h md5-private.h \
|
||||
language-private.h ../cups/transcode.h language.h pwg-private.h \
|
||||
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
|
||||
dest-options.o: dest-options.c cups-private.h string-private.h \
|
||||
../config.h debug-private.h ../cups/versioning.h ipp-private.h \
|
||||
../cups/ipp.h http.h array.h http-private.h md5-private.h \
|
||||
language-private.h ../cups/transcode.h language.h pwg-private.h \
|
||||
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
|
||||
dir.o: dir.c string-private.h ../config.h debug-private.h \
|
||||
../cups/versioning.h dir.h
|
||||
emit.o: emit.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
encode.o: encode.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
file.o: file.c file-private.h cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
getdevices.o: getdevices.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
emit.o: emit.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
encode.o: encode.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
file.o: file.c file-private.h cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
getdevices.o: getdevices.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
getifaddrs.o: getifaddrs.c http-private.h ../config.h ../cups/http.h \
|
||||
versioning.h array.h md5-private.h ipp-private.h ../cups/ipp.h
|
||||
getputfile.o: getputfile.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
globals.o: globals.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
http.o: http.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
http-addr.o: http-addr.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
http-addrlist.o: http-addrlist.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
http-support.o: http-support.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
ipp.o: ipp.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
ipp-support.o: ipp-support.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
langprintf.o: langprintf.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
language.o: language.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
localize.o: localize.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
mark.o: mark.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
getputfile.o: getputfile.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
globals.o: globals.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
http.o: http.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
http-addr.o: http-addr.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
http-addrlist.o: http-addrlist.c cups-private.h string-private.h \
|
||||
../config.h debug-private.h ../cups/versioning.h ipp-private.h \
|
||||
../cups/ipp.h http.h array.h http-private.h md5-private.h \
|
||||
language-private.h ../cups/transcode.h language.h pwg-private.h \
|
||||
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
|
||||
http-support.o: http-support.c cups-private.h string-private.h \
|
||||
../config.h debug-private.h ../cups/versioning.h ipp-private.h \
|
||||
../cups/ipp.h http.h array.h http-private.h md5-private.h \
|
||||
language-private.h ../cups/transcode.h language.h pwg-private.h \
|
||||
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
|
||||
ipp.o: ipp.c cups-private.h string-private.h ../config.h debug-private.h \
|
||||
../cups/versioning.h ipp-private.h ../cups/ipp.h http.h array.h \
|
||||
http-private.h md5-private.h language-private.h ../cups/transcode.h \
|
||||
language.h pwg-private.h ../cups/cups.h file.h ppd-private.h \
|
||||
../cups/ppd.h thread-private.h
|
||||
ipp-support.o: ipp-support.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
langprintf.o: langprintf.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
language.o: language.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
localize.o: localize.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
mark.o: mark.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
md5.o: md5.c md5-private.h string-private.h ../config.h
|
||||
md5passwd.o: md5passwd.c http-private.h ../config.h ../cups/http.h \
|
||||
versioning.h array.h md5-private.h ipp-private.h ../cups/ipp.h \
|
||||
string-private.h
|
||||
notify.o: notify.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
options.o: options.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
notify.o: notify.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
options.o: options.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
page.o: page.c string-private.h ../config.h debug-private.h \
|
||||
../cups/versioning.h ppd.h cups.h file.h ipp.h http.h array.h \
|
||||
language.h
|
||||
ppd.o: ppd.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
ppd-cache.o: ppd-cache.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
pwg-media.o: pwg-media.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
request.o: request.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
ppd.o: ppd.c cups-private.h string-private.h ../config.h debug-private.h \
|
||||
../cups/versioning.h ipp-private.h ../cups/ipp.h http.h array.h \
|
||||
http-private.h md5-private.h language-private.h ../cups/transcode.h \
|
||||
language.h pwg-private.h ../cups/cups.h file.h ppd-private.h \
|
||||
../cups/ppd.h thread-private.h
|
||||
ppd-cache.o: ppd-cache.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
pwg-media.o: pwg-media.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
request.o: request.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
sidechannel.o: sidechannel.c sidechannel.h versioning.h cups-private.h \
|
||||
../cups/cups.h file.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
snmp.o: snmp.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h \
|
||||
snmp-private.h
|
||||
string-private.h ../config.h debug-private.h ipp-private.h \
|
||||
../cups/ipp.h http.h array.h http-private.h md5-private.h \
|
||||
language-private.h ../cups/transcode.h language.h pwg-private.h \
|
||||
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
|
||||
snmp.o: snmp.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h snmp-private.h
|
||||
snprintf.o: snprintf.c string-private.h ../config.h
|
||||
string.o: string.c string-private.h ../config.h debug-private.h \
|
||||
../cups/versioning.h thread-private.h array.h
|
||||
tempfile.o: tempfile.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
thread.o: thread.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
transcode.o: transcode.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
usersys.o: usersys.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
util.o: util.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h debug-private.h \
|
||||
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
|
||||
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
|
||||
tempfile.o: tempfile.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
thread.o: thread.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
transcode.o: transcode.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
usersys.o: usersys.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
util.o: util.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
testadmin.o: testadmin.c adminutil.h cups.h file.h versioning.h ipp.h \
|
||||
http.h array.h language.h string-private.h ../config.h
|
||||
testarray.o: testarray.c string-private.h ../config.h debug-private.h \
|
||||
@@ -223,28 +233,28 @@ testi18n.o: testi18n.c string-private.h ../config.h language-private.h \
|
||||
../cups/transcode.h language.h array.h versioning.h
|
||||
testipp.o: testipp.c file.h versioning.h string-private.h ../config.h \
|
||||
ipp-private.h ../cups/ipp.h http.h array.h
|
||||
testoptions.o: testoptions.c cups-private.h ../cups/cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h string-private.h \
|
||||
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
testlang.o: testlang.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
testppd.o: testppd.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h
|
||||
testoptions.o: testoptions.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
testlang.o: testlang.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
testppd.o: testppd.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h
|
||||
testpwg.o: testpwg.c ppd-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h ../cups/ppd.h pwg-private.h \
|
||||
file-private.h cups-private.h string-private.h ../config.h \
|
||||
debug-private.h http-private.h md5-private.h ipp-private.h \
|
||||
debug-private.h ipp-private.h http-private.h md5-private.h \
|
||||
language-private.h ../cups/transcode.h thread-private.h
|
||||
testsnmp.o: testsnmp.c cups-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h string-private.h ../config.h \
|
||||
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
|
||||
http-private.h md5-private.h ipp-private.h language-private.h \
|
||||
../cups/transcode.h thread-private.h snmp-private.h
|
||||
testsnmp.o: testsnmp.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
|
||||
http.h array.h http-private.h md5-private.h language-private.h \
|
||||
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
|
||||
ppd-private.h ../cups/ppd.h thread-private.h snmp-private.h
|
||||
|
||||
+4
-4
@@ -304,7 +304,7 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
|
||||
echo Linking $@...
|
||||
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
|
||||
-install_name $(libdir)/$@ \
|
||||
-current_version 2.9.0 \
|
||||
-current_version 2.10.0 \
|
||||
-compatibility_version 2.0.0 \
|
||||
-exported_symbols_list t.exp \
|
||||
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
@@ -333,7 +333,7 @@ libcups_s.a: $(LIBOBJS) libcups_s.exp
|
||||
libcups.la: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
|
||||
-rpath $(LIBDIR) -version-info 2:9 $(LIBGSSAPI) $(SSLLIBS) \
|
||||
-rpath $(LIBDIR) -version-info 2:10 $(LIBGSSAPI) $(SSLLIBS) \
|
||||
$(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ apihelp:
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-cups.header --intro api-cups.shtml \
|
||||
api-cups.xml \
|
||||
cups.h adminutil.c dest.c language.c notify.c \
|
||||
cups.h adminutil.c dest*.c language.c notify.c \
|
||||
options.c tempfile.c usersys.c \
|
||||
util.c >../doc/help/api-cups.html
|
||||
mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
|
||||
@@ -573,7 +573,7 @@ framedhelp:
|
||||
--section "Programming" --title "CUPS API" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-cups.header --intro api-cups.shtml \
|
||||
cups.h adminutil.c dest.c language.c notify.c \
|
||||
cups.h adminutil.c dest*.c language.c notify.c \
|
||||
options.c tempfile.c usersys.c \
|
||||
util.c
|
||||
mxmldoc --framed api-filedir \
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Administration utility API definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -65,7 +65,7 @@ static void write_option(cups_file_t *dstfp, int order,
|
||||
/*
|
||||
* 'cupsAdminCreateWindowsPPD()' - Create the Windows PPD file for a printer.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @deprecated@
|
||||
*/
|
||||
|
||||
char * /* O - PPD file or NULL */
|
||||
@@ -393,7 +393,7 @@ cupsAdminCreateWindowsPPD(
|
||||
/*
|
||||
* 'cupsAdminExportSamba()' - Export a printer to Samba.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @deprecated@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -843,7 +843,7 @@ cupsAdminExportSamba(
|
||||
* The returned settings should be freed with cupsFreeOptions() when
|
||||
* you are done with them.
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -1159,7 +1159,7 @@ cupsAdminGetServerSettings(
|
||||
/*
|
||||
* 'cupsAdminSetServerSettings()' - Set settings on the server.
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
|
||||
+8
-5
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Administration utility API definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -55,16 +55,19 @@ extern int cupsAdminExportSamba(const char *dest, const char *ppd,
|
||||
const char *samba_server,
|
||||
const char *samba_user,
|
||||
const char *samba_password,
|
||||
FILE *logfile) _CUPS_API_1_2;
|
||||
FILE *logfile) _CUPS_DEPRECATED;
|
||||
extern char *cupsAdminCreateWindowsPPD(http_t *http, const char *dest,
|
||||
char *buffer, int bufsize) _CUPS_API_1_2;
|
||||
char *buffer, int bufsize)
|
||||
_CUPS_DEPRECATED;
|
||||
|
||||
extern int cupsAdminGetServerSettings(http_t *http,
|
||||
int *num_settings,
|
||||
cups_option_t **settings) _CUPS_API_1_3;
|
||||
cups_option_t **settings)
|
||||
_CUPS_API_1_3;
|
||||
extern int cupsAdminSetServerSettings(http_t *http,
|
||||
int num_settings,
|
||||
cups_option_t *settings) _CUPS_API_1_3;
|
||||
cups_option_t *settings)
|
||||
_CUPS_API_1_3;
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-filter.shtml 9799 2011-05-20 18:09:22Z mike $"
|
||||
"$Id: api-filter.shtml 10424 2012-04-23 17:26:57Z mike $"
|
||||
|
||||
Filter and backend programming introduction for CUPS.
|
||||
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
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
|
||||
@@ -81,7 +81,7 @@ directory to write to.</p>
|
||||
|
||||
<p>In addition, some operating systems provide additional security mechanisms
|
||||
that further limit file system access, even for backends running as root. On
|
||||
Mac OS X, for example, no backend may write to a user's home directory.</p>
|
||||
OS X, for example, no backend may write to a user's home directory.</p>
|
||||
</blockquote>
|
||||
|
||||
<h3><a name="SIGNALS">Canceled Jobs and Signal Handling</a></h3>
|
||||
@@ -153,7 +153,7 @@ when running print filters and backends:</p>
|
||||
|
||||
<dt>APPLE_LANGUAGE</dt>
|
||||
<dd>The Apple language identifier associated with the job
|
||||
(Mac OS X only).</dd>
|
||||
(OS X only).</dd>
|
||||
|
||||
<dt>CHARSET</dt>
|
||||
<dd>The job character set, typically "utf-8".</dd>
|
||||
@@ -474,7 +474,7 @@ sub-state and not an issue that applies when a job is not printing.</p>
|
||||
<blockquote><b>Note:</b>
|
||||
|
||||
<p>"STATE:" messages often provide visible alerts to the user. For example,
|
||||
on Mac OS X setting a printer-state-reason value with an "-error" or
|
||||
on OS X setting a printer-state-reason value with an "-error" or
|
||||
"-warning" suffix will cause the printer's dock item to bounce if the
|
||||
corresponding reason is localized with a cupsIPPReason keyword in the
|
||||
printer's PPD file.</p>
|
||||
|
||||
+46
-52
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-httpipp.shtml 9727 2011-04-28 21:20:12Z mike $"
|
||||
"$Id: api-httpipp.shtml 10388 2012-03-26 21:15:41Z mike $"
|
||||
|
||||
HTTP and IPP API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
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
|
||||
@@ -29,35 +29,20 @@ 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 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> structure 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 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 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 (<code>group_tag</code>), a
|
||||
value type tag (<code>value_tag</code>), the attribute name (<code>name</code>),
|
||||
and 1 or more values (<code>values[]</code>). Attributes are added to an
|
||||
<a href='#ipp_t'><code>ipp_t</code></a> structure using one of the
|
||||
<code>ippAdd</code> functions. For example, use
|
||||
<a href='#ippAddString'><code>ippAddString</code></a> to add a
|
||||
"requesting-user-name" string attribute to a request:</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>
|
||||
<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>
|
||||
@@ -67,6 +52,8 @@ function can be used for simple query operations that do not involve files:</p>
|
||||
{
|
||||
<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());
|
||||
|
||||
@@ -74,13 +61,7 @@ function can be used for simple query operations that do not involve files:</p>
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>The <a href='#cupsDoRequest'><code>cupsDoRequest</code></a> function frees
|
||||
the request structure and returns an IPP response structure or NULL 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>
|
||||
<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;
|
||||
@@ -89,25 +70,20 @@ to find specific attributes, for example:</p>
|
||||
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>
|
||||
<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 = response->attrs; attr != NULL; attr = attr->next)
|
||||
if (attr->name == NULL)
|
||||
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(attr->name);
|
||||
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>
|
||||
<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>();
|
||||
@@ -115,37 +91,55 @@ our previous <a href='#get_jobs'><code>get_jobs</code></a> example code:</p>
|
||||
if (response != NULL)
|
||||
{
|
||||
<a href='#ipp_attribute_t'>ipp_attribute_t</a> *attr;
|
||||
const char *attrname;
|
||||
int job_id = 0;
|
||||
char *job_name = NULL;
|
||||
char *job_originating_user_name = NULL;
|
||||
const char *job_name = NULL;
|
||||
const char *job_originating_user_name = NULL;
|
||||
|
||||
puts("Job ID Owner Title");
|
||||
puts("------ ---------------- ---------------------------------");
|
||||
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
for (attr = <a href='#ippFirstAttribute'>ippFirstAttribute</a>(response); attr != NULL; attr = <a href='#ippNextAttribute'>ippNextAttribute</a>(response))
|
||||
{
|
||||
/* Attributes without names are separators between jobs */
|
||||
if (attr->name == NULL)
|
||||
attrname = ippGetName(attr);
|
||||
if (attrname == NULL)
|
||||
{
|
||||
if (job_id > 0 && job_name != NULL && job_originating_user_name != 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(attr->name, "job-id") && attr->value_tag == IPP_TAG_INTEGER)
|
||||
job_id = attr->values[0].integer;
|
||||
else if (!strcmp(attr->name, "job-name") && attr->value_tag == IPP_TAG_NAME)
|
||||
job_name = attr->values[0].string.text;
|
||||
else if (!strcmp(attr->name, "job-originating-user-name") &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
job_originating_user_name = attr->values[0].string.text;
|
||||
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 && job_name != NULL && job_originating_user_name != 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>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-ppd.header 10103 2011-11-03 20:44:57Z mike $"
|
||||
"$Id: api-ppd.header 10424 2012-04-23 17:26:57Z mike $"
|
||||
|
||||
PPD API header for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
Copyright 2008-2012 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<h1 class='title'>PPD API (DEPRECATED)</h1>
|
||||
|
||||
<blockquote>The PPD API is deprecated starting in CUPS 1.6. Please use the new Job Ticket APIs in the <a href="api-cups.html">CUPS API</a> documentation. These functions will be removed in a future release of CUPS.</blockquote>
|
||||
<blockquote>The PPD API is deprecated starting in CUPS 1.6/OS X 10.8. Please use the new Job Ticket APIs in the <a href="api-cups.html">CUPS API</a> documentation. These functions will be removed in a future release of CUPS.</blockquote>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-ppd.shtml 10103 2011-11-03 20:44:57Z mike $"
|
||||
"$Id: api-ppd.shtml 10424 2012-04-23 17:26:57Z mike $"
|
||||
|
||||
PPD API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
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
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
|
||||
|
||||
<blockquote>The PPD API is deprecated starting in CUPS 1.6. Please use the new Job Ticket APIs in the <a href="api-cups.html">CUPS API</a> documentation. These functions will be removed in a future release of CUPS.</blockquote>
|
||||
<blockquote>The PPD API is deprecated starting in CUPS 1.6/OS X 10.8. Please use the new Job Ticket APIs in the <a href="api-cups.html">CUPS API</a> documentation. These functions will be removed in a future release of CUPS.</blockquote>
|
||||
|
||||
<p>The CUPS PPD API provides read-only access the data in PostScript Printer
|
||||
Description ("PPD") files which are used for all printers with a driver. With
|
||||
|
||||
+24
-24
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Sorted array routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -110,7 +110,7 @@ static int cups_array_find(cups_array_t *a, void *e, int prev, int *rdiff);
|
||||
* appended at the end of the run of identical elements. For unsorted arrays,
|
||||
* the element is appended to the end of the array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -202,7 +202,7 @@ _cupsArrayAddStrings(cups_array_t *a, /* I - Array */
|
||||
* The caller is responsible for freeing the memory used by the
|
||||
* elements themselves.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -244,7 +244,7 @@ cupsArrayClear(cups_array_t *a) /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayCount()' - Get the number of elements in the array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Number of elements */
|
||||
@@ -271,7 +271,7 @@ cupsArrayCount(cups_array_t *a) /* I - Array */
|
||||
* The current element is undefined until you call @link cupsArrayFind@,
|
||||
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Element */
|
||||
@@ -301,7 +301,7 @@ cupsArrayCurrent(cups_array_t *a) /* I - Array */
|
||||
* The caller is responsible for freeing the memory used by the
|
||||
* elements themselves.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -345,7 +345,7 @@ cupsArrayDelete(cups_array_t *a) /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayDup()' - Duplicate the array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Duplicate array */
|
||||
@@ -430,7 +430,7 @@ cupsArrayDup(cups_array_t *a) /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayFind()' - Find an element in the array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Element found or @code NULL@ */
|
||||
@@ -525,7 +525,7 @@ cupsArrayFind(cups_array_t *a, /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayFirst()' - Get the first element in the array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - First element or @code NULL@ if the array is empty */
|
||||
@@ -554,7 +554,7 @@ cupsArrayFirst(cups_array_t *a) /* I - Array */
|
||||
* The current element is undefined until you call @link cupsArrayFind@,
|
||||
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Index of the current element, starting at 0 */
|
||||
@@ -570,7 +570,7 @@ cupsArrayGetIndex(cups_array_t *a) /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayGetInsert()' - Get the index of the last inserted element.
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Index of the last inserted element, starting at 0 */
|
||||
@@ -586,7 +586,7 @@ cupsArrayGetInsert(cups_array_t *a) /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayIndex()' - Get the N-th element in the array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - N-th element or @code NULL@ */
|
||||
@@ -609,7 +609,7 @@ cupsArrayIndex(cups_array_t *a, /* I - Array */
|
||||
* inserted at the beginning of the run of identical elements. For unsorted
|
||||
* arrays, the element is inserted at the beginning of the array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on failure, 1 on success */
|
||||
@@ -639,7 +639,7 @@ cupsArrayInsert(cups_array_t *a, /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayLast()' - Get the last element in the array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Last element or @code NULL@ if the array is empty */
|
||||
@@ -670,7 +670,7 @@ cupsArrayLast(cups_array_t *a) /* I - Array */
|
||||
* data pointer argument can safely be omitted when not required so functions
|
||||
* like @code strcmp@ can be used for sorted string arrays.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Array */
|
||||
@@ -692,7 +692,7 @@ cupsArrayNew(cups_array_func_t f, /* I - Comparison function or @code NULL@ for
|
||||
* The hash function ("h") is used to implement cached lookups with the
|
||||
* specified hash size ("hsize").
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Array */
|
||||
@@ -722,7 +722,7 @@ cupsArrayNew2(cups_array_func_t f, /* I - Comparison function or @code NULL@ fo
|
||||
* The free function ("cf") is used to automatically free/release elements when
|
||||
* removed or the array is deleted.
|
||||
*
|
||||
* @since CUPS 1.5/Mac OS X 10.7@
|
||||
* @since CUPS 1.5/OS X 10.7@
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Array */
|
||||
@@ -805,7 +805,7 @@ _cupsArrayNewStrings(const char *s) /* I - Comma-delimited strings or NULL */
|
||||
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
|
||||
* to set the current element.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Next element or @code NULL@ */
|
||||
@@ -838,7 +838,7 @@ cupsArrayNext(cups_array_t *a) /* I - Array */
|
||||
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
|
||||
* to set the current element.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Previous element or @code NULL@ */
|
||||
@@ -871,7 +871,7 @@ cupsArrayPrev(cups_array_t *a) /* I - Array */
|
||||
* The caller is responsible for freeing the memory used by the
|
||||
* removed element.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -936,7 +936,7 @@ cupsArrayRemove(cups_array_t *a, /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayRestore()' - Reset the current element to the last @link cupsArraySave@.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - New current element */
|
||||
@@ -967,7 +967,7 @@ cupsArrayRestore(cups_array_t *a) /* I - Array */
|
||||
*
|
||||
* The save/restore stack is guaranteed to be at least 32 elements deep.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -989,7 +989,7 @@ cupsArraySave(cups_array_t *a) /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayUserData()' - Return the user data for an array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - User data */
|
||||
@@ -1005,7 +1005,7 @@ cupsArrayUserData(cups_array_t *a) /* I - Array */
|
||||
/*
|
||||
* 'cups_array_add()' - Insert or append an element to the array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
static int /* O - 1 on success, 0 on failure */
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* PPD model-specific attribute routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -30,7 +30,7 @@
|
||||
/*
|
||||
* 'ppdFindAttr()' - Find the first matching attribute.
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
ppd_attr_t * /* O - Attribute or @code NULL@ if not found */
|
||||
@@ -87,7 +87,7 @@ ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
|
||||
/*
|
||||
* 'ppdFindNextAttr()' - Find the next matching attribute.
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
ppd_attr_t * /* O - Attribute or @code NULL@ if not found */
|
||||
|
||||
+28
-21
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Authentication functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* This file contains Kerberos support code, copyright 2006 by
|
||||
@@ -115,7 +115,7 @@ static int cups_local_auth(http_t *http);
|
||||
* This function should be called in response to a @code HTTP_UNAUTHORIZED@
|
||||
* status, prior to resubmitting your request.
|
||||
*
|
||||
* @since CUPS 1.1.20/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.20/OS X 10.4@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@@ -124,7 +124,8 @@ cupsDoAuthentication(
|
||||
const char *method, /* I - Request method ("GET", "POST", "PUT") */
|
||||
const char *resource) /* I - Resource path */
|
||||
{
|
||||
const char *password; /* Password string */
|
||||
const char *password, /* Password string */
|
||||
*www_auth; /* WWW-Authenticate header */
|
||||
char prompt[1024], /* Prompt for user */
|
||||
realm[HTTP_MAX_VALUE], /* realm="xyz" string */
|
||||
nonce[HTTP_MAX_VALUE]; /* nonce="xyz" string */
|
||||
@@ -179,9 +180,11 @@ cupsDoAuthentication(
|
||||
* Nope, see if we should retry the current username:password...
|
||||
*/
|
||||
|
||||
www_auth = http->fields[HTTP_FIELD_WWW_AUTHENTICATE];
|
||||
|
||||
if ((http->digest_tries > 1 || !http->userpass[0]) &&
|
||||
(!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) ||
|
||||
!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Digest", 6)))
|
||||
(!_cups_strncasecmp(www_auth, "Basic", 5) ||
|
||||
!_cups_strncasecmp(www_auth, "Digest", 6)))
|
||||
{
|
||||
/*
|
||||
* Nope - get a new password from the user...
|
||||
@@ -197,8 +200,7 @@ cupsDoAuthentication(
|
||||
cupsUser(),
|
||||
http->hostname[0] == '/' ? "localhost" : http->hostname);
|
||||
|
||||
http->digest_tries = _cups_strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],
|
||||
"Digest", 5) != 0;
|
||||
http->digest_tries = _cups_strncasecmp(www_auth, "Digest", 6) != 0;
|
||||
http->userpass[0] = '\0';
|
||||
|
||||
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
|
||||
@@ -227,7 +229,7 @@ cupsDoAuthentication(
|
||||
*/
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
|
||||
if (!_cups_strncasecmp(www_auth, "Negotiate", 9))
|
||||
{
|
||||
/*
|
||||
* Kerberos authentication...
|
||||
@@ -241,7 +243,7 @@ cupsDoAuthentication(
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_GSSAPI */
|
||||
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5))
|
||||
if (!_cups_strncasecmp(www_auth, "Basic", 5))
|
||||
{
|
||||
/*
|
||||
* Basic authentication...
|
||||
@@ -254,7 +256,7 @@ cupsDoAuthentication(
|
||||
(int)strlen(http->userpass));
|
||||
httpSetAuthString(http, "Basic", encode);
|
||||
}
|
||||
else if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Digest", 6))
|
||||
else if (!_cups_strncasecmp(www_auth, "Digest", 6))
|
||||
{
|
||||
/*
|
||||
* Digest authentication...
|
||||
@@ -277,7 +279,7 @@ cupsDoAuthentication(
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: Unknown auth type: \"%s\"",
|
||||
http->fields[HTTP_FIELD_WWW_AUTHENTICATE]));
|
||||
www_auth));
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
@@ -658,8 +660,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
int pid; /* Current process ID */
|
||||
FILE *fp; /* Certificate file */
|
||||
char trc[16], /* Try Root Certificate parameter */
|
||||
filename[1024], /* Certificate filename */
|
||||
certificate[33];/* Certificate string */
|
||||
filename[1024]; /* Certificate filename */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
# if defined(HAVE_AUTHORIZATION_H)
|
||||
OSStatus status; /* Status */
|
||||
@@ -853,19 +854,25 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
* Read the certificate from the file...
|
||||
*/
|
||||
|
||||
fgets(certificate, sizeof(certificate), fp);
|
||||
char certificate[33], /* Certificate string */
|
||||
*certptr; /* Pointer to certificate string */
|
||||
|
||||
certptr = fgets(certificate, sizeof(certificate), fp);
|
||||
fclose(fp);
|
||||
|
||||
/*
|
||||
* Set the authorization string and return...
|
||||
*/
|
||||
if (certptr)
|
||||
{
|
||||
/*
|
||||
* Set the authorization string and return...
|
||||
*/
|
||||
|
||||
httpSetAuthString(http, "Local", certificate);
|
||||
httpSetAuthString(http, "Local", certificate);
|
||||
|
||||
DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
|
||||
http->authstring));
|
||||
DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
|
||||
http->authstring));
|
||||
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
return (1);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Backchannel functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* cupsBackChannelRead() - Read data from the backchannel.
|
||||
* cupsBackChannelWrite() - Write data to the backchannel.
|
||||
* cups_setup() - Setup select()
|
||||
* cups_setup() - Setup select()
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -50,7 +50,7 @@ static void cups_setup(fd_set *set, struct timeval *tval,
|
||||
* parameter controls how many seconds to wait for the data - use 0.0 to
|
||||
* return immediately if there is no data, -1.0 to wait for data indefinitely.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Bytes read or -1 on error */
|
||||
@@ -101,7 +101,7 @@ cupsBackChannelRead(char *buffer, /* I - Buffer to read into */
|
||||
* 0.0 to return immediately if the data cannot be written, -1.0 to wait
|
||||
* indefinitely.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Bytes written or -1 on error */
|
||||
@@ -178,7 +178,7 @@ cupsBackChannelWrite(
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_setup()' - Setup select()
|
||||
* 'cups_setup()' - Setup select()
|
||||
*/
|
||||
|
||||
static void
|
||||
|
||||
+14
-3
@@ -44,7 +44,7 @@ static void quote_string(const char *s);
|
||||
* variable or the device URI passed in argv[0], whichever is found
|
||||
* first.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - Device URI or @code NULL@ */
|
||||
@@ -54,6 +54,8 @@ cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */
|
||||
*auth_info_required; /* AUTH_INFO_REQUIRED env var */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global info */
|
||||
int options; /* Resolve options */
|
||||
ppd_file_t *ppd; /* PPD file */
|
||||
ppd_attr_t *ppdattr; /* PPD attribute */
|
||||
|
||||
|
||||
if ((device_uri = getenv("DEVICE_URI")) == NULL)
|
||||
@@ -69,6 +71,15 @@ cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */
|
||||
!strcmp(auth_info_required, "negotiate"))
|
||||
options |= _HTTP_RESOLVE_FQDN;
|
||||
|
||||
if ((ppd = ppdOpenFile(getenv("PPD"))) != NULL)
|
||||
{
|
||||
if ((ppdattr = ppdFindAttr(ppd, "cupsIPPFaxOut", NULL)) != NULL &&
|
||||
!_cups_strcasecmp(ppdattr->value, "true"))
|
||||
options |= _HTTP_RESOLVE_FAXOUT;
|
||||
|
||||
ppdClose(ppd);
|
||||
}
|
||||
|
||||
return (_httpResolveURI(device_uri, cg->resolved_uri,
|
||||
sizeof(cg->resolved_uri), options, NULL, NULL));
|
||||
}
|
||||
@@ -81,7 +92,7 @@ cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */
|
||||
* It handles quoting of special characters in the device-make-and-model,
|
||||
* device-info, device-id, and device-location strings.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -125,7 +136,7 @@ quote_string(const char *s) /* I - String to write */
|
||||
if (*s == '\\' || *s == '\"')
|
||||
putchar('\\');
|
||||
|
||||
if (*s == '\n')
|
||||
if (((*s & 255) < ' ' && *s != '\t') || *s == 0x7f)
|
||||
putchar(' ');
|
||||
else
|
||||
putchar(*s);
|
||||
|
||||
+4
-4
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Option marking routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -79,7 +79,7 @@ static cups_array_t *ppd_test_constraints(ppd_file_t *ppd,
|
||||
* the conflicting options. The returned option array must be freed using
|
||||
* @link cupsFreeOptions@.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
int /* O - Number of conflicting options */
|
||||
@@ -178,7 +178,7 @@ cupsGetConflicts(
|
||||
* choice for the conflicting option, then iterating over all possible choices
|
||||
* until a non-conflicting option choice is found.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -650,7 +650,7 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
* This function tests whether a particular option choice is available based
|
||||
* on constraints against options in the "InstallableOptions" group.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
int /* O - 1 if conflicting, 0 if not conflicting */
|
||||
|
||||
+15
-5
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Private definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -22,15 +22,15 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <cups/cups.h>
|
||||
# include "string-private.h"
|
||||
# include "debug-private.h"
|
||||
# include "ppd-private.h"
|
||||
# include "http-private.h"
|
||||
# include "ipp-private.h"
|
||||
# include "http-private.h"
|
||||
# include "language-private.h"
|
||||
# include "pwg-private.h"
|
||||
# include "ppd-private.h"
|
||||
# include "thread-private.h"
|
||||
# include <cups/cups.h>
|
||||
# ifdef __APPLE__
|
||||
# include <sys/cdefs.h>
|
||||
# include <CoreFoundation/CoreFoundation.h>
|
||||
@@ -158,7 +158,8 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
cups_server_cert_cb_t server_cert_cb; /* Server certificate callback */
|
||||
void *server_cert_data;
|
||||
/* Server certificate user data */
|
||||
int any_root, /* Allow any root */
|
||||
int server_version, /* Server IPP version */
|
||||
any_root, /* Allow any root */
|
||||
expired_certs, /* Allow expired certs */
|
||||
expired_root; /* Allow expired root */
|
||||
|
||||
@@ -190,13 +191,22 @@ typedef struct _cups_media_db_s /* Media database */
|
||||
* millimeters */
|
||||
} _cups_media_db_t;
|
||||
|
||||
typedef struct _cups_dconstres_s /* Constraint/resolver */
|
||||
{
|
||||
char *name; /* Name of resolver */
|
||||
ipp_t *collection; /* Collection containing attrs */
|
||||
} _cups_dconstres_t;
|
||||
|
||||
struct _cups_dinfo_s /* Destination capability and status
|
||||
* information */
|
||||
{
|
||||
const char *uri; /* Printer URI */
|
||||
char *resource; /* Resource path */
|
||||
ipp_t *attrs; /* Printer attributes */
|
||||
int num_defaults; /* Number of default options */
|
||||
cups_option_t *defaults; /* Default options */
|
||||
cups_array_t *constraints; /* Job constraints */
|
||||
cups_array_t *resolvers; /* Job resolvers */
|
||||
cups_array_t *localizations; /* Localization information */
|
||||
cups_array_t *media_db; /* Media database */
|
||||
_cups_media_db_t min_size, /* Minimum size */
|
||||
|
||||
+26
-23
@@ -52,10 +52,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 1.0599
|
||||
# define CUPS_VERSION 1.0602
|
||||
# define CUPS_VERSION_MAJOR 1
|
||||
# define CUPS_VERSION_MINOR 6
|
||||
# define CUPS_VERSION_PATCH -1
|
||||
# define CUPS_VERSION_PATCH 2
|
||||
|
||||
# define CUPS_BC_FD 3
|
||||
/* Back-channel file descriptor for
|
||||
@@ -230,20 +230,20 @@ enum cups_ptype_e /* Printer type/capability bit
|
||||
CUPS_PRINTER_FAX = 0x40000, /* Fax queue */
|
||||
CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */
|
||||
CUPS_PRINTER_DELETE = 0x100000, /* Delete printer
|
||||
* @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
* @since CUPS 1.2/OS X 10.5@ */
|
||||
CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared
|
||||
* @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
* @since CUPS 1.2/OS X 10.5@ */
|
||||
CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication
|
||||
* @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
* @since CUPS 1.2/OS X 10.5@ */
|
||||
CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands
|
||||
* @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
* @since CUPS 1.2/OS X 10.5@ */
|
||||
CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered
|
||||
* and added @private@
|
||||
* @since Deprecated@ */
|
||||
CUPS_PRINTER_SCANNER = 0x2000000, /* Scanner-only device
|
||||
* @since CUPS 1.4/Mac OS X 10.6@ */
|
||||
* @since CUPS 1.4/OS X 10.6@ */
|
||||
CUPS_PRINTER_MFP = 0x4000000, /* Printer with scanning capabilities
|
||||
* @since CUPS 1.4/Mac OS X 10.6@ */
|
||||
* @since CUPS 1.4/OS X 10.6@ */
|
||||
CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT |
|
||||
* DEFAULT | FAX | REJECTING | DELETE |
|
||||
* NOT_SHARED | AUTHENTICATED |
|
||||
@@ -267,7 +267,7 @@ typedef struct cups_dest_s /**** Destination ****/
|
||||
|
||||
typedef struct _cups_dinfo_s cups_dinfo_t;
|
||||
/* Destination capability and status
|
||||
* information @since CUPS 1.6@ */
|
||||
* information @since CUPS 1.6/OS X 10.8@ */
|
||||
|
||||
typedef struct cups_job_s /**** Job ****/
|
||||
{
|
||||
@@ -284,7 +284,7 @@ typedef struct cups_job_s /**** Job ****/
|
||||
time_t processing_time; /* Time the job was processed */
|
||||
} cups_job_t;
|
||||
|
||||
typedef struct cups_size_s /**** Media Size @since CUPS 1.6@ ****/
|
||||
typedef struct cups_size_s /**** Media Size @since CUPS 1.6/OS X 10.8@ ****/
|
||||
{
|
||||
char media[128]; /* Media name to use */
|
||||
int width, /* Width in hundredths of millimeters */
|
||||
@@ -304,17 +304,17 @@ typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls,
|
||||
cups_array_t *distinguished_names,
|
||||
void *user_data);
|
||||
/* Client credentials callback
|
||||
* @since CUPS 1.5/Mac OS X 10.7@ */
|
||||
* @since CUPS 1.5/OS X 10.7@ */
|
||||
|
||||
typedef int (*cups_dest_cb_t)(void *user_data, unsigned flags,
|
||||
cups_dest_t *dest);
|
||||
/* Destination enumeration callback
|
||||
* @since CUPS 1.6@ */
|
||||
* @since CUPS 1.6/OS X 10.8@ */
|
||||
|
||||
# ifdef __BLOCKS__
|
||||
typedef int (^cups_dest_block_t)(unsigned flags, cups_dest_t *dest);
|
||||
/* Destination enumeration block
|
||||
* @since CUPS 1.6@ */
|
||||
* @since CUPS 1.6/OS X 10.8@ */
|
||||
# endif /* __BLOCKS__ */
|
||||
|
||||
typedef void (*cups_device_cb_t)(const char *device_class,
|
||||
@@ -323,7 +323,7 @@ typedef void (*cups_device_cb_t)(const char *device_class,
|
||||
const char *device_uri,
|
||||
const char *device_location, void *user_data);
|
||||
/* Device callback
|
||||
* @since CUPS 1.4/Mac OS X 10.6@ */
|
||||
* @since CUPS 1.4/OS X 10.6@ */
|
||||
|
||||
typedef const char *(*cups_password_cb_t)(const char *prompt);
|
||||
/* Password callback */
|
||||
@@ -333,12 +333,12 @@ typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http,
|
||||
const char *resource,
|
||||
void *user_data);
|
||||
/* New password callback
|
||||
* @since CUPS 1.4/Mac OS X 10.6@ */
|
||||
* @since CUPS 1.4/OS X 10.6@ */
|
||||
|
||||
typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls,
|
||||
cups_array_t *certs, void *user_data);
|
||||
/* Server credentials callback
|
||||
* @since CUPS 1.5/Mac OS X 10.7@ */
|
||||
* @since CUPS 1.5/OS X 10.7@ */
|
||||
|
||||
|
||||
/*
|
||||
@@ -429,7 +429,7 @@ extern int cupsPrintFiles2(http_t *http, const char *name,
|
||||
extern int cupsSetDests2(http_t *http, int num_dests,
|
||||
cups_dest_t *dests) _CUPS_API_1_1_21;
|
||||
|
||||
/**** New in CUPS 1.2/Mac OS X 10.5 ****/
|
||||
/**** New in CUPS 1.2/OS X 10.5 ****/
|
||||
extern ssize_t cupsBackChannelRead(char *buffer, size_t bytes,
|
||||
double timeout) _CUPS_API_1_2;
|
||||
extern ssize_t cupsBackChannelWrite(const char *buffer, size_t bytes,
|
||||
@@ -446,7 +446,7 @@ extern int cupsRemoveOption(const char *name, int num_options,
|
||||
cups_option_t **options) _CUPS_API_1_2;
|
||||
extern cups_file_t *cupsTempFile2(char *filename, int len) _CUPS_API_1_2;
|
||||
|
||||
/**** New in CUPS 1.3/Mac OS X 10.5 ****/
|
||||
/**** New in CUPS 1.3/OS X 10.5 ****/
|
||||
extern ipp_t *cupsDoIORequest(http_t *http, ipp_t *request,
|
||||
const char *resource, int infile,
|
||||
int outfile) _CUPS_API_1_3;
|
||||
@@ -461,7 +461,7 @@ extern void cupsSetDefaultDest(const char *name,
|
||||
int num_dests,
|
||||
cups_dest_t *dests) _CUPS_API_1_3;
|
||||
|
||||
/**** New in CUPS 1.4/Mac OS X 10.6 ****/
|
||||
/**** New in CUPS 1.4/OS X 10.6 ****/
|
||||
extern ipp_status_t cupsCancelJob2(http_t *http, const char *name,
|
||||
int job_id, int purge) _CUPS_API_1_4;
|
||||
extern int cupsCreateJob(http_t *http, const char *name,
|
||||
@@ -498,14 +498,14 @@ extern http_status_t cupsStartDocument(http_t *http, const char *name,
|
||||
extern http_status_t cupsWriteRequestData(http_t *http, const char *buffer,
|
||||
size_t length) _CUPS_API_1_4;
|
||||
|
||||
/**** New in CUPS 1.5 ****/
|
||||
/**** New in CUPS 1.5/OS X 10.7 ****/
|
||||
extern void cupsSetClientCertCB(cups_client_cert_cb_t cb,
|
||||
void *user_data) _CUPS_API_1_5;
|
||||
extern int cupsSetCredentials(cups_array_t *certs) _CUPS_API_1_5;
|
||||
extern void cupsSetServerCertCB(cups_server_cert_cb_t cb,
|
||||
void *user_data) _CUPS_API_1_5;
|
||||
|
||||
/**** New in CUPS 1.6 ****/
|
||||
/**** New in CUPS 1.6/OS X 10.8 ****/
|
||||
extern ipp_status_t cupsCancelDestJob(http_t *http, cups_dest_t *dest,
|
||||
int job_id) _CUPS_API_1_6;
|
||||
extern int cupsCheckDestSupported(http_t *http, cups_dest_t *dest,
|
||||
@@ -513,7 +513,8 @@ extern int cupsCheckDestSupported(http_t *http, cups_dest_t *dest,
|
||||
const char *option,
|
||||
const char *value) _CUPS_API_1_6;
|
||||
extern ipp_status_t cupsCloseDestJob(http_t *http, cups_dest_t *dest,
|
||||
int job_id) _CUPS_API_1_6;
|
||||
cups_dinfo_t *info, int job_id)
|
||||
_CUPS_API_1_6;
|
||||
extern http_t *cupsConnectDest(cups_dest_t *dest, unsigned flags,
|
||||
int msec, int *cancel,
|
||||
char *resource, size_t resourcesize,
|
||||
@@ -558,7 +559,9 @@ extern int cupsEnumDestsBlock(unsigned flags, int msec,
|
||||
_CUPS_API_1_6;
|
||||
# endif /* __BLOCKS__ */
|
||||
extern ipp_status_t cupsFinishDestDocument(http_t *http,
|
||||
cups_dest_t *dest) _CUPS_API_1_6;
|
||||
cups_dest_t *dest,
|
||||
cups_dinfo_t *info)
|
||||
_CUPS_API_1_6;
|
||||
extern void cupsFreeDestInfo(cups_dinfo_t *dinfo) _CUPS_API_1_6;
|
||||
extern int cupsGetDestMediaByName(http_t *http, cups_dest_t *dest,
|
||||
cups_dinfo_t *dinfo,
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* PPD custom option routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* 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
|
||||
@@ -41,7 +41,7 @@
|
||||
/*
|
||||
* 'ppdFindCustomOption()' - Find a custom option.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ppd_coption_t * /* O - Custom option or NULL */
|
||||
@@ -62,7 +62,7 @@ ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
|
||||
/*
|
||||
* 'ppdFindCustomParam()' - Find a parameter for a custom option.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
@@ -88,7 +88,7 @@ ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
|
||||
/*
|
||||
* 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
@@ -104,7 +104,7 @@ ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */
|
||||
/*
|
||||
* 'ppdNextCustomParam()' - Return the next parameter for a custom option.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
|
||||
+1
-11
@@ -45,8 +45,8 @@ _cups_gettimeofday(struct timeval *tv, /* I - Timeval struct */
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
# include <unistd.h>
|
||||
# include <regex.h>
|
||||
#endif /* WIN32 */
|
||||
#include <regex.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
@@ -65,10 +65,8 @@ int _cups_debug_level = 1;
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
# ifndef WIN32
|
||||
static regex_t *debug_filter = NULL;
|
||||
/* Filter expression for messages */
|
||||
# endif /* !WIN32 */
|
||||
static int debug_init = 0; /* Did we initialize debugging? */
|
||||
static _cups_mutex_t debug_mutex = _CUPS_MUTEX_INITIALIZER;
|
||||
/* Mutex to control initialization */
|
||||
@@ -455,7 +453,6 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
# ifndef WIN32
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
@@ -467,7 +464,6 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
# endif /* !WIN32 */
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
@@ -538,7 +534,6 @@ _cups_debug_puts(const char *s) /* I - String to output */
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
# ifndef WIN32
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
@@ -550,7 +545,6 @@ _cups_debug_puts(const char *s) /* I - String to output */
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
# endif /* !WIN32 */
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
@@ -606,13 +600,11 @@ _cups_debug_set(const char *logfile, /* I - Log file or NULL */
|
||||
_cups_debug_fd = -1;
|
||||
}
|
||||
|
||||
# ifndef WIN32
|
||||
if (debug_filter)
|
||||
{
|
||||
regfree((regex_t *)debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
# endif /* !WIN32 */
|
||||
|
||||
_cups_debug_level = 1;
|
||||
|
||||
@@ -639,7 +631,6 @@ _cups_debug_set(const char *logfile, /* I - Log file or NULL */
|
||||
if (level)
|
||||
_cups_debug_level = atoi(level);
|
||||
|
||||
# ifndef WIN32
|
||||
if (filter)
|
||||
{
|
||||
if ((debug_filter = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
|
||||
@@ -653,7 +644,6 @@ _cups_debug_set(const char *logfile, /* I - Log file or NULL */
|
||||
debug_filter = NULL;
|
||||
}
|
||||
}
|
||||
# endif /* !WIN32 */
|
||||
|
||||
debug_init = 1;
|
||||
}
|
||||
|
||||
+237
-24
@@ -37,7 +37,7 @@
|
||||
* Returns IPP_OK on success and IPP_NOT_AUTHORIZED or IPP_FORBIDDEN on
|
||||
* failure.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_status_t
|
||||
@@ -53,29 +53,94 @@ cupsCancelDestJob(http_t *http, /* I - Connection to destination */
|
||||
* 'cupsCloseDestJob()' - Close a job and start printing.
|
||||
*
|
||||
* Use when the last call to cupsStartDocument passed 0 for "last_document".
|
||||
* "job_id" is the job ID returned by cupsCreateDestJob. Returns IPP_OK on
|
||||
* success.
|
||||
* "job_id" is the job ID returned by cupsCreateDestJob. Returns @code IPP_OK@
|
||||
* on success.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_status_t
|
||||
ipp_status_t /* O - IPP status code */
|
||||
cupsCloseDestJob(
|
||||
http_t *http, /* I - Connection to destination */
|
||||
cups_dest_t *dest, /* I - Destination */
|
||||
int job_id) /* I - Job ID */
|
||||
http_t *http, /* I - Connection to destination */
|
||||
cups_dest_t *dest, /* I - Destination */
|
||||
cups_dinfo_t *info, /* I - Destination information */
|
||||
int job_id) /* I - Job ID */
|
||||
{
|
||||
return (IPP_NOT_FOUND);
|
||||
int i; /* Looping var */
|
||||
ipp_t *request = NULL;/* Close-Job/Send-Document request */
|
||||
ipp_attribute_t *attr; /* operations-supported attribute */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsCloseDestJob(http=%p, dest=%p(%s/%s), info=%p, job_id=%d)",
|
||||
http, dest, dest ? dest->name : NULL,
|
||||
dest ? dest->instance : NULL, info, job_id));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!http || !dest || !info || job_id <= 0)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
DEBUG_puts("1cupsCloseDestJob: Bad arguments.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a Close-Job or empty Send-Document request...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(info->attrs, "operations-supported",
|
||||
IPP_TAG_ENUM)) != NULL)
|
||||
{
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
if (attr->values[i].integer == IPP_CLOSE_JOB)
|
||||
{
|
||||
request = ippNewRequest(IPP_CLOSE_JOB);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!request)
|
||||
request = ippNewRequest(IPP_SEND_DOCUMENT);
|
||||
|
||||
if (!request)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
|
||||
DEBUG_puts("1cupsCloseDestJob: Unable to create Close-Job/Send-Document "
|
||||
"request.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, info->uri);
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
|
||||
job_id);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, cupsUser());
|
||||
if (ippGetOperation(request) == IPP_SEND_DOCUMENT)
|
||||
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);
|
||||
|
||||
/*
|
||||
* Send the request and return the status...
|
||||
*/
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, info->resource));
|
||||
|
||||
DEBUG_printf(("1cupsCloseDestJob: %s (%s)", ippErrorString(cupsLastError()),
|
||||
cupsLastErrorString()));
|
||||
|
||||
return (cupsLastError());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsCreateDestJob()' - Create a job on a destination.
|
||||
*
|
||||
* Returns IPP_OK or IPP_OK_SUBST on success, saving the job ID in the variable
|
||||
* pointed to by "job_id".
|
||||
* Returns @code IPP_OK@ or @code IPP_OK_SUBST@ on success, saving the job ID
|
||||
* in the variable pointed to by "job_id".
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_status_t /* O - IPP status code */
|
||||
@@ -88,26 +153,117 @@ cupsCreateDestJob(
|
||||
int num_options, /* I - Number of job options */
|
||||
cups_option_t *options) /* I - Job options */
|
||||
{
|
||||
*job_id = 0;
|
||||
ipp_t *request, /* Create-Job request */
|
||||
*response; /* Create-Job response */
|
||||
ipp_attribute_t *attr; /* job-id attribute */
|
||||
|
||||
return (IPP_NOT_POSSIBLE);
|
||||
|
||||
DEBUG_printf(("cupsCreateDestJob(http=%p, dest=%p(%s/%s), info=%p, "
|
||||
"job_id=%p, title=\"%s\", num_options=%d, options=%p)",
|
||||
http, dest, dest ? dest->name : NULL,
|
||||
dest ? dest->instance : NULL, info, job_id, title, num_options,
|
||||
options));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (job_id)
|
||||
*job_id = 0;
|
||||
|
||||
if (!http || !dest || !info || !job_id)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
DEBUG_puts("1cupsCreateDestJob: Bad arguments.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a Create-Job request...
|
||||
*/
|
||||
|
||||
if ((request = ippNewRequest(IPP_CREATE_JOB)) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
|
||||
DEBUG_puts("1cupsCreateDestJob: Unable to create Create-Job request.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, info->uri);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, cupsUser());
|
||||
if (title)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
|
||||
title);
|
||||
|
||||
cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB);
|
||||
cupsEncodeOptions2(request, num_options, options, IPP_TAG_SUBSCRIPTION);
|
||||
|
||||
/*
|
||||
* Send the request and get the job-id...
|
||||
*/
|
||||
|
||||
response = cupsDoRequest(http, request, info->resource);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) != NULL)
|
||||
{
|
||||
*job_id = attr->values[0].integer;
|
||||
DEBUG_printf(("1cupsCreateDestJob: job-id=%d", *job_id));
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
/*
|
||||
* Return the status code from the Create-Job request...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("1cupsCreateDestJob: %s (%s)", ippErrorString(cupsLastError()),
|
||||
cupsLastErrorString()));
|
||||
|
||||
return (cupsLastError());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsFinishDestDocument()' - Finish the current document.
|
||||
*
|
||||
* Returns IPP_OK on success.
|
||||
* Returns @code IPP_OK@ or @code IPP_OK_SUBST@ on success.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_status_t
|
||||
ipp_status_t /* O - Status of document submission */
|
||||
cupsFinishDestDocument(
|
||||
http_t *http, /* I - Connection to destination */
|
||||
cups_dest_t *dest) /* I - Destination */
|
||||
http_t *http, /* I - Connection to destination */
|
||||
cups_dest_t *dest, /* I - Destination */
|
||||
cups_dinfo_t *info) /* I - Destination information */
|
||||
{
|
||||
return (IPP_NOT_FOUND);
|
||||
DEBUG_printf(("cupsFinishDestDocument(http=%p, dest=%p(%s/%s), info=%p)",
|
||||
http, dest, dest ? dest->name : NULL,
|
||||
dest ? dest->instance : NULL, info));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!http || !dest || !info)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
DEBUG_puts("1cupsFinishDestDocument: Bad arguments.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the response at the end of the document and return it...
|
||||
*/
|
||||
|
||||
ippDelete(cupsGetResponse(http, info->resource));
|
||||
|
||||
DEBUG_printf(("1cupsFinishDestDocument: %s (%s)",
|
||||
ippErrorString(cupsLastError()), cupsLastErrorString()));
|
||||
|
||||
return (cupsLastError());
|
||||
}
|
||||
|
||||
|
||||
@@ -119,12 +275,12 @@ cupsFinishDestDocument(
|
||||
* document (see CUPS_FORMAT_xxx constants), and "num_options" and "options"
|
||||
* are the options do be applied to the document. "last_document" should be 1
|
||||
* if this is the last document to be submitted in the job. Returns
|
||||
* HTTP_CONTINUE on success.
|
||||
* @code HTTP_CONTINUE@ on success.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
http_status_t
|
||||
http_status_t /* O - Status of document creation */
|
||||
cupsStartDestDocument(
|
||||
http_t *http, /* I - Connection to destination */
|
||||
cups_dest_t *dest, /* I - Destination */
|
||||
@@ -136,7 +292,64 @@ cupsStartDestDocument(
|
||||
cups_option_t *options, /* I - Document options */
|
||||
int last_document) /* I - 1 if this is the last document */
|
||||
{
|
||||
return (HTTP_CONTINUE);
|
||||
ipp_t *request; /* Send-Document request */
|
||||
http_status_t status; /* HTTP status */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsStartDestDocument(http=%p, dest=%p(%s/%s), info=%p, "
|
||||
"job_id=%d, docname=\"%s\", format=\"%s\", num_options=%d, "
|
||||
"options=%p, last_document=%d)",
|
||||
http, dest, dest ? dest->name : NULL,
|
||||
dest ? dest->instance : NULL, info, job_id, docname, format,
|
||||
num_options, options, last_document));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!http || !dest || !info || job_id <= 0)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
DEBUG_puts("1cupsStartDestDocument: Bad arguments.");
|
||||
return (HTTP_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a Send-Document request...
|
||||
*/
|
||||
|
||||
if ((request = ippNewRequest(IPP_SEND_DOCUMENT)) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
|
||||
DEBUG_puts("1cupsStartDestDocument: Unable to create Send-Document "
|
||||
"request.");
|
||||
return (HTTP_ERROR);
|
||||
}
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, info->uri);
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job_id);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, cupsUser());
|
||||
if (docname)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-name",
|
||||
NULL, docname);
|
||||
if (format)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
|
||||
"document-format", NULL, format);
|
||||
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", last_document);
|
||||
|
||||
cupsEncodeOptions2(request, num_options, options, IPP_TAG_DOCUMENT);
|
||||
|
||||
/*
|
||||
* Send and delete the request, then return the status...
|
||||
*/
|
||||
|
||||
status = cupsSendRequest(http, request, info->resource, CUPS_LENGTH_VARIABLE);
|
||||
|
||||
ippDelete(request);
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+322
-12
@@ -15,10 +15,14 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsLocalizeDestOption() - Get the localized string for a destination
|
||||
* option.
|
||||
* cupsLocalizeDestValue() - Get the localized string for a destination
|
||||
* option+value pair.
|
||||
* cupsLocalizeDestOption() - Get the localized string for a destination
|
||||
* option.
|
||||
* cupsLocalizeDestValue() - Get the localized string for a destination
|
||||
* option+value pair.
|
||||
* cups_create_localizations() - Create the localizations array for a
|
||||
* destination.
|
||||
* cups_read_strings() - Read a pair of strings from a .strings file.
|
||||
* cups_scan_strings() - Scan a quoted string.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -28,14 +32,24 @@
|
||||
#include "cups-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void cups_create_localizations(http_t *http, cups_dinfo_t *dinfo);
|
||||
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);
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsLocalizeDestOption()' - Get the localized string for a destination
|
||||
* option.
|
||||
*
|
||||
* The returned string is stored in the localization array and will become
|
||||
* invalid if the localization array is deleted.
|
||||
* The returned string is stored in the destination information and will become
|
||||
* invalid if the destination information is deleted.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
const char * /* O - Localized string */
|
||||
@@ -45,7 +59,25 @@ cupsLocalizeDestOption(
|
||||
cups_dinfo_t *dinfo, /* I - Destination information */
|
||||
const char *option) /* I - Option to localize */
|
||||
{
|
||||
return (option);
|
||||
_cups_message_t key, /* Search key */
|
||||
*match; /* Matching entry */
|
||||
|
||||
|
||||
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
|
||||
return (option);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,10 +85,10 @@ cupsLocalizeDestOption(
|
||||
* 'cupsLocalizeDestValue()' - Get the localized string for a destination
|
||||
* option+value pair.
|
||||
*
|
||||
* The returned string is stored in the localization array and will become
|
||||
* invalid if the localization array is deleted.
|
||||
* The returned string is stored in the destination information and will become
|
||||
* invalid if the destination information is deleted.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
const char * /* O - Localized string */
|
||||
@@ -67,10 +99,288 @@ cupsLocalizeDestValue(
|
||||
const char *option, /* I - Option to localize */
|
||||
const char *value) /* I - Value to localize */
|
||||
{
|
||||
return (value);
|
||||
_cups_message_t key, /* Search key */
|
||||
*match; /* Matching entry */
|
||||
char pair[256]; /* option.value pair */
|
||||
|
||||
|
||||
if (!http || !dest || !dinfo)
|
||||
return (value);
|
||||
|
||||
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
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_create_localizations()' - Create the localizations array for a
|
||||
* destination.
|
||||
*/
|
||||
|
||||
static void
|
||||
cups_create_localizations(
|
||||
http_t *http, /* I - Connection to destination */
|
||||
cups_dinfo_t *dinfo) /* I - Destination informations */
|
||||
{
|
||||
http_t *http2; /* Connection for strings file */
|
||||
http_status_t status; /* Request status */
|
||||
ipp_attribute_t *attr; /* "printer-strings-uri" attribute */
|
||||
char scheme[32], /* URI scheme */
|
||||
userpass[256], /* Username/password info */
|
||||
hostname[256], /* Hostname */
|
||||
resource[1024], /* Resource */
|
||||
http_hostname[256],
|
||||
/* Hostname of connection */
|
||||
tempfile[1024]; /* Temporary filename */
|
||||
int port; /* Port number */
|
||||
http_encryption_t encryption; /* Encryption to use */
|
||||
cups_file_t *temp; /* Temporary file */
|
||||
|
||||
|
||||
/*
|
||||
* Create an empty message catalog...
|
||||
*/
|
||||
|
||||
dinfo->localizations = _cupsMessageNew(NULL);
|
||||
|
||||
/*
|
||||
* See if there are any localizations...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(dinfo->attrs, "printer-strings-uri",
|
||||
IPP_TAG_URI)) == NULL)
|
||||
{
|
||||
/*
|
||||
* Nope...
|
||||
*/
|
||||
|
||||
DEBUG_puts("4cups_create_localizations: No printer-strings-uri (uri) "
|
||||
"value.");
|
||||
return; /* Nope */
|
||||
}
|
||||
|
||||
/*
|
||||
* Pull apart the URI and determine whether we need to try a different
|
||||
* server...
|
||||
*/
|
||||
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[0].string.text,
|
||||
scheme, sizeof(scheme), userpass, sizeof(userpass),
|
||||
hostname, sizeof(hostname), &port, resource,
|
||||
sizeof(resource)) < HTTP_URI_OK)
|
||||
{
|
||||
DEBUG_printf(("4cups_create_localizations: Bad printer-strings-uri value "
|
||||
"\"%s\".", attr->values[0].string.text));
|
||||
return;
|
||||
}
|
||||
|
||||
httpGetHostname(http, http_hostname, sizeof(http_hostname));
|
||||
|
||||
if (!_cups_strcasecmp(http_hostname, hostname) &&
|
||||
port == _httpAddrPort(http->hostaddr))
|
||||
{
|
||||
/*
|
||||
* Use the same connection...
|
||||
*/
|
||||
|
||||
http2 = http;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Connect to the alternate host...
|
||||
*/
|
||||
|
||||
if (!strcmp(scheme, "https"))
|
||||
encryption = HTTP_ENCRYPT_ALWAYS;
|
||||
else
|
||||
encryption = HTTP_ENCRYPT_IF_REQUESTED;
|
||||
|
||||
if ((http2 = httpConnectEncrypt(hostname, port, encryption)) == NULL)
|
||||
{
|
||||
DEBUG_printf(("4cups_create_localizations: Unable to connect to "
|
||||
"%s:%d: %s", hostname, port, cupsLastErrorString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a temporary file...
|
||||
*/
|
||||
|
||||
if ((temp = cupsTempFile2(tempfile, sizeof(tempfile))) == NULL)
|
||||
{
|
||||
DEBUG_printf(("4cups_create_localizations: Unable to create temporary "
|
||||
"file: %s", cupsLastErrorString()));
|
||||
if (http2 != http)
|
||||
httpClose(http2);
|
||||
return;
|
||||
}
|
||||
|
||||
status = cupsGetFd(http2, resource, cupsFileNumber(temp));
|
||||
|
||||
DEBUG_printf(("4cups_create_localizations: GET %s = %s", resource,
|
||||
httpStatus(status)));
|
||||
|
||||
if (status == HTTP_OK)
|
||||
{
|
||||
/*
|
||||
* Got the file, read it...
|
||||
*/
|
||||
|
||||
char buffer[8192], /* Message buffer */
|
||||
*id, /* ID string */
|
||||
*str; /* Translated message */
|
||||
_cups_message_t *m; /* Current message */
|
||||
|
||||
lseek(cupsFileNumber(temp), 0, SEEK_SET);
|
||||
|
||||
while (cups_read_strings(temp, 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(dinfo->localizations, m);
|
||||
else
|
||||
{
|
||||
if (m->id)
|
||||
free(m->id);
|
||||
|
||||
if (m->str)
|
||||
free(m->str);
|
||||
|
||||
free(m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_printf(("4cups_create_localizations: %d messages loaded.",
|
||||
cupsArrayCount(dinfo->localizations)));
|
||||
|
||||
/*
|
||||
* Cleanup...
|
||||
*/
|
||||
|
||||
unlink(tempfile);
|
||||
cupsFileClose(temp);
|
||||
|
||||
if (http2 != http)
|
||||
httpClose(http2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '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 = ((((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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
+651
-52
@@ -15,23 +15,28 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsCheckDestSupported() - Check that the option and value are supported
|
||||
* by the destination.
|
||||
* cupsCopyDestConflicts() - Get conflicts and resolutions for a new
|
||||
* option/value pair.
|
||||
* cupsCopyDestInfo() - Get the supported values/capabilities for the
|
||||
* destination.
|
||||
* cupsFreeDestInfo() - Free destination information obtained using
|
||||
* @link cupsCopyDestInfo@.
|
||||
* cupsGetDestMediaByName() - Get media names, dimensions, and margins.
|
||||
* cupsGetDestMediaBySize() - Get media names, dimensions, and margins.
|
||||
* cups_compare_media_db() - Compare two media entries.
|
||||
* cups_copy_media_db() - Copy a media entry.
|
||||
* cups_create_media_db() - Create the media database.
|
||||
* cups_free_media_cb() - Free a media entry.
|
||||
* cups_get_media_db() - Lookup the media entry for a given size.
|
||||
* cups_is_close_media_db() - Compare two media entries to see if they are
|
||||
* close to the same size.
|
||||
* cupsCheckDestSupported() - Check that the option and value are supported
|
||||
* by the destination.
|
||||
* cupsCopyDestConflicts() - Get conflicts and resolutions for a new
|
||||
* option/value pair.
|
||||
* cupsCopyDestInfo() - Get the supported values/capabilities for the
|
||||
* destination.
|
||||
* cupsFreeDestInfo() - Free destination information obtained using
|
||||
* @link cupsCopyDestInfo@.
|
||||
* cupsGetDestMediaByName() - Get media names, dimensions, and margins.
|
||||
* cupsGetDestMediaBySize() - Get media names, dimensions, and margins.
|
||||
* cups_add_dconstres() - Add a constraint or resolver to an array.
|
||||
* cups_compare_dconstres() - Compare to resolver entries.
|
||||
* cups_compare_media_db() - Compare two media entries.
|
||||
* cups_copy_media_db() - Copy a media entry.
|
||||
* cups_create_constraints() - Create the constraints and resolvers arrays.
|
||||
* cups_create_defaults() - Create the -default option array.
|
||||
* cups_create_media_db() - Create the media database.
|
||||
* cups_free_media_cb() - Free a media entry.
|
||||
* cups_get_media_db() - Lookup the media entry for a given size.
|
||||
* cups_is_close_media_db() - Compare two media entries to see if they are
|
||||
* close to the same size.
|
||||
* cups_test_constraints() - Test constraints.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -45,9 +50,14 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void cups_add_dconstres(cups_array_t *a, ipp_t *collection);
|
||||
static int cups_compare_dconstres(_cups_dconstres_t *a,
|
||||
_cups_dconstres_t *b);
|
||||
static int cups_compare_media_db(_cups_media_db_t *a,
|
||||
_cups_media_db_t *b);
|
||||
static _cups_media_db_t *cups_copy_media_db(_cups_media_db_t *mdb);
|
||||
static void cups_create_constraints(cups_dinfo_t *dinfo);
|
||||
static void cups_create_defaults(cups_dinfo_t *dinfo);
|
||||
static void cups_create_media_db(cups_dinfo_t *dinfo);
|
||||
static void cups_free_media_db(_cups_media_db_t *mdb);
|
||||
static int cups_get_media_db(cups_dinfo_t *dinfo,
|
||||
@@ -55,6 +65,14 @@ static int cups_get_media_db(cups_dinfo_t *dinfo,
|
||||
cups_size_t *size);
|
||||
static int cups_is_close_media_db(_cups_media_db_t *a,
|
||||
_cups_media_db_t *b);
|
||||
static cups_array_t *cups_test_constraints(cups_dinfo_t *dinfo,
|
||||
const char *new_option,
|
||||
const char *new_value,
|
||||
int num_options,
|
||||
cups_option_t *options,
|
||||
int *num_conflicts,
|
||||
cups_option_t **conflicts);
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsCheckDestSupported()' - Check that the option and value are supported
|
||||
@@ -62,7 +80,7 @@ static int cups_is_close_media_db(_cups_media_db_t *a,
|
||||
*
|
||||
* Returns 1 if supported, 0 otherwise.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 if supported, 0 otherwise */
|
||||
@@ -176,6 +194,15 @@ cupsCheckDestSupported(
|
||||
case IPP_TAG_BOOLEAN :
|
||||
return (attr->values[0].boolean);
|
||||
|
||||
case IPP_TAG_RANGE :
|
||||
int_value = atoi(value);
|
||||
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
if (int_value >= attr->values[i].range.lower &&
|
||||
int_value <= attr->values[i].range.upper)
|
||||
return (1);
|
||||
break;
|
||||
|
||||
case IPP_TAG_RESOLUTION :
|
||||
if (sscanf(value, "%dx%d%15s", &xres_value, &yres_value, temp) != 3)
|
||||
{
|
||||
@@ -187,7 +214,7 @@ cupsCheckDestSupported(
|
||||
|
||||
if (!strcmp(temp, "dpi"))
|
||||
units_value = IPP_RES_PER_INCH;
|
||||
else if (!strcmp(temp, "dpc"))
|
||||
else if (!strcmp(temp, "dpc") || !strcmp(temp, "dpcm"))
|
||||
units_value = IPP_RES_PER_CM;
|
||||
else
|
||||
return (0);
|
||||
@@ -239,20 +266,21 @@ cupsCheckDestSupported(
|
||||
* user. "new_option" and "new_value" are the setting the user has just
|
||||
* changed.
|
||||
*
|
||||
* Returns 1 if there is a conflict and 0 otherwise.
|
||||
* Returns 1 if there is a conflict, 0 if there are no conflicts, and -1 if
|
||||
* there was an unrecoverable error such as a resolver loop.
|
||||
*
|
||||
* If "num_conflicts" and "conflicts" are not NULL, they are set to contain the
|
||||
* list of conflicting option/value pairs. Similarly, if "num_resolved" and
|
||||
* "resolved" are not NULL they will be set to the list of changes needed to
|
||||
* resolve the conflict.
|
||||
* If "num_conflicts" and "conflicts" are not @code NULL@, they are set to
|
||||
* contain the list of conflicting option/value pairs. Similarly, if
|
||||
* "num_resolved" and "resolved" are not @code NULL@ they will be set to the
|
||||
* list of changes needed to resolve the conflict.
|
||||
*
|
||||
* If cupsCopyDestConflicts returns 1 but "num_resolved" and "resolved" are set
|
||||
* to 0 and NULL, respectively, then the conflict cannot be resolved.
|
||||
* to 0 and @code NULL@, respectively, then the conflict cannot be resolved.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 if there is a conflict */
|
||||
int /* O - 1 if there is a conflict, 0 if none, -1 on error */
|
||||
cupsCopyDestConflicts(
|
||||
http_t *http, /* I - Connection to destination */
|
||||
cups_dest_t *dest, /* I - Destination */
|
||||
@@ -266,6 +294,27 @@ cupsCopyDestConflicts(
|
||||
int *num_resolved, /* O - Number of options to resolve */
|
||||
cups_option_t **resolved) /* O - Resolved options */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
have_conflicts = 0, /* Do we have conflicts? */
|
||||
changed, /* Did we change something? */
|
||||
tries, /* Number of tries for resolution */
|
||||
num_myconf = 0, /* My number of conflicting options */
|
||||
num_myres = 0; /* My number of resolved options */
|
||||
cups_option_t *myconf = NULL, /* My conflicting options */
|
||||
*myres = NULL, /* My resolved options */
|
||||
*myoption, /* My current option */
|
||||
*option; /* Current option */
|
||||
cups_array_t *active, /* Active conflicts */
|
||||
*pass = NULL, /* Resolvers for this pass */
|
||||
*resolvers = NULL, /* Resolvers we have used */
|
||||
*test; /* Test array for conflicts */
|
||||
_cups_dconstres_t *c, /* Current constraint */
|
||||
*r; /* Current resolver */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
char value[2048]; /* Current attribute value as string */
|
||||
const char *myvalue; /* Current value of an option */
|
||||
|
||||
|
||||
/*
|
||||
* Clear returned values...
|
||||
*/
|
||||
@@ -286,18 +335,223 @@ cupsCopyDestConflicts(
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!http || !dest || !dinfo || !new_option || !new_value ||
|
||||
if (!http || !dest || !dinfo ||
|
||||
(num_conflicts != NULL) != (conflicts != NULL) ||
|
||||
(num_resolved != NULL) != (resolved != NULL))
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Check for an resolve any conflicts...
|
||||
* Load constraints as needed...
|
||||
*/
|
||||
|
||||
/* TODO: implement me! */
|
||||
if (!dinfo->constraints)
|
||||
cups_create_constraints(dinfo);
|
||||
|
||||
return (0);
|
||||
if (cupsArrayCount(dinfo->constraints) == 0)
|
||||
return (0);
|
||||
|
||||
if (!dinfo->num_defaults)
|
||||
cups_create_defaults(dinfo);
|
||||
|
||||
/*
|
||||
* If we are resolving, create a shadow array...
|
||||
*/
|
||||
|
||||
if (num_resolved)
|
||||
{
|
||||
for (i = num_options, option = options; i > 0; i --, option ++)
|
||||
num_myres = cupsAddOption(option->name, option->value, num_myres, &myres);
|
||||
|
||||
if (new_option && new_value)
|
||||
num_myres = cupsAddOption(new_option, new_value, num_myres, &myres);
|
||||
}
|
||||
else
|
||||
{
|
||||
num_myres = num_options;
|
||||
myres = options;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for any conflicts...
|
||||
*/
|
||||
|
||||
if (num_resolved)
|
||||
pass = cupsArrayNew((cups_array_func_t)cups_compare_dconstres, NULL);
|
||||
|
||||
for (tries = 0; tries < 100; tries ++)
|
||||
{
|
||||
/*
|
||||
* Check for any conflicts...
|
||||
*/
|
||||
|
||||
if (num_conflicts || num_resolved)
|
||||
{
|
||||
cupsFreeOptions(num_myconf, myconf);
|
||||
|
||||
num_myconf = 0;
|
||||
myconf = NULL;
|
||||
active = cups_test_constraints(dinfo, new_option, new_value,
|
||||
num_myres, myres, &num_myconf,
|
||||
&myconf);
|
||||
}
|
||||
else
|
||||
active = cups_test_constraints(dinfo, new_option, new_value, num_myres,
|
||||
myres, NULL, NULL);
|
||||
|
||||
have_conflicts = (active != NULL);
|
||||
|
||||
if (!active || !num_resolved)
|
||||
break; /* All done */
|
||||
|
||||
/*
|
||||
* Scan the constraints that were triggered to apply resolvers...
|
||||
*/
|
||||
|
||||
if (!resolvers)
|
||||
resolvers = cupsArrayNew((cups_array_func_t)cups_compare_dconstres, NULL);
|
||||
|
||||
for (c = (_cups_dconstres_t *)cupsArrayFirst(active), changed = 0;
|
||||
c;
|
||||
c = (_cups_dconstres_t *)cupsArrayNext(active))
|
||||
{
|
||||
if (cupsArrayFind(pass, c))
|
||||
continue; /* Already applied this resolver... */
|
||||
|
||||
if (cupsArrayFind(resolvers, c))
|
||||
{
|
||||
DEBUG_printf(("1cupsCopyDestConflicts: Resolver loop with %s.",
|
||||
c->name));
|
||||
have_conflicts = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((r = cupsArrayFind(dinfo->resolvers, c)) == NULL)
|
||||
{
|
||||
DEBUG_printf(("1cupsCopyDestConflicts: Resolver %s not found.",
|
||||
c->name));
|
||||
have_conflicts = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the options from the resolver...
|
||||
*/
|
||||
|
||||
cupsArrayAdd(pass, r);
|
||||
cupsArrayAdd(resolvers, r);
|
||||
|
||||
for (attr = ippFirstAttribute(r->collection);
|
||||
attr;
|
||||
attr = ippNextAttribute(r->collection))
|
||||
{
|
||||
if (new_option && !strcmp(attr->name, new_option))
|
||||
continue; /* Ignore this if we just changed it */
|
||||
|
||||
if (ippAttributeString(attr, value, sizeof(value)) >= sizeof(value))
|
||||
continue; /* Ignore if the value is too long */
|
||||
|
||||
if ((test = cups_test_constraints(dinfo, attr->name, value, num_myres,
|
||||
myres, NULL, NULL)) == NULL)
|
||||
{
|
||||
/*
|
||||
* That worked, flag it...
|
||||
*/
|
||||
|
||||
changed = 1;
|
||||
}
|
||||
else
|
||||
cupsArrayDelete(test);
|
||||
|
||||
/*
|
||||
* Add the option/value from the resolver regardless of whether it
|
||||
* worked; this makes sure that we can cascade several changes to
|
||||
* make things resolve...
|
||||
*/
|
||||
|
||||
num_myres = cupsAddOption(attr->name, value, num_myres, &myres);
|
||||
}
|
||||
}
|
||||
|
||||
if (!changed)
|
||||
{
|
||||
DEBUG_puts("1cupsCopyDestConflicts: Unable to resolve constraints.");
|
||||
have_conflicts = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cupsArrayClear(pass);
|
||||
|
||||
cupsArrayDelete(active);
|
||||
active = NULL;
|
||||
}
|
||||
|
||||
if (tries >= 100)
|
||||
{
|
||||
DEBUG_puts("1cupsCopyDestConflicts: Unable to resolve after 100 tries.");
|
||||
have_conflicts = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy resolved options as needed...
|
||||
*/
|
||||
|
||||
if (num_resolved)
|
||||
{
|
||||
for (i = num_myres, myoption = myres; i > 0; i --, myoption ++)
|
||||
{
|
||||
if ((myvalue = cupsGetOption(myoption->name, num_options,
|
||||
options)) == NULL ||
|
||||
strcmp(myvalue, myoption->value))
|
||||
{
|
||||
if (new_option && !strcmp(new_option, myoption->name) &&
|
||||
new_value && !strcmp(new_value, myoption->value))
|
||||
continue;
|
||||
|
||||
*num_resolved = cupsAddOption(myoption->name, myoption->value,
|
||||
*num_resolved, resolved);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up...
|
||||
*/
|
||||
|
||||
cleanup:
|
||||
|
||||
cupsArrayDelete(active);
|
||||
cupsArrayDelete(pass);
|
||||
cupsArrayDelete(resolvers);
|
||||
|
||||
if (num_resolved)
|
||||
{
|
||||
/*
|
||||
* Free shadow copy of options...
|
||||
*/
|
||||
|
||||
cupsFreeOptions(num_myres, myres);
|
||||
}
|
||||
|
||||
if (num_conflicts)
|
||||
{
|
||||
/*
|
||||
* Return conflicting options to caller...
|
||||
*/
|
||||
|
||||
*num_conflicts = num_myconf;
|
||||
*conflicts = myconf;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Free conflicting options...
|
||||
*/
|
||||
|
||||
cupsFreeOptions(num_myconf, myconf);
|
||||
}
|
||||
|
||||
return (have_conflicts);
|
||||
}
|
||||
|
||||
|
||||
@@ -308,7 +562,7 @@ cupsCopyDestConflicts(
|
||||
* The caller is responsible for calling @link cupsFreeDestInfo@ on the return
|
||||
* value. @code NULL@ is returned on error.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
cups_dinfo_t * /* O - Destination information */
|
||||
@@ -319,6 +573,9 @@ cupsCopyDestInfo(
|
||||
cups_dinfo_t *dinfo; /* Destination information */
|
||||
ipp_t *request, /* Get-Printer-Attributes request */
|
||||
*response; /* Supported attributes */
|
||||
int tries, /* Number of tries so far */
|
||||
delay, /* Current retry delay */
|
||||
prev_delay; /* Next retry delay */
|
||||
const char *uri; /* Printer URI */
|
||||
char resource[1024]; /* Resource path */
|
||||
int version; /* IPP version */
|
||||
@@ -352,7 +609,10 @@ cupsCopyDestInfo(
|
||||
* Get the supported attributes...
|
||||
*/
|
||||
|
||||
version = 20;
|
||||
delay = 1;
|
||||
prev_delay = 1;
|
||||
tries = 0;
|
||||
version = 20;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -383,11 +643,22 @@ cupsCopyDestInfo(
|
||||
|
||||
if (status == IPP_VERSION_NOT_SUPPORTED && version > 11)
|
||||
version = 11;
|
||||
else if (status == IPP_PRINTER_BUSY)
|
||||
{
|
||||
sleep(delay);
|
||||
|
||||
delay = _cupsNextDelay(delay, &prev_delay);
|
||||
}
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
tries ++;
|
||||
}
|
||||
while (!response);
|
||||
while (!response && tries < 10);
|
||||
|
||||
if (!response)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Allocate a cups_dinfo_t structure and return it...
|
||||
@@ -429,14 +700,15 @@ cupsFreeDestInfo(cups_dinfo_t *dinfo) /* I - Destination information */
|
||||
|
||||
_cupsStrFree(dinfo->resource);
|
||||
|
||||
ippDelete(dinfo->attrs);
|
||||
|
||||
cupsArrayDelete(dinfo->constraints);
|
||||
cupsArrayDelete(dinfo->resolvers);
|
||||
|
||||
cupsArrayDelete(dinfo->localizations);
|
||||
|
||||
cupsArrayDelete(dinfo->media_db);
|
||||
|
||||
ippDelete(dinfo->attrs);
|
||||
|
||||
free(dinfo);
|
||||
}
|
||||
|
||||
@@ -444,14 +716,13 @@ cupsFreeDestInfo(cups_dinfo_t *dinfo) /* I - Destination information */
|
||||
/*
|
||||
* 'cupsGetDestMediaByName()' - Get media names, dimensions, and margins.
|
||||
*
|
||||
* The "media" string is a PWG media name, while "width" and "length" are the
|
||||
* dimensions in hundredths of millimeters. "flags" provides some matching
|
||||
* The "media" string is a PWG media name. "Flags" provides some matching
|
||||
* guidance (multiple flags can be combined):
|
||||
*
|
||||
* CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer
|
||||
* CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size
|
||||
* CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with 2-sided printing
|
||||
* CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size
|
||||
* CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer,
|
||||
* CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
|
||||
* CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with 2-sided printing,
|
||||
* CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and
|
||||
* CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the
|
||||
* size amongst the "ready" media.
|
||||
*
|
||||
@@ -459,7 +730,7 @@ cupsFreeDestInfo(cups_dinfo_t *dinfo) /* I - Destination information */
|
||||
*
|
||||
* Returns 1 when there is a match and 0 if there is not a match.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on match, 0 on failure */
|
||||
@@ -510,14 +781,13 @@ cupsGetDestMediaByName(
|
||||
/*
|
||||
* 'cupsGetDestMediaBySize()' - Get media names, dimensions, and margins.
|
||||
*
|
||||
* The "media" string is a PWG media name, while "width" and "length" are the
|
||||
* dimensions in hundredths of millimeters. "flags" provides some matching
|
||||
* guidance (multiple flags can be combined):
|
||||
* "Width" and "length" are the dimensions in hundredths of millimeters.
|
||||
* "Flags" provides some matching guidance (multiple flags can be combined):
|
||||
*
|
||||
* CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer
|
||||
* CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size
|
||||
* CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with 2-sided printing
|
||||
* CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size
|
||||
* CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer,
|
||||
* CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
|
||||
* CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with 2-sided printing,
|
||||
* CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and
|
||||
* CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the
|
||||
* size amongst the "ready" media.
|
||||
*
|
||||
@@ -525,7 +795,7 @@ cupsGetDestMediaByName(
|
||||
*
|
||||
* Returns 1 when there is a match and 0 if there is not a match.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on match, 0 on failure */
|
||||
@@ -576,6 +846,46 @@ cupsGetDestMediaBySize(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_add_dconstres()' - Add a constraint or resolver to an array.
|
||||
*/
|
||||
|
||||
static void
|
||||
cups_add_dconstres(
|
||||
cups_array_t *a, /* I - Array */
|
||||
ipp_t *collection) /* I - Collection value */
|
||||
{
|
||||
ipp_attribute_t *attr; /* Attribute */
|
||||
_cups_dconstres_t *temp; /* Current constraint/resolver */
|
||||
|
||||
|
||||
if ((attr = ippFindAttribute(collection, "resolver-name",
|
||||
IPP_TAG_NAME)) == NULL)
|
||||
return;
|
||||
|
||||
if ((temp = calloc(1, sizeof(_cups_dconstres_t))) == NULL)
|
||||
return;
|
||||
|
||||
temp->name = attr->values[0].string.text;
|
||||
temp->collection = collection;
|
||||
|
||||
cupsArrayAdd(a, temp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_compare_dconstres()' - Compare to resolver entries.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
cups_compare_dconstres(
|
||||
_cups_dconstres_t *a, /* I - First resolver */
|
||||
_cups_dconstres_t *b) /* I - Second resolver */
|
||||
{
|
||||
return (strcmp(a->name, b->name));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_compare_media_db()' - Compare two media entries.
|
||||
*/
|
||||
@@ -633,6 +943,93 @@ cups_copy_media_db(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_create_constraints()' - Create the constraints and resolvers arrays.
|
||||
*/
|
||||
|
||||
static void
|
||||
cups_create_constraints(
|
||||
cups_dinfo_t *dinfo) /* I - Destination information */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ipp_attribute_t *attr; /* Attribute */
|
||||
_ipp_value_t *val; /* Current value */
|
||||
|
||||
|
||||
dinfo->constraints = cupsArrayNew3(NULL, NULL, NULL, 0, NULL,
|
||||
(cups_afree_func_t)free);
|
||||
dinfo->resolvers = cupsArrayNew3((cups_array_func_t)cups_compare_dconstres,
|
||||
NULL, NULL, 0, NULL,
|
||||
(cups_afree_func_t)free);
|
||||
|
||||
if ((attr = ippFindAttribute(dinfo->attrs, "job-constraints-supported",
|
||||
IPP_TAG_BEGIN_COLLECTION)) != NULL)
|
||||
{
|
||||
for (i = attr->num_values, val = attr->values; i > 0; i --, val ++)
|
||||
cups_add_dconstres(dinfo->constraints, val->collection);
|
||||
}
|
||||
|
||||
if ((attr = ippFindAttribute(dinfo->attrs, "job-resolvers-supported",
|
||||
IPP_TAG_BEGIN_COLLECTION)) != NULL)
|
||||
{
|
||||
for (i = attr->num_values, val = attr->values; i > 0; i --, val ++)
|
||||
cups_add_dconstres(dinfo->resolvers, val->collection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_create_defaults()' - Create the -default option array.
|
||||
*
|
||||
* TODO: Need to support collection defaults...
|
||||
*/
|
||||
|
||||
static void
|
||||
cups_create_defaults(
|
||||
cups_dinfo_t *dinfo) /* I - Destination information */
|
||||
{
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
char name[IPP_MAX_NAME + 1],
|
||||
/* Current name */
|
||||
*nameptr, /* Pointer into current name */
|
||||
value[2048]; /* Current value */
|
||||
|
||||
|
||||
/*
|
||||
* Iterate through the printer attributes looking for xxx-default and adding
|
||||
* xxx=value to the defaults option array.
|
||||
*/
|
||||
|
||||
for (attr = ippFirstAttribute(dinfo->attrs);
|
||||
attr;
|
||||
attr = ippNextAttribute(dinfo->attrs))
|
||||
{
|
||||
if (!attr->name || attr->group_tag != IPP_TAG_PRINTER)
|
||||
continue;
|
||||
|
||||
if (attr->value_tag == IPP_TAG_BEGIN_COLLECTION)
|
||||
continue; /* TODO: STR #4096 */
|
||||
|
||||
if ((nameptr = attr->name + strlen(attr->name) - 8) <= attr->name ||
|
||||
strcmp(nameptr, "-default"))
|
||||
continue;
|
||||
|
||||
strlcpy(name, attr->name, sizeof(name));
|
||||
if ((nameptr = name + strlen(name) - 8) <= name ||
|
||||
strcmp(nameptr, "-default"))
|
||||
continue;
|
||||
|
||||
*nameptr = '\0';
|
||||
|
||||
if (ippAttributeString(attr, value, sizeof(value)) >= sizeof(value))
|
||||
continue;
|
||||
|
||||
dinfo->num_defaults = cupsAddOption(name, value, dinfo->num_defaults,
|
||||
&dinfo->defaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_create_media_db()' - Create the media database.
|
||||
*/
|
||||
@@ -821,7 +1218,7 @@ cups_create_media_db(
|
||||
mdb.top =
|
||||
mdb.bottom = 1270; /* Default 1/2" top/bottom margins */
|
||||
|
||||
for (i = media_col_db->num_values, val = media_col_db->values;
|
||||
for (i = media_attr->num_values, val = media_attr->values;
|
||||
i > 0;
|
||||
i --, val ++)
|
||||
{
|
||||
@@ -1159,6 +1556,208 @@ cups_is_close_media_db(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_test_constraints()' - Test constraints.
|
||||
*
|
||||
* TODO: STR #4096 - Need to properly support media-col contraints...
|
||||
*/
|
||||
|
||||
static cups_array_t * /* O - Active constraints */
|
||||
cups_test_constraints(
|
||||
cups_dinfo_t *dinfo, /* I - Destination information */
|
||||
const char *new_option, /* I - Newly selected option */
|
||||
const char *new_value, /* I - Newly selected value */
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t *options, /* I - Options */
|
||||
int *num_conflicts, /* O - Number of conflicting options */
|
||||
cups_option_t **conflicts) /* O - Conflicting options */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
match; /* Value matches? */
|
||||
int num_matching; /* Number of matching options */
|
||||
cups_option_t *matching; /* Matching options */
|
||||
_cups_dconstres_t *c; /* Current constraint */
|
||||
cups_array_t *active = NULL; /* Active constraints */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
_ipp_value_t *attrval; /* Current attribute value */
|
||||
const char *value; /* Current value */
|
||||
char temp[1024]; /* Temporary string */
|
||||
int int_value; /* Integer value */
|
||||
int xres_value, /* Horizontal resolution */
|
||||
yres_value; /* Vertical resolution */
|
||||
ipp_res_t units_value; /* Resolution units */
|
||||
|
||||
|
||||
for (c = (_cups_dconstres_t *)cupsArrayFirst(dinfo->constraints);
|
||||
c;
|
||||
c = (_cups_dconstres_t *)cupsArrayNext(dinfo->constraints))
|
||||
{
|
||||
num_matching = 0;
|
||||
matching = NULL;
|
||||
|
||||
for (attr = ippFirstAttribute(c->collection);
|
||||
attr;
|
||||
attr = ippNextAttribute(c->collection))
|
||||
{
|
||||
if (attr->value_tag == IPP_TAG_BEGIN_COLLECTION)
|
||||
break; /* TODO: STR #4096 */
|
||||
|
||||
/*
|
||||
* Get the value for the current attribute in the constraint...
|
||||
*/
|
||||
|
||||
if (new_option && new_value && !strcmp(attr->name, new_option))
|
||||
value = new_value;
|
||||
else if ((value = cupsGetOption(attr->name, num_options,
|
||||
options)) == NULL)
|
||||
value = cupsGetOption(attr->name, dinfo->num_defaults, dinfo->defaults);
|
||||
|
||||
if (!value)
|
||||
{
|
||||
/*
|
||||
* Not set so this constraint does not apply...
|
||||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
match = 0;
|
||||
|
||||
switch (attr->value_tag)
|
||||
{
|
||||
case IPP_TAG_INTEGER :
|
||||
case IPP_TAG_ENUM :
|
||||
int_value = atoi(value);
|
||||
|
||||
for (i = attr->num_values, attrval = attr->values;
|
||||
i > 0;
|
||||
i --, attrval ++)
|
||||
{
|
||||
if (attrval->integer == int_value)
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IPP_TAG_BOOLEAN :
|
||||
int_value = !strcmp(value, "true");
|
||||
|
||||
for (i = attr->num_values, attrval = attr->values;
|
||||
i > 0;
|
||||
i --, attrval ++)
|
||||
{
|
||||
if (attrval->boolean == int_value)
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IPP_TAG_RANGE :
|
||||
int_value = atoi(value);
|
||||
|
||||
for (i = attr->num_values, attrval = attr->values;
|
||||
i > 0;
|
||||
i --, attrval ++)
|
||||
{
|
||||
if (int_value >= attrval->range.lower &&
|
||||
int_value <= attrval->range.upper)
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IPP_TAG_RESOLUTION :
|
||||
if (sscanf(value, "%dx%d%15s", &xres_value, &yres_value, temp) != 3)
|
||||
{
|
||||
if (sscanf(value, "%d%15s", &xres_value, temp) != 2)
|
||||
break;
|
||||
|
||||
yres_value = xres_value;
|
||||
}
|
||||
|
||||
if (!strcmp(temp, "dpi"))
|
||||
units_value = IPP_RES_PER_INCH;
|
||||
else if (!strcmp(temp, "dpc") || !strcmp(temp, "dpcm"))
|
||||
units_value = IPP_RES_PER_CM;
|
||||
else
|
||||
break;
|
||||
|
||||
for (i = attr->num_values, attrval = attr->values;
|
||||
i > 0;
|
||||
i --, attrval ++)
|
||||
{
|
||||
if (attrval->resolution.xres == xres_value &&
|
||||
attrval->resolution.yres == yres_value &&
|
||||
attrval->resolution.units == units_value)
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_CHARSET :
|
||||
case IPP_TAG_URI :
|
||||
case IPP_TAG_URISCHEME :
|
||||
case IPP_TAG_MIMETYPE :
|
||||
case IPP_TAG_LANGUAGE :
|
||||
case IPP_TAG_TEXTLANG :
|
||||
case IPP_TAG_NAMELANG :
|
||||
for (i = attr->num_values, attrval = attr->values;
|
||||
i > 0;
|
||||
i --, attrval ++)
|
||||
{
|
||||
if (!strcmp(attrval->string.text, value))
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
if (!match)
|
||||
break;
|
||||
|
||||
num_matching = cupsAddOption(attr->name, value, num_matching, &matching);
|
||||
}
|
||||
|
||||
if (!attr)
|
||||
{
|
||||
if (!active)
|
||||
active = cupsArrayNew(NULL, NULL);
|
||||
|
||||
cupsArrayAdd(active, c);
|
||||
|
||||
if (num_conflicts && conflicts)
|
||||
{
|
||||
cups_option_t *moption; /* Matching option */
|
||||
|
||||
for (i = num_matching, moption = matching; i > 0; i --, moption ++)
|
||||
*num_conflicts = cupsAddOption(moption->name, moption->value,
|
||||
*num_conflicts, conflicts);
|
||||
}
|
||||
}
|
||||
|
||||
cupsFreeOptions(num_matching, matching);
|
||||
}
|
||||
|
||||
return (active);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
+503
-71
@@ -62,13 +62,17 @@
|
||||
* cups_block_cb() - Enumeration callback for block API.
|
||||
* cups_compare_dests() - Compare two destinations.
|
||||
* cups_dnssd_browse_cb() - Browse for printers.
|
||||
* cups_dnssd_browse_cb() - Browse for printers.
|
||||
* cups_dnssd_client_cb() - Avahi client callback function.
|
||||
* cups_dnssd_compare_device() - Compare two devices.
|
||||
* cups_dnssd_free_device() - Free the memory used by a device.
|
||||
* cups_dnssd_get_device() - Lookup a device and create it as needed.
|
||||
* cups_dnssd_local_cb() - Browse for local printers.
|
||||
* cups_dnssd_poll_cb() - Wait for input on the specified file
|
||||
* descriptors.
|
||||
* cups_dnssd_query_cb() - Process query data.
|
||||
* cups_dnssd_resolve() - Resolve a Bonjour printer URI.
|
||||
* cups_dnssd_resolve_cb() - See if we should continue resolving.
|
||||
* cups_dnssd_resolve() - Resolve a Bonjour printer URI.
|
||||
* cups_dnssd_resolve_cb() - See if we should continue resolving.
|
||||
* cups_dnssd_unquote() - Unquote a name string.
|
||||
* cups_find_dest() - Find a destination using a binary search.
|
||||
* cups_get_default() - Get the default destination from an
|
||||
@@ -97,6 +101,16 @@
|
||||
# include <dns_sd.h>
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
#ifdef HAVE_AVAHI
|
||||
# include <avahi-client/client.h>
|
||||
# include <avahi-client/lookup.h>
|
||||
# include <avahi-common/simple-watch.h>
|
||||
# include <avahi-common/domain.h>
|
||||
# include <avahi-common/error.h>
|
||||
# include <avahi-common/malloc.h>
|
||||
#define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX
|
||||
#endif /* HAVE_AVAHI */
|
||||
|
||||
|
||||
/*
|
||||
* Constants...
|
||||
@@ -117,7 +131,7 @@
|
||||
* Types...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DNSSD
|
||||
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
||||
typedef enum _cups_dnssd_state_e /* Enumerated device state */
|
||||
{
|
||||
_CUPS_DNSSD_NEW,
|
||||
@@ -125,12 +139,19 @@ typedef enum _cups_dnssd_state_e /* Enumerated device state */
|
||||
_CUPS_DNSSD_PENDING,
|
||||
_CUPS_DNSSD_ACTIVE,
|
||||
_CUPS_DNSSD_LOCAL,
|
||||
_CUPS_DNSSD_INCOMPATIBLE,
|
||||
_CUPS_DNSSD_ERROR
|
||||
} _cups_dnssd_state_t;
|
||||
|
||||
typedef struct _cups_dnssd_data_s /* Enumeration data */
|
||||
{
|
||||
# ifdef HAVE_DNSSD
|
||||
DNSServiceRef main_ref; /* Main service reference */
|
||||
# else /* HAVE_AVAHI */
|
||||
AvahiSimplePoll *simple_poll; /* Polling interface */
|
||||
AvahiClient *client; /* Client information */
|
||||
int got_data; /* Did we get data? */
|
||||
# endif /* HAVE_DNSSD */
|
||||
cups_dest_cb_t cb; /* Callback */
|
||||
void *user_data; /* User data pointer */
|
||||
cups_ptype_t type, /* Printer type filter */
|
||||
@@ -141,7 +162,11 @@ typedef struct _cups_dnssd_data_s /* Enumeration data */
|
||||
typedef struct _cups_dnssd_device_s /* Enumerated device */
|
||||
{
|
||||
_cups_dnssd_state_t state; /* State of device listing */
|
||||
# ifdef HAVE_DNSSD
|
||||
DNSServiceRef ref; /* Service reference for query */
|
||||
# else /* HAVE_AVAHI */
|
||||
AvahiRecordBrowser *ref; /* Browser for query */
|
||||
# endif /* HAVE_DNSSD */
|
||||
char *domain, /* Domain name */
|
||||
*fullName, /* Full name */
|
||||
*regtype; /* Registration type */
|
||||
@@ -165,8 +190,8 @@ typedef struct _cups_dnssd_resolve_s /* Data for resolving URI */
|
||||
static CFArrayRef appleCopyLocations(void);
|
||||
static CFStringRef appleCopyNetwork(void);
|
||||
static char *appleGetPaperSize(char *name, int namesize);
|
||||
static CFStringRef appleGetPrinter(CFArrayRef locations, CFStringRef network,
|
||||
CFIndex *locindex);
|
||||
static CFStringRef appleGetPrinter(CFArrayRef locations,
|
||||
CFStringRef network, CFIndex *locindex);
|
||||
#endif /* __APPLE__ */
|
||||
static cups_dest_t *cups_add_dest(const char *name, const char *instance,
|
||||
int *num_dests, cups_dest_t **dests);
|
||||
@@ -175,7 +200,8 @@ static int cups_block_cb(cups_dest_block_t block, unsigned flags,
|
||||
cups_dest_t *dest);
|
||||
#endif /* __BLOCKS__ */
|
||||
static int cups_compare_dests(cups_dest_t *a, cups_dest_t *b);
|
||||
#ifdef HAVE_DNSSD
|
||||
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
||||
# ifdef HAVE_DNSSD
|
||||
static void cups_dnssd_browse_cb(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
@@ -184,6 +210,20 @@ static void cups_dnssd_browse_cb(DNSServiceRef sdRef,
|
||||
const char *regtype,
|
||||
const char *replyDomain,
|
||||
void *context);
|
||||
# else /* HAVE_AVAHI */
|
||||
static void cups_dnssd_browse_cb(AvahiServiceBrowser *browser,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiBrowserEvent event,
|
||||
const char *serviceName,
|
||||
const char *regtype,
|
||||
const char *replyDomain,
|
||||
AvahiLookupResultFlags flags,
|
||||
void *context);
|
||||
static void cups_dnssd_client_cb(AvahiClient *client,
|
||||
AvahiClientState state,
|
||||
void *context);
|
||||
# endif /* HAVE_DNSSD */
|
||||
static int cups_dnssd_compare_devices(_cups_dnssd_device_t *a,
|
||||
_cups_dnssd_device_t *b);
|
||||
static void cups_dnssd_free_device(_cups_dnssd_device_t *device,
|
||||
@@ -193,6 +233,7 @@ static _cups_dnssd_device_t *
|
||||
const char *serviceName,
|
||||
const char *regtype,
|
||||
const char *replyDomain);
|
||||
# ifdef HAVE_DNSSD
|
||||
static void cups_dnssd_local_cb(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
@@ -209,13 +250,27 @@ static void cups_dnssd_query_cb(DNSServiceRef sdRef,
|
||||
uint16_t rrtype, uint16_t rrclass,
|
||||
uint16_t rdlen, const void *rdata,
|
||||
uint32_t ttl, void *context);
|
||||
# else /* HAVE_AVAHI */
|
||||
static int cups_dnssd_poll_cb(struct pollfd *pollfds,
|
||||
unsigned int num_pollfds,
|
||||
int timeout, void *context);
|
||||
static void cups_dnssd_query_cb(AvahiRecordBrowser *browser,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiBrowserEvent event,
|
||||
const char *name, uint16_t rrclass,
|
||||
uint16_t rrtype, const void *rdata,
|
||||
size_t rdlen,
|
||||
AvahiLookupResultFlags flags,
|
||||
void *context);
|
||||
# endif /* HAVE_DNSSD */
|
||||
static const char *cups_dnssd_resolve(cups_dest_t *dest, const char *uri,
|
||||
int msec, int *cancel,
|
||||
cups_dest_cb_t cb, void *user_data);
|
||||
static int cups_dnssd_resolve_cb(void *context);
|
||||
static void cups_dnssd_unquote(char *dst, const char *src,
|
||||
size_t dstsize);
|
||||
#endif /* HAVE_DNSSD */
|
||||
#endif /* HAVE_DNSSD || HAVE_AVAHI */
|
||||
static int cups_find_dest(const char *name, const char *instance,
|
||||
int num_dests, cups_dest_t *dests, int prev,
|
||||
int *rdiff);
|
||||
@@ -348,11 +403,6 @@ _cupsAppleCopyDefaultPrinter(void)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
//# ifdef DEBUG
|
||||
// CFStringGetCString(network, name, namesize, kCFStringEncodingUTF8);
|
||||
// DEBUG_printf(("2_cupsUserDefault: network=\"%s\"", name));
|
||||
//# endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* Lookup the network in the preferences...
|
||||
*/
|
||||
@@ -549,7 +599,7 @@ _cupsAppleSetUseLastPrinter(
|
||||
* to by "cancel" is non-zero, or the callback function (or block) returns 0,
|
||||
* The caller is responsible for calling httpClose() on the returned object.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
http_t * /* O - Connection to server or @code NULL@ */
|
||||
@@ -610,14 +660,14 @@ cupsConnectDest(
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DNSSD
|
||||
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
||||
if (strstr(uri, "._tcp"))
|
||||
{
|
||||
if ((uri = cups_dnssd_resolve(dest, uri, msec, cancel, cb,
|
||||
user_data)) == NULL)
|
||||
return (NULL);
|
||||
}
|
||||
#endif /* HAVE_DNSSD */
|
||||
#endif /* HAVE_DNSSD || HAVE_AVAHI */
|
||||
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme),
|
||||
userpass, sizeof(userpass), hostname, sizeof(hostname),
|
||||
@@ -715,7 +765,7 @@ cupsConnectDest(
|
||||
* to by "cancel" is non-zero, or the callback function (or block) returns 0,
|
||||
* The caller is responsible for calling httpClose() on the returned object.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
http_t * /* O - Connection to server or @code NULL@ */
|
||||
@@ -741,7 +791,7 @@ cupsConnectDestBlock(
|
||||
* copy) - for use with the cupsEnumDests* functions. The caller is responsible
|
||||
* for calling cupsFreeDests() on the returned object(s).
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int
|
||||
@@ -821,7 +871,7 @@ cupsCopyDest(cups_dest_t *dest,
|
||||
* Enumeration happens on the current thread and does not return until all
|
||||
* destinations have been enumerated or the callback function returns 0.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -837,34 +887,43 @@ cupsEnumDests(
|
||||
{
|
||||
int i, /* Looping var */
|
||||
num_dests; /* Number of destinations */
|
||||
cups_dest_t *dests, /* Destinations */
|
||||
cups_dest_t *dests = NULL, /* Destinations */
|
||||
*dest; /* Current destination */
|
||||
#ifdef HAVE_DNSSD
|
||||
int nfds, /* Number of files responded */
|
||||
count, /* Number of queries started */
|
||||
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
||||
int count, /* Number of queries started */
|
||||
remaining; /* Remainder of timeout */
|
||||
_cups_dnssd_data_t data; /* Data for callback */
|
||||
_cups_dnssd_device_t *device; /* Current device */
|
||||
int main_fd; /* File descriptor for lookups */
|
||||
# ifdef HAVE_DNSSD
|
||||
int nfds, /* Number of files responded */
|
||||
main_fd; /* File descriptor for lookups */
|
||||
DNSServiceRef ipp_ref, /* IPP browser */
|
||||
local_ipp_ref; /* Local IPP browser */
|
||||
# ifdef HAVE_SSL
|
||||
# ifdef HAVE_SSL
|
||||
DNSServiceRef ipps_ref, /* IPPS browser */
|
||||
local_ipps_ref; /* Local IPPS browser */
|
||||
# endif /* HAVE_SSL */
|
||||
# ifdef HAVE_POLL
|
||||
# endif /* HAVE_SSL */
|
||||
# ifdef HAVE_POLL
|
||||
struct pollfd pfd; /* Polling data */
|
||||
# else
|
||||
# else
|
||||
fd_set input; /* Input set for select() */
|
||||
struct timeval timeout; /* Timeout for select() */
|
||||
# endif /* HAVE_POLL */
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
# endif /* HAVE_POLL */
|
||||
# else /* HAVE_AVAHI */
|
||||
int error; /* Error value */
|
||||
AvahiServiceBrowser *ipp_ref; /* IPP browser */
|
||||
# ifdef HAVE_SSL
|
||||
AvahiServiceBrowser *ipps_ref; /* IPPS browser */
|
||||
# endif /* HAVE_SSL */
|
||||
# endif /* HAVE_DNSSD */
|
||||
#endif /* HAVE_DNSSD || HAVE_AVAHI */
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
(void)flags;
|
||||
|
||||
if (!cb)
|
||||
return (0);
|
||||
|
||||
@@ -887,7 +946,7 @@ cupsEnumDests(
|
||||
if (i > 0 || msec == 0)
|
||||
return (1);
|
||||
|
||||
#ifdef HAVE_DNSSD
|
||||
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
||||
/*
|
||||
* Get Bonjour-shared printers...
|
||||
*/
|
||||
@@ -898,6 +957,7 @@ cupsEnumDests(
|
||||
NULL, NULL, 0, NULL,
|
||||
(cups_afree_func_t)cups_dnssd_free_device);
|
||||
|
||||
# ifdef HAVE_DNSSD
|
||||
if (DNSServiceCreateConnection(&data.main_ref) != kDNSServiceErr_NoError)
|
||||
return (0);
|
||||
|
||||
@@ -905,27 +965,56 @@ cupsEnumDests(
|
||||
|
||||
ipp_ref = data.main_ref;
|
||||
DNSServiceBrowse(&ipp_ref, kDNSServiceFlagsShareConnection, 0,
|
||||
"_ipp._tcp,_cups", NULL,
|
||||
"_ipp._tcp", NULL,
|
||||
(DNSServiceBrowseReply)cups_dnssd_browse_cb, &data);
|
||||
|
||||
local_ipp_ref = data.main_ref;
|
||||
DNSServiceBrowse(&local_ipp_ref, kDNSServiceFlagsShareConnection,
|
||||
kDNSServiceInterfaceIndexLocalOnly,
|
||||
"_ipp._tcp,_cups", NULL,
|
||||
"_ipp._tcp", NULL,
|
||||
(DNSServiceBrowseReply)cups_dnssd_local_cb, &data);
|
||||
|
||||
# ifdef HAVE_SSL
|
||||
# ifdef HAVE_SSL
|
||||
ipps_ref = data.main_ref;
|
||||
DNSServiceBrowse(&ipps_ref, kDNSServiceFlagsShareConnection, 0,
|
||||
"_ipps._tcp,_cups", NULL,
|
||||
"_ipps._tcp", NULL,
|
||||
(DNSServiceBrowseReply)cups_dnssd_browse_cb, &data);
|
||||
|
||||
local_ipps_ref = data.main_ref;
|
||||
DNSServiceBrowse(&local_ipps_ref, kDNSServiceFlagsShareConnection,
|
||||
kDNSServiceInterfaceIndexLocalOnly,
|
||||
"_ipps._tcp,_cups", NULL,
|
||||
"_ipps._tcp", NULL,
|
||||
(DNSServiceBrowseReply)cups_dnssd_local_cb, &data);
|
||||
# endif /* HAVE_SSL */
|
||||
# endif /* HAVE_SSL */
|
||||
|
||||
# else /* HAVE_AVAHI */
|
||||
if ((data.simple_poll = avahi_simple_poll_new()) == NULL)
|
||||
{
|
||||
DEBUG_puts("cupsEnumDests: Unable to create Avahi simple poll object.");
|
||||
return (1);
|
||||
}
|
||||
|
||||
avahi_simple_poll_set_func(data.simple_poll, cups_dnssd_poll_cb, &data);
|
||||
|
||||
data.client = avahi_client_new(avahi_simple_poll_get(data.simple_poll),
|
||||
0, cups_dnssd_client_cb, &data,
|
||||
&error);
|
||||
if (!data.client)
|
||||
{
|
||||
DEBUG_puts("cupsEnumDests: Unable to create Avahi client.");
|
||||
avahi_simple_poll_free(data.simple_poll);
|
||||
return (1);
|
||||
}
|
||||
|
||||
ipp_ref = avahi_service_browser_new(data.client, AVAHI_IF_UNSPEC,
|
||||
AVAHI_PROTO_UNSPEC, "_ipp._tcp", NULL,
|
||||
0, cups_dnssd_browse_cb, &data);
|
||||
# ifdef HAVE_SSL
|
||||
ipps_ref = avahi_service_browser_new(data.client, AVAHI_IF_UNSPEC,
|
||||
AVAHI_PROTO_UNSPEC, "_ipps._tcp", NULL,
|
||||
0, cups_dnssd_browse_cb, &data);
|
||||
# endif /* HAVE_SSL */
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
if (msec < 0)
|
||||
remaining = INT_MAX;
|
||||
@@ -938,13 +1027,14 @@ cupsEnumDests(
|
||||
* Check for input...
|
||||
*/
|
||||
|
||||
# ifdef HAVE_POLL
|
||||
# ifdef HAVE_DNSSD
|
||||
# ifdef HAVE_POLL
|
||||
pfd.fd = main_fd;
|
||||
pfd.events = POLLIN;
|
||||
|
||||
nfds = poll(&pfd, 1, remaining > 250 ? 250 : remaining);
|
||||
|
||||
# else
|
||||
# else
|
||||
FD_ZERO(&input);
|
||||
FD_SET(main_fd, &input);
|
||||
|
||||
@@ -952,13 +1042,30 @@ cupsEnumDests(
|
||||
timeout.tv_usec = remaining > 250 ? 250000 : remaining * 1000;
|
||||
|
||||
nfds = select(main_fd + 1, &input, NULL, NULL, &timeout);
|
||||
# endif /* HAVE_POLL */
|
||||
# endif /* HAVE_POLL */
|
||||
|
||||
if (nfds > 0)
|
||||
DNSServiceProcessResult(data.main_ref);
|
||||
else if (nfds == 0)
|
||||
remaining -= 250;
|
||||
|
||||
# else /* HAVE_AVAHI */
|
||||
data.got_data = 0;
|
||||
|
||||
if ((error = avahi_simple_poll_iterate(data.simple_poll, 250)) > 0)
|
||||
{
|
||||
/*
|
||||
* We've been told to exit the loop. Perhaps the connection to
|
||||
* Avahi failed.
|
||||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!data.got_data)
|
||||
remaining -= 250;
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
for (device = (_cups_dnssd_device_t *)cupsArrayFirst(data.devices),
|
||||
count = 0;
|
||||
device;
|
||||
@@ -969,10 +1076,11 @@ cupsEnumDests(
|
||||
|
||||
if (!device->ref && device->state == _CUPS_DNSSD_NEW)
|
||||
{
|
||||
device->ref = data.main_ref;
|
||||
|
||||
DEBUG_printf(("1cupsEnumDests: Querying '%s'.", device->fullName));
|
||||
|
||||
# ifdef HAVE_DNSSD
|
||||
device->ref = data.main_ref;
|
||||
|
||||
if (DNSServiceQueryRecord(&(device->ref),
|
||||
kDNSServiceFlagsShareConnection,
|
||||
0, device->fullName,
|
||||
@@ -990,14 +1098,39 @@ cupsEnumDests(
|
||||
|
||||
DEBUG_puts("1cupsEnumDests: Query failed.");
|
||||
}
|
||||
|
||||
# else /* HAVE_AVAHI */
|
||||
if ((device->ref = avahi_record_browser_new(data.client,
|
||||
AVAHI_IF_UNSPEC,
|
||||
AVAHI_PROTO_UNSPEC,
|
||||
device->fullName,
|
||||
AVAHI_DNS_CLASS_IN,
|
||||
AVAHI_DNS_TYPE_TXT,
|
||||
0,
|
||||
cups_dnssd_query_cb,
|
||||
&data)) != NULL)
|
||||
{
|
||||
count ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
device->state = _CUPS_DNSSD_ERROR;
|
||||
|
||||
DEBUG_printf(("1cupsEnumDests: Query failed: %s",
|
||||
avahi_strerror(avahi_client_errno(data.client))));
|
||||
}
|
||||
# endif /* HAVE_DNSSD */
|
||||
}
|
||||
else if (device->ref && device->state == _CUPS_DNSSD_PENDING)
|
||||
{
|
||||
if (!(*cb)(user_data, CUPS_DEST_FLAGS_NONE, &device->dest))
|
||||
{
|
||||
remaining = -1;
|
||||
break;
|
||||
}
|
||||
if ((device->type & mask) == type)
|
||||
{
|
||||
if (!(*cb)(user_data, CUPS_DEST_FLAGS_NONE, &device->dest))
|
||||
{
|
||||
remaining = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
device->state = _CUPS_DNSSD_ACTIVE;
|
||||
}
|
||||
@@ -1006,16 +1139,27 @@ cupsEnumDests(
|
||||
|
||||
cupsArrayDelete(data.devices);
|
||||
|
||||
# ifdef HAVE_DNSSD
|
||||
DNSServiceRefDeallocate(ipp_ref);
|
||||
DNSServiceRefDeallocate(local_ipp_ref);
|
||||
|
||||
# ifdef HAVE_SSL
|
||||
# ifdef HAVE_SSL
|
||||
DNSServiceRefDeallocate(ipp_ref);
|
||||
DNSServiceRefDeallocate(local_ipp_ref);
|
||||
# endif /* HAVE_SSL */
|
||||
# endif /* HAVE_SSL */
|
||||
|
||||
DNSServiceRefDeallocate(data.main_ref);
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
# else /* HAVE_AVAHI */
|
||||
avahi_service_browser_free(ipp_ref);
|
||||
# ifdef HAVE_SSL
|
||||
avahi_service_browser_free(ipps_ref);
|
||||
# endif /* HAVE_SSL */
|
||||
|
||||
avahi_client_free(data.client);
|
||||
avahi_simple_poll_free(data.simple_poll);
|
||||
# endif /* HAVE_DNSSD */
|
||||
#endif /* HAVE_DNSSD || HAVE_DNSSD */
|
||||
|
||||
return (1);
|
||||
}
|
||||
@@ -1033,7 +1177,7 @@ cupsEnumDests(
|
||||
* Enumeration happens on the current thread and does not return until all
|
||||
* destinations have been enumerated or the block returns 0.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -1213,7 +1357,7 @@ _cupsGetDestResource(
|
||||
* Free the memory used by the destination array using the @link cupsFreeDests@
|
||||
* function.
|
||||
*
|
||||
* Note: On Mac OS X this function also gets the default paper from the system
|
||||
* Note: On OS X this function also gets the default paper from the system
|
||||
* preferences (~/L/P/org.cups.PrintingPrefs.plist) and includes it in the
|
||||
* options array for each destination that supports it.
|
||||
*/
|
||||
@@ -1506,7 +1650,7 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
|
||||
* Use the @link cupsFreeDests@ function to free the destination list and
|
||||
* the @link cupsGetDest@ function to find a particular destination.
|
||||
*
|
||||
* @since CUPS 1.1.21/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.21/OS X 10.4@
|
||||
*/
|
||||
|
||||
int /* O - Number of destinations */
|
||||
@@ -1644,7 +1788,7 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
* need to set a default if one exists...
|
||||
*/
|
||||
|
||||
if (dest == NULL && defprinter != NULL)
|
||||
if (!dest && *dests && defprinter)
|
||||
{
|
||||
for (i = 0; i < num_dests; i ++)
|
||||
(*dests)[i].is_default = 0;
|
||||
@@ -1689,7 +1833,7 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
* The returned destination must be freed using @link cupsFreeDests@ with a
|
||||
* "num_dests" value of 1.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
cups_dest_t * /* O - Destination or @code NULL@ */
|
||||
@@ -1814,7 +1958,7 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
|
||||
* @link cupsSetDests@ or @link cupsSetDests2@ functions to save the new
|
||||
* options for the user.
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - New number of destinations */
|
||||
@@ -1860,7 +2004,7 @@ cupsRemoveDest(const char *name, /* I - Destination name */
|
||||
/*
|
||||
* 'cupsSetDefaultDest()' - Set the default destination.
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -1915,7 +2059,7 @@ cupsSetDests(int num_dests, /* I - Number of destinations */
|
||||
* This function saves the destinations to /etc/cups/lpoptions when run
|
||||
* as root and ~/.cups/lpoptions when run as a normal user.
|
||||
*
|
||||
* @since CUPS 1.1.21/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.21/OS X 10.4@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@@ -1934,7 +2078,7 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
#endif /* WIN32 */
|
||||
char filename[1024]; /* lpoptions file */
|
||||
int num_temps; /* Number of temporary destinations */
|
||||
cups_dest_t *temps, /* Temporary destinations */
|
||||
cups_dest_t *temps = NULL, /* Temporary destinations */
|
||||
*temp; /* Current temporary dest */
|
||||
const char *val; /* Value of temporary option */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
@@ -2305,7 +2449,7 @@ appleCopyNetwork(void)
|
||||
* 'appleGetPaperSize()' - Get the default paper size.
|
||||
*/
|
||||
|
||||
char * /* O - Default paper size */
|
||||
static char * /* O - Default paper size */
|
||||
appleGetPaperSize(char *name, /* I - Paper size name buffer */
|
||||
int namesize) /* I - Size of buffer */
|
||||
{
|
||||
@@ -2476,7 +2620,8 @@ cups_compare_dests(cups_dest_t *a, /* I - First destination */
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_DNSSD
|
||||
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
||||
# ifdef HAVE_DNSSD
|
||||
/*
|
||||
* 'cups_dnssd_browse_cb()' - Browse for printers.
|
||||
*/
|
||||
@@ -2517,6 +2662,104 @@ cups_dnssd_browse_cb(
|
||||
}
|
||||
|
||||
|
||||
# else /* HAVE_AVAHI */
|
||||
/*
|
||||
* 'cups_dnssd_browse_cb()' - Browse for printers.
|
||||
*/
|
||||
|
||||
static void
|
||||
cups_dnssd_browse_cb(
|
||||
AvahiServiceBrowser *browser, /* I - Browser */
|
||||
AvahiIfIndex interface, /* I - Interface index (unused) */
|
||||
AvahiProtocol protocol, /* I - Network protocol (unused) */
|
||||
AvahiBrowserEvent event, /* I - What happened */
|
||||
const char *name, /* I - Service name */
|
||||
const char *type, /* I - Registration type */
|
||||
const char *domain, /* I - Domain */
|
||||
AvahiLookupResultFlags flags, /* I - Flags */
|
||||
void *context) /* I - Devices array */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
AvahiClient *client = avahi_service_browser_get_client(browser);
|
||||
/* Client information */
|
||||
#endif /* DEBUG */
|
||||
_cups_dnssd_data_t *data = (_cups_dnssd_data_t *)context;
|
||||
/* Enumeration data */
|
||||
|
||||
|
||||
(void)interface;
|
||||
(void)protocol;
|
||||
(void)context;
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case AVAHI_BROWSER_FAILURE:
|
||||
DEBUG_printf(("cups_dnssd_browse_cb: %s",
|
||||
avahi_strerror(avahi_client_errno(client))));
|
||||
avahi_simple_poll_quit(data->simple_poll);
|
||||
break;
|
||||
|
||||
case AVAHI_BROWSER_NEW:
|
||||
/*
|
||||
* This object is new on the network.
|
||||
*/
|
||||
|
||||
if (flags & AVAHI_LOOKUP_RESULT_LOCAL)
|
||||
{
|
||||
/*
|
||||
* This comes from the local machine so ignore it.
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cups_dnssd_browse_cb: Ignoring local service \"%s\".",
|
||||
name));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Create a device entry for it if it doesn't yet exist.
|
||||
*/
|
||||
|
||||
cups_dnssd_get_device(data, name, type, domain);
|
||||
}
|
||||
break;
|
||||
|
||||
case AVAHI_BROWSER_REMOVE:
|
||||
case AVAHI_BROWSER_ALL_FOR_NOW:
|
||||
case AVAHI_BROWSER_CACHE_EXHAUSTED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_dnssd_client_cb()' - Avahi client callback function.
|
||||
*/
|
||||
|
||||
static void
|
||||
cups_dnssd_client_cb(
|
||||
AvahiClient *client, /* I - Client information (unused) */
|
||||
AvahiClientState state, /* I - Current state */
|
||||
void *context) /* I - User data (unused) */
|
||||
{
|
||||
_cups_dnssd_data_t *data = (_cups_dnssd_data_t *)context;
|
||||
/* Enumeration data */
|
||||
|
||||
|
||||
(void)client;
|
||||
|
||||
/*
|
||||
* If the connection drops, quit.
|
||||
*/
|
||||
|
||||
if (state == AVAHI_CLIENT_FAILURE)
|
||||
{
|
||||
DEBUG_puts("cups_dnssd_client_cb: Avahi connection failed.");
|
||||
avahi_simple_poll_quit(data->simple_poll);
|
||||
}
|
||||
}
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_dnssd_compare_device()' - Compare two devices.
|
||||
*/
|
||||
@@ -2542,8 +2785,13 @@ cups_dnssd_free_device(
|
||||
DEBUG_printf(("5cups_dnssd_free_device(device=%p(%s), data=%p)", device,
|
||||
device->dest.name, data));
|
||||
|
||||
# ifdef HAVE_DNSSD
|
||||
if (device->ref)
|
||||
DNSServiceRefDeallocate(device->ref);
|
||||
# else /* HAVE_AVAHI */
|
||||
if (device->ref)
|
||||
avahi_record_browser_free(device->ref);
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
_cupsStrFree(device->domain);
|
||||
_cupsStrFree(device->fullName);
|
||||
@@ -2653,14 +2901,25 @@ cups_dnssd_get_device(
|
||||
* Set the "full name" of this service, which is used for queries...
|
||||
*/
|
||||
|
||||
# ifdef HAVE_DNSSD
|
||||
DNSServiceConstructFullName(fullName, device->dest.name, device->regtype,
|
||||
device->domain);
|
||||
# else /* HAVE_AVAHI */
|
||||
avahi_service_name_join(fullName, kDNSServiceMaxDomainName, serviceName,
|
||||
regtype, replyDomain);
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
_cupsStrFree(device->fullName);
|
||||
device->fullName = _cupsStrAlloc(fullName);
|
||||
|
||||
if (device->ref)
|
||||
{
|
||||
# ifdef HAVE_DNSSD
|
||||
DNSServiceRefDeallocate(device->ref);
|
||||
# else /* HAVE_AVAHI */
|
||||
avahi_record_browser_free(device->ref);
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
device->ref = 0;
|
||||
}
|
||||
|
||||
@@ -2674,6 +2933,7 @@ cups_dnssd_get_device(
|
||||
}
|
||||
|
||||
|
||||
# ifdef HAVE_DNSSD
|
||||
/*
|
||||
* 'cups_dnssd_local_cb()' - Browse for local printers.
|
||||
*/
|
||||
@@ -2731,12 +2991,51 @@ cups_dnssd_local_cb(
|
||||
|
||||
device->state = _CUPS_DNSSD_LOCAL;
|
||||
}
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
|
||||
# ifdef HAVE_AVAHI
|
||||
/*
|
||||
* 'cups_dnssd_poll_cb()' - Wait for input on the specified file descriptors.
|
||||
*
|
||||
* Note: This function is needed because avahi_simple_poll_iterate is broken
|
||||
* and always uses a timeout of 0 (!) milliseconds.
|
||||
* (Avahi Ticket #364)
|
||||
*/
|
||||
|
||||
static int /* O - Number of file descriptors matching */
|
||||
cups_dnssd_poll_cb(
|
||||
struct pollfd *pollfds, /* I - File descriptors */
|
||||
unsigned int num_pollfds, /* I - Number of file descriptors */
|
||||
int timeout, /* I - Timeout in milliseconds (unused) */
|
||||
void *context) /* I - User data (unused) */
|
||||
{
|
||||
_cups_dnssd_data_t *data = (_cups_dnssd_data_t *)context;
|
||||
/* Enumeration data */
|
||||
int val; /* Return value */
|
||||
|
||||
|
||||
(void)timeout;
|
||||
|
||||
val = poll(pollfds, num_pollfds, 250);
|
||||
|
||||
if (val < 0)
|
||||
{
|
||||
DEBUG_printf(("cups_dnssd_poll_cb: %s", strerror(errno)));
|
||||
}
|
||||
else if (val > 0)
|
||||
data->got_data = 1;
|
||||
|
||||
return (val);
|
||||
}
|
||||
# endif /* HAVE_AVAHI */
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_dnssd_query_cb()' - Process query data.
|
||||
*/
|
||||
|
||||
# ifdef HAVE_DNSSD
|
||||
static void
|
||||
cups_dnssd_query_cb(
|
||||
DNSServiceRef sdRef, /* I - Service reference */
|
||||
@@ -2751,6 +3050,27 @@ cups_dnssd_query_cb(
|
||||
uint32_t ttl, /* I - Time-to-live */
|
||||
void *context) /* I - Enumeration data */
|
||||
{
|
||||
# else /* HAVE_AVAHI */
|
||||
static void
|
||||
cups_dnssd_query_cb(
|
||||
AvahiRecordBrowser *browser, /* I - Record browser */
|
||||
AvahiIfIndex interfaceIndex,
|
||||
/* I - Interface index (unused) */
|
||||
AvahiProtocol protocol, /* I - Network protocol (unused) */
|
||||
AvahiBrowserEvent event, /* I - What happened? */
|
||||
const char *fullName, /* I - Service name */
|
||||
uint16_t rrclass, /* I - Record class */
|
||||
uint16_t rrtype, /* I - Record type */
|
||||
const void *rdata, /* I - TXT record */
|
||||
size_t rdlen, /* I - Length of TXT record */
|
||||
AvahiLookupResultFlags flags, /* I - Flags */
|
||||
void *context) /* I - Enumeration data */
|
||||
{
|
||||
# ifdef DEBUG
|
||||
AvahiClient *client = avahi_record_browser_get_client(browser);
|
||||
/* Client information */
|
||||
# endif /* DEBUG */
|
||||
# endif /* HAVE_DNSSD */
|
||||
_cups_dnssd_data_t *data = (_cups_dnssd_data_t *)context;
|
||||
/* Enumeration data */
|
||||
char name[1024], /* Service name */
|
||||
@@ -2759,6 +3079,7 @@ cups_dnssd_query_cb(
|
||||
*device; /* Device */
|
||||
|
||||
|
||||
# ifdef HAVE_DNSSD
|
||||
DEBUG_printf(("5cups_dnssd_query_cb(sdRef=%p, flags=%x, "
|
||||
"interfaceIndex=%d, errorCode=%d, fullName=\"%s\", "
|
||||
"rrtype=%u, rrclass=%u, rdlen=%u, rdata=%p, ttl=%u, "
|
||||
@@ -2772,6 +3093,27 @@ cups_dnssd_query_cb(
|
||||
if (errorCode != kDNSServiceErr_NoError || !(flags & kDNSServiceFlagsAdd))
|
||||
return;
|
||||
|
||||
# else /* HAVE_AVAHI */
|
||||
DEBUG_printf(("5cups_dnssd_query_cb(browser=%p, interfaceIndex=%d, "
|
||||
"protocol=%d, event=%d, fullName=\"%s\", rrclass=%u, "
|
||||
"rrtype=%u, rdata=%p, rdlen=%u, flags=%x, context=%p)",
|
||||
browser, interfaceIndex, protocol, event, fullName, rrclass,
|
||||
rrtype, rdata, (unsigned)rdlen, flags, context));
|
||||
|
||||
/*
|
||||
* Only process "add" data...
|
||||
*/
|
||||
|
||||
if (event != AVAHI_BROWSER_NEW)
|
||||
{
|
||||
if (event == AVAHI_BROWSER_FAILURE)
|
||||
DEBUG_printf(("cups_dnssd_query_cb: %s",
|
||||
avahi_strerror(avahi_client_errno(client))));
|
||||
|
||||
return;
|
||||
}
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
/*
|
||||
* Lookup the service in the devices array.
|
||||
*/
|
||||
@@ -2786,8 +3128,7 @@ cups_dnssd_query_cb(
|
||||
if ((device = cupsArrayFind(data->devices, &dkey)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Found it, pull out the priority and make and model from the TXT
|
||||
* record and save it...
|
||||
* Found it, pull out the make and model from the TXT record and save it...
|
||||
*/
|
||||
|
||||
const uint8_t *txt, /* Pointer into data */
|
||||
@@ -2801,11 +3142,13 @@ cups_dnssd_query_cb(
|
||||
model[256], /* Model */
|
||||
uriname[1024], /* Name for URI */
|
||||
uri[1024]; /* Printer URI */
|
||||
cups_ptype_t type; /* Device type */
|
||||
cups_ptype_t type = CUPS_PRINTER_REMOTE | CUPS_PRINTER_BW;
|
||||
/* Printer type */
|
||||
int saw_printer_type = 0;
|
||||
/* Did we see a printer-type key? */
|
||||
|
||||
device->state = _CUPS_DNSSD_PENDING;
|
||||
make_and_model[0] = '\0';
|
||||
type = CUPS_PRINTER_REMOTE;
|
||||
|
||||
strcpy(model, "Unknown");
|
||||
|
||||
@@ -2876,19 +3219,102 @@ cups_dnssd_query_cb(
|
||||
if ((ptr = strchr(model, ',')) != NULL)
|
||||
*ptr = '\0';
|
||||
}
|
||||
else if (!_cups_strcasecmp(key, "note"))
|
||||
device->dest.num_options = cupsAddOption("printer-location", value,
|
||||
device->dest.num_options,
|
||||
&device->dest.options);
|
||||
else if (!_cups_strcasecmp(key, "pdl"))
|
||||
{
|
||||
/*
|
||||
* Look for PDF-capable printers; only PDF-capable printers are shown.
|
||||
*/
|
||||
|
||||
const char *start, *next; /* Pointer into value */
|
||||
int have_pdf = 0; /* Have PDF? */
|
||||
|
||||
for (start = value; start && *start; start = next)
|
||||
{
|
||||
if (!_cups_strncasecmp(start, "application/pdf", 15) &&
|
||||
(!start[15] || start[15] == ','))
|
||||
{
|
||||
have_pdf = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((next = strchr(start, ',')) != NULL)
|
||||
next ++;
|
||||
}
|
||||
|
||||
if (!have_pdf)
|
||||
device->state = _CUPS_DNSSD_INCOMPATIBLE;
|
||||
}
|
||||
else if (!_cups_strcasecmp(key, "printer-type"))
|
||||
{
|
||||
device->dest.num_options = cupsAddOption("printer-type", value,
|
||||
device->dest.num_options,
|
||||
&device->dest.options);
|
||||
type = strtol(value, NULL, 0);
|
||||
/*
|
||||
* Value is either NNNN or 0xXXXX
|
||||
*/
|
||||
|
||||
saw_printer_type = 1;
|
||||
type = strtol(value, NULL, 0);
|
||||
}
|
||||
else if (!saw_printer_type)
|
||||
{
|
||||
if (!_cups_strcasecmp(key, "air") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_AUTHENTICATED;
|
||||
else if (!_cups_strcasecmp(key, "bind") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_BIND;
|
||||
else if (!_cups_strcasecmp(key, "collate") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_COLLATE;
|
||||
else if (!_cups_strcasecmp(key, "color") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_COLOR;
|
||||
else if (!_cups_strcasecmp(key, "copies") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_COPIES;
|
||||
else if (!_cups_strcasecmp(key, "duplex") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_DUPLEX;
|
||||
else if (!_cups_strcasecmp(key, "fax") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_MFP;
|
||||
else if (!_cups_strcasecmp(key, "papercustom") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_VARIABLE;
|
||||
else if (!_cups_strcasecmp(key, "papermax"))
|
||||
{
|
||||
if (!_cups_strcasecmp(value, "legal-a4"))
|
||||
type |= CUPS_PRINTER_SMALL;
|
||||
else if (!_cups_strcasecmp(value, "isoc-a2"))
|
||||
type |= CUPS_PRINTER_MEDIUM;
|
||||
else if (!_cups_strcasecmp(value, ">isoc-a2"))
|
||||
type |= CUPS_PRINTER_LARGE;
|
||||
}
|
||||
else if (!_cups_strcasecmp(key, "punch") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_PUNCH;
|
||||
else if (!_cups_strcasecmp(key, "scan") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_MFP;
|
||||
else if (!_cups_strcasecmp(key, "sort") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_SORT;
|
||||
else if (!_cups_strcasecmp(key, "staple") &&
|
||||
!_cups_strcasecmp(value, "t"))
|
||||
type |= CUPS_PRINTER_STAPLE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the make-and-model...
|
||||
* Save the printer-xxx values...
|
||||
*/
|
||||
|
||||
device->dest.num_options = cupsAddOption("printer-info", name,
|
||||
device->dest.num_options,
|
||||
&device->dest.options);
|
||||
|
||||
if (make_and_model[0])
|
||||
{
|
||||
strlcat(make_and_model, " ", sizeof(make_and_model));
|
||||
@@ -2905,6 +3331,12 @@ cups_dnssd_query_cb(
|
||||
device->dest.num_options,
|
||||
&device->dest.options);
|
||||
|
||||
device->type = type;
|
||||
snprintf(value, sizeof(value), "%u", type);
|
||||
device->dest.num_options = cupsAddOption("printer-type", value,
|
||||
device->dest.num_options,
|
||||
&device->dest.options);
|
||||
|
||||
/*
|
||||
* Save the URI...
|
||||
*/
|
||||
@@ -2912,7 +3344,7 @@ cups_dnssd_query_cb(
|
||||
cups_dnssd_unquote(uriname, device->fullName, sizeof(uriname));
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri),
|
||||
!strcmp(device->regtype, "_ipps._tcp") ? "ipps" : "ipp",
|
||||
NULL, uriname, 0, "/cups");
|
||||
NULL, uriname, 0, saw_printer_type ? "/cups" : "/");
|
||||
|
||||
DEBUG_printf(("6cups_dnssd_query: printer-uri-supported=\"%s\"", uri));
|
||||
|
||||
|
||||
+9
-9
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* This set of APIs abstracts enumeration of directory entries.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -79,7 +79,7 @@ _cups_dir_time(FILETIME ft) /* I - File time */
|
||||
/*
|
||||
* 'cupsDirClose()' - Close a directory.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -110,7 +110,7 @@ cupsDirClose(cups_dir_t *dp) /* I - Directory pointer */
|
||||
/*
|
||||
* 'cupsDirOpen()' - Open a directory.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_dir_t * /* O - Directory pointer or @code NULL@ if the directory could not be opened. */
|
||||
@@ -153,7 +153,7 @@ cupsDirOpen(const char *directory) /* I - Directory name */
|
||||
/*
|
||||
* 'cupsDirRead()' - Read the next directory entry.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_dentry_t * /* O - Directory entry or @code NULL@ if there are no more */
|
||||
@@ -213,7 +213,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
|
||||
/*
|
||||
* 'cupsDirRewind()' - Rewind to the start of the directory.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -263,7 +263,7 @@ struct _cups_dir_s /**** Directory data structure ****/
|
||||
/*
|
||||
* 'cupsDirClose()' - Close a directory.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -290,7 +290,7 @@ cupsDirClose(cups_dir_t *dp) /* I - Directory pointer */
|
||||
/*
|
||||
* 'cupsDirOpen()' - Open a directory.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_dir_t * /* O - Directory pointer or @code NULL@ if the directory could not be opened. */
|
||||
@@ -344,7 +344,7 @@ cupsDirOpen(const char *directory) /* I - Directory name */
|
||||
/*
|
||||
* 'cupsDirRead()' - Read the next directory entry.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_dentry_t * /* O - Directory entry or @code NULL@ when there are no more */
|
||||
@@ -442,7 +442,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
|
||||
/*
|
||||
* 'cupsDirRewind()' - Rewind to the start of the directory.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
|
||||
+22
-10
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* PPD code emission routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -87,7 +87,7 @@ ppdCollect(ppd_file_t *ppd, /* I - PPD file data */
|
||||
* The choices array should be freed using @code free@ when you are
|
||||
* finished with it.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Number of options marked */
|
||||
@@ -260,7 +260,7 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
|
||||
*
|
||||
* When "limit" is zero, this function is identical to ppdEmit().
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
@@ -519,15 +519,27 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
|
||||
*/
|
||||
|
||||
if (display && strcmp(display->value, "job"))
|
||||
{
|
||||
fprintf(fp, "@PJL JOB NAME = \"%s\"\n", temp);
|
||||
|
||||
if (display && !strcmp(display->value, "rdymsg"))
|
||||
fprintf(fp, "@PJL RDYMSG DISPLAY = \"%s\"\n", displaymsg);
|
||||
}
|
||||
else if (display && !strcmp(display->value, "rdymsg"))
|
||||
fprintf(fp, "@PJL RDYMSG DISPLAY = \"%s\"\n", displaymsg);
|
||||
else
|
||||
fprintf(fp, "@PJL JOB NAME = \"%s\" DISPLAY = \"%s\"\n", temp,
|
||||
displaymsg);
|
||||
|
||||
/*
|
||||
* Replace double quotes with single quotes and UTF-8 characters with
|
||||
* question marks so that the user does not cause a PJL syntax error.
|
||||
*/
|
||||
|
||||
strlcpy(temp, user, sizeof(temp));
|
||||
|
||||
for (ptr = temp; *ptr; ptr ++)
|
||||
if (*ptr == '\"')
|
||||
*ptr = '\'';
|
||||
else if (!charset && (*ptr & 128))
|
||||
*ptr = '?';
|
||||
|
||||
fprintf(fp, "@PJL SET USERNAME = \"%s\"\n", temp);
|
||||
}
|
||||
else
|
||||
fputs(ppd->jcl_begin, fp);
|
||||
@@ -542,7 +554,7 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
|
||||
/*
|
||||
* 'ppdEmitJCLEnd()' - Emit JCLEnd code to a file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
@@ -601,7 +613,7 @@ ppdEmitJCLEnd(ppd_file_t *ppd, /* I - PPD file record */
|
||||
* The return string is allocated on the heap and should be freed using
|
||||
* @code free@ when you are done with it.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - String containing option code or @code NULL@ if there is no option code */
|
||||
|
||||
+17
-4
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Option encoding routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -71,13 +71,22 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "hue", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "hue-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 1, "include-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION },
|
||||
{ 0, "job-impressions", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "job-id", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-impressions", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-impressions-completed", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-k-limit", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "job-k-octets", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-k-octets-completed",IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-media-sheets", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-media-sheets-completed", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-page-limit", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "job-priority", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "job-quota-period", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 1, "job-sheets", IPP_TAG_NAME, IPP_TAG_JOB },
|
||||
{ 1, "job-sheets-default", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "job-state", IPP_TAG_ENUM, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-state-message", IPP_TAG_TEXT, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-state-reasons", IPP_TAG_KEYWORD, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-uuid", IPP_TAG_URI, IPP_TAG_JOB },
|
||||
{ 0, "landscape", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ 1, "marker-change-time", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
@@ -179,6 +188,9 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "sides", IPP_TAG_KEYWORD, IPP_TAG_JOB,
|
||||
IPP_TAG_DOCUMENT },
|
||||
{ 0, "sides-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ 0, "time-at-completed", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "time-at-creation", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "time-at-processing", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "wrap", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ 0, "wrap-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "x-dimension", IPP_TAG_INTEGER, IPP_TAG_JOB,
|
||||
@@ -227,7 +239,7 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
|
||||
* function multiple times for each group, or use cupsEncodeOptions()
|
||||
* to add the standard groups.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -539,7 +551,8 @@ cupsEncodeOptions2(
|
||||
else
|
||||
attr->values[j].resolution.yres = attr->values[j].resolution.xres;
|
||||
|
||||
if (!_cups_strcasecmp(s, "dpc"))
|
||||
if (!_cups_strcasecmp(s, "dpc") ||
|
||||
!_cups_strcasecmp(s, "dpcm"))
|
||||
attr->values[j].resolution.units = IPP_RES_PER_CM;
|
||||
else
|
||||
attr->values[j].resolution.units = IPP_RES_PER_INCH;
|
||||
|
||||
+28
-28
@@ -8,7 +8,7 @@
|
||||
* our own file functions allows us to provide transparent support of
|
||||
* gzip'd print files, PPD files, etc.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -352,7 +352,7 @@ _cupsFileCheckFilter(
|
||||
/*
|
||||
* 'cupsFileClose()' - Close a CUPS file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@@ -484,7 +484,7 @@ cupsFileClose(cups_file_t *fp) /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileCompression()' - Return whether a file is compressed.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - @code CUPS_FILE_NONE@ or @code CUPS_FILE_GZIP@ */
|
||||
@@ -497,7 +497,7 @@ cupsFileCompression(cups_file_t *fp) /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileEOF()' - Return the end-of-file status.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on end of file, 0 otherwise */
|
||||
@@ -516,7 +516,7 @@ cupsFileEOF(cups_file_t *fp) /* I - CUPS file */
|
||||
* the supplied paths, @code NULL@ is returned. A @code NULL@ path only
|
||||
* matches the current directory.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - Full path to file or @code NULL@ if not found */
|
||||
@@ -619,7 +619,7 @@ cupsFileFind(const char *filename, /* I - File to find */
|
||||
/*
|
||||
* 'cupsFileFlush()' - Flush pending output.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@@ -667,7 +667,7 @@ cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileGetChar()' - Get a single character from a file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Character or -1 on end of file */
|
||||
@@ -711,7 +711,7 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileGetConf()' - Get a line from a configuration file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Line read or @code NULL@ on end of file or error */
|
||||
@@ -855,7 +855,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
* nul-terminated, however you should use the returned length to determine
|
||||
* the number of bytes on the line.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
size_t /* O - Number of bytes on line or 0 on end of file */
|
||||
@@ -930,7 +930,7 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
/*
|
||||
* 'cupsFileGets()' - Get a CR and/or LF-terminated line.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Line read or @code NULL@ on end of file or error */
|
||||
@@ -1012,7 +1012,7 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileLock()' - Temporarily lock access to a file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@@ -1041,7 +1041,7 @@ cupsFileLock(cups_file_t *fp, /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileNumber()' - Return the file descriptor associated with a CUPS file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - File descriptor */
|
||||
@@ -1070,7 +1070,7 @@ cupsFileNumber(cups_file_t *fp) /* I - CUPS file */
|
||||
* connection as needed, generally preferring IPv6 connections when there is
|
||||
* a choice.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_file_t * /* O - CUPS file or @code NULL@ if the file or socket cannot be opened */
|
||||
@@ -1192,7 +1192,7 @@ cupsFileOpen(const char *filename, /* I - Name of file */
|
||||
* supplied which enables Flate compression of the file. Compression is
|
||||
* not supported for the "a" (append) mode.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_file_t * /* O - CUPS file or @code NULL@ if the file could not be opened */
|
||||
@@ -1304,7 +1304,7 @@ cupsFileOpenFd(int fd, /* I - File descriptor */
|
||||
/*
|
||||
* 'cupsFilePeekChar()' - Peek at the next character from a file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Character or -1 on end of file */
|
||||
@@ -1336,7 +1336,7 @@ cupsFilePeekChar(cups_file_t *fp) /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFilePrintf()' - Write a formatted string.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Number of bytes written or -1 on error */
|
||||
@@ -1433,7 +1433,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFilePutChar()' - Write a character.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@@ -1487,7 +1487,7 @@ cupsFilePutChar(cups_file_t *fp, /* I - CUPS file */
|
||||
*
|
||||
* This function handles any comment escaping of the value.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes written or -1 on error */
|
||||
@@ -1548,7 +1548,7 @@ cupsFilePutConf(cups_file_t *fp, /* I - CUPS file */
|
||||
*
|
||||
* Like the @code fputs@ function, no newline is appended to the string.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Number of bytes written or -1 on error */
|
||||
@@ -1612,7 +1612,7 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileRead()' - Read from a file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes read or -1 on error */
|
||||
@@ -1689,7 +1689,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
* 'cupsFileRewind()' - Set the current file position to the beginning of the
|
||||
* file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
off_t /* O - New file position or -1 on error */
|
||||
@@ -1761,7 +1761,7 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileSeek()' - Seek in a file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
off_t /* O - New file position or -1 on error */
|
||||
@@ -1914,7 +1914,7 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileStderr()' - Return a CUPS file associated with stderr.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_file_t * /* O - CUPS file */
|
||||
@@ -1950,7 +1950,7 @@ cupsFileStderr(void)
|
||||
/*
|
||||
* 'cupsFileStdin()' - Return a CUPS file associated with stdin.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_file_t * /* O - CUPS file */
|
||||
@@ -1980,7 +1980,7 @@ cupsFileStdin(void)
|
||||
/*
|
||||
* 'cupsFileStdout()' - Return a CUPS file associated with stdout.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
cups_file_t * /* O - CUPS file */
|
||||
@@ -2016,7 +2016,7 @@ cupsFileStdout(void)
|
||||
/*
|
||||
* 'cupsFileTell()' - Return the current file position.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
off_t /* O - File position */
|
||||
@@ -2033,7 +2033,7 @@ cupsFileTell(cups_file_t *fp) /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileUnlock()' - Unlock access to a file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@@ -2063,7 +2063,7 @@ cupsFileUnlock(cups_file_t *fp) /* I - CUPS file */
|
||||
/*
|
||||
* 'cupsFileWrite()' - Write to a file.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes written or -1 on error */
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* cupsGetDevices implementation for CUPS.
|
||||
*
|
||||
* Copyright 2008-2011 by Apple Inc.
|
||||
* Copyright 2008-2012 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -34,7 +34,7 @@
|
||||
* parameters provide comma-delimited lists of backends to include or omit from
|
||||
* the request respectively.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
ipp_status_t /* O - Request status - @code IPP_OK@ on success. */
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Get/put file functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -41,7 +41,7 @@
|
||||
*
|
||||
* This function returns @code HTTP_OK@ when the file is successfully retrieved.
|
||||
*
|
||||
* @since CUPS 1.1.20/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.20/OS X 10.4@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
@@ -187,7 +187,7 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
*
|
||||
* This function returns @code HTTP_OK@ when the file is successfully retrieved.
|
||||
*
|
||||
* @since CUPS 1.1.20/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.20/OS X 10.4@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
@@ -255,7 +255,7 @@ cupsGetFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DE
|
||||
* This function returns @code HTTP_CREATED@ when the file is stored
|
||||
* successfully.
|
||||
*
|
||||
* @since CUPS 1.1.20/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.20/OS X 10.4@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
@@ -446,7 +446,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
* This function returns @code HTTP_CREATED@ when the file is stored
|
||||
* successfully.
|
||||
*
|
||||
* @since CUPS 1.1.20/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.20/OS X 10.4@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
|
||||
+55
-24
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Global variable access routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -20,6 +20,7 @@
|
||||
* _cupsGlobals() - Return a pointer to thread local storage
|
||||
* _cupsGlobalUnlock() - Unlock the global mutex.
|
||||
* DllMain() - Main entry for library.
|
||||
* cups_fix_path() - Fix a file path to use forward slashes consistently.
|
||||
* cups_globals_alloc() - Allocate and initialize global data.
|
||||
* cups_globals_free() - Free global data.
|
||||
* cups_globals_init() - Initialize environment variables.
|
||||
@@ -43,16 +44,23 @@ static _cups_threadkey_t cups_globals_key = _CUPS_THREADKEY_INITIALIZER;
|
||||
static pthread_once_t cups_globals_key_once = PTHREAD_ONCE_INIT;
|
||||
/* One-time initialization object */
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
#if defined(HAVE_PTHREAD_H) || defined(WIN32)
|
||||
static _cups_mutex_t cups_global_mutex = _CUPS_MUTEX_INITIALIZER;
|
||||
/* Global critical section */
|
||||
#endif /* HAVE_PTHREAD_H || WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
static void cups_fix_path(char *path);
|
||||
#endif /* WIN32 */
|
||||
static _cups_globals_t *cups_globals_alloc(void);
|
||||
#if defined(HAVE_PTHREAD_H) || defined(WIN32)
|
||||
static void cups_globals_free(_cups_globals_t *g);
|
||||
#endif /* HAVE_PTHREAD_H || WIN32 */
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
static void cups_globals_init(void);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
@@ -187,9 +195,9 @@ cups_globals_alloc(void)
|
||||
#ifdef WIN32
|
||||
HKEY key; /* Registry key */
|
||||
DWORD size; /* Size of string */
|
||||
static char installdir[1024], /* Install directory */
|
||||
confdir[1024], /* Server root directory */
|
||||
localedir[1024]; /* Locale directory */
|
||||
static char installdir[1024] = "", /* Install directory */
|
||||
confdir[1024] = "", /* Server root directory */
|
||||
localedir[1024] = ""; /* Locale directory */
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
@@ -202,37 +210,58 @@ cups_globals_alloc(void)
|
||||
*/
|
||||
|
||||
memset(cg, 0, sizeof(_cups_globals_t));
|
||||
cg->encryption = (http_encryption_t)-1;
|
||||
cg->password_cb = (cups_password_cb2_t)_cupsGetPassword;
|
||||
cg->any_root = 1;
|
||||
cg->expired_certs = 1;
|
||||
cg->expired_root = 1;
|
||||
cg->encryption = (http_encryption_t)-1;
|
||||
cg->password_cb = (cups_password_cb2_t)_cupsGetPassword;
|
||||
cg->any_root = 1;
|
||||
cg->expired_certs = 1;
|
||||
cg->expired_root = 1;
|
||||
cg->server_version = 20;
|
||||
|
||||
/*
|
||||
* Then set directories as appropriate...
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* Open the registry...
|
||||
*/
|
||||
|
||||
strcpy(installdir, "C:/Program Files/cups.org");
|
||||
|
||||
if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\cups.org", 0, KEY_READ,
|
||||
&key))
|
||||
if (!installdir[0])
|
||||
{
|
||||
/*
|
||||
* Grab the installation directory...
|
||||
* Open the registry...
|
||||
*/
|
||||
|
||||
size = sizeof(installdir);
|
||||
RegQueryValueEx(key, "installdir", NULL, NULL, installdir, &size);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
strcpy(installdir, "C:/Program Files/cups.org");
|
||||
|
||||
snprintf(confdir, sizeof(confdir), "%s/conf", installdir);
|
||||
snprintf(localedir, sizeof(localedir), "%s/locale", installdir);
|
||||
if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\cups.org", 0, KEY_READ,
|
||||
&key))
|
||||
{
|
||||
/*
|
||||
* Grab the installation directory...
|
||||
*/
|
||||
|
||||
char *ptr; /* Pointer into installdir */
|
||||
|
||||
size = sizeof(installdir);
|
||||
RegQueryValueEx(key, "installdir", NULL, NULL, installdir, &size);
|
||||
RegCloseKey(key);
|
||||
|
||||
for (ptr = installdir; *ptr;)
|
||||
{
|
||||
if (*ptr == '\\')
|
||||
{
|
||||
if (ptr[1])
|
||||
*ptr++ = '/';
|
||||
else
|
||||
*ptr = '\0'; /* Strip trailing \ */
|
||||
}
|
||||
else if (*ptr == '/' && !ptr[1])
|
||||
*ptr = '\0'; /* Strip trailing / */
|
||||
else
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(confdir, sizeof(confdir), "%s/conf", installdir);
|
||||
snprintf(localedir, sizeof(localedir), "%s/locale", installdir);
|
||||
}
|
||||
|
||||
if ((cg->cups_datadir = getenv("CUPS_DATADIR")) == NULL)
|
||||
cg->cups_datadir = installdir;
|
||||
@@ -298,6 +327,7 @@ cups_globals_alloc(void)
|
||||
* 'cups_globals_free()' - Free global data.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_PTHREAD_H) || defined(WIN32)
|
||||
static void
|
||||
cups_globals_free(_cups_globals_t *cg) /* I - Pointer to global data */
|
||||
{
|
||||
@@ -330,6 +360,7 @@ cups_globals_free(_cups_globals_t *cg) /* I - Pointer to global data */
|
||||
|
||||
free(cg);
|
||||
}
|
||||
#endif /* HAVE_PTHREAD_H || WIN32 */
|
||||
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
|
||||
+10
-12
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* HTTP address routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* 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
|
||||
@@ -34,18 +34,16 @@
|
||||
#ifdef HAVE_RESOLV_H
|
||||
# include <resolv.h>
|
||||
#endif /* HAVE_RESOLV_H */
|
||||
#ifdef HAVE_COREFOUNDATION
|
||||
#ifdef __APPLE__
|
||||
# include <CoreFoundation/CoreFoundation.h>
|
||||
#endif /* HAVE_COREFOUNDATION */
|
||||
#ifdef HAVE_SYSTEMCONFIGURATION
|
||||
# include <SystemConfiguration/SystemConfiguration.h>
|
||||
#endif /* HAVE_SYSTEMCONFIGURATION */
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrAny()' - Check for the "any" address.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 if "any", 0 otherwise */
|
||||
@@ -71,7 +69,7 @@ httpAddrAny(const http_addr_t *addr) /* I - Address to check */
|
||||
/*
|
||||
* 'httpAddrEqual()' - Compare two addresses.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 if equal, 0 if not */
|
||||
@@ -104,7 +102,7 @@ httpAddrEqual(const http_addr_t *addr1, /* I - First address */
|
||||
/*
|
||||
* 'httpAddrLength()' - Return the length of the address in bytes.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Length in bytes */
|
||||
@@ -135,7 +133,7 @@ httpAddrLength(const http_addr_t *addr) /* I - Address */
|
||||
/*
|
||||
* 'httpAddrLocalhost()' - Check for the local loopback address.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 if local host, 0 otherwise */
|
||||
@@ -174,7 +172,7 @@ httpAddrLocalhost(
|
||||
/*
|
||||
* 'httpAddrLookup()' - Lookup the hostname associated with the address.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Host name */
|
||||
@@ -342,7 +340,7 @@ _httpAddrSetPort(http_addr_t *addr, /* I - Address */
|
||||
/*
|
||||
* 'httpAddrString()' - Convert an address to a numeric string.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Numeric address string */
|
||||
@@ -616,7 +614,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
|
||||
* Otherwise, return the FQDN for the local system using both gethostname()
|
||||
* and gethostbyname() to get the local hostname with domain.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - FQDN for connection or system */
|
||||
|
||||
+26
-13
@@ -32,12 +32,15 @@
|
||||
#ifdef HAVE_POLL
|
||||
# include <poll.h>
|
||||
#endif /* HAVE_POLL */
|
||||
#ifndef WIN32
|
||||
# include <sys/fcntl.h>
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrConnect()' - Connect to any of the addresses in the list.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
http_addrlist_t * /* O - Connected address or NULL on failure */
|
||||
@@ -55,7 +58,7 @@ httpAddrConnect(
|
||||
* 'httpAddrConnect2()' - Connect to any of the addresses in the list with a
|
||||
* timeout and optional cancel.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
http_addrlist_t * /* O - Connected address or NULL on failure */
|
||||
@@ -68,6 +71,7 @@ httpAddrConnect2(
|
||||
int val; /* Socket option value */
|
||||
#ifdef O_NONBLOCK
|
||||
socklen_t len; /* Length of value */
|
||||
http_addr_t peer; /* Peer address */
|
||||
int flags, /* Socket flags */
|
||||
remaining; /* Remaining timeout */
|
||||
# ifdef HAVE_POLL
|
||||
@@ -97,7 +101,7 @@ httpAddrConnect2(
|
||||
if (cancel && *cancel)
|
||||
return (NULL);
|
||||
|
||||
if (msec <= 0)
|
||||
if (msec <= 0 || getenv("CUPS_DISABLE_ASYNC_CONNECT"))
|
||||
msec = INT_MAX;
|
||||
|
||||
/*
|
||||
@@ -106,6 +110,9 @@ httpAddrConnect2(
|
||||
|
||||
while (addrlist)
|
||||
{
|
||||
if (cancel && *cancel)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Create the socket...
|
||||
*/
|
||||
@@ -177,8 +184,12 @@ httpAddrConnect2(
|
||||
DEBUG_printf(("httpAddrConnect2: Setting non-blocking connect()"));
|
||||
|
||||
flags = fcntl(*sock, F_GETFL, 0);
|
||||
if (msec > 0)
|
||||
if (msec != INT_MAX)
|
||||
{
|
||||
DEBUG_puts("httpAddrConnect2: Setting non-blocking connect()");
|
||||
|
||||
fcntl(*sock, F_SETFL, flags | O_NONBLOCK);
|
||||
}
|
||||
#endif /* O_NONBLOCK */
|
||||
|
||||
/*
|
||||
@@ -201,13 +212,16 @@ httpAddrConnect2(
|
||||
|
||||
#ifdef O_NONBLOCK
|
||||
# ifdef WIN32
|
||||
if (errno == WSAEINPROGRESS)
|
||||
if (WSAGetLastError() == WSAEINPROGRESS ||
|
||||
WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
# else
|
||||
if (errno == EINPROGRESS)
|
||||
if (errno == EINPROGRESS || errno == EWOULDBLOCK)
|
||||
# endif /* WIN32 */
|
||||
{
|
||||
DEBUG_puts("1httpAddrConnect2: Finishing async connect()");
|
||||
|
||||
fcntl(*sock, F_SETFL, flags);
|
||||
|
||||
for (remaining = msec; remaining > 0; remaining -= 250)
|
||||
{
|
||||
do
|
||||
@@ -263,14 +277,13 @@ httpAddrConnect2(
|
||||
|
||||
if (nfds > 0)
|
||||
{
|
||||
len = sizeof(val);
|
||||
if (getsockopt(*sock, SOL_SOCKET, SO_ERROR, &val, &len) >= 0)
|
||||
len = sizeof(peer);
|
||||
if (!getpeername(*sock, (struct sockaddr *)&peer, &len))
|
||||
{
|
||||
DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...",
|
||||
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
|
||||
_httpAddrPort(&(addrlist->addr))));
|
||||
httpAddrString(&peer, temp, sizeof(temp)),
|
||||
_httpAddrPort(&peer)));
|
||||
|
||||
fcntl(*sock, F_SETFL, flags);
|
||||
return (addrlist);
|
||||
}
|
||||
|
||||
@@ -317,7 +330,7 @@ httpAddrConnect2(
|
||||
/*
|
||||
* 'httpAddrFreeList()' - Free an address list.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -345,7 +358,7 @@ httpAddrFreeList(
|
||||
/*
|
||||
* 'httpAddrGetList()' - Get a list of addresses for a hostname.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
http_addrlist_t * /* O - List of addresses or NULL */
|
||||
|
||||
+2
-16
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Private HTTP definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -44,29 +44,14 @@
|
||||
# ifdef HAVE_GSSAPI
|
||||
# ifdef HAVE_GSS_GSSAPI_H
|
||||
# include <GSS/gssapi.h>
|
||||
# ifdef HAVE_GSSAPI_GENERIC_H
|
||||
# include <GSS/gssapi_generic.h>
|
||||
# endif /* HAVE_GSSAPI_GENERIC_H */
|
||||
# ifdef HAVE_GSSAPI_KRB5_H
|
||||
# include <GSS/gssapi_krb5.h>
|
||||
# endif /* HAVE_GSSAPI_KRB5_H */
|
||||
# elif defined(HAVE_GSSAPI_GSSAPI_H)
|
||||
# include <gssapi/gssapi.h>
|
||||
# ifdef HAVE_GSSAPI_GENERIC_H
|
||||
# include <gssapi/gssapi_generic.h>
|
||||
# endif /* HAVE_GSSAPI_GENERIC_H */
|
||||
# ifdef HAVE_GSSAPI_KRB5_H
|
||||
# include <gssapi/gssapi_krb5.h>
|
||||
# endif /* HAVE_GSSAPI_KRB5_H */
|
||||
# elif defined(HAVE_GSSAPI_H)
|
||||
# include <gssapi.h>
|
||||
# endif /* HAVE_GSS_GSSAPI_H */
|
||||
# ifndef HAVE_GSS_C_NT_HOSTBASED_SERVICE
|
||||
# define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
|
||||
# endif /* !HAVE_GSS_C_NT_HOSTBASED_SERVICE */
|
||||
# ifdef HAVE_KRB5_H
|
||||
# include <krb5.h>
|
||||
# endif /* HAVE_KRB5_H */
|
||||
# endif /* HAVE_GSSAPI */
|
||||
|
||||
# ifdef HAVE_AUTHORIZATION_H
|
||||
@@ -154,6 +139,7 @@ extern "C" {
|
||||
#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? */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+473
-89
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* HTTP support routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -16,33 +16,37 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* httpAssembleURI() - Assemble a uniform resource identifier from its
|
||||
* components.
|
||||
* httpAssembleURI() - Assemble a uniform resource identifier from its
|
||||
* components.
|
||||
* httpAssembleURIf() - Assemble a uniform resource identifier from its
|
||||
* components with a formatted resource.
|
||||
* components with a formatted resource.
|
||||
* _httpAssembleUUID() - Make a UUID URI conforming to RFC 4122.
|
||||
* httpDecode64() - Base64-decode a string.
|
||||
* httpDecode64_2() - Base64-decode a string.
|
||||
* httpEncode64() - Base64-encode a string.
|
||||
* httpEncode64_2() - Base64-encode a string.
|
||||
* httpDecode64() - Base64-decode a string.
|
||||
* httpDecode64_2() - Base64-decode a string.
|
||||
* httpEncode64() - Base64-encode a string.
|
||||
* httpEncode64_2() - Base64-encode a string.
|
||||
* httpGetDateString() - Get a formatted date/time string from a time value.
|
||||
* httpGetDateString2() - Get a formatted date/time string from a time value.
|
||||
* httpGetDateTime() - Get a time value from a formatted date/time string.
|
||||
* httpSeparate() - Separate a Universal Resource Identifier into its
|
||||
* components.
|
||||
* httpSeparate2() - Separate a Universal Resource Identifier into its
|
||||
* components.
|
||||
* httpSeparateURI() - Separate a Universal Resource Identifier into its
|
||||
* components.
|
||||
* httpStatus() - Return a short string describing a HTTP status code.
|
||||
* _cups_hstrerror() - hstrerror() emulation function for Solaris and
|
||||
* others.
|
||||
* _httpDecodeURI() - Percent-decode a HTTP request URI.
|
||||
* _httpEncodeURI() - Percent-encode a HTTP request URI.
|
||||
* _httpResolveURI() - Resolve a DNS-SD URI.
|
||||
* httpGetDateTime() - Get a time value from a formatted date/time string.
|
||||
* httpSeparate() - Separate a Universal Resource Identifier into its
|
||||
* components.
|
||||
* httpSeparate2() - Separate a Universal Resource Identifier into its
|
||||
* components.
|
||||
* httpSeparateURI() - Separate a Universal Resource Identifier into its
|
||||
* components.
|
||||
* httpStatus() - Return a short string describing a HTTP status
|
||||
* code.
|
||||
* _cups_hstrerror() - hstrerror() emulation function for Solaris and
|
||||
* others.
|
||||
* _httpDecodeURI() - Percent-decode a HTTP request URI.
|
||||
* _httpEncodeURI() - Percent-encode a HTTP request URI.
|
||||
* _httpResolveURI() - Resolve a DNS-SD URI.
|
||||
* http_client_cb() - Client callback for resolving URI.
|
||||
* http_copy_decode() - Copy and decode a URI.
|
||||
* http_copy_encode() - Copy and encode a URI.
|
||||
* http_resolve_cb() - Build a device URI for the given service name.
|
||||
* http_poll_cb() - Wait for input on the specified file descriptors.
|
||||
* http_resolve_cb() - Build a device URI for the given service name.
|
||||
* http_resolve_cb() - Build a device URI for the given service name.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -59,6 +63,10 @@
|
||||
# else
|
||||
# include <sys/select.h>
|
||||
# endif /* WIN32 */
|
||||
#elif defined(HAVE_AVAHI)
|
||||
# include <avahi-client/client.h>
|
||||
# include <avahi-client/lookup.h>
|
||||
# include <avahi-common/simple-watch.h>
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
|
||||
@@ -68,9 +76,13 @@
|
||||
|
||||
typedef struct _http_uribuf_s /* URI buffer */
|
||||
{
|
||||
char *buffer; /* Pointer to buffer */
|
||||
size_t bufsize; /* Size of buffer */
|
||||
int options; /* Options passed to _httpResolveURI */
|
||||
#ifdef HAVE_AVAHI
|
||||
AvahiSimplePoll *poll; /* Poll state */
|
||||
#endif /* HAVE_AVAHI */
|
||||
char *buffer; /* Pointer to buffer */
|
||||
size_t bufsize; /* Size of buffer */
|
||||
int options; /* Options passed to _httpResolveURI */
|
||||
const char *resource; /* Resource from URI */
|
||||
} _http_uribuf_t;
|
||||
|
||||
|
||||
@@ -127,6 +139,22 @@ static void DNSSD_API http_resolve_cb(DNSServiceRef sdRef,
|
||||
void *context);
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
#ifdef HAVE_AVAHI
|
||||
static void http_client_cb(AvahiClient *client,
|
||||
AvahiClientState state, void *simple_poll);
|
||||
static int http_poll_cb(struct pollfd *pollfds, unsigned int num_pollfds,
|
||||
int timeout, void *context);
|
||||
static void http_resolve_cb(AvahiServiceResolver *resolver,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiResolverEvent event,
|
||||
const char *name, const char *type,
|
||||
const char *domain, const char *host_name,
|
||||
const AvahiAddress *address, uint16_t port,
|
||||
AvahiStringList *txt,
|
||||
AvahiLookupResultFlags flags, void *context);
|
||||
#endif /* HAVE_AVAHI */
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAssembleURI()' - Assemble a uniform resource identifier from its
|
||||
@@ -137,7 +165,7 @@ static void DNSSD_API http_resolve_cb(DNSServiceRef sdRef,
|
||||
* place of traditional string functions whenever you need to create a
|
||||
* URI string.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
http_uri_status_t /* O - URI status */
|
||||
@@ -299,8 +327,7 @@ httpAssembleURI(
|
||||
/*
|
||||
* Otherwise, just copy the host string...
|
||||
*/
|
||||
|
||||
ptr = http_copy_encode(ptr, host, end, ":/?#[]@\\\"", NULL,
|
||||
ptr = http_copy_encode(ptr, host, end, "<>{}|^:/?#[]@\\\"", NULL,
|
||||
encoding & HTTP_URI_CODING_HOSTNAME);
|
||||
|
||||
if (!ptr)
|
||||
@@ -387,7 +414,7 @@ httpAssembleURI(
|
||||
* this function in place of traditional string functions whenever
|
||||
* you need to create a URI string.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
http_uri_status_t /* O - URI status */
|
||||
@@ -517,7 +544,7 @@ httpDecode64(char *out, /* I - String to write to */
|
||||
/*
|
||||
* 'httpDecode64_2()' - Base64-decode a string.
|
||||
*
|
||||
* @since CUPS 1.1.21/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.21/OS X 10.4@
|
||||
*/
|
||||
|
||||
char * /* O - Decoded string */
|
||||
@@ -636,7 +663,7 @@ httpEncode64(char *out, /* I - String to write to */
|
||||
/*
|
||||
* 'httpEncode64_2()' - Base64-encode a string.
|
||||
*
|
||||
* @since CUPS 1.1.21/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.21/OS X 10.4@
|
||||
*/
|
||||
|
||||
char * /* O - Encoded string */
|
||||
@@ -745,7 +772,7 @@ httpGetDateString(time_t t) /* I - UNIX time */
|
||||
/*
|
||||
* 'httpGetDateString2()' - Get a formatted date/time string from a time value.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - Date/time string */
|
||||
@@ -757,10 +784,13 @@ httpGetDateString2(time_t t, /* I - UNIX time */
|
||||
|
||||
|
||||
tdate = gmtime(&t);
|
||||
snprintf(s, slen, "%s, %02d %s %d %02d:%02d:%02d GMT",
|
||||
http_days[tdate->tm_wday], tdate->tm_mday,
|
||||
http_months[tdate->tm_mon], tdate->tm_year + 1900,
|
||||
tdate->tm_hour, tdate->tm_min, tdate->tm_sec);
|
||||
if (tdate)
|
||||
snprintf(s, slen, "%s, %02d %s %d %02d:%02d:%02d GMT",
|
||||
http_days[tdate->tm_wday], tdate->tm_mday,
|
||||
http_months[tdate->tm_mon], tdate->tm_year + 1900,
|
||||
tdate->tm_hour, tdate->tm_min, tdate->tm_sec);
|
||||
else
|
||||
s[0] = '\0';
|
||||
|
||||
return (s);
|
||||
}
|
||||
@@ -862,7 +892,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
|
||||
*
|
||||
* This function is deprecated; use the httpSeparateURI() function instead.
|
||||
*
|
||||
* @since CUPS 1.1.21/Mac OS X 10.4@
|
||||
* @since CUPS 1.1.21/OS X 10.4@
|
||||
* @deprecated@
|
||||
*/
|
||||
|
||||
@@ -887,7 +917,7 @@ httpSeparate2(const char *uri, /* I - Universal Resource Identifier */
|
||||
* 'httpSeparateURI()' - Separate a Universal Resource Identifier into its
|
||||
* components.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
http_uri_status_t /* O - Result of separation */
|
||||
@@ -1431,24 +1461,29 @@ _httpResolveURI(
|
||||
|
||||
if (strstr(hostname, "._tcp"))
|
||||
{
|
||||
#ifdef HAVE_DNSSD
|
||||
# ifdef WIN32
|
||||
# pragma comment(lib, "dnssd.lib")
|
||||
# endif /* WIN32 */
|
||||
DNSServiceRef ref, /* DNS-SD master service reference */
|
||||
domainref, /* DNS-SD service reference for domain */
|
||||
localref; /* DNS-SD service reference for .local */
|
||||
int domainsent = 0, /* Send the domain resolve? */
|
||||
offline = 0; /* offline-report state set? */
|
||||
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
||||
char *regtype, /* Pointer to type in hostname */
|
||||
*domain; /* Pointer to domain in hostname */
|
||||
_http_uribuf_t uribuf; /* URI buffer */
|
||||
#ifdef HAVE_POLL
|
||||
int offline = 0; /* offline-report state set? */
|
||||
# ifdef HAVE_DNSSD
|
||||
# ifdef WIN32
|
||||
# pragma comment(lib, "dnssd.lib")
|
||||
# endif /* WIN32 */
|
||||
DNSServiceRef ref, /* DNS-SD master service reference */
|
||||
domainref, /* DNS-SD service reference for domain */
|
||||
localref; /* DNS-SD service reference for .local */
|
||||
int domainsent = 0; /* Send the domain resolve? */
|
||||
# ifdef HAVE_POLL
|
||||
struct pollfd polldata; /* Polling data */
|
||||
#else /* select() */
|
||||
# else /* select() */
|
||||
fd_set input_set; /* Input set for select() */
|
||||
struct timeval stimeout; /* Timeout value for select() */
|
||||
#endif /* HAVE_POLL */
|
||||
# endif /* HAVE_POLL */
|
||||
# elif defined(HAVE_AVAHI)
|
||||
AvahiClient *client; /* Client information */
|
||||
int error; /* Status */
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
if (options & _HTTP_RESOLVE_STDERR)
|
||||
fprintf(stderr, "DEBUG: Resolving \"%s\"...\n", hostname);
|
||||
@@ -1488,6 +1523,8 @@ _httpResolveURI(
|
||||
uribuf.buffer = resolved_uri;
|
||||
uribuf.bufsize = resolved_size;
|
||||
uribuf.options = options;
|
||||
uribuf.resource = resource;
|
||||
|
||||
resolved_uri[0] = '\0';
|
||||
|
||||
DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
|
||||
@@ -1501,18 +1538,22 @@ _httpResolveURI(
|
||||
|
||||
uri = NULL;
|
||||
|
||||
# ifdef HAVE_DNSSD
|
||||
if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
|
||||
{
|
||||
localref = ref;
|
||||
if (DNSServiceResolve(&localref, kDNSServiceFlagsShareConnection, 0,
|
||||
hostname, regtype, "local.", http_resolve_cb,
|
||||
if (DNSServiceResolve(&localref,
|
||||
kDNSServiceFlagsShareConnection, 0, hostname, regtype,
|
||||
"local.", http_resolve_cb,
|
||||
&uribuf) == kDNSServiceErr_NoError)
|
||||
{
|
||||
int fds; /* Number of ready descriptors */
|
||||
time_t timeout, /* Poll timeout */
|
||||
start_time = time(NULL);/* Start time */
|
||||
start_time = time(NULL),/* Start time */
|
||||
end_time = start_time + 90;
|
||||
/* End time */
|
||||
|
||||
for (;;)
|
||||
while (time(NULL) < end_time)
|
||||
{
|
||||
if (options & _HTTP_RESOLVE_STDERR)
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Looking for printer."));
|
||||
@@ -1524,28 +1565,32 @@ _httpResolveURI(
|
||||
}
|
||||
|
||||
/*
|
||||
* For the first minute (or forever if we have a callback), wakeup
|
||||
* every 2 seconds to emit a "looking for printer" message...
|
||||
* Wakeup every 2 seconds to emit a "looking for printer" message...
|
||||
*/
|
||||
|
||||
timeout = (time(NULL) < (start_time + 60) || cb) ? 2000 : -1;
|
||||
if ((timeout = end_time - time(NULL)) > 2)
|
||||
timeout = 2;
|
||||
|
||||
#ifdef HAVE_POLL
|
||||
# ifdef HAVE_POLL
|
||||
polldata.fd = DNSServiceRefSockFD(ref);
|
||||
polldata.events = POLLIN;
|
||||
|
||||
fds = poll(&polldata, 1, timeout);
|
||||
fds = poll(&polldata, 1, 1000 * timeout);
|
||||
|
||||
#else /* select() */
|
||||
# else /* select() */
|
||||
FD_ZERO(&input_set);
|
||||
FD_SET(DNSServiceRefSockFD(ref), &input_set);
|
||||
|
||||
stimeout.tv_sec = ((int)timeout) / 1000;
|
||||
stimeout.tv_usec = ((int)(timeout) * 1000) % 1000000;
|
||||
# ifdef WIN32
|
||||
stimeout.tv_sec = (long)timeout;
|
||||
# else
|
||||
stimeout.tv_sec = timeout;
|
||||
# endif /* WIN32 */
|
||||
stimeout.tv_usec = 0;
|
||||
|
||||
fds = select(DNSServiceRefSockFD(ref)+1, &input_set, NULL, NULL,
|
||||
timeout < 0.0 ? NULL : &stimeout);
|
||||
#endif /* HAVE_POLL */
|
||||
&stimeout);
|
||||
# endif /* HAVE_POLL */
|
||||
|
||||
if (fds < 0)
|
||||
{
|
||||
@@ -1562,7 +1607,7 @@ _httpResolveURI(
|
||||
* comes in, do an additional domain resolution...
|
||||
*/
|
||||
|
||||
if (domainsent == 0 && (domain && _cups_strcasecmp(domain, "local.")))
|
||||
if (domainsent == 0 && domain && _cups_strcasecmp(domain, "local."))
|
||||
{
|
||||
if (options & _HTTP_RESOLVE_STDERR)
|
||||
fprintf(stderr,
|
||||
@@ -1571,10 +1616,11 @@ _httpResolveURI(
|
||||
domain ? domain : "");
|
||||
|
||||
domainref = ref;
|
||||
if (DNSServiceResolve(&domainref, kDNSServiceFlagsShareConnection,
|
||||
if (DNSServiceResolve(&domainref,
|
||||
kDNSServiceFlagsShareConnection,
|
||||
0, hostname, regtype, domain,
|
||||
http_resolve_cb, &uribuf)
|
||||
== kDNSServiceErr_NoError)
|
||||
http_resolve_cb,
|
||||
&uribuf) == kDNSServiceErr_NoError)
|
||||
domainsent = 1;
|
||||
}
|
||||
|
||||
@@ -1608,24 +1654,96 @@ _httpResolveURI(
|
||||
|
||||
DNSServiceRefDeallocate(ref);
|
||||
}
|
||||
# else /* HAVE_AVAHI */
|
||||
if ((uribuf.poll = avahi_simple_poll_new()) != NULL)
|
||||
{
|
||||
avahi_simple_poll_set_func(uribuf.poll, http_poll_cb, NULL);
|
||||
|
||||
if ((client = avahi_client_new(avahi_simple_poll_get(uribuf.poll),
|
||||
0, http_client_cb,
|
||||
&uribuf, &error)) != NULL)
|
||||
{
|
||||
if (avahi_service_resolver_new(client, AVAHI_IF_UNSPEC,
|
||||
AVAHI_PROTO_UNSPEC, hostname,
|
||||
regtype, "local.", AVAHI_PROTO_UNSPEC, 0,
|
||||
http_resolve_cb, &uribuf) != NULL)
|
||||
{
|
||||
time_t start_time = time(NULL),
|
||||
/* Start time */
|
||||
end_time = start_time + 90;
|
||||
/* End time */
|
||||
int pstatus; /* Poll status */
|
||||
|
||||
pstatus = avahi_simple_poll_iterate(uribuf.poll, 2000);
|
||||
|
||||
if (pstatus == 0 && !resolved_uri[0] && domain &&
|
||||
_cups_strcasecmp(domain, "local."))
|
||||
{
|
||||
/*
|
||||
* Resolve for .local hasn't returned anything, try the listed
|
||||
* domain...
|
||||
*/
|
||||
|
||||
avahi_service_resolver_new(client, AVAHI_IF_UNSPEC,
|
||||
AVAHI_PROTO_UNSPEC, hostname,
|
||||
regtype, domain, AVAHI_PROTO_UNSPEC, 0,
|
||||
http_resolve_cb, &uribuf);
|
||||
}
|
||||
|
||||
while (!pstatus && !resolved_uri[0] && time(NULL) < end_time)
|
||||
{
|
||||
if ((pstatus = avahi_simple_poll_iterate(uribuf.poll, 2000)) != 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
* If it hasn't resolved within 5 seconds set the offline-report
|
||||
* printer-state-reason...
|
||||
*/
|
||||
|
||||
if ((options & _HTTP_RESOLVE_STDERR) && offline == 0 &&
|
||||
time(NULL) > (start_time + 5))
|
||||
{
|
||||
fputs("STATE: +offline-report\n", stderr);
|
||||
offline = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Collect the result (if we got one).
|
||||
*/
|
||||
|
||||
if (resolved_uri[0])
|
||||
uri = resolved_uri;
|
||||
}
|
||||
|
||||
avahi_client_free(client);
|
||||
}
|
||||
|
||||
avahi_simple_poll_free(uribuf.poll);
|
||||
}
|
||||
# endif /* HAVE_DNSSD */
|
||||
|
||||
if (options & _HTTP_RESOLVE_STDERR)
|
||||
{
|
||||
if (uri)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Resolved as \"%s\"...\n", uri);
|
||||
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs("DEBUG: Unable to resolve URI\n", stderr);
|
||||
|
||||
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* HAVE_DNSSD || HAVE_AVAHI */
|
||||
/*
|
||||
* No DNS-SD support...
|
||||
*/
|
||||
|
||||
uri = NULL;
|
||||
#endif /* HAVE_DNSSD */
|
||||
#endif /* HAVE_DNSSD || HAVE_AVAHI */
|
||||
|
||||
if ((options & _HTTP_RESOLVE_STDERR) && !uri)
|
||||
_cupsLangPrintFilter(stderr, "ERROR", _("Unable to find printer."));
|
||||
@@ -1646,6 +1764,35 @@ _httpResolveURI(
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_AVAHI
|
||||
/*
|
||||
* 'http_client_cb()' - Client callback for resolving URI.
|
||||
*/
|
||||
|
||||
static void
|
||||
http_client_cb(
|
||||
AvahiClient *client, /* I - Client information */
|
||||
AvahiClientState state, /* I - Current state */
|
||||
void *context) /* I - Pointer to URI buffer */
|
||||
{
|
||||
DEBUG_printf(("7http_client_cb(client=%p, state=%d, context=%p)", client,
|
||||
state, context));
|
||||
|
||||
/*
|
||||
* If the connection drops, quit.
|
||||
*/
|
||||
|
||||
if (state == AVAHI_CLIENT_FAILURE)
|
||||
{
|
||||
_http_uribuf_t *uribuf = (_http_uribuf_t *)context;
|
||||
/* URI buffer */
|
||||
|
||||
avahi_simple_poll_quit(uribuf->poll);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_AVAHI */
|
||||
|
||||
|
||||
/*
|
||||
* 'http_copy_decode()' - Copy and decode a URI.
|
||||
*/
|
||||
@@ -1704,6 +1851,11 @@ http_copy_decode(char *dst, /* O - Destination buffer */
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
else if ((*src & 255) <= 0x20 || (*src & 255) >= 0x7f)
|
||||
{
|
||||
*ptr = '\0';
|
||||
return (NULL);
|
||||
}
|
||||
else
|
||||
*ptr++ = *src;
|
||||
}
|
||||
@@ -1781,13 +1933,16 @@ http_resolve_cb(
|
||||
const unsigned char *txtRecord, /* I - TXT record data */
|
||||
void *context) /* I - Pointer to URI buffer */
|
||||
{
|
||||
_http_uribuf_t *uribuf = (_http_uribuf_t *)context;
|
||||
/* URI buffer */
|
||||
const char *scheme, /* URI scheme */
|
||||
*hostptr; /* Pointer into hostTarget */
|
||||
char rp[257], /* Remote printer */
|
||||
*hostptr, /* Pointer into hostTarget */
|
||||
*reskey, /* "rp" or "rfo" */
|
||||
*resdefault; /* Default path */
|
||||
char resource[257], /* Remote path */
|
||||
fqdn[256]; /* FQDN of the .local name */
|
||||
const void *value; /* Value from TXT record */
|
||||
uint8_t valueLen; /* Length of value */
|
||||
_http_uribuf_t *uribuf; /* URI buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("7http_resolve_cb(sdRef=%p, flags=%x, interfaceIndex=%u, "
|
||||
@@ -1796,8 +1951,6 @@ http_resolve_cb(
|
||||
interfaceIndex, errorCode, fullName, hostTarget, port, txtLen,
|
||||
txtRecord, context));
|
||||
|
||||
uribuf = (_http_uribuf_t *)context;
|
||||
|
||||
/*
|
||||
* Figure out the scheme from the full name...
|
||||
*/
|
||||
@@ -1821,17 +1974,29 @@ http_resolve_cb(
|
||||
* Extract the "remote printer" key from the TXT record...
|
||||
*/
|
||||
|
||||
if ((value = TXTRecordGetValuePtr(txtLen, txtRecord, "rp",
|
||||
if ((uribuf->options & _HTTP_RESOLVE_FAXOUT) &&
|
||||
(!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")))
|
||||
{
|
||||
reskey = "rfo";
|
||||
resdefault = "/ipp/faxout";
|
||||
}
|
||||
else
|
||||
{
|
||||
reskey = "rp";
|
||||
resdefault = "/";
|
||||
}
|
||||
|
||||
if ((value = TXTRecordGetValuePtr(txtLen, txtRecord, reskey,
|
||||
&valueLen)) != NULL)
|
||||
{
|
||||
if (((char *)value)[0] == '/')
|
||||
{
|
||||
/*
|
||||
* "rp" value (incorrectly) has a leading slash already...
|
||||
* Value (incorrectly) has a leading slash already...
|
||||
*/
|
||||
|
||||
memcpy(rp, value, valueLen);
|
||||
rp[valueLen] = '\0';
|
||||
memcpy(resource, value, valueLen);
|
||||
resource[valueLen] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1839,19 +2004,18 @@ http_resolve_cb(
|
||||
* Convert to resource by concatenating with a leading "/"...
|
||||
*/
|
||||
|
||||
rp[0] = '/';
|
||||
memcpy(rp + 1, value, valueLen);
|
||||
rp[valueLen + 1] = '\0';
|
||||
resource[0] = '/';
|
||||
memcpy(resource + 1, value, valueLen);
|
||||
resource[valueLen + 1] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Default "rp" value is blank, mapping to a path of "/"...
|
||||
* Use the default value...
|
||||
*/
|
||||
|
||||
rp[0] = '/';
|
||||
rp[1] = '\0';
|
||||
strlcpy(resource, resdefault, sizeof(resource));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1899,6 +2063,8 @@ http_resolve_cb(
|
||||
error));
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
httpAddrFreeList(addrlist);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1906,11 +2072,229 @@ http_resolve_cb(
|
||||
* Assemble the final device URI...
|
||||
*/
|
||||
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, uribuf->bufsize, scheme,
|
||||
NULL, hostTarget, ntohs(port), rp);
|
||||
if ((!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")) &&
|
||||
!strcmp(uribuf->resource, "/cups"))
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uribuf->buffer, uribuf->bufsize,
|
||||
scheme, NULL, hostTarget, ntohs(port), "%s?snmp=false",
|
||||
resource);
|
||||
else
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, uribuf->bufsize,
|
||||
scheme, NULL, hostTarget, ntohs(port), resource);
|
||||
|
||||
DEBUG_printf(("8http_resolve_cb: Resolved URI is \"%s\"...", uribuf->buffer));
|
||||
}
|
||||
|
||||
#elif defined(HAVE_AVAHI)
|
||||
/*
|
||||
* 'http_poll_cb()' - Wait for input on the specified file descriptors.
|
||||
*
|
||||
* Note: This function is needed because avahi_simple_poll_iterate is broken
|
||||
* and always uses a timeout of 0 (!) milliseconds.
|
||||
* (Avahi Ticket #364)
|
||||
*/
|
||||
|
||||
static int /* O - Number of file descriptors matching */
|
||||
http_poll_cb(
|
||||
struct pollfd *pollfds, /* I - File descriptors */
|
||||
unsigned int num_pollfds, /* I - Number of file descriptors */
|
||||
int timeout, /* I - Timeout in milliseconds (used) */
|
||||
void *context) /* I - User data (unused) */
|
||||
{
|
||||
(void)timeout;
|
||||
(void)context;
|
||||
|
||||
return (poll(pollfds, num_pollfds, 2000));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'http_resolve_cb()' - Build a device URI for the given service name.
|
||||
*/
|
||||
|
||||
static void
|
||||
http_resolve_cb(
|
||||
AvahiServiceResolver *resolver, /* I - Resolver (unused) */
|
||||
AvahiIfIndex interface, /* I - Interface index (unused) */
|
||||
AvahiProtocol protocol, /* I - Network protocol (unused) */
|
||||
AvahiResolverEvent event, /* I - Event (found, etc.) */
|
||||
const char *name, /* I - Service name */
|
||||
const char *type, /* I - Registration type */
|
||||
const char *domain, /* I - Domain (unused) */
|
||||
const char *hostTarget, /* I - Hostname */
|
||||
const AvahiAddress *address, /* I - Address (unused) */
|
||||
uint16_t port, /* I - Port number */
|
||||
AvahiStringList *txt, /* I - TXT record */
|
||||
AvahiLookupResultFlags flags, /* I - Lookup flags (unused) */
|
||||
void *context) /* I - Pointer to URI buffer */
|
||||
{
|
||||
_http_uribuf_t *uribuf = (_http_uribuf_t *)context;
|
||||
/* URI buffer */
|
||||
const char *scheme, /* URI scheme */
|
||||
*hostptr, /* Pointer into hostTarget */
|
||||
*reskey, /* "rp" or "rfo" */
|
||||
*resdefault; /* Default path */
|
||||
char resource[257], /* Remote path */
|
||||
fqdn[256]; /* FQDN of the .local name */
|
||||
AvahiStringList *pair; /* Current TXT record key/value pair */
|
||||
char *value; /* Value for "rp" key */
|
||||
size_t valueLen = 0; /* Length of "rp" key */
|
||||
|
||||
|
||||
DEBUG_printf(("7http_resolve_cb(resolver=%p, "
|
||||
"interface=%d, protocol=%d, event=%d, name=\"%s\", "
|
||||
"type=\"%s\", domain=\"%s\", hostTarget=\"%s\", address=%p, "
|
||||
"port=%d, txt=%p, flags=%d, context=%p)",
|
||||
resolver, interface, protocol, event, name, type, domain,
|
||||
hostTarget, address, port, txt, flags, context));
|
||||
|
||||
if (event != AVAHI_RESOLVER_FOUND)
|
||||
{
|
||||
avahi_service_resolver_free(resolver);
|
||||
avahi_simple_poll_quit(uribuf->poll);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Figure out the scheme from the full name...
|
||||
*/
|
||||
|
||||
if (strstr(type, "_ipp."))
|
||||
scheme = "ipp";
|
||||
else if (strstr(type, "_printer."))
|
||||
scheme = "lpd";
|
||||
else if (strstr(type, "_pdl-datastream."))
|
||||
scheme = "socket";
|
||||
else
|
||||
scheme = "riousbprint";
|
||||
|
||||
if (!strncmp(type, "_ipps.", 6) || !strncmp(type, "_ipp-tls.", 9))
|
||||
scheme = "ipps";
|
||||
else if (!strncmp(type, "_ipp.", 5) || !strncmp(type, "_fax-ipp.", 9))
|
||||
scheme = "ipp";
|
||||
else if (!strncmp(type, "_http.", 6))
|
||||
scheme = "http";
|
||||
else if (!strncmp(type, "_https.", 7))
|
||||
scheme = "https";
|
||||
else if (!strncmp(type, "_printer.", 9))
|
||||
scheme = "lpd";
|
||||
else if (!strncmp(type, "_pdl-datastream.", 16))
|
||||
scheme = "socket";
|
||||
else
|
||||
{
|
||||
avahi_service_resolver_free(resolver);
|
||||
avahi_simple_poll_quit(uribuf->poll);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the remote resource key from the TXT record...
|
||||
*/
|
||||
|
||||
if ((uribuf->options & _HTTP_RESOLVE_FAXOUT) &&
|
||||
(!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")))
|
||||
{
|
||||
reskey = "rfo";
|
||||
resdefault = "/ipp/faxout";
|
||||
}
|
||||
else
|
||||
{
|
||||
reskey = "rp";
|
||||
resdefault = "/";
|
||||
}
|
||||
|
||||
if ((pair = avahi_string_list_find(txt, reskey)) != NULL)
|
||||
{
|
||||
avahi_string_list_get_pair(pair, NULL, &value, &valueLen);
|
||||
|
||||
if (value[0] == '/')
|
||||
{
|
||||
/*
|
||||
* Value (incorrectly) has a leading slash already...
|
||||
*/
|
||||
|
||||
memcpy(resource, value, valueLen);
|
||||
resource[valueLen] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Convert to resource by concatenating with a leading "/"...
|
||||
*/
|
||||
|
||||
resource[0] = '/';
|
||||
memcpy(resource + 1, value, valueLen);
|
||||
resource[valueLen + 1] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Use the default value...
|
||||
*/
|
||||
|
||||
strlcpy(resource, resdefault, sizeof(resource));
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the FQDN if needed...
|
||||
*/
|
||||
|
||||
if ((uribuf->options & _HTTP_RESOLVE_FQDN) &&
|
||||
(hostptr = hostTarget + strlen(hostTarget) - 6) > hostTarget &&
|
||||
!_cups_strcasecmp(hostptr, ".local"))
|
||||
{
|
||||
/*
|
||||
* OK, we got a .local name but the caller needs a real domain. Start by
|
||||
* getting the IP address of the .local name and then do reverse-lookups...
|
||||
*/
|
||||
|
||||
http_addrlist_t *addrlist, /* List of addresses */
|
||||
*addr; /* Current address */
|
||||
|
||||
DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget));
|
||||
|
||||
snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port));
|
||||
if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL)
|
||||
{
|
||||
for (addr = addrlist; addr; addr = addr->next)
|
||||
{
|
||||
int error = getnameinfo(&(addr->addr.addr),
|
||||
httpAddrLength(&(addr->addr)),
|
||||
fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
|
||||
|
||||
if (!error)
|
||||
{
|
||||
DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
|
||||
|
||||
if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
|
||||
_cups_strcasecmp(hostptr, ".local"))
|
||||
{
|
||||
hostTarget = fqdn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
|
||||
httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
|
||||
error));
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
httpAddrFreeList(addrlist);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Assemble the final device URI using the resolved hostname...
|
||||
*/
|
||||
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, uribuf->bufsize, scheme,
|
||||
NULL, hostTarget, port, resource);
|
||||
DEBUG_printf(("8http_resolve_cb: Resolved URI is \"%s\".", uribuf->buffer));
|
||||
|
||||
avahi_simple_poll_quit(uribuf->poll);
|
||||
}
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
|
||||
|
||||
+171
-144
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* HTTP routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* This file contains Kerberos support code, copyright 2006 by
|
||||
@@ -133,6 +133,7 @@
|
||||
# include <signal.h>
|
||||
# include <sys/time.h>
|
||||
# include <sys/resource.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif /* WIN32 */
|
||||
#ifdef HAVE_POLL
|
||||
# include <poll.h>
|
||||
@@ -258,7 +259,7 @@ static BIO_METHOD http_bio_methods =
|
||||
*
|
||||
* Use @code cupsArrayNew(NULL, NULL)@ to create a credentials array.
|
||||
*
|
||||
* @since CUPS 1.5/Mac OS X 10.7@
|
||||
* @since CUPS 1.5/OS X 10.7@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@@ -331,7 +332,7 @@ httpCheck(http_t *http) /* I - Connection to server */
|
||||
/*
|
||||
* 'httpClearCookie()' - Clear the cookie value(s).
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -494,7 +495,7 @@ httpConnectEncrypt(
|
||||
* 'httpCopyCredentials()' - Copy the credentials associated with an encrypted
|
||||
* connection.
|
||||
*
|
||||
* @since CUPS 1.5/Mac OS X 10.7@
|
||||
* @since CUPS 1.5/OS X 10.7@
|
||||
*/
|
||||
|
||||
int /* O - Status of call (0 = success) */
|
||||
@@ -835,7 +836,7 @@ httpFlush(http_t *http) /* I - Connection to server */
|
||||
/*
|
||||
* 'httpFlushWrite()' - Flush data in write buffer.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Bytes written or -1 on error */
|
||||
@@ -937,7 +938,7 @@ httpGet(http_t *http, /* I - Connection to server */
|
||||
* string to use with httpSetField() for the HTTP_FIELD_AUTHORIZATION
|
||||
* value.
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Authorization string */
|
||||
@@ -953,7 +954,7 @@ httpGetAuthString(http_t *http) /* I - Connection to server */
|
||||
/*
|
||||
* 'httpGetBlocking()' - Get the blocking/non-block state of a connection.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 if blocking, 0 if non-blocking */
|
||||
@@ -966,7 +967,7 @@ httpGetBlocking(http_t *http) /* I - Connection to server */
|
||||
/*
|
||||
* 'httpGetCookie()' - Get any cookie data from the response.
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
const char * /* O - Cookie data or NULL */
|
||||
@@ -979,7 +980,7 @@ httpGetCookie(http_t *http) /* I - HTTP connecion */
|
||||
/*
|
||||
* 'httpGetFd()' - Get the file descriptor associated with a connection.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - File descriptor or -1 if none */
|
||||
@@ -1049,7 +1050,7 @@ httpGetLength(http_t *http) /* I - Connection to server */
|
||||
* This function returns the complete content length, even for
|
||||
* content larger than 2^31 - 1.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
off_t /* O - Content length */
|
||||
@@ -1183,6 +1184,10 @@ httpGets(char *line, /* I - Line to read into */
|
||||
|
||||
DEBUG_printf(("4httpGets: read %d bytes...", bytes));
|
||||
|
||||
#ifdef DEBUG
|
||||
http_debug_hex("httpGets", http->buffer + http->used, bytes);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (bytes < 0)
|
||||
{
|
||||
/*
|
||||
@@ -1303,7 +1308,7 @@ httpGetState(http_t *http) /* I - Connection to server */
|
||||
/*
|
||||
* 'httpGetStatus()' - Get the status of the last HTTP request.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
@@ -1332,7 +1337,7 @@ httpGetSubField(http_t *http, /* I - Connection to server */
|
||||
/*
|
||||
* 'httpGetSubField2()' - Get a sub-field value.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Value or NULL */
|
||||
@@ -1664,6 +1669,8 @@ _httpPeek(http_t *http, /* I - Connection to server */
|
||||
* Buffer small reads for better performance...
|
||||
*/
|
||||
|
||||
ssize_t buflen; /* Length of read for buffer */
|
||||
|
||||
if (!http->blocking)
|
||||
{
|
||||
while (!httpWait(http, http->wait_value))
|
||||
@@ -1676,48 +1683,69 @@ _httpPeek(http_t *http, /* I - Connection to server */
|
||||
}
|
||||
|
||||
if (http->data_remaining > sizeof(http->buffer))
|
||||
bytes = sizeof(http->buffer);
|
||||
buflen = sizeof(http->buffer);
|
||||
else
|
||||
bytes = http->data_remaining;
|
||||
buflen = http->data_remaining;
|
||||
|
||||
DEBUG_printf(("2_httpPeek: Reading %d bytes into buffer.", (int)buflen));
|
||||
|
||||
do
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
if (http->tls)
|
||||
bytes = http_read_ssl(http, http->buffer, bytes);
|
||||
else
|
||||
if (http->tls)
|
||||
bytes = http_read_ssl(http, http->buffer, buflen);
|
||||
else
|
||||
#endif /* HAVE_SSL */
|
||||
{
|
||||
DEBUG_printf(("2_httpPeek: reading %d bytes from socket into buffer...",
|
||||
(int)bytes));
|
||||
bytes = recv(http->fd, http->buffer, buflen, 0);
|
||||
|
||||
bytes = recv(http->fd, http->buffer, bytes, 0);
|
||||
|
||||
DEBUG_printf(("2_httpPeek: read %d bytes from socket into buffer...",
|
||||
(int)bytes));
|
||||
}
|
||||
|
||||
if (bytes > 0)
|
||||
http->used = bytes;
|
||||
else if (bytes < 0)
|
||||
{
|
||||
if (bytes < 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (WSAGetLastError() != WSAEINTR && WSAGetLastError() != WSAEWOULDBLOCK)
|
||||
{
|
||||
http->error = WSAGetLastError();
|
||||
return (-1);
|
||||
}
|
||||
if (WSAGetLastError() != WSAEINTR)
|
||||
{
|
||||
http->error = WSAGetLastError();
|
||||
return (-1);
|
||||
}
|
||||
else if (WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
{
|
||||
if (!http->timeout_cb ||
|
||||
!(*http->timeout_cb)(http, http->timeout_data))
|
||||
{
|
||||
http->error = WSAEWOULDBLOCK;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
http->error = errno;
|
||||
return (-1);
|
||||
}
|
||||
if (errno == EWOULDBLOCK || errno == EAGAIN)
|
||||
{
|
||||
if (http->timeout_cb && !(*http->timeout_cb)(http, http->timeout_data))
|
||||
{
|
||||
http->error = errno;
|
||||
return (-1);
|
||||
}
|
||||
else if (!http->timeout_cb && errno != EAGAIN)
|
||||
{
|
||||
http->error = errno;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
else if (errno != EINTR)
|
||||
{
|
||||
http->error = errno;
|
||||
return (-1);
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
http->error = EPIPE;
|
||||
return (0);
|
||||
}
|
||||
while (bytes < 0);
|
||||
|
||||
DEBUG_printf(("2_httpPeek: Read " CUPS_LLFMT " bytes into buffer.",
|
||||
CUPS_LLCAST bytes));
|
||||
#ifdef DEBUG
|
||||
http_debug_hex("_httpPeek", http->buffer, (int)bytes);
|
||||
#endif /* DEBUG */
|
||||
|
||||
http->used = bytes;
|
||||
}
|
||||
|
||||
if (http->used > 0)
|
||||
@@ -1850,7 +1878,7 @@ httpRead(http_t *http, /* I - Connection to server */
|
||||
/*
|
||||
* 'httpRead2()' - Read data from a HTTP connection.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes read */
|
||||
@@ -1998,7 +2026,11 @@ httpRead2(http_t *http, /* I - Connection to server */
|
||||
}
|
||||
while (bytes < 0);
|
||||
|
||||
DEBUG_printf(("2httpRead2: Read %d bytes into buffer.", (int)bytes));
|
||||
DEBUG_printf(("2httpRead2: Read " CUPS_LLFMT " bytes into buffer.",
|
||||
CUPS_LLCAST bytes));
|
||||
#ifdef DEBUG
|
||||
http_debug_hex("httpRead2", http->buffer, (int)bytes);
|
||||
#endif /* DEBUG */
|
||||
|
||||
http->used = bytes;
|
||||
}
|
||||
@@ -2101,6 +2133,9 @@ httpRead2(http_t *http, /* I - Connection to server */
|
||||
|
||||
DEBUG_printf(("2httpRead2: read " CUPS_LLFMT " bytes from socket...",
|
||||
CUPS_LLCAST bytes));
|
||||
#ifdef DEBUG
|
||||
http_debug_hex("httpRead2", buffer, (int)bytes);
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
if (bytes > 0)
|
||||
@@ -2136,20 +2171,12 @@ httpRead2(http_t *http, /* I - Connection to server */
|
||||
{
|
||||
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
|
||||
httpGets(len, sizeof(len), http);
|
||||
|
||||
if (http->data_encoding != HTTP_ENCODE_CHUNKED)
|
||||
{
|
||||
if (http->state == HTTP_POST_RECV)
|
||||
http->state ++;
|
||||
else
|
||||
http->state = HTTP_WAITING;
|
||||
}
|
||||
else if (http->state == HTTP_POST_RECV)
|
||||
http->state ++;
|
||||
else
|
||||
http->state = HTTP_WAITING;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
http_debug_hex("httpRead2", buffer, (int)bytes);
|
||||
#endif /* DEBUG */
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
@@ -2326,6 +2353,23 @@ httpReconnect2(http_t *http, /* I - Connection to server */
|
||||
http->fd = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset all state (except fields, which may be reused)...
|
||||
*/
|
||||
|
||||
http->state = HTTP_WAITING;
|
||||
http->status = HTTP_CONTINUE;
|
||||
http->version = HTTP_1_1;
|
||||
http->keep_alive = HTTP_KEEPALIVE_OFF;
|
||||
memset(&http->_hostaddr, 0, sizeof(http->_hostaddr));
|
||||
http->data_encoding = HTTP_ENCODE_LENGTH;
|
||||
http->_data_remaining = 0;
|
||||
http->used = 0;
|
||||
http->expect = 0;
|
||||
http->data_remaining = 0;
|
||||
http->hostaddr = NULL;
|
||||
http->wused = 0;
|
||||
|
||||
/*
|
||||
* Connect to the server...
|
||||
*/
|
||||
@@ -2364,8 +2408,6 @@ httpReconnect2(http_t *http, /* I - Connection to server */
|
||||
|
||||
http->hostaddr = &(addr->addr);
|
||||
http->error = 0;
|
||||
http->status = HTTP_CONTINUE;
|
||||
http->state = HTTP_WAITING;
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
if (http->encryption == HTTP_ENCRYPT_ALWAYS)
|
||||
@@ -2405,7 +2447,7 @@ httpReconnect2(http_t *http, /* I - Connection to server */
|
||||
* HTTP_FIELD_AUTHORIZATION prior to issuing a HTTP request using httpGet(),
|
||||
* httpHead(), httpOptions(), httpPost, or httpPut().
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -2462,7 +2504,7 @@ httpSetAuthString(http_t *http, /* I - Connection to server */
|
||||
* 'httpSetCredentials()' - Set the credentials associated with an encrypted
|
||||
* connection.
|
||||
*
|
||||
* @since CUPS 1.5/Mac OS X 10.7@
|
||||
* @since CUPS 1.5/OS X 10.7@
|
||||
*/
|
||||
|
||||
int /* O - Status of call (0 = success) */
|
||||
@@ -2483,7 +2525,7 @@ httpSetCredentials(http_t *http, /* I - Connection to server */
|
||||
/*
|
||||
* 'httpSetCookie()' - Set the cookie value(s).
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -2508,7 +2550,7 @@ httpSetCookie(http_t *http, /* I - Connection */
|
||||
*
|
||||
* Currently only HTTP_CONTINUE is supported for the "expect" argument.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -2593,7 +2635,7 @@ httpSetField(http_t *http, /* I - Connection to server */
|
||||
/*
|
||||
* 'httpSetLength()' - Set the content-length and content-encoding.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -2623,7 +2665,7 @@ httpSetLength(http_t *http, /* I - Connection to server */
|
||||
* The optional timeout callback receives both the HTTP connection and a user
|
||||
* data pointer and must return 1 to continue or 0 to error (time) out.
|
||||
*
|
||||
* @since CUPS 1.5/Mac OS X 10.7@
|
||||
* @since CUPS 1.5/OS X 10.7@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -2991,7 +3033,7 @@ _httpWait(http_t *http, /* I - Connection to server */
|
||||
/*
|
||||
* 'httpWait()' - Wait for data available on a connection.
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
int /* O - 1 if data is available, 0 otherwise */
|
||||
@@ -3054,7 +3096,7 @@ httpWrite(http_t *http, /* I - Connection to server */
|
||||
/*
|
||||
* 'httpWrite2()' - Write data to a HTTP connection.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes written */
|
||||
@@ -3602,7 +3644,39 @@ http_send(http_t *http, /* I - Connection to server */
|
||||
*/
|
||||
|
||||
if (!http->fields[HTTP_FIELD_USER_AGENT][0])
|
||||
httpSetField(http, HTTP_FIELD_USER_AGENT, CUPS_MINIMAL);
|
||||
{
|
||||
#ifdef WIN32
|
||||
SYSTEM_INFO sysinfo; /* System information */
|
||||
OSVERSIONEX version; /* OS version info */
|
||||
|
||||
version.dwOSVersionInfoSize = sizeof(OSVERSIONEX);
|
||||
GetVersionInfoEx(&version);
|
||||
GetNativeSystemInfo(&sysinfo);
|
||||
|
||||
snprintf(buf, sizeof(buf), CUPS_MINIMAL " (Windows %d.%d; %s) IPP/2.0",
|
||||
version.major, version.minor,
|
||||
sysinfo.wProcessorArchitecture
|
||||
== PROCESSOR_ARCHITECTURE_AMD64 ? "amd64" :
|
||||
sysinfo.wProcessorArchitecture
|
||||
== PROCESSOR_ARCHITECTURE_ARM ? "arm" :
|
||||
sysinfo.wProcessorArchitecture
|
||||
== PROCESSOR_ARCHITECTURE_IA64 ? "ia64" :
|
||||
sysinfo.wProcessorArchitecture
|
||||
== PROCESSOR_ARCHITECTURE_INTEL ? "intel" :
|
||||
"unknown");
|
||||
|
||||
#else
|
||||
struct utsname name; /* uname info */
|
||||
|
||||
uname(&name);
|
||||
|
||||
snprintf(buf, sizeof(buf), CUPS_MINIMAL " (%s %s; %s) IPP/2.0",
|
||||
name.sysname, name.release, name.machine);
|
||||
#endif /* WIN32 */
|
||||
|
||||
DEBUG_printf(("8http_send: Default User-Agent: %s", buf));
|
||||
httpSetField(http, HTTP_FIELD_USER_AGENT, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode the URI as needed...
|
||||
@@ -3661,8 +3735,17 @@ http_send(http_t *http, /* I - Connection to server */
|
||||
DEBUG_printf(("9http_send: %s: %s", http_fields[i],
|
||||
httpGetField(http, i)));
|
||||
|
||||
if (httpPrintf(http, "%s: %s\r\n", http_fields[i],
|
||||
httpGetField(http, i)) < 1)
|
||||
if (i == HTTP_FIELD_HOST)
|
||||
{
|
||||
if (httpPrintf(http, "Host: %s:%d\r\n", httpGetField(http, i),
|
||||
_httpAddrPort(http->hostaddr)) < 1)
|
||||
{
|
||||
http->status = HTTP_ERROR;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
else if (httpPrintf(http, "%s: %s\r\n", http_fields[i],
|
||||
httpGetField(http, i)) < 1)
|
||||
{
|
||||
http->status = HTTP_ERROR;
|
||||
return (-1);
|
||||
@@ -3740,63 +3823,6 @@ http_set_credentials(http_t *http) /* I - Connection to server */
|
||||
if ((credentials = http->tls_credentials) == NULL)
|
||||
credentials = cg->tls_credentials;
|
||||
|
||||
# if HAVE_SECPOLICYCREATESSL
|
||||
/*
|
||||
* Otherwise root around in the user's keychain to see if one can be found...
|
||||
*/
|
||||
|
||||
if (!credentials)
|
||||
{
|
||||
CFDictionaryRef query; /* Query dictionary */
|
||||
CFTypeRef matches = NULL; /* Matching credentials */
|
||||
CFArrayRef dn_array = NULL;/* Distinguished names array */
|
||||
CFTypeRef keys[] = { kSecClass,
|
||||
kSecMatchLimit,
|
||||
kSecReturnRef };
|
||||
/* Keys for dictionary */
|
||||
CFTypeRef values[] = { kSecClassCertificate,
|
||||
kSecMatchLimitOne,
|
||||
kCFBooleanTrue };
|
||||
/* Values for dictionary */
|
||||
|
||||
/*
|
||||
* Get the names associated with the server.
|
||||
*/
|
||||
|
||||
if ((error = SSLCopyDistinguishedNames(http->tls, &dn_array)) != noErr)
|
||||
{
|
||||
DEBUG_printf(("4http_set_credentials: SSLCopyDistinguishedNames, error=%d",
|
||||
(int)error));
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a query which will return all identities that can sign and match
|
||||
* the passed in policy.
|
||||
*/
|
||||
|
||||
query = CFDictionaryCreate(NULL,
|
||||
(const void**)(&keys[0]),
|
||||
(const void**)(&values[0]),
|
||||
sizeof(keys) / sizeof(keys[0]),
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
&kCFTypeDictionaryValueCallBacks);
|
||||
if (query)
|
||||
{
|
||||
error = SecItemCopyMatching(query, &matches);
|
||||
DEBUG_printf(("4http_set_credentials: SecItemCopyMatching, error=%d",
|
||||
(int)error));
|
||||
CFRelease(query);
|
||||
}
|
||||
|
||||
if (matches)
|
||||
CFRelease(matches);
|
||||
|
||||
if (dn_array)
|
||||
CFRelease(dn_array);
|
||||
}
|
||||
# endif /* HAVE_SECPOLICYCREATESSL */
|
||||
|
||||
if (credentials)
|
||||
{
|
||||
error = SSLSetCertificate(http->tls, credentials);
|
||||
@@ -3866,12 +3892,11 @@ http_set_wait(http_t *http) /* I - Connection to server */
|
||||
static int /* O - 0 on success, -1 on failure */
|
||||
http_setup_ssl(http_t *http) /* I - Connection to server */
|
||||
{
|
||||
_cups_globals_t *cg = _cupsGlobals();
|
||||
/* Pointer to library globals */
|
||||
int any_root; /* Allow any root */
|
||||
char hostname[256], /* Hostname */
|
||||
*hostptr; /* Pointer into hostname */
|
||||
|
||||
_cups_globals_t *cg = _cupsGlobals();
|
||||
/* Pointer to library globals */
|
||||
# ifdef HAVE_LIBSSL
|
||||
SSL_CTX *context; /* Context for encryption */
|
||||
BIO *bio; /* BIO data */
|
||||
@@ -3938,7 +3963,9 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
|
||||
http->tls = SSL_new(context);
|
||||
SSL_set_bio(http->tls, bio, bio);
|
||||
|
||||
# ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
|
||||
SSL_set_tlsext_host_name(http->tls, hostname);
|
||||
# endif /* HAVE_SSL_SET_TLSEXT_HOST_NAME */
|
||||
|
||||
if (SSL_connect(http->tls) != 1)
|
||||
{
|
||||
@@ -4059,15 +4086,6 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
|
||||
cg->expired_root, (int)error));
|
||||
}
|
||||
|
||||
# ifdef HAVE_SSLSETPROTOCOLVERSIONMAX
|
||||
if (!error)
|
||||
{
|
||||
error = SSLSetProtocolVersionMax(http->tls, kTLSProtocol1);
|
||||
DEBUG_printf(("4http_setup_ssl: SSLSetProtocolVersionMax(kTLSProtocol1), "
|
||||
"error=%d", (int)error));
|
||||
}
|
||||
# endif /* HAVE_SSLSETPROTOCOLVERSIONMAX */
|
||||
|
||||
/*
|
||||
* In general, don't verify certificates since things like the common name
|
||||
* often do not match...
|
||||
@@ -4142,7 +4160,8 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
|
||||
break;
|
||||
|
||||
case errSSLWouldBlock :
|
||||
usleep(1000);
|
||||
error = noErr; /* Force a retry */
|
||||
usleep(1000); /* in 1 millisecond */
|
||||
break;
|
||||
|
||||
# ifdef HAVE_SECCERTIFICATECOPYDATA
|
||||
@@ -4178,7 +4197,7 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
|
||||
{
|
||||
data = (CFDataRef)CFArrayGetValueAtIndex(dn_array, i);
|
||||
|
||||
if ((credential = malloc(sizeof(*credential))))
|
||||
if ((credential = malloc(sizeof(*credential))) != NULL)
|
||||
{
|
||||
credential->datalen = CFDataGetLength(data);
|
||||
if ((credential->data = malloc(credential->datalen)))
|
||||
@@ -4187,6 +4206,8 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
|
||||
credential->datalen);
|
||||
cupsArrayAdd(names, credential);
|
||||
}
|
||||
else
|
||||
free(credential);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4480,6 +4501,8 @@ http_write(http_t *http, /* I - Connection to server */
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
DEBUG_printf(("3http_write: About to write %d bytes.", (int)length));
|
||||
|
||||
if (http->timeout_cb)
|
||||
{
|
||||
#ifdef HAVE_POLL
|
||||
@@ -4497,7 +4520,8 @@ http_write(http_t *http, /* I - Connection to server */
|
||||
pfd.events = POLLOUT;
|
||||
|
||||
while ((nfds = poll(&pfd, 1, http->wait_value)) < 0 &&
|
||||
(errno == EINTR || errno == EAGAIN));
|
||||
(errno == EINTR || errno == EAGAIN))
|
||||
/* do nothing */;
|
||||
|
||||
#else
|
||||
do
|
||||
@@ -4543,6 +4567,9 @@ http_write(http_t *http, /* I - Connection to server */
|
||||
#endif /* HAVE_SSL */
|
||||
bytes = send(http->fd, buffer, length, 0);
|
||||
|
||||
DEBUG_printf(("3http_write: Write of %d bytes returned %d.", (int)length,
|
||||
(int)bytes));
|
||||
|
||||
if (bytes < 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
|
||||
+10
-10
@@ -124,7 +124,7 @@ typedef enum http_auth_e /**** HTTP authentication types ****/
|
||||
HTTP_AUTH_MD5_SESS, /* MD5-session authentication in use */
|
||||
HTTP_AUTH_MD5_INT, /* Digest authentication in use for body */
|
||||
HTTP_AUTH_MD5_SESS_INT, /* MD5-session authentication in use for body */
|
||||
HTTP_AUTH_NEGOTIATE /* GSSAPI authentication in use @since CUPS 1.3/Mac OS X 10.5@ */
|
||||
HTTP_AUTH_NEGOTIATE /* GSSAPI authentication in use @since CUPS 1.3/OS X 10.5@ */
|
||||
} http_auth_t;
|
||||
|
||||
typedef enum http_encoding_e /**** HTTP transfer encoding values ****/
|
||||
@@ -251,7 +251,7 @@ typedef enum http_status_e /**** HTTP status codes ****/
|
||||
HTTP_NOT_SUPPORTED, /* HTTP version not supported */
|
||||
|
||||
HTTP_AUTHORIZATION_CANCELED = 1000, /* User canceled authorization @since CUPS 1.4@ */
|
||||
HTTP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/Mac OS X 10.7@ */
|
||||
HTTP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/OS X 10.7@ */
|
||||
HTTP_WEBIF_DISABLED /* Web interface is disabled @private@ */
|
||||
} http_status_t;
|
||||
|
||||
@@ -292,7 +292,7 @@ typedef enum http_version_e /**** HTTP version numbers ****/
|
||||
typedef union _http_addr_u /**** Socket address union, which
|
||||
**** makes using IPv6 and other
|
||||
**** address types easier and
|
||||
**** more portable. @since CUPS 1.2/Mac OS X 10.5@
|
||||
**** more portable. @since CUPS 1.2/OS X 10.5@
|
||||
****/
|
||||
{
|
||||
struct sockaddr addr; /* Base structure for family value */
|
||||
@@ -309,7 +309,7 @@ typedef union _http_addr_u /**** Socket address union, which
|
||||
typedef struct http_addrlist_s /**** Socket address list, which is
|
||||
**** used to enumerate all of the
|
||||
**** addresses that are associated
|
||||
**** with a hostname. @since CUPS 1.2/Mac OS X 10.5@
|
||||
**** with a hostname. @since CUPS 1.2/OS X 10.5@
|
||||
****/
|
||||
{
|
||||
struct http_addrlist_s *next; /* Pointer to next address in list */
|
||||
@@ -318,14 +318,14 @@ typedef struct http_addrlist_s /**** Socket address list, which is
|
||||
|
||||
typedef struct _http_s http_t; /**** HTTP connection type ****/
|
||||
|
||||
typedef struct http_credential_s /**** HTTP credential data @since CUPS 1.5/Mac OS X 10.7@ ****/
|
||||
typedef struct http_credential_s /**** HTTP credential data @since CUPS 1.5/OS X 10.7@ ****/
|
||||
{
|
||||
void *data; /* Pointer to credential data */
|
||||
size_t datalen; /* Credential length */
|
||||
} http_credential_t;
|
||||
|
||||
typedef int (*http_timeout_cb_t)(http_t *http, void *user_data);
|
||||
/**** HTTP timeout callback @since CUPS 1.5/Mac OS X 10.7@ ****/
|
||||
/**** HTTP timeout callback @since CUPS 1.5/OS X 10.7@ ****/
|
||||
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ extern void httpSeparate2(const char *uri,
|
||||
char *host, int hostlen, int *port,
|
||||
char *resource, int resourcelen) _CUPS_DEPRECATED;
|
||||
|
||||
/**** New in CUPS 1.2/Mac OS X 10.5 ****/
|
||||
/**** New in CUPS 1.2/OS X 10.5 ****/
|
||||
extern int httpAddrAny(const http_addr_t *addr) _CUPS_API_1_2;
|
||||
extern http_addrlist_t *httpAddrConnect(http_addrlist_t *addrlist, int *sock) _CUPS_API_1_2;
|
||||
extern int httpAddrEqual(const http_addr_t *addr1,
|
||||
@@ -443,12 +443,12 @@ extern void httpSetLength(http_t *http, size_t length) _CUPS_API_1_2;
|
||||
extern ssize_t httpWrite2(http_t *http, const char *buffer,
|
||||
size_t length) _CUPS_API_1_2;
|
||||
|
||||
/**** New in CUPS 1.3/Mac OS X 10.5 ****/
|
||||
/**** New in CUPS 1.3/OS X 10.5 ****/
|
||||
extern char *httpGetAuthString(http_t *http) _CUPS_API_1_3;
|
||||
extern void httpSetAuthString(http_t *http, const char *scheme,
|
||||
const char *data) _CUPS_API_1_3;
|
||||
|
||||
/**** New in CUPS 1.5/Mac OS X 10.7 ****/
|
||||
/**** New in CUPS 1.5/OS X 10.7 ****/
|
||||
extern int httpAddCredential(cups_array_t *credentials,
|
||||
const void *data, size_t datalen)
|
||||
_CUPS_API_1_5;
|
||||
@@ -462,7 +462,7 @@ extern void httpSetTimeout(http_t *http, double timeout,
|
||||
http_timeout_cb_t cb, void *user_data)
|
||||
_CUPS_API_1_5;
|
||||
|
||||
/**** New in CUPS 1.6 ****/
|
||||
/**** New in CUPS 1.6/OS X 10.8 ****/
|
||||
extern http_addrlist_t *httpAddrConnect2(http_addrlist_t *addrlist, int *sock,
|
||||
int msec, int *cancel)
|
||||
_CUPS_API_1_6;
|
||||
|
||||
@@ -46,103 +46,6 @@ extern "C" {
|
||||
* Structures...
|
||||
*/
|
||||
|
||||
typedef union _ipp_request_u /**** Request Header ****/
|
||||
{
|
||||
struct /* Any Header */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
int op_status; /* Operation ID or status code*/
|
||||
int request_id; /* Request ID */
|
||||
} any;
|
||||
|
||||
struct /* Operation Header */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
ipp_op_t operation_id; /* Operation ID */
|
||||
int request_id; /* Request ID */
|
||||
} op;
|
||||
|
||||
struct /* Status Header */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
ipp_status_t status_code; /* Status code */
|
||||
int request_id; /* Request ID */
|
||||
} status;
|
||||
|
||||
/**** New in CUPS 1.1.19 ****/
|
||||
struct /* Event Header @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
ipp_status_t status_code; /* Status code */
|
||||
int request_id; /* Request ID */
|
||||
} event;
|
||||
} _ipp_request_t;
|
||||
|
||||
/**** New in CUPS 1.1.19 ****/
|
||||
|
||||
typedef union _ipp_value_u /**** Attribute Value ****/
|
||||
{
|
||||
int integer; /* Integer/enumerated value */
|
||||
|
||||
char boolean; /* Boolean value */
|
||||
|
||||
ipp_uchar_t date[11]; /* Date/time value */
|
||||
|
||||
struct
|
||||
{
|
||||
int xres, /* Horizontal resolution */
|
||||
yres; /* Vertical resolution */
|
||||
ipp_res_t units; /* Resolution units */
|
||||
} resolution; /* Resolution value */
|
||||
|
||||
struct
|
||||
{
|
||||
int lower, /* Lower value */
|
||||
upper; /* Upper value */
|
||||
} range; /* Range of integers value */
|
||||
|
||||
struct
|
||||
{
|
||||
char *language; /* Language code */
|
||||
char *text; /* String */
|
||||
} string; /* String with language value */
|
||||
|
||||
struct
|
||||
{
|
||||
int length; /* Length of attribute */
|
||||
void *data; /* Data in attribute */
|
||||
} unknown; /* Unknown attribute type */
|
||||
|
||||
/**** New in CUPS 1.1.19 ****/
|
||||
ipp_t *collection; /* Collection value @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
} _ipp_value_t;
|
||||
|
||||
struct _ipp_attribute_s /**** Attribute ****/
|
||||
{
|
||||
ipp_attribute_t *next; /* Next attribute in list */
|
||||
ipp_tag_t group_tag, /* Job/Printer/Operation group tag */
|
||||
value_tag; /* What type of value is it? */
|
||||
char *name; /* Name of attribute */
|
||||
int num_values; /* Number of values */
|
||||
_ipp_value_t values[1]; /* Values */
|
||||
};
|
||||
|
||||
struct _ipp_s /**** IPP Request/Response/Notification ****/
|
||||
{
|
||||
ipp_state_t state; /* State of request */
|
||||
_ipp_request_t request; /* Request header */
|
||||
ipp_attribute_t *attrs; /* Attributes */
|
||||
ipp_attribute_t *last; /* Last attribute in list */
|
||||
ipp_attribute_t *current; /* Current attribute (for read/write) */
|
||||
ipp_tag_t curtag; /* Current attribute group tag */
|
||||
|
||||
/**** New in CUPS 1.2 ****/
|
||||
ipp_attribute_t *prev; /* Previous attribute (for read) @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
|
||||
/**** New in CUPS 1.4.4 ****/
|
||||
int use; /* Use count @since CUPS 1.4.4/Mac OS X 10.6.?@ */
|
||||
};
|
||||
|
||||
typedef struct /**** Attribute mapping data ****/
|
||||
{
|
||||
int multivalue; /* Option has multiple values? */
|
||||
|
||||
+26
-21
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Internet Printing Protocol support functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -78,7 +78,11 @@ static const char * const ipp_status_oks[] = /* "OK" status codes */
|
||||
"client-error-ignored-all-subscriptions",
|
||||
"client-error-too-many-subscriptions",
|
||||
"(client-error-ignored-all-notifications)",
|
||||
"(client-error-client-print-support-file-not-found)"
|
||||
"(client-error-client-print-support-file-not-found)",
|
||||
"client-error-document-password-error",
|
||||
"client-error-document-permission-error",
|
||||
"client-error-document-security-error",
|
||||
"client-error-document-unprintable-error"
|
||||
},
|
||||
* const ipp_status_500s[] = /* Server errors */
|
||||
{
|
||||
@@ -158,7 +162,7 @@ static const char * const ipp_std_ops[] =
|
||||
"Suspend-Current-Job",
|
||||
"Resume-Job",
|
||||
|
||||
/* 0x0030 - 0x003b */
|
||||
/* 0x0030 - 0x003d */
|
||||
"Promote-Job",
|
||||
"Schedule-Job-After",
|
||||
"0x32",
|
||||
@@ -171,7 +175,8 @@ static const char * const ipp_std_ops[] =
|
||||
"Cancel-My-Jobs",
|
||||
"Resubmit-Job",
|
||||
"Close-Job",
|
||||
"Identify-Printer"
|
||||
"Identify-Printer",
|
||||
"Validate-Document"
|
||||
},
|
||||
* const ipp_cups_ops[] =
|
||||
{
|
||||
@@ -406,7 +411,7 @@ static size_t ipp_col_string(ipp_t *col, char *buffer, size_t bufsize);
|
||||
* trailing nul. The buffer pointer can be NULL to get the required length,
|
||||
* just like (v)snprintf.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
size_t /* O - Number of bytes less nul */
|
||||
@@ -487,12 +492,12 @@ ippAttributeString(
|
||||
bufptr += snprintf(bufptr, bufend - bufptr + 1, "%dx%d%s",
|
||||
val->resolution.xres, val->resolution.yres,
|
||||
val->resolution.units == IPP_RES_PER_INCH ?
|
||||
"dpi" : "dpc");
|
||||
"dpi" : "dpcm");
|
||||
else
|
||||
bufptr += snprintf(temp, sizeof(temp), "%dx%d%s",
|
||||
val->resolution.xres, val->resolution.yres,
|
||||
val->resolution.units == IPP_RES_PER_INCH ?
|
||||
"dpi" : "dpc");
|
||||
"dpi" : "dpcm");
|
||||
break;
|
||||
|
||||
case IPP_TAG_DATE :
|
||||
@@ -640,8 +645,8 @@ ippEnumString(const char *attrname, /* I - Attribute name */
|
||||
|
||||
if (!strcmp(attrname, "document-state") &&
|
||||
enumvalue >= 3 &&
|
||||
enumvalue <= (3 + (int)(sizeof(ipp_document_states) /
|
||||
sizeof(ipp_document_states[0]))))
|
||||
enumvalue < (3 + (int)(sizeof(ipp_document_states) /
|
||||
sizeof(ipp_document_states[0]))))
|
||||
return (ipp_document_states[enumvalue - 3]);
|
||||
else if ((!strcmp(attrname, "finishings") ||
|
||||
!strcmp(attrname, "finishings-actual") ||
|
||||
@@ -649,13 +654,13 @@ ippEnumString(const char *attrname, /* I - Attribute name */
|
||||
!strcmp(attrname, "finishings-ready") ||
|
||||
!strcmp(attrname, "finishings-supported")) &&
|
||||
enumvalue >= 3 &&
|
||||
enumvalue <= (3 + (int)(sizeof(ipp_finishings) / sizeof(ipp_finishings[0]))))
|
||||
enumvalue < (3 + (int)(sizeof(ipp_finishings) / sizeof(ipp_finishings[0]))))
|
||||
return (ipp_finishings[enumvalue - 3]);
|
||||
else if ((!strcmp(attrname, "job-collation-type") ||
|
||||
!strcmp(attrname, "job-collation-type-actual")) &&
|
||||
enumvalue >= 3 &&
|
||||
enumvalue <= (3 + (int)(sizeof(ipp_job_collation_types) /
|
||||
sizeof(ipp_job_collation_types[0]))))
|
||||
enumvalue < (3 + (int)(sizeof(ipp_job_collation_types) /
|
||||
sizeof(ipp_job_collation_types[0]))))
|
||||
return (ipp_job_collation_types[enumvalue - 3]);
|
||||
else if (!strcmp(attrname, "job-state") &&
|
||||
enumvalue >= IPP_JOB_PENDING && enumvalue <= IPP_JOB_COMPLETED)
|
||||
@@ -667,16 +672,16 @@ ippEnumString(const char *attrname, /* I - Attribute name */
|
||||
!strcmp(attrname, "orientation-requested-default") ||
|
||||
!strcmp(attrname, "orientation-requested-supported")) &&
|
||||
enumvalue >= 3 &&
|
||||
enumvalue <= (3 + (int)(sizeof(ipp_orientation_requesteds) /
|
||||
sizeof(ipp_orientation_requesteds[0]))))
|
||||
enumvalue < (3 + (int)(sizeof(ipp_orientation_requesteds) /
|
||||
sizeof(ipp_orientation_requesteds[0]))))
|
||||
return (ipp_orientation_requesteds[enumvalue - 3]);
|
||||
else if ((!strcmp(attrname, "print-quality") ||
|
||||
!strcmp(attrname, "print-quality-actual") ||
|
||||
!strcmp(attrname, "print-quality-default") ||
|
||||
!strcmp(attrname, "print-quality-supported")) &&
|
||||
enumvalue >= 3 &&
|
||||
enumvalue <= (3 + (int)(sizeof(ipp_print_qualities) /
|
||||
sizeof(ipp_print_qualities[0]))))
|
||||
enumvalue < (3 + (int)(sizeof(ipp_print_qualities) /
|
||||
sizeof(ipp_print_qualities[0]))))
|
||||
return (ipp_print_qualities[enumvalue - 3]);
|
||||
else if (!strcmp(attrname, "printer-state") &&
|
||||
enumvalue >= IPP_PRINTER_IDLE && enumvalue <= IPP_PRINTER_STOPPED)
|
||||
@@ -816,7 +821,7 @@ ippErrorString(ipp_status_t error) /* I - Error status */
|
||||
/*
|
||||
* 'ippErrorValue()' - Return a status code for the given name.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ipp_status_t /* O - IPP status code */
|
||||
@@ -854,7 +859,7 @@ ippErrorValue(const char *name) /* I - Name */
|
||||
/*
|
||||
* 'ippOpString()' - Return a name for the given operation id.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - Name */
|
||||
@@ -889,7 +894,7 @@ ippOpString(ipp_op_t op) /* I - Operation ID */
|
||||
/*
|
||||
* 'ippOpValue()' - Return an operation id for the given name.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ipp_op_t /* O - Operation ID */
|
||||
@@ -965,7 +970,7 @@ ippSetPort(int p) /* I - Port number to use */
|
||||
*
|
||||
* The returned names are defined in RFC 2911 and 3382.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
const char * /* O - Tag name */
|
||||
@@ -985,7 +990,7 @@ ippTagString(ipp_tag_t tag) /* I - Tag value */
|
||||
*
|
||||
* The tag names are defined in RFC 2911 and 3382.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
ipp_tag_t /* O - Tag value */
|
||||
|
||||
+168
-162
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Internet Printing Protocol functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -120,17 +120,24 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static ipp_attribute_t *ipp_add_attr(ipp_t *ipp, const char *name, ipp_tag_t group_tag,
|
||||
ipp_tag_t value_tag, int num_values);
|
||||
static void ipp_free_values(ipp_attribute_t *attr, int element, int count);
|
||||
static char *ipp_get_code(const char *locale, char *buffer, size_t bufsize);
|
||||
static char *ipp_lang_code(const char *locale, char *buffer, size_t bufsize);
|
||||
static ipp_attribute_t *ipp_add_attr(ipp_t *ipp, const char *name,
|
||||
ipp_tag_t group_tag, ipp_tag_t value_tag,
|
||||
int num_values);
|
||||
static void ipp_free_values(ipp_attribute_t *attr, int element,
|
||||
int count);
|
||||
static char *ipp_get_code(const char *locale, char *buffer,
|
||||
size_t bufsize)
|
||||
__attribute__((nonnull(1,2)));
|
||||
static char *ipp_lang_code(const char *locale, char *buffer,
|
||||
size_t bufsize)
|
||||
__attribute__((nonnull(1,2)));
|
||||
static size_t ipp_length(ipp_t *ipp, int collection);
|
||||
static ssize_t ipp_read_http(http_t *http, ipp_uchar_t *buffer,
|
||||
size_t length);
|
||||
static ssize_t ipp_read_file(int *fd, ipp_uchar_t *buffer,
|
||||
size_t length);
|
||||
static _ipp_value_t *ipp_set_value(ipp_t *ipp, ipp_attribute_t **attr, int element);
|
||||
static _ipp_value_t *ipp_set_value(ipp_t *ipp, ipp_attribute_t **attr,
|
||||
int element);
|
||||
static ssize_t ipp_write_file(int *fd, ipp_uchar_t *buffer,
|
||||
size_t length);
|
||||
|
||||
@@ -301,7 +308,7 @@ ippAddBooleans(ipp_t *ipp, /* I - IPP message */
|
||||
* (@code IPP_TAG_OPERATION@), printer (@code IPP_TAG_PRINTER@), subscription
|
||||
* (@code IPP_TAG_SUBSCRIPTION@), or unsupported (@code IPP_TAG_UNSUPPORTED_GROUP@).
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
ipp_attribute_t * /* O - New attribute */
|
||||
@@ -352,7 +359,7 @@ ippAddCollection(ipp_t *ipp, /* I - IPP message */
|
||||
* (@code IPP_TAG_OPERATION@), printer (@code IPP_TAG_PRINTER@), subscription
|
||||
* (@code IPP_TAG_SUBSCRIPTION@), or unsupported (@code IPP_TAG_UNSUPPORTED_GROUP@).
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
ipp_attribute_t * /* O - New attribute */
|
||||
@@ -602,7 +609,7 @@ ippAddIntegers(ipp_t *ipp, /* I - IPP message */
|
||||
* (@code IPP_TAG_OPERATION@), printer (@code IPP_TAG_PRINTER@), subscription
|
||||
* (@code IPP_TAG_SUBSCRIPTION@), or unsupported (@code IPP_TAG_UNSUPPORTED_GROUP@).
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ipp_attribute_t * /* O - New attribute */
|
||||
@@ -665,7 +672,7 @@ ippAddOctetString(ipp_t *ipp, /* I - IPP message */
|
||||
* (@code IPP_TAG_NOTSETTABLE@), delete-attribute (@code IPP_TAG_DELETEATTR@), and
|
||||
* admin-define (@code IPP_TAG_ADMINDEFINE@).
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_attribute_t * /* O - New attribute */
|
||||
@@ -1058,14 +1065,17 @@ ippAddString(ipp_t *ipp, /* I - IPP message */
|
||||
attr->values[0].string.language = _cupsStrAlloc(ipp_lang_code(language, code,
|
||||
sizeof(code)));
|
||||
|
||||
if (value_tag == IPP_TAG_CHARSET)
|
||||
attr->values[0].string.text = _cupsStrAlloc(ipp_get_code(value, code,
|
||||
sizeof(code)));
|
||||
else if (value_tag == IPP_TAG_LANGUAGE)
|
||||
attr->values[0].string.text = _cupsStrAlloc(ipp_lang_code(value, code,
|
||||
sizeof(code)));
|
||||
else
|
||||
attr->values[0].string.text = _cupsStrAlloc(value);
|
||||
if (value)
|
||||
{
|
||||
if (value_tag == IPP_TAG_CHARSET)
|
||||
attr->values[0].string.text = _cupsStrAlloc(ipp_get_code(value, code,
|
||||
sizeof(code)));
|
||||
else if (value_tag == IPP_TAG_LANGUAGE)
|
||||
attr->values[0].string.text = _cupsStrAlloc(ipp_lang_code(value, code,
|
||||
sizeof(code)));
|
||||
else
|
||||
attr->values[0].string.text = _cupsStrAlloc(value);
|
||||
}
|
||||
}
|
||||
|
||||
return (attr);
|
||||
@@ -1221,7 +1231,7 @@ ippAddStrings(
|
||||
* created - this should only be done as long as the original source IPP message will
|
||||
* not be freed for the life of the destination.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
|
||||
@@ -1472,7 +1482,7 @@ ippCopyAttribute(
|
||||
* 0 to skip it. The function may also choose to do a partial copy of the source attribute
|
||||
* itself.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on error */
|
||||
@@ -1600,7 +1610,7 @@ ippDelete(ipp_t *ipp) /* I - IPP message */
|
||||
/*
|
||||
* 'ippDeleteAttribute()' - Delete a single attribute in an IPP message.
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -1675,7 +1685,7 @@ ippDeleteAttribute(
|
||||
*
|
||||
* Deleting all values in an attribute deletes the attribute.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -1802,7 +1812,7 @@ ippFindNextAttribute(ipp_t *ipp, /* I - IPP message */
|
||||
/*
|
||||
* 'ippFirstAttribute()' - Return the first attribute in the message.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_attribute_t * /* O - First attribute or @code NULL@ if none */
|
||||
@@ -1829,7 +1839,7 @@ ippFirstAttribute(ipp_t *ipp) /* I - IPP message */
|
||||
* The @code element@ parameter specifies which value to get from 0 to
|
||||
* @link ippGetCount(attr)@ - 1.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - Boolean value or -1 on error */
|
||||
@@ -1858,7 +1868,7 @@ ippGetBoolean(ipp_attribute_t *attr, /* I - IPP attribute */
|
||||
* The @code element@ parameter specifies which value to get from 0 to
|
||||
* @link ippGetCount(attr)@ - 1.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_t * /* O - Collection value or @code NULL@ on error */
|
||||
@@ -1885,7 +1895,7 @@ ippGetCollection(
|
||||
/*
|
||||
* 'ippGetCount()' - Get the number of values in an attribute.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - Number of values or -1 on error */
|
||||
@@ -1912,7 +1922,7 @@ ippGetCount(ipp_attribute_t *attr) /* I - IPP attribute */
|
||||
* The @code element@ parameter specifies which value to get from 0 to
|
||||
* @link ippGetCount(attr)@ - 1.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
const ipp_uchar_t * /* O - Date value or @code NULL@ */
|
||||
@@ -1938,7 +1948,7 @@ ippGetDate(ipp_attribute_t *attr, /* I - IPP attribute */
|
||||
/*
|
||||
* 'ippGetGroupTag()' - Get the group associated with an attribute.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_tag_t /* O - Group tag or @code IPP_TAG_ZERO@ on error */
|
||||
@@ -1965,7 +1975,7 @@ ippGetGroupTag(ipp_attribute_t *attr) /* I - IPP attribute */
|
||||
* The @code element@ parameter specifies which value to get from 0 to
|
||||
* @link ippGetCount(attr)@ - 1.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - Value or -1 on error */
|
||||
@@ -1991,7 +2001,7 @@ ippGetInteger(ipp_attribute_t *attr, /* I - IPP attribute */
|
||||
/*
|
||||
* 'ippGetName()' - Get the attribute name.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
const char * /* O - Attribute name or @code NULL@ for separators */
|
||||
@@ -2015,7 +2025,7 @@ ippGetName(ipp_attribute_t *attr) /* I - IPP attribute */
|
||||
/*
|
||||
* 'ippGetOperation()' - Get the operation ID in an IPP message.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_op_t /* O - Operation ID or -1 on error */
|
||||
@@ -2042,7 +2052,7 @@ ippGetOperation(ipp_t *ipp) /* I - IPP request message */
|
||||
* The @code element@ parameter specifies which value to get from 0 to
|
||||
* @link ippGetCount(attr)@ - 1.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - Lower value of range or -1 */
|
||||
@@ -2077,7 +2087,7 @@ ippGetRange(ipp_attribute_t *attr, /* I - IPP attribute */
|
||||
/*
|
||||
* 'ippGetRequestId()' - Get the request ID from an IPP message.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - Request ID or -1 on error */
|
||||
@@ -2104,7 +2114,7 @@ ippGetRequestId(ipp_t *ipp) /* I - IPP message */
|
||||
* The @code element@ parameter specifies which value to get from 0 to
|
||||
* @link ippGetCount(attr)@ - 1.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - Horizontal/cross feed resolution or -1 */
|
||||
@@ -2139,7 +2149,7 @@ ippGetResolution(
|
||||
/*
|
||||
* 'ippGetState()' - Get the IPP message state.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_state_t /* O - IPP message state value */
|
||||
@@ -2163,7 +2173,7 @@ ippGetState(ipp_t *ipp) /* I - IPP message */
|
||||
/*
|
||||
* 'ippGetStatusCode()' - Get the status code from an IPP response or event message.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_status_t /* O - Status code in IPP message */
|
||||
@@ -2190,7 +2200,7 @@ ippGetStatusCode(ipp_t *ipp) /* I - IPP response or event message */
|
||||
* The @code element@ parameter specifies which value to get from 0 to
|
||||
* @link ippGetCount(attr)@ - 1.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
const char *
|
||||
@@ -2221,7 +2231,7 @@ ippGetString(ipp_attribute_t *attr, /* I - IPP attribute */
|
||||
/*
|
||||
* 'ippGetValueTag()' - Get the value tag for an attribute.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_tag_t /* O - Value tag or @code IPP_TAG_ZERO@ on error */
|
||||
@@ -2245,7 +2255,7 @@ ippGetValueTag(ipp_attribute_t *attr) /* I - IPP attribute */
|
||||
/*
|
||||
* 'ippGetVersion()' - Get the major and minor version number from an IPP message.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - Major version number or -1 on error */
|
||||
@@ -2289,7 +2299,7 @@ ippLength(ipp_t *ipp) /* I - IPP message */
|
||||
/*
|
||||
* 'ippNextAttribute()' - Return the next attribute in the message.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
ipp_attribute_t * /* O - Next attribute or @code NULL@ if none */
|
||||
@@ -2317,7 +2327,9 @@ ippNextAttribute(ipp_t *ipp) /* I - IPP message */
|
||||
ipp_t * /* O - New IPP message */
|
||||
ippNew(void)
|
||||
{
|
||||
ipp_t *temp; /* New IPP message */
|
||||
ipp_t *temp; /* New IPP message */
|
||||
_cups_globals_t *cg = _cupsGlobals();
|
||||
/* Global data */
|
||||
|
||||
|
||||
DEBUG_puts("ippNew()");
|
||||
@@ -2325,11 +2337,11 @@ ippNew(void)
|
||||
if ((temp = (ipp_t *)calloc(1, sizeof(ipp_t))) != NULL)
|
||||
{
|
||||
/*
|
||||
* Default to IPP 2.0...
|
||||
* Set default version - usually 2.0...
|
||||
*/
|
||||
|
||||
temp->request.any.version[0] = 2;
|
||||
temp->request.any.version[1] = 0;
|
||||
temp->request.any.version[0] = cg->server_version / 10;
|
||||
temp->request.any.version[1] = cg->server_version % 10;
|
||||
temp->use = 1;
|
||||
}
|
||||
|
||||
@@ -2346,7 +2358,7 @@ ippNew(void)
|
||||
* attributes-natural-language attributes added. The
|
||||
* attributes-natural-language value is derived from the current locale.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ipp_t * /* O - IPP request message */
|
||||
@@ -2428,7 +2440,7 @@ ippRead(http_t *http, /* I - HTTP connection */
|
||||
/*
|
||||
* 'ippReadFile()' - Read data for an IPP message from a file.
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
ipp_state_t /* O - Current state */
|
||||
@@ -2444,7 +2456,7 @@ ippReadFile(int fd, /* I - HTTP data */
|
||||
/*
|
||||
* 'ippReadIO()' - Read data for an IPP message.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ipp_state_t /* O - Current state */
|
||||
@@ -2467,7 +2479,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
|
||||
DEBUG_printf(("ippReadIO(src=%p, cb=%p, blocking=%d, parent=%p, ipp=%p)",
|
||||
src, cb, blocking, parent, ipp));
|
||||
DEBUG_printf(("2ippReadIO: ipp->state=%d", ipp->state));
|
||||
DEBUG_printf(("2ippReadIO: ipp->state=%d", ipp ? ipp->state : IPP_ERROR));
|
||||
|
||||
if (!src || !ipp)
|
||||
return (IPP_ERROR);
|
||||
@@ -2567,7 +2579,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
*/
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("IPP extension tag larger than 0x7FFFFFFF."), 1);
|
||||
DEBUG_printf(("1ippReadIO: bad name length %d.", n));
|
||||
DEBUG_printf(("1ippReadIO: bad tag 0x%x.", tag));
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
@@ -2761,6 +2773,13 @@ ippReadIO(void *src, /* I - Data source */
|
||||
ipp->prev = ipp->current;
|
||||
|
||||
attr = ipp->current = ipp_add_attr(ipp, NULL, ipp->curtag, IPP_TAG_ZERO, 1);
|
||||
if (!attr)
|
||||
{
|
||||
_cupsSetHTTPError(HTTP_ERROR);
|
||||
DEBUG_puts("1ippReadIO: unable to allocate attribute.");
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
DEBUG_printf(("2ippReadIO: membername, ipp->current=%p, ipp->prev=%p",
|
||||
ipp->current, ipp->prev));
|
||||
@@ -2836,7 +2855,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
else
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("IPP enum value not 4 bytes."), 1);
|
||||
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
|
||||
DEBUG_printf(("1ippReadIO: bad integer value length %d.", n));
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
@@ -2862,7 +2881,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("IPP boolean value not 1 byte."),
|
||||
1);
|
||||
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
|
||||
DEBUG_printf(("1ippReadIO: bad boolean value length %d.", n));
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
@@ -2903,11 +2922,14 @@ ippReadIO(void *src, /* I - Data source */
|
||||
case IPP_TAG_CHARSET :
|
||||
case IPP_TAG_LANGUAGE :
|
||||
case IPP_TAG_MIMETYPE :
|
||||
if ((*cb)(src, buffer, n) < n)
|
||||
{
|
||||
DEBUG_puts("1ippReadIO: unable to read string value.");
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
if (n > 0)
|
||||
{
|
||||
if ((*cb)(src, buffer, n) < n)
|
||||
{
|
||||
DEBUG_puts("1ippReadIO: unable to read string value.");
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
buffer[n] = '\0';
|
||||
@@ -2919,7 +2941,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
if (n != 11)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("IPP date value not 11 bytes."), 1);
|
||||
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
|
||||
DEBUG_printf(("1ippReadIO: bad date value length %d.", n));
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
@@ -2937,7 +2959,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("IPP resolution value not 9 bytes."), 1);
|
||||
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
|
||||
DEBUG_printf(("1ippReadIO: bad resolution value length %d.", n));
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
@@ -2964,7 +2986,8 @@ ippReadIO(void *src, /* I - Data source */
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("IPP rangeOfInteger value not 8 bytes."), 1);
|
||||
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
|
||||
DEBUG_printf(("1ippReadIO: bad rangeOfInteger value length "
|
||||
"%d.", n));
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
@@ -2996,7 +3019,8 @@ ippReadIO(void *src, /* I - Data source */
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("IPP nameWithLanguage value less than "
|
||||
"minimum 4 bytes."), 1);
|
||||
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
|
||||
DEBUG_printf(("1ippReadIO: bad stringWithLanguage value "
|
||||
"length %d.", n));
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
@@ -3028,7 +3052,8 @@ ippReadIO(void *src, /* I - Data source */
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("IPP language length overflows value."), 1);
|
||||
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
|
||||
DEBUG_printf(("1ippReadIO: bad language value length %d.",
|
||||
n));
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
@@ -3045,7 +3070,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("IPP string length overflows value."), 1);
|
||||
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
|
||||
DEBUG_printf(("1ippReadIO: bad string value length %d.", n));
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
@@ -3100,7 +3125,23 @@ ippReadIO(void *src, /* I - Data source */
|
||||
* we need to carry over...
|
||||
*/
|
||||
|
||||
if ((*cb)(src, buffer, n) < n)
|
||||
if (!attr)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("IPP memberName with no attribute."), 1);
|
||||
DEBUG_puts("1ippReadIO: Member name without attribute.");
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
else if (n == 0)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("IPP memberName value is empty."), 1);
|
||||
DEBUG_puts("1ippReadIO: Empty member name value.");
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
else if ((*cb)(src, buffer, n) < n)
|
||||
{
|
||||
DEBUG_puts("1ippReadIO: Unable to read member name value.");
|
||||
_cupsBufferRelease((char *)buffer);
|
||||
@@ -3179,7 +3220,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
* The @code element@ parameter specifies which value to set from 0 to
|
||||
* @link ippGetCount(attr)@.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3221,7 +3262,7 @@ ippSetBoolean(ipp_t *ipp, /* IO - IPP message */
|
||||
* The @code element@ parameter specifies which value to set from 0 to
|
||||
* @link ippGetCount(attr)@.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3270,7 +3311,7 @@ ippSetCollection(
|
||||
* The @code element@ parameter specifies which value to set from 0 to
|
||||
* @link ippGetCount(attr)@.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3315,7 +3356,7 @@ ippSetDate(ipp_t *ipp, /* IO - IPP message */
|
||||
* (@code IPP_TAG_OPERATION@), printer (@code IPP_TAG_PRINTER@), subscription
|
||||
* (@code IPP_TAG_SUBSCRIPTION@), or unsupported (@code IPP_TAG_UNSUPPORTED_GROUP@).
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3353,7 +3394,7 @@ ippSetGroupTag(
|
||||
* The @code element@ parameter specifies which value to set from 0 to
|
||||
* @link ippGetCount(attr)@.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3393,7 +3434,7 @@ ippSetInteger(ipp_t *ipp, /* IO - IPP message */
|
||||
*
|
||||
* The @code attr@ parameter may be modified as a result of setting the value.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3433,7 +3474,7 @@ ippSetName(ipp_t *ipp, /* IO - IPP message */
|
||||
* The @code ipp@ parameter refers to an IPP message previously created using the
|
||||
* @link ippNew@ or @link ippNewRequest@ functions.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3468,7 +3509,7 @@ ippSetOperation(ipp_t *ipp, /* I - IPP request message */
|
||||
* The @code element@ parameter specifies which value to set from 0 to
|
||||
* @link ippGetCount(attr)@.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3511,7 +3552,7 @@ ippSetRange(ipp_t *ipp, /* IO - IPP message */
|
||||
*
|
||||
* The @code request_id@ parameter must be greater than 0.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3548,7 +3589,7 @@ ippSetRequestId(ipp_t *ipp, /* I - IPP message */
|
||||
* The @code element@ parameter specifies which value to set from 0 to
|
||||
* @link ippGetCount(attr)@.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3590,7 +3631,7 @@ ippSetResolution(
|
||||
/*
|
||||
* 'ippSetState()' - Set the current state of the IPP message.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3621,7 +3662,7 @@ ippSetState(ipp_t *ipp, /* I - IPP message */
|
||||
* The @code ipp@ parameter refers to an IPP message previously created using the
|
||||
* @link ippNew@ or @link ippNewRequest@ functions.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3656,7 +3697,7 @@ ippSetStatusCode(ipp_t *ipp, /* I - IPP response or event message */
|
||||
* The @code element@ parameter specifies which value to set from 0 to
|
||||
* @link ippGetCount(attr)@.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3673,7 +3714,11 @@ ippSetString(ipp_t *ipp, /* IO - IPP message */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!ipp || !attr || !*attr || (*attr)->value_tag != IPP_TAG_INTEGER ||
|
||||
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)
|
||||
return (0);
|
||||
|
||||
@@ -3723,7 +3768,7 @@ ippSetString(ipp_t *ipp, /* IO - IPP message */
|
||||
* code in the "attributes-natural-language" attribute or, if not present, the language
|
||||
* code for the current locale.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3880,7 +3925,7 @@ ippSetValueTag(
|
||||
*
|
||||
* The valid version numbers are currently 1.0, 1.1, 2.0, 2.1, and 2.2.
|
||||
*
|
||||
* @since CUPS 1.6@
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -3974,7 +4019,7 @@ ippWrite(http_t *http, /* I - HTTP connection */
|
||||
/*
|
||||
* 'ippWriteFile()' - Write data for an IPP message to a file.
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
* @since CUPS 1.1.19/OS X 10.3@
|
||||
*/
|
||||
|
||||
ipp_state_t /* O - Current state */
|
||||
@@ -3992,7 +4037,7 @@ ippWriteFile(int fd, /* I - HTTP data */
|
||||
/*
|
||||
* 'ippWriteIO()' - Write data for an IPP message.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ipp_state_t /* O - Current state */
|
||||
@@ -4968,7 +5013,8 @@ ipp_free_values(ipp_attribute_t *attr, /* I - Attribute to free values from */
|
||||
_ipp_value_t *value; /* Current value */
|
||||
|
||||
|
||||
DEBUG_printf(("4ipp_free_values(attr=%p, element=%d, count=%d)", attr, element, count));
|
||||
DEBUG_printf(("4ipp_free_values(attr=%p, element=%d, count=%d)", attr,
|
||||
element, count));
|
||||
|
||||
if (!(attr->value_tag & IPP_TAG_COPY))
|
||||
{
|
||||
@@ -4980,8 +5026,13 @@ ipp_free_values(ipp_attribute_t *attr, /* I - Attribute to free values from */
|
||||
{
|
||||
case IPP_TAG_TEXTLANG :
|
||||
case IPP_TAG_NAMELANG :
|
||||
if (element == 0 && count == attr->num_values && attr->values[0].string.language)
|
||||
if (element == 0 && count == attr->num_values &&
|
||||
attr->values[0].string.language)
|
||||
{
|
||||
_cupsStrFree(attr->values[0].string.language);
|
||||
attr->values[0].string.language = NULL;
|
||||
}
|
||||
/* Fall through to other string values */
|
||||
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
@@ -4995,7 +5046,10 @@ ipp_free_values(ipp_attribute_t *attr, /* I - Attribute to free values from */
|
||||
for (i = count, value = attr->values + element;
|
||||
i > 0;
|
||||
i --, value ++)
|
||||
{
|
||||
_cupsStrFree(value->string.text);
|
||||
value->string.text = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPP_TAG_DEFAULT :
|
||||
@@ -5016,7 +5070,10 @@ ipp_free_values(ipp_attribute_t *attr, /* I - Attribute to free values from */
|
||||
for (i = count, value = attr->values + element;
|
||||
i > 0;
|
||||
i --, value ++)
|
||||
{
|
||||
ippDelete(value->collection);
|
||||
value->collection = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPP_TAG_STRING :
|
||||
@@ -5024,8 +5081,13 @@ ipp_free_values(ipp_attribute_t *attr, /* I - Attribute to free values from */
|
||||
for (i = count, value = attr->values + element;
|
||||
i > 0;
|
||||
i --, value ++)
|
||||
{
|
||||
if (value->unknown.data)
|
||||
{
|
||||
free(value->unknown.data);
|
||||
value->unknown.data = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5273,9 +5335,8 @@ ipp_read_http(http_t *http, /* I - Client connection */
|
||||
ipp_uchar_t *buffer, /* O - Buffer for data */
|
||||
size_t length) /* I - Total length */
|
||||
{
|
||||
int tbytes, /* Total bytes read */
|
||||
bytes; /* Bytes read this pass */
|
||||
char len[32]; /* Length string */
|
||||
int tbytes, /* Total bytes read */
|
||||
bytes; /* Bytes read this pass */
|
||||
|
||||
|
||||
DEBUG_printf(("7ipp_read_http(http=%p, buffer=%p, length=%d)",
|
||||
@@ -5295,91 +5356,36 @@ ipp_read_http(http_t *http, /* I - Client connection */
|
||||
if (http->state == HTTP_WAITING)
|
||||
break;
|
||||
|
||||
if (http->used > 0 && http->data_encoding == HTTP_ENCODE_LENGTH)
|
||||
if (http->used == 0 && !http->blocking)
|
||||
{
|
||||
/*
|
||||
* Do "fast read" from HTTP buffer directly...
|
||||
* Wait up to 10 seconds for more data on non-blocking sockets...
|
||||
*/
|
||||
|
||||
if (http->used > (int)(length - tbytes))
|
||||
bytes = (int)(length - tbytes);
|
||||
else
|
||||
bytes = http->used;
|
||||
|
||||
if (bytes == 1)
|
||||
buffer[0] = http->buffer[0];
|
||||
else
|
||||
memcpy(buffer, http->buffer, bytes);
|
||||
|
||||
http->used -= bytes;
|
||||
http->data_remaining -= bytes;
|
||||
|
||||
if (http->data_remaining <= INT_MAX)
|
||||
http->_data_remaining = (int)http->data_remaining;
|
||||
else
|
||||
http->_data_remaining = INT_MAX;
|
||||
|
||||
if (http->used > 0)
|
||||
memmove(http->buffer, http->buffer + bytes, http->used);
|
||||
|
||||
if (http->data_remaining == 0)
|
||||
{
|
||||
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
|
||||
{
|
||||
/*
|
||||
* Get the trailing CR LF after the chunk...
|
||||
*/
|
||||
|
||||
if (!httpGets(len, sizeof(len), http))
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (http->data_encoding != HTTP_ENCODE_CHUNKED)
|
||||
{
|
||||
if (http->state == HTTP_POST_RECV)
|
||||
http->state ++;
|
||||
else
|
||||
http->state = HTTP_WAITING;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Wait a maximum of 1 second for data...
|
||||
*/
|
||||
|
||||
if (!http->blocking)
|
||||
if (!httpWait(http, 10000))
|
||||
{
|
||||
/*
|
||||
* Wait up to 10 seconds for more data on non-blocking sockets...
|
||||
* Signal no data...
|
||||
*/
|
||||
|
||||
if (!httpWait(http, 10000))
|
||||
{
|
||||
/*
|
||||
* Signal no data...
|
||||
*/
|
||||
|
||||
bytes = -1;
|
||||
break;
|
||||
}
|
||||
bytes = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((bytes = httpRead2(http, (char *)buffer, length - tbytes)) < 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
break;
|
||||
#else
|
||||
if (errno != EAGAIN && errno != EINTR)
|
||||
break;
|
||||
|
||||
bytes = 0;
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
else if (bytes == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((bytes = httpRead2(http, (char *)buffer, length - tbytes)) < 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
break;
|
||||
#else
|
||||
if (errno != EAGAIN && errno != EINTR)
|
||||
break;
|
||||
|
||||
bytes = 0;
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
else if (bytes == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+144
-19
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Internet Printing Protocol definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -150,13 +150,13 @@ typedef enum ipp_op_e /**** IPP operations ****/
|
||||
IPP_SET_PRINTER_ATTRIBUTES, /* Set printer attributes @private@ */
|
||||
IPP_SET_JOB_ATTRIBUTES, /* Set job attributes */
|
||||
IPP_GET_PRINTER_SUPPORTED_VALUES, /* Get supported attribute values */
|
||||
IPP_CREATE_PRINTER_SUBSCRIPTION, /* Create a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
IPP_CREATE_JOB_SUBSCRIPTION, /* Create a job subscription @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
IPP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
IPP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
IPP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
IPP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
IPP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
IPP_CREATE_PRINTER_SUBSCRIPTION, /* Create a printer subscription @since CUPS 1.2/OS X 10.5@ */
|
||||
IPP_CREATE_JOB_SUBSCRIPTION, /* Create a job subscription @since CUPS 1.2/OS X 10.5@ */
|
||||
IPP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2/OS X 10.5@ */
|
||||
IPP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2/OS X 10.5@ */
|
||||
IPP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2/OS X 10.5@ */
|
||||
IPP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2/OS X 10.5@ */
|
||||
IPP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2/OS X 10.5@ */
|
||||
IPP_SEND_NOTIFICATIONS, /* Send notification events @private@ */
|
||||
IPP_GET_RESOURCE_ATTRIBUTES, /* Get resource attributes @private@ */
|
||||
IPP_GET_RESOURCE_DATA, /* Get resource data @private@ */
|
||||
@@ -188,6 +188,7 @@ typedef enum ipp_op_e /**** IPP operations ****/
|
||||
IPP_RESUBMIT_JOB, /* Resubmit-Job */
|
||||
IPP_CLOSE_JOB, /* Close-Job */
|
||||
IPP_IDENTIFY_PRINTER, /* Identify-Printer (proposed IPP JPS3) */
|
||||
IPP_VALIDATE_DOCUMENT, /* Validate-Document (proposed IPP JPS3) */
|
||||
IPP_PRIVATE = 0x4000, /* Reserved @private@ */
|
||||
CUPS_GET_DEFAULT, /* Get the default printer */
|
||||
CUPS_GET_PRINTERS, /* Get a list of printers and/or classes */
|
||||
@@ -202,9 +203,9 @@ typedef enum ipp_op_e /**** IPP operations ****/
|
||||
CUPS_GET_DEVICES, /* Get a list of supported devices */
|
||||
CUPS_GET_PPDS, /* Get a list of supported drivers */
|
||||
CUPS_MOVE_JOB, /* Move a job to a different printer */
|
||||
CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
CUPS_GET_PPD, /* Get a PPD file @since CUPS 1.3/Mac OS X 10.5@ */
|
||||
CUPS_GET_DOCUMENT = 0x4027 /* Get a document file @since CUPS 1.4/Mac OS X 10.6@ */
|
||||
CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2/OS X 10.5@ */
|
||||
CUPS_GET_PPD, /* Get a PPD file @since CUPS 1.3/OS X 10.5@ */
|
||||
CUPS_GET_DOCUMENT = 0x4027 /* Get a document file @since CUPS 1.4/OS X 10.6@ */
|
||||
|
||||
/* Legacy names for the add operations */
|
||||
#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
|
||||
@@ -304,8 +305,8 @@ typedef enum ipp_status_e /**** IPP status codes ****/
|
||||
IPP_TOO_MANY_JOBS, /* server-error-too-many-jobs */
|
||||
IPP_TOO_MANY_DOCUMENTS, /* server-error-too-many-documents */
|
||||
|
||||
IPP_AUTHENTICATION_CANCELED = 0x1000, /* Authentication canceled by user @since CUPS 1.5/Mac OS X 10.7@ */
|
||||
IPP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/Mac OS X 10.7@ */
|
||||
IPP_AUTHENTICATION_CANCELED = 0x1000, /* Authentication canceled by user @since CUPS 1.5/OS X 10.7@ */
|
||||
IPP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/OS X 10.7@ */
|
||||
IPP_UPGRADE_REQUIRED /* TLS upgrade required */
|
||||
|
||||
/* Legacy name for canceled status */
|
||||
@@ -365,14 +366,138 @@ typedef struct _ipp_s ipp_t; /**** IPP request/response data ****/
|
||||
typedef struct _ipp_attribute_s ipp_attribute_t;
|
||||
/**** IPP attribute ****/
|
||||
|
||||
/**** New in CUPS 1.2 ****/
|
||||
/**** New in CUPS 1.2/OS X 10.5 ****/
|
||||
typedef ssize_t (*ipp_iocb_t)(void *context, ipp_uchar_t *buffer, size_t bytes);
|
||||
/**** IPP IO Callback Function @since CUPS 1.2/Mac OS X 10.5@ ****/
|
||||
/**** IPP IO Callback Function @since CUPS 1.2/OS X 10.5@ ****/
|
||||
|
||||
/**** New in CUPS 1.6 ****/
|
||||
/**** New in CUPS 1.6/OS X 10.8 ****/
|
||||
typedef int (*ipp_copycb_t)(void *context, ipp_t *dst, ipp_attribute_t *attr);
|
||||
|
||||
|
||||
/*
|
||||
* The following structures are PRIVATE starting with CUPS 1.6/OS X 10.8.
|
||||
* Please use the new accessor functions available in CUPS 1.6 and later, as
|
||||
* these definitions will be moved to a private header file in a future release.
|
||||
*
|
||||
* Define _IPP_PRIVATE_STRUCTURES to cause the private IPP structures to be
|
||||
* exposed in CUPS 1.6. This happens automatically on OS X when compiling for
|
||||
* a deployment target of 10.7 or earlier.
|
||||
*/
|
||||
|
||||
# if defined(_CUPS_SOURCE) || defined(_CUPS_IPP_PRIVATE_H_)
|
||||
/* Building CUPS */
|
||||
# define _IPP_PRIVATE_STRUCTURES 1
|
||||
# elif defined(__APPLE__)
|
||||
# if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
|
||||
/* Building for 10.7 and earlier */
|
||||
# define _IPP_PRIVATE_STRUCTURES 1
|
||||
# elif !defined(MAC_OS_X_VERSION_10_8)
|
||||
/* Building for 10.7 and earlier */
|
||||
# define _IPP_PRIVATE_STRUCTURES 1
|
||||
# endif /* MAC_OS_X_VERSION_10_8 && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 */
|
||||
# endif /* _CUPS_SOURCE || _CUPS_IPP_PRIVATE_H_ */
|
||||
|
||||
# ifdef _IPP_PRIVATE_STRUCTURES
|
||||
typedef union _ipp_request_u /**** Request Header ****/
|
||||
{
|
||||
struct /* Any Header */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
int op_status; /* Operation ID or status code*/
|
||||
int request_id; /* Request ID */
|
||||
} any;
|
||||
|
||||
struct /* Operation Header */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
ipp_op_t operation_id; /* Operation ID */
|
||||
int request_id; /* Request ID */
|
||||
} op;
|
||||
|
||||
struct /* Status Header */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
ipp_status_t status_code; /* Status code */
|
||||
int request_id; /* Request ID */
|
||||
} status;
|
||||
|
||||
/**** New in CUPS 1.1.19 ****/
|
||||
struct /* Event Header @since CUPS 1.1.19/OS X 10.3@ */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
ipp_status_t status_code; /* Status code */
|
||||
int request_id; /* Request ID */
|
||||
} event;
|
||||
} _ipp_request_t;
|
||||
|
||||
/**** New in CUPS 1.1.19 ****/
|
||||
|
||||
typedef union _ipp_value_u /**** Attribute Value ****/
|
||||
{
|
||||
int integer; /* Integer/enumerated value */
|
||||
|
||||
char boolean; /* Boolean value */
|
||||
|
||||
ipp_uchar_t date[11]; /* Date/time value */
|
||||
|
||||
struct
|
||||
{
|
||||
int xres, /* Horizontal resolution */
|
||||
yres; /* Vertical resolution */
|
||||
ipp_res_t units; /* Resolution units */
|
||||
} resolution; /* Resolution value */
|
||||
|
||||
struct
|
||||
{
|
||||
int lower, /* Lower value */
|
||||
upper; /* Upper value */
|
||||
} range; /* Range of integers value */
|
||||
|
||||
struct
|
||||
{
|
||||
char *language; /* Language code */
|
||||
char *text; /* String */
|
||||
} string; /* String with language value */
|
||||
|
||||
struct
|
||||
{
|
||||
int length; /* Length of attribute */
|
||||
void *data; /* Data in attribute */
|
||||
} unknown; /* Unknown attribute type */
|
||||
|
||||
/**** New in CUPS 1.1.19 ****/
|
||||
ipp_t *collection; /* Collection value @since CUPS 1.1.19/OS X 10.3@ */
|
||||
} _ipp_value_t;
|
||||
typedef _ipp_value_t ipp_value_t; /**** Convenience typedef that will be removed @private@ ****/
|
||||
|
||||
struct _ipp_attribute_s /**** Attribute ****/
|
||||
{
|
||||
ipp_attribute_t *next; /* Next attribute in list */
|
||||
ipp_tag_t group_tag, /* Job/Printer/Operation group tag */
|
||||
value_tag; /* What type of value is it? */
|
||||
char *name; /* Name of attribute */
|
||||
int num_values; /* Number of values */
|
||||
_ipp_value_t values[1]; /* Values */
|
||||
};
|
||||
|
||||
struct _ipp_s /**** IPP Request/Response/Notification ****/
|
||||
{
|
||||
ipp_state_t state; /* State of request */
|
||||
_ipp_request_t request; /* Request header */
|
||||
ipp_attribute_t *attrs; /* Attributes */
|
||||
ipp_attribute_t *last; /* Last attribute in list */
|
||||
ipp_attribute_t *current; /* Current attribute (for read/write) */
|
||||
ipp_tag_t curtag; /* Current attribute group tag */
|
||||
|
||||
/**** New in CUPS 1.2 ****/
|
||||
ipp_attribute_t *prev; /* Previous attribute (for read) @since CUPS 1.2/OS X 10.5@ */
|
||||
|
||||
/**** New in CUPS 1.4.4 ****/
|
||||
int use; /* Use count @since CUPS 1.4.4/OS X 10.6.?@ */
|
||||
};
|
||||
# endif /* _IPP_PRIVATE_STRUCTURES */
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
@@ -435,7 +560,7 @@ extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr) _CUPS_API_1_1
|
||||
extern ipp_state_t ippReadFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19;
|
||||
extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19;
|
||||
|
||||
/**** New in CUPS 1.2/Mac OS X 10.5 ****/
|
||||
/**** New in CUPS 1.2/OS X 10.5 ****/
|
||||
extern ipp_attribute_t *ippAddOctetString(ipp_t *ipp, ipp_tag_t group,
|
||||
const char *name,
|
||||
const void *data, int datalen) _CUPS_API_1_2;
|
||||
@@ -448,11 +573,11 @@ extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking,
|
||||
extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking,
|
||||
ipp_t *parent, ipp_t *ipp) _CUPS_API_1_2;
|
||||
|
||||
/**** New in CUPS 1.4/Mac OS X 10.6 ****/
|
||||
/**** New in CUPS 1.4/OS X 10.6 ****/
|
||||
extern const char *ippTagString(ipp_tag_t tag) _CUPS_API_1_4;
|
||||
extern ipp_tag_t ippTagValue(const char *name) _CUPS_API_1_4;
|
||||
|
||||
/**** New in CUPS 1.6 ****/
|
||||
/**** New in CUPS 1.6/OS X 10.8 ****/
|
||||
extern ipp_attribute_t *ippAddOutOfBand(ipp_t *ipp, ipp_tag_t group,
|
||||
ipp_tag_t value_tag, const char *name)
|
||||
_CUPS_API_1_6;
|
||||
|
||||
@@ -71,6 +71,7 @@ extern const char *_cupsLangString(cups_lang_t *lang,
|
||||
extern void _cupsMessageFree(cups_array_t *a);
|
||||
extern cups_array_t *_cupsMessageLoad(const char *filename, int unquote);
|
||||
extern const char *_cupsMessageLookup(cups_array_t *a, const char *m);
|
||||
extern cups_array_t *_cupsMessageNew(void *context);
|
||||
extern void _cupsSetLocale(char *argv[]);
|
||||
|
||||
|
||||
|
||||
+71
-22
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* I18N/language support for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -17,26 +17,27 @@
|
||||
* Contents:
|
||||
*
|
||||
* _cupsAppleLanguage() - Get the Apple language identifier associated with
|
||||
* a locale ID.
|
||||
* a locale ID.
|
||||
* _cupsEncodingName() - Return the character encoding name string for the
|
||||
* given encoding enumeration.
|
||||
* cupsLangDefault() - Return the default language.
|
||||
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.) for
|
||||
* the given language.
|
||||
* cupsLangFlush() - Flush all language data out of the cache.
|
||||
* cupsLangFree() - Free language data.
|
||||
* cupsLangGet() - Get a language.
|
||||
* _cupsLangString() - Get a message string.
|
||||
* given encoding enumeration.
|
||||
* cupsLangDefault() - Return the default language.
|
||||
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.)
|
||||
* for the given language.
|
||||
* cupsLangFlush() - Flush all language data out of the cache.
|
||||
* cupsLangFree() - Free language data.
|
||||
* cupsLangGet() - Get a language.
|
||||
* _cupsLangString() - Get a message string.
|
||||
* _cupsMessageFree() - Free a messages array.
|
||||
* _cupsMessageLoad() - Load a .po file into a messages array.
|
||||
* _cupsMessageLookup() - Lookup a message string.
|
||||
* _cupsMessageNew() - Make a new message catalog array.
|
||||
* appleLangDefault() - Get the default locale string.
|
||||
* appleMessageLoad() - Load a message catalog from a localizable bundle.
|
||||
* cups_cache_lookup() - Lookup a language in the cache...
|
||||
* cups_message_compare() - Compare two messages.
|
||||
* cups_message_free() - Free a message.
|
||||
* cups_message_load() - Load the message catalog for a language.
|
||||
* cups_unquote() - Unquote characters in strings...
|
||||
* cups_unquote() - Unquote characters in strings...
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -787,7 +788,7 @@ _cupsLangString(cups_lang_t *lang, /* I - Language */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!lang || !message)
|
||||
if (!lang || !message || !*message)
|
||||
return (message);
|
||||
|
||||
_cupsMutexLock(&lang_mutex);
|
||||
@@ -854,10 +855,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
* Create an array to hold the messages...
|
||||
*/
|
||||
|
||||
if ((a = cupsArrayNew3((cups_array_func_t)cups_message_compare, NULL,
|
||||
(cups_ahash_func_t)NULL, 0,
|
||||
(cups_acopy_func_t)NULL,
|
||||
(cups_afree_func_t)cups_message_free)) == NULL)
|
||||
if ((a = _cupsMessageNew(NULL)) == NULL)
|
||||
{
|
||||
DEBUG_puts("5_cupsMessageLoad: Unable to allocate array!");
|
||||
return (NULL);
|
||||
@@ -938,7 +936,23 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
*/
|
||||
|
||||
if (m)
|
||||
cupsArrayAdd(a, m);
|
||||
{
|
||||
if (m->str && m->str[0])
|
||||
{
|
||||
cupsArrayAdd(a, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Translation is empty, don't add it... (STR #4033)
|
||||
*/
|
||||
|
||||
free(m->id);
|
||||
if (m->str)
|
||||
free(m->str);
|
||||
free(m);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new message with the given msgid string...
|
||||
@@ -968,6 +982,11 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
if ((temp = realloc(m->str ? m->str : m->id,
|
||||
length + strlen(ptr) + 1)) == NULL)
|
||||
{
|
||||
if (m->str)
|
||||
free(m->str);
|
||||
free(m->id);
|
||||
free(m);
|
||||
|
||||
cupsFileClose(fp);
|
||||
return (a);
|
||||
}
|
||||
@@ -1005,6 +1024,9 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
|
||||
if ((m->str = strdup(ptr)) == NULL)
|
||||
{
|
||||
free(m->id);
|
||||
free(m);
|
||||
|
||||
cupsFileClose(fp);
|
||||
return (a);
|
||||
}
|
||||
@@ -1016,7 +1038,23 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
*/
|
||||
|
||||
if (m)
|
||||
cupsArrayAdd(a, m);
|
||||
{
|
||||
if (m->str && m->str[0])
|
||||
{
|
||||
cupsArrayAdd(a, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Translation is empty, don't add it... (STR #4033)
|
||||
*/
|
||||
|
||||
free(m->id);
|
||||
if (m->str)
|
||||
free(m->str);
|
||||
free(m);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the message catalog file and return the new array...
|
||||
@@ -1100,6 +1138,20 @@ _cupsMessageLookup(cups_array_t *a, /* I - Message array */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsMessageNew()' - Make a new message catalog array.
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Array */
|
||||
_cupsMessageNew(void *context) /* I - User data */
|
||||
{
|
||||
return (cupsArrayNew3((cups_array_func_t)cups_message_compare, context,
|
||||
(cups_ahash_func_t)NULL, 0,
|
||||
(cups_acopy_func_t)NULL,
|
||||
(cups_afree_func_t)cups_message_free));
|
||||
}
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* 'appleLangDefault()' - Get the default locale string.
|
||||
@@ -1334,10 +1386,7 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
* plist as the user data.
|
||||
*/
|
||||
|
||||
return (cupsArrayNew3((cups_array_func_t)cups_message_compare, (void *)plist,
|
||||
(cups_ahash_func_t)NULL, 0,
|
||||
(cups_acopy_func_t)NULL,
|
||||
(cups_afree_func_t)cups_message_free));
|
||||
return (_cupsMessageNew((void *)plist));
|
||||
}
|
||||
# endif /* CUPS_BUNDLEDIR */
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
#include "WinVersRes.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION MASTER_PROD_VERS
|
||||
PRODUCTVERSION MASTER_PROD_VERS
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", MASTER_COMPANY_NAME
|
||||
VALUE "FileDescription", "CUPS Library"
|
||||
VALUE "FileVersion", MASTER_PROD_VERS_STR
|
||||
VALUE "InternalName", "libcups2.dll"
|
||||
VALUE "LegalCopyright", MASTER_LEGAL_COPYRIGHT
|
||||
VALUE "OriginalFilename", "libcups2.dll"
|
||||
VALUE "ProductName", MASTER_PROD_NAME
|
||||
VALUE "ProductVersion", MASTER_PROD_VERS_STR
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
+9
-9
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* PPD localization routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -61,7 +61,7 @@ static cups_lang_t *ppd_ll_CC(char *ll_CC, int ll_CC_size);
|
||||
* descriptions, printer presets, and custom option parameters. Each
|
||||
* localized string uses the UTF-8 character encoding.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@@ -246,7 +246,7 @@ ppdLocalizeAttr(ppd_file_t *ppd, /* I - PPD file */
|
||||
*
|
||||
* If no value of the requested scheme can be found, NULL is returned.
|
||||
*
|
||||
* @since CUPS 1.3/Mac OS X 10.5@
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - Value or NULL if not found */
|
||||
@@ -310,9 +310,9 @@ ppdLocalizeIPPReason(
|
||||
!strncmp(reason, "shutdown", 8))
|
||||
message = _("The printer is not connected.");
|
||||
else if (!strncmp(reason, "toner-low", 9))
|
||||
message = _("The printer is low on toner.");
|
||||
message = _("The printer is running low on toner.");
|
||||
else if (!strncmp(reason, "toner-empty", 11))
|
||||
message = _("The printer is out of toner.");
|
||||
message = _("The printer may be out of toner.");
|
||||
else if (!strncmp(reason, "cover-open", 10))
|
||||
message = _("The printer's cover is open.");
|
||||
else if (!strncmp(reason, "interlock-open", 14))
|
||||
@@ -332,7 +332,7 @@ ppdLocalizeIPPReason(
|
||||
else if (!strncmp(reason, "output-area-full", 16))
|
||||
message = _("The output bin is full.");
|
||||
else if (!strncmp(reason, "marker-supply-low", 17))
|
||||
message = _("The printer is low on ink.");
|
||||
message = _("The printer is running low on ink.");
|
||||
else if (!strncmp(reason, "marker-supply-empty", 19))
|
||||
message = _("The printer may be out of ink.");
|
||||
else if (!strncmp(reason, "marker-waste-almost-full", 24))
|
||||
@@ -351,7 +351,7 @@ ppdLocalizeIPPReason(
|
||||
message = _("The developer unit will need to be replaced soon.");
|
||||
else if (!strncmp(reason, "developer-empty", 15))
|
||||
message = _("The developer unit needs to be replaced.");
|
||||
|
||||
|
||||
if (message)
|
||||
{
|
||||
strlcpy(buffer, _cupsLangString(lang, message), bufsize);
|
||||
@@ -499,7 +499,7 @@ ppdLocalizeIPPReason(
|
||||
* text from the attribute value. If no localized text for the requested
|
||||
* name can be found, @code NULL@ is returned.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
const char * /* O - Value or @code NULL@ if not found */
|
||||
@@ -637,7 +637,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
|
||||
/*
|
||||
* '_ppdHashName()' - Generate a hash value for a device or profile name.
|
||||
*
|
||||
* This function is primarily used on Mac OS X, but is generally accessible
|
||||
* This function is primarily used on OS X, but is generally accessible
|
||||
* since cupstestppd needs to check for profile name collisions in PPD files...
|
||||
*/
|
||||
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Option marking routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -575,7 +575,7 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
|
||||
*
|
||||
* Options are returned from all groups in ascending alphanumeric order.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ppd_option_t * /* O - First option or @code NULL@ */
|
||||
@@ -593,7 +593,7 @@ ppdFirstOption(ppd_file_t *ppd) /* I - PPD file */
|
||||
*
|
||||
* Options are returned from all groups in ascending alphanumeric order.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
ppd_option_t * /* O - Next option or @code NULL@ */
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Notification routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2005-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -33,7 +33,7 @@
|
||||
*
|
||||
* The returned string must be freed by the caller using @code free@.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Subject string or @code NULL@ */
|
||||
@@ -164,7 +164,7 @@ cupsNotifySubject(cups_lang_t *lang, /* I - Language data */
|
||||
*
|
||||
* The returned string must be freed by the caller using @code free@.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Message text or @code NULL@ */
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Option routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -438,7 +438,7 @@ cupsParseOptions(
|
||||
/*
|
||||
* 'cupsRemoveOption()' - Remove an option from an option array.
|
||||
*
|
||||
* @since CUPS 1.2/Mac OS X 10.5@
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
*/
|
||||
|
||||
int /* O - New number of options */
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Page size functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdPageSize()' - Get the page size record for the given size.
|
||||
* 'ppdPageSize()' - Get the page size record for the named size.
|
||||
*/
|
||||
|
||||
ppd_size_t * /* O - Size record for page or NULL */
|
||||
@@ -198,7 +198,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
|
||||
* If the specified PPD file does not support custom page sizes, both
|
||||
* "minimum" and "maximum" are filled with zeroes.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
*/
|
||||
|
||||
int /* O - 1 if custom sizes are supported, 0 otherwise */
|
||||
|
||||
+160
-130
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* PPD cache implementation for CUPS.
|
||||
*
|
||||
* Copyright 2010-2011 by Apple Inc.
|
||||
* Copyright 2010-2012 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -69,7 +69,8 @@ static int pwg_compare_finishings(_pwg_finishings_t *a,
|
||||
_pwg_finishings_t *b);
|
||||
static void pwg_free_finishings(_pwg_finishings_t *f);
|
||||
static void pwg_ppdize_name(const char *ipp, char *name, size_t namesize);
|
||||
static void pwg_unppdize_name(const char *ppd, char *name, size_t namesize);
|
||||
static void pwg_unppdize_name(const char *ppd, char *name, size_t namesize,
|
||||
const char *dashchars);
|
||||
|
||||
|
||||
/*
|
||||
@@ -171,6 +172,8 @@ _ppdCacheCreateWithFile(
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
pc->max_copies = 9999;
|
||||
|
||||
/*
|
||||
* Read the file...
|
||||
*/
|
||||
@@ -327,7 +330,7 @@ _ppdCacheCreateWithFile(
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((num_sizes = atoi(value)) <= 0 || num_sizes > 65536)
|
||||
if ((num_sizes = atoi(value)) < 0 || num_sizes > 65536)
|
||||
{
|
||||
DEBUG_printf(("_ppdCacheCreateWithFile: Bad NumSizes value %d on line "
|
||||
"%d.", num_sizes, linenum));
|
||||
@@ -335,12 +338,15 @@ _ppdCacheCreateWithFile(
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((pc->sizes = calloc(num_sizes, sizeof(_pwg_size_t))) == NULL)
|
||||
if (num_sizes > 0)
|
||||
{
|
||||
DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d sizes.",
|
||||
num_sizes));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
goto create_error;
|
||||
if ((pc->sizes = calloc(num_sizes, sizeof(_pwg_size_t))) == NULL)
|
||||
{
|
||||
DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d sizes.",
|
||||
num_sizes));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
goto create_error;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!_cups_strcasecmp(line, "Size"))
|
||||
@@ -553,6 +559,8 @@ _ppdCacheCreateWithFile(
|
||||
|
||||
cupsArrayAdd(pc->finishings, finishings);
|
||||
}
|
||||
else if (!_cups_strcasecmp(line, "MaxCopies"))
|
||||
pc->max_copies = atoi(value);
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("_ppdCacheCreateWithFile: Unknown %s on line %d.", line,
|
||||
@@ -680,145 +688,145 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Copy and convert size data...
|
||||
*/
|
||||
|
||||
if (ppd->num_sizes == 0)
|
||||
if (ppd->num_sizes > 0)
|
||||
{
|
||||
DEBUG_puts("_ppdCacheCreateWithPPD: No page sizes in PPD.");
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((pc->sizes = calloc(ppd->num_sizes, sizeof(_pwg_size_t))) == NULL)
|
||||
{
|
||||
DEBUG_printf(("_ppdCacheCreateWithPPD: Unable to allocate %d "
|
||||
"_pwg_size_t's.", ppd->num_sizes));
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
for (i = ppd->num_sizes, pwg_size = pc->sizes, ppd_size = ppd->sizes;
|
||||
i > 0;
|
||||
i --, ppd_size ++)
|
||||
{
|
||||
/*
|
||||
* Don't copy over custom size...
|
||||
*/
|
||||
|
||||
if (!_cups_strcasecmp(ppd_size->name, "Custom"))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Convert the PPD size name to the corresponding PWG keyword name.
|
||||
*/
|
||||
|
||||
if ((pwg_media = _pwgMediaForPPD(ppd_size->name)) != NULL)
|
||||
if ((pc->sizes = calloc(ppd->num_sizes, sizeof(_pwg_size_t))) == NULL)
|
||||
{
|
||||
/*
|
||||
* Standard name, do we have conflicts?
|
||||
*/
|
||||
|
||||
for (j = 0; j < pc->num_sizes; j ++)
|
||||
if (!strcmp(pc->sizes[j].map.pwg, pwg_media->pwg))
|
||||
{
|
||||
pwg_media = NULL;
|
||||
break;
|
||||
}
|
||||
DEBUG_printf(("_ppdCacheCreateWithPPD: Unable to allocate %d "
|
||||
"_pwg_size_t's.", ppd->num_sizes));
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if (pwg_media)
|
||||
for (i = ppd->num_sizes, pwg_size = pc->sizes, ppd_size = ppd->sizes;
|
||||
i > 0;
|
||||
i --, ppd_size ++)
|
||||
{
|
||||
/*
|
||||
* Standard name and no conflicts, use it!
|
||||
* Don't copy over custom size...
|
||||
*/
|
||||
|
||||
pwg_name = pwg_media->pwg;
|
||||
new_known_pwg = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_cups_strcasecmp(ppd_size->name, "Custom"))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Not a standard name; convert it to a PWG vendor name of the form:
|
||||
*
|
||||
* pp_lowerppd_WIDTHxHEIGHTuu
|
||||
* Convert the PPD size name to the corresponding PWG keyword name.
|
||||
*/
|
||||
|
||||
pwg_name = pwg_keyword;
|
||||
new_known_pwg = 0;
|
||||
|
||||
pwg_unppdize_name(ppd_size->name, ppd_name, sizeof(ppd_name));
|
||||
_pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), NULL, ppd_name,
|
||||
_PWG_FROMPTS(ppd_size->width),
|
||||
_PWG_FROMPTS(ppd_size->length));
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have a similar paper with non-zero margins then we only
|
||||
* want to keep it if it has a larger imageable area length.
|
||||
*/
|
||||
|
||||
pwg_media = _pwgMediaForSize(_PWG_FROMPTS(ppd_size->width),
|
||||
_PWG_FROMPTS(ppd_size->length));
|
||||
new_width = pwg_media->width;
|
||||
new_length = pwg_media->length;
|
||||
new_left = _PWG_FROMPTS(ppd_size->left);
|
||||
new_bottom = _PWG_FROMPTS(ppd_size->bottom);
|
||||
new_right = _PWG_FROMPTS(ppd_size->width - ppd_size->right);
|
||||
new_top = _PWG_FROMPTS(ppd_size->length - ppd_size->top);
|
||||
new_imageable = new_length - new_top - new_bottom;
|
||||
new_borderless = new_bottom == 0 && new_top == 0 &&
|
||||
new_left == 0 && new_right == 0;
|
||||
|
||||
for (k = pc->num_sizes, similar = 0, old_size = pc->sizes, new_size = NULL;
|
||||
k > 0 && !similar;
|
||||
k --, old_size ++)
|
||||
{
|
||||
old_imageable = old_size->length - old_size->top - old_size->bottom;
|
||||
old_borderless = old_size->left == 0 && old_size->bottom == 0 &&
|
||||
old_size->right == 0 && old_size->top == 0;
|
||||
old_known_pwg = strncmp(old_size->map.pwg, "oe_", 3) &&
|
||||
strncmp(old_size->map.pwg, "om_", 3);
|
||||
|
||||
similar = old_borderless == new_borderless &&
|
||||
_PWG_EQUIVALENT(old_size->width, new_width) &&
|
||||
_PWG_EQUIVALENT(old_size->length, new_length);
|
||||
|
||||
if (similar &&
|
||||
(new_known_pwg || (!old_known_pwg && new_imageable > old_imageable)))
|
||||
if ((pwg_media = _pwgMediaForPPD(ppd_size->name)) != NULL)
|
||||
{
|
||||
/*
|
||||
* The new paper has a larger imageable area so it could replace
|
||||
* the older paper. Regardless of the imageable area, we always
|
||||
* prefer the size with a well-known PWG name.
|
||||
* Standard name, do we have conflicts?
|
||||
*/
|
||||
|
||||
new_size = old_size;
|
||||
_cupsStrFree(old_size->map.ppd);
|
||||
_cupsStrFree(old_size->map.pwg);
|
||||
for (j = 0; j < pc->num_sizes; j ++)
|
||||
if (!strcmp(pc->sizes[j].map.pwg, pwg_media->pwg))
|
||||
{
|
||||
pwg_media = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pwg_media)
|
||||
{
|
||||
/*
|
||||
* Standard name and no conflicts, use it!
|
||||
*/
|
||||
|
||||
pwg_name = pwg_media->pwg;
|
||||
new_known_pwg = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Not a standard name; convert it to a PWG vendor name of the form:
|
||||
*
|
||||
* pp_lowerppd_WIDTHxHEIGHTuu
|
||||
*/
|
||||
|
||||
pwg_name = pwg_keyword;
|
||||
new_known_pwg = 0;
|
||||
|
||||
pwg_unppdize_name(ppd_size->name, ppd_name, sizeof(ppd_name), "_.");
|
||||
_pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), NULL, ppd_name,
|
||||
_PWG_FROMPTS(ppd_size->width),
|
||||
_PWG_FROMPTS(ppd_size->length));
|
||||
}
|
||||
}
|
||||
|
||||
if (!similar)
|
||||
{
|
||||
/*
|
||||
* The paper was unique enough to deserve its own entry so add it to the
|
||||
* end.
|
||||
* If we have a similar paper with non-zero margins then we only want to
|
||||
* keep it if it has a larger imageable area length. The NULL check is for
|
||||
* dimensions that are <= 0...
|
||||
*/
|
||||
|
||||
new_size = pwg_size ++;
|
||||
pc->num_sizes ++;
|
||||
}
|
||||
if ((pwg_media = _pwgMediaForSize(_PWG_FROMPTS(ppd_size->width),
|
||||
_PWG_FROMPTS(ppd_size->length))) == NULL)
|
||||
continue;
|
||||
|
||||
if (new_size)
|
||||
{
|
||||
/*
|
||||
* Save this size...
|
||||
*/
|
||||
new_width = pwg_media->width;
|
||||
new_length = pwg_media->length;
|
||||
new_left = _PWG_FROMPTS(ppd_size->left);
|
||||
new_bottom = _PWG_FROMPTS(ppd_size->bottom);
|
||||
new_right = _PWG_FROMPTS(ppd_size->width - ppd_size->right);
|
||||
new_top = _PWG_FROMPTS(ppd_size->length - ppd_size->top);
|
||||
new_imageable = new_length - new_top - new_bottom;
|
||||
new_borderless = new_bottom == 0 && new_top == 0 &&
|
||||
new_left == 0 && new_right == 0;
|
||||
|
||||
new_size->map.ppd = _cupsStrAlloc(ppd_size->name);
|
||||
new_size->map.pwg = _cupsStrAlloc(pwg_name);
|
||||
new_size->width = new_width;
|
||||
new_size->length = new_length;
|
||||
new_size->left = new_left;
|
||||
new_size->bottom = new_bottom;
|
||||
new_size->right = new_right;
|
||||
new_size->top = new_top;
|
||||
for (k = pc->num_sizes, similar = 0, old_size = pc->sizes, new_size = NULL;
|
||||
k > 0 && !similar;
|
||||
k --, old_size ++)
|
||||
{
|
||||
old_imageable = old_size->length - old_size->top - old_size->bottom;
|
||||
old_borderless = old_size->left == 0 && old_size->bottom == 0 &&
|
||||
old_size->right == 0 && old_size->top == 0;
|
||||
old_known_pwg = strncmp(old_size->map.pwg, "oe_", 3) &&
|
||||
strncmp(old_size->map.pwg, "om_", 3);
|
||||
|
||||
similar = old_borderless == new_borderless &&
|
||||
_PWG_EQUIVALENT(old_size->width, new_width) &&
|
||||
_PWG_EQUIVALENT(old_size->length, new_length);
|
||||
|
||||
if (similar &&
|
||||
(new_known_pwg || (!old_known_pwg && new_imageable > old_imageable)))
|
||||
{
|
||||
/*
|
||||
* The new paper has a larger imageable area so it could replace
|
||||
* the older paper. Regardless of the imageable area, we always
|
||||
* prefer the size with a well-known PWG name.
|
||||
*/
|
||||
|
||||
new_size = old_size;
|
||||
_cupsStrFree(old_size->map.ppd);
|
||||
_cupsStrFree(old_size->map.pwg);
|
||||
}
|
||||
}
|
||||
|
||||
if (!similar)
|
||||
{
|
||||
/*
|
||||
* The paper was unique enough to deserve its own entry so add it to the
|
||||
* end.
|
||||
*/
|
||||
|
||||
new_size = pwg_size ++;
|
||||
pc->num_sizes ++;
|
||||
}
|
||||
|
||||
if (new_size)
|
||||
{
|
||||
/*
|
||||
* Save this size...
|
||||
*/
|
||||
|
||||
new_size->map.ppd = _cupsStrAlloc(ppd_size->name);
|
||||
new_size->map.pwg = _cupsStrAlloc(pwg_name);
|
||||
new_size->width = new_width;
|
||||
new_size->length = new_length;
|
||||
new_size->left = new_left;
|
||||
new_size->bottom = new_bottom;
|
||||
new_size->right = new_right;
|
||||
new_size->top = new_top;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -906,7 +914,8 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
*/
|
||||
|
||||
pwg_name = pwg_keyword;
|
||||
pwg_unppdize_name(choice->choice, pwg_keyword, sizeof(pwg_keyword));
|
||||
pwg_unppdize_name(choice->choice, pwg_keyword, sizeof(pwg_keyword),
|
||||
"_");
|
||||
}
|
||||
|
||||
map->pwg = _cupsStrAlloc(pwg_name);
|
||||
@@ -970,7 +979,8 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
*/
|
||||
|
||||
pwg_name = pwg_keyword;
|
||||
pwg_unppdize_name(choice->choice, pwg_keyword, sizeof(pwg_keyword));
|
||||
pwg_unppdize_name(choice->choice, pwg_keyword, sizeof(pwg_keyword),
|
||||
"_");
|
||||
}
|
||||
|
||||
map->pwg = _cupsStrAlloc(pwg_name);
|
||||
@@ -999,7 +1009,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
i > 0;
|
||||
i --, choice ++, map ++)
|
||||
{
|
||||
pwg_unppdize_name(choice->choice, pwg_keyword, sizeof(pwg_keyword));
|
||||
pwg_unppdize_name(choice->choice, pwg_keyword, sizeof(pwg_keyword), "_");
|
||||
|
||||
map->pwg = _cupsStrAlloc(pwg_keyword);
|
||||
map->ppd = _cupsStrAlloc(choice->choice);
|
||||
@@ -1348,6 +1358,17 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
NULL)) != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Max copies...
|
||||
*/
|
||||
|
||||
if ((ppd_attr = ppdFindAttr(ppd, "cupsMaxCopies", NULL)) != NULL)
|
||||
pc->max_copies = atoi(ppd_attr->value);
|
||||
else if (ppd->manual_copies)
|
||||
pc->max_copies = 1;
|
||||
else
|
||||
pc->max_copies = 9999;
|
||||
|
||||
/*
|
||||
* Return the cache data...
|
||||
*/
|
||||
@@ -2333,6 +2354,12 @@ _ppdCacheWriteFile(
|
||||
cupsFilePutChar(fp, '\n');
|
||||
}
|
||||
|
||||
/*
|
||||
* Max copies...
|
||||
*/
|
||||
|
||||
cupsFilePrintf(fp, "MaxCopies %d\n", pc->max_copies);
|
||||
|
||||
/*
|
||||
* IPP attributes, if any...
|
||||
*/
|
||||
@@ -2578,7 +2605,8 @@ pwg_ppdize_name(const char *ipp, /* I - IPP keyword */
|
||||
static void
|
||||
pwg_unppdize_name(const char *ppd, /* I - PPD keyword */
|
||||
char *name, /* I - Name buffer */
|
||||
size_t namesize) /* I - Size of name buffer */
|
||||
size_t namesize, /* I - Size of name buffer */
|
||||
const char *dashchars)/* I - Characters to be replaced by dashes */
|
||||
{
|
||||
char *ptr, /* Pointer into name buffer */
|
||||
*end; /* End of name buffer */
|
||||
@@ -2588,8 +2616,10 @@ pwg_unppdize_name(const char *ppd, /* I - PPD keyword */
|
||||
{
|
||||
if (_cups_isalnum(*ppd) || *ppd == '-')
|
||||
*ptr++ = tolower(*ppd & 255);
|
||||
else if (*ppd == '_' || *ppd == '.')
|
||||
else if (strchr(dashchars, *ppd))
|
||||
*ptr++ = '-';
|
||||
else
|
||||
*ptr++ = *ppd;
|
||||
|
||||
if (!_cups_isupper(*ppd) && _cups_isalnum(*ppd) &&
|
||||
_cups_isupper(ppd[1]) && ptr < end)
|
||||
|
||||
@@ -49,7 +49,7 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define _PPD_CACHE_VERSION 2 /* Version number in cache file */
|
||||
# define _PPD_CACHE_VERSION 3 /* Version number in cache file */
|
||||
|
||||
|
||||
/*
|
||||
@@ -141,6 +141,7 @@ struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
|
||||
*prefilters; /* cupsPreFilter values */
|
||||
int single_file; /* cupsSingleFile value */
|
||||
cups_array_t *finishings; /* cupsIPPFinishings values */
|
||||
int max_copies; /* cupsMaxCopies value */
|
||||
};
|
||||
|
||||
|
||||
|
||||
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