Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 4d5e91c810 |
@@ -1,6 +1,239 @@
|
||||
CHANGES.txt - 2007-12-17
|
||||
CHANGES.txt - 2008-07-21
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.3.8
|
||||
|
||||
- Documentation updates (STR #2785, STR #2861, STR #2862)
|
||||
- The scheduler did not add the ending job sheet when the
|
||||
job was released.
|
||||
- The IPP backend did not relay marker-* attributes.
|
||||
- The CUPS GNOME/KDE menu item was not localized for
|
||||
Chinese (STR #2880)
|
||||
- The CUPS GNOME/KDE menu item was not localized for
|
||||
Japanese (STR #2876)
|
||||
- The cupstestppd utility reported mixed line endings for
|
||||
Mac OS and Windows PPD files (STR #2874)
|
||||
- The pdftops filter did not print landscape orientation PDF
|
||||
pages correctly on all printers (STR #2850)
|
||||
- The scheduler did not handle expiring of implicit classes
|
||||
or their members properly, leading to a configuration where
|
||||
one of the members would have a short name (STR #2766)
|
||||
- The scheduler and cupstestppd utilities did not support
|
||||
cupsFilter and cupsPreFilter programs with spaces in their
|
||||
names (STR #2866)
|
||||
- Removed unused variables and assignments found by the
|
||||
LLVM "clang" tool.
|
||||
- Added NULL checks recommended by the LLVM "clang" tool.
|
||||
- The scheduler would crash if you started a printer that
|
||||
pointed to a backend that did not exist (STR #2865)
|
||||
- The ppdLocalize functions incorrectly mapped all generic
|
||||
locales to country-specific locales.
|
||||
- The cups-driverd program did not support Simplified Chinese
|
||||
or Traditional Chinese language version strings (STR #2851)
|
||||
- Added an Indonesian translation (STR #2792)
|
||||
- Fixed a timing issue in the backends that could cause data
|
||||
corruption with the CUPS_SC_CMD_DRAIN_OUTPUT side-channel
|
||||
command (STR #2858)
|
||||
- The scheduler did not support "HostNameLookups" with all of
|
||||
the boolean names (STR #2861)
|
||||
- Fixed a compile problem with glibc 2.8 (STR #2860)
|
||||
- The PostScript filter did not support %%IncludeFeature lines
|
||||
in the page setup section of each page (STR #2831)
|
||||
- The scheduler did not generate printer-state events when the
|
||||
default printer was changed (STR #2764)
|
||||
- cupstestppd incorrectly reported a warning about the PPD format
|
||||
version in some locales (STR #2854)
|
||||
- cupsGetPPD() and friends incorrectly returned a PPD file for
|
||||
a class with no printers.
|
||||
- The member-uris values for local printers in a class returned
|
||||
by the scheduler did not reflect the connected hostname or
|
||||
port.
|
||||
- The CUPS PHP extension was not thread-safe (STR #2828)
|
||||
- The scheduler incorrectly added the document-format-default
|
||||
attribute to the list of "common" printer attributes, which
|
||||
over time would slow down the printing system (STR #2755,
|
||||
STR #2836)
|
||||
- The cups-deviced and cups-driverd helper programs did not set
|
||||
the CFProcessPath environment variable on Mac OS X (STR #2837)
|
||||
- "lpstat -p" could report the wrong job as printing (STR #2845)
|
||||
- The scheduler would crash when some cupsd.conf directives
|
||||
were missing values (STR #2849)
|
||||
- The web interface "move jobs" operation redirected users to
|
||||
the wrong URL (STR #2815)
|
||||
- The Polish web interface translation contained errors
|
||||
(STR #2815)
|
||||
- The scheduler did not report PostScript printer PPDs with
|
||||
filters as PostScript devices.
|
||||
- The scheduler did not set the job document-format attribute
|
||||
for jobs submitted using Create-Job and Send-Document.
|
||||
- cupsFileTell() did not work for log files opened in append
|
||||
mode (STR #2810)
|
||||
- The scheduler did not set QUERY_STRING all of the time
|
||||
for CGI scripts (STR #2781, STR #2816)
|
||||
- The scheduler now returns an error for bad job-sheets
|
||||
values (STR #2775)
|
||||
- Authenticated remote printing did not work over domain
|
||||
sockets (STR #2750)
|
||||
- The scheduler incorrectly logged errors for print filters
|
||||
when a job was canceled (STR #2806, #2808)
|
||||
- The scheduler no longer allows multiple RSS subscriptions
|
||||
with the same URI (STR #2789)
|
||||
- The scheduler now supports Kerberized printing with
|
||||
multiple server names (STR #2783)
|
||||
- "Satisfy any" did not work in IPP policies (STR #2782)
|
||||
- The CUPS imaging library would crash with very large
|
||||
images - more than 16Mx16M pixels (STR #2805)
|
||||
- The PNG image loading code would crash with large images
|
||||
(STR #2790)
|
||||
- The scheduler did not limit the total number of filters.
|
||||
- The scheduler now ensures that the RSS directory has
|
||||
the correct permissions.
|
||||
- The RSS notifier did not quote the feed URL in the RSS
|
||||
file it created (STR #2801)
|
||||
- The web interface allowed the creation and cancellation
|
||||
of RSS subscriptions without a username (STR #2774)
|
||||
- Increased the default MaxCopies value on Mac OS X to
|
||||
9999 to match the limit imposed by the print dialog.
|
||||
- The scheduler did not reject requests with an empty
|
||||
Content-Length field (STR #2787)
|
||||
- The scheduler did not log the current date and time and
|
||||
did not escape special characters in request URIs when
|
||||
logging bad requests to the access_log file (STR #2788)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3.7
|
||||
|
||||
- CVE-2008-0047: cgiCompileSearch buffer overflow (STR #2729)
|
||||
- CVE-2008-1373: CUPS GIF image filter overflow (STR #2765)
|
||||
- Updated the "make check" tests to do a more thorough
|
||||
automated test.
|
||||
- cups-driverd complained about missing directories (STR
|
||||
#2777)
|
||||
- cupsaddsmb would leave the Samba username and password on
|
||||
disk if no Windows drivers were installed (STR #2779)
|
||||
- The Linux USB backend used 100% CPU when a printer was
|
||||
disconnected (STR #2769)
|
||||
- The sample raster drivers did not properly handle SIGTERM
|
||||
(STR #2770)
|
||||
- The scheduler sent notify_post() messages too often on
|
||||
Mac OS X.
|
||||
- Kerberos access to the web interface did not work
|
||||
(STR #2748)
|
||||
- The scheduler did not support "AuthType Default" in IPP
|
||||
policies (STR #2749)
|
||||
- The scheduler did not support the "HideImplicitMembers"
|
||||
directive as documented (STR #2760)
|
||||
- "make check" didn't return a non-zero exit code on
|
||||
error (STR #2758)
|
||||
- The scheduler incorrectly logged AUTH_foo environment
|
||||
variables in debug mode (STR #2751)
|
||||
- The image filters inverted PBM files (STR #2746)
|
||||
- cupsctl would crash if the scheduler was not running
|
||||
(STR #2741)
|
||||
- The scheduler could crash when printing using a port
|
||||
monitor (STR #2742)
|
||||
- The scheduler would crash if PAM was broken (STR #2734)
|
||||
- The image filters did not work with some CMYK JPEG files
|
||||
produced by Adobe applications (STR #2727)
|
||||
- The Mac OS X USB backend did not work with printers that
|
||||
did not report a make or model.
|
||||
- The job-sheets option was not encoded properly (STR #2715)
|
||||
- The scheduler incorrectly complained about missing LSB
|
||||
PPD directories.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3.6
|
||||
|
||||
- Documentation updates (STR #2646, STR #2647, STR #2649)
|
||||
- Fixed a problem with the web interface "Use Kerberos
|
||||
Authentication" check box (STR #2703)
|
||||
- The scheduler unconditionally overwrote the printer-state-
|
||||
message with "process-name failed" when a filter or backend
|
||||
failed, preventing a useful error message from being shown
|
||||
to the user.
|
||||
- Policies on CUPS-Move-Job didn't work as expected (STR
|
||||
#2699)
|
||||
- The configure script only supported D-BUS on Linux
|
||||
(STR #2702)
|
||||
- The scheduler did not support </LimitExcept> (STR #2701)
|
||||
- The scheduler did not reset the job-hold-until attribute
|
||||
after a job's hold time was reached.
|
||||
- The scheduler did not support printer supply attributes
|
||||
(STR #1307)
|
||||
- The Kerberos credentials provided by some Windows KDCs
|
||||
were still too large - now use a dynamic buffer to
|
||||
support credentials up to 64k in size (STR #2695)
|
||||
- Printing a test page from the web interface incorrectly
|
||||
defaulted to the "guest" user (STR #2688)
|
||||
- The cupsEncodeOptions2() function did not parse multiple-
|
||||
value attribute values properly (STR #2690)
|
||||
- The scheduler incorrectly sent printer-stopped events for
|
||||
status updates from the print filters (STR #2680)
|
||||
- The IPP backend could crash when handling printer errors
|
||||
(STR #2667)
|
||||
- Multi-file jobs did not print to remote CUPS servers
|
||||
(STR #2673)
|
||||
- The scheduler did not provide the Apple language ID to
|
||||
job filters.
|
||||
- Kerberos authentication did not work with the web
|
||||
interface (STR #2606, STR #2669)
|
||||
- The requesing-user-name-allowed and -denied functionality
|
||||
did not work for Kerberos-authenticated usernames (STR
|
||||
#2670)
|
||||
- CUPS didn't compile on HP-UX 11i (STR #2679)
|
||||
- cupsEncodeOptions2() did not handle option values like
|
||||
"What's up, doc?" properly.
|
||||
- Added lots of memory allocation checks (Fortify)
|
||||
- The scheduler would crash if it was unable to add a job
|
||||
file (Fortify)
|
||||
- ppdOpen*() did not check all memory allocations (Coverity)
|
||||
- ippReadIO() did not check all memory allocations (Coverity)
|
||||
- The PostScript filter did not detect read errors (Coverity)
|
||||
- The scheduler did not check for a missing job-sheets-completed
|
||||
attribute when sending an event notification (Coverity)
|
||||
- "Set Printer Options" might not work with raw queues (Coverity)
|
||||
- cupsRasterInterpretPPD() could crash on certain PostScript
|
||||
errors (Coverity)
|
||||
- The USB backend did not check for back-channel support
|
||||
properly on all systems (Coverity)
|
||||
- Fixed memory leaks in the GIF and PNM image loading code
|
||||
(Coverity)
|
||||
- Removed some dead code in the CUPS API and scheduler (Coverity)
|
||||
- Fixed two overflow bugs in the HP-GL/2 filter (Coverity)
|
||||
- Fixed another ASN1 string parsing bug (STR #2665)
|
||||
- The RSS notifier directory was not installed with the
|
||||
correct permissions.
|
||||
- The standard CUPS backends could use 100% CPU while waiting
|
||||
for print data (STR #2664)
|
||||
- Filename-based MIME rules did not work (STR #2659)
|
||||
- The cups-polld program did not exit if the scheduler crashed
|
||||
(STR #2640)
|
||||
- The scheduler would crash if you tried to set the port-monitor
|
||||
on a raw queue (STR #2639)
|
||||
- The scheduler could crash if a polled remote printer was
|
||||
converted to a class (STR #2656)
|
||||
- The web interface and cupsctl did not correctly reflect
|
||||
the "allow printing from the Internet" state (STR #2650)
|
||||
- The scheduler incorrectly treated MIME types as case-
|
||||
sensitive (STR #2657)
|
||||
- The Java support classes did not send UTF-8 strings to
|
||||
the scheduler (STR #2651)
|
||||
- The CGI code did not handle interrupted POST requests
|
||||
properly (STR #2652)
|
||||
- The PostScript filter incorrectly handled number-up when
|
||||
the number of pages was evenly divisible by the number-up
|
||||
value.
|
||||
- The PDF filter incorrectly filtered pages when page-ranges
|
||||
and number-up were both specified (STR #2643)
|
||||
- The IPP backend did not handle printing of pictwps files
|
||||
to a non-Mac CUPS server properly.
|
||||
- The scheduler did not detect network interface changes
|
||||
on operating systems other than Mac OS X (STR #2631)
|
||||
- The scheduler now logs the UNIX error message when it
|
||||
is unable to create a request file such as a print job.
|
||||
- Added support for --enable-pie on Mac OS X.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3.5
|
||||
|
||||
- The SNMP backend did not check for negative string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CREDITS.txt - 2007-09-10
|
||||
CREDITS.txt - 2008-06-16
|
||||
------------------------
|
||||
|
||||
Few projects are completed by one person, and CUPS is no exception. We'd
|
||||
@@ -30,6 +30,7 @@ like to thank the following individuals for their contributions:
|
||||
Daniel Nylander - Swedish localization.
|
||||
Giulio Orsero - Bug fixes and testing.
|
||||
Michal Osowiecki - Polish localization.
|
||||
Citra Paska - Indonesian localization.
|
||||
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
|
||||
Vincenzo Reale - Italian localization.
|
||||
Petter Reinholdtsen - HP-UX compiler stuff.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
INSTALL - CUPS v1.3.2 - 2007-09-18
|
||||
INSTALL - CUPS v1.3.8 - 2008-07-14
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source
|
||||
@@ -31,9 +31,8 @@ BEFORE YOU BEGIN
|
||||
compile and run without these, however you'll miss out on
|
||||
many of the features provided by CUPS.
|
||||
|
||||
Kerberos support requires a very recent version of the MIT
|
||||
implementation with the krb5_cc_new_unique() function or the
|
||||
Heimdal implementation, along with the corresponding GSSAPI
|
||||
Kerberos support requires MIT Kerberos 1.6.3 or later or
|
||||
Heimdal Kerberos, along with the corresponding GSSAPI
|
||||
pieces.
|
||||
|
||||
Also, please note that CUPS no longer includes the
|
||||
@@ -47,7 +46,7 @@ COMPILING FROM SUBVERSION
|
||||
|
||||
The CUPS Subversion repository doesn't hold a copy of the
|
||||
pre-built configure script. You'll need to run the GNU
|
||||
autoconf software (2.52 or higher) before compiling the
|
||||
autoconf software (2.60 or higher) before compiling the
|
||||
software from Subversion:
|
||||
|
||||
autoconf -f
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Common makefile definitions for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007 by Apple Inc.
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -108,17 +108,17 @@ INSTALLSTATIC = @INSTALLSTATIC@
|
||||
# for extra debug info)
|
||||
#
|
||||
|
||||
ALL_CFLAGS = $(CFLAGS) $(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \
|
||||
$(OPTIONS)
|
||||
ALL_CFLAGS = -I.. -D_CUPS_SOURCE $(CFLAGS) $(SSLFLAGS) \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
ALL_CXXFLAGS = -I.. -D_CUPS_SOURCE $(CXXFLAGS) $(SSLFLAGS) \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
ARCHFLAGS = @ARCHFLAGS@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
BACKLIBS = @BACKLIBS@
|
||||
CFLAGS = -I.. @CPPFLAGS@ @CFLAGS@ \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
CFLAGS = @CPPFLAGS@ @CFLAGS@
|
||||
COMMONLIBS = @LIBS@
|
||||
CUPSDLIBS = @CUPSDLIBS@
|
||||
CXXFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@
|
||||
CXXLIBS = @CXXLIBS@
|
||||
DSOFLAGS = @DSOFLAGS@
|
||||
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
|
||||
@@ -258,7 +258,7 @@ DBUSDIR = @DBUSDIR@
|
||||
|
||||
.cxx.o:
|
||||
echo Compiling $<...
|
||||
$(CXX) $(ARCHFLAGS) $(OPTIM) $(CXXFLAGS) -c $<
|
||||
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c $<
|
||||
|
||||
.man.1 .man.1m .man.5 .man.7 .man.8:
|
||||
echo Linking $<...
|
||||
|
||||
@@ -31,6 +31,10 @@ DIRS = cups backend berkeley cgi-bin filter locale man monitor \
|
||||
|
||||
all:
|
||||
chmod +x cups-config
|
||||
echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
|
||||
echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
|
||||
echo Using LDFLAGS="$(LDFLAGS)"
|
||||
echo Using LIBS="$(LIBS)"
|
||||
for dir in $(DIRS); do\
|
||||
echo Making all in $$dir... ;\
|
||||
(cd $$dir ; $(MAKE) $(MFLAGS)) || exit 1;\
|
||||
@@ -80,6 +84,22 @@ depend:
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Run the clang.llvm.org static code analysis tool on the C sources.
|
||||
#
|
||||
|
||||
.PHONY: clang
|
||||
clang:
|
||||
if test ! -d clang; then \
|
||||
mkdir clang; \
|
||||
else \
|
||||
rm -rf clang/*; \
|
||||
fi
|
||||
$(MAKE) $(MFLAGS) CC="scan-build -o ../clang $(CC)" \
|
||||
CXX="scan-build -o ../clang $(CXX)" clean all
|
||||
test `ls -1 clang | wc -l` != 0 || exit 1
|
||||
|
||||
|
||||
#
|
||||
# Generate a ctags file...
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
README - CUPS v1.3.2 - 2007-09-18
|
||||
README - CUPS v1.3.8 - 2008-07-14
|
||||
---------------------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
@@ -153,9 +153,9 @@ PRINTING FILES
|
||||
|
||||
LEGAL STUFF
|
||||
|
||||
CUPS is Copyright 2007 by Apple Inc. CUPS, the CUPS logo, and
|
||||
the Common UNIX Printing System are the trademark property of
|
||||
Apple Inc.
|
||||
CUPS is Copyright 2007-2008 Apple Inc. All Rights Reserved.
|
||||
CUPS, the CUPS logo, and the Common UNIX Printing System are
|
||||
trademarks of Apple Inc.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
|
||||
|
||||
@@ -64,19 +64,23 @@ backendGetDeviceID(
|
||||
char *uri, /* O - Device URI */
|
||||
int uri_size) /* I - Size of buffer */
|
||||
{
|
||||
#ifdef __APPLE__ /* This function is a no-op */
|
||||
return (-1);
|
||||
|
||||
#else /* Get the device ID from the specified file descriptor... */
|
||||
char *attr, /* 1284 attribute */
|
||||
*delim, /* 1284 delimiter */
|
||||
*uriptr, /* Pointer into URI */
|
||||
manufacturer[256], /* Manufacturer string */
|
||||
serial_number[1024]; /* Serial number string */
|
||||
int manulen; /* Length of manufacturer string */
|
||||
#ifdef __linux
|
||||
# ifdef __linux
|
||||
int length; /* Length of device ID info */
|
||||
int got_id = 0;
|
||||
#endif /* __linux */
|
||||
#if defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
# endif /* __linux */
|
||||
# if defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
struct ecpp_device_id did; /* Device ID buffer */
|
||||
#endif /* __sun && ECPPIOC_GETDEVID */
|
||||
# endif /* __sun && ECPPIOC_GETDEVID */
|
||||
|
||||
|
||||
DEBUG_printf(("backendGetDeviceID(fd=%d, device_id=%p, device_id_size=%d, "
|
||||
@@ -106,7 +110,7 @@ backendGetDeviceID(
|
||||
|
||||
*device_id = '\0';
|
||||
|
||||
#ifdef __linux
|
||||
# ifdef __linux
|
||||
if (ioctl(fd, LPIOC_GET_DEVICE_ID(device_id_size), device_id))
|
||||
{
|
||||
/*
|
||||
@@ -213,13 +217,13 @@ backendGetDeviceID(
|
||||
memmove(device_id, device_id + 2, length);
|
||||
device_id[length] = '\0';
|
||||
}
|
||||
# ifdef DEBUG
|
||||
# ifdef DEBUG
|
||||
else
|
||||
printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
|
||||
# endif /* DEBUG */
|
||||
#endif /* __linux */
|
||||
# endif /* DEBUG */
|
||||
# endif /* __linux */
|
||||
|
||||
#if defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
# if defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
did.mode = ECPP_CENTRONICS;
|
||||
did.len = device_id_size - 1;
|
||||
did.rlen = 0;
|
||||
@@ -236,11 +240,11 @@ backendGetDeviceID(
|
||||
else
|
||||
device_id[device_id_size - 1] = '\0';
|
||||
}
|
||||
# ifdef DEBUG
|
||||
# ifdef DEBUG
|
||||
else
|
||||
printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
|
||||
# endif /* DEBUG */
|
||||
#endif /* __sun && ECPPIOC_GETDEVID */
|
||||
# endif /* DEBUG */
|
||||
# endif /* __sun && ECPPIOC_GETDEVID */
|
||||
}
|
||||
|
||||
DEBUG_printf(("backendGetDeviceID: device_id=\"%s\"\n", device_id));
|
||||
@@ -369,6 +373,7 @@ backendGetDeviceID(
|
||||
}
|
||||
|
||||
return (0);
|
||||
#endif /* __APPLE__ */
|
||||
}
|
||||
|
||||
|
||||
@@ -474,15 +479,41 @@ backendGetMakeModel(
|
||||
|
||||
if (mfg)
|
||||
{
|
||||
/*
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*mfg & 255))
|
||||
mfg ++;
|
||||
|
||||
/*
|
||||
* Map common bad names to the ones we use for driver selection...
|
||||
*/
|
||||
|
||||
if (!strncasecmp(mfg, "Hewlett-Packard", 15))
|
||||
strlcpy(make_model, "HP", make_model_size);
|
||||
else if (!strncasecmp(mfg, "Lexmark International", 21))
|
||||
strlcpy(make_model, "Lexmark", make_model_size);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Use the manufacturer that is supplied...
|
||||
*/
|
||||
|
||||
strlcpy(make_model, mfg, make_model_size);
|
||||
|
||||
if ((delim = strchr(make_model, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
if ((delim = strchr(make_model, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
|
||||
/*
|
||||
* But strip trailing whitespace...
|
||||
*/
|
||||
|
||||
for (delim = make_model + strlen(make_model) - 1;
|
||||
delim > make_model && *delim == ' ';
|
||||
delim --)
|
||||
*delim = '\0';
|
||||
}
|
||||
|
||||
if (!strncasecmp(make_model, mdl, strlen(make_model)))
|
||||
{
|
||||
@@ -498,6 +529,9 @@ backendGetMakeModel(
|
||||
* Concatenate the make and model...
|
||||
*/
|
||||
|
||||
while (isspace(*mdl & 255))
|
||||
mdl ++;
|
||||
|
||||
strlcat(make_model, " ", make_model_size);
|
||||
strlcat(make_model, mdl, make_model_size);
|
||||
}
|
||||
@@ -508,6 +542,9 @@ backendGetMakeModel(
|
||||
* Just copy model string, since it has the manufacturer...
|
||||
*/
|
||||
|
||||
while (isspace(*mdl & 255))
|
||||
mdl ++;
|
||||
|
||||
strlcpy(make_model, mdl, make_model_size);
|
||||
}
|
||||
}
|
||||
@@ -517,6 +554,9 @@ backendGetMakeModel(
|
||||
* Use description...
|
||||
*/
|
||||
|
||||
while (isspace(*attr & 255))
|
||||
attr ++;
|
||||
|
||||
if (!strncasecmp(attr, "Hewlett-Packard hp ", 19))
|
||||
{
|
||||
/*
|
||||
@@ -552,6 +592,11 @@ backendGetMakeModel(
|
||||
if ((delim = strchr(make_model, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
|
||||
for (delim = make_model + strlen(make_model) - 1;
|
||||
delim > make_model && *delim == ' ';
|
||||
delim --)
|
||||
*delim = '\0';
|
||||
|
||||
/*
|
||||
* Strip trailing whitespace...
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* IPP backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -22,6 +22,7 @@
|
||||
* compress_files() - Compress print files...
|
||||
* password_cb() - Disable the password prompt for
|
||||
* cupsDoFileRequest().
|
||||
* report_attr() - Report an IPP attribute value.
|
||||
* report_printer_state() - Report the printer state.
|
||||
* run_pictwps_filter() - Convert PICT files to PostScript when printing
|
||||
* remotely.
|
||||
@@ -72,6 +73,7 @@ static void check_printer_state(http_t *http, const char *uri,
|
||||
static void compress_files(int num_files, char **files);
|
||||
#endif /* HAVE_LIBZ */
|
||||
static const char *password_cb(const char *);
|
||||
static void report_attr(ipp_attribute_t *attr);
|
||||
static int report_printer_state(ipp_t *ipp, int job_id);
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -142,6 +144,11 @@ main(int argc, /* I - Number of command-line args */
|
||||
{ /* Printer attributes we want */
|
||||
"copies-supported",
|
||||
"document-format-supported",
|
||||
"marker-colors",
|
||||
"marker-levels",
|
||||
"marker-message",
|
||||
"marker-names",
|
||||
"marker-types",
|
||||
"printer-is-accepting-jobs",
|
||||
"printer-state",
|
||||
"printer-state-message",
|
||||
@@ -521,8 +528,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
|
||||
if (argc == 6 || strcmp(filename, argv[6]))
|
||||
unlink(filename);
|
||||
if (tmpfilename[0])
|
||||
unlink(tmpfilename);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
@@ -579,8 +586,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
if (job_cancelled)
|
||||
{
|
||||
if (argc == 6 || strcmp(filename, argv[6]))
|
||||
unlink(filename);
|
||||
if (tmpfilename[0])
|
||||
unlink(tmpfilename);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
@@ -765,8 +772,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
ippDelete(supported);
|
||||
httpClose(http);
|
||||
|
||||
if (argc == 6 || strcmp(filename, argv[6]))
|
||||
unlink(filename);
|
||||
if (tmpfilename[0])
|
||||
unlink(tmpfilename);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
@@ -865,12 +872,13 @@ main(int argc, /* I - Number of command-line args */
|
||||
num_options = cupsParseOptions(argv[5], 0, &options);
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (!strcasecmp(content_type, "application/pictwps") && num_files == 1)
|
||||
if (!strcasecmp(final_content_type, "application/pictwps") &&
|
||||
num_files == 1)
|
||||
{
|
||||
if (format_sup != NULL)
|
||||
{
|
||||
for (i = 0; i < format_sup->num_values; i ++)
|
||||
if (!strcasecmp(content_type, format_sup->values[i].string.text))
|
||||
if (!strcasecmp(final_content_type, format_sup->values[i].string.text))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -881,10 +889,18 @@ main(int argc, /* I - Number of command-line args */
|
||||
* so convert the document to PostScript...
|
||||
*/
|
||||
|
||||
if (run_pictwps_filter(argv, filename))
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
if (run_pictwps_filter(argv, files[0]))
|
||||
{
|
||||
if (pstmpname[0])
|
||||
unlink(pstmpname);
|
||||
|
||||
filename = pstmpname;
|
||||
if (tmpfilename[0])
|
||||
unlink(tmpfilename);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
files[0] = pstmpname;
|
||||
|
||||
/*
|
||||
* Change the MIME type to application/postscript and change the
|
||||
@@ -1279,6 +1295,11 @@ check_printer_state(
|
||||
*response; /* IPP response */
|
||||
static const char * const attrs[] = /* Attributes we want */
|
||||
{
|
||||
"marker-colors",
|
||||
"marker-levels",
|
||||
"marker-message",
|
||||
"marker-names",
|
||||
"marker-types",
|
||||
"printer-state-message",
|
||||
"printer-state-reasons"
|
||||
};
|
||||
@@ -1401,7 +1422,7 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
|
||||
{
|
||||
(void)prompt;
|
||||
|
||||
if (password && password_tries < 3)
|
||||
if (password && *password && password_tries < 3)
|
||||
{
|
||||
password_tries ++;
|
||||
|
||||
@@ -1431,6 +1452,74 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'report_attr()' - Report an IPP attribute value.
|
||||
*/
|
||||
|
||||
static void
|
||||
report_attr(ipp_attribute_t *attr) /* I - Attribute */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char value[1024], /* Value string */
|
||||
*valptr, /* Pointer into value string */
|
||||
*attrptr; /* Pointer into attribute value */
|
||||
|
||||
|
||||
/*
|
||||
* Convert the attribute values into quoted strings...
|
||||
*/
|
||||
|
||||
for (i = 0, valptr = value;
|
||||
i < attr->num_values && valptr < (value + sizeof(value) - 10);
|
||||
i ++)
|
||||
{
|
||||
if (i > 0)
|
||||
*valptr++ = ',';
|
||||
|
||||
switch (attr->value_tag)
|
||||
{
|
||||
case IPP_TAG_INTEGER :
|
||||
case IPP_TAG_ENUM :
|
||||
snprintf(valptr, sizeof(value) - (valptr - value), "%d",
|
||||
attr->values[i].integer);
|
||||
valptr += strlen(valptr);
|
||||
break;
|
||||
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
*valptr++ = '\"';
|
||||
for (attrptr = attr->values[i].string.text;
|
||||
*attrptr && valptr < (value + sizeof(value) - 10);
|
||||
attrptr ++)
|
||||
{
|
||||
if (*attrptr == '\\' || *attrptr == '\"')
|
||||
*valptr++ = '\\';
|
||||
|
||||
*valptr++ = *attrptr;
|
||||
}
|
||||
*valptr++ = '\"';
|
||||
break;
|
||||
|
||||
default :
|
||||
/*
|
||||
* Unsupported value type...
|
||||
*/
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*valptr = '\0';
|
||||
|
||||
/*
|
||||
* Tell the scheduler about the new values...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "ATTR: %s=%s\n", attr->name, value);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'report_printer_state()' - Report the printer state.
|
||||
*/
|
||||
@@ -1441,8 +1530,9 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int count; /* Count of reasons shown... */
|
||||
ipp_attribute_t *psm, /* pritner-state-message */
|
||||
*reasons; /* printer-state-reasons */
|
||||
ipp_attribute_t *psm, /* printer-state-message */
|
||||
*reasons, /* printer-state-reasons */
|
||||
*marker; /* marker-* attributes */
|
||||
const char *reason; /* Current reason */
|
||||
const char *message; /* Message to show */
|
||||
char unknown[1024]; /* Unknown message string */
|
||||
@@ -1549,6 +1639,22 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
|
||||
fprintf(stderr, "%s\n", state);
|
||||
|
||||
/*
|
||||
* Relay the current marker-* attribute values...
|
||||
*/
|
||||
|
||||
if ((marker = ippFindAttribute(ipp, "marker-colors", IPP_TAG_NAME)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-levels",
|
||||
IPP_TAG_INTEGER)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-message", IPP_TAG_TEXT)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-names", IPP_TAG_NAME)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-types", IPP_TAG_KEYWORD)) != NULL)
|
||||
report_attr(marker);
|
||||
|
||||
return (count);
|
||||
}
|
||||
|
||||
@@ -1680,7 +1786,6 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to fork pictwpstops: %s\n"),
|
||||
strerror(errno));
|
||||
unlink(filename);
|
||||
if (ppdfile)
|
||||
unlink(ppdfile);
|
||||
return (-1);
|
||||
@@ -1695,7 +1800,6 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to wait for pictwpstops: %s\n"),
|
||||
strerror(errno));
|
||||
close(fd);
|
||||
unlink(filename);
|
||||
if (ppdfile)
|
||||
unlink(ppdfile);
|
||||
return (-1);
|
||||
@@ -1715,7 +1819,6 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
_cupsLangPrintf(stderr, _("ERROR: pictwpstops exited on signal %d!\n"),
|
||||
status);
|
||||
|
||||
unlink(filename);
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -445,8 +445,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
unlink(tmpfilename);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
filename = tmpfilename;
|
||||
}
|
||||
else if (argc == 6)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* © Copyright 2004 Apple Computer, Inc. All rights reserved.
|
||||
* Copyright 2004-2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* IMPORTANT: This Apple software is supplied to you by Apple Computer,
|
||||
* Inc. ("Apple") in consideration of your agreement to the following
|
||||
@@ -70,6 +70,16 @@
|
||||
* signalHandler() - handle SIGINT to close the session before quiting.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This backend uses deprecated APIs for AppleTalk; we know this, so
|
||||
* silence any warnings about it...
|
||||
*/
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
# undef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
#endif /* MAX_OS_X_VERSION_MIN_REQUIRED */
|
||||
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_0
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -85,17 +95,17 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include <cups/cups.h>
|
||||
#include <cups/backend.h>
|
||||
#include <cups/sidechannel.h>
|
||||
#include <cups/i18n.h>
|
||||
|
||||
#include <netat/appletalk.h>
|
||||
#include <netat/atp.h>
|
||||
#include <netat/ddp.h>
|
||||
#include <netat/nbp.h>
|
||||
#include <netat/pap.h>
|
||||
|
||||
#include <cups/cups.h>
|
||||
#include <cups/backend.h>
|
||||
#include <cups/sidechannel.h>
|
||||
#include <cups/i18n.h>
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
#ifdef HAVE_APPLETALK_AT_PROTO_H
|
||||
@@ -270,7 +280,6 @@ int main (int argc, const char * argv[])
|
||||
*/
|
||||
static int listDevices(void)
|
||||
{
|
||||
int err = noErr;
|
||||
int i;
|
||||
int numberFound;
|
||||
|
||||
@@ -290,7 +299,7 @@ static int listDevices(void)
|
||||
return -1; /* Network is down */
|
||||
}
|
||||
|
||||
if ((err = zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone)) != 0)
|
||||
if (zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone))
|
||||
{
|
||||
perror("ERROR: Unable to get default AppleTalk zone");
|
||||
return -2;
|
||||
@@ -399,14 +408,13 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
at_inet_t sendDataAddr;
|
||||
at_inet_t src;
|
||||
at_resp_t resp;
|
||||
int userdata, xo, reqlen;
|
||||
int userdata, xo = 0, reqlen;
|
||||
u_short tid;
|
||||
u_char bitmap;
|
||||
int maxfdp1,
|
||||
nbp_failures = 0;
|
||||
struct timeval timeout, *timeoutPtr;
|
||||
u_char flowQuantum = 1;
|
||||
u_short recvSequence = 0;
|
||||
time_t now,
|
||||
start_time,
|
||||
elasped_time,
|
||||
@@ -718,7 +726,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
case AT_PAP_TYPE_SEND_DATA: /* Send-Data packet */
|
||||
sendDataAddr.socket = src.socket;
|
||||
gSendDataID = tid;
|
||||
recvSequence = OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
|
||||
OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
|
||||
|
||||
if ((fileBufferNbytes > 0 || fileEOFRead) && fileEOFSent == false)
|
||||
{
|
||||
@@ -896,8 +904,7 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
|
||||
{
|
||||
int result,
|
||||
open_result,
|
||||
userdata,
|
||||
atp_err;
|
||||
userdata;
|
||||
time_t tm,
|
||||
waitTime;
|
||||
char data[10],
|
||||
@@ -946,8 +953,8 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
|
||||
|
||||
fprintf(stderr, "DEBUG: -> %s\n", packet_name(AT_PAP_TYPE_OPEN_CONN));
|
||||
|
||||
if ((atp_err = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
|
||||
0, &resp, &retry, 0)) < 0)
|
||||
if (atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
|
||||
0, &resp, &retry, 0) < 0)
|
||||
{
|
||||
statusUpdate("Destination unreachable", 23);
|
||||
result = EHOSTUNREACH;
|
||||
@@ -1014,7 +1021,6 @@ static int papClose()
|
||||
{
|
||||
int fd;
|
||||
u_short tmpID;
|
||||
int result;
|
||||
unsigned char rdata[ATP_DATA_SIZE];
|
||||
int userdata;
|
||||
u_char *puserdata = (u_char *)&userdata;
|
||||
@@ -1067,9 +1073,9 @@ static int papClose()
|
||||
resp.resp[0].iov_base = rdata;
|
||||
resp.resp[0].iov_len = sizeof(rdata);
|
||||
|
||||
result = atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
|
||||
atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
|
||||
|
||||
result = close(fd);
|
||||
close(fd);
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Common run loop APIs for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -212,11 +212,11 @@ backendRunLoop(
|
||||
FD_SET(print_fd, &input);
|
||||
if (use_bc)
|
||||
FD_SET(device_fd, &input);
|
||||
if (side_cb)
|
||||
if (!print_bytes && side_cb)
|
||||
FD_SET(CUPS_SC_FD, &input);
|
||||
|
||||
FD_ZERO(&output);
|
||||
if (print_bytes || !use_bc)
|
||||
if (print_bytes || (!use_bc && !side_cb))
|
||||
FD_SET(device_fd, &output);
|
||||
|
||||
if (use_bc || side_cb)
|
||||
@@ -250,7 +250,15 @@ backendRunLoop(
|
||||
*/
|
||||
|
||||
if (side_cb && FD_ISSET(CUPS_SC_FD, &input))
|
||||
{
|
||||
/*
|
||||
* Do the side-channel request, then start back over in the select
|
||||
* loop since it may have read from print_fd...
|
||||
*/
|
||||
|
||||
(*side_cb)(print_fd, device_fd, use_bc);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we have back-channel data ready...
|
||||
|
||||
@@ -556,7 +556,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
if (!print_bytes)
|
||||
FD_SET(print_fd, &input);
|
||||
FD_SET(device_fd, &input);
|
||||
FD_SET(CUPS_SC_FD, &input);
|
||||
if (!print_bytes)
|
||||
FD_SET(CUPS_SC_FD, &input);
|
||||
|
||||
FD_ZERO(&output);
|
||||
if (print_bytes)
|
||||
@@ -570,7 +571,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*/
|
||||
|
||||
if (FD_ISSET(CUPS_SC_FD, &input))
|
||||
{
|
||||
/*
|
||||
* Do the side-channel request, then start back over in the select
|
||||
* loop since it may have read from print_fd...
|
||||
*/
|
||||
|
||||
side_cb(print_fd, device_fd, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we have back-channel data ready...
|
||||
|
||||
@@ -1090,7 +1090,7 @@ asn1_get_string(
|
||||
* String is larger than the buffer...
|
||||
*/
|
||||
|
||||
memcpy(string, buffer, strsize - 1);
|
||||
memcpy(string, *buffer, strsize - 1);
|
||||
string[strsize - 1] = '\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Copyright � 2005-2007 Apple Inc. All rights reserved.
|
||||
* Copyright 2005-2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* IMPORTANT: This Apple software is supplied to you by Apple Computer,
|
||||
* Inc. ("Apple") in consideration of your agreement to the following
|
||||
@@ -83,6 +83,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <libgen.h>
|
||||
#include <mach/mach.h>
|
||||
@@ -91,6 +92,7 @@
|
||||
#include <cups/debug.h>
|
||||
#include <cups/sidechannel.h>
|
||||
#include <cups/i18n.h>
|
||||
#include "backend-private.h"
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/usb/IOUSBLib.h>
|
||||
@@ -314,7 +316,8 @@ print_device(const char *uri, /* I - Device URI */
|
||||
OSStatus status; /* Function results */
|
||||
pthread_t read_thread_id, /* Read thread */
|
||||
sidechannel_thread_id;/* Side-channel thread */
|
||||
int sidechannel_started = 0;/* Was the side-channel thread started? */
|
||||
int have_sidechannel = 0; /* Was the side-channel thread started? */
|
||||
struct stat sidechannel_info; /* Side-channel file descriptor info */
|
||||
char print_buffer[8192], /* Print data buffer */
|
||||
*print_ptr; /* Pointer into print data buffer */
|
||||
UInt32 location; /* Unique location in bus topology */
|
||||
@@ -329,6 +332,17 @@ print_device(const char *uri, /* I - Device URI */
|
||||
struct timespec cond_timeout; /* pthread condition timeout */
|
||||
|
||||
|
||||
/*
|
||||
* See if the side-channel descriptor is valid...
|
||||
*/
|
||||
|
||||
have_sidechannel = !fstat(CUPS_SC_FD, &sidechannel_info) &&
|
||||
S_ISSOCK(sidechannel_info.st_mode);
|
||||
|
||||
/*
|
||||
* Localize using CoreFoundation...
|
||||
*/
|
||||
|
||||
setup_cfLanguage();
|
||||
|
||||
parse_options(options, serial, sizeof(serial), &location, &g.wait_eof);
|
||||
@@ -442,21 +456,14 @@ print_device(const char *uri, /* I - Device URI */
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the side channel thread only if the descriptor is valid
|
||||
* (i.e. it's not when the backend is used for auto-setup)...
|
||||
* Start the side channel thread if the descriptor is valid...
|
||||
*/
|
||||
|
||||
pthread_mutex_init(&g.readwrite_lock_mutex, NULL);
|
||||
pthread_cond_init(&g.readwrite_lock_cond, NULL);
|
||||
g.readwrite_lock = 1;
|
||||
|
||||
FD_ZERO(&input_set);
|
||||
FD_SET(CUPS_SC_FD, &input_set);
|
||||
|
||||
stimeout.tv_sec = 0;
|
||||
stimeout.tv_usec = 0;
|
||||
|
||||
if ((select(CUPS_SC_FD+1, &input_set, NULL, NULL, &stimeout)) >= 0)
|
||||
if (have_sidechannel)
|
||||
{
|
||||
g.sidechannel_thread_stop = 0;
|
||||
g.sidechannel_thread_done = 0;
|
||||
@@ -469,8 +476,6 @@ print_device(const char *uri, /* I - Device URI */
|
||||
_cupsLangPuts(stderr, _("WARNING: Couldn't create side channel\n"));
|
||||
return CUPS_BACKEND_STOP;
|
||||
}
|
||||
|
||||
sidechannel_started = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -669,7 +674,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
* Wait for the side channel thread to exit...
|
||||
*/
|
||||
|
||||
if (sidechannel_started)
|
||||
if (have_sidechannel)
|
||||
{
|
||||
close(CUPS_SC_FD);
|
||||
pthread_mutex_lock(&g.readwrite_lock_mutex);
|
||||
@@ -1004,25 +1009,21 @@ static Boolean list_device_cb(void *refcon,
|
||||
{
|
||||
CFStringRef make = NULL, model = NULL, serial = NULL;
|
||||
char uristr[1024], makestr[1024], modelstr[1024], serialstr[1024];
|
||||
char optionsstr[1024], idstr[1024];
|
||||
char optionsstr[1024], idstr[1024], make_modelstr[1024];
|
||||
|
||||
copy_deviceinfo(deviceIDString, &make, &model, &serial);
|
||||
CFStringGetCString(deviceIDString, idstr, sizeof(idstr),
|
||||
kCFStringEncodingUTF8);
|
||||
backendGetMakeModel(idstr, make_modelstr, sizeof(make_modelstr));
|
||||
|
||||
modelstr[0] = '/';
|
||||
|
||||
CFStringGetCString(deviceIDString, idstr, sizeof(idstr),
|
||||
kCFStringEncodingUTF8);
|
||||
|
||||
if (make)
|
||||
CFStringGetCString(make, makestr, sizeof(makestr),
|
||||
kCFStringEncodingUTF8);
|
||||
else
|
||||
if (!CFStringGetCString(make, makestr, sizeof(makestr),
|
||||
kCFStringEncodingUTF8))
|
||||
strcpy(makestr, "Unknown");
|
||||
|
||||
if (model)
|
||||
CFStringGetCString(model, &modelstr[1], sizeof(modelstr)-1,
|
||||
kCFStringEncodingUTF8);
|
||||
else
|
||||
if (!CFStringGetCString(model, &modelstr[1], sizeof(modelstr)-1,
|
||||
kCFStringEncodingUTF8))
|
||||
strcpy(modelstr + 1, "Printer");
|
||||
|
||||
optionsstr[0] = '\0';
|
||||
@@ -1037,18 +1038,8 @@ static Boolean list_device_cb(void *refcon,
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, uristr, sizeof(uristr), "usb", NULL, makestr, 0, modelstr);
|
||||
strncat(uristr, optionsstr, sizeof(uristr));
|
||||
|
||||
/*
|
||||
* Fix common HP 1284 bug...
|
||||
*/
|
||||
|
||||
if (!strcasecmp(makestr, "Hewlett-Packard"))
|
||||
strcpy(makestr, "HP");
|
||||
|
||||
if (!strncasecmp(modelstr + 1, "hp ", 3))
|
||||
_cups_strcpy(modelstr + 1, modelstr + 4);
|
||||
|
||||
printf("direct %s \"%s %s\" \"%s %s USB\" \"%s\"\n", uristr, makestr,
|
||||
&modelstr[1], makestr, &modelstr[1], idstr);
|
||||
printf("direct %s \"%s\" \"%s USB\" \"%s\"\n", uristr, make_modelstr,
|
||||
make_modelstr, idstr);
|
||||
|
||||
release_deviceinfo(&make, &model, &serial);
|
||||
CFRelease(deviceIDString);
|
||||
@@ -1184,9 +1175,19 @@ static void copy_deviceinfo(CFStringRef deviceIDString,
|
||||
CFStringRef serialKeys[] = { CFSTR("SN:"), CFSTR("SERN:"), NULL };
|
||||
|
||||
if (make != NULL)
|
||||
*make = copy_value_for_key(deviceIDString, makeKeys);
|
||||
{
|
||||
if ((*make = copy_value_for_key(deviceIDString, makeKeys)) == NULL)
|
||||
*make = CFStringCreateWithCString(kCFAllocatorDefault, "Unknown",
|
||||
kCFStringEncodingUTF8);
|
||||
}
|
||||
|
||||
if (model != NULL)
|
||||
*model = copy_value_for_key(deviceIDString, modelKeys);
|
||||
{
|
||||
if ((*model = copy_value_for_key(deviceIDString, modelKeys)) == NULL)
|
||||
*model = CFStringCreateWithCString(kCFAllocatorDefault, "Printer",
|
||||
kCFStringEncodingUTF8);
|
||||
}
|
||||
|
||||
if (serial != NULL)
|
||||
*serial = copy_value_for_key(deviceIDString, serialKeys);
|
||||
}
|
||||
@@ -1679,7 +1680,7 @@ static void parse_options(char *options,
|
||||
|
||||
/*!
|
||||
* @function setup_cfLanguage
|
||||
* @abstract Convert the contents of the CUPS 'LANG' environment
|
||||
* @abstract Convert the contents of the CUPS 'APPLE_LANGUAGE' environment
|
||||
* variable into a one element CF array of languages.
|
||||
*
|
||||
* @discussion Each submitted job comes with a natural language. CUPS passes
|
||||
@@ -1695,7 +1696,9 @@ static void setup_cfLanguage(void)
|
||||
CFArrayRef langArray = NULL;
|
||||
const char *requestedLang = NULL;
|
||||
|
||||
requestedLang = getenv("LANG");
|
||||
if ((requestedLang = getenv("APPLE_LANGUAGE")) == NULL)
|
||||
requestedLang = getenv("LANG");
|
||||
|
||||
if (requestedLang != NULL)
|
||||
{
|
||||
lang[0] = CFStringCreateWithCString(kCFAllocatorDefault, requestedLang, kCFStringEncodingUTF8);
|
||||
@@ -1708,7 +1711,7 @@ static void setup_cfLanguage(void)
|
||||
CFRelease(langArray);
|
||||
}
|
||||
else
|
||||
fputs("DEBUG: usb: LANG environment variable missing.\n", stderr);
|
||||
fputs("DEBUG: usb: LANG and APPLE_LANGUAGE environment variables missing.\n", stderr);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@@ -414,11 +414,10 @@ open_device(const char *uri, /* I - Device URI */
|
||||
*/
|
||||
|
||||
if (busy)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 5 seconds...\n"));
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
@@ -516,7 +515,7 @@ open_device(const char *uri, /* I - Device URI */
|
||||
}
|
||||
#else
|
||||
{
|
||||
if (use_bc)
|
||||
if (*use_bc)
|
||||
fd = open(uri + 4, O_RDWR | O_EXCL);
|
||||
else
|
||||
fd = -1;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* "lpr" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -420,8 +420,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
else
|
||||
{
|
||||
num_files = 1;
|
||||
|
||||
#ifndef WIN32
|
||||
# if defined(HAVE_SIGSET)
|
||||
sigset(SIGHUP, sighandler);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Administration CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -308,6 +308,16 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure we have a username...
|
||||
*/
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate the subscription name...
|
||||
*/
|
||||
@@ -352,9 +362,6 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, printer_uri);
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, user);
|
||||
|
||||
@@ -897,7 +904,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
cgiCopyTemplateLang("choose-serial.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
else if (!file && (var = cgiGetVariable("PPD_NAME")) == NULL)
|
||||
else if (!file && !cgiGetVariable("PPD_NAME"))
|
||||
{
|
||||
if (modify)
|
||||
{
|
||||
@@ -1268,6 +1275,16 @@ do_cancel_subscription(http_t *http)/* I - HTTP connection */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Require a username...
|
||||
*/
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cancel the subscription...
|
||||
*/
|
||||
@@ -1279,9 +1296,6 @@ do_cancel_subscription(http_t *http)/* I - HTTP connection */
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER,
|
||||
"notify-subscription-id", id);
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, user);
|
||||
|
||||
@@ -1333,12 +1347,12 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
*remote_printers,
|
||||
/* REMOTE_PRINTERS value */
|
||||
*share_printers,/* SHARE_PRINTERS value */
|
||||
#ifdef HAVE_GSSAPI
|
||||
*default_auth_type,
|
||||
/* DefaultAuthType value */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
*user_cancel_any;
|
||||
/* USER_CANCEL_ANY value */
|
||||
#ifdef HAVE_GSSAPI
|
||||
char default_auth_type[255];
|
||||
/* DefaultAuthType value */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
|
||||
/*
|
||||
@@ -1373,13 +1387,16 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
*/
|
||||
|
||||
if (cgiGetVariable("KERBEROS"))
|
||||
default_auth_type = "Negotiate";
|
||||
strlcpy(default_auth_type, "Negotiate", sizeof(default_auth_type));
|
||||
else
|
||||
{
|
||||
default_auth_type = cupsGetOption("DefaultAuthType", num_settings,
|
||||
settings);
|
||||
if (!strcasecmp(default_auth_type, "Negotiate"))
|
||||
default_auth_type = "Basic";
|
||||
const char *val = cupsGetOption("DefaultAuthType", num_settings,
|
||||
settings);
|
||||
|
||||
if (val && !strcasecmp(val, "Negotiate"))
|
||||
strlcpy(default_auth_type, "Basic", sizeof(default_auth_type));
|
||||
else
|
||||
strlcpy(default_auth_type, val, sizeof(default_auth_type));
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: DefaultAuthType %s\n", default_auth_type);
|
||||
@@ -1647,14 +1664,15 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
* Allocate memory and load the file into a string buffer...
|
||||
*/
|
||||
|
||||
buffer = calloc(1, info.st_size + 1);
|
||||
if ((buffer = calloc(1, info.st_size + 1)) != NULL)
|
||||
{
|
||||
cupsFileRead(cupsd, buffer, info.st_size);
|
||||
cgiSetVariable("CUPSDCONF", buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
cupsFileRead(cupsd, buffer, info.st_size);
|
||||
cupsFileClose(cupsd);
|
||||
|
||||
cgiSetVariable("CUPSDCONF", buffer);
|
||||
free(buffer);
|
||||
|
||||
/*
|
||||
* Then get the default cupsd.conf file and put that into a string as
|
||||
* well...
|
||||
@@ -1665,37 +1683,39 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
if (!stat(filename, &info) && info.st_size < (1024 * 1024) &&
|
||||
(cupsd = cupsFileOpen(filename, "r")) != NULL)
|
||||
{
|
||||
buffer = calloc(1, 2 * info.st_size + 1);
|
||||
bufend = buffer + 2 * info.st_size - 1;
|
||||
|
||||
for (bufptr = buffer;
|
||||
bufptr < bufend && (ch = cupsFileGetChar(cupsd)) != EOF;)
|
||||
if ((buffer = calloc(1, 2 * info.st_size + 1)) != NULL)
|
||||
{
|
||||
if (ch == '\\' || ch == '\"')
|
||||
bufend = buffer + 2 * info.st_size - 1;
|
||||
|
||||
for (bufptr = buffer;
|
||||
bufptr < bufend && (ch = cupsFileGetChar(cupsd)) != EOF;)
|
||||
{
|
||||
*bufptr++ = '\\';
|
||||
*bufptr++ = ch;
|
||||
if (ch == '\\' || ch == '\"')
|
||||
{
|
||||
*bufptr++ = '\\';
|
||||
*bufptr++ = ch;
|
||||
}
|
||||
else if (ch == '\n')
|
||||
{
|
||||
*bufptr++ = '\\';
|
||||
*bufptr++ = 'n';
|
||||
}
|
||||
else if (ch == '\t')
|
||||
{
|
||||
*bufptr++ = '\\';
|
||||
*bufptr++ = 't';
|
||||
}
|
||||
else if (ch >= ' ')
|
||||
*bufptr++ = ch;
|
||||
}
|
||||
else if (ch == '\n')
|
||||
{
|
||||
*bufptr++ = '\\';
|
||||
*bufptr++ = 'n';
|
||||
}
|
||||
else if (ch == '\t')
|
||||
{
|
||||
*bufptr++ = '\\';
|
||||
*bufptr++ = 't';
|
||||
}
|
||||
else if (ch >= ' ')
|
||||
*bufptr++ = ch;
|
||||
|
||||
*bufptr = '\0';
|
||||
|
||||
cgiSetVariable("CUPSDCONF_DEFAULT", buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
*bufptr = '\0';
|
||||
|
||||
cupsFileClose(cupsd);
|
||||
|
||||
cgiSetVariable("CUPSDCONF_DEFAULT", buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2992,15 +3012,15 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
|
||||
cgiSetVariable("KEYWORD", "job_sheets_start");
|
||||
cgiSetVariable("KEYTEXT", cgiText(_("Starting Banner")));
|
||||
cgiSetVariable("DEFCHOICE", attr == NULL ?
|
||||
"" : attr->values[0].string.text);
|
||||
cgiSetVariable("DEFCHOICE", attr != NULL ?
|
||||
attr->values[0].string.text : "");
|
||||
|
||||
cgiCopyTemplateLang("option-pickone.tmpl");
|
||||
|
||||
cgiSetVariable("KEYWORD", "job_sheets_end");
|
||||
cgiSetVariable("KEYTEXT", cgiText(_("Ending Banner")));
|
||||
cgiSetVariable("DEFCHOICE", attr == NULL && attr->num_values > 1 ?
|
||||
"" : attr->values[1].string.text);
|
||||
cgiSetVariable("DEFCHOICE", attr != NULL && attr->num_values > 1 ?
|
||||
attr->values[1].string.text : "");
|
||||
|
||||
cgiCopyTemplateLang("option-pickone.tmpl");
|
||||
|
||||
@@ -3084,7 +3104,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
* Binary protocol support...
|
||||
*/
|
||||
|
||||
if (ppd->protocols && strstr(ppd->protocols, "BCP"))
|
||||
if (ppd && ppd->protocols && strstr(ppd->protocols, "BCP"))
|
||||
{
|
||||
protocol = ppdFindAttr(ppd, "cupsProtocol", NULL);
|
||||
|
||||
@@ -3187,7 +3207,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
}
|
||||
|
||||
if ((var = cgiGetVariable("protocol")) != NULL)
|
||||
cupsFilePrintf(out, "*cupsProtocol: %s\n", cgiGetVariable("protocol"));
|
||||
cupsFilePrintf(out, "*cupsProtocol: %s\n", var);
|
||||
|
||||
cupsFileClose(in);
|
||||
cupsFileClose(out);
|
||||
@@ -3226,12 +3246,12 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
attr->values[1].string.text = _cupsStrAlloc(cgiGetVariable("job_sheets_end"));
|
||||
|
||||
if ((var = cgiGetVariable("printer_error_policy")) != NULL)
|
||||
attr = ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
||||
"printer-error-policy", NULL, var);
|
||||
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
||||
"printer-error-policy", NULL, var);
|
||||
|
||||
if ((var = cgiGetVariable("printer_op_policy")) != NULL)
|
||||
attr = ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
||||
"printer-op-policy", NULL, var);
|
||||
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
||||
"printer-op-policy", NULL, var);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -158,6 +158,8 @@ cgiGetAttributes(ipp_t *request, /* I - IPP request */
|
||||
for (i = 0; i < num_attrs; i ++)
|
||||
free(attrs[i]);
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
|
||||
@@ -472,10 +474,16 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
|
||||
|
||||
if (cupsLastError() <= IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiRewriteURL(job_printer_uri, resource, sizeof(resource), NULL);
|
||||
cgiFormEncode(uri, resource, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
const char *path = strstr(job_printer_uri, "/printers/");
|
||||
if (!path)
|
||||
path = strstr(job_printer_uri, "/classes/");
|
||||
|
||||
if (path)
|
||||
{
|
||||
cgiFormEncode(uri, path, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
}
|
||||
}
|
||||
|
||||
if (job_id)
|
||||
@@ -523,8 +531,7 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
|
||||
* See who is logged in...
|
||||
*/
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
user = getenv("REMOTE_USER");
|
||||
|
||||
/*
|
||||
* Locate the test page file...
|
||||
@@ -562,8 +569,9 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
if (user)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
|
||||
NULL, "Test Page");
|
||||
@@ -593,6 +601,11 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
|
||||
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
}
|
||||
else if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
cgiStartHTML(cgiText(_("Print Test Page")));
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Job status CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -185,6 +185,11 @@ do_job_op(http_t *http, /* I - HTTP connection */
|
||||
cgiFormEncode(url + 6, getenv("HTTP_REFERER"), sizeof(url) - 6);
|
||||
cgiSetVariable("refresh_page", url);
|
||||
}
|
||||
else if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Printer status CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -280,6 +280,11 @@ print_command(http_t *http, /* I - Connection to server */
|
||||
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
}
|
||||
else if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
cgiStartHTML(cgiText(_("Printer Maintenance")));
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Search routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -53,7 +53,8 @@ cgiCompileSearch(const char *query) /* I - Query string */
|
||||
* Allocate a regular expression storage structure...
|
||||
*/
|
||||
|
||||
re = (regex_t *)calloc(1, sizeof(regex_t));
|
||||
if ((re = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Allocate a buffer to hold the regular expression string, starting
|
||||
@@ -65,7 +66,11 @@ cgiCompileSearch(const char *query) /* I - Query string */
|
||||
if (slen < 1024)
|
||||
slen = 1024;
|
||||
|
||||
s = (char *)malloc(slen);
|
||||
if ((s = (char *)malloc(slen)) == NULL)
|
||||
{
|
||||
free(re);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the query string to the regular expression, handling basic
|
||||
@@ -162,7 +167,9 @@ cgiCompileSearch(const char *query) /* I - Query string */
|
||||
* string + RE overhead...
|
||||
*/
|
||||
|
||||
wlen = (sptr - s) + 4 * wlen + 2 * strlen(prefix) + 4;
|
||||
wlen = (sptr - s) + 2 * 4 * wlen + 2 * strlen(prefix) + 11;
|
||||
if (lword)
|
||||
wlen += strlen(lword);
|
||||
|
||||
if (wlen > slen)
|
||||
{
|
||||
@@ -227,7 +234,13 @@ cgiCompileSearch(const char *query) /* I - Query string */
|
||||
char *lword2; /* New "last word" */
|
||||
|
||||
|
||||
lword2 = strdup(sword);
|
||||
if ((lword2 = strdup(sword)) == NULL)
|
||||
{
|
||||
free(lword);
|
||||
free(s);
|
||||
free(re);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
strcpy(sptr, ".*|.*");
|
||||
sptr += 5;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* CGI template function.
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -53,6 +53,13 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
|
||||
fprintf(stderr, "DEBUG2: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
|
||||
tmpl ? tmpl : "(null)");
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!tmpl || !out)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Open the template file...
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* CGI form variable and array functions.
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -322,9 +322,15 @@ cgiSetArray(const char *name, /* I - Name of variable */
|
||||
{
|
||||
if (element >= var->avalues)
|
||||
{
|
||||
const char **temp; /* Temporary pointer */
|
||||
|
||||
temp = (const char **)realloc((void *)(var->values),
|
||||
sizeof(char *) * (element + 16));
|
||||
if (!temp)
|
||||
return;
|
||||
|
||||
var->avalues = element + 16;
|
||||
var->values = (const char **)realloc((void *)(var->values),
|
||||
sizeof(char *) * var->avalues);
|
||||
var->values = temp;
|
||||
}
|
||||
|
||||
if (element >= var->nvalues)
|
||||
@@ -362,9 +368,15 @@ cgiSetSize(const char *name, /* I - Name of variable */
|
||||
|
||||
if (size >= var->avalues)
|
||||
{
|
||||
const char **temp; /* Temporary pointer */
|
||||
|
||||
temp = (const char **)realloc((void *)(var->values),
|
||||
sizeof(char *) * (size + 16));
|
||||
if (!temp)
|
||||
return;
|
||||
|
||||
var->avalues = size + 16;
|
||||
var->values = (const char **)realloc((void *)(var->values),
|
||||
sizeof(char *) * var->avalues);
|
||||
var->values = temp;
|
||||
}
|
||||
|
||||
if (size > var->nvalues)
|
||||
@@ -426,7 +438,7 @@ cgi_add_variable(const char *name, /* I - Variable name */
|
||||
int element, /* I - Array element number */
|
||||
const char *value) /* I - Variable value */
|
||||
{
|
||||
_cgi_var_t *var; /* New variable */
|
||||
_cgi_var_t *var; /* New variable */
|
||||
|
||||
|
||||
if (name == NULL || value == NULL || element < 0 || element > 100000)
|
||||
@@ -438,19 +450,29 @@ cgi_add_variable(const char *name, /* I - Variable name */
|
||||
|
||||
if (form_count >= form_alloc)
|
||||
{
|
||||
if (form_alloc == 0)
|
||||
form_vars = malloc(sizeof(_cgi_var_t) * 16);
|
||||
else
|
||||
form_vars = realloc(form_vars, (form_alloc + 16) * sizeof(_cgi_var_t));
|
||||
_cgi_var_t *temp_vars; /* Temporary form pointer */
|
||||
|
||||
|
||||
if (form_alloc == 0)
|
||||
temp_vars = malloc(sizeof(_cgi_var_t) * 16);
|
||||
else
|
||||
temp_vars = realloc(form_vars, (form_alloc + 16) * sizeof(_cgi_var_t));
|
||||
|
||||
if (!temp_vars)
|
||||
return;
|
||||
|
||||
form_vars = temp_vars;
|
||||
form_alloc += 16;
|
||||
}
|
||||
|
||||
var = form_vars + form_count;
|
||||
var = form_vars + form_count;
|
||||
|
||||
if ((var->values = calloc(element + 1, sizeof(char *))) == NULL)
|
||||
return;
|
||||
|
||||
var->name = strdup(name);
|
||||
var->nvalues = element + 1;
|
||||
var->avalues = element + 1;
|
||||
var->values = calloc(element + 1, sizeof(char *));
|
||||
var->values[element] = strdup(value);
|
||||
|
||||
form_count ++;
|
||||
@@ -784,11 +806,15 @@ cgi_initialize_post(void)
|
||||
|
||||
for (tbytes = 0; tbytes < length; tbytes += nbytes)
|
||||
if ((nbytes = read(0, data + tbytes, length - tbytes)) < 0)
|
||||
{
|
||||
if (errno != EAGAIN)
|
||||
{
|
||||
free(data);
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
nbytes = 0;
|
||||
}
|
||||
|
||||
data[length] = '\0';
|
||||
|
||||
|
||||
@@ -29,14 +29,12 @@ DefaultAuthType Basic
|
||||
# Restrict access to the server...
|
||||
<Location />
|
||||
Order allow,deny
|
||||
Allow localhost
|
||||
</Location>
|
||||
|
||||
# Restrict access to the admin pages...
|
||||
<Location /admin>
|
||||
@ENCRYPTION_REQUIRED@
|
||||
Order allow,deny
|
||||
Allow localhost
|
||||
</Location>
|
||||
|
||||
# Restrict access to configuration files...
|
||||
@@ -44,7 +42,6 @@ DefaultAuthType Basic
|
||||
AuthType Default
|
||||
Require user @SYSTEM
|
||||
Order allow,deny
|
||||
Allow localhost
|
||||
</Location>
|
||||
|
||||
# Set the default printer/job policies...
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 7057 2007-11-01 23:29:14Z mike $"
|
||||
dnl "$Id: cups-common.m4 7735 2008-07-14 21:25:26Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -19,12 +19,9 @@ AC_PREREQ(2.60)
|
||||
dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Versio number information...
|
||||
CUPS_VERSION="1.3.5"
|
||||
dnl Version number information...
|
||||
CUPS_VERSION="1.3.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)
|
||||
@@ -183,37 +180,66 @@ esac
|
||||
|
||||
AC_SUBST(ARFLAGS)
|
||||
|
||||
dnl Extra platform-specific libraries...
|
||||
dnl Prep libraries specifically for cupsd and backends...
|
||||
BACKLIBS=""
|
||||
CUPSDLIBS=""
|
||||
DBUSDIR=""
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
|
||||
CUPS_SYSTEM_AUTHKEY=""
|
||||
AC_SUBST(BACKLIBS)
|
||||
AC_SUBST(CUPSDLIBS)
|
||||
|
||||
dnl See if we have POSIX ACL support...
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS=""
|
||||
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
|
||||
CUPSDLIBS="$CUPSDLIBS $LIBS"
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
dnl Check for DBUS support
|
||||
if test -d /etc/dbus-1; then
|
||||
DBUSDIR="/etc/dbus-1"
|
||||
else
|
||||
DBUSDIR=""
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
|
||||
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
|
||||
DBUSDIR="$withval")
|
||||
|
||||
if test "x$enable_dbus" != xno; then
|
||||
AC_PATH_PROG(PKGCONFIG, pkg-config)
|
||||
if test "x$PKGCONFIG" != x; then
|
||||
AC_MSG_CHECKING(for DBUS)
|
||||
if $PKGCONFIG --exists dbus-1; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DBUS)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
|
||||
CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
|
||||
AC_CHECK_LIB(dbus-1,
|
||||
dbus_message_iter_init_append,
|
||||
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND),,
|
||||
`$PKGCONFIG --libs dbus-1`)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
DBUSDIR=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(DBUSDIR)
|
||||
|
||||
dnl Extra platform-specific libraries...
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
|
||||
CUPS_SYSTEM_AUTHKEY=""
|
||||
FONTS="fonts"
|
||||
AC_SUBST(FONTS)
|
||||
LEGACY_BACKENDS="parallel scsi"
|
||||
AC_SUBST(LEGACY_BACKENDS)
|
||||
|
||||
case $uname in
|
||||
Darwin*)
|
||||
FONTS=""
|
||||
LEGACY_BACKENDS=""
|
||||
BACKLIBS="-framework IOKit"
|
||||
CUPSDLIBS="-sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration"
|
||||
BACKLIBS="$BACKLIBS -framework IOKit"
|
||||
CUPSDLIBS="$CUPSDLIBS -sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration"
|
||||
LIBS="-framework CoreFoundation $LIBS"
|
||||
|
||||
dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString...
|
||||
AC_MSG_CHECKING(for CFLocaleCreateCanonicalLocaleIdentifierFromString)
|
||||
if test "$uname" = "Darwin" -a $uversion -ge 70; then
|
||||
AC_DEFINE(HAVE_CF_LOCALE_ID)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl Check for framework headers...
|
||||
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
|
||||
AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
|
||||
@@ -232,60 +258,41 @@ case $uname in
|
||||
AC_CHECK_FUNCS(notify_post)
|
||||
|
||||
dnl Check for Authorization Services support
|
||||
AC_ARG_WITH(adminkey, [ --with-adminkey set the default SystemAuthKey value],
|
||||
default_adminkey="$withval",
|
||||
default_adminkey="default")
|
||||
AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
|
||||
default_operkey="$withval",
|
||||
default_operkey="default")
|
||||
|
||||
AC_CHECK_HEADER(Security/Authorization.h, [
|
||||
AC_DEFINE(HAVE_AUTHORIZATION_H)
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"])
|
||||
|
||||
if test "x$default_adminkey" != xdefault; then
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
|
||||
elif grep -q system.print.operator /etc/authorization; then
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
|
||||
else
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
|
||||
fi
|
||||
|
||||
if test "x$default_operkey" != xdefault; then
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
|
||||
elif grep -q system.print.operator /etc/authorization; then
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
|
||||
else
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
|
||||
fi])
|
||||
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
|
||||
;;
|
||||
|
||||
Linux*)
|
||||
dnl Check for DBUS support
|
||||
if test "x$enable_dbus" != xno; then
|
||||
AC_PATH_PROG(PKGCONFIG, pkg-config)
|
||||
if test "x$PKGCONFIG" != x; then
|
||||
AC_MSG_CHECKING(for DBUS)
|
||||
if $PKGCONFIG --exists dbus-1; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DBUS)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
|
||||
CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
|
||||
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ], dbusdir="$withval", dbusdir="/etc/dbus-1")
|
||||
DBUSDIR="$dbusdir"
|
||||
AC_CHECK_LIB(dbus-1,
|
||||
dbus_message_iter_init_append,
|
||||
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
|
||||
AC_SUBST(CUPS_SYSTEM_AUTHKEY)
|
||||
|
||||
dnl See if we have POSIX ACL support...
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS=""
|
||||
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
|
||||
CUPSDLIBS="$CUPSDLIBS $LIBS"
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
AC_SUBST(BACKLIBS)
|
||||
AC_SUBST(CUPSDLIBS)
|
||||
AC_SUBST(DBUSDIR)
|
||||
|
||||
dnl New default port definition for IPP...
|
||||
AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
|
||||
DEFAULT_IPP_PORT="$withval",
|
||||
DEFAULT_IPP_PORT="631")
|
||||
|
||||
AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
AC_SUBST(FONTS)
|
||||
AC_SUBST(LEGACY_BACKENDS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 7057 2007-11-01 23:29:14Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 7735 2008-07-14 21:25:26Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-compiler.m4 6976 2007-09-18 20:39:31Z mike $"
|
||||
dnl "$Id: cups-compiler.m4 7648 2008-06-16 17:41:11Z mike $"
|
||||
dnl
|
||||
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -98,36 +98,61 @@ if test -n "$GCC"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate position-independent code as needed...
|
||||
if test $PICFLAG = 1 -a $uname != AIX; then
|
||||
OPTIM="-fPIC $OPTIM"
|
||||
fi
|
||||
|
||||
case $uname in
|
||||
Linux*)
|
||||
if test x$enable_pie = xyes; then
|
||||
PIEFLAGS="-pie -fPIE"
|
||||
fi
|
||||
# The -fstack-protector option is available with some versions of
|
||||
# GCC and adds "stack canaries" which detect when the return address
|
||||
# has been overwritten, preventing many types of exploit attacks.
|
||||
AC_MSG_CHECKING(if GCC supports -fstack-protector)
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fstack-protector"
|
||||
AC_TRY_COMPILE(,,
|
||||
OPTIM="$OPTIM -fstack-protector"
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no))
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
|
||||
if test x$enable_relro = xyes; then
|
||||
RELROFLAGS="-Wl,-z,relro"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test x$enable_pie = xyes; then
|
||||
echo "Sorry, --enable-pie is not supported on this OS!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# The -pie option is available with some versions of GCC and adds
|
||||
# randomization of addresses, which avoids another class of exploits
|
||||
# that depend on a fixed address for common functions.
|
||||
if test x$enable_pie = xyes; then
|
||||
AC_MSG_CHECKING(if GCC supports -pie)
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -pie -fPIE"
|
||||
AC_TRY_COMPILE(,,
|
||||
PIEFLAGS="-pie -fPIE"
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no, ignoring --enable-pie))
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
fi
|
||||
|
||||
if test "x$with_optim" = x; then
|
||||
# Add useful warning options for tracking down problems...
|
||||
OPTIM="-Wall -Wno-format-y2k $OPTIM"
|
||||
# Additional warning options for alpha testing...
|
||||
OPTIM="-Wshadow -Wunused $OPTIM"
|
||||
# Additional warning options for development testing...
|
||||
if test -d .svn; then
|
||||
OPTIM="-Wshadow -Wunused $OPTIM"
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# -D_FORTIFY_SOURCE=2 adds additional object size
|
||||
# checking, basically wrapping all string functions
|
||||
# with buffer-limited ones. Not strictly needed for
|
||||
# CUPS since we already use buffer-limited calls, but
|
||||
# this will catch any additions that are broken.
|
||||
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
|
||||
|
||||
if test x$enable_pie = xyes; then
|
||||
# GCC 4 on Mac OS X needs -Wl,-pie as well
|
||||
LDFLAGS="$LDFLAGS -Wl,-pie"
|
||||
fi
|
||||
;;
|
||||
|
||||
HP-UX*)
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
@@ -201,6 +226,12 @@ if test -n "$GCC"; then
|
||||
;;
|
||||
|
||||
Linux*)
|
||||
# The -z relro option is provided by the Linux linker command to
|
||||
# make relocatable data read-only.
|
||||
if test x$enable_relro = xyes; then
|
||||
RELROFLAGS="-Wl,-z,relro"
|
||||
fi
|
||||
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
if test -z "$with_arch32flags"; then
|
||||
@@ -468,8 +499,8 @@ else
|
||||
# cups-support@cups.org...
|
||||
echo "Building CUPS with default compiler optimizations; contact"
|
||||
echo "cups-bugs@cups.org with uname and compiler options needed"
|
||||
echo "for your platform, or set the CFLAGS and CXXFLAGS"
|
||||
echo "environment variable before running configure."
|
||||
echo "for your platform, or set the CFLAGS, CXXFLAGS, and LDFLAGS"
|
||||
echo "environment variables before running configure."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
@@ -490,6 +521,12 @@ case $uname in
|
||||
OPTIM="$OPTIM -D_HPUX_SOURCE"
|
||||
;;
|
||||
|
||||
Linux*)
|
||||
# glibc 2.8 and higher breaks peer credentials unless you
|
||||
# define _GNU_SOURCE...
|
||||
OPTIM="$OPTIM -D_GNU_SOURCE"
|
||||
;;
|
||||
|
||||
OSF*)
|
||||
# Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
|
||||
# to be POSIX-compliant...
|
||||
@@ -498,5 +535,5 @@ case $uname in
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-compiler.m4 6976 2007-09-18 20:39:31Z mike $".
|
||||
dnl End of "$Id: cups-compiler.m4 7648 2008-06-16 17:41:11Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
dnl
|
||||
dnl "$Id: cups-defaults.m4 6754 2007-08-01 19:00:07Z mike $"
|
||||
dnl "$Id: cups-defaults.m4 7448 2008-04-14 18:10:27Z mike $"
|
||||
dnl
|
||||
dnl Default cupsd configuration settings for the Common UNIX Printing System
|
||||
dnl (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 2006-2007 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -290,10 +290,10 @@ fi
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
|
||||
|
||||
dnl Default MaxCopies value...
|
||||
AC_ARG_WITH(max-copies, [ --with-max-copies set max copies value, default=100 ],
|
||||
AC_ARG_WITH(max-copies, [ --with-max-copies set default max copies value, default=auto ],
|
||||
CUPS_MAX_COPIES="$withval",
|
||||
if test "x$uname" = xDarwin; then
|
||||
CUPS_MAX_COPIES="999"
|
||||
CUPS_MAX_COPIES="9999"
|
||||
else
|
||||
CUPS_MAX_COPIES="100"
|
||||
fi)
|
||||
@@ -337,6 +337,14 @@ AC_ARG_WITH(snmp-community, [ --with-snmp-community set SNMP community, defau
|
||||
AC_SUBST(CUPS_SNMP_ADDRESS)
|
||||
AC_SUBST(CUPS_SNMP_COMMUNITY)
|
||||
|
||||
dnl New default port definition for IPP...
|
||||
AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
|
||||
DEFAULT_IPP_PORT="$withval",
|
||||
DEFAULT_IPP_PORT="631")
|
||||
|
||||
AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-defaults.m4 6754 2007-08-01 19:00:07Z mike $".
|
||||
dnl End of "$Id: cups-defaults.m4 7448 2008-04-14 18:10:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-network.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl "$Id: cups-network.m4 7140 2007-12-19 01:47:57Z mike $"
|
||||
dnl
|
||||
dnl Networking stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -29,24 +29,6 @@ fi
|
||||
AC_CHECK_MEMBER(struct sockaddr.sa_len,,, [#include <sys/socket.h>])
|
||||
AC_CHECK_HEADER(sys/sockio.h, AC_DEFINE(HAVE_SYS_SOCKIO_H))
|
||||
|
||||
if test "$uname" = "SunOS"; then
|
||||
case "$uversion" in
|
||||
55* | 56*)
|
||||
maxfiles=1024
|
||||
;;
|
||||
*)
|
||||
maxfiles=4096
|
||||
;;
|
||||
esac
|
||||
else
|
||||
maxfiles=4096
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(maxfiles, [ --with-maxfiles=N set maximum number of file descriptors for scheduler ],
|
||||
maxfiles=$withval)
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_MAX_FDS, $maxfiles)
|
||||
|
||||
CUPS_DEFAULT_DOMAINSOCKET=""
|
||||
|
||||
dnl Domain socket support...
|
||||
@@ -84,5 +66,5 @@ AC_CHECK_HEADERS(AppleTalk/at_proto.h,AC_DEFINE(HAVE_APPLETALK_AT_PROTO_H),,
|
||||
[#include <netat/appletalk.h>])
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-network.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl End of "$Id: cups-network.m4 7140 2007-12-19 01:47:57Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -76,13 +76,6 @@
|
||||
#define CUPS_DEFAULT_MAX_COPIES 100
|
||||
|
||||
|
||||
/*
|
||||
* Maximum number of file descriptors to support.
|
||||
*/
|
||||
|
||||
#define CUPS_MAX_FDS 4096
|
||||
|
||||
|
||||
/*
|
||||
* Do we have domain socket support?
|
||||
*/
|
||||
@@ -445,13 +438,6 @@
|
||||
#undef HAVE_CFBUNDLEPRIV_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have CFLocaleCreateCanonicalLocaleIdentifierFromString()?
|
||||
*/
|
||||
|
||||
#undef HAVE_CF_LOCALE_ID
|
||||
|
||||
|
||||
/*
|
||||
* Do we have MacOSX 10.4's mbr_XXX functions()?
|
||||
*/
|
||||
|
||||
@@ -91,7 +91,6 @@ HEADERS = \
|
||||
dir.h \
|
||||
file.h \
|
||||
http.h \
|
||||
i18n.h \
|
||||
ipp.h \
|
||||
language.h \
|
||||
ppd.h \
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Administration utility API definitions for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -386,7 +386,7 @@ cupsAdminCreateWindowsPPD(
|
||||
{
|
||||
write_option(dstfp, jclorder ++, "cupsJobSheetsStart", "Start Banner",
|
||||
"job-sheets", suppattr, defattr, 0, 2);
|
||||
write_option(dstfp, jclorder ++, "cupsJobSheetsEnd", "End Banner",
|
||||
write_option(dstfp, jclorder, "cupsJobSheetsEnd", "End Banner",
|
||||
"job-sheets", suppattr, defattr, 1, 2);
|
||||
}
|
||||
|
||||
@@ -808,6 +808,9 @@ cupsAdminExportSamba(
|
||||
if (have_drivers == 0)
|
||||
{
|
||||
_cupsSetError(IPP_NOT_FOUND, message);
|
||||
|
||||
unlink(authfile);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -958,7 +961,7 @@ _cupsAdminGetServerSettings(
|
||||
if (!value && strncmp(line, "</", 2))
|
||||
value = line + strlen(line);
|
||||
|
||||
if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
|
||||
if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) && value)
|
||||
{
|
||||
char *port; /* Pointer to port number, if any */
|
||||
|
||||
@@ -1014,7 +1017,7 @@ _cupsAdminGetServerSettings(
|
||||
{
|
||||
in_policy = 0;
|
||||
}
|
||||
else if (!strcasecmp(line, "<Limit") && in_policy)
|
||||
else if (!strcasecmp(line, "<Limit") && in_policy && value)
|
||||
{
|
||||
/*
|
||||
* See if the policy limit is for the Cancel-Job operation...
|
||||
@@ -1047,7 +1050,7 @@ _cupsAdminGetServerSettings(
|
||||
{
|
||||
cancel_policy = 0;
|
||||
}
|
||||
else if (!strcasecmp(line, "<Location"))
|
||||
else if (!strcasecmp(line, "<Location") && value)
|
||||
{
|
||||
in_admin_location = !strcasecmp(value, "/admin");
|
||||
in_location = 1;
|
||||
@@ -1057,7 +1060,7 @@ _cupsAdminGetServerSettings(
|
||||
in_admin_location = 0;
|
||||
in_location = 0;
|
||||
}
|
||||
else if (!strcasecmp(line, "Allow") && in_admin_location &&
|
||||
else if (!strcasecmp(line, "Allow") && value &&
|
||||
strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1")
|
||||
#ifdef AF_LOCAL
|
||||
&& *value != '/'
|
||||
@@ -1067,9 +1070,9 @@ _cupsAdminGetServerSettings(
|
||||
#endif /* AF_INET6 */
|
||||
)
|
||||
{
|
||||
remote_admin = 1;
|
||||
|
||||
if (!strcasecmp(value, "all"))
|
||||
if (in_admin_location)
|
||||
remote_admin = 1;
|
||||
else if (!strcasecmp(value, "all"))
|
||||
remote_any = 1;
|
||||
}
|
||||
else if (line[0] != '<' && !in_location && !in_policy)
|
||||
@@ -1221,8 +1224,8 @@ _cupsAdminSetServerSettings(
|
||||
* Get the cupsd.conf file...
|
||||
*/
|
||||
|
||||
if ((status = get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
|
||||
&remote)) == HTTP_OK)
|
||||
if (get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
|
||||
&remote) == HTTP_OK)
|
||||
{
|
||||
if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
|
||||
{
|
||||
@@ -1578,8 +1581,6 @@ _cupsAdminSetServerSettings(
|
||||
if (remote_admin)
|
||||
cupsFilePrintf(temp, " Allow %s\n",
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
else
|
||||
cupsFilePuts(temp, " Allow localhost\n");
|
||||
}
|
||||
else if (in_conf_location && remote_admin >= 0)
|
||||
{
|
||||
@@ -1597,8 +1598,6 @@ _cupsAdminSetServerSettings(
|
||||
if (remote_admin)
|
||||
cupsFilePrintf(temp, " Allow %s\n",
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
else
|
||||
cupsFilePuts(temp, " Allow localhost\n");
|
||||
}
|
||||
else if (in_root_location && (remote_admin >= 0 || share_printers >= 0))
|
||||
{
|
||||
@@ -1619,8 +1618,6 @@ _cupsAdminSetServerSettings(
|
||||
if (remote_admin > 0 || share_printers > 0)
|
||||
cupsFilePrintf(temp, " Allow %s\n",
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
else
|
||||
cupsFilePuts(temp, " Allow localhost\n");
|
||||
}
|
||||
|
||||
in_admin_location = 0;
|
||||
@@ -1841,8 +1838,6 @@ _cupsAdminSetServerSettings(
|
||||
|
||||
if (remote_admin > 0 || share_printers > 0)
|
||||
cupsFilePrintf(temp, " Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
|
||||
else
|
||||
cupsFilePuts(temp, " Allow localhost\n");
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
}
|
||||
@@ -1859,8 +1854,6 @@ _cupsAdminSetServerSettings(
|
||||
|
||||
if (remote_admin)
|
||||
cupsFilePrintf(temp, " Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
|
||||
else
|
||||
cupsFilePuts(temp, " Allow localhost\n");
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
}
|
||||
@@ -1880,8 +1873,6 @@ _cupsAdminSetServerSettings(
|
||||
|
||||
if (remote_admin)
|
||||
cupsFilePrintf(temp, " Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
|
||||
else
|
||||
cupsFilePuts(temp, " Allow localhost\n");
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Authentication functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* This file contains Kerberos support code, copyright 2006 by
|
||||
@@ -91,8 +91,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
const char *password; /* Password string */
|
||||
char prompt[1024], /* Prompt for user */
|
||||
realm[HTTP_MAX_VALUE], /* realm="xyz" string */
|
||||
nonce[HTTP_MAX_VALUE], /* nonce="xyz" string */
|
||||
encode[4096]; /* Encoded username:password */
|
||||
nonce[HTTP_MAX_VALUE]; /* nonce="xyz" string */
|
||||
int localauth; /* Local authentication result */
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
|
||||
@@ -271,8 +270,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
if (http->gssctx != GSS_C_NO_CONTEXT)
|
||||
{
|
||||
major_status = gss_delete_sec_context(&minor_status, &http->gssctx,
|
||||
GSS_C_NO_BUFFER);
|
||||
gss_delete_sec_context(&minor_status, &http->gssctx, GSS_C_NO_BUFFER);
|
||||
http->gssctx = GSS_C_NO_CONTEXT;
|
||||
}
|
||||
|
||||
@@ -301,13 +299,39 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
if (major_status == GSS_S_CONTINUE_NEEDED)
|
||||
DEBUG_gss_printf(major_status, minor_status, "Continuation needed!");
|
||||
|
||||
if (output_token.length)
|
||||
if (output_token.length > 0 && output_token.length <= 65536)
|
||||
{
|
||||
httpEncode64_2(encode, sizeof(encode), output_token.value,
|
||||
/*
|
||||
* Allocate the authorization string since Windows KDCs can have
|
||||
* arbitrarily large credentials...
|
||||
*/
|
||||
|
||||
int authsize = 10 + /* "Negotiate " */
|
||||
output_token.length * 4 / 3 + 1 + /* Base64 */
|
||||
1; /* nul */
|
||||
|
||||
httpSetAuthString(http, NULL, NULL);
|
||||
|
||||
if ((http->authstring = malloc(authsize)) == NULL)
|
||||
{
|
||||
http->authstring = http->_authstring;
|
||||
authsize = sizeof(http->_authstring);
|
||||
}
|
||||
|
||||
strcpy(http->authstring, "Negotiate ");
|
||||
httpEncode64_2(http->authstring + 10, authsize - 10, output_token.value,
|
||||
output_token.length);
|
||||
httpSetAuthString(http, "Negotiate", encode);
|
||||
|
||||
major_status = gss_release_buffer(&minor_status, &output_token);
|
||||
gss_release_buffer(&minor_status, &output_token);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("cupsDoAuthentication: Kerberos credentials too large - "
|
||||
"%d bytes!\n", output_token.length));
|
||||
|
||||
gss_release_buffer(&minor_status, &output_token);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
#endif /* HAVE_GSSAPI */
|
||||
}
|
||||
@@ -317,6 +341,9 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
* Basic authentication...
|
||||
*/
|
||||
|
||||
char encode[256]; /* Base64 buffer */
|
||||
|
||||
|
||||
httpEncode64_2(encode, sizeof(encode), http->userpass,
|
||||
(int)strlen(http->userpass));
|
||||
httpSetAuthString(http, "Basic", encode);
|
||||
@@ -327,7 +354,8 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
* Digest authentication...
|
||||
*/
|
||||
|
||||
char digest[1024]; /* Digest auth data */
|
||||
char encode[33], /* MD5 buffer */
|
||||
digest[1024]; /* Digest auth data */
|
||||
|
||||
|
||||
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "realm", realm);
|
||||
|
||||
@@ -59,10 +59,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 1.0305
|
||||
# define CUPS_VERSION 1.0308
|
||||
# define CUPS_VERSION_MAJOR 1
|
||||
# define CUPS_VERSION_MINOR 3
|
||||
# define CUPS_VERSION_PATCH 5
|
||||
# define CUPS_VERSION_PATCH 8
|
||||
# define CUPS_DATE_ANY -1
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* User-defined destination (and option) support for the Common UNIX
|
||||
* Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -89,7 +89,7 @@ cupsAddDest(const char *name, /* I - Destination name */
|
||||
if (!name || !dests)
|
||||
return (0);
|
||||
|
||||
if ((dest = cupsGetDest(name, instance, num_dests, *dests)) != NULL)
|
||||
if (cupsGetDest(name, instance, num_dests, *dests))
|
||||
return (num_dests);
|
||||
|
||||
/*
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* PPD code emission routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -106,15 +106,24 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
|
||||
DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)\n",
|
||||
ppd, section, min_order, choices));
|
||||
|
||||
if (ppd == NULL)
|
||||
if (!ppd || !choices)
|
||||
{
|
||||
if (choices)
|
||||
*choices = NULL;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate memory for up to 1000 selected choices...
|
||||
*/
|
||||
|
||||
count = 0;
|
||||
collect = calloc(sizeof(ppd_choice_t *), 1000);
|
||||
count = 0;
|
||||
if ((collect = calloc(sizeof(ppd_choice_t *), 1000)) == NULL)
|
||||
{
|
||||
*choices = NULL;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop through all options and add choices as needed...
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Option encoding routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -43,98 +43,100 @@
|
||||
|
||||
static const _ipp_option_t ipp_options[] =
|
||||
{
|
||||
{ "auth-info", IPP_TAG_TEXT, IPP_TAG_JOB },
|
||||
{ "auth-info-required", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ "blackplot", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ "blackplot-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ "brightness", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "brightness-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "columns", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "columns-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "copies", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "copies-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "document-format", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
|
||||
{ "document-format-default", IPP_TAG_MIMETYPE, IPP_TAG_PRINTER },
|
||||
{ "finishings", IPP_TAG_ENUM, IPP_TAG_JOB },
|
||||
{ "finishings-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ "fitplot", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ "fitplot-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ "gamma", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "gamma-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "hue", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "hue-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "job-k-limit", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "job-page-limit", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "job-priority", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "job-quota-period", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "job-uuid", IPP_TAG_URI, IPP_TAG_JOB },
|
||||
{ "landscape", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ "media", IPP_TAG_KEYWORD, IPP_TAG_JOB },
|
||||
{ "mirror", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ "mirror-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ "natural-scaling", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "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-events-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ "notify-lease-duration", IPP_TAG_INTEGER, IPP_TAG_SUBSCRIPTION },
|
||||
{ "notify-lease-duration-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "notify-natural-language", IPP_TAG_LANGUAGE, IPP_TAG_SUBSCRIPTION },
|
||||
{ "notify-pull-method", IPP_TAG_KEYWORD, IPP_TAG_SUBSCRIPTION },
|
||||
{ "notify-recipient-uri", IPP_TAG_URI, IPP_TAG_SUBSCRIPTION },
|
||||
{ "notify-time-interval", IPP_TAG_INTEGER, IPP_TAG_SUBSCRIPTION },
|
||||
{ "notify-user-data", IPP_TAG_STRING, IPP_TAG_SUBSCRIPTION },
|
||||
{ "number-up", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "number-up-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "orientation-requested", IPP_TAG_ENUM, IPP_TAG_JOB },
|
||||
{ "orientation-requested-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ "page-bottom", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "page-bottom-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "page-left", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "page-left-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "page-ranges", IPP_TAG_RANGE, IPP_TAG_JOB },
|
||||
{ "page-ranges-default", IPP_TAG_RANGE, IPP_TAG_PRINTER },
|
||||
{ "page-right", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "page-right-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "page-top", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "page-top-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "penwidth-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "port-monitor", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ "prettyprint-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ "print-quality", IPP_TAG_ENUM, IPP_TAG_JOB },
|
||||
{ "print-quality-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ "printer-error-policy", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ "printer-info", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ "printer-is-accepting-jobs",IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ "printer-is-shared", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ "printer-location", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ "printer-make-and-model", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ "printer-more-info", IPP_TAG_URI, IPP_TAG_PRINTER },
|
||||
{ "printer-op-policy", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ "printer-resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB },
|
||||
{ "printer-state", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ "printer-state-change-time",IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "printer-state-reasons", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ "printer-type", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ "printer-uri", IPP_TAG_URI, IPP_TAG_OPERATION },
|
||||
{ "queued-job-count", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "raw", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
|
||||
{ "requesting-user-name-allowed", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ "requesting-user-name-denied", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ "resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB },
|
||||
{ "resolution-default", IPP_TAG_RESOLUTION, IPP_TAG_PRINTER },
|
||||
{ "saturation", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "saturation-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "scaling", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ "scaling-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ "sides", IPP_TAG_KEYWORD, IPP_TAG_JOB },
|
||||
{ "sides-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ "wrap", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ "wrap-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER }
|
||||
{ 1, "auth-info", IPP_TAG_TEXT, IPP_TAG_JOB },
|
||||
{ 1, "auth-info-required", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ 0, "blackplot", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ 0, "blackplot-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "brightness", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "brightness-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "columns", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "columns-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "copies", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "copies-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "document-format", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
|
||||
{ 0, "document-format-default", IPP_TAG_MIMETYPE, IPP_TAG_PRINTER },
|
||||
{ 1, "finishings", IPP_TAG_ENUM, IPP_TAG_JOB },
|
||||
{ 1, "finishings-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ 0, "fitplot", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ 0, "fitplot-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "gamma", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "gamma-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "hue", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "hue-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "job-k-limit", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "job-page-limit", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "job-priority", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "job-quota-period", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 1, "job-sheets", IPP_TAG_NAME, IPP_TAG_JOB },
|
||||
{ 1, "job-sheets-default", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "job-uuid", IPP_TAG_URI, IPP_TAG_JOB },
|
||||
{ 0, "landscape", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ 1, "media", IPP_TAG_KEYWORD, IPP_TAG_JOB },
|
||||
{ 0, "mirror", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ 0, "mirror-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "natural-scaling", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "natural-scaling-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "notify-charset", IPP_TAG_CHARSET, IPP_TAG_SUBSCRIPTION },
|
||||
{ 1, "notify-events", IPP_TAG_KEYWORD, IPP_TAG_SUBSCRIPTION },
|
||||
{ 1, "notify-events-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ 0, "notify-lease-duration", IPP_TAG_INTEGER, IPP_TAG_SUBSCRIPTION },
|
||||
{ 0, "notify-lease-duration-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "notify-natural-language", IPP_TAG_LANGUAGE, IPP_TAG_SUBSCRIPTION },
|
||||
{ 0, "notify-pull-method", IPP_TAG_KEYWORD, IPP_TAG_SUBSCRIPTION },
|
||||
{ 0, "notify-recipient-uri", IPP_TAG_URI, IPP_TAG_SUBSCRIPTION },
|
||||
{ 0, "notify-time-interval", IPP_TAG_INTEGER, IPP_TAG_SUBSCRIPTION },
|
||||
{ 0, "notify-user-data", IPP_TAG_STRING, IPP_TAG_SUBSCRIPTION },
|
||||
{ 0, "number-up", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "number-up-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "orientation-requested", IPP_TAG_ENUM, IPP_TAG_JOB },
|
||||
{ 0, "orientation-requested-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ 0, "page-bottom", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "page-bottom-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "page-left", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "page-left-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 1, "page-ranges", IPP_TAG_RANGE, IPP_TAG_JOB },
|
||||
{ 1, "page-ranges-default", IPP_TAG_RANGE, IPP_TAG_PRINTER },
|
||||
{ 0, "page-right", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "page-right-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "page-top", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "page-top-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "penwidth-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "port-monitor", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ 0, "prettyprint-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "print-quality", IPP_TAG_ENUM, IPP_TAG_JOB },
|
||||
{ 0, "print-quality-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-error-policy", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-info", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-is-shared", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-location", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-make-and-model", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-more-info", IPP_TAG_URI, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-op-policy", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB },
|
||||
{ 0, "printer-state", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-state-change-time", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 1, "printer-state-reasons", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-type", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-uri", IPP_TAG_URI, IPP_TAG_OPERATION },
|
||||
{ 0, "queued-job-count", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "raw", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
|
||||
{ 1, "requesting-user-name-allowed", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 1, "requesting-user-name-denied", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB },
|
||||
{ 0, "resolution-default", IPP_TAG_RESOLUTION, IPP_TAG_PRINTER },
|
||||
{ 0, "saturation", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "saturation-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "scaling", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "scaling-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "sides", IPP_TAG_KEYWORD, IPP_TAG_JOB },
|
||||
{ 0, "sides-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ 0, "wrap", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ 0, "wrap-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER }
|
||||
};
|
||||
|
||||
|
||||
@@ -192,7 +194,8 @@ cupsEncodeOptions2(
|
||||
char *s, /* Pointer into option value */
|
||||
*val, /* Pointer to option value */
|
||||
*copy, /* Copy of option value */
|
||||
*sep; /* Option separator */
|
||||
*sep, /* Option separator */
|
||||
quote; /* Quote character */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
ipp_tag_t value_tag; /* IPP value tag */
|
||||
cups_option_t *option; /* Current option */
|
||||
@@ -284,41 +287,28 @@ cupsEncodeOptions2(
|
||||
* Count the number of values...
|
||||
*/
|
||||
|
||||
for (count = 1, sep = option->value; *sep; sep ++)
|
||||
if (match && match->multivalue)
|
||||
{
|
||||
if (*sep == '\'')
|
||||
for (count = 1, sep = option->value, quote = 0; *sep; sep ++)
|
||||
{
|
||||
/*
|
||||
* Skip quoted option value...
|
||||
*/
|
||||
if (*sep == quote)
|
||||
quote = 0;
|
||||
else if (!quote && (*sep == '\'' || *sep == '\"'))
|
||||
{
|
||||
/*
|
||||
* Skip quoted option value...
|
||||
*/
|
||||
|
||||
sep ++;
|
||||
|
||||
while (*sep && *sep != '\'')
|
||||
quote = *sep++;
|
||||
}
|
||||
else if (*sep == ',' && !quote)
|
||||
count ++;
|
||||
else if (*sep == '\\' && sep[1])
|
||||
sep ++;
|
||||
|
||||
if (!*sep)
|
||||
sep --;
|
||||
}
|
||||
else if (*sep == '\"')
|
||||
{
|
||||
/*
|
||||
* Skip quoted option value...
|
||||
*/
|
||||
|
||||
sep ++;
|
||||
|
||||
while (*sep && *sep != '\"')
|
||||
sep ++;
|
||||
|
||||
if (!*sep)
|
||||
sep --;
|
||||
}
|
||||
else if (*sep == ',')
|
||||
count ++;
|
||||
else if (*sep == '\\' && sep[1])
|
||||
sep ++;
|
||||
}
|
||||
else
|
||||
count = 1;
|
||||
|
||||
DEBUG_printf(("cupsEncodeOptions2: option = \'%s\', count = %d\n",
|
||||
option->name, count));
|
||||
@@ -390,16 +380,47 @@ cupsEncodeOptions2(
|
||||
* Scan the value string for values...
|
||||
*/
|
||||
|
||||
for (j = 0; j < count; val = sep, j ++)
|
||||
for (j = 0, sep = val; j < count; val = sep, j ++)
|
||||
{
|
||||
/*
|
||||
* Find the end of this value and mark it if needed...
|
||||
*/
|
||||
|
||||
if ((sep = strchr(val, ',')) != NULL)
|
||||
*sep++ = '\0';
|
||||
else
|
||||
sep = val + strlen(val);
|
||||
if (count > 1)
|
||||
{
|
||||
for (quote = 0; *sep; sep ++)
|
||||
{
|
||||
if (*sep == quote)
|
||||
{
|
||||
/*
|
||||
* Finish quoted value...
|
||||
*/
|
||||
|
||||
quote = 0;
|
||||
}
|
||||
else if (!quote && (*sep == '\'' || *sep == '\"'))
|
||||
{
|
||||
/*
|
||||
* Handle quoted option value...
|
||||
*/
|
||||
|
||||
quote = *sep;
|
||||
}
|
||||
else if (*sep == ',' && count > 1)
|
||||
break;
|
||||
else if (*sep == '\\' && sep[1])
|
||||
{
|
||||
/*
|
||||
* Skip quoted character...
|
||||
*/
|
||||
|
||||
sep ++;
|
||||
}
|
||||
}
|
||||
|
||||
if (*sep == ',')
|
||||
*sep++ = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the option value(s) over as needed by the type...
|
||||
@@ -413,7 +434,7 @@ cupsEncodeOptions2(
|
||||
* Integer/enumeration value...
|
||||
*/
|
||||
|
||||
attr->values[j].integer = strtol(val, &s, 0);
|
||||
attr->values[j].integer = strtol(val, &s, 10);
|
||||
|
||||
DEBUG_printf(("cupsEncodeOptions2: Added integer option value %d...\n",
|
||||
attr->values[j].integer));
|
||||
@@ -455,12 +476,12 @@ cupsEncodeOptions2(
|
||||
s = val;
|
||||
}
|
||||
else
|
||||
attr->values[j].range.lower = strtol(val, &s, 0);
|
||||
attr->values[j].range.lower = strtol(val, &s, 10);
|
||||
|
||||
if (*s == '-')
|
||||
{
|
||||
if (s[1])
|
||||
attr->values[j].range.upper = strtol(s + 1, NULL, 0);
|
||||
attr->values[j].range.upper = strtol(s + 1, NULL, 10);
|
||||
else
|
||||
attr->values[j].range.upper = 2147483647;
|
||||
}
|
||||
@@ -477,10 +498,10 @@ cupsEncodeOptions2(
|
||||
* Resolution...
|
||||
*/
|
||||
|
||||
attr->values[j].resolution.xres = strtol(val, &s, 0);
|
||||
attr->values[j].resolution.xres = strtol(val, &s, 10);
|
||||
|
||||
if (*s == 'x')
|
||||
attr->values[j].resolution.yres = strtol(s + 1, &s, 0);
|
||||
attr->values[j].resolution.yres = strtol(s + 1, &s, 10);
|
||||
else
|
||||
attr->values[j].resolution.yres = attr->values[j].resolution.xres;
|
||||
|
||||
@@ -499,7 +520,7 @@ cupsEncodeOptions2(
|
||||
*/
|
||||
|
||||
attr->values[j].unknown.length = (int)strlen(val);
|
||||
attr->values[j].unknown.data = _cupsStrAlloc(val);
|
||||
attr->values[j].unknown.data = strdup(val);
|
||||
|
||||
DEBUG_printf(("cupsEncodeOptions2: Added octet-string value \"%s\"...\n",
|
||||
attr->values[j].unknown.data));
|
||||
|
||||
@@ -110,7 +110,8 @@ struct _cups_file_s /**** CUPS file structure... ****/
|
||||
buf[4096], /* Buffer */
|
||||
*ptr, /* Pointer into buffer */
|
||||
*end; /* End of buffer data */
|
||||
off_t pos; /* File position for start of buffer */
|
||||
off_t pos, /* Position in file */
|
||||
bufpos; /* File position for start of buffer */
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
z_stream stream; /* (De)compression stream */
|
||||
@@ -402,13 +403,14 @@ cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
if (!fp || fp->mode != 'w')
|
||||
{
|
||||
DEBUG_puts(" Attempt to flush a read-only file...");
|
||||
DEBUG_puts("cupsFileFlush: Attempt to flush a read-only file...");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
bytes = (ssize_t)(fp->ptr - fp->buf);
|
||||
|
||||
DEBUG_printf((" Flushing %ld bytes...\n", (long)bytes));
|
||||
DEBUG_printf(("cupsFileFlush: Flushing " CUPS_LLFMT " bytes...\n",
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
if (bytes > 0)
|
||||
{
|
||||
@@ -440,6 +442,8 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileGetChar(fp=%p)\n", fp));
|
||||
|
||||
if (!fp || (fp->mode != 'r' && fp->mode != 's'))
|
||||
{
|
||||
DEBUG_puts("cupsFileGetChar: Bad arguments!");
|
||||
@@ -463,6 +467,10 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
DEBUG_printf(("cupsFileGetChar: Returning %d...\n", *(fp->ptr) & 255));
|
||||
|
||||
fp->pos ++;
|
||||
|
||||
DEBUG_printf(("cupsFileGetChar: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (*(fp->ptr)++ & 255);
|
||||
}
|
||||
|
||||
@@ -485,6 +493,10 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileGetConf(fp=%p, buf=%p, buflen=" CUPS_LLFMT
|
||||
", value=%p, linenum=%p)\n", fp, buf, CUPS_LLCAST buflen,
|
||||
value, linenum));
|
||||
|
||||
if (!fp || (fp->mode != 'r' && fp->mode != 's') ||
|
||||
!buf || buflen < 2 || !value)
|
||||
{
|
||||
@@ -623,6 +635,9 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileGetLine(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")\n",
|
||||
fp, buf, CUPS_LLCAST buflen));
|
||||
|
||||
if (!fp || (fp->mode != 'r' && fp->mode != 's') || !buf || buflen < 3)
|
||||
return (0);
|
||||
|
||||
@@ -637,6 +652,7 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
break;
|
||||
|
||||
*ptr++ = ch = *(fp->ptr)++;
|
||||
fp->pos ++;
|
||||
|
||||
if (ch == '\r')
|
||||
{
|
||||
@@ -649,7 +665,10 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
break;
|
||||
|
||||
if (*(fp->ptr) == '\n')
|
||||
{
|
||||
*ptr++ = *(fp->ptr)++;
|
||||
fp->pos ++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -665,6 +684,8 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
DEBUG_printf(("cupsFileGetLine: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (ptr - buf);
|
||||
}
|
||||
|
||||
@@ -687,6 +708,9 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileGets(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST buflen));
|
||||
|
||||
if (!fp || (fp->mode != 'r' && fp->mode != 's') || !buf || buflen < 2)
|
||||
return (NULL);
|
||||
|
||||
@@ -706,6 +730,7 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
}
|
||||
|
||||
ch = *(fp->ptr)++;
|
||||
fp->pos ++;
|
||||
|
||||
if (ch == '\r')
|
||||
{
|
||||
@@ -718,7 +743,10 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
break;
|
||||
|
||||
if (*(fp->ptr) == '\n')
|
||||
fp->ptr ++;
|
||||
{
|
||||
fp->ptr ++;
|
||||
fp->pos ++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -736,6 +764,8 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
DEBUG_printf(("cupsFileGets: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (buf);
|
||||
}
|
||||
|
||||
@@ -801,7 +831,8 @@ cupsFileOpen(const char *filename, /* I - Name of file */
|
||||
*/
|
||||
|
||||
if (!filename || !mode ||
|
||||
(*mode != 'r' && *mode != 'w' && *mode != 'a' && *mode != 's'))
|
||||
(*mode != 'r' && *mode != 'w' && *mode != 'a' && *mode != 's') ||
|
||||
(*mode == 'a' && isdigit(mode[1] & 255)))
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
@@ -893,7 +924,8 @@ cupsFileOpenFd(int fd, /* I - File descriptor */
|
||||
*/
|
||||
|
||||
if (fd < 0 || !mode ||
|
||||
(*mode != 'r' && *mode != 'w' && *mode != 'a' && *mode != 's'))
|
||||
(*mode != 'r' && *mode != 'w' && *mode != 'a' && *mode != 's') ||
|
||||
(*mode == 'a' && isdigit(mode[1] & 255)))
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
@@ -911,8 +943,10 @@ cupsFileOpenFd(int fd, /* I - File descriptor */
|
||||
|
||||
switch (*mode)
|
||||
{
|
||||
case 'w' :
|
||||
case 'a' :
|
||||
fp->pos = lseek(fd, 0, SEEK_END);
|
||||
|
||||
case 'w' :
|
||||
fp->mode = 'w';
|
||||
fp->ptr = fp->buf;
|
||||
fp->end = fp->buf + sizeof(fp->buf);
|
||||
@@ -1039,7 +1073,16 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
return (-1);
|
||||
|
||||
if (fp->mode == 's')
|
||||
return (cups_write(fp, buf, bytes));
|
||||
{
|
||||
if (cups_write(fp, buf, bytes) < 0)
|
||||
return (-1);
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("cupsFilePrintf: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
if ((fp->ptr + bytes) > fp->end)
|
||||
if (cupsFileFlush(fp))
|
||||
@@ -1047,6 +1090,8 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("cupsFilePrintf: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (bytes > sizeof(fp->buf))
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
@@ -1109,6 +1154,8 @@ cupsFilePutChar(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos ++;
|
||||
|
||||
DEBUG_printf(("cupsFilePutChar: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -1144,6 +1191,8 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("cupsFilePuts: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
@@ -1153,6 +1202,8 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("cupsFilePuts: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (bytes > sizeof(fp->buf))
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
@@ -1184,8 +1235,8 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t count; /* Bytes read */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileRead(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
|
||||
(long)bytes));
|
||||
DEBUG_printf(("cupsFileRead(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -1207,7 +1258,8 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
if (fp->ptr >= fp->end)
|
||||
if (cups_fill(fp) <= 0)
|
||||
{
|
||||
DEBUG_printf((" cups_fill() returned -1, total=%d\n", (int)total));
|
||||
DEBUG_printf(("cupsFileRead: cups_fill() returned -1, total=" CUPS_LLFMT "\n",
|
||||
CUPS_LLCAST total));
|
||||
|
||||
if (total > 0)
|
||||
return ((ssize_t)total);
|
||||
@@ -1221,6 +1273,9 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
memcpy(buf, fp->ptr, count);
|
||||
fp->ptr += count;
|
||||
fp->pos += count;
|
||||
|
||||
DEBUG_printf(("cupsFileRead: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
/*
|
||||
* Update the counts for the last read...
|
||||
@@ -1235,7 +1290,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
* Return the total number of bytes read...
|
||||
*/
|
||||
|
||||
DEBUG_printf((" total=%d\n", (int)total));
|
||||
DEBUG_printf(("cupsFileRead: total=%d\n", (int)total));
|
||||
|
||||
return ((ssize_t)total);
|
||||
}
|
||||
@@ -1252,6 +1307,9 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileRewind(fp=%p)\n", fp));
|
||||
DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (!fp || fp->mode != 'r')
|
||||
return (-1);
|
||||
|
||||
@@ -1259,18 +1317,22 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
* Handle special cases...
|
||||
*/
|
||||
|
||||
if (fp->pos == 0)
|
||||
if (fp->bufpos == 0)
|
||||
{
|
||||
/*
|
||||
* No seeking necessary...
|
||||
*/
|
||||
|
||||
fp->pos = 0;
|
||||
|
||||
if (fp->ptr)
|
||||
{
|
||||
fp->ptr = fp->buf;
|
||||
fp->eof = 0;
|
||||
}
|
||||
|
||||
DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -1288,10 +1350,13 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
lseek(fp->fd, 0, SEEK_SET);
|
||||
|
||||
fp->pos = 0;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->eof = 0;
|
||||
fp->bufpos = 0;
|
||||
fp->pos = 0;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->eof = 0;
|
||||
|
||||
DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -1308,9 +1373,10 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t bytes; /* Number bytes in buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")\n", fp, pos));
|
||||
DEBUG_printf((" fp->pos=" CUPS_LLFMT "\n", fp->pos));
|
||||
DEBUG_printf((" fp->ptr=%p, fp->end=%p\n", fp->ptr, fp->end));
|
||||
DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")\n", fp,
|
||||
CUPS_LLCAST pos));
|
||||
DEBUG_printf(("cupsFileSeek: fp->pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileSeek: fp->ptr=%p, fp->end=%p\n", fp->ptr, fp->end));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -1326,19 +1392,22 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
if (pos == 0)
|
||||
return (cupsFileRewind(fp));
|
||||
|
||||
if (fp->pos == pos)
|
||||
if (fp->ptr)
|
||||
{
|
||||
/*
|
||||
* No seeking necessary...
|
||||
*/
|
||||
bytes = (ssize_t)(fp->end - fp->buf);
|
||||
|
||||
if (fp->ptr)
|
||||
if (pos >= fp->bufpos && pos < (fp->bufpos + bytes))
|
||||
{
|
||||
fp->ptr = fp->buf;
|
||||
fp->eof = 0;
|
||||
}
|
||||
/*
|
||||
* No seeking necessary...
|
||||
*/
|
||||
|
||||
return (pos);
|
||||
fp->pos = pos;
|
||||
fp->ptr = fp->buf + pos - fp->bufpos;
|
||||
fp->eof = 0;
|
||||
|
||||
return (pos);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
@@ -1354,26 +1423,20 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
/*
|
||||
* Figure out the number of bytes in the current buffer, and then
|
||||
* see if we are outside of it...
|
||||
* Seek forwards or backwards...
|
||||
*/
|
||||
|
||||
if (fp->ptr)
|
||||
bytes = (ssize_t)(fp->end - fp->buf);
|
||||
else
|
||||
bytes = 0;
|
||||
|
||||
fp->eof = 0;
|
||||
|
||||
DEBUG_printf((" bytes=" CUPS_LLFMT "\n", CUPS_LLCAST bytes));
|
||||
DEBUG_printf(("cupsFileSeek: bytes=" CUPS_LLFMT "\n", CUPS_LLCAST bytes));
|
||||
|
||||
if (pos < fp->pos)
|
||||
if (pos < fp->bufpos)
|
||||
{
|
||||
/*
|
||||
* Need to seek backwards...
|
||||
*/
|
||||
|
||||
DEBUG_puts(" SEEK BACKWARDS");
|
||||
DEBUG_puts("cupsFileSeek: SEEK BACKWARDS");
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
if (fp->compressed)
|
||||
@@ -1381,72 +1444,70 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
inflateEnd(&fp->stream);
|
||||
|
||||
lseek(fp->fd, 0, SEEK_SET);
|
||||
fp->pos = 0;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->bufpos = 0;
|
||||
fp->pos = 0;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
|
||||
while ((bytes = cups_fill(fp)) > 0)
|
||||
if (pos >= fp->pos && pos < (fp->pos + bytes))
|
||||
if (pos >= fp->bufpos && pos < (fp->bufpos + bytes))
|
||||
break;
|
||||
|
||||
if (bytes <= 0)
|
||||
return (-1);
|
||||
|
||||
fp->ptr = fp->buf + pos - fp->pos;
|
||||
fp->ptr = fp->buf + pos - fp->bufpos;
|
||||
fp->pos = pos;
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_LIBZ */
|
||||
{
|
||||
fp->pos = lseek(fp->fd, pos, SEEK_SET);
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->bufpos = lseek(fp->fd, pos, SEEK_SET);
|
||||
fp->pos = fp->bufpos;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
|
||||
DEBUG_printf((" lseek() returned %ld...\n", (long)fp->pos));
|
||||
DEBUG_printf(("cupsFileSeek: lseek() returned " CUPS_LLFMT "...\n",
|
||||
CUPS_LLCAST fp->pos));
|
||||
}
|
||||
}
|
||||
else if (pos >= (fp->pos + bytes))
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Need to seek forwards...
|
||||
*/
|
||||
|
||||
DEBUG_puts(" SEEK FORWARDS");
|
||||
DEBUG_puts("cupsFileSeek: SEEK FORWARDS");
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
if (fp->compressed)
|
||||
{
|
||||
while ((bytes = cups_fill(fp)) > 0)
|
||||
{
|
||||
if (pos >= fp->pos && pos < (fp->pos + bytes))
|
||||
if (pos >= fp->bufpos && pos < (fp->bufpos + bytes))
|
||||
break;
|
||||
}
|
||||
|
||||
if (bytes <= 0)
|
||||
return (-1);
|
||||
|
||||
fp->ptr = fp->buf + pos - fp->pos;
|
||||
fp->ptr = fp->buf + pos - fp->bufpos;
|
||||
fp->pos = pos;
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_LIBZ */
|
||||
{
|
||||
fp->pos = lseek(fp->fd, pos, SEEK_SET);
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->bufpos = lseek(fp->fd, pos, SEEK_SET);
|
||||
fp->pos = fp->bufpos;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
|
||||
DEBUG_printf((" lseek() returned " CUPS_LLFMT "...\n", fp->pos));
|
||||
DEBUG_printf(("cupsFileSeek: lseek() returned " CUPS_LLFMT "...\n",
|
||||
CUPS_LLCAST fp->pos));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Just reposition the current pointer, since we have the right
|
||||
* range...
|
||||
*/
|
||||
|
||||
DEBUG_puts(" SEEK INSIDE BUFFER");
|
||||
|
||||
fp->ptr = fp->buf + pos - fp->pos;
|
||||
}
|
||||
DEBUG_printf(("cupsFileSeek: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (fp->pos);
|
||||
}
|
||||
@@ -1555,6 +1616,9 @@ cupsFileStdout(void)
|
||||
off_t /* O - File position */
|
||||
cupsFileTell(cups_file_t *fp) /* I - CUPS file */
|
||||
{
|
||||
DEBUG_printf(("cupsFileTell(fp=%p)\n", fp));
|
||||
DEBUG_printf(("cupsFileTell: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (fp ? fp->pos : 0);
|
||||
}
|
||||
|
||||
@@ -1570,6 +1634,8 @@ cupsFileUnlock(cups_file_t *fp) /* I - File to lock */
|
||||
* Range check...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileUnlock(fp=%p)\n", fp));
|
||||
|
||||
if (!fp || fp->mode == 's')
|
||||
return (-1);
|
||||
|
||||
@@ -1598,6 +1664,9 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileWrite(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n",
|
||||
fp, buf, CUPS_LLCAST bytes));
|
||||
|
||||
if (!fp || !buf || bytes < 0 || (fp->mode != 'w' && fp->mode != 's'))
|
||||
return (-1);
|
||||
|
||||
@@ -1615,6 +1684,8 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += (off_t)bytes;
|
||||
|
||||
DEBUG_printf(("cupsFileWrite: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return ((ssize_t)bytes);
|
||||
}
|
||||
|
||||
@@ -1624,6 +1695,8 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += (off_t)bytes;
|
||||
|
||||
DEBUG_printf(("cupsFileWrite: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (bytes > sizeof(fp->buf))
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
@@ -1652,8 +1725,8 @@ cups_compress(cups_file_t *fp, /* I - CUPS file */
|
||||
const char *buf, /* I - Buffer */
|
||||
size_t bytes) /* I - Number bytes */
|
||||
{
|
||||
DEBUG_printf(("cups_compress(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
|
||||
(long)bytes));
|
||||
DEBUG_printf(("cups_compress(fp=%p, buf=%p, bytes=" CUPS_LLFMT "\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
* Update the CRC...
|
||||
@@ -1674,8 +1747,8 @@ cups_compress(cups_file_t *fp, /* I - CUPS file */
|
||||
* Flush the current buffer...
|
||||
*/
|
||||
|
||||
DEBUG_printf((" avail_in=%d, avail_out=%d\n", fp->stream.avail_in,
|
||||
fp->stream.avail_out));
|
||||
DEBUG_printf(("cups_compress: avail_in=%d, avail_out=%d\n",
|
||||
fp->stream.avail_in, fp->stream.avail_out));
|
||||
|
||||
if (fp->stream.avail_out < (int)(sizeof(fp->cbuf) / 8))
|
||||
{
|
||||
@@ -1710,19 +1783,15 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
|
||||
DEBUG_printf(("cups_fill(fp=%p)\n", fp));
|
||||
DEBUG_printf((" fp->ptr=%p, fp->end=%p, fp->buf=%p, "
|
||||
"fp->pos=" CUPS_LLFMT ", fp->eof=%d\n",
|
||||
fp->ptr, fp->end, fp->buf, fp->pos, fp->eof));
|
||||
|
||||
/*
|
||||
* Update the "pos" element as needed...
|
||||
*/
|
||||
DEBUG_printf(("cups_fill: fp->ptr=%p, fp->end=%p, fp->buf=%p, "
|
||||
"fp->bufpos=" CUPS_LLFMT ", fp->eof=%d\n",
|
||||
fp->ptr, fp->end, fp->buf, CUPS_LLCAST fp->bufpos, fp->eof));
|
||||
|
||||
if (fp->ptr && fp->end)
|
||||
fp->pos += (off_t)(fp->end - fp->buf);
|
||||
fp->bufpos += fp->end - fp->buf;
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
DEBUG_printf((" fp->compressed=%d\n", fp->compressed));
|
||||
DEBUG_printf(("cups_fill: fp->compressed=%d\n", fp->compressed));
|
||||
|
||||
while (!fp->ptr || fp->compressed)
|
||||
{
|
||||
@@ -1750,7 +1819,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
* Can't read from file!
|
||||
*/
|
||||
|
||||
DEBUG_printf((" cups_read() returned " CUPS_LLFMT "!\n",
|
||||
DEBUG_printf(("cups_fill: cups_read() returned " CUPS_LLFMT "!\n",
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
return (-1);
|
||||
@@ -2030,6 +2099,9 @@ cups_read(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t total; /* Total bytes read */
|
||||
|
||||
|
||||
DEBUG_printf(("cups_read(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
* Loop until we read at least 0 bytes...
|
||||
*/
|
||||
@@ -2048,6 +2120,8 @@ cups_read(cups_file_t *fp, /* I - CUPS file */
|
||||
total = read(fp->fd, buf, bytes);
|
||||
#endif /* WIN32 */
|
||||
|
||||
DEBUG_printf(("cups_read: total=" CUPS_LLFMT "\n", CUPS_LLCAST total));
|
||||
|
||||
if (total >= 0)
|
||||
break;
|
||||
|
||||
@@ -2082,8 +2156,8 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t count; /* Count this time */
|
||||
|
||||
|
||||
DEBUG_printf(("cups_write(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
|
||||
(long)bytes));
|
||||
DEBUG_printf(("cups_write(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
* Loop until all bytes are written...
|
||||
@@ -2104,6 +2178,8 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
|
||||
count = write(fp->fd, buf, bytes);
|
||||
#endif /* WIN32 */
|
||||
|
||||
DEBUG_printf(("cups_write: count=" CUPS_LLFMT "\n", CUPS_LLCAST count));
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
/*
|
||||
@@ -2116,8 +2192,6 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
DEBUG_printf((" count=%ld\n", (long)count));
|
||||
|
||||
/*
|
||||
* Update the counts for the last write call...
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* HTTP address list routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -202,9 +202,11 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
* Domain socket address...
|
||||
*/
|
||||
|
||||
first = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
|
||||
first->addr.un.sun_family = AF_LOCAL;
|
||||
strlcpy(first->addr.un.sun_path, hostname, sizeof(first->addr.un.sun_path));
|
||||
if ((first = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t))) != NULL)
|
||||
{
|
||||
first->addr.un.sun_family = AF_LOCAL;
|
||||
strlcpy(first->addr.un.sun_path, hostname, sizeof(first->addr.un.sun_path));
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* AF_LOCAL */
|
||||
@@ -526,8 +528,6 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
|
||||
if (addr)
|
||||
addr->next = temp;
|
||||
else
|
||||
addr = temp;
|
||||
}
|
||||
}
|
||||
else if (!hostname)
|
||||
@@ -581,8 +581,6 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
|
||||
if (addr)
|
||||
addr->next = temp;
|
||||
else
|
||||
addr = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,6 @@
|
||||
# include <config.h>
|
||||
|
||||
# ifdef __sun
|
||||
/*
|
||||
* Define FD_SETSIZE to CUPS_MAX_FDS on Solaris to get the correct version of
|
||||
* select() for large numbers of file descriptors.
|
||||
*/
|
||||
|
||||
# define FD_SETSIZE CUPS_MAX_FDS
|
||||
# include <sys/select.h>
|
||||
# endif /* __sun */
|
||||
|
||||
@@ -263,6 +257,12 @@ extern void _cups_freeifaddrs(struct ifaddrs *addrs);
|
||||
# endif /* HAVE_GETIFADDRS */
|
||||
# endif /* !WIN32 */
|
||||
|
||||
/*
|
||||
* Common URI encoding function...
|
||||
*/
|
||||
|
||||
extern char *_httpEncodeURI(char *dst, const char *src, size_t dstsize);
|
||||
|
||||
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
* httpStatus() - Return a short string describing a HTTP status code.
|
||||
* _cups_hstrerror() - hstrerror() emulation function for Solaris and
|
||||
* others...
|
||||
* _httpEncodeURI() - Percent-encode a HTTP request URI.
|
||||
* http_copy_decode() - Copy and decode a URI.
|
||||
* http_copy_encode() - Copy and encode a URI.
|
||||
*/
|
||||
@@ -1203,6 +1204,20 @@ _cups_hstrerror(int error) /* I - Error number */
|
||||
#endif /* !HAVE_HSTRERROR */
|
||||
|
||||
|
||||
/*
|
||||
* '_httpEncodeURI()' - Percent-encode a HTTP request URI.
|
||||
*/
|
||||
|
||||
char * /* O - Encoded URI */
|
||||
_httpEncodeURI(char *dst, /* I - Destination buffer */
|
||||
const char *src, /* I - Source URI */
|
||||
size_t dstsize) /* I - Size of destination buffer */
|
||||
{
|
||||
http_copy_encode(dst, src, dst + dstsize - 1, NULL, NULL, 1);
|
||||
return (dst);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'http_copy_decode()' - Copy and decode a URI.
|
||||
*/
|
||||
@@ -1283,7 +1298,7 @@ http_copy_encode(char *dst, /* O - Destination buffer */
|
||||
const char *term, /* I - Terminating characters */
|
||||
int encode) /* I - %-encode reserved chars? */
|
||||
{
|
||||
static const char *hex = "0123456789ABCDEF";
|
||||
static const char hex[] = "0123456789ABCDEF";
|
||||
|
||||
|
||||
while (*src && dst < dstend)
|
||||
@@ -1311,6 +1326,8 @@ http_copy_encode(char *dst, /* O - Destination buffer */
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
||||
*dst = '\0';
|
||||
|
||||
if (*src)
|
||||
return (NULL);
|
||||
else
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* HTTP routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* This file contains Kerberos support code, copyright 2006 by
|
||||
@@ -293,8 +293,7 @@ void
|
||||
httpClose(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
#ifdef HAVE_GSSAPI
|
||||
OM_uint32 minor_status, /* Minor status code */
|
||||
major_status; /* Major status code */
|
||||
OM_uint32 minor_status; /* Minor status code */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
|
||||
@@ -321,11 +320,10 @@ httpClose(http_t *http) /* I - HTTP connection */
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
if (http->gssctx != GSS_C_NO_CONTEXT)
|
||||
major_status = gss_delete_sec_context(&minor_status, &http->gssctx,
|
||||
GSS_C_NO_BUFFER);
|
||||
gss_delete_sec_context(&minor_status, &http->gssctx, GSS_C_NO_BUFFER);
|
||||
|
||||
if (http->gssname != GSS_C_NO_NAME)
|
||||
major_status = gss_release_name(&minor_status, &http->gssname);
|
||||
gss_release_name(&minor_status, &http->gssname);
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
#ifdef HAVE_AUTHORIZATION_H
|
||||
@@ -402,9 +400,11 @@ httpConnectEncrypt(
|
||||
* Allocate memory for the structure...
|
||||
*/
|
||||
|
||||
http = calloc(sizeof(http_t), 1);
|
||||
if (http == NULL)
|
||||
if ((http = calloc(sizeof(http_t), 1)) == NULL)
|
||||
{
|
||||
httpAddrFreeList(addrlist);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
http->version = HTTP_1_1;
|
||||
http->blocking = 1;
|
||||
@@ -1735,9 +1735,15 @@ httpSetAuthString(http_t *http, /* I - HTTP connection */
|
||||
*/
|
||||
|
||||
int len = (int)strlen(scheme) + (data ? (int)strlen(data) + 1 : 0) + 1;
|
||||
char *temp;
|
||||
|
||||
if (len > (int)sizeof(http->_authstring))
|
||||
http->authstring = malloc(len);
|
||||
{
|
||||
if ((temp = malloc(len)) == NULL)
|
||||
len = sizeof(http->_authstring);
|
||||
else
|
||||
http->authstring = temp;
|
||||
}
|
||||
|
||||
if (data)
|
||||
snprintf(http->authstring, len, "%s %s", scheme, data);
|
||||
@@ -2514,8 +2520,7 @@ http_send(http_t *http, /* I - HTTP connection */
|
||||
const char *uri) /* I - URI */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char *ptr, /* Pointer in buffer */
|
||||
buf[1024]; /* Encoded URI buffer */
|
||||
char buf[1024]; /* Encoded URI buffer */
|
||||
static const char * const codes[] =
|
||||
{ /* Request code strings */
|
||||
NULL,
|
||||
@@ -2532,8 +2537,6 @@ http_send(http_t *http, /* I - HTTP connection */
|
||||
"TRACE",
|
||||
"CLOSE"
|
||||
};
|
||||
static const char hex[] = "0123456789ABCDEF";
|
||||
/* Hex digits */
|
||||
|
||||
|
||||
DEBUG_printf(("http_send(http=%p, request=HTTP_%s, uri=\"%s\")\n",
|
||||
@@ -2553,20 +2556,7 @@ http_send(http_t *http, /* I - HTTP connection */
|
||||
* Encode the URI as needed...
|
||||
*/
|
||||
|
||||
for (ptr = buf; *uri != '\0' && ptr < (buf + sizeof(buf) - 1); uri ++)
|
||||
if (*uri <= ' ' || *uri >= 127)
|
||||
{
|
||||
if (ptr < (buf + sizeof(buf) - 1))
|
||||
*ptr ++ = '%';
|
||||
if (ptr < (buf + sizeof(buf) - 1))
|
||||
*ptr ++ = hex[(*uri >> 4) & 15];
|
||||
if (ptr < (buf + sizeof(buf) - 1))
|
||||
*ptr ++ = hex[*uri & 15];
|
||||
}
|
||||
else
|
||||
*ptr ++ = *uri;
|
||||
|
||||
*ptr = '\0';
|
||||
_httpEncodeURI(buf, uri, sizeof(buf));
|
||||
|
||||
/*
|
||||
* See if we had an error the last time around; if so, reconnect...
|
||||
|
||||
@@ -82,6 +82,10 @@ typedef struct _cups_vmap_s /**** VBCS Charmap Struct ****/
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
extern const char *_cupsAppleLanguage(const char *locale, char *language,
|
||||
size_t langsize);
|
||||
#endif /* __APPLE__ */
|
||||
extern void _cupsCharmapFlush(void);
|
||||
extern void _cupsCharmapFree(const cups_encoding_t encoding);
|
||||
extern void *_cupsCharmapGet(const cups_encoding_t encoding);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Private IPP definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -40,6 +40,7 @@ extern "C" {
|
||||
|
||||
typedef struct /**** Attribute mapping data ****/
|
||||
{
|
||||
int multivalue; /* Option has multiple values? */
|
||||
const char *name; /* Option/attribute name */
|
||||
ipp_tag_t value_tag; /* Value tag for this attribute */
|
||||
ipp_tag_t group_tag; /* Group tag for this attribute */
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Internet Printing Protocol support functions for the Common UNIX
|
||||
* Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -361,7 +361,12 @@ ippAddOctetString(ipp_t *ipp, /* I - IPP message */
|
||||
|
||||
if (data)
|
||||
{
|
||||
attr->values[0].unknown.data = malloc(datalen);
|
||||
if ((attr->values[0].unknown.data = malloc(datalen)) == NULL)
|
||||
{
|
||||
ippDeleteAttribute(ipp, attr);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
memcpy(attr->values[0].unknown.data, data, datalen);
|
||||
}
|
||||
|
||||
@@ -1014,7 +1019,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
ipp_t *ipp) /* I - IPP data */
|
||||
{
|
||||
int n; /* Length of data */
|
||||
unsigned char buffer[IPP_MAX_LENGTH],
|
||||
unsigned char buffer[IPP_MAX_LENGTH + 1],
|
||||
/* Data buffer */
|
||||
string[IPP_MAX_NAME],
|
||||
/* Small string buffer */
|
||||
@@ -1044,7 +1049,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
* Get the request header...
|
||||
*/
|
||||
|
||||
if ((n = (*cb)(src, buffer, 8)) < 8)
|
||||
if ((*cb)(src, buffer, 8) < 8)
|
||||
{
|
||||
DEBUG_printf(("ippReadIO: Unable to read header (%d bytes read)!\n", n));
|
||||
return (IPP_ERROR);
|
||||
@@ -1182,17 +1187,15 @@ ippReadIO(void *src, /* I - Data source */
|
||||
|
||||
attr->value_tag = tag;
|
||||
}
|
||||
else if (value_tag == IPP_TAG_STRING ||
|
||||
(value_tag >= IPP_TAG_TEXTLANG &&
|
||||
value_tag <= IPP_TAG_MIMETYPE))
|
||||
else if (value_tag >= IPP_TAG_TEXTLANG &&
|
||||
value_tag <= IPP_TAG_MIMETYPE)
|
||||
{
|
||||
/*
|
||||
* String values can sometimes come across in different
|
||||
* forms; accept sets of differing values...
|
||||
*/
|
||||
|
||||
if (tag != IPP_TAG_STRING &&
|
||||
(tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE))
|
||||
if (tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE)
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
else if (value_tag != tag)
|
||||
@@ -1277,7 +1280,11 @@ ippReadIO(void *src, /* I - Data source */
|
||||
if (ipp->current)
|
||||
ipp->prev = ipp->current;
|
||||
|
||||
attr = ipp->current = _ippAddAttr(ipp, 1);
|
||||
if ((attr = ipp->current = _ippAddAttr(ipp, 1)) == NULL)
|
||||
{
|
||||
DEBUG_puts("ippReadIO: unable to allocate attribute!");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
DEBUG_printf(("ippReadIO: name=\'%s\', ipp->current=%p, ipp->prev=%p\n",
|
||||
buffer, ipp->current, ipp->prev));
|
||||
@@ -1325,6 +1332,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
|
||||
value->integer = n;
|
||||
break;
|
||||
|
||||
case IPP_TAG_BOOLEAN :
|
||||
if (n != 1)
|
||||
{
|
||||
@@ -1340,10 +1348,10 @@ ippReadIO(void *src, /* I - Data source */
|
||||
|
||||
value->boolean = buffer[0];
|
||||
break;
|
||||
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_STRING :
|
||||
case IPP_TAG_URI :
|
||||
case IPP_TAG_URISCHEME :
|
||||
case IPP_TAG_CHARSET :
|
||||
@@ -1366,6 +1374,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
DEBUG_printf(("ippReadIO: value = \'%s\'\n",
|
||||
value->string.text));
|
||||
break;
|
||||
|
||||
case IPP_TAG_DATE :
|
||||
if (n != 11)
|
||||
{
|
||||
@@ -1379,6 +1388,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
case IPP_TAG_RESOLUTION :
|
||||
if (n != 9)
|
||||
{
|
||||
@@ -1401,6 +1411,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
value->resolution.units =
|
||||
(ipp_res_t)buffer[8];
|
||||
break;
|
||||
|
||||
case IPP_TAG_RANGE :
|
||||
if (n != 8)
|
||||
{
|
||||
@@ -1421,6 +1432,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
(((((buffer[4] << 8) | buffer[5]) << 8) | buffer[6]) << 8) |
|
||||
buffer[7];
|
||||
break;
|
||||
|
||||
case IPP_TAG_TEXTLANG :
|
||||
case IPP_TAG_NAMELANG :
|
||||
if (n >= sizeof(buffer) || n < 4)
|
||||
@@ -1538,16 +1550,27 @@ ippReadIO(void *src, /* I - Data source */
|
||||
break;
|
||||
|
||||
default : /* Other unsupported values */
|
||||
if (n > sizeof(buffer))
|
||||
if (n > IPP_MAX_LENGTH)
|
||||
{
|
||||
DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
if (!value)
|
||||
{
|
||||
DEBUG_puts("ippReadIO: NULL value!");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
value->unknown.length = n;
|
||||
if (n > 0)
|
||||
{
|
||||
value->unknown.data = malloc(n);
|
||||
if ((value->unknown.data = malloc(n)) == NULL)
|
||||
{
|
||||
DEBUG_puts("ippReadIO: Unable to allocate value");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
if ((*cb)(src, value->unknown.data, n) < n)
|
||||
{
|
||||
DEBUG_puts("ippReadIO: Unable to read unsupported value!");
|
||||
@@ -1941,7 +1964,6 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_STRING :
|
||||
case IPP_TAG_URI :
|
||||
case IPP_TAG_URISCHEME :
|
||||
case IPP_TAG_CHARSET :
|
||||
@@ -2399,7 +2421,8 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
DEBUG_printf(("ippWriteIO: wrote %d bytes\n", bufptr - buffer));
|
||||
DEBUG_printf(("ippWriteIO: wrote %d bytes\n",
|
||||
(int)(bufptr - buffer)));
|
||||
|
||||
/*
|
||||
* If blocking is disabled, stop here...
|
||||
@@ -2507,7 +2530,6 @@ _ippFreeAttr(ipp_attribute_t *attr) /* I - Attribute to free */
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_STRING :
|
||||
case IPP_TAG_URI :
|
||||
case IPP_TAG_URISCHEME :
|
||||
case IPP_TAG_CHARSET :
|
||||
@@ -2546,6 +2568,13 @@ _ippFreeAttr(ipp_attribute_t *attr) /* I - Attribute to free */
|
||||
ippDelete(value->collection);
|
||||
break;
|
||||
|
||||
case IPP_TAG_STRING :
|
||||
for (i = 0, value = attr->values;
|
||||
i < attr->num_values;
|
||||
i ++, value ++)
|
||||
free(value->unknown.data);
|
||||
break;
|
||||
|
||||
default :
|
||||
if (!((int)attr->value_tag & IPP_TAG_COPY))
|
||||
{
|
||||
@@ -2634,7 +2663,6 @@ ipp_length(ipp_t *ipp, /* I - IPP message or collection */
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_STRING :
|
||||
case IPP_TAG_URI :
|
||||
case IPP_TAG_URISCHEME :
|
||||
case IPP_TAG_CHARSET :
|
||||
@@ -2722,7 +2750,7 @@ ipp_read_http(http_t *http, /* I - Client connection */
|
||||
|
||||
|
||||
DEBUG_printf(("ipp_read_http(http=%p, buffer=%p, length=%d)\n",
|
||||
http, buffer, length));
|
||||
http, buffer, (int)length));
|
||||
|
||||
/*
|
||||
* Loop until all bytes are read...
|
||||
|
||||
@@ -63,8 +63,8 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
|
||||
*/
|
||||
|
||||
va_start(ap, message);
|
||||
bytes = vsnprintf(buffer, sizeof(buffer),
|
||||
_cupsLangString(cg->lang_default, message), ap);
|
||||
vsnprintf(buffer, sizeof(buffer),
|
||||
_cupsLangString(cg->lang_default, message), ap);
|
||||
va_end(ap);
|
||||
|
||||
/*
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* I18N/language support for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -16,6 +16,8 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _cupsAppleLanguage() - Get the Apple language identifier associated
|
||||
* with a locale ID.
|
||||
* _cupsEncodingName() - Return the character encoding name string
|
||||
* for the given encoding enumeration.
|
||||
* cupsLangDefault() - Return the default language.
|
||||
@@ -65,26 +67,6 @@ static pthread_mutex_t lang_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
static cups_lang_t *lang_cache = NULL;
|
||||
/* Language string cache */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
static const char *appleLangDefault(void);
|
||||
#endif /* __APPLE__ */
|
||||
static cups_lang_t *cups_cache_lookup(const char *name,
|
||||
cups_encoding_t encoding);
|
||||
static int cups_message_compare(_cups_message_t *m1,
|
||||
_cups_message_t *m2);
|
||||
static void cups_unquote(char *d, const char *s);
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static const char * const lang_encodings[] =
|
||||
{ /* Encoding strings */
|
||||
"us-ascii", "iso-8859-1",
|
||||
@@ -155,6 +137,123 @@ static const char * const lang_encodings[] =
|
||||
"euc-kr", "euc-tw"
|
||||
};
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef struct
|
||||
{
|
||||
const char * const language; /* Language ID */
|
||||
const char * const locale; /* Locale ID */
|
||||
} _apple_language_locale_t;
|
||||
|
||||
static const _apple_language_locale_t apple_language_locale[] =
|
||||
{ /* Locale to language ID LUT */
|
||||
{ "en" , "en_US" },
|
||||
{ "nb" , "no" },
|
||||
{ "zh-Hans" , "zh_CN" },
|
||||
{ "zh-Hant" , "zh_TW" }
|
||||
};
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
static const char *appleLangDefault(void);
|
||||
#endif /* __APPLE__ */
|
||||
static cups_lang_t *cups_cache_lookup(const char *name,
|
||||
cups_encoding_t encoding);
|
||||
static int cups_message_compare(_cups_message_t *m1,
|
||||
_cups_message_t *m2);
|
||||
static void cups_unquote(char *d, const char *s);
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* _cupsAppleLanguage() - Get the Apple language identifier associated
|
||||
* with a locale ID.
|
||||
*/
|
||||
|
||||
const char * /* O - Language ID */
|
||||
_cupsAppleLanguage(const char *locale, /* I - Locale ID */
|
||||
char *language,/* I - Language ID buffer */
|
||||
size_t langsize) /* I - Size of language ID buffer */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
CFStringRef localeid, /* CF locale identifier */
|
||||
langid; /* CF language identifier */
|
||||
|
||||
|
||||
/*
|
||||
* Copy the locale name and convert, as needed, to the Apple-specific
|
||||
* locale identifier...
|
||||
*/
|
||||
|
||||
switch (strlen(locale))
|
||||
{
|
||||
default :
|
||||
/*
|
||||
* Invalid locale...
|
||||
*/
|
||||
|
||||
strlcpy(language, "en", langsize);
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
strlcpy(language, locale, langsize);
|
||||
break;
|
||||
|
||||
case 5 :
|
||||
strlcpy(language, locale, langsize);
|
||||
|
||||
if (language[2] == '-')
|
||||
{
|
||||
/*
|
||||
* Convert ll-cc to ll_CC...
|
||||
*/
|
||||
|
||||
language[2] = '_';
|
||||
language[3] = toupper(language[3] & 255);
|
||||
language[4] = toupper(language[4] & 255);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0;
|
||||
i < (int)(sizeof(apple_language_locale) /
|
||||
sizeof(apple_language_locale[0]));
|
||||
i ++)
|
||||
if (!strcmp(locale, apple_language_locale[i].locale))
|
||||
{
|
||||
strlcpy(language, apple_language_locale[i].language, sizeof(language));
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempt to map the locale ID to a language ID...
|
||||
*/
|
||||
|
||||
if ((localeid = CFStringCreateWithCString(kCFAllocatorDefault, language,
|
||||
kCFStringEncodingASCII)) != NULL)
|
||||
{
|
||||
if ((langid = CFLocaleCreateCanonicalLanguageIdentifierFromString(
|
||||
kCFAllocatorDefault, localeid)) != NULL)
|
||||
{
|
||||
CFStringGetCString(langid, language, langsize, kCFStringEncodingASCII);
|
||||
CFRelease(langid);
|
||||
}
|
||||
|
||||
CFRelease(localeid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return what we got...
|
||||
*/
|
||||
|
||||
return (language);
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsEncodingName()' - Return the character encoding name string
|
||||
@@ -876,7 +975,12 @@ _cupsMessageLoad(const char *filename) /* I - Message catalog to load */
|
||||
return (a);
|
||||
}
|
||||
|
||||
m->id = strdup(ptr);
|
||||
if ((m->id = strdup(ptr)) == NULL)
|
||||
{
|
||||
free(m);
|
||||
cupsFileClose(fp);
|
||||
return (a);
|
||||
}
|
||||
}
|
||||
else if (s[0] == '\"' && m)
|
||||
{
|
||||
@@ -924,7 +1028,11 @@ _cupsMessageLoad(const char *filename) /* I - Message catalog to load */
|
||||
* Set the string...
|
||||
*/
|
||||
|
||||
m->str = strdup(ptr);
|
||||
if ((m->str = strdup(ptr)) == NULL)
|
||||
{
|
||||
cupsFileClose(fp);
|
||||
return (a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -973,30 +1081,6 @@ _cupsMessageLookup(cups_array_t *a, /* I - Message array */
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* Code & data to translate OSX's language names to their ISO 639-1 locale.
|
||||
*
|
||||
* The first version uses the new CoreFoundation API added in 10.3 (Panther),
|
||||
* the second is for 10.2 (Jaguar).
|
||||
*/
|
||||
|
||||
# ifdef HAVE_CF_LOCALE_ID
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char * const name; /* Language name */
|
||||
const char * const locale; /* Locale name */
|
||||
} _apple_name_locale_t;
|
||||
|
||||
static const _apple_name_locale_t apple_name_locale[] =
|
||||
{
|
||||
{ "en" , "en_US" },
|
||||
{ "nb" , "no" },
|
||||
{ "zh-Hans" , "zh_CN" },
|
||||
{ "zh-Hant" , "zh_TW" }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* 'appleLangDefault()' - Get the default locale string.
|
||||
*/
|
||||
@@ -1067,14 +1151,15 @@ appleLangDefault(void)
|
||||
*/
|
||||
|
||||
for (i = 0;
|
||||
i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]);
|
||||
i++)
|
||||
i < (int)(sizeof(apple_language_locale) /
|
||||
sizeof(apple_language_locale[0]));
|
||||
i ++)
|
||||
{
|
||||
if (!strcmp(cg->language, apple_name_locale[i].name))
|
||||
if (!strcmp(cg->language, apple_language_locale[i].language))
|
||||
{
|
||||
DEBUG_printf(("appleLangDefault: mapping \"%s\" to \"%s\"...\n",
|
||||
cg->language, apple_name_locale[i].locale));
|
||||
strlcpy(cg->language, apple_name_locale[i].locale,
|
||||
cg->language, apple_language_locale[i].locale));
|
||||
strlcpy(cg->language, apple_language_locale[i].locale,
|
||||
sizeof(cg->language));
|
||||
break;
|
||||
}
|
||||
@@ -1110,166 +1195,6 @@ appleLangDefault(void)
|
||||
|
||||
return (cg->language);
|
||||
}
|
||||
# else
|
||||
/*
|
||||
* Code & data to translate OSX 10.2's language names to their ISO 639-1
|
||||
* locale.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char * const name; /* Language name */
|
||||
const char * const locale; /* Locale name */
|
||||
} _apple_name_locale_t;
|
||||
|
||||
static const _apple_name_locale_t apple_name_locale[] =
|
||||
{
|
||||
{ "English" , "en_US.UTF-8" }, { "French" , "fr.UTF-8" },
|
||||
{ "German" , "de.UTF-8" }, { "Italian" , "it.UTF-8" },
|
||||
{ "Dutch" , "nl.UTF-8" }, { "Swedish" , "sv.UTF-8" },
|
||||
{ "Spanish" , "es.UTF-8" }, { "Danish" , "da.UTF-8" },
|
||||
{ "Portuguese" , "pt.UTF-8" }, { "Norwegian" , "no.UTF-8" },
|
||||
{ "Hebrew" , "he.UTF-8" }, { "Japanese" , "ja.UTF-8" },
|
||||
{ "Arabic" , "ar.UTF-8" }, { "Finnish" , "fi.UTF-8" },
|
||||
{ "Greek" , "el.UTF-8" }, { "Icelandic" , "is.UTF-8" },
|
||||
{ "Maltese" , "mt.UTF-8" }, { "Turkish" , "tr.UTF-8" },
|
||||
{ "Croatian" , "hr.UTF-8" }, { "Chinese" , "zh.UTF-8" },
|
||||
{ "Urdu" , "ur.UTF-8" }, { "Hindi" , "hi.UTF-8" },
|
||||
{ "Thai" , "th.UTF-8" }, { "Korean" , "ko.UTF-8" },
|
||||
{ "Lithuanian" , "lt.UTF-8" }, { "Polish" , "pl.UTF-8" },
|
||||
{ "Hungarian" , "hu.UTF-8" }, { "Estonian" , "et.UTF-8" },
|
||||
{ "Latvian" , "lv.UTF-8" }, { "Sami" , "se.UTF-8" },
|
||||
{ "Faroese" , "fo.UTF-8" }, { "Farsi" , "fa.UTF-8" },
|
||||
{ "Russian" , "ru.UTF-8" }, { "Chinese" , "zh.UTF-8" },
|
||||
{ "Dutch" , "nl.UTF-8" }, { "Irish" , "ga.UTF-8" },
|
||||
{ "Albanian" , "sq.UTF-8" }, { "Romanian" , "ro.UTF-8" },
|
||||
{ "Czech" , "cs.UTF-8" }, { "Slovak" , "sk.UTF-8" },
|
||||
{ "Slovenian" , "sl.UTF-8" }, { "Yiddish" , "yi.UTF-8" },
|
||||
{ "Serbian" , "sr.UTF-8" }, { "Macedonian" , "mk.UTF-8" },
|
||||
{ "Bulgarian" , "bg.UTF-8" }, { "Ukrainian" , "uk.UTF-8" },
|
||||
{ "Byelorussian", "be.UTF-8" }, { "Uzbek" , "uz.UTF-8" },
|
||||
{ "Kazakh" , "kk.UTF-8" }, { "Azerbaijani", "az.UTF-8" },
|
||||
{ "Azerbaijani" , "az.UTF-8" }, { "Armenian" , "hy.UTF-8" },
|
||||
{ "Georgian" , "ka.UTF-8" }, { "Moldavian" , "mo.UTF-8" },
|
||||
{ "Kirghiz" , "ky.UTF-8" }, { "Tajiki" , "tg.UTF-8" },
|
||||
{ "Turkmen" , "tk.UTF-8" }, { "Mongolian" , "mn.UTF-8" },
|
||||
{ "Mongolian" , "mn.UTF-8" }, { "Pashto" , "ps.UTF-8" },
|
||||
{ "Kurdish" , "ku.UTF-8" }, { "Kashmiri" , "ks.UTF-8" },
|
||||
{ "Sindhi" , "sd.UTF-8" }, { "Tibetan" , "bo.UTF-8" },
|
||||
{ "Nepali" , "ne.UTF-8" }, { "Sanskrit" , "sa.UTF-8" },
|
||||
{ "Marathi" , "mr.UTF-8" }, { "Bengali" , "bn.UTF-8" },
|
||||
{ "Assamese" , "as.UTF-8" }, { "Gujarati" , "gu.UTF-8" },
|
||||
{ "Punjabi" , "pa.UTF-8" }, { "Oriya" , "or.UTF-8" },
|
||||
{ "Malayalam" , "ml.UTF-8" }, { "Kannada" , "kn.UTF-8" },
|
||||
{ "Tamil" , "ta.UTF-8" }, { "Telugu" , "te.UTF-8" },
|
||||
{ "Sinhalese" , "si.UTF-8" }, { "Burmese" , "my.UTF-8" },
|
||||
{ "Khmer" , "km.UTF-8" }, { "Lao" , "lo.UTF-8" },
|
||||
{ "Vietnamese" , "vi.UTF-8" }, { "Indonesian" , "id.UTF-8" },
|
||||
{ "Tagalog" , "tl.UTF-8" }, { "Malay" , "ms.UTF-8" },
|
||||
{ "Malay" , "ms.UTF-8" }, { "Amharic" , "am.UTF-8" },
|
||||
{ "Tigrinya" , "ti.UTF-8" }, { "Oromo" , "om.UTF-8" },
|
||||
{ "Somali" , "so.UTF-8" }, { "Swahili" , "sw.UTF-8" },
|
||||
{ "Kinyarwanda" , "rw.UTF-8" }, { "Rundi" , "rn.UTF-8" },
|
||||
{ "Nyanja" , "" }, { "Malagasy" , "mg.UTF-8" },
|
||||
{ "Esperanto" , "eo.UTF-8" }, { "Welsh" , "cy.UTF-8" },
|
||||
{ "Basque" , "eu.UTF-8" }, { "Catalan" , "ca.UTF-8" },
|
||||
{ "Latin" , "la.UTF-8" }, { "Quechua" , "qu.UTF-8" },
|
||||
{ "Guarani" , "gn.UTF-8" }, { "Aymara" , "ay.UTF-8" },
|
||||
{ "Tatar" , "tt.UTF-8" }, { "Uighur" , "ug.UTF-8" },
|
||||
{ "Dzongkha" , "dz.UTF-8" }, { "Javanese" , "jv.UTF-8" },
|
||||
{ "Sundanese" , "su.UTF-8" }, { "Galician" , "gl.UTF-8" },
|
||||
{ "Afrikaans" , "af.UTF-8" }, { "Breton" , "br.UTF-8" },
|
||||
{ "Inuktitut" , "iu.UTF-8" }, { "Scottish" , "gd.UTF-8" },
|
||||
{ "Manx" , "gv.UTF-8" }, { "Irish" , "ga.UTF-8" },
|
||||
{ "Tongan" , "to.UTF-8" }, { "Greek" , "el.UTF-8" },
|
||||
{ "Greenlandic" , "kl.UTF-8" }, { "Azerbaijani", "az.UTF-8" }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* 'appleLangDefault()' - Get the default locale string.
|
||||
*/
|
||||
|
||||
static const char * /* O - Locale string */
|
||||
appleLangDefault(void)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
CFPropertyListRef localizationList;
|
||||
/* List of localization data */
|
||||
CFStringRef localizationName;
|
||||
/* Current name */
|
||||
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[0])
|
||||
{
|
||||
if ((lang = getenv("LANG")))
|
||||
strlcpy(cg->language, lang, sizeof(cg->language));
|
||||
else
|
||||
{
|
||||
localizationList =
|
||||
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
|
||||
kCFPreferencesCurrentApplication);
|
||||
|
||||
if (localizationList != NULL)
|
||||
{
|
||||
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
|
||||
CFArrayGetCount(localizationList) > 0)
|
||||
{
|
||||
localizationName = CFArrayGetValueAtIndex(localizationList, 0);
|
||||
|
||||
if (localizationName != NULL &&
|
||||
CFGetTypeID(localizationName) == CFStringGetTypeID())
|
||||
{
|
||||
CFIndex length = CFStringGetLength(localizationName);
|
||||
|
||||
if (length <= sizeof(buff) &&
|
||||
CFStringGetCString(localizationName, buff, sizeof(buff),
|
||||
kCFStringEncodingASCII))
|
||||
{
|
||||
buff[sizeof(buff) - 1] = '\0';
|
||||
|
||||
for (i = 0;
|
||||
i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]);
|
||||
i++)
|
||||
{
|
||||
if (!strcasecmp(buff, apple_name_locale[i].name))
|
||||
{
|
||||
strlcpy(cg->language, apple_name_locale[i].locale,
|
||||
sizeof(cg->language));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(localizationList);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we didn't find the language, default to en_US...
|
||||
*/
|
||||
|
||||
if (!cg->language[0])
|
||||
strlcpy(cg->language, apple_name_locale[0].locale, sizeof(cg->language));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the cached locale...
|
||||
*/
|
||||
|
||||
return (cg->language);
|
||||
}
|
||||
# endif /* HAVE_CF_LOCALE_ID */
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
__cups_strcpy
|
||||
__cupsAdminGetServerSettings
|
||||
__cupsAdminSetServerSettings
|
||||
__cupsAppleLanguage
|
||||
__cupsCharmapFlush
|
||||
__cupsCharmapFree
|
||||
__cupsCharmapGet
|
||||
@@ -24,6 +25,7 @@ __cupsStrFormatd
|
||||
__cupsStrFree
|
||||
__cupsStrScand
|
||||
__cupsStrStatistics
|
||||
__httpEncodeURI
|
||||
__httpReadCDSA
|
||||
__httpWriteCDSA
|
||||
__ippAddAttr
|
||||
|
||||
@@ -436,13 +436,6 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
|
||||
strlcpy(ll_CC, "sv_SE", ll_CC_size);
|
||||
else if (!strcmp(ll_CC, "zh")) /* Simplified Chinese */
|
||||
strlcpy(ll_CC, "zh_CN", ll_CC_size);
|
||||
else if (ll_CC_size >= 6)
|
||||
{
|
||||
ll_CC[2] = '_';
|
||||
ll_CC[3] = toupper(ll_CC[0] & 255);
|
||||
ll_CC[4] = toupper(ll_CC[1] & 255);
|
||||
ll_CC[5] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_printf(("ppd_ll_CC: lang->language=\"%s\", ll=\"%s\", ll_CC=\"%s\"...\n",
|
||||
|
||||
@@ -197,11 +197,14 @@ ppdFindChoice(ppd_option_t *o, /* I - Pointer to option */
|
||||
ppd_choice_t *c; /* Current choice */
|
||||
|
||||
|
||||
if (o == NULL || choice == NULL)
|
||||
if (!o || !choice)
|
||||
return (NULL);
|
||||
|
||||
if (choice[0] == '{' || !strncasecmp(choice, "Custom.", 7))
|
||||
choice = "Custom";
|
||||
|
||||
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
|
||||
if (strcasecmp(c->choice, choice) == 0)
|
||||
if (!strcasecmp(c->choice, choice))
|
||||
return (c);
|
||||
|
||||
return (NULL);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Option routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -63,9 +63,14 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
cups_option_t *temp; /* Pointer to new option */
|
||||
|
||||
|
||||
if (name == NULL || !name[0] || value == NULL ||
|
||||
options == NULL || num_options < 0)
|
||||
DEBUG_printf(("cupsAddOption(name=\"%s\", value=\"%s\", num_options=%d, "
|
||||
"options=%p)\n", name, value, num_options, options));
|
||||
|
||||
if (!name || !name[0] || !value || !options || num_options < 0)
|
||||
{
|
||||
DEBUG_printf(("cupsAddOption: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
/*
|
||||
* Look for an existing option with the same name...
|
||||
@@ -81,6 +86,8 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
* No matching option name...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsAddOption: New option...");
|
||||
|
||||
if (num_options == 0)
|
||||
temp = (cups_option_t *)malloc(sizeof(cups_option_t));
|
||||
else
|
||||
@@ -88,7 +95,10 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
(num_options + 1));
|
||||
|
||||
if (temp == NULL)
|
||||
{
|
||||
DEBUG_puts("cupsAddOption: Unable to expand option array, returning 0");
|
||||
return (0);
|
||||
}
|
||||
|
||||
*options = temp;
|
||||
temp += num_options;
|
||||
@@ -122,7 +132,10 @@ cupsFreeOptions(
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
if (num_options <= 0 || options == NULL)
|
||||
DEBUG_printf(("cupsFreeOptions(num_options=%d, options=%p)\n", num_options,
|
||||
options));
|
||||
|
||||
if (num_options <= 0 || !options)
|
||||
return;
|
||||
|
||||
for (i = 0; i < num_options; i ++)
|
||||
@@ -147,13 +160,23 @@ cupsGetOption(const char *name, /* I - Name of option */
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
if (name == NULL || num_options <= 0 || options == NULL)
|
||||
DEBUG_printf(("cupsGetOption(name=\"%s\", num_options=%d, options=%p)\n",
|
||||
name, num_options, options));
|
||||
|
||||
if (!name || num_options <= 0 || !options)
|
||||
{
|
||||
DEBUG_puts("cupsGetOption: Returning NULL");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_options; i ++)
|
||||
if (strcasecmp(options[i].name, name) == 0)
|
||||
if (!strcasecmp(options[i].name, name))
|
||||
{
|
||||
DEBUG_printf(("cupsGetOption: Returning \"%s\"\n", options[i].value));
|
||||
return (options[i].value);
|
||||
}
|
||||
|
||||
DEBUG_puts("cupsGetOption: Returning NULL");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -470,18 +493,41 @@ cupsParseOptions(
|
||||
char *copyarg, /* Copy of input string */
|
||||
*ptr, /* Pointer into string */
|
||||
*name, /* Pointer to name */
|
||||
*value; /* Pointer to value */
|
||||
*value, /* Pointer to value */
|
||||
quote; /* Quote character */
|
||||
|
||||
|
||||
if (arg == NULL || options == NULL || num_options < 0)
|
||||
DEBUG_printf(("cupsParseOptions(arg=\"%s\", num_options=%d, options=%p)\n",
|
||||
arg, num_options, options));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!arg)
|
||||
{
|
||||
DEBUG_printf(("cupsParseOptions: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
if (!options || num_options < 0)
|
||||
{
|
||||
DEBUG_puts("cupsParseOptions: Returning 0");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a copy of the argument string and then divide it up...
|
||||
*/
|
||||
|
||||
copyarg = strdup(arg);
|
||||
ptr = copyarg;
|
||||
if ((copyarg = strdup(arg)) == NULL)
|
||||
{
|
||||
DEBUG_puts("cupsParseOptions: Unable to copy arg string");
|
||||
DEBUG_printf(("cupsParseOptions: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
ptr = copyarg;
|
||||
|
||||
/*
|
||||
* Skip leading spaces...
|
||||
@@ -501,7 +547,7 @@ cupsParseOptions(
|
||||
*/
|
||||
|
||||
name = ptr;
|
||||
while (!isspace(*ptr & 255) && *ptr != '=' && *ptr != '\0')
|
||||
while (!isspace(*ptr & 255) && *ptr != '=' && *ptr)
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
@@ -518,13 +564,15 @@ cupsParseOptions(
|
||||
while (isspace(*ptr & 255))
|
||||
*ptr++ = '\0';
|
||||
|
||||
DEBUG_printf(("cupsParseOptions: name=\"%s\"\n", name));
|
||||
|
||||
if (*ptr != '=')
|
||||
{
|
||||
/*
|
||||
* Start of another option...
|
||||
* Boolean option...
|
||||
*/
|
||||
|
||||
if (strncasecmp(name, "no", 2) == 0)
|
||||
if (!strncasecmp(name, "no", 2))
|
||||
num_options = cupsAddOption(name + 2, "false", num_options,
|
||||
options);
|
||||
else
|
||||
@@ -538,100 +586,84 @@ cupsParseOptions(
|
||||
*/
|
||||
|
||||
*ptr++ = '\0';
|
||||
value = ptr;
|
||||
|
||||
if (*ptr == '\'')
|
||||
while (*ptr && !isspace(*ptr & 255))
|
||||
{
|
||||
/*
|
||||
* Quoted string constant...
|
||||
*/
|
||||
|
||||
ptr ++;
|
||||
value = ptr;
|
||||
|
||||
while (*ptr != '\'' && *ptr != '\0')
|
||||
{
|
||||
if (*ptr == '\\')
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
if (*ptr == ',')
|
||||
ptr ++;
|
||||
}
|
||||
|
||||
if (*ptr != '\0')
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
else if (*ptr == '\"')
|
||||
{
|
||||
/*
|
||||
* Double-quoted string constant...
|
||||
*/
|
||||
|
||||
ptr ++;
|
||||
value = ptr;
|
||||
|
||||
while (*ptr != '\"' && *ptr != '\0')
|
||||
else if (*ptr == '\'' || *ptr == '\"')
|
||||
{
|
||||
if (*ptr == '\\')
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
/*
|
||||
* Quoted string constant...
|
||||
*/
|
||||
|
||||
ptr ++;
|
||||
}
|
||||
quote = *ptr;
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
if (*ptr != '\0')
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
else if (*ptr == '{')
|
||||
{
|
||||
/*
|
||||
* Collection value...
|
||||
*/
|
||||
|
||||
int depth;
|
||||
|
||||
value = ptr;
|
||||
|
||||
for (depth = 1; *ptr; ptr ++)
|
||||
if (*ptr == '{')
|
||||
depth ++;
|
||||
else if (*ptr == '}')
|
||||
while (*ptr != quote && *ptr)
|
||||
{
|
||||
depth --;
|
||||
if (!depth)
|
||||
{
|
||||
ptr ++;
|
||||
if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
if (*ptr != ',')
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (*ptr == '\\')
|
||||
ptr ++;
|
||||
}
|
||||
|
||||
if (*ptr)
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
if (*ptr != '\0')
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Normal space-delimited string...
|
||||
*/
|
||||
|
||||
value = ptr;
|
||||
|
||||
while (!isspace(*ptr & 255) && *ptr != '\0')
|
||||
}
|
||||
else if (*ptr == '{')
|
||||
{
|
||||
if (*ptr == '\\')
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
/*
|
||||
* Collection value...
|
||||
*/
|
||||
|
||||
ptr ++;
|
||||
int depth;
|
||||
|
||||
for (depth = 0; *ptr; ptr ++)
|
||||
{
|
||||
if (*ptr == '{')
|
||||
depth ++;
|
||||
else if (*ptr == '}')
|
||||
{
|
||||
depth --;
|
||||
if (!depth)
|
||||
{
|
||||
ptr ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Normal space-delimited string...
|
||||
*/
|
||||
|
||||
while (!isspace(*ptr & 255) && *ptr)
|
||||
{
|
||||
if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*ptr != '\0')
|
||||
*ptr++ = '\0';
|
||||
|
||||
DEBUG_printf(("cupsParseOptions: value=\"%s\"\n", value));
|
||||
|
||||
/*
|
||||
* Skip trailing whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
*ptr++ = '\0';
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
* Add the string value...
|
||||
@@ -647,6 +679,8 @@ cupsParseOptions(
|
||||
|
||||
free(copyarg);
|
||||
|
||||
DEBUG_printf(("cupsParseOptions: Returning %d\n", num_options));
|
||||
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
@@ -667,12 +701,18 @@ cupsRemoveOption(
|
||||
cups_option_t *option; /* Current option */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsRemoveOption(name=\"%s\", num_options=%d, options=%p)\n",
|
||||
name, num_options, options));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!name || num_options < 1 || !options)
|
||||
{
|
||||
DEBUG_printf(("cupsRemoveOption: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop for the option...
|
||||
@@ -688,6 +728,8 @@ cupsRemoveOption(
|
||||
* Remove this option from the array...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsRemoveOption: Found option, removing it...");
|
||||
|
||||
num_options --;
|
||||
i --;
|
||||
|
||||
@@ -703,6 +745,7 @@ cupsRemoveOption(
|
||||
* Return the new number of options...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsRemoveOption: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* PPD file routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -623,11 +623,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
puts("");
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (strcmp(keyword, "CloseUI") && strcmp(keyword, "CloseGroup") &&
|
||||
strcmp(keyword, "CloseSubGroup") && strncmp(keyword, "Default", 7) &&
|
||||
strcmp(keyword, "JCLCloseUI") && strcmp(keyword, "JCLOpenUI") &&
|
||||
strcmp(keyword, "OpenUI") && strcmp(keyword, "OpenGroup") &&
|
||||
strcmp(keyword, "OpenSubGroup") && string == NULL)
|
||||
if (strncmp(keyword, "Default", 7) && !string)
|
||||
{
|
||||
/*
|
||||
* Need a string value!
|
||||
@@ -814,6 +810,13 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
profile = realloc(ppd->profiles, sizeof(ppd_profile_t) *
|
||||
(ppd->num_profiles + 1));
|
||||
|
||||
if (!profile)
|
||||
{
|
||||
cg->ppd_status = PPD_ALLOC_ERROR;
|
||||
|
||||
goto error;
|
||||
}
|
||||
|
||||
ppd->profiles = profile;
|
||||
profile += ppd->num_profiles;
|
||||
ppd->num_profiles ++;
|
||||
@@ -1091,7 +1094,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
else if (!strcmp(string, "Plus90"))
|
||||
ppd->landscape = 90;
|
||||
}
|
||||
else if (!strcmp(keyword, "Emulators"))
|
||||
else if (!strcmp(keyword, "Emulators") && string)
|
||||
{
|
||||
for (count = 1, sptr = string; sptr != NULL;)
|
||||
if ((sptr = strchr(sptr, ' ')) != NULL)
|
||||
@@ -1102,7 +1105,12 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
}
|
||||
|
||||
ppd->num_emulations = count;
|
||||
ppd->emulations = calloc(count, sizeof(ppd_emul_t));
|
||||
if ((ppd->emulations = calloc(count, sizeof(ppd_emul_t))) == NULL)
|
||||
{
|
||||
cg->ppd_status = PPD_ALLOC_ERROR;
|
||||
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (i = 0, sptr = string; i < count; i ++)
|
||||
{
|
||||
@@ -1866,7 +1874,12 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
* Add the option choice...
|
||||
*/
|
||||
|
||||
choice = ppd_add_choice(option, name);
|
||||
if ((choice = ppd_add_choice(option, name)) == NULL)
|
||||
{
|
||||
cg->ppd_status = PPD_ALLOC_ERROR;
|
||||
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (text[0])
|
||||
cupsCharsetToUTF8((cups_utf8_t *)choice->text, text,
|
||||
@@ -2848,8 +2861,6 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
if (ch == 0x0a)
|
||||
cupsFileGetChar(fp);
|
||||
}
|
||||
|
||||
ch = '\n';
|
||||
}
|
||||
else if (ch < ' ' && ch != '\t' && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* Contents:
|
||||
*
|
||||
* cupsDoFileRequest() - Do an IPP request with a file.
|
||||
* cupsDoIORequest() - Do an IPP request with file descriptors.
|
||||
* cupsDoRequest() - Do an IPP request.
|
||||
* _cupsSetError() - Set the last IPP status code and status-message.
|
||||
* _cupsSetHTTPError() - Set the last error using the HTTP status.
|
||||
|
||||
@@ -61,7 +61,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
for (i = 1, num_settings = 0; i < argc; i ++)
|
||||
for (i = 1, num_settings = 0, settings = NULL; i < argc; i ++)
|
||||
num_settings = cupsParseOptions(argv[i], num_settings, &settings);
|
||||
|
||||
if (cupsAdminSetServerSettings(http, num_settings, settings))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* CUPS API test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -70,8 +70,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
printf("cupsGetDest(\"%s\"): ", dests[num_dests / 2].name);
|
||||
fflush(stdout);
|
||||
|
||||
if ((dest = cupsGetDest(dests[num_dests / 2].name, NULL, num_dests,
|
||||
dests)) == NULL)
|
||||
if (!cupsGetDest(dests[num_dests / 2].name, NULL, num_dests, dests))
|
||||
{
|
||||
status = 1;
|
||||
puts("FAIL");
|
||||
@@ -88,8 +87,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) == NULL)
|
||||
{
|
||||
status = 1;
|
||||
puts("FAIL");
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
@@ -104,8 +103,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if (cupsPrintFile(dest->name, "../data/testprint.ps", "Test Page",
|
||||
dest->num_options, dest->options) <= 0)
|
||||
{
|
||||
status = 1;
|
||||
puts("FAIL");
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* File test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -34,12 +34,14 @@
|
||||
#ifdef HAVE_LIBZ
|
||||
# include <zlib.h>
|
||||
#endif /* HAVE_LIBZ */
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int random_tests(void);
|
||||
static int read_write_tests(int compression);
|
||||
|
||||
|
||||
@@ -51,8 +53,10 @@ int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int status; /* Exit status */
|
||||
char filename[1024]; /* Filename buffer */
|
||||
int status; /* Exit status */
|
||||
char filename[1024]; /* Filename buffer */
|
||||
int fds[2]; /* Open file descriptors */
|
||||
cups_file_t *fdfile; /* File opened with cupsFileOpenFd() */
|
||||
|
||||
|
||||
if (argc == 1)
|
||||
@@ -73,11 +77,51 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
status += read_write_tests(1);
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
/*
|
||||
* Do uncompressed random I/O tests...
|
||||
*/
|
||||
|
||||
status += random_tests();
|
||||
|
||||
/*
|
||||
* Test fdopen and close without reading...
|
||||
*/
|
||||
|
||||
pipe(fds);
|
||||
close(fds[1]);
|
||||
|
||||
fputs("\ncupsFileOpenFd(fd, \"r\"): ", stdout);
|
||||
fflush(stdout);
|
||||
|
||||
if ((fdfile = cupsFileOpenFd(fds[0], "r")) == NULL)
|
||||
{
|
||||
puts("FAIL");
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Able to open file, now close without reading. If we don't return
|
||||
* before the alarm fires, that is a failure and we will crash on the
|
||||
* alarm signal...
|
||||
*/
|
||||
|
||||
puts("PASS");
|
||||
fputs("cupsFileClose(no read): ", stdout);
|
||||
fflush(stdout);
|
||||
|
||||
alarm(5);
|
||||
cupsFileClose(fdfile);
|
||||
alarm(0);
|
||||
|
||||
puts("PASS");
|
||||
}
|
||||
|
||||
/*
|
||||
* Test path functions...
|
||||
*/
|
||||
|
||||
fputs("cupsFileFind: ", stdout);
|
||||
fputs("\ncupsFileFind: ", 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)))
|
||||
@@ -134,6 +178,190 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'random_tests()' - Do random access tests.
|
||||
*/
|
||||
|
||||
static int /* O - Status */
|
||||
random_tests(void)
|
||||
{
|
||||
int status, /* Status of tests */
|
||||
pass, /* Current pass */
|
||||
count, /* Number of records read */
|
||||
record, /* Current record */
|
||||
num_records; /* Number of records */
|
||||
ssize_t pos, /* Position in file */
|
||||
expected; /* Expected position in file */
|
||||
cups_file_t *fp; /* File */
|
||||
char buffer[512]; /* Data buffer */
|
||||
|
||||
|
||||
/*
|
||||
* Run 4 passes, each time appending to a data file and then reopening the
|
||||
* file for reading to validate random records in the file.
|
||||
*/
|
||||
|
||||
for (status = 0, pass = 0; pass < 4; pass ++)
|
||||
{
|
||||
/*
|
||||
* cupsFileOpen(append)
|
||||
*/
|
||||
|
||||
printf("\ncupsFileOpen(append %d): ", pass);
|
||||
|
||||
if ((fp = cupsFileOpen("testfile.dat", "a")) == NULL)
|
||||
{
|
||||
printf("FAIL (%s)\n", strerror(errno));
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
/*
|
||||
* cupsFileTell()
|
||||
*/
|
||||
|
||||
expected = 256 * sizeof(buffer) * pass;
|
||||
|
||||
fputs("cupsFileTell(): ", stdout);
|
||||
if ((pos = cupsFileTell(fp)) != expected)
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of " CUPS_LLFMT ")\n",
|
||||
CUPS_LLCAST pos, CUPS_LLCAST expected);
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
/*
|
||||
* cupsFileWrite()
|
||||
*/
|
||||
|
||||
fputs("cupsFileWrite(256 512-byte records): ", stdout);
|
||||
for (record = 0; record < 256; record ++)
|
||||
{
|
||||
memset(buffer, record, sizeof(buffer));
|
||||
if (cupsFileWrite(fp, buffer, sizeof(buffer)) < sizeof(buffer))
|
||||
break;
|
||||
}
|
||||
|
||||
if (record < 256)
|
||||
{
|
||||
printf("FAIL (%d: %s)\n", record, strerror(errno));
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
/*
|
||||
* cupsFileTell()
|
||||
*/
|
||||
|
||||
expected += 256 * sizeof(buffer);
|
||||
|
||||
fputs("cupsFileTell(): ", stdout);
|
||||
if ((pos = cupsFileTell(fp)) != expected)
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of " CUPS_LLFMT ")\n",
|
||||
CUPS_LLCAST pos, CUPS_LLCAST expected);
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
/*
|
||||
* cupsFileOpen(read)
|
||||
*/
|
||||
|
||||
printf("\ncupsFileOpen(read %d): ", pass);
|
||||
|
||||
if ((fp = cupsFileOpen("testfile.dat", "r")) == NULL)
|
||||
{
|
||||
printf("FAIL (%s)\n", strerror(errno));
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
/*
|
||||
* cupsFileSeek, cupsFileRead
|
||||
*/
|
||||
|
||||
fputs("cupsFileSeek(), cupsFileRead(): ", stdout);
|
||||
|
||||
for (num_records = (pass + 1) * 256, count = (pass + 1) * 256,
|
||||
record = rand() % num_records;
|
||||
count > 0;
|
||||
count --, record = (record + (rand() & 31) - 16 + num_records) %
|
||||
num_records)
|
||||
{
|
||||
/*
|
||||
* The last record is always the first...
|
||||
*/
|
||||
|
||||
if (count == 1)
|
||||
record = 0;
|
||||
|
||||
/*
|
||||
* Try reading the data for the specified record, and validate the
|
||||
* contents...
|
||||
*/
|
||||
|
||||
expected = sizeof(buffer) * record;
|
||||
|
||||
if ((pos = cupsFileSeek(fp, expected)) != expected)
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of " CUPS_LLFMT ")\n",
|
||||
CUPS_LLCAST pos, CUPS_LLCAST expected);
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cupsFileRead(fp, buffer, sizeof(buffer)) != sizeof(buffer))
|
||||
{
|
||||
printf("FAIL (%s)\n", strerror(errno));
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else if ((buffer[0] & 255) != (record & 255) ||
|
||||
memcmp(buffer, buffer + 1, sizeof(buffer) - 1))
|
||||
{
|
||||
printf("FAIL (Bad Data - %d instead of %d)\n", buffer[0] & 255,
|
||||
record & 255);
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
puts("PASS");
|
||||
|
||||
cupsFileClose(fp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the test file...
|
||||
*/
|
||||
|
||||
unlink("testfile.dat");
|
||||
|
||||
/*
|
||||
* Return the test status...
|
||||
*/
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'read_write_tests()' - Perform read/write tests.
|
||||
*/
|
||||
@@ -142,7 +370,7 @@ static int /* O - Status */
|
||||
read_write_tests(int compression) /* I - Use compression? */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_file_t *fp; /* First file */
|
||||
cups_file_t *fp; /* File */
|
||||
int status; /* Exit status */
|
||||
char line[1024], /* Line from file */
|
||||
*value; /* Directive value from line */
|
||||
@@ -150,6 +378,7 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
unsigned char readbuf[8192], /* Read buffer */
|
||||
writebuf[8192]; /* Write buffer */
|
||||
int byte; /* Byte from file */
|
||||
off_t length; /* Length of file */
|
||||
static const char *partial_line = "partial line";
|
||||
/* Partial line */
|
||||
|
||||
@@ -221,7 +450,7 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
fputs("cupsFilePrintf(): ", stdout);
|
||||
|
||||
for (i = 0; i < 1000; i ++)
|
||||
if (cupsFilePrintf(fp, "TestLine %d\n", i) < 0)
|
||||
if (cupsFilePrintf(fp, "TestLine %03d\n", i) < 0)
|
||||
break;
|
||||
|
||||
if (i >= 1000)
|
||||
@@ -282,6 +511,20 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileTell()
|
||||
*/
|
||||
|
||||
fputs("cupsFileTell(): ", stdout);
|
||||
|
||||
if ((length = cupsFileTell(fp)) == 81933283)
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of 81933283)\n", CUPS_LLCAST length);
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileClose()
|
||||
*/
|
||||
@@ -306,7 +549,7 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
* cupsFileOpen(read)
|
||||
*/
|
||||
|
||||
fputs("cupsFileOpen(read): ", stdout);
|
||||
fputs("\ncupsFileOpen(read): ", stdout);
|
||||
|
||||
fp = cupsFileOpen(compression ? "testfile.dat.gz" : "testfile.dat", "r");
|
||||
if (fp)
|
||||
@@ -385,23 +628,9 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
|
||||
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");
|
||||
@@ -467,6 +696,20 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileTell()
|
||||
*/
|
||||
|
||||
fputs("cupsFileTell(): ", stdout);
|
||||
|
||||
if ((length = cupsFileTell(fp)) == 81933283)
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of 81933283)\n", CUPS_LLCAST length);
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileClose()
|
||||
*/
|
||||
@@ -487,6 +730,12 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the test file...
|
||||
*/
|
||||
|
||||
unlink(compression ? "testfile.dat.gz" : "testfile.dat");
|
||||
|
||||
/*
|
||||
* Return the test status...
|
||||
*/
|
||||
|
||||
@@ -299,7 +299,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* httpAddrGetList()
|
||||
*/
|
||||
|
||||
fputs("httpAddrGetList(): ", stdout);
|
||||
printf("httpAddrGetList(%s): ", hostname);
|
||||
|
||||
addrlist = httpAddrGetList(hostname, AF_UNSPEC, NULL);
|
||||
if (addrlist)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Transcoding support for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -132,8 +132,6 @@ _cupsCharmapFlush(void)
|
||||
vnext = vmap->next;
|
||||
|
||||
free_vbcs_charmap(vmap);
|
||||
|
||||
free(vmap);
|
||||
}
|
||||
|
||||
vmap_cache = NULL;
|
||||
@@ -330,13 +328,8 @@ cupsCharsetToUTF8(
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
bytes = conv_sbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding);
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
bytes = conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding);
|
||||
else
|
||||
{
|
||||
DEBUG_puts(" Bad encoding, returning -1");
|
||||
bytes = -1;
|
||||
}
|
||||
bytes = conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding);
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
@@ -437,10 +430,8 @@ cupsUTF8ToCharset(
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
bytes = conv_utf8_to_sbcs((cups_sbcs_t *)dest, src, maxout, encoding);
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
bytes = conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding);
|
||||
else
|
||||
bytes = -1;
|
||||
bytes = conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding);
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
@@ -1468,6 +1459,8 @@ get_vbcs_charmap(
|
||||
{
|
||||
DEBUG_puts(" Unable to get charmap count!");
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1479,9 +1472,10 @@ get_vbcs_charmap(
|
||||
|
||||
if ((vmap = (_cups_vmap_t *)calloc(1, sizeof(_cups_vmap_t))) == NULL)
|
||||
{
|
||||
cupsFileClose(fp);
|
||||
DEBUG_puts(" Unable to allocate memory!");
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -772,7 +772,7 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
|
||||
resource, sizeof(resource), 0))
|
||||
return (NULL);
|
||||
|
||||
DEBUG_printf(("Printer hostname=\"%s\", port=%d\n", hostname, port));
|
||||
DEBUG_printf(("cupsGetPPD3: Printer hostname=\"%s\", port=%d\n", hostname, port));
|
||||
|
||||
/*
|
||||
* Remap local hostname to localhost...
|
||||
@@ -846,9 +846,6 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
|
||||
|
||||
close(fd);
|
||||
|
||||
if (http2 != http)
|
||||
httpClose(http2);
|
||||
|
||||
/*
|
||||
* See if we actually got the file or an error...
|
||||
*/
|
||||
@@ -877,6 +874,9 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (http2 != http)
|
||||
httpClose(http2);
|
||||
|
||||
/*
|
||||
* Return the PPD file...
|
||||
*/
|
||||
@@ -1611,6 +1611,16 @@ cups_get_printer_uri(
|
||||
host, hostsize, port, resource, resourcesize);
|
||||
ippDelete(response);
|
||||
|
||||
if (!strncmp(resource, "/classes/", 9))
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("No printer-uri found for class!"));
|
||||
|
||||
*host = '\0';
|
||||
*resource = '\0';
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -1618,7 +1628,7 @@ cups_get_printer_uri(
|
||||
}
|
||||
|
||||
if (cupsLastError() != IPP_NOT_FOUND)
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, "No printer-uri found!");
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("No printer-uri found!"));
|
||||
|
||||
*host = '\0';
|
||||
*resource = '\0';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
%
|
||||
% PostScript test page for the Common UNIX Printing System ("CUPS").
|
||||
%
|
||||
% Copyright 2007 Apple Inc.
|
||||
% Copyright 2007-2008 Apple Inc.
|
||||
% Copyright 1993-2007 Easy Software Products
|
||||
%
|
||||
% These coded instructions, statements, and computer programs are the
|
||||
@@ -573,10 +573,10 @@ gsave
|
||||
pageHeight 8 mul % Move down...
|
||||
2 copy moveto % Position text
|
||||
smallFont setfont % Font
|
||||
(Copyright 2007 Apple Inc., All Rights Reserved. CUPS and the CUPS logo are the trademark) show
|
||||
(Copyright 2007-2008 Apple Inc., All Rights Reserved. CUPS and the CUPS logo are the) show
|
||||
pageHeight 2 add sub % Move down...
|
||||
2 copy moveto % Position text
|
||||
(property of Apple Inc., 1 Infinite Loop, Cupertino, CA 95014, USA.) show
|
||||
(trademark property of Apple Inc., 1 Infinite Loop, Cupertino, CA 95014, USA.) show
|
||||
pageHeight 2 mul 4 add sub % Move down...
|
||||
moveto % Position text
|
||||
(Need help? Contact your operating system vendor or visit "http://www.cups.org/".) show
|
||||
@@ -593,6 +593,6 @@ gsave
|
||||
grestore
|
||||
showpage
|
||||
%
|
||||
% End of "$Id: testprint.ps 6649 2007-07-11 21:46:42Z mike $".
|
||||
% End of "$Id: testprint.ps 7158 2008-01-02 21:23:11Z mike $".
|
||||
%
|
||||
%%EOF
|
||||
|
||||
@@ -15,6 +15,8 @@ X-KDE-SubstituteUID=false
|
||||
X-KDE-Username=
|
||||
Name=Manage Printing
|
||||
Comment=CUPS Web Interface
|
||||
Name[de]=Druckerverwaltung
|
||||
Comment[de]=CUPS Webinterface
|
||||
Name[en_US]=Manage Printing
|
||||
Comment[en_US]=CUPS Web Interface
|
||||
Name[es]=Administrar impresión
|
||||
@@ -23,14 +25,17 @@ 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
|
||||
Name[he]=נהל הדפסות
|
||||
Comment[he]=ממשק דפדפן של CUPS
|
||||
Name[id]=Manajemen Pencetakan
|
||||
Comment[id]=Antarmuka Web CUPS
|
||||
Name[it]=Gestione stampa
|
||||
Comment[it]=Interfaccia web di CUPS
|
||||
Name[ja]=印刷の管理
|
||||
Comment[ja]=CUPS Web インタフェース
|
||||
Name[pl]=Zarządzanie drukowaniem
|
||||
Comment[pl]=Interfejs WWW CUPS
|
||||
Name[zh]=打印机管理
|
||||
Comment[zh]=CUPS网页界面
|
||||
Name[zh_TW]=印表管理
|
||||
Comment[zh_TW]=CUPS 網頁介面
|
||||
Name[de]=Druckerverwaltung
|
||||
Comment[de]=CUPS Webinterface
|
||||
|
||||
|
||||
@@ -217,18 +217,14 @@ install: all $(INSTALL_LANGUAGES)
|
||||
|
||||
install-languages:
|
||||
for lang in $(LANGUAGES); do \
|
||||
$(INSTALL_DIR) -m 755 $(DOCDIR)/$$lang/images; \
|
||||
if test -f $$lang/index.html; then \
|
||||
$(INSTALL_MAN) $$lang/index.html $(DOCDIR)/$$lang; \
|
||||
if test -d $$lang; then \
|
||||
$(INSTALL_DIR) -m 755 $(DOCDIR)/$$lang/images; \
|
||||
$(INSTALL_MAN) $$lang/index.html $(DOCDIR)/$$lang 2>/dev/null || true; \
|
||||
$(INSTALL_MAN) $$lang/cups.css $(DOCDIR)/$$lang 2>/dev/null || true; \
|
||||
for file in $(WEBBUTTONS); do \
|
||||
$(INSTALL_MAN) $$lang/$$file $(DOCDIR)/$$lang/images 2>/dev/null || true; \
|
||||
done \
|
||||
fi; \
|
||||
if test -f $$lang/cups.css; then \
|
||||
$(INSTALL_MAN) $$lang/cups.css $(DOCDIR)/$$lang; \
|
||||
fi; \
|
||||
for file in $(WEBBUTTONS); do \
|
||||
if test -f $$lang/$$file; then \
|
||||
$(INSTALL_MAN) $$lang/$$file $(DOCDIR)/$$lang/images; \
|
||||
fi; \
|
||||
done \
|
||||
done
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ process using the startup script for your operating system:</P>
|
||||
|
||||
<LI>MacOS X:
|
||||
<PRE CLASS="command">
|
||||
/System/Library/StartupItems/PrintingServices/PrintingServices restart
|
||||
sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
|
||||
sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
|
||||
</PRE></LI>
|
||||
|
||||
</UL>
|
||||
@@ -987,7 +988,7 @@ printers are shared (published) by default. The default is
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>Deny</CODE> directive specifies a hostname, IP
|
||||
address, or network that is allowed access to the server.
|
||||
address, or network that is denied access to the server.
|
||||
<CODE>Deny</CODE> directives are cummulative, so multiple
|
||||
<CODE>Deny</CODE> directives can be used to allow access for
|
||||
multiple hosts or networks. The <CODE>/mm</CODE> notation
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
CUPS IPP specification for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 2007 by Apple Inc.
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 1997-2007 by Easy Software Products.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
@@ -2251,6 +2251,101 @@ the system.
|
||||
<p>The job-sheets-supported attribute specifies the available banner files.
|
||||
There will always be at least one banner file available called "none".
|
||||
|
||||
<h4><a name="marker-change-time">marker-change-time (integer)</a></h4>
|
||||
|
||||
<p>The marker-change-time attribute specifies the printer-up-time value when
|
||||
the last change to the marker-colors, marker-levels, marker-names, or
|
||||
marker-types attributes was made.</p>
|
||||
|
||||
<h4><a name="marker-colors">marker-colors (1setof name(MAX))</a></h4>
|
||||
|
||||
<p>The marker-colors attribute specifies the color(s) for each supply in the
|
||||
printer. It is only available when the driver provides supply levels. The
|
||||
color is either "none" or one or more hex-encoded sRGB colors of the form
|
||||
"#RRGGBB".</p>
|
||||
|
||||
<h4><a name="marker-levels">marker-levels (1setof integer(-1:100))</a></h4>
|
||||
|
||||
<p>The marker-levels attribute specifies the current supply levels for the
|
||||
printer. It is only available when the driver provides supply levels. A
|
||||
value of -1 indicates the level is unknown, while values from 0 to 100
|
||||
indicate the corresponding percentage.</p>
|
||||
|
||||
<h4><a name="marker-names">marker-names (1setof name(MAX))</a></h4>
|
||||
|
||||
<p>The marker-names attribute specifies the name(s) for each supply in the
|
||||
printer. It is only available when the driver provides supply levels.</p>
|
||||
|
||||
<h4><a name="marker-types">marker-types (1setof type3 keyword)</a></h4>
|
||||
|
||||
<p>The marker-types attribute specifies the type(s) of each supply in the
|
||||
printer. It is only available when the driver provides supply levels. The
|
||||
following (RFC 3805) types are currently supported:</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li><tt>toner</tt></li>
|
||||
|
||||
<li><tt>wasteToner</tt></li>
|
||||
|
||||
<li><tt>ink</tt></li>
|
||||
|
||||
<li><tt>inkCartridge</tt></li>
|
||||
|
||||
<li><tt>inkRibbon</tt></li>
|
||||
|
||||
<li><tt>wasteInk</tt></li>
|
||||
|
||||
<li><tt>opc</tt></li>
|
||||
|
||||
<li><tt>developer</tt></li>
|
||||
|
||||
<li><tt>fuserOil</tt></li>
|
||||
|
||||
<li><tt>solidWax</tt></li>
|
||||
|
||||
<li><tt>ribbonWax</tt></li>
|
||||
|
||||
<li><tt>wasteWax</tt></li>
|
||||
|
||||
<li><tt>fuser</tt></li>
|
||||
|
||||
<li><tt>coronaWire</tt></li>
|
||||
|
||||
<li><tt>fuserOilWick</tt></li>
|
||||
|
||||
<li><tt>cleanerUnit</tt></li>
|
||||
|
||||
<li><tt>fuserCleaningPad</tt></li>
|
||||
|
||||
<li><tt>transferUnit</tt></li>
|
||||
|
||||
<li><tt>tonerCartridge</tt></li>
|
||||
|
||||
<li><tt>fuserOiler</tt></li>
|
||||
|
||||
<li><tt>water</tt></li>
|
||||
|
||||
<li><tt>wasteWater</tt></li>
|
||||
|
||||
<li><tt>bindingSupply</tt></li>
|
||||
|
||||
<li><tt>bandingSupply</tt></li>
|
||||
|
||||
<li><tt>stichingWire</tt></li>
|
||||
|
||||
<li><tt>shrinkWrap</tt></li>
|
||||
|
||||
<li><tt>paperWrap</tt></li>
|
||||
|
||||
<li><tt>staples</tt></li>
|
||||
|
||||
<li><tt>inserts</tt></li>
|
||||
|
||||
<li><tt>covers</tt></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h4><a name="port-monitor">port-monitor" (name(127))</a></h4>
|
||||
|
||||
<p>The port-monitor attribute specifies the port monitor to use when printing
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
"$Id: spec-ppd.html 7050 2007-10-31 18:35:56Z mike $"
|
||||
"$Id: spec-ppd.html 7444 2008-04-09 22:41:03Z mike $"
|
||||
|
||||
CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 2007 by Apple Inc.
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 1997-2007 by Easy Software Products.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
@@ -1185,13 +1185,27 @@ text:for%20all%20good%20men%20to%20come%20to%20the%20aid%20of%20their%20country.
|
||||
*cupsIPPReason com.vendor-error/A serious error occurred: "http://www.vendor.com/help"
|
||||
|
||||
<em>*% Map com.vendor-error to text and a local, Apple help book, and remote page</em>
|
||||
*APHelpBook: "file:///Library/Printers/vendor/Help/filename"
|
||||
*APHelpBook: "file:///Library/Printers/vendor/Help.bundle"
|
||||
*cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html
|
||||
help:anchor='com.vendor-error'%20bookID=Vendor%20Help
|
||||
http://www.vendor.com/help"
|
||||
*End
|
||||
</pre>
|
||||
|
||||
<h3><span class='info'>CUPS 1.4</span><a name='cupsMarkerName'>cupsMarkerName</a></h3>
|
||||
|
||||
<p class='summary'>*cupsMarkerName/Name Text: ""</p>
|
||||
|
||||
<p>This optional attribute maps <code>marker-names</code> strings that are
|
||||
generated by the driver to human readable text.</p>
|
||||
|
||||
<p>Examples:</p>
|
||||
|
||||
<pre class='command'>
|
||||
<em>*% Map cyanToner to "Cyan Toner"</em>
|
||||
*cupsMarkerName cyanToner/Cyan Toner: ""
|
||||
</pre>
|
||||
|
||||
<h3><span class='info'>CUPS 1.2</span><a name='cupsLanguages'>cupsLanguages</a></h3>
|
||||
|
||||
<p class='summary'>*cupsLanguages: "locale list"</p>
|
||||
@@ -1204,7 +1218,7 @@ list of locale names ("en", "en_US", "fr_CA", etc.)</p>
|
||||
|
||||
<pre class='command'>
|
||||
<em>*% Specify Canadian, UK, and US English, and Candian and French French</em>
|
||||
*cupsLanguages: "en_CA en_UK en_US fr_CA fr_CA"
|
||||
*cupsLanguages: "en_CA en_UK en_US fr_CA fr_FR"
|
||||
</pre>
|
||||
|
||||
<h3><a name='cupsManualCopies'>cupsManualCopies</a></h3>
|
||||
@@ -1322,21 +1336,6 @@ PPD file extensions was used. Currently it must be the string
|
||||
|
||||
<h2 class='title'><a name='MACOSX'>Mac OS X Attributes</a></h2>
|
||||
|
||||
<h3><a name='APBookFile'>APBookFile</a></h3>
|
||||
|
||||
<p class='summary'>*APBookFile: "file URL"</p>
|
||||
|
||||
<p>This string attribute specifies the Apple help book file to use when
|
||||
looking up IPP reason codes for this printer driver. The
|
||||
<a href='#cupsIPPReason'><tt>cupsIPPReason</tt></a> attribute maps
|
||||
"help" URIs to this file.</p>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre class='command'>
|
||||
*APBookFile: "file:///Library/Printers/vendor/Help/filename"
|
||||
</pre>
|
||||
|
||||
<h3><span class='info'>Mac OS X 10.3</span><a name='APDialogExtension'>APDialogExtension</a></h3>
|
||||
|
||||
<p class='summary'>*APDialogExtension: "/Library/Printers/vendor/filename.plugin"</p>
|
||||
@@ -1445,6 +1444,21 @@ and the <tt>Tumble</tt> page attribute.</p>
|
||||
<p>Also see the related <a href='#cupsBackSide'><tt>cupsBackSide</tt></a>
|
||||
attribute.</p>
|
||||
|
||||
<h3><a name='APHelpBook'>APHelpBook</a></h3>
|
||||
|
||||
<p class='summary'>*APHelpBook: "bundle URL"</p>
|
||||
|
||||
<p>This string attribute specifies the Apple help book bundle to use when
|
||||
looking up IPP reason codes for this printer driver. The
|
||||
<a href='#cupsIPPReason'><tt>cupsIPPReason</tt></a> attribute maps
|
||||
"help" URIs to this file.</p>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre class='command'>
|
||||
*APHelpBook: "file:///Library/Printers/vendor/Help.bundle"
|
||||
</pre>
|
||||
|
||||
<h3><span class='info'>Mac OS X 10.3</span><a name='APPrinterIconPath'>APPrinterIconPath</a></h3>
|
||||
|
||||
<p class='summary'>*APPrinterIconPath: "/Library/Printers/vendor/filename"</p>
|
||||
@@ -1620,7 +1634,7 @@ the device.</p>
|
||||
|
||||
<li>Added custom option values support</li>
|
||||
|
||||
<li>Added <tt>APBookFile</tt> attribute</li>
|
||||
<li>Added <tt>APHelpBook</tt> attribute</li>
|
||||
|
||||
<li>Added <tt>APDuplexRequiresFlippedMargin</tt> attribute</li>
|
||||
|
||||
|
||||
|
Depois Largura: | Altura: | Tamanho: 1.6 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.3 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.2 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.0 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.8 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.0 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.8 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.3 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.2 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.3 KiB |
|
Depois Largura: | Altura: | Tamanho: 904 B |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 1018 B |
|
Depois Largura: | Altura: | Tamanho: 1.5 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.0 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.6 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.7 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.7 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.7 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.5 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 686 B |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |