Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet 6e9e4387b7 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.1.21rc2@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
522 arquivos alterados com 17942 adições e 11884 exclusões
+9 -9
Ver Arquivo
@@ -1,4 +1,4 @@
CGI - CUPS v1.1.19 - 05/27/2003
CGI - CUPS v1.1.21 - 06/29/2004
-------------------------------
This file describes the experimental scripting/CGI support
@@ -31,20 +31,20 @@ The following MIME types are reserved for the CGI support in
CUPS (the names have been chosen to mirror those used by
Apache):
application/x-http-cgi CGI script/program
application/x-http-java Java program
application/x-http-perl Perl script
application/x-http-php PHP script
application/x-http-python Python script
application/x-httpd-cgi CGI script/program
application/x-httpd-java Java program
application/x-httpd-perl Perl script
application/x-httpd-php PHP script
application/x-httpd-python Python script
In order to enable the corresponding type, you must create a new
/etc/cups/cgi.types file which maps the filename extensions to
the appropriate MIME type, for example:
application/x-http-cgi cgi
application/x-http-php php
application/x-httpd-cgi cgi
application/x-httpd-php php
CGI scripts/programs (application/x-http-cgi) also must have
CGI scripts/programs (application/x-httpd-cgi) also must have
execution permissions to be treated as a CGI script or program.
+425 -1
Ver Arquivo
@@ -1,6 +1,430 @@
CHANGES.txt - 09/17/2003
CHANGES.txt - 08/23/2004
------------------------
CHANGES IN CUPS V1.1.21rc2
- The scheduler used a select() timeout of INT_MAX
seconds when there was nothing to do, which doesn't
work on IRIX (STR #864)
- Updated the cupsaddsmb program to use the new Windows
2000 PostScript drivers instead of the Windows NT
printer drivers (STR #390)
- The gziptoany filter did not produce copies for raw
print jobs (STR #808)
- The cupsLangGet() function now uses nl_langinfo(),
when available, to get the current encoding (STR #856)
- Added a ReloadTimeout directive to control how long
the scheduler waits for jobs to complete before
restarting the scheduler (STR #861)
- Added a note to the default cupsd.conf file which
mentions that you must allow connections from
localhost for the command-line and web interfaces to
work (STR #850)
- The IPP backend incorrectly used the local port when
communicating with a remote server; this caused
problems with some custom configurations (STR #852)
- The cups-lpd mini-daemon wasn't using the right
default banner option (STR #851)
- Updated the new httpDecode64_2() and httpEncode64_2()
functions to handle arbitrary binary data, not just
text (STR #860)
- String options with quotes in their values were not
quoted properly by the scheduler (STR #839)
- Configure script changes for GNU/Hurd (STR #838)
- The lppasswd program was not installed properly by GNU
install when the installer was not root (STR #836)
- Updated the cups-lpd man page (STR #843)
- Fixed a typo in the cupsd man page (STR #833)
- The USB backend now defaults to using the newer
/dev/usb/lpN filenames; this helps on systems which
use the devfs filesystem type on Linux (STR #818)
- The config.h file did not define the HAVE_USERSEC_H
constant when the configure script detected the
usersec.h header file. This caused authentication
errors on AIX (STR #832)
- The lp and lpr commands now report the temporary
filename and error if they are unable to create a
temporary file (STR #812)
- Added ServerTokens directive to control the Server
header in HTTP responses (STR #792)
- Added new httpDecode64_2(), httpEncode64_2(), and
httpSeparate2() functions which offer buffer size
arguments (STR #797)
- The cupsGetFile() and cupsPutFile() code did not
support CDSA or GNUTLS (STR #794)
- The httpSeparate() function did not decode all
character escapes (STR #795)
- The cupstestppd program now checks for invalid Duplex
option choices and fails PPD files that use
non-standard values (STR #791)
- Updated the printer name error message to indicate
that spaces are not allowed (STR #675)
- The scheduler didn't handle HTTP GET form data
properly (STR #744)
- The pstops filter now makes sure that the prolog code
is sent before the setup code (STR #776)
- The pstops filter now handles print files that
incorrectly start @PJL commands without a language
escape (STR #734)
- Miscellaneous build fixes for NetBSD (STR #788)
- Added support for quoted system group names (STR #784)
- Added "version" option to IPP backend to workaround
serious bug in Linksys's IPP implementation (STR #767)
- Added Spanish translation of web interface (STR #772,
STR #802)
- The LPD backend now uses geteuid() instead of getuid()
when it is available (STR #752)
- The IPP backend did not report the printer state if
the wait option was set to "no" (STR #761)
- The printer state was not updated for "STATE: foo,bar"
messages (STR #745)
- Added new CUPS API convenience functions which accept
a HTTP connection to eliminate extra username/password
prompts. This resolves a previous authentication
caching issue (STR #729, STR #743)
- The scheduler did not correctly throttle the browse
broadcasts, resulting in missing printers on client
machines (STR #754)
- The scheduler did not pass the correct CUPS_ENCRYPTION
setting to CGI programs which caused problems on
systems which used non-standard encryption settings
(STR #773)
- The lpq command showed 11st, 12nd, and 13rd instead of
11th, 12th, and 13th for the rank (STR #769)
- "make install" didn't work on some platforms due to an
error in the man page makefiles (STR #775)
- Changed some calls to snprintf() in the scheduler to
SetStringf() (STR #740)
CHANGES IN CUPS V1.1.21rc1
- Fixed some "type-punned" warnings produced by GCC when
-fstrict-aliasing is specified (STR #679)
- The PDF filter incorrectly calculated the bounding box
of a page (STR #682)
- The IPP backend did not use SSL when printing over a
port other than 443 (STR #730)
- The scheduler could crash when processing a Limit or
LimitExcept directive (STR #728)
- The lpq, lpr, and lp commands did not differentiate
between the server being unresponsive and the lack of
a default printer (STR #728)
- The PAM checks in the configure script did not stop
after the first match (STR #728)
- The cups-config man page was incorrectly placed in
section 3 (STR #728)
- The cupstestppd utility did not show a warning message
when a PPD file indicated BCP protocol support with
PJL (STR #720)
- The scheduler did not return the correct exit code
when startup failed (STR #718)
- The cupsRasterReadPixels() function checked for
EAGAIN, which caused problems on FreeBSD (STR #723)
- The cupsGetDests() function did not use the current
encryption setting (STR #653)
- The scheduler did not properly parse name-based
BrowseRelay directives in the cupsd.conf file (STR
#711)
- The IPP backend now supports the following options in
the device URI: encryption, waitjob, and waitprinter
(STR #699)
- The parallel, serial, socket, and USB backends did not
return a non-zero exit status when a job failed to
print in the middle of sending it (STR #715)
- Location directives in the cupsd.conf file were
case-sensitive for printer and class names, so
queue-specific access control was not reliable (STR
#700)
- cupsDoFileRequest() did not handle HTTP continue
status messages in all cases, causing sporatic
problems with IPP printers from some vendors (STR
#716)
- The rastertodymo driver now supports the Zebra ZPL
language (STR #713)
- The test suite no longer generates a printcap file,
which caused problems when testing as the root user
(STR #693)
- The scheduler now updates the accepting state of an
implicit class based upon the accepting state of its
member printers (STR #697)
- The pstops filter didn't properly skip leading PJL
commands (STR #664)
- The reinterpret_cast keyword was not highlighted when
printing C/C++ source files in prettyprint mode (STR
#694)
- Fixed a segfault problem with some of the client
programs (STR #668)
- When using RunAsUser, the scheduler did not correctly
set the ownership of the log files, preventing log
file rotation (STR #686)
- The image filters did not correctly load 1-bit PNG
files (STR #687)
- The pdftops filter did not show all annotation objects
in a PDF file (STR #674)
- The pdftops filter did not print the contents of
textual form elements, making it impossible to print a
filled-in form (STR #663)
- Integrated the MacOS X/Darwin USB backend into the
CUPS baseline (STR #661)
- The USB backend incorrectly reported "media tray
empty" (STR #660)
- The scheduler did not use a case-insensitive
comparison when checking for group membership, which
caused problems with Win9x clients printing via SAMBA
(STR #647)
- The scheduler did not report the addresses associated
with certain network errors, making troubleshooting
difficult (STR #648, #649)
- The cupstestppd program did not allow a default choice
of "Unknown" as required by the PPD spec (STR #651)
- The select() buffers are now allocated to be at least
as large as sizeof(fd_set) (STR #639)
- The LPD backend now supports overriding the print job
username via the device URI (STR #631)
- The scheduler did not handle an unknown MIME type when
checking for a CGI script (STR #603)
- Added a timeout optimization to the scheduler's main
loop to allow CUPS to sleep more of the time (STR
#629)
- The USB backend now retries printing to devices of the
form "usb://make/model" if any USB port shows up as
"busy" (STR #617)
- The httpGetHostByName() function did not range check
IP address values (STR #608)
- The httpUpdate() function could return HTTP_ERROR
instead of the HTTP status if the server closed the
connection before the client received the whole
response (STR #611)
- The LPD mini-daemon did not allow the administrator to
force banner pages on (STR #605)
- Added PAM support for Darwin/MacOS X (STR #550)
- The web interface now provides a "Set As Default"
button to set the default printer or class on a server
(STR #577)
- The HTTP authentication cache was broken (STR #517)
- The cupstestppd utility now fails PPD files that have
a DefaultOption keyword for a non-existance option
name (STR #476)
- Optimized the scanning of new PPD files on scheduler
startup (STR #424)
- The EPM list file did not include the bin, lib, or
sbin directories (STR #598)
- The web interface did not redirect administration
tasks to the primary server for a class or printer
(STR #491, #652)
- The cups-lpd mini-daemon did not reject print jobs to
queues that were rejecting new print jobs (STR #515)
- Some calls to the ctype functions did not account for
platforms that use a signed char type by default (STR
#518)
- The scheduler could use excess amounts of CPU if a CGI
program was sending data faster than the client could
take it (STR #595)
- Updated the Ghostscript 8.x integration stuff (STR
#484)
- The lpd backend used a source port of 732 by default,
which is outside of the range defined by RFC 1179;
also added a new (default) "reserve=any" option for
any priviledged port from 1 to 1023 (STR #474)
- The scheduler did not check for a valid Listen/Port
configuration (STR #499)
- The cupsPrintFiles() function did not always set the
last IPP error message (STR #538)
- The pstops filter did not write the PostScript header
line if the file began with a PJL escape sequence (STR
#574)
- The printer-is-accepting-jobs status of remote
printers was not sent to clients via browsing or
polling (STR #571)
- The web interface did not show the printer state
history information (STR #592)
- The rastertoepson filter would crash under certain
cirsumstances (STR #583)
- The USB backend did not handle serial numbers using
the (incorrect) SN keyword and did not terminate the
make and model name strings properly (STR #471, STR
#588)
- The USB backend did not build on Solaris x86 (STR
#585)
- The cupsDoAuthentication() function did not use the
method name for Digest authentication (STR #584)
- The scheduler could crash if a print job could not be
printed and the PreserveJobHistory option was turned
off (STR #535)
- cups-lpd now logs the temporary filenames that could
not be opened in order to make troubleshooting easier
(STR #565)
- cupsGetJobs() now returns -1 on error (STR #569)
- Added localization for Belarusian (STR #575)
- The LPD backend used the full length of the hostname
when creating the data and control filenames, which
causes problems with older systems that can't handle
long filenames (STR #560)
- The scheduler did not refresh the common printer data
after a fast reload; this prevented banner and other
information from being updated (STR #562)
- The scheduler did not send common or history data to
the client when processing a CUPS-Get-Default request
(STR #559)
- The httpFlush() function did not always flush the
remaining response data in requests (STR #558)
- The scheduler could complete a job before it collected
the exit status from all filters and the backend (STR
#448)
- The PPD conformance tests did not catch group
translation strings that exceeded the maximum allowed
size (STR #454)
- Updated the client code in the scheduler to close the
client connection on errors rather than shutting down
the receive end of the socket; this caused resource
problems on some systems (STR #434)
- cups-polld didn't compile on Tru64 5.1B (STR #436)
- "lpc stat" crashed if the device URI was empty (STR
#548)
- The scheduler did not compile without zlib (STR #433)
- std:floor() cast needed on IRIX 6.5 with SGI C++
compiler (STR #497)
- cupsRasterReadPixels() and cupsRasterWritePixels() did
not handle EAGAIN and EINTR properly (STR #473)
- RequiresPageRegion should not be consulted for Manual
Feed (STR #514)
- International characters were not substituted in
banner files properly (STR #468)
- Updated pdftops to Xpdf 2.03 code to fix printing bugs
(STR #470)
- The Digest authentication code did not include the
(required) "uri" attribute in the Authorization
response, preventing interoperation with Apache
(STR #408)
- The web interface could lockup when displaying certain
URLs (STR #459)
- The PostScript filters now convert underscores ("_")
to spaces for custom classification names (STR #555)
CHANGES IN CUPS V1.1.20
- The pstops filter didn't properly handle collated,
duplexed copies of documents with an odd number of
pages on printers that did not do their own collated
copies (STR #389)
- Tru64 doesn't define a prototype for hstrerror() (STR
#430)
- Updated the pdftops filter to use the annotation flags
instead of the subtype to determine whether to print
an annotation (STR #425)
- The French web interface localization did not use
absolute paths for the navigation bar (STR #428)
- The CUPS test suite did not undefine the PRINTER and
LPDEST environment variables. This could lead to bogus
test results (STR #380)
- The cupsLangDefault() function now works if you don't
have the base OS localization installed (STR #418)
- The pdftops filter no longer needs to create temporary
files with tmpnam (STR #406)
- The HTTP code did not use a case-insensitive
comparison when checking for the Basic authentication
method (STR #407)
- The httpEncode() function always added a trailing "="
character, which is not required by the Base64
encoding specification (STR #407)
- The signal handlers did not need to call sigset();
this caused a recursion problem on some versions of
IRIX (STR #422)
- Moved the scheduler termination code into the mainline
to be consistent with the way other signals are
handled (STR #423)
- The cupsaddsmb program didn't export the new CUPS
driver for Windows properly (STR #390)
- The ppdOpen() functions did not issue an error when a
translation string exceeded the maximum allowed by the
Adobe PPD specification (STR #399)
- The default landscape orientation was not the same as
that defined in the PPD file (STR #397)
- Updated the pstoraster patch files and CUPS driver to
work with Ghostscript 8 (STR #402)
- The hpgltops filter did not skip PJL commands (STR
#379)
CHANGES IN CUPS V1.1.20rc6
- "lp -i jobid -H restart" would often return an error
even though the job restarted successfully (STR #362)
- The scheduler did not check for invalid allow/deny
addresses such as "11.22.33.44/24". It now masks off
the extra address bits and logs a warning message in
the error_log file (STR #337)
- The cupstestppd utility now checks for missing
ImageableArea and PaperDimension attributes for each
defined PageSize (STR #365)
- The IPP code did not wait for a reply indefinitely on
HTTP connections in "blocking" mode (STR #377)
- The web interfaces did not rewrite the default printer
URI properly (STR #369 and #299)
- The LPD backend passed the C and L commands in the
wrong order (STR #378)
- The Dymo label printer driver did not set the label
length properly (STR #373)
- The scheduler did not support job IDs higher than
99999 (STR #371)
- The Visual C++ project files did not work (STR #366)
- The scheduler's cupsLangSeek() function did not reset
the "EOF" flag, preventing compressed files from being
typed properly in some cases (STR #368)
- The cupsLangGet() cache was only used if the locale
name provided an explicit character set name (STR
#354)
- The CUPS API convenience functions did not call
cupsLangFree() when they were done with the
localization data (STR #354)
- The scheduler did not return the
job-hold-until-supported or job-hold-until-default
attributes (STR #356)
- The cupsaddsmb program did not support the new CUPS
driver for Windows (STR #357)
CHANGES IN CUPS V1.1.20rc5
- The scheduler did not initialize the browse socket
file descriptor properly when only SLP browsing was
enabled (STR #259)
- The scheduler accessed the job attributes before they
were set (STR #347, fix to STR #335)
- The cupsCancelJob() function did not return 0 when the
job could not be canceled (STR #340)
CHANGES IN CUPS V1.1.20rc4
- The scheduler did not move the incoming job attributes
in the operation group to the job group (STR #335)
- The cupsDoFileRequest() function did not check for an
early HTTP response while sending the file (STR #314)
- The web interfaces did not quote #, ?, or . in printer
names, which caused some problems with the generated
URLs (STR #320)
- CUPS couldn't be completely compiled with the -dDEBUG
option (STR #331)
CHANGES IN CUPS V1.1.20rc3
- More SLP changes (STR #259)
- Revamped the child signal handling code to completely
avoid deadlock issues on Solaris (STR #325)
- The lpadmin command displayed an incorrect error
message when the "-u" option was provided with no
arguments (STR #313)
- The web admin interface did not display an error
message if the PPD file could not be loaded (STR #308)
- The ppdEmit() functions did not use the correct
orientation value position for custom page sizes (STR
#292)
CHANGES IN CUPS V1.1.20rc2
- The serial backend set the IXANY option on the port
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
ENCRYPTION - CUPS v1.1.19 - 05/27/2003
ENCRYPTION - CUPS v1.1.20 - 11/24/2003
--------------------------------------
This file describes the encryption support provided by CUPS.
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
INSTALL - CUPS v1.1.19 - 05/27/2003
INSTALL - CUPS v1.1.20 - 11/24/2003
-----------------------------------
This file describes how to compile and install CUPS from source
+8 -9
Ver Arquivo
@@ -7,9 +7,9 @@
<H2 ALIGN="CENTER">Common UNIX Printing System License Agreement</H2>
<P ALIGN="CENTER">Copyright 1997-2003 by Easy Software Products<BR>
<P ALIGN="CENTER">Copyright 1997-2004 by Easy Software Products<BR>
44141 AIRPORT VIEW DR STE 204<BR>
HOLLYWOOD, MARYLAND 20636-3111 USA<BR>
HOLLYWOOD, MARYLAND 20636-3142 USA<BR>
<BR>
Voice: +1.301.373.9600<BR>
Email: <A HREF="mailto:cups-info@cups.org">cups-info@cups.org</A><BR>
@@ -138,13 +138,12 @@ derived work.
<H3>Trademarks</H3>
<P>Easy Software Products has trademarked the Common UNIX
Printing System, CUPS, and CUPS logo. These names and logos may
be used freely in any direct port or binary distribution of
CUPS. Please contract Easy Software Products 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.
Printing System, CUPS, and CUPS logo. You may use these names
and logos in any direct port or binary distribution of CUPS.
Please contact Easy Software Products 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.
<H3>Binary Distribution Rights</H3>
+5 -5
Ver Arquivo
@@ -1,8 +1,8 @@
Common UNIX Printing System License Agreement
Copyright 1997-2003 by Easy Software Products
Copyright 1997-2004 by Easy Software Products
44141 AIRPORT VIEW DR STE 204
HOLLYWOOD, MARYLAND 20636-3111 USA
HOLLYWOOD, MARYLAND 20636-3142 USA
Voice: +1.301.373.9600
Email: cups-info@cups.org
@@ -107,9 +107,9 @@ derived work.
TRADEMARKS
Easy Software Products has trademarked the Common UNIX Printing
System, CUPS, and CUPS logo. These names and logos may be used
freely in any direct port or binary distribution of CUPS. Please
contract Easy Software Products for written permission to use
System, CUPS, and CUPS logo. You may use these names and logos
in any direct port or binary distribution of CUPS. Please
contact Easy Software Products 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.
+7 -4
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Common makefile definitions for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -145,7 +145,6 @@ LIBDIR = $(BUILDROOT)$(libdir)
LOCALEDIR = $(BUILDROOT)@CUPS_LOCALEDIR@
LOGDIR = $(BUILDROOT)@CUPS_LOGDIR@
MANDIR = $(BUILDROOT)@mandir@
PAMDIR = $(BUILDROOT)@PAMDIR@
PMANDIR = $(BUILDROOT)@PMANDIR@
REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
SBINDIR = $(BUILDROOT)@sbindir@
@@ -159,6 +158,10 @@ CAT8EXT = @CAT8EXT@
MAN8EXT = @MAN8EXT@
MAN8DIR = @MAN8DIR@
PAMDIR = $(BUILDROOT)@PAMDIR@
PAMFILE = @PAMFILE@
#
# Rules...
#
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
+2 -2
Ver Arquivo
@@ -1,4 +1,4 @@
README - CUPS v1.1.19 - 05/27/2003
README - CUPS v1.1.20 - 11/24/2003
----------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
@@ -248,7 +248,7 @@ file.
LEGAL STUFF
CUPS is Copyright 1993-2003 by Easy Software Products. CUPS,
CUPS is Copyright 1993-2004 by Easy Software Products. CUPS,
the CUPS logo, and the Common UNIX Printing System are the
trademark property of Easy Software Products.
+4 -3
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Backend makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -141,6 +141,7 @@ socket: socket.o ../cups/$(LIBCUPS)
usb: usb.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o usb usb.o $(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-unix.c
#
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backend test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+232 -93
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -26,6 +26,7 @@
* Contents:
*
* main() - Send a file to the printer or server.
* check_printer_state() - Check the printer state...
* password_cb() - Disable the password prompt for
* cupsDoFileRequest().
* report_printer_state() - Report the printer state.
@@ -43,6 +44,7 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <cups/http-private.h>
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/string.h>
@@ -54,49 +56,21 @@
* Globals...
*/
static char tmpfilename[1024] = ""; /* Temporary spool file name */
static char *password = NULL; /* Password for device URI */
#ifdef __APPLE__
static char pstmpname[1024] = ""; /* Temporary PostScript file name */
#endif /* __APPLE__ */
/*
* Some OS's don't have hstrerror(), most notably Solaris...
*/
#ifndef HAVE_HSTRERROR
# define hstrerror cups_hstrerror
const char * /* O - Error string */
cups_hstrerror(int error) /* I - Error number */
{
static const char * const errors[] =
{
"OK",
"Host not found.",
"Try again.",
"Unrecoverable lookup error.",
"No data associated with name."
};
if (error < 0 || error > 4)
return ("Unknown hostname lookup error.");
else
return (errors[error]);
}
#elif defined(_AIX)
/*
* AIX doesn't provide a prototype but does provide the function...
*/
extern const char *hstrerror(int);
#endif /* !HAVE_HSTRERROR */
static char tmpfilename[1024] = ""; /* Temporary spool file name */
/*
* Local functions...
*/
void check_printer_state(http_t *http, cups_lang_t *language,
const char *charset, const char *uri, /* I - Printer URI */
const char *resource, const char *user,
int version);
const char *password_cb(const char *);
int report_printer_state(ipp_t *ipp);
@@ -106,13 +80,6 @@ int run_pictwps_filter(char **argv, const char *filename);
static void sigterm_handler(int sig);
/*
* Local globals...
*/
char *password = NULL;
/*
* 'main()' - Send a file to the printer or server.
*
@@ -131,7 +98,11 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024]; /* Resource info (printer name) */
resource[1024], /* Resource info (printer name) */
*optptr, /* Pointer to URI options */
name[255], /* Name of option */
value[255], /* Value of option */
*ptr; /* Pointer into name or value */
char *filename; /* File to print */
int port; /* Port number (not used) */
char uri[HTTP_MAX_URI];/* Updated URI without user/pass */
@@ -140,6 +111,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
ipp_t *request, /* IPP request */
*response, /* IPP response */
*supported; /* get-printer-attributes response */
int waitjob, /* Wait for job complete? */
waitprinter; /* Wait for printer ready? */
ipp_attribute_t *job_id_attr; /* job-id attribute */
int job_id; /* job-id value */
ipp_attribute_t *job_sheets; /* job-media-sheets-completed attribute */
@@ -238,6 +211,25 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (content_type == NULL)
content_type = "application/octet-stream";
/*
* Extract the hostname and printer name from the URI...
*/
if (strchr(argv[0], ':') != NULL)
httpSeparate(argv[0], method, username, hostname, &port, resource);
else if (getenv("DEVICE_URI") != NULL)
httpSeparate(getenv("DEVICE_URI"), method, username, hostname, &port,
resource);
else
{
fputs("ERROR: Missing device URI on command-line and no DEVICE_URI environment variable!\n",
stderr);
return (1);
}
if (!strcmp(method, "https"))
cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
/*
* If we have 7 arguments, print the file named on the command-line.
* Otherwise, copy stdin to a temporary file and print the temporary
@@ -277,10 +269,123 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
filename = argv[6];
/*
* Extract the hostname and printer name from the URI...
* See if there are any options...
*/
httpSeparate(argv[0], method, username, hostname, &port, resource);
version = 1;
waitjob = 1;
waitprinter = 1;
if ((optptr = strchr(resource, '?')) != NULL)
{
/*
* Yup, terminate the device name string and move to the first
* character of the optptr...
*/
*optptr++ = '\0';
/*
* Then parse the optptr...
*/
while (*optptr)
{
/*
* Get the name...
*/
for (ptr = name; *optptr && *optptr != '=';)
if (ptr < (name + sizeof(name) - 1))
*ptr++ = *optptr++;
*ptr = '\0';
if (*optptr == '=')
{
/*
* Get the value...
*/
optptr ++;
for (ptr = value; *optptr && *optptr != '+';)
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *optptr++;
*ptr = '\0';
if (*optptr == '+')
optptr ++;
}
else
value[0] = '\0';
/*
* Process the option...
*/
if (!strcasecmp(name, "waitjob"))
{
/*
* Wait for job completion?
*/
waitjob = !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") ||
!strcasecmp(value, "true");
}
else if (!strcasecmp(name, "waitprinter"))
{
/*
* Wait for printer idle?
*/
waitprinter = !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") ||
!strcasecmp(value, "true");
}
else if (!strcasecmp(name, "encryption"))
{
/*
* Enable/disable encryption?
*/
if (!strcasecmp(value, "always"))
cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
else if (!strcasecmp(value, "required"))
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
else if (!strcasecmp(value, "never"))
cupsSetEncryption(HTTP_ENCRYPT_NEVER);
else if (!strcasecmp(value, "ifrequested"))
cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED);
else
{
fprintf(stderr, "ERROR: Unknown encryption option value \"%s\"!\n",
value);
}
}
else if (!strcasecmp(name, "version"))
{
if (!strcmp(value, "1.0"))
version = 0;
else if (!strcmp(value, "1.1"))
version = 1;
else
{
fprintf(stderr, "ERROR: Unknown version option value \"%s\"!\n",
value);
}
}
else
{
/*
* Unknown option...
*/
fprintf(stderr, "ERROR: Unknown option \"%s\" with value \"%s\"!\n",
name, value);
}
}
}
/*
* Set the authentication info, if any...
@@ -315,7 +420,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* available printer in the class.
*/
fprintf(stderr, "INFO: Unable to queue job on %s, queuing on next printer in class...\n",
fprintf(stderr, "INFO: Unable to connect to %s, queuing on next printer in class...\n",
hostname);
if (argc == 6 || strcmp(filename, argv[6]))
@@ -372,7 +477,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
charset_sup = NULL;
copies_sup = NULL;
format_sup = NULL;
version = 1;
supported = NULL;
do
@@ -495,7 +599,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
IPP_TAG_BOOLEAN);
if (printer_state == NULL ||
printer_state->values[0].integer > IPP_PRINTER_PROCESSING ||
(printer_state->values[0].integer > IPP_PRINTER_PROCESSING && waitprinter) ||
printer_accepting == NULL ||
!printer_accepting->values[0].boolean)
{
@@ -601,8 +705,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
fprintf(stderr, "DEBUG: printer-uri = \"%s\"\n", uri);
if (argv[2][0])
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, argv[2]);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, argv[2]);
fprintf(stderr, "DEBUG: requesting-user-name = \"%s\"\n", argv[2]);
@@ -740,7 +844,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Wait for the job to complete...
*/
if (!job_id)
if (!job_id || !waitjob)
continue;
fputs("INFO: Waiting for job to complete...\n", stderr);
@@ -770,8 +874,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
job_id);
if (argv[2][0])
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, argv[2]);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, argv[2]);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", sizeof(jattrs) / sizeof(jattrs[0]),
@@ -811,7 +915,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
fprintf(stderr, "ERROR: Unable to get job %d attributes (%s)!\n",
job_id, ippErrorString(ipp_status));
break;
break;
}
}
@@ -841,43 +945,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
ippDelete(response);
/*
* Now check on the printer state...
* Check the printer state and report it if necessary...
*/
request = ippNew();
request->request.op.version[1] = version;
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
/* if (!copies_sup)
httpReconnect(http);*/
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, charset);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL,
language != NULL ? language->language : "en");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
if (argv[2][0])
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, argv[2]);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-state-reasons");
/*
* Do the request...
*/
if (!copies_sup)
httpReconnect(http);
if ((response = cupsDoRequest(http, request, resource)) != NULL)
{
reasons = report_printer_state(response);
ippDelete(response);
}
check_printer_state(http, language, charset, uri, resource, argv[2],
version);
/*
* Wait 10 seconds before polling again...
@@ -887,6 +962,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
}
/*
* Check the printer state and report it if necessary...
*/
/* if (!copies_sup)
httpReconnect(http);*/
check_printer_state(http, language, charset, uri, resource, argv[2], version);
/*
* Free memory...
*/
@@ -912,13 +996,68 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Return the queue status...
*/
if (ipp_status <= IPP_OK_CONFLICT && reasons == 0)
fputs("INFO: Ready to print.\n", stderr);
return (ipp_status > IPP_OK_CONFLICT);
}
/*
* 'check_printer_state()' - Check the printer state...
*/
void
check_printer_state(http_t *http, /* I - HTTP connection */
cups_lang_t *language,
/* I - Language */
const char *charset,
/* I - Charset */
const char *uri, /* I - Printer URI */
const char *resource,
/* I - Resource path */
const char *user, /* I - Username, if any */
int version)/* I - IPP version */
{
ipp_t *request, /* IPP request */
*response; /* IPP response */
/*
* Check on the printer state...
*/
request = ippNew();
request->request.op.version[1] = version;
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, charset);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL,
language != NULL ? language->language : "en");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
if (user && user[0])
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-state-reasons");
/*
* Do the request...
*/
if ((response = cupsDoRequest(http, request, resource)) != NULL)
{
report_printer_state(response);
ippDelete(response);
}
}
/*
* 'password_cb()' - Disable the password prompt for cupsDoFileRequest().
*/
+81 -64
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -43,6 +43,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <cups/http-private.h>
#include <cups/string.h>
#include <errno.h>
#include <sys/types.h>
@@ -66,45 +67,21 @@
static char tmpfilename[1024] = ""; /* Temporary spool file name */
/*
* Some OS's don't have hstrerror(), most notably Solaris...
*/
#ifndef HAVE_HSTRERROR
# define hstrerror cups_hstrerror
const char * /* O - Error string */
cups_hstrerror(int error) /* I - Error number */
{
static const char * const errors[] =
{
"OK",
"Host not found.",
"Try again.",
"Unrecoverable lookup error.",
"No data associated with name."
};
if (error < 0 || error > 4)
return ("Unknown hostname lookup error.");
else
return (errors[error]);
}
#elif defined(_AIX)
/*
* AIX doesn't provide a prototype but does provide the function...
*/
extern const char *hstrerror(int);
#endif /* !HAVE_HSTRERROR */
/*
* The order for control and data files in LPD requests...
*/
#define ORDER_CONTROL_DATA 0
#define ORDER_DATA_CONTROL 1
#define ORDER_CONTROL_DATA 0 /* Control file first, then data */
#define ORDER_DATA_CONTROL 1 /* Data file first, then control */
/*
* What to reserve...
*/
#define RESERVE_NONE 0 /* Don't reserve a priviledged port */
#define RESERVE_RFC1179 1 /* Reserve port 721-731 */
#define RESERVE_ANY 2 /* Reserve port 1-1023 */
/*
@@ -143,7 +120,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
{
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
*options, /* Pointer to options */
name[255], /* Name of option */
@@ -151,7 +128,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*ptr, /* Pointer into name or value */
*filename, /* File to print */
title[256]; /* Title string */
int port; /* Port number (not used) */
int port; /* Port number */
int status; /* Status of LPD job */
int banner; /* Print banner page? */
int format; /* Print format */
@@ -253,6 +230,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
httpSeparate(argv[0], method, username, hostname, &port, resource);
if (!username[0])
{
/*
* If no username is in the device URI, then use the print job user...
*/
strlcpy(username, argv[2], sizeof(username));
}
/*
* See if there are any options...
*/
@@ -260,11 +246,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
banner = 0;
format = 'l';
order = ORDER_CONTROL_DATA;
reserve = 0;
reserve = RESERVE_ANY;
manual_copies = 1;
timeout = 300;
sanitize_title = 1;
#if defined(__APPLE__)
/* We want to pass utf-8 characters, not re-map them (3071945) */
sanitize_title= 0;
#endif
if ((options = strchr(resource, '?')) != NULL)
{
/*
@@ -285,7 +276,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
for (ptr = name; *options && *options != '=';)
*ptr++ = *options++;
if (ptr < (name + sizeof(name) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '=')
@@ -297,7 +289,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
options ++;
for (ptr = value; *options && *options != '+';)
*ptr++ = *options++;
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '+')
@@ -351,10 +344,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Set port reservation mode...
*/
reserve = !value[0] ||
strcasecmp(value, "on") == 0 ||
strcasecmp(value, "yes") == 0 ||
strcasecmp(value, "true") == 0;
if (!value[0] ||
!strcasecmp(value, "on") ||
!strcasecmp(value, "yes") ||
!strcasecmp(value, "true") ||
!strcasecmp(value, "rfc1179"))
reserve = RESERVE_RFC1179;
else if (!strcasecmp(value, "any"))
reserve = RESERVE_ANY;
else
reserve = RESERVE_NONE;
}
else if (strcasecmp(name, "manual_copies") == 0)
{
@@ -404,7 +403,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
for (ptr = title; *ptr; ptr ++)
if (!isalnum(*ptr) && !isspace(*ptr))
if (!isalnum(*ptr & 255) && !isspace(*ptr & 255))
*ptr = '_';
}
@@ -426,7 +425,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
status = lpd_queue(hostname, port, resource + 1, filename,
argv[2] /* user */, title, copies,
username, title, copies,
banner, format, order, reserve, manual_copies, timeout);
if (!status)
@@ -434,7 +433,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
else
status = lpd_queue(hostname, port, resource + 1, filename,
argv[2] /* user */, title, 1,
username, title, 1,
banner, format, order, reserve, 1, timeout);
/*
@@ -593,9 +592,24 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
addr.sin_family = hostaddr->h_addrtype;
addr.sin_port = htons(port);
for (lport = 732;;)
for (lport = reserve == RESERVE_RFC1179 ? 732 : 1024;;)
{
/*
* Choose the next priviledged port...
*/
lport --;
if (lport < 721 && reserve == RESERVE_RFC1179)
lport = 731;
else if (lport < 1)
lport = 1023;
#ifdef HAVE_GETEUID
if (geteuid() || !reserve)
#else
if (getuid() || !reserve)
#endif /* HAVE_GETEUID */
{
/*
* Just create a regular socket...
@@ -613,13 +627,14 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
{
/*
* We're running as root and want to comply with RFC 1179. Reserve a
* priviledged lport between 721 and 732...
* priviledged lport between 721 and 731...
*/
if ((fd = rresvport(&lport)) < 0)
{
perror("ERROR: Unable to reserve port");
sleep(30);
sleep(1);
continue;
}
}
@@ -639,13 +654,15 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
}
else if (error == EADDRINUSE)
{
port --;
if (port < 721)
port = 732;
/*
* Try on another port...
*/
sleep(1);
}
else
{
perror("ERROR: Unable to connect to printer");
perror("ERROR: Unable to connect to printer; will retry in 30 seconds...");
sleep(30);
}
}
@@ -693,28 +710,28 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (banner)
{
snprintf(cptr, sizeof(control) - (cptr - control), "L%s\nC%s\n", user,
localhost);
snprintf(cptr, sizeof(control) - (cptr - control), "C%s\nL%s\n",
localhost, user);
cptr += strlen(cptr);
}
while (copies > 0)
{
snprintf(cptr, sizeof(control) - (cptr - control), "%cdfA%03d%s\n", format,
snprintf(cptr, sizeof(control) - (cptr - control), "%cdfA%03d%.15s\n", format,
getpid() % 1000, localhost);
cptr += strlen(cptr);
copies --;
}
snprintf(cptr, sizeof(control) - (cptr - control),
"UdfA%03d%s\nN%s\n",
"UdfA%03d%.15s\nN%s\n",
getpid() % 1000, localhost, title);
fprintf(stderr, "DEBUG: Control file is:\n%s", control);
if (order == ORDER_CONTROL_DATA)
{
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%s\n", strlen(control),
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
getpid() % 1000, localhost))
return (1);
@@ -755,7 +772,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
* Send the print file...
*/
if (lpd_command(fd, timeout, "\003%u dfA%03.3d%s\n",
if (lpd_command(fd, timeout, "\003%u dfA%03.3d%.15s\n",
(unsigned)filestats.st_size, getpid() % 1000,
localhost))
return (1);
@@ -820,7 +837,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (status == 0 && order == ORDER_DATA_CONTROL)
{
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%s\n", strlen(control),
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
getpid() % 1000, localhost))
return (1);
+6 -6
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Parallel port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -245,6 +245,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Finally, send the print file...
*/
wbytes = 0;
while (copies > 0)
{
copies --;
@@ -298,9 +300,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (0);
return (wbytes < 0);
}
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IRIX SCSI printer support for the Common UNIX Printing System (CUPS).
*
* Copyright 2003 by Easy Software Products, all rights reserved.
* Copyright 2003-2004 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Linux SCSI printer support for the Common UNIX Printing System (CUPS).
*
* Copyright 2003 by Easy Software Products, all rights reserved.
* Copyright 2003-2004 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
+1 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* SCSI printer backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2003 by Easy Software Products, all rights reserved.
* Copyright 2003-2004 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
@@ -211,9 +211,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (fp != 0)
close(fp);
if (!status)
fputs("INFO: Ready to print.\n", stderr);
return (status);
}
+10 -8
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Serial port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -251,7 +251,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
for (ptr = name; *options && *options != '=';)
*ptr++ = *options++;
if (ptr < (name + sizeof(name) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '=')
@@ -263,7 +264,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
options ++;
for (ptr = value; *options && *options != '+';)
*ptr++ = *options++;
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '+')
@@ -442,6 +444,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (bufsize > sizeof(buffer))
bufsize = sizeof(buffer);
wbytes = 0;
while (copies > 0)
{
copies --;
@@ -527,9 +531,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (0);
return (wbytes < 0);
}
+7 -39
Ver Arquivo
@@ -3,7 +3,7 @@
*
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -36,6 +36,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <cups/http-private.h>
#include <cups/string.h>
#include <errno.h>
#include <sys/types.h>
@@ -54,39 +55,6 @@
#endif /* WIN32 */
/*
* Some OS's don't have hstrerror(), most notably Solaris...
*/
#ifndef HAVE_HSTRERROR
# define hstrerror cups_hstrerror
const char * /* O - Error string */
cups_hstrerror(int error) /* I - Error number */
{
static const char * const errors[] =
{
"OK",
"Host not found.",
"Try again.",
"Unrecoverable lookup error.",
"No data associated with name."
};
if (error < 0 || error > 4)
return ("Unknown hostname lookup error.");
else
return (errors[error]);
}
#elif defined(_AIX)
/*
* AIX doesn't provide a prototype but does provide the function...
*/
extern const char *hstrerror(int);
#endif /* !HAVE_HSTRERROR */
/*
* Local functions...
*/
@@ -219,6 +187,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
addr.sin_family = hostaddr->h_addrtype;
addr.sin_port = htons(port);
wbytes = 0;
while (copies > 0)
{
for (delay = 5;;)
@@ -401,9 +371,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (0);
return (wbytes < 0);
}
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+807
Ver Arquivo
@@ -0,0 +1,807 @@
/*
* "$Id$"
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
* This file is included from "usb.c" when compiled on UNIX/Linux.
*
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Send a file to the specified USB port.
* list_devices() - List all USB devices.
*/
/*
* Include necessary headers.
*/
#ifdef __linux
# include <sys/ioctl.h>
# include <linux/lp.h>
# define IOCNR_GET_DEVICE_ID 1
/*
* Get device_id string
*/
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
#endif /* __linux */
#ifdef __sun
# ifdef __sparc
# include <sys/ecppio.h>
# else
# include <sys/ioccom.h>
# include <sys/ecppsys.h>
# endif /* __sparc */
#endif /* __sun */
/*
* Local functions...
*/
void decode_device_id(int port, const char *device_id,
char *make_model, int mmsize,
char *uri, int urisize);
int open_device(const char *uri);
/*
* 'print_device()' - Print a file to a USB device.
*/
int /* O - Exit status */
print_device(const char *uri, /* I - Device URI */
const char *hostname, /* I - Hostname/manufacturer */
const char *resource, /* I - Resource/modelname */
const char *options, /* I - Device options/serial number */
int fp, /* I - File descriptor to print */
int copies) /* I - Copies to print */
{
int fd; /* USB device */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct termios opts; /* Parallel port options */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
#ifdef __linux
unsigned char status; /* Port status (off-line, out-of-paper, etc.) */
#endif /* __linux */
/*
* Open the USB port device...
*/
do
{
if ((fd = open_device(uri)) == -1)
{
if (errno == EBUSY)
{
fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else if (errno == ENXIO || errno == EIO || errno == ENOENT)
{
fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else
{
fprintf(stderr, "ERROR: Unable to open USB device \"%s\": %s\n",
uri, strerror(errno));
return (1);
}
}
}
while (fd < 0);
/*
* Set any options provided...
*/
tcgetattr(fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(fd, TCSANOW, &opts);
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
* current page... Only ignore SIGTERM if we are printing data from
* stdin (otherwise you can't cancel raw jobs...)
*/
if (fp)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
}
#if defined(__linux) && defined(LP_POUTPA)
/*
* Show the printer status before we send the file; normally, we'd
* do this while we write data to the printer, however at least some
* Linux kernels have buggy USB drivers which don't like to be
* queried while sending data to the printer...
*
* Also, we're using the 8255 constants instead of the ones that are
* supposed to be used, as it appears that the USB driver also doesn't
* follow standards...
*/
if (ioctl(fd, LPGETSTATUS, &status) == 0)
{
fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
if (status & LP_POUTPA)
fputs("WARNING: Media tray empty!\n", stderr);
else if (!(status & LP_PERRORP))
fputs("WARNING: Printer fault!\n", stderr);
else if (!(status & LP_PSELECD))
fputs("WARNING: Printer off-line.\n", stderr);
}
#endif /* __linux && LP_POUTPA */
/*
* Finally, send the print file...
*/
wbytes = 0;
while (copies > 0)
{
copies --;
if (fp != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(fp, 0, SEEK_SET);
}
tbytes = 0;
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
nbytes -= wbytes;
bufptr += wbytes;
}
if (wbytes < 0)
break;
if (fp)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
}
}
/*
* Close the USB port and return...
*/
close(fd);
return (wbytes < 0);
}
/*
* 'decode_device_id()' - Decode the IEEE-1284 device ID string.
*/
void
decode_device_id(int port, /* I - Port number */
const char *device_id, /* I - 1284 device ID string */
char *make_model, /* O - Make/model */
int mmsize, /* I - Size of buffer */
char *uri, /* O - Device URI */
int urisize) /* I - Size of buffer */
{
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*uriptr, /* Pointer into URI */
*mfg, /* Manufacturer string */
*mdl, /* Model string */
serial_number[1024]; /* Serial number string */
/*
* Look for the description field...
*/
if ((attr = strstr(device_id, "DES:")) != NULL)
attr += 4;
else if ((attr = strstr(device_id, "DESCRIPTION:")) != NULL)
attr += 12;
if ((mfg = strstr(device_id, "MANUFACTURER:")) != NULL)
mfg += 13;
else if ((mfg = strstr(device_id, "MFG:")) != NULL)
mfg += 4;
if ((mdl = strstr(device_id, "MODEL:")) != NULL)
mdl += 6;
else if ((mdl = strstr(device_id, "MDL:")) != NULL)
mdl += 4;
if (attr)
{
if (strncasecmp(attr, "Hewlett-Packard ", 16) == 0)
{
strlcpy(make_model, "HP ", mmsize);
strlcpy(make_model + 3, attr + 16, mmsize - 3);
}
else
{
strlcpy(make_model, attr, mmsize);
}
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
}
else if (mfg && mdl)
{
/*
* Build a make-model string from the manufacturer and model attributes...
*/
strlcpy(make_model, mfg, mmsize);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
strlcat(make_model, " ", mmsize);
strlcat(make_model, mdl, mmsize);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
}
else
{
/*
* Use "Unknown" as the printer make and model...
*/
strlcpy(make_model, "Unknown", mmsize);
}
/*
* Look for the serial number field...
*/
if ((attr = strstr(device_id, "SERN:")) != NULL)
attr += 5;
else if ((attr = strstr(device_id, "SERIALNUMBER:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, ";SN:")) != NULL)
attr += 4;
if (mfg)
{
/*
* Make sure manufacturer is truncated at delimiter...
*/
if ((delim = strchr(mfg, ';')) != NULL)
*delim = '\0';
}
if (mdl)
{
/*
* Make sure model is truncated at delimiter...
*/
if ((delim = strchr(mdl, ';')) != NULL)
*delim = '\0';
}
if (attr)
{
strlcpy(serial_number, attr, sizeof(serial_number));
if ((delim = strchr(serial_number, ';')) != NULL)
*delim = '\0';
}
else
serial_number[0] = '\0';
/*
* Generate the device URI from the make_model and serial number strings.
*/
strlcpy(uri, "usb://", urisize);
for (uriptr = uri + 6, delim = make_model;
*delim && uriptr < (uri + urisize - 1);
delim ++)
if (*delim == ' ')
{
delim ++;
*uriptr++ = '/';
break;
}
else
*uriptr++ = *delim;
for (; *delim && uriptr < (uri + urisize - 3); delim ++)
if (*delim == ' ')
{
*uriptr++ = '%';
*uriptr++ = '2';
*uriptr++ = '0';
}
else
*uriptr++ = *delim;
*uriptr = '\0';
if (serial_number[0])
{
/*
* Add the serial number to the URI...
*/
strlcat(uri, "?serial=", urisize);
strlcat(uri, serial_number, urisize);
}
}
/*
* 'list_devices()' - List all USB devices.
*/
void
list_devices(void)
{
#ifdef __linux
int i; /* Looping var */
int length; /* Length of device ID info */
int fd; /* File descriptor */
char format[255], /* Format for device filename */
device[255], /* Device filename */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
/*
* First figure out which USB printer filename to use...
*/
if (access("/dev/usblp0", 0) == 0)
strcpy(format, "/dev/usblp%d");
else if (access("/dev/usb/usblp0", 0) == 0)
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usb/lp%d");
/*
* Then open each USB device...
*/
for (i = 0; i < 16; i ++)
{
sprintf(device, format, i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
if (ioctl(fd, LPIOC_GET_DEVICE_ID(sizeof(device_id)), device_id) == 0)
{
length = (((unsigned)device_id[0] & 255) << 8) +
((unsigned)device_id[1] & 255);
/*
* Check to see if the length is larger than our buffer; first
* assume that the vendor incorrectly implemented the 1284 spec,
* and then limit the length to the size of our buffer...
*/
if (length > (sizeof(device_id) - 2))
length = (((unsigned)device_id[1] & 255) << 8) +
((unsigned)device_id[0] & 255);
if (length > (sizeof(device_id) - 2))
length = sizeof(device_id) - 2;
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
else
device_id[0] = '\0';
close(fd);
}
else
device_id[0] = '\0';
if (device_id[0])
{
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
printf("direct %s \"%s\" \"USB Printer #%d\"\n", device_uri,
make_model, i + 1);
}
else
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
}
#elif defined(__sgi)
#elif defined(__sun)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
# ifdef ECPPIOC_GETDEVID
struct ecpp_device_id did; /* Device ID buffer */
# endif /* ECPPIOC_GETDEVID */
/*
* Open each USB device...
*/
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
# ifndef ECPPIOC_GETDEVID
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
# else
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
did.mode = ECPP_CENTRONICS;
did.len = sizeof(device_id);
did.rlen = 0;
did.addr = device_id;
if (ioctl(fd, ECPPIOC_GETDEVID, &did) == 0)
{
if (did.rlen < (sizeof(device_id) - 1))
device_id[did.rlen] = '\0';
else
device_id[sizeof(device_id) - 1] = '\0';
}
else
device_id[0] = '\0';
close(fd);
}
else
device_id[0] = '\0';
if (device_id[0])
{
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
printf("direct %s \"%s\" \"USB Printer #%d\"\n", device_uri,
make_model, i + 1);
}
else
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
# endif /* !ECPPIOC_GETDEVID */
}
#elif defined(__hpux)
#elif defined(__osf)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
int i; /* Looping var */
char device[255]; /* Device filename */
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/ulpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
sprintf(device, "/dev/unlpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d (no reset)\"\n", device, i + 1);
}
#endif
}
/*
* 'open_device()' - Open a USB device...
*/
int /* O - File descriptor or -1 on error */
open_device(const char *uri) /* I - Device URI */
{
/*
* The generic implementation just treats the URI as a device filename...
* Specific operating systems may also support using the device serial
* number and/or make/model.
*/
if (strncmp(uri, "usb:/dev/", 9) == 0)
return (open(uri + 4, O_RDWR | O_EXCL));
#ifdef __linux
else if (strncmp(uri, "usb://", 6) == 0)
{
/*
* For Linux, try looking up the device serial number or model...
*/
int i; /* Looping var */
int busy; /* Are any ports busy? */
int length; /* Length of device ID info */
int fd; /* File descriptor */
char format[255], /* Format for device filename */
device[255], /* Device filename */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
device_uri[1024]; /* Device URI string */
/*
* First figure out which USB printer filename to use...
*/
if (access("/dev/usblp0", 0) == 0)
strcpy(format, "/dev/usblp%d");
else if (access("/dev/usb/usblp0", 0) == 0)
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usb/lp%d");
/*
* Then find the correct USB device...
*/
do
{
for (busy = 0, i = 0; i < 16; i ++)
{
sprintf(device, format, i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
if (ioctl(fd, LPIOC_GET_DEVICE_ID(sizeof(device_id)), device_id) == 0)
{
length = (((unsigned)device_id[0] & 255) << 8) +
((unsigned)device_id[1] & 255);
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
else
device_id[0] = '\0';
}
else
{
/*
* If the open failed because it was busy, flag it so we retry
* as needed...
*/
if (errno == EBUSY)
busy = 1;
device_id[0] = '\0';
}
if (device_id[0])
{
/*
* Got the device ID - is this the one?
*/
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
if (strcmp(uri, device_uri) == 0)
{
/*
* Yes, return this file descriptor...
*/
fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n", device);
return (fd);
}
}
/*
* This wasn't the one...
*/
if (fd >= 0)
close(fd);
}
/*
* If we get here and at least one of the printer ports showed up
* as "busy", then sleep for a bit and retry...
*/
if (busy)
{
fputs("INFO: USB printer is busy; will retry in 5 seconds...\n",
stderr);
sleep(5);
}
}
while (busy);
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
else if (strncmp(uri, "usb://", 6) == 0)
{
/*
* For Solaris, try looking up the device serial number or model...
*/
int i; /* Looping var */
int busy; /* Are any ports busy? */
int fd; /* File descriptor */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
device_uri[1024]; /* Device URI string */
struct ecpp_device_id did; /* Device ID buffer */
/*
* Find the correct USB device...
*/
do
{
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
did.mode = ECPP_CENTRONICS;
did.len = sizeof(device_id);
did.rlen = 0;
did.addr = device_id;
if (ioctl(fd, ECPPIOC_GETDEVID, &did) == 0)
{
if (did.rlen < (sizeof(device_id) - 1))
device_id[did.rlen] = '\0';
else
device_id[sizeof(device_id) - 1] = '\0';
}
else
device_id[0] = '\0';
}
else
{
/*
* If the open failed because it was busy, flag it so we retry
* as needed...
*/
if (errno == EBUSY)
busy = 1;
device_id[0] = '\0';
}
if (device_id[0])
{
/*
* Got the device ID - is this the one?
*/
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
if (strcmp(uri, device_uri) == 0)
return (fd); /* Yes, return this file descriptor... */
}
/*
* This wasn't the one...
*/
if (fd >= 0)
close(fd);
}
/*
* If we get here and at least one of the printer ports showed up
* as "busy", then sleep for a bit and retry...
*/
if (busy)
{
fputs("INFO: USB printer is busy; will retry in 5 seconds...\n",
stderr);
sleep(5);
}
}
while (busy);
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#endif /* __linux */
else
{
errno = ENODEV;
return (-1);
}
}
/*
* End of "$Id$".
*/
+128 -664
Ver Arquivo
@@ -3,7 +3,7 @@
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -25,14 +25,20 @@
*
* Contents:
*
* list_devices() - List all available USB devices to stdout.
* print_device() - Print a file to a USB device.
* main() - Send a file to the specified USB port.
* list_devices() - List all USB devices.
*/
/*
* Include necessary headers.
*/
#ifdef __APPLE__
/* A header order dependency requires this be first */
# include <ApplicationServices/ApplicationServices.h>
#endif /* __APPLE__ */
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
@@ -48,35 +54,79 @@
# include <termios.h>
#endif /* WIN32 */
#ifdef __linux
# include <sys/ioctl.h>
# include <linux/lp.h>
# define IOCNR_GET_DEVICE_ID 1
/*
* Get device_id string
*/
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
#endif /* __linux */
#ifdef __sun
# ifdef __sparc
# include <sys/ecppio.h>
# else
# include <sys/ecppsys.h>
# endif /* __sparc */
#endif /* __sun */
/*
* Local functions...
*/
void decode_device_id(int port, const char *device_id,
char *make_model, int mmsize,
char *uri, int urisize);
void list_devices(void);
int open_device(const char *uri);
int print_device(const char *uri, const char *hostname,
const char *resource, const char *options,
int fp, int copies);
/*
* Include the vendor-specific USB implementation...
*/
#ifdef __APPLE__
# include "usb-darwin.c"
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# include "usb-unix.c"
#else
/*
* Use dummy functions that do nothing on unsupported platforms...
* These can be used as templates for implementing USB printing on new
* platforms...
*/
/*
* 'list_devices()' - List all available USB devices to stdout.
*/
void
list_devices(void)
{
/*
* Don't have any devices to list... Use output of the form:
*
* direct usb:/make/model?serial=foo "Make Model" "USB Printer"
*
* Note that "Hewlett Packard" or any other variation MUST be mapped to
* "HP" for compatibility with the PPD and ICC specs.
*/
}
/*
* 'print_device()' - Print a file to a USB device.
*/
int /* O - Exit status */
print_device(const char *uri, /* I - Device URI */
const char *hostname, /* I - Hostname/manufacturer */
const char *resource, /* I - Resource/modelname */
const char *options, /* I - Device options/serial number */
int fp, /* I - File descriptor to print */
int copies) /* I - Copies to print */
{
/*
* Can't print, so just reference the arguments to eliminate compiler
* warnings and return and exit status of 1. Normally you would use the
* arguments to send a file to the printer and return 0 if everything
* worked OK and non-zero if there was an error.
*/
(void)uri;
(void)hostname;
(void)resource;
(void)options;
(void)fp;
(void)copies;
return (1);
}
#endif /* __APPLE__ */
/*
@@ -87,25 +137,23 @@ int open_device(const char *uri);
* printer-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
int fp; /* Print file */
int copies; /* Number of copies to print */
int fd; /* Parallel device */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct termios opts; /* Parallel port options */
int fp; /* Print file */
int copies; /* Number of copies to print */
int status; /* Exit status */
int port; /* Port number (not used) */
const char *uri; /* Device URI */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
#ifdef __linux
unsigned char status; /* Port status (off-line, out-of-paper, etc.) */
#endif /* __linux */
/*
@@ -139,10 +187,41 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
else if (argc < 6 || argc > 7)
{
fputs("Usage: USB job-id user title copies options [file]\n", stderr);
fputs("Usage: usb job-id user title copies options [file]\n", stderr);
return (1);
}
/*
* Extract the device name and options from the URI...
*/
if (strncmp(argv[0], "usb:", 4))
uri = getenv("DEVICE_URI");
else
uri = argv[0];
if (!uri)
{
fputs("ERROR: No device URI found in argv[0] or in DEVICE_URI environment variable!\n", stderr);
return (1);
}
httpSeparate(argv[0], method, username, hostname, &port, resource);
/*
* See if there are any options...
*/
if ((options = strchr(resource, '?')) != NULL)
{
/*
* Yup, terminate the device name string and move to the first
* character of the options...
*/
*options++ = '\0';
}
/*
* If we have 7 arguments, print the file named on the command-line.
* Otherwise, send stdin instead...
@@ -161,643 +240,28 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((fp = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
fprintf(stderr, "ERROR: unable to open print file %s - %s\n",
argv[6], strerror(errno));
return (1);
}
copies = atoi(argv[4]);
}
/*
* Open the USB port device...
*/
do
{
if ((fd = open_device(argv[0])) == -1)
{
if (errno == EBUSY)
{
fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else if (errno == ENXIO || errno == EIO || errno == ENOENT)
{
fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else
{
fprintf(stderr, "ERROR: Unable to open USB device \"%s\": %s\n",
argv[0], strerror(errno));
return (1);
}
}
}
while (fd < 0);
/*
* Set any options provided...
*/
tcgetattr(fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(fd, TCSANOW, &opts);
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
* current page... Only ignore SIGTERM if we are printing data from
* stdin (otherwise you can't cancel raw jobs...)
*/
if (argc < 7)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
}
#if defined(__linux) && defined(LP_POUTPA)
/*
* Show the printer status before we send the file; normally, we'd
* do this while we write data to the printer, however at least some
* Linux kernels have buggy USB drivers which don't like to be
* queried while sending data to the printer...
*
* Also, we're using the 8255 constants instead of the ones that are
* supposed to be used, as it appears that the USB driver also doesn't
* follow standards...
*/
if (ioctl(fd, LPGETSTATUS, &status) == 0)
{
fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
if (!(status & LP_POUTPA))
fputs("WARNING: Media tray empty!\n", stderr);
else if (!(status & LP_PERRORP))
fputs("WARNING: Printer fault!\n", stderr);
else if (!(status & LP_PSELECD))
fputs("WARNING: Printer off-line.\n", stderr);
}
#endif /* __linux && LP_POUTPA */
/*
* Finally, send the print file...
*/
while (copies > 0)
{
copies --;
if (fp != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(fp, 0, SEEK_SET);
}
tbytes = 0;
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
nbytes -= wbytes;
bufptr += wbytes;
}
if (wbytes < 0)
break;
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
}
}
status = print_device(uri, hostname, resource, options, fp, copies);
/*
* Close the socket connection and input file and return...
* Close the input file and return...
*/
close(fd);
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (0);
}
/*
* 'decode_device_id()' - Decode the IEEE-1284 device ID string.
*/
void
decode_device_id(int port, /* I - Port number */
const char *device_id, /* I - 1284 device ID string */
char *make_model, /* O - Make/model */
int mmsize, /* I - Size of buffer */
char *uri, /* O - Device URI */
int urisize) /* I - Size of buffer */
{
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*uriptr, /* Pointer into URI */
*mfg, /* Manufacturer string */
*mdl, /* Model string */
serial_number[1024]; /* Serial number string */
/*
* Look for the description field...
*/
if ((attr = strstr(device_id, "DES:")) != NULL)
attr += 4;
else if ((attr = strstr(device_id, "DESCRIPTION:")) != NULL)
attr += 12;
if ((mfg = strstr(device_id, "MANUFACTURER:")) != NULL)
mfg += 13;
else if ((mfg = strstr(device_id, "MFG:")) != NULL)
mfg += 4;
if ((mdl = strstr(device_id, "MODEL:")) != NULL)
mdl += 6;
else if ((mdl = strstr(device_id, "MDL:")) != NULL)
mdl += 4;
if (attr)
{
if (strncasecmp(attr, "Hewlett-Packard ", 16) == 0)
{
strlcpy(make_model, "HP ", mmsize);
strlcpy(make_model + 3, attr + 16, mmsize - 3);
}
else
{
strlcpy(make_model, attr, mmsize);
}
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
}
else if (mfg && mdl)
{
/*
* Build a make-model string from the manufacturer and model attributes...
*/
strlcpy(make_model, mfg, mmsize);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
strlcat(make_model, " ", mmsize);
strlcat(make_model, mdl, mmsize);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
}
else
{
/*
* Use "Unknown" as the printer make and model...
*/
strlcpy(make_model, "Unknown", mmsize);
}
/*
* Look for the serial number field...
*/
if ((attr = strstr(device_id, "SERN:")) != NULL)
attr += 5;
else if ((attr = strstr(device_id, "SERIALNUMBER:")) != NULL)
attr += 13;
if (attr)
{
strlcpy(serial_number, attr, sizeof(serial_number));
if ((delim = strchr(serial_number, ';')) != NULL)
*delim = '\0';
}
else
serial_number[0] = '\0';
/*
* Generate the device URI from the make_model and serial number strings.
*/
strlcpy(uri, "usb://", urisize);
for (uriptr = uri + 6, delim = make_model;
*delim && uriptr < (uri + urisize - 1);
delim ++)
if (*delim == ' ')
{
delim ++;
*uriptr++ = '/';
break;
}
else
*uriptr++ = *delim;
for (; *delim && uriptr < (uri + urisize - 3); delim ++)
if (*delim == ' ')
{
*uriptr++ = '%';
*uriptr++ = '2';
*uriptr++ = '0';
}
else
*uriptr++ = *delim;
*uriptr = '\0';
if (serial_number[0])
{
/*
* Add the serial number to the URI...
*/
strlcat(uri, "?serial=", urisize);
strlcat(uri, serial_number, urisize);
}
}
/*
* 'list_devices()' - List all USB devices.
*/
void
list_devices(void)
{
#ifdef __linux
int i; /* Looping var */
int length; /* Length of device ID info */
int fd; /* File descriptor */
char format[255], /* Format for device filename */
device[255], /* Device filename */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
/*
* First figure out which USB printer filename to use...
*/
if (access("/dev/usb/lp0", 0) == 0)
strcpy(format, "/dev/usb/lp%d");
else if (access("/dev/usb/usblp0", 0) == 0)
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usblp%d");
/*
* Then open each USB device...
*/
for (i = 0; i < 16; i ++)
{
sprintf(device, format, i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
if (ioctl(fd, LPIOC_GET_DEVICE_ID(sizeof(device_id)), device_id) == 0)
{
length = (((unsigned)device_id[0] & 255) << 8) +
((unsigned)device_id[1] & 255);
/*
* Check to see if the length is larger than our buffer; first
* assume that the vendor incorrectly implemented the 1284 spec,
* and then limit the length to the size of our buffer...
*/
if (length > (sizeof(device_id) - 2))
length = (((unsigned)device_id[1] & 255) << 8) +
((unsigned)device_id[0] & 255);
if (length > (sizeof(device_id) - 2))
length = sizeof(device_id) - 2;
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
else
device_id[0] = '\0';
close(fd);
}
else
device_id[0] = '\0';
if (device_id[0])
{
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
printf("direct %s \"%s\" \"USB Printer #%d\"\n", device_uri,
make_model, i + 1);
}
else
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
}
#elif defined(__sgi)
#elif defined(__sun)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
# ifdef ECPPIOC_GETDEVID
struct ecpp_device_id did; /* Device ID buffer */
# endif /* ECPPIOC_GETDEVID */
/*
* Open each USB device...
*/
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
# ifndef ECPPIOC_GETDEVID
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
# else
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
did.mode = ECPP_CENTRONICS;
did.len = sizeof(device_id);
did.rlen = 0;
did.addr = device_id;
if (ioctl(fd, ECPPIOC_GETDEVID, &did) == 0)
{
if (did.rlen < (sizeof(device_id) - 1))
device_id[did.rlen] = '\0';
else
device_id[sizeof(device_id) - 1] = '\0';
}
else
device_id[0] = '\0';
close(fd);
}
else
device_id[0] = '\0';
if (device_id[0])
{
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
printf("direct %s \"%s\" \"USB Printer #%d\"\n", device_uri,
make_model, i + 1);
}
else
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
# endif /* !ECPPIOC_GETDEVID */
}
#elif defined(__hpux)
#elif defined(__osf)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
int i; /* Looping var */
char device[255]; /* Device filename */
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/ulpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
sprintf(device, "/dev/unlpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d (no reset)\"\n", device, i + 1);
}
#endif
}
/*
* 'open_device()' - Open a USB device...
*/
int /* O - File descriptor or -1 on error */
open_device(const char *uri) /* I - Device URI */
{
/*
* The generic implementation just treats the URI as a device filename...
* Specific operating systems may also support using the device serial
* number and/or make/model.
*/
if (strncmp(uri, "usb:/dev/", 9) == 0)
return (open(uri + 4, O_RDWR | O_EXCL));
#ifdef __linux
else if (strncmp(uri, "usb://", 6) == 0)
{
/*
* For Linux, try looking up the device serial number or model...
*/
int i; /* Looping var */
int length; /* Length of device ID info */
int fd; /* File descriptor */
char format[255], /* Format for device filename */
device[255], /* Device filename */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
device_uri[1024]; /* Device URI string */
/*
* First figure out which USB printer filename to use...
*/
if (access("/dev/usb/lp0", 0) == 0)
strcpy(format, "/dev/usb/lp%d");
else if (access("/dev/usb/usblp0", 0) == 0)
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usblp%d");
/*
* Then find the correct USB device...
*/
for (i = 0; i < 16; i ++)
{
sprintf(device, format, i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
if (ioctl(fd, LPIOC_GET_DEVICE_ID(sizeof(device_id)), device_id) == 0)
{
length = (((unsigned)device_id[0] & 255) << 8) +
((unsigned)device_id[1] & 255);
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
else
device_id[0] = '\0';
}
else
device_id[0] = '\0';
if (device_id[0])
{
/*
* Got the device ID - is this the one?
*/
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
if (strcmp(uri, device_uri) == 0)
{
/*
* Yes, return this file descriptor...
*/
fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n", device);
return (fd);
}
}
/*
* This wasn't the one...
*/
close(fd);
}
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
else if (strncmp(uri, "usb://", 6) == 0)
{
/*
* For Solaris, try looking up the device serial number or model...
*/
int i; /* Looping var */
int fd; /* File descriptor */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
device_uri[1024]; /* Device URI string */
struct ecpp_device_id did; /* Device ID buffer */
/*
* Find the correct USB device...
*/
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
did.mode = ECPP_CENTRONICS;
did.len = sizeof(device_id);
did.rlen = 0;
did.addr = device_id;
if (ioctl(fd, ECPPIOC_GETDEVID, &did) == 0)
{
if (did.rlen < (sizeof(device_id) - 1))
device_id[did.rlen] = '\0';
else
device_id[sizeof(device_id) - 1] = '\0';
}
else
device_id[0] = '\0';
}
else
device_id[0] = '\0';
if (device_id[0])
{
/*
* Got the device ID - is this the one?
*/
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
if (strcmp(uri, device_uri) == 0)
return (fd); /* Yes, return this file descriptor... */
}
/*
* This wasn't the one...
*/
close(fd);
}
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#endif /* __linux */
else
{
errno = ENODEV;
return (-1);
}
return (status);
}
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Berkeley commands makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
+15 -11
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpc" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -99,18 +99,18 @@ main(int argc, /* I - Number of command-line arguments */
* Find any options in the string...
*/
while (isspace(line[0]))
while (isspace(line[0] & 255))
cups_strcpy(line, line + 1);
for (params = line; *params != '\0'; params ++)
if (isspace(*params))
if (isspace(*params & 255))
break;
/*
* Remove whitespace between the command and parameters...
*/
while (isspace(*params))
while (isspace(*params & 255))
*params++ = '\0';
/*
@@ -221,7 +221,8 @@ show_status(http_t *http, /* I - HTTP connection to server */
*jattr; /* Current job attribute */
cups_lang_t *language; /* Default language */
char *printer, /* Printer name */
*device; /* Device URI */
*device, /* Device URI */
*delimiter; /* Char search result */
ipp_pstate_t pstate; /* Printer state */
int accepting; /* Is printer accepting jobs? */
int jobcount; /* Count of current jobs */
@@ -351,7 +352,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Skip leading whitespace and commas...
*/
while (isspace(*dptr) || *dptr == ',')
while (isspace(*dptr & 255) || *dptr == ',')
dptr ++;
if (*dptr == '\0')
@@ -365,7 +366,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
ptr ++, dptr ++);
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr)))
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr & 255)))
{
match = 1;
break;
@@ -375,9 +376,9 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Skip trailing junk...
*/
while (!isspace(*dptr) && *dptr != '\0')
while (!isspace(*dptr & 255) && *dptr != '\0')
dptr ++;
while (isspace(*dptr) || *dptr == ',')
while (isspace(*dptr & 255) || *dptr == ',')
dptr ++;
if (*dptr == '\0')
@@ -454,8 +455,11 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Just show the method...
*/
*strchr(device, ':') = '\0';
printf("\tprinter is on device \'%s\' speed -1\n", device);
if ((delimiter = strchr(device, ':')) != NULL )
{
*delimiter = '\0';
printf("\tprinter is on device \'%s\' speed -1\n", device);
}
}
printf("\tqueuing is %sabled\n", accepting ? "en" : "dis");
+30 -8
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -69,6 +69,7 @@ main(int argc, /* I - Number of command-line arguments */
*user; /* Desired user */
char *instance; /* Printer instance */
int id, /* Desired job ID */
all, /* All printers */
interval, /* Reporting interval */
longstatus; /* Show file details */
int num_dests; /* Number of destinations */
@@ -98,13 +99,10 @@ main(int argc, /* I - Number of command-line arguments */
id = 0;
interval = 0;
longstatus = 0;
all = 0;
num_dests = cupsGetDests(&dests);
for (i = 0; i < num_dests; i ++)
if (dests[i].is_default)
dest = dests[i].name;
for (i = 1; i < argc; i ++)
if (argv[i][0] == '+')
interval = atoi(argv[i] + 1);
@@ -158,7 +156,7 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'a' : /* All printers */
dest = NULL;
all = 1;
break;
case 'l' : /* Long status */
@@ -173,11 +171,26 @@ main(int argc, /* I - Number of command-line arguments */
break;
}
}
else if (isdigit(argv[i][0]))
else if (isdigit(argv[i][0] & 255))
id = atoi(argv[i]);
else
user = argv[i];
if (dest == NULL && !all)
{
for (i = 0; i < num_dests; i ++)
if (dests[i].is_default)
dest = dests[i].name;
if (dest == NULL)
{
fputs("lpq: error - no default destination available.\n", stderr);
httpClose(http);
cupsFreeDests(num_dests, dests);
return (1);
}
}
/*
* Show the status in a loop...
*/
@@ -425,7 +438,16 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
strcpy(rankstr, "active");
else
{
snprintf(rankstr, sizeof(rankstr), "%d%s", rank, ranks[rank % 10]);
/*
* Make the rank show the "correct" suffix for each number
* (11-13 are the only special cases, for English anyways...)
*/
if ((rank % 100) >= 11 && (rank % 100) <= 13)
snprintf(rankstr, sizeof(rankstr), "%dth", rank);
else
snprintf(rankstr, sizeof(rankstr), "%d%s", rank, ranks[rank % 10]);
rank ++;
}
+6 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpr" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -321,10 +321,10 @@ main(int argc, /* I - Number of command-line arguments */
if (printer == NULL)
{
if (cupsLastError() >= IPP_BAD_REQUEST)
fputs("lpr: error - scheduler not responding!\n", stderr);
else
if (cupsLastError() == IPP_NOT_FOUND)
fputs("lpr: error - no default destination available.\n", stderr);
else
fputs("lpr: error - scheduler not responding!\n", stderr);
return (1);
}
@@ -372,7 +372,8 @@ main(int argc, /* I - Number of command-line arguments */
if ((temp = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
fputs("lpr: unable to create temporary file.\n", stderr);
fprintf(stderr, "lpr: unable to create temporary file \"%s\" - %s\n",
tempfile, strerror(errno));
return (1);
}
+3 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lprm" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -141,7 +141,8 @@ main(int argc, /* I - Number of command-line arguments */
* Cancel a job or printer...
*/
if (isdigit(argv[i][0]) && cupsGetDest(argv[i], NULL, num_dests, dests) == NULL)
if (isdigit(argv[i][0] & 255) &&
cupsGetDest(argv[i], NULL, num_dests, dests) == NULL)
{
dest = NULL;
op = IPP_CANCEL_JOB;
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
#
# CGI makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products.
# Copyright 1997-2004 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
+14 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Administration CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -119,6 +119,8 @@ main(int argc, /* I - Number of command-line arguments */
do_printer_op(http, language, CUPS_REJECT_JOBS);
else if (strcmp(op, "purge-jobs") == 0)
do_printer_op(http, language, IPP_PURGE_JOBS);
else if (strcmp(op, "set-as-default") == 0)
do_printer_op(http, language, CUPS_SET_DEFAULT);
else if (strcmp(op, "add-class") == 0)
do_am_class(http, language, 0);
else if (strcmp(op, "add-printer") == 0)
@@ -263,7 +265,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
if (*ptr || ptr == name || strlen(name) > 127)
{
cgiSetVariable("ERROR", "The class name may only contain up to 127 printable "
"characters.");
"characters and may not contain spaces.");
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
return;
}
@@ -574,7 +576,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
if (*ptr || ptr == name || strlen(name) > 127)
{
cgiSetVariable("ERROR", "The printer name may only contain up to 127 printable "
"characters.");
"characters and may not contain spaces.");
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
return;
}
@@ -961,7 +963,12 @@ do_config_printer(http_t *http, /* I - HTTP connection */
return;
}
ppd = ppdOpenFile(filename);
if ((ppd = ppdOpenFile(filename)) == NULL)
{
cgiSetVariable("ERROR", ippErrorString(IPP_DEVICE_ERROR));
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
return;
}
if (cgiGetVariable("job_sheets_start") != NULL ||
cgiGetVariable("job_sheets_end") != NULL)
@@ -1229,7 +1236,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */
strlcpy(keyword, line + 8, sizeof(keyword));
for (keyptr = keyword; *keyptr; keyptr ++)
if (*keyptr == ':' || isspace(*keyptr))
if (*keyptr == ':' || isspace(*keyptr & 255))
break;
*keyptr = '\0';
@@ -1540,6 +1547,8 @@ do_printer_op(http_t *http, /* I - HTTP connection */
cgiCopyTemplateLang(stdout, TEMPLATES, "printer-reject.tmpl", getenv("LANG"));
else if (op == IPP_PURGE_JOBS)
cgiCopyTemplateLang(stdout, TEMPLATES, "printer-purge.tmpl", getenv("LANG"));
else if (op == CUPS_SET_DEFAULT)
cgiCopyTemplateLang(stdout, TEMPLATES, "printer-default.tmpl", getenv("LANG"));
}
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI support library definitions.
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
+5 -31
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Class status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -128,38 +128,12 @@ main(int argc, /* I - Number of command-line arguments */
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
char method[HTTP_MAX_URI],
username[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
uri[HTTP_MAX_URI];
int port; /* URI data */
const char *server; /* Name of server */
char url[HTTP_MAX_URI]; /* New URL */
/*
* Map localhost access to localhost...
*/
server = getenv("SERVER_NAME");
httpSeparate(attr->values[0].string.text, method, username,
hostname, &port, resource);
if (strcasecmp(hostname, server) == 0 &&
(strcmp(getenv("REMOTE_HOST"), "127.0.0.1") == 0 ||
strcmp(getenv("REMOTE_HOST"), "localhost") == 0 ||
strcmp(getenv("REMOTE_HOST"), server) == 0))
strcpy(hostname, "localhost");
/*
* Rewrite URI with HTTP address...
*/
snprintf(uri, sizeof(uri), "http://%s:%d%s", hostname, port,
resource);
cgiSetVariable("DEFAULT_URI", uri);
cgiSetVariable("DEFAULT_URI",
ippRewriteURL(attr->values[0].string.text,
url, sizeof(url), NULL));
}
ippDelete(response);
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI HTML functions.
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
+152 -91
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP variable routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -26,6 +26,7 @@
* ippGetAttributes() - Get the list of attributes that are needed
* by the template file.
* ippGetTemplateDir() - Get the templates directory...
* ippRewriteURL() - Rewrite a printer URI into a web browser URL...
* ippSetServerVersion() - Set the server name and CUPS version...
* ippSetCGIVars() - Set CGI variables from an IPP response.
*/
@@ -66,7 +67,7 @@ ippGetAttributes(ipp_t *request, /* I - IPP request */
if (lang != NULL)
{
for (i = 0; lang[i] && i < 15; i ++)
if (isalnum(lang[i]))
if (isalnum(lang[i] & 255))
locale[i] = tolower(lang[i]);
else
locale[i] = '_';
@@ -127,6 +128,9 @@ ippGetAttributes(ipp_t *request, /* I - IPP request */
*nameptr = '\0';
if (!strncmp(name, "printer_state_history", 21))
strcpy(name, "printer_state_history");
/*
* Possibly add it to the list of attributes...
*/
@@ -185,6 +189,135 @@ ippGetTemplateDir(void)
}
/*
* 'ippRewriteURL()' - Rewrite a printer URI into a web browser URL...
*/
char * /* O - New URL */
ippRewriteURL(const char *uri, /* I - Current URI */
char *url, /* O - New URL */
int urlsize, /* I - Size of URL buffer */
const char *newresource) /* I - Replacement resource */
{
char method[HTTP_MAX_URI],
userpass[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
rawresource[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
/* URI components... */
*rawptr, /* Pointer into rawresource */
*resptr; /* Pointer into resource */
int port; /* Port number */
static int ishttps = -1; /* Using encryption? */
static const char *server; /* Name of server */
static char servername[1024];
/* Local server name */
static const char hexchars[] = "0123456789ABCDEF";
/* Hexadecimal conversion characters */
/*
* Check if we have been called before...
*/
if (ishttps < 0)
{
/*
* No, initialize static vars for the conversion...
*
* First get the server name associated with the client interface as
* well as the locally configured hostname. We'll check *both* of
* these to see if the printer URL is local...
*/
server = getenv("SERVER_NAME");
gethostname(servername, sizeof(servername));
/*
* Then flag whether we are using SSL on this connection...
*/
ishttps = getenv("HTTPS") != NULL;
}
/*
* Convert the URI to a URL...
*/
httpSeparate(uri, method, userpass, hostname, &port, rawresource);
if (strcmp(method, "ipp") == 0 ||
strcmp(method, "http") == 0)
{
if (newresource)
{
/*
* Force the specified resource name instead of the one in the URL...
*/
strlcpy(resource, newresource, sizeof(resource));
}
else
{
/*
* Rewrite the resource string so it doesn't contain any
* illegal chars...
*/
for (rawptr = rawresource, resptr = resource; *rawptr; rawptr ++)
if ((*rawptr & 128) || *rawptr == '%' || *rawptr == ' ' ||
*rawptr == '#' || *rawptr == '?' ||
*rawptr == '.') /* For MSIE */
{
if (resptr < (resource + sizeof(resource) - 3))
{
*resptr++ = '%';
*resptr++ = hexchars[(*rawptr >> 4) & 15];
*resptr++ = hexchars[*rawptr & 15];
}
}
else if (resptr < (resource + sizeof(resource) - 1))
*resptr++ = *rawptr;
*resptr = '\0';
}
/*
* Map local access to a local URI...
*/
if (strcasecmp(hostname, server) == 0 ||
strcasecmp(hostname, servername) == 0)
{
/*
* Make URI relative to the current server...
*/
strlcpy(url, resource, urlsize);
}
else
{
/*
* Rewrite URI with HTTP/HTTPS scheme...
*/
if (userpass[0])
snprintf(url, urlsize, "%s://%s@%s:%d%s",
ishttps ? "https" : "http",
userpass, hostname, port, resource);
else
snprintf(url, urlsize, "%s://%s:%d%s",
ishttps ? "https" : "http",
hostname, port, resource);
}
}
else
strlcpy(url, uri, urlsize);
return (url);
}
/*
* 'ippSetServerVersion()' - Set the server name and CUPS version...
*/
@@ -221,22 +354,7 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
*nameptr, /* Pointer into name */
value[16384], /* Value(s) */
*valptr; /* Pointer into value */
char method[HTTP_MAX_URI],
username[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
rawresource[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
uri[HTTP_MAX_URI],
*rawptr, /* Pointer into rawresource */
*resptr; /* Pointer into resource */
int port; /* URI data */
int ishttps; /* Using encryption? */
const char *server; /* Name of server */
char servername[1024];
/* Locale server name */
struct tm *date; /* Date information */
static const char hexchars[] = "0123456789ABCDEF";
/* Hexadecimal conversion characters */
DEBUG_printf(("<P>ippSetCGIVars(response=%p, filter_name=\"%s\", filter_value=\"%s\", prefix=\"%s\")\n",
@@ -249,21 +367,6 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
if (!prefix)
ippSetServerVersion();
/*
* Get the server name associated with the client interface as well as
* the locally configured hostname. We'll check *both* of these to
* see if the printer URL is local...
*/
server = getenv("SERVER_NAME");
gethostname(servername, sizeof(servername));
/*
* Flag whether we are using SSL on this connection...
*/
ishttps = getenv("HTTPS") != NULL;
/*
* Loop through the attributes and set them for the template...
*/
@@ -334,7 +437,7 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
* attribute...
*/
if (strcmp(name, "job_printer_uri") == 0)
if (!strcmp(name, "job_printer_uri"))
{
if ((valptr = strrchr(attr->values[0].string.text, '/')) == NULL)
valptr = "unknown";
@@ -344,6 +447,19 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
cgiSetArray("job_printer_name", element, valptr);
}
/*
* Add "admin_uri" variable if we have a "printer_uri_supported"
* attribute...
*/
if (!strcmp(name, "printer_uri_supported"))
{
ippRewriteURL(attr->values[0].string.text, value, sizeof(value),
"/admin/");
cgiSetArray("admin_uri", element, value);
}
/*
* Copy values...
*/
@@ -407,64 +523,9 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
* Rewrite URIs...
*/
httpSeparate(attr->values[i].string.text, method, username,
hostname, &port, rawresource);
if (strcmp(method, "ipp") == 0 ||
strcmp(method, "http") == 0)
{
/*
* Rewrite the resource string so it doesn't contain any
* illegal chars...
*/
for (rawptr = rawresource, resptr = resource; *rawptr;)
if (*rawptr & 128 || *rawptr == '%' || *rawptr == ' ')
{
if (resptr < (resource + sizeof(resource) - 3))
{
*resptr++ = '%';
*resptr++ = hexchars[(*rawptr >> 4) & 15];
*resptr++ = hexchars[*rawptr & 15];
}
}
else if (resptr < (resource + sizeof(resource) - 1))
*resptr++ = *rawptr++;
*resptr = '\0';
/*
* Map local access to a local URI...
*/
if (strcasecmp(hostname, server) == 0 ||
strcasecmp(hostname, servername) == 0)
{
/*
* Make URI relative to the current server...
*/
strlcpy(uri, resource, sizeof(uri));
}
else
{
/*
* Rewrite URI with HTTP address...
*/
if (username[0])
snprintf(uri, sizeof(uri), "%s://%s@%s:%d%s",
ishttps ? "https" : "http",
username, hostname, port, resource);
else
snprintf(uri, sizeof(uri), "%s://%s:%d%s",
ishttps ? "https" : "http",
hostname, port, resource);
}
strlcat(valptr, uri, sizeof(value) - (valptr - value));
break;
}
ippRewriteURL(attr->values[i].string.text, valptr,
sizeof(value) - (valptr - value), NULL);
break;
}
case IPP_TAG_STRING :
+2 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP variable definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -47,6 +47,7 @@
extern void ippGetAttributes(ipp_t *request, const char *directory,
const char *tmpl, const char *lang);
extern char *ippGetTemplateDir(void);
extern char *ippRewriteURL(const char *, char *, int, const char *);
extern void ippSetServerVersion(void);
extern void ippSetCGIVars(ipp_t *, const char *, const char *,
const char *, int);
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Job status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
+5 -31
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Printer status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -129,38 +129,12 @@ main(int argc, /* I - Number of command-line arguments */
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
char method[HTTP_MAX_URI],
username[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
uri[HTTP_MAX_URI];
int port; /* URI data */
const char *server; /* Name of server */
char url[HTTP_MAX_URI]; /* New URL */
/*
* Map localhost access to localhost...
*/
server = getenv("SERVER_NAME");
httpSeparate(attr->values[0].string.text, method, username,
hostname, &port, resource);
if (strcasecmp(hostname, server) == 0 &&
(strcmp(getenv("REMOTE_HOST"), "127.0.0.1") == 0 ||
strcmp(getenv("REMOTE_HOST"), "localhost") == 0 ||
strcmp(getenv("REMOTE_HOST"), server) == 0))
strcpy(hostname, "localhost");
/*
* Rewrite URI with HTTP address...
*/
snprintf(uri, sizeof(uri), "http://%s:%d%s", hostname, port,
resource);
cgiSetVariable("DEFAULT_URI", uri);
cgiSetVariable("DEFAULT_URI",
ippRewriteURL(attr->values[0].string.text,
url, sizeof(url), NULL));
}
ippDelete(response);
+7 -7
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI template function.
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -96,7 +96,7 @@ cgiCopyTemplateLang(FILE *out, /* I - Output file */
if (lang != NULL)
{
for (i = 0; lang[i] && i < 15; i ++)
if (isalnum(lang[i]))
if (isalnum(lang[i] & 255))
locale[i] = tolower(lang[i]);
else
locale[i] = '_';
@@ -189,7 +189,7 @@ cgi_copy(FILE *out, /* I - Output file */
*s = '\0';
if (s == name && isspace(ch))
if (s == name && isspace(ch & 255))
{
if (out)
{
@@ -210,7 +210,7 @@ cgi_copy(FILE *out, /* I - Output file */
* Insert value only if it exists...
*/
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1]))
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
{
*nameptr++ = '\0';
@@ -254,7 +254,7 @@ cgi_copy(FILE *out, /* I - Output file */
int count; /* Number of elements */
if (isdigit(name[1]))
if (isdigit(name[1] & 255))
count = atoi(name + 1);
else
count = cgiGetSize(name + 1);
@@ -280,7 +280,7 @@ cgi_copy(FILE *out, /* I - Output file */
* Insert variable or variable name (if element is NULL)...
*/
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1]))
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
{
*nameptr++ = '\0';
if ((value = cgiGetArray(name, atoi(nameptr) - 1)) == NULL)
@@ -367,7 +367,7 @@ cgi_copy(FILE *out, /* I - Output file */
if (innername[0] == '#')
sprintf(s, "%d", cgiGetSize(innername + 1));
else if ((innerptr = strrchr(innername, '-')) != NULL &&
isdigit(innerptr[1]))
isdigit(innerptr[1] & 255))
{
*innerptr++ = '\0';
if ((innerval = cgiGetArray(innername, atoi(innerptr) - 1)) == NULL)
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI form variable and array functions.
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -622,7 +622,7 @@ cgi_initialize_string(const char *data) /* I - Form data string */
* Add the string to the variable "database"...
*/
if ((s = strrchr(name, '-')) != NULL && isdigit(s[1]))
if ((s = strrchr(name, '-')) != NULL && isdigit(s[1] & 255))
{
*s++ = '\0';
if (value[0])
+4 -4
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Configuration file makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1993-2003 by Easy Software Products.
# Copyright 1993-2004 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -67,7 +67,7 @@ install:
done
-if test x$(PAMDIR) != x$(BUILDROOT); then \
$(INSTALL_DIR) $(PAMDIR); \
$(INSTALL_DATA) pam.conf $(PAMDIR)/cups; \
$(INSTALL_DATA) $(PAMFILE) $(PAMDIR)/cups; \
fi
+3 -3
Ver Arquivo
@@ -1,10 +1,10 @@
#
# "$Id: classes.conf 3041 2002-12-17 19:00:27Z swdev $"
# "$Id: classes.conf 4088 2004-02-25 20:15:27Z mike $"
#
# Sample class configuration file for the Common UNIX Printing System
# (CUPS) scheduler.
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -85,5 +85,5 @@
#</Class>
#
# End of "$Id: classes.conf 3041 2002-12-17 19:00:27Z swdev $".
# End of "$Id: classes.conf 4088 2004-02-25 20:15:27Z mike $".
#
+3 -3
Ver Arquivo
@@ -1,10 +1,10 @@
#
# "$Id: client.conf 3705 2003-05-09 19:14:44Z mike $"
# "$Id: client.conf 4088 2004-02-25 20:15:27Z mike $"
#
# Sample client configuration file for the Common UNIX Printing System
# (CUPS).
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -63,5 +63,5 @@
#
# End of "$Id: client.conf 3705 2003-05-09 19:14:44Z mike $".
# End of "$Id: client.conf 4088 2004-02-25 20:15:27Z mike $".
#
+23 -3
Ver Arquivo
@@ -4,7 +4,7 @@
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler.
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -296,6 +296,22 @@ LogLevel info
#ServerRoot @CUPS_SERVERROOT@
#
# ServerTokens: specifies what information in provided in the Server
# header of HTTP responses. The default is Minor.
#
# ServerTokens None
# ServerTokens ProductOnly CUPS
# ServerTokens Major CUPS/1
# ServerTokens Minor CUPS/1.1
# ServerTokens Minimal CUPS/@CUPS_VERSION@
# ServerTokens OS CUPS/@CUPS_VERSION@ (uname)
# ServerTokens Full CUPS/@CUPS_VERSION@ (uname) IPP/1.1
#
#ServerTokens Minor
########
######## Fax Support
########
@@ -402,6 +418,10 @@ LogLevel info
# for encryption. If you want to support web-based encryption you'll
# probably need to listen on port 443 (the "https" port...)
#
# NOTE 2: In order for the command-line and web interfaces to work, you
# must have at least one Port or Listen line that allows access from the
# local loopback address (localhost).
#
#Port 80
#Port 443
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id: mime.convs 3709 2003-05-12 17:38:18Z mike $"
# "$Id: mime.convs 4087 2004-02-25 20:14:54Z mike $"
#
# MIME converts file for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products.
# Copyright 1997-2004 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -114,5 +114,5 @@ image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
#application/octet-stream application/vnd.cups-raw 0 -
#
# End of "$Id: mime.convs 3709 2003-05-12 17:38:18Z mike $".
# End of "$Id: mime.convs 4087 2004-02-25 20:14:54Z mike $".
#
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id: mime.types 3564 2003-04-07 18:03:28Z mike $"
# "$Id: mime.types 4087 2004-02-25 20:14:54Z mike $"
#
# MIME types file for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products.
# Copyright 1997-2004 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -157,5 +157,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
#application/octet-stream
#
# End of "$Id: mime.types 3564 2003-04-07 18:03:28Z mike $".
# End of "$Id: mime.types 4087 2004-02-25 20:14:54Z mike $".
#
+7
Ver Arquivo
@@ -0,0 +1,7 @@
# cups: auth account password session
auth sufficient pam_securityserver.so
auth sufficient pam_unix.so
auth required pam_deny.so
account required pam_permit.so
password required pam_deny.so
session required pam_permit.so
Ver Arquivo
+3 -3
Ver Arquivo
@@ -1,10 +1,10 @@
#
# "$Id: printers.conf 3041 2002-12-17 19:00:27Z swdev $"
# "$Id: printers.conf 4088 2004-02-25 20:15:27Z mike $"
#
# Sample printer configuration file for the Common UNIX Printing System
# (CUPS) scheduler.
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -92,5 +92,5 @@
#</Printer>
#
# End of "$Id: printers.conf 3041 2002-12-17 19:00:27Z swdev $".
# End of "$Id: printers.conf 4088 2004-02-25 20:15:27Z mike $".
#
+24 -13
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-common.m4 3940 2003-09-17 19:35:22Z mike $"
dnl "$Id: cups-common.m4 4374 2004-08-19 13:54:38Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -29,9 +29,10 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number information...
CUPS_VERSION="1.1.20rc2"
CUPS_VERSION="1.1.21rc2"
AC_SUBST(CUPS_VERSION)
AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION")
AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION")
dnl Default compiler flags...
CFLAGS="${CFLAGS:=}"
@@ -55,9 +56,9 @@ AC_PATH_PROG(HTMLDOC,htmldoc)
AC_PATH_PROG(LN,ln)
AC_PATH_PROG(MV,mv)
AC_PATH_PROG(NROFF,nroff)
if test "$NROFF" = ""; then
if test "x$NROFF" = x; then
AC_PATH_PROG(GROFF,groff)
if test "$GROFF" = ""; then
if test "x$GROFF" = x; then
NROFF="echo"
else
NROFF="$GROFF -T ascii"
@@ -117,6 +118,7 @@ dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
@@ -137,7 +139,7 @@ dnl Check OS version and use appropriate format string for strftime...
AC_MSG_CHECKING(for correct format string to use with strftime)
case "$uname" in
IRIX* | SunOS*)
IRIX | SunOS*)
# IRIX and SunOS
AC_MSG_RESULT(NULL)
AC_DEFINE(CUPS_STRFTIME_FORMAT, NULL)
@@ -152,13 +154,22 @@ esac
dnl Checks for mkstemp and mkstemps functions.
AC_CHECK_FUNCS(mkstemp mkstemps)
dnl Checks for vsyslog function.
dnl Check for geteuid function.
AC_CHECK_FUNCS(geteuid)
dnl Check for vsyslog function.
AC_CHECK_FUNCS(vsyslog)
dnl Checks for signal functions.
if test "$uname" != "Linux"; then
AC_CHECK_FUNCS(sigset)
fi
case "$uname" in
Linux | GNU)
# Do not use sigset on Linux or GNU HURD
;;
*)
# Use sigset on other platforms, if available
AC_CHECK_FUNCS(sigset)
;;
esac
AC_CHECK_FUNCS(sigaction)
@@ -202,5 +213,5 @@ AC_SUBST(BACKLIBS)
AC_SUBST(COMMONLIBS)
dnl
dnl End of "$Id: cups-common.m4 3940 2003-09-17 19:35:22Z mike $".
dnl End of "$Id: cups-common.m4 4374 2004-08-19 13:54:38Z mike $".
dnl
+6 -6
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-compiler.m4 3874 2003-08-20 18:27:48Z mike $"
dnl "$Id: cups-compiler.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -119,7 +119,7 @@ else
OPTIM="+z $OPTIM"
fi
;;
IRIX*)
IRIX)
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
OPTIM="-O2"
@@ -202,5 +202,5 @@ if test $uname = HP-UX; then
fi
dnl
dnl End of "$Id: cups-compiler.m4 3874 2003-08-20 18:27:48Z mike $".
dnl End of "$Id: cups-compiler.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+8 -8
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-directories.m4 3041 2002-12-17 19:00:27Z swdev $"
dnl "$Id: cups-directories.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Directory stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -115,8 +115,8 @@ if test x$rcdir = x; then
INITDDIR="/System/Library/StartupItems/PrintingServices"
;;
Linux*)
# Linux seems to choose an init.d directory at random...
Linux | GNU)
# Linux/HURD seems to choose an init.d directory at random...
if test -d /sbin/init.d; then
# SuSE
INITDIR="/sbin/init.d"
@@ -197,7 +197,7 @@ AC_SUBST(CUPS_REQUESTS)
dnl Set the CUPS_LOCALE directory...
case "$uname" in
Linux* | *BSD* | Darwin*)
Linux | GNU | *BSD* | Darwin*)
CUPS_LOCALEDIR="$datadir/locale"
AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$datadir/locale")
;;
@@ -238,5 +238,5 @@ AC_SUBST(CUPS_FONTPATH)
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$fontpath")
dnl
dnl End of "$Id: cups-directories.m4 3041 2002-12-17 19:00:27Z swdev $".
dnl End of "$Id: cups-directories.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-image.m4 3041 2002-12-17 19:00:27Z swdev $"
dnl "$Id: cups-image.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl Image library stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -78,5 +78,5 @@ AC_SUBST(EXPORT_LIBZ)
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
dnl
dnl End of "$Id: cups-image.m4 3041 2002-12-17 19:00:27Z swdev $".
dnl End of "$Id: cups-image.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-libtool.m4 3041 2002-12-17 19:00:27Z swdev $"
dnl "$Id: cups-libtool.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl Libtool stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -45,5 +45,5 @@ if test x$LIBTOOL != x; then
fi
dnl
dnl End of "$Id: cups-libtool.m4 3041 2002-12-17 19:00:27Z swdev $".
dnl End of "$Id: cups-libtool.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+8 -8
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-manpages.m4 3041 2002-12-17 19:00:27Z swdev $"
dnl "$Id: cups-manpages.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -25,13 +25,13 @@ dnl
dnl Fix "mandir" variable...
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
case "$uname" in
Darwin* | Linux* | *BSD* | AIX*)
# Darwin, MacOS X, Linux, *BSD, and AIX
Darwin* | Linux | GNU | *BSD* | AIX*)
# Darwin, MacOS X, Linux, GNU HURD, *BSD, and AIX
mandir="/usr/share/man"
AMANDIR="/usr/share/man"
PMANDIR="/usr/share/man"
;;
IRIX*)
IRIX)
# SGI IRIX
mandir="/usr/share/catman/u_man"
AMANDIR="/usr/share/catman/a_man"
@@ -100,5 +100,5 @@ AC_SUBST(MAN8EXT)
AC_SUBST(MAN8DIR)
dnl
dnl End of "$Id: cups-manpages.m4 3041 2002-12-17 19:00:27Z swdev $".
dnl End of "$Id: cups-manpages.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-network.m4 3888 2003-08-28 15:16:08Z mike $"
dnl "$Id: cups-network.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl Networking stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -55,5 +55,5 @@ AC_ARG_WITH(maxfiles, [ --with-maxfiles=N set maximum number of file desc
AC_DEFINE_UNQUOTED(CUPS_MAX_FDS, $maxfiles)
dnl
dnl End of "$Id: cups-network.m4 3888 2003-08-28 15:16:08Z mike $".
dnl End of "$Id: cups-network.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-openslp.m4 3041 2002-12-17 19:00:27Z swdev $"
dnl "$Id: cups-openslp.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -44,5 +44,5 @@ AC_SUBST(LIBSLP)
dnl
dnl End of "$Id: cups-openslp.m4 3041 2002-12-17 19:00:27Z swdev $".
dnl End of "$Id: cups-openslp.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-openssl.m4 3940 2003-09-17 19:35:22Z mike $"
dnl "$Id: cups-openssl.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -108,5 +108,5 @@ AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-openssl.m4 3940 2003-09-17 19:35:22Z mike $".
dnl End of "$Id: cups-openssl.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+16 -8
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-opsys.m4 3929 2003-09-15 20:32:12Z mike $"
dnl "$Id: cups-opsys.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Operating system stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -25,9 +25,17 @@ dnl
dnl Get the operating system and version number...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
if test x$uname = xIRIX64; then
uname="IRIX"
fi
case "$uname" in
GNU* | GNU/*)
uname="GNU"
;;
IRIX*)
uname="IRIX"
;;
Linux*)
uname="Linux"
;;
esac
dnl Determine the correct username and group for this OS...
AC_ARG_WITH(cups-user, [ --with-cups-user set default user for CUPS],
@@ -87,5 +95,5 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USER, "$CUPS_USER")
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GROUP, "$CUPS_GROUP")
dnl
dnl "$Id: cups-opsys.m4 3929 2003-09-15 20:32:12Z mike $"
dnl "$Id: cups-opsys.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
+38 -15
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pam.m4 3041 2002-12-17 19:00:27Z swdev $"
dnl "$Id: cups-pam.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl PAM stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -30,6 +30,7 @@ if test $uname = AIX; then
fi
PAMDIR=""
PAMFILE=""
PAMLIBS=""
PAMMOD="pam_unknown.so"
@@ -41,31 +42,53 @@ if test x$enable_pam != xno; then
AC_CHECK_HEADER(pam/pam_appl.h,AC_DEFINE(HAVE_PAM_PAM_APPL_H))
if test x$ac_cv_lib_pam_pam_start != xno; then
# Set the necessary libraries for PAM...
if test x$ac_cv_lib_dl_dlopen != xno; then
PAMLIBS="-lpam -ldl"
else
PAMLIBS="-lpam"
fi
if test -d /etc/pam.d; then
PAMDIR="/etc/pam.d"
fi
# Find the PAM configuration directory, if any...
for dir in /private/etc/pam.d /etc/pam.d; do
if test -d $dir; then
PAMDIR=$dir
break;
fi
done
fi
LIBS="$SAVELIBS"
# This test might need to be updated as Linux distributors move
# things around...
for mod in pam_unix2.so pam_unix.so pam_pwdb.so; do
if test -f /lib/security/$mod; then
PAMMOD="$mod"
fi
done
case "$uname" in
Darwin*)
# Darwin, MacOS X
PAMFILE="pam.darwin"
;;
IRIX)
# SGI IRIX
PAMFILE="pam.irix"
;;
*)
# All others; this test might need to be updated
# as Linux distributors move things around...
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
PAMFILE="pam.std"
;;
esac
fi
AC_SUBST(PAMDIR)
AC_SUBST(PAMFILE)
AC_SUBST(PAMLIBS)
AC_SUBST(PAMMOD)
dnl
dnl End of "$Id: cups-pam.m4 3041 2002-12-17 19:00:27Z swdev $".
dnl End of "$Id: cups-pam.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-scripting.m4 3472 2003-03-14 17:04:09Z mike $"
dnl "$Id: cups-scripting.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl Scripting configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -87,5 +87,5 @@ if test "x$CUPS_PYTHON" != x; then
fi
dnl
dnl End of "$Id: cups-scripting.m4 3472 2003-03-14 17:04:09Z mike $".
dnl End of "$Id: cups-scripting.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+9 -9
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-sharedlibs.m4 3826 2003-07-23 20:07:35Z mike $"
dnl "$Id: cups-sharedlibs.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Shared library support for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -41,13 +41,13 @@ if test x$enable_shared != xno; then
DSO="ld"
DSOFLAGS="$DSOFLAGS -b -z +h \$@"
;;
IRIX*)
IRIX)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi2.5,-soname,\$@ -shared \$(OPTIM)"
;;
OSF1* | Linux* | *BSD*)
OSF1* | Linux | GNU | *BSD*)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
@@ -135,8 +135,8 @@ if test "$DSO" != ":"; then
LDFLAGS="$LDFLAGS -Wl,-R$libdir"
EXPORT_LDFLAGS="-Wl,-R$libdir"
;;
Linux*)
# Linux
Linux | GNU)
# Linux and HURD
DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
@@ -152,5 +152,5 @@ AC_SUBST(IMGLIBS)
AC_SUBST(EXPORT_LDFLAGS)
dnl
dnl End of "$Id: cups-sharedlibs.m4 3826 2003-07-23 20:07:35Z mike $".
dnl End of "$Id: cups-sharedlibs.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+30 -3
Ver Arquivo
@@ -5,7 +5,7 @@
*
* @configure_input@
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -17,18 +17,22 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*/
#ifndef _CUPS_CONFIG_H_
#define _CUPS_CONFIG_H_
/*
* Version of software...
*/
#define CUPS_SVERSION "CUPS v1.1.19rc3"
#define CUPS_SVERSION "CUPS v1.1.21"
#define CUPS_MINIMAL "CUPS/1.1.21"
/*
@@ -139,6 +143,13 @@
#undef HAVE_STRLCPY
/*
* Do we have the geteuid() function?
*/
#undef HAVE_GETEUID
/*
* Do we have the vsyslog() function?
*/
@@ -178,6 +189,13 @@
#undef HAVE_MALLOC_H
/*
* Do we have the langinfo.h header file?
*/
#undef HAVE_LANGINFO_H
/*
* Which encryption libraries do we have?
*/
@@ -259,6 +277,13 @@
#undef HAVE_STRUCT_SOCKADDR_SA_LEN
/*
* Do we have the AIX usersec.h header file?
*/
#undef HAVE_USERSEC_H
/*
* Various scripting languages...
*/
@@ -273,6 +298,8 @@
#define CUPS_PYTHON "/usr/bin/python"
#endif /* !_CUPS_CONFIG_H_ */
/*
* End of "$Id$".
*/
+4 -4
Ver Arquivo
@@ -3,7 +3,7 @@ dnl "$Id$"
dnl
dnl Configuration script for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2003 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -41,7 +41,7 @@ sinclude(config-scripts/cups-pam.m4)
sinclude(config-scripts/cups-scripting.m4)
AC_OUTPUT(Makedefs cups.list cups.sh cups-config conf/cupsd.conf conf/pam.conf)
AC_OUTPUT(Makedefs cups.list cups.sh cups-config conf/cupsd.conf conf/pam.std)
chmod +x cups-config
+3 -3
Ver Arquivo
@@ -4,7 +4,7 @@
#
# CUPS configuration utility.
#
# Copyright 2001-2003 by Easy Software Products, all rights reserved.
# Copyright 2001-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
+1 -100
Ver Arquivo
@@ -3,106 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
Project: "cups"=.\cups\cups.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "enumports"=.\visualc\enumports.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "fltk"="..\fltk-1.1\visualc\fltk.lib.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "fltkimages"="..\fltk-1.1\visualc\fltkimages.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "gui"=.\gui\gui.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "printers"=.\gui\printers.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name cups
End Project Dependency
Begin Project Dependency
Project_Dep_Name fltk
End Project Dependency
Begin Project Dependency
Project_Dep_Name gui
End Project Dependency
Begin Project Dependency
Project_Dep_Name fltkimages
End Project Dependency
Begin Project Dependency
Project_Dep_Name zlib
End Project Dependency
}}}
###############################################################################
Project: "restartspooler"=.\visualc\restartspooler.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "zlib"="..\htmldoc-1.8\visualc\zlib.dsp" - Package Owner=<4>
Project: "cups"=".\cups\cups.dsp" - Package Owner=<4>
Package=<5>
{{{
+24 -19
Ver Arquivo
@@ -4,7 +4,7 @@
# ESP Package Manager (EPM) file list for the Common UNIX Printing
# System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -16,16 +16,16 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
# Product information
%product Common UNIX Printing System
%copyright 1993-2003 by Easy Software Products, All Rights Reserved.
%copyright 1993-2004 by Easy Software Products, All Rights Reserved.
%vendor Easy Software Products
%license LICENSE.txt
%readme README.txt
@@ -151,11 +151,14 @@ f 0555 root sys $SERVERBIN/filter/rastertohp filter/rastertohp
f 0555 root sys $SERVERBIN/filter/texttops filter/texttops
# Admin commands
d 0555 root sys $BINDIR -
l 0555 root sys $BINDIR/disable $SBINDIR/accept
l 0555 root sys $BINDIR/enable $SBINDIR/accept
l 0555 root sys $LIBDIR/accept $SBINDIR/accept
d 0555 root sys $LIBDIR -
l 0555 root sys $LIBDIR/lpadmin $SBINDIR/lpadmin
l 0555 root sys $LIBDIR/reject accept
d 0555 root sys $SBINDIR -
f 0555 root sys $SBINDIR/accept systemv/accept
f 0555 root sys $SBINDIR/cupsaddsmb systemv/cupsaddsmb
f 0555 root sys $SBINDIR/lpadmin systemv/lpadmin
@@ -280,9 +283,15 @@ f 0444 root sys $DATADIR/model ppd/*.ppd
d 0555 root sys $DATADIR/templates -
c 0444 root sys $DATADIR/templates templates/*.tmpl
d 0555 root sys $DATADIR/templates/be -
c 0444 root sys $DATADIR/templates/be templates/be/*.tmpl
d 0555 root sys $DATADIR/templates/de -
c 0444 root sys $DATADIR/templates/de templates/de/*.tmpl
d 0555 root sys $DATADIR/templates/es -
c 0444 root sys $DATADIR/templates/es templates/es/*.tmpl
d 0555 root sys $DATADIR/templates/fr -
c 0444 root sys $DATADIR/templates/fr templates/fr/*.tmpl
@@ -297,17 +306,7 @@ c 0600 root sys $SERVERROOT/mime.types conf/mime.types
%if PAMDIR
d 0555 root sys $PAMDIR -
%system linux
# Linux almost always supports PAM...
c 0644 root sys $PAMDIR/cups conf/pam.conf
%system irix
# IRIX doesn't normally support PAM, but the freeware project
# includes a version of PAM that can be used...
c 0644 root sys $PAMDIR/cups conf/pam.irix
%system all
c 0644 root sys $PAMDIR/cups conf/@PAMFILE@
%endif
# Developer files
@@ -331,10 +330,18 @@ f 0444 root sys $DOCDIR doc/*.css
f 0444 root sys $DOCDIR doc/*.html
f 0444 root sys $DOCDIR doc/*.pdf
f 0444 root sys $DOCDIR/robots.txt doc/robots.txt
d 0555 root sys $DOCDIR/be -
f 0444 root sys $DOCDIR/be doc/be/*.css
f 0444 root sys $DOCDIR/be doc/be/*.html
f 0444 root sys $DOCDIR/be doc/be/*.pdf
d 0555 root sys $DOCDIR/de -
f 0444 root sys $DOCDIR/de doc/de/*.css
f 0444 root sys $DOCDIR/de doc/de/*.html
f 0444 root sys $DOCDIR/de doc/de/*.pdf
d 0555 root sys $DOCDIR/es -
f 0444 root sys $DOCDIR/es doc/es/*.css
f 0444 root sys $DOCDIR/es doc/es/*.html
f 0444 root sys $DOCDIR/es doc/es/*.pdf
d 0555 root sys $DOCDIR/fr -
f 0444 root sys $DOCDIR/fr doc/fr/*.css
f 0444 root sys $DOCDIR/fr doc/fr/*.html
@@ -356,6 +363,7 @@ d 0555 root sys $PMANDIR/cat3 -
d 0555 root sys $PMANDIR/man3 -
f 0444 root sys $MANDIR/cat1/backend.$CAT1EXT man/backend.$CAT1EXT
f 0444 root sys $MANDIR/cat1/cups-config.$CAT1EXT man/cups-config.$CAT1EXT
f 0444 root sys $MANDIR/cat1/cupstestppd.$CAT1EXT man/cupstestppd.$CAT1EXT
f 0444 root sys $MANDIR/cat1/filter.$CAT1EXT man/filter.$CAT1EXT
f 0444 root sys $MANDIR/cat1/lpoptions.$CAT1EXT man/lpoptions.$CAT1EXT
@@ -367,8 +375,6 @@ f 0444 root sys $MANDIR/cat1/lpstat.$CAT1EXT man/lpstat.$CAT1EXT
f 0444 root sys $MANDIR/cat1/lp.$CAT1EXT man/lp.$CAT1EXT
l 0444 root sys $MANDIR/cat1/cancel.$CAT1EXT lp.$CAT1EXT
f 0444 root sys $PMANDIR/cat3/cups-config.$CAT3EXT man/cups-config.$CAT3EXT
f 0444 root sys $MANDIR/cat5/classes.conf.$CAT5EXT man/classes.conf.$CAT5EXT
f 0444 root sys $MANDIR/cat5/cupsd.conf.$CAT5EXT man/cupsd.conf.$CAT5EXT
f 0444 root sys $MANDIR/cat5/mime.convs.$CAT5EXT man/mime.convs.$CAT5EXT
@@ -389,6 +395,7 @@ f 0444 root sys $AMANDIR/cat$MAN8DIR/lpinfo.$CAT8EXT man/lpinfo.$CAT8EXT
f 0444 root sys $AMANDIR/cat$MAN8DIR/lpmove.$CAT8EXT man/lpmove.$CAT8EXT
f 0444 root sys $MANDIR/man1/backend.1 man/backend.man
f 0444 root sys $MANDIR/man1/cups-config.1 man/cups-config.man
f 0444 root sys $MANDIR/man1/cupstestppd.1 man/cupstestppd.man
f 0444 root sys $MANDIR/man1/filter.1 man/filter.man
f 0444 root sys $MANDIR/man1/lpoptions.1 man/lpoptions.man
@@ -400,8 +407,6 @@ f 0444 root sys $MANDIR/man1/lpstat.1 man/lpstat.man
f 0444 root sys $MANDIR/man1/lp.1 man/lp.man
l 0444 root sys $MANDIR/man1/cancel.1 lp.1
f 0444 root sys $PMANDIR/man3/cups-config.3 man/cups-config.man
f 0444 root sys $MANDIR/man5/classes.conf.5 man/classes.conf.man
f 0444 root sys $MANDIR/man5/cupsd.conf.5 man/cupsd.conf.man
f 0444 root sys $MANDIR/man5/mime.convs.5 man/mime.convs.man
+3 -3
Ver Arquivo
@@ -4,7 +4,7 @@
#
# Startup/shutdown script for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
+54 -20
Ver Arquivo
@@ -1,11 +1,11 @@
#
# "$Id: cups.spec 3942 2003-09-17 19:36:31Z mike $"
# "$Id: cups.spec 4208 2004-06-29 03:14:19Z mike $"
#
# RPM "spec" file for the Common UNIX Printing System (CUPS).
#
# Original version by Jason McMullan <jmcc@ontv.com>.
#
# Copyright 1999-2003 by Easy Software Products, all rights reserved.
# Copyright 1999-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -17,16 +17,16 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
Summary: Common Unix Printing System
Name: cups
Version: 1.1.20rc2
Version: 1.1.21rc2
Release: 1
Copyright: GPL
Group: System Environment/Daemons
@@ -171,26 +171,62 @@ rm -rf $RPM_BUILD_ROOT
/usr/share/locale/*
%dir /usr/share/man/cat1
/usr/share/man/cat1/*
/usr/share/man/cat1/backend.1
/usr/share/man/cat1/cupstestppd.1
/usr/share/man/cat1/filter.1
/usr/share/man/cat1/lp.1
/usr/share/man/cat1/lpoptions.1
/usr/share/man/cat1/lppasswd.1
/usr/share/man/cat1/lpq.1
/usr/share/man/cat1/lpr.1
/usr/share/man/cat1/lprm.1
/usr/share/man/cat1/lpstat.1
%dir /usr/share/man/cat5
/usr/share/man/cat5/*
%dir /usr/share/man/cat8
/usr/share/man/cat8/*
%dir /usr/share/man/man1
/usr/share/man/man1/*
/usr/share/man/man1/backend.1.gz
/usr/share/man/man1/cupstestppd.1.gz
/usr/share/man/man1/filter.1.gz
/usr/share/man/man1/lp.1.gz
/usr/share/man/man1/lpoptions.1.gz
/usr/share/man/man1/lppasswd.1.gz
/usr/share/man/man1/lpq.1.gz
/usr/share/man/man1/lpr.1.gz
/usr/share/man/man1/lprm.1.gz
/usr/share/man/man1/lpstat.1.gz
%dir /usr/share/man/man5
/usr/share/man/man5/*
%dir /usr/share/man/man8
/usr/share/man/man8/*
%dir /usr/share/man/fr/cat1
/usr/share/man/fr/cat1/*
/usr/share/man/fr/cat1/backend.1
/usr/share/man/fr/cat1/cupstestppd.1
/usr/share/man/fr/cat1/filter.1
/usr/share/man/fr/cat1/lp.1
/usr/share/man/fr/cat1/lpoptions.1
/usr/share/man/fr/cat1/lppasswd.1
/usr/share/man/fr/cat1/lpq.1
/usr/share/man/fr/cat1/lpr.1
/usr/share/man/fr/cat1/lprm.1
/usr/share/man/fr/cat1/lpstat.1
%dir /usr/share/man/fr/cat5
/usr/share/man/fr/cat5/*
%dir /usr/share/man/fr/cat8
/usr/share/man/fr/cat8/*
%dir /usr/share/man/fr/man1
/usr/share/man/fr/man1/*
/usr/share/man/fr/man1/backend.1.gz
/usr/share/man/fr/man1/cupstestppd.1.gz
/usr/share/man/fr/man1/filter.1.gz
/usr/share/man/fr/man1/lp.1.gz
/usr/share/man/fr/man1/lpoptions.1.gz
/usr/share/man/fr/man1/lppasswd.1.gz
/usr/share/man/fr/man1/lpq.1.gz
/usr/share/man/fr/man1/lpr.1.gz
/usr/share/man/fr/man1/lprm.1.gz
/usr/share/man/fr/man1/lpstat.1.gz
%dir /usr/share/man/fr/man5
/usr/share/man/fr/man5/*
%dir /usr/share/man/fr/man8
@@ -200,24 +236,22 @@ rm -rf $RPM_BUILD_ROOT
%attr(1700,lp,root) %dir /var/spool/cups/tmp
%files devel
%dir /usr/share/man/cat1
/usr/share/man/cat1/cups-config.1
%dir /usr/share/man/fr/cat1
/usr/share/man/fr/cat1/cups-config.1
%dir /usr/share/man/man1
/usr/share/man/man1/cups-config.1.gz
%dir /usr/share/man/fr/man1
/usr/share/man/fr/man1/cups-config.1.gz
/usr/bin/cups-config
%dir /usr/include/cups
/usr/include/cups/*
/usr/lib/*.a
%dir /usr/share/man/cat3
/usr/share/man/cat3/*
%dir /usr/share/man/man3
/usr/share/man/man3/*
%dir /usr/share/man/fr/cat3
/usr/share/man/fr/cat3/*
%dir /usr/share/man/fr/man3
/usr/share/man/fr/man3/*
%files libs
/usr/lib/*.so*
#
# End of "$Id: cups.spec 3942 2003-09-17 19:36:31Z mike $".
# End of "$Id: cups.spec 4208 2004-06-29 03:14:19Z mike $".
#
+6 -6
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Support library Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2003 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -93,8 +93,8 @@ install: all installhdrs
fi
if test $(LIBCUPS) != "libcups.a"; then \
$(INSTALL_LIB) libcups.a $(LIBDIR); \
$(RANLIB) $(LIBDIR)/libcups.a; \
fi
$(RANLIB) $(LIBDIR)/libcups.a
installhdrs:
$(INSTALL_DIR) $(INCLUDEDIR)/cups
@@ -122,7 +122,7 @@ libcups.2.dylib: $(LIBOBJS) ../Makedefs
echo Linking $@...
$(DSO) $(DSOFLAGS) -o $@ \
-install_name $(libdir)/$@ \
-current_version 2.5.0 \
-current_version 2.7.0 \
-compatibility_version 2.0.0 \
$(LIBOBJS) $(SSLLIBS) $(COMMONLIBS)
$(RM) libcups.dylib
@@ -149,7 +149,7 @@ libcups_s.a: $(LIBOBJS) ../Makedefs
libcups.la: $(LIBOBJS) ../Makedefs
echo Linking $@...
$(DSO) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
-version-info 2:5 $(SSLLIBS) $(COMMONLIBS)
-version-info 2:7 $(SSLLIBS) $(COMMONLIBS)
#
+2 -2
Ver Arquivo
@@ -4,7 +4,7 @@
* PPD model-specific attribute routines for the Common UNIX Printing System
* (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -16,7 +16,7 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
+23 -12
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Authentication functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -75,6 +75,11 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
encode[512]; /* Encoded username:password */
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")\n",
http, method, resource));
DEBUG_printf(("cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"\n",
http->digest_tries, http->userpass));
/*
* Clear the current authentication string...
*/
@@ -86,14 +91,16 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
*/
if (!cups_local_auth(http))
{
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
return (0);
}
/*
* Nope, see if we should retry the current digest password...
* Nope, see if we should retry the current username:password...
*/
if (strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) == 0 ||
http->digest_tries > 1 || !http->userpass[0])
if (http->digest_tries > 1 || !http->userpass[0])
{
/*
* Nope - get a new password from the user...
@@ -102,7 +109,8 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
snprintf(prompt, sizeof(prompt), "Password for %s on %s? ", cupsUser(),
http->hostname);
http->digest_tries = 0;
http->digest_tries = strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],
"Basic", 5) == 0;
http->userpass[0] = '\0';
if ((password = cupsGetPassword(prompt)) == NULL)
@@ -114,14 +122,14 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(),
password);
}
else
else if (http->status == HTTP_UNAUTHORIZED)
http->digest_tries ++;
/*
* Got a password; encode it for the server...
*/
if (strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) == 0)
if (strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) == 0)
{
/*
* Basic authentication...
@@ -140,12 +148,15 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "nonce", nonce);
httpMD5(cupsUser(), realm, strchr(http->userpass, ':') + 1, encode);
httpMD5Final(nonce, "POST", resource, encode);
httpMD5Final(nonce, method, resource, encode);
snprintf(http->authstring, sizeof(http->authstring),
"Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", "
"response=\"%s\"", cupsUser(), realm, nonce, encode);
"uri=\"%s\", response=\"%s\"", cupsUser(), realm, nonce,
resource, encode);
}
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
return (0);
}
@@ -226,7 +237,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
snprintf(http->authstring, sizeof(http->authstring), "Local %s", certificate);
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
authstring));
http->authstring));
return (0);
#endif /* WIN32 || __EMX__ */
+8 -4
Ver Arquivo
@@ -85,6 +85,10 @@ LIB32=link.exe -lib
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\auth.c
# End Source File
# Begin Source File
SOURCE=.\dest.c
# End Source File
# Begin Source File
@@ -97,6 +101,10 @@ SOURCE=.\encode.c
# End Source File
# Begin Source File
SOURCE=.\getputfile.c
# End Source File
# Begin Source File
SOURCE=".\http-addr.c"
# End Source File
# Begin Source File
@@ -121,10 +129,6 @@ SOURCE=.\language.c
# End Source File
# Begin Source File
SOURCE=..\oemlicense\license.c
# End Source File
# Begin Source File
SOURCE=.\mark.c
# End Source File
# Begin Source File
+22 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* API definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -82,6 +82,7 @@ enum /* Not a typedef'd enum so we can OR */
CUPS_PRINTER_IMPLICIT = 0x10000, /* Implicit class */
CUPS_PRINTER_DEFAULT = 0x20000, /* Default printer on network */
CUPS_PRINTER_FAX = 0x40000, /* Fax queue */
CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */
CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT) */
};
@@ -180,6 +181,24 @@ extern http_status_t cupsPutFile(http_t *http, const char *resource,
const char *filename);
extern http_status_t cupsPutFd(http_t *http, const char *resource, int fd);
/**** New in CUPS 1.1.21 ****/
extern const char *cupsGetDefault2(http_t *http);
extern int cupsGetDests2(http_t *http, cups_dest_t **dests);
extern int cupsGetJobs2(http_t *http, cups_job_t **jobs,
const char *dest, int myjobs,
int completed);
extern const char *cupsGetPPD2(http_t *http, const char *printer);
extern int cupsPrintFile2(http_t *http, const char *printer,
const char *filename,
const char *title, int num_options,
cups_option_t *options);
extern int cupsPrintFiles2(http_t *http, const char *printer,
int num_files, const char **files,
const char *title, int num_options,
cups_option_t *options);
extern int cupsSetDests2(http_t *http, int num_dests,
cups_dest_t *dests);
# ifdef __cplusplus
}
+1 -1
Ver Arquivo
@@ -18,7 +18,7 @@
"Cyan",
"Magenta",
"Yellow",
"Copyright 1993-2003 by Easy Software Products, All Rights Reserved.",
"Copyright 1993-2004 by Easy Software Products, All Rights Reserved.",
"General",
"Printer",
"Image",
+136
Ver Arquivo
@@ -0,0 +1,136 @@
cupsAddDest
cupsAddOption
cupsCancelJob
cupsDoAuthentication
cupsDoFileRequest
cupsEncodeOptions
cupsEncryption
cupsFreeDests
cupsFreeJobs
cupsFreeOptions
cupsGetClasses
cupsGetDefault
cupsGetDest
cupsGetDests
cupsGetFd
cupsGetFile
cupsGetJobs
cupsGetOption
cupsGetPassword
cupsGetPPD
cupsGetPrinters
cupsLangEncoding
cupsLangFlush
cupsLangFree
cupsLangGet
cupsLastError
cupsMarkOptions
cupsParseOptions
cupsPrintFile
cupsPrintFiles
cupsPutFd
cupsPutFile
cupsServer
cupsSetDests
cupsSetEncryption
cupsSetPasswordCB
cupsSetServer
cupsSetUser
cupsTempFd
cupsTempFile
cupsUser
httpCheck
httpClearCookie
httpClose
httpConnect
httpConnectEncrypt
httpDecode64
httpDelete
httpEncode64
httpEncryption
httpFlush
httpGet
httpGetDateString
httpGetDateTime
httpGetHostByName
httpGetLength
httpGets
httpGetSubField
httpHead
httpInitialize
httpMD5
httpMD5Final
httpMD5String
httpOptions
httpPost
httpPrintf
httpPut
httpRead
httpReconnect
httpSeparate
httpSetCookie
httpSetField
httpStatus
httpTrace
httpUpdate
httpWait
httpWrite
_ipp_add_attr
ippAddBoolean
ippAddBooleans
ippAddCollection
ippAddCollections
ippAddDate
ippAddInteger
ippAddIntegers
ippAddRange
ippAddRanges
ippAddResolution
ippAddResolutions
ippAddSeparator
ippAddString
ippAddStrings
ippDateToTime
ippDelete
ippDeleteAttribute
ippErrorString
ippFindAttribute
ippFindNextAttribute
_ipp_free_attr
ippLength
ippNew
ippPort
ippRead
ippReadFile
ippReadIO
ippSetPort
ippTimeToDate
ippWrite
ippWriteFile
ippWriteIO
md5_append
md5_finish
md5_init
ppdClose
ppdCollect
ppdConflicts
ppdEmit
ppdEmitFd
ppdEmitJCL
ppdErrorString
ppdFindAttr
ppdFindChoice
ppdFindMarkedChoice
ppdFindNextAttr
ppdFindOption
ppdIsMarked
ppdLastError
ppdMarkDefaults
ppdMarkOption
ppdOpen
ppdOpenFd
ppdOpenFile
ppdPageLength
ppdPageSize
ppdPageWidth
ppdSetConformance
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Debugging macros for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+89 -31
Ver Arquivo
@@ -4,7 +4,7 @@
* User-defined destination (and option) support for the Common UNIX
* Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -30,6 +30,7 @@
* cupsFreeDests() - Free the memory used by the list of destinations.
* cupsGetDest() - Get the named destination from the list.
* cupsGetDests() - Get the list of destinations.
* cupsGetDests2() - Get the list of destinations using a HTTP connection.
* cupsSetDests() - Set the list of destinations.
* cups_get_dests() - Get destinations from a file.
* cups_get_sdests() - Get destinations from a server.
@@ -52,7 +53,7 @@
static int cups_get_dests(const char *filename, int num_dests,
cups_dest_t **dests);
static int cups_get_sdests(ipp_op_t op, int num_dests,
static int cups_get_sdests(http_t *http, ipp_op_t op, int num_dests,
cups_dest_t **dests);
@@ -208,6 +209,33 @@ cupsGetDest(const char *name, /* I - Name of destination */
int /* O - Number of destinations */
cupsGetDests(cups_dest_t **dests) /* O - Destinations */
{
int num_dests; /* Number of destinations */
http_t *http; /* HTTP connection */
/*
* Connect to the CUPS server and get the destination list and options...
*/
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
num_dests = cupsGetDests2(http, dests);
if (http)
httpClose(http);
return (num_dests);
}
/*
* 'cupsGetDests2()' - Get the list of destinations.
*/
int /* O - Number of destinations */
cupsGetDests2(http_t *http, /* I - HTTP connection */
cups_dest_t **dests) /* O - Destinations */
{
int i; /* Looping var */
int num_dests; /* Number of destinations */
@@ -221,6 +249,13 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
cups_dest_t *reals; /* Real queues */
/*
* Range check the input...
*/
if (!http || !dests)
return (0);
/*
* Initialize destination array...
*/
@@ -232,8 +267,8 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
* Grab the printers and classes...
*/
num_dests = cups_get_sdests(CUPS_GET_PRINTERS, num_dests, dests);
num_dests = cups_get_sdests(CUPS_GET_CLASSES, num_dests, dests);
num_dests = cups_get_sdests(http, CUPS_GET_PRINTERS, num_dests, dests);
num_dests = cups_get_sdests(http, CUPS_GET_CLASSES, num_dests, dests);
/*
* Make a copy of the "real" queues for a later sanity check...
@@ -259,7 +294,7 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
* Grab the default destination...
*/
if ((defprinter = cupsGetDefault()) != NULL)
if ((defprinter = cupsGetDefault2(http)) != NULL)
{
/*
* Grab printer and instance name...
@@ -362,6 +397,31 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
void
cupsSetDests(int num_dests, /* I - Number of destinations */
cups_dest_t *dests) /* I - Destinations */
{
http_t *http; /* HTTP connection */
/*
* Connect to the CUPS server and save the destination list and options...
*/
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
cupsSetDests2(http, num_dests, dests);
if (http)
httpClose(http);
}
/*
* 'cupsSetDests()' - Set the list of destinations.
*/
int /* O - 0 on success, -1 on error */
cupsSetDests2(http_t *http, /* I - HTTP connection */
int num_dests, /* I - Number of destinations */
cups_dest_t *dests) /* I - Destinations */
{
int i, j; /* Looping vars */
int wrote; /* Wrote definition? */
@@ -376,12 +436,19 @@ cupsSetDests(int num_dests, /* I - Number of destinations */
const char *val; /* Value of temporary option */
/*
* Range check the input...
*/
if (!http || !num_dests || !dests)
return (-1);
/*
* Get the server destinations...
*/
num_temps = cups_get_sdests(CUPS_GET_PRINTERS, 0, &temps);
num_temps = cups_get_sdests(CUPS_GET_CLASSES, num_temps, &temps);
num_temps = cups_get_sdests(http, CUPS_GET_PRINTERS, 0, &temps);
num_temps = cups_get_sdests(http, CUPS_GET_CLASSES, num_temps, &temps);
/*
* Figure out which file to write to...
@@ -417,7 +484,7 @@ cupsSetDests(int num_dests, /* I - Number of destinations */
if ((fp = fopen(filename, "w")) == NULL)
{
cupsFreeDests(num_temps, temps);
return;
return (-1);
}
/*
@@ -495,7 +562,9 @@ cupsSetDests(int num_dests, /* I - Number of destinations */
* Close the file and return...
*/
fclose(fp);
fclose(fp);
return (0);
}
@@ -547,9 +616,9 @@ cups_get_dests(const char *filename, /* I - File to read from */
* See what type of line it is...
*/
if (strncasecmp(line, "dest", 4) == 0 && isspace(line[4]))
if (strncasecmp(line, "dest", 4) == 0 && isspace(line[4] & 255))
lineptr = line + 4;
else if (strncasecmp(line, "default", 7) == 0 && isspace(line[7]))
else if (strncasecmp(line, "default", 7) == 0 && isspace(line[7] & 255))
lineptr = line + 7;
else
continue;
@@ -558,7 +627,7 @@ cups_get_dests(const char *filename, /* I - File to read from */
* Skip leading whitespace...
*/
while (isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
if (!*lineptr)
@@ -570,7 +639,7 @@ cups_get_dests(const char *filename, /* I - File to read from */
* Search for an instance...
*/
while (!isspace(*lineptr) && *lineptr && *lineptr != '/')
while (!isspace(*lineptr & 255) && *lineptr && *lineptr != '/')
lineptr ++;
if (!*lineptr)
@@ -589,7 +658,7 @@ cups_get_dests(const char *filename, /* I - File to read from */
* Search for an instance...
*/
while (!isspace(*lineptr) && *lineptr)
while (!isspace(*lineptr & 255) && *lineptr)
lineptr ++;
}
else
@@ -656,12 +725,12 @@ cups_get_dests(const char *filename, /* I - File to read from */
*/
static int /* O - Number of destinations */
cups_get_sdests(ipp_op_t op, /* I - get-printers or get-classes */
cups_get_sdests(http_t *http, /* I - HTTP connection */
ipp_op_t op, /* I - get-printers or get-classes */
int num_dests, /* I - Number of destinations */
cups_dest_t **dests) /* IO - Destinations */
{
cups_dest_t *dest; /* Current destination */
http_t *http; /* HTTP connection */
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
@@ -675,13 +744,6 @@ cups_get_sdests(ipp_op_t op, /* I - get-printers or get-classes */
};
/*
* Connect to the CUPS server...
*/
if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
return (num_dests);
/*
* Build a CUPS_GET_PRINTERS or CUPS_GET_CLASSES request, which require
* the following attributes:
@@ -703,6 +765,8 @@ cups_get_sdests(ipp_op_t op, /* I - get-printers or get-classes */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
cupsLangFree(language);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]),
NULL, pattrs);
@@ -779,12 +843,6 @@ cups_get_sdests(ipp_op_t op, /* I - get-printers or get-classes */
ippDelete(response);
}
/*
* Close the server connection...
*/
httpClose(http);
/*
* Return the count...
*/
+15 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD code emission routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -257,6 +257,8 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
pos = 4;
else
{
pos --;
if (pos < 0 || pos > 4)
pos = 4;
@@ -456,6 +458,8 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
pos = 4;
else
{
pos --;
if (pos < 0 || pos > 4)
pos = 4;
@@ -687,8 +691,14 @@ ppd_handle_media(ppd_file_t *ppd)
ppdMarkOption(ppd, "PageRegion", size->name);
if ((rpr && rpr->value && !strcmp(rpr->value, "False")) ||
(!rpr && !ppd->num_filters))
/*
* RequiresPageRegion does not apply to manual feed so we need to
* check that we are not doing manual feed before unmarking PageRegion.
*/
if (!(manual_feed && !strcasecmp(manual_feed->choice, "True")) &&
((rpr && rpr->value && !strcmp(rpr->value, "False")) ||
(!rpr && !ppd->num_filters)))
{
/*
* Either the PPD file specifies no PageRegion code or the PPD file
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option encoding routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+28 -44
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Get/put file functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -70,6 +70,9 @@ cupsGetFd(http_t *http, /* I - HTTP connection to server */
* Range check input...
*/
DEBUG_printf(("cupsGetFd(http=%p, resource=\"%s\", fd=%d)\n", http,
resource, fd));
if (!http || !resource || fd < 0)
{
if (http)
@@ -122,42 +125,24 @@ cupsGetFd(http_t *http, /* I - HTTP connection to server */
continue;
}
else if (status == HTTP_ERROR)
{
#ifdef WIN32
if (http->error != WSAENETDOWN && http->error != WSAENETUNREACH)
#else
if (http->error != ENETDOWN && http->error != ENETUNREACH)
#endif /* WIN32 */
continue;
else
break;
}
#ifdef HAVE_LIBSSL
#ifdef HAVE_SSL
else if (status == HTTP_UPGRADE_REQUIRED)
{
/*
* Flush any error message...
*/
/* Flush any error message... */
httpFlush(http);
/*
* Upgrade with encryption...
*/
/* Reconnect... */
httpReconnect(http);
/* Upgrade with encryption... */
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
/*
* Try again, this time with encryption enabled...
*/
/* Try again, this time with encryption enabled... */
continue;
}
#endif /* HAVE_LIBSSL */
#endif /* HAVE_SSL */
}
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED ||
status == HTTP_ERROR);
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
/*
* See if we actually got the file or an error...
@@ -264,6 +249,9 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */
* Range check input...
*/
DEBUG_printf(("cupsPutFd(http=%p, resource=\"%s\", fd=%d)\n", http,
resource, fd));
if (!http || !resource || fd < 0)
{
if (http)
@@ -278,6 +266,9 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */
do
{
DEBUG_printf(("cupsPutFd: starting attempt, authstring=\"%s\"...\n",
http->authstring));
httpClearFields(http);
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
httpSetField(http, HTTP_FIELD_TRANSFER_ENCODING, "chunked");
@@ -320,6 +311,8 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */
while ((status = httpUpdate(http)) == HTTP_CONTINUE);
}
DEBUG_printf(("cupsPutFd: status=%d\n", status));
if (status == HTTP_UNAUTHORIZED)
{
/*
@@ -339,33 +332,24 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */
continue;
}
else if (status == HTTP_ERROR)
{
#ifdef WIN32
if (http->error != WSAENETDOWN && http->error != WSAENETUNREACH)
#else
if (http->error != ENETDOWN && http->error != ENETUNREACH)
#endif /* WIN32 */
continue;
else
break;
}
#ifdef HAVE_LIBSSL
#ifdef HAVE_SSL
else if (status == HTTP_UPGRADE_REQUIRED)
{
/* Flush any error message... */
httpFlush(http);
/* Reconnect... */
httpReconnect(http);
/* Upgrade with encryption... */
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
/* Try again, this time with encryption enabled... */
continue;
}
#endif /* HAVE_LIBSSL */
#endif /* HAVE_SSL */
}
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED ||
status == HTTP_ERROR);
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
/*
* See if we actually put the file or an error...
+8 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP host/address routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -73,7 +73,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
* htonl() macro to get the right byte order for the address.
*/
for (nameptr = name; isdigit(*nameptr) || *nameptr == '.'; nameptr ++);
for (nameptr = name; isdigit(*nameptr & 255) || *nameptr == '.'; nameptr ++);
if (!*nameptr)
{
@@ -84,7 +84,10 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
*/
if (sscanf(name, "%u.%u.%u.%u", ip, ip + 1, ip + 2, ip + 3) != 4)
return (NULL); /* Must have 4 numbers */
return (NULL); /* Must have 4 numbers */
if (ip[0] > 255 || ip[1] > 255 || ip[2] > 255 || ip[3] > 255)
return (NULL); /* Invalid byte ranges! */
packed_ip = htonl(((((((ip[0] << 8) | ip[1]) << 8) | ip[2]) << 8) | ip[3]));
+18 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Private HTTP definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -80,7 +80,21 @@ typedef struct
typedef SSLConnectionRef http_tls_t;
# endif /* HAVE_LIBSSL */
/*
* Some OS's don't have hstrerror(), most notably Solaris...
*/
# ifndef HAVE_HSTRERROR
extern const char *cups_hstrerror(int error);
# define hstrerror cups_hstrerror
# elif defined(_AIX) || defined(__osf__)
/*
* AIX and Tru64 UNIX don't provide a prototype but do provide the function...
*/
extern const char *hstrerror(int error);
# endif /* !HAVE_HSTRERROR */
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
/*
+134 -74
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP support routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -25,9 +25,13 @@
*
* Contents:
*
* httpSeparate() - Separate a Universal Resource Identifier into its
* components.
* httpStatus() - Return a short string describing a HTTP status code.
* httpSeparate() - Separate a Universal Resource Identifier into its
* components.
* httpSeparate2() - Separate a Universal Resource Identifier into its
* components.
* httpStatus() - Return a short string describing a HTTP status code.
* cups_hstrerror() - hstrerror() emulation function for Solaris and others...
* http_copy_decode() - Copy and decode a URI.
*/
/*
@@ -44,6 +48,14 @@
#include "ipp.h"
/*
* Local functions...
*/
static const char *http_copy_decode(char *dst, const char *src,
int dstsize, const char *term);
/*
* 'httpSeparate()' - Separate a Universal Resource Identifier into its
* components.
@@ -52,16 +64,36 @@
void
httpSeparate(const char *uri, /* I - Universal Resource Identifier */
char *method, /* O - Method [32] (http, https, etc.) */
char *username, /* O - Username [32] */
char *host, /* O - Hostname [32] */
char *username, /* O - Username [1024] */
char *host, /* O - Hostname [1024] */
int *port, /* O - Port number to use */
char *resource) /* O - Resource/filename [1024] */
{
httpSeparate2(uri, method, 32, username, HTTP_MAX_URI, host, HTTP_MAX_URI,
port, resource, HTTP_MAX_URI);
}
/*
* 'httpSeparate2()' - Separate a Universal Resource Identifier into its
* components.
*/
void
httpSeparate2(const char *uri, /* I - Universal Resource Identifier */
char *method, /* O - Method (http, https, etc.) */
int methodlen, /* I - Size of method buffer */
char *username, /* O - Username */
int usernamelen, /* I - Size of username buffer */
char *host, /* O - Hostname */
int hostlen, /* I - Size of hostname buffer */
int *port, /* O - Port number to use */
char *resource, /* O - Resource/filename */
int resourcelen) /* I - Size of resource buffer */
{
char *ptr; /* Pointer into string... */
const char *atsign, /* @ sign */
*slash; /* Separator */
char safeuri[HTTP_MAX_URI]; /* "Safe" local copy of URI */
char quoted; /* Quoted character */
/*
@@ -72,15 +104,6 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
port == NULL || resource == NULL)
return;
/*
* Copy the URL to a local string to make sure we don't have a URL
* longer than HTTP_MAX_URI characters long...
*/
strlcpy(safeuri, uri, sizeof(safeuri));
uri = safeuri;
/*
* Grab the method portion of the URI...
*/
@@ -91,7 +114,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
* Workaround for HP IPP client bug...
*/
strcpy(method, "ipp");
strlcpy(method, "ipp", methodlen);
}
else
{
@@ -99,11 +122,8 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
* Standard URI with method...
*/
for (ptr = host; *uri != ':' && *uri != '\0'; uri ++)
if (ptr < (host + HTTP_MAX_URI - 1))
*ptr++ = *uri;
uri = http_copy_decode(host, uri, hostlen, ":");
*ptr = '\0';
if (*uri == ':')
uri ++;
@@ -116,13 +136,13 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
{
if ((ptr = strchr(host, '/')) != NULL)
{
strlcpy(resource, ptr, HTTP_MAX_URI);
strlcpy(resource, ptr, resourcelen);
*ptr = '\0';
}
else
resource[0] = '\0';
if (isdigit(*uri))
if (isdigit(*uri & 255))
{
/*
* OK, we have "hostname:port[/resource]"...
@@ -131,17 +151,17 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
*port = strtol(uri, (char **)&uri, 10);
if (*uri == '/')
strlcpy(resource, uri, HTTP_MAX_URI);
strlcpy(resource, uri, resourcelen);
}
else
*port = 631;
strcpy(method, "http");
strlcpy(method, "http", methodlen);
username[0] = '\0';
return;
}
else
strlcpy(method, host, 32);
strlcpy(method, host, methodlen);
}
/*
@@ -150,7 +170,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
if (strncmp(uri, "//", 2) != 0)
{
strlcpy(resource, uri, HTTP_MAX_URI);
strlcpy(resource, uri, resourcelen);
username[0] = '\0';
host[0] = '\0';
@@ -173,36 +193,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
* Got a username:password combo...
*/
for (ptr = username; uri < atsign; uri ++)
if (ptr < (username + HTTP_MAX_URI - 1))
{
if (*uri == '%' && isxdigit(uri[1]) && isxdigit(uri[2]))
{
/*
* Grab a hex-encoded username and password...
*/
uri ++;
if (isalpha(*uri))
quoted = (tolower(*uri) - 'a' + 10) << 4;
else
quoted = (*uri - '0') << 4;
uri ++;
if (isalpha(*uri))
quoted |= tolower(*uri) - 'a' + 10;
else
quoted |= *uri - '0';
*ptr++ = quoted;
}
else
*ptr++ = *uri;
}
*ptr = '\0';
uri = atsign + 1;
uri = http_copy_decode(username, uri, usernamelen, "@") + 1;
}
else
username[0] = '\0';
@@ -211,11 +202,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
* Grab the hostname...
*/
for (ptr = host; *uri != ':' && *uri != '/' && *uri != '\0'; uri ++)
if (ptr < (host + HTTP_MAX_URI - 1))
*ptr++ = *uri;
*ptr = '\0';
uri = http_copy_decode(host, uri, hostlen, ":/");
if (*uri != ':')
{
@@ -224,7 +211,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
else if (strcasecmp(method, "https") == 0)
*port = 443;
else if (strcasecmp(method, "ipp") == 0)
*port = ippPort();
*port = 631;
else if (strcasecmp(method, "lpd") == 0)
*port = 515;
else if (strcasecmp(method, "socket") == 0) /* Not registered yet... */
@@ -238,13 +225,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
* Parse port number...
*/
*port = 0;
uri ++;
while (isdigit(*uri))
{
*port = (*port * 10) + *uri - '0';
uri ++;
}
*port = strtol(uri + 1, (char **)&uri, 10);
}
if (*uri == '\0')
@@ -262,7 +243,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
* The remaining portion is the resource string...
*/
strlcpy(resource, uri, HTTP_MAX_URI);
http_copy_decode(resource, uri, resourcelen, "");
}
@@ -313,6 +294,85 @@ httpStatus(http_status_t status) /* I - HTTP status code */
}
#ifndef HAVE_HSTRERROR
/*
* 'cups_hstrerror()' - hstrerror() emulation function for Solaris and others...
*/
const char * /* O - Error string */
cups_hstrerror(int error) /* I - Error number */
{
static const char * const errors[] = /* Error strings */
{
"OK",
"Host not found.",
"Try again.",
"Unrecoverable lookup error.",
"No data associated with name."
};
if (error < 0 || error > 4)
return ("Unknown hostname lookup error.");
else
return (errors[error]);
}
#endif /* !HAVE_HSTRERROR */
/*
* 'http_copy_decode()' - Copy and decode a URI.
*/
static const char * /* O - New source pointer */
http_copy_decode(char *dst, /* O - Destination buffer */
const char *src, /* I - Source pointer */
int dstsize, /* I - Destination size */
const char *term) /* I - Terminating characters */
{
char *ptr, /* Pointer into buffer */
*end; /* End of buffer */
int quoted; /* Quoted character */
/*
* Copy the src to the destination until we hit a terminating character
* or the end of the string.
*/
for (ptr = dst, end = dst + dstsize - 1; *src && !strchr(term, *src); src ++)
if (ptr < end)
{
if (*src == '%' && isxdigit(src[1] & 255) && isxdigit(src[2] & 255))
{
/*
* Grab a hex-encoded character...
*/
src ++;
if (isalpha(*src))
quoted = (tolower(*src) - 'a' + 10) << 4;
else
quoted = (*src - '0') << 4;
src ++;
if (isalpha(*src))
quoted |= tolower(*src) - 'a' + 10;
else
quoted |= *src - '0';
*ptr++ = quoted;
}
else
*ptr++ = *src;
}
*ptr = '\0';
return (src);
}
/*
* End of "$Id$".
*/
+210 -74
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -55,7 +55,9 @@
* httpGetDateTime() - Get a time value from a formatted date/time string.
* httpUpdate() - Update the current HTTP state for incoming data.
* httpDecode64() - Base64-decode a string.
* httpDecode64_2() - Base64-decode a string.
* httpEncode64() - Base64-encode a string.
* httpEncode64_2() - Base64-encode a string.
* httpGetLength() - Get the amount of data remaining from the
* content-length or transfer-encoding fields.
* http_field() - Return the field index for a field name.
@@ -204,8 +206,8 @@ httpInitialize(void)
#endif /* HAVE_LIBSSL */
#ifdef WIN32
WSADATA winsockdata; /* WinSock data */
static int initialized = 0;/* Has WinSock been initialized? */
WSADATA winsockdata; /* WinSock data */
static int initialized = 0; /* Has WinSock been initialized? */
if (!initialized)
@@ -213,7 +215,7 @@ httpInitialize(void)
#elif defined(HAVE_SIGSET)
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
struct sigaction action; /* POSIX sigaction data */
struct sigaction action; /* POSIX sigaction data */
/*
@@ -290,6 +292,8 @@ httpClearCookie(http_t *http) /* I - Connection */
void
httpClose(http_t *http) /* I - Connection to close */
{
DEBUG_printf(("httpClose(http=%p)\n", http));
if (!http)
return;
@@ -353,7 +357,10 @@ httpConnectEncrypt(const char *host, /* I - Host to connect to */
struct hostent *hostaddr; /* Host address data */
if (host == NULL)
DEBUG_printf(("httpConnectEncrypt(host=\"%s\", port=%d, encrypt=%d)\n",
host ? host : "(null)", port, encrypt));
if (!host)
return (NULL);
httpInitialize();
@@ -456,6 +463,8 @@ int /* O - -1 on error, 0 on success */
httpEncryption(http_t *http, /* I - HTTP data */
http_encryption_t e) /* I - New encryption preference */
{
DEBUG_printf(("httpEncryption(http=%p, e=%d)\n", http, e));
#ifdef HAVE_SSL
if (!http)
return (0);
@@ -487,6 +496,12 @@ httpReconnect(http_t *http) /* I - HTTP data */
{
int val; /* Socket option value */
DEBUG_printf(("httpReconnect(http=%p)\n", http));
if (!http)
return (-1);
#ifdef HAVE_SSL
if (http->tls)
http_shutdown_ssl(http);
@@ -539,7 +554,11 @@ httpReconnect(http_t *http) /* I - HTTP data */
*/
val = 1;
#ifdef WIN32
setsockopt(http->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
#else
setsockopt(http->fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
#endif // WIN32
/*
* Connect to the server...
@@ -610,22 +629,22 @@ httpGetSubField(http_t *http, /* I - HTTP data */
*ptr; /* Pointer into string buffer */
DEBUG_printf(("httpGetSubField(http=%p, field=%d, name=\"%s\", value=%p)\n",
http, field, name, value));
if (http == NULL ||
field < HTTP_FIELD_ACCEPT_LANGUAGE ||
field > HTTP_FIELD_WWW_AUTHENTICATE ||
name == NULL || value == NULL)
return (NULL);
DEBUG_printf(("httpGetSubField(%p, %d, \"%s\", %p)\n",
http, field, name, value));
for (fptr = http->fields[field]; *fptr;)
{
/*
* Skip leading whitespace...
*/
while (isspace(*fptr))
while (isspace(*fptr & 255))
fptr ++;
if (*fptr == ',')
@@ -639,18 +658,18 @@ httpGetSubField(http_t *http, /* I - HTTP data */
*/
for (ptr = temp;
*fptr && *fptr != '=' && !isspace(*fptr) && ptr < (temp + sizeof(temp) - 1);
*fptr && *fptr != '=' && !isspace(*fptr & 255) && ptr < (temp + sizeof(temp) - 1);
*ptr++ = *fptr++);
*ptr = '\0';
DEBUG_printf(("name = \"%s\"\n", temp));
DEBUG_printf(("httpGetSubField: name=\"%s\"\n", temp));
/*
* Skip trailing chars up to the '='...
*/
while (isspace(*fptr))
while (isspace(*fptr & 255))
fptr ++;
if (!*fptr)
@@ -665,7 +684,7 @@ httpGetSubField(http_t *http, /* I - HTTP data */
fptr ++;
while (isspace(*fptr))
while (isspace(*fptr & 255))
fptr ++;
if (*fptr == '\"')
@@ -693,16 +712,16 @@ httpGetSubField(http_t *http, /* I - HTTP data */
*/
for (ptr = value;
*fptr && !isspace(*fptr) && *fptr != ',' && ptr < (value + HTTP_MAX_VALUE - 1);
*fptr && !isspace(*fptr & 255) && *fptr != ',' && ptr < (value + HTTP_MAX_VALUE - 1);
*ptr++ = *fptr++);
*ptr = '\0';
while (*fptr && !isspace(*fptr) && *fptr != ',')
while (*fptr && !isspace(*fptr & 255) && *fptr != ',')
fptr ++;
}
DEBUG_printf(("value = \"%s\"\n", value));
DEBUG_printf(("httpGetSubField: value=\"%s\"\n", value));
/*
* See if this is the one...
@@ -830,15 +849,14 @@ httpTrace(http_t *http, /* I - HTTP data */
*/
void
httpFlush(http_t *http) /* I - HTTP data */
httpFlush(http_t *http) /* I - HTTP data */
{
char buffer[8192]; /* Junk buffer */
char buffer[8192]; /* Junk buffer */
if (http->state != HTTP_WAITING)
{
while (httpRead(http, buffer, sizeof(buffer)) > 0);
}
DEBUG_printf(("httpFlush(http=%p), state=%d\n", http, http->state));
while (httpRead(http, buffer, sizeof(buffer)) > 0);
}
@@ -855,7 +873,8 @@ httpRead(http_t *http, /* I - HTTP data */
char len[32]; /* Length string */
DEBUG_printf(("httpRead(%p, %p, %d)\n", http, buffer, length));
DEBUG_printf(("httpRead(http=%p, buffer=%p, length=%d)\n",
http, buffer, length));
if (http == NULL || buffer == NULL)
return (-1);
@@ -884,7 +903,7 @@ httpRead(http_t *http, /* I - HTTP data */
}
}
DEBUG_printf(("httpRead: data_remaining = %d\n", http->data_remaining));
DEBUG_printf(("httpRead: data_remaining=%d\n", http->data_remaining));
if (http->data_remaining <= 0)
{
@@ -901,6 +920,12 @@ httpRead(http_t *http, /* I - HTTP data */
else
http->state = HTTP_WAITING;
/*
* Prevent future reads for this request...
*/
http->data_encoding = HTTP_ENCODE_LENGTH;
return (0);
}
else if (length > http->data_remaining)
@@ -1175,7 +1200,7 @@ httpWrite(http_t *http, /* I - HTTP data */
#else
if (errno == EINTR)
continue;
else if (errno != http->error)
else if (errno != http->error && errno != ECONNRESET)
{
http->error = errno;
continue;
@@ -1265,7 +1290,7 @@ httpGets(char *line, /* I - Line to read into */
int bytes; /* Number of bytes read */
DEBUG_printf(("httpGets(%p, %d, %p)\n", line, length, http));
DEBUG_printf(("httpGets(line=%p, length=%d, http=%p)\n", line, length, http));
if (http == NULL || line == NULL)
return (NULL);
@@ -1307,6 +1332,8 @@ httpGets(char *line, /* I - Line to read into */
#endif /* HAVE_SSL */
bytes = recv(http->fd, bufend, HTTP_MAX_BUFFER - http->used, 0);
DEBUG_printf(("httpGets: read %d bytes...\n", bytes));
if (bytes < 0)
{
/*
@@ -1320,8 +1347,10 @@ httpGets(char *line, /* I - Line to read into */
continue;
}
DEBUG_printf(("httpGets(): recv() error %d!\n", WSAGetLastError()));
DEBUG_printf(("httpGets: recv() error %d!\n", WSAGetLastError()));
#else
DEBUG_printf(("httpGets: recv() error %d!\n", errno));
if (errno == EINTR)
continue;
else if (errno != http->error)
@@ -1329,8 +1358,6 @@ httpGets(char *line, /* I - Line to read into */
http->error = errno;
continue;
}
DEBUG_printf(("httpGets(): recv() error %d!\n", errno));
#endif /* WIN32 */
return (NULL);
@@ -1387,11 +1414,11 @@ httpGets(char *line, /* I - Line to read into */
if (http->used > 0)
memmove(http->buffer, bufptr, http->used);
DEBUG_printf(("httpGets(): Returning \"%s\"\n", line));
DEBUG_printf(("httpGets: Returning \"%s\"\n", line));
return (line);
}
DEBUG_puts("httpGets(): No new line available!");
DEBUG_puts("httpGets: No new line available!");
return (NULL);
}
@@ -1414,6 +1441,8 @@ httpPrintf(http_t *http, /* I - HTTP data */
va_list ap; /* Variable argument pointer */
DEBUG_printf(("httpPrintf(http=%p, format=\"%s\", ...)\n", http, format));
va_start(ap, format);
bytes = vsnprintf(buf, sizeof(buf), format, ap);
va_end(ap);
@@ -1523,11 +1552,11 @@ httpUpdate(http_t *http) /* I - HTTP data */
char line[1024], /* Line from connection... */
*value; /* Pointer to value on line */
http_field_t field; /* Field index */
int major, minor; /* HTTP version numbers */
http_status_t status; /* Authorization status */
int major, minor, /* HTTP version numbers */
status; /* Request status */
DEBUG_printf(("httpUpdate(%p)\n", http));
DEBUG_printf(("httpUpdate(http=%p), state=%d\n", http, http->state));
/*
* If we haven't issued any commands, then there is nothing to "update"...
@@ -1542,7 +1571,7 @@ httpUpdate(http_t *http) /* I - HTTP data */
while (httpGets(line, sizeof(line), http) != NULL)
{
DEBUG_puts(line);
DEBUG_printf(("httpUpdate: Got \"%s\"\n", line));
if (line[0] == '\0')
{
@@ -1558,16 +1587,19 @@ httpUpdate(http_t *http) /* I - HTTP data */
if (http->status == HTTP_CONTINUE)
return (http->status);
if (http->status < HTTP_BAD_REQUEST)
http->digest_tries = 0;
#ifdef HAVE_SSL
if (http->status == HTTP_SWITCHING_PROTOCOLS && !http->tls)
{
if (http_setup_ssl(http) != 0)
{
#ifdef WIN32
# ifdef WIN32
closesocket(http->fd);
#else
# else
close(http->fd);
#endif
# endif /* WIN32 */
return (HTTP_ERROR);
}
@@ -1601,11 +1633,11 @@ httpUpdate(http_t *http) /* I - HTTP data */
* Got the beginning of a response...
*/
if (sscanf(line, "HTTP/%d.%d%d", &major, &minor, (int *)&status) != 3)
if (sscanf(line, "HTTP/%d.%d%d", &major, &minor, &status) != 3)
return (HTTP_ERROR);
http->version = (http_version_t)(major * 100 + minor);
http->status = status;
http->status = (http_status_t)status;
}
else if ((value = strchr(line, ':')) != NULL)
{
@@ -1614,7 +1646,7 @@ httpUpdate(http_t *http) /* I - HTTP data */
*/
*value++ = '\0';
while (isspace(*value))
while (isspace(*value & 255))
value ++;
/*
@@ -1656,8 +1688,13 @@ httpUpdate(http_t *http) /* I - HTTP data */
* See if there was an error...
*/
if (http->error == EPIPE && http->status > HTTP_CONTINUE)
return (http->status);
if (http->error)
{
DEBUG_printf(("httpUpdate: socket error %d - %s\n", http->error,
strerror(http->error)));
http->status = HTTP_ERROR;
return (HTTP_ERROR);
}
@@ -1674,16 +1711,50 @@ httpUpdate(http_t *http) /* I - HTTP data */
* 'httpDecode64()' - Base64-decode a string.
*/
char * /* O - Decoded string */
httpDecode64(char *out, /* I - String to write to */
const char *in) /* I - String to read from */
char * /* O - Decoded string */
httpDecode64(char *out, /* I - String to write to */
const char *in) /* I - String to read from */
{
int pos, /* Bit position */
base64; /* Value of this character */
char *outptr; /* Output pointer */
int outlen; /* Output buffer length */
for (outptr = out, pos = 0; *in != '\0'; in ++)
/*
* Use the old maximum buffer size for binary compatibility...
*/
outlen = 512;
return (httpDecode64_2(out, &outlen, in));
}
/*
* 'httpDecode64_2()' - Base64-decode a string.
*/
char * /* O - Decoded string */
httpDecode64_2(char *out, /* I - String to write to */
int *outlen, /* IO - Size of output string */
const char *in) /* I - String to read from */
{
int pos, /* Bit position */
base64; /* Value of this character */
char *outptr, /* Output pointer */
*outend; /* End of output buffer */
/*
* Range check input...
*/
if (!out || !outlen || *outlen < 1 || !in || !*in)
return (NULL);
/*
* Convert from base-64 to bytes...
*/
for (outptr = out, outend = out + *outlen - 1, pos = 0; *in != '\0'; in ++)
{
/*
* Decode this character into a number from 0 to 63...
@@ -1711,21 +1782,27 @@ httpDecode64(char *out, /* I - String to write to */
switch (pos)
{
case 0 :
*outptr = base64 << 2;
if (outptr < outend)
*outptr = base64 << 2;
pos ++;
break;
case 1 :
*outptr++ |= (base64 >> 4) & 3;
*outptr = (base64 << 4) & 255;
if (outptr < outend)
*outptr++ |= (base64 >> 4) & 3;
if (outptr < outend)
*outptr = (base64 << 4) & 255;
pos ++;
break;
case 2 :
*outptr++ |= (base64 >> 2) & 15;
*outptr = (base64 << 6) & 255;
if (outptr < outend)
*outptr++ |= (base64 >> 2) & 15;
if (outptr < outend)
*outptr = (base64 << 6) & 255;
pos ++;
break;
case 3 :
*outptr++ |= base64;
if (outptr < outend)
*outptr++ |= base64;
pos = 0;
break;
}
@@ -1734,9 +1811,11 @@ httpDecode64(char *out, /* I - String to write to */
*outptr = '\0';
/*
* Return the decoded string...
* Return the decoded string and size...
*/
*outlen = (int)(outptr - out);
return (out);
}
@@ -1745,12 +1824,27 @@ httpDecode64(char *out, /* I - String to write to */
* 'httpEncode64()' - Base64-encode a string.
*/
char * /* O - Encoded string */
httpEncode64(char *out, /* I - String to write to */
const char *in) /* I - String to read from */
char * /* O - Encoded string */
httpEncode64(char *out, /* I - String to write to */
const char *in) /* I - String to read from */
{
char *outptr; /* Output pointer */
static const char base64[] = /* Base64 characters... */
return (httpEncode64_2(out, 512, in, strlen(in)));
}
/*
* 'httpEncode64_2()' - Base64-encode a string.
*/
char * /* O - Encoded string */
httpEncode64_2(char *out, /* I - String to write to */
int outlen, /* I - Size of output string */
const char *in, /* I - String to read from */
int inlen) /* I - Size of input string */
{
char *outptr, /* Output pointer */
*outend; /* End of output buffer */
static const char base64[] = /* Base64 characters... */
{
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
@@ -1759,32 +1853,55 @@ httpEncode64(char *out, /* I - String to write to */
};
for (outptr = out; *in != '\0'; in ++)
/*
* Range check input...
*/
if (!out || outlen < 1 || !in || inlen < 1)
return (NULL);
/*
* Convert bytes to base-64...
*/
for (outptr = out, outend = out + outlen - 1; inlen > 0; in ++, inlen --)
{
/*
* Encode the up to 3 characters as 4 Base64 numbers...
*/
*outptr ++ = base64[in[0] >> 2];
*outptr ++ = base64[((in[0] << 4) | (in[1] >> 4)) & 63];
if (outptr < outend)
*outptr ++ = base64[(in[0] & 255) >> 2];
if (outptr < outend)
*outptr ++ = base64[(((in[0] & 255) << 4) | ((in[1] & 255) >> 4)) & 63];
in ++;
if (*in == '\0')
inlen --;
if (inlen <= 0)
{
*outptr ++ = '=';
if (outptr < outend)
*outptr ++ = '=';
if (outptr < outend)
*outptr ++ = '=';
break;
}
*outptr ++ = base64[((in[0] << 2) | (in[1] >> 6)) & 63];
if (outptr < outend)
*outptr ++ = base64[(((in[0] & 255) << 2) | ((in[1] & 255) >> 6)) & 63];
in ++;
if (*in == '\0')
inlen --;
if (inlen <= 0)
{
if (outptr < outend)
*outptr ++ = '=';
break;
}
*outptr ++ = base64[in[0] & 63];
if (outptr < outend)
*outptr ++ = base64[in[0] & 63];
}
*outptr ++ = '=';
*outptr = '\0';
/*
@@ -1803,7 +1920,7 @@ httpEncode64(char *out, /* I - String to write to */
int /* O - Content length */
httpGetLength(http_t *http) /* I - HTTP data */
{
DEBUG_printf(("httpGetLength(%p), state = %d\n", http, http->state));
DEBUG_printf(("httpGetLength(http=%p), state=%d\n", http, http->state));
if (strcasecmp(http->fields[HTTP_FIELD_TRANSFER_ENCODING], "chunked") == 0)
{
@@ -1829,7 +1946,7 @@ httpGetLength(http_t *http) /* I - HTTP data */
else
http->data_remaining = atoi(http->fields[HTTP_FIELD_CONTENT_LENGTH]);
DEBUG_printf(("httpGetLength: content_length = %d\n", http->data_remaining));
DEBUG_printf(("httpGetLength: content_length=%d\n", http->data_remaining));
}
return (http->data_remaining);
@@ -1886,6 +2003,9 @@ http_send(http_t *http, /* I - HTTP data */
/* Hex digits */
DEBUG_printf(("http_send(http=%p, request=HTTP_%s, uri=\"%s\")\n",
http, codes[request], uri));
if (http == NULL || uri == NULL)
return (-1);
@@ -1976,8 +2096,11 @@ http_wait(http_t *http, /* I - HTTP data */
#endif /* !WIN32 */
struct timeval timeout; /* Timeout */
int nfds; /* Result from select() */
int set_size; /* Size of select set */
DEBUG_printf(("http_wait(http=%p, msec=%d)\n", http, msec));
/*
* Check the SSL/TLS buffers for data first...
*/
@@ -2022,7 +2145,11 @@ http_wait(http_t *http, /* I - HTTP data */
getrlimit(RLIMIT_NOFILE, &limit);
http->input_set = calloc(1, (limit.rlim_cur + 31) / 8);
set_size = (limit.rlim_cur + 31) / 8 + 4;
if (set_size < sizeof(fd_set))
set_size = sizeof(fd_set);
http->input_set = calloc(1, set_size);
#endif /* WIN32 */
if (!http->input_set)
@@ -2158,6 +2285,8 @@ http_setup_ssl(http_t *http) /* I - HTTP data */
# endif /* HAVE_LIBSSL */
DEBUG_printf(("http_setup_ssl(http=%p)\n", http));
# ifdef HAVE_LIBSSL
context = SSL_CTX_new(SSLv23_client_method());
conn = SSL_new(context);
@@ -2165,6 +2294,13 @@ http_setup_ssl(http_t *http) /* I - HTTP data */
SSL_set_fd(conn, http->fd);
if (SSL_connect(conn) != 1)
{
# ifdef DEBUG
unsigned long error; /* Error code */
while ((error = ERR_get_error()) != 0)
printf("http_setup_ssl: %s\n", ERR_error_string(error, NULL));
# endif /* DEBUG */
SSL_CTX_free(context);
SSL_free(conn);
+13 -3
Ver Arquivo
@@ -4,7 +4,7 @@
* Hyper-Text Transport Protocol definitions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -354,6 +354,16 @@ extern void httpClearCookie(http_t *http);
extern void httpSetCookie(http_t *http, const char *cookie);
extern int httpWait(http_t *http, int msec);
/**** New in CUPS 1.1.21 ****/
extern char *httpDecode64_2(char *out, int *outlen, const char *in);
extern char *httpEncode64_2(char *out, int outlen, const char *in,
int inlen);
extern void httpSeparate2(const char *uri,
char *method, int methodlen,
char *username, int usernamelen,
char *host, int hostlen, int *port,
char *resource, int resourcelen);
/*
* C++ magic...
+3 -3
Ver Arquivo
@@ -4,7 +4,7 @@
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+24 -12
Ver Arquivo
@@ -4,7 +4,7 @@
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -77,6 +77,10 @@
#include <ctype.h>
#include <errno.h>
#ifdef WIN32
# include <io.h>
#endif // WIN32
/*
* Local functions...
@@ -381,7 +385,7 @@ ippAddString(ipp_t *ipp, /* I - IPP request */
if (*p == '_')
*p = '-';
else
*p = tolower(*p);
*p = tolower(*p & 255);
}
return (attr);
@@ -1718,7 +1722,7 @@ ippWriteIO(void *dst, /* I - Destination */
DEBUG_printf(("ippWrite: writing string = %d, \'%s\'\n", n,
value->string.text));
if ((sizeof(buffer) - (bufptr - buffer)) < (n + 2))
if ((int)(sizeof(buffer) - (bufptr - buffer)) < (n + 2))
{
if ((*cb)(dst, buffer, bufptr - buffer) < 0)
{
@@ -1943,7 +1947,7 @@ ippWriteIO(void *dst, /* I - Destination */
if (n > (sizeof(buffer) - 2))
return (IPP_ERROR);
if ((sizeof(buffer) - (bufptr - buffer)) < (n + 2))
if ((int)(sizeof(buffer) - (bufptr - buffer)) < (n + 2))
{
if ((*cb)(dst, buffer, bufptr - buffer) < 0)
{
@@ -2093,7 +2097,7 @@ ippWriteIO(void *dst, /* I - Destination */
if (n > (sizeof(buffer) - 2))
return (IPP_ERROR);
if ((sizeof(buffer) - (bufptr - buffer)) < (n + 2))
if ((int)(sizeof(buffer) - (bufptr - buffer)) < (n + 2))
{
if ((*cb)(dst, buffer, bufptr - buffer) < 0)
{
@@ -2491,16 +2495,24 @@ ipp_read_http(http_t *http, /* I - Client connection */
* Wait a maximum of 1 second for data...
*/
if (!httpWait(http, 1000))
if (!http->blocking)
{
/*
* Signal no data...
* Wait up to 1 second for more data on non-blocking sockets...
*/
bytes = -1;
break;
if (!httpWait(http, 1000))
{
/*
* Signal no data...
*/
bytes = -1;
break;
}
}
else if ((bytes = httpRead(http, (char *)buffer, length - tbytes)) <= 0)
if ((bytes = httpRead(http, (char *)buffer, length - tbytes)) <= 0)
break;
}
}
+3 -3
Ver Arquivo
@@ -4,7 +4,7 @@
* Internet Printing Protocol definitions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+121 -47
Ver Arquivo
@@ -3,7 +3,7 @@
*
* I18N/language support for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -43,6 +43,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#endif /* HAVE_LANGINFO_H */
#ifdef WIN32
# include <io.h>
#else
@@ -186,10 +189,14 @@ cups_lang_t * /* O - Language data */
cupsLangGet(const char *language) /* I - Language or locale */
{
int i, count; /* Looping vars */
char langname[16], /* Requested language name */
char locale[255], /* Copy of locale name */
langname[16], /* Requested language name */
country[16], /* Country code */
charset[16], /* Character set */
*ptr, /* Pointer into language/ */
#ifdef CODESET
*csptr, /* Pointer to CODESET string */
#endif /* CODESET */
*ptr, /* Pointer into language/charset */
real[48], /* Real language name */
filename[1024], /* Filename for language locale file */
*localedir; /* Directory for locale files */
@@ -203,20 +210,20 @@ cupsLangGet(const char *language) /* I - Language or locale */
static const char * const locale_encodings[] =
{ /* Locale charset names */
"ASCII",
"ISO8859-1",
"ISO8859-2",
"ISO8859-3",
"ISO8859-4",
"ISO8859-5",
"ISO8859-6",
"ISO8859-7",
"ISO8859-8",
"ISO8859-9",
"ISO8859-10",
"UTF-8",
"ISO8859-13",
"ISO8859-14",
"ISO8859-15",
"ISO88591",
"ISO88592",
"ISO88593",
"ISO88594",
"ISO88595",
"ISO88596",
"ISO88597",
"ISO88598",
"ISO88599",
"ISO885910",
"UTF8",
"ISO885913",
"ISO885914",
"ISO885915",
"CP874",
"CP1250",
"CP1251",
@@ -232,6 +239,8 @@ cupsLangGet(const char *language) /* I - Language or locale */
};
DEBUG_printf(("cupsLangGet(language=\"%s\")\n", language ? language : "(null)"));
#ifdef __APPLE__
/*
* Apple's setlocale doesn't give us the user's localization
@@ -240,19 +249,6 @@ cupsLangGet(const char *language) /* I - Language or locale */
if (language == NULL)
language = appleLangDefault();
#elif defined(LC_MESSAGES)
if (language == NULL)
{
/*
* First see if the locale has been set; if it is still "C" or
* "POSIX", set the locale to the default...
*/
language = setlocale(LC_MESSAGES, NULL);
if (!strcmp(language, "C") || !strcmp(language, "POSIX"))
language = setlocale(LC_MESSAGES, "");
}
#else
if (language == NULL)
{
@@ -261,13 +257,74 @@ cupsLangGet(const char *language) /* I - Language or locale */
* "POSIX", set the locale to the default...
*/
language = setlocale(LC_ALL, NULL);
# ifdef LC_MESSAGES
ptr = setlocale(LC_MESSAGES, NULL);
# else
ptr = setlocale(LC_ALL, NULL);
# endif /* LC_MESSAGES */
if (!strcmp(language, "C") || !strcmp(language, "POSIX"))
language = setlocale(LC_ALL, "");
DEBUG_printf(("cupsLangGet: current locale is \"%s\"\n",
ptr ? ptr : "(null)"));
if (!ptr || !strcmp(ptr, "C") || !strcmp(ptr, "POSIX"))
ptr = setlocale(LC_ALL, "");
if (ptr)
{
strlcpy(locale, ptr, sizeof(locale));
language = locale;
DEBUG_printf(("cupsLangGet: new language value is \"%s\"\n",
language ? language : "(null)"));
}
}
#endif /* __APPLE__ */
/*
* If "language" is NULL at this point, then chances are we are using
* a language that is not installed for the base OS.
*/
if (!language)
{
/*
* Switch to the value of the "LANG" environment variable, and if
* that is NULL as well, use "C".
*/
if ((language = getenv("LANG")) == NULL)
language = "C";
}
/*
* Set the charset to "unknown"...
*/
charset[0] = '\0';
#ifdef CODESET
/*
* On systems that support the nl_langinfo(CODESET) call, use
* this value as the character set...
*/
if ((csptr = nl_langinfo(CODESET)) != NULL)
{
/*
* Copy all of the letters and numbers in the CODESET string...
*/
for (ptr = charset; *csptr; csptr ++)
if (isalnum(*csptr & 255) && ptr < (charset + sizeof(charset) - 1))
*ptr++ = *csptr;
*ptr = '\0';
DEBUG_printf(("cupsLangGet: charset set to \"%s\" via nl_langinfo(CODESET)...\n",
charset));
}
#endif /* CODESET */
/*
* Set the locale back to POSIX while we do string ops, since
* apparently some buggy C libraries break ctype() for non-I18N
@@ -292,7 +349,6 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
country[0] = '\0';
charset[0] = '\0';
if (language == NULL || !language[0] ||
strcmp(language, "POSIX") == 0)
@@ -307,7 +363,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
if (*language == '_' || *language == '-' || *language == '.')
break;
else if (ptr < (langname + sizeof(langname) - 1))
*ptr++ = tolower(*language);
*ptr++ = tolower(*language & 255);
*ptr = '\0';
@@ -321,20 +377,20 @@ cupsLangGet(const char *language) /* I - Language or locale */
if (*language == '.')
break;
else if (ptr < (country + sizeof(country) - 1))
*ptr++ = toupper(*language);
*ptr++ = toupper(*language & 255);
*ptr = '\0';
}
if (*language == '.')
if (*language == '.' && !charset[0])
{
/*
* Copy the encoding...
*/
for (language ++, ptr = charset; *language; language ++)
if (ptr < (charset + sizeof(charset) - 1))
*ptr++ = toupper(*language);
if (isalnum(*language & 255) && ptr < (charset + sizeof(charset) - 1))
*ptr++ = toupper(*language & 255);
*ptr = '\0';
}
@@ -363,11 +419,14 @@ cupsLangGet(const char *language) /* I - Language or locale */
_cupsRestoreLocale(LC_CTYPE, oldlocale);
#endif /* __APPLE__ */
DEBUG_printf(("cupsLangGet: langname=\"%s\", country=\"%s\", charset=\"%s\"\n",
langname, country, charset));
/*
* Figure out the desired encoding...
*/
encoding = CUPS_US_ASCII;
encoding = CUPS_AUTO_ENCODING;
if (charset[0])
{
@@ -379,6 +438,10 @@ cupsLangGet(const char *language) /* I - Language or locale */
}
}
DEBUG_printf(("cupsLangGet: encoding=%d(%s)\n", encoding,
encoding == CUPS_AUTO_ENCODING ? "auto" :
lang_encodings[encoding]));
/*
* Now find the message catalog for this locale...
*/
@@ -505,10 +568,12 @@ cupsLangGet(const char *language) /* I - Language or locale */
lang->used ++;
strlcpy(lang->language, real, sizeof(lang->language));
if (charset[0])
if (encoding != CUPS_AUTO_ENCODING)
lang->encoding = encoding;
else
{
lang->encoding = CUPS_US_ASCII;
for (i = 0; i < (sizeof(lang_encodings) / sizeof(lang_encodings[0])); i ++)
if (strcmp(lang_encodings[i], line) == 0)
{
@@ -557,7 +622,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
* Grab the message number and text...
*/
if (isdigit(line[0]))
if (isdigit(line[0] & 255))
msg = (cups_msg_t)atoi(line);
else
msg ++;
@@ -566,9 +631,9 @@ cupsLangGet(const char *language) /* I - Language or locale */
continue;
text = line;
while (isdigit(*text))
while (isdigit(*text & 255))
text ++;
while (isspace(*text))
while (isspace(*text & 255))
text ++;
lang->messages[msg] = strdup(text);
@@ -891,18 +956,27 @@ cups_cache_lookup(const char *name,/* I - Name of locale */
cups_lang_t *lang; /* Current language */
DEBUG_printf(("cups_cache_lookup(name=\"%s\", encoding=%d(%s))\n", name,
encoding, encoding == CUPS_AUTO_ENCODING ? "auto" :
lang_encodings[encoding]));
/*
* Loop through the cache and return a match if found...
*/
for (lang = lang_cache; lang != NULL; lang = lang->next)
if (!strcmp(lang->language, name) && encoding == lang->encoding)
if (!strcmp(lang->language, name) &&
(encoding == CUPS_AUTO_ENCODING || encoding == lang->encoding))
{
lang->used ++;
DEBUG_puts("cups_cache_lookup: returning match!");
return (lang);
}
DEBUG_puts("cups_cache_lookup: returning NULL!");
return (NULL);
}
+4 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Multi-language support for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -161,6 +161,7 @@ typedef enum /**** Message Indices ****/
typedef enum /**** Language Encodings ****/
{
CUPS_AUTO_ENCODING = -1,
CUPS_US_ASCII,
CUPS_ISO8859_1,
CUPS_ISO8859_2,
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option marking routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* MD5 password support for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+8 -8
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -180,7 +180,7 @@ cupsParseOptions(const char *arg, /* I - Argument to parse */
* Skip leading spaces...
*/
while (isspace(*ptr))
while (isspace(*ptr & 255))
ptr ++;
/*
@@ -194,7 +194,7 @@ cupsParseOptions(const char *arg, /* I - Argument to parse */
*/
name = ptr;
while (!isspace(*ptr) && *ptr != '=' && *ptr != '\0')
while (!isspace(*ptr & 255) && *ptr != '=' && *ptr != '\0')
ptr ++;
/*
@@ -208,7 +208,7 @@ cupsParseOptions(const char *arg, /* I - Argument to parse */
* Skip trailing spaces...
*/
while (isspace(*ptr))
while (isspace(*ptr & 255))
*ptr++ = '\0';
if (*ptr != '=')
@@ -310,7 +310,7 @@ cupsParseOptions(const char *arg, /* I - Argument to parse */
value = ptr;
while (!isspace(*ptr) && *ptr != '\0')
while (!isspace(*ptr & 255) && *ptr != '\0')
{
if (*ptr == '\\')
cups_strcpy(ptr, ptr + 1);
@@ -323,7 +323,7 @@ cupsParseOptions(const char *arg, /* I - Argument to parse */
* Skip trailing whitespace...
*/
while (isspace(*ptr))
while (isspace(*ptr & 255))
*ptr++ = '\0';
/*
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Page size functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+47 -35
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD file routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -114,7 +114,7 @@ static ppd_size_t *ppd_add_size(ppd_file_t *ppd, const char *name);
static int ppd_compare_groups(ppd_group_t *g0, ppd_group_t *g1);
static int ppd_compare_options(ppd_option_t *o0, ppd_option_t *o1);
#endif /* !__APPLE__ */
static void ppd_decode(char *string);
static int ppd_decode(char *string);
#ifndef __APPLE__
static void ppd_fix(char *string);
#else
@@ -595,11 +595,7 @@ ppdOpen(FILE *fp) /* I - File to read from */
cupsLangString(language, CUPS_MSG_GENERAL));
if (group == NULL)
{
ppd_status = PPD_ALLOC_ERROR;
goto error;
}
DEBUG_printf(("Adding to group %s...\n", group->text));
option = ppd_get_option(group, keyword);
@@ -832,8 +828,6 @@ ppdOpen(FILE *fp) /* I - File to read from */
{
DEBUG_puts("Unable to get general group!");
ppd_status = PPD_ALLOC_ERROR;
goto error;
}
@@ -979,7 +973,7 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (name[0] == '*')
cups_strcpy(name, name + 1); /* Eliminate leading asterisk */
for (i = strlen(name) - 1; i > 0 && isspace(name[i]); i --)
for (i = strlen(name) - 1; i > 0 && isspace(name[i] & 255); i --)
name[i] = '\0'; /* Eliminate trailing spaces */
DEBUG_printf(("OpenUI of %s in group %s...\n", name,
@@ -1002,11 +996,7 @@ ppdOpen(FILE *fp) /* I - File to read from */
cupsLangString(language, CUPS_MSG_GENERAL));
if (group == NULL)
{
ppd_status = PPD_ALLOC_ERROR;
goto error;
}
DEBUG_printf(("Adding to group %s...\n", group->text));
option = ppd_get_option(group, name);
@@ -1104,11 +1094,7 @@ ppdOpen(FILE *fp) /* I - File to read from */
group = ppd_get_group(ppd, "JCL", "JCL");
if (group == NULL)
{
ppd_status = PPD_ALLOC_ERROR;
goto error;
}
/*
* Add an option record to the current JCLs...
@@ -1213,6 +1199,9 @@ ppdOpen(FILE *fp) /* I - File to read from */
group = ppd_get_group(ppd, string, sptr);
if (group == NULL)
goto error;
ppd_free(string);
string = NULL;
}
@@ -1927,7 +1916,7 @@ ppd_compare_options(ppd_option_t *o0, /* I - First option */
* 'ppd_decode()' - Decode a string value...
*/
static void
static int /* O - Length of decoded string */
ppd_decode(char *string) /* I - String to decode */
{
char *inptr, /* Input pointer */
@@ -1938,14 +1927,14 @@ ppd_decode(char *string) /* I - String to decode */
outptr = string;
while (*inptr != '\0')
if (*inptr == '<' && isxdigit(inptr[1]))
if (*inptr == '<' && isxdigit(inptr[1] & 255))
{
/*
* Convert hex to 8-bit values...
*/
inptr ++;
while (isxdigit(*inptr))
while (isxdigit(*inptr & 255))
{
if (isalpha(*inptr))
*outptr = (tolower(*inptr) - 'a' + 10) << 4;
@@ -1954,6 +1943,9 @@ ppd_decode(char *string) /* I - String to decode */
inptr ++;
if (!isxdigit(*inptr & 255))
break;
if (isalpha(*inptr))
*outptr |= tolower(*inptr) - 'a' + 10;
else
@@ -1972,6 +1964,8 @@ ppd_decode(char *string) /* I - String to decode */
*outptr++ = *inptr++;
*outptr = '\0';
return (outptr - string);
}
@@ -2111,6 +2105,13 @@ ppd_get_group(ppd_file_t *ppd, /* I - PPD file */
{
DEBUG_printf(("Adding group %s...\n", name));
if (ppd_conform == PPD_CONFORM_STRICT && strlen(text) >= sizeof(group->text))
{
ppd_status = PPD_ILLEGAL_TRANSLATION;
return (NULL);
}
if (ppd->num_groups == 0)
group = malloc(sizeof(ppd_group_t));
else
@@ -2118,7 +2119,11 @@ ppd_get_group(ppd_file_t *ppd, /* I - PPD file */
(ppd->num_groups + 1) * sizeof(ppd_group_t));
if (group == NULL)
{
ppd_status = PPD_ALLOC_ERROR;
return (NULL);
}
ppd->groups = group;
group += ppd->num_groups;
@@ -2193,7 +2198,8 @@ ppd_read(FILE *fp, /* I - File to read from */
colon, /* Colon seen? */
endquote, /* Waiting for an end quote */
mask, /* Mask to be returned */
startline; /* Start line */
startline, /* Start line */
textlen; /* Length of text */
char *keyptr, /* Keyword pointer */
*optptr, /* Option pointer */
*textptr, /* Text pointer */
@@ -2478,7 +2484,7 @@ ppd_read(FILE *fp, /* I - File to read from */
*/
for (lineptr = line; *lineptr; lineptr ++)
if (!isspace(*lineptr))
if (!isspace(*lineptr & 255))
break;
if (*lineptr)
@@ -2498,7 +2504,7 @@ ppd_read(FILE *fp, /* I - File to read from */
keyptr = keyword;
while (*lineptr != '\0' && *lineptr != ':' && !isspace(*lineptr))
while (*lineptr != '\0' && *lineptr != ':' && !isspace(*lineptr & 255))
{
if (*lineptr <= ' ' || *lineptr > 126 || *lineptr == '/' ||
(keyptr - keyword) >= (PPD_MAX_NAME - 1))
@@ -2519,18 +2525,18 @@ ppd_read(FILE *fp, /* I - File to read from */
/* DEBUG_printf(("keyword = \"%s\", lineptr = \"%s\"\n", keyword, lineptr));*/
if (isspace(*lineptr))
if (isspace(*lineptr & 255))
{
/*
* Get an option name...
*/
while (isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
optptr = option;
while (*lineptr != '\0' && !isspace(*lineptr) && *lineptr != ':' &&
while (*lineptr != '\0' && !isspace(*lineptr & 255) && *lineptr != ':' &&
*lineptr != '/')
{
if (*lineptr <= ' ' || *lineptr > 126 ||
@@ -2545,13 +2551,13 @@ ppd_read(FILE *fp, /* I - File to read from */
*optptr = '\0';
if (isspace(*lineptr) && ppd_conform == PPD_CONFORM_STRICT)
if (isspace(*lineptr & 255) && ppd_conform == PPD_CONFORM_STRICT)
{
ppd_status = PPD_ILLEGAL_WHITESPACE;
return (0);
}
while (isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
mask |= PPD_OPTION;
@@ -2581,21 +2587,27 @@ ppd_read(FILE *fp, /* I - File to read from */
}
*textptr = '\0';
ppd_decode(text);
textlen = ppd_decode(text);
if (textlen > PPD_MAX_TEXT && ppd_conform == PPD_CONFORM_STRICT)
{
ppd_status = PPD_ILLEGAL_TRANSLATION;
return (0);
}
mask |= PPD_TEXT;
}
/* DEBUG_printf(("text = \"%s\", lineptr = \"%s\"\n", text, lineptr));*/
}
if (isspace(*lineptr) && ppd_conform == PPD_CONFORM_STRICT)
if (isspace(*lineptr & 255) && ppd_conform == PPD_CONFORM_STRICT)
{
ppd_status = PPD_ILLEGAL_WHITESPACE;
return (0);
}
while (isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
if (*lineptr == ':')
@@ -2605,11 +2617,11 @@ ppd_read(FILE *fp, /* I - File to read from */
*/
lineptr ++;
while (isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
strptr = lineptr + strlen(lineptr) - 1;
while (strptr >= lineptr && isspace(*strptr))
while (strptr >= lineptr && isspace(*strptr & 255))
*strptr-- = '\0';
if (*strptr == '\"')
+3 -3
Ver Arquivo
@@ -4,7 +4,7 @@
* PostScript Printer Description definitions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+104 -66
Ver Arquivo
@@ -3,7 +3,7 @@
*
* snprintf functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -61,6 +61,7 @@ cups_vsnprintf(char *buffer, /* O - Output buffer */
temp[1024]; /* Buffer for formatted numbers */
char *s; /* Pointer to string */
int slen; /* Length of string */
int bytes; /* Total number of bytes needed */
/*
@@ -69,8 +70,9 @@ cups_vsnprintf(char *buffer, /* O - Output buffer */
bufptr = buffer;
bufend = buffer + bufsize - 1;
bytes = 0;
while (*format && bufptr < bufend)
while (*format)
{
if (*format == '%')
{
@@ -131,16 +133,21 @@ cups_vsnprintf(char *buffer, /* O - Output buffer */
sprintf(temp, tformat, va_arg(ap, double));
if ((bufptr + strlen(temp)) > bufend)
bytes += strlen(temp);
if (bufptr)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
if ((bufptr + strlen(temp)) > bufend)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
}
}
break;
@@ -161,16 +168,21 @@ cups_vsnprintf(char *buffer, /* O - Output buffer */
sprintf(temp, tformat, va_arg(ap, int));
if ((bufptr + strlen(temp)) > bufend)
bytes += strlen(temp);
if (bufptr)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
if ((bufptr + strlen(temp)) > bufend)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
}
}
break;
@@ -184,29 +196,39 @@ cups_vsnprintf(char *buffer, /* O - Output buffer */
sprintf(temp, tformat, va_arg(ap, void *));
if ((bufptr + strlen(temp)) > bufend)
bytes += strlen(temp);
if (bufptr)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
if ((bufptr + strlen(temp)) > bufend)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
}
}
break;
case 'c' : /* Character or character array */
if (width <= 1)
*bufptr++ = va_arg(ap, int);
else
{
if ((bufptr + width) > bufend)
width = bufend - bufptr;
bytes += width;
memcpy(bufptr, va_arg(ap, char *), width);
bufptr += width;
if (bufptr)
{
if (width <= 1)
*bufptr++ = va_arg(ap, int);
else
{
if ((bufptr + width) > bufend)
width = bufend - bufptr;
memcpy(bufptr, va_arg(ap, char *), width);
bufptr += width;
}
}
break;
@@ -218,24 +240,29 @@ cups_vsnprintf(char *buffer, /* O - Output buffer */
if (slen > width && prec != width)
width = slen;
if ((bufptr + width) > bufend)
width = bufend - bufptr;
bytes += width;
if (slen > width)
slen = width;
if (sign == '-')
if (bufptr)
{
strncpy(bufptr, s, slen);
memset(bufptr + slen, ' ', width - slen);
}
else
{
memset(bufptr, ' ', width - slen);
strncpy(bufptr + width - slen, s, slen);
}
if ((bufptr + width) > bufend)
width = bufend - bufptr;
bufptr += width;
if (slen > width)
slen = width;
if (sign == '-')
{
strncpy(bufptr, s, slen);
memset(bufptr + slen, ' ', width - slen);
}
else
{
memset(bufptr, ' ', width - slen);
strncpy(bufptr + width - slen, s, slen);
}
bufptr += width;
}
break;
case 'n' : /* Output number of chars so far */
@@ -248,30 +275,41 @@ cups_vsnprintf(char *buffer, /* O - Output buffer */
sprintf(temp, tformat, va_arg(ap, int));
if ((bufptr + strlen(temp)) > bufend)
bytes += strlen(temp);
if (bufptr)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
if ((bufptr + strlen(temp)) > bufend)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
}
}
break;
}
}
else
*bufptr++ = *format++;
{
bytes ++;
if (bufptr && bufptr < bufend)
*bufptr++ = *format++;
}
}
/*
* Nul-terminate the string and return the number of characters in it.
* Nul-terminate the string and return the number of characters needed.
*/
*bufptr = '\0';
return (bufptr - buffer);
return (bytes);
}
#endif /* !HAVE_VSNPRINT */
+7 -7
Ver Arquivo
@@ -3,7 +3,7 @@
*
* String functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -88,9 +88,9 @@ cups_strcasecmp(const char *s, /* I - First string */
{
while (*s != '\0' && *t != '\0')
{
if (tolower(*s) < tolower(*t))
if (tolower(*s & 255) < tolower(*t & 255))
return (-1);
else if (tolower(*s) > tolower(*t))
else if (tolower(*s & 255) > tolower(*t & 255))
return (1);
s ++;
@@ -118,9 +118,9 @@ cups_strncasecmp(const char *s, /* I - First string */
{
while (*s != '\0' && *t != '\0' && n > 0)
{
if (tolower(*s) < tolower(*t))
if (tolower(*s & 255) < tolower(*t & 255))
return (-1);
else if (tolower(*s) > tolower(*t))
else if (tolower(*s & 255) > tolower(*t & 255))
return (1);
s ++;
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* String definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Temp file utilities for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2003 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*

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