Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| ada93e7136 |
+6
-71
@@ -1,79 +1,9 @@
|
||||
CHANGES-1.3.txt
|
||||
---------------
|
||||
|
||||
CHANGES IN CUPS V1.3.11
|
||||
|
||||
- The scheduler did not handle partial header lines properly from CGI
|
||||
programs (STR #3194)
|
||||
- The web interface could hang on OpenBSD (STR #3176, STR #3196)
|
||||
- The scheduler and cupsfilter utility did not handle rules starting
|
||||
with a negation operator properly (STR #3160)
|
||||
- The scheduler and cupsfilter utility would crash with certain MIME
|
||||
.types rules (STR #3159)
|
||||
- httpSetField wasn't bracketing IPv6 numeric addresses for the Host:
|
||||
field (STR #3164)
|
||||
- The ServerName, if specified, was not treated as a valid alias for the
|
||||
local system (STR #3167)
|
||||
- "make epm" did not work (STR #3166)
|
||||
- "lpstat -h server" showed non-shared printers (STR #3147)
|
||||
- "make check" did not work on Linux (STR #3161)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3.10
|
||||
|
||||
- Documentation fixes (STR #2994, STR #2995, STR #3008, STR #3056,
|
||||
STR #3057)
|
||||
- SECURITY: The scheduler now protects against DNS rebinding attacks
|
||||
(STR #3118)
|
||||
- SECURITY: Fixed TIFF integer overflow in image filters (STR #3031)
|
||||
- The scheduler did not support the job-hold-until attribute with the
|
||||
Restart-Job operation (STR #3130)
|
||||
- SECURITY: The PNG image reading code did not validate the
|
||||
image size properly, leading to a potential buffer overflow
|
||||
(STR #2974)
|
||||
- The rastertohp driver did not set the 1-sided printing mode when
|
||||
needed (STR #3131)
|
||||
- Now use a wrapper program instead of our fork of the Xpdf code to
|
||||
support printing of PDF files. The new wrapper supports using Xpdf,
|
||||
poppler, or Ghostscript to convert PDF files to PostScript (STR #3129)
|
||||
- Long job names caused problems with some PJL printers (STR #3125)
|
||||
- The lpq command did not work when showing all destinations (STR #3117)
|
||||
- The scheduler used a codeset name of UTF8 which is not supported on
|
||||
Solaris (STR #3113)
|
||||
- cupsGetJobs() did not work with a NULL destination (STR #3107)
|
||||
- Fixed a localization problem for option choices (incorrectly) named
|
||||
"Custom" (STR #3106)
|
||||
- The fallback OpenSSL random number seeding would not work (STR #3079)
|
||||
- The scheduler might miss a child signal, causing high CPU usage.
|
||||
- The scheduler did not enforce quotas after the job history was
|
||||
unloaded (STR #3078)
|
||||
- The job-k-limit, job-page-limit, and job-quota-period attributes
|
||||
could not be set using the lpadmin command (STR #3077)
|
||||
- httpSeparateURI() did not error out on URIs with a missing port
|
||||
number after a colon.
|
||||
- Fixed a Valgrind-detected initialization error when creating a
|
||||
missing directory on startup.
|
||||
- The scheduler did not always read all of the HTTP headers from a
|
||||
CGI script/program.
|
||||
- The scheduler did not always set the "air" property in Bonjour/DNS-SD
|
||||
registrations.
|
||||
- The scheduler incorrectly compared Mac OS X UUIDs for access
|
||||
control, preventing access in certain configurations.
|
||||
- The IPP backend incorrectly reset the required authentication
|
||||
to Kerberos when authentication failed.
|
||||
- The scheduler no longer looks up the local hostname by default;
|
||||
turn on hostname lookups to restore the previous behavior.
|
||||
- The scheduler did not always load MIME type rules correctly
|
||||
(STR #3059)
|
||||
- The test page did not format correctly on A4 paper (STR #3060)
|
||||
- The web interface sometimes incorrectly redirected users to
|
||||
127.0.0.1 (STR #3022)
|
||||
- cupsPrintFile*() did not send the document filename for single
|
||||
file submissions (STR #3055)
|
||||
- The scheduler did not update the member-names attribute when
|
||||
removing the last printer from a class.
|
||||
- The scheduler did not report PPD Products with parenthesis
|
||||
in them properly (STR #3046)
|
||||
- Documentation fixes (STR #2994, STR #2995, STR #3008)
|
||||
- The wrong italic fonts were listed in the UTF-8 charset file
|
||||
for the text filter.
|
||||
- The backends did not return an OK status for the
|
||||
@@ -105,6 +35,11 @@ CHANGES IN CUPS V1.3.10
|
||||
- The scheduler now rejects ATTR: messages with empty values.
|
||||
- The scheduler could consume all CPU handling closed connections
|
||||
(STR #2988)
|
||||
- The scheduler now protects against DNS rebinding attacks on
|
||||
localhost.
|
||||
- SECURITY: The PNG image reading code did not validate the
|
||||
image size properly, leading to a potential buffer overflow
|
||||
(STR #2974)
|
||||
- Fixed some configure script bugs with rc/xinetd directories
|
||||
(STR #2970)
|
||||
- The Epson sample driver PPDs contained errors (STR #2979)
|
||||
|
||||
+1
-135
@@ -1,140 +1,6 @@
|
||||
CHANGES.txt - 2009-05-16
|
||||
CHANGES.txt - 2008-12-15
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.4b3
|
||||
|
||||
- Documentation fixes (STR #3044, STR #3057, STR #3153, STR #3158,
|
||||
STR #3173)
|
||||
- Added complete localizations for German, Japanese, Polish, and
|
||||
Russian and partial localizations for Chinese, Danish, Finnish,
|
||||
French, Italian, Korean, Norwegian, Portuguese, and Swedish
|
||||
(STR #3096, STR #3098, STR #3109, STR #3111, STR #3141)
|
||||
- Updated the configure check for -fstack-protector (STR #3198)
|
||||
- The network backends now correctly convert SNMP supply descriptions to
|
||||
UTF-8 encoding as needed.
|
||||
- The scheduler could crash when deleting an attribute (STR #3197)
|
||||
- The cups-driverd program did not detect symlink loops (STR #3185)
|
||||
- The EPSON 24-pin series driver should now feed the correct amount
|
||||
(STR #2624)
|
||||
- The scheduler now automatically logs the last N debug messages for
|
||||
failed print jobs.
|
||||
- You can now modify a raw print queue (STR #3133)
|
||||
- Fixed a number of ppdi issues and added a unit test to validate that
|
||||
ppdc + ppdi can generate and import the same data (STR #3152)
|
||||
- Moving jobs in the web interface now shows an error if you only have
|
||||
one printer or class added (STR #3094)
|
||||
- Since classes have never truly supported the printer-error-policy
|
||||
stuff added in CUPS 1.2, update the code to reflect the current
|
||||
reality and support only the retry-current-job policy for now
|
||||
(STR #3171)
|
||||
- Revised the password callback support (STR #2953)
|
||||
- ppdEmit*() did not choose between PageSize and PageRegion properly.
|
||||
- Make some fairly substantial changes to the Kerberos support code so
|
||||
that CUPS can work in multi-realm environments and does not require
|
||||
delegatable credentials. Shared printing still requires delegation,
|
||||
however "delegation by policy" can be enabled in the KDC to make this
|
||||
all work.
|
||||
- "AccessLogLevel actions" did not hide client-error-not-found errors.
|
||||
- AP_FIRST_InputSlot did not work with number-up.
|
||||
- cupsBackChannelRead() and cupsBackChannelWrite() could fail due to a
|
||||
lack of kernel buffers.
|
||||
- The IPP and LPD backends did not respond to side-channel requests
|
||||
while copying print data to a temporary file.
|
||||
- cupsWriteRequestData() flushed the output buffer unnecessarily,
|
||||
causing reduced performance in some situations.
|
||||
- If a CGI process died before sending its MIME headers, the request
|
||||
would hang on the client.
|
||||
- The printer/class/job search feature on the web interface did not
|
||||
work (STR #3132)
|
||||
- The scheduler did not write the printers out for classes.
|
||||
- CUPS-Get-PPDs did not work properly when filtering by language,
|
||||
product, or psversion (STR #3136)
|
||||
- The scheduler now kills job filters when it takes more than 30 seconds
|
||||
(configurable) to cancel or hold the job.
|
||||
- The cupstestppd program did not validate the capitalization of
|
||||
filenames in the PPD file.
|
||||
- The cupstestppd program did not validate the PageSize and PageRegion
|
||||
values.
|
||||
- The cups-deviced helper program could miss reporting some backend
|
||||
devices (STR #3108)
|
||||
- The cupsSideChannelSNMP* functions did not work.
|
||||
- The scheduler could consume 100% CPU when jobs were canceled.
|
||||
- Clicking on "Select Another Make/Manufacturer" in the web interface
|
||||
incorrectly added the printer (STR #3095)
|
||||
- The scheduler no longer uses programs with insecure file
|
||||
permissions.
|
||||
- httpAssembleURI*() did not escape backslashes in hostnames.
|
||||
- The dnssd backend did not unquote "full names" before creating the
|
||||
device URI.
|
||||
- The scheduler now supports JobRetryInterval values less than 10
|
||||
seconds.
|
||||
- Updated the Spanish localization (STR #3090)
|
||||
- The scheduler did not redo Bonjour/DNS-SD registrations when updating
|
||||
them failed.
|
||||
- The "authenticated" policy incorrectly required authentication for
|
||||
status operations.
|
||||
- ppdOpen*() incorrectly loaded PPDs with multiple JobPatchFile
|
||||
keywords.
|
||||
- The network backends no longer report the SNMP "offline" or
|
||||
maintenance status bits since they are inconsistently implemented and
|
||||
often unreliable.
|
||||
- The scheduler no longer logs child processes killed via SIGKILL as
|
||||
"crashed".
|
||||
- The printer link shown on the "job moved" template was bad (STR #3085)
|
||||
- Updated the HTML templates to use the final HTML 4 DOCTYPE (STR #3086)
|
||||
- The scheduler did not track the "paused" reason properly if a
|
||||
printer had other reasons associated with it.
|
||||
- cupsSendRequest() did not clear old local certificate auth data.
|
||||
- The PPD compiler did not search for localization files properly
|
||||
(STR #3084)
|
||||
- cupsGetNamedDest() did not use the fallback default like
|
||||
cupsGetDests*() (STR #3082)
|
||||
- The scheduler now provides a LogTimeFormat directive to enable
|
||||
microseconds in the date and time that are logged.
|
||||
- The scheduler now provides a MultipleOperationTimeout directive to
|
||||
control the timeout for multi-file print jobs.
|
||||
- The configure script incorrectly allowed Avahi to be used for DNS-SD
|
||||
printer discovery (STR #3065)
|
||||
- The web interface and scheduler did not support URIs up to 1024 bytes
|
||||
in length (STR #3072)
|
||||
- Fixed pdftops issues with page sizes (STR #3063)
|
||||
- Fixed pdftops issues with Ghostscript (STR #3062)
|
||||
- The scheduler incorrectly registered default profiles for PostScript
|
||||
printers with no specified colorspace.
|
||||
- The scheduler incorrectly created an empty org.cups.printers.plist
|
||||
file on Mac OS X.
|
||||
- cupsGetPPD3() did not look for local PPDs in the right directory.
|
||||
- SNMP lookups via side-channel did not work for NULL-VALUE and
|
||||
and OCTET-STRING OIDs containing nul characters.
|
||||
- The libusb-based USB backend did not work.
|
||||
- The scheduler did not set the printer-commands attribute correctly
|
||||
for some PPDs.
|
||||
- The ppdi utility did not work.
|
||||
- The web interface no longer uses multi-part output with old or broken
|
||||
web browsers (STR #3049)
|
||||
- CUPS now conforms to the draft IPP/2.0 and IPP/2.1 specification.
|
||||
- Added a new cupsGetConflicts() API to get a list of conflicting
|
||||
options.
|
||||
- The PPD compiler didn't localize options or choices that did not
|
||||
have associated translation text (STR #3045)
|
||||
- Updated the Spanish localization (STR #3043)
|
||||
- Fixed build problems (STR #3040, STR #3047)
|
||||
- cupsResolveConflicts() did not resolve using the default option
|
||||
choice in some cases due to the mirror UIConstraints that are
|
||||
present in most PPD files.
|
||||
- The scheduler did not honor MIME type priorities.
|
||||
- The commandtops filter incorrectly used the JCLBegin code to end
|
||||
its jobs.
|
||||
- The default BrowseLocalProtocols value was not set properly.
|
||||
- Since the commandtops filter does not actually support ReportLevels
|
||||
all on its own, don't list that printer command by default for PS
|
||||
printers.
|
||||
- The scheduler did not give filters a chance to log errors or update
|
||||
printer attributes when a job was canceled.
|
||||
- The scheduler did not clear the "connecting-to-device" reason keyword
|
||||
when a job finished.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.4b2
|
||||
|
||||
- Documentation updates (STR #2983, STR #2998, STR #3021)
|
||||
|
||||
+4
-11
@@ -1,4 +1,4 @@
|
||||
INSTALL - CUPS v1.4b3 - 2009-05-19
|
||||
INSTALL - CUPS v1.4b2 - 2008-12-15
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source code. For more
|
||||
@@ -179,16 +179,9 @@ GETTING DEBUG LOGGING FROM CUPS
|
||||
|
||||
When configured with the "--enable-debug-printfs" option, CUPS compiles in
|
||||
additional debug logging support in the scheduler, CUPS API, and CUPS
|
||||
Imaging API. The following environment variables are used to enable and
|
||||
control debug logging:
|
||||
|
||||
CUPS_DEBUG_FILTER Specifies a POSIX regular expression to control
|
||||
which messages are logged.
|
||||
CUPS_DEBUG_LEVEL Specifies a number from 0 to 9 to control the
|
||||
verbosity of the logging. The default level is 1.
|
||||
CUPS_DEBUG_LOG Specifies a log file to use. Specify the name "-"
|
||||
to send the messages to stderr. Prefix a filename
|
||||
with "+" to append to an existing file.
|
||||
Imaging API. Set the CUPS_DEBUG_LOG environment variable to a filename to
|
||||
append logging information at run-time. Use the name "-" to send the
|
||||
messages to stderr.
|
||||
|
||||
|
||||
REPORTING PROBLEMS
|
||||
|
||||
+13
-18
@@ -1,6 +1,6 @@
|
||||
CUPS License Agreement
|
||||
Common UNIX Printing System License Agreement
|
||||
|
||||
Copyright 2007-2009 by Apple Inc.
|
||||
Copyright 2007 by Apple Inc.
|
||||
1 Infinite Loop
|
||||
Cupertino, CA 95014 USA
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
CUPS(tm) is provided under the GNU General Public License ("GPL")
|
||||
and GNU Library General Public License ("LGPL"), Version 2, with
|
||||
exceptions for Apple operating systems and the OpenSSL toolkit. A
|
||||
copy of the exceptions and licenses follow this introduction.
|
||||
The Common UNIX Printing System(tm), ("CUPS(tm)"), is provided
|
||||
under the GNU General Public License ("GPL") and GNU Library
|
||||
General Public License ("LGPL"), Version 2, with exceptions for
|
||||
Apple operating systems and the OpenSSL toolkit. A copy of the
|
||||
exceptions and licenses follow this introduction.
|
||||
|
||||
The GNU LGPL applies to the CUPS and CUPS Imaging libraries
|
||||
located in the "cups" and "filter" subdirectories of the CUPS
|
||||
@@ -136,18 +137,12 @@ redistribute it freely, subject to the following restrictions:
|
||||
|
||||
TRADEMARKS
|
||||
|
||||
CUPS and the CUPS logo (the "CUPS Marks") are trademarks of Apple
|
||||
Inc. Apple grants you a non-exclusive and non-transferable right
|
||||
to use the CUPS Marks in any direct port or binary distribution
|
||||
incorporating CUPS software and in any promotional material
|
||||
therefor. You agree that your products will meet the highest
|
||||
levels of quality and integrity for similar goods, not be unlawful,
|
||||
and be developed, manufactured, and distributed in compliance with
|
||||
this license. You will not interfere with Apple's rights in the
|
||||
CUPS Marks, and all use of the CUPS Marks shall inure to the
|
||||
benefit of Apple. This license does not apply to use of the CUPS
|
||||
Marks in a derivative products, which requires prior written
|
||||
permission from Apple Inc.
|
||||
Apple Inc. has trademarked the Common UNIX Printing System, CUPS,
|
||||
and CUPS logo. You may use these names and logos in any direct port
|
||||
or binary distribution of CUPS. Please contact Apple Inc. for written
|
||||
permission to use them in derivative products. Our intention is to
|
||||
protect the value of these trademarks and ensure that any derivative
|
||||
product meets the same high-quality standards as the original.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
+9
-8
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Common makefile definitions for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2009 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
|
||||
@@ -36,17 +36,18 @@ RMDIR = @RMDIR@
|
||||
SED = @SED@
|
||||
SHELL = /bin/sh
|
||||
|
||||
|
||||
#
|
||||
# Installation programs...
|
||||
#
|
||||
|
||||
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
|
||||
INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
|
||||
INSTALL_DATA = $(INSTALL) -c -m 444
|
||||
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755 @INSTALL_STRIP@
|
||||
INSTALL_CONFIG = $(INSTALL) -m @CUPS_CONFIG_FILE_PERM@
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
INSTALL_DIR = $(INSTALL) -d
|
||||
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
|
||||
INSTALL_MAN = $(INSTALL) -c -m 444
|
||||
INSTALL_SCRIPT = $(INSTALL) -c -m 555
|
||||
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755 @INSTALL_STRIP@
|
||||
INSTALL_MAN = $(INSTALL) -m 644
|
||||
INSTALL_SCRIPT = $(INSTALL) -m 755
|
||||
|
||||
#
|
||||
# Default user, group, and system groups for the scheduler...
|
||||
@@ -143,7 +144,7 @@ LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \
|
||||
LEGACY_BACKENDS = @LEGACY_BACKENDS@
|
||||
LIBCUPSORDER = @LIBCUPSORDER@
|
||||
LIBCUPSIMAGEORDER = @LIBCUPSIMAGEORDER@
|
||||
LINKCUPS = @LINKCUPS@ $(SSLLIBS) $(DNSSDLIBS)
|
||||
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
|
||||
LINKCUPSIMAGE = @LINKCUPSIMAGE@
|
||||
LIBS = $(LINKCUPS) $(COMMONLIBS)
|
||||
OPTIM = @OPTIM@
|
||||
|
||||
+9
-64
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Top-level Makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2009 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
|
||||
@@ -316,88 +316,33 @@ uninstall:
|
||||
fi \
|
||||
$(RMDIR) $(BUILDROOT)$(INITDDIR); \
|
||||
fi
|
||||
if test "x$(SMFMANIFESTDIR)" != x; then \
|
||||
echo Uninstalling SMF manifest in $(SMFMANIFESTDIR)...;\
|
||||
$(RM) $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
|
||||
fi
|
||||
if test "x$(DBUSDIR)" != x; then \
|
||||
echo Uninstalling cups.conf in $(DBUSDIR)...;\
|
||||
$(RM) $(BUILDROOT)$(DBUSDIR)/cups.conf; \
|
||||
$(RMDIR) $(BUILDROOT)$(DBUSDIR); \
|
||||
fi
|
||||
if test "x$(XINETD)" != x; then \
|
||||
echo Uninstalling xinetd configuration file for cups-lpd...; \
|
||||
$(RM) $(BUILDROOT)$(XINETD)/cups-lpd; \
|
||||
fi
|
||||
if test "x$(MENUDIR)" != x; then \
|
||||
echo Uninstalling desktop menu...; \
|
||||
$(RM) $(BUILDROOT)$(MENUDIR)/cups.desktop; \
|
||||
fi
|
||||
if test "x$(ICONDIR)" != x; then \
|
||||
echo Uninstalling desktop icons...; \
|
||||
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps/cups.png; \
|
||||
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps/cups.png; \
|
||||
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps/cups.png; \
|
||||
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps/cups.png; \
|
||||
fi
|
||||
$(RM) $(BUILDROOT)/etc/xinetd.d/cups-lpd
|
||||
$(RM) $(BUILDROOT)/usr/share/applications/cups.desktop
|
||||
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/16x16/apps/cups.png
|
||||
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/32x32/apps/cups.png
|
||||
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/64x64/apps/cups.png
|
||||
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/128x128/apps/cups.png
|
||||
|
||||
|
||||
#
|
||||
# Run the test suite...
|
||||
#
|
||||
|
||||
test: all unittests
|
||||
test: all
|
||||
echo Running CUPS test suite...
|
||||
cd test; ./run-stp-tests.sh
|
||||
|
||||
|
||||
check: all unittests
|
||||
check: all
|
||||
echo Running CUPS test suite with defaults...
|
||||
cd test; ./run-stp-tests.sh 1 0 n
|
||||
|
||||
|
||||
#
|
||||
# Create HTML documentation...
|
||||
#
|
||||
|
||||
apihelp:
|
||||
for dir in cgi-bin cups filter driver ppdc scheduler; do\
|
||||
echo Generating API help in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
|
||||
done
|
||||
|
||||
framedhelp:
|
||||
for dir in cgi-bin cups filter driver ppdc scheduler; do\
|
||||
echo Generating framed API help in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) framedhelp) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Create an Xcode docset...
|
||||
#
|
||||
|
||||
docset: apihelp
|
||||
echo Generating docset directory tree...
|
||||
$(RM) -r org.cups.docset
|
||||
mkdir -p org.cups.docset/Contents/Resources/Documentation/help
|
||||
mkdir -p org.cups.docset/Contents/Resources/Documentation/images
|
||||
cd man; $(MAKE) $(MFLAGS) html
|
||||
cd doc; $(MAKE) $(MFLAGS) docset
|
||||
cd cgi-bin; $(MAKE) $(MFLAGS) makedocset
|
||||
cgi-bin/makedocset org.cups.docset \
|
||||
`svnversion . | sed -e '1,$$s/[a-zA-Z]//g'` \
|
||||
doc/help/api-*.tokens
|
||||
$(RM) doc/help/api-*.tokens
|
||||
echo Indexing docset...
|
||||
/Developer/usr/bin/docsetutil index org.cups.docset
|
||||
echo Generating docset archive and feed...
|
||||
/Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
|
||||
--atom org.cups.docset.atom \
|
||||
--download-url http://www.cups.org/org.cups.docset.xar \
|
||||
org.cups.docset
|
||||
|
||||
|
||||
#
|
||||
# Make software distributions using EPM (http://www.easysw.com/epm/)...
|
||||
#
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
README - CUPS v1.4b3 - 2009-05-19
|
||||
README - CUPS v1.4b2 - 2008-12-15
|
||||
---------------------------------
|
||||
|
||||
**********************************************************************
|
||||
@@ -20,13 +20,13 @@ instead...
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
CUPS is a standards-based, open source printing system developed by Apple
|
||||
Inc. for Mac OS® X and other UNIX®-like operating systems. CUPS uses the
|
||||
Internet Printing Protocol ("IPP") and provides System V and Berkeley
|
||||
command-line interfaces, a web interface, and a C API to manage printers and
|
||||
print jobs. It supports printing to both local (parallel, serial, USB) and
|
||||
networked printers, and printers can be shared from one computer to another,
|
||||
even over the Internet!
|
||||
The Common UNIX Printing System ("CUPS") is a standards-based, open source
|
||||
printing system developed by Apple Inc. for Mac OS® X and other UNIX®-like
|
||||
operating systems. CUPS uses the Internet Printing Protocol ("IPP") and
|
||||
provides System V and Berkeley command-line interfaces, a web interface,
|
||||
and a C API to manage printers and print jobs. It supports printing to
|
||||
both local (parallel, serial, USB) and networked printers, and printers can
|
||||
be shared from one computer to another, even over the Internet!
|
||||
|
||||
Internally, CUPS uses PostScript Printer Description ("PPD") files to
|
||||
describe printer capabilities and features and a wide variety of generic
|
||||
@@ -163,8 +163,8 @@ PRINTING FILES
|
||||
|
||||
LEGAL STUFF
|
||||
|
||||
CUPS is Copyright 2007-2009 by Apple Inc. CUPS and the CUPS logo are
|
||||
trademarks of Apple Inc.
|
||||
CUPS is Copyright 2007-2008 by Apple Inc. CUPS, the CUPS logo, and the
|
||||
Common UNIX Printing System are trademarks of Apple Inc.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
|
||||
|
||||
+8
-9
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Backend makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2009 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
|
||||
@@ -19,8 +19,8 @@ include ../Makedefs
|
||||
|
||||
RBACKENDS = ipp lpd $(DNSSD_BACKEND)
|
||||
UBACKENDS = $(PAP) $(LEGACY_BACKENDS) serial snmp socket usb
|
||||
UNITTESTS = test1284 testbackend testsupplies
|
||||
TARGETS = libbackend.a $(RBACKENDS) $(UBACKENDS)
|
||||
TARGETS = test1284 testbackend testsupplies \
|
||||
libbackend.a $(RBACKENDS) $(UBACKENDS)
|
||||
LIBOBJS = ieee1284.o network.o runloop.o snmp-supplies.o
|
||||
OBJS = ipp.o lpd.o dnssd.o pap.o parallel.o scsi.o serial.o snmp.o \
|
||||
socket.o test1284.o testbackend.o testsupplies.o usb.o
|
||||
@@ -44,7 +44,7 @@ libs:
|
||||
# Make unit tests...
|
||||
#
|
||||
|
||||
unittests: $(UNITTESTS)
|
||||
unittests:
|
||||
|
||||
|
||||
#
|
||||
@@ -52,7 +52,7 @@ unittests: $(UNITTESTS)
|
||||
#
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(TARGETS) $(UNITTESTS) $(LIBOBJS) http mdns
|
||||
$(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http mdns
|
||||
|
||||
|
||||
#
|
||||
@@ -137,7 +137,7 @@ uninstall:
|
||||
test1284: test1284.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o test1284 test1284.o ../cups/libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
@@ -147,7 +147,7 @@ test1284: test1284.o ../cups/libcups.a
|
||||
testbackend: testbackend.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o testbackend testbackend.o ../cups/libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
@@ -157,8 +157,7 @@ testbackend: testbackend.o ../cups/libcups.a
|
||||
testsupplies: testsupplies.o libbackend.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o testsupplies testsupplies.o libbackend.a \
|
||||
../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ)
|
||||
../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Backend support definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -78,7 +78,6 @@ extern "C" {
|
||||
#define CUPS_OID_prtGeneral CUPS_OID_printmib,5
|
||||
#define CUPS_OID_prtGeneralTable CUPS_OID_prtGeneral,1
|
||||
#define CUPS_OID_prtGeneralEntry CUPS_OID_prtGeneralTable,1
|
||||
#define CUPS_OID_prtGeneralCurrentLocalization CUPS_OID_prtGeneralEntry,2
|
||||
#define CUPS_OID_prtGeneralPrinterName CUPS_OID_prtGeneralEntry,16
|
||||
#define CUPS_OID_prtGeneralSerialNumber CUPS_OID_prtGeneralEntry,17
|
||||
|
||||
@@ -88,11 +87,6 @@ extern "C" {
|
||||
#define CUPS_OID_prtCoverDescription CUPS_OID_prtCoverEntry,2
|
||||
#define CUPS_OID_prtCoverStatus CUPS_OID_prtCoverEntry,3
|
||||
|
||||
#define CUPS_OID_prtLocalization CUPS_OID_printmib,7
|
||||
#define CUPS_OID_prtLocalizationTable CUPS_OID_prtLocalization,1
|
||||
#define CUPS_OID_prtLocalizationEntry CUPS_OID_prtLocalizationTable,1
|
||||
#define CUPS_OID_prtLocalizationCharacterSet CUPS_OID_prtLocalizationEntry,4
|
||||
|
||||
#define CUPS_OID_prtMarker CUPS_OID_printmib,10
|
||||
#define CUPS_OID_prtMarkerTable CUPS_OID_prtMarker,2
|
||||
#define CUPS_OID_prtMarkerEntry CUPS_OID_prtMarkerTable,1
|
||||
@@ -244,22 +238,6 @@ extern "C" {
|
||||
#define CUPS_TC_inserts 33
|
||||
#define CUPS_TC_covers 34
|
||||
|
||||
/* These come from RFC 3808 to define character sets we support */
|
||||
/* Also see http://www.iana.org/assignments/character-sets */
|
||||
#define CUPS_TC_csASCII 3
|
||||
#define CUPS_TC_csISOLatin1 4
|
||||
#define CUPS_TC_csShiftJIS 17
|
||||
#define CUPS_TC_csUTF8 106
|
||||
#define CUPS_TC_csUnicode 1000 /* UCS2 BE */
|
||||
#define CUPS_TC_csUCS4 1001 /* UCS4 BE */
|
||||
#define CUPS_TC_csUnicodeASCII 1002
|
||||
#define CUPS_TC_csUnicodeLatin1 1003
|
||||
#define CUPS_TC_csUTF16BE 1013
|
||||
#define CUPS_TC_csUTF16LE 1014
|
||||
#define CUPS_TC_csUTF32 1017
|
||||
#define CUPS_TC_csUTF32BE 1018
|
||||
#define CUPS_TC_csUTF32LE 1019
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
|
||||
+106
-216
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* DNS-SD discovery backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2008-2009 by Apple Inc.
|
||||
* Copyright 2008 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -19,11 +19,8 @@
|
||||
* browse_callback() - Browse devices.
|
||||
* browse_local_callback() - Browse local devices.
|
||||
* compare_devices() - Compare two devices.
|
||||
* exec_backend() - Execute the backend that corresponds to the
|
||||
* resolved service name.
|
||||
* get_device() - Create or update a device.
|
||||
* query_callback() - Process query data.
|
||||
* sigterm_handler() - Handle termination signals...
|
||||
* unquote() - Unquote a name string.
|
||||
*/
|
||||
|
||||
@@ -56,8 +53,7 @@ typedef struct
|
||||
char *name, /* Service name */
|
||||
*domain, /* Domain name */
|
||||
*fullName, /* Full name */
|
||||
*make_and_model, /* Make and model from TXT record */
|
||||
*device_id; /* 1284 device ID from TXT record */
|
||||
*make_and_model; /* Make and model from TXT record */
|
||||
cups_devtype_t type; /* Device registration type */
|
||||
int priority, /* Priority associated with type */
|
||||
cups_shared, /* CUPS shared printer? */
|
||||
@@ -65,14 +61,6 @@ typedef struct
|
||||
} cups_device_t;
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static int job_canceled = 0;
|
||||
/* Set to 1 on SIGTERM */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
@@ -106,7 +94,6 @@ static void query_callback(DNSServiceRef sdRef,
|
||||
uint16_t rrclass, uint16_t rdlen,
|
||||
const void *rdata, uint32_t ttl,
|
||||
void *context);
|
||||
static void sigterm_handler(int sig);
|
||||
static void unquote(char *dst, const char *src, size_t dstsize);
|
||||
|
||||
|
||||
@@ -135,34 +122,14 @@ main(int argc, /* I - Number of command-line args */
|
||||
struct timeval timeout; /* Timeout for select() */
|
||||
cups_array_t *devices; /* Device array */
|
||||
cups_device_t *device; /* Current device */
|
||||
char uriName[1024]; /* Unquoted fullName for URI */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
/*
|
||||
* Don't buffer stderr, and catch SIGTERM...
|
||||
*/
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, sigterm_handler);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTERM, &action, sigterm_handler);
|
||||
#else
|
||||
signal(SIGTERM, sigterm_handler);
|
||||
#endif /* HAVE_SIGSET */
|
||||
|
||||
/*
|
||||
* Check command-line...
|
||||
*/
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
if (argc >= 6)
|
||||
exec_backend(argv);
|
||||
else if (argc != 1)
|
||||
@@ -250,7 +217,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Loop until we are killed...
|
||||
*/
|
||||
|
||||
while (!job_canceled)
|
||||
for (;;)
|
||||
{
|
||||
FD_ZERO(&input);
|
||||
FD_SET(fd, &input);
|
||||
@@ -279,6 +246,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
cups_device_t *best; /* Best matching device */
|
||||
char device_uri[1024]; /* Device URI */
|
||||
int count; /* Number of queries */
|
||||
static const char * const schemes[] =
|
||||
{ "lpd", "ipp", "ipp", "socket", "riousbprint" };
|
||||
/* URI schemes for devices */
|
||||
|
||||
|
||||
for (device = (cups_device_t *)cupsArrayFirst(devices),
|
||||
@@ -327,14 +297,12 @@ main(int argc, /* I - Number of command-line args */
|
||||
else if (strcasecmp(best->name, device->name) ||
|
||||
strcasecmp(best->domain, device->domain))
|
||||
{
|
||||
unquote(uriName, best->fullName, sizeof(uriName));
|
||||
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
|
||||
"dnssd", NULL, uriName, 0,
|
||||
schemes[best->type], NULL, best->fullName, 0,
|
||||
best->cups_shared ? "/cups" : "/");
|
||||
|
||||
cupsBackendReport("network", device_uri, best->make_and_model,
|
||||
best->name, best->device_id, NULL);
|
||||
best->name, NULL, NULL);
|
||||
best->sent = 1;
|
||||
best = device;
|
||||
}
|
||||
@@ -351,20 +319,16 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
if (best)
|
||||
{
|
||||
unquote(uriName, best->fullName, sizeof(uriName));
|
||||
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
|
||||
"dnssd", NULL, uriName, 0,
|
||||
schemes[best->type], NULL, best->fullName, 0,
|
||||
best->cups_shared ? "/cups" : "/");
|
||||
|
||||
cupsBackendReport("network", device_uri, best->make_and_model,
|
||||
best->name, best->device_id, NULL);
|
||||
best->name, NULL, NULL);
|
||||
best->sent = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -466,7 +430,12 @@ static int /* O - Result of comparison */
|
||||
compare_devices(cups_device_t *a, /* I - First device */
|
||||
cups_device_t *b) /* I - Second device */
|
||||
{
|
||||
return (strcmp(a->name, b->name));
|
||||
int result = strcmp(a->name, b->name);
|
||||
|
||||
if (result)
|
||||
return (result);
|
||||
else
|
||||
return (strcmp(a->domain, b->domain));
|
||||
}
|
||||
|
||||
|
||||
@@ -489,8 +458,6 @@ exec_backend(char **argv) /* I - Command-line arguments */
|
||||
* Resolve the device URI...
|
||||
*/
|
||||
|
||||
job_canceled = -1;
|
||||
|
||||
if ((resolved_uri = cupsBackendDeviceURI(argv)) == NULL)
|
||||
exit(CUPS_BACKEND_FAILED);
|
||||
|
||||
@@ -512,7 +479,7 @@ exec_backend(char **argv) /* I - Command-line arguments */
|
||||
snprintf(filename, sizeof(filename), "%s/backend/%s", cups_serverbin, scheme);
|
||||
|
||||
/*
|
||||
* Overwrite the device URI and run the new backend...
|
||||
* Overwrite the device URIs and run the new backend...
|
||||
*/
|
||||
|
||||
setenv("DEVICE_URI", resolved_uri, 1);
|
||||
@@ -549,7 +516,8 @@ get_device(cups_array_t *devices, /* I - Device array */
|
||||
* See if this is a new device...
|
||||
*/
|
||||
|
||||
key.name = (char *)serviceName;
|
||||
key.name = (char *)serviceName;
|
||||
key.domain = (char *)replyDomain;
|
||||
|
||||
if (!strcmp(regtype, "_ipp._tcp.") ||
|
||||
!strcmp(regtype, "_ipp-tls._tcp."))
|
||||
@@ -566,29 +534,11 @@ get_device(cups_array_t *devices, /* I - Device array */
|
||||
for (device = cupsArrayFind(devices, &key);
|
||||
device;
|
||||
device = cupsArrayNext(devices))
|
||||
if (strcasecmp(device->name, key.name))
|
||||
if (strcasecmp(device->name, key.name) ||
|
||||
strcasecmp(device->domain, key.domain))
|
||||
break;
|
||||
else if (device->type == key.type)
|
||||
{
|
||||
if (!strcasecmp(device->domain, "local.") &&
|
||||
strcasecmp(device->domain, replyDomain))
|
||||
{
|
||||
/*
|
||||
* Update the .local listing to use the "global" domain name instead.
|
||||
* The backend will try local lookups first, then the global domain name.
|
||||
*/
|
||||
|
||||
free(device->domain);
|
||||
device->domain = strdup(replyDomain);
|
||||
|
||||
DNSServiceConstructFullName(fullName, device->name, regtype,
|
||||
replyDomain);
|
||||
free(device->fullName);
|
||||
device->fullName = strdup(fullName);
|
||||
}
|
||||
|
||||
return (device);
|
||||
}
|
||||
|
||||
/*
|
||||
* Yes, add the device...
|
||||
@@ -636,8 +586,8 @@ query_callback(
|
||||
{
|
||||
cups_array_t *devices; /* Device array */
|
||||
char name[1024], /* Service name */
|
||||
*ptr; /* Pointer into string */
|
||||
cups_device_t dkey, /* Search key */
|
||||
*ptr; /* Pointer into name */
|
||||
cups_device_t key, /* Search key */
|
||||
*device; /* Device */
|
||||
|
||||
|
||||
@@ -660,183 +610,123 @@ query_callback(
|
||||
* Lookup the service in the devices array.
|
||||
*/
|
||||
|
||||
devices = (cups_array_t *)context;
|
||||
dkey.name = name;
|
||||
devices = (cups_array_t *)context;
|
||||
key.name = name;
|
||||
|
||||
unquote(name, fullName, sizeof(name));
|
||||
|
||||
if ((dkey.domain = strstr(name, "._tcp.")) != NULL)
|
||||
dkey.domain += 6;
|
||||
if ((key.domain = strstr(name, "._tcp.")) != NULL)
|
||||
key.domain += 6;
|
||||
else
|
||||
dkey.domain = (char *)"local.";
|
||||
key.domain = (char *)"local.";
|
||||
|
||||
if ((ptr = strstr(name, "._")) != NULL)
|
||||
*ptr = '\0';
|
||||
|
||||
if (strstr(fullName, "_ipp._tcp.") ||
|
||||
strstr(fullName, "_ipp-tls._tcp."))
|
||||
dkey.type = CUPS_DEVICE_IPP;
|
||||
key.type = CUPS_DEVICE_IPP;
|
||||
else if (strstr(fullName, "_fax-ipp._tcp."))
|
||||
dkey.type = CUPS_DEVICE_FAX_IPP;
|
||||
key.type = CUPS_DEVICE_FAX_IPP;
|
||||
else if (strstr(fullName, "_printer._tcp."))
|
||||
dkey.type = CUPS_DEVICE_PRINTER;
|
||||
key.type = CUPS_DEVICE_PRINTER;
|
||||
else if (strstr(fullName, "_pdl-datastream._tcp."))
|
||||
dkey.type = CUPS_DEVICE_PDL_DATASTREAM;
|
||||
key.type = CUPS_DEVICE_PDL_DATASTREAM;
|
||||
else
|
||||
dkey.type = CUPS_DEVICE_RIOUSBPRINT;
|
||||
key.type = CUPS_DEVICE_RIOUSBPRINT;
|
||||
|
||||
for (device = cupsArrayFind(devices, &dkey);
|
||||
for (device = cupsArrayFind(devices, &key);
|
||||
device;
|
||||
device = cupsArrayNext(devices))
|
||||
{
|
||||
if (strcasecmp(device->name, dkey.name) ||
|
||||
strcasecmp(device->domain, dkey.domain))
|
||||
if (strcasecmp(device->name, key.name) ||
|
||||
strcasecmp(device->domain, key.domain))
|
||||
{
|
||||
device = NULL;
|
||||
break;
|
||||
}
|
||||
else if (device->type == dkey.type)
|
||||
else if (device->type == key.type)
|
||||
{
|
||||
/*
|
||||
* Found it, pull out the priority and make and model from the TXT
|
||||
* record and save it...
|
||||
*/
|
||||
|
||||
const uint8_t *data, /* Pointer into data */
|
||||
*datanext, /* Next key/value pair */
|
||||
*dataend; /* End of entire TXT record */
|
||||
uint8_t datalen; /* Length of current key/value pair */
|
||||
char key[256], /* Key string */
|
||||
value[256], /* Value string */
|
||||
make_and_model[512],
|
||||
/* Manufacturer and model */
|
||||
model[256], /* Model */
|
||||
device_id[2048];/* 1284 device ID */
|
||||
const void *value; /* Pointer to value */
|
||||
uint8_t valueLen; /* Length of value (max 255) */
|
||||
char make_and_model[512], /* Manufacturer and model */
|
||||
model[256], /* Model */
|
||||
priority[256]; /* Priority */
|
||||
|
||||
|
||||
device_id[0] = '\0';
|
||||
make_and_model[0] = '\0';
|
||||
value = TXTRecordGetValuePtr(rdlen, rdata, "priority", &valueLen);
|
||||
|
||||
strcpy(model, "Unknown");
|
||||
|
||||
for (data = rdata, dataend = data + rdlen;
|
||||
data < dataend;
|
||||
data = datanext)
|
||||
if (value && valueLen)
|
||||
{
|
||||
/*
|
||||
* Read a key/value pair starting with an 8-bit length. Since the
|
||||
* length is 8 bits and the size of the key/value buffers is 256, we
|
||||
* don't need to check for overflow...
|
||||
*/
|
||||
memcpy(priority, value, valueLen);
|
||||
priority[valueLen] = '\0';
|
||||
device->priority = atoi(priority);
|
||||
}
|
||||
|
||||
datalen = *data++;
|
||||
if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MFG",
|
||||
&valueLen)) == NULL)
|
||||
value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MANUFACTURER",
|
||||
&valueLen);
|
||||
|
||||
if (!datalen || (data + datalen) >= dataend)
|
||||
break;
|
||||
if (value && valueLen)
|
||||
{
|
||||
memcpy(make_and_model, value, valueLen);
|
||||
make_and_model[valueLen] = '\0';
|
||||
}
|
||||
else
|
||||
make_and_model[0] = '\0';
|
||||
|
||||
datanext = data + datalen;
|
||||
if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MDL",
|
||||
&valueLen)) == NULL)
|
||||
value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MODEL", &valueLen);
|
||||
|
||||
for (ptr = key; data < datanext && *data != '='; data ++)
|
||||
*ptr++ = *data;
|
||||
*ptr = '\0';
|
||||
|
||||
if (data < datanext && *data == '=')
|
||||
if (value && valueLen)
|
||||
{
|
||||
memcpy(model, value, valueLen);
|
||||
model[valueLen] = '\0';
|
||||
}
|
||||
else if ((value = TXTRecordGetValuePtr(rdlen, rdata, "product",
|
||||
&valueLen)) != NULL && valueLen > 2)
|
||||
{
|
||||
if (((char *)value)[0] == '(')
|
||||
{
|
||||
data ++;
|
||||
/*
|
||||
* Strip parenthesis...
|
||||
*/
|
||||
|
||||
if (data < datanext)
|
||||
memcpy(value, data, datanext - data);
|
||||
value[datanext - data] = '\0';
|
||||
memcpy(model, value + 1, valueLen - 2);
|
||||
model[valueLen - 2] = '\0';
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
if (!strncasecmp(key, "usb_", 4))
|
||||
{
|
||||
/*
|
||||
* Add USB device ID information...
|
||||
*/
|
||||
memcpy(model, value, valueLen);
|
||||
model[valueLen] = '\0';
|
||||
}
|
||||
|
||||
ptr = device_id + strlen(device_id);
|
||||
snprintf(ptr, sizeof(device_id) - (ptr - device_id), "%s:%s;",
|
||||
key + 4, value);
|
||||
}
|
||||
|
||||
if (!strcasecmp(key, "usb_MFG") || !strcasecmp(key, "usb_MANU") ||
|
||||
!strcasecmp(key, "usb_MANUFACTURER"))
|
||||
strcpy(make_and_model, value);
|
||||
else if (!strcasecmp(key, "usb_MDL") || !strcasecmp(key, "usb_MODEL"))
|
||||
strcpy(model, value);
|
||||
else if (!strcasecmp(key, "product") && !strstr(value, "Ghostscript"))
|
||||
if (!strcasecmp(model, "GPL Ghostscript") ||
|
||||
!strcasecmp(model, "GNU Ghostscript") ||
|
||||
!strcasecmp(model, "ESP Ghostscript"))
|
||||
{
|
||||
if (value[0] == '(')
|
||||
if ((value = TXTRecordGetValuePtr(rdlen, rdata, "ty",
|
||||
&valueLen)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Strip parenthesis...
|
||||
*/
|
||||
memcpy(model, value, valueLen);
|
||||
model[valueLen] = '\0';
|
||||
|
||||
if ((ptr = value + strlen(value) - 1) > value && *ptr == ')')
|
||||
if ((ptr = strchr(model, ',')) != NULL)
|
||||
*ptr = '\0';
|
||||
|
||||
strcpy(model, value + 1);
|
||||
}
|
||||
else
|
||||
strcpy(model, value);
|
||||
}
|
||||
else if (!strcasecmp(key, "ty"))
|
||||
{
|
||||
strcpy(model, value);
|
||||
|
||||
if ((ptr = strchr(model, ',')) != NULL)
|
||||
*ptr = '\0';
|
||||
}
|
||||
else if (!strcasecmp(key, "priority"))
|
||||
device->priority = atoi(value);
|
||||
else if ((device->type == CUPS_DEVICE_IPP ||
|
||||
device->type == CUPS_DEVICE_PRINTER) &&
|
||||
!strcasecmp(key, "printer-type"))
|
||||
{
|
||||
/*
|
||||
* This is a CUPS printer!
|
||||
*/
|
||||
|
||||
device->cups_shared = 1;
|
||||
|
||||
if (device->type == CUPS_DEVICE_PRINTER)
|
||||
device->sent = 1;
|
||||
strcpy(model, "Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
if (device->device_id)
|
||||
free(device->device_id);
|
||||
|
||||
if (!device_id[0] && strcmp(model, "Unknown"))
|
||||
{
|
||||
if (make_and_model[0])
|
||||
snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;",
|
||||
make_and_model, model);
|
||||
else if (!strncasecmp(model, "designjet ", 10))
|
||||
snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s", model + 10);
|
||||
else if (!strncasecmp(model, "stylus ", 7))
|
||||
snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s", model + 7);
|
||||
else if ((ptr = strchr(model, ' ')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Assume the first word is the make...
|
||||
*/
|
||||
|
||||
memcpy(make_and_model, model, ptr - model);
|
||||
make_and_model[ptr - model] = '\0';
|
||||
|
||||
snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s",
|
||||
make_and_model, ptr + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (device_id[0])
|
||||
device->device_id = strdup(device_id);
|
||||
else
|
||||
device->device_id = NULL;
|
||||
strcpy(model, "Unknown");
|
||||
|
||||
if (device->make_and_model)
|
||||
free(device->make_and_model);
|
||||
@@ -845,11 +735,25 @@ query_callback(
|
||||
{
|
||||
strlcat(make_and_model, " ", sizeof(make_and_model));
|
||||
strlcat(make_and_model, model, sizeof(make_and_model));
|
||||
|
||||
device->make_and_model = strdup(make_and_model);
|
||||
}
|
||||
else
|
||||
device->make_and_model = strdup(model);
|
||||
|
||||
if ((device->type == CUPS_DEVICE_IPP ||
|
||||
device->type == CUPS_DEVICE_PRINTER) &&
|
||||
TXTRecordGetValuePtr(rdlen, rdata, "printer-type", &valueLen))
|
||||
{
|
||||
/*
|
||||
* This is a CUPS printer!
|
||||
*/
|
||||
|
||||
device->cups_shared = 1;
|
||||
|
||||
if (device->type == CUPS_DEVICE_PRINTER)
|
||||
device->sent = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -859,20 +763,6 @@ query_callback(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'sigterm_handler()' - Handle termination signals...
|
||||
*/
|
||||
|
||||
static void
|
||||
sigterm_handler(int sig) /* I - Signal number (unused) */
|
||||
{
|
||||
if (job_canceled)
|
||||
exit(CUPS_BACKEND_OK);
|
||||
else
|
||||
job_canceled = 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'unquote()' - Unquote a name string.
|
||||
*/
|
||||
|
||||
+128
-92
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* IPP backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -143,9 +143,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
"copies-supported",
|
||||
"document-format-supported",
|
||||
"marker-colors",
|
||||
"marker-high-levels",
|
||||
"marker-levels",
|
||||
"marker-low-levels",
|
||||
"marker-message",
|
||||
"marker-names",
|
||||
"marker-types",
|
||||
@@ -260,7 +258,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
*/
|
||||
|
||||
compression = 0;
|
||||
version = 11;
|
||||
version = 1;
|
||||
waitjob = 1;
|
||||
waitprinter = 1;
|
||||
contimeout = 7 * 24 * 60 * 60;
|
||||
@@ -357,13 +355,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
else if (!strcasecmp(name, "version"))
|
||||
{
|
||||
if (!strcmp(value, "1.0"))
|
||||
version = 10;
|
||||
version = 0;
|
||||
else if (!strcmp(value, "1.1"))
|
||||
version = 11;
|
||||
else if (!strcmp(value, "2.0"))
|
||||
version = 20;
|
||||
else if (!strcmp(value, "2.1"))
|
||||
version = 21;
|
||||
version = 1;
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
@@ -414,54 +408,41 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Copy stdin to a temporary file...
|
||||
*/
|
||||
|
||||
int fd; /* File descriptor */
|
||||
http_addrlist_t *addrlist; /* Address list */
|
||||
char buffer[8192]; /* Buffer for copying */
|
||||
int bytes; /* Number of bytes read */
|
||||
off_t tbytes; /* Total bytes copied */
|
||||
int fd; /* File descriptor */
|
||||
cups_file_t *fp; /* Temporary file */
|
||||
char buffer[8192]; /* Buffer for copying */
|
||||
int bytes; /* Number of bytes read */
|
||||
off_t tbytes; /* Total bytes copied */
|
||||
|
||||
|
||||
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, "1")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
|
||||
hostname);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
|
||||
|
||||
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
|
||||
{
|
||||
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
|
||||
if ((fp = cupsFileOpenFd(fd, compression ? "w9" : "w")) == NULL)
|
||||
{
|
||||
_cupsLangPrintError(_("ERROR: Unable to open temporary file"));
|
||||
close(fd);
|
||||
unlink(tmpfilename);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
tbytes = 0;
|
||||
|
||||
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
|
||||
{
|
||||
if (write(fd, buffer, bytes) < bytes)
|
||||
if (cupsFileWrite(fp, buffer, bytes) < bytes)
|
||||
{
|
||||
_cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
|
||||
close(fd);
|
||||
cupsFileClose(fp);
|
||||
unlink(tmpfilename);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
else
|
||||
tbytes += bytes;
|
||||
|
||||
if (snmp_fd >= 0)
|
||||
backendCheckSideChannel(snmp_fd, &(addrlist->addr));
|
||||
}
|
||||
|
||||
if (snmp_fd >= 0)
|
||||
_cupsSNMPClose(snmp_fd);
|
||||
|
||||
httpAddrFreeList(addrlist);
|
||||
|
||||
close(fd);
|
||||
cupsFileClose(fp);
|
||||
|
||||
/*
|
||||
* Don't try printing files less than 2 bytes...
|
||||
@@ -622,7 +603,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
while (http == NULL);
|
||||
|
||||
if (job_cancelled || !http)
|
||||
if (job_cancelled)
|
||||
{
|
||||
if (tmpfilename[0])
|
||||
unlink(tmpfilename);
|
||||
@@ -686,8 +667,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
|
||||
request->request.op.version[0] = version / 10;
|
||||
request->request.op.version[1] = version % 10;
|
||||
request->request.op.version[1] = version;
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
@@ -733,16 +713,16 @@ main(int argc, /* I - Number of command-line args */
|
||||
delay += 5;
|
||||
}
|
||||
else if ((ipp_status == IPP_BAD_REQUEST ||
|
||||
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version > 10)
|
||||
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version == 1)
|
||||
{
|
||||
/*
|
||||
* Switch to IPP/1.0...
|
||||
*/
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("INFO: Printer does not support IPP/%d.%d, trying "
|
||||
"IPP/1.0...\n"), version / 10, version % 10);
|
||||
version = 10;
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer does not support IPP/1.1, trying "
|
||||
"IPP/1.0...\n"));
|
||||
version = 0;
|
||||
httpReconnect(http);
|
||||
}
|
||||
else if (ipp_status == IPP_NOT_FOUND)
|
||||
@@ -894,8 +874,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
else
|
||||
request = ippNewRequest(IPP_PRINT_JOB);
|
||||
|
||||
request->request.op.version[0] = version / 10;
|
||||
request->request.op.version[1] = version % 10;
|
||||
request->request.op.version[1] = version;
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
@@ -988,7 +967,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
"document-format", NULL, final_content_type);
|
||||
}
|
||||
|
||||
if (copies_sup && version > 10 && send_options)
|
||||
if (copies_sup && version > 0 && send_options)
|
||||
{
|
||||
/*
|
||||
* Only send options if the destination printer supports the copies
|
||||
@@ -1043,39 +1022,21 @@ main(int argc, /* I - Number of command-line args */
|
||||
sleep(10);
|
||||
}
|
||||
else if ((ipp_status == IPP_BAD_REQUEST ||
|
||||
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version > 10)
|
||||
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version == 1)
|
||||
{
|
||||
/*
|
||||
* Switch to IPP/1.0...
|
||||
*/
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("INFO: Printer does not support IPP/%d.%d, trying "
|
||||
"IPP/1.0...\n"), version / 10, version % 10);
|
||||
version = 10;
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer does not support IPP/1.1, trying "
|
||||
"IPP/1.0...\n"));
|
||||
version = 0;
|
||||
httpReconnect(http);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Update auth-info-required as needed...
|
||||
*/
|
||||
|
||||
_cupsLangPrintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"),
|
||||
cupsLastErrorString());
|
||||
|
||||
if (ipp_status == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
|
||||
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
|
||||
|
||||
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
|
||||
"Negotiate", 9))
|
||||
fputs("ATTR: auth-info-required=negotiate\n", stderr);
|
||||
else
|
||||
fputs("ATTR: auth-info-required=username,password\n", stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((job_id_attr = ippFindAttribute(response, "job-id",
|
||||
IPP_TAG_INTEGER)) == NULL)
|
||||
@@ -1111,8 +1072,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_SEND_DOCUMENT);
|
||||
request->request.op.version[0] = version / 10;
|
||||
request->request.op.version[1] = version % 10;
|
||||
|
||||
request->request.op.version[1] = version;
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
@@ -1177,8 +1138,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
|
||||
request->request.op.version[0] = version / 10;
|
||||
request->request.op.version[1] = version % 10;
|
||||
request->request.op.version[1] = version;
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
@@ -1328,7 +1288,15 @@ main(int argc, /* I - Number of command-line args */
|
||||
*/
|
||||
|
||||
if (ipp_status == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
/*
|
||||
* Authorization failures here mean that we need Kerberos. Username +
|
||||
* password authentication is handled in the password_cb function.
|
||||
*/
|
||||
|
||||
fputs("ATTR: auth-info-required=negotiate\n", stderr);
|
||||
return (CUPS_BACKEND_AUTH_REQUIRED);
|
||||
}
|
||||
else if (ipp_status > IPP_OK_CONFLICT)
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
else
|
||||
@@ -1354,8 +1322,7 @@ cancel_job(http_t *http, /* I - HTTP connection */
|
||||
_cupsLangPuts(stderr, _("INFO: Canceling print job...\n"));
|
||||
|
||||
request = ippNewRequest(IPP_CANCEL_JOB);
|
||||
request->request.op.version[0] = version / 10;
|
||||
request->request.op.version[1] = version % 10;
|
||||
request->request.op.version[1] = version;
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
@@ -1410,8 +1377,7 @@ check_printer_state(
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
|
||||
request->request.op.version[0] = version / 10;
|
||||
request->request.op.version[1] = version % 10;
|
||||
request->request.op.version[1] = version;
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
@@ -1636,8 +1602,11 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
*reasons, /* printer-state-reasons */
|
||||
*marker; /* marker-* attributes */
|
||||
const char *reason; /* Current reason */
|
||||
const char *message; /* Message to show */
|
||||
char unknown[1024]; /* Unknown message string */
|
||||
const char *prefix; /* Prefix for STATE: line */
|
||||
char state[1024]; /* State string */
|
||||
cups_lang_t *language; /* Current localization */
|
||||
int saw_caprw; /* Saw com.apple.print.recoverable-warning state */
|
||||
|
||||
|
||||
@@ -1652,24 +1621,96 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
saw_caprw = 0;
|
||||
state[0] = '\0';
|
||||
prefix = "STATE: ";
|
||||
language = cupsLangDefault();
|
||||
|
||||
for (i = 0, count = 0; i < reasons->num_values; i ++)
|
||||
{
|
||||
reason = reasons->values[i].string.text;
|
||||
|
||||
if (!strcmp(reason, "com.apple.print.recoverable-warning"))
|
||||
saw_caprw = 1;
|
||||
else if (strcmp(reason, "paused"))
|
||||
if (strcmp(reason, "paused"))
|
||||
{
|
||||
strlcat(state, prefix, sizeof(state));
|
||||
strlcat(state, reason, sizeof(state));
|
||||
|
||||
prefix = ",";
|
||||
}
|
||||
|
||||
message = "";
|
||||
|
||||
if (!strncmp(reason, "media-needed", 12))
|
||||
message = _("Media tray needs to be filled.");
|
||||
else if (!strncmp(reason, "media-jam", 9))
|
||||
message = _("Media jam!");
|
||||
else if (!strncmp(reason, "moving-to-paused", 16) ||
|
||||
!strncmp(reason, "offline", 7) ||
|
||||
!strncmp(reason, "paused", 6) ||
|
||||
!strncmp(reason, "shutdown", 8))
|
||||
message = _("Printer offline.");
|
||||
else if (!strncmp(reason, "toner-low", 9))
|
||||
message = _("Toner low.");
|
||||
else if (!strncmp(reason, "toner-empty", 11))
|
||||
message = _("Out of toner!");
|
||||
else if (!strncmp(reason, "cover-open", 10))
|
||||
message = _("Cover open.");
|
||||
else if (!strncmp(reason, "interlock-open", 14))
|
||||
message = _("Interlock open.");
|
||||
else if (!strncmp(reason, "door-open", 9))
|
||||
message = _("Door open.");
|
||||
else if (!strncmp(reason, "input-tray-missing", 18))
|
||||
message = _("Media tray missing!");
|
||||
else if (!strncmp(reason, "media-low", 9))
|
||||
message = _("Media tray almost empty.");
|
||||
else if (!strncmp(reason, "media-empty", 11))
|
||||
message = _("Media tray empty!");
|
||||
else if (!strncmp(reason, "output-tray-missing", 19))
|
||||
message = _("Output tray missing!");
|
||||
else if (!strncmp(reason, "output-area-almost-full", 23))
|
||||
message = _("Output bin almost full.");
|
||||
else if (!strncmp(reason, "output-area-full", 16))
|
||||
message = _("Output bin full!");
|
||||
else if (!strncmp(reason, "marker-supply-low", 17))
|
||||
message = _("Ink/toner almost empty.");
|
||||
else if (!strncmp(reason, "marker-supply-empty", 19))
|
||||
message = _("Ink/toner empty!");
|
||||
else if (!strncmp(reason, "marker-waste-almost-full", 24))
|
||||
message = _("Ink/toner waste bin almost full.");
|
||||
else if (!strncmp(reason, "marker-waste-full", 17))
|
||||
message = _("Ink/toner waste bin full!");
|
||||
else if (!strncmp(reason, "fuser-over-temp", 15))
|
||||
message = _("Fuser temperature high!");
|
||||
else if (!strncmp(reason, "fuser-under-temp", 16))
|
||||
message = _("Fuser temperature low!");
|
||||
else if (!strncmp(reason, "opc-near-eol", 12))
|
||||
message = _("OPC almost at end-of-life.");
|
||||
else if (!strncmp(reason, "opc-life-over", 13))
|
||||
message = _("OPC at end-of-life!");
|
||||
else if (!strncmp(reason, "developer-low", 13))
|
||||
message = _("Developer almost empty.");
|
||||
else if (!strncmp(reason, "developer-empty", 15))
|
||||
message = _("Developer empty!");
|
||||
else if (!strcmp(reason, "com.apple.print.recoverable-warning"))
|
||||
saw_caprw = 1;
|
||||
else if (strstr(reason, "error") != NULL)
|
||||
{
|
||||
message = unknown;
|
||||
|
||||
snprintf(unknown, sizeof(unknown), _("Unknown printer error (%s)!"),
|
||||
reason);
|
||||
}
|
||||
|
||||
if (message[0])
|
||||
{
|
||||
count ++;
|
||||
if (strstr(reasons->values[i].string.text, "error"))
|
||||
fprintf(stderr, "ERROR: %s\n", _cupsLangString(language, message));
|
||||
else if (strstr(reasons->values[i].string.text, "warning"))
|
||||
fprintf(stderr, "WARNING: %s\n", _cupsLangString(language, message));
|
||||
else
|
||||
fprintf(stderr, "INFO: %s\n", _cupsLangString(language, message));
|
||||
}
|
||||
}
|
||||
|
||||
if (state[0])
|
||||
fprintf(stderr, "%s\n", state);
|
||||
fprintf(stderr, "%s\n", state);
|
||||
|
||||
/*
|
||||
* Relay com.apple.print.recoverable-message...
|
||||
@@ -1687,15 +1728,9 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
|
||||
if ((marker = ippFindAttribute(ipp, "marker-colors", IPP_TAG_NAME)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-high-levels",
|
||||
IPP_TAG_INTEGER)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-levels",
|
||||
IPP_TAG_INTEGER)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-low-levels",
|
||||
IPP_TAG_INTEGER)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-message", IPP_TAG_TEXT)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-names", IPP_TAG_NAME)) != NULL)
|
||||
@@ -1762,7 +1797,8 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
|
||||
if ((fd = cupsTempFd(pstmpname, sizeof(pstmpname))) < 0)
|
||||
{
|
||||
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to create temporary file - %s.\n"),
|
||||
strerror(errno));
|
||||
if (ppdfile)
|
||||
unlink(ppdfile);
|
||||
return (-1);
|
||||
|
||||
+4
-29
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -386,7 +386,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*/
|
||||
|
||||
sanitize_title = !value[0] || !strcasecmp(value, "on") ||
|
||||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
|
||||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
|
||||
}
|
||||
else if (!strcasecmp(name, "timeout"))
|
||||
{
|
||||
@@ -424,31 +424,17 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* Copy stdin to a temporary file...
|
||||
*/
|
||||
|
||||
http_addrlist_t *addrlist; /* Address list */
|
||||
int snmp_fd; /* SNMP socket */
|
||||
char buffer[8192]; /* Buffer for copying */
|
||||
int bytes; /* Number of bytes read */
|
||||
char buffer[8192]; /* Buffer for copying */
|
||||
int bytes; /* Number of bytes read */
|
||||
|
||||
|
||||
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, "1")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
|
||||
hostname);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
|
||||
|
||||
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
|
||||
{
|
||||
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
|
||||
|
||||
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
|
||||
{
|
||||
if (write(fd, buffer, bytes) < bytes)
|
||||
{
|
||||
_cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
|
||||
@@ -456,15 +442,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
unlink(tmpfilename);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if (snmp_fd >= 0)
|
||||
backendCheckSideChannel(snmp_fd, &(addrlist->addr));
|
||||
}
|
||||
|
||||
if (snmp_fd >= 0)
|
||||
_cupsSNMPClose(snmp_fd);
|
||||
|
||||
httpAddrFreeList(addrlist);
|
||||
}
|
||||
else if (argc == 6)
|
||||
{
|
||||
@@ -695,8 +672,6 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
|
||||
sprintf(portname, "%d", port);
|
||||
|
||||
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
|
||||
|
||||
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
|
||||
|
||||
+8
-24
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Common network APIs for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -162,72 +162,58 @@ backendNetworkSideCB(
|
||||
case CUPS_ASN1_BOOLEAN :
|
||||
snprintf(dataptr, sizeof(data) - (dataptr - data), "%d",
|
||||
packet.object_value.boolean);
|
||||
datalen += (int)strlen(dataptr);
|
||||
break;
|
||||
|
||||
case CUPS_ASN1_INTEGER :
|
||||
snprintf(dataptr, sizeof(data) - (dataptr - data), "%d",
|
||||
packet.object_value.integer);
|
||||
datalen += (int)strlen(dataptr);
|
||||
break;
|
||||
|
||||
case CUPS_ASN1_BIT_STRING :
|
||||
case CUPS_ASN1_OCTET_STRING :
|
||||
i = (int)(sizeof(data) - (dataptr - data));
|
||||
if (packet.object_value.string.num_bytes < i)
|
||||
i = packet.object_value.string.num_bytes;
|
||||
|
||||
memcpy(dataptr, packet.object_value.string.bytes, i);
|
||||
|
||||
datalen += i;
|
||||
strlcpy(dataptr, packet.object_value.string,
|
||||
sizeof(data) - (dataptr - data));
|
||||
break;
|
||||
|
||||
case CUPS_ASN1_OID :
|
||||
_cupsSNMPOIDToString(packet.object_value.oid, dataptr,
|
||||
sizeof(data) - (dataptr - data));
|
||||
datalen += (int)strlen(dataptr);
|
||||
break;
|
||||
|
||||
case CUPS_ASN1_HEX_STRING :
|
||||
for (i = 0;
|
||||
i < packet.object_value.string.num_bytes &&
|
||||
i < packet.object_value.hex_string.num_bytes &&
|
||||
dataptr < (data + sizeof(data) - 3);
|
||||
i ++, dataptr += 2)
|
||||
sprintf(dataptr, "%02X",
|
||||
packet.object_value.string.bytes[i]);
|
||||
datalen += (int)strlen(dataptr);
|
||||
packet.object_value.hex_string.bytes[i]);
|
||||
break;
|
||||
|
||||
case CUPS_ASN1_COUNTER :
|
||||
snprintf(dataptr, sizeof(data) - (dataptr - data), "%d",
|
||||
packet.object_value.counter);
|
||||
datalen += (int)strlen(dataptr);
|
||||
break;
|
||||
|
||||
case CUPS_ASN1_GAUGE :
|
||||
snprintf(dataptr, sizeof(data) - (dataptr - data), "%u",
|
||||
packet.object_value.gauge);
|
||||
datalen += (int)strlen(dataptr);
|
||||
break;
|
||||
|
||||
case CUPS_ASN1_TIMETICKS :
|
||||
snprintf(dataptr, sizeof(data) - (dataptr - data), "%u",
|
||||
packet.object_value.timeticks);
|
||||
datalen += (int)strlen(dataptr);
|
||||
break;
|
||||
|
||||
default :
|
||||
fprintf(stderr, "DEBUG: Unknown OID value type %02X!\n",
|
||||
packet.object_type);
|
||||
|
||||
case CUPS_ASN1_NULL_VALUE :
|
||||
dataptr[0] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: Returning %s %s\n", data, data + datalen);
|
||||
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
datalen += (int)strlen(data + datalen);
|
||||
}
|
||||
else
|
||||
fputs("DEBUG: SNMP read error...\n", stderr);
|
||||
@@ -260,8 +246,7 @@ backendNetworkSideCB(
|
||||
if (_cupsSNMPRead(snmp_fd, &packet, 1.0) &&
|
||||
packet.object_type == CUPS_ASN1_OCTET_STRING)
|
||||
{
|
||||
strlcpy(data, (char *)packet.object_value.string.bytes,
|
||||
sizeof(data));
|
||||
strlcpy(data, packet.object_value.string, sizeof(data));
|
||||
datalen = (int)strlen(data);
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
}
|
||||
@@ -274,7 +259,6 @@ backendNetworkSideCB(
|
||||
{
|
||||
strlcpy(data, device_id, sizeof(data));
|
||||
datalen = (int)strlen(data);
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+26
-38
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Serial port backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -944,6 +944,7 @@ list_devices(void)
|
||||
|
||||
# ifdef B115200
|
||||
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
|
||||
device, i + 1);
|
||||
# else
|
||||
printf("serial serial:%s?baud=38400 \"Unknown\" \"%s\"\n", device, info);
|
||||
# endif /* B115200 */
|
||||
@@ -1211,51 +1212,38 @@ list_devices(void)
|
||||
{
|
||||
CFTypeRef serialNameAsCFString;
|
||||
CFTypeRef bsdPathAsCFString;
|
||||
CFTypeRef hiddenVal;
|
||||
char serialName[128];
|
||||
char bsdPath[1024];
|
||||
Boolean result;
|
||||
|
||||
|
||||
/* Check if hidden... */
|
||||
hiddenVal = IORegistryEntrySearchCFProperty(serialService,
|
||||
kIOServicePlane,
|
||||
CFSTR("HiddenPort"),
|
||||
kCFAllocatorDefault,
|
||||
kIORegistryIterateRecursively |
|
||||
kIORegistryIterateParents);
|
||||
if (hiddenVal)
|
||||
CFRelease(hiddenVal); /* This interface should not be used */
|
||||
else
|
||||
serialNameAsCFString =
|
||||
IORegistryEntryCreateCFProperty(serialService,
|
||||
CFSTR(kIOTTYDeviceKey),
|
||||
kCFAllocatorDefault, 0);
|
||||
if (serialNameAsCFString)
|
||||
{
|
||||
serialNameAsCFString =
|
||||
IORegistryEntryCreateCFProperty(serialService,
|
||||
CFSTR(kIOTTYDeviceKey),
|
||||
kCFAllocatorDefault, 0);
|
||||
if (serialNameAsCFString)
|
||||
result = CFStringGetCString(serialNameAsCFString, serialName,
|
||||
sizeof(serialName),
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(serialNameAsCFString);
|
||||
|
||||
if (result)
|
||||
{
|
||||
result = CFStringGetCString(serialNameAsCFString, serialName,
|
||||
sizeof(serialName),
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(serialNameAsCFString);
|
||||
|
||||
if (result)
|
||||
bsdPathAsCFString =
|
||||
IORegistryEntryCreateCFProperty(serialService,
|
||||
CFSTR(kIOCalloutDeviceKey),
|
||||
kCFAllocatorDefault, 0);
|
||||
if (bsdPathAsCFString)
|
||||
{
|
||||
bsdPathAsCFString =
|
||||
IORegistryEntryCreateCFProperty(serialService,
|
||||
CFSTR(kIOCalloutDeviceKey),
|
||||
kCFAllocatorDefault, 0);
|
||||
if (bsdPathAsCFString)
|
||||
{
|
||||
result = CFStringGetCString(bsdPathAsCFString, bsdPath,
|
||||
sizeof(bsdPath),
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(bsdPathAsCFString);
|
||||
|
||||
if (result)
|
||||
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n",
|
||||
bsdPath, serialName);
|
||||
}
|
||||
result = CFStringGetCString(bsdPathAsCFString, bsdPath,
|
||||
sizeof(bsdPath),
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(bsdPathAsCFString);
|
||||
|
||||
if (result)
|
||||
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n",
|
||||
bsdPath, serialName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+95
-272
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* SNMP supplies functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2008-2009 by Apple Inc.
|
||||
* Copyright 2008 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -17,8 +17,7 @@
|
||||
*
|
||||
* backendSNMPSupplies() - Get the current supplies for a device.
|
||||
* backend_init_supplies() - Initialize the supplies list.
|
||||
* backend_walk_cb() - Interpret the supply value responses.
|
||||
* utf16_to_utf8() - Convert UTF-16 text to UTF-8.
|
||||
* backend_walk_cb() - Interpret the supply value responses...
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -34,14 +33,13 @@
|
||||
*/
|
||||
|
||||
#define CUPS_MAX_SUPPLIES 32 /* Maximum number of supplies for a printer */
|
||||
#define CUPS_SUPPLY_TIMEOUT 2.0 /* Timeout for SNMP lookups */
|
||||
|
||||
|
||||
/*
|
||||
* Local structures...
|
||||
*/
|
||||
|
||||
typedef struct /**** Printer supply data ****/
|
||||
typedef struct
|
||||
{
|
||||
char name[CUPS_SNMP_MAX_STRING], /* Name of supply */
|
||||
color[8]; /* Color: "#RRGGBB" or "none" */
|
||||
@@ -51,21 +49,12 @@ typedef struct /**** Printer supply data ****/
|
||||
level; /* Current level value */
|
||||
} backend_supplies_t;
|
||||
|
||||
typedef struct /**** Printer state table ****/
|
||||
{
|
||||
int bit; /* State bit */
|
||||
const char *keyword; /* IPP printer-state-reasons keyword */
|
||||
} backend_state_t;
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static http_addr_t current_addr; /* Current address */
|
||||
static int current_state = -1;
|
||||
/* Current device state bits */
|
||||
static int charset = -1; /* Character set for supply names */
|
||||
static int num_supplies = 0;
|
||||
/* Number of supplies found */
|
||||
static backend_supplies_t supplies[CUPS_MAX_SUPPLIES];
|
||||
@@ -80,13 +69,6 @@ static const int hrPrinterStatus[] =
|
||||
static const int hrPrinterDetectedErrorState[] =
|
||||
{ CUPS_OID_hrPrinterDetectedErrorState, 1, -1 };
|
||||
/* Current printer state bits OID */
|
||||
static const int prtGeneralCurrentLocalization[] =
|
||||
{ CUPS_OID_prtGeneralCurrentLocalization, 1, -1 };
|
||||
static const int prtLocalizationCharacterSet[] =
|
||||
{ CUPS_OID_prtLocalizationCharacterSet, 1, 1, -1 },
|
||||
prtLocalizationCharacterSetOffset =
|
||||
(sizeof(prtLocalizationCharacterSet) /
|
||||
sizeof(prtLocalizationCharacterSet[0]));
|
||||
static const int prtMarkerColorantValue[] =
|
||||
{ CUPS_OID_prtMarkerColorantValue, -1 },
|
||||
/* Colorant OID */
|
||||
@@ -136,23 +118,6 @@ static const int prtMarkerSuppliesType[] =
|
||||
sizeof(prtMarkerSuppliesType[0]));
|
||||
/* Offset to supply index */
|
||||
|
||||
static const backend_state_t const printer_states[] =
|
||||
{
|
||||
{ CUPS_TC_lowPaper, "media-low-report" },
|
||||
{ CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty, "media-empty-warning" },
|
||||
{ CUPS_TC_lowToner, "toner-low-report" },
|
||||
{ CUPS_TC_noToner, "toner-empty-warning" },
|
||||
{ CUPS_TC_doorOpen, "door-open-report" },
|
||||
{ CUPS_TC_jammed, "media-jam-warning" },
|
||||
/* { CUPS_TC_offline, "offline-report" }, */ /* unreliable */
|
||||
/* { CUPS_TC_serviceRequested | CUPS_TC_overduePreventMaint, "service-needed-warning" }, */ /* unreliable */
|
||||
{ CUPS_TC_inputTrayMissing, "input-tray-missing-warning" },
|
||||
{ CUPS_TC_outputTrayMissing, "output-tray-missing-warning" },
|
||||
{ CUPS_TC_markerSupplyMissing, "marker-supply-missing-warning" },
|
||||
{ CUPS_TC_outputNearFull, "output-area-almost-full-report" },
|
||||
{ CUPS_TC_outputFull, "output-area-full-warning" }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
@@ -160,8 +125,6 @@ static const backend_state_t const printer_states[] =
|
||||
|
||||
static void backend_init_supplies(int snmp_fd, http_addr_t *addr);
|
||||
static void backend_walk_cb(cups_snmp_t *packet, void *data);
|
||||
static void utf16_to_utf8(cups_utf8_t *dst, const unsigned char *src,
|
||||
size_t srcsize, size_t dstsize, int le);
|
||||
|
||||
|
||||
/*
|
||||
@@ -179,8 +142,8 @@ backendSNMPSupplies(
|
||||
backend_init_supplies(snmp_fd, addr);
|
||||
else if (num_supplies > 0)
|
||||
_cupsSNMPWalk(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1,
|
||||
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesLevel,
|
||||
CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL);
|
||||
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesLevel, 0.5,
|
||||
backend_walk_cb, NULL);
|
||||
|
||||
if (page_count)
|
||||
*page_count = -1;
|
||||
@@ -190,14 +153,12 @@ backendSNMPSupplies(
|
||||
|
||||
if (num_supplies > 0)
|
||||
{
|
||||
int i, /* Looping var */
|
||||
new_state, /* New state value */
|
||||
change_state; /* State change */
|
||||
int i; /* Looping var */
|
||||
char value[CUPS_MAX_SUPPLIES * 4],
|
||||
/* marker-levels value string */
|
||||
*ptr; /* Pointer into value string */
|
||||
cups_snmp_t packet; /* SNMP response packet */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Generate the marker-levels value string...
|
||||
@@ -225,27 +186,77 @@ backendSNMPSupplies(
|
||||
hrPrinterDetectedErrorState))
|
||||
return (-1);
|
||||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, 0.5) ||
|
||||
packet.object_type != CUPS_ASN1_OCTET_STRING)
|
||||
return (-1);
|
||||
|
||||
new_state = (packet.object_value.string.bytes[0] << 8) |
|
||||
packet.object_value.string.bytes[1];
|
||||
i = ((packet.object_value.string[0] & 255) << 8) |
|
||||
(packet.object_value.string[1] & 255);
|
||||
|
||||
if (current_state < 0)
|
||||
change_state = 0xffff;
|
||||
if (i & CUPS_TC_lowPaper)
|
||||
fputs("STATE: +media-low-report\n", stderr);
|
||||
else
|
||||
change_state = current_state ^ new_state;
|
||||
fputs("STATE: -media-low-report\n", stderr);
|
||||
|
||||
for (i = 0;
|
||||
i < (int)(sizeof(printer_states) / sizeof(printer_states[0]));
|
||||
i ++)
|
||||
if (change_state & printer_states[i].bit)
|
||||
fprintf(stderr, "STATE: %c%s\n",
|
||||
(new_state & printer_states[i].bit) ? '+' : '-',
|
||||
printer_states[i].keyword);
|
||||
if (i & (CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty))
|
||||
fputs("STATE: +media-empty-warning\n", stderr);
|
||||
else
|
||||
fputs("STATE: -media-empty-warning\n", stderr);
|
||||
|
||||
current_state = new_state;
|
||||
if (i & CUPS_TC_lowToner)
|
||||
fputs("STATE: +toner-low-report\n", stderr);
|
||||
else
|
||||
fputs("STATE: -toner-low-report\n", stderr);
|
||||
|
||||
if (i & CUPS_TC_noToner)
|
||||
fputs("STATE: +toner-empty-warning\n", stderr);
|
||||
else
|
||||
fputs("STATE: -toner-empty-warning\n", stderr);
|
||||
|
||||
if (i & CUPS_TC_doorOpen)
|
||||
fputs("STATE: +door-open-report\n", stderr);
|
||||
else
|
||||
fputs("STATE: -door-open-report\n", stderr);
|
||||
|
||||
if (i & CUPS_TC_jammed)
|
||||
fputs("STATE: +media-jam-warning\n", stderr);
|
||||
else
|
||||
fputs("STATE: -media-jam-warning\n", stderr);
|
||||
|
||||
if (i & CUPS_TC_offline)
|
||||
fputs("STATE: +offline-report\n", stderr);
|
||||
else
|
||||
fputs("STATE: -offline-report\n", stderr);
|
||||
|
||||
if (i & (CUPS_TC_serviceRequested | CUPS_TC_overduePreventMaint))
|
||||
fputs("STATE: +service-needed-warning\n", stderr);
|
||||
else
|
||||
fputs("STATE: -service-needed-warning\n", stderr);
|
||||
|
||||
if (i & CUPS_TC_inputTrayMissing)
|
||||
fputs("STATE: +input-tray-missing-warning\n", stderr);
|
||||
else
|
||||
fputs("STATE: -input-tray-missing-warning\n", stderr);
|
||||
|
||||
if (i & CUPS_TC_outputTrayMissing)
|
||||
fputs("STATE: +output-tray-missing-warning\n", stderr);
|
||||
else
|
||||
fputs("STATE: -output-tray-missing-warning\n", stderr);
|
||||
|
||||
if (i & CUPS_TC_markerSupplyMissing)
|
||||
fputs("STATE: +marker-supply-missing-warning\n", stderr);
|
||||
else
|
||||
fputs("STATE: -marker-supply-missing-warning\n", stderr);
|
||||
|
||||
if (i & CUPS_TC_outputNearFull)
|
||||
fputs("STATE: +output-area-almost-full-report\n", stderr);
|
||||
else
|
||||
fputs("STATE: -output-area-almost-full-report\n", stderr);
|
||||
|
||||
if (i & CUPS_TC_outputFull)
|
||||
fputs("STATE: +output-area-full-warning\n", stderr);
|
||||
else
|
||||
fputs("STATE: -output-area-full-warning\n", stderr);
|
||||
|
||||
/*
|
||||
* Get the current printer state...
|
||||
@@ -258,7 +269,7 @@ backendSNMPSupplies(
|
||||
hrPrinterStatus))
|
||||
return (-1);
|
||||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, 0.5) ||
|
||||
packet.object_type != CUPS_ASN1_INTEGER)
|
||||
return (-1);
|
||||
|
||||
@@ -276,7 +287,7 @@ backendSNMPSupplies(
|
||||
prtMarkerLifeCount))
|
||||
return (-1);
|
||||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, 0.5) ||
|
||||
packet.object_type != CUPS_ASN1_COUNTER)
|
||||
return (-1);
|
||||
|
||||
@@ -357,10 +368,8 @@ backend_init_supplies(
|
||||
* Reset state information...
|
||||
*/
|
||||
|
||||
current_addr = *addr;
|
||||
current_state = -1;
|
||||
num_supplies = -1;
|
||||
charset = -1;
|
||||
current_addr = *addr;
|
||||
num_supplies = -1;
|
||||
|
||||
memset(supplies, 0, sizeof(supplies));
|
||||
|
||||
@@ -387,17 +396,14 @@ backend_init_supplies(
|
||||
hrDeviceDescr))
|
||||
return;
|
||||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, 0.5) ||
|
||||
packet.object_type != CUPS_ASN1_OCTET_STRING)
|
||||
{
|
||||
strlcpy(description, "Unknown", sizeof(description));
|
||||
num_supplies = 0;
|
||||
}
|
||||
else
|
||||
strlcpy(description, (char *)packet.object_value.string.bytes,
|
||||
sizeof(description));
|
||||
|
||||
fprintf(stderr, "DEBUG2: hrDeviceDesc=\"%s\"\n", description);
|
||||
strlcpy(description, packet.object_value.string, sizeof(description));
|
||||
|
||||
/*
|
||||
* See if we have already queried this device...
|
||||
@@ -416,31 +422,28 @@ backend_init_supplies(
|
||||
/*
|
||||
* Yes, read the cache file:
|
||||
*
|
||||
* 2 num_supplies charset
|
||||
* 1 num_supplies
|
||||
* device description
|
||||
* supply structures...
|
||||
*/
|
||||
|
||||
if (cupsFileGets(cachefile, value, sizeof(value)))
|
||||
{
|
||||
if (sscanf(value, "2 %d%d", &num_supplies, &charset) == 2 &&
|
||||
if (sscanf(value, "1 %d", &num_supplies) == 1 &&
|
||||
num_supplies <= CUPS_MAX_SUPPLIES &&
|
||||
cupsFileGets(cachefile, value, sizeof(value)))
|
||||
{
|
||||
if ((ptr = value + strlen(value) - 1) >= value && *ptr == '\n')
|
||||
*ptr = '\n';
|
||||
|
||||
if (!strcmp(description, value))
|
||||
cupsFileRead(cachefile, (char *)supplies,
|
||||
num_supplies * sizeof(backend_supplies_t));
|
||||
else
|
||||
{
|
||||
num_supplies = -1;
|
||||
charset = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num_supplies = -1;
|
||||
charset = -1;
|
||||
}
|
||||
}
|
||||
|
||||
cupsFileClose(cachefile);
|
||||
@@ -450,55 +453,6 @@ backend_init_supplies(
|
||||
* If the cache information isn't correct, scan for supplies...
|
||||
*/
|
||||
|
||||
if (charset < 0)
|
||||
{
|
||||
/*
|
||||
* Get the configured character set...
|
||||
*/
|
||||
|
||||
int oid[CUPS_SNMP_MAX_OID]; /* OID for character set */
|
||||
|
||||
|
||||
if (!_cupsSNMPWrite(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1,
|
||||
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
|
||||
prtGeneralCurrentLocalization))
|
||||
return;
|
||||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
|
||||
packet.object_type != CUPS_ASN1_INTEGER)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"DEBUG: prtGeneralCurrentLocalization type is %x, expected %x!\n",
|
||||
packet.object_type, CUPS_ASN1_INTEGER);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: prtGeneralCurrentLocalization=%d\n",
|
||||
packet.object_value.integer);
|
||||
|
||||
_cupsSNMPCopyOID(oid, prtLocalizationCharacterSet, CUPS_SNMP_MAX_OID);
|
||||
oid[prtLocalizationCharacterSetOffset - 2] = packet.object_value.integer;
|
||||
|
||||
|
||||
if (!_cupsSNMPWrite(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1,
|
||||
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
|
||||
oid))
|
||||
return;
|
||||
|
||||
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
|
||||
packet.object_type != CUPS_ASN1_INTEGER)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"DEBUG: prtLocalizationCharacterSet type is %x, expected %x!\n",
|
||||
packet.object_type, CUPS_ASN1_INTEGER);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: prtLocalizationCharacterSet=%d\n",
|
||||
packet.object_value.integer);
|
||||
charset = packet.object_value.integer;
|
||||
}
|
||||
|
||||
if (num_supplies < 0)
|
||||
{
|
||||
/*
|
||||
@@ -506,8 +460,8 @@ backend_init_supplies(
|
||||
*/
|
||||
|
||||
_cupsSNMPWalk(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1,
|
||||
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesEntry,
|
||||
CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL);
|
||||
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesEntry, 0.5,
|
||||
backend_walk_cb, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -519,7 +473,7 @@ backend_init_supplies(
|
||||
|
||||
if ((cachefile = cupsFileOpen(cachefilename, "w")) != NULL)
|
||||
{
|
||||
cupsFilePrintf(cachefile, "2 %d %d\n", num_supplies, charset);
|
||||
cupsFilePrintf(cachefile, "1 %d\n", num_supplies);
|
||||
cupsFilePrintf(cachefile, "%s\n", description);
|
||||
|
||||
if (num_supplies > 0)
|
||||
@@ -540,8 +494,8 @@ backend_init_supplies(
|
||||
strcpy(supplies[i].color, "none");
|
||||
|
||||
_cupsSNMPWalk(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1,
|
||||
_cupsSNMPDefaultCommunity(), prtMarkerColorantValue,
|
||||
CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL);
|
||||
_cupsSNMPDefaultCommunity(), prtMarkerColorantValue, 0.5,
|
||||
backend_walk_cb, NULL);
|
||||
|
||||
/*
|
||||
* Output the marker-colors attribute...
|
||||
@@ -603,7 +557,7 @@ backend_init_supplies(
|
||||
|
||||
|
||||
/*
|
||||
* 'backend_walk_cb()' - Interpret the supply value responses.
|
||||
* 'backend_walk_cb()' - Interpret the supply value responses...
|
||||
*/
|
||||
|
||||
static void
|
||||
@@ -636,13 +590,13 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
|
||||
i = packet->object_name[prtMarkerColorantValueOffset];
|
||||
|
||||
fprintf(stderr, "DEBUG2: prtMarkerColorantValue.1.%d = \"%s\"\n", i,
|
||||
(char *)packet->object_value.string.bytes);
|
||||
packet->object_value.string);
|
||||
|
||||
for (j = 0; j < num_supplies; j ++)
|
||||
if (supplies[j].colorant == i)
|
||||
{
|
||||
for (k = 0; k < (int)(sizeof(colors) / sizeof(colors[0])); k ++)
|
||||
if (!strcmp(colors[k][0], (char *)packet->object_value.string.bytes))
|
||||
if (!strcmp(colors[k][0], packet->object_value.string))
|
||||
{
|
||||
strcpy(supplies[j].color, colors[k][1]);
|
||||
break;
|
||||
@@ -679,84 +633,14 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
|
||||
packet->object_type != CUPS_ASN1_OCTET_STRING)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "DEBUG2: prtMarkerSuppliesDescription.1.%d = \"%s\"\n", i,
|
||||
packet->object_value.string);
|
||||
|
||||
if (i > num_supplies)
|
||||
num_supplies = i;
|
||||
|
||||
switch (charset)
|
||||
{
|
||||
case CUPS_TC_csASCII :
|
||||
case CUPS_TC_csUTF8 :
|
||||
case CUPS_TC_csUnicodeASCII :
|
||||
strlcpy(supplies[i - 1].name,
|
||||
(char *)packet->object_value.string.bytes,
|
||||
sizeof(supplies[0].name));
|
||||
break;
|
||||
|
||||
case CUPS_TC_csISOLatin1 :
|
||||
case CUPS_TC_csUnicodeLatin1 :
|
||||
cupsCharsetToUTF8((cups_utf8_t *)supplies[i - 1].name,
|
||||
(char *)packet->object_value.string.bytes,
|
||||
sizeof(supplies[0].name), CUPS_ISO8859_1);
|
||||
break;
|
||||
|
||||
case CUPS_TC_csShiftJIS :
|
||||
cupsCharsetToUTF8((cups_utf8_t *)supplies[i - 1].name,
|
||||
(char *)packet->object_value.string.bytes,
|
||||
sizeof(supplies[0].name), CUPS_JIS_X0213);
|
||||
break;
|
||||
|
||||
case CUPS_TC_csUCS4 :
|
||||
case CUPS_TC_csUTF32 :
|
||||
case CUPS_TC_csUTF32BE :
|
||||
case CUPS_TC_csUTF32LE :
|
||||
cupsUTF32ToUTF8((cups_utf8_t *)supplies[i - 1].name,
|
||||
(cups_utf32_t *)packet->object_value.string.bytes,
|
||||
sizeof(supplies[0].name));
|
||||
break;
|
||||
|
||||
case CUPS_TC_csUnicode :
|
||||
case CUPS_TC_csUTF16BE :
|
||||
case CUPS_TC_csUTF16LE :
|
||||
utf16_to_utf8((cups_utf8_t *)supplies[i - 1].name,
|
||||
packet->object_value.string.bytes,
|
||||
packet->object_value.string.num_bytes,
|
||||
sizeof(supplies[0].name), charset == CUPS_TC_csUTF16LE);
|
||||
break;
|
||||
|
||||
default :
|
||||
/*
|
||||
* If we get here, the printer is using an unknown character set and
|
||||
* we just want to copy characters that look like ASCII...
|
||||
*/
|
||||
|
||||
{
|
||||
char *src, *dst; /* Pointers into strings */
|
||||
|
||||
|
||||
/*
|
||||
* Loop safe because both the object_value and supplies char arrays
|
||||
* are CUPS_SNMP_MAX_STRING elements long.
|
||||
*/
|
||||
|
||||
for (src = (char *)packet->object_value.string.bytes,
|
||||
dst = supplies[i - 1].name;
|
||||
*src;
|
||||
src ++)
|
||||
{
|
||||
if ((*src & 0x80) || *src < ' ' || *src == 0x7f)
|
||||
*dst++ = '?';
|
||||
else
|
||||
*dst++ = *src;
|
||||
}
|
||||
|
||||
*dst = '\0';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: prtMarkerSuppliesDescription.1.%d = \"%s\"\n", i,
|
||||
supplies[i - 1].name);
|
||||
|
||||
strlcpy(supplies[i - 1].name, packet->object_value.string,
|
||||
sizeof(supplies[0].name));
|
||||
}
|
||||
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesLevel))
|
||||
{
|
||||
@@ -818,67 +702,6 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'utf16_to_utf8()' - Convert UTF-16 text to UTF-8.
|
||||
*/
|
||||
|
||||
static void
|
||||
utf16_to_utf8(
|
||||
cups_utf8_t *dst, /* I - Destination buffer */
|
||||
const unsigned char *src, /* I - Source string */
|
||||
size_t srcsize, /* I - Size of source string */
|
||||
size_t dstsize, /* I - Size of destination buffer */
|
||||
int le) /* I - Source is little-endian? */
|
||||
{
|
||||
cups_utf32_t ch, /* Current character */
|
||||
temp[CUPS_SNMP_MAX_STRING],
|
||||
/* UTF-32 string */
|
||||
*ptr; /* Pointer into UTF-32 string */
|
||||
|
||||
|
||||
for (ptr = temp; srcsize >= 2;)
|
||||
{
|
||||
if (le)
|
||||
ch = src[0] | (src[1] << 8);
|
||||
else
|
||||
ch = (src[0] << 8) | src[1];
|
||||
|
||||
src += 2;
|
||||
srcsize -= 2;
|
||||
|
||||
if (ch >= 0xd800 && ch <= 0xdbff && srcsize >= 2)
|
||||
{
|
||||
/*
|
||||
* Multi-word UTF-16 char...
|
||||
*/
|
||||
|
||||
int lch; /* Lower word */
|
||||
|
||||
|
||||
if (le)
|
||||
lch = src[0] | (src[1] << 8);
|
||||
else
|
||||
lch = (src[0] << 8) | src[1];
|
||||
|
||||
if (lch >= 0xdc00 && lch <= 0xdfff)
|
||||
{
|
||||
src += 2;
|
||||
srcsize -= 2;
|
||||
|
||||
ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr < (temp + CUPS_SNMP_MAX_STRING - 1))
|
||||
*ptr++ = ch;
|
||||
}
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
cupsUTF32ToUTF8(dst, temp, dstsize);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
+17
-17
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* SNMP discovery backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -1015,18 +1015,18 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
|
||||
char make_model[256]; /* Make and model */
|
||||
|
||||
|
||||
if (strchr((char *)packet.object_value.string.bytes, ':') &&
|
||||
strchr((char *)packet.object_value.string.bytes, ';'))
|
||||
if (strchr(packet.object_value.string, ':') &&
|
||||
strchr(packet.object_value.string, ';'))
|
||||
{
|
||||
/*
|
||||
* Description is the IEEE-1284 device ID...
|
||||
*/
|
||||
|
||||
if (!device->id)
|
||||
device->id = strdup((char *)packet.object_value.string.bytes);
|
||||
device->id = strdup(packet.object_value.string);
|
||||
|
||||
backendGetMakeModel((char *)packet.object_value.string.bytes,
|
||||
make_model, sizeof(make_model));
|
||||
backendGetMakeModel(packet.object_value.string, make_model,
|
||||
sizeof(make_model));
|
||||
|
||||
if (device->info)
|
||||
free(device->info);
|
||||
@@ -1039,13 +1039,13 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
|
||||
* Description is plain text...
|
||||
*/
|
||||
|
||||
fix_make_model(make_model, (char *)packet.object_value.string.bytes,
|
||||
fix_make_model(make_model, packet.object_value.string,
|
||||
sizeof(make_model));
|
||||
|
||||
if (device->info)
|
||||
free(device->info);
|
||||
|
||||
device->info = strdup((char *)packet.object_value.string.bytes);
|
||||
device->info = strdup(packet.object_value.string);
|
||||
}
|
||||
|
||||
if (!device->make_and_model)
|
||||
@@ -1066,14 +1066,14 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
|
||||
if (device->id)
|
||||
free(device->id);
|
||||
|
||||
device->id = strdup((char *)packet.object_value.string.bytes);
|
||||
device->id = strdup(packet.object_value.string);
|
||||
|
||||
/*
|
||||
* Convert the ID to a make and model string...
|
||||
*/
|
||||
|
||||
backendGetMakeModel((char *)packet.object_value.string.bytes,
|
||||
make_model, sizeof(make_model));
|
||||
backendGetMakeModel(packet.object_value.string, make_model,
|
||||
sizeof(make_model));
|
||||
if (device->make_and_model)
|
||||
free(device->make_and_model);
|
||||
|
||||
@@ -1084,7 +1084,7 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
|
||||
case DEVICE_LOCATION :
|
||||
if (device && packet.object_type == CUPS_ASN1_OCTET_STRING &&
|
||||
!device->location)
|
||||
device->location = strdup((char *)packet.object_value.string.bytes);
|
||||
device->location = strdup(packet.object_value.string);
|
||||
break;
|
||||
|
||||
case DEVICE_PRODUCT :
|
||||
@@ -1096,12 +1096,12 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
|
||||
*/
|
||||
|
||||
if (!device->info)
|
||||
device->info = strdup((char *)packet.object_value.string.bytes);
|
||||
device->info = strdup(packet.object_value.string);
|
||||
|
||||
if (device->make_and_model)
|
||||
free(device->make_and_model);
|
||||
|
||||
device->make_and_model = strdup((char *)packet.object_value.string.bytes);
|
||||
device->make_and_model = strdup(packet.object_value.string);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1113,16 +1113,16 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
|
||||
* Update an existing cache entry...
|
||||
*/
|
||||
|
||||
if (!strncmp((char *)packet.object_value.string.bytes, "lpr:", 4))
|
||||
if (!strncmp(packet.object_value.string, "lpr:", 4))
|
||||
{
|
||||
/*
|
||||
* We want "lpd://..." for the URI...
|
||||
*/
|
||||
|
||||
packet.object_value.string.bytes[2] = 'd';
|
||||
packet.object_value.string[2] = 'd';
|
||||
}
|
||||
|
||||
device->uri = strdup((char *)packet.object_value.string.bytes);
|
||||
device->uri = strdup(packet.object_value.string);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -261,8 +261,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
sprintf(portname, "%d", port);
|
||||
|
||||
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
|
||||
|
||||
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
|
||||
|
||||
+27
-133
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Backend test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -16,9 +16,8 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Run the named backend.
|
||||
* usage() - Show usage information.
|
||||
* walk_cb() - Show results of cupsSideChannelSNMPWalk...
|
||||
* main() - Run the named backend.
|
||||
* usage() - Show usage information.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -41,8 +40,6 @@
|
||||
*/
|
||||
|
||||
static void usage(void);
|
||||
static void walk_cb(const char *oid, const char *data, int datalen,
|
||||
void *context);
|
||||
|
||||
|
||||
/*
|
||||
@@ -58,14 +55,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int first_arg, /* First argument for backend */
|
||||
do_ps = 0, /* Do PostScript query+test? */
|
||||
do_pcl = 0, /* Do PCL query+test? */
|
||||
do_query = 0, /* Do PostScript query? */
|
||||
do_side_tests = 0, /* Test side-channel ops? */
|
||||
do_trickle = 0, /* Trickle data to backend */
|
||||
do_walk = 0, /* Do OID lookup (0) or walking (1) */
|
||||
show_log = 0; /* Show log messages from backends? */
|
||||
const char *oid = ".1.3.6.1.2.1.43.10.2.1.4.1.1";
|
||||
/* OID to lookup or walk */
|
||||
do_trickle = 0; /* Trickle data to backend */
|
||||
char scheme[255], /* Scheme in URI == backend */
|
||||
backend[1024]; /* Backend path */
|
||||
const char *serverbin; /* CUPS_SERVERBIN environment variable */
|
||||
@@ -83,31 +75,12 @@ main(int argc, /* I - Number of command-line args */
|
||||
for (first_arg = 1;
|
||||
argv[first_arg] && argv[first_arg][0] == '-';
|
||||
first_arg ++)
|
||||
if (!strcmp(argv[first_arg], "-d"))
|
||||
show_log = 1;
|
||||
else if (!strcmp(argv[first_arg], "-pcl"))
|
||||
do_pcl = 1;
|
||||
else if (!strcmp(argv[first_arg], "-ps"))
|
||||
do_ps = 1;
|
||||
if (!strcmp(argv[first_arg], "-ps"))
|
||||
do_query = 1;
|
||||
else if (!strcmp(argv[first_arg], "-s"))
|
||||
do_side_tests = 1;
|
||||
else if (!strcmp(argv[first_arg], "-t"))
|
||||
do_trickle = 1;
|
||||
else if (!strcmp(argv[first_arg], "-get") && (first_arg + 1) < argc)
|
||||
{
|
||||
first_arg ++;
|
||||
|
||||
do_side_tests = 1;
|
||||
oid = argv[first_arg];
|
||||
}
|
||||
else if (!strcmp(argv[first_arg], "-walk") && (first_arg + 1) < argc)
|
||||
{
|
||||
first_arg ++;
|
||||
|
||||
do_side_tests = 1;
|
||||
do_walk = 1;
|
||||
oid = argv[first_arg];
|
||||
}
|
||||
else
|
||||
usage();
|
||||
|
||||
@@ -160,15 +133,15 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Execute the trickle process as needed...
|
||||
*/
|
||||
|
||||
if (do_trickle || do_pcl || do_ps)
|
||||
if (do_trickle || do_query)
|
||||
{
|
||||
pipe(data_fds);
|
||||
|
||||
if ((pid = fork()) == 0)
|
||||
{
|
||||
/*
|
||||
* Trickle/query child comes here. Rearrange file descriptors so that
|
||||
* FD 1, 3, and 4 point to the backend...
|
||||
* Trickle/query child comes here... Rearrange file descriptors so that
|
||||
* FD
|
||||
*/
|
||||
|
||||
close(0);
|
||||
@@ -206,28 +179,14 @@ main(int argc, /* I - Number of command-line args */
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Do PS or PCL query + test pages.
|
||||
* Do a simple PostScript query job to get the default page size.
|
||||
*/
|
||||
|
||||
char buffer[1024]; /* Buffer for response data */
|
||||
ssize_t bytes; /* Number of bytes of response data */
|
||||
double timeout; /* Timeout */
|
||||
const char *data; /* Data to send */
|
||||
static const char *pcl_data = /* PCL data */
|
||||
"\033%-12345X@PJL\r\n"
|
||||
"@PJL JOB NAME = \"Hello, World!\"\r\n"
|
||||
"@PJL INFO USTATUS\r\n"
|
||||
"@PJL ENTER LANGUAGE = PCL\r\n"
|
||||
"\033E"
|
||||
"Hello, World!\n"
|
||||
"\014"
|
||||
"\033%-12345X@PJL\r\n"
|
||||
"@PJL EOJ NAME=\"Hello, World!\"\r\n"
|
||||
"\033%-12345X";
|
||||
static const char *ps_data = /* PostScript data */
|
||||
char buffer[1024]; /* Buffer for response data */
|
||||
ssize_t bytes; /* Number of bytes of response data */
|
||||
static const char *ps_query = /* PostScript query file */
|
||||
"%!\n"
|
||||
"save\n"
|
||||
"product = flush\n"
|
||||
"currentpagedevice /PageSize get aload pop\n"
|
||||
"2 copy gt {exch} if\n"
|
||||
"(Unknown)\n"
|
||||
@@ -256,27 +215,14 @@ main(int argc, /* I - Number of command-line args */
|
||||
" {exch pop exit} {pop} ifelse\n"
|
||||
"} bind forall\n"
|
||||
"= flush pop pop\n"
|
||||
"/Courier findfont 12 scalefont setfont\n"
|
||||
"0 setgray 36 720 moveto (Hello, ) show product show (!) show\n"
|
||||
"showpage\n"
|
||||
"restore\n"
|
||||
"\004";
|
||||
|
||||
|
||||
if (do_pcl)
|
||||
data = pcl_data;
|
||||
else
|
||||
data = ps_data;
|
||||
|
||||
write(1, data, strlen(data));
|
||||
write(1, ps_query, strlen(ps_query));
|
||||
write(2, "DEBUG: START\n", 13);
|
||||
timeout = 60.0;
|
||||
while ((bytes = cupsBackChannelRead(buffer, sizeof(buffer),
|
||||
timeout)) > 0)
|
||||
{
|
||||
while ((bytes = cupsBackChannelRead(buffer, sizeof(buffer), 30.0)) > 0)
|
||||
write(2, buffer, bytes);
|
||||
timeout = 5.0;
|
||||
}
|
||||
write(2, "\nDEBUG: END\n", 12);
|
||||
}
|
||||
|
||||
@@ -301,7 +247,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Child comes here...
|
||||
*/
|
||||
|
||||
if (do_trickle || do_ps)
|
||||
if (do_trickle || do_query)
|
||||
{
|
||||
close(0);
|
||||
dup(data_fds[0]);
|
||||
@@ -309,12 +255,6 @@ main(int argc, /* I - Number of command-line args */
|
||||
close(data_fds[1]);
|
||||
}
|
||||
|
||||
if (!show_log)
|
||||
{
|
||||
close(2);
|
||||
open("/dev/null", O_WRONLY);
|
||||
}
|
||||
|
||||
close(3);
|
||||
dup(back_fds[1]);
|
||||
close(back_fds[0]);
|
||||
@@ -326,7 +266,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
close(side_fds[1]);
|
||||
|
||||
execv(backend, argv + first_arg);
|
||||
fprintf(stderr, "testbackend: Unable to execute \"%s\": %s\n", backend,
|
||||
fprintf(stderr, "textbackend: Unable to execute \"%s\": %s\n", backend,
|
||||
strerror(errno));
|
||||
return (errno);
|
||||
}
|
||||
@@ -340,7 +280,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Parent comes here, setup back and side channel file descriptors...
|
||||
*/
|
||||
|
||||
if (do_trickle || do_ps)
|
||||
if (do_trickle || do_query)
|
||||
{
|
||||
close(data_fds[0]);
|
||||
close(data_fds[1]);
|
||||
@@ -382,7 +322,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
length = 0;
|
||||
scstatus = cupsSideChannelDoRequest(CUPS_SC_CMD_DRAIN_OUTPUT, buffer,
|
||||
&length, 60.0);
|
||||
&length, 5.0);
|
||||
printf("CUPS_SC_CMD_DRAIN_OUTPUT returned %s\n", statuses[scstatus]);
|
||||
|
||||
length = 1;
|
||||
@@ -403,31 +343,11 @@ main(int argc, /* I - Number of command-line args */
|
||||
printf("CUPS_SC_CMD_GET_STATE returned %s, %02X\n", statuses[scstatus],
|
||||
buffer[0] & 255);
|
||||
|
||||
if (do_walk)
|
||||
{
|
||||
/*
|
||||
* Walk the OID tree...
|
||||
*/
|
||||
|
||||
scstatus = cupsSideChannelSNMPWalk(oid, 5.0, walk_cb, NULL);
|
||||
printf("CUPS_SC_CMD_SNMP_WALK returned %s\n", statuses[scstatus]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Lookup the same OID twice...
|
||||
*/
|
||||
|
||||
length = sizeof(buffer);
|
||||
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
|
||||
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %s\n", oid,
|
||||
statuses[scstatus], buffer);
|
||||
|
||||
length = sizeof(buffer);
|
||||
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
|
||||
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %s\n", oid,
|
||||
statuses[scstatus], buffer);
|
||||
}
|
||||
length = sizeof(buffer);
|
||||
scstatus = cupsSideChannelSNMPGet(".1.3.6.1.2.1.43.10.2.1.4.1.1", buffer,
|
||||
&length, 5.0);
|
||||
printf("CUPS_SC_CMD_SNMP_GET returned %s, %s\n", statuses[scstatus],
|
||||
buffer);
|
||||
|
||||
length = 0;
|
||||
scstatus = cupsSideChannelDoRequest(CUPS_SC_CMD_SOFT_RESET, buffer,
|
||||
@@ -460,38 +380,12 @@ main(int argc, /* I - Number of command-line args */
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
puts("Usage: testbackend [-d] [-ps] [-s [-oid OID] [-walk OID]] [-t] "
|
||||
"device-uri job-id user title copies options [file]");
|
||||
puts("");
|
||||
puts("Options:");
|
||||
puts(" -d Show log messages from backend.");
|
||||
puts(" -oid OID Lookup the specified SNMP OID.");
|
||||
puts(" (.1.3.6.1.2.1.43.10.2.1.4.1.1 is a good one for printers)");
|
||||
puts(" -pcl Send PCL+PJL query and test page to backend.");
|
||||
puts(" -ps Send PostScript query and test page to backend.");
|
||||
puts(" -s Do side-channel + SNMP tests.");
|
||||
puts(" -t Send spaces slowly to backend ('trickle').");
|
||||
puts(" -walk OID Walk the specified SNMP OID.");
|
||||
puts(" (.1.3.6.1.2.1.43 is a good one for printers)");
|
||||
|
||||
fputs("Usage: testbackend [-ps] [-s] [-t] device-uri job-id user title copies "
|
||||
"options [file]\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'walk_cb()' - Show results of cupsSideChannelSNMPWalk...
|
||||
*/
|
||||
|
||||
static void
|
||||
walk_cb(const char *oid, /* I - OID */
|
||||
const char *data, /* I - Data */
|
||||
int datalen, /* I - Length of data */
|
||||
void *context) /* I - Context (unused) */
|
||||
{
|
||||
printf("CUPS_SC_CMD_SNMP_WALK %s=%s (%d bytes)\n", oid, data, datalen);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
+60
-134
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Copyright 2005-2009 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
|
||||
@@ -279,11 +279,10 @@ static void soft_reset();
|
||||
static void status_timer_cb(CFRunLoopTimerRef timer, void *info);
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static pid_t child_pid; /* Child PID */
|
||||
static pid_t child_pid; /* Child PID */
|
||||
static void run_legacy_backend(int argc, char *argv[], int fd); /* Starts child backend process running as a ppc executable */
|
||||
static void sigterm_handler(int sig); /* SIGTERM handler */
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
static int job_canceled = 0; /* Was the job canceled? */
|
||||
static void sigterm_handler(int sig); /* SIGTERM handler */
|
||||
|
||||
#ifdef PARSE_PS_ERRORS
|
||||
static const char *next_line (const char *buffer);
|
||||
@@ -318,8 +317,6 @@ print_device(const char *uri, /* I - Device URI */
|
||||
{
|
||||
char serial[1024]; /* Serial number buffer */
|
||||
OSStatus status; /* Function results */
|
||||
IOReturn iostatus, /* Current IO status */
|
||||
prev_iostatus = 0; /* Previous IO status */
|
||||
pthread_t read_thread_id, /* Read thread */
|
||||
sidechannel_thread_id;/* Side-channel thread */
|
||||
int have_sidechannel = 0; /* Was the side-channel thread started? */
|
||||
@@ -451,9 +448,9 @@ print_device(const char *uri, /* I - Device URI */
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
|
||||
/*
|
||||
* Now that we are "connected" to the port, catch SIGTERM so that we
|
||||
* Now that we are "connected" to the port, ignore SIGTERM so that we
|
||||
* can finish out any page data the driver sends (e.g. to eject the
|
||||
* current page... Only catch SIGTERM if we are printing data from
|
||||
* current page... Only ignore SIGTERM if we are printing data from
|
||||
* stdin (otherwise you can't cancel raw jobs...)
|
||||
*/
|
||||
|
||||
@@ -465,7 +462,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = sigterm_handler;
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
}
|
||||
|
||||
@@ -585,13 +582,13 @@ print_device(const char *uri, /* I - Device URI */
|
||||
{
|
||||
fputs("DEBUG: Received an interrupt before any bytes were "
|
||||
"written, aborting!\n", stderr);
|
||||
return (CUPS_BACKEND_OK);
|
||||
return (0);
|
||||
}
|
||||
else if (errno != EAGAIN && errno != EINTR)
|
||||
else if (errno != EAGAIN)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("ERROR: Unable to read print data!\n"));
|
||||
perror("DEBUG: select");
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,11 +617,11 @@ print_device(const char *uri, /* I - Device URI */
|
||||
* Read error - bail if we don't see EAGAIN or EINTR...
|
||||
*/
|
||||
|
||||
if (errno != EAGAIN && errno != EINTR)
|
||||
if (errno != EAGAIN || errno != EINTR)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("ERROR: Unable to read print data!\n"));
|
||||
perror("DEBUG: read");
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
return CUPS_BACKEND_STOP;
|
||||
}
|
||||
|
||||
g.print_bytes = 0;
|
||||
@@ -648,49 +645,29 @@ print_device(const char *uri, /* I - Device URI */
|
||||
{
|
||||
bytes = g.print_bytes;
|
||||
|
||||
iostatus = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
|
||||
status = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
|
||||
|
||||
/*
|
||||
* Ignore timeout errors, but retain the number of bytes written to
|
||||
* avoid sending duplicate data (<rdar://problem/6254911>)...
|
||||
*/
|
||||
|
||||
if (iostatus == kIOUSBTransactionTimeout)
|
||||
iostatus = 0;
|
||||
if (status == kIOUSBTransactionTimeout)
|
||||
status = 0;
|
||||
|
||||
/*
|
||||
* Ignore stall errors, since we clear any stalls in the class driver...
|
||||
*/
|
||||
|
||||
if (iostatus == kIOUSBPipeStalled)
|
||||
iostatus = 0;
|
||||
|
||||
/*
|
||||
* Ignore the first "aborted" status we get, since we might have
|
||||
* received a signal (<rdar://problem/6860126>)...
|
||||
*/
|
||||
|
||||
if (iostatus == kIOReturnAborted && prev_iostatus != kIOReturnAborted)
|
||||
{
|
||||
prev_iostatus = iostatus;
|
||||
iostatus = 0;
|
||||
}
|
||||
else
|
||||
prev_iostatus = iostatus;
|
||||
|
||||
if (iostatus || bytes < 0)
|
||||
if (status || bytes < 0)
|
||||
{
|
||||
/*
|
||||
* Write error - bail if we don't see an error we can retry...
|
||||
*/
|
||||
|
||||
IOReturn err = (*g.classdriver)->Abort(g.classdriver);
|
||||
OSStatus err = (*g.classdriver)->Abort(g.classdriver);
|
||||
_cupsLangPuts(stderr, _("ERROR: Unable to send print data!\n"));
|
||||
fprintf(stderr, "DEBUG: USB class driver WritePipe returned %x\n",
|
||||
iostatus);
|
||||
fprintf(stderr, "DEBUG: USB class driver Abort returned %x\n",
|
||||
err);
|
||||
status = job_canceled ? CUPS_BACKEND_FAILED : CUPS_BACKEND_STOP;
|
||||
fprintf(stderr, "DEBUG: USB class driver WritePipe returned %ld\n",
|
||||
(long)status);
|
||||
fprintf(stderr, "DEBUG: USB class driver Abort returned %ld\n",
|
||||
(long)err);
|
||||
status = CUPS_BACKEND_STOP;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1264,83 +1241,56 @@ static kern_return_t load_classdriver(CFStringRef driverPath,
|
||||
printer_interface_t intf,
|
||||
classdriver_t ***printerDriver)
|
||||
{
|
||||
kern_return_t kr = kUSBPrinterClassDeviceNotOpen;
|
||||
classdriver_t **driver = NULL;
|
||||
CFStringRef bundle = driverPath ? driverPath : kUSBGenericTOPrinterClassDriver;
|
||||
char bundlestr[1024]; /* Bundle path */
|
||||
struct stat bundleinfo; /* File information for bundle */
|
||||
CFURLRef url; /* URL for driver */
|
||||
CFPlugInRef plugin = NULL; /* Plug-in address */
|
||||
kern_return_t kr = kUSBPrinterClassDeviceNotOpen;
|
||||
classdriver_t **driver = NULL;
|
||||
CFStringRef bundle = (driverPath == NULL ? kUSBGenericTOPrinterClassDriver : driverPath);
|
||||
|
||||
|
||||
CFStringGetCString(bundle, bundlestr, sizeof(bundlestr), kCFStringEncodingUTF8);
|
||||
|
||||
/*
|
||||
* Validate permissions for the class driver...
|
||||
*/
|
||||
|
||||
if (stat(bundlestr, &bundleinfo))
|
||||
if (bundle != NULL)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Unable to load class driver \"%s\": %s\n",
|
||||
bundlestr, strerror(errno));
|
||||
return (kr);
|
||||
}
|
||||
else if (bundleinfo.st_mode & S_IWOTH)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Unable to load class driver \"%s\": insecure file "
|
||||
"permissions (0%o)\n", bundlestr, bundleinfo.st_mode);
|
||||
return (kr);
|
||||
}
|
||||
CFURLRef url = CFURLCreateWithFileSystemPath(NULL, bundle, kCFURLPOSIXPathStyle, true);
|
||||
CFPlugInRef plugin = (url != NULL ? CFPlugInCreate(NULL, url) : NULL);
|
||||
|
||||
/*
|
||||
* Try loading the class driver...
|
||||
*/
|
||||
if (url != NULL)
|
||||
CFRelease(url);
|
||||
|
||||
url = CFURLCreateWithFileSystemPath(NULL, bundle, kCFURLPOSIXPathStyle, true);
|
||||
|
||||
if (url)
|
||||
{
|
||||
plugin = CFPlugInCreate(NULL, url);
|
||||
CFRelease(url);
|
||||
}
|
||||
else
|
||||
plugin = NULL;
|
||||
|
||||
if (plugin)
|
||||
{
|
||||
CFArrayRef factories = CFPlugInFindFactoriesForPlugInTypeInPlugIn(kUSBPrinterClassTypeID, plugin);
|
||||
if (factories != NULL && CFArrayGetCount(factories) > 0)
|
||||
if (plugin != NULL)
|
||||
{
|
||||
CFUUIDRef factoryID = CFArrayGetValueAtIndex(factories, 0);
|
||||
IUnknownVTbl **iunknown = CFPlugInInstanceCreate(NULL, factoryID, kUSBPrinterClassTypeID);
|
||||
if (iunknown != NULL)
|
||||
CFArrayRef factories = CFPlugInFindFactoriesForPlugInTypeInPlugIn(kUSBPrinterClassTypeID, plugin);
|
||||
if (factories != NULL && CFArrayGetCount(factories) > 0)
|
||||
{
|
||||
kr = (*iunknown)->QueryInterface(iunknown, CFUUIDGetUUIDBytes(kUSBPrinterClassInterfaceID), (LPVOID *)&driver);
|
||||
if (kr == kIOReturnSuccess && driver != NULL)
|
||||
CFUUIDRef factoryID = CFArrayGetValueAtIndex(factories, 0);
|
||||
IUnknownVTbl **iunknown = CFPlugInInstanceCreate(NULL, factoryID, kUSBPrinterClassTypeID);
|
||||
if (iunknown != NULL)
|
||||
{
|
||||
classdriver_t **genericDriver = NULL;
|
||||
if (driverPath != NULL && CFStringCompare(driverPath, kUSBGenericTOPrinterClassDriver, 0) != kCFCompareEqualTo)
|
||||
kr = load_classdriver(NULL, intf, &genericDriver);
|
||||
|
||||
if (kr == kIOReturnSuccess)
|
||||
kr = (*iunknown)->QueryInterface(iunknown, CFUUIDGetUUIDBytes(kUSBPrinterClassInterfaceID), (LPVOID *)&driver);
|
||||
if (kr == kIOReturnSuccess && driver != NULL)
|
||||
{
|
||||
(*driver)->interface = intf;
|
||||
(*driver)->Initialize(driver, genericDriver);
|
||||
classdriver_t **genericDriver = NULL;
|
||||
if (driverPath != NULL && CFStringCompare(driverPath, kUSBGenericTOPrinterClassDriver, 0) != kCFCompareEqualTo)
|
||||
kr = load_classdriver(NULL, intf, &genericDriver);
|
||||
|
||||
(*driver)->plugin = plugin;
|
||||
(*driver)->interface = intf;
|
||||
*printerDriver = driver;
|
||||
if (kr == kIOReturnSuccess)
|
||||
{
|
||||
(*driver)->interface = intf;
|
||||
(*driver)->Initialize(driver, genericDriver);
|
||||
|
||||
(*driver)->plugin = plugin;
|
||||
(*driver)->interface = intf;
|
||||
*printerDriver = driver;
|
||||
}
|
||||
}
|
||||
(*iunknown)->Release(iunknown);
|
||||
}
|
||||
(*iunknown)->Release(iunknown);
|
||||
CFRelease(factories);
|
||||
}
|
||||
CFRelease(factories);
|
||||
}
|
||||
}
|
||||
|
||||
char bundlestr[1024];
|
||||
CFStringGetCString(bundle, bundlestr, sizeof(bundlestr), kCFStringEncodingUTF8);
|
||||
fprintf(stderr, "DEBUG: load_classdriver(%s) (kr:0x%08x)\n", bundlestr, (int)kr);
|
||||
|
||||
return (kr);
|
||||
return kr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1933,47 +1883,23 @@ static void run_legacy_backend(int argc,
|
||||
|
||||
exit(exitstatus);
|
||||
}
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
|
||||
|
||||
/*
|
||||
* 'sigterm_handler()' - SIGTERM handler.
|
||||
*/
|
||||
|
||||
static void
|
||||
sigterm_handler(int sig) /* I - Signal */
|
||||
static void sigterm_handler(int sig)
|
||||
{
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
/* If we started a child process pass the signal on to it...
|
||||
*/
|
||||
if (child_pid)
|
||||
{
|
||||
/*
|
||||
* If we started a child process pass the signal on to it...
|
||||
*/
|
||||
|
||||
int status;
|
||||
|
||||
kill(child_pid, sig);
|
||||
while (waitpid(child_pid, &status, 0) < 0 && errno == EINTR);
|
||||
|
||||
if (WIFEXITED(status))
|
||||
exit(WEXITSTATUS(status));
|
||||
else if (status == SIGTERM || status == SIGKILL)
|
||||
exit(0);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Child crashed on signal %d!\n", status);
|
||||
exit(CUPS_BACKEND_STOP);
|
||||
}
|
||||
}
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
|
||||
/*
|
||||
* Otherwise just flag that the job has been canceled...
|
||||
*/
|
||||
|
||||
job_canceled = 1;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
|
||||
|
||||
#ifdef PARSE_PS_ERRORS
|
||||
/*
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Libusb interface code for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -156,13 +156,13 @@ print_device(const char *uri, /* I - Device URI */
|
||||
* TODO: Add back-channel support, along with better write error handling.
|
||||
*/
|
||||
|
||||
while (poll(pfds, 2, -1) > 0)
|
||||
if (poll(pfds, 2, -1) > 0)
|
||||
{
|
||||
if (pfds[0].revents & POLLIN)
|
||||
{
|
||||
if ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
if (usb_bulk_write(printer->handle, printer->write_endp, buffer,
|
||||
while (usb_bulk_write(printer->handle, printer->write_endp, buffer,
|
||||
bytes, 45000) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
@@ -174,7 +174,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
tbytes += bytes;
|
||||
}
|
||||
else if (bytes == 0 || (bytes < 0 && errno != EAGAIN && errno != EINTR))
|
||||
else if (bytes < 0 && errno != EAGAIN && errno != EINTR)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Berkeley commands makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2009 by Apple Inc.
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -76,12 +76,10 @@ install-data:
|
||||
#
|
||||
|
||||
install-exec:
|
||||
echo Installing Berkeley user printing commands in $(BINDIR)...
|
||||
$(INSTALL_DIR) -m 755 $(BINDIR)
|
||||
$(INSTALL_BIN) lpq $(BINDIR)
|
||||
$(INSTALL_BIN) lpr $(BINDIR)
|
||||
$(INSTALL_BIN) lprm $(BINDIR)
|
||||
echo Installing Berkeley admin printing commands in $(BINDIR)...
|
||||
$(INSTALL_DIR) -m 755 $(SBINDIR)
|
||||
$(INSTALL_BIN) lpc $(SBINDIR)
|
||||
if test "x$(SYMROOT)" != "x"; then \
|
||||
|
||||
+8
-7
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* "lpq" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -372,13 +372,17 @@ show_jobs(const char *command, /* I - Command name */
|
||||
|
||||
request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
|
||||
|
||||
if (id)
|
||||
if (dest == NULL)
|
||||
{
|
||||
snprintf(resource, sizeof(resource), "ipp://localhost/jobs/%d", id);
|
||||
if (id)
|
||||
sprintf(resource, "ipp://localhost/jobs/%d", id);
|
||||
else
|
||||
strcpy(resource, "ipp://localhost/jobs");
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
|
||||
NULL, resource);
|
||||
}
|
||||
else if (dest)
|
||||
else
|
||||
{
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
|
||||
NULL, "localhost", 0, "/printers/%s", dest);
|
||||
@@ -386,9 +390,6 @@ show_jobs(const char *command, /* I - Command name */
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, resource);
|
||||
}
|
||||
else
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, "ipp://localhost/");
|
||||
|
||||
if (user)
|
||||
{
|
||||
|
||||
@@ -42,9 +42,6 @@ jobs.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
jobs.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
|
||||
jobs.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
|
||||
jobs.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
|
||||
makedocset.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
makedocset.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h
|
||||
makedocset.o: ../cups/file.h ../cups/language.h ../cups/array.h help-index.h
|
||||
printers.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
printers.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
|
||||
printers.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
|
||||
|
||||
+6
-23
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# CGI makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2009 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
|
||||
@@ -28,7 +28,6 @@ OBJS = \
|
||||
classes.o \
|
||||
help.o \
|
||||
jobs.o \
|
||||
makedocset.o \
|
||||
printers.o \
|
||||
testcgi.o \
|
||||
testhi.o \
|
||||
@@ -81,7 +80,7 @@ unittests: $(UNITTARGETS)
|
||||
#
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS) makedocset
|
||||
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
|
||||
$(RM) libcupscgi.so libcupscgi.sl libcupscgi.dylib
|
||||
|
||||
|
||||
@@ -195,8 +194,6 @@ apihelp:
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-cgi.header --intro api-cgi.shtml \
|
||||
cgi.h help-index.h $(LIBOBJS:.o=.c) >../doc/help/api-cgi.html
|
||||
mxmldoc --tokens help/api-cgi.html api-cgi.xml >../doc/help/api-cgi.tokens
|
||||
$(RM) api-cgi.xml
|
||||
|
||||
framedhelp:
|
||||
mxmldoc --framed api-cgi \
|
||||
@@ -302,17 +299,6 @@ jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
$(CC) $(LDFLAGS) -o $@ jobs.o -lcupscgi $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# makedocset
|
||||
#
|
||||
|
||||
makedocset: makedocset.o ../Makedefs libcupscgi.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ makedocset.o libcupscgi.a \
|
||||
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(LIBZ) $(LIBGSSAPI)
|
||||
|
||||
|
||||
#
|
||||
# printers.cgi
|
||||
#
|
||||
@@ -329,8 +315,7 @@ printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
|
||||
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(LIBZ) $(LIBGSSAPI)
|
||||
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
|
||||
echo Testing CGI API...
|
||||
./testcgi
|
||||
|
||||
@@ -342,8 +327,7 @@ testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/libcups.a
|
||||
testhi: testhi.o ../Makedefs libcupscgi.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
|
||||
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(LIBZ) $(LIBGSSAPI)
|
||||
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
|
||||
echo Testing help index API...
|
||||
./testhi
|
||||
|
||||
@@ -355,7 +339,7 @@ testhi: testhi.o ../Makedefs libcupscgi.a ../cups/libcups.a
|
||||
testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.a ../cups/libcups.a \
|
||||
$(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) $(LIBZ) $(LIBGSSAPI)
|
||||
$(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
|
||||
|
||||
|
||||
#
|
||||
@@ -365,8 +349,7 @@ testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/libcups.a
|
||||
websearch: websearch.o ../Makedefs libcupscgi.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ websearch.o libcupscgi.a \
|
||||
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(LIBZ) $(LIBGSSAPI)
|
||||
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
|
||||
|
||||
|
||||
#
|
||||
|
||||
+13
-33
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Administration CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -261,7 +261,7 @@ choose_device_cb(
|
||||
|
||||
current_device ++;
|
||||
|
||||
if (time(NULL) > last_device_time && cgiSupportsMultipart())
|
||||
if (time(NULL) > last_device_time)
|
||||
{
|
||||
/*
|
||||
* Update the page...
|
||||
@@ -921,21 +921,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
if (cupsGetDevices(http, 30, CUPS_INCLUDE_ALL, CUPS_EXCLUDE_NONE,
|
||||
(cups_device_cb_t)choose_device_cb,
|
||||
(void *)title) == IPP_OK)
|
||||
{
|
||||
fputs("DEBUG: Got device list!\n", stderr);
|
||||
|
||||
if (!cgiSupportsMultipart())
|
||||
{
|
||||
/*
|
||||
* Non-modern browsers that don't support multi-part documents get
|
||||
* everything at the end...
|
||||
*/
|
||||
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("choose-device.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
@@ -1057,10 +1043,9 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
|
||||
return;
|
||||
}
|
||||
else if (!file &&
|
||||
(!cgiGetVariable("PPD_NAME") || cgiGetVariable("SELECT_MAKE")))
|
||||
else if (!file && !cgiGetVariable("PPD_NAME"))
|
||||
{
|
||||
if (modify && !cgiGetVariable("SELECT_MAKE"))
|
||||
if (modify)
|
||||
{
|
||||
/*
|
||||
* Get the PPD file...
|
||||
@@ -1084,8 +1069,6 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
|
||||
if (get_status != HTTP_OK)
|
||||
{
|
||||
httpFlush(http);
|
||||
|
||||
fprintf(stderr, "ERROR: Unable to get PPD file %s: %d - %s\n",
|
||||
uri, get_status, httpStatus(get_status));
|
||||
}
|
||||
@@ -1139,7 +1122,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
|
||||
if ((var = cgiGetVariable("CURRENT_MAKE")) == NULL)
|
||||
var = cgiGetVariable("PPD_MAKE");
|
||||
if (var && !cgiGetVariable("SELECT_MAKE"))
|
||||
if (var)
|
||||
{
|
||||
const char *make_model; /* Make and model */
|
||||
|
||||
@@ -1147,7 +1130,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_TEXT,
|
||||
"ppd-make", NULL, var);
|
||||
|
||||
if ((make_model = cgiGetVariable("CURRENT_MAKE_AND_MODEL")) != NULL)
|
||||
if ((make_model = cgiGetVariable("CURRENT_MAKE_AND_MODEL")) != NULL &&
|
||||
!cgiGetVariable("SELECT_MAKE"))
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_TEXT,
|
||||
"ppd-make-and-model", NULL, make_model);
|
||||
}
|
||||
@@ -1459,18 +1443,14 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
*share_printers,/* SHARE_PRINTERS value */
|
||||
*user_cancel_any,
|
||||
/* USER_CANCEL_ANY value */
|
||||
*browse_web_if = NULL,
|
||||
/* BrowseWebIF value */
|
||||
*preserve_job_history = NULL,
|
||||
*browse_web_if, /* BrowseWebIF value */
|
||||
*preserve_job_history,
|
||||
/* PreserveJobHistory value */
|
||||
*preserve_job_files = NULL,
|
||||
*preserve_job_files,
|
||||
/* PreserveJobFiles value */
|
||||
*max_clients = NULL,
|
||||
/* MaxClients value */
|
||||
*max_jobs = NULL,
|
||||
/* MaxJobs value */
|
||||
*max_log_size = NULL;
|
||||
/* MaxLogSize value */
|
||||
*max_clients, /* MaxClients value */
|
||||
*max_jobs, /* MaxJobs value */
|
||||
*max_log_size; /* MaxLogSize value */
|
||||
char local_protocols[255],
|
||||
/* BrowseLocalProtocols */
|
||||
remote_protocols[255];
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<!--
|
||||
"$Id: api-array.header 8087 2008-10-27 21:37:05Z mike $"
|
||||
|
||||
CGI API header for CUPS.
|
||||
|
||||
Copyright 2009 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>CGI API</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Header</th>
|
||||
<th>cups/cgi.h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Library</th>
|
||||
<td>-lcupscgi</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>See Also</th>
|
||||
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
@@ -1,17 +0,0 @@
|
||||
<!--
|
||||
"$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
|
||||
|
||||
CGI API introduction for CUPS.
|
||||
|
||||
Copyright 2009 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
|
||||
|
||||
<p>The CGI API provides Common Gateway Interface functions for CUPS.</p>
|
||||
+1
-2
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* CGI support library definitions.
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -95,7 +95,6 @@ extern void cgiShowIPPError(const char *message);
|
||||
extern void cgiShowJobs(http_t *http, const char *dest);
|
||||
extern void cgiStartHTML(const char *title);
|
||||
extern void cgiStartMultipart(void);
|
||||
extern int cgiSupportsMultipart(void);
|
||||
extern const char *cgiText(const char *message);
|
||||
|
||||
#endif /* !_CUPS_CGI_H_ */
|
||||
|
||||
+11
-52
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* HTML support functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -14,13 +14,12 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cgiEndHTML() - End a HTML page.
|
||||
* cgiEndMultipart() - End the delivery of a multipart web page.
|
||||
* cgiFormEncode() - Encode a string as a form variable.
|
||||
* cgiStartHTML() - Start a HTML page.
|
||||
* cgiStartMultipart() - Start a multipart delivery of a web page.
|
||||
* cgiSupportsMultipart() - Does the browser support multi-part documents?
|
||||
* cgi_null_passwd() - Return a NULL password for authentication.
|
||||
* cgiEndHTML() - End a HTML page.
|
||||
* cgiEndMultipart() - End the delivery of a multipart web page.
|
||||
* cgiFormEncode() - Encode a string as a form variable...
|
||||
* cgiStartHTML() - Start a HTML page.
|
||||
* cgiStartMultipart() - Start a multipart delivery of a web page...
|
||||
* cgi_null_passwd() - Return a NULL password for authentication.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -68,15 +67,12 @@ void
|
||||
cgiEndMultipart(void)
|
||||
{
|
||||
if (cgi_multipart)
|
||||
{
|
||||
printf("\n%s--\n", cgi_multipart);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiFormEncode()' - Encode a string as a form variable.
|
||||
* 'cgiFormEncode()' - Encode a string as a form variable...
|
||||
*/
|
||||
|
||||
char * /* O - Destination string */
|
||||
@@ -187,55 +183,18 @@ cgiStartHTML(const char *title) /* I - Title of page */
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiStartMultipart()' - Start a multipart delivery of a web page.
|
||||
* 'cgiStartMultipart()' - Start a multipart delivery of a web page...
|
||||
*/
|
||||
|
||||
void
|
||||
cgiStartMultipart(void)
|
||||
{
|
||||
puts("MIME-Version: 1.0\n"
|
||||
"Content-Type: multipart/x-mixed-replace; boundary=\"CUPS-MULTIPART\"\n");
|
||||
fflush(stdout);
|
||||
|
||||
puts("MIME-Version: 1.0");
|
||||
puts("Content-Type: multipart/x-mixed-replace; boundary=\"CUPS-MULTIPART\"\n");
|
||||
cgi_multipart = "--CUPS-MULTIPART";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiSupportsMultipart()' - Does the browser support multi-part documents?
|
||||
*/
|
||||
|
||||
int /* O - 1 if multi-part supported, 0 otherwise */
|
||||
cgiSupportsMultipart(void)
|
||||
{
|
||||
const char *user_agent; /* User-Agent string */
|
||||
static int supports_multipart = -1;/* Cached value */
|
||||
|
||||
|
||||
if (supports_multipart < 0)
|
||||
{
|
||||
/*
|
||||
* CUPS STR #3049: Apparently some browsers don't support multi-part
|
||||
* documents, which makes them useless for many web sites. Rather than
|
||||
* abandoning those users, we'll offer a degraded single-part mode...
|
||||
*
|
||||
* Currently we know that anything based on Gecko, MSIE, and Safari all
|
||||
* work. We'll add more as they are reported/tested.
|
||||
*/
|
||||
|
||||
if ((user_agent = getenv("HTTP_USER_AGENT")) != NULL &&
|
||||
(strstr(user_agent, " Gecko/") != NULL ||
|
||||
strstr(user_agent, " MSIE ") != NULL ||
|
||||
strstr(user_agent, " Safari/") != NULL))
|
||||
supports_multipart = 1;
|
||||
else
|
||||
supports_multipart = 0;
|
||||
}
|
||||
|
||||
return (supports_multipart);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_null_passwd()' - Return a NULL password for authentication.
|
||||
*/
|
||||
|
||||
+56
-89
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -288,7 +288,8 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
|
||||
* See who is logged in...
|
||||
*/
|
||||
|
||||
user = getenv("REMOTE_USER");
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
/*
|
||||
* See if the user has already selected a new destination...
|
||||
@@ -373,14 +374,8 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", NULL, "printer-uri-supported");
|
||||
|
||||
if (user)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type",
|
||||
CUPS_PRINTER_LOCAL);
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type-mask",
|
||||
CUPS_PRINTER_SCANNER);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
@@ -420,18 +415,7 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
|
||||
else
|
||||
cgiStartHTML(cgiText(_("Move All Jobs")));
|
||||
|
||||
if (cgiGetSize("JOB_PRINTER_NAME") > 0)
|
||||
cgiCopyTemplateLang("job-move.tmpl");
|
||||
else
|
||||
{
|
||||
if (job_id)
|
||||
cgiSetVariable("MESSAGE", cgiText(_("Unable to move job")));
|
||||
else
|
||||
cgiSetVariable("MESSAGE", cgiText(_("Unable to move jobs")));
|
||||
|
||||
cgiSetVariable("ERROR", cgiText(_("No destinations added.")));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
}
|
||||
cgiCopyTemplateLang("job-move.tmpl");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -493,10 +477,7 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
|
||||
{
|
||||
const char *path = strstr(job_printer_uri, "/printers/");
|
||||
if (!path)
|
||||
{
|
||||
path = strstr(job_printer_uri, "/classes/");
|
||||
cgiSetVariable("IS_CLASS", "YES");
|
||||
}
|
||||
|
||||
if (path)
|
||||
{
|
||||
@@ -567,14 +548,11 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
|
||||
* Show status...
|
||||
*/
|
||||
|
||||
if (cgiSupportsMultipart())
|
||||
{
|
||||
cgiStartMultipart();
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("command.tmpl");
|
||||
cgiEndHTML();
|
||||
fflush(stdout);
|
||||
}
|
||||
cgiStartMultipart();
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("command.tmpl");
|
||||
cgiEndHTML();
|
||||
fflush(stdout);
|
||||
|
||||
/*
|
||||
* Send the command file job...
|
||||
@@ -596,9 +574,7 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
if (cgiSupportsMultipart())
|
||||
cgiEndMultipart();
|
||||
cgiEndMultipart();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -616,9 +592,7 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
if (cgiSupportsMultipart())
|
||||
cgiEndMultipart();
|
||||
cgiEndMultipart();
|
||||
|
||||
cupsCancelJob(dest, job_id);
|
||||
return;
|
||||
@@ -628,47 +602,44 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
|
||||
* Wait for the job to complete...
|
||||
*/
|
||||
|
||||
if (cgiSupportsMultipart())
|
||||
for (;;)
|
||||
{
|
||||
for (;;)
|
||||
/*
|
||||
* Get the current job state...
|
||||
*/
|
||||
|
||||
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
|
||||
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
|
||||
NULL, uri);
|
||||
if (user)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", 2, NULL, job_attrs);
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
|
||||
|
||||
attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM);
|
||||
if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED)
|
||||
{
|
||||
/*
|
||||
* Get the current job state...
|
||||
*/
|
||||
|
||||
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
|
||||
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
|
||||
NULL, uri);
|
||||
if (user)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", 2, NULL, job_attrs);
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
|
||||
|
||||
attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM);
|
||||
if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED)
|
||||
{
|
||||
ippDelete(response);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Job not complete, so update the status...
|
||||
*/
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("command.tmpl");
|
||||
cgiEndHTML();
|
||||
fflush(stdout);
|
||||
|
||||
sleep(5);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Job not complete, so update the status...
|
||||
*/
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("command.tmpl");
|
||||
cgiEndHTML();
|
||||
fflush(stdout);
|
||||
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -684,9 +655,7 @@ cgiPrintCommand(http_t *http, /* I - Connection to server */
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("command.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
if (cgiSupportsMultipart())
|
||||
cgiEndMultipart();
|
||||
cgiEndMultipart();
|
||||
}
|
||||
|
||||
|
||||
@@ -809,7 +778,7 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
|
||||
int urlsize, /* I - Size of URL buffer */
|
||||
const char *newresource) /* I - Replacement resource */
|
||||
{
|
||||
char scheme[HTTP_MAX_URI],
|
||||
char method[HTTP_MAX_URI],
|
||||
userpass[HTTP_MAX_URI],
|
||||
hostname[HTTP_MAX_URI],
|
||||
rawresource[HTTP_MAX_URI],
|
||||
@@ -856,13 +825,13 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
|
||||
* Convert the URI to a URL...
|
||||
*/
|
||||
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass,
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, uri, method, sizeof(method), userpass,
|
||||
sizeof(userpass), hostname, sizeof(hostname), &port,
|
||||
rawresource, sizeof(rawresource));
|
||||
|
||||
if (!strcmp(scheme, "ipp") ||
|
||||
!strcmp(scheme, "http") ||
|
||||
!strcmp(scheme, "https"))
|
||||
if (!strcmp(method, "ipp") ||
|
||||
!strcmp(method, "http") ||
|
||||
!strcmp(method, "https"))
|
||||
{
|
||||
if (newresource)
|
||||
{
|
||||
@@ -901,9 +870,7 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
|
||||
* Map local access to a local URI...
|
||||
*/
|
||||
|
||||
if (!strcasecmp(hostname, "127.0.0.1") ||
|
||||
!strcasecmp(hostname, "[::1]") ||
|
||||
!strcasecmp(hostname, "localhost") ||
|
||||
if (!strcasecmp(hostname, "localhost") ||
|
||||
!strncasecmp(hostname, "localhost.", 10) ||
|
||||
!strcasecmp(hostname, server) ||
|
||||
!strcasecmp(hostname, servername))
|
||||
@@ -1422,8 +1389,8 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
|
||||
NULL, url);
|
||||
}
|
||||
else
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
|
||||
"ipp://localhost/");
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL,
|
||||
"ipp://localhost/jobs");
|
||||
|
||||
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
|
||||
|
||||
@@ -30,7 +30,6 @@ _cgiShowIPPError
|
||||
_cgiShowJobs
|
||||
_cgiStartHTML
|
||||
_cgiStartMultipart
|
||||
_cgiSupportsMultipart
|
||||
_cgiText
|
||||
_helpDeleteIndex
|
||||
_helpFindNode
|
||||
|
||||
@@ -1,478 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Xcode documentation set generator.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* makedocset directory *.tokens
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Test the help index code.
|
||||
* compare_html() - Compare the titles of two HTML files.
|
||||
* compare_sections() - Compare the names of two help sections.
|
||||
* compare_sections_files() - Compare the number of files and section names.
|
||||
* write_index() - Write an index file for the CUPS help.
|
||||
* write_info() - Write the Info.plist file.
|
||||
* write_nodes() - Write the Nodes.xml file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi.h"
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local structures...
|
||||
*/
|
||||
|
||||
typedef struct _cups_html_s /**** Help file ****/
|
||||
{
|
||||
char *path; /* Path to help file */
|
||||
char *title; /* Title of help file */
|
||||
} _cups_html_t;
|
||||
|
||||
typedef struct _cups_section_s /**** Help section ****/
|
||||
{
|
||||
char *name; /* Section name */
|
||||
cups_array_t *files; /* Files in this section */
|
||||
} _cups_section_t;
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int compare_html(_cups_html_t *a, _cups_html_t *b);
|
||||
static int compare_sections(_cups_section_t *a, _cups_section_t *b);
|
||||
static int compare_sections_files(_cups_section_t *a, _cups_section_t *b);
|
||||
static void write_index(const char *path, help_index_t *hi);
|
||||
static void write_info(const char *path, const char *revision);
|
||||
static void write_nodes(const char *path, help_index_t *hi);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Test the help index code.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line args */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char path[1024], /* Path to documentation */
|
||||
line[1024]; /* Line from file */
|
||||
help_index_t *hi; /* Help index */
|
||||
cups_file_t *tokens, /* Tokens.xml file */
|
||||
*fp; /* Current file */
|
||||
|
||||
|
||||
if (argc < 4)
|
||||
{
|
||||
puts("Usage: makedocset directory revision *.tokens");
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Index the help documents...
|
||||
*/
|
||||
|
||||
snprintf(path, sizeof(path), "%s/Contents/Resources/Documentation", argv[1]);
|
||||
if ((hi = helpLoadIndex(NULL, path)) == NULL)
|
||||
{
|
||||
fputs("makedocset: Unable to index help files!\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
snprintf(path, sizeof(path), "%s/Contents/Resources/Documentation/index.html",
|
||||
argv[1]);
|
||||
write_index(path, hi);
|
||||
|
||||
snprintf(path, sizeof(path), "%s/Contents/Resources/Nodes.xml", argv[1]);
|
||||
write_nodes(path, hi);
|
||||
|
||||
/*
|
||||
* Write the Info.plist file...
|
||||
*/
|
||||
|
||||
snprintf(path, sizeof(path), "%s/Contents/Info.plist", argv[1]);
|
||||
write_info(path, argv[2]);
|
||||
|
||||
/*
|
||||
* Merge the Tokens.xml files...
|
||||
*/
|
||||
|
||||
snprintf(path, sizeof(path), "%s/Contents/Resources/Tokens.xml", argv[1]);
|
||||
if ((tokens = cupsFileOpen(path, "w")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "makedocset: Unable to create \"%s\": %s\n", path,
|
||||
strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
cupsFilePuts(tokens, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
cupsFilePuts(tokens, "<Tokens version=\"1.0\">\n");
|
||||
|
||||
for (i = 3; i < argc; i ++)
|
||||
{
|
||||
if ((fp = cupsFileOpen(argv[i], "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "makedocset: Unable to open \"%s\": %s\n", argv[i],
|
||||
strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (!cupsFileGets(fp, line, sizeof(line)) || strncmp(line, "<?xml ", 6) ||
|
||||
!cupsFileGets(fp, line, sizeof(line)) || strncmp(line, "<Tokens ", 8))
|
||||
{
|
||||
fprintf(stderr, "makedocset: Bad Tokens.xml file \"%s\"!\n", argv[i]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
while (cupsFileGets(fp, line, sizeof(line)))
|
||||
{
|
||||
if (strcmp(line, "</Tokens>"))
|
||||
cupsFilePrintf(tokens, "%s\n", line);
|
||||
}
|
||||
|
||||
cupsFileClose(fp);
|
||||
}
|
||||
|
||||
cupsFilePuts(tokens, "</Tokens>\n");
|
||||
|
||||
cupsFileClose(tokens);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'compare_html()' - Compare the titles of two HTML files.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
compare_html(_cups_html_t *a, /* I - First file */
|
||||
_cups_html_t *b) /* I - Second file */
|
||||
{
|
||||
return (strcasecmp(a->title, b->title));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'compare_sections()' - Compare the names of two help sections.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
compare_sections(_cups_section_t *a, /* I - First section */
|
||||
_cups_section_t *b) /* I - Second section */
|
||||
{
|
||||
return (strcasecmp(a->name, b->name));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'compare_sections_files()' - Compare the number of files and section names.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
compare_sections_files(
|
||||
_cups_section_t *a, /* I - First section */
|
||||
_cups_section_t *b) /* I - Second section */
|
||||
{
|
||||
int ret = cupsArrayCount(b->files) - cupsArrayCount(a->files);
|
||||
|
||||
if (ret)
|
||||
return (ret);
|
||||
else
|
||||
return (strcasecmp(a->name, b->name));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'write_index()' - Write an index file for the CUPS help.
|
||||
*/
|
||||
|
||||
static void
|
||||
write_index(const char *path, /* I - File to write */
|
||||
help_index_t *hi) /* I - Index of files */
|
||||
{
|
||||
cups_file_t *fp; /* Output file */
|
||||
help_node_t *node; /* Current help node */
|
||||
_cups_section_t *section, /* Current section */
|
||||
key; /* Section search key */
|
||||
_cups_html_t *html; /* Current HTML file */
|
||||
cups_array_t *sections, /* Sections in index */
|
||||
*sections_files,/* Sections sorted by size */
|
||||
*columns[3]; /* Columns in final HTML file */
|
||||
int column, /* Current column */
|
||||
lines[3], /* Number of lines in each column */
|
||||
min_column, /* Smallest column */
|
||||
min_lines; /* Smallest number of lines */
|
||||
|
||||
|
||||
/*
|
||||
* Build an array of sections and their files.
|
||||
*/
|
||||
|
||||
sections = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
|
||||
|
||||
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
|
||||
node;
|
||||
node = (help_node_t *)cupsArrayNext(hi->nodes))
|
||||
{
|
||||
if (node->anchor)
|
||||
continue;
|
||||
|
||||
key.name = node->section ? node->section : "Miscellaneous";
|
||||
if ((section = (_cups_section_t *)cupsArrayFind(sections, &key)) == NULL)
|
||||
{
|
||||
section = (_cups_section_t *)calloc(1, sizeof(_cups_section_t));
|
||||
section->name = key.name;
|
||||
section->files = cupsArrayNew((cups_array_func_t)compare_html, NULL);
|
||||
|
||||
cupsArrayAdd(sections, section);
|
||||
}
|
||||
|
||||
html = (_cups_html_t *)calloc(1, sizeof(_cups_html_t));
|
||||
html->path = node->filename;
|
||||
html->title = node->text;
|
||||
|
||||
cupsArrayAdd(section->files, html);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a sorted list of sections based on the number of files in each section
|
||||
* and the section name...
|
||||
*/
|
||||
|
||||
sections_files = cupsArrayNew((cups_array_func_t)compare_sections_files,
|
||||
NULL);
|
||||
for (section = (_cups_section_t *)cupsArrayFirst(sections);
|
||||
section;
|
||||
section = (_cups_section_t *)cupsArrayNext(sections))
|
||||
cupsArrayAdd(sections_files, section);
|
||||
|
||||
/*
|
||||
* Then build three columns to hold everything, trying to balance the number of
|
||||
* lines in each column...
|
||||
*/
|
||||
|
||||
for (column = 0; column < 3; column ++)
|
||||
{
|
||||
columns[column] = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
|
||||
lines[column] = 0;
|
||||
}
|
||||
|
||||
for (section = (_cups_section_t *)cupsArrayFirst(sections_files);
|
||||
section;
|
||||
section = (_cups_section_t *)cupsArrayNext(sections_files))
|
||||
{
|
||||
for (min_column = 0, min_lines = lines[0], column = 1;
|
||||
column < 3;
|
||||
column ++)
|
||||
{
|
||||
if (lines[column] < min_lines)
|
||||
{
|
||||
min_column = column;
|
||||
min_lines = lines[column];
|
||||
}
|
||||
}
|
||||
|
||||
cupsArrayAdd(columns[min_column], section);
|
||||
lines[min_column] += cupsArrayCount(section->files) + 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the HTML file...
|
||||
*/
|
||||
|
||||
if ((fp = cupsFileOpen(path, "w")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cupsFilePuts(fp, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 "
|
||||
"Transitional//EN\" "
|
||||
"\"http://www.w3.org/TR/html4/loose.dtd\">\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
"<title>CUPS Documentation</title>\n"
|
||||
"<link rel='stylesheet' type='text/css' "
|
||||
"href='cups-printable.css'>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
"<h1 class='title'>CUPS Documentation</h1>\n"
|
||||
"<table width='100%' summary=''>\n"
|
||||
"<tr>\n");
|
||||
|
||||
for (column = 0; column < 3; column ++)
|
||||
{
|
||||
if (column)
|
||||
cupsFilePuts(fp, "<td> </td>\n");
|
||||
|
||||
cupsFilePuts(fp, "<td valign='top' width='33%'>");
|
||||
for (section = (_cups_section_t *)cupsArrayFirst(columns[column]);
|
||||
section;
|
||||
section = (_cups_section_t *)cupsArrayNext(columns[column]))
|
||||
{
|
||||
cupsFilePrintf(fp, "<h2 class='title'>%s</h2>\n", section->name);
|
||||
for (html = (_cups_html_t *)cupsArrayFirst(section->files);
|
||||
html;
|
||||
html = (_cups_html_t *)cupsArrayNext(section->files))
|
||||
cupsFilePrintf(fp, "<p class='compact'><a href='%s'>%s</a></p>\n",
|
||||
html->path, html->title);
|
||||
}
|
||||
cupsFilePuts(fp, "</td>\n");
|
||||
}
|
||||
cupsFilePuts(fp, "</tr>\n"
|
||||
"</table>\n"
|
||||
"</body>\n"
|
||||
"</html>\n");
|
||||
cupsFileClose(fp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'write_info()' - Write the Info.plist file.
|
||||
*/
|
||||
|
||||
static void
|
||||
write_info(const char *path, /* I - File to write */
|
||||
const char *revision) /* I - Version number */
|
||||
{
|
||||
cups_file_t *fp; /* File */
|
||||
|
||||
|
||||
if ((fp = cupsFileOpen(path, "w")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cupsFilePrintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" "
|
||||
"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
"<plist version=\"1.0\">\n"
|
||||
"<dict>\n"
|
||||
"\t<key>CFBundleIdentifier</key>\n"
|
||||
"\t<string>org.cups.docset</string>\n"
|
||||
"\t<key>CFBundleName</key>\n"
|
||||
"\t<string>CUPS Documentation</string>\n"
|
||||
"\t<key>CFBundleVersion</key>\n"
|
||||
"\t<string>1.4.%s</string>\n"
|
||||
"\t<key>DocSetFeedName</key>\n"
|
||||
"\t<string>cups.org</string>\n"
|
||||
"\t<key>DocSetFeedURL</key>\n"
|
||||
"\t<string>http://www.cups.org/org.cups.docset.xar"
|
||||
"</string>\n"
|
||||
"</dict>\n"
|
||||
"</plist>\n", revision);
|
||||
|
||||
cupsFileClose(fp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'write_nodes()' - Write the Nodes.xml file.
|
||||
*/
|
||||
|
||||
static void
|
||||
write_nodes(const char *path, /* I - File to write */
|
||||
help_index_t *hi) /* I - Index of files */
|
||||
{
|
||||
cups_file_t *fp; /* Output file */
|
||||
int id; /* Current node ID */
|
||||
help_node_t *node; /* Current help node */
|
||||
int subnodes; /* Currently in Subnodes for file? */
|
||||
int needclose; /* Need to close the current node? */
|
||||
|
||||
|
||||
if ((fp = cupsFileOpen(path, "w")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cupsFilePuts(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<DocSetNodes version=\"1.0\">\n"
|
||||
"<TOC>\n"
|
||||
"<Node id=\"0\">\n"
|
||||
"<Name>CUPS Documentation</Name>\n"
|
||||
"<Path>Documentation/index.html</Path>\n"
|
||||
"</Node>\n");
|
||||
|
||||
for (node = (help_node_t *)cupsArrayFirst(hi->nodes), id = 1, subnodes = 0,
|
||||
needclose = 0;
|
||||
node;
|
||||
node = (help_node_t *)cupsArrayNext(hi->nodes), id ++)
|
||||
{
|
||||
if (node->anchor)
|
||||
{
|
||||
if (!subnodes)
|
||||
{
|
||||
cupsFilePuts(fp, "<Subnodes>\n");
|
||||
subnodes = 1;
|
||||
}
|
||||
|
||||
cupsFilePrintf(fp, "<Node id=\"%d\">\n"
|
||||
"<Path>Documentation/%s</Path>\n"
|
||||
"<Anchor>%s</Anchor>\n"
|
||||
"<Name>%s</Name>\n"
|
||||
"</Node>\n", id, node->filename, node->anchor,
|
||||
node->text);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (subnodes)
|
||||
{
|
||||
cupsFilePuts(fp, "</Subnodes>\n");
|
||||
subnodes = 0;
|
||||
}
|
||||
|
||||
if (needclose)
|
||||
cupsFilePuts(fp, "</Node>\n");
|
||||
|
||||
cupsFilePrintf(fp, "<Node id=\"%d\">\n"
|
||||
"<Path>Documentation/%s</Path>\n"
|
||||
"<Name>%s</Name>\n", id, node->filename, node->text);
|
||||
needclose = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (subnodes)
|
||||
cupsFilePuts(fp, "</Subnodes>\n");
|
||||
|
||||
if (needclose)
|
||||
cupsFilePuts(fp, "</Node>\n");
|
||||
|
||||
cupsFilePuts(fp, "</TOC>\n"
|
||||
"</DocSetNodes>\n");
|
||||
|
||||
cupsFileClose(fp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+4
-13
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* CGI form variable and array functions.
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -148,6 +148,9 @@ cgiGetArray(const char *name, /* I - Name of array variable */
|
||||
if ((var = cgi_find_variable(name)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (var->nvalues == 1)
|
||||
return (var->values[0]);
|
||||
|
||||
if (element < 0 || element >= var->nvalues)
|
||||
return (NULL);
|
||||
|
||||
@@ -806,18 +809,6 @@ cgi_initialize_post(void)
|
||||
else
|
||||
nbytes = 0;
|
||||
}
|
||||
else if (nbytes == 0)
|
||||
{
|
||||
/*
|
||||
* CUPS STR #3176: OpenBSD: Early end-of-file on POST data causes 100% CPU
|
||||
*
|
||||
* This should never happen, but does on OpenBSD. If we see early end-of-
|
||||
* file, treat this as an error and process no data.
|
||||
*/
|
||||
|
||||
free(data);
|
||||
return (0);
|
||||
}
|
||||
|
||||
data[length] = '\0';
|
||||
|
||||
|
||||
+6
-3
@@ -72,12 +72,15 @@ install: all install-data install-headers install-libs install-exec
|
||||
install-data:
|
||||
for file in $(KEEP); do \
|
||||
if test -r $(SERVERROOT)/$$file ; then \
|
||||
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.N ; \
|
||||
$(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \
|
||||
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file.N || true; \
|
||||
else \
|
||||
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT) ; \
|
||||
$(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
|
||||
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file || true; \
|
||||
fi ; \
|
||||
done
|
||||
$(INSTALL_CONFIG) -g $(CUPS_GROUP) cupsd.conf $(SERVERROOT)/cupsd.conf.default
|
||||
$(INSTALL_CONFIG) cupsd.conf $(SERVERROOT)/cupsd.conf.default
|
||||
-chgrp $(CUPS_GROUP) $(SERVERROOT)/cupsd.conf.default
|
||||
$(INSTALL_DIR) -m 755 $(DATADIR)/mime
|
||||
for file in $(REPLACE); do \
|
||||
if test -r $(DATADIR)/mime/$$file ; then \
|
||||
|
||||
@@ -22,7 +22,7 @@ Listen localhost:@DEFAULT_IPP_PORT@
|
||||
Browsing On
|
||||
BrowseOrder allow,deny
|
||||
BrowseAllow all
|
||||
BrowseLocalProtocols @CUPS_BROWSE_LOCAL_PROTOCOLS@
|
||||
BrowseLocalProtocols @CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS@
|
||||
|
||||
# Default authentication type, when authentication is required...
|
||||
DefaultAuthType Basic
|
||||
@@ -34,6 +34,7 @@ DefaultAuthType Basic
|
||||
|
||||
# Restrict access to the admin pages...
|
||||
<Location /admin>
|
||||
@ENCRYPTION_REQUIRED@
|
||||
Order allow,deny
|
||||
</Location>
|
||||
|
||||
@@ -62,13 +63,13 @@ DefaultAuthType Basic
|
||||
# All printer operations require a printer operator to authenticate...
|
||||
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
|
||||
AuthType Default
|
||||
Require user @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
|
||||
Require user @CUPS_DEFAULT_PRINTADMIN_AUTH@
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
# Only the owner or an administrator can cancel or authenticate a job...
|
||||
<Limit Cancel-Job CUPS-Authenticate-Job>
|
||||
Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
|
||||
Require user @OWNER @CUPS_DEFAULT_PRINTADMIN_AUTH@
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
@@ -101,18 +102,19 @@ DefaultAuthType Basic
|
||||
# All printer operations require a printer operator to authenticate...
|
||||
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
|
||||
AuthType Default
|
||||
Require user @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
|
||||
Require user @CUPS_DEFAULT_PRINTADMIN_AUTH@
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
# Only the owner or an administrator can cancel or authenticate a job...
|
||||
<Limit Cancel-Job CUPS-Authenticate-Job>
|
||||
AuthType Default
|
||||
Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
|
||||
Require user @OWNER @CUPS_DEFAULT_PRINTADMIN_AUTH@
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
<Limit All>
|
||||
AuthType Default
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
</Policy>
|
||||
|
||||
+7
-9
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: mime.types 8652 2009-05-16 23:48:35Z mike $"
|
||||
# "$Id: mime.types 7995 2008-10-01 04:48:33Z mike $"
|
||||
#
|
||||
# MIME types file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
@@ -7,7 +7,7 @@
|
||||
# VERSIONS OF CUPS. Instead, create a "local.types" file that
|
||||
# reflects your local configuration changes.
|
||||
#
|
||||
# Copyright 2007-2009 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
|
||||
@@ -50,12 +50,10 @@
|
||||
#
|
||||
# MIME type names are case-insensitive. Internally they are converted
|
||||
# to lowercase. Multiple occurrences of a type will cause the provided
|
||||
# rules to be appended to the existing definition. If two types use the same
|
||||
# rules to resolve a type and have the same priority, e.g. "doc" extension for
|
||||
# "text/bar" and "text/foo", the returned type will be the first type as
|
||||
# sorted in alphanumerically ascending order without regard to case. Thus,
|
||||
# the "text/bar" type will match the "doc" extension first unless the
|
||||
# "text/foo" type has specified a higher priority.
|
||||
# rules to be appended to the existing definition. Type names are sorted
|
||||
# in ascending order, so if two types use the same rules to resolve a type
|
||||
# (e.g. doc extension for two types), the returned type will be the first
|
||||
# type in the sorted list.
|
||||
#
|
||||
# The "printable" rule differs from the "ascii" rule in that it also
|
||||
# accepts 8-bit characters in the range 128-255.
|
||||
@@ -177,5 +175,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
|
||||
application/octet-stream
|
||||
|
||||
#
|
||||
# End of "$Id: mime.types 8652 2009-05-16 23:48:35Z mike $".
|
||||
# End of "$Id: mime.types 7995 2008-10-01 04:48:33Z mike $".
|
||||
#
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-3264.m4 8524 2009-04-19 21:18:45Z mike $"
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl 32/64-bit library support stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
dnl Setup support for separate 32/64-bit library generation...
|
||||
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems])
|
||||
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
|
||||
|
||||
INSTALL32=""
|
||||
LIB32CUPS=""
|
||||
@@ -28,7 +28,7 @@ AC_SUBST(LIB32CUPSIMAGE)
|
||||
AC_SUBST(LIB32DIR)
|
||||
AC_SUBST(UNINSTALL32)
|
||||
|
||||
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems])
|
||||
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
|
||||
|
||||
INSTALL64=""
|
||||
LIB64CUPS=""
|
||||
@@ -136,5 +136,5 @@ case "$uname" in
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-3264.m4 8524 2009-04-19 21:18:45Z mike $".
|
||||
dnl End of "$Id$".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 8613 2009-05-11 22:39:39Z mike $"
|
||||
dnl "$Id: cups-common.m4 8094 2008-10-31 20:51:39Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 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
|
||||
@@ -20,7 +20,7 @@ dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Version number information...
|
||||
CUPS_VERSION="1.4b3"
|
||||
CUPS_VERSION="1.4b2"
|
||||
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'`"
|
||||
@@ -65,7 +65,7 @@ fi
|
||||
AC_SUBST(CUPS_HTMLVIEW)
|
||||
|
||||
AC_MSG_CHECKING(for install-sh script)
|
||||
INSTALL="`pwd`/install-sh"
|
||||
INSTALL="`pwd`/install-sh -c"
|
||||
AC_SUBST(INSTALL)
|
||||
AC_MSG_RESULT(using $INSTALL)
|
||||
|
||||
@@ -78,7 +78,7 @@ fi
|
||||
|
||||
dnl Static library option...
|
||||
INSTALLSTATIC=""
|
||||
AC_ARG_ENABLE(static, [ --enable-static install static libraries])
|
||||
AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
|
||||
|
||||
if test x$enable_static = xyes; then
|
||||
echo Installing static libraries...
|
||||
@@ -92,7 +92,7 @@ AC_SEARCH_LIBS(crypt, crypt)
|
||||
AC_SEARCH_LIBS(getspent, sec gen)
|
||||
|
||||
LIBMALLOC=""
|
||||
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo build with malloc debug logging])
|
||||
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
|
||||
|
||||
if test x$enable_mallinfo = xyes; then
|
||||
SAVELIBS="$LIBS"
|
||||
@@ -105,7 +105,7 @@ fi
|
||||
AC_SUBST(LIBMALLOC)
|
||||
|
||||
dnl Check for libpaper support...
|
||||
AC_ARG_ENABLE(libpaper, [ --enable-libpaper build with libpaper support])
|
||||
AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
|
||||
|
||||
if test x$enable_libpaper = xyes; then
|
||||
AC_CHECK_LIB(paper,systempapername,
|
||||
@@ -180,7 +180,7 @@ dnl See if we have the removefile(3) function for securely removing files
|
||||
AC_CHECK_FUNCS(removefile)
|
||||
|
||||
dnl See if we have libusb...
|
||||
AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing])
|
||||
AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing, default=auto])
|
||||
|
||||
LIBUSB=""
|
||||
AC_SUBST(LIBUSB)
|
||||
@@ -201,7 +201,7 @@ if test $check_libusb = yes; then
|
||||
fi
|
||||
|
||||
dnl See if we have libwrap for TCP wrappers support...
|
||||
AC_ARG_ENABLE(tcp_wrappers, [ --enable-tcp-wrappers use libwrap for TCP wrappers support])
|
||||
AC_ARG_ENABLE(tcp_wrappers, [ --enable-tcp-wrappers use libwrap for TCP wrappers support, default=no])
|
||||
|
||||
LIBWRAP=""
|
||||
AC_SUBST(LIBWRAP)
|
||||
@@ -234,7 +234,7 @@ AC_SUBST(CUPSDLIBS)
|
||||
dnl See if we have POSIX ACL support...
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS=""
|
||||
AC_ARG_ENABLE(acl, [ --enable-acl build with POSIX ACL support])
|
||||
AC_ARG_ENABLE(acl, [ --enable-acl enable POSIX ACL support, default=auto])
|
||||
if test "x$enable_acl" != xno; then
|
||||
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
|
||||
CUPSDLIBS="$CUPSDLIBS $LIBS"
|
||||
@@ -248,7 +248,7 @@ else
|
||||
DBUSDIR=""
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(dbus, [ --enable-dbus build with DBUS support])
|
||||
AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
|
||||
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
|
||||
DBUSDIR="$withval")
|
||||
|
||||
@@ -284,7 +284,7 @@ AC_SUBST(DBUS_NOTIFIER)
|
||||
AC_SUBST(DBUS_NOTIFIERLIBS)
|
||||
|
||||
dnl Extra platform-specific libraries...
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
|
||||
CUPS_SYSTEM_AUTHKEY=""
|
||||
FONTS="fonts"
|
||||
LEGACY_BACKENDS="parallel scsi"
|
||||
@@ -307,9 +307,6 @@ case $uname in
|
||||
AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
|
||||
AC_CHECK_FUNCS(mbr_uid_to_uuid)
|
||||
|
||||
dnl Check for the vproc_transaction_begin/end stuff...
|
||||
AC_CHECK_FUNCS(vproc_transaction_begin)
|
||||
|
||||
dnl Need <dlfcn.h> header...
|
||||
AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
|
||||
|
||||
@@ -337,11 +334,11 @@ case $uname in
|
||||
fi
|
||||
|
||||
if test "x$default_operkey" != xdefault; then
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
|
||||
elif grep -q system.print.operator /etc/authorization; then
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
|
||||
else
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
|
||||
fi])
|
||||
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
|
||||
|
||||
@@ -350,12 +347,12 @@ case $uname in
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
|
||||
AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
|
||||
AC_SUBST(CUPS_SYSTEM_AUTHKEY)
|
||||
AC_SUBST(FONTS)
|
||||
AC_SUBST(LEGACY_BACKENDS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 8613 2009-05-11 22:39:39Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 8094 2008-10-31 20:51:39Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-compiler.m4 8655 2009-05-17 00:13:47Z mike $"
|
||||
dnl "$Id: cups-compiler.m4 8139 2008-11-17 23:46:55Z mike $"
|
||||
dnl
|
||||
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 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
|
||||
@@ -20,11 +20,10 @@ OPTIM=""
|
||||
AC_SUBST(INSTALL_STRIP)
|
||||
AC_SUBST(OPTIM)
|
||||
|
||||
AC_ARG_WITH(optim, [ --with-optim set optimization flags ])
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug build with debugging symbols])
|
||||
AC_ARG_ENABLE(debug_guards, [ --enable-debug-guards build with memory allocation guards])
|
||||
AC_ARG_ENABLE(debug_printfs, [ --enable-debug-printfs build with CUPS_DEBUG_LOG support])
|
||||
AC_ARG_ENABLE(unit_tests, [ --enable-unit-tests build and run unit tests])
|
||||
AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no])
|
||||
AC_ARG_ENABLE(debug_printfs, [ --enable-debug-printfs turn on debug printfs, default=no])
|
||||
AC_ARG_ENABLE(unit_tests, [ --enable-unit-tests turn on unit tests, default=no])
|
||||
|
||||
dnl For debugging, keep symbols, otherwise strip them...
|
||||
if test x$enable_debug = xyes; then
|
||||
@@ -36,14 +35,6 @@ fi
|
||||
dnl Debug printfs can slow things down, so provide a separate option for that
|
||||
if test x$enable_debug_printfs = xyes; then
|
||||
CFLAGS="$CFLAGS -DDEBUG"
|
||||
CXXFLAGS="$CXXFLAGS -DDEBUG"
|
||||
fi
|
||||
|
||||
dnl Debug guards use an extra 4 bytes for some structures like strings in the
|
||||
dnl string pool, so provide a separate option for that
|
||||
if test x$enable_debug_guards = xyes; then
|
||||
CFLAGS="$CFLAGS -DDEBUG_GUARDS"
|
||||
CXXFLAGS="$CXXFLAGS -DDEBUG_GUARDS"
|
||||
fi
|
||||
|
||||
dnl Unit tests take up time during a compile...
|
||||
@@ -55,8 +46,10 @@ fi
|
||||
AC_SUBST(UNITTESTS)
|
||||
|
||||
dnl Setup general architecture flags...
|
||||
AC_ARG_WITH(archflags, [ --with-archflags set default architecture flags ])
|
||||
AC_ARG_WITH(ldarchflags, [ --with-ldarchflags set program architecture flags ])
|
||||
AC_ARG_WITH(archflags, [ --with-archflags="flags"
|
||||
set default architecture flags ])
|
||||
AC_ARG_WITH(ldarchflags, [ --with-ldarchflags="flags"
|
||||
set default program architecture flags ])
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
ARCHFLAGS=""
|
||||
@@ -79,16 +72,18 @@ AC_SUBST(ARCHFLAGS)
|
||||
AC_SUBST(LDARCHFLAGS)
|
||||
|
||||
dnl Setup support for separate 32/64-bit library generation...
|
||||
AC_ARG_WITH(arch32flags, [ --with-arch32flags set 32-bit architecture flags])
|
||||
AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
|
||||
specifies 32-bit architecture flags])
|
||||
ARCH32FLAGS=""
|
||||
AC_SUBST(ARCH32FLAGS)
|
||||
|
||||
AC_ARG_WITH(arch64flags, [ --with-arch64flags set 64-bit architecture flags])
|
||||
AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
|
||||
specifies 64-bit architecture flags])
|
||||
ARCH64FLAGS=""
|
||||
AC_SUBST(ARCH64FLAGS)
|
||||
|
||||
dnl Read-only data/program support on Linux...
|
||||
AC_ARG_ENABLE(relro, [ --enable-relro build with the GCC relro option])
|
||||
AC_ARG_ENABLE(relro, [ --enable-relro use GCC relro option, default=no])
|
||||
|
||||
dnl Update compiler options...
|
||||
CXXLIBS="${CXXLIBS:=}"
|
||||
@@ -101,7 +96,7 @@ RELROFLAGS=""
|
||||
AC_SUBST(RELROFLAGS)
|
||||
|
||||
LIBCUPSORDER="libcups.order"
|
||||
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder set libcups secorder file, default=libcups.order],
|
||||
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order],
|
||||
if test -f "$withval"; then
|
||||
LIBCUPSORDER="$withval"
|
||||
fi)
|
||||
@@ -109,7 +104,7 @@ AC_SUBST(LIBCUPSORDER)
|
||||
|
||||
LIBCUPSIMAGEORDER="libcupsimage.order"
|
||||
AC_ARG_WITH(libcupsimageorder, [ --with-libcupsimagesorder
|
||||
set libcupsimage secorder file, default=libcupsimage.order],
|
||||
libcupsimage secorder file, default=libcupsimage.order],
|
||||
if test -f "$withval"; then
|
||||
LIBCUPSIMAGEORDER="$withval"
|
||||
fi)
|
||||
@@ -140,7 +135,7 @@ if test -n "$GCC"; then
|
||||
AC_MSG_CHECKING(if GCC supports -fstack-protector)
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fstack-protector"
|
||||
AC_TRY_LINK(,,
|
||||
AC_TRY_COMPILE(,,
|
||||
OPTIM="$OPTIM -fstack-protector"
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no))
|
||||
@@ -563,5 +558,5 @@ case $uname in
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-compiler.m4 8655 2009-05-17 00:13:47Z mike $".
|
||||
dnl End of "$Id: cups-compiler.m4 8139 2008-11-17 23:46:55Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
dnl
|
||||
dnl "$Id: cups-defaults.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-defaults.m4 8106 2008-11-11 00:57:12Z mike $"
|
||||
dnl
|
||||
dnl Default cupsd configuration settings for the Common UNIX Printing System
|
||||
dnl (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 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
|
||||
@@ -28,11 +28,7 @@ AC_SUBST(LANGUAGES)
|
||||
dnl Default ConfigFilePerm
|
||||
AC_ARG_WITH(config_file_perm, [ --with-config-file-perm set default ConfigFilePerm value, default=0640],
|
||||
CUPS_CONFIG_FILE_PERM="$withval",
|
||||
if test "x$uname" = xDarwin; then
|
||||
CUPS_CONFIG_FILE_PERM="644"
|
||||
else
|
||||
CUPS_CONFIG_FILE_PERM="640"
|
||||
fi)
|
||||
CUPS_CONFIG_FILE_PERM="640")
|
||||
AC_SUBST(CUPS_CONFIG_FILE_PERM)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
|
||||
|
||||
@@ -66,7 +62,7 @@ AC_SUBST(CUPS_ACCESS_LOG_LEVEL)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_ACCESS_LOG_LEVEL, "$CUPS_ACCESS_LOG_LEVEL")
|
||||
|
||||
dnl Default Browsing
|
||||
AC_ARG_ENABLE(browsing, [ --disable-browsing disable Browsing by default])
|
||||
AC_ARG_ENABLE(browsing, [ --enable-browsing enable Browsing by default, default=yes])
|
||||
if test "x$enable_browsing" = xno; then
|
||||
CUPS_BROWSING="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSING, 0)
|
||||
@@ -123,8 +119,8 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS,
|
||||
"$CUPS_BROWSE_REMOTE_PROTOCOLS")
|
||||
|
||||
dnl Default BrowseShortNames
|
||||
AC_ARG_ENABLE(browse_short, [ --disable-browse-short-names
|
||||
disable BrowseShortNames by default])
|
||||
AC_ARG_ENABLE(browse_short, [ --enable-browse-short-names
|
||||
enable BrowseShortNames by default, default=yes])
|
||||
if test "x$enable_browse_short" = xno; then
|
||||
CUPS_BROWSE_SHORT_NAMES="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_SHORT_NAMES, 0)
|
||||
@@ -135,8 +131,7 @@ fi
|
||||
AC_SUBST(CUPS_BROWSE_SHORT_NAMES)
|
||||
|
||||
dnl Default DefaultShared
|
||||
AC_ARG_ENABLE(default_shared, [ --disable-default-shared
|
||||
disable DefaultShared by default])
|
||||
AC_ARG_ENABLE(default_shared, [ --enable-default-shared enable DefaultShared by default, default=yes])
|
||||
if test "x$enable_default_shared" = xno; then
|
||||
CUPS_DEFAULT_SHARED="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DEFAULT_SHARED, 0)
|
||||
@@ -147,8 +142,8 @@ fi
|
||||
AC_SUBST(CUPS_DEFAULT_SHARED)
|
||||
|
||||
dnl Default ImplicitClasses
|
||||
AC_ARG_ENABLE(implicit, [ --disable-implicit-classes
|
||||
disable ImplicitClasses by default])
|
||||
AC_ARG_ENABLE(implicit, [ --enable-implicit-classes
|
||||
enable ImplicitClasses by default, default=yes])
|
||||
if test "x$enable_implicit" = xno; then
|
||||
CUPS_IMPLICIT_CLASSES="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IMPLICIT_CLASSES, 0)
|
||||
@@ -160,7 +155,7 @@ AC_SUBST(CUPS_IMPLICIT_CLASSES)
|
||||
|
||||
dnl Default UseNetworkDefault
|
||||
AC_ARG_ENABLE(use_network_default, [ --enable-use-network-default
|
||||
set UseNetworkDefault to Yes by default])
|
||||
enable UseNetworkDefault by default, default=auto])
|
||||
if test "x$enable_use_network_default" != xno; then
|
||||
AC_MSG_CHECKING(whether to use network default printers)
|
||||
if test "x$enable_use_network_default" = xyes -o $uname != Darwin; then
|
||||
@@ -363,17 +358,28 @@ fi
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SMB_CONFIG_FILE, "$CUPS_DEFAULT_SMB_CONFIG_FILE")
|
||||
|
||||
dnl Default MaxCopies value...
|
||||
AC_ARG_WITH(max-copies, [ --with-max-copies set default max copies value, default=9999 ],
|
||||
AC_ARG_WITH(max-copies, [ --with-max-copies set default max copies value, default=auto ],
|
||||
CUPS_MAX_COPIES="$withval",
|
||||
CUPS_MAX_COPIES="9999")
|
||||
if test "x$uname" = xDarwin; then
|
||||
CUPS_MAX_COPIES="9999"
|
||||
else
|
||||
CUPS_MAX_COPIES="100"
|
||||
fi)
|
||||
|
||||
AC_SUBST(CUPS_MAX_COPIES)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_MAX_COPIES, $CUPS_MAX_COPIES)
|
||||
|
||||
dnl Default raw printing state
|
||||
AC_ARG_ENABLE(raw_printing, [ --disable-raw-printing do not allow raw printing by default])
|
||||
AC_ARG_ENABLE(raw_printing, [ --enable-raw-printing enable raw printing by default, default=auto])
|
||||
if test "x$enable_raw_printing" != xno; then
|
||||
DEFAULT_RAW_PRINTING=""
|
||||
AC_MSG_CHECKING(whether to enable raw printing)
|
||||
if test "x$enable_raw_printing" = xyes -o $uname = Darwin; then
|
||||
DEFAULT_RAW_PRINTING=""
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
DEFAULT_RAW_PRINTING="#"
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
else
|
||||
DEFAULT_RAW_PRINTING="#"
|
||||
fi
|
||||
@@ -400,7 +406,7 @@ AC_SUBST(CUPS_SNMP_ADDRESS)
|
||||
AC_SUBST(CUPS_SNMP_COMMUNITY)
|
||||
|
||||
dnl New default port definition for IPP...
|
||||
AC_ARG_WITH(ipp-port, [ --with-ipp-port set port number for IPP, default=631 ],
|
||||
AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
|
||||
DEFAULT_IPP_PORT="$withval",
|
||||
DEFAULT_IPP_PORT="631")
|
||||
|
||||
@@ -408,8 +414,8 @@ AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl Filters
|
||||
AC_ARG_ENABLE(bannertops, [ --enable-bannertops always build the banner filter ])
|
||||
AC_ARG_ENABLE(texttops, [ --enable-texttops always build the text filter ])
|
||||
AC_ARG_ENABLE(bannertops, [ --enable-bannertops build with default banner filter, default=auto ])
|
||||
AC_ARG_ENABLE(texttops, [ --enable-texttops build with default text filter, default=auto ])
|
||||
|
||||
if test "x$enable_bannertops" = xno; then
|
||||
BANNERTOPS=""
|
||||
@@ -435,5 +441,5 @@ AC_SUBST(BANNERTOPS)
|
||||
AC_SUBST(TEXTTOPS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-defaults.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-defaults.m4 8106 2008-11-11 00:57:12Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-directories.m4 8497 2009-04-12 23:04:51Z mike $"
|
||||
dnl "$Id: cups-directories.m4 8076 2008-10-23 15:38:43Z mike $"
|
||||
dnl
|
||||
dnl Directory stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -411,19 +411,10 @@ AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
|
||||
AC_SUBST(CUPS_SERVERROOT)
|
||||
|
||||
# Transient run-time state
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin (Mac OS X)
|
||||
CUPS_STATEDIR="$CUPS_SERVERROOT"
|
||||
;;
|
||||
*)
|
||||
# All others
|
||||
CUPS_STATEDIR="$localstatedir/run/cups"
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
|
||||
CUPS_STATEDIR="$localstatedir/run/cups"
|
||||
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
|
||||
AC_SUBST(CUPS_STATEDIR)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-directories.m4 8497 2009-04-12 23:04:51Z mike $".
|
||||
dnl End of "$Id: cups-directories.m4 8076 2008-10-23 15:38:43Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-dnssd.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $"
|
||||
dnl
|
||||
dnl DNS Service Discovery (aka Bonjour) stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -7,7 +7,7 @@ dnl http://www.dns-sd.org
|
||||
dnl http://www.multicastdns.org/
|
||||
dnl http://developer.apple.com/networking/bonjour/
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -16,7 +16,7 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support])
|
||||
AC_ARG_ENABLE(dnssd, [ --enable-dnssd turn on DNS Service Discovery support, default=yes])
|
||||
AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library],
|
||||
LDFLAGS="-L$withval $LDFLAGS"
|
||||
DSOFLAGS="-L$withval $DSOFLAGS",)
|
||||
@@ -32,29 +32,17 @@ if test x$enable_dnssd != xno; then
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin and MacOS X...
|
||||
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
|
||||
AC_DEFINE(HAVE_DNSSD)
|
||||
AC_DEFINE(HAVE_COREFOUNDATION)
|
||||
AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
|
||||
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
|
||||
DNSSD_BACKEND="dnssd"
|
||||
;;
|
||||
*)
|
||||
# All others...
|
||||
AC_MSG_CHECKING(for current version of dns_sd library)
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS="$LIBS -ldns_sd"
|
||||
AC_TRY_COMPILE([#include <dns_sd.h],
|
||||
[int constant = kDNSServiceFlagsShareConnection;
|
||||
unsigned char txtRecord[100];
|
||||
uint8_t valueLen;
|
||||
TXTRecordGetValuePtr(sizeof(txtRecord),
|
||||
txtRecord, "value", &valueLen);],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_CHECK_LIB(dns_sd,TXTRecordGetValuePtr,
|
||||
AC_DEFINE(HAVE_DNSSD)
|
||||
DNSSDLIBS="-ldns_sd"
|
||||
DNSSD_BACKEND="dnssd",
|
||||
AC_MSG_RESULT(no))
|
||||
LIBS="$SAVELIBS"
|
||||
DNSSDLIBS="-ldns_sd")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
@@ -64,5 +52,5 @@ AC_SUBST(DNSSDLIBS)
|
||||
AC_SUBST(DNSSD_BACKEND)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-dnssd.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-gssapi.m4 8659 2009-05-18 22:03:04Z mike $"
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl GSSAPI/Kerberos library detection.
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 2006-2007 by Easy Software Products.
|
||||
dnl
|
||||
dnl This file contains Kerberos support code, copyright 2006 by
|
||||
@@ -16,10 +16,9 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(gssapi, [ --disable-gssapi disable GSSAPI support])
|
||||
AC_ARG_ENABLE(gssapi, [ --enable-gssapi turn on GSSAPI support, default=yes])
|
||||
|
||||
LIBGSSAPI=""
|
||||
AC_SUBST(LIBGSSAPI)
|
||||
|
||||
if test x$enable_gssapi != xno; then
|
||||
AC_PATH_PROG(KRB5CONFIG, krb5-config)
|
||||
@@ -74,7 +73,6 @@ if test x$enable_gssapi != xno; then
|
||||
AC_CHECK_FUNC(gsskrb5_register_acceptor_identity,
|
||||
AC_DEFINE(HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY))
|
||||
AC_CHECK_FUNC(krb5_cc_new_unique, AC_DEFINE(HAVE_KRB5_CC_NEW_UNIQUE))
|
||||
AC_CHECK_FUNC(krb5_ipc_client_set_target_uid, AC_DEFINE(HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID))
|
||||
|
||||
AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE)
|
||||
if test $ac_cv_header_gssapi_gssapi_h = yes; then
|
||||
@@ -109,7 +107,7 @@ AC_ARG_WITH(gssservicename, [ --with-gssservicename set default gss service n
|
||||
|
||||
if test x$default_gssservicename != xno; then
|
||||
if test "x$default_gssservicename" = "xdefault"; then
|
||||
CUPS_DEFAULT_GSSSERVICENAME="host"
|
||||
CUPS_DEFAULT_GSSSERVICENAME="ipp"
|
||||
else
|
||||
CUPS_DEFAULT_GSSSERVICENAME="$default_gssservicename"
|
||||
fi
|
||||
@@ -117,8 +115,9 @@ else
|
||||
CUPS_DEFAULT_GSSSERVICENAME=""
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBGSSAPI)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME")
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-gssapi.m4 8659 2009-05-18 22:03:04Z mike $".
|
||||
dnl End of "$Id$".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-image.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-image.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Image library/filter stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
dnl See if we want the image filters included at all...
|
||||
AC_ARG_ENABLE(image, [ --enable-image always build the image filters])
|
||||
AC_ARG_ENABLE(image, [ --enable-image turn on image filters, default=auto])
|
||||
|
||||
IMGFILTERS=""
|
||||
if test "x$enable_image" != xno; then
|
||||
@@ -30,9 +30,9 @@ fi
|
||||
AC_SUBST(IMGFILTERS)
|
||||
|
||||
dnl Check for image libraries...
|
||||
AC_ARG_ENABLE(jpeg, [ --disable-jpeg disable JPEG support])
|
||||
AC_ARG_ENABLE(png, [ --disable-png disable PNG support])
|
||||
AC_ARG_ENABLE(tiff, [ --disable-tiff disable TIFF support])
|
||||
AC_ARG_ENABLE(jpeg, [ --enable-jpeg turn on JPEG support, default=yes])
|
||||
AC_ARG_ENABLE(png, [ --enable-png turn on PNG support, default=yes])
|
||||
AC_ARG_ENABLE(tiff, [ --enable-tiff turn on TIFF support, default=yes])
|
||||
|
||||
LIBJPEG=""
|
||||
LIBPNG=""
|
||||
@@ -105,5 +105,5 @@ AC_SUBST(EXPORT_LIBZ)
|
||||
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-image.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-image.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-launchd.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-launchd.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl launchd stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
|
||||
AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support])
|
||||
AC_ARG_ENABLE(launchd, [ --enable-launchd turn on launchd support, default=yes])
|
||||
|
||||
DEFAULT_LAUNCHD_CONF=""
|
||||
LAUNCHDLIBS=""
|
||||
@@ -40,5 +40,5 @@ AC_SUBST(DEFAULT_LAUNCHD_CONF)
|
||||
AC_SUBST(LAUNCHDLIBS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-launchd.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-launchd.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-ldap.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-ldap.m4 7800 2008-07-25 21:01:34Z mike $"
|
||||
dnl
|
||||
dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 2003-2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -13,7 +13,7 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(ldap, [ --disable-ldap disable LDAP support])
|
||||
AC_ARG_ENABLE(ldap, [ --enable-ldap turn on LDAP support, default=yes])
|
||||
AC_ARG_WITH(ldap-libs, [ --with-ldap-libs set directory for LDAP library],
|
||||
LDFLAGS="-L$withval $LDFLAGS"
|
||||
DSOFLAGS="-L$withval $DSOFLAGS",)
|
||||
@@ -48,5 +48,5 @@ AC_SUBST(LIBLDAP)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-ldap.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-ldap.m4 7800 2008-07-25 21:01:34Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-libtool.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Libtool stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -13,13 +13,14 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported
|
||||
build with libtool (UNSUPPORTED!)],
|
||||
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=LIBTOOL_PATH
|
||||
turn on building with libtool (UNSUPPORTED!), default=no],
|
||||
[if test x$enable_libtool_unsupported != xno; then
|
||||
LIBTOOL="$enable_libtool_unsupported"
|
||||
enable_shared=no
|
||||
echo "WARNING: libtool is not supported or endorsed by Apple Inc."
|
||||
echo " WE DO NOT PROVIDE SUPPORT FOR LIBTOOL PROBLEMS."
|
||||
echo "WARNING: libtool is not supported or endorsed by Easy Software Products."
|
||||
echo " WE DO NOT PROVIDE TECHNICAL SUPPORT FOR LIBTOOL PROBLEMS."
|
||||
echo " (even if you have a support contract)"
|
||||
else
|
||||
LIBTOOL=""
|
||||
fi])
|
||||
@@ -35,5 +36,5 @@ if test x$LIBTOOL != x; then
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-libtool.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-manpages.m4 8230 2009-01-12 19:17:09Z mike $"
|
||||
dnl "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -51,6 +51,14 @@ AC_SUBST(PMANDIR)
|
||||
|
||||
dnl Setup manpage extensions...
|
||||
case "$uname" in
|
||||
*BSD* | Darwin*)
|
||||
# *BSD
|
||||
MAN1EXT=1
|
||||
MAN5EXT=5
|
||||
MAN7EXT=7
|
||||
MAN8EXT=8
|
||||
MAN8DIR=8
|
||||
;;
|
||||
IRIX*)
|
||||
# SGI IRIX
|
||||
MAN1EXT=1
|
||||
@@ -67,8 +75,8 @@ case "$uname" in
|
||||
MAN8EXT=1m
|
||||
MAN8DIR=1m
|
||||
;;
|
||||
Linux* | GNU* | Darwin*)
|
||||
# Linux, GNU Hurd, and Mac OS X
|
||||
Linux* | GNU*)
|
||||
# Linux and GNU Hurd
|
||||
MAN1EXT=1.gz
|
||||
MAN5EXT=5.gz
|
||||
MAN7EXT=7.gz
|
||||
@@ -92,5 +100,5 @@ AC_SUBST(MAN8EXT)
|
||||
AC_SUBST(MAN8DIR)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-manpages.m4 8230 2009-01-12 19:17:09Z mike $".
|
||||
dnl End of "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-pam.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-pam.m4 7960 2008-09-17 19:42:02Z mike $"
|
||||
dnl
|
||||
dnl PAM stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -13,8 +13,8 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(pam, [ --disable-pam disable PAM support])
|
||||
AC_ARG_WITH(pam_module, [ --with-pam-module specify the PAM module to use])
|
||||
AC_ARG_ENABLE(pam, [ --enable-pam turn on PAM support, default=yes])
|
||||
AC_ARG_WITH(pam_module, [ --with-pam-module specify the PAM module to use, default=auto])
|
||||
|
||||
dnl Don't use PAM with AIX...
|
||||
if test $uname = AIX; then
|
||||
@@ -63,7 +63,7 @@ if test x$enable_pam != xno; then
|
||||
# Darwin, MacOS X
|
||||
if test "x$with_pam_module" != x; then
|
||||
PAMFILE="pam.$with_pam_module"
|
||||
elif test -f /usr/lib/pam/pam_opendirectory.so.2; then
|
||||
elif test -f /usr/lib/pam/pam_opendirectory.so; then
|
||||
PAMFILE="pam.opendirectory"
|
||||
else
|
||||
PAMFILE="pam.securityserver"
|
||||
@@ -100,5 +100,5 @@ AC_SUBST(PAMLIBS)
|
||||
AC_SUBST(PAMMOD)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-pam.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-pam.m4 7960 2008-09-17 19:42:02Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-pap.m4 8524 2009-04-19 21:18:45Z mike $"
|
||||
dnl "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl PAP (AppleTalk) stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -15,17 +15,17 @@ dnl
|
||||
|
||||
# Currently the PAP backend is only supported on MacOS X with the AppleTalk
|
||||
# SDK installed...
|
||||
AC_ARG_ENABLE(pap, [ --enable-pap build with AppleTalk support])
|
||||
AC_ARG_ENABLE(pap, [ --enable-pap build with AppleTalk support, default=auto])
|
||||
|
||||
PAP=""
|
||||
AC_SUBST(PAP)
|
||||
|
||||
if test x$enable_pap = xyes -a $uname = Darwin; then
|
||||
if test x$enable_pap != xno -a $uname = Darwin; then
|
||||
AC_CHECK_HEADER(netat/appletalk.h,[
|
||||
PAP="pap"
|
||||
AC_CHECK_HEADER(AppleTalk/at_proto.h)])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-pap.m4 8524 2009-04-19 21:18:45Z mike $".
|
||||
dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-pdf.m4 8430 2009-03-12 21:50:44Z mike $"
|
||||
dnl "$Id: cups-pdf.m4 7449 2008-04-14 18:27:53Z mike $"
|
||||
dnl
|
||||
dnl PDF filter configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -13,56 +13,39 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_WITH(pdftops, [ --with-pdftops set pdftops filter (gs,pdftops,none), default=pdftops ])
|
||||
AC_ARG_ENABLE(pdftops, [ --enable-pdftops build pdftops filter, default=auto ])
|
||||
|
||||
PDFTOPS=""
|
||||
CUPS_PDFTOPS=""
|
||||
CUPS_GHOSTSCRIPT=""
|
||||
|
||||
case "x$with_pdftops" in
|
||||
x) # Default/auto
|
||||
if test $uname != Darwin; then
|
||||
AC_PATH_PROG(CUPS_PDFTOPS, pdftops)
|
||||
if test "x$CUPS_PDFTOPS" != x; then
|
||||
AC_DEFINE(HAVE_PDFTOPS)
|
||||
PDFTOPS="pdftops"
|
||||
else
|
||||
AC_PATH_PROG(CUPS_GHOSTSCRIPT, gs)
|
||||
if test "x$CUPS_GHOSTSCRIPT" != x; then
|
||||
AC_DEFINE(HAVE_GHOSTSCRIPT)
|
||||
PDFTOPS="pdftops"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
xgs)
|
||||
AC_PATH_PROG(CUPS_GHOSTSCRIPT, gs)
|
||||
if test "x$CUPS_GHOSTSCRIPT" != x; then
|
||||
AC_DEFINE(HAVE_GHOSTSCRIPT)
|
||||
PDFTOPS="pdftops"
|
||||
else
|
||||
AC_MSG_ERROR(Unable to find gs program!)
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
xpdftops)
|
||||
if test "x$enable_pdftops" != xno; then
|
||||
AC_PATH_PROG(CUPS_PDFTOPS, pdftops)
|
||||
if test "x$CUPS_PDFTOPS" != x; then
|
||||
AC_DEFINE(HAVE_PDFTOPS)
|
||||
PDFTOPS="pdftops"
|
||||
else
|
||||
AC_MSG_ERROR(Unable to find pdftops program!)
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(CUPS_PDFTOPS, "$CUPS_PDFTOPS")
|
||||
|
||||
AC_PATH_PROG(CUPS_GHOSTSCRIPT, gs)
|
||||
if test "x$CUPS_GHOSTSCRIPT" != x; then
|
||||
AC_DEFINE(HAVE_GHOSTSCRIPT)
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(CUPS_GHOSTSCRIPT, "$CUPS_GHOSTSCRIPT")
|
||||
|
||||
if test "x$CUPS_PDFTOPS" != x -o "x$CUPS_GHOSTSCRIPT" != x; then
|
||||
AC_MSG_CHECKING(whether to build pdftops filter)
|
||||
if test x$enable_pdftops = xyes -o $uname != Darwin; then
|
||||
PDFTOPS="pdftops"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
elif test x$enable_pdftops = xyes; then
|
||||
AC_MSG_ERROR(Unable to find pdftops or gs programs!)
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_PDFTOPS, "$CUPS_PDFTOPS")
|
||||
AC_DEFINE_UNQUOTED(CUPS_GHOSTSCRIPT, "$CUPS_GHOSTSCRIPT")
|
||||
AC_SUBST(PDFTOPS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-pdf.m4 8430 2009-03-12 21:50:44Z mike $".
|
||||
dnl End of "$Id: cups-pdf.m4 7449 2008-04-14 18:27:53Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-poll.m4 8524 2009-04-19 21:18:45Z mike $"
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl Select/poll stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -18,5 +18,5 @@ AC_CHECK_FUNC(epoll_create, AC_DEFINE(HAVE_EPOLL))
|
||||
AC_CHECK_FUNC(kqueue, AC_DEFINE(HAVE_KQUEUE))
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-poll.m4 8524 2009-04-19 21:18:45Z mike $".
|
||||
dnl End of "$Id$".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-sharedlibs.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-sharedlibs.m4 7630 2008-06-09 22:31:44Z mike $"
|
||||
dnl
|
||||
dnl Shared library support for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -16,7 +16,7 @@ dnl
|
||||
PICFLAG=1
|
||||
DSOFLAGS="${DSOFLAGS:=}"
|
||||
|
||||
AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
|
||||
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries, default=yes])
|
||||
|
||||
if test x$enable_shared != xno; then
|
||||
case "$uname" in
|
||||
@@ -244,5 +244,5 @@ AC_SUBST(IMGLIBS)
|
||||
AC_SUBST(EXPORT_LDFLAGS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-sharedlibs.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-sharedlibs.m4 7630 2008-06-09 22:31:44Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-slp.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-slp.m4 7241 2008-01-22 22:34:52Z mike $"
|
||||
dnl
|
||||
dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -13,7 +13,7 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(slp, [ --disable-slp disable SLP support])
|
||||
AC_ARG_ENABLE(slp, [ --enable-slp turn on SLP support, default=yes])
|
||||
AC_ARG_WITH(openslp-libs, [ --with-openslp-libs set directory for OpenSLP library],
|
||||
LDFLAGS="-L$withval $LDFLAGS"
|
||||
DSOFLAGS="-L$withval $DSOFLAGS",)
|
||||
@@ -34,5 +34,5 @@ AC_SUBST(LIBSLP)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-slp.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-slp.m4 7241 2008-01-22 22:34:52Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-ssl.m4 8591 2009-05-04 23:40:10Z mike $"
|
||||
dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $"
|
||||
dnl
|
||||
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 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
|
||||
@@ -13,7 +13,7 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TLS support])
|
||||
AC_ARG_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support, default=yes])
|
||||
AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=first])
|
||||
AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=second])
|
||||
AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=third])
|
||||
@@ -26,6 +26,7 @@ AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenS
|
||||
|
||||
SSLFLAGS=""
|
||||
SSLLIBS=""
|
||||
ENCRYPTION_REQUIRED=""
|
||||
|
||||
if test x$enable_ssl != xno; then
|
||||
dnl Look for CDSA...
|
||||
@@ -33,6 +34,10 @@ if test x$enable_ssl != xno; then
|
||||
if test $uname = Darwin; then
|
||||
AC_CHECK_HEADER(Security/SecureTransport.h, [
|
||||
SSLLIBS="-framework CoreFoundation -framework Security"
|
||||
# MacOS X doesn't (yet) come with pre-installed encryption
|
||||
# certificates for CUPS, so don't enable encryption on
|
||||
# /admin just yet...
|
||||
#ENCRYPTION_REQUIRED=" Encryption Required"
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_CDSASSL)
|
||||
|
||||
@@ -58,11 +63,12 @@ if test x$enable_ssl != xno; then
|
||||
fi
|
||||
|
||||
dnl Then look for GNU TLS...
|
||||
if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
|
||||
if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then
|
||||
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
|
||||
if $PKGCONFIG --exists gnutls; then
|
||||
SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
SSLFLAGS=`$PKGCONFIG --cflags gnutls`
|
||||
if test "x$LIBGNUTLSCONFIG" != x; then
|
||||
SSLLIBS=`$LIBGNUTLSCONFIG --libs`
|
||||
SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
|
||||
ENCRYPTION_REQUIRED=" Encryption Required"
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
fi
|
||||
@@ -89,6 +95,7 @@ if test x$enable_ssl != xno; then
|
||||
AC_CHECK_LIB(ssl,SSL_new,
|
||||
[SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
|
||||
SSLLIBS="-lssl $libcrypto"
|
||||
ENCRYPTION_REQUIRED=" Encryption Required"
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_LIBSSL)],,
|
||||
$libcrypto)
|
||||
@@ -109,11 +116,12 @@ fi
|
||||
|
||||
AC_SUBST(SSLFLAGS)
|
||||
AC_SUBST(SSLLIBS)
|
||||
AC_SUBST(ENCRYPTION_REQUIRED)
|
||||
|
||||
EXPORT_SSLLIBS="$SSLLIBS"
|
||||
AC_SUBST(EXPORT_SSLLIBS)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-ssl.m4 8591 2009-05-04 23:40:10Z mike $".
|
||||
dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-threads.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Threading stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -13,7 +13,7 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(threads, [ --disable-threads disable multi-threading support])
|
||||
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support])
|
||||
|
||||
have_pthread=no
|
||||
PTHREAD_FLAGS=""
|
||||
@@ -50,5 +50,5 @@ fi
|
||||
AC_SUBST(PTHREAD_FLAGS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-threads.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
|
||||
+2
-11
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Configuration file for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -31,7 +31,7 @@
|
||||
#define CUPS_DEFAULT_USER "lp"
|
||||
#define CUPS_DEFAULT_GROUP "sys"
|
||||
#define CUPS_DEFAULT_SYSTEM_GROUPS "sys root system"
|
||||
#define CUPS_DEFAULT_PRINTOPERATOR_AUTH "@SYSTEM"
|
||||
#define CUPS_DEFAULT_PRINTADMIN_AUTH "@SYSTEM"
|
||||
|
||||
|
||||
/*
|
||||
@@ -434,7 +434,6 @@
|
||||
|
||||
#undef HAVE_USERSEC_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have pthread support?
|
||||
*/
|
||||
@@ -542,7 +541,6 @@
|
||||
#undef HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY
|
||||
#undef HAVE_GSS_C_NT_HOSTBASED_SERVICE
|
||||
#undef HAVE_KRB5_CC_NEW_UNIQUE
|
||||
#undef HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID
|
||||
#undef HAVE_KRB5_H
|
||||
#undef HAVE_HEIMDAL
|
||||
|
||||
@@ -607,13 +605,6 @@
|
||||
#undef HAVE_LRAND48
|
||||
|
||||
|
||||
/*
|
||||
* Do we have vproc_transaction_begin/end?
|
||||
*/
|
||||
|
||||
#undef HAVE_VPROC_TRANSACTION_BEGIN
|
||||
|
||||
|
||||
/*
|
||||
* Do we have libusb?
|
||||
*/
|
||||
|
||||
+21
-33
@@ -24,14 +24,14 @@ debug.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
debug.o: i18n.h transcode.h debug.h
|
||||
dest.o: debug.h globals.h string.h ../config.h http-private.h http.h
|
||||
dest.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
|
||||
dest.o: language.h i18n.h transcode.h pwgmedia.h
|
||||
dest.o: language.h i18n.h transcode.h
|
||||
dir.o: dir.h versioning.h string.h ../config.h debug.h
|
||||
emit.o: ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
encode.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
encode.o: ipp-private.h string.h ../config.h debug.h
|
||||
file.o: file-private.h http-private.h ../config.h http.h versioning.h md5.h
|
||||
file.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
|
||||
file.o: language.h i18n.h transcode.h debug.h
|
||||
file.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
file.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
file.o: i18n.h transcode.h debug.h
|
||||
getdevices.o: globals.h string.h ../config.h http-private.h http.h
|
||||
getdevices.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
getdevices.o: file.h language.h i18n.h transcode.h debug.h
|
||||
@@ -71,7 +71,7 @@ localize.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
localize.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
localize.o: i18n.h transcode.h ppd-private.h debug.h
|
||||
mark.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
mark.o: string.h ../config.h debug.h pwgmedia.h
|
||||
mark.o: string.h ../config.h debug.h
|
||||
md5.o: md5.h string.h ../config.h
|
||||
md5passwd.o: http-private.h ../config.h http.h versioning.h md5.h
|
||||
md5passwd.o: ipp-private.h ipp.h string.h
|
||||
@@ -80,13 +80,10 @@ notify.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
notify.o: i18n.h transcode.h
|
||||
options.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
options.o: string.h ../config.h debug.h
|
||||
page.o: ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
page.o: ppd.h array.h versioning.h file.h string.h ../config.h
|
||||
ppd.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
ppd.o: language.h globals.h string.h ../config.h http-private.h md5.h
|
||||
ppd.o: ipp-private.h i18n.h transcode.h debug.h
|
||||
pwgmedia.o: pwgmedia.h globals.h string.h ../config.h http-private.h http.h
|
||||
pwgmedia.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
pwgmedia.o: file.h language.h i18n.h transcode.h debug.h
|
||||
request.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
request.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
request.o: i18n.h transcode.h debug.h
|
||||
@@ -115,7 +112,6 @@ testarray.o: debug.h
|
||||
testconflicts.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
testconflicts.o: language.h string.h ../config.h
|
||||
testcups.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
testcups.o: string.h ../config.h
|
||||
testfile.o: string.h ../config.h file.h versioning.h debug.h
|
||||
testhttp.o: http-private.h ../config.h http.h versioning.h md5.h
|
||||
testhttp.o: ipp-private.h ipp.h string.h
|
||||
@@ -128,7 +124,7 @@ testoptions.o: array.h file.h language.h
|
||||
testlang.o: i18n.h transcode.h language.h array.h versioning.h string.h
|
||||
testlang.o: ../config.h
|
||||
testppd.o: ../cups/string.h ../config.h string.h cups.h ipp.h http.h
|
||||
testppd.o: versioning.h ppd.h array.h file.h language.h pwgmedia.h
|
||||
testppd.o: versioning.h ppd.h array.h file.h language.h
|
||||
testsnmp.o: string.h ../config.h snmp-private.h http.h versioning.h
|
||||
# DO NOT DELETE
|
||||
|
||||
@@ -156,14 +152,14 @@ debug.32.o: debug.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h langu
|
||||
debug.32.o: debug.c i18n.h transcode.h debug.h
|
||||
dest.32.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h
|
||||
dest.32.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
|
||||
dest.32.o: dest.c language.h i18n.h transcode.h pwgmedia.h
|
||||
dest.32.o: dest.c language.h i18n.h transcode.h
|
||||
dir.32.o: dir.c dir.h versioning.h string.h ../config.h debug.h
|
||||
emit.32.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
encode.32.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
encode.32.o: encode.c ipp-private.h string.h ../config.h debug.h
|
||||
file.32.o: file.c file-private.h http-private.h ../config.h http.h versioning.h md5.h
|
||||
file.32.o: file.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
|
||||
file.32.o: file.c language.h i18n.h transcode.h debug.h
|
||||
file.32.o: file.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
file.32.o: file.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
file.32.o: file.c i18n.h transcode.h debug.h
|
||||
getdevices.32.o: getdevices.c globals.h string.h ../config.h http-private.h http.h
|
||||
getdevices.32.o: getdevices.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
getdevices.32.o: getdevices.c file.h language.h i18n.h transcode.h debug.h
|
||||
@@ -203,7 +199,7 @@ localize.32.o: localize.c globals.h string.h ../config.h http-private.h http.h
|
||||
localize.32.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
localize.32.o: localize.c i18n.h transcode.h ppd-private.h debug.h
|
||||
mark.32.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
mark.32.o: mark.c string.h ../config.h debug.h pwgmedia.h
|
||||
mark.32.o: mark.c string.h ../config.h debug.h
|
||||
md5.32.o: md5.c md5.h string.h ../config.h
|
||||
md5passwd.32.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
md5passwd.32.o: md5passwd.c ipp-private.h ipp.h string.h
|
||||
@@ -212,13 +208,10 @@ notify.32.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h lan
|
||||
notify.32.o: notify.c i18n.h transcode.h
|
||||
options.32.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
options.32.o: options.c string.h ../config.h debug.h
|
||||
page.32.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
page.32.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h
|
||||
ppd.32.o: ppd.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
ppd.32.o: ppd.c language.h globals.h string.h ../config.h http-private.h md5.h
|
||||
ppd.32.o: ppd.c ipp-private.h i18n.h transcode.h debug.h
|
||||
pwgmedia.32.o: pwgmedia.c pwgmedia.h globals.h string.h ../config.h http-private.h http.h
|
||||
pwgmedia.32.o: pwgmedia.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
pwgmedia.32.o: pwgmedia.c file.h language.h i18n.h transcode.h debug.h
|
||||
request.32.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
request.32.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
request.32.o: request.c i18n.h transcode.h debug.h
|
||||
@@ -247,7 +240,6 @@ testarray.32.o: testarray.c debug.h
|
||||
testconflicts.32.o: testconflicts.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
testconflicts.32.o: testconflicts.c language.h string.h ../config.h
|
||||
testcups.32.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
testcups.32.o: testcups.c string.h ../config.h
|
||||
testfile.32.o: testfile.c string.h ../config.h file.h versioning.h debug.h
|
||||
testhttp.32.o: testhttp.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
testhttp.32.o: testhttp.c ipp-private.h ipp.h string.h
|
||||
@@ -260,7 +252,7 @@ testoptions.32.o: testoptions.c array.h file.h language.h
|
||||
testlang.32.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h
|
||||
testlang.32.o: testlang.c ../config.h
|
||||
testppd.32.o: testppd.c ../cups/string.h ../config.h string.h cups.h ipp.h http.h
|
||||
testppd.32.o: testppd.c versioning.h ppd.h array.h file.h language.h pwgmedia.h
|
||||
testppd.32.o: testppd.c versioning.h ppd.h array.h file.h language.h
|
||||
testsnmp.32.o: testsnmp.c string.h ../config.h snmp-private.h http.h versioning.h
|
||||
# DO NOT DELETE
|
||||
|
||||
@@ -288,14 +280,14 @@ debug.64.o: debug.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h langu
|
||||
debug.64.o: debug.c i18n.h transcode.h debug.h
|
||||
dest.64.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h
|
||||
dest.64.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
|
||||
dest.64.o: dest.c language.h i18n.h transcode.h pwgmedia.h
|
||||
dest.64.o: dest.c language.h i18n.h transcode.h
|
||||
dir.64.o: dir.c dir.h versioning.h string.h ../config.h debug.h
|
||||
emit.64.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
encode.64.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
encode.64.o: encode.c ipp-private.h string.h ../config.h debug.h
|
||||
file.64.o: file.c file-private.h http-private.h ../config.h http.h versioning.h md5.h
|
||||
file.64.o: file.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
|
||||
file.64.o: file.c language.h i18n.h transcode.h debug.h
|
||||
file.64.o: file.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
file.64.o: file.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
file.64.o: file.c i18n.h transcode.h debug.h
|
||||
getdevices.64.o: getdevices.c globals.h string.h ../config.h http-private.h http.h
|
||||
getdevices.64.o: getdevices.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
getdevices.64.o: getdevices.c file.h language.h i18n.h transcode.h debug.h
|
||||
@@ -335,7 +327,7 @@ localize.64.o: localize.c globals.h string.h ../config.h http-private.h http.h
|
||||
localize.64.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
localize.64.o: localize.c i18n.h transcode.h ppd-private.h debug.h
|
||||
mark.64.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
mark.64.o: mark.c string.h ../config.h debug.h pwgmedia.h
|
||||
mark.64.o: mark.c string.h ../config.h debug.h
|
||||
md5.64.o: md5.c md5.h string.h ../config.h
|
||||
md5passwd.64.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
md5passwd.64.o: md5passwd.c ipp-private.h ipp.h string.h
|
||||
@@ -344,13 +336,10 @@ notify.64.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h lan
|
||||
notify.64.o: notify.c i18n.h transcode.h
|
||||
options.64.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
options.64.o: options.c string.h ../config.h debug.h
|
||||
page.64.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
page.64.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h
|
||||
ppd.64.o: ppd.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
ppd.64.o: ppd.c language.h globals.h string.h ../config.h http-private.h md5.h
|
||||
ppd.64.o: ppd.c ipp-private.h i18n.h transcode.h debug.h
|
||||
pwgmedia.64.o: pwgmedia.c pwgmedia.h globals.h string.h ../config.h http-private.h http.h
|
||||
pwgmedia.64.o: pwgmedia.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
pwgmedia.64.o: pwgmedia.c file.h language.h i18n.h transcode.h debug.h
|
||||
request.64.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
request.64.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
request.64.o: request.c i18n.h transcode.h debug.h
|
||||
@@ -379,7 +368,6 @@ testarray.64.o: testarray.c debug.h
|
||||
testconflicts.64.o: testconflicts.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
testconflicts.64.o: testconflicts.c language.h string.h ../config.h
|
||||
testcups.64.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
testcups.64.o: testcups.c string.h ../config.h
|
||||
testfile.64.o: testfile.c string.h ../config.h file.h versioning.h debug.h
|
||||
testhttp.64.o: testhttp.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
testhttp.64.o: testhttp.c ipp-private.h ipp.h string.h
|
||||
@@ -392,5 +380,5 @@ testoptions.64.o: testoptions.c array.h file.h language.h
|
||||
testlang.64.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h
|
||||
testlang.64.o: testlang.c ../config.h
|
||||
testppd.64.o: testppd.c ../cups/string.h ../config.h string.h cups.h ipp.h http.h
|
||||
testppd.64.o: testppd.c versioning.h ppd.h array.h file.h language.h pwgmedia.h
|
||||
testppd.64.o: testppd.c versioning.h ppd.h array.h file.h language.h
|
||||
testsnmp.64.o: testsnmp.c string.h ../config.h snmp-private.h http.h versioning.h
|
||||
|
||||
+57
-47
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# API library Makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2009 by Apple Inc.
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -56,7 +56,6 @@ LIBOBJS = \
|
||||
options.o \
|
||||
page.o \
|
||||
ppd.o \
|
||||
pwgmedia.o \
|
||||
request.o \
|
||||
sidechannel.o \
|
||||
snmp.o \
|
||||
@@ -289,8 +288,7 @@ uninstall64bit:
|
||||
|
||||
libcups.so.2 libcups.sl.2: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) \
|
||||
$(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(RM) `basename $@ .2`
|
||||
$(LN) $@ `basename $@ .2`
|
||||
|
||||
@@ -302,8 +300,7 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
|
||||
32bit/libcups.so.2: $(LIB32OBJS)
|
||||
echo Linking 32-bit $@...
|
||||
-mkdir 32bit
|
||||
$(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBGSSAPI) \
|
||||
$(DNSSDLIBS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(RM) 32bit/libcups.so
|
||||
$(LN) libcups.so.2 32bit/libcups.so
|
||||
|
||||
@@ -315,8 +312,7 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
|
||||
64bit/libcups.so.2: $(LIB64OBJS)
|
||||
echo Linking 64-bit $@...
|
||||
-mkdir 64bit
|
||||
$(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBGSSAPI) \
|
||||
$(DNSSDLIBS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(RM) 64bit/libcups.so
|
||||
$(LN) libcups.so.2 64bit/libcups.so
|
||||
|
||||
@@ -333,8 +329,7 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER) libcups.exp
|
||||
-compatibility_version 2.0.0 \
|
||||
-exported_symbols_list libcups.exp \
|
||||
-sectorder __TEXT __text $(LIBCUPSORDER) \
|
||||
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ)
|
||||
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(RM) libcups.dylib
|
||||
$(LN) $@ libcups.dylib
|
||||
|
||||
@@ -345,9 +340,7 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER) libcups.exp
|
||||
|
||||
libcups_s.a: $(LIBOBJS) libcups_s.exp
|
||||
echo Creating $@...
|
||||
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o \
|
||||
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ) -lm
|
||||
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) -lm
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ libcups_s.o
|
||||
|
||||
@@ -358,9 +351,8 @@ libcups_s.a: $(LIBOBJS) libcups_s.exp
|
||||
|
||||
libcups.la: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
|
||||
-rpath $(LIBDIR) -version-info 2:8 $(LIBGSSAPI) $(SSLLIBS) \
|
||||
$(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
|
||||
-version-info 2:8 $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
@@ -405,7 +397,7 @@ php_cups_wrap.c: cups.h
|
||||
testadmin: testadmin.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testadmin.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
@@ -415,7 +407,7 @@ testadmin: testadmin.o libcups.a
|
||||
testarray: testarray.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running array API tests...
|
||||
./testarray
|
||||
|
||||
@@ -427,7 +419,7 @@ testarray: testarray.o libcups.a
|
||||
testconflicts: testconflicts.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testconflicts.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
@@ -437,7 +429,7 @@ testconflicts: testconflicts.o libcups.a
|
||||
testcups: testcups.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testcups.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
@@ -447,7 +439,7 @@ testcups: testcups.o libcups.a
|
||||
testfile: testfile.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running file API tests...
|
||||
./testfile
|
||||
|
||||
@@ -459,7 +451,7 @@ testfile: testfile.o libcups.a
|
||||
testhttp: testhttp.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running HTTP API tests...
|
||||
./testhttp
|
||||
|
||||
@@ -471,7 +463,7 @@ testhttp: testhttp.o libcups.a
|
||||
testipp: testipp.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running IPP API tests...
|
||||
./testipp
|
||||
|
||||
@@ -483,7 +475,7 @@ testipp: testipp.o libcups.a
|
||||
testi18n: testi18n.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running internationalization API tests...
|
||||
./testi18n
|
||||
|
||||
@@ -495,7 +487,7 @@ testi18n: testi18n.o libcups.a
|
||||
testlang: testlang.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running language API tests...
|
||||
./testlang
|
||||
|
||||
@@ -507,7 +499,7 @@ testlang: testlang.o libcups.a
|
||||
testoptions: testoptions.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running option API tests...
|
||||
./testoptions
|
||||
|
||||
@@ -516,10 +508,10 @@ testoptions: testoptions.o libcups.a
|
||||
# testppd (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testppd: testppd.o libcups.a test.ppd test2.ppd
|
||||
testppd: testppd.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running PPD API tests...
|
||||
./testppd
|
||||
|
||||
@@ -531,7 +523,7 @@ testppd: testppd.o libcups.a test.ppd test2.ppd
|
||||
testsnmp: testsnmp.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testsnmp.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
@@ -548,52 +540,34 @@ apihelp:
|
||||
mxmldoc --section "Programming" --title "Array API" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-array.header --intro api-array.shtml \
|
||||
api-array.xml \
|
||||
array.h array.c >../doc/help/api-array.html
|
||||
mxmldoc --tokens help/api-array.html api-array.xml >../doc/help/api-array.tokens
|
||||
$(RM) api-array.xml
|
||||
mxmldoc --section "Programming" --title "CUPS API" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-cups.header --intro api-cups.shtml \
|
||||
api-cups.xml \
|
||||
cups.h adminutil.c dest.c language.c notify.c \
|
||||
options.c tempfile.c usersys.c \
|
||||
util.c >../doc/help/api-cups.html
|
||||
mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
|
||||
$(RM) api-cups.xml
|
||||
mxmldoc --section "Programming" --title "File and Directory APIs" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-filedir.header --intro api-filedir.shtml \
|
||||
api-filedir.xml \
|
||||
file.h file.c dir.h dir.c >../doc/help/api-filedir.html
|
||||
mxmldoc --tokens api-filedir.xml >../doc/help/api-filedir.tokens
|
||||
$(RM) api-filedir.xml
|
||||
mxmldoc --section "Programming" --title "PPD API" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-ppd.header --intro api-ppd.shtml \
|
||||
api-ppd.xml \
|
||||
ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
|
||||
ppd.c >../doc/help/api-ppd.html
|
||||
mxmldoc --tokens help/api-ppd.html api-ppd.xml >../doc/help/api-ppd.tokens
|
||||
$(RM) api-ppd.xml
|
||||
mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-httpipp.header --intro api-httpipp.shtml \
|
||||
api-httpipp.xml \
|
||||
http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
|
||||
http.c http-addr.c http-support.c ipp.c ipp-support.c \
|
||||
md5passwd.c request.c >../doc/help/api-httpipp.html
|
||||
mxmldoc --tokens help/api-httpipp.html api-httpipp.xml >../doc/help/api-httpipp.tokens
|
||||
$(RM) api-httpipp.xml
|
||||
mxmldoc --section "Programming" \
|
||||
--title "Filter and Backend Programming" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-filter.header --intro api-filter.shtml \
|
||||
api-filter.xml \
|
||||
backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
|
||||
>../doc/help/api-filter.html
|
||||
mxmldoc --tokens help/api-filter.html api-filter.xml >../doc/help/api-filter.tokens
|
||||
$(RM) api-filter.xml
|
||||
|
||||
framedhelp:
|
||||
echo Generating CUPS API help files...
|
||||
@@ -640,6 +614,42 @@ framedhelp:
|
||||
backchannel.c backend.h backend.c sidechannel.c sidechannel.h
|
||||
|
||||
|
||||
docsets:
|
||||
echo Generating CUPS API documentation sets...
|
||||
../tools/makedocset --docset org.cups.overview.docset \
|
||||
--title "Introduction to CUPS Programming" \
|
||||
--header api-overview.header --intro api-overview.shtml
|
||||
../tools/makedocset --docset org.cups.array.docset \
|
||||
--title "Array API" \
|
||||
--header api-array.header --intro api-array.shtml \
|
||||
array.h array.c
|
||||
../tools/makedocset --docset org.cups.cups.docset \
|
||||
--title "CUPS API" \
|
||||
--header api-cups.header --intro api-cups.shtml \
|
||||
cups.h adminutil.c dest.c language.c notify.c \
|
||||
options.c tempfile.c usersys.c \
|
||||
util.c
|
||||
../tools/makedocset --docset org.cups.filedir.docset \
|
||||
--title "File and Directory APIs" \
|
||||
--header api-filedir.header --intro api-filedir.shtml \
|
||||
file.h file.c dir.h dir.c
|
||||
../tools/makedocset --docset org.cups.ppd.docset \
|
||||
--title "PPD API" \
|
||||
--header api-ppd.header --intro api-ppd.shtml \
|
||||
ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
|
||||
page.c ppd.c
|
||||
../tools/makedocset --docset org.cups.httpipp.docset \
|
||||
--title "HTTP and IPP APIs" \
|
||||
--header api-httpipp.header --intro api-httpipp.shtml \
|
||||
http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
|
||||
http.c http-addr.c http-support.c ipp.c ipp-support.c \
|
||||
md5passwd.c request.c
|
||||
../tools/makedocset --docset org.cups.filter.docset \
|
||||
--title "Filter and Backend Programming" \
|
||||
--header api-filter.header --intro api-filter.shtml \
|
||||
backchannel.c backend.h backend.c sidechannel.c sidechannel.h
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
+6
-14
@@ -4,7 +4,7 @@
|
||||
* Administration utility API definitions for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -949,8 +949,6 @@ _cupsAdminGetServerSettings(
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
http = cg->http;
|
||||
}
|
||||
|
||||
if (!http || !num_settings || !settings)
|
||||
@@ -1135,13 +1133,7 @@ _cupsAdminGetServerSettings(
|
||||
else if (!strcasecmp(value, "all"))
|
||||
remote_any = 1;
|
||||
}
|
||||
else if (line[0] != '<' && !in_location && !in_policy &&
|
||||
strcasecmp(line, "Allow") &&
|
||||
strcasecmp(line, "AuthType") &&
|
||||
strcasecmp(line, "Deny") &&
|
||||
strcasecmp(line, "Order") &&
|
||||
strcasecmp(line, "Require") &&
|
||||
strcasecmp(line, "Satisfy"))
|
||||
else if (line[0] != '<' && !in_location && !in_policy)
|
||||
cg->cupsd_num_settings = cupsAddOption(line, value,
|
||||
cg->cupsd_num_settings,
|
||||
&(cg->cupsd_settings));
|
||||
@@ -1651,7 +1643,7 @@ _cupsAdminSetServerSettings(
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH "\n"
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
|
||||
" </Limit>\n");
|
||||
}
|
||||
|
||||
@@ -1798,7 +1790,7 @@ _cupsAdminSetServerSettings(
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH "\n"
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
|
||||
" </Limit>\n");
|
||||
|
||||
in_cancel_job = 0;
|
||||
@@ -2023,7 +2015,7 @@ _cupsAdminSetServerSettings(
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH "\n"
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
|
||||
" </Limit>\n");
|
||||
|
||||
cupsFilePuts(temp, " <Limit All>\n"
|
||||
@@ -2210,7 +2202,7 @@ do_samba_command(const char *command, /* I - Command to run */
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, "\n");
|
||||
|
||||
DEBUG_printf(("9do_samba_command: status=%d", status));
|
||||
DEBUG_printf(("status=%d\n", status));
|
||||
|
||||
if (WIFEXITED(status))
|
||||
return (WEXITSTATUS(status));
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-array.header 8627 2009-05-13 21:39:17Z mike $"
|
||||
"$Id: api-array.header 8087 2008-10-27 21:37:05Z mike $"
|
||||
|
||||
Array API header for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 2008-2009 by Apple Inc.
|
||||
Copyright 2008 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -12,8 +12,6 @@
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>Array API</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-cups.header 8627 2009-05-13 21:39:17Z mike $"
|
||||
"$Id: api-cups.header 8087 2008-10-27 21:37:05Z mike $"
|
||||
|
||||
CUPS API header for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 2008-2009 by Apple Inc.
|
||||
Copyright 2008 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -12,8 +12,6 @@
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>CUPS API</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-filedir.header 8627 2009-05-13 21:39:17Z mike $"
|
||||
"$Id: api-filedir.header 8087 2008-10-27 21:37:05Z mike $"
|
||||
|
||||
File and Directory API header for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 2008-2009 by Apple Inc.
|
||||
Copyright 2008 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -12,8 +12,6 @@
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>File and Directory APIs</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<!--
|
||||
"$Id: api-filter.header 8627 2009-05-13 21:39:17Z mike $"
|
||||
"$Id: api-filter.header 8087 2008-10-27 21:37:05Z mike $"
|
||||
|
||||
Filter and backend programming header for the Common UNIX Printing System
|
||||
(CUPS).
|
||||
|
||||
Copyright 2008-2009 by Apple Inc.
|
||||
Copyright 2008 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -13,8 +13,6 @@
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>Filter and Backend Programming</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
+4
-23
@@ -1,10 +1,10 @@
|
||||
<!--
|
||||
"$Id: api-filter.shtml 8628 2009-05-13 22:25:34Z mike $"
|
||||
"$Id: api-filter.shtml 7962 2008-09-18 17:31:33Z mike $"
|
||||
|
||||
Filter and backend programming introduction for the Common UNIX Printing
|
||||
System (CUPS).
|
||||
|
||||
Copyright 2007-2009 by Apple Inc.
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
@@ -49,12 +49,6 @@ the remaining filters read from the standard input and write to the standard
|
||||
output. The backend is the last filter in the chain and writes to the
|
||||
device.</p>
|
||||
|
||||
<p>Filters are always run as a non-privileged user, typically "lp", with no
|
||||
connection to the user's desktop. Backends are run either as a non-privileged
|
||||
user or as root if the file permissions do not allow user or group execution.
|
||||
The <a href="#PERMISSIONS">file permissions</a> section talks about this in
|
||||
more detail.</p>
|
||||
|
||||
<h3><a name="SECURITY">Security Considerations</a></h3>
|
||||
|
||||
<p>It is always important to use security programming practices. Filters and
|
||||
@@ -67,7 +61,7 @@ specify an arbitrary file path to a separator page, template, or other file
|
||||
used by the filter since that can lead to an unauthorized disclosure of
|
||||
information. <em>Always</em> treat input as suspect and validate it!</p>
|
||||
|
||||
<p>If you are developing a backend that runs as root , make sure to check for
|
||||
<p>If you are developing a backend that runs as root, make sure to check for
|
||||
potential buffer overflows, integer under/overflow conditions, and file
|
||||
accesses since these can lead to privilege escalations. When writing files,
|
||||
always validate the file path and <em>never</em> allow a user to determine
|
||||
@@ -81,23 +75,10 @@ user may not be the same as the local user and/or there may not be a local home
|
||||
directory to write to.</p>
|
||||
|
||||
<p>In addition, some operating systems provide additional security mechanisms
|
||||
that further limit file system access, even for backends running as root. On
|
||||
that further limit file system access, even for backends running as root. On
|
||||
Mac OS X, for example, no backend may write to a user's home directory.</p>
|
||||
</blockquote>
|
||||
|
||||
<h3><a name="PERMISSIONS">File Permissions</a></h3>
|
||||
|
||||
<p>For security reasons, CUPS will only run filters and backends that are owned
|
||||
by root and do not have world write permissions. The recommended permissions for
|
||||
filters and backends are 0555 - read and execute but no write. Backends that
|
||||
must run as root should use permissions of 0500 - read and execute by root, no
|
||||
access for other users. Write permissions can be enabled for the root user
|
||||
only.</p>
|
||||
|
||||
<p>To avoid a warning message, the directory containing your filter(s) must also
|
||||
be owned by root and have world write disabled - permissions of 0755 or 0555 are
|
||||
strongly encouraged.</p>
|
||||
|
||||
<h3><a name="TEMPFILES">Temporary Files</a></h3>
|
||||
|
||||
<p>Temporary files should be created in the directory specified by the
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-httpipp.header 8627 2009-05-13 21:39:17Z mike $"
|
||||
"$Id: api-httpipp.header 8087 2008-10-27 21:37:05Z mike $"
|
||||
|
||||
HTTP and IPP API header for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 2007-2009 by Apple Inc.
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
@@ -13,8 +13,6 @@
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>HTTP and IPP APIs</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Introduction to CUPS programming header for the Common UNIX Printing System
|
||||
(CUPS).
|
||||
|
||||
Copyright 2008-2009 by Apple Inc.
|
||||
Copyright 2008 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -13,8 +13,6 @@
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>Introduction to CUPS Programming</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-ppd.header 8627 2009-05-13 21:39:17Z mike $"
|
||||
"$Id: api-ppd.header 8087 2008-10-27 21:37:05Z mike $"
|
||||
|
||||
PPD API header for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 2008-2009 by Apple Inc.
|
||||
Copyright 2008 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -12,8 +12,6 @@
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>PPD API</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
+18
-18
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Sorted array routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -109,7 +109,7 @@ int /* O - 1 on success, 0 on failure */
|
||||
cupsArrayAdd(cups_array_t *a, /* I - Array */
|
||||
void *e) /* I - Element */
|
||||
{
|
||||
DEBUG_printf(("2cupsArrayAdd(a=%p, e=%p)", a, e));
|
||||
DEBUG_printf(("cupsArrayAdd(a=%p, e=%p)\n", a, e));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -117,7 +117,7 @@ cupsArrayAdd(cups_array_t *a, /* I - Array */
|
||||
|
||||
if (!a || !e)
|
||||
{
|
||||
DEBUG_puts("3cupsArrayAdd: returning 0");
|
||||
DEBUG_puts("cupsArrayAdd: returning 0");
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ int /* O - 0 on failure, 1 on success */
|
||||
cupsArrayInsert(cups_array_t *a, /* I - Array */
|
||||
void *e) /* I - Element */
|
||||
{
|
||||
DEBUG_printf(("2cupsArrayInsert(a=%p, e=%p)", a, e));
|
||||
DEBUG_printf(("cupsArrayInsert(a=%p, e=%p)\n", a, e));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -513,7 +513,7 @@ cupsArrayInsert(cups_array_t *a, /* I - Array */
|
||||
|
||||
if (!a || !e)
|
||||
{
|
||||
DEBUG_puts("3cupsArrayInsert: returning 0");
|
||||
DEBUG_puts("cupsArrayInsert: returning 0");
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -846,7 +846,7 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
diff; /* Comparison with current element */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_array_add(a=%p, e=%p, insert=%d)", a, e, insert));
|
||||
DEBUG_printf(("cups_array_add(a=%p, e=%p, insert=%d)\n", a, e, insert));
|
||||
|
||||
/*
|
||||
* Verify we have room for the new element...
|
||||
@@ -879,11 +879,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
temp = realloc(a->elements, count * sizeof(void *));
|
||||
}
|
||||
|
||||
DEBUG_printf(("9cups_array_add: count=%d", count));
|
||||
DEBUG_printf(("cups_array_add: count=%d\n", count));
|
||||
|
||||
if (!temp)
|
||||
{
|
||||
DEBUG_puts("9cups_array_add: allocation failed, returning 0");
|
||||
DEBUG_puts("cupsAddAdd: allocation failed, returning 0");
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -978,11 +978,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
if (a->saved[i] >= current)
|
||||
a->saved[i] ++;
|
||||
|
||||
DEBUG_printf(("9cups_array_add: insert element at index %d...", current));
|
||||
DEBUG_printf(("cups_array_add: insert element at index %d...\n", current));
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
DEBUG_printf(("9cups_array_add: append element at %d...", current));
|
||||
DEBUG_printf(("cups_array_add: append element at %d...\n", current));
|
||||
#endif /* DEBUG */
|
||||
|
||||
a->elements[current] = e;
|
||||
@@ -991,11 +991,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
|
||||
#ifdef DEBUG
|
||||
for (current = 0; current < a->num_elements; current ++)
|
||||
DEBUG_printf(("9cups_array_add: a->elements[%d]=%p", current,
|
||||
DEBUG_printf(("cups_array_add: a->elements[%d]=%p\n", current,
|
||||
a->elements[current]));
|
||||
#endif /* DEBUG */
|
||||
|
||||
DEBUG_puts("9cups_array_add: returning 1");
|
||||
DEBUG_puts("cups_array_add: returning 1");
|
||||
|
||||
return (1);
|
||||
}
|
||||
@@ -1017,7 +1017,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
|
||||
diff; /* Comparison with current element */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_array_find(a=%p, e=%p, prev=%d, rdiff=%p)", a, e, prev,
|
||||
DEBUG_printf(("cups_array_find(a=%p, e=%p, prev=%d, rdiff=%p)\n", a, e, prev,
|
||||
rdiff));
|
||||
|
||||
if (a->compare)
|
||||
@@ -1026,7 +1026,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
|
||||
* Do a binary search for the element...
|
||||
*/
|
||||
|
||||
DEBUG_puts("9cups_array_find: binary search");
|
||||
DEBUG_puts("cups_array_find: binary search");
|
||||
|
||||
if (prev >= 0 && prev < a->num_elements)
|
||||
{
|
||||
@@ -1042,7 +1042,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
|
||||
* Exact or edge match, return it!
|
||||
*/
|
||||
|
||||
DEBUG_printf(("9cups_array_find: Returning %d, diff=%d", prev, diff));
|
||||
DEBUG_printf(("cups_array_find: Returning %d, diff=%d\n", prev, diff));
|
||||
|
||||
*rdiff = diff;
|
||||
|
||||
@@ -1082,7 +1082,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
|
||||
current = (left + right) / 2;
|
||||
diff = (*(a->compare))(e, a->elements[current], a->data);
|
||||
|
||||
DEBUG_printf(("9cups_array_find: left=%d, right=%d, current=%d, diff=%d",
|
||||
DEBUG_printf(("cups_array_find: left=%d, right=%d, current=%d, diff=%d\n",
|
||||
left, right, current, diff));
|
||||
|
||||
if (diff == 0)
|
||||
@@ -1115,7 +1115,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
|
||||
* Do a linear pointer search...
|
||||
*/
|
||||
|
||||
DEBUG_puts("9cups_array_find: linear search");
|
||||
DEBUG_puts("cups_array_find: linear search");
|
||||
|
||||
diff = 1;
|
||||
|
||||
@@ -1131,7 +1131,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
|
||||
* Return the closest element and the difference...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("8cups_array_find: Returning %d, diff=%d", current, diff));
|
||||
DEBUG_printf(("cups_array_find: Returning %d, diff=%d\n", current, diff));
|
||||
|
||||
*rdiff = diff;
|
||||
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
* PPD model-specific attribute routines for the Common UNIX Printing System
|
||||
* (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -44,8 +44,8 @@ ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
|
||||
*attr; /* Current attribute */
|
||||
|
||||
|
||||
DEBUG_printf(("2ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")", ppd, name,
|
||||
spec));
|
||||
DEBUG_printf(("ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")\n", ppd,
|
||||
name ? name : "(null)", spec ? spec : "(null)"));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
|
||||
+138
-178
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Authentication functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -20,8 +20,8 @@
|
||||
* Contents:
|
||||
*
|
||||
* cupsDoAuthentication() - Authenticate a request.
|
||||
* cups_get_gssname() - Get GSSAPI name for authentication.
|
||||
* cups_gss_printf() - Show error messages from GSSAPI...
|
||||
* DEBUG_gss_printf() - Show debug error messages from GSSAPI...
|
||||
* cups_get_gss_creds() - Get CUPS service credentials for authentication.
|
||||
* cups_local_auth() - Get the local authorization certificate if
|
||||
* available/applicable...
|
||||
*/
|
||||
@@ -62,13 +62,13 @@ extern const char *cssmErrorString(int error);
|
||||
*/
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
static gss_name_t cups_get_gssname(http_t *http, const char *service_name);
|
||||
# ifdef DEBUG
|
||||
static void cups_gss_printf(OM_uint32 major_status, OM_uint32 minor_status,
|
||||
const char *message);
|
||||
static void DEBUG_gss_printf(OM_uint32 major_status, OM_uint32 minor_status,
|
||||
const char *message);
|
||||
# else
|
||||
# define cups_gss_printf(major, minor, message)
|
||||
# endif /* DEBUG */
|
||||
# define DEBUG_gss_printf(major, minor, message)
|
||||
# endif /* DEBUG */
|
||||
static gss_name_t cups_get_gss_creds(http_t *http, const char *service_name);
|
||||
#endif /* HAVE_GSSAPI */
|
||||
static int cups_local_auth(http_t *http);
|
||||
|
||||
@@ -83,10 +83,10 @@ static int cups_local_auth(http_t *http);
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
cupsDoAuthentication(
|
||||
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
|
||||
const char *method, /* I - Request method ("GET", "POST", "PUT") */
|
||||
const char *resource) /* I - Resource path */
|
||||
cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
|
||||
const char *method,/* I - Request method ("GET", "POST", "PUT") */
|
||||
const char *resource)
|
||||
/* I - Resource path */
|
||||
{
|
||||
const char *password; /* Password string */
|
||||
char prompt[1024], /* Prompt for user */
|
||||
@@ -96,19 +96,13 @@ cupsDoAuthentication(
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")",
|
||||
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")\n",
|
||||
http, method, resource));
|
||||
DEBUG_printf(("2cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"",
|
||||
DEBUG_printf(("cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"\n",
|
||||
http->digest_tries, http->userpass));
|
||||
DEBUG_printf(("2cupsDoAuthentication: WWW-Authenticate=\"%s\"",
|
||||
DEBUG_printf(("cupsDoAuthentication: WWW-Authenticate=\"%s\"\n",
|
||||
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE)));
|
||||
|
||||
if (!http)
|
||||
http = _cupsConnect();
|
||||
|
||||
if (!http || !method || !resource)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Clear the current authentication string...
|
||||
*/
|
||||
@@ -123,7 +117,7 @@ cupsDoAuthentication(
|
||||
{
|
||||
if ((localauth = cups_local_auth(http)) == 0)
|
||||
{
|
||||
DEBUG_printf(("2cupsDoAuthentication: authstring=\"%s\"",
|
||||
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n",
|
||||
http->authstring));
|
||||
|
||||
if (http->status == HTTP_UNAUTHORIZED)
|
||||
@@ -132,10 +126,7 @@ cupsDoAuthentication(
|
||||
return (0);
|
||||
}
|
||||
else if (localauth == -1)
|
||||
{
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
return (-1); /* Error or canceled */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -163,17 +154,11 @@ cupsDoAuthentication(
|
||||
"Digest", 5) != 0;
|
||||
http->userpass[0] = '\0';
|
||||
|
||||
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
|
||||
{
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
if ((password = cupsGetPassword(prompt)) == NULL)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (!password[0])
|
||||
{
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(),
|
||||
password);
|
||||
@@ -214,19 +199,16 @@ cupsDoAuthentication(
|
||||
|
||||
if (gss_init_sec_context == NULL)
|
||||
{
|
||||
DEBUG_puts("1cupsDoAuthentication: Weak-linked GSSAPI/Kerberos framework "
|
||||
DEBUG_puts("cupsDoAuthentication: Weak-linked GSSAPI/Kerberos framework "
|
||||
"is not present");
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
|
||||
return (-1);
|
||||
}
|
||||
# endif /* __APPLE__ */
|
||||
|
||||
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: too many Negotiate tries (%d)",
|
||||
DEBUG_printf(("cupsDoAuthentication: too many Negotiate tries (%d)\n",
|
||||
http->digest_tries));
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
|
||||
return (-1);
|
||||
}
|
||||
@@ -236,10 +218,9 @@ cupsDoAuthentication(
|
||||
if ((gss_service_name = getenv("CUPS_GSSSERVICENAME")) == NULL)
|
||||
gss_service_name = CUPS_DEFAULT_GSSSERVICENAME;
|
||||
else
|
||||
DEBUG_puts("2cupsDoAuthentication: GSS service name set via "
|
||||
"environment variable");
|
||||
DEBUG_puts("cupsDoAuthentication: GSS service name set via environment");
|
||||
|
||||
http->gssname = cups_get_gssname(http, gss_service_name);
|
||||
http->gssname = cups_get_gss_creds(http, gss_service_name);
|
||||
}
|
||||
|
||||
# ifdef USE_SPNEGO /* We don't implement SPNEGO just yet... */
|
||||
@@ -296,10 +277,8 @@ cupsDoAuthentication(
|
||||
major_status = gss_init_sec_context(&minor_status, GSS_C_NO_CREDENTIAL,
|
||||
&http->gssctx,
|
||||
http->gssname, http->gssmech,
|
||||
#ifdef GSS_C_DELEG_POLICY_FLAG
|
||||
GSS_C_DELEG_POLICY_FLAG |
|
||||
#endif /* GSS_C_DELEG_POLICY_FLAG */
|
||||
GSS_C_MUTUAL_FLAG | GSS_C_INTEG_FLAG,
|
||||
GSS_C_DELEG_FLAG | GSS_C_MUTUAL_FLAG |
|
||||
GSS_C_INTEG_FLAG,
|
||||
GSS_C_INDEFINITE,
|
||||
GSS_C_NO_CHANNEL_BINDINGS,
|
||||
&input_token, &http->gssmech,
|
||||
@@ -310,17 +289,15 @@ cupsDoAuthentication(
|
||||
|
||||
if (GSS_ERROR(major_status))
|
||||
{
|
||||
cups_gss_printf(major_status, minor_status,
|
||||
"cupsDoAuthentication: Unable to initialize security "
|
||||
"context");
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
|
||||
# ifdef DEBUG
|
||||
DEBUG_gss_printf(major_status, minor_status,
|
||||
"Unable to initialize security context");
|
||||
# endif /* DEBUG */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (major_status == GSS_S_CONTINUE_NEEDED)
|
||||
cups_gss_printf(major_status, minor_status,
|
||||
"cupsDoAuthentication: Continuation needed!");
|
||||
DEBUG_gss_printf(major_status, minor_status, "Continuation needed!");
|
||||
|
||||
if (output_token.length > 0 && output_token.length <= 65536)
|
||||
{
|
||||
@@ -349,9 +326,9 @@ cupsDoAuthentication(
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: Kerberos credentials too large - "
|
||||
"%d bytes!", (int)output_token.length));
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
DEBUG_printf(("cupsDoAuthentication: Kerberos credentials too large - "
|
||||
"%d bytes!\n", (int)output_token.length));
|
||||
|
||||
gss_release_buffer(&minor_status, &output_token);
|
||||
|
||||
return (-1);
|
||||
@@ -392,79 +369,22 @@ cupsDoAuthentication(
|
||||
httpSetAuthString(http, "Digest", digest);
|
||||
}
|
||||
|
||||
DEBUG_printf(("1cupsDoAuthentication: authstring=\"%s\"", http->authstring));
|
||||
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
/*
|
||||
* 'cups_get_gssname()' - Get CUPS service credentials for authentication.
|
||||
*/
|
||||
|
||||
static gss_name_t /* O - Server name */
|
||||
cups_get_gssname(
|
||||
http_t *http, /* I - Connection to server */
|
||||
const char *service_name) /* I - Service name */
|
||||
{
|
||||
gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
|
||||
/* Service token */
|
||||
OM_uint32 major_status, /* Major status code */
|
||||
minor_status; /* Minor status code */
|
||||
gss_name_t server_name; /* Server name */
|
||||
char buf[1024], /* Name buffer */
|
||||
fqdn[HTTP_MAX_URI]; /* Server name buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_get_gssname(http=%p, service_name=\"%s\")", http,
|
||||
service_name));
|
||||
|
||||
|
||||
/*
|
||||
* Get the hostname...
|
||||
*/
|
||||
|
||||
httpGetHostname(http, fqdn, sizeof(fqdn));
|
||||
|
||||
if (!strcmp(fqdn, "localhost"))
|
||||
httpGetHostname(NULL, fqdn, sizeof(fqdn));
|
||||
|
||||
/*
|
||||
* Get a server name we can use for authentication purposes...
|
||||
*/
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s@%s", service_name, fqdn);
|
||||
|
||||
DEBUG_printf(("9cups_get_gssname: Looking up %s...", buf));
|
||||
|
||||
token.value = buf;
|
||||
token.length = strlen(buf);
|
||||
server_name = GSS_C_NO_NAME;
|
||||
major_status = gss_import_name(&minor_status, &token,
|
||||
GSS_C_NT_HOSTBASED_SERVICE,
|
||||
&server_name);
|
||||
|
||||
if (GSS_ERROR(major_status))
|
||||
{
|
||||
cups_gss_printf(major_status, minor_status,
|
||||
"cups_get_gssname: gss_import_name() failed");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (server_name);
|
||||
}
|
||||
|
||||
|
||||
# ifdef DEBUG
|
||||
/*
|
||||
* 'cups_gss_printf()' - Show debug error messages from GSSAPI...
|
||||
* 'DEBUG_gss_printf()' - Show debug error messages from GSSAPI...
|
||||
*/
|
||||
|
||||
static void
|
||||
cups_gss_printf(OM_uint32 major_status,/* I - Major status code */
|
||||
OM_uint32 minor_status,/* I - Minor status code */
|
||||
const char *message) /* I - Prefix for error message */
|
||||
DEBUG_gss_printf(OM_uint32 major_status,/* I - Major status code */
|
||||
OM_uint32 minor_status,/* I - Minor status code */
|
||||
const char *message) /* I - Prefix for error message */
|
||||
{
|
||||
OM_uint32 err_major_status, /* Major status code for display */
|
||||
err_minor_status; /* Minor status code for display */
|
||||
@@ -487,13 +407,68 @@ cups_gss_printf(OM_uint32 major_status,/* I - Major status code */
|
||||
gss_display_status(&err_minor_status, minor_status, GSS_C_MECH_CODE,
|
||||
GSS_C_NULL_OID, &msg_ctx, &minor_status_string);
|
||||
|
||||
DEBUG_printf(("1%s: %s, %s", message, (char *)major_status_string.value,
|
||||
(char *)minor_status_string.value));
|
||||
printf("%s: %s, %s\n", message, (char *)major_status_string.value,
|
||||
(char *)minor_status_string.value);
|
||||
|
||||
gss_release_buffer(&err_minor_status, &major_status_string);
|
||||
gss_release_buffer(&err_minor_status, &minor_status_string);
|
||||
}
|
||||
# endif /* DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_get_gss_creds()' - Get CUPS service credentials for authentication.
|
||||
*/
|
||||
|
||||
static gss_name_t /* O - Server name */
|
||||
cups_get_gss_creds(
|
||||
http_t *http, /* I - Connection to server */
|
||||
const char *service_name) /* I - Service name */
|
||||
{
|
||||
gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
|
||||
/* Service token */
|
||||
OM_uint32 major_status, /* Major status code */
|
||||
minor_status; /* Minor status code */
|
||||
gss_name_t server_name; /* Server name */
|
||||
char buf[1024], /* Name buffer */
|
||||
fqdn[HTTP_MAX_URI]; /* Server name buffer */
|
||||
|
||||
|
||||
/*
|
||||
* Get the hostname...
|
||||
*/
|
||||
|
||||
httpGetHostname(http, fqdn, sizeof(fqdn));
|
||||
|
||||
if (!strcmp(fqdn, "localhost"))
|
||||
httpGetHostname(NULL, fqdn, sizeof(fqdn));
|
||||
|
||||
/*
|
||||
* Get a server name we can use for authentication purposes...
|
||||
*/
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s@%s", service_name, fqdn);
|
||||
|
||||
DEBUG_printf(("cups_get_gss_creds: Looking up %s...\n", buf));
|
||||
|
||||
token.value = buf;
|
||||
token.length = strlen(buf);
|
||||
server_name = GSS_C_NO_NAME;
|
||||
major_status = gss_import_name(&minor_status, &token,
|
||||
GSS_C_NT_HOSTBASED_SERVICE,
|
||||
&server_name);
|
||||
|
||||
if (GSS_ERROR(major_status))
|
||||
{
|
||||
# ifdef DEBUG
|
||||
DEBUG_gss_printf(major_status, minor_status, "gss_import_name() failed");
|
||||
# endif /* DEBUG */
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (server_name);
|
||||
}
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
|
||||
@@ -516,8 +491,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
#else
|
||||
int pid; /* Current process ID */
|
||||
FILE *fp; /* Certificate file */
|
||||
char trc[16], /* Try Root Certificate parameter */
|
||||
filename[1024], /* Certificate filename */
|
||||
char filename[1024], /* Certificate filename */
|
||||
certificate[33];/* Certificate string */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
# if defined(HAVE_AUTHORIZATION_H)
|
||||
@@ -531,7 +505,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
# endif /* HAVE_AUTHORIZATION_H */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_local_auth(http=%p) hostaddr=%s, hostname=\"%s\"",
|
||||
DEBUG_printf(("cups_local_auth(http=%p) hostaddr=%s, hostname=\"%s\"\n",
|
||||
http, httpAddrString(http->hostaddr, filename, sizeof(filename)), http->hostname));
|
||||
|
||||
/*
|
||||
@@ -541,7 +515,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
if (!httpAddrLocalhost(http->hostaddr) &&
|
||||
strcasecmp(http->hostname, "localhost") != 0)
|
||||
{
|
||||
DEBUG_puts("8cups_local_auth: Not a local connection!");
|
||||
DEBUG_puts("cups_local_auth: Not a local connection!");
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -564,7 +538,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
kAuthorizationFlagDefaults, &http->auth_ref);
|
||||
if (status != errAuthorizationSuccess)
|
||||
{
|
||||
DEBUG_printf(("8cups_local_auth: AuthorizationCreate() returned %d (%s)",
|
||||
DEBUG_printf(("cups_local_auth: AuthorizationCreate() returned %d (%s)\n",
|
||||
(int)status, cssmErrorString(status)));
|
||||
return (-1);
|
||||
}
|
||||
@@ -599,14 +573,14 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
|
||||
httpSetAuthString(http, "AuthRef", buffer);
|
||||
|
||||
DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
|
||||
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
|
||||
http->authstring));
|
||||
return (0);
|
||||
}
|
||||
else if (status == errAuthorizationCanceled)
|
||||
return (-1);
|
||||
|
||||
DEBUG_printf(("9cups_local_auth: AuthorizationCopyRights() returned %d (%s)",
|
||||
DEBUG_printf(("cups_local_auth: AuthorizationCopyRights() returned %d (%s)\n",
|
||||
(int)status, cssmErrorString(status)));
|
||||
|
||||
/*
|
||||
@@ -615,42 +589,6 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
}
|
||||
# endif /* HAVE_AUTHORIZATION_H */
|
||||
|
||||
# if defined(SO_PEERCRED) && defined(AF_LOCAL)
|
||||
/*
|
||||
* See if we can authenticate using the peer credentials provided over a
|
||||
* domain socket; if so, specify "PeerCred username" as the authentication
|
||||
* information...
|
||||
*/
|
||||
|
||||
# ifdef HAVE_GSSAPI
|
||||
if (strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9) &&
|
||||
# else
|
||||
if (
|
||||
# endif /* HAVE_GSSAPI */
|
||||
http->hostaddr->addr.sa_family == AF_LOCAL &&
|
||||
!getenv("GATEWAY_INTERFACE")) /* Not via CGI programs... */
|
||||
{
|
||||
/*
|
||||
* Verify that the current cupsUser() matches the current UID...
|
||||
*/
|
||||
|
||||
struct passwd *pwd; /* Password information */
|
||||
const char *username; /* Current username */
|
||||
|
||||
username = cupsUser();
|
||||
|
||||
if ((pwd = getpwnam(username)) != NULL && pwd->pw_uid == getuid())
|
||||
{
|
||||
httpSetAuthString(http, "PeerCred", username);
|
||||
|
||||
DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
|
||||
http->authstring));
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
# endif /* SO_PEERCRED && AF_LOCAL */
|
||||
|
||||
/*
|
||||
* Try opening a certificate file for this PID. If that fails,
|
||||
* try the root certificate...
|
||||
@@ -660,34 +598,25 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
snprintf(filename, sizeof(filename), "%s/certs/%d", cg->cups_statedir, pid);
|
||||
if ((fp = fopen(filename, "r")) == NULL && pid > 0)
|
||||
{
|
||||
/*
|
||||
* No certificate for this PID; see if we can get the root certificate...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("9cups_local_auth: Unable to open file %s: %s",
|
||||
DEBUG_printf(("cups_local_auth: Unable to open file %s: %s\n",
|
||||
filename, strerror(errno)));
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
/*
|
||||
* If local certificate authentication isn't available for this PID,
|
||||
* check if we need Kerberos authentication...
|
||||
*/
|
||||
|
||||
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
|
||||
{
|
||||
/*
|
||||
* Kerberos required, don't try the root certificate...
|
||||
* Yes, don't try the root certificate...
|
||||
*/
|
||||
|
||||
return (1);
|
||||
}
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
if (!httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "trc", trc,
|
||||
sizeof(trc)))
|
||||
{
|
||||
/*
|
||||
* Scheduler doesn't want us to use the root certificate...
|
||||
*/
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/certs/0", cg->cups_statedir);
|
||||
fp = fopen(filename, "r");
|
||||
}
|
||||
@@ -707,12 +636,43 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
|
||||
httpSetAuthString(http, "Local", certificate);
|
||||
|
||||
DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
|
||||
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
|
||||
http->authstring));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
# if defined(SO_PEERCRED) && defined(AF_LOCAL)
|
||||
/*
|
||||
* See if we can authenticate using the peer credentials provided over a
|
||||
* domain socket; if so, specify "PeerCred username" as the authentication
|
||||
* information...
|
||||
*/
|
||||
|
||||
if (http->hostaddr->addr.sa_family == AF_LOCAL &&
|
||||
!getenv("GATEWAY_INTERFACE")) /* Not via CGI programs... */
|
||||
{
|
||||
/*
|
||||
* Verify that the current cupsUser() matches the current UID...
|
||||
*/
|
||||
|
||||
struct passwd *pwd; /* Password information */
|
||||
const char *username; /* Current username */
|
||||
|
||||
username = cupsUser();
|
||||
|
||||
if ((pwd = getpwnam(username)) != NULL && pwd->pw_uid == getuid())
|
||||
{
|
||||
httpSetAuthString(http, "PeerCred", username);
|
||||
|
||||
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
|
||||
http->authstring));
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
# endif /* SO_PEERCRED && AF_LOCAL */
|
||||
|
||||
return (1);
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ cupsBackChannelRead(char *buffer, /* I - Buffer to read into */
|
||||
else
|
||||
status = select(4, &input, NULL, NULL, &tval);
|
||||
}
|
||||
while (status < 0 && errno != EINTR && errno != EAGAIN);
|
||||
while (status < 0 && errno != EINTR);
|
||||
|
||||
if (status < 0)
|
||||
return (-1); /* Timeout! */
|
||||
@@ -86,7 +86,7 @@ cupsBackChannelRead(char *buffer, /* I - Buffer to read into */
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
return ((ssize_t)_read(3, buffer, (unsigned)bytes));
|
||||
return ((ssize_t)read(3, buffer, (unsigned)bytes));
|
||||
#else
|
||||
return (read(3, buffer, bytes));
|
||||
#endif /* WIN32 */
|
||||
@@ -138,9 +138,9 @@ cupsBackChannelWrite(
|
||||
else
|
||||
status = select(4, NULL, &output, NULL, &tval);
|
||||
}
|
||||
while (status < 0 && errno != EINTR && errno != EAGAIN);
|
||||
while (status < 0 && errno != EINTR);
|
||||
|
||||
if (status <= 0)
|
||||
if (status < 0)
|
||||
return (-1); /* Timeout! */
|
||||
|
||||
/*
|
||||
@@ -148,7 +148,7 @@ cupsBackChannelWrite(
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
count = (ssize_t)_write(3, buffer, (unsigned)(bytes - total));
|
||||
count = (ssize_t)write(3, buffer, (unsigned)(bytes - total));
|
||||
#else
|
||||
count = write(3, buffer, bytes - total);
|
||||
#endif /* WIN32 */
|
||||
@@ -159,7 +159,7 @@ cupsBackChannelWrite(
|
||||
* Write error - abort on fatal errors...
|
||||
*/
|
||||
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
if (errno != EINTR)
|
||||
return (-1);
|
||||
}
|
||||
else
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Backend functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -75,7 +75,7 @@ cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */
|
||||
* It handles quoting of special characters in the device-make-and-model,
|
||||
* device-info, device-id, and device-location strings.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4@
|
||||
*/
|
||||
|
||||
void
|
||||
|
||||
+79
-292
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Option marking routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -18,8 +18,6 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsGetConflicts() - Get a list of conflicting options in a marked
|
||||
* PPD.
|
||||
* cupsResolveConflicts() - Resolve conflicts in a marked PPD.
|
||||
* ppdConflicts() - Check to see if there are any conflicts among
|
||||
* the marked option choices.
|
||||
@@ -47,7 +45,6 @@
|
||||
enum
|
||||
{
|
||||
_PPD_NORMAL_CONSTRAINTS,
|
||||
_PPD_OPTION_CONSTRAINTS,
|
||||
_PPD_INSTALLABLE_CONSTRAINTS,
|
||||
_PPD_ALL_CONSTRAINTS
|
||||
};
|
||||
@@ -68,74 +65,6 @@ static cups_array_t *ppd_test_constraints(ppd_file_t *ppd,
|
||||
int which);
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetConflicts()' - Get a list of conflicting options in a marked PPD.
|
||||
*
|
||||
* This function gets a list of options that would conflict if "option" and
|
||||
* "choice" were marked in the PPD. You would typically call this function
|
||||
* after marking the currently selected options in the PPD in order to
|
||||
* determine whether a new option selection would cause a conflict.
|
||||
*
|
||||
* The number of conflicting options are returned with "options" pointing to
|
||||
* the conflicting options. The returned option array must be freed using
|
||||
* @link cupsFreeOptions@.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
*/
|
||||
|
||||
int /* O - Number of conflicting options */
|
||||
cupsGetConflicts(
|
||||
ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *option, /* I - Option to test */
|
||||
const char *choice, /* I - Choice to test */
|
||||
cups_option_t **options) /* O - Conflicting options */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
num_options; /* Number of conflicting options */
|
||||
cups_array_t *active; /* Active conflicts */
|
||||
_ppd_cups_uiconsts_t *c; /* Current constraints */
|
||||
_ppd_cups_uiconst_t *cptr; /* Current constraint */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (options)
|
||||
*options = NULL;
|
||||
|
||||
if (!ppd || !option || !choice || !options)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Test for conflicts...
|
||||
*/
|
||||
|
||||
active = ppd_test_constraints(ppd, option, choice, 0, NULL,
|
||||
_PPD_ALL_CONSTRAINTS);
|
||||
|
||||
/*
|
||||
* Loop through all of the UI constraints and add any options that conflict...
|
||||
*/
|
||||
|
||||
for (num_options = 0, c = (_ppd_cups_uiconsts_t *)cupsArrayFirst(active);
|
||||
c;
|
||||
c = (_ppd_cups_uiconsts_t *)cupsArrayNext(active))
|
||||
{
|
||||
for (i = c->num_constraints, cptr = c->constraints;
|
||||
i > 0;
|
||||
i --, cptr ++)
|
||||
if (strcasecmp(cptr->option->keyword, option))
|
||||
num_options = cupsAddOption(cptr->option->keyword, cptr->choice->choice,
|
||||
num_options, options);
|
||||
}
|
||||
|
||||
cupsArrayDelete(active);
|
||||
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsResolveConflicts()' - Resolve conflicts in a marked PPD.
|
||||
*
|
||||
@@ -170,7 +99,7 @@ cupsGetConflicts(
|
||||
* choice for the conflicting option, then iterating over all possible choices
|
||||
* until a non-conflicting option choice is found.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@@ -182,22 +111,16 @@ cupsResolveConflicts(
|
||||
cups_option_t **options) /* IO - Additional selected options */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
tries, /* Number of tries */
|
||||
num_newopts; /* Number of new options */
|
||||
cups_option_t *newopts; /* New options */
|
||||
num_newopts, /* Number of new options */
|
||||
num_resopts; /* Number of resolver options */
|
||||
cups_option_t *newopts, /* New options */
|
||||
*resopts; /* Resolver options */
|
||||
cups_array_t *active, /* Active constraints */
|
||||
*pass, /* Resolvers for this pass */
|
||||
*resolvers, /* Resolvers we have used */
|
||||
*test; /* Test array for conflicts */
|
||||
*resolvers; /* Resolvers we have used */
|
||||
_ppd_cups_uiconsts_t *consts; /* Current constraints */
|
||||
_ppd_cups_uiconst_t *constptr; /* Current constraint */
|
||||
ppd_attr_t *resolver; /* Current resolver */
|
||||
const char *resval; /* Pointer into resolver value */
|
||||
char resoption[PPD_MAX_NAME],
|
||||
/* Current resolver option */
|
||||
reschoice[PPD_MAX_NAME],
|
||||
/* Current resolver choice */
|
||||
*resptr; /* Pointer into option/choice */
|
||||
const char *value; /* Selected option value */
|
||||
int changed; /* Did we change anything? */
|
||||
ppd_choice_t *marked; /* Marked choice */
|
||||
@@ -231,14 +154,10 @@ cupsResolveConflicts(
|
||||
|
||||
resolvers = NULL;
|
||||
pass = cupsArrayNew((cups_array_func_t)strcasecmp, NULL);
|
||||
tries = 0;
|
||||
|
||||
while (tries < 100 &&
|
||||
(active = ppd_test_constraints(ppd, NULL, NULL, num_newopts, newopts,
|
||||
while ((active = ppd_test_constraints(ppd, NULL, NULL, num_newopts, newopts,
|
||||
_PPD_ALL_CONSTRAINTS)) != NULL)
|
||||
{
|
||||
tries ++;
|
||||
|
||||
if (!resolvers)
|
||||
resolvers = cupsArrayNew((cups_array_func_t)strcasecmp, NULL);
|
||||
|
||||
@@ -261,7 +180,7 @@ cupsResolveConflicts(
|
||||
* Resolver loop!
|
||||
*/
|
||||
|
||||
DEBUG_printf(("1ppdResolveConflicts: Resolver loop with %s!",
|
||||
DEBUG_printf(("ppdResolveConflicts: Resolver loop with %s!\n",
|
||||
consts->resolver));
|
||||
goto error;
|
||||
}
|
||||
@@ -269,14 +188,14 @@ cupsResolveConflicts(
|
||||
if ((resolver = ppdFindAttr(ppd, "cupsUIResolver",
|
||||
consts->resolver)) == NULL)
|
||||
{
|
||||
DEBUG_printf(("1ppdResolveConflicts: Resolver %s not found!",
|
||||
DEBUG_printf(("ppdResolveConflicts: Resolver %s not found!\n",
|
||||
consts->resolver));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!resolver->value)
|
||||
{
|
||||
DEBUG_printf(("1ppdResolveConflicts: Resolver %s has no value!",
|
||||
DEBUG_printf(("ppdResolveConflicts: Resolver %s has no value!\n",
|
||||
consts->resolver));
|
||||
goto error;
|
||||
}
|
||||
@@ -288,74 +207,25 @@ cupsResolveConflicts(
|
||||
cupsArrayAdd(pass, consts->resolver);
|
||||
cupsArrayAdd(resolvers, consts->resolver);
|
||||
|
||||
for (resval = resolver->value; *resval && !changed;)
|
||||
if (option && choice)
|
||||
{
|
||||
while (isspace(*resval & 255))
|
||||
resval ++;
|
||||
resopts = NULL;
|
||||
num_resopts = _ppdParseOptions(resolver->value, 0, &resopts);
|
||||
|
||||
if (*resval != '*')
|
||||
break;
|
||||
|
||||
for (resval ++, resptr = resoption;
|
||||
*resval && !isspace(*resval & 255);
|
||||
resval ++)
|
||||
if (resptr < (resoption + sizeof(resoption) - 1))
|
||||
*resptr++ = *resval;
|
||||
|
||||
*resptr = '\0';
|
||||
|
||||
while (isspace(*resval & 255))
|
||||
resval ++;
|
||||
|
||||
for (resptr = reschoice;
|
||||
*resval && !isspace(*resval & 255);
|
||||
resval ++)
|
||||
if (resptr < (reschoice + sizeof(reschoice) - 1))
|
||||
*resptr++ = *resval;
|
||||
|
||||
*resptr = '\0';
|
||||
|
||||
if (!resoption[0] || !reschoice[0])
|
||||
break;
|
||||
|
||||
/*
|
||||
* Is this the option we are changing?
|
||||
*/
|
||||
|
||||
if (option &&
|
||||
(!strcasecmp(resoption, option) ||
|
||||
(!strcasecmp(option, "PageSize") &&
|
||||
!strcasecmp(resoption, "PageRegion")) ||
|
||||
(!strcasecmp(option, "PageRegion") &&
|
||||
!strcasecmp(resoption, "PageSize"))))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Try this choice...
|
||||
*/
|
||||
|
||||
if ((test = ppd_test_constraints(ppd, resoption, reschoice,
|
||||
num_newopts, newopts,
|
||||
_PPD_ALL_CONSTRAINTS)) == NULL)
|
||||
if ((value = cupsGetOption(option, num_newopts, newopts)) != NULL &&
|
||||
!strcasecmp(value, choice))
|
||||
{
|
||||
/*
|
||||
* That worked...
|
||||
*/
|
||||
DEBUG_printf(("cupsResolveConflicts: Resolver %s changes %s!\n",
|
||||
consts->resolver, option));
|
||||
cupsFreeOptions(num_resopts, resopts);
|
||||
goto error;
|
||||
}
|
||||
|
||||
changed = 1;
|
||||
}
|
||||
else
|
||||
cupsArrayDelete(test);
|
||||
cupsFreeOptions(num_resopts, resopts);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the option/choice from the resolver regardless of whether it
|
||||
* worked; this makes sure that we can cascade several changes to
|
||||
* make things resolve...
|
||||
*/
|
||||
|
||||
num_newopts = cupsAddOption(resoption, reschoice, num_newopts,
|
||||
&newopts);
|
||||
}
|
||||
num_newopts = _ppdParseOptions(resolver->value, num_newopts, &newopts);
|
||||
changed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -366,64 +236,28 @@ cupsResolveConflicts(
|
||||
|
||||
int j; /* Looping var */
|
||||
ppd_choice_t *cptr; /* Current choice */
|
||||
ppd_size_t *size; /* Current page size */
|
||||
cups_array_t *test; /* Test array for conflicts */
|
||||
|
||||
|
||||
for (i = consts->num_constraints, constptr = consts->constraints;
|
||||
i > 0 && !changed;
|
||||
i > 0;
|
||||
i --, constptr ++)
|
||||
{
|
||||
/*
|
||||
* Can't resolve by changing an installable option...
|
||||
*/
|
||||
|
||||
if (constptr->installable)
|
||||
if (constptr->installable ||
|
||||
!strcasecmp(constptr->option->keyword, "PageSize") ||
|
||||
!strcasecmp(constptr->option->keyword, "PageRegion"))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Is this the option we are changing?
|
||||
*/
|
||||
|
||||
if (option &&
|
||||
(!strcasecmp(constptr->option->keyword, option) ||
|
||||
(!strcasecmp(option, "PageSize") &&
|
||||
!strcasecmp(constptr->option->keyword, "PageRegion")) ||
|
||||
(!strcasecmp(option, "PageRegion") &&
|
||||
!strcasecmp(constptr->option->keyword, "PageSize"))))
|
||||
if (option && !strcasecmp(constptr->option->keyword, option))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Get the current option choice...
|
||||
*/
|
||||
|
||||
if ((value = cupsGetOption(constptr->option->keyword, num_newopts,
|
||||
newopts)) == NULL)
|
||||
{
|
||||
if (!strcasecmp(constptr->option->keyword, "PageSize") ||
|
||||
!strcasecmp(constptr->option->keyword, "PageRegion"))
|
||||
{
|
||||
if ((value = cupsGetOption("PageSize", num_newopts,
|
||||
newopts)) == NULL)
|
||||
value = cupsGetOption("PageRegion", num_newopts, newopts);
|
||||
|
||||
if (!value)
|
||||
{
|
||||
if ((size = ppdPageSize(ppd, NULL)) != NULL)
|
||||
value = size->name;
|
||||
else
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
marked = ppdFindMarkedChoice(ppd, constptr->option->keyword);
|
||||
value = marked ? marked->choice : "";
|
||||
}
|
||||
marked = ppdFindMarkedChoice(ppd, constptr->option->keyword);
|
||||
value = marked ? marked->choice : "";
|
||||
}
|
||||
|
||||
if (!strncasecmp(value, "Custom.", 7))
|
||||
value = "Custom";
|
||||
|
||||
/*
|
||||
* Try the default choice...
|
||||
*/
|
||||
@@ -434,7 +268,7 @@ cupsResolveConflicts(
|
||||
(test = ppd_test_constraints(ppd, constptr->option->keyword,
|
||||
constptr->option->defchoice,
|
||||
num_newopts, newopts,
|
||||
_PPD_OPTION_CONSTRAINTS)) == NULL)
|
||||
_PPD_ALL_CONSTRAINTS)) == NULL)
|
||||
{
|
||||
/*
|
||||
* That worked...
|
||||
@@ -451,21 +285,21 @@ cupsResolveConflicts(
|
||||
* Try each choice instead...
|
||||
*/
|
||||
|
||||
cupsArrayDelete(test);
|
||||
|
||||
for (j = constptr->option->num_choices,
|
||||
cptr = constptr->option->choices;
|
||||
j > 0;
|
||||
j --, cptr ++)
|
||||
{
|
||||
cupsArrayDelete(test);
|
||||
test = NULL;
|
||||
|
||||
if (strcasecmp(value, cptr->choice) &&
|
||||
strcasecmp(constptr->option->defchoice, cptr->choice) &&
|
||||
strcasecmp("Custom", cptr->choice) &&
|
||||
(test = ppd_test_constraints(ppd, constptr->option->keyword,
|
||||
cptr->choice, num_newopts,
|
||||
newopts,
|
||||
_PPD_OPTION_CONSTRAINTS)) == NULL)
|
||||
_PPD_ALL_CONSTRAINTS)) == NULL)
|
||||
{
|
||||
/*
|
||||
* This choice works...
|
||||
@@ -477,16 +311,16 @@ cupsResolveConflicts(
|
||||
changed = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cupsArrayDelete(test);
|
||||
cupsArrayDelete(test);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!changed)
|
||||
{
|
||||
DEBUG_puts("1ppdResolveConflicts: Unable to automatically resolve "
|
||||
DEBUG_puts("ppdResolveConflicts: Unable to automatically resolve "
|
||||
"constraint!");
|
||||
goto error;
|
||||
}
|
||||
@@ -494,12 +328,8 @@ cupsResolveConflicts(
|
||||
|
||||
cupsArrayClear(pass);
|
||||
cupsArrayDelete(active);
|
||||
active = NULL;
|
||||
}
|
||||
|
||||
if (tries >= 100)
|
||||
goto error;
|
||||
|
||||
/*
|
||||
* Free the caller's option array...
|
||||
*/
|
||||
@@ -529,13 +359,6 @@ cupsResolveConflicts(
|
||||
|
||||
cupsArrayRestore(ppd->sorted_attrs);
|
||||
|
||||
DEBUG_printf(("1cupsResolveConflicts: Returning %d options:", num_newopts));
|
||||
#ifdef DEBUG
|
||||
for (i = 0; i < num_newopts; i ++)
|
||||
DEBUG_printf(("1cupsResolveConflicts: options[%d]: %s=%s", i,
|
||||
newopts[i].name, newopts[i].value));
|
||||
#endif /* DEBUG */
|
||||
|
||||
return (1);
|
||||
|
||||
/*
|
||||
@@ -546,14 +369,11 @@ cupsResolveConflicts(
|
||||
|
||||
cupsFreeOptions(num_newopts, newopts);
|
||||
|
||||
cupsArrayDelete(active);
|
||||
cupsArrayDelete(pass);
|
||||
cupsArrayDelete(resolvers);
|
||||
|
||||
cupsArrayRestore(ppd->sorted_attrs);
|
||||
|
||||
DEBUG_puts("1cupsResolveConflicts: Unable to resolve conflicts!");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -626,7 +446,7 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
* This function tests whether a particular option choice is available based
|
||||
* on constraints against options in the "InstallableOptions" group.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4@
|
||||
*/
|
||||
|
||||
int /* O - 1 if conflicting, 0 if not conflicting */
|
||||
@@ -638,9 +458,6 @@ ppdInstallableConflict(
|
||||
cups_array_t *active; /* Active conflicts */
|
||||
|
||||
|
||||
DEBUG_printf(("2ppdInstallableConflict(ppd=%p, option=\"%s\", choice=\"%s\")",
|
||||
ppd, option, choice));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
@@ -707,8 +524,6 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
*ptr; /* Pointer into option or choice */
|
||||
|
||||
|
||||
DEBUG_printf(("7ppd_load_constraints(ppd=%p)", ppd));
|
||||
|
||||
/*
|
||||
* Create an array to hold the constraint data...
|
||||
*/
|
||||
@@ -752,7 +567,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
|
||||
if ((consts = calloc(1, sizeof(_ppd_cups_uiconsts_t))) == NULL)
|
||||
{
|
||||
DEBUG_puts("8ppd_load_constraints: Unable to allocate memory for "
|
||||
DEBUG_puts("ppd_load_constraints: Unable to allocate memory for "
|
||||
"UIConstraints!");
|
||||
return;
|
||||
}
|
||||
@@ -760,7 +575,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
if ((constptr = calloc(2, sizeof(_ppd_cups_uiconst_t))) == NULL)
|
||||
{
|
||||
free(consts);
|
||||
DEBUG_puts("8ppd_load_constraints: Unable to allocate memory for "
|
||||
DEBUG_puts("ppd_load_constraints: Unable to allocate memory for "
|
||||
"UIConstraints!");
|
||||
return;
|
||||
}
|
||||
@@ -790,7 +605,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
|
||||
if (!constptr[0].option || (!constptr[0].choice && oldconst->choice1[0]))
|
||||
{
|
||||
DEBUG_printf(("8ppd_load_constraints: Unknown option *%s %s!",
|
||||
DEBUG_printf(("ppd_load_constraints: Unknown option *%s %s!\n",
|
||||
oldconst->option1, oldconst->choice1));
|
||||
free(consts->constraints);
|
||||
free(consts);
|
||||
@@ -815,7 +630,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
|
||||
if (!constptr[1].option || (!constptr[1].choice && oldconst->choice2[0]))
|
||||
{
|
||||
DEBUG_printf(("8ppd_load_constraints: Unknown option *%s %s!",
|
||||
DEBUG_printf(("ppd_load_constraints: Unknown option *%s %s!\n",
|
||||
oldconst->option2, oldconst->choice2));
|
||||
free(consts->constraints);
|
||||
free(consts);
|
||||
@@ -841,7 +656,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
{
|
||||
if (!constattr->value)
|
||||
{
|
||||
DEBUG_puts("8ppd_load_constraints: Bad cupsUIConstraints value!");
|
||||
DEBUG_puts("ppd_load_constraints: Bad cupsUIConstraints value!");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -851,13 +666,13 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
DEBUG_puts("8ppd_load_constraints: Bad cupsUIConstraints value!");
|
||||
DEBUG_puts("ppd_load_constraints: Bad cupsUIConstraints value!");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((consts = calloc(1, sizeof(_ppd_cups_uiconsts_t))) == NULL)
|
||||
{
|
||||
DEBUG_puts("8ppd_load_constraints: Unable to allocate memory for "
|
||||
DEBUG_puts("ppd_load_constraints: Unable to allocate memory for "
|
||||
"cupsUIConstraints!");
|
||||
return;
|
||||
}
|
||||
@@ -865,7 +680,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
if ((constptr = calloc(i, sizeof(_ppd_cups_uiconst_t))) == NULL)
|
||||
{
|
||||
free(consts);
|
||||
DEBUG_puts("8ppd_load_constraints: Unable to allocate memory for "
|
||||
DEBUG_puts("ppd_load_constraints: Unable to allocate memory for "
|
||||
"cupsUIConstraints!");
|
||||
return;
|
||||
}
|
||||
@@ -916,7 +731,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
|
||||
if (!constptr->option || (!constptr->choice && choice[0]))
|
||||
{
|
||||
DEBUG_printf(("8ppd_load_constraints: Unknown option *%s %s!",
|
||||
DEBUG_printf(("ppd_load_constraints: Unknown option *%s %s!\n",
|
||||
option, choice));
|
||||
break;
|
||||
}
|
||||
@@ -953,16 +768,16 @@ ppd_test_constraints(
|
||||
*marked; /* Marked choice */
|
||||
cups_array_t *active = NULL; /* Active constraints */
|
||||
const char *value; /* Current value */
|
||||
int option_conflict;/* Conflict with current option? */
|
||||
|
||||
|
||||
DEBUG_printf(("7ppd_test_constraints(ppd=%p, option=\"%s\", choice=\"%s\", "
|
||||
"num_options=%d, options=%p, which=%d)", ppd, option, choice,
|
||||
num_options, options, which));
|
||||
DEBUG_printf(("ppd_test_constraints(ppd=%p, num_options=%d, options=%p, "
|
||||
"which=%d)\n", ppd, num_options, options, which));
|
||||
|
||||
if (!ppd->cups_uiconstraints)
|
||||
ppd_load_constraints(ppd);
|
||||
|
||||
DEBUG_printf(("9ppd_test_constraints: %d constraints!",
|
||||
DEBUG_printf(("ppd_test_constraints: %d constraints!\n",
|
||||
cupsArrayCount(ppd->cups_uiconstraints)));
|
||||
|
||||
cupsArraySave(ppd->marked);
|
||||
@@ -971,9 +786,9 @@ ppd_test_constraints(
|
||||
consts;
|
||||
consts = (_ppd_cups_uiconsts_t *)cupsArrayNext(ppd->cups_uiconstraints))
|
||||
{
|
||||
DEBUG_printf(("9ppd_test_constraints: installable=%d, resolver=\"%s\", "
|
||||
DEBUG_printf(("ppd_test_constraints: installable=%d, resolver=\"%s\", "
|
||||
"num_constraints=%d option1=\"%s\", choice1=\"%s\", "
|
||||
"option2=\"%s\", choice2=\"%s\", ...",
|
||||
"option2=\"%s\", choice2=\"%s\", ...\n",
|
||||
consts->installable, consts->resolver, consts->num_constraints,
|
||||
consts->constraints[0].option->keyword,
|
||||
consts->constraints[0].choice ?
|
||||
@@ -982,35 +797,17 @@ ppd_test_constraints(
|
||||
consts->constraints[1].choice ?
|
||||
consts->constraints[1].choice->choice : ""));
|
||||
|
||||
if (consts->installable && which < _PPD_INSTALLABLE_CONSTRAINTS)
|
||||
continue; /* Skip installable option constraint */
|
||||
if (which != _PPD_ALL_CONSTRAINTS && which != consts->installable)
|
||||
continue;
|
||||
|
||||
if (!consts->installable && which == _PPD_INSTALLABLE_CONSTRAINTS)
|
||||
continue; /* Skip non-installable option constraint */
|
||||
DEBUG_puts("ppd_test_constraints: Testing...");
|
||||
|
||||
if (which == _PPD_OPTION_CONSTRAINTS && option)
|
||||
{
|
||||
/*
|
||||
* Skip constraints that do not involve the current option...
|
||||
*/
|
||||
|
||||
for (i = consts->num_constraints, constptr = consts->constraints;
|
||||
i > 0;
|
||||
i --, constptr ++)
|
||||
if (!strcasecmp(constptr->option->keyword, option))
|
||||
break;
|
||||
|
||||
if (!i)
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG_puts("9ppd_test_constraints: Testing...");
|
||||
|
||||
for (i = consts->num_constraints, constptr = consts->constraints;
|
||||
for (i = consts->num_constraints, constptr = consts->constraints,
|
||||
option_conflict = 0;
|
||||
i > 0;
|
||||
i --, constptr ++)
|
||||
{
|
||||
DEBUG_printf(("9ppd_test_constraints: %s=%s?", constptr->option->keyword,
|
||||
DEBUG_printf(("ppd_test_constraints: %s=%s?\n", constptr->option->keyword,
|
||||
constptr->choice ? constptr->choice->choice : ""));
|
||||
|
||||
if (constptr->choice &&
|
||||
@@ -1028,6 +825,9 @@ ppd_test_constraints(
|
||||
!strcasecmp(option, "PageRegion")))
|
||||
{
|
||||
value = choice;
|
||||
|
||||
if (!strcasecmp(value, constptr->choice->choice))
|
||||
option_conflict = 1;
|
||||
}
|
||||
else if ((value = cupsGetOption("PageSize", num_options,
|
||||
options)) == NULL)
|
||||
@@ -1041,12 +841,9 @@ ppd_test_constraints(
|
||||
value = size->name;
|
||||
}
|
||||
|
||||
if (value && !strncasecmp(value, "Custom.", 7))
|
||||
value = "Custom";
|
||||
|
||||
if (!value || strcasecmp(value, constptr->choice->choice))
|
||||
{
|
||||
DEBUG_puts("9ppd_test_constraints: NO");
|
||||
DEBUG_puts("ppd_test_constraints: NO");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1054,32 +851,23 @@ ppd_test_constraints(
|
||||
{
|
||||
if (option && choice && !strcasecmp(option, constptr->option->keyword))
|
||||
{
|
||||
if (!strncasecmp(choice, "Custom.", 7))
|
||||
value = "Custom";
|
||||
else
|
||||
value = choice;
|
||||
|
||||
if (strcasecmp(value, constptr->choice->choice))
|
||||
{
|
||||
DEBUG_puts("9ppd_test_constraints: NO");
|
||||
if (strcasecmp(choice, constptr->choice->choice))
|
||||
break;
|
||||
}
|
||||
|
||||
option_conflict = 1;
|
||||
}
|
||||
else if ((value = cupsGetOption(constptr->option->keyword, num_options,
|
||||
options)) != NULL)
|
||||
{
|
||||
if (!strncasecmp(value, "Custom.", 7))
|
||||
value = "Custom";
|
||||
|
||||
if (strcasecmp(value, constptr->choice->choice))
|
||||
{
|
||||
DEBUG_puts("9ppd_test_constraints: NO");
|
||||
DEBUG_puts("ppd_test_constraints: NO");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!constptr->choice->marked)
|
||||
{
|
||||
DEBUG_puts("9ppd_test_constraints: NO");
|
||||
DEBUG_puts("ppd_test_constraints: NO");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1088,10 +876,9 @@ ppd_test_constraints(
|
||||
{
|
||||
if (!strcasecmp(choice, "None") || !strcasecmp(choice, "Off") ||
|
||||
!strcasecmp(choice, "False"))
|
||||
{
|
||||
DEBUG_puts("9ppd_test_constraints: NO");
|
||||
break;
|
||||
}
|
||||
|
||||
option_conflict = 1;
|
||||
}
|
||||
else if ((value = cupsGetOption(constptr->option->keyword, num_options,
|
||||
options)) != NULL)
|
||||
@@ -1099,7 +886,7 @@ ppd_test_constraints(
|
||||
if (!strcasecmp(value, "None") || !strcasecmp(value, "Off") ||
|
||||
!strcasecmp(value, "False"))
|
||||
{
|
||||
DEBUG_puts("9ppd_test_constraints: NO");
|
||||
DEBUG_puts("ppd_test_constraints: NO");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1108,30 +895,30 @@ ppd_test_constraints(
|
||||
key.option = constptr->option;
|
||||
|
||||
if ((marked = (ppd_choice_t *)cupsArrayFind(ppd->marked, &key))
|
||||
== NULL ||
|
||||
!= NULL &&
|
||||
(!strcasecmp(marked->choice, "None") ||
|
||||
!strcasecmp(marked->choice, "Off") ||
|
||||
!strcasecmp(marked->choice, "False")))
|
||||
{
|
||||
DEBUG_puts("9ppd_test_constraints: NO");
|
||||
DEBUG_puts("ppd_test_constraints: NO");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i <= 0)
|
||||
if (i <= 0 && (!option || option_conflict))
|
||||
{
|
||||
if (!active)
|
||||
active = cupsArrayNew(NULL, NULL);
|
||||
|
||||
cupsArrayAdd(active, consts);
|
||||
DEBUG_puts("9ppd_test_constraints: Added...");
|
||||
DEBUG_puts("ppd_test_constraints: Added...");
|
||||
}
|
||||
}
|
||||
|
||||
cupsArrayRestore(ppd->marked);
|
||||
|
||||
DEBUG_printf(("8ppd_test_constraints: Found %d active constraints!",
|
||||
DEBUG_printf(("ppd_test_constraints: Found %d active constraints!\n",
|
||||
cupsArrayCount(active)));
|
||||
|
||||
return (active);
|
||||
|
||||
+3
-20
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* API definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -117,26 +117,18 @@ enum cups_ptype_e /**** Printer type/capability bit constants ****/
|
||||
CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered and added @since CUPS 1.3/Mac OS X 10.5@ */
|
||||
CUPS_PRINTER_SCANNER = 0x2000000, /* Scanner-only device @since CUPS 1.4/Mac OS X 10.6@ */
|
||||
CUPS_PRINTER_MFP = 0x4000000, /* Printer with scanning capabilities @since CUPS 1.4/Mac OS X 10.6@ */
|
||||
CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT | DEFAULT | FAX | REJECTING | DELETE | NOT_SHARED | AUTHENTICATED | COMMANDS | DISCOVERED) @private@ */
|
||||
};
|
||||
|
||||
typedef const char *(*cups_password_cb_t)(const char *prompt);
|
||||
/**** Password callback ****/
|
||||
|
||||
typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http,
|
||||
const char *method,
|
||||
const char *resource,
|
||||
void *user_data);
|
||||
/**** New password callback @since CUPS 1.4/Mac OS X 10.6@ ****/
|
||||
|
||||
typedef void (*cups_device_cb_t)(const char *device_class,
|
||||
const char *device_id, const char *device_info,
|
||||
const char *device_make_and_model,
|
||||
const char *device_uri,
|
||||
const char *device_location, void *user_data);
|
||||
/**** Device callback @since CUPS 1.4/Mac OS X 10.6@ ****/
|
||||
/**** Device callback @since CUPS 1.4@ ****/
|
||||
|
||||
typedef struct cups_option_s /**** Printer Options ****/
|
||||
{
|
||||
@@ -289,20 +281,13 @@ extern int cupsCreateJob(http_t *http, const char *name,
|
||||
cups_option_t *options) _CUPS_API_1_4;
|
||||
extern ipp_status_t cupsFinishDocument(http_t *http,
|
||||
const char *name) _CUPS_API_1_4;
|
||||
extern int cupsGetConflicts(ppd_file_t *ppd, const char *option,
|
||||
const char *choice,
|
||||
cups_option_t **options)
|
||||
_CUPS_API_1_4;
|
||||
extern ipp_status_t cupsGetDevices(http_t *http, int timeout,
|
||||
const char *include_schemes,
|
||||
const char *exclude_schemes,
|
||||
const char *include_schemes,
|
||||
cups_device_cb_t callback,
|
||||
void *user_data) _CUPS_API_1_4;
|
||||
extern cups_dest_t *cupsGetNamedDest(http_t *http, const char *name,
|
||||
const char *instance) _CUPS_API_1_4;
|
||||
extern const char *cupsGetPassword2(const char *prompt, http_t *http,
|
||||
const char *method,
|
||||
const char *resource) _CUPS_API_1_4;
|
||||
extern http_status_t cupsGetPPD3(http_t *http, const char *name,
|
||||
time_t *modtime, char *buffer,
|
||||
size_t bufsize) _CUPS_API_1_4;
|
||||
@@ -318,8 +303,6 @@ extern int cupsResolveConflicts(ppd_file_t *ppd, const char *option,
|
||||
extern http_status_t cupsSendRequest(http_t *http, ipp_t *request,
|
||||
const char *resource,
|
||||
size_t length) _CUPS_API_1_4;
|
||||
extern void cupsSetPasswordCB2(cups_password_cb2_t cb,
|
||||
void *user_data) _CUPS_API_1_4;
|
||||
extern http_status_t cupsStartDocument(http_t *http, const char *name,
|
||||
int job_id, const char *docname,
|
||||
const char *format,
|
||||
|
||||
+9
-79
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Debugging functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2008-2009 by Apple Inc.
|
||||
* Copyright 2008 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -26,16 +26,9 @@
|
||||
|
||||
#include "globals.h"
|
||||
#include "debug.h"
|
||||
#ifdef WIN32
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
# include <unistd.h>
|
||||
#endif /* WIN32 */
|
||||
#include <sys/time.h>
|
||||
#include <fcntl.h>
|
||||
#ifndef WIN32
|
||||
# include <regex.h>
|
||||
#endif /* WIN32 */
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -44,8 +37,6 @@
|
||||
|
||||
int _cups_debug_fd = -1;
|
||||
/* Debug log file descriptor */
|
||||
int _cups_debug_level = 1;
|
||||
/* Log level (0 to 9) */
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -53,10 +44,6 @@ int _cups_debug_level = 1;
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
# ifndef WIN32
|
||||
static regex_t *debug_filter = NULL;
|
||||
/* Filter expression for messages */
|
||||
# endif /* !WIN32 */
|
||||
static int debug_init = 0; /* Did we initialize debugging? */
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
static pthread_mutex_t debug_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
@@ -406,13 +393,8 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
struct timeval curtime; /* Current time */
|
||||
char buffer[2048]; /* Output buffer */
|
||||
size_t bytes; /* Number of bytes in buffer */
|
||||
int level; /* Log level in message */
|
||||
const char *cups_debug_filter,
|
||||
/* CUPS_DEBUG_FILTER environment variable */
|
||||
*cups_debug_level,
|
||||
/* CUPS_DEBUG_LEVEL environment variable */
|
||||
*cups_debug_log;/* CUPS_DEBUG_LOG environment variable */
|
||||
|
||||
const char *cups_debug_log;/* CUPS_DEBUG_LOG environment variable */
|
||||
|
||||
|
||||
/*
|
||||
* See if we need to do any logging...
|
||||
@@ -429,6 +411,8 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
|
||||
if (!debug_init)
|
||||
{
|
||||
debug_init = 1;
|
||||
|
||||
if ((cups_debug_log = getenv("CUPS_DEBUG_LOG")) == NULL)
|
||||
_cups_debug_fd = -1;
|
||||
else if (!strcmp(cups_debug_log, "-"))
|
||||
@@ -436,31 +420,8 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
else
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer), cups_debug_log, getpid());
|
||||
|
||||
if (buffer[0] == '+')
|
||||
_cups_debug_fd = open(buffer + 1, O_WRONLY | O_APPEND | O_CREAT, 0644);
|
||||
else
|
||||
_cups_debug_fd = open(buffer, O_WRONLY | O_TRUNC | O_CREAT, 0644);
|
||||
_cups_debug_fd = open(buffer, O_WRONLY | O_APPEND | O_CREAT, 0644);
|
||||
}
|
||||
|
||||
if ((cups_debug_level = getenv("CUPS_DEBUG_LEVEL")) != NULL)
|
||||
_cups_debug_level = atoi(cups_debug_level);
|
||||
|
||||
if ((cups_debug_filter = getenv("CUPS_DEBUG_FILTER")) != NULL)
|
||||
{
|
||||
if ((debug_filter = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
|
||||
fputs("Unable to allocate memory for CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
else if (regcomp(debug_filter, cups_debug_filter, REG_EXTENDED))
|
||||
{
|
||||
fputs("Bad regular expression in CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
free(debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
debug_init = 1;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&debug_mutex);
|
||||
@@ -469,30 +430,6 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
if (_cups_debug_fd < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Filter as needed...
|
||||
*/
|
||||
|
||||
if (isdigit(format[0]))
|
||||
level = *format++ - '0';
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
|
||||
pthread_mutex_lock(&debug_mutex);
|
||||
result = regexec(debug_filter, format, 0, NULL, 0);
|
||||
pthread_mutex_unlock(&debug_mutex);
|
||||
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
*/
|
||||
@@ -530,14 +467,7 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
void
|
||||
_cups_debug_puts(const char *s) /* I - String to output */
|
||||
{
|
||||
char format[4]; /* C%s */
|
||||
|
||||
format[0] = *s++;
|
||||
format[1] = '%';
|
||||
format[2] = 's';
|
||||
format[3] = '\0';
|
||||
|
||||
_cups_debug_printf(format, s);
|
||||
_cups_debug_printf("%s\n", s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-32
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Debugging macros for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -18,15 +18,6 @@
|
||||
#ifndef _CUPS_DEBUG_H_
|
||||
# define _CUPS_DEBUG_H_
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* The debug macros are used if you compile with DEBUG defined.
|
||||
*
|
||||
@@ -36,24 +27,6 @@ extern "C" {
|
||||
* DEBUG_printf(("format string", arg, arg, ...));
|
||||
*
|
||||
* Note the extra parenthesis around the DEBUG_printf macro...
|
||||
*
|
||||
* Newlines are not required on the end of messages, as both add one when
|
||||
* writing the output.
|
||||
*
|
||||
* If the first character is a digit, then it represents the "log level" of the
|
||||
* message from 0 to 9. The default level is 1. The following defines the
|
||||
* current levels we use:
|
||||
*
|
||||
* 0 = public APIs, other than value accessor functions
|
||||
* 1 = return values for public APIs
|
||||
* 2 = public value accessor APIs, progress for public APIs
|
||||
* 3 = return values for value accessor APIs
|
||||
* 4 = private APIs, progress for value accessor APIs
|
||||
* 5 = return values for private APIs
|
||||
* 6 = progress for private APIs
|
||||
* 7 = static functions
|
||||
* 8 = return values for static functions
|
||||
* 9 = progress for static functions
|
||||
*/
|
||||
|
||||
# ifdef DEBUG
|
||||
@@ -70,7 +43,6 @@ extern "C" {
|
||||
*/
|
||||
|
||||
extern int _cups_debug_fd;
|
||||
extern int _cups_debug_level;
|
||||
extern void _cups_debug_printf(const char *format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__ ((__format__ (__printf__, 1, 2)))
|
||||
@@ -78,9 +50,6 @@ __attribute__ ((__format__ (__printf__, 1, 2)))
|
||||
;
|
||||
extern void _cups_debug_puts(const char *s);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_DEBUG_H_ */
|
||||
|
||||
|
||||
+146
-176
@@ -4,7 +4,7 @@
|
||||
* User-defined destination (and option) support for the Common UNIX
|
||||
* Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -54,7 +54,6 @@
|
||||
|
||||
#include "debug.h"
|
||||
#include "globals.h"
|
||||
#include "pwgmedia.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -83,6 +82,7 @@
|
||||
#ifdef __APPLE__
|
||||
static CFArrayRef appleCopyLocations(void);
|
||||
static CFStringRef appleCopyNetwork(void);
|
||||
static char *appleGetDefault(char *name, int namesize);
|
||||
static char *appleGetPaperSize(char *name, int namesize);
|
||||
static CFStringRef appleGetPrinter(CFArrayRef locations, CFStringRef network,
|
||||
CFIndex *locindex);
|
||||
@@ -98,8 +98,8 @@ static int cups_find_dest(const char *name, const char *instance,
|
||||
static char *cups_get_default(const char *filename, char *namebuf,
|
||||
size_t namesize, const char **instance);
|
||||
static int cups_get_dests(const char *filename, const char *match_name,
|
||||
const char *match_inst, int user_default_set,
|
||||
int num_dests, cups_dest_t **dests);
|
||||
const char *match_inst, int num_dests,
|
||||
cups_dest_t **dests);
|
||||
static int cups_get_sdests(http_t *http, ipp_op_t op, const char *name,
|
||||
int num_dests, cups_dest_t **dests);
|
||||
static char *cups_make_string(ipp_attribute_t *attr, char *buffer,
|
||||
@@ -129,7 +129,7 @@ cupsAddDest(const char *name, /* I - Destination name */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_dest_t *dest; /* Destination pointer */
|
||||
cups_dest_t *parent = NULL; /* Parent destination */
|
||||
cups_dest_t *parent; /* Parent destination */
|
||||
cups_option_t *doption, /* Current destination option */
|
||||
*poption; /* Current parent option */
|
||||
|
||||
@@ -301,8 +301,7 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
char filename[1024]; /* Local ~/.cups/lpoptions file */
|
||||
const char *defprinter; /* Default printer */
|
||||
char name[1024], /* Copy of printer name */
|
||||
*instance, /* Pointer to instance name */
|
||||
*user_default; /* User default printer */
|
||||
*instance; /* Pointer to instance name */
|
||||
int num_reals; /* Number of real queues */
|
||||
cups_dest_t *reals; /* Real queues */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
@@ -362,20 +361,22 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
* Grab the default destination...
|
||||
*/
|
||||
|
||||
if ((user_default = _cupsUserDefault(name, sizeof(name))) != NULL)
|
||||
defprinter = name;
|
||||
else if ((defprinter = cupsGetDefault2(http)) != NULL)
|
||||
{
|
||||
strlcpy(name, defprinter, sizeof(name));
|
||||
defprinter = name;
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
if ((defprinter = appleGetDefault(name, sizeof(name))) == NULL)
|
||||
#endif /* __APPLE__ */
|
||||
defprinter = cupsGetDefault2(http);
|
||||
|
||||
if (defprinter)
|
||||
{
|
||||
/*
|
||||
* Separate printer and instance name...
|
||||
* Grab printer and instance name...
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (name != defprinter)
|
||||
#endif /* __APPLE__ */
|
||||
strlcpy(name, defprinter, sizeof(name));
|
||||
|
||||
if ((instance = strchr(name, '/')) != NULL)
|
||||
*instance++ = '\0';
|
||||
|
||||
@@ -387,15 +388,21 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
dest->is_default = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* This initialization of "instance" is unnecessary, but avoids a
|
||||
* compiler warning...
|
||||
*/
|
||||
|
||||
instance = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load the /etc/cups/lpoptions and ~/.cups/lpoptions files...
|
||||
*/
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/lpoptions", cg->cups_serverroot);
|
||||
num_dests = cups_get_dests(filename, NULL, NULL, user_default != NULL,
|
||||
num_dests, dests);
|
||||
num_dests = cups_get_dests(filename, NULL, NULL, num_dests, dests);
|
||||
|
||||
if ((home = getenv("HOME")) != NULL)
|
||||
{
|
||||
@@ -403,8 +410,7 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
if (access(filename, 0))
|
||||
snprintf(filename, sizeof(filename), "%s/.lpoptions", home);
|
||||
|
||||
num_dests = cups_get_dests(filename, NULL, NULL, user_default != NULL,
|
||||
num_dests, dests);
|
||||
num_dests = cups_get_dests(filename, NULL, NULL, num_dests, dests);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -478,7 +484,7 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
* The returned destination must be freed using @link cupsFreeDests@ with a
|
||||
* "num_dests" value of 1.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4@
|
||||
*/
|
||||
|
||||
cups_dest_t * /* O - Destination or @code NULL@ */
|
||||
@@ -490,7 +496,6 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
|
||||
char filename[1024], /* Path to lpoptions */
|
||||
defname[256]; /* Default printer name */
|
||||
const char *home = getenv("HOME"); /* Home directory */
|
||||
int set_as_default = 0; /* Set returned destination as default */
|
||||
ipp_op_t op = IPP_GET_PRINTER_ATTRIBUTES;
|
||||
/* IPP operation to get server ops */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
@@ -502,8 +507,9 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
|
||||
|
||||
if (!name)
|
||||
{
|
||||
set_as_default = 1;
|
||||
name = _cupsUserDefault(defname, sizeof(defname));
|
||||
if ((name = getenv("LPDEST")) == NULL)
|
||||
if ((name = getenv("PRINTER")) != NULL && !strcmp(name, "lp"))
|
||||
name = NULL;
|
||||
|
||||
if (!name && home)
|
||||
{
|
||||
@@ -548,31 +554,17 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
|
||||
*/
|
||||
|
||||
if (!cups_get_sdests(http, op, name, 0, &dest))
|
||||
{
|
||||
if (op == CUPS_GET_DEFAULT)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* The default printer from environment variables or from a
|
||||
* configuration file does not exist. Find out the real default.
|
||||
*/
|
||||
|
||||
if (!cups_get_sdests(http, CUPS_GET_DEFAULT, name, 0, &dest))
|
||||
return (NULL);
|
||||
}
|
||||
return (NULL);
|
||||
|
||||
if (instance)
|
||||
dest->instance = _cupsStrAlloc(instance);
|
||||
|
||||
if (set_as_default)
|
||||
dest->is_default = 1;
|
||||
|
||||
/*
|
||||
* Then add local options...
|
||||
*/
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/lpoptions", cg->cups_serverroot);
|
||||
cups_get_dests(filename, name, instance, 1, 1, &dest);
|
||||
cups_get_dests(filename, name, instance, 1, &dest);
|
||||
|
||||
if (home)
|
||||
{
|
||||
@@ -581,7 +573,7 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
|
||||
if (access(filename, 0))
|
||||
snprintf(filename, sizeof(filename), "%s/.lpoptions", home);
|
||||
|
||||
cups_get_dests(filename, name, instance, 1, 1, &dest);
|
||||
cups_get_dests(filename, name, instance, 1, &dest);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -758,7 +750,7 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
* Merge in server defaults...
|
||||
*/
|
||||
|
||||
num_temps = cups_get_dests(filename, NULL, NULL, 0, num_temps, &temps);
|
||||
num_temps = cups_get_dests(filename, NULL, NULL, num_temps, &temps);
|
||||
|
||||
/*
|
||||
* Point to user defaults...
|
||||
@@ -934,106 +926,6 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsUserDefault()' - Get the user default printer from environment
|
||||
* variables and location information.
|
||||
*/
|
||||
|
||||
char * /* O - Default printer or NULL */
|
||||
_cupsUserDefault(char *name, /* I - Name buffer */
|
||||
size_t namesize) /* I - Size of name buffer */
|
||||
{
|
||||
const char *env; /* LPDEST or PRINTER env variable */
|
||||
#ifdef __APPLE__
|
||||
CFStringRef network; /* Network location */
|
||||
CFArrayRef locations; /* Location array */
|
||||
CFStringRef locprinter; /* Current printer */
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
if ((env = getenv("LPDEST")) == NULL)
|
||||
if ((env = getenv("PRINTER")) != NULL && !strcmp(env, "lp"))
|
||||
env = NULL;
|
||||
|
||||
if (env)
|
||||
{
|
||||
strlcpy(name, env, namesize);
|
||||
return (name);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* Use location-based defaults if "use last printer" is selected in the
|
||||
* system preferences...
|
||||
*/
|
||||
|
||||
if (!appleUseLastPrinter())
|
||||
{
|
||||
DEBUG_puts("1_cupsUserDefault: Not using last printer as default...");
|
||||
name[0] = '\0';
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the current location...
|
||||
*/
|
||||
|
||||
if ((network = appleCopyNetwork()) == NULL)
|
||||
{
|
||||
DEBUG_puts("1_cupsUserDefault: Unable to get current network...");
|
||||
name[0] = '\0';
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
# ifdef DEBUG
|
||||
CFStringGetCString(network, name, namesize, kCFStringEncodingUTF8);
|
||||
DEBUG_printf(("2_cupsUserDefault: network=\"%s\"", name));
|
||||
# endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* Lookup the network in the preferences...
|
||||
*/
|
||||
|
||||
if ((locations = appleCopyLocations()) == NULL)
|
||||
{
|
||||
/*
|
||||
* Missing or bad location array, so no location-based default...
|
||||
*/
|
||||
|
||||
DEBUG_puts("1_cupsUserDefault: Missing or bad location history array...");
|
||||
|
||||
CFRelease(network);
|
||||
|
||||
name[0] = '\0';
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
DEBUG_printf(("2_cupsUserDefault: Got location, %d entries...",
|
||||
(int)CFArrayGetCount(locations)));
|
||||
|
||||
if ((locprinter = appleGetPrinter(locations, network, NULL)) != NULL)
|
||||
CFStringGetCString(locprinter, name, namesize, kCFStringEncodingUTF8);
|
||||
else
|
||||
name[0] = '\0';
|
||||
|
||||
CFRelease(network);
|
||||
CFRelease(locations);
|
||||
|
||||
DEBUG_printf(("1_cupsUserDefault: Returning \"%s\"...", name));
|
||||
|
||||
return (*name ? name : NULL);
|
||||
|
||||
#else
|
||||
/*
|
||||
* No location-based defaults on this platform...
|
||||
*/
|
||||
|
||||
name[0] = '\0';
|
||||
return (NULL);
|
||||
#endif /* __APPLE__ */
|
||||
}
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* 'appleCopyLocations()' - Copy the location history array.
|
||||
@@ -1101,6 +993,79 @@ appleCopyNetwork(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'appleGetDefault()' - Get the default printer for this location.
|
||||
*/
|
||||
|
||||
static char * /* O - Name or NULL if no default */
|
||||
appleGetDefault(char *name, /* I - Name buffer */
|
||||
int namesize) /* I - Size of name buffer */
|
||||
{
|
||||
CFStringRef network; /* Network location */
|
||||
CFArrayRef locations; /* Location array */
|
||||
CFStringRef locprinter; /* Current printer */
|
||||
|
||||
|
||||
/*
|
||||
* Use location-based defaults if "use last printer" is selected in the
|
||||
* system preferences...
|
||||
*/
|
||||
|
||||
if (!appleUseLastPrinter())
|
||||
{
|
||||
DEBUG_puts("appleGetDefault: Not using last printer as default...");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the current location...
|
||||
*/
|
||||
|
||||
if ((network = appleCopyNetwork()) == NULL)
|
||||
{
|
||||
DEBUG_puts("appleGetDefault: Unable to get current network...");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
CFStringGetCString(network, name, namesize, kCFStringEncodingUTF8);
|
||||
DEBUG_printf(("appleGetDefault: network=\"%s\"\n", name));
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* Lookup the network in the preferences...
|
||||
*/
|
||||
|
||||
if ((locations = appleCopyLocations()) == NULL)
|
||||
{
|
||||
/*
|
||||
* Missing or bad location array, so no location-based default...
|
||||
*/
|
||||
|
||||
DEBUG_puts("appleGetDefault: Missing or bad location history array...");
|
||||
|
||||
CFRelease(network);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
DEBUG_printf(("appleGetDefault: Got location, %d entries...\n",
|
||||
(int)CFArrayGetCount(locations)));
|
||||
|
||||
if ((locprinter = appleGetPrinter(locations, network, NULL)) != NULL)
|
||||
CFStringGetCString(locprinter, name, namesize, kCFStringEncodingUTF8);
|
||||
else
|
||||
name[0] = '\0';
|
||||
|
||||
CFRelease(network);
|
||||
CFRelease(locations);
|
||||
|
||||
DEBUG_printf(("appleGetDefault: Returning \"%s\"...\n", name));
|
||||
|
||||
return (*name ? name : NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'appleGetPaperSize()' - Get the default paper size.
|
||||
*/
|
||||
@@ -1109,8 +1074,7 @@ static char * /* O - Default paper size */
|
||||
appleGetPaperSize(char *name, /* I - Paper size name buffer */
|
||||
int namesize) /* I - Size of buffer */
|
||||
{
|
||||
CFStringRef defaultPaperID; /* Default paper ID */
|
||||
_cups_pwg_media_t *pwgmedia; /* PWG media size */
|
||||
CFStringRef defaultPaperID; /* Default paper ID */
|
||||
|
||||
|
||||
defaultPaperID = CFPreferencesCopyAppValue(kDefaultPaperIDKey,
|
||||
@@ -1120,8 +1084,10 @@ appleGetPaperSize(char *name, /* I - Paper size name buffer */
|
||||
!CFStringGetCString(defaultPaperID, name, namesize,
|
||||
kCFStringEncodingUTF8))
|
||||
name[0] = '\0';
|
||||
else if ((pwgmedia = _cupsPWGMediaByLegacy(name)) != NULL)
|
||||
strlcpy(name, pwgmedia->pwg, namesize);
|
||||
else if (!strncmp(name, "na-", 3))
|
||||
_cups_strcpy(name, name + 3);
|
||||
else if (!strncmp(name, "iso-", 4))
|
||||
_cups_strcpy(name, name + 4);
|
||||
|
||||
if (defaultPaperID)
|
||||
CFRelease(defaultPaperID);
|
||||
@@ -1191,7 +1157,7 @@ appleSetDefault(const char *name) /* I - Default printer/class name */
|
||||
|
||||
if ((network = appleCopyNetwork()) == NULL)
|
||||
{
|
||||
DEBUG_puts("1appleSetDefault: Unable to get current network...");
|
||||
DEBUG_puts("appleSetDefault: Unable to get current network...");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1260,7 +1226,6 @@ appleSetDefault(const char *name) /* I - Default printer/class name */
|
||||
CFPreferencesSetAppValue(kLocationHistoryArrayKey, newlocations,
|
||||
kPMPrintingPreferences);
|
||||
CFPreferencesAppSynchronize(kPMPrintingPreferences);
|
||||
notify_post("com.apple.printerPrefsChange");
|
||||
}
|
||||
|
||||
if (newlocations)
|
||||
@@ -1550,13 +1515,11 @@ cups_get_default(const char *filename, /* I - File to read */
|
||||
*/
|
||||
|
||||
static int /* O - Number of destinations */
|
||||
cups_get_dests(
|
||||
const char *filename, /* I - File to read from */
|
||||
const char *match_name, /* I - Destination name we want */
|
||||
const char *match_inst, /* I - Instance name we want */
|
||||
int user_default_set, /* I - User default printer set? */
|
||||
int num_dests, /* I - Number of destinations */
|
||||
cups_dest_t **dests) /* IO - Destinations */
|
||||
cups_get_dests(const char *filename, /* I - File to read from */
|
||||
const char *match_name, /* I - Destination name we want */
|
||||
const char *match_inst, /* I - Instance name we want */
|
||||
int num_dests, /* I - Number of destinations */
|
||||
cups_dest_t **dests) /* IO - Destinations */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_dest_t *dest; /* Current destination */
|
||||
@@ -1566,12 +1529,13 @@ cups_get_dests(
|
||||
*name, /* Name of destination/option */
|
||||
*instance; /* Instance of destination */
|
||||
int linenum; /* Current line number */
|
||||
const char *printer; /* PRINTER or LPDEST */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_get_dests(filename=\"%s\", match_name=\"%s\", "
|
||||
"match_inst=\"%s\", user_default_set=%d, num_dests=%d, "
|
||||
"dests=%p)", filename, match_name, match_inst,
|
||||
user_default_set, num_dests, dests));
|
||||
DEBUG_printf(("cups_get_dests(filename=\"%s\", match_name=\"%s\", "
|
||||
"match_inst=\"%s\", num_dests=%d, dests=%p)\n", filename,
|
||||
match_name ? match_name : "(null)",
|
||||
match_inst ? match_inst : "(null)", num_dests, dests));
|
||||
|
||||
/*
|
||||
* Try to open the file...
|
||||
@@ -1580,6 +1544,18 @@ cups_get_dests(
|
||||
if ((fp = cupsFileOpen(filename, "r")) == NULL)
|
||||
return (num_dests);
|
||||
|
||||
/*
|
||||
* Check environment variables...
|
||||
*/
|
||||
|
||||
if ((printer = getenv("LPDEST")) == NULL)
|
||||
if ((printer = getenv("PRINTER")) != NULL)
|
||||
if (strcmp(printer, "lp") == 0)
|
||||
printer = NULL;
|
||||
|
||||
DEBUG_printf(("cups_get_dests: printer=\"%s\"\n",
|
||||
printer ? printer : "(null)"));
|
||||
|
||||
/*
|
||||
* Read each printer; each line looks like:
|
||||
*
|
||||
@@ -1595,12 +1571,12 @@ cups_get_dests(
|
||||
* See what type of line it is...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("9cups_get_dests: linenum=%d line=\"%s\" lineptr=\"%s\"",
|
||||
linenum, line, lineptr));
|
||||
DEBUG_printf(("cups_get_dests: linenum=%d line=\"%s\" lineptr=\"%s\"\n",
|
||||
linenum, line, lineptr ? lineptr : "(null)"));
|
||||
|
||||
if ((strcasecmp(line, "dest") && strcasecmp(line, "default")) || !lineptr)
|
||||
{
|
||||
DEBUG_puts("9cups_get_dests: Not a dest or default line...");
|
||||
DEBUG_puts("cups_get_dests: Not a dest or default line...");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1635,7 +1611,7 @@ cups_get_dests(
|
||||
if (*lineptr)
|
||||
*lineptr++ = '\0';
|
||||
|
||||
DEBUG_printf(("9cups_get_dests: name=\"%s\", instance=\"%s\"", name,
|
||||
DEBUG_printf(("cups_get_dests: name=\"%s\", instance=\"%s\"\n", name,
|
||||
instance));
|
||||
|
||||
/*
|
||||
@@ -1655,7 +1631,7 @@ cups_get_dests(
|
||||
}
|
||||
else if (cupsGetDest(name, NULL, num_dests, *dests) == NULL)
|
||||
{
|
||||
DEBUG_puts("9cups_get_dests: Not found!");
|
||||
DEBUG_puts("cups_get_dests: Not found!");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@@ -1672,7 +1648,7 @@ cups_get_dests(
|
||||
* Out of memory!
|
||||
*/
|
||||
|
||||
DEBUG_puts("9cups_get_dests: Out of memory!");
|
||||
DEBUG_puts("cups_get_dests: Out of memory!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1695,9 +1671,9 @@ cups_get_dests(
|
||||
* Set this as default if needed...
|
||||
*/
|
||||
|
||||
if (!user_default_set && !strcasecmp(line, "default"))
|
||||
if (!printer && !strcasecmp(line, "default"))
|
||||
{
|
||||
DEBUG_puts("9cups_get_dests: Setting as default...");
|
||||
DEBUG_puts("cups_get_dests: Setting as default...");
|
||||
|
||||
for (i = 0; i < num_dests; i ++)
|
||||
(*dests)[i].is_default = 0;
|
||||
@@ -1727,6 +1703,7 @@ cups_get_sdests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFA
|
||||
int num_dests, /* I - Number of destinations */
|
||||
cups_dest_t **dests) /* IO - Destinations */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_dest_t *dest; /* Current destination */
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
@@ -1744,7 +1721,6 @@ cups_get_sdests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFA
|
||||
static const char * const pattrs[] = /* Attributes we're interested in */
|
||||
{
|
||||
"auth-info-required",
|
||||
"device-uri",
|
||||
"job-sheets-default",
|
||||
"marker-change-time",
|
||||
"marker-colors",
|
||||
@@ -1758,7 +1734,6 @@ cups_get_sdests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFA
|
||||
"media-supported",
|
||||
#endif /* __APPLE__ */
|
||||
"printer-commands",
|
||||
"printer-defaults",
|
||||
"printer-info",
|
||||
"printer-is-accepting-jobs",
|
||||
"printer-is-shared",
|
||||
@@ -1769,7 +1744,7 @@ cups_get_sdests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFA
|
||||
"printer-state-change-time",
|
||||
"printer-state-reasons",
|
||||
"printer-type",
|
||||
"printer-uri-supported"
|
||||
"printer-defaults"
|
||||
};
|
||||
|
||||
|
||||
@@ -1844,12 +1819,10 @@ cups_get_sdests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFA
|
||||
attr->value_tag != IPP_TAG_NAME &&
|
||||
attr->value_tag != IPP_TAG_NAMELANG &&
|
||||
attr->value_tag != IPP_TAG_KEYWORD &&
|
||||
attr->value_tag != IPP_TAG_RANGE &&
|
||||
attr->value_tag != IPP_TAG_URI)
|
||||
attr->value_tag != IPP_TAG_RANGE)
|
||||
continue;
|
||||
|
||||
if (!strcmp(attr->name, "auth-info-required") ||
|
||||
!strcmp(attr->name, "device-uri") ||
|
||||
!strcmp(attr->name, "marker-change-time") ||
|
||||
!strcmp(attr->name, "marker-colors") ||
|
||||
!strcmp(attr->name, "marker-high-levels") ||
|
||||
@@ -1867,8 +1840,7 @@ cups_get_sdests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFA
|
||||
!strcmp(attr->name, "printer-type") ||
|
||||
!strcmp(attr->name, "printer-is-accepting-jobs") ||
|
||||
!strcmp(attr->name, "printer-location") ||
|
||||
!strcmp(attr->name, "printer-state-reasons") ||
|
||||
!strcmp(attr->name, "printer-uri-supported"))
|
||||
!strcmp(attr->name, "printer-state-reasons"))
|
||||
{
|
||||
/*
|
||||
* Add a printer description attribute...
|
||||
@@ -1886,8 +1858,6 @@ cups_get_sdests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFA
|
||||
* See if we can set a default media size...
|
||||
*/
|
||||
|
||||
int i; /* Looping var */
|
||||
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
if (!strcasecmp(media_default, attr->values[i].string.text))
|
||||
{
|
||||
|
||||
+12
-13
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* This set of APIs abstracts enumeration of directory entries.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -73,7 +73,7 @@ _cups_dir_time(FILETIME ft) /* I - File time */
|
||||
* between them...
|
||||
*/
|
||||
|
||||
val = ft.dwLowDateTime + ((ULONGLONG)ft.dwHighDateTime << 32);
|
||||
val = ft.dwLowDateTime + (ft.dwHighDateTime << 32);
|
||||
return ((time_t)(val / 10000000 - 11644732800));
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ struct _cups_dir_s /**** Directory data structure ****/
|
||||
void
|
||||
cupsDirClose(cups_dir_t *dp) /* I - Directory pointer */
|
||||
{
|
||||
DEBUG_printf(("cupsDirClose(dp=%p)", dp));
|
||||
DEBUG_printf(("cupsDirClose(dp=%p)\n", dp));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -301,7 +301,7 @@ cupsDirOpen(const char *directory) /* I - Directory name */
|
||||
cups_dir_t *dp; /* Directory */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsDirOpen(directory=\"%s\")", directory));
|
||||
DEBUG_printf(("cupsDirOpen(directory=\"%s\")\n", directory));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -360,7 +360,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
|
||||
|
||||
DEBUG_printf(("2cupsDirRead(dp=%p)", dp));
|
||||
DEBUG_printf(("cupsDirRead(dp=%p)\n", dp));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -382,18 +382,17 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
|
||||
|
||||
if (readdir_r(dp->dir, (struct dirent *)buffer, &entry))
|
||||
{
|
||||
DEBUG_printf(("3cupsDirRead: readdir_r() failed - %s\n", strerror(errno)));
|
||||
DEBUG_printf((" readdir_r() failed - %s\n", strerror(errno)));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
DEBUG_puts("3cupsDirRead: readdir_r() returned a NULL pointer!");
|
||||
DEBUG_puts(" readdir_r() returned a NULL pointer!");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
DEBUG_printf(("4cupsDirRead: readdir_r() returned \"%s\"...",
|
||||
entry->d_name));
|
||||
DEBUG_printf((" readdir_r() returned \"%s\"...\n", entry->d_name));
|
||||
|
||||
# else
|
||||
/*
|
||||
@@ -402,11 +401,11 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
|
||||
|
||||
if ((entry = readdir(dp->dir)) == NULL)
|
||||
{
|
||||
DEBUG_puts("3cupsDirRead: readdir() returned a NULL pointer!");
|
||||
DEBUG_puts(" readdir() returned a NULL pointer!");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
DEBUG_printf(("4cupsDirRead: readdir() returned \"%s\"...", entry->d_name));
|
||||
DEBUG_printf((" readdir() returned \"%s\"...\n", entry->d_name));
|
||||
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
|
||||
@@ -427,7 +426,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
|
||||
|
||||
if (stat(filename, &(dp->entry.fileinfo)))
|
||||
{
|
||||
DEBUG_printf(("3cupsDirRead: stat() failed for \"%s\" - %s...", filename,
|
||||
DEBUG_printf((" stat() failed for \"%s\" - %s...\n", filename,
|
||||
strerror(errno)));
|
||||
continue;
|
||||
}
|
||||
@@ -450,7 +449,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
|
||||
void
|
||||
cupsDirRewind(cups_dir_t *dp) /* I - Directory pointer */
|
||||
{
|
||||
DEBUG_printf(("cupsDirRewind(dp=%p)", dp));
|
||||
DEBUG_printf(("cupsDirRewind(dp=%p)\n", dp));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
|
||||
+47
-103
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* PPD code emission routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -109,7 +109,7 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
|
||||
float *orders; /* Collected order values */
|
||||
|
||||
|
||||
DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)",
|
||||
DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)\n",
|
||||
ppd, section, min_order, choices));
|
||||
|
||||
if (!ppd || !choices)
|
||||
@@ -223,7 +223,7 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
|
||||
|
||||
free(orders);
|
||||
|
||||
DEBUG_printf(("2ppdCollect2: %d marked choices...", count));
|
||||
DEBUG_printf(("ppdCollect2: %d marked choices...\n", count));
|
||||
|
||||
/*
|
||||
* Return the array and number of choices; if 0, free the array since
|
||||
@@ -390,8 +390,7 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
|
||||
const char *title) /* I - Title */
|
||||
{
|
||||
char *ptr; /* Pointer into JCL string */
|
||||
char temp[65], /* Local title string */
|
||||
displaymsg[33]; /* Local display string */
|
||||
char temp[81]; /* Local title string */
|
||||
|
||||
|
||||
/*
|
||||
@@ -465,39 +464,14 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up the job title...
|
||||
* Eliminate any path info from the job title...
|
||||
*/
|
||||
|
||||
if ((ptr = strrchr(title, '/')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Only show basename of file path...
|
||||
*/
|
||||
|
||||
title = ptr + 1;
|
||||
}
|
||||
|
||||
if (!strncmp(title, "smbprn.", 7))
|
||||
{
|
||||
/*
|
||||
* Skip leading smbprn.######## from Samba jobs...
|
||||
*/
|
||||
|
||||
for (title += 7; *title && isdigit(*title & 255); title ++);
|
||||
for (; *title && isspace(*title & 255); title ++);
|
||||
|
||||
if ((ptr = strstr(title, " - ")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Skip application name in "Some Application - Title of job"...
|
||||
*/
|
||||
|
||||
title = ptr + 3;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Replace double quotes with single quotes and UTF-8 characters with
|
||||
* Replace double quotes with single quotes and 8-bit characters with
|
||||
* question marks so that the title does not cause a PJL syntax error.
|
||||
*/
|
||||
|
||||
@@ -506,18 +480,9 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
|
||||
for (ptr = temp; *ptr; ptr ++)
|
||||
if (*ptr == '\"')
|
||||
*ptr = '\'';
|
||||
else if (!charset && (*ptr & 128))
|
||||
else if (charset && (*ptr & 128))
|
||||
*ptr = '?';
|
||||
|
||||
/*
|
||||
* CUPS STR #3125: Long PJL JOB NAME causes problems with some printers
|
||||
*
|
||||
* Generate the display message, truncating at 32 characters + nul to avoid
|
||||
* issues with some printer's PJL implementations...
|
||||
*/
|
||||
|
||||
snprintf(displaymsg, sizeof(displaymsg), "%d %s %s", job_id, user, temp);
|
||||
|
||||
/*
|
||||
* Send PJL JOB and PJL RDYMSG commands before we enter PostScript mode...
|
||||
*/
|
||||
@@ -527,11 +492,11 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
|
||||
fprintf(fp, "@PJL JOB NAME = \"%s\"\n", temp);
|
||||
|
||||
if (display && !strcmp(display->value, "rdymsg"))
|
||||
fprintf(fp, "@PJL RDYMSG DISPLAY = \"%s\"\n", displaymsg);
|
||||
fprintf(fp, "@PJL RDYMSG DISPLAY = \"%d %s %s\"\n", job_id, user, temp);
|
||||
}
|
||||
else
|
||||
fprintf(fp, "@PJL JOB NAME = \"%s\" DISPLAY = \"%s\"\n", temp,
|
||||
displaymsg);
|
||||
fprintf(fp, "@PJL JOB NAME = \"%s\" DISPLAY = \"%d %s %s\"\n", temp,
|
||||
job_id, user, temp);
|
||||
}
|
||||
else
|
||||
fputs(ppd->jcl_begin, fp);
|
||||
@@ -626,7 +591,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
struct lconv *loc; /* Locale data */
|
||||
|
||||
|
||||
DEBUG_printf(("ppdEmitString(ppd=%p, section=%d, min_order=%f)",
|
||||
DEBUG_printf(("ppdEmitString(ppd=%p, section=%d, min_order=%f)\n",
|
||||
ppd, section, min_order));
|
||||
|
||||
/*
|
||||
@@ -697,7 +662,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
!strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
|
||||
!strcasecmp(choices[i]->choice, "Custom"))
|
||||
{
|
||||
DEBUG_puts("2ppdEmitString: Custom size set!");
|
||||
DEBUG_puts("ppdEmitString: Custom size set!");
|
||||
|
||||
bufsize += 37; /* %%BeginFeature: *CustomPageSize True\n */
|
||||
bufsize += 50; /* Five 9-digit numbers + newline */
|
||||
@@ -707,8 +672,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
choices[i]->option->keyword))
|
||||
!= NULL)
|
||||
{
|
||||
bufsize += 23 + strlen(choices[i]->option->keyword) + 6;
|
||||
/* %%BeginFeature: *Customkeyword True\n */
|
||||
bufsize += 17 + strlen(choices[i]->option->keyword) + 6;
|
||||
/* %%BeginFeature: *keyword True\n */
|
||||
|
||||
|
||||
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
|
||||
@@ -752,7 +717,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
* Allocate memory...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("2ppdEmitString: Allocating %d bytes for string...",
|
||||
DEBUG_printf(("ppdEmitString: Allocating %d bytes for string...\n",
|
||||
(int)bufsize));
|
||||
|
||||
if ((buffer = calloc(1, bufsize)) == NULL)
|
||||
@@ -865,8 +830,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
* Send DSC comments with option...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("2ppdEmitString: Adding code for %s=%s...",
|
||||
choices[i]->option->keyword, choices[i]->choice));
|
||||
DEBUG_printf(("Adding code for %s=%s...\n", choices[i]->option->keyword,
|
||||
choices[i]->choice));
|
||||
|
||||
if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
|
||||
!strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
|
||||
@@ -1070,7 +1035,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
"} stopped cleartomark\n", bufend - bufptr + 1);
|
||||
bufptr += strlen(bufptr);
|
||||
|
||||
DEBUG_printf(("2ppdEmitString: Offset in string is %d...",
|
||||
DEBUG_printf(("ppdEmitString: Offset in string is %d...\n",
|
||||
(int)(bufptr - buffer)));
|
||||
}
|
||||
else
|
||||
@@ -1111,32 +1076,17 @@ static void
|
||||
ppd_handle_media(ppd_file_t *ppd) /* I - PPD file */
|
||||
{
|
||||
ppd_choice_t *manual_feed, /* ManualFeed choice, if any */
|
||||
*input_slot; /* InputSlot choice, if any */
|
||||
*input_slot, /* InputSlot choice, if any */
|
||||
*page; /* PageSize/PageRegion */
|
||||
ppd_size_t *size; /* Current media size */
|
||||
ppd_attr_t *rpr; /* RequiresPageRegion value */
|
||||
|
||||
|
||||
/*
|
||||
* This function determines what page size code to use, if any, for the
|
||||
* current media size, InputSlot, and ManualFeed selections.
|
||||
*
|
||||
* We use the PageSize code if:
|
||||
*
|
||||
* 1. A custom media size is selected.
|
||||
* 2. ManualFeed and InputSlot are not selected (or do not exist).
|
||||
* 3. ManualFeed is selected but is False and InputSlot is not selected or
|
||||
* the selection has no code - the latter check done to support "auto" or
|
||||
* "printer default" InputSlot options.
|
||||
*
|
||||
* We use the PageRegion code if:
|
||||
*
|
||||
* 4. RequiresPageRegion does not exist and the PPD contains cupsFilter
|
||||
* keywords, indicating this is a CUPS-based driver.
|
||||
* 5. RequiresPageRegion exists for the selected InputSlot (or "All" for any
|
||||
* InputSlot or ManualFeed selection) and is True.
|
||||
*
|
||||
* If none of the 5 conditions are true, no page size code is used and we
|
||||
* unmark any existing PageSize or PageRegion choices.
|
||||
* This function determines if the user has selected a media source
|
||||
* via the InputSlot or ManualFeed options; if so, it marks the
|
||||
* PageRegion option corresponding to the current media size.
|
||||
* Otherwise it marks the PageSize option.
|
||||
*/
|
||||
|
||||
if ((size = ppdPageSize(ppd, NULL)) == NULL)
|
||||
@@ -1153,52 +1103,46 @@ ppd_handle_media(ppd_file_t *ppd) /* I - PPD file */
|
||||
if (!rpr)
|
||||
rpr = ppdFindAttr(ppd, "RequiresPageRegion", "All");
|
||||
|
||||
if (!strcasecmp(size->name, "Custom") ||
|
||||
(!manual_feed && !input_slot) ||
|
||||
(manual_feed && !strcasecmp(manual_feed->choice, "False") &&
|
||||
(!input_slot || (input_slot->code && !input_slot->code[0]))) ||
|
||||
(!rpr && ppd->num_filters > 0))
|
||||
if (!strcasecmp(size->name, "Custom") || (!manual_feed && !input_slot) ||
|
||||
!((manual_feed && !strcasecmp(manual_feed->choice, "True")) ||
|
||||
(input_slot && input_slot->code && input_slot->code[0])))
|
||||
{
|
||||
/*
|
||||
* Use PageSize code...
|
||||
* Manual feed was not selected and/or the input slot selection does
|
||||
* not contain any PostScript code. Use the PageSize option...
|
||||
*/
|
||||
|
||||
ppdMarkOption(ppd, "PageSize", size->name);
|
||||
}
|
||||
else if (rpr && rpr->value && !strcasecmp(rpr->value, "True"))
|
||||
{
|
||||
/*
|
||||
* Use PageRegion code...
|
||||
*/
|
||||
|
||||
ppdMarkOption(ppd, "PageRegion", size->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Do not use PageSize or PageRegion code...
|
||||
* Manual feed was selected and/or the input slot selection contains
|
||||
* PostScript code. Use the PageRegion option...
|
||||
*/
|
||||
|
||||
ppd_choice_t *page; /* PageSize/Region choice, if any */
|
||||
ppdMarkOption(ppd, "PageRegion", size->name);
|
||||
|
||||
if ((page = ppdFindMarkedChoice(ppd, "PageSize")) != NULL)
|
||||
/*
|
||||
* RequiresPageRegion does not apply to manual feed so we need to
|
||||
* check that we are not doing manual feed before unmarking PageRegion.
|
||||
*/
|
||||
|
||||
if (!(manual_feed && !strcasecmp(manual_feed->choice, "True")) &&
|
||||
((rpr && rpr->value && !strcmp(rpr->value, "False")) ||
|
||||
(!rpr && !ppd->num_filters)))
|
||||
{
|
||||
/*
|
||||
* Unmark PageSize...
|
||||
* Either the PPD file specifies no PageRegion code or the PPD file
|
||||
* not for a CUPS raster driver and thus defaults to no PageRegion
|
||||
* code... Unmark the PageRegion choice so that we don't output the
|
||||
* code...
|
||||
*/
|
||||
|
||||
page->marked = 0;
|
||||
cupsArrayRemove(ppd->marked, page);
|
||||
}
|
||||
page = ppdFindMarkedChoice(ppd, "PageRegion");
|
||||
|
||||
if ((page = ppdFindMarkedChoice(ppd, "PageRegion")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Unmark PageRegion...
|
||||
*/
|
||||
|
||||
page->marked = 0;
|
||||
cupsArrayRemove(ppd->marked, page);
|
||||
if (page)
|
||||
page->marked = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-64
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Option encoding routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -54,7 +54,6 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "compression", IPP_TAG_KEYWORD, IPP_TAG_OPERATION },
|
||||
{ 0, "copies", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "copies-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "device-uri", IPP_TAG_URI, IPP_TAG_PRINTER },
|
||||
{ 0, "document-format", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
|
||||
{ 0, "document-format-default", IPP_TAG_MIMETYPE, IPP_TAG_PRINTER },
|
||||
{ 1, "exclude-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION },
|
||||
@@ -70,10 +69,10 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "hue-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 1, "include-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION },
|
||||
{ 0, "job-impressions", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "job-k-limit", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "job-page-limit", 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_PRINTER },
|
||||
{ 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 },
|
||||
@@ -87,13 +86,6 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 1, "marker-names", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 1, "marker-types", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ 1, "media", IPP_TAG_KEYWORD, IPP_TAG_JOB },
|
||||
{ 0, "media-col", IPP_TAG_BEGIN_COLLECTION, IPP_TAG_JOB },
|
||||
{ 0, "media-col-default", IPP_TAG_BEGIN_COLLECTION, IPP_TAG_PRINTER },
|
||||
{ 0, "media-color", IPP_TAG_KEYWORD, IPP_TAG_JOB },
|
||||
{ 1, "media-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ 0, "media-key", IPP_TAG_KEYWORD, IPP_TAG_JOB },
|
||||
{ 0, "media-size", IPP_TAG_BEGIN_COLLECTION, IPP_TAG_JOB },
|
||||
{ 0, "media-type", 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 },
|
||||
@@ -146,7 +138,6 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 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 },
|
||||
{ 1, "printer-uri-supported", IPP_TAG_URI, IPP_TAG_PRINTER },
|
||||
{ 0, "queued-job-count", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "raw", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
|
||||
{ 1, "requested-attributes", IPP_TAG_NAME, IPP_TAG_OPERATION },
|
||||
@@ -161,9 +152,7 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 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 },
|
||||
{ 0, "x-dimension", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "y-dimension", IPP_TAG_INTEGER, IPP_TAG_JOB }
|
||||
{ 0, "wrap-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER }
|
||||
};
|
||||
|
||||
|
||||
@@ -187,7 +176,7 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t *options) /* I - Options */
|
||||
{
|
||||
DEBUG_printf(("cupsEncodeOptions(%p, %d, %p)", ipp, num_options, options));
|
||||
DEBUG_printf(("cupsEncodeOptions(%p, %d, %p)\n", ipp, num_options, options));
|
||||
|
||||
/*
|
||||
* Add the options in the proper groups & order...
|
||||
@@ -226,13 +215,10 @@ cupsEncodeOptions2(
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
ipp_tag_t value_tag; /* IPP value tag */
|
||||
cups_option_t *option; /* Current option */
|
||||
ipp_t *collection; /* Collection value */
|
||||
int num_cols; /* Number of collection values */
|
||||
cups_option_t *cols; /* Collection values */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsEncodeOptions2(ipp=%p, num_options=%d, options=%p, "
|
||||
"group_tag=%x)", ipp, num_options, options, group_tag));
|
||||
"group_tag=%x)\n", ipp, num_options, options, group_tag));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -340,7 +326,7 @@ cupsEncodeOptions2(
|
||||
else
|
||||
count = 1;
|
||||
|
||||
DEBUG_printf(("2cupsEncodeOptions2: option=\"%s\", count=%d",
|
||||
DEBUG_printf(("cupsEncodeOptions2: option = \'%s\', count = %d\n",
|
||||
option->name, count));
|
||||
|
||||
/*
|
||||
@@ -353,7 +339,7 @@ cupsEncodeOptions2(
|
||||
* Ran out of memory!
|
||||
*/
|
||||
|
||||
DEBUG_puts("1cupsEncodeOptions2: Ran out of memory for attributes!");
|
||||
DEBUG_puts("cupsEncodeOptions2: Ran out of memory for attributes!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -382,8 +368,7 @@ cupsEncodeOptions2(
|
||||
* Ran out of memory!
|
||||
*/
|
||||
|
||||
DEBUG_puts("1cupsEncodeOptions2: Ran out of memory for value copy!");
|
||||
ippDeleteAttribute(ipp, attr);
|
||||
DEBUG_puts("cupsEncodeOptions2: Ran out of memory for value copy!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -459,8 +444,8 @@ cupsEncodeOptions2(
|
||||
|
||||
attr->values[j].integer = strtol(val, &s, 10);
|
||||
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Added integer option value "
|
||||
"%d...", attr->values[j].integer));
|
||||
DEBUG_printf(("cupsEncodeOptions2: Added integer option value %d...\n",
|
||||
attr->values[j].integer));
|
||||
break;
|
||||
|
||||
case IPP_TAG_BOOLEAN :
|
||||
@@ -474,7 +459,7 @@ cupsEncodeOptions2(
|
||||
|
||||
attr->values[j].boolean = 1;
|
||||
|
||||
DEBUG_puts("2cupsEncodeOptions2: Added boolean true value...");
|
||||
DEBUG_puts("cupsEncodeOptions2: Added boolean true value...");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -484,7 +469,7 @@ cupsEncodeOptions2(
|
||||
|
||||
attr->values[j].boolean = 0;
|
||||
|
||||
DEBUG_puts("2cupsEncodeOptions2: Added boolean false value...");
|
||||
DEBUG_puts("cupsEncodeOptions2: Added boolean false value...");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -511,8 +496,8 @@ cupsEncodeOptions2(
|
||||
else
|
||||
attr->values[j].range.upper = attr->values[j].range.lower;
|
||||
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Added range option value "
|
||||
"%d-%d...", attr->values[j].range.lower,
|
||||
DEBUG_printf(("cupsEncodeOptions2: Added range option value %d-%d...\n",
|
||||
attr->values[j].range.lower,
|
||||
attr->values[j].range.upper));
|
||||
break;
|
||||
|
||||
@@ -533,8 +518,8 @@ cupsEncodeOptions2(
|
||||
else
|
||||
attr->values[j].resolution.units = IPP_RES_PER_INCH;
|
||||
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Added resolution option value "
|
||||
"%s...", val));
|
||||
DEBUG_printf(("cupsEncodeOptions2: Added resolution option value %s...\n",
|
||||
val));
|
||||
break;
|
||||
|
||||
case IPP_TAG_STRING :
|
||||
@@ -545,32 +530,10 @@ cupsEncodeOptions2(
|
||||
attr->values[j].unknown.length = (int)strlen(val);
|
||||
attr->values[j].unknown.data = strdup(val);
|
||||
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Added octet-string value "
|
||||
"\"%s\"...", (char *)attr->values[j].unknown.data));
|
||||
DEBUG_printf(("cupsEncodeOptions2: Added octet-string value "
|
||||
"\"%s\"...\n", (char *)attr->values[j].unknown.data));
|
||||
break;
|
||||
|
||||
case IPP_TAG_BEGIN_COLLECTION :
|
||||
/*
|
||||
* Collection value
|
||||
*/
|
||||
|
||||
num_cols = cupsParseOptions(val, 0, &cols);
|
||||
if ((collection = ippNew()) == NULL)
|
||||
{
|
||||
cupsFreeOptions(num_cols, cols);
|
||||
|
||||
if (copy)
|
||||
free(copy);
|
||||
|
||||
ippDeleteAttribute(ipp, attr);
|
||||
return;
|
||||
}
|
||||
|
||||
attr->values[j].collection = collection;
|
||||
cupsEncodeOptions2(collection, num_cols, cols, IPP_TAG_JOB);
|
||||
cupsFreeOptions(num_cols, cols);
|
||||
break;
|
||||
|
||||
default :
|
||||
if ((attr->values[j].string.text = _cupsStrAlloc(val)) == NULL)
|
||||
{
|
||||
@@ -578,16 +541,11 @@ cupsEncodeOptions2(
|
||||
* Ran out of memory!
|
||||
*/
|
||||
|
||||
DEBUG_puts("1cupsEncodeOptions2: Ran out of memory for string!");
|
||||
|
||||
if (copy)
|
||||
free(copy);
|
||||
|
||||
ippDeleteAttribute(ipp, attr);
|
||||
DEBUG_puts("cupsEncodeOptions2: Ran out of memory for string!");
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Added string value \"%s\"...",
|
||||
DEBUG_printf(("cupsEncodeOptions2: Added string value \"%s\"...\n",
|
||||
val));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Private file definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Since stdio files max out at 256 files on many systems, we have to
|
||||
* write similar functions without this limit. At the same time, using
|
||||
* our own file functions allows us to provide transparent support of
|
||||
* gzip'd print files, PPD files, etc.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_FILE_PRIVATE_H_
|
||||
# define _CUPS_FILE_PRIVATE_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <stdarg.h>
|
||||
# include <errno.h>
|
||||
# include <fcntl.h>
|
||||
# include "http-private.h"
|
||||
# include "globals.h"
|
||||
# include "debug.h"
|
||||
|
||||
# ifdef HAVE_LIBZ
|
||||
# include <zlib.h>
|
||||
# endif /* HAVE_LIBZ */
|
||||
# ifdef WIN32
|
||||
# include <io.h>
|
||||
# include <sys/locking.h>
|
||||
# endif /* WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Some operating systems support large files via open flag O_LARGEFILE...
|
||||
*/
|
||||
|
||||
# ifndef O_LARGEFILE
|
||||
# define O_LARGEFILE 0
|
||||
# endif /* !O_LARGEFILE */
|
||||
|
||||
|
||||
/*
|
||||
* Some operating systems don't define O_BINARY, which is used by Microsoft
|
||||
* and IBM to flag binary files...
|
||||
*/
|
||||
|
||||
# ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
# endif /* !O_BINARY */
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
struct _cups_file_s /**** CUPS file structure... ****/
|
||||
|
||||
{
|
||||
int fd; /* File descriptor */
|
||||
char mode, /* Mode ('r' or 'w') */
|
||||
compressed, /* Compression used? */
|
||||
is_stdio, /* stdin/out/err? */
|
||||
eof, /* End of file? */
|
||||
buf[4096], /* Buffer */
|
||||
*ptr, /* Pointer into buffer */
|
||||
*end; /* End of buffer data */
|
||||
off_t pos, /* Position in file */
|
||||
bufpos; /* File position for start of buffer */
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
z_stream stream; /* (De)compression stream */
|
||||
Bytef cbuf[4096]; /* (De)compression buffer */
|
||||
uLong crc; /* (De)compression CRC */
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
char *printf_buffer; /* cupsFilePrintf buffer */
|
||||
size_t printf_size; /* Size of cupsFilePrintf buffer */
|
||||
};
|
||||
|
||||
|
||||
#endif /* !_CUPS_FILE_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+136
-75
@@ -8,7 +8,7 @@
|
||||
* our own file functions allows us to provide transparent support of
|
||||
* gzip'd print files, PPD files, etc.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -58,7 +58,71 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "file-private.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include "http-private.h"
|
||||
#include "globals.h"
|
||||
#include "debug.h"
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
# include <zlib.h>
|
||||
#endif /* HAVE_LIBZ */
|
||||
#ifdef WIN32
|
||||
# include <io.h>
|
||||
# include <sys/locking.h>
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Some operating systems support large files via open flag O_LARGEFILE...
|
||||
*/
|
||||
|
||||
#ifndef O_LARGEFILE
|
||||
# define O_LARGEFILE 0
|
||||
#endif /* !O_LARGEFILE */
|
||||
|
||||
|
||||
/*
|
||||
* Some operating systems don't define O_BINARY, which is used by Microsoft
|
||||
* and IBM to flag binary files...
|
||||
*/
|
||||
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif /* !O_BINARY */
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
struct _cups_file_s /**** CUPS file structure... ****/
|
||||
|
||||
{
|
||||
int fd; /* File descriptor */
|
||||
char mode, /* Mode ('r' or 'w') */
|
||||
compressed, /* Compression used? */
|
||||
is_stdio, /* stdin/out/err? */
|
||||
eof, /* End of file? */
|
||||
buf[4096], /* Buffer */
|
||||
*ptr, /* Pointer into buffer */
|
||||
*end; /* End of buffer data */
|
||||
off_t pos, /* Position in file */
|
||||
bufpos; /* File position for start of buffer */
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
z_stream stream; /* (De)compression stream */
|
||||
Bytef cbuf[4096]; /* (De)compression buffer */
|
||||
uLong crc; /* (De)compression CRC */
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
char *printf_buffer; /* cupsFilePrintf buffer */
|
||||
size_t printf_size; /* Size of cupsFilePrintf buffer */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
@@ -88,7 +152,7 @@ cupsFileClose(cups_file_t *fp) /* I - CUPS file */
|
||||
int is_stdio; /* Is a stdio file? */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileClose(fp=%p)", fp));
|
||||
DEBUG_printf(("cupsFileClose(fp=%p)\n", fp));
|
||||
|
||||
/*
|
||||
* Range check...
|
||||
@@ -258,10 +322,6 @@ cupsFileFind(const char *filename, /* I - File to find */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileFind(filename=\"%s\", path=\"%s\", executable=%d, "
|
||||
"buffer=%p, bufsize=%d)", filename, path, executable, buffer,
|
||||
bufsize));
|
||||
|
||||
if (!filename || !buffer || bufsize < 2)
|
||||
return (NULL);
|
||||
|
||||
@@ -306,7 +366,7 @@ cupsFileFind(const char *filename, /* I - File to find */
|
||||
if (!access(buffer, executable ? X_OK : 0))
|
||||
#endif /* WIN32 */
|
||||
{
|
||||
DEBUG_printf(("1cupsFileFind: Returning \"%s\"", buffer));
|
||||
DEBUG_printf(("cupsFileFind: Returning \"%s\"\n", buffer));
|
||||
return (buffer);
|
||||
}
|
||||
|
||||
@@ -329,12 +389,12 @@ cupsFileFind(const char *filename, /* I - File to find */
|
||||
|
||||
if (!access(buffer, 0))
|
||||
{
|
||||
DEBUG_printf(("1cupsFileFind: Returning \"%s\"", buffer));
|
||||
DEBUG_printf(("cupsFileFind: Returning \"%s\"\n", buffer));
|
||||
return (buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_puts("1cupsFileFind: Returning NULL");
|
||||
DEBUG_puts("cupsFileFind: Returning NULL");
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
@@ -352,7 +412,7 @@ cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
|
||||
ssize_t bytes; /* Bytes to write */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileFlush(fp=%p)", fp));
|
||||
DEBUG_printf(("cupsFileFlush(fp=%p)\n", fp));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -360,13 +420,13 @@ cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
if (!fp || fp->mode != 'w')
|
||||
{
|
||||
DEBUG_puts("1cupsFileFlush: 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(("2cupsFileFlush: Flushing " CUPS_LLFMT " bytes...",
|
||||
DEBUG_printf(("cupsFileFlush: Flushing " CUPS_LLFMT " bytes...\n",
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
if (bytes > 0)
|
||||
@@ -401,9 +461,11 @@ 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("3cupsFileGetChar: Bad arguments!");
|
||||
DEBUG_puts("cupsFileGetChar: Bad arguments!");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -414,7 +476,7 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
|
||||
if (fp->ptr >= fp->end)
|
||||
if (cups_fill(fp) < 0)
|
||||
{
|
||||
DEBUG_puts("3cupsFileGetChar: Unable to fill buffer!");
|
||||
DEBUG_puts("cupsFileGetChar: Unable to fill buffer!");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -422,11 +484,11 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
|
||||
* Return the next character in the buffer...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("3cupsFileGetChar: Returning %d...", *(fp->ptr) & 255));
|
||||
DEBUG_printf(("cupsFileGetChar: Returning %d...\n", *(fp->ptr) & 255));
|
||||
|
||||
fp->pos ++;
|
||||
|
||||
DEBUG_printf(("4cupsFileGetChar: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileGetChar: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (*(fp->ptr)++ & 255);
|
||||
}
|
||||
@@ -452,8 +514,8 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("2cupsFileGetConf(fp=%p, buf=%p, buflen=" CUPS_LLFMT
|
||||
", value=%p, linenum=%p)", fp, buf, CUPS_LLCAST buflen,
|
||||
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') ||
|
||||
@@ -596,7 +658,7 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("2cupsFileGetLine(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")",
|
||||
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)
|
||||
@@ -645,7 +707,7 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
DEBUG_printf(("4cupsFileGetLine: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileGetLine: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (ptr - buf);
|
||||
}
|
||||
@@ -671,7 +733,7 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("2cupsFileGets(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")", fp, buf,
|
||||
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)
|
||||
@@ -727,7 +789,7 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
DEBUG_printf(("4cupsFileGets: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileGets: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (buf);
|
||||
}
|
||||
@@ -755,7 +817,7 @@ cupsFileLock(cups_file_t *fp, /* I - CUPS file */
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
return (_locking(fp->fd, block ? _LK_LOCK : _LK_NBLCK, 0));
|
||||
return (locking(fp->fd, block ? _LK_LOCK : _LK_NBLCK, 0));
|
||||
#else
|
||||
return (lockf(fp->fd, block ? F_LOCK : F_TLOCK, 0));
|
||||
#endif /* WIN32 */
|
||||
@@ -808,7 +870,7 @@ cupsFileOpen(const char *filename, /* I - Name of file */
|
||||
http_addrlist_t *addrlist; /* Host address list */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileOpen(filename=\"%s\", mode=\"%s\")", filename,
|
||||
DEBUG_printf(("cupsFileOpen(filename=\"%s\", mode=\"%s\")\n", filename,
|
||||
mode));
|
||||
|
||||
/*
|
||||
@@ -911,7 +973,7 @@ cupsFileOpenFd(int fd, /* I - File descriptor */
|
||||
cups_file_t *fp; /* New CUPS file */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileOpenFd(fd=%d, mode=\"%s\")", fd, mode));
|
||||
DEBUG_printf(("cupsFileOpenFd(fd=%d, mode=\"%s\")\n", fd, mode));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -1057,7 +1119,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t bytes; /* Formatted size */
|
||||
|
||||
|
||||
DEBUG_printf(("2cupsFilePrintf(fp=%p, format=\"%s\", ...)", fp, format));
|
||||
DEBUG_printf(("cupsFilePrintf(fp=%p, format=\"%s\", ...)\n", fp, format));
|
||||
|
||||
if (!fp || !format || (fp->mode != 'w' && fp->mode != 's'))
|
||||
return (-1);
|
||||
@@ -1078,7 +1140,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
bytes = vsnprintf(fp->printf_buffer, fp->printf_size, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (bytes >= (ssize_t)fp->printf_size)
|
||||
if (bytes >= fp->printf_size)
|
||||
{
|
||||
/*
|
||||
* Expand the printf buffer...
|
||||
@@ -1108,7 +1170,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("4cupsFilePrintf: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFilePrintf: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
@@ -1119,7 +1181,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("4cupsFilePrintf: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFilePrintf: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (bytes > sizeof(fp->buf))
|
||||
{
|
||||
@@ -1185,7 +1247,7 @@ cupsFilePutChar(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos ++;
|
||||
|
||||
DEBUG_printf(("4cupsFilePutChar: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFilePutChar: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -1196,7 +1258,7 @@ cupsFilePutChar(cups_file_t *fp, /* I - CUPS file */
|
||||
*
|
||||
* This function handles any comment escaping of the value.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes written or -1 on error */
|
||||
@@ -1287,7 +1349,7 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("4cupsFilePuts: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFilePuts: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
@@ -1298,7 +1360,7 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("4cupsFilePuts: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFilePuts: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (bytes > sizeof(fp->buf))
|
||||
{
|
||||
@@ -1333,7 +1395,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t count; /* Bytes read */
|
||||
|
||||
|
||||
DEBUG_printf(("2cupsFileRead(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")", fp, buf,
|
||||
DEBUG_printf(("cupsFileRead(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
@@ -1356,8 +1418,8 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
if (fp->ptr >= fp->end)
|
||||
if (cups_fill(fp) <= 0)
|
||||
{
|
||||
DEBUG_printf(("4cupsFileRead: cups_fill() returned -1, total="
|
||||
CUPS_LLFMT, CUPS_LLCAST total));
|
||||
DEBUG_printf(("cupsFileRead: cups_fill() returned -1, total=" CUPS_LLFMT "\n",
|
||||
CUPS_LLCAST total));
|
||||
|
||||
if (total > 0)
|
||||
return ((ssize_t)total);
|
||||
@@ -1373,7 +1435,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
fp->ptr += count;
|
||||
fp->pos += count;
|
||||
|
||||
DEBUG_printf(("4cupsFileRead: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileRead: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
/*
|
||||
* Update the counts for the last read...
|
||||
@@ -1388,7 +1450,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
* Return the total number of bytes read...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("3cupsFileRead: total=" CUPS_LLFMT, CUPS_LLCAST total));
|
||||
DEBUG_printf(("cupsFileRead: total=%d\n", (int)total));
|
||||
|
||||
return ((ssize_t)total);
|
||||
}
|
||||
@@ -1408,8 +1470,8 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileRewind(fp=%p)", fp));
|
||||
DEBUG_printf(("2cupsFileRewind: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
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);
|
||||
@@ -1432,7 +1494,7 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
fp->eof = 0;
|
||||
}
|
||||
|
||||
DEBUG_printf(("2cupsFileRewind: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -1451,7 +1513,7 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
if (lseek(fp->fd, 0, SEEK_SET))
|
||||
{
|
||||
DEBUG_printf(("1cupsFileRewind: lseek failed: %s", strerror(errno)));
|
||||
DEBUG_printf(("cupsFileRewind: lseek failed: %s\n", strerror(errno)));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -1461,7 +1523,7 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
fp->end = NULL;
|
||||
fp->eof = 0;
|
||||
|
||||
DEBUG_printf(("2cupsFileRewind: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -1480,10 +1542,10 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t bytes; /* Number bytes in buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")", fp,
|
||||
DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")\n", fp,
|
||||
CUPS_LLCAST pos));
|
||||
DEBUG_printf(("2cupsFileSeek: fp->pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("2cupsFileSeek: fp->ptr=%p, fp->end=%p", fp->ptr, fp->end));
|
||||
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...
|
||||
@@ -1503,8 +1565,6 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
{
|
||||
bytes = (ssize_t)(fp->end - fp->buf);
|
||||
|
||||
DEBUG_printf(("2cupsFileSeek: bytes=" CUPS_LLFMT, CUPS_LLCAST bytes));
|
||||
|
||||
if (pos >= fp->bufpos && pos < (fp->bufpos + bytes))
|
||||
{
|
||||
/*
|
||||
@@ -1537,13 +1597,15 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->eof = 0;
|
||||
|
||||
DEBUG_printf(("cupsFileSeek: bytes=" CUPS_LLFMT "\n", CUPS_LLCAST bytes));
|
||||
|
||||
if (pos < fp->bufpos)
|
||||
{
|
||||
/*
|
||||
* Need to seek backwards...
|
||||
*/
|
||||
|
||||
DEBUG_puts("2cupsFileSeek: SEEK BACKWARDS");
|
||||
DEBUG_puts("cupsFileSeek: SEEK BACKWARDS");
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
if (fp->compressed)
|
||||
@@ -1574,7 +1636,7 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
|
||||
DEBUG_printf(("2cupsFileSeek: lseek() returned " CUPS_LLFMT,
|
||||
DEBUG_printf(("cupsFileSeek: lseek() returned " CUPS_LLFMT "...\n",
|
||||
CUPS_LLCAST fp->pos));
|
||||
}
|
||||
}
|
||||
@@ -1584,7 +1646,7 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
* Need to seek forwards...
|
||||
*/
|
||||
|
||||
DEBUG_puts("2cupsFileSeek: SEEK FORWARDS");
|
||||
DEBUG_puts("cupsFileSeek: SEEK FORWARDS");
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
if (fp->compressed)
|
||||
@@ -1609,12 +1671,12 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
|
||||
DEBUG_printf(("2cupsFileSeek: lseek() returned " CUPS_LLFMT,
|
||||
DEBUG_printf(("cupsFileSeek: lseek() returned " CUPS_LLFMT "...\n",
|
||||
CUPS_LLCAST fp->pos));
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_printf(("2cupsFileSeek: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileSeek: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (fp->pos);
|
||||
}
|
||||
@@ -1731,9 +1793,8 @@ cupsFileStdout(void)
|
||||
off_t /* O - File position */
|
||||
cupsFileTell(cups_file_t *fp) /* I - CUPS file */
|
||||
{
|
||||
DEBUG_printf(("2cupsFileTell(fp=%p)", fp));
|
||||
DEBUG_printf(("3cupsFileTell: pos=" CUPS_LLFMT,
|
||||
CUPS_LLCAST (fp ? fp->pos : -1)));
|
||||
DEBUG_printf(("cupsFileTell(fp=%p)\n", fp));
|
||||
DEBUG_printf(("cupsFileTell: pos=" CUPS_LLFMT "\n", CUPS_LLCAST (fp ? fp->pos : -1)));
|
||||
|
||||
return (fp ? fp->pos : 0);
|
||||
}
|
||||
@@ -1752,7 +1813,7 @@ cupsFileUnlock(cups_file_t *fp) /* I - CUPS file */
|
||||
* Range check...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileUnlock(fp=%p)", fp));
|
||||
DEBUG_printf(("cupsFileUnlock(fp=%p)\n", fp));
|
||||
|
||||
if (!fp || fp->mode == 's')
|
||||
return (-1);
|
||||
@@ -1762,7 +1823,7 @@ cupsFileUnlock(cups_file_t *fp) /* I - CUPS file */
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
return (_locking(fp->fd, _LK_UNLCK, 0));
|
||||
return (locking(fp->fd, _LK_UNLCK, 0));
|
||||
#else
|
||||
return (lockf(fp->fd, F_ULOCK, 0));
|
||||
#endif /* WIN32 */
|
||||
@@ -1784,7 +1845,7 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("2cupsFileWrite(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")",
|
||||
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'))
|
||||
@@ -1804,7 +1865,7 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += (off_t)bytes;
|
||||
|
||||
DEBUG_printf(("4cupsFileWrite: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileWrite: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return ((ssize_t)bytes);
|
||||
}
|
||||
@@ -1815,7 +1876,7 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += (off_t)bytes;
|
||||
|
||||
DEBUG_printf(("4cupsFileWrite: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileWrite: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (bytes > sizeof(fp->buf))
|
||||
{
|
||||
@@ -1845,7 +1906,7 @@ cups_compress(cups_file_t *fp, /* I - CUPS file */
|
||||
const char *buf, /* I - Buffer */
|
||||
size_t bytes) /* I - Number bytes */
|
||||
{
|
||||
DEBUG_printf(("7cups_compress(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")", fp, buf,
|
||||
DEBUG_printf(("cups_compress(fp=%p, buf=%p, bytes=" CUPS_LLFMT "\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
@@ -1867,7 +1928,7 @@ cups_compress(cups_file_t *fp, /* I - CUPS file */
|
||||
* Flush the current buffer...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("9cups_compress: avail_in=%d, avail_out=%d",
|
||||
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))
|
||||
@@ -1902,16 +1963,16 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_fill(fp=%p)", fp));
|
||||
DEBUG_printf(("9cups_fill: fp->ptr=%p, fp->end=%p, fp->buf=%p, "
|
||||
"fp->bufpos=" CUPS_LLFMT ", fp->eof=%d",
|
||||
DEBUG_printf(("cups_fill(fp=%p)\n", fp));
|
||||
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->bufpos += fp->end - fp->buf;
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
DEBUG_printf(("9cups_fill: fp->compressed=%d", fp->compressed));
|
||||
DEBUG_printf(("cups_fill: fp->compressed=%d\n", fp->compressed));
|
||||
|
||||
while (!fp->ptr || fp->compressed)
|
||||
{
|
||||
@@ -1939,7 +2000,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
* Can't read from file!
|
||||
*/
|
||||
|
||||
DEBUG_printf(("9cups_fill: cups_read() returned " CUPS_LLFMT,
|
||||
DEBUG_printf(("cups_fill: cups_read() returned " CUPS_LLFMT "!\n",
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
return (-1);
|
||||
@@ -1956,7 +2017,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
fp->ptr = fp->buf;
|
||||
fp->end = fp->buf + bytes;
|
||||
|
||||
DEBUG_printf(("9cups_fill: Returning " CUPS_LLFMT,
|
||||
DEBUG_printf(("cups_fill: Returning " CUPS_LLFMT "!\n",
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
return (bytes);
|
||||
@@ -2147,7 +2208,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
* Bad CRC, mark end-of-file...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("9cups_fill: tcrc=%08x, fp->crc=%08x",
|
||||
DEBUG_printf(("cups_fill: tcrc=%08x, fp->crc=%08x\n",
|
||||
(unsigned int)tcrc, (unsigned int)fp->crc));
|
||||
|
||||
fp->eof = 1;
|
||||
@@ -2220,7 +2281,7 @@ cups_read(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t total; /* Total bytes read */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_read(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")", fp, buf,
|
||||
DEBUG_printf(("cups_read(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
@@ -2241,7 +2302,7 @@ cups_read(cups_file_t *fp, /* I - CUPS file */
|
||||
total = read(fp->fd, buf, bytes);
|
||||
#endif /* WIN32 */
|
||||
|
||||
DEBUG_printf(("9cups_read: total=" CUPS_LLFMT, CUPS_LLCAST total));
|
||||
DEBUG_printf(("cups_read: total=" CUPS_LLFMT "\n", CUPS_LLCAST total));
|
||||
|
||||
if (total >= 0)
|
||||
break;
|
||||
@@ -2277,7 +2338,7 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t count; /* Count this time */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_write(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")", fp, buf,
|
||||
DEBUG_printf(("cups_write(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
@@ -2299,7 +2360,7 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
|
||||
count = write(fp->fd, buf, bytes);
|
||||
#endif /* WIN32 */
|
||||
|
||||
DEBUG_printf(("9cups_write: count=" CUPS_LLFMT, CUPS_LLCAST count));
|
||||
DEBUG_printf(("cups_write: count=" CUPS_LLFMT "\n", CUPS_LLCAST count));
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
|
||||
+18
-24
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* cupsGetDevices implementation for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2008-2009 by Apple Inc.
|
||||
* Copyright 2008 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -35,7 +35,7 @@
|
||||
* parameters provide comma-delimited lists of backends to include or omit from
|
||||
* the request respectively.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4@
|
||||
*/
|
||||
|
||||
ipp_status_t /* O - Request status - @code IPP_OK@ on success. */
|
||||
@@ -66,11 +66,6 @@ cupsGetDevices(
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsGetDevices(http=%p, timeout=%d, include_schemes=\"%s\", "
|
||||
"exclude_schemes=\"%s\", callback=%p, user_data=%p)", http,
|
||||
timeout, include_schemes, exclude_schemes, callback,
|
||||
user_data));
|
||||
|
||||
if (!callback)
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
|
||||
@@ -112,10 +107,10 @@ cupsGetDevices(
|
||||
|
||||
do
|
||||
{
|
||||
DEBUG_puts("2cupsGetDevices: Sending request...");
|
||||
DEBUG_puts("cupsGetDevices: Sending request...");
|
||||
status = cupsSendRequest(http, request, "/", ippLength(request));
|
||||
|
||||
DEBUG_puts("2cupsGetDevices: Waiting for response status...");
|
||||
DEBUG_puts("cupsGetDevices: Waiting for response status...");
|
||||
while (status == HTTP_CONTINUE)
|
||||
status = httpUpdate(http);
|
||||
|
||||
@@ -129,15 +124,14 @@ cupsGetDevices(
|
||||
* See if we can do authentication...
|
||||
*/
|
||||
|
||||
DEBUG_puts("2cupsGetDevices: Need authorization...");
|
||||
int auth_result;
|
||||
|
||||
if (!cupsDoAuthentication(http, "POST", "/"))
|
||||
DEBUG_puts("cupsGetDevices: Need authorization...");
|
||||
|
||||
if ((auth_result = cupsDoAuthentication(http, "POST", "/")) == 0)
|
||||
httpReconnect(http);
|
||||
else
|
||||
{
|
||||
status = HTTP_AUTHORIZATION_CANCELED;
|
||||
break;
|
||||
}
|
||||
else if (auth_result < 0)
|
||||
http->status = status = HTTP_FORBIDDEN;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
@@ -147,7 +141,7 @@ cupsGetDevices(
|
||||
* Force a reconnect with encryption...
|
||||
*/
|
||||
|
||||
DEBUG_puts("2cupsGetDevices: Need encryption...");
|
||||
DEBUG_puts("cupsGetDevices: Need encryption...");
|
||||
|
||||
if (!httpReconnect(http))
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
@@ -157,7 +151,7 @@ cupsGetDevices(
|
||||
}
|
||||
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
|
||||
|
||||
DEBUG_printf(("2cupsGetDevices: status=%d", status));
|
||||
DEBUG_printf(("cupsGetDevices: status=%d\n", status));
|
||||
|
||||
ippDelete(request);
|
||||
|
||||
@@ -183,14 +177,14 @@ cupsGetDevices(
|
||||
device_uri = NULL;
|
||||
attr = NULL;
|
||||
|
||||
DEBUG_puts("2cupsGetDevices: Reading response...");
|
||||
DEBUG_puts("cupsGetDevices: Reading response...");
|
||||
|
||||
do
|
||||
{
|
||||
if ((state = ippRead(http, response)) == IPP_ERROR)
|
||||
break;
|
||||
|
||||
DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state,
|
||||
DEBUG_printf(("cupsGetDevices: state=%d, response->last=%p\n", state,
|
||||
response->last));
|
||||
|
||||
if (!response->attrs)
|
||||
@@ -203,8 +197,8 @@ cupsGetDevices(
|
||||
else
|
||||
attr = attr->next;
|
||||
|
||||
DEBUG_printf(("2cupsGetDevices: attr->name=\"%s\", attr->value_tag=%d",
|
||||
attr->name, attr->value_tag));
|
||||
DEBUG_printf(("cupsGetDevices: attr->name=\"%s\", attr->value_tag=%d\n",
|
||||
attr->name ? attr->name : "(null)", attr->value_tag));
|
||||
|
||||
if (!attr->name)
|
||||
{
|
||||
@@ -243,7 +237,7 @@ cupsGetDevices(
|
||||
}
|
||||
while (state != IPP_DATA);
|
||||
|
||||
DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state,
|
||||
DEBUG_printf(("cupsGetDevices: state=%d, response->last=%p\n", state,
|
||||
response->last));
|
||||
|
||||
if (device_class && device_id && device_info && device_make_and_model &&
|
||||
@@ -264,7 +258,7 @@ cupsGetDevices(
|
||||
{
|
||||
attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
|
||||
|
||||
DEBUG_printf(("cupsGetDevices: status-code=%s, status-message=\"%s\"",
|
||||
DEBUG_printf(("cupsGetDevices: status-code=%s, status-message=\"%s\"\n",
|
||||
ippErrorString(response->request.status.status_code),
|
||||
attr ? attr->values[0].string.text : ""));
|
||||
|
||||
|
||||
+6
-16
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Get/put file functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -66,7 +66,7 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsGetFd(http=%p, resource=\"%s\", fd=%d)", http,
|
||||
DEBUG_printf(("cupsGetFd(http=%p, resource=\"%s\", fd=%d)\n", http,
|
||||
resource, fd));
|
||||
|
||||
if (!resource || fd < 0)
|
||||
@@ -123,10 +123,7 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
*/
|
||||
|
||||
if (cupsDoAuthentication(http, "GET", resource))
|
||||
{
|
||||
status = HTTP_AUTHORIZATION_CANCELED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (httpReconnect(http))
|
||||
{
|
||||
@@ -182,8 +179,6 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
* Return the request status...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("1cupsGetFd: Returning %d...", status));
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
@@ -279,7 +274,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsPutFd(http=%p, resource=\"%s\", fd=%d)", http,
|
||||
DEBUG_printf(("cupsPutFd(http=%p, resource=\"%s\", fd=%d)\n", http,
|
||||
resource, fd));
|
||||
|
||||
if (!resource || fd < 0)
|
||||
@@ -302,7 +297,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
|
||||
do
|
||||
{
|
||||
DEBUG_printf(("2cupsPutFd: starting attempt, authstring=\"%s\"...",
|
||||
DEBUG_printf(("cupsPutFd: starting attempt, authstring=\"%s\"...\n",
|
||||
http->authstring));
|
||||
|
||||
httpClearFields(http);
|
||||
@@ -360,7 +355,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
|
||||
if (status == HTTP_ERROR && !retries)
|
||||
{
|
||||
DEBUG_printf(("2cupsPutFd: retry on status %d", status));
|
||||
DEBUG_printf(("cupsPutFd: retry on status %d\n", status));
|
||||
|
||||
retries ++;
|
||||
|
||||
@@ -378,7 +373,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG_printf(("2cupsPutFd: status=%d", status));
|
||||
DEBUG_printf(("cupsPutFd: status=%d\n", status));
|
||||
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
{
|
||||
@@ -393,10 +388,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
*/
|
||||
|
||||
if (cupsDoAuthentication(http, "PUT", resource))
|
||||
{
|
||||
status = HTTP_AUTHORIZATION_CANCELED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (httpReconnect(http))
|
||||
{
|
||||
@@ -440,8 +432,6 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
httpFlush(http);
|
||||
}
|
||||
|
||||
DEBUG_printf(("1cupsPutFd: Returning %d...", status));
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
+3
-6
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Global variable access routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -112,7 +112,7 @@ _cupsGlobals(void)
|
||||
*/
|
||||
|
||||
globals->encryption = (http_encryption_t)-1;
|
||||
globals->password_cb = (cups_password_cb2_t)_cupsGetPassword;
|
||||
globals->password_cb = _cupsGetPassword;
|
||||
|
||||
cups_env_init(globals);
|
||||
}
|
||||
@@ -167,9 +167,6 @@ globals_destructor(void *value) /* I - Data to free */
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
cupsArrayDelete(cg->pwg_size_lut);
|
||||
cupsArrayDelete(cg->leg_size_lut);
|
||||
|
||||
free(value);
|
||||
}
|
||||
|
||||
@@ -205,7 +202,7 @@ _cupsGlobals(void)
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
globals.encryption = (http_encryption_t)-1;
|
||||
globals.password_cb = (cups_password_cb2_t)_cupsGetPassword;
|
||||
globals.password_cb = _cupsGetPassword;
|
||||
|
||||
cups_env_init(&globals);
|
||||
}
|
||||
|
||||
+2
-9
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Global variable definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -103,10 +103,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
int ppd_line; /* Current line number */
|
||||
ppd_conform_t ppd_conform; /* Level of conformance required */
|
||||
|
||||
/* pwgmedia.c */
|
||||
cups_array_t *pwg_size_lut, /* Lookup table for PWG names */
|
||||
*leg_size_lut; /* Lookup table for legacy names */
|
||||
|
||||
/* snmp.c */
|
||||
char snmp_community[255];
|
||||
/* Default SNMP community name */
|
||||
@@ -120,8 +116,7 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
char user[65], /* User name */
|
||||
server[256], /* Server address */
|
||||
servername[256];/* Server hostname */
|
||||
cups_password_cb2_t password_cb; /* Password callback */
|
||||
void *password_data; /* Password user data */
|
||||
cups_password_cb_t password_cb; /* Password callback */
|
||||
|
||||
/* util.c */
|
||||
http_t *http; /* Current server connection */
|
||||
@@ -143,11 +138,9 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
extern http_t *_cupsConnect(void);
|
||||
extern const char *_cupsGetPassword(const char *prompt);
|
||||
extern _cups_globals_t *_cupsGlobals(void);
|
||||
extern void _cupsSetDefaults(void);
|
||||
extern void _cupsSetError(ipp_status_t status, const char *message,
|
||||
int localize);
|
||||
extern void _cupsSetHTTPError(http_status_t status);
|
||||
extern char *_cupsUserDefault(char *name, size_t namesize);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+11
-22
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* HTTP address routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -154,7 +154,7 @@ httpAddrLocalhost(
|
||||
#endif /* AF_LOCAL */
|
||||
|
||||
if (addr->addr.sa_family == AF_INET &&
|
||||
(ntohl(addr->ipv4.sin_addr.s_addr) & 0xff000000) == 0x7f000000)
|
||||
ntohl(addr->ipv4.sin_addr.s_addr) == 0x7f000001)
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
@@ -184,8 +184,8 @@ httpAddrLookup(
|
||||
/* Global data */
|
||||
|
||||
|
||||
DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)", addr, name,
|
||||
namelen));
|
||||
DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)\n",
|
||||
addr, name, namelen));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -207,16 +207,6 @@ httpAddrLookup(
|
||||
}
|
||||
#endif /* AF_LOCAL */
|
||||
|
||||
/*
|
||||
* Optimize lookups for localhost/loopback addresses...
|
||||
*/
|
||||
|
||||
if (httpAddrLocalhost(addr))
|
||||
{
|
||||
strlcpy(name, "localhost", namelen);
|
||||
return (name);
|
||||
}
|
||||
|
||||
#ifdef HAVE_RES_INIT
|
||||
/*
|
||||
* STR #2920: Initialize resolver after failure in cups-polld
|
||||
@@ -289,8 +279,6 @@ httpAddrLookup(
|
||||
}
|
||||
#endif /* HAVE_GETNAMEINFO */
|
||||
|
||||
DEBUG_printf(("1httpAddrLookup: returning \"%s\"...", name));
|
||||
|
||||
return (name);
|
||||
}
|
||||
|
||||
@@ -326,7 +314,8 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
char *s, /* I - String buffer */
|
||||
int slen) /* I - Length of string */
|
||||
{
|
||||
DEBUG_printf(("httpAddrString(addr=%p, s=%p, slen=%d)", addr, s, slen));
|
||||
DEBUG_printf(("httpAddrString(addr=%p, s=%p, slen=%d)\n",
|
||||
addr, s, slen));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -453,7 +442,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
else
|
||||
strlcpy(s, "UNKNOWN", slen);
|
||||
|
||||
DEBUG_printf(("1httpAddrString: returning \"%s\"...", s));
|
||||
DEBUG_printf(("httpAddrString: returning \"%s\"...\n", s));
|
||||
|
||||
return (s);
|
||||
}
|
||||
@@ -475,7 +464,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
|
||||
/* Pointer to library globals */
|
||||
|
||||
|
||||
DEBUG_printf(("httpGetHostByName(name=\"%s\")", name));
|
||||
DEBUG_printf(("httpGetHostByName(name=\"%s\")\n", name));
|
||||
|
||||
/*
|
||||
* Avoid lookup delays and configuration problems when connecting
|
||||
@@ -513,7 +502,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
|
||||
cg->ip_ptrs[0] = (char *)name;
|
||||
cg->ip_ptrs[1] = NULL;
|
||||
|
||||
DEBUG_puts("1httpGetHostByName: returning domain socket address...");
|
||||
DEBUG_puts("httpGetHostByName: returning domain socket address...");
|
||||
|
||||
return (&cg->hostent);
|
||||
}
|
||||
@@ -549,7 +538,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
|
||||
cg->ip_ptrs[0] = (char *)&(cg->ip_addr);
|
||||
cg->ip_ptrs[1] = NULL;
|
||||
|
||||
DEBUG_puts("1httpGetHostByName: returning IPv4 address...");
|
||||
DEBUG_puts("httpGetHostByName: returning IPv4 address...");
|
||||
|
||||
return (&cg->hostent);
|
||||
}
|
||||
@@ -560,7 +549,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
|
||||
* the name...
|
||||
*/
|
||||
|
||||
DEBUG_puts("1httpGetHostByName: returning domain lookup address(es)...");
|
||||
DEBUG_puts("httpGetHostByName: returning domain lookup address(es)...");
|
||||
|
||||
return (gethostbyname(name));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* HTTP address list routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -50,7 +50,7 @@ httpAddrConnect(
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
DEBUG_printf(("httpAddrConnect(addrlist=%p, sock=%p)", addrlist, sock));
|
||||
DEBUG_printf(("httpAddrConnect(addrlist=%p, sock=%p)\n", addrlist, sock));
|
||||
|
||||
if (!sock)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ httpAddrConnect(
|
||||
* Create the socket...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("2httpAddrConnect: Trying %s:%d...",
|
||||
DEBUG_printf(("httpAddrConnect: Trying %s:%d...\n",
|
||||
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
|
||||
_httpAddrPort(&(addrlist->addr))));
|
||||
|
||||
@@ -134,13 +134,13 @@ httpAddrConnect(
|
||||
if (!connect(*sock, &(addrlist->addr.addr),
|
||||
httpAddrLength(&(addrlist->addr))))
|
||||
{
|
||||
DEBUG_printf(("1httpAddrConnect: Connected to %s:%d...",
|
||||
DEBUG_printf(("httpAddrConnect: Connected to %s:%d...\n",
|
||||
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
|
||||
_httpAddrPort(&(addrlist->addr))));
|
||||
break;
|
||||
}
|
||||
|
||||
DEBUG_printf(("1httpAddrConnect: Unable to connect to %s:%d: %s",
|
||||
DEBUG_printf(("httpAddrConnect: Unable to connect to %s:%d: %s\n",
|
||||
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
|
||||
_httpAddrPort(&(addrlist->addr)), strerror(errno)));
|
||||
|
||||
@@ -265,7 +265,6 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
}
|
||||
else
|
||||
#endif /* AF_LOCAL */
|
||||
if (!hostname || strcasecmp(hostname, "localhost"))
|
||||
{
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
struct addrinfo hints, /* Address lookup hints */
|
||||
@@ -502,7 +501,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
* Detect some common errors and handle them sanely...
|
||||
*/
|
||||
|
||||
if (!addr && (!hostname || !strcasecmp(hostname, "localhost")))
|
||||
if (!addr && (!hostname || !strcmp(hostname, "localhost")))
|
||||
{
|
||||
struct servent *port; /* Port number for service */
|
||||
int portnum; /* Port number */
|
||||
@@ -531,7 +530,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
else
|
||||
return (NULL);
|
||||
|
||||
if (hostname && !strcasecmp(hostname, "localhost"))
|
||||
if (hostname && !strcmp(hostname, "localhost"))
|
||||
{
|
||||
/*
|
||||
* Unfortunately, some users ignore all of the warnings in the
|
||||
|
||||
@@ -268,7 +268,6 @@ extern char *_httpEncodeURI(char *dst, const char *src,
|
||||
size_t dstsize);
|
||||
extern const char *_httpResolveURI(const char *uri, char *resolved_uri,
|
||||
size_t resolved_size, int log);
|
||||
extern int _httpWait(http_t *http, int msec, int usessl);
|
||||
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
|
||||
+41
-97
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* HTTP support routines for the Common UNIX Printing System (CUPS) scheduler.
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -52,7 +52,6 @@
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_DNSSD
|
||||
# include <dns_sd.h>
|
||||
# include <poll.h>
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
|
||||
@@ -293,7 +292,7 @@ httpAssembleURI(
|
||||
* Otherwise, just copy the host string...
|
||||
*/
|
||||
|
||||
ptr = http_copy_encode(ptr, host, end, ":/?#[]@\\", NULL,
|
||||
ptr = http_copy_encode(ptr, host, end, ":/?#[]@", NULL,
|
||||
encoding & HTTP_URI_CODING_HOSTNAME);
|
||||
|
||||
if (!ptr)
|
||||
@@ -727,7 +726,7 @@ httpGetDateTime(const char *s) /* I - Date/time string */
|
||||
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 };
|
||||
|
||||
|
||||
DEBUG_printf(("2httpGetDateTime(s=\"%s\")", s));
|
||||
DEBUG_printf(("httpGetDateTime(s=\"%s\")\n", s));
|
||||
|
||||
/*
|
||||
* Extract the date and time from the formatted string...
|
||||
@@ -736,8 +735,8 @@ httpGetDateTime(const char *s) /* I - Date/time string */
|
||||
if (sscanf(s, "%*s%d%15s%d%d:%d:%d", &day, mon, &year, &hour, &min, &sec) < 6)
|
||||
return (0);
|
||||
|
||||
DEBUG_printf(("4httpGetDateTime: day=%d, mon=\"%s\", year=%d, hour=%d, "
|
||||
"min=%d, sec=%d", day, mon, year, hour, min, sec));
|
||||
DEBUG_printf((" day=%d, mon=\"%s\", year=%d, hour=%d, min=%d, sec=%d\n",
|
||||
day, mon, year, hour, min, sec));
|
||||
|
||||
/*
|
||||
* Convert the month name to a number from 0 to 11.
|
||||
@@ -750,7 +749,7 @@ httpGetDateTime(const char *s) /* I - Date/time string */
|
||||
if (i >= 12)
|
||||
return (0);
|
||||
|
||||
DEBUG_printf(("4httpGetDateTime: i=%d", i));
|
||||
DEBUG_printf((" i=%d\n", i));
|
||||
|
||||
/*
|
||||
* Now convert the date and time to a UNIX time value in seconds since
|
||||
@@ -763,14 +762,14 @@ httpGetDateTime(const char *s) /* I - Date/time string */
|
||||
else
|
||||
days = normal_days[i] + day - 1;
|
||||
|
||||
DEBUG_printf(("4httpGetDateTime: days=%d", days));
|
||||
DEBUG_printf((" days=%d\n", days));
|
||||
|
||||
days += (year - 1970) * 365 + /* 365 days per year (normally) */
|
||||
((year - 1) / 4 - 492) - /* + leap days */
|
||||
((year - 1) / 100 - 19) + /* - 100 year days */
|
||||
((year - 1) / 400 - 4); /* + 400 year days */
|
||||
|
||||
DEBUG_printf(("4httpGetDateTime: days=%d\n", days));
|
||||
DEBUG_printf((" days=%d\n", days));
|
||||
|
||||
return (days * 86400 + hour * 3600 + min * 60 + sec);
|
||||
}
|
||||
@@ -1089,12 +1088,6 @@ httpSeparateURI(
|
||||
* Yes, collect the port number...
|
||||
*/
|
||||
|
||||
if (!isdigit(uri[1] & 255))
|
||||
{
|
||||
*port = 0;
|
||||
return (HTTP_URI_BAD_PORT);
|
||||
}
|
||||
|
||||
*port = strtol(uri + 1, (char **)&uri, 10);
|
||||
|
||||
if (*uri != '/' && *uri)
|
||||
@@ -1210,7 +1203,6 @@ httpStatus(http_status_t status) /* I - HTTP status code */
|
||||
s = _("Bad Request");
|
||||
break;
|
||||
case HTTP_UNAUTHORIZED :
|
||||
case HTTP_AUTHORIZATION_CANCELED :
|
||||
s = _("Unauthorized");
|
||||
break;
|
||||
case HTTP_FORBIDDEN :
|
||||
@@ -1240,9 +1232,6 @@ httpStatus(http_status_t status) /* I - HTTP status code */
|
||||
case HTTP_SERVICE_UNAVAILABLE :
|
||||
s = _("Service Unavailable");
|
||||
break;
|
||||
case HTTP_SERVER_ERROR :
|
||||
s = _("Internal Server Error");
|
||||
break;
|
||||
|
||||
default :
|
||||
s = _("Unknown");
|
||||
@@ -1302,7 +1291,7 @@ _httpResolveURI(
|
||||
const char *uri, /* I - DNS-SD URI */
|
||||
char *resolved_uri, /* I - Buffer for resolved URI */
|
||||
size_t resolved_size, /* I - Size of URI buffer */
|
||||
int logit) /* I - Log progress to stderr? */
|
||||
int log) /* I - Log progress to stderr? */
|
||||
{
|
||||
char scheme[32], /* URI components... */
|
||||
userpass[256],
|
||||
@@ -1314,8 +1303,8 @@ _httpResolveURI(
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
DEBUG_printf(("4_httpResolveURI(uri=\"%s\", resolved_uri=%p, "
|
||||
"resolved_size=" CUPS_LLFMT ")", uri, resolved_uri,
|
||||
DEBUG_printf(("_httpResolveURI(uri=\"%s\", resolved_uri=%p, "
|
||||
"resolved_size=" CUPS_LLFMT ")\n", uri, resolved_uri,
|
||||
CUPS_LLCAST resolved_size));
|
||||
|
||||
/*
|
||||
@@ -1334,11 +1323,11 @@ _httpResolveURI(
|
||||
sizeof(resource)) < HTTP_URI_OK)
|
||||
#endif /* DEBUG */
|
||||
{
|
||||
if (logit)
|
||||
if (log)
|
||||
_cupsLangPrintf(stderr, _("Bad device URI \"%s\"!\n"), uri);
|
||||
|
||||
DEBUG_printf(("6_httpResolveURI: httpSeparateURI returned %d!", status));
|
||||
DEBUG_puts("5_httpResolveURI: Returning NULL");
|
||||
DEBUG_printf(("_httpResolveURI: httpSeparateURI returned %d!\n", status));
|
||||
DEBUG_puts("_httpResolveURI: Returning NULL");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1349,18 +1338,10 @@ _httpResolveURI(
|
||||
if (strstr(hostname, "._tcp"))
|
||||
{
|
||||
#ifdef HAVE_DNSSD
|
||||
DNSServiceRef ref, /* DNS-SD master service reference */
|
||||
domainref, /* DNS-SD service reference for domain */
|
||||
localref; /* DNS-SD service reference for .local */
|
||||
int domainsent = 0; /* Send the domain resolve? */
|
||||
DNSServiceRef ref; /* DNS-SD service reference */
|
||||
char *regtype, /* Pointer to type in hostname */
|
||||
*domain; /* Pointer to domain in hostname */
|
||||
_http_uribuf_t uribuf; /* URI buffer */
|
||||
struct pollfd polldata; /* Polling data */
|
||||
|
||||
|
||||
if (logit)
|
||||
fprintf(stderr, "DEBUG: Resolving \"%s\"...\n", hostname);
|
||||
|
||||
/*
|
||||
* Separate the hostname into service name, registration type, and domain...
|
||||
@@ -1381,10 +1362,14 @@ _httpResolveURI(
|
||||
|
||||
if (regtype <= hostname)
|
||||
{
|
||||
DEBUG_puts("5_httpResolveURI: Bad hostname, returning NULL");
|
||||
DEBUG_puts("_httpResolveURI: Bad hostname, returning NULL");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
domain = regtype + strlen(regtype) - 1;
|
||||
if (domain > regtype && *domain == '.')
|
||||
*domain = '\0';
|
||||
|
||||
for (domain = strchr(regtype, '.');
|
||||
domain;
|
||||
domain = strchr(domain + 1, '.'))
|
||||
@@ -1399,74 +1384,33 @@ _httpResolveURI(
|
||||
|
||||
resolved_uri[0] = '\0';
|
||||
|
||||
DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
|
||||
DEBUG_printf(("_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
|
||||
"domain=\"%s\"\n", hostname, regtype, domain));
|
||||
if (logit)
|
||||
if (log)
|
||||
{
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
fprintf(stderr, "DEBUG: Resolving \"%s\", regtype=\"%s\", "
|
||||
"domain=\"local.\"...\n", hostname, regtype);
|
||||
fprintf(stderr, "DEBUG: Resolving %s, regtype=%s, domain=%s...\n",
|
||||
hostname, regtype, domain);
|
||||
_cupsLangPuts(stderr, _("INFO: Looking for printer...\n"));
|
||||
}
|
||||
|
||||
uri = NULL;
|
||||
|
||||
if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
|
||||
if (DNSServiceResolve(&ref, 0, 0, hostname, regtype, domain,
|
||||
resolve_callback,
|
||||
&uribuf) == kDNSServiceErr_NoError)
|
||||
{
|
||||
localref = ref;
|
||||
if (DNSServiceResolve(&localref, kDNSServiceFlagsShareConnection, 0,
|
||||
hostname, regtype, "local.", resolve_callback,
|
||||
&uribuf) == kDNSServiceErr_NoError)
|
||||
{
|
||||
if (strcasecmp(domain, "local."))
|
||||
{
|
||||
/*
|
||||
* Wait 2 seconds for a response to the local resolve; if nothing comes
|
||||
* in, do an additional domain resolution...
|
||||
*/
|
||||
|
||||
polldata.fd = DNSServiceRefSockFD(ref);
|
||||
polldata.events = POLLIN;
|
||||
|
||||
if (poll(&polldata, 1, 2000) != 1)
|
||||
{
|
||||
/*
|
||||
* OK, send the domain name resolve...
|
||||
*/
|
||||
|
||||
if (logit)
|
||||
fprintf(stderr, "DEBUG: Resolving \"%s\", regtype=\"%s\", "
|
||||
"domain=\"%s\"...\n", hostname, regtype, domain);
|
||||
|
||||
domainref = ref;
|
||||
if (DNSServiceResolve(&domainref, kDNSServiceFlagsShareConnection, 0,
|
||||
hostname, regtype, domain, resolve_callback,
|
||||
&uribuf) == kDNSServiceErr_NoError)
|
||||
domainsent = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (DNSServiceProcessResult(ref) == kDNSServiceErr_NoError)
|
||||
uri = resolved_uri;
|
||||
|
||||
if (domainsent)
|
||||
DNSServiceRefDeallocate(domainref);
|
||||
|
||||
DNSServiceRefDeallocate(localref);
|
||||
}
|
||||
if (DNSServiceProcessResult(ref) != kDNSServiceErr_NoError &&
|
||||
resolved_uri[0])
|
||||
uri = NULL;
|
||||
else
|
||||
uri = resolved_uri;
|
||||
|
||||
DNSServiceRefDeallocate(ref);
|
||||
}
|
||||
else
|
||||
uri = NULL;
|
||||
|
||||
if (logit)
|
||||
{
|
||||
if (uri)
|
||||
fprintf(stderr, "DEBUG: Resolved as \"%s\"...\n", uri);
|
||||
else
|
||||
fputs("DEBUG: Unable to resolve URI!\n", stderr);
|
||||
|
||||
if (log)
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
@@ -1476,11 +1420,11 @@ _httpResolveURI(
|
||||
uri = NULL;
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
if (logit && !uri)
|
||||
if (log && !uri)
|
||||
_cupsLangPuts(stderr, _("Unable to find printer!\n"));
|
||||
}
|
||||
|
||||
DEBUG_printf(("5_httpResolveURI: Returning \"%s\"", uri));
|
||||
DEBUG_printf(("_httpResolveURI: Returning \"%s\"\n", uri));
|
||||
|
||||
return (uri);
|
||||
}
|
||||
@@ -1628,9 +1572,9 @@ resolve_callback(
|
||||
_http_uribuf_t *uribuf; /* URI buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("7resolve_callback(sdRef=%p, flags=%x, interfaceIndex=%u, "
|
||||
DEBUG_printf(("resolve_callback(sdRef=%p, flags=%x, interfaceIndex=%u, "
|
||||
"errorCode=%d, fullName=\"%s\", hostTarget=\"%s\", port=%u, "
|
||||
"txtLen=%u, txtRecord=%p, context=%p)", sdRef, flags,
|
||||
"txtLen=%u, txtRecord=%p, context=%p)\n", sdRef, flags,
|
||||
interfaceIndex, errorCode, fullName, hostTarget, port, txtLen,
|
||||
txtRecord, context));
|
||||
|
||||
@@ -1638,7 +1582,7 @@ resolve_callback(
|
||||
* Figure out the scheme from the full name...
|
||||
*/
|
||||
|
||||
if (strstr(fullName, "._ipp") || strstr(fullName, "._fax-ipp"))
|
||||
if (strstr(fullName, "._ipp"))
|
||||
scheme = "ipp";
|
||||
else if (strstr(fullName, "._printer."))
|
||||
scheme = "lpd";
|
||||
@@ -1674,7 +1618,7 @@ resolve_callback(
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, uribuf->bufsize, scheme,
|
||||
NULL, hostTarget, ntohs(port), rp);
|
||||
|
||||
DEBUG_printf(("8resolve_callback: Resolved URI is \"%s\"...",
|
||||
DEBUG_printf(("resolve_callback: Resolved URI is \"%s\"...\n",
|
||||
uribuf->buffer));
|
||||
}
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
+199
-282
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+1
-4
@@ -248,10 +248,7 @@ typedef enum http_status_e /**** HTTP status codes ****/
|
||||
HTTP_BAD_GATEWAY, /* Bad gateway */
|
||||
HTTP_SERVICE_UNAVAILABLE, /* Service is unavailable */
|
||||
HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */
|
||||
HTTP_NOT_SUPPORTED, /* HTTP version not supported */
|
||||
|
||||
HTTP_AUTHORIZATION_CANCELED = 1000 /* User cancelled authorization */
|
||||
|
||||
HTTP_NOT_SUPPORTED /* HTTP version not supported */
|
||||
} http_status_t;
|
||||
|
||||
typedef enum http_uri_status_e /**** URI separation status @since CUPS1.2@ ****/
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ __attribute__ ((__format__ (__printf__, 2, 3)))
|
||||
extern int _cupsLangPuts(FILE *fp, const char *message);
|
||||
extern const char *_cupsLangString(cups_lang_t *lang, const char *message);
|
||||
extern void _cupsMessageFree(cups_array_t *a);
|
||||
extern cups_array_t *_cupsMessageLoad(const char *filename, int unquote);
|
||||
extern cups_array_t *_cupsMessageLoad(const char *filename);
|
||||
extern const char *_cupsMessageLookup(cups_array_t *a, const char *m);
|
||||
extern void _cupsSetLocale(char *argv[]);
|
||||
|
||||
|
||||
+44
-6
@@ -4,7 +4,7 @@
|
||||
* Internet Printing Protocol support functions for the Common UNIX
|
||||
* Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -391,15 +391,53 @@ ippOpValue(const char *name) /* I - Textual name */
|
||||
int /* O - Port number */
|
||||
ippPort(void)
|
||||
{
|
||||
const char *ipp_port; /* IPP_PORT environment variable */
|
||||
struct servent *port; /* Port number info */
|
||||
int portnum; /* Port number */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
|
||||
|
||||
DEBUG_puts("ippPort()");
|
||||
|
||||
if (!cg->ipp_port)
|
||||
_cupsSetDefaults();
|
||||
{
|
||||
/*
|
||||
* See if the server definition includes the port number...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("1ippPort: Returning %d...", cg->ipp_port));
|
||||
DEBUG_puts("ippPort: Not initialized...");
|
||||
|
||||
cupsServer();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (cg->ipp_port)
|
||||
DEBUG_puts(("ippPort: Set via cupsServer()..."));
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
if (!cg->ipp_port)
|
||||
{
|
||||
if ((ipp_port = getenv("IPP_PORT")) != NULL)
|
||||
{
|
||||
DEBUG_puts("ippPort: Set via IPP_PORT...");
|
||||
portnum = atoi(ipp_port);
|
||||
}
|
||||
else if ((port = getservbyname("ipp", NULL)) == NULL)
|
||||
{
|
||||
DEBUG_puts("ippPort: Set via CUPS_DEFAULT_IPP_PORT...");
|
||||
portnum = CUPS_DEFAULT_IPP_PORT;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_puts("ippPort: Set via ipp service entry...");
|
||||
portnum = ntohs(port->s_port);
|
||||
}
|
||||
|
||||
if (portnum > 0)
|
||||
cg->ipp_port = portnum;
|
||||
}
|
||||
|
||||
DEBUG_printf(("ippPort: Returning %d...\n", cg->ipp_port));
|
||||
|
||||
return (cg->ipp_port);
|
||||
}
|
||||
@@ -412,7 +450,7 @@ ippPort(void)
|
||||
void
|
||||
ippSetPort(int p) /* I - Port number to use */
|
||||
{
|
||||
DEBUG_printf(("ippSetPort(p=%d)", p));
|
||||
DEBUG_printf(("ippSetPort(p=%d)\n", p));
|
||||
|
||||
_cupsGlobals()->ipp_port = p;
|
||||
}
|
||||
@@ -423,7 +461,7 @@ ippSetPort(int p) /* I - Port number to use */
|
||||
*
|
||||
* The returned names are defined in RFC 2911 and 3382.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4@
|
||||
*/
|
||||
|
||||
const char * /* O - Tag name */
|
||||
@@ -443,7 +481,7 @@ ippTagString(ipp_tag_t tag) /* I - Tag value */
|
||||
*
|
||||
* The tag names are defined in RFC 2911 and 3382.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
* @since CUPS 1.4@
|
||||
*/
|
||||
|
||||
ipp_tag_t /* O - Tag value */
|
||||
|
||||
+150
-158
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+2
-2
@@ -4,7 +4,7 @@
|
||||
* Internet Printing Protocol definitions for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -248,7 +248,7 @@ typedef enum ipp_op_e /**** IPP operations... ****/
|
||||
CUPS_MOVE_JOB, /* Move a job to a different printer */
|
||||
CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
CUPS_GET_PPD, /* Get a PPD file @since CUPS 1.3/Mac OS X 10.5@ */
|
||||
CUPS_GET_DOCUMENT = 0x4027 /* Get a document file @since CUPS 1.4/Mac OS X 10.6@ */
|
||||
CUPS_GET_DOCUMENT = 0x4027 /* Get a document file @since CUPS 1.4@ */
|
||||
} ipp_op_t;
|
||||
|
||||
/* Old names for the operations */
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ _cupsLangPrintError(const char *message)/* I - Message */
|
||||
* Format the message...
|
||||
*/
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "%s: %s\n",
|
||||
snprintf(buffer, sizeof(buffer), "%s: %s",
|
||||
_cupsLangString(cg->lang_default, message), strerror(last_errno));
|
||||
|
||||
/*
|
||||
|
||||
+26
-27
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* I18N/language support for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 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
|
||||
@@ -429,7 +429,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
};
|
||||
|
||||
|
||||
DEBUG_printf(("2cupsLangGet(language=\"%s\")", language));
|
||||
DEBUG_printf(("cupsLangGet(language=\"%s\")\n", language ? language : "(null)"));
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
@@ -448,7 +448,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
if ((language = getenv("LANG")) == NULL)
|
||||
language = appleLangDefault();
|
||||
|
||||
DEBUG_printf(("4cupsLangGet: language=\"%s\"", language));
|
||||
DEBUG_printf(("cupsLangGet: language=\"%s\"\n", language));
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -477,7 +477,8 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
ptr = setlocale(LC_ALL, NULL);
|
||||
# endif /* LC_MESSAGES */
|
||||
|
||||
DEBUG_printf(("4cupsLangGet: current locale is \"%s\"", ptr));
|
||||
DEBUG_printf(("cupsLangGet: current locale is \"%s\"\n",
|
||||
ptr ? ptr : "(null)"));
|
||||
|
||||
if (!ptr || !strcmp(ptr, "C") || !strcmp(ptr, "POSIX"))
|
||||
{
|
||||
@@ -525,7 +526,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
if (!strncmp(locale, "nb", 2))
|
||||
locale[1] = 'o';
|
||||
|
||||
DEBUG_printf(("4cupsLangGet: new language value is \"%s\"", language));
|
||||
DEBUG_printf(("cupsLangGet: new language value is \"%s\"\n", language));
|
||||
}
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
@@ -562,8 +563,8 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
DEBUG_printf(("4cupsLangGet: charset set to \"%s\" via "
|
||||
"nl_langinfo(CODESET)...", charset));
|
||||
DEBUG_printf(("cupsLangGet: charset set to \"%s\" via nl_langinfo(CODESET)...\n",
|
||||
charset));
|
||||
}
|
||||
#endif /* CODESET */
|
||||
|
||||
@@ -642,7 +643,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_printf(("4cupsLangGet: langname=\"%s\", country=\"%s\", charset=\"%s\"",
|
||||
DEBUG_printf(("cupsLangGet: langname=\"%s\", country=\"%s\", charset=\"%s\"\n",
|
||||
langname, country, charset));
|
||||
|
||||
/*
|
||||
@@ -680,7 +681,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_printf(("4cupsLangGet: encoding=%d(%s)", encoding,
|
||||
DEBUG_printf(("cupsLangGet: encoding=%d(%s)\n", encoding,
|
||||
encoding == CUPS_AUTO_ENCODING ? "auto" :
|
||||
lang_encodings[encoding]));
|
||||
|
||||
@@ -711,7 +712,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
DEBUG_printf(("3cupsLangGet: Using cached copy of \"%s\"...", real));
|
||||
DEBUG_printf(("cupsLangGet: Using cached copy of \"%s\"...\n", real));
|
||||
|
||||
return (lang);
|
||||
}
|
||||
@@ -731,7 +732,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* No generic localization, so use POSIX...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("4cupsLangGet: access(\"%s\", 0): %s", filename,
|
||||
DEBUG_printf(("cupsLangGet: access(\"%s\", 0): %s\n", filename,
|
||||
strerror(errno)));
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/C/cups_C.po", cg->localedir);
|
||||
@@ -790,7 +791,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* Read the strings from the file...
|
||||
*/
|
||||
|
||||
lang->strings = _cupsMessageLoad(filename, 1);
|
||||
lang->strings = _cupsMessageLoad(filename);
|
||||
|
||||
/*
|
||||
* Return...
|
||||
@@ -882,8 +883,7 @@ _cupsMessageFree(cups_array_t *a) /* I - Message array */
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - New message array */
|
||||
_cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
int unquote) /* I - Unescape \foo in strings */
|
||||
_cupsMessageLoad(const char *filename) /* I - Message catalog to load */
|
||||
{
|
||||
cups_file_t *fp; /* Message file */
|
||||
cups_array_t *a; /* Message array */
|
||||
@@ -894,7 +894,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
int length; /* Length of combined strings */
|
||||
|
||||
|
||||
DEBUG_printf(("4_cupsMessageLoad(filename=\"%s\")", filename));
|
||||
DEBUG_printf(("_cupsMessageLoad(filename=\"%s\")\n", filename));
|
||||
|
||||
/*
|
||||
* Create an array to hold the messages...
|
||||
@@ -902,7 +902,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
|
||||
if ((a = cupsArrayNew((cups_array_func_t)cups_message_compare, NULL)) == NULL)
|
||||
{
|
||||
DEBUG_puts("5_cupsMessageLoad: Unable to allocate array!");
|
||||
DEBUG_puts("_cupsMessageLoad: Unable to allocate array!");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -912,7 +912,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
|
||||
if ((fp = cupsFileOpen(filename, "r")) == NULL)
|
||||
{
|
||||
DEBUG_printf(("5_cupsMessageLoad: Unable to open file: %s",
|
||||
DEBUG_printf(("_cupsMessageLoad: Unable to open file: %s\n",
|
||||
strerror(errno)));
|
||||
return (a);
|
||||
}
|
||||
@@ -967,8 +967,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
* Unquote the text...
|
||||
*/
|
||||
|
||||
if (unquote)
|
||||
cups_unquote(ptr, ptr);
|
||||
cups_unquote(ptr, ptr);
|
||||
|
||||
/*
|
||||
* Create or add to a message...
|
||||
@@ -1067,7 +1066,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
DEBUG_printf(("5_cupsMessageLoad: Returning %d messages...",
|
||||
DEBUG_printf(("_cupsMessageLoad: Returning %d messages...\n",
|
||||
cupsArrayCount(a)));
|
||||
|
||||
return (a);
|
||||
@@ -1164,7 +1163,7 @@ appleLangDefault(void)
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(localeName);
|
||||
|
||||
DEBUG_printf(("9appleLangDefault: cg->language=\"%s\"",
|
||||
DEBUG_printf(("appleLangDefault: cg->language=\"%s\"\n",
|
||||
cg->language));
|
||||
|
||||
/*
|
||||
@@ -1178,7 +1177,7 @@ appleLangDefault(void)
|
||||
{
|
||||
if (!strcmp(cg->language, apple_language_locale[i].language))
|
||||
{
|
||||
DEBUG_printf(("9appleLangDefault: mapping \"%s\" to \"%s\"...",
|
||||
DEBUG_printf(("appleLangDefault: mapping \"%s\" to \"%s\"...\n",
|
||||
cg->language, apple_language_locale[i].locale));
|
||||
strlcpy(cg->language, apple_language_locale[i].locale,
|
||||
sizeof(cg->language));
|
||||
@@ -1231,7 +1230,7 @@ cups_cache_lookup(const char *name,/* I - Name of locale */
|
||||
cups_lang_t *lang; /* Current language */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_cache_lookup(name=\"%s\", encoding=%d(%s))", name,
|
||||
DEBUG_printf(("cups_cache_lookup(name=\"%s\", encoding=%d(%s))\n", name,
|
||||
encoding, encoding == CUPS_AUTO_ENCODING ? "auto" :
|
||||
lang_encodings[encoding]));
|
||||
|
||||
@@ -1241,8 +1240,8 @@ cups_cache_lookup(const char *name,/* I - Name of locale */
|
||||
|
||||
for (lang = lang_cache; lang != NULL; lang = lang->next)
|
||||
{
|
||||
DEBUG_printf(("9cups_cache_lookup: lang=%p, language=\"%s\", "
|
||||
"encoding=%d(%s)", lang, lang->language, lang->encoding,
|
||||
DEBUG_printf(("cups_cache_lookup: lang=%p, language=\"%s\", encoding=%d(%s)\n",
|
||||
lang, lang->language, lang->encoding,
|
||||
lang_encodings[lang->encoding]));
|
||||
|
||||
if (!strcmp(lang->language, name) &&
|
||||
@@ -1250,13 +1249,13 @@ cups_cache_lookup(const char *name,/* I - Name of locale */
|
||||
{
|
||||
lang->used ++;
|
||||
|
||||
DEBUG_puts("8cups_cache_lookup: returning match!");
|
||||
DEBUG_puts("cups_cache_lookup: returning match!");
|
||||
|
||||
return (lang);
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_puts("8cups_cache_lookup: returning NULL!");
|
||||
DEBUG_puts("cups_cache_lookup: returning NULL!");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@ __cupsMD5Init
|
||||
__cupsMessageFree
|
||||
__cupsMessageLoad
|
||||
__cupsMessageLookup
|
||||
__cupsPWGMediaByName
|
||||
__cupsPWGMediaByLegacy
|
||||
__cupsPWGMediaBySize
|
||||
__cupsSetError
|
||||
__cupsSetLocale
|
||||
__cupsSNMPClose
|
||||
@@ -140,7 +137,6 @@ _cupsFreeDests
|
||||
_cupsFreeJobs
|
||||
_cupsFreeOptions
|
||||
_cupsGetClasses
|
||||
_cupsGetConflicts
|
||||
_cupsGetDefault
|
||||
_cupsGetDefault2
|
||||
_cupsGetDest
|
||||
@@ -154,7 +150,6 @@ _cupsGetJobs2
|
||||
_cupsGetNamedDest
|
||||
_cupsGetOption
|
||||
_cupsGetPassword
|
||||
_cupsGetPassword2
|
||||
_cupsGetPPD
|
||||
_cupsGetPPD2
|
||||
_cupsGetPPD3
|
||||
@@ -189,14 +184,11 @@ _cupsSetDests
|
||||
_cupsSetDests2
|
||||
_cupsSetEncryption
|
||||
_cupsSetPasswordCB
|
||||
_cupsSetPasswordCB2
|
||||
_cupsSetServer
|
||||
_cupsSetUser
|
||||
_cupsSideChannelDoRequest
|
||||
_cupsSideChannelRead
|
||||
_cupsSideChannelWrite
|
||||
_cupsSideChannelSNMPGet
|
||||
_cupsSideChannelSNMPWalk
|
||||
_cupsStartDocument
|
||||
_cupsTempFd
|
||||
_cupsTempFile
|
||||
@@ -308,8 +300,6 @@ _ippRead
|
||||
_ippReadFile
|
||||
_ippReadIO
|
||||
_ippSetPort
|
||||
_ippTagString
|
||||
_ippTagValue
|
||||
_ippTimeToDate
|
||||
_ippWrite
|
||||
_ippWriteFile
|
||||
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário