Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet eed496f916 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.2.8@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
501 arquivos alterados com 25212 adições e 5616 exclusões
+190 -1
Ver Arquivo
@@ -1,6 +1,195 @@
CHANGES.txt - 2006-09-21
CHANGES.txt - 2007-02-06
------------------------
CHANGES IN CUPS V1.2.8
- Documentation fixes (STR #2141, STR #2157)
- The HTTP upgrade redirection used by the scheduler did
not work with Internet Explorer (STR #2235)
- Members of a class with Unicode names did not appear
correctly in the web interface (STR #2154)
- Changing the "Save debugging information" setting in
the web interface no longer affects the other server
settings (STR #1993)
- The scheduler did not choose SSL certificates correctly
on Mac OS X (STR #2225)
- The scheduler could get in an infinite loop when
printing to a remote class (STR #2228)
- The jobs web page did not have separating space after
the number of pages column (STR #2230)
- Added French localization (STR #2221)
- Updated Spanish localization (STR #2223)
- Updated Japanese localization (STR #2216)
- cupsBorderlessScalingFacter was limited to a range of
0.9 to 1.1, but some printers need larger values (STR
#2222)
- Landscape printing of PDF files did not always work
(STR #2149)
- Fixed slow USB printing on Minolta printers (STR #2104,
STR #2219)
- The ZPL label printer driver could produce stretched
output (PR #6448)
- The IPP backend now clears the printer-state-message
when there are no outstanding errors or warnings (STR
#2126)
- The CUPS Java scripting support did not work with
recent versions of Java due to the use of Sun's private
Base64 class (STR #2152)
- The scheduler did not pass HTTP GET form variables to
custom CGI programs (STR #2173)
- The lpoptions command now displays the reason why a PPD
file cannot be found (STR #2184)
- The scheduler did not accept "none" as a browse
protocol name (STR #2200)
- The scheduler still loaded the remote printer cache,
even when browsing was disabled (STR #2198)
- The SNMP backend now shows OfficeJet printers with the
"HP" manufacturer prefix (STR #2151)
- Web interface HTML cleanup (STR #2153)
- The parallel backend consumed 100% CPU on FreeBSD due
to an apparently common parallel port driver bug (STR
#2161)
- ippReadIO() incorrectly returned IPP_IDLE when the
initial IPP message header could not be read (STR
#2179)
- cupsRasterInterpretPPD() did not support custom options
(STR #1960)
- Collated output produced by the PostScript filter could
lose some options (STR #2137)
- job-hold-until with time values for the next day would
be held for 60 days (STR #2144)
- Some types of Sun raster files did not print correctly
(STR #2107)
- Raw PBM files did not print correctly (STR #2106)
- The SNMP backend no longer uses IPP with HP printers,
as some recent firmware versions appear to not work
(STR #2055)
- cupsMarkOptions() did not handle the
multiple-document-handling option (STR #2135)
- lpstat did not show the local job ID of active printers
(STR #2125)
- The backends incorrectly used STATUS:
media-tray-empty-error messages for out-of-paper
conditions (STR #2123, STR #2124)
- cupsGetPPD2() returned the wrong error when the PPD
file did not exist (STR #2122)
- cupsDoAuthentication() did not translate the password
prompt (STR #2121)
- httpGetLength2() did not handle error messages without
content correctly (STR #2133)
- Added support for 32/64-bit libraries on HP-UX Itanium
systems (STR #2115)
- Fixed a configure script problem with the 32/64-bit
library support (STR #2114)
- The PostScript filter did not properly output document
setup commands for reversed output (STR #2111)
- The scheduler did not parse IPv6 netmasks properly (STR
#2117)
CHANGES IN CUPS V1.2.7
- Documentation updates (STR #2089)
- Added an Italian translation (STR #2105)
- The PostScript filter now rotates the bounding box
values as needed (STR #2079)
- The scheduler no longer loads the remote printer cache
when browsing is disabled (STR #2084)
- The scheduler no longer writes a new launchd
configuration file if it doesn't have to (STR #2083)
- Updated the USB and PAP backends for Mac OS X (STR
#2086)
- The scheduler now picks up on changes to IPv6 and DNS
configuration on Mac OS X (STR #2085)
- The lpstat program could still hang (STR #2098)
- Fixed an inefficiency in the SNMP IPP detection code
(STR #2100)
- The SSL negotiation code did not implement short
timeouts (STR #2091)
CHANGES IN CUPS V1.2.6
- The web interface was not localized on Mac OS X (STR
#2075)
- "lpc status" did not show the number of queued jobs for
disabled queues (STR #2069)
- The lpstat program could hang (STR #2073)
- The serial backend did not support the new USB serial
filenames on Linux (STR #2061)
- The parallel backend did not support bidirectional I/O
properly (STR #2056)
- The network backends now log the numeric address that
is being used (STR #2046)
- Fixed a compile error when using libpaper.
- Fixed a compile error when compiling on Solaris with
threading enabled (STR #2049, STR #2050)
- Missing printer-state-changed event for
printer-state-message updates (STR #2047)
CHANGES IN CUPS V1.2.5
- Documentation updates (STR #2038)
- The SNMP backend no longer uses IPP for Epson printers
(STR #2028)
- Updated the configure script for Tru64 UNIX 5.1 (STR
#2033)
- Tru64 5.1B's getaddrinfo() and getnameinfo() functions
leak file descriptors (STR #2034)
- cupsAddDest() didn't add the parent destination's
options and attributes.
- ppdConflicts() did not handle custom option
constraints.
- Raw printing of gzip'd files did not work (STR #2009)
- The scheduler no longer preserves default option
choices when the new PPD no longer provides the old
default choice (STR #1929)
- The Linux SCSI backend is now only built if the SCSI
development headers are installed.
- USB printing to Minolta printers did not work (STR
#2019)
- Windows clients could not monitor the queue status (STR
#2006)
- The scheduler didn't log the operation name in the
access_log file for Create-Job and Print-Job requests.
- The PostScript filter now separates collated copies
with any required JCL commands so that JCL-based
finishing options act on the individual copies and not
all of the copies as a single document.
- The PostScript filter now disables duplex printing when
printing a 1-page document.
- cups-lpd didn't pass the correct
job-originating-host-name value (STR #2023)
- Fixed some speling errors in the German message catalog
(STR #2012)
- cupstestppd did not catch PPD files with bad
UIConstraints values (STR #2016)
- The USB backend did not work with the current udev-
created printers if the first printer was disconnected
(STR #2017)
- Mirrored and rotated printing did not work with some
documents (STR #2004)
- 2-sided printing with banners did not work properly on
some printers (STR #2018)
- Updated the raw type rule to handle PJL within the
first 4k of a print job (STR #1969)
- Added an Estonian translation (STR #1957)
- Clarified the documentation for the cupsd.conf @LOCAL
and @IF(name) allow/deny functionality (STR #1992)
- The PostScript filters did not escape the Title and For
comments in the print job header (STR #1988)
- The scheduler would use 100% CPU if browsing was
disabled and the cupsd.conf file contained BrowsePoll
lines (STR #1994)
- The cupsDirRead() function did not work properly on
non-POSIX-compliant systems (STR #2001)
- The cupsFile functions didn't handle read/write errors
properly (STR #1996)
- The DBUS support now works with older versions of the
DBUS library.
CHANGES IN CUPS V1.2.4
- The --with-printcap configure option did not work (STR
+5 -2
Ver Arquivo
@@ -1,4 +1,4 @@
CREDITS.txt - 2006-04-17
CREDITS.txt - 2007-02-05
------------------------
Few projects are completed by one person, and CUPS is no exception. We'd
@@ -6,6 +6,7 @@ like to thank the following individuals for their contributions:
Nathaniel Barbour - Lots of testing and feedback.
N. Becker - setsid().
Philippe Combes - French localization.
Jean-Eric Cuendet - GhostScript filters for CUPS.
Van Dang - HTTP and IPP policeman.
L. Peter Deutsch - MD5 code.
@@ -20,6 +21,7 @@ like to thank the following individuals for their contributions:
testing.
Kiko - Bug fixes.
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
Marek Laane - Estonian translation.
Mark Lawrence - Microsoft interoperability testing.
Jeff Licquia - Bug fixes, beta testing, evangelism.
Jason McMullan - Original CUPS RPM distributions.
@@ -28,8 +30,9 @@ like to thank the following individuals for their contributions:
Giulio Orsero - Bug fixes and testing.
Michal Osowiecki - Polish localization.
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
Vincenzo Reale - Italian localization.
Petter Reinholdtsen - HP-UX compiler stuff.
Juan Pablo González Riopedre - Spanish localization
Juan Pablo González Riopedre - Spanish localization.
Stuart Stevens - HP JetDirect IPP information.
Andrea Suatoni - IRIX desktop integration and testing.
Tomohiro Kato - Japanese localization.
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
INSTALL - CUPS v1.2.0 - 2006-05-08
INSTALL - CUPS v1.2.8 - 2007-02-14
----------------------------------
This file describes how to compile and install CUPS from source
+18 -21
Ver Arquivo
@@ -1,6 +1,6 @@
Common UNIX Printing System License Agreement
Copyright 1997-2006 by Easy Software Products
Copyright 1997-2007 by Easy Software Products
44141 AIRPORT VIEW DR STE 204
HOLLYWOOD, MARYLAND 20636 USA
@@ -17,12 +17,12 @@ General Public License ("LGPL"), Version 2, with exceptions for
Apple operating systems and the OpenSSL toolkit. A copy of the
exceptions and licenses follow this introduction.
The GNU LGPL applies to the CUPS API library, located in the
"cups" subdirectory of the CUPS source distribution and in the
"cups" include directory and library files in the binary
distributions. The GNU GPL applies to the remainder of the CUPS
distribution, including the "pdftops" filter which is based upon
Xpdf and the CUPS imaging library.
The GNU LGPL applies to the CUPS and CUPS Imaging libraries
located in the "cups" and "filter" subdirectories of the CUPS
source distribution and in the "cups" include directory and
library files in the binary distributions. The GNU GPL applies to
the remainder of the CUPS distribution, including the "pdftops"
filter which is based upon Xpdf.
For those not familiar with the GNU GPL, the license basically
allows you to:
@@ -32,22 +32,19 @@ allows you to:
binary form.
- Sell verbatim copies of the software for a media fee, or
sell support for the software.
- Distribute or sell printer drivers and filters that use
CUPS so long as source code is made available under the
GPL.
What this license *does not* allow you to do is make changes or
add features to CUPS and then sell a binary distribution without
source code. You must provide source for any new drivers,
changes, or additions to the software, and all code must be
provided under the GPL or LGPL as appropriate. The only
exceptions to this are the portions of the CUPS software covered
by the Apple operating system license exceptions outlined later
in this license agreement.
source code. You must provide source for any changes or additions
to the software, and all code must be provided under the GPL or
LGPL as appropriate. The only exceptions to this are the portions
of the CUPS software covered by the Apple operating system
license exceptions outlined later in this license agreement.
The GNU LGPL relaxes the "link-to" restriction, allowing you to
develop applications that use the CUPS API library under other
licenses and/or conditions as appropriate for your application.
develop applications that use the CUPS and CUPS Imaging libraries
under other licenses and/or conditions as appropriate for your
application, driver, or filter.
LICENSE EXCEPTIONS
@@ -119,9 +116,9 @@ BINARY DISTRIBUTION RIGHTS
Easy Software Products also sells rights to the CUPS source code
under a binary distribution license for vendors that are unable
to release source code for their drivers, additions, and
modifications to CUPS under the GNU GPL and LGPL. For
information please contact us at the address shown above.
to release source code for their additions and modifications to
CUPS under the GNU GPL and LGPL. For information please contact
us at the address shown above.
The Common UNIX Printing System provides a "pdftops" filter that
is based on the Xpdf software. For binary distribution licensing
+4 -1
Ver Arquivo
@@ -237,7 +237,7 @@ check: all
EPMFLAGS = -v --output-dir dist $(EPMARCH)
aix bsd deb depot inst pkg rpm setld slackware swinstall tardist:
aix bsd deb depot inst pkg setld slackware swinstall tardist:
epm $(EPMFLAGS) -f $@ cups packaging/cups.list
epm:
@@ -246,6 +246,9 @@ epm:
osx:
epm $(EPMFLAGS) -f osx -s packaging/installer.tif cups packaging/cups.list
rpm:
epm $(EPMFLAGS) -f rpm -s packaging/installer.gif cups packaging/cups.list
.PHONEY: dist
dist: all
$(RM) -r dist
+2 -2
Ver Arquivo
@@ -1,4 +1,4 @@
README - CUPS v1.2.3 - 2006-08-28
README - CUPS v1.2.8 - 2007-02-14
---------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
@@ -170,7 +170,7 @@ PRINTING FILES
LEGAL STUFF
CUPS is Copyright 1993-2006 by Easy Software Products. CUPS,
CUPS is Copyright 1993-2007 by Easy Software Products. CUPS,
the CUPS logo, and the Common UNIX Printing System are the
trademark property of Easy Software Products.
+1 -1
Ver Arquivo
@@ -46,7 +46,7 @@ all: $(TARGETS)
#
clean:
$(RM) $(OBJS) $(TARGETS) http
$(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http
#
+14 -1
Ver Arquivo
@@ -107,6 +107,7 @@ main(int argc, /* I - Number of command-line args */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
addrname[256], /* Address name */
*optptr, /* Pointer to URI options */
name[255], /* Name of option */
value[255], /* Value of option */
@@ -574,6 +575,18 @@ main(int argc, /* I - Number of command-line args */
fputs("STATE: -connecting-to-device\n", stderr);
fprintf(stderr, "INFO: Connected to %s...\n", hostname);
#ifdef AF_INET6
if (http->hostaddr->addr.sa_family == AF_INET6)
fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6)...\n",
httpAddrString(http->hostaddr, addrname, sizeof(addrname)),
ntohs(http->hostaddr->ipv6.sin6_port));
else
#endif /* AF_INET6 */
if (http->hostaddr->addr.sa_family == AF_INET)
fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4)...\n",
httpAddrString(http->hostaddr, addrname, sizeof(addrname)),
ntohs(http->hostaddr->ipv4.sin_port));
/*
* Build a URI for the printer and fill the standard IPP attributes for
* an IPP_PRINT_FILE request. We can't use the URI in argv[0] because it
@@ -1367,7 +1380,7 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */
strlcat(state, reason, sizeof(state));
prefix = ",";
message = NULL;
message = "";
if (!strncmp(reason, "media-needed", 12))
message = "Media tray needs to be filled.";
+13 -2
Ver Arquivo
@@ -582,6 +582,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
*cptr; /* Pointer into control file string */
char status; /* Status byte from command */
char portname[255]; /* Port name */
char addrname[256]; /* Address name */
http_addrlist_t *addrlist, /* Address list */
*addr; /* Socket address */
int copy; /* Copies written */
@@ -820,8 +821,18 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
fputs("STATE: -connecting-to-device\n", stderr);
fprintf(stderr, "INFO: Connected to %s...\n", hostname);
fprintf(stderr, "DEBUG: Connected on ports %d (local %d)...\n", port,
lport);
#ifdef AF_INET6
if (addr->addr.addr.sa_family == AF_INET6)
fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6) (local port %d)...\n",
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
ntohs(addr->addr.ipv6.sin6_port), lport);
else
#endif /* AF_INET6 */
if (addr->addr.addr.sa_family == AF_INET)
fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4) (local port %d)...\n",
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
ntohs(addr->addr.ipv4.sin_port), lport);
/*
* Next, open the print file and figure out its size...
+198 -168
Ver Arquivo
@@ -42,31 +42,35 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*
* This program implements the Printer Access Protocol (PAP) on top of AppleTalk Transaction
* Protocol (ATP). If it were to use the blocking pap functions of the AppleTalk library it
* would need seperate threads for reading, writing and status.
* This program implements the Printer Access Protocol (PAP) on top of AppleTalk
* Transaction Protocol (ATP). If it were to use the blocking pap functions of
* the AppleTalk library it would need seperate threads for reading, writing
* and status.
*
* Contents:
*
* main() - Send a file to the specified Appletalk printer.
* listDevices() - List all LaserWriter printers in the local zone.
* printFile() - Print from a file descriptor to an NBP specified printer.
* printFile() - Print file.
* papOpen() - Open a pap session to a printer.
* papClose() - Close a pap session after cleaning up pending transactions.
* papClose() - Close a pap session.
* papWrite() - Write bytes to a printer.
* papCloseResp() - Send a pap close response in the rare case we receive a close connection request.
* papCloseResp() - Send a pap close response.
* papSendRequest() - Fomrat and send a pap packet.
* papCancelRequest() - Cancel a pending pap request.
* statusUpdate() - Print printer status to stderr.
* parseUri() - Extract the print name and zone from a uri.
* addPercentEscapes() - Encode a string with percent escapes.
* removePercentEscapes - Returns a string with any percent escape sequences replaced with their equivalent.
* removePercentEscapes - Remove percent escape sequences from a string.
* nbptuple_compare() - Compare routine for qsort.
* okayToUseAppleTalk() - Returns true if AppleTalk is available and enabled.
* packet_name() - Returns packet name string.
* connectTimeout() - Returns the connect timeout preference value.
* signalHandler() - handle SIGINT to close the session before quiting.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -86,7 +90,8 @@
#include <netat/nbp.h>
#include <netat/pap.h>
#include <cups/http.h>
#include <cups/cups.h>
#include <cups/backend.h>
#include <libkern/OSByteOrder.h>
@@ -95,19 +100,25 @@
#else
/* These definitions come from at_proto.h... */
# define ZIP_DEF_INTERFACE NULL
enum { RUNNING, NOTLOADED, LOADED, OTHERERROR }; /* Appletalk Stack status Function. */
enum { RUNNING, NOTLOADED, LOADED, OTHERERROR };
extern int atp_abort(int fd, at_inet_t *dest, u_short tid);
extern int atp_close(int fd);
extern int atp_getreq(int fd, at_inet_t *src, char *buf, int *len, int *userdata, int *xo, u_short *tid, u_char *bitmap, int nowait);
extern int atp_getreq(int fd, at_inet_t *src, char *buf, int *len, int *userdata,
int *xo, u_short *tid, u_char *bitmap, int nowait);
extern int atp_getresp(int fd, u_short *tid, at_resp_t *resp);
extern int atp_look(int fd);
extern int atp_open(at_socket *sock);
extern int atp_sendreq(int fd, at_inet_t *dest, char *buf, int len, int userdata, int xo, int xo_relt, u_short *tid, at_resp_t *resp, at_retry_t *retry, int nowait);
extern int atp_sendrsp(int fd, at_inet_t *dest, int xo, u_short tid, at_resp_t *resp);
extern int atp_sendreq(int fd, at_inet_t *dest, char *buf, int len,
int userdata, int xo, int xo_relt, u_short *tid,
at_resp_t *resp, at_retry_t *retry, int nowait);
extern int atp_sendrsp(int fd, at_inet_t *dest, int xo, u_short tid,
at_resp_t *resp);
extern int checkATStack();
extern int nbp_lookup(at_entity_t *entity, at_nbptuple_t *buf, int max, at_retry_t *retry);
extern int nbp_make_entity(at_entity_t *entity, char *obj, char *type, char *zone);
extern int nbp_lookup(at_entity_t *entity, at_nbptuple_t *buf, int max,
at_retry_t *retry);
extern int nbp_make_entity(at_entity_t *entity, char *obj, char *type,
char *zone);
extern int zip_getmyzone(char *ifName, at_nvestr_t *zone);
#endif /* HAVE_APPLETALK_AT_PROTO_H */
@@ -116,7 +127,7 @@ extern int zip_getmyzone(char *ifName, at_nvestr_t *zone);
#include <CoreFoundation/CFPreferences.h>
/* Defines */
#define MAX_PRINTERS 500 /* Max number of printers we can lookup in listDevices */
#define MAX_PRINTERS 500 /* Max number of printers we can lookup */
#define PAP_CONNID 0
#define PAP_TYPE 1
#define PAP_EOF 2
@@ -126,43 +137,35 @@ extern int zip_getmyzone(char *ifName, at_nvestr_t *zone);
#define SEQUENCE_NUM(p) (((u_char *)&p)[2])
#define IS_PAP_EOF(p) (((u_char *)&p)[2])
#define PAPPacketStr(x) \
((x) == AT_PAP_TYPE_OPEN_CONN) ? "PAP_OPEN_CONN" : \
((x) == AT_PAP_TYPE_OPEN_CONN_REPLY) ? "PAP_OPEN_CONN_REPLY" : \
((x) == AT_PAP_TYPE_SEND_DATA) ? "PAP_SEND_DATA" : \
((x) == AT_PAP_TYPE_DATA) ? "PAP_DATA" : \
((x) == AT_PAP_TYPE_TICKLE) ? "PAP_TICKLE" : \
((x) == AT_PAP_TYPE_CLOSE_CONN) ? "PAP_CLOSE_CONN" : \
((x) == AT_PAP_TYPE_CLOSE_CONN_REPLY) ? "PAP_CLOSE_CONN_REPLY" : \
((x) == AT_PAP_TYPE_SEND_STATUS) ? "PAP_SEND_STATUS" : \
((x) == AT_PAP_TYPE_SEND_STS_REPLY) ? "PAP_SEND_STS_REPLY" : \
((x) == AT_PAP_TYPE_READ_LW) ? "PAP_READ_LW" : \
"<Unknown>"
#ifndef true
#define true 1
#define false 0
#endif
/* Globals */
int gSockfd = 0; /* Socket descriptor */
at_inet_t gSessionAddr = { 0 }; /* Address of the session responding socket */
u_char gConnID = 0; /* PAP session connection id */
u_short gSendDataID = 0; /* Transaction id of our pending send-data request */
u_short gTickleID = 0; /* Transaction id of our outstanding tickle request*/
int gWaitEOF = false; /* Option: causes us to wait for a remote's EOF */
int gSockfd = 0; /* Socket descriptor */
at_inet_t gSessionAddr = { 0 }; /* Address of the session responding socket */
u_char gConnID = 0; /* PAP session connection id */
u_short gSendDataID = 0; /* Transaction id of pending send-data request */
u_short gTickleID = 0; /* Transaction id of outstanding tickle request*/
int gWaitEOF = false; /* Option: wait for a remote's EOF */
int gStatusInterval= 5; /* Option: 0=off else seconds between status requests*/
int gErrorlogged = false; /* If an error was logged don't send any more INFO messages */
int gDebug = 0; /* Option: causes us to emit debugging info */
int gDebug = 0; /* Option: emit debugging info */
/* Local functions */
static int listDevices(void);
static int printFile(char* name, char* type, char* zone, int fdin, int fdout, int fderr, int copies, int argc);
static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd, at_inet_t* pap_to, u_char* flowQuantum);
static int papClose(int abortflag);
static int papWrite(int sockfd, at_inet_t* dest, u_short tid, u_char connID, u_char flowQuantum, char* data, int len, int eof);
static int papCloseResp(int sockfd, at_inet_t* dest, int xo, u_short tid, u_char connID);
static int papSendRequest(int sockfd, at_inet_t* dest, u_char connID, int function, u_char bitmap, int xo, int seqno);
static int printFile(char* name, char* type, char* zone, int fdin, int fdout,
int fderr, int copies, int argc);
static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
at_inet_t* pap_to, u_char* flowQuantum);
static int papClose();
static int papWrite(int sockfd, at_inet_t* dest, u_short tid, u_char connID,
u_char flowQuantum, char* data, int len, int eof);
static int papCloseResp(int sockfd, at_inet_t* dest, int xo, u_short tid,
u_char connID);
static int papSendRequest(int sockfd, at_inet_t* dest, u_char connID,
int function, u_char bitmap, int xo, int seqno);
static int papCancelRequest(int sockfd, u_short tid);
static void statusUpdate(char* status, u_char statusLen);
static int parseUri(const char* argv0, char* name, char* type, char* zone);
@@ -170,6 +173,7 @@ static int addPercentEscapes(const char* src, char* dst, int dstMax);
static int removePercentEscapes(const char* src, char* dst, int dstMax);
static int nbptuple_compare(const void *p1, const void *p2);
static int okayToUseAppleTalk(void);
static const char *packet_name(u_char x);
static int connectTimeout(void);
static void signalHandler(int sigraised);
@@ -199,10 +203,13 @@ int main (int argc, const char * argv[])
if (argc == 1 || (argc == 2 && strcmp(argv[1], "-discover") == 0))
{
/* Ignore errors returned by listDevices - they may be transitory
* and we don't want cupsd to think that pap is forever unusable.
/* If listDevices() didn't find any devices or returns an error output a
* legacy style announcement.
*
*/
listDevices();
if (listDevices() <= 0)
puts("network pap \"Unknown\" \"AppleTalk Printer Access Protocol (pap)\"");
return 0;
}
@@ -239,9 +246,9 @@ int main (int argc, const char * argv[])
}
/* Extract the device name and options from the URI... */
parseUri(argv[0], name, type, zone);
parseUri(cupsBackendDeviceURI((char **)argv), name, type, zone);
err = printFile(name, type, zone, fileno(fp), 3, STDERR_FILENO, copies, argc);
err = printFile(name, type, zone, fileno(fp), STDOUT_FILENO, STDERR_FILENO, copies, argc);
if (fp != stdin)
fclose(fp);
@@ -263,7 +270,7 @@ int main (int argc, const char * argv[])
static int listDevices(void)
{
int err = noErr;
int ind;
int i;
int numberFound;
at_nvestr_t at_zone;
@@ -287,10 +294,13 @@ static int listDevices(void)
perror("ERROR: Unable to get default AppleTalk zone");
return -2;
}
memcpy(zone, at_zone.str, MIN(at_zone.len, sizeof(zone)-1));
zone[MIN(at_zone.len, sizeof(zone)-1)] = '\0';
err = addPercentEscapes(zone, encodedZone, sizeof(encodedZone));
fprintf(stderr, "INFO: Using default AppleTalk zone \"%s\"\n", zone);
addPercentEscapes(zone, encodedZone, sizeof(encodedZone));
/* Look up all the printers in our zone */
nbp_make_entity(&entity, "=", "LaserWriter", zone);
@@ -310,10 +320,10 @@ static int listDevices(void)
/* Not required but sort them so they look nice */
qsort(buf, numberFound, sizeof(at_nbptuple_t), nbptuple_compare);
for (ind = 0; ind < numberFound; ind++)
for (i = 0; i < numberFound; i++)
{
memcpy(name, buf[ind].enu_entity.object.str, MIN(buf[ind].enu_entity.object.len, sizeof(name)-1));
name[MIN(buf[ind].enu_entity.object.len, sizeof(name)-1)] = '\0';
memcpy(name, buf[i].enu_entity.object.str, MIN(buf[i].enu_entity.object.len, sizeof(name)-1));
name[MIN(buf[i].enu_entity.object.len, sizeof(name)-1)] = '\0';
if (addPercentEscapes(name, encodedName, sizeof(encodedName)) == 0)
{
@@ -371,7 +381,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
int err;
int rc;
int val;
int len, ind;
int len, i;
char fileBuffer[4096]; /* File buffer */
int fileBufferNbytes;
@@ -390,20 +400,19 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
int userdata, xo, reqlen;
u_short tid;
u_char bitmap;
int maxfdp1;
int maxfdp1,
nbp_failures = 0;
struct timeval timeout, *timeoutPtr;
u_char flowQuantum = 1;
u_short recvSequence = 0;
time_t now,
connect_time,
start_time,
elasped_time,
sleep_time,
connect_timeout = -1,
nextStatusTime = 0;
at_entity_t entity;
at_retry_t retry;
Boolean recoverableErrShown = false;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
@@ -420,51 +429,60 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
* Remember when we started looking for the printer.
*/
connect_time = time(NULL);
start_time = time(NULL);
retry.interval = 1;
retry.retries = 5;
retry.backoff = 0;
fprintf(stderr, "STATE: +connecting-to-device\n");
/* Loop forever trying to get an open session with the printer. */
for (;;)
{
/* Make sure it's okay to use appletalk */
if (okayToUseAppleTalk())
{
/* Clear this printer-state-reason in case we've set it */
fprintf(stderr, "STATE: -apple-appletalk-disabled-warning\n");
/* Resolve the name into an address. Returns the number found or an error */
if ((err = nbp_lookup(&entity, &tuple, 1, &retry)) > 0)
{
if (err > 1)
fprintf(stderr, "DEBUG: Found more than one printer with the name \"%s\"\n", name);
if (recoverableErrShown)
{
fprintf(stderr, "INFO: recovered: \n");
sleep(5);
recoverableErrShown = false;
if (nbp_failures)
{
fprintf(stderr, "STATE: -apple-nbp-lookup-warning\n");
nbp_failures = 0;
}
/* Open a connection to the device */
if ((err = papOpen(&tuple, &gConnID, &gSockfd, &gSessionAddr, &flowQuantum)) == 0)
break;
fprintf(stderr, "WARNING: Unable to open \"%s:%s\": %s\n", name, zone, strerror(errno));
fprintf(stderr, "WARNING: Unable to open \"%s:%s\": %s\n", name, zone, strerror(err));
}
else
{
fprintf(stderr, "WARNING: recoverable: Printer not responding\n");
recoverableErrShown = true;
/* It's not unusual to have to call nbp_lookup() twice before it's sucessful... */
if (++nbp_failures > 2)
{
retry.interval = 2;
retry.retries = 3;
fprintf(stderr, "STATE: +apple-nbp-lookup-warning\n");
fprintf(stderr, "WARNING: Printer not responding\n");
}
}
}
else
{
fprintf(stderr, "WARNING: recoverable: AppleTalk disabled in System Preferences.\n");
recoverableErrShown = true;
fprintf(stderr, "STATE: +apple-appletalk-disabled-warning\n");
fprintf(stderr, "INFO: AppleTalk disabled in System Preferences.\n");
}
retry.retries = 3;
elasped_time = time(NULL) - connect_time;
elasped_time = time(NULL) - start_time;
if (connect_timeout == -1)
connect_timeout = connectTimeout();
@@ -475,9 +493,9 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
err = ETIMEDOUT;
goto Exit; /* Waiting too long... */
}
else if (elasped_time < 30 /*(30 * 60)*/)
else if (elasped_time < (30 * 60))
sleep_time = 10; /* Waiting < 30 minutes */
else if (elasped_time < 60 /*(24 * 60 * 60)*/)
else if (elasped_time < (24 * 60 * 60))
sleep_time = 30; /* Waiting < 24 hours */
else
sleep_time = 60; /* Waiting > 24 hours */
@@ -486,6 +504,8 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
sleep(sleep_time);
}
fprintf(stderr, "STATE: -connecting-to-device\n");
/*
* Now that we are connected to the printer ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
@@ -536,21 +556,6 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
val = fcntl(fdin, F_GETFL, 0);
fcntl(fdin, F_SETFL, val | O_NONBLOCK);
/* Set non-blocking mode on our data destination descriptor */
val = fcntl(fdout, F_GETFL, 0);
if (val < 0)
{
/*
* Map output to stdout if we don't have the backchannel pipe
* available on file descriptor 3...
*/
if (fdout == 3 && errno == EBADF)
fdout = 1;
}
else
fcntl(fdout, F_SETFL, val | O_NONBLOCK);
fileBufferNbytes = 0;
fileTbytes = 0;
fileEOFRead = fileEOFSent = false;
@@ -666,7 +671,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
}
}
fprintf(stderr, "DEBUG: <- %s\n", PAPPacketStr(TYPE_OF(userdata)));
fprintf(stderr, "DEBUG: <- %s\n", packet_name(TYPE_OF(userdata)));
switch (TYPE_OF(userdata))
{
@@ -707,10 +712,10 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
break;
case AT_PAP_TYPE_DATA: /* Data packet */
for (len=0, ind=0; ind < ATP_TRESP_MAX; ind++)
for (len=0, i=0; i < ATP_TRESP_MAX; i++)
{
if (resp.bitmap & (1 << ind))
len += resp.resp[ind].iov_len;
if (resp.bitmap & (1 << i))
len += resp.resp[i].iov_len;
}
fprintf(stderr, "DEBUG: <- PAP_DATA %d bytes %s\n", len, IS_PAP_EOF(userdata) ? "with EOF" : "");
@@ -722,7 +727,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
char logstr[512];
int logstrlen;
write(fdout, sockBuffer, len);
cupsBackChannelWrite(sockBuffer, len, 1.0);
sockBuffer[len] = '\0'; /* We always reserve room for the nul so we can use strstr() below*/
pLineBegin = sockBuffer;
@@ -835,7 +840,7 @@ Exit:
/*
* Close the socket and return...
*/
papClose(false);
papClose();
return err;
}
@@ -854,37 +859,35 @@ Exit:
*
* @result A non-zero return value for errors
*/
static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd, at_inet_t* sessionAddr, u_char* flowQuantum)
static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
at_inet_t* sessionAddr, u_char* flowQuantum)
{
int result,
openResult;
long tm;
char data[10], rdata[ATP_DATA_SIZE];
int userdata;
u_char *puserdata = (u_char *)&userdata;
at_socket sock = 0;
u_short waitTime;
int status;
open_result,
userdata,
atp_err;
time_t tm,
waitTime;
char data[10],
rdata[ATP_DATA_SIZE];
u_char *puserdata;
at_socket socketfd;
at_resp_t resp;
at_retry_t retry;
if (tuple == NULL)
{
errno = EINVAL;
return -1;
}
result = 0;
socketfd = 0;
puserdata = (u_char *)&userdata;
fprintf(stderr, "INFO: Opening connection\n");
errno = 0;
result = 0;
*fd = atp_open(&sock);
if (*fd < 0)
if ((*fd = atp_open(&socketfd)) < 0)
return -1;
/* Build the open connection request packet.
/*
* Build the open connection request packet.
*/
tm = time(NULL);
srand(tm);
@@ -901,64 +904,67 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd, at_inet_t* ses
resp.resp[0].iov_base = rdata;
resp.resp[0].iov_len = sizeof(rdata);
data[0] = sock;
data[0] = socketfd;
data[1] = 8;
for (;;)
{
waitTime = (u_short)(time(NULL) - tm);
OSWriteBigInt16(&data[2], 0, waitTime);
waitTime = time(NULL) - tm;
OSWriteBigInt16(&data[2], 0, (u_short)waitTime);
fprintf(stderr, "DEBUG: -> %s\n", PAPPacketStr(AT_PAP_TYPE_OPEN_CONN));
fprintf(stderr, "DEBUG: -> %s\n", packet_name(AT_PAP_TYPE_OPEN_CONN));
status = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0, 0, &resp, &retry, 0);
if (status < 0)
if ((atp_err = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
0, &resp, &retry, 0)) < 0)
{
statusUpdate("Destination unreachable", 23);
result = EHOSTUNREACH;
errno = EHOSTUNREACH;
sleep(1);
goto Exit;
break;
}
else
puserdata = (u_char *)&resp.userdata[0];
open_result = OSReadBigInt16(&rdata[2], 0);
fprintf(stderr, "DEBUG: <- %s, status %d\n", packet_name(puserdata[1]),
open_result);
/*
* Just for the sake of our sanity check the other fields in the packet
*/
if (puserdata[1] != AT_PAP_TYPE_OPEN_CONN_REPLY ||
(open_result == 0 && (puserdata[0] & 0xff) != *connID))
{
puserdata = (u_char *)&resp.userdata[0];
openResult = OSReadBigInt16(&rdata[2], 0);
fprintf(stderr, "DEBUG: <- %s, status %d\n", PAPPacketStr(puserdata[1]), openResult);
/* Just for the sake of our sanity check the other fields in the packet
*/
if (puserdata[1] != AT_PAP_TYPE_OPEN_CONN_REPLY ||
(openResult == 0 && (puserdata[0] & 0xff) != *connID))
{
result = EINVAL;
errno = EINVAL;
goto Exit;
}
statusUpdate(&rdata[5], rdata[4] & 0xff);
if (openResult == 0)
break; /* Connection established okay, exit from the loop */
result = EINVAL;
break;
}
statusUpdate(&rdata[5], rdata[4] & 0xff);
/*
* if the connection established okay exit from the loop
*/
if (open_result == 0)
break;
sleep(1);
}
/* Update the session address
*/
sessionAddr->net = tuple->enu_addr.net;
sessionAddr->node = tuple->enu_addr.node;
sessionAddr->socket = rdata[0];
*flowQuantum = rdata[1];
Exit:
if (result != 0)
if (result == 0)
{
/* Update the session address
*/
sessionAddr->net = tuple->enu_addr.net;
sessionAddr->node = tuple->enu_addr.node;
sessionAddr->socket = rdata[0];
*flowQuantum = rdata[1];
}
else
{
atp_close(*fd);
*fd = 0;
sleep(1);
}
return result;
@@ -970,12 +976,9 @@ Exit:
* @abstract End a PAP session by canceling outstanding send-data & tickle
* transactions and sending a PAP close request.
*
* @param abort If we're aborting then send the close request
* with 0 retries (not yet implemented)
*
* @result A non-zero return value for errors
*/
static int papClose(int abortflag)
static int papClose()
{
int fd;
u_short tmpID;
@@ -1018,7 +1021,7 @@ static int papClose(int abortflag)
if (gWaitEOF == false)
sleep(2);
fprintf(stderr, "DEBUG: -> %s\n", PAPPacketStr(AT_PAP_TYPE_CLOSE_CONN));
fprintf(stderr, "DEBUG: -> %s\n", packet_name(AT_PAP_TYPE_CLOSE_CONN));
puserdata[0] = gConnID;
puserdata[1] = AT_PAP_TYPE_CLOSE_CONN;
@@ -1058,7 +1061,7 @@ static int papClose(int abortflag)
static int papWrite(int sockfd, at_inet_t* dest, u_short tid, u_char connID, u_char flowQuantum, char* data, int len, int eof)
{
int result;
int ind;
int i;
u_char* puserdata;
at_resp_t resp;
@@ -1076,26 +1079,26 @@ static int papWrite(int sockfd, at_inet_t* dest, u_short tid, u_char connID, u_c
* response packets to reply to an incoming
* PAP 'SENDDATA' request
*/
for (ind = 0; ind < flowQuantum; ind++)
for (i = 0; i < flowQuantum; i++)
{
resp.userdata[ind] = 0;
puserdata = (u_char *)&resp.userdata[ind];
resp.userdata[i] = 0;
puserdata = (u_char *)&resp.userdata[i];
puserdata[PAP_CONNID] = connID;
puserdata[PAP_TYPE] = AT_PAP_TYPE_DATA;
puserdata[PAP_EOF] = eof ? 1 : 0;
resp.resp[ind].iov_base = (caddr_t)data;
resp.resp[i].iov_base = (caddr_t)data;
if (data)
data += AT_PAP_DATA_SIZE;
resp.resp[ind].iov_len = MIN((int)len, (int)AT_PAP_DATA_SIZE);
len -= resp.resp[ind].iov_len;
resp.resp[i].iov_len = MIN((int)len, (int)AT_PAP_DATA_SIZE);
len -= resp.resp[i].iov_len;
if (len == 0)
break;
}
resp.bitmap = (1 << (ind + 1)) - 1;
resp.bitmap = (1 << (i + 1)) - 1;
/*
* Write out the data as a PAP 'DATA' response
@@ -1168,7 +1171,7 @@ static int papSendRequest(int sockfd, at_inet_t* dest, u_char connID, int functi
at_resp_t resp;
static u_short pap_send_count = 0;
fprintf(stderr, "DEBUG: -> %s\n", PAPPacketStr(function));
fprintf(stderr, "DEBUG: -> %s\n", packet_name(function));
puserdata[0] = connID;
puserdata[1] = function;
@@ -1274,7 +1277,7 @@ void statusUpdate(char* status, u_char statusLen)
*/
static int parseUri(const char* argv0, char* name, char* type, char* zone)
{
char scheme[255], /* Scheme in URI */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
@@ -1290,8 +1293,10 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
/*
* Extract the device name and options from the URI...
*/
method[0] = username[0] = hostname[0] = resource[0] = '\0';
port = 0;
httpSeparateURI(HTTP_URI_CODING_NONE, argv0, scheme, sizeof(scheme),
httpSeparateURI(HTTP_URI_CODING_NONE, argv0, method, sizeof(method),
username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource));
@@ -1527,6 +1532,31 @@ static int okayToUseAppleTalk()
}
/*!
* @function packet_name
* @abstract Returns packet name string.
*
* @result A string
*/
static const char *packet_name(u_char x)
{
switch (x)
{
case AT_PAP_TYPE_OPEN_CONN: return "PAP_OPEN_CONN";
case AT_PAP_TYPE_OPEN_CONN_REPLY: return "PAP_OPEN_CONN_REPLY";
case AT_PAP_TYPE_SEND_DATA: return "PAP_SEND_DATA";
case AT_PAP_TYPE_DATA: return "PAP_DATA";
case AT_PAP_TYPE_TICKLE: return "PAP_TICKLE";
case AT_PAP_TYPE_CLOSE_CONN: return "PAP_CLOSE_CONN";
case AT_PAP_TYPE_CLOSE_CONN_REPLY: return "PAP_CLOSE_CONN_REPLY";
case AT_PAP_TYPE_SEND_STATUS: return "PAP_SEND_STATUS";
case AT_PAP_TYPE_SEND_STS_REPLY: return "PAP_SEND_STS_REPLY";
case AT_PAP_TYPE_READ_LW: return "PAP_READ_LW";
}
return "<Unknown>";
}
/*!
* @function connectTimeout
* @abstract Returns the connect timeout preference value.
@@ -1562,7 +1592,7 @@ static void signalHandler(int sigraised)
{
fprintf(stderr, "ERROR: There was a timeout error while sending data to the printer\n");
papClose(true);
papClose();
_exit(1);
}
+23 -3
Ver Arquivo
@@ -88,7 +88,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
int print_fd, /* Print file */
device_fd; /* Parallel device */
device_fd, /* Parallel device */
use_bc; /* Read back-channel data? */
int copies; /* Number of copies to print */
size_t tbytes; /* Total number of bytes written */
struct termios opts; /* Parallel port options */
@@ -188,7 +189,26 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
do
{
if ((device_fd = open(resource, O_WRONLY | O_EXCL)) == -1)
#if defined(__linux) || defined(__FreeBSD__)
/*
* The Linux and FreeBSD parallel port drivers currently are broken WRT
* select() and bidirection I/O...
*/
device_fd = open(resource, O_WRONLY | O_EXCL);
use_bc = 0;
#else
if ((device_fd = open(resource, O_RDWR | O_EXCL)) < 0)
{
device_fd = open(resource, O_WRONLY | O_EXCL);
use_bc = 0;
}
else
use_bc = 1;
#endif /* __linux || __FreeBSD__ */
if (device_fd == -1)
{
if (getenv("CLASS") != NULL)
{
@@ -264,7 +284,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
lseek(print_fd, 0, SEEK_SET);
}
tbytes = backendRunLoop(print_fd, device_fd, 1);
tbytes = backendRunLoop(print_fd, device_fd, use_bc);
if (print_fd != 0 && tbytes >= 0)
fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
+2 -2
Ver Arquivo
@@ -206,7 +206,7 @@ backendRunLoop(int print_fd, /* I - Print file descriptor */
if (!paperout)
{
fputs("ERROR: Out of paper!\n", stderr);
fputs("STATUS: +media-tray-empty-error\n", stderr);
fputs("STATE: +media-empty-error\n", stderr);
paperout = 1;
}
}
@@ -229,7 +229,7 @@ backendRunLoop(int print_fd, /* I - Print file descriptor */
{
if (paperout)
{
fputs("STATUS: -media-tray-empty-error\n", stderr);
fputs("STATE: -media-empty-error\n", stderr);
paperout = 0;
}
+2 -2
Ver Arquivo
@@ -80,7 +80,7 @@ void list_devices(void);
int print_device(const char *resource, int fd, int copies);
#ifdef __linux__
#if defined(__linux__) && defined(HAVE_SCSI_SG_H)
# include "scsi-linux.c"
#elif defined(__sgi)
# include "scsi-irix.c"
@@ -90,7 +90,7 @@ int print_device(const char *resource, int fd, int copies);
*/
void list_devices(void) {}
int print_device(const char *resource, int fd, int copies) { return (CUPS_BACKEND_FAILED); }
#endif /* __linux */
#endif /* __linux && HAVE_SCSI_SG_H */
/*
+8
Ver Arquivo
@@ -778,6 +778,14 @@ list_devices(void)
printf("serial serial:%s?baud=230400 \"Unknown\" \"USB Serial Port #%d\"\n",
device, i + 1);
}
sprintf(device, "/dev/ttyUSB%d", i);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=230400 \"Unknown\" \"USB Serial Port #%d\"\n",
device, i + 1);
}
}
for (i = 0; i < 64; i ++)
+13 -8
Ver Arquivo
@@ -1126,7 +1126,7 @@ asn1_set_packed(unsigned char **buffer, /* IO - Pointer in buffer */
{
if (integer > 0xfffffff)
{
**buffer = (integer >> 14) & 0x7f;
**buffer = (integer >> 28) & 0x7f;
(*buffer) ++;
}
@@ -1471,6 +1471,8 @@ fix_make_model(
}
else if (!strncasecmp(old_make_model, "deskjet", 7))
snprintf(make_model, make_model_size, "HP DeskJet%s", old_make_model + 7);
else if (!strncasecmp(old_make_model, "officejet", 9))
snprintf(make_model, make_model_size, "HP OfficeJet%s", old_make_model + 9);
else if (!strncasecmp(old_make_model, "stylus_pro_", 11))
snprintf(make_model, make_model_size, "EPSON Stylus Pro %s",
old_make_model + 11);
@@ -1728,14 +1730,17 @@ probe_device(snmp_cache_t *device) /* I - Device */
debug_printf("DEBUG: %.3f Probing %s...\n", run_time(), device->addrname);
if (device->make_and_model &&
(!strncasecmp(device->make_and_model, "Kyocera", 7) ||
(!strncasecmp(device->make_and_model, "Epson", 5) ||
!strncasecmp(device->make_and_model, "HP ", 3) ||
!strncasecmp(device->make_and_model, "Hewlett", 7) ||
!strncasecmp(device->make_and_model, "Kyocera", 7) ||
!strncasecmp(device->make_and_model, "Lexmark", 7) ||
!strncasecmp(device->make_and_model, "Tektronix", 9) ||
!strncasecmp(device->make_and_model, "Xerox", 5)))
{
/*
* Kyocera, Lexmark, Tektronix, and Xerox printers often lock up on
* IPP probes, so exclude them from the IPP connection test...
* Epson, HP, Kyocera, Lexmark, Tektronix, and Xerox printers often lock
* up on IPP probes, so exclude them from the IPP connection test...
*/
http = NULL;
@@ -1751,7 +1756,7 @@ probe_device(snmp_cache_t *device) /* I - Device */
alarm(0);
}
if (http);
if (http)
{
/*
* IPP is supported...
@@ -1768,9 +1773,9 @@ probe_device(snmp_cache_t *device) /* I - Device */
static const char * const resources[] =
{ /* Common resource paths for IPP */
"/ipp",
"/ipp/port2",
"/ipp/port3",
"/EPSON_IPP_Printer",
/*"/ipp/port2",*/
/*"/ipp/port3",*/
/*"/EPSON_IPP_Printer",*/
"/LPT1",
"/LPT2",
"/COM1",
+17 -2
Ver Arquivo
@@ -78,7 +78,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
int delay; /* Delay for retries... */
int device_fd; /* AppSocket */
int error; /* Error code (if any) */
http_addrlist_t *addrlist; /* Address list */
http_addrlist_t *addrlist, /* Address list */
*addr; /* Connected address */
char addrname[256]; /* Address name */
ssize_t tbytes; /* Total number of bytes written */
struct timeval timeout; /* Timeout for select() */
fd_set input; /* Input set for select() */
@@ -245,7 +247,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
for (delay = 5;;)
{
if (!httpAddrConnect(addrlist, &device_fd))
if ((addr = httpAddrConnect(addrlist, &device_fd)) == NULL)
{
error = errno;
device_fd = -1;
@@ -293,6 +295,19 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
fputs("STATE: -connecting-to-device\n", stderr);
fprintf(stderr, "INFO: Connected to %s...\n", hostname);
#ifdef AF_INET6
if (addr->addr.addr.sa_family == AF_INET6)
fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6)...\n",
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
ntohs(addr->addr.ipv6.sin6_port));
else
#endif /* AF_INET6 */
if (addr->addr.addr.sa_family == AF_INET)
fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4)...\n",
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
ntohs(addr->addr.ipv4.sin_port));
/*
* Print everything...
+60 -14
Ver Arquivo
@@ -198,12 +198,13 @@ static void copy_deviceinfo(CFStringRef deviceIDString, CFStringRef *make, CFStr
static void release_deviceinfo(CFStringRef *make, CFStringRef *model, CFStringRef *serial);
static kern_return_t load_classdriver(CFStringRef driverPath, printer_interface_t intf, classdriver_context_t ***driver);
static kern_return_t unload_classdriver(classdriver_context_t ***classDriver);
static kern_return_t load_printerdriver(printer_data_t *printer);
static kern_return_t registry_open(printer_data_t *printer);
static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *driverBundlePath);
static kern_return_t registry_open(printer_data_t *printer, CFStringRef *driverBundlePath);
static kern_return_t registry_close(printer_data_t *printer);
static OSStatus copy_deviceid(classdriver_context_t **printer, CFStringRef *deviceID);
static void copy_devicestring(io_service_t usbInterface, CFStringRef *deviceID, UInt32 *deviceLocation);
static CFStringRef copy_value_for_key(CFStringRef deviceID, CFStringRef *keys);
static CFStringRef cfstr_create_and_trim(const char *cstr);
static void parse_options(const char *options, char *serial, UInt32 *location, Boolean *waitEOF);
static void setup_cfLanguage(void);
static void *read_thread(void *reference);
@@ -255,6 +256,7 @@ print_device(const char *uri, /* I - Device URI */
int countdown = INITIAL_LOG_INTERVAL; /* Logging interval */
pthread_cond_t *readCompleteConditionPtr = NULL; /* Read complete condition */
pthread_mutex_t *readMutexPtr = NULL; /* Read mutex */
CFStringRef driverBundlePath; /* Class driver path */
setup_cfLanguage();
parse_options(options, serial, &printer_data.location, &printer_data.waitEOF);
@@ -263,9 +265,10 @@ print_device(const char *uri, /* I - Device URI */
resource++;
printer_data.uri = uri;
printer_data.make = CFStringCreateWithCString(NULL, hostname, kCFStringEncodingUTF8);
printer_data.model = CFStringCreateWithCString(NULL, resource, kCFStringEncodingUTF8);
printer_data.serial = CFStringCreateWithCString(NULL, serial, kCFStringEncodingUTF8);
printer_data.make = cfstr_create_and_trim(hostname);
printer_data.model = cfstr_create_and_trim(resource);
printer_data.serial = cfstr_create_and_trim(serial);
fputs("STATE: +connecting-to-device\n", stderr);
@@ -281,7 +284,9 @@ print_device(const char *uri, /* I - Device URI */
iterate_printers(find_device_callback, &printer_data);
fprintf(stderr, "INFO: Opening Connection\n");
status = registry_open(&printer_data);
driverBundlePath = NULL;
status = registry_open(&printer_data, &driverBundlePath);
#if defined(__i386__)
/*
* If we were unable to load the class drivers for this printer it's probably because they're ppc-only.
@@ -292,6 +297,26 @@ print_device(const char *uri, /* I - Device URI */
/* Never returns here */
}
#endif /* __i386__ */
if (status == -2) {
/*
* If we still were unable to load the class drivers for this printer log
* the error and stop the queue...
*/
if (driverBundlePath == NULL || !CFStringGetCString(driverBundlePath, buffer, sizeof(buffer), kCFStringEncodingUTF8))
strlcpy(buffer, "USB class driver", sizeof(buffer));
fprintf(stderr, "STATE: +apple-missing-usbclassdriver-error\n" \
"FATAL: Could not load %s\n", buffer);
if (driverBundlePath)
CFRelease(driverBundlePath);
return CUPS_BACKEND_STOP;
}
if (driverBundlePath)
CFRelease(driverBundlePath);
if (status != noErr) {
sleep( PRINTER_POLLING_INTERVAL );
@@ -508,7 +533,7 @@ static Boolean find_device_callback(void *refcon, io_service_t obj)
if (CFStringCompare(make, userData->make, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
if (CFStringCompare(model, userData->model, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
if (userData->serial != NULL) {
if (serial != NULL && CFStringCompare(model, userData->model, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
if (serial != NULL && CFStringCompare(serial, userData->serial, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
IOObjectRetain(obj);
userData->printerObj = obj;
keepLooking = false;
@@ -728,9 +753,11 @@ static kern_return_t unload_classdriver(classdriver_context_t ***classDriver)
/*
* 'load_printerdriver()' - Load a vendor's (or generic) classdriver.
*
* If driverBundlePath is not NULL on return it is the callers responsbility to release it!
*/
static kern_return_t load_printerdriver(printer_data_t *printer)
static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *driverBundlePath)
{
IOCFPlugInInterface **iodev = NULL;
SInt32 score;
@@ -744,11 +771,10 @@ static kern_return_t load_printerdriver(printer_data_t *printer)
kr = IORegistryEntryCreateCFProperties(printer->printerObj, &properties, NULL, kNilOptions);
if (kr == kIOReturnSuccess) {
CFStringRef driverBundlePath = NULL;
if (properties != NULL) {
driverBundlePath = (CFStringRef) CFDictionaryGetValue(properties, kUSBClassDriverProperty);
*driverBundlePath = (CFStringRef) CFDictionaryGetValue(properties, kUSBClassDriverProperty);
}
kr = load_classdriver(driverBundlePath, intf, &printer->printerDriver);
kr = load_classdriver(*driverBundlePath, intf, &printer->printerDriver);
}
if (kr != kIOReturnSuccess)
@@ -764,9 +790,9 @@ static kern_return_t load_printerdriver(printer_data_t *printer)
* 'registry_open()' - Open a connection to the printer.
*/
static kern_return_t registry_open(printer_data_t *printer)
static kern_return_t registry_open(printer_data_t *printer, CFStringRef *driverBundlePath)
{
kern_return_t kr = load_printerdriver(printer);
kern_return_t kr = load_printerdriver(printer, driverBundlePath);
if (kr != kIOReturnSuccess) {
kr = -2;
}
@@ -975,6 +1001,27 @@ static CFStringRef copy_value_for_key(CFStringRef deviceID, CFStringRef *keys)
}
/*
* 'cfstr_create_and_trim()' - Create a CFString from a c-string and
* trim it's whitespace characters.
*/
CFStringRef cfstr_create_and_trim(const char *cstr)
{
CFStringRef cfstr;
CFMutableStringRef cfmutablestr = NULL;
if ((cfstr = CFStringCreateWithCString(NULL, cstr, kCFStringEncodingUTF8)) != NULL)
{
if ((cfmutablestr = CFStringCreateMutableCopy(NULL, 1024, cfstr)) != NULL)
CFStringTrimWhitespace(cfmutablestr);
CFRelease(cfstr);
}
return (CFStringRef) cfmutablestr;
}
#pragma mark -
/*
* 'parse_options()' - Parse uri options.
@@ -1344,7 +1391,6 @@ static void *read_thread(void *reference)
return NULL;
}
/*
* End of "$Id$".
*/
+64 -48
Ver Arquivo
@@ -79,12 +79,14 @@ print_device(const char *uri, /* I - Device URI */
do
{
/*
* Disable backchannel data when printing to Canon USB printers - apparently
* Canon printers will return the IEEE-1284 device ID over and over and over
* when they get a read request...
* Disable backchannel data when printing to Canon or Minolta USB
* printers - apparently these printers will return the IEEE-1284
* device ID over and over and over when they get a read request...
*/
use_bc = strcasecmp(hostname, "Canon") != 0;
use_bc = strcasecmp(hostname, "Canon") &&
strcasecmp(hostname, "Konica Minolta") &&
strcasecmp(hostname, "Minolta");
if ((device_fd = open_device(uri, &use_bc)) == -1)
{
@@ -185,44 +187,52 @@ void
list_devices(void)
{
#ifdef __linux
int i; /* Looping var */
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 */
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 */
/*
* First figure out which USB printer filename to use...
*/
if (!access("/dev/usblp0", 0))
strcpy(format, "/dev/usblp%d");
else if (!access("/dev/usb/usblp0", 0))
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usb/lp%d");
/*
* Then open each USB device...
* Try to open each USB device...
*/
for (i = 0; i < 16; i ++)
{
sprintf(device, format, i);
/*
* Linux has a long history of changing the standard filenames used
* for USB printer devices. We get the honor of trying them all...
*/
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
sprintf(device, "/dev/usblp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
{
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
make_model, make_model, i + 1, device_id);
if (errno != ENOENT)
continue;
close(fd);
sprintf(device, "/dev/usb/lp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
{
if (errno != ENOENT)
continue;
sprintf(device, "/dev/usb/usblp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
continue;
}
}
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
make_model, make_model, i + 1, device_id);
close(fd);
}
#elif defined(__sgi)
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
@@ -309,35 +319,41 @@ open_device(const char *uri, /* I - Device URI */
int i; /* Looping var */
int busy; /* Are any ports busy? */
char format[255], /* Format for device filename */
device[255], /* Device filename */
char 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))
strcpy(format, "/dev/usblp%d");
else if (!access("/dev/usb/usblp0", 0))
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usb/lp%d");
/*
* Then find the correct USB device...
* Find the correct USB device...
*/
do
{
for (busy = 0, i = 0; i < 16; i ++)
{
sprintf(device, format, i);
/*
* Linux has a long history of changing the standard filenames used
* for USB printer devices. We get the honor of trying them all...
*/
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
sprintf(device, "/dev/usblp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
{
sprintf(device, "/dev/usb/lp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
{
sprintf(device, "/dev/usb/usblp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
continue;
}
}
if (fd >= 0)
{
backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
+18 -67
Ver Arquivo
@@ -237,10 +237,8 @@ show_status(http_t *http, /* I - HTTP connection to server */
const char *dests) /* I - Destinations */
{
ipp_t *request, /* IPP Request */
*response, /* IPP Response */
*jobs; /* IPP Get Jobs response */
ipp_attribute_t *attr, /* Current attribute */
*jattr; /* Current job attribute */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
char *printer, /* Printer name */
*device, /* Device URI */
@@ -251,14 +249,13 @@ show_status(http_t *http, /* I - HTTP connection to server */
const char *dptr, /* Pointer into destination list */
*ptr; /* Pointer into printer name */
int match; /* Non-zero if this job matches */
char printer_uri[HTTP_MAX_URI];
/* Printer URI */
static const char *requested[] = /* Requested attributes */
{
"printer-name",
"device-uri",
"printer-is-accepting-jobs",
"printer-name",
"printer-state",
"printer-is-accepting-jobs"
"queued-job-count"
};
@@ -329,21 +326,21 @@ show_status(http_t *http, /* I - HTTP connection to server */
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
{
if (!strcmp(attr->name, "printer-name") &&
attr->value_tag == IPP_TAG_NAME)
printer = attr->values[0].string.text;
if (!strcmp(attr->name, "device-uri") &&
attr->value_tag == IPP_TAG_URI)
device = attr->values[0].string.text;
if (!strcmp(attr->name, "printer-state") &&
attr->value_tag == IPP_TAG_ENUM)
pstate = (ipp_pstate_t)attr->values[0].integer;
if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
attr->value_tag == IPP_TAG_BOOLEAN)
else if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
attr->value_tag == IPP_TAG_BOOLEAN)
accepting = attr->values[0].boolean;
else if (!strcmp(attr->name, "printer-name") &&
attr->value_tag == IPP_TAG_NAME)
printer = attr->values[0].string.text;
else if (!strcmp(attr->name, "printer-state") &&
attr->value_tag == IPP_TAG_ENUM)
pstate = (ipp_pstate_t)attr->values[0].integer;
else if (!strcmp(attr->name, "queued-job-count") &&
attr->value_tag == IPP_TAG_INTEGER)
jobcount = attr->values[0].integer;
attr = attr->next;
}
@@ -395,7 +392,8 @@ 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 & 255)))
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' ||
isspace(*dptr & 255)))
{
match = 1;
break;
@@ -421,53 +419,6 @@ show_status(http_t *http, /* I - HTTP connection to server */
if (match)
{
/*
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* limit
*/
request = ippNew();
request->request.op.operation_id = IPP_GET_JOBS;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL,
cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL,
language->language);
httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri),
"ipp", NULL, "localhost", 631, "/printers/%s",
printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, printer_uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "job-id");
if ((jobs = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Grab the number of jobs for the printer.
*/
for (jattr = jobs->attrs; jattr != NULL; jattr = jattr->next)
if (jattr->name && !strcmp(jattr->name, "job-id"))
jobcount ++;
ippDelete(jobs);
}
/*
* Display it...
*/
+1 -1
Ver Arquivo
@@ -914,7 +914,7 @@ cgiSetIPPObjectVars(
snprintf(valptr, sizeof(value) - (valptr - value),
"<A HREF=\"%s\">%s</A>", url,
strrchr(url, '/') + 1);
strrchr(attr->values[i].string.text, '/') + 1);
}
else
cgiRewriteURL(attr->values[i].string.text, valptr,
+4 -4
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: mime.types 5402 2006-04-14 19:21:03Z mike $"
# "$Id: mime.types 6003 2006-10-02 16:26:04Z mike $"
#
# MIME types file for the Common UNIX Printing System (CUPS).
#
@@ -154,8 +154,8 @@ application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
string(0,<1B>@) \
(contains(0,128,<1B>%-12345X) + \
(contains(0,1024,"LANGUAGE=PCL") \
contains(0,1024,"LANGUAGE = PCL")))
(contains(0,4096,"LANGUAGE=PCL") \
contains(0,4096,"LANGUAGE = PCL")))
########################################################################
#
@@ -167,5 +167,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
application/octet-stream
#
# End of "$Id: mime.types 5402 2006-04-14 19:21:03Z mike $".
# End of "$Id: mime.types 6003 2006-10-02 16:26:04Z mike $".
#
+149
Ver Arquivo
@@ -0,0 +1,149 @@
dnl
dnl "$Id$"
dnl
dnl 32/64-bit library support stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2006 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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl Setup support for separate 32/64-bit library generation...
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
INSTALL32=""
LIB32CUPS=""
LIB32CUPSIMAGE=""
LIB32DIR=""
UNINSTALL32=""
AC_SUBST(INSTALL32)
AC_SUBST(LIB32CUPS)
AC_SUBST(LIB32CUPSIMAGE)
AC_SUBST(LIB32DIR)
AC_SUBST(UNINSTALL32)
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
INSTALL64=""
LIB64CUPS=""
LIB64CUPSIMAGE=""
LIB64DIR=""
UNINSTALL64=""
AC_SUBST(INSTALL64)
AC_SUBST(LIB64CUPS)
AC_SUBST(LIB64CUPSIMAGE)
AC_SUBST(LIB64DIR)
AC_SUBST(UNINSTALL64)
case "$uname" in
HP-UX*)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib"
if test -d /usr/lib/hpux32; then
LIB32DIR="${LIB32DIR}/hpux32"
fi
UNINSTALL32="uninstall32bit"
fi
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries, 32-bit base...
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib"
if test -d /usr/lib/hpux64; then
LIB64DIR="${LIB64DIR}/hpux64"
fi
UNINSTALL64="uninstall64bit"
fi
;;
IRIX)
if test "x$enable_32bit" = xyes; then
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$prefix/lib32"
UNINSTALL32="uninstall32bit"
fi
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries, 32-bit base...
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$prefix/lib64"
UNINSTALL64="uninstall64bit"
fi
;;
Linux*)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib"
if test -d /usr/lib32; then
LIB32DIR="${LIB32DIR}32"
fi
UNINSTALL32="uninstall32bit"
fi
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries, 32-bit base...
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib"
if test -d /usr/lib64; then
LIB64DIR="${LIB64DIR}64"
fi
UNINSTALL64="uninstall64bit"
fi
;;
SunOS*)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib/32"
UNINSTALL32="uninstall32bit"
fi
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries, 32-bit base...
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib/64"
UNINSTALL64="uninstall64bit"
fi
;;
esac
dnl
dnl End of "$Id$".
dnl
+10 -11
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-common.m4 5930 2006-09-07 19:49:34Z mike $"
dnl "$Id: cups-common.m4 6145 2006-12-06 20:10:16Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -28,12 +28,9 @@ AC_PREREQ(2.50)
dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Versio number information...
CUPS_VERSION="1.2.4"
dnl Version number information...
CUPS_VERSION="1.2.8"
CUPS_REVISION=""
if test -z "$CUPS_REVISION" -a -d .svn; then
CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
fi
AC_SUBST(CUPS_VERSION)
AC_SUBST(CUPS_REVISION)
@@ -132,6 +129,7 @@ AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
dnl Checks for string functions.
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
@@ -231,12 +229,13 @@ case $uname in
AC_MSG_CHECKING(for DBUS)
if $PKGCONFIG --exists dbus-1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DBUS)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
DBUSDIR="/etc/dbus-1/system.d"
AC_CHECK_LIB(dbus-1,
dbus_message_iter_init_append,
AC_DEFINE(HAVE_DBUS)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
DBUSDIR="/etc/dbus-1/system.d")
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
else
AC_MSG_RESULT(no)
fi
@@ -265,5 +264,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl
dnl End of "$Id: cups-common.m4 5930 2006-09-07 19:49:34Z mike $".
dnl End of "$Id: cups-common.m4 6145 2006-12-06 20:10:16Z mike $".
dnl
+67 -92
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $"
dnl "$Id: cups-compiler.m4 6145 2006-12-06 20:10:16Z mike $"
dnl
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -46,41 +46,15 @@ fi
AC_SUBST(ARCHFLAGS)
dnl Setup support for separate 32/64-bit library generation...
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
specifies 32-bit architecture flags])
ARCH32FLAGS=""
INSTALL32=""
LIB32CUPS=""
LIB32CUPSIMAGE=""
LIB32DIR=""
UNINSTALL32=""
AC_SUBST(ARCH32FLAGS)
AC_SUBST(INSTALL32)
AC_SUBST(LIB32CUPS)
AC_SUBST(LIB32CUPSIMAGE)
AC_SUBST(LIB32DIR)
AC_SUBST(UNINSTALL32)
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
specifies 64-bit architecture flags])
ARCH64FLAGS=""
INSTALL64=""
LIB64CUPS=""
LIB64CUPSIMAGE=""
LIB64DIR=""
UNINSTALL64=""
AC_SUBST(ARCH64FLAGS)
AC_SUBST(INSTALL64)
AC_SUBST(LIB64CUPS)
AC_SUBST(LIB64CUPSIMAGE)
AC_SUBST(LIB64DIR)
AC_SUBST(UNINSTALL64)
dnl Position-Independent Executable support on Linux and *BSD...
AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
@@ -93,6 +67,7 @@ PIEFLAGS=""
AC_SUBST(PIEFLAGS)
if test -n "$GCC"; then
# Add GCC-specific compiler options...
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
# Default to optimize-for-size and debug
@@ -128,6 +103,42 @@ if test -n "$GCC"; then
fi
case "$uname" in
HP-UX*)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
if test -z "$with_arch32flags"; then
ARCH32FLAGS="-milp32"
else
ARCH32FLAGS="$with_arch32flags"
fi
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
ARCHFLAGS="-mlp64"
else
ARCHFLAGS="$with_arch64flags"
fi
fi
fi
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries, 32-bit base...
if test -z "$with_arch64flags"; then
ARCH64FLAGS="-mlp64"
else
ARCH64FLAGS="$with_arch64flags"
fi
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
ARCHFLAGS="-milp32"
else
ARCHFLAGS="$with_arch32flags"
fi
fi
fi
;;
IRIX)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
@@ -136,11 +147,6 @@ if test -n "$GCC"; then
else
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$prefix/lib32"
UNINSTALL32="uninstall32bit"
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
@@ -158,11 +164,6 @@ if test -n "$GCC"; then
else
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$prefix/lib64"
UNINSTALL64="uninstall64bit"
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
@@ -182,14 +183,6 @@ if test -n "$GCC"; then
else
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib"
if test -d /usr/lib32; then
LIB32DIR="${LIB32DIR}32"
fi
UNINSTALL32="uninstall32bit"
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
@@ -207,14 +200,6 @@ if test -n "$GCC"; then
else
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib"
if test -d /usr/lib64; then
LIB64DIR="${LIB64DIR}64"
fi
UNINSTALL64="uninstall64bit"
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
@@ -234,11 +219,6 @@ if test -n "$GCC"; then
else
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib/32"
UNINSTALL32="uninstall32bit"
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
@@ -256,11 +236,6 @@ if test -n "$GCC"; then
else
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib/64"
UNINSTALL64="uninstall64bit"
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
@@ -273,6 +248,7 @@ if test -n "$GCC"; then
;;
esac
else
# Add vendor-specific compiler options...
case $uname in
AIX*)
if test -z "$OPTIM"; then
@@ -321,11 +297,6 @@ else
else
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$prefix/lib32"
UNINSTALL32="uninstall32bit"
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
@@ -343,11 +314,6 @@ else
else
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$prefix/lib64"
UNINSTALL64="uninstall64bit"
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
@@ -358,6 +324,16 @@ else
fi
fi
;;
OSF*)
# Tru64 UNIX aka Digital UNIX aka OSF/1
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
OPTIM="-O"
else
OPTIM="$with_optim"
fi
fi
;;
SunOS*)
# Solaris
if test -z "$OPTIM"; then
@@ -376,11 +352,6 @@ else
# Compiling on a Solaris system, build 64-bit
# binaries with separate 32-bit libraries...
ARCH32FLAGS="-xarch=generic"
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib/32"
UNINSTALL32="uninstall32bit"
if test "x$with_optim" = x; then
# Suppress all of Sun's questionable
@@ -400,11 +371,6 @@ else
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries...
ARCH64FLAGS="-xarch=generic64"
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib/64"
UNINSTALL64="uninstall64bit"
fi
if test "x$with_optim" = x; then
@@ -449,16 +415,25 @@ else
esac
fi
if test $uname = HP-UX; then
# HP-UX 10.20 (at least) needs this definition to get the
# h_errno global...
OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
# Add general compiler options per platform...
case $uname in
HP-UX*)
# HP-UX 10.20 (at least) needs this definition to get the
# h_errno global...
OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
# HP-UX 11.00 (at least) needs this definition to get the
# u_short type used by the IP headers...
OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
fi
# HP-UX 11.00 (at least) needs this definition to get the
# u_short type used by the IP headers...
OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
;;
OSF*)
# Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
# to be POSIX-compliant...
OPTIM="$OPTIM -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE"
;;
esac
dnl
dnl End of "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $".
dnl End of "$Id: cups-compiler.m4 6145 2006-12-06 20:10:16Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,10 +1,10 @@
dnl
dnl "$Id: cups-defaults.m4 5980 2006-09-21 19:01:55Z mike $"
dnl "$Id: cups-defaults.m4 6234 2007-02-05 20:25:50Z mike $"
dnl
dnl Default cupsd configuration settings for the Common UNIX Printing System
dnl (CUPS).
dnl
dnl Copyright 2006 by Easy Software Products, all rights reserved.
dnl Copyright 2006-2007 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
@@ -24,11 +24,11 @@ dnl WWW: http://www.cups.org
dnl
dnl Default langugages...
AC_ARG_WITH(languages, [ --with-languages set installed languages, default="de es ja pl sv" ],
AC_ARG_WITH(languages, [ --with-languages set installed languages, default="de es et fr it ja pl sv" ],
if test "x$withval" != xno; then
LANGUAGES="$withval"
fi,
LANGUAGES="de es ja pl sv")
LANGUAGES="de es et fr it ja pl sv")
AC_SUBST(LANGUAGES)
dnl Default ConfigFilePerm
@@ -252,5 +252,5 @@ fi
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
dnl
dnl End of "$Id: cups-defaults.m4 5980 2006-09-21 19:01:55Z mike $".
dnl End of "$Id: cups-defaults.m4 6234 2007-02-05 20:25:50Z mike $".
dnl
+9 -4
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-network.m4 5634 2006-06-06 17:48:27Z mike $"
dnl "$Id: cups-network.m4 6049 2006-10-20 15:07:21Z mike $"
dnl
dnl Networking stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -24,12 +24,17 @@ dnl
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(gethostbyaddr, nsl)
AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
AC_SEARCH_LIBS(getifaddrs, nsl, AC_DEFINE(HAVE_GETIFADDRS))
AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
AC_SEARCH_LIBS(hstrerror, nsl socket resolv, AC_DEFINE(HAVE_HSTRERROR))
AC_SEARCH_LIBS(rresvport_af, nsl, AC_DEFINE(HAVE_RRESVPORT_AF))
# Tru64 5.1b leaks file descriptors with these functions; disable until
# we can come up with a test for this...
if test "$uname" != "OSF1"; then
AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
fi
AC_CHECK_MEMBER(struct sockaddr.sa_len,,, [#include <sys/socket.h>])
AC_CHECK_HEADER(sys/sockio.h, AC_DEFINE(HAVE_SYS_SOCKIO_H))
@@ -85,5 +90,5 @@ AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
AC_SUBST(CUPS_LISTEN_DOMAINSOCKET)
dnl
dnl End of "$Id: cups-network.m4 5634 2006-06-06 17:48:27Z mike $".
dnl End of "$Id: cups-network.m4 6049 2006-10-20 15:07:21Z mike $".
dnl
+4 -3
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-opsys.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-opsys.m4 6145 2006-12-06 20:10:16Z mike $"
dnl
dnl Operating system stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -22,9 +22,10 @@ dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl Get the operating system and version number...
dnl Get the operating system, version number, and architecture...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/^[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\).*/\1\2/'`
uarch=`uname -m`
case "$uname" in
GNU* | GNU/*)
@@ -39,5 +40,5 @@ case "$uname" in
esac
dnl
dnl "$Id: cups-opsys.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-opsys.m4 6145 2006-12-06 20:10:16Z mike $"
dnl
+28 -9
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-sharedlibs.m4 5582 2006-05-24 01:00:35Z mike $"
dnl "$Id: cups-sharedlibs.m4 6145 2006-12-06 20:10:16Z mike $"
dnl
dnl Shared library support for the Common UNIX Printing System (CUPS).
dnl
@@ -36,10 +36,20 @@ if test x$enable_shared != xno; then
DSOFLAGS="$DSOFLAGS -Wl,-h,\`basename \$@\` -G \$(OPTIM)"
;;
HP-UX*)
LIBCUPS="libcups.sl.2"
LIBCUPSIMAGE="libcupsimage.sl.2"
DSO="\$(LD)"
DSOFLAGS="$DSOFLAGS -b -z +h \`basename \$@\`"
case "$uarch" in
ia64)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-b,-z,+h,\`basename \$@\`"
;;
*)
LIBCUPS="libcups.sl.2"
LIBCUPSIMAGE="libcupsimage.sl.2"
DSO="\$(LD)"
DSOFLAGS="$DSOFLAGS -b -z +h \`basename \$@\`"
;;
esac
;;
IRIX)
LIBCUPS="libcups.so.2"
@@ -126,9 +136,18 @@ if test "$DSO" != ":"; then
case $uname in
HP-UX*)
# HP-UX needs the path, even for /usr/lib...
DSOFLAGS="+s +b $libdir $DSOFLAGS"
DSO32FLAGS="+s +b $LIB32DIR $DSO32FLAGS"
DSO64FLAGS="+s +b $LIB64DIR $DSO64FLAGS"
case "$uarch" in
ia64)
DSOFLAGS="-Wl,+s,+b,$libdir $DSOFLAGS"
DSO32FLAGS="-Wl,+s,+b,$LIB32DIR $DSO32FLAGS"
DSO64FLAGS="-Wl,+s,+b,$LIB64DIR $DSO64FLAGS"
;;
*)
DSOFLAGS="+s +b $libdir $DSOFLAGS"
DSO32FLAGS="+s +b $LIB32DIR $DSO32FLAGS"
DSO64FLAGS="+s +b $LIB64DIR $DSO64FLAGS"
;;
esac
LDFLAGS="$LDFLAGS -Wl,+s,+b,$libdir"
EXPORT_LDFLAGS="-Wl,+s,+b,$libdir"
;;
@@ -173,5 +192,5 @@ AC_SUBST(IMGLIBS)
AC_SUBST(EXPORT_LDFLAGS)
dnl
dnl End of "$Id: cups-sharedlibs.m4 5582 2006-05-24 01:00:35Z mike $".
dnl End of "$Id: cups-sharedlibs.m4 6145 2006-12-06 20:10:16Z mike $".
dnl
+30 -12
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-ssl.m4 5630 2006-06-05 18:42:53Z mike $"
dnl "$Id: cups-ssl.m4 6238 2007-02-06 16:04:25Z mike $"
dnl
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2007 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
@@ -42,15 +42,33 @@ if test x$enable_ssl != xno; then
dnl Look for CDSA...
if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
if test $uname = Darwin; then
AC_CHECK_HEADER(Security/SecureTransport.h,
[SSLLIBS="-framework CoreFoundation -framework Security"
# MacOS X doesn't (yet) come with pre-installed encryption
# certificates for CUPS, so don't enable encryption on
# /admin just yet...
#ENCRYPTION_REQUIRED=" Encryption Required"
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_CDSASSL)])
AC_CHECK_HEADER(Security/SecureTransport.h, [
SSLLIBS="-framework CoreFoundation -framework Security"
# MacOS X doesn't (yet) come with pre-installed encryption
# certificates for CUPS, so don't enable encryption on
# /admin just yet...
#ENCRYPTION_REQUIRED=" Encryption Required"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_CDSASSL)
dnl Check for the various security headers...
AC_CHECK_HEADER(Security/SecPolicy.h,
AC_DEFINE(HAVE_SECPOLICY_H))
AC_CHECK_HEADER(Security/SecPolicyPriv.h,
AC_DEFINE(HAVE_SECPOLICYPRIV_H))
AC_CHECK_HEADER(Security/SecBasePriv.h,
AC_DEFINE(HAVE_SECBASEPRIV_H))
AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
dnl Check for SecIdentitySearchCreateWithPolicy...
AC_MSG_CHECKING(for SecIdentitySearchCreateWithPolicy)
if test $uversion -ge 80; then
AC_DEFINE(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi])
fi
fi
@@ -115,5 +133,5 @@ AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-ssl.m4 5630 2006-06-05 18:42:53Z mike $".
dnl End of "$Id: cups-ssl.m4 6238 2007-02-06 16:04:25Z mike $".
dnl
+8 -2
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-threads.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-threads.m4 6061 2006-10-23 00:26:52Z mike $"
dnl
dnl Threading stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -44,6 +44,12 @@ if test "x$enable_threads" != xno; then
if test $have_pthread = yes; then
PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
# be POSIX-compliant... :(
if test $uname = SunOS; then
PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
fi
break
fi
done
@@ -53,5 +59,5 @@ fi
AC_SUBST(PTHREAD_FLAGS)
dnl
dnl End of "$Id: cups-threads.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-threads.m4 6061 2006-10-23 00:26:52Z mike $".
dnl
+27 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Configuration file for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -147,6 +147,13 @@
#undef HAVE_CRYPT_H
/*
* Do we have <scsi/sg.h>?
*/
#undef HAVE_SCSI_SG_H
/*
* Use <string.h>, <strings.h>, and/or <bstring.h>?
*/
@@ -261,10 +268,20 @@
/*
* Do we have <Security/SecBasePriv.h>?
* What Security framework headers do we have?
*/
#undef HAVE_SECPOLICY_H
#undef HAVE_SECPOLICYPRIV_H
#undef HAVE_SECBASEPRIV_H
#undef HAVE_SECIDENTITYSEARCHPRIV_H
/*
* Do we have the SecIdentitySearchCreateWithPolicy function?
*/
#undef HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
/*
@@ -413,6 +430,13 @@
#undef HAVE_CFBUNDLEPRIV_H
/*
* Do we have CFLocaleCreateCanonicalLocaleIdentifierFromString()?
*/
#undef HAVE_CF_LOCALE_ID
/*
* Do we have MacOSX 10.4's mbr_XXX functions()?
*/
@@ -434,6 +458,7 @@
*/
#undef HAVE_DBUS
#undef HAVE_DBUS_MESSAGE_ITER_INIT_APPEND
/*
+1
Ver Arquivo
@@ -29,6 +29,7 @@ sinclude(config-scripts/cups-common.m4)
sinclude(config-scripts/cups-directories.m4)
sinclude(config-scripts/cups-manpages.m4)
sinclude(config-scripts/cups-3264.m4)
sinclude(config-scripts/cups-sharedlibs.m4)
sinclude(config-scripts/cups-libtool.m4)
sinclude(config-scripts/cups-compiler.m4)
+233 -70
Ver Arquivo
@@ -7,7 +7,7 @@
* MANY OF THE FUNCTIONS IN THIS HEADER ARE PRIVATE AND SUBJECT TO
* CHANGE AT ANY TIME. USE AT YOUR OWN RISK.
*
* Copyright 2001-2006 by Easy Software Products.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -48,9 +48,12 @@
#include "debug.h"
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
#ifdef WIN32
#else
# include <unistd.h>
# include <sys/wait.h>
#endif /* WIN32 */
/*
@@ -243,7 +246,7 @@ cupsAdminCreateWindowsPPD(
if ((ptr = strchr(line, ':')) == NULL)
{
snprintf(line, sizeof(line),
_cupsLangString(language, _("Missing value on line %d!\n")),
_cupsLangString(language, _("Missing value on line %d!")),
linenum);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
@@ -262,7 +265,7 @@ cupsAdminCreateWindowsPPD(
{
snprintf(line, sizeof(line),
_cupsLangString(language,
_("Missing double quote on line %d!\n")),
_("Missing double quote on line %d!")),
linenum);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
@@ -281,7 +284,7 @@ cupsAdminCreateWindowsPPD(
{
snprintf(line, sizeof(line),
_cupsLangString(language,
_("Bad option + choice on line %d!\n")),
_("Bad option + choice on line %d!")),
linenum);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
@@ -324,6 +327,21 @@ cupsAdminCreateWindowsPPD(
cupsFileClose(srcfp);
unlink(src);
if (linenum == 0)
{
snprintf(line, sizeof(line),
_cupsLangString(language, _("Empty PPD file!")),
linenum);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
cupsFileClose(dstfp);
unlink(buffer);
*buffer = '\0';
return (NULL);
}
/*
* Now add the CUPS-specific attributes and options...
*/
@@ -656,7 +674,7 @@ cupsAdminExportSamba(
{
snprintf(message, sizeof(message),
_cupsLangString(language,
_("Unable to set Windows printer driver (%d)!\n")),
_("Unable to set Windows printer driver (%d)!")),
status);
_cupsSetError(IPP_INTERNAL_ERROR, message);
@@ -985,6 +1003,11 @@ _cupsAdminSetServerSettings(
wrote_root_location; /* Wrote the / location? */
int indent; /* Indentation */
int cupsd_num_settings; /* New number of settings */
int old_remote_printers, /* Show remote printers */
old_share_printers, /* Share local printers */
old_remote_admin, /* Remote administration allowed? */
old_user_cancel_any, /* Cancel-job policy set? */
old_debug_logging; /* LogLevel debug set? */
cups_option_t *cupsd_settings, /* New settings */
*setting; /* Current setting */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
@@ -1017,39 +1040,134 @@ _cupsAdminSetServerSettings(
else
return (0);
/*
* Get current settings...
*/
if (!_cupsAdminGetServerSettings(http, &cupsd_num_settings,
&cupsd_settings))
return (0);
if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, cupsd_num_settings,
cupsd_settings)) != NULL)
old_debug_logging = atoi(val);
else
old_debug_logging = 0;
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, cupsd_num_settings,
cupsd_settings)) != NULL)
old_remote_admin = atoi(val);
else
old_remote_admin = 0;
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, cupsd_num_settings,
cupsd_settings)) != NULL)
old_remote_printers = atoi(val);
else
old_remote_printers = 1;
if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, cupsd_num_settings,
cupsd_settings)) != NULL)
old_share_printers = atoi(val);
else
old_share_printers = 0;
if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, cupsd_num_settings,
cupsd_settings)) != NULL)
old_user_cancel_any = atoi(val);
else
old_user_cancel_any = 0;
cupsFreeOptions(cupsd_num_settings, cupsd_settings);
/*
* Get basic settings...
*/
if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, num_settings,
settings)) != NULL)
{
debug_logging = atoi(val);
if (debug_logging == old_debug_logging)
{
/*
* No change to this setting...
*/
debug_logging = -1;
}
}
else
debug_logging = 0;
debug_logging = -1;
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings,
settings)) != NULL)
{
remote_admin = atoi(val);
if (remote_admin == old_remote_admin)
{
/*
* No change to this setting...
*/
remote_admin = -1;
}
}
else
remote_admin = 0;
remote_admin = -1;
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, num_settings,
settings)) != NULL)
{
remote_printers = atoi(val);
if (remote_printers == old_remote_printers)
{
/*
* No change to this setting...
*/
remote_printers = -1;
}
}
else
remote_printers = 1;
remote_printers = -1;
if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, num_settings,
settings)) != NULL)
{
share_printers = atoi(val);
if (share_printers == old_share_printers)
{
/*
* No change to this setting...
*/
share_printers = -1;
}
}
else
share_printers = 0;
share_printers = -1;
if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, num_settings,
settings)) != NULL)
{
user_cancel_any = atoi(val);
if (user_cancel_any == old_user_cancel_any)
{
/*
* No change to this setting...
*/
user_cancel_any = -1;
}
}
else
user_cancel_any = 0;
user_cancel_any = -1;
/*
* Create a temporary file for the new cupsd.conf file...
@@ -1101,13 +1219,14 @@ _cupsAdminSetServerSettings(
while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
{
if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) &&
(share_printers >= 0 || remote_admin >= 0))
{
if (!wrote_port_listen)
{
wrote_port_listen = 1;
if (share_printers || remote_admin)
if (share_printers > 0 || remote_admin > 0)
{
cupsFilePuts(temp, "# Allow remote access\n");
cupsFilePrintf(temp, "Port %d\n", server_port);
@@ -1125,26 +1244,30 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "Listen " CUPS_DEFAULT_DOMAINSOCKET "\n");
#endif /* CUPS_DEFAULT_DOMAINSOCKET */
}
else if (value && value[0] == '/' &&
strcmp(CUPS_DEFAULT_DOMAINSOCKET, value))
else if (value && value[0] == '/'
#ifdef CUPS_DEFAULT_DOMAINSOCKET
&& strcmp(CUPS_DEFAULT_DOMAINSOCKET, value)
#endif /* CUPS_DEFAULT_DOMAINSOCKET */
)
cupsFilePrintf(temp, "Listen %s\n", value);
}
else if (!strcasecmp(line, "Browsing") ||
!strcasecmp(line, "BrowseAddress") ||
!strcasecmp(line, "BrowseAllow") ||
!strcasecmp(line, "BrowseDeny") ||
!strcasecmp(line, "BrowseOrder"))
else if ((!strcasecmp(line, "Browsing") ||
!strcasecmp(line, "BrowseAddress") ||
!strcasecmp(line, "BrowseAllow") ||
!strcasecmp(line, "BrowseDeny") ||
!strcasecmp(line, "BrowseOrder")) &&
(remote_printers >= 0 || share_printers >= 0))
{
if (!wrote_browsing)
{
wrote_browsing = 1;
if (remote_printers || share_printers)
if (remote_printers > 0 || share_printers > 0)
{
if (remote_printers && share_printers)
if (remote_printers > 0 && share_printers > 0)
cupsFilePuts(temp,
"# Enable printer sharing and shared printers.\n");
else if (remote_printers)
else if (remote_printers > 0)
cupsFilePuts(temp,
"# Show shared printers on the local network.\n");
else
@@ -1154,10 +1277,10 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "Browsing On\n");
cupsFilePuts(temp, "BrowseOrder allow,deny\n");
if (remote_printers)
if (remote_printers > 0)
cupsFilePuts(temp, "BrowseAllow @LOCAL\n");
if (share_printers)
if (share_printers > 0)
cupsFilePuts(temp, "BrowseAddress @LOCAL\n");
}
else
@@ -1168,7 +1291,7 @@ _cupsAdminSetServerSettings(
}
}
}
else if (!strcasecmp(line, "LogLevel"))
else if (!strcasecmp(line, "LogLevel") && debug_logging >= 0)
{
wrote_loglevel = 1;
@@ -1231,13 +1354,13 @@ _cupsAdminSetServerSettings(
{
in_location = 0;
indent -= 2;
if (in_admin_location)
if (in_admin_location && remote_admin >= 0)
{
wrote_admin_location = 1;
if (remote_admin)
cupsFilePuts(temp, " # Allow remote administration...\n");
else
else if (remote_admin == 0)
cupsFilePuts(temp, " # Restrict access to the admin pages...\n");
cupsFilePuts(temp, " Order allow,deny\n");
@@ -1247,7 +1370,7 @@ _cupsAdminSetServerSettings(
else
cupsFilePuts(temp, " Allow localhost\n");
}
else if (in_conf_location)
else if (in_conf_location && remote_admin >= 0)
{
wrote_conf_location = 1;
@@ -1265,23 +1388,23 @@ _cupsAdminSetServerSettings(
else
cupsFilePuts(temp, " Allow localhost\n");
}
else if (in_root_location)
else if (in_root_location && (remote_admin >= 0 || share_printers >= 0))
{
wrote_root_location = 1;
if (remote_admin && share_printers)
if (remote_admin > 0 && share_printers > 0)
cupsFilePuts(temp, " # Allow shared printing and remote "
"administration...\n");
else if (remote_admin)
else if (remote_admin > 0)
cupsFilePuts(temp, " # Allow remote administration...\n");
else if (share_printers)
else if (share_printers > 0)
cupsFilePuts(temp, " # Allow shared printing...\n");
else
cupsFilePuts(temp, " # Restrict access to the server...\n");
cupsFilePuts(temp, " Order allow,deny\n");
if (remote_admin || share_printers)
if (remote_admin > 0 || share_printers > 0)
cupsFilePuts(temp, " Allow @LOCAL\n");
else
cupsFilePuts(temp, " Allow localhost\n");
@@ -1304,7 +1427,7 @@ _cupsAdminSetServerSettings(
indent += 2;
if (!strcasecmp(value, "cancel-job"))
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
{
/*
* Don't write anything for this limit section...
@@ -1323,7 +1446,7 @@ _cupsAdminSetServerSettings(
if (*valptr)
*valptr++ = '\0';
if (!strcasecmp(value, "cancel-job"))
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
{
/*
* Write everything except for this definition...
@@ -1359,7 +1482,9 @@ _cupsAdminSetServerSettings(
in_cancel_job = 0;
}
else if ((in_admin_location || in_conf_location || in_root_location) &&
else if ((((in_admin_location || in_conf_location || in_root_location) &&
remote_admin >= 0) ||
(in_root_location && share_printers >= 0)) &&
(!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny") ||
!strcasecmp(line, "Order")))
continue;
@@ -1424,13 +1549,13 @@ _cupsAdminSetServerSettings(
* Write any missing info...
*/
if (!wrote_browsing)
if (!wrote_browsing && (remote_printers >= 0 || share_printers >= 0))
{
if (remote_printers || share_printers)
if (remote_printers > 0 || share_printers > 0)
{
if (remote_printers && share_printers)
if (remote_printers > 0 && share_printers > 0)
cupsFilePuts(temp, "# Enable printer sharing and shared printers.\n");
else if (remote_printers)
else if (remote_printers > 0)
cupsFilePuts(temp, "# Show shared printers on the local network.\n");
else
cupsFilePuts(temp, "# Share local printers on the local network.\n");
@@ -1438,10 +1563,10 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "Browsing On\n");
cupsFilePuts(temp, "BrowseOrder allow,deny\n");
if (remote_printers)
if (remote_printers > 0)
cupsFilePuts(temp, "BrowseAllow @LOCAL\n");
if (share_printers)
if (share_printers > 0)
cupsFilePuts(temp, "BrowseAddress @LOCAL\n");
}
else
@@ -1451,7 +1576,7 @@ _cupsAdminSetServerSettings(
}
}
if (!wrote_loglevel)
if (!wrote_loglevel && debug_logging >= 0)
{
if (debug_logging)
{
@@ -1465,9 +1590,9 @@ _cupsAdminSetServerSettings(
}
}
if (!wrote_port_listen)
if (!wrote_port_listen && (share_printers >= 0 || remote_admin >= 0))
{
if (share_printers || remote_admin)
if (share_printers > 0 || remote_admin > 0)
{
cupsFilePuts(temp, "# Allow remote access\n");
cupsFilePrintf(temp, "Port %d\n", ippPort());
@@ -1485,14 +1610,14 @@ _cupsAdminSetServerSettings(
#endif /* CUPS_DEFAULT_DOMAINSOCKET */
}
if (!wrote_root_location)
if (!wrote_root_location && (remote_admin >= 0 || share_printers >= 0))
{
if (remote_admin && share_printers)
if (remote_admin > 0 && share_printers > 0)
cupsFilePuts(temp,
"# Allow shared printing and remote administration...\n");
else if (remote_admin)
else if (remote_admin > 0)
cupsFilePuts(temp, "# Allow remote administration...\n");
else if (share_printers)
else if (share_printers > 0)
cupsFilePuts(temp, "# Allow shared printing...\n");
else
cupsFilePuts(temp, "# Restrict access to the server...\n");
@@ -1500,7 +1625,7 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "<Location />\n"
" Order allow,deny\n");
if (remote_admin || share_printers)
if (remote_admin > 0 || share_printers > 0)
cupsFilePuts(temp, " Allow @LOCAL\n");
else
cupsFilePuts(temp, " Allow localhost\n");
@@ -1508,7 +1633,7 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "</Location>\n");
}
if (!wrote_admin_location)
if (!wrote_admin_location && remote_admin >= 0)
{
if (remote_admin)
cupsFilePuts(temp, "# Allow remote administration...\n");
@@ -1526,7 +1651,7 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "</Location>\n");
}
if (!wrote_conf_location)
if (!wrote_conf_location && remote_admin >= 0)
{
if (remote_admin)
cupsFilePuts(temp,
@@ -1547,7 +1672,7 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "</Location>\n");
}
if (!wrote_policy)
if (!wrote_policy && user_cancel_any >= 0)
{
cupsFilePuts(temp, "<Policy default>\n"
" # Job-related operations must be done by the owner "
@@ -1626,21 +1751,50 @@ _cupsAdminSetServerSettings(
* Updated OK, add the basic settings...
*/
cupsd_num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
debug_logging ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
remote_admin ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
remote_printers ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
cupsd_num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
share_printers ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
cupsd_num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
user_cancel_any ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
if (debug_logging >= 0)
cupsd_num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
debug_logging ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
else
cupsd_num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
old_debug_logging ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
if (remote_admin >= 0)
cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
remote_admin ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
else
cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
old_remote_admin ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
if (remote_printers >= 0)
cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
remote_printers ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
else
cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
old_remote_printers ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
if (share_printers >= 0)
cupsd_num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
share_printers ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
else
cupsd_num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
old_share_printers ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
if (user_cancel_any >= 0)
cupsd_num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
user_cancel_any ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
else
cupsd_num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
old_user_cancel_any ? "1" : "0",
cupsd_num_settings, &cupsd_settings);
/*
* Save the new values...
@@ -1681,6 +1835,10 @@ do_samba_command(const char *command, /* I - Command to run */
const char *authfile, /* I - Samba authentication file */
FILE *logfile) /* I - Optional log file */
{
#ifdef WIN32
return (1); /* Always fail on Windows... */
#else
int status; /* Status of command */
int pid; /* Process ID of child */
@@ -1739,6 +1897,7 @@ do_samba_command(const char *command, /* I - Command to run */
return (WEXITSTATUS(status));
else
return (-WTERMSIG(status));
#endif /* WIN32 */
}
@@ -1756,7 +1915,9 @@ get_cupsd_conf(
int *remote) /* O - Remote file? */
{
int fd; /* Temporary file descriptor */
#ifndef WIN32
struct stat info; /* cupsd.conf file information */
#endif /* WIN32 */
http_status_t status; /* Status of getting cupsd.conf */
char host[HTTP_MAX_HOST]; /* Hostname for connection */
@@ -1773,6 +1934,7 @@ get_cupsd_conf(
snprintf(name, namesize, "%s/cupsd.conf", cg->cups_serverroot);
*remote = 0;
#ifndef WIN32
if (!strcasecmp(host, "localhost") && !access(name, R_OK))
{
/*
@@ -1799,6 +1961,7 @@ get_cupsd_conf(
status = HTTP_OK;
}
else
#endif /* !WIN32 */
{
/*
* Read cupsd.conf via a HTTP GET request...
+12 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Authentication functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -75,6 +75,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
realm[HTTP_MAX_VALUE], /* realm="xyz" string */
nonce[HTTP_MAX_VALUE], /* nonce="xyz" string */
encode[512]; /* Encoded username:password */
_cups_globals_t *cg; /* Global data */
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")\n",
@@ -114,8 +115,15 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
* Nope - get a new password from the user...
*/
snprintf(prompt, sizeof(prompt), _("Password for %s on %s? "), cupsUser(),
http->hostname[0] == '/' ? "localhost" : http->hostname);
cg = _cupsGlobals();
if (!cg->lang_default)
cg->lang_default = cupsLangDefault();
snprintf(prompt, sizeof(prompt),
_cupsLangString(cg->lang_default, _("Password for %s on %s? ")),
cupsUser(),
http->hostname[0] == '/' ? "localhost" : http->hostname);
http->digest_tries = strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],
"Digest", 5) != 0;
@@ -144,7 +152,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
*/
httpEncode64_2(encode, sizeof(encode), http->userpass,
strlen(http->userpass));
(int)strlen(http->userpass));
snprintf(http->authstring, sizeof(http->authstring), "Basic %s", encode);
}
else
+10 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backchannel functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -95,7 +95,11 @@ cupsBackChannelRead(char *buffer, /* I - Buffer to read */
* Read bytes from the pipe...
*/
#ifdef WIN32
return ((ssize_t)read(3, buffer, (unsigned)bytes));
#else
return (read(3, buffer, bytes));
#endif /* WIN32 */
}
@@ -153,7 +157,11 @@ cupsBackChannelWrite(
* Write bytes to the pipe...
*/
#ifdef WIN32
count = (ssize_t)write(3, buffer, (unsigned)(bytes - total));
#else
count = write(3, buffer, bytes - total);
#endif /* WIN32 */
if (count < 0)
{
@@ -175,7 +183,7 @@ cupsBackChannelWrite(
}
}
return (bytes);
return ((ssize_t)bytes);
}
+10 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* API definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -31,6 +31,13 @@
* Include necessary headers...
*/
# include <sys/types.h>
# if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
# define __CUPS_SSIZE_T_DEFINED
/* Windows does not support the ssize_t type, so map it to off_t... */
typedef off_t ssize_t; /* @private@ */
# endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */
# include "ipp.h"
# include "ppd.h"
# include "language.h"
@@ -61,10 +68,10 @@ extern "C" {
* Constants...
*/
# define CUPS_VERSION 1.0204
# define CUPS_VERSION 1.0208
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 2
# define CUPS_VERSION_PATCH 4
# define CUPS_VERSION_PATCH 8
# define CUPS_DATE_ANY -1
+58 -14
Ver Arquivo
@@ -4,7 +4,7 @@
* User-defined destination (and option) support for the Common UNIX
* Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -64,21 +64,31 @@ static int cups_get_sdests(http_t *http, ipp_op_t op, int num_dests,
/*
* 'cupsAddDest()' - Add a destination to the list of destinations.
*
* Use the cupsSaveDests() function to save the updated list of destinations
* to the user's lpoptions file.
* This function cannot be used to add a new class or printer queue,
* it only adds a new container of saved options for the named
* destination or instance.
*
* If the named destination already exists, the destination list is
* returned unchanged. Adding a new instance of a destination creates
* a copy of that destination's options.
*
* Use the cupsSaveDests() function to save the updated list of
* destinations to the user's lpoptions file.
*/
int /* O - New number of destinations */
cupsAddDest(const char *name, /* I - Name of destination */
const char *instance, /* I - Instance of destination or NULL for none/primary */
cupsAddDest(const char *name, /* I - Destination name */
const char *instance, /* I - Instance name or NULL for none/primary */
int num_dests, /* I - Number of destinations */
cups_dest_t **dests) /* IO - Destinations */
{
int i; /* Looping var */
cups_dest_t *dest; /* Destination pointer */
cups_dest_t *parent; /* Parent destination */
cups_option_t *option; /* Current option */
if (name == NULL || dests == NULL)
if (!name || !dests)
return (0);
if ((dest = cupsGetDest(name, instance, num_dests, *dests)) != NULL)
@@ -98,27 +108,53 @@ cupsAddDest(const char *name, /* I - Name of destination */
*dests = dest;
/*
* Find where to insert the destination...
*/
for (i = num_dests; i > 0; i --, dest ++)
if (strcasecmp(name, dest->name) < 0)
break;
else if (!instance && dest->instance)
break;
else if (!strcasecmp(name, dest->name) &&
instance != NULL && dest->instance != NULL &&
instance && dest->instance &&
strcasecmp(instance, dest->instance) < 0)
break;
if (i > 0)
memmove(dest + 1, dest, i * sizeof(cups_dest_t));
/*
* Initialize the destination...
*/
dest->name = strdup(name);
dest->is_default = 0;
dest->num_options = 0;
dest->options = (cups_option_t *)0;
if (instance == NULL)
if (!instance)
dest->instance = NULL;
else
{
/*
* Copy options from the primary instance...
*/
dest->instance = strdup(instance);
if ((parent = cupsGetDest(name, NULL, num_dests + 1, *dests)) != NULL)
{
for (i = parent->num_options, option = parent->options;
i > 0;
i --, option ++)
dest->num_options = cupsAddOption(option->name, option->value,
dest->num_options,
&(dest->options));
}
}
return (num_dests + 1);
}
@@ -160,18 +196,18 @@ cupsFreeDests(int num_dests, /* I - Number of destinations */
*/
cups_dest_t * /* O - Destination pointer or NULL */
cupsGetDest(const char *name, /* I - Name of destination */
const char *instance, /* I - Instance of destination */
cupsGetDest(const char *name, /* I - Destination name or NULL for the default destination */
const char *instance, /* I - Instance name or NULL */
int num_dests, /* I - Number of destinations */
cups_dest_t *dests) /* I - Destinations */
{
int comp; /* Result of comparison */
if (num_dests == 0 || dests == NULL)
if (num_dests <= 0 || !dests)
return (NULL);
if (name == NULL)
if (!name)
{
/*
* NULL name for default printer.
@@ -198,9 +234,9 @@ cupsGetDest(const char *name, /* I - Name of destination */
return (NULL);
else if (comp == 0)
{
if ((instance == NULL && dests->instance == NULL) ||
if ((!instance && !dests->instance) ||
(instance != NULL && dests->instance != NULL &&
strcasecmp(instance, dests->instance) == 0))
!strcasecmp(instance, dests->instance)))
return (dests);
}
@@ -220,6 +256,9 @@ cupsGetDest(const char *name, /* I - Name of destination */
* printer-info, printer-is-accepting-jobs, printer-is-shared,
* printer-make-and-model, printer-state, printer-state-change-time,
* printer-state-reasons, and printer-type attributes as options.
*
* Use the cupsFreeDests() function to free the destination list and
* the cupsGetDest() function to find a particular destination.
*/
int /* O - Number of destinations */
@@ -252,6 +291,9 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
* printer-make-and-model, printer-state, printer-state-change-time,
* printer-state-reasons, and printer-type attributes as options.
*
* Use the cupsFreeDests() function to free the destination list and
* the cupsGetDest() function to find a particular destination.
*
* @since CUPS 1.1.21@
*/
@@ -458,7 +500,9 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */
cups_option_t *option; /* Current option */
_ipp_option_t *match; /* Matching attribute for option */
FILE *fp; /* File pointer */
#ifndef WIN32
const char *home; /* HOME environment variable */
#endif /* WIN32 */
char filename[1024]; /* lpoptions file */
int num_temps; /* Number of temporary destinations */
cups_dest_t *temps, /* Temporary destinations */
+28 -2
Ver Arquivo
@@ -347,10 +347,12 @@ cupsDirOpen(const char *directory) /* I - Directory name */
cups_dentry_t * /* O - Directory entry */
cupsDirRead(cups_dir_t *dp) /* I - Directory */
{
char buffer[sizeof(struct dirent) + 1024];
/* Directory entry buffer */
struct dirent *entry; /* Pointer to entry */
char filename[1024]; /* Full filename */
# ifdef HAVE_PTHREAD_H
char buffer[sizeof(struct dirent) + 1024];
/* Directory entry buffer */
# endif /* HAVE_PTHREAD_H */
DEBUG_printf(("cupsDirRead(dp=%p)\n", dp));
@@ -368,6 +370,11 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory */
for (;;)
{
# ifdef HAVE_PTHREAD_H
/*
* Read the next entry using the reentrant version of readdir...
*/
if (readdir_r(dp->dir, (struct dirent *)buffer, &entry))
{
DEBUG_printf((" readdir_r() failed - %s\n", strerror(errno)));
@@ -382,6 +389,25 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory */
DEBUG_printf((" readdir_r() returned \"%s\"...\n", entry->d_name));
# else
/*
* Read the next entry using the original version of readdir...
*/
if ((entry = readdir(dp->dir)) == NULL)
{
DEBUG_puts(" readdir() returned a NULL pointer!");
return (NULL);
}
DEBUG_printf((" readdir() returned \"%s\"...\n", entry->d_name));
# endif /* HAVE_PTHREAD_H */
/*
* Skip "." and ".."...
*/
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
continue;
+7 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD code emission routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -291,7 +291,11 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
while (buflength > 0)
{
#ifdef WIN32
if ((bytes = (ssize_t)write(fd, bufptr, (unsigned)buflength)) < 0)
#else
if ((bytes = write(fd, bufptr, buflength)) < 0)
#endif /* WIN32 */
{
if (errno == EAGAIN || errno == EINTR)
continue;
@@ -725,7 +729,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
else
pos = 4;
values[pos] = orientation;
values[pos] = (float)orientation;
for (pos = 0; pos < 5; pos ++)
{
@@ -811,7 +815,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
if (choices[i]->code && choices[i]->code[0])
{
j = strlen(choices[i]->code);
j = (int)strlen(choices[i]->code);
memcpy(bufptr, choices[i]->code, j);
bufptr += j;
+4 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option encoding routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -82,7 +82,7 @@ static const _ipp_option_t ipp_options[] =
{ "natural-scaling-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ "notify-charset", IPP_TAG_CHARSET, IPP_TAG_SUBSCRIPTION },
{ "notify-events", IPP_TAG_KEYWORD, IPP_TAG_SUBSCRIPTION },
{ "notify-lease-time", IPP_TAG_INTEGER, IPP_TAG_SUBSCRIPTION },
{ "notify-lease-duration", IPP_TAG_INTEGER, IPP_TAG_SUBSCRIPTION },
{ "notify-natural-language", IPP_TAG_LANGUAGE, IPP_TAG_SUBSCRIPTION },
{ "notify-pull-method", IPP_TAG_KEYWORD, IPP_TAG_SUBSCRIPTION },
{ "notify-recipient", IPP_TAG_URI, IPP_TAG_SUBSCRIPTION },
@@ -265,7 +265,7 @@ cupsEncodeOptions2(
int namelen; /* Length of name */
namelen = strlen(option->name);
namelen = (int)strlen(option->name);
if (namelen < 9 || strcmp(option->name + namelen - 8, "-default"))
{
@@ -500,7 +500,7 @@ cupsEncodeOptions2(
* octet-string
*/
attr->values[j].unknown.length = strlen(val);
attr->values[j].unknown.length = (int)strlen(val);
attr->values[j].unknown.data = _cupsStrAlloc(val);
DEBUG_printf(("cupsEncodeOptions2: Added octet-string value \"%s\"...\n",
+71 -26
Ver Arquivo
@@ -8,7 +8,7 @@
* our own file functions allows us to provide transparent support of
* gzip'd print files, PPD files, etc.
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -94,6 +94,16 @@
#endif /* !O_LARGEFILE */
/*
* Some operating systems don't define O_BINARY, which is used by Microsoft
* and IBM to flag binary files...
*/
#ifndef O_BINARY
# define O_BINARY 0
#endif /* !O_BINARY */
/*
* Types and structures...
*/
@@ -332,7 +342,11 @@ cupsFileFind(const char *filename, /* I - File to find */
while (*path)
{
#ifdef WIN32
if (*path == ';' || (*path == ':' && ((bufptr - buffer) > 1 || !isalpha(buffer[0] & 255))))
#else
if (*path == ';' || *path == ':')
#endif /* WIN32 */
{
if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend)
*bufptr++ = '/';
@@ -344,7 +358,10 @@ cupsFileFind(const char *filename, /* I - File to find */
#else
if (!access(buffer, executable ? X_OK : 0))
#endif /* WIN32 */
{
DEBUG_printf(("cupsFileFind: Returning \"%s\"\n", buffer));
return (buffer);
}
bufptr = buffer;
}
@@ -364,9 +381,15 @@ cupsFileFind(const char *filename, /* I - File to find */
strlcpy(bufptr, filename, bufend - bufptr);
if (!access(buffer, 0))
{
DEBUG_printf(("cupsFileFind: Returning \"%s\"\n", buffer));
return (buffer);
}
else
{
DEBUG_puts("cupsFileFind: Returning NULL");
return (NULL);
}
}
@@ -377,7 +400,7 @@ cupsFileFind(const char *filename, /* I - File to find */
int /* O - 0 on success, -1 on error */
cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
{
size_t bytes; /* Bytes to write */
ssize_t bytes; /* Bytes to write */
DEBUG_printf(("cupsFileFlush(fp=%p)\n", fp));
@@ -392,7 +415,7 @@ cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
return (-1);
}
bytes = fp->ptr - fp->buf;
bytes = (ssize_t)(fp->ptr - fp->buf);
DEBUG_printf((" Flushing %ld bytes...\n", (long)bytes));
@@ -427,7 +450,10 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
*/
if (!fp || (fp->mode != 'r' && fp->mode != 's'))
{
DEBUG_puts("cupsFileGetChar: Bad arguments!");
return (-1);
}
/*
* If the input buffer is empty, try to read more data...
@@ -435,12 +461,17 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
if (fp->ptr >= fp->end)
if (cups_fill(fp) < 0)
{
DEBUG_puts("cupsFileGetChar: Unable to fill buffer!");
return (-1);
}
/*
* Return the next character in the buffer...
*/
DEBUG_printf(("cupsFileGetChar: Returning %d...\n", *(fp->ptr) & 255));
return (*(fp->ptr)++ & 255);
}
@@ -780,15 +811,15 @@ cupsFileOpen(const char *filename, /* I - Name of file */
switch (*mode)
{
case 'a' : /* Append file */
fd = open(filename, O_RDWR | O_CREAT | O_APPEND | O_LARGEFILE, 0666);
fd = open(filename, O_RDWR | O_CREAT | O_APPEND | O_LARGEFILE | O_BINARY, 0666);
break;
case 'r' : /* Read file */
fd = open(filename, O_RDONLY | O_LARGEFILE, 0);
fd = open(filename, O_RDONLY | O_LARGEFILE | O_BINARY, 0);
break;
case 'w' : /* Write file */
fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT | O_LARGEFILE, 0666);
fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT | O_LARGEFILE | O_BINARY, 0666);
break;
case 's' : /* Read/write socket */
@@ -991,7 +1022,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
...) /* I - Additional args as necessary */
{
va_list ap; /* Argument list */
size_t bytes; /* Formatted size */
ssize_t bytes; /* Formatted size */
char buf[8192]; /* Formatted text */
@@ -1090,7 +1121,7 @@ int /* O - Number of bytes written or -1 */
cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
const char *s) /* I - String to write */
{
size_t bytes; /* Bytes to write */
ssize_t bytes; /* Bytes to write */
/*
@@ -1104,7 +1135,7 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
* Write the string...
*/
bytes = strlen(s);
bytes = (int)strlen(s);
if (fp->mode == 's')
{
@@ -1149,8 +1180,8 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
char *buf, /* O - Buffer */
size_t bytes) /* I - Number of bytes to read */
{
size_t total, /* Total bytes read */
count; /* Bytes read */
size_t total; /* Total bytes read */
ssize_t count; /* Bytes read */
DEBUG_printf(("cupsFileRead(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
@@ -1179,14 +1210,14 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
DEBUG_printf((" cups_fill() returned -1, total=%d\n", total));
if (total > 0)
return (total);
return ((ssize_t)total);
else
return (-1);
}
count = fp->end - fp->ptr;
if (count > bytes)
count = bytes;
count = (ssize_t)(fp->end - fp->ptr);
if (count > (ssize_t)bytes)
count = (ssize_t)bytes;
memcpy(buf, fp->ptr, count);
fp->ptr += count;
@@ -1206,7 +1237,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
DEBUG_printf((" total=%d\n", total));
return (total);
return ((ssize_t)total);
}
@@ -1274,7 +1305,7 @@ off_t /* O - New file position or -1 */
cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
off_t pos) /* I - Position in file */
{
size_t bytes; /* Number bytes in buffer */
ssize_t bytes; /* Number bytes in buffer */
DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")\n", fp, pos));
@@ -1328,7 +1359,7 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
*/
if (fp->ptr)
bytes = fp->end - fp->buf;
bytes = (ssize_t)(fp->end - fp->buf);
else
bytes = 0;
@@ -1582,16 +1613,16 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
if (cups_write(fp, buf, bytes) < 0)
return (-1);
fp->pos += bytes;
fp->pos += (off_t)bytes;
return (bytes);
return ((ssize_t)bytes);
}
if ((fp->ptr + bytes) > fp->end)
if (cupsFileFlush(fp))
return (-1);
fp->pos += bytes;
fp->pos += (off_t)bytes;
if (bytes > sizeof(fp->buf))
{
@@ -1606,7 +1637,7 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
{
memcpy(fp->ptr, buf, bytes);
fp->ptr += bytes;
return (bytes);
return ((ssize_t)bytes);
}
}
@@ -1687,7 +1718,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
*/
if (fp->ptr && fp->end)
fp->pos += fp->end - fp->buf;
fp->pos += (off_t)(fp->end - fp->buf);
#ifdef HAVE_LIBZ
DEBUG_printf((" fp->compressed=%d\n", fp->compressed));
@@ -1995,10 +2026,17 @@ cups_read(cups_file_t *fp, /* I - CUPS file */
for (;;)
{
#ifdef WIN32
if (fp->mode == 's')
total = (ssize_t)recv(fp->fd, buf, (unsigned)bytes, 0);
else
total = (ssize_t)read(fp->fd, buf, (unsigned)bytes);
#else
if (fp->mode == 's')
total = recv(fp->fd, buf, bytes, 0);
else
total = read(fp->fd, buf, bytes);
#endif /* WIN32 */
if (total >= 0)
break;
@@ -2030,8 +2068,8 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
const char *buf, /* I - Buffer */
size_t bytes) /* I - Number bytes */
{
size_t total, /* Total bytes written */
count; /* Count this time */
size_t total; /* Total bytes written */
ssize_t count; /* Count this time */
DEBUG_printf(("cups_write(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
@@ -2044,10 +2082,17 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
total = 0;
while (bytes > 0)
{
#ifdef WIN32
if (fp->mode == 's')
count = (ssize_t)send(fp->fd, buf, (unsigned)bytes, 0);
else
count = (ssize_t)write(fp->fd, buf, (unsigned)bytes);
#else
if (fp->mode == 's')
count = send(fp->fd, buf, bytes, 0);
else
count = write(fp->fd, buf, bytes);
#endif /* WIN32 */
if (count < 0)
{
@@ -2076,7 +2121,7 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
* Return the total number of bytes written...
*/
return (total);
return ((ssize_t)total);
}
+4 -4
Ver Arquivo
@@ -8,7 +8,7 @@
* our own file functions allows us to provide transparent support of
* gzip'd print files, PPD files, etc.
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -36,11 +36,11 @@
*/
# include <sys/types.h>
# ifdef WIN32
# if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
# define __CUPS_SSIZE_T_DEFINED
/* Windows does not support the ssize_t type, so map it to off_t... */
typedef off_t ssize_t; /* @private@ */
# endif /* WIN32 */
# endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */
/*
-4
Ver Arquivo
@@ -98,11 +98,7 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
/* language.c */
cups_lang_t *lang_default; /* Default language */
# ifdef __APPLE__
# ifdef HAVE_CF_LOCALE_ID
char language[32]; /* Cached language */
# else
const char *language; /* Cached language */
# endif /* HAVE_CF_LOCALE_ID */
# endif /* __APPLE__ */
/* ppd.c */
+4 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP address list routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -62,7 +62,7 @@ httpAddrConnect(
* Create the socket...
*/
if ((*sock = socket(addrlist->addr.addr.sa_family, SOCK_STREAM, 0)) < 0)
if ((*sock = (int)socket(addrlist->addr.addr.sa_family, SOCK_STREAM, 0)) < 0)
{
/*
* Don't abort yet, as this could just be an issue with the local
@@ -248,7 +248,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
*/
strlcpy(ipv6, hostname + 4, sizeof(ipv6));
if ((ipv6len = strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
if ((ipv6len = (int)strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
{
ipv6[ipv6len] = '\0';
hostname = ipv6;
@@ -268,7 +268,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
*/
strlcpy(ipv6, hostname + 1, sizeof(ipv6));
if ((ipv6len = strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
if ((ipv6len = (int)strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
{
ipv6[ipv6len] = '\0';
hostname = ipv6;
+35 -34
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Private HTTP definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -70,7 +70,8 @@ typedef int socklen_t;
# if defined HAVE_LIBSSL
/*
* The OpenSSL library provides its own SSL/TLS context structure for its
* IO and protocol management...
* IO and protocol management. However, we need to provide our own BIO
* (basic IO) implementation to do timeouts...
*/
# include <openssl/err.h>
@@ -79,6 +80,8 @@ typedef int socklen_t;
typedef SSL http_tls_t;
extern BIO_METHOD *_httpBIOMethods(void);
# elif defined HAVE_GNUTLS
/*
* The GNU TLS library is more of a "bare metal" SSL/TLS library...
@@ -91,6 +94,11 @@ typedef struct
void *credentials; /* GNU TLS credentials object */
} http_tls_t;
extern ssize_t _httpReadGNUTLS(gnutls_transport_ptr ptr, void *data,
size_t length);
extern ssize_t _httpWriteGNUTLS(gnutls_transport_ptr ptr, const void *data,
size_t length);
# elif defined(HAVE_CDSASSL)
/*
* Darwin's Security framework provides its own SSL/TLS context structure
@@ -105,15 +113,6 @@ typedef struct /**** CDSA connection information ****/
CFArrayRef certsArray; /* Certificates array */
} http_tls_t;
typedef union _cdsa_conn_ref_u /**** CDSA Connection reference union
**** used to resolve 64-bit casting
**** warnings.
****/
{
SSLConnectionRef connection; /* SSL connection pointer */
int sock; /* Socket */
} cdsa_conn_ref_t;
extern OSStatus _httpReadCDSA(SSLConnectionRef connection, void *data,
size_t *dataLength);
extern OSStatus _httpWriteCDSA(SSLConnectionRef connection, const void *data,
@@ -139,21 +138,22 @@ extern const char *hstrerror(int error);
* Some OS's don't have getifaddrs() and freeifaddrs()...
*/
# include <net/if.h>
# ifdef HAVE_GETIFADDRS
# include <ifaddrs.h>
# else
# include <sys/ioctl.h>
# ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
# endif /* HAVE_SYS_SOCKIO_H */
# ifndef WIN32
# include <net/if.h>
# ifdef HAVE_GETIFADDRS
# include <ifaddrs.h>
# else
# include <sys/ioctl.h>
# ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
# endif /* HAVE_SYS_SOCKIO_H */
# ifdef ifa_dstaddr
# undef ifa_dstaddr
# endif /* ifa_dstaddr */
# ifndef ifr_netmask
# define ifr_netmask ifr_addr
# endif /* !ifr_netmask */
# ifdef ifa_dstaddr
# undef ifa_dstaddr
# endif /* ifa_dstaddr */
# ifndef ifr_netmask
# define ifr_netmask ifr_addr
# endif /* !ifr_netmask */
struct ifaddrs /**** Interface Structure ****/
{
@@ -171,18 +171,19 @@ struct ifaddrs /**** Interface Structure ****/
void *ifa_data; /* Interface statistics */
};
# ifndef ifa_broadaddr
# define ifa_broadaddr ifa_ifu.ifu_broadaddr
# endif /* !ifa_broadaddr */
# ifndef ifa_dstaddr
# define ifa_dstaddr ifa_ifu.ifu_dstaddr
# endif /* !ifa_dstaddr */
# ifndef ifa_broadaddr
# define ifa_broadaddr ifa_ifu.ifu_broadaddr
# endif /* !ifa_broadaddr */
# ifndef ifa_dstaddr
# define ifa_dstaddr ifa_ifu.ifu_dstaddr
# endif /* !ifa_dstaddr */
extern int _cups_getifaddrs(struct ifaddrs **addrs);
# define getifaddrs _cups_getifaddrs
# define getifaddrs _cups_getifaddrs
extern void _cups_freeifaddrs(struct ifaddrs *addrs);
# define freeifaddrs _cups_freeifaddrs
# endif /* HAVE_GETIFADDRS */
# define freeifaddrs _cups_freeifaddrs
# endif /* HAVE_GETIFADDRS */
# endif /* !WIN32 */
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
+16 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP support routines for the Common UNIX Printing System (CUPS) scheduler.
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -549,7 +549,7 @@ char * /* O - Encoded string */
httpEncode64(char *out, /* I - String to write to */
const char *in) /* I - String to read from */
{
return (httpEncode64_2(out, 512, in, strlen(in)));
return (httpEncode64_2(out, 512, in, (int)strlen(in)));
}
@@ -595,8 +595,14 @@ httpEncode64_2(char *out, /* I - String to write to */
if (outptr < outend)
*outptr ++ = base64[(in[0] & 255) >> 2];
if (outptr < outend)
*outptr ++ = base64[(((in[0] & 255) << 4) | ((in[1] & 255) >> 4)) & 63];
{
if (inlen > 1)
*outptr ++ = base64[(((in[0] & 255) << 4) | ((in[1] & 255) >> 4)) & 63];
else
*outptr ++ = base64[((in[0] & 255) << 4) & 63];
}
in ++;
inlen --;
@@ -610,7 +616,12 @@ httpEncode64_2(char *out, /* I - String to write to */
}
if (outptr < outend)
*outptr ++ = base64[(((in[0] & 255) << 2) | ((in[1] & 255) >> 6)) & 63];
{
if (inlen > 1)
*outptr ++ = base64[(((in[0] & 255) << 2) | ((in[1] & 255) >> 6)) & 63];
else
*outptr ++ = base64[((in[0] & 255) << 2) & 63];
}
in ++;
inlen --;
@@ -1101,7 +1112,7 @@ httpSeparateURI(
char *resptr = resource + strlen(resource);
uri = http_copy_decode(resptr, uri, resourcelen - (resptr - resource),
uri = http_copy_decode(resptr, uri, resourcelen - (int)(resptr - resource),
NULL, decoding & HTTP_URI_CODING_QUERY);
}
}
+343 -70
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -25,6 +25,7 @@
*
* Contents:
*
* _httpBIOMethods() - Get the OpenSSL BIO methods for HTTP connections.
* httpBlocking() - Set blocking/non-blocking behavior on a connection.
* httpCheck() - Check to see if there is a pending response from
* the server.
@@ -60,7 +61,8 @@
* httpPut() - Send a PUT request to the server.
* httpRead() - Read data from a HTTP connection.
* httpRead2() - Read data from a HTTP connection.
* _httpReadCDSA() - Read function for CDSA decryption code.
* _httpReadCDSA() - Read function for the CDSA library.
* _httpReadGNUTLS() - Read function for the GNU TLS library.
* httpReconnect() - Reconnect to a HTTP server...
* httpSetCookie() - Set the cookie value(s)...
* httpSetExpect() - Set the Expect: header in a request.
@@ -71,7 +73,14 @@
* httpWait() - Wait for data available on a connection.
* httpWrite() - Write data to a HTTP connection.
* httpWrite2() - Write data to a HTTP connection.
* _httpWriteCDSA() - Write function for CDSA encryption code.
* _httpWriteCDSA() - Write function for the CDSA library.
* _httpWriteGNUTLS() - Write function for the GNU TLS library.
* http_bio_ctrl() - Control the HTTP connection.
* http_bio_free() - Free OpenSSL data.
* http_bio_new() - Initialize an OpenSSL BIO structure.
* http_bio_puts() - Send a string for OpenSSL.
* http_bio_read() - Read data for OpenSSL.
* http_bio_write() - Write data for OpenSSL.
* http_field() - Return the field index for a field name.
* http_read_ssl() - Read from a SSL/TLS connection.
* http_send() - Send a request with all fields and the trailing
@@ -118,7 +127,7 @@
static http_field_t http_field(const char *name);
static int http_send(http_t *http, http_state_t request,
const char *uri);
static int http_wait(http_t *http, int msec);
static int http_wait(http_t *http, int msec, int usessl);
static int http_write(http_t *http, const char *buffer,
int length);
static int http_write_chunk(http_t *http, const char *buffer,
@@ -168,6 +177,45 @@ static const char * const http_fields[] =
};
#if defined(HAVE_SSL) && defined(HAVE_LIBSSL)
/*
* BIO methods for OpenSSL...
*/
static int http_bio_write(BIO *h, const char *buf, int num);
static int http_bio_read(BIO *h, char *buf, int size);
static int http_bio_puts(BIO *h, const char *str);
static long http_bio_ctrl(BIO *h, int cmd, long arg1, void *arg2);
static int http_bio_new(BIO *h);
static int http_bio_free(BIO *data);
static BIO_METHOD http_bio_methods =
{
BIO_TYPE_SOCKET,
"http",
http_bio_write,
http_bio_read,
http_bio_puts,
NULL, /* http_bio_gets, */
http_bio_ctrl,
http_bio_new,
http_bio_free,
NULL,
};
/*
* '_httpBIOMethods()' - Get the OpenSSL BIO methods for HTTP connections.
*/
BIO_METHOD * /* O - BIO methods for OpenSSL */
_httpBIOMethods(void)
{
return (&http_bio_methods);
}
#endif /* HAVE_SSL && HAVE_LIBSSL */
/*
* 'httpBlocking()' - Set blocking/non-blocking behavior on a connection.
*/
@@ -646,8 +694,18 @@ httpGetLength2(http_t *http) /* I - HTTP connection */
* after the transfer is complete...
*/
if (http->fields[HTTP_FIELD_CONTENT_LENGTH][0] == '\0')
http->data_remaining = 2147483647;
if (!http->fields[HTTP_FIELD_CONTENT_LENGTH][0])
{
/*
* Default content length is 0 for errors and 2^31-1 for other
* successful requests...
*/
if (http->status >= HTTP_MULTIPLE_CHOICES)
http->data_remaining = 0;
else
http->data_remaining = 2147483647;
}
else
http->data_remaining = strtoll(http->fields[HTTP_FIELD_CONTENT_LENGTH],
NULL, 10);
@@ -869,10 +927,14 @@ httpGets(char *line, /* I - Line to read into */
* No newline; see if there is more data to be read...
*/
if (!http->blocking && !http_wait(http, 10000))
if (!http->blocking && !http_wait(http, 10000, 1))
{
DEBUG_puts("httpGets: Timed out!");
#ifdef WIN32
http->error = WSAETIMEDOUT;
#else
http->error = ETIMEDOUT;
#endif /* WIN32 */
return (NULL);
}
@@ -948,7 +1010,7 @@ httpGets(char *line, /* I - Line to read into */
*lineptr++ = *bufptr++;
}
http->used -= bufptr - http->buffer;
http->used -= (int)(bufptr - http->buffer);
if (http->used > 0)
memmove(http->buffer, bufptr, http->used);
@@ -1221,8 +1283,8 @@ httpRead2(http_t *http, /* I - HTTP connection */
return (0);
}
else if (length > http->data_remaining)
length = http->data_remaining;
else if (length > (size_t)http->data_remaining)
length = (size_t)http->data_remaining;
if (http->used == 0 && length <= 256)
{
@@ -1277,15 +1339,15 @@ httpRead2(http_t *http, /* I - HTTP connection */
if (http->used > 0)
{
if (length > http->used)
length = http->used;
if (length > (size_t)http->used)
length = (size_t)http->used;
bytes = length;
bytes = (ssize_t)length;
DEBUG_printf(("httpRead2: grabbing %d bytes from input buffer...\n", bytes));
memcpy(buffer, http->buffer, length);
http->used -= length;
http->used -= (int)length;
if (http->used > 0)
memmove(http->buffer, http->buffer + length, http->used);
@@ -1296,7 +1358,7 @@ httpRead2(http_t *http, /* I - HTTP connection */
if (!http->blocking && !httpWait(http, 10000))
return (0);
bytes = http_read_ssl(http, buffer, length);
bytes = (ssize_t)http_read_ssl(http, buffer, (int)length);
}
#endif /* HAVE_SSL */
else
@@ -1306,9 +1368,13 @@ httpRead2(http_t *http, /* I - HTTP connection */
DEBUG_printf(("httpRead2: reading %d bytes from socket...\n", length));
#ifdef WIN32
bytes = (ssize_t)recv(http->fd, buffer, (int)length, 0);
#else
while ((bytes = recv(http->fd, buffer, length, 0)) < 0)
if (errno != EINTR)
break;
#endif /* WIN32 */
DEBUG_printf(("httpRead2: read %d bytes from socket...\n", bytes));
}
@@ -1391,7 +1457,7 @@ httpRead2(http_t *http, /* I - HTTP connection */
#if defined(HAVE_SSL) && defined(HAVE_CDSASSL)
/*
* '_httpReadCDSA()' - Read function for CDSA decryption code.
* '_httpReadCDSA()' - Read function for the CDSA library.
*/
OSStatus /* O - -1 on error, 0 on success */
@@ -1400,19 +1466,36 @@ _httpReadCDSA(
void *data, /* I - Data buffer */
size_t *dataLength) /* IO - Number of bytes */
{
OSStatus result; /* Return value */
ssize_t bytes; /* Number of bytes read */
cdsa_conn_ref_t u; /* Connection reference union */
OSStatus result; /* Return value */
ssize_t bytes; /* Number of bytes read */
http_t *http; /* HTTP connection */
u.connection = connection;
http = (http_t *)connection;
if (!http->blocking)
{
/*
* Make sure we have data before we read...
*/
if (!http_wait(http, 10000, 0))
{
http->error = ETIMEDOUT;
return (-1);
}
}
do
bytes = recv(u.sock, data, *dataLength, 0);
{
bytes = recv(http->fd, data, *dataLength, 0);
}
while (bytes == -1 && errno == EINTR);
if (bytes == *dataLength)
{
result = 0;
}
else if (bytes > 0)
{
*dataLength = bytes;
@@ -1430,11 +1513,45 @@ _httpReadCDSA(
result = errSSLClosedAbort;
}
return result;
return (result);
}
#endif /* HAVE_SSL && HAVE_CDSASSL */
#if defined(HAVE_SSL) && defined(HAVE_GNUTLS)
/*
* '_httpReadGNUTLS()' - Read function for the GNU TLS library.
*/
ssize_t /* O - Number of bytes read or -1 on error */
_httpReadGNUTLS(
gnutls_transport_ptr ptr, /* I - HTTP connection */
void *data, /* I - Buffer */
size_t length) /* I - Number of bytes to read */
{
http_t *http; /* HTTP connection */
http = (http_t *)ptr;
if (!http->blocking)
{
/*
* Make sure we have data before we read...
*/
if (!http_wait(http, 10000, 0))
{
http->error = ETIMEDOUT;
return (-1);
}
}
return (recv(http->fd, data, length, 0));
}
#endif /* HAVE_SSL && HAVE_GNUTLS */
/*
* 'httpReconnect()' - Reconnect to a HTTP server.
*/
@@ -1830,7 +1947,7 @@ httpWait(http_t *http, /* I - HTTP connection */
* If not, check the SSL/TLS buffers and do a select() on the connection...
*/
return (http_wait(http, msec));
return (http_wait(http, msec, 1));
}
@@ -1905,8 +2022,8 @@ httpWrite2(http_t *http, /* I - HTTP connection */
DEBUG_printf((" copying %d bytes to wbuffer...\n", length));
memcpy(http->wbuffer + http->wused, buffer, length);
http->wused += length;
bytes = length;
http->wused += (int)length;
bytes = (ssize_t)length;
}
else
{
@@ -1917,9 +2034,9 @@ httpWrite2(http_t *http, /* I - HTTP connection */
DEBUG_printf((" writing %d bytes to socket...\n", length));
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
bytes = http_write_chunk(http, buffer, length);
bytes = (ssize_t)http_write_chunk(http, buffer, (int)length);
else
bytes = http_write(http, buffer, length);
bytes = (ssize_t)http_write(http, buffer, (int)length);
DEBUG_printf((" wrote %d bytes...\n", bytes));
}
@@ -1977,7 +2094,7 @@ httpWrite2(http_t *http, /* I - HTTP connection */
#if defined(HAVE_SSL) && defined(HAVE_CDSASSL)
/*
* '_httpWriteCDSA()' - Write function for CDSA encryption code.
* '_httpWriteCDSA()' - Write function for the CDSA library.
*/
OSStatus /* O - -1 on error, 0 on success */
@@ -1986,19 +2103,23 @@ _httpWriteCDSA(
const void *data, /* I - Data buffer */
size_t *dataLength) /* IO - Number of bytes */
{
OSStatus result; /* Return value */
ssize_t bytes; /* Number of bytes read */
cdsa_conn_ref_t u; /* Connection reference union */
OSStatus result; /* Return value */
ssize_t bytes; /* Number of bytes read */
http_t *http; /* HTTP connection */
u.connection = connection;
http = (http_t *)connection;
do
bytes = write(u.sock, data, *dataLength);
{
bytes = write(http->fd, data, *dataLength);
}
while (bytes == -1 && errno == EINTR);
if (bytes == *dataLength)
{
result = 0;
}
else if (bytes >= 0)
{
*dataLength = bytes;
@@ -2014,11 +2135,173 @@ _httpWriteCDSA(
result = errSSLClosedAbort;
}
return result;
return (result);
}
#endif /* HAVE_SSL && HAVE_CDSASSL */
#if defined(HAVE_SSL) && defined(HAVE_GNUTLS)
/*
* '_httpWriteGNUTLS()' - Write function for the GNU TLS library.
*/
ssize_t /* O - Number of bytes written or -1 on error */
_httpWriteGNUTLS(
gnutls_transport_ptr ptr, /* I - HTTP connection */
const void *data, /* I - Data buffer */
size_t length) /* I - Number of bytes to write */
{
return (send(((http_t *)ptr)->fd, data, length, 0));
}
#endif /* HAVE_SSL && HAVE_GNUTLS */
#if defined(HAVE_SSL) && defined(HAVE_LIBSSL)
/*
* 'http_bio_ctrl()' - Control the HTTP connection.
*/
static long /* O - Result/data */
http_bio_ctrl(BIO *h, /* I - BIO data */
int cmd, /* I - Control command */
long arg1, /* I - First argument */
void *arg2) /* I - Second argument */
{
switch (cmd)
{
default :
return (0);
case BIO_CTRL_RESET :
h->ptr = NULL;
return (0);
case BIO_C_SET_FILE_PTR :
h->ptr = arg2;
h->init = 1;
return (1);
case BIO_C_GET_FILE_PTR :
if (arg2)
{
*((void **)arg2) = h->ptr;
return (1);
}
else
return (0);
case BIO_CTRL_DUP :
case BIO_CTRL_FLUSH :
return (1);
}
}
/*
* 'http_bio_free()' - Free OpenSSL data.
*/
static int /* O - 1 on success, 0 on failure */
http_bio_free(BIO *h) /* I - BIO data */
{
if (!h)
return (0);
if (h->shutdown)
{
h->init = 0;
h->flags = 0;
}
return (1);
}
/*
* 'http_bio_new()' - Initialize an OpenSSL BIO structure.
*/
static int /* O - 1 on success, 0 on failure */
http_bio_new(BIO *h) /* I - BIO data */
{
if (!h)
return (0);
h->init = 0;
h->num = 0;
h->ptr = NULL;
h->flags = 0;
return (1);
}
/*
* 'http_bio_puts()' - Send a string for OpenSSL.
*/
static int /* O - Bytes written */
http_bio_puts(BIO *h, /* I - BIO data */
const char *str) /* I - String to write */
{
#ifdef WIN32
return (send(((http_t *)h->ptr)->fd, str, (int)strlen(str), 0));
#else
return (send(((http_t *)h->ptr)->fd, str, strlen(str), 0));
#endif /* WIN32 */
}
/*
* 'http_bio_read()' - Read data for OpenSSL.
*/
static int /* O - Bytes read */
http_bio_read(BIO *h, /* I - BIO data */
char *buf, /* I - Buffer */
int size) /* I - Number of bytes to read */
{
http_t *http; /* HTTP connection */
http = (http_t *)h->ptr;
if (!http->blocking)
{
/*
* Make sure we have data before we read...
*/
if (!http_wait(http, 10000, 0))
{
#ifdef WIN32
http->error = WSAETIMEDOUT;
#else
http->error = ETIMEDOUT;
#endif /* WIN32 */
return (-1);
}
}
return (recv(http->fd, buf, size, 0));
}
/*
* 'http_bio_write()' - Write data for OpenSSL.
*/
static int /* O - Bytes written */
http_bio_write(BIO *h, /* I - BIO data */
const char *buf, /* I - Buffer to write */
int num) /* I - Number of bytes to write */
{
return (send(((http_t *)h->ptr)->fd, buf, num, 0));
}
#endif /* HAVE_SSL && HAVE_LIBSSL */
/*
* 'http_field()' - Return the field index for a field name.
*/
@@ -2247,6 +2530,7 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
# ifdef HAVE_LIBSSL
SSL_CTX *context; /* Context for encryption */
SSL *conn; /* Connection for encryption */
BIO *bio; /* BIO data */
# elif defined(HAVE_GNUTLS)
http_tls_t *conn; /* TLS session object */
gnutls_certificate_client_credentials *credentials;
@@ -2254,7 +2538,6 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
# elif defined(HAVE_CDSASSL)
OSStatus error; /* Error code */
http_tls_t *conn; /* CDSA connection information */
cdsa_conn_ref_t u; /* Connection reference union */
# endif /* HAVE_LIBSSL */
@@ -2265,9 +2548,12 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
SSL_CTX_set_options(context, SSL_OP_NO_SSLv2); /* Only use SSLv3 or TLS */
conn = SSL_new(context);
bio = BIO_new(_httpBIOMethods());
BIO_ctrl(bio, BIO_C_SET_FILE_PTR, 0, (char *)http);
conn = SSL_new(context);
SSL_set_bio(conn, bio, bio);
SSL_set_fd(conn, http->fd);
if (SSL_connect(conn) != 1)
{
# ifdef DEBUG
@@ -2316,8 +2602,9 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
gnutls_init(&(conn->session), GNUTLS_CLIENT);
gnutls_set_default_priority(conn->session);
gnutls_credentials_set(conn->session, GNUTLS_CRD_CERTIFICATE, *credentials);
gnutls_transport_set_ptr(conn->session,
(gnutls_transport_ptr)((long)http->fd));
gnutls_transport_set_ptr(conn->session, (gnutls_transport_ptr)http);
gnutls_transport_set_pull_function(conn->session, _httpReadGNUTLS);
gnutls_transport_set_push_function(conn->session, _httpWriteGNUTLS);
if ((gnutls_handshake(conn->session)) != GNUTLS_E_SUCCESS)
{
@@ -2348,9 +2635,7 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
* Use a union to resolve warnings about int/pointer size mismatches...
*/
u.connection = NULL;
u.sock = http->fd;
error = SSLSetConnection(conn->session, u.connection);
error = SSLSetConnection(conn->session, http);
if (!error)
error = SSLSetIOFuncs(conn->session, _httpReadCDSA, _httpWriteCDSA);
@@ -2472,43 +2757,30 @@ http_upgrade(http_t *http) /* I - HTTP connection */
* encryption on the link...
*/
httpClearFields(&myhttp);
httpSetField(&myhttp, HTTP_FIELD_CONNECTION, "upgrade");
httpSetField(&myhttp, HTTP_FIELD_UPGRADE, "TLS/1.0, SSL/2.0, SSL/3.0");
httpClearFields(http);
httpSetField(http, HTTP_FIELD_CONNECTION, "upgrade");
httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.0, SSL/2.0, SSL/3.0");
if ((ret = httpOptions(&myhttp, "*")) == 0)
if ((ret = httpOptions(http, "*")) == 0)
{
/*
* Wait for the secure connection...
*/
while (httpUpdate(&myhttp) == HTTP_CONTINUE);
while (httpUpdate(http) == HTTP_CONTINUE);
}
httpFlush(&myhttp);
httpFlush(http);
/*
* Copy the HTTP data back over, if any...
* Restore the HTTP request data...
*/
http->fd = myhttp.fd;
http->error = myhttp.error;
http->activity = myhttp.activity;
http->status = myhttp.status;
http->version = myhttp.version;
http->keep_alive = myhttp.keep_alive;
http->used = myhttp.used;
if (http->used)
memcpy(http->buffer, myhttp.buffer, http->used);
http->auth_type = myhttp.auth_type;
http->nonce_count = myhttp.nonce_count;
memcpy(http->nonce, myhttp.nonce, sizeof(http->nonce));
http->tls = myhttp.tls;
http->encryption = myhttp.encryption;
memcpy(http->fields, myhttp.fields, sizeof(http->fields));
http->data_encoding = myhttp.data_encoding;
http->data_remaining = myhttp.data_remaining;
http->_data_remaining = myhttp._data_remaining;
http->expect = myhttp.expect;
/*
* See if we actually went secure...
@@ -2544,7 +2816,8 @@ http_upgrade(http_t *http) /* I - HTTP connection */
static int /* O - 1 if data is available, 0 otherwise */
http_wait(http_t *http, /* I - HTTP connection */
int msec) /* I - Milliseconds to wait */
int msec, /* I - Milliseconds to wait */
int usessl) /* I - Use SSL context? */
{
#ifndef WIN32
struct rlimit limit; /* Runtime limit */
@@ -2564,7 +2837,7 @@ http_wait(http_t *http, /* I - HTTP connection */
*/
#ifdef HAVE_SSL
if (http->tls)
if (http->tls && usessl)
{
# ifdef HAVE_LIBSSL
if (SSL_pending((SSL *)(http->tls)))
@@ -2754,7 +3027,7 @@ http_write_chunk(http_t *http, /* I - HTTP connection */
*/
sprintf(header, "%x\r\n", length);
if (http_write(http, header, strlen(header)) < 0)
if (http_write(http, header, (int)strlen(header)) < 0)
{
DEBUG_puts(" http_write of length failed!");
return (-1);
+6 -1
Ver Arquivo
@@ -4,7 +4,7 @@
* Hyper-Text Transport Protocol definitions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -36,6 +36,11 @@
# include <time.h>
# include <sys/types.h>
# ifdef WIN32
# ifndef __CUPS_SSIZE_T_DEFINED
# define __CUPS_SSIZE_T_DEFINED
/* Windows does not support the ssize_t type, so map it to off_t... */
typedef off_t ssize_t; /* @private@ */
# endif /* !__CUPS_SSIZE_T_DEFINED */
# include <winsock2.h>
# include <ws2tcpip.h>
# else
+24 -13
Ver Arquivo
@@ -4,7 +4,7 @@
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -1054,7 +1054,7 @@ ippReadIO(void *src, /* I - Data source */
if ((n = (*cb)(src, buffer, 8)) < 8)
{
DEBUG_printf(("ippReadIO: Unable to read header (%d bytes read)!\n", n));
return (n == 0 ? IPP_IDLE : IPP_ERROR);
return (IPP_ERROR);
}
/*
@@ -1098,8 +1098,11 @@ ippReadIO(void *src, /* I - Data source */
break;
case IPP_ATTRIBUTE :
while ((*cb)(src, buffer, 1) > 0)
for (;;)
{
if ((*cb)(src, buffer, 1) < 1)
return (IPP_ERROR);
DEBUG_printf(("ippReadIO: ipp->current=%p, ipp->prev=%p\n",
ipp->current, ipp->prev));
@@ -2156,10 +2159,10 @@ ippWriteIO(void *dst, /* I - Destination */
n = 4;
if (value->string.charset != NULL)
n += strlen(value->string.charset);
n += (int)strlen(value->string.charset);
if (value->string.text != NULL)
n += strlen(value->string.text);
n += (int)strlen(value->string.text);
if (n > (sizeof(buffer) - 2))
return (IPP_ERROR);
@@ -2562,7 +2565,7 @@ ipp_length(ipp_t *ipp, /* I - IPP message or collection */
DEBUG_printf(("attr->name = %s, attr->num_values = %d, bytes = %d\n",
attr->name, attr->num_values, bytes));
bytes += strlen(attr->name); /* Name */
bytes += (int)strlen(attr->name); /* Name */
bytes += attr->num_values; /* Value tag for each value */
bytes += 2 * attr->num_values; /* Name lengths */
bytes += 2 * attr->num_values; /* Value lengths */
@@ -2594,7 +2597,7 @@ ipp_length(ipp_t *ipp, /* I - IPP message or collection */
i < attr->num_values;
i ++, value ++)
if (value->string.text != NULL)
bytes += strlen(value->string.text);
bytes += (int)strlen(value->string.text);
break;
case IPP_TAG_DATE :
@@ -2618,10 +2621,10 @@ ipp_length(ipp_t *ipp, /* I - IPP message or collection */
i ++, value ++)
{
if (value->string.charset != NULL)
bytes += strlen(value->string.charset);
bytes += (int)strlen(value->string.charset);
if (value->string.text != NULL)
bytes += strlen(value->string.text);
bytes += (int)strlen(value->string.text);
}
break;
@@ -2629,7 +2632,7 @@ ipp_length(ipp_t *ipp, /* I - IPP message or collection */
for (i = 0, value = attr->values;
i < attr->num_values;
i ++, value ++)
bytes += ipp_length(value->collection, 1);
bytes += (int)ipp_length(value->collection, 1);
break;
default :
@@ -2678,7 +2681,7 @@ ipp_read_http(http_t *http, /* I - Client connection */
* Loop until all bytes are read...
*/
for (tbytes = 0, bytes = 0; tbytes < length; tbytes += bytes, buffer += bytes)
for (tbytes = 0, bytes = 0; tbytes < (int)length; tbytes += bytes, buffer += bytes)
{
DEBUG_printf(("tbytes = %d, http->state = %d\n", tbytes, http->state));
@@ -2691,8 +2694,8 @@ ipp_read_http(http_t *http, /* I - Client connection */
* Do "fast read" from HTTP buffer directly...
*/
if (http->used > (length - tbytes))
bytes = length - tbytes;
if (http->used > (int)(length - tbytes))
bytes = (int)(length - tbytes);
else
bytes = http->used;
@@ -2783,7 +2786,11 @@ ipp_read_file(int *fd, /* I - File descriptor */
ipp_uchar_t *buffer, /* O - Read buffer */
size_t length) /* I - Number of bytes to read */
{
#ifdef WIN32
return ((ssize_t)read(*fd, buffer, (unsigned)length));
#else
return (read(*fd, buffer, length));
#endif /* WIN32 */
}
@@ -2796,7 +2803,11 @@ ipp_write_file(int *fd, /* I - File descriptor */
ipp_uchar_t *buffer, /* I - Data to write */
size_t length) /* I - Number of bytes to write */
{
#ifdef WIN32
return ((ssize_t)write(*fd, buffer, (unsigned)length));
#else
return (write(*fd, buffer, length));
#endif /* WIN32 */
}
+3 -3
Ver Arquivo
@@ -4,7 +4,7 @@
* Localized printf/puts functions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 2002-2006 by Easy Software Products.
* Copyright 2002-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -88,7 +88,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
*/
if (bytes > 0)
return (fwrite(output, 1, bytes, fp));
return ((int)fwrite(output, 1, bytes, fp));
else
return (bytes);
}
@@ -133,7 +133,7 @@ _cupsLangPuts(FILE *fp, /* I - File to write to */
*/
if (bytes > 0)
return (fwrite(output, 1, bytes, fp));
return ((int)fwrite(output, 1, bytes, fp));
else
return (bytes);
}
+68 -55
Ver Arquivo
@@ -3,7 +3,7 @@
*
* I18N/language support for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -887,7 +887,7 @@ _cupsMessageLoad(const char *filename) /* I - Message catalog to load */
* Append to current string...
*/
length = strlen(m->str ? m->str : m->id);
length = (int)strlen(m->str ? m->str : m->id);
if ((temp = realloc(m->str ? m->str : m->id,
length + strlen(ptr) + 1)) == NULL)
@@ -995,6 +995,7 @@ appleLangDefault(void)
/* List of localization data */
CFStringRef languageName; /* Current name */
CFStringRef localeName; /* Canonical from of name */
char *lang; /* LANG environment variable */
_cups_globals_t *cg = _cupsGlobals();
/* Pointer to library globals */
@@ -1005,38 +1006,43 @@ appleLangDefault(void)
if (!cg->language[0])
{
localizationList =
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
kCFPreferencesCurrentApplication);
if (localizationList != NULL)
if ((lang = getenv("LANG")))
strlcpy(cg->language, lang, sizeof(cg->language));
else
{
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
CFArrayGetCount(localizationList) > 0)
localizationList =
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
kCFPreferencesCurrentApplication);
if (localizationList != NULL)
{
languageName = CFArrayGetValueAtIndex(localizationList, 0);
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
CFArrayGetCount(localizationList) > 0)
{
languageName = CFArrayGetValueAtIndex(localizationList, 0);
if (languageName != NULL &&
CFGetTypeID(languageName) == CFStringGetTypeID())
{
localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString(
kCFAllocatorDefault, languageName);
if (languageName != NULL &&
CFGetTypeID(languageName) == CFStringGetTypeID())
{
localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString(
kCFAllocatorDefault, languageName);
if (localeName != NULL)
{
CFStringGetCString(localeName, cg->language, sizeof(cg->language),
kCFStringEncodingASCII);
CFRelease(localeName);
if (localeName != NULL)
{
CFStringGetCString(localeName, cg->language, sizeof(cg->language),
kCFStringEncodingASCII);
CFRelease(localeName);
if (!strcmp(cg->language, "en"))
strlcpy(cg->language, "en_US.UTF-8", sizeof(cg->language));
else if (strchr(cg->language, '.') == NULL)
strlcat(cg->language, ".UTF-8", sizeof(cg->language));
}
}
if (!strcmp(cg->language, "en"))
strlcpy(cg->language, "en_US.UTF-8", sizeof(cg->language));
else if (strchr(cg->language, '.') == NULL)
strlcat(cg->language, ".UTF-8", sizeof(cg->language));
}
}
}
CFRelease(localizationList);
}
CFRelease(localizationList);
}
/*
@@ -1144,59 +1150,66 @@ appleLangDefault(void)
char buff[256]; /* Temporary buffer */
_cups_globals_t *cg = _cupsGlobals();
/* Pointer to library globals */
char *lang; /* LANG environment variable */
/*
* Only do the lookup and translation the first time.
*/
if (cg->language == NULL)
if (!cg->language[0])
{
localizationList =
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
kCFPreferencesCurrentApplication);
if (localizationList != NULL)
if ((lang = getenv("LANG")))
strlcpy(cg->language, lang, sizeof(cg->language));
else
{
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
CFArrayGetCount(localizationList) > 0)
localizationList =
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
kCFPreferencesCurrentApplication);
if (localizationList != NULL)
{
localizationName = CFArrayGetValueAtIndex(localizationList, 0);
if (localizationName != NULL &&
CFGetTypeID(localizationName) == CFStringGetTypeID())
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
CFArrayGetCount(localizationList) > 0)
{
CFIndex length = CFStringGetLength(localizationName);
localizationName = CFArrayGetValueAtIndex(localizationList, 0);
if (length <= sizeof(buff) &&
CFStringGetCString(localizationName, buff, sizeof(buff),
kCFStringEncodingASCII))
if (localizationName != NULL &&
CFGetTypeID(localizationName) == CFStringGetTypeID())
{
buff[sizeof(buff) - 1] = '\0';
CFIndex length = CFStringGetLength(localizationName);
for (i = 0;
i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]);
i++)
if (length <= sizeof(buff) &&
CFStringGetCString(localizationName, buff, sizeof(buff),
kCFStringEncodingASCII))
{
if (!strcasecmp(buff, apple_name_locale[i].name))
buff[sizeof(buff) - 1] = '\0';
for (i = 0;
i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]);
i++)
{
cg->language = apple_name_locale[i].locale;
break;
if (!strcasecmp(buff, apple_name_locale[i].name))
{
strlcpy(cg->language, apple_name_locale[i].locale,
sizeof(cg->language));
break;
}
}
}
}
}
}
CFRelease(localizationList);
CFRelease(localizationList);
}
}
/*
* If we didn't find the language, default to en_US...
*/
if (cg->language == NULL)
cg->language = apple_name_locale[0].locale;
if (!cg->language[0])
strlcpy(cg->language, apple_name_locale[0].locale, sizeof(cg->language));
}
/*
+1
Ver Arquivo
@@ -28,6 +28,7 @@ _cups_freeifaddrs
_cups_strcpy
_cups_strlcat
_cups_strlcpy
_httpBIOMethods
_ippAddAttr
_ippFreeAttr
_ppdGetEncoding
+38 -45
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option marking routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -62,15 +62,14 @@ static void ppd_defaults(ppd_file_t *ppd, ppd_group_t *g);
int /* O - Number of conflicts found */
ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
{
int i, j, k, /* Looping variables */
int i, j, /* Looping variables */
conflicts; /* Number of conflicts */
ppd_const_t *c; /* Current constraint */
ppd_group_t *g, *sg; /* Groups */
ppd_option_t *o1, *o2; /* Options */
ppd_choice_t *c1, *c2; /* Choices */
if (ppd == NULL)
if (!ppd)
return (0);
/*
@@ -79,15 +78,8 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
conflicts = 0;
for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
{
for (j = g->num_options, o1 = g->options; j > 0; j --, o1 ++)
o1->conflicted = 0;
for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++)
for (k = sg->num_options, o1 = sg->options; k > 0; k --, o1 ++)
o1->conflicted = 0;
}
for (o1 = ppdFirstOption(ppd); o1; o1 = ppdNextOption(ppd))
o1->conflicted = 0;
/*
* Loop through all of the UI constraints and flag any options
@@ -102,9 +94,9 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
o1 = ppdFindOption(ppd, c->option1);
if (o1 == NULL)
if (!o1)
continue;
else if (c->choice1[0] != '\0')
else if (c->choice1[0])
{
/*
* This constraint maps to a specific choice.
@@ -122,10 +114,10 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
if (c1->marked)
break;
if (j == 0 ||
strcasecmp(c1->choice, "None") == 0 ||
strcasecmp(c1->choice, "Off") == 0 ||
strcasecmp(c1->choice, "False") == 0)
if (!j ||
!strcasecmp(c1->choice, "None") ||
!strcasecmp(c1->choice, "Off") ||
!strcasecmp(c1->choice, "False"))
c1 = NULL;
}
@@ -135,9 +127,9 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
o2 = ppdFindOption(ppd, c->option2);
if (o2 == NULL)
if (!o2)
continue;
else if (c->choice2[0] != '\0')
else if (c->choice2[0])
{
/*
* This constraint maps to a specific choice.
@@ -155,10 +147,10 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
if (c2->marked)
break;
if (j == 0 ||
strcasecmp(c2->choice, "None") == 0 ||
strcasecmp(c2->choice, "Off") == 0 ||
strcasecmp(c2->choice, "False") == 0)
if (!j ||
!strcasecmp(c2->choice, "None") ||
!strcasecmp(c2->choice, "Off") ||
!strcasecmp(c2->choice, "False"))
c2 = NULL;
}
@@ -166,8 +158,7 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
* If both options are marked then there is a conflict...
*/
if (c1 != NULL && c1->marked &&
c2 != NULL && c2->marked)
if (c1 && c1->marked && c2 && c2->marked)
{
DEBUG_printf(("%s->%s conflicts with %s->%s (%s %s %s %s)\n",
o1->keyword, c1->choice, o2->keyword, c2->choice,
@@ -418,26 +409,27 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_CURVE :
case PPD_CUSTOM_INVCURVE :
case PPD_CUSTOM_REAL :
cparam->current.custom_real = _cupsStrScand(choice + 7, NULL,
loc);
cparam->current.custom_real = (float)_cupsStrScand(choice + 7,
NULL, loc);
break;
case PPD_CUSTOM_POINTS :
cparam->current.custom_points = _cupsStrScand(choice + 7,
&units, loc);
cparam->current.custom_points = (float)_cupsStrScand(choice + 7,
&units,
loc);
if (units)
{
if (!strcasecmp(units, "cm"))
cparam->current.custom_points *= 72.0 / 2.54;
cparam->current.custom_points *= 72.0f / 2.54f;
else if (!strcasecmp(units, "mm"))
cparam->current.custom_points *= 72.0 / 25.4;
cparam->current.custom_points *= 72.0f / 25.4f;
else if (!strcasecmp(units, "m"))
cparam->current.custom_points *= 72.0 / 0.0254;
cparam->current.custom_points *= 72.0f / 0.0254f;
else if (!strcasecmp(units, "in"))
cparam->current.custom_points *= 72.0;
cparam->current.custom_points *= 72.0f;
else if (!strcasecmp(units, "ft"))
cparam->current.custom_points *= 12 * 72.0;
cparam->current.custom_points *= 12.0f * 72.0f;
}
break;
@@ -494,26 +486,27 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_CURVE :
case PPD_CUSTOM_INVCURVE :
case PPD_CUSTOM_REAL :
cparam->current.custom_real = _cupsStrScand(val->value, NULL,
loc);
cparam->current.custom_real = (float)_cupsStrScand(val->value,
NULL, loc);
break;
case PPD_CUSTOM_POINTS :
cparam->current.custom_points = _cupsStrScand(val->value, &units,
loc);
cparam->current.custom_points = (float)_cupsStrScand(val->value,
&units,
loc);
if (units)
{
if (!strcasecmp(units, "cm"))
cparam->current.custom_points *= 72.0 / 2.54;
cparam->current.custom_points *= 72.0f / 2.54f;
else if (!strcasecmp(units, "mm"))
cparam->current.custom_points *= 72.0 / 25.4;
cparam->current.custom_points *= 72.0f / 25.4f;
else if (!strcasecmp(units, "m"))
cparam->current.custom_points *= 72.0 / 0.0254;
cparam->current.custom_points *= 72.0f / 0.0254f;
else if (!strcasecmp(units, "in"))
cparam->current.custom_points *= 72.0;
cparam->current.custom_points *= 72.0f;
else if (!strcasecmp(units, "ft"))
cparam->current.custom_points *= 12 * 72.0;
cparam->current.custom_points *= 12.0f * 72.0f;
}
break;
+55 -39
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Page size functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -50,9 +50,12 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
const char *name) /* I - Size name */
{
int i; /* Looping var */
ppd_size_t *size; /* Current page size */
float w, l; /* Width and length of page */
char *nameptr; /* Pointer into name */
struct lconv *loc; /* Locale data */
ppd_coption_t *coption; /* Custom option for page size */
ppd_cparam_t *cparam; /* Custom option parameter */
if (!ppd)
@@ -66,11 +69,11 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
* Find the custom page size...
*/
for (i = 0; i < ppd->num_sizes; i ++)
if (!strcmp("Custom", ppd->sizes[i].name))
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
if (!strcmp("Custom", size->name))
break;
if (i == ppd->num_sizes)
if (!i)
return (NULL);
/*
@@ -83,52 +86,65 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
*/
loc = localeconv();
w = _cupsStrScand(name + 7, &nameptr, loc);
w = (float)_cupsStrScand(name + 7, &nameptr, loc);
if (!nameptr || *nameptr != 'x')
return (NULL);
l = _cupsStrScand(nameptr + 1, &nameptr, loc);
l = (float)_cupsStrScand(nameptr + 1, &nameptr, loc);
if (!nameptr)
return (NULL);
if (!strcasecmp(nameptr, "in"))
{
ppd->sizes[i].width = w * 72.0f;
ppd->sizes[i].length = l * 72.0f;
ppd->sizes[i].left = ppd->custom_margins[0];
ppd->sizes[i].bottom = ppd->custom_margins[1];
ppd->sizes[i].right = w * 72.0f - ppd->custom_margins[2];
ppd->sizes[i].top = l * 72.0f - ppd->custom_margins[3];
w *= 72.0f;
l *= 72.0f;
}
else if (!strcasecmp(nameptr, "cm"))
else if (!strcasecmp(nameptr, "ft"))
{
ppd->sizes[i].width = w / 2.54f * 72.0f;
ppd->sizes[i].length = l / 2.54f * 72.0f;
ppd->sizes[i].left = ppd->custom_margins[0];
ppd->sizes[i].bottom = ppd->custom_margins[1];
ppd->sizes[i].right = w / 2.54f * 72.0f - ppd->custom_margins[2];
ppd->sizes[i].top = l / 2.54f * 72.0f - ppd->custom_margins[3];
w *= 12.0f * 72.0f;
l *= 12.0f * 72.0f;
}
else if (!strcasecmp(nameptr, "mm"))
{
ppd->sizes[i].width = w / 25.4f * 72.0f;
ppd->sizes[i].length = l / 25.4f * 72.0f;
ppd->sizes[i].left = ppd->custom_margins[0];
ppd->sizes[i].bottom = ppd->custom_margins[1];
ppd->sizes[i].right = w / 25.4f * 72.0f - ppd->custom_margins[2];
ppd->sizes[i].top = l / 25.4f * 72.0f - ppd->custom_margins[3];
w *= 72.0f / 25.4f;
l *= 72.0f / 25.4f;
}
else
else if (!strcasecmp(nameptr, "cm"))
{
ppd->sizes[i].width = w;
ppd->sizes[i].length = l;
ppd->sizes[i].left = ppd->custom_margins[0];
ppd->sizes[i].bottom = ppd->custom_margins[1];
ppd->sizes[i].right = w - ppd->custom_margins[2];
ppd->sizes[i].top = l - ppd->custom_margins[3];
w *= 72.0f / 2.54f;
l *= 72.0f / 2.54f;
}
else if (!strcasecmp(nameptr, "m"))
{
w *= 72.0f / 0.0254f;
l *= 72.0f / 0.0254f;
}
return (ppd->sizes + i);
size->width = w;
size->length = l;
size->left = ppd->custom_margins[0];
size->bottom = ppd->custom_margins[1];
size->right = w - ppd->custom_margins[2];
size->top = l - ppd->custom_margins[3];
/*
* Update the custom option records for the page size, too...
*/
if ((coption = ppdFindCustomOption(ppd, "PageSize")) != NULL)
{
if ((cparam = ppdFindCustomParam(coption, "Width")) != NULL)
cparam->current.custom_points = w;
if ((cparam = ppdFindCustomParam(coption, "Height")) != NULL)
cparam->current.custom_points = l;
}
/*
* Return the page size...
*/
return (size);
}
else
{
@@ -136,9 +152,9 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
* Lookup by name...
*/
for (i = 0; i < ppd->num_sizes; i ++)
if (!strcasecmp(name, ppd->sizes[i].name))
return (ppd->sizes + i);
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
if (!strcmp(name, size->name))
return (size);
}
}
else
@@ -147,9 +163,9 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
* Find default...
*/
for (i = 0; i < ppd->num_sizes; i ++)
if (ppd->sizes[i].marked)
return (ppd->sizes + i);
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
if (size->marked)
return (size);
}
return (NULL);
+141 -31
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD file routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
* Copyright 1997-2007 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
@@ -819,17 +819,17 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
strlcpy(profile->resolution, name, sizeof(profile->resolution));
strlcpy(profile->media_type, text, sizeof(profile->media_type));
profile->density = _cupsStrScand(string, &sptr, loc);
profile->gamma = _cupsStrScand(sptr, &sptr, loc);
profile->matrix[0][0] = _cupsStrScand(sptr, &sptr, loc);
profile->matrix[0][1] = _cupsStrScand(sptr, &sptr, loc);
profile->matrix[0][2] = _cupsStrScand(sptr, &sptr, loc);
profile->matrix[1][0] = _cupsStrScand(sptr, &sptr, loc);
profile->matrix[1][1] = _cupsStrScand(sptr, &sptr, loc);
profile->matrix[1][2] = _cupsStrScand(sptr, &sptr, loc);
profile->matrix[2][0] = _cupsStrScand(sptr, &sptr, loc);
profile->matrix[2][1] = _cupsStrScand(sptr, &sptr, loc);
profile->matrix[2][2] = _cupsStrScand(sptr, &sptr, loc);
profile->density = (float)_cupsStrScand(string, &sptr, loc);
profile->gamma = (float)_cupsStrScand(sptr, &sptr, loc);
profile->matrix[0][0] = (float)_cupsStrScand(sptr, &sptr, loc);
profile->matrix[0][1] = (float)_cupsStrScand(sptr, &sptr, loc);
profile->matrix[0][2] = (float)_cupsStrScand(sptr, &sptr, loc);
profile->matrix[1][0] = (float)_cupsStrScand(sptr, &sptr, loc);
profile->matrix[1][1] = (float)_cupsStrScand(sptr, &sptr, loc);
profile->matrix[1][2] = (float)_cupsStrScand(sptr, &sptr, loc);
profile->matrix[2][0] = (float)_cupsStrScand(sptr, &sptr, loc);
profile->matrix[2][1] = (float)_cupsStrScand(sptr, &sptr, loc);
profile->matrix[2][2] = (float)_cupsStrScand(sptr, &sptr, loc);
}
else if (!strcmp(keyword, "cupsFilter"))
{
@@ -928,8 +928,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
if (!strcmp(ctype, "curve"))
{
cparam->type = PPD_CUSTOM_CURVE;
cparam->minimum.custom_curve = _cupsStrScand(cminimum, NULL, loc);
cparam->maximum.custom_curve = _cupsStrScand(cmaximum, NULL, loc);
cparam->minimum.custom_curve = (float)_cupsStrScand(cminimum, NULL, loc);
cparam->maximum.custom_curve = (float)_cupsStrScand(cmaximum, NULL, loc);
}
else if (!strcmp(ctype, "int"))
{
@@ -940,8 +940,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
else if (!strcmp(ctype, "invcurve"))
{
cparam->type = PPD_CUSTOM_INVCURVE;
cparam->minimum.custom_invcurve = _cupsStrScand(cminimum, NULL, loc);
cparam->maximum.custom_invcurve = _cupsStrScand(cmaximum, NULL, loc);
cparam->minimum.custom_invcurve = (float)_cupsStrScand(cminimum, NULL, loc);
cparam->maximum.custom_invcurve = (float)_cupsStrScand(cmaximum, NULL, loc);
}
else if (!strcmp(ctype, "passcode"))
{
@@ -958,14 +958,14 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
else if (!strcmp(ctype, "points"))
{
cparam->type = PPD_CUSTOM_POINTS;
cparam->minimum.custom_points = _cupsStrScand(cminimum, NULL, loc);
cparam->maximum.custom_points = _cupsStrScand(cmaximum, NULL, loc);
cparam->minimum.custom_points = (float)_cupsStrScand(cminimum, NULL, loc);
cparam->maximum.custom_points = (float)_cupsStrScand(cmaximum, NULL, loc);
}
else if (!strcmp(ctype, "real"))
{
cparam->type = PPD_CUSTOM_REAL;
cparam->minimum.custom_real = _cupsStrScand(cminimum, NULL, loc);
cparam->maximum.custom_real = _cupsStrScand(cmaximum, NULL, loc);
cparam->minimum.custom_real = (float)_cupsStrScand(cminimum, NULL, loc);
cparam->maximum.custom_real = (float)_cupsStrScand(cmaximum, NULL, loc);
}
else if (!strcmp(ctype, "string"))
{
@@ -1001,7 +1001,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
else if (!strcmp(keyword, "HWMargins"))
{
for (i = 0, sptr = string; i < 4; i ++)
ppd->custom_margins[i] = _cupsStrScand(sptr, &sptr, loc);
ppd->custom_margins[i] = (float)_cupsStrScand(sptr, &sptr, loc);
}
else if (!strncmp(keyword, "Custom", 6) && !strcmp(name, "True"))
{
@@ -1400,7 +1400,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
else if (!strcmp(keyword, "OrderDependency") ||
!strcmp(keyword, "NonUIOrderDependency"))
{
order = _cupsStrScand(string, &sptr, loc);
order = (float)_cupsStrScand(string, &sptr, loc);
if (!sptr || sscanf(sptr, "%40s%40s", name, keyword) != 2)
{
@@ -1549,6 +1549,18 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
goto error;
case 2 : /* Two options... */
/*
* Check for broken constraints like "* Option"...
*/
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
(!strcmp(constraint->option1, "*") ||
!strcmp(constraint->choice1, "*")))
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
/*
* The following strcpy's are safe, as optionN and
* choiceN are all the same size (size defined by PPD spec...)
@@ -1556,17 +1568,38 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
if (constraint->option1[0] == '*')
_cups_strcpy(constraint->option1, constraint->option1 + 1);
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
if (constraint->choice1[0] == '*')
_cups_strcpy(constraint->option2, constraint->choice1 + 1);
else
_cups_strcpy(constraint->option2, constraint->choice1);
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
constraint->choice1[0] = '\0';
constraint->choice2[0] = '\0';
break;
case 3 : /* Two options, one choice... */
/*
* Check for broken constraints like "* Option"...
*/
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
(!strcmp(constraint->option1, "*") ||
!strcmp(constraint->choice1, "*") ||
!strcmp(constraint->option2, "*")))
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
/*
* The following _cups_strcpy's are safe, as optionN and
* choiceN are all the same size (size defined by PPD spec...)
@@ -1574,9 +1607,21 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
if (constraint->option1[0] == '*')
_cups_strcpy(constraint->option1, constraint->option1 + 1);
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
if (constraint->choice1[0] == '*')
{
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
constraint->option2[0] == '*')
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
_cups_strcpy(constraint->choice2, constraint->option2);
_cups_strcpy(constraint->option2, constraint->choice1 + 1);
constraint->choice1[0] = '\0';
@@ -1585,20 +1630,85 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
{
if (constraint->option2[0] == '*')
_cups_strcpy(constraint->option2, constraint->option2 + 1);
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
constraint->choice2[0] = '\0';
}
break;
case 4 : /* Two options, two choices... */
/*
* Check for broken constraints like "* Option"...
*/
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
(!strcmp(constraint->option1, "*") ||
!strcmp(constraint->choice1, "*") ||
!strcmp(constraint->option2, "*") ||
!strcmp(constraint->choice2, "*")))
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
if (constraint->option1[0] == '*')
_cups_strcpy(constraint->option1, constraint->option1 + 1);
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
constraint->choice1[0] == '*')
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
if (constraint->option2[0] == '*')
_cups_strcpy(constraint->option2, constraint->option2 + 1);
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
constraint->choice2[0] == '*')
{
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
}
break;
}
/*
* Handle CustomFoo option constraints...
*/
if (!strncasecmp(constraint->option1, "Custom", 6) &&
!strcasecmp(constraint->choice1, "True"))
{
_cups_strcpy(constraint->option1, constraint->option1 + 6);
strcpy(constraint->choice1, "Custom");
}
if (!strncasecmp(constraint->option2, "Custom", 6) &&
!strcasecmp(constraint->choice2, "True"))
{
_cups_strcpy(constraint->option2, constraint->option2 + 6);
strcpy(constraint->choice2, "Custom");
}
/*
* Don't add this one as an attribute...
*/
ppd_free(string);
string = NULL;
}
@@ -1618,8 +1728,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
goto error;
}
size->width = _cupsStrScand(string, &sptr, loc);
size->length = _cupsStrScand(sptr, NULL, loc);
size->width = (float)_cupsStrScand(string, &sptr, loc);
size->length = (float)_cupsStrScand(sptr, NULL, loc);
ppd_free(string);
string = NULL;
@@ -1640,10 +1750,10 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
goto error;
}
size->left = _cupsStrScand(string, &sptr, loc);
size->bottom = _cupsStrScand(sptr, &sptr, loc);
size->right = _cupsStrScand(sptr, &sptr, loc);
size->top = _cupsStrScand(sptr, NULL, loc);
size->left = (float)_cupsStrScand(string, &sptr, loc);
size->bottom = (float)_cupsStrScand(sptr, &sptr, loc);
size->right = (float)_cupsStrScand(sptr, &sptr, loc);
size->top = (float)_cupsStrScand(sptr, NULL, loc);
ppd_free(string);
string = NULL;
@@ -2260,7 +2370,7 @@ ppd_get_cparam(ppd_coption_t *opt, /* I - PPD file */
return (NULL);
strlcpy(cparam->name, param, sizeof(cparam->name));
strlcpy(cparam->text, text, sizeof(cparam->text));
strlcpy(cparam->text, text[0] ? text : param, sizeof(cparam->text));
/*
* Add this record to the array...
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP utilities for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -285,7 +285,7 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
#ifdef WIN32
if (http->error != WSAENETDOWN && http->error != WSAENETUNREACH &&
http->error != ETIMEDOUT)
http->error != WSAETIMEDOUT)
#else
if (http->error != ENETDOWN && http->error != ENETUNREACH &&
http->error != ETIMEDOUT)
+7 -7
Ver Arquivo
@@ -3,7 +3,7 @@
*
* snprintf functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -195,7 +195,7 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */
sprintf(temp, tformat, va_arg(ap, double));
bytes += strlen(temp);
bytes += (int)strlen(temp);
if (bufptr)
{
@@ -225,7 +225,7 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */
sprintf(temp, tformat, va_arg(ap, int));
bytes += strlen(temp);
bytes += (int)strlen(temp);
if (bufptr)
{
@@ -248,7 +248,7 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */
sprintf(temp, tformat, va_arg(ap, void *));
bytes += strlen(temp);
bytes += (int)strlen(temp);
if (bufptr)
{
@@ -275,7 +275,7 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */
else
{
if ((bufptr + width) > bufend)
width = bufend - bufptr;
width = (int)(bufend - bufptr);
memcpy(bufptr, va_arg(ap, char *), (size_t)width);
bufptr += width;
@@ -287,7 +287,7 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */
if ((s = va_arg(ap, char *)) == NULL)
s = "(null)";
slen = strlen(s);
slen = (int)strlen(s);
if (slen > width && prec != width)
width = slen;
@@ -296,7 +296,7 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */
if (bufptr)
{
if ((bufptr + width) > bufend)
width = bufend - bufptr;
width = (int)(bufend - bufptr);
if (slen > width)
slen = width;
+43 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* String functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -243,7 +243,7 @@ _cupsStrFormatd(char *buf, /* I - String */
if (loc && loc->decimal_point)
{
dec = loc->decimal_point;
declen = strlen(dec);
declen = (int)strlen(dec);
}
else
{
@@ -439,6 +439,47 @@ _cupsStrScand(const char *buf, /* I - Pointer to number */
}
}
if (*buf == 'e' || *buf == 'E')
{
/*
* Read exponent...
*/
if (tempptr < (temp + sizeof(temp) - 1))
*tempptr++ = *buf++;
else
{
if (bufptr)
*bufptr = NULL;
return (0.0);
}
if (*buf == '+' || *buf == '-')
{
if (tempptr < (temp + sizeof(temp) - 1))
*tempptr++ = *buf++;
else
{
if (bufptr)
*bufptr = NULL;
return (0.0);
}
}
while (isdigit(*buf & 255))
if (tempptr < (temp + sizeof(temp) - 1))
*tempptr++ = *buf++;
else
{
if (bufptr)
*bufptr = NULL;
return (0.0);
}
}
/*
* Nul-terminate the temporary string and return the value...
*/
+14 -12
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Temp file utilities for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -25,9 +25,9 @@
*
* Contents:
*
* cupsTempFd() - Create a temporary file.
* cupsTempFile() - Generate a temporary filename.
* cupsTempFile2() - Create a temporary CUPS file.
* cupsTempFd() - Creates a temporary file.
* cupsTempFile() - Generates a temporary filename.
* cupsTempFile2() - Creates a temporary CUPS file.
*/
/*
@@ -48,12 +48,13 @@
/*
* 'cupsTempFd()' - Create a temporary file.
* 'cupsTempFd()' - Creates a temporary file.
*
* The temporary filename is stored in the filename buffer.
* The temporary filename is returned in the filename buffer.
* The temporary file is opened for reading and writing.
*/
int /* O - New file descriptor */
int /* O - New file descriptor or -1 on error */
cupsTempFd(char *filename, /* I - Pointer to buffer */
int len) /* I - Size of buffer */
{
@@ -158,16 +159,16 @@ cupsTempFd(char *filename, /* I - Pointer to buffer */
/*
* 'cupsTempFile()' - Generate a temporary filename.
* 'cupsTempFile()' - Generates a temporary filename.
*
* The temporary filename is stored in the filename buffer.
* The temporary filename is returned in the filename buffer.
* This function is deprecated - use cupsTempFd() or cupsTempFile2()
* instead.
*
* @deprecated@
*/
char * /* O - Filename */
char * /* O - Filename or NULL on error */
cupsTempFile(char *filename, /* I - Pointer to buffer */
int len) /* I - Size of buffer */
{
@@ -207,9 +208,10 @@ cupsTempFile(char *filename, /* I - Pointer to buffer */
/*
* 'cupsTempFile2()' - Create a temporary CUPS file.
* 'cupsTempFile2()' - Creates a temporary CUPS file.
*
* The temporary filename is stored in the filename buffer.
* The temporary filename is returned in the filename buffer.
* The temporary file is opened for writing.
*
* @since CUPS 1.2@
*/
+27 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* File test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -86,8 +86,13 @@ main(int argc, /* I - Number of command-line arguments */
*/
fputs("cupsFileFind: ", stdout);
#ifdef WIN32
if (cupsFileFind("notepad.exe", "C:/WINDOWS", 1, filename, sizeof(filename)) &&
cupsFileFind("notepad.exe", "C:/WINDOWS;C:/WINDOWS/SYSTEM32", 1, filename, sizeof(filename)))
#else
if (cupsFileFind("cat", "/bin", 1, filename, sizeof(filename)) &&
cupsFileFind("cat", "/bin:/usr/bin", 1, filename, sizeof(filename)))
#endif /* WIN32 */
printf("PASS (%s)\n", filename);
else
{
@@ -165,7 +170,12 @@ read_write_tests(int compression) /* I - Use compression? */
* Initialize the write buffer with random data...
*/
#ifdef WIN32
srand((unsigned)time(NULL));
#else
srand(time(NULL));
#endif /* WIN32 */
for (i = 0; i < (int)sizeof(writebuf); i ++)
writebuf[i] = rand();
@@ -362,14 +372,28 @@ read_write_tests(int compression) /* I - Use compression? */
}
/*
* cupsGetChar()
* cupsFileGetChar()
*/
fputs("cupsGetChar(): ", stdout);
fputs("cupsFileGetChar(): ", stdout);
#ifdef DEBUG
puts("\ni byte\n----- -----");
for (i = 0; i < 256; i ++)
{
byte = cupsFileGetChar(fp);
printf("%-5d %-5d\n", i, byte);
if (byte != i)
break;
}
#else
for (i = 0; i < 256; i ++)
if ((byte = cupsFileGetChar(fp)) != i)
break;
#endif /* DEBUG */
if (i >= 256)
puts("PASS");
+2
Ver Arquivo
@@ -84,6 +84,8 @@ static uri_test_t uri_tests[] = /* URI test data */
"http", "username:password", "server", "/", 8080, 8080 },
{ HTTP_URI_OK, "http://username:passwor%64@server:8080/directory/filename",
"http", "username:password", "server", "/directory/filename", 8080, 8080 },
{ HTTP_URI_OK, "http://[2000::10:100]:631/ipp",
"http", "", "2000::10:100", "/ipp", 631, 631 },
{ HTTP_URI_OK, "https://username:passwor%64@server/directory/filename",
"https", "username:password", "server", "/directory/filename", 443, 0 },
{ HTTP_URI_OK, "ipp://username:passwor%64@[::1]/ipp",
+69
Ver Arquivo
@@ -195,6 +195,8 @@ main(int argc, /* I - Number of command-line arguments */
ppd_attr_t *attr; /* Current attribute */
ppd_group_t *group; /* Option group */
ppd_option_t *option; /* Option */
ppd_coption_t *coption; /* Custom option */
ppd_cparam_t *cparam; /* Custom parameter */
char lang[255]; /* LANG environment variable */
@@ -221,6 +223,73 @@ main(int argc, /* I - Number of command-line arguments */
for (k = 0; k < option->num_choices; k ++)
printf(" - %s (%s)\n", option->choices[k].choice,
option->choices[k].text);
if ((coption = ppdFindCustomOption(ppd, option->keyword)) != NULL)
{
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
cparam;
cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
{
switch (cparam->type)
{
case PPD_CUSTOM_CURVE :
printf(" %s(%s): PPD_CUSTOM_CURVE (%g to %g)\n",
cparam->name, cparam->text,
cparam->minimum.custom_curve,
cparam->maximum.custom_curve);
break;
case PPD_CUSTOM_INT :
printf(" %s(%s): PPD_CUSTOM_INT (%d to %d)\n",
cparam->name, cparam->text,
cparam->minimum.custom_int,
cparam->maximum.custom_int);
break;
case PPD_CUSTOM_INVCURVE :
printf(" %s(%s): PPD_CUSTOM_INVCURVE (%g to %g)\n",
cparam->name, cparam->text,
cparam->minimum.custom_invcurve,
cparam->maximum.custom_invcurve);
break;
case PPD_CUSTOM_PASSCODE :
printf(" %s(%s): PPD_CUSTOM_PASSCODE (%d to %d)\n",
cparam->name, cparam->text,
cparam->minimum.custom_passcode,
cparam->maximum.custom_passcode);
break;
case PPD_CUSTOM_PASSWORD :
printf(" %s(%s): PPD_CUSTOM_PASSWORD (%d to %d)\n",
cparam->name, cparam->text,
cparam->minimum.custom_password,
cparam->maximum.custom_password);
break;
case PPD_CUSTOM_POINTS :
printf(" %s(%s): PPD_CUSTOM_POINTS (%g to %g)\n",
cparam->name, cparam->text,
cparam->minimum.custom_points,
cparam->maximum.custom_points);
break;
case PPD_CUSTOM_REAL :
printf(" %s(%s): PPD_CUSTOM_REAL (%g to %g)\n",
cparam->name, cparam->text,
cparam->minimum.custom_real,
cparam->maximum.custom_real);
break;
case PPD_CUSTOM_STRING :
printf(" %s(%s): PPD_CUSTOM_STRING (%d to %d)\n",
cparam->name, cparam->text,
cparam->minimum.custom_string,
cparam->maximum.custom_string);
break;
}
}
}
}
}
+77 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Transcoding support for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are
* the property of Easy Software Products and are protected by Federal
@@ -292,7 +292,39 @@ cupsCharsetToUTF8(
encoding < 0 || encoding >= CUPS_ENCODING_VBCS_END)
{
strlcpy((char *)dest, src, maxout);
return (strlen((char *)dest));
return ((int)strlen((char *)dest));
}
/*
* Handle ISO-8859-1 to UTF-8 directly...
*/
if (encoding == CUPS_ISO8859_1)
{
int ch; /* Character from string */
cups_utf8_t *destptr, /* Pointer into UTF-8 buffer */
*destend; /* End of UTF-8 buffer */
destptr = dest;
destend = dest + maxout - 2;
while (*src && destptr < destend)
{
ch = *src++ & 255;
if (ch & 128)
{
*destptr++ = 0xc0 | (ch >> 6);
*destptr++ = 0x80 | (ch & 0x3f);
}
else
*destptr++ = ch;
}
*destptr = '\0';
return ((int)(destptr - dest));
}
/*
@@ -360,7 +392,46 @@ cupsUTF8ToCharset(
encoding < 0 || encoding >= CUPS_ENCODING_VBCS_END)
{
strlcpy(dest, (char *)src, maxout);
return (strlen(dest));
return ((int)strlen(dest));
}
/*
* Handle UTF-8 to ISO-8859-1 directly...
*/
if (encoding == CUPS_ISO8859_1)
{
int ch; /* Character from string */
char *destptr, /* Pointer into ISO-8859-1 buffer */
*destend; /* End of ISO-8859-1 buffer */
destptr = dest;
destend = dest + maxout - 1;
while (*src && destptr < destend)
{
ch = *src++;
if ((ch & 0xe0) == 0xc0)
{
ch = ((ch & 0x1f) << 6) | (*src++ & 0x3f);
if (ch < 256)
*destptr++ = ch;
else
*destptr++ = '?';
}
else if ((ch & 0xf0) == 0xe0 ||
(ch & 0xf8) == 0xf0)
*destptr++ = '?';
else if (!(ch & 0x80))
*destptr++ = ch;
}
*destptr = '\0';
return ((int)(destptr - dest));
}
/*
@@ -445,6 +516,7 @@ cupsUTF8ToUTF32(
*/
*dest++ = ch;
continue;
}
else if ((ch & 0xe0) == 0xc0)
{
@@ -540,7 +612,7 @@ cupsUTF8ToUTF32(
* Check for UTF-16 surrogate (illegal UTF-8)...
*/
if (*dest >= 0xd800 && *dest <= 0xdfff)
if (ch32 >= 0xd800 && ch32 <= 0xdfff)
return (-1);
}
@@ -896,7 +968,7 @@ conv_utf8_to_vbcs(
if (unichar < 0x80)
{
*dest++ = (cups_vbcs_t)unichar;
*dest++ = (cups_sbcs_t)unichar;
continue;
}
+2 -1
Ver Arquivo
@@ -1649,7 +1649,8 @@ cups_get_printer_uri(
ippDelete(response);
}
_cupsSetError(IPP_INTERNAL_ERROR, "No printer-uri found!");
if (cupsLastError() != IPP_NOT_FOUND)
_cupsSetError(IPP_INTERNAL_ERROR, "No printer-uri found!");
*host = '\0';
*resource = '\0';
+7 -1
Ver Arquivo
@@ -14,10 +14,16 @@ X-DCOP-ServiceType=
X-KDE-SubstituteUID=false
X-KDE-Username=
Name=Manage Printing
Name[en_US]=Manage Printing
Comment=CUPS Web Interface
Name[en_US]=Manage Printing
Comment[en_US]=CUPS Web Interface
Name[es]=Administrar impresión
Comment[es]=Interfaz Web de CUPS
Name[et]=Trükkimise haldur
Comment[et]=CUPS-i veebiliides
Name[fr]=Gestionnaire d'impression
Comment[fr]=Interface Web de CUPS
Name[pl]=Zarządzanie drukowaniem
Comment[pl]=Interfejs WWW CUPS
Name[it]=Gestione stampa
Comment[it]=Interfaccia web di CUPS
+1 -1
Ver Arquivo
@@ -130,7 +130,7 @@ WIDTH="15" HEIGHT="15" ALT=""></TD>
<P><SMALL>Das Common UNIX Printing System, CUPS, und das CUPS Logo sind
Warenzeichen der <A HREF="http://www.easysw.com">Easy Software
Products</A>. CUPS ist urheberrechtlich gesch&uuml;tzt 1997-2006 von Easy Software Products,
Products</A>. CUPS ist urheberrechtlich gesch&uuml;tzt 1997-2007 von Easy Software Products,
Alle Rechte vorbehalten.</SMALL></P>
</TD>
+1 -1
Ver Arquivo
@@ -133,7 +133,7 @@ WIDTH="15" HEIGHT="15" ALT=""></TD>
<P><SMALL>Common UNIX Printing System, CUPS, y el logo de CUPS son
marcas registradas de <A HREF="http://www.easysw.com">Easy Software
Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products.
Products</A>. Los derechos de copia de CUPS 1997-2007 son de Easy Software Products.
Todos los derechos reservados.</SMALL></P>
</TD>
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 595 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 443 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 472 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 563 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 636 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 513 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 612 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 644 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 419 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 355 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 506 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 522 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 721 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 874 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 313 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 451 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 523 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 450 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 571 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 541 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 537 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 552 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 475 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 606 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 768 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 630 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 560 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 649 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 534 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 551 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 709 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 329 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 753 B

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