Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet b7d698516c Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.4.8@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
767 arquivos alterados com 42102 adições e 121648 exclusões
+8
Ver Arquivo
@@ -3,6 +3,14 @@ CHANGES-1.3.txt
CHANGES IN CUPS V1.3.11
- The scheduler did not prevent nested classes (STR #3211)
- The scheduler did not reprint processing jobs that were moved to
another destination (STR #3222)
- The scheduler did not reset the current job file when stopping a
printer (STR #3226)
- The scheduler did not handle POSTs to custom CGIs properly (STR #3221)
- The pdftops filter did not print landscape PDF pages properly
(STR #2881)
- The scheduler did not handle partial header lines properly from CGI
programs (STR #3194)
- The web interface could hang on OpenBSD (STR #3176, STR #3196)
+435 -1
Ver Arquivo
@@ -1,6 +1,440 @@
CHANGES.txt - 2009-05-16
CHANGES.txt - 2011-07-25
------------------------
CHANGES IN CUPS V1.4.8
- The scheduler would delete job data files when restarted (STR #3880)
- The network backends could crash if a printer returned a value of 0
for the maximum capacity for a supply (STR #3875)
CHANGES IN CUPS V1.4.7
- Documentation changes (STR #3710, STR #3720, STR #3745, STR #3750,
STR #3757, STR #3758, STR #3782, STR #3826, STR #3829, STR #3837)
- Web interface fixes (STR #3412, STR #3345, STR #3455, STR #3707,
STR #3755, STR #3769, STR #3783)
- Configure script fixes (STR #3659, STR #3691)
- Compilation fixes (STR #3718, STR #3771, STR #3774)
- The imageto* filters could crash with bad GIF files (STR #3867)
- The scheduler might leave old job data files in the spool directory
(STR #3795)
- CUPS did not work with locales using the ASCII character set
(STR #3832)
- httpAddrString() did not return a URI-style IPv6 numeric address
(STR #3814)
- Fixed an issue when reading compressed CUPS raster streams (STR #3812)
- Fixed an issue with PostScript printer auto-configuration (STR #3443)
- Fixed some compatibility issues with the libusb-based USB backend
(STR #3799)
- The network backends no longer try to collect SNMP supply and status
information for raw queues (STR #3809)
- The DBUS notifier did not report job state changes (STR #3805)
- The scheduler did not always report that the "normal" print-quality
value was supported (STR #3803)
- The gziptoany filter did not report the correct error if it was unable
to write the uncompressed document to the next filter or backend in
the chain (STR #3797)
- The Epson and Oki 9-pin drivers had a bad resolution option
(STR #3798)
- The scheduler did not always register the correct default ICC profile
on Mac OS X.
- The scheduler did not use the job owner when authorizing access for
the CUPS-Get-Document operation, preventing non-admins from accessing
their own jobs.
- CUPS did not work with some printers that incorrectly implemented the
HTTP/1.1 standard (STR #3778, STR #3791)
- The scheduler did not retry fax jobs properly.
- The scheduler now recognizes an empty cupsCommands PPD keyword as
meaning that CUPS commands are not supported for a printer (STR #3773)
- Fixed a crash bug in the scheduler when the application/octet-stream
MIME type was not defined (STR #3690)
- Polled printers were advertised more slowly than necessary (STR #3574)
- cupsResolveConflicts() did not handle resolving multiple UIConstraints
issues (STR #3705)
- The SetEnv and PassEnv directives had no effect (STR #3664)
- The web interface no longer tries to use multi-part delivery when
adding printers (STR #3455)
- The libusb-based USB backend printed slowly to the LaserJet 1300 and
other printers (STR #3405)
- "lp" and "lpr" failed to print with Kerberos enabled (STR #3768)
- The cupsctl program now displays an error if you try to directly set
the Port or Listen directives (STR #3749)
- PPD files with "*JobPatchFile: bla" no longer fail to load in relaxed
conformance mode (STR #3747)
- The scheduler generated a bad notify-text string for printer state
change notifications (STR #3739)
- The scheduler incorrectly updated printers.conf when it really needed
to update classes.conf or remote.cache (STR #3726)
- Hardwired remote printers with options did not work (STR #3717)
- Accessing the CUPS web interface using a CNAME-based hostname would
sometimes fail due to redirection to the actual hostname (STR #3701)
- Subscription events had a misspelled attribute (STR #3693)
- "make check" failed if LC_MESSAGES was set (STR #3765)
- Fixed the configure script to always look for the pkg-config script
(STR #3761)
- The scheduler now only looks up interface hostnames if HostNameLookups
are enabled (STR #3737)
- Fixed a compilation problem on DragonFly BSD (STR #3738)
- The default PageLogFormat value had the username and job ID swapped
from CUPS 1.3.x (STR #3727)
- The scheduler could crash if a browsed printer times out while a job
is printing (STR #3754)
- The scheduler incorrectly mapped custom page sizes to standard sizes
(STR #3764)
- cupsfilter and pstops did not map IPP attributes to PPD options due to
a change in cupsMarkOptions (STR #3756)
- The scheduler did not always show the most recent status message from
the print filters (STR #3731)
- The PostScript filter did not apply the mirror and number-up options
properly, leading to offset and clipped output (STR #3732)
- The network backends always reported "low toner" or "out of toner"
states, even for inkjet printers (STR #3733)
CHANGES IN CUPS V1.4.6
- Fixed a "make check" issue on Solaris (STR #3729)
- Regression: The pstops filter did not support landscape printing of
PostScript files (STR #3722)
- The scheduler killed retried (fax) jobs after restarting them
(STR #3697)
- The cupsAdminSetServerSettings() function disabled sharing when
debug logging was enabled (STR #3712)
CHANGES IN CUPS V1.4.5
- Documentation fixes (STR #3542, STR #3650)
- Localization fixes (STR #3635, STR #3636, STR #3647, STR #3666)
- Security: Fixed a memory corruption bug reported in CVE-2010-2941
(STR #3648)
- The CUPS API incorrectly mapped the HTTP_UNAUTHORIZED status to the
IPP_NOT_AUTHORIZED status code, when IPP_NOT_AUTHENTICATED would be
the correct mapping (STR #3684)
- The scheduler would restart jobs while shutting down (STR #3679)
- Fixed a PPD loader bug that could cause a crash in cupsd (STR #3680)
- Improved the mapping of non-standard PPD and PWG names (STR #3671)
- The scheduler did not initialize Kerberos in all cases (STR #3662)
- cupsAdminSetServerSettings duplicated Listen and Order lines
(STR #3645)
- Added DeviceN colorspace support to the CUPS Raster format (STR #3419)
- ppdMarkDefaults() did not clear the marked field of the previous
choices (STR #3642)
- The serial backend would not allow a raw job to be canceled
(STR #3649)
- The socket backend could go into an infinite loop with certain
printers (STR #3622)
- Setting the PRINTER or LPDEST environment variables to "name/instance"
did not work (STR #3485)
- The scheduler did not handle the JobRetryLimit setting properly
(STR #3466)
- The lpstat command always showed a remote job ID of 0 for shared
printers (STR #3627)
- Increased the write timeout for the libusb-based USB backend to 5
minutes (STR #3595)
- The libusb-base USB backend did not check whether the printer has a
serial number (STR #3590)
- The lpadmin command did not support setting of custom option values
(STR #3631)
- The lpadmin command did not support setting of the location or
description of a class (STR #3613)
- The cupsaddsmb command did not give up after too many failed attempts
(STR #3615)
- The CUPS library no longer uses certain problematic ctype macros that
change based on the locale's character set.
- PJL value substitution of more than 9 values was broken (STR #3621)
- Custom options with missing string values caused ppdEmit* to segfault
(STR #3620)
- Fixed an issue with the Italian version of the web interface
(STR #3624)
- Fixed the Solaris SMF configuration file for cups-lpd (STR #3611)
- The scheduler did not set the notify-subscribed-event attribute when
delivering printer-added or printer-modified events (STR #3608)
- The mailto notifier could get into an infinite loop (STR #3609)
- Date/time information was not shown in banner pages.
- Relational operators were broken in #if/#elif/#else/#endif expressions
for the PPD compiler.
- Moving a job via the web interface failed without asking for
authentication (STR #3559)
- The scheduler now clears the printer-state-reasons when the driver is
changed (STR #3570)
- The web interface did not allow a user to change the driver
(STR #3537, STR #3601)
- The scheduler was not setting the PATH_INFO environment variable when
needed (STR #3600)
- The scheduler incorrectly set the CUPSD_AUTH_TYPE environment
variable instead of AUTH_TYPE (STR #3599)
- Fixed a buffer overrun in the PPD compiler (STR #3594)
- Fixed some additional IPP job template attribute mapping issues in the
scheduler.
CHANGES IN CUPS V1.4.4
- Documentation updates (STR #3453, STR #3527, STR #3528, STR #3529)
- Security: The texttops filter did not check the results of allocations
(STR #3516)
- Security: The fix for CVE-2009-3553 was incomplete (STR #3490)
- Security: The web admin interface could disclose the contents of
memory (STR #3577)
- Security: CUPS could overwrite files as root in directories owned or
writable by non-root users (STR #3510)
- The cups-config utility did not return the correct linker options on
AIX (STR #3587)
- Fixed some IPP conformance issues with the scheduler's
ippget-event-life, operations-supported, output-bin, and sides
attributes (STR #3554)
- The OpenSSL interfaces have been made thread-safe and the GNU TLS
interface is explicitly forbidden when threading is enabled
(STR #3461)
- Fixed an IPP conformance issue with the scheduler's Send-Document
implementation (STR #3514)
- Added additional validation checks for the 1284 device ID (STR #3534)
- Fixed a problem with the RPM spec file (STR #3544)
- The lpstat command did not limit the job list to the specified
printers (STR #3541)
- The cupsfilter command did not set the RIP_MAX_CACHE environment
variable (STR #3531)
- Fixed support for media-col and page size variants (STR #3394)
- The PostScript filter did not support all media selection options for
the first page (STR #3525)
- The scheduler did not always remove job control files (STR #3425)
- The scheduler could crash on restart if classes were defined
(STR #3524)
- The scheduler no longer looks up network interface hostnames by
default on Mac OS X (STR #3523)
- ippWriteIO did not write collection (member) attributes properly in
all cases (STR #3521)
- The "cupsctl --remote-any" and corresponding web interface check box
(allow printing from the Internet) did not work reliably (STR #3520)
- The lpq and lpr commands would sometimes choose different default
printers (STR #3503)
- cupsDo*Request did not flush error text, leading to multiple issues
(STR #3325, STR #3519)
- cupsDoAuthentication did not cancel password authentication after 3
failures (STR #3518)
- Fixed several LDAP browsing bugs (STR #3392)
- The Dymo driver did not support copies (STR #3457)
- The scheduler did not update the classes.conf file when deleting a
printer belonging to a class (STR #3505)
- The lppasswd command did not use localized password prompts
(STR #3492)
- The socket backend no longer waits for back-channel data on platforms
other than Mac OS X (STR #3495)
- The scheduler didn't send events when a printer started accepting or
rejecting jobs (STR #3480)
- The web interface now includes additional CSRF protection (STR #3498)
CHANGES IN CUPS V1.4.3
- SECURITY: The scheduler could try responding on a closed client
connection, leading to a crash (STR #3200)
- SECURITY: The lppasswd program allowed the localization files to be
overridden when running in setuid mode (STR #3482)
- Localization updates (STR #3352, STR #3409, STR #3422, STR #3452,
STR #3473, STR #3502)
- Documentation updates (STR #3451, STR #3504)
- The IPP backend now sets the printer-state-message to "Ready to
print." at the end of a successful job (STR #3460)
- The PPD compiler did not correctly add the manufacturer to the output
filename when using the "-m" option (STR #3469)
- The IPP backend did not handle authentication properly for the Get-
Printer-Attributes operation (STR 3458)
- Getting SNMP values larger than 127 bytes did not work.
- IPP conformance: Get-Jobs has a default value for requested-attributes
(STR #3383)
- cupsPrintFiles() did not report all errors (STR #3449)
- cupsAddDest() could read freed memory (STR #3448)
- The DBUS notifier did not build (STR #3447)
- The scheduler would crash when an active printer was deleted.
- The snmp backend did not work with some printers (STR #3413)
- The web interface did not show the conflicting values when setting
options (STR #3440)
- Setting options in the web interface did not always work (STR #3439)
- The scheduler did not use the Get-Job-Attributes policy for a printer
(STR #3431)
- The scheduler added two job-name attributes to each job object
(STR #3428)
- CSS files would not print (STR #3442)
- The scheduler did not clean out completed jobs when PreserveJobHistory
was turned off (STR #3425)
- The web interface did not show completed jobs for a printer
(STR #3436)
- Authenticated printing did not always work when printing directly to
a remote server (STR #3435)
- The USB backend did not work on Solaris (STR #3423)
- cupstestppd didn't catch problems with JobPatchFile definitions
(STR #3421)
- The socket backend could crash if a SNMP string had a negative length.
- Fixed some termination issues with the USB backend on Mac OS X.
- The side-channel APIs did not handle interrupts properly.
- The network backends incorrectly cleared the media-empty-warning
state.
- The web interface did not allow users to successfully add serial
printers (STR #3391)
- cupsTempFd() did not work in some situations (STR #3382)
- Some C API headers were missing C++ wrapper logic.
- The PPD compiler did not localize single-language PPD options properly
(STR #3386)
- Modifying a printer from the web interface sometimes caused the wrong
driver to be selected (STR #3418)
- The scheduler did not handle out-of-memory conditions properly when
loading a job (STR #3407)
- When adding printers from the web interface, the dynamic updates of
the device list made it hard to pick a device (STR #3406)
- Fixed a typo in the web interface admin page template (STR 3403)
- The web interface did not preserve the "printer is shared" state when
modifying a printer (STR #3390)
- The PPD compiler incorrectly inserted translations of empty strings
(STR #3411)
- The scheduler did not reset the SIGPIPE handler of child processes
(STR #3399)
- cupsGetNamedDest() incorrectly returned the default printer if the
named printer did not exist (STR #3397)
- Fixed a GNU TLS error handling bug (STR #3381)
CHANGES IN CUPS V1.4.2
- SECURITY: The CUPS web interface was vulnerable to several XSS and
HTTP header/body attacks via attribute injection (STR #3367,
STR #3401)
- Fixed localization errors (STR #3359, STR #3372, STR #3380, STR #3387)
- The documentation for classes.conf and printers.conf did not provide
the correct instructions for manual changes (STR #3351)
- The scheduler did not always rebuild printer cache files when the
driver was changed (STR #3356)
- The documentation makefile failed to install localizations when using
newer versions of Bash (STR #3360)
- The configure script did not use the --with-xinetd value for the
default LPD configuration path (STR #3347)
- The configure script incorrectly required glib for DBUS support
(STR #3346)
- The cupstestppd program incorrectly reported filters with bad
permisssions as missing (STR #3363)
- The cups.desktop file used the wrong locale names (STR #3358)
- cupsSideChannelRead() did not return an error for short reads.
- The installed PAM configuration file did not use the correct options
with the pam_unix2 module (STR #3313)
- The scheduler did not preserve default options that contained special
characters (STR #3340)
- The scheduler did not remove old pre-filters when updating a printer
driver (STR #3342)
- The HP/GL-2 filter did not check for early end-of-file (STR #3319)
- The USB backend did not compile on some platforms (STR #3332)
- cupsSideChannelSNMPWalk() could go into an infinite loop with broken
SNMP implementations.
CHANGES IN CUPS V1.4.1
- Documention fixes (STR #3296)
- SNMP supply levels and states were wrong for some printers.
- The IPP backend did not update the auth-info-required value.
- The libusb-based USB backend would hang at the end of the job
(STR #3315, STR #3318)
- DNS-SD registrations for raw queues had an empty "ty" key (STR #3299)
- The JPEG and BMP MIME type rules were broken (STR #3284)
- cupsGetNamedDest returned the default printer when the named
destination did not exist (STR #3285)
- The JobKillDelay was not triggered for canceled jobs (STR #3292)
- The PPD compiler could get in an infinite loop (STR #3293)
- The configure check for dns-sd.h was broken (STR #3297)
- The "Query Printer for Default Options" page did not go away if the
query job was held (STR #3302)
- Boolean options did not show up as selected in the web interface
(STR #3303)
- The scheduler did not cache or report driver information files
correctly, leading to a variety of issues (STR #3283, STR #3297,
STR #3305)
- cupsDoIORequest() did not abort on permanent errors (STR #3311)
- Modifying a class in the web interface did not work (STR #3312)
- BrowseLocalProtocols could be cleared when changing the sharing
setting (STR #3287)
- The scheduler could return an empty supported document format
(STR #3308)
- The PPD compiler generated invalid PPD files when the locale used
something other than "." for the decimal point (STR #3300)
- The IPP backend did not handle some non-comforming IPP printer
implementations (STR #3262)
- The scheduler leaked three file descriptors to each job filter
(STR #3263)
- The scheduler now uses a default CUPS-Get-Devices timeout of 15
seconds (STR #3307)
CHANGES IN CUPS V1.4.0
- Localization updates (STR #3223, STR #3246, STR #3248, STR #3250)
- Documentation updates (STR #3225, STR #3230, STR #3242, STR #3260)
- The --with-pdftops configure option did not accept a full path to the
filter (STR #3278)
- The banner filter did not position the back side image correctly
(STR #3277)
- The dnssd backend could crash (STR #3272)
- The 1284 device ID sometimes contained trailing garbage (STR #3266)
- The USB backend returned different URIs for some printers than in
CUPS 1.3 (STR #3259)
- The scheduler did not do local job-hold-until processing for remote
queues (STR #3258)
- The scheduler did not try all possible SSL certificates on Mac OS X.
- The scheduler did not always remove a file descriptor when using the
kqueue interface (STR #3256)
- The scheduler did not protect against bad job control files in all
cases (STR #3253)
- The scheduler did not encode "+" in model names (STR #3254)
- The web interface didn't show the default options (STR #3244)
- The IPP and LPD backends needed print data before they would do an
SNMP query.
- Fixed a GNU TLS compatibility issue (STR #3231)
- Fixed a HTML error in the add and modify printer web interface
templates (STR #3229)
- The scheduler did not minimize the number of printer state events that
were generated by filter STATE: messages, which could lead to poor
performance.
- The USB backend on Mac OS X did not cleanly cancel a job.
- The network backends now set the connecting-to-device printer-state-
reasons value when looking up the address and copying the print data
for consistency.
- The scheduler now supports the com.apple.print.recoverable-warning
reason on all platforms.
CHANGES IN CUPS V1.4rc1
- The PPD compiler documentation was missing information on localization
(STR #3212)
- The IPP backend now reconnects after every request when talking to
printers that claim IPP support but only use HTTP/1.0.
- The PPD compiler crashed when both "Resolution" and "Group foo Option
Resolution" were specified in the .drv file.
- The PPD compiler's #if/#elif/#else/#endif did not work for undefined
variables (STR #3210)
- Static libraries could not be installed by a non-root user on systems
needing a ranlib program (STR #3209)
- The scheduler incorrectly always tried to copy Kerberos credentials
for print jobs.
- Updated the Spanish localization (STR #3204)
- The scheduler crashed when getting the default paper size from
libpaper (STR #3205, STR #3206)
- The PPD compiler now defines six variables: CUPS_VERSION,
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, CUPS_VERSION_PATCH,
PLATFORM_NAME, and PLATFORM_ARCH (STR #3203)
- Fixed a whitespace skipping bug in cupsRasterInterpretPPD.
- The scheduler did not return HTTP 403 (Forbidden) for authenticated
users that were not authorized to do IPP operations (STR #3193)
- The scheduler did not report more than 8 Product strings from a PPD
file. Some PPD files have as many as 24.
- ppdOpen*() could crash if a keyword had no value string (something
that cupstestppd looks for...)
- cupsLangDefault() did not return the correct language on Mac OS X.
- The Mac OS X USB backend did not handle aborted or stalled pipe
conditions properly, which prevented drivers from ejecting partial
pages when a job was canceled or held.
CHANGES IN CUPS V1.4b3
- Documentation fixes (STR #3044, STR #3057, STR #3153, STR #3158,
+4 -2
Ver Arquivo
@@ -1,4 +1,4 @@
CREDITS.txt - 2008-12-08
CREDITS.txt - 2010-03-13
------------------------
Few projects are completed by one person, and CUPS is no exception. We'd
@@ -17,6 +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.
Kenshi Muto - Japanese localization, patches, and
testing.
Tomohiro Kato - Japanese localization.
@@ -28,6 +29,7 @@ like to thank the following individuals for their contributions:
Jason McMullan - Original CUPS RPM distributions.
Wes Morgan - *BSD fixes.
Daniel Nylander - Swedish localization.
Niklas 'Nille' kerstršm - Swedish localization.
Giulio Orsero - Bug fixes and testing.
Michal Osowiecki - Polish localization.
Citra Paska - Indonesian localization.
@@ -38,7 +40,7 @@ like to thank the following individuals for their contributions:
Opher Shachar - Hebrew localization.
Stuart Stevens - HP JetDirect IPP information.
Andrea Suatoni - IRIX desktop integration and testing.
Teppo Turlianen - Finnish localization.
Teppo Turliainen - Finnish localization.
Tim Waugh - Lots of patches, testing, and Linux
integration.
Yugami - LDAP browsing support.
+5 -6
Ver Arquivo
@@ -1,14 +1,13 @@
INSTALL - CUPS v1.4b3 - 2009-05-19
INSTALL - CUPS v1.4.8 - 2011-07-25
----------------------------------
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. ****
**** 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. ****
BEFORE YOU BEGIN
@@ -43,7 +42,7 @@ COMPILING THE SUBVERSION REPOSITORY CODE
configure script. You'll need to run the GNU autoconf software (2.60 or
higher) to create it:
autoconf -f
autoconf
CONFIGURATION
+5 -4
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id$"
#
# Common makefile definitions for the Common UNIX Printing System (CUPS).
# Common makefile definitions for CUPS.
#
# Copyright 2007-2009 by Apple Inc.
# Copyright 2007-2010 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 @@
AR = @AR@
AWK = @AWK@
CC = @LIBTOOL@ @CC@
CHMOD = @CHMOD@
CXX = @LIBTOOL@ @CXX@
DSO = @DSO@
DSOXX = @DSOXX@
@@ -262,7 +263,7 @@ DBUSDIR = @DBUSDIR@
.c.o:
echo Compiling $<...
$(CC) $(ARCHFLAGS) $(OPTIM) $(ALL_CFLAGS) -c $<
$(CC) $(ARCHFLAGS) $(OPTIM) $(ALL_CFLAGS) -c -o $@ $<
.c.32.o:
echo Compiling 32-bit $<...
@@ -274,7 +275,7 @@ DBUSDIR = @DBUSDIR@
.cxx.o:
echo Compiling $<...
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c $<
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c -o $@ $<
.man.1 .man.1m .man.3 .man.5 .man.7 .man.8:
echo Linking $<...
+17 -14
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id$"
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
# Top-level Makefile for CUPS.
#
# Copyright 2007-2009 by Apple Inc.
# Copyright 2007-2010 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -16,13 +16,6 @@
include Makedefs
#
# Don't run top-level build targets in parallel...
#
.NOTPARALLEL:
#
# Directories to make...
#
@@ -139,13 +132,15 @@ depend:
#
# Run the clang.llvm.org static code analysis tool on the C sources.
# (at least checker-231 is required for scan-build to work this way)
#
.PHONY: clang
.PHONY: clang clang-changes
clang:
$(RM) -r clang
scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) \
CC=ccc-analyzer CXX=ccc-analyzer clean all
scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) clean all
clang-changes:
scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) all
#
@@ -392,6 +387,7 @@ docset: apihelp
echo Indexing docset...
/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 \
--atom org.cups.docset.atom \
--download-url http://www.cups.org/org.cups.docset.xar \
@@ -399,7 +395,7 @@ docset: apihelp
#
# Make software distributions using EPM (http://www.easysw.com/epm/)...
# Make software distributions using EPM (http://www.epmhome.org/)...
#
EPMFLAGS = -v --output-dir dist $(EPMARCH)
@@ -424,11 +420,18 @@ dist: all
*BSD*) $(MAKE) $(MFLAGS) bsd;; \
Darwin*) $(MAKE) $(MFLAGS) osx;; \
IRIX*) $(MAKE) $(MFLAGS) tardist;; \
Linux*) $(MAKE) $(MFLAGS) rpm;; \
Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \
SunOS*) $(MAKE) $(MFLAGS) pkg;; \
esac
#
# Don't run top-level build targets in parallel...
#
.NOTPARALLEL:
#
# End of "$Id$".
#
+2 -15
Ver Arquivo
@@ -1,19 +1,6 @@
README - CUPS v1.4b3 - 2009-05-19
README - CUPS v1.4.8 - 2011-07-25
---------------------------------
**********************************************************************
**********************************************************************
********** **********
********** THIS IS BETA-RELEASE SOFTWARE. DO NOT USE ON **********
********** PRODUCTION SYSTEMS! REPORT PROBLEMS TO THE **********
********** CUPS FORUMS OR BUG REPORTING PAGES: **********
********** **********
********** http://www.cups.org/newsgroups.php (FORUMS) **********
********** http://www.cups.org/str.php (BUGS) **********
********** **********
**********************************************************************
**********************************************************************
Looking for compile instructions? Read the file "INSTALL.txt"
instead...
@@ -163,7 +150,7 @@ PRINTING FILES
LEGAL STUFF
CUPS is Copyright 2007-2009 by Apple Inc. CUPS and the CUPS logo are
CUPS is Copyright 2007-2011 by Apple Inc. CUPS and the CUPS logo are
trademarks of Apple Inc.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
+28 -7
Ver Arquivo
@@ -34,6 +34,26 @@
# include <cups/string.h>
# include <signal.h>
# ifdef __linux
# include <sys/ioctl.h>
# include <linux/lp.h>
# define IOCNR_GET_DEVICE_ID 1
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
# include <linux/parport.h>
# include <linux/ppdev.h>
# include <unistd.h>
# include <fcntl.h>
# endif /* __linux */
# ifdef __sun
# ifdef __sparc
# include <sys/ecppio.h>
# else
# include <sys/ioccom.h>
# include <sys/ecppsys.h>
# endif /* __sparc */
# endif /* __sun */
/*
* C++ magic...
@@ -276,16 +296,17 @@ extern int backendGetDeviceID(int fd, char *device_id,
extern int backendGetMakeModel(const char *device_id,
char *make_model,
int make_model_size);
extern void backendNetworkSideCB(int print_fd, int device_fd,
extern int backendNetworkSideCB(int print_fd, int device_fd,
int snmp_fd, http_addr_t *addr,
int use_bc);
extern ssize_t backendRunLoop(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, int use_bc,
void (*side_cb)(int print_fd,
int device_fd,
int snmp_fd,
http_addr_t *addr,
int use_bc));
http_addr_t *addr, int use_bc,
int update_state,
int (*side_cb)(int print_fd,
int device_fd,
int snmp_fd,
http_addr_t *addr,
int use_bc));
extern int backendSNMPSupplies(int snmp_fd, http_addr_t *addr,
int *page_count,
int *printer_state);
+2 -2
Ver Arquivo
@@ -153,8 +153,8 @@ main(int argc, /* I - Number of command-line args */
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, sigterm_handler);
action.sa_handler = sigterm_handler;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, sigterm_handler);
#endif /* HAVE_SIGSET */
+47 -29
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IEEE-1284 support functions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -27,26 +27,6 @@
#include "backend-private.h"
#ifdef __linux
# include <sys/ioctl.h>
# include <linux/lp.h>
# define IOCNR_GET_DEVICE_ID 1
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
# include <linux/parport.h>
# include <linux/ppdev.h>
# include <unistd.h>
# include <fcntl.h>
#endif /* __linux */
#ifdef __sun
# ifdef __sparc
# include <sys/ecppio.h>
# else
# include <sys/ioccom.h>
# include <sys/ecppsys.h>
# endif /* __sparc */
#endif /* __sun */
/*
* 'backendGetDeviceID()' - Get the IEEE-1284 device ID string and
@@ -196,20 +176,43 @@ backendGetDeviceID(
* and then limit the length to the size of our buffer...
*/
if (length > (device_id_size - 2))
if (length > device_id_size)
length = (((unsigned)device_id[1] & 255) << 8) +
((unsigned)device_id[0] & 255);
if (length > (device_id_size - 2))
length = device_id_size - 2;
if (length > device_id_size)
length = device_id_size;
/*
* Copy the device ID text to the beginning of the buffer and
* nul-terminate.
* The length field counts the number of bytes in the string
* including the length field itself (2 bytes). The minimum
* length for a valid/usable device ID is 14 bytes:
*
* <LENGTH> MFG: <MFG> ;MDL: <MDL> ;
* 2 + 4 + 1 + 5 + 1 + 1
*/
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
if (length < 14)
{
/*
* Can't use this device ID, so don't try to copy it...
*/
device_id[0] = '\0';
got_id = 0;
}
else
{
/*
* Copy the device ID text to the beginning of the buffer and
* nul-terminate.
*/
length -= 2;
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
}
# ifdef DEBUG
else
@@ -306,6 +309,17 @@ backendGetDeviceID(
mfg = temp;
}
if (!mdl)
mdl = "";
if (!strncasecmp(mdl, mfg, strlen(mfg)))
{
mdl += strlen(mfg);
while (isspace(*mdl & 255))
mdl ++;
}
/*
* Generate the device URI from the manufacturer, make_model, and
* serial number strings.
@@ -389,7 +403,11 @@ backendGetMakeModel(
char temp[1024]; /* Temporary make and model */
snprintf(temp, sizeof(temp), "%s %s", mfg, mdl);
if (mfg)
snprintf(temp, sizeof(temp), "%s %s", mfg, mdl);
else
snprintf(temp, sizeof(temp), "%s", mdl);
_ppdNormalizeMakeAndModel(temp, make_model, make_model_size);
}
}
+94 -60
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -45,6 +45,8 @@
static char *password = NULL; /* Password for device URI */
static int password_tries = 0; /* Password tries */
static const char *auth_info_required = "none";
/* New auth-info-required value */
#ifdef __APPLE__
static char pstmpname[1024] = ""; /* Temporary PostScript file name */
#endif /* __APPLE__ */
@@ -91,7 +93,7 @@ main(int argc, /* I - Number of command-line args */
int num_options; /* Number of printer options */
cups_option_t *options; /* Printer options */
const char *device_uri; /* Device URI */
char method[255], /* Method in URI */
char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
@@ -236,21 +238,14 @@ main(int argc, /* I - Number of command-line args */
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
if (httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource)) < HTTP_URI_OK)
{
_cupsLangPuts(stderr,
_("ERROR: Missing device URI on command-line and no "
"DEVICE_URI environment variable!\n"));
return (CUPS_BACKEND_STOP);
}
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme),
username, sizeof(username), hostname, sizeof(hostname), &port,
resource, sizeof(resource));
if (!port)
port = IPP_PORT; /* Default to port 631 */
if (!strcmp(method, "https"))
if (!strcmp(scheme, "https"))
cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
else
cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED);
@@ -416,11 +411,12 @@ main(int argc, /* I - Number of command-line args */
int fd; /* File descriptor */
http_addrlist_t *addrlist; /* Address list */
char buffer[8192]; /* Buffer for copying */
int bytes; /* Number of bytes read */
off_t tbytes; /* Total bytes copied */
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, "1")) == NULL)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
@@ -438,23 +434,8 @@ main(int argc, /* I - Number of command-line args */
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
tbytes = 0;
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
{
if (write(fd, buffer, bytes) < bytes)
{
_cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
close(fd);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
else
tbytes += bytes;
if (snmp_fd >= 0)
backendCheckSideChannel(snmp_fd, &(addrlist->addr));
}
tbytes = backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
backendNetworkSideCB);
if (snmp_fd >= 0)
_cupsSNMPClose(snmp_fd);
@@ -544,8 +525,7 @@ main(int argc, /* I - Number of command-line args */
do
{
fprintf(stderr, "DEBUG: Connecting to %s:%d\n",
hostname, port);
fprintf(stderr, "DEBUG: Connecting to %s:%d\n", hostname, port);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
if ((http = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL)
@@ -661,7 +641,8 @@ main(int argc, /* I - Number of command-line args */
* might contain username:password information...
*/
snprintf(uri, sizeof(uri), "%s://%s:%d%s", method, hostname, port, resource);
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), scheme, NULL, hostname,
port, resource);
/*
* First validate the destination and see if the device supports multiple
@@ -702,6 +683,9 @@ main(int argc, /* I - Number of command-line args */
fputs("DEBUG: Getting supported attributes...\n", stderr);
if (http->version < HTTP_1_1)
httpReconnect(http);
if ((supported = cupsDoRequest(http, request, resource)) == NULL)
ipp_status = cupsLastError();
else
@@ -754,6 +738,15 @@ main(int argc, /* I - Number of command-line args */
return (CUPS_BACKEND_STOP);
}
else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
{
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
"Negotiate", 9))
auth_info_required = "negotiate";
fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
return (CUPS_BACKEND_AUTH_REQUIRED);
}
else
{
_cupsLangPrintf(stderr,
@@ -1021,6 +1014,9 @@ main(int argc, /* I - Number of command-line args */
* Do the request...
*/
if (http->version < HTTP_1_1)
httpReconnect(http);
if (num_files > 1)
response = cupsDoRequest(http, request, resource);
else
@@ -1064,16 +1060,21 @@ main(int argc, /* I - Number of command-line args */
_cupsLangPrintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"),
cupsLastErrorString());
if (ipp_status == IPP_NOT_AUTHORIZED)
if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
{
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))
fputs("ATTR: auth-info-required=negotiate\n", stderr);
else
fputs("ATTR: auth-info-required=username,password\n", stderr);
auth_info_required = "negotiate";
}
}
}
@@ -1130,6 +1131,9 @@ main(int argc, /* I - Number of command-line args */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, content_type);
if (http->version < HTTP_1_1)
httpReconnect(http);
ippDelete(cupsDoFileRequest(http, request, resource, files[i]));
if (cupsLastError() > IPP_OK_CONFLICT)
@@ -1198,7 +1202,7 @@ main(int argc, /* I - Number of command-line args */
* Do the request...
*/
if (!copies_sup)
if (!copies_sup || http->version < HTTP_1_1)
httpReconnect(http);
response = cupsDoRequest(http, request, resource);
@@ -1251,6 +1255,19 @@ main(int argc, /* I - Number of command-line args */
break;
}
}
else
{
/*
* If the printer does not return a job-state attribute, it does not
* conform to the IPP specification - break out immediately and fail
* the job...
*/
fputs("DEBUG: No job-state available from printer - stopping queue.\n",
stderr);
ipp_status = IPP_INTERNAL_ERROR;
break;
}
}
ippDelete(response);
@@ -1295,6 +1312,15 @@ main(int argc, /* I - Number of command-line args */
page_count > start_count)
fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
#ifdef HAVE_GSSAPI
/*
* See if we used Kerberos at all...
*/
if (http->gssctx)
auth_info_required = "negotiate";
#endif /* HAVE_GSSAPI */
/*
* Free memory...
*/
@@ -1327,12 +1353,19 @@ main(int argc, /* I - Number of command-line args */
* Return the queue status...
*/
if (ipp_status == IPP_NOT_AUTHORIZED)
fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
return (CUPS_BACKEND_AUTH_REQUIRED);
else if (ipp_status == IPP_INTERNAL_ERROR)
return (CUPS_BACKEND_STOP);
else if (ipp_status > IPP_OK_CONFLICT)
return (CUPS_BACKEND_FAILED);
else
{
_cupsLangPuts(stderr, _("INFO: Ready to print.\n"));
return (CUPS_BACKEND_OK);
}
}
@@ -1369,6 +1402,9 @@ cancel_job(http_t *http, /* I - HTTP connection */
* Do the request...
*/
if (http->version < HTTP_1_1)
httpReconnect(http);
ippDelete(cupsDoRequest(http, request, resource));
if (cupsLastError() > IPP_OK_CONFLICT)
@@ -1428,6 +1464,9 @@ check_printer_state(
* Do the request...
*/
if (http->version < HTTP_1_1)
httpReconnect(http);
if ((response = cupsDoRequest(http, request, resource)) != NULL)
{
report_printer_state(response, job_id);
@@ -1523,6 +1562,12 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
{
(void)prompt;
/*
* Remember that we need to authenticate...
*/
auth_info_required = "username,password";
if (password && *password && password_tries < 3)
{
password_tries ++;
@@ -1532,23 +1577,10 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
else
{
/*
* If there is no password set in the device URI, return the
* "authentication required" exit code...
* Give up after 3 tries or if we don't have a password to begin with...
*/
if (tmpfilename[0])
unlink(tmpfilename);
#ifdef __APPLE__
if (pstmpname[0])
unlink(pstmpname);
#endif /* __APPLE__ */
fputs("ATTR: auth-info-required=username,password\n", stderr);
exit(CUPS_BACKEND_AUTH_REQUIRED);
return (NULL); /* Eliminate compiler warning */
return (NULL);
}
}
@@ -1802,8 +1834,7 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
* file...
*/
close(1);
dup(fd);
dup2(fd, 1);
close(fd);
if (!getuid())
@@ -1812,8 +1843,11 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
* Change to an unpriviledged user...
*/
setgid(fileinfo.st_gid);
setuid(fileinfo.st_uid);
if (setgid(fileinfo.st_gid))
return (errno);
if (setuid(fileinfo.st_uid))
return (errno);
}
execlp("pictwpstops", printer, argv[1], argv[2], argv[3], argv[4], argv[5],
+11 -23
Ver Arquivo
@@ -113,7 +113,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
const char *device_uri; /* Device URI */
char method[255], /* Method in URI */
char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
@@ -193,9 +193,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme),
username, sizeof(username), hostname, sizeof(hostname), &port,
resource, sizeof(resource));
if (!port)
@@ -426,10 +425,11 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
http_addrlist_t *addrlist; /* Address list */
int snmp_fd; /* SNMP socket */
char buffer[8192]; /* Buffer for copying */
int bytes; /* Number of bytes read */
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, "1")) == NULL)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
@@ -447,19 +447,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
{
if (write(fd, buffer, bytes) < bytes)
{
_cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
close(fd);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
if (snmp_fd >= 0)
backendCheckSideChannel(snmp_fd, &(addrlist->addr));
}
backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
backendNetworkSideCB);
if (snmp_fd >= 0)
_cupsSNMPClose(snmp_fd);
@@ -695,6 +684,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
sprintf(portname, "%d", port);
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
@@ -721,9 +711,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
* First try to reserve a port for this connection...
*/
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Connecting to %s:%d for printer %s\n",
hostname, port, printer);
fprintf(stderr, "DEBUG: Connecting to %s:%d for printer %s\n", hostname,
port, printer);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
for (lport = reserve == RESERVE_RFC1179 ? 732 : 1024, addr = addrlist,
@@ -809,7 +798,6 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
error = errno;
close(fd);
fd = -1;
if (addr->next)
continue;
+9 -8
Ver Arquivo
@@ -61,7 +61,7 @@ backendCheckSideChannel(
* 'backendNetworkSideCB()' - Handle common network side-channel commands.
*/
void
int /* O - -1 on error, 0 on success */
backendNetworkSideCB(
int print_fd, /* I - Print file or -1 */
int device_fd, /* I - Device file or -1 */
@@ -79,10 +79,7 @@ backendNetworkSideCB(
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
return;
}
return (-1);
switch (command)
{
@@ -173,9 +170,13 @@ backendNetworkSideCB(
case CUPS_ASN1_BIT_STRING :
case CUPS_ASN1_OCTET_STRING :
i = (int)(sizeof(data) - (dataptr - data));
if (packet.object_value.string.num_bytes < i)
if (packet.object_value.string.num_bytes < 0)
i = 0;
else if (packet.object_value.string.num_bytes <
(sizeof(data) - (dataptr - data)))
i = packet.object_value.string.num_bytes;
else
i = (int)(sizeof(data) - (dataptr - data));
memcpy(dataptr, packet.object_value.string.bytes, i);
@@ -284,7 +285,7 @@ backendNetworkSideCB(
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
+7 -10
Ver Arquivo
@@ -1278,7 +1278,7 @@ int papCancelRequest(int sockfd, u_short tid)
* 'sidechannel_request()' - Handle side-channel requests.
*/
static void
static int
sidechannel_request()
{
cups_sc_command_t command; /* Request command */
@@ -1289,32 +1289,29 @@ sidechannel_request()
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
fputs(_("WARNING: Failed to read side-channel request!\n"), stderr);
return;
}
return (-1);
switch (command)
{
case CUPS_SC_CMD_GET_BIDI: /* Is the connection bidirectional? */
data[0] = 1;
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0);
return (cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0));
break;
case CUPS_SC_CMD_GET_STATE: /* Return device state */
data[0] = CUPS_SC_STATE_ONLINE;
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0);
return (cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0));
break;
case CUPS_SC_CMD_DRAIN_OUTPUT: /* Drain all pending output */
case CUPS_SC_CMD_SOFT_RESET: /* Do a soft reset */
case CUPS_SC_CMD_GET_DEVICE_ID: /* Return IEEE-1284 device ID */
default:
cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED,
NULL, 0, 1.0);
return (cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED,
NULL, 0, 1.0));
break;
}
return;
return (0);
}
+5 -8
Ver Arquivo
@@ -59,7 +59,7 @@
*/
static void list_devices(void);
static void side_cb(int print_fd, int device_fd, int snmp_fd,
static int side_cb(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, int use_bc);
@@ -284,7 +284,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
lseek(print_fd, 0, SEEK_SET);
}
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, side_cb);
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb);
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintf(stderr,
@@ -615,7 +615,7 @@ list_devices(void)
* 'side_cb()' - Handle side-channel requests...
*/
static void
static int /* O - 0 on success, -1 on error */
side_cb(int print_fd, /* I - Print file */
int device_fd, /* I - Device file */
int snmp_fd, /* I - SNMP socket (unused) */
@@ -634,10 +634,7 @@ side_cb(int print_fd, /* I - Print file */
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
return;
}
return (-1);
switch (command)
{
@@ -680,7 +677,7 @@ side_cb(int print_fd, /* I - Print file */
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
+21 -9
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Common run loop APIs for the Common UNIX Printing System (CUPS).
* Common run loop APIs for CUPS.
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -147,7 +147,8 @@ backendRunLoop(
int snmp_fd, /* I - SNMP socket or -1 if none */
http_addr_t *addr, /* I - Address of device */
int use_bc, /* I - Use back-channel? */
void (*side_cb)(int, int, int, http_addr_t *, int))
int update_state, /* I - Update printer-state-reasons? */
int (*side_cb)(int, int, int, http_addr_t *, int))
/* I - Side-channel callback */
{
int nfds; /* Maximum file descriptor value + 1 */
@@ -196,6 +197,14 @@ backendRunLoop(
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
}
else if (print_fd < 0)
{
/*
* Copy print data from stdin, but don't mess with the signal handlers...
*/
print_fd = 0;
}
/*
* Figure out the maximum file descriptor value to use with select()...
@@ -237,7 +246,7 @@ backendRunLoop(
* Pause printing to clear any pending errors...
*/
if (errno == ENXIO && offline != 1)
if (errno == ENXIO && offline != 1 && update_state)
{
fputs("STATE: +offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently offline.\n"));
@@ -266,7 +275,8 @@ backendRunLoop(
* loop since it may have read from print_fd...
*/
(*side_cb)(print_fd, device_fd, snmp_fd, addr, use_bc);
if ((*side_cb)(print_fd, device_fd, snmp_fd, addr, use_bc))
side_cb = NULL;
continue;
}
@@ -289,6 +299,8 @@ backendRunLoop(
strerror(errno));
use_bc = 0;
}
else if (bc_bytes == 0)
use_bc = 0;
}
/*
@@ -342,7 +354,7 @@ backendRunLoop(
if (errno == ENOSPC)
{
if (paperout != 1)
if (paperout != 1 && update_state)
{
fputs("STATE: +media-empty-warning\n", stderr);
_cupsLangPuts(stderr, _("ERROR: Out of paper!\n"));
@@ -351,7 +363,7 @@ backendRunLoop(
}
else if (errno == ENXIO)
{
if (offline != 1)
if (offline != 1 && update_state)
{
fputs("STATE: +offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
@@ -367,13 +379,13 @@ backendRunLoop(
}
else
{
if (paperout)
if (paperout && update_state)
{
fputs("STATE: -media-empty-warning\n", stderr);
paperout = 0;
}
if (offline)
if (offline && update_state)
{
fputs("STATE: -offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
+10 -12
Ver Arquivo
@@ -84,7 +84,7 @@
*/
static void list_devices(void);
static void side_cb(int print_fd, int device_fd, int use_bc);
static int side_cb(int print_fd, int device_fd, int use_bc);
/*
@@ -109,7 +109,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
sep; /* Option separator */
int port; /* Port number (not used) */
int copies; /* Number of copies to print */
int print_fd, /* Print file */
int side_eof = 0, /* Saw EOF on side-channel? */
print_fd, /* Print file */
device_fd; /* Serial device */
int nfds; /* Maximum file descriptor value + 1 */
fd_set input, /* Input set for reading */
@@ -501,7 +502,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* stdin (otherwise you can't cancel raw jobs...)
*/
if (print_fd != 0)
if (!print_fd)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
@@ -558,7 +559,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (!print_bytes)
FD_SET(print_fd, &input);
FD_SET(device_fd, &input);
if (!print_bytes)
if (!print_bytes && !side_eof)
FD_SET(CUPS_SC_FD, &input);
FD_ZERO(&output);
@@ -579,7 +580,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* loop since it may have read from print_fd...
*/
side_cb(print_fd, device_fd, 1);
if (side_cb(print_fd, device_fd, 1))
side_eof = 1;
continue;
}
@@ -1278,7 +1280,7 @@ list_devices(void)
* 'side_cb()' - Handle side-channel requests...
*/
static void
static int /* O - 0 on success, -1 on error */
side_cb(int print_fd, /* I - Print file */
int device_fd, /* I - Device file */
int use_bc) /* I - Using back-channel? */
@@ -1292,11 +1294,7 @@ side_cb(int print_fd, /* I - Print file */
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
_cupsLangPuts(stderr,
_("WARNING: Failed to read side-channel request!\n"));
return;
}
return (-1);
switch (command)
{
@@ -1323,7 +1321,7 @@ side_cb(int print_fd, /* I - Print file */
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
+122 -13
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* SNMP supplies functions for the Common UNIX Printing System (CUPS).
* SNMP supplies functions for CUPS.
*
* Copyright 2008-2009 by Apple Inc.
* Copyright 2008-2011 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -36,6 +36,17 @@
#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_MARKER_WASTE_ALMOST_FULL 16
#define CUPS_MARKER_WASTE_FULL 32
#define CUPS_OPC_NEAR_EOL 64
#define CUPS_OPC_LIFE_OVER 128
#define CUPS_TONER_LOW 256
#define CUPS_TONER_EMPTY 512
/*
* Local structures...
@@ -70,6 +81,8 @@ static int num_supplies = 0;
/* Number of supplies found */
static backend_supplies_t supplies[CUPS_MAX_SUPPLIES];
/* Supply information */
static int supply_state = -1;
/* Supply state info */
static const int hrDeviceDescr[] =
{ CUPS_OID_hrDeviceDescr, 1, -1 };
@@ -140,8 +153,8 @@ static const backend_state_t const printer_states[] =
{
{ CUPS_TC_lowPaper, "media-low-report" },
{ CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty, "media-empty-warning" },
{ CUPS_TC_lowToner, "toner-low-report" },
{ CUPS_TC_noToner, "toner-empty-warning" },
/* { CUPS_TC_lowToner, "toner-low-report" }, */ /* now use prtMarkerSupplies */
/* { CUPS_TC_noToner, "toner-empty-warning" }, */ /* now use prtMarkerSupplies */
{ CUPS_TC_doorOpen, "door-open-report" },
{ CUPS_TC_jammed, "media-jam-warning" },
/* { CUPS_TC_offline, "offline-report" }, */ /* unreliable */
@@ -153,6 +166,20 @@ static const backend_state_t const printer_states[] =
{ CUPS_TC_outputFull, "output-area-full-warning" }
};
static const backend_state_t const supply_states[] =
{
{ CUPS_DEVELOPER_LOW, "developer-low-report" },
{ CUPS_DEVELOPER_EMPTY, "developer-empty-warning" },
{ CUPS_MARKER_SUPPLY_LOW, "marker-supply-low-report" },
{ CUPS_MARKER_SUPPLY_EMPTY, "marker-supply-empty-warning" },
{ CUPS_MARKER_WASTE_ALMOST_FULL, "marker-waste-almost-full-report" },
{ CUPS_MARKER_WASTE_FULL, "marker-waste-full-warning" },
{ 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" }
};
/*
* Local functions...
@@ -191,13 +218,14 @@ backendSNMPSupplies(
if (num_supplies > 0)
{
int i, /* Looping var */
percent, /* Percent full */
new_state, /* New state value */
change_state; /* State change */
change_state, /* State change */
new_supply_state = 0; /* Supply state */
char value[CUPS_MAX_SUPPLIES * 4],
/* marker-levels value string */
*ptr; /* Pointer into value string */
cups_snmp_t packet; /* SNMP response packet */
/*
* Generate the marker-levels value string...
@@ -205,17 +233,88 @@ backendSNMPSupplies(
for (i = 0, ptr = value; i < num_supplies; i ++, ptr += strlen(ptr))
{
if (supplies[i].max_capacity > 0)
percent = 100 * supplies[i].level / supplies[i].max_capacity;
else
percent = 50;
if (percent <= 10)
{
switch (supplies[i].type)
{
case CUPS_TC_toner :
case CUPS_TC_tonerCartridge :
if (percent <= 1)
new_supply_state |= CUPS_TONER_EMPTY;
else
new_supply_state |= CUPS_TONER_LOW;
break;
case CUPS_TC_wasteToner :
case CUPS_TC_wasteInk :
if (percent <= 1)
new_supply_state |= CUPS_MARKER_WASTE_FULL;
else
new_supply_state |= CUPS_MARKER_WASTE_ALMOST_FULL;
break;
case CUPS_TC_ink :
case CUPS_TC_inkCartridge :
case CUPS_TC_inkRibbon :
case CUPS_TC_solidWax :
case CUPS_TC_ribbonWax :
if (percent <= 1)
new_supply_state |= CUPS_MARKER_SUPPLY_EMPTY;
else
new_supply_state |= CUPS_MARKER_SUPPLY_LOW;
break;
case CUPS_TC_developer :
if (percent <= 1)
new_supply_state |= CUPS_DEVELOPER_EMPTY;
else
new_supply_state |= CUPS_DEVELOPER_LOW;
break;
case CUPS_TC_coronaWire :
case CUPS_TC_fuser :
case CUPS_TC_opc :
case CUPS_TC_transferUnit :
if (percent <= 1)
new_supply_state |= CUPS_OPC_LIFE_OVER;
else
new_supply_state |= CUPS_OPC_NEAR_EOL;
break;
}
}
if (i)
*ptr++ = ',';
if (supplies[i].max_capacity > 0)
sprintf(ptr, "%d", 100 * supplies[i].level / supplies[i].max_capacity);
sprintf(ptr, "%d", percent);
else
strcpy(ptr, "-1");
}
fprintf(stderr, "ATTR: marker-levels=%s\n", value);
if (supply_state < 0)
change_state = 0xffff;
else
change_state = supply_state ^ new_supply_state;
fprintf(stderr, "DEBUG: new_supply_state=%x, change_state=%x\n",
new_supply_state, change_state);
for (i = 0;
i < (int)(sizeof(supply_states) / sizeof(supply_states[0]));
i ++)
if (change_state & supply_states[i].bit)
{
fprintf(stderr, "STATE: %c%s\n",
(new_supply_state & supply_states[i].bit) ? '+' : '-',
supply_states[i].keyword);
}
supply_state = new_supply_state;
/*
* Get the current printer status bits...
*/
@@ -229,21 +328,31 @@ backendSNMPSupplies(
packet.object_type != CUPS_ASN1_OCTET_STRING)
return (-1);
new_state = (packet.object_value.string.bytes[0] << 8) |
packet.object_value.string.bytes[1];
if (packet.object_value.string.num_bytes == 2)
new_state = (packet.object_value.string.bytes[0] << 8) |
packet.object_value.string.bytes[1];
else if (packet.object_value.string.num_bytes == 1)
new_state = (packet.object_value.string.bytes[0] << 8);
else
new_state = 0;
if (current_state < 0)
change_state = 0xffff;
else
change_state = current_state ^ new_state;
fprintf(stderr, "DEBUG: new_state=%x, change_state=%x\n", new_state,
change_state);
for (i = 0;
i < (int)(sizeof(printer_states) / sizeof(printer_states[0]));
i ++)
if (change_state & printer_states[i].bit)
{
fprintf(stderr, "STATE: %c%s\n",
(new_state & printer_states[i].bit) ? '+' : '-',
(new_state & printer_states[i].bit) ? '+' : '-',
printer_states[i].keyword);
}
current_state = new_state;
@@ -368,9 +477,9 @@ backend_init_supplies(
* See if we should be getting supply levels via SNMP...
*/
if ((ppd = ppdOpenFile(getenv("PPD"))) != NULL &&
(ppdattr = ppdFindAttr(ppd, "cupsSNMPSupplies", NULL)) != NULL &&
ppdattr->value && strcasecmp(ppdattr->value, "true"))
if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL ||
((ppdattr = ppdFindAttr(ppd, "cupsSNMPSupplies", NULL)) != NULL &&
ppdattr->value && strcasecmp(ppdattr->value, "true")))
{
ppdClose(ppd);
return;
+5 -3
Ver Arquivo
@@ -999,7 +999,7 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
DEVICE_PRODUCT, LexmarkProductOID2);
_cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
packet.community, CUPS_ASN1_GET_REQUEST,
DEVICE_URI, LexmarkDeviceIdOID);
DEVICE_ID, LexmarkDeviceIdOID);
_cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
packet.community, CUPS_ASN1_GET_REQUEST,
DEVICE_PRODUCT, XeroxProductOID);
@@ -1054,7 +1054,9 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
break;
case DEVICE_ID :
if (device && packet.object_type == CUPS_ASN1_OCTET_STRING)
if (device && packet.object_type == CUPS_ASN1_OCTET_STRING &&
(!device->id ||
strlen(device->id) < packet.object_value.string.num_bytes))
{
/*
* Update an existing cache entry...
@@ -1107,7 +1109,7 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
case DEVICE_URI :
if (device && packet.object_type == CUPS_ASN1_OCTET_STRING &&
!device->uri)
!device->uri && packet.object_value.string.num_bytes > 0)
{
/*
* Update an existing cache entry...
+15 -15
Ver Arquivo
@@ -3,7 +3,7 @@
*
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -62,7 +62,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
const char *device_uri; /* Device URI */
char method[255], /* Method in URI */
char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (not used) */
@@ -72,9 +72,11 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
sep; /* Option separator */
int print_fd; /* Print file */
int copies; /* Number of copies to print */
time_t start_time, /* Time of first connect */
current_time, /* Current time */
time_t start_time; /* Time of first connect */
#ifdef __APPLE__
time_t current_time, /* Current time */
wait_time; /* Time to wait before shutting down socket */
#endif /* __APPLE__ */
int recoverable; /* Recoverable error shown? */
int contimeout; /* Connection timeout */
int waiteof; /* Wait for end-of-file? */
@@ -168,9 +170,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme),
username, sizeof(username), hostname, sizeof(hostname), &port,
resource, sizeof(resource));
if (port == 0)
@@ -261,6 +262,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
sprintf(portname, "%d", port);
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
@@ -270,12 +272,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
return (CUPS_BACKEND_STOP);
}
fprintf(stderr, "DEBUG: Connecting to %s:%d\n",
hostname, port);
fprintf(stderr, "DEBUG: Connecting to %s:%d\n", hostname, port);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
fputs("STATE: +connecting-to-device\n", stderr);
for (delay = 5;;)
{
if ((addr = httpAddrConnect(addrlist, &device_fd)) == NULL)
@@ -345,9 +344,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (recoverable)
{
/*
* If we've shown a recoverable error make sure the printer proxies
* have a chance to see the recovered message. Not pretty but
* necessary for now...
* If we've shown a recoverable error make sure the printer proxies have a
* chance to see the recovered message. Not pretty but necessary for now...
*/
fputs("INFO: recovered: \n", stderr);
@@ -397,7 +395,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
lseek(print_fd, 0, SEEK_SET);
}
tbytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addr->addr), 1,
tbytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addr->addr), 1, 0,
backendNetworkSideCB);
if (print_fd != 0 && tbytes >= 0)
@@ -410,6 +408,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
CUPS_LLCAST tbytes);
}
#ifdef __APPLE__
/*
* Wait up to 5 seconds to get any pending back-channel data...
*/
@@ -418,6 +417,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
while (wait_time >= time(&current_time))
if (wait_bc(device_fd, wait_time - current_time) <= 0)
break;
#endif /* __APPLE__ */
if (waiteof)
{
+205 -48
Ver Arquivo
@@ -16,9 +16,10 @@
*
* Contents:
*
* main() - Run the named backend.
* usage() - Show usage information.
* walk_cb() - Show results of cupsSideChannelSNMPWalk...
* main() - Run the named backend.
* sigterm_handler() - Flag when we get SIGTERM.
* usage() - Show usage information.
* walk_cb() - Show results of cupsSideChannelSNMPWalk...
*/
/*
@@ -34,12 +35,21 @@
#include <fcntl.h>
#include <errno.h>
#include <sys/wait.h>
#include <signal.h>
/*
* Local globals...
*/
static int job_canceled = 0;
/*
* Local functions...
*/
static void sigterm_handler(int sig);
static void usage(void);
static void walk_cb(const char *oid, const char *data, int datalen,
void *context);
@@ -58,6 +68,7 @@ main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
int first_arg, /* First argument for backend */
do_cancel = 0, /* Simulate a cancel-job via SIGTERM */
do_ps = 0, /* Do PostScript query+test? */
do_pcl = 0, /* Do PCL query+test? */
do_side_tests = 0, /* Test side-channel ops? */
@@ -69,9 +80,12 @@ main(int argc, /* I - Number of command-line args */
char scheme[255], /* Scheme in URI == backend */
backend[1024]; /* Backend path */
const char *serverbin; /* CUPS_SERVERBIN environment variable */
int back_fds[2], /* Back-channel pipe */
int fd, /* Temporary file descriptor */
back_fds[2], /* Back-channel pipe */
side_fds[2], /* Side-channel socket */
data_fds[2], /* Data pipe */
back_pid = -1, /* Backend process ID */
data_pid = -1, /* Trickle process ID */
pid, /* Process ID */
status; /* Exit status */
@@ -85,6 +99,8 @@ main(int argc, /* I - Number of command-line args */
first_arg ++)
if (!strcmp(argv[first_arg], "-d"))
show_log = 1;
else if (!strcmp(argv[first_arg], "-cancel"))
do_cancel = 1;
else if (!strcmp(argv[first_arg], "-pcl"))
do_pcl = 1;
else if (!strcmp(argv[first_arg], "-ps"))
@@ -160,33 +176,44 @@ main(int argc, /* I - Number of command-line args */
* Execute the trickle process as needed...
*/
if (do_trickle || do_pcl || do_ps)
if (do_trickle || do_pcl || do_ps || do_cancel)
{
pipe(data_fds);
if ((pid = fork()) == 0)
signal(SIGTERM, sigterm_handler);
if ((data_pid = fork()) == 0)
{
/*
* Trickle/query child comes here. Rearrange file descriptors so that
* FD 1, 3, and 4 point to the backend...
*/
close(0);
open("/dev/null", O_RDONLY);
if ((fd = open("/dev/null", O_RDONLY)) != 0)
{
dup2(fd, 0);
close(fd);
}
close(1);
dup(data_fds[1]);
if (data_fds[1] != 1)
{
dup2(data_fds[1], 1);
close(data_fds[1]);
}
close(data_fds[0]);
close(data_fds[1]);
close(3);
dup(back_fds[0]);
close(back_fds[0]);
if (back_fds[0] != 3)
{
dup2(back_fds[0], 3);
close(back_fds[0]);
}
close(back_fds[1]);
close(4);
dup(side_fds[0]);
close(side_fds[0]);
if (side_fds[0] != 4)
{
dup2(side_fds[0], 4);
close(side_fds[0]);
}
close(side_fds[1]);
if (do_trickle)
@@ -203,6 +230,97 @@ main(int argc, /* I - Number of command-line args */
sleep(1);
}
}
else if (do_cancel)
{
/*
* Write PS or PCL lines until we see SIGTERM...
*/
int line = 0, page = 0; /* Current line and page */
ssize_t bytes; /* Number of bytes of response data */
char buffer[1024]; /* Output buffer */
if (do_pcl)
write(1, "\033E", 2);
else
write(1, "%!\n/Courier findfont 12 scalefont setfont 0 setgray\n", 52);
while (!job_canceled)
{
if (line == 0)
{
page ++;
if (do_pcl)
snprintf(buffer, sizeof(buffer), "PCL Page %d\r\n\r\n", page);
else
snprintf(buffer, sizeof(buffer),
"18 732 moveto (PS Page %d) show\n", page);
write(1, buffer, strlen(buffer));
}
line ++;
if (do_pcl)
snprintf(buffer, sizeof(buffer), "Line %d\r\n", line);
else
snprintf(buffer, sizeof(buffer), "18 %d moveto (Line %d) show\n",
720 - line * 12, line);
write(1, buffer, strlen(buffer));
if (line >= 55)
{
/*
* Eject after 55 lines...
*/
line = 0;
if (do_pcl)
write(1, "\014", 1);
else
write(1, "showpage\n", 9);
}
/*
* Check for back-channel data...
*/
if ((bytes = cupsBackChannelRead(buffer, sizeof(buffer), 0)) > 0)
write(2, buffer, bytes);
/*
* Throttle output to ~100hz...
*/
usleep(10000);
}
/*
* Eject current page with info...
*/
if (do_pcl)
snprintf(buffer, sizeof(buffer),
"Canceled on line %d of page %d\r\n\014\033E", line, page);
else
snprintf(buffer, sizeof(buffer),
"\n18 %d moveto (Canceled on line %d of page %d)\nshowpage\n",
720 - line * 12, line, page);
write(1, buffer, strlen(buffer));
/*
* See if we get any back-channel data...
*/
while ((bytes = cupsBackChannelRead(buffer, sizeof(buffer), 5.0)) > 0)
write(2, buffer, bytes);
exit(0);
}
else
{
/*
@@ -282,7 +400,7 @@ main(int argc, /* I - Number of command-line args */
exit(0);
}
else if (pid < 0)
else if (data_pid < 0)
{
perror("testbackend: Unable to fork");
return (1);
@@ -295,34 +413,43 @@ main(int argc, /* I - Number of command-line args */
* Execute the backend...
*/
if ((pid = fork()) == 0)
if ((back_pid = fork()) == 0)
{
/*
* Child comes here...
*/
if (do_trickle || do_ps)
if (do_trickle || do_ps || do_pcl || do_cancel)
{
close(0);
dup(data_fds[0]);
close(data_fds[0]);
if (data_fds[0] != 0)
{
dup2(data_fds[0], 0);
close(data_fds[0]);
}
close(data_fds[1]);
}
if (!show_log)
{
close(2);
open("/dev/null", O_WRONLY);
if ((fd = open("/dev/null", O_WRONLY)) != 2)
{
dup2(fd, 2);
close(fd);
}
}
close(3);
dup(back_fds[1]);
close(back_fds[0]);
if (back_fds[1] != 3)
{
dup2(back_fds[1], 3);
close(back_fds[0]);
}
close(back_fds[1]);
close(4);
dup(side_fds[1]);
close(side_fds[0]);
if (side_fds[1] != 4)
{
dup2(side_fds[1], 4);
close(side_fds[0]);
}
close(side_fds[1]);
execv(backend, argv + first_arg);
@@ -330,7 +457,7 @@ main(int argc, /* I - Number of command-line args */
strerror(errno));
return (errno);
}
else if (pid < 0)
else if (back_pid < 0)
{
perror("testbackend: Unable to fork");
return (1);
@@ -340,20 +467,24 @@ main(int argc, /* I - Number of command-line args */
* Parent comes here, setup back and side channel file descriptors...
*/
if (do_trickle || do_ps)
if (do_trickle || do_ps || do_pcl || do_cancel)
{
close(data_fds[0]);
close(data_fds[1]);
}
close(3);
dup(back_fds[0]);
close(back_fds[0]);
if (back_fds[0] != 3)
{
dup2(back_fds[0], 3);
close(back_fds[0]);
}
close(back_fds[1]);
close(4);
dup(side_fds[0]);
close(side_fds[0]);
if (side_fds[0] != 4)
{
dup2(side_fds[0], 4);
close(side_fds[0]);
}
close(side_fds[1]);
/*
@@ -435,14 +566,26 @@ main(int argc, /* I - Number of command-line args */
printf("CUPS_SC_CMD_SOFT_RESET returned %s\n", statuses[scstatus]);
}
while (wait(&status) != pid);
if (status)
if (do_cancel)
{
if (WIFEXITED(status))
printf("%s exited with status %d!\n", backend, WEXITSTATUS(status));
else
printf("%s crashed with signal %d!\n", backend, WTERMSIG(status));
sleep(1);
kill(data_pid, SIGTERM);
kill(back_pid, SIGTERM);
}
while ((pid = wait(&status)) > 0)
{
if (status)
{
if (WIFEXITED(status))
printf("%s exited with status %d!\n",
pid == back_pid ? backend : "test",
WEXITSTATUS(status));
else
printf("%s crashed with signal %d!\n",
pid == back_pid ? backend : "test",
WTERMSIG(status));
}
}
/*
@@ -453,6 +596,19 @@ main(int argc, /* I - Number of command-line args */
}
/*
* 'sigterm_handler()' - Flag when we get SIGTERM.
*/
static void
sigterm_handler(int sig) /* I - Signal */
{
(void)sig;
job_canceled = 1;
}
/*
* 'usage()' - Show usage information.
*/
@@ -460,10 +616,11 @@ main(int argc, /* I - Number of command-line args */
static void
usage(void)
{
puts("Usage: testbackend [-d] [-ps] [-s [-oid OID] [-walk OID]] [-t] "
"device-uri job-id user title copies options [file]");
puts("Usage: testbackend [-cancel] [-d] [-ps | -pcl] [-s [-oid 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(" (.1.3.6.1.2.1.43.10.2.1.4.1.1 is a good one for printers)");
+183 -67
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* "$Id$"
*
* Copyright 2005-2009 Apple Inc. All rights reserved.
* Copyright 2005-2010 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
@@ -104,6 +104,14 @@
extern char **environ;
/*
* DEBUG_WRITES, if defined, causes the backend to write data to the printer in
* 512 byte increments, up to 8192 bytes, to make debugging with a USB bus
* analyzer easier.
*/
#define DEBUG_WRITES 0
/*
* WAIT_EOF_DELAY is number of seconds we'll wait for responses from
* the printer after we've finished sending all the data
@@ -232,6 +240,9 @@ typedef struct globals_s
int print_fd; /* File descriptor to print */
ssize_t print_bytes; /* Print bytes read */
#if DEBUG_WRITES
ssize_t debug_bytes; /* Current bytes to read */
#endif /* DEBUG_WRITES */
Boolean wait_eof;
int drain_output; /* Drain all pending output */
@@ -282,7 +293,6 @@ static void status_timer_cb(CFRunLoopTimerRef timer, void *info);
static pid_t child_pid; /* Child PID */
static void run_legacy_backend(int argc, char *argv[], int fd); /* Starts child backend process running as a ppc executable */
#endif /* __i386__ || __x86_64__ */
static int job_canceled = 0; /* Was the job canceled? */
static void sigterm_handler(int sig); /* SIGTERM handler */
#ifdef PARSE_PS_ERRORS
@@ -318,8 +328,7 @@ print_device(const char *uri, /* I - Device URI */
{
char serial[1024]; /* Serial number buffer */
OSStatus status; /* Function results */
IOReturn iostatus, /* Current IO status */
prev_iostatus = 0; /* Previous IO status */
IOReturn iostatus; /* Current IO status */
pthread_t read_thread_id, /* Read thread */
sidechannel_thread_id;/* Side-channel thread */
int have_sidechannel = 0; /* Was the side-channel thread started? */
@@ -364,12 +373,12 @@ print_device(const char *uri, /* I - Device URI */
if (!g.make || !g.model)
{
_cupsLangPuts(stderr, _("ERROR: Fatal USB error!\n"));
_cupsLangPuts(stderr, _("ERROR: Fatal USB error\n"));
if (!g.make)
fputs("DEBUG: USB make string is NULL!\n", stderr);
fputs("DEBUG: USB make string is NULL\n", stderr);
if (!g.model)
fputs("DEBUG: USB model string is NULL!\n", stderr);
fputs("DEBUG: USB model string is NULL\n", stderr);
return (CUPS_BACKEND_STOP);
}
@@ -422,7 +431,7 @@ print_device(const char *uri, /* I - Device URI */
strlcpy(print_buffer, "USB class driver", sizeof(print_buffer));
fputs("STATE: +apple-missing-usbclassdriver-error\n", stderr);
_cupsLangPuts(stderr, _("ERROR: Fatal USB error!\n"));
_cupsLangPuts(stderr, _("ERROR: Fatal USB error\n"));
fprintf(stderr, "DEBUG: Could not load %s\n", print_buffer);
if (driverBundlePath)
@@ -451,9 +460,9 @@ print_device(const char *uri, /* I - Device URI */
fputs("STATE: -connecting-to-device\n", stderr);
/*
* Now that we are "connected" to the port, catch SIGTERM so that we
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
* current page... Only catch SIGTERM if we are printing data from
* current page... Only ignore SIGTERM if we are printing data from
* stdin (otherwise you can't cancel raw jobs...)
*/
@@ -465,7 +474,7 @@ print_device(const char *uri, /* I - Device URI */
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = sigterm_handler;
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
}
@@ -487,8 +496,9 @@ print_device(const char *uri, /* I - Device URI */
if (pthread_create(&sidechannel_thread_id, NULL, sidechannel_thread, NULL))
{
_cupsLangPuts(stderr, _("ERROR: Fatal USB error!\n"));
fputs("DEBUG: Couldn't create side-channel thread!\n", stderr);
_cupsLangPuts(stderr, _("ERROR: Fatal USB error\n"));
fputs("DEBUG: Couldn't create side-channel thread\n", stderr);
registry_close();
return (CUPS_BACKEND_STOP);
}
}
@@ -505,8 +515,9 @@ print_device(const char *uri, /* I - Device URI */
if (pthread_create(&read_thread_id, NULL, read_thread, NULL))
{
_cupsLangPuts(stderr, _("ERROR: Fatal USB error!\n"));
fputs("DEBUG: Couldn't create read thread!\n", stderr);
_cupsLangPuts(stderr, _("ERROR: Fatal USB error\n"));
fputs("DEBUG: Couldn't create read thread\n", stderr);
registry_close();
return (CUPS_BACKEND_STOP);
}
@@ -584,14 +595,16 @@ print_device(const char *uri, /* I - Device URI */
if (errno == EINTR && total_bytes == 0)
{
fputs("DEBUG: Received an interrupt before any bytes were "
"written, aborting!\n", stderr);
"written, aborting\n", stderr);
registry_close();
return (CUPS_BACKEND_OK);
}
else if (errno != EAGAIN && errno != EINTR)
{
_cupsLangPuts(stderr, _("ERROR: Unable to read print data!\n"));
_cupsLangPuts(stderr, _("ERROR: Unable to read print data\n"));
perror("DEBUG: select");
return (CUPS_BACKEND_FAILED);
registry_close();
return (CUPS_BACKEND_FAILED);
}
}
@@ -612,7 +625,16 @@ print_device(const char *uri, /* I - Device URI */
if (FD_ISSET(print_fd, &input_set))
{
#if DEBUG_WRITES
g.debug_bytes += 512;
if (g.debug_bytes > sizeof(print_buffer))
g.debug_bytes = 512;
g.print_bytes = read(print_fd, print_buffer, g.debug_bytes);
#else
g.print_bytes = read(print_fd, print_buffer, sizeof(print_buffer));
#endif /* DEBUG_WRITES */
if (g.print_bytes < 0)
{
@@ -622,8 +644,9 @@ print_device(const char *uri, /* I - Device URI */
if (errno != EAGAIN && errno != EINTR)
{
_cupsLangPuts(stderr, _("ERROR: Unable to read print data!\n"));
_cupsLangPuts(stderr, _("ERROR: Unable to read print data\n"));
perror("DEBUG: read");
registry_close();
return (CUPS_BACKEND_FAILED);
}
@@ -646,8 +669,7 @@ print_device(const char *uri, /* I - Device URI */
if (g.print_bytes)
{
bytes = g.print_bytes;
bytes = g.print_bytes;
iostatus = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
/*
@@ -656,27 +678,42 @@ print_device(const char *uri, /* I - Device URI */
*/
if (iostatus == kIOUSBTransactionTimeout)
iostatus = 0;
/*
* Ignore stall errors, since we clear any stalls in the class driver...
*/
if (iostatus == kIOUSBPipeStalled)
iostatus = 0;
/*
* Ignore the first "aborted" status we get, since we might have
* received a signal (<rdar://problem/6860126>)...
*/
if (iostatus == kIOReturnAborted && prev_iostatus != kIOReturnAborted)
{
prev_iostatus = iostatus;
iostatus = 0;
fputs("DEBUG: Got USB transaction timeout during write\n", stderr);
iostatus = 0;
}
else
prev_iostatus = iostatus;
/*
* If we've stalled, retry the write...
*/
else if (iostatus == kIOUSBPipeStalled)
{
fputs("DEBUG: Got USB pipe stalled during write\n", stderr);
bytes = g.print_bytes;
iostatus = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
}
/*
* Retry a write after an aborted write since we probably just got
* SIGTERM (<rdar://problem/6860126>)...
*/
else if (iostatus == kIOReturnAborted)
{
fputs("DEBUG: Got USB return aborted during write\n", stderr);
IOReturn err = (*g.classdriver)->Abort(g.classdriver);
fprintf(stderr, "DEBUG: USB class driver Abort returned %x\n", err);
#if DEBUG_WRITES
sleep(5);
#endif /* DEBUG_WRITES */
bytes = g.print_bytes;
iostatus = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
}
if (iostatus || bytes < 0)
{
@@ -684,21 +721,25 @@ print_device(const char *uri, /* I - Device URI */
* Write error - bail if we don't see an error we can retry...
*/
IOReturn err = (*g.classdriver)->Abort(g.classdriver);
_cupsLangPuts(stderr, _("ERROR: Unable to send print data!\n"));
_cupsLangPuts(stderr, _("ERROR: Unable to send print data\n"));
fprintf(stderr, "DEBUG: USB class driver WritePipe returned %x\n",
iostatus);
IOReturn err = (*g.classdriver)->Abort(g.classdriver);
fprintf(stderr, "DEBUG: USB class driver Abort returned %x\n",
err);
status = job_canceled ? CUPS_BACKEND_FAILED : CUPS_BACKEND_STOP;
status = CUPS_BACKEND_FAILED;
break;
}
else if (bytes > 0)
{
fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
g.print_bytes -= bytes;
print_ptr += bytes;
total_bytes += bytes;
g.print_bytes -= bytes;
print_ptr += bytes;
total_bytes += bytes;
}
}
if (print_fd != 0 && status == noErr)
@@ -709,6 +750,22 @@ print_device(const char *uri, /* I - Device URI */
fprintf(stderr, "DEBUG: Sent %lld bytes...\n", (off_t)total_bytes);
if (!print_fd)
{
/*
* Re-enable the SIGTERM handler so pthread_kill() will work...
*/
struct sigaction action; /* POSIX signal action */
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
sigaddset(&action.sa_mask, SIGTERM);
action.sa_handler = sigterm_handler;
sigaction(SIGTERM, &action, NULL);
}
/*
* Wait for the side channel thread to exit...
*/
@@ -739,6 +796,7 @@ print_device(const char *uri, /* I - Device URI */
* Force the side-channel thread to exit...
*/
fputs("DEBUG: Force the side-channel thread to exit...\n", stderr);
pthread_kill(sidechannel_thread_id, SIGTERM);
}
}
@@ -779,6 +837,7 @@ print_device(const char *uri, /* I - Device URI */
*/
g.wait_eof = 0;
fputs("DEBUG: Force the read thread to exit...\n", stderr);
pthread_kill(read_thread_id, SIGTERM);
}
}
@@ -844,6 +903,8 @@ static void *read_thread(void *reference)
readstatus = (*g.classdriver)->ReadPipe(g.classdriver, readbuffer, &rbytes);
if (readstatus == kIOReturnSuccess && rbytes > 0)
{
fprintf(stderr, "DEBUG: Read %d bytes of back-channel data...\n",
(int)rbytes);
cupsBackChannelWrite((char*)readbuffer, rbytes, 1.0);
/* cntrl-d is echoed by the printer.
@@ -858,6 +919,12 @@ static void *read_thread(void *reference)
parse_pserror(readbuffer, rbytes);
#endif
}
else if (readstatus == kIOUSBTransactionTimeout)
fputs("DEBUG: Got USB transaction timeout during read\n", stderr);
else if (readstatus == kIOUSBPipeStalled)
fputs("DEBUG: Got USB pipe stalled during read\n", stderr);
else if (readstatus == kIOReturnAborted)
fputs("DEBUG: Got USB return aborted during read\n", stderr);
/*
* Make sure this loop executes no more than once every 250 miliseconds...
@@ -899,46 +966,93 @@ sidechannel_thread(void *reference)
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
continue;
{
if (status == CUPS_SC_STATUS_TIMEOUT)
continue;
else
break;
}
switch (command)
{
case CUPS_SC_CMD_SOFT_RESET: /* Do a soft reset */
fputs("DEBUG: CUPS_SC_CMD_SOFT_RESET received from driver...\n",
stderr);
if ((*g.classdriver)->SoftReset != NULL)
{
soft_reset();
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, NULL, 0, 1.0);
fputs("DEBUG: Returning status CUPS_STATUS_OK with no bytes...\n",
stderr);
}
else
{
cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED,
NULL, 0, 1.0);
fputs("DEBUG: Returning status CUPS_STATUS_NOT_IMPLEMENTED with "
"no bytes...\n", stderr);
}
break;
case CUPS_SC_CMD_DRAIN_OUTPUT: /* Drain all pending output */
fputs("DEBUG: CUPS_SC_CMD_DRAIN_OUTPUT received from driver...\n",
stderr);
g.drain_output = 1;
break;
case CUPS_SC_CMD_GET_BIDI: /* Is the connection bidirectional? */
fputs("DEBUG: CUPS_SC_CMD_GET_BIDI received from driver...\n",
stderr);
data[0] = g.bidi_flag;
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0);
fprintf(stderr,
"DEBUG: Returned CUPS_SC_STATUS_OK with 1 byte (%02X)...\n",
data[0]);
break;
case CUPS_SC_CMD_GET_DEVICE_ID: /* Return IEEE-1284 device ID */
fputs("DEBUG: CUPS_SC_CMD_GET_DEVICE_ID received from driver...\n",
stderr);
datalen = sizeof(data);
get_device_id(&status, data, &datalen);
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, datalen, 1.0);
if (datalen < sizeof(data))
data[datalen] = '\0';
else
data[sizeof(data) - 1] = '\0';
fprintf(stderr,
"DEBUG: Returning CUPS_SC_STATUS_OK with %d bytes (%s)...\n",
datalen, data);
break;
case CUPS_SC_CMD_GET_STATE: /* Return device state */
fputs("DEBUG: CUPS_SC_CMD_GET_STATE received from driver...\n",
stderr);
data[0] = CUPS_SC_STATE_ONLINE;
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0);
fprintf(stderr,
"DEBUG: Returned CUPS_SC_STATUS_OK with 1 byte (%02X)...\n",
data[0]);
break;
default:
fprintf(stderr, "DEBUG: Unknown side-channel command (%d) received "
"from driver...\n", command);
cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED,
NULL, 0, 1.0);
fputs("DEBUG: Returned CUPS_SC_STATUS_NOT_IMPLEMENTED with no bytes...\n",
stderr);
break;
}
}
@@ -1078,7 +1192,7 @@ static Boolean list_device_cb(void *refcon,
snprintf(optionsstr, sizeof(optionsstr), "?location=%x", (unsigned)deviceLocation);
httpAssembleURI(HTTP_URI_CODING_ALL, uristr, sizeof(uristr), "usb", NULL, makestr, 0, modelstr);
strncat(uristr, optionsstr, sizeof(uristr));
strlcat(uristr, optionsstr, sizeof(uristr));
cupsBackendReport("direct", uristr, make_modelstr, make_modelstr, idstr,
NULL);
@@ -1283,7 +1397,10 @@ static kern_return_t load_classdriver(CFStringRef driverPath,
{
fprintf(stderr, "DEBUG: Unable to load class driver \"%s\": %s\n",
bundlestr, strerror(errno));
return (kr);
if (errno == ENOENT)
return (load_classdriver(NULL, intf, printerDriver));
else
return (kr);
}
else if (bundleinfo.st_mode & S_IWOTH)
{
@@ -1815,6 +1932,7 @@ static void run_legacy_backend(int argc,
* Setup a SIGTERM handler then block it before forking...
*/
int err; /* posix_spawn result */
struct sigaction action; /* POSIX signal action */
sigset_t newmask, /* New signal mask */
oldmask; /* Old signal mask */
@@ -1863,7 +1981,7 @@ static void run_legacy_backend(int argc,
# else
perror("DEBUG: Unable to set binary preference to ppc");
# endif /* __x86_64__ */
_cupsLangPrintf(stderr, _("Unable to use legacy USB class driver!\n"));
_cupsLangPrintf(stderr, _("Unable to use legacy USB class driver\n"));
exit(CUPS_BACKEND_STOP);
}
}
@@ -1881,11 +1999,12 @@ static void run_legacy_backend(int argc,
my_argv[i] = NULL;
if (posix_spawn(&child_pid, usbpath, NULL, &attrs, my_argv, environ))
if ((err = posix_spawn(&child_pid, usbpath, NULL, &attrs, my_argv,
environ)) != 0)
{
fprintf(stderr, "DEBUG: Unable to exec %s: %s\n", usbpath,
strerror(errno));
_cupsLangPrintf(stderr, _("Unable to use legacy USB class driver!\n"));
strerror(err));
_cupsLangPrintf(stderr, _("Unable to use legacy USB class driver\n"));
exit(CUPS_BACKEND_STOP);
}
@@ -1911,14 +2030,14 @@ static void run_legacy_backend(int argc,
if (WIFSIGNALED(childstatus))
{
exitstatus = CUPS_BACKEND_STOP;
fprintf(stderr, "DEBUG: usb(legacy) backend %d crashed on signal %d!\n",
fprintf(stderr, "DEBUG: usb(legacy) backend %d crashed on signal %d\n",
child_pid, WTERMSIG(childstatus));
}
else
{
if ((exitstatus = WEXITSTATUS(childstatus)) != 0)
fprintf(stderr,
"DEBUG: usb(legacy) backend %d stopped with status %d!\n",
"DEBUG: usb(legacy) backend %d stopped with status %d\n",
child_pid, exitstatus);
else
fprintf(stderr, "DEBUG: usb(legacy) backend %d exited with no errors\n",
@@ -1944,6 +2063,10 @@ static void
sigterm_handler(int sig) /* I - Signal */
{
#if defined(__i386__) || defined(__x86_64__)
/*
* If we started a child process pass the signal on to it...
*/
if (child_pid)
{
/*
@@ -1961,17 +2084,11 @@ sigterm_handler(int sig) /* I - Signal */
exit(0);
else
{
fprintf(stderr, "DEBUG: Child crashed on signal %d!\n", status);
fprintf(stderr, "DEBUG: Child crashed on signal %d\n", status);
exit(CUPS_BACKEND_STOP);
}
}
#endif /* __i386__ || __x86_64__ */
/*
* Otherwise just flag that the job has been canceled...
*/
job_canceled = 1;
}
@@ -2123,12 +2240,11 @@ static void get_device_id(cups_sc_status_t *status,
char *data,
int *datalen)
{
UInt32 deviceLocation = 0;
UInt8 interfaceNum = 0;
CFStringRef deviceIDString = NULL;
/* GetDeviceID */
copy_devicestring(g.printer_obj, &deviceIDString, &deviceLocation, &interfaceNum);
copy_deviceid(g.classdriver, &deviceIDString);
if (deviceIDString)
{
CFStringGetCString(deviceIDString, data, *datalen, kCFStringEncodingUTF8);
+33 -17
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Libusb interface code for the Common UNIX Printing System (CUPS).
* Libusb interface code for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -100,7 +100,7 @@ print_device(const char *uri, /* I - Device URI */
usb_printer_t *printer; /* Printer */
ssize_t bytes, /* Bytes read/written */
tbytes; /* Total bytes written */
char buffer[8192]; /* Print data buffer */
char buffer[512]; /* Print data buffer */
struct sigaction action; /* Actions for POSIX signals */
struct pollfd pfds[2]; /* Poll descriptors */
@@ -158,12 +158,21 @@ print_device(const char *uri, /* I - Device URI */
while (poll(pfds, 2, -1) > 0)
{
if (pfds[0].revents & POLLIN)
/*
* CUPS STR #3318: USB process hangs on end-of-file, making further
* printing impossible
*
* From a strict interpretation of POSIX poll(), POLLHUP should never be
* set without POLLIN, since POLLIN is the event you request. That said,
* it appears that some versions of Linux break this.
*/
if (pfds[0].revents & (POLLIN | POLLHUP))
{
if ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0)
{
if (usb_bulk_write(printer->handle, printer->write_endp, buffer,
bytes, 45000) < 0)
bytes, 3600000) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to write %d bytes to printer!\n"),
@@ -178,8 +187,13 @@ print_device(const char *uri, /* I - Device URI */
break;
}
if (pfds[1].revents & POLLIN)
tbytes += side_cb(printer, print_fd);
if (pfds[1].revents & (POLLIN | POLLHUP))
{
if ((bytes = side_cb(printer, print_fd)) < 0)
pfds[1].events = 0; /* Filter has gone away... */
else
tbytes += bytes;
}
}
}
@@ -397,7 +411,7 @@ get_device_id(usb_printer_t *printer, /* I - Printer */
if (usb_control_msg(printer->handle,
USB_TYPE_CLASS | USB_ENDPOINT_IN | USB_RECIP_INTERFACE,
0, printer->conf, printer->iface,
0, printer->conf, (printer->iface << 8) | printer->altset,
buffer, bufsize, 5000) < 0)
{
*buffer = '\0';
@@ -418,12 +432,14 @@ get_device_id(usb_printer_t *printer, /* I - Printer */
* and then limit the length to the size of our buffer...
*/
if (length > (bufsize - 2))
if (length > bufsize)
length = (((unsigned)buffer[1] & 255) << 8) +
((unsigned)buffer[0] & 255);
if (length > (bufsize - 2))
length = bufsize - 2;
if (length > bufsize)
length = bufsize;
length -= 2;
/*
* Copy the device ID text to the beginning of the buffer and
@@ -502,7 +518,8 @@ make_device_uri(
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
if ((sern = cupsGetOption("SN", num_values, values)) == NULL)
if ((sern = cupsGetOption("SN", num_values, values)) == NULL &&
printer->device->descriptor.iSerialNumber)
{
/*
* Try getting the serial number from the device itself...
@@ -658,6 +675,7 @@ open_device(usb_printer_t *printer, /* I - Printer */
goto error;
}
#if 0 /* STR #3801: Claiming interface 0 causes problems with some printers */
if (number != 0)
while (usb_claim_interface(printer->handle, 0) < 0)
{
@@ -668,6 +686,7 @@ open_device(usb_printer_t *printer, /* I - Printer */
goto error;
}
#endif /* 0 */
/*
* Set alternate setting...
@@ -731,7 +750,7 @@ side_cb(usb_printer_t *printer, /* I - Printer */
{
ssize_t bytes, /* Bytes read/written */
tbytes; /* Total bytes written */
char buffer[8192]; /* Print data buffer */
char buffer[512]; /* Print data buffer */
struct pollfd pfd; /* Poll descriptor */
cups_sc_command_t command; /* Request command */
cups_sc_status_t status; /* Request/response status */
@@ -743,10 +762,7 @@ side_cb(usb_printer_t *printer, /* I - Printer */
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
return (0);
}
return (-1);
switch (command)
{
+7 -10
Ver Arquivo
@@ -5,7 +5,7 @@
*
* This file is included from "usb.c" when compiled on UNIX/Linux.
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -36,7 +36,7 @@
*/
static int open_device(const char *uri, int *use_bc);
static void side_cb(int print_fd, int device_fd, int snmp_fd,
static int side_cb(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, int use_bc);
@@ -187,10 +187,10 @@ print_device(const char *uri, /* I - Device URI */
* select() or poll(), so we can't support the sidechannel either...
*/
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, NULL);
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, NULL);
#else
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, side_cb);
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb);
#endif /* __sun */
if (print_fd != 0 && tbytes >= 0)
@@ -560,7 +560,7 @@ open_device(const char *uri, /* I - Device URI */
* 'side_cb()' - Handle side-channel requests...
*/
static void
static int /* O - 0 on success, -1 on error */
side_cb(int print_fd, /* I - Print file */
int device_fd, /* I - Device file */
int snmp_fd, /* I - SNMP socket (unused) */
@@ -579,10 +579,7 @@ side_cb(int print_fd, /* I - Print file */
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
return;
}
return (-1);
switch (command)
{
@@ -625,7 +622,7 @@ side_cb(int print_fd, /* I - Print file */
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
+17 -1
Ver Arquivo
@@ -340,7 +340,18 @@ show_jobs(const char *command, /* I - Command name */
char resource[1024]; /* Resource string */
char rankstr[255]; /* Rank string */
char namestr[1024]; /* Job name string */
static const char *ranks[10] = /* Ranking strings */
static const char * const jobattrs[] =/* Job attributes we want to see */
{
"copies",
"job-id",
"job-k-octets",
"job-name",
"job-originating-user-name",
"job-printer-uri",
"job-priority",
"job-state"
};
static const char * const ranks[10] = /* Ranking strings */
{
"th",
"st",
@@ -368,6 +379,7 @@ show_jobs(const char *command, /* I - Command name */
* attributes-charset
* attributes-natural-language
* job-uri or printer-uri
* requested-attributes
*/
request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
@@ -397,6 +409,10 @@ show_jobs(const char *command, /* I - Command name */
ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
}
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
(int)(sizeof(jobattrs) / sizeof(jobattrs[0])), NULL, jobattrs);
/*
* Do the request and get back a response...
*/
+5 -4
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id$"
#
# CGI makefile for the Common UNIX Printing System (CUPS).
# CGI makefile for CUPS.
#
# Copyright 2007-2009 by Apple Inc.
# Copyright 2007-2010 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -118,7 +118,7 @@ install-exec:
done
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
for file in $(TARGETS); do \
for file in $(CGIS); do \
cp $$file $(SYMROOT); \
done \
fi
@@ -158,8 +158,9 @@ install-libs: $(INSTALLSTATIC)
installstatic:
$(INSTALL_DIR) -m 755 $(LIBDIR)
$(INSTALL_LIB) libcupscgi.a $(LIBDIR)
$(INSTALL_LIB) -m 755 libcupscgi.a $(LIBDIR)
$(RANLIB) $(LIBDIR)/libcupscgi.a
$(CHMOD) 555 $(LIBDIR)/libcupscgi.a
#
+196 -72
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Administration CGI for the Common UNIX Printing System (CUPS).
* Administration CGI for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -52,8 +52,7 @@
* Local globals...
*/
static int current_device; /* Current device for add/modify */
static time_t last_device_time; /* Last update time for device list */
static int current_device = 0; /* Current device shown */
/*
@@ -122,6 +121,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiSetVariable("SECTION", "admin");
cgiSetVariable("REFRESH_PAGE", "");
/*
* See if we have form data...
@@ -145,7 +145,30 @@ main(int argc, /* I - Number of command-line arguments */
fprintf(stderr, "DEBUG: op=\"%s\"...\n", op);
if (!strcmp(op, "set-allowed-users"))
if (!*op)
{
const char *printer = getenv("PRINTER_NAME"),
/* Printer or class name */
*server_port = getenv("SERVER_PORT");
/* Port number string */
int port = atoi(server_port ? server_port : "0");
/* Port number */
char uri[1024]; /* URL */
if (printer)
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri),
getenv("HTTPS") ? "https" : "http", NULL,
getenv("SERVER_NAME"), port, "/%s/%s",
cgiGetVariable("IS_CLASS") ? "classes" : "printers",
printer);
else
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri),
getenv("HTTPS") ? "https" : "http", NULL,
getenv("SERVER_NAME"), port, "/admin");
printf("Location: %s\n\n", uri);
}
else if (!strcmp(op, "set-allowed-users"))
do_set_allowed_users(http);
else if (!strcmp(op, "set-as-default"))
do_set_default(http);
@@ -191,7 +214,7 @@ main(int argc, /* I - Number of command-line arguments */
}
else if (op && !strcmp(op, "redirect"))
{
const char *url; /* Redirection URL... */
const char *url; /* Redirection URL... */
char prefix[1024]; /* URL prefix */
@@ -205,7 +228,50 @@ main(int argc, /* I - Number of command-line arguments */
fprintf(stderr, "DEBUG: redirecting with prefix %s!\n", prefix);
if ((url = cgiGetVariable("URL")) != NULL)
printf("Location: %s%s\n\n", prefix, url);
{
char encoded[1024], /* Encoded URL string */
*ptr; /* Pointer into encoded string */
ptr = encoded;
if (*url != '/')
*ptr++ = '/';
for (; *url && ptr < (encoded + sizeof(encoded) - 4); url ++)
{
if (strchr("%@&+ <>#=", *url) || *url < ' ' || *url & 128)
{
/*
* Percent-encode this character; safe because we have at least 4
* bytes left in the array...
*/
sprintf(ptr, "%%%02X", *url & 255);
ptr += 3;
}
else
*ptr++ = *url;
}
*ptr = '\0';
if (*url)
{
/*
* URL was too long, just redirect to the admin page...
*/
printf("Location: %s/admin\n\n", prefix);
}
else
{
/*
* URL is OK, redirect there...
*/
printf("Location: %s%s\n\n", prefix, encoded);
}
}
else
printf("Location: %s/admin\n\n", prefix);
}
@@ -248,6 +314,21 @@ choose_device_cb(
const char *device_location, /* I - Location */
const char *title) /* I - Page title */
{
/*
* For modern browsers, start a multi-part page so we can show that something
* is happening. Non-modern browsers just get everything at the end...
*/
if (current_device == 0 && cgiSupportsMultipart())
{
cgiStartMultipart();
cgiStartHTML(title);
cgiCopyTemplateLang("choose-device.tmpl");
cgiEndHTML();
fflush(stdout);
}
/*
* Add the device to the array...
*/
@@ -260,23 +341,6 @@ choose_device_cb(
cgiSetArray("device_location", current_device, device_location);
current_device ++;
if (time(NULL) > last_device_time && cgiSupportsMultipart())
{
/*
* Update the page...
*/
if (!last_device_time)
cgiStartMultipart();
cgiStartHTML(title);
cgiCopyTemplateLang("choose-device.tmpl");
cgiEndHTML();
fflush(stdout);
time(&last_device_time);
}
}
@@ -345,6 +409,31 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */
* and classes and (re)show the add page...
*/
if (cgiGetVariable("EVENT_JOB_CREATED"))
cgiSetVariable("EVENT_JOB_CREATED", "CHECKED");
if (cgiGetVariable("EVENT_JOB_COMPLETED"))
cgiSetVariable("EVENT_JOB_COMPLETED", "CHECKED");
if (cgiGetVariable("EVENT_JOB_STOPPED"))
cgiSetVariable("EVENT_JOB_STOPPED", "CHECKED");
if (cgiGetVariable("EVENT_JOB_CONFIG_CHANGED"))
cgiSetVariable("EVENT_JOB_CONFIG_CHANGED", "CHECKED");
if (cgiGetVariable("EVENT_PRINTER_STOPPED"))
cgiSetVariable("EVENT_PRINTER_STOPPED", "CHECKED");
if (cgiGetVariable("EVENT_PRINTER_ADDED"))
cgiSetVariable("EVENT_PRINTER_ADDED", "CHECKED");
if (cgiGetVariable("EVENT_PRINTER_MODIFIED"))
cgiSetVariable("EVENT_PRINTER_MODIFIED", "CHECKED");
if (cgiGetVariable("EVENT_PRINTER_DELETED"))
cgiSetVariable("EVENT_PRINTER_DELETED", "CHECKED");
if (cgiGetVariable("EVENT_SERVER_STARTED"))
cgiSetVariable("EVENT_SERVER_STARTED", "CHECKED");
if (cgiGetVariable("EVENT_SERVER_STOPPED"))
cgiSetVariable("EVENT_SERVER_STOPPED", "CHECKED");
if (cgiGetVariable("EVENT_SERVER_RESTARTED"))
cgiSetVariable("EVENT_SERVER_RESTARTED", "CHECKED");
if (cgiGetVariable("EVENT_SERVER_AUDIT"))
cgiSetVariable("EVENT_SERVER_AUDIT", "CHECKED");
request = ippNewRequest(CUPS_GET_PRINTERS);
response = cupsDoRequest(http, request, "/");
@@ -467,6 +556,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
ipp_attribute_t *attr; /* member-uris attribute */
char uri[HTTP_MAX_URI]; /* Device or printer URI */
const char *name, /* Pointer to class name */
*op, /* Operation name */
*ptr; /* Pointer to CGI variable */
const char *title; /* Title of page */
static const char * const pattrs[] = /* Requested printer attributes */
@@ -478,6 +568,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
title = cgiText(modify ? _("Modify Class") : _("Add Class"));
op = cgiGetVariable("OP");
name = cgiGetVariable("PRINTER_NAME");
if (cgiGetVariable("PRINTER_LOCATION") == NULL)
@@ -492,10 +583,22 @@ do_am_class(http_t *http, /* I - HTTP connection */
request = ippNewRequest(CUPS_GET_PRINTERS);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type",
CUPS_PRINTER_LOCAL);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type-mask",
CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE |
CUPS_PRINTER_IMPLICIT);
/*
* Do the request and get back a response...
*/
cgiClearVariables();
if (op)
cgiSetVariable("OP", op);
if (name)
cgiSetVariable("PRINTER_NAME", name);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
@@ -628,6 +731,15 @@ do_am_class(http_t *http, /* I - HTTP connection */
return;
}
if (!name)
{
cgiStartHTML(title);
cgiSetVariable("ERROR", cgiText(_("Missing form variable!")));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return;
}
for (ptr = name; *ptr; ptr ++)
if ((*ptr >= 0 && *ptr <= ' ') || *ptr == 127 || *ptr == '/' || *ptr == '#')
break;
@@ -662,8 +774,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
request = ippNewRequest(CUPS_ADD_CLASS);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/classes/%s",
cgiGetVariable("PRINTER_NAME"));
"localhost", 0, "/classes/%s", name);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -683,7 +794,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
attr = ippAddStrings(request, IPP_TAG_PRINTER, IPP_TAG_URI, "member-uris",
num_printers, NULL, NULL);
for (i = 0; i < num_printers; i ++)
attr->values[i].string.text = strdup(cgiGetArray("MEMBER_URIS", i));
attr->values[i].string.text = _cupsStrAlloc(cgiGetArray("MEMBER_URIS", i));
}
/*
@@ -863,8 +974,6 @@ do_am_printer(http_t *http, /* I - HTTP connection */
if (!cgiGetVariable("CURRENT_MAKE"))
cgiSetVariable("CURRENT_MAKE", make);
cgiSetVariable("PPD_MAKE", make);
if (!cgiGetVariable("CURRENT_MAKE_AND_MODEL"))
cgiSetVariable("CURRENT_MAKE_AND_MODEL", uriptr);
@@ -881,7 +990,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
if (isalnum(*uriptr & 255) || *uriptr == '_' || *uriptr == '-' ||
*uriptr == '.')
*tptr++ = *uriptr;
else if ((*uriptr == ' ' || *uriptr == '/') && tptr[-1] != '_')
else if ((*uriptr == ' ' || *uriptr == '/') && tptr > template &&
tptr[-1] != '_')
*tptr++ = '_';
else if (*uriptr == '?' || *uriptr == '(')
break;
@@ -910,31 +1020,28 @@ do_am_printer(http_t *http, /* I - HTTP connection */
}
/*
* Scan for devices for up to 30 seconds, updating the page as we find
* them...
* Scan for devices for up to 30 seconds...
*/
fputs("DEBUG: Getting list of devices...\n", stderr);
last_device_time = 0;
current_device = 0;
if (cupsGetDevices(http, 30, CUPS_INCLUDE_ALL, CUPS_EXCLUDE_NONE,
current_device = 0;
if (cupsGetDevices(http, 5, CUPS_INCLUDE_ALL, CUPS_EXCLUDE_NONE,
(cups_device_cb_t)choose_device_cb,
(void *)title) == IPP_OK)
{
fputs("DEBUG: Got device list!\n", stderr);
if (!cgiSupportsMultipart())
{
/*
* Non-modern browsers that don't support multi-part documents get
* everything at the end...
*/
if (cgiSupportsMultipart())
cgiStartMultipart();
cgiStartHTML(title);
cgiCopyTemplateLang("choose-device.tmpl");
cgiEndHTML();
}
cgiSetVariable("CUPS_GET_DEVICES_DONE", "1");
cgiStartHTML(title);
cgiCopyTemplateLang("choose-device.tmpl");
cgiEndHTML();
if (cgiSupportsMultipart())
cgiEndMultipart();
}
else
{
@@ -955,18 +1062,9 @@ do_am_printer(http_t *http, /* I - HTTP connection */
return;
}
}
/*
* Show the final selection page...
*/
cgiSetVariable("CUPS_GET_DEVICES_DONE", "1");
cgiStartHTML(title);
cgiCopyTemplateLang("choose-device.tmpl");
cgiEndHTML();
cgiEndMultipart();
}
else if (strchr(var, '/') == NULL)
else if (!strchr(var, '/') ||
(!strncmp(var, "lpd://", 6) && !strchr(var + 6, '/')))
{
if ((attr = ippFindAttribute(oldinfo, "device-uri", IPP_TAG_URI)) != NULL)
{
@@ -1030,6 +1128,11 @@ do_am_printer(http_t *http, /* I - HTTP connection */
if ((attr = ippFindAttribute(oldinfo, "printer-location",
IPP_TAG_TEXT)) != NULL)
cgiSetVariable("PRINTER_LOCATION", attr->values[0].string.text);
if ((attr = ippFindAttribute(oldinfo, "printer-is-shared",
IPP_TAG_BOOLEAN)) != NULL)
cgiSetVariable("PRINTER_IS_SHARED",
attr->values[0].boolean ? "1" : "0");
}
cgiCopyTemplateLang("modify-printer.tmpl");
@@ -1137,8 +1240,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, "ipp://localhost/printers/");
if ((var = cgiGetVariable("CURRENT_MAKE")) == NULL)
var = cgiGetVariable("PPD_MAKE");
if ((var = cgiGetVariable("PPD_MAKE")) == NULL)
var = cgiGetVariable("CURRENT_MAKE");
if (var && !cgiGetVariable("SELECT_MAKE"))
{
const char *make_model; /* Make and model */
@@ -1165,7 +1268,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
* Got the list of PPDs, see if the user has selected a make...
*/
if (cgiSetIPPVars(response, NULL, NULL, NULL, 0) == 0)
if (cgiSetIPPVars(response, NULL, NULL, NULL, 0) == 0 && !modify)
{
/*
* No PPD files with this make, try again with all makes...
@@ -1201,8 +1304,11 @@ do_am_printer(http_t *http, /* I - HTTP connection */
*/
cgiStartHTML(title);
cgiSetVariable("CURRENT_MAKE_AND_MODEL",
cgiGetArray("PPD_MAKE_AND_MODEL", 0));
if (!cgiGetVariable("PPD_MAKE"))
cgiSetVariable("PPD_MAKE", cgiGetVariable("CURRENT_MAKE"));
if (!modify)
cgiSetVariable("CURRENT_MAKE_AND_MODEL",
cgiGetArray("PPD_MAKE_AND_MODEL", 0));
cgiCopyTemplateLang("choose-model.tmpl");
cgiEndHTML();
}
@@ -1494,7 +1600,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
#ifdef HAVE_GSSAPI
char default_auth_type[255];
/* DefaultAuthType value */
const char *val; /* Setting value */
const char *val; /* Setting value */
#endif /* HAVE_GSSAPI */
@@ -1566,7 +1672,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
strcat(local_protocols, "slp");
}
#endif /* HAVE_SLP */
if (cgiGetVariable("BROWSE_REMOTE_CUPS"))
strcpy(remote_protocols, "cups");
else
@@ -1819,7 +1925,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
perror(tempfile);
return;
}
@@ -1831,7 +1937,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
perror(tempfile);
close(tempfd);
unlink(tempfile);
@@ -2397,7 +2503,7 @@ do_list_printers(http_t *http) /* I - HTTP connection */
attr;
attr = ippFindNextAttribute(response, "device-uri", IPP_TAG_URI))
{
cupsArrayAdd(printer_devices, strdup(attr->values[0].string.text));
cupsArrayAdd(printer_devices, _cupsStrAlloc(attr->values[0].string.text));
}
/*
@@ -2501,7 +2607,8 @@ do_list_printers(http_t *http) /* I - HTTP connection */
if (isalnum(*ptr & 255) || *ptr == '_' || *ptr == '-' ||
*ptr == '.')
*option_ptr++ = *ptr;
else if ((*ptr == ' ' || *ptr == '/') && option_ptr[-1] != '_')
else if ((*ptr == ' ' || *ptr == '/') && option_ptr > option &&
option_ptr[-1] != '_')
*option_ptr++ = '_';
else if (*ptr == '?' || *ptr == '(')
break;
@@ -2534,7 +2641,7 @@ do_list_printers(http_t *http) /* I - HTTP connection */
for (printer_device = (char *)cupsArrayFirst(printer_devices);
printer_device;
printer_device = (char *)cupsArrayNext(printer_devices))
free(printer_device);
_cupsStrFree(printer_device);
cupsArrayDelete(printer_devices);
}
@@ -2607,7 +2714,9 @@ do_menu(http_t *http) /* I - HTTP connection */
if ((val = cupsGetOption("DefaultAuthType", num_settings,
settings)) != NULL && !strcasecmp(val, "Negotiate"))
cgiSetVariable("KERBEROS", "CHECKED");
else
#endif /* HAVE_GSSAPI */
cgiSetVariable("KERBEROS", "");
#ifdef HAVE_DNSSD
cgiSetVariable("HAVE_DNSSD", "1");
@@ -2973,7 +3082,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
* Add the name...
*/
attr->values[i].string.text = strdup(ptr);
attr->values[i].string.text = _cupsStrAlloc(ptr);
/*
* Advance to the next name...
@@ -3219,11 +3328,16 @@ do_set_options(http_t *http, /* I - HTTP connection */
for (option = ppdFirstOption(ppd);
option;
option = ppdNextOption(ppd))
{
if ((var = cgiGetVariable(option->keyword)) != NULL)
{
have_options = 1;
ppdMarkOption(ppd, option->keyword, var);
fprintf(stderr, "DEBUG: Set %s to %s...\n", option->keyword, var);
}
else
fprintf(stderr, "DEBUG: Didn't find %s...\n", option->keyword);
}
}
if (!have_options || ppdConflicts(ppd))
@@ -3244,7 +3358,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
((ppdattr = ppdFindAttr(ppd, "cupsCommands", NULL)) != NULL &&
ppdattr->value && strstr(ppdattr->value, "AutoConfigure")))
cgiSetVariable("HAVE_AUTOCONFIGURE", "YES");
else
else
{
for (i = 0; i < ppd->num_filters; i ++)
if (!strncmp(ppd->filters[i], "application/vnd.cups-postscript", 31))
@@ -3330,6 +3444,16 @@ do_set_options(http_t *http, /* I - HTTP connection */
{
cgiSetArray("ckeyword", k, option->keyword);
cgiSetArray("ckeytext", k, option->text);
for (m = 0; m < option->num_choices; m ++)
{
if (option->choices[m].marked)
{
cgiSetArray("cchoice", k, option->choices[m].text);
break;
}
}
k ++;
}
@@ -3348,7 +3472,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
cgiSetVariable("GROUP", group->text);
cgiCopyTemplateLang("option-header.tmpl");
for (j = group->num_options, option = group->options;
j > 0;
j --, option ++)
@@ -3992,7 +4116,7 @@ get_option_value(
snprintf(buffer, bufsize, "Custom.%gx%g%s", width, length, uval);
}
else if (cupsArrayCount(coption->params) == 1)
else if (cupsArrayCount(coption->params) == 1)
{
cparam = ppdFirstCustomParam(coption);
snprintf(keyword, sizeof(keyword), "%s.%s", coption->keyword, cparam->name);
+18 -4
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* CGI support library definitions.
* CGI support library definitions for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -33,6 +33,14 @@
# include "help-index.h"
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Types...
*/
@@ -54,17 +62,19 @@ typedef struct cgi_file_s /**** Uploaded file data ****/
extern void cgiAbort(const char *title, const char *stylesheet,
const char *format, ...);
extern int cgiCheckVariables(const char *names);
extern void cgiClearVariables(void);
extern void *cgiCompileSearch(const char *query);
extern void cgiCopyTemplateFile(FILE *out, const char *tmpl);
extern void cgiCopyTemplateLang(const char *tmpl);
extern int cgiDoSearch(void *search, const char *text);
extern void cgiEndHTML(void);
extern void cgiEndMultipart(void);
extern char *cgiFormEncode(char *dst, const char *src, size_t dstsize);
extern char *cgiFormEncode(char *dst, const char *src,
size_t dstsize);
extern void cgiFreeSearch(void *search);
extern const char *cgiGetArray(const char *name, int element);
extern void cgiGetAttributes(ipp_t *request, const char *tmpl);
extern char *cgiGetCookie(const char *name, char *buf, int buflen);
extern const char *cgiGetCookie(const char *name);
extern const cgi_file_t *cgiGetFile(void);
extern cups_array_t *cgiGetIPPObjects(ipp_t *response, void *search);
extern int cgiGetSize(const char *name);
@@ -98,6 +108,10 @@ extern void cgiStartMultipart(void);
extern int cgiSupportsMultipart(void);
extern const char *cgiText(const char *message);
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_CGI_H_ */
/*
+18 -3
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Class status CGI for the Common UNIX Printing System (CUPS).
* Class status CGI for CUPS.
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -72,6 +72,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiSetVariable("SECTION", "classes");
cgiSetVariable("REFRESH_PAGE", "");
/*
* See if we are displaying a printer or all classes...
@@ -146,7 +147,21 @@ main(int argc, /* I - Number of command-line arguments */
}
else if (pclass)
{
if (!strcmp(op, "start-class"))
if (!*op)
{
const char *server_port = getenv("SERVER_PORT");
/* Port number string */
int port = atoi(server_port ? server_port : "0");
/* Port number */
char uri[1024]; /* URL */
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri),
getenv("HTTPS") ? "https" : "http", NULL,
getenv("SERVER_NAME"), port, "/classes/%s", pclass);
printf("Location: %s\n\n", uri);
}
else if (!strcmp(op, "start-class"))
do_class_op(http, pclass, IPP_RESUME_PRINTER, cgiText(_("Resume Class")));
else if (!strcmp(op, "stop-class"))
do_class_op(http, pclass, IPP_PAUSE_PRINTER, cgiText(_("Pause Class")));
+12
Ver Arquivo
@@ -23,6 +23,14 @@
# include <cups/array.h>
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Data structures...
*/
@@ -68,6 +76,10 @@ extern help_index_t *helpSearchIndex(help_index_t *hi, const char *query,
const char *filename);
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_HELP_INDEX_H_ */
/*
+9 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Online help CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -63,6 +63,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiSetVariable("SECTION", "help");
cgiSetVariable("REFRESH_PAGE", "");
/*
* Load the help index...
@@ -102,7 +103,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
for (i = 0; i < argc; i ++)
fprintf(stderr, "argv[%d]=\"%s\"\n", i, argv[i]);
fprintf(stderr, "DEBUG: argv[%d]=\"%s\"\n", i, argv[i]);
if ((helpfile = getenv("PATH_INFO")) != NULL)
{
@@ -182,6 +183,12 @@ main(int argc, /* I - Number of command-line arguments */
topic = cgiGetVariable("TOPIC");
si = helpSearchIndex(hi, query, topic, helpfile);
cgiClearVariables();
if (query)
cgiSetVariable("QUERY", query);
if (topic)
cgiSetVariable("TOPIC", topic);
fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n",
query ? query : "(null)", topic ? topic : "(null)");
+8 -26
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* HTML support functions for the Common UNIX Printing System (CUPS).
* HTML support functions for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -208,31 +208,13 @@ cgiStartMultipart(void)
int /* O - 1 if multi-part supported, 0 otherwise */
cgiSupportsMultipart(void)
{
const char *user_agent; /* User-Agent string */
static int supports_multipart = -1;/* Cached value */
/*
* Too many bug reports for browsers that don't support it, and too much pain
* to whitelist known-good browsers, so for now we just punt on multi-part
* support... :(
*/
if (supports_multipart < 0)
{
/*
* CUPS STR #3049: Apparently some browsers don't support multi-part
* documents, which makes them useless for many web sites. Rather than
* abandoning those users, we'll offer a degraded single-part mode...
*
* Currently we know that anything based on Gecko, MSIE, and Safari all
* work. We'll add more as they are reported/tested.
*/
if ((user_agent = getenv("HTTP_USER_AGENT")) != NULL &&
(strstr(user_agent, " Gecko/") != NULL ||
strstr(user_agent, " MSIE ") != NULL ||
strstr(user_agent, " Safari/") != NULL))
supports_multipart = 1;
else
supports_multipart = 0;
}
return (supports_multipart);
return (0);
}
+40 -15
Ver Arquivo
@@ -285,10 +285,14 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
/*
* See who is logged in...
* Make sure we have a username...
*/
user = getenv("REMOTE_USER");
if ((user = getenv("REMOTE_USER")) == NULL)
{
puts("Status: 401\n");
exit(0);
}
/*
* See if the user has already selected a new destination...
@@ -333,7 +337,7 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
NULL, job_uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "job-printer-uri");
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
if ((attr = ippFindAttribute(response, "job-printer-uri",
@@ -650,7 +654,8 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM);
if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED)
if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED ||
attr->values[0].integer == IPP_JOB_HELD)
{
ippDelete(response);
break;
@@ -925,7 +930,7 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
ishttps ? "https" : "http",
userpass, hostname, port, resource);
else
snprintf(url, urlsize, "%s://%s:%d%s",
snprintf(url, urlsize, "%s://%s:%d%s",
ishttps ? "https" : "http",
hostname, port, resource);
}
@@ -1397,7 +1402,9 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
int ascending, /* Order of jobs (0 = descending) */
first, /* First job to show */
count; /* Number of jobs */
const char *var; /* Form variable */
const char *var, /* Form variable */
*query, /* Query string */
*section; /* Section in web interface */
void *search; /* Search data */
char url[1024], /* Printer URI */
val[1024]; /* Form variable */
@@ -1441,11 +1448,14 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL &&
if ((query = cgiGetVariable("QUERY")) != NULL &&
!cgiGetVariable("CLEAR"))
search = cgiCompileSearch(var);
search = cgiCompileSearch(query);
else
{
query = NULL;
search = NULL;
}
jobs = cgiGetIPPObjects(response, search);
count = cupsArrayCount(jobs);
@@ -1470,16 +1480,27 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
if (first < 0)
first = 0;
sprintf(val, "%d", count);
cgiSetVariable("TOTAL", val);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
else
{
ascending = !which_jobs || !strcasecmp(which_jobs, "not-completed");
cgiSetVariable("ORDER", ascending ? "asc" : "dec");
}
section = cgiGetVariable("SECTION");
cgiClearVariables();
if (query)
cgiSetVariable("QUERY", query);
cgiSetVariable("ORDER", ascending ? "asc" : "dec");
cgiSetVariable("SECTION", section);
sprintf(val, "%d", count);
cgiSetVariable("TOTAL", val);
if (which_jobs)
cgiSetVariable("WHICH_JOBS", which_jobs);
if (ascending)
{
@@ -1501,7 +1522,11 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
*/
if (dest)
snprintf(val, sizeof(val), "/%s/%s", cgiGetVariable("SECTION"), dest);
{
snprintf(val, sizeof(val), "/%s/%s", section, dest);
cgiSetVariable("PRINTER_NAME", dest);
cgiSetVariable("PRINTER_URI_SUPPORTED", val);
}
else
strlcpy(val, "/jobs/", sizeof(val));
+1
Ver Arquivo
@@ -57,6 +57,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiSetVariable("SECTION", "jobs");
cgiSetVariable("REFRESH_PAGE", "");
/*
* Connect to the HTTP server...
+3
Ver Arquivo
@@ -1,4 +1,5 @@
_cgiCheckVariables
_cgiClearVariables
_cgiCompileSearch
_cgiCopyTemplateFile
_cgiCopyTemplateLang
@@ -9,6 +10,7 @@ _cgiFormEncode
_cgiFreeSearch
_cgiGetArray
_cgiGetAttributes
_cgiGetCookie
_cgiGetFile
_cgiGetIPPObjects
_cgiGetSize
@@ -23,6 +25,7 @@ _cgiRewriteURL
_cgiSetArray
_cgiSetIPPObjectVars
_cgiSetIPPVars
_cgiSetCookie
_cgiSetServerVersion
_cgiSetSize
_cgiSetVariable
+12 -4
Ver Arquivo
@@ -357,7 +357,7 @@ write_index(const char *path, /* I - File to write */
static void
write_info(const char *path, /* I - File to write */
const char *revision) /* I - Version number */
const char *revision) /* I - Subversion revision number */
{
cups_file_t *fp; /* File */
@@ -379,14 +379,22 @@ write_info(const char *path, /* I - File to write */
"\t<key>CFBundleName</key>\n"
"\t<string>CUPS Documentation</string>\n"
"\t<key>CFBundleVersion</key>\n"
"\t<string>1.4.%s</string>\n"
"\t<string>%d.%d.%s</string>\n"
"\t<key>CFBundleShortVersionString</key>\n"
"\t<string>%d.%d.%d</string>\n"
"\t<key>DocSetFeedName</key>\n"
"\t<string>cups.org</string>\n"
"\t<key>DocSetFeedURL</key>\n"
"\t<string>http://www.cups.org/org.cups.docset.xar"
"\t<string>http://www.cups.org/org.cups.docset.atom"
"</string>\n"
"\t<key>DocSetPublisherIdentifier</key>\n"
"\t<string>org.cups</string>\n"
"\t<key>DocSetPublisherName</key>\n"
"\t<string>CUPS</string>\n"
"</dict>\n"
"</plist>\n", revision);
"</plist>\n",
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, revision,
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, CUPS_VERSION_PATCH);
cupsFileClose(fp);
}
+18 -3
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Printer status CGI for the Common UNIX Printing System (CUPS).
* Printer status CGI for CUPS.
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -73,6 +73,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiSetVariable("SECTION", "printers");
cgiSetVariable("REFRESH_PAGE", "");
/*
* See if we are displaying a printer or all printers...
@@ -147,7 +148,21 @@ main(int argc, /* I - Number of command-line arguments */
}
else if (printer)
{
if (!strcmp(op, "start-printer"))
if (!*op)
{
const char *server_port = getenv("SERVER_PORT");
/* Port number string */
int port = atoi(server_port ? server_port : "0");
/* Port number */
char uri[1024]; /* URL */
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri),
getenv("HTTPS") ? "https" : "http", NULL,
getenv("SERVER_NAME"), port, "/printers/%s", printer);
printf("Location: %s\n\n", uri);
}
else if (!strcmp(op, "start-printer"))
do_printer_op(http, printer, IPP_RESUME_PRINTER,
cgiText(_("Resume Printer")));
else if (!strcmp(op, "stop-printer"))
+27 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI template function.
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -119,7 +119,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
*locptr = '\0'; /* Strip charset */
}
fprintf(stderr, "DEBUG: lang=\"%s\", locale=\"%s\"...\n",
fprintf(stderr, "DEBUG2: lang=\"%s\", locale=\"%s\"...\n",
lang ? lang : "(null)", locale);
/*
@@ -369,6 +369,20 @@ cgi_copy(FILE *out, /* I - Output file */
continue;
}
else if (name[0] == '$')
{
/*
* Insert cookie value or nothing if not defined.
*/
if ((value = cgiGetCookie(name + 1)) != NULL)
outptr = value;
else
{
outval[0] = '\0';
outptr = outval;
}
}
else
{
/*
@@ -437,7 +451,14 @@ cgi_copy(FILE *out, /* I - Output file */
* Test for existance...
*/
result = cgiGetArray(name, element) != NULL && outptr[0];
if (name[0] == '?')
result = cgiGetArray(name + 1, element) != NULL;
else if (name[0] == '#')
result = cgiGetVariable(name + 1) != NULL;
else
result = cgiGetArray(name, element) != NULL;
result = result && outptr[0];
compare[0] = '\0';
}
else
@@ -675,6 +696,8 @@ cgi_puts(const char *s, /* I - String to output */
fputs("&gt;", out);
else if (*s == '\"')
fputs("&quot;", out);
else if (*s == '\'')
fputs("&#39;", out);
else if (*s == '&')
fputs("&amp;", out);
else
@@ -695,7 +718,7 @@ cgi_puturi(const char *s, /* I - String to output */
{
while (*s)
{
if (strchr("%&+ <>#=", *s) || *s & 128)
if (strchr("%@&+ <>#=", *s) || *s < ' ' || *s & 128)
fprintf(out, "%%%02X", *s & 255);
else
putc(*s, out);
+287 -33
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* CGI form variable and array functions.
* CGI form variable and array functions for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -14,24 +14,34 @@
*
* Contents:
*
* cgiCheckVariables() - Check for the presence of "required" variables.
* cgiGetArray() - Get an element from a form array...
* cgiGetFile() - Get the file (if any) that was submitted in the form.
* cgiCheckVariables() - Check for the presence of "required"
* variables.
* cgiClearVariables() - Clear all form variables.
* cgiGetArray() - Get an element from a form array.
* cgiGetCookie() - Get a cookie value.
* cgiGetFile() - Get the file (if any) that was submitted in
* the form.
* cgiGetSize() - Get the size of a form array value.
* cgiGetVariable() - Get a CGI variable from the database...
* cgiInitialize() - Initialize the CGI variable "database"...
* cgiGetVariable() - Get a CGI variable from the database.
* cgiInitialize() - Initialize the CGI variable "database".
* cgiIsPOST() - Determine whether this page was POSTed.
* cgiSetArray() - Set array element N to the specified string.
* cgiSetCookie() - Set a cookie value.
* cgiSetSize() - Set the array size.
* cgiSetVariable() - Set a CGI variable in the database...
* cgiSetVariable() - Set a CGI variable in the database.
* cgi_add_variable() - Add a form variable.
* cgi_compare_variables() - Compare two variables.
* cgi_find_variable() - Find a variable...
* cgi_initialize_get() - Initialize form variables using the GET method.
* cgi_initialize_multipart() - Initialize variables and file using the POST method.
* cgi_find_variable() - Find a variable.
* cgi_initialize_cookies() - Initialize cookies.
* cgi_initialize_get() - Initialize form variables using the GET
* method.
* cgi_initialize_multipart() - Initialize variables and file using the POST
* method.
* cgi_initialize_post() - Initialize variables using the POST method.
* cgi_initialize_string() - Initialize form variables from a string.
* cgi_passwd() - Catch authentication requests and notify the server.
* cgi_passwd() - Catch authentication requests and notify the
* server.
* cgi_set_sid() - Set the CUPS session ID.
* cgi_sort_variables() - Sort all form variables for faster lookup.
* cgi_unlink_file() - Remove the uploaded form.
*/
@@ -39,6 +49,15 @@
/*#define DEBUG*/
#include "cgi-private.h"
#include <errno.h>
#include <cups/http.h>
#include <cups/md5.h>
/*
* Session ID name
*/
#define CUPS_SID "org.cups.sid"
/*
@@ -58,6 +77,8 @@ typedef struct /**** Form variable structure ****/
* Local globals...
*/
static int num_cookies = 0;/* Number of cookies */
static cups_option_t *cookies = NULL;/* Cookies */
static int form_count = 0, /* Form variable count */
form_alloc = 0; /* Number of variables allocated */
static _cgi_var_t *form_vars = NULL;
@@ -75,11 +96,13 @@ static void cgi_add_variable(const char *name, int element,
static int cgi_compare_variables(const _cgi_var_t *v1,
const _cgi_var_t *v2);
static _cgi_var_t *cgi_find_variable(const char *name);
static void cgi_initialize_cookies(void);
static int cgi_initialize_get(void);
static int cgi_initialize_multipart(const char *boundary);
static int cgi_initialize_post(void);
static int cgi_initialize_string(const char *data);
static const char *cgi_passwd(const char *prompt);
static const char *cgi_set_sid(void);
static void cgi_sort_variables(void);
static void cgi_unlink_file(void);
@@ -135,7 +158,32 @@ cgiCheckVariables(const char *names) /* I - Variables to look for */
/*
* 'cgiGetArray()' - Get an element from a form array...
* 'cgiClearVariables()' - Clear all form variables.
*/
void
cgiClearVariables(void)
{
int i, j; /* Looping vars */
_cgi_var_t *v; /* Current variable */
for (v = form_vars, i = form_count; i > 0; v ++, i --)
{
_cupsStrFree(v->name);
for (j = 0; j < v->nvalues; j ++)
if (v->values[j])
_cupsStrFree(v->values[j]);
}
form_count = 0;
cgi_unlink_file();
}
/*
* 'cgiGetArray()' - Get an element from a form array.
*/
const char * /* O - Element value or NULL */
@@ -151,7 +199,18 @@ cgiGetArray(const char *name, /* I - Name of array variable */
if (element < 0 || element >= var->nvalues)
return (NULL);
return (var->values[element]);
return (_cupsStrRetain(var->values[element]));
}
/*
* 'cgiGetCookie()' - Get a cookie value.
*/
const char * /* O - Value or NULL */
cgiGetCookie(const char *name) /* I - Name of cookie */
{
return (cupsGetOption(name, num_cookies, cookies));
}
@@ -184,10 +243,10 @@ cgiGetSize(const char *name) /* I - Name of variable */
/*
* 'cgiGetVariable()' - Get a CGI variable from the database...
* 'cgiGetVariable()' - Get a CGI variable from the database.
*
* Returns NULL if the variable doesn't exist. If the variable is an
* array of values, returns the last element...
* array of values, returns the last element.
*/
const char * /* O - Value of variable */
@@ -206,19 +265,21 @@ cgiGetVariable(const char *name) /* I - Name of variable */
var->values[var->nvalues - 1]));
#endif /* DEBUG */
return ((var == NULL) ? NULL : var->values[var->nvalues - 1]);
return ((var == NULL) ? NULL : _cupsStrRetain(var->values[var->nvalues - 1]));
}
/*
* 'cgiInitialize()' - Initialize the CGI variable "database"...
* 'cgiInitialize()' - Initialize the CGI variable "database".
*/
int /* O - Non-zero if there was form data */
cgiInitialize(void)
{
const char *method; /* Form posting method */
const char *content_type; /* Content-Type of post data */
const char *method, /* Form posting method */
*content_type, /* Content-Type of post data */
*cups_sid_cookie, /* SID cookie */
*cups_sid_form; /* SID form variable */
/*
@@ -241,6 +302,20 @@ cgiInitialize(void)
setbuf(stdout, NULL);
#endif /* DEBUG */
/*
* Get cookies...
*/
cgi_initialize_cookies();
if ((cups_sid_cookie = cgiGetCookie(CUPS_SID)) == NULL)
{
fputs("DEBUG: " CUPS_SID " cookie not found, initializing!\n", stderr);
cups_sid_cookie = cgi_set_sid();
}
fprintf(stderr, "DEBUG: " CUPS_SID " cookie is \"%s\"\n", cups_sid_cookie);
/*
* Get the request method (GET or POST)...
*/
@@ -264,9 +339,27 @@ cgiInitialize(void)
boundary += 9;
if (content_type && !strncmp(content_type, "multipart/form-data; ", 21))
return (cgi_initialize_multipart(boundary));
{
if (!cgi_initialize_multipart(boundary))
return (0);
}
else if (!cgi_initialize_post())
return (0);
if ((cups_sid_form = cgiGetVariable(CUPS_SID)) == NULL ||
strcmp(cups_sid_cookie, cups_sid_form))
{
if (cups_sid_form)
fprintf(stderr, "DEBUG: " CUPS_SID " form variable is \"%s\"\n",
cups_sid_form);
else
fputs("DEBUG: " CUPS_SID " form variable is not present.\n", stderr);
cgiClearVariables();
return (0);
}
else
return (cgi_initialize_post());
return (1);
}
else
return (0);
@@ -337,13 +430,45 @@ cgiSetArray(const char *name, /* I - Name of variable */
var->nvalues = element + 1;
}
else if (var->values[element])
free((char *)var->values[element]);
_cupsStrFree((char *)var->values[element]);
var->values[element] = strdup(value);
var->values[element] = _cupsStrAlloc(value);
}
}
/*
* 'cgiSetCookie()' - Set a cookie value.
*/
void
cgiSetCookie(const char *name, /* I - Name */
const char *value, /* I - Value */
const char *path, /* I - Path (typically "/") */
const char *domain, /* I - Domain name */
time_t expires, /* I - Expiration date (0 for session) */
int secure) /* I - Require SSL */
{
num_cookies = cupsAddOption(name, value, num_cookies, &cookies);
printf("Set-Cookie: %s=%s;", name, value);
if (path)
printf("; path=%s", path);
if (domain)
printf("; domain=%s", domain);
if (expires)
{
char date[256]; /* Date string */
printf("; expires=%s", httpGetDateString2(expires, date, sizeof(date)));
}
if (secure)
puts("; secure;");
else
puts(";");
}
/*
* 'cgiSetSize()' - Set the array size.
*/
@@ -384,7 +509,7 @@ cgiSetSize(const char *name, /* I - Name of variable */
{
for (i = size; i < var->nvalues; i ++)
if (var->values[i])
free((void *)(var->values[i]));
_cupsStrFree((void *)(var->values[i]));
}
var->nvalues = size;
@@ -392,7 +517,7 @@ cgiSetSize(const char *name, /* I - Name of variable */
/*
* 'cgiSetVariable()' - Set a CGI variable in the database...
* 'cgiSetVariable()' - Set a CGI variable in the database.
*
* If the variable is an array, this truncates the array to a single element.
*/
@@ -417,9 +542,9 @@ cgiSetVariable(const char *name, /* I - Name of variable */
{
for (i = 0; i < var->nvalues; i ++)
if (var->values[i])
free((char *)var->values[i]);
_cupsStrFree((char *)var->values[i]);
var->values[0] = strdup(value);
var->values[0] = _cupsStrAlloc(value);
var->nvalues = 1;
}
}
@@ -465,10 +590,10 @@ cgi_add_variable(const char *name, /* I - Variable name */
if ((var->values = calloc(element + 1, sizeof(char *))) == NULL)
return;
var->name = strdup(name);
var->name = _cupsStrAlloc(name);
var->nvalues = element + 1;
var->avalues = element + 1;
var->values[element] = strdup(value);
var->values[element] = _cupsStrAlloc(value);
form_count ++;
}
@@ -488,7 +613,7 @@ cgi_compare_variables(
/*
* 'cgi_find_variable()' - Find a variable...
* 'cgi_find_variable()' - Find a variable.
*/
static _cgi_var_t * /* O - Variable pointer or NULL */
@@ -507,6 +632,91 @@ cgi_find_variable(const char *name) /* I - Name of variable */
}
/*
* 'cgi_initialize_cookies()' - Initialize cookies.
*/
static void
cgi_initialize_cookies(void)
{
const char *cookie; /* HTTP_COOKIE environment variable */
char name[128], /* Name string */
value[512], /* Value string */
*ptr; /* Pointer into name/value */
if ((cookie = getenv("HTTP_COOKIE")) == NULL)
return;
while (*cookie)
{
/*
* Skip leading whitespace...
*/
while (isspace(*cookie & 255))
cookie ++;
if (!*cookie)
break;
/*
* Copy the name...
*/
for (ptr = name; *cookie && *cookie != '=';)
if (ptr < (name + sizeof(name) - 1))
*ptr++ = *cookie++;
else
break;
if (*cookie != '=')
break;
*ptr = '\0';
cookie ++;
/*
* Then the value...
*/
if (*cookie == '\"')
{
for (cookie ++, ptr = value; *cookie && *cookie != '\"';)
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *cookie++;
else
break;
if (*cookie == '\"')
cookie ++;
}
else
{
for (ptr = value; *cookie && *cookie != ';';)
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *cookie++;
else
break;
}
if (*cookie == ';')
cookie ++;
else if (*cookie)
break;
*ptr = '\0';
/*
* Then add the cookie to an array as long as the name doesn't start with
* "$"...
*/
if (name[0] != '$')
num_cookies = cupsAddOption(name, value, num_cookies, &cookies);
}
}
/*
* 'cgi_initialize_get()' - Initialize form variables using the GET method.
*/
@@ -536,7 +746,8 @@ cgi_initialize_get(void)
/*
* 'cgi_initialize_multipart()' - Initialize variables and file using the POST method.
* 'cgi_initialize_multipart()' - Initialize variables and file using the POST
* method.
*
* TODO: Update to support files > 2GB.
*/
@@ -848,7 +1059,7 @@ cgi_initialize_string(const char *data) /* I - Form data string */
char *s, /* Pointer to current form string */
ch, /* Temporary character */
name[255], /* Name of form variable */
value[65536]; /* Variable value... */
value[65536]; /* Variable value */
/*
@@ -901,6 +1112,9 @@ cgi_initialize_string(const char *data) /* I - Form data string */
* Read the hex code...
*/
if (!isxdigit(data[1] & 255) || !isxdigit(data[2] & 255))
return (0);
if (s < (value + sizeof(value) - 1))
{
data ++;
@@ -988,6 +1202,46 @@ cgi_passwd(const char *prompt) /* I - Prompt (not used) */
}
/*
* 'cgi_set_sid()' - Set the CUPS session ID.
*/
static const char * /* O - New session ID */
cgi_set_sid(void)
{
char buffer[512], /* SID data */
sid[33]; /* SID string */
_cups_md5_state_t md5; /* MD5 state */
unsigned char sum[16]; /* MD5 sum */
const char *remote_addr, /* REMOTE_ADDR */
*server_name, /* SERVER_NAME */
*server_port; /* SERVER_PORT */
if ((remote_addr = getenv("REMOTE_ADDR")) == NULL)
remote_addr = "REMOTE_ADDR";
if ((server_name = getenv("SERVER_NAME")) == NULL)
server_name = "SERVER_NAME";
if ((server_port = getenv("SERVER_PORT")) == NULL)
server_port = "SERVER_PORT";
CUPS_SRAND(time(NULL));
snprintf(buffer, sizeof(buffer), "%s:%s:%s:%02X%02X%02X%02X%02X%02X%02X%02X",
remote_addr, server_name, server_port,
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255,
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255,
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255,
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255);
_cupsMD5Init(&md5);
_cupsMD5Append(&md5, (unsigned char *)buffer, (int)strlen(buffer));
_cupsMD5Finish(&md5, sum);
cgiSetCookie(CUPS_SID, httpMD5String(sum, sid), "/", NULL, 0, 0);
return (cupsGetOption(CUPS_SID, num_cookies, cookies));
}
/*
* 'cgi_sort_variables()' - Sort all form variables for faster lookup.
*/
+15 -8
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Web search program for www.cups.org.
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -33,7 +33,8 @@
* Local functions...
*/
static void list_nodes(const char *title, cups_array_t *nodes);
static void list_nodes(help_index_t *hi, const char *title,
cups_array_t *nodes);
/*
@@ -69,7 +70,7 @@ main(int argc, /* I - Number of command-line args */
search = helpSearchIndex(hi, argv[2], NULL, NULL);
if (search)
list_nodes(argv[1], search->sorted);
list_nodes(hi, argv[1], search->sorted);
/*
* Return with no errors...
@@ -84,10 +85,12 @@ main(int argc, /* I - Number of command-line args */
*/
static void
list_nodes(const char *title, /* I - Title string */
list_nodes(help_index_t *hi, /* I - Help index */
const char *title, /* I - Title string */
cups_array_t *nodes) /* I - Nodes */
{
help_node_t *node; /* Current node */
help_node_t *node, /* Current node */
*file; /* File node */
printf("%d\n", cupsArrayCount(nodes));
@@ -96,10 +99,14 @@ list_nodes(const char *title, /* I - Title string */
node = (help_node_t *)cupsArrayNext(nodes))
{
if (node->anchor)
printf("%d|%s#%s|%s\n", node->score, node->filename, node->anchor,
node->text);
{
file = helpFindNode(hi, node->filename, NULL);
printf("%d|%s#%s|%s|%s\n", node->score, node->filename, node->anchor,
node->text, file ? file->text : node->filename);
}
else
printf("%d|%s|%s\n", node->score, node->filename, node->text);
printf("%d|%s|%s|%s\n", node->score, node->filename, node->text,
node->text);
}
}
+1 -1
Ver Arquivo
@@ -90,7 +90,7 @@ install-data:
done
-if test x$(PAMDIR) != x; then \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(PAMDIR); \
if test -r $(BUILDROOT)$(PAMDIR)/cups/$(PAMFILE) ; then \
if test -r $(BUILDROOT)$(PAMDIR)/cups ; then \
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups.N ; \
else \
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups ; \
+7 -4
Ver Arquivo
@@ -1,9 +1,8 @@
#
# "$Id$"
#
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler. See "man cupsd.conf" for a complete description of this
# file.
# Sample configuration file for the CUPS scheduler. See "man cupsd.conf" for a
# complete description of this file.
#
# Log general information in error_log - change "@CUPS_LOG_LEVEL@" to "debug"
@@ -47,6 +46,10 @@ DefaultAuthType Basic
# Set the default printer/job policies...
<Policy default>
# Job-related operations must be done by the owner or an administrator...
<Limit Create-Job Print-Job Print-URI Validate-Job>
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>
Require user @OWNER @SYSTEM
Order deny,allow
@@ -80,7 +83,7 @@ DefaultAuthType Basic
# Set the authenticated printer/job policies...
<Policy authenticated>
# Job-related operations must be done by the owner or an administrator...
<Limit Create-Job Print-Job Print-URI>
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Default
Order deny,allow
</Limit>
+3 -2
Ver Arquivo
@@ -7,7 +7,7 @@
#
# MIME converts file for the Common UNIX Printing System (CUPS).
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -38,7 +38,7 @@
# PostScript filters
#
application/pdf application/postscript 33 pdftops
application/pdf application/vnd.cups-postscript 66 pdftops
application/postscript application/vnd.cups-postscript 66 pstops
application/vnd.hp-HPGL application/postscript 66 hpgltops
application/x-cshell application/postscript 33 texttops
@@ -46,6 +46,7 @@ application/x-csource application/postscript 33 texttops
application/x-perl application/postscript 33 texttops
application/x-shell application/postscript 33 texttops
text/plain application/postscript 33 texttops
text/css application/postscript 33 texttops
text/html application/postscript 33 texttops
image/gif application/vnd.cups-postscript 66 imagetops
image/png application/vnd.cups-postscript 66 imagetops
+4 -4
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: mime.types 8652 2009-05-16 23:48:35Z mike $"
# "$Id: mime.types 8783 2009-08-28 17:51:05Z mike $"
#
# MIME types file for the Common UNIX Printing System (CUPS).
#
@@ -95,7 +95,7 @@ application/vnd.hp-HPGL hpgl \
image/gif gif string(0,GIF87a) string(0,GIF89a)
image/png png string(0,<89>PNG)
image/jpeg jpeg jpg jpe string(0,<FFD8FF>) &&\
image/jpeg jpeg jpg jpe string(0,<FFD8FF>) +\
(char(3,0xe0) char(3,0xe1) char(3,0xe2) char(3,0xe3)\
char(3,0xe4) char(3,0xe5) char(3,0xe6) char(3,0xe7)\
char(3,0xe8) char(3,0xe9) char(3,0xea) char(3,0xeb)\
@@ -114,7 +114,7 @@ image/x-sun-raster ras string(0,<59a66a95>)
#image/fpx fpx
image/x-alias pix short(8,8) short(8,24)
image/x-bitmap bmp string(0,BM) && !printable(2,14)
image/x-bitmap bmp string(0,BM) + !printable(2,14)
image/x-icon ico
########################################################################
@@ -177,5 +177,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
application/octet-stream
#
# End of "$Id: mime.types 8652 2009-05-16 23:48:35Z mike $".
# End of "$Id: mime.types 8783 2009-08-28 17:51:05Z mike $".
#
-3
Ver Arquivo
@@ -1,3 +0,0 @@
#%PAM-1.0
auth required pam_unix.so shadow nodelay nullok
account required pam_unix.so
+1 -1
Ver Arquivo
@@ -1,2 +1,2 @@
auth required @PAMMOD@ nullok shadow
auth required @PAMMODAUTH@
account required @PAMMOD@
+1 -1
Ver Arquivo
@@ -1,7 +1,7 @@
#
# "$Id$"
#
# Sample SNMP configuration file for CUPS. See "man cups-smnp.conf" for a
# Sample SNMP configuration file for CUPS. See "man cups-snmp.conf" for a
# complete description of this file.
#
+48 -34
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-common.m4 8613 2009-05-11 22:39:39Z mike $"
dnl "$Id: cups-common.m4 9853 2011-07-06 20:27:31Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl Common configuration stuff for CUPS.
dnl
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2007-2011 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,7 +20,7 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number information...
CUPS_VERSION="1.4b3"
CUPS_VERSION="1.4.8"
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'`"
@@ -49,6 +49,7 @@ AC_PROG_CPP
AC_PROG_CXX
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(CHMOD,chmod)
AC_PATH_PROG(HTMLDOC,htmldoc)
AC_PATH_PROG(LD,ld)
AC_PATH_PROG(LN,ln)
@@ -87,6 +88,9 @@ fi
AC_SUBST(INSTALLSTATIC)
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(crypt, crypt)
AC_SEARCH_LIBS(getspent, sec gen)
@@ -132,6 +136,13 @@ AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
dnl Checks for statfs and its many headers...
AC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H))
AC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H))
AC_CHECK_HEADER(sys/statvfs.h,AC_DEFINE(HAVE_SYS_STATVFS_H))
AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H))
AC_CHECK_FUNCS(statfs statvfs)
dnl Checks for string functions.
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
@@ -141,10 +152,7 @@ else
fi
dnl Check for random number functions...
AC_CHECK_FUNCS(random mrand48 lrand48)
dnl Checks for mkstemp and mkstemps functions.
AC_CHECK_FUNCS(mkstemp mkstemps)
AC_CHECK_FUNCS(random lrand48 arc4random)
dnl Check for geteuid function.
AC_CHECK_FUNCS(geteuid)
@@ -176,6 +184,14 @@ AC_TRY_COMPILE([#include <time.h>],[struct tm t;
AC_DEFINE(HAVE_TM_GMTOFF),
AC_MSG_RESULT(no))
dnl See if the stat structure has the st_gen member...
AC_MSG_CHECKING(for st_gen member in stat structure)
AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat t;
int o = t.st_gen;],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ST_GEN),
AC_MSG_RESULT(no))
dnl See if we have the removefile(3) function for securely removing files
AC_CHECK_FUNCS(removefile)
@@ -194,7 +210,7 @@ else
fi
if test $check_libusb = yes; then
AC_CHECK_LIB(usb, usb_init,[
AC_CHECK_LIB(usb, usb_get_string_simple,[
AC_CHECK_HEADER(usb.h,
AC_DEFINE(HAVE_USB_H)
LIBUSB="-lusb")])
@@ -255,27 +271,22 @@ AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory
DBUS_NOTIFIER=""
DBUS_NOTIFIERLIBS=""
if test "x$enable_dbus" != xno; then
AC_PATH_PROG(PKGCONFIG, pkg-config)
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for DBUS)
if $PKGCONFIG --exists dbus-1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DBUS)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
AC_CHECK_LIB(dbus-1,
dbus_message_iter_init_append,
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND),,
`$PKGCONFIG --libs dbus-1`)
if $PKGCONFIG --exists glib-2.0 && $PKGCONFIG --exists dbus-glib-1; then
DBUS_NOTIFIER="dbus"
DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs glib-2.0` `$PKGCONFIG --libs dbus-glib-1` `$PKGCONFIG --libs dbus-1`"
CFLAGS="$CFLAGS `$PKGCONFIG --cflags glib-2.0`"
fi
else
AC_MSG_RESULT(no)
fi
if test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for DBUS)
if $PKGCONFIG --exists dbus-1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DBUS)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
DBUS_NOTIFIER="dbus"
DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs dbus-1`"
SAVELIBS="$LIBS"
LIBS="$LIBS $DBUS_NOTIFIERLIBS"
AC_CHECK_FUNC(dbus_message_iter_init_append,
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
LIBS="$SAVELIBS"
else
AC_MSG_RESULT(no)
fi
fi
@@ -291,17 +302,20 @@ LEGACY_BACKENDS="parallel scsi"
case $uname in
Darwin*)
# FONTS=""
LEGACY_BACKENDS=""
BACKLIBS="$BACKLIBS -framework IOKit"
CUPSDLIBS="$CUPSDLIBS -sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration -weak_framework ApplicationServices"
LIBS="-framework SystemConfiguration -framework CoreFoundation $LIBS"
LIBS="-framework SystemConfiguration -framework CoreFoundation -framework Security $LIBS"
dnl Check for framework headers...
AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h,AC_DEFINE(HAVE_APPLICATIONSERVICES_H))
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
dnl Check for dynamic store function...
AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName)
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))
@@ -324,7 +338,7 @@ case $uname in
AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
default_operkey="$withval",
default_operkey="default")
AC_CHECK_HEADER(Security/Authorization.h, [
AC_DEFINE(HAVE_AUTHORIZATION_H)
@@ -357,5 +371,5 @@ AC_SUBST(FONTS)
AC_SUBST(LEGACY_BACKENDS)
dnl
dnl End of "$Id: cups-common.m4 8613 2009-05-11 22:39:39Z mike $".
dnl End of "$Id: cups-common.m4 9853 2011-07-06 20:27:31Z mike $".
dnl
+15 -8
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-compiler.m4 8655 2009-05-17 00:13:47Z mike $"
dnl "$Id: cups-compiler.m4 9822 2011-06-10 22:59:36Z mike $"
dnl
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -146,15 +146,22 @@ if test -n "$GCC"; then
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
# The -pie option is available with some versions of GCC and adds
# The -fPIE option is available with some versions of GCC and adds
# randomization of addresses, which avoids another class of exploits
# that depend on a fixed address for common functions.
AC_MSG_CHECKING(if GCC supports -pie)
AC_MSG_CHECKING(if GCC supports -fPIE)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -pie -fPIE"
CFLAGS="$CFLAGS -fPIE"
AC_TRY_COMPILE(,,
PIEFLAGS="-pie -fPIE"
AC_MSG_RESULT(yes),
[case "$CC" in
*clang)
PIEFLAGS="-fPIE -Wl,-pie"
;;
*)
PIEFLAGS="-fPIE -pie"
;;
esac
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
@@ -175,7 +182,7 @@ if test -n "$GCC"; then
# checking, basically wrapping all string functions
# with buffer-limited ones. Not strictly needed for
# CUPS since we already use buffer-limited calls, but
# this will catch any additions that are broken.
# this will catch any additions that are broken.
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
if test x$enable_pie = xyes; then
@@ -563,5 +570,5 @@ case $uname in
esac
dnl
dnl End of "$Id: cups-compiler.m4 8655 2009-05-17 00:13:47Z mike $".
dnl End of "$Id: cups-compiler.m4 9822 2011-06-10 22:59:36Z mike $".
dnl
+18 -5
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-defaults.m4 8344 2009-02-10 17:05:35Z mike $"
dnl "$Id: cups-defaults.m4 8929 2009-12-15 22:40:37Z mike $"
dnl
dnl Default cupsd configuration settings for the Common UNIX Printing System
dnl (CUPS).
@@ -208,6 +208,10 @@ AC_ARG_WITH(cups_user, [ --with-cups-user set default user for CUPS],
AC_MSG_RESULT(no password file, using "$CUPS_USER")
fi)
if test "x$CUPS_USER" = "xroot" -o "x$CUPS_USER" = "x0"; then
AC_MSG_ERROR([The default user for CUPS cannot be root!])
fi
AC_ARG_WITH(cups_group, [ --with-cups-group set default group for CUPS],
CUPS_GROUP="$withval",
AC_MSG_CHECKING(for default print group)
@@ -238,6 +242,10 @@ AC_ARG_WITH(cups_group, [ --with-cups-group set default group for CUPS],
AC_MSG_RESULT(no group file, using "$CUPS_GROUP")
fi)
if test "x$CUPS_GROUP" = "xroot" -o "x$CUPS_GROUP" = "xwheel" -o "x$CUPS_GROUP" = "x0"; then
AC_MSG_ERROR([The default group for CUPS cannot be root!])
fi
AC_ARG_WITH(system_groups, [ --with-system-groups set default system groups for CUPS],
CUPS_SYSTEM_GROUPS="$withval",
if test x$uname = xDarwin; then
@@ -269,9 +277,14 @@ AC_ARG_WITH(system_groups, [ --with-system-groups set default system groups
fi
fi)
CUPS_PRIMARY_SYSTEM_GROUP="`echo $CUPS_SYSTEM_GROUPS | awk '{print $1}'`"
for group in $CUPS_SYSTEM_GROUPS; do
if test "x$CUPS_GROUP" = "x$group"; then
AC_MSG_ERROR([The default system groups cannot contain the default CUPS group!])
fi
done
AC_SUBST(CUPS_USER)
AC_SUBST(CUPS_GROUP)
AC_SUBST(CUPS_SYSTEM_GROUPS)
@@ -325,8 +338,8 @@ if test x$default_lpdconfigfile != xno; then
CUPS_DEFAULT_LPD_CONFIG_FILE="launchd:///System/Library/LaunchDaemons/org.cups.cups-lpd.plist"
;;
*)
if test -d /etc/xinetd.d; then
CUPS_DEFAULT_LPD_CONFIG_FILE="xinetd:///etc/xinetd.d/cups-lpd"
if test "x$XINETD" != x; then
CUPS_DEFAULT_LPD_CONFIG_FILE="xinetd://$XINETD/cups-lpd"
else
CUPS_DEFAULT_LPD_CONFIG_FILE=""
fi
@@ -435,5 +448,5 @@ AC_SUBST(BANNERTOPS)
AC_SUBST(TEXTTOPS)
dnl
dnl End of "$Id: cups-defaults.m4 8344 2009-02-10 17:05:35Z mike $".
dnl End of "$Id: cups-defaults.m4 8929 2009-12-15 22:40:37Z mike $".
dnl
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-dnssd.m4 8344 2009-02-10 17:05:35Z mike $"
dnl "$Id: cups-dnssd.m4 8789 2009-08-28 22:54:34Z mike $"
dnl
dnl DNS Service Discovery (aka Bonjour) stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -43,7 +43,7 @@ if test x$enable_dnssd != xno; then
AC_MSG_CHECKING(for current version of dns_sd library)
SAVELIBS="$LIBS"
LIBS="$LIBS -ldns_sd"
AC_TRY_COMPILE([#include <dns_sd.h],
AC_TRY_COMPILE([#include <dns_sd.h>],
[int constant = kDNSServiceFlagsShareConnection;
unsigned char txtRecord[100];
uint8_t valueLen;
@@ -64,5 +64,5 @@ AC_SUBST(DNSSDLIBS)
AC_SUBST(DNSSD_BACKEND)
dnl
dnl End of "$Id: cups-dnssd.m4 8344 2009-02-10 17:05:35Z mike $".
dnl End of "$Id: cups-dnssd.m4 8789 2009-08-28 22:54:34Z mike $".
dnl
+4 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-launchd.m4 8344 2009-02-10 17:05:35Z mike $"
dnl "$Id: cups-launchd.m4 9120 2010-04-23 18:56:34Z mike $"
dnl
dnl launchd stuff for the Common UNIX Printing System (CUPS).
dnl launchd stuff for CUPS.
dnl
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2007-2010 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
@@ -35,10 +35,9 @@ if test x$enable_launchd != xno; then
esac
fi
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LAUNCHD_CONF, "$DEFAULT_LAUNCHD_CONF")
AC_SUBST(DEFAULT_LAUNCHD_CONF)
AC_SUBST(LAUNCHDLIBS)
dnl
dnl End of "$Id: cups-launchd.m4 8344 2009-02-10 17:05:35Z mike $".
dnl End of "$Id: cups-launchd.m4 9120 2010-04-23 18:56:34Z mike $".
dnl
+15 -17
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-pam.m4 8344 2009-02-10 17:05:35Z mike $"
dnl "$Id: cups-pam.m4 8825 2009-09-22 21:53:31Z mike $"
dnl
dnl PAM stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -22,9 +22,10 @@ if test $uname = AIX; then
fi
PAMDIR=""
PAMFILE=""
PAMFILE="pam.std"
PAMLIBS=""
PAMMOD="pam_unknown.so"
PAMMODAUTH="pam_unknown.so"
if test x$enable_pam != xno; then
SAVELIBS="$LIBS"
@@ -60,7 +61,7 @@ if test x$enable_pam != xno; then
case "$uname" in
Darwin*)
# Darwin, MacOS X
# Darwin/Mac 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
@@ -70,26 +71,22 @@ if test x$enable_pam != xno; then
fi
;;
IRIX)
# SGI IRIX
PAMFILE="pam.irix"
;;
*)
# All others; this test might need to be updated
# as Linux distributors move things around...
if test "x$with_pam_module" != x; then
PAMMOD="pam_${with_pam_module}.so"
else
for mod in pam_unix2.so pam_unix.so pam_pwdb.so; do
if test -f /lib/security/$mod; then
PAMMOD="$mod"
break;
fi
done
elif test -f /lib/security/pam_unix2.so; then
PAMMOD="pam_unix2.so"
elif test -f /lib/security/pam_unix.so; then
PAMMOD="pam_unix.so"
fi
PAMFILE="pam.std"
if test "x$PAMMOD" = xpam_unix.so; then
PAMMODAUTH="$PAMMOD shadow nodelay"
else
PAMMODAUTH="$PAMMOD nodelay"
fi
;;
esac
fi
@@ -98,7 +95,8 @@ AC_SUBST(PAMDIR)
AC_SUBST(PAMFILE)
AC_SUBST(PAMLIBS)
AC_SUBST(PAMMOD)
AC_SUBST(PAMMODAUTH)
dnl
dnl End of "$Id: cups-pam.m4 8344 2009-02-10 17:05:35Z mike $".
dnl End of "$Id: cups-pam.m4 8825 2009-09-22 21:53:31Z mike $".
dnl
+23 -3
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-pdf.m4 8430 2009-03-12 21:50:44Z mike $"
dnl "$Id: cups-pdf.m4 8760 2009-08-07 22:30:30Z mike $"
dnl
dnl PDF filter configuration stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -13,7 +13,7 @@ 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_WITH(pdftops, [ --with-pdftops set pdftops filter (gs,pdftops,none), default=pdftops ])
AC_ARG_WITH(pdftops, [ --with-pdftops set pdftops filter (gs,/path/to/gs,pdftops,/path/to/pdftops,none), default=pdftops ])
PDFTOPS=""
CUPS_PDFTOPS=""
@@ -47,6 +47,12 @@ case "x$with_pdftops" in
fi
;;
x/*/gs) # Use /path/to/gs without any check:
CUPS_GHOSTSCRIPT="$with_pdftops"
AC_DEFINE(HAVE_GHOSTSCRIPT)
PDFTOPS="pdftops"
;;
xpdftops)
AC_PATH_PROG(CUPS_PDFTOPS, pdftops)
if test "x$CUPS_PDFTOPS" != x; then
@@ -57,6 +63,20 @@ case "x$with_pdftops" in
exit 1
fi
;;
x/*/pdftops) # Use /path/to/pdftops without any check:
CUPS_PDFTOPS="$with_pdftops"
AC_DEFINE(HAVE_PDFTOPS)
PDFTOPS="pdftops"
;;
xnone) # Make no pdftops filter if with_pdftops=none:
;;
*) # Invalid with_pdftops value:
AC_MSG_ERROR(Invalid with_pdftops value!)
exit 1
;;
esac
AC_DEFINE_UNQUOTED(CUPS_PDFTOPS, "$CUPS_PDFTOPS")
@@ -64,5 +84,5 @@ AC_DEFINE_UNQUOTED(CUPS_GHOSTSCRIPT, "$CUPS_GHOSTSCRIPT")
AC_SUBST(PDFTOPS)
dnl
dnl End of "$Id: cups-pdf.m4 8430 2009-03-12 21:50:44Z mike $".
dnl End of "$Id: cups-pdf.m4 8760 2009-08-07 22:30:30Z mike $".
dnl
+17 -2
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-sharedlibs.m4 8344 2009-02-10 17:05:35Z mike $"
dnl "$Id: cups-sharedlibs.m4 9154 2010-06-16 00:49:01Z mike $"
dnl
dnl Shared library support for the Common UNIX Printing System (CUPS).
dnl
@@ -158,16 +158,31 @@ AC_SUBST(LIBCUPSPPDC)
if test x$enable_shared = xno; then
LINKCUPS="../cups/libcups.a"
LINKCUPSIMAGE="../filter/libcupsimage.a"
EXTLINKCUPS="-lcups"
EXTLINKCUPSDRIVER="-lcupsdriver"
EXTLINKCUPSIMAGE="-lcupsimage"
else
if test $uname = AIX; then
LINKCUPS="-lcups_s"
LINKCUPSIMAGE="-lcupsimage_s"
EXTLINKCUPS="-lcups_s"
EXTLINKCUPSDRIVER="-lcupsdriver_s"
EXTLINKCUPSIMAGE="-lcupsimage_s"
else
LINKCUPS="-lcups"
LINKCUPSIMAGE="-lcupsimage"
EXTLINKCUPS="-lcups"
EXTLINKCUPSDRIVER="-lcupsdriver"
EXTLINKCUPSIMAGE="-lcupsimage"
fi
fi
AC_SUBST(EXTLINKCUPS)
AC_SUBST(EXTLINKCUPSDRIVER)
AC_SUBST(EXTLINKCUPSIMAGE)
AC_SUBST(LINKCUPS)
AC_SUBST(LINKCUPSIMAGE)
@@ -244,5 +259,5 @@ AC_SUBST(IMGLIBS)
AC_SUBST(EXPORT_LDFLAGS)
dnl
dnl End of "$Id: cups-sharedlibs.m4 8344 2009-02-10 17:05:35Z mike $".
dnl End of "$Id: cups-sharedlibs.m4 9154 2010-06-16 00:49:01Z mike $".
dnl
+57 -14
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-ssl.m4 8591 2009-05-04 23:40:10Z mike $"
dnl "$Id: cups-ssl.m4 9470 2011-01-11 07:05:58Z mike $"
dnl
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
dnl OpenSSL/GNUTLS stuff for CUPS.
dnl
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2007-2011 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
@@ -26,17 +26,22 @@ AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenS
SSLFLAGS=""
SSLLIBS=""
have_ssl=0
if test x$enable_ssl != xno; then
dnl Look for CDSA...
if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
if test $have_ssl = 0 -a "x$enable_cdsassl" != "xno"; then
if test $uname = Darwin; then
AC_CHECK_HEADER(Security/SecureTransport.h, [
SSLLIBS="-framework CoreFoundation -framework Security"
have_ssl=1
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_CDSASSL)
dnl Check for the various security headers...
AC_CHECK_HEADER(Security/SecItem.h,
AC_DEFINE(HAVE_SECITEM_H))
AC_CHECK_HEADER(Security/SecItemPriv.h,
AC_DEFINE(HAVE_SECITEMPRIV_H))
AC_CHECK_HEADER(Security/SecPolicy.h,
AC_DEFINE(HAVE_SECPOLICY_H))
AC_CHECK_HEADER(Security/SecPolicyPriv.h,
@@ -53,23 +58,58 @@ if test x$enable_ssl != xno; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl Check for SecPolicyCreateSSL...
AC_MSG_CHECKING(for SecPolicyCreateSSL)
if test $uversion -ge 110; then
AC_DEFINE(HAVE_SECPOLICYCREATESSL)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi])
fi
fi
dnl Then look for GNU TLS...
if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
if $PKGCONFIG --exists gnutls; then
SSLLIBS=`$PKGCONFIG --libs gnutls`
SSLFLAGS=`$PKGCONFIG --cflags gnutls`
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)
if test "x$have_pthread" = xyes; then
AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
else
have_ssl=1
SSLLIBS=`$PKGCONFIG --libs gnutls`
SSLFLAGS=`$PKGCONFIG --cflags gnutls`
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)
fi
elif test "x$LIBGNUTLSCONFIG" != x; then
if test "x$have_pthread" = xyes; then
AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
else
have_ssl=1
SSLLIBS=`$LIBGNUTLSCONFIG --libs`
SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)
fi
fi
if test $have_ssl = 1; then
if $PKGCONFIG --exists gcrypt; then
SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
elif test "x$LIBGCRYPTCONFIG" != x; then
SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`"
SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`"
fi
fi
fi
dnl Check for the OpenSSL library last...
if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then
if test $have_ssl = 0 -a "x$enable_openssl" != "xno"; then
AC_CHECK_HEADER(openssl/ssl.h,
dnl Save the current libraries so the crypto stuff isn't always
dnl included...
@@ -87,7 +127,8 @@ if test x$enable_ssl != xno; then
"-lcrypto -lRSAglue -lrsaref"
do
AC_CHECK_LIB(ssl,SSL_new,
[SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
[have_ssl=1
SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
SSLLIBS="-lssl $libcrypto"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_LIBSSL)],,
@@ -102,9 +143,11 @@ if test x$enable_ssl != xno; then
fi
fi
if test "x$SSLLIBS" != x; then
if test $have_ssl = 1; then
AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
elif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes -o x$enable_openssl = xyes; then
AC_MSG_ERROR([Unable to enable SSL support.])
fi
AC_SUBST(SSLFLAGS)
@@ -115,5 +158,5 @@ AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-ssl.m4 8591 2009-05-04 23:40:10Z mike $".
dnl End of "$Id: cups-ssl.m4 9470 2011-01-11 07:05:58Z mike $".
dnl
+56 -17
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Configuration file for the Common UNIX Printing System (CUPS).
* Configuration file for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -289,6 +289,8 @@
*/
#undef HAVE_AUTHORIZATION_H
#undef HAVE_SECITEM_H
#undef HAVE_SECITEMPRIV_H
#undef HAVE_SECPOLICY_H
#undef HAVE_SECPOLICYPRIV_H
#undef HAVE_SECBASEPRIV_H
@@ -302,6 +304,13 @@
#undef HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
/*
* Do we have the SecPolicyCreateSSL function?
*/
#undef HAVE_SECPOLICYCREATESSL
/*
* Do we have the SLP library?
*/
@@ -335,14 +344,6 @@
#undef HAVE_DNSSD
/*
* Do we have Darwin's CoreFoundation and SystemConfiguration frameworks?
*/
#undef HAVE_COREFOUNDATION
#undef HAVE_SYSTEMCONFIGURATION
/*
* Do we have <sys/ioctl.h>?
*/
@@ -351,11 +352,10 @@
/*
* Do we have mkstemp() and/or mkstemps()?
* Does the "stat" structure contain the "st_gen" member?
*/
#undef HAVE_MKSTEMP
#undef HAVE_MKSTEMPS
#undef HAVE_ST_GEN
/*
@@ -448,7 +448,6 @@
#undef HAVE_LAUNCH_H
#undef HAVE_LAUNCHD
#define CUPS_DEFAULT_LAUNCHD_CONF ""
/*
@@ -499,7 +498,21 @@
/*
* Do we have MacOSX 10.4's mbr_XXX functions()?
* Do we have ApplicationServices public headers?
*/
#undef HAVE_APPLICATIONSERVICES_H
/*
* Do we have the SCDynamicStoreCopyComputerName function?
*/
#undef HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME
/*
* Do we have MacOSX 10.4's mbr_XXX functions?
*/
#undef HAVE_MEMBERSHIP_H
@@ -508,7 +521,7 @@
/*
* Do we have Darwin's notify_post() header and function?
* Do we have Darwin's notify_post header and function?
*/
#undef HAVE_NOTIFY_H
@@ -602,10 +615,24 @@
* Which random number generator function to use...
*/
#undef HAVE_ARC4RANDOM
#undef HAVE_RANDOM
#undef HAVE_MRAND48
#undef HAVE_LRAND48
#ifdef HAVE_ARC4RANDOM
# define CUPS_RAND() arc4random()
# define CUPS_SRAND(v) arc4random_stir()
#elif defined(HAVE_RANDOM)
# define CUPS_RAND() random()
# define CUPS_SRAND(v) srandom(v)
#elif defined(HAVE_LRAND48)
# define CUPS_RAND() lrand48()
# define CUPS_SRAND(v) srand48(v)
#else
# define CUPS_RAND() rand()
# define CUPS_SRAND(v) srand(v)
#endif /* HAVE_ARC4RANDOM */
/*
* Do we have vproc_transaction_begin/end?
@@ -628,6 +655,18 @@
#undef HAVE_TCPD_H
/*
* Do we have statfs or statvfs and one of the corresponding headers?
*/
#undef HAVE_STATFS
#undef HAVE_STATVFS
#undef HAVE_SYS_MOUNT_H
#undef HAVE_SYS_STATFS_H
#undef HAVE_SYS_STATVFS_H
#undef HAVE_SYS_VFS_H
#endif /* !_CUPS_CONFIG_H_ */
/*
+2 -2
Ver Arquivo
@@ -31,9 +31,9 @@ sinclude(config-scripts/cups-poll.m4)
sinclude(config-scripts/cups-slp.m4)
sinclude(config-scripts/cups-gssapi.m4)
sinclude(config-scripts/cups-ldap.m4)
sinclude(config-scripts/cups-threads.m4)
sinclude(config-scripts/cups-ssl.m4)
sinclude(config-scripts/cups-pam.m4)
sinclude(config-scripts/cups-threads.m4)
sinclude(config-scripts/cups-largefile.m4)
sinclude(config-scripts/cups-dnssd.m4)
sinclude(config-scripts/cups-launchd.m4)
@@ -70,7 +70,7 @@ AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
init/org.cups.cups-lpd.plist init/cups.xml
man/client.conf.man man/cups-deviced.man man/cups-driverd.man
man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
man/cupsd.conf.man man/drv.man man/lpoptions.man
man/cupsd.conf.man man/lpoptions.man
templates/header.tmpl
$LANGFILES)
+4 -4
Ver Arquivo
@@ -4,7 +4,7 @@
#
# CUPS configuration utility.
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007-2010 by Apple Inc.
# Copyright 2001-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -113,12 +113,12 @@ while test $# -gt 0; do
;;
--libs)
if test $static = no; then
libs="-lcups $LIBS";
libs="@EXTLINKCUPS@ $LIBS";
if test $image = yes; then
libs="-lcupsimage $libs"
libs="@EXTLINKCUPSIMAGE@ $libs"
fi
if test $driver = yes; then
libs="-lcupsdriver $libs"
libs="@EXTLINKCUPSDRIVER@ $libs"
fi
else
libs="$libdir/libcups.a $LIBS";
+159 -102
Ver Arquivo
@@ -2,112 +2,131 @@
adminutil.o: adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
adminutil.o: file.h language.h globals.h string.h ../config.h http-private.h
adminutil.o: md5.h ipp-private.h i18n.h transcode.h debug.h
adminutil.o: md5.h ipp-private.h i18n.h transcode.h pwg-private.h
adminutil.o: ../cups/cups.h debug.h
array.o: array.h versioning.h string.h ../config.h debug.h
attr.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
attr.o: language.h debug.h string.h ../config.h
auth.o: globals.h string.h ../config.h http-private.h http.h versioning.h
auth.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
auth.o: i18n.h transcode.h debug.h
auth.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
backchannel.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h
backchannel.o: language.h
backend.o: backend.h versioning.h globals.h string.h ../config.h
backend.o: http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h
backend.o: array.h file.h language.h i18n.h transcode.h
backend.o: array.h file.h language.h i18n.h transcode.h pwg-private.h
backend.o: ../cups/cups.h
conflicts.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h
conflicts.o: file.h language.h string.h ../config.h debug.h
custom.o: globals.h string.h ../config.h http-private.h http.h versioning.h
custom.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
custom.o: i18n.h transcode.h debug.h
custom.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
debug.o: globals.h string.h ../config.h http-private.h http.h versioning.h
debug.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
debug.o: i18n.h transcode.h debug.h
debug.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
dest.o: debug.h globals.h string.h ../config.h http-private.h http.h
dest.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
dest.o: language.h i18n.h transcode.h pwgmedia.h
dest.o: language.h i18n.h transcode.h pwg-private.h ../cups/cups.h
dir.o: dir.h versioning.h string.h ../config.h debug.h
emit.o: ppd.h array.h versioning.h file.h string.h ../config.h debug.h
encode.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
encode.o: ipp-private.h string.h ../config.h debug.h
file.o: file-private.h http-private.h ../config.h http.h versioning.h md5.h
file.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
file.o: language.h i18n.h transcode.h debug.h
file.o: language.h i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
getdevices.o: globals.h string.h ../config.h http-private.h http.h
getdevices.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getdevices.o: file.h language.h i18n.h transcode.h debug.h
getdevices.o: file.h language.h i18n.h transcode.h pwg-private.h
getdevices.o: ../cups/cups.h debug.h
getifaddrs.o: http-private.h ../config.h http.h versioning.h md5.h
getifaddrs.o: ipp-private.h ipp.h
getputfile.o: globals.h string.h ../config.h http-private.h http.h
getputfile.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getputfile.o: file.h language.h i18n.h transcode.h debug.h
getputfile.o: file.h language.h i18n.h transcode.h pwg-private.h
getputfile.o: ../cups/cups.h debug.h
globals.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
globals.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
globals.o: i18n.h transcode.h
globals.o: i18n.h transcode.h pwg-private.h ../cups/cups.h
http.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
http.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
http.o: i18n.h transcode.h debug.h
http.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
http-addr.o: http-private.h ../config.h http.h versioning.h md5.h
http-addr.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addr.o: file.h language.h i18n.h transcode.h debug.h
http-addr.o: file.h language.h i18n.h transcode.h pwg-private.h
http-addr.o: ../cups/cups.h debug.h
http-addrlist.o: http-private.h ../config.h http.h versioning.h md5.h
http-addrlist.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addrlist.o: file.h language.h i18n.h transcode.h debug.h
http-addrlist.o: file.h language.h i18n.h transcode.h pwg-private.h
http-addrlist.o: ../cups/cups.h debug.h
http-support.o: debug.h globals.h string.h ../config.h http-private.h http.h
http-support.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
http-support.o: file.h language.h i18n.h transcode.h
http-support.o: file.h language.h i18n.h transcode.h pwg-private.h
http-support.o: ../cups/cups.h
ipp.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
ipp.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
ipp.o: transcode.h debug.h
ipp.o: transcode.h pwg-private.h ../cups/cups.h debug.h
ipp-support.o: globals.h string.h ../config.h http-private.h http.h
ipp-support.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
ipp-support.o: file.h language.h i18n.h transcode.h debug.h
ipp-support.o: file.h language.h i18n.h transcode.h pwg-private.h
ipp-support.o: ../cups/cups.h debug.h
langprintf.o: globals.h string.h ../config.h http-private.h http.h
langprintf.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
langprintf.o: file.h language.h i18n.h transcode.h
langprintf.o: file.h language.h i18n.h transcode.h pwg-private.h
langprintf.o: ../cups/cups.h
language.o: globals.h string.h ../config.h http-private.h http.h versioning.h
language.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
language.o: i18n.h transcode.h debug.h
language.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
localize.o: globals.h string.h ../config.h http-private.h http.h versioning.h
localize.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
localize.o: i18n.h transcode.h ppd-private.h debug.h
localize.o: i18n.h transcode.h pwg-private.h ../cups/cups.h ppd-private.h
localize.o: debug.h
mark.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
mark.o: string.h ../config.h debug.h pwgmedia.h
mark.o: string.h ../config.h debug.h pwg-private.h ../cups/cups.h
md5.o: md5.h string.h ../config.h
md5passwd.o: http-private.h ../config.h http.h versioning.h md5.h
md5passwd.o: ipp-private.h ipp.h string.h
notify.o: globals.h string.h ../config.h http-private.h http.h versioning.h
notify.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
notify.o: i18n.h transcode.h
notify.o: i18n.h transcode.h pwg-private.h ../cups/cups.h
options.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
options.o: string.h ../config.h debug.h
page.o: ppd.h array.h versioning.h file.h string.h ../config.h debug.h
ppd.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
ppd.o: language.h globals.h string.h ../config.h http-private.h md5.h
ppd.o: ipp-private.h i18n.h transcode.h debug.h
pwgmedia.o: pwgmedia.h globals.h string.h ../config.h http-private.h http.h
pwgmedia.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
pwgmedia.o: file.h language.h i18n.h transcode.h debug.h
ppd.o: language.h pwg-private.h ../cups/cups.h globals.h string.h ../config.h
ppd.o: http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h
pwg-file.o: pwg-private.h ../cups/cups.h globals.h string.h ../config.h
pwg-file.o: http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
pwg-file.o: cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
pwg-media.o: pwg-private.h ../cups/cups.h globals.h string.h ../config.h
pwg-media.o: http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
pwg-media.o: cups.h ppd.h array.h file.h language.h i18n.h transcode.h
pwg-media.o: debug.h
pwg-ppd.o: pwg-private.h ../cups/cups.h globals.h string.h ../config.h
pwg-ppd.o: http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
pwg-ppd.o: cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
request.o: globals.h string.h ../config.h http-private.h http.h versioning.h
request.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
request.o: i18n.h transcode.h debug.h
request.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
sidechannel.o: sidechannel.h versioning.h string.h ../config.h debug.h
snmp.o: globals.h string.h ../config.h http-private.h http.h versioning.h
snmp.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
snmp.o: i18n.h transcode.h debug.h snmp-private.h
snmp.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
snmp.o: snmp-private.h
snprintf.o: string.h ../config.h
string.o: array.h versioning.h debug.h string.h ../config.h
tempfile.o: globals.h string.h ../config.h http-private.h http.h versioning.h
tempfile.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
tempfile.o: i18n.h transcode.h debug.h
tempfile.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
transcode.o: globals.h string.h ../config.h http-private.h http.h
transcode.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
transcode.o: file.h language.h i18n.h transcode.h debug.h
transcode.o: file.h language.h i18n.h transcode.h pwg-private.h
transcode.o: ../cups/cups.h debug.h
usersys.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
usersys.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
usersys.o: i18n.h transcode.h debug.h
usersys.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
util.o: globals.h string.h ../config.h http-private.h http.h versioning.h
util.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
util.o: i18n.h transcode.h debug.h
util.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
testadmin.o: adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
testadmin.o: file.h language.h string.h ../config.h
testarray.o: ../cups/string.h ../config.h string.h array.h versioning.h dir.h
@@ -127,119 +146,138 @@ testoptions.o: string.h ../config.h cups.h ipp.h http.h versioning.h ppd.h
testoptions.o: array.h file.h language.h
testlang.o: i18n.h transcode.h language.h array.h versioning.h string.h
testlang.o: ../config.h
testppd.o: ../cups/string.h ../config.h string.h cups.h ipp.h http.h
testppd.o: versioning.h ppd.h array.h file.h language.h pwgmedia.h
testppd.o: ../cups/cups.h ../cups/string.h ../config.h string.h
testpwg.o: pwg-private.h ../cups/cups.h
testsnmp.o: string.h ../config.h snmp-private.h http.h versioning.h
# DO NOT DELETE
adminutil.32.o: adminutil.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
adminutil.32.o: adminutil.c file.h language.h globals.h string.h ../config.h http-private.h
adminutil.32.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h debug.h
adminutil.32.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h pwg-private.h
adminutil.32.o: adminutil.c ../cups/cups.h debug.h
array.32.o: array.c array.h versioning.h string.h ../config.h debug.h
attr.32.o: attr.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
attr.32.o: attr.c language.h debug.h string.h ../config.h
auth.32.o: auth.c globals.h string.h ../config.h http-private.h http.h versioning.h
auth.32.o: auth.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
auth.32.o: auth.c i18n.h transcode.h debug.h
auth.32.o: auth.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
backchannel.32.o: backchannel.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
backchannel.32.o: backchannel.c language.h
backend.32.o: backend.c backend.h versioning.h globals.h string.h ../config.h
backend.32.o: backend.c http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h
backend.32.o: backend.c array.h file.h language.h i18n.h transcode.h
backend.32.o: backend.c array.h file.h language.h i18n.h transcode.h pwg-private.h
backend.32.o: backend.c ../cups/cups.h
conflicts.32.o: conflicts.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h
conflicts.32.o: conflicts.c file.h language.h string.h ../config.h debug.h
custom.32.o: custom.c globals.h string.h ../config.h http-private.h http.h versioning.h
custom.32.o: custom.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
custom.32.o: custom.c i18n.h transcode.h debug.h
custom.32.o: custom.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
debug.32.o: debug.c globals.h string.h ../config.h http-private.h http.h versioning.h
debug.32.o: debug.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
debug.32.o: debug.c i18n.h transcode.h debug.h
debug.32.o: debug.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
dest.32.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h
dest.32.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
dest.32.o: dest.c language.h i18n.h transcode.h pwgmedia.h
dest.32.o: dest.c language.h i18n.h transcode.h pwg-private.h ../cups/cups.h
dir.32.o: dir.c dir.h versioning.h string.h ../config.h debug.h
emit.32.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
encode.32.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
encode.32.o: encode.c ipp-private.h string.h ../config.h debug.h
file.32.o: file.c file-private.h http-private.h ../config.h http.h versioning.h md5.h
file.32.o: file.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
file.32.o: file.c language.h i18n.h transcode.h debug.h
file.32.o: file.c language.h i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
getdevices.32.o: getdevices.c globals.h string.h ../config.h http-private.h http.h
getdevices.32.o: getdevices.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getdevices.32.o: getdevices.c file.h language.h i18n.h transcode.h debug.h
getdevices.32.o: getdevices.c file.h language.h i18n.h transcode.h pwg-private.h
getdevices.32.o: getdevices.c ../cups/cups.h debug.h
getifaddrs.32.o: getifaddrs.c http-private.h ../config.h http.h versioning.h md5.h
getifaddrs.32.o: getifaddrs.c ipp-private.h ipp.h
getputfile.32.o: getputfile.c globals.h string.h ../config.h http-private.h http.h
getputfile.32.o: getputfile.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getputfile.32.o: getputfile.c file.h language.h i18n.h transcode.h debug.h
getputfile.32.o: getputfile.c file.h language.h i18n.h transcode.h pwg-private.h
getputfile.32.o: getputfile.c ../cups/cups.h debug.h
globals.32.o: globals.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
globals.32.o: globals.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
globals.32.o: globals.c i18n.h transcode.h
globals.32.o: globals.c i18n.h transcode.h pwg-private.h ../cups/cups.h
http.32.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
http.32.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
http.32.o: http.c i18n.h transcode.h debug.h
http.32.o: http.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
http-addr.32.o: http-addr.c http-private.h ../config.h http.h versioning.h md5.h
http-addr.32.o: http-addr.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addr.32.o: http-addr.c file.h language.h i18n.h transcode.h debug.h
http-addr.32.o: http-addr.c file.h language.h i18n.h transcode.h pwg-private.h
http-addr.32.o: http-addr.c ../cups/cups.h debug.h
http-addrlist.32.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h
http-addrlist.32.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addrlist.32.o: http-addrlist.c file.h language.h i18n.h transcode.h debug.h
http-addrlist.32.o: http-addrlist.c file.h language.h i18n.h transcode.h pwg-private.h
http-addrlist.32.o: http-addrlist.c ../cups/cups.h debug.h
http-support.32.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h
http-support.32.o: http-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
http-support.32.o: http-support.c file.h language.h i18n.h transcode.h
http-support.32.o: http-support.c file.h language.h i18n.h transcode.h pwg-private.h
http-support.32.o: http-support.c ../cups/cups.h
ipp.32.o: ipp.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
ipp.32.o: ipp.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
ipp.32.o: ipp.c transcode.h debug.h
ipp.32.o: ipp.c transcode.h pwg-private.h ../cups/cups.h debug.h
ipp-support.32.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h
ipp-support.32.o: ipp-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
ipp-support.32.o: ipp-support.c file.h language.h i18n.h transcode.h debug.h
ipp-support.32.o: ipp-support.c file.h language.h i18n.h transcode.h pwg-private.h
ipp-support.32.o: ipp-support.c ../cups/cups.h debug.h
langprintf.32.o: langprintf.c globals.h string.h ../config.h http-private.h http.h
langprintf.32.o: langprintf.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
langprintf.32.o: langprintf.c file.h language.h i18n.h transcode.h
langprintf.32.o: langprintf.c file.h language.h i18n.h transcode.h pwg-private.h
langprintf.32.o: langprintf.c ../cups/cups.h
language.32.o: language.c globals.h string.h ../config.h http-private.h http.h versioning.h
language.32.o: language.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
language.32.o: language.c i18n.h transcode.h debug.h
language.32.o: language.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
localize.32.o: localize.c globals.h string.h ../config.h http-private.h http.h versioning.h
localize.32.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
localize.32.o: localize.c i18n.h transcode.h ppd-private.h debug.h
localize.32.o: localize.c i18n.h transcode.h pwg-private.h ../cups/cups.h ppd-private.h
localize.32.o: localize.c debug.h
mark.32.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
mark.32.o: mark.c string.h ../config.h debug.h pwgmedia.h
mark.32.o: mark.c string.h ../config.h debug.h pwg-private.h ../cups/cups.h
md5.32.o: md5.c md5.h string.h ../config.h
md5passwd.32.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h
md5passwd.32.o: md5passwd.c ipp-private.h ipp.h string.h
notify.32.o: notify.c globals.h string.h ../config.h http-private.h http.h versioning.h
notify.32.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
notify.32.o: notify.c i18n.h transcode.h
notify.32.o: notify.c i18n.h transcode.h pwg-private.h ../cups/cups.h
options.32.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
options.32.o: options.c string.h ../config.h debug.h
page.32.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
ppd.32.o: ppd.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
ppd.32.o: ppd.c language.h globals.h string.h ../config.h http-private.h md5.h
ppd.32.o: ppd.c ipp-private.h i18n.h transcode.h debug.h
pwgmedia.32.o: pwgmedia.c pwgmedia.h globals.h string.h ../config.h http-private.h http.h
pwgmedia.32.o: pwgmedia.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
pwgmedia.32.o: pwgmedia.c file.h language.h i18n.h transcode.h debug.h
ppd.32.o: ppd.c language.h pwg-private.h ../cups/cups.h globals.h string.h ../config.h
ppd.32.o: ppd.c http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h
pwg-file.32.o: pwg-file.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
pwg-file.32.o: pwg-file.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
pwg-file.32.o: pwg-file.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
pwg-media.32.o: pwg-media.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
pwg-media.32.o: pwg-media.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
pwg-media.32.o: pwg-media.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h
pwg-media.32.o: pwg-media.c debug.h
pwg-ppd.32.o: pwg-ppd.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
pwg-ppd.32.o: pwg-ppd.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
pwg-ppd.32.o: pwg-ppd.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
request.32.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h
request.32.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
request.32.o: request.c i18n.h transcode.h debug.h
request.32.o: request.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
sidechannel.32.o: sidechannel.c sidechannel.h versioning.h string.h ../config.h debug.h
snmp.32.o: snmp.c globals.h string.h ../config.h http-private.h http.h versioning.h
snmp.32.o: snmp.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
snmp.32.o: snmp.c i18n.h transcode.h debug.h snmp-private.h
snmp.32.o: snmp.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
snmp.32.o: snmp.c snmp-private.h
snprintf.32.o: snprintf.c string.h ../config.h
string.32.o: string.c array.h versioning.h debug.h string.h ../config.h
tempfile.32.o: tempfile.c globals.h string.h ../config.h http-private.h http.h versioning.h
tempfile.32.o: tempfile.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
tempfile.32.o: tempfile.c i18n.h transcode.h debug.h
tempfile.32.o: tempfile.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
transcode.32.o: transcode.c globals.h string.h ../config.h http-private.h http.h
transcode.32.o: transcode.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
transcode.32.o: transcode.c file.h language.h i18n.h transcode.h debug.h
transcode.32.o: transcode.c file.h language.h i18n.h transcode.h pwg-private.h
transcode.32.o: transcode.c ../cups/cups.h debug.h
usersys.32.o: usersys.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
usersys.32.o: usersys.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
usersys.32.o: usersys.c i18n.h transcode.h debug.h
usersys.32.o: usersys.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
util.32.o: util.c globals.h string.h ../config.h http-private.h http.h versioning.h
util.32.o: util.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
util.32.o: util.c i18n.h transcode.h debug.h
util.32.o: util.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
testadmin.32.o: testadmin.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
testadmin.32.o: testadmin.c file.h language.h string.h ../config.h
testarray.32.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h
@@ -259,119 +297,138 @@ testoptions.32.o: testoptions.c string.h ../config.h cups.h ipp.h http.h versio
testoptions.32.o: testoptions.c array.h file.h language.h
testlang.32.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h
testlang.32.o: testlang.c ../config.h
testppd.32.o: testppd.c ../cups/string.h ../config.h string.h cups.h ipp.h http.h
testppd.32.o: testppd.c versioning.h ppd.h array.h file.h language.h pwgmedia.h
testppd.32.o: testppd.c ../cups/cups.h ../cups/string.h ../config.h string.h
testpwg.32.o: testpwg.c pwg-private.h ../cups/cups.h
testsnmp.32.o: testsnmp.c string.h ../config.h snmp-private.h http.h versioning.h
# DO NOT DELETE
adminutil.64.o: adminutil.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
adminutil.64.o: adminutil.c file.h language.h globals.h string.h ../config.h http-private.h
adminutil.64.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h debug.h
adminutil.64.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h pwg-private.h
adminutil.64.o: adminutil.c ../cups/cups.h debug.h
array.64.o: array.c array.h versioning.h string.h ../config.h debug.h
attr.64.o: attr.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
attr.64.o: attr.c language.h debug.h string.h ../config.h
auth.64.o: auth.c globals.h string.h ../config.h http-private.h http.h versioning.h
auth.64.o: auth.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
auth.64.o: auth.c i18n.h transcode.h debug.h
auth.64.o: auth.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
backchannel.64.o: backchannel.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
backchannel.64.o: backchannel.c language.h
backend.64.o: backend.c backend.h versioning.h globals.h string.h ../config.h
backend.64.o: backend.c http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h
backend.64.o: backend.c array.h file.h language.h i18n.h transcode.h
backend.64.o: backend.c array.h file.h language.h i18n.h transcode.h pwg-private.h
backend.64.o: backend.c ../cups/cups.h
conflicts.64.o: conflicts.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h
conflicts.64.o: conflicts.c file.h language.h string.h ../config.h debug.h
custom.64.o: custom.c globals.h string.h ../config.h http-private.h http.h versioning.h
custom.64.o: custom.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
custom.64.o: custom.c i18n.h transcode.h debug.h
custom.64.o: custom.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
debug.64.o: debug.c globals.h string.h ../config.h http-private.h http.h versioning.h
debug.64.o: debug.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
debug.64.o: debug.c i18n.h transcode.h debug.h
debug.64.o: debug.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
dest.64.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h
dest.64.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
dest.64.o: dest.c language.h i18n.h transcode.h pwgmedia.h
dest.64.o: dest.c language.h i18n.h transcode.h pwg-private.h ../cups/cups.h
dir.64.o: dir.c dir.h versioning.h string.h ../config.h debug.h
emit.64.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
encode.64.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
encode.64.o: encode.c ipp-private.h string.h ../config.h debug.h
file.64.o: file.c file-private.h http-private.h ../config.h http.h versioning.h md5.h
file.64.o: file.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
file.64.o: file.c language.h i18n.h transcode.h debug.h
file.64.o: file.c language.h i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
getdevices.64.o: getdevices.c globals.h string.h ../config.h http-private.h http.h
getdevices.64.o: getdevices.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getdevices.64.o: getdevices.c file.h language.h i18n.h transcode.h debug.h
getdevices.64.o: getdevices.c file.h language.h i18n.h transcode.h pwg-private.h
getdevices.64.o: getdevices.c ../cups/cups.h debug.h
getifaddrs.64.o: getifaddrs.c http-private.h ../config.h http.h versioning.h md5.h
getifaddrs.64.o: getifaddrs.c ipp-private.h ipp.h
getputfile.64.o: getputfile.c globals.h string.h ../config.h http-private.h http.h
getputfile.64.o: getputfile.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getputfile.64.o: getputfile.c file.h language.h i18n.h transcode.h debug.h
getputfile.64.o: getputfile.c file.h language.h i18n.h transcode.h pwg-private.h
getputfile.64.o: getputfile.c ../cups/cups.h debug.h
globals.64.o: globals.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
globals.64.o: globals.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
globals.64.o: globals.c i18n.h transcode.h
globals.64.o: globals.c i18n.h transcode.h pwg-private.h ../cups/cups.h
http.64.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
http.64.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
http.64.o: http.c i18n.h transcode.h debug.h
http.64.o: http.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
http-addr.64.o: http-addr.c http-private.h ../config.h http.h versioning.h md5.h
http-addr.64.o: http-addr.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addr.64.o: http-addr.c file.h language.h i18n.h transcode.h debug.h
http-addr.64.o: http-addr.c file.h language.h i18n.h transcode.h pwg-private.h
http-addr.64.o: http-addr.c ../cups/cups.h debug.h
http-addrlist.64.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h
http-addrlist.64.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addrlist.64.o: http-addrlist.c file.h language.h i18n.h transcode.h debug.h
http-addrlist.64.o: http-addrlist.c file.h language.h i18n.h transcode.h pwg-private.h
http-addrlist.64.o: http-addrlist.c ../cups/cups.h debug.h
http-support.64.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h
http-support.64.o: http-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
http-support.64.o: http-support.c file.h language.h i18n.h transcode.h
http-support.64.o: http-support.c file.h language.h i18n.h transcode.h pwg-private.h
http-support.64.o: http-support.c ../cups/cups.h
ipp.64.o: ipp.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
ipp.64.o: ipp.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
ipp.64.o: ipp.c transcode.h debug.h
ipp.64.o: ipp.c transcode.h pwg-private.h ../cups/cups.h debug.h
ipp-support.64.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h
ipp-support.64.o: ipp-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
ipp-support.64.o: ipp-support.c file.h language.h i18n.h transcode.h debug.h
ipp-support.64.o: ipp-support.c file.h language.h i18n.h transcode.h pwg-private.h
ipp-support.64.o: ipp-support.c ../cups/cups.h debug.h
langprintf.64.o: langprintf.c globals.h string.h ../config.h http-private.h http.h
langprintf.64.o: langprintf.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
langprintf.64.o: langprintf.c file.h language.h i18n.h transcode.h
langprintf.64.o: langprintf.c file.h language.h i18n.h transcode.h pwg-private.h
langprintf.64.o: langprintf.c ../cups/cups.h
language.64.o: language.c globals.h string.h ../config.h http-private.h http.h versioning.h
language.64.o: language.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
language.64.o: language.c i18n.h transcode.h debug.h
language.64.o: language.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
localize.64.o: localize.c globals.h string.h ../config.h http-private.h http.h versioning.h
localize.64.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
localize.64.o: localize.c i18n.h transcode.h ppd-private.h debug.h
localize.64.o: localize.c i18n.h transcode.h pwg-private.h ../cups/cups.h ppd-private.h
localize.64.o: localize.c debug.h
mark.64.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
mark.64.o: mark.c string.h ../config.h debug.h pwgmedia.h
mark.64.o: mark.c string.h ../config.h debug.h pwg-private.h ../cups/cups.h
md5.64.o: md5.c md5.h string.h ../config.h
md5passwd.64.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h
md5passwd.64.o: md5passwd.c ipp-private.h ipp.h string.h
notify.64.o: notify.c globals.h string.h ../config.h http-private.h http.h versioning.h
notify.64.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
notify.64.o: notify.c i18n.h transcode.h
notify.64.o: notify.c i18n.h transcode.h pwg-private.h ../cups/cups.h
options.64.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
options.64.o: options.c string.h ../config.h debug.h
page.64.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
ppd.64.o: ppd.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
ppd.64.o: ppd.c language.h globals.h string.h ../config.h http-private.h md5.h
ppd.64.o: ppd.c ipp-private.h i18n.h transcode.h debug.h
pwgmedia.64.o: pwgmedia.c pwgmedia.h globals.h string.h ../config.h http-private.h http.h
pwgmedia.64.o: pwgmedia.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
pwgmedia.64.o: pwgmedia.c file.h language.h i18n.h transcode.h debug.h
ppd.64.o: ppd.c language.h pwg-private.h ../cups/cups.h globals.h string.h ../config.h
ppd.64.o: ppd.c http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h
pwg-file.64.o: pwg-file.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
pwg-file.64.o: pwg-file.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
pwg-file.64.o: pwg-file.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
pwg-media.64.o: pwg-media.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
pwg-media.64.o: pwg-media.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
pwg-media.64.o: pwg-media.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h
pwg-media.64.o: pwg-media.c debug.h
pwg-ppd.64.o: pwg-ppd.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
pwg-ppd.64.o: pwg-ppd.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
pwg-ppd.64.o: pwg-ppd.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
request.64.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h
request.64.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
request.64.o: request.c i18n.h transcode.h debug.h
request.64.o: request.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
sidechannel.64.o: sidechannel.c sidechannel.h versioning.h string.h ../config.h debug.h
snmp.64.o: snmp.c globals.h string.h ../config.h http-private.h http.h versioning.h
snmp.64.o: snmp.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
snmp.64.o: snmp.c i18n.h transcode.h debug.h snmp-private.h
snmp.64.o: snmp.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
snmp.64.o: snmp.c snmp-private.h
snprintf.64.o: snprintf.c string.h ../config.h
string.64.o: string.c array.h versioning.h debug.h string.h ../config.h
tempfile.64.o: tempfile.c globals.h string.h ../config.h http-private.h http.h versioning.h
tempfile.64.o: tempfile.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
tempfile.64.o: tempfile.c i18n.h transcode.h debug.h
tempfile.64.o: tempfile.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
transcode.64.o: transcode.c globals.h string.h ../config.h http-private.h http.h
transcode.64.o: transcode.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
transcode.64.o: transcode.c file.h language.h i18n.h transcode.h debug.h
transcode.64.o: transcode.c file.h language.h i18n.h transcode.h pwg-private.h
transcode.64.o: transcode.c ../cups/cups.h debug.h
usersys.64.o: usersys.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
usersys.64.o: usersys.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
usersys.64.o: usersys.c i18n.h transcode.h debug.h
usersys.64.o: usersys.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
util.64.o: util.c globals.h string.h ../config.h http-private.h http.h versioning.h
util.64.o: util.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
util.64.o: util.c i18n.h transcode.h debug.h
util.64.o: util.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
testadmin.64.o: testadmin.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
testadmin.64.o: testadmin.c file.h language.h string.h ../config.h
testarray.64.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h
@@ -391,6 +448,6 @@ testoptions.64.o: testoptions.c string.h ../config.h cups.h ipp.h http.h versio
testoptions.64.o: testoptions.c array.h file.h language.h
testlang.64.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h
testlang.64.o: testlang.c ../config.h
testppd.64.o: testppd.c ../cups/string.h ../config.h string.h cups.h ipp.h http.h
testppd.64.o: testppd.c versioning.h ppd.h array.h file.h language.h pwgmedia.h
testppd.64.o: testppd.c ../cups/cups.h ../cups/string.h ../config.h string.h
testpwg.64.o: testpwg.c pwg-private.h ../cups/cups.h
testsnmp.64.o: testsnmp.c string.h ../config.h snmp-private.h http.h versioning.h
+22 -30
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id$"
#
# API library Makefile for the Common UNIX Printing System (CUPS).
# API library Makefile for CUPS.
#
# Copyright 2007-2009 by Apple Inc.
# Copyright 2007-2010 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -56,7 +56,9 @@ LIBOBJS = \
options.o \
page.o \
ppd.o \
pwgmedia.o \
pwg-file.o \
pwg-media.o \
pwg-ppd.o \
request.o \
sidechannel.o \
snmp.o \
@@ -83,8 +85,8 @@ OBJS = \
testoptions.o \
testlang.o \
testppd.o \
testsnmp.o \
php_cups_wrap.o
testpwg.o \
testsnmp.o
#
@@ -130,6 +132,7 @@ UNITTARGETS = \
testlang \
testoptions \
testppd \
testpwg \
testsnmp
TARGETS = \
@@ -237,8 +240,9 @@ install-libs: $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
installstatic:
$(INSTALL_DIR) -m 755 $(LIBDIR)
$(INSTALL_LIB) libcups.a $(LIBDIR)
$(INSTALL_LIB) -m 755 libcups.a $(LIBDIR)
$(RANLIB) $(LIBDIR)/libcups.a
$(CHMOD) 555 $(LIBDIR)/libcups.a
install32bit:
echo Installing libraries in $(LIB32DIR)...
@@ -374,30 +378,6 @@ libcups.a: $(LIBOBJS)
$(RANLIB) $@
#
# CUPS language bindings for various scripting languages...
#
# NOTE: Not currently used or functional - see the scripting/php directory
# for the hand-written bindings...
#
phpcups.so: $(LIBCUPS) php_cups_wrap.o
echo Linking $@...
if test `uname` = Darwin; then \
DSOFLAGS="-bundle -flat_namespace -undefined suppress"; \
else \
DSOFLAGS="$(DSOFLAGS)"; \
fi; \
$(DSO) $$DSOFLAGS -o $@ php_cups_wrap.o $(LIBS) `php-config --ldflags --libs`
php_cups_wrap.o: php_cups_wrap.c
echo Compiling $<...
$(CC) $(CFLAGS) `php-config --includes` -c $<
php_cups_wrap.c: cups.h
echo Creating $< using SWIG...
swig -php -o $@ -module cups cups.h
#
# testadmin (dependency on static CUPS library is intentional)
#
@@ -524,6 +504,18 @@ testppd: testppd.o libcups.a test.ppd test2.ppd
./testppd
#
# testpwg (dependency on static CUPS library is intentional)
#
testpwg: testpwg.o libcups.a test.ppd
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testpwg.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running PWG API tests...
./testpwg test.ppd
#
# testsnmp (dependency on static CUPS library is intentional)
#
+135 -125
Ver Arquivo
@@ -4,7 +4,7 @@
* Administration utility API definitions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -17,16 +17,14 @@
*
* Contents:
*
* cupsAdminCreateWindowsPPD() - Create the Windows PPD file for a printer.
* cupsAdminExportSamba() - Export a printer to Samba.
* cupsAdminGetServerSettings() - Get settings from the server.
* _cupsAdminGetServerSettings() - Get settings from the server (private).
* cupsAdminSetServerSettings() - Set settings on the server.
* _cupsAdminSetServerSettings() - Set settings on the server (private).
* do_samba_command() - Do a SAMBA command.
* get_cupsd_conf() - Get the current cupsd.conf file.
* invalidate_cupsd_cache() - Invalidate the cached cupsd.conf settings.
* write_option() - Write a CUPS option to a PPD file.
* cupsAdminCreateWindowsPPD() - Create the Windows PPD file for a printer.
* cupsAdminExportSamba() - Export a printer to Samba.
* cupsAdminGetServerSettings() - Get settings from the server.
* cupsAdminSetServerSettings() - Set settings on the server.
* do_samba_command() - Do a SAMBA command.
* get_cupsd_conf() - Get the current cupsd.conf file.
* invalidate_cupsd_cache() - Invalidate the cached cupsd.conf settings.
* write_option() - Write a CUPS option to a PPD file.
*/
/*
@@ -50,12 +48,6 @@
* Local functions...
*/
extern int _cupsAdminGetServerSettings(http_t *http,
int *num_settings,
cups_option_t **settings);
extern int _cupsAdminSetServerSettings(http_t *http,
int num_settings,
cups_option_t *settings);
static int do_samba_command(const char *command,
const char *address,
const char *subcommand,
@@ -243,7 +235,7 @@ cupsAdminCreateWindowsPPD(
}
else if (jcloption && !strncmp(line, "*OrderDependency:", 17))
{
for (ptr = line + 17; *ptr && isspace(*ptr & 255); ptr ++);
for (ptr = line + 17; _cups_isspace(*ptr); ptr ++);
ptr = strchr(ptr, ' ');
@@ -862,25 +854,6 @@ cupsAdminGetServerSettings(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
int *num_settings, /* O - Number of settings */
cups_option_t **settings) /* O - Settings */
{
return (_cupsAdminGetServerSettings(http, num_settings, settings));
}
/*
* '_cupsAdminGetServerSettings()' - Get settings from the server.
*
* The returned settings should be freed with cupsFreeOptions() when
* you are done with them.
*
* @since CUPS 1.2@
*/
int /* O - 1 on success, 0 on failure */
_cupsAdminGetServerSettings(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
int *num_settings, /* O - Number of settings */
cups_option_t **settings) /* O - Settings */
{
int i; /* Looping var */
cups_file_t *cupsd; /* cupsd.conf file */
@@ -1043,7 +1016,7 @@ _cupsAdminGetServerSettings(
&& *value != '/'
#endif /* AF_LOCAL */
#ifdef AF_INET6
&& strcmp(value, "::1")
&& strcmp(value, "[::1]")
#endif /* AF_INET6 */
)
remote_access = 1;
@@ -1088,7 +1061,7 @@ _cupsAdminGetServerSettings(
while (*value)
{
for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++);
if (*valptr)
*valptr++ = '\0';
@@ -1099,7 +1072,7 @@ _cupsAdminGetServerSettings(
break;
}
for (value = valptr; isspace(*value & 255); value ++);
for (value = valptr; _cups_isspace(*value); value ++);
}
}
else if (!strcasecmp(line, "</Limit>"))
@@ -1213,22 +1186,6 @@ cupsAdminSetServerSettings(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
int num_settings, /* I - Number of settings */
cups_option_t *settings) /* I - Settings */
{
return (_cupsAdminSetServerSettings(http, num_settings, settings));
}
/*
* '_cupsAdminSetServerSettings()' - Set settings on the server.
*
* @since CUPS 1.2@
*/
int /* O - 1 on success, 0 on failure */
_cupsAdminSetServerSettings(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
int num_settings, /* I - Number of settings */
cups_option_t *settings) /* I - Settings */
{
int i; /* Looping var */
http_status_t status; /* GET/PUT status */
@@ -1309,8 +1266,8 @@ _cupsAdminSetServerSettings(
* Get current settings...
*/
if (!_cupsAdminGetServerSettings(http, &cupsd_num_settings,
&cupsd_settings))
if (!cupsAdminGetServerSettings(http, &cupsd_num_settings,
&cupsd_settings))
return (0);
if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, cupsd_num_settings,
@@ -1319,36 +1276,54 @@ _cupsAdminSetServerSettings(
else
old_debug_logging = 0;
DEBUG_printf(("1cupsAdminSetServerSettings: old debug_logging=%d",
old_debug_logging));
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, cupsd_num_settings,
cupsd_settings)) != NULL)
old_remote_admin = atoi(val);
else
old_remote_admin = 0;
DEBUG_printf(("1cupsAdminSetServerSettings: old remote_admin=%d",
old_remote_admin));
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, cupsd_num_settings,
cupsd_settings)) != NULL)
remote_any = atoi(val);
else
remote_any = 0;
DEBUG_printf(("1cupsAdminSetServerSettings: old remote_any=%d",
remote_any));
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, cupsd_num_settings,
cupsd_settings)) != NULL)
old_remote_printers = atoi(val);
else
old_remote_printers = 1;
DEBUG_printf(("1cupsAdminSetServerSettings: old remote_printers=%d",
old_remote_printers));
if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, cupsd_num_settings,
cupsd_settings)) != NULL)
old_share_printers = atoi(val);
else
old_share_printers = 0;
DEBUG_printf(("1cupsAdminSetServerSettings: old share_printers=%d",
old_share_printers));
if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, cupsd_num_settings,
cupsd_settings)) != NULL)
old_user_cancel_any = atoi(val);
else
old_user_cancel_any = 0;
DEBUG_printf(("1cupsAdminSetServerSettings: old user_cancel_any=%d",
old_user_cancel_any));
cupsFreeOptions(cupsd_num_settings, cupsd_settings);
/*
@@ -1372,16 +1347,22 @@ _cupsAdminSetServerSettings(
else
debug_logging = -1;
DEBUG_printf(("1cupsAdminSetServerSettings: debug_logging=%d",
debug_logging));
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, num_settings,
settings)) != NULL)
remote_any = atoi(val);
DEBUG_printf(("1cupsAdminSetServerSettings: remote_any=%d",
remote_any));
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings,
settings)) != NULL)
{
remote_admin = atoi(val);
if (remote_admin == old_remote_admin && remote_any < 0)
if (remote_admin == old_remote_admin)
{
/*
* No change to this setting...
@@ -1393,6 +1374,9 @@ _cupsAdminSetServerSettings(
else
remote_admin = -1;
DEBUG_printf(("1cupsAdminSetServerSettings: remote_admin=%d",
remote_admin));
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, num_settings,
settings)) != NULL)
{
@@ -1410,12 +1394,15 @@ _cupsAdminSetServerSettings(
else
remote_printers = -1;
DEBUG_printf(("1cupsAdminSetServerSettings: remote_printers=%d",
remote_printers));
if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, num_settings,
settings)) != NULL)
{
share_printers = atoi(val);
if (share_printers == old_share_printers && remote_any < 0)
if (share_printers == old_share_printers)
{
/*
* No change to this setting...
@@ -1427,6 +1414,9 @@ _cupsAdminSetServerSettings(
else
share_printers = -1;
DEBUG_printf(("1cupsAdminSetServerSettings: share_printers=%d",
share_printers));
if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, num_settings,
settings)) != NULL)
{
@@ -1444,6 +1434,9 @@ _cupsAdminSetServerSettings(
else
user_cancel_any = -1;
DEBUG_printf(("1cupsAdminSetServerSettings: user_cancel_any=%d",
user_cancel_any));
/*
* Create a temporary file for the new cupsd.conf file...
*/
@@ -1495,13 +1488,13 @@ _cupsAdminSetServerSettings(
while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
{
if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) &&
(share_printers >= 0 || remote_admin >= 0))
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
{
if (!wrote_port_listen)
{
wrote_port_listen = 1;
if (share_printers > 0 || remote_admin > 0)
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
{
cupsFilePuts(temp, "# Allow remote access\n");
cupsFilePrintf(temp, "Port %d\n", server_port);
@@ -1553,7 +1546,7 @@ _cupsAdminSetServerSettings(
const char *remotep = cupsGetOption("BrowseRemoteProtocols",
num_settings, settings);
if (!localp)
if (!localp || !localp[0])
localp = cupsGetOption("BrowseLocalProtocols", cupsd_num_settings,
cupsd_settings);
@@ -1709,7 +1702,8 @@ _cupsAdminSetServerSettings(
cupsFilePrintf(temp, " Allow %s\n",
remote_any > 0 ? "all" : "@LOCAL");
}
else if (in_root_location && (remote_admin >= 0 || share_printers >= 0))
else if (in_root_location &&
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
{
wrote_root_location = 1;
@@ -1720,12 +1714,14 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, " # Allow remote administration...\n");
else if (share_printers > 0)
cupsFilePuts(temp, " # Allow shared printing...\n");
else if (remote_any > 0)
cupsFilePuts(temp, " # Allow remote access...\n");
else
cupsFilePuts(temp, " # Restrict access to the server...\n");
cupsFilePuts(temp, " Order allow,deny\n");
if (remote_admin > 0 || share_printers > 0)
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
cupsFilePrintf(temp, " Allow %s\n",
remote_any > 0 ? "all" : "@LOCAL");
}
@@ -1736,83 +1732,86 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "</Location>\n");
}
else if (!strcasecmp(line, "<Limit") && in_default_policy)
else if (!strcasecmp(line, "<Limit"))
{
/*
* See if the policy limit is for the Cancel-Job operation...
*/
char *valptr; /* Pointer into value */
indent += 2;
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
if (in_default_policy)
{
/*
* Don't write anything for this limit section...
* See if the policy limit is for the Cancel-Job operation...
*/
in_cancel_job = 2;
char *valptr; /* Pointer into value */
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
{
/*
* Don't write anything for this limit section...
*/
in_cancel_job = 2;
}
else
{
cupsFilePrintf(temp, "%*s%s", indent, "", line);
while (*value)
{
for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++);
if (*valptr)
*valptr++ = '\0';
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
{
/*
* Write everything except for this definition...
*/
in_cancel_job = 1;
}
else
cupsFilePrintf(temp, " %s", value);
for (value = valptr; _cups_isspace(*value); value ++);
}
cupsFilePuts(temp, ">\n");
}
}
else
{
cupsFilePrintf(temp, " %s", line);
cupsFilePrintf(temp, "%*s%s %s>\n", indent, "", line, value);
while (*value)
{
for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
if (*valptr)
*valptr++ = '\0';
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
{
/*
* Write everything except for this definition...
*/
in_cancel_job = 1;
}
else
cupsFilePrintf(temp, " %s", value);
for (value = valptr; isspace(*value & 255); value ++);
}
cupsFilePuts(temp, ">\n");
}
indent += 2;
}
else if (!strcasecmp(line, "</Limit>") && in_cancel_job)
{
indent -= 2;
if (in_cancel_job == 1)
cupsFilePuts(temp, " </Limit>\n");
cupsFilePuts(temp, " </Limit>\n");
wrote_policy = 1;
if (!user_cancel_any)
cupsFilePuts(temp, " # Only the owner or an administrator can cancel "
"a job...\n"
" <Limit Cancel-Job>\n"
" Order deny,allow\n"
" Require user @OWNER "
"a job...\n"
" <Limit Cancel-Job>\n"
" Order deny,allow\n"
" Require user @OWNER "
CUPS_DEFAULT_PRINTOPERATOR_AUTH "\n"
" </Limit>\n");
in_cancel_job = 0;
}
else if ((((in_admin_location || in_conf_location || in_root_location) &&
remote_admin >= 0) ||
(remote_admin >= 0 || remote_any > 0)) ||
(in_root_location && share_printers >= 0)) &&
(!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny") ||
!strcasecmp(line, "Order")))
continue;
else if (in_cancel_job == 2)
continue;
else if (!strcasecmp(line, "<Limit") && value)
cupsFilePrintf(temp, " %s %s>\n", line, value);
else if (line[0] == '<')
{
if (value)
@@ -1852,7 +1851,7 @@ _cupsAdminSetServerSettings(
/*
* Record the non-policy, non-location directives that we find
* in the server settings, since we cache this info and record it
* in _cupsAdminGetServerSettings()...
* in cupsAdminGetServerSettings()...
*/
cupsd_num_settings = cupsAddOption(line, value, cupsd_num_settings,
@@ -1910,9 +1909,10 @@ _cupsAdminSetServerSettings(
}
}
if (!wrote_port_listen && (share_printers >= 0 || remote_admin >= 0))
if (!wrote_port_listen &&
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
{
if (share_printers > 0 || remote_admin > 0)
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
{
cupsFilePuts(temp, "# Allow remote access\n");
cupsFilePrintf(temp, "Port %d\n", ippPort());
@@ -1930,7 +1930,8 @@ _cupsAdminSetServerSettings(
#endif /* CUPS_DEFAULT_DOMAINSOCKET */
}
if (!wrote_root_location && (remote_admin >= 0 || share_printers >= 0))
if (!wrote_root_location &&
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
{
if (remote_admin > 0 && share_printers > 0)
cupsFilePuts(temp,
@@ -1939,13 +1940,15 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "# Allow remote administration...\n");
else if (share_printers > 0)
cupsFilePuts(temp, "# Allow shared printing...\n");
else if (remote_any > 0)
cupsFilePuts(temp, "# Allow remote access...\n");
else
cupsFilePuts(temp, "# Restrict access to the server...\n");
cupsFilePuts(temp, "<Location />\n"
" Order allow,deny\n");
if (remote_admin > 0 || share_printers > 0)
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
cupsFilePrintf(temp, " Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
cupsFilePuts(temp, "</Location>\n");
@@ -2034,6 +2037,8 @@ _cupsAdminSetServerSettings(
for (i = num_settings, setting = settings; i > 0; i --, setting ++)
if (setting->name[0] != '_' &&
strcasecmp(setting->name, "Listen") &&
strcasecmp(setting->name, "Port") &&
!cupsGetOption(setting->name, cupsd_num_settings, cupsd_settings))
{
/*
@@ -2173,18 +2178,23 @@ do_samba_command(const char *command, /* I - Command to run */
* Child goes here, redirect stdin/out/err and execute the command...
*/
close(0);
open("/dev/null", O_RDONLY);
int fd = open("/dev/null", O_RDONLY);
close(1);
if (fd > 0)
{
dup2(fd, 0);
close(fd);
}
if (logfile)
dup(fileno(logfile));
else
open("/dev/null", O_WRONLY);
dup2(fileno(logfile), 1);
else if ((fd = open("/dev/null", O_WRONLY)) > 1)
{
dup2(fd, 1);
close(fd);
}
close(2);
dup(1);
dup2(1, 2);
execlp(command, command, address, "-N", "-A", authfile, "-c", subcmd,
(char *)0);
+2 -6
Ver Arquivo
@@ -1,13 +1,9 @@
/*
* "$Id$"
*
* Administration utility API definitions for the Common UNIX Printing
* System (CUPS).
* Administration utility API definitions for CUPS.
*
* MANY OF THE FUNCTIONS IN THIS HEADER ARE PRIVATE AND SUBJECT TO
* CHANGE AT ANY TIME. USE AT YOUR OWN RISK.
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
"$Id: api-array.shtml 9728 2011-04-28 21:21:24Z mike $"
Array API introduction for the Common UNIX Printing System (CUPS).
Array API introduction for CUPS.
Copyright 2007-2008 by Apple Inc.
Copyright 2007-2011 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
+8 -7
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-cups.shtml 7337 2008-02-22 04:44:04Z mike $"
"$Id: api-cups.shtml 9728 2011-04-28 21:21:24Z mike $"
CUPS API introduction for the Common UNIX Printing System (CUPS).
API introduction for CUPS.
Copyright 2007-2008 by Apple Inc.
Copyright 2007-2011 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -50,7 +50,7 @@ specific destination for printing:</p>
int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&amp;dests);
<a href='#cups_dest_t'>cups_dest_t</a> *dest = <a href='#cupsGetDest'>cupsGetDest</a>("name", NULL, num_dests, dests);
/* do something wiith dest */
/* do something with dest */
<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
</pre>
@@ -82,12 +82,13 @@ instance will return the default instance for that destination.</p>
</tr>
<tr>
<td>"printer-is-accepting-jobs"</td>
<td>"1" if the destination is accepting new jobs, "0" if not.</td>
<td>"true" if the destination is accepting new jobs, "false" if
not.</td>
</tr>
<tr>
<td>"printer-is-shared"</td>
<td>"1" if the destination is being shared with other computers, "0" if
not.</td>
<td>"true" if the destination is being shared with other computers,
"false" if not.</td>
</tr>
<tr>
<td>"printer-location"</td>
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
"$Id: api-filedir.shtml 9728 2011-04-28 21:21:24Z mike $"
File and directory API introduction for the Common UNIX Printing System (CUPS).
File and directory API introduction for CUPS.
Copyright 2007-2008 by Apple Inc.
Copyright 2007-2011 by Apple Inc.
Copyright 1997-2005 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
+4 -2
Ver Arquivo
@@ -1,5 +1,5 @@
<!--
"$Id: api-filter.header 8627 2009-05-13 21:39:17Z mike $"
"$Id: api-filter.header 9272 2010-08-27 16:51:43Z mike $"
Filter and backend programming header for the Common UNIX Printing System
(CUPS).
@@ -34,7 +34,9 @@
Programming: <a href='api-cups.html' target='_top'>CUPS API</a><br>
Programming: <a href='api-ppd.html' target='_top'>PPD API</a><br>
Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
Specifications: <a href='spec-design' target='_top'>CUPS Design Description</a></td>
Programming: <a href='postscript-driver.html' target='_top'>Developing PostScript Printer Drivers</a><br>
Programming: <a href='raster-driver.html' target='_top'>Developing Raster Printer Drivers</a><br>
Specifications: <a href='spec-design.html' target='_top'>CUPS Design Description</a></td>
</tr>
</tbody>
</table></div>
+21 -13
Ver Arquivo
@@ -1,5 +1,5 @@
<!--
"$Id: api-filter.shtml 8628 2009-05-13 22:25:34Z mike $"
"$Id: api-filter.shtml 9728 2011-04-28 21:21:24Z mike $"
Filter and backend programming introduction for the Common UNIX Printing
System (CUPS).
@@ -58,7 +58,7 @@ more detail.</p>
<h3><a name="SECURITY">Security Considerations</a></h3>
<p>It is always important to use security programming practices. Filters and
most backends are run as a non-priviledged user, so the major security
most backends are run as a non-privileged user, so the major security
consideration is resource utilization - filters should not depend on unlimited
amounts of CPU, memory, or disk space, and should protect against conditions
that could lead to excess usage of any resource like infinite loops and
@@ -67,7 +67,7 @@ specify an arbitrary file path to a separator page, template, or other file
used by the filter since that can lead to an unauthorized disclosure of
information. <em>Always</em> treat input as suspect and validate it!</p>
<p>If you are developing a backend that runs as root , make sure to check for
<p>If you are developing a backend that runs as root, make sure to check for
potential buffer overflows, integer under/overflow conditions, and file
accesses since these can lead to privilege escalations. When writing files,
always validate the file path and <em>never</em> allow a user to determine
@@ -88,15 +88,15 @@ Mac OS X, for example, no backend may write to a user's home directory.</p>
<h3><a name="PERMISSIONS">File Permissions</a></h3>
<p>For security reasons, CUPS will only run filters and backends that are owned
by root and do not have world write permissions. The recommended permissions for
filters and backends are 0555 - read and execute but no write. Backends that
must run as root should use permissions of 0500 - read and execute by root, no
access for other users. Write permissions can be enabled for the root user
only.</p>
by root and do not have world or group write permissions. The recommended
permissions for filters and backends are 0555 - read and execute but no write.
Backends that must run as root should use permissions of 0500 - read and execute
by root, no access for other users. Write permissions can be enabled for the
root user only.</p>
<p>To avoid a warning message, the directory containing your filter(s) must also
be owned by root and have world write disabled - permissions of 0755 or 0555 are
strongly encouraged.</p>
be owned by root and have world and group write disabled - permissions of 0755
or 0555 are strongly encouraged.</p>
<h3><a name="TEMPFILES">Temporary Files</a></h3>
@@ -127,7 +127,7 @@ when running print filters and backends:</p>
<dl class="code">
<dt>APPLE_LANGUAGES</dt>
<dt>APPLE_LANGUAGE</dt>
<dd>The Apple language identifier associated with the job
(Mac OS X only).</dd>
@@ -264,7 +264,16 @@ prefix strings:</p>
current queue. Typically this is used to indicate persistent media,
ink, toner, and configuration conditions or errors on a printer.
<a href='#TABLE2'>Table 2</a> lists the standard state keywords -
use vendor-prefixed ("com.acme.foo") keywords for custom states.</dd>
use vendor-prefixed ("com.acme.foo") keywords for custom states.
<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 "-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>
</blockquote></dd>
<dt>WARNING: message</dt>
<dd>Sets the printer-state-message attribute and adds the specified
@@ -276,7 +285,6 @@ prefix strings:</p>
<p>Messages without one of these prefixes are treated as if they began with
the "DEBUG:" prefix string.</p>
<div class='table'><table width='80%' summary='Table 1: Standard marker-types Values'>
<caption>Table 1: <a name='TABLE1'>Standard marker-types Values</a></caption>
<thead>
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-httpipp.shtml 7684 2008-06-23 16:47:38Z mike $"
"$Id: api-httpipp.shtml 9728 2011-04-28 21:21:24Z mike $"
HTTP and IPP API introduction for the Common UNIX Printing System (CUPS).
HTTP and IPP API introduction for CUPS.
Copyright 2007-2008 by Apple Inc.
Copyright 2007-2011 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
+2 -3
Ver Arquivo
@@ -1,10 +1,9 @@
<!--
"$Id: api-cups.header 7279 2008-01-31 01:50:44Z mike $"
Introduction to CUPS programming content for the Common UNIX Printing System
(CUPS).
Introduction to CUPS programming content for CUPS.
Copyright 2008 by Apple Inc.
Copyright 2008-2011 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-ppd.shtml 7616 2008-05-28 00:34:13Z mike $"
"$Id: api-ppd.shtml 9728 2011-04-28 21:21:24Z mike $"
PPD API introduction for the Common UNIX Printing System (CUPS).
PPD API introduction for CUPS.
Copyright 2007-2008 by Apple Inc.
Copyright 2007-2011 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
+11 -9
Ver Arquivo
@@ -4,7 +4,7 @@
* PPD model-specific attribute routines for the Common UNIX Printing System
* (CUPS).
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -15,8 +15,10 @@
*
* Contents:
*
* ppdFindAttr() - Find the first matching attribute.
* ppdFindNextAttr() - Find the next matching attribute.
* ppdFindAttr() - Find the first matching attribute.
* ppdFindNextAttr() - Find the next matching attribute.
* _ppdGet1284Values() - Get 1284 device ID keys and values.
* _ppdNormalizeMakeAndModel() - Normalize a product/make-and-model string.
*/
/*
@@ -178,7 +180,7 @@ _ppdGet1284Values(
num_values = 0;
while (*device_id)
{
while (isspace(*device_id & 255))
while (_cups_isspace(*device_id))
device_id ++;
if (!*device_id)
@@ -191,13 +193,13 @@ _ppdGet1284Values(
if (!*device_id)
break;
while (ptr > key && isspace(ptr[-1] & 255))
while (ptr > key && _cups_isspace(ptr[-1]))
ptr --;
*ptr = '\0';
device_id ++;
while (isspace(*device_id & 255))
while (_cups_isspace(*device_id))
device_id ++;
if (!*device_id)
@@ -210,7 +212,7 @@ _ppdGet1284Values(
if (!*device_id)
break;
while (ptr > value && isspace(ptr[-1] & 255))
while (ptr > value && _cups_isspace(ptr[-1]))
ptr --;
*ptr = '\0';
@@ -251,7 +253,7 @@ _ppdNormalizeMakeAndModel(
* Skip leading whitespace...
*/
while (isspace(*make_and_model & 255))
while (_cups_isspace(*make_and_model))
make_and_model ++;
/*
@@ -406,7 +408,7 @@ _ppdNormalizeMakeAndModel(
*/
for (bufptr = buffer + strlen(buffer) - 1;
bufptr >= buffer && isspace(*bufptr & 255);
bufptr >= buffer && _cups_isspace(*bufptr);
bufptr --);
bufptr[1] = '\0';
+16 -15
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Authentication functions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* This file contains Kerberos support code, copyright 2006 by
@@ -98,10 +98,6 @@ cupsDoAuthentication(
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")",
http, method, resource));
DEBUG_printf(("2cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"",
http->digest_tries, http->userpass));
DEBUG_printf(("2cupsDoAuthentication: WWW-Authenticate=\"%s\"",
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE)));
if (!http)
http = _cupsConnect();
@@ -109,6 +105,11 @@ cupsDoAuthentication(
if (!http || !method || !resource)
return (-1);
DEBUG_printf(("2cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"",
http->digest_tries, http->userpass));
DEBUG_printf(("2cupsDoAuthentication: WWW-Authenticate=\"%s\"",
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE)));
/*
* Clear the current authentication string...
*/
@@ -181,6 +182,15 @@ cupsDoAuthentication(
else if (http->status == HTTP_UNAUTHORIZED)
http->digest_tries ++;
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
{
DEBUG_printf(("1cupsDoAuthentication: Too many authentication tries (%d)",
http->digest_tries));
http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
}
/*
* Got a password; encode it for the server...
*/
@@ -222,15 +232,6 @@ cupsDoAuthentication(
}
# endif /* __APPLE__ */
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
{
DEBUG_printf(("1cupsDoAuthentication: too many Negotiate tries (%d)",
http->digest_tries));
http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
}
if (http->gssname == GSS_C_NO_NAME)
{
if ((gss_service_name = getenv("CUPS_GSSSERVICENAME")) == NULL)
@@ -250,7 +251,7 @@ cupsDoAuthentication(
authorization = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
authorization += 9;
while (*authorization && isspace(*authorization & 255))
while (*authorization && _cups_isspace(*authorization))
authorization ++;
if (*authorization)
+12
Ver Arquivo
@@ -26,6 +26,14 @@
# include "versioning.h"
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Constants...
*/
@@ -57,6 +65,10 @@ extern void cupsBackendReport(const char *device_scheme,
_CUPS_API_1_4;
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_BACKEND_H_ */
/*
+20 -16
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Option marking routines for the Common UNIX Printing System (CUPS).
* Option marking routines for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -290,25 +290,25 @@ cupsResolveConflicts(
for (resval = resolver->value; *resval && !changed;)
{
while (isspace(*resval & 255))
while (_cups_isspace(*resval))
resval ++;
if (*resval != '*')
break;
for (resval ++, resptr = resoption;
*resval && !isspace(*resval & 255);
*resval && !_cups_isspace(*resval);
resval ++)
if (resptr < (resoption + sizeof(resoption) - 1))
*resptr++ = *resval;
*resptr = '\0';
while (isspace(*resval & 255))
while (_cups_isspace(*resval))
resval ++;
for (resptr = reschoice;
*resval && !isspace(*resval & 255);
*resval && !_cups_isspace(*resval);
resval ++)
if (resptr < (reschoice + sizeof(reschoice) - 1))
*resptr++ = *resval;
@@ -483,13 +483,13 @@ cupsResolveConflicts(
}
}
}
}
if (!changed)
{
DEBUG_puts("1ppdResolveConflicts: Unable to automatically resolve "
"constraint!");
goto error;
}
if (!changed)
{
DEBUG_puts("1ppdResolveConflicts: Unable to automatically resolve "
"constraint!");
goto error;
}
cupsArrayClear(pass);
@@ -583,9 +583,13 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
* Clear all conflicts...
*/
cupsArraySave(ppd->options);
for (o = ppdFirstOption(ppd); o; o = ppdNextOption(ppd))
o->conflicted = 0;
cupsArrayRestore(ppd->options);
/*
* Test for conflicts...
*/
@@ -641,7 +645,7 @@ ppdInstallableConflict(
DEBUG_printf(("2ppdInstallableConflict(ppd=%p, option=\"%s\", choice=\"%s\")",
ppd, option, choice));
/*
/*
* Range check input...
*/
@@ -883,20 +887,20 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
* Extract "*Option Choice" or just "*Option"...
*/
for (vptr ++, ptr = option; *vptr && !isspace(*vptr & 255); vptr ++)
for (vptr ++, ptr = option; *vptr && !_cups_isspace(*vptr); vptr ++)
if (ptr < (option + sizeof(option) - 1))
*ptr++ = *vptr;
*ptr = '\0';
while (isspace(*vptr & 255))
while (_cups_isspace(*vptr))
vptr ++;
if (*vptr == '*')
choice[0] = '\0';
else
{
for (ptr = choice; *vptr && !isspace(*vptr & 255); vptr ++)
for (ptr = choice; *vptr && !_cups_isspace(*vptr); vptr ++)
if (ptr < (choice + sizeof(choice) - 1))
*ptr++ = *vptr;
+9 -7
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* API definitions for the Common UNIX Printing System (CUPS).
* API definitions for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -25,10 +25,12 @@
# include <sys/types.h>
# if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
# define __CUPS_SSIZE_T_DEFINED
# include <stddef.h>
/* Windows does not support the ssize_t type, so map it to off_t... */
typedef off_t ssize_t; /* @private@ */
# endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */
# include "file.h"
# include "ipp.h"
# include "ppd.h"
# include "language.h"
@@ -59,10 +61,10 @@ extern "C" {
* Constants...
*/
# define CUPS_VERSION 1.0400
# define CUPS_VERSION 1.0408
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 4
# define CUPS_VERSION_PATCH -1
# define CUPS_VERSION_PATCH 8
# define CUPS_BC_FD 3 /* Back-channel file descriptor for select/poll */
# define CUPS_DATE_ANY (time_t)-1
@@ -253,7 +255,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 ****/
/**** New in CUPS 1.2/Mac 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,
@@ -268,7 +270,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 ****/
/**** New in CUPS 1.3/Mac 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;
@@ -281,7 +283,7 @@ extern void cupsSetDefaultDest(const char *name,
int num_dests,
cups_dest_t *dests) _CUPS_API_1_3;
/**** New in CUPS 1.4 ****/
/**** New in CUPS 1.4/Mac 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,
+10 -5
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* PPD custom option routines for the Common UNIX Printing System (CUPS).
* PPD custom option routines for CUPS.
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -70,14 +70,19 @@ ppd_cparam_t * /* O - Custom parameter or NULL */
ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
const char *name) /* I - Parameter name */
{
ppd_cparam_t key; /* Custom parameter search key */
ppd_cparam_t *param; /* Current custom parameter */
if (!opt)
return (NULL);
strlcpy(key.name, name, sizeof(key.name));
return ((ppd_cparam_t *)cupsArrayFind(opt->params, &key));
for (param = (ppd_cparam_t *)cupsArrayFirst(opt->params);
param;
param = (ppd_cparam_t *)cupsArrayNext(opt->params))
if (!strcasecmp(param->name, name))
break;
return (param);
}
+32 -12
Ver Arquivo
@@ -33,7 +33,6 @@
* server.
* appleCopyLocations() - Copy the location history array.
* appleCopyNetwork() - Get the network ID for the current location.
* appleGetDefault() - Get the default printer for this location.
* appleGetPaperSize() - Get the default paper size.
* appleGetPrinter() - Get a printer from the history array.
* appleSetDefault() - Set the default printer for this location.
@@ -54,7 +53,7 @@
#include "debug.h"
#include "globals.h"
#include "pwgmedia.h"
#include "pwg-private.h"
#include <stdlib.h>
#include <ctype.h>
#include <sys/stat.h>
@@ -139,12 +138,17 @@ cupsAddDest(const char *name, /* I - Destination name */
if (!cupsGetDest(name, instance, num_dests, *dests))
{
if (instance &&
(parent = cupsGetDest(name, NULL, num_dests, *dests)) == NULL)
if (instance && !cupsGetDest(name, NULL, num_dests, *dests))
return (num_dests);
dest = cups_add_dest(name, instance, &num_dests, dests);
/*
* Find the base dest again now the array has been realloc'd.
*/
parent = cupsGetDest(name, NULL, num_dests, *dests);
if (instance && parent && parent->num_options > 0)
{
/*
@@ -505,7 +509,19 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
set_as_default = 1;
name = _cupsUserDefault(defname, sizeof(defname));
if (!name && home)
if (name)
{
char *ptr; /* Temporary pointer... */
if ((ptr = strchr(defname, '/')) != NULL)
{
*ptr++ = '\0';
instance = ptr;
}
else
instance = NULL;
}
else if (home)
{
/*
* No default in the environment, try the user's lpoptions files...
@@ -549,7 +565,7 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
if (!cups_get_sdests(http, op, name, 0, &dest))
{
if (op == CUPS_GET_DEFAULT)
if (op == CUPS_GET_DEFAULT || (name && !set_as_default))
return (NULL);
/*
@@ -557,7 +573,7 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
* configuration file does not exist. Find out the real default.
*/
if (!cups_get_sdests(http, CUPS_GET_DEFAULT, name, 0, &dest))
if (!cups_get_sdests(http, CUPS_GET_DEFAULT, NULL, 0, &dest))
return (NULL);
}
@@ -1109,8 +1125,8 @@ static char * /* O - Default paper size */
appleGetPaperSize(char *name, /* I - Paper size name buffer */
int namesize) /* I - Size of buffer */
{
CFStringRef defaultPaperID; /* Default paper ID */
_cups_pwg_media_t *pwgmedia; /* PWG media size */
CFStringRef defaultPaperID; /* Default paper ID */
_pwg_media_t *pwgmedia; /* PWG media size */
defaultPaperID = CFPreferencesCopyAppValue(kDefaultPaperIDKey,
@@ -1120,7 +1136,7 @@ appleGetPaperSize(char *name, /* I - Paper size name buffer */
!CFStringGetCString(defaultPaperID, name, namesize,
kCFStringEncodingUTF8))
name[0] = '\0';
else if ((pwgmedia = _cupsPWGMediaByLegacy(name)) != NULL)
else if ((pwgmedia = _pwgMediaForLegacy(name)) != NULL)
strlcpy(name, pwgmedia->pwg, namesize);
if (defaultPaperID)
@@ -1230,7 +1246,8 @@ appleSetDefault(const char *name) /* I - Default printer/class name */
CFArrayRemoveValueAtIndex(newlocations, locindex);
}
else
newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeArrayCallBacks);
newlocation = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeDictionaryKeyCallBacks,
@@ -1288,6 +1305,9 @@ appleUseLastPrinter(void)
CFPropertyListRef uselast; /* Use last printer preference value */
if (getenv("CUPS_DISABLE_APPLE_DEFAULT"))
return (0);
if ((uselast = CFPreferencesCopyAppValue(kUseLastPrinterAsCurrentPrinterKey,
kPMPrintingPreferences)) != NULL)
{
@@ -1800,7 +1820,7 @@ cups_get_sdests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFA
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
if (name)
if (name && op != CUPS_GET_DEFAULT)
{
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", ippPort(), "/printers/%s", name);
+27 -14
Ver Arquivo
@@ -484,7 +484,8 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
*/
for (title += 7; *title && isdigit(*title & 255); title ++);
for (; *title && isspace(*title & 255); title ++);
while (_cups_isspace(*title))
title ++;
if ((ptr = strstr(title, " - ")) != NULL)
{
@@ -683,7 +684,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
bufsize += strlen(cparam->current.custom_string);
if (cparam->current.custom_string)
bufsize += strlen(cparam->current.custom_string);
break;
}
}
@@ -728,7 +730,9 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
bufsize += 3 + 4 * strlen(cparam->current.custom_string);
bufsize += 3;
if (cparam->current.custom_string)
bufsize += 4 * strlen(cparam->current.custom_string);
break;
}
}
@@ -772,6 +776,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
if (section == PPD_ORDER_JCL)
{
if (!strcasecmp(choices[i]->choice, "Custom") &&
choices[i]->code &&
(coption = ppdFindCustomOption(ppd, choices[i]->option->keyword))
!= NULL)
{
@@ -796,8 +801,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
*/
pnum = *cptr++ - '0';
while (isalnum(*cptr & 255))
pnum = pnum * 10 + *cptr - '0';
while (isdigit(*cptr & 255))
pnum = pnum * 10 + *cptr++ - '0';
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
cparam;
@@ -827,9 +832,12 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
strlcpy(bufptr, cparam->current.custom_string,
bufend - bufptr);
bufptr += strlen(bufptr);
if (cparam->current.custom_string)
{
strlcpy(bufptr, cparam->current.custom_string,
bufend - bufptr);
bufptr += strlen(bufptr);
}
break;
}
}
@@ -1032,14 +1040,19 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_STRING :
*bufptr++ = '(';
for (s = cparam->current.custom_string; *s; s ++)
if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
if (cparam->current.custom_string)
{
for (s = cparam->current.custom_string; *s; s ++)
{
snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
bufptr += strlen(bufptr);
if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
{
snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
bufptr += strlen(bufptr);
}
else
*bufptr++ = *s;
}
else
*bufptr++ = *s;
}
*bufptr++ = ')';
*bufptr++ = '\n';
+1
Ver Arquivo
@@ -125,6 +125,7 @@ static const _ipp_option_t ipp_options[] =
{ 0, "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "penwidth-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "port-monitor", IPP_TAG_NAME, IPP_TAG_PRINTER },
{ 0, "ppd-name", IPP_TAG_NAME, IPP_TAG_PRINTER },
{ 0, "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
+114 -8
Ver Arquivo
@@ -8,7 +8,7 @@
* our own file functions allows us to provide transparent support of
* gzip'd print files, PPD files, etc.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -59,6 +59,8 @@
*/
#include "file-private.h"
#include <sys/stat.h>
#include <sys/types.h>
/*
@@ -69,6 +71,7 @@
static ssize_t cups_compress(cups_file_t *fp, const char *buf, size_t bytes);
#endif /* HAVE_LIBZ */
static ssize_t cups_fill(cups_file_t *fp);
static int cups_open(const char *filename, int mode);
static ssize_t cups_read(cups_file_t *fp, char *buf, size_t bytes);
static ssize_t cups_write(cups_file_t *fp, const char *buf, size_t bytes);
@@ -491,7 +494,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
// Strip the comment and any trailing whitespace...
while (ptr > buf)
{
if (!isspace(ptr[-1] & 255))
if (!_cups_isspace(ptr[-1]))
break;
ptr --;
@@ -505,7 +508,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
* Strip leading whitespace...
*/
for (ptr = buf; isspace(*ptr & 255); ptr ++);
for (ptr = buf; _cups_isspace(*ptr); ptr ++);
if (ptr > buf)
_cups_strcpy(buf, ptr);
@@ -521,7 +524,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
*/
for (ptr = buf; *ptr; ptr ++)
if (isspace(*ptr & 255))
if (_cups_isspace(*ptr))
break;
if (*ptr)
@@ -530,7 +533,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
* Have a value, skip any other spaces...
*/
while (isspace(*ptr & 255))
while (_cups_isspace(*ptr))
*ptr++ = '\0';
if (*ptr)
@@ -554,7 +557,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
return (buf);
}
while (ptr > *value && isspace(*ptr & 255))
while (ptr > *value && _cups_isspace(*ptr))
*ptr-- = '\0';
}
@@ -827,7 +830,8 @@ cupsFileOpen(const char *filename, /* I - Name of file */
switch (*mode)
{
case 'a' : /* Append file */
fd = open(filename, O_RDWR | O_CREAT | O_APPEND | O_LARGEFILE | O_BINARY, 0666);
fd = cups_open(filename,
O_RDWR | O_CREAT | O_APPEND | O_LARGEFILE | O_BINARY);
break;
case 'r' : /* Read file */
@@ -835,7 +839,21 @@ cupsFileOpen(const char *filename, /* I - Name of file */
break;
case 'w' : /* Write file */
fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT | O_LARGEFILE | O_BINARY, 0666);
fd = cups_open(filename, O_WRONLY | O_LARGEFILE | O_BINARY);
if (fd < 0 && errno == ENOENT)
{
fd = cups_open(filename,
O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE | O_BINARY);
if (fd < 0 && errno == EEXIST)
fd = cups_open(filename, O_WRONLY | O_LARGEFILE | O_BINARY);
}
if (fd >= 0)
#ifdef WIN32
_chsize(fd, 0);
#else
ftruncate(fd, 0);
#endif /* WIN32 */
break;
case 's' : /* Read/write socket */
@@ -2208,6 +2226,94 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
}
/*
* 'cups_open()' - Safely open a file for writing.
*
* We don't allow appending to directories or files that are hard-linked or
* symlinked.
*/
static int /* O - File descriptor or -1 otherwise */
cups_open(const char *filename, /* I - Filename */
int mode) /* I - Open mode */
{
int fd; /* File descriptor */
struct stat fileinfo; /* File information */
#ifndef WIN32
struct stat linkinfo; /* Link information */
#endif /* !WIN32 */
/*
* Open the file...
*/
if ((fd = open(filename, mode, 0666)) < 0)
return (-1);
/*
* Then verify that the file descriptor doesn't point to a directory or hard-
* linked file.
*/
if (fstat(fd, &fileinfo))
{
close(fd);
return (-1);
}
if (fileinfo.st_nlink != 1)
{
close(fd);
errno = EPERM;
return (-1);
}
#ifdef WIN32
if (fileinfo.st_mode & _S_IFDIR)
#else
if (S_ISDIR(fileinfo.st_mode))
#endif /* WIN32 */
{
close(fd);
errno = EISDIR;
return (-1);
}
#ifndef WIN32
/*
* Then use lstat to determine whether the filename is a symlink...
*/
if (lstat(filename, &linkinfo))
{
close(fd);
return (-1);
}
if (S_ISLNK(linkinfo.st_mode) ||
fileinfo.st_dev != linkinfo.st_dev ||
fileinfo.st_ino != linkinfo.st_ino ||
#ifdef HAVE_ST_GEN
fileinfo.st_gen != linkinfo.st_gen ||
#endif /* HAVE_ST_GEN */
fileinfo.st_nlink != linkinfo.st_nlink ||
fileinfo.st_mode != linkinfo.st_mode)
{
/*
* Yes, don't allow!
*/
close(fd);
errno = EPERM;
return (-1);
}
#endif /* !WIN32 */
return (fd);
}
/*
* 'cups_read()' - Read from a file descriptor.
*/
+1
Ver Arquivo
@@ -27,6 +27,7 @@
*/
# include "versioning.h"
# include <stddef.h>
# include <sys/types.h>
# if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
# define __CUPS_SSIZE_T_DEFINED
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* cupsGetDevices implementation for the Common UNIX Printing System (CUPS).
*
* Copyright 2008-2009 by Apple Inc.
* Copyright 2008-2010 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -258,7 +258,7 @@ cupsGetDevices(
httpBlocking(http, blocking);
httpFlush(http);
if (status == IPP_ERROR)
if (status == HTTP_ERROR)
_cupsSetError(IPP_ERROR, NULL, 0);
else
{
+40 -11
Ver Arquivo
@@ -38,20 +38,46 @@
static void
cups_env_init(_cups_globals_t *g) /* I - Global data */
{
if ((g->cups_datadir = getenv("CUPS_DATADIR")) == NULL)
g->cups_datadir = CUPS_DATADIR;
#ifndef WIN32
# ifdef HAVE_GETEUID
if ((geteuid() != getuid() && getuid()) || getegid() != getgid())
# else
if (!getuid())
# endif /* HAVE_GETEUID */
{
/*
* When running setuid/setgid, don't allow environment variables to override
* the directories...
*/
if ((g->cups_serverbin = getenv("CUPS_SERVERBIN")) == NULL)
g->cups_serverbin = CUPS_SERVERBIN;
if ((g->cups_serverroot = getenv("CUPS_SERVERROOT")) == NULL)
g->cups_datadir = CUPS_DATADIR;
g->cups_serverbin = CUPS_SERVERBIN;
g->cups_serverroot = CUPS_SERVERROOT;
g->cups_statedir = CUPS_STATEDIR;
g->localedir = CUPS_LOCALEDIR;
}
else
#endif /* !WIN32 */
{
/*
* Allow directories to be overridden by environment variables.
*/
if ((g->cups_statedir = getenv("CUPS_STATEDIR")) == NULL)
g->cups_statedir = CUPS_STATEDIR;
if ((g->cups_datadir = getenv("CUPS_DATADIR")) == NULL)
g->cups_datadir = CUPS_DATADIR;
if ((g->localedir = getenv("LOCALEDIR")) == NULL)
g->localedir = CUPS_LOCALEDIR;
if ((g->cups_serverbin = getenv("CUPS_SERVERBIN")) == NULL)
g->cups_serverbin = CUPS_SERVERBIN;
if ((g->cups_serverroot = getenv("CUPS_SERVERROOT")) == NULL)
g->cups_serverroot = CUPS_SERVERROOT;
if ((g->cups_statedir = getenv("CUPS_STATEDIR")) == NULL)
g->cups_statedir = CUPS_STATEDIR;
if ((g->localedir = getenv("LOCALEDIR")) == NULL)
g->localedir = CUPS_LOCALEDIR;
}
}
@@ -159,7 +185,9 @@ globals_destructor(void *value) /* I - Data to free */
if (cg->last_status_message)
_cupsStrFree(cg->last_status_message);
# ifndef CUPS_LITE
cupsFreeOptions(cg->cupsd_num_settings, cg->cupsd_settings);
# endif /* !CUPS_LITE */
for (buffer = cg->ipp_buffers; buffer; buffer = next)
{
@@ -167,8 +195,9 @@ globals_destructor(void *value) /* I - Data to free */
free(buffer);
}
cupsArrayDelete(cg->pwg_size_lut);
cupsArrayDelete(cg->leg_size_lut);
cupsArrayDelete(cg->ppd_size_lut);
cupsArrayDelete(cg->pwg_size_lut);
free(value);
}
+8 -3
Ver Arquivo
@@ -26,6 +26,8 @@
# include "http-private.h"
# include "cups.h"
# include "i18n.h"
# include "ppd-private.h"
# include "pwg-private.h"
# ifdef HAVE_PTHREAD_H
# include <pthread.h>
@@ -103,9 +105,12 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
int ppd_line; /* Current line number */
ppd_conform_t ppd_conform; /* Level of conformance required */
/* pwgmedia.c */
cups_array_t *pwg_size_lut, /* Lookup table for PWG names */
*leg_size_lut; /* Lookup table for legacy names */
/* pwg-media.c */
cups_array_t *leg_size_lut, /* Lookup table for legacy names */
*ppd_size_lut, /* Lookup table for PPD names */
*pwg_size_lut; /* Lookup table for PWG names */
_pwg_media_t pwg_media; /* PWG media data for custom size */
char pwg_name[65]; /* PWG media name for custom size */
/* snmp.c */
char snmp_community[255];
+34 -22
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* HTTP address routines for the Common UNIX Printing System (CUPS).
* HTTP address routines for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -358,8 +358,11 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
#ifdef AF_INET6
else if (addr->addr.sa_family == AF_INET6)
{
char *sptr, /* Pointer into string */
temps[64]; /* Temporary string for address */
# ifdef HAVE_GETNAMEINFO
if (getnameinfo(&addr->addr, httpAddrLength(addr), s, slen,
if (getnameinfo(&addr->addr, httpAddrLength(addr), temps, sizeof(temps),
NULL, 0, NI_NUMERICHOST))
{
/*
@@ -371,29 +374,36 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
return (NULL);
}
else if ((sptr = strchr(temps, '%')) != NULL)
{
/*
* Convert "%zone" to "+zone" to match URI form...
*/
*sptr = '+';
}
# else
char *sptr; /* Pointer into string */
int i; /* Looping var */
unsigned temp; /* Current value */
const char *prefix; /* Prefix for address */
prefix = "";
for (sptr = s, i = 0; i < 4 && addr->ipv6.sin6_addr.s6_addr32[i]; i ++)
for (sptr = temps, i = 0; i < 4 && addr->ipv6.sin6_addr.s6_addr32[i]; i ++)
{
temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]);
snprintf(sptr, slen, "%s%x", prefix, (temp >> 16) & 0xffff);
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
(temp >> 16) & 0xffff);
prefix = ":";
slen -= strlen(sptr);
sptr += strlen(sptr);
temp &= 0xffff;
if (temp || i == 3 || addr->ipv6.sin6_addr.s6_addr32[i + 1])
{
snprintf(sptr, slen, "%s%x", prefix, temp);
slen -= strlen(sptr);
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix, temp);
sptr += strlen(sptr);
}
}
@@ -405,24 +415,24 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
if (i < 4)
{
snprintf(sptr, slen, "%s:", prefix);
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s:", prefix);
prefix = ":";
slen -= strlen(sptr);
sptr += strlen(sptr);
for (; i < 4; i ++)
{
temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]);
if ((temp & 0xffff0000) || addr->ipv6.sin6_addr.s6_addr32[i - 1])
if ((temp & 0xffff0000) ||
(i > 0 && addr->ipv6.sin6_addr.s6_addr32[i - 1]))
{
snprintf(sptr, slen, "%s%x", prefix, (temp >> 16) & 0xffff);
slen -= strlen(sptr);
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
(temp >> 16) & 0xffff);
sptr += strlen(sptr);
}
snprintf(sptr, slen, "%s%x", prefix, temp & 0xffff);
slen -= strlen(sptr);
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
temp & 0xffff);
sptr += strlen(sptr);
}
}
@@ -432,9 +442,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
* Empty address...
*/
strlcpy(s, "::", slen);
sptr = s + 2;
slen -= 2;
strlcpy(temps, "::", sizeof(temps));
}
else
{
@@ -442,12 +450,16 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
* Empty at end...
*/
strlcpy(sptr, "::", slen);
sptr += 2;
slen -= 2;
strlcpy(sptr, "::", sizeof(temps) - (sptr - temps));
}
}
# endif /* HAVE_GETNAMEINFO */
/*
* Add "[v1." and "]" around IPv6 address to convert to URI form.
*/
snprintf(s, slen, "[v1.%s]", temps);
}
#endif /* AF_INET6 */
else
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* HTTP address list routines for the Common UNIX Printing System (CUPS).
* HTTP address list routines for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -271,7 +271,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
struct addrinfo hints, /* Address lookup hints */
*results, /* Address lookup results */
*current; /* Current result */
char ipv6[1024], /* IPv6 address */
char ipv6[64], /* IPv6 address */
*ipv6zone; /* Pointer to zone separator */
int ipv6len; /* Length of IPv6 address */
int error; /* getaddrinfo() error */
+4 -2
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Private HTTP definitions for the Common UNIX Printing System (CUPS).
* Private HTTP definitions for CUPS.
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -98,6 +98,7 @@ extern BIO_METHOD *_httpBIOMethods(void);
* The GNU TLS library is more of a "bare metal" SSL/TLS library...
*/
# include <gnutls/gnutls.h>
# include <gcrypt.h>
typedef struct
{
@@ -268,6 +269,7 @@ extern char *_httpEncodeURI(char *dst, const char *src,
size_t dstsize);
extern const char *_httpResolveURI(const char *uri, char *resolved_uri,
size_t resolved_size, int log);
extern int _httpUpdate(http_t *http, http_status_t *status);
extern int _httpWait(http_t *http, int msec, int usessl);
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
+64 -21
Ver Arquivo
@@ -50,6 +50,7 @@
#include "debug.h"
#include "globals.h"
#include <stdlib.h>
#include <errno.h>
#ifdef HAVE_DNSSD
# include <dns_sd.h>
# include <poll.h>
@@ -916,7 +917,9 @@ httpSeparateURI(
for (ptr = scheme, end = scheme + schemelen - 1;
*uri && *uri != ':' && ptr < end;)
if (isalnum(*uri & 255) || *uri == '-' || *uri == '+' || *uri == '.')
if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789-+.", *uri) != NULL)
*ptr++ = *uri++;
else
break;
@@ -1352,7 +1355,8 @@ _httpResolveURI(
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? */
int domainsent = 0, /* Send the domain resolve? */
offline = 0; /* offline-report state set? */
char *regtype, /* Pointer to type in hostname */
*domain; /* Pointer to domain in hostname */
_http_uribuf_t uribuf; /* URI buffer */
@@ -1406,7 +1410,6 @@ _httpResolveURI(
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Resolving \"%s\", regtype=\"%s\", "
"domain=\"local.\"...\n", hostname, regtype);
_cupsLangPuts(stderr, _("INFO: Looking for printer...\n"));
}
uri = NULL;
@@ -1418,36 +1421,76 @@ _httpResolveURI(
hostname, regtype, "local.", resolve_callback,
&uribuf) == kDNSServiceErr_NoError)
{
if (strcasecmp(domain, "local."))
int fds; /* Number of ready descriptors */
time_t timeout, /* Poll timeout */
start_time = time(NULL);/* Start time */
for (;;)
{
if (logit)
_cupsLangPuts(stderr, _("INFO: Looking for printer...\n"));
/*
* Wait 2 seconds for a response to the local resolve; if nothing comes
* in, do an additional domain resolution...
* For the first minute, wakeup every 2 seconds to emit a
* "looking for printer" message...
*/
timeout = (time(NULL) < (start_time + 60)) ? 2000 : -1;
polldata.fd = DNSServiceRefSockFD(ref);
polldata.events = POLLIN;
if (poll(&polldata, 1, 2000) != 1)
fds = poll(&polldata, 1, timeout);
if (fds < 0)
{
if (errno != EINTR && errno != EAGAIN)
{
DEBUG_printf(("5_httpResolveURI: poll error: %s", strerror(errno)));
break;
}
}
else if (fds == 0)
{
/*
* OK, send the domain name resolve...
* Wait 2 seconds for a response to the local resolve; if nothing
* comes in, do an additional domain resolution...
*/
if (logit)
fprintf(stderr, "DEBUG: Resolving \"%s\", regtype=\"%s\", "
"domain=\"%s\"...\n", hostname, regtype, domain);
if (domainsent == 0 && strcasecmp(domain, "local."))
{
if (logit)
fprintf(stderr,
"DEBUG: Resolving \"%s\", regtype=\"%s\", "
"domain=\"%s\"...\n", hostname, regtype, domain);
domainref = ref;
if (DNSServiceResolve(&domainref, kDNSServiceFlagsShareConnection, 0,
hostname, regtype, domain, resolve_callback,
&uribuf) == kDNSServiceErr_NoError)
domainsent = 1;
}
domainref = ref;
if (DNSServiceResolve(&domainref, kDNSServiceFlagsShareConnection, 0,
hostname, regtype, domain, resolve_callback,
&uribuf) == kDNSServiceErr_NoError)
domainsent = 1;
/*
* If it hasn't resolved within 5 seconds set the offline-report
* printer-state-reason...
*/
if (logit && offline == 0 && time(NULL) > (start_time + 5))
{
fputs("STATE: +offline-report\n", stderr);
offline = 1;
}
}
}
if (DNSServiceProcessResult(ref) == kDNSServiceErr_NoError)
uri = resolved_uri;
else
{
if (DNSServiceProcessResult(ref) == kDNSServiceErr_NoError)
{
uri = resolved_uri;
break;
}
}
}
if (domainsent)
DNSServiceRefDeallocate(domainref);
@@ -1465,7 +1508,7 @@ _httpResolveURI(
else
fputs("DEBUG: Unable to resolve URI!\n", stderr);
fputs("STATE: -connecting-to-device\n", stderr);
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
}
#else
+363 -183
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* HTTP routines for the Common UNIX Printing System (CUPS).
* HTTP routines for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* This file contains Kerberos support code, copyright 2006 by
@@ -25,7 +25,7 @@
* server.
* httpClearCookie() - Clear the cookie value(s).
* httpClearFields() - Clear HTTP request fields.
* httpClose() - Close an HTTP connection...
* httpClose() - Close an HTTP connection.
* httpConnect() - Connect to a HTTP server.
* httpConnectEncrypt() - Connect to a HTTP server using encryption.
* _httpCreate() - Create an unconnected HTTP connection.
@@ -62,11 +62,12 @@
* _httpReadGNUTLS() - Read function for the GNU TLS library.
* httpReconnect() - Reconnect to a HTTP server.
* httpSetAuthString() - Set the current authorization string.
* httpSetCookie() - Set the cookie value(s)...
* httpSetCookie() - Set the cookie value(s).
* httpSetExpect() - Set the Expect: header in a request.
* httpSetField() - Set the value of an HTTP header.
* httpSetLength() - Set the content-length and content-encoding.
* httpTrace() - Send an TRACE request to the server.
* _httpUpdate() - Update the current HTTP status for incoming data.
* httpUpdate() - Update the current HTTP state for incoming data.
* _httpWait() - Wait for data available on a connection (no flush).
* httpWait() - Wait for data available on a connection.
@@ -83,10 +84,12 @@
* http_debug_hex() - Do a hex dump of a buffer.
* http_field() - Return the field index for a field name.
* http_read_ssl() - Read from a SSL/TLS connection.
* http_locking_cb() - Lock/unlock a thread's mutex.
* http_send() - Send a request with all fields and the trailing
* blank line.
* http_setup_ssl() - Set up SSL/TLS support on a connection.
* http_shutdown_ssl() - Shut down SSL/TLS on a connection.
* http_threadid_cb() - Return the current thread ID.
* http_upgrade() - Force upgrade to TLS encryption.
* http_write() - Write a buffer to a HTTP connection.
* http_write_chunk() - Write a chunked buffer.
@@ -144,6 +147,19 @@ static int http_setup_ssl(http_t *http);
static void http_shutdown_ssl(http_t *http);
static int http_upgrade(http_t *http);
static int http_write_ssl(http_t *http, const char *buf, int len);
# ifdef HAVE_GNUTLS
# ifdef HAVE_PTHREAD_H
GCRY_THREAD_OPTION_PTHREAD_IMPL;
# endif /* HAVE_PTHREAD_H */
# elif defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H)
static pthread_mutex_t *http_locks; /* OpenSSL lock mutexes */
static void http_locking_cb(int mode, int type, const char *file,
int line);
static unsigned long http_threadid_cb(void);
# endif /* HAVE_GNUTLS */
#endif /* HAVE_SSL */
@@ -312,7 +328,7 @@ httpClearFields(http_t *http) /* I - Connection to server */
/*
* 'httpClose()' - Close an HTTP connection...
* 'httpClose()' - Close an HTTP connection.
*/
void
@@ -560,8 +576,9 @@ httpError(http_t *http) /* I - Connection to server */
void
httpFlush(http_t *http) /* I - Connection to server */
{
char buffer[8192]; /* Junk buffer */
int blocking; /* To block or not to block */
char buffer[8192]; /* Junk buffer */
int blocking; /* To block or not to block */
http_state_t oldstate; /* Old state */
DEBUG_printf(("httpFlush(http=%p), state=%s", http,
@@ -578,6 +595,7 @@ httpFlush(http_t *http) /* I - Connection to server */
* Read any data we can...
*/
oldstate = http->state;
while (httpRead2(http, buffer, sizeof(buffer)) > 0);
/*
@@ -587,7 +605,7 @@ httpFlush(http_t *http) /* I - Connection to server */
http->blocking = blocking;
if (http->state != HTTP_WAITING && http->fd >= 0)
if (http->state == oldstate && http->state != HTTP_WAITING && http->fd >= 0)
{
/*
* Didn't get the data back, so close the current connection.
@@ -721,7 +739,7 @@ httpGetField(http_t *http, /* I - Connection to server */
{
if (!http || field <= HTTP_FIELD_UNKNOWN || field >= HTTP_FIELD_MAX)
return (NULL);
else if (field == HTTP_FIELD_AUTHORIZATION &&
else if (field == HTTP_FIELD_AUTHORIZATION &&
http->field_authorization)
{
/*
@@ -893,7 +911,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
* Skip leading whitespace...
*/
while (isspace(*fptr & 255))
while (_cups_isspace(*fptr))
fptr ++;
if (*fptr == ',')
@@ -907,7 +925,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
*/
for (ptr = temp;
*fptr && *fptr != '=' && !isspace(*fptr & 255) &&
*fptr && *fptr != '=' && !_cups_isspace(*fptr) &&
ptr < (temp + sizeof(temp) - 1);
*ptr++ = *fptr++);
@@ -919,7 +937,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
* Skip trailing chars up to the '='...
*/
while (isspace(*fptr & 255))
while (_cups_isspace(*fptr))
fptr ++;
if (!*fptr)
@@ -934,7 +952,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
fptr ++;
while (isspace(*fptr & 255))
while (_cups_isspace(*fptr))
fptr ++;
if (*fptr == '\"')
@@ -962,12 +980,12 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
*/
for (ptr = value;
*fptr && !isspace(*fptr & 255) && *fptr != ',' && ptr < end;
*fptr && !_cups_isspace(*fptr) && *fptr != ',' && ptr < end;
*ptr++ = *fptr++);
*ptr = '\0';
while (*fptr && !isspace(*fptr & 255) && *fptr != ',')
while (*fptr && !_cups_isspace(*fptr) && *fptr != ',')
fptr ++;
}
@@ -1137,7 +1155,7 @@ httpGets(char *line, /* I - Line to read into */
http->activity = time(NULL);
*lineptr = '\0';
DEBUG_printf(("3httpGets: Returning \"%s\"", line));
return (line);
@@ -1171,21 +1189,22 @@ httpHead(http_t *http, /* I - Connection to server */
void
httpInitialize(void)
{
#ifdef HAVE_LIBSSL
# ifndef WIN32
struct timeval curtime; /* Current time in microseconds */
# endif /* !WIN32 */
int i; /* Looping var */
unsigned char data[1024]; /* Seed data */
#endif /* HAVE_LIBSSL */
static int initialized = 0; /* Have we been called before? */
#ifdef WIN32
WSADATA winsockdata; /* WinSock data */
static int initialized = 0; /* Has WinSock been initialized? */
#endif /* WIN32 */
#ifdef HAVE_LIBSSL
int i; /* Looping var */
unsigned char data[1024]; /* Seed data */
#endif /* HAVE_LIBSSL */
if (!initialized)
WSAStartup(MAKEWORD(1,1), &winsockdata);
if (initialized)
return;
#ifdef WIN32
WSAStartup(MAKEWORD(2,2), &winsockdata);
#elif !defined(SO_NOSIGPIPE)
/*
* Ignore SIGPIPE signals...
@@ -1193,6 +1212,7 @@ httpInitialize(void)
# ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
# elif defined(HAVE_SIGACTION)
struct sigaction action; /* POSIX sigaction data */
@@ -1200,35 +1220,63 @@ httpInitialize(void)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
# else
signal(SIGPIPE, SIG_IGN);
# endif /* !SO_NOSIGPIPE */
#endif /* WIN32 */
#ifdef HAVE_GNUTLS
gnutls_global_init();
#endif /* HAVE_GNUTLS */
/*
* Make sure we handle threading properly...
*/
# ifdef HAVE_PTHREAD_H
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
# endif /* HAVE_PTHREAD_H */
/*
* Initialize GNU TLS...
*/
gnutls_global_init();
#elif defined(HAVE_LIBSSL)
/*
* Initialize OpenSSL...
*/
#ifdef HAVE_LIBSSL
SSL_load_error_strings();
SSL_library_init();
/*
* Set the threading callbacks...
*/
# ifdef HAVE_PTHREAD_H
http_locks = calloc(CRYPTO_num_locks(), sizeof(pthread_mutex_t));
for (i = 0; i < CRYPTO_num_locks(); i ++)
pthread_mutex_init(http_locks + i, NULL);
CRYPTO_set_id_callback(http_threadid_cb);
CRYPTO_set_locking_callback(http_locking_cb);
# endif /* HAVE_PTHREAD_H */
/*
* Using the current time is a dubious random seed, but on some systems
* it is the best we can do (on others, this seed isn't even used...)
*/
# ifdef WIN32
# else
gettimeofday(&curtime, NULL);
srand(curtime.tv_sec + curtime.tv_usec);
# endif /* WIN32 */
CUPS_SRAND(time(NULL));
for (i = 0; i < sizeof(data); i ++)
data[i] = rand();
data[i] = CUPS_RAND();
RAND_seed(data, sizeof(data));
#endif /* HAVE_LIBSSL */
#endif /* HAVE_GNUTLS */
initialized = 1;
}
@@ -1816,7 +1864,7 @@ httpSetAuthString(http_t *http, /* I - Connection to server */
/*
* 'httpSetCookie()' - Set the cookie value(s)...
* 'httpSetCookie()' - Set the cookie value(s).
*
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
@@ -1964,6 +2012,164 @@ httpTrace(http_t *http, /* I - Connection to server */
}
/*
* '_httpUpdate()' - Update the current HTTP status for incoming data.
*
* Note: Unlike httpUpdate(), this function does not flush pending write data
* and only retrieves a single status line from the HTTP connection.
*/
int /* O - 1 to continue, 0 to stop */
_httpUpdate(http_t *http, /* I - Connection to server */
http_status_t *status) /* O - Current HTTP status */
{
char line[32768], /* Line from connection... */
*value; /* Pointer to value on line */
http_field_t field; /* Field index */
int major, minor; /* HTTP version numbers */
DEBUG_printf(("_httpUpdate(http=%p, status=%p), state=%s", http, status,
http_states[http->state]));
/*
* Grab a single line from the connection...
*/
if (!httpGets(line, sizeof(line), http))
{
*status = HTTP_ERROR;
return (0);
}
DEBUG_printf(("2_httpUpdate: Got \"%s\"", line));
if (line[0] == '\0')
{
/*
* Blank line means the start of the data section (if any). Return
* the result code, too...
*
* If we get status 100 (HTTP_CONTINUE), then we *don't* change states.
* Instead, we just return HTTP_CONTINUE to the caller and keep on
* tryin'...
*/
if (http->status == HTTP_CONTINUE)
{
*status = http->status;
return (0);
}
if (http->status < HTTP_BAD_REQUEST)
http->digest_tries = 0;
#ifdef HAVE_SSL
if (http->status == HTTP_SWITCHING_PROTOCOLS && !http->tls)
{
if (http_setup_ssl(http) != 0)
{
# ifdef WIN32
closesocket(http->fd);
# else
close(http->fd);
# endif /* WIN32 */
*status = http->status = HTTP_ERROR;
return (0);
}
*status = HTTP_CONTINUE;
return (0);
}
#endif /* HAVE_SSL */
httpGetLength2(http);
switch (http->state)
{
case HTTP_GET :
case HTTP_POST :
case HTTP_POST_RECV :
case HTTP_PUT :
http->state ++;
case HTTP_POST_SEND :
case HTTP_HEAD :
break;
default :
http->state = HTTP_WAITING;
break;
}
*status = http->status;
return (0);
}
else if (!strncmp(line, "HTTP/", 5))
{
/*
* Got the beginning of a response...
*/
int intstatus; /* Status value as an integer */
if (sscanf(line, "HTTP/%d.%d%d", &major, &minor, &intstatus) != 3)
{
*status = http->status = HTTP_ERROR;
return (0);
}
http->version = (http_version_t)(major * 100 + minor);
*status = http->status = (http_status_t)intstatus;
}
else if ((value = strchr(line, ':')) != NULL)
{
/*
* Got a value...
*/
*value++ = '\0';
while (_cups_isspace(*value))
value ++;
/*
* Be tolerants of servers that send unknown attribute fields...
*/
if (!strcasecmp(line, "expect"))
{
/*
* "Expect: 100-continue" or similar...
*/
http->expect = (http_status_t)atoi(value);
}
else if (!strcasecmp(line, "cookie"))
{
/*
* "Cookie: name=value[; name=value ...]" - replaces previous cookies...
*/
httpSetCookie(http, value);
}
else if ((field = http_field(line)) != HTTP_FIELD_UNKNOWN)
httpSetField(http, field, value);
#ifdef DEBUG
else
DEBUG_printf(("1_httpUpdate: unknown field %s seen!", line));
#endif /* DEBUG */
}
else
{
DEBUG_printf(("1_httpUpdate: Bad response line \"%s\"!", line));
*status = http->status = HTTP_ERROR;
return (0);
}
return (1);
}
/*
* 'httpUpdate()' - Update the current HTTP state for incoming data.
*/
@@ -1971,11 +2177,7 @@ httpTrace(http_t *http, /* I - Connection to server */
http_status_t /* O - HTTP status */
httpUpdate(http_t *http) /* I - Connection to server */
{
char line[32768], /* Line from connection... */
*value; /* Pointer to value on line */
http_field_t field; /* Field index */
int major, minor, /* HTTP version numbers */
status; /* Request status */
http_status_t status; /* Request status */
DEBUG_printf(("httpUpdate(http=%p), state=%s", http,
@@ -2004,122 +2206,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
* Grab all of the lines we can from the connection...
*/
while (httpGets(line, sizeof(line), http) != NULL)
{
DEBUG_printf(("2httpUpdate: Got \"%s\"", line));
if (line[0] == '\0')
{
/*
* Blank line means the start of the data section (if any). Return
* the result code, too...
*
* If we get status 100 (HTTP_CONTINUE), then we *don't* change states.
* Instead, we just return HTTP_CONTINUE to the caller and keep on
* tryin'...
*/
if (http->status == HTTP_CONTINUE)
return (http->status);
if (http->status < HTTP_BAD_REQUEST)
http->digest_tries = 0;
#ifdef HAVE_SSL
if (http->status == HTTP_SWITCHING_PROTOCOLS && !http->tls)
{
if (http_setup_ssl(http) != 0)
{
# ifdef WIN32
closesocket(http->fd);
# else
close(http->fd);
# endif /* WIN32 */
return (HTTP_ERROR);
}
return (HTTP_CONTINUE);
}
#endif /* HAVE_SSL */
httpGetLength2(http);
switch (http->state)
{
case HTTP_GET :
case HTTP_POST :
case HTTP_POST_RECV :
case HTTP_PUT :
http->state ++;
case HTTP_POST_SEND :
case HTTP_HEAD :
break;
default :
http->state = HTTP_WAITING;
break;
}
return (http->status);
}
else if (!strncmp(line, "HTTP/", 5))
{
/*
* Got the beginning of a response...
*/
if (sscanf(line, "HTTP/%d.%d%d", &major, &minor, &status) != 3)
return (HTTP_ERROR);
http->version = (http_version_t)(major * 100 + minor);
http->status = (http_status_t)status;
}
else if ((value = strchr(line, ':')) != NULL)
{
/*
* Got a value...
*/
*value++ = '\0';
while (isspace(*value & 255))
value ++;
/*
* Be tolerants of servers that send unknown attribute fields...
*/
if (!strcasecmp(line, "expect"))
{
/*
* "Expect: 100-continue" or similar...
*/
http->expect = (http_status_t)atoi(value);
}
else if (!strcasecmp(line, "cookie"))
{
/*
* "Cookie: name=value[; name=value ...]" - replaces previous cookies...
*/
httpSetCookie(http, value);
}
else if ((field = http_field(line)) == HTTP_FIELD_UNKNOWN)
{
DEBUG_printf(("1httpUpdate: unknown field %s seen!", line));
continue;
}
else
httpSetField(http, field, value);
}
else
{
DEBUG_printf(("1httpUpdate: Bad response line \"%s\"!", line));
http->status = HTTP_ERROR;
return (HTTP_ERROR);
}
}
while (_httpUpdate(http, &status));
/*
* See if there was an error...
@@ -2140,10 +2227,10 @@ httpUpdate(http_t *http) /* I - Connection to server */
}
/*
* If we haven't already returned, then there is nothing new...
* Return the current status...
*/
return (HTTP_CONTINUE);
return (status);
}
@@ -2283,7 +2370,7 @@ httpWait(http_t *http, /* I - Connection to server */
*
* @deprecated@
*/
int /* O - Number of bytes written */
httpWrite(http_t *http, /* I - Connection to server */
const char *buffer, /* I - Buffer for data */
@@ -2298,7 +2385,7 @@ httpWrite(http_t *http, /* I - Connection to server */
*
* @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Number of bytes written */
httpWrite2(http_t *http, /* I - Connection to server */
const char *buffer, /* I - Buffer for data */
@@ -2407,13 +2494,6 @@ httpWrite2(http_t *http, /* I - Connection to server */
http->data_encoding = HTTP_ENCODE_LENGTH;
http->data_remaining = 0;
}
if (http->state == HTTP_POST_RECV)
http->state ++;
else if (http->state == HTTP_PUT_RECV)
http->state = HTTP_STATUS;
else
http->state = HTTP_WAITING;
}
return (bytes);
@@ -2456,7 +2536,7 @@ _httpWriteCDSA(
else
{
*dataLength = 0;
if (errno == EAGAIN)
result = errSSLWouldBlock;
else
@@ -2517,7 +2597,7 @@ http_bio_ctrl(BIO *h, /* I - BIO data */
}
else
return (0);
case BIO_CTRL_DUP :
case BIO_CTRL_FLUSH :
return (1);
@@ -2719,7 +2799,36 @@ http_read_ssl(http_t *http, /* I - Connection to server */
return (SSL_read((SSL *)(http->tls), buf, len));
# elif defined(HAVE_GNUTLS)
return (gnutls_record_recv(((http_tls_t *)(http->tls))->session, buf, len));
ssize_t result; /* Return value */
result = gnutls_record_recv(((http_tls_t *)(http->tls))->session, buf, len);
if (result < 0 && !errno)
{
/*
* Convert GNU TLS error to errno value...
*/
switch (result)
{
case GNUTLS_E_INTERRUPTED :
errno = EINTR;
break;
case GNUTLS_E_AGAIN :
errno = EAGAIN;
break;
default :
errno = EPIPE;
break;
}
result = -1;
}
return ((int)result);
# elif defined(HAVE_CDSASSL)
int result; /* Return value */
@@ -2758,6 +2867,25 @@ http_read_ssl(http_t *http, /* I - Connection to server */
#endif /* HAVE_SSL */
#if defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H)
/*
* 'http_locking_cb()' - Lock/unlock a thread's mutex.
*/
static void
http_locking_cb(int mode, /* I - Lock mode */
int type, /* I - Lock type */
const char *file, /* I - Source file */
int line) /* I - Line number */
{
if (mode & CRYPTO_LOCK)
pthread_mutex_lock(http_locks + type);
else
pthread_mutex_unlock(http_locks + type);
}
#endif /* HAVE_LIBSSL && HAVE_PTHREAD_H */
/*
* 'http_send()' - Send a request with all fields and the trailing blank line.
*/
@@ -2857,7 +2985,7 @@ 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],
if (httpPrintf(http, "%s: %s\r\n", http_fields[i],
httpGetField(http, i)) < 1)
{
http->status = HTTP_ERROR;
@@ -2896,15 +3024,15 @@ http_send(http_t *http, /* I - Connection to server */
* The Kerberos and AuthRef authentication strings can only be used once...
*/
if (http->field_authorization && http->authstring &&
(!strncmp(http->authstring, "Negotiate", 9) ||
if (http->field_authorization && http->authstring &&
(!strncmp(http->authstring, "Negotiate", 9) ||
!strncmp(http->authstring, "AuthRef", 7)))
{
http->_authstring[0] = '\0';
if (http->authstring != http->_authstring)
free(http->authstring);
http->authstring = http->_authstring;
}
@@ -3004,6 +3132,11 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
http->error = errno;
http->status = HTTP_ERROR;
gnutls_deinit(conn->session);
gnutls_certificate_free_credentials(*credentials);
free(credentials);
free(conn);
return (-1);
}
@@ -3124,6 +3257,19 @@ http_shutdown_ssl(http_t *http) /* I - Connection to server */
#endif /* HAVE_SSL */
#if defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H)
/*
* 'http_threadid_cb()' - Return the current thread ID.
*/
static unsigned long /* O - Thread ID */
http_threadid_cb(void)
{
return ((unsigned long)pthread_self());
}
#endif /* HAVE_LIBSSL && HAVE_PTHREAD_H */
#ifdef HAVE_SSL
/*
* 'http_upgrade()' - Force upgrade to TLS encryption.
@@ -3138,6 +3284,13 @@ http_upgrade(http_t *http) /* I - Connection to server */
DEBUG_printf(("7http_upgrade(%p)", http));
/*
* Flush the connection to make sure any previous "Upgrade" message
* has been read.
*/
httpFlush(http);
/*
* Copy the HTTP data to a local variable so we can do the OPTIONS
* request without interfering with the existing request data...
@@ -3165,8 +3318,6 @@ http_upgrade(http_t *http) /* I - Connection to server */
while (httpUpdate(http) == HTTP_CONTINUE);
}
httpFlush(http);
/*
* Restore the HTTP request data...
*/
@@ -3210,7 +3361,7 @@ http_upgrade(http_t *http) /* I - Connection to server */
/*
* 'http_write()' - Write a buffer to a HTTP connection.
*/
static int /* O - Number of bytes written */
http_write(http_t *http, /* I - Connection to server */
const char *buffer, /* I - Buffer for data */
@@ -3325,7 +3476,36 @@ http_write_ssl(http_t *http, /* I - Connection to server */
return (SSL_write((SSL *)(http->tls), buf, len));
# elif defined(HAVE_GNUTLS)
return (gnutls_record_send(((http_tls_t *)(http->tls))->session, buf, len));
ssize_t result; /* Return value */
result = gnutls_record_send(((http_tls_t *)(http->tls))->session, buf, len);
if (result < 0 && !errno)
{
/*
* Convert GNU TLS error to errno value...
*/
switch (result)
{
case GNUTLS_E_INTERRUPTED :
errno = EINTR;
break;
case GNUTLS_E_AGAIN :
errno = EAGAIN;
break;
default :
errno = EPIPE;
break;
}
result = -1;
}
return ((int)result);
# elif defined(HAVE_CDSASSL)
int result; /* Return value */
OSStatus error; /* Error info */
@@ -3348,11 +3528,11 @@ http_write_ssl(http_t *http, /* I - Connection to server */
else
{
result = -1;
errno = EINTR;
errno = EINTR;
}
break;
default :
errno = EPIPE;
errno = EPIPE;
result = -1;
break;
}
+6 -7
Ver Arquivo
@@ -1,10 +1,9 @@
/*
* "$Id$"
*
* Hyper-Text Transport Protocol definitions for the Common UNIX Printing
* System (CUPS).
* Hyper-Text Transport Protocol definitions for CUPS.
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -88,7 +87,7 @@ extern "C" {
#if defined(AF_INET6) && !defined(s6_addr32)
# if defined(__sun)
# define s6_addr32 _S6_un._S6_u32
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)|| defined(__DragonFly__)
# define s6_addr32 __u6_addr.__u6_addr32
# elif defined(__osf__)
# define s6_addr32 s6_un.sa6_laddr
@@ -250,7 +249,7 @@ typedef enum http_status_e /**** HTTP status codes ****/
HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */
HTTP_NOT_SUPPORTED, /* HTTP version not supported */
HTTP_AUTHORIZATION_CANCELED = 1000 /* User cancelled authorization */
HTTP_AUTHORIZATION_CANCELED = 1000 /* User canceled authorization */
} http_status_t;
@@ -387,7 +386,7 @@ extern void httpSeparate2(const char *uri,
char *host, int hostlen, int *port,
char *resource, int resourcelen) _CUPS_DEPRECATED;
/**** New in CUPS 1.2 ****/
/**** New in CUPS 1.2/Mac 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,
@@ -435,7 +434,7 @@ 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 ****/
/**** New in CUPS 1.3/Mac 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;
+88 -38
Ver Arquivo
@@ -1,10 +1,9 @@
/*
* "$Id$"
*
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
* Internet Printing Protocol functions for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -186,6 +185,8 @@ ippAddCollection(ipp_t *ipp, /* I - IPP message */
attr->value_tag = IPP_TAG_BEGIN_COLLECTION;
attr->values[0].collection = value;
value->use ++;
return (attr);
}
@@ -224,10 +225,15 @@ ippAddCollections(
attr->value_tag = IPP_TAG_BEGIN_COLLECTION;
if (values != NULL)
{
for (i = 0, value = attr->values;
i < num_values;
i ++, value ++)
{
value->collection = (ipp_t *)values[i];
value->collection->use ++;
}
}
return (attr);
}
@@ -425,7 +431,8 @@ ippAddString(ipp_t *ipp, /* I - IPP message */
value = "en";
/*
* Convert language values to lowercase and change _ to - as needed...
* Convert language and charset values to lowercase and change _ to - as
* needed...
*/
if ((type == IPP_TAG_LANGUAGE || type == IPP_TAG_CHARSET) && value)
@@ -473,6 +480,8 @@ ippAddStrings(
int i; /* Looping var */
ipp_attribute_t *attr; /* New attribute */
ipp_value_t *value; /* Current value */
char buffer[1024], /* Language/charset value buffer */
*bufptr; /* Pointer into buffer */
DEBUG_printf(("ippAddStrings(ipp=%p, group=%02x(%s), type=%02x(%s), "
@@ -506,16 +515,36 @@ ippAddStrings(
if (values != NULL)
{
/*
* Force language to be English for the POSIX locale...
*/
if ((int)type & IPP_TAG_COPY)
value->string.text = (char *)values[i];
else if (type == IPP_TAG_LANGUAGE && !strcasecmp(values[i], "C"))
{
/*
* Force language to be English for the POSIX locale...
*/
if (type == IPP_TAG_LANGUAGE && !strcasecmp(values[i], "C"))
value->string.text = ((int)type & IPP_TAG_COPY) ? "en" :
_cupsStrAlloc("en");
}
else if (type == IPP_TAG_LANGUAGE || type == IPP_TAG_CHARSET)
{
/*
* Convert language values to lowercase and change _ to - as needed...
*/
strlcpy(buffer, values[i], sizeof(buffer));
for (bufptr = buffer; *bufptr; bufptr ++)
if (*bufptr == '_')
*bufptr = '-';
else
*bufptr = tolower(*bufptr & 255);
value->string.text = _cupsStrAlloc(buffer);
}
else
value->string.text = ((int)type & IPP_TAG_COPY) ? (char *)values[i] :
_cupsStrAlloc(values[i]);
value->string.text = _cupsStrAlloc(values[i]);
}
}
@@ -776,6 +805,10 @@ ippDelete(ipp_t *ipp) /* I - IPP message */
if (!ipp)
return;
ipp->use --;
if (ipp->use > 0)
return;
for (attr = ipp->attrs; attr != NULL; attr = next)
{
next = attr->next;
@@ -950,6 +983,7 @@ ippNew(void)
temp->request.any.version[0] = 1;
temp->request.any.version[1] = 1;
temp->use = 1;
}
DEBUG_printf(("1ippNew: Returning %p", temp));
@@ -1241,7 +1275,9 @@ ippReadIO(void *src, /* I - Data source */
attr->value_tag = tag;
}
else if ((value_tag >= IPP_TAG_TEXTLANG &&
else if (value_tag == IPP_TAG_TEXTLANG ||
value_tag == IPP_TAG_NAMELANG ||
(value_tag >= IPP_TAG_TEXT &&
value_tag <= IPP_TAG_MIMETYPE))
{
/*
@@ -1249,8 +1285,9 @@ ippReadIO(void *src, /* I - Data source */
* forms; accept sets of differing values...
*/
if ((tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE) &&
tag != IPP_TAG_NOVALUE)
if (tag != IPP_TAG_TEXTLANG && tag != IPP_TAG_NAMELANG &&
(tag < IPP_TAG_TEXT || tag > IPP_TAG_MIMETYPE) &&
tag != IPP_TAG_NOVALUE)
{
DEBUG_printf(("1ippReadIO: 1setOf value tag %x(%s) != %x(%s)",
value_tag, ippTagString(value_tag), tag,
@@ -1871,6 +1908,12 @@ ippWriteIO(void *dst, /* I - Destination */
*bufptr++ = ipp->request.any.request_id >> 8;
*bufptr++ = ipp->request.any.request_id;
DEBUG_printf(("2ippWriteIO: version=%d.%d", buffer[0], buffer[1]));
DEBUG_printf(("2ippWriteIO: op_status=%04x",
ipp->request.any.op_status));
DEBUG_printf(("2ippWriteIO: request_id=%d",
ipp->request.any.request_id));
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
DEBUG_puts("1ippWriteIO: Could not write IPP header...");
@@ -1888,11 +1931,7 @@ ippWriteIO(void *dst, /* I - Destination */
ipp->current = ipp->attrs;
ipp->curtag = IPP_TAG_ZERO;
DEBUG_printf(("2ippWriteIO: version=%d.%d", buffer[0], buffer[1]));
DEBUG_printf(("2ippWriteIO: op_status=%04x",
ipp->request.any.op_status));
DEBUG_printf(("2ippWriteIO: request_id=%d",
ipp->request.any.request_id));
DEBUG_printf(("1ippWriteIO: ipp->current=%p", ipp->current));
/*
* If blocking is disabled, stop here...
@@ -1913,23 +1952,30 @@ ippWriteIO(void *dst, /* I - Destination */
ipp->current = ipp->current->next;
if (ipp->curtag != attr->group_tag && parent == NULL)
if (!parent)
{
/*
* Send a group tag byte...
*/
if (ipp->curtag != attr->group_tag)
{
/*
* Send a group tag byte...
*/
ipp->curtag = attr->group_tag;
ipp->curtag = attr->group_tag;
if (attr->group_tag == IPP_TAG_ZERO)
if (attr->group_tag == IPP_TAG_ZERO)
continue;
DEBUG_printf(("2ippWriteIO: wrote group tag=%x(%s)",
attr->group_tag, ippTagString(attr->group_tag)));
*bufptr++ = attr->group_tag;
}
else if (attr->group_tag == IPP_TAG_ZERO)
continue;
DEBUG_printf(("2ippWriteIO: wrote group tag=%x(%s)",
attr->group_tag, ippTagString(attr->group_tag)));
*bufptr++ = attr->group_tag;
}
else if (attr->group_tag == IPP_TAG_ZERO)
continue;
DEBUG_printf(("1ippWriteIO: %s (%s%s)", attr->name,
attr->num_values > 1 ? "1setOf " : "",
ippTagString(attr->value_tag)));
/*
* Write the attribute tag and name. The current implementation
@@ -2602,15 +2648,18 @@ ippWriteIO(void *dst, /* I - Destination */
* Write the data out...
*/
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
if (bufptr > buffer)
{
DEBUG_puts("1ippWriteIO: Could not write IPP attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
DEBUG_puts("1ippWriteIO: Could not write IPP attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
DEBUG_printf(("2ippWriteIO: wrote %d bytes",
(int)(bufptr - buffer)));
DEBUG_printf(("2ippWriteIO: wrote %d bytes",
(int)(bufptr - buffer)));
}
/*
* If blocking is disabled, stop here...
@@ -2720,6 +2769,7 @@ _ippFreeAttr(ipp_attribute_t *attr) /* I - Attribute to free */
{
case IPP_TAG_TEXT :
case IPP_TAG_NAME :
case IPP_TAG_RESERVED_STRING :
case IPP_TAG_KEYWORD :
case IPP_TAG_URI :
case IPP_TAG_URISCHEME :
@@ -2979,7 +3029,7 @@ ipp_read_http(http_t *http, /* I - Client connection */
int tbytes, /* Total bytes read */
bytes; /* Bytes read this pass */
char len[32]; /* Length string */
DEBUG_printf(("7ipp_read_http(http=%p, buffer=%p, length=%d)",
http, buffer, (int)length));
+17 -14
Ver Arquivo
@@ -1,10 +1,9 @@
/*
* "$Id$"
*
* Internet Printing Protocol definitions for the Common UNIX Printing
* System (CUPS).
* Internet Printing Protocol definitions for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -64,7 +63,7 @@ extern "C" {
* Types and structures...
*/
typedef enum ipp_tag_e /**** Format tags for attributes... ****/
typedef enum ipp_tag_e /**** Format tags for attributes ****/
{
IPP_TAG_ZERO = 0x00, /* Zero tag - used for separators */
IPP_TAG_OPERATION, /* Operation group */
@@ -94,7 +93,8 @@ typedef enum ipp_tag_e /**** Format tags for attributes... ****/
IPP_TAG_END_COLLECTION, /* End of collection value */
IPP_TAG_TEXT = 0x41, /* Text value */
IPP_TAG_NAME, /* Name value */
IPP_TAG_KEYWORD = 0x44, /* Keyword value */
IPP_TAG_RESERVED_STRING, /* Reserved for future string value @private@ */
IPP_TAG_KEYWORD, /* Keyword value */
IPP_TAG_URI, /* URI value */
IPP_TAG_URISCHEME, /* URI scheme value */
IPP_TAG_CHARSET, /* Character set value */
@@ -105,13 +105,13 @@ typedef enum ipp_tag_e /**** Format tags for attributes... ****/
IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values */
} ipp_tag_t;
typedef enum ipp_res_e /**** Resolution units... ****/
typedef enum ipp_res_e /**** Resolution units ****/
{
IPP_RES_PER_INCH = 3, /* Pixels per inch */
IPP_RES_PER_CM /* Pixels per centimeter */
} ipp_res_t;
typedef enum ipp_finish_e /**** Finishings... ****/
typedef enum ipp_finish_e /**** Finishings ****/
{
IPP_FINISHINGS_NONE = 3, /* No finishing */
IPP_FINISHINGS_STAPLE, /* Staple (any location) */
@@ -143,7 +143,7 @@ typedef enum ipp_finish_e /**** Finishings... ****/
IPP_FINISHINGS_BIND_BOTTOM /* Bind on bottom */
} ipp_finish_t;
typedef enum ipp_orient_e /**** Orientation... ****/
typedef enum ipp_orient_e /**** Orientation values ****/
{
IPP_PORTRAIT = 3, /* No rotation */
IPP_LANDSCAPE, /* 90 degrees counter-clockwise */
@@ -151,14 +151,14 @@ typedef enum ipp_orient_e /**** Orientation... ****/
IPP_REVERSE_PORTRAIT /* 180 degrees */
} ipp_orient_t;
typedef enum ipp_quality_e /**** Qualities... ****/
typedef enum ipp_quality_e /**** Qualities ****/
{
IPP_QUALITY_DRAFT = 3, /* Draft quality */
IPP_QUALITY_NORMAL, /* Normal quality */
IPP_QUALITY_HIGH /* High quality */
} ipp_quality_t;
typedef enum ipp_jstate_e /**** Job States.... */
typedef enum ipp_jstate_e /**** Job states ****/
{
IPP_JOB_PENDING = 3, /* Job is waiting to be printed */
IPP_JOB_HELD, /* Job is held for printing */
@@ -170,14 +170,14 @@ typedef enum ipp_jstate_e /**** Job States.... */
} ipp_jstate_t;
#define IPP_JOB_CANCELLED IPP_JOB_CANCELED
typedef enum ipp_pstate_e /**** Printer States.... */
typedef enum ipp_pstate_e /**** Printer states ****/
{
IPP_PRINTER_IDLE = 3, /* Printer is idle */
IPP_PRINTER_PROCESSING, /* Printer is working */
IPP_PRINTER_STOPPED /* Printer is stopped */
} ipp_pstate_t;
typedef enum ipp_state_e /**** IPP states... ****/
typedef enum ipp_state_e /**** IPP states ****/
{
IPP_ERROR = -1, /* An error occurred */
IPP_IDLE, /* Nothing is happening/request completed */
@@ -186,7 +186,7 @@ typedef enum ipp_state_e /**** IPP states... ****/
IPP_DATA /* IPP request data needs to be sent/received */
} ipp_state_t;
typedef enum ipp_op_e /**** IPP operations... ****/
typedef enum ipp_op_e /**** IPP operations ****/
{
IPP_PRINT_JOB = 0x0002, /* Print a single file */
IPP_PRINT_URI, /* Print a single URL @private@ */
@@ -255,7 +255,7 @@ typedef enum ipp_op_e /**** IPP operations... ****/
#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
#define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS
typedef enum ipp_status_e /**** IPP status codes... ****/
typedef enum ipp_status_e /**** IPP status codes ****/
{
IPP_OK = 0x0000, /* successful-ok */
IPP_OK_SUBST, /* successful-ok-ignored-or-substituted-attributes */
@@ -405,6 +405,9 @@ struct ipp_s /**** IPP Request/Response/Notification ****/
/**** 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.5 ****/
int use; /* Use count */
};
+15 -5
Ver Arquivo
@@ -267,9 +267,17 @@ _cupsEncodingName(
{
if (encoding < 0 ||
encoding >= (sizeof(lang_encodings) / sizeof(const char *)))
{
DEBUG_printf(("1_cupsEncodingName(encoding=%d) = out of range (\"%s\")",
encoding, lang_encodings[0]));
return (lang_encodings[0]);
}
else
{
DEBUG_printf(("1_cupsEncodingName(encoding=%d) = \"%s\"",
encoding, lang_encodings[encoding]));
return (lang_encodings[encoding]);
}
}
@@ -445,7 +453,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
if (!language)
{
if ((language = getenv("LANG")) == NULL)
if (!getenv("SOFTWARE") || (language = getenv("LANG")) == NULL)
language = appleLangDefault();
DEBUG_printf(("4cupsLangGet: language=\"%s\"", language));
@@ -497,7 +505,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
for (ptr = charset, csptr ++; *csptr; csptr ++)
if (ptr < (charset + sizeof(charset) - 1) && isalnum(*csptr & 255))
if (ptr < (charset + sizeof(charset) - 1) && _cups_isalnum(*csptr))
*ptr++ = *csptr;
*ptr = '\0';
@@ -557,7 +565,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
for (ptr = charset; *csptr; csptr ++)
if (isalnum(*csptr & 255) && ptr < (charset + sizeof(charset) - 1))
if (_cups_isalnum(*csptr) && ptr < (charset + sizeof(charset) - 1))
*ptr++ = *csptr;
*ptr = '\0';
@@ -624,7 +632,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
for (language ++, ptr = charset; *language; language ++)
if (isalnum(*language & 255) && ptr < (charset + sizeof(charset) - 1))
if (_cups_isalnum(*language) && ptr < (charset + sizeof(charset) - 1))
*ptr++ = toupper(*language & 255);
*ptr = '\0';
@@ -1121,13 +1129,15 @@ appleLangDefault(void)
/* Pointer to library globals */
DEBUG_puts("2appleLangDefault()");
/*
* Only do the lookup and translation the first time.
*/
if (!cg->language[0])
{
if ((lang = getenv("LANG")))
if (getenv("SOFTWARE") != NULL && (lang = getenv("LANG")) != NULL)
{
strlcpy(cg->language, lang, sizeof(cg->language));
return (cg->language);
+21 -5
Ver Arquivo
@@ -2,8 +2,6 @@ __cups_debug_fd
__cups_debug_printf
__cups_debug_puts
__cups_strcpy
__cupsAdminGetServerSettings
__cupsAdminSetServerSettings
__cupsAppleLanguage
__cupsCharmapFlush
__cupsCharmapFree
@@ -21,9 +19,6 @@ __cupsMD5Init
__cupsMessageFree
__cupsMessageLoad
__cupsMessageLookup
__cupsPWGMediaByName
__cupsPWGMediaByLegacy
__cupsPWGMediaBySize
__cupsSetError
__cupsSetLocale
__cupsSNMPClose
@@ -62,6 +57,27 @@ __ppdHashName
__ppdLocalizedAttr
__ppdNormalizeMakeAndModel
__ppdParseOptions
__pwgCreateWithFile
__pwgCreateWithPPD
__pwgDestroy
__pwgGenerateSize
__pwgGetBin
__pwgGetInputSlot
__pwgGetMediaType
__pwgGetOutputBin
__pwgGetPageSize
__pwgGetSize
__pwgGetSource
__pwgGetType
__pwgInitSize
__pwgInputSlotForSource
__pwgMediaForLegacy
__pwgMediaForPPD
__pwgMediaForPWG
__pwgMediaForSize
__pwgMediaTypeForType
__pwgPageSizeForMedia
__pwgWriteFile
_cupsAddDest
_cupsAddOption
_cupsAdminCreateWindowsPPD
+5 -2
Ver Arquivo
@@ -1,8 +1,6 @@
LIBRARY libcups2
VERSION 2.7
EXPORTS
_cupsAdminGetServerSettings
_cupsAdminSetServerSettings
_cupsCharmapFlush
_cupsCharmapFree
_cupsCharmapGet
@@ -29,10 +27,14 @@ _cupsStrStatistics
_cups_strcpy
_cups_strlcat
_cups_strlcpy
_httpResolveURI
_ippAddAttr
_ippFindOption
_ippFreeAttr
_ppdFreeLanguages
_ppdGetEncoding
_ppdGetLanguages
_ppdHashName
cupsAddDest
cupsAddOption
cupsAdminCreateWindowsPPD
@@ -129,6 +131,7 @@ cupsPrintFiles2
cupsPutFd
cupsPutFile
cupsRemoveOption
cupsResolveConflicts
cupsServer
cupsSetDests
cupsSetDests2
+24 -6
Ver Arquivo
@@ -1,12 +1,11 @@
_cups_debug_fd
_cupsAdminGetServerSettings
_cupsAdminSetServerSettings
_cupsCharmapFlush
_cupsCharmapFree
_cupsCharmapGet
_cupsEncodingName
_cupsGetPassword
_cupsGlobals
_cupsLangPrintError
_cupsLangPrintf
_cupsLangPuts
_cupsLangString
@@ -16,9 +15,6 @@ _cupsMD5Init
_cupsMessageFree
_cupsMessageLoad
_cupsMessageLookup
_cupsPWGMediaByName
_cupsPWGMediaByLegacy
_cupsPWGMediaBySize
_cupsSetError
_cupsSetLocale
_cupsSNMPClose
@@ -50,6 +46,7 @@ _httpBIOMethods
_httpCreate
_httpEncodeURI
_httpResolveURI
_httpWait
_ippAddAttr
_ippFreeAttr
_ppdFreeLanguages
@@ -59,4 +56,25 @@ _ppdGetLanguages
_ppdHashName
_ppdLocalizedAttr
_ppdNormalizeMakeAndModel
_ppdParseOptions
_ppdParseOptions
_pwgCreateWithFile
_pwgDestroy
_pwgWriteFile
_pwgGenerateSize
_pwgInitSize
_pwgMediaForLegacy
_pwgMediaForPPD
_pwgMediaForPWG
_pwgMediaForSize
_pwgCreateWithPPD
_pwgGetBin
_pwgGetInputSlot
_pwgGetMediaType
_pwgGetOutputBin
_pwgGetPageSize
_pwgGetSize
_pwgGetSource
_pwgGetType
_pwgInputSlotForSource
_pwgMediaTypeForType
_pwgPageSizeForMedia
+8 -8
Ver Arquivo
@@ -389,7 +389,7 @@ ppdLocalizeIPPReason(
valptr += 5;
while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
{
if (*valptr == '%' && isxdigit(valptr[1] & 255) &&
isxdigit(valptr[2] & 255))
@@ -427,7 +427,7 @@ ppdLocalizeIPPReason(
* Skip this URI...
*/
while (*valptr && !isspace(*valptr & 255))
while (*valptr && !_cups_isspace(*valptr))
valptr++;
}
@@ -435,7 +435,7 @@ ppdLocalizeIPPReason(
* Skip whitespace...
*/
while (isspace(*valptr & 255))
while (_cups_isspace(*valptr))
valptr ++;
}
@@ -463,7 +463,7 @@ ppdLocalizeIPPReason(
* Copy URI...
*/
while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
*bufptr++ = *valptr++;
*bufptr = '\0';
@@ -476,7 +476,7 @@ ppdLocalizeIPPReason(
* Skip this URI...
*/
while (*valptr && !isspace(*valptr & 255))
while (*valptr && !_cups_isspace(*valptr))
valptr++;
}
@@ -484,7 +484,7 @@ ppdLocalizeIPPReason(
* Skip whitespace...
*/
while (isspace(*valptr & 255))
while (_cups_isspace(*valptr))
valptr ++;
}
@@ -598,7 +598,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
* Skip leading whitespace...
*/
while (isspace(*ptr & 255))
while (_cups_isspace(*ptr))
ptr ++;
if (!*ptr)
@@ -608,7 +608,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
* Find the end of this language name...
*/
for (start = ptr; *ptr && !isspace(*ptr & 255); ptr ++);
for (start = ptr; *ptr && !_cups_isspace(*ptr); ptr ++);
if (*ptr)
*ptr++ = '\0';
+198 -331
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Option marking routines for the Common UNIX Printing System (CUPS).
* Option marking routines for CUPS.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -29,13 +29,11 @@
* ppdFirstOption() - Return the first option in the PPD file.
* ppdNextOption() - Return the next option in the PPD file.
* _ppdParseOptions() - Parse options from a PPD file.
* debug_marked() - Output the marked array to stdout...
* ppd_debug_marked() - Output the marked array to stdout...
* ppd_defaults() - Set the defaults for this group and all sub-groups.
* ppd_mark_choices() - Mark one or more option choices from a string.
* ppd_mark_option() - Quickly mark an option without checking for
* conflicts.
* ppd_mark_size() - Quickly mark a page size without checking for
* conflicts.
*/
/*
@@ -45,7 +43,8 @@
#include "cups.h"
#include "string.h"
#include "debug.h"
#include "pwgmedia.h"
#include "ppd-private.h"
#include "pwg-private.h"
/*
@@ -53,15 +52,14 @@
*/
#ifdef DEBUG
static void debug_marked(ppd_file_t *ppd, const char *title);
static void ppd_debug_marked(ppd_file_t *ppd, const char *title);
#else
# define debug_marked(ppd,title)
# define ppd_debug_marked(ppd,title)
#endif /* DEBUG */
static void ppd_defaults(ppd_file_t *ppd, ppd_group_t *g);
static void ppd_mark_choices(ppd_file_t *ppd, const char *s);
static void ppd_mark_option(ppd_file_t *ppd, const char *option,
const char *choice);
static void ppd_mark_size(ppd_file_t *ppd, const char *size);
/*
@@ -78,41 +76,20 @@ cupsMarkOptions(
int num_options, /* I - Number of options */
cups_option_t *options) /* I - Options */
{
int i, j, k; /* Looping vars */
int i, j; /* Looping vars */
char *ptr, /* Pointer into string */
s[255]; /* Temporary string */
const char *val, /* Pointer into value */
*media, /* media option */
*media_col, /* media-col option */
*page_size; /* PageSize option */
*output_bin, /* output-bin option */
*output_mode, /* output-mode option */
*page_size, /* PageSize option */
*ppd_keyword, /* PPD keyword */
*print_quality, /* print-quality option */
*sides; /* sides option */
cups_option_t *optptr; /* Current option */
ppd_option_t *option; /* PPD option */
ppd_attr_t *attr; /* PPD attribute */
static const char * const duplex_options[] =
{ /* Duplex option names */
"Duplex", /* Adobe */
"EFDuplex", /* EFI */
"EFDuplexing", /* EFI */
"KD03Duplex", /* Kodak */
"JCLDuplex" /* Samsung */
};
static const char * const duplex_one[] =
{ /* one-sided names */
"None",
"False"
};
static const char * const duplex_two_long[] =
{ /* two-sided-long-edge names */
"DuplexNoTumble", /* Adobe */
"LongEdge", /* EFI */
"Top" /* EFI */
};
static const char * const duplex_two_short[] =
{ /* two-sided-long-edge names */
"DuplexTumble", /* Adobe */
"ShortEdge", /* EFI */
"Bottom" /* EFI */
};
_pwg_t *pwg; /* PWG mapping data */
/*
@@ -122,79 +99,42 @@ cupsMarkOptions(
if (!ppd || num_options <= 0 || !options)
return (0);
debug_marked(ppd, "Before...");
ppd_debug_marked(ppd, "Before...");
/*
* Do special handling for media, media-col, and PageSize...
* Do special handling for finishings, media, output-bin, output-mode,
* print-color-mode, print-quality, and PageSize...
*/
media = cupsGetOption("media", num_options, options);
media_col = cupsGetOption("media-col", num_options, options);
page_size = cupsGetOption("PageSize", num_options, options);
media = cupsGetOption("media", num_options, options);
output_bin = cupsGetOption("output-bin", num_options, options);
output_mode = cupsGetOption("output-mode", num_options, options);
page_size = cupsGetOption("PageSize", num_options, options);
print_quality = cupsGetOption("print-quality", num_options, options);
sides = cupsGetOption("sides", num_options, options);
if (media_col && (!page_size || !page_size[0]))
if ((media || output_bin || output_mode || print_quality || sides) &&
!ppd->pwg)
{
/*
* Pull out the corresponding media size from the media-col value...
* Load PWG mapping data as needed...
*/
int num_media_cols, /* Number of media-col values */
num_media_sizes;/* Number of media-size values */
cups_option_t *media_cols, /* media-col values */
*media_sizes; /* media-size values */
num_media_cols = cupsParseOptions(media_col, 0, &media_cols);
if ((val = cupsGetOption("media-key", num_media_cols, media_cols)) != NULL)
media = val;
else if ((val = cupsGetOption("media-size", num_media_cols,
media_cols)) != NULL)
{
/*
* Lookup by dimensions...
*/
double width, /* Width in points */
length; /* Length in points */
struct lconv *loc; /* Locale data */
_cups_pwg_media_t *pwgmedia; /* PWG media name */
num_media_sizes = cupsParseOptions(val, 0, &media_sizes);
loc = localeconv();
if ((val = cupsGetOption("x-dimension", num_media_sizes,
media_sizes)) != NULL)
width = _cupsStrScand(val, NULL, loc) * 2540.0 / 72.0;
else
width = 0.0;
if ((val = cupsGetOption("y-dimension", num_media_sizes,
media_sizes)) != NULL)
length = _cupsStrScand(val, NULL, loc) * 2540.0 / 72.0;
else
length = 0.0;
if ((pwgmedia = _cupsPWGMediaBySize(width, length)) != NULL)
media = pwgmedia->pwg;
cupsFreeOptions(num_media_sizes, media_sizes);
}
cupsFreeOptions(num_media_cols, media_cols);
ppd->pwg = _pwgCreateWithPPD(ppd);
}
pwg = (_pwg_t *)ppd->pwg;
if (media)
{
/*
* Loop through the option string, separating it at commas and
* marking each individual option as long as the corresponding
* PPD option (PageSize, InputSlot, etc.) is not also set.
* Loop through the option string, separating it at commas and marking each
* individual option as long as the corresponding PPD option (PageSize,
* InputSlot, etc.) is not also set.
*
* For PageSize, we also check for an empty option value since
* some versions of MacOS X use it to specify auto-selection
* of the media based solely on the size.
* For PageSize, we also check for an empty option value since some versions
* of MacOS X use it to specify auto-selection of the media based solely on
* the size.
*/
for (val = media; *val;)
@@ -215,23 +155,114 @@ cupsMarkOptions(
*/
if (!page_size || !page_size[0])
ppd_mark_size(ppd, s);
{
if (!strncasecmp(s, "Custom.", 7) || ppdPageSize(ppd, s))
ppd_mark_option(ppd, "PageSize", s);
else if ((ppd_keyword = _pwgGetPageSize(pwg, NULL, s, NULL)) != NULL)
ppd_mark_option(ppd, "PageSize", ppd_keyword);
}
if (cupsGetOption("InputSlot", num_options, options) == NULL)
ppd_mark_option(ppd, "InputSlot", s);
if (pwg && pwg->source_option &&
!cupsGetOption(pwg->source_option, num_options, options) &&
(ppd_keyword = _pwgGetInputSlot(pwg, NULL, s)) != NULL)
ppd_mark_option(ppd, pwg->source_option, ppd_keyword);
if (cupsGetOption("MediaType", num_options, options) == NULL)
ppd_mark_option(ppd, "MediaType", s);
if (!cupsGetOption("MediaType", num_options, options) &&
(ppd_keyword = _pwgGetMediaType(pwg, NULL, s)) != NULL)
ppd_mark_option(ppd, "MediaType", ppd_keyword);
}
}
if (cupsGetOption("EFMediaType", num_options, options) == NULL)
ppd_mark_option(ppd, "EFMediaType", s); /* EFI */
if (pwg)
{
if (!cupsGetOption("com.apple.print.DocumentTicket.PMSpoolFormat",
num_options, options) &&
!cupsGetOption("APPrinterPreset", num_options, options) &&
(output_mode || print_quality))
{
/*
* Map output-mode and print-quality to a preset...
*/
if (cupsGetOption("EFMediaQualityMode", num_options, options) == NULL)
ppd_mark_option(ppd, "EFMediaQualityMode", s); /* EFI */
_pwg_output_mode_t pwg_om; /* output-mode index */
_pwg_print_quality_t pwg_pq; /* print-quality index */
cups_option_t *preset;/* Current preset option */
if (!strcasecmp(s, "manual") &&
!cupsGetOption("ManualFeed", num_options, options))
ppd_mark_option(ppd, "ManualFeed", "True");
if (output_mode && !strcmp(output_mode, "monochrome"))
pwg_om = _PWG_OUTPUT_MODE_MONOCHROME;
else
pwg_om = _PWG_OUTPUT_MODE_COLOR;
if (print_quality)
{
pwg_pq = atoi(print_quality) - IPP_QUALITY_DRAFT;
if (pwg_pq < _PWG_PRINT_QUALITY_DRAFT)
pwg_pq = _PWG_PRINT_QUALITY_DRAFT;
else if (pwg_pq > _PWG_PRINT_QUALITY_HIGH)
pwg_pq = _PWG_PRINT_QUALITY_HIGH;
}
else
pwg_pq = _PWG_PRINT_QUALITY_NORMAL;
if (pwg->num_presets[pwg_om][pwg_pq] == 0)
{
/*
* Try to find a preset that works so that we maximize the chances of us
* getting a good print using IPP attributes.
*/
if (pwg->num_presets[pwg_om][_PWG_PRINT_QUALITY_NORMAL] > 0)
pwg_pq = _PWG_PRINT_QUALITY_NORMAL;
else if (pwg->num_presets[_PWG_OUTPUT_MODE_COLOR][pwg_pq] > 0)
pwg_om = _PWG_OUTPUT_MODE_COLOR;
else
{
pwg_pq = _PWG_PRINT_QUALITY_NORMAL;
pwg_om = _PWG_OUTPUT_MODE_COLOR;
}
}
if (pwg->num_presets[pwg_om][pwg_pq] > 0)
{
/*
* Copy the preset options as long as the corresponding names are not
* already defined in the IPP request...
*/
for (i = pwg->num_presets[pwg_om][pwg_pq],
preset = pwg->presets[pwg_om][pwg_pq];
i > 0;
i --, preset ++)
{
if (!cupsGetOption(preset->name, num_options, options))
ppd_mark_option(ppd, preset->name, preset->value);
}
}
}
if (output_bin && !cupsGetOption("OutputBin", num_options, options) &&
(ppd_keyword = _pwgGetOutputBin(pwg, output_bin)) != NULL)
{
/*
* Map output-bin to OutputBin...
*/
ppd_mark_option(ppd, "OutputBin", ppd_keyword);
}
if (sides && pwg->sides_option &&
!cupsGetOption(pwg->sides_option, num_options, options))
{
/*
* Map sides to duplex option...
*/
if (!strcmp(sides, "one-sided"))
ppd_mark_option(ppd, pwg->sides_option, pwg->sides_1sided);
else if (!strcmp(sides, "two-sided-long-edge"))
ppd_mark_option(ppd, pwg->sides_option, pwg->sides_2sided_long);
else if (!strcmp(sides, "two-sided-short-edge"))
ppd_mark_option(ppd, pwg->sides_option, pwg->sides_2sided_short);
}
}
@@ -241,98 +272,11 @@ cupsMarkOptions(
for (i = num_options, optptr = options; i > 0; i --, optptr ++)
if (!strcasecmp(optptr->name, "media") ||
!strcasecmp(optptr->name, "media-col"))
!strcasecmp(optptr->name, "output-bin") ||
!strcasecmp(optptr->name, "output-mode") ||
!strcasecmp(optptr->name, "print-quality") ||
!strcasecmp(optptr->name, "sides"))
continue;
else if (!strcasecmp(optptr->name, "sides"))
{
for (j = 0;
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
j ++)
if (cupsGetOption(duplex_options[j], num_options, options))
break;
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
{
/*
* Don't override the PPD option with the IPP attribute...
*/
continue;
}
if (!strcasecmp(optptr->value, "one-sided"))
{
/*
* Mark the appropriate duplex option for one-sided output...
*/
for (j = 0;
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
j ++)
if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
break;
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
{
for (k = 0;
k < (int)(sizeof(duplex_one) / sizeof(duplex_one[0]));
k ++)
if (ppdFindChoice(option, duplex_one[k]))
{
ppd_mark_option(ppd, duplex_options[j], duplex_one[k]);
break;
}
}
}
else if (!strcasecmp(optptr->value, "two-sided-long-edge"))
{
/*
* Mark the appropriate duplex option for two-sided-long-edge output...
*/
for (j = 0;
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
j ++)
if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
break;
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
{
for (k = 0;
k < (int)(sizeof(duplex_two_long) / sizeof(duplex_two_long[0]));
k ++)
if (ppdFindChoice(option, duplex_two_long[k]))
{
ppd_mark_option(ppd, duplex_options[j], duplex_two_long[k]);
break;
}
}
}
else if (!strcasecmp(optptr->value, "two-sided-short-edge"))
{
/*
* Mark the appropriate duplex option for two-sided-short-edge output...
*/
for (j = 0;
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
j ++)
if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
break;
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
{
for (k = 0;
k < (int)(sizeof(duplex_two_short) / sizeof(duplex_two_short[0]));
k ++)
if (ppdFindChoice(option, duplex_two_short[k]))
{
ppd_mark_option(ppd, duplex_options[j], duplex_two_short[k]);
break;
}
}
}
}
else if (!strcasecmp(optptr->name, "resolution") ||
!strcasecmp(optptr->name, "printer-resolution"))
{
@@ -344,11 +288,6 @@ cupsMarkOptions(
ppd_mark_option(ppd, "CNRes_PGP", optptr->value);
/* Canon */
}
else if (!strcasecmp(optptr->name, "output-bin"))
{
if (!cupsGetOption("OutputBin", num_options, options))
ppd_mark_option(ppd, "OutputBin", optptr->value);
}
else if (!strcasecmp(optptr->name, "multiple-document-handling"))
{
if (!cupsGetOption("Collate", num_options, options) &&
@@ -421,7 +360,7 @@ cupsMarkOptions(
else
ppd_mark_option(ppd, optptr->name, optptr->value);
debug_marked(ppd, "After...");
ppd_debug_marked(ppd, "After...");
return (ppdConflicts(ppd) > 0);
}
@@ -581,7 +520,10 @@ ppdMarkDefaults(ppd_file_t *ppd) /* I - PPD file record */
for (c = (ppd_choice_t *)cupsArrayFirst(ppd->marked);
c;
c = (ppd_choice_t *)cupsArrayNext(ppd->marked))
{
cupsArrayRemove(ppd->marked, c);
c->marked = 0;
}
/*
* Then repopulate it with the defaults...
@@ -668,6 +610,7 @@ ppdNextOption(ppd_file_t *ppd) /* I - PPD file */
* This function looks for strings of the form:
*
* *option choice ... *optionN choiceN
* property value ... propertyN valueN
*
* It stops when it finds a string that doesn't match this format.
*/
@@ -676,10 +619,11 @@ int /* O - Number of options */
_ppdParseOptions(
const char *s, /* I - String to parse */
int num_options, /* I - Number of options */
cups_option_t **options) /* IO - Options */
cups_option_t **options, /* IO - Options */
_ppd_parse_t which) /* I - What to parse */
{
char option[PPD_MAX_NAME], /* Current option */
choice[PPD_MAX_NAME], /* Current choice */
char option[PPD_MAX_NAME * 2 + 1], /* Current option/property */
choice[PPD_MAX_NAME], /* Current choice/value */
*ptr; /* Pointer into option or choice */
@@ -687,8 +631,8 @@ _ppdParseOptions(
return (num_options);
/*
* Read all of the "*Option Choice" pairs from the string, marking PPD
* options as we go...
* Read all of the "*Option Choice" and "property value" pairs from the
* string, add them to an options array as we go...
*/
while (*s)
@@ -697,22 +641,18 @@ _ppdParseOptions(
* Skip leading whitespace...
*/
while (isspace(*s & 255))
while (_cups_isspace(*s))
s ++;
if (*s != '*')
break;
/*
* Get the option name...
* Get the option/property name...
*/
s ++;
ptr = option;
while (*s && !isspace(*s & 255) && ptr < (option + sizeof(option) - 1))
while (*s && !_cups_isspace(*s) && ptr < (option + sizeof(option) - 1))
*ptr++ = *s++;
if (ptr == s)
if (ptr == s || !_cups_isspace(*s))
break;
*ptr = '\0';
@@ -721,23 +661,29 @@ _ppdParseOptions(
* Get the choice...
*/
while (isspace(*s & 255))
while (_cups_isspace(*s))
s ++;
if (!*s)
break;
ptr = choice;
while (*s && !isspace(*s & 255) && ptr < (choice + sizeof(choice) - 1))
while (*s && !_cups_isspace(*s) && ptr < (choice + sizeof(choice) - 1))
*ptr++ = *s++;
if (*s && !_cups_isspace(*s))
break;
*ptr = '\0';
/*
* Add it to the options array...
*/
num_options = cupsAddOption(option, choice, num_options, options);
if (option[0] == '*' && which != _PPD_PARSE_PROPERTIES)
num_options = cupsAddOption(option + 1, choice, num_options, options);
else if (option[0] != '*' && which != _PPD_PARSE_OPTIONS)
num_options = cupsAddOption(option, choice, num_options, options);
}
return (num_options);
@@ -746,11 +692,11 @@ _ppdParseOptions(
#ifdef DEBUG
/*
* 'debug_marked()' - Output the marked array to stdout...
* 'ppd_debug_marked()' - Output the marked array to stdout...
*/
static void
debug_marked(ppd_file_t *ppd, /* I - PPD file data */
ppd_debug_marked(ppd_file_t *ppd, /* I - PPD file data */
const char *title) /* I - Title for list */
{
ppd_choice_t *c; /* Current choice */
@@ -806,7 +752,7 @@ ppd_mark_choices(ppd_file_t *ppd, /* I - PPD file */
return;
options = NULL;
num_options = _ppdParseOptions(s, 0, &options);
num_options = _ppdParseOptions(s, 0, &options, 0);
for (i = num_options, option = options; i > 0; i --, option ++)
ppd_mark_option(ppd, option->name, option->value);
@@ -842,6 +788,8 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
if (!strcasecmp(option, "AP_D_InputSlot"))
{
cupsArraySave(ppd->options);
if ((o = ppdFindOption(ppd, "InputSlot")) != NULL)
{
key.option = o;
@@ -851,13 +799,21 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
cupsArrayRemove(ppd->marked, oldc);
}
}
cupsArrayRestore(ppd->options);
}
/*
* Check for custom options...
*/
if ((o = ppdFindOption(ppd, option)) == NULL)
cupsArraySave(ppd->options);
o = ppdFindOption(ppd, option);
cupsArrayRestore(ppd->options);
if (!o)
return;
loc = localeconv();
@@ -912,15 +868,15 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
if (units)
{
if (!strcasecmp(units, "cm"))
cparam->current.custom_points *= 72.0f / 2.54f;
cparam->current.custom_points *= 72.0f / 2.54f;
else if (!strcasecmp(units, "mm"))
cparam->current.custom_points *= 72.0f / 25.4f;
cparam->current.custom_points *= 72.0f / 25.4f;
else if (!strcasecmp(units, "m"))
cparam->current.custom_points *= 72.0f / 0.0254f;
cparam->current.custom_points *= 72.0f / 0.0254f;
else if (!strcasecmp(units, "in"))
cparam->current.custom_points *= 72.0f;
cparam->current.custom_points *= 72.0f;
else if (!strcasecmp(units, "ft"))
cparam->current.custom_points *= 12.0f * 72.0f;
cparam->current.custom_points *= 12.0f * 72.0f;
}
break;
@@ -1060,6 +1016,8 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
* appropriate...
*/
cupsArraySave(ppd->options);
if (!strcasecmp(option, "PageSize"))
{
if ((o = ppdFindOption(ppd, "PageRegion")) != NULL)
@@ -1084,6 +1042,8 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
}
}
}
cupsArrayRestore(ppd->options);
}
else if (!strcasecmp(option, "InputSlot"))
{
@@ -1091,6 +1051,8 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
* Unmark ManualFeed option...
*/
cupsArraySave(ppd->options);
if ((o = ppdFindOption(ppd, "ManualFeed")) != NULL)
{
key.option = o;
@@ -1100,6 +1062,8 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
cupsArrayRemove(ppd->marked, oldc);
}
}
cupsArrayRestore(ppd->options);
}
else if (!strcasecmp(option, "ManualFeed") &&
!strcasecmp(choice, "True"))
@@ -1108,6 +1072,8 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
* Unmark InputSlot option...
*/
cupsArraySave(ppd->options);
if ((o = ppdFindOption(ppd, "InputSlot")) != NULL)
{
key.option = o;
@@ -1117,6 +1083,8 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
cupsArrayRemove(ppd->marked, oldc);
}
}
cupsArrayRestore(ppd->options);
}
}
@@ -1126,107 +1094,6 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
}
/*
* 'ppd_mark_size()' - Quickly mark a page size without checking for conflicts.
*
* This function is also responsible for mapping PWG/ISO/IPP size names to the
* PPD file...
*/
static void
ppd_mark_size(ppd_file_t *ppd, /* I - PPD file */
const char *size) /* I - Size name */
{
int i; /* Looping var */
_cups_pwg_media_t *pwgmedia; /* PWG media information */
ppd_size_t *ppdsize; /* Current PPD size */
double dw, dl; /* Difference in width and height */
double width, /* Width to find */
length; /* Length to find */
char width_str[256], /* Width in size name */
length_str[256],/* Length in size name */
units[256], /* Units in size name */
custom[256]; /* Custom size */
struct lconv *loc; /* Localization data */
/*
* See if this is a PPD size...
*/
if (!strncasecmp(size, "Custom.", 7) || ppdPageSize(ppd, size))
{
ppd_mark_option(ppd, "PageSize", size);
return;
}
/*
* Nope, try looking up the PWG or legacy (IPP/ISO) size name...
*/
if ((pwgmedia = _cupsPWGMediaByName(size)) == NULL)
pwgmedia = _cupsPWGMediaByLegacy(size);
if (pwgmedia)
{
width = pwgmedia->width;
length = pwgmedia->length;
}
else if (sscanf(size, "%*[^_]_%*[^_]_%255[0-9.]x%255[0-9.]%s", width_str,
length_str, units) == 3)
{
/*
* Got a "self-describing" name that isn't in our table...
*/
loc = localeconv();
width = _cupsStrScand(width_str, NULL, loc);
length = _cupsStrScand(length_str, NULL, loc);
if (!strcmp(units, "in"))
{
width *= 72.0;
length *= 72.0;
}
else if (!strcmp(units, "mm"))
{
width *= 25.4 / 72.0;
length *= 25.4 / 72.0;
}
else
return;
}
else
return;
/*
* Search the PPD file for a matching size...
*/
for (i = ppd->num_sizes, ppdsize = ppd->sizes; i > 0; i --, ppdsize ++)
{
dw = ppdsize->width - width;
dl = ppdsize->length - length;
if (dw > -5.0 && dw < 5.0 && dl > -5.0 && dl < 5.0)
{
ppd_mark_option(ppd, "PageSize", ppdsize->name);
return;
}
}
/*
* No match found; if custom sizes are supported, set a custom size...
*/
if (ppd->variable_sizes)
{
snprintf(custom, sizeof(custom), "Custom.%dx%d", (int)width, (int)length);
ppd_mark_option(ppd, "PageSize", custom);
}
}
/*
* End of "$Id$".
*/
+6 -6
Ver Arquivo
@@ -282,7 +282,7 @@ cupsParseOptions(
* Skip leading spaces...
*/
while (isspace(*ptr & 255))
while (_cups_isspace(*ptr))
ptr ++;
/*
@@ -296,7 +296,7 @@ cupsParseOptions(
*/
name = ptr;
while (!isspace(*ptr & 255) && *ptr != '=' && *ptr)
while (!strchr("\f\n\r\t\v =", *ptr) && *ptr)
ptr ++;
/*
@@ -310,7 +310,7 @@ cupsParseOptions(
* Skip trailing spaces...
*/
while (isspace(*ptr & 255))
while (_cups_isspace(*ptr))
*ptr++ = '\0';
if ((sep = *ptr) == '=')
@@ -339,7 +339,7 @@ cupsParseOptions(
value = ptr;
while (*ptr && !isspace(*ptr & 255))
while (*ptr && !_cups_isspace(*ptr))
{
if (*ptr == ',')
ptr ++;
@@ -394,7 +394,7 @@ cupsParseOptions(
* Normal space-delimited string...
*/
while (!isspace(*ptr & 255) && *ptr)
while (*ptr && !_cups_isspace(*ptr))
{
if (*ptr == '\\' && ptr[1])
_cups_strcpy(ptr, ptr + 1);
@@ -413,7 +413,7 @@ cupsParseOptions(
* Skip trailing whitespace...
*/
while (isspace(*ptr & 255))
while (_cups_isspace(*ptr))
ptr ++;
/*

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais