Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet 6cdc660c05 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.4.7@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
1068 arquivos alterados com 164123 adições e 16186 exclusões
+79 -6
Ver Arquivo
@@ -1,9 +1,87 @@
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)
- The scheduler and cupsfilter utility did not handle rules starting
with a negation operator properly (STR #3160)
- The scheduler and cupsfilter utility would crash with certain MIME
.types rules (STR #3159)
- httpSetField wasn't bracketing IPv6 numeric addresses for the Host:
field (STR #3164)
- The ServerName, if specified, was not treated as a valid alias for the
local system (STR #3167)
- "make epm" did not work (STR #3166)
- "lpstat -h server" showed non-shared printers (STR #3147)
- "make check" did not work on Linux (STR #3161)
CHANGES IN CUPS V1.3.10
- Documentation fixes (STR #2994, STR #2995, STR #3008)
- Documentation fixes (STR #2994, STR #2995, STR #3008, STR #3056,
STR #3057)
- SECURITY: The scheduler now protects against DNS rebinding attacks
(STR #3118)
- SECURITY: Fixed TIFF integer overflow in image filters (STR #3031)
- The scheduler did not support the job-hold-until attribute with the
Restart-Job operation (STR #3130)
- SECURITY: The PNG image reading code did not validate the
image size properly, leading to a potential buffer overflow
(STR #2974)
- The rastertohp driver did not set the 1-sided printing mode when
needed (STR #3131)
- Now use a wrapper program instead of our fork of the Xpdf code to
support printing of PDF files. The new wrapper supports using Xpdf,
poppler, or Ghostscript to convert PDF files to PostScript (STR #3129)
- Long job names caused problems with some PJL printers (STR #3125)
- The lpq command did not work when showing all destinations (STR #3117)
- The scheduler used a codeset name of UTF8 which is not supported on
Solaris (STR #3113)
- cupsGetJobs() did not work with a NULL destination (STR #3107)
- Fixed a localization problem for option choices (incorrectly) named
"Custom" (STR #3106)
- The fallback OpenSSL random number seeding would not work (STR #3079)
- The scheduler might miss a child signal, causing high CPU usage.
- The scheduler did not enforce quotas after the job history was
unloaded (STR #3078)
- The job-k-limit, job-page-limit, and job-quota-period attributes
could not be set using the lpadmin command (STR #3077)
- httpSeparateURI() did not error out on URIs with a missing port
number after a colon.
- Fixed a Valgrind-detected initialization error when creating a
missing directory on startup.
- The scheduler did not always read all of the HTTP headers from a
CGI script/program.
- The scheduler did not always set the "air" property in Bonjour/DNS-SD
registrations.
- The scheduler incorrectly compared Mac OS X UUIDs for access
control, preventing access in certain configurations.
- The IPP backend incorrectly reset the required authentication
to Kerberos when authentication failed.
- The scheduler no longer looks up the local hostname by default;
turn on hostname lookups to restore the previous behavior.
- The scheduler did not always load MIME type rules correctly
(STR #3059)
- The test page did not format correctly on A4 paper (STR #3060)
- The web interface sometimes incorrectly redirected users to
127.0.0.1 (STR #3022)
- cupsPrintFile*() did not send the document filename for single
file submissions (STR #3055)
- The scheduler did not update the member-names attribute when
removing the last printer from a class.
- The scheduler did not report PPD Products with parenthesis
in them properly (STR #3046)
- The wrong italic fonts were listed in the UTF-8 charset file
for the text filter.
- The backends did not return an OK status for the
@@ -35,11 +113,6 @@ CHANGES IN CUPS V1.3.10
- The scheduler now rejects ATTR: messages with empty values.
- The scheduler could consume all CPU handling closed connections
(STR #2988)
- The scheduler now protects against DNS rebinding attacks on
localhost.
- SECURITY: The PNG image reading code did not validate the
image size properly, leading to a potential buffer overflow
(STR #2974)
- Fixed some configure script bugs with rc/xinetd directories
(STR #2970)
- The Epson sample driver PPDs contained errors (STR #2979)
+562 -1
Ver Arquivo
@@ -1,6 +1,567 @@
CHANGES.txt - 2008-12-15
CHANGES.txt - 2011-06-20
------------------------
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,
STR #3173)
- Added complete localizations for German, Japanese, Polish, and
Russian and partial localizations for Chinese, Danish, Finnish,
French, Italian, Korean, Norwegian, Portuguese, and Swedish
(STR #3096, STR #3098, STR #3109, STR #3111, STR #3141)
- Updated the configure check for -fstack-protector (STR #3198)
- The network backends now correctly convert SNMP supply descriptions to
UTF-8 encoding as needed.
- The scheduler could crash when deleting an attribute (STR #3197)
- The cups-driverd program did not detect symlink loops (STR #3185)
- The EPSON 24-pin series driver should now feed the correct amount
(STR #2624)
- The scheduler now automatically logs the last N debug messages for
failed print jobs.
- You can now modify a raw print queue (STR #3133)
- Fixed a number of ppdi issues and added a unit test to validate that
ppdc + ppdi can generate and import the same data (STR #3152)
- Moving jobs in the web interface now shows an error if you only have
one printer or class added (STR #3094)
- Since classes have never truly supported the printer-error-policy
stuff added in CUPS 1.2, update the code to reflect the current
reality and support only the retry-current-job policy for now
(STR #3171)
- Revised the password callback support (STR #2953)
- ppdEmit*() did not choose between PageSize and PageRegion properly.
- Make some fairly substantial changes to the Kerberos support code so
that CUPS can work in multi-realm environments and does not require
delegatable credentials. Shared printing still requires delegation,
however "delegation by policy" can be enabled in the KDC to make this
all work.
- "AccessLogLevel actions" did not hide client-error-not-found errors.
- AP_FIRST_InputSlot did not work with number-up.
- cupsBackChannelRead() and cupsBackChannelWrite() could fail due to a
lack of kernel buffers.
- The IPP and LPD backends did not respond to side-channel requests
while copying print data to a temporary file.
- cupsWriteRequestData() flushed the output buffer unnecessarily,
causing reduced performance in some situations.
- If a CGI process died before sending its MIME headers, the request
would hang on the client.
- The printer/class/job search feature on the web interface did not
work (STR #3132)
- The scheduler did not write the printers out for classes.
- CUPS-Get-PPDs did not work properly when filtering by language,
product, or psversion (STR #3136)
- The scheduler now kills job filters when it takes more than 30 seconds
(configurable) to cancel or hold the job.
- The cupstestppd program did not validate the capitalization of
filenames in the PPD file.
- The cupstestppd program did not validate the PageSize and PageRegion
values.
- The cups-deviced helper program could miss reporting some backend
devices (STR #3108)
- The cupsSideChannelSNMP* functions did not work.
- The scheduler could consume 100% CPU when jobs were canceled.
- Clicking on "Select Another Make/Manufacturer" in the web interface
incorrectly added the printer (STR #3095)
- The scheduler no longer uses programs with insecure file
permissions.
- httpAssembleURI*() did not escape backslashes in hostnames.
- The dnssd backend did not unquote "full names" before creating the
device URI.
- The scheduler now supports JobRetryInterval values less than 10
seconds.
- Updated the Spanish localization (STR #3090)
- The scheduler did not redo Bonjour/DNS-SD registrations when updating
them failed.
- The "authenticated" policy incorrectly required authentication for
status operations.
- ppdOpen*() incorrectly loaded PPDs with multiple JobPatchFile
keywords.
- The network backends no longer report the SNMP "offline" or
maintenance status bits since they are inconsistently implemented and
often unreliable.
- The scheduler no longer logs child processes killed via SIGKILL as
"crashed".
- The printer link shown on the "job moved" template was bad (STR #3085)
- Updated the HTML templates to use the final HTML 4 DOCTYPE (STR #3086)
- The scheduler did not track the "paused" reason properly if a
printer had other reasons associated with it.
- cupsSendRequest() did not clear old local certificate auth data.
- The PPD compiler did not search for localization files properly
(STR #3084)
- cupsGetNamedDest() did not use the fallback default like
cupsGetDests*() (STR #3082)
- The scheduler now provides a LogTimeFormat directive to enable
microseconds in the date and time that are logged.
- The scheduler now provides a MultipleOperationTimeout directive to
control the timeout for multi-file print jobs.
- The configure script incorrectly allowed Avahi to be used for DNS-SD
printer discovery (STR #3065)
- The web interface and scheduler did not support URIs up to 1024 bytes
in length (STR #3072)
- Fixed pdftops issues with page sizes (STR #3063)
- Fixed pdftops issues with Ghostscript (STR #3062)
- The scheduler incorrectly registered default profiles for PostScript
printers with no specified colorspace.
- The scheduler incorrectly created an empty org.cups.printers.plist
file on Mac OS X.
- cupsGetPPD3() did not look for local PPDs in the right directory.
- SNMP lookups via side-channel did not work for NULL-VALUE and
and OCTET-STRING OIDs containing nul characters.
- The libusb-based USB backend did not work.
- The scheduler did not set the printer-commands attribute correctly
for some PPDs.
- The ppdi utility did not work.
- The web interface no longer uses multi-part output with old or broken
web browsers (STR #3049)
- CUPS now conforms to the draft IPP/2.0 and IPP/2.1 specification.
- Added a new cupsGetConflicts() API to get a list of conflicting
options.
- The PPD compiler didn't localize options or choices that did not
have associated translation text (STR #3045)
- Updated the Spanish localization (STR #3043)
- Fixed build problems (STR #3040, STR #3047)
- cupsResolveConflicts() did not resolve using the default option
choice in some cases due to the mirror UIConstraints that are
present in most PPD files.
- The scheduler did not honor MIME type priorities.
- The commandtops filter incorrectly used the JCLBegin code to end
its jobs.
- The default BrowseLocalProtocols value was not set properly.
- Since the commandtops filter does not actually support ReportLevels
all on its own, don't list that printer command by default for PS
printers.
- The scheduler did not give filters a chance to log errors or update
printer attributes when a job was canceled.
- The scheduler did not clear the "connecting-to-device" reason keyword
when a job finished.
CHANGES IN CUPS V1.4b2
- Documentation updates (STR #2983, STR #2998, STR #3021)
+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.
+15 -9
Ver Arquivo
@@ -1,14 +1,13 @@
INSTALL - CUPS v1.4b2 - 2008-12-15
INSTALL - CUPS v1.4.7 - 2011-01-06
----------------------------------
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
@@ -179,9 +178,16 @@ GETTING DEBUG LOGGING FROM CUPS
When configured with the "--enable-debug-printfs" option, CUPS compiles in
additional debug logging support in the scheduler, CUPS API, and CUPS
Imaging API. Set the CUPS_DEBUG_LOG environment variable to a filename to
append logging information at run-time. Use the name "-" to send the
messages to stderr.
Imaging API. The following environment variables are used to enable and
control debug logging:
CUPS_DEBUG_FILTER Specifies a POSIX regular expression to control
which messages are logged.
CUPS_DEBUG_LEVEL Specifies a number from 0 to 9 to control the
verbosity of the logging. The default level is 1.
CUPS_DEBUG_LOG Specifies a log file to use. Specify the name "-"
to send the messages to stderr. Prefix a filename
with "+" to append to an existing file.
REPORTING PROBLEMS
+18 -13
Ver Arquivo
@@ -1,6 +1,6 @@
Common UNIX Printing System License Agreement
CUPS License Agreement
Copyright 2007 by Apple Inc.
Copyright 2007-2009 by Apple Inc.
1 Infinite Loop
Cupertino, CA 95014 USA
@@ -9,11 +9,10 @@
INTRODUCTION
The Common UNIX Printing System(tm), ("CUPS(tm)"), is provided
under the GNU General Public License ("GPL") and GNU Library
General Public License ("LGPL"), Version 2, with exceptions for
Apple operating systems and the OpenSSL toolkit. A copy of the
exceptions and licenses follow this introduction.
CUPS(tm) is provided under the GNU General Public License ("GPL")
and GNU Library General Public License ("LGPL"), Version 2, with
exceptions for Apple operating systems and the OpenSSL toolkit. A
copy of the exceptions and licenses follow this introduction.
The GNU LGPL applies to the CUPS and CUPS Imaging libraries
located in the "cups" and "filter" subdirectories of the CUPS
@@ -137,12 +136,18 @@ redistribute it freely, subject to the following restrictions:
TRADEMARKS
Apple Inc. has trademarked the Common UNIX Printing System, CUPS,
and CUPS logo. You may use these names and logos in any direct port
or binary distribution of CUPS. Please contact Apple Inc. for written
permission to use them in derivative products. Our intention is to
protect the value of these trademarks and ensure that any derivative
product meets the same high-quality standards as the original.
CUPS and the CUPS logo (the "CUPS Marks") are trademarks of Apple
Inc. Apple grants you a non-exclusive and non-transferable right
to use the CUPS Marks in any direct port or binary distribution
incorporating CUPS software and in any promotional material
therefor. You agree that your products will meet the highest
levels of quality and integrity for similar goods, not be unlawful,
and be developed, manufactured, and distributed in compliance with
this license. You will not interfere with Apple's rights in the
CUPS Marks, and all use of the CUPS Marks shall inure to the
benefit of Apple. This license does not apply to use of the CUPS
Marks in a derivative products, which requires prior written
permission from Apple Inc.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
+12 -12
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id$"
#
# Common makefile definitions for the Common UNIX Printing System (CUPS).
# Common makefile definitions for 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
@@ -20,6 +20,7 @@
AR = @AR@
AWK = @AWK@
CC = @LIBTOOL@ @CC@
CHMOD = @CHMOD@
CXX = @LIBTOOL@ @CXX@
DSO = @DSO@
DSOXX = @DSOXX@
@@ -36,18 +37,17 @@ RMDIR = @RMDIR@
SED = @SED@
SHELL = /bin/sh
#
# Installation programs...
#
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755 @INSTALL_STRIP@
INSTALL_CONFIG = $(INSTALL) -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -c -m 444
INSTALL_DIR = $(INSTALL) -d
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755 @INSTALL_STRIP@
INSTALL_MAN = $(INSTALL) -m 644
INSTALL_SCRIPT = $(INSTALL) -m 755
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
INSTALL_MAN = $(INSTALL) -c -m 444
INSTALL_SCRIPT = $(INSTALL) -c -m 555
#
# Default user, group, and system groups for the scheduler...
@@ -144,7 +144,7 @@ LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \
LEGACY_BACKENDS = @LEGACY_BACKENDS@
LIBCUPSORDER = @LIBCUPSORDER@
LIBCUPSIMAGEORDER = @LIBCUPSIMAGEORDER@
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
LINKCUPS = @LINKCUPS@ $(SSLLIBS) $(DNSSDLIBS)
LINKCUPSIMAGE = @LINKCUPSIMAGE@
LIBS = $(LINKCUPS) $(COMMONLIBS)
OPTIM = @OPTIM@
@@ -263,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 $<...
@@ -275,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 $<...
+80 -22
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id$"
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
# Top-level Makefile for 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
@@ -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
#
@@ -316,35 +311,91 @@ uninstall:
fi \
$(RMDIR) $(BUILDROOT)$(INITDDIR); \
fi
if test "x$(SMFMANIFESTDIR)" != x; then \
echo Uninstalling SMF manifest in $(SMFMANIFESTDIR)...;\
$(RM) $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
fi
if test "x$(DBUSDIR)" != x; then \
echo Uninstalling cups.conf in $(DBUSDIR)...;\
$(RM) $(BUILDROOT)$(DBUSDIR)/cups.conf; \
$(RMDIR) $(BUILDROOT)$(DBUSDIR); \
fi
$(RM) $(BUILDROOT)/etc/xinetd.d/cups-lpd
$(RM) $(BUILDROOT)/usr/share/applications/cups.desktop
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/16x16/apps/cups.png
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/32x32/apps/cups.png
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/64x64/apps/cups.png
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/128x128/apps/cups.png
if test "x$(XINETD)" != x; then \
echo Uninstalling xinetd configuration file for cups-lpd...; \
$(RM) $(BUILDROOT)$(XINETD)/cups-lpd; \
fi
if test "x$(MENUDIR)" != x; then \
echo Uninstalling desktop menu...; \
$(RM) $(BUILDROOT)$(MENUDIR)/cups.desktop; \
fi
if test "x$(ICONDIR)" != x; then \
echo Uninstalling desktop icons...; \
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps/cups.png; \
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps/cups.png; \
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps/cups.png; \
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps/cups.png; \
fi
#
# Run the test suite...
#
test: all
test: all unittests
echo Running CUPS test suite...
cd test; ./run-stp-tests.sh
check: all
check: all unittests
echo Running CUPS test suite with defaults...
cd test; ./run-stp-tests.sh 1 0 n
#
# Make software distributions using EPM (http://www.easysw.com/epm/)...
# Create HTML documentation...
#
apihelp:
for dir in cgi-bin cups filter driver ppdc scheduler; do\
echo Generating API help in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
done
framedhelp:
for dir in cgi-bin cups filter driver ppdc scheduler; do\
echo Generating framed API help in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) framedhelp) || exit 1;\
done
#
# Create an Xcode docset...
#
docset: apihelp
echo Generating docset directory tree...
$(RM) -r org.cups.docset
mkdir -p org.cups.docset/Contents/Resources/Documentation/help
mkdir -p org.cups.docset/Contents/Resources/Documentation/images
cd man; $(MAKE) $(MFLAGS) html
cd doc; $(MAKE) $(MFLAGS) docset
cd cgi-bin; $(MAKE) $(MFLAGS) makedocset
cgi-bin/makedocset org.cups.docset \
`svnversion . | sed -e '1,$$s/[a-zA-Z]//g'` \
doc/help/api-*.tokens
$(RM) doc/help/api-*.tokens
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 \
org.cups.docset
#
# Make software distributions using EPM (http://www.epmhome.org/)...
#
EPMFLAGS = -v --output-dir dist $(EPMARCH)
@@ -369,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$".
#
+10 -23
Ver Arquivo
@@ -1,32 +1,19 @@
README - CUPS v1.4b2 - 2008-12-15
README - CUPS v1.4.7 - 2011-01-06
---------------------------------
**********************************************************************
**********************************************************************
********** **********
********** 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...
INTRODUCTION
The Common UNIX Printing System ("CUPS") is a standards-based, open source
printing system developed by Apple Inc. for Mac OS® X and other UNIX®-like
operating systems. CUPS uses the Internet Printing Protocol ("IPP") and
provides System V and Berkeley command-line interfaces, a web interface,
and a C API to manage printers and print jobs. It supports printing to
both local (parallel, serial, USB) and networked printers, and printers can
be shared from one computer to another, even over the Internet!
CUPS is a standards-based, open source printing system developed by Apple
Inc. for Mac OS® X and other UNIX®-like operating systems. CUPS uses the
Internet Printing Protocol ("IPP") and provides System V and Berkeley
command-line interfaces, a web interface, and a C API to manage printers and
print jobs. It supports printing to both local (parallel, serial, USB) and
networked printers, and printers can be shared from one computer to another,
even over the Internet!
Internally, CUPS uses PostScript Printer Description ("PPD") files to
describe printer capabilities and features and a wide variety of generic
@@ -163,8 +150,8 @@ PRINTING FILES
LEGAL STUFF
CUPS is Copyright 2007-2008 by Apple Inc. CUPS, the CUPS logo, and the
Common UNIX Printing System are trademarks of Apple Inc.
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.
+9 -8
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Backend makefile 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
@@ -19,8 +19,8 @@ include ../Makedefs
RBACKENDS = ipp lpd $(DNSSD_BACKEND)
UBACKENDS = $(PAP) $(LEGACY_BACKENDS) serial snmp socket usb
TARGETS = test1284 testbackend testsupplies \
libbackend.a $(RBACKENDS) $(UBACKENDS)
UNITTESTS = test1284 testbackend testsupplies
TARGETS = libbackend.a $(RBACKENDS) $(UBACKENDS)
LIBOBJS = ieee1284.o network.o runloop.o snmp-supplies.o
OBJS = ipp.o lpd.o dnssd.o pap.o parallel.o scsi.o serial.o snmp.o \
socket.o test1284.o testbackend.o testsupplies.o usb.o
@@ -44,7 +44,7 @@ libs:
# Make unit tests...
#
unittests:
unittests: $(UNITTESTS)
#
@@ -52,7 +52,7 @@ unittests:
#
clean:
$(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http mdns
$(RM) $(OBJS) $(TARGETS) $(UNITTESTS) $(LIBOBJS) http mdns
#
@@ -137,7 +137,7 @@ uninstall:
test1284: test1284.o ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o test1284 test1284.o ../cups/libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -147,7 +147,7 @@ test1284: test1284.o ../cups/libcups.a
testbackend: testbackend.o ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o testbackend testbackend.o ../cups/libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -157,7 +157,8 @@ testbackend: testbackend.o ../cups/libcups.a
testsupplies: testsupplies.o libbackend.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o testsupplies testsupplies.o libbackend.a \
../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
$(COMMONLIBS) $(LIBZ)
#
+51 -8
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backend support definitions 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
@@ -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...
@@ -78,6 +98,7 @@ extern "C" {
#define CUPS_OID_prtGeneral CUPS_OID_printmib,5
#define CUPS_OID_prtGeneralTable CUPS_OID_prtGeneral,1
#define CUPS_OID_prtGeneralEntry CUPS_OID_prtGeneralTable,1
#define CUPS_OID_prtGeneralCurrentLocalization CUPS_OID_prtGeneralEntry,2
#define CUPS_OID_prtGeneralPrinterName CUPS_OID_prtGeneralEntry,16
#define CUPS_OID_prtGeneralSerialNumber CUPS_OID_prtGeneralEntry,17
@@ -87,6 +108,11 @@ extern "C" {
#define CUPS_OID_prtCoverDescription CUPS_OID_prtCoverEntry,2
#define CUPS_OID_prtCoverStatus CUPS_OID_prtCoverEntry,3
#define CUPS_OID_prtLocalization CUPS_OID_printmib,7
#define CUPS_OID_prtLocalizationTable CUPS_OID_prtLocalization,1
#define CUPS_OID_prtLocalizationEntry CUPS_OID_prtLocalizationTable,1
#define CUPS_OID_prtLocalizationCharacterSet CUPS_OID_prtLocalizationEntry,4
#define CUPS_OID_prtMarker CUPS_OID_printmib,10
#define CUPS_OID_prtMarkerTable CUPS_OID_prtMarker,2
#define CUPS_OID_prtMarkerEntry CUPS_OID_prtMarkerTable,1
@@ -238,6 +264,22 @@ extern "C" {
#define CUPS_TC_inserts 33
#define CUPS_TC_covers 34
/* These come from RFC 3808 to define character sets we support */
/* Also see http://www.iana.org/assignments/character-sets */
#define CUPS_TC_csASCII 3
#define CUPS_TC_csISOLatin1 4
#define CUPS_TC_csShiftJIS 17
#define CUPS_TC_csUTF8 106
#define CUPS_TC_csUnicode 1000 /* UCS2 BE */
#define CUPS_TC_csUCS4 1001 /* UCS4 BE */
#define CUPS_TC_csUnicodeASCII 1002
#define CUPS_TC_csUnicodeLatin1 1003
#define CUPS_TC_csUTF16BE 1013
#define CUPS_TC_csUTF16LE 1014
#define CUPS_TC_csUTF32 1017
#define CUPS_TC_csUTF32BE 1018
#define CUPS_TC_csUTF32LE 1019
/*
* Prototypes...
@@ -254,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);
+217 -107
Ver Arquivo
@@ -3,7 +3,7 @@
*
* DNS-SD discovery backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2008 by Apple Inc.
* Copyright 2008-2009 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -19,8 +19,11 @@
* browse_callback() - Browse devices.
* browse_local_callback() - Browse local devices.
* compare_devices() - Compare two devices.
* exec_backend() - Execute the backend that corresponds to the
* resolved service name.
* get_device() - Create or update a device.
* query_callback() - Process query data.
* sigterm_handler() - Handle termination signals...
* unquote() - Unquote a name string.
*/
@@ -53,7 +56,8 @@ typedef struct
char *name, /* Service name */
*domain, /* Domain name */
*fullName, /* Full name */
*make_and_model; /* Make and model from TXT record */
*make_and_model, /* Make and model from TXT record */
*device_id; /* 1284 device ID from TXT record */
cups_devtype_t type; /* Device registration type */
int priority, /* Priority associated with type */
cups_shared, /* CUPS shared printer? */
@@ -61,6 +65,14 @@ typedef struct
} cups_device_t;
/*
* Local globals...
*/
static int job_canceled = 0;
/* Set to 1 on SIGTERM */
/*
* Local functions...
*/
@@ -94,6 +106,7 @@ static void query_callback(DNSServiceRef sdRef,
uint16_t rrclass, uint16_t rdlen,
const void *rdata, uint32_t ttl,
void *context);
static void sigterm_handler(int sig);
static void unquote(char *dst, const char *src, size_t dstsize);
@@ -122,14 +135,34 @@ main(int argc, /* I - Number of command-line args */
struct timeval timeout; /* Timeout for select() */
cups_array_t *devices; /* Device array */
cups_device_t *device; /* Current device */
char uriName[1024]; /* Unquoted fullName for URI */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Don't buffer stderr, and catch SIGTERM...
*/
setbuf(stderr, NULL);
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, sigterm_handler);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = sigterm_handler;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, sigterm_handler);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
setbuf(stderr, NULL);
if (argc >= 6)
exec_backend(argv);
else if (argc != 1)
@@ -217,7 +250,7 @@ main(int argc, /* I - Number of command-line args */
* Loop until we are killed...
*/
for (;;)
while (!job_canceled)
{
FD_ZERO(&input);
FD_SET(fd, &input);
@@ -246,9 +279,6 @@ main(int argc, /* I - Number of command-line args */
cups_device_t *best; /* Best matching device */
char device_uri[1024]; /* Device URI */
int count; /* Number of queries */
static const char * const schemes[] =
{ "lpd", "ipp", "ipp", "socket", "riousbprint" };
/* URI schemes for devices */
for (device = (cups_device_t *)cupsArrayFirst(devices),
@@ -297,12 +327,14 @@ main(int argc, /* I - Number of command-line args */
else if (strcasecmp(best->name, device->name) ||
strcasecmp(best->domain, device->domain))
{
unquote(uriName, best->fullName, sizeof(uriName));
httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
schemes[best->type], NULL, best->fullName, 0,
"dnssd", NULL, uriName, 0,
best->cups_shared ? "/cups" : "/");
cupsBackendReport("network", device_uri, best->make_and_model,
best->name, NULL, NULL);
best->name, best->device_id, NULL);
best->sent = 1;
best = device;
}
@@ -319,16 +351,20 @@ main(int argc, /* I - Number of command-line args */
if (best)
{
unquote(uriName, best->fullName, sizeof(uriName));
httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
schemes[best->type], NULL, best->fullName, 0,
"dnssd", NULL, uriName, 0,
best->cups_shared ? "/cups" : "/");
cupsBackendReport("network", device_uri, best->make_and_model,
best->name, NULL, NULL);
best->name, best->device_id, NULL);
best->sent = 1;
}
}
}
return (CUPS_BACKEND_OK);
}
@@ -430,12 +466,7 @@ static int /* O - Result of comparison */
compare_devices(cups_device_t *a, /* I - First device */
cups_device_t *b) /* I - Second device */
{
int result = strcmp(a->name, b->name);
if (result)
return (result);
else
return (strcmp(a->domain, b->domain));
return (strcmp(a->name, b->name));
}
@@ -458,6 +489,8 @@ exec_backend(char **argv) /* I - Command-line arguments */
* Resolve the device URI...
*/
job_canceled = -1;
if ((resolved_uri = cupsBackendDeviceURI(argv)) == NULL)
exit(CUPS_BACKEND_FAILED);
@@ -479,7 +512,7 @@ exec_backend(char **argv) /* I - Command-line arguments */
snprintf(filename, sizeof(filename), "%s/backend/%s", cups_serverbin, scheme);
/*
* Overwrite the device URIs and run the new backend...
* Overwrite the device URI and run the new backend...
*/
setenv("DEVICE_URI", resolved_uri, 1);
@@ -516,8 +549,7 @@ get_device(cups_array_t *devices, /* I - Device array */
* See if this is a new device...
*/
key.name = (char *)serviceName;
key.domain = (char *)replyDomain;
key.name = (char *)serviceName;
if (!strcmp(regtype, "_ipp._tcp.") ||
!strcmp(regtype, "_ipp-tls._tcp."))
@@ -534,11 +566,29 @@ get_device(cups_array_t *devices, /* I - Device array */
for (device = cupsArrayFind(devices, &key);
device;
device = cupsArrayNext(devices))
if (strcasecmp(device->name, key.name) ||
strcasecmp(device->domain, key.domain))
if (strcasecmp(device->name, key.name))
break;
else if (device->type == key.type)
{
if (!strcasecmp(device->domain, "local.") &&
strcasecmp(device->domain, replyDomain))
{
/*
* Update the .local listing to use the "global" domain name instead.
* The backend will try local lookups first, then the global domain name.
*/
free(device->domain);
device->domain = strdup(replyDomain);
DNSServiceConstructFullName(fullName, device->name, regtype,
replyDomain);
free(device->fullName);
device->fullName = strdup(fullName);
}
return (device);
}
/*
* Yes, add the device...
@@ -586,8 +636,8 @@ query_callback(
{
cups_array_t *devices; /* Device array */
char name[1024], /* Service name */
*ptr; /* Pointer into name */
cups_device_t key, /* Search key */
*ptr; /* Pointer into string */
cups_device_t dkey, /* Search key */
*device; /* Device */
@@ -610,123 +660,183 @@ query_callback(
* Lookup the service in the devices array.
*/
devices = (cups_array_t *)context;
key.name = name;
devices = (cups_array_t *)context;
dkey.name = name;
unquote(name, fullName, sizeof(name));
if ((key.domain = strstr(name, "._tcp.")) != NULL)
key.domain += 6;
if ((dkey.domain = strstr(name, "._tcp.")) != NULL)
dkey.domain += 6;
else
key.domain = (char *)"local.";
dkey.domain = (char *)"local.";
if ((ptr = strstr(name, "._")) != NULL)
*ptr = '\0';
if (strstr(fullName, "_ipp._tcp.") ||
strstr(fullName, "_ipp-tls._tcp."))
key.type = CUPS_DEVICE_IPP;
dkey.type = CUPS_DEVICE_IPP;
else if (strstr(fullName, "_fax-ipp._tcp."))
key.type = CUPS_DEVICE_FAX_IPP;
dkey.type = CUPS_DEVICE_FAX_IPP;
else if (strstr(fullName, "_printer._tcp."))
key.type = CUPS_DEVICE_PRINTER;
dkey.type = CUPS_DEVICE_PRINTER;
else if (strstr(fullName, "_pdl-datastream._tcp."))
key.type = CUPS_DEVICE_PDL_DATASTREAM;
dkey.type = CUPS_DEVICE_PDL_DATASTREAM;
else
key.type = CUPS_DEVICE_RIOUSBPRINT;
dkey.type = CUPS_DEVICE_RIOUSBPRINT;
for (device = cupsArrayFind(devices, &key);
for (device = cupsArrayFind(devices, &dkey);
device;
device = cupsArrayNext(devices))
{
if (strcasecmp(device->name, key.name) ||
strcasecmp(device->domain, key.domain))
if (strcasecmp(device->name, dkey.name) ||
strcasecmp(device->domain, dkey.domain))
{
device = NULL;
break;
}
else if (device->type == key.type)
else if (device->type == dkey.type)
{
/*
* Found it, pull out the priority and make and model from the TXT
* record and save it...
*/
const void *value; /* Pointer to value */
uint8_t valueLen; /* Length of value (max 255) */
char make_and_model[512], /* Manufacturer and model */
model[256], /* Model */
priority[256]; /* Priority */
const uint8_t *data, /* Pointer into data */
*datanext, /* Next key/value pair */
*dataend; /* End of entire TXT record */
uint8_t datalen; /* Length of current key/value pair */
char key[256], /* Key string */
value[256], /* Value string */
make_and_model[512],
/* Manufacturer and model */
model[256], /* Model */
device_id[2048];/* 1284 device ID */
value = TXTRecordGetValuePtr(rdlen, rdata, "priority", &valueLen);
device_id[0] = '\0';
make_and_model[0] = '\0';
if (value && valueLen)
strcpy(model, "Unknown");
for (data = rdata, dataend = data + rdlen;
data < dataend;
data = datanext)
{
memcpy(priority, value, valueLen);
priority[valueLen] = '\0';
device->priority = atoi(priority);
}
/*
* Read a key/value pair starting with an 8-bit length. Since the
* length is 8 bits and the size of the key/value buffers is 256, we
* don't need to check for overflow...
*/
if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MFG",
&valueLen)) == NULL)
value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MANUFACTURER",
&valueLen);
datalen = *data++;
if (value && valueLen)
{
memcpy(make_and_model, value, valueLen);
make_and_model[valueLen] = '\0';
}
else
make_and_model[0] = '\0';
if (!datalen || (data + datalen) >= dataend)
break;
if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MDL",
&valueLen)) == NULL)
value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MODEL", &valueLen);
datanext = data + datalen;
if (value && valueLen)
{
memcpy(model, value, valueLen);
model[valueLen] = '\0';
}
else if ((value = TXTRecordGetValuePtr(rdlen, rdata, "product",
&valueLen)) != NULL && valueLen > 2)
{
if (((char *)value)[0] == '(')
for (ptr = key; data < datanext && *data != '='; data ++)
*ptr++ = *data;
*ptr = '\0';
if (data < datanext && *data == '=')
{
/*
* Strip parenthesis...
*/
data ++;
memcpy(model, value + 1, valueLen - 2);
model[valueLen - 2] = '\0';
if (data < datanext)
memcpy(value, data, datanext - data);
value[datanext - data] = '\0';
}
else
{
memcpy(model, value, valueLen);
model[valueLen] = '\0';
}
continue;
if (!strcasecmp(model, "GPL Ghostscript") ||
!strcasecmp(model, "GNU Ghostscript") ||
!strcasecmp(model, "ESP Ghostscript"))
if (!strncasecmp(key, "usb_", 4))
{
if ((value = TXTRecordGetValuePtr(rdlen, rdata, "ty",
&valueLen)) != NULL)
/*
* Add USB device ID information...
*/
ptr = device_id + strlen(device_id);
snprintf(ptr, sizeof(device_id) - (ptr - device_id), "%s:%s;",
key + 4, value);
}
if (!strcasecmp(key, "usb_MFG") || !strcasecmp(key, "usb_MANU") ||
!strcasecmp(key, "usb_MANUFACTURER"))
strcpy(make_and_model, value);
else if (!strcasecmp(key, "usb_MDL") || !strcasecmp(key, "usb_MODEL"))
strcpy(model, value);
else if (!strcasecmp(key, "product") && !strstr(value, "Ghostscript"))
{
if (value[0] == '(')
{
memcpy(model, value, valueLen);
model[valueLen] = '\0';
/*
* Strip parenthesis...
*/
if ((ptr = strchr(model, ',')) != NULL)
if ((ptr = value + strlen(value) - 1) > value && *ptr == ')')
*ptr = '\0';
strcpy(model, value + 1);
}
else
strcpy(model, "Unknown");
strcpy(model, value);
}
else if (!strcasecmp(key, "ty"))
{
strcpy(model, value);
if ((ptr = strchr(model, ',')) != NULL)
*ptr = '\0';
}
else if (!strcasecmp(key, "priority"))
device->priority = atoi(value);
else if ((device->type == CUPS_DEVICE_IPP ||
device->type == CUPS_DEVICE_PRINTER) &&
!strcasecmp(key, "printer-type"))
{
/*
* This is a CUPS printer!
*/
device->cups_shared = 1;
if (device->type == CUPS_DEVICE_PRINTER)
device->sent = 1;
}
}
if (device->device_id)
free(device->device_id);
if (!device_id[0] && strcmp(model, "Unknown"))
{
if (make_and_model[0])
snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;",
make_and_model, model);
else if (!strncasecmp(model, "designjet ", 10))
snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s", model + 10);
else if (!strncasecmp(model, "stylus ", 7))
snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s", model + 7);
else if ((ptr = strchr(model, ' ')) != NULL)
{
/*
* Assume the first word is the make...
*/
memcpy(make_and_model, model, ptr - model);
make_and_model[ptr - model] = '\0';
snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s",
make_and_model, ptr + 1);
}
}
if (device_id[0])
device->device_id = strdup(device_id);
else
strcpy(model, "Unknown");
device->device_id = NULL;
if (device->make_and_model)
free(device->make_and_model);
@@ -735,25 +845,11 @@ query_callback(
{
strlcat(make_and_model, " ", sizeof(make_and_model));
strlcat(make_and_model, model, sizeof(make_and_model));
device->make_and_model = strdup(make_and_model);
}
else
device->make_and_model = strdup(model);
if ((device->type == CUPS_DEVICE_IPP ||
device->type == CUPS_DEVICE_PRINTER) &&
TXTRecordGetValuePtr(rdlen, rdata, "printer-type", &valueLen))
{
/*
* This is a CUPS printer!
*/
device->cups_shared = 1;
if (device->type == CUPS_DEVICE_PRINTER)
device->sent = 1;
}
break;
}
}
@@ -763,6 +859,20 @@ query_callback(
}
/*
* 'sigterm_handler()' - Handle termination signals...
*/
static void
sigterm_handler(int sig) /* I - Signal number (unused) */
{
if (job_canceled)
exit(CUPS_BACKEND_OK);
else
job_canceled = 1;
}
/*
* 'unquote()' - Unquote a name string.
*/
+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);
}
}
+170 -172
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP 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
@@ -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) */
@@ -143,7 +145,9 @@ main(int argc, /* I - Number of command-line args */
"copies-supported",
"document-format-supported",
"marker-colors",
"marker-high-levels",
"marker-levels",
"marker-low-levels",
"marker-message",
"marker-names",
"marker-types",
@@ -234,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);
@@ -258,7 +255,7 @@ main(int argc, /* I - Number of command-line args */
*/
compression = 0;
version = 1;
version = 11;
waitjob = 1;
waitprinter = 1;
contimeout = 7 * 24 * 60 * 60;
@@ -355,9 +352,13 @@ main(int argc, /* I - Number of command-line args */
else if (!strcasecmp(name, "version"))
{
if (!strcmp(value, "1.0"))
version = 0;
version = 10;
else if (!strcmp(value, "1.1"))
version = 1;
version = 11;
else if (!strcmp(value, "2.0"))
version = 20;
else if (!strcmp(value, "2.1"))
version = 21;
else
{
_cupsLangPrintf(stderr,
@@ -408,41 +409,40 @@ main(int argc, /* I - Number of command-line args */
* Copy stdin to a temporary file...
*/
int fd; /* File descriptor */
cups_file_t *fp; /* Temporary file */
char buffer[8192]; /* Buffer for copying */
int bytes; /* Number of bytes read */
off_t tbytes; /* Total bytes copied */
int fd; /* File descriptor */
http_addrlist_t *addrlist; /* Address list */
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"),
hostname);
return (CUPS_BACKEND_STOP);
}
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
return (CUPS_BACKEND_FAILED);
}
if ((fp = cupsFileOpenFd(fd, compression ? "w9" : "w")) == NULL)
{
_cupsLangPrintError(_("ERROR: Unable to open temporary file"));
close(fd);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
tbytes = 0;
tbytes = backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
backendNetworkSideCB);
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
if (cupsFileWrite(fp, buffer, bytes) < bytes)
{
_cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
cupsFileClose(fp);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
else
tbytes += bytes;
if (snmp_fd >= 0)
_cupsSNMPClose(snmp_fd);
cupsFileClose(fp);
httpAddrFreeList(addrlist);
close(fd);
/*
* Don't try printing files less than 2 bytes...
@@ -525,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)
@@ -603,7 +602,7 @@ main(int argc, /* I - Number of command-line args */
}
while (http == NULL);
if (job_cancelled)
if (job_cancelled || !http)
{
if (tmpfilename[0])
unlink(tmpfilename);
@@ -642,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
@@ -667,7 +667,8 @@ main(int argc, /* I - Number of command-line args */
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -682,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
@@ -713,16 +717,16 @@ main(int argc, /* I - Number of command-line args */
delay += 5;
}
else if ((ipp_status == IPP_BAD_REQUEST ||
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version == 1)
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version > 10)
{
/*
* Switch to IPP/1.0...
*/
_cupsLangPuts(stderr,
_("INFO: Printer does not support IPP/1.1, trying "
"IPP/1.0...\n"));
version = 0;
_cupsLangPrintf(stderr,
_("INFO: Printer does not support IPP/%d.%d, trying "
"IPP/1.0...\n"), version / 10, version % 10);
version = 10;
httpReconnect(http);
}
else if (ipp_status == IPP_NOT_FOUND)
@@ -734,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,
@@ -874,7 +887,8 @@ main(int argc, /* I - Number of command-line args */
else
request = ippNewRequest(IPP_PRINT_JOB);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -967,7 +981,7 @@ main(int argc, /* I - Number of command-line args */
"document-format", NULL, final_content_type);
}
if (copies_sup && version > 0 && send_options)
if (copies_sup && version > 10 && send_options)
{
/*
* Only send options if the destination printer supports the copies
@@ -1000,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
@@ -1022,21 +1039,44 @@ main(int argc, /* I - Number of command-line args */
sleep(10);
}
else if ((ipp_status == IPP_BAD_REQUEST ||
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version == 1)
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version > 10)
{
/*
* Switch to IPP/1.0...
*/
_cupsLangPuts(stderr,
_("INFO: Printer does not support IPP/1.1, trying "
"IPP/1.0...\n"));
version = 0;
_cupsLangPrintf(stderr,
_("INFO: Printer does not support IPP/%d.%d, trying "
"IPP/1.0...\n"), version / 10, version % 10);
version = 10;
httpReconnect(http);
}
else
{
/*
* Update auth-info-required as needed...
*/
_cupsLangPrintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"),
cupsLastErrorString());
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))
auth_info_required = "negotiate";
}
}
}
else if ((job_id_attr = ippFindAttribute(response, "job-id",
IPP_TAG_INTEGER)) == NULL)
@@ -1072,8 +1112,8 @@ main(int argc, /* I - Number of command-line args */
*/
request = ippNewRequest(IPP_SEND_DOCUMENT);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -1091,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)
@@ -1138,7 +1181,8 @@ main(int argc, /* I - Number of command-line args */
*/
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -1158,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);
@@ -1211,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);
@@ -1255,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...
*/
@@ -1287,20 +1353,19 @@ main(int argc, /* I - Number of command-line args */
* Return the queue status...
*/
if (ipp_status == IPP_NOT_AUTHORIZED)
{
/*
* Authorization failures here mean that we need Kerberos. Username +
* password authentication is handled in the password_cb function.
*/
fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
fputs("ATTR: auth-info-required=negotiate\n", stderr);
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);
}
}
@@ -1322,7 +1387,8 @@ cancel_job(http_t *http, /* I - HTTP connection */
_cupsLangPuts(stderr, _("INFO: Canceling print job...\n"));
request = ippNewRequest(IPP_CANCEL_JOB);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -1336,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)
@@ -1377,7 +1446,8 @@ check_printer_state(
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -1394,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);
@@ -1489,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 ++;
@@ -1498,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);
}
}
@@ -1602,11 +1668,8 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
*reasons, /* printer-state-reasons */
*marker; /* marker-* attributes */
const char *reason; /* Current reason */
const char *message; /* Message to show */
char unknown[1024]; /* Unknown message string */
const char *prefix; /* Prefix for STATE: line */
char state[1024]; /* State string */
cups_lang_t *language; /* Current localization */
int saw_caprw; /* Saw com.apple.print.recoverable-warning state */
@@ -1621,96 +1684,24 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
saw_caprw = 0;
state[0] = '\0';
prefix = "STATE: ";
language = cupsLangDefault();
for (i = 0, count = 0; i < reasons->num_values; i ++)
{
reason = reasons->values[i].string.text;
if (strcmp(reason, "paused"))
if (!strcmp(reason, "com.apple.print.recoverable-warning"))
saw_caprw = 1;
else if (strcmp(reason, "paused"))
{
strlcat(state, prefix, sizeof(state));
strlcat(state, reason, sizeof(state));
prefix = ",";
}
message = "";
if (!strncmp(reason, "media-needed", 12))
message = _("Media tray needs to be filled.");
else if (!strncmp(reason, "media-jam", 9))
message = _("Media jam!");
else if (!strncmp(reason, "moving-to-paused", 16) ||
!strncmp(reason, "offline", 7) ||
!strncmp(reason, "paused", 6) ||
!strncmp(reason, "shutdown", 8))
message = _("Printer offline.");
else if (!strncmp(reason, "toner-low", 9))
message = _("Toner low.");
else if (!strncmp(reason, "toner-empty", 11))
message = _("Out of toner!");
else if (!strncmp(reason, "cover-open", 10))
message = _("Cover open.");
else if (!strncmp(reason, "interlock-open", 14))
message = _("Interlock open.");
else if (!strncmp(reason, "door-open", 9))
message = _("Door open.");
else if (!strncmp(reason, "input-tray-missing", 18))
message = _("Media tray missing!");
else if (!strncmp(reason, "media-low", 9))
message = _("Media tray almost empty.");
else if (!strncmp(reason, "media-empty", 11))
message = _("Media tray empty!");
else if (!strncmp(reason, "output-tray-missing", 19))
message = _("Output tray missing!");
else if (!strncmp(reason, "output-area-almost-full", 23))
message = _("Output bin almost full.");
else if (!strncmp(reason, "output-area-full", 16))
message = _("Output bin full!");
else if (!strncmp(reason, "marker-supply-low", 17))
message = _("Ink/toner almost empty.");
else if (!strncmp(reason, "marker-supply-empty", 19))
message = _("Ink/toner empty!");
else if (!strncmp(reason, "marker-waste-almost-full", 24))
message = _("Ink/toner waste bin almost full.");
else if (!strncmp(reason, "marker-waste-full", 17))
message = _("Ink/toner waste bin full!");
else if (!strncmp(reason, "fuser-over-temp", 15))
message = _("Fuser temperature high!");
else if (!strncmp(reason, "fuser-under-temp", 16))
message = _("Fuser temperature low!");
else if (!strncmp(reason, "opc-near-eol", 12))
message = _("OPC almost at end-of-life.");
else if (!strncmp(reason, "opc-life-over", 13))
message = _("OPC at end-of-life!");
else if (!strncmp(reason, "developer-low", 13))
message = _("Developer almost empty.");
else if (!strncmp(reason, "developer-empty", 15))
message = _("Developer empty!");
else if (!strcmp(reason, "com.apple.print.recoverable-warning"))
saw_caprw = 1;
else if (strstr(reason, "error") != NULL)
{
message = unknown;
snprintf(unknown, sizeof(unknown), _("Unknown printer error (%s)!"),
reason);
}
if (message[0])
{
count ++;
if (strstr(reasons->values[i].string.text, "error"))
fprintf(stderr, "ERROR: %s\n", _cupsLangString(language, message));
else if (strstr(reasons->values[i].string.text, "warning"))
fprintf(stderr, "WARNING: %s\n", _cupsLangString(language, message));
else
fprintf(stderr, "INFO: %s\n", _cupsLangString(language, message));
}
}
fprintf(stderr, "%s\n", state);
if (state[0])
fprintf(stderr, "%s\n", state);
/*
* Relay com.apple.print.recoverable-message...
@@ -1728,9 +1719,15 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
if ((marker = ippFindAttribute(ipp, "marker-colors", IPP_TAG_NAME)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-high-levels",
IPP_TAG_INTEGER)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-levels",
IPP_TAG_INTEGER)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-low-levels",
IPP_TAG_INTEGER)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-message", IPP_TAG_TEXT)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-names", IPP_TAG_NAME)) != NULL)
@@ -1797,8 +1794,7 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
if ((fd = cupsTempFd(pstmpname, sizeof(pstmpname))) < 0)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to create temporary file - %s.\n"),
strerror(errno));
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
if (ppdfile)
unlink(ppdfile);
return (-1);
@@ -1838,8 +1834,7 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
* file...
*/
close(1);
dup(fd);
dup2(fd, 1);
close(fd);
if (!getuid())
@@ -1848,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],
+33 -20
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Line Printer Daemon backend 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
@@ -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)
@@ -386,7 +385,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
sanitize_title = !value[0] || !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
}
else if (!strcasecmp(name, "timeout"))
{
@@ -424,24 +423,37 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Copy stdin to a temporary file...
*/
char buffer[8192]; /* Buffer for copying */
int bytes; /* Number of bytes read */
http_addrlist_t *addrlist; /* Address list */
int snmp_fd; /* SNMP socket */
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"),
hostname);
return (CUPS_BACKEND_STOP);
}
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
return (CUPS_BACKEND_FAILED);
}
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);
}
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
backendNetworkSideCB);
if (snmp_fd >= 0)
_cupsSNMPClose(snmp_fd);
httpAddrFreeList(addrlist);
}
else if (argc == 6)
{
@@ -672,6 +684,9 @@ 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)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
@@ -696,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,
@@ -784,7 +798,6 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
error = errno;
close(fd);
fd = -1;
if (addr->next)
continue;
+31 -14
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Common network APIs for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -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)
{
@@ -162,58 +159,76 @@ backendNetworkSideCB(
case CUPS_ASN1_BOOLEAN :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%d",
packet.object_value.boolean);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_INTEGER :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%d",
packet.object_value.integer);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_BIT_STRING :
case CUPS_ASN1_OCTET_STRING :
strlcpy(dataptr, packet.object_value.string,
sizeof(data) - (dataptr - data));
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);
datalen += i;
break;
case CUPS_ASN1_OID :
_cupsSNMPOIDToString(packet.object_value.oid, dataptr,
sizeof(data) - (dataptr - data));
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_HEX_STRING :
for (i = 0;
i < packet.object_value.hex_string.num_bytes &&
i < packet.object_value.string.num_bytes &&
dataptr < (data + sizeof(data) - 3);
i ++, dataptr += 2)
sprintf(dataptr, "%02X",
packet.object_value.hex_string.bytes[i]);
packet.object_value.string.bytes[i]);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_COUNTER :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%d",
packet.object_value.counter);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_GAUGE :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%u",
packet.object_value.gauge);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_TIMETICKS :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%u",
packet.object_value.timeticks);
datalen += (int)strlen(dataptr);
break;
default :
fprintf(stderr, "DEBUG: Unknown OID value type %02X!\n",
packet.object_type);
case CUPS_ASN1_NULL_VALUE :
dataptr[0] = '\0';
break;
}
fprintf(stderr, "DEBUG: Returning %s %s\n", data, data + datalen);
status = CUPS_SC_STATUS_OK;
datalen += (int)strlen(data + datalen);
status = CUPS_SC_STATUS_OK;
}
else
fputs("DEBUG: SNMP read error...\n", stderr);
@@ -246,7 +261,8 @@ backendNetworkSideCB(
if (_cupsSNMPRead(snmp_fd, &packet, 1.0) &&
packet.object_type == CUPS_ASN1_OCTET_STRING)
{
strlcpy(data, packet.object_value.string, sizeof(data));
strlcpy(data, (char *)packet.object_value.string.bytes,
sizeof(data));
datalen = (int)strlen(data);
status = CUPS_SC_STATUS_OK;
}
@@ -259,6 +275,7 @@ backendNetworkSideCB(
{
strlcpy(data, device_id, sizeof(data));
datalen = (int)strlen(data);
status = CUPS_SC_STATUS_OK;
break;
}
@@ -268,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"));
+48 -38
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Serial port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 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
@@ -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;
}
@@ -944,7 +946,6 @@ list_devices(void)
# ifdef B115200
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
device, i + 1);
# else
printf("serial serial:%s?baud=38400 \"Unknown\" \"%s\"\n", device, info);
# endif /* B115200 */
@@ -1212,38 +1213,51 @@ list_devices(void)
{
CFTypeRef serialNameAsCFString;
CFTypeRef bsdPathAsCFString;
CFTypeRef hiddenVal;
char serialName[128];
char bsdPath[1024];
Boolean result;
serialNameAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOTTYDeviceKey),
kCFAllocatorDefault, 0);
if (serialNameAsCFString)
/* Check if hidden... */
hiddenVal = IORegistryEntrySearchCFProperty(serialService,
kIOServicePlane,
CFSTR("HiddenPort"),
kCFAllocatorDefault,
kIORegistryIterateRecursively |
kIORegistryIterateParents);
if (hiddenVal)
CFRelease(hiddenVal); /* This interface should not be used */
else
{
result = CFStringGetCString(serialNameAsCFString, serialName,
sizeof(serialName),
kCFStringEncodingASCII);
CFRelease(serialNameAsCFString);
if (result)
serialNameAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOTTYDeviceKey),
kCFAllocatorDefault, 0);
if (serialNameAsCFString)
{
bsdPathAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOCalloutDeviceKey),
kCFAllocatorDefault, 0);
if (bsdPathAsCFString)
result = CFStringGetCString(serialNameAsCFString, serialName,
sizeof(serialName),
kCFStringEncodingASCII);
CFRelease(serialNameAsCFString);
if (result)
{
result = CFStringGetCString(bsdPathAsCFString, bsdPath,
sizeof(bsdPath),
kCFStringEncodingASCII);
CFRelease(bsdPathAsCFString);
if (result)
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n",
bsdPath, serialName);
bsdPathAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOCalloutDeviceKey),
kCFAllocatorDefault, 0);
if (bsdPathAsCFString)
{
result = CFStringGetCString(bsdPathAsCFString, bsdPath,
sizeof(bsdPath),
kCFStringEncodingASCII);
CFRelease(bsdPathAsCFString);
if (result)
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n",
bsdPath, serialName);
}
}
}
}
@@ -1266,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? */
@@ -1280,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)
{
@@ -1311,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));
}
+381 -98
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* SNMP supplies functions for the Common UNIX Printing System (CUPS).
* SNMP supplies functions 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
@@ -17,7 +17,8 @@
*
* backendSNMPSupplies() - Get the current supplies for a device.
* backend_init_supplies() - Initialize the supplies list.
* backend_walk_cb() - Interpret the supply value responses...
* backend_walk_cb() - Interpret the supply value responses.
* utf16_to_utf8() - Convert UTF-16 text to UTF-8.
*/
/*
@@ -33,13 +34,25 @@
*/
#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...
*/
typedef struct
typedef struct /**** Printer supply data ****/
{
char name[CUPS_SNMP_MAX_STRING], /* Name of supply */
color[8]; /* Color: "#RRGGBB" or "none" */
@@ -49,16 +62,27 @@ typedef struct
level; /* Current level value */
} backend_supplies_t;
typedef struct /**** Printer state table ****/
{
int bit; /* State bit */
const char *keyword; /* IPP printer-state-reasons keyword */
} backend_state_t;
/*
* Local globals...
*/
static http_addr_t current_addr; /* Current address */
static int current_state = -1;
/* Current device state bits */
static int charset = -1; /* Character set for supply names */
static 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 };
@@ -69,6 +93,13 @@ static const int hrPrinterStatus[] =
static const int hrPrinterDetectedErrorState[] =
{ CUPS_OID_hrPrinterDetectedErrorState, 1, -1 };
/* Current printer state bits OID */
static const int prtGeneralCurrentLocalization[] =
{ CUPS_OID_prtGeneralCurrentLocalization, 1, -1 };
static const int prtLocalizationCharacterSet[] =
{ CUPS_OID_prtLocalizationCharacterSet, 1, 1, -1 },
prtLocalizationCharacterSetOffset =
(sizeof(prtLocalizationCharacterSet) /
sizeof(prtLocalizationCharacterSet[0]));
static const int prtMarkerColorantValue[] =
{ CUPS_OID_prtMarkerColorantValue, -1 },
/* Colorant OID */
@@ -118,6 +149,37 @@ static const int prtMarkerSuppliesType[] =
sizeof(prtMarkerSuppliesType[0]));
/* Offset to supply index */
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" }, */ /* 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 */
/* { CUPS_TC_serviceRequested | CUPS_TC_overduePreventMaint, "service-needed-warning" }, */ /* unreliable */
{ CUPS_TC_inputTrayMissing, "input-tray-missing-warning" },
{ CUPS_TC_outputTrayMissing, "output-tray-missing-warning" },
{ CUPS_TC_markerSupplyMissing, "marker-supply-missing-warning" },
{ CUPS_TC_outputNearFull, "output-area-almost-full-report" },
{ 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...
@@ -125,6 +187,8 @@ static const int prtMarkerSuppliesType[] =
static void backend_init_supplies(int snmp_fd, http_addr_t *addr);
static void backend_walk_cb(cups_snmp_t *packet, void *data);
static void utf16_to_utf8(cups_utf8_t *dst, const unsigned char *src,
size_t srcsize, size_t dstsize, int le);
/*
@@ -142,8 +206,8 @@ backendSNMPSupplies(
backend_init_supplies(snmp_fd, addr);
else if (num_supplies > 0)
_cupsSNMPWalk(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesLevel, 0.5,
backend_walk_cb, NULL);
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesLevel,
CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL);
if (page_count)
*page_count = -1;
@@ -153,30 +217,101 @@ backendSNMPSupplies(
if (num_supplies > 0)
{
int i; /* Looping var */
int i, /* Looping var */
percent, /* Percent full */
new_state, /* New state value */
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...
*/
for (i = 0, ptr = value; i < num_supplies; i ++, ptr += strlen(ptr))
{
percent = 100 * supplies[i].level / supplies[i].max_capacity;
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...
*/
@@ -186,77 +321,37 @@ backendSNMPSupplies(
hrPrinterDetectedErrorState))
return (-1);
if (!_cupsSNMPRead(snmp_fd, &packet, 0.5) ||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_OCTET_STRING)
return (-1);
i = ((packet.object_value.string[0] & 255) << 8) |
(packet.object_value.string[1] & 255);
if (i & CUPS_TC_lowPaper)
fputs("STATE: +media-low-report\n", stderr);
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
fputs("STATE: -media-low-report\n", stderr);
new_state = 0;
if (i & (CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty))
fputs("STATE: +media-empty-warning\n", stderr);
if (current_state < 0)
change_state = 0xffff;
else
fputs("STATE: -media-empty-warning\n", stderr);
change_state = current_state ^ new_state;
if (i & CUPS_TC_lowToner)
fputs("STATE: +toner-low-report\n", stderr);
else
fputs("STATE: -toner-low-report\n", stderr);
fprintf(stderr, "DEBUG: new_state=%x, change_state=%x\n", new_state,
change_state);
if (i & CUPS_TC_noToner)
fputs("STATE: +toner-empty-warning\n", stderr);
else
fputs("STATE: -toner-empty-warning\n", stderr);
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) ? '+' : '-',
printer_states[i].keyword);
}
if (i & CUPS_TC_doorOpen)
fputs("STATE: +door-open-report\n", stderr);
else
fputs("STATE: -door-open-report\n", stderr);
if (i & CUPS_TC_jammed)
fputs("STATE: +media-jam-warning\n", stderr);
else
fputs("STATE: -media-jam-warning\n", stderr);
if (i & CUPS_TC_offline)
fputs("STATE: +offline-report\n", stderr);
else
fputs("STATE: -offline-report\n", stderr);
if (i & (CUPS_TC_serviceRequested | CUPS_TC_overduePreventMaint))
fputs("STATE: +service-needed-warning\n", stderr);
else
fputs("STATE: -service-needed-warning\n", stderr);
if (i & CUPS_TC_inputTrayMissing)
fputs("STATE: +input-tray-missing-warning\n", stderr);
else
fputs("STATE: -input-tray-missing-warning\n", stderr);
if (i & CUPS_TC_outputTrayMissing)
fputs("STATE: +output-tray-missing-warning\n", stderr);
else
fputs("STATE: -output-tray-missing-warning\n", stderr);
if (i & CUPS_TC_markerSupplyMissing)
fputs("STATE: +marker-supply-missing-warning\n", stderr);
else
fputs("STATE: -marker-supply-missing-warning\n", stderr);
if (i & CUPS_TC_outputNearFull)
fputs("STATE: +output-area-almost-full-report\n", stderr);
else
fputs("STATE: -output-area-almost-full-report\n", stderr);
if (i & CUPS_TC_outputFull)
fputs("STATE: +output-area-full-warning\n", stderr);
else
fputs("STATE: -output-area-full-warning\n", stderr);
current_state = new_state;
/*
* Get the current printer state...
@@ -269,7 +364,7 @@ backendSNMPSupplies(
hrPrinterStatus))
return (-1);
if (!_cupsSNMPRead(snmp_fd, &packet, 0.5) ||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_INTEGER)
return (-1);
@@ -287,7 +382,7 @@ backendSNMPSupplies(
prtMarkerLifeCount))
return (-1);
if (!_cupsSNMPRead(snmp_fd, &packet, 0.5) ||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_COUNTER)
return (-1);
@@ -368,8 +463,10 @@ backend_init_supplies(
* Reset state information...
*/
current_addr = *addr;
num_supplies = -1;
current_addr = *addr;
current_state = -1;
num_supplies = -1;
charset = -1;
memset(supplies, 0, sizeof(supplies));
@@ -377,9 +474,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;
@@ -396,14 +493,17 @@ backend_init_supplies(
hrDeviceDescr))
return;
if (!_cupsSNMPRead(snmp_fd, &packet, 0.5) ||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_OCTET_STRING)
{
strlcpy(description, "Unknown", sizeof(description));
num_supplies = 0;
}
else
strlcpy(description, packet.object_value.string, sizeof(description));
strlcpy(description, (char *)packet.object_value.string.bytes,
sizeof(description));
fprintf(stderr, "DEBUG2: hrDeviceDesc=\"%s\"\n", description);
/*
* See if we have already queried this device...
@@ -422,28 +522,31 @@ backend_init_supplies(
/*
* Yes, read the cache file:
*
* 1 num_supplies
* 2 num_supplies charset
* device description
* supply structures...
*/
if (cupsFileGets(cachefile, value, sizeof(value)))
{
if (sscanf(value, "1 %d", &num_supplies) == 1 &&
if (sscanf(value, "2 %d%d", &num_supplies, &charset) == 2 &&
num_supplies <= CUPS_MAX_SUPPLIES &&
cupsFileGets(cachefile, value, sizeof(value)))
{
if ((ptr = value + strlen(value) - 1) >= value && *ptr == '\n')
*ptr = '\n';
if (!strcmp(description, value))
cupsFileRead(cachefile, (char *)supplies,
num_supplies * sizeof(backend_supplies_t));
else
{
num_supplies = -1;
charset = -1;
}
}
else
{
num_supplies = -1;
charset = -1;
}
}
cupsFileClose(cachefile);
@@ -453,6 +556,55 @@ backend_init_supplies(
* If the cache information isn't correct, scan for supplies...
*/
if (charset < 0)
{
/*
* Get the configured character set...
*/
int oid[CUPS_SNMP_MAX_OID]; /* OID for character set */
if (!_cupsSNMPWrite(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
prtGeneralCurrentLocalization))
return;
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_INTEGER)
{
fprintf(stderr,
"DEBUG: prtGeneralCurrentLocalization type is %x, expected %x!\n",
packet.object_type, CUPS_ASN1_INTEGER);
return;
}
fprintf(stderr, "DEBUG2: prtGeneralCurrentLocalization=%d\n",
packet.object_value.integer);
_cupsSNMPCopyOID(oid, prtLocalizationCharacterSet, CUPS_SNMP_MAX_OID);
oid[prtLocalizationCharacterSetOffset - 2] = packet.object_value.integer;
if (!_cupsSNMPWrite(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
oid))
return;
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_INTEGER)
{
fprintf(stderr,
"DEBUG: prtLocalizationCharacterSet type is %x, expected %x!\n",
packet.object_type, CUPS_ASN1_INTEGER);
return;
}
fprintf(stderr, "DEBUG2: prtLocalizationCharacterSet=%d\n",
packet.object_value.integer);
charset = packet.object_value.integer;
}
if (num_supplies < 0)
{
/*
@@ -460,8 +612,8 @@ backend_init_supplies(
*/
_cupsSNMPWalk(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesEntry, 0.5,
backend_walk_cb, NULL);
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesEntry,
CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL);
}
/*
@@ -473,7 +625,7 @@ backend_init_supplies(
if ((cachefile = cupsFileOpen(cachefilename, "w")) != NULL)
{
cupsFilePrintf(cachefile, "1 %d\n", num_supplies);
cupsFilePrintf(cachefile, "2 %d %d\n", num_supplies, charset);
cupsFilePrintf(cachefile, "%s\n", description);
if (num_supplies > 0)
@@ -494,8 +646,8 @@ backend_init_supplies(
strcpy(supplies[i].color, "none");
_cupsSNMPWalk(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), prtMarkerColorantValue, 0.5,
backend_walk_cb, NULL);
_cupsSNMPDefaultCommunity(), prtMarkerColorantValue,
CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL);
/*
* Output the marker-colors attribute...
@@ -557,7 +709,7 @@ backend_init_supplies(
/*
* 'backend_walk_cb()' - Interpret the supply value responses...
* 'backend_walk_cb()' - Interpret the supply value responses.
*/
static void
@@ -590,13 +742,13 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
i = packet->object_name[prtMarkerColorantValueOffset];
fprintf(stderr, "DEBUG2: prtMarkerColorantValue.1.%d = \"%s\"\n", i,
packet->object_value.string);
(char *)packet->object_value.string.bytes);
for (j = 0; j < num_supplies; j ++)
if (supplies[j].colorant == i)
{
for (k = 0; k < (int)(sizeof(colors) / sizeof(colors[0])); k ++)
if (!strcmp(colors[k][0], packet->object_value.string))
if (!strcmp(colors[k][0], (char *)packet->object_value.string.bytes))
{
strcpy(supplies[j].color, colors[k][1]);
break;
@@ -633,14 +785,84 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
packet->object_type != CUPS_ASN1_OCTET_STRING)
return;
fprintf(stderr, "DEBUG2: prtMarkerSuppliesDescription.1.%d = \"%s\"\n", i,
packet->object_value.string);
if (i > num_supplies)
num_supplies = i;
strlcpy(supplies[i - 1].name, packet->object_value.string,
sizeof(supplies[0].name));
switch (charset)
{
case CUPS_TC_csASCII :
case CUPS_TC_csUTF8 :
case CUPS_TC_csUnicodeASCII :
strlcpy(supplies[i - 1].name,
(char *)packet->object_value.string.bytes,
sizeof(supplies[0].name));
break;
case CUPS_TC_csISOLatin1 :
case CUPS_TC_csUnicodeLatin1 :
cupsCharsetToUTF8((cups_utf8_t *)supplies[i - 1].name,
(char *)packet->object_value.string.bytes,
sizeof(supplies[0].name), CUPS_ISO8859_1);
break;
case CUPS_TC_csShiftJIS :
cupsCharsetToUTF8((cups_utf8_t *)supplies[i - 1].name,
(char *)packet->object_value.string.bytes,
sizeof(supplies[0].name), CUPS_JIS_X0213);
break;
case CUPS_TC_csUCS4 :
case CUPS_TC_csUTF32 :
case CUPS_TC_csUTF32BE :
case CUPS_TC_csUTF32LE :
cupsUTF32ToUTF8((cups_utf8_t *)supplies[i - 1].name,
(cups_utf32_t *)packet->object_value.string.bytes,
sizeof(supplies[0].name));
break;
case CUPS_TC_csUnicode :
case CUPS_TC_csUTF16BE :
case CUPS_TC_csUTF16LE :
utf16_to_utf8((cups_utf8_t *)supplies[i - 1].name,
packet->object_value.string.bytes,
packet->object_value.string.num_bytes,
sizeof(supplies[0].name), charset == CUPS_TC_csUTF16LE);
break;
default :
/*
* If we get here, the printer is using an unknown character set and
* we just want to copy characters that look like ASCII...
*/
{
char *src, *dst; /* Pointers into strings */
/*
* Loop safe because both the object_value and supplies char arrays
* are CUPS_SNMP_MAX_STRING elements long.
*/
for (src = (char *)packet->object_value.string.bytes,
dst = supplies[i - 1].name;
*src;
src ++)
{
if ((*src & 0x80) || *src < ' ' || *src == 0x7f)
*dst++ = '?';
else
*dst++ = *src;
}
*dst = '\0';
}
break;
}
fprintf(stderr, "DEBUG2: prtMarkerSuppliesDescription.1.%d = \"%s\"\n", i,
supplies[i - 1].name);
}
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesLevel))
{
@@ -702,6 +924,67 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
}
/*
* 'utf16_to_utf8()' - Convert UTF-16 text to UTF-8.
*/
static void
utf16_to_utf8(
cups_utf8_t *dst, /* I - Destination buffer */
const unsigned char *src, /* I - Source string */
size_t srcsize, /* I - Size of source string */
size_t dstsize, /* I - Size of destination buffer */
int le) /* I - Source is little-endian? */
{
cups_utf32_t ch, /* Current character */
temp[CUPS_SNMP_MAX_STRING],
/* UTF-32 string */
*ptr; /* Pointer into UTF-32 string */
for (ptr = temp; srcsize >= 2;)
{
if (le)
ch = src[0] | (src[1] << 8);
else
ch = (src[0] << 8) | src[1];
src += 2;
srcsize -= 2;
if (ch >= 0xd800 && ch <= 0xdbff && srcsize >= 2)
{
/*
* Multi-word UTF-16 char...
*/
int lch; /* Lower word */
if (le)
lch = src[0] | (src[1] << 8);
else
lch = (src[0] << 8) | src[1];
if (lch >= 0xdc00 && lch <= 0xdfff)
{
src += 2;
srcsize -= 2;
ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000;
}
}
if (ptr < (temp + CUPS_SNMP_MAX_STRING - 1))
*ptr++ = ch;
}
*ptr = '\0';
cupsUTF32ToUTF8(dst, temp, dstsize);
}
/*
* End of "$Id$".
*/
+22 -20
Ver Arquivo
@@ -3,7 +3,7 @@
*
* SNMP discovery backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -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);
@@ -1015,18 +1015,18 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
char make_model[256]; /* Make and model */
if (strchr(packet.object_value.string, ':') &&
strchr(packet.object_value.string, ';'))
if (strchr((char *)packet.object_value.string.bytes, ':') &&
strchr((char *)packet.object_value.string.bytes, ';'))
{
/*
* Description is the IEEE-1284 device ID...
*/
if (!device->id)
device->id = strdup(packet.object_value.string);
device->id = strdup((char *)packet.object_value.string.bytes);
backendGetMakeModel(packet.object_value.string, make_model,
sizeof(make_model));
backendGetMakeModel((char *)packet.object_value.string.bytes,
make_model, sizeof(make_model));
if (device->info)
free(device->info);
@@ -1039,13 +1039,13 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
* Description is plain text...
*/
fix_make_model(make_model, packet.object_value.string,
fix_make_model(make_model, (char *)packet.object_value.string.bytes,
sizeof(make_model));
if (device->info)
free(device->info);
device->info = strdup(packet.object_value.string);
device->info = strdup((char *)packet.object_value.string.bytes);
}
if (!device->make_and_model)
@@ -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...
@@ -1066,14 +1068,14 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
if (device->id)
free(device->id);
device->id = strdup(packet.object_value.string);
device->id = strdup((char *)packet.object_value.string.bytes);
/*
* Convert the ID to a make and model string...
*/
backendGetMakeModel(packet.object_value.string, make_model,
sizeof(make_model));
backendGetMakeModel((char *)packet.object_value.string.bytes,
make_model, sizeof(make_model));
if (device->make_and_model)
free(device->make_and_model);
@@ -1084,7 +1086,7 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
case DEVICE_LOCATION :
if (device && packet.object_type == CUPS_ASN1_OCTET_STRING &&
!device->location)
device->location = strdup(packet.object_value.string);
device->location = strdup((char *)packet.object_value.string.bytes);
break;
case DEVICE_PRODUCT :
@@ -1096,33 +1098,33 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
*/
if (!device->info)
device->info = strdup(packet.object_value.string);
device->info = strdup((char *)packet.object_value.string.bytes);
if (device->make_and_model)
free(device->make_and_model);
device->make_and_model = strdup(packet.object_value.string);
device->make_and_model = strdup((char *)packet.object_value.string.bytes);
}
break;
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...
*/
if (!strncmp(packet.object_value.string, "lpr:", 4))
if (!strncmp((char *)packet.object_value.string.bytes, "lpr:", 4))
{
/*
* We want "lpd://..." for the URI...
*/
packet.object_value.string[2] = 'd';
packet.object_value.string.bytes[2] = 'd';
}
device->uri = strdup(packet.object_value.string);
device->uri = strdup((char *)packet.object_value.string.bytes);
}
break;
}
+17 -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,9 @@ 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)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
@@ -268,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)
@@ -343,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);
@@ -395,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)
@@ -408,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...
*/
@@ -416,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)
{
+328 -65
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backend test program for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -16,8 +16,10 @@
*
* Contents:
*
* main() - Run the named backend.
* usage() - Show usage information.
* main() - Run the named backend.
* sigterm_handler() - Flag when we get SIGTERM.
* usage() - Show usage information.
* walk_cb() - Show results of cupsSideChannelSNMPWalk...
*/
/*
@@ -33,13 +35,24 @@
#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);
/*
@@ -55,15 +68,24 @@ main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
int first_arg, /* First argument for backend */
do_query = 0, /* Do PostScript query? */
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? */
do_trickle = 0; /* Trickle data to backend */
do_trickle = 0, /* Trickle data to backend */
do_walk = 0, /* Do OID lookup (0) or walking (1) */
show_log = 0; /* Show log messages from backends? */
const char *oid = ".1.3.6.1.2.1.43.10.2.1.4.1.1";
/* OID to lookup or walk */
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 */
@@ -75,12 +97,33 @@ main(int argc, /* I - Number of command-line args */
for (first_arg = 1;
argv[first_arg] && argv[first_arg][0] == '-';
first_arg ++)
if (!strcmp(argv[first_arg], "-ps"))
do_query = 1;
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"))
do_ps = 1;
else if (!strcmp(argv[first_arg], "-s"))
do_side_tests = 1;
else if (!strcmp(argv[first_arg], "-t"))
do_trickle = 1;
else if (!strcmp(argv[first_arg], "-get") && (first_arg + 1) < argc)
{
first_arg ++;
do_side_tests = 1;
oid = argv[first_arg];
}
else if (!strcmp(argv[first_arg], "-walk") && (first_arg + 1) < argc)
{
first_arg ++;
do_side_tests = 1;
do_walk = 1;
oid = argv[first_arg];
}
else
usage();
@@ -133,33 +176,44 @@ main(int argc, /* I - Number of command-line args */
* Execute the trickle process as needed...
*/
if (do_trickle || do_query)
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
* 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)
@@ -176,17 +230,122 @@ 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
{
/*
* Do a simple PostScript query job to get the default page size.
* Do PS or PCL query + test pages.
*/
char buffer[1024]; /* Buffer for response data */
ssize_t bytes; /* Number of bytes of response data */
static const char *ps_query = /* PostScript query file */
char buffer[1024]; /* Buffer for response data */
ssize_t bytes; /* Number of bytes of response data */
double timeout; /* Timeout */
const char *data; /* Data to send */
static const char *pcl_data = /* PCL data */
"\033%-12345X@PJL\r\n"
"@PJL JOB NAME = \"Hello, World!\"\r\n"
"@PJL INFO USTATUS\r\n"
"@PJL ENTER LANGUAGE = PCL\r\n"
"\033E"
"Hello, World!\n"
"\014"
"\033%-12345X@PJL\r\n"
"@PJL EOJ NAME=\"Hello, World!\"\r\n"
"\033%-12345X";
static const char *ps_data = /* PostScript data */
"%!\n"
"save\n"
"product = flush\n"
"currentpagedevice /PageSize get aload pop\n"
"2 copy gt {exch} if\n"
"(Unknown)\n"
@@ -215,20 +374,33 @@ main(int argc, /* I - Number of command-line args */
" {exch pop exit} {pop} ifelse\n"
"} bind forall\n"
"= flush pop pop\n"
"/Courier findfont 12 scalefont setfont\n"
"0 setgray 36 720 moveto (Hello, ) show product show (!) show\n"
"showpage\n"
"restore\n"
"\004";
write(1, ps_query, strlen(ps_query));
if (do_pcl)
data = pcl_data;
else
data = ps_data;
write(1, data, strlen(data));
write(2, "DEBUG: START\n", 13);
while ((bytes = cupsBackChannelRead(buffer, sizeof(buffer), 30.0)) > 0)
timeout = 60.0;
while ((bytes = cupsBackChannelRead(buffer, sizeof(buffer),
timeout)) > 0)
{
write(2, buffer, bytes);
timeout = 5.0;
}
write(2, "\nDEBUG: END\n", 12);
}
exit(0);
}
else if (pid < 0)
else if (data_pid < 0)
{
perror("testbackend: Unable to fork");
return (1);
@@ -241,36 +413,51 @@ 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_query)
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]);
}
close(3);
dup(back_fds[1]);
close(back_fds[0]);
if (!show_log)
{
if ((fd = open("/dev/null", O_WRONLY)) != 2)
{
dup2(fd, 2);
close(fd);
}
}
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);
fprintf(stderr, "textbackend: Unable to execute \"%s\": %s\n", backend,
fprintf(stderr, "testbackend: Unable to execute \"%s\": %s\n", backend,
strerror(errno));
return (errno);
}
else if (pid < 0)
else if (back_pid < 0)
{
perror("testbackend: Unable to fork");
return (1);
@@ -280,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_query)
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]);
/*
@@ -322,7 +513,7 @@ main(int argc, /* I - Number of command-line args */
length = 0;
scstatus = cupsSideChannelDoRequest(CUPS_SC_CMD_DRAIN_OUTPUT, buffer,
&length, 5.0);
&length, 60.0);
printf("CUPS_SC_CMD_DRAIN_OUTPUT returned %s\n", statuses[scstatus]);
length = 1;
@@ -343,11 +534,31 @@ main(int argc, /* I - Number of command-line args */
printf("CUPS_SC_CMD_GET_STATE returned %s, %02X\n", statuses[scstatus],
buffer[0] & 255);
length = sizeof(buffer);
scstatus = cupsSideChannelSNMPGet(".1.3.6.1.2.1.43.10.2.1.4.1.1", buffer,
&length, 5.0);
printf("CUPS_SC_CMD_SNMP_GET returned %s, %s\n", statuses[scstatus],
buffer);
if (do_walk)
{
/*
* Walk the OID tree...
*/
scstatus = cupsSideChannelSNMPWalk(oid, 5.0, walk_cb, NULL);
printf("CUPS_SC_CMD_SNMP_WALK returned %s\n", statuses[scstatus]);
}
else
{
/*
* Lookup the same OID twice...
*/
length = sizeof(buffer);
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %s\n", oid,
statuses[scstatus], buffer);
length = sizeof(buffer);
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %s\n", oid,
statuses[scstatus], buffer);
}
length = 0;
scstatus = cupsSideChannelDoRequest(CUPS_SC_CMD_SOFT_RESET, buffer,
@@ -355,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));
}
}
/*
@@ -373,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.
*/
@@ -380,12 +616,39 @@ main(int argc, /* I - Number of command-line args */
static void
usage(void)
{
fputs("Usage: testbackend [-ps] [-s] [-t] device-uri job-id user title copies "
"options [file]\n", stderr);
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)");
puts(" -pcl Send PCL+PJL query and test page to backend.");
puts(" -ps Send PostScript query and test page to backend.");
puts(" -s Do side-channel + SNMP tests.");
puts(" -t Send spaces slowly to backend ('trickle').");
puts(" -walk OID Walk the specified SNMP OID.");
puts(" (.1.3.6.1.2.1.43 is a good one for printers)");
exit(1);
}
/*
* 'walk_cb()' - Show results of cupsSideChannelSNMPWalk...
*/
static void
walk_cb(const char *oid, /* I - OID */
const char *data, /* I - Data */
int datalen, /* I - Length of data */
void *context) /* I - Context (unused) */
{
printf("CUPS_SC_CMD_SNMP_WALK %s=%s (%d bytes)\n", oid, data, datalen);
}
/*
* End of "$Id$".
*/
+277 -87
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* "$Id$"
*
* Copyright 2005-2008 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 */
@@ -279,10 +290,10 @@ static void soft_reset();
static void status_timer_cb(CFRunLoopTimerRef timer, void *info);
#if defined(__i386__) || defined(__x86_64__)
static pid_t child_pid; /* Child PID */
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 */
static void sigterm_handler(int sig); /* SIGTERM handler */
#endif /* __i386__ || __x86_64__ */
static void sigterm_handler(int sig); /* SIGTERM handler */
#ifdef PARSE_PS_ERRORS
static const char *next_line (const char *buffer);
@@ -317,6 +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 */
pthread_t read_thread_id, /* Read thread */
sidechannel_thread_id;/* Side-channel thread */
int have_sidechannel = 0; /* Was the side-channel thread started? */
@@ -361,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);
}
@@ -419,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)
@@ -484,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);
}
}
@@ -502,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);
}
@@ -581,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);
return (0);
"written, aborting\n", stderr);
registry_close();
return (CUPS_BACKEND_OK);
}
else if (errno != EAGAIN)
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_STOP);
registry_close();
return (CUPS_BACKEND_FAILED);
}
}
@@ -609,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)
{
@@ -617,11 +642,12 @@ print_device(const char *uri, /* I - Device URI */
* Read error - bail if we don't see EAGAIN or EINTR...
*/
if (errno != EAGAIN || errno != EINTR)
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");
return CUPS_BACKEND_STOP;
registry_close();
return (CUPS_BACKEND_FAILED);
}
g.print_bytes = 0;
@@ -643,39 +669,77 @@ print_device(const char *uri, /* I - Device URI */
if (g.print_bytes)
{
bytes = g.print_bytes;
status = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
bytes = g.print_bytes;
iostatus = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
/*
* Ignore timeout errors, but retain the number of bytes written to
* avoid sending duplicate data (<rdar://problem/6254911>)...
*/
if (status == kIOUSBTransactionTimeout)
status = 0;
if (iostatus == kIOUSBTransactionTimeout)
{
fputs("DEBUG: Got USB transaction timeout during write\n", stderr);
iostatus = 0;
}
if (status || bytes < 0)
/*
* 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)
{
/*
* Write error - bail if we don't see an error we can retry...
*/
OSStatus err = (*g.classdriver)->Abort(g.classdriver);
_cupsLangPuts(stderr, _("ERROR: Unable to send print data!\n"));
fprintf(stderr, "DEBUG: USB class driver WritePipe returned %ld\n",
(long)status);
fprintf(stderr, "DEBUG: USB class driver Abort returned %ld\n",
(long)err);
status = CUPS_BACKEND_STOP;
_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 = 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)
@@ -686,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...
*/
@@ -716,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);
}
}
@@ -756,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);
}
}
@@ -821,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.
@@ -835,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...
@@ -876,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;
}
}
@@ -1055,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);
@@ -1241,56 +1378,86 @@ static kern_return_t load_classdriver(CFStringRef driverPath,
printer_interface_t intf,
classdriver_t ***printerDriver)
{
kern_return_t kr = kUSBPrinterClassDeviceNotOpen;
classdriver_t **driver = NULL;
CFStringRef bundle = (driverPath == NULL ? kUSBGenericTOPrinterClassDriver : driverPath);
kern_return_t kr = kUSBPrinterClassDeviceNotOpen;
classdriver_t **driver = NULL;
CFStringRef bundle = driverPath ? driverPath : kUSBGenericTOPrinterClassDriver;
char bundlestr[1024]; /* Bundle path */
struct stat bundleinfo; /* File information for bundle */
CFURLRef url; /* URL for driver */
CFPlugInRef plugin = NULL; /* Plug-in address */
if (bundle != NULL)
CFStringGetCString(bundle, bundlestr, sizeof(bundlestr), kCFStringEncodingUTF8);
/*
* Validate permissions for the class driver...
*/
if (stat(bundlestr, &bundleinfo))
{
CFURLRef url = CFURLCreateWithFileSystemPath(NULL, bundle, kCFURLPOSIXPathStyle, true);
CFPlugInRef plugin = (url != NULL ? CFPlugInCreate(NULL, url) : NULL);
fprintf(stderr, "DEBUG: Unable to load class driver \"%s\": %s\n",
bundlestr, strerror(errno));
if (errno == ENOENT)
return (load_classdriver(NULL, intf, printerDriver));
else
return (kr);
}
else if (bundleinfo.st_mode & S_IWOTH)
{
fprintf(stderr, "DEBUG: Unable to load class driver \"%s\": insecure file "
"permissions (0%o)\n", bundlestr, bundleinfo.st_mode);
return (kr);
}
if (url != NULL)
CFRelease(url);
/*
* Try loading the class driver...
*/
if (plugin != NULL)
url = CFURLCreateWithFileSystemPath(NULL, bundle, kCFURLPOSIXPathStyle, true);
if (url)
{
plugin = CFPlugInCreate(NULL, url);
CFRelease(url);
}
else
plugin = NULL;
if (plugin)
{
CFArrayRef factories = CFPlugInFindFactoriesForPlugInTypeInPlugIn(kUSBPrinterClassTypeID, plugin);
if (factories != NULL && CFArrayGetCount(factories) > 0)
{
CFArrayRef factories = CFPlugInFindFactoriesForPlugInTypeInPlugIn(kUSBPrinterClassTypeID, plugin);
if (factories != NULL && CFArrayGetCount(factories) > 0)
CFUUIDRef factoryID = CFArrayGetValueAtIndex(factories, 0);
IUnknownVTbl **iunknown = CFPlugInInstanceCreate(NULL, factoryID, kUSBPrinterClassTypeID);
if (iunknown != NULL)
{
CFUUIDRef factoryID = CFArrayGetValueAtIndex(factories, 0);
IUnknownVTbl **iunknown = CFPlugInInstanceCreate(NULL, factoryID, kUSBPrinterClassTypeID);
if (iunknown != NULL)
kr = (*iunknown)->QueryInterface(iunknown, CFUUIDGetUUIDBytes(kUSBPrinterClassInterfaceID), (LPVOID *)&driver);
if (kr == kIOReturnSuccess && driver != NULL)
{
kr = (*iunknown)->QueryInterface(iunknown, CFUUIDGetUUIDBytes(kUSBPrinterClassInterfaceID), (LPVOID *)&driver);
if (kr == kIOReturnSuccess && driver != NULL)
classdriver_t **genericDriver = NULL;
if (driverPath != NULL && CFStringCompare(driverPath, kUSBGenericTOPrinterClassDriver, 0) != kCFCompareEqualTo)
kr = load_classdriver(NULL, intf, &genericDriver);
if (kr == kIOReturnSuccess)
{
classdriver_t **genericDriver = NULL;
if (driverPath != NULL && CFStringCompare(driverPath, kUSBGenericTOPrinterClassDriver, 0) != kCFCompareEqualTo)
kr = load_classdriver(NULL, intf, &genericDriver);
(*driver)->interface = intf;
(*driver)->Initialize(driver, genericDriver);
if (kr == kIOReturnSuccess)
{
(*driver)->interface = intf;
(*driver)->Initialize(driver, genericDriver);
(*driver)->plugin = plugin;
(*driver)->interface = intf;
*printerDriver = driver;
}
(*driver)->plugin = plugin;
(*driver)->interface = intf;
*printerDriver = driver;
}
(*iunknown)->Release(iunknown);
}
CFRelease(factories);
(*iunknown)->Release(iunknown);
}
CFRelease(factories);
}
}
char bundlestr[1024];
CFStringGetCString(bundle, bundlestr, sizeof(bundlestr), kCFStringEncodingUTF8);
fprintf(stderr, "DEBUG: load_classdriver(%s) (kr:0x%08x)\n", bundlestr, (int)kr);
return kr;
return (kr);
}
@@ -1765,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 */
@@ -1813,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);
}
}
@@ -1831,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);
}
@@ -1861,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",
@@ -1883,22 +2052,44 @@ static void run_legacy_backend(int argc,
exit(exitstatus);
}
#endif /* __i386__ || __x86_64__ */
/*
* 'sigterm_handler()' - SIGTERM handler.
*/
static void sigterm_handler(int sig)
static void
sigterm_handler(int sig) /* I - Signal */
{
/* If we started a child process pass the signal on to it...
*/
#if defined(__i386__) || defined(__x86_64__)
/*
* If we started a child process pass the signal on to it...
*/
if (child_pid)
{
/*
* If we started a child process pass the signal on to it...
*/
int status;
kill(child_pid, sig);
while (waitpid(child_pid, &status, 0) < 0 && errno == EINTR);
exit(1);
}
if (WIFEXITED(status))
exit(WEXITSTATUS(status));
else if (status == SIGTERM || status == SIGKILL)
exit(0);
else
{
fprintf(stderr, "DEBUG: Child crashed on signal %d\n", status);
exit(CUPS_BACKEND_STOP);
}
}
#endif /* __i386__ || __x86_64__ */
}
#ifdef PARSE_PS_ERRORS
@@ -2049,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);
+36 -20
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Libusb interface code for the Common UNIX Printing System (CUPS).
* Libusb interface code for CUPS.
*
* Copyright 2007-2008 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 */
@@ -156,14 +156,23 @@ print_device(const char *uri, /* I - Device URI */
* TODO: Add back-channel support, along with better write error handling.
*/
if (poll(pfds, 2, -1) > 0)
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)
{
while (usb_bulk_write(printer->handle, printer->write_endp, buffer,
bytes, 45000) < 0)
if (usb_bulk_write(printer->handle, printer->write_endp, buffer,
bytes, 3600000) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to write %d bytes to printer!\n"),
@@ -174,12 +183,17 @@ print_device(const char *uri, /* I - Device URI */
tbytes += bytes;
}
else if (bytes < 0 && errno != EAGAIN && errno != EINTR)
else if (bytes == 0 || (bytes < 0 && errno != EAGAIN && errno != EINTR))
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));
}
+3 -1
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Berkeley commands makefile 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, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -76,10 +76,12 @@ install-data:
#
install-exec:
echo Installing Berkeley user printing commands in $(BINDIR)...
$(INSTALL_DIR) -m 755 $(BINDIR)
$(INSTALL_BIN) lpq $(BINDIR)
$(INSTALL_BIN) lpr $(BINDIR)
$(INSTALL_BIN) lprm $(BINDIR)
echo Installing Berkeley admin printing commands in $(BINDIR)...
$(INSTALL_DIR) -m 755 $(SBINDIR)
$(INSTALL_BIN) lpc $(SBINDIR)
if test "x$(SYMROOT)" != "x"; then \
+24 -9
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpq" command 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
@@ -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,21 +379,18 @@ 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);
if (dest == NULL)
if (id)
{
if (id)
sprintf(resource, "ipp://localhost/jobs/%d", id);
else
strcpy(resource, "ipp://localhost/jobs");
snprintf(resource, sizeof(resource), "ipp://localhost/jobs/%d", id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, resource);
}
else
else if (dest)
{
httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
NULL, "localhost", 0, "/printers/%s", dest);
@@ -390,6 +398,9 @@ show_jobs(const char *command, /* I - Command name */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, resource);
}
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, "ipp://localhost/");
if (user)
{
@@ -398,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...
*/
+3
Ver Arquivo
@@ -42,6 +42,9 @@ jobs.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
jobs.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
jobs.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
jobs.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
makedocset.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
makedocset.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h
makedocset.o: ../cups/file.h ../cups/language.h ../cups/array.h help-index.h
printers.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
printers.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
printers.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
+27 -9
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id$"
#
# CGI makefile for the Common UNIX Printing System (CUPS).
# CGI makefile for CUPS.
#
# 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
@@ -28,6 +28,7 @@ OBJS = \
classes.o \
help.o \
jobs.o \
makedocset.o \
printers.o \
testcgi.o \
testhi.o \
@@ -80,7 +81,7 @@ unittests: $(UNITTARGETS)
#
clean:
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS) makedocset
$(RM) libcupscgi.so libcupscgi.sl libcupscgi.dylib
@@ -117,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
@@ -157,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
#
@@ -194,6 +196,8 @@ apihelp:
--css ../doc/cups-printable.css \
--header api-cgi.header --intro api-cgi.shtml \
cgi.h help-index.h $(LIBOBJS:.o=.c) >../doc/help/api-cgi.html
mxmldoc --tokens help/api-cgi.html api-cgi.xml >../doc/help/api-cgi.tokens
$(RM) api-cgi.xml
framedhelp:
mxmldoc --framed api-cgi \
@@ -299,6 +303,17 @@ jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
$(CC) $(LDFLAGS) -o $@ jobs.o -lcupscgi $(LIBS)
#
# makedocset
#
makedocset: makedocset.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ makedocset.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
$(LIBZ) $(LIBGSSAPI)
#
# printers.cgi
#
@@ -315,7 +330,8 @@ printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
$(LIBZ) $(LIBGSSAPI)
echo Testing CGI API...
./testcgi
@@ -327,7 +343,8 @@ testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/libcups.a
testhi: testhi.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
$(LIBZ) $(LIBGSSAPI)
echo Testing help index API...
./testhi
@@ -339,7 +356,7 @@ testhi: testhi.o ../Makedefs libcupscgi.a ../cups/libcups.a
testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
$(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) $(LIBZ) $(LIBGSSAPI)
#
@@ -349,7 +366,8 @@ testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/libcups.a
websearch: websearch.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ websearch.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
$(LIBZ) $(LIBGSSAPI)
#
+217 -73
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Administration CGI for the Common UNIX Printing System (CUPS).
* Administration CGI for CUPS.
*
* Copyright 2007-2008 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)
{
/*
* 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,18 +1020,29 @@ 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())
cgiStartMultipart();
cgiSetVariable("CUPS_GET_DEVICES_DONE", "1");
cgiStartHTML(title);
cgiCopyTemplateLang("choose-device.tmpl");
cgiEndHTML();
if (cgiSupportsMultipart())
cgiEndMultipart();
}
else
{
fprintf(stderr,
@@ -941,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)
{
@@ -1016,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");
@@ -1043,9 +1160,10 @@ do_am_printer(http_t *http, /* I - HTTP connection */
return;
}
else if (!file && !cgiGetVariable("PPD_NAME"))
else if (!file &&
(!cgiGetVariable("PPD_NAME") || cgiGetVariable("SELECT_MAKE")))
{
if (modify)
if (modify && !cgiGetVariable("SELECT_MAKE"))
{
/*
* Get the PPD file...
@@ -1069,6 +1187,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
if (get_status != HTTP_OK)
{
httpFlush(http);
fprintf(stderr, "ERROR: Unable to get PPD file %s: %d - %s\n",
uri, get_status, httpStatus(get_status));
}
@@ -1120,9 +1240,9 @@ 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)
if ((var = cgiGetVariable("PPD_MAKE")) == NULL)
var = cgiGetVariable("CURRENT_MAKE");
if (var && !cgiGetVariable("SELECT_MAKE"))
{
const char *make_model; /* Make and model */
@@ -1130,8 +1250,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_TEXT,
"ppd-make", NULL, var);
if ((make_model = cgiGetVariable("CURRENT_MAKE_AND_MODEL")) != NULL &&
!cgiGetVariable("SELECT_MAKE"))
if ((make_model = cgiGetVariable("CURRENT_MAKE_AND_MODEL")) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_TEXT,
"ppd-make-and-model", NULL, make_model);
}
@@ -1149,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...
@@ -1185,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();
}
@@ -1443,14 +1565,18 @@ do_config_server(http_t *http) /* I - HTTP connection */
*share_printers,/* SHARE_PRINTERS value */
*user_cancel_any,
/* USER_CANCEL_ANY value */
*browse_web_if, /* BrowseWebIF value */
*preserve_job_history,
*browse_web_if = NULL,
/* BrowseWebIF value */
*preserve_job_history = NULL,
/* PreserveJobHistory value */
*preserve_job_files,
*preserve_job_files = NULL,
/* PreserveJobFiles value */
*max_clients, /* MaxClients value */
*max_jobs, /* MaxJobs value */
*max_log_size; /* MaxLogSize value */
*max_clients = NULL,
/* MaxClients value */
*max_jobs = NULL,
/* MaxJobs value */
*max_log_size = NULL;
/* MaxLogSize value */
char local_protocols[255],
/* BrowseLocalProtocols */
remote_protocols[255];
@@ -1474,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 */
@@ -1546,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
@@ -1799,7 +1925,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
perror(tempfile);
return;
}
@@ -1811,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);
@@ -2377,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));
}
/*
@@ -2481,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;
@@ -2514,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);
}
@@ -2587,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");
@@ -2953,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...
@@ -3199,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))
@@ -3224,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))
@@ -3310,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 ++;
}
@@ -3328,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 ++)
@@ -3972,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);
+34
Ver Arquivo
@@ -0,0 +1,34 @@
<!--
"$Id: api-array.header 8087 2008-10-27 21:37:05Z mike $"
CGI API header for CUPS.
Copyright 2009 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
law. Distribution and use rights are outlined in the file "LICENSE.txt"
which should have been included with this file. If this file is
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h1 class='title'>CGI API</h1>
<div class='summary'><table summary='General Information'>
<thead>
<tr>
<th>Header</th>
<th>cups/cgi.h</th>
</tr>
</thead>
<tbody>
<tr>
<th>Library</th>
<td>-lcupscgi</td>
</tr>
<tr>
<th>See Also</th>
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a></td>
</tr>
</tbody>
</table></div>
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<!--
"$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
CGI API introduction for CUPS.
Copyright 2009 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
law. Distribution and use rights are outlined in the file "LICENSE.txt"
which should have been included with this file. If this file is
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
<p>The CGI API provides Common Gateway Interface functions for CUPS.</p>
+19 -4
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* CGI support library definitions.
* CGI support library definitions for CUPS.
*
* 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
@@ -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);
@@ -95,8 +105,13 @@ extern void cgiShowIPPError(const char *message);
extern void cgiShowJobs(http_t *http, const char *dest);
extern void cgiStartHTML(const char *title);
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)");
+35 -12
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* HTML support functions for the Common UNIX Printing System (CUPS).
* HTML support functions 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
@@ -14,12 +14,13 @@
*
* Contents:
*
* cgiEndHTML() - End a HTML page.
* cgiEndMultipart() - End the delivery of a multipart web page.
* cgiFormEncode() - Encode a string as a form variable...
* cgiStartHTML() - Start a HTML page.
* cgiStartMultipart() - Start a multipart delivery of a web page...
* cgi_null_passwd() - Return a NULL password for authentication.
* cgiEndHTML() - End a HTML page.
* cgiEndMultipart() - End the delivery of a multipart web page.
* cgiFormEncode() - Encode a string as a form variable.
* cgiStartHTML() - Start a HTML page.
* cgiStartMultipart() - Start a multipart delivery of a web page.
* cgiSupportsMultipart() - Does the browser support multi-part documents?
* cgi_null_passwd() - Return a NULL password for authentication.
*/
/*
@@ -67,12 +68,15 @@ void
cgiEndMultipart(void)
{
if (cgi_multipart)
{
printf("\n%s--\n", cgi_multipart);
fflush(stdout);
}
}
/*
* 'cgiFormEncode()' - Encode a string as a form variable...
* 'cgiFormEncode()' - Encode a string as a form variable.
*/
char * /* O - Destination string */
@@ -183,18 +187,37 @@ cgiStartHTML(const char *title) /* I - Title of page */
/*
* 'cgiStartMultipart()' - Start a multipart delivery of a web page...
* 'cgiStartMultipart()' - Start a multipart delivery of a web page.
*/
void
cgiStartMultipart(void)
{
puts("MIME-Version: 1.0");
puts("Content-Type: multipart/x-mixed-replace; boundary=\"CUPS-MULTIPART\"\n");
puts("MIME-Version: 1.0\n"
"Content-Type: multipart/x-mixed-replace; boundary=\"CUPS-MULTIPART\"\n");
fflush(stdout);
cgi_multipart = "--CUPS-MULTIPART";
}
/*
* 'cgiSupportsMultipart()' - Does the browser support multi-part documents?
*/
int /* O - 1 if multi-part supported, 0 otherwise */
cgiSupportsMultipart(void)
{
/*
* 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... :(
*/
return (0);
}
/*
* 'cgi_null_passwd()' - Return a NULL password for authentication.
*/
+126 -68
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI <-> IPP variable routines 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
@@ -285,11 +285,14 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
/*
* See who is logged in...
* Make sure we have a username...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
{
puts("Status: 401\n");
exit(0);
}
/*
* See if the user has already selected a new destination...
@@ -334,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",
@@ -374,8 +377,14 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-uri-supported");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
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_SCANNER);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
@@ -415,7 +424,18 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
else
cgiStartHTML(cgiText(_("Move All Jobs")));
cgiCopyTemplateLang("job-move.tmpl");
if (cgiGetSize("JOB_PRINTER_NAME") > 0)
cgiCopyTemplateLang("job-move.tmpl");
else
{
if (job_id)
cgiSetVariable("MESSAGE", cgiText(_("Unable to move job")));
else
cgiSetVariable("MESSAGE", cgiText(_("Unable to move jobs")));
cgiSetVariable("ERROR", cgiText(_("No destinations added.")));
cgiCopyTemplateLang("error.tmpl");
}
}
else
{
@@ -477,7 +497,10 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
{
const char *path = strstr(job_printer_uri, "/printers/");
if (!path)
{
path = strstr(job_printer_uri, "/classes/");
cgiSetVariable("IS_CLASS", "YES");
}
if (path)
{
@@ -548,11 +571,14 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
* Show status...
*/
cgiStartMultipart();
cgiStartHTML(title);
cgiCopyTemplateLang("command.tmpl");
cgiEndHTML();
fflush(stdout);
if (cgiSupportsMultipart())
{
cgiStartMultipart();
cgiStartHTML(title);
cgiCopyTemplateLang("command.tmpl");
cgiEndHTML();
fflush(stdout);
}
/*
* Send the command file job...
@@ -574,7 +600,9 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
cgiStartHTML(title);
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
cgiEndMultipart();
if (cgiSupportsMultipart())
cgiEndMultipart();
return;
}
@@ -592,7 +620,9 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
cgiStartHTML(title);
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
cgiEndMultipart();
if (cgiSupportsMultipart())
cgiEndMultipart();
cupsCancelJob(dest, job_id);
return;
@@ -602,44 +632,48 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
* Wait for the job to complete...
*/
for (;;)
if (cgiSupportsMultipart())
{
/*
* Get the current job state...
*/
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, uri);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", 2, NULL, job_attrs);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM);
if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED)
for (;;)
{
/*
* Get the current job state...
*/
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, uri);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", 2, NULL, job_attrs);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM);
if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED ||
attr->values[0].integer == IPP_JOB_HELD)
{
ippDelete(response);
break;
}
/*
* Job not complete, so update the status...
*/
ippDelete(response);
break;
cgiStartHTML(title);
cgiCopyTemplateLang("command.tmpl");
cgiEndHTML();
fflush(stdout);
sleep(5);
}
/*
* Job not complete, so update the status...
*/
ippDelete(response);
cgiStartHTML(title);
cgiCopyTemplateLang("command.tmpl");
cgiEndHTML();
fflush(stdout);
sleep(5);
}
/*
@@ -655,7 +689,9 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
cgiStartHTML(title);
cgiCopyTemplateLang("command.tmpl");
cgiEndHTML();
cgiEndMultipart();
if (cgiSupportsMultipart())
cgiEndMultipart();
}
@@ -778,7 +814,7 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
int urlsize, /* I - Size of URL buffer */
const char *newresource) /* I - Replacement resource */
{
char method[HTTP_MAX_URI],
char scheme[HTTP_MAX_URI],
userpass[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
rawresource[HTTP_MAX_URI],
@@ -825,13 +861,13 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
* Convert the URI to a URL...
*/
httpSeparateURI(HTTP_URI_CODING_ALL, uri, method, sizeof(method), userpass,
httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass,
sizeof(userpass), hostname, sizeof(hostname), &port,
rawresource, sizeof(rawresource));
if (!strcmp(method, "ipp") ||
!strcmp(method, "http") ||
!strcmp(method, "https"))
if (!strcmp(scheme, "ipp") ||
!strcmp(scheme, "http") ||
!strcmp(scheme, "https"))
{
if (newresource)
{
@@ -870,7 +906,9 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
* Map local access to a local URI...
*/
if (!strcasecmp(hostname, "localhost") ||
if (!strcasecmp(hostname, "127.0.0.1") ||
!strcasecmp(hostname, "[::1]") ||
!strcasecmp(hostname, "localhost") ||
!strncasecmp(hostname, "localhost.", 10) ||
!strcasecmp(hostname, server) ||
!strcasecmp(hostname, servername))
@@ -892,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);
}
@@ -1364,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 */
@@ -1389,8 +1429,8 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
NULL, url);
}
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL,
"ipp://localhost/jobs");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
"ipp://localhost/");
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
@@ -1408,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);
@@ -1437,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)
{
@@ -1468,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...
+4
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
@@ -30,6 +33,7 @@ _cgiShowIPPError
_cgiShowJobs
_cgiStartHTML
_cgiStartMultipart
_cgiSupportsMultipart
_cgiText
_helpDeleteIndex
_helpFindNode
+486
Ver Arquivo
@@ -0,0 +1,486 @@
/*
* "$Id$"
*
* Xcode documentation set generator.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* Usage:
*
* makedocset directory *.tokens
*
* Contents:
*
* main() - Test the help index code.
* compare_html() - Compare the titles of two HTML files.
* compare_sections() - Compare the names of two help sections.
* compare_sections_files() - Compare the number of files and section names.
* write_index() - Write an index file for the CUPS help.
* write_info() - Write the Info.plist file.
* write_nodes() - Write the Nodes.xml file.
*/
/*
* Include necessary headers...
*/
#include "cgi.h"
#include <errno.h>
/*
* Local structures...
*/
typedef struct _cups_html_s /**** Help file ****/
{
char *path; /* Path to help file */
char *title; /* Title of help file */
} _cups_html_t;
typedef struct _cups_section_s /**** Help section ****/
{
char *name; /* Section name */
cups_array_t *files; /* Files in this section */
} _cups_section_t;
/*
* Local functions...
*/
static int compare_html(_cups_html_t *a, _cups_html_t *b);
static int compare_sections(_cups_section_t *a, _cups_section_t *b);
static int compare_sections_files(_cups_section_t *a, _cups_section_t *b);
static void write_index(const char *path, help_index_t *hi);
static void write_info(const char *path, const char *revision);
static void write_nodes(const char *path, help_index_t *hi);
/*
* 'main()' - Test the help index code.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
int i; /* Looping var */
char path[1024], /* Path to documentation */
line[1024]; /* Line from file */
help_index_t *hi; /* Help index */
cups_file_t *tokens, /* Tokens.xml file */
*fp; /* Current file */
if (argc < 4)
{
puts("Usage: makedocset directory revision *.tokens");
return (1);
}
/*
* Index the help documents...
*/
snprintf(path, sizeof(path), "%s/Contents/Resources/Documentation", argv[1]);
if ((hi = helpLoadIndex(NULL, path)) == NULL)
{
fputs("makedocset: Unable to index help files!\n", stderr);
return (1);
}
snprintf(path, sizeof(path), "%s/Contents/Resources/Documentation/index.html",
argv[1]);
write_index(path, hi);
snprintf(path, sizeof(path), "%s/Contents/Resources/Nodes.xml", argv[1]);
write_nodes(path, hi);
/*
* Write the Info.plist file...
*/
snprintf(path, sizeof(path), "%s/Contents/Info.plist", argv[1]);
write_info(path, argv[2]);
/*
* Merge the Tokens.xml files...
*/
snprintf(path, sizeof(path), "%s/Contents/Resources/Tokens.xml", argv[1]);
if ((tokens = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create \"%s\": %s\n", path,
strerror(errno));
return (1);
}
cupsFilePuts(tokens, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
cupsFilePuts(tokens, "<Tokens version=\"1.0\">\n");
for (i = 3; i < argc; i ++)
{
if ((fp = cupsFileOpen(argv[i], "r")) == NULL)
{
fprintf(stderr, "makedocset: Unable to open \"%s\": %s\n", argv[i],
strerror(errno));
return (1);
}
if (!cupsFileGets(fp, line, sizeof(line)) || strncmp(line, "<?xml ", 6) ||
!cupsFileGets(fp, line, sizeof(line)) || strncmp(line, "<Tokens ", 8))
{
fprintf(stderr, "makedocset: Bad Tokens.xml file \"%s\"!\n", argv[i]);
return (1);
}
while (cupsFileGets(fp, line, sizeof(line)))
{
if (strcmp(line, "</Tokens>"))
cupsFilePrintf(tokens, "%s\n", line);
}
cupsFileClose(fp);
}
cupsFilePuts(tokens, "</Tokens>\n");
cupsFileClose(tokens);
/*
* Return with no errors...
*/
return (0);
}
/*
* 'compare_html()' - Compare the titles of two HTML files.
*/
static int /* O - Result of comparison */
compare_html(_cups_html_t *a, /* I - First file */
_cups_html_t *b) /* I - Second file */
{
return (strcasecmp(a->title, b->title));
}
/*
* 'compare_sections()' - Compare the names of two help sections.
*/
static int /* O - Result of comparison */
compare_sections(_cups_section_t *a, /* I - First section */
_cups_section_t *b) /* I - Second section */
{
return (strcasecmp(a->name, b->name));
}
/*
* 'compare_sections_files()' - Compare the number of files and section names.
*/
static int /* O - Result of comparison */
compare_sections_files(
_cups_section_t *a, /* I - First section */
_cups_section_t *b) /* I - Second section */
{
int ret = cupsArrayCount(b->files) - cupsArrayCount(a->files);
if (ret)
return (ret);
else
return (strcasecmp(a->name, b->name));
}
/*
* 'write_index()' - Write an index file for the CUPS help.
*/
static void
write_index(const char *path, /* I - File to write */
help_index_t *hi) /* I - Index of files */
{
cups_file_t *fp; /* Output file */
help_node_t *node; /* Current help node */
_cups_section_t *section, /* Current section */
key; /* Section search key */
_cups_html_t *html; /* Current HTML file */
cups_array_t *sections, /* Sections in index */
*sections_files,/* Sections sorted by size */
*columns[3]; /* Columns in final HTML file */
int column, /* Current column */
lines[3], /* Number of lines in each column */
min_column, /* Smallest column */
min_lines; /* Smallest number of lines */
/*
* Build an array of sections and their files.
*/
sections = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
node;
node = (help_node_t *)cupsArrayNext(hi->nodes))
{
if (node->anchor)
continue;
key.name = node->section ? node->section : "Miscellaneous";
if ((section = (_cups_section_t *)cupsArrayFind(sections, &key)) == NULL)
{
section = (_cups_section_t *)calloc(1, sizeof(_cups_section_t));
section->name = key.name;
section->files = cupsArrayNew((cups_array_func_t)compare_html, NULL);
cupsArrayAdd(sections, section);
}
html = (_cups_html_t *)calloc(1, sizeof(_cups_html_t));
html->path = node->filename;
html->title = node->text;
cupsArrayAdd(section->files, html);
}
/*
* Build a sorted list of sections based on the number of files in each section
* and the section name...
*/
sections_files = cupsArrayNew((cups_array_func_t)compare_sections_files,
NULL);
for (section = (_cups_section_t *)cupsArrayFirst(sections);
section;
section = (_cups_section_t *)cupsArrayNext(sections))
cupsArrayAdd(sections_files, section);
/*
* Then build three columns to hold everything, trying to balance the number of
* lines in each column...
*/
for (column = 0; column < 3; column ++)
{
columns[column] = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
lines[column] = 0;
}
for (section = (_cups_section_t *)cupsArrayFirst(sections_files);
section;
section = (_cups_section_t *)cupsArrayNext(sections_files))
{
for (min_column = 0, min_lines = lines[0], column = 1;
column < 3;
column ++)
{
if (lines[column] < min_lines)
{
min_column = column;
min_lines = lines[column];
}
}
cupsArrayAdd(columns[min_column], section);
lines[min_column] += cupsArrayCount(section->files) + 2;
}
/*
* Write the HTML file...
*/
if ((fp = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
strerror(errno));
exit(1);
}
cupsFilePuts(fp, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 "
"Transitional//EN\" "
"\"http://www.w3.org/TR/html4/loose.dtd\">\n"
"<html>\n"
"<head>\n"
"<title>CUPS Documentation</title>\n"
"<link rel='stylesheet' type='text/css' "
"href='cups-printable.css'>\n"
"</head>\n"
"<body>\n"
"<h1 class='title'>CUPS Documentation</h1>\n"
"<table width='100%' summary=''>\n"
"<tr>\n");
for (column = 0; column < 3; column ++)
{
if (column)
cupsFilePuts(fp, "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n");
cupsFilePuts(fp, "<td valign='top' width='33%'>");
for (section = (_cups_section_t *)cupsArrayFirst(columns[column]);
section;
section = (_cups_section_t *)cupsArrayNext(columns[column]))
{
cupsFilePrintf(fp, "<h2 class='title'>%s</h2>\n", section->name);
for (html = (_cups_html_t *)cupsArrayFirst(section->files);
html;
html = (_cups_html_t *)cupsArrayNext(section->files))
cupsFilePrintf(fp, "<p class='compact'><a href='%s'>%s</a></p>\n",
html->path, html->title);
}
cupsFilePuts(fp, "</td>\n");
}
cupsFilePuts(fp, "</tr>\n"
"</table>\n"
"</body>\n"
"</html>\n");
cupsFileClose(fp);
}
/*
* 'write_info()' - Write the Info.plist file.
*/
static void
write_info(const char *path, /* I - File to write */
const char *revision) /* I - Subversion revision number */
{
cups_file_t *fp; /* File */
if ((fp = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
strerror(errno));
exit(1);
}
cupsFilePrintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" "
"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
"<plist version=\"1.0\">\n"
"<dict>\n"
"\t<key>CFBundleIdentifier</key>\n"
"\t<string>org.cups.docset</string>\n"
"\t<key>CFBundleName</key>\n"
"\t<string>CUPS Documentation</string>\n"
"\t<key>CFBundleVersion</key>\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.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",
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, revision,
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, CUPS_VERSION_PATCH);
cupsFileClose(fp);
}
/*
* 'write_nodes()' - Write the Nodes.xml file.
*/
static void
write_nodes(const char *path, /* I - File to write */
help_index_t *hi) /* I - Index of files */
{
cups_file_t *fp; /* Output file */
int id; /* Current node ID */
help_node_t *node; /* Current help node */
int subnodes; /* Currently in Subnodes for file? */
int needclose; /* Need to close the current node? */
if ((fp = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
strerror(errno));
exit(1);
}
cupsFilePuts(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<DocSetNodes version=\"1.0\">\n"
"<TOC>\n"
"<Node id=\"0\">\n"
"<Name>CUPS Documentation</Name>\n"
"<Path>Documentation/index.html</Path>\n"
"</Node>\n");
for (node = (help_node_t *)cupsArrayFirst(hi->nodes), id = 1, subnodes = 0,
needclose = 0;
node;
node = (help_node_t *)cupsArrayNext(hi->nodes), id ++)
{
if (node->anchor)
{
if (!subnodes)
{
cupsFilePuts(fp, "<Subnodes>\n");
subnodes = 1;
}
cupsFilePrintf(fp, "<Node id=\"%d\">\n"
"<Path>Documentation/%s</Path>\n"
"<Anchor>%s</Anchor>\n"
"<Name>%s</Name>\n"
"</Node>\n", id, node->filename, node->anchor,
node->text);
}
else
{
if (subnodes)
{
cupsFilePuts(fp, "</Subnodes>\n");
subnodes = 0;
}
if (needclose)
cupsFilePuts(fp, "</Node>\n");
cupsFilePrintf(fp, "<Node id=\"%d\">\n"
"<Path>Documentation/%s</Path>\n"
"<Name>%s</Name>\n", id, node->filename, node->text);
needclose = 1;
}
}
if (subnodes)
cupsFilePuts(fp, "</Subnodes>\n");
if (needclose)
cupsFilePuts(fp, "</Node>\n");
cupsFilePuts(fp, "</TOC>\n"
"</DocSetNodes>\n");
cupsFileClose(fp);
}
/*
* End of "$Id$".
*/
+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);
+299 -36
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* CGI form variable and array functions.
* CGI form variable and array functions for CUPS.
*
* Copyright 2007-2008 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 */
@@ -148,13 +196,21 @@ cgiGetArray(const char *name, /* I - Name of array variable */
if ((var = cgi_find_variable(name)) == NULL)
return (NULL);
if (var->nvalues == 1)
return (var->values[0]);
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));
}
@@ -187,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 */
@@ -209,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 */
/*
@@ -244,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)...
*/
@@ -267,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);
@@ -340,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.
*/
@@ -387,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;
@@ -395,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.
*/
@@ -420,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;
}
}
@@ -468,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 ++;
}
@@ -491,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 */
@@ -510,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.
*/
@@ -539,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.
*/
@@ -809,6 +1017,18 @@ cgi_initialize_post(void)
else
nbytes = 0;
}
else if (nbytes == 0)
{
/*
* CUPS STR #3176: OpenBSD: Early end-of-file on POST data causes 100% CPU
*
* This should never happen, but does on OpenBSD. If we see early end-of-
* file, treat this as an error and process no data.
*/
free(data);
return (0);
}
data[length] = '\0';
@@ -839,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 */
/*
@@ -892,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 ++;
@@ -979,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);
}
}
+4 -7
Ver Arquivo
@@ -72,15 +72,12 @@ install: all install-data install-headers install-libs install-exec
install-data:
for file in $(KEEP); do \
if test -r $(SERVERROOT)/$$file ; then \
$(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file.N || true; \
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.N ; \
else \
$(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file || true; \
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT) ; \
fi ; \
done
$(INSTALL_CONFIG) cupsd.conf $(SERVERROOT)/cupsd.conf.default
-chgrp $(CUPS_GROUP) $(SERVERROOT)/cupsd.conf.default
$(INSTALL_CONFIG) -g $(CUPS_GROUP) cupsd.conf $(SERVERROOT)/cupsd.conf.default
$(INSTALL_DIR) -m 755 $(DATADIR)/mime
for file in $(REPLACE); do \
if test -r $(DATADIR)/mime/$$file ; then \
@@ -93,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 ; \
+12 -11
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"
@@ -22,7 +21,7 @@ Listen localhost:@DEFAULT_IPP_PORT@
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseLocalProtocols @CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS@
BrowseLocalProtocols @CUPS_BROWSE_LOCAL_PROTOCOLS@
# Default authentication type, when authentication is required...
DefaultAuthType Basic
@@ -34,7 +33,6 @@ DefaultAuthType Basic
# Restrict access to the admin pages...
<Location /admin>
@ENCRYPTION_REQUIRED@
Order allow,deny
</Location>
@@ -48,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
@@ -63,13 +65,13 @@ DefaultAuthType Basic
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @CUPS_DEFAULT_PRINTADMIN_AUTH@
Require user @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @CUPS_DEFAULT_PRINTADMIN_AUTH@
Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
@@ -81,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>
@@ -102,19 +104,18 @@ DefaultAuthType Basic
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @CUPS_DEFAULT_PRINTADMIN_AUTH@
Require user @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @CUPS_DEFAULT_PRINTADMIN_AUTH@
Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
<Limit All>
AuthType Default
Order deny,allow
</Limit>
</Policy>
+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
+11 -9
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: mime.types 7995 2008-10-01 04:48:33Z mike $"
# "$Id: mime.types 8783 2009-08-28 17:51:05Z mike $"
#
# MIME types file for the Common UNIX Printing System (CUPS).
#
@@ -7,7 +7,7 @@
# VERSIONS OF CUPS. Instead, create a "local.types" file that
# reflects your local configuration changes.
#
# 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
@@ -50,10 +50,12 @@
#
# MIME type names are case-insensitive. Internally they are converted
# to lowercase. Multiple occurrences of a type will cause the provided
# rules to be appended to the existing definition. Type names are sorted
# in ascending order, so if two types use the same rules to resolve a type
# (e.g. doc extension for two types), the returned type will be the first
# type in the sorted list.
# rules to be appended to the existing definition. If two types use the same
# rules to resolve a type and have the same priority, e.g. "doc" extension for
# "text/bar" and "text/foo", the returned type will be the first type as
# sorted in alphanumerically ascending order without regard to case. Thus,
# the "text/bar" type will match the "doc" extension first unless the
# "text/foo" type has specified a higher priority.
#
# The "printable" rule differs from the "ascii" rule in that it also
# accepts 8-bit characters in the range 128-255.
@@ -93,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)\
@@ -112,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
########################################################################
@@ -175,5 +177,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
application/octet-stream
#
# End of "$Id: mime.types 7995 2008-10-01 04:48:33Z 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.
#
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id$"
dnl "$Id: cups-3264.m4 8524 2009-04-19 21:18:45Z mike $"
dnl
dnl 32/64-bit library support stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
dnl Setup support for separate 32/64-bit library generation...
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems])
INSTALL32=""
LIB32CUPS=""
@@ -28,7 +28,7 @@ AC_SUBST(LIB32CUPSIMAGE)
AC_SUBST(LIB32DIR)
AC_SUBST(UNINSTALL32)
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems])
INSTALL64=""
LIB64CUPS=""
@@ -136,5 +136,5 @@ case "$uname" in
esac
dnl
dnl End of "$Id$".
dnl End of "$Id: cups-3264.m4 8524 2009-04-19 21:18:45Z mike $".
dnl
+64 -47
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-common.m4 8094 2008-10-31 20:51:39Z mike $"
dnl "$Id: cups-common.m4 9482 2011-01-14 18:57:44Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl Common configuration stuff for CUPS.
dnl
dnl Copyright 2007-2008 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.4b2"
CUPS_VERSION="1.4.7"
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)
@@ -65,7 +66,7 @@ fi
AC_SUBST(CUPS_HTMLVIEW)
AC_MSG_CHECKING(for install-sh script)
INSTALL="`pwd`/install-sh -c"
INSTALL="`pwd`/install-sh"
AC_SUBST(INSTALL)
AC_MSG_RESULT(using $INSTALL)
@@ -78,7 +79,7 @@ fi
dnl Static library option...
INSTALLSTATIC=""
AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
AC_ARG_ENABLE(static, [ --enable-static install static libraries])
if test x$enable_static = xyes; then
echo Installing static libraries...
@@ -87,12 +88,15 @@ 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)
LIBMALLOC=""
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo build with malloc debug logging])
if test x$enable_mallinfo = xyes; then
SAVELIBS="$LIBS"
@@ -105,7 +109,7 @@ fi
AC_SUBST(LIBMALLOC)
dnl Check for libpaper support...
AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
AC_ARG_ENABLE(libpaper, [ --enable-libpaper build with libpaper support])
if test x$enable_libpaper = xyes; then
AC_CHECK_LIB(paper,systempapername,
@@ -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,11 +184,19 @@ 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)
dnl See if we have libusb...
AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing, default=auto])
AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing])
LIBUSB=""
AC_SUBST(LIBUSB)
@@ -194,14 +210,14 @@ 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")])
fi
dnl See if we have libwrap for TCP wrappers support...
AC_ARG_ENABLE(tcp_wrappers, [ --enable-tcp-wrappers use libwrap for TCP wrappers support, default=no])
AC_ARG_ENABLE(tcp_wrappers, [ --enable-tcp-wrappers use libwrap for TCP wrappers support])
LIBWRAP=""
AC_SUBST(LIBWRAP)
@@ -234,7 +250,7 @@ AC_SUBST(CUPSDLIBS)
dnl See if we have POSIX ACL support...
SAVELIBS="$LIBS"
LIBS=""
AC_ARG_ENABLE(acl, [ --enable-acl enable POSIX ACL support, default=auto])
AC_ARG_ENABLE(acl, [ --enable-acl build with POSIX ACL support])
if test "x$enable_acl" != xno; then
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
CUPSDLIBS="$CUPSDLIBS $LIBS"
@@ -248,34 +264,29 @@ else
DBUSDIR=""
fi
AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
AC_ARG_ENABLE(dbus, [ --enable-dbus build with DBUS support])
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
DBUSDIR="$withval")
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
@@ -284,29 +295,35 @@ AC_SUBST(DBUS_NOTIFIER)
AC_SUBST(DBUS_NOTIFIERLIBS)
dnl Extra platform-specific libraries...
CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
CUPS_SYSTEM_AUTHKEY=""
FONTS="fonts"
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))
AC_CHECK_FUNCS(mbr_uid_to_uuid)
dnl Check for the vproc_transaction_begin/end stuff...
AC_CHECK_FUNCS(vproc_transaction_begin)
dnl Need <dlfcn.h> header...
AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
@@ -334,11 +351,11 @@ case $uname in
fi
if test "x$default_operkey" != xdefault; then
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
elif grep -q system.print.operator /etc/authorization; then
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
else
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
fi])
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
@@ -347,12 +364,12 @@ case $uname in
;;
esac
AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
AC_SUBST(CUPS_SYSTEM_AUTHKEY)
AC_SUBST(FONTS)
AC_SUBST(LEGACY_BACKENDS)
dnl
dnl End of "$Id: cups-common.m4 8094 2008-10-31 20:51:39Z mike $".
dnl End of "$Id: cups-common.m4 9482 2011-01-14 18:57:44Z mike $".
dnl
+37 -25
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-compiler.m4 8139 2008-11-17 23:46:55Z 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
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007-2009 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,10 +20,11 @@ OPTIM=""
AC_SUBST(INSTALL_STRIP)
AC_SUBST(OPTIM)
AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no])
AC_ARG_ENABLE(debug_printfs, [ --enable-debug-printfs turn on debug printfs, default=no])
AC_ARG_ENABLE(unit_tests, [ --enable-unit-tests turn on unit tests, default=no])
AC_ARG_WITH(optim, [ --with-optim set optimization flags ])
AC_ARG_ENABLE(debug, [ --enable-debug build with debugging symbols])
AC_ARG_ENABLE(debug_guards, [ --enable-debug-guards build with memory allocation guards])
AC_ARG_ENABLE(debug_printfs, [ --enable-debug-printfs build with CUPS_DEBUG_LOG support])
AC_ARG_ENABLE(unit_tests, [ --enable-unit-tests build and run unit tests])
dnl For debugging, keep symbols, otherwise strip them...
if test x$enable_debug = xyes; then
@@ -35,6 +36,14 @@ fi
dnl Debug printfs can slow things down, so provide a separate option for that
if test x$enable_debug_printfs = xyes; then
CFLAGS="$CFLAGS -DDEBUG"
CXXFLAGS="$CXXFLAGS -DDEBUG"
fi
dnl Debug guards use an extra 4 bytes for some structures like strings in the
dnl string pool, so provide a separate option for that
if test x$enable_debug_guards = xyes; then
CFLAGS="$CFLAGS -DDEBUG_GUARDS"
CXXFLAGS="$CXXFLAGS -DDEBUG_GUARDS"
fi
dnl Unit tests take up time during a compile...
@@ -46,10 +55,8 @@ fi
AC_SUBST(UNITTESTS)
dnl Setup general architecture flags...
AC_ARG_WITH(archflags, [ --with-archflags="flags"
set default architecture flags ])
AC_ARG_WITH(ldarchflags, [ --with-ldarchflags="flags"
set default program architecture flags ])
AC_ARG_WITH(archflags, [ --with-archflags set default architecture flags ])
AC_ARG_WITH(ldarchflags, [ --with-ldarchflags set program architecture flags ])
if test -z "$with_archflags"; then
ARCHFLAGS=""
@@ -72,18 +79,16 @@ AC_SUBST(ARCHFLAGS)
AC_SUBST(LDARCHFLAGS)
dnl Setup support for separate 32/64-bit library generation...
AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
specifies 32-bit architecture flags])
AC_ARG_WITH(arch32flags, [ --with-arch32flags set 32-bit architecture flags])
ARCH32FLAGS=""
AC_SUBST(ARCH32FLAGS)
AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
specifies 64-bit architecture flags])
AC_ARG_WITH(arch64flags, [ --with-arch64flags set 64-bit architecture flags])
ARCH64FLAGS=""
AC_SUBST(ARCH64FLAGS)
dnl Read-only data/program support on Linux...
AC_ARG_ENABLE(relro, [ --enable-relro use GCC relro option, default=no])
AC_ARG_ENABLE(relro, [ --enable-relro build with the GCC relro option])
dnl Update compiler options...
CXXLIBS="${CXXLIBS:=}"
@@ -96,7 +101,7 @@ RELROFLAGS=""
AC_SUBST(RELROFLAGS)
LIBCUPSORDER="libcups.order"
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order],
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder set libcups secorder file, default=libcups.order],
if test -f "$withval"; then
LIBCUPSORDER="$withval"
fi)
@@ -104,7 +109,7 @@ AC_SUBST(LIBCUPSORDER)
LIBCUPSIMAGEORDER="libcupsimage.order"
AC_ARG_WITH(libcupsimageorder, [ --with-libcupsimagesorder
libcupsimage secorder file, default=libcupsimage.order],
set libcupsimage secorder file, default=libcupsimage.order],
if test -f "$withval"; then
LIBCUPSIMAGEORDER="$withval"
fi)
@@ -135,21 +140,28 @@ if test -n "$GCC"; then
AC_MSG_CHECKING(if GCC supports -fstack-protector)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector"
AC_TRY_COMPILE(,,
AC_TRY_LINK(,,
OPTIM="$OPTIM -fstack-protector"
AC_MSG_RESULT(yes),
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"
@@ -170,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
@@ -558,5 +570,5 @@ case $uname in
esac
dnl
dnl End of "$Id: cups-compiler.m4 8139 2008-11-17 23:46:55Z mike $".
dnl End of "$Id: cups-compiler.m4 9822 2011-06-10 22:59:36Z mike $".
dnl
+39 -32
Ver Arquivo
@@ -1,10 +1,10 @@
dnl
dnl "$Id: cups-defaults.m4 8106 2008-11-11 00:57:12Z 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).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2006-2007 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -28,7 +28,11 @@ AC_SUBST(LANGUAGES)
dnl Default ConfigFilePerm
AC_ARG_WITH(config_file_perm, [ --with-config-file-perm set default ConfigFilePerm value, default=0640],
CUPS_CONFIG_FILE_PERM="$withval",
CUPS_CONFIG_FILE_PERM="640")
if test "x$uname" = xDarwin; then
CUPS_CONFIG_FILE_PERM="644"
else
CUPS_CONFIG_FILE_PERM="640"
fi)
AC_SUBST(CUPS_CONFIG_FILE_PERM)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
@@ -62,7 +66,7 @@ AC_SUBST(CUPS_ACCESS_LOG_LEVEL)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_ACCESS_LOG_LEVEL, "$CUPS_ACCESS_LOG_LEVEL")
dnl Default Browsing
AC_ARG_ENABLE(browsing, [ --enable-browsing enable Browsing by default, default=yes])
AC_ARG_ENABLE(browsing, [ --disable-browsing disable Browsing by default])
if test "x$enable_browsing" = xno; then
CUPS_BROWSING="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSING, 0)
@@ -119,8 +123,8 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS,
"$CUPS_BROWSE_REMOTE_PROTOCOLS")
dnl Default BrowseShortNames
AC_ARG_ENABLE(browse_short, [ --enable-browse-short-names
enable BrowseShortNames by default, default=yes])
AC_ARG_ENABLE(browse_short, [ --disable-browse-short-names
disable BrowseShortNames by default])
if test "x$enable_browse_short" = xno; then
CUPS_BROWSE_SHORT_NAMES="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_SHORT_NAMES, 0)
@@ -131,7 +135,8 @@ fi
AC_SUBST(CUPS_BROWSE_SHORT_NAMES)
dnl Default DefaultShared
AC_ARG_ENABLE(default_shared, [ --enable-default-shared enable DefaultShared by default, default=yes])
AC_ARG_ENABLE(default_shared, [ --disable-default-shared
disable DefaultShared by default])
if test "x$enable_default_shared" = xno; then
CUPS_DEFAULT_SHARED="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DEFAULT_SHARED, 0)
@@ -142,8 +147,8 @@ fi
AC_SUBST(CUPS_DEFAULT_SHARED)
dnl Default ImplicitClasses
AC_ARG_ENABLE(implicit, [ --enable-implicit-classes
enable ImplicitClasses by default, default=yes])
AC_ARG_ENABLE(implicit, [ --disable-implicit-classes
disable ImplicitClasses by default])
if test "x$enable_implicit" = xno; then
CUPS_IMPLICIT_CLASSES="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IMPLICIT_CLASSES, 0)
@@ -155,7 +160,7 @@ AC_SUBST(CUPS_IMPLICIT_CLASSES)
dnl Default UseNetworkDefault
AC_ARG_ENABLE(use_network_default, [ --enable-use-network-default
enable UseNetworkDefault by default, default=auto])
set UseNetworkDefault to Yes by default])
if test "x$enable_use_network_default" != xno; then
AC_MSG_CHECKING(whether to use network default printers)
if test "x$enable_use_network_default" = xyes -o $uname != Darwin; then
@@ -203,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)
@@ -233,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
@@ -264,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)
@@ -320,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
@@ -358,28 +376,17 @@ fi
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SMB_CONFIG_FILE, "$CUPS_DEFAULT_SMB_CONFIG_FILE")
dnl Default MaxCopies value...
AC_ARG_WITH(max-copies, [ --with-max-copies set default max copies value, default=auto ],
AC_ARG_WITH(max-copies, [ --with-max-copies set default max copies value, default=9999 ],
CUPS_MAX_COPIES="$withval",
if test "x$uname" = xDarwin; then
CUPS_MAX_COPIES="9999"
else
CUPS_MAX_COPIES="100"
fi)
CUPS_MAX_COPIES="9999")
AC_SUBST(CUPS_MAX_COPIES)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_MAX_COPIES, $CUPS_MAX_COPIES)
dnl Default raw printing state
AC_ARG_ENABLE(raw_printing, [ --enable-raw-printing enable raw printing by default, default=auto])
AC_ARG_ENABLE(raw_printing, [ --disable-raw-printing do not allow raw printing by default])
if test "x$enable_raw_printing" != xno; then
AC_MSG_CHECKING(whether to enable raw printing)
if test "x$enable_raw_printing" = xyes -o $uname = Darwin; then
DEFAULT_RAW_PRINTING=""
AC_MSG_RESULT(yes)
else
DEFAULT_RAW_PRINTING="#"
AC_MSG_RESULT(no)
fi
DEFAULT_RAW_PRINTING=""
else
DEFAULT_RAW_PRINTING="#"
fi
@@ -406,7 +413,7 @@ AC_SUBST(CUPS_SNMP_ADDRESS)
AC_SUBST(CUPS_SNMP_COMMUNITY)
dnl New default port definition for IPP...
AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
AC_ARG_WITH(ipp-port, [ --with-ipp-port set port number for IPP, default=631 ],
DEFAULT_IPP_PORT="$withval",
DEFAULT_IPP_PORT="631")
@@ -414,8 +421,8 @@ AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl Filters
AC_ARG_ENABLE(bannertops, [ --enable-bannertops build with default banner filter, default=auto ])
AC_ARG_ENABLE(texttops, [ --enable-texttops build with default text filter, default=auto ])
AC_ARG_ENABLE(bannertops, [ --enable-bannertops always build the banner filter ])
AC_ARG_ENABLE(texttops, [ --enable-texttops always build the text filter ])
if test "x$enable_bannertops" = xno; then
BANNERTOPS=""
@@ -441,5 +448,5 @@ AC_SUBST(BANNERTOPS)
AC_SUBST(TEXTTOPS)
dnl
dnl End of "$Id: cups-defaults.m4 8106 2008-11-11 00:57:12Z mike $".
dnl End of "$Id: cups-defaults.m4 8929 2009-12-15 22:40:37Z mike $".
dnl
+13 -4
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-directories.m4 8076 2008-10-23 15:38:43Z mike $"
dnl "$Id: cups-directories.m4 8497 2009-04-12 23:04:51Z mike $"
dnl
dnl Directory stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -411,10 +411,19 @@ AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
AC_SUBST(CUPS_SERVERROOT)
# Transient run-time state
CUPS_STATEDIR="$localstatedir/run/cups"
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
case "$uname" in
Darwin*)
# Darwin (Mac OS X)
CUPS_STATEDIR="$CUPS_SERVERROOT"
;;
*)
# All others
CUPS_STATEDIR="$localstatedir/run/cups"
;;
esac
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
AC_SUBST(CUPS_STATEDIR)
dnl
dnl End of "$Id: cups-directories.m4 8076 2008-10-23 15:38:43Z mike $".
dnl End of "$Id: cups-directories.m4 8497 2009-04-12 23:04:51Z mike $".
dnl
+19 -7
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z 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
@@ -7,7 +7,7 @@ dnl http://www.dns-sd.org
dnl http://www.multicastdns.org/
dnl http://developer.apple.com/networking/bonjour/
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Apple Inc. and are protected by Federal copyright
@@ -16,7 +16,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_ENABLE(dnssd, [ --enable-dnssd turn on DNS Service Discovery support, default=yes])
AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support])
AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
@@ -32,17 +32,29 @@ if test x$enable_dnssd != xno; then
case "$uname" in
Darwin*)
# Darwin and MacOS X...
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
AC_DEFINE(HAVE_DNSSD)
AC_DEFINE(HAVE_COREFOUNDATION)
AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
DNSSD_BACKEND="dnssd"
;;
*)
# All others...
AC_CHECK_LIB(dns_sd,TXTRecordGetValuePtr,
AC_MSG_CHECKING(for current version of dns_sd library)
SAVELIBS="$LIBS"
LIBS="$LIBS -ldns_sd"
AC_TRY_COMPILE([#include <dns_sd.h>],
[int constant = kDNSServiceFlagsShareConnection;
unsigned char txtRecord[100];
uint8_t valueLen;
TXTRecordGetValuePtr(sizeof(txtRecord),
txtRecord, "value", &valueLen);],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DNSSD)
DNSSDLIBS="-ldns_sd")
DNSSDLIBS="-ldns_sd"
DNSSD_BACKEND="dnssd",
AC_MSG_RESULT(no))
LIBS="$SAVELIBS"
;;
esac
])
@@ -52,5 +64,5 @@ AC_SUBST(DNSSDLIBS)
AC_SUBST(DNSSD_BACKEND)
dnl
dnl End of "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $".
dnl End of "$Id: cups-dnssd.m4 8789 2009-08-28 22:54:34Z mike $".
dnl
+7 -6
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id$"
dnl "$Id: cups-gssapi.m4 8659 2009-05-18 22:03:04Z mike $"
dnl
dnl GSSAPI/Kerberos library detection.
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2006-2007 by Easy Software Products.
dnl
dnl This file contains Kerberos support code, copyright 2006 by
@@ -16,9 +16,10 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(gssapi, [ --enable-gssapi turn on GSSAPI support, default=yes])
AC_ARG_ENABLE(gssapi, [ --disable-gssapi disable GSSAPI support])
LIBGSSAPI=""
AC_SUBST(LIBGSSAPI)
if test x$enable_gssapi != xno; then
AC_PATH_PROG(KRB5CONFIG, krb5-config)
@@ -73,6 +74,7 @@ if test x$enable_gssapi != xno; then
AC_CHECK_FUNC(gsskrb5_register_acceptor_identity,
AC_DEFINE(HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY))
AC_CHECK_FUNC(krb5_cc_new_unique, AC_DEFINE(HAVE_KRB5_CC_NEW_UNIQUE))
AC_CHECK_FUNC(krb5_ipc_client_set_target_uid, AC_DEFINE(HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID))
AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE)
if test $ac_cv_header_gssapi_gssapi_h = yes; then
@@ -107,7 +109,7 @@ AC_ARG_WITH(gssservicename, [ --with-gssservicename set default gss service n
if test x$default_gssservicename != xno; then
if test "x$default_gssservicename" = "xdefault"; then
CUPS_DEFAULT_GSSSERVICENAME="ipp"
CUPS_DEFAULT_GSSSERVICENAME="host"
else
CUPS_DEFAULT_GSSSERVICENAME="$default_gssservicename"
fi
@@ -115,9 +117,8 @@ else
CUPS_DEFAULT_GSSSERVICENAME=""
fi
AC_SUBST(LIBGSSAPI)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME")
dnl
dnl End of "$Id$".
dnl End of "$Id: cups-gssapi.m4 8659 2009-05-18 22:03:04Z mike $".
dnl
+7 -7
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-image.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-image.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl Image library/filter stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
dnl See if we want the image filters included at all...
AC_ARG_ENABLE(image, [ --enable-image turn on image filters, default=auto])
AC_ARG_ENABLE(image, [ --enable-image always build the image filters])
IMGFILTERS=""
if test "x$enable_image" != xno; then
@@ -30,9 +30,9 @@ fi
AC_SUBST(IMGFILTERS)
dnl Check for image libraries...
AC_ARG_ENABLE(jpeg, [ --enable-jpeg turn on JPEG support, default=yes])
AC_ARG_ENABLE(png, [ --enable-png turn on PNG support, default=yes])
AC_ARG_ENABLE(tiff, [ --enable-tiff turn on TIFF support, default=yes])
AC_ARG_ENABLE(jpeg, [ --disable-jpeg disable JPEG support])
AC_ARG_ENABLE(png, [ --disable-png disable PNG support])
AC_ARG_ENABLE(tiff, [ --disable-tiff disable TIFF support])
LIBJPEG=""
LIBPNG=""
@@ -105,5 +105,5 @@ AC_SUBST(EXPORT_LIBZ)
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
dnl
dnl End of "$Id: cups-image.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-image.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+5 -6
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-launchd.m4 6649 2007-07-11 21:46:42Z 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 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
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(launchd, [ --enable-launchd turn on launchd support, default=yes])
AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support])
DEFAULT_LAUNCHD_CONF=""
LAUNCHDLIBS=""
@@ -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 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-launchd.m4 9120 2010-04-23 18:56:34Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-ldap.m4 7800 2008-07-25 21:01:34Z mike $"
dnl "$Id: cups-ldap.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2003-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -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_ENABLE(ldap, [ --enable-ldap turn on LDAP support, default=yes])
AC_ARG_ENABLE(ldap, [ --disable-ldap disable LDAP support])
AC_ARG_WITH(ldap-libs, [ --with-ldap-libs set directory for LDAP library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
@@ -48,5 +48,5 @@ AC_SUBST(LIBLDAP)
dnl
dnl End of "$Id: cups-ldap.m4 7800 2008-07-25 21:01:34Z mike $".
dnl End of "$Id: cups-ldap.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+7 -8
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-libtool.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl Libtool stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 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
@@ -13,14 +13,13 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=LIBTOOL_PATH
turn on building with libtool (UNSUPPORTED!), default=no],
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported
build with libtool (UNSUPPORTED!)],
[if test x$enable_libtool_unsupported != xno; then
LIBTOOL="$enable_libtool_unsupported"
enable_shared=no
echo "WARNING: libtool is not supported or endorsed by Easy Software Products."
echo " WE DO NOT PROVIDE TECHNICAL SUPPORT FOR LIBTOOL PROBLEMS."
echo " (even if you have a support contract)"
echo "WARNING: libtool is not supported or endorsed by Apple Inc."
echo " WE DO NOT PROVIDE SUPPORT FOR LIBTOOL PROBLEMS."
else
LIBTOOL=""
fi])
@@ -36,5 +35,5 @@ if test x$LIBTOOL != x; then
fi
dnl
dnl End of "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-libtool.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+4 -12
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-manpages.m4 8230 2009-01-12 19:17:09Z mike $"
dnl
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -51,14 +51,6 @@ AC_SUBST(PMANDIR)
dnl Setup manpage extensions...
case "$uname" in
*BSD* | Darwin*)
# *BSD
MAN1EXT=1
MAN5EXT=5
MAN7EXT=7
MAN8EXT=8
MAN8DIR=8
;;
IRIX*)
# SGI IRIX
MAN1EXT=1
@@ -75,8 +67,8 @@ case "$uname" in
MAN8EXT=1m
MAN8DIR=1m
;;
Linux* | GNU*)
# Linux and GNU Hurd
Linux* | GNU* | Darwin*)
# Linux, GNU Hurd, and Mac OS X
MAN1EXT=1.gz
MAN5EXT=5.gz
MAN7EXT=7.gz
@@ -100,5 +92,5 @@ AC_SUBST(MAN8EXT)
AC_SUBST(MAN8DIR)
dnl
dnl End of "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-manpages.m4 8230 2009-01-12 19:17:09Z mike $".
dnl
+19 -21
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pam.m4 7960 2008-09-17 19:42:02Z 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
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007-2009 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
@@ -13,8 +13,8 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(pam, [ --enable-pam turn on PAM support, default=yes])
AC_ARG_WITH(pam_module, [ --with-pam-module specify the PAM module to use, default=auto])
AC_ARG_ENABLE(pam, [ --disable-pam disable PAM support])
AC_ARG_WITH(pam_module, [ --with-pam-module specify the PAM module to use])
dnl Don't use PAM with AIX...
if test $uname = AIX; then
@@ -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,36 +61,32 @@ 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; then
elif test -f /usr/lib/pam/pam_opendirectory.so.2; then
PAMFILE="pam.opendirectory"
else
PAMFILE="pam.securityserver"
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 7960 2008-09-17 19:42:02Z mike $".
dnl End of "$Id: cups-pam.m4 8825 2009-09-22 21:53:31Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-pap.m4 8524 2009-04-19 21:18:45Z mike $"
dnl
dnl PAP (AppleTalk) stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -15,17 +15,17 @@ dnl
# Currently the PAP backend is only supported on MacOS X with the AppleTalk
# SDK installed...
AC_ARG_ENABLE(pap, [ --enable-pap build with AppleTalk support, default=auto])
AC_ARG_ENABLE(pap, [ --enable-pap build with AppleTalk support])
PAP=""
AC_SUBST(PAP)
if test x$enable_pap != xno -a $uname = Darwin; then
if test x$enable_pap = xyes -a $uname = Darwin; then
AC_CHECK_HEADER(netat/appletalk.h,[
PAP="pap"
AC_CHECK_HEADER(AppleTalk/at_proto.h)])
fi
dnl
dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-pap.m4 8524 2009-04-19 21:18:45Z mike $".
dnl
+60 -23
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pdf.m4 7449 2008-04-14 18:27:53Z 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
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -13,39 +13,76 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(pdftops, [ --enable-pdftops build pdftops filter, default=auto ])
AC_ARG_WITH(pdftops, [ --with-pdftops set pdftops filter (gs,/path/to/gs,pdftops,/path/to/pdftops,none), default=pdftops ])
PDFTOPS=""
CUPS_PDFTOPS=""
CUPS_GHOSTSCRIPT=""
if test "x$enable_pdftops" != xno; then
AC_PATH_PROG(CUPS_PDFTOPS, pdftops)
if test "x$CUPS_PDFTOPS" != x; then
AC_DEFINE(HAVE_PDFTOPS)
case "x$with_pdftops" in
x) # Default/auto
if test $uname != Darwin; then
AC_PATH_PROG(CUPS_PDFTOPS, pdftops)
if test "x$CUPS_PDFTOPS" != x; then
AC_DEFINE(HAVE_PDFTOPS)
PDFTOPS="pdftops"
else
AC_PATH_PROG(CUPS_GHOSTSCRIPT, gs)
if test "x$CUPS_GHOSTSCRIPT" != x; then
AC_DEFINE(HAVE_GHOSTSCRIPT)
PDFTOPS="pdftops"
fi
fi
fi
AC_DEFINE_UNQUOTED(CUPS_PDFTOPS, "$CUPS_PDFTOPS")
;;
xgs)
AC_PATH_PROG(CUPS_GHOSTSCRIPT, gs)
if test "x$CUPS_GHOSTSCRIPT" != x; then
AC_DEFINE(HAVE_GHOSTSCRIPT)
fi
AC_DEFINE_UNQUOTED(CUPS_GHOSTSCRIPT, "$CUPS_GHOSTSCRIPT")
if test "x$CUPS_PDFTOPS" != x -o "x$CUPS_GHOSTSCRIPT" != x; then
AC_MSG_CHECKING(whether to build pdftops filter)
if test x$enable_pdftops = xyes -o $uname != Darwin; then
PDFTOPS="pdftops"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
elif test x$enable_pdftops = xyes; then
AC_MSG_ERROR(Unable to find pdftops or gs programs!)
PDFTOPS="pdftops"
else
AC_MSG_ERROR(Unable to find gs program!)
exit 1
fi
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
AC_DEFINE(HAVE_PDFTOPS)
PDFTOPS="pdftops"
else
AC_MSG_ERROR(Unable to find pdftops program!)
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")
AC_DEFINE_UNQUOTED(CUPS_GHOSTSCRIPT, "$CUPS_GHOSTSCRIPT")
AC_SUBST(PDFTOPS)
dnl
dnl End of "$Id: cups-pdf.m4 7449 2008-04-14 18:27:53Z mike $".
dnl End of "$Id: cups-pdf.m4 8760 2009-08-07 22:30:30Z mike $".
dnl
+2 -2
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id$"
dnl "$Id: cups-poll.m4 8524 2009-04-19 21:18:45Z mike $"
dnl
dnl Select/poll stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -18,5 +18,5 @@ AC_CHECK_FUNC(epoll_create, AC_DEFINE(HAVE_EPOLL))
AC_CHECK_FUNC(kqueue, AC_DEFINE(HAVE_KQUEUE))
dnl
dnl End of "$Id$".
dnl End of "$Id: cups-poll.m4 8524 2009-04-19 21:18:45Z mike $".
dnl
+19 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-sharedlibs.m4 7630 2008-06-09 22:31:44Z 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
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007-2009 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
@@ -16,7 +16,7 @@ dnl
PICFLAG=1
DSOFLAGS="${DSOFLAGS:=}"
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries, default=yes])
AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
if test x$enable_shared != xno; then
case "$uname" in
@@ -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 7630 2008-06-09 22:31:44Z mike $".
dnl End of "$Id: cups-sharedlibs.m4 9154 2010-06-16 00:49:01Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-slp.m4 7241 2008-01-22 22:34:52Z mike $"
dnl "$Id: cups-slp.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007-2009 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
@@ -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_ENABLE(slp, [ --enable-slp turn on SLP support, default=yes])
AC_ARG_ENABLE(slp, [ --disable-slp disable SLP support])
AC_ARG_WITH(openslp-libs, [ --with-openslp-libs set directory for OpenSLP library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
@@ -34,5 +34,5 @@ AC_SUBST(LIBSLP)
dnl
dnl End of "$Id: cups-slp.m4 7241 2008-01-22 22:34:52Z mike $".
dnl End of "$Id: cups-slp.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+59 -24
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z 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-2008 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
@@ -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_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support, default=yes])
AC_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TLS support])
AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=first])
AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=second])
AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=third])
@@ -26,22 +26,22 @@ AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenS
SSLFLAGS=""
SSLLIBS=""
ENCRYPTION_REQUIRED=""
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"
# MacOS X doesn't (yet) come with pre-installed encryption
# certificates for CUPS, so don't enable encryption on
# /admin just yet...
#ENCRYPTION_REQUIRED=" Encryption Required"
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,
@@ -58,24 +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"; then
if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
if test "x$LIBGNUTLSCONFIG" != x; then
SSLLIBS=`$LIBGNUTLSCONFIG --libs`
SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
ENCRYPTION_REQUIRED=" Encryption Required"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)
AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
if $PKGCONFIG --exists gnutls; 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=`$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...
@@ -93,9 +127,9 @@ 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"
ENCRYPTION_REQUIRED=" Encryption Required"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_LIBSSL)],,
$libcrypto)
@@ -109,19 +143,20 @@ 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)
AC_SUBST(SSLLIBS)
AC_SUBST(ENCRYPTION_REQUIRED)
EXPORT_SSLLIBS="$SSLLIBS"
AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
dnl End of "$Id: cups-ssl.m4 9470 2011-01-11 07:05:58Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-threads.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl Threading stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 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
@@ -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_ENABLE(threads, [ --enable-threads enable multi-threading support])
AC_ARG_ENABLE(threads, [ --disable-threads disable multi-threading support])
have_pthread=no
PTHREAD_FLAGS=""
@@ -50,5 +50,5 @@ fi
AC_SUBST(PTHREAD_FLAGS)
dnl
dnl End of "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-threads.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+66 -18
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Configuration file for the Common UNIX Printing System (CUPS).
* Configuration file for CUPS.
*
* Copyright 2007-2008 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
@@ -31,7 +31,7 @@
#define CUPS_DEFAULT_USER "lp"
#define CUPS_DEFAULT_GROUP "sys"
#define CUPS_DEFAULT_SYSTEM_GROUPS "sys root system"
#define CUPS_DEFAULT_PRINTADMIN_AUTH "@SYSTEM"
#define CUPS_DEFAULT_PRINTOPERATOR_AUTH "@SYSTEM"
/*
@@ -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
/*
@@ -434,6 +434,7 @@
#undef HAVE_USERSEC_H
/*
* Do we have pthread support?
*/
@@ -447,7 +448,6 @@
#undef HAVE_LAUNCH_H
#undef HAVE_LAUNCHD
#define CUPS_DEFAULT_LAUNCHD_CONF ""
/*
@@ -498,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
@@ -507,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
@@ -541,6 +555,7 @@
#undef HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY
#undef HAVE_GSS_C_NT_HOSTBASED_SERVICE
#undef HAVE_KRB5_CC_NEW_UNIQUE
#undef HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID
#undef HAVE_KRB5_H
#undef HAVE_HEIMDAL
@@ -600,10 +615,31 @@
* 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?
*/
#undef HAVE_VPROC_TRANSACTION_BEGIN
/*
* Do we have libusb?
@@ -619,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";
+171 -102
Ver Arquivo
@@ -2,109 +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
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: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
file.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
file.o: i18n.h transcode.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 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
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
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
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
@@ -112,6 +134,7 @@ testarray.o: debug.h
testconflicts.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h
testconflicts.o: language.h string.h ../config.h
testcups.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
testcups.o: string.h ../config.h
testfile.o: string.h ../config.h file.h versioning.h debug.h
testhttp.o: http-private.h ../config.h http.h versioning.h md5.h
testhttp.o: ipp-private.h ipp.h string.h
@@ -123,116 +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
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
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 http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
file.32.o: file.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
file.32.o: file.c i18n.h transcode.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 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
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
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
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
@@ -240,6 +285,7 @@ testarray.32.o: testarray.c debug.h
testconflicts.32.o: testconflicts.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
testconflicts.32.o: testconflicts.c language.h string.h ../config.h
testcups.32.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
testcups.32.o: testcups.c string.h ../config.h
testfile.32.o: testfile.c string.h ../config.h file.h versioning.h debug.h
testhttp.32.o: testhttp.c http-private.h ../config.h http.h versioning.h md5.h
testhttp.32.o: testhttp.c ipp-private.h ipp.h string.h
@@ -251,116 +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
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
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 http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
file.64.o: file.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
file.64.o: file.c i18n.h transcode.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 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
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
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
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
@@ -368,6 +436,7 @@ testarray.64.o: testarray.c debug.h
testconflicts.64.o: testconflicts.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
testconflicts.64.o: testconflicts.c language.h string.h ../config.h
testcups.64.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
testcups.64.o: testcups.c string.h ../config.h
testfile.64.o: testfile.c string.h ../config.h file.h versioning.h debug.h
testhttp.64.o: testhttp.c http-private.h ../config.h http.h versioning.h md5.h
testhttp.64.o: testhttp.c ipp-private.h ipp.h string.h
@@ -379,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
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
+67 -85
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id$"
#
# API library Makefile for the Common UNIX Printing System (CUPS).
# API library Makefile for CUPS.
#
# Copyright 2007-2008 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,6 +56,9 @@ LIBOBJS = \
options.o \
page.o \
ppd.o \
pwg-file.o \
pwg-media.o \
pwg-ppd.o \
request.o \
sidechannel.o \
snmp.o \
@@ -82,8 +85,8 @@ OBJS = \
testoptions.o \
testlang.o \
testppd.o \
testsnmp.o \
php_cups_wrap.o
testpwg.o \
testsnmp.o
#
@@ -129,6 +132,7 @@ UNITTARGETS = \
testlang \
testoptions \
testppd \
testpwg \
testsnmp
TARGETS = \
@@ -236,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)...
@@ -288,7 +293,8 @@ uninstall64bit:
libcups.so.2 libcups.sl.2: $(LIBOBJS)
echo Linking $@...
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) \
$(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) `basename $@ .2`
$(LN) $@ `basename $@ .2`
@@ -300,7 +306,8 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
32bit/libcups.so.2: $(LIB32OBJS)
echo Linking 32-bit $@...
-mkdir 32bit
$(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBGSSAPI) \
$(DNSSDLIBS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) 32bit/libcups.so
$(LN) libcups.so.2 32bit/libcups.so
@@ -312,7 +319,8 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
64bit/libcups.so.2: $(LIB64OBJS)
echo Linking 64-bit $@...
-mkdir 64bit
$(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBGSSAPI) \
$(DNSSDLIBS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) 64bit/libcups.so
$(LN) libcups.so.2 64bit/libcups.so
@@ -329,7 +337,8 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER) libcups.exp
-compatibility_version 2.0.0 \
-exported_symbols_list libcups.exp \
-sectorder __TEXT __text $(LIBCUPSORDER) \
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
$(COMMONLIBS) $(LIBZ)
$(RM) libcups.dylib
$(LN) $@ libcups.dylib
@@ -340,7 +349,9 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER) libcups.exp
libcups_s.a: $(LIBOBJS) libcups_s.exp
echo Creating $@...
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) -lm
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o \
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
$(COMMONLIBS) $(LIBZ) -lm
$(RM) $@
$(AR) $(ARFLAGS) $@ libcups_s.o
@@ -351,8 +362,9 @@ libcups_s.a: $(LIBOBJS) libcups_s.exp
libcups.la: $(LIBOBJS)
echo Linking $@...
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
-version-info 2:8 $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
-rpath $(LIBDIR) -version-info 2:8 $(LIBGSSAPI) $(SSLLIBS) \
$(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -366,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)
#
@@ -397,7 +385,7 @@ php_cups_wrap.c: cups.h
testadmin: testadmin.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testadmin.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -407,7 +395,7 @@ testadmin: testadmin.o libcups.a
testarray: testarray.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running array API tests...
./testarray
@@ -419,7 +407,7 @@ testarray: testarray.o libcups.a
testconflicts: testconflicts.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testconflicts.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -429,7 +417,7 @@ testconflicts: testconflicts.o libcups.a
testcups: testcups.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testcups.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -439,7 +427,7 @@ testcups: testcups.o libcups.a
testfile: testfile.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running file API tests...
./testfile
@@ -451,7 +439,7 @@ testfile: testfile.o libcups.a
testhttp: testhttp.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running HTTP API tests...
./testhttp
@@ -463,7 +451,7 @@ testhttp: testhttp.o libcups.a
testipp: testipp.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running IPP API tests...
./testipp
@@ -475,7 +463,7 @@ testipp: testipp.o libcups.a
testi18n: testi18n.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running internationalization API tests...
./testi18n
@@ -487,7 +475,7 @@ testi18n: testi18n.o libcups.a
testlang: testlang.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running language API tests...
./testlang
@@ -499,7 +487,7 @@ testlang: testlang.o libcups.a
testoptions: testoptions.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running option API tests...
./testoptions
@@ -508,14 +496,26 @@ testoptions: testoptions.o libcups.a
# testppd (dependency on static CUPS library is intentional)
#
testppd: testppd.o libcups.a
testppd: testppd.o libcups.a test.ppd test2.ppd
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running PPD API tests...
./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)
#
@@ -523,7 +523,7 @@ testppd: testppd.o libcups.a
testsnmp: testsnmp.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testsnmp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -540,34 +540,52 @@ apihelp:
mxmldoc --section "Programming" --title "Array API" \
--css ../doc/cups-printable.css \
--header api-array.header --intro api-array.shtml \
api-array.xml \
array.h array.c >../doc/help/api-array.html
mxmldoc --tokens help/api-array.html api-array.xml >../doc/help/api-array.tokens
$(RM) api-array.xml
mxmldoc --section "Programming" --title "CUPS API" \
--css ../doc/cups-printable.css \
--header api-cups.header --intro api-cups.shtml \
api-cups.xml \
cups.h adminutil.c dest.c language.c notify.c \
options.c tempfile.c usersys.c \
util.c >../doc/help/api-cups.html
mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
$(RM) api-cups.xml
mxmldoc --section "Programming" --title "File and Directory APIs" \
--css ../doc/cups-printable.css \
--header api-filedir.header --intro api-filedir.shtml \
api-filedir.xml \
file.h file.c dir.h dir.c >../doc/help/api-filedir.html
mxmldoc --tokens api-filedir.xml >../doc/help/api-filedir.tokens
$(RM) api-filedir.xml
mxmldoc --section "Programming" --title "PPD API" \
--css ../doc/cups-printable.css \
--header api-ppd.header --intro api-ppd.shtml \
api-ppd.xml \
ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
ppd.c >../doc/help/api-ppd.html
mxmldoc --tokens help/api-ppd.html api-ppd.xml >../doc/help/api-ppd.tokens
$(RM) api-ppd.xml
mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
--css ../doc/cups-printable.css \
--header api-httpipp.header --intro api-httpipp.shtml \
api-httpipp.xml \
http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
http.c http-addr.c http-support.c ipp.c ipp-support.c \
md5passwd.c request.c >../doc/help/api-httpipp.html
mxmldoc --tokens help/api-httpipp.html api-httpipp.xml >../doc/help/api-httpipp.tokens
$(RM) api-httpipp.xml
mxmldoc --section "Programming" \
--title "Filter and Backend Programming" \
--css ../doc/cups-printable.css \
--header api-filter.header --intro api-filter.shtml \
api-filter.xml \
backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
>../doc/help/api-filter.html
mxmldoc --tokens help/api-filter.html api-filter.xml >../doc/help/api-filter.tokens
$(RM) api-filter.xml
framedhelp:
echo Generating CUPS API help files...
@@ -614,42 +632,6 @@ framedhelp:
backchannel.c backend.h backend.c sidechannel.c sidechannel.h
docsets:
echo Generating CUPS API documentation sets...
../tools/makedocset --docset org.cups.overview.docset \
--title "Introduction to CUPS Programming" \
--header api-overview.header --intro api-overview.shtml
../tools/makedocset --docset org.cups.array.docset \
--title "Array API" \
--header api-array.header --intro api-array.shtml \
array.h array.c
../tools/makedocset --docset org.cups.cups.docset \
--title "CUPS API" \
--header api-cups.header --intro api-cups.shtml \
cups.h adminutil.c dest.c language.c notify.c \
options.c tempfile.c usersys.c \
util.c
../tools/makedocset --docset org.cups.filedir.docset \
--title "File and Directory APIs" \
--header api-filedir.header --intro api-filedir.shtml \
file.h file.c dir.h dir.c
../tools/makedocset --docset org.cups.ppd.docset \
--title "PPD API" \
--header api-ppd.header --intro api-ppd.shtml \
ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
page.c ppd.c
../tools/makedocset --docset org.cups.httpipp.docset \
--title "HTTP and IPP APIs" \
--header api-httpipp.header --intro api-httpipp.shtml \
http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
http.c http-addr.c http-support.c ipp.c ipp-support.c \
md5passwd.c request.c
../tools/makedocset --docset org.cups.filter.docset \
--title "Filter and Backend Programming" \
--header api-filter.header --intro api-filter.shtml \
backchannel.c backend.h backend.c sidechannel.c sidechannel.h
#
# Dependencies...
#
+148 -130
Ver Arquivo
@@ -4,7 +4,7 @@
* Administration utility API definitions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 2007-2008 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 */
@@ -949,6 +922,8 @@ _cupsAdminGetServerSettings(
return (0);
}
}
http = cg->http;
}
if (!http || !num_settings || !settings)
@@ -1041,7 +1016,7 @@ _cupsAdminGetServerSettings(
&& *value != '/'
#endif /* AF_LOCAL */
#ifdef AF_INET6
&& strcmp(value, "::1")
&& strcmp(value, "[::1]")
#endif /* AF_INET6 */
)
remote_access = 1;
@@ -1086,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';
@@ -1097,7 +1072,7 @@ _cupsAdminGetServerSettings(
break;
}
for (value = valptr; isspace(*value & 255); value ++);
for (value = valptr; _cups_isspace(*value); value ++);
}
}
else if (!strcasecmp(line, "</Limit>"))
@@ -1133,7 +1108,13 @@ _cupsAdminGetServerSettings(
else if (!strcasecmp(value, "all"))
remote_any = 1;
}
else if (line[0] != '<' && !in_location && !in_policy)
else if (line[0] != '<' && !in_location && !in_policy &&
strcasecmp(line, "Allow") &&
strcasecmp(line, "AuthType") &&
strcasecmp(line, "Deny") &&
strcasecmp(line, "Order") &&
strcasecmp(line, "Require") &&
strcasecmp(line, "Satisfy"))
cg->cupsd_num_settings = cupsAddOption(line, value,
cg->cupsd_num_settings,
&(cg->cupsd_settings));
@@ -1205,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 */
@@ -1301,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,
@@ -1311,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);
/*
@@ -1364,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...
@@ -1385,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)
{
@@ -1402,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...
@@ -1419,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)
{
@@ -1436,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...
*/
@@ -1487,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);
@@ -1545,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);
@@ -1643,7 +1644,7 @@ _cupsAdminSetServerSettings(
" <Limit Cancel-Job>\n"
" Order deny,allow\n"
" Require user @OWNER "
CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
CUPS_DEFAULT_PRINTOPERATOR_AUTH "\n"
" </Limit>\n");
}
@@ -1701,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;
@@ -1712,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");
}
@@ -1728,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 "
CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
"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)
@@ -1844,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,
@@ -1902,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());
@@ -1922,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,
@@ -1931,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");
@@ -2015,7 +2026,7 @@ _cupsAdminSetServerSettings(
" <Limit Cancel-Job>\n"
" Order deny,allow\n"
" Require user @OWNER "
CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
CUPS_DEFAULT_PRINTOPERATOR_AUTH "\n"
" </Limit>\n");
cupsFilePuts(temp, " <Limit All>\n"
@@ -2026,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))
{
/*
@@ -2165,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);
@@ -2202,7 +2220,7 @@ do_samba_command(const char *command, /* I - Command to run */
if (logfile)
_cupsLangPuts(logfile, "\n");
DEBUG_printf(("status=%d\n", status));
DEBUG_printf(("9do_samba_command: status=%d", status));
if (WIFEXITED(status))
return (WEXITSTATUS(status));
+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
+4 -2
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-array.header 8087 2008-10-27 21:37:05Z mike $"
"$Id: api-array.header 8627 2009-05-13 21:39:17Z mike $"
Array API header for the Common UNIX Printing System (CUPS).
Copyright 2008 by Apple Inc.
Copyright 2008-2009 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
@@ -12,6 +12,8 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h1 class='title'>Array API</h1>
<div class='summary'><table summary='General Information'>
<thead>
<tr>
+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
+4 -2
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-cups.header 8087 2008-10-27 21:37:05Z mike $"
"$Id: api-cups.header 8627 2009-05-13 21:39:17Z mike $"
CUPS API header for the Common UNIX Printing System (CUPS).
Copyright 2008 by Apple Inc.
Copyright 2008-2009 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
@@ -12,6 +12,8 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h1 class='title'>CUPS API</h1>
<div class='summary'><table summary='General Information'>
<thead>
<tr>
+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>
+4 -2
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-filedir.header 8087 2008-10-27 21:37:05Z mike $"
"$Id: api-filedir.header 8627 2009-05-13 21:39:17Z mike $"
File and Directory API header for the Common UNIX Printing System (CUPS).
Copyright 2008 by Apple Inc.
Copyright 2008-2009 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
@@ -12,6 +12,8 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h1 class='title'>File and Directory APIs</h1>
<div class='summary'><table summary='General Information'>
<thead>
<tr>
+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
+7 -3
Ver Arquivo
@@ -1,10 +1,10 @@
<!--
"$Id: api-filter.header 8087 2008-10-27 21:37:05Z 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).
Copyright 2008 by Apple Inc.
Copyright 2008-2009 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
@@ -13,6 +13,8 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h1 class='title'>Filter and Backend Programming</h1>
<div class='summary'><table summary='General Information'>
<thead>
<tr>
@@ -32,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>
+34 -7
Ver Arquivo
@@ -1,10 +1,10 @@
<!--
"$Id: api-filter.shtml 7962 2008-09-18 17:31:33Z 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).
Copyright 2007-2008 by Apple Inc.
Copyright 2007-2009 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -49,10 +49,16 @@ the remaining filters read from the standard input and write to the standard
output. The backend is the last filter in the chain and writes to the
device.</p>
<p>Filters are always run as a non-privileged user, typically "lp", with no
connection to the user's desktop. Backends are run either as a non-privileged
user or as root if the file permissions do not allow user or group execution.
The <a href="#PERMISSIONS">file permissions</a> section talks about this in
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
@@ -75,10 +81,23 @@ user may not be the same as the local user and/or there may not be a local home
directory to write to.</p>
<p>In addition, some operating systems provide additional security mechanisms
that further limit file system access, even for backends running as root. On
that further limit file system access, even for backends running as root. On
Mac OS X, for example, no backend may write to a user's home directory.</p>
</blockquote>
<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 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 and group write disabled - permissions of 0755
or 0555 are strongly encouraged.</p>
<h3><a name="TEMPFILES">Temporary Files</a></h3>
<p>Temporary files should be created in the directory specified by the
@@ -108,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>
@@ -245,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
@@ -257,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>
+4 -2
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-httpipp.header 8087 2008-10-27 21:37:05Z mike $"
"$Id: api-httpipp.header 8627 2009-05-13 21:39:17Z mike $"
HTTP and IPP API header 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, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -13,6 +13,8 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h1 class='title'>HTTP and IPP APIs</h1>
<div class='summary'><table summary='General Information'>
<thead>
<tr>
+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
+3 -1
Ver Arquivo
@@ -4,7 +4,7 @@
Introduction to CUPS programming header for the Common UNIX Printing System
(CUPS).
Copyright 2008 by Apple Inc.
Copyright 2008-2009 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
@@ -13,6 +13,8 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h1 class='title'>Introduction to CUPS Programming</h1>
<div class='summary'><table summary='General Information'>
<thead>
<tr>
+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
+4 -2
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-ppd.header 8087 2008-10-27 21:37:05Z mike $"
"$Id: api-ppd.header 8627 2009-05-13 21:39:17Z mike $"
PPD API header for the Common UNIX Printing System (CUPS).
Copyright 2008 by Apple Inc.
Copyright 2008-2009 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
@@ -12,6 +12,8 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h1 class='title'>PPD API</h1>
<div class='summary'><table summary='General Information'>
<thead>
<tr>
+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
+18 -18
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Sorted array routines 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
@@ -109,7 +109,7 @@ int /* O - 1 on success, 0 on failure */
cupsArrayAdd(cups_array_t *a, /* I - Array */
void *e) /* I - Element */
{
DEBUG_printf(("cupsArrayAdd(a=%p, e=%p)\n", a, e));
DEBUG_printf(("2cupsArrayAdd(a=%p, e=%p)", a, e));
/*
* Range check input...
@@ -117,7 +117,7 @@ cupsArrayAdd(cups_array_t *a, /* I - Array */
if (!a || !e)
{
DEBUG_puts("cupsArrayAdd: returning 0");
DEBUG_puts("3cupsArrayAdd: returning 0");
return (0);
}
@@ -505,7 +505,7 @@ int /* O - 0 on failure, 1 on success */
cupsArrayInsert(cups_array_t *a, /* I - Array */
void *e) /* I - Element */
{
DEBUG_printf(("cupsArrayInsert(a=%p, e=%p)\n", a, e));
DEBUG_printf(("2cupsArrayInsert(a=%p, e=%p)", a, e));
/*
* Range check input...
@@ -513,7 +513,7 @@ cupsArrayInsert(cups_array_t *a, /* I - Array */
if (!a || !e)
{
DEBUG_puts("cupsArrayInsert: returning 0");
DEBUG_puts("3cupsArrayInsert: returning 0");
return (0);
}
@@ -846,7 +846,7 @@ cups_array_add(cups_array_t *a, /* I - Array */
diff; /* Comparison with current element */
DEBUG_printf(("cups_array_add(a=%p, e=%p, insert=%d)\n", a, e, insert));
DEBUG_printf(("7cups_array_add(a=%p, e=%p, insert=%d)", a, e, insert));
/*
* Verify we have room for the new element...
@@ -879,11 +879,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
temp = realloc(a->elements, count * sizeof(void *));
}
DEBUG_printf(("cups_array_add: count=%d\n", count));
DEBUG_printf(("9cups_array_add: count=%d", count));
if (!temp)
{
DEBUG_puts("cupsAddAdd: allocation failed, returning 0");
DEBUG_puts("9cups_array_add: allocation failed, returning 0");
return (0);
}
@@ -978,11 +978,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
if (a->saved[i] >= current)
a->saved[i] ++;
DEBUG_printf(("cups_array_add: insert element at index %d...\n", current));
DEBUG_printf(("9cups_array_add: insert element at index %d...", current));
}
#ifdef DEBUG
else
DEBUG_printf(("cups_array_add: append element at %d...\n", current));
DEBUG_printf(("9cups_array_add: append element at %d...", current));
#endif /* DEBUG */
a->elements[current] = e;
@@ -991,11 +991,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
#ifdef DEBUG
for (current = 0; current < a->num_elements; current ++)
DEBUG_printf(("cups_array_add: a->elements[%d]=%p\n", current,
DEBUG_printf(("9cups_array_add: a->elements[%d]=%p", current,
a->elements[current]));
#endif /* DEBUG */
DEBUG_puts("cups_array_add: returning 1");
DEBUG_puts("9cups_array_add: returning 1");
return (1);
}
@@ -1017,7 +1017,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
diff; /* Comparison with current element */
DEBUG_printf(("cups_array_find(a=%p, e=%p, prev=%d, rdiff=%p)\n", a, e, prev,
DEBUG_printf(("7cups_array_find(a=%p, e=%p, prev=%d, rdiff=%p)", a, e, prev,
rdiff));
if (a->compare)
@@ -1026,7 +1026,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
* Do a binary search for the element...
*/
DEBUG_puts("cups_array_find: binary search");
DEBUG_puts("9cups_array_find: binary search");
if (prev >= 0 && prev < a->num_elements)
{
@@ -1042,7 +1042,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
* Exact or edge match, return it!
*/
DEBUG_printf(("cups_array_find: Returning %d, diff=%d\n", prev, diff));
DEBUG_printf(("9cups_array_find: Returning %d, diff=%d", prev, diff));
*rdiff = diff;
@@ -1082,7 +1082,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
current = (left + right) / 2;
diff = (*(a->compare))(e, a->elements[current], a->data);
DEBUG_printf(("cups_array_find: left=%d, right=%d, current=%d, diff=%d\n",
DEBUG_printf(("9cups_array_find: left=%d, right=%d, current=%d, diff=%d",
left, right, current, diff));
if (diff == 0)
@@ -1115,7 +1115,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
* Do a linear pointer search...
*/
DEBUG_puts("cups_array_find: linear search");
DEBUG_puts("9cups_array_find: linear search");
diff = 1;
@@ -1131,7 +1131,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
* Return the closest element and the difference...
*/
DEBUG_printf(("cups_array_find: Returning %d, diff=%d\n", current, diff));
DEBUG_printf(("8cups_array_find: Returning %d, diff=%d", current, diff));
*rdiff = diff;
+13 -11
Ver Arquivo
@@ -4,7 +4,7 @@
* PPD model-specific attribute routines for the Common UNIX Printing System
* (CUPS).
*
* 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
@@ -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.
*/
/*
@@ -44,8 +46,8 @@ ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
*attr; /* Current attribute */
DEBUG_printf(("ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")\n", ppd,
name ? name : "(null)", spec ? spec : "(null)"));
DEBUG_printf(("2ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")", ppd, name,
spec));
/*
* Range check input...
@@ -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';
+187 -146
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Authentication functions 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.
*
* This file contains Kerberos support code, copyright 2006 by
@@ -20,8 +20,8 @@
* Contents:
*
* cupsDoAuthentication() - Authenticate a request.
* DEBUG_gss_printf() - Show debug error messages from GSSAPI...
* cups_get_gss_creds() - Get CUPS service credentials for authentication.
* cups_get_gssname() - Get GSSAPI name for authentication.
* cups_gss_printf() - Show error messages from GSSAPI...
* cups_local_auth() - Get the local authorization certificate if
* available/applicable...
*/
@@ -62,13 +62,13 @@ extern const char *cssmErrorString(int error);
*/
#ifdef HAVE_GSSAPI
static gss_name_t cups_get_gssname(http_t *http, const char *service_name);
# ifdef DEBUG
static void DEBUG_gss_printf(OM_uint32 major_status, OM_uint32 minor_status,
const char *message);
static void cups_gss_printf(OM_uint32 major_status, OM_uint32 minor_status,
const char *message);
# else
# define DEBUG_gss_printf(major, minor, message)
# endif /* DEBUG */
static gss_name_t cups_get_gss_creds(http_t *http, const char *service_name);
# define cups_gss_printf(major, minor, message)
# endif /* DEBUG */
#endif /* HAVE_GSSAPI */
static int cups_local_auth(http_t *http);
@@ -83,10 +83,10 @@ static int cups_local_auth(http_t *http);
*/
int /* O - 0 on success, -1 on error */
cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
const char *method,/* I - Request method ("GET", "POST", "PUT") */
const char *resource)
/* I - Resource path */
cupsDoAuthentication(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
const char *method, /* I - Request method ("GET", "POST", "PUT") */
const char *resource) /* I - Resource path */
{
const char *password; /* Password string */
char prompt[1024], /* Prompt for user */
@@ -96,11 +96,18 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
_cups_globals_t *cg; /* Global data */
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")\n",
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")",
http, method, resource));
DEBUG_printf(("cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"\n",
if (!http)
http = _cupsConnect();
if (!http || !method || !resource)
return (-1);
DEBUG_printf(("2cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"",
http->digest_tries, http->userpass));
DEBUG_printf(("cupsDoAuthentication: WWW-Authenticate=\"%s\"\n",
DEBUG_printf(("2cupsDoAuthentication: WWW-Authenticate=\"%s\"",
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE)));
/*
@@ -117,7 +124,7 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
{
if ((localauth = cups_local_auth(http)) == 0)
{
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n",
DEBUG_printf(("2cupsDoAuthentication: authstring=\"%s\"",
http->authstring));
if (http->status == HTTP_UNAUTHORIZED)
@@ -126,7 +133,10 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
return (0);
}
else if (localauth == -1)
{
http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1); /* Error or canceled */
}
}
/*
@@ -154,11 +164,17 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
"Digest", 5) != 0;
http->userpass[0] = '\0';
if ((password = cupsGetPassword(prompt)) == NULL)
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
{
http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
}
if (!password[0])
{
http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
}
snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(),
password);
@@ -166,6 +182,15 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
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...
*/
@@ -199,28 +224,23 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
if (gss_init_sec_context == NULL)
{
DEBUG_puts("cupsDoAuthentication: Weak-linked GSSAPI/Kerberos framework "
DEBUG_puts("1cupsDoAuthentication: Weak-linked GSSAPI/Kerberos framework "
"is not present");
http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
}
# endif /* __APPLE__ */
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
{
DEBUG_printf(("cupsDoAuthentication: too many Negotiate tries (%d)\n",
http->digest_tries));
return (-1);
}
if (http->gssname == GSS_C_NO_NAME)
{
if ((gss_service_name = getenv("CUPS_GSSSERVICENAME")) == NULL)
gss_service_name = CUPS_DEFAULT_GSSSERVICENAME;
else
DEBUG_puts("cupsDoAuthentication: GSS service name set via environment");
DEBUG_puts("2cupsDoAuthentication: GSS service name set via "
"environment variable");
http->gssname = cups_get_gss_creds(http, gss_service_name);
http->gssname = cups_get_gssname(http, gss_service_name);
}
# ifdef USE_SPNEGO /* We don't implement SPNEGO just yet... */
@@ -231,7 +251,7 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
authorization = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
authorization += 9;
while (*authorization && isspace(*authorization & 255))
while (*authorization && _cups_isspace(*authorization))
authorization ++;
if (*authorization)
@@ -277,8 +297,10 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
major_status = gss_init_sec_context(&minor_status, GSS_C_NO_CREDENTIAL,
&http->gssctx,
http->gssname, http->gssmech,
GSS_C_DELEG_FLAG | GSS_C_MUTUAL_FLAG |
GSS_C_INTEG_FLAG,
#ifdef GSS_C_DELEG_POLICY_FLAG
GSS_C_DELEG_POLICY_FLAG |
#endif /* GSS_C_DELEG_POLICY_FLAG */
GSS_C_MUTUAL_FLAG | GSS_C_INTEG_FLAG,
GSS_C_INDEFINITE,
GSS_C_NO_CHANNEL_BINDINGS,
&input_token, &http->gssmech,
@@ -289,15 +311,17 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
if (GSS_ERROR(major_status))
{
# ifdef DEBUG
DEBUG_gss_printf(major_status, minor_status,
"Unable to initialize security context");
# endif /* DEBUG */
cups_gss_printf(major_status, minor_status,
"cupsDoAuthentication: Unable to initialize security "
"context");
http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
}
if (major_status == GSS_S_CONTINUE_NEEDED)
DEBUG_gss_printf(major_status, minor_status, "Continuation needed!");
cups_gss_printf(major_status, minor_status,
"cupsDoAuthentication: Continuation needed!");
if (output_token.length > 0 && output_token.length <= 65536)
{
@@ -326,9 +350,9 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
}
else
{
DEBUG_printf(("cupsDoAuthentication: Kerberos credentials too large - "
"%d bytes!\n", (int)output_token.length));
DEBUG_printf(("1cupsDoAuthentication: Kerberos credentials too large - "
"%d bytes!", (int)output_token.length));
http->status = HTTP_AUTHORIZATION_CANCELED;
gss_release_buffer(&minor_status, &output_token);
return (-1);
@@ -369,22 +393,79 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
httpSetAuthString(http, "Digest", digest);
}
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
DEBUG_printf(("1cupsDoAuthentication: authstring=\"%s\"", http->authstring));
return (0);
}
#ifdef HAVE_GSSAPI
/*
* 'cups_get_gssname()' - Get CUPS service credentials for authentication.
*/
static gss_name_t /* O - Server name */
cups_get_gssname(
http_t *http, /* I - Connection to server */
const char *service_name) /* I - Service name */
{
gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
/* Service token */
OM_uint32 major_status, /* Major status code */
minor_status; /* Minor status code */
gss_name_t server_name; /* Server name */
char buf[1024], /* Name buffer */
fqdn[HTTP_MAX_URI]; /* Server name buffer */
DEBUG_printf(("7cups_get_gssname(http=%p, service_name=\"%s\")", http,
service_name));
/*
* Get the hostname...
*/
httpGetHostname(http, fqdn, sizeof(fqdn));
if (!strcmp(fqdn, "localhost"))
httpGetHostname(NULL, fqdn, sizeof(fqdn));
/*
* Get a server name we can use for authentication purposes...
*/
snprintf(buf, sizeof(buf), "%s@%s", service_name, fqdn);
DEBUG_printf(("9cups_get_gssname: Looking up %s...", buf));
token.value = buf;
token.length = strlen(buf);
server_name = GSS_C_NO_NAME;
major_status = gss_import_name(&minor_status, &token,
GSS_C_NT_HOSTBASED_SERVICE,
&server_name);
if (GSS_ERROR(major_status))
{
cups_gss_printf(major_status, minor_status,
"cups_get_gssname: gss_import_name() failed");
return (NULL);
}
return (server_name);
}
# ifdef DEBUG
/*
* 'DEBUG_gss_printf()' - Show debug error messages from GSSAPI...
* 'cups_gss_printf()' - Show debug error messages from GSSAPI...
*/
static void
DEBUG_gss_printf(OM_uint32 major_status,/* I - Major status code */
OM_uint32 minor_status,/* I - Minor status code */
const char *message) /* I - Prefix for error message */
cups_gss_printf(OM_uint32 major_status,/* I - Major status code */
OM_uint32 minor_status,/* I - Minor status code */
const char *message) /* I - Prefix for error message */
{
OM_uint32 err_major_status, /* Major status code for display */
err_minor_status; /* Minor status code for display */
@@ -407,68 +488,13 @@ DEBUG_gss_printf(OM_uint32 major_status,/* I - Major status code */
gss_display_status(&err_minor_status, minor_status, GSS_C_MECH_CODE,
GSS_C_NULL_OID, &msg_ctx, &minor_status_string);
printf("%s: %s, %s\n", message, (char *)major_status_string.value,
(char *)minor_status_string.value);
DEBUG_printf(("1%s: %s, %s", message, (char *)major_status_string.value,
(char *)minor_status_string.value));
gss_release_buffer(&err_minor_status, &major_status_string);
gss_release_buffer(&err_minor_status, &minor_status_string);
}
# endif /* DEBUG */
/*
* 'cups_get_gss_creds()' - Get CUPS service credentials for authentication.
*/
static gss_name_t /* O - Server name */
cups_get_gss_creds(
http_t *http, /* I - Connection to server */
const char *service_name) /* I - Service name */
{
gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
/* Service token */
OM_uint32 major_status, /* Major status code */
minor_status; /* Minor status code */
gss_name_t server_name; /* Server name */
char buf[1024], /* Name buffer */
fqdn[HTTP_MAX_URI]; /* Server name buffer */
/*
* Get the hostname...
*/
httpGetHostname(http, fqdn, sizeof(fqdn));
if (!strcmp(fqdn, "localhost"))
httpGetHostname(NULL, fqdn, sizeof(fqdn));
/*
* Get a server name we can use for authentication purposes...
*/
snprintf(buf, sizeof(buf), "%s@%s", service_name, fqdn);
DEBUG_printf(("cups_get_gss_creds: Looking up %s...\n", buf));
token.value = buf;
token.length = strlen(buf);
server_name = GSS_C_NO_NAME;
major_status = gss_import_name(&minor_status, &token,
GSS_C_NT_HOSTBASED_SERVICE,
&server_name);
if (GSS_ERROR(major_status))
{
# ifdef DEBUG
DEBUG_gss_printf(major_status, minor_status, "gss_import_name() failed");
# endif /* DEBUG */
return (NULL);
}
return (server_name);
}
#endif /* HAVE_GSSAPI */
@@ -491,7 +517,8 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
#else
int pid; /* Current process ID */
FILE *fp; /* Certificate file */
char filename[1024], /* Certificate filename */
char trc[16], /* Try Root Certificate parameter */
filename[1024], /* Certificate filename */
certificate[33];/* Certificate string */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
# if defined(HAVE_AUTHORIZATION_H)
@@ -505,7 +532,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
# endif /* HAVE_AUTHORIZATION_H */
DEBUG_printf(("cups_local_auth(http=%p) hostaddr=%s, hostname=\"%s\"\n",
DEBUG_printf(("7cups_local_auth(http=%p) hostaddr=%s, hostname=\"%s\"",
http, httpAddrString(http->hostaddr, filename, sizeof(filename)), http->hostname));
/*
@@ -515,7 +542,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
if (!httpAddrLocalhost(http->hostaddr) &&
strcasecmp(http->hostname, "localhost") != 0)
{
DEBUG_puts("cups_local_auth: Not a local connection!");
DEBUG_puts("8cups_local_auth: Not a local connection!");
return (1);
}
@@ -538,7 +565,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
kAuthorizationFlagDefaults, &http->auth_ref);
if (status != errAuthorizationSuccess)
{
DEBUG_printf(("cups_local_auth: AuthorizationCreate() returned %d (%s)\n",
DEBUG_printf(("8cups_local_auth: AuthorizationCreate() returned %d (%s)",
(int)status, cssmErrorString(status)));
return (-1);
}
@@ -573,14 +600,14 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
httpSetAuthString(http, "AuthRef", buffer);
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
http->authstring));
return (0);
}
else if (status == errAuthorizationCanceled)
return (-1);
DEBUG_printf(("cups_local_auth: AuthorizationCopyRights() returned %d (%s)\n",
DEBUG_printf(("9cups_local_auth: AuthorizationCopyRights() returned %d (%s)",
(int)status, cssmErrorString(status)));
/*
@@ -589,6 +616,42 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
}
# endif /* HAVE_AUTHORIZATION_H */
# if defined(SO_PEERCRED) && defined(AF_LOCAL)
/*
* See if we can authenticate using the peer credentials provided over a
* domain socket; if so, specify "PeerCred username" as the authentication
* information...
*/
# ifdef HAVE_GSSAPI
if (strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9) &&
# else
if (
# endif /* HAVE_GSSAPI */
http->hostaddr->addr.sa_family == AF_LOCAL &&
!getenv("GATEWAY_INTERFACE")) /* Not via CGI programs... */
{
/*
* Verify that the current cupsUser() matches the current UID...
*/
struct passwd *pwd; /* Password information */
const char *username; /* Current username */
username = cupsUser();
if ((pwd = getpwnam(username)) != NULL && pwd->pw_uid == getuid())
{
httpSetAuthString(http, "PeerCred", username);
DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
http->authstring));
return (0);
}
}
# endif /* SO_PEERCRED && AF_LOCAL */
/*
* Try opening a certificate file for this PID. If that fails,
* try the root certificate...
@@ -598,25 +661,34 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
snprintf(filename, sizeof(filename), "%s/certs/%d", cg->cups_statedir, pid);
if ((fp = fopen(filename, "r")) == NULL && pid > 0)
{
DEBUG_printf(("cups_local_auth: Unable to open file %s: %s\n",
/*
* No certificate for this PID; see if we can get the root certificate...
*/
DEBUG_printf(("9cups_local_auth: Unable to open file %s: %s",
filename, strerror(errno)));
#ifdef HAVE_GSSAPI
/*
* If local certificate authentication isn't available for this PID,
* check if we need Kerberos authentication...
*/
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
{
/*
* Yes, don't try the root certificate...
* Kerberos required, don't try the root certificate...
*/
return (1);
}
#endif /* HAVE_GSSAPI */
if (!httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "trc", trc,
sizeof(trc)))
{
/*
* Scheduler doesn't want us to use the root certificate...
*/
return (1);
}
snprintf(filename, sizeof(filename), "%s/certs/0", cg->cups_statedir);
fp = fopen(filename, "r");
}
@@ -636,43 +708,12 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
httpSetAuthString(http, "Local", certificate);
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
http->authstring));
return (0);
}
# if defined(SO_PEERCRED) && defined(AF_LOCAL)
/*
* See if we can authenticate using the peer credentials provided over a
* domain socket; if so, specify "PeerCred username" as the authentication
* information...
*/
if (http->hostaddr->addr.sa_family == AF_LOCAL &&
!getenv("GATEWAY_INTERFACE")) /* Not via CGI programs... */
{
/*
* Verify that the current cupsUser() matches the current UID...
*/
struct passwd *pwd; /* Password information */
const char *username; /* Current username */
username = cupsUser();
if ((pwd = getpwnam(username)) != NULL && pwd->pw_uid == getuid())
{
httpSetAuthString(http, "PeerCred", username);
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
http->authstring));
return (0);
}
}
# endif /* SO_PEERCRED && AF_LOCAL */
return (1);
#endif /* WIN32 || __EMX__ */
}
+6 -6
Ver Arquivo
@@ -76,7 +76,7 @@ cupsBackChannelRead(char *buffer, /* I - Buffer to read into */
else
status = select(4, &input, NULL, NULL, &tval);
}
while (status < 0 && errno != EINTR);
while (status < 0 && errno != EINTR && errno != EAGAIN);
if (status < 0)
return (-1); /* Timeout! */
@@ -86,7 +86,7 @@ cupsBackChannelRead(char *buffer, /* I - Buffer to read into */
*/
#ifdef WIN32
return ((ssize_t)read(3, buffer, (unsigned)bytes));
return ((ssize_t)_read(3, buffer, (unsigned)bytes));
#else
return (read(3, buffer, bytes));
#endif /* WIN32 */
@@ -138,9 +138,9 @@ cupsBackChannelWrite(
else
status = select(4, NULL, &output, NULL, &tval);
}
while (status < 0 && errno != EINTR);
while (status < 0 && errno != EINTR && errno != EAGAIN);
if (status < 0)
if (status <= 0)
return (-1); /* Timeout! */
/*
@@ -148,7 +148,7 @@ cupsBackChannelWrite(
*/
#ifdef WIN32
count = (ssize_t)write(3, buffer, (unsigned)(bytes - total));
count = (ssize_t)_write(3, buffer, (unsigned)(bytes - total));
#else
count = write(3, buffer, bytes - total);
#endif /* WIN32 */
@@ -159,7 +159,7 @@ cupsBackChannelWrite(
* Write error - abort on fatal errors...
*/
if (errno != EINTR)
if (errno != EINTR && errno != EAGAIN)
return (-1);
}
else
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backend functions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -75,7 +75,7 @@ cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */
* It handles quoting of special characters in the device-make-and-model,
* device-info, device-id, and device-location strings.
*
* @since CUPS 1.4@
* @since CUPS 1.4/Mac OS X 10.6@
*/
void
+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_ */
/*

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